From d6d0014c6b1989f9571eb06c1641de9946c3c980 Mon Sep 17 00:00:00 2001 From: Paolo Cretaro Date: Tue, 25 Apr 2017 15:00:50 +0200 Subject: staging: iio: tsl2x7x: Replace deprecated macros (S_IRUGO, S_IWUSR) Use octal digits as suggested by checkpatch instead of deprecated macros. Signed-off-by: Paolo Cretaro Signed-off-by: Jonathan Cameron --- drivers/staging/iio/light/tsl2x7x_core.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index af3910bc1b4f..8121a5188638 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -1498,34 +1498,34 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, return 0; } -static DEVICE_ATTR(power_state, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(power_state, 0644, tsl2x7x_power_state_show, tsl2x7x_power_state_store); -static DEVICE_ATTR(in_proximity0_calibscale_available, S_IRUGO, +static DEVICE_ATTR(in_proximity0_calibscale_available, 0444, tsl2x7x_prox_gain_available_show, NULL); -static DEVICE_ATTR(in_illuminance0_calibscale_available, S_IRUGO, +static DEVICE_ATTR(in_illuminance0_calibscale_available, 0444, tsl2x7x_gain_available_show, NULL); -static DEVICE_ATTR(in_illuminance0_integration_time, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(in_illuminance0_integration_time, 0644, tsl2x7x_als_time_show, tsl2x7x_als_time_store); -static DEVICE_ATTR(in_illuminance0_target_input, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(in_illuminance0_target_input, 0644, tsl2x7x_als_cal_target_show, tsl2x7x_als_cal_target_store); -static DEVICE_ATTR(in_illuminance0_calibrate, S_IWUSR, NULL, +static DEVICE_ATTR(in_illuminance0_calibrate, 0200, NULL, tsl2x7x_do_calibrate); -static DEVICE_ATTR(in_proximity0_calibrate, S_IWUSR, NULL, +static DEVICE_ATTR(in_proximity0_calibrate, 0200, NULL, tsl2x7x_do_prox_calibrate); -static DEVICE_ATTR(in_illuminance0_lux_table, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(in_illuminance0_lux_table, 0644, tsl2x7x_luxtable_show, tsl2x7x_luxtable_store); -static DEVICE_ATTR(in_intensity0_thresh_period, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(in_intensity0_thresh_period, 0644, tsl2x7x_als_persistence_show, tsl2x7x_als_persistence_store); -static DEVICE_ATTR(in_proximity0_thresh_period, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(in_proximity0_thresh_period, 0644, tsl2x7x_prox_persistence_show, tsl2x7x_prox_persistence_store); /* Use the default register values to identify the Taos device */ -- cgit v1.2.3-55-g7522 From e4ff6c1b41d66e929e18a9afaa7d7d5788ff3da8 Mon Sep 17 00:00:00 2001 From: Brian Masney Date: Mon, 24 Apr 2017 21:34:33 -0400 Subject: staging: iio: isl29028: correct proximity sleep times The sysfs attribute in_proximity_sampling_frequency_available currently shows the values 1 3 5 10 13 20 83 100. These values are supposed to correspond to the sleep values 800 400 200 100 75 50 12.5 0 (all in ms). When passing in a sampling frequency of 3, it actually uses a sleep time of 200ms instead of the expected 400ms value. This patch changes the value shown by this sysfs attribute to use fixed-point numbers so that the correct sampling frequency is shown to the user. This patch also changes the code that updates the proximity sampling frequency to only allow values that are shown in the _available sysfs attribute. The original code showed the value 83 that corresponds to the sleep time 12 ms. The data sheet actually lists 12.5 ms as the sleep time, so the proximity frequency was updated to 80. Signed-off-by: Brian Masney Signed-off-by: Jonathan Cameron --- drivers/staging/iio/light/isl29028.c | 70 +++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c index 5375e7a81205..aeb50825acef 100644 --- a/drivers/staging/iio/light/isl29028.c +++ b/drivers/staging/iio/light/isl29028.c @@ -64,8 +64,25 @@ #define ISL29028_POWER_OFF_DELAY_MS 2000 -static const unsigned int isl29028_prox_sleep_time[] = {800, 400, 200, 100, 75, - 50, 12, 0}; +struct isl29028_prox_data { + int sampling_int; + int sampling_fract; + int sleep_time; +}; + +static const struct isl29028_prox_data isl29028_prox_data[] = { + { 1, 250000, 800 }, + { 2, 500000, 400 }, + { 5, 0, 200 }, + { 10, 0, 100 }, + { 13, 300000, 75 }, + { 20, 0, 50 }, + { 80, 0, 13 }, /* + * Note: Data sheet lists 12.5 ms sleep time. + * Round up a half millisecond for msleep(). + */ + { 100, 0, 0 } +}; enum isl29028_als_ir_mode { ISL29028_MODE_NONE = 0, @@ -76,32 +93,37 @@ enum isl29028_als_ir_mode { struct isl29028_chip { struct mutex lock; struct regmap *regmap; - unsigned int prox_sampling; + int prox_sampling_int; + int prox_sampling_frac; bool enable_prox; int lux_scale; enum isl29028_als_ir_mode als_ir_mode; }; -static int isl29028_find_prox_sleep_time_index(int sampling) +static int isl29028_find_prox_sleep_index(int sampling_int, int sampling_fract) { - unsigned int period = DIV_ROUND_UP(1000, sampling); int i; - for (i = 0; i < ARRAY_SIZE(isl29028_prox_sleep_time); ++i) { - if (period >= isl29028_prox_sleep_time[i]) - break; + for (i = 0; i < ARRAY_SIZE(isl29028_prox_data); ++i) { + if (isl29028_prox_data[i].sampling_int == sampling_int && + isl29028_prox_data[i].sampling_fract == sampling_fract) + return i; } - return i; + return -EINVAL; } static int isl29028_set_proxim_sampling(struct isl29028_chip *chip, - unsigned int sampling) + int sampling_int, int sampling_fract) { struct device *dev = regmap_get_device(chip->regmap); int sleep_index, ret; - sleep_index = isl29028_find_prox_sleep_time_index(sampling); + sleep_index = isl29028_find_prox_sleep_index(sampling_int, + sampling_fract); + if (sleep_index < 0) + return sleep_index; + ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, ISL29028_CONF_PROX_SLP_MASK, sleep_index << ISL29028_CONF_PROX_SLP_SH); @@ -112,16 +134,18 @@ static int isl29028_set_proxim_sampling(struct isl29028_chip *chip, return ret; } - chip->prox_sampling = sampling; + chip->prox_sampling_int = sampling_int; + chip->prox_sampling_frac = sampling_fract; return ret; } static int isl29028_enable_proximity(struct isl29028_chip *chip) { - int sleep_index, ret; + int prox_index, ret; - ret = isl29028_set_proxim_sampling(chip, chip->prox_sampling); + ret = isl29028_set_proxim_sampling(chip, chip->prox_sampling_int, + chip->prox_sampling_frac); if (ret < 0) return ret; @@ -132,8 +156,12 @@ static int isl29028_enable_proximity(struct isl29028_chip *chip) return ret; /* Wait for conversion to be complete for first sample */ - sleep_index = isl29028_find_prox_sleep_time_index(chip->prox_sampling); - msleep(isl29028_prox_sleep_time[sleep_index]); + prox_index = isl29028_find_prox_sleep_index(chip->prox_sampling_int, + chip->prox_sampling_frac); + if (prox_index < 0) + return prox_index; + + msleep(isl29028_prox_data[prox_index].sleep_time); return 0; } @@ -361,7 +389,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev, break; } - ret = isl29028_set_proxim_sampling(chip, val); + ret = isl29028_set_proxim_sampling(chip, val, val2); break; case IIO_LIGHT: if (mask != IIO_CHAN_INFO_SCALE) { @@ -439,7 +467,8 @@ static int isl29028_read_raw(struct iio_dev *indio_dev, if (chan->type != IIO_PROXIMITY) break; - *val = chip->prox_sampling; + *val = chip->prox_sampling_int; + *val2 = chip->prox_sampling_frac; ret = IIO_VAL_INT; break; case IIO_CHAN_INFO_SCALE: @@ -472,7 +501,7 @@ static int isl29028_read_raw(struct iio_dev *indio_dev, } static IIO_CONST_ATTR(in_proximity_sampling_frequency_available, - "1 3 5 10 13 20 83 100"); + "1.25 2.5 5 10 13.3 20 80 100"); static IIO_CONST_ATTR(in_illuminance_scale_available, "125 2000"); #define ISL29028_CONST_ATTR(name) (&iio_const_attr_##name.dev_attr.attr) @@ -571,7 +600,8 @@ static int isl29028_probe(struct i2c_client *client, } chip->enable_prox = false; - chip->prox_sampling = 20; + chip->prox_sampling_int = 20; + chip->prox_sampling_frac = 0; chip->lux_scale = 2000; ret = regmap_write(chip->regmap, ISL29028_REG_TEST1_MODE, 0x0); -- cgit v1.2.3-55-g7522 From 105c3de1eb414d17e7b9db116f076026d2767ef6 Mon Sep 17 00:00:00 2001 From: Brian Masney Date: Mon, 24 Apr 2017 21:34:34 -0400 Subject: staging: iio: isl29028: move out of staging Move ISL29028 ALS / Proximity Sensor out of staging and into mainline. Signed-off-by: Brian Masney Signed-off-by: Jonathan Cameron --- drivers/iio/light/Kconfig | 10 + drivers/iio/light/Makefile | 1 + drivers/iio/light/isl29028.c | 723 +++++++++++++++++++++++++++++++++++ drivers/staging/iio/light/Kconfig | 10 - drivers/staging/iio/light/Makefile | 1 - drivers/staging/iio/light/isl29028.c | 723 ----------------------------------- 6 files changed, 734 insertions(+), 734 deletions(-) create mode 100644 drivers/iio/light/isl29028.c delete mode 100644 drivers/staging/iio/light/isl29028.c (limited to 'drivers/staging') diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index 33e755d8d825..2356ed9285df 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig @@ -172,6 +172,16 @@ config SENSORS_ISL29018 in lux, proximity infrared sensing and normal infrared sensing. Data from sensor is accessible via sysfs. +config SENSORS_ISL29028 + tristate "Intersil ISL29028 Concurrent Light and Proximity Sensor" + depends on I2C + select REGMAP_I2C + help + Provides driver for the Intersil's ISL29028 device. + This driver supports the sysfs interface to get the ALS, IR intensity, + Proximity value via iio. The ISL29028 provides the concurrent sensing + of ambient light and proximity. + config ISL29125 tristate "Intersil ISL29125 digital color light sensor" depends on I2C diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile index 681363c2b298..fa32fa459e2e 100644 --- a/drivers/iio/light/Makefile +++ b/drivers/iio/light/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_GP2AP020A00F) += gp2ap020a00f.o obj-$(CONFIG_HID_SENSOR_ALS) += hid-sensor-als.o obj-$(CONFIG_HID_SENSOR_PROX) += hid-sensor-prox.o obj-$(CONFIG_SENSORS_ISL29018) += isl29018.o +obj-$(CONFIG_SENSORS_ISL29028) += isl29028.o obj-$(CONFIG_ISL29125) += isl29125.o obj-$(CONFIG_JSA1212) += jsa1212.o obj-$(CONFIG_SENSORS_LM3533) += lm3533-als.o diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c new file mode 100644 index 000000000000..aeb50825acef --- /dev/null +++ b/drivers/iio/light/isl29028.c @@ -0,0 +1,723 @@ +/* + * IIO driver for the light sensor ISL29028. + * ISL29028 is Concurrent Ambient Light and Proximity Sensor + * + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2017 Brian Masney + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ISL29028_CONV_TIME_MS 100 + +#define ISL29028_REG_CONFIGURE 0x01 + +#define ISL29028_CONF_ALS_IR_MODE_ALS 0 +#define ISL29028_CONF_ALS_IR_MODE_IR BIT(0) +#define ISL29028_CONF_ALS_IR_MODE_MASK BIT(0) + +#define ISL29028_CONF_ALS_RANGE_LOW_LUX 0 +#define ISL29028_CONF_ALS_RANGE_HIGH_LUX BIT(1) +#define ISL29028_CONF_ALS_RANGE_MASK BIT(1) + +#define ISL29028_CONF_ALS_DIS 0 +#define ISL29028_CONF_ALS_EN BIT(2) +#define ISL29028_CONF_ALS_EN_MASK BIT(2) + +#define ISL29028_CONF_PROX_SLP_SH 4 +#define ISL29028_CONF_PROX_SLP_MASK (7 << ISL29028_CONF_PROX_SLP_SH) + +#define ISL29028_CONF_PROX_EN BIT(7) +#define ISL29028_CONF_PROX_EN_MASK BIT(7) + +#define ISL29028_REG_INTERRUPT 0x02 + +#define ISL29028_REG_PROX_DATA 0x08 +#define ISL29028_REG_ALSIR_L 0x09 +#define ISL29028_REG_ALSIR_U 0x0A + +#define ISL29028_REG_TEST1_MODE 0x0E +#define ISL29028_REG_TEST2_MODE 0x0F + +#define ISL29028_NUM_REGS (ISL29028_REG_TEST2_MODE + 1) + +#define ISL29028_POWER_OFF_DELAY_MS 2000 + +struct isl29028_prox_data { + int sampling_int; + int sampling_fract; + int sleep_time; +}; + +static const struct isl29028_prox_data isl29028_prox_data[] = { + { 1, 250000, 800 }, + { 2, 500000, 400 }, + { 5, 0, 200 }, + { 10, 0, 100 }, + { 13, 300000, 75 }, + { 20, 0, 50 }, + { 80, 0, 13 }, /* + * Note: Data sheet lists 12.5 ms sleep time. + * Round up a half millisecond for msleep(). + */ + { 100, 0, 0 } +}; + +enum isl29028_als_ir_mode { + ISL29028_MODE_NONE = 0, + ISL29028_MODE_ALS, + ISL29028_MODE_IR, +}; + +struct isl29028_chip { + struct mutex lock; + struct regmap *regmap; + int prox_sampling_int; + int prox_sampling_frac; + bool enable_prox; + int lux_scale; + enum isl29028_als_ir_mode als_ir_mode; +}; + +static int isl29028_find_prox_sleep_index(int sampling_int, int sampling_fract) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(isl29028_prox_data); ++i) { + if (isl29028_prox_data[i].sampling_int == sampling_int && + isl29028_prox_data[i].sampling_fract == sampling_fract) + return i; + } + + return -EINVAL; +} + +static int isl29028_set_proxim_sampling(struct isl29028_chip *chip, + int sampling_int, int sampling_fract) +{ + struct device *dev = regmap_get_device(chip->regmap); + int sleep_index, ret; + + sleep_index = isl29028_find_prox_sleep_index(sampling_int, + sampling_fract); + if (sleep_index < 0) + return sleep_index; + + ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, + ISL29028_CONF_PROX_SLP_MASK, + sleep_index << ISL29028_CONF_PROX_SLP_SH); + + if (ret < 0) { + dev_err(dev, "%s(): Error %d setting the proximity sampling\n", + __func__, ret); + return ret; + } + + chip->prox_sampling_int = sampling_int; + chip->prox_sampling_frac = sampling_fract; + + return ret; +} + +static int isl29028_enable_proximity(struct isl29028_chip *chip) +{ + int prox_index, ret; + + ret = isl29028_set_proxim_sampling(chip, chip->prox_sampling_int, + chip->prox_sampling_frac); + if (ret < 0) + return ret; + + ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, + ISL29028_CONF_PROX_EN_MASK, + ISL29028_CONF_PROX_EN); + if (ret < 0) + return ret; + + /* Wait for conversion to be complete for first sample */ + prox_index = isl29028_find_prox_sleep_index(chip->prox_sampling_int, + chip->prox_sampling_frac); + if (prox_index < 0) + return prox_index; + + msleep(isl29028_prox_data[prox_index].sleep_time); + + return 0; +} + +static int isl29028_set_als_scale(struct isl29028_chip *chip, int lux_scale) +{ + struct device *dev = regmap_get_device(chip->regmap); + int val = (lux_scale == 2000) ? ISL29028_CONF_ALS_RANGE_HIGH_LUX : + ISL29028_CONF_ALS_RANGE_LOW_LUX; + int ret; + + ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, + ISL29028_CONF_ALS_RANGE_MASK, val); + if (ret < 0) { + dev_err(dev, "%s(): Error %d setting the ALS scale\n", __func__, + ret); + return ret; + } + + chip->lux_scale = lux_scale; + + return ret; +} + +static int isl29028_set_als_ir_mode(struct isl29028_chip *chip, + enum isl29028_als_ir_mode mode) +{ + int ret; + + if (chip->als_ir_mode == mode) + return 0; + + ret = isl29028_set_als_scale(chip, chip->lux_scale); + if (ret < 0) + return ret; + + switch (mode) { + case ISL29028_MODE_ALS: + ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, + ISL29028_CONF_ALS_IR_MODE_MASK, + ISL29028_CONF_ALS_IR_MODE_ALS); + if (ret < 0) + return ret; + + ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, + ISL29028_CONF_ALS_RANGE_MASK, + ISL29028_CONF_ALS_RANGE_HIGH_LUX); + break; + case ISL29028_MODE_IR: + ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, + ISL29028_CONF_ALS_IR_MODE_MASK, + ISL29028_CONF_ALS_IR_MODE_IR); + break; + case ISL29028_MODE_NONE: + return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, + ISL29028_CONF_ALS_EN_MASK, + ISL29028_CONF_ALS_DIS); + } + + if (ret < 0) + return ret; + + /* Enable the ALS/IR */ + ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, + ISL29028_CONF_ALS_EN_MASK, + ISL29028_CONF_ALS_EN); + if (ret < 0) + return ret; + + /* Need to wait for conversion time if ALS/IR mode enabled */ + msleep(ISL29028_CONV_TIME_MS); + + chip->als_ir_mode = mode; + + return 0; +} + +static int isl29028_read_als_ir(struct isl29028_chip *chip, int *als_ir) +{ + struct device *dev = regmap_get_device(chip->regmap); + unsigned int lsb; + unsigned int msb; + int ret; + + ret = regmap_read(chip->regmap, ISL29028_REG_ALSIR_L, &lsb); + if (ret < 0) { + dev_err(dev, + "%s(): Error %d reading register ALSIR_L\n", + __func__, ret); + return ret; + } + + ret = regmap_read(chip->regmap, ISL29028_REG_ALSIR_U, &msb); + if (ret < 0) { + dev_err(dev, + "%s(): Error %d reading register ALSIR_U\n", + __func__, ret); + return ret; + } + + *als_ir = ((msb & 0xF) << 8) | (lsb & 0xFF); + + return 0; +} + +static int isl29028_read_proxim(struct isl29028_chip *chip, int *prox) +{ + struct device *dev = regmap_get_device(chip->regmap); + unsigned int data; + int ret; + + if (!chip->enable_prox) { + ret = isl29028_enable_proximity(chip); + if (ret < 0) + return ret; + + chip->enable_prox = true; + } + + ret = regmap_read(chip->regmap, ISL29028_REG_PROX_DATA, &data); + if (ret < 0) { + dev_err(dev, "%s(): Error %d reading register PROX_DATA\n", + __func__, ret); + return ret; + } + + *prox = data; + + return 0; +} + +static int isl29028_als_get(struct isl29028_chip *chip, int *als_data) +{ + struct device *dev = regmap_get_device(chip->regmap); + int ret; + int als_ir_data; + + ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS); + if (ret < 0) { + dev_err(dev, "%s(): Error %d enabling ALS mode\n", __func__, + ret); + return ret; + } + + ret = isl29028_read_als_ir(chip, &als_ir_data); + if (ret < 0) + return ret; + + /* + * convert als data count to lux. + * if lux_scale = 125, lux = count * 0.031 + * if lux_scale = 2000, lux = count * 0.49 + */ + if (chip->lux_scale == 125) + als_ir_data = (als_ir_data * 31) / 1000; + else + als_ir_data = (als_ir_data * 49) / 100; + + *als_data = als_ir_data; + + return 0; +} + +static int isl29028_ir_get(struct isl29028_chip *chip, int *ir_data) +{ + struct device *dev = regmap_get_device(chip->regmap); + int ret; + + ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR); + if (ret < 0) { + dev_err(dev, "%s(): Error %d enabling IR mode\n", __func__, + ret); + return ret; + } + + return isl29028_read_als_ir(chip, ir_data); +} + +static int isl29028_set_pm_runtime_busy(struct isl29028_chip *chip, bool on) +{ + struct device *dev = regmap_get_device(chip->regmap); + int ret; + + if (on) { + ret = pm_runtime_get_sync(dev); + if (ret < 0) + pm_runtime_put_noidle(dev); + } else { + pm_runtime_mark_last_busy(dev); + ret = pm_runtime_put_autosuspend(dev); + } + + return ret; +} + +/* Channel IO */ +static int isl29028_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long mask) +{ + struct isl29028_chip *chip = iio_priv(indio_dev); + struct device *dev = regmap_get_device(chip->regmap); + int ret; + + ret = isl29028_set_pm_runtime_busy(chip, true); + if (ret < 0) + return ret; + + mutex_lock(&chip->lock); + + ret = -EINVAL; + switch (chan->type) { + case IIO_PROXIMITY: + if (mask != IIO_CHAN_INFO_SAMP_FREQ) { + dev_err(dev, + "%s(): proximity: Mask value 0x%08lx is not supported\n", + __func__, mask); + break; + } + + if (val < 1 || val > 100) { + dev_err(dev, + "%s(): proximity: Sampling frequency %d is not in the range [1:100]\n", + __func__, val); + break; + } + + ret = isl29028_set_proxim_sampling(chip, val, val2); + break; + case IIO_LIGHT: + if (mask != IIO_CHAN_INFO_SCALE) { + dev_err(dev, + "%s(): light: Mask value 0x%08lx is not supported\n", + __func__, mask); + break; + } + + if (val != 125 && val != 2000) { + dev_err(dev, + "%s(): light: Lux scale %d is not in the set {125, 2000}\n", + __func__, val); + break; + } + + ret = isl29028_set_als_scale(chip, val); + break; + default: + dev_err(dev, "%s(): Unsupported channel type %x\n", + __func__, chan->type); + break; + } + + mutex_unlock(&chip->lock); + + if (ret < 0) + return ret; + + ret = isl29028_set_pm_runtime_busy(chip, false); + if (ret < 0) + return ret; + + return ret; +} + +static int isl29028_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct isl29028_chip *chip = iio_priv(indio_dev); + struct device *dev = regmap_get_device(chip->regmap); + int ret, pm_ret; + + ret = isl29028_set_pm_runtime_busy(chip, true); + if (ret < 0) + return ret; + + mutex_lock(&chip->lock); + + ret = -EINVAL; + switch (mask) { + case IIO_CHAN_INFO_RAW: + case IIO_CHAN_INFO_PROCESSED: + switch (chan->type) { + case IIO_LIGHT: + ret = isl29028_als_get(chip, val); + break; + case IIO_INTENSITY: + ret = isl29028_ir_get(chip, val); + break; + case IIO_PROXIMITY: + ret = isl29028_read_proxim(chip, val); + break; + default: + break; + } + + if (ret < 0) + break; + + ret = IIO_VAL_INT; + break; + case IIO_CHAN_INFO_SAMP_FREQ: + if (chan->type != IIO_PROXIMITY) + break; + + *val = chip->prox_sampling_int; + *val2 = chip->prox_sampling_frac; + ret = IIO_VAL_INT; + break; + case IIO_CHAN_INFO_SCALE: + if (chan->type != IIO_LIGHT) + break; + *val = chip->lux_scale; + ret = IIO_VAL_INT; + break; + default: + dev_err(dev, "%s(): mask value 0x%08lx is not supported\n", + __func__, mask); + break; + } + + mutex_unlock(&chip->lock); + + if (ret < 0) + return ret; + + /** + * Preserve the ret variable if the call to + * isl29028_set_pm_runtime_busy() is successful so the reading + * (if applicable) is returned to user space. + */ + pm_ret = isl29028_set_pm_runtime_busy(chip, false); + if (pm_ret < 0) + return pm_ret; + + return ret; +} + +static IIO_CONST_ATTR(in_proximity_sampling_frequency_available, + "1.25 2.5 5 10 13.3 20 80 100"); +static IIO_CONST_ATTR(in_illuminance_scale_available, "125 2000"); + +#define ISL29028_CONST_ATTR(name) (&iio_const_attr_##name.dev_attr.attr) +static struct attribute *isl29028_attributes[] = { + ISL29028_CONST_ATTR(in_proximity_sampling_frequency_available), + ISL29028_CONST_ATTR(in_illuminance_scale_available), + NULL, +}; + +static const struct attribute_group isl29108_group = { + .attrs = isl29028_attributes, +}; + +static const struct iio_chan_spec isl29028_channels[] = { + { + .type = IIO_LIGHT, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) | + BIT(IIO_CHAN_INFO_SCALE), + }, { + .type = IIO_INTENSITY, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_PROXIMITY, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SAMP_FREQ), + } +}; + +static const struct iio_info isl29028_info = { + .attrs = &isl29108_group, + .driver_module = THIS_MODULE, + .read_raw = isl29028_read_raw, + .write_raw = isl29028_write_raw, +}; + +static int isl29028_clear_configure_reg(struct isl29028_chip *chip) +{ + struct device *dev = regmap_get_device(chip->regmap); + int ret; + + ret = regmap_write(chip->regmap, ISL29028_REG_CONFIGURE, 0x0); + if (ret < 0) + dev_err(dev, "%s(): Error %d clearing the CONFIGURE register\n", + __func__, ret); + + chip->als_ir_mode = ISL29028_MODE_NONE; + chip->enable_prox = false; + + return ret; +} + +static bool isl29028_is_volatile_reg(struct device *dev, unsigned int reg) +{ + switch (reg) { + case ISL29028_REG_INTERRUPT: + case ISL29028_REG_PROX_DATA: + case ISL29028_REG_ALSIR_L: + case ISL29028_REG_ALSIR_U: + return true; + default: + return false; + } +} + +static const struct regmap_config isl29028_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .volatile_reg = isl29028_is_volatile_reg, + .max_register = ISL29028_NUM_REGS - 1, + .num_reg_defaults_raw = ISL29028_NUM_REGS, + .cache_type = REGCACHE_RBTREE, +}; + +static int isl29028_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct isl29028_chip *chip; + struct iio_dev *indio_dev; + int ret; + + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); + if (!indio_dev) + return -ENOMEM; + + chip = iio_priv(indio_dev); + + i2c_set_clientdata(client, indio_dev); + mutex_init(&chip->lock); + + chip->regmap = devm_regmap_init_i2c(client, &isl29028_regmap_config); + if (IS_ERR(chip->regmap)) { + ret = PTR_ERR(chip->regmap); + dev_err(&client->dev, "%s: Error %d initializing regmap\n", + __func__, ret); + return ret; + } + + chip->enable_prox = false; + chip->prox_sampling_int = 20; + chip->prox_sampling_frac = 0; + chip->lux_scale = 2000; + + ret = regmap_write(chip->regmap, ISL29028_REG_TEST1_MODE, 0x0); + if (ret < 0) { + dev_err(&client->dev, + "%s(): Error %d writing to TEST1_MODE register\n", + __func__, ret); + return ret; + } + + ret = regmap_write(chip->regmap, ISL29028_REG_TEST2_MODE, 0x0); + if (ret < 0) { + dev_err(&client->dev, + "%s(): Error %d writing to TEST2_MODE register\n", + __func__, ret); + return ret; + } + + ret = isl29028_clear_configure_reg(chip); + if (ret < 0) + return ret; + + indio_dev->info = &isl29028_info; + indio_dev->channels = isl29028_channels; + indio_dev->num_channels = ARRAY_SIZE(isl29028_channels); + indio_dev->name = id->name; + indio_dev->dev.parent = &client->dev; + indio_dev->modes = INDIO_DIRECT_MODE; + + pm_runtime_enable(&client->dev); + pm_runtime_set_autosuspend_delay(&client->dev, + ISL29028_POWER_OFF_DELAY_MS); + pm_runtime_use_autosuspend(&client->dev); + + ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); + if (ret < 0) { + dev_err(&client->dev, + "%s(): iio registration failed with error %d\n", + __func__, ret); + return ret; + } + + return 0; +} + +static int isl29028_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct isl29028_chip *chip = 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); + + return isl29028_clear_configure_reg(chip); +} + +static int __maybe_unused isl29028_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + struct isl29028_chip *chip = iio_priv(indio_dev); + int ret; + + mutex_lock(&chip->lock); + + ret = isl29028_clear_configure_reg(chip); + + mutex_unlock(&chip->lock); + + return ret; +} + +static int __maybe_unused isl29028_resume(struct device *dev) +{ + /** + * The specific component (ALS/IR or proximity) will enable itself as + * needed the next time that the user requests a reading. This is done + * above in isl29028_set_als_ir_mode() and isl29028_enable_proximity(). + */ + return 0; +} + +static const struct dev_pm_ops isl29028_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) + SET_RUNTIME_PM_OPS(isl29028_suspend, isl29028_resume, NULL) +}; + +static const struct i2c_device_id isl29028_id[] = { + {"isl29028", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, isl29028_id); + +static const struct of_device_id isl29028_of_match[] = { + { .compatible = "isl,isl29028", }, /* for backward compat., don't use */ + { .compatible = "isil,isl29028", }, + { }, +}; +MODULE_DEVICE_TABLE(of, isl29028_of_match); + +static struct i2c_driver isl29028_driver = { + .driver = { + .name = "isl29028", + .pm = &isl29028_pm_ops, + .of_match_table = isl29028_of_match, + }, + .probe = isl29028_probe, + .remove = isl29028_remove, + .id_table = isl29028_id, +}; + +module_i2c_driver(isl29028_driver); + +MODULE_DESCRIPTION("ISL29028 Ambient Light and Proximity Sensor driver"); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Laxman Dewangan "); diff --git a/drivers/staging/iio/light/Kconfig b/drivers/staging/iio/light/Kconfig index 4fbf6298c0f3..aacb0ae58c0e 100644 --- a/drivers/staging/iio/light/Kconfig +++ b/drivers/staging/iio/light/Kconfig @@ -3,16 +3,6 @@ # menu "Light sensors" -config SENSORS_ISL29028 - tristate "Intersil ISL29028 Concurrent Light and Proximity Sensor" - depends on I2C - select REGMAP_I2C - help - Provides driver for the Intersil's ISL29028 device. - This driver supports the sysfs interface to get the ALS, IR intensity, - Proximity value via iio. The ISL29028 provides the concurrent sensing - of ambient light and proximity. - config TSL2x7x tristate "TAOS TSL/TMD2x71 and TSL/TMD2x72 Family of light and proximity sensors" depends on I2C diff --git a/drivers/staging/iio/light/Makefile b/drivers/staging/iio/light/Makefile index f8693e9fdc94..10286c3ee6fe 100644 --- a/drivers/staging/iio/light/Makefile +++ b/drivers/staging/iio/light/Makefile @@ -2,5 +2,4 @@ # Makefile for industrial I/O Light sensors # -obj-$(CONFIG_SENSORS_ISL29028) += isl29028.o obj-$(CONFIG_TSL2x7x) += tsl2x7x_core.o diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c deleted file mode 100644 index aeb50825acef..000000000000 --- a/drivers/staging/iio/light/isl29028.c +++ /dev/null @@ -1,723 +0,0 @@ -/* - * IIO driver for the light sensor ISL29028. - * ISL29028 is Concurrent Ambient Light and Proximity Sensor - * - * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. - * Copyright (c) 2016-2017 Brian Masney - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ISL29028_CONV_TIME_MS 100 - -#define ISL29028_REG_CONFIGURE 0x01 - -#define ISL29028_CONF_ALS_IR_MODE_ALS 0 -#define ISL29028_CONF_ALS_IR_MODE_IR BIT(0) -#define ISL29028_CONF_ALS_IR_MODE_MASK BIT(0) - -#define ISL29028_CONF_ALS_RANGE_LOW_LUX 0 -#define ISL29028_CONF_ALS_RANGE_HIGH_LUX BIT(1) -#define ISL29028_CONF_ALS_RANGE_MASK BIT(1) - -#define ISL29028_CONF_ALS_DIS 0 -#define ISL29028_CONF_ALS_EN BIT(2) -#define ISL29028_CONF_ALS_EN_MASK BIT(2) - -#define ISL29028_CONF_PROX_SLP_SH 4 -#define ISL29028_CONF_PROX_SLP_MASK (7 << ISL29028_CONF_PROX_SLP_SH) - -#define ISL29028_CONF_PROX_EN BIT(7) -#define ISL29028_CONF_PROX_EN_MASK BIT(7) - -#define ISL29028_REG_INTERRUPT 0x02 - -#define ISL29028_REG_PROX_DATA 0x08 -#define ISL29028_REG_ALSIR_L 0x09 -#define ISL29028_REG_ALSIR_U 0x0A - -#define ISL29028_REG_TEST1_MODE 0x0E -#define ISL29028_REG_TEST2_MODE 0x0F - -#define ISL29028_NUM_REGS (ISL29028_REG_TEST2_MODE + 1) - -#define ISL29028_POWER_OFF_DELAY_MS 2000 - -struct isl29028_prox_data { - int sampling_int; - int sampling_fract; - int sleep_time; -}; - -static const struct isl29028_prox_data isl29028_prox_data[] = { - { 1, 250000, 800 }, - { 2, 500000, 400 }, - { 5, 0, 200 }, - { 10, 0, 100 }, - { 13, 300000, 75 }, - { 20, 0, 50 }, - { 80, 0, 13 }, /* - * Note: Data sheet lists 12.5 ms sleep time. - * Round up a half millisecond for msleep(). - */ - { 100, 0, 0 } -}; - -enum isl29028_als_ir_mode { - ISL29028_MODE_NONE = 0, - ISL29028_MODE_ALS, - ISL29028_MODE_IR, -}; - -struct isl29028_chip { - struct mutex lock; - struct regmap *regmap; - int prox_sampling_int; - int prox_sampling_frac; - bool enable_prox; - int lux_scale; - enum isl29028_als_ir_mode als_ir_mode; -}; - -static int isl29028_find_prox_sleep_index(int sampling_int, int sampling_fract) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(isl29028_prox_data); ++i) { - if (isl29028_prox_data[i].sampling_int == sampling_int && - isl29028_prox_data[i].sampling_fract == sampling_fract) - return i; - } - - return -EINVAL; -} - -static int isl29028_set_proxim_sampling(struct isl29028_chip *chip, - int sampling_int, int sampling_fract) -{ - struct device *dev = regmap_get_device(chip->regmap); - int sleep_index, ret; - - sleep_index = isl29028_find_prox_sleep_index(sampling_int, - sampling_fract); - if (sleep_index < 0) - return sleep_index; - - ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - ISL29028_CONF_PROX_SLP_MASK, - sleep_index << ISL29028_CONF_PROX_SLP_SH); - - if (ret < 0) { - dev_err(dev, "%s(): Error %d setting the proximity sampling\n", - __func__, ret); - return ret; - } - - chip->prox_sampling_int = sampling_int; - chip->prox_sampling_frac = sampling_fract; - - return ret; -} - -static int isl29028_enable_proximity(struct isl29028_chip *chip) -{ - int prox_index, ret; - - ret = isl29028_set_proxim_sampling(chip, chip->prox_sampling_int, - chip->prox_sampling_frac); - if (ret < 0) - return ret; - - ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - ISL29028_CONF_PROX_EN_MASK, - ISL29028_CONF_PROX_EN); - if (ret < 0) - return ret; - - /* Wait for conversion to be complete for first sample */ - prox_index = isl29028_find_prox_sleep_index(chip->prox_sampling_int, - chip->prox_sampling_frac); - if (prox_index < 0) - return prox_index; - - msleep(isl29028_prox_data[prox_index].sleep_time); - - return 0; -} - -static int isl29028_set_als_scale(struct isl29028_chip *chip, int lux_scale) -{ - struct device *dev = regmap_get_device(chip->regmap); - int val = (lux_scale == 2000) ? ISL29028_CONF_ALS_RANGE_HIGH_LUX : - ISL29028_CONF_ALS_RANGE_LOW_LUX; - int ret; - - ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - ISL29028_CONF_ALS_RANGE_MASK, val); - if (ret < 0) { - dev_err(dev, "%s(): Error %d setting the ALS scale\n", __func__, - ret); - return ret; - } - - chip->lux_scale = lux_scale; - - return ret; -} - -static int isl29028_set_als_ir_mode(struct isl29028_chip *chip, - enum isl29028_als_ir_mode mode) -{ - int ret; - - if (chip->als_ir_mode == mode) - return 0; - - ret = isl29028_set_als_scale(chip, chip->lux_scale); - if (ret < 0) - return ret; - - switch (mode) { - case ISL29028_MODE_ALS: - ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - ISL29028_CONF_ALS_IR_MODE_MASK, - ISL29028_CONF_ALS_IR_MODE_ALS); - if (ret < 0) - return ret; - - ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - ISL29028_CONF_ALS_RANGE_MASK, - ISL29028_CONF_ALS_RANGE_HIGH_LUX); - break; - case ISL29028_MODE_IR: - ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - ISL29028_CONF_ALS_IR_MODE_MASK, - ISL29028_CONF_ALS_IR_MODE_IR); - break; - case ISL29028_MODE_NONE: - return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - ISL29028_CONF_ALS_EN_MASK, - ISL29028_CONF_ALS_DIS); - } - - if (ret < 0) - return ret; - - /* Enable the ALS/IR */ - ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - ISL29028_CONF_ALS_EN_MASK, - ISL29028_CONF_ALS_EN); - if (ret < 0) - return ret; - - /* Need to wait for conversion time if ALS/IR mode enabled */ - msleep(ISL29028_CONV_TIME_MS); - - chip->als_ir_mode = mode; - - return 0; -} - -static int isl29028_read_als_ir(struct isl29028_chip *chip, int *als_ir) -{ - struct device *dev = regmap_get_device(chip->regmap); - unsigned int lsb; - unsigned int msb; - int ret; - - ret = regmap_read(chip->regmap, ISL29028_REG_ALSIR_L, &lsb); - if (ret < 0) { - dev_err(dev, - "%s(): Error %d reading register ALSIR_L\n", - __func__, ret); - return ret; - } - - ret = regmap_read(chip->regmap, ISL29028_REG_ALSIR_U, &msb); - if (ret < 0) { - dev_err(dev, - "%s(): Error %d reading register ALSIR_U\n", - __func__, ret); - return ret; - } - - *als_ir = ((msb & 0xF) << 8) | (lsb & 0xFF); - - return 0; -} - -static int isl29028_read_proxim(struct isl29028_chip *chip, int *prox) -{ - struct device *dev = regmap_get_device(chip->regmap); - unsigned int data; - int ret; - - if (!chip->enable_prox) { - ret = isl29028_enable_proximity(chip); - if (ret < 0) - return ret; - - chip->enable_prox = true; - } - - ret = regmap_read(chip->regmap, ISL29028_REG_PROX_DATA, &data); - if (ret < 0) { - dev_err(dev, "%s(): Error %d reading register PROX_DATA\n", - __func__, ret); - return ret; - } - - *prox = data; - - return 0; -} - -static int isl29028_als_get(struct isl29028_chip *chip, int *als_data) -{ - struct device *dev = regmap_get_device(chip->regmap); - int ret; - int als_ir_data; - - ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS); - if (ret < 0) { - dev_err(dev, "%s(): Error %d enabling ALS mode\n", __func__, - ret); - return ret; - } - - ret = isl29028_read_als_ir(chip, &als_ir_data); - if (ret < 0) - return ret; - - /* - * convert als data count to lux. - * if lux_scale = 125, lux = count * 0.031 - * if lux_scale = 2000, lux = count * 0.49 - */ - if (chip->lux_scale == 125) - als_ir_data = (als_ir_data * 31) / 1000; - else - als_ir_data = (als_ir_data * 49) / 100; - - *als_data = als_ir_data; - - return 0; -} - -static int isl29028_ir_get(struct isl29028_chip *chip, int *ir_data) -{ - struct device *dev = regmap_get_device(chip->regmap); - int ret; - - ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR); - if (ret < 0) { - dev_err(dev, "%s(): Error %d enabling IR mode\n", __func__, - ret); - return ret; - } - - return isl29028_read_als_ir(chip, ir_data); -} - -static int isl29028_set_pm_runtime_busy(struct isl29028_chip *chip, bool on) -{ - struct device *dev = regmap_get_device(chip->regmap); - int ret; - - if (on) { - ret = pm_runtime_get_sync(dev); - if (ret < 0) - pm_runtime_put_noidle(dev); - } else { - pm_runtime_mark_last_busy(dev); - ret = pm_runtime_put_autosuspend(dev); - } - - return ret; -} - -/* Channel IO */ -static int isl29028_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, int val2, long mask) -{ - struct isl29028_chip *chip = iio_priv(indio_dev); - struct device *dev = regmap_get_device(chip->regmap); - int ret; - - ret = isl29028_set_pm_runtime_busy(chip, true); - if (ret < 0) - return ret; - - mutex_lock(&chip->lock); - - ret = -EINVAL; - switch (chan->type) { - case IIO_PROXIMITY: - if (mask != IIO_CHAN_INFO_SAMP_FREQ) { - dev_err(dev, - "%s(): proximity: Mask value 0x%08lx is not supported\n", - __func__, mask); - break; - } - - if (val < 1 || val > 100) { - dev_err(dev, - "%s(): proximity: Sampling frequency %d is not in the range [1:100]\n", - __func__, val); - break; - } - - ret = isl29028_set_proxim_sampling(chip, val, val2); - break; - case IIO_LIGHT: - if (mask != IIO_CHAN_INFO_SCALE) { - dev_err(dev, - "%s(): light: Mask value 0x%08lx is not supported\n", - __func__, mask); - break; - } - - if (val != 125 && val != 2000) { - dev_err(dev, - "%s(): light: Lux scale %d is not in the set {125, 2000}\n", - __func__, val); - break; - } - - ret = isl29028_set_als_scale(chip, val); - break; - default: - dev_err(dev, "%s(): Unsupported channel type %x\n", - __func__, chan->type); - break; - } - - mutex_unlock(&chip->lock); - - if (ret < 0) - return ret; - - ret = isl29028_set_pm_runtime_busy(chip, false); - if (ret < 0) - return ret; - - return ret; -} - -static int isl29028_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, int *val2, long mask) -{ - struct isl29028_chip *chip = iio_priv(indio_dev); - struct device *dev = regmap_get_device(chip->regmap); - int ret, pm_ret; - - ret = isl29028_set_pm_runtime_busy(chip, true); - if (ret < 0) - return ret; - - mutex_lock(&chip->lock); - - ret = -EINVAL; - switch (mask) { - case IIO_CHAN_INFO_RAW: - case IIO_CHAN_INFO_PROCESSED: - switch (chan->type) { - case IIO_LIGHT: - ret = isl29028_als_get(chip, val); - break; - case IIO_INTENSITY: - ret = isl29028_ir_get(chip, val); - break; - case IIO_PROXIMITY: - ret = isl29028_read_proxim(chip, val); - break; - default: - break; - } - - if (ret < 0) - break; - - ret = IIO_VAL_INT; - break; - case IIO_CHAN_INFO_SAMP_FREQ: - if (chan->type != IIO_PROXIMITY) - break; - - *val = chip->prox_sampling_int; - *val2 = chip->prox_sampling_frac; - ret = IIO_VAL_INT; - break; - case IIO_CHAN_INFO_SCALE: - if (chan->type != IIO_LIGHT) - break; - *val = chip->lux_scale; - ret = IIO_VAL_INT; - break; - default: - dev_err(dev, "%s(): mask value 0x%08lx is not supported\n", - __func__, mask); - break; - } - - mutex_unlock(&chip->lock); - - if (ret < 0) - return ret; - - /** - * Preserve the ret variable if the call to - * isl29028_set_pm_runtime_busy() is successful so the reading - * (if applicable) is returned to user space. - */ - pm_ret = isl29028_set_pm_runtime_busy(chip, false); - if (pm_ret < 0) - return pm_ret; - - return ret; -} - -static IIO_CONST_ATTR(in_proximity_sampling_frequency_available, - "1.25 2.5 5 10 13.3 20 80 100"); -static IIO_CONST_ATTR(in_illuminance_scale_available, "125 2000"); - -#define ISL29028_CONST_ATTR(name) (&iio_const_attr_##name.dev_attr.attr) -static struct attribute *isl29028_attributes[] = { - ISL29028_CONST_ATTR(in_proximity_sampling_frequency_available), - ISL29028_CONST_ATTR(in_illuminance_scale_available), - NULL, -}; - -static const struct attribute_group isl29108_group = { - .attrs = isl29028_attributes, -}; - -static const struct iio_chan_spec isl29028_channels[] = { - { - .type = IIO_LIGHT, - .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) | - BIT(IIO_CHAN_INFO_SCALE), - }, { - .type = IIO_INTENSITY, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - }, { - .type = IIO_PROXIMITY, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_SAMP_FREQ), - } -}; - -static const struct iio_info isl29028_info = { - .attrs = &isl29108_group, - .driver_module = THIS_MODULE, - .read_raw = isl29028_read_raw, - .write_raw = isl29028_write_raw, -}; - -static int isl29028_clear_configure_reg(struct isl29028_chip *chip) -{ - struct device *dev = regmap_get_device(chip->regmap); - int ret; - - ret = regmap_write(chip->regmap, ISL29028_REG_CONFIGURE, 0x0); - if (ret < 0) - dev_err(dev, "%s(): Error %d clearing the CONFIGURE register\n", - __func__, ret); - - chip->als_ir_mode = ISL29028_MODE_NONE; - chip->enable_prox = false; - - return ret; -} - -static bool isl29028_is_volatile_reg(struct device *dev, unsigned int reg) -{ - switch (reg) { - case ISL29028_REG_INTERRUPT: - case ISL29028_REG_PROX_DATA: - case ISL29028_REG_ALSIR_L: - case ISL29028_REG_ALSIR_U: - return true; - default: - return false; - } -} - -static const struct regmap_config isl29028_regmap_config = { - .reg_bits = 8, - .val_bits = 8, - .volatile_reg = isl29028_is_volatile_reg, - .max_register = ISL29028_NUM_REGS - 1, - .num_reg_defaults_raw = ISL29028_NUM_REGS, - .cache_type = REGCACHE_RBTREE, -}; - -static int isl29028_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct isl29028_chip *chip; - struct iio_dev *indio_dev; - int ret; - - indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); - if (!indio_dev) - return -ENOMEM; - - chip = iio_priv(indio_dev); - - i2c_set_clientdata(client, indio_dev); - mutex_init(&chip->lock); - - chip->regmap = devm_regmap_init_i2c(client, &isl29028_regmap_config); - if (IS_ERR(chip->regmap)) { - ret = PTR_ERR(chip->regmap); - dev_err(&client->dev, "%s: Error %d initializing regmap\n", - __func__, ret); - return ret; - } - - chip->enable_prox = false; - chip->prox_sampling_int = 20; - chip->prox_sampling_frac = 0; - chip->lux_scale = 2000; - - ret = regmap_write(chip->regmap, ISL29028_REG_TEST1_MODE, 0x0); - if (ret < 0) { - dev_err(&client->dev, - "%s(): Error %d writing to TEST1_MODE register\n", - __func__, ret); - return ret; - } - - ret = regmap_write(chip->regmap, ISL29028_REG_TEST2_MODE, 0x0); - if (ret < 0) { - dev_err(&client->dev, - "%s(): Error %d writing to TEST2_MODE register\n", - __func__, ret); - return ret; - } - - ret = isl29028_clear_configure_reg(chip); - if (ret < 0) - return ret; - - indio_dev->info = &isl29028_info; - indio_dev->channels = isl29028_channels; - indio_dev->num_channels = ARRAY_SIZE(isl29028_channels); - indio_dev->name = id->name; - indio_dev->dev.parent = &client->dev; - indio_dev->modes = INDIO_DIRECT_MODE; - - pm_runtime_enable(&client->dev); - pm_runtime_set_autosuspend_delay(&client->dev, - ISL29028_POWER_OFF_DELAY_MS); - pm_runtime_use_autosuspend(&client->dev); - - ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); - if (ret < 0) { - dev_err(&client->dev, - "%s(): iio registration failed with error %d\n", - __func__, ret); - return ret; - } - - return 0; -} - -static int isl29028_remove(struct i2c_client *client) -{ - struct iio_dev *indio_dev = i2c_get_clientdata(client); - struct isl29028_chip *chip = 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); - - return isl29028_clear_configure_reg(chip); -} - -static int __maybe_unused isl29028_suspend(struct device *dev) -{ - struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); - struct isl29028_chip *chip = iio_priv(indio_dev); - int ret; - - mutex_lock(&chip->lock); - - ret = isl29028_clear_configure_reg(chip); - - mutex_unlock(&chip->lock); - - return ret; -} - -static int __maybe_unused isl29028_resume(struct device *dev) -{ - /** - * The specific component (ALS/IR or proximity) will enable itself as - * needed the next time that the user requests a reading. This is done - * above in isl29028_set_als_ir_mode() and isl29028_enable_proximity(). - */ - return 0; -} - -static const struct dev_pm_ops isl29028_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(isl29028_suspend, isl29028_resume, NULL) -}; - -static const struct i2c_device_id isl29028_id[] = { - {"isl29028", 0}, - {} -}; -MODULE_DEVICE_TABLE(i2c, isl29028_id); - -static const struct of_device_id isl29028_of_match[] = { - { .compatible = "isl,isl29028", }, /* for backward compat., don't use */ - { .compatible = "isil,isl29028", }, - { }, -}; -MODULE_DEVICE_TABLE(of, isl29028_of_match); - -static struct i2c_driver isl29028_driver = { - .driver = { - .name = "isl29028", - .pm = &isl29028_pm_ops, - .of_match_table = isl29028_of_match, - }, - .probe = isl29028_probe, - .remove = isl29028_remove, - .id_table = isl29028_id, -}; - -module_i2c_driver(isl29028_driver); - -MODULE_DESCRIPTION("ISL29028 Ambient Light and Proximity Sensor driver"); -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Laxman Dewangan "); -- cgit v1.2.3-55-g7522 From 2451c5dda4d0bc65c1d72fa8d06f3db2ad6f4311 Mon Sep 17 00:00:00 2001 From: Quentin Swain Date: Sun, 30 Apr 2017 19:16:58 -0400 Subject: iio: ad9834 convert symbolic permissions to octal Remove checkpatch warnings by converting symbolic S_IRUGO and S_IWUSR permissions to octal Signed-off-by: Quentin Swain Signed-off-by: Jonathan Cameron --- drivers/staging/iio/frequency/ad9834.c | 22 +++++++++++----------- drivers/staging/iio/frequency/dds.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index af108e96b3ec..995acdd7c942 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -292,7 +292,7 @@ ssize_t ad9834_show_out0_wavetype_available(struct device *dev, return sprintf(buf, "%s\n", str); } -static IIO_DEVICE_ATTR(out_altvoltage0_out0_wavetype_available, S_IRUGO, +static IIO_DEVICE_ATTR(out_altvoltage0_out0_wavetype_available, 0444, ad9834_show_out0_wavetype_available, NULL, 0); static @@ -312,27 +312,27 @@ ssize_t ad9834_show_out1_wavetype_available(struct device *dev, return sprintf(buf, "%s\n", str); } -static IIO_DEVICE_ATTR(out_altvoltage0_out1_wavetype_available, S_IRUGO, +static IIO_DEVICE_ATTR(out_altvoltage0_out1_wavetype_available, 0444, ad9834_show_out1_wavetype_available, NULL, 0); /** * see dds.h for further information */ -static IIO_DEV_ATTR_FREQ(0, 0, S_IWUSR, NULL, ad9834_write, AD9834_REG_FREQ0); -static IIO_DEV_ATTR_FREQ(0, 1, S_IWUSR, NULL, ad9834_write, AD9834_REG_FREQ1); -static IIO_DEV_ATTR_FREQSYMBOL(0, S_IWUSR, NULL, ad9834_write, AD9834_FSEL); +static IIO_DEV_ATTR_FREQ(0, 0, 0200, NULL, ad9834_write, AD9834_REG_FREQ0); +static IIO_DEV_ATTR_FREQ(0, 1, 0200, NULL, ad9834_write, AD9834_REG_FREQ1); +static IIO_DEV_ATTR_FREQSYMBOL(0, 0200, NULL, ad9834_write, AD9834_FSEL); static IIO_CONST_ATTR_FREQ_SCALE(0, "1"); /* 1Hz */ -static IIO_DEV_ATTR_PHASE(0, 0, S_IWUSR, NULL, ad9834_write, AD9834_REG_PHASE0); -static IIO_DEV_ATTR_PHASE(0, 1, S_IWUSR, NULL, ad9834_write, AD9834_REG_PHASE1); -static IIO_DEV_ATTR_PHASESYMBOL(0, S_IWUSR, NULL, ad9834_write, AD9834_PSEL); +static IIO_DEV_ATTR_PHASE(0, 0, 0200, NULL, ad9834_write, AD9834_REG_PHASE0); +static IIO_DEV_ATTR_PHASE(0, 1, 0200, NULL, ad9834_write, AD9834_REG_PHASE1); +static IIO_DEV_ATTR_PHASESYMBOL(0, 0200, NULL, ad9834_write, AD9834_PSEL); static IIO_CONST_ATTR_PHASE_SCALE(0, "0.0015339808"); /* 2PI/2^12 rad*/ -static IIO_DEV_ATTR_PINCONTROL_EN(0, S_IWUSR, NULL, +static IIO_DEV_ATTR_PINCONTROL_EN(0, 0200, NULL, ad9834_write, AD9834_PIN_SW); -static IIO_DEV_ATTR_OUT_ENABLE(0, S_IWUSR, NULL, ad9834_write, AD9834_RESET); -static IIO_DEV_ATTR_OUTY_ENABLE(0, 1, S_IWUSR, NULL, +static IIO_DEV_ATTR_OUT_ENABLE(0, 0200, NULL, ad9834_write, AD9834_RESET); +static IIO_DEV_ATTR_OUTY_ENABLE(0, 1, 0200, NULL, ad9834_write, AD9834_OPBITEN); static IIO_DEV_ATTR_OUT_WAVETYPE(0, 0, ad9834_store_wavetype, 0); static IIO_DEV_ATTR_OUT_WAVETYPE(0, 1, ad9834_store_wavetype, 1); diff --git a/drivers/staging/iio/frequency/dds.h b/drivers/staging/iio/frequency/dds.h index fe53e7324c94..d6ccd99c14d7 100644 --- a/drivers/staging/iio/frequency/dds.h +++ b/drivers/staging/iio/frequency/dds.h @@ -101,7 +101,7 @@ #define IIO_DEV_ATTR_OUT_WAVETYPE(_channel, _output, _store, _addr) \ IIO_DEVICE_ATTR(out_altvoltage##_channel##_out##_output##_wavetype,\ - S_IWUSR, NULL, _store, _addr) + 0200, NULL, _store, _addr) /** * /sys/bus/iio/devices/.../out_altvoltageX_outY_wavetype_available -- cgit v1.2.3-55-g7522 From 3e8eae90790af430bb6d92dbd830f6b5653bc17b Mon Sep 17 00:00:00 2001 From: Quentin Swain Date: Sun, 30 Apr 2017 19:16:59 -0400 Subject: iio: ade7753 Convert: symbolic permissions to octal Convert S_IRUGO and S_IWUSR macros to octal permissions to resolve warnings reported by checkpatch.pl Signed-off-by: Quentin Swain Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7753.c | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c index b71fbd313778..c0f258c53d3f 100644 --- a/drivers/staging/iio/meter/ade7753.c +++ b/drivers/staging/iio/meter/ade7753.c @@ -298,92 +298,92 @@ static IIO_DEV_ATTR_AENERGY(ade7753_read_24bit, ADE7753_AENERGY); static IIO_DEV_ATTR_LAENERGY(ade7753_read_24bit, ADE7753_LAENERGY); static IIO_DEV_ATTR_VAENERGY(ade7753_read_24bit, ADE7753_VAENERGY); static IIO_DEV_ATTR_LVAENERGY(ade7753_read_24bit, ADE7753_LVAENERGY); -static IIO_DEV_ATTR_CFDEN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CFDEN(0644, ade7753_read_16bit, ade7753_write_16bit, ADE7753_CFDEN); -static IIO_DEV_ATTR_CFNUM(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CFNUM(0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_CFNUM); static IIO_DEV_ATTR_CHKSUM(ade7753_read_8bit, ADE7753_CHKSUM); -static IIO_DEV_ATTR_PHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_PHCAL(0644, ade7753_read_16bit, ade7753_write_16bit, ADE7753_PHCAL); -static IIO_DEV_ATTR_APOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_APOS(0644, ade7753_read_16bit, ade7753_write_16bit, ADE7753_APOS); -static IIO_DEV_ATTR_SAGCYC(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_SAGCYC(0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_SAGCYC); -static IIO_DEV_ATTR_SAGLVL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_SAGLVL(0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_SAGLVL); -static IIO_DEV_ATTR_LINECYC(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_LINECYC(0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_LINECYC); -static IIO_DEV_ATTR_WDIV(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_WDIV(0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_WDIV); -static IIO_DEV_ATTR_IRMS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_IRMS(0644, ade7753_read_24bit, NULL, ADE7753_IRMS); -static IIO_DEV_ATTR_VRMS(S_IRUGO, +static IIO_DEV_ATTR_VRMS(0444, ade7753_read_24bit, NULL, ADE7753_VRMS); -static IIO_DEV_ATTR_IRMSOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_IRMSOS(0644, ade7753_read_16bit, ade7753_write_16bit, ADE7753_IRMSOS); -static IIO_DEV_ATTR_VRMSOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_VRMSOS(0644, ade7753_read_16bit, ade7753_write_16bit, ADE7753_VRMSOS); -static IIO_DEV_ATTR_WGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_WGAIN(0644, ade7753_read_16bit, ade7753_write_16bit, ADE7753_WGAIN); -static IIO_DEV_ATTR_VAGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_VAGAIN(0644, ade7753_read_16bit, ade7753_write_16bit, ADE7753_VAGAIN); -static IIO_DEV_ATTR_PGA_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_PGA_GAIN(0644, ade7753_read_16bit, ade7753_write_16bit, ADE7753_GAIN); -static IIO_DEV_ATTR_IPKLVL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_IPKLVL(0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_IPKLVL); -static IIO_DEV_ATTR_VPKLVL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_VPKLVL(0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_VPKLVL); -static IIO_DEV_ATTR_IPEAK(S_IRUGO, +static IIO_DEV_ATTR_IPEAK(0444, ade7753_read_24bit, NULL, ADE7753_IPEAK); -static IIO_DEV_ATTR_VPEAK(S_IRUGO, +static IIO_DEV_ATTR_VPEAK(0444, ade7753_read_24bit, NULL, ADE7753_VPEAK); -static IIO_DEV_ATTR_VPERIOD(S_IRUGO, +static IIO_DEV_ATTR_VPERIOD(0444, ade7753_read_16bit, NULL, ADE7753_PERIOD); -static IIO_DEV_ATTR_CH_OFF(1, S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CH_OFF(1, 0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_CH1OS); -static IIO_DEV_ATTR_CH_OFF(2, S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CH_OFF(2, 0644, ade7753_read_8bit, ade7753_write_8bit, ADE7753_CH2OS); @@ -514,7 +514,7 @@ static IIO_DEV_ATTR_TEMP_RAW(ade7753_read_8bit); static IIO_CONST_ATTR(in_temp_offset, "-25 C"); static IIO_CONST_ATTR(in_temp_scale, "0.67 C"); -static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_SAMP_FREQ(0644, ade7753_read_frequency, ade7753_write_frequency); -- cgit v1.2.3-55-g7522 From 37cbe596e24a606463e052405d6ff585141331b7 Mon Sep 17 00:00:00 2001 From: Quentin Swain Date: Sun, 30 Apr 2017 19:17:00 -0400 Subject: iio: ade7754: Convert symbolic permissions to octal Convert symbolic S_IRUGO and S_IWUSR macros to octal permissions to resolve warnings reported by checkpatch.pl Signed-off-by: Quentin Swain Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7754.c | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c index 32dc50341746..be0df3fe4230 100644 --- a/drivers/staging/iio/meter/ade7754.c +++ b/drivers/staging/iio/meter/ade7754.c @@ -316,111 +316,111 @@ static IIO_DEV_ATTR_AENERGY(ade7754_read_24bit, ADE7754_AENERGY); static IIO_DEV_ATTR_LAENERGY(ade7754_read_24bit, ADE7754_LAENERGY); static IIO_DEV_ATTR_VAENERGY(ade7754_read_24bit, ADE7754_VAENERGY); static IIO_DEV_ATTR_LVAENERGY(ade7754_read_24bit, ADE7754_LVAENERGY); -static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_VPEAK(0644, ade7754_read_8bit, ade7754_write_8bit, ADE7754_VPEAK); -static IIO_DEV_ATTR_IPEAK(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_IPEAK(0644, ade7754_read_8bit, ade7754_write_8bit, ADE7754_VPEAK); -static IIO_DEV_ATTR_APHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_APHCAL(0644, ade7754_read_8bit, ade7754_write_8bit, ADE7754_APHCAL); -static IIO_DEV_ATTR_BPHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BPHCAL(0644, ade7754_read_8bit, ade7754_write_8bit, ADE7754_BPHCAL); -static IIO_DEV_ATTR_CPHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CPHCAL(0644, ade7754_read_8bit, ade7754_write_8bit, ADE7754_CPHCAL); -static IIO_DEV_ATTR_AAPOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_AAPOS(0644, ade7754_read_16bit, ade7754_write_16bit, ADE7754_AAPOS); -static IIO_DEV_ATTR_BAPOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BAPOS(0644, ade7754_read_16bit, ade7754_write_16bit, ADE7754_BAPOS); -static IIO_DEV_ATTR_CAPOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CAPOS(0644, ade7754_read_16bit, ade7754_write_16bit, ADE7754_CAPOS); -static IIO_DEV_ATTR_WDIV(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_WDIV(0644, ade7754_read_8bit, ade7754_write_8bit, ADE7754_WDIV); -static IIO_DEV_ATTR_VADIV(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_VADIV(0644, ade7754_read_8bit, ade7754_write_8bit, ADE7754_VADIV); -static IIO_DEV_ATTR_CFNUM(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CFNUM(0644, ade7754_read_16bit, ade7754_write_16bit, ADE7754_CFNUM); -static IIO_DEV_ATTR_CFDEN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CFDEN(0644, ade7754_read_16bit, ade7754_write_16bit, ADE7754_CFDEN); -static IIO_DEV_ATTR_ACTIVE_POWER_A_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_ACTIVE_POWER_A_GAIN(0644, ade7754_read_16bit, ade7754_write_16bit, ADE7754_AAPGAIN); -static IIO_DEV_ATTR_ACTIVE_POWER_B_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_ACTIVE_POWER_B_GAIN(0644, ade7754_read_16bit, ade7754_write_16bit, ADE7754_BAPGAIN); -static IIO_DEV_ATTR_ACTIVE_POWER_C_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_ACTIVE_POWER_C_GAIN(0644, ade7754_read_16bit, ade7754_write_16bit, ADE7754_CAPGAIN); -static IIO_DEV_ATTR_AIRMS(S_IRUGO, +static IIO_DEV_ATTR_AIRMS(0444, ade7754_read_24bit, NULL, ADE7754_AIRMS); -static IIO_DEV_ATTR_BIRMS(S_IRUGO, +static IIO_DEV_ATTR_BIRMS(0444, ade7754_read_24bit, NULL, ADE7754_BIRMS); -static IIO_DEV_ATTR_CIRMS(S_IRUGO, +static IIO_DEV_ATTR_CIRMS(0444, ade7754_read_24bit, NULL, ADE7754_CIRMS); -static IIO_DEV_ATTR_AVRMS(S_IRUGO, +static IIO_DEV_ATTR_AVRMS(0444, ade7754_read_24bit, NULL, ADE7754_AVRMS); -static IIO_DEV_ATTR_BVRMS(S_IRUGO, +static IIO_DEV_ATTR_BVRMS(0444, ade7754_read_24bit, NULL, ADE7754_BVRMS); -static IIO_DEV_ATTR_CVRMS(S_IRUGO, +static IIO_DEV_ATTR_CVRMS(0444, ade7754_read_24bit, NULL, ADE7754_CVRMS); -static IIO_DEV_ATTR_AIRMSOS(S_IRUGO, +static IIO_DEV_ATTR_AIRMSOS(0444, ade7754_read_16bit, ade7754_write_16bit, ADE7754_AIRMSOS); -static IIO_DEV_ATTR_BIRMSOS(S_IRUGO, +static IIO_DEV_ATTR_BIRMSOS(0444, ade7754_read_16bit, ade7754_write_16bit, ADE7754_BIRMSOS); -static IIO_DEV_ATTR_CIRMSOS(S_IRUGO, +static IIO_DEV_ATTR_CIRMSOS(0444, ade7754_read_16bit, ade7754_write_16bit, ADE7754_CIRMSOS); -static IIO_DEV_ATTR_AVRMSOS(S_IRUGO, +static IIO_DEV_ATTR_AVRMSOS(0444, ade7754_read_16bit, ade7754_write_16bit, ADE7754_AVRMSOS); -static IIO_DEV_ATTR_BVRMSOS(S_IRUGO, +static IIO_DEV_ATTR_BVRMSOS(0444, ade7754_read_16bit, ade7754_write_16bit, ADE7754_BVRMSOS); -static IIO_DEV_ATTR_CVRMSOS(S_IRUGO, +static IIO_DEV_ATTR_CVRMSOS(0444, ade7754_read_16bit, ade7754_write_16bit, ADE7754_CVRMSOS); @@ -549,7 +549,7 @@ static IIO_DEV_ATTR_TEMP_RAW(ade7754_read_8bit); static IIO_CONST_ATTR(in_temp_offset, "129 C"); static IIO_CONST_ATTR(in_temp_scale, "4 C"); -static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_SAMP_FREQ(0644, ade7754_read_frequency, ade7754_write_frequency); -- cgit v1.2.3-55-g7522 From 78425b3290397686d888b16d43013142a62bc268 Mon Sep 17 00:00:00 2001 From: Quentin Swain Date: Sun, 30 Apr 2017 19:17:01 -0400 Subject: iio: ade7758: Convert symbolic permissions to octal Convert symbolic S_IRUGO and S_IWUSR macros to octal permissions to fix warnings reported by checkpatch.pl Signed-off-by: Quentin Swain Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7758_core.c | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index 99c89e606c8d..40498af4dc46 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c @@ -301,103 +301,103 @@ static int ade7758_reset(struct device *dev) return ret; } -static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_VPEAK(0644, ade7758_read_8bit, ade7758_write_8bit, ADE7758_VPEAK); -static IIO_DEV_ATTR_IPEAK(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_IPEAK(0644, ade7758_read_8bit, ade7758_write_8bit, ADE7758_VPEAK); -static IIO_DEV_ATTR_APHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_APHCAL(0644, ade7758_read_8bit, ade7758_write_8bit, ADE7758_APHCAL); -static IIO_DEV_ATTR_BPHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BPHCAL(0644, ade7758_read_8bit, ade7758_write_8bit, ADE7758_BPHCAL); -static IIO_DEV_ATTR_CPHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CPHCAL(0644, ade7758_read_8bit, ade7758_write_8bit, ADE7758_CPHCAL); -static IIO_DEV_ATTR_WDIV(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_WDIV(0644, ade7758_read_8bit, ade7758_write_8bit, ADE7758_WDIV); -static IIO_DEV_ATTR_VADIV(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_VADIV(0644, ade7758_read_8bit, ade7758_write_8bit, ADE7758_VADIV); -static IIO_DEV_ATTR_AIRMS(S_IRUGO, +static IIO_DEV_ATTR_AIRMS(0444, ade7758_read_24bit, NULL, ADE7758_AIRMS); -static IIO_DEV_ATTR_BIRMS(S_IRUGO, +static IIO_DEV_ATTR_BIRMS(0444, ade7758_read_24bit, NULL, ADE7758_BIRMS); -static IIO_DEV_ATTR_CIRMS(S_IRUGO, +static IIO_DEV_ATTR_CIRMS(0444, ade7758_read_24bit, NULL, ADE7758_CIRMS); -static IIO_DEV_ATTR_AVRMS(S_IRUGO, +static IIO_DEV_ATTR_AVRMS(0444, ade7758_read_24bit, NULL, ADE7758_AVRMS); -static IIO_DEV_ATTR_BVRMS(S_IRUGO, +static IIO_DEV_ATTR_BVRMS(0444, ade7758_read_24bit, NULL, ADE7758_BVRMS); -static IIO_DEV_ATTR_CVRMS(S_IRUGO, +static IIO_DEV_ATTR_CVRMS(0444, ade7758_read_24bit, NULL, ADE7758_CVRMS); -static IIO_DEV_ATTR_AIRMSOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_AIRMSOS(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_AIRMSOS); -static IIO_DEV_ATTR_BIRMSOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BIRMSOS(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_BIRMSOS); -static IIO_DEV_ATTR_CIRMSOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CIRMSOS(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_CIRMSOS); -static IIO_DEV_ATTR_AVRMSOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_AVRMSOS(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_AVRMSOS); -static IIO_DEV_ATTR_BVRMSOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BVRMSOS(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_BVRMSOS); -static IIO_DEV_ATTR_CVRMSOS(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CVRMSOS(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_CVRMSOS); -static IIO_DEV_ATTR_AIGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_AIGAIN(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_AIGAIN); -static IIO_DEV_ATTR_BIGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BIGAIN(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_BIGAIN); -static IIO_DEV_ATTR_CIGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CIGAIN(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_CIGAIN); -static IIO_DEV_ATTR_AVRMSGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_AVRMSGAIN(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_AVRMSGAIN); -static IIO_DEV_ATTR_BVRMSGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BVRMSGAIN(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_BVRMSGAIN); -static IIO_DEV_ATTR_CVRMSGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CVRMSGAIN(0644, ade7758_read_16bit, ade7758_write_16bit, ADE7758_CVRMSGAIN); -- cgit v1.2.3-55-g7522 From b46c39a09838bb87d412a6ad7427ea58bf99ae02 Mon Sep 17 00:00:00 2001 From: Quentin Swain Date: Sun, 30 Apr 2017 19:17:02 -0400 Subject: iio: ade7854: Convert symbolic permissions to octal Convert symbolic S_IRUGO and S_IWUSR macros to octal to fix warnings reported by checkpatch.pl Signed-off-by: Quentin Swain Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7854.c | 88 ++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c index c6cffc11b0ba..70612da64a8b 100644 --- a/drivers/staging/iio/meter/ade7854.c +++ b/drivers/staging/iio/meter/ade7854.c @@ -186,127 +186,127 @@ static int ade7854_reset(struct device *dev) return st->write_reg_16(dev, ADE7854_CONFIG, val); } -static IIO_DEV_ATTR_AIGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_AIGAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_AIGAIN); -static IIO_DEV_ATTR_BIGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BIGAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_BIGAIN); -static IIO_DEV_ATTR_CIGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CIGAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_CIGAIN); -static IIO_DEV_ATTR_NIGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_NIGAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_NIGAIN); -static IIO_DEV_ATTR_AVGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_AVGAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_AVGAIN); -static IIO_DEV_ATTR_BVGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BVGAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_BVGAIN); -static IIO_DEV_ATTR_CVGAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CVGAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_CVGAIN); -static IIO_DEV_ATTR_APPARENT_POWER_A_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_APPARENT_POWER_A_GAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_AVAGAIN); -static IIO_DEV_ATTR_APPARENT_POWER_B_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_APPARENT_POWER_B_GAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_BVAGAIN); -static IIO_DEV_ATTR_APPARENT_POWER_C_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_APPARENT_POWER_C_GAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_CVAGAIN); -static IIO_DEV_ATTR_ACTIVE_POWER_A_OFFSET(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_ACTIVE_POWER_A_OFFSET(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_AWATTOS); -static IIO_DEV_ATTR_ACTIVE_POWER_B_OFFSET(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_ACTIVE_POWER_B_OFFSET(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_BWATTOS); -static IIO_DEV_ATTR_ACTIVE_POWER_C_OFFSET(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_ACTIVE_POWER_C_OFFSET(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_CWATTOS); -static IIO_DEV_ATTR_REACTIVE_POWER_A_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_REACTIVE_POWER_A_GAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_AVARGAIN); -static IIO_DEV_ATTR_REACTIVE_POWER_B_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_REACTIVE_POWER_B_GAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_BVARGAIN); -static IIO_DEV_ATTR_REACTIVE_POWER_C_GAIN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_REACTIVE_POWER_C_GAIN(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_CVARGAIN); -static IIO_DEV_ATTR_REACTIVE_POWER_A_OFFSET(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_REACTIVE_POWER_A_OFFSET(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_AVAROS); -static IIO_DEV_ATTR_REACTIVE_POWER_B_OFFSET(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_REACTIVE_POWER_B_OFFSET(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_BVAROS); -static IIO_DEV_ATTR_REACTIVE_POWER_C_OFFSET(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_REACTIVE_POWER_C_OFFSET(0644, ade7854_read_24bit, ade7854_write_24bit, ADE7854_CVAROS); -static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_VPEAK(0644, ade7854_read_32bit, ade7854_write_32bit, ADE7854_VPEAK); -static IIO_DEV_ATTR_IPEAK(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_IPEAK(0644, ade7854_read_32bit, ade7854_write_32bit, ADE7854_VPEAK); -static IIO_DEV_ATTR_APHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_APHCAL(0644, ade7854_read_16bit, ade7854_write_16bit, ADE7854_APHCAL); -static IIO_DEV_ATTR_BPHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_BPHCAL(0644, ade7854_read_16bit, ade7854_write_16bit, ADE7854_BPHCAL); -static IIO_DEV_ATTR_CPHCAL(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CPHCAL(0644, ade7854_read_16bit, ade7854_write_16bit, ADE7854_CPHCAL); -static IIO_DEV_ATTR_CF1DEN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CF1DEN(0644, ade7854_read_16bit, ade7854_write_16bit, ADE7854_CF1DEN); -static IIO_DEV_ATTR_CF2DEN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CF2DEN(0644, ade7854_read_16bit, ade7854_write_16bit, ADE7854_CF2DEN); -static IIO_DEV_ATTR_CF3DEN(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CF3DEN(0644, ade7854_read_16bit, ade7854_write_16bit, ADE7854_CF3DEN); -static IIO_DEV_ATTR_LINECYC(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_LINECYC(0644, ade7854_read_16bit, ade7854_write_16bit, ADE7854_LINECYC); -static IIO_DEV_ATTR_SAGCYC(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_SAGCYC(0644, ade7854_read_8bit, ade7854_write_8bit, ADE7854_SAGCYC); -static IIO_DEV_ATTR_CFCYC(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_CFCYC(0644, ade7854_read_8bit, ade7854_write_8bit, ADE7854_CFCYC); -static IIO_DEV_ATTR_PEAKCYC(S_IWUSR | S_IRUGO, +static IIO_DEV_ATTR_PEAKCYC(0644, ade7854_read_8bit, ade7854_write_8bit, ADE7854_PEAKCYC); @@ -318,55 +318,55 @@ static IIO_DEV_ATTR_ANGLE1(ade7854_read_24bit, ADE7854_ANGLE1); static IIO_DEV_ATTR_ANGLE2(ade7854_read_24bit, ADE7854_ANGLE2); -static IIO_DEV_ATTR_AIRMS(S_IRUGO, +static IIO_DEV_ATTR_AIRMS(0444, ade7854_read_24bit, NULL, ADE7854_AIRMS); -static IIO_DEV_ATTR_BIRMS(S_IRUGO, +static IIO_DEV_ATTR_BIRMS(0444, ade7854_read_24bit, NULL, ADE7854_BIRMS); -static IIO_DEV_ATTR_CIRMS(S_IRUGO, +static IIO_DEV_ATTR_CIRMS(0444, ade7854_read_24bit, NULL, ADE7854_CIRMS); -static IIO_DEV_ATTR_NIRMS(S_IRUGO, +static IIO_DEV_ATTR_NIRMS(0444, ade7854_read_24bit, NULL, ADE7854_NIRMS); -static IIO_DEV_ATTR_AVRMS(S_IRUGO, +static IIO_DEV_ATTR_AVRMS(0444, ade7854_read_24bit, NULL, ADE7854_AVRMS); -static IIO_DEV_ATTR_BVRMS(S_IRUGO, +static IIO_DEV_ATTR_BVRMS(0444, ade7854_read_24bit, NULL, ADE7854_BVRMS); -static IIO_DEV_ATTR_CVRMS(S_IRUGO, +static IIO_DEV_ATTR_CVRMS(0444, ade7854_read_24bit, NULL, ADE7854_CVRMS); -static IIO_DEV_ATTR_AIRMSOS(S_IRUGO, +static IIO_DEV_ATTR_AIRMSOS(0444, ade7854_read_16bit, ade7854_write_16bit, ADE7854_AIRMSOS); -static IIO_DEV_ATTR_BIRMSOS(S_IRUGO, +static IIO_DEV_ATTR_BIRMSOS(0444, ade7854_read_16bit, ade7854_write_16bit, ADE7854_BIRMSOS); -static IIO_DEV_ATTR_CIRMSOS(S_IRUGO, +static IIO_DEV_ATTR_CIRMSOS(0444, ade7854_read_16bit, ade7854_write_16bit, ADE7854_CIRMSOS); -static IIO_DEV_ATTR_AVRMSOS(S_IRUGO, +static IIO_DEV_ATTR_AVRMSOS(0444, ade7854_read_16bit, ade7854_write_16bit, ADE7854_AVRMSOS); -static IIO_DEV_ATTR_BVRMSOS(S_IRUGO, +static IIO_DEV_ATTR_BVRMSOS(0444, ade7854_read_16bit, ade7854_write_16bit, ADE7854_BVRMSOS); -static IIO_DEV_ATTR_CVRMSOS(S_IRUGO, +static IIO_DEV_ATTR_CVRMSOS(0444, ade7854_read_16bit, ade7854_write_16bit, ADE7854_CVRMSOS); -- cgit v1.2.3-55-g7522 From 38a67ffd44fc013437f83e96612c5210499ba02a Mon Sep 17 00:00:00 2001 From: Brian Masney Date: Thu, 4 May 2017 20:38:22 -0400 Subject: staging: iio: tsl2x7x: rename driver for consistency with other IIO light drivers This patch renames the tsl2x7x_core.c file to tsl2x7x.c so that the naming convention is consistent with other IIO light drivers outside of staging. Signed-off-by: Brian Masney Signed-off-by: Jonathan Cameron --- drivers/staging/iio/light/Makefile | 2 +- drivers/staging/iio/light/tsl2x7x.c | 2063 ++++++++++++++++++++++++++++++ drivers/staging/iio/light/tsl2x7x_core.c | 2063 ------------------------------ 3 files changed, 2064 insertions(+), 2064 deletions(-) create mode 100644 drivers/staging/iio/light/tsl2x7x.c delete mode 100644 drivers/staging/iio/light/tsl2x7x_core.c (limited to 'drivers/staging') diff --git a/drivers/staging/iio/light/Makefile b/drivers/staging/iio/light/Makefile index 10286c3ee6fe..ab8dc3a3d10b 100644 --- a/drivers/staging/iio/light/Makefile +++ b/drivers/staging/iio/light/Makefile @@ -2,4 +2,4 @@ # Makefile for industrial I/O Light sensors # -obj-$(CONFIG_TSL2x7x) += tsl2x7x_core.o +obj-$(CONFIG_TSL2x7x) += tsl2x7x.o diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c new file mode 100644 index 000000000000..8121a5188638 --- /dev/null +++ b/drivers/staging/iio/light/tsl2x7x.c @@ -0,0 +1,2063 @@ +/* + * Device driver for monitoring ambient light intensity in (lux) + * and proximity detection (prox) within the TAOS TSL2X7X family of devices. + * + * Copyright (c) 2012, TAOS Corporation. + * + * 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. + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tsl2x7x.h" + +/* Cal defs*/ +#define PROX_STAT_CAL 0 +#define PROX_STAT_SAMP 1 +#define MAX_SAMPLES_CAL 200 + +/* TSL2X7X Device ID */ +#define TRITON_ID 0x00 +#define SWORDFISH_ID 0x30 +#define HALIBUT_ID 0x20 + +/* Lux calculation constants */ +#define TSL2X7X_LUX_CALC_OVER_FLOW 65535 + +/* TAOS Register definitions - note: + * depending on device, some of these register are not used and the + * register address is benign. + */ +/* 2X7X register offsets */ +#define TSL2X7X_MAX_CONFIG_REG 16 + +/* Device Registers and Masks */ +#define TSL2X7X_CNTRL 0x00 +#define TSL2X7X_ALS_TIME 0X01 +#define TSL2X7X_PRX_TIME 0x02 +#define TSL2X7X_WAIT_TIME 0x03 +#define TSL2X7X_ALS_MINTHRESHLO 0X04 +#define TSL2X7X_ALS_MINTHRESHHI 0X05 +#define TSL2X7X_ALS_MAXTHRESHLO 0X06 +#define TSL2X7X_ALS_MAXTHRESHHI 0X07 +#define TSL2X7X_PRX_MINTHRESHLO 0X08 +#define TSL2X7X_PRX_MINTHRESHHI 0X09 +#define TSL2X7X_PRX_MAXTHRESHLO 0X0A +#define TSL2X7X_PRX_MAXTHRESHHI 0X0B +#define TSL2X7X_PERSISTENCE 0x0C +#define TSL2X7X_PRX_CONFIG 0x0D +#define TSL2X7X_PRX_COUNT 0x0E +#define TSL2X7X_GAIN 0x0F +#define TSL2X7X_NOTUSED 0x10 +#define TSL2X7X_REVID 0x11 +#define TSL2X7X_CHIPID 0x12 +#define TSL2X7X_STATUS 0x13 +#define TSL2X7X_ALS_CHAN0LO 0x14 +#define TSL2X7X_ALS_CHAN0HI 0x15 +#define TSL2X7X_ALS_CHAN1LO 0x16 +#define TSL2X7X_ALS_CHAN1HI 0x17 +#define TSL2X7X_PRX_LO 0x18 +#define TSL2X7X_PRX_HI 0x19 + +/* tsl2X7X cmd reg masks */ +#define TSL2X7X_CMD_REG 0x80 +#define TSL2X7X_CMD_SPL_FN 0x60 + +#define TSL2X7X_CMD_PROX_INT_CLR 0X05 +#define TSL2X7X_CMD_ALS_INT_CLR 0x06 +#define TSL2X7X_CMD_PROXALS_INT_CLR 0X07 + +/* tsl2X7X cntrl reg masks */ +#define TSL2X7X_CNTL_ADC_ENBL 0x02 +#define TSL2X7X_CNTL_PWR_ON 0x01 + +/* tsl2X7X status reg masks */ +#define TSL2X7X_STA_ADC_VALID 0x01 +#define TSL2X7X_STA_PRX_VALID 0x02 +#define TSL2X7X_STA_ADC_PRX_VALID (TSL2X7X_STA_ADC_VALID |\ + TSL2X7X_STA_PRX_VALID) +#define TSL2X7X_STA_ALS_INTR 0x10 +#define TSL2X7X_STA_PRX_INTR 0x20 + +/* tsl2X7X cntrl reg masks */ +#define TSL2X7X_CNTL_REG_CLEAR 0x00 +#define TSL2X7X_CNTL_PROX_INT_ENBL 0X20 +#define TSL2X7X_CNTL_ALS_INT_ENBL 0X10 +#define TSL2X7X_CNTL_WAIT_TMR_ENBL 0X08 +#define TSL2X7X_CNTL_PROX_DET_ENBL 0X04 +#define TSL2X7X_CNTL_PWRON 0x01 +#define TSL2X7X_CNTL_ALSPON_ENBL 0x03 +#define TSL2X7X_CNTL_INTALSPON_ENBL 0x13 +#define TSL2X7X_CNTL_PROXPON_ENBL 0x0F +#define TSL2X7X_CNTL_INTPROXPON_ENBL 0x2F + +/*Prox diode to use */ +#define TSL2X7X_DIODE0 0x10 +#define TSL2X7X_DIODE1 0x20 +#define TSL2X7X_DIODE_BOTH 0x30 + +/* LED Power */ +#define TSL2X7X_mA100 0x00 +#define TSL2X7X_mA50 0x40 +#define TSL2X7X_mA25 0x80 +#define TSL2X7X_mA13 0xD0 +#define TSL2X7X_MAX_TIMER_CNT (0xFF) + +#define TSL2X7X_MIN_ITIME 3 + +/* TAOS txx2x7x Device family members */ +enum { + tsl2571, + tsl2671, + tmd2671, + tsl2771, + tmd2771, + tsl2572, + tsl2672, + tmd2672, + tsl2772, + tmd2772 +}; + +enum { + TSL2X7X_CHIP_UNKNOWN = 0, + TSL2X7X_CHIP_WORKING = 1, + TSL2X7X_CHIP_SUSPENDED = 2 +}; + +struct tsl2x7x_parse_result { + int integer; + int fract; +}; + +/* Per-device data */ +struct tsl2x7x_als_info { + u16 als_ch0; + u16 als_ch1; + u16 lux; +}; + +struct tsl2x7x_prox_stat { + int min; + int max; + int mean; + unsigned long stddev; +}; + +struct tsl2x7x_chip_info { + int chan_table_elements; + struct iio_chan_spec channel[4]; + const struct iio_info *info; +}; + +struct tsl2X7X_chip { + kernel_ulong_t id; + struct mutex prox_mutex; + struct mutex als_mutex; + struct i2c_client *client; + u16 prox_data; + struct tsl2x7x_als_info als_cur_info; + struct tsl2x7x_settings tsl2x7x_settings; + struct tsl2X7X_platform_data *pdata; + int als_time_scale; + int als_saturation; + int tsl2x7x_chip_status; + u8 tsl2x7x_config[TSL2X7X_MAX_CONFIG_REG]; + const struct tsl2x7x_chip_info *chip_info; + const struct iio_info *info; + s64 event_timestamp; + /* + * This structure is intentionally large to accommodate + * updates via sysfs. + * Sized to 9 = max 8 segments + 1 termination segment + */ + struct tsl2x7x_lux tsl2x7x_device_lux[TSL2X7X_MAX_LUX_TABLE_SIZE]; +}; + +/* Different devices require different coefficents */ +static const struct tsl2x7x_lux tsl2x71_lux_table[] = { + { 14461, 611, 1211 }, + { 18540, 352, 623 }, + { 0, 0, 0 }, +}; + +static const struct tsl2x7x_lux tmd2x71_lux_table[] = { + { 11635, 115, 256 }, + { 15536, 87, 179 }, + { 0, 0, 0 }, +}; + +static const struct tsl2x7x_lux tsl2x72_lux_table[] = { + { 14013, 466, 917 }, + { 18222, 310, 552 }, + { 0, 0, 0 }, +}; + +static const struct tsl2x7x_lux tmd2x72_lux_table[] = { + { 13218, 130, 262 }, + { 17592, 92, 169 }, + { 0, 0, 0 }, +}; + +static const struct tsl2x7x_lux *tsl2x7x_default_lux_table_group[] = { + [tsl2571] = tsl2x71_lux_table, + [tsl2671] = tsl2x71_lux_table, + [tmd2671] = tmd2x71_lux_table, + [tsl2771] = tsl2x71_lux_table, + [tmd2771] = tmd2x71_lux_table, + [tsl2572] = tsl2x72_lux_table, + [tsl2672] = tsl2x72_lux_table, + [tmd2672] = tmd2x72_lux_table, + [tsl2772] = tsl2x72_lux_table, + [tmd2772] = tmd2x72_lux_table, +}; + +static const struct tsl2x7x_settings tsl2x7x_default_settings = { + .als_time = 219, /* 101 ms */ + .als_gain = 0, + .prx_time = 254, /* 5.4 ms */ + .prox_gain = 1, + .wait_time = 245, + .prox_config = 0, + .als_gain_trim = 1000, + .als_cal_target = 150, + .als_thresh_low = 200, + .als_thresh_high = 256, + .persistence = 255, + .interrupts_en = 0, + .prox_thres_low = 0, + .prox_thres_high = 512, + .prox_max_samples_cal = 30, + .prox_pulse_count = 8 +}; + +static const s16 tsl2X7X_als_gainadj[] = { + 1, + 8, + 16, + 120 +}; + +static const s16 tsl2X7X_prx_gainadj[] = { + 1, + 2, + 4, + 8 +}; + +/* Channel variations */ +enum { + ALS, + PRX, + ALSPRX, + PRX2, + ALSPRX2, +}; + +static const u8 device_channel_config[] = { + ALS, + PRX, + PRX, + ALSPRX, + ALSPRX, + ALS, + PRX2, + PRX2, + ALSPRX2, + ALSPRX2 +}; + +/** + * tsl2x7x_i2c_read() - Read a byte from a register. + * @client: i2c client + * @reg: device register to read from + * @*val: pointer to location to store register contents. + * + */ +static int +tsl2x7x_i2c_read(struct i2c_client *client, u8 reg, u8 *val) +{ + int ret; + + /* select register to write */ + ret = i2c_smbus_write_byte(client, (TSL2X7X_CMD_REG | reg)); + if (ret < 0) { + dev_err(&client->dev, "failed to write register %x\n", reg); + return ret; + } + + /* read the data */ + ret = i2c_smbus_read_byte(client); + if (ret >= 0) + *val = (u8)ret; + else + dev_err(&client->dev, "failed to read register %x\n", reg); + + return ret; +} + +/** + * tsl2x7x_get_lux() - Reads and calculates current lux value. + * @indio_dev: pointer to IIO device + * + * The raw ch0 and ch1 values of the ambient light sensed in the last + * integration cycle are read from the device. + * Time scale factor array values are adjusted based on the integration time. + * The raw values are multiplied by a scale factor, and device gain is obtained + * using gain index. Limit checks are done next, then the ratio of a multiple + * of ch1 value, to the ch0 value, is calculated. Array tsl2x7x_device_lux[] + * is then scanned to find the first ratio value that is just above the ratio + * we just calculated. The ch0 and ch1 multiplier constants in the array are + * then used along with the time scale factor array values, to calculate the + * lux. + */ +static int tsl2x7x_get_lux(struct iio_dev *indio_dev) +{ + u16 ch0, ch1; /* separated ch0/ch1 data from device */ + u32 lux; /* raw lux calculated from device data */ + u64 lux64; + u32 ratio; + u8 buf[4]; + struct tsl2x7x_lux *p; + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + int i, ret; + u32 ch0lux = 0; + u32 ch1lux = 0; + + if (mutex_trylock(&chip->als_mutex) == 0) + return chip->als_cur_info.lux; /* busy, so return LAST VALUE */ + + if (chip->tsl2x7x_chip_status != TSL2X7X_CHIP_WORKING) { + /* device is not enabled */ + dev_err(&chip->client->dev, "%s: device is not enabled\n", + __func__); + ret = -EBUSY; + goto out_unlock; + } + + ret = tsl2x7x_i2c_read(chip->client, + (TSL2X7X_CMD_REG | TSL2X7X_STATUS), &buf[0]); + if (ret < 0) { + dev_err(&chip->client->dev, + "%s: Failed to read STATUS Reg\n", __func__); + goto out_unlock; + } + /* is data new & valid */ + if (!(buf[0] & TSL2X7X_STA_ADC_VALID)) { + dev_err(&chip->client->dev, + "%s: data not valid yet\n", __func__); + ret = chip->als_cur_info.lux; /* return LAST VALUE */ + goto out_unlock; + } + + for (i = 0; i < 4; i++) { + ret = tsl2x7x_i2c_read(chip->client, + (TSL2X7X_CMD_REG | + (TSL2X7X_ALS_CHAN0LO + i)), &buf[i]); + if (ret < 0) { + dev_err(&chip->client->dev, + "failed to read. err=%x\n", ret); + goto out_unlock; + } + } + + /* clear any existing interrupt status */ + ret = i2c_smbus_write_byte(chip->client, + (TSL2X7X_CMD_REG | + TSL2X7X_CMD_SPL_FN | + TSL2X7X_CMD_ALS_INT_CLR)); + if (ret < 0) { + dev_err(&chip->client->dev, + "i2c_write_command failed - err = %d\n", ret); + goto out_unlock; /* have no data, so return failure */ + } + + /* extract ALS/lux data */ + ch0 = le16_to_cpup((const __le16 *)&buf[0]); + ch1 = le16_to_cpup((const __le16 *)&buf[2]); + + chip->als_cur_info.als_ch0 = ch0; + chip->als_cur_info.als_ch1 = ch1; + + if ((ch0 >= chip->als_saturation) || (ch1 >= chip->als_saturation)) { + lux = TSL2X7X_LUX_CALC_OVER_FLOW; + goto return_max; + } + + if (!ch0) { + /* have no data, so return LAST VALUE */ + ret = chip->als_cur_info.lux; + goto out_unlock; + } + /* calculate ratio */ + ratio = (ch1 << 15) / ch0; + /* convert to unscaled lux using the pointer to the table */ + p = (struct tsl2x7x_lux *)chip->tsl2x7x_device_lux; + while (p->ratio != 0 && p->ratio < ratio) + p++; + + if (p->ratio == 0) { + lux = 0; + } else { + ch0lux = DIV_ROUND_UP(ch0 * p->ch0, + tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]); + ch1lux = DIV_ROUND_UP(ch1 * p->ch1, + tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]); + lux = ch0lux - ch1lux; + } + + /* note: lux is 31 bit max at this point */ + if (ch1lux > ch0lux) { + dev_dbg(&chip->client->dev, "ch1lux > ch0lux-return last value\n"); + ret = chip->als_cur_info.lux; + goto out_unlock; + } + + /* adjust for active time scale */ + if (chip->als_time_scale == 0) + lux = 0; + else + lux = (lux + (chip->als_time_scale >> 1)) / + chip->als_time_scale; + + /* adjust for active gain scale + * The tsl2x7x_device_lux tables have a factor of 256 built-in. + * User-specified gain provides a multiplier. + * Apply user-specified gain before shifting right to retain precision. + * Use 64 bits to avoid overflow on multiplication. + * Then go back to 32 bits before division to avoid using div_u64(). + */ + + lux64 = lux; + lux64 = lux64 * chip->tsl2x7x_settings.als_gain_trim; + lux64 >>= 8; + lux = lux64; + lux = (lux + 500) / 1000; + + if (lux > TSL2X7X_LUX_CALC_OVER_FLOW) /* check for overflow */ + lux = TSL2X7X_LUX_CALC_OVER_FLOW; + + /* Update the structure with the latest lux. */ +return_max: + chip->als_cur_info.lux = lux; + ret = lux; + +out_unlock: + mutex_unlock(&chip->als_mutex); + + return ret; +} + +/** + * tsl2x7x_get_prox() - Reads proximity data registers and updates + * chip->prox_data. + * + * @indio_dev: pointer to IIO device + */ +static int tsl2x7x_get_prox(struct iio_dev *indio_dev) +{ + int i; + int ret; + u8 status; + u8 chdata[2]; + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + + if (mutex_trylock(&chip->prox_mutex) == 0) { + dev_err(&chip->client->dev, + "%s: Can't get prox mutex\n", __func__); + return -EBUSY; + } + + ret = tsl2x7x_i2c_read(chip->client, + (TSL2X7X_CMD_REG | TSL2X7X_STATUS), &status); + if (ret < 0) { + dev_err(&chip->client->dev, "i2c err=%d\n", ret); + goto prox_poll_err; + } + + switch (chip->id) { + case tsl2571: + case tsl2671: + case tmd2671: + case tsl2771: + case tmd2771: + if (!(status & TSL2X7X_STA_ADC_VALID)) + goto prox_poll_err; + break; + case tsl2572: + case tsl2672: + case tmd2672: + case tsl2772: + case tmd2772: + if (!(status & TSL2X7X_STA_PRX_VALID)) + goto prox_poll_err; + break; + } + + for (i = 0; i < 2; i++) { + ret = tsl2x7x_i2c_read(chip->client, + (TSL2X7X_CMD_REG | + (TSL2X7X_PRX_LO + i)), &chdata[i]); + if (ret < 0) + goto prox_poll_err; + } + + chip->prox_data = + le16_to_cpup((const __le16 *)&chdata[0]); + +prox_poll_err: + + mutex_unlock(&chip->prox_mutex); + + return chip->prox_data; +} + +/** + * tsl2x7x_defaults() - Populates the device nominal operating parameters + * with those provided by a 'platform' data struct or + * with prefined defaults. + * + * @chip: pointer to device structure. + */ +static void tsl2x7x_defaults(struct tsl2X7X_chip *chip) +{ + /* If Operational settings defined elsewhere.. */ + if (chip->pdata && chip->pdata->platform_default_settings) + memcpy(&chip->tsl2x7x_settings, + chip->pdata->platform_default_settings, + sizeof(tsl2x7x_default_settings)); + else + memcpy(&chip->tsl2x7x_settings, + &tsl2x7x_default_settings, + sizeof(tsl2x7x_default_settings)); + + /* Load up the proper lux table. */ + if (chip->pdata && chip->pdata->platform_lux_table[0].ratio != 0) + memcpy(chip->tsl2x7x_device_lux, + chip->pdata->platform_lux_table, + sizeof(chip->pdata->platform_lux_table)); + else + memcpy(chip->tsl2x7x_device_lux, + (struct tsl2x7x_lux *)tsl2x7x_default_lux_table_group[chip->id], + MAX_DEFAULT_TABLE_BYTES); +} + +/** + * tsl2x7x_als_calibrate() - Obtain single reading and calculate + * the als_gain_trim. + * + * @indio_dev: pointer to IIO device + */ +static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) +{ + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + u8 reg_val; + int gain_trim_val; + int ret; + int lux_val; + + ret = i2c_smbus_write_byte(chip->client, + (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); + if (ret < 0) { + dev_err(&chip->client->dev, + "failed to write CNTRL register, ret=%d\n", ret); + return ret; + } + + reg_val = i2c_smbus_read_byte(chip->client); + if ((reg_val & (TSL2X7X_CNTL_ADC_ENBL | TSL2X7X_CNTL_PWR_ON)) + != (TSL2X7X_CNTL_ADC_ENBL | TSL2X7X_CNTL_PWR_ON)) { + dev_err(&chip->client->dev, + "%s: failed: ADC not enabled\n", __func__); + return -1; + } + + ret = i2c_smbus_write_byte(chip->client, + (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); + if (ret < 0) { + dev_err(&chip->client->dev, + "failed to write ctrl reg: ret=%d\n", ret); + return ret; + } + + reg_val = i2c_smbus_read_byte(chip->client); + if ((reg_val & TSL2X7X_STA_ADC_VALID) != TSL2X7X_STA_ADC_VALID) { + dev_err(&chip->client->dev, + "%s: failed: STATUS - ADC not valid.\n", __func__); + return -ENODATA; + } + + lux_val = tsl2x7x_get_lux(indio_dev); + if (lux_val < 0) { + dev_err(&chip->client->dev, + "%s: failed to get lux\n", __func__); + return lux_val; + } + + gain_trim_val = ((chip->tsl2x7x_settings.als_cal_target) + * chip->tsl2x7x_settings.als_gain_trim) / lux_val; + if ((gain_trim_val < 250) || (gain_trim_val > 4000)) + return -ERANGE; + + chip->tsl2x7x_settings.als_gain_trim = gain_trim_val; + dev_info(&chip->client->dev, + "%s als_calibrate completed\n", chip->client->name); + + return (int)gain_trim_val; +} + +static int tsl2x7x_chip_on(struct iio_dev *indio_dev) +{ + int i; + int ret = 0; + u8 *dev_reg; + u8 utmp; + int als_count; + int als_time; + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + u8 reg_val = 0; + + if (chip->pdata && chip->pdata->power_on) + chip->pdata->power_on(indio_dev); + + /* Non calculated parameters */ + chip->tsl2x7x_config[TSL2X7X_PRX_TIME] = + chip->tsl2x7x_settings.prx_time; + chip->tsl2x7x_config[TSL2X7X_WAIT_TIME] = + chip->tsl2x7x_settings.wait_time; + chip->tsl2x7x_config[TSL2X7X_PRX_CONFIG] = + chip->tsl2x7x_settings.prox_config; + + chip->tsl2x7x_config[TSL2X7X_ALS_MINTHRESHLO] = + (chip->tsl2x7x_settings.als_thresh_low) & 0xFF; + chip->tsl2x7x_config[TSL2X7X_ALS_MINTHRESHHI] = + (chip->tsl2x7x_settings.als_thresh_low >> 8) & 0xFF; + chip->tsl2x7x_config[TSL2X7X_ALS_MAXTHRESHLO] = + (chip->tsl2x7x_settings.als_thresh_high) & 0xFF; + chip->tsl2x7x_config[TSL2X7X_ALS_MAXTHRESHHI] = + (chip->tsl2x7x_settings.als_thresh_high >> 8) & 0xFF; + chip->tsl2x7x_config[TSL2X7X_PERSISTENCE] = + chip->tsl2x7x_settings.persistence; + + chip->tsl2x7x_config[TSL2X7X_PRX_COUNT] = + chip->tsl2x7x_settings.prox_pulse_count; + chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHLO] = + (chip->tsl2x7x_settings.prox_thres_low) & 0xFF; + chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHHI] = + (chip->tsl2x7x_settings.prox_thres_low >> 8) & 0xFF; + chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHLO] = + (chip->tsl2x7x_settings.prox_thres_high) & 0xFF; + chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHHI] = + (chip->tsl2x7x_settings.prox_thres_high >> 8) & 0xFF; + + /* and make sure we're not already on */ + if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) { + /* if forcing a register update - turn off, then on */ + dev_info(&chip->client->dev, "device is already enabled\n"); + return -EINVAL; + } + + /* determine als integration register */ + als_count = (chip->tsl2x7x_settings.als_time * 100 + 135) / 270; + if (!als_count) + als_count = 1; /* ensure at least one cycle */ + + /* convert back to time (encompasses overrides) */ + als_time = (als_count * 27 + 5) / 10; + chip->tsl2x7x_config[TSL2X7X_ALS_TIME] = 256 - als_count; + + /* Set the gain based on tsl2x7x_settings struct */ + chip->tsl2x7x_config[TSL2X7X_GAIN] = + chip->tsl2x7x_settings.als_gain | + (TSL2X7X_mA100 | TSL2X7X_DIODE1) + | ((chip->tsl2x7x_settings.prox_gain) << 2); + + /* set chip struct re scaling and saturation */ + chip->als_saturation = als_count * 922; /* 90% of full scale */ + chip->als_time_scale = (als_time + 25) / 50; + + /* + * TSL2X7X Specific power-on / adc enable sequence + * Power on the device 1st. + */ + utmp = TSL2X7X_CNTL_PWR_ON; + ret = i2c_smbus_write_byte_data(chip->client, + TSL2X7X_CMD_REG | TSL2X7X_CNTRL, utmp); + if (ret < 0) { + dev_err(&chip->client->dev, + "%s: failed on CNTRL reg.\n", __func__); + return ret; + } + + /* + * Use the following shadow copy for our delay before enabling ADC. + * Write all the registers. + */ + for (i = 0, dev_reg = chip->tsl2x7x_config; + i < TSL2X7X_MAX_CONFIG_REG; i++) { + ret = i2c_smbus_write_byte_data(chip->client, + TSL2X7X_CMD_REG + i, + *dev_reg++); + if (ret < 0) { + dev_err(&chip->client->dev, + "failed on write to reg %d.\n", i); + return ret; + } + } + + mdelay(3); /* Power-on settling time */ + + /* + * NOW enable the ADC + * initialize the desired mode of operation + */ + utmp = TSL2X7X_CNTL_PWR_ON | + TSL2X7X_CNTL_ADC_ENBL | + TSL2X7X_CNTL_PROX_DET_ENBL; + ret = i2c_smbus_write_byte_data(chip->client, + TSL2X7X_CMD_REG | TSL2X7X_CNTRL, utmp); + if (ret < 0) { + dev_err(&chip->client->dev, + "%s: failed on 2nd CTRL reg.\n", __func__); + return ret; + } + + chip->tsl2x7x_chip_status = TSL2X7X_CHIP_WORKING; + + if (chip->tsl2x7x_settings.interrupts_en != 0) { + dev_info(&chip->client->dev, "Setting Up Interrupt(s)\n"); + + reg_val = TSL2X7X_CNTL_PWR_ON | TSL2X7X_CNTL_ADC_ENBL; + if ((chip->tsl2x7x_settings.interrupts_en == 0x20) || + (chip->tsl2x7x_settings.interrupts_en == 0x30)) + reg_val |= TSL2X7X_CNTL_PROX_DET_ENBL; + + reg_val |= chip->tsl2x7x_settings.interrupts_en; + ret = i2c_smbus_write_byte_data(chip->client, + (TSL2X7X_CMD_REG | + TSL2X7X_CNTRL), reg_val); + if (ret < 0) + dev_err(&chip->client->dev, + "%s: failed in tsl2x7x_IOCTL_INT_SET.\n", + __func__); + + /* Clear out any initial interrupts */ + ret = i2c_smbus_write_byte(chip->client, + TSL2X7X_CMD_REG | + TSL2X7X_CMD_SPL_FN | + TSL2X7X_CMD_PROXALS_INT_CLR); + if (ret < 0) { + dev_err(&chip->client->dev, + "%s: Failed to clear Int status\n", + __func__); + return ret; + } + } + + return ret; +} + +static int tsl2x7x_chip_off(struct iio_dev *indio_dev) +{ + int ret; + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + + /* turn device off */ + chip->tsl2x7x_chip_status = TSL2X7X_CHIP_SUSPENDED; + + ret = i2c_smbus_write_byte_data(chip->client, + TSL2X7X_CMD_REG | TSL2X7X_CNTRL, 0x00); + + if (chip->pdata && chip->pdata->power_off) + chip->pdata->power_off(chip->client); + + return ret; +} + +/** + * tsl2x7x_invoke_change + * @indio_dev: pointer to IIO device + * + * Obtain and lock both ALS and PROX resources, + * determine and save device state (On/Off), + * cycle device to implement updated parameter, + * put device back into proper state, and unlock + * resource. + */ +static +int tsl2x7x_invoke_change(struct iio_dev *indio_dev) +{ + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + int device_status = chip->tsl2x7x_chip_status; + + mutex_lock(&chip->als_mutex); + mutex_lock(&chip->prox_mutex); + + if (device_status == TSL2X7X_CHIP_WORKING) + tsl2x7x_chip_off(indio_dev); + + tsl2x7x_chip_on(indio_dev); + + if (device_status != TSL2X7X_CHIP_WORKING) + tsl2x7x_chip_off(indio_dev); + + mutex_unlock(&chip->prox_mutex); + mutex_unlock(&chip->als_mutex); + + return 0; +} + +static +void tsl2x7x_prox_calculate(int *data, int length, + struct tsl2x7x_prox_stat *statP) +{ + int i; + int sample_sum; + int tmp; + + if (!length) + length = 1; + + sample_sum = 0; + statP->min = INT_MAX; + statP->max = INT_MIN; + for (i = 0; i < length; i++) { + sample_sum += data[i]; + statP->min = min(statP->min, data[i]); + statP->max = max(statP->max, data[i]); + } + + statP->mean = sample_sum / length; + sample_sum = 0; + for (i = 0; i < length; i++) { + tmp = data[i] - statP->mean; + sample_sum += tmp * tmp; + } + statP->stddev = int_sqrt((long)sample_sum / length); +} + +/** + * tsl2x7x_prox_cal() - Calculates std. and sets thresholds. + * @indio_dev: pointer to IIO device + * + * Calculates a standard deviation based on the samples, + * and sets the threshold accordingly. + */ +static void tsl2x7x_prox_cal(struct iio_dev *indio_dev) +{ + int prox_history[MAX_SAMPLES_CAL + 1]; + int i; + struct tsl2x7x_prox_stat prox_stat_data[2]; + struct tsl2x7x_prox_stat *calP; + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + u8 tmp_irq_settings; + u8 current_state = chip->tsl2x7x_chip_status; + + if (chip->tsl2x7x_settings.prox_max_samples_cal > MAX_SAMPLES_CAL) { + dev_err(&chip->client->dev, + "max prox samples cal is too big: %d\n", + chip->tsl2x7x_settings.prox_max_samples_cal); + chip->tsl2x7x_settings.prox_max_samples_cal = MAX_SAMPLES_CAL; + } + + /* have to stop to change settings */ + tsl2x7x_chip_off(indio_dev); + + /* Enable proximity detection save just in case prox not wanted yet*/ + tmp_irq_settings = chip->tsl2x7x_settings.interrupts_en; + chip->tsl2x7x_settings.interrupts_en |= TSL2X7X_CNTL_PROX_INT_ENBL; + + /*turn on device if not already on*/ + tsl2x7x_chip_on(indio_dev); + + /*gather the samples*/ + for (i = 0; i < chip->tsl2x7x_settings.prox_max_samples_cal; i++) { + mdelay(15); + tsl2x7x_get_prox(indio_dev); + prox_history[i] = chip->prox_data; + dev_info(&chip->client->dev, "2 i=%d prox data= %d\n", + i, chip->prox_data); + } + + tsl2x7x_chip_off(indio_dev); + calP = &prox_stat_data[PROX_STAT_CAL]; + tsl2x7x_prox_calculate(prox_history, + chip->tsl2x7x_settings.prox_max_samples_cal, + calP); + chip->tsl2x7x_settings.prox_thres_high = (calP->max << 1) - calP->mean; + + dev_info(&chip->client->dev, " cal min=%d mean=%d max=%d\n", + calP->min, calP->mean, calP->max); + dev_info(&chip->client->dev, + "%s proximity threshold set to %d\n", + chip->client->name, chip->tsl2x7x_settings.prox_thres_high); + + /* back to the way they were */ + chip->tsl2x7x_settings.interrupts_en = tmp_irq_settings; + if (current_state == TSL2X7X_CHIP_WORKING) + tsl2x7x_chip_on(indio_dev); +} + +static ssize_t tsl2x7x_power_state_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); + + return snprintf(buf, PAGE_SIZE, "%d\n", chip->tsl2x7x_chip_status); +} + +static ssize_t tsl2x7x_power_state_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + bool value; + + if (strtobool(buf, &value)) + return -EINVAL; + + if (value) + tsl2x7x_chip_on(indio_dev); + else + tsl2x7x_chip_off(indio_dev); + + return len; +} + +static ssize_t tsl2x7x_gain_available_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); + + switch (chip->id) { + case tsl2571: + case tsl2671: + case tmd2671: + case tsl2771: + case tmd2771: + return snprintf(buf, PAGE_SIZE, "%s\n", "1 8 16 128"); + } + + return snprintf(buf, PAGE_SIZE, "%s\n", "1 8 16 120"); +} + +static ssize_t tsl2x7x_prox_gain_available_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%s\n", "1 2 4 8"); +} + +static ssize_t tsl2x7x_als_time_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); + int y, z; + + y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1; + z = y * TSL2X7X_MIN_ITIME; + y /= 1000; + z %= 1000; + + return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); +} + +static ssize_t tsl2x7x_als_time_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + struct tsl2x7x_parse_result result; + int ret; + + ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract); + if (ret) + return ret; + + result.fract /= 3; + chip->tsl2x7x_settings.als_time = + TSL2X7X_MAX_TIMER_CNT - (u8)result.fract; + + dev_info(&chip->client->dev, "%s: als time = %d", + __func__, chip->tsl2x7x_settings.als_time); + + tsl2x7x_invoke_change(indio_dev); + + return IIO_VAL_INT_PLUS_MICRO; +} + +static IIO_CONST_ATTR(in_illuminance0_integration_time_available, + ".00272 - .696"); + +static ssize_t tsl2x7x_als_cal_target_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); + + return snprintf(buf, PAGE_SIZE, "%d\n", + chip->tsl2x7x_settings.als_cal_target); +} + +static ssize_t tsl2x7x_als_cal_target_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + unsigned long value; + + if (kstrtoul(buf, 0, &value)) + return -EINVAL; + + if (value) + chip->tsl2x7x_settings.als_cal_target = value; + + tsl2x7x_invoke_change(indio_dev); + + return len; +} + +/* persistence settings */ +static ssize_t tsl2x7x_als_persistence_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); + int y, z, filter_delay; + + /* Determine integration time */ + y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1; + z = y * TSL2X7X_MIN_ITIME; + filter_delay = z * (chip->tsl2x7x_settings.persistence & 0x0F); + y = filter_delay / 1000; + z = filter_delay % 1000; + + return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); +} + +static ssize_t tsl2x7x_als_persistence_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + struct tsl2x7x_parse_result result; + int y, z, filter_delay; + int ret; + + ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract); + if (ret) + return ret; + + y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1; + z = y * TSL2X7X_MIN_ITIME; + + filter_delay = + DIV_ROUND_UP((result.integer * 1000) + result.fract, z); + + chip->tsl2x7x_settings.persistence &= 0xF0; + chip->tsl2x7x_settings.persistence |= (filter_delay & 0x0F); + + dev_info(&chip->client->dev, "%s: als persistence = %d", + __func__, filter_delay); + + tsl2x7x_invoke_change(indio_dev); + + return IIO_VAL_INT_PLUS_MICRO; +} + +static ssize_t tsl2x7x_prox_persistence_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); + int y, z, filter_delay; + + /* Determine integration time */ + y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1; + z = y * TSL2X7X_MIN_ITIME; + filter_delay = z * ((chip->tsl2x7x_settings.persistence & 0xF0) >> 4); + y = filter_delay / 1000; + z = filter_delay % 1000; + + return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); +} + +static ssize_t tsl2x7x_prox_persistence_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + struct tsl2x7x_parse_result result; + int y, z, filter_delay; + int ret; + + ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract); + if (ret) + return ret; + + y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1; + z = y * TSL2X7X_MIN_ITIME; + + filter_delay = + DIV_ROUND_UP((result.integer * 1000) + result.fract, z); + + chip->tsl2x7x_settings.persistence &= 0x0F; + chip->tsl2x7x_settings.persistence |= ((filter_delay << 4) & 0xF0); + + dev_info(&chip->client->dev, "%s: prox persistence = %d", + __func__, filter_delay); + + tsl2x7x_invoke_change(indio_dev); + + return IIO_VAL_INT_PLUS_MICRO; +} + +static ssize_t tsl2x7x_do_calibrate(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + bool value; + + if (strtobool(buf, &value)) + return -EINVAL; + + if (value) + tsl2x7x_als_calibrate(indio_dev); + + tsl2x7x_invoke_change(indio_dev); + + return len; +} + +static ssize_t tsl2x7x_luxtable_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); + int i = 0; + int offset = 0; + + while (i < (TSL2X7X_MAX_LUX_TABLE_SIZE * 3)) { + offset += snprintf(buf + offset, PAGE_SIZE, "%u,%u,%u,", + chip->tsl2x7x_device_lux[i].ratio, + chip->tsl2x7x_device_lux[i].ch0, + chip->tsl2x7x_device_lux[i].ch1); + if (chip->tsl2x7x_device_lux[i].ratio == 0) { + /* + * We just printed the first "0" entry. + * Now get rid of the extra "," and break. + */ + offset--; + break; + } + i++; + } + + offset += snprintf(buf + offset, PAGE_SIZE, "\n"); + return offset; +} + +static ssize_t tsl2x7x_luxtable_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + int value[ARRAY_SIZE(chip->tsl2x7x_device_lux) * 3 + 1]; + int n; + + get_options(buf, ARRAY_SIZE(value), value); + + /* We now have an array of ints starting at value[1], and + * enumerated by value[0]. + * We expect each group of three ints is one table entry, + * and the last table entry is all 0. + */ + n = value[0]; + if ((n % 3) || n < 6 || + n > ((ARRAY_SIZE(chip->tsl2x7x_device_lux) - 1) * 3)) { + dev_info(dev, "LUX TABLE INPUT ERROR 1 Value[0]=%d\n", n); + return -EINVAL; + } + + if ((value[(n - 2)] | value[(n - 1)] | value[n]) != 0) { + dev_info(dev, "LUX TABLE INPUT ERROR 2 Value[0]=%d\n", n); + return -EINVAL; + } + + if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) + tsl2x7x_chip_off(indio_dev); + + /* Zero out the table */ + memset(chip->tsl2x7x_device_lux, 0, sizeof(chip->tsl2x7x_device_lux)); + memcpy(chip->tsl2x7x_device_lux, &value[1], (value[0] * 4)); + + tsl2x7x_invoke_change(indio_dev); + + return len; +} + +static ssize_t tsl2x7x_do_prox_calibrate(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + bool value; + + if (strtobool(buf, &value)) + return -EINVAL; + + if (value) + tsl2x7x_prox_cal(indio_dev); + + tsl2x7x_invoke_change(indio_dev); + + return len; +} + +static int tsl2x7x_read_interrupt_config(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir) +{ + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + int ret; + + if (chan->type == IIO_INTENSITY) + ret = !!(chip->tsl2x7x_settings.interrupts_en & 0x10); + else + ret = !!(chip->tsl2x7x_settings.interrupts_en & 0x20); + + return ret; +} + +static int tsl2x7x_write_interrupt_config(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir, + int val) +{ + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + + if (chan->type == IIO_INTENSITY) { + if (val) + chip->tsl2x7x_settings.interrupts_en |= 0x10; + else + chip->tsl2x7x_settings.interrupts_en &= 0x20; + } else { + if (val) + chip->tsl2x7x_settings.interrupts_en |= 0x20; + else + chip->tsl2x7x_settings.interrupts_en &= 0x10; + } + + tsl2x7x_invoke_change(indio_dev); + + return 0; +} + +static int tsl2x7x_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 tsl2X7X_chip *chip = iio_priv(indio_dev); + + if (chan->type == IIO_INTENSITY) { + switch (dir) { + case IIO_EV_DIR_RISING: + chip->tsl2x7x_settings.als_thresh_high = val; + break; + case IIO_EV_DIR_FALLING: + chip->tsl2x7x_settings.als_thresh_low = val; + break; + default: + return -EINVAL; + } + } else { + switch (dir) { + case IIO_EV_DIR_RISING: + chip->tsl2x7x_settings.prox_thres_high = val; + break; + case IIO_EV_DIR_FALLING: + chip->tsl2x7x_settings.prox_thres_low = val; + break; + default: + return -EINVAL; + } + } + + tsl2x7x_invoke_change(indio_dev); + + return 0; +} + +static int tsl2x7x_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 tsl2X7X_chip *chip = iio_priv(indio_dev); + + if (chan->type == IIO_INTENSITY) { + switch (dir) { + case IIO_EV_DIR_RISING: + *val = chip->tsl2x7x_settings.als_thresh_high; + break; + case IIO_EV_DIR_FALLING: + *val = chip->tsl2x7x_settings.als_thresh_low; + break; + default: + return -EINVAL; + } + } else { + switch (dir) { + case IIO_EV_DIR_RISING: + *val = chip->tsl2x7x_settings.prox_thres_high; + break; + case IIO_EV_DIR_FALLING: + *val = chip->tsl2x7x_settings.prox_thres_low; + break; + default: + return -EINVAL; + } + } + + return IIO_VAL_INT; +} + +static int tsl2x7x_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long mask) +{ + int ret = -EINVAL; + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + + switch (mask) { + case IIO_CHAN_INFO_PROCESSED: + switch (chan->type) { + case IIO_LIGHT: + tsl2x7x_get_lux(indio_dev); + *val = chip->als_cur_info.lux; + ret = IIO_VAL_INT; + break; + default: + return -EINVAL; + } + break; + case IIO_CHAN_INFO_RAW: + switch (chan->type) { + case IIO_INTENSITY: + tsl2x7x_get_lux(indio_dev); + if (chan->channel == 0) + *val = chip->als_cur_info.als_ch0; + else + *val = chip->als_cur_info.als_ch1; + ret = IIO_VAL_INT; + break; + case IIO_PROXIMITY: + tsl2x7x_get_prox(indio_dev); + *val = chip->prox_data; + ret = IIO_VAL_INT; + break; + default: + return -EINVAL; + } + break; + case IIO_CHAN_INFO_CALIBSCALE: + if (chan->type == IIO_LIGHT) + *val = + tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]; + else + *val = + tsl2X7X_prx_gainadj[chip->tsl2x7x_settings.prox_gain]; + ret = IIO_VAL_INT; + break; + case IIO_CHAN_INFO_CALIBBIAS: + *val = chip->tsl2x7x_settings.als_gain_trim; + ret = IIO_VAL_INT; + break; + + default: + ret = -EINVAL; + } + + return ret; +} + +static int tsl2x7x_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + + switch (mask) { + case IIO_CHAN_INFO_CALIBSCALE: + if (chan->type == IIO_INTENSITY) { + switch (val) { + case 1: + chip->tsl2x7x_settings.als_gain = 0; + break; + case 8: + chip->tsl2x7x_settings.als_gain = 1; + break; + case 16: + chip->tsl2x7x_settings.als_gain = 2; + break; + case 120: + switch (chip->id) { + case tsl2572: + case tsl2672: + case tmd2672: + case tsl2772: + case tmd2772: + return -EINVAL; + } + chip->tsl2x7x_settings.als_gain = 3; + break; + case 128: + switch (chip->id) { + case tsl2571: + case tsl2671: + case tmd2671: + case tsl2771: + case tmd2771: + return -EINVAL; + } + chip->tsl2x7x_settings.als_gain = 3; + break; + default: + return -EINVAL; + } + } else { + switch (val) { + case 1: + chip->tsl2x7x_settings.prox_gain = 0; + break; + case 2: + chip->tsl2x7x_settings.prox_gain = 1; + break; + case 4: + chip->tsl2x7x_settings.prox_gain = 2; + break; + case 8: + chip->tsl2x7x_settings.prox_gain = 3; + break; + default: + return -EINVAL; + } + } + break; + case IIO_CHAN_INFO_CALIBBIAS: + chip->tsl2x7x_settings.als_gain_trim = val; + break; + + default: + return -EINVAL; + } + + tsl2x7x_invoke_change(indio_dev); + + return 0; +} + +static DEVICE_ATTR(power_state, 0644, + tsl2x7x_power_state_show, tsl2x7x_power_state_store); + +static DEVICE_ATTR(in_proximity0_calibscale_available, 0444, + tsl2x7x_prox_gain_available_show, NULL); + +static DEVICE_ATTR(in_illuminance0_calibscale_available, 0444, + tsl2x7x_gain_available_show, NULL); + +static DEVICE_ATTR(in_illuminance0_integration_time, 0644, + tsl2x7x_als_time_show, tsl2x7x_als_time_store); + +static DEVICE_ATTR(in_illuminance0_target_input, 0644, + tsl2x7x_als_cal_target_show, tsl2x7x_als_cal_target_store); + +static DEVICE_ATTR(in_illuminance0_calibrate, 0200, NULL, + tsl2x7x_do_calibrate); + +static DEVICE_ATTR(in_proximity0_calibrate, 0200, NULL, + tsl2x7x_do_prox_calibrate); + +static DEVICE_ATTR(in_illuminance0_lux_table, 0644, + tsl2x7x_luxtable_show, tsl2x7x_luxtable_store); + +static DEVICE_ATTR(in_intensity0_thresh_period, 0644, + tsl2x7x_als_persistence_show, tsl2x7x_als_persistence_store); + +static DEVICE_ATTR(in_proximity0_thresh_period, 0644, + tsl2x7x_prox_persistence_show, tsl2x7x_prox_persistence_store); + +/* Use the default register values to identify the Taos device */ +static int tsl2x7x_device_id(unsigned char *id, int target) +{ + switch (target) { + case tsl2571: + case tsl2671: + case tsl2771: + return (*id & 0xf0) == TRITON_ID; + case tmd2671: + case tmd2771: + return (*id & 0xf0) == HALIBUT_ID; + case tsl2572: + case tsl2672: + case tmd2672: + case tsl2772: + case tmd2772: + return (*id & 0xf0) == SWORDFISH_ID; + } + + return -EINVAL; +} + +static irqreturn_t tsl2x7x_event_handler(int irq, void *private) +{ + struct iio_dev *indio_dev = private; + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + s64 timestamp = iio_get_time_ns(indio_dev); + int ret; + u8 value; + + value = i2c_smbus_read_byte_data(chip->client, + TSL2X7X_CMD_REG | TSL2X7X_STATUS); + + /* What type of interrupt do we need to process */ + if (value & TSL2X7X_STA_PRX_INTR) { + tsl2x7x_get_prox(indio_dev); /* freshen data for ABI */ + iio_push_event(indio_dev, + IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, + 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_EITHER), + timestamp); + } + + if (value & TSL2X7X_STA_ALS_INTR) { + tsl2x7x_get_lux(indio_dev); /* freshen data for ABI */ + iio_push_event(indio_dev, + IIO_UNMOD_EVENT_CODE(IIO_LIGHT, + 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_EITHER), + timestamp); + } + /* Clear interrupt now that we have handled it. */ + ret = i2c_smbus_write_byte(chip->client, + TSL2X7X_CMD_REG | TSL2X7X_CMD_SPL_FN | + TSL2X7X_CMD_PROXALS_INT_CLR); + if (ret < 0) + dev_err(&chip->client->dev, + "Failed to clear irq from event handler. err = %d\n", + ret); + + return IRQ_HANDLED; +} + +static struct attribute *tsl2x7x_ALS_device_attrs[] = { + &dev_attr_power_state.attr, + &dev_attr_in_illuminance0_calibscale_available.attr, + &dev_attr_in_illuminance0_integration_time.attr, + &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr, + &dev_attr_in_illuminance0_target_input.attr, + &dev_attr_in_illuminance0_calibrate.attr, + &dev_attr_in_illuminance0_lux_table.attr, + NULL +}; + +static struct attribute *tsl2x7x_PRX_device_attrs[] = { + &dev_attr_power_state.attr, + &dev_attr_in_proximity0_calibrate.attr, + NULL +}; + +static struct attribute *tsl2x7x_ALSPRX_device_attrs[] = { + &dev_attr_power_state.attr, + &dev_attr_in_illuminance0_calibscale_available.attr, + &dev_attr_in_illuminance0_integration_time.attr, + &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr, + &dev_attr_in_illuminance0_target_input.attr, + &dev_attr_in_illuminance0_calibrate.attr, + &dev_attr_in_illuminance0_lux_table.attr, + &dev_attr_in_proximity0_calibrate.attr, + NULL +}; + +static struct attribute *tsl2x7x_PRX2_device_attrs[] = { + &dev_attr_power_state.attr, + &dev_attr_in_proximity0_calibrate.attr, + &dev_attr_in_proximity0_calibscale_available.attr, + NULL +}; + +static struct attribute *tsl2x7x_ALSPRX2_device_attrs[] = { + &dev_attr_power_state.attr, + &dev_attr_in_illuminance0_calibscale_available.attr, + &dev_attr_in_illuminance0_integration_time.attr, + &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr, + &dev_attr_in_illuminance0_target_input.attr, + &dev_attr_in_illuminance0_calibrate.attr, + &dev_attr_in_illuminance0_lux_table.attr, + &dev_attr_in_proximity0_calibrate.attr, + &dev_attr_in_proximity0_calibscale_available.attr, + NULL +}; + +static struct attribute *tsl2X7X_ALS_event_attrs[] = { + &dev_attr_in_intensity0_thresh_period.attr, + NULL, +}; + +static struct attribute *tsl2X7X_PRX_event_attrs[] = { + &dev_attr_in_proximity0_thresh_period.attr, + NULL, +}; + +static struct attribute *tsl2X7X_ALSPRX_event_attrs[] = { + &dev_attr_in_intensity0_thresh_period.attr, + &dev_attr_in_proximity0_thresh_period.attr, + NULL, +}; + +static const struct attribute_group tsl2X7X_device_attr_group_tbl[] = { + [ALS] = { + .attrs = tsl2x7x_ALS_device_attrs, + }, + [PRX] = { + .attrs = tsl2x7x_PRX_device_attrs, + }, + [ALSPRX] = { + .attrs = tsl2x7x_ALSPRX_device_attrs, + }, + [PRX2] = { + .attrs = tsl2x7x_PRX2_device_attrs, + }, + [ALSPRX2] = { + .attrs = tsl2x7x_ALSPRX2_device_attrs, + }, +}; + +static const struct attribute_group tsl2X7X_event_attr_group_tbl[] = { + [ALS] = { + .attrs = tsl2X7X_ALS_event_attrs, + .name = "events", + }, + [PRX] = { + .attrs = tsl2X7X_PRX_event_attrs, + .name = "events", + }, + [ALSPRX] = { + .attrs = tsl2X7X_ALSPRX_event_attrs, + .name = "events", + }, +}; + +static const struct iio_info tsl2X7X_device_info[] = { + [ALS] = { + .attrs = &tsl2X7X_device_attr_group_tbl[ALS], + .event_attrs = &tsl2X7X_event_attr_group_tbl[ALS], + .driver_module = THIS_MODULE, + .read_raw = &tsl2x7x_read_raw, + .write_raw = &tsl2x7x_write_raw, + .read_event_value = &tsl2x7x_read_thresh, + .write_event_value = &tsl2x7x_write_thresh, + .read_event_config = &tsl2x7x_read_interrupt_config, + .write_event_config = &tsl2x7x_write_interrupt_config, + }, + [PRX] = { + .attrs = &tsl2X7X_device_attr_group_tbl[PRX], + .event_attrs = &tsl2X7X_event_attr_group_tbl[PRX], + .driver_module = THIS_MODULE, + .read_raw = &tsl2x7x_read_raw, + .write_raw = &tsl2x7x_write_raw, + .read_event_value = &tsl2x7x_read_thresh, + .write_event_value = &tsl2x7x_write_thresh, + .read_event_config = &tsl2x7x_read_interrupt_config, + .write_event_config = &tsl2x7x_write_interrupt_config, + }, + [ALSPRX] = { + .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX], + .event_attrs = &tsl2X7X_event_attr_group_tbl[ALSPRX], + .driver_module = THIS_MODULE, + .read_raw = &tsl2x7x_read_raw, + .write_raw = &tsl2x7x_write_raw, + .read_event_value = &tsl2x7x_read_thresh, + .write_event_value = &tsl2x7x_write_thresh, + .read_event_config = &tsl2x7x_read_interrupt_config, + .write_event_config = &tsl2x7x_write_interrupt_config, + }, + [PRX2] = { + .attrs = &tsl2X7X_device_attr_group_tbl[PRX2], + .event_attrs = &tsl2X7X_event_attr_group_tbl[PRX], + .driver_module = THIS_MODULE, + .read_raw = &tsl2x7x_read_raw, + .write_raw = &tsl2x7x_write_raw, + .read_event_value = &tsl2x7x_read_thresh, + .write_event_value = &tsl2x7x_write_thresh, + .read_event_config = &tsl2x7x_read_interrupt_config, + .write_event_config = &tsl2x7x_write_interrupt_config, + }, + [ALSPRX2] = { + .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX2], + .event_attrs = &tsl2X7X_event_attr_group_tbl[ALSPRX], + .driver_module = THIS_MODULE, + .read_raw = &tsl2x7x_read_raw, + .write_raw = &tsl2x7x_write_raw, + .read_event_value = &tsl2x7x_read_thresh, + .write_event_value = &tsl2x7x_write_thresh, + .read_event_config = &tsl2x7x_read_interrupt_config, + .write_event_config = &tsl2x7x_write_interrupt_config, + }, +}; + +static const struct iio_event_spec tsl2x7x_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 tsl2x7x_chip_info tsl2x7x_chip_info_tbl[] = { + [ALS] = { + .channel = { + { + .type = IIO_LIGHT, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), + }, { + .type = IIO_INTENSITY, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_CALIBSCALE) | + BIT(IIO_CHAN_INFO_CALIBBIAS), + .event_spec = tsl2x7x_events, + .num_event_specs = ARRAY_SIZE(tsl2x7x_events), + }, { + .type = IIO_INTENSITY, + .indexed = 1, + .channel = 1, + }, + }, + .chan_table_elements = 3, + .info = &tsl2X7X_device_info[ALS], + }, + [PRX] = { + .channel = { + { + .type = IIO_PROXIMITY, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .event_spec = tsl2x7x_events, + .num_event_specs = ARRAY_SIZE(tsl2x7x_events), + }, + }, + .chan_table_elements = 1, + .info = &tsl2X7X_device_info[PRX], + }, + [ALSPRX] = { + .channel = { + { + .type = IIO_LIGHT, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) + }, { + .type = IIO_INTENSITY, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_CALIBSCALE) | + BIT(IIO_CHAN_INFO_CALIBBIAS), + .event_spec = tsl2x7x_events, + .num_event_specs = ARRAY_SIZE(tsl2x7x_events), + }, { + .type = IIO_INTENSITY, + .indexed = 1, + .channel = 1, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_PROXIMITY, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .event_spec = tsl2x7x_events, + .num_event_specs = ARRAY_SIZE(tsl2x7x_events), + }, + }, + .chan_table_elements = 4, + .info = &tsl2X7X_device_info[ALSPRX], + }, + [PRX2] = { + .channel = { + { + .type = IIO_PROXIMITY, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_CALIBSCALE), + .event_spec = tsl2x7x_events, + .num_event_specs = ARRAY_SIZE(tsl2x7x_events), + }, + }, + .chan_table_elements = 1, + .info = &tsl2X7X_device_info[PRX2], + }, + [ALSPRX2] = { + .channel = { + { + .type = IIO_LIGHT, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), + }, { + .type = IIO_INTENSITY, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_CALIBSCALE) | + BIT(IIO_CHAN_INFO_CALIBBIAS), + .event_spec = tsl2x7x_events, + .num_event_specs = ARRAY_SIZE(tsl2x7x_events), + }, { + .type = IIO_INTENSITY, + .indexed = 1, + .channel = 1, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_PROXIMITY, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_CALIBSCALE), + .event_spec = tsl2x7x_events, + .num_event_specs = ARRAY_SIZE(tsl2x7x_events), + }, + }, + .chan_table_elements = 4, + .info = &tsl2X7X_device_info[ALSPRX2], + }, +}; + +static int tsl2x7x_probe(struct i2c_client *clientp, + const struct i2c_device_id *id) +{ + int ret; + unsigned char device_id; + struct iio_dev *indio_dev; + struct tsl2X7X_chip *chip; + + indio_dev = devm_iio_device_alloc(&clientp->dev, sizeof(*chip)); + if (!indio_dev) + return -ENOMEM; + + chip = iio_priv(indio_dev); + chip->client = clientp; + i2c_set_clientdata(clientp, indio_dev); + + ret = tsl2x7x_i2c_read(chip->client, + TSL2X7X_CHIPID, &device_id); + if (ret < 0) + return ret; + + if ((!tsl2x7x_device_id(&device_id, id->driver_data)) || + (tsl2x7x_device_id(&device_id, id->driver_data) == -EINVAL)) { + dev_info(&chip->client->dev, + "%s: i2c device found does not match expected id\n", + __func__); + return -EINVAL; + } + + ret = i2c_smbus_write_byte(clientp, (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); + if (ret < 0) { + dev_err(&clientp->dev, "write to cmd reg failed. err = %d\n", + ret); + return ret; + } + + /* + * ALS and PROX functions can be invoked via user space poll + * or H/W interrupt. If busy return last sample. + */ + mutex_init(&chip->als_mutex); + mutex_init(&chip->prox_mutex); + + chip->tsl2x7x_chip_status = TSL2X7X_CHIP_UNKNOWN; + 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]]; + + indio_dev->info = chip->chip_info->info; + indio_dev->dev.parent = &clientp->dev; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->name = chip->client->name; + indio_dev->channels = chip->chip_info->channel; + indio_dev->num_channels = chip->chip_info->chan_table_elements; + + if (clientp->irq) { + ret = devm_request_threaded_irq(&clientp->dev, clientp->irq, + NULL, + &tsl2x7x_event_handler, + IRQF_TRIGGER_RISING | + IRQF_ONESHOT, + "TSL2X7X_event", + indio_dev); + if (ret) { + dev_err(&clientp->dev, + "%s: irq request failed", __func__); + return ret; + } + } + + /* Load up the defaults */ + tsl2x7x_defaults(chip); + /* Make sure the chip is on */ + tsl2x7x_chip_on(indio_dev); + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err(&clientp->dev, + "%s: iio registration failed\n", __func__); + return ret; + } + + dev_info(&clientp->dev, "%s Light sensor found.\n", id->name); + + return 0; +} + +static int tsl2x7x_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + int ret = 0; + + if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) { + ret = tsl2x7x_chip_off(indio_dev); + chip->tsl2x7x_chip_status = TSL2X7X_CHIP_SUSPENDED; + } + + if (chip->pdata && chip->pdata->platform_power) { + pm_message_t pmm = {PM_EVENT_SUSPEND}; + + chip->pdata->platform_power(dev, pmm); + } + + return ret; +} + +static int tsl2x7x_resume(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); + int ret = 0; + + if (chip->pdata && chip->pdata->platform_power) { + pm_message_t pmm = {PM_EVENT_RESUME}; + + chip->pdata->platform_power(dev, pmm); + } + + if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_SUSPENDED) + ret = tsl2x7x_chip_on(indio_dev); + + return ret; +} + +static int tsl2x7x_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + + tsl2x7x_chip_off(indio_dev); + + iio_device_unregister(indio_dev); + + return 0; +} + +static struct i2c_device_id tsl2x7x_idtable[] = { + { "tsl2571", tsl2571 }, + { "tsl2671", tsl2671 }, + { "tmd2671", tmd2671 }, + { "tsl2771", tsl2771 }, + { "tmd2771", tmd2771 }, + { "tsl2572", tsl2572 }, + { "tsl2672", tsl2672 }, + { "tmd2672", tmd2672 }, + { "tsl2772", tsl2772 }, + { "tmd2772", tmd2772 }, + {} +}; + +MODULE_DEVICE_TABLE(i2c, tsl2x7x_idtable); + +static const struct dev_pm_ops tsl2x7x_pm_ops = { + .suspend = tsl2x7x_suspend, + .resume = tsl2x7x_resume, +}; + +/* Driver definition */ +static struct i2c_driver tsl2x7x_driver = { + .driver = { + .name = "tsl2x7x", + .pm = &tsl2x7x_pm_ops, + }, + .id_table = tsl2x7x_idtable, + .probe = tsl2x7x_probe, + .remove = tsl2x7x_remove, +}; + +module_i2c_driver(tsl2x7x_driver); + +MODULE_AUTHOR("J. August Brenner"); +MODULE_DESCRIPTION("TAOS tsl2x7x ambient and proximity light sensor driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c deleted file mode 100644 index 8121a5188638..000000000000 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ /dev/null @@ -1,2063 +0,0 @@ -/* - * Device driver for monitoring ambient light intensity in (lux) - * and proximity detection (prox) within the TAOS TSL2X7X family of devices. - * - * Copyright (c) 2012, TAOS Corporation. - * - * 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. - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tsl2x7x.h" - -/* Cal defs*/ -#define PROX_STAT_CAL 0 -#define PROX_STAT_SAMP 1 -#define MAX_SAMPLES_CAL 200 - -/* TSL2X7X Device ID */ -#define TRITON_ID 0x00 -#define SWORDFISH_ID 0x30 -#define HALIBUT_ID 0x20 - -/* Lux calculation constants */ -#define TSL2X7X_LUX_CALC_OVER_FLOW 65535 - -/* TAOS Register definitions - note: - * depending on device, some of these register are not used and the - * register address is benign. - */ -/* 2X7X register offsets */ -#define TSL2X7X_MAX_CONFIG_REG 16 - -/* Device Registers and Masks */ -#define TSL2X7X_CNTRL 0x00 -#define TSL2X7X_ALS_TIME 0X01 -#define TSL2X7X_PRX_TIME 0x02 -#define TSL2X7X_WAIT_TIME 0x03 -#define TSL2X7X_ALS_MINTHRESHLO 0X04 -#define TSL2X7X_ALS_MINTHRESHHI 0X05 -#define TSL2X7X_ALS_MAXTHRESHLO 0X06 -#define TSL2X7X_ALS_MAXTHRESHHI 0X07 -#define TSL2X7X_PRX_MINTHRESHLO 0X08 -#define TSL2X7X_PRX_MINTHRESHHI 0X09 -#define TSL2X7X_PRX_MAXTHRESHLO 0X0A -#define TSL2X7X_PRX_MAXTHRESHHI 0X0B -#define TSL2X7X_PERSISTENCE 0x0C -#define TSL2X7X_PRX_CONFIG 0x0D -#define TSL2X7X_PRX_COUNT 0x0E -#define TSL2X7X_GAIN 0x0F -#define TSL2X7X_NOTUSED 0x10 -#define TSL2X7X_REVID 0x11 -#define TSL2X7X_CHIPID 0x12 -#define TSL2X7X_STATUS 0x13 -#define TSL2X7X_ALS_CHAN0LO 0x14 -#define TSL2X7X_ALS_CHAN0HI 0x15 -#define TSL2X7X_ALS_CHAN1LO 0x16 -#define TSL2X7X_ALS_CHAN1HI 0x17 -#define TSL2X7X_PRX_LO 0x18 -#define TSL2X7X_PRX_HI 0x19 - -/* tsl2X7X cmd reg masks */ -#define TSL2X7X_CMD_REG 0x80 -#define TSL2X7X_CMD_SPL_FN 0x60 - -#define TSL2X7X_CMD_PROX_INT_CLR 0X05 -#define TSL2X7X_CMD_ALS_INT_CLR 0x06 -#define TSL2X7X_CMD_PROXALS_INT_CLR 0X07 - -/* tsl2X7X cntrl reg masks */ -#define TSL2X7X_CNTL_ADC_ENBL 0x02 -#define TSL2X7X_CNTL_PWR_ON 0x01 - -/* tsl2X7X status reg masks */ -#define TSL2X7X_STA_ADC_VALID 0x01 -#define TSL2X7X_STA_PRX_VALID 0x02 -#define TSL2X7X_STA_ADC_PRX_VALID (TSL2X7X_STA_ADC_VALID |\ - TSL2X7X_STA_PRX_VALID) -#define TSL2X7X_STA_ALS_INTR 0x10 -#define TSL2X7X_STA_PRX_INTR 0x20 - -/* tsl2X7X cntrl reg masks */ -#define TSL2X7X_CNTL_REG_CLEAR 0x00 -#define TSL2X7X_CNTL_PROX_INT_ENBL 0X20 -#define TSL2X7X_CNTL_ALS_INT_ENBL 0X10 -#define TSL2X7X_CNTL_WAIT_TMR_ENBL 0X08 -#define TSL2X7X_CNTL_PROX_DET_ENBL 0X04 -#define TSL2X7X_CNTL_PWRON 0x01 -#define TSL2X7X_CNTL_ALSPON_ENBL 0x03 -#define TSL2X7X_CNTL_INTALSPON_ENBL 0x13 -#define TSL2X7X_CNTL_PROXPON_ENBL 0x0F -#define TSL2X7X_CNTL_INTPROXPON_ENBL 0x2F - -/*Prox diode to use */ -#define TSL2X7X_DIODE0 0x10 -#define TSL2X7X_DIODE1 0x20 -#define TSL2X7X_DIODE_BOTH 0x30 - -/* LED Power */ -#define TSL2X7X_mA100 0x00 -#define TSL2X7X_mA50 0x40 -#define TSL2X7X_mA25 0x80 -#define TSL2X7X_mA13 0xD0 -#define TSL2X7X_MAX_TIMER_CNT (0xFF) - -#define TSL2X7X_MIN_ITIME 3 - -/* TAOS txx2x7x Device family members */ -enum { - tsl2571, - tsl2671, - tmd2671, - tsl2771, - tmd2771, - tsl2572, - tsl2672, - tmd2672, - tsl2772, - tmd2772 -}; - -enum { - TSL2X7X_CHIP_UNKNOWN = 0, - TSL2X7X_CHIP_WORKING = 1, - TSL2X7X_CHIP_SUSPENDED = 2 -}; - -struct tsl2x7x_parse_result { - int integer; - int fract; -}; - -/* Per-device data */ -struct tsl2x7x_als_info { - u16 als_ch0; - u16 als_ch1; - u16 lux; -}; - -struct tsl2x7x_prox_stat { - int min; - int max; - int mean; - unsigned long stddev; -}; - -struct tsl2x7x_chip_info { - int chan_table_elements; - struct iio_chan_spec channel[4]; - const struct iio_info *info; -}; - -struct tsl2X7X_chip { - kernel_ulong_t id; - struct mutex prox_mutex; - struct mutex als_mutex; - struct i2c_client *client; - u16 prox_data; - struct tsl2x7x_als_info als_cur_info; - struct tsl2x7x_settings tsl2x7x_settings; - struct tsl2X7X_platform_data *pdata; - int als_time_scale; - int als_saturation; - int tsl2x7x_chip_status; - u8 tsl2x7x_config[TSL2X7X_MAX_CONFIG_REG]; - const struct tsl2x7x_chip_info *chip_info; - const struct iio_info *info; - s64 event_timestamp; - /* - * This structure is intentionally large to accommodate - * updates via sysfs. - * Sized to 9 = max 8 segments + 1 termination segment - */ - struct tsl2x7x_lux tsl2x7x_device_lux[TSL2X7X_MAX_LUX_TABLE_SIZE]; -}; - -/* Different devices require different coefficents */ -static const struct tsl2x7x_lux tsl2x71_lux_table[] = { - { 14461, 611, 1211 }, - { 18540, 352, 623 }, - { 0, 0, 0 }, -}; - -static const struct tsl2x7x_lux tmd2x71_lux_table[] = { - { 11635, 115, 256 }, - { 15536, 87, 179 }, - { 0, 0, 0 }, -}; - -static const struct tsl2x7x_lux tsl2x72_lux_table[] = { - { 14013, 466, 917 }, - { 18222, 310, 552 }, - { 0, 0, 0 }, -}; - -static const struct tsl2x7x_lux tmd2x72_lux_table[] = { - { 13218, 130, 262 }, - { 17592, 92, 169 }, - { 0, 0, 0 }, -}; - -static const struct tsl2x7x_lux *tsl2x7x_default_lux_table_group[] = { - [tsl2571] = tsl2x71_lux_table, - [tsl2671] = tsl2x71_lux_table, - [tmd2671] = tmd2x71_lux_table, - [tsl2771] = tsl2x71_lux_table, - [tmd2771] = tmd2x71_lux_table, - [tsl2572] = tsl2x72_lux_table, - [tsl2672] = tsl2x72_lux_table, - [tmd2672] = tmd2x72_lux_table, - [tsl2772] = tsl2x72_lux_table, - [tmd2772] = tmd2x72_lux_table, -}; - -static const struct tsl2x7x_settings tsl2x7x_default_settings = { - .als_time = 219, /* 101 ms */ - .als_gain = 0, - .prx_time = 254, /* 5.4 ms */ - .prox_gain = 1, - .wait_time = 245, - .prox_config = 0, - .als_gain_trim = 1000, - .als_cal_target = 150, - .als_thresh_low = 200, - .als_thresh_high = 256, - .persistence = 255, - .interrupts_en = 0, - .prox_thres_low = 0, - .prox_thres_high = 512, - .prox_max_samples_cal = 30, - .prox_pulse_count = 8 -}; - -static const s16 tsl2X7X_als_gainadj[] = { - 1, - 8, - 16, - 120 -}; - -static const s16 tsl2X7X_prx_gainadj[] = { - 1, - 2, - 4, - 8 -}; - -/* Channel variations */ -enum { - ALS, - PRX, - ALSPRX, - PRX2, - ALSPRX2, -}; - -static const u8 device_channel_config[] = { - ALS, - PRX, - PRX, - ALSPRX, - ALSPRX, - ALS, - PRX2, - PRX2, - ALSPRX2, - ALSPRX2 -}; - -/** - * tsl2x7x_i2c_read() - Read a byte from a register. - * @client: i2c client - * @reg: device register to read from - * @*val: pointer to location to store register contents. - * - */ -static int -tsl2x7x_i2c_read(struct i2c_client *client, u8 reg, u8 *val) -{ - int ret; - - /* select register to write */ - ret = i2c_smbus_write_byte(client, (TSL2X7X_CMD_REG | reg)); - if (ret < 0) { - dev_err(&client->dev, "failed to write register %x\n", reg); - return ret; - } - - /* read the data */ - ret = i2c_smbus_read_byte(client); - if (ret >= 0) - *val = (u8)ret; - else - dev_err(&client->dev, "failed to read register %x\n", reg); - - return ret; -} - -/** - * tsl2x7x_get_lux() - Reads and calculates current lux value. - * @indio_dev: pointer to IIO device - * - * The raw ch0 and ch1 values of the ambient light sensed in the last - * integration cycle are read from the device. - * Time scale factor array values are adjusted based on the integration time. - * The raw values are multiplied by a scale factor, and device gain is obtained - * using gain index. Limit checks are done next, then the ratio of a multiple - * of ch1 value, to the ch0 value, is calculated. Array tsl2x7x_device_lux[] - * is then scanned to find the first ratio value that is just above the ratio - * we just calculated. The ch0 and ch1 multiplier constants in the array are - * then used along with the time scale factor array values, to calculate the - * lux. - */ -static int tsl2x7x_get_lux(struct iio_dev *indio_dev) -{ - u16 ch0, ch1; /* separated ch0/ch1 data from device */ - u32 lux; /* raw lux calculated from device data */ - u64 lux64; - u32 ratio; - u8 buf[4]; - struct tsl2x7x_lux *p; - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - int i, ret; - u32 ch0lux = 0; - u32 ch1lux = 0; - - if (mutex_trylock(&chip->als_mutex) == 0) - return chip->als_cur_info.lux; /* busy, so return LAST VALUE */ - - if (chip->tsl2x7x_chip_status != TSL2X7X_CHIP_WORKING) { - /* device is not enabled */ - dev_err(&chip->client->dev, "%s: device is not enabled\n", - __func__); - ret = -EBUSY; - goto out_unlock; - } - - ret = tsl2x7x_i2c_read(chip->client, - (TSL2X7X_CMD_REG | TSL2X7X_STATUS), &buf[0]); - if (ret < 0) { - dev_err(&chip->client->dev, - "%s: Failed to read STATUS Reg\n", __func__); - goto out_unlock; - } - /* is data new & valid */ - if (!(buf[0] & TSL2X7X_STA_ADC_VALID)) { - dev_err(&chip->client->dev, - "%s: data not valid yet\n", __func__); - ret = chip->als_cur_info.lux; /* return LAST VALUE */ - goto out_unlock; - } - - for (i = 0; i < 4; i++) { - ret = tsl2x7x_i2c_read(chip->client, - (TSL2X7X_CMD_REG | - (TSL2X7X_ALS_CHAN0LO + i)), &buf[i]); - if (ret < 0) { - dev_err(&chip->client->dev, - "failed to read. err=%x\n", ret); - goto out_unlock; - } - } - - /* clear any existing interrupt status */ - ret = i2c_smbus_write_byte(chip->client, - (TSL2X7X_CMD_REG | - TSL2X7X_CMD_SPL_FN | - TSL2X7X_CMD_ALS_INT_CLR)); - if (ret < 0) { - dev_err(&chip->client->dev, - "i2c_write_command failed - err = %d\n", ret); - goto out_unlock; /* have no data, so return failure */ - } - - /* extract ALS/lux data */ - ch0 = le16_to_cpup((const __le16 *)&buf[0]); - ch1 = le16_to_cpup((const __le16 *)&buf[2]); - - chip->als_cur_info.als_ch0 = ch0; - chip->als_cur_info.als_ch1 = ch1; - - if ((ch0 >= chip->als_saturation) || (ch1 >= chip->als_saturation)) { - lux = TSL2X7X_LUX_CALC_OVER_FLOW; - goto return_max; - } - - if (!ch0) { - /* have no data, so return LAST VALUE */ - ret = chip->als_cur_info.lux; - goto out_unlock; - } - /* calculate ratio */ - ratio = (ch1 << 15) / ch0; - /* convert to unscaled lux using the pointer to the table */ - p = (struct tsl2x7x_lux *)chip->tsl2x7x_device_lux; - while (p->ratio != 0 && p->ratio < ratio) - p++; - - if (p->ratio == 0) { - lux = 0; - } else { - ch0lux = DIV_ROUND_UP(ch0 * p->ch0, - tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]); - ch1lux = DIV_ROUND_UP(ch1 * p->ch1, - tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]); - lux = ch0lux - ch1lux; - } - - /* note: lux is 31 bit max at this point */ - if (ch1lux > ch0lux) { - dev_dbg(&chip->client->dev, "ch1lux > ch0lux-return last value\n"); - ret = chip->als_cur_info.lux; - goto out_unlock; - } - - /* adjust for active time scale */ - if (chip->als_time_scale == 0) - lux = 0; - else - lux = (lux + (chip->als_time_scale >> 1)) / - chip->als_time_scale; - - /* adjust for active gain scale - * The tsl2x7x_device_lux tables have a factor of 256 built-in. - * User-specified gain provides a multiplier. - * Apply user-specified gain before shifting right to retain precision. - * Use 64 bits to avoid overflow on multiplication. - * Then go back to 32 bits before division to avoid using div_u64(). - */ - - lux64 = lux; - lux64 = lux64 * chip->tsl2x7x_settings.als_gain_trim; - lux64 >>= 8; - lux = lux64; - lux = (lux + 500) / 1000; - - if (lux > TSL2X7X_LUX_CALC_OVER_FLOW) /* check for overflow */ - lux = TSL2X7X_LUX_CALC_OVER_FLOW; - - /* Update the structure with the latest lux. */ -return_max: - chip->als_cur_info.lux = lux; - ret = lux; - -out_unlock: - mutex_unlock(&chip->als_mutex); - - return ret; -} - -/** - * tsl2x7x_get_prox() - Reads proximity data registers and updates - * chip->prox_data. - * - * @indio_dev: pointer to IIO device - */ -static int tsl2x7x_get_prox(struct iio_dev *indio_dev) -{ - int i; - int ret; - u8 status; - u8 chdata[2]; - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - - if (mutex_trylock(&chip->prox_mutex) == 0) { - dev_err(&chip->client->dev, - "%s: Can't get prox mutex\n", __func__); - return -EBUSY; - } - - ret = tsl2x7x_i2c_read(chip->client, - (TSL2X7X_CMD_REG | TSL2X7X_STATUS), &status); - if (ret < 0) { - dev_err(&chip->client->dev, "i2c err=%d\n", ret); - goto prox_poll_err; - } - - switch (chip->id) { - case tsl2571: - case tsl2671: - case tmd2671: - case tsl2771: - case tmd2771: - if (!(status & TSL2X7X_STA_ADC_VALID)) - goto prox_poll_err; - break; - case tsl2572: - case tsl2672: - case tmd2672: - case tsl2772: - case tmd2772: - if (!(status & TSL2X7X_STA_PRX_VALID)) - goto prox_poll_err; - break; - } - - for (i = 0; i < 2; i++) { - ret = tsl2x7x_i2c_read(chip->client, - (TSL2X7X_CMD_REG | - (TSL2X7X_PRX_LO + i)), &chdata[i]); - if (ret < 0) - goto prox_poll_err; - } - - chip->prox_data = - le16_to_cpup((const __le16 *)&chdata[0]); - -prox_poll_err: - - mutex_unlock(&chip->prox_mutex); - - return chip->prox_data; -} - -/** - * tsl2x7x_defaults() - Populates the device nominal operating parameters - * with those provided by a 'platform' data struct or - * with prefined defaults. - * - * @chip: pointer to device structure. - */ -static void tsl2x7x_defaults(struct tsl2X7X_chip *chip) -{ - /* If Operational settings defined elsewhere.. */ - if (chip->pdata && chip->pdata->platform_default_settings) - memcpy(&chip->tsl2x7x_settings, - chip->pdata->platform_default_settings, - sizeof(tsl2x7x_default_settings)); - else - memcpy(&chip->tsl2x7x_settings, - &tsl2x7x_default_settings, - sizeof(tsl2x7x_default_settings)); - - /* Load up the proper lux table. */ - if (chip->pdata && chip->pdata->platform_lux_table[0].ratio != 0) - memcpy(chip->tsl2x7x_device_lux, - chip->pdata->platform_lux_table, - sizeof(chip->pdata->platform_lux_table)); - else - memcpy(chip->tsl2x7x_device_lux, - (struct tsl2x7x_lux *)tsl2x7x_default_lux_table_group[chip->id], - MAX_DEFAULT_TABLE_BYTES); -} - -/** - * tsl2x7x_als_calibrate() - Obtain single reading and calculate - * the als_gain_trim. - * - * @indio_dev: pointer to IIO device - */ -static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) -{ - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - u8 reg_val; - int gain_trim_val; - int ret; - int lux_val; - - ret = i2c_smbus_write_byte(chip->client, - (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); - if (ret < 0) { - dev_err(&chip->client->dev, - "failed to write CNTRL register, ret=%d\n", ret); - return ret; - } - - reg_val = i2c_smbus_read_byte(chip->client); - if ((reg_val & (TSL2X7X_CNTL_ADC_ENBL | TSL2X7X_CNTL_PWR_ON)) - != (TSL2X7X_CNTL_ADC_ENBL | TSL2X7X_CNTL_PWR_ON)) { - dev_err(&chip->client->dev, - "%s: failed: ADC not enabled\n", __func__); - return -1; - } - - ret = i2c_smbus_write_byte(chip->client, - (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); - if (ret < 0) { - dev_err(&chip->client->dev, - "failed to write ctrl reg: ret=%d\n", ret); - return ret; - } - - reg_val = i2c_smbus_read_byte(chip->client); - if ((reg_val & TSL2X7X_STA_ADC_VALID) != TSL2X7X_STA_ADC_VALID) { - dev_err(&chip->client->dev, - "%s: failed: STATUS - ADC not valid.\n", __func__); - return -ENODATA; - } - - lux_val = tsl2x7x_get_lux(indio_dev); - if (lux_val < 0) { - dev_err(&chip->client->dev, - "%s: failed to get lux\n", __func__); - return lux_val; - } - - gain_trim_val = ((chip->tsl2x7x_settings.als_cal_target) - * chip->tsl2x7x_settings.als_gain_trim) / lux_val; - if ((gain_trim_val < 250) || (gain_trim_val > 4000)) - return -ERANGE; - - chip->tsl2x7x_settings.als_gain_trim = gain_trim_val; - dev_info(&chip->client->dev, - "%s als_calibrate completed\n", chip->client->name); - - return (int)gain_trim_val; -} - -static int tsl2x7x_chip_on(struct iio_dev *indio_dev) -{ - int i; - int ret = 0; - u8 *dev_reg; - u8 utmp; - int als_count; - int als_time; - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - u8 reg_val = 0; - - if (chip->pdata && chip->pdata->power_on) - chip->pdata->power_on(indio_dev); - - /* Non calculated parameters */ - chip->tsl2x7x_config[TSL2X7X_PRX_TIME] = - chip->tsl2x7x_settings.prx_time; - chip->tsl2x7x_config[TSL2X7X_WAIT_TIME] = - chip->tsl2x7x_settings.wait_time; - chip->tsl2x7x_config[TSL2X7X_PRX_CONFIG] = - chip->tsl2x7x_settings.prox_config; - - chip->tsl2x7x_config[TSL2X7X_ALS_MINTHRESHLO] = - (chip->tsl2x7x_settings.als_thresh_low) & 0xFF; - chip->tsl2x7x_config[TSL2X7X_ALS_MINTHRESHHI] = - (chip->tsl2x7x_settings.als_thresh_low >> 8) & 0xFF; - chip->tsl2x7x_config[TSL2X7X_ALS_MAXTHRESHLO] = - (chip->tsl2x7x_settings.als_thresh_high) & 0xFF; - chip->tsl2x7x_config[TSL2X7X_ALS_MAXTHRESHHI] = - (chip->tsl2x7x_settings.als_thresh_high >> 8) & 0xFF; - chip->tsl2x7x_config[TSL2X7X_PERSISTENCE] = - chip->tsl2x7x_settings.persistence; - - chip->tsl2x7x_config[TSL2X7X_PRX_COUNT] = - chip->tsl2x7x_settings.prox_pulse_count; - chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHLO] = - (chip->tsl2x7x_settings.prox_thres_low) & 0xFF; - chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHHI] = - (chip->tsl2x7x_settings.prox_thres_low >> 8) & 0xFF; - chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHLO] = - (chip->tsl2x7x_settings.prox_thres_high) & 0xFF; - chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHHI] = - (chip->tsl2x7x_settings.prox_thres_high >> 8) & 0xFF; - - /* and make sure we're not already on */ - if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) { - /* if forcing a register update - turn off, then on */ - dev_info(&chip->client->dev, "device is already enabled\n"); - return -EINVAL; - } - - /* determine als integration register */ - als_count = (chip->tsl2x7x_settings.als_time * 100 + 135) / 270; - if (!als_count) - als_count = 1; /* ensure at least one cycle */ - - /* convert back to time (encompasses overrides) */ - als_time = (als_count * 27 + 5) / 10; - chip->tsl2x7x_config[TSL2X7X_ALS_TIME] = 256 - als_count; - - /* Set the gain based on tsl2x7x_settings struct */ - chip->tsl2x7x_config[TSL2X7X_GAIN] = - chip->tsl2x7x_settings.als_gain | - (TSL2X7X_mA100 | TSL2X7X_DIODE1) - | ((chip->tsl2x7x_settings.prox_gain) << 2); - - /* set chip struct re scaling and saturation */ - chip->als_saturation = als_count * 922; /* 90% of full scale */ - chip->als_time_scale = (als_time + 25) / 50; - - /* - * TSL2X7X Specific power-on / adc enable sequence - * Power on the device 1st. - */ - utmp = TSL2X7X_CNTL_PWR_ON; - ret = i2c_smbus_write_byte_data(chip->client, - TSL2X7X_CMD_REG | TSL2X7X_CNTRL, utmp); - if (ret < 0) { - dev_err(&chip->client->dev, - "%s: failed on CNTRL reg.\n", __func__); - return ret; - } - - /* - * Use the following shadow copy for our delay before enabling ADC. - * Write all the registers. - */ - for (i = 0, dev_reg = chip->tsl2x7x_config; - i < TSL2X7X_MAX_CONFIG_REG; i++) { - ret = i2c_smbus_write_byte_data(chip->client, - TSL2X7X_CMD_REG + i, - *dev_reg++); - if (ret < 0) { - dev_err(&chip->client->dev, - "failed on write to reg %d.\n", i); - return ret; - } - } - - mdelay(3); /* Power-on settling time */ - - /* - * NOW enable the ADC - * initialize the desired mode of operation - */ - utmp = TSL2X7X_CNTL_PWR_ON | - TSL2X7X_CNTL_ADC_ENBL | - TSL2X7X_CNTL_PROX_DET_ENBL; - ret = i2c_smbus_write_byte_data(chip->client, - TSL2X7X_CMD_REG | TSL2X7X_CNTRL, utmp); - if (ret < 0) { - dev_err(&chip->client->dev, - "%s: failed on 2nd CTRL reg.\n", __func__); - return ret; - } - - chip->tsl2x7x_chip_status = TSL2X7X_CHIP_WORKING; - - if (chip->tsl2x7x_settings.interrupts_en != 0) { - dev_info(&chip->client->dev, "Setting Up Interrupt(s)\n"); - - reg_val = TSL2X7X_CNTL_PWR_ON | TSL2X7X_CNTL_ADC_ENBL; - if ((chip->tsl2x7x_settings.interrupts_en == 0x20) || - (chip->tsl2x7x_settings.interrupts_en == 0x30)) - reg_val |= TSL2X7X_CNTL_PROX_DET_ENBL; - - reg_val |= chip->tsl2x7x_settings.interrupts_en; - ret = i2c_smbus_write_byte_data(chip->client, - (TSL2X7X_CMD_REG | - TSL2X7X_CNTRL), reg_val); - if (ret < 0) - dev_err(&chip->client->dev, - "%s: failed in tsl2x7x_IOCTL_INT_SET.\n", - __func__); - - /* Clear out any initial interrupts */ - ret = i2c_smbus_write_byte(chip->client, - TSL2X7X_CMD_REG | - TSL2X7X_CMD_SPL_FN | - TSL2X7X_CMD_PROXALS_INT_CLR); - if (ret < 0) { - dev_err(&chip->client->dev, - "%s: Failed to clear Int status\n", - __func__); - return ret; - } - } - - return ret; -} - -static int tsl2x7x_chip_off(struct iio_dev *indio_dev) -{ - int ret; - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - - /* turn device off */ - chip->tsl2x7x_chip_status = TSL2X7X_CHIP_SUSPENDED; - - ret = i2c_smbus_write_byte_data(chip->client, - TSL2X7X_CMD_REG | TSL2X7X_CNTRL, 0x00); - - if (chip->pdata && chip->pdata->power_off) - chip->pdata->power_off(chip->client); - - return ret; -} - -/** - * tsl2x7x_invoke_change - * @indio_dev: pointer to IIO device - * - * Obtain and lock both ALS and PROX resources, - * determine and save device state (On/Off), - * cycle device to implement updated parameter, - * put device back into proper state, and unlock - * resource. - */ -static -int tsl2x7x_invoke_change(struct iio_dev *indio_dev) -{ - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - int device_status = chip->tsl2x7x_chip_status; - - mutex_lock(&chip->als_mutex); - mutex_lock(&chip->prox_mutex); - - if (device_status == TSL2X7X_CHIP_WORKING) - tsl2x7x_chip_off(indio_dev); - - tsl2x7x_chip_on(indio_dev); - - if (device_status != TSL2X7X_CHIP_WORKING) - tsl2x7x_chip_off(indio_dev); - - mutex_unlock(&chip->prox_mutex); - mutex_unlock(&chip->als_mutex); - - return 0; -} - -static -void tsl2x7x_prox_calculate(int *data, int length, - struct tsl2x7x_prox_stat *statP) -{ - int i; - int sample_sum; - int tmp; - - if (!length) - length = 1; - - sample_sum = 0; - statP->min = INT_MAX; - statP->max = INT_MIN; - for (i = 0; i < length; i++) { - sample_sum += data[i]; - statP->min = min(statP->min, data[i]); - statP->max = max(statP->max, data[i]); - } - - statP->mean = sample_sum / length; - sample_sum = 0; - for (i = 0; i < length; i++) { - tmp = data[i] - statP->mean; - sample_sum += tmp * tmp; - } - statP->stddev = int_sqrt((long)sample_sum / length); -} - -/** - * tsl2x7x_prox_cal() - Calculates std. and sets thresholds. - * @indio_dev: pointer to IIO device - * - * Calculates a standard deviation based on the samples, - * and sets the threshold accordingly. - */ -static void tsl2x7x_prox_cal(struct iio_dev *indio_dev) -{ - int prox_history[MAX_SAMPLES_CAL + 1]; - int i; - struct tsl2x7x_prox_stat prox_stat_data[2]; - struct tsl2x7x_prox_stat *calP; - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - u8 tmp_irq_settings; - u8 current_state = chip->tsl2x7x_chip_status; - - if (chip->tsl2x7x_settings.prox_max_samples_cal > MAX_SAMPLES_CAL) { - dev_err(&chip->client->dev, - "max prox samples cal is too big: %d\n", - chip->tsl2x7x_settings.prox_max_samples_cal); - chip->tsl2x7x_settings.prox_max_samples_cal = MAX_SAMPLES_CAL; - } - - /* have to stop to change settings */ - tsl2x7x_chip_off(indio_dev); - - /* Enable proximity detection save just in case prox not wanted yet*/ - tmp_irq_settings = chip->tsl2x7x_settings.interrupts_en; - chip->tsl2x7x_settings.interrupts_en |= TSL2X7X_CNTL_PROX_INT_ENBL; - - /*turn on device if not already on*/ - tsl2x7x_chip_on(indio_dev); - - /*gather the samples*/ - for (i = 0; i < chip->tsl2x7x_settings.prox_max_samples_cal; i++) { - mdelay(15); - tsl2x7x_get_prox(indio_dev); - prox_history[i] = chip->prox_data; - dev_info(&chip->client->dev, "2 i=%d prox data= %d\n", - i, chip->prox_data); - } - - tsl2x7x_chip_off(indio_dev); - calP = &prox_stat_data[PROX_STAT_CAL]; - tsl2x7x_prox_calculate(prox_history, - chip->tsl2x7x_settings.prox_max_samples_cal, - calP); - chip->tsl2x7x_settings.prox_thres_high = (calP->max << 1) - calP->mean; - - dev_info(&chip->client->dev, " cal min=%d mean=%d max=%d\n", - calP->min, calP->mean, calP->max); - dev_info(&chip->client->dev, - "%s proximity threshold set to %d\n", - chip->client->name, chip->tsl2x7x_settings.prox_thres_high); - - /* back to the way they were */ - chip->tsl2x7x_settings.interrupts_en = tmp_irq_settings; - if (current_state == TSL2X7X_CHIP_WORKING) - tsl2x7x_chip_on(indio_dev); -} - -static ssize_t tsl2x7x_power_state_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); - - return snprintf(buf, PAGE_SIZE, "%d\n", chip->tsl2x7x_chip_status); -} - -static ssize_t tsl2x7x_power_state_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - bool value; - - if (strtobool(buf, &value)) - return -EINVAL; - - if (value) - tsl2x7x_chip_on(indio_dev); - else - tsl2x7x_chip_off(indio_dev); - - return len; -} - -static ssize_t tsl2x7x_gain_available_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); - - switch (chip->id) { - case tsl2571: - case tsl2671: - case tmd2671: - case tsl2771: - case tmd2771: - return snprintf(buf, PAGE_SIZE, "%s\n", "1 8 16 128"); - } - - return snprintf(buf, PAGE_SIZE, "%s\n", "1 8 16 120"); -} - -static ssize_t tsl2x7x_prox_gain_available_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return snprintf(buf, PAGE_SIZE, "%s\n", "1 2 4 8"); -} - -static ssize_t tsl2x7x_als_time_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); - int y, z; - - y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1; - z = y * TSL2X7X_MIN_ITIME; - y /= 1000; - z %= 1000; - - return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); -} - -static ssize_t tsl2x7x_als_time_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - struct tsl2x7x_parse_result result; - int ret; - - ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract); - if (ret) - return ret; - - result.fract /= 3; - chip->tsl2x7x_settings.als_time = - TSL2X7X_MAX_TIMER_CNT - (u8)result.fract; - - dev_info(&chip->client->dev, "%s: als time = %d", - __func__, chip->tsl2x7x_settings.als_time); - - tsl2x7x_invoke_change(indio_dev); - - return IIO_VAL_INT_PLUS_MICRO; -} - -static IIO_CONST_ATTR(in_illuminance0_integration_time_available, - ".00272 - .696"); - -static ssize_t tsl2x7x_als_cal_target_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); - - return snprintf(buf, PAGE_SIZE, "%d\n", - chip->tsl2x7x_settings.als_cal_target); -} - -static ssize_t tsl2x7x_als_cal_target_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - unsigned long value; - - if (kstrtoul(buf, 0, &value)) - return -EINVAL; - - if (value) - chip->tsl2x7x_settings.als_cal_target = value; - - tsl2x7x_invoke_change(indio_dev); - - return len; -} - -/* persistence settings */ -static ssize_t tsl2x7x_als_persistence_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); - int y, z, filter_delay; - - /* Determine integration time */ - y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1; - z = y * TSL2X7X_MIN_ITIME; - filter_delay = z * (chip->tsl2x7x_settings.persistence & 0x0F); - y = filter_delay / 1000; - z = filter_delay % 1000; - - return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); -} - -static ssize_t tsl2x7x_als_persistence_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - struct tsl2x7x_parse_result result; - int y, z, filter_delay; - int ret; - - ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract); - if (ret) - return ret; - - y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1; - z = y * TSL2X7X_MIN_ITIME; - - filter_delay = - DIV_ROUND_UP((result.integer * 1000) + result.fract, z); - - chip->tsl2x7x_settings.persistence &= 0xF0; - chip->tsl2x7x_settings.persistence |= (filter_delay & 0x0F); - - dev_info(&chip->client->dev, "%s: als persistence = %d", - __func__, filter_delay); - - tsl2x7x_invoke_change(indio_dev); - - return IIO_VAL_INT_PLUS_MICRO; -} - -static ssize_t tsl2x7x_prox_persistence_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); - int y, z, filter_delay; - - /* Determine integration time */ - y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1; - z = y * TSL2X7X_MIN_ITIME; - filter_delay = z * ((chip->tsl2x7x_settings.persistence & 0xF0) >> 4); - y = filter_delay / 1000; - z = filter_delay % 1000; - - return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); -} - -static ssize_t tsl2x7x_prox_persistence_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - struct tsl2x7x_parse_result result; - int y, z, filter_delay; - int ret; - - ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract); - if (ret) - return ret; - - y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1; - z = y * TSL2X7X_MIN_ITIME; - - filter_delay = - DIV_ROUND_UP((result.integer * 1000) + result.fract, z); - - chip->tsl2x7x_settings.persistence &= 0x0F; - chip->tsl2x7x_settings.persistence |= ((filter_delay << 4) & 0xF0); - - dev_info(&chip->client->dev, "%s: prox persistence = %d", - __func__, filter_delay); - - tsl2x7x_invoke_change(indio_dev); - - return IIO_VAL_INT_PLUS_MICRO; -} - -static ssize_t tsl2x7x_do_calibrate(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - bool value; - - if (strtobool(buf, &value)) - return -EINVAL; - - if (value) - tsl2x7x_als_calibrate(indio_dev); - - tsl2x7x_invoke_change(indio_dev); - - return len; -} - -static ssize_t tsl2x7x_luxtable_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev)); - int i = 0; - int offset = 0; - - while (i < (TSL2X7X_MAX_LUX_TABLE_SIZE * 3)) { - offset += snprintf(buf + offset, PAGE_SIZE, "%u,%u,%u,", - chip->tsl2x7x_device_lux[i].ratio, - chip->tsl2x7x_device_lux[i].ch0, - chip->tsl2x7x_device_lux[i].ch1); - if (chip->tsl2x7x_device_lux[i].ratio == 0) { - /* - * We just printed the first "0" entry. - * Now get rid of the extra "," and break. - */ - offset--; - break; - } - i++; - } - - offset += snprintf(buf + offset, PAGE_SIZE, "\n"); - return offset; -} - -static ssize_t tsl2x7x_luxtable_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - int value[ARRAY_SIZE(chip->tsl2x7x_device_lux) * 3 + 1]; - int n; - - get_options(buf, ARRAY_SIZE(value), value); - - /* We now have an array of ints starting at value[1], and - * enumerated by value[0]. - * We expect each group of three ints is one table entry, - * and the last table entry is all 0. - */ - n = value[0]; - if ((n % 3) || n < 6 || - n > ((ARRAY_SIZE(chip->tsl2x7x_device_lux) - 1) * 3)) { - dev_info(dev, "LUX TABLE INPUT ERROR 1 Value[0]=%d\n", n); - return -EINVAL; - } - - if ((value[(n - 2)] | value[(n - 1)] | value[n]) != 0) { - dev_info(dev, "LUX TABLE INPUT ERROR 2 Value[0]=%d\n", n); - return -EINVAL; - } - - if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) - tsl2x7x_chip_off(indio_dev); - - /* Zero out the table */ - memset(chip->tsl2x7x_device_lux, 0, sizeof(chip->tsl2x7x_device_lux)); - memcpy(chip->tsl2x7x_device_lux, &value[1], (value[0] * 4)); - - tsl2x7x_invoke_change(indio_dev); - - return len; -} - -static ssize_t tsl2x7x_do_prox_calibrate(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - bool value; - - if (strtobool(buf, &value)) - return -EINVAL; - - if (value) - tsl2x7x_prox_cal(indio_dev); - - tsl2x7x_invoke_change(indio_dev); - - return len; -} - -static int tsl2x7x_read_interrupt_config(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, - enum iio_event_type type, - enum iio_event_direction dir) -{ - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - int ret; - - if (chan->type == IIO_INTENSITY) - ret = !!(chip->tsl2x7x_settings.interrupts_en & 0x10); - else - ret = !!(chip->tsl2x7x_settings.interrupts_en & 0x20); - - return ret; -} - -static int tsl2x7x_write_interrupt_config(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, - enum iio_event_type type, - enum iio_event_direction dir, - int val) -{ - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - - if (chan->type == IIO_INTENSITY) { - if (val) - chip->tsl2x7x_settings.interrupts_en |= 0x10; - else - chip->tsl2x7x_settings.interrupts_en &= 0x20; - } else { - if (val) - chip->tsl2x7x_settings.interrupts_en |= 0x20; - else - chip->tsl2x7x_settings.interrupts_en &= 0x10; - } - - tsl2x7x_invoke_change(indio_dev); - - return 0; -} - -static int tsl2x7x_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 tsl2X7X_chip *chip = iio_priv(indio_dev); - - if (chan->type == IIO_INTENSITY) { - switch (dir) { - case IIO_EV_DIR_RISING: - chip->tsl2x7x_settings.als_thresh_high = val; - break; - case IIO_EV_DIR_FALLING: - chip->tsl2x7x_settings.als_thresh_low = val; - break; - default: - return -EINVAL; - } - } else { - switch (dir) { - case IIO_EV_DIR_RISING: - chip->tsl2x7x_settings.prox_thres_high = val; - break; - case IIO_EV_DIR_FALLING: - chip->tsl2x7x_settings.prox_thres_low = val; - break; - default: - return -EINVAL; - } - } - - tsl2x7x_invoke_change(indio_dev); - - return 0; -} - -static int tsl2x7x_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 tsl2X7X_chip *chip = iio_priv(indio_dev); - - if (chan->type == IIO_INTENSITY) { - switch (dir) { - case IIO_EV_DIR_RISING: - *val = chip->tsl2x7x_settings.als_thresh_high; - break; - case IIO_EV_DIR_FALLING: - *val = chip->tsl2x7x_settings.als_thresh_low; - break; - default: - return -EINVAL; - } - } else { - switch (dir) { - case IIO_EV_DIR_RISING: - *val = chip->tsl2x7x_settings.prox_thres_high; - break; - case IIO_EV_DIR_FALLING: - *val = chip->tsl2x7x_settings.prox_thres_low; - break; - default: - return -EINVAL; - } - } - - return IIO_VAL_INT; -} - -static int tsl2x7x_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long mask) -{ - int ret = -EINVAL; - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - - switch (mask) { - case IIO_CHAN_INFO_PROCESSED: - switch (chan->type) { - case IIO_LIGHT: - tsl2x7x_get_lux(indio_dev); - *val = chip->als_cur_info.lux; - ret = IIO_VAL_INT; - break; - default: - return -EINVAL; - } - break; - case IIO_CHAN_INFO_RAW: - switch (chan->type) { - case IIO_INTENSITY: - tsl2x7x_get_lux(indio_dev); - if (chan->channel == 0) - *val = chip->als_cur_info.als_ch0; - else - *val = chip->als_cur_info.als_ch1; - ret = IIO_VAL_INT; - break; - case IIO_PROXIMITY: - tsl2x7x_get_prox(indio_dev); - *val = chip->prox_data; - ret = IIO_VAL_INT; - break; - default: - return -EINVAL; - } - break; - case IIO_CHAN_INFO_CALIBSCALE: - if (chan->type == IIO_LIGHT) - *val = - tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]; - else - *val = - tsl2X7X_prx_gainadj[chip->tsl2x7x_settings.prox_gain]; - ret = IIO_VAL_INT; - break; - case IIO_CHAN_INFO_CALIBBIAS: - *val = chip->tsl2x7x_settings.als_gain_trim; - ret = IIO_VAL_INT; - break; - - default: - ret = -EINVAL; - } - - return ret; -} - -static int tsl2x7x_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, - int val2, - long mask) -{ - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - - switch (mask) { - case IIO_CHAN_INFO_CALIBSCALE: - if (chan->type == IIO_INTENSITY) { - switch (val) { - case 1: - chip->tsl2x7x_settings.als_gain = 0; - break; - case 8: - chip->tsl2x7x_settings.als_gain = 1; - break; - case 16: - chip->tsl2x7x_settings.als_gain = 2; - break; - case 120: - switch (chip->id) { - case tsl2572: - case tsl2672: - case tmd2672: - case tsl2772: - case tmd2772: - return -EINVAL; - } - chip->tsl2x7x_settings.als_gain = 3; - break; - case 128: - switch (chip->id) { - case tsl2571: - case tsl2671: - case tmd2671: - case tsl2771: - case tmd2771: - return -EINVAL; - } - chip->tsl2x7x_settings.als_gain = 3; - break; - default: - return -EINVAL; - } - } else { - switch (val) { - case 1: - chip->tsl2x7x_settings.prox_gain = 0; - break; - case 2: - chip->tsl2x7x_settings.prox_gain = 1; - break; - case 4: - chip->tsl2x7x_settings.prox_gain = 2; - break; - case 8: - chip->tsl2x7x_settings.prox_gain = 3; - break; - default: - return -EINVAL; - } - } - break; - case IIO_CHAN_INFO_CALIBBIAS: - chip->tsl2x7x_settings.als_gain_trim = val; - break; - - default: - return -EINVAL; - } - - tsl2x7x_invoke_change(indio_dev); - - return 0; -} - -static DEVICE_ATTR(power_state, 0644, - tsl2x7x_power_state_show, tsl2x7x_power_state_store); - -static DEVICE_ATTR(in_proximity0_calibscale_available, 0444, - tsl2x7x_prox_gain_available_show, NULL); - -static DEVICE_ATTR(in_illuminance0_calibscale_available, 0444, - tsl2x7x_gain_available_show, NULL); - -static DEVICE_ATTR(in_illuminance0_integration_time, 0644, - tsl2x7x_als_time_show, tsl2x7x_als_time_store); - -static DEVICE_ATTR(in_illuminance0_target_input, 0644, - tsl2x7x_als_cal_target_show, tsl2x7x_als_cal_target_store); - -static DEVICE_ATTR(in_illuminance0_calibrate, 0200, NULL, - tsl2x7x_do_calibrate); - -static DEVICE_ATTR(in_proximity0_calibrate, 0200, NULL, - tsl2x7x_do_prox_calibrate); - -static DEVICE_ATTR(in_illuminance0_lux_table, 0644, - tsl2x7x_luxtable_show, tsl2x7x_luxtable_store); - -static DEVICE_ATTR(in_intensity0_thresh_period, 0644, - tsl2x7x_als_persistence_show, tsl2x7x_als_persistence_store); - -static DEVICE_ATTR(in_proximity0_thresh_period, 0644, - tsl2x7x_prox_persistence_show, tsl2x7x_prox_persistence_store); - -/* Use the default register values to identify the Taos device */ -static int tsl2x7x_device_id(unsigned char *id, int target) -{ - switch (target) { - case tsl2571: - case tsl2671: - case tsl2771: - return (*id & 0xf0) == TRITON_ID; - case tmd2671: - case tmd2771: - return (*id & 0xf0) == HALIBUT_ID; - case tsl2572: - case tsl2672: - case tmd2672: - case tsl2772: - case tmd2772: - return (*id & 0xf0) == SWORDFISH_ID; - } - - return -EINVAL; -} - -static irqreturn_t tsl2x7x_event_handler(int irq, void *private) -{ - struct iio_dev *indio_dev = private; - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - s64 timestamp = iio_get_time_ns(indio_dev); - int ret; - u8 value; - - value = i2c_smbus_read_byte_data(chip->client, - TSL2X7X_CMD_REG | TSL2X7X_STATUS); - - /* What type of interrupt do we need to process */ - if (value & TSL2X7X_STA_PRX_INTR) { - tsl2x7x_get_prox(indio_dev); /* freshen data for ABI */ - iio_push_event(indio_dev, - IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, - 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_EITHER), - timestamp); - } - - if (value & TSL2X7X_STA_ALS_INTR) { - tsl2x7x_get_lux(indio_dev); /* freshen data for ABI */ - iio_push_event(indio_dev, - IIO_UNMOD_EVENT_CODE(IIO_LIGHT, - 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_EITHER), - timestamp); - } - /* Clear interrupt now that we have handled it. */ - ret = i2c_smbus_write_byte(chip->client, - TSL2X7X_CMD_REG | TSL2X7X_CMD_SPL_FN | - TSL2X7X_CMD_PROXALS_INT_CLR); - if (ret < 0) - dev_err(&chip->client->dev, - "Failed to clear irq from event handler. err = %d\n", - ret); - - return IRQ_HANDLED; -} - -static struct attribute *tsl2x7x_ALS_device_attrs[] = { - &dev_attr_power_state.attr, - &dev_attr_in_illuminance0_calibscale_available.attr, - &dev_attr_in_illuminance0_integration_time.attr, - &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr, - &dev_attr_in_illuminance0_target_input.attr, - &dev_attr_in_illuminance0_calibrate.attr, - &dev_attr_in_illuminance0_lux_table.attr, - NULL -}; - -static struct attribute *tsl2x7x_PRX_device_attrs[] = { - &dev_attr_power_state.attr, - &dev_attr_in_proximity0_calibrate.attr, - NULL -}; - -static struct attribute *tsl2x7x_ALSPRX_device_attrs[] = { - &dev_attr_power_state.attr, - &dev_attr_in_illuminance0_calibscale_available.attr, - &dev_attr_in_illuminance0_integration_time.attr, - &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr, - &dev_attr_in_illuminance0_target_input.attr, - &dev_attr_in_illuminance0_calibrate.attr, - &dev_attr_in_illuminance0_lux_table.attr, - &dev_attr_in_proximity0_calibrate.attr, - NULL -}; - -static struct attribute *tsl2x7x_PRX2_device_attrs[] = { - &dev_attr_power_state.attr, - &dev_attr_in_proximity0_calibrate.attr, - &dev_attr_in_proximity0_calibscale_available.attr, - NULL -}; - -static struct attribute *tsl2x7x_ALSPRX2_device_attrs[] = { - &dev_attr_power_state.attr, - &dev_attr_in_illuminance0_calibscale_available.attr, - &dev_attr_in_illuminance0_integration_time.attr, - &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr, - &dev_attr_in_illuminance0_target_input.attr, - &dev_attr_in_illuminance0_calibrate.attr, - &dev_attr_in_illuminance0_lux_table.attr, - &dev_attr_in_proximity0_calibrate.attr, - &dev_attr_in_proximity0_calibscale_available.attr, - NULL -}; - -static struct attribute *tsl2X7X_ALS_event_attrs[] = { - &dev_attr_in_intensity0_thresh_period.attr, - NULL, -}; - -static struct attribute *tsl2X7X_PRX_event_attrs[] = { - &dev_attr_in_proximity0_thresh_period.attr, - NULL, -}; - -static struct attribute *tsl2X7X_ALSPRX_event_attrs[] = { - &dev_attr_in_intensity0_thresh_period.attr, - &dev_attr_in_proximity0_thresh_period.attr, - NULL, -}; - -static const struct attribute_group tsl2X7X_device_attr_group_tbl[] = { - [ALS] = { - .attrs = tsl2x7x_ALS_device_attrs, - }, - [PRX] = { - .attrs = tsl2x7x_PRX_device_attrs, - }, - [ALSPRX] = { - .attrs = tsl2x7x_ALSPRX_device_attrs, - }, - [PRX2] = { - .attrs = tsl2x7x_PRX2_device_attrs, - }, - [ALSPRX2] = { - .attrs = tsl2x7x_ALSPRX2_device_attrs, - }, -}; - -static const struct attribute_group tsl2X7X_event_attr_group_tbl[] = { - [ALS] = { - .attrs = tsl2X7X_ALS_event_attrs, - .name = "events", - }, - [PRX] = { - .attrs = tsl2X7X_PRX_event_attrs, - .name = "events", - }, - [ALSPRX] = { - .attrs = tsl2X7X_ALSPRX_event_attrs, - .name = "events", - }, -}; - -static const struct iio_info tsl2X7X_device_info[] = { - [ALS] = { - .attrs = &tsl2X7X_device_attr_group_tbl[ALS], - .event_attrs = &tsl2X7X_event_attr_group_tbl[ALS], - .driver_module = THIS_MODULE, - .read_raw = &tsl2x7x_read_raw, - .write_raw = &tsl2x7x_write_raw, - .read_event_value = &tsl2x7x_read_thresh, - .write_event_value = &tsl2x7x_write_thresh, - .read_event_config = &tsl2x7x_read_interrupt_config, - .write_event_config = &tsl2x7x_write_interrupt_config, - }, - [PRX] = { - .attrs = &tsl2X7X_device_attr_group_tbl[PRX], - .event_attrs = &tsl2X7X_event_attr_group_tbl[PRX], - .driver_module = THIS_MODULE, - .read_raw = &tsl2x7x_read_raw, - .write_raw = &tsl2x7x_write_raw, - .read_event_value = &tsl2x7x_read_thresh, - .write_event_value = &tsl2x7x_write_thresh, - .read_event_config = &tsl2x7x_read_interrupt_config, - .write_event_config = &tsl2x7x_write_interrupt_config, - }, - [ALSPRX] = { - .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX], - .event_attrs = &tsl2X7X_event_attr_group_tbl[ALSPRX], - .driver_module = THIS_MODULE, - .read_raw = &tsl2x7x_read_raw, - .write_raw = &tsl2x7x_write_raw, - .read_event_value = &tsl2x7x_read_thresh, - .write_event_value = &tsl2x7x_write_thresh, - .read_event_config = &tsl2x7x_read_interrupt_config, - .write_event_config = &tsl2x7x_write_interrupt_config, - }, - [PRX2] = { - .attrs = &tsl2X7X_device_attr_group_tbl[PRX2], - .event_attrs = &tsl2X7X_event_attr_group_tbl[PRX], - .driver_module = THIS_MODULE, - .read_raw = &tsl2x7x_read_raw, - .write_raw = &tsl2x7x_write_raw, - .read_event_value = &tsl2x7x_read_thresh, - .write_event_value = &tsl2x7x_write_thresh, - .read_event_config = &tsl2x7x_read_interrupt_config, - .write_event_config = &tsl2x7x_write_interrupt_config, - }, - [ALSPRX2] = { - .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX2], - .event_attrs = &tsl2X7X_event_attr_group_tbl[ALSPRX], - .driver_module = THIS_MODULE, - .read_raw = &tsl2x7x_read_raw, - .write_raw = &tsl2x7x_write_raw, - .read_event_value = &tsl2x7x_read_thresh, - .write_event_value = &tsl2x7x_write_thresh, - .read_event_config = &tsl2x7x_read_interrupt_config, - .write_event_config = &tsl2x7x_write_interrupt_config, - }, -}; - -static const struct iio_event_spec tsl2x7x_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 tsl2x7x_chip_info tsl2x7x_chip_info_tbl[] = { - [ALS] = { - .channel = { - { - .type = IIO_LIGHT, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), - }, { - .type = IIO_INTENSITY, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_CALIBSCALE) | - BIT(IIO_CHAN_INFO_CALIBBIAS), - .event_spec = tsl2x7x_events, - .num_event_specs = ARRAY_SIZE(tsl2x7x_events), - }, { - .type = IIO_INTENSITY, - .indexed = 1, - .channel = 1, - }, - }, - .chan_table_elements = 3, - .info = &tsl2X7X_device_info[ALS], - }, - [PRX] = { - .channel = { - { - .type = IIO_PROXIMITY, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .event_spec = tsl2x7x_events, - .num_event_specs = ARRAY_SIZE(tsl2x7x_events), - }, - }, - .chan_table_elements = 1, - .info = &tsl2X7X_device_info[PRX], - }, - [ALSPRX] = { - .channel = { - { - .type = IIO_LIGHT, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) - }, { - .type = IIO_INTENSITY, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_CALIBSCALE) | - BIT(IIO_CHAN_INFO_CALIBBIAS), - .event_spec = tsl2x7x_events, - .num_event_specs = ARRAY_SIZE(tsl2x7x_events), - }, { - .type = IIO_INTENSITY, - .indexed = 1, - .channel = 1, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - }, { - .type = IIO_PROXIMITY, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .event_spec = tsl2x7x_events, - .num_event_specs = ARRAY_SIZE(tsl2x7x_events), - }, - }, - .chan_table_elements = 4, - .info = &tsl2X7X_device_info[ALSPRX], - }, - [PRX2] = { - .channel = { - { - .type = IIO_PROXIMITY, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_CALIBSCALE), - .event_spec = tsl2x7x_events, - .num_event_specs = ARRAY_SIZE(tsl2x7x_events), - }, - }, - .chan_table_elements = 1, - .info = &tsl2X7X_device_info[PRX2], - }, - [ALSPRX2] = { - .channel = { - { - .type = IIO_LIGHT, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), - }, { - .type = IIO_INTENSITY, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_CALIBSCALE) | - BIT(IIO_CHAN_INFO_CALIBBIAS), - .event_spec = tsl2x7x_events, - .num_event_specs = ARRAY_SIZE(tsl2x7x_events), - }, { - .type = IIO_INTENSITY, - .indexed = 1, - .channel = 1, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - }, { - .type = IIO_PROXIMITY, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_CALIBSCALE), - .event_spec = tsl2x7x_events, - .num_event_specs = ARRAY_SIZE(tsl2x7x_events), - }, - }, - .chan_table_elements = 4, - .info = &tsl2X7X_device_info[ALSPRX2], - }, -}; - -static int tsl2x7x_probe(struct i2c_client *clientp, - const struct i2c_device_id *id) -{ - int ret; - unsigned char device_id; - struct iio_dev *indio_dev; - struct tsl2X7X_chip *chip; - - indio_dev = devm_iio_device_alloc(&clientp->dev, sizeof(*chip)); - if (!indio_dev) - return -ENOMEM; - - chip = iio_priv(indio_dev); - chip->client = clientp; - i2c_set_clientdata(clientp, indio_dev); - - ret = tsl2x7x_i2c_read(chip->client, - TSL2X7X_CHIPID, &device_id); - if (ret < 0) - return ret; - - if ((!tsl2x7x_device_id(&device_id, id->driver_data)) || - (tsl2x7x_device_id(&device_id, id->driver_data) == -EINVAL)) { - dev_info(&chip->client->dev, - "%s: i2c device found does not match expected id\n", - __func__); - return -EINVAL; - } - - ret = i2c_smbus_write_byte(clientp, (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); - if (ret < 0) { - dev_err(&clientp->dev, "write to cmd reg failed. err = %d\n", - ret); - return ret; - } - - /* - * ALS and PROX functions can be invoked via user space poll - * or H/W interrupt. If busy return last sample. - */ - mutex_init(&chip->als_mutex); - mutex_init(&chip->prox_mutex); - - chip->tsl2x7x_chip_status = TSL2X7X_CHIP_UNKNOWN; - 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]]; - - indio_dev->info = chip->chip_info->info; - indio_dev->dev.parent = &clientp->dev; - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->name = chip->client->name; - indio_dev->channels = chip->chip_info->channel; - indio_dev->num_channels = chip->chip_info->chan_table_elements; - - if (clientp->irq) { - ret = devm_request_threaded_irq(&clientp->dev, clientp->irq, - NULL, - &tsl2x7x_event_handler, - IRQF_TRIGGER_RISING | - IRQF_ONESHOT, - "TSL2X7X_event", - indio_dev); - if (ret) { - dev_err(&clientp->dev, - "%s: irq request failed", __func__); - return ret; - } - } - - /* Load up the defaults */ - tsl2x7x_defaults(chip); - /* Make sure the chip is on */ - tsl2x7x_chip_on(indio_dev); - - ret = iio_device_register(indio_dev); - if (ret) { - dev_err(&clientp->dev, - "%s: iio registration failed\n", __func__); - return ret; - } - - dev_info(&clientp->dev, "%s Light sensor found.\n", id->name); - - return 0; -} - -static int tsl2x7x_suspend(struct device *dev) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - int ret = 0; - - if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) { - ret = tsl2x7x_chip_off(indio_dev); - chip->tsl2x7x_chip_status = TSL2X7X_CHIP_SUSPENDED; - } - - if (chip->pdata && chip->pdata->platform_power) { - pm_message_t pmm = {PM_EVENT_SUSPEND}; - - chip->pdata->platform_power(dev, pmm); - } - - return ret; -} - -static int tsl2x7x_resume(struct device *dev) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct tsl2X7X_chip *chip = iio_priv(indio_dev); - int ret = 0; - - if (chip->pdata && chip->pdata->platform_power) { - pm_message_t pmm = {PM_EVENT_RESUME}; - - chip->pdata->platform_power(dev, pmm); - } - - if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_SUSPENDED) - ret = tsl2x7x_chip_on(indio_dev); - - return ret; -} - -static int tsl2x7x_remove(struct i2c_client *client) -{ - struct iio_dev *indio_dev = i2c_get_clientdata(client); - - tsl2x7x_chip_off(indio_dev); - - iio_device_unregister(indio_dev); - - return 0; -} - -static struct i2c_device_id tsl2x7x_idtable[] = { - { "tsl2571", tsl2571 }, - { "tsl2671", tsl2671 }, - { "tmd2671", tmd2671 }, - { "tsl2771", tsl2771 }, - { "tmd2771", tmd2771 }, - { "tsl2572", tsl2572 }, - { "tsl2672", tsl2672 }, - { "tmd2672", tmd2672 }, - { "tsl2772", tsl2772 }, - { "tmd2772", tmd2772 }, - {} -}; - -MODULE_DEVICE_TABLE(i2c, tsl2x7x_idtable); - -static const struct dev_pm_ops tsl2x7x_pm_ops = { - .suspend = tsl2x7x_suspend, - .resume = tsl2x7x_resume, -}; - -/* Driver definition */ -static struct i2c_driver tsl2x7x_driver = { - .driver = { - .name = "tsl2x7x", - .pm = &tsl2x7x_pm_ops, - }, - .id_table = tsl2x7x_idtable, - .probe = tsl2x7x_probe, - .remove = tsl2x7x_remove, -}; - -module_i2c_driver(tsl2x7x_driver); - -MODULE_AUTHOR("J. August Brenner"); -MODULE_DESCRIPTION("TAOS tsl2x7x ambient and proximity light sensor driver"); -MODULE_LICENSE("GPL"); -- cgit v1.2.3-55-g7522 From 8d043004838daff5e75aa6705380e02dd17544d0 Mon Sep 17 00:00:00 2001 From: Enric Balletbo i Serra Date: Thu, 4 May 2017 22:38:31 +0200 Subject: tsl2x7x: remove paragraph about writing to the FSF's mailing address Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL. Signed-off-by: Enric Balletbo i Serra Signed-off-by: Jonathan Cameron --- drivers/staging/iio/light/tsl2x7x.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c index 8121a5188638..a912e9ec87f2 100644 --- a/drivers/staging/iio/light/tsl2x7x.c +++ b/drivers/staging/iio/light/tsl2x7x.c @@ -13,10 +13,6 @@ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include -- cgit v1.2.3-55-g7522 From 4ae2f37a2f35f72f52e1b51a38558ff28a09ef30 Mon Sep 17 00:00:00 2001 From: Harinath Nampally Date: Tue, 9 May 2017 19:41:53 -0400 Subject: staging: iio: meter: Fix the identations for proper alignments. This patch fixes below checkpatch.pl kind of warnings: CHECK: Alignment should match open parenthesis Signed-off-by: Harinath Nampally Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7753.c | 55 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c index c0f258c53d3f..ce26abdeab92 100644 --- a/drivers/staging/iio/meter/ade7753.c +++ b/drivers/staging/iio/meter/ade7753.c @@ -107,9 +107,8 @@ static int ade7753_spi_write_reg_8(struct device *dev, return ret; } -static int ade7753_spi_write_reg_16(struct device *dev, - u8 reg_address, - u16 value) +static int ade7753_spi_write_reg_16(struct device *dev, u8 reg_address, + u16 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -126,8 +125,8 @@ static int ade7753_spi_write_reg_16(struct device *dev, } static int ade7753_spi_read_reg_8(struct device *dev, - u8 reg_address, - u8 *val) + u8 reg_address, + u8 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7753_state *st = iio_priv(indio_dev); @@ -136,7 +135,7 @@ static int ade7753_spi_read_reg_8(struct device *dev, ret = spi_w8r8(st->us, ADE7753_READ_REG(reg_address)); if (ret < 0) { dev_err(&st->us->dev, "problem when reading 8 bit register 0x%02X", - reg_address); + reg_address); return ret; } *val = ret; @@ -145,8 +144,8 @@ static int ade7753_spi_read_reg_8(struct device *dev, } static int ade7753_spi_read_reg_16(struct device *dev, - u8 reg_address, - u16 *val) + u8 reg_address, + u16 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7753_state *st = iio_priv(indio_dev); @@ -165,8 +164,8 @@ static int ade7753_spi_read_reg_16(struct device *dev, } static int ade7753_spi_read_reg_24(struct device *dev, - u8 reg_address, - u32 *val) + u8 reg_address, + u32 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7753_state *st = iio_priv(indio_dev); @@ -189,7 +188,7 @@ static int ade7753_spi_read_reg_24(struct device *dev, ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); if (ret) { dev_err(&st->us->dev, "problem when reading 24 bit register 0x%02X", - reg_address); + reg_address); goto error_ret; } *val = (st->rx[0] << 16) | (st->rx[1] << 8) | st->rx[2]; @@ -200,8 +199,8 @@ error_ret: } static ssize_t ade7753_read_8bit(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { int ret; u8 val; @@ -215,8 +214,8 @@ static ssize_t ade7753_read_8bit(struct device *dev, } static ssize_t ade7753_read_16bit(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { int ret; u16 val; @@ -230,8 +229,8 @@ static ssize_t ade7753_read_16bit(struct device *dev, } static ssize_t ade7753_read_24bit(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { int ret; u32 val; @@ -245,9 +244,9 @@ static ssize_t ade7753_read_24bit(struct device *dev, } static ssize_t ade7753_write_8bit(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); int ret; @@ -263,9 +262,9 @@ error_ret: } static ssize_t ade7753_write_16bit(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); int ret; @@ -450,8 +449,8 @@ err_ret: } static ssize_t ade7753_read_frequency(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { int ret; u16 t; @@ -468,9 +467,9 @@ static ssize_t ade7753_read_frequency(struct device *dev, } static ssize_t ade7753_write_frequency(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7753_state *st = iio_priv(indio_dev); -- cgit v1.2.3-55-g7522 From c8f1786531253fe014ff6315d243f2d8cb980cba Mon Sep 17 00:00:00 2001 From: Timothée Isnard Date: Wed, 3 May 2017 22:03:13 +0200 Subject: staging: ccree: Strip trailing whitespace Fix the 994 trailing whitespace checkpatch errors out of 1571 checkpatch issues in the ccree driver Signed-off-by: Timothée Isnard Acked-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_bitops.h | 6 +- drivers/staging/ccree/cc_crypto_ctx.h | 8 +- drivers/staging/ccree/cc_hal.h | 6 +- drivers/staging/ccree/cc_hw_queue_defs.h | 116 +++++------ drivers/staging/ccree/cc_lli_defs.h | 6 +- drivers/staging/ccree/cc_pal_log.h | 12 +- drivers/staging/ccree/cc_pal_log_plat.h | 6 +- drivers/staging/ccree/cc_pal_types.h | 42 ++-- drivers/staging/ccree/cc_pal_types_plat.h | 8 +- drivers/staging/ccree/cc_regs.h | 10 +- drivers/staging/ccree/dx_crys_kernel.h | 46 ++--- drivers/staging/ccree/dx_env.h | 126 ++++++------ drivers/staging/ccree/dx_host.h | 38 ++-- drivers/staging/ccree/dx_reg_base_host.h | 6 +- drivers/staging/ccree/dx_reg_common.h | 8 +- drivers/staging/ccree/hash_defs.h | 10 +- drivers/staging/ccree/hw_queue_defs_plat.h | 6 +- drivers/staging/ccree/ssi_aead.c | 256 ++++++++++++------------ drivers/staging/ccree/ssi_aead.h | 18 +- drivers/staging/ccree/ssi_buffer_mgr.c | 212 ++++++++++---------- drivers/staging/ccree/ssi_buffer_mgr.h | 10 +- drivers/staging/ccree/ssi_cipher.c | 110 +++++------ drivers/staging/ccree/ssi_cipher.h | 8 +- drivers/staging/ccree/ssi_config.h | 8 +- drivers/staging/ccree/ssi_driver.c | 24 +-- drivers/staging/ccree/ssi_driver.h | 10 +- drivers/staging/ccree/ssi_fips.c | 14 +- drivers/staging/ccree/ssi_fips.h | 8 +- drivers/staging/ccree/ssi_fips_data.h | 36 ++-- drivers/staging/ccree/ssi_fips_ext.c | 32 +-- drivers/staging/ccree/ssi_fips_ll.c | 86 ++++---- drivers/staging/ccree/ssi_fips_local.c | 26 +-- drivers/staging/ccree/ssi_fips_local.h | 6 +- drivers/staging/ccree/ssi_hash.c | 302 ++++++++++++++--------------- drivers/staging/ccree/ssi_hash.h | 22 +-- drivers/staging/ccree/ssi_ivgen.c | 48 ++--- drivers/staging/ccree/ssi_ivgen.h | 38 ++-- drivers/staging/ccree/ssi_pm.c | 8 +- drivers/staging/ccree/ssi_pm.h | 6 +- drivers/staging/ccree/ssi_pm_ext.c | 16 +- drivers/staging/ccree/ssi_pm_ext.h | 6 +- drivers/staging/ccree/ssi_request_mgr.c | 100 +++++----- drivers/staging/ccree/ssi_request_mgr.h | 14 +- drivers/staging/ccree/ssi_sram_mgr.c | 30 +-- drivers/staging/ccree/ssi_sram_mgr.h | 38 ++-- drivers/staging/ccree/ssi_sysfs.c | 28 +-- drivers/staging/ccree/ssi_sysfs.h | 6 +- 47 files changed, 993 insertions(+), 993 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_bitops.h b/drivers/staging/ccree/cc_bitops.h index 3a39565ef73b..ad3aeedb65e8 100644 --- a/drivers/staging/ccree/cc_bitops.h +++ b/drivers/staging/ccree/cc_bitops.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 9e10b2670313..f8ebd7605179 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -163,7 +163,7 @@ enum drv_hash_mode { DRV_HASH_SHA512 = 3, DRV_HASH_SHA384 = 4, DRV_HASH_MD5 = 5, - DRV_HASH_CBC_MAC = 6, + DRV_HASH_CBC_MAC = 6, DRV_HASH_XCBC_MAC = 7, DRV_HASH_CMAC = 8, DRV_HASH_MODE_NUM = 9, diff --git a/drivers/staging/ccree/cc_hal.h b/drivers/staging/ccree/cc_hal.h index 75a0ce3e80d6..dd1c66d4878b 100644 --- a/drivers/staging/ccree/cc_hal.h +++ b/drivers/staging/ccree/cc_hal.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index fbaf1b6fcd90..8dca344c15a3 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -124,12 +124,12 @@ typedef enum SetupOp { SETUP_LOAD_STATE2 = 3, SETUP_LOAD_KEY0 = 4, SETUP_LOAD_XEX_KEY = 5, - SETUP_WRITE_STATE0 = 8, + SETUP_WRITE_STATE0 = 8, SETUP_WRITE_STATE1 = 9, SETUP_WRITE_STATE2 = 10, SETUP_WRITE_STATE3 = 11, setupOp_OPTIONTS, - setupOp_END = INT32_MAX, + setupOp_END = INT32_MAX, }SetupOp_t; enum AesMacSelector { @@ -196,7 +196,7 @@ void descriptor_log(HwDesc_s *desc); #if defined(HW_DESCRIPTOR_LOG) || defined(HW_DESC_DUMP_HOST_BUF) #define LOG_HW_DESC(pDesc) descriptor_log(pDesc) #else -#define LOG_HW_DESC(pDesc) +#define LOG_HW_DESC(pDesc) #endif #if (CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_TRACE) || defined(OEMFW_LOG) @@ -204,8 +204,8 @@ void descriptor_log(HwDesc_s *desc); #ifdef UART_PRINTF #define CREATE_DETAILED_DUMP(pDesc) createDetailedDump(pDesc) #else -#define CREATE_DETAILED_DUMP(pDesc) -#endif +#define CREATE_DETAILED_DUMP(pDesc) +#endif #define HW_DESC_DUMP(pDesc) do { \ CC_PAL_LOG_TRACE("\n---------------------------------------------------\n"); \ @@ -226,7 +226,7 @@ void descriptor_log(HwDesc_s *desc); /*! * This macro indicates the end of current HW descriptors flow and release the HW engines. - * + * * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_QUEUE_LAST_IND(pDesc) \ @@ -236,8 +236,8 @@ void descriptor_log(HwDesc_s *desc); /*! * This macro signs the end of HW descriptors flow by asking for completion ack, and release the HW engines - * - * \param pDesc pointer HW descriptor struct + * + * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_ACK_LAST(pDesc) \ do { \ @@ -250,11 +250,11 @@ void descriptor_log(HwDesc_s *desc); /*! * This macro sets the DIN field of a HW descriptors - * - * \param pDesc pointer HW descriptor struct + * + * \param pDesc pointer HW descriptor struct * \param dmaMode The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT * \param dinAdr DIN address - * \param dinSize Data size in bytes + * \param dinSize Data size in bytes * \param axiNs AXI secure bit */ #define HW_DESC_SET_DIN_TYPE(pDesc, dmaMode, dinAdr, dinSize, axiNs) \ @@ -268,12 +268,12 @@ void descriptor_log(HwDesc_s *desc); /*! - * This macro sets the DIN field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and - * other special modes - * + * This macro sets the DIN field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and + * other special modes + * * \param pDesc pointer HW descriptor struct * \param dinAdr DIN address - * \param dinSize Data size in bytes + * \param dinSize Data size in bytes */ #define HW_DESC_SET_DIN_NO_DMA(pDesc, dinAdr, dinSize) \ do { \ @@ -282,13 +282,13 @@ void descriptor_log(HwDesc_s *desc); } while (0) /*! - * This macro sets the DIN field of a HW descriptors to SRAM mode. - * Note: No need to check SRAM alignment since host requests do not use SRAM and - * adaptor will enforce alignment check. - * + * This macro sets the DIN field of a HW descriptors to SRAM mode. + * Note: No need to check SRAM alignment since host requests do not use SRAM and + * adaptor will enforce alignment check. + * * \param pDesc pointer HW descriptor struct * \param dinAdr DIN address - * \param dinSize Data size in bytes + * \param dinSize Data size in bytes */ #define HW_DESC_SET_DIN_SRAM(pDesc, dinAdr, dinSize) \ do { \ @@ -297,11 +297,11 @@ void descriptor_log(HwDesc_s *desc); CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ } while (0) -/*! This macro sets the DIN field of a HW descriptors to CONST mode - * +/*! This macro sets the DIN field of a HW descriptors to CONST mode + * * \param pDesc pointer HW descriptor struct * \param val DIN const value - * \param dinSize Data size in bytes + * \param dinSize Data size in bytes */ #define HW_DESC_SET_DIN_CONST(pDesc, val, dinSize) \ do { \ @@ -313,7 +313,7 @@ void descriptor_log(HwDesc_s *desc); /*! * This macro sets the DIN not last input data indicator - * + * * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_DIN_NOT_LAST_INDICATION(pDesc) \ @@ -322,12 +322,12 @@ void descriptor_log(HwDesc_s *desc); } while (0) /*! - * This macro sets the DOUT field of a HW descriptors - * - * \param pDesc pointer HW descriptor struct + * This macro sets the DOUT field of a HW descriptors + * + * \param pDesc pointer HW descriptor struct * \param dmaMode The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT * \param doutAdr DOUT address - * \param doutSize Data size in bytes + * \param doutSize Data size in bytes * \param axiNs AXI secure bit */ #define HW_DESC_SET_DOUT_TYPE(pDesc, dmaMode, doutAdr, doutSize, axiNs) \ @@ -340,14 +340,14 @@ void descriptor_log(HwDesc_s *desc); } while (0) /*! - * This macro sets the DOUT field of a HW descriptors to DLLI type - * The LAST INDICATION is provided by the user - * - * \param pDesc pointer HW descriptor struct + * This macro sets the DOUT field of a HW descriptors to DLLI type + * The LAST INDICATION is provided by the user + * + * \param pDesc pointer HW descriptor struct * \param doutAdr DOUT address - * \param doutSize Data size in bytes + * \param doutSize Data size in bytes * \param lastInd The last indication bit - * \param axiNs AXI secure bit + * \param axiNs AXI secure bit */ #define HW_DESC_SET_DOUT_DLLI(pDesc, doutAdr, doutSize, axiNs ,lastInd) \ do { \ @@ -360,14 +360,14 @@ void descriptor_log(HwDesc_s *desc); } while (0) /*! - * This macro sets the DOUT field of a HW descriptors to DLLI type - * The LAST INDICATION is provided by the user - * - * \param pDesc pointer HW descriptor struct + * This macro sets the DOUT field of a HW descriptors to DLLI type + * The LAST INDICATION is provided by the user + * + * \param pDesc pointer HW descriptor struct * \param doutAdr DOUT address - * \param doutSize Data size in bytes + * \param doutSize Data size in bytes * \param lastInd The last indication bit - * \param axiNs AXI secure bit + * \param axiNs AXI secure bit */ #define HW_DESC_SET_DOUT_MLLI(pDesc, doutAdr, doutSize, axiNs ,lastInd) \ do { \ @@ -380,12 +380,12 @@ void descriptor_log(HwDesc_s *desc); } while (0) /*! - * This macro sets the DOUT field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and - * other special modes - * + * This macro sets the DOUT field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and + * other special modes + * * \param pDesc pointer HW descriptor struct * \param doutAdr DOUT address - * \param doutSize Data size in bytes + * \param doutSize Data size in bytes * \param registerWriteEnable Enables a write operation to a register */ #define HW_DESC_SET_DOUT_NO_DMA(pDesc, doutAdr, doutSize, registerWriteEnable) \ @@ -396,8 +396,8 @@ void descriptor_log(HwDesc_s *desc); } while (0) /*! - * This macro sets the word for the XOR operation. - * + * This macro sets the word for the XOR operation. + * * \param pDesc pointer HW descriptor struct * \param xorVal xor data value */ @@ -408,7 +408,7 @@ void descriptor_log(HwDesc_s *desc); /*! * This macro sets the XOR indicator bit in the descriptor - * + * * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_XOR_ACTIVE(pDesc) \ @@ -418,7 +418,7 @@ void descriptor_log(HwDesc_s *desc); /*! * This macro selects the AES engine instead of HASH engine when setting up combined mode with AES XCBC MAC - * + * * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_AES_NOT_HASH_MODE(pDesc) \ @@ -428,12 +428,12 @@ void descriptor_log(HwDesc_s *desc); /*! * This macro sets the DOUT field of a HW descriptors to SRAM mode - * Note: No need to check SRAM alignment since host requests do not use SRAM and - * adaptor will enforce alignment check. - * + * Note: No need to check SRAM alignment since host requests do not use SRAM and + * adaptor will enforce alignment check. + * * \param pDesc pointer HW descriptor struct * \param doutAdr DOUT address - * \param doutSize Data size in bytes + * \param doutSize Data size in bytes */ #define HW_DESC_SET_DOUT_SRAM(pDesc, doutAdr, doutSize) \ do { \ @@ -445,7 +445,7 @@ void descriptor_log(HwDesc_s *desc); /*! * This macro sets the data unit size for XEX mode in data_out_addr[15:0] - * + * * \param pDesc pointer HW descriptor struct * \param dataUnitSize data unit size for XEX mode */ @@ -588,9 +588,9 @@ void descriptor_log(HwDesc_s *desc); } while (0) /*! - * This macro sets the DIN field of a HW descriptors to star/stop monitor descriptor. + * This macro sets the DIN field of a HW descriptors to star/stop monitor descriptor. * Used for performance measurements and debug purposes. - * + * * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_DIN_MONITOR_CNTR(pDesc) \ diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index 697f1ed181e0..c4cdd83af58e 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/cc_pal_log.h b/drivers/staging/ccree/cc_pal_log.h index e5f5a8737833..21abd2d26b90 100644 --- a/drivers/staging/ccree/cc_pal_log.h +++ b/drivers/staging/ccree/cc_pal_log.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -21,8 +21,8 @@ #include "cc_pal_log_plat.h" /*! -@file -@brief This file contains the PAL layer log definitions, by default the log is disabled. +@file +@brief This file contains the PAL layer log definitions, by default the log is disabled. @defgroup cc_pal_log CryptoCell PAL logging APIs and definitions @{ @ingroup cc_pal @@ -181,7 +181,7 @@ static inline void CC_PalLogMaskSet(uint32_t setMask) {CC_UNUSED_PARAM(setMask); /*! Log debug data.*/ #define CC_PAL_LOG_DATA( ...) do {} while (0) #endif -/** +/** @} */ diff --git a/drivers/staging/ccree/cc_pal_log_plat.h b/drivers/staging/ccree/cc_pal_log_plat.h index a05a200cf6eb..bc47a50e1917 100644 --- a/drivers/staging/ccree/cc_pal_log_plat.h +++ b/drivers/staging/ccree/cc_pal_log_plat.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/cc_pal_types.h b/drivers/staging/ccree/cc_pal_types.h index 9b59bbb34515..bf8a5e122992 100644 --- a/drivers/staging/ccree/cc_pal_types.h +++ b/drivers/staging/ccree/cc_pal_types.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -17,15 +17,15 @@ #ifndef CC_PAL_TYPES_H #define CC_PAL_TYPES_H -/*! -@file -@brief This file contains platform-dependent definitions and types. +/*! +@file +@brief This file contains platform-dependent definitions and types. @defgroup cc_pal_types CryptoCell PAL platform dependant types @{ @ingroup cc_pal */ - + #include "cc_pal_types_plat.h" /*! Boolean definition.*/ @@ -69,29 +69,29 @@ typedef enum { #define CC_MIN( a , b ) ( ( (a) < (b) ) ? (a) : (b) ) #endif -#ifdef max -/*! Definition for maximum. */ +#ifdef max +/*! Definition for maximum. */ #define CC_MAX(a,b) max( a , b ) #else -/*! Definition for maximum. */ +/*! Definition for maximum. */ #define CC_MAX( a , b ) ( ( (a) > (b) ) ? (a) : (b) ) #endif -/*! Macro that calculates number of full bytes from bits (i.e. 7 bits are 1 byte). */ -#define CALC_FULL_BYTES(numBits) ((numBits)/CC_BITS_IN_BYTE + (((numBits) & (CC_BITS_IN_BYTE-1)) > 0)) -/*! Macro that calculates number of full 32bits words from bits (i.e. 31 bits are 1 word). */ -#define CALC_FULL_32BIT_WORDS(numBits) ((numBits)/CC_BITS_IN_32BIT_WORD + (((numBits) & (CC_BITS_IN_32BIT_WORD-1)) > 0)) -/*! Macro that calculates number of full 32bits words from bytes (i.e. 3 bytes are 1 word). */ -#define CALC_32BIT_WORDS_FROM_BYTES(sizeBytes) ((sizeBytes)/CC_32BIT_WORD_SIZE + (((sizeBytes) & (CC_32BIT_WORD_SIZE-1)) > 0)) -/*! Macro that round up bits to 32bits words. */ +/*! Macro that calculates number of full bytes from bits (i.e. 7 bits are 1 byte). */ +#define CALC_FULL_BYTES(numBits) ((numBits)/CC_BITS_IN_BYTE + (((numBits) & (CC_BITS_IN_BYTE-1)) > 0)) +/*! Macro that calculates number of full 32bits words from bits (i.e. 31 bits are 1 word). */ +#define CALC_FULL_32BIT_WORDS(numBits) ((numBits)/CC_BITS_IN_32BIT_WORD + (((numBits) & (CC_BITS_IN_32BIT_WORD-1)) > 0)) +/*! Macro that calculates number of full 32bits words from bytes (i.e. 3 bytes are 1 word). */ +#define CALC_32BIT_WORDS_FROM_BYTES(sizeBytes) ((sizeBytes)/CC_32BIT_WORD_SIZE + (((sizeBytes) & (CC_32BIT_WORD_SIZE-1)) > 0)) +/*! Macro that round up bits to 32bits words. */ #define ROUNDUP_BITS_TO_32BIT_WORD(numBits) (CALC_FULL_32BIT_WORDS(numBits) * CC_BITS_IN_32BIT_WORD) -/*! Macro that round up bits to bytes. */ +/*! Macro that round up bits to bytes. */ #define ROUNDUP_BITS_TO_BYTES(numBits) (CALC_FULL_BYTES(numBits) * CC_BITS_IN_BYTE) -/*! Macro that round up bytes to 32bits words. */ -#define ROUNDUP_BYTES_TO_32BIT_WORD(sizeBytes) (CALC_32BIT_WORDS_FROM_BYTES(sizeBytes) * CC_32BIT_WORD_SIZE) +/*! Macro that round up bytes to 32bits words. */ +#define ROUNDUP_BYTES_TO_32BIT_WORD(sizeBytes) (CALC_32BIT_WORDS_FROM_BYTES(sizeBytes) * CC_32BIT_WORD_SIZE) -/** +/** @} */ #endif diff --git a/drivers/staging/ccree/cc_pal_types_plat.h b/drivers/staging/ccree/cc_pal_types_plat.h index 6e4211262231..b682ff0e40e6 100644 --- a/drivers/staging/ccree/cc_pal_types_plat.h +++ b/drivers/staging/ccree/cc_pal_types_plat.h @@ -1,20 +1,20 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ - + #ifndef SSI_PAL_TYPES_PLAT_H #define SSI_PAL_TYPES_PLAT_H /* Linux kernel types */ diff --git a/drivers/staging/ccree/cc_regs.h b/drivers/staging/ccree/cc_regs.h index 963f8148cd28..a2d42a368335 100644 --- a/drivers/staging/ccree/cc_regs.h +++ b/drivers/staging/ccree/cc_regs.h @@ -1,22 +1,22 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ /*! - * @file + * @file * @brief This file contains macro definitions for accessing ARM TrustZone CryptoCell register space. */ @@ -66,7 +66,7 @@ do { \ BITFIELD_GET(reg_val, CC_ ## reg_name ## _ ## fld_name ## _BIT_SHIFT, \ CC_ ## reg_name ## _ ## fld_name ## _BIT_SIZE)) -/* yael TBD !!! - * +/* yael TBD !!! - * * all HW includes should start with CC_ and not DX_ !! */ diff --git a/drivers/staging/ccree/dx_crys_kernel.h b/drivers/staging/ccree/dx_crys_kernel.h index 703469c4a828..a776e24af55d 100644 --- a/drivers/staging/ccree/dx_crys_kernel.h +++ b/drivers/staging/ccree/dx_crys_kernel.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -20,31 +20,31 @@ // -------------------------------------- // BLOCK: DSCRPTR // -------------------------------------- -#define DX_DSCRPTR_COMPLETION_COUNTER_REG_OFFSET 0xE00UL +#define DX_DSCRPTR_COMPLETION_COUNTER_REG_OFFSET 0xE00UL #define DX_DSCRPTR_COMPLETION_COUNTER_COMPLETION_COUNTER_BIT_SHIFT 0x0UL #define DX_DSCRPTR_COMPLETION_COUNTER_COMPLETION_COUNTER_BIT_SIZE 0x6UL #define DX_DSCRPTR_COMPLETION_COUNTER_OVERFLOW_COUNTER_BIT_SHIFT 0x6UL #define DX_DSCRPTR_COMPLETION_COUNTER_OVERFLOW_COUNTER_BIT_SIZE 0x1UL -#define DX_DSCRPTR_SW_RESET_REG_OFFSET 0xE40UL +#define DX_DSCRPTR_SW_RESET_REG_OFFSET 0xE40UL #define DX_DSCRPTR_SW_RESET_VALUE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_SW_RESET_VALUE_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_SRAM_SIZE_REG_OFFSET 0xE60UL +#define DX_DSCRPTR_QUEUE_SRAM_SIZE_REG_OFFSET 0xE60UL #define DX_DSCRPTR_QUEUE_SRAM_SIZE_NUM_OF_DSCRPTR_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_SRAM_SIZE_NUM_OF_DSCRPTR_BIT_SIZE 0xAUL #define DX_DSCRPTR_QUEUE_SRAM_SIZE_DSCRPTR_SRAM_SIZE_BIT_SHIFT 0xAUL #define DX_DSCRPTR_QUEUE_SRAM_SIZE_DSCRPTR_SRAM_SIZE_BIT_SIZE 0xCUL #define DX_DSCRPTR_QUEUE_SRAM_SIZE_SRAM_SIZE_BIT_SHIFT 0x16UL #define DX_DSCRPTR_QUEUE_SRAM_SIZE_SRAM_SIZE_BIT_SIZE 0x3UL -#define DX_DSCRPTR_SINGLE_ADDR_EN_REG_OFFSET 0xE64UL +#define DX_DSCRPTR_SINGLE_ADDR_EN_REG_OFFSET 0xE64UL #define DX_DSCRPTR_SINGLE_ADDR_EN_VALUE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_SINGLE_ADDR_EN_VALUE_BIT_SIZE 0x1UL -#define DX_DSCRPTR_MEASURE_CNTR_REG_OFFSET 0xE68UL +#define DX_DSCRPTR_MEASURE_CNTR_REG_OFFSET 0xE68UL #define DX_DSCRPTR_MEASURE_CNTR_VALUE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_MEASURE_CNTR_VALUE_BIT_SIZE 0x20UL -#define DX_DSCRPTR_QUEUE_WORD0_REG_OFFSET 0xE80UL +#define DX_DSCRPTR_QUEUE_WORD0_REG_OFFSET 0xE80UL #define DX_DSCRPTR_QUEUE_WORD0_VALUE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_WORD0_VALUE_BIT_SIZE 0x20UL -#define DX_DSCRPTR_QUEUE_WORD1_REG_OFFSET 0xE84UL +#define DX_DSCRPTR_QUEUE_WORD1_REG_OFFSET 0xE84UL #define DX_DSCRPTR_QUEUE_WORD1_DIN_DMA_MODE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_WORD1_DIN_DMA_MODE_BIT_SIZE 0x2UL #define DX_DSCRPTR_QUEUE_WORD1_DIN_SIZE_BIT_SHIFT 0x2UL @@ -59,10 +59,10 @@ #define DX_DSCRPTR_QUEUE_WORD1_LOCK_QUEUE_BIT_SIZE 0x1UL #define DX_DSCRPTR_QUEUE_WORD1_NOT_USED_BIT_SHIFT 0x1EUL #define DX_DSCRPTR_QUEUE_WORD1_NOT_USED_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD2_REG_OFFSET 0xE88UL +#define DX_DSCRPTR_QUEUE_WORD2_REG_OFFSET 0xE88UL #define DX_DSCRPTR_QUEUE_WORD2_VALUE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_WORD2_VALUE_BIT_SIZE 0x20UL -#define DX_DSCRPTR_QUEUE_WORD3_REG_OFFSET 0xE8CUL +#define DX_DSCRPTR_QUEUE_WORD3_REG_OFFSET 0xE8CUL #define DX_DSCRPTR_QUEUE_WORD3_DOUT_DMA_MODE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_WORD3_DOUT_DMA_MODE_BIT_SIZE 0x2UL #define DX_DSCRPTR_QUEUE_WORD3_DOUT_SIZE_BIT_SHIFT 0x2UL @@ -77,7 +77,7 @@ #define DX_DSCRPTR_QUEUE_WORD3_NOT_USED_BIT_SIZE 0x1UL #define DX_DSCRPTR_QUEUE_WORD3_QUEUE_LAST_IND_BIT_SHIFT 0x1FUL #define DX_DSCRPTR_QUEUE_WORD3_QUEUE_LAST_IND_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_REG_OFFSET 0xE90UL +#define DX_DSCRPTR_QUEUE_WORD4_REG_OFFSET 0xE90UL #define DX_DSCRPTR_QUEUE_WORD4_DATA_FLOW_MODE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_WORD4_DATA_FLOW_MODE_BIT_SIZE 0x6UL #define DX_DSCRPTR_QUEUE_WORD4_AES_SEL_N_HASH_BIT_SHIFT 0x6UL @@ -110,30 +110,30 @@ #define DX_DSCRPTR_QUEUE_WORD4_WORD_SWAP_BIT_SIZE 0x1UL #define DX_DSCRPTR_QUEUE_WORD4_BYTES_SWAP_BIT_SHIFT 0x1FUL #define DX_DSCRPTR_QUEUE_WORD4_BYTES_SWAP_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD5_REG_OFFSET 0xE94UL +#define DX_DSCRPTR_QUEUE_WORD5_REG_OFFSET 0xE94UL #define DX_DSCRPTR_QUEUE_WORD5_DIN_ADDR_HIGH_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_WORD5_DIN_ADDR_HIGH_BIT_SIZE 0x10UL #define DX_DSCRPTR_QUEUE_WORD5_DOUT_ADDR_HIGH_BIT_SHIFT 0x10UL #define DX_DSCRPTR_QUEUE_WORD5_DOUT_ADDR_HIGH_BIT_SIZE 0x10UL -#define DX_DSCRPTR_QUEUE_WATERMARK_REG_OFFSET 0xE98UL +#define DX_DSCRPTR_QUEUE_WATERMARK_REG_OFFSET 0xE98UL #define DX_DSCRPTR_QUEUE_WATERMARK_VALUE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_WATERMARK_VALUE_BIT_SIZE 0xAUL -#define DX_DSCRPTR_QUEUE_CONTENT_REG_OFFSET 0xE9CUL +#define DX_DSCRPTR_QUEUE_CONTENT_REG_OFFSET 0xE9CUL #define DX_DSCRPTR_QUEUE_CONTENT_VALUE_BIT_SHIFT 0x0UL #define DX_DSCRPTR_QUEUE_CONTENT_VALUE_BIT_SIZE 0xAUL // -------------------------------------- // BLOCK: AXI_P // -------------------------------------- -#define DX_AXIM_MON_INFLIGHT_REG_OFFSET 0xB00UL +#define DX_AXIM_MON_INFLIGHT_REG_OFFSET 0xB00UL #define DX_AXIM_MON_INFLIGHT_VALUE_BIT_SHIFT 0x0UL #define DX_AXIM_MON_INFLIGHT_VALUE_BIT_SIZE 0x8UL -#define DX_AXIM_MON_INFLIGHTLAST_REG_OFFSET 0xB40UL +#define DX_AXIM_MON_INFLIGHTLAST_REG_OFFSET 0xB40UL #define DX_AXIM_MON_INFLIGHTLAST_VALUE_BIT_SHIFT 0x0UL #define DX_AXIM_MON_INFLIGHTLAST_VALUE_BIT_SIZE 0x8UL -#define DX_AXIM_MON_COMP_REG_OFFSET 0xB80UL +#define DX_AXIM_MON_COMP_REG_OFFSET 0xB80UL #define DX_AXIM_MON_COMP_VALUE_BIT_SHIFT 0x0UL #define DX_AXIM_MON_COMP_VALUE_BIT_SIZE 0x10UL -#define DX_AXIM_MON_ERR_REG_OFFSET 0xBC4UL +#define DX_AXIM_MON_ERR_REG_OFFSET 0xBC4UL #define DX_AXIM_MON_ERR_BRESP_BIT_SHIFT 0x0UL #define DX_AXIM_MON_ERR_BRESP_BIT_SIZE 0x2UL #define DX_AXIM_MON_ERR_BID_BIT_SHIFT 0x2UL @@ -142,7 +142,7 @@ #define DX_AXIM_MON_ERR_RRESP_BIT_SIZE 0x2UL #define DX_AXIM_MON_ERR_RID_BIT_SHIFT 0x12UL #define DX_AXIM_MON_ERR_RID_BIT_SIZE 0x4UL -#define DX_AXIM_CFG_REG_OFFSET 0xBE8UL +#define DX_AXIM_CFG_REG_OFFSET 0xBE8UL #define DX_AXIM_CFG_BRESPMASK_BIT_SHIFT 0x4UL #define DX_AXIM_CFG_BRESPMASK_BIT_SIZE 0x1UL #define DX_AXIM_CFG_RRESPMASK_BIT_SHIFT 0x5UL @@ -151,7 +151,7 @@ #define DX_AXIM_CFG_INFLTMASK_BIT_SIZE 0x1UL #define DX_AXIM_CFG_COMPMASK_BIT_SHIFT 0x7UL #define DX_AXIM_CFG_COMPMASK_BIT_SIZE 0x1UL -#define DX_AXIM_ACE_CONST_REG_OFFSET 0xBECUL +#define DX_AXIM_ACE_CONST_REG_OFFSET 0xBECUL #define DX_AXIM_ACE_CONST_ARDOMAIN_BIT_SHIFT 0x0UL #define DX_AXIM_ACE_CONST_ARDOMAIN_BIT_SIZE 0x2UL #define DX_AXIM_ACE_CONST_AWDOMAIN_BIT_SHIFT 0x2UL @@ -170,7 +170,7 @@ #define DX_AXIM_ACE_CONST_AWADDR_NOT_MASKED_BIT_SIZE 0x7UL #define DX_AXIM_ACE_CONST_AWLEN_VAL_BIT_SHIFT 0x19UL #define DX_AXIM_ACE_CONST_AWLEN_VAL_BIT_SIZE 0x4UL -#define DX_AXIM_CACHE_PARAMS_REG_OFFSET 0xBF0UL +#define DX_AXIM_CACHE_PARAMS_REG_OFFSET 0xBF0UL #define DX_AXIM_CACHE_PARAMS_AWCACHE_LAST_BIT_SHIFT 0x0UL #define DX_AXIM_CACHE_PARAMS_AWCACHE_LAST_BIT_SIZE 0x4UL #define DX_AXIM_CACHE_PARAMS_AWCACHE_BIT_SHIFT 0x4UL diff --git a/drivers/staging/ccree/dx_env.h b/drivers/staging/ccree/dx_env.h index 08040604b6da..d4c0440131e0 100644 --- a/drivers/staging/ccree/dx_env.h +++ b/drivers/staging/ccree/dx_env.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -20,49 +20,49 @@ // -------------------------------------- // BLOCK: FPGA_ENV_REGS // -------------------------------------- -#define DX_ENV_PKA_DEBUG_MODE_REG_OFFSET 0x024UL +#define DX_ENV_PKA_DEBUG_MODE_REG_OFFSET 0x024UL #define DX_ENV_PKA_DEBUG_MODE_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_PKA_DEBUG_MODE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_SCAN_MODE_REG_OFFSET 0x030UL +#define DX_ENV_SCAN_MODE_REG_OFFSET 0x030UL #define DX_ENV_SCAN_MODE_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_SCAN_MODE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_ALLOW_SCAN_REG_OFFSET 0x034UL +#define DX_ENV_CC_ALLOW_SCAN_REG_OFFSET 0x034UL #define DX_ENV_CC_ALLOW_SCAN_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_ALLOW_SCAN_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_HOST_INT_REG_OFFSET 0x0A0UL +#define DX_ENV_CC_HOST_INT_REG_OFFSET 0x0A0UL #define DX_ENV_CC_HOST_INT_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_HOST_INT_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_PUB_HOST_INT_REG_OFFSET 0x0A4UL +#define DX_ENV_CC_PUB_HOST_INT_REG_OFFSET 0x0A4UL #define DX_ENV_CC_PUB_HOST_INT_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_PUB_HOST_INT_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_RST_N_REG_OFFSET 0x0A8UL +#define DX_ENV_CC_RST_N_REG_OFFSET 0x0A8UL #define DX_ENV_CC_RST_N_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_RST_N_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_RST_OVERRIDE_REG_OFFSET 0x0ACUL +#define DX_ENV_RST_OVERRIDE_REG_OFFSET 0x0ACUL #define DX_ENV_RST_OVERRIDE_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_RST_OVERRIDE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_POR_N_ADDR_REG_OFFSET 0x0E0UL +#define DX_ENV_CC_POR_N_ADDR_REG_OFFSET 0x0E0UL #define DX_ENV_CC_POR_N_ADDR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_POR_N_ADDR_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_COLD_RST_REG_OFFSET 0x0FCUL +#define DX_ENV_CC_COLD_RST_REG_OFFSET 0x0FCUL #define DX_ENV_CC_COLD_RST_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_COLD_RST_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_DUMMY_ADDR_REG_OFFSET 0x108UL +#define DX_ENV_DUMMY_ADDR_REG_OFFSET 0x108UL #define DX_ENV_DUMMY_ADDR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_DUMMY_ADDR_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_COUNTER_CLR_REG_OFFSET 0x118UL +#define DX_ENV_COUNTER_CLR_REG_OFFSET 0x118UL #define DX_ENV_COUNTER_CLR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_COUNTER_CLR_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_COUNTER_RD_REG_OFFSET 0x11CUL +#define DX_ENV_COUNTER_RD_REG_OFFSET 0x11CUL #define DX_ENV_COUNTER_RD_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_COUNTER_RD_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_RNG_DEBUG_ENABLE_REG_OFFSET 0x430UL +#define DX_ENV_RNG_DEBUG_ENABLE_REG_OFFSET 0x430UL #define DX_ENV_RNG_DEBUG_ENABLE_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_RNG_DEBUG_ENABLE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_LCS_REG_OFFSET 0x43CUL +#define DX_ENV_CC_LCS_REG_OFFSET 0x43CUL #define DX_ENV_CC_LCS_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_LCS_VALUE_BIT_SIZE 0x8UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_REG_OFFSET 0x440UL +#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_REG_OFFSET 0x440UL #define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_CM_BIT_SHIFT 0x0UL #define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_CM_BIT_SIZE 0x1UL #define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_DM_BIT_SHIFT 0x1UL @@ -71,54 +71,54 @@ #define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_SECURE_BIT_SIZE 0x1UL #define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_RMA_BIT_SHIFT 0x3UL #define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_RMA_BIT_SIZE 0x1UL -#define DX_ENV_DCU_EN_REG_OFFSET 0x444UL +#define DX_ENV_DCU_EN_REG_OFFSET 0x444UL #define DX_ENV_DCU_EN_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_DCU_EN_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_CC_LCS_IS_VALID_REG_OFFSET 0x448UL +#define DX_ENV_CC_LCS_IS_VALID_REG_OFFSET 0x448UL #define DX_ENV_CC_LCS_IS_VALID_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_LCS_IS_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_POWER_DOWN_REG_OFFSET 0x478UL +#define DX_ENV_POWER_DOWN_REG_OFFSET 0x478UL #define DX_ENV_POWER_DOWN_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_POWER_DOWN_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_DCU_H_EN_REG_OFFSET 0x484UL +#define DX_ENV_DCU_H_EN_REG_OFFSET 0x484UL #define DX_ENV_DCU_H_EN_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_DCU_H_EN_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_VERSION_REG_OFFSET 0x488UL +#define DX_ENV_VERSION_REG_OFFSET 0x488UL #define DX_ENV_VERSION_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_VERSION_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_ROSC_WRITE_REG_OFFSET 0x48CUL +#define DX_ENV_ROSC_WRITE_REG_OFFSET 0x48CUL #define DX_ENV_ROSC_WRITE_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_ROSC_WRITE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_ROSC_ADDR_REG_OFFSET 0x490UL +#define DX_ENV_ROSC_ADDR_REG_OFFSET 0x490UL #define DX_ENV_ROSC_ADDR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_ROSC_ADDR_VALUE_BIT_SIZE 0x8UL -#define DX_ENV_RESET_SESSION_KEY_REG_OFFSET 0x494UL +#define DX_ENV_RESET_SESSION_KEY_REG_OFFSET 0x494UL #define DX_ENV_RESET_SESSION_KEY_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_RESET_SESSION_KEY_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_SESSION_KEY_0_REG_OFFSET 0x4A0UL +#define DX_ENV_SESSION_KEY_0_REG_OFFSET 0x4A0UL #define DX_ENV_SESSION_KEY_0_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_SESSION_KEY_0_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_SESSION_KEY_1_REG_OFFSET 0x4A4UL +#define DX_ENV_SESSION_KEY_1_REG_OFFSET 0x4A4UL #define DX_ENV_SESSION_KEY_1_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_SESSION_KEY_1_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_SESSION_KEY_2_REG_OFFSET 0x4A8UL +#define DX_ENV_SESSION_KEY_2_REG_OFFSET 0x4A8UL #define DX_ENV_SESSION_KEY_2_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_SESSION_KEY_2_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_SESSION_KEY_3_REG_OFFSET 0x4ACUL +#define DX_ENV_SESSION_KEY_3_REG_OFFSET 0x4ACUL #define DX_ENV_SESSION_KEY_3_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_SESSION_KEY_3_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_SESSION_KEY_VALID_REG_OFFSET 0x4B0UL +#define DX_ENV_SESSION_KEY_VALID_REG_OFFSET 0x4B0UL #define DX_ENV_SESSION_KEY_VALID_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_SESSION_KEY_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_SPIDEN_REG_OFFSET 0x4D0UL +#define DX_ENV_SPIDEN_REG_OFFSET 0x4D0UL #define DX_ENV_SPIDEN_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_SPIDEN_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_AXIM_USER_PARAMS_REG_OFFSET 0x600UL +#define DX_ENV_AXIM_USER_PARAMS_REG_OFFSET 0x600UL #define DX_ENV_AXIM_USER_PARAMS_ARUSER_BIT_SHIFT 0x0UL #define DX_ENV_AXIM_USER_PARAMS_ARUSER_BIT_SIZE 0x5UL #define DX_ENV_AXIM_USER_PARAMS_AWUSER_BIT_SHIFT 0x5UL #define DX_ENV_AXIM_USER_PARAMS_AWUSER_BIT_SIZE 0x5UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_REG_OFFSET 0x604UL +#define DX_ENV_SECURITY_MODE_OVERRIDE_REG_OFFSET 0x604UL #define DX_ENV_SECURITY_MODE_OVERRIDE_AWPROT_NS_BIT_BIT_SHIFT 0x0UL #define DX_ENV_SECURITY_MODE_OVERRIDE_AWPROT_NS_BIT_BIT_SIZE 0x1UL #define DX_ENV_SECURITY_MODE_OVERRIDE_AWPROT_NS_OVERRIDE_BIT_SHIFT 0x1UL @@ -127,97 +127,97 @@ #define DX_ENV_SECURITY_MODE_OVERRIDE_ARPROT_NS_BIT_BIT_SIZE 0x1UL #define DX_ENV_SECURITY_MODE_OVERRIDE_ARPROT_NS_OVERRIDE_BIT_SHIFT 0x3UL #define DX_ENV_SECURITY_MODE_OVERRIDE_ARPROT_NS_OVERRIDE_BIT_SIZE 0x1UL -#define DX_ENV_AO_CC_KPLT_0_REG_OFFSET 0x620UL +#define DX_ENV_AO_CC_KPLT_0_REG_OFFSET 0x620UL #define DX_ENV_AO_CC_KPLT_0_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_AO_CC_KPLT_0_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KPLT_1_REG_OFFSET 0x624UL +#define DX_ENV_AO_CC_KPLT_1_REG_OFFSET 0x624UL #define DX_ENV_AO_CC_KPLT_1_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_AO_CC_KPLT_1_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KPLT_2_REG_OFFSET 0x628UL +#define DX_ENV_AO_CC_KPLT_2_REG_OFFSET 0x628UL #define DX_ENV_AO_CC_KPLT_2_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_AO_CC_KPLT_2_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KPLT_3_REG_OFFSET 0x62CUL +#define DX_ENV_AO_CC_KPLT_3_REG_OFFSET 0x62CUL #define DX_ENV_AO_CC_KPLT_3_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_AO_CC_KPLT_3_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KCST_0_REG_OFFSET 0x630UL +#define DX_ENV_AO_CC_KCST_0_REG_OFFSET 0x630UL #define DX_ENV_AO_CC_KCST_0_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_AO_CC_KCST_0_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KCST_1_REG_OFFSET 0x634UL +#define DX_ENV_AO_CC_KCST_1_REG_OFFSET 0x634UL #define DX_ENV_AO_CC_KCST_1_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_AO_CC_KCST_1_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KCST_2_REG_OFFSET 0x638UL +#define DX_ENV_AO_CC_KCST_2_REG_OFFSET 0x638UL #define DX_ENV_AO_CC_KCST_2_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_AO_CC_KCST_2_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KCST_3_REG_OFFSET 0x63CUL +#define DX_ENV_AO_CC_KCST_3_REG_OFFSET 0x63CUL #define DX_ENV_AO_CC_KCST_3_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_AO_CC_KCST_3_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APB_FIPS_ADDR_REG_OFFSET 0x650UL +#define DX_ENV_APB_FIPS_ADDR_REG_OFFSET 0x650UL #define DX_ENV_APB_FIPS_ADDR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APB_FIPS_ADDR_VALUE_BIT_SIZE 0xCUL -#define DX_ENV_APB_FIPS_VAL_REG_OFFSET 0x654UL +#define DX_ENV_APB_FIPS_VAL_REG_OFFSET 0x654UL #define DX_ENV_APB_FIPS_VAL_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APB_FIPS_VAL_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APB_FIPS_MASK_REG_OFFSET 0x658UL +#define DX_ENV_APB_FIPS_MASK_REG_OFFSET 0x658UL #define DX_ENV_APB_FIPS_MASK_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APB_FIPS_MASK_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APB_FIPS_CNT_REG_OFFSET 0x65CUL +#define DX_ENV_APB_FIPS_CNT_REG_OFFSET 0x65CUL #define DX_ENV_APB_FIPS_CNT_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APB_FIPS_CNT_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APB_FIPS_NEW_ADDR_REG_OFFSET 0x660UL +#define DX_ENV_APB_FIPS_NEW_ADDR_REG_OFFSET 0x660UL #define DX_ENV_APB_FIPS_NEW_ADDR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APB_FIPS_NEW_ADDR_VALUE_BIT_SIZE 0xCUL -#define DX_ENV_APB_FIPS_NEW_VAL_REG_OFFSET 0x664UL +#define DX_ENV_APB_FIPS_NEW_VAL_REG_OFFSET 0x664UL #define DX_ENV_APB_FIPS_NEW_VAL_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APB_FIPS_NEW_VAL_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APBP_FIPS_ADDR_REG_OFFSET 0x670UL +#define DX_ENV_APBP_FIPS_ADDR_REG_OFFSET 0x670UL #define DX_ENV_APBP_FIPS_ADDR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APBP_FIPS_ADDR_VALUE_BIT_SIZE 0xCUL -#define DX_ENV_APBP_FIPS_VAL_REG_OFFSET 0x674UL +#define DX_ENV_APBP_FIPS_VAL_REG_OFFSET 0x674UL #define DX_ENV_APBP_FIPS_VAL_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APBP_FIPS_VAL_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APBP_FIPS_MASK_REG_OFFSET 0x678UL +#define DX_ENV_APBP_FIPS_MASK_REG_OFFSET 0x678UL #define DX_ENV_APBP_FIPS_MASK_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APBP_FIPS_MASK_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APBP_FIPS_CNT_REG_OFFSET 0x67CUL +#define DX_ENV_APBP_FIPS_CNT_REG_OFFSET 0x67CUL #define DX_ENV_APBP_FIPS_CNT_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APBP_FIPS_CNT_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APBP_FIPS_NEW_ADDR_REG_OFFSET 0x680UL +#define DX_ENV_APBP_FIPS_NEW_ADDR_REG_OFFSET 0x680UL #define DX_ENV_APBP_FIPS_NEW_ADDR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APBP_FIPS_NEW_ADDR_VALUE_BIT_SIZE 0xCUL -#define DX_ENV_APBP_FIPS_NEW_VAL_REG_OFFSET 0x684UL +#define DX_ENV_APBP_FIPS_NEW_VAL_REG_OFFSET 0x684UL #define DX_ENV_APBP_FIPS_NEW_VAL_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_APBP_FIPS_NEW_VAL_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_CC_POWERDOWN_EN_REG_OFFSET 0x690UL +#define DX_ENV_CC_POWERDOWN_EN_REG_OFFSET 0x690UL #define DX_ENV_CC_POWERDOWN_EN_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_POWERDOWN_EN_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_POWERDOWN_RST_EN_REG_OFFSET 0x694UL +#define DX_ENV_CC_POWERDOWN_RST_EN_REG_OFFSET 0x694UL #define DX_ENV_CC_POWERDOWN_RST_EN_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_CC_POWERDOWN_RST_EN_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_POWERDOWN_RST_CNTR_REG_OFFSET 0x698UL +#define DX_ENV_POWERDOWN_RST_CNTR_REG_OFFSET 0x698UL #define DX_ENV_POWERDOWN_RST_CNTR_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_POWERDOWN_RST_CNTR_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_POWERDOWN_EN_DEBUG_REG_OFFSET 0x69CUL +#define DX_ENV_POWERDOWN_EN_DEBUG_REG_OFFSET 0x69CUL #define DX_ENV_POWERDOWN_EN_DEBUG_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_POWERDOWN_EN_DEBUG_VALUE_BIT_SIZE 0x1UL // -------------------------------------- // BLOCK: ENV_CC_MEMORIES // -------------------------------------- -#define DX_ENV_FUSE_READY_REG_OFFSET 0x000UL +#define DX_ENV_FUSE_READY_REG_OFFSET 0x000UL #define DX_ENV_FUSE_READY_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_FUSE_READY_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_PERF_RAM_MASTER_REG_OFFSET 0x0ECUL +#define DX_ENV_PERF_RAM_MASTER_REG_OFFSET 0x0ECUL #define DX_ENV_PERF_RAM_MASTER_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_PERF_RAM_MASTER_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_PERF_RAM_ADDR_HIGH4_REG_OFFSET 0x0F0UL +#define DX_ENV_PERF_RAM_ADDR_HIGH4_REG_OFFSET 0x0F0UL #define DX_ENV_PERF_RAM_ADDR_HIGH4_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_PERF_RAM_ADDR_HIGH4_VALUE_BIT_SIZE 0x2UL -#define DX_ENV_FUSES_RAM_REG_OFFSET 0x3ECUL +#define DX_ENV_FUSES_RAM_REG_OFFSET 0x3ECUL #define DX_ENV_FUSES_RAM_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_FUSES_RAM_VALUE_BIT_SIZE 0x20UL // -------------------------------------- // BLOCK: ENV_PERF_RAM_BASE // -------------------------------------- -#define DX_ENV_PERF_RAM_BASE_REG_OFFSET 0x000UL +#define DX_ENV_PERF_RAM_BASE_REG_OFFSET 0x000UL #define DX_ENV_PERF_RAM_BASE_VALUE_BIT_SHIFT 0x0UL #define DX_ENV_PERF_RAM_BASE_VALUE_BIT_SIZE 0x20UL diff --git a/drivers/staging/ccree/dx_host.h b/drivers/staging/ccree/dx_host.h index 4e42e748dc5f..3e75dc4d2657 100644 --- a/drivers/staging/ccree/dx_host.h +++ b/drivers/staging/ccree/dx_host.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -20,7 +20,7 @@ // -------------------------------------- // BLOCK: HOST_P // -------------------------------------- -#define DX_HOST_IRR_REG_OFFSET 0xA00UL +#define DX_HOST_IRR_REG_OFFSET 0xA00UL #define DX_HOST_IRR_DSCRPTR_COMPLETION_LOW_INT_BIT_SHIFT 0x2UL #define DX_HOST_IRR_DSCRPTR_COMPLETION_LOW_INT_BIT_SIZE 0x1UL #define DX_HOST_IRR_AXI_ERR_INT_BIT_SHIFT 0x8UL @@ -31,7 +31,7 @@ #define DX_HOST_IRR_DSCRPTR_WATERMARK_INT_BIT_SIZE 0x1UL #define DX_HOST_IRR_AXIM_COMP_INT_BIT_SHIFT 0x17UL #define DX_HOST_IRR_AXIM_COMP_INT_BIT_SIZE 0x1UL -#define DX_HOST_IMR_REG_OFFSET 0xA04UL +#define DX_HOST_IMR_REG_OFFSET 0xA04UL #define DX_HOST_IMR_NOT_USED_MASK_BIT_SHIFT 0x1UL #define DX_HOST_IMR_NOT_USED_MASK_BIT_SIZE 0x1UL #define DX_HOST_IMR_DSCRPTR_COMPLETION_MASK_BIT_SHIFT 0x2UL @@ -44,7 +44,7 @@ #define DX_HOST_IMR_DSCRPTR_WATERMARK_MASK0_BIT_SIZE 0x1UL #define DX_HOST_IMR_AXIM_COMP_INT_MASK_BIT_SHIFT 0x17UL #define DX_HOST_IMR_AXIM_COMP_INT_MASK_BIT_SIZE 0x1UL -#define DX_HOST_ICR_REG_OFFSET 0xA08UL +#define DX_HOST_ICR_REG_OFFSET 0xA08UL #define DX_HOST_ICR_DSCRPTR_COMPLETION_BIT_SHIFT 0x2UL #define DX_HOST_ICR_DSCRPTR_COMPLETION_BIT_SIZE 0x1UL #define DX_HOST_ICR_AXI_ERR_CLEAR_BIT_SHIFT 0x8UL @@ -55,10 +55,10 @@ #define DX_HOST_ICR_DSCRPTR_WATERMARK_QUEUE0_CLEAR_BIT_SIZE 0x1UL #define DX_HOST_ICR_AXIM_COMP_INT_CLEAR_BIT_SHIFT 0x17UL #define DX_HOST_ICR_AXIM_COMP_INT_CLEAR_BIT_SIZE 0x1UL -#define DX_HOST_SIGNATURE_REG_OFFSET 0xA24UL +#define DX_HOST_SIGNATURE_REG_OFFSET 0xA24UL #define DX_HOST_SIGNATURE_VALUE_BIT_SHIFT 0x0UL #define DX_HOST_SIGNATURE_VALUE_BIT_SIZE 0x20UL -#define DX_HOST_BOOT_REG_OFFSET 0xA28UL +#define DX_HOST_BOOT_REG_OFFSET 0xA28UL #define DX_HOST_BOOT_SYNTHESIS_CONFIG_BIT_SHIFT 0x0UL #define DX_HOST_BOOT_SYNTHESIS_CONFIG_BIT_SIZE 0x1UL #define DX_HOST_BOOT_LARGE_RKEK_LOCAL_BIT_SHIFT 0x1UL @@ -115,40 +115,40 @@ #define DX_HOST_BOOT_ONLY_ENCRYPT_LOCAL_BIT_SIZE 0x1UL #define DX_HOST_BOOT_AES_EXISTS_LOCAL_BIT_SHIFT 0x1EUL #define DX_HOST_BOOT_AES_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_VERSION_REG_OFFSET 0xA40UL +#define DX_HOST_VERSION_REG_OFFSET 0xA40UL #define DX_HOST_VERSION_VALUE_BIT_SHIFT 0x0UL #define DX_HOST_VERSION_VALUE_BIT_SIZE 0x20UL -#define DX_HOST_KFDE0_VALID_REG_OFFSET 0xA60UL +#define DX_HOST_KFDE0_VALID_REG_OFFSET 0xA60UL #define DX_HOST_KFDE0_VALID_VALUE_BIT_SHIFT 0x0UL #define DX_HOST_KFDE0_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_HOST_KFDE1_VALID_REG_OFFSET 0xA64UL +#define DX_HOST_KFDE1_VALID_REG_OFFSET 0xA64UL #define DX_HOST_KFDE1_VALID_VALUE_BIT_SHIFT 0x0UL #define DX_HOST_KFDE1_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_HOST_KFDE2_VALID_REG_OFFSET 0xA68UL +#define DX_HOST_KFDE2_VALID_REG_OFFSET 0xA68UL #define DX_HOST_KFDE2_VALID_VALUE_BIT_SHIFT 0x0UL #define DX_HOST_KFDE2_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_HOST_KFDE3_VALID_REG_OFFSET 0xA6CUL +#define DX_HOST_KFDE3_VALID_REG_OFFSET 0xA6CUL #define DX_HOST_KFDE3_VALID_VALUE_BIT_SHIFT 0x0UL #define DX_HOST_KFDE3_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_HOST_GPR0_REG_OFFSET 0xA70UL +#define DX_HOST_GPR0_REG_OFFSET 0xA70UL #define DX_HOST_GPR0_VALUE_BIT_SHIFT 0x0UL #define DX_HOST_GPR0_VALUE_BIT_SIZE 0x20UL -#define DX_GPR_HOST_REG_OFFSET 0xA74UL +#define DX_GPR_HOST_REG_OFFSET 0xA74UL #define DX_GPR_HOST_VALUE_BIT_SHIFT 0x0UL #define DX_GPR_HOST_VALUE_BIT_SIZE 0x20UL -#define DX_HOST_POWER_DOWN_EN_REG_OFFSET 0xA78UL +#define DX_HOST_POWER_DOWN_EN_REG_OFFSET 0xA78UL #define DX_HOST_POWER_DOWN_EN_VALUE_BIT_SHIFT 0x0UL #define DX_HOST_POWER_DOWN_EN_VALUE_BIT_SIZE 0x1UL // -------------------------------------- // BLOCK: HOST_SRAM // -------------------------------------- -#define DX_SRAM_DATA_REG_OFFSET 0xF00UL +#define DX_SRAM_DATA_REG_OFFSET 0xF00UL #define DX_SRAM_DATA_VALUE_BIT_SHIFT 0x0UL #define DX_SRAM_DATA_VALUE_BIT_SIZE 0x20UL -#define DX_SRAM_ADDR_REG_OFFSET 0xF04UL +#define DX_SRAM_ADDR_REG_OFFSET 0xF04UL #define DX_SRAM_ADDR_VALUE_BIT_SHIFT 0x0UL #define DX_SRAM_ADDR_VALUE_BIT_SIZE 0xFUL -#define DX_SRAM_DATA_READY_REG_OFFSET 0xF08UL +#define DX_SRAM_DATA_READY_REG_OFFSET 0xF08UL #define DX_SRAM_DATA_READY_VALUE_BIT_SHIFT 0x0UL #define DX_SRAM_DATA_READY_VALUE_BIT_SIZE 0x1UL diff --git a/drivers/staging/ccree/dx_reg_base_host.h b/drivers/staging/ccree/dx_reg_base_host.h index 58dafe05fbeb..ffe45dded17f 100644 --- a/drivers/staging/ccree/dx_reg_base_host.h +++ b/drivers/staging/ccree/dx_reg_base_host.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/dx_reg_common.h b/drivers/staging/ccree/dx_reg_common.h index 4ffed386521c..d5132ffaf6e6 100644 --- a/drivers/staging/ccree/dx_reg_common.h +++ b/drivers/staging/ccree/dx_reg_common.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -19,7 +19,7 @@ #define DX_DEV_SIGNATURE 0xDCC71200UL -#define CC_HW_VERSION 0xef840015UL +#define CC_HW_VERSION 0xef840015UL #define DX_DEV_SHA_MAX 512 diff --git a/drivers/staging/ccree/hash_defs.h b/drivers/staging/ccree/hash_defs.h index 5ab0861fd1bb..a441c81b33b1 100644 --- a/drivers/staging/ccree/hash_defs.h +++ b/drivers/staging/ccree/hash_defs.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -58,8 +58,8 @@ enum HashCipherDoPadding { }; typedef struct SepHashPrivateContext { - /* The current length is placed at the end of the context buffer because the hash - context is used for all HMAC operations as well. HMAC context includes a 64 bytes + /* The current length is placed at the end of the context buffer because the hash + context is used for all HMAC operations as well. HMAC context includes a 64 bytes K0 field. The size of struct drv_ctx_hash reserved field is 88/184 bytes depend if t he SHA512 is supported ( in this case teh context size is 256 bytes). The size of struct drv_ctx_hash reseved field is 20 or 52 depend if the SHA512 is supported. diff --git a/drivers/staging/ccree/hw_queue_defs_plat.h b/drivers/staging/ccree/hw_queue_defs_plat.h index aee02cc7588a..bcca509e2549 100644 --- a/drivers/staging/ccree/hw_queue_defs_plat.h +++ b/drivers/staging/ccree/hw_queue_defs_plat.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 038291773b59..240a3c481db8 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -51,7 +51,7 @@ /* Value of each ICV_CMP byte (of 8) in case of success */ -#define ICV_VERIF_OK 0x01 +#define ICV_VERIF_OK 0x01 struct ssi_aead_handle { ssi_sram_addr_t sram_workspace_addr; @@ -106,13 +106,13 @@ static void ssi_aead_exit(struct crypto_aead *tfm) ctx->enckey_dma_addr = 0; ctx->enckey = NULL; } - + if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { /* XCBC authetication */ if (ctx->auth_state.xcbc.xcbc_keys != NULL) { SSI_RESTORE_DMA_ADDR_TO_48BIT( ctx->auth_state.xcbc.xcbc_keys_dma_addr); dma_free_coherent(dev, CC_AES_128_BIT_KEY_SIZE * 3, - ctx->auth_state.xcbc.xcbc_keys, + ctx->auth_state.xcbc.xcbc_keys, ctx->auth_state.xcbc.xcbc_keys_dma_addr); } SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer xcbc_keys_dma_addr=0x%llX\n", @@ -203,14 +203,14 @@ static int ssi_aead_init(struct crypto_aead *tfm) 2 * MAX_HMAC_DIGEST_SIZE); SSI_LOG_DEBUG("Allocated authkey buffer in context ctx->authkey=@%p\n", ctx->auth_state.hmac.ipad_opad); - + ctx->auth_state.hmac.padded_authkey = dma_alloc_coherent(dev, MAX_HMAC_BLOCK_SIZE, &ctx->auth_state.hmac.padded_authkey_dma_addr, GFP_KERNEL); if (ctx->auth_state.hmac.padded_authkey == NULL) { SSI_LOG_ERR("failed to allocate padded_authkey\n"); goto init_failed; - } + } SSI_UPDATE_DMA_ADDR_TO_48BIT( ctx->auth_state.hmac.padded_authkey_dma_addr, MAX_HMAC_BLOCK_SIZE); @@ -225,7 +225,7 @@ init_failed: ssi_aead_exit(tfm); return -ENOMEM; } - + static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *cc_base) { @@ -313,9 +313,9 @@ static int hmac_setkey(HwDesc_s *desc, struct ssi_aead_ctx *ctx) { unsigned int hmacPadConst[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST }; unsigned int digest_ofs = 0; - unsigned int hash_mode = (ctx->auth_mode == DRV_HASH_SHA1) ? + unsigned int hash_mode = (ctx->auth_mode == DRV_HASH_SHA1) ? DRV_HASH_HW_SHA1 : DRV_HASH_HW_SHA256; - unsigned int digest_size = (ctx->auth_mode == DRV_HASH_SHA1) ? + unsigned int digest_size = (ctx->auth_mode == DRV_HASH_SHA1) ? CC_SHA1_DIGEST_SIZE : CC_SHA256_DIGEST_SIZE; int idx = 0; @@ -363,7 +363,7 @@ static int hmac_setkey(HwDesc_s *desc, struct ssi_aead_ctx *ctx) /* Get the digset */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->auth_state.hmac.ipad_opad_dma_addr + digest_ofs), digest_size, NS_BIT, 0); @@ -420,7 +420,7 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx) return 0; /* All tests of keys sizes passed */ } -/*This function prepers the user key so it can pass to the hmac processing +/*This function prepers the user key so it can pass to the hmac processing (copy to intenral buffer or hash in case of key longer than block */ static int ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) @@ -437,7 +437,7 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl unsigned int idx = 0; int rc = 0; HwDesc_s desc[MAX_AEAD_SETKEY_SEQ]; - dma_addr_t padded_authkey_dma_addr = + dma_addr_t padded_authkey_dma_addr = ctx->auth_state.hmac.padded_authkey_dma_addr; switch (ctx->auth_mode) { /* auth_key required and >0 */ @@ -469,7 +469,7 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); idx++; - + /* Load the hash current length*/ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_CIPHER_MODE(&desc[idx], hashmode); @@ -478,17 +478,17 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); idx++; - + HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + key_dma_addr, keylen, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); idx++; - + /* Get hashed key */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hashmode); + HW_DESC_SET_CIPHER_MODE(&desc[idx], hashmode); HW_DESC_SET_DOUT_DLLI(&desc[idx], padded_authkey_dma_addr, digestsize, @@ -500,32 +500,32 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); idx++; - + HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0, (blocksize - digestsize)); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], (padded_authkey_dma_addr + digestsize), (blocksize - digestsize), NS_BIT, 0); idx++; } else { HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + key_dma_addr, keylen, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], (padded_authkey_dma_addr), keylen, NS_BIT, 0); idx++; - + if ((blocksize - keylen) != 0) { HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0, (blocksize - keylen)); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], (padded_authkey_dma_addr + keylen), (blocksize - keylen), NS_BIT, 0); @@ -537,7 +537,7 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl HW_DESC_SET_DIN_CONST(&desc[idx], 0, (blocksize - keylen)); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], padded_authkey_dma_addr, blocksize, NS_BIT, 0); @@ -632,7 +632,7 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) } END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_1); - + /* STAT_PHASE_2: Create sequence */ START_CYCLE_COUNT(); @@ -656,7 +656,7 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) /* STAT_PHASE_3: Submit sequence to HW */ START_CYCLE_COUNT(); - + if (seq_len > 0) { /* For CCM there is no sequence to setup the key */ #ifdef ENABLE_CYCLE_COUNT ssi_req.op_type = STAT_OP_TYPE_SETKEY; @@ -684,7 +684,7 @@ static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsign { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); int rc = 0; - + if (keylen < 3) return -EINVAL; @@ -702,7 +702,7 @@ static int ssi_aead_setauthsize( unsigned int authsize) { struct ssi_aead_ctx *ctx = crypto_aead_ctx(authenc); - + CHECK_AND_RETURN_UPON_FIPS_ERROR(); /* Unsupported auth. sizes */ if ((authsize == 0) || @@ -752,11 +752,11 @@ static int ssi_ccm_setauthsize(struct crypto_aead *authenc, } #endif /*SSI_CC_HAS_AES_CCM*/ -static inline void +static inline void ssi_aead_create_assoc_desc( - struct aead_request *areq, + struct aead_request *areq, unsigned int flow_mode, - HwDesc_s desc[], + HwDesc_s desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(areq); @@ -769,7 +769,7 @@ ssi_aead_create_assoc_desc( case SSI_DMA_BUF_DLLI: SSI_LOG_DEBUG("ASSOC buffer type DLLI\n"); HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, sg_dma_address(areq->src), areq->assoclen, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); @@ -797,9 +797,9 @@ ssi_aead_create_assoc_desc( static inline void ssi_aead_process_authenc_data_desc( - struct aead_request *areq, + struct aead_request *areq, unsigned int flow_mode, - HwDesc_s desc[], + HwDesc_s desc[], unsigned int *seq_size, int direct) { @@ -814,7 +814,7 @@ ssi_aead_process_authenc_data_desc( (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? areq_ctx->dstSgl : areq_ctx->srcSgl; - unsigned int offset = + unsigned int offset = (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? areq_ctx->dstOffset : areq_ctx->srcOffset; SSI_LOG_DEBUG("AUTHENC: SRC/DST buffer type DLLI\n"); @@ -860,9 +860,9 @@ ssi_aead_process_authenc_data_desc( static inline void ssi_aead_process_cipher_data_desc( - struct aead_request *areq, + struct aead_request *areq, unsigned int flow_mode, - HwDesc_s desc[], + HwDesc_s desc[], unsigned int *seq_size) { unsigned int idx = *seq_size; @@ -926,7 +926,7 @@ static inline void ssi_aead_process_digest_result_desc( HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); } else { HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); @@ -985,7 +985,7 @@ static inline void ssi_aead_setup_cipher_desc( HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); HW_DESC_SET_FLOW_MODE(&desc[idx], ctx->flow_mode); if (ctx->flow_mode == S_DIN_to_AES) { - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, ((ctx->enc_keylen == 24) ? CC_AES_KEY_SIZE_MAX : ctx->enc_keylen), NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); @@ -1035,7 +1035,7 @@ static inline void ssi_aead_hmac_setup_digest_desc( struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); unsigned int hash_mode = (ctx->auth_mode == DRV_HASH_SHA1) ? DRV_HASH_HW_SHA1 : DRV_HASH_HW_SHA256; - unsigned int digest_size = (ctx->auth_mode == DRV_HASH_SHA1) ? + unsigned int digest_size = (ctx->auth_mode == DRV_HASH_SHA1) ? CC_SHA1_DIGEST_SIZE : CC_SHA256_DIGEST_SIZE; unsigned int idx = *seq_size; @@ -1098,7 +1098,7 @@ static inline void ssi_aead_xcbc_setup_digest_desc( /* Setup XCBC MAC K2 */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (ctx->auth_state.xcbc.xcbc_keys_dma_addr + + (ctx->auth_state.xcbc.xcbc_keys_dma_addr + AES_KEYSIZE_128), AES_KEYSIZE_128, NS_BIT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); @@ -1150,7 +1150,7 @@ static inline void ssi_aead_process_digest_scheme_desc( struct ssi_aead_handle *aead_handle = ctx->drvdata->aead_handle; unsigned int hash_mode = (ctx->auth_mode == DRV_HASH_SHA1) ? DRV_HASH_HW_SHA1 : DRV_HASH_HW_SHA256; - unsigned int digest_size = (ctx->auth_mode == DRV_HASH_SHA1) ? + unsigned int digest_size = (ctx->auth_mode == DRV_HASH_SHA1) ? CC_SHA1_DIGEST_SIZE : CC_SHA256_DIGEST_SIZE; unsigned int idx = *seq_size; @@ -1284,9 +1284,9 @@ static inline void ssi_aead_hmac_authenc( return; } - /** + /** * Double-pass flow - * Fallback for unsupported single-pass modes, + * Fallback for unsupported single-pass modes, * i.e. using assoc. data of non-word-multiple */ if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { /* encrypt first.. */ @@ -1335,9 +1335,9 @@ ssi_aead_xcbc_authenc( return; } - /** + /** * Double-pass flow - * Fallback for unsupported single-pass modes, + * Fallback for unsupported single-pass modes, * i.e. using assoc. data of non-word-multiple */ if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { /* encrypt first.. */ @@ -1382,7 +1382,7 @@ static int validate_data_size(struct ssi_aead_ctx *ctx, if (ctx->cipher_mode == DRV_CIPHER_GCTR) { if (areq_ctx->plaintext_authenticate_only == true) - areq_ctx->is_single_pass = false; + areq_ctx->is_single_pass = false; break; } @@ -1417,7 +1417,7 @@ static unsigned int format_ccm_a0(uint8_t *pA0Buff, uint32_t headerSize) unsigned int len = 0; if ( headerSize == 0 ) { return 0; - } + } if ( headerSize < ((1UL << 16) - (1UL << 8) )) { len = 2; @@ -1477,11 +1477,11 @@ static inline int ssi_aead_ccm( } /* load key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ((ctx->enc_keylen == 24) ? - CC_AES_KEY_SIZE_MAX : ctx->enc_keylen), + HW_DESC_INIT(&desc[idx]); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ((ctx->enc_keylen == 24) ? + CC_AES_KEY_SIZE_MAX : ctx->enc_keylen), NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); @@ -1494,19 +1494,19 @@ static inline int ssi_aead_ccm( HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->gen_ctx.iv_dma_addr, + req_ctx->gen_ctx.iv_dma_addr, AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); idx++; /* load MAC key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ((ctx->enc_keylen == 24) ? - CC_AES_KEY_SIZE_MAX : ctx->enc_keylen), + HW_DESC_INIT(&desc[idx]); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ((ctx->enc_keylen == 24) ? + CC_AES_KEY_SIZE_MAX : ctx->enc_keylen), NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); @@ -1520,9 +1520,9 @@ static inline int ssi_aead_ccm( HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->mac_buf_dma_addr, + req_ctx->mac_buf_dma_addr, AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); @@ -1534,7 +1534,7 @@ static inline int ssi_aead_ccm( ssi_aead_create_assoc_desc(req, DIN_HASH, desc, &idx); } else { HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, sg_dma_address(&req_ctx->ccm_adata_sg), AES_BLOCK_SIZE + req_ctx->ccm_hdr_size, NS_BIT); @@ -1582,7 +1582,7 @@ static inline int ssi_aead_ccm( HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_result , ctx->authsize, NS_BIT, 1); HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - idx++; + idx++; *seq_size = idx; return 0; @@ -1600,9 +1600,9 @@ static int config_ccm_adata(struct aead_request *req) { uint8_t *b0 = req_ctx->ccm_config + CCM_B0_OFFSET; uint8_t *a0 = req_ctx->ccm_config + CCM_A0_OFFSET; uint8_t *ctr_count_0 = req_ctx->ccm_config + CCM_CTR_COUNT_0_OFFSET; - unsigned int cryptlen = (req_ctx->gen_ctx.op_type == - DRV_CRYPTO_DIRECTION_ENCRYPT) ? - req->cryptlen : + unsigned int cryptlen = (req_ctx->gen_ctx.op_type == + DRV_CRYPTO_DIRECTION_ENCRYPT) ? + req->cryptlen : (req->cryptlen - ctx->authsize); int rc; memset(req_ctx->mac_buf, 0, AES_BLOCK_SIZE); @@ -1622,13 +1622,13 @@ static int config_ccm_adata(struct aead_request *req) { *b0 |= (8 * ((m - 2) / 2)); if (req->assoclen > 0) *b0 |= 64; /* Enable bit 6 if Adata exists. */ - + rc = set_msg_len(b0 + 16 - l, cryptlen, l); /* Write L'. */ if (rc != 0) { return rc; } /* END of "taken from crypto/ccm.c" */ - + /* l(a) - size of associated data. */ req_ctx->ccm_hdr_size = format_ccm_a0 (a0, req->assoclen); @@ -1654,7 +1654,7 @@ static void ssi_rfc4309_ccm_process(struct aead_request *req) /* In RFC 4309 there is an 11-bytes nonce+IV part, that we build here. */ memcpy(areq_ctx->ctr_iv + CCM_BLOCK_NONCE_OFFSET, ctx->ctr_nonce, CCM_BLOCK_NONCE_SIZE); memcpy(areq_ctx->ctr_iv + CCM_BLOCK_IV_OFFSET, req->iv, CCM_BLOCK_IV_SIZE); - req->iv = areq_ctx->ctr_iv; + req->iv = areq_ctx->ctr_iv; req->assoclen -= CCM_BLOCK_IV_SIZE; } #endif /*SSI_CC_HAS_AES_CCM*/ @@ -1672,11 +1672,11 @@ static inline void ssi_aead_gcm_setup_ghash_desc( unsigned int idx = *seq_size; /* load key to AES*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); + HW_DESC_INIT(&desc[idx]); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ctx->enc_keylen, NS_BIT); + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ctx->enc_keylen, NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); @@ -1688,7 +1688,7 @@ static inline void ssi_aead_gcm_setup_ghash_desc( HW_DESC_SET_DOUT_DLLI(&desc[idx], req_ctx->hkey_dma_addr, AES_BLOCK_SIZE, - NS_BIT, 0); + NS_BIT, 0); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); idx++; @@ -1701,13 +1701,13 @@ static inline void ssi_aead_gcm_setup_ghash_desc( /* Load GHASH subkey */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->hkey_dma_addr, + req_ctx->hkey_dma_addr, AES_BLOCK_SIZE, NS_BIT); HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); + HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); idx++; @@ -1719,10 +1719,10 @@ static inline void ssi_aead_gcm_setup_ghash_desc( HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); HW_DESC_SET_CIPHER_DO(&desc[idx], 1); //1=AES_SK RKEK HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); + HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); idx++; @@ -1733,7 +1733,7 @@ static inline void ssi_aead_gcm_setup_ghash_desc( HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); + HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); idx++; @@ -1751,11 +1751,11 @@ static inline void ssi_aead_gcm_setup_gctr_desc( unsigned int idx = *seq_size; /* load key to AES*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); + HW_DESC_INIT(&desc[idx]); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ctx->enc_keylen, NS_BIT); + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ctx->enc_keylen, NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); @@ -1767,9 +1767,9 @@ static inline void ssi_aead_gcm_setup_gctr_desc( HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->gcm_iv_inc2_dma_addr, + req_ctx->gcm_iv_inc2_dma_addr, AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); idx++; @@ -1786,7 +1786,7 @@ static inline void ssi_aead_process_gcm_result_desc( struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); - dma_addr_t mac_result; + dma_addr_t mac_result; unsigned int idx = *seq_size; if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) { @@ -1797,7 +1797,7 @@ static inline void ssi_aead_process_gcm_result_desc( /* process(ghash) gcm_block_len */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, req_ctx->gcm_block_len_dma_addr, AES_BLOCK_SIZE, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); @@ -1813,16 +1813,16 @@ static inline void ssi_aead_process_gcm_result_desc( HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - idx++; + idx++; /* load AES/CTR initial CTR value inc by 1*/ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->gcm_iv_inc1_dma_addr, + req_ctx->gcm_iv_inc1_dma_addr, AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); idx++; @@ -1842,7 +1842,7 @@ static inline void ssi_aead_process_gcm_result_desc( HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_result, ctx->authsize, NS_BIT, 1); HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - idx++; + idx++; *seq_size = idx; } @@ -1864,7 +1864,7 @@ static inline int ssi_aead_gcm( //in RFC4543 no data to encrypt. just copy data from src to dest. - if (req_ctx->plaintext_authenticate_only==true){ + if (req_ctx->plaintext_authenticate_only==true){ ssi_aead_process_cipher_data_desc(req, BYPASS, desc, seq_size); ssi_aead_gcm_setup_ghash_desc(req, desc, seq_size); /* process(ghash) assoc data */ @@ -1883,7 +1883,7 @@ static inline int ssi_aead_gcm( ssi_aead_gcm_setup_gctr_desc(req, desc, seq_size); /* process(gctr+ghash) */ if (req_ctx->cryptlen != 0) - ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, seq_size); + ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, seq_size); ssi_aead_process_gcm_result_desc(req, desc, seq_size); idx = *seq_size; @@ -1940,10 +1940,10 @@ static int config_gcm_context(struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); - - unsigned int cryptlen = (req_ctx->gen_ctx.op_type == - DRV_CRYPTO_DIRECTION_ENCRYPT) ? - req->cryptlen : + + unsigned int cryptlen = (req_ctx->gen_ctx.op_type == + DRV_CRYPTO_DIRECTION_ENCRYPT) ? + req->cryptlen : (req->cryptlen - ctx->authsize); __be32 counter = cpu_to_be32(2); @@ -1988,7 +1988,7 @@ static void ssi_rfc4_gcm_process(struct aead_request *req) memcpy(areq_ctx->ctr_iv + GCM_BLOCK_RFC4_NONCE_OFFSET, ctx->ctr_nonce, GCM_BLOCK_RFC4_NONCE_SIZE); memcpy(areq_ctx->ctr_iv + GCM_BLOCK_RFC4_IV_OFFSET, req->iv, GCM_BLOCK_RFC4_IV_SIZE); - req->iv = areq_ctx->ctr_iv; + req->iv = areq_ctx->ctr_iv; req->assoclen -= GCM_BLOCK_RFC4_IV_SIZE; } @@ -1999,7 +1999,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction { int rc = 0; int seq_len = 0; - HwDesc_s desc[MAX_AEAD_PROCESS_SEQ]; + HwDesc_s desc[MAX_AEAD_PROCESS_SEQ]; struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *areq_ctx = aead_request_ctx(req); @@ -2015,7 +2015,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction /* STAT_PHASE_0: Init and sanity checks */ START_CYCLE_COUNT(); - + /* Check data length according to mode */ if (unlikely(validate_data_size(ctx, direct, req) != 0)) { SSI_LOG_ERR("Unsupported crypt/assoc len %d/%d.\n", @@ -2041,7 +2041,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction /* STAT_PHASE_1: Map buffers */ START_CYCLE_COUNT(); - + if (ctx->cipher_mode == DRV_CIPHER_CTR) { /* Build CTR IV - Copy nonce from last 4 bytes in * CTR key to first 4 bytes in CTR IV */ @@ -2056,7 +2056,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction /* Replace with counter iv */ req->iv = areq_ctx->ctr_iv; areq_ctx->hw_iv_size = CTR_RFC3686_BLOCK_SIZE; - } else if ((ctx->cipher_mode == DRV_CIPHER_CCM) || + } else if ((ctx->cipher_mode == DRV_CIPHER_CCM) || (ctx->cipher_mode == DRV_CIPHER_GCTR) ) { areq_ctx->hw_iv_size = AES_BLOCK_SIZE; if (areq_ctx->ctr_iv != req->iv) { @@ -2072,23 +2072,23 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction rc = config_ccm_adata(req); if (unlikely(rc != 0)) { SSI_LOG_ERR("config_ccm_adata() returned with a failure %d!", rc); - goto exit; + goto exit; } } else { - areq_ctx->ccm_hdr_size = ccm_header_size_null; + areq_ctx->ccm_hdr_size = ccm_header_size_null; } #else - areq_ctx->ccm_hdr_size = ccm_header_size_null; + areq_ctx->ccm_hdr_size = ccm_header_size_null; #endif /*SSI_CC_HAS_AES_CCM*/ -#if SSI_CC_HAS_AES_GCM +#if SSI_CC_HAS_AES_GCM if (ctx->cipher_mode == DRV_CIPHER_GCTR) { rc = config_gcm_context(req); if (unlikely(rc != 0)) { SSI_LOG_ERR("config_gcm_context() returned with a failure %d!", rc); - goto exit; + goto exit; } - } + } #endif /*SSI_CC_HAS_AES_GCM*/ rc = ssi_buffer_mgr_map_aead_request(ctx->drvdata, req); @@ -2153,7 +2153,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction #endif /*SSI_CC_HAS_AES_GCM*/ break; #endif - default: + default: SSI_LOG_ERR("Unsupported authenc (%d)\n", ctx->auth_mode); ssi_buffer_mgr_unmap_aead_request(dev, req); rc = -ENOTSUPP; @@ -2172,7 +2172,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction ssi_buffer_mgr_unmap_aead_request(dev, req); } - + END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); exit: return rc; @@ -2214,9 +2214,9 @@ static int ssi_rfc4309_ccm_encrypt(struct aead_request *req) areq_ctx->backup_iv = req->iv; areq_ctx->backup_giv = NULL; areq_ctx->is_gcm4543 = true; - + ssi_rfc4309_ccm_process(req); - + rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_ENCRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; @@ -2261,10 +2261,10 @@ static int ssi_rfc4309_ccm_decrypt(struct aead_request *req) /* No generated IV required */ areq_ctx->backup_iv = req->iv; areq_ctx->backup_giv = NULL; - + areq_ctx->is_gcm4543 = true; ssi_rfc4309_ccm_process(req); - + rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_DECRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; @@ -2280,7 +2280,7 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); int rc = 0; - + SSI_LOG_DEBUG("ssi_rfc4106_gcm_setkey() keylen %d, key %p \n", keylen, key ); if (keylen < 4) @@ -2298,7 +2298,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign { struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); int rc = 0; - + SSI_LOG_DEBUG("ssi_rfc4543_gcm_setkey() keylen %d, key %p \n", keylen, key ); if (keylen < 4) @@ -2374,7 +2374,7 @@ static int ssi_rfc4106_gcm_encrypt(struct aead_request *req) /* No generated IV required */ areq_ctx->backup_iv = req->iv; areq_ctx->backup_giv = NULL; - + areq_ctx->plaintext_authenticate_only = false; ssi_rfc4_gcm_process(req); @@ -2393,14 +2393,14 @@ static int ssi_rfc4543_gcm_encrypt(struct aead_request *req) struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc; - + //plaintext is not encryped with rfc4543 areq_ctx->plaintext_authenticate_only = true; /* No generated IV required */ areq_ctx->backup_iv = req->iv; areq_ctx->backup_giv = NULL; - + ssi_rfc4_gcm_process(req); areq_ctx->is_gcm4543 = true; @@ -2426,7 +2426,7 @@ static int ssi_rfc4106_gcm_decrypt(struct aead_request *req) /* No generated IV required */ areq_ctx->backup_iv = req->iv; areq_ctx->backup_giv = NULL; - + areq_ctx->plaintext_authenticate_only = false; ssi_rfc4_gcm_process(req); @@ -2452,7 +2452,7 @@ static int ssi_rfc4543_gcm_decrypt(struct aead_request *req) /* No generated IV required */ areq_ctx->backup_iv = req->iv; areq_ctx->backup_giv = NULL; - + ssi_rfc4_gcm_process(req); areq_ctx->is_gcm4543 = true; @@ -2715,7 +2715,7 @@ static struct ssi_alg_template aead_algs[] = { .cipher_mode = DRV_CIPHER_GCTR, .flow_mode = S_DIN_to_AES, .auth_mode = DRV_HASH_NULL, - }, + }, #endif /*SSI_CC_HAS_AES_GCM*/ }; diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index fe88c9e04f88..6135ff28438e 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -35,10 +35,10 @@ /* defines for AES GCM configuration buffer */ #define GCM_BLOCK_LEN_SIZE 8 -#define GCM_BLOCK_RFC4_IV_OFFSET 4 +#define GCM_BLOCK_RFC4_IV_OFFSET 4 #define GCM_BLOCK_RFC4_IV_SIZE 8 /* IV size for rfc's */ -#define GCM_BLOCK_RFC4_NONCE_OFFSET 0 -#define GCM_BLOCK_RFC4_NONCE_SIZE 4 +#define GCM_BLOCK_RFC4_NONCE_OFFSET 0 +#define GCM_BLOCK_RFC4_NONCE_SIZE 4 @@ -62,12 +62,12 @@ enum aead_ccm_header_size { struct aead_req_ctx { /* Allocate cache line although only 4 bytes are needed to - * assure next field falls @ cache line + * assure next field falls @ cache line * Used for both: digest HW compare and CCM/GCM MAC value */ uint8_t mac_buf[MAX_MAC_SIZE] ____cacheline_aligned; uint8_t ctr_iv[AES_BLOCK_SIZE] ____cacheline_aligned; - //used in gcm + //used in gcm uint8_t gcm_iv_inc1[AES_BLOCK_SIZE] ____cacheline_aligned; uint8_t gcm_iv_inc2[AES_BLOCK_SIZE] ____cacheline_aligned; uint8_t hkey[AES_BLOCK_SIZE] ____cacheline_aligned; @@ -85,7 +85,7 @@ struct aead_req_ctx { dma_addr_t ccm_iv0_dma_addr; /* buffer for internal ccm configurations */ dma_addr_t icv_dma_addr; /* Phys. address of ICV */ - //used in gcm + //used in gcm dma_addr_t gcm_iv_inc1_dma_addr; /* buffer for internal gcm configurations */ dma_addr_t gcm_iv_inc2_dma_addr; /* buffer for internal gcm configurations */ dma_addr_t hkey_dma_addr; /* Phys. address of hkey */ diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 038e2ff5e545..39065e8b75b1 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -102,18 +102,18 @@ dma_addr_t ssi_buff_mgr_update_dma_addr(dma_addr_t orig_addr, uint32_t data_len) #ifdef CC_DMA_48BIT_SIM_FULL /* With this code all addresses will be switched to 48 bits. */ /* The if condition protects from double expention */ - if((((orig_addr >> 16) & 0xFFFF) != 0xFFFF) && + if((((orig_addr >> 16) & 0xFFFF) != 0xFFFF) && (data_len <= CC_MAX_MLLI_ENTRY_SIZE)) { #else - if((!(((orig_addr >> 16) & 0xFF) % 2)) && + if((!(((orig_addr >> 16) & 0xFF) % 2)) && (data_len <= CC_MAX_MLLI_ENTRY_SIZE)) { #endif - tmp_dma_addr = ((orig_addr<<16) | 0xFFFF0000 | + tmp_dma_addr = ((orig_addr<<16) | 0xFFFF0000 | (orig_addr & UINT16_MAX)); SSI_LOG_DEBUG("MAP DMA: orig address=0x%llX " "dma_address=0x%llX\n", orig_addr, tmp_dma_addr); - return tmp_dma_addr; + return tmp_dma_addr; } return orig_addr; } @@ -126,29 +126,29 @@ dma_addr_t ssi_buff_mgr_restore_dma_addr(dma_addr_t orig_addr) /* The if condition protects from double restoring */ if((orig_addr >> 32) & 0xFFFF ) { #else - if(((orig_addr >> 32) & 0xFFFF) && + if(((orig_addr >> 32) & 0xFFFF) && !(((orig_addr >> 32) & 0xFF) % 2) ) { #endif /*return high 16 bits*/ tmp_dma_addr = ((orig_addr >> 16)); /*clean the 0xFFFF in the lower bits (set in the add expansion)*/ - tmp_dma_addr &= 0xFFFF0000; + tmp_dma_addr &= 0xFFFF0000; /* Set the original 16 bits */ - tmp_dma_addr |= (orig_addr & UINT16_MAX); + tmp_dma_addr |= (orig_addr & UINT16_MAX); SSI_LOG_DEBUG("Release DMA: orig address=0x%llX " "dma_address=0x%llX\n", orig_addr, tmp_dma_addr); - return tmp_dma_addr; + return tmp_dma_addr; } return orig_addr; } #endif /** * ssi_buffer_mgr_get_sgl_nents() - Get scatterlist number of entries. - * + * * @sg_list: SG list * @nbytes: [IN] Total SGL data bytes. - * @lbytes: [OUT] Returns the amount of bytes at the last entry + * @lbytes: [OUT] Returns the amount of bytes at the last entry */ static unsigned int ssi_buffer_mgr_get_sgl_nents( struct scatterlist *sg_list, unsigned int nbytes, uint32_t *lbytes, bool *is_chained) @@ -179,7 +179,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( /** * ssi_buffer_mgr_zero_sgl() - Zero scatter scatter list data. - * + * * @sgl: */ void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, uint32_t data_len) @@ -201,7 +201,7 @@ void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, uint32_t data_len) /** * ssi_buffer_mgr_copy_scatterlist_portion() - Copy scatter list data, * from to_skip to end, to dest and vice versa - * + * * @dest: * @sg: * @to_skip: @@ -306,7 +306,7 @@ static int ssi_buffer_mgr_generate_mlli( rc =-ENOMEM; goto build_mlli_exit; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(mlli_params->mlli_dma_addr, + SSI_UPDATE_DMA_ADDR_TO_48BIT(mlli_params->mlli_dma_addr, (MAX_NUM_OF_TOTAL_MLLI_ENTRIES* LLI_ENTRY_BYTE_SIZE)); /* Point to start of MLLI */ @@ -315,7 +315,7 @@ static int ssi_buffer_mgr_generate_mlli( for (i = 0; i < sg_data->num_of_buffers; i++) { if (sg_data->type[i] == DMA_SGL_TYPE) rc = ssi_buffer_mgr_render_scatterlist_to_mlli( - sg_data->entry[i].sgl, + sg_data->entry[i].sgl, sg_data->total_data_len[i], sg_data->offset[i], &total_nents, &mlli_p); else /*DMA_BUFF_TYPE*/ @@ -329,9 +329,9 @@ static int ssi_buffer_mgr_generate_mlli( /* set last bit in the current table */ if (sg_data->mlli_nents[i] != NULL) { - /*Calculate the current MLLI table length for the + /*Calculate the current MLLI table length for the length field in the descriptor*/ - *(sg_data->mlli_nents[i]) += + *(sg_data->mlli_nents[i]) += (total_nents - prev_total_nents); prev_total_nents = total_nents; } @@ -440,20 +440,20 @@ static int ssi_buffer_mgr_map_scatterlist( if (unlikely(dma_map_sg(dev, sg, 1, direction) != 1)) { SSI_LOG_ERR("dma_map_sg() single buffer failed\n"); return -ENOMEM; - } + } SSI_LOG_DEBUG("Mapped sg: dma_address=0x%llX " "page_link=0x%08lX addr=%pK offset=%u " "length=%u\n", - (unsigned long long)sg_dma_address(sg), - sg->page_link, - sg_virt(sg), + (unsigned long long)sg_dma_address(sg), + sg->page_link, + sg_virt(sg), sg->offset, sg->length); *lbytes = nbytes; *nents = 1; *mapped_nents = 1; SSI_UPDATE_DMA_ADDR_TO_48BIT(sg_dma_address(sg), sg_dma_len(sg)); } else { /*sg_is_last*/ - *nents = ssi_buffer_mgr_get_sgl_nents(sg, nbytes, lbytes, + *nents = ssi_buffer_mgr_get_sgl_nents(sg, nbytes, lbytes, &is_chained); if (*nents > max_sg_nents) { *nents = 0; @@ -498,7 +498,7 @@ ssi_aead_handle_config_buf(struct device *dev, SSI_LOG_DEBUG(" handle additional data config set to DLLI \n"); /* create sg for the current buffer */ sg_init_one(&areq_ctx->ccm_adata_sg, config_data, AES_BLOCK_SIZE + areq_ctx->ccm_hdr_size); - if (unlikely(dma_map_sg(dev, &areq_ctx->ccm_adata_sg, 1, + if (unlikely(dma_map_sg(dev, &areq_ctx->ccm_adata_sg, 1, DMA_TO_DEVICE) != 1)) { SSI_LOG_ERR("dma_map_sg() " "config buffer failed\n"); @@ -507,16 +507,16 @@ ssi_aead_handle_config_buf(struct device *dev, SSI_LOG_DEBUG("Mapped curr_buff: dma_address=0x%llX " "page_link=0x%08lX addr=%pK " "offset=%u length=%u\n", - (unsigned long long)sg_dma_address(&areq_ctx->ccm_adata_sg), - areq_ctx->ccm_adata_sg.page_link, + (unsigned long long)sg_dma_address(&areq_ctx->ccm_adata_sg), + areq_ctx->ccm_adata_sg.page_link, sg_virt(&areq_ctx->ccm_adata_sg), - areq_ctx->ccm_adata_sg.offset, + areq_ctx->ccm_adata_sg.offset, areq_ctx->ccm_adata_sg.length); /* prepare for case of MLLI */ if (assoclen > 0) { - ssi_buffer_mgr_add_scatterlist_entry(sg_data, 1, + ssi_buffer_mgr_add_scatterlist_entry(sg_data, 1, &areq_ctx->ccm_adata_sg, - (AES_BLOCK_SIZE + + (AES_BLOCK_SIZE + areq_ctx->ccm_hdr_size), 0, false, NULL); } @@ -542,10 +542,10 @@ static inline int ssi_ahash_handle_curr_buf(struct device *dev, SSI_LOG_DEBUG("Mapped curr_buff: dma_address=0x%llX " "page_link=0x%08lX addr=%pK " "offset=%u length=%u\n", - (unsigned long long)sg_dma_address(areq_ctx->buff_sg), - areq_ctx->buff_sg->page_link, + (unsigned long long)sg_dma_address(areq_ctx->buff_sg), + areq_ctx->buff_sg->page_link, sg_virt(areq_ctx->buff_sg), - areq_ctx->buff_sg->offset, + areq_ctx->buff_sg->offset, areq_ctx->buff_sg->length); areq_ctx->data_dma_buf_type = SSI_DMA_BUF_DLLI; areq_ctx->curr_sg = areq_ctx->buff_sg; @@ -566,12 +566,12 @@ void ssi_buffer_mgr_unmap_blkcipher_request( struct blkcipher_req_ctx *req_ctx = (struct blkcipher_req_ctx *)ctx; if (likely(req_ctx->gen_ctx.iv_dma_addr != 0)) { - SSI_LOG_DEBUG("Unmapped iv: iv_dma_addr=0x%llX iv_size=%u\n", + SSI_LOG_DEBUG("Unmapped iv: iv_dma_addr=0x%llX iv_size=%u\n", (unsigned long long)req_ctx->gen_ctx.iv_dma_addr, ivsize); SSI_RESTORE_DMA_ADDR_TO_48BIT(req_ctx->gen_ctx.iv_dma_addr); - dma_unmap_single(dev, req_ctx->gen_ctx.iv_dma_addr, - ivsize, + dma_unmap_single(dev, req_ctx->gen_ctx.iv_dma_addr, + ivsize, req_ctx->is_giv ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE); } @@ -586,12 +586,12 @@ void ssi_buffer_mgr_unmap_blkcipher_request( SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(src)); dma_unmap_sg(dev, src, req_ctx->in_nents, DMA_BIDIRECTIONAL); - SSI_LOG_DEBUG("Unmapped req->src=%pK\n", + SSI_LOG_DEBUG("Unmapped req->src=%pK\n", sg_virt(src)); if (src != dst) { SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(dst)); - dma_unmap_sg(dev, dst, req_ctx->out_nents, + dma_unmap_sg(dev, dst, req_ctx->out_nents, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped req->dst=%pK\n", sg_virt(dst)); @@ -608,7 +608,7 @@ int ssi_buffer_mgr_map_blkcipher_request( struct scatterlist *dst) { struct blkcipher_req_ctx *req_ctx = (struct blkcipher_req_ctx *)ctx; - struct mlli_params *mlli_params = &req_ctx->mlli_params; + struct mlli_params *mlli_params = &req_ctx->mlli_params; struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle; struct device *dev = &drvdata->plat_dev->dev; struct buffer_array sg_data; @@ -623,12 +623,12 @@ int ssi_buffer_mgr_map_blkcipher_request( /* Map IV buffer */ if (likely(ivsize != 0) ) { dump_byte_array("iv", (uint8_t *)info, ivsize); - req_ctx->gen_ctx.iv_dma_addr = - dma_map_single(dev, (void *)info, - ivsize, + req_ctx->gen_ctx.iv_dma_addr = + dma_map_single(dev, (void *)info, + ivsize, req_ctx->is_giv ? DMA_BIDIRECTIONAL: DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(dev, + if (unlikely(dma_mapping_error(dev, req_ctx->gen_ctx.iv_dma_addr))) { SSI_LOG_ERR("Mapping iv %u B at va=%pK " "for DMA failed\n", ivsize, info); @@ -641,7 +641,7 @@ int ssi_buffer_mgr_map_blkcipher_request( (unsigned long long)req_ctx->gen_ctx.iv_dma_addr); } else req_ctx->gen_ctx.iv_dma_addr = 0; - + /* Map the src SGL */ rc = ssi_buffer_mgr_map_scatterlist(dev, src, nbytes, DMA_BIDIRECTIONAL, &req_ctx->in_nents, @@ -681,11 +681,11 @@ int ssi_buffer_mgr_map_blkcipher_request( &req_ctx->in_mlli_nents); ssi_buffer_mgr_add_scatterlist_entry(&sg_data, req_ctx->out_nents, dst, - nbytes, 0, true, + nbytes, 0, true, &req_ctx->out_mlli_nents); } } - + if (unlikely(req_ctx->dma_buf_type == SSI_DMA_BUF_MLLI)) { mlli_params->curr_pool = buff_mgr->mlli_buffs_pool; rc = ssi_buffer_mgr_generate_mlli(dev, &sg_data, mlli_params); @@ -716,7 +716,7 @@ void ssi_buffer_mgr_unmap_aead_request( if (areq_ctx->mac_buf_dma_addr != 0) { SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->mac_buf_dma_addr); - dma_unmap_single(dev, areq_ctx->mac_buf_dma_addr, + dma_unmap_single(dev, areq_ctx->mac_buf_dma_addr, MAX_MAC_SIZE, DMA_BIDIRECTIONAL); } @@ -727,22 +727,22 @@ void ssi_buffer_mgr_unmap_aead_request( dma_unmap_single(dev, areq_ctx->hkey_dma_addr, AES_BLOCK_SIZE, DMA_BIDIRECTIONAL); } - + if (areq_ctx->gcm_block_len_dma_addr != 0) { SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_block_len_dma_addr); dma_unmap_single(dev, areq_ctx->gcm_block_len_dma_addr, AES_BLOCK_SIZE, DMA_TO_DEVICE); } - + if (areq_ctx->gcm_iv_inc1_dma_addr != 0) { SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_iv_inc1_dma_addr); - dma_unmap_single(dev, areq_ctx->gcm_iv_inc1_dma_addr, + dma_unmap_single(dev, areq_ctx->gcm_iv_inc1_dma_addr, AES_BLOCK_SIZE, DMA_TO_DEVICE); } - + if (areq_ctx->gcm_iv_inc2_dma_addr != 0) { SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_iv_inc2_dma_addr); - dma_unmap_single(dev, areq_ctx->gcm_iv_inc2_dma_addr, + dma_unmap_single(dev, areq_ctx->gcm_iv_inc2_dma_addr, AES_BLOCK_SIZE, DMA_TO_DEVICE); } } @@ -751,7 +751,7 @@ void ssi_buffer_mgr_unmap_aead_request( if (areq_ctx->ccm_hdr_size != ccm_header_size_null) { if (areq_ctx->ccm_iv0_dma_addr != 0) { SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->ccm_iv0_dma_addr); - dma_unmap_single(dev, areq_ctx->ccm_iv0_dma_addr, + dma_unmap_single(dev, areq_ctx->ccm_iv0_dma_addr, AES_BLOCK_SIZE, DMA_TO_DEVICE); } @@ -763,10 +763,10 @@ void ssi_buffer_mgr_unmap_aead_request( hw_iv_size, DMA_BIDIRECTIONAL); } - /*In case a pool was set, a table was + /*In case a pool was set, a table was allocated and should be released */ if (areq_ctx->mlli_params.curr_pool != NULL) { - SSI_LOG_DEBUG("free MLLI buffer: dma=0x%08llX virt=%pK\n", + SSI_LOG_DEBUG("free MLLI buffer: dma=0x%08llX virt=%pK\n", (unsigned long long)areq_ctx->mlli_params.mlli_dma_addr, areq_ctx->mlli_params.mlli_virt_addr); SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->mlli_params.mlli_dma_addr); @@ -786,7 +786,7 @@ void ssi_buffer_mgr_unmap_aead_request( dma_unmap_sg(dev, req->src, ssi_buffer_mgr_get_sgl_nents(req->src,size_to_unmap,&dummy,&chained) , DMA_BIDIRECTIONAL); if (unlikely(req->src != req->dst)) { - SSI_LOG_DEBUG("Unmapping dst sgl: req->dst=%pK\n", + SSI_LOG_DEBUG("Unmapping dst sgl: req->dst=%pK\n", sg_virt(req->dst)); SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(req->dst)); dma_unmap_sg(dev, req->dst, ssi_buffer_mgr_get_sgl_nents(req->dst,size_to_unmap,&dummy,&chained), @@ -821,12 +821,12 @@ static inline int ssi_buffer_mgr_get_aead_icv_nents( unsigned int icv_required_size = authsize > last_entry_data_size ? (authsize - last_entry_data_size) : authsize; unsigned int nents; unsigned int i; - + if (sgl_nents < MAX_ICV_NENTS_SUPPORTED) { *is_icv_fragmented = false; return 0; } - + for( i = 0 ; i < (sgl_nents - MAX_ICV_NENTS_SUPPORTED) ; i++) { if (sgl == NULL) { break; @@ -883,12 +883,12 @@ static inline int ssi_buffer_mgr_aead_chain_iv( SSI_LOG_ERR("Mapping iv %u B at va=%pK for DMA failed\n", hw_iv_size, req->iv); rc = -ENOMEM; - goto chain_iv_exit; + goto chain_iv_exit; } SSI_UPDATE_DMA_ADDR_TO_48BIT(areq_ctx->gen_ctx.iv_dma_addr, hw_iv_size); SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=0x%llX\n", - hw_iv_size, req->iv, + hw_iv_size, req->iv, (unsigned long long)areq_ctx->gen_ctx.iv_dma_addr); if (do_chain == true && areq_ctx->plaintext_authenticate_only == true){ // TODO: what about CTR?? ask Ron struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -943,7 +943,7 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( //it is assumed that if we reach here , the sgl is already mapped sg_index = current_sg->length; if (sg_index > size_of_assoc) { //the first entry in the scatter list contains all the associated data - mapped_nents++; + mapped_nents++; } else{ while (sg_index <= size_of_assoc) { @@ -1095,7 +1095,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( &areq_ctx->srcSgl[areq_ctx->src.nents - 1]) + (*src_last_bytes - authsize); areq_ctx->icv_virt_addr = sg_virt( - &areq_ctx->srcSgl[areq_ctx->src.nents - 1]) + + &areq_ctx->srcSgl[areq_ctx->src.nents - 1]) + (*src_last_bytes - authsize); } @@ -1214,8 +1214,8 @@ static inline int ssi_buffer_mgr_aead_chain_data( size_for_map += crypto_aead_ivsize(tfm); } - size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? authsize:0; - src_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->src,size_for_map,&src_last_bytes, &chained); + size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? authsize:0; + src_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->src,size_for_map,&src_last_bytes, &chained); sg_index = areq_ctx->srcSgl->length; //check where the data starts while (sg_index <= size_to_skip) { @@ -1238,7 +1238,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( areq_ctx->src.nents = src_mapped_nents; - areq_ctx->srcOffset = offset; + areq_ctx->srcOffset = offset; if (req->src != req->dst) { size_for_map = req->assoclen +req->cryptlen; @@ -1253,7 +1253,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( &dst_mapped_nents); if (unlikely(rc != 0)) { rc = -ENOMEM; - goto chain_data_exit; + goto chain_data_exit; } } @@ -1303,10 +1303,10 @@ static void ssi_buffer_mgr_update_aead_mlli_nents( struct ssi_drvdata *drvdata, { struct aead_req_ctx *areq_ctx = aead_request_ctx(req); uint32_t curr_mlli_size = 0; - + if (areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI) { areq_ctx->assoc.sram_addr = drvdata->mlli_sram_addr; - curr_mlli_size = areq_ctx->assoc.mlli_nents * + curr_mlli_size = areq_ctx->assoc.mlli_nents * LLI_ENTRY_BYTE_SIZE; } @@ -1318,31 +1318,31 @@ static void ssi_buffer_mgr_update_aead_mlli_nents( struct ssi_drvdata *drvdata, curr_mlli_size; areq_ctx->dst.sram_addr = areq_ctx->src.sram_addr; if (areq_ctx->is_single_pass == false) - areq_ctx->assoc.mlli_nents += + areq_ctx->assoc.mlli_nents += areq_ctx->src.mlli_nents; } else { - if (areq_ctx->gen_ctx.op_type == + if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) { - areq_ctx->src.sram_addr = + areq_ctx->src.sram_addr = drvdata->mlli_sram_addr + curr_mlli_size; - areq_ctx->dst.sram_addr = - areq_ctx->src.sram_addr + - areq_ctx->src.mlli_nents * + areq_ctx->dst.sram_addr = + areq_ctx->src.sram_addr + + areq_ctx->src.mlli_nents * LLI_ENTRY_BYTE_SIZE; if (areq_ctx->is_single_pass == false) - areq_ctx->assoc.mlli_nents += + areq_ctx->assoc.mlli_nents += areq_ctx->src.mlli_nents; } else { - areq_ctx->dst.sram_addr = + areq_ctx->dst.sram_addr = drvdata->mlli_sram_addr + curr_mlli_size; - areq_ctx->src.sram_addr = + areq_ctx->src.sram_addr = areq_ctx->dst.sram_addr + - areq_ctx->dst.mlli_nents * + areq_ctx->dst.mlli_nents * LLI_ENTRY_BYTE_SIZE; if (areq_ctx->is_single_pass == false) - areq_ctx->assoc.mlli_nents += + areq_ctx->assoc.mlli_nents += areq_ctx->dst.mlli_nents; } } @@ -1387,8 +1387,8 @@ int ssi_buffer_mgr_map_aead_request( #endif /* cacluate the size for cipher remove ICV in decrypt*/ - areq_ctx->cryptlen = (areq_ctx->gen_ctx.op_type == - DRV_CRYPTO_DIRECTION_ENCRYPT) ? + areq_ctx->cryptlen = (areq_ctx->gen_ctx.op_type == + DRV_CRYPTO_DIRECTION_ENCRYPT) ? req->cryptlen : (req->cryptlen - authsize); @@ -1489,15 +1489,15 @@ int ssi_buffer_mgr_map_aead_request( LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES+LLI_MAX_NUM_OF_DATA_ENTRIES, &dummy, &mapped_nents); if (unlikely(rc != 0)) { rc = -ENOMEM; - goto aead_map_failure; + goto aead_map_failure; } if (likely(areq_ctx->is_single_pass == true)) { /* - * Create MLLI table for: + * Create MLLI table for: * (1) Assoc. data * (2) Src/Dst SGLs - * Note: IV is contg. buffer (not an SGL) + * Note: IV is contg. buffer (not an SGL) */ rc = ssi_buffer_mgr_aead_chain_assoc(drvdata, req, &sg_data, true, false); if (unlikely(rc != 0)) @@ -1511,19 +1511,19 @@ int ssi_buffer_mgr_map_aead_request( } else { /* DOUBLE-PASS flow */ /* * Prepare MLLI table(s) in this order: - * + * * If ENCRYPT/DECRYPT (inplace): * (1) MLLI table for assoc * (2) IV entry (chained right after end of assoc) * (3) MLLI for src/dst (inplace operation) - * - * If ENCRYPT (non-inplace) + * + * If ENCRYPT (non-inplace) * (1) MLLI table for assoc * (2) IV entry (chained right after end of assoc) * (3) MLLI for dst * (4) MLLI for src - * - * If DECRYPT (non-inplace) + * + * If DECRYPT (non-inplace) * (1) MLLI table for assoc * (2) IV entry (chained right after end of assoc) * (3) MLLI for src @@ -1572,7 +1572,7 @@ int ssi_buffer_mgr_map_hash_request_final( areq_ctx->buff0; uint32_t *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : &areq_ctx->buff0_cnt; - struct mlli_params *mlli_params = &areq_ctx->mlli_params; + struct mlli_params *mlli_params = &areq_ctx->mlli_params; struct buffer_array sg_data; struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle; uint32_t dummy = 0; @@ -1593,7 +1593,7 @@ int ssi_buffer_mgr_map_hash_request_final( /* nothing to do */ return 0; } - + /*TODO: copy data in case that buffer is enough for operation */ /* map the previous buffer */ if (*curr_buff_cnt != 0 ) { @@ -1612,7 +1612,7 @@ int ssi_buffer_mgr_map_hash_request_final( &dummy, &mapped_nents))){ goto unmap_curr_buff; } - if ( src && (mapped_nents == 1) + if ( src && (mapped_nents == 1) && (areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) ) { memcpy(areq_ctx->buff_sg,src, sizeof(struct scatterlist)); @@ -1668,7 +1668,7 @@ int ssi_buffer_mgr_map_hash_request_update( areq_ctx->buff1; uint32_t *next_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : &areq_ctx->buff1_cnt; - struct mlli_params *mlli_params = &areq_ctx->mlli_params; + struct mlli_params *mlli_params = &areq_ctx->mlli_params; unsigned int update_data_len; uint32_t total_in_len = nbytes + *curr_buff_cnt; struct buffer_array sg_data; @@ -1676,7 +1676,7 @@ int ssi_buffer_mgr_map_hash_request_update( unsigned int swap_index = 0; uint32_t dummy = 0; uint32_t mapped_nents = 0; - + SSI_LOG_DEBUG(" update params : curr_buff=%pK " "curr_buff_cnt=0x%X nbytes=0x%X " "src=%pK curr_index=%u \n", @@ -1694,12 +1694,12 @@ int ssi_buffer_mgr_map_hash_request_update( "*curr_buff_cnt=0x%X copy_to=%pK\n", curr_buff, *curr_buff_cnt, &curr_buff[*curr_buff_cnt]); - areq_ctx->in_nents = + areq_ctx->in_nents = ssi_buffer_mgr_get_sgl_nents(src, nbytes, &dummy, NULL); sg_copy_to_buffer(src, areq_ctx->in_nents, - &curr_buff[*curr_buff_cnt], nbytes); + &curr_buff[*curr_buff_cnt], nbytes); *curr_buff_cnt += nbytes; return 1; } @@ -1734,7 +1734,7 @@ int ssi_buffer_mgr_map_hash_request_update( /* change the buffer index for next operation */ swap_index = 1; } - + if ( update_data_len > *curr_buff_cnt ) { if ( unlikely( ssi_buffer_mgr_map_scatterlist( dev,src, (update_data_len -*curr_buff_cnt), @@ -1744,7 +1744,7 @@ int ssi_buffer_mgr_map_hash_request_update( &dummy, &mapped_nents))){ goto unmap_curr_buff; } - if ( (mapped_nents == 1) + if ( (mapped_nents == 1) && (areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) ) { /* only one entry in the SG and no previous data */ memcpy(areq_ctx->buff_sg,src, @@ -1792,10 +1792,10 @@ void ssi_buffer_mgr_unmap_hash_request( uint32_t *prev_len = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : &areq_ctx->buff1_cnt; - /*In case a pool was set, a table was + /*In case a pool was set, a table was allocated and should be released */ if (areq_ctx->mlli_params.curr_pool != NULL) { - SSI_LOG_DEBUG("free MLLI buffer: dma=0x%llX virt=%pK\n", + SSI_LOG_DEBUG("free MLLI buffer: dma=0x%llX virt=%pK\n", (unsigned long long)areq_ctx->mlli_params.mlli_dma_addr, areq_ctx->mlli_params.mlli_virt_addr); SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->mlli_params.mlli_dma_addr); @@ -1803,22 +1803,22 @@ void ssi_buffer_mgr_unmap_hash_request( areq_ctx->mlli_params.mlli_virt_addr, areq_ctx->mlli_params.mlli_dma_addr); } - + if ((src) && likely(areq_ctx->in_nents != 0)) { SSI_LOG_DEBUG("Unmapped sg src: virt=%pK dma=0x%llX len=0x%X\n", sg_virt(src), - (unsigned long long)sg_dma_address(src), + (unsigned long long)sg_dma_address(src), sg_dma_len(src)); SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(src)); - dma_unmap_sg(dev, src, + dma_unmap_sg(dev, src, areq_ctx->in_nents, DMA_TO_DEVICE); } if (*prev_len != 0) { SSI_LOG_DEBUG("Unmapped buffer: areq_ctx->buff_sg=%pK" - "dma=0x%llX len 0x%X\n", + "dma=0x%llX len 0x%X\n", sg_virt(areq_ctx->buff_sg), - (unsigned long long)sg_dma_address(areq_ctx->buff_sg), + (unsigned long long)sg_dma_address(areq_ctx->buff_sg), sg_dma_len(areq_ctx->buff_sg)); dma_unmap_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE); if (!do_revert) { @@ -1844,7 +1844,7 @@ int ssi_buffer_mgr_init(struct ssi_drvdata *drvdata) buff_mgr_handle->mlli_buffs_pool = dma_pool_create( "dx_single_mlli_tables", dev, - MAX_NUM_OF_TOTAL_MLLI_ENTRIES * + MAX_NUM_OF_TOTAL_MLLI_ENTRIES * LLI_ENTRY_BYTE_SIZE, MLLI_TABLE_MIN_ALIGNMENT, 0); diff --git a/drivers/staging/ccree/ssi_buffer_mgr.h b/drivers/staging/ccree/ssi_buffer_mgr.h index 5f4b032389f1..8c3273edc618 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.h +++ b/drivers/staging/ccree/ssi_buffer_mgr.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -48,7 +48,7 @@ struct mlli_params { struct dma_pool *curr_pool; uint8_t *mlli_virt_addr; dma_addr_t mlli_dma_addr; - uint32_t mlli_len; + uint32_t mlli_len; }; int ssi_buffer_mgr_init(struct ssi_drvdata *drvdata); @@ -65,7 +65,7 @@ int ssi_buffer_mgr_map_blkcipher_request( struct scatterlist *dst); void ssi_buffer_mgr_unmap_blkcipher_request( - struct device *dev, + struct device *dev, void *ctx, unsigned int ivsize, struct scatterlist *src, diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 664ed7e52cf2..7e85d2c0dfab 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -117,7 +117,7 @@ static int validate_data_size(struct ssi_ablkcipher_ctx *ctx_p, unsigned int siz switch (ctx_p->cipher_mode){ case DRV_CIPHER_XTS: if ((size >= SSI_MIN_AES_XTS_SIZE) && - (size <= SSI_MAX_AES_XTS_SIZE) && + (size <= SSI_MAX_AES_XTS_SIZE) && IS_ALIGNED(size, AES_BLOCK_SIZE)) return 0; break; @@ -189,7 +189,7 @@ static int ssi_blkcipher_init(struct crypto_tfm *tfm) int rc = 0; unsigned int max_key_buf_size = get_max_keysize(tfm); - SSI_LOG_DEBUG("Initializing context @%p for %s\n", ctx_p, + SSI_LOG_DEBUG("Initializing context @%p for %s\n", ctx_p, crypto_tfm_alg_name(tfm)); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -251,7 +251,7 @@ static void ssi_blkcipher_exit(struct crypto_tfm *tfm) SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx_p->user.key_dma_addr); dma_unmap_single(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); - SSI_LOG_DEBUG("Unmapped key buffer key_dma_addr=0x%llX\n", + SSI_LOG_DEBUG("Unmapped key buffer key_dma_addr=0x%llX\n", (unsigned long long)ctx_p->user.key_dma_addr); /* Free key buffer in context */ @@ -266,9 +266,9 @@ typedef struct tdes_keys{ u8 key3[DES_KEY_SIZE]; }tdes_keys_t; -static const u8 zero_buff[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +static const u8 zero_buff[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; /* The function verifies that tdes keys are not weak.*/ @@ -278,7 +278,7 @@ static int ssi_fips_verify_3des_keys(const u8 *key, unsigned int keylen) tdes_keys_t *tdes_key = (tdes_keys_t*)key; /* verify key1 != key2 and key3 != key2*/ - if (unlikely( (memcmp((u8*)tdes_key->key1, (u8*)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || + if (unlikely( (memcmp((u8*)tdes_key->key1, (u8*)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || (memcmp((u8*)tdes_key->key3, (u8*)tdes_key->key2, sizeof(tdes_key->key3)) == 0) )) { return -ENOEXEC; } @@ -317,8 +317,8 @@ static enum HwCryptoKey hw_key_to_cc_hw_key(int slot_num) return END_OF_KEYS; } -static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, - const u8 *key, +static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, + const u8 *key, unsigned int keylen) { struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); @@ -334,7 +334,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, CHECK_AND_RETURN_UPON_FIPS_ERROR(); SSI_LOG_DEBUG("ssi_blkcipher_setkey: after FIPS check"); - + /* STAT_PHASE_0: Init and sanity checks */ START_CYCLE_COUNT(); @@ -396,13 +396,13 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, return -EINVAL; } } - if ((ctx_p->cipher_mode == DRV_CIPHER_XTS) && + if ((ctx_p->cipher_mode == DRV_CIPHER_XTS) && ssi_fips_verify_xts_keys(key, keylen) != 0) { SSI_LOG_DEBUG("ssi_blkcipher_setkey: weak XTS key"); return -EINVAL; } - if ((ctx_p->flow_mode == S_DIN_to_DES) && - (keylen == DES3_EDE_KEY_SIZE) && + if ((ctx_p->flow_mode == S_DIN_to_DES) && + (keylen == DES3_EDE_KEY_SIZE) && ssi_fips_verify_3des_keys(key, keylen) != 0) { SSI_LOG_DEBUG("ssi_blkcipher_setkey: weak 3DES key"); return -EINVAL; @@ -414,7 +414,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, /* STAT_PHASE_1: Copy key to ctx */ START_CYCLE_COUNT(); SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx_p->user.key_dma_addr); - dma_sync_single_for_cpu(dev, ctx_p->user.key_dma_addr, + dma_sync_single_for_cpu(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); #if SSI_CC_HAS_MULTI2 if (ctx_p->flow_mode == S_DIN_to_MULTI2) { @@ -426,7 +426,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, SSI_LOG_DEBUG("ssi_blkcipher_setkey: SSI_CC_HAS_MULTI2 einval"); return -EINVAL; } - } else + } else #endif /*SSI_CC_HAS_MULTI2*/ { memcpy(ctx_p->user.key, key, keylen); @@ -447,11 +447,11 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, } } } - dma_sync_single_for_device(dev, ctx_p->user.key_dma_addr, + dma_sync_single_for_device(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx_p->user.key_dma_addr ,max_key_buf_size); ctx_p->keylen = keylen; - + END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_1); SSI_LOG_DEBUG("ssi_blkcipher_setkey: return safely"); @@ -496,7 +496,7 @@ ssi_blkcipher_create_setup_desc( HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); HW_DESC_SET_FLOW_MODE(&desc[*seq_size], flow_mode); HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], cipher_mode); - if ((cipher_mode == DRV_CIPHER_CTR) || + if ((cipher_mode == DRV_CIPHER_CTR) || (cipher_mode == DRV_CIPHER_OFB) ) { HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_STATE1); @@ -517,7 +517,7 @@ ssi_blkcipher_create_setup_desc( HW_DESC_SET_HW_CRYPTO_KEY(&desc[*seq_size], ctx_p->hw.key1_slot); } else { HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - key_dma_addr, + key_dma_addr, ((key_len == 24) ? AES_MAX_KEY_SIZE : key_len), NS_BIT); } @@ -559,7 +559,7 @@ ssi_blkcipher_create_setup_desc( if (ssi_is_hw_key(tfm)) { HW_DESC_SET_HW_CRYPTO_KEY(&desc[*seq_size], ctx_p->hw.key2_slot); } else { - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, + HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, (key_dma_addr+key_len/2), key_len/2, NS_BIT); } @@ -568,7 +568,7 @@ ssi_blkcipher_create_setup_desc( HW_DESC_SET_KEY_SIZE_AES(&desc[*seq_size], key_len/2); HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_XEX_KEY); (*seq_size)++; - + /* Set state */ HW_DESC_INIT(&desc[*seq_size]); HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_STATE1); @@ -596,7 +596,7 @@ static inline void ssi_blkcipher_create_multi2_setup_desc( unsigned int *seq_size) { struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); - + int direction = req_ctx->gen_ctx.op_type; /* Load system key */ HW_DESC_INIT(&desc[*seq_size]); @@ -611,8 +611,8 @@ static inline void ssi_blkcipher_create_multi2_setup_desc( /* load data key */ HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - (ctx_p->user.key_dma_addr + + HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, + (ctx_p->user.key_dma_addr + CC_MULTI2_SYSTEM_KEY_SIZE), CC_MULTI2_DATA_KEY_SIZE, NS_BIT); HW_DESC_SET_MULTI2_NUM_ROUNDS(&desc[*seq_size], @@ -622,8 +622,8 @@ static inline void ssi_blkcipher_create_multi2_setup_desc( HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_STATE0 ); (*seq_size)++; - - + + /* Set state */ HW_DESC_INIT(&desc[*seq_size]); HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, @@ -632,9 +632,9 @@ static inline void ssi_blkcipher_create_multi2_setup_desc( HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); HW_DESC_SET_FLOW_MODE(&desc[*seq_size], ctx_p->flow_mode); HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], ctx_p->cipher_mode); - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_STATE1); + HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_STATE1); (*seq_size)++; - + } #endif /*SSI_CC_HAS_MULTI2*/ @@ -715,7 +715,7 @@ ssi_blkcipher_create_data_desc( "addr 0x%08X\n", (unsigned int)ctx_p->drvdata->mlli_sram_addr, (unsigned int)ctx_p->drvdata->mlli_sram_addr); - HW_DESC_SET_DOUT_MLLI(&desc[*seq_size], + HW_DESC_SET_DOUT_MLLI(&desc[*seq_size], ctx_p->drvdata->mlli_sram_addr, req_ctx->in_mlli_nents, NS_BIT,(areq == NULL)? 0:1); @@ -723,13 +723,13 @@ ssi_blkcipher_create_data_desc( SSI_LOG_DEBUG(" din/dout params " "addr 0x%08X addr 0x%08X\n", (unsigned int)ctx_p->drvdata->mlli_sram_addr, - (unsigned int)ctx_p->drvdata->mlli_sram_addr + - (uint32_t)LLI_ENTRY_BYTE_SIZE * + (unsigned int)ctx_p->drvdata->mlli_sram_addr + + (uint32_t)LLI_ENTRY_BYTE_SIZE * req_ctx->in_nents); - HW_DESC_SET_DOUT_MLLI(&desc[*seq_size], + HW_DESC_SET_DOUT_MLLI(&desc[*seq_size], (ctx_p->drvdata->mlli_sram_addr + - LLI_ENTRY_BYTE_SIZE * - req_ctx->in_mlli_nents), + LLI_ENTRY_BYTE_SIZE * + req_ctx->in_mlli_nents), req_ctx->out_mlli_nents, NS_BIT,(areq == NULL)? 0:1); } if (areq != NULL) { @@ -741,7 +741,7 @@ ssi_blkcipher_create_data_desc( } static int ssi_blkcipher_complete(struct device *dev, - struct ssi_ablkcipher_ctx *ctx_p, + struct ssi_ablkcipher_ctx *ctx_p, struct blkcipher_req_ctx *req_ctx, struct scatterlist *dst, struct scatterlist *src, void *info, //req info @@ -779,7 +779,7 @@ static int ssi_blkcipher_process( unsigned int nbytes, void *info, //req info unsigned int ivsize, - void *areq, + void *areq, enum drv_crypto_direction direction) { struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); @@ -796,7 +796,7 @@ static int ssi_blkcipher_process( CHECK_AND_RETURN_UPON_FIPS_ERROR(); /* STAT_PHASE_0: Init and sanity checks */ START_CYCLE_COUNT(); - + /* TODO: check data length according to mode */ if (unlikely(validate_data_size(ctx_p, nbytes))) { SSI_LOG_ERR("Unsupported data size %d.\n", nbytes); @@ -826,12 +826,12 @@ static int ssi_blkcipher_process( /* Setup request context */ req_ctx->gen_ctx.op_type = direction; - + END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_0); /* STAT_PHASE_1: Map buffers */ START_CYCLE_COUNT(); - + rc = ssi_buffer_mgr_map_blkcipher_request(ctx_p->drvdata, req_ctx, ivsize, nbytes, info, src, dst); if (unlikely(rc != 0)) { SSI_LOG_ERR("map_request() failed\n"); @@ -863,7 +863,7 @@ static int ssi_blkcipher_process( } /* Data processing */ ssi_blkcipher_create_data_desc(tfm, - req_ctx, + req_ctx, dst, src, nbytes, areq, @@ -880,7 +880,7 @@ static int ssi_blkcipher_process( /* STAT_PHASE_3: Lock HW and push sequence */ START_CYCLE_COUNT(); - + rc = send_request(ctx_p->drvdata, &ssi_req, desc, seq_len, (areq == NULL)? 0:1); if(areq != NULL) { if (unlikely(rc != -EINPROGRESS)) { @@ -892,17 +892,17 @@ static int ssi_blkcipher_process( } else { if (rc != 0) { ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); + END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); } else { END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); rc = ssi_blkcipher_complete(dev, ctx_p, req_ctx, dst, src, info, ivsize, NULL, ctx_p->drvdata->cc_base); - } + } } exit_process: if (cts_restore_flag != 0) ctx_p->cipher_mode = DRV_CIPHER_CBC_CTS; - + return rc; } @@ -941,7 +941,7 @@ static int ssi_sblkcipher_init(struct crypto_tfm *tfm) static void ssi_sblkcipher_exit(struct crypto_tfm *tfm) { struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); - + kfree(ctx_p->sync_ctx); SSI_LOG_DEBUG("Free sync ctx buffer in context ctx_p->sync_ctx=@%p\n", ctx_p->sync_ctx); @@ -987,15 +987,15 @@ static int ssi_sblkcipher_decrypt(struct blkcipher_desc *desc, static int ssi_ablkcipher_init(struct crypto_tfm *tfm) { struct ablkcipher_tfm *ablktfm = &tfm->crt_ablkcipher; - + ablktfm->reqsize = sizeof(struct blkcipher_req_ctx); return ssi_blkcipher_init(tfm); } -static int ssi_ablkcipher_setkey(struct crypto_ablkcipher *tfm, - const u8 *key, +static int ssi_ablkcipher_setkey(struct crypto_ablkcipher *tfm, + const u8 *key, unsigned int keylen) { return ssi_blkcipher_setkey(crypto_ablkcipher_tfm(tfm), key, keylen); @@ -1383,7 +1383,7 @@ static struct ssi_alg_template blkcipher_algs[] = { #endif /*SSI_CC_HAS_MULTI2*/ }; -static +static struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct ssi_alg_template *template) { struct ssi_crypto_alg *t_alg; @@ -1405,7 +1405,7 @@ struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct ssi_alg_template *templa alg->cra_blocksize = template->blocksize; alg->cra_alignmask = 0; alg->cra_ctxsize = sizeof(struct ssi_ablkcipher_ctx); - + alg->cra_init = template->synchronous? ssi_sblkcipher_init:ssi_ablkcipher_init; alg->cra_exit = template->synchronous? ssi_sblkcipher_exit:ssi_blkcipher_exit; alg->cra_type = template->synchronous? &crypto_blkcipher_type:&crypto_ablkcipher_type; @@ -1428,7 +1428,7 @@ struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct ssi_alg_template *templa int ssi_ablkcipher_free(struct ssi_drvdata *drvdata) { struct ssi_crypto_alg *t_alg, *n; - struct ssi_blkcipher_handle *blkcipher_handle = + struct ssi_blkcipher_handle *blkcipher_handle = drvdata->blkcipher_handle; struct device *dev; dev = &drvdata->plat_dev->dev; @@ -1489,9 +1489,9 @@ int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata) kfree(t_alg); goto fail0; } else { - list_add_tail(&t_alg->entry, + list_add_tail(&t_alg->entry, &ablkcipher_handle->blkcipher_alg_list); - SSI_LOG_DEBUG("Registered %s\n", + SSI_LOG_DEBUG("Registered %s\n", t_alg->crypto_alg.cra_driver_name); } } diff --git a/drivers/staging/ccree/ssi_cipher.h b/drivers/staging/ccree/ssi_cipher.h index ba4eb7c4893f..ec2d4f4964d0 100644 --- a/drivers/staging/ccree/ssi_cipher.h +++ b/drivers/staging/ccree/ssi_cipher.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -71,7 +71,7 @@ static inline bool ssi_is_hw_key(struct crypto_tfm *tfm) return (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_HW_KEY); } -#else +#else struct arm_hw_key_info { int hw_key1; diff --git a/drivers/staging/ccree/ssi_config.h b/drivers/staging/ccree/ssi_config.h index d96a5436f6d7..431b518d893a 100644 --- a/drivers/staging/ccree/ssi_config.h +++ b/drivers/staging/ccree/ssi_config.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -45,7 +45,7 @@ /* Define the CryptoCell DMA cache coherency signals configuration */ #if defined (DISABLE_COHERENT_DMA_OPS) - /* Software Controlled Cache Coherency (SCCC) */ + /* Software Controlled Cache Coherency (SCCC) */ #define SSI_CACHE_PARAMS (0x000) /* CC attached to NONE-ACP such as HPP/ACE/AMBA4. * The customer is responsible to enable/disable this feature diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index bc19adce6dee..75b9f41d9c50 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -155,11 +155,11 @@ static irqreturn_t cc_isr(int irq, void *dev_id) /* AXI error interrupt */ if (unlikely((irr & SSI_AXI_ERR_IRQ_MASK) != 0)) { uint32_t axi_err; - + /* Read the AXI error ID */ axi_err = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR)); SSI_LOG_DEBUG("AXI completion error: axim_mon_err=0x%08X\n", axi_err); - + irr &= ~SSI_AXI_ERR_IRQ_MASK; } @@ -192,7 +192,7 @@ int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe) /* Unmask relevant interrupt cause */ val = (~(SSI_COMP_IRQ_MASK | SSI_AXI_ERR_IRQ_MASK | SSI_GPR0_IRQ_MASK)); CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), val); - + #ifdef DX_HOST_IRQ_TIMER_INIT_VAL_REG_OFFSET #ifdef DX_IRQ_DELAY /* Set CC IRQ delay */ @@ -266,7 +266,7 @@ static int init_cc_resources(struct platform_device *plat_dev) } SSI_LOG_DEBUG("CC registers mapped from %pa to 0x%p\n", &new_drvdata->res_mem->start, cc_base); new_drvdata->cc_base = cc_base; - + /* Then IRQ */ new_drvdata->res_irq = platform_get_resource(plat_dev, IORESOURCE_IRQ, 0); @@ -396,7 +396,7 @@ static int init_cc_resources(struct platform_device *plat_dev) init_cc_res_err: SSI_LOG_ERR("Freeing CC HW resources!\n"); - + if (new_drvdata != NULL) { ssi_aead_free(new_drvdata); ssi_hash_free(new_drvdata); @@ -410,7 +410,7 @@ init_cc_res_err: #ifdef ENABLE_CC_SYSFS ssi_sysfs_fini(); #endif - + if (req_mem_cc_regs != NULL) { if (irq_registered) { free_irq(new_drvdata->res_irq->start, new_drvdata); @@ -432,7 +432,7 @@ init_cc_res_err: void fini_cc_regs(struct ssi_drvdata *drvdata) { /* Mask all interrupts */ - WRITE_REGISTER(drvdata->cc_base + + WRITE_REGISTER(drvdata->cc_base + CC_REG_OFFSET(HOST_RGF, HOST_IMR), 0xFFFFFFFF); } @@ -505,14 +505,14 @@ static int cc7x_probe(struct platform_device *plat_dev) static int cc7x_remove(struct platform_device *plat_dev) { SSI_LOG_DEBUG("Releasing cc7x resources...\n"); - + cleanup_cc_resources(plat_dev); SSI_LOG(KERN_INFO, "ARM cc7x_ree device terminated\n"); #ifdef ENABLE_CYCLE_COUNT display_all_stat_db(); #endif - + return 0; } #if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 891958b99634..5f1070801d54 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -89,7 +89,7 @@ /* Definitions for HW descriptors DIN/DOUT fields */ #define NS_BIT 1 #define AXI_ID 0 -/* AXI_ID is not actually the AXI ID of the transaction but the value of AXI_ID +/* AXI_ID is not actually the AXI ID of the transaction but the value of AXI_ID field in the HW descriptor. The DMA engine +8 that value. */ /* Logging macros */ @@ -213,7 +213,7 @@ void dump_byte_array(const char *name, const uint8_t *the_array, unsigned long s #define START_CYCLE_COUNT_AT(_var) do { _var = get_cycles(); } while(0) #define END_CYCLE_COUNT_AT(_var, _stat_op_type, _stat_phase) update_host_stat(_stat_op_type, _stat_phase, get_cycles() - _var) #else -#define DECL_CYCLE_COUNT_RESOURCES +#define DECL_CYCLE_COUNT_RESOURCES #define START_CYCLE_COUNT() do { } while (0) #define END_CYCLE_COUNT(_stat_op_type, _stat_phase) do { } while (0) #define GET_START_CYCLE_COUNT() 0 diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index 50f748511979..34e5ddf55073 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -27,8 +27,8 @@ extern int ssi_fips_ext_get_state(ssi_fips_state_t *p_state); extern int ssi_fips_ext_get_error(ssi_fips_error_t *p_err); /* -This function returns the REE FIPS state. -It should be called by kernel module. +This function returns the REE FIPS state. +It should be called by kernel module. */ int ssi_fips_get_state(ssi_fips_state_t *p_state) { @@ -46,8 +46,8 @@ int ssi_fips_get_state(ssi_fips_state_t *p_state) EXPORT_SYMBOL(ssi_fips_get_state); /* -This function returns the REE FIPS error. -It should be called by kernel module. +This function returns the REE FIPS error. +It should be called by kernel module. */ int ssi_fips_get_error(ssi_fips_error_t *p_err) { diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h index 19bcdeb34308..0c50655f7e34 100644 --- a/drivers/staging/ccree/ssi_fips.h +++ b/drivers/staging/ccree/ssi_fips.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -23,7 +23,7 @@ #endif -/*! +/*! @file @brief This file contains FIPS related defintions and APIs. */ diff --git a/drivers/staging/ccree/ssi_fips_data.h b/drivers/staging/ccree/ssi_fips_data.h index 3fddd8f74e07..a4b78f1b4d48 100644 --- a/drivers/staging/ccree/ssi_fips_data.h +++ b/drivers/staging/ccree/ssi_fips_data.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -36,7 +36,7 @@ http://csrc.nist.gov/groups/STM/cavp/documents/aes/XTSTestVectors.zip * AES CMAC http://csrc.nist.gov/groups/STM/cavp/index.html#07 http://csrc.nist.gov/groups/STM/cavp/documents/mac/cmactestvectors.zip - + * AES-CCM http://csrc.nist.gov/groups/STM/cavp/#07 http://csrc.nist.gov/groups/STM/cavp/documents/mac/ccmtestvectors.zip @@ -55,12 +55,12 @@ http://csrc.nist.gov/groups/STM/cavp/documents/des/tdesmct_intermediate.zip * HASH http://csrc.nist.gov/groups/STM/cavp/#03 -http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip - -* HMAC +http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip + +* HMAC http://csrc.nist.gov/groups/STM/cavp/#07 -http://csrc.nist.gov/groups/STM/cavp/documents/mac/hmactestvectors.zip - +http://csrc.nist.gov/groups/STM/cavp/documents/mac/hmactestvectors.zip + */ /* NIST AES */ @@ -86,18 +86,18 @@ http://csrc.nist.gov/groups/STM/cavp/documents/mac/hmactestvectors.zip #define NIST_AES_CBC_IV { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f } #define NIST_AES_128_CBC_CIPHER { 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d } -#define NIST_AES_192_CBC_CIPHER { 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d, 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8 } -#define NIST_AES_256_CBC_CIPHER { 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba, 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6 } +#define NIST_AES_192_CBC_CIPHER { 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d, 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8 } +#define NIST_AES_256_CBC_CIPHER { 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba, 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6 } #define NIST_AES_OFB_IV { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f } #define NIST_AES_128_OFB_CIPHER { 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a } -#define NIST_AES_192_OFB_CIPHER { 0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab, 0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74 } +#define NIST_AES_192_OFB_CIPHER { 0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab, 0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74 } #define NIST_AES_256_OFB_CIPHER { 0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b, 0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60 } #define NIST_AES_CTR_IV { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff } #define NIST_AES_128_CTR_CIPHER { 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, 0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce } -#define NIST_AES_192_CTR_CIPHER { 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b } -#define NIST_AES_256_CTR_CIPHER { 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28 } +#define NIST_AES_192_CTR_CIPHER { 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b } +#define NIST_AES_256_CTR_CIPHER { 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28 } #define RFC3962_AES_128_KEY { 0x63, 0x68, 0x69, 0x63, 0x6b, 0x65, 0x6e, 0x20, 0x74, 0x65, 0x72, 0x69, 0x79, 0x61, 0x6b, 0x69 } @@ -111,8 +111,8 @@ http://csrc.nist.gov/groups/STM/cavp/documents/mac/hmactestvectors.zip 0x09, 0x09, 0x23, 0x02, 0x6e, 0x91, 0x77, 0x18, 0x15, 0xf2, 0x9d, 0xab, 0x01, 0x93, 0x2f, 0x2f } #define NIST_AES_256_XTS_IV { 0x4f, 0xae, 0xf7, 0x11, 0x7c, 0xda, 0x59, 0xc6, 0x6e, 0x4b, 0x92, 0x01, 0x3e, 0x76, 0x8a, 0xd5 } #define NIST_AES_256_XTS_VECTOR_SIZE 16 -#define NIST_AES_256_XTS_PLAIN { 0xeb, 0xab, 0xce, 0x95, 0xb1, 0x4d, 0x3c, 0x8d, 0x6f, 0xb3, 0x50, 0x39, 0x07, 0x90, 0x31, 0x1c } -#define NIST_AES_256_XTS_CIPHER { 0x77, 0x8a, 0xe8, 0xb4, 0x3c, 0xb9, 0x8d, 0x5a, 0x82, 0x50, 0x81, 0xd5, 0xbe, 0x47, 0x1c, 0x63 } +#define NIST_AES_256_XTS_PLAIN { 0xeb, 0xab, 0xce, 0x95, 0xb1, 0x4d, 0x3c, 0x8d, 0x6f, 0xb3, 0x50, 0x39, 0x07, 0x90, 0x31, 0x1c } +#define NIST_AES_256_XTS_CIPHER { 0x77, 0x8a, 0xe8, 0xb4, 0x3c, 0xb9, 0x8d, 0x5a, 0x82, 0x50, 0x81, 0xd5, 0xbe, 0x47, 0x1c, 0x63 } #define NIST_AES_512_XTS_KEY { 0x1e, 0xa6, 0x61, 0xc5, 0x8d, 0x94, 0x3a, 0x0e, 0x48, 0x01, 0xe4, 0x2f, 0x4b, 0x09, 0x47, 0x14, \ 0x9e, 0x7f, 0x9f, 0x8e, 0x3e, 0x68, 0xd0, 0xc7, 0x50, 0x52, 0x10, 0xbd, 0x31, 0x1a, 0x0e, 0x7c, \ @@ -121,9 +121,9 @@ http://csrc.nist.gov/groups/STM/cavp/documents/mac/hmactestvectors.zip #define NIST_AES_512_XTS_IV { 0xad, 0xf8, 0xd9, 0x26, 0x27, 0x46, 0x4a, 0xd2, 0xf0, 0x42, 0x8e, 0x84, 0xa9, 0xf8, 0x75, 0x64, } #define NIST_AES_512_XTS_VECTOR_SIZE 32 #define NIST_AES_512_XTS_PLAIN { 0x2e, 0xed, 0xea, 0x52, 0xcd, 0x82, 0x15, 0xe1, 0xac, 0xc6, 0x47, 0xe8, 0x10, 0xbb, 0xc3, 0x64, \ - 0x2e, 0x87, 0x28, 0x7f, 0x8d, 0x2e, 0x57, 0xe3, 0x6c, 0x0a, 0x24, 0xfb, 0xc1, 0x2a, 0x20, 0x2e } + 0x2e, 0x87, 0x28, 0x7f, 0x8d, 0x2e, 0x57, 0xe3, 0x6c, 0x0a, 0x24, 0xfb, 0xc1, 0x2a, 0x20, 0x2e } #define NIST_AES_512_XTS_CIPHER { 0xcb, 0xaa, 0xd0, 0xe2, 0xf6, 0xce, 0xa3, 0xf5, 0x0b, 0x37, 0xf9, 0x34, 0xd4, 0x6a, 0x9b, 0x13, \ - 0x0b, 0x9d, 0x54, 0xf0, 0x7e, 0x34, 0xf3, 0x6a, 0xf7, 0x93, 0xe8, 0x6f, 0x73, 0xc6, 0xd7, 0xdb } + 0x0b, 0x9d, 0x54, 0xf0, 0x7e, 0x34, 0xf3, 0x6a, 0xf7, 0x93, 0xe8, 0x6f, 0x73, 0xc6, 0xd7, 0xdb } /* NIST AES-CMAC */ diff --git a/drivers/staging/ccree/ssi_fips_ext.c b/drivers/staging/ccree/ssi_fips_ext.c index 2ac432fe1233..291a880f567c 100644 --- a/drivers/staging/ccree/ssi_fips_ext.c +++ b/drivers/staging/ccree/ssi_fips_ext.c @@ -1,21 +1,21 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ /************************************************************** -This file defines the driver FIPS functions that should be +This file defines the driver FIPS functions that should be implemented by the driver user. Current implementation is sample code only. ***************************************************************/ @@ -32,10 +32,10 @@ static ssi_fips_state_t fips_state = CC_FIPS_STATE_NOT_SUPPORTED; static ssi_fips_error_t fips_error = CC_REE_FIPS_ERROR_OK; /* -This function returns the FIPS REE state. +This function returns the FIPS REE state. The function should be implemented by the driver user, depends on where . -the state value is stored. -The reference code uses global variable. +the state value is stored. +The reference code uses global variable. */ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) { @@ -51,10 +51,10 @@ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) } /* -This function returns the FIPS REE error. +This function returns the FIPS REE error. The function should be implemented by the driver user, depends on where . -the error value is stored. -The reference code uses global variable. +the error value is stored. +The reference code uses global variable. */ int ssi_fips_ext_get_error(ssi_fips_error_t *p_err) { @@ -70,10 +70,10 @@ int ssi_fips_ext_get_error(ssi_fips_error_t *p_err) } /* -This function sets the FIPS REE state. +This function sets the FIPS REE state. The function should be implemented by the driver user, depends on where . -the state value is stored. -The reference code uses global variable. +the state value is stored. +The reference code uses global variable. */ int ssi_fips_ext_set_state(ssi_fips_state_t state) { @@ -82,10 +82,10 @@ int ssi_fips_ext_set_state(ssi_fips_state_t state) } /* -This function sets the FIPS REE error. +This function sets the FIPS REE error. The function should be implemented by the driver user, depends on where . -the error value is stored. -The reference code uses global variable. +the error value is stored. +The reference code uses global variable. */ int ssi_fips_ext_set_error(ssi_fips_error_t err) { diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index d573574bbb98..3c7c9dd7fd61 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -30,13 +30,13 @@ that executes the KAT. static const uint32_t digest_len_init[] = { 0x00000040, 0x00000000, 0x00000000, 0x00000000 }; -static const uint32_t sha1_init[] = { +static const uint32_t sha1_init[] = { SHA1_H4, SHA1_H3, SHA1_H2, SHA1_H1, SHA1_H0 }; static const uint32_t sha256_init[] = { SHA256_H7, SHA256_H6, SHA256_H5, SHA256_H4, SHA256_H3, SHA256_H2, SHA256_H1, SHA256_H0 }; #if (CC_SUPPORT_SHA > 256) -static const uint32_t digest_len_sha512_init[] = { +static const uint32_t digest_len_sha512_init[] = { 0x00000080, 0x00000000, 0x00000000, 0x00000000 }; static const uint64_t sha512_init[] = { SHA512_H7, SHA512_H6, SHA512_H5, SHA512_H4, @@ -271,7 +271,7 @@ static const FipsGcmData FipsGcmDataTable[] = { #define FIPS_GCM_NUM_OF_TESTS (sizeof(FipsGcmDataTable) / sizeof(FipsGcmData)) -static inline ssi_fips_error_t +static inline ssi_fips_error_t FIPS_CipherToFipsError(enum drv_cipher_mode mode, bool is_aes) { switch (mode) @@ -296,7 +296,7 @@ FIPS_CipherToFipsError(enum drv_cipher_mode mode, bool is_aes) } -static inline int +static inline int ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, bool is_aes, int cipher_mode, @@ -331,7 +331,7 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direction); HW_DESC_SET_FLOW_MODE(&desc[idx], s_flow_mode); HW_DESC_SET_CIPHER_MODE(&desc[idx], cipher_mode); - if ((cipher_mode == DRV_CIPHER_CTR) || + if ((cipher_mode == DRV_CIPHER_CTR) || (cipher_mode == DRV_CIPHER_OFB) ) { HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); } else { @@ -346,7 +346,7 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direction); if (is_aes) { HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, + key_dma_addr, ((key_len == 24) ? AES_MAX_KEY_SIZE : key_len), NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_len); @@ -376,7 +376,7 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_INIT(&desc[idx]); HW_DESC_SET_CIPHER_MODE(&desc[idx], cipher_mode); HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direction); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (key_dma_addr+key_len/2), key_len/2, NS_BIT); HW_DESC_SET_XEX_DATA_UNIT_SIZE(&desc[idx], data_size); HW_DESC_SET_FLOW_MODE(&desc[idx], s_flow_mode); @@ -481,7 +481,7 @@ ssi_cipher_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffe } -static inline int +static inline int ssi_cmac_fips_run_test(struct ssi_drvdata *drvdata, dma_addr_t key_dma_addr, size_t key_len, @@ -522,19 +522,19 @@ ssi_cmac_fips_run_test(struct ssi_drvdata *drvdata, //ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, false, &idx); HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - din_dma_addr, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + din_dma_addr, din_len, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); idx++; - + /* Get final MAC result */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DOUT_DLLI(&desc[idx], digest_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT, 0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CMAC); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CMAC); idx++; /* perform the operation - Lock HW and push sequence */ @@ -605,7 +605,7 @@ ssi_cmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, } -static inline ssi_fips_error_t +static inline ssi_fips_error_t FIPS_HashToFipsError(enum drv_hash_mode hash_mode) { switch (hash_mode) { @@ -624,7 +624,7 @@ FIPS_HashToFipsError(enum drv_hash_mode hash_mode) return CC_REE_FIPS_ERROR_GENERAL; } -static inline int +static inline int ssi_hash_fips_run_test(struct ssi_drvdata *drvdata, dma_addr_t initial_digest_dma_addr, dma_addr_t din_dma_addr, @@ -779,7 +779,7 @@ ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, } -static inline ssi_fips_error_t +static inline ssi_fips_error_t FIPS_HmacToFipsError(enum drv_hash_mode hash_mode) { switch (hash_mode) { @@ -798,7 +798,7 @@ FIPS_HmacToFipsError(enum drv_hash_mode hash_mode) return CC_REE_FIPS_ERROR_GENERAL; } -static inline int +static inline int ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, dma_addr_t initial_digest_dma_addr, dma_addr_t key_dma_addr, @@ -841,7 +841,7 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0, (block_size - key_size)); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], (k0_dma_addr + key_size), (block_size - key_size), NS_BIT, 0); idx++; @@ -917,7 +917,7 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, /* data descriptor */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, din_dma_addr, data_in_size, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); @@ -1112,7 +1112,7 @@ ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, } -static inline int +static inline int ssi_ccm_fips_run_test(struct ssi_drvdata *drvdata, enum drv_crypto_direction direction, dma_addr_t key_dma_addr, @@ -1160,7 +1160,7 @@ ssi_ccm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, iv_dma_addr, AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); idx++; @@ -1183,7 +1183,7 @@ ssi_ccm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); @@ -1235,7 +1235,7 @@ ssi_ccm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, NS_BIT); HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, NS_BIT, 0); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - idx++; + idx++; /* perform the operation - Lock HW and push sequence */ BUG_ON(idx > FIPS_CCM_MAX_SEQ_LEN); @@ -1373,12 +1373,12 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, ///////////////////////////////// 1 //////////////////////////////////// /* load key to AES*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); + HW_DESC_INIT(&desc[idx]); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, key_dma_addr, key_size, - NS_BIT); + NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); @@ -1389,7 +1389,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_DIN_CONST(&desc[idx], 0x0, AES_BLOCK_SIZE); HW_DESC_SET_DOUT_DLLI(&desc[idx], hkey_dma_addr, AES_BLOCK_SIZE, - NS_BIT, 0); + NS_BIT, 0); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); idx++; @@ -1407,8 +1407,8 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); + HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); idx++; @@ -1420,10 +1420,10 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); HW_DESC_SET_CIPHER_DO(&desc[idx], 1); //1=AES_SK RKEK HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); + HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); idx++; @@ -1434,7 +1434,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); + HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); idx++; @@ -1447,7 +1447,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, ///////////////////////////////// 2 //////////////////////////////////// HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, adata_dma_addr, adata_size, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); @@ -1459,12 +1459,12 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, ///////////////////////////////// 3 //////////////////////////////////// /* load key to AES*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); + HW_DESC_INIT(&desc[idx]); + HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, key_dma_addr, key_size, - NS_BIT); + NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); @@ -1477,7 +1477,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, iv_inc2_dma_addr, AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); idx++; @@ -1486,7 +1486,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, ///////////////////////////////// 4 //////////////////////////////////// /* process(gctr+ghash) */ // if (req_ctx->cryptlen != 0) -// ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, seq_size); +// ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, seq_size); ///////////////////////////////// 4 //////////////////////////////////// HW_DESC_INIT(&desc[idx]); @@ -1506,7 +1506,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, /* prcess(ghash) gcm_block_len */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, block_len_dma_addr, AES_BLOCK_SIZE, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); @@ -1522,7 +1522,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - idx++; + idx++; /* load AES/CTR initial CTR value inc by 1*/ HW_DESC_INIT(&desc[idx]); @@ -1531,7 +1531,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, iv_inc1_dma_addr, AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); idx++; diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index 51b535a2a09a..8f5df925e295 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -74,12 +74,12 @@ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) regVal = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, GPR_HOST)); if (regVal == (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)) { return CC_REE_FIPS_ERROR_OK; - } + } return CC_REE_FIPS_ERROR_FROM_TEE; } -/* +/* This function should push the FIPS REE library status towards the TEE library. By writing the error state to HOST_GPR0 register. The function is called from . driver entry point so no need to protect by mutex. @@ -119,7 +119,7 @@ void ssi_fips_fini(struct ssi_drvdata *drvdata) void fips_handler(struct ssi_drvdata *drvdata) { - struct ssi_fips_handle *fips_handle_ptr = + struct ssi_fips_handle *fips_handle_ptr = drvdata->fips_handle; #ifdef COMP_IN_WQ queue_delayed_work(fips_handle_ptr->workq, &fips_handle_ptr->fipswork, 0); @@ -154,11 +154,11 @@ static void fips_dsr(unsigned long devarg) teeFipsError = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, GPR_HOST)); if (teeFipsError != (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)) { ssi_fips_set_error(drvdata, CC_REE_FIPS_ERROR_FROM_TEE); - } + } } /* after verifing that there is nothing to do, Unmask AXI completion interrupt */ - CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), + CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), CC_HAL_READ_REGISTER( CC_REG_OFFSET(HOST_RGF, HOST_IMR)) & ~irq); } @@ -231,11 +231,11 @@ ssi_fips_error_t cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) -/* The function checks if FIPS supported and FIPS error exists.* +/* The function checks if FIPS supported and FIPS error exists.* * It should be used in every driver API.*/ int ssi_fips_check_fips_error(void) { - ssi_fips_state_t fips_state; + ssi_fips_state_t fips_state; if (ssi_fips_get_state(&fips_state) != 0) { FIPS_LOG("ssi_fips_get_state FAILED, returning.. \n"); @@ -249,14 +249,14 @@ int ssi_fips_check_fips_error(void) } -/* The function sets the REE FIPS state.* +/* The function sets the REE FIPS state.* * It should be used while driver is being loaded .*/ int ssi_fips_set_state(ssi_fips_state_t state) { return ssi_fips_ext_set_state(state); } -/* The function sets the REE FIPS error, and pushes the error to TEE library. * +/* The function sets the REE FIPS error, and pushes the error to TEE library. * * It should be used when any of the KAT tests fails .*/ int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err) { @@ -268,7 +268,7 @@ int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err) // setting no error is not allowed if (err == CC_REE_FIPS_ERROR_OK) { return -ENOEXEC; - } + } // If error exists, do not set new error if (ssi_fips_get_error(¤t_err) != 0) { return -ENOEXEC; diff --git a/drivers/staging/ccree/ssi_fips_local.h b/drivers/staging/ccree/ssi_fips_local.h index 65997c15a20e..e189b425d7f9 100644 --- a/drivers/staging/ccree/ssi_fips_local.h +++ b/drivers/staging/ccree/ssi_fips_local.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index f99d4219b01e..69c1df2aa2e7 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -44,18 +44,18 @@ struct ssi_hash_handle { static const uint32_t digest_len_init[] = { 0x00000040, 0x00000000, 0x00000000, 0x00000000 }; -static const uint32_t md5_init[] = { +static const uint32_t md5_init[] = { SHA1_H3, SHA1_H2, SHA1_H1, SHA1_H0 }; -static const uint32_t sha1_init[] = { +static const uint32_t sha1_init[] = { SHA1_H4, SHA1_H3, SHA1_H2, SHA1_H1, SHA1_H0 }; -static const uint32_t sha224_init[] = { +static const uint32_t sha224_init[] = { SHA224_H7, SHA224_H6, SHA224_H5, SHA224_H4, SHA224_H3, SHA224_H2, SHA224_H1, SHA224_H0 }; static const uint32_t sha256_init[] = { SHA256_H7, SHA256_H6, SHA256_H5, SHA256_H4, SHA256_H3, SHA256_H2, SHA256_H1, SHA256_H0 }; #if (DX_DEV_SHA_MAX > 256) -static const uint32_t digest_len_sha512_init[] = { +static const uint32_t digest_len_sha512_init[] = { 0x00000080, 0x00000000, 0x00000000, 0x00000000 }; static const uint64_t sha384_init[] = { SHA384_H7, SHA384_H6, SHA384_H5, SHA384_H4, @@ -66,11 +66,11 @@ static const uint64_t sha512_init[] = { #endif static void ssi_hash_create_xcbc_setup( - struct ahash_request *areq, + struct ahash_request *areq, HwDesc_s desc[], unsigned int *seq_size); -static void ssi_hash_create_cmac_setup(struct ahash_request *areq, +static void ssi_hash_create_cmac_setup(struct ahash_request *areq, HwDesc_s desc[], unsigned int *seq_size); @@ -96,7 +96,7 @@ struct hash_key_req_ctx { /* hash per-session context */ struct ssi_hash_ctx { struct ssi_drvdata *drvdata; - /* holds the origin digest; the digest after "setkey" if HMAC,* + /* holds the origin digest; the digest after "setkey" if HMAC,* the initial digest if HASH. */ uint8_t digest_buff[SSI_MAX_HASH_DIGEST_SIZE] ____cacheline_aligned; uint8_t opad_tmp_keys_buff[SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE] ____cacheline_aligned; @@ -115,7 +115,7 @@ static const struct crypto_type crypto_shash_type; static void ssi_hash_create_data_desc( struct ahash_req_ctx *areq_ctx, - struct ssi_hash_ctx *ctx, + struct ssi_hash_ctx *ctx, unsigned int flow_mode,HwDesc_s desc[], bool is_not_last_data, unsigned int *seq_size); @@ -131,11 +131,11 @@ static inline void ssi_set_hash_endianity(uint32_t mode, HwDesc_s *desc) } } -static int ssi_hash_map_result(struct device *dev, - struct ahash_req_ctx *state, +static int ssi_hash_map_result(struct device *dev, + struct ahash_req_ctx *state, unsigned int digestsize) { - state->digest_result_dma_addr = + state->digest_result_dma_addr = dma_map_single(dev, (void *)state->digest_result_buff, digestsize, DMA_BIDIRECTIONAL); @@ -154,8 +154,8 @@ static int ssi_hash_map_result(struct device *dev, return 0; } -static int ssi_hash_map_request(struct device *dev, - struct ahash_req_ctx *state, +static int ssi_hash_map_request(struct device *dev, + struct ahash_req_ctx *state, struct ssi_hash_ctx *ctx) { bool is_hmac = ctx->is_hmac; @@ -211,7 +211,7 @@ static int ssi_hash_map_request(struct device *dev, ctx->inter_digestsize, state->digest_buff); goto fail3; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr, + SSI_UPDATE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr, ctx->inter_digestsize); SSI_LOG_DEBUG("Mapped digest %d B at va=%pK to dma=0x%llX\n", ctx->inter_digestsize, state->digest_buff, @@ -220,7 +220,7 @@ static int ssi_hash_map_request(struct device *dev, if (is_hmac) { SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->digest_buff_dma_addr); dma_sync_single_for_cpu(dev, ctx->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->digest_buff_dma_addr, + SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->digest_buff_dma_addr, ctx->inter_digestsize); if ((ctx->hw_mode == DRV_CIPHER_XCBC_MAC) || (ctx->hw_mode == DRV_CIPHER_CMAC)) { memset(state->digest_buff, 0, ctx->inter_digestsize); @@ -238,16 +238,16 @@ static int ssi_hash_map_request(struct device *dev, } SSI_RESTORE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr); dma_sync_single_for_device(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); - SSI_UPDATE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr, + SSI_UPDATE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr, ctx->inter_digestsize); if (ctx->hash_mode != DRV_HASH_NULL) { SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr); dma_sync_single_for_cpu(dev, ctx->opad_tmp_keys_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); memcpy(state->opad_digest_buff, ctx->opad_tmp_keys_buff, ctx->inter_digestsize); - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr, + SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr, ctx->inter_digestsize); - } + } } else { /*hash*/ /* Copy the initial digests if hash flow. The SRAM contains the initial digests in the expected order for all SHA* */ @@ -338,8 +338,8 @@ fail0: return rc; } -static void ssi_hash_unmap_request(struct device *dev, - struct ahash_req_ctx *state, +static void ssi_hash_unmap_request(struct device *dev, + struct ahash_req_ctx *state, struct ssi_hash_ctx *ctx) { if (state->digest_buff_dma_addr != 0) { @@ -375,8 +375,8 @@ static void ssi_hash_unmap_request(struct device *dev, kfree(state->buff0); } -static void ssi_hash_unmap_result(struct device *dev, - struct ahash_req_ctx *state, +static void ssi_hash_unmap_result(struct device *dev, + struct ahash_req_ctx *state, unsigned int digestsize, u8 *result) { if (state->digest_result_dma_addr != 0) { @@ -384,10 +384,10 @@ static void ssi_hash_unmap_result(struct device *dev, dma_unmap_single(dev, state->digest_result_dma_addr, digestsize, - DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("unmpa digest result buffer " "va (%pK) pa (%llx) len %u\n", - state->digest_result_buff, + state->digest_result_buff, (unsigned long long)state->digest_result_dma_addr, digestsize); memcpy(result, @@ -415,7 +415,7 @@ static void ssi_hash_digest_complete(struct device *dev, void *ssi_req, void __i struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); uint32_t digestsize = crypto_ahash_digestsize(tfm); - + SSI_LOG_DEBUG("req=%pK\n", req); ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, false); @@ -431,7 +431,7 @@ static void ssi_hash_complete(struct device *dev, void *ssi_req, void __iomem *c struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); uint32_t digestsize = crypto_ahash_digestsize(tfm); - + SSI_LOG_DEBUG("req=%pK\n", req); ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, false); @@ -440,11 +440,11 @@ static void ssi_hash_complete(struct device *dev, void *ssi_req, void __iomem *c req->base.complete(&req->base, 0); } -static int ssi_hash_digest(struct ahash_req_ctx *state, - struct ssi_hash_ctx *ctx, - unsigned int digestsize, - struct scatterlist *src, - unsigned int nbytes, u8 *result, +static int ssi_hash_digest(struct ahash_req_ctx *state, + struct ssi_hash_ctx *ctx, + unsigned int digestsize, + struct scatterlist *src, + unsigned int nbytes, u8 *result, void *async_req) { struct device *dev = &ctx->drvdata->plat_dev->dev; @@ -568,7 +568,7 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, /* Get final MAC result */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, async_req? 1:0); /*TODO*/ if (async_req) { HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); @@ -593,7 +593,7 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc); ssi_buffer_mgr_unmap_hash_request(dev, state, src, true); } else { - ssi_buffer_mgr_unmap_hash_request(dev, state, src, false); + ssi_buffer_mgr_unmap_hash_request(dev, state, src, false); } ssi_hash_unmap_result(dev, state, digestsize, result); ssi_hash_unmap_request(dev, state, ctx); @@ -601,11 +601,11 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, return rc; } -static int ssi_hash_update(struct ahash_req_ctx *state, - struct ssi_hash_ctx *ctx, - unsigned int block_size, - struct scatterlist *src, - unsigned int nbytes, +static int ssi_hash_update(struct ahash_req_ctx *state, + struct ssi_hash_ctx *ctx, + unsigned int block_size, + struct scatterlist *src, + unsigned int nbytes, void *async_req) { struct device *dev = &ctx->drvdata->plat_dev->dev; @@ -697,12 +697,12 @@ static int ssi_hash_update(struct ahash_req_ctx *state, return rc; } -static int ssi_hash_finup(struct ahash_req_ctx *state, - struct ssi_hash_ctx *ctx, - unsigned int digestsize, - struct scatterlist *src, - unsigned int nbytes, - u8 *result, +static int ssi_hash_finup(struct ahash_req_ctx *state, + struct ssi_hash_ctx *ctx, + unsigned int digestsize, + struct scatterlist *src, + unsigned int nbytes, + u8 *result, void *async_req) { struct device *dev = &ctx->drvdata->plat_dev->dev; @@ -803,7 +803,7 @@ static int ssi_hash_finup(struct ahash_req_ctx *state, HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); idx++; if (async_req) { @@ -828,12 +828,12 @@ static int ssi_hash_finup(struct ahash_req_ctx *state, return rc; } -static int ssi_hash_final(struct ahash_req_ctx *state, - struct ssi_hash_ctx *ctx, - unsigned int digestsize, - struct scatterlist *src, - unsigned int nbytes, - u8 *result, +static int ssi_hash_final(struct ahash_req_ctx *state, + struct ssi_hash_ctx *ctx, + unsigned int digestsize, + struct scatterlist *src, + unsigned int nbytes, + u8 *result, void *async_req) { struct device *dev = &ctx->drvdata->plat_dev->dev; @@ -972,7 +972,7 @@ static int ssi_hash_final(struct ahash_req_ctx *state, static int ssi_hash_init(struct ahash_req_ctx *state, struct ssi_hash_ctx *ctx) { struct device *dev = &ctx->drvdata->plat_dev->dev; - state->xcbc_count = 0; + state->xcbc_count = 0; CHECK_AND_RETURN_UPON_FIPS_ERROR(); ssi_hash_map_request(dev, state, ctx); @@ -997,8 +997,8 @@ static int ssi_hash_import(struct ssi_hash_ctx *ctx, const void *in) #endif static int ssi_hash_setkey(void *hash, - const u8 *key, - unsigned int keylen, + const u8 *key, + unsigned int keylen, bool synchronize) { unsigned int hmacPadConst[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST }; @@ -1011,7 +1011,7 @@ static int ssi_hash_setkey(void *hash, ssi_sram_addr_t larval_addr; SSI_LOG_DEBUG("ssi_hash_setkey: start keylen: %d", keylen); - + CHECK_AND_RETURN_UPON_FIPS_ERROR(); if (synchronize) { ctx = crypto_shash_ctx(((struct crypto_shash *)hash)); @@ -1022,7 +1022,7 @@ static int ssi_hash_setkey(void *hash, blocksize = crypto_tfm_alg_blocksize(&((struct crypto_ahash *)hash)->base); digestsize = crypto_ahash_digestsize(((struct crypto_ahash *)hash)); } - + larval_addr = ssi_ahash_get_larval_digest_sram_addr( ctx->drvdata, ctx->hash_mode); @@ -1058,7 +1058,7 @@ static int ssi_hash_setkey(void *hash, HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); idx++; - + /* Load the hash current length*/ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); @@ -1067,17 +1067,17 @@ static int ssi_hash_setkey(void *hash, HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); idx++; - + HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctx->key_params.key_dma_addr, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + ctx->key_params.key_dma_addr, keylen, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); idx++; - + /* Get hashed key */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); HW_DESC_SET_DOUT_DLLI(&desc[idx], ctx->opad_tmp_keys_dma_addr, digestsize, NS_BIT, 0); HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); @@ -1085,19 +1085,19 @@ static int ssi_hash_setkey(void *hash, HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); idx++; - + HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0, (blocksize - digestsize)); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + digestsize), (blocksize - digestsize), NS_BIT, 0); idx++; } else { HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctx->key_params.key_dma_addr, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + ctx->key_params.key_dma_addr, keylen, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); HW_DESC_SET_DOUT_DLLI(&desc[idx], @@ -1109,7 +1109,7 @@ static int ssi_hash_setkey(void *hash, HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0, (blocksize - keylen)); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + keylen), (blocksize - keylen), NS_BIT, 0); @@ -1120,7 +1120,7 @@ static int ssi_hash_setkey(void *hash, HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0, blocksize); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], + HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr), blocksize, NS_BIT, 0); @@ -1249,7 +1249,7 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, "keylen=%u\n", (unsigned long long)ctx->key_params.key_dma_addr, ctx->key_params.keylen); - + ctx->is_hmac = true; /* 1. Load the AES key */ HW_DESC_INIT(&desc[idx]); @@ -1264,23 +1264,23 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0x01010101, CC_AES_128_BIT_KEY_SIZE); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + - XCBC_MAC_K1_OFFSET), + HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + + XCBC_MAC_K1_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT, 0); idx++; HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0x02020202, CC_AES_128_BIT_KEY_SIZE); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + - XCBC_MAC_K2_OFFSET), + HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + + XCBC_MAC_K2_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT, 0); idx++; HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_CONST(&desc[idx], 0x03030303, CC_AES_128_BIT_KEY_SIZE); HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + + HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + XCBC_MAC_K3_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT, 0); idx++; @@ -1324,23 +1324,23 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, /* STAT_PHASE_1: Copy key to ctx */ START_CYCLE_COUNT(); - + SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr); dma_sync_single_for_cpu(&ctx->drvdata->plat_dev->dev, - ctx->opad_tmp_keys_dma_addr, + ctx->opad_tmp_keys_dma_addr, keylen, DMA_TO_DEVICE); memcpy(ctx->opad_tmp_keys_buff, key, keylen); if (keylen == 24) memset(ctx->opad_tmp_keys_buff + 24, 0, CC_AES_KEY_SIZE_MAX - 24); - + dma_sync_single_for_device(&ctx->drvdata->plat_dev->dev, - ctx->opad_tmp_keys_dma_addr, + ctx->opad_tmp_keys_dma_addr, keylen, DMA_TO_DEVICE); SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr, keylen); - + ctx->key_params.keylen = keylen; - + END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_1); return 0; @@ -1416,13 +1416,13 @@ fail: } static int ssi_shash_cra_init(struct crypto_tfm *tfm) -{ +{ struct ssi_hash_ctx *ctx = crypto_tfm_ctx(tfm); - struct shash_alg * shash_alg = + struct shash_alg * shash_alg = container_of(tfm->__crt_alg, struct shash_alg, base); struct ssi_hash_alg *ssi_alg = container_of(shash_alg, struct ssi_hash_alg, shash_alg); - + CHECK_AND_RETURN_UPON_FIPS_ERROR(); ctx->hash_mode = ssi_alg->hash_mode; ctx->hw_mode = ssi_alg->hw_mode; @@ -1435,9 +1435,9 @@ static int ssi_shash_cra_init(struct crypto_tfm *tfm) static int ssi_ahash_cra_init(struct crypto_tfm *tfm) { struct ssi_hash_ctx *ctx = crypto_tfm_ctx(tfm); - struct hash_alg_common * hash_alg_common = + struct hash_alg_common * hash_alg_common = container_of(tfm->__crt_alg, struct hash_alg_common, base); - struct ahash_alg *ahash_alg = + struct ahash_alg *ahash_alg = container_of(hash_alg_common, struct ahash_alg, halg); struct ssi_hash_alg *ssi_alg = container_of(ahash_alg, struct ssi_hash_alg, ahash_alg); @@ -1499,7 +1499,7 @@ static int ssi_mac_update(struct ahash_request *req) } else { ssi_hash_create_cmac_setup(req, desc, &idx); } - + ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, true, &idx); /* store the hash digest result in context */ @@ -1541,7 +1541,7 @@ static int ssi_mac_final(struct ahash_request *req) uint32_t rem_cnt = state->buff_index ? state->buff1_cnt : state->buff0_cnt; - + CHECK_AND_RETURN_UPON_FIPS_ERROR(); if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { @@ -1576,8 +1576,8 @@ static int ssi_mac_final(struct ahash_request *req) HW_DESC_INIT(&desc[idx]); HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_DECRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (ctx->opad_tmp_keys_dma_addr + + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + (ctx->opad_tmp_keys_dma_addr + XCBC_MAC_K1_OFFSET), keySize, NS_BIT); HW_DESC_SET_KEY_SIZE_AES(&desc[idx], keyLen); @@ -1599,7 +1599,7 @@ static int ssi_mac_final(struct ahash_request *req) HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); idx++; } - + if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { ssi_hash_create_xcbc_setup(req, desc, &idx); } else { @@ -1621,14 +1621,14 @@ static int ssi_mac_final(struct ahash_request *req) HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); idx++; } - + /* Get final MAC result */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, 1); /*TODO*/ HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); idx++; rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1); @@ -1659,7 +1659,7 @@ static int ssi_mac_finup(struct ahash_request *req) SSI_LOG_DEBUG("No data to update. Call to fdx_mac_final \n"); return ssi_mac_final(req); } - + if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, req->src, req->nbytes, 1) != 0)) { SSI_LOG_ERR("map_ahash_request_final() failed\n"); return -ENOMEM; @@ -1694,14 +1694,14 @@ static int ssi_mac_finup(struct ahash_request *req) } else { ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, false, &idx); } - + /* Get final MAC result */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, 1); /*TODO*/ HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); idx++; rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1); @@ -1728,7 +1728,7 @@ static int ssi_mac_digest(struct ahash_request *req) SSI_LOG_DEBUG("===== -digest mac (%d) ====\n", req->nbytes); CHECK_AND_RETURN_UPON_FIPS_ERROR(); - + if (unlikely(ssi_hash_map_request(dev, state, ctx) != 0)) { SSI_LOG_ERR("map_ahash_source() failed\n"); return -ENOMEM; @@ -1742,7 +1742,7 @@ static int ssi_mac_digest(struct ahash_request *req) SSI_LOG_ERR("map_ahash_request_final() failed\n"); return -ENOMEM; } - + /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_digest_complete; ssi_req.user_arg = (void *)req; @@ -1750,7 +1750,7 @@ static int ssi_mac_digest(struct ahash_request *req) ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ #endif - + if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { keyLen = CC_AES_128_BIT_KEY_SIZE; ssi_hash_create_xcbc_setup(req, desc, &idx); @@ -1769,7 +1769,7 @@ static int ssi_mac_digest(struct ahash_request *req) } else { ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, false, &idx); } - + /* Get final MAC result */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT,1); @@ -1777,7 +1777,7 @@ static int ssi_mac_digest(struct ahash_request *req) HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); HW_DESC_SET_CIPHER_CONFIG0(&desc[idx],DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); idx++; rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1); @@ -1792,7 +1792,7 @@ static int ssi_mac_digest(struct ahash_request *req) //shash wrap functions #ifdef SYNC_ALGS -static int ssi_shash_digest(struct shash_desc *desc, +static int ssi_shash_digest(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { struct ahash_req_ctx *state = shash_desc_ctx(desc); @@ -1804,14 +1804,14 @@ static int ssi_shash_digest(struct shash_desc *desc, if (len == 0) { return ssi_hash_digest(state, ctx, digestsize, NULL, 0, out, NULL); } - + /* sg_init_one may crash when len is 0 (depends on kernel configuration) */ sg_init_one(&src, (const void *)data, len); - + return ssi_hash_digest(state, ctx, digestsize, &src, len, out, NULL); } -static int ssi_shash_update(struct shash_desc *desc, +static int ssi_shash_update(struct shash_desc *desc, const u8 *data, unsigned int len) { struct ahash_req_ctx *state = shash_desc_ctx(desc); @@ -1821,11 +1821,11 @@ static int ssi_shash_update(struct shash_desc *desc, struct scatterlist src; sg_init_one(&src, (const void *)data, len); - + return ssi_hash_update(state, ctx, blocksize, &src, len, NULL); } -static int ssi_shash_finup(struct shash_desc *desc, +static int ssi_shash_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { struct ahash_req_ctx *state = shash_desc_ctx(desc); @@ -1833,9 +1833,9 @@ static int ssi_shash_finup(struct shash_desc *desc, struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); uint32_t digestsize = crypto_shash_digestsize(tfm); struct scatterlist src; - + sg_init_one(&src, (const void *)data, len); - + return ssi_hash_finup(state, ctx, digestsize, &src, len, out, NULL); } @@ -1845,7 +1845,7 @@ static int ssi_shash_final(struct shash_desc *desc, u8 *out) struct crypto_shash *tfm = desc->tfm; struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); uint32_t digestsize = crypto_shash_digestsize(tfm); - + return ssi_hash_final(state, ctx, digestsize, NULL, 0, out, NULL); } @@ -1871,12 +1871,12 @@ static int ssi_shash_import(struct shash_desc *desc, const void *in) { struct crypto_shash *tfm = desc->tfm; struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - + return ssi_hash_import(ctx, in); } #endif -static int ssi_shash_setkey(struct crypto_shash *tfm, +static int ssi_shash_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { return ssi_hash_setkey((void *) tfm, key, keylen, true); @@ -1891,7 +1891,7 @@ static int ssi_ahash_digest(struct ahash_request *req) struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); uint32_t digestsize = crypto_ahash_digestsize(tfm); - + return ssi_hash_digest(state, ctx, digestsize, req->src, req->nbytes, req->result, (void *)req); } @@ -1901,7 +1901,7 @@ static int ssi_ahash_update(struct ahash_request *req) struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); unsigned int block_size = crypto_tfm_alg_blocksize(&tfm->base); - + return ssi_hash_update(state, ctx, block_size, req->src, req->nbytes, (void *)req); } @@ -1911,7 +1911,7 @@ static int ssi_ahash_finup(struct ahash_request *req) struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); uint32_t digestsize = crypto_ahash_digestsize(tfm); - + return ssi_hash_finup(state, ctx, digestsize, req->src, req->nbytes, req->result, (void *)req); } @@ -1921,7 +1921,7 @@ static int ssi_ahash_final(struct ahash_request *req) struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); uint32_t digestsize = crypto_ahash_digestsize(tfm); - + return ssi_hash_final(state, ctx, digestsize, req->src, req->nbytes, req->result, (void *)req); } @@ -1929,7 +1929,7 @@ static int ssi_ahash_init(struct ahash_request *req) { struct ahash_req_ctx *state = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); - struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); + struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); SSI_LOG_DEBUG("===== init (%d) ====\n", req->nbytes); @@ -1941,7 +1941,7 @@ static int ssi_ahash_export(struct ahash_request *req, void *out) { struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash); - + return ssi_hash_export(ctx, out); } @@ -1949,14 +1949,14 @@ static int ssi_ahash_import(struct ahash_request *req, const void *in) { struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash); - + return ssi_hash_import(ctx, in); } #endif static int ssi_ahash_setkey(struct crypto_ahash *ahash, const u8 *key, unsigned int keylen) -{ +{ return ssi_hash_setkey((void *) ahash, key, keylen, false); } @@ -1970,7 +1970,7 @@ struct ssi_hash_template { union { struct ahash_alg template_ahash; struct shash_alg template_shash; - }; + }; int hash_mode; int hw_mode; int inter_digestsize; @@ -2212,7 +2212,7 @@ static struct ssi_hash_template driver_hash[] = { .inter_digestsize = AES_BLOCK_SIZE, }, #endif - + }; static struct ssi_hash_alg * @@ -2259,9 +2259,9 @@ ssi_hash_create_alg(struct ssi_hash_template *template, bool keyed) alg->cra_blocksize = template->blocksize; alg->cra_alignmask = 0; alg->cra_exit = ssi_hash_cra_exit; - + if (template->synchronize) { - alg->cra_init = ssi_shash_cra_init; + alg->cra_init = ssi_shash_cra_init; alg->cra_flags = CRYPTO_ALG_TYPE_SHASH | CRYPTO_ALG_KERN_DRIVER_ONLY; alg->cra_type = &crypto_shash_type; @@ -2418,7 +2418,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) sizeof(sha1_init) + sizeof(sha224_init) + sizeof(sha256_init); - + sram_buff = ssi_sram_mgr_alloc(drvdata, sram_size_to_alloc); if (sram_buff == NULL_SRAM_ADDR) { SSI_LOG_ERR("SRAM pool exhausted\n"); @@ -2441,7 +2441,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) /* ahash registration */ for (alg = 0; alg < ARRAY_SIZE(driver_hash); alg++) { struct ssi_hash_alg *t_alg; - + /* register hmac version */ if ((((struct ssi_hash_template)driver_hash[alg]).hw_mode != DRV_CIPHER_XCBC_MAC) && @@ -2454,7 +2454,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) goto fail; } t_alg->drvdata = drvdata; - + if (t_alg->synchronize) { rc = crypto_register_shash(&t_alg->shash_alg); if (unlikely(rc != 0)) { @@ -2485,7 +2485,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) goto fail; } t_alg->drvdata = drvdata; - + if (t_alg->synchronize) { rc = crypto_register_shash(&t_alg->shash_alg); if (unlikely(rc != 0)) { @@ -2494,8 +2494,8 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) kfree(t_alg); goto fail; } else - list_add_tail(&t_alg->entry, &hash_handle->hash_list); - + list_add_tail(&t_alg->entry, &hash_handle->hash_list); + } else { rc = crypto_register_ahash(&t_alg->ahash_alg); if (unlikely(rc != 0)) { @@ -2535,14 +2535,14 @@ int ssi_hash_free(struct ssi_drvdata *drvdata) list_del(&t_hash_alg->entry); kfree(t_hash_alg); } - + kfree(hash_handle); drvdata->hash_handle = NULL; } return 0; } -static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, +static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, HwDesc_s desc[], unsigned int *seq_size) { unsigned int idx = *seq_size; @@ -2552,7 +2552,7 @@ static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, /* Setup XCBC MAC K1 */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + XCBC_MAC_K1_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); @@ -2564,7 +2564,7 @@ static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, /* Setup XCBC MAC K2 */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + XCBC_MAC_K2_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); @@ -2576,7 +2576,7 @@ static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, /* Setup XCBC MAC K3 */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + XCBC_MAC_K3_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT); HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE2); @@ -2598,7 +2598,7 @@ static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, *seq_size = idx; } -static void ssi_hash_create_cmac_setup(struct ahash_request *areq, +static void ssi_hash_create_cmac_setup(struct ahash_request *areq, HwDesc_s desc[], unsigned int *seq_size) { @@ -2634,15 +2634,15 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, struct ssi_hash_ctx *ctx, unsigned int flow_mode, HwDesc_s desc[], - bool is_not_last_data, + bool is_not_last_data, unsigned int *seq_size) { unsigned int idx = *seq_size; if (likely(areq_ctx->data_dma_buf_type == SSI_DMA_BUF_DLLI)) { HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - sg_dma_address(areq_ctx->curr_sg), + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + sg_dma_address(areq_ctx->curr_sg), areq_ctx->curr_sg->length, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); idx++; @@ -2654,19 +2654,19 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, } /* bypass */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - areq_ctx->mlli_params.mlli_dma_addr, - areq_ctx->mlli_params.mlli_len, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, + areq_ctx->mlli_params.mlli_dma_addr, + areq_ctx->mlli_params.mlli_len, NS_BIT); - HW_DESC_SET_DOUT_SRAM(&desc[idx], - ctx->drvdata->mlli_sram_addr, + HW_DESC_SET_DOUT_SRAM(&desc[idx], + ctx->drvdata->mlli_sram_addr, areq_ctx->mlli_params.mlli_len); HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); idx++; /* process */ HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_MLLI, - ctx->drvdata->mlli_sram_addr, + HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_MLLI, + ctx->drvdata->mlli_sram_addr, areq_ctx->mlli_nents, NS_BIT); HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); @@ -2680,12 +2680,12 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, } /*! - * Gets the address of the initial digest in SRAM + * Gets the address of the initial digest in SRAM * according to the given hash mode - * + * * \param drvdata * \param mode The Hash mode. Supported modes: MD5/SHA1/SHA224/SHA256 - * + * * \return uint32_t The address of the inital digest in SRAM */ ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, uint32_t mode) diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index a2b076d3af72..b5bf67721fba 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -68,7 +68,7 @@ struct ahash_req_ctx { struct scatterlist *curr_sg; uint32_t in_nents; uint32_t mlli_nents; - struct mlli_params mlli_params; + struct mlli_params mlli_params; }; int ssi_hash_alloc(struct ssi_drvdata *drvdata); @@ -77,22 +77,22 @@ int ssi_hash_free(struct ssi_drvdata *drvdata); /*! * Gets the initial digest length - * - * \param drvdata + * + * \param drvdata * \param mode The Hash mode. Supported modes: MD5/SHA1/SHA224/SHA256/SHA384/SHA512 - * + * * \return uint32_t returns the address of the initial digest length in SRAM */ ssi_sram_addr_t ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, uint32_t mode); /*! - * Gets the address of the initial digest in SRAM + * Gets the address of the initial digest in SRAM * according to the given hash mode - * - * \param drvdata + * + * \param drvdata * \param mode The Hash mode. Supported modes: MD5/SHA1/SHA224/SHA256/SHA384/SHA512 - * + * * \return uint32_t The address of the inital digest in SRAM */ ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, uint32_t mode); diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index f16f4692f404..a760fafd1a43 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -31,8 +31,8 @@ #define SSI_IVPOOL_GEN_SEQ_LEN 4 /** - * struct ssi_ivgen_ctx -IV pool generation context - * @pool: the start address of the iv-pool resides in internal RAM + * struct ssi_ivgen_ctx -IV pool generation context + * @pool: the start address of the iv-pool resides in internal RAM * @ctr_key_dma: address of pool's encryption key material in internal RAM * @ctr_iv_dma: address of pool's counter iv in internal RAM * @next_iv_ofs: the offset to the next available IV in pool @@ -49,12 +49,12 @@ struct ssi_ivgen_ctx { }; /*! - * Generates SSI_IVPOOL_SIZE of random bytes by + * Generates SSI_IVPOOL_SIZE of random bytes by * encrypting 0's using AES128-CTR. - * + * * \param ivgen iv-pool context * \param iv_seq IN/OUT array to the descriptors sequence - * \param iv_seq_len IN/OUT pointer to the sequence length + * \param iv_seq_len IN/OUT pointer to the sequence length */ static int ssi_ivgen_generate_pool( struct ssi_ivgen_ctx *ivgen_ctx, @@ -110,11 +110,11 @@ static int ssi_ivgen_generate_pool( } /*! - * Generates the initial pool in SRAM. - * This function should be invoked when resuming DX driver. - * - * \param drvdata - * + * Generates the initial pool in SRAM. + * This function should be invoked when resuming DX driver. + * + * \param drvdata + * * \return int Zero for success, negative value otherwise. */ int ssi_ivgen_init_sram_pool(struct ssi_drvdata *drvdata) @@ -152,8 +152,8 @@ int ssi_ivgen_init_sram_pool(struct ssi_drvdata *drvdata) /*! * Free iv-pool and ivgen context. - * - * \param drvdata + * + * \param drvdata */ void ssi_ivgen_fini(struct ssi_drvdata *drvdata) { @@ -177,11 +177,11 @@ void ssi_ivgen_fini(struct ssi_drvdata *drvdata) } /*! - * Allocates iv-pool and maps resources. - * This function generates the first IV pool. - * + * Allocates iv-pool and maps resources. + * This function generates the first IV pool. + * * \param drvdata Driver's private context - * + * * \return int Zero for success, negative value otherwise. */ int ssi_ivgen_init(struct ssi_drvdata *drvdata) @@ -228,15 +228,15 @@ out: /*! * Acquires 16 Bytes IV from the iv-pool - * + * * \param drvdata Driver private context * \param iv_out_dma Array of physical IV out addresses * \param iv_out_dma_len Length of iv_out_dma array (additional elements of iv_out_dma array are ignore) - * \param iv_out_size May be 8 or 16 bytes long + * \param iv_out_size May be 8 or 16 bytes long * \param iv_seq IN/OUT array to the descriptors sequence - * \param iv_seq_len IN/OUT pointer to the sequence length - * - * \return int Zero for success, negative value otherwise. + * \param iv_seq_len IN/OUT pointer to the sequence length + * + * \return int Zero for success, negative value otherwise. */ int ssi_ivgen_getiv( struct ssi_drvdata *drvdata, diff --git a/drivers/staging/ccree/ssi_ivgen.h b/drivers/staging/ccree/ssi_ivgen.h index bc69cd8ca418..15f678fa2d96 100644 --- a/drivers/staging/ccree/ssi_ivgen.h +++ b/drivers/staging/ccree/ssi_ivgen.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -23,43 +23,43 @@ #define SSI_IVPOOL_SEQ_LEN 8 /*! - * Allocates iv-pool and maps resources. - * This function generates the first IV pool. - * + * Allocates iv-pool and maps resources. + * This function generates the first IV pool. + * * \param drvdata Driver's private context - * + * * \return int Zero for success, negative value otherwise. */ int ssi_ivgen_init(struct ssi_drvdata *drvdata); /*! * Free iv-pool and ivgen context. - * - * \param drvdata + * + * \param drvdata */ void ssi_ivgen_fini(struct ssi_drvdata *drvdata); /*! - * Generates the initial pool in SRAM. - * This function should be invoked when resuming DX driver. - * - * \param drvdata - * + * Generates the initial pool in SRAM. + * This function should be invoked when resuming DX driver. + * + * \param drvdata + * * \return int Zero for success, negative value otherwise. */ int ssi_ivgen_init_sram_pool(struct ssi_drvdata *drvdata); /*! * Acquires 16 Bytes IV from the iv-pool - * + * * \param drvdata Driver private context * \param iv_out_dma Array of physical IV out addresses * \param iv_out_dma_len Length of iv_out_dma array (additional elements of iv_out_dma array are ignore) - * \param iv_out_size May be 8 or 16 bytes long + * \param iv_out_size May be 8 or 16 bytes long * \param iv_seq IN/OUT array to the descriptors sequence - * \param iv_seq_len IN/OUT pointer to the sequence length - * - * \return int Zero for success, negative value otherwise. + * \param iv_seq_len IN/OUT pointer to the sequence length + * + * \return int Zero for success, negative value otherwise. */ int ssi_ivgen_getiv( struct ssi_drvdata *drvdata, diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c index dd399f28a68c..5bfbdd06dec2 100644 --- a/drivers/staging/ccree/ssi_pm.c +++ b/drivers/staging/ccree/ssi_pm.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -83,7 +83,7 @@ int ssi_power_mgr_runtime_resume(struct device *dev) /* must be after the queue resuming as it uses the HW queue*/ ssi_hash_init_sram_digest_consts(drvdata); - + ssi_ivgen_init_sram_pool(drvdata); return 0; } diff --git a/drivers/staging/ccree/ssi_pm.h b/drivers/staging/ccree/ssi_pm.h index 516fc3f445a8..f1fe1777c04a 100644 --- a/drivers/staging/ccree/ssi_pm.h +++ b/drivers/staging/ccree/ssi_pm.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/ssi_pm_ext.c b/drivers/staging/ccree/ssi_pm_ext.c index f86bbab22073..5889d9f97479 100644 --- a/drivers/staging/ccree/ssi_pm_ext.c +++ b/drivers/staging/ccree/ssi_pm_ext.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -26,9 +26,9 @@ #include "ssi_pm_ext.h" /* -This function should suspend the HW (if possiable), It should be implemented by -the driver user. -The reference code clears the internal SRAM to imitate lose of state. +This function should suspend the HW (if possiable), It should be implemented by +the driver user. +The reference code clears the internal SRAM to imitate lose of state. */ void ssi_pm_ext_hw_suspend(struct device *dev) { @@ -50,8 +50,8 @@ void ssi_pm_ext_hw_suspend(struct device *dev) } /* -This function should resume the HW (if possiable).It should be implemented by -the driver user. +This function should resume the HW (if possiable).It should be implemented by +the driver user. */ void ssi_pm_ext_hw_resume(struct device *dev) { diff --git a/drivers/staging/ccree/ssi_pm_ext.h b/drivers/staging/ccree/ssi_pm_ext.h index b4e2795de29e..9049e6ffa8d3 100644 --- a/drivers/staging/ccree/ssi_pm_ext.h +++ b/drivers/staging/ccree/ssi_pm_ext.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 522bd62c102e..0631323a64b8 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -42,8 +42,8 @@ #define MONITOR_CNTR_BIT 0 /** - * Monitor descriptor. - * Used to measure CC performance. + * Monitor descriptor. + * Used to measure CC performance. */ #define INIT_CC_MONITOR_DESC(desc_p) \ do { \ @@ -51,7 +51,7 @@ do { \ HW_DESC_SET_DIN_MONITOR_CNTR(desc_p); \ } while (0) -/** +/** * Try adding monitor descriptor BEFORE enqueuing sequence. */ #define CC_CYCLE_DESC_HEAD(cc_base_addr, desc_p, lock_p, is_monitored_p) \ @@ -65,8 +65,8 @@ do { \ } while (0) /** - * If CC_CYCLE_DESC_HEAD was successfully added: - * 1. Add memory barrier descriptor to ensure last AXI transaction. + * If CC_CYCLE_DESC_HEAD was successfully added: + * 1. Add memory barrier descriptor to ensure last AXI transaction. * 2. Add monitor descriptor to sequence tail AFTER enqueuing sequence. */ #define CC_CYCLE_DESC_TAIL(cc_base_addr, desc_p, is_monitored) \ @@ -82,7 +82,7 @@ do { \ } while (0) /** - * Try reading CC monitor counter value upon sequence complete. + * Try reading CC monitor counter value upon sequence complete. * Can only succeed if the lock_p is taken by the owner of the given request. */ #define END_CC_MONITOR_COUNT(cc_base_addr, stat_op_type, stat_phase, monitor_null_cycles, lock_p, is_monitored) \ @@ -279,10 +279,10 @@ static inline void enqueue_seq( } /*! - * Completion will take place if and only if user requested completion - * by setting "is_dout = 0" in send_request(). - * - * \param dev + * Completion will take place if and only if user requested completion + * by setting "is_dout = 0" in send_request(). + * + * \param dev * \param dx_compl_h The completion event to signal */ static void request_mgr_complete(struct device *dev, void *dx_compl_h, void __iomem *cc_base) @@ -298,14 +298,14 @@ static inline int request_mgr_queues_status_check( unsigned int total_seq_len) { unsigned long poll_queue; - - /* SW queue is checked only once as it will not - be chaned during the poll becasue the spinlock_bh + + /* SW queue is checked only once as it will not + be chaned during the poll becasue the spinlock_bh is held by the thread */ if (unlikely(((req_mgr_h->req_queue_head + 1) & - (MAX_REQUEST_QUEUE_SIZE - 1)) == + (MAX_REQUEST_QUEUE_SIZE - 1)) == req_mgr_h->req_queue_tail)) { - SSI_LOG_ERR("SW FIFO is full. req_queue_head=%d sw_fifo_len=%d\n", + SSI_LOG_ERR("SW FIFO is full. req_queue_head=%d sw_fifo_len=%d\n", req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE); return -EBUSY; } @@ -315,11 +315,11 @@ static inline int request_mgr_queues_status_check( } /* Wait for space in HW queue. Poll constant num of iterations. */ for (poll_queue =0; poll_queue < SSI_MAX_POLL_ITER ; poll_queue ++) { - req_mgr_h->q_free_slots = + req_mgr_h->q_free_slots = CC_HAL_READ_REGISTER( CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_CONTENT)); - if (unlikely(req_mgr_h->q_free_slots < + if (unlikely(req_mgr_h->q_free_slots < req_mgr_h->min_free_hw_slots)) { req_mgr_h->min_free_hw_slots = req_mgr_h->q_free_slots; } @@ -329,12 +329,12 @@ static inline int request_mgr_queues_status_check( return 0; } - SSI_LOG_DEBUG("HW FIFO is full. q_free_slots=%d total_seq_len=%d\n", + SSI_LOG_DEBUG("HW FIFO is full. q_free_slots=%d total_seq_len=%d\n", req_mgr_h->q_free_slots, total_seq_len); } /* No room in the HW queue try again later */ SSI_LOG_DEBUG("HW FIFO full, timeout. req_queue_head=%d " - "sw_fifo_len=%d q_free_slots=%d total_seq_len=%d\n", + "sw_fifo_len=%d q_free_slots=%d total_seq_len=%d\n", req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE, req_mgr_h->q_free_slots, @@ -344,15 +344,15 @@ static inline int request_mgr_queues_status_check( /*! * Enqueue caller request to crypto hardware. - * - * \param drvdata + * + * \param drvdata * \param ssi_req The request to enqueue * \param desc The crypto sequence * \param len The crypto sequence length - * \param is_dout If "true": completion is handled by the caller + * \param is_dout If "true": completion is handled by the caller * If "false": this function adds a dummy descriptor completion * and waits upon completion signal. - * + * * \return int Returns -EINPROGRESS if "is_dout=true"; "0" if "is_dout=false" */ int send_request( @@ -385,7 +385,7 @@ int send_request( spin_lock_bh(&req_mgr_h->hw_lock); /* Check if there is enough place in the SW/HW queues - in case iv gen add the max size and in case of no dout add 1 + in case iv gen add the max size and in case of no dout add 1 for the internal completion descriptor */ rc = request_mgr_queues_status_check(req_mgr_h, cc_base, @@ -397,7 +397,7 @@ int send_request( spin_unlock_bh(&req_mgr_h->hw_lock); if (rc != -EAGAIN) { - /* Any error other than HW queue full + /* Any error other than HW queue full (SW queue is full) */ #if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) ssi_power_mgr_runtime_put_suspend(&drvdata->plat_dev->dev); @@ -441,12 +441,12 @@ int send_request( total_seq_len += iv_seq_len; } - + used_sw_slots = ((req_mgr_h->req_queue_head - req_mgr_h->req_queue_tail) & (MAX_REQUEST_QUEUE_SIZE-1)); if (unlikely(used_sw_slots > req_mgr_h->max_used_sw_slots)) { req_mgr_h->max_used_sw_slots = used_sw_slots; } - + CC_CYCLE_DESC_HEAD(cc_base, &req_mgr_h->monitor_desc, &req_mgr_h->monitor_lock, &ssi_req->is_monitored_p); @@ -495,11 +495,11 @@ int send_request( * Enqueue caller request to crypto hardware during init process. * assume this function is not called in middle of a flow, * since we set QUEUE_LAST_IND flag in the last descriptor. - * - * \param drvdata + * + * \param drvdata * \param desc The crypto sequence * \param len The crypto sequence length - * + * * \return int Returns "0" upon success */ int send_request_init( @@ -530,7 +530,7 @@ int send_request_init( void complete_request(struct ssi_drvdata *drvdata) { - struct ssi_request_mgr_handle *request_mgr_handle = + struct ssi_request_mgr_handle *request_mgr_handle = drvdata->request_mgr_handle; #ifdef COMP_IN_WQ queue_delayed_work(request_mgr_handle->workq, &request_mgr_handle->compwork, 0); @@ -553,7 +553,7 @@ static void proc_completions(struct ssi_drvdata *drvdata) { struct ssi_crypto_req *ssi_req; struct platform_device *plat_dev = drvdata->plat_dev; - struct ssi_request_mgr_handle * request_mgr_handle = + struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; #if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) int rc = 0; @@ -612,7 +612,7 @@ static void comp_handler(unsigned long devarg) { struct ssi_drvdata *drvdata = (struct ssi_drvdata *)devarg; void __iomem *cc_base = drvdata->cc_base; - struct ssi_request_mgr_handle * request_mgr_handle = + struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; uint32_t irq; @@ -626,38 +626,38 @@ static void comp_handler(unsigned long devarg) if (irq & SSI_COMP_IRQ_MASK) { /* To avoid the interrupt from firing as we unmask it, we clear it now */ CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), SSI_COMP_IRQ_MASK); - + /* Avoid race with above clear: Test completion counter once more */ - request_mgr_handle->axi_completed += CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, + request_mgr_handle->axi_completed += CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); - + /* ISR-to-Tasklet latency */ if (request_mgr_handle->axi_completed) { /* Only if actually reflects ISR-to-completion-handling latency, i.e., not duplicate as a result of interrupt after AXIM_MON_ERR clear, before end of loop */ END_CYCLE_COUNT_AT(drvdata->isr_exit_cycles, STAT_OP_TYPE_GENERIC, STAT_PHASE_1); } - + while (request_mgr_handle->axi_completed) { do { proc_completions(drvdata); /* At this point (after proc_completions()), request_mgr_handle->axi_completed is always 0. The following assignment was changed to = (previously was +=) to conform KW restrictions. */ - request_mgr_handle->axi_completed = CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, + request_mgr_handle->axi_completed = CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); } while (request_mgr_handle->axi_completed > 0); - + /* To avoid the interrupt from firing as we unmask it, we clear it now */ CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), SSI_COMP_IRQ_MASK); - + /* Avoid race with above clear: Test completion counter once more */ - request_mgr_handle->axi_completed += CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, + request_mgr_handle->axi_completed += CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); } - + } /* after verifing that there is nothing to do, Unmask AXI completion interrupt */ - CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), + CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), CC_HAL_READ_REGISTER( CC_REG_OFFSET(HOST_RGF, HOST_IMR)) & ~irq); END_CYCLE_COUNT(STAT_OP_TYPE_GENERIC, STAT_PHASE_2); @@ -685,12 +685,12 @@ only verify that the queue can be suspended. */ int ssi_request_mgr_runtime_suspend_queue(struct ssi_drvdata *drvdata) { - struct ssi_request_mgr_handle * request_mgr_handle = + struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; - + /* lock the send_request */ spin_lock_bh(&request_mgr_handle->hw_lock); - if (request_mgr_handle->req_queue_head != + if (request_mgr_handle->req_queue_head != request_mgr_handle->req_queue_tail) { spin_unlock_bh(&request_mgr_handle->hw_lock); return -EBUSY; @@ -703,7 +703,7 @@ int ssi_request_mgr_runtime_suspend_queue(struct ssi_drvdata *drvdata) bool ssi_request_mgr_is_queue_runtime_suspend(struct ssi_drvdata *drvdata) { - struct ssi_request_mgr_handle * request_mgr_handle = + struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; return request_mgr_handle->is_runtime_suspended; diff --git a/drivers/staging/ccree/ssi_request_mgr.h b/drivers/staging/ccree/ssi_request_mgr.h index c09339b566d0..1fdb7f8b77ba 100644 --- a/drivers/staging/ccree/ssi_request_mgr.h +++ b/drivers/staging/ccree/ssi_request_mgr.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -27,15 +27,15 @@ int request_mgr_init(struct ssi_drvdata *drvdata); /*! * Enqueue caller request to crypto hardware. - * - * \param drvdata + * + * \param drvdata * \param ssi_req The request to enqueue * \param desc The crypto sequence * \param len The crypto sequence length - * \param is_dout If "true": completion is handled by the caller + * \param is_dout If "true": completion is handled by the caller * If "false": this function adds a dummy descriptor completion * and waits upon completion signal. - * + * * \return int Returns -EINPROGRESS if "is_dout=ture"; "0" if "is_dout=false" */ int send_request( diff --git a/drivers/staging/ccree/ssi_sram_mgr.c b/drivers/staging/ccree/ssi_sram_mgr.c index 50066e17d1d3..44662fdd9c97 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.c +++ b/drivers/staging/ccree/ssi_sram_mgr.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -29,7 +29,7 @@ struct ssi_sram_mgr_ctx { /** * ssi_sram_mgr_fini() - Cleanup SRAM pool. - * + * * @drvdata: Associated device driver context */ void ssi_sram_mgr_fini(struct ssi_drvdata *drvdata) @@ -44,10 +44,10 @@ void ssi_sram_mgr_fini(struct ssi_drvdata *drvdata) } /** - * ssi_sram_mgr_init() - Initializes SRAM pool. + * ssi_sram_mgr_init() - Initializes SRAM pool. * The pool starts right at the beginning of SRAM. * Returns zero for success, negative value otherwise. - * + * * @drvdata: Associated device driver context */ int ssi_sram_mgr_init(struct ssi_drvdata *drvdata) @@ -77,12 +77,12 @@ out: } /*! - * Allocated buffer from SRAM pool. - * Note: Caller is responsible to free the LAST allocated buffer. - * This function does not taking care of any fragmentation may occur - * by the order of calls to alloc/free. - * - * \param drvdata + * Allocated buffer from SRAM pool. + * Note: Caller is responsible to free the LAST allocated buffer. + * This function does not taking care of any fragmentation may occur + * by the order of calls to alloc/free. + * + * \param drvdata * \param size The requested bytes to allocate */ ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, uint32_t size) @@ -100,7 +100,7 @@ ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, uint32_t size) size, smgr_ctx->sram_free_offset); return NULL_SRAM_ADDR; } - + p = smgr_ctx->sram_free_offset; smgr_ctx->sram_free_offset += size; SSI_LOG_DEBUG("Allocated %u B @ %u\n", size, (unsigned int)p); @@ -109,9 +109,9 @@ ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, uint32_t size) /** * ssi_sram_mgr_const2sram_desc() - Create const descriptors sequence to - * set values in given array into SRAM. + * set values in given array into SRAM. * Note: each const value can't exceed word size. - * + * * @src: A pointer to array of words to set as consts. * @dst: The target SRAM buffer to set into * @nelements: The number of words in "src" array diff --git a/drivers/staging/ccree/ssi_sram_mgr.h b/drivers/staging/ccree/ssi_sram_mgr.h index d71fbaf9ac44..a71e17dc8bbe 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.h +++ b/drivers/staging/ccree/ssi_sram_mgr.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -33,39 +33,39 @@ typedef uint64_t ssi_sram_addr_t; #define NULL_SRAM_ADDR ((ssi_sram_addr_t)-1) /*! - * Initializes SRAM pool. - * The first X bytes of SRAM are reserved for ROM usage, hence, pool - * starts right after X bytes. - * - * \param drvdata - * + * Initializes SRAM pool. + * The first X bytes of SRAM are reserved for ROM usage, hence, pool + * starts right after X bytes. + * + * \param drvdata + * * \return int Zero for success, negative value otherwise. */ int ssi_sram_mgr_init(struct ssi_drvdata *drvdata); /*! * Uninits SRAM pool. - * - * \param drvdata + * + * \param drvdata */ void ssi_sram_mgr_fini(struct ssi_drvdata *drvdata); /*! - * Allocated buffer from SRAM pool. - * Note: Caller is responsible to free the LAST allocated buffer. - * This function does not taking care of any fragmentation may occur - * by the order of calls to alloc/free. - * - * \param drvdata + * Allocated buffer from SRAM pool. + * Note: Caller is responsible to free the LAST allocated buffer. + * This function does not taking care of any fragmentation may occur + * by the order of calls to alloc/free. + * + * \param drvdata * \param size The requested bytes to allocate */ ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, uint32_t size); /** * ssi_sram_mgr_const2sram_desc() - Create const descriptors sequence to - * set values in given array into SRAM. + * set values in given array into SRAM. * Note: each const value can't exceed word size. - * + * * @src: A pointer to array of words to set as consts. * @dst: The target SRAM buffer to set into * @nelements: The number of words in "src" array diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 7c514c1072a9..1ff1e78ccc08 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -40,7 +40,7 @@ struct stat_name { const char *stat_phase_name[MAX_STAT_PHASES]; }; -static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] = +static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] = { { /* STAT_OP_TYPE_NULL */ @@ -50,8 +50,8 @@ static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] = { .op_type_name = "Encode", .stat_phase_name[STAT_PHASE_0] = "Init and sanity checks", - .stat_phase_name[STAT_PHASE_1] = "Map buffers", - .stat_phase_name[STAT_PHASE_2] = "Create sequence", + .stat_phase_name[STAT_PHASE_1] = "Map buffers", + .stat_phase_name[STAT_PHASE_2] = "Create sequence", .stat_phase_name[STAT_PHASE_3] = "Send Request", .stat_phase_name[STAT_PHASE_4] = "HW-Q push", .stat_phase_name[STAT_PHASE_5] = "Sequence completion", @@ -59,8 +59,8 @@ static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] = }, { .op_type_name = "Decode", .stat_phase_name[STAT_PHASE_0] = "Init and sanity checks", - .stat_phase_name[STAT_PHASE_1] = "Map buffers", - .stat_phase_name[STAT_PHASE_2] = "Create sequence", + .stat_phase_name[STAT_PHASE_1] = "Map buffers", + .stat_phase_name[STAT_PHASE_2] = "Create sequence", .stat_phase_name[STAT_PHASE_3] = "Send Request", .stat_phase_name[STAT_PHASE_4] = "HW-Q push", .stat_phase_name[STAT_PHASE_5] = "Sequence completion", @@ -88,7 +88,7 @@ static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] = }; /* - * Structure used to create a directory + * Structure used to create a directory * and its attributes in sysfs. */ struct sys_dir { @@ -140,12 +140,12 @@ static void display_db(struct stat_item item[MAX_STAT_OP_TYPES][MAX_STAT_PHASES] uint64_t avg; for (i=STAT_OP_TYPE_ENCODE; i 0) { avg = (uint64_t)item[i][j].sum; do_div(avg, item[i][j].count); - SSI_LOG_ERR("%s, %s: min=%d avg=%d max=%d sum=%lld count=%d\n", - stat_name_db[i].op_type_name, stat_name_db[i].stat_phase_name[j], + SSI_LOG_ERR("%s, %s: min=%d avg=%d max=%d sum=%lld count=%d\n", + stat_name_db[i].op_type_name, stat_name_db[i].stat_phase_name[j], item[i][j].min, (int)avg, item[i][j].max, (long long)item[i][j].sum, item[i][j].count); } } @@ -271,9 +271,9 @@ void update_cc_stat( void display_all_stat_db(void) { - SSI_LOG_ERR("\n======= CYCLE COUNT STATS =======\n"); + SSI_LOG_ERR("\n======= CYCLE COUNT STATS =======\n"); display_db(stat_host_db); - SSI_LOG_ERR("\n======= CC HW CYCLE COUNT STATS =======\n"); + SSI_LOG_ERR("\n======= CC HW CYCLE COUNT STATS =======\n"); display_db(stat_cc_db); } #endif /*CC_CYCLE_COUNT*/ diff --git a/drivers/staging/ccree/ssi_sysfs.h b/drivers/staging/ccree/ssi_sysfs.h index baeac1d99c07..cd456c5dccc4 100644 --- a/drivers/staging/ccree/ssi_sysfs.h +++ b/drivers/staging/ccree/ssi_sysfs.h @@ -1,15 +1,15 @@ /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * + * * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ -- cgit v1.2.3-55-g7522 From f8aad3595b21bd4964db2b482c66049376ddde56 Mon Sep 17 00:00:00 2001 From: Matthew Giassa Date: Sat, 6 May 2017 15:46:55 -0700 Subject: staging: ccree: resolve columns over 80 chars in cc_hal.h Modified comment to resolve 80+ characters warning from checkpatch. ie: WARNING: line over 80 characters Warnings no longer present after change. Signed-off-by: Matthew Giassa Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hal.h b/drivers/staging/ccree/cc_hal.h index dd1c66d4878b..9b54c8007320 100644 --- a/drivers/staging/ccree/cc_hal.h +++ b/drivers/staging/ccree/cc_hal.h @@ -14,7 +14,9 @@ * along with this program; if not, see . */ -/* pseudo cc_hal.h for cc7x_perf_test_driver (to be able to include code from CC drivers) */ +/* pseudo cc_hal.h for cc7x_perf_test_driver (to be able to include code from + * CC drivers). + */ #ifndef __CC_HAL_H__ #define __CC_HAL_H__ -- cgit v1.2.3-55-g7522 From 3477f15a850fc290d03f424571d222d1252e9028 Mon Sep 17 00:00:00 2001 From: Matthew Giassa Date: Sat, 6 May 2017 15:46:56 -0700 Subject: staging: ccree: resolve possible macro issue in cc_hal.h Wrapping "offset" in macro definition to resolve checkpatch issue, ie: CHECK: Macro argument 'offset' may be better as '(offset)' to avoid precedence issues Signed-off-by: Matthew Giassa Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hal.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hal.h b/drivers/staging/ccree/cc_hal.h index 9b54c8007320..eecc866dfc74 100644 --- a/drivers/staging/ccree/cc_hal.h +++ b/drivers/staging/ccree/cc_hal.h @@ -26,7 +26,8 @@ #define READ_REGISTER(_addr) ioread32((_addr)) #define WRITE_REGISTER(_addr, _data) iowrite32((_data), (_addr)) -#define CC_HAL_WRITE_REGISTER(offset, val) WRITE_REGISTER(cc_base + offset, val) -#define CC_HAL_READ_REGISTER(offset) READ_REGISTER(cc_base + offset) +#define CC_HAL_WRITE_REGISTER(offset, val) \ + WRITE_REGISTER(cc_base + (offset), val) +#define CC_HAL_READ_REGISTER(offset) READ_REGISTER(cc_base + (offset)) #endif -- cgit v1.2.3-55-g7522 From 83dc299ee6b253e314d7d150b360e7de89686c24 Mon Sep 17 00:00:00 2001 From: Tuomo Rinne Date: Mon, 1 May 2017 23:46:18 +0100 Subject: staging: rtl8192u: Remove unnecessary scope Remove scope unnecessary scope that is already enforced by the if statements scope. Signed-off-by: Tuomo Rinne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 66 +++++++++++++++++------------------- 1 file changed, 32 insertions(+), 34 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 975f707827e1..94d898b3e9ab 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2300,43 +2300,41 @@ static void dm_check_edca_turbo( * Restore original EDCA according to the declaration of AP. */ if (priv->bcurrent_turbo_EDCA) { + u8 u1bAIFS; + u32 u4bAcParam; + struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; + u8 mode = priv->ieee80211->mode; + + /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ + dm_init_edca_turbo(dev); + u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; + u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| + ((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)| + ((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)| + ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); + /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/ + write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); + + /* + * Check ACM bit. + * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13. + */ { - u8 u1bAIFS; - u32 u4bAcParam; - struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; - u8 mode = priv->ieee80211->mode; - - /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ - dm_init_edca_turbo(dev); - u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; - u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| - ((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)| - ((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)| - ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); - /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/ - write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); - - /* - * Check ACM bit. - * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13. - */ - { - /* TODO: Modified this part and try to set acm control in only 1 IO processing!! */ - - PACI_AIFSN pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]); - u8 AcmCtrl; - - read_nic_byte(dev, AcmHwCtrl, &AcmCtrl); - - if (pAciAifsn->f.ACM) { /* ACM bit is 1. */ - AcmCtrl |= AcmHw_BeqEn; - } else { /* ACM bit is 0. */ - AcmCtrl &= (~AcmHw_BeqEn); - } + /* TODO: Modified this part and try to set acm control in only 1 IO processing!! */ - RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl); - write_nic_byte(dev, AcmHwCtrl, AcmCtrl); + PACI_AIFSN pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]); + u8 AcmCtrl; + + read_nic_byte(dev, AcmHwCtrl, &AcmCtrl); + + if (pAciAifsn->f.ACM) { /* ACM bit is 1. */ + AcmCtrl |= AcmHw_BeqEn; + } else { /* ACM bit is 0. */ + AcmCtrl &= (~AcmHw_BeqEn); } + + RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl); + write_nic_byte(dev, AcmHwCtrl, AcmCtrl); } priv->bcurrent_turbo_EDCA = false; } -- cgit v1.2.3-55-g7522 From 2b7f2a43589aa8800ffd3759775bbfcb34e17179 Mon Sep 17 00:00:00 2001 From: Tuomo Rinne Date: Mon, 1 May 2017 23:46:19 +0100 Subject: staging: rtl8192u: Improve code readability Split the u4bAcParam parameter construction to multiple lines for easier readability. Signed-off-by: Tuomo Rinne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 94d898b3e9ab..283dda450463 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2300,20 +2300,30 @@ static void dm_check_edca_turbo( * Restore original EDCA according to the declaration of AP. */ if (priv->bcurrent_turbo_EDCA) { - u8 u1bAIFS; - u32 u4bAcParam; + u8 u1bAIFS; + u32 u4bAcParam, op_limit, cw_max, cw_min; + struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; u8 mode = priv->ieee80211->mode; /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ dm_init_edca_turbo(dev); - u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; - u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| - ((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)| - ((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)| - ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); - /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/ - write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); + + u1bAIFS = qos_parameters->aifs[0] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20) + aSifsTime; + + op_limit = (u32)le16_to_cpu(qos_parameters->tx_op_limit[0]); + cw_max = (u32)le16_to_cpu(qos_parameters->cw_max[0]); + cw_min = (u32)le16_to_cpu(qos_parameters->cw_min[0]); + + op_limit <<= AC_PARAM_TXOP_LIMIT_OFFSET; + cw_max <<= AC_PARAM_ECW_MAX_OFFSET; + cw_min <<= AC_PARAM_ECW_MIN_OFFSET; + u1bAIFS <<= AC_PARAM_AIFS_OFFSET; + + u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS; + + write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); + /* * Check ACM bit. -- cgit v1.2.3-55-g7522 From fb8cf3bfb23b631360d1e6ee2cb1d740e42b0851 Mon Sep 17 00:00:00 2001 From: Tuomo Rinne Date: Mon, 1 May 2017 23:46:20 +0100 Subject: staging: rtl8192u: Convert u4bAcParam to little-endian The commit 9304b5b0d4fe ("staging: rtl8192u: Fix sparse warnings in r8192U_dm.c") adds casting of le16 from cpu endianness. Therefore constructing u4bAcParam potentially using big-endian order. This patch converts the u4bAcParam parameter back to little-endian after it has been constructed. Hence on big-endian architectures the parameter will remain as little-endian. Signed-off-by: Tuomo Rinne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 283dda450463..e6f8d1da65d9 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2321,6 +2321,7 @@ static void dm_check_edca_turbo( u1bAIFS <<= AC_PARAM_AIFS_OFFSET; u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS; + cpu_to_le32s(&u4bAcParam); write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); -- cgit v1.2.3-55-g7522 From d05038ccd4e4850598018aa7647ff029cbe248a7 Mon Sep 17 00:00:00 2001 From: Fabrizio Perria Date: Wed, 3 May 2017 08:00:26 -0400 Subject: staging: rtl8192u: ieee80211: rtl819x_TSProc: Fixed brace placement issues Fixed multiple checkpatch.pl issues regarding open brace placement, else (after a brace) placement, unnecessary braces (single statement branches) and space before closing brace. To get the list of errors, the following command has been executed: ./scripts/checkpatch.pl --show-types --strict \ --types=else_after_brace,open_brace,braces --terse \ -f drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c Signed-off-by: Fabrizio Perria Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 171 +++++++-------------- 1 file changed, 55 insertions(+), 116 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index b4c13fff2c65..f98bb03aa293 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -36,18 +36,15 @@ static void RxPktPendingTimeout(unsigned long data) spin_lock_irqsave(&(ieee->reorder_spinlock), flags); IEEE80211_DEBUG(IEEE80211_DL_REORDER,"==================>%s()\n",__func__); - if(pRxTs->RxTimeoutIndicateSeq != 0xffff) - { + if(pRxTs->RxTimeoutIndicateSeq != 0xffff) { // Indicate the pending packets sequentially according to SeqNum until meet the gap. - while(!list_empty(&pRxTs->RxPendingPktList)) - { + while(!list_empty(&pRxTs->RxPendingPktList)) { pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTs->RxPendingPktList.prev,RX_REORDER_ENTRY,List); if(index == 0) pRxTs->RxIndicateSeq = pReorderEntry->SeqNum; if( SN_LESS(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) || - SN_EQUAL(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) ) - { + SN_EQUAL(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) ) { list_del_init(&pReorderEntry->List); if(SN_EQUAL(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq)) @@ -58,22 +55,19 @@ static void RxPktPendingTimeout(unsigned long data) index++; list_add_tail(&pReorderEntry->List, &ieee->RxReorder_Unused_List); - } - else - { + } else { bPktInBuf = true; break; } } } - if(index>0) - { + if(index>0) { // Set RxTimeoutIndicateSeq to 0xffff to indicate no pending packets in buffer now. pRxTs->RxTimeoutIndicateSeq = 0xffff; // Indicate packets - if(index > REORDER_WIN_SIZE){ + if(index > REORDER_WIN_SIZE) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorder buffer full!! \n"); spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; @@ -81,8 +75,7 @@ static void RxPktPendingTimeout(unsigned long data) ieee80211_indicate_packets(ieee, ieee->stats_IndicateArray, index); } - if(bPktInBuf && (pRxTs->RxTimeoutIndicateSeq==0xffff)) - { + if(bPktInBuf && (pRxTs->RxTimeoutIndicateSeq==0xffff)) { pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq; mod_timer(&pRxTs->RxPktPendingTimer, jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)); @@ -147,8 +140,7 @@ void TSInitialize(struct ieee80211_device *ieee) INIT_LIST_HEAD(&ieee->Tx_TS_Pending_List); INIT_LIST_HEAD(&ieee->Tx_TS_Unused_List); - for(count = 0; count < TOTAL_TS_NUM; count++) - { + for(count = 0; count < TOTAL_TS_NUM; count++) { // pTxTS->num = count; // The timers for the operation of Traffic Stream and Block Ack. @@ -172,8 +164,7 @@ void TSInitialize(struct ieee80211_device *ieee) INIT_LIST_HEAD(&ieee->Rx_TS_Admit_List); INIT_LIST_HEAD(&ieee->Rx_TS_Pending_List); INIT_LIST_HEAD(&ieee->Rx_TS_Unused_List); - for(count = 0; count < TOTAL_TS_NUM; count++) - { + for(count = 0; count < TOTAL_TS_NUM; count++) { pRxTS->num = count; INIT_LIST_HEAD(&pRxTS->RxPendingPktList); setup_timer(&pRxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut, @@ -191,15 +182,13 @@ void TSInitialize(struct ieee80211_device *ieee) // Initialize unused Rx Reorder List. INIT_LIST_HEAD(&ieee->RxReorder_Unused_List); //#ifdef TO_DO_LIST - for(count = 0; count < REORDER_ENTRY_NUM; count++) - { + for(count = 0; count < REORDER_ENTRY_NUM; count++) { list_add_tail( &pRxReorderEntry->List,&ieee->RxReorder_Unused_List); if(count == (REORDER_ENTRY_NUM-1)) break; pRxReorderEntry = &ieee->RxReorderEntry[count+1]; } //#endif - } static void AdmitTS(struct ieee80211_device *ieee, @@ -223,36 +212,25 @@ static PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee, bool search_dir[4] = {0}; struct list_head *psearch_list; //FIXME PTS_COMMON_INFO pRet = NULL; - if(ieee->iw_mode == IW_MODE_MASTER) //ap mode - { - if(TxRxSelect == TX_DIR) - { + if(ieee->iw_mode == IW_MODE_MASTER) { //ap mode + if(TxRxSelect == TX_DIR) { search_dir[DIR_DOWN] = true; search_dir[DIR_BI_DIR]= true; - } - else - { + } else { search_dir[DIR_UP] = true; search_dir[DIR_BI_DIR]= true; } - } - else if(ieee->iw_mode == IW_MODE_ADHOC) - { + } else if(ieee->iw_mode == IW_MODE_ADHOC) { if(TxRxSelect == TX_DIR) search_dir[DIR_UP] = true; else search_dir[DIR_DOWN] = true; - } - else - { - if(TxRxSelect == TX_DIR) - { + } else { + if(TxRxSelect == TX_DIR) { search_dir[DIR_UP] = true; search_dir[DIR_BI_DIR]= true; search_dir[DIR_DIRECT]= true; - } - else - { + } else { search_dir[DIR_DOWN] = true; search_dir[DIR_BI_DIR]= true; search_dir[DIR_DIRECT]= true; @@ -265,28 +243,24 @@ static PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee, psearch_list = &ieee->Rx_TS_Admit_List; //for(dir = DIR_UP; dir <= DIR_BI_DIR; dir++) - for(dir = 0; dir <= DIR_BI_DIR; dir++) - { + for(dir = 0; dir <= DIR_BI_DIR; dir++) { if (!search_dir[dir]) continue; list_for_each_entry(pRet, psearch_list, List){ // IEEE80211_DEBUG(IEEE80211_DL_TS, "ADD:%pM, TID:%d, dir:%d\n", pRet->Addr, pRet->TSpec.f.TSInfo.field.ucTSID, pRet->TSpec.f.TSInfo.field.ucDirection); if (memcmp(pRet->Addr, Addr, 6) == 0) if (pRet->TSpec.f.TSInfo.field.ucTSID == TID) - if(pRet->TSpec.f.TSInfo.field.ucDirection == dir) - { + if(pRet->TSpec.f.TSInfo.field.ucDirection == dir) { // printk("Bingo! got it\n"); break; } - } if(&pRet->List != psearch_list) break; } - if(&pRet->List != psearch_list){ + if(&pRet->List != psearch_list) return pRet ; - } else return NULL; } @@ -327,25 +301,21 @@ bool GetTs( // We do not build any TS for Broadcast or Multicast stream. // So reject these kinds of search here. // - if (is_multicast_ether_addr(Addr)) - { + if (is_multicast_ether_addr(Addr)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "get TS for Broadcast or Multicast\n"); return false; } - if (ieee->current_network.qos_data.supported == 0) + if (ieee->current_network.qos_data.supported == 0) { UP = 0; - else - { + } else { // In WMM case: we use 4 TID only - if (!IsACValid(TID)) - { + if (!IsACValid(TID)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, " in %s(), TID(%d) is not valid\n", __func__, TID); return false; } - switch (TID) - { + switch (TID) { case 0: case 3: UP = 0; @@ -373,18 +343,13 @@ bool GetTs( Addr, UP, TxRxSelect); - if(*ppTS != NULL) - { + if(*ppTS != NULL) { return true; - } - else - { + } else { if (!bAddNewTs) { IEEE80211_DEBUG(IEEE80211_DL_TS, "add new TS failed(tid:%d)\n", UP); return false; - } - else - { + } else { // // Create a new Traffic stream for current Tx/Rx // This is for EDCA and WMM to add a new TS. @@ -406,16 +371,13 @@ bool GetTs( ((TxRxSelect==TX_DIR)?DIR_DOWN:DIR_UP): ((TxRxSelect==TX_DIR)?DIR_UP:DIR_DOWN); IEEE80211_DEBUG(IEEE80211_DL_TS, "to add Ts\n"); - if(!list_empty(pUnusedList)) - { + if(!list_empty(pUnusedList)) { (*ppTS) = list_entry(pUnusedList->next, TS_COMMON_INFO, List); list_del_init(&(*ppTS)->List); - if(TxRxSelect==TX_DIR) - { + if(TxRxSelect==TX_DIR) { PTX_TS_RECORD tmp = container_of(*ppTS, TX_TS_RECORD, TsCommonInfo); ResetTxTsEntry(tmp); - } - else{ + } else { PRX_TS_RECORD tmp = container_of(*ppTS, RX_TS_RECORD, TsCommonInfo); ResetRxTsEntry(tmp); } @@ -438,9 +400,7 @@ bool GetTs( // if there is DirectLink, we need to do additional operation here!! return true; - } - else - { + } else { IEEE80211_DEBUG(IEEE80211_DL_ERR, "in function %s() There is not enough TS record to be used!!", __func__); return false; } @@ -457,16 +417,14 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, PTS_COMMON_INFO pTs, del_timer_sync(&pTs->InactTimer); TsInitDelBA(ieee, pTs, TxRxSelect); - if(TxRxSelect == RX_DIR) - { + if(TxRxSelect == RX_DIR) { //#ifdef TO_DO_LIST PRX_REORDER_ENTRY pRxReorderEntry; PRX_TS_RECORD pRxTS = (PRX_TS_RECORD)pTs; if(timer_pending(&pRxTS->RxPktPendingTimer)) del_timer_sync(&pRxTS->RxPktPendingTimer); - while(!list_empty(&pRxTS->RxPendingPktList)) - { + while(!list_empty(&pRxTS->RxPendingPktList)) { spin_lock_irqsave(&(ieee->reorder_spinlock), flags); //pRxReorderEntry = list_entry(&pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); pRxReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); @@ -474,14 +432,13 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, PTS_COMMON_INFO pTs, { int i = 0; struct ieee80211_rxb *prxb = pRxReorderEntry->prxb; - if (unlikely(!prxb)) - { + if (unlikely(!prxb)) { spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; } - for(i =0; i < prxb->nr_subframes; i++) { + for(i =0; i < prxb->nr_subframes; i++) dev_kfree_skb(prxb->subframes[i]); - } + kfree(prxb); prxb = NULL; } @@ -490,9 +447,7 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, PTS_COMMON_INFO pTs, } //#endif - } - else - { + } else { PTX_TS_RECORD pTxTS = (PTX_TS_RECORD)pTs; del_timer_sync(&pTxTS->TsAddBaTimer); } @@ -503,20 +458,16 @@ void RemovePeerTS(struct ieee80211_device *ieee, u8 *Addr) PTS_COMMON_INFO pTS, pTmpTS; printk("===========>RemovePeerTS,%pM\n", Addr); - list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) - { - if (memcmp(pTS->Addr, Addr, 6) == 0) - { + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) { + if (memcmp(pTS->Addr, Addr, 6) == 0) { RemoveTsEntry(ieee, pTS, TX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); } } - list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Admit_List, List) - { - if (memcmp(pTS->Addr, Addr, 6) == 0) - { + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Admit_List, List) { + if (memcmp(pTS->Addr, Addr, 6) == 0) { printk("====>remove Tx_TS_admin_list\n"); RemoveTsEntry(ieee, pTS, TX_DIR); list_del_init(&pTS->List); @@ -524,20 +475,16 @@ void RemovePeerTS(struct ieee80211_device *ieee, u8 *Addr) } } - list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Pending_List, List) - { - if (memcmp(pTS->Addr, Addr, 6) == 0) - { + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Pending_List, List) { + if (memcmp(pTS->Addr, Addr, 6) == 0) { RemoveTsEntry(ieee, pTS, RX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); } } - list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Admit_List, List) - { - if (memcmp(pTS->Addr, Addr, 6) == 0) - { + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Admit_List, List) { + if (memcmp(pTS->Addr, Addr, 6) == 0) { RemoveTsEntry(ieee, pTS, RX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); @@ -549,29 +496,25 @@ void RemoveAllTS(struct ieee80211_device *ieee) { PTS_COMMON_INFO pTS, pTmpTS; - list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) - { + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) { RemoveTsEntry(ieee, pTS, TX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); } - list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Admit_List, List) - { + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Admit_List, List) { RemoveTsEntry(ieee, pTS, TX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); } - list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Pending_List, List) - { + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Pending_List, List) { RemoveTsEntry(ieee, pTS, RX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); } - list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Admit_List, List) - { + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Admit_List, List) { RemoveTsEntry(ieee, pTS, RX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); @@ -580,21 +523,17 @@ void RemoveAllTS(struct ieee80211_device *ieee) void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS) { - if(!pTxTS->bAddBaReqInProgress) - { + if(!pTxTS->bAddBaReqInProgress) { pTxTS->bAddBaReqInProgress = true; - if(pTxTS->bAddBaReqDelayed) - { + if(pTxTS->bAddBaReqDelayed) { IEEE80211_DEBUG(IEEE80211_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies + msecs_to_jiffies(TS_ADDBA_DELAY)); - } - else - { + } else { IEEE80211_DEBUG(IEEE80211_DL_BA,"TsStartAddBaProcess(): Immediately Start ADDBA now!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies+10); //set 10 ticks } - } - else + } else { IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s()==>BA timer is already added\n", __func__); + } } -- cgit v1.2.3-55-g7522 From 1f536fcc76eb117b62610c3fd2e76c5c75cb0612 Mon Sep 17 00:00:00 2001 From: Jaikumar Dhanapal Date: Sat, 6 May 2017 19:52:29 +0530 Subject: staging: android: ion: cosmetic changes Checks reported by the checkpatch.pl scripts are resolved. This patch contains trivial changes like alignment and trailing whitespace removal Signed-off-by: Jaikumar Dhanapal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 03d3a4fce0e2..3a724ca1729c 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -221,7 +221,7 @@ struct ion_dma_buf_attachment { }; static int ion_dma_buf_attach(struct dma_buf *dmabuf, struct device *dev, - struct dma_buf_attachment *attachment) + struct dma_buf_attachment *attachment) { struct ion_dma_buf_attachment *a; struct sg_table *table; @@ -264,7 +264,6 @@ static void ion_dma_buf_detatch(struct dma_buf *dmabuf, kfree(a); } - static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment, enum dma_data_direction direction) { @@ -354,11 +353,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, mutex_unlock(&buffer->lock); } - mutex_lock(&buffer->lock); list_for_each_entry(a, &buffer->attachments, list) { dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents, - DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); } mutex_unlock(&buffer->lock); @@ -380,7 +378,7 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, mutex_lock(&buffer->lock); list_for_each_entry(a, &buffer->attachments, list) { dma_sync_sg_for_device(a->dev, a->table->sgl, a->table->nents, - DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); } mutex_unlock(&buffer->lock); -- cgit v1.2.3-55-g7522 From 777e923c2d41388a220c0d6fec33abe9c30015a6 Mon Sep 17 00:00:00 2001 From: Richard Porter Date: Wed, 3 May 2017 13:47:14 +0100 Subject: staging: android: ion: Align with open parenthesis Fix checkpatch.pl warning: CHECK: Alignment should match open parenthesis + fd = ion_alloc(data.allocation.len, + data.allocation.heap_id_mask, Signed-off-by: Richard Porter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion-ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c index 76427e4773a8..d9f8b1424da1 100644 --- a/drivers/staging/android/ion/ion-ioctl.c +++ b/drivers/staging/android/ion/ion-ioctl.c @@ -83,8 +83,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) int fd; fd = ion_alloc(data.allocation.len, - data.allocation.heap_id_mask, - data.allocation.flags); + data.allocation.heap_id_mask, + data.allocation.flags); if (fd < 0) return fd; -- cgit v1.2.3-55-g7522 From 1d283a64180f6e425c47d62b87a702be800ce960 Mon Sep 17 00:00:00 2001 From: Bingyu Zhou Date: Sat, 29 Apr 2017 16:19:33 +0800 Subject: staging: rtl8723bs: Fix checkpatch space errors in os_dep/sdio_ops_linux.c Detected the follow errors by checkpatch.pl -f ERROR: spaces required around that '<' ERROR: space required after that ';' Signed-off-by: Bingyu Zhou Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c index 33f0f83b002d..3aa3e6548fd5 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c @@ -272,7 +272,7 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err) DBG_871X(KERN_ERR "%s: (%d) addr = 0x%05x, val = 0x%x\n", __func__, *err, addr, v); *err = 0; - for (i = 0; ibSurpriseRemoved) { /* DBG_871X(" %s (padapter->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n", __func__); */ - return ; + return; } func = psdio->func; @@ -346,7 +346,7 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err) if (padapter->bSurpriseRemoved) { /* DBG_871X(" %s (padapter->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n", __func__); */ - return ; + return; } func = psdio->func; @@ -365,7 +365,7 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err) DBG_871X(KERN_ERR "%s: (%d) addr = 0x%05x val = 0x%08x\n", __func__, *err, addr, v); *err = 0; - for (i = 0; ifunc; - if (unlikely((cnt == 1) || (cnt ==2))) + if (unlikely((cnt == 1) || (cnt == 2))) { int i; u8 *pbuf = (u8 *)pdata; @@ -465,7 +465,7 @@ s32 _sd_read(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata) *0 Success *others Fail */ -s32 sd_read(struct intf_hdl * pintfhdl, u32 addr, u32 cnt, void *pdata) +s32 sd_read(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata) { struct adapter *padapter; struct dvobj_priv *psdiodev; @@ -517,7 +517,7 @@ s32 _sd_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata) struct sdio_func *func; u32 size; - s32 err =-EPERM; + s32 err = -EPERM; padapter = pintfhdl->padapter; psdiodev = pintfhdl->pintf_dev; @@ -529,9 +529,9 @@ s32 _sd_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata) } func = psdio->func; -/* size = sdio_align_size(func, cnt); */ +/* size = sdio_align_size(func, cnt); */ - if (unlikely((cnt == 1) || (cnt ==2))) + if (unlikely((cnt == 1) || (cnt == 2))) { int i; u8 *pbuf = (u8 *)pdata; @@ -576,7 +576,7 @@ s32 sd_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata) PSDIO_DATA psdio; struct sdio_func *func; bool claim_needed; - s32 err =-EPERM; + s32 err = -EPERM; padapter = pintfhdl->padapter; psdiodev = pintfhdl->pintf_dev; -- cgit v1.2.3-55-g7522 From 2f1e2772ecebd423f211748de4389f76f0a47230 Mon Sep 17 00:00:00 2001 From: Adheer Chandravanshi Date: Wed, 3 May 2017 07:37:52 +0530 Subject: staging: rtl8723bs: Fix coding style issues checkpatch.pl reported errors for use of extra whitespaces in the function prototypes. Removed extra spaces to meet the coding standards. Signed-off-by: Adheer Chandravanshi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/rtl8192c_rf.h | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/include/rtl8192c_rf.h b/drivers/staging/rtl8723bs/include/rtl8192c_rf.h index 0dbee562d19b..97900a31b326 100644 --- a/drivers/staging/rtl8723bs/include/rtl8192c_rf.h +++ b/drivers/staging/rtl8723bs/include/rtl8192c_rf.h @@ -19,19 +19,16 @@ /* */ /* RF RL6052 Series API */ /* */ -void rtl8192c_RF_ChangeTxPath(struct adapter *Adapter, - u16 DataRate); -void rtl8192c_PHY_RF6052SetBandwidth( - struct adapter * Adapter, - enum CHANNEL_WIDTH Bandwidth); -void rtl8192c_PHY_RF6052SetCckTxPower( - struct adapter *Adapter, - u8* pPowerlevel); -void rtl8192c_PHY_RF6052SetOFDMTxPower( - struct adapter *Adapter, - u8* pPowerLevel, - u8 Channel); -int PHY_RF6052_Config8192C(struct adapter * Adapter ); +void rtl8192c_RF_ChangeTxPath(struct adapter *Adapter, + u16 DataRate); +void rtl8192c_PHY_RF6052SetBandwidth(struct adapter *Adapter, + enum CHANNEL_WIDTH Bandwidth); +void rtl8192c_PHY_RF6052SetCckTxPower(struct adapter *Adapter, + u8 *pPowerlevel); +void rtl8192c_PHY_RF6052SetOFDMTxPower(struct adapter *Adapter, + u8 *pPowerLevel, + u8 Channel); +int PHY_RF6052_Config8192C(struct adapter *Adapter); /*--------------------------Exported Function prototype---------------------*/ -- cgit v1.2.3-55-g7522 From 3bca7cf81faa9e772ec58ccad645bf4d0f0600b3 Mon Sep 17 00:00:00 2001 From: Jaya Durga Date: Fri, 5 May 2017 10:11:54 +0530 Subject: Staging: rtl8712: ieee80211: fixed brace coding style issue Fixed coding style issue Signed-off-by: Jaya Durga Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/ieee80211.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c index f35121eedac6..0689f4537b94 100644 --- a/drivers/staging/rtl8712/ieee80211.c +++ b/drivers/staging/rtl8712/ieee80211.c @@ -197,9 +197,10 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv) pdev_network->rates, &sz); ie = r8712_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->rates + 8), &sz); - } else + } else { ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_, rateLen, pdev_network->rates, &sz); + } /*DS parameter set*/ ie = r8712_set_ie(ie, _DSSET_IE_, 1, (u8 *)&pdev_network->Configuration.DSConfig, &sz); -- cgit v1.2.3-55-g7522 From 318dda31fb52f279895c9e20f52bb4f9b91a2ce8 Mon Sep 17 00:00:00 2001 From: Justin Vreeland Date: Mon, 1 May 2017 18:52:48 -0600 Subject: staging: rtl8723bs: Fix initialization of static variables Do not initialize static to 0 Do not initialize static to false Signed-off-by: Justin Vreeland Reviewed-by: Bastien Nocera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 8 ++++---- drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 4 ++-- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +- drivers/staging/rtl8723bs/hal/odm_DIG.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c index 86040adb436c..37f42bfc55ed 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c @@ -404,7 +404,7 @@ static void halbtc8723b1ant_MonitorWiFiCtr(PBTC_COEXIST pBtCoexist) { s32 wifiRssi = 0; bool bWifiBusy = false, bWifiUnderBMode = false; - static u8 nCCKLockCounter = 0; + static u8 nCCKLockCounter; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); @@ -488,7 +488,7 @@ static void halbtc8723b1ant_MonitorWiFiCtr(PBTC_COEXIST pBtCoexist) static bool halbtc8723b1ant_IsWifiStatusChanged(PBTC_COEXIST pBtCoexist) { - static bool bPreWifiBusy = false, bPreUnder4way = false, bPreBtHsOn = false; + static bool bPreWifiBusy, bPreUnder4way, bPreBtHsOn; bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; bool bWifiConnected = false; @@ -2754,7 +2754,7 @@ void EXhalbtc8723b1ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist) u32 wifiBw, wifiTrafficDir, faOfdm, faCck, wifiLinkStatus; u8 wifiDot11Chnl, wifiHsChnl; u32 fwVer = 0, btPatchVer = 0; - static u8 PopReportIn10s = 0; + static u8 PopReportIn10s; CL_SPRINTF( cliBuf, @@ -3751,7 +3751,7 @@ void EXhalbtc8723b1ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) void EXhalbtc8723b1ant_Periodical(PBTC_COEXIST pBtCoexist) { - static u8 disVerInfoCnt = 0; + static u8 disVerInfoCnt; u32 fwVer = 0, btPatchVer = 0; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ==========================Periodical ===========================\n")); diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c index f5bc511d02f2..33610d39333f 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c @@ -282,7 +282,7 @@ static void halbtc8723b2ant_QueryBtInfo(PBTC_COEXIST pBtCoexist) static bool halbtc8723b2ant_IsWifiStatusChanged(PBTC_COEXIST pBtCoexist) { - static bool bPreWifiBusy = false, bPreUnder4way = false, bPreBtHsOn = false; + static bool bPreWifiBusy, bPreUnder4way, bPreBtHsOn; bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; bool bWifiConnected = false; @@ -3706,7 +3706,7 @@ void EXhalbtc8723b2ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) void EXhalbtc8723b2ant_Periodical(PBTC_COEXIST pBtCoexist) { - static u8 disVerInfoCnt = 0; + static u8 disVerInfoCnt; u32 fwVer = 0, btPatchVer = 0; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ==========================Periodical ===========================\n")); diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index cc7e0903ee9d..9e08a4de4895 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -385,7 +385,7 @@ static s32 halbtcoutsrc_GetWifiRssi(struct adapter *padapter) static u8 halbtcoutsrc_GetWifiScanAPNum(struct adapter *padapter) { struct mlme_ext_priv *pmlmeext; - static u8 scan_AP_num = 0; + static u8 scan_AP_num; pmlmeext = &padapter->mlmeextpriv; diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c b/drivers/staging/rtl8723bs/hal/odm_DIG.c index ba8e8eb534ef..202c52f488ae 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.c +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c @@ -372,7 +372,7 @@ void odm_PauseDIG( { PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - static bool bPaused = false; + static bool bPaused; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG() =========>\n")); -- cgit v1.2.3-55-g7522 From e803a374e98c9cb6ec67af15758e1b27f146dfaf Mon Sep 17 00:00:00 2001 From: Justin Vreeland Date: Mon, 1 May 2017 18:52:49 -0600 Subject: staging: rtl8723bs: Wrap multi-line macros in do-while loop Wrapping in do-while ensures macros are executed as expected. Signed-off-by: Justin Vreeland Reviewed-by: Bastien Nocera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/odm_debug.h | 81 +++++++++++++++++-------------- 1 file changed, 45 insertions(+), 36 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.h b/drivers/staging/rtl8723bs/hal/odm_debug.h index 2ec4baf57464..ff131361248c 100644 --- a/drivers/staging/rtl8723bs/hal/odm_debug.h +++ b/drivers/staging/rtl8723bs/hal/odm_debug.h @@ -105,51 +105,60 @@ #if DBG #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)\ - if (\ - (comp & pDM_Odm->DebugComponents) &&\ - (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)\ - ) {\ - RT_PRINTK fmt;\ - } + do {\ + if (\ + (comp & pDM_Odm->DebugComponents) &&\ + (level <= pDM_Odm->DebugLevel ||\ + level == ODM_DBG_SERIOUS)\ + ) {\ + RT_PRINTK fmt;\ + } \ + } while (0) #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)\ - if (\ - (comp & pDM_Odm->DebugComponents) &&\ - (level <= pDM_Odm->DebugLevel)\ - ) {\ - RT_PRINTK fmt;\ - } + do {\ + if (\ + (comp & pDM_Odm->DebugComponents) &&\ + (level <= pDM_Odm->DebugLevel)\ + ) {\ + RT_PRINTK fmt;\ + } \ + } while (0) #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)\ - if (!expr) {\ - DbgPrint("Assertion failed! %s at ......\n", #expr);\ - DbgPrint(\ - " ......%s,%s, line =%d\n",\ - __FILE__,\ - __func__,\ - __LINE__\ - );\ - RT_PRINTK fmt;\ - ASSERT(false);\ - } + do {\ + if (!expr) {\ + DbgPrint("Assertion failed! %s at ......\n", #expr);\ + DbgPrint(\ + " ......%s,%s, line =%d\n",\ + __FILE__,\ + __func__,\ + __LINE__\ + );\ + RT_PRINTK fmt;\ + ASSERT(false);\ + } \ + } while (0) #define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); } #define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); } #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); } #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)\ - if (\ - (comp & pDM_Odm->DebugComponents) &&\ - (level <= pDM_Odm->DebugLevel)\ - ) {\ - int __i;\ - u8 *__ptr = (u8 *)ptr;\ - DbgPrint("[ODM] ");\ - DbgPrint(title_str);\ - DbgPrint(" ");\ - for (__i = 0; __i < 6; __i++)\ - DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\ - DbgPrint("\n");\ - } + do {\ + if (\ + (comp & pDM_Odm->DebugComponents) &&\ + (level <= pDM_Odm->DebugLevel)\ + ) {\ + int __i;\ + u8 *__ptr = (u8 *)ptr;\ + DbgPrint("[ODM] ");\ + DbgPrint(title_str);\ + DbgPrint(" ");\ + for (__i = 0; __i < 6; __i++)\ + DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\ + DbgPrint("\n");\ + } \ + } while (0) #else #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) no_printk fmt #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) no_printk fmt -- cgit v1.2.3-55-g7522 From 77503165b8caae24f400477cc897632671c1d143 Mon Sep 17 00:00:00 2001 From: Justin Vreeland Date: Mon, 1 May 2017 18:52:50 -0600 Subject: staging: rtl8723bs: Macros with complex values should be enclosed in parentheses Enclosing macros with complex values ensures expression is evaluated as expected. Signed-off-by: Justin Vreeland Reviewed-by: Bastien Nocera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/odm.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 0b3541a91548..87a76bafecb3 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -209,7 +209,10 @@ typedef struct _ODM_RATE_ADAPTIVE { #define AVG_THERMAL_NUM 8 #define IQK_Matrix_REG_NUM 8 -#define IQK_Matrix_Settings_NUM 14+24+21 /* Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G */ +#define IQK_Matrix_Settings_NUM (14 + 24 + 21) /* Channels_2_4G_NUM + * + Channels_5G_20M_NUM + * + Channels_5G + */ #define DM_Type_ByFW 0 #define DM_Type_ByDriver 1 -- cgit v1.2.3-55-g7522 From 67d1ca7e5f76fe4e1722a837aab6cd93b591eabf Mon Sep 17 00:00:00 2001 From: Justin Vreeland Date: Mon, 1 May 2017 18:52:51 -0600 Subject: staging: rtl8723bs: Move braces to same line as conditional Ensure checkpatch compliance Signed-off-by: Justin Vreeland Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c | 18 ++++++++---------- drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c | 12 ++++++------ drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 9 ++++----- 3 files changed, 18 insertions(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c index 28d1a229c3a6..21ec890fd60c 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c @@ -385,8 +385,7 @@ s32 PHY_MACConfig8723B(struct adapter *Adapter) /* Config MAC */ /* */ rtStatus = phy_ConfigMACWithParaFile(Adapter, pszMACRegFile); - if (rtStatus == _FAIL) - { + if (rtStatus == _FAIL) { ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv); rtStatus = _SUCCESS; } @@ -459,8 +458,7 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter) Adapter->registrypriv.RegEnableTxPowerLimit == 1 || (Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1) ) { - if (PHY_ConfigRFWithPowerLimitTableParaFile(Adapter, pszRFTxPwrLmtFile) == _FAIL) - { + if (PHY_ConfigRFWithPowerLimitTableParaFile(Adapter, pszRFTxPwrLmtFile) == _FAIL) { if (HAL_STATUS_SUCCESS != ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_TXPWR_LMT, (ODM_RF_RADIO_PATH_E)0)) rtStatus = _FAIL; } @@ -474,8 +472,8 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter) /* */ /* 1. Read PHY_REG.TXT BB INIT!! */ /* */ - if (phy_ConfigBBWithParaFile(Adapter, pszBBRegFile, CONFIG_BB_PHY_REG) == _FAIL) - { + if (phy_ConfigBBWithParaFile(Adapter, pszBBRegFile, CONFIG_BB_PHY_REG) == + _FAIL) { if (HAL_STATUS_SUCCESS != ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG)) rtStatus = _FAIL; } @@ -491,8 +489,8 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter) Adapter->registrypriv.RegEnableTxPowerByRate == 1 || (Adapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory != 2) ) { - if (phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile) == _FAIL) - { + if (phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile) == + _FAIL) { if (HAL_STATUS_SUCCESS != ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG)) rtStatus = _FAIL; } @@ -514,8 +512,8 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter) /* */ /* 2. Read BB AGC table Initialization */ /* */ - if (phy_ConfigBBWithParaFile(Adapter, pszAGCTableFile, CONFIG_BB_AGC_TAB) == _FAIL) - { + if (phy_ConfigBBWithParaFile(Adapter, pszAGCTableFile, + CONFIG_BB_AGC_TAB) == _FAIL) { if (HAL_STATUS_SUCCESS != ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB)) rtStatus = _FAIL; } diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c index 3a85d0cddfda..a71b552eca9a 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c @@ -144,15 +144,15 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) /*----Initialize RF fom connfiguration file----*/ switch (eRFPath) { case RF_PATH_A: - if (PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, eRFPath) == _FAIL) - { + if (PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, + eRFPath) == _FAIL) { if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath)) rtStatus = _FAIL; } break; case RF_PATH_B: - if (PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, eRFPath) == _FAIL) - { + if (PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, + eRFPath) == _FAIL) { if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath)) rtStatus = _FAIL; } @@ -186,8 +186,8 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) /* 3 Configuration of Tx Power Tracking */ /* 3 ----------------------------------------------------------------- */ - if (PHY_ConfigRFWithTxPwrTrackParaFile(Adapter, pszTxPwrTrackFile) == _FAIL) - { + if (PHY_ConfigRFWithTxPwrTrackParaFile(Adapter, pszTxPwrTrackFile) == + _FAIL) { ODM_ConfigRFWithTxPwrTrackHeaderFile(&pHalData->odmpriv); } diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c index ca6ad9659b09..505e122bdfb5 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c @@ -23,8 +23,7 @@ static u8 rtw_sdio_wait_enough_TxOQT_space(struct adapter *padapter, u8 agg_num) u32 n = 0; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - while (pHalData->SdioTxOQTFreeSpace < agg_num) - { + while (pHalData->SdioTxOQTFreeSpace < agg_num) { if ( (padapter->bSurpriseRemoved == true) || (padapter->bDriverStopped == true) @@ -299,7 +298,8 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv ) { if (pxmitbuf) { /* pxmitbuf->priv_data will be NULL, and will crash here */ - if (pxmitbuf->len > 0 && pxmitbuf->priv_data) { + if (pxmitbuf->len > 0 && + pxmitbuf->priv_data) { struct xmit_frame *pframe; pframe = (struct xmit_frame*)pxmitbuf->priv_data; pframe->agg_num = k; @@ -400,8 +400,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv pxmitbuf->priv_data = NULL; enqueue_pending_xmitbuf(pxmitpriv, pxmitbuf); yield(); - } - else + } else rtw_free_xmitbuf(pxmitpriv, pxmitbuf); pxmitbuf = NULL; } -- cgit v1.2.3-55-g7522 From 69d59bebccf7720d318b8535fb41782d133f1b85 Mon Sep 17 00:00:00 2001 From: Justin Vreeland Date: Mon, 1 May 2017 18:52:52 -0600 Subject: staging: rtl8723bs: Fix pointer style Fix "(foo*)" should be "(foo *)" Fix "foo * bar" should be "foo *bar" Signed-off-by: Justin Vreeland Reviewed-by: Bastien Nocera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c index 505e122bdfb5..7978a987b31c 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c @@ -58,7 +58,7 @@ static s32 rtl8723_dequeue_writeport(struct adapter *padapter) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); struct xmit_buf *pxmitbuf; - struct adapter * pri_padapter = padapter; + struct adapter *pri_padapter = padapter; s32 ret = 0; u8 PageIdx = 0; u32 deviceId; @@ -301,7 +301,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv if (pxmitbuf->len > 0 && pxmitbuf->priv_data) { struct xmit_frame *pframe; - pframe = (struct xmit_frame*)pxmitbuf->priv_data; + pframe = (struct xmit_frame *)pxmitbuf->priv_data; pframe->agg_num = k; pxmitbuf->agg_num = k; rtl8723b_update_txdesc(pframe, pframe->buf_addr); @@ -392,7 +392,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv if (pxmitbuf->len > 0) { struct xmit_frame *pframe; - pframe = (struct xmit_frame*)pxmitbuf->priv_data; + pframe = (struct xmit_frame *)pxmitbuf->priv_data; pframe->agg_num = k; pxmitbuf->agg_num = k; rtl8723b_update_txdesc(pframe, pframe->buf_addr); -- cgit v1.2.3-55-g7522 From 46e17f83f85e39da152d3a62c76817e34708f03d Mon Sep 17 00:00:00 2001 From: Justin Vreeland Date: Mon, 1 May 2017 18:52:53 -0600 Subject: staging: rtl8723bs: Fix spacing around '<' Ensure checkpatch compliance Signed-off-by: Justin Vreeland Reviewed-by: Bastien Nocera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c index 7978a987b31c..d654b3438af1 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c @@ -230,7 +230,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv pxmitbuf = NULL; if (padapter->registrypriv.wifi_spec == 1) { - for (idx = 0; idx<4; idx++) + for (idx = 0; idx < 4; idx++) inx[idx] = pxmitpriv->wmm_para_seq[idx]; } else { inx[0] = 0; -- cgit v1.2.3-55-g7522 From 25b20f6d83d3a80f42cc092df404b640217746a7 Mon Sep 17 00:00:00 2001 From: Justin Vreeland Date: Mon, 1 May 2017 18:52:54 -0600 Subject: staging: rtl8723bs: Do not use assignment in if condition Ensure checkpatch compliance Signed-off-by: Justin Vreeland Reviewed-by: Bastien Nocera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c index d654b3438af1..9bee2e40be32 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c @@ -610,7 +610,8 @@ s32 rtl8723bs_hal_xmitframe_enqueue( struct xmit_priv *pxmitpriv = &padapter->xmitpriv; s32 err; - if ((err = rtw_xmitframe_enqueue(padapter, pxmitframe)) != _SUCCESS) { + err = rtw_xmitframe_enqueue(padapter, pxmitframe); + if (err != _SUCCESS) { rtw_free_xmitframe(pxmitpriv, pxmitframe); pxmitpriv->tx_drop++; -- cgit v1.2.3-55-g7522 From 789bf45ace8045ed53cf5d2c53185edf0db28e73 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Wed, 3 May 2017 00:28:10 -0300 Subject: staging: unisys: Solve sparse warning The following commit fixes the following sparse report: drivers/staging//unisys/visorhba/visorhba_main.c:660:29: warning: cast to restricted __le64 by casting readq (which is unsigned long on x86) to u64, as expected by the seq_printf call. Signed-off-by: Marcos Paulo de Souza Acked-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorhba/visorhba_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 6997b16b4dcd..46d33e65fbed 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -657,7 +657,7 @@ static int info_debugfs_show(struct seq_file *seq, void *v) seq_printf(seq, "phys_flags_addr = 0x%016llx\n", phys_flags_addr); seq_printf(seq, "FeatureFlags = %llu\n", - (__le64)readq(devdata->flags_addr)); + (u64)readq(devdata->flags_addr)); } seq_printf(seq, "acquire_failed_cnt = %llu\n", devdata->acquire_failed_cnt); -- cgit v1.2.3-55-g7522 From 355e6e4913f1b3594f0d811e888fb6a572a81b2b Mon Sep 17 00:00:00 2001 From: Craig Kewley Date: Mon, 1 May 2017 21:22:35 +0100 Subject: staging: octeon: use __func__ instead of func name Fix checkpatch warning: WARNING: Prefer using '"%s...", __func__' to using 'INTERFACE' Signed-off-by: Craig Kewley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h index 617da8037a4d..cb5540dc0e9d 100644 --- a/drivers/staging/octeon/ethernet-util.h +++ b/drivers/staging/octeon/ethernet-util.h @@ -39,7 +39,7 @@ static inline int INTERFACE(int ipd_port) interface = cvmx_helper_get_interface_num(ipd_port); if (interface >= 0) return interface; - panic("Illegal ipd_port %d passed to INTERFACE\n", ipd_port); + panic("Illegal ipd_port %d passed to %s\n", ipd_port, __func__); } /** -- cgit v1.2.3-55-g7522 From e9837cd9e35b9e5a4e7c2ec69de28eeeb903401b Mon Sep 17 00:00:00 2001 From: Jason Litzinger Date: Sat, 29 Apr 2017 07:46:47 -0600 Subject: staging: wilc1000: Refactor handling of HT caps fields This addresses the following sparse warnings: drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51: expected unsigned short [unsigned] [assigned] [usertype] ht_capa_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51: got restricted __le16 const [usertype] cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52: expected unsigned short [unsigned] [assigned] [usertype] ht_ext_params drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52: got restricted __le16 const [usertype] extended_ht_cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51: expected unsigned int [unsigned] [assigned] [usertype] ht_tx_bf_cap drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51: got restricted __le32 const [usertype] tx_BF_cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51: expected unsigned short [unsigned] [assigned] [usertype] ht_capa_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51: got restricted __le16 const [usertype] cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52: expected unsigned short [unsigned] [assigned] [usertype] ht_ext_params drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52: got restricted __le16 const [usertype] extended_ht_cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51: expected unsigned int [unsigned] [assigned] [usertype] ht_tx_bf_cap drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51: got restricted __le32 const [usertype] tx_BF_cap_info This is not the first attempt to address this problem: https://lkml.org/lkml/2017/3/7/808 First, the current code works because the final use of the ht_capa values (in host_interface.c: WILC_HostIf_PackStaParam) packs them into a buffer in little-endian format. Since this matches the byte-order of struct ieee80211_ht_cap, all is seemingly well. What the current code does not do, and what these warnings expose, is clearly communicate what the fields in struct add_sta_param represent -- values with a specific (little endian) byte order. This will lead to problems if the values are ever actually used by the host, and that host is not little endian. The proposed change addresses this by embedding a struct ieee80211_ht_cap into struct add_sta_param. When the values are later packed out, the newly embedded struct is copied directly into the outbound buffer. All 16 and 32 bit types are treated as little endian and marked as such. Future use of the values by the host would still require conversion, or sparse would flag them again. The following items are required for this to be correct: 1. The data is not currently used by the host. 2. struct ieee80211_ht_cap is packed. 3. The packing of the fields matches the order in struct ieee80211_ht_cap. This is similar, I believe, to how the same data is handled in marvell/mwifiex/11n.c. Test-compiled/loaded against staging-next on x86_64 Test-compiled against staging-next for ARM. Applied/built against staging-testing. Testing consists of compilation for the above trees/targets, and a sparse check, no functional testing. Signed-off-by: Jason Litzinger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 20 +++----------------- drivers/staging/wilc1000/host_interface.h | 10 ++-------- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 18 ++---------------- 3 files changed, 7 insertions(+), 41 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c3a8af081880..c8e3229a2809 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2052,23 +2052,9 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, pu8CurrByte += pstrStationParam->rates_len; *pu8CurrByte++ = pstrStationParam->ht_supported; - *pu8CurrByte++ = pstrStationParam->ht_capa_info & 0xFF; - *pu8CurrByte++ = (pstrStationParam->ht_capa_info >> 8) & 0xFF; - - *pu8CurrByte++ = pstrStationParam->ht_ampdu_params; - memcpy(pu8CurrByte, pstrStationParam->ht_supp_mcs_set, - WILC_SUPP_MCS_SET_SIZE); - pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; - - *pu8CurrByte++ = pstrStationParam->ht_ext_params & 0xFF; - *pu8CurrByte++ = (pstrStationParam->ht_ext_params >> 8) & 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->ht_ante_sel; + memcpy(pu8CurrByte, &pstrStationParam->ht_capa, + sizeof(struct ieee80211_ht_cap)); + pu8CurrByte += sizeof(struct ieee80211_ht_cap); *pu8CurrByte++ = pstrStationParam->flags_mask & 0xFF; *pu8CurrByte++ = (pstrStationParam->flags_mask >> 8) & 0xFF; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index f36d3b5a0370..0e72b9193734 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -1,6 +1,6 @@ #ifndef HOST_INT_H #define HOST_INT_H - +#include #include "coreconfigurator.h" #define IP_ALEN 4 @@ -47,7 +47,6 @@ #define ETH_ALEN 6 #define PMKID_LEN 16 #define WILC_MAX_NUM_PMKIDS 16 -#define WILC_SUPP_MCS_SET_SIZE 16 #define WILC_ADD_STA_LENGTH 40 #define SCAN_EVENT_DONE_ABORTED #define NUM_CONCURRENT_IFC 2 @@ -289,12 +288,7 @@ struct add_sta_param { u8 rates_len; const u8 *rates; bool ht_supported; - u16 ht_capa_info; - u8 ht_ampdu_params; - u8 ht_supp_mcs_set[16]; - u16 ht_ext_params; - u32 ht_tx_bf_cap; - u8 ht_ante_sel; + struct ieee80211_ht_cap ht_capa; u16 flags_mask; u16 flags_set; }; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 44a12bdd6a46..807aada308e3 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2003,14 +2003,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_supported = false; } else { 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.ht_supp_mcs_set, - ¶ms->ht_capa->mcs, - 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.ht_ante_sel = params->ht_capa->antenna_selection_info; + strStaParams.ht_capa = *params->ht_capa; } strStaParams.flags_mask = params->sta_flags_mask; @@ -2075,14 +2068,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_supported = false; } else { 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.ht_supp_mcs_set, - ¶ms->ht_capa->mcs, - 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.ht_ante_sel = params->ht_capa->antenna_selection_info; + strStaParams.ht_capa = *params->ht_capa; } strStaParams.flags_mask = params->sta_flags_mask; -- cgit v1.2.3-55-g7522 From 588c1840e2bc281c3a97d02d6f607de17189bd59 Mon Sep 17 00:00:00 2001 From: Vincent Siles Date: Tue, 2 May 2017 16:18:39 +0200 Subject: staging: wilc1000: Last line is empty Removing empty line at the end of the file Signed-off-by: Vincent Siles Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_debugfs.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index 7d32de930576..5c93c7c22652 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -122,4 +122,3 @@ static void __exit wilc_debugfs_remove(void) module_exit(wilc_debugfs_remove); #endif - -- cgit v1.2.3-55-g7522 From 8bf2f0b22b5e93fcff13d8b041fffbc2610cbf51 Mon Sep 17 00:00:00 2001 From: Vincent Siles Date: Tue, 2 May 2017 16:18:40 +0200 Subject: staging: wilc1000: Stripping '-' comments Removing some '-' comments to fit in the 80 characters limit Signed-off-by: Vincent Siles Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index 5c93c7c22652..4c28ee2b759a 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -20,7 +20,7 @@ static struct dentry *wilc_dir; /* - * -------------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- */ #define DEBUG BIT(0) #define INFO BIT(1) @@ -32,7 +32,7 @@ static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR); EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL); /* - * -------------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- */ static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) @@ -75,7 +75,7 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf, } /* - * -------------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- */ #define FOPS(_open, _read, _write, _poll) { \ -- cgit v1.2.3-55-g7522 From 896fce0c68f07b5f09ed8af630956c72f34243f2 Mon Sep 17 00:00:00 2001 From: Vincent Siles Date: Tue, 2 May 2017 16:18:41 +0200 Subject: staging: wilc1000: Function signature too long Splitting functions signature across several lines to fin in the 80 characters limit Signed-off-by: Vincent Siles Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_debugfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index 4c28ee2b759a..a225244c2a83 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -35,7 +35,8 @@ EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL); * ---------------------------------------------------------------------------- */ -static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) +static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) { char buf[128]; int res = 0; @@ -49,8 +50,9 @@ static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, si return simple_read_from_buffer(userbuf, count, ppos, buf, res); } -static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf, - size_t count, loff_t *ppos) +static ssize_t wilc_debug_level_write(struct file *filp, + const char __user *buf, size_t count, + loff_t *ppos) { int flag = 0; int ret; -- cgit v1.2.3-55-g7522 From c584282b628e644ab8346a17075c111aec0bad13 Mon Sep 17 00:00:00 2001 From: Vincent Siles Date: Tue, 2 May 2017 16:18:42 +0200 Subject: staging: wilc1000: Function calls too long Splitting function calls across multiple lines to fit in the 80 characters limit Signed-off-by: Vincent Siles Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index a225244c2a83..12d356a148d5 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -45,7 +45,8 @@ static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, if (*ppos > 0) return 0; - res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&WILC_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); } @@ -62,7 +63,8 @@ static ssize_t wilc_debug_level_write(struct file *filp, return ret; if (flag > DBG_LEVEL_ALL) { - pr_info("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC_DEBUG_LEVEL)); + pr_info("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", + __func__, flag, atomic_read(&WILC_DEBUG_LEVEL)); return -EINVAL; } -- cgit v1.2.3-55-g7522 From bb3fd8698806b30224f70b537963b76f50489cb5 Mon Sep 17 00:00:00 2001 From: Vincent Siles Date: Tue, 2 May 2017 16:18:43 +0200 Subject: staging: wilc1000: Fixing struct definition layout Split struct definition across multiple line to fit in the 80 characters limit Signed-off-by: Vincent Siles Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_debugfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index 12d356a148d5..ce54864569c7 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -98,7 +98,12 @@ struct wilc_debugfs_info_t { }; static struct wilc_debugfs_info_t debugfs_info[] = { - { "wilc_debug_level", 0666, (DEBUG | ERR), FOPS(NULL, wilc_debug_level_read, wilc_debug_level_write, NULL), }, + { + "wilc_debug_level", + 0666, + (DEBUG | ERR), + FOPS(NULL, wilc_debug_level_read, wilc_debug_level_write, NULL), + }, }; static int __init wilc_debugfs_init(void) -- cgit v1.2.3-55-g7522 From c3972591d991a82bad67522a60a3a0d8f7dceb56 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 29 Apr 2017 13:03:42 +0100 Subject: staging: vt6656: vnt_update_ifs set max_min based on short slot time. Short slot time is controlled by mac80211 so there is no need to find odfm rates. Merge PK_TYPE_11B and PK_TYPE_11GA & PK_TYPE_11GB into one else and switch on short slot time. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/card.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 0e5a99375099..c61422ea8846 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -359,35 +359,18 @@ void vnt_update_ifs(struct vnt_private *priv) priv->sifs = C_SIFS_A; priv->difs = C_SIFS_A + 2 * C_SLOT_SHORT; max_min = 4; - } else if (priv->packet_type == PK_TYPE_11B) { - priv->slot = C_SLOT_LONG; - priv->sifs = C_SIFS_BG; - priv->difs = C_SIFS_BG + 2 * C_SLOT_LONG; - max_min = 5; - } else {/* PK_TYPE_11GA & PK_TYPE_11GB */ - bool ofdm_rate = false; - unsigned int ii = 0; - + } else { priv->sifs = C_SIFS_BG; - if (priv->short_slot_time) + if (priv->short_slot_time) { priv->slot = C_SLOT_SHORT; - else + max_min = 4; + } else { priv->slot = C_SLOT_LONG; - - priv->difs = C_SIFS_BG + 2 * priv->slot; - - for (ii = RATE_54M; ii >= RATE_6M; ii--) { - if (priv->basic_rates & ((u32)(0x1 << ii))) { - ofdm_rate = true; - break; - } + max_min = 5; } - if (ofdm_rate) - max_min = 4; - else - max_min = 5; + priv->difs = C_SIFS_BG + 2 * priv->slot; } priv->eifs = C_EIFS; -- cgit v1.2.3-55-g7522 From 66e496c4131905e6097aec143b7de88c766c043f Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 29 Apr 2017 13:03:43 +0100 Subject: staging: vt6656: always call vnt_update_ifs on short time change. short time change needs to synchronize parameters in vnt_update_ifs so a call to the function is always necessary. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/main_usb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 028f54b453d0..9237930991ca 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -715,6 +715,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, priv->short_slot_time = false; vnt_set_short_slot_time(priv); + vnt_update_ifs(priv); vnt_set_vga_gain_offset(priv, priv->bb_vga[0]); vnt_update_pre_ed_threshold(priv, false); } -- cgit v1.2.3-55-g7522 From dc32190f2cd41c7dba25363ea7d618d4f5172b4e Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 29 Apr 2017 13:03:44 +0100 Subject: staging: vt6556: vnt_start Fix missing call to vnt_key_init_table. The key table is not intialized correctly without this call. Signed-off-by: Malcolm Priestley Cc: # v3.17+ Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/main_usb.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 9237930991ca..06f7841d44d3 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -513,6 +513,9 @@ static int vnt_start(struct ieee80211_hw *hw) goto free_all; } + if (vnt_key_init_table(priv)) + goto free_all; + priv->int_interval = 1; /* bInterval is set to 1 */ vnt_int_start_interrupt(priv); -- cgit v1.2.3-55-g7522 From c12603576e06689af0bc62b4017eeb99ceda84d6 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 29 Apr 2017 13:03:45 +0100 Subject: staging: vt6656: Only call vnt_set_bss_mode on basic rates change. To ensure the bss is always synchronized only call on basic rate change. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/main_usb.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 06f7841d44d3..095b85567306 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -637,7 +637,6 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed) { struct vnt_private *priv = hw->priv; struct ieee80211_conf *conf = &hw->conf; - u8 bb_type; if (changed & IEEE80211_CONF_CHANGE_PS) { if (conf->flags & IEEE80211_CONF_PS) @@ -651,15 +650,9 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed) vnt_set_channel(priv, conf->chandef.chan->hw_value); if (conf->chandef.chan->band == NL80211_BAND_5GHZ) - bb_type = BB_TYPE_11A; + priv->bb_type = BB_TYPE_11A; else - bb_type = BB_TYPE_11G; - - if (priv->bb_type != bb_type) { - priv->bb_type = bb_type; - - vnt_set_bss_mode(priv); - } + priv->bb_type = BB_TYPE_11G; } if (changed & IEEE80211_CONF_CHANGE_POWER) { @@ -690,6 +683,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, priv->basic_rates = conf->basic_rates; vnt_update_top_rates(priv); + vnt_set_bss_mode(priv); dev_dbg(&priv->usb->dev, "basic rates %x\n", conf->basic_rates); } @@ -850,7 +844,6 @@ static void vnt_sw_scan_start(struct ieee80211_hw *hw, { struct vnt_private *priv = hw->priv; - vnt_set_bss_mode(priv); /* Set max sensitivity*/ vnt_update_pre_ed_threshold(priv, true); } -- cgit v1.2.3-55-g7522 From d9d1ffd4bf80ebf77609c145e2e97e2cfd4f8f02 Mon Sep 17 00:00:00 2001 From: Cezary Gapinski Date: Sat, 29 Apr 2017 19:54:30 +0200 Subject: staging/ks7010: Fix type assignment for struct hostif_hdr Sparse spits out a warnings about __le16 and unsigned short assignment. Change the type of size and event members of struct hostif_hdr to __le16 and correct conversion to the proper cpu type. Signed-off-by: Cezary Gapinski Reviewed-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks7010_sdio.c | 10 ++++++---- drivers/staging/ks7010/ks_hostif.h | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index c325f4846209..9b28ee1cfb1e 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -269,7 +269,8 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer, hdr = (struct hostif_hdr *)buffer; DPRINTK(4, "size=%d\n", hdr->size); - if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) { + if (le16_to_cpu(hdr->event) < HIF_DATA_REQ || + le16_to_cpu(hdr->event) > HIF_REQ_MAX) { DPRINTK(1, "unknown event=%04X\n", hdr->event); return 0; } @@ -327,13 +328,14 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, hdr = (struct hostif_hdr *)p; - if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) { + if (le16_to_cpu(hdr->event) < HIF_DATA_REQ || + le16_to_cpu(hdr->event) > HIF_REQ_MAX) { DPRINTK(1, "unknown event=%04X\n", hdr->event); return 0; } /* add event to hostt buffer */ - priv->hostt.buff[priv->hostt.qtail] = hdr->event; + priv->hostt.buff[priv->hostt.qtail] = le16_to_cpu(hdr->event); priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE; DPRINTK(4, "event=%04X\n", hdr->event); @@ -403,7 +405,7 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size) hdr = (struct hostif_hdr *)&rx_buffer->data[0]; rx_buffer->size = le16_to_cpu(hdr->size) + sizeof(hdr->size); - event = hdr->event; + event = le16_to_cpu(hdr->event); inc_rxqtail(priv); ret = ks7010_sdio_writeb(priv, READ_STATUS, REG_STATUS_IDLE); diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index d758076d419d..ff0ca77e39df 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -62,8 +62,8 @@ */ struct hostif_hdr { - u16 size; - u16 event; + __le16 size; + __le16 event; } __packed; struct hostif_data_request_t { -- cgit v1.2.3-55-g7522 From 93270634a32b2c4e5ff7c3f1987a5473b484623f Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Sat, 29 Apr 2017 22:58:41 +0200 Subject: staging: ks7010: avoid CamelCase in fields of struct local_gain_t Replace CamelCase fields of struct with underscores to comply with the standard kernel coding style Signed-off-by: Janusz Lisiecki Reviewed-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 6 +++--- drivers/staging/ks7010/ks_wlan.h | 8 ++++---- drivers/staging/ks7010/ks_wlan_net.c | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 49e95426ac30..6d6cbe1e1f9c 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -567,9 +567,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv) break; case LOCAL_GAIN: memcpy(&priv->gain, priv->rxp, sizeof(priv->gain)); - DPRINTK(3, "TxMode=%d, RxMode=%d, TxGain=%d, RxGain=%d\n", - priv->gain.TxMode, priv->gain.RxMode, priv->gain.TxGain, - priv->gain.RxGain); + DPRINTK(3, "tx_mode=%d, rx_mode=%d, tx_gain=%d, rx_gain=%d\n", + priv->gain.tx_mode, priv->gain.rx_mode, + priv->gain.tx_gain, priv->gain.rx_gain); break; case LOCAL_EEPROM_SUM: memcpy(&priv->eeprom_sum, priv->rxp, sizeof(priv->eeprom_sum)); diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h index cd4f56ddbea8..3767079be00d 100644 --- a/drivers/staging/ks7010/ks_wlan.h +++ b/drivers/staging/ks7010/ks_wlan.h @@ -264,10 +264,10 @@ struct local_aplist_t { }; struct local_gain_t { - u8 TxMode; - u8 RxMode; - u8 TxGain; - u8 RxGain; + u8 tx_mode; + u8 rx_mode; + u8 tx_gain; + u8 rx_gain; }; struct local_eeprom_sum_t { diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 5a43f193dcc8..0c778aa4bb7a 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -2378,14 +2378,14 @@ static int ks_wlan_set_tx_gain(struct net_device *dev, return -EPERM; /* for SLEEP MODE */ if (*uwrq >= 0 && *uwrq <= 0xFF) /* 0-255 */ - priv->gain.TxGain = (uint8_t)*uwrq; + priv->gain.tx_gain = (uint8_t)*uwrq; else return -EINVAL; - if (priv->gain.TxGain < 0xFF) - priv->gain.TxMode = 1; + if (priv->gain.tx_gain < 0xFF) + priv->gain.tx_mode = 1; else - priv->gain.TxMode = 0; + priv->gain.tx_mode = 0; hostif_sme_enqueue(priv, SME_SET_GAIN); return 0; @@ -2400,7 +2400,7 @@ static int ks_wlan_get_tx_gain(struct net_device *dev, if (priv->sleep_mode == SLP_SLEEP) return -EPERM; /* for SLEEP MODE */ - *uwrq = priv->gain.TxGain; + *uwrq = priv->gain.tx_gain; hostif_sme_enqueue(priv, SME_GET_GAIN); return 0; } @@ -2415,14 +2415,14 @@ static int ks_wlan_set_rx_gain(struct net_device *dev, return -EPERM; /* for SLEEP MODE */ if (*uwrq >= 0 && *uwrq <= 0xFF) /* 0-255 */ - priv->gain.RxGain = (uint8_t)*uwrq; + priv->gain.rx_gain = (uint8_t)*uwrq; else return -EINVAL; - if (priv->gain.RxGain < 0xFF) - priv->gain.RxMode = 1; + if (priv->gain.rx_gain < 0xFF) + priv->gain.rx_mode = 1; else - priv->gain.RxMode = 0; + priv->gain.rx_mode = 0; hostif_sme_enqueue(priv, SME_SET_GAIN); return 0; @@ -2437,7 +2437,7 @@ static int ks_wlan_get_rx_gain(struct net_device *dev, if (priv->sleep_mode == SLP_SLEEP) return -EPERM; /* for SLEEP MODE */ - *uwrq = priv->gain.RxGain; + *uwrq = priv->gain.rx_gain; hostif_sme_enqueue(priv, SME_GET_GAIN); return 0; } -- cgit v1.2.3-55-g7522 From 5e1cdda0e2c2f5ccf8216a35512c624c62f97e04 Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Sat, 29 Apr 2017 22:58:43 +0200 Subject: staging: ks7010: avoid CamelCase: FhParms_t fields Replace CamelCase struct field names with underscores to comply with the standard kernel coding style. Changed: - dwellTime - hopSet - hopPattern - hopIndex Signed-off-by: Janusz Lisiecki Reviewed-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index ff0ca77e39df..435aca389725 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -239,10 +239,10 @@ struct rate_set8_t { } __packed; struct FhParms_t { - u16 dwellTime; - u8 hopSet; - u8 hopPattern; - u8 hopIndex; + u16 dwell_time; + u8 hop_set; + u8 hop_pattern; + u8 hop_index; } __packed; struct DsParms_t { -- cgit v1.2.3-55-g7522 From eda237de2ba4e7c014e40600218dc21bb3a64597 Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Sat, 29 Apr 2017 22:58:44 +0200 Subject: staging: ks7010: avoid CamelCase: link_ap_info_t fields Replace CamelCase struct field names with underscores to comply with the standard kernel coding style. Changed: - FhParms_t - DsParms_t - CfParms_t - IbssParms_t - ErpParams_t Signed-off-by: Janusz Lisiecki Reviewed-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 435aca389725..64bad0efbf9e 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -238,25 +238,25 @@ struct rate_set8_t { u8 rate_pad; } __packed; -struct FhParms_t { +struct fh_parms_t { u16 dwell_time; u8 hop_set; u8 hop_pattern; u8 hop_index; } __packed; -struct DsParms_t { +struct ds_parms_t { u8 channel; } __packed; -struct CfParms_t { +struct cf_parms_t { u8 count; u8 period; u16 maxDuration; u16 durRemaining; } __packed; -struct IbssParms_t { +struct ibss_parms_t { u16 atimWindow; } __packed; @@ -266,7 +266,7 @@ struct rsn_t { u8 body[RSN_BODY_SIZE]; } __packed; -struct ErpParams_t { +struct erp_params_t { u8 erp_info; } __packed; @@ -312,11 +312,11 @@ struct link_ap_info_t { u16 beacon_period; /* +10 */ u16 capability; /* +12 */ struct rate_set8_t rate_set; /* +14 */ - struct FhParms_t fh_parameter; /* +24 */ - struct DsParms_t ds_parameter; /* +29 */ - struct CfParms_t cf_parameter; /* +30 */ - struct IbssParms_t ibss_parameter; /* +36 */ - struct ErpParams_t erp_parameter; /* +38 */ + struct fh_parms_t fh_parameter; /* +24 */ + struct ds_parms_t ds_parameter; /* +29 */ + struct cf_parms_t cf_parameter; /* +30 */ + struct ibss_parms_t ibss_parameter; /* +36 */ + struct erp_params_t erp_parameter; /* +38 */ u8 pad1; /* +39 */ struct rate_set8_t ext_rate_set; /* +40 */ u8 DTIM_period; /* +50 */ -- cgit v1.2.3-55-g7522 From f364422edf74c5454dab4c374f0226975f6623f0 Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Sat, 29 Apr 2017 22:58:45 +0200 Subject: staging: ks7010: avoid CamelCase: CfParms_t fields Replace CamelCase struct field names with underscores to comply with the standard kernel coding style. Changed: - maxDuration - durRemaining Signed-off-by: Janusz Lisiecki Reviewed-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 64bad0efbf9e..e39a0d90499c 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -252,8 +252,8 @@ struct ds_parms_t { struct cf_parms_t { u8 count; u8 period; - u16 maxDuration; - u16 durRemaining; + u16 max_duration; + u16 dur_remaining; } __packed; struct ibss_parms_t { -- cgit v1.2.3-55-g7522 From 49642ffdb82ec5f5a7764bdd93f0a18421364036 Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Sat, 29 Apr 2017 22:58:46 +0200 Subject: staging: ks7010: avoid CamelCase: atimWindow Replace CamelCase variable name with underscores to comply with the standard kernel coding style. Signed-off-by: Janusz Lisiecki Reviewed-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index e39a0d90499c..6e8878490903 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -257,7 +257,7 @@ struct cf_parms_t { } __packed; struct ibss_parms_t { - u16 atimWindow; + u16 atim_window; } __packed; struct rsn_t { -- cgit v1.2.3-55-g7522 From 1d6c26224b8346efb8b08b8c1d6bc6bf58c5d2bf Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Sat, 29 Apr 2017 22:58:47 +0200 Subject: staging: ks7010: avoid CamelCase: reqIEs_size and respIEs_size Replace CamelCase association_request_t and association_response_t struct field names with underscores to comply with the standard kernel coding style. Signed-off-by: Janusz Lisiecki Reviewed-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 10 +++++----- drivers/staging/ks7010/ks_hostif.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 6d6cbe1e1f9c..caf2551bc087 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -948,18 +948,18 @@ void hostif_associate_indication(struct ks_wlan_private *priv) wrqu.data.length += sizeof(associnfo_leader0) - 1; pbuf += sizeof(associnfo_leader0) - 1; - for (i = 0; i < assoc_req->reqIEs_size; i++) + for (i = 0; i < assoc_req->req_ies_size; i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); - wrqu.data.length += (assoc_req->reqIEs_size) * 2; + wrqu.data.length += (assoc_req->req_ies_size) * 2; memcpy(pbuf, associnfo_leader1, sizeof(associnfo_leader1) - 1); wrqu.data.length += sizeof(associnfo_leader1) - 1; pbuf += sizeof(associnfo_leader1) - 1; - pb += assoc_req->reqIEs_size; - for (i = 0; i < assoc_resp->respIEs_size; i++) + pb += assoc_req->req_ies_size; + for (i = 0; i < assoc_resp->resp_ies_size; i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); - wrqu.data.length += (assoc_resp->respIEs_size) * 2; + wrqu.data.length += (assoc_resp->resp_ies_size) * 2; pbuf += sprintf(pbuf, ")"); wrqu.data.length += 1; diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 6e8878490903..538600f9e376 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -481,7 +481,7 @@ struct association_request_t { u16 capability; u16 listen_interval; u8 ap_address[6]; - u16 reqIEs_size; + u16 req_ies_size; } __packed; struct association_response_t { @@ -492,14 +492,14 @@ struct association_response_t { u16 capability; u16 status; u16 association_id; - u16 respIEs_size; + u16 resp_ies_size; } __packed; struct hostif_associate_indication_t { struct hostif_hdr header; struct association_request_t assoc_req; struct association_response_t assoc_resp; - /* followed by (reqIEs_size + respIEs_size) octets of data */ + /* followed by (req_ies_size + resp_ies_size) octets of data */ /* reqIEs data *//* respIEs data */ } __packed; -- cgit v1.2.3-55-g7522 From 2ba8444c97b1ff72a80219d9baeec5e75995c926 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 2 May 2017 09:01:39 +0300 Subject: staging:r8188eu: move IV/ICV trimming into decrypt() and also place it after rtl88eu_mon_recv_hook() IV/ICV should be trimmed immediately after decoding (this is a decryptor job). Trim IV/ICV inside decrypt() for SW decrypted frames, for HW decrypted - before rtl88eu_mon_recv_hook(). Adopt frames receive process to work without IV/ICV fields. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_recv.c | 80 ++++++++++++------------------- 1 file changed, 30 insertions(+), 50 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index c6c4404e717b..e8f0ff93f05a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -259,12 +259,10 @@ static int recvframe_chkmic(struct adapter *adapter, } /* icv_len included the mic code */ - datalen = precvframe->pkt->len-prxattrib->hdrlen - - prxattrib->iv_len-prxattrib->icv_len-8; + datalen = precvframe->pkt->len-prxattrib->hdrlen - 8; pframe = precvframe->pkt->data; - payload = pframe+prxattrib->hdrlen+prxattrib->iv_len; + payload = pframe+prxattrib->hdrlen; - RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n prxattrib->iv_len=%d prxattrib->icv_len=%d\n", prxattrib->iv_len, prxattrib->icv_len)); rtw_seccalctkipmic(mickey, pframe, payload, datalen, &miccode[0], (unsigned char)prxattrib->priority); /* care the length of the data */ @@ -409,9 +407,15 @@ static struct recv_frame *decryptor(struct adapter *padapter, default: break; } + if (res != _FAIL) { + memmove(precv_frame->pkt->data + precv_frame->attrib.iv_len, precv_frame->pkt->data, precv_frame->attrib.hdrlen); + skb_pull(precv_frame->pkt, precv_frame->attrib.iv_len); + skb_trim(precv_frame->pkt, precv_frame->pkt->len - precv_frame->attrib.icv_len); + } } else if (prxattrib->bdecrypted == 1 && prxattrib->encrypt > 0 && - (psecuritypriv->busetkipkey == 1 || prxattrib->encrypt != _TKIP_)) - psecuritypriv->hw_decrypted = true; + (psecuritypriv->busetkipkey == 1 || prxattrib->encrypt != _TKIP_)) { + psecuritypriv->hw_decrypted = true; + } if (res == _FAIL) { rtw_free_recvframe(return_packet, &padapter->recvpriv.free_recv_queue); @@ -452,7 +456,7 @@ static struct recv_frame *portctrl(struct adapter *adapter, if (auth_alg == 2) { /* get ether_type */ - ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE + pfhdr->attrib.iv_len; + ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE; memcpy(&be_tmp, ptr, 2); ether_type = ntohs(be_tmp); @@ -1263,6 +1267,13 @@ static int validate_recv_frame(struct adapter *adapter, */ rtl88eu_mon_recv_hook(adapter->pmondev, precv_frame); + if (precv_frame->attrib.bdecrypted == 1 && precv_frame->attrib.encrypt > 0 && + (adapter->securitypriv.busetkipkey == 1 || precv_frame->attrib.encrypt != _TKIP_)) { + memmove(precv_frame->pkt->data + precv_frame->attrib.iv_len, precv_frame->pkt->data, precv_frame->attrib.hdrlen); + skb_pull(precv_frame->pkt, precv_frame->attrib.iv_len); + skb_trim(precv_frame->pkt, precv_frame->pkt->len - precv_frame->attrib.icv_len); + } + exit: return retval; @@ -1282,11 +1293,8 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) u8 *ptr = precvframe->pkt->data; struct rx_pkt_attrib *pattrib = &precvframe->attrib; - if (pattrib->encrypt) - skb_trim(precvframe->pkt, precvframe->pkt->len - pattrib->icv_len); - - psnap = (struct ieee80211_snap_hdr *)(ptr+pattrib->hdrlen + pattrib->iv_len); - psnap_type = ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE; + psnap = (struct ieee80211_snap_hdr *)(ptr+pattrib->hdrlen); + psnap_type = ptr+pattrib->hdrlen + SNAP_SIZE; /* convert hdr + possible LLC headers into Ethernet header */ if ((!memcmp(psnap, rtw_rfc1042_header, SNAP_SIZE) && (!memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2) == false) && @@ -1299,12 +1307,9 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) bsnaphdr = false; } - rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0); + rmv_len = pattrib->hdrlen + (bsnaphdr ? SNAP_SIZE : 0); len = precvframe->pkt->len - rmv_len; - RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n===pattrib->hdrlen: %x, pattrib->iv_len:%x===\n\n", pattrib->hdrlen, pattrib->iv_len)); - memcpy(&be_tmp, ptr+rmv_len, 2); eth_type = ntohs(be_tmp); /* pattrib->ether_type */ pattrib->eth_type = eth_type; @@ -1329,7 +1334,6 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, struct __queue *defrag_q) { struct list_head *plist, *phead; - u8 wlanhdr_offset; u8 curfragnum; struct recv_frame *pfhdr, *pnfhdr; struct recv_frame *prframe, *pnextrframe; @@ -1378,12 +1382,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, /* copy the 2nd~n fragment frame's payload to the first fragment */ /* get the 2nd~last fragment frame's payload */ - wlanhdr_offset = pnfhdr->attrib.hdrlen + pnfhdr->attrib.iv_len; - - skb_pull(pnextrframe->pkt, wlanhdr_offset); - - /* append to first fragment frame's tail (if privacy frame, pull the ICV) */ - skb_trim(prframe->pkt, prframe->pkt->len - pfhdr->attrib.icv_len); + skb_pull(pnextrframe->pkt, pnfhdr->attrib.hdrlen); /* memcpy */ memcpy(skb_tail_pointer(pfhdr->pkt), pnfhdr->pkt->data, @@ -1391,7 +1390,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, skb_put(prframe->pkt, pnfhdr->pkt->len); - pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len; + pfhdr->attrib.icv_len = 0; plist = plist->next; } @@ -1518,11 +1517,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) nr_subframes = 0; pattrib = &prframe->attrib; - skb_pull(prframe->pkt, prframe->attrib.hdrlen); - - if (prframe->attrib.iv_len > 0) - skb_pull(prframe->pkt, prframe->attrib.iv_len); - a_len = prframe->pkt->len; pdata = prframe->pkt->data; @@ -1892,24 +1886,6 @@ static int process_recv_indicatepkts(struct adapter *padapter, return retval; } -static int recv_func_prehandle(struct adapter *padapter, - struct recv_frame *rframe) -{ - int ret = _SUCCESS; - struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; - - /* check the frame crtl field and decache */ - ret = validate_recv_frame(padapter, rframe); - if (ret != _SUCCESS) { - RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("recv_func: validate_recv_frame fail! drop pkt\n")); - rtw_free_recvframe(rframe, pfree_recv_queue);/* free this recv_frame */ - goto exit; - } - -exit: - return ret; -} - static int recv_func_posthandle(struct adapter *padapter, struct recv_frame *prframe) { @@ -1962,6 +1938,7 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe) struct rx_pkt_attrib *prxattrib = &rframe->attrib; struct security_priv *psecuritypriv = &padapter->securitypriv; struct mlme_priv *mlmepriv = &padapter->mlmepriv; + struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; /* check if need to handle uc_swdec_pending_queue*/ if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && psecuritypriv->busetkipkey) { @@ -1973,9 +1950,12 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe) } } - ret = recv_func_prehandle(padapter, rframe); - - if (ret == _SUCCESS) { + /* check the frame crtl field and decache */ + ret = validate_recv_frame(padapter, rframe); + if (ret != _SUCCESS) { + RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("recv_func: validate_recv_frame fail! drop pkt\n")); + rtw_free_recvframe(rframe, pfree_recv_queue);/* free this recv_frame */ + } else { /* check if need to enqueue into uc_swdec_pending_queue*/ if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && !IS_MCAST(prxattrib->ra) && prxattrib->encrypt > 0 && -- cgit v1.2.3-55-g7522 From d86e16da6a5d0a705eda2bd0c9640c3b503a61b7 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 2 May 2017 09:01:40 +0300 Subject: staging:r8188eu: use different mon_recv_decrypted() inside rtl88eu_mon_recv_hook() and rtl88eu_mon_xmit_hook(). Create mon_recv_decrypted_recv() to change rtl88eu_mon_recv_hook() without affect to rtl88eu_mon_xmit_hook(). Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/mon.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/os_dep/mon.c b/drivers/staging/rtl8188eu/os_dep/mon.c index cfe37eb026d6..7eac87d641cf 100644 --- a/drivers/staging/rtl8188eu/os_dep/mon.c +++ b/drivers/staging/rtl8188eu/os_dep/mon.c @@ -66,6 +66,27 @@ static void mon_recv_decrypted(struct net_device *dev, const u8 *data, netif_rx(skb); } +static void mon_recv_decrypted_recv(struct net_device *dev, const u8 *data, + int data_len, int iv_len, int icv_len) +{ + struct sk_buff *skb; + + skb = netdev_alloc_skb(dev, data_len); + if (!skb) + return; + memcpy(skb_put(skb, data_len), data, data_len); + + /* + * Frame data is not encrypted. Strip off protection so + * userspace doesn't think that it is. + */ + unprotect_frame(skb, iv_len, icv_len); + + skb->ip_summed = CHECKSUM_UNNECESSARY; + skb->protocol = eth_type_trans(skb, dev); + netif_rx(skb); +} + static void mon_recv_encrypted(struct net_device *dev, const u8 *data, int data_len) { @@ -99,7 +120,7 @@ void rtl88eu_mon_recv_hook(struct net_device *dev, struct recv_frame *frame) SET_ICE_IV_LEN(iv_len, icv_len, attr->encrypt); if (attr->bdecrypted) - mon_recv_decrypted(dev, data, data_len, iv_len, icv_len); + mon_recv_decrypted_recv(dev, data, data_len, iv_len, icv_len); else mon_recv_encrypted(dev, data, data_len); } -- cgit v1.2.3-55-g7522 From 02b19b4c4920cf7976828216b36f0f2317aa20be Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 2 May 2017 09:01:41 +0300 Subject: staging:r8188eu: inline unprotect_frame() in mon_recv_decrypted_recv() It is useful to remove IV/ICV from rtl88eu_mon_recv_hook(). Also unprotect_frame() will be very short without skb_(pull|trim). Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/mon.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/os_dep/mon.c b/drivers/staging/rtl8188eu/os_dep/mon.c index 7eac87d641cf..53f853f08428 100644 --- a/drivers/staging/rtl8188eu/os_dep/mon.c +++ b/drivers/staging/rtl8188eu/os_dep/mon.c @@ -70,6 +70,8 @@ static void mon_recv_decrypted_recv(struct net_device *dev, const u8 *data, int data_len, int iv_len, int icv_len) { struct sk_buff *skb; + struct ieee80211_hdr *hdr; + int hdr_len; skb = netdev_alloc_skb(dev, data_len); if (!skb) @@ -80,7 +82,19 @@ static void mon_recv_decrypted_recv(struct net_device *dev, const u8 *data, * Frame data is not encrypted. Strip off protection so * userspace doesn't think that it is. */ - unprotect_frame(skb, iv_len, icv_len); + + hdr = (struct ieee80211_hdr *)skb->data; + hdr_len = ieee80211_hdrlen(hdr->frame_control); + + if (skb->len < hdr_len + iv_len + icv_len) { + if (ieee80211_has_protected(hdr->frame_control)) { + hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_PROTECTED); + + memmove(skb->data + iv_len, skb->data, hdr_len); + skb_pull(skb, iv_len); + skb_trim(skb, skb->len - icv_len); + } + } skb->ip_summed = CHECKSUM_UNNECESSARY; skb->protocol = eth_type_trans(skb, dev); -- cgit v1.2.3-55-g7522 From 79650ffde38ec4dd8f5c39ff0a305fb0bc1bb142 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 2 May 2017 09:01:42 +0300 Subject: staging:r8188eu: trim IV/ICV fields in validate_recv_data_frame() Length of IV/ICV fields calculated here, so trim these field here too. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_recv.c | 17 ++++++++++------- drivers/staging/rtl8188eu/os_dep/mon.c | 19 ++++--------------- 2 files changed, 14 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index e8f0ff93f05a..2c37bb548c0f 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -1138,6 +1138,8 @@ static int validate_recv_data_frame(struct adapter *adapter, } if (pattrib->privacy) { + struct sk_buff *skb = precv_frame->pkt; + RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("validate_recv_data_frame:pattrib->privacy=%x\n", pattrib->privacy)); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n ^^^^^^^^^^^IS_MCAST(pattrib->ra(0x%02x))=%d^^^^^^^^^^^^^^^6\n", pattrib->ra[0], IS_MCAST(pattrib->ra))); @@ -1146,6 +1148,13 @@ static int validate_recv_data_frame(struct adapter *adapter, RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n pattrib->encrypt=%d\n", pattrib->encrypt)); SET_ICE_IV_LEN(pattrib->iv_len, pattrib->icv_len, pattrib->encrypt); + + if (pattrib->bdecrypted == 1 && pattrib->encrypt > 0) { + memmove(skb->data + pattrib->iv_len, + skb->data, pattrib->hdrlen); + skb_pull(skb, pattrib->iv_len); + skb_trim(skb, skb->len - pattrib->icv_len); + } } else { pattrib->encrypt = 0; pattrib->iv_len = 0; @@ -1265,14 +1274,8 @@ static int validate_recv_frame(struct adapter *adapter, * Hence forward the frame to the monitor anyway to preserve the order * in which frames were received. */ - rtl88eu_mon_recv_hook(adapter->pmondev, precv_frame); - if (precv_frame->attrib.bdecrypted == 1 && precv_frame->attrib.encrypt > 0 && - (adapter->securitypriv.busetkipkey == 1 || precv_frame->attrib.encrypt != _TKIP_)) { - memmove(precv_frame->pkt->data + precv_frame->attrib.iv_len, precv_frame->pkt->data, precv_frame->attrib.hdrlen); - skb_pull(precv_frame->pkt, precv_frame->attrib.iv_len); - skb_trim(precv_frame->pkt, precv_frame->pkt->len - precv_frame->attrib.icv_len); - } + rtl88eu_mon_recv_hook(adapter->pmondev, precv_frame); exit: diff --git a/drivers/staging/rtl8188eu/os_dep/mon.c b/drivers/staging/rtl8188eu/os_dep/mon.c index 53f853f08428..ed396619d97a 100644 --- a/drivers/staging/rtl8188eu/os_dep/mon.c +++ b/drivers/staging/rtl8188eu/os_dep/mon.c @@ -67,7 +67,7 @@ static void mon_recv_decrypted(struct net_device *dev, const u8 *data, } static void mon_recv_decrypted_recv(struct net_device *dev, const u8 *data, - int data_len, int iv_len, int icv_len) + int data_len) { struct sk_buff *skb; struct ieee80211_hdr *hdr; @@ -86,15 +86,8 @@ static void mon_recv_decrypted_recv(struct net_device *dev, const u8 *data, hdr = (struct ieee80211_hdr *)skb->data; hdr_len = ieee80211_hdrlen(hdr->frame_control); - if (skb->len < hdr_len + iv_len + icv_len) { - if (ieee80211_has_protected(hdr->frame_control)) { - hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_PROTECTED); - - memmove(skb->data + iv_len, skb->data, hdr_len); - skb_pull(skb, iv_len); - skb_trim(skb, skb->len - icv_len); - } - } + if (ieee80211_has_protected(hdr->frame_control)) + hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_PROTECTED); skb->ip_summed = CHECKSUM_UNNECESSARY; skb->protocol = eth_type_trans(skb, dev); @@ -117,7 +110,6 @@ static void mon_recv_encrypted(struct net_device *dev, const u8 *data, void rtl88eu_mon_recv_hook(struct net_device *dev, struct recv_frame *frame) { struct rx_pkt_attrib *attr; - int iv_len, icv_len; int data_len; u8 *data; @@ -130,11 +122,8 @@ void rtl88eu_mon_recv_hook(struct net_device *dev, struct recv_frame *frame) data = frame->pkt->data; data_len = frame->pkt->len; - /* Broadcast and multicast frames don't have attr->{iv,icv}_len set */ - SET_ICE_IV_LEN(iv_len, icv_len, attr->encrypt); - if (attr->bdecrypted) - mon_recv_decrypted_recv(dev, data, data_len, iv_len, icv_len); + mon_recv_decrypted_recv(dev, data, data_len); else mon_recv_encrypted(dev, data, data_len); } -- cgit v1.2.3-55-g7522 From 5c92c3e376f636f777df83ea47e3732033973cfb Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 2 May 2017 09:01:43 +0300 Subject: staging:r8188eu: remove ieee80211_get_hdrlen() ieee80211_get_hdrlen is unused, remove it and all corresponding code. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 27 -------------------------- drivers/staging/rtl8188eu/include/ieee80211.h | 13 ------------- 2 files changed, 40 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index d1dafe0f20c6..6fc93fa9421e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -972,33 +972,6 @@ int ieee80211_is_empty_essid(const char *essid, int essid_len) return 1; } -int ieee80211_get_hdrlen(u16 fc) -{ - int hdrlen = 24; - - switch (WLAN_FC_GET_TYPE(fc)) { - case RTW_IEEE80211_FTYPE_DATA: - if (fc & RTW_IEEE80211_STYPE_QOS_DATA) - hdrlen += 2; - if ((fc & RTW_IEEE80211_FCTL_FROMDS) && (fc & RTW_IEEE80211_FCTL_TODS)) - hdrlen += 6; /* Addr4 */ - break; - case RTW_IEEE80211_FTYPE_CTL: - switch (WLAN_FC_GET_STYPE(fc)) { - case RTW_IEEE80211_STYPE_CTS: - case RTW_IEEE80211_STYPE_ACK: - hdrlen = 10; - break; - default: - hdrlen = 16; - break; - } - break; - } - - return hdrlen; -} - static int rtw_get_cipher_info(struct wlan_network *pnetwork) { uint wpa_ielen; diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index 22ab0c43e376..6348fcfe3fcc 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -308,10 +308,6 @@ enum eap_type { /* Frame control field constants */ #define RTW_IEEE80211_FCTL_VERS 0x0003 -#define RTW_IEEE80211_FCTL_FTYPE 0x000c -#define RTW_IEEE80211_FCTL_STYPE 0x00f0 -#define RTW_IEEE80211_FCTL_TODS 0x0100 -#define RTW_IEEE80211_FCTL_FROMDS 0x0200 #define RTW_IEEE80211_FCTL_MOREFRAGS 0x0400 #define RTW_IEEE80211_FCTL_RETRY 0x0800 #define RTW_IEEE80211_FCTL_PM 0x1000 @@ -321,8 +317,6 @@ enum eap_type { #define RTW_IEEE80211_FCTL_CTL_EXT 0x0f00 #define RTW_IEEE80211_FTYPE_MGMT 0x0000 -#define RTW_IEEE80211_FTYPE_CTL 0x0004 -#define RTW_IEEE80211_FTYPE_DATA 0x0008 #define RTW_IEEE80211_FTYPE_EXT 0x000c /* management */ @@ -345,8 +339,6 @@ enum eap_type { #define RTW_IEEE80211_STYPE_BACK 0x0090 #define RTW_IEEE80211_STYPE_PSPOLL 0x00A0 #define RTW_IEEE80211_STYPE_RTS 0x00B0 -#define RTW_IEEE80211_STYPE_CTS 0x00C0 -#define RTW_IEEE80211_STYPE_ACK 0x00D0 #define RTW_IEEE80211_STYPE_CFEND 0x00E0 #define RTW_IEEE80211_STYPE_CFENDACK 0x00F0 @@ -359,7 +351,6 @@ enum eap_type { #define RTW_IEEE80211_STYPE_CFACK 0x0050 #define RTW_IEEE80211_STYPE_CFPOLL 0x0060 #define RTW_IEEE80211_STYPE_CFACKPOLL 0x0070 -#define RTW_IEEE80211_STYPE_QOS_DATA 0x0080 #define RTW_IEEE80211_STYPE_QOS_DATA_CFACK 0x0090 #define RTW_IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0 #define RTW_IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0 @@ -408,9 +399,6 @@ struct ieee80211_snap_hdr { #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) -#define WLAN_FC_GET_TYPE(fc) ((fc) & RTW_IEEE80211_FCTL_FTYPE) -#define WLAN_FC_GET_STYPE(fc) ((fc) & RTW_IEEE80211_FCTL_STYPE) - #define WLAN_QC_GET_TID(qc) ((qc) & 0x0f) #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTW_IEEE80211_SCTL_FRAG) @@ -646,7 +634,6 @@ static inline int is_broadcast_mac_addr(const u8 *addr) /* Baron move to ieee80211.c */ int ieee80211_is_empty_essid(const char *essid, int essid_len); -int ieee80211_get_hdrlen(u16 fc); /* Action category code */ enum rtw_ieee80211_category { -- cgit v1.2.3-55-g7522 From 13e00f8ebded278a7887d98ad65ceabc24f3776a Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 2 May 2017 09:01:44 +0300 Subject: staging:r8188eu: remove ieee80211_is_empty_essid() ieee80211_is_empty_essid() is unused, remove it. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 17 ----------------- drivers/staging/rtl8188eu/include/ieee80211.h | 3 --- 2 files changed, 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index 6fc93fa9421e..bb867a987c2b 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -955,23 +955,6 @@ void rtw_macaddr_cfg(u8 *mac_addr) DBG_88E("rtw_macaddr_cfg MAC Address = %pM\n", (mac_addr)); } -/* Baron adds to avoid FreeBSD warning */ -int ieee80211_is_empty_essid(const char *essid, int essid_len) -{ - /* Single white space is for Linksys APs */ - if (essid_len == 1 && essid[0] == ' ') - return 1; - - /* Otherwise, if the entire essid is 0, we assume it is hidden */ - while (essid_len) { - essid_len--; - if (essid[essid_len] != '\0') - return 0; - } - - return 1; -} - static int rtw_get_cipher_info(struct wlan_network *pnetwork) { uint wpa_ielen; diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index 6348fcfe3fcc..c82d50c5f6c6 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -632,9 +632,6 @@ static inline int is_broadcast_mac_addr(const u8 *addr) #define IEEE_G (1<<2) #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) -/* Baron move to ieee80211.c */ -int ieee80211_is_empty_essid(const char *essid, int essid_len); - /* Action category code */ enum rtw_ieee80211_category { RTW_WLAN_CATEGORY_SPECTRUM_MGMT = 0, -- cgit v1.2.3-55-g7522 From 4bfdd7749aa1747d5997b811f61d2e614e3e3022 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 2 May 2017 09:01:45 +0300 Subject: staging:r8188eu: remove unused definitions from include/ieee80211.h Remove unused RTW_IEEE80211_FCTL_*, RTW_IEEE80211_FTYPE_*, RTW_IEEE80211_STYPE_*, IEEE80211_STATMASK_*, IEEE80211_DEFAULT_*, BEACON_PROBE_SSID_ID_POSITION, MFIE_TYPE_*, IEEE80211_DTIM_* and IEEE80211_PS_*. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/ieee80211.h | 91 --------------------------- 1 file changed, 91 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index c82d50c5f6c6..284db7d00f50 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -306,59 +306,6 @@ enum eap_type { #define MIN_FRAG_THRESHOLD 256U #define MAX_FRAG_THRESHOLD 2346U -/* Frame control field constants */ -#define RTW_IEEE80211_FCTL_VERS 0x0003 -#define RTW_IEEE80211_FCTL_MOREFRAGS 0x0400 -#define RTW_IEEE80211_FCTL_RETRY 0x0800 -#define RTW_IEEE80211_FCTL_PM 0x1000 -#define RTW_IEEE80211_FCTL_MOREDATA 0x2000 -#define RTW_IEEE80211_FCTL_PROTECTED 0x4000 -#define RTW_IEEE80211_FCTL_ORDER 0x8000 -#define RTW_IEEE80211_FCTL_CTL_EXT 0x0f00 - -#define RTW_IEEE80211_FTYPE_MGMT 0x0000 -#define RTW_IEEE80211_FTYPE_EXT 0x000c - -/* management */ -#define RTW_IEEE80211_STYPE_ASSOC_REQ 0x0000 -#define RTW_IEEE80211_STYPE_ASSOC_RESP 0x0010 -#define RTW_IEEE80211_STYPE_REASSOC_REQ 0x0020 -#define RTW_IEEE80211_STYPE_REASSOC_RESP 0x0030 -#define RTW_IEEE80211_STYPE_PROBE_REQ 0x0040 -#define RTW_IEEE80211_STYPE_PROBE_RESP 0x0050 -#define RTW_IEEE80211_STYPE_BEACON 0x0080 -#define RTW_IEEE80211_STYPE_ATIM 0x0090 -#define RTW_IEEE80211_STYPE_DISASSOC 0x00A0 -#define RTW_IEEE80211_STYPE_AUTH 0x00B0 -#define RTW_IEEE80211_STYPE_DEAUTH 0x00C0 -#define RTW_IEEE80211_STYPE_ACTION 0x00D0 - -/* control */ -#define RTW_IEEE80211_STYPE_CTL_EXT 0x0060 -#define RTW_IEEE80211_STYPE_BACK_REQ 0x0080 -#define RTW_IEEE80211_STYPE_BACK 0x0090 -#define RTW_IEEE80211_STYPE_PSPOLL 0x00A0 -#define RTW_IEEE80211_STYPE_RTS 0x00B0 -#define RTW_IEEE80211_STYPE_CFEND 0x00E0 -#define RTW_IEEE80211_STYPE_CFENDACK 0x00F0 - -/* data */ -#define RTW_IEEE80211_STYPE_DATA 0x0000 -#define RTW_IEEE80211_STYPE_DATA_CFACK 0x0010 -#define RTW_IEEE80211_STYPE_DATA_CFPOLL 0x0020 -#define RTW_IEEE80211_STYPE_DATA_CFACKPOLL 0x0030 -#define RTW_IEEE80211_STYPE_NULLFUNC 0x0040 -#define RTW_IEEE80211_STYPE_CFACK 0x0050 -#define RTW_IEEE80211_STYPE_CFPOLL 0x0060 -#define RTW_IEEE80211_STYPE_CFACKPOLL 0x0070 -#define RTW_IEEE80211_STYPE_QOS_DATA_CFACK 0x0090 -#define RTW_IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0 -#define RTW_IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0 -#define RTW_IEEE80211_STYPE_QOS_NULLFUNC 0x00C0 -#define RTW_IEEE80211_STYPE_QOS_CFACK 0x00D0 -#define RTW_IEEE80211_STYPE_QOS_CFPOLL 0x00E0 -#define RTW_IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0 - /* sequence control field */ #define RTW_IEEE80211_SCTL_FRAG 0x000F #define RTW_IEEE80211_SCTL_SEQ 0xFFF0 @@ -411,14 +358,6 @@ struct ieee80211_snap_hdr { #define IEEE80211_DATA_HDR3_LEN 24 #define IEEE80211_DATA_HDR4_LEN 30 - -#define IEEE80211_STATMASK_SIGNAL (1<<0) -#define IEEE80211_STATMASK_RSSI (1<<1) -#define IEEE80211_STATMASK_NOISE (1<<2) -#define IEEE80211_STATMASK_RATE (1<<3) -#define IEEE80211_STATMASK_WEMASK 0x7 - - #define IEEE80211_CCK_MODULATION (1<<0) #define IEEE80211_OFDM_MODULATION (1<<1) @@ -476,9 +415,6 @@ struct ieee80211_snap_hdr { IEEE80211_OFDM_RATE_36MB_MASK | \ IEEE80211_OFDM_RATE_48MB_MASK | \ IEEE80211_OFDM_RATE_54MB_MASK) -#define IEEE80211_DEFAULT_RATES_MASK \ - (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ - IEEE80211_CCK_DEFAULT_RATES_MASK) #define IEEE80211_NUM_OFDM_RATES 8 #define IEEE80211_NUM_CCK_RATES 4 @@ -509,25 +445,6 @@ struct ieee80211_snap_hdr { #define WEP_KEYS 4 #define WEP_KEY_LEN 13 -#define BEACON_PROBE_SSID_ID_POSITION 12 - -/* Management Frame Information Element Types */ -#define MFIE_TYPE_SSID 0 -#define MFIE_TYPE_RATES 1 -#define MFIE_TYPE_FH_SET 2 -#define MFIE_TYPE_DS_SET 3 -#define MFIE_TYPE_CF_SET 4 -#define MFIE_TYPE_TIM 5 -#define MFIE_TYPE_IBSS_SET 6 -#define MFIE_TYPE_CHALLENGE 16 -#define MFIE_TYPE_ERP 42 -#define MFIE_TYPE_RSN 48 -#define MFIE_TYPE_RATES_EX 50 -#define MFIE_TYPE_GENERIC 221 - -#define IEEE80211_DEFAULT_TX_ESSID "Penguin" -#define IEEE80211_DEFAULT_BASIC_RATE 10 - /* SWEEP TABLE ENTRIES NUMBER*/ #define MAX_SWEEP_TAB_ENTRIES 42 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 @@ -554,14 +471,6 @@ struct ieee80211_snap_hdr { #define NETWORK_HAS_OFDM (1<<1) #define NETWORK_HAS_CCK (1<<2) -#define IEEE80211_DTIM_MBCAST 4 -#define IEEE80211_DTIM_UCAST 2 -#define IEEE80211_DTIM_VALID 1 -#define IEEE80211_DTIM_INVALID 0 - -#define IEEE80211_PS_DISABLED 0 -#define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST -#define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST #define IW_ESSID_MAX_SIZE 32 /* join_res: -- cgit v1.2.3-55-g7522 From 100007115f540a19304fdbe5b78ba501f26552f4 Mon Sep 17 00:00:00 2001 From: Laurence Rochfort Date: Mon, 8 May 2017 12:03:10 +0100 Subject: Staging: fbtft: Fix unbalanced braces around else statement Balance if/else braces as recommended by checkpatch.pl Signed-off-by: Laurence Rochfort Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_agm1264k-fl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c index 489151a6bf80..456a8dd65caf 100644 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c @@ -282,10 +282,10 @@ static void iterate_diffusion_matrix(u32 xres, u32 yres, int x, continue; write_pos = &convert_buf[(y + j) * xres + x + i]; coeff = diffusing_matrix[i][j]; - if (-1 == coeff) + if (-1 == coeff) { /* pixel itself */ *write_pos = pixel; - else { + } else { signed short p = *write_pos + error * coeff; if (p > WHITE) -- cgit v1.2.3-55-g7522 From 3036d0e226b04f10fbce1fd5263c735e4c1d9ffa Mon Sep 17 00:00:00 2001 From: Karthik Tummala Date: Mon, 8 May 2017 18:05:55 +0530 Subject: Staging: greybus: light: Prefer kcalloc over kzalloc Fixed following checkpatch.pl warning: * WARNING: Prefer kcalloc over kzalloc with multiply Instead of specifying no.of bytes * size as argument in kzalloc, prefer kcalloc. Signed-off-by: Karthik Tummala Reviewed-by: Rui Miguel Silva Acked-by: Viresh Kumar Changes for v2: - Changed subject line & fixed typo as suggested by Rui Miguel Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/light.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index 16813628eda1..861a249e6ef1 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -1030,7 +1030,7 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id) light->channels_count = conf.channel_count; light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL); - light->channels = kzalloc(light->channels_count * + light->channels = kcalloc(light->channels_count, sizeof(struct gb_channel), GFP_KERNEL); if (!light->channels) return -ENOMEM; @@ -1167,7 +1167,7 @@ static int gb_lights_create_all(struct gb_lights *glights) if (ret < 0) goto out; - glights->lights = kzalloc(glights->lights_count * + glights->lights = kcalloc(glights->lights_count, sizeof(struct gb_light), GFP_KERNEL); if (!glights->lights) { ret = -ENOMEM; -- cgit v1.2.3-55-g7522 From 03d261deea9d0b8fbb908d7f1f29f26fd272984d Mon Sep 17 00:00:00 2001 From: JB Van Puyvelde Date: Thu, 11 May 2017 22:58:56 +0200 Subject: staging: greybus: power_supply: replace kzalloc by kcalloc According to checkpatch.pl, kcalloc should be preferred to kzalloc with multiply. Signed-off-by: JB Van Puyvelde Acked-by: Viresh Kumar Reviewed-by: Rui Miguel Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/power_supply.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index e85c988b7034..20cac20518d7 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -944,7 +944,7 @@ static int gb_power_supplies_setup(struct gb_power_supplies *supplies) if (ret < 0) goto out; - supplies->supply = kzalloc(supplies->supplies_count * + supplies->supply = kcalloc(supplies->supplies_count, sizeof(struct gb_power_supply), GFP_KERNEL); -- cgit v1.2.3-55-g7522 From 9f8e8caf54ce9e75fba76bbbc90ae69e51b9077e Mon Sep 17 00:00:00 2001 From: Matthew Giassa Date: Tue, 9 May 2017 19:17:27 -0700 Subject: staging: android: ion: Resolve minor indentation issue. Resolving a minor checkpatch/indentation issue in ion_carveout_heap.c, ie: drivers/staging/android/ion/ion_carveout_heap.c ----------------------------------------------- CHECK: Alignment should match open parenthesis +static phys_addr_t ion_carveout_allocate(struct ion_heap *heap, + unsigned long size) Signed-off-by: Matthew Giassa Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_carveout_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c index 5fdc1f328f61..fee7650d6fbb 100644 --- a/drivers/staging/android/ion/ion_carveout_heap.c +++ b/drivers/staging/android/ion/ion_carveout_heap.c @@ -33,7 +33,7 @@ struct ion_carveout_heap { }; static phys_addr_t ion_carveout_allocate(struct ion_heap *heap, - unsigned long size) + unsigned long size) { struct ion_carveout_heap *carveout_heap = container_of(heap, struct ion_carveout_heap, heap); -- cgit v1.2.3-55-g7522 From 3f514c35c04754337fc519e2ac10e518d9a0dcdd Mon Sep 17 00:00:00 2001 From: Gustavo A. R. Silva Date: Wed, 10 May 2017 23:27:40 -0500 Subject: staging: lustre: ptlrpc: remove unnecessary code offset is an unsigned variable and, greater-than-or-equal-to-zero comparison of an unsigned variable is always true. Addresses-Coverity-ID: 1373919 Signed-off-by: Gustavo A. R. Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 8177e1a31ca9..5810bbab6585 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -1761,7 +1761,7 @@ static u32 __req_capsule_offset(const struct req_capsule *pill, field->rmf_name, offset, loc); offset--; - LASSERT(0 <= offset && offset < REQ_MAX_FIELD_NR); + LASSERT(offset < REQ_MAX_FIELD_NR); return offset; } -- cgit v1.2.3-55-g7522 From b0aa6886920e8f8bd5fa733e09334c7f6374afb8 Mon Sep 17 00:00:00 2001 From: Thibaut Robert Date: Tue, 9 May 2017 21:46:50 +0200 Subject: staging: lustre: remove unnecessary braces This patch fixes checkpatch warnings: "WARNING: braces {} are not necessary for single statement blocks" and "WARNING: braces {} are not necessary for any arm of this statement". Signed-off-by: Thibaut Robert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 11 +++++------ drivers/staging/lustre/lustre/lmv/lmv_obd.c | 6 ++---- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 8 ++++---- drivers/staging/lustre/lustre/obdclass/lu_object.c | 3 +-- drivers/staging/lustre/lustre/obdecho/echo_client.c | 3 +-- drivers/staging/lustre/lustre/osc/osc_cache.c | 3 +-- drivers/staging/lustre/lustre/ptlrpc/import.c | 15 +++++---------- 7 files changed, 19 insertions(+), 30 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 3663c5cdb051..4dc7baee1f28 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -363,17 +363,16 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) */ cli->cl_chunkbits = PAGE_SHIFT; - if (!strcmp(name, LUSTRE_MDC_NAME)) { + if (!strcmp(name, LUSTRE_MDC_NAME)) cli->cl_max_rpcs_in_flight = OBD_MAX_RIF_DEFAULT; - } else if (totalram_pages >> (20 - PAGE_SHIFT) <= 128 /* MB */) { + else if (totalram_pages >> (20 - PAGE_SHIFT) <= 128 /* MB */) cli->cl_max_rpcs_in_flight = 2; - } else if (totalram_pages >> (20 - PAGE_SHIFT) <= 256 /* MB */) { + else if (totalram_pages >> (20 - PAGE_SHIFT) <= 256 /* MB */) cli->cl_max_rpcs_in_flight = 3; - } else if (totalram_pages >> (20 - PAGE_SHIFT) <= 512 /* MB */) { + else if (totalram_pages >> (20 - PAGE_SHIFT) <= 512 /* MB */) cli->cl_max_rpcs_in_flight = 4; - } else { + else cli->cl_max_rpcs_in_flight = OBD_MAX_RIF_DEFAULT; - } spin_lock_init(&cli->cl_mod_rpcs_lock); spin_lock_init(&cli->cl_mod_rpcs_hist.oh_lock); diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 732595125d8a..aaff986f9287 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2413,9 +2413,8 @@ static int lmv_read_page(struct obd_export *exp, struct md_op_data *op_data, if (rc) return rc; - if (unlikely(lsm)) { + if (unlikely(lsm)) return lmv_read_striped_page(exp, op_data, cb_op, offset, ppage); - } tgt = lmv_find_target(lmv, &op_data->op_fid1); if (IS_ERR(tgt)) @@ -3107,9 +3106,8 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp, return -EIO; } - if (oqctl->qc_cmd != Q_GETOQUOTA) { + if (oqctl->qc_cmd != Q_GETOQUOTA) return obd_quotactl(tgt->ltd_exp, oqctl); - } for (i = 0; i < lmv->desc.ld_tgt_count; i++) { int err; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 392b0e38a91e..9e06078c1e79 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -911,13 +911,13 @@ static int mdc_finish_intent_lock(struct obd_export *exp, OBD_FAIL_TIMEOUT(OBD_FAIL_MDC_ENQUEUE_PAUSE, obd_timeout); } - if (it->it_op & IT_CREAT) { + if (it->it_op & IT_CREAT) /* XXX this belongs in ll_create_it */ - } else if (it->it_op == IT_OPEN) { + ; + else if (it->it_op == IT_OPEN) LASSERT(!it_disposition(it, DISP_OPEN_CREATE)); - } else { + else LASSERT(it->it_op & (IT_GETATTR | IT_LOOKUP | IT_LAYOUT)); - } /* If we already have a matching lock, then cancel the new * one. We have to set the data here instead of in diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index abcf951208d2..94c8ae5a106a 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -918,9 +918,8 @@ static unsigned long lu_htable_order(struct lu_device *top) cache_size = cache_size / 100 * lu_cache_percent * (PAGE_SIZE / 1024); - for (bits = 1; (1 << bits) < cache_size; ++bits) { + for (bits = 1; (1 << bits) < cache_size; ++bits) ; - } return clamp_t(typeof(bits), bits, LU_SITE_BITS_MIN, bits_max); } diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 77b4c5504689..d4768311cf92 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -1646,9 +1646,8 @@ static int echo_client_connect(const struct lu_env *env, struct lustre_handle conn = { 0 }; rc = class_connect(&conn, src, cluuid); - if (rc == 0) { + if (rc == 0) *exp = class_conn2export(&conn); - } return rc; } diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index c5ccf568313a..33d769c625e7 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1406,9 +1406,8 @@ static void osc_release_write_grant(struct client_obd *cli, struct brw_page *pga) { assert_spin_locked(&cli->cl_loi_list_lock); - if (!(pga->flag & OBD_BRW_FROM_GRANT)) { + if (!(pga->flag & OBD_BRW_FROM_GRANT)) return; - } pga->flag &= ~OBD_BRW_FROM_GRANT; atomic_long_dec(&obd_dirty_pages); diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index 93e172fe9ce4..52cb1f0c9c94 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -1182,17 +1182,15 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, } /* Sanity checks for a reconnected import. */ - if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE)) { + if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE)) CERROR("imp_replayable flag does not match server after reconnect. We should LBUG right here.\n"); - } if (lustre_msg_get_last_committed(request->rq_repmsg) > 0 && lustre_msg_get_last_committed(request->rq_repmsg) < - aa->pcaa_peer_committed) { + aa->pcaa_peer_committed) CERROR("%s went back in time (transno %lld was previously committed, server now claims %lld)! See https://bugzilla.lustre.org/show_bug.cgi?id=9646\n", obd2cli_tgt(imp->imp_obd), aa->pcaa_peer_committed, lustre_msg_get_last_committed(request->rq_repmsg)); - } finish: ptlrpc_prepare_replay(imp); @@ -1437,20 +1435,17 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) rc = 0; } - if (imp->imp_state == LUSTRE_IMP_REPLAY_LOCKS) { + if (imp->imp_state == LUSTRE_IMP_REPLAY_LOCKS) if (atomic_read(&imp->imp_replay_inflight) == 0) { IMPORT_SET_STATE(imp, LUSTRE_IMP_REPLAY_WAIT); rc = signal_completed_replay(imp); if (rc) goto out; } - } - if (imp->imp_state == LUSTRE_IMP_REPLAY_WAIT) { - if (atomic_read(&imp->imp_replay_inflight) == 0) { + if (imp->imp_state == LUSTRE_IMP_REPLAY_WAIT) + if (atomic_read(&imp->imp_replay_inflight) == 0) IMPORT_SET_STATE(imp, LUSTRE_IMP_RECOVER); - } - } if (imp->imp_state == LUSTRE_IMP_RECOVER) { CDEBUG(D_HA, "reconnected to %s@%s\n", -- cgit v1.2.3-55-g7522 From b4573c90c3facfbbc38b2b1f9c58211d6cc47e47 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:35:54 +0300 Subject: staging: ccree: remove unused code Remove a bunch of cruft being used in HW debugging but not useful or compiled for driver use or development. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_bitops.h | 27 ---- drivers/staging/ccree/cc_hw_queue_defs.h | 36 ----- drivers/staging/ccree/cc_pal_log.h | 188 ------------------------ drivers/staging/ccree/cc_pal_log_plat.h | 33 ----- drivers/staging/ccree/cc_pal_types.h | 97 ------------- drivers/staging/ccree/cc_pal_types_plat.h | 29 ---- drivers/staging/ccree/cc_regs.h | 11 -- drivers/staging/ccree/dx_env.h | 224 ----------------------------- drivers/staging/ccree/dx_reg_base_host.h | 9 -- drivers/staging/ccree/hw_queue_defs_plat.h | 43 ------ drivers/staging/ccree/ssi_driver.h | 3 - 11 files changed, 700 deletions(-) delete mode 100644 drivers/staging/ccree/cc_pal_log.h delete mode 100644 drivers/staging/ccree/cc_pal_log_plat.h delete mode 100644 drivers/staging/ccree/cc_pal_types.h delete mode 100644 drivers/staging/ccree/cc_pal_types_plat.h delete mode 100644 drivers/staging/ccree/dx_env.h delete mode 100644 drivers/staging/ccree/hw_queue_defs_plat.h (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_bitops.h b/drivers/staging/ccree/cc_bitops.h index ad3aeedb65e8..ee5238a9928d 100644 --- a/drivers/staging/ccree/cc_bitops.h +++ b/drivers/staging/ccree/cc_bitops.h @@ -32,31 +32,4 @@ (((new_val) & BITMASK(bit_size)) << (bit_offset)); \ } while (0) -/* Is val aligned to "align" ("align" must be power of 2) */ -#ifndef IS_ALIGNED -#define IS_ALIGNED(val, align) \ - (((uintptr_t)(val) & ((align) - 1)) == 0) -#endif - -#define SWAP_ENDIAN(word) \ - (((word) >> 24) | (((word) & 0x00FF0000) >> 8) | \ - (((word) & 0x0000FF00) << 8) | (((word) & 0x000000FF) << 24)) - -#ifdef BIG__ENDIAN -#define SWAP_TO_LE(word) SWAP_ENDIAN(word) -#define SWAP_TO_BE(word) word -#else -#define SWAP_TO_LE(word) word -#define SWAP_TO_BE(word) SWAP_ENDIAN(word) -#endif - - - -/* Is val a multiple of "mult" ("mult" must be power of 2) */ -#define IS_MULT(val, mult) \ - (((val) & ((mult) - 1)) == 0) - -#define IS_NULL_ADDR(adr) \ - (!(adr)) - #endif /*_CC_BITOPS_H_*/ diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 8dca344c15a3..537ea0dcab7c 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -17,7 +17,6 @@ #ifndef __CC_HW_QUEUE_DEFS_H__ #define __CC_HW_QUEUE_DEFS_H__ -#include "cc_pal_log.h" #include "cc_regs.h" #include "dx_crys_kernel.h" @@ -189,41 +188,6 @@ typedef enum HwDesKeySize { (pDesc)->word[5] = 0; \ } while (0) -/* HW descriptor debug functions */ -int createDetailedDump(HwDesc_s *pDesc); -void descriptor_log(HwDesc_s *desc); - -#if defined(HW_DESCRIPTOR_LOG) || defined(HW_DESC_DUMP_HOST_BUF) -#define LOG_HW_DESC(pDesc) descriptor_log(pDesc) -#else -#define LOG_HW_DESC(pDesc) -#endif - -#if (CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_TRACE) || defined(OEMFW_LOG) - -#ifdef UART_PRINTF -#define CREATE_DETAILED_DUMP(pDesc) createDetailedDump(pDesc) -#else -#define CREATE_DETAILED_DUMP(pDesc) -#endif - -#define HW_DESC_DUMP(pDesc) do { \ - CC_PAL_LOG_TRACE("\n---------------------------------------------------\n"); \ - CREATE_DETAILED_DUMP(pDesc); \ - CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[0]); \ - CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[1]); \ - CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[2]); \ - CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[3]); \ - CC_PAL_LOG_TRACE("0x%08X, ", (unsigned int)(pDesc)->word[4]); \ - CC_PAL_LOG_TRACE("0x%08X\n", (unsigned int)(pDesc)->word[5]); \ - CC_PAL_LOG_TRACE("---------------------------------------------------\n\n"); \ -} while (0) - -#else -#define HW_DESC_DUMP(pDesc) do {} while (0) -#endif - - /*! * This macro indicates the end of current HW descriptors flow and release the HW engines. * diff --git a/drivers/staging/ccree/cc_pal_log.h b/drivers/staging/ccree/cc_pal_log.h deleted file mode 100644 index 21abd2d26b90..000000000000 --- a/drivers/staging/ccree/cc_pal_log.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef _CC_PAL_LOG_H_ -#define _CC_PAL_LOG_H_ - -#include "cc_pal_types.h" -#include "cc_pal_log_plat.h" - -/*! -@file -@brief This file contains the PAL layer log definitions, by default the log is disabled. -@defgroup cc_pal_log CryptoCell PAL logging APIs and definitions -@{ -@ingroup cc_pal -*/ - -/* PAL log levels (to be used in CC_PAL_logLevel) */ -/*! PAL log level - disabled. */ -#define CC_PAL_LOG_LEVEL_NULL (-1) /*!< \internal Disable logging */ -/*! PAL log level - error. */ -#define CC_PAL_LOG_LEVEL_ERR 0 -/*! PAL log level - warning. */ -#define CC_PAL_LOG_LEVEL_WARN 1 -/*! PAL log level - info. */ -#define CC_PAL_LOG_LEVEL_INFO 2 -/*! PAL log level - debug. */ -#define CC_PAL_LOG_LEVEL_DEBUG 3 -/*! PAL log level - trace. */ -#define CC_PAL_LOG_LEVEL_TRACE 4 -/*! PAL log level - data. */ -#define CC_PAL_LOG_LEVEL_DATA 5 - -#ifndef CC_PAL_LOG_CUR_COMPONENT -/* Setting default component mask in case caller did not define */ -/* (a mask that is always on for every log mask value but full masking) */ -/*! Default log debugged component.*/ -#define CC_PAL_LOG_CUR_COMPONENT 0xFFFFFFFF -#endif -#ifndef CC_PAL_LOG_CUR_COMPONENT_NAME -/*! Default log debugged component.*/ -#define CC_PAL_LOG_CUR_COMPONENT_NAME "CC" -#endif - -/* Select compile time log level (default if not explicitly specified by caller) */ -#ifndef CC_PAL_MAX_LOG_LEVEL /* Can be overriden by external definition of this constant */ -#ifdef DEBUG -/*! Default debug log level (when debug is set to on).*/ -#define CC_PAL_MAX_LOG_LEVEL CC_PAL_LOG_LEVEL_ERR /*CC_PAL_LOG_LEVEL_DEBUG*/ -#else /* Disable logging */ -/*! Default debug log level (when debug is set to on).*/ -#define CC_PAL_MAX_LOG_LEVEL CC_PAL_LOG_LEVEL_NULL -#endif -#endif /*CC_PAL_MAX_LOG_LEVEL*/ -/*! Evaluate CC_PAL_MAX_LOG_LEVEL in case provided by caller */ -#define __CC_PAL_LOG_LEVEL_EVAL(level) level -/*! Maximal log level defintion.*/ -#define _CC_PAL_MAX_LOG_LEVEL __CC_PAL_LOG_LEVEL_EVAL(CC_PAL_MAX_LOG_LEVEL) - - -#ifdef ARM_DSM -/*! Log init function. */ -#define CC_PalLogInit() do {} while (0) -/*! Log set level function - sets the level of logging in case of debug. */ -#define CC_PalLogLevelSet(setLevel) do {} while (0) -/*! Log set mask function - sets the component masking in case of debug. */ -#define CC_PalLogMaskSet(setMask) do {} while (0) -#else -#if _CC_PAL_MAX_LOG_LEVEL > CC_PAL_LOG_LEVEL_NULL -/*! Log init function. */ -void CC_PalLogInit(void); -/*! Log set level function - sets the level of logging in case of debug. */ -void CC_PalLogLevelSet(int setLevel); -/*! Log set mask function - sets the component masking in case of debug. */ -void CC_PalLogMaskSet(uint32_t setMask); -/*! Global variable for log level */ -extern int CC_PAL_logLevel; -/*! Global variable for log mask */ -extern uint32_t CC_PAL_logMask; -#else /* No log */ -/*! Log init function. */ -static inline void CC_PalLogInit(void) {} -/*! Log set level function - sets the level of logging in case of debug. */ -static inline void CC_PalLogLevelSet(int setLevel) {CC_UNUSED_PARAM(setLevel);} -/*! Log set mask function - sets the component masking in case of debug. */ -static inline void CC_PalLogMaskSet(uint32_t setMask) {CC_UNUSED_PARAM(setMask);} -#endif -#endif - -/*! Filter logging based on logMask and dispatch to platform specific logging mechanism. */ -#define _CC_PAL_LOG(level, format, ...) \ - if (CC_PAL_logMask & CC_PAL_LOG_CUR_COMPONENT) \ - __CC_PAL_LOG_PLAT(CC_PAL_LOG_LEVEL_ ## level, "%s:%s: " format, CC_PAL_LOG_CUR_COMPONENT_NAME, __func__, ##__VA_ARGS__) - -#if (_CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_ERR) -/*! Log messages according to log level.*/ -#define CC_PAL_LOG_ERR(format, ... ) \ - _CC_PAL_LOG(ERR, format, ##__VA_ARGS__) -#else -/*! Log messages according to log level.*/ -#define CC_PAL_LOG_ERR( ... ) do {} while (0) -#endif - -#if (_CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_WARN) -/*! Log messages according to log level.*/ -#define CC_PAL_LOG_WARN(format, ... ) \ - if (CC_PAL_logLevel >= CC_PAL_LOG_LEVEL_WARN) \ - _CC_PAL_LOG(WARN, format, ##__VA_ARGS__) -#else -/*! Log messages according to log level.*/ -#define CC_PAL_LOG_WARN( ... ) do {} while (0) -#endif - -#if (_CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_INFO) -/*! Log messages according to log level.*/ -#define CC_PAL_LOG_INFO(format, ... ) \ - if (CC_PAL_logLevel >= CC_PAL_LOG_LEVEL_INFO) \ - _CC_PAL_LOG(INFO, format, ##__VA_ARGS__) -#else -/*! Log messages according to log level.*/ -#define CC_PAL_LOG_INFO( ... ) do {} while (0) -#endif - -#if (_CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_DEBUG) -/*! Log messages according to log level.*/ -#define CC_PAL_LOG_DEBUG(format, ... ) \ - if (CC_PAL_logLevel >= CC_PAL_LOG_LEVEL_DEBUG) \ - _CC_PAL_LOG(DEBUG, format, ##__VA_ARGS__) - -/*! Log message buffer.*/ -#define CC_PAL_LOG_DUMP_BUF(msg, buf, size) \ - do { \ - int i; \ - uint8_t *pData = (uint8_t*)buf; \ - \ - PRINTF("%s (%d):\n", msg, size); \ - for (i = 0; i < size; i++) { \ - PRINTF("0x%02X ", pData[i]); \ - if ((i & 0xF) == 0xF) { \ - PRINTF("\n"); \ - } \ - } \ - PRINTF("\n"); \ - } while (0) -#else -/*! Log debug messages.*/ -#define CC_PAL_LOG_DEBUG( ... ) do {} while (0) -/*! Log debug buffer.*/ -#define CC_PAL_LOG_DUMP_BUF(msg, buf, size) do {} while (0) -#endif - -#if (_CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_TRACE) -/*! Log debug trace.*/ -#define CC_PAL_LOG_TRACE(format, ... ) \ - if (CC_PAL_logLevel >= CC_PAL_LOG_LEVEL_TRACE) \ - _CC_PAL_LOG(TRACE, format, ##__VA_ARGS__) -#else -/*! Log debug trace.*/ -#define CC_PAL_LOG_TRACE(...) do {} while (0) -#endif - -#if (_CC_PAL_MAX_LOG_LEVEL >= CC_PAL_LOG_LEVEL_TRACE) -/*! Log debug data.*/ -#define CC_PAL_LOG_DATA(format, ...) \ - if (CC_PAL_logLevel >= CC_PAL_LOG_LEVEL_TRACE) \ - _CC_PAL_LOG(DATA, format, ##__VA_ARGS__) -#else -/*! Log debug data.*/ -#define CC_PAL_LOG_DATA( ...) do {} while (0) -#endif -/** -@} - */ - -#endif /*_CC_PAL_LOG_H_*/ diff --git a/drivers/staging/ccree/cc_pal_log_plat.h b/drivers/staging/ccree/cc_pal_log_plat.h deleted file mode 100644 index bc47a50e1917..000000000000 --- a/drivers/staging/ccree/cc_pal_log_plat.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -/* Dummy pal_log_plat for test driver in kernel */ - -#ifndef _SSI_PAL_LOG_PLAT_H_ -#define _SSI_PAL_LOG_PLAT_H_ - -#if defined(DEBUG) - -#define __CC_PAL_LOG_PLAT(level, format, ...) printk(level "cc7x_test::" format , ##__VA_ARGS__) - -#else /* Disable all prints */ - -#define __CC_PAL_LOG_PLAT(...) do {} while (0) - -#endif - -#endif /*_SASI_PAL_LOG_PLAT_H_*/ - diff --git a/drivers/staging/ccree/cc_pal_types.h b/drivers/staging/ccree/cc_pal_types.h deleted file mode 100644 index bf8a5e122992..000000000000 --- a/drivers/staging/ccree/cc_pal_types.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef CC_PAL_TYPES_H -#define CC_PAL_TYPES_H - -/*! -@file -@brief This file contains platform-dependent definitions and types. -@defgroup cc_pal_types CryptoCell PAL platform dependant types -@{ -@ingroup cc_pal - -*/ - -#include "cc_pal_types_plat.h" - -/*! Boolean definition.*/ -typedef enum { - /*! Boolean false definition.*/ - CC_FALSE = 0, - /*! Boolean true definition.*/ - CC_TRUE = 1 -} CCBool; - -/*! Success definition. */ -#define CC_SUCCESS 0UL -/*! Failure definition. */ -#define CC_FAIL 1UL - -/*! Defintion of 1KB in bytes. */ -#define CC_1K_SIZE_IN_BYTES 1024 -/*! Defintion of number of bits in a byte. */ -#define CC_BITS_IN_BYTE 8 -/*! Defintion of number of bits in a 32bits word. */ -#define CC_BITS_IN_32BIT_WORD 32 -/*! Defintion of number of bytes in a 32bits word. */ -#define CC_32BIT_WORD_SIZE (sizeof(uint32_t)) - -/*! Success (OK) defintion. */ -#define CC_OK 0 - -/*! Macro that handles unused parameters in the code (to avoid compilation warnings). */ -#define CC_UNUSED_PARAM(prm) ((void)prm) - -/*! Maximal uint32 value.*/ -#define CC_MAX_UINT32_VAL (0xFFFFFFFF) - - -/* Minimum and Maximum macros */ -#ifdef min -/*! Definition for minimum. */ -#define CC_MIN(a,b) min( a , b ) -#else -/*! Definition for minimum. */ -#define CC_MIN( a , b ) ( ( (a) < (b) ) ? (a) : (b) ) -#endif - -#ifdef max -/*! Definition for maximum. */ -#define CC_MAX(a,b) max( a , b ) -#else -/*! Definition for maximum. */ -#define CC_MAX( a , b ) ( ( (a) > (b) ) ? (a) : (b) ) -#endif - -/*! Macro that calculates number of full bytes from bits (i.e. 7 bits are 1 byte). */ -#define CALC_FULL_BYTES(numBits) ((numBits)/CC_BITS_IN_BYTE + (((numBits) & (CC_BITS_IN_BYTE-1)) > 0)) -/*! Macro that calculates number of full 32bits words from bits (i.e. 31 bits are 1 word). */ -#define CALC_FULL_32BIT_WORDS(numBits) ((numBits)/CC_BITS_IN_32BIT_WORD + (((numBits) & (CC_BITS_IN_32BIT_WORD-1)) > 0)) -/*! Macro that calculates number of full 32bits words from bytes (i.e. 3 bytes are 1 word). */ -#define CALC_32BIT_WORDS_FROM_BYTES(sizeBytes) ((sizeBytes)/CC_32BIT_WORD_SIZE + (((sizeBytes) & (CC_32BIT_WORD_SIZE-1)) > 0)) -/*! Macro that round up bits to 32bits words. */ -#define ROUNDUP_BITS_TO_32BIT_WORD(numBits) (CALC_FULL_32BIT_WORDS(numBits) * CC_BITS_IN_32BIT_WORD) -/*! Macro that round up bits to bytes. */ -#define ROUNDUP_BITS_TO_BYTES(numBits) (CALC_FULL_BYTES(numBits) * CC_BITS_IN_BYTE) -/*! Macro that round up bytes to 32bits words. */ -#define ROUNDUP_BYTES_TO_32BIT_WORD(sizeBytes) (CALC_32BIT_WORDS_FROM_BYTES(sizeBytes) * CC_32BIT_WORD_SIZE) - - -/** -@} - */ -#endif diff --git a/drivers/staging/ccree/cc_pal_types_plat.h b/drivers/staging/ccree/cc_pal_types_plat.h deleted file mode 100644 index b682ff0e40e6..000000000000 --- a/drivers/staging/ccree/cc_pal_types_plat.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - - -#ifndef SSI_PAL_TYPES_PLAT_H -#define SSI_PAL_TYPES_PLAT_H -/* Linux kernel types */ - -#include - -#ifndef NULL /* Missing in Linux kernel */ -#define NULL (0x0L) -#endif - - -#endif /*SSI_PAL_TYPES_PLAT_H*/ diff --git a/drivers/staging/ccree/cc_regs.h b/drivers/staging/ccree/cc_regs.h index a2d42a368335..e81b0dc8ce5e 100644 --- a/drivers/staging/ccree/cc_regs.h +++ b/drivers/staging/ccree/cc_regs.h @@ -32,9 +32,6 @@ #define CC_REG_BIT_SHIFT(reg_name, field_name) \ (DX_ ## reg_name ## _ ## field_name ## _BIT_SHIFT) -/* Register Offset macros (from registers base address in host) */ -#include "dx_reg_base_host.h" - /* Read-Modify-Write a field of a register */ #define MODIFY_REGISTER_FLD(unitName, regName, fldName, fldVal) \ do { \ @@ -44,14 +41,6 @@ do { \ WRITE_REGISTER(CC_REG_ADDR(unitName, regName), regVal); \ } while (0) -/* Registers address macros for ENV registers (development FPGA only) */ -#ifdef DX_BASE_ENV_REGS - -/* This offset should be added to mapping address of DX_BASE_ENV_REGS */ -#define CC_ENV_REG_OFFSET(reg_name) (DX_ENV_ ## reg_name ## _REG_OFFSET) - -#endif /*DX_BASE_ENV_REGS*/ - /*! Bit fields get */ #define CC_REG_FLD_GET(unit_name, reg_name, fld_name, reg_val) \ (DX_ ## reg_name ## _ ## fld_name ## _BIT_SIZE == 0x20 ? \ diff --git a/drivers/staging/ccree/dx_env.h b/drivers/staging/ccree/dx_env.h deleted file mode 100644 index d4c0440131e0..000000000000 --- a/drivers/staging/ccree/dx_env.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef __DX_ENV_H__ -#define __DX_ENV_H__ - -// -------------------------------------- -// BLOCK: FPGA_ENV_REGS -// -------------------------------------- -#define DX_ENV_PKA_DEBUG_MODE_REG_OFFSET 0x024UL -#define DX_ENV_PKA_DEBUG_MODE_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_PKA_DEBUG_MODE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_SCAN_MODE_REG_OFFSET 0x030UL -#define DX_ENV_SCAN_MODE_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_SCAN_MODE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_ALLOW_SCAN_REG_OFFSET 0x034UL -#define DX_ENV_CC_ALLOW_SCAN_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_ALLOW_SCAN_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_HOST_INT_REG_OFFSET 0x0A0UL -#define DX_ENV_CC_HOST_INT_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_HOST_INT_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_PUB_HOST_INT_REG_OFFSET 0x0A4UL -#define DX_ENV_CC_PUB_HOST_INT_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_PUB_HOST_INT_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_RST_N_REG_OFFSET 0x0A8UL -#define DX_ENV_CC_RST_N_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_RST_N_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_RST_OVERRIDE_REG_OFFSET 0x0ACUL -#define DX_ENV_RST_OVERRIDE_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_RST_OVERRIDE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_POR_N_ADDR_REG_OFFSET 0x0E0UL -#define DX_ENV_CC_POR_N_ADDR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_POR_N_ADDR_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_COLD_RST_REG_OFFSET 0x0FCUL -#define DX_ENV_CC_COLD_RST_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_COLD_RST_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_DUMMY_ADDR_REG_OFFSET 0x108UL -#define DX_ENV_DUMMY_ADDR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_DUMMY_ADDR_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_COUNTER_CLR_REG_OFFSET 0x118UL -#define DX_ENV_COUNTER_CLR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_COUNTER_CLR_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_COUNTER_RD_REG_OFFSET 0x11CUL -#define DX_ENV_COUNTER_RD_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_COUNTER_RD_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_RNG_DEBUG_ENABLE_REG_OFFSET 0x430UL -#define DX_ENV_RNG_DEBUG_ENABLE_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_RNG_DEBUG_ENABLE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_LCS_REG_OFFSET 0x43CUL -#define DX_ENV_CC_LCS_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_LCS_VALUE_BIT_SIZE 0x8UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_REG_OFFSET 0x440UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_CM_BIT_SHIFT 0x0UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_CM_BIT_SIZE 0x1UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_DM_BIT_SHIFT 0x1UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_DM_BIT_SIZE 0x1UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_SECURE_BIT_SHIFT 0x2UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_SECURE_BIT_SIZE 0x1UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_RMA_BIT_SHIFT 0x3UL -#define DX_ENV_CC_IS_CM_DM_SECURE_RMA_IS_RMA_BIT_SIZE 0x1UL -#define DX_ENV_DCU_EN_REG_OFFSET 0x444UL -#define DX_ENV_DCU_EN_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_DCU_EN_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_CC_LCS_IS_VALID_REG_OFFSET 0x448UL -#define DX_ENV_CC_LCS_IS_VALID_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_LCS_IS_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_POWER_DOWN_REG_OFFSET 0x478UL -#define DX_ENV_POWER_DOWN_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_POWER_DOWN_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_DCU_H_EN_REG_OFFSET 0x484UL -#define DX_ENV_DCU_H_EN_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_DCU_H_EN_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_VERSION_REG_OFFSET 0x488UL -#define DX_ENV_VERSION_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_VERSION_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_ROSC_WRITE_REG_OFFSET 0x48CUL -#define DX_ENV_ROSC_WRITE_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_ROSC_WRITE_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_ROSC_ADDR_REG_OFFSET 0x490UL -#define DX_ENV_ROSC_ADDR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_ROSC_ADDR_VALUE_BIT_SIZE 0x8UL -#define DX_ENV_RESET_SESSION_KEY_REG_OFFSET 0x494UL -#define DX_ENV_RESET_SESSION_KEY_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_RESET_SESSION_KEY_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_SESSION_KEY_0_REG_OFFSET 0x4A0UL -#define DX_ENV_SESSION_KEY_0_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_SESSION_KEY_0_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_SESSION_KEY_1_REG_OFFSET 0x4A4UL -#define DX_ENV_SESSION_KEY_1_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_SESSION_KEY_1_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_SESSION_KEY_2_REG_OFFSET 0x4A8UL -#define DX_ENV_SESSION_KEY_2_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_SESSION_KEY_2_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_SESSION_KEY_3_REG_OFFSET 0x4ACUL -#define DX_ENV_SESSION_KEY_3_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_SESSION_KEY_3_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_SESSION_KEY_VALID_REG_OFFSET 0x4B0UL -#define DX_ENV_SESSION_KEY_VALID_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_SESSION_KEY_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_SPIDEN_REG_OFFSET 0x4D0UL -#define DX_ENV_SPIDEN_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_SPIDEN_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_AXIM_USER_PARAMS_REG_OFFSET 0x600UL -#define DX_ENV_AXIM_USER_PARAMS_ARUSER_BIT_SHIFT 0x0UL -#define DX_ENV_AXIM_USER_PARAMS_ARUSER_BIT_SIZE 0x5UL -#define DX_ENV_AXIM_USER_PARAMS_AWUSER_BIT_SHIFT 0x5UL -#define DX_ENV_AXIM_USER_PARAMS_AWUSER_BIT_SIZE 0x5UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_REG_OFFSET 0x604UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_AWPROT_NS_BIT_BIT_SHIFT 0x0UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_AWPROT_NS_BIT_BIT_SIZE 0x1UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_AWPROT_NS_OVERRIDE_BIT_SHIFT 0x1UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_AWPROT_NS_OVERRIDE_BIT_SIZE 0x1UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_ARPROT_NS_BIT_BIT_SHIFT 0x2UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_ARPROT_NS_BIT_BIT_SIZE 0x1UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_ARPROT_NS_OVERRIDE_BIT_SHIFT 0x3UL -#define DX_ENV_SECURITY_MODE_OVERRIDE_ARPROT_NS_OVERRIDE_BIT_SIZE 0x1UL -#define DX_ENV_AO_CC_KPLT_0_REG_OFFSET 0x620UL -#define DX_ENV_AO_CC_KPLT_0_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_AO_CC_KPLT_0_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KPLT_1_REG_OFFSET 0x624UL -#define DX_ENV_AO_CC_KPLT_1_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_AO_CC_KPLT_1_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KPLT_2_REG_OFFSET 0x628UL -#define DX_ENV_AO_CC_KPLT_2_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_AO_CC_KPLT_2_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KPLT_3_REG_OFFSET 0x62CUL -#define DX_ENV_AO_CC_KPLT_3_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_AO_CC_KPLT_3_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KCST_0_REG_OFFSET 0x630UL -#define DX_ENV_AO_CC_KCST_0_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_AO_CC_KCST_0_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KCST_1_REG_OFFSET 0x634UL -#define DX_ENV_AO_CC_KCST_1_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_AO_CC_KCST_1_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KCST_2_REG_OFFSET 0x638UL -#define DX_ENV_AO_CC_KCST_2_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_AO_CC_KCST_2_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_AO_CC_KCST_3_REG_OFFSET 0x63CUL -#define DX_ENV_AO_CC_KCST_3_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_AO_CC_KCST_3_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APB_FIPS_ADDR_REG_OFFSET 0x650UL -#define DX_ENV_APB_FIPS_ADDR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APB_FIPS_ADDR_VALUE_BIT_SIZE 0xCUL -#define DX_ENV_APB_FIPS_VAL_REG_OFFSET 0x654UL -#define DX_ENV_APB_FIPS_VAL_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APB_FIPS_VAL_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APB_FIPS_MASK_REG_OFFSET 0x658UL -#define DX_ENV_APB_FIPS_MASK_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APB_FIPS_MASK_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APB_FIPS_CNT_REG_OFFSET 0x65CUL -#define DX_ENV_APB_FIPS_CNT_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APB_FIPS_CNT_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APB_FIPS_NEW_ADDR_REG_OFFSET 0x660UL -#define DX_ENV_APB_FIPS_NEW_ADDR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APB_FIPS_NEW_ADDR_VALUE_BIT_SIZE 0xCUL -#define DX_ENV_APB_FIPS_NEW_VAL_REG_OFFSET 0x664UL -#define DX_ENV_APB_FIPS_NEW_VAL_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APB_FIPS_NEW_VAL_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APBP_FIPS_ADDR_REG_OFFSET 0x670UL -#define DX_ENV_APBP_FIPS_ADDR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APBP_FIPS_ADDR_VALUE_BIT_SIZE 0xCUL -#define DX_ENV_APBP_FIPS_VAL_REG_OFFSET 0x674UL -#define DX_ENV_APBP_FIPS_VAL_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APBP_FIPS_VAL_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APBP_FIPS_MASK_REG_OFFSET 0x678UL -#define DX_ENV_APBP_FIPS_MASK_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APBP_FIPS_MASK_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APBP_FIPS_CNT_REG_OFFSET 0x67CUL -#define DX_ENV_APBP_FIPS_CNT_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APBP_FIPS_CNT_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_APBP_FIPS_NEW_ADDR_REG_OFFSET 0x680UL -#define DX_ENV_APBP_FIPS_NEW_ADDR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APBP_FIPS_NEW_ADDR_VALUE_BIT_SIZE 0xCUL -#define DX_ENV_APBP_FIPS_NEW_VAL_REG_OFFSET 0x684UL -#define DX_ENV_APBP_FIPS_NEW_VAL_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_APBP_FIPS_NEW_VAL_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_CC_POWERDOWN_EN_REG_OFFSET 0x690UL -#define DX_ENV_CC_POWERDOWN_EN_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_POWERDOWN_EN_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_CC_POWERDOWN_RST_EN_REG_OFFSET 0x694UL -#define DX_ENV_CC_POWERDOWN_RST_EN_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_CC_POWERDOWN_RST_EN_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_POWERDOWN_RST_CNTR_REG_OFFSET 0x698UL -#define DX_ENV_POWERDOWN_RST_CNTR_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_POWERDOWN_RST_CNTR_VALUE_BIT_SIZE 0x20UL -#define DX_ENV_POWERDOWN_EN_DEBUG_REG_OFFSET 0x69CUL -#define DX_ENV_POWERDOWN_EN_DEBUG_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_POWERDOWN_EN_DEBUG_VALUE_BIT_SIZE 0x1UL -// -------------------------------------- -// BLOCK: ENV_CC_MEMORIES -// -------------------------------------- -#define DX_ENV_FUSE_READY_REG_OFFSET 0x000UL -#define DX_ENV_FUSE_READY_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_FUSE_READY_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_PERF_RAM_MASTER_REG_OFFSET 0x0ECUL -#define DX_ENV_PERF_RAM_MASTER_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_PERF_RAM_MASTER_VALUE_BIT_SIZE 0x1UL -#define DX_ENV_PERF_RAM_ADDR_HIGH4_REG_OFFSET 0x0F0UL -#define DX_ENV_PERF_RAM_ADDR_HIGH4_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_PERF_RAM_ADDR_HIGH4_VALUE_BIT_SIZE 0x2UL -#define DX_ENV_FUSES_RAM_REG_OFFSET 0x3ECUL -#define DX_ENV_FUSES_RAM_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_FUSES_RAM_VALUE_BIT_SIZE 0x20UL -// -------------------------------------- -// BLOCK: ENV_PERF_RAM_BASE -// -------------------------------------- -#define DX_ENV_PERF_RAM_BASE_REG_OFFSET 0x000UL -#define DX_ENV_PERF_RAM_BASE_VALUE_BIT_SHIFT 0x0UL -#define DX_ENV_PERF_RAM_BASE_VALUE_BIT_SIZE 0x20UL - -#endif /*__DX_ENV_H__*/ diff --git a/drivers/staging/ccree/dx_reg_base_host.h b/drivers/staging/ccree/dx_reg_base_host.h index ffe45dded17f..47bbadbcd1df 100644 --- a/drivers/staging/ccree/dx_reg_base_host.h +++ b/drivers/staging/ccree/dx_reg_base_host.h @@ -17,16 +17,7 @@ #ifndef __DX_REG_BASE_HOST_H__ #define __DX_REG_BASE_HOST_H__ -/* Identify platform: Xilinx Zynq7000 ZC706 */ -#define DX_PLAT_ZYNQ7000 1 -#define DX_PLAT_ZYNQ7000_ZC706 1 - #define DX_BASE_CC 0x80000000 - -#define DX_BASE_ENV_REGS 0x40008000 -#define DX_BASE_ENV_CC_MEMORIES 0x40008000 -#define DX_BASE_ENV_PERF_RAM 0x40009000 - #define DX_BASE_HOST_RGF 0x0UL #define DX_BASE_CRY_KERNEL 0x0UL #define DX_BASE_ROM 0x40000000 diff --git a/drivers/staging/ccree/hw_queue_defs_plat.h b/drivers/staging/ccree/hw_queue_defs_plat.h deleted file mode 100644 index bcca509e2549..000000000000 --- a/drivers/staging/ccree/hw_queue_defs_plat.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef __HW_QUEUE_DEFS_PLAT_H__ -#define __HW_QUEUE_DEFS_PLAT_H__ - - -/*****************************/ -/* Descriptor packing macros */ -/*****************************/ - -#define HW_QUEUE_FREE_SLOTS_GET() (CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_CONTENT)) & HW_QUEUE_SLOTS_MAX) - -#define HW_QUEUE_POLL_QUEUE_UNTIL_FREE_SLOTS(seqLen) \ - do { \ - } while (HW_QUEUE_FREE_SLOTS_GET() < (seqLen)) - -#define HW_DESC_PUSH_TO_QUEUE(pDesc) do { \ - LOG_HW_DESC(pDesc); \ - HW_DESC_DUMP(pDesc); \ - CC_HAL_WRITE_REGISTER(GET_HW_Q_DESC_WORD_IDX(0), (pDesc)->word[0]); \ - CC_HAL_WRITE_REGISTER(GET_HW_Q_DESC_WORD_IDX(1), (pDesc)->word[1]); \ - CC_HAL_WRITE_REGISTER(GET_HW_Q_DESC_WORD_IDX(2), (pDesc)->word[2]); \ - CC_HAL_WRITE_REGISTER(GET_HW_Q_DESC_WORD_IDX(3), (pDesc)->word[3]); \ - CC_HAL_WRITE_REGISTER(GET_HW_Q_DESC_WORD_IDX(4), (pDesc)->word[4]); \ - wmb(); \ - CC_HAL_WRITE_REGISTER(GET_HW_Q_DESC_WORD_IDX(5), (pDesc)->word[5]); \ -} while (0) - -#endif /*__HW_QUEUE_DEFS_PLAT_H__*/ diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 5f1070801d54..d3e9eb2dcbf6 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -136,9 +136,6 @@ struct ssi_drvdata { struct resource *res_mem; struct resource *res_irq; void __iomem *cc_base; -#ifdef DX_BASE_ENV_REGS - void __iomem *env_base; /* ARM CryptoCell development FPGAs only */ -#endif unsigned int irq; uint32_t irq_mask; uint32_t fw_ver; -- cgit v1.2.3-55-g7522 From a1ab41ebd04601586bf30c9a03e6598d5dd3b826 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:35:55 +0300 Subject: staging: ccree: stdint to kernel types conversion Move from stdint style int_t/uint_t to kernel style u/s types. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 75 +++++++++--------- drivers/staging/ccree/cc_hw_queue_defs.h | 57 ++++++-------- drivers/staging/ccree/cc_lli_defs.h | 10 +-- drivers/staging/ccree/cc_regs.h | 4 +- drivers/staging/ccree/hash_defs.h | 14 ++-- drivers/staging/ccree/ssi_aead.c | 26 +++---- drivers/staging/ccree/ssi_aead.h | 26 +++---- drivers/staging/ccree/ssi_buffer_mgr.c | 126 +++++++++++++++--------------- drivers/staging/ccree/ssi_buffer_mgr.h | 10 +-- drivers/staging/ccree/ssi_cipher.c | 10 +-- drivers/staging/ccree/ssi_cipher.h | 10 +-- drivers/staging/ccree/ssi_driver.c | 16 ++-- drivers/staging/ccree/ssi_driver.h | 14 ++-- drivers/staging/ccree/ssi_fips.h | 10 +-- drivers/staging/ccree/ssi_fips_ll.c | 130 +++++++++++++++---------------- drivers/staging/ccree/ssi_fips_local.c | 6 +- drivers/staging/ccree/ssi_fips_local.h | 2 +- drivers/staging/ccree/ssi_hash.c | 86 ++++++++++---------- drivers/staging/ccree/ssi_hash.h | 32 ++++---- drivers/staging/ccree/ssi_ivgen.c | 4 +- drivers/staging/ccree/ssi_request_mgr.c | 28 +++---- drivers/staging/ccree/ssi_sram_mgr.c | 10 +-- drivers/staging/ccree/ssi_sram_mgr.h | 6 +- drivers/staging/ccree/ssi_sysfs.c | 24 +++--- 24 files changed, 357 insertions(+), 379 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index f8ebd7605179..31ccf518fda4 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -18,12 +18,7 @@ #ifndef _CC_CRYPTO_CTX_H_ #define _CC_CRYPTO_CTX_H_ -#ifdef __KERNEL__ #include -#define INT32_MAX 0x7FFFFFFFL -#else -#include -#endif #ifndef max @@ -113,7 +108,7 @@ enum drv_engine_type { DRV_ENGINE_HASH = 3, DRV_ENGINE_RC4 = 4, DRV_ENGINE_DOUT = 5, - DRV_ENGINE_RESERVE32B = INT32_MAX, + DRV_ENGINE_RESERVE32B = S32_MAX, }; enum drv_crypto_alg { @@ -126,7 +121,7 @@ enum drv_crypto_alg { DRV_CRYPTO_ALG_AEAD = 5, DRV_CRYPTO_ALG_BYPASS = 6, DRV_CRYPTO_ALG_NUM = 7, - DRV_CRYPTO_ALG_RESERVE32B = INT32_MAX + DRV_CRYPTO_ALG_RESERVE32B = S32_MAX }; enum drv_crypto_direction { @@ -134,7 +129,7 @@ enum drv_crypto_direction { DRV_CRYPTO_DIRECTION_ENCRYPT = 0, DRV_CRYPTO_DIRECTION_DECRYPT = 1, DRV_CRYPTO_DIRECTION_DECRYPT_ENCRYPT = 3, - DRV_CRYPTO_DIRECTION_RESERVE32B = INT32_MAX + DRV_CRYPTO_DIRECTION_RESERVE32B = S32_MAX }; enum drv_cipher_mode { @@ -152,7 +147,7 @@ enum drv_cipher_mode { DRV_CIPHER_GCTR = 12, DRV_CIPHER_ESSIV = 13, DRV_CIPHER_BITLOCKER = 14, - DRV_CIPHER_RESERVE32B = INT32_MAX + DRV_CIPHER_RESERVE32B = S32_MAX }; enum drv_hash_mode { @@ -167,7 +162,7 @@ enum drv_hash_mode { DRV_HASH_XCBC_MAC = 7, DRV_HASH_CMAC = 8, DRV_HASH_MODE_NUM = 9, - DRV_HASH_RESERVE32B = INT32_MAX + DRV_HASH_RESERVE32B = S32_MAX }; enum drv_hash_hw_mode { @@ -178,7 +173,7 @@ enum drv_hash_hw_mode { DRV_HASH_HW_SHA512 = 4, DRV_HASH_HW_SHA384 = 12, DRV_HASH_HW_GHASH = 6, - DRV_HASH_HW_RESERVE32B = INT32_MAX + DRV_HASH_HW_RESERVE32B = S32_MAX }; enum drv_multi2_mode { @@ -186,7 +181,7 @@ enum drv_multi2_mode { DRV_MULTI2_ECB = 0, DRV_MULTI2_CBC = 1, DRV_MULTI2_OFB = 2, - DRV_MULTI2_RESERVE32B = INT32_MAX + DRV_MULTI2_RESERVE32B = S32_MAX }; @@ -201,13 +196,13 @@ enum drv_crypto_key_type { DRV_APPLET_KEY = 4, /* NA */ DRV_PLATFORM_KEY = 5, /* 0x101 */ DRV_CUSTOMER_KEY = 6, /* 0x110 */ - DRV_END_OF_KEYS = INT32_MAX, + DRV_END_OF_KEYS = S32_MAX, }; enum drv_crypto_padding_type { DRV_PADDING_NONE = 0, DRV_PADDING_PKCS7 = 1, - DRV_PADDING_RESERVE32B = INT32_MAX + DRV_PADDING_RESERVE32B = S32_MAX }; /*******************************************************************/ @@ -223,9 +218,9 @@ struct drv_ctx_generic { struct drv_ctx_hash { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HASH */ enum drv_hash_mode mode; - uint8_t digest[CC_DIGEST_SIZE_MAX]; + u8 digest[CC_DIGEST_SIZE_MAX]; /* reserve to end of allocated context size */ - uint8_t reserved[CC_CTX_SIZE - 2 * sizeof(uint32_t) - + u8 reserved[CC_CTX_SIZE - 2 * sizeof(u32) - CC_DIGEST_SIZE_MAX]; }; @@ -234,11 +229,11 @@ struct drv_ctx_hash { struct drv_ctx_hmac { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HMAC */ enum drv_hash_mode mode; - uint8_t digest[CC_DIGEST_SIZE_MAX]; - uint32_t k0[CC_HMAC_BLOCK_SIZE_MAX/sizeof(uint32_t)]; - uint32_t k0_size; + u8 digest[CC_DIGEST_SIZE_MAX]; + u32 k0[CC_HMAC_BLOCK_SIZE_MAX/sizeof(u32)]; + u32 k0_size; /* reserve to end of allocated context size */ - uint8_t reserved[CC_CTX_SIZE - 3 * sizeof(uint32_t) - + u8 reserved[CC_CTX_SIZE - 3 * sizeof(u32) - CC_DIGEST_SIZE_MAX - CC_HMAC_BLOCK_SIZE_MAX]; }; @@ -248,19 +243,19 @@ struct drv_ctx_cipher { enum drv_crypto_direction direction; enum drv_crypto_key_type crypto_key_type; enum drv_crypto_padding_type padding_type; - uint32_t key_size; /* numeric value in bytes */ - uint32_t data_unit_size; /* required for XTS */ + u32 key_size; /* numeric value in bytes */ + u32 data_unit_size; /* required for XTS */ /* block_state is the AES engine block state. * It is used by the host to pass IV or counter at initialization. * It is used by SeP for intermediate block chaining state and for * returning MAC algorithms results. */ - uint8_t block_state[CC_AES_BLOCK_SIZE]; - uint8_t key[CC_AES_KEY_SIZE_MAX]; - uint8_t xex_key[CC_AES_KEY_SIZE_MAX]; + u8 block_state[CC_AES_BLOCK_SIZE]; + u8 key[CC_AES_KEY_SIZE_MAX]; + u8 xex_key[CC_AES_KEY_SIZE_MAX]; /* reserve to end of allocated context size */ - uint32_t reserved[CC_DRV_CTX_SIZE_WORDS - 7 - - CC_AES_BLOCK_SIZE/sizeof(uint32_t) - 2 * - (CC_AES_KEY_SIZE_MAX/sizeof(uint32_t))]; + u32 reserved[CC_DRV_CTX_SIZE_WORDS - 7 - + CC_AES_BLOCK_SIZE/sizeof(u32) - 2 * + (CC_AES_KEY_SIZE_MAX/sizeof(u32))]; }; /* authentication and encryption with associated data class */ @@ -268,20 +263,20 @@ struct drv_ctx_aead { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_AES */ enum drv_cipher_mode mode; enum drv_crypto_direction direction; - uint32_t key_size; /* numeric value in bytes */ - uint32_t nonce_size; /* nonce size (octets) */ - uint32_t header_size; /* finit additional data size (octets) */ - uint32_t text_size; /* finit text data size (octets) */ - uint32_t tag_size; /* mac size, element of {4, 6, 8, 10, 12, 14, 16} */ + u32 key_size; /* numeric value in bytes */ + u32 nonce_size; /* nonce size (octets) */ + u32 header_size; /* finit additional data size (octets) */ + u32 text_size; /* finit text data size (octets) */ + u32 tag_size; /* mac size, element of {4, 6, 8, 10, 12, 14, 16} */ /* block_state1/2 is the AES engine block state */ - uint8_t block_state[CC_AES_BLOCK_SIZE]; - uint8_t mac_state[CC_AES_BLOCK_SIZE]; /* MAC result */ - uint8_t nonce[CC_AES_BLOCK_SIZE]; /* nonce buffer */ - uint8_t key[CC_AES_KEY_SIZE_MAX]; + u8 block_state[CC_AES_BLOCK_SIZE]; + u8 mac_state[CC_AES_BLOCK_SIZE]; /* MAC result */ + u8 nonce[CC_AES_BLOCK_SIZE]; /* nonce buffer */ + u8 key[CC_AES_KEY_SIZE_MAX]; /* reserve to end of allocated context size */ - uint32_t reserved[CC_DRV_CTX_SIZE_WORDS - 8 - - 3 * (CC_AES_BLOCK_SIZE/sizeof(uint32_t)) - - CC_AES_KEY_SIZE_MAX/sizeof(uint32_t)]; + u32 reserved[CC_DRV_CTX_SIZE_WORDS - 8 - + 3 * (CC_AES_BLOCK_SIZE/sizeof(u32)) - + CC_AES_KEY_SIZE_MAX/sizeof(u32)]; }; /*******************************************************************/ diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 537ea0dcab7c..8c2b7f489373 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -17,18 +17,11 @@ #ifndef __CC_HW_QUEUE_DEFS_H__ #define __CC_HW_QUEUE_DEFS_H__ +#include + #include "cc_regs.h" #include "dx_crys_kernel.h" -#ifdef __KERNEL__ -#include -#define UINT32_MAX 0xFFFFFFFFL -#define INT32_MAX 0x7FFFFFFFL -#define UINT16_MAX 0xFFFFL -#else -#include -#endif - /****************************************************************************** * DEFINITIONS ******************************************************************************/ @@ -48,7 +41,7 @@ ******************************************************************************/ typedef struct HwDesc { - uint32_t word[HW_DESC_SIZE_WORDS]; + u32 word[HW_DESC_SIZE_WORDS]; } HwDesc_s; typedef enum DescDirection { @@ -56,7 +49,7 @@ typedef enum DescDirection { DESC_DIRECTION_ENCRYPT_ENCRYPT = 0, DESC_DIRECTION_DECRYPT_DECRYPT = 1, DESC_DIRECTION_DECRYPT_ENCRYPT = 3, - DESC_DIRECTION_END = INT32_MAX, + DESC_DIRECTION_END = S32_MAX, }DescDirection_t; typedef enum DmaMode { @@ -66,7 +59,7 @@ typedef enum DmaMode { DMA_DLLI = 2, DMA_MLLI = 3, DmaMode_OPTIONTS, - DmaMode_END = INT32_MAX, + DmaMode_END = S32_MAX, }DmaMode_t; typedef enum FlowMode { @@ -105,7 +98,7 @@ typedef enum FlowMode { S_HASH_to_DOUT = 43, SET_FLOW_ID = 44, FlowMode_OPTIONTS, - FlowMode_END = INT32_MAX, + FlowMode_END = S32_MAX, }FlowMode_t; typedef enum TunnelOp { @@ -113,7 +106,7 @@ typedef enum TunnelOp { TUNNEL_OFF = 0, TUNNEL_ON = 1, TunnelOp_OPTIONS, - TunnelOp_END = INT32_MAX, + TunnelOp_END = S32_MAX, } TunnelOp_t; typedef enum SetupOp { @@ -128,14 +121,14 @@ typedef enum SetupOp { SETUP_WRITE_STATE2 = 10, SETUP_WRITE_STATE3 = 11, setupOp_OPTIONTS, - setupOp_END = INT32_MAX, + setupOp_END = S32_MAX, }SetupOp_t; enum AesMacSelector { AES_SK = 1, AES_CMAC_INIT = 2, AES_CMAC_SIZE0 = 3, - AesMacEnd = INT32_MAX, + AesMacEnd = S32_MAX, }; #define HW_KEY_MASK_CIPHER_DO 0x3 @@ -156,21 +149,21 @@ typedef enum HwCryptoKey { KFDE1_KEY = 9, /* 0x1001 */ KFDE2_KEY = 10, /* 0x1010 */ KFDE3_KEY = 11, /* 0x1011 */ - END_OF_KEYS = INT32_MAX, + END_OF_KEYS = S32_MAX, }HwCryptoKey_t; typedef enum HwAesKeySize { AES_128_KEY = 0, AES_192_KEY = 1, AES_256_KEY = 2, - END_OF_AES_KEYS = INT32_MAX, + END_OF_AES_KEYS = S32_MAX, }HwAesKeySize_t; typedef enum HwDesKeySize { DES_ONE_KEY = 0, DES_TWO_KEYS = 1, DES_THREE_KEYS = 2, - END_OF_DES_KEYS = INT32_MAX, + END_OF_DES_KEYS = S32_MAX, }HwDesKeySize_t; /*****************************/ @@ -210,7 +203,7 @@ typedef enum HwDesKeySize { } while (0) -#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32)&UINT16_MAX) +#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32)&U16_MAX) /*! * This macro sets the DIN field of a HW descriptors @@ -223,7 +216,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DIN_TYPE(pDesc, dmaMode, dinAdr, dinSize, axiNs) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (dinAdr)&UINT32_MAX ); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (dinAdr)&U32_MAX ); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DIN_ADDR_HIGH, (pDesc)->word[5], MSB64(dinAdr) ); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], (dmaMode)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ @@ -241,7 +234,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DIN_NO_DMA(pDesc, dinAdr, dinSize) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (uint32_t)(dinAdr)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(dinAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ } while (0) @@ -256,7 +249,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DIN_SRAM(pDesc, dinAdr, dinSize) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (uint32_t)(dinAdr)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(dinAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], DMA_SRAM); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ } while (0) @@ -269,7 +262,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DIN_CONST(pDesc, val, dinSize) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (uint32_t)(val)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(val)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_CONST_VALUE, (pDesc)->word[1], 1); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], DMA_SRAM); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ @@ -296,7 +289,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DOUT_TYPE(pDesc, dmaMode, doutAdr, doutSize, axiNs) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&UINT32_MAX ); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&U32_MAX ); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], (dmaMode)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ @@ -315,7 +308,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DOUT_DLLI(pDesc, doutAdr, doutSize, axiNs ,lastInd) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&UINT32_MAX ); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&U32_MAX ); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_DLLI); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ @@ -335,7 +328,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DOUT_MLLI(pDesc, doutAdr, doutSize, axiNs ,lastInd) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&UINT32_MAX ); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&U32_MAX ); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_MLLI); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ @@ -354,7 +347,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DOUT_NO_DMA(pDesc, doutAdr, doutSize, registerWriteEnable) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(doutAdr)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(doutAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], (registerWriteEnable)); \ } while (0) @@ -367,7 +360,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_XOR_VAL(pDesc, xorVal) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(xorVal)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(xorVal)); \ } while (0) /*! @@ -401,7 +394,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_DOUT_SRAM(pDesc, doutAdr, doutSize) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(doutAdr)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(doutAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_SRAM); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ } while (0) @@ -415,7 +408,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_XEX_DATA_UNIT_SIZE(pDesc, dataUnitSize) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(dataUnitSize)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(dataUnitSize)); \ } while (0) /*! @@ -426,7 +419,7 @@ typedef enum HwDesKeySize { */ #define HW_DESC_SET_MULTI2_NUM_ROUNDS(pDesc, numRounds) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (uint32_t)(numRounds)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(numRounds)); \ } while (0) /*! diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index c4cdd83af58e..75d5e2762e8f 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -29,18 +29,18 @@ #define CC_MAX_MLLI_ENTRY_SIZE 0x10000 -#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32)&UINT16_MAX) +#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32)&U16_MAX) #define LLI_SET_ADDR(lli_p, addr) \ - BITFIELD_SET(((uint32_t *)(lli_p))[LLI_WORD0_OFFSET], LLI_LADDR_BIT_OFFSET, LLI_LADDR_BIT_SIZE, (addr & UINT32_MAX)); \ - BITFIELD_SET(((uint32_t *)(lli_p))[LLI_WORD1_OFFSET], LLI_HADDR_BIT_OFFSET, LLI_HADDR_BIT_SIZE, MSB64(addr)); + BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD0_OFFSET], LLI_LADDR_BIT_OFFSET, LLI_LADDR_BIT_SIZE, (addr & U32_MAX)); \ + BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD1_OFFSET], LLI_HADDR_BIT_OFFSET, LLI_HADDR_BIT_SIZE, MSB64(addr)); #define LLI_SET_SIZE(lli_p, size) \ - BITFIELD_SET(((uint32_t *)(lli_p))[LLI_WORD1_OFFSET], LLI_SIZE_BIT_OFFSET, LLI_SIZE_BIT_SIZE, size) + BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD1_OFFSET], LLI_SIZE_BIT_OFFSET, LLI_SIZE_BIT_SIZE, size) /* Size of entry */ #define LLI_ENTRY_WORD_SIZE 2 -#define LLI_ENTRY_BYTE_SIZE (LLI_ENTRY_WORD_SIZE * sizeof(uint32_t)) +#define LLI_ENTRY_BYTE_SIZE (LLI_ENTRY_WORD_SIZE * sizeof(u32)) /* Word0[31:0] = ADDR[31:0] */ #define LLI_WORD0_OFFSET 0 diff --git a/drivers/staging/ccree/cc_regs.h b/drivers/staging/ccree/cc_regs.h index e81b0dc8ce5e..8b89f0603f16 100644 --- a/drivers/staging/ccree/cc_regs.h +++ b/drivers/staging/ccree/cc_regs.h @@ -35,7 +35,7 @@ /* Read-Modify-Write a field of a register */ #define MODIFY_REGISTER_FLD(unitName, regName, fldName, fldVal) \ do { \ - uint32_t regVal; \ + u32 regVal; \ regVal = READ_REGISTER(CC_REG_ADDR(unitName, regName)); \ CC_REG_FLD_SET(unitName, regName, fldName, regVal, fldVal); \ WRITE_REGISTER(CC_REG_ADDR(unitName, regName), regVal); \ @@ -86,7 +86,7 @@ do { \ } while (0) /* Usage example: - uint32_t reg_shadow = READ_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL)); + u32 reg_shadow = READ_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL)); CC_REG_FLD_SET(CRY_KERNEL,AES_CONTROL,NK_KEY0,reg_shadow, 3); CC_REG_FLD_SET(CRY_KERNEL,AES_CONTROL,NK_KEY1,reg_shadow, 1); WRITE_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL), reg_shadow); diff --git a/drivers/staging/ccree/hash_defs.h b/drivers/staging/ccree/hash_defs.h index a441c81b33b1..613897038f6d 100644 --- a/drivers/staging/ccree/hash_defs.h +++ b/drivers/staging/ccree/hash_defs.h @@ -48,13 +48,13 @@ enum HashConfig1Padding { HASH_PADDING_DISABLED = 0, HASH_PADDING_ENABLED = 1, HASH_DIGEST_RESULT_LITTLE_ENDIAN = 2, - HASH_CONFIG1_PADDING_RESERVE32 = INT32_MAX, + HASH_CONFIG1_PADDING_RESERVE32 = S32_MAX, }; enum HashCipherDoPadding { DO_NOT_PAD = 0, DO_PAD = 1, - HASH_CIPHER_DO_PADDING_RESERVE32 = INT32_MAX, + HASH_CIPHER_DO_PADDING_RESERVE32 = S32_MAX, }; typedef struct SepHashPrivateContext { @@ -66,11 +66,11 @@ typedef struct SepHashPrivateContext { This means that this structure size (without the reserved field can be up to 20 bytes , in case sha512 is not suppported it is 20 bytes (SEP_HASH_LENGTH_WORDS define to 2 ) and in the other case it is 28 (SEP_HASH_LENGTH_WORDS define to 4) */ - uint32_t reserved[(sizeof(struct drv_ctx_hash)/sizeof(uint32_t)) - SEP_HASH_LENGTH_WORDS - 3]; - uint32_t CurrentDigestedLength[SEP_HASH_LENGTH_WORDS]; - uint32_t KeyType; - uint32_t dataCompleted; - uint32_t hmacFinalization; + u32 reserved[(sizeof(struct drv_ctx_hash)/sizeof(u32)) - SEP_HASH_LENGTH_WORDS - 3]; + u32 CurrentDigestedLength[SEP_HASH_LENGTH_WORDS]; + u32 KeyType; + u32 dataCompleted; + u32 hmacFinalization; /* no space left */ } SepHashPrivateContext_s; diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 240a3c481db8..7f9b5cc777e9 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -60,18 +60,18 @@ struct ssi_aead_handle { struct ssi_aead_ctx { struct ssi_drvdata *drvdata; - uint8_t ctr_nonce[MAX_NONCE_SIZE]; /* used for ctr3686 iv and aes ccm */ - uint8_t *enckey; + u8 ctr_nonce[MAX_NONCE_SIZE]; /* used for ctr3686 iv and aes ccm */ + u8 *enckey; dma_addr_t enckey_dma_addr; union { struct { - uint8_t *padded_authkey; - uint8_t *ipad_opad; /* IPAD, OPAD*/ + u8 *padded_authkey; + u8 *ipad_opad; /* IPAD, OPAD*/ dma_addr_t padded_authkey_dma_addr; dma_addr_t ipad_opad_dma_addr; } hmac; struct { - uint8_t *xcbc_keys; /* K1,K2,K3 */ + u8 *xcbc_keys; /* K1,K2,K3 */ dma_addr_t xcbc_keys_dma_addr; } xcbc; } auth_state; @@ -428,7 +428,7 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl dma_addr_t key_dma_addr = 0; struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = &ctx->drvdata->plat_dev->dev; - uint32_t larval_addr = ssi_ahash_get_larval_digest_sram_addr( + u32 larval_addr = ssi_ahash_get_larval_digest_sram_addr( ctx->drvdata, ctx->auth_mode); struct ssi_crypto_req ssi_req = {}; unsigned int blocksize; @@ -831,7 +831,7 @@ ssi_aead_process_authenc_data_desc( * assoc. + iv + data -compact in one table * if assoclen is ZERO only IV perform */ ssi_sram_addr_t mlli_addr = areq_ctx->assoc.sram_addr; - uint32_t mlli_nents = areq_ctx->assoc.mlli_nents; + u32 mlli_nents = areq_ctx->assoc.mlli_nents; if (likely(areq_ctx->is_single_pass == true)) { if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT){ @@ -1386,11 +1386,11 @@ static int validate_data_size(struct ssi_aead_ctx *ctx, break; } - if (!IS_ALIGNED(assoclen, sizeof(uint32_t))) + if (!IS_ALIGNED(assoclen, sizeof(u32))) areq_ctx->is_single_pass = false; if ((ctx->cipher_mode == DRV_CIPHER_CTR) && - !IS_ALIGNED(cipherlen, sizeof(uint32_t))) + !IS_ALIGNED(cipherlen, sizeof(u32))) areq_ctx->is_single_pass = false; break; @@ -1412,7 +1412,7 @@ data_size_err: } #if SSI_CC_HAS_AES_CCM -static unsigned int format_ccm_a0(uint8_t *pA0Buff, uint32_t headerSize) +static unsigned int format_ccm_a0(u8 *pA0Buff, u32 headerSize) { unsigned int len = 0; if ( headerSize == 0 ) { @@ -1597,9 +1597,9 @@ static int config_ccm_adata(struct aead_request *req) { /* Note: The code assume that req->iv[0] already contains the value of L' of RFC3610 */ unsigned int l = lp + 1; /* This is L' of RFC 3610. */ unsigned int m = ctx->authsize; /* This is M' of RFC 3610. */ - uint8_t *b0 = req_ctx->ccm_config + CCM_B0_OFFSET; - uint8_t *a0 = req_ctx->ccm_config + CCM_A0_OFFSET; - uint8_t *ctr_count_0 = req_ctx->ccm_config + CCM_CTR_COUNT_0_OFFSET; + u8 *b0 = req_ctx->ccm_config + CCM_B0_OFFSET; + u8 *a0 = req_ctx->ccm_config + CCM_A0_OFFSET; + u8 *ctr_count_0 = req_ctx->ccm_config + CCM_CTR_COUNT_0_OFFSET; unsigned int cryptlen = (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT) ? req->cryptlen : diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 6135ff28438e..654a181729d7 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -57,30 +57,30 @@ enum aead_ccm_header_size { ccm_header_size_zero = 0, ccm_header_size_2 = 2, ccm_header_size_6 = 6, - ccm_header_size_max = INT32_MAX + ccm_header_size_max = S32_MAX }; struct aead_req_ctx { /* Allocate cache line although only 4 bytes are needed to * assure next field falls @ cache line * Used for both: digest HW compare and CCM/GCM MAC value */ - uint8_t mac_buf[MAX_MAC_SIZE] ____cacheline_aligned; - uint8_t ctr_iv[AES_BLOCK_SIZE] ____cacheline_aligned; + u8 mac_buf[MAX_MAC_SIZE] ____cacheline_aligned; + u8 ctr_iv[AES_BLOCK_SIZE] ____cacheline_aligned; //used in gcm - uint8_t gcm_iv_inc1[AES_BLOCK_SIZE] ____cacheline_aligned; - uint8_t gcm_iv_inc2[AES_BLOCK_SIZE] ____cacheline_aligned; - uint8_t hkey[AES_BLOCK_SIZE] ____cacheline_aligned; + u8 gcm_iv_inc1[AES_BLOCK_SIZE] ____cacheline_aligned; + u8 gcm_iv_inc2[AES_BLOCK_SIZE] ____cacheline_aligned; + u8 hkey[AES_BLOCK_SIZE] ____cacheline_aligned; struct { - uint8_t lenA[GCM_BLOCK_LEN_SIZE] ____cacheline_aligned; - uint8_t lenC[GCM_BLOCK_LEN_SIZE] ; + u8 lenA[GCM_BLOCK_LEN_SIZE] ____cacheline_aligned; + u8 lenC[GCM_BLOCK_LEN_SIZE] ; } gcm_len_block; - uint8_t ccm_config[CCM_CONFIG_BUF_SIZE] ____cacheline_aligned; + u8 ccm_config[CCM_CONFIG_BUF_SIZE] ____cacheline_aligned; unsigned int hw_iv_size ____cacheline_aligned; /*HW actual size input*/ - uint8_t backup_mac[MAX_MAC_SIZE]; /*used to prevent cache coherence problem*/ - uint8_t *backup_iv; /*store iv for generated IV flow*/ - uint8_t *backup_giv; /*store iv for rfc3686(ctr) flow*/ + u8 backup_mac[MAX_MAC_SIZE]; /*used to prevent cache coherence problem*/ + u8 *backup_iv; /*store iv for generated IV flow*/ + u8 *backup_giv; /*store iv for rfc3686(ctr) flow*/ dma_addr_t mac_buf_dma_addr; /* internal ICV DMA buffer */ dma_addr_t ccm_iv0_dma_addr; /* buffer for internal ccm configurations */ dma_addr_t icv_dma_addr; /* Phys. address of ICV */ @@ -92,7 +92,7 @@ struct aead_req_ctx { dma_addr_t gcm_block_len_dma_addr; /* Phys. address of gcm block len */ bool is_gcm4543; - uint8_t *icv_virt_addr; /* Virt. address of ICV */ + u8 *icv_virt_addr; /* Virt. address of ICV */ struct async_gen_req_ctx gen_ctx; struct ssi_mlli assoc; struct ssi_mlli src; diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 39065e8b75b1..77e490968db9 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -92,11 +92,11 @@ struct buffer_array { int total_data_len[MAX_NUM_OF_BUFFERS_IN_MLLI]; enum dma_buffer_type type[MAX_NUM_OF_BUFFERS_IN_MLLI]; bool is_last[MAX_NUM_OF_BUFFERS_IN_MLLI]; - uint32_t * mlli_nents[MAX_NUM_OF_BUFFERS_IN_MLLI]; + u32 * mlli_nents[MAX_NUM_OF_BUFFERS_IN_MLLI]; }; #ifdef CC_DMA_48BIT_SIM -dma_addr_t ssi_buff_mgr_update_dma_addr(dma_addr_t orig_addr, uint32_t data_len) +dma_addr_t ssi_buff_mgr_update_dma_addr(dma_addr_t orig_addr, u32 data_len) { dma_addr_t tmp_dma_addr; #ifdef CC_DMA_48BIT_SIM_FULL @@ -109,7 +109,7 @@ dma_addr_t ssi_buff_mgr_update_dma_addr(dma_addr_t orig_addr, uint32_t data_len) (data_len <= CC_MAX_MLLI_ENTRY_SIZE)) { #endif tmp_dma_addr = ((orig_addr<<16) | 0xFFFF0000 | - (orig_addr & UINT16_MAX)); + (orig_addr & U16_MAX)); SSI_LOG_DEBUG("MAP DMA: orig address=0x%llX " "dma_address=0x%llX\n", orig_addr, tmp_dma_addr); @@ -134,7 +134,7 @@ dma_addr_t ssi_buff_mgr_restore_dma_addr(dma_addr_t orig_addr) /*clean the 0xFFFF in the lower bits (set in the add expansion)*/ tmp_dma_addr &= 0xFFFF0000; /* Set the original 16 bits */ - tmp_dma_addr |= (orig_addr & UINT16_MAX); + tmp_dma_addr |= (orig_addr & U16_MAX); SSI_LOG_DEBUG("Release DMA: orig address=0x%llX " "dma_address=0x%llX\n", orig_addr, tmp_dma_addr); @@ -151,7 +151,7 @@ dma_addr_t ssi_buff_mgr_restore_dma_addr(dma_addr_t orig_addr) * @lbytes: [OUT] Returns the amount of bytes at the last entry */ static unsigned int ssi_buffer_mgr_get_sgl_nents( - struct scatterlist *sg_list, unsigned int nbytes, uint32_t *lbytes, bool *is_chained) + struct scatterlist *sg_list, unsigned int nbytes, u32 *lbytes, bool *is_chained) { unsigned int nents = 0; while (nbytes != 0) { @@ -182,7 +182,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( * * @sgl: */ -void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, uint32_t data_len) +void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, u32 data_len) { struct scatterlist *current_sg = sgl; int sg_index = 0; @@ -210,21 +210,21 @@ void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, uint32_t data_len) */ void ssi_buffer_mgr_copy_scatterlist_portion( u8 *dest, struct scatterlist *sg, - uint32_t to_skip, uint32_t end, + u32 to_skip, u32 end, enum ssi_sg_cpy_direct direct) { - uint32_t nents, lbytes; + u32 nents, lbytes; nents = ssi_buffer_mgr_get_sgl_nents(sg, end, &lbytes, NULL); sg_copy_buffer(sg, nents, (void *)dest, (end - to_skip), 0, (direct == SSI_SG_TO_BUF)); } static inline int ssi_buffer_mgr_render_buff_to_mlli( - dma_addr_t buff_dma, uint32_t buff_size, uint32_t *curr_nents, - uint32_t **mlli_entry_pp) + dma_addr_t buff_dma, u32 buff_size, u32 *curr_nents, + u32 **mlli_entry_pp) { - uint32_t *mlli_entry_p = *mlli_entry_pp; - uint32_t new_nents;; + u32 *mlli_entry_p = *mlli_entry_pp; + u32 new_nents;; /* Verify there is no memory overflow*/ new_nents = (*curr_nents + buff_size/CC_MAX_MLLI_ENTRY_SIZE + 1); @@ -261,16 +261,16 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( static inline int ssi_buffer_mgr_render_scatterlist_to_mlli( - struct scatterlist *sgl, uint32_t sgl_data_len, uint32_t sglOffset, uint32_t *curr_nents, - uint32_t **mlli_entry_pp) + struct scatterlist *sgl, u32 sgl_data_len, u32 sglOffset, u32 *curr_nents, + u32 **mlli_entry_pp) { struct scatterlist *curr_sgl = sgl; - uint32_t *mlli_entry_p = *mlli_entry_pp; - int32_t rc = 0; + u32 *mlli_entry_p = *mlli_entry_pp; + s32 rc = 0; for ( ; (curr_sgl != NULL) && (sgl_data_len != 0); curr_sgl = sg_next(curr_sgl)) { - uint32_t entry_data_len = + u32 entry_data_len = (sgl_data_len > sg_dma_len(curr_sgl) - sglOffset) ? sg_dma_len(curr_sgl) - sglOffset : sgl_data_len ; sgl_data_len -= entry_data_len; @@ -291,8 +291,8 @@ static int ssi_buffer_mgr_generate_mlli( struct buffer_array *sg_data, struct mlli_params *mlli_params) { - uint32_t *mlli_p; - uint32_t total_nents = 0,prev_total_nents = 0; + u32 *mlli_p; + u32 total_nents = 0,prev_total_nents = 0; int rc = 0, i; SSI_LOG_DEBUG("NUM of SG's = %d\n", sg_data->num_of_buffers); @@ -310,7 +310,7 @@ static int ssi_buffer_mgr_generate_mlli( (MAX_NUM_OF_TOTAL_MLLI_ENTRIES* LLI_ENTRY_BYTE_SIZE)); /* Point to start of MLLI */ - mlli_p = (uint32_t *)mlli_params->mlli_virt_addr; + mlli_p = (u32 *)mlli_params->mlli_virt_addr; /* go over all SG's and link it to one MLLI table */ for (i = 0; i < sg_data->num_of_buffers; i++) { if (sg_data->type[i] == DMA_SGL_TYPE) @@ -353,7 +353,7 @@ build_mlli_exit: static inline void ssi_buffer_mgr_add_buffer_entry( struct buffer_array *sgl_data, dma_addr_t buffer_dma, unsigned int buffer_len, - bool is_last_entry, uint32_t *mlli_nents) + bool is_last_entry, u32 *mlli_nents) { unsigned int index = sgl_data->num_of_buffers; @@ -379,7 +379,7 @@ static inline void ssi_buffer_mgr_add_scatterlist_entry( unsigned int data_len, unsigned int data_offset, bool is_last_table, - uint32_t *mlli_nents) + u32 *mlli_nents) { unsigned int index = sgl_data->num_of_buffers; @@ -398,10 +398,10 @@ static inline void ssi_buffer_mgr_add_scatterlist_entry( } static int -ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, uint32_t nents, +ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, u32 nents, enum dma_data_direction direction) { - uint32_t i , j; + u32 i , j; struct scatterlist *l_sg = sg; for (i = 0; i < nents; i++) { if (l_sg == NULL) { @@ -430,8 +430,8 @@ err: static int ssi_buffer_mgr_map_scatterlist( struct device *dev, struct scatterlist *sg, unsigned int nbytes, int direction, - uint32_t *nents, uint32_t max_sg_nents, - uint32_t *lbytes, uint32_t *mapped_nents) + u32 *nents, u32 max_sg_nents, + u32 *lbytes, u32 *mapped_nents) { bool is_chained = false; @@ -491,7 +491,7 @@ static int ssi_buffer_mgr_map_scatterlist( static inline int ssi_aead_handle_config_buf(struct device *dev, struct aead_req_ctx *areq_ctx, - uint8_t* config_data, + u8* config_data, struct buffer_array *sg_data, unsigned int assoclen) { @@ -526,8 +526,8 @@ ssi_aead_handle_config_buf(struct device *dev, static inline int ssi_ahash_handle_curr_buf(struct device *dev, struct ahash_req_ctx *areq_ctx, - uint8_t* curr_buff, - uint32_t curr_buff_cnt, + u8* curr_buff, + u32 curr_buff_cnt, struct buffer_array *sg_data) { SSI_LOG_DEBUG(" handle curr buff %x set to DLLI \n", curr_buff_cnt); @@ -612,9 +612,9 @@ int ssi_buffer_mgr_map_blkcipher_request( struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle; struct device *dev = &drvdata->plat_dev->dev; struct buffer_array sg_data; - uint32_t dummy = 0; + u32 dummy = 0; int rc = 0; - uint32_t mapped_nents = 0; + u32 mapped_nents = 0; req_ctx->dma_buf_type = SSI_DMA_BUF_DLLI; mlli_params->curr_pool = NULL; @@ -622,7 +622,7 @@ int ssi_buffer_mgr_map_blkcipher_request( /* Map IV buffer */ if (likely(ivsize != 0) ) { - dump_byte_array("iv", (uint8_t *)info, ivsize); + dump_byte_array("iv", (u8 *)info, ivsize); req_ctx->gen_ctx.iv_dma_addr = dma_map_single(dev, (void *)info, ivsize, @@ -710,9 +710,9 @@ void ssi_buffer_mgr_unmap_aead_request( struct aead_req_ctx *areq_ctx = aead_request_ctx(req); unsigned int hw_iv_size = areq_ctx->hw_iv_size; struct crypto_aead *tfm = crypto_aead_reqtfm(req); - uint32_t dummy; + u32 dummy; bool chained; - uint32_t size_to_unmap = 0; + u32 size_to_unmap = 0; if (areq_ctx->mac_buf_dma_addr != 0) { SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->mac_buf_dma_addr); @@ -796,7 +796,7 @@ void ssi_buffer_mgr_unmap_aead_request( if ((areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) && likely(req->src == req->dst)) { - uint32_t size_to_skip = req->assoclen; + u32 size_to_skip = req->assoclen; if (areq_ctx->is_gcm4543) { size_to_skip += crypto_aead_ivsize(tfm); } @@ -814,7 +814,7 @@ static inline int ssi_buffer_mgr_get_aead_icv_nents( struct scatterlist *sgl, unsigned int sgl_nents, unsigned int authsize, - uint32_t last_entry_data_size, + u32 last_entry_data_size, bool *is_icv_fragmented) { unsigned int icv_max_size = 0; @@ -914,11 +914,11 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( { struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc = 0; - uint32_t mapped_nents = 0; + u32 mapped_nents = 0; struct scatterlist *current_sg = req->src; struct crypto_aead *tfm = crypto_aead_reqtfm(req); unsigned int sg_index = 0; - uint32_t size_of_assoc = req->assoclen; + u32 size_of_assoc = req->assoclen; if (areq_ctx->is_gcm4543) { size_of_assoc += crypto_aead_ivsize(tfm); @@ -1004,7 +1004,7 @@ chain_assoc_exit: static inline void ssi_buffer_mgr_prepare_aead_data_dlli( struct aead_request *req, - uint32_t *src_last_bytes, uint32_t *dst_last_bytes) + u32 *src_last_bytes, u32 *dst_last_bytes) { struct aead_req_ctx *areq_ctx = aead_request_ctx(req); enum drv_crypto_direction direct = areq_ctx->gen_ctx.op_type; @@ -1042,7 +1042,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( struct ssi_drvdata *drvdata, struct aead_request *req, struct buffer_array *sg_data, - uint32_t *src_last_bytes, uint32_t *dst_last_bytes, + u32 *src_last_bytes, u32 *dst_last_bytes, bool is_last_table) { struct aead_req_ctx *areq_ctx = aead_request_ctx(req); @@ -1075,7 +1075,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( /* In ACP platform we already copying ICV for any INPLACE-DECRYPT operation, hence we must neglect this code. */ - uint32_t size_to_skip = req->assoclen; + u32 size_to_skip = req->assoclen; if (areq_ctx->is_gcm4543) { size_to_skip += crypto_aead_ivsize(tfm); } @@ -1122,7 +1122,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( /* Backup happens only when ICV is fragmented, ICV verification is made by CPU compare in order to simplify MAC verification upon request completion */ - uint32_t size_to_skip = req->assoclen; + u32 size_to_skip = req->assoclen; if (areq_ctx->is_gcm4543) { size_to_skip += crypto_aead_ivsize(tfm); } @@ -1190,14 +1190,14 @@ static inline int ssi_buffer_mgr_aead_chain_data( unsigned int authsize = areq_ctx->req_authsize; int src_last_bytes = 0, dst_last_bytes = 0; int rc = 0; - uint32_t src_mapped_nents = 0, dst_mapped_nents = 0; - uint32_t offset = 0; + u32 src_mapped_nents = 0, dst_mapped_nents = 0; + u32 offset = 0; unsigned int size_for_map = req->assoclen +req->cryptlen; /*non-inplace mode*/ struct crypto_aead *tfm = crypto_aead_reqtfm(req); - uint32_t sg_index = 0; + u32 sg_index = 0; bool chained = false; bool is_gcm4543 = areq_ctx->is_gcm4543; - uint32_t size_to_skip = req->assoclen; + u32 size_to_skip = req->assoclen; if (is_gcm4543) { size_to_skip += crypto_aead_ivsize(tfm); } @@ -1302,7 +1302,7 @@ static void ssi_buffer_mgr_update_aead_mlli_nents( struct ssi_drvdata *drvdata, struct aead_request *req) { struct aead_req_ctx *areq_ctx = aead_request_ctx(req); - uint32_t curr_mlli_size = 0; + u32 curr_mlli_size = 0; if (areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI) { areq_ctx->assoc.sram_addr = drvdata->mlli_sram_addr; @@ -1362,9 +1362,9 @@ int ssi_buffer_mgr_map_aead_request( struct crypto_aead *tfm = crypto_aead_reqtfm(req); bool is_gcm4543 = areq_ctx->is_gcm4543; - uint32_t mapped_nents = 0; - uint32_t dummy = 0; /*used for the assoc data fragments */ - uint32_t size_to_map = 0; + u32 mapped_nents = 0; + u32 dummy = 0; /*used for the assoc data fragments */ + u32 size_to_map = 0; mlli_params->curr_pool = NULL; sg_data.num_of_buffers = 0; @@ -1373,7 +1373,7 @@ int ssi_buffer_mgr_map_aead_request( if ((areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) && likely(req->src == req->dst)) { - uint32_t size_to_skip = req->assoclen; + u32 size_to_skip = req->assoclen; if (is_gcm4543) { size_to_skip += crypto_aead_ivsize(tfm); } @@ -1568,15 +1568,15 @@ int ssi_buffer_mgr_map_hash_request_final( { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; struct device *dev = &drvdata->plat_dev->dev; - uint8_t* curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : + u8* curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : areq_ctx->buff0; - uint32_t *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : + u32 *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : &areq_ctx->buff0_cnt; struct mlli_params *mlli_params = &areq_ctx->mlli_params; struct buffer_array sg_data; struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle; - uint32_t dummy = 0; - uint32_t mapped_nents = 0; + u32 dummy = 0; + u32 mapped_nents = 0; SSI_LOG_DEBUG(" final params : curr_buff=%pK " "curr_buff_cnt=0x%X nbytes = 0x%X " @@ -1660,22 +1660,22 @@ int ssi_buffer_mgr_map_hash_request_update( { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; struct device *dev = &drvdata->plat_dev->dev; - uint8_t* curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : + u8* curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : areq_ctx->buff0; - uint32_t *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : + u32 *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : &areq_ctx->buff0_cnt; - uint8_t* next_buff = areq_ctx->buff_index ? areq_ctx->buff0 : + u8* next_buff = areq_ctx->buff_index ? areq_ctx->buff0 : areq_ctx->buff1; - uint32_t *next_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : + u32 *next_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : &areq_ctx->buff1_cnt; struct mlli_params *mlli_params = &areq_ctx->mlli_params; unsigned int update_data_len; - uint32_t total_in_len = nbytes + *curr_buff_cnt; + u32 total_in_len = nbytes + *curr_buff_cnt; struct buffer_array sg_data; struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle; unsigned int swap_index = 0; - uint32_t dummy = 0; - uint32_t mapped_nents = 0; + u32 dummy = 0; + u32 mapped_nents = 0; SSI_LOG_DEBUG(" update params : curr_buff=%pK " "curr_buff_cnt=0x%X nbytes=0x%X " @@ -1789,7 +1789,7 @@ void ssi_buffer_mgr_unmap_hash_request( struct device *dev, void *ctx, struct scatterlist *src, bool do_revert) { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; - uint32_t *prev_len = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : + u32 *prev_len = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : &areq_ctx->buff1_cnt; /*In case a pool was set, a table was diff --git a/drivers/staging/ccree/ssi_buffer_mgr.h b/drivers/staging/ccree/ssi_buffer_mgr.h index 8c3273edc618..4acbb4b6afc9 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.h +++ b/drivers/staging/ccree/ssi_buffer_mgr.h @@ -46,9 +46,9 @@ struct ssi_mlli { struct mlli_params { struct dma_pool *curr_pool; - uint8_t *mlli_virt_addr; + u8 *mlli_virt_addr; dma_addr_t mlli_dma_addr; - uint32_t mlli_len; + u32 mlli_len; }; int ssi_buffer_mgr_init(struct ssi_drvdata *drvdata); @@ -81,13 +81,13 @@ int ssi_buffer_mgr_map_hash_request_update(struct ssi_drvdata *drvdata, void *ct void ssi_buffer_mgr_unmap_hash_request(struct device *dev, void *ctx, struct scatterlist *src, bool do_revert); -void ssi_buffer_mgr_copy_scatterlist_portion(u8 *dest, struct scatterlist *sg, uint32_t to_skip, uint32_t end, enum ssi_sg_cpy_direct direct); +void ssi_buffer_mgr_copy_scatterlist_portion(u8 *dest, struct scatterlist *sg, u32 to_skip, u32 end, enum ssi_sg_cpy_direct direct); -void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, uint32_t data_len); +void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, u32 data_len); #ifdef CC_DMA_48BIT_SIM -dma_addr_t ssi_buff_mgr_update_dma_addr(dma_addr_t orig_addr, uint32_t data_len); +dma_addr_t ssi_buff_mgr_update_dma_addr(dma_addr_t orig_addr, u32 data_len); dma_addr_t ssi_buff_mgr_restore_dma_addr(dma_addr_t orig_addr); #define SSI_UPDATE_DMA_ADDR_TO_48BIT(addr,size) addr = \ diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 7e85d2c0dfab..c62fe4f98595 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -45,7 +45,7 @@ struct ssi_blkcipher_handle { }; struct cc_user_key_info { - uint8_t *key; + u8 *key; dma_addr_t key_dma_addr; }; struct cc_hw_key_info { @@ -69,7 +69,7 @@ struct ssi_ablkcipher_ctx { static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __iomem *cc_base); -static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, uint32_t size) { +static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { switch (ctx_p->flow_mode){ case S_DIN_to_AES: switch (size){ @@ -329,7 +329,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, SSI_LOG_DEBUG("Setting key in context @%p for %s. keylen=%u\n", ctx_p, crypto_tfm_alg_name(tfm), keylen); - dump_byte_array("key", (uint8_t *)key, keylen); + dump_byte_array("key", (u8 *)key, keylen); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -724,7 +724,7 @@ ssi_blkcipher_create_data_desc( "addr 0x%08X addr 0x%08X\n", (unsigned int)ctx_p->drvdata->mlli_sram_addr, (unsigned int)ctx_p->drvdata->mlli_sram_addr + - (uint32_t)LLI_ENTRY_BYTE_SIZE * + (u32)LLI_ENTRY_BYTE_SIZE * req_ctx->in_nents); HW_DESC_SET_DOUT_MLLI(&desc[*seq_size], (ctx_p->drvdata->mlli_sram_addr + @@ -750,7 +750,7 @@ static int ssi_blkcipher_complete(struct device *dev, void __iomem *cc_base) { int completion_error = 0; - uint32_t inflight_counter; + u32 inflight_counter; DECL_CYCLE_COUNT_RESOURCES; START_CYCLE_COUNT(); diff --git a/drivers/staging/ccree/ssi_cipher.h b/drivers/staging/ccree/ssi_cipher.h index ec2d4f4964d0..7d58b56fc2c7 100644 --- a/drivers/staging/ccree/ssi_cipher.h +++ b/drivers/staging/ccree/ssi_cipher.h @@ -40,11 +40,11 @@ struct blkcipher_req_ctx { struct async_gen_req_ctx gen_ctx; enum ssi_req_dma_buf_type dma_buf_type; - uint32_t in_nents; - uint32_t in_mlli_nents; - uint32_t out_nents; - uint32_t out_mlli_nents; - uint8_t *backup_info; /*store iv for generated IV flow*/ + u32 in_nents; + u32 in_mlli_nents; + u32 out_nents; + u32 out_mlli_nents; + u8 *backup_info; /*store iv for generated IV flow*/ bool is_giv; struct mlli_params mlli_params; }; diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 75b9f41d9c50..52c698431404 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -73,10 +73,10 @@ #ifdef DX_DUMP_BYTES -void dump_byte_array(const char *name, const uint8_t *the_array, unsigned long size) +void dump_byte_array(const char *name, const u8 *the_array, unsigned long size) { int i , line_offset = 0, ret = 0; - const uint8_t *cur_byte; + const u8 *cur_byte; char line_buf[80]; if (the_array == NULL) { @@ -116,8 +116,8 @@ static irqreturn_t cc_isr(int irq, void *dev_id) { struct ssi_drvdata *drvdata = (struct ssi_drvdata *)dev_id; void __iomem *cc_base = drvdata->cc_base; - uint32_t irr; - uint32_t imr; + u32 irr; + u32 imr; DECL_CYCLE_COUNT_RESOURCES; /* STAT_OP_TYPE_GENERIC STAT_PHASE_0: Interrupt */ @@ -154,7 +154,7 @@ static irqreturn_t cc_isr(int irq, void *dev_id) #endif /* AXI error interrupt */ if (unlikely((irr & SSI_AXI_ERR_IRQ_MASK) != 0)) { - uint32_t axi_err; + u32 axi_err; /* Read the AXI error ID */ axi_err = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR)); @@ -224,7 +224,7 @@ static int init_cc_resources(struct platform_device *plat_dev) void __iomem *cc_base = NULL; bool irq_registered = false; struct ssi_drvdata *new_drvdata = kzalloc(sizeof(struct ssi_drvdata), GFP_KERNEL); - uint32_t signature_val; + u32 signature_val; int rc = 0; if (unlikely(new_drvdata == NULL)) { @@ -304,7 +304,7 @@ static int init_cc_resources(struct platform_device *plat_dev) signature_val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_SIGNATURE)); if (signature_val != DX_DEV_SIGNATURE) { SSI_LOG_ERR("Invalid CC signature: SIGNATURE=0x%08X != expected=0x%08X\n", - signature_val, (uint32_t)DX_DEV_SIGNATURE); + signature_val, (u32)DX_DEV_SIGNATURE); rc = -EINVAL; goto init_cc_res_err; } @@ -479,7 +479,7 @@ static int cc7x_probe(struct platform_device *plat_dev) { int rc; #if defined(CONFIG_ARM) && defined(CC_DEBUG) - uint32_t ctr, cacheline_size; + u32 ctr, cacheline_size; asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr)); cacheline_size = 4 << ((ctr >> 16) & 0xf); diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index d3e9eb2dcbf6..45fc23fe169f 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -37,10 +37,6 @@ #include #include -#ifndef INT32_MAX /* Missing in Linux kernel */ -#define INT32_MAX 0x7FFFFFFFL -#endif - /* Registers definitions from shared/hw/ree_include */ #include "dx_reg_base_host.h" #include "dx_host.h" @@ -137,11 +133,11 @@ struct ssi_drvdata { struct resource *res_irq; void __iomem *cc_base; unsigned int irq; - uint32_t irq_mask; - uint32_t fw_ver; + u32 irq_mask; + u32 fw_ver; /* Calibration time of start/stop * monitor descriptors */ - uint32_t monitor_null_cycles; + u32 monitor_null_cycles; struct platform_device *plat_dev; ssi_sram_addr_t mlli_sram_addr; struct completion icache_setup_completion; @@ -157,7 +153,7 @@ struct ssi_drvdata { #ifdef ENABLE_CYCLE_COUNT cycles_t isr_exit_cycles; /* Save for isr-to-tasklet latency */ #endif - uint32_t inflight_counter; + u32 inflight_counter; }; @@ -196,7 +192,7 @@ struct async_gen_req_ctx { }; #ifdef DX_DUMP_BYTES -void dump_byte_array(const char *name, const uint8_t *the_array, unsigned long size); +void dump_byte_array(const char *name, const u8 *the_array, unsigned long size); #else #define dump_byte_array(name, array, size) do { \ } while (0); diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h index 0c50655f7e34..607c64b8c458 100644 --- a/drivers/staging/ccree/ssi_fips.h +++ b/drivers/staging/ccree/ssi_fips.h @@ -17,12 +17,6 @@ #ifndef __SSI_FIPS_H__ #define __SSI_FIPS_H__ - -#ifndef INT32_MAX /* Missing in Linux kernel */ -#define INT32_MAX 0x7FFFFFFFL -#endif - - /*! @file @brief This file contains FIPS related defintions and APIs. @@ -32,7 +26,7 @@ typedef enum ssi_fips_state { CC_FIPS_STATE_NOT_SUPPORTED = 0, CC_FIPS_STATE_SUPPORTED, CC_FIPS_STATE_ERROR, - CC_FIPS_STATE_RESERVE32B = INT32_MAX + CC_FIPS_STATE_RESERVE32B = S32_MAX } ssi_fips_state_t; @@ -58,7 +52,7 @@ typedef enum ssi_fips_error { CC_REE_FIPS_ERROR_HMAC_SHA256_PUT, CC_REE_FIPS_ERROR_HMAC_SHA512_PUT, CC_REE_FIPS_ERROR_ROM_CHECKSUM, - CC_REE_FIPS_ERROR_RESERVE32B = INT32_MAX + CC_REE_FIPS_ERROR_RESERVE32B = S32_MAX } ssi_fips_error_t; diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index 3c7c9dd7fd61..eb468e1baf53 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -28,17 +28,17 @@ that executes the KAT. #include "ssi_request_mgr.h" -static const uint32_t digest_len_init[] = { +static const u32 digest_len_init[] = { 0x00000040, 0x00000000, 0x00000000, 0x00000000 }; -static const uint32_t sha1_init[] = { +static const u32 sha1_init[] = { SHA1_H4, SHA1_H3, SHA1_H2, SHA1_H1, SHA1_H0 }; -static const uint32_t sha256_init[] = { +static const u32 sha256_init[] = { SHA256_H7, SHA256_H6, SHA256_H5, SHA256_H4, SHA256_H3, SHA256_H2, SHA256_H1, SHA256_H0 }; #if (CC_SUPPORT_SHA > 256) -static const uint32_t digest_len_sha512_init[] = { +static const u32 digest_len_sha512_init[] = { 0x00000080, 0x00000000, 0x00000000, 0x00000000 }; -static const uint64_t sha512_init[] = { +static const u64 sha512_init[] = { SHA512_H7, SHA512_H6, SHA512_H5, SHA512_H4, SHA512_H3, SHA512_H2, SHA512_H1, SHA512_H0 }; #endif @@ -47,128 +47,128 @@ static const uint64_t sha512_init[] = { #define NIST_CIPHER_AES_MAX_VECTOR_SIZE 32 struct fips_cipher_ctx { - uint8_t iv[CC_AES_IV_SIZE]; - uint8_t key[AES_512_BIT_KEY_SIZE]; - uint8_t din[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; - uint8_t dout[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; + u8 iv[CC_AES_IV_SIZE]; + u8 key[AES_512_BIT_KEY_SIZE]; + u8 din[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; + u8 dout[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; }; typedef struct _FipsCipherData { - uint8_t isAes; - uint8_t key[AES_512_BIT_KEY_SIZE]; + u8 isAes; + u8 key[AES_512_BIT_KEY_SIZE]; size_t keySize; - uint8_t iv[CC_AES_IV_SIZE]; + u8 iv[CC_AES_IV_SIZE]; enum drv_crypto_direction direction; enum drv_cipher_mode oprMode; - uint8_t dataIn[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; - uint8_t dataOut[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; + u8 dataIn[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; + u8 dataOut[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; size_t dataInSize; } FipsCipherData; struct fips_cmac_ctx { - uint8_t key[AES_256_BIT_KEY_SIZE]; - uint8_t din[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; - uint8_t mac_res[CC_DIGEST_SIZE_MAX]; + u8 key[AES_256_BIT_KEY_SIZE]; + u8 din[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; + u8 mac_res[CC_DIGEST_SIZE_MAX]; }; typedef struct _FipsCmacData { enum drv_crypto_direction direction; - uint8_t key[AES_256_BIT_KEY_SIZE]; + u8 key[AES_256_BIT_KEY_SIZE]; size_t key_size; - uint8_t data_in[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; + u8 data_in[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; size_t data_in_size; - uint8_t mac_res[CC_DIGEST_SIZE_MAX]; + u8 mac_res[CC_DIGEST_SIZE_MAX]; size_t mac_res_size; } FipsCmacData; struct fips_hash_ctx { - uint8_t initial_digest[CC_DIGEST_SIZE_MAX]; - uint8_t din[NIST_SHA_MSG_SIZE]; - uint8_t mac_res[CC_DIGEST_SIZE_MAX]; + u8 initial_digest[CC_DIGEST_SIZE_MAX]; + u8 din[NIST_SHA_MSG_SIZE]; + u8 mac_res[CC_DIGEST_SIZE_MAX]; }; typedef struct _FipsHashData { enum drv_hash_mode hash_mode; - uint8_t data_in[NIST_SHA_MSG_SIZE]; + u8 data_in[NIST_SHA_MSG_SIZE]; size_t data_in_size; - uint8_t mac_res[CC_DIGEST_SIZE_MAX]; + u8 mac_res[CC_DIGEST_SIZE_MAX]; } FipsHashData; /* note that the hmac key length must be equal or less than block size (block size is 64 up to sha256 and 128 for sha384/512) */ struct fips_hmac_ctx { - uint8_t initial_digest[CC_DIGEST_SIZE_MAX]; - uint8_t key[CC_HMAC_BLOCK_SIZE_MAX]; - uint8_t k0[CC_HMAC_BLOCK_SIZE_MAX]; - uint8_t digest_bytes_len[HASH_LEN_SIZE]; - uint8_t tmp_digest[CC_DIGEST_SIZE_MAX]; - uint8_t din[NIST_HMAC_MSG_SIZE]; - uint8_t mac_res[CC_DIGEST_SIZE_MAX]; + u8 initial_digest[CC_DIGEST_SIZE_MAX]; + u8 key[CC_HMAC_BLOCK_SIZE_MAX]; + u8 k0[CC_HMAC_BLOCK_SIZE_MAX]; + u8 digest_bytes_len[HASH_LEN_SIZE]; + u8 tmp_digest[CC_DIGEST_SIZE_MAX]; + u8 din[NIST_HMAC_MSG_SIZE]; + u8 mac_res[CC_DIGEST_SIZE_MAX]; }; typedef struct _FipsHmacData { enum drv_hash_mode hash_mode; - uint8_t key[CC_HMAC_BLOCK_SIZE_MAX]; + u8 key[CC_HMAC_BLOCK_SIZE_MAX]; size_t key_size; - uint8_t data_in[NIST_HMAC_MSG_SIZE]; + u8 data_in[NIST_HMAC_MSG_SIZE]; size_t data_in_size; - uint8_t mac_res[CC_DIGEST_SIZE_MAX]; + u8 mac_res[CC_DIGEST_SIZE_MAX]; } FipsHmacData; #define FIPS_CCM_B0_A0_ADATA_SIZE (NIST_AESCCM_IV_SIZE + NIST_AESCCM_IV_SIZE + NIST_AESCCM_ADATA_SIZE) struct fips_ccm_ctx { - uint8_t b0_a0_adata[FIPS_CCM_B0_A0_ADATA_SIZE]; - uint8_t iv[NIST_AESCCM_IV_SIZE]; - uint8_t ctr_cnt_0[NIST_AESCCM_IV_SIZE]; - uint8_t key[CC_AES_KEY_SIZE_MAX]; - uint8_t din[NIST_AESCCM_TEXT_SIZE]; - uint8_t dout[NIST_AESCCM_TEXT_SIZE]; - uint8_t mac_res[NIST_AESCCM_TAG_SIZE]; + u8 b0_a0_adata[FIPS_CCM_B0_A0_ADATA_SIZE]; + u8 iv[NIST_AESCCM_IV_SIZE]; + u8 ctr_cnt_0[NIST_AESCCM_IV_SIZE]; + u8 key[CC_AES_KEY_SIZE_MAX]; + u8 din[NIST_AESCCM_TEXT_SIZE]; + u8 dout[NIST_AESCCM_TEXT_SIZE]; + u8 mac_res[NIST_AESCCM_TAG_SIZE]; }; typedef struct _FipsCcmData { enum drv_crypto_direction direction; - uint8_t key[CC_AES_KEY_SIZE_MAX]; + u8 key[CC_AES_KEY_SIZE_MAX]; size_t keySize; - uint8_t nonce[NIST_AESCCM_NONCE_SIZE]; - uint8_t adata[NIST_AESCCM_ADATA_SIZE]; + u8 nonce[NIST_AESCCM_NONCE_SIZE]; + u8 adata[NIST_AESCCM_ADATA_SIZE]; size_t adataSize; - uint8_t dataIn[NIST_AESCCM_TEXT_SIZE]; + u8 dataIn[NIST_AESCCM_TEXT_SIZE]; size_t dataInSize; - uint8_t dataOut[NIST_AESCCM_TEXT_SIZE]; - uint8_t tagSize; - uint8_t macResOut[NIST_AESCCM_TAG_SIZE]; + u8 dataOut[NIST_AESCCM_TEXT_SIZE]; + u8 tagSize; + u8 macResOut[NIST_AESCCM_TAG_SIZE]; } FipsCcmData; struct fips_gcm_ctx { - uint8_t adata[NIST_AESGCM_ADATA_SIZE]; - uint8_t key[CC_AES_KEY_SIZE_MAX]; - uint8_t hkey[CC_AES_KEY_SIZE_MAX]; - uint8_t din[NIST_AESGCM_TEXT_SIZE]; - uint8_t dout[NIST_AESGCM_TEXT_SIZE]; - uint8_t mac_res[NIST_AESGCM_TAG_SIZE]; - uint8_t len_block[AES_BLOCK_SIZE]; - uint8_t iv_inc1[AES_BLOCK_SIZE]; - uint8_t iv_inc2[AES_BLOCK_SIZE]; + u8 adata[NIST_AESGCM_ADATA_SIZE]; + u8 key[CC_AES_KEY_SIZE_MAX]; + u8 hkey[CC_AES_KEY_SIZE_MAX]; + u8 din[NIST_AESGCM_TEXT_SIZE]; + u8 dout[NIST_AESGCM_TEXT_SIZE]; + u8 mac_res[NIST_AESGCM_TAG_SIZE]; + u8 len_block[AES_BLOCK_SIZE]; + u8 iv_inc1[AES_BLOCK_SIZE]; + u8 iv_inc2[AES_BLOCK_SIZE]; }; typedef struct _FipsGcmData { enum drv_crypto_direction direction; - uint8_t key[CC_AES_KEY_SIZE_MAX]; + u8 key[CC_AES_KEY_SIZE_MAX]; size_t keySize; - uint8_t iv[NIST_AESGCM_IV_SIZE]; - uint8_t adata[NIST_AESGCM_ADATA_SIZE]; + u8 iv[NIST_AESGCM_IV_SIZE]; + u8 adata[NIST_AESGCM_ADATA_SIZE]; size_t adataSize; - uint8_t dataIn[NIST_AESGCM_TEXT_SIZE]; + u8 dataIn[NIST_AESGCM_TEXT_SIZE]; size_t dataInSize; - uint8_t dataOut[NIST_AESGCM_TEXT_SIZE]; - uint8_t tagSize; - uint8_t macResOut[NIST_AESGCM_TAG_SIZE]; + u8 dataOut[NIST_AESGCM_TEXT_SIZE]; + u8 tagSize; + u8 macResOut[NIST_AESGCM_TAG_SIZE]; } FipsGcmData; diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index 8f5df925e295..316507d88b4e 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -68,7 +68,7 @@ extern size_t ssi_fips_max_mem_alloc_size(void); /* The function called once at driver entry point to check whether TEE FIPS error occured.*/ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) { - uint32_t regVal; + u32 regVal; void __iomem *cc_base = drvdata->cc_base; regVal = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, GPR_HOST)); @@ -145,8 +145,8 @@ static void fips_dsr(unsigned long devarg) { struct ssi_drvdata *drvdata = (struct ssi_drvdata *)devarg; void __iomem *cc_base = drvdata->cc_base; - uint32_t irq; - uint32_t teeFipsError = 0; + u32 irq; + u32 teeFipsError = 0; irq = (drvdata->irq & (SSI_GPR0_IRQ_MASK)); diff --git a/drivers/staging/ccree/ssi_fips_local.h b/drivers/staging/ccree/ssi_fips_local.h index e189b425d7f9..038dd3b24903 100644 --- a/drivers/staging/ccree/ssi_fips_local.h +++ b/drivers/staging/ccree/ssi_fips_local.h @@ -29,7 +29,7 @@ typedef enum CC_FipsSyncStatus{ CC_FIPS_SYNC_MODULE_ERROR = 0x1, CC_FIPS_SYNC_REE_STATUS = 0x4, CC_FIPS_SYNC_TEE_STATUS = 0x8, - CC_FIPS_SYNC_STATUS_RESERVE32B = INT32_MAX + CC_FIPS_SYNC_STATUS_RESERVE32B = S32_MAX }CCFipsSyncStatus_t; diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 69c1df2aa2e7..2d3c6304befd 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -42,25 +42,25 @@ struct ssi_hash_handle { struct completion init_comp; }; -static const uint32_t digest_len_init[] = { +static const u32 digest_len_init[] = { 0x00000040, 0x00000000, 0x00000000, 0x00000000 }; -static const uint32_t md5_init[] = { +static const u32 md5_init[] = { SHA1_H3, SHA1_H2, SHA1_H1, SHA1_H0 }; -static const uint32_t sha1_init[] = { +static const u32 sha1_init[] = { SHA1_H4, SHA1_H3, SHA1_H2, SHA1_H1, SHA1_H0 }; -static const uint32_t sha224_init[] = { +static const u32 sha224_init[] = { SHA224_H7, SHA224_H6, SHA224_H5, SHA224_H4, SHA224_H3, SHA224_H2, SHA224_H1, SHA224_H0 }; -static const uint32_t sha256_init[] = { +static const u32 sha256_init[] = { SHA256_H7, SHA256_H6, SHA256_H5, SHA256_H4, SHA256_H3, SHA256_H2, SHA256_H1, SHA256_H0 }; #if (DX_DEV_SHA_MAX > 256) -static const uint32_t digest_len_sha512_init[] = { +static const u32 digest_len_sha512_init[] = { 0x00000080, 0x00000000, 0x00000000, 0x00000000 }; -static const uint64_t sha384_init[] = { +static const u64 sha384_init[] = { SHA384_H7, SHA384_H6, SHA384_H5, SHA384_H4, SHA384_H3, SHA384_H2, SHA384_H1, SHA384_H0 }; -static const uint64_t sha512_init[] = { +static const u64 sha512_init[] = { SHA512_H7, SHA512_H6, SHA512_H5, SHA512_H4, SHA512_H3, SHA512_H2, SHA512_H1, SHA512_H0 }; #endif @@ -89,7 +89,7 @@ struct ssi_hash_alg { struct hash_key_req_ctx { - uint32_t keylen; + u32 keylen; dma_addr_t key_dma_addr; }; @@ -98,8 +98,8 @@ struct ssi_hash_ctx { struct ssi_drvdata *drvdata; /* holds the origin digest; the digest after "setkey" if HMAC,* the initial digest if HASH. */ - uint8_t digest_buff[SSI_MAX_HASH_DIGEST_SIZE] ____cacheline_aligned; - uint8_t opad_tmp_keys_buff[SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE] ____cacheline_aligned; + u8 digest_buff[SSI_MAX_HASH_DIGEST_SIZE] ____cacheline_aligned; + u8 opad_tmp_keys_buff[SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE] ____cacheline_aligned; dma_addr_t opad_tmp_keys_dma_addr ____cacheline_aligned; dma_addr_t digest_buff_dma_addr; /* use for hmac with key large then mode block size */ @@ -120,7 +120,7 @@ static void ssi_hash_create_data_desc( bool is_not_last_data, unsigned int *seq_size); -static inline void ssi_set_hash_endianity(uint32_t mode, HwDesc_s *desc) +static inline void ssi_set_hash_endianity(u32 mode, HwDesc_s *desc) { if (unlikely((mode == DRV_HASH_MD5) || (mode == DRV_HASH_SHA384) || @@ -414,7 +414,7 @@ static void ssi_hash_digest_complete(struct device *dev, void *ssi_req, void __i struct ahash_req_ctx *state = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); - uint32_t digestsize = crypto_ahash_digestsize(tfm); + u32 digestsize = crypto_ahash_digestsize(tfm); SSI_LOG_DEBUG("req=%pK\n", req); @@ -430,7 +430,7 @@ static void ssi_hash_complete(struct device *dev, void *ssi_req, void __iomem *c struct ahash_req_ctx *state = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); - uint32_t digestsize = crypto_ahash_digestsize(tfm); + u32 digestsize = crypto_ahash_digestsize(tfm); SSI_LOG_DEBUG("req=%pK\n", req); @@ -611,7 +611,7 @@ static int ssi_hash_update(struct ahash_req_ctx *state, struct device *dev = &ctx->drvdata->plat_dev->dev; struct ssi_crypto_req ssi_req = {}; HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; - uint32_t idx = 0; + u32 idx = 0; int rc; SSI_LOG_DEBUG("===== %s-update (%d) ====\n", ctx->is_hmac ? @@ -1473,7 +1473,7 @@ static int ssi_mac_update(struct ahash_request *req) struct ssi_crypto_req ssi_req = {}; HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; int rc; - uint32_t idx = 0; + u32 idx = 0; CHECK_AND_RETURN_UPON_FIPS_ERROR(); if (req->nbytes == 0) { @@ -1536,10 +1536,10 @@ static int ssi_mac_final(struct ahash_request *req) HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; int idx = 0; int rc = 0; - uint32_t keySize, keyLen; - uint32_t digestsize = crypto_ahash_digestsize(tfm); + u32 keySize, keyLen; + u32 digestsize = crypto_ahash_digestsize(tfm); - uint32_t rem_cnt = state->buff_index ? state->buff1_cnt : + u32 rem_cnt = state->buff_index ? state->buff1_cnt : state->buff0_cnt; @@ -1650,8 +1650,8 @@ static int ssi_mac_finup(struct ahash_request *req) HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; int idx = 0; int rc = 0; - uint32_t key_len = 0; - uint32_t digestsize = crypto_ahash_digestsize(tfm); + u32 key_len = 0; + u32 digestsize = crypto_ahash_digestsize(tfm); SSI_LOG_DEBUG("===== finup xcbc(%d) ====\n", req->nbytes); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -1719,10 +1719,10 @@ static int ssi_mac_digest(struct ahash_request *req) struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); struct device *dev = &ctx->drvdata->plat_dev->dev; - uint32_t digestsize = crypto_ahash_digestsize(tfm); + u32 digestsize = crypto_ahash_digestsize(tfm); struct ssi_crypto_req ssi_req = {}; HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; - uint32_t keyLen; + u32 keyLen; int idx = 0; int rc; @@ -1798,7 +1798,7 @@ static int ssi_shash_digest(struct shash_desc *desc, struct ahash_req_ctx *state = shash_desc_ctx(desc); struct crypto_shash *tfm = desc->tfm; struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - uint32_t digestsize = crypto_shash_digestsize(tfm); + u32 digestsize = crypto_shash_digestsize(tfm); struct scatterlist src; if (len == 0) { @@ -1817,7 +1817,7 @@ static int ssi_shash_update(struct shash_desc *desc, struct ahash_req_ctx *state = shash_desc_ctx(desc); struct crypto_shash *tfm = desc->tfm; struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - uint32_t blocksize = crypto_tfm_alg_blocksize(&tfm->base); + u32 blocksize = crypto_tfm_alg_blocksize(&tfm->base); struct scatterlist src; sg_init_one(&src, (const void *)data, len); @@ -1831,7 +1831,7 @@ static int ssi_shash_finup(struct shash_desc *desc, struct ahash_req_ctx *state = shash_desc_ctx(desc); struct crypto_shash *tfm = desc->tfm; struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - uint32_t digestsize = crypto_shash_digestsize(tfm); + u32 digestsize = crypto_shash_digestsize(tfm); struct scatterlist src; sg_init_one(&src, (const void *)data, len); @@ -1844,7 +1844,7 @@ static int ssi_shash_final(struct shash_desc *desc, u8 *out) struct ahash_req_ctx *state = shash_desc_ctx(desc); struct crypto_shash *tfm = desc->tfm; struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - uint32_t digestsize = crypto_shash_digestsize(tfm); + u32 digestsize = crypto_shash_digestsize(tfm); return ssi_hash_final(state, ctx, digestsize, NULL, 0, out, NULL); } @@ -1890,7 +1890,7 @@ static int ssi_ahash_digest(struct ahash_request *req) struct ahash_req_ctx *state = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); - uint32_t digestsize = crypto_ahash_digestsize(tfm); + u32 digestsize = crypto_ahash_digestsize(tfm); return ssi_hash_digest(state, ctx, digestsize, req->src, req->nbytes, req->result, (void *)req); } @@ -1910,7 +1910,7 @@ static int ssi_ahash_finup(struct ahash_request *req) struct ahash_req_ctx *state = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); - uint32_t digestsize = crypto_ahash_digestsize(tfm); + u32 digestsize = crypto_ahash_digestsize(tfm); return ssi_hash_finup(state, ctx, digestsize, req->src, req->nbytes, req->result, (void *)req); } @@ -1920,7 +1920,7 @@ static int ssi_ahash_final(struct ahash_request *req) struct ahash_req_ctx *state = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); - uint32_t digestsize = crypto_ahash_digestsize(tfm); + u32 digestsize = crypto_ahash_digestsize(tfm); return ssi_hash_final(state, ctx, digestsize, req->src, req->nbytes, req->result, (void *)req); } @@ -2284,7 +2284,7 @@ int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata) struct ssi_hash_handle *hash_handle = drvdata->hash_handle; ssi_sram_addr_t sram_buff_ofs = hash_handle->digest_len_sram_addr; unsigned int larval_seq_len = 0; - HwDesc_s larval_seq[CC_DIGEST_SIZE_MAX/sizeof(uint32_t)]; + HwDesc_s larval_seq[CC_DIGEST_SIZE_MAX/sizeof(u32)]; int rc = 0; #if (DX_DEV_SHA_MAX > 256) int i; @@ -2351,15 +2351,15 @@ int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata) #if (DX_DEV_SHA_MAX > 256) /* We are forced to swap each double-word larval before copying to sram */ for (i = 0; i < ARRAY_SIZE(sha384_init); i++) { - const uint32_t const0 = ((uint32_t *)((uint64_t *)&sha384_init[i]))[1]; - const uint32_t const1 = ((uint32_t *)((uint64_t *)&sha384_init[i]))[0]; + const u32 const0 = ((u32 *)((u64 *)&sha384_init[i]))[1]; + const u32 const1 = ((u32 *)((u64 *)&sha384_init[i]))[0]; ssi_sram_mgr_const2sram_desc(&const0, sram_buff_ofs, 1, larval_seq, &larval_seq_len); - sram_buff_ofs += sizeof(uint32_t); + sram_buff_ofs += sizeof(u32); ssi_sram_mgr_const2sram_desc(&const1, sram_buff_ofs, 1, larval_seq, &larval_seq_len); - sram_buff_ofs += sizeof(uint32_t); + sram_buff_ofs += sizeof(u32); } rc = send_request_init(drvdata, larval_seq, larval_seq_len); if (unlikely(rc != 0)) { @@ -2369,15 +2369,15 @@ int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata) larval_seq_len = 0; for (i = 0; i < ARRAY_SIZE(sha512_init); i++) { - const uint32_t const0 = ((uint32_t *)((uint64_t *)&sha512_init[i]))[1]; - const uint32_t const1 = ((uint32_t *)((uint64_t *)&sha512_init[i]))[0]; + const u32 const0 = ((u32 *)((u64 *)&sha512_init[i]))[1]; + const u32 const1 = ((u32 *)((u64 *)&sha512_init[i]))[0]; ssi_sram_mgr_const2sram_desc(&const0, sram_buff_ofs, 1, larval_seq, &larval_seq_len); - sram_buff_ofs += sizeof(uint32_t); + sram_buff_ofs += sizeof(u32); ssi_sram_mgr_const2sram_desc(&const1, sram_buff_ofs, 1, larval_seq, &larval_seq_len); - sram_buff_ofs += sizeof(uint32_t); + sram_buff_ofs += sizeof(u32); } rc = send_request_init(drvdata, larval_seq, larval_seq_len); if (unlikely(rc != 0)) { @@ -2394,7 +2394,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) { struct ssi_hash_handle *hash_handle; ssi_sram_addr_t sram_buff; - uint32_t sram_size_to_alloc; + u32 sram_size_to_alloc; int rc = 0; int alg; @@ -2686,9 +2686,9 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, * \param drvdata * \param mode The Hash mode. Supported modes: MD5/SHA1/SHA224/SHA256 * - * \return uint32_t The address of the inital digest in SRAM + * \return u32 The address of the inital digest in SRAM */ -ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, uint32_t mode) +ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, u32 mode) { struct ssi_drvdata *_drvdata = (struct ssi_drvdata *)drvdata; struct ssi_hash_handle *hash_handle = _drvdata->hash_handle; @@ -2734,7 +2734,7 @@ ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, uint32_t mo } ssi_sram_addr_t -ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, uint32_t mode) +ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, u32 mode) { struct ssi_drvdata *_drvdata = (struct ssi_drvdata *)drvdata; struct ssi_hash_handle *hash_handle = _drvdata->hash_handle; diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index b5bf67721fba..b821d0c854b5 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -48,26 +48,26 @@ struct aeshash_state { /* ahash state */ struct ahash_req_ctx { - uint8_t* buff0; - uint8_t* buff1; - uint8_t* digest_result_buff; + u8* buff0; + u8* buff1; + u8* digest_result_buff; struct async_gen_req_ctx gen_ctx; enum ssi_req_dma_buf_type data_dma_buf_type; - uint8_t *digest_buff; - uint8_t *opad_digest_buff; - uint8_t *digest_bytes_len; + u8 *digest_buff; + u8 *opad_digest_buff; + u8 *digest_bytes_len; dma_addr_t opad_digest_dma_addr; dma_addr_t digest_buff_dma_addr; dma_addr_t digest_bytes_len_dma_addr; dma_addr_t digest_result_dma_addr; - uint32_t buff0_cnt; - uint32_t buff1_cnt; - uint32_t buff_index; - uint32_t xcbc_count; /* count xcbc update operatations */ + u32 buff0_cnt; + u32 buff1_cnt; + u32 buff_index; + u32 xcbc_count; /* count xcbc update operatations */ struct scatterlist buff_sg[2]; struct scatterlist *curr_sg; - uint32_t in_nents; - uint32_t mlli_nents; + u32 in_nents; + u32 mlli_nents; struct mlli_params mlli_params; }; @@ -81,10 +81,10 @@ int ssi_hash_free(struct ssi_drvdata *drvdata); * \param drvdata * \param mode The Hash mode. Supported modes: MD5/SHA1/SHA224/SHA256/SHA384/SHA512 * - * \return uint32_t returns the address of the initial digest length in SRAM + * \return u32 returns the address of the initial digest length in SRAM */ ssi_sram_addr_t -ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, uint32_t mode); +ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, u32 mode); /*! * Gets the address of the initial digest in SRAM @@ -93,9 +93,9 @@ ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, uint32_t mode); * \param drvdata * \param mode The Hash mode. Supported modes: MD5/SHA1/SHA224/SHA256/SHA384/SHA512 * - * \return uint32_t The address of the inital digest in SRAM + * \return u32 The address of the inital digest in SRAM */ -ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, uint32_t mode); +ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, u32 mode); #endif /*__SSI_HASH_H__*/ diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index a760fafd1a43..3ea040f59c02 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -43,8 +43,8 @@ struct ssi_ivgen_ctx { ssi_sram_addr_t pool; ssi_sram_addr_t ctr_key; ssi_sram_addr_t ctr_iv; - uint32_t next_iv_ofs; - uint8_t *pool_meta; + u32 next_iv_ofs; + u8 *pool_meta; dma_addr_t pool_meta_dma; }; diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 0631323a64b8..260aee33f235 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -87,7 +87,7 @@ do { \ */ #define END_CC_MONITOR_COUNT(cc_base_addr, stat_op_type, stat_phase, monitor_null_cycles, lock_p, is_monitored) \ do { \ - uint32_t elapsed_cycles; \ + u32 elapsed_cycles; \ if ((is_monitored) == true) { \ elapsed_cycles = READ_REGISTER((cc_base_addr) + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_MEASURE_CNTR)); \ clear_bit(MONITOR_CNTR_BIT, (lock_p)); \ @@ -111,13 +111,13 @@ struct ssi_request_mgr_handle { unsigned int min_free_hw_slots; unsigned int max_used_sw_slots; struct ssi_crypto_req req_queue[MAX_REQUEST_QUEUE_SIZE]; - uint32_t req_queue_head; - uint32_t req_queue_tail; - uint32_t axi_completed; - uint32_t q_free_slots; + u32 req_queue_head; + u32 req_queue_tail; + u32 axi_completed; + u32 q_free_slots; spinlock_t hw_lock; HwDesc_s compl_desc; - uint8_t *dummy_comp_buff; + u8 *dummy_comp_buff; dma_addr_t dummy_comp_buff_dma; HwDesc_s monitor_desc; volatile unsigned long monitor_lock; @@ -147,7 +147,7 @@ void request_mgr_fini(struct ssi_drvdata *drvdata) if (req_mgr_h->dummy_comp_buff_dma != 0) { SSI_RESTORE_DMA_ADDR_TO_48BIT(req_mgr_h->dummy_comp_buff_dma); dma_free_coherent(&drvdata->plat_dev->dev, - sizeof(uint32_t), req_mgr_h->dummy_comp_buff, + sizeof(u32), req_mgr_h->dummy_comp_buff, req_mgr_h->dummy_comp_buff_dma); } @@ -213,22 +213,22 @@ int request_mgr_init(struct ssi_drvdata *drvdata) /* Allocate DMA word for "dummy" completion descriptor use */ req_mgr_h->dummy_comp_buff = dma_alloc_coherent(&drvdata->plat_dev->dev, - sizeof(uint32_t), &req_mgr_h->dummy_comp_buff_dma, GFP_KERNEL); + sizeof(u32), &req_mgr_h->dummy_comp_buff_dma, GFP_KERNEL); if (!req_mgr_h->dummy_comp_buff) { SSI_LOG_ERR("Not enough memory to allocate DMA (%zu) dropped " - "buffer\n", sizeof(uint32_t)); + "buffer\n", sizeof(u32)); rc = -ENOMEM; goto req_mgr_init_err; } SSI_UPDATE_DMA_ADDR_TO_48BIT(req_mgr_h->dummy_comp_buff_dma, - sizeof(uint32_t)); + sizeof(u32)); /* Init. "dummy" completion descriptor */ HW_DESC_INIT(&req_mgr_h->compl_desc); - HW_DESC_SET_DIN_CONST(&req_mgr_h->compl_desc, 0, sizeof(uint32_t)); + HW_DESC_SET_DIN_CONST(&req_mgr_h->compl_desc, 0, sizeof(u32)); HW_DESC_SET_DOUT_DLLI(&req_mgr_h->compl_desc, req_mgr_h->dummy_comp_buff_dma, - sizeof(uint32_t), NS_BIT, 1); + sizeof(u32), NS_BIT, 1); HW_DESC_SET_FLOW_MODE(&req_mgr_h->compl_desc, BYPASS); HW_DESC_SET_QUEUE_LAST_IND(&req_mgr_h->compl_desc); @@ -581,7 +581,7 @@ static void proc_completions(struct ssi_drvdata *drvdata) #ifdef COMPLETION_DELAY /* Delay */ { - uint32_t axi_err; + u32 axi_err; int i; SSI_LOG_INFO("Delay\n"); for (i=0;i<1000000;i++) { @@ -615,7 +615,7 @@ static void comp_handler(unsigned long devarg) struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; - uint32_t irq; + u32 irq; DECL_CYCLE_COUNT_RESOURCES; diff --git a/drivers/staging/ccree/ssi_sram_mgr.c b/drivers/staging/ccree/ssi_sram_mgr.c index 44662fdd9c97..7dd5a72c2da3 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.c +++ b/drivers/staging/ccree/ssi_sram_mgr.c @@ -85,7 +85,7 @@ out: * \param drvdata * \param size The requested bytes to allocate */ -ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, uint32_t size) +ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, u32 size) { struct ssi_sram_mgr_ctx *smgr_ctx = drvdata->sram_mgr_handle; ssi_sram_addr_t p; @@ -119,17 +119,17 @@ ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, uint32_t size) * @seq_len: A pointer to the given IN/OUT sequence length */ void ssi_sram_mgr_const2sram_desc( - const uint32_t *src, ssi_sram_addr_t dst, + const u32 *src, ssi_sram_addr_t dst, unsigned int nelement, HwDesc_s *seq, unsigned int *seq_len) { - uint32_t i; + u32 i; unsigned int idx = *seq_len; for (i = 0; i < nelement; i++, idx++) { HW_DESC_INIT(&seq[idx]); - HW_DESC_SET_DIN_CONST(&seq[idx], src[i], sizeof(uint32_t)); - HW_DESC_SET_DOUT_SRAM(&seq[idx], dst + (i * sizeof(uint32_t)), sizeof(uint32_t)); + HW_DESC_SET_DIN_CONST(&seq[idx], src[i], sizeof(u32)); + HW_DESC_SET_DOUT_SRAM(&seq[idx], dst + (i * sizeof(u32)), sizeof(u32)); HW_DESC_SET_FLOW_MODE(&seq[idx], BYPASS); } diff --git a/drivers/staging/ccree/ssi_sram_mgr.h b/drivers/staging/ccree/ssi_sram_mgr.h index a71e17dc8bbe..df634db11e24 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.h +++ b/drivers/staging/ccree/ssi_sram_mgr.h @@ -28,7 +28,7 @@ struct ssi_drvdata; * Address (offset) within CC internal SRAM */ -typedef uint64_t ssi_sram_addr_t; +typedef u64 ssi_sram_addr_t; #define NULL_SRAM_ADDR ((ssi_sram_addr_t)-1) @@ -59,7 +59,7 @@ void ssi_sram_mgr_fini(struct ssi_drvdata *drvdata); * \param drvdata * \param size The requested bytes to allocate */ -ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, uint32_t size); +ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, u32 size); /** * ssi_sram_mgr_const2sram_desc() - Create const descriptors sequence to @@ -73,7 +73,7 @@ ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, uint32_t size); * @seq_len: A pointer to the given IN/OUT sequence length */ void ssi_sram_mgr_const2sram_desc( - const uint32_t *src, ssi_sram_addr_t dst, + const u32 *src, ssi_sram_addr_t dst, unsigned int nelement, HwDesc_s *seq, unsigned int *seq_len); diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 1ff1e78ccc08..89021c009872 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -95,7 +95,7 @@ struct sys_dir { struct kobject *sys_dir_kobj; struct attribute_group sys_dir_attr_group; struct attribute **sys_dir_attr_list; - uint32_t num_of_attrs; + u32 num_of_attrs; struct ssi_drvdata *drvdata; /* Associated driver context */ }; @@ -137,12 +137,12 @@ static void update_db(struct stat_item *item, unsigned int result) static void display_db(struct stat_item item[MAX_STAT_OP_TYPES][MAX_STAT_PHASES]) { unsigned int i, j; - uint64_t avg; + u64 avg; for (i=STAT_OP_TYPE_ENCODE; i 0) { - avg = (uint64_t)item[i][j].sum; + avg = (u64)item[i][j].sum; do_div(avg, item[i][j].count); SSI_LOG_ERR("%s, %s: min=%d avg=%d max=%d sum=%lld count=%d\n", stat_name_db[i].op_type_name, stat_name_db[i].stat_phase_name[j], @@ -176,8 +176,8 @@ static ssize_t ssi_sys_stat_host_db_show(struct kobject *kobj, { int i, j ; char line[512]; - uint32_t min_cyc, max_cyc; - uint64_t avg; + u32 min_cyc, max_cyc; + u64 avg; ssize_t buf_len, tmp_len=0; buf_len = scnprintf(buf,PAGE_SIZE, @@ -187,7 +187,7 @@ static ssize_t ssi_sys_stat_host_db_show(struct kobject *kobj, for (i=STAT_OP_TYPE_ENCODE; i 0) { - avg = (uint64_t)stat_host_db[i][j].sum; + avg = (u64)stat_host_db[i][j].sum; do_div(avg, stat_host_db[i][j].count); min_cyc = stat_host_db[i][j].min; max_cyc = stat_host_db[i][j].max; @@ -216,8 +216,8 @@ static ssize_t ssi_sys_stat_cc_db_show(struct kobject *kobj, { int i; char line[256]; - uint32_t min_cyc, max_cyc; - uint64_t avg; + u32 min_cyc, max_cyc; + u64 avg; ssize_t buf_len,tmp_len=0; buf_len = scnprintf(buf,PAGE_SIZE, @@ -226,7 +226,7 @@ static ssize_t ssi_sys_stat_cc_db_show(struct kobject *kobj, return buf_len; for (i=STAT_OP_TYPE_ENCODE; i 0) { - avg = (uint64_t)stat_cc_db[i][STAT_PHASE_6].sum; + avg = (u64)stat_cc_db[i][STAT_PHASE_6].sum; do_div(avg, stat_cc_db[i][STAT_PHASE_6].count); min_cyc = stat_cc_db[i][STAT_PHASE_6].min; max_cyc = stat_cc_db[i][STAT_PHASE_6].max; @@ -284,7 +284,7 @@ static ssize_t ssi_sys_regdump_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct ssi_drvdata *drvdata = sys_get_drvdata(); - uint32_t register_value; + u32 register_value; void __iomem* cc_base = drvdata->cc_base; int offset = 0; @@ -333,7 +333,7 @@ struct sys_dir { struct kobject *sys_dir_kobj; struct attribute_group sys_dir_attr_group; struct attribute **sys_dir_attr_list; - uint32_t num_of_attrs; + u32 num_of_attrs; struct ssi_drvdata *drvdata; /* Associated driver context */ }; @@ -361,7 +361,7 @@ static struct ssi_drvdata *sys_get_drvdata(void) static int sys_init_dir(struct sys_dir *sys_dir, struct ssi_drvdata *drvdata, struct kobject *parent_dir_kobj, const char *dir_name, - struct kobj_attribute *attrs, uint32_t num_of_attrs) + struct kobj_attribute *attrs, u32 num_of_attrs) { int i; -- cgit v1.2.3-55-g7522 From ee67acfeedaab7ef01c463377808e8438e618e2a Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:35:56 +0300 Subject: staging: ccree: remove min/max macros Remove useless and wrong min/max macros. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 31ccf518fda4..216d24791d5d 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -20,12 +20,6 @@ #include - -#ifndef max -#define max(a, b) ((a) > (b) ? (a) : (b)) -#define min(a, b) ((a) < (b) ? (a) : (b)) -#endif - /* context size */ #ifndef CC_CTX_SIZE_LOG2 #if (CC_SUPPORT_SHA > 256) -- cgit v1.2.3-55-g7522 From df8a6b053c915bad3d5f4aab1e8fa7c87f88b176 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:35:57 +0300 Subject: staging: ccree: drop open coded init for memset Replace open coded struct zeroing with a memset call. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 8c2b7f489373..f17c37db6258 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -172,14 +172,7 @@ typedef enum HwDesKeySize { #define GET_HW_Q_DESC_WORD_IDX(descWordIdx) (CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD ## descWordIdx) ) -#define HW_DESC_INIT(pDesc) do { \ - (pDesc)->word[0] = 0; \ - (pDesc)->word[1] = 0; \ - (pDesc)->word[2] = 0; \ - (pDesc)->word[3] = 0; \ - (pDesc)->word[4] = 0; \ - (pDesc)->word[5] = 0; \ -} while (0) +#define HW_DESC_INIT(pDesc) memset(pDesc, 0, sizeof(HwDesc_s)) /*! * This macro indicates the end of current HW descriptors flow and release the HW engines. -- cgit v1.2.3-55-g7522 From 8ca57f5cecf0472ee10076e1d016e614db6570e1 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:35:58 +0300 Subject: staging: ccree: fix enum/struct definitions style Fix enum and struct definition coding style by removing uneeded typedef and s/CamelCase/snake_case/g. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 54 +++++++++++++++----------------- drivers/staging/ccree/ssi_aead.c | 54 ++++++++++++++++---------------- drivers/staging/ccree/ssi_cipher.c | 14 ++++----- drivers/staging/ccree/ssi_fips_ll.c | 12 +++---- drivers/staging/ccree/ssi_hash.c | 38 +++++++++++----------- drivers/staging/ccree/ssi_ivgen.c | 6 ++-- drivers/staging/ccree/ssi_ivgen.h | 2 +- drivers/staging/ccree/ssi_request_mgr.c | 16 +++++----- drivers/staging/ccree/ssi_request_mgr.h | 4 +-- drivers/staging/ccree/ssi_sram_mgr.c | 2 +- drivers/staging/ccree/ssi_sram_mgr.h | 2 +- 11 files changed, 100 insertions(+), 104 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index f17c37db6258..1607fed22239 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -40,29 +40,28 @@ * TYPE DEFINITIONS ******************************************************************************/ -typedef struct HwDesc { +struct cc_hw_desc { u32 word[HW_DESC_SIZE_WORDS]; -} HwDesc_s; +}; -typedef enum DescDirection { +enum cc_desc_direction { DESC_DIRECTION_ILLEGAL = -1, DESC_DIRECTION_ENCRYPT_ENCRYPT = 0, DESC_DIRECTION_DECRYPT_DECRYPT = 1, DESC_DIRECTION_DECRYPT_ENCRYPT = 3, DESC_DIRECTION_END = S32_MAX, -}DescDirection_t; +}; -typedef enum DmaMode { +enum cc_dma_mode { DMA_MODE_NULL = -1, NO_DMA = 0, DMA_SRAM = 1, DMA_DLLI = 2, DMA_MLLI = 3, - DmaMode_OPTIONTS, - DmaMode_END = S32_MAX, -}DmaMode_t; + DMA_MODE_END = S32_MAX, +}; -typedef enum FlowMode { +enum cc_flow_mode { FLOW_MODE_NULL = -1, /* data flows */ BYPASS = 0, @@ -97,19 +96,17 @@ typedef enum FlowMode { S_DES_to_DOUT = 42, S_HASH_to_DOUT = 43, SET_FLOW_ID = 44, - FlowMode_OPTIONTS, - FlowMode_END = S32_MAX, -}FlowMode_t; + FLOW_MODE_END = S32_MAX, +}; -typedef enum TunnelOp { +enum cc_tunnel_op { TUNNEL_OP_INVALID = -1, TUNNEL_OFF = 0, TUNNEL_ON = 1, - TunnelOp_OPTIONS, - TunnelOp_END = S32_MAX, -} TunnelOp_t; + TUNNEL_OP_END = S32_MAX, +}; -typedef enum SetupOp { +enum cc_setup_op { SETUP_LOAD_NOP = 0, SETUP_LOAD_STATE0 = 1, SETUP_LOAD_STATE1 = 2, @@ -120,15 +117,14 @@ typedef enum SetupOp { SETUP_WRITE_STATE1 = 9, SETUP_WRITE_STATE2 = 10, SETUP_WRITE_STATE3 = 11, - setupOp_OPTIONTS, - setupOp_END = S32_MAX, -}SetupOp_t; + SETUP_OP_END = S32_MAX, +}; -enum AesMacSelector { +enum cc_aes_mac_selector { AES_SK = 1, AES_CMAC_INIT = 2, AES_CMAC_SIZE0 = 3, - AesMacEnd = S32_MAX, + AES_MAC_END = S32_MAX, }; #define HW_KEY_MASK_CIPHER_DO 0x3 @@ -137,7 +133,7 @@ enum AesMacSelector { /* HwCryptoKey[1:0] is mapped to cipher_do[1:0] */ /* HwCryptoKey[2:3] is mapped to cipher_config2[1:0] */ -typedef enum HwCryptoKey { +enum cc_hw_crypto_key { USER_KEY = 0, /* 0x0000 */ ROOT_KEY = 1, /* 0x0001 */ PROVISIONING_KEY = 2, /* 0x0010 */ /* ==KCP */ @@ -150,21 +146,21 @@ typedef enum HwCryptoKey { KFDE2_KEY = 10, /* 0x1010 */ KFDE3_KEY = 11, /* 0x1011 */ END_OF_KEYS = S32_MAX, -}HwCryptoKey_t; +}; -typedef enum HwAesKeySize { +enum cc_hw_aes_key_size { AES_128_KEY = 0, AES_192_KEY = 1, AES_256_KEY = 2, END_OF_AES_KEYS = S32_MAX, -}HwAesKeySize_t; +}; -typedef enum HwDesKeySize { +enum cc_hw_des_key_size { DES_ONE_KEY = 0, DES_TWO_KEYS = 1, DES_THREE_KEYS = 2, END_OF_DES_KEYS = S32_MAX, -}HwDesKeySize_t; +}; /*****************************/ /* Descriptor packing macros */ @@ -172,7 +168,7 @@ typedef enum HwDesKeySize { #define GET_HW_Q_DESC_WORD_IDX(descWordIdx) (CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD ## descWordIdx) ) -#define HW_DESC_INIT(pDesc) memset(pDesc, 0, sizeof(HwDesc_s)) +#define HW_DESC_INIT(pDesc) memset(pDesc, 0, sizeof(struct cc_hw_desc)) /*! * This macro indicates the end of current HW descriptors flow and release the HW engines. diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 7f9b5cc777e9..cfd0cb7b4af2 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -79,7 +79,7 @@ struct ssi_aead_ctx { unsigned int auth_keylen; unsigned int authsize; /* Actual (reduced?) size of the MAC/ICv */ enum drv_cipher_mode cipher_mode; - enum FlowMode flow_mode; + enum cc_flow_mode flow_mode; enum drv_hash_mode auth_mode; }; @@ -274,7 +274,7 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c aead_request_complete(areq, err); } -static int xcbc_setkey(HwDesc_s *desc, struct ssi_aead_ctx *ctx) +static int xcbc_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) { /* Load the AES key */ HW_DESC_INIT(&desc[0]); @@ -309,7 +309,7 @@ static int xcbc_setkey(HwDesc_s *desc, struct ssi_aead_ctx *ctx) return 4; } -static int hmac_setkey(HwDesc_s *desc, struct ssi_aead_ctx *ctx) +static int hmac_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) { unsigned int hmacPadConst[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST }; unsigned int digest_ofs = 0; @@ -436,7 +436,7 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl unsigned int hashmode; unsigned int idx = 0; int rc = 0; - HwDesc_s desc[MAX_AEAD_SETKEY_SEQ]; + struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; dma_addr_t padded_authkey_dma_addr = ctx->auth_state.hmac.padded_authkey_dma_addr; @@ -568,7 +568,7 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) struct rtattr *rta = (struct rtattr *)key; struct ssi_crypto_req ssi_req = {}; struct crypto_authenc_key_param *param; - HwDesc_s desc[MAX_AEAD_SETKEY_SEQ]; + struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; int seq_len = 0, rc = -EINVAL; DECL_CYCLE_COUNT_RESOURCES; @@ -756,7 +756,7 @@ static inline void ssi_aead_create_assoc_desc( struct aead_request *areq, unsigned int flow_mode, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(areq); @@ -799,7 +799,7 @@ static inline void ssi_aead_process_authenc_data_desc( struct aead_request *areq, unsigned int flow_mode, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size, int direct) { @@ -862,7 +862,7 @@ static inline void ssi_aead_process_cipher_data_desc( struct aead_request *areq, unsigned int flow_mode, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { unsigned int idx = *seq_size; @@ -905,7 +905,7 @@ ssi_aead_process_cipher_data_desc( static inline void ssi_aead_process_digest_result_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -955,7 +955,7 @@ static inline void ssi_aead_process_digest_result_desc( static inline void ssi_aead_setup_cipher_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1002,7 +1002,7 @@ static inline void ssi_aead_setup_cipher_desc( static inline void ssi_aead_process_cipher( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size, unsigned int data_flow_mode) { @@ -1028,7 +1028,7 @@ static inline void ssi_aead_process_cipher( static inline void ssi_aead_hmac_setup_digest_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1064,7 +1064,7 @@ static inline void ssi_aead_hmac_setup_digest_desc( static inline void ssi_aead_xcbc_setup_digest_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1128,7 +1128,7 @@ static inline void ssi_aead_xcbc_setup_digest_desc( static inline void ssi_aead_process_digest_header_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { unsigned int idx = *seq_size; @@ -1142,7 +1142,7 @@ static inline void ssi_aead_process_digest_header_desc( static inline void ssi_aead_process_digest_scheme_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1206,7 +1206,7 @@ static inline void ssi_aead_process_digest_scheme_desc( static inline void ssi_aead_load_mlli_to_sram( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct aead_req_ctx *req_ctx = aead_request_ctx(req); @@ -1233,12 +1233,12 @@ static inline void ssi_aead_load_mlli_to_sram( } } -static inline enum FlowMode ssi_aead_get_data_flow_mode( +static inline enum cc_flow_mode ssi_aead_get_data_flow_mode( enum drv_crypto_direction direct, - enum FlowMode setup_flow_mode, + enum cc_flow_mode setup_flow_mode, bool is_single_pass) { - enum FlowMode data_flow_mode; + enum cc_flow_mode data_flow_mode; if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { if (setup_flow_mode == S_DIN_to_AES) @@ -1261,7 +1261,7 @@ static inline enum FlowMode ssi_aead_get_data_flow_mode( static inline void ssi_aead_hmac_authenc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1313,7 +1313,7 @@ static inline void ssi_aead_hmac_authenc( static inline void ssi_aead_xcbc_authenc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1457,7 +1457,7 @@ static int set_msg_len(u8 *block, unsigned int msglen, unsigned int csize) static inline int ssi_aead_ccm( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1663,7 +1663,7 @@ static void ssi_rfc4309_ccm_process(struct aead_request *req) static inline void ssi_aead_gcm_setup_ghash_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1742,7 +1742,7 @@ static inline void ssi_aead_gcm_setup_ghash_desc( static inline void ssi_aead_gcm_setup_gctr_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1780,7 +1780,7 @@ static inline void ssi_aead_gcm_setup_gctr_desc( static inline void ssi_aead_process_gcm_result_desc( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1849,7 +1849,7 @@ static inline void ssi_aead_process_gcm_result_desc( static inline int ssi_aead_gcm( struct aead_request *req, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct aead_req_ctx *req_ctx = aead_request_ctx(req); @@ -1999,7 +1999,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction { int rc = 0; int seq_len = 0; - HwDesc_s desc[MAX_AEAD_PROCESS_SEQ]; + struct cc_hw_desc desc[MAX_AEAD_PROCESS_SEQ]; struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *areq_ctx = aead_request_ctx(req); diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index c62fe4f98595..ea0e863169e4 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -49,8 +49,8 @@ struct cc_user_key_info { dma_addr_t key_dma_addr; }; struct cc_hw_key_info { - enum HwCryptoKey key1_slot; - enum HwCryptoKey key2_slot; + enum cc_hw_crypto_key key1_slot; + enum cc_hw_crypto_key key2_slot; }; struct ssi_ablkcipher_ctx { @@ -302,7 +302,7 @@ static int ssi_fips_verify_xts_keys(const u8 *key, unsigned int keylen) return 0; } -static enum HwCryptoKey hw_key_to_cc_hw_key(int slot_num) +static enum cc_hw_crypto_key hw_key_to_cc_hw_key(int slot_num) { switch (slot_num) { case 0: @@ -464,7 +464,7 @@ ssi_blkcipher_create_setup_desc( struct blkcipher_req_ctx *req_ctx, unsigned int ivsize, unsigned int nbytes, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); @@ -592,7 +592,7 @@ static inline void ssi_blkcipher_create_multi2_setup_desc( struct crypto_tfm *tfm, struct blkcipher_req_ctx *req_ctx, unsigned int ivsize, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); @@ -645,7 +645,7 @@ ssi_blkcipher_create_data_desc( struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes, void *areq, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); @@ -784,7 +784,7 @@ static int ssi_blkcipher_process( { struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); struct device *dev = &ctx_p->drvdata->plat_dev->dev; - HwDesc_s desc[MAX_ABLKCIPHER_SEQ_LEN]; + struct cc_hw_desc desc[MAX_ABLKCIPHER_SEQ_LEN]; struct ssi_crypto_req ssi_req = {}; int rc, seq_len = 0,cts_restore_flag = 0; DECL_CYCLE_COUNT_RESOURCES; diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index eb468e1baf53..7c7c922f0788 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -314,7 +314,7 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, int rc; struct ssi_crypto_req ssi_req = {0}; - HwDesc_s desc[FIPS_CIPHER_MAX_SEQ_LEN]; + struct cc_hw_desc desc[FIPS_CIPHER_MAX_SEQ_LEN]; int idx = 0; int s_flow_mode = is_aes ? S_DIN_to_AES : S_DIN_to_DES; @@ -495,7 +495,7 @@ ssi_cmac_fips_run_test(struct ssi_drvdata *drvdata, int rc; struct ssi_crypto_req ssi_req = {0}; - HwDesc_s desc[FIPS_CMAC_MAX_SEQ_LEN]; + struct cc_hw_desc desc[FIPS_CMAC_MAX_SEQ_LEN]; int idx = 0; /* Setup CMAC Key */ @@ -640,7 +640,7 @@ ssi_hash_fips_run_test(struct ssi_drvdata *drvdata, int rc; struct ssi_crypto_req ssi_req = {0}; - HwDesc_s desc[FIPS_HASH_MAX_SEQ_LEN]; + struct cc_hw_desc desc[FIPS_HASH_MAX_SEQ_LEN]; int idx = 0; /* Load initial digest */ @@ -823,7 +823,7 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, int rc; struct ssi_crypto_req ssi_req = {0}; - HwDesc_s desc[FIPS_HMAC_MAX_SEQ_LEN]; + struct cc_hw_desc desc[FIPS_HMAC_MAX_SEQ_LEN]; int idx = 0; int i; /* calc the hash opad first and ipad only afterwards (unlike the flow in ssi_hash.c) */ @@ -1131,7 +1131,7 @@ ssi_ccm_fips_run_test(struct ssi_drvdata *drvdata, int rc; struct ssi_crypto_req ssi_req = {0}; - HwDesc_s desc[FIPS_CCM_MAX_SEQ_LEN]; + struct cc_hw_desc desc[FIPS_CCM_MAX_SEQ_LEN]; unsigned int idx = 0; unsigned int cipher_flow_mode; @@ -1358,7 +1358,7 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, int rc; struct ssi_crypto_req ssi_req = {0}; - HwDesc_s desc[FIPS_GCM_MAX_SEQ_LEN]; + struct cc_hw_desc desc[FIPS_GCM_MAX_SEQ_LEN]; unsigned int idx = 0; unsigned int cipher_flow_mode; diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 2d3c6304befd..13374e749b4b 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -67,11 +67,11 @@ static const u64 sha512_init[] = { static void ssi_hash_create_xcbc_setup( struct ahash_request *areq, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size); static void ssi_hash_create_cmac_setup(struct ahash_request *areq, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size); struct ssi_hash_alg { @@ -116,11 +116,11 @@ static const struct crypto_type crypto_shash_type; static void ssi_hash_create_data_desc( struct ahash_req_ctx *areq_ctx, struct ssi_hash_ctx *ctx, - unsigned int flow_mode,HwDesc_s desc[], + unsigned int flow_mode,struct cc_hw_desc desc[], bool is_not_last_data, unsigned int *seq_size); -static inline void ssi_set_hash_endianity(u32 mode, HwDesc_s *desc) +static inline void ssi_set_hash_endianity(u32 mode, struct cc_hw_desc *desc) { if (unlikely((mode == DRV_HASH_MD5) || (mode == DRV_HASH_SHA384) || @@ -162,7 +162,7 @@ static int ssi_hash_map_request(struct device *dev, ssi_sram_addr_t larval_digest_addr = ssi_ahash_get_larval_digest_sram_addr( ctx->drvdata, ctx->hash_mode); struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc; + struct cc_hw_desc desc; int rc = -ENOMEM; state->buff0 = kzalloc(SSI_MAX_HASH_BLCK_SIZE ,GFP_KERNEL|GFP_DMA); @@ -450,7 +450,7 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, struct device *dev = &ctx->drvdata->plat_dev->dev; bool is_hmac = ctx->is_hmac; struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; ssi_sram_addr_t larval_digest_addr = ssi_ahash_get_larval_digest_sram_addr( ctx->drvdata, ctx->hash_mode); int idx = 0; @@ -610,7 +610,7 @@ static int ssi_hash_update(struct ahash_req_ctx *state, { struct device *dev = &ctx->drvdata->plat_dev->dev; struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; u32 idx = 0; int rc; @@ -708,7 +708,7 @@ static int ssi_hash_finup(struct ahash_req_ctx *state, struct device *dev = &ctx->drvdata->plat_dev->dev; bool is_hmac = ctx->is_hmac; struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; int idx = 0; int rc; @@ -839,7 +839,7 @@ static int ssi_hash_final(struct ahash_req_ctx *state, struct device *dev = &ctx->drvdata->plat_dev->dev; bool is_hmac = ctx->is_hmac; struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; int idx = 0; int rc; @@ -1007,7 +1007,7 @@ static int ssi_hash_setkey(void *hash, int blocksize = 0; int digestsize = 0; int i, idx = 0, rc = 0; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; ssi_sram_addr_t larval_addr; SSI_LOG_DEBUG("ssi_hash_setkey: start keylen: %d", keylen); @@ -1218,7 +1218,7 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, struct ssi_crypto_req ssi_req = {}; struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash); int idx = 0, rc = 0; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; SSI_LOG_DEBUG("===== setkey (%d) ====\n", keylen); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -1471,7 +1471,7 @@ static int ssi_mac_update(struct ahash_request *req) struct device *dev = &ctx->drvdata->plat_dev->dev; unsigned int block_size = crypto_tfm_alg_blocksize(&tfm->base); struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; int rc; u32 idx = 0; @@ -1533,7 +1533,7 @@ static int ssi_mac_final(struct ahash_request *req) struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); struct device *dev = &ctx->drvdata->plat_dev->dev; struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; int idx = 0; int rc = 0; u32 keySize, keyLen; @@ -1647,7 +1647,7 @@ static int ssi_mac_finup(struct ahash_request *req) struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); struct device *dev = &ctx->drvdata->plat_dev->dev; struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; int idx = 0; int rc = 0; u32 key_len = 0; @@ -1721,7 +1721,7 @@ static int ssi_mac_digest(struct ahash_request *req) struct device *dev = &ctx->drvdata->plat_dev->dev; u32 digestsize = crypto_ahash_digestsize(tfm); struct ssi_crypto_req ssi_req = {}; - HwDesc_s desc[SSI_MAX_AHASH_SEQ_LEN]; + struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN]; u32 keyLen; int idx = 0; int rc; @@ -2284,7 +2284,7 @@ int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata) struct ssi_hash_handle *hash_handle = drvdata->hash_handle; ssi_sram_addr_t sram_buff_ofs = hash_handle->digest_len_sram_addr; unsigned int larval_seq_len = 0; - HwDesc_s larval_seq[CC_DIGEST_SIZE_MAX/sizeof(u32)]; + struct cc_hw_desc larval_seq[CC_DIGEST_SIZE_MAX/sizeof(u32)]; int rc = 0; #if (DX_DEV_SHA_MAX > 256) int i; @@ -2543,7 +2543,7 @@ int ssi_hash_free(struct ssi_drvdata *drvdata) } static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { unsigned int idx = *seq_size; struct ahash_req_ctx *state = ahash_request_ctx(areq); @@ -2599,7 +2599,7 @@ static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, } static void ssi_hash_create_cmac_setup(struct ahash_request *areq, - HwDesc_s desc[], + struct cc_hw_desc desc[], unsigned int *seq_size) { unsigned int idx = *seq_size; @@ -2633,7 +2633,7 @@ static void ssi_hash_create_cmac_setup(struct ahash_request *areq, static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, struct ssi_hash_ctx *ctx, unsigned int flow_mode, - HwDesc_s desc[], + struct cc_hw_desc desc[], bool is_not_last_data, unsigned int *seq_size) { diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index 3ea040f59c02..1bb6f8919101 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -58,7 +58,7 @@ struct ssi_ivgen_ctx { */ static int ssi_ivgen_generate_pool( struct ssi_ivgen_ctx *ivgen_ctx, - HwDesc_s iv_seq[], + struct cc_hw_desc iv_seq[], unsigned int *iv_seq_len) { unsigned int idx = *iv_seq_len; @@ -120,7 +120,7 @@ static int ssi_ivgen_generate_pool( int ssi_ivgen_init_sram_pool(struct ssi_drvdata *drvdata) { struct ssi_ivgen_ctx *ivgen_ctx = drvdata->ivgen_handle; - HwDesc_s iv_seq[SSI_IVPOOL_SEQ_LEN]; + struct cc_hw_desc iv_seq[SSI_IVPOOL_SEQ_LEN]; unsigned int iv_seq_len = 0; int rc; @@ -243,7 +243,7 @@ int ssi_ivgen_getiv( dma_addr_t iv_out_dma[], unsigned int iv_out_dma_len, unsigned int iv_out_size, - HwDesc_s iv_seq[], + struct cc_hw_desc iv_seq[], unsigned int *iv_seq_len) { struct ssi_ivgen_ctx *ivgen_ctx = drvdata->ivgen_handle; diff --git a/drivers/staging/ccree/ssi_ivgen.h b/drivers/staging/ccree/ssi_ivgen.h index 15f678fa2d96..d466124a8b27 100644 --- a/drivers/staging/ccree/ssi_ivgen.h +++ b/drivers/staging/ccree/ssi_ivgen.h @@ -66,7 +66,7 @@ int ssi_ivgen_getiv( dma_addr_t iv_out_dma[], unsigned int iv_out_dma_len, unsigned int iv_out_size, - HwDesc_s iv_seq[], + struct cc_hw_desc iv_seq[], unsigned int *iv_seq_len); #endif /*__SSI_IVGEN_H__*/ diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 260aee33f235..ba7bee32973c 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -72,7 +72,7 @@ do { \ #define CC_CYCLE_DESC_TAIL(cc_base_addr, desc_p, is_monitored) \ do { \ if ((is_monitored) == true) { \ - HwDesc_s barrier_desc; \ + struct cc_hw_desc barrier_desc; \ HW_DESC_INIT(&barrier_desc); \ HW_DESC_SET_DIN_NO_DMA(&barrier_desc, 0, 0xfffff0); \ HW_DESC_SET_DOUT_NO_DMA(&barrier_desc, 0, 0, 1); \ @@ -116,10 +116,10 @@ struct ssi_request_mgr_handle { u32 axi_completed; u32 q_free_slots; spinlock_t hw_lock; - HwDesc_s compl_desc; + struct cc_hw_desc compl_desc; u8 *dummy_comp_buff; dma_addr_t dummy_comp_buff_dma; - HwDesc_s monitor_desc; + struct cc_hw_desc monitor_desc; volatile unsigned long monitor_lock; #ifdef COMP_IN_WQ struct workqueue_struct *workq; @@ -170,7 +170,7 @@ void request_mgr_fini(struct ssi_drvdata *drvdata) int request_mgr_init(struct ssi_drvdata *drvdata) { #ifdef CC_CYCLE_COUNT - HwDesc_s monitor_desc[2]; + struct cc_hw_desc monitor_desc[2]; struct ssi_crypto_req monitor_req = {0}; #endif struct ssi_request_mgr_handle *req_mgr_h; @@ -259,7 +259,7 @@ req_mgr_init_err: static inline void enqueue_seq( void __iomem *cc_base, - HwDesc_s seq[], unsigned int seq_len) + struct cc_hw_desc seq[], unsigned int seq_len) { int i; @@ -357,14 +357,14 @@ static inline int request_mgr_queues_status_check( */ int send_request( struct ssi_drvdata *drvdata, struct ssi_crypto_req *ssi_req, - HwDesc_s *desc, unsigned int len, bool is_dout) + struct cc_hw_desc *desc, unsigned int len, bool is_dout) { void __iomem *cc_base = drvdata->cc_base; struct ssi_request_mgr_handle *req_mgr_h = drvdata->request_mgr_handle; unsigned int used_sw_slots; unsigned int iv_seq_len = 0; unsigned int total_seq_len = len; /*initial sequence length*/ - HwDesc_s iv_seq[SSI_IVPOOL_SEQ_LEN]; + struct cc_hw_desc iv_seq[SSI_IVPOOL_SEQ_LEN]; int rc; unsigned int max_required_seq_len = (total_seq_len + ((ssi_req->ivgen_dma_addr_len == 0) ? 0 : @@ -503,7 +503,7 @@ int send_request( * \return int Returns "0" upon success */ int send_request_init( - struct ssi_drvdata *drvdata, HwDesc_s *desc, unsigned int len) + struct ssi_drvdata *drvdata, struct cc_hw_desc *desc, unsigned int len) { void __iomem *cc_base = drvdata->cc_base; struct ssi_request_mgr_handle *req_mgr_h = drvdata->request_mgr_handle; diff --git a/drivers/staging/ccree/ssi_request_mgr.h b/drivers/staging/ccree/ssi_request_mgr.h index 1fdb7f8b77ba..ea685bb7fa2b 100644 --- a/drivers/staging/ccree/ssi_request_mgr.h +++ b/drivers/staging/ccree/ssi_request_mgr.h @@ -40,10 +40,10 @@ int request_mgr_init(struct ssi_drvdata *drvdata); */ int send_request( struct ssi_drvdata *drvdata, struct ssi_crypto_req *ssi_req, - HwDesc_s *desc, unsigned int len, bool is_dout); + struct cc_hw_desc *desc, unsigned int len, bool is_dout); int send_request_init( - struct ssi_drvdata *drvdata, HwDesc_s *desc, unsigned int len); + struct ssi_drvdata *drvdata, struct cc_hw_desc *desc, unsigned int len); void complete_request(struct ssi_drvdata *drvdata); diff --git a/drivers/staging/ccree/ssi_sram_mgr.c b/drivers/staging/ccree/ssi_sram_mgr.c index 7dd5a72c2da3..bd7078d3e6aa 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.c +++ b/drivers/staging/ccree/ssi_sram_mgr.c @@ -121,7 +121,7 @@ ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, u32 size) void ssi_sram_mgr_const2sram_desc( const u32 *src, ssi_sram_addr_t dst, unsigned int nelement, - HwDesc_s *seq, unsigned int *seq_len) + struct cc_hw_desc *seq, unsigned int *seq_len) { u32 i; unsigned int idx = *seq_len; diff --git a/drivers/staging/ccree/ssi_sram_mgr.h b/drivers/staging/ccree/ssi_sram_mgr.h index df634db11e24..ece63594cb62 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.h +++ b/drivers/staging/ccree/ssi_sram_mgr.h @@ -75,6 +75,6 @@ ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, u32 size); void ssi_sram_mgr_const2sram_desc( const u32 *src, ssi_sram_addr_t dst, unsigned int nelement, - HwDesc_s *seq, unsigned int *seq_len); + struct cc_hw_desc *seq, unsigned int *seq_len); #endif /*__SSI_SRAM_MGR_H__*/ -- cgit v1.2.3-55-g7522 From e3f25f79903110577f7993957b3e6783763afb75 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:35:59 +0300 Subject: staging: ccree: fix white space style errors Fix checkpatch reported white space style violations in cc_hw_queue_defs.h Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 82 +++++++++++++++----------------- 1 file changed, 38 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 1607fed22239..71381760566d 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -23,10 +23,9 @@ #include "dx_crys_kernel.h" /****************************************************************************** -* DEFINITIONS +* DEFINITIONS ******************************************************************************/ - /* Dma AXI Secure bit */ #define AXI_SECURE 0 #define AXI_NOT_SECURE 1 @@ -54,17 +53,17 @@ enum cc_desc_direction { enum cc_dma_mode { DMA_MODE_NULL = -1, - NO_DMA = 0, + NO_DMA = 0, DMA_SRAM = 1, DMA_DLLI = 2, DMA_MLLI = 3, - DMA_MODE_END = S32_MAX, + DMA_MODE_END = S32_MAX, }; enum cc_flow_mode { FLOW_MODE_NULL = -1, /* data flows */ - BYPASS = 0, + BYPASS = 0, DIN_AES_DOUT = 1, AES_to_HASH = 2, AES_and_HASH = 3, @@ -84,11 +83,11 @@ enum cc_flow_mode { DIN_AES_AESMAC = 17, HASH_to_DOUT = 18, /* setup flows */ - S_DIN_to_AES = 32, + S_DIN_to_AES = 32, S_DIN_to_AES2 = 33, S_DIN_to_DES = 34, S_DIN_to_RC4 = 35, - S_DIN_to_MULTI2 = 36, + S_DIN_to_MULTI2 = 36, S_DIN_to_HASH = 37, S_AES_to_DOUT = 38, S_AES2_to_DOUT = 39, @@ -127,10 +126,9 @@ enum cc_aes_mac_selector { AES_MAC_END = S32_MAX, }; -#define HW_KEY_MASK_CIPHER_DO 0x3 +#define HW_KEY_MASK_CIPHER_DO 0x3 #define HW_KEY_SHIFT_CIPHER_CFG2 2 - /* HwCryptoKey[1:0] is mapped to cipher_do[1:0] */ /* HwCryptoKey[2:3] is mapped to cipher_config2[1:0] */ enum cc_hw_crypto_key { @@ -166,7 +164,7 @@ enum cc_hw_des_key_size { /* Descriptor packing macros */ /*****************************/ -#define GET_HW_Q_DESC_WORD_IDX(descWordIdx) (CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD ## descWordIdx) ) +#define GET_HW_Q_DESC_WORD_IDX(descWordIdx) (CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD ## descWordIdx)) #define HW_DESC_INIT(pDesc) memset(pDesc, 0, sizeof(struct cc_hw_desc)) @@ -175,7 +173,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct */ -#define HW_DESC_SET_QUEUE_LAST_IND(pDesc) \ +#define HW_DESC_SET_QUEUE_LAST_IND(pDesc) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, QUEUE_LAST_IND, (pDesc)->word[3], 1); \ } while (0) @@ -185,14 +183,13 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct */ -#define HW_DESC_SET_ACK_LAST(pDesc) \ +#define HW_DESC_SET_ACK_LAST(pDesc) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, QUEUE_LAST_IND, (pDesc)->word[3], 1); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, ACK_NEEDED, (pDesc)->word[4], 1); \ } while (0) - -#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32)&U16_MAX) +#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32) & U16_MAX) /*! * This macro sets the DIN field of a HW descriptors @@ -204,15 +201,14 @@ enum cc_hw_des_key_size { * \param axiNs AXI secure bit */ #define HW_DESC_SET_DIN_TYPE(pDesc, dmaMode, dinAdr, dinSize, axiNs) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (dinAdr)&U32_MAX ); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DIN_ADDR_HIGH, (pDesc)->word[5], MSB64(dinAdr) ); \ + do { \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (dinAdr) & U32_MAX); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DIN_ADDR_HIGH, (pDesc)->word[5], MSB64(dinAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], (dmaMode)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, NS_BIT, (pDesc)->word[1], (axiNs)); \ } while (0) - /*! * This macro sets the DIN field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and * other special modes @@ -222,7 +218,7 @@ enum cc_hw_des_key_size { * \param dinSize Data size in bytes */ #define HW_DESC_SET_DIN_NO_DMA(pDesc, dinAdr, dinSize) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(dinAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ } while (0) @@ -237,7 +233,7 @@ enum cc_hw_des_key_size { * \param dinSize Data size in bytes */ #define HW_DESC_SET_DIN_SRAM(pDesc, dinAdr, dinSize) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(dinAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], DMA_SRAM); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ @@ -250,7 +246,7 @@ enum cc_hw_des_key_size { * \param dinSize Data size in bytes */ #define HW_DESC_SET_DIN_CONST(pDesc, val, dinSize) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(val)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_CONST_VALUE, (pDesc)->word[1], 1); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], DMA_SRAM); \ @@ -263,7 +259,7 @@ enum cc_hw_des_key_size { * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_DIN_NOT_LAST_INDICATION(pDesc) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, NOT_LAST, (pDesc)->word[1], 1); \ } while (0) @@ -277,9 +273,9 @@ enum cc_hw_des_key_size { * \param axiNs AXI secure bit */ #define HW_DESC_SET_DOUT_TYPE(pDesc, dmaMode, doutAdr, doutSize, axiNs) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&U32_MAX ); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \ + do { \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr) & U32_MAX); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], (dmaMode)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, NS_BIT, (pDesc)->word[3], (axiNs)); \ @@ -295,10 +291,10 @@ enum cc_hw_des_key_size { * \param lastInd The last indication bit * \param axiNs AXI secure bit */ -#define HW_DESC_SET_DOUT_DLLI(pDesc, doutAdr, doutSize, axiNs ,lastInd) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&U32_MAX ); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \ +#define HW_DESC_SET_DOUT_DLLI(pDesc, doutAdr, doutSize, axiNs, lastInd) \ + do { \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr) & U32_MAX); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_DLLI); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], lastInd); \ @@ -315,10 +311,10 @@ enum cc_hw_des_key_size { * \param lastInd The last indication bit * \param axiNs AXI secure bit */ -#define HW_DESC_SET_DOUT_MLLI(pDesc, doutAdr, doutSize, axiNs ,lastInd) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr)&U32_MAX ); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr) ); \ +#define HW_DESC_SET_DOUT_MLLI(pDesc, doutAdr, doutSize, axiNs, lastInd) \ + do { \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr) & U32_MAX); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_MLLI); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], lastInd); \ @@ -335,7 +331,7 @@ enum cc_hw_des_key_size { * \param registerWriteEnable Enables a write operation to a register */ #define HW_DESC_SET_DOUT_NO_DMA(pDesc, doutAdr, doutSize, registerWriteEnable) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(doutAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], (registerWriteEnable)); \ @@ -348,7 +344,7 @@ enum cc_hw_des_key_size { * \param xorVal xor data value */ #define HW_DESC_SET_XOR_VAL(pDesc, xorVal) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(xorVal)); \ } while (0) @@ -358,7 +354,7 @@ enum cc_hw_des_key_size { * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_XOR_ACTIVE(pDesc) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, HASH_XOR_BIT, (pDesc)->word[3], 1); \ } while (0) @@ -368,7 +364,7 @@ enum cc_hw_des_key_size { * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_AES_NOT_HASH_MODE(pDesc) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, AES_SEL_N_HASH, (pDesc)->word[4], 1); \ } while (0) @@ -382,13 +378,12 @@ enum cc_hw_des_key_size { * \param doutSize Data size in bytes */ #define HW_DESC_SET_DOUT_SRAM(pDesc, doutAdr, doutSize) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(doutAdr)); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_SRAM); \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ } while (0) - /*! * This macro sets the data unit size for XEX mode in data_out_addr[15:0] * @@ -464,8 +459,8 @@ enum cc_hw_des_key_size { */ #define HW_DESC_SET_HW_CRYPTO_KEY(pDesc, hwKey) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (hwKey)&HW_KEY_MASK_CIPHER_DO); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF2, (pDesc)->word[4], (hwKey>>HW_KEY_SHIFT_CIPHER_CFG2)); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (hwKey) & HW_KEY_MASK_CIPHER_DO); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF2, (pDesc)->word[4], (hwKey >> HW_KEY_SHIFT_CIPHER_CFG2)); \ } while (0) /*! @@ -530,7 +525,7 @@ enum cc_hw_des_key_size { */ #define HW_DESC_SET_CIPHER_DO(pDesc, cipherDo) \ do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (cipherDo)&HW_KEY_MASK_CIPHER_DO); \ + CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (cipherDo) & HW_KEY_MASK_CIPHER_DO); \ } while (0) /*! @@ -540,10 +535,9 @@ enum cc_hw_des_key_size { * \param pDesc pointer HW descriptor struct */ #define HW_DESC_SET_DIN_MONITOR_CNTR(pDesc) \ - do { \ + do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_MEASURE_CNTR, VALUE, (pDesc)->word[1], _HW_DESC_MONITOR_KICK); \ } while (0) - #endif /*__CC_HW_QUEUE_DEFS_H__*/ -- cgit v1.2.3-55-g7522 From 96c87d8dd166d5ba66d6251910209fe5d69a6e52 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:36:00 +0300 Subject: staging: ccree: fix cc_lli_defs.h white space Fix checkpatch reported white space style violations in cc_lli_defs.h Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_lli_defs.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index 75d5e2762e8f..8c978b14a1f1 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -14,7 +14,6 @@ * along with this program; if not, see . */ - #ifndef _CC_LLI_DEFS_H_ #define _CC_LLI_DEFS_H_ #ifdef __KERNEL__ @@ -29,7 +28,7 @@ #define CC_MAX_MLLI_ENTRY_SIZE 0x10000 -#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32)&U16_MAX) +#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32) & U16_MAX) #define LLI_SET_ADDR(lli_p, addr) \ BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD0_OFFSET], LLI_LADDR_BIT_OFFSET, LLI_LADDR_BIT_SIZE, (addr & U32_MAX)); \ @@ -53,5 +52,4 @@ #define LLI_HADDR_BIT_OFFSET 16 #define LLI_HADDR_BIT_SIZE 16 - #endif /*_CC_LLI_DEFS_H_*/ -- cgit v1.2.3-55-g7522 From a2316f263e73046d169ee11ffa876472756f672d Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:36:01 +0300 Subject: stating: ccree: remove double definition of MSB64 The MSB64 is defined in two include file. One copy is sufficient. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_lli_defs.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index 8c978b14a1f1..d9758e643fa9 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -28,8 +28,6 @@ #define CC_MAX_MLLI_ENTRY_SIZE 0x10000 -#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32) & U16_MAX) - #define LLI_SET_ADDR(lli_p, addr) \ BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD0_OFFSET], LLI_LADDR_BIT_OFFSET, LLI_LADDR_BIT_SIZE, (addr & U32_MAX)); \ BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD1_OFFSET], LLI_HADDR_BIT_OFFSET, LLI_HADDR_BIT_SIZE, MSB64(addr)); -- cgit v1.2.3-55-g7522 From 6adce0c93bef10fe6802247de1ad7af44836338b Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:36:02 +0300 Subject: staging: ccree: drop __KERNEL__ include guard Drop uneeded include guard for __KERNEL__. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_lli_defs.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index d9758e643fa9..c84b14226dc9 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -16,11 +16,9 @@ #ifndef _CC_LLI_DEFS_H_ #define _CC_LLI_DEFS_H_ -#ifdef __KERNEL__ + #include -#else -#include -#endif + #include "cc_bitops.h" /* Max DLLI size */ -- cgit v1.2.3-55-g7522 From 54ee8341a9826fa72f2adce0b0b1bccf13e85eab Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 7 May 2017 16:36:03 +0300 Subject: staging: ccree: fix checkpatch errors in macro def Fix various checkpatch warnings and errors in LLI macro definitions Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_lli_defs.h | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index c84b14226dc9..857b94fc9c58 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -21,17 +21,29 @@ #include "cc_bitops.h" -/* Max DLLI size */ -#define DLLI_SIZE_BIT_SIZE 0x18 // DX_DSCRPTR_QUEUE_WORD1_DIN_SIZE_BIT_SIZE +/* Max DLLI size + * AKA DX_DSCRPTR_QUEUE_WORD1_DIN_SIZE_BIT_SIZE + */ +#define DLLI_SIZE_BIT_SIZE 0x18 #define CC_MAX_MLLI_ENTRY_SIZE 0x10000 -#define LLI_SET_ADDR(lli_p, addr) \ - BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD0_OFFSET], LLI_LADDR_BIT_OFFSET, LLI_LADDR_BIT_SIZE, (addr & U32_MAX)); \ - BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD1_OFFSET], LLI_HADDR_BIT_OFFSET, LLI_HADDR_BIT_SIZE, MSB64(addr)); - -#define LLI_SET_SIZE(lli_p, size) \ - BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD1_OFFSET], LLI_SIZE_BIT_OFFSET, LLI_SIZE_BIT_SIZE, size) +#define LLI_SET_ADDR(__lli_p, __addr) do { \ + u32 *lli_p = (u32 *)__lli_p; \ + typeof(__addr) addr = __addr; \ + \ + BITFIELD_SET(lli_p[LLI_WORD0_OFFSET], \ + LLI_LADDR_BIT_OFFSET, \ + LLI_LADDR_BIT_SIZE, (addr & U32_MAX)); \ + \ + BITFIELD_SET(lli_p[LLI_WORD1_OFFSET], \ + LLI_HADDR_BIT_OFFSET, \ + LLI_HADDR_BIT_SIZE, MSB64(addr)); \ + } while (0) + +#define LLI_SET_SIZE(lli_p, size) \ + BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD1_OFFSET], \ + LLI_SIZE_BIT_OFFSET, LLI_SIZE_BIT_SIZE, size) /* Size of entry */ #define LLI_ENTRY_WORD_SIZE 2 -- cgit v1.2.3-55-g7522 From 1be00f941b0ca059725b280544c8f4f76b503b7a Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 11 May 2017 09:38:19 +0200 Subject: staging: ccree: Fix indentation of driver_hash[] initializers Closing braces should match the first characters of the openings. Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_hash.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 13374e749b4b..162d17dee2cd 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -2002,8 +2002,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA1_DIGEST_SIZE, .statesize = sizeof(struct sha1_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA1, .hw_mode = DRV_HASH_HW_SHA1, @@ -2031,8 +2031,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA256_DIGEST_SIZE, .statesize = sizeof(struct sha256_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA256, .hw_mode = DRV_HASH_HW_SHA256, @@ -2060,8 +2060,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA224_DIGEST_SIZE, .statesize = sizeof(struct sha256_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA224, .hw_mode = DRV_HASH_HW_SHA256, @@ -2090,8 +2090,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA384_DIGEST_SIZE, .statesize = sizeof(struct sha512_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA384, .hw_mode = DRV_HASH_HW_SHA512, @@ -2119,8 +2119,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA512_DIGEST_SIZE, .statesize = sizeof(struct sha512_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA512, .hw_mode = DRV_HASH_HW_SHA512, @@ -2149,8 +2149,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = MD5_DIGEST_SIZE, .statesize = sizeof(struct md5_state), - }, }, + }, }, .hash_mode = DRV_HASH_MD5, .hw_mode = DRV_HASH_HW_MD5, @@ -2176,8 +2176,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = AES_BLOCK_SIZE, .statesize = sizeof(struct aeshash_state), - }, }, + }, }, .hash_mode = DRV_HASH_NULL, .hw_mode = DRV_CIPHER_XCBC_MAC, @@ -2204,8 +2204,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = AES_BLOCK_SIZE, .statesize = sizeof(struct aeshash_state), - }, }, + }, }, .hash_mode = DRV_HASH_NULL, .hw_mode = DRV_CIPHER_CMAC, -- cgit v1.2.3-55-g7522 From 75d9c393763da31a8a95ae514c6f3caa2429ce33 Mon Sep 17 00:00:00 2001 From: Alexis Lothoré Date: Wed, 10 May 2017 19:39:41 +0200 Subject: staging: emxx_udc: Update EPn variables name Update EPn* variables names to EPN* to prevent CamelCase usage Signed-off-by: Alexis Lothoré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 136 +++++++++++------------ drivers/staging/emxx_udc/emxx_udc.h | 216 ++++++++++++++++++------------------ 2 files changed, 176 insertions(+), 176 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 77b242e09932..82f2c117863e 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -200,13 +200,13 @@ static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc) for (num = 0; num < NUM_ENDPOINTS - 1; num++) { p_ep_regs = &udc->p_regs->EP_REGS[num]; data = _nbu2ss_readl(&p_ep_regs->EP_PCKT_ADRS); - buf_type = _nbu2ss_readl(&p_ep_regs->EP_CONTROL) & EPn_BUF_TYPE; + buf_type = _nbu2ss_readl(&p_ep_regs->EP_CONTROL) & EPN_BUF_TYPE; if (buf_type == 0) { /* Single Buffer */ - use_ram_size += (data & EPn_MPKT) / sizeof(u32); + use_ram_size += (data & EPN_MPKT) / sizeof(u32); } else { /* Double Buffer */ - use_ram_size += ((data & EPn_MPKT) / sizeof(u32)) * 2; + use_ram_size += ((data & EPN_MPKT) / sizeof(u32)) * 2; } if ((data >> 16) > last_ram_adr) @@ -245,15 +245,15 @@ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /* Bulk, Interrupt, ISO */ switch (ep->ep_type) { case USB_ENDPOINT_XFER_BULK: - data = EPn_BULK; + data = EPN_BULK; break; case USB_ENDPOINT_XFER_INT: - data = EPn_BUF_SINGLE | EPn_INTERRUPT; + data = EPN_BUF_SINGLE | EPN_INTERRUPT; break; case USB_ENDPOINT_XFER_ISOC: - data = EPn_ISO; + data = EPN_ISO; break; default: @@ -267,24 +267,24 @@ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) if (ep->direct == USB_DIR_OUT) { /*---------------------------------------------------------*/ /* OUT */ - data = EPn_EN | EPn_BCLR | EPn_DIR0; + data = EPN_EN | EPN_BCLR | EPN_DIR0; _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - data = EPn_ONAK | EPn_OSTL_EN | EPn_OSTL; + data = EPN_ONAK | EPN_OSTL_EN | EPN_OSTL; _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - data = EPn_OUT_EN | EPn_OUT_END_EN; + data = EPN_OUT_EN | EPN_OUT_END_EN; _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); } else { /*---------------------------------------------------------*/ /* IN */ - data = EPn_EN | EPn_BCLR | EPn_AUTO; + data = EPN_EN | EPN_BCLR | EPN_AUTO; _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - data = EPn_ISTL; + data = EPN_ISTL; _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - data = EPn_IN_EN | EPn_IN_END_EN; + data = EPN_IN_EN | EPN_IN_END_EN; _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); } @@ -315,24 +315,24 @@ static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) if (ep->direct == USB_DIR_OUT) { /*---------------------------------------------------------*/ /* OUT */ - data = EPn_ONAK | EPn_BCLR; + data = EPN_ONAK | EPN_BCLR; _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - data = EPn_EN | EPn_DIR0; + data = EPN_EN | EPN_DIR0; _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - data = EPn_OUT_EN | EPn_OUT_END_EN; + data = EPN_OUT_EN | EPN_OUT_END_EN; _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); } else { /*---------------------------------------------------------*/ /* IN */ - data = EPn_BCLR; + data = EPN_BCLR; _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - data = EPn_EN | EPn_AUTO; + data = EPN_EN | EPN_AUTO; _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - data = EPn_IN_EN | EPn_IN_END_EN; + data = EPN_IN_EN | EPN_IN_END_EN; _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); } @@ -360,21 +360,21 @@ static void _nbu2ss_ep_dma_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /*---------------------------------------------------------*/ /* Transfer Direct */ - data = DCR1_EPn_DIR0; + data = DCR1_EPN_DIR0; _nbu2ss_bitset(&udc->p_regs->EP_DCR[num].EP_DCR1, data); /*---------------------------------------------------------*/ /* DMA Mode etc. */ - data = EPn_STOP_MODE | EPn_STOP_SET | EPn_DMAMODE0; + data = EPN_STOP_MODE | EPN_STOP_SET | EPN_DMAMODE0; _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_DMA_CTRL, data); } else { /*---------------------------------------------------------*/ /* IN */ - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, EPn_AUTO); + _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, EPN_AUTO); /*---------------------------------------------------------*/ /* DMA Mode etc. */ - data = EPn_BURST_SET | EPn_DMAMODE0; + data = EPN_BURST_SET | EPN_DMAMODE0; _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_DMA_CTRL, data); } } @@ -402,12 +402,12 @@ static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /*---------------------------------------------------------*/ /* OUT */ _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, 0); - _nbu2ss_bitclr(&preg->EP_DCR[num].EP_DCR1, DCR1_EPn_DIR0); + _nbu2ss_bitclr(&preg->EP_DCR[num].EP_DCR1, DCR1_EPN_DIR0); _nbu2ss_writel(&preg->EP_REGS[num].EP_DMA_CTRL, 0); } else { /*---------------------------------------------------------*/ /* IN */ - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, EPn_AUTO); + _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); _nbu2ss_writel(&preg->EP_REGS[num].EP_DMA_CTRL, 0); } } @@ -418,9 +418,9 @@ static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) { struct fc_regs *preg = udc->p_regs; - _nbu2ss_bitclr(&preg->EP_DCR[ep->epnum - 1].EP_DCR1, DCR1_EPn_REQEN); - mdelay(DMA_DISABLE_TIME); /* DCR1_EPn_REQEN Clear */ - _nbu2ss_bitclr(&preg->EP_REGS[ep->epnum - 1].EP_DMA_CTRL, EPn_DMA_EN); + _nbu2ss_bitclr(&preg->EP_DCR[ep->epnum - 1].EP_DCR1, DCR1_EPN_REQEN); + mdelay(DMA_DISABLE_TIME); /* DCR1_EPN_REQEN Clear */ + _nbu2ss_bitclr(&preg->EP_REGS[ep->epnum - 1].EP_DMA_CTRL, EPN_DMA_EN); } /*-------------------------------------------------------------------------*/ @@ -453,16 +453,16 @@ static void _nbu2ss_ep_in_end( } else { num = epnum - 1; - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, EPn_AUTO); + _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); /* Writing of 1-4 bytes */ if (length) _nbu2ss_writel(&preg->EP_REGS[num].EP_WRITE, data32); - data = (((length) << 5) & EPn_DW) | EPn_DEND; + data = (((length) << 5) & EPN_DW) | EPN_DEND; _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, data); - _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, EPn_AUTO); + _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); } } @@ -835,7 +835,7 @@ static int _nbu2ss_out_dma( _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer); /* Number of transfer packets */ - mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPn_MPKT; + mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT; dmacnt = length / mpkt; lmpkt = (length % mpkt) & ~(u32)0x03; @@ -851,18 +851,18 @@ static int _nbu2ss_out_dma( data = mpkt | (lmpkt << 16); _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data); - data = ((dmacnt & 0xff) << 16) | DCR1_EPn_DIR0 | DCR1_EPn_REQEN; + data = ((dmacnt & 0xff) << 16) | DCR1_EPN_DIR0 | DCR1_EPN_REQEN; _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR1, data); if (burst == 0) { _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, 0); - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_DMA_CTRL, EPn_BURST_SET); + _nbu2ss_bitclr(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET); } else { _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT , (dmacnt << 16)); - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPn_BURST_SET); + _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET); } - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPn_DMA_EN); + _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN); result = length & ~(u32)0x03; req->div_len = result; @@ -978,7 +978,7 @@ static int _nbu2ss_epn_out_transfer( /*-------------------------------------------------------------*/ /* Receive Length */ iRecvLength - = _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) & EPn_LDATA; + = _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) & EPN_LDATA; if (iRecvLength != 0) { result = _nbu2ss_epn_out_data(udc, ep, req, iRecvLength); @@ -1042,7 +1042,7 @@ static int _nbu2ss_in_dma( req->dma_flag = TRUE; /* MAX Packet Size */ - mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPn_MPKT; + mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT; if ((DMA_MAX_COUNT * mpkt) < length) iWriteLength = DMA_MAX_COUNT * mpkt; @@ -1074,7 +1074,7 @@ static int _nbu2ss_in_dma( _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer); /* Packet and DMA setting */ - data = ((dmacnt & 0xff) << 16) | DCR1_EPn_REQEN; + data = ((dmacnt & 0xff) << 16) | DCR1_EPN_REQEN; _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR1, data); /* Packet setting of EPC */ @@ -1082,7 +1082,7 @@ static int _nbu2ss_in_dma( _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, data); /*DMA setting of EPC */ - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPn_DMA_EN); + _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN); result = iWriteLength & ~(u32)0x3; req->div_len = result; @@ -1192,11 +1192,11 @@ static int _nbu2ss_epn_in_transfer( /*-------------------------------------------------------------*/ /* State confirmation of FIFO */ if (req->req.actual == 0) { - if ((status & EPn_IN_EMPTY) == 0) + if ((status & EPN_IN_EMPTY) == 0) return 1; /* Not Empty */ } else { - if ((status & EPn_IN_FULL) != 0) + if ((status & EPN_IN_FULL) != 0) return 1; /* Not Empty */ } @@ -1252,7 +1252,7 @@ static int _nbu2ss_start_transfer( } } else { - /* EPn */ + /* EPN */ if (ep->direct == USB_DIR_OUT) { /* OUT */ if (!bflag) @@ -1281,7 +1281,7 @@ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) length = _nbu2ss_readl( &ep->udc->p_regs->EP_REGS[ep->epnum - 1].EP_LEN_DCNT); - length &= EPn_LDATA; + length &= EPN_LDATA; if (length < ep->ep.maxpacket) bflag = TRUE; } @@ -1304,9 +1304,9 @@ static void _nbu2ss_endpoint_toggle_reset( num = (ep_adrs & 0x7F) - 1; if (ep_adrs & USB_DIR_IN) - data = EPn_IPIDCLR; + data = EPN_IPIDCLR; else - data = EPn_BCLR | EPn_OPIDCLR; + data = EPN_BCLR | EPN_OPIDCLR; _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); } @@ -1341,9 +1341,9 @@ static void _nbu2ss_set_endpoint_stall( ep->halted = TRUE; if (ep_adrs & USB_DIR_IN) - data = EPn_BCLR | EPn_ISTL; + data = EPN_BCLR | EPN_ISTL; else - data = EPn_OSTL_EN | EPn_OSTL; + data = EPN_OSTL_EN | EPN_OSTL; _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, data); } else { @@ -1351,13 +1351,13 @@ static void _nbu2ss_set_endpoint_stall( ep->stalled = FALSE; if (ep_adrs & USB_DIR_IN) { _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL - , EPn_ISTL); + , EPN_ISTL); } else { data = _nbu2ss_readl(&preg->EP_REGS[num].EP_CONTROL); - data &= ~EPn_OSTL; - data |= EPn_OSTL_EN; + data &= ~EPN_OSTL; + data |= EPN_OSTL_EN; _nbu2ss_writel(&preg->EP_REGS[num].EP_CONTROL , data); @@ -1453,13 +1453,13 @@ static int _nbu2ss_get_ep_stall(struct nbu2ss_udc *udc, u8 ep_adrs) } else { data = _nbu2ss_readl(&preg->EP_REGS[epnum - 1].EP_CONTROL); - if ((data & EPn_EN) == 0) + if ((data & EPN_EN) == 0) return -1; if (ep_adrs & USB_ENDPOINT_DIR_MASK) - bit_data = EPn_ISTL; + bit_data = EPN_ISTL; else - bit_data = EPn_OSTL; + bit_data = EPN_OSTL; } if ((data & bit_data) == 0) @@ -1548,7 +1548,7 @@ static void _nbu2ss_epn_set_stall( regdata = _nbu2ss_readl( &preg->EP_REGS[ep->epnum - 1].EP_STATUS); - if ((regdata & EPn_IN_DATA) == 0) + if ((regdata & EPN_IN_DATA) == 0) break; mdelay(1); @@ -1968,7 +1968,7 @@ static inline void _nbu2ss_epn_in_int( status = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_STATUS); - if ((status & EPn_IN_FULL) == 0) { + if ((status & EPN_IN_FULL) == 0) { /*-----------------------------------------*/ /* 0 Length Packet */ req->zero = false; @@ -2059,18 +2059,18 @@ static inline void _nbu2ss_epn_out_dma_int( } ep_dmacnt = _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) - & EPn_DMACNT; + & EPN_DMACNT; ep_dmacnt >>= 16; for (i = 0; i < EPC_PLL_LOCK_COUNT; i++) { dmacnt = _nbu2ss_readl(&preg->EP_DCR[num].EP_DCR1) - & DCR1_EPn_DMACNT; + & DCR1_EPN_DMACNT; dmacnt >>= 16; if (ep_dmacnt == dmacnt) break; } - _nbu2ss_bitclr(&preg->EP_DCR[num].EP_DCR1, DCR1_EPn_REQEN); + _nbu2ss_bitclr(&preg->EP_DCR[num].EP_DCR1, DCR1_EPN_REQEN); if (dmacnt != 0) { mpkt = ep->ep.maxpacket; @@ -2117,20 +2117,20 @@ static inline void _nbu2ss_epn_int(struct nbu2ss_udc *udc, u32 epnum) return; } - if (status & EPn_OUT_END_INT) { - status &= ~EPn_OUT_INT; + if (status & EPN_OUT_END_INT) { + status &= ~EPN_OUT_INT; _nbu2ss_epn_out_dma_int(udc, ep, req); } - if (status & EPn_OUT_INT) + if (status & EPN_OUT_INT) _nbu2ss_epn_out_int(udc, ep, req); - if (status & EPn_IN_END_INT) { - status &= ~EPn_IN_INT; + if (status & EPN_IN_END_INT) { + status &= ~EPN_IN_INT; _nbu2ss_epn_in_dma_int(udc, ep, req); } - if (status & EPn_IN_INT) + if (status & EPN_IN_INT) _nbu2ss_epn_in_int(udc, ep, req); } @@ -2231,9 +2231,9 @@ static void _nbu2ss_fifo_flush(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) _nbu2ss_bitset(&p->EP0_CONTROL, EP0_BCLR); } else { - /* EPn */ + /* EPN */ _nbu2ss_ep_dma_abort(udc, ep); - _nbu2ss_bitset(&p->EP_REGS[ep->epnum - 1].EP_CONTROL, EPn_BCLR); + _nbu2ss_bitset(&p->EP_REGS[ep->epnum - 1].EP_CONTROL, EPN_BCLR); } } @@ -2478,7 +2478,7 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) suspend_flag = 1; } - if (status & EPn_INT) { + if (status & EPN_INT) { /* EP INT */ int_bit = status >> 8; @@ -2868,7 +2868,7 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) } else { data = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_LEN_DCNT) - & EPn_LDATA; + & EPN_LDATA; } spin_unlock_irqrestore(&udc->lock, flags); diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index 78c08e15a1f9..332332dd58e1 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -144,7 +144,7 @@ /*------- (0x001C) Setup Data 1 Register */ /*------- (0x0020) USB Interrupt Status Register */ -#define EPn_INT 0x00FFFF00 +#define EPN_INT 0x00FFFF00 #define EP15_INT BIT23 #define EP14_INT BIT22 #define EP13_INT BIT21 @@ -264,102 +264,102 @@ /*------- (0x0038) EP0 Read Register */ /*------- (0x003C) EP0 Write Register */ -/*------- (0x0040:) EPn Control Register */ -#define EPn_EN BIT31 -#define EPn_BUF_TYPE BIT30 -#define EPn_BUF_SINGLE BIT30 - -#define EPn_DIR0 BIT26 -#define EPn_MODE (BIT25 + BIT24) -#define EPn_BULK 0 -#define EPn_INTERRUPT BIT24 -#define EPn_ISO BIT25 - -#define EPn_OVERSEL BIT17 -#define EPn_AUTO BIT16 - -#define EPn_IPIDCLR BIT11 -#define EPn_OPIDCLR BIT10 -#define EPn_BCLR BIT09 -#define EPn_CBCLR BIT08 -#define EPn_DEND BIT07 -#define EPn_DW (BIT06 + BIT05) -#define EPn_DW4 0 -#define EPn_DW3 (BIT06 + BIT05) -#define EPn_DW2 BIT06 -#define EPn_DW1 BIT05 - -#define EPn_OSTL_EN BIT04 -#define EPn_ISTL BIT03 -#define EPn_OSTL BIT02 - -#define EPn_ONAK BIT00 - -/*------- (0x0044:) EPn Status Register */ -#define EPn_ISO_PIDERR BIT29 /* R */ -#define EPn_OPID BIT28 /* R */ -#define EPn_OUT_NOTKN BIT27 /* R */ -#define EPn_ISO_OR BIT26 /* R */ - -#define EPn_ISO_CRC BIT24 /* R */ -#define EPn_OUT_END_INT BIT23 /* RW */ -#define EPn_OUT_OR_INT BIT22 /* RW */ -#define EPn_OUT_NAK_ERR_INT BIT21 /* RW */ -#define EPn_OUT_STALL_INT BIT20 /* RW */ -#define EPn_OUT_INT BIT19 /* RW */ -#define EPn_OUT_NULL_INT BIT18 /* RW */ -#define EPn_OUT_FULL BIT17 /* R */ -#define EPn_OUT_EMPTY BIT16 /* R */ - -#define EPn_IPID BIT10 /* R */ -#define EPn_IN_NOTKN BIT09 /* R */ -#define EPn_ISO_UR BIT08 /* R */ -#define EPn_IN_END_INT BIT07 /* RW */ - -#define EPn_IN_NAK_ERR_INT BIT05 /* RW */ -#define EPn_IN_STALL_INT BIT04 /* RW */ -#define EPn_IN_INT BIT03 /* RW */ -#define EPn_IN_DATA BIT02 /* R */ -#define EPn_IN_FULL BIT01 /* R */ -#define EPn_IN_EMPTY BIT00 /* R */ - -#define EPn_INT_EN \ - (EPn_OUT_END_INT | EPn_OUT_INT | EPn_IN_END_INT | EPn_IN_INT) - -/*------- (0x0048:) EPn Interrupt Enable Register */ -#define EPn_OUT_END_EN BIT23 /* RW */ -#define EPn_OUT_OR_EN BIT22 /* RW */ -#define EPn_OUT_NAK_ERR_EN BIT21 /* RW */ -#define EPn_OUT_STALL_EN BIT20 /* RW */ -#define EPn_OUT_EN BIT19 /* RW */ -#define EPn_OUT_NULL_EN BIT18 /* RW */ - -#define EPn_IN_END_EN BIT07 /* RW */ - -#define EPn_IN_NAK_ERR_EN BIT05 /* RW */ -#define EPn_IN_STALL_EN BIT04 /* RW */ -#define EPn_IN_EN BIT03 /* RW */ - -/*------- (0x004C:) EPn Interrupt Enable Register */ -#define EPn_STOP_MODE BIT11 -#define EPn_DEND_SET BIT10 -#define EPn_BURST_SET BIT09 -#define EPn_STOP_SET BIT08 - -#define EPn_DMA_EN BIT04 - -#define EPn_DMAMODE0 BIT00 - -/*------- (0x0050:) EPn MaxPacket & BaseAddress Register */ -#define EPn_BASEAD 0x1FFF0000 -#define EPn_MPKT 0x000007FF - -/*------- (0x0054:) EPn Length & DMA Count Register */ -#define EPn_DMACNT 0x01FF0000 -#define EPn_LDATA 0x000007FF - -/*------- (0x0058:) EPn Read Register */ -/*------- (0x005C:) EPn Write Register */ +/*------- (0x0040:) EPN Control Register */ +#define EPN_EN BIT31 +#define EPN_BUF_TYPE BIT30 +#define EPN_BUF_SINGLE BIT30 + +#define EPN_DIR0 BIT26 +#define EPN_MODE (BIT25 + BIT24) +#define EPN_BULK 0 +#define EPN_INTERRUPT BIT24 +#define EPN_ISO BIT25 + +#define EPN_OVERSEL BIT17 +#define EPN_AUTO BIT16 + +#define EPN_IPIDCLR BIT11 +#define EPN_OPIDCLR BIT10 +#define EPN_BCLR BIT09 +#define EPN_CBCLR BIT08 +#define EPN_DEND BIT07 +#define EPN_DW (BIT06 + BIT05) +#define EPN_DW4 0 +#define EPN_DW3 (BIT06 + BIT05) +#define EPN_DW2 BIT06 +#define EPN_DW1 BIT05 + +#define EPN_OSTL_EN BIT04 +#define EPN_ISTL BIT03 +#define EPN_OSTL BIT02 + +#define EPN_ONAK BIT00 + +/*------- (0x0044:) EPN Status Register */ +#define EPN_ISO_PIDERR BIT29 /* R */ +#define EPN_OPID BIT28 /* R */ +#define EPN_OUT_NOTKN BIT27 /* R */ +#define EPN_ISO_OR BIT26 /* R */ + +#define EPN_ISO_CRC BIT24 /* R */ +#define EPN_OUT_END_INT BIT23 /* RW */ +#define EPN_OUT_OR_INT BIT22 /* RW */ +#define EPN_OUT_NAK_ERR_INT BIT21 /* RW */ +#define EPN_OUT_STALL_INT BIT20 /* RW */ +#define EPN_OUT_INT BIT19 /* RW */ +#define EPN_OUT_NULL_INT BIT18 /* RW */ +#define EPN_OUT_FULL BIT17 /* R */ +#define EPN_OUT_EMPTY BIT16 /* R */ + +#define EPN_IPID BIT10 /* R */ +#define EPN_IN_NOTKN BIT09 /* R */ +#define EPN_ISO_UR BIT08 /* R */ +#define EPN_IN_END_INT BIT07 /* RW */ + +#define EPN_IN_NAK_ERR_INT BIT05 /* RW */ +#define EPN_IN_STALL_INT BIT04 /* RW */ +#define EPN_IN_INT BIT03 /* RW */ +#define EPN_IN_DATA BIT02 /* R */ +#define EPN_IN_FULL BIT01 /* R */ +#define EPN_IN_EMPTY BIT00 /* R */ + +#define EPN_INT_EN \ + (EPN_OUT_END_INT | EPN_OUT_INT | EPN_IN_END_INT | EPN_IN_INT) + +/*------- (0x0048:) EPN Interrupt Enable Register */ +#define EPN_OUT_END_EN BIT23 /* RW */ +#define EPN_OUT_OR_EN BIT22 /* RW */ +#define EPN_OUT_NAK_ERR_EN BIT21 /* RW */ +#define EPN_OUT_STALL_EN BIT20 /* RW */ +#define EPN_OUT_EN BIT19 /* RW */ +#define EPN_OUT_NULL_EN BIT18 /* RW */ + +#define EPN_IN_END_EN BIT07 /* RW */ + +#define EPN_IN_NAK_ERR_EN BIT05 /* RW */ +#define EPN_IN_STALL_EN BIT04 /* RW */ +#define EPN_IN_EN BIT03 /* RW */ + +/*------- (0x004C:) EPN Interrupt Enable Register */ +#define EPN_STOP_MODE BIT11 +#define EPN_DEND_SET BIT10 +#define EPN_BURST_SET BIT09 +#define EPN_STOP_SET BIT08 + +#define EPN_DMA_EN BIT04 + +#define EPN_DMAMODE0 BIT00 + +/*------- (0x0050:) EPN MaxPacket & BaseAddress Register */ +#define EPN_BASEAD 0x1FFF0000 +#define EPN_MPKT 0x000007FF + +/*------- (0x0054:) EPN Length & DMA Count Register */ +#define EPN_DMACNT 0x01FF0000 +#define EPN_LDATA 0x000007FF + +/*------- (0x0058:) EPN Read Register */ +/*------- (0x005C:) EPN Write Register */ /*------- (0x1000) AHBSCTR Register */ #define WAIT_MODE BIT00 @@ -428,19 +428,19 @@ #define EP_AVAILABLE 0xFFFF0000 /* R */ #define DMA_AVAILABLE 0x0000FFFF /* R */ -/*------- (0x1110:) EPnDCR1 Register */ -#define DCR1_EPn_DMACNT 0x00FF0000 /* RW */ +/*------- (0x1110:) EPNDCR1 Register */ +#define DCR1_EPN_DMACNT 0x00FF0000 /* RW */ -#define DCR1_EPn_DIR0 BIT01 /* RW */ -#define DCR1_EPn_REQEN BIT00 /* RW */ +#define DCR1_EPN_DIR0 BIT01 /* RW */ +#define DCR1_EPN_REQEN BIT00 /* RW */ -/*------- (0x1114:) EPnDCR2 Register */ -#define DCR2_EPn_LMPKT 0x07FF0000 /* RW */ +/*------- (0x1114:) EPNDCR2 Register */ +#define DCR2_EPN_LMPKT 0x07FF0000 /* RW */ -#define DCR2_EPn_MPKT 0x000007FF /* RW */ +#define DCR2_EPN_MPKT 0x000007FF /* RW */ -/*------- (0x1118:) EPnTADR Register */ -#define EPn_TADR 0xFFFFFFFF /* RW */ +/*------- (0x1118:) EPNTADR Register */ +#define EPN_TADR 0xFFFFFFFF /* RW */ /*===========================================================================*/ /* Struct */ @@ -509,10 +509,10 @@ struct fc_regs { #define EP0_PACKETSIZE 64 #define EP_PACKETSIZE 1024 -/* EPn RAM SIZE */ +/* EPN RAM SIZE */ #define D_RAM_SIZE_CTRL 64 -/* EPn Bulk Endpoint Max Packet Size */ +/* EPN Bulk Endpoint Max Packet Size */ #define D_FS_RAM_SIZE_BULK 64 #define D_HS_RAM_SIZE_BULK 512 -- cgit v1.2.3-55-g7522 From ecddcb75290a9ce53547c204578f39167715bf7b Mon Sep 17 00:00:00 2001 From: Alexis Lothoré Date: Wed, 10 May 2017 19:39:42 +0200 Subject: staging: emxx_udc: Balance "else" parenthesis Add missing parenthesis for else statement Signed-off-by: Alexis Lothoré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 82f2c117863e..14db5f70acdb 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -526,12 +526,13 @@ static void _nbu2ss_dma_unmap_single( if (direct == USB_DIR_OUT) memcpy(req->req.buf, ep->virt_buf, req->req.actual & 0xfffffffc); - } else + } else { dma_unmap_single(udc->gadget.dev.parent, req->req.dma, req->req.length, (direct == USB_DIR_IN) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); + } req->req.dma = DMA_ADDR_INVALID; req->mapped = 0; } else { -- cgit v1.2.3-55-g7522 From 16047b1066f22cdd2628954ced2ae942b3a064a7 Mon Sep 17 00:00:00 2001 From: Alexis Lothoré Date: Wed, 10 May 2017 19:39:43 +0200 Subject: staging: emxx_udc: Update function names Ensure that function names does not mix upper/lower case Signed-off-by: Alexis Lothoré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 14db5f70acdb..2d68dde89323 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -574,7 +574,7 @@ static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *buf, u32 length) /*-------------------------------------------------------------------------*/ /* Endpoint 0 OUT Transfer (PIO, OverBytes) */ -static int EP0_out_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) +static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) { u32 i; u32 iReadSize = 0; @@ -621,7 +621,7 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) /*-------------------------------------------------------------------------*/ /* Endpoint 0 IN Transfer (PIO, OverBytes) */ -static int EP0_in_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 iRemainSize) +static int ep0_in_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 iRemainSize) { u32 i; union usb_reg_access Temp32; @@ -724,7 +724,7 @@ static int _nbu2ss_ep0_in_transfer( if ((iRemainSize < sizeof(u32)) && (result != EP0_PACKETSIZE)) { pBuffer += result; - result += EP0_in_OverBytes(udc, pBuffer, iRemainSize); + result += ep0_in_overbytes(udc, pBuffer, iRemainSize); req->div_len = result; } @@ -765,7 +765,7 @@ static int _nbu2ss_ep0_out_transfer( pBuffer += result; iRemainSize -= result; - result = EP0_out_OverBytes(udc, pBuffer + result = ep0_out_overbytes(udc, pBuffer , min(iRemainSize, iRecvLength)); req->req.actual += result; } -- cgit v1.2.3-55-g7522 From 5a012f67cbcb202bf9bbde143e0fc927fcae971b Mon Sep 17 00:00:00 2001 From: Alexis Lothoré Date: Wed, 10 May 2017 19:39:44 +0200 Subject: staging: emxx_udc: Update local variable names Ensure that any any local variable use snake_case (many mixed upper/lower case) Signed-off-by: Alexis Lothoré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 248 ++++++++++++++++++------------------ 1 file changed, 124 insertions(+), 124 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 2d68dde89323..0e2392371e0e 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -577,18 +577,18 @@ static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *buf, u32 length) static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) { u32 i; - u32 iReadSize = 0; - union usb_reg_access Temp32; - union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf; + u32 i_read_size = 0; + union usb_reg_access temp_32; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)pBuf; if ((length > 0) && (length < sizeof(u32))) { - Temp32.dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); + temp_32.dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); for (i = 0 ; i < length ; i++) - pBuf32->byte.DATA[i] = Temp32.byte.DATA[i]; - iReadSize += length; + p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; + i_read_size += length; } - return iReadSize; + return i_read_size; } /*-------------------------------------------------------------------------*/ @@ -596,43 +596,43 @@ static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) { u32 i; - u32 iMaxLength = EP0_PACKETSIZE; - u32 iWordLength = 0; - u32 iWriteLength = 0; - union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf; + u32 i_max_length = EP0_PACKETSIZE; + u32 i_word_length = 0; + u32 i_write_length = 0; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)pBuf; /*------------------------------------------------------------*/ /* Transfer Length */ - if (iMaxLength < length) - iWordLength = iMaxLength / sizeof(u32); + if (i_max_length < length) + i_word_length = i_max_length / sizeof(u32); else - iWordLength = length / sizeof(u32); + i_word_length = length / sizeof(u32); /*------------------------------------------------------------*/ /* PIO */ - for (i = 0; i < iWordLength; i++) { - _nbu2ss_writel(&udc->p_regs->EP0_WRITE, pBuf32->dw); - pBuf32++; - iWriteLength += sizeof(u32); + for (i = 0; i < i_word_length; i++) { + _nbu2ss_writel(&udc->p_regs->EP0_WRITE, p_buf_32->dw); + p_buf_32++; + i_write_length += sizeof(u32); } - return iWriteLength; + return i_write_length; } /*-------------------------------------------------------------------------*/ /* Endpoint 0 IN Transfer (PIO, OverBytes) */ -static int ep0_in_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 iRemainSize) +static int ep0_in_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 i_remain_size) { u32 i; - union usb_reg_access Temp32; - union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf; + union usb_reg_access temp_32; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)pBuf; - if ((iRemainSize > 0) && (iRemainSize < sizeof(u32))) { - for (i = 0 ; i < iRemainSize ; i++) - Temp32.byte.DATA[i] = pBuf32->byte.DATA[i]; - _nbu2ss_ep_in_end(udc, 0, Temp32.dw, iRemainSize); + if ((i_remain_size > 0) && (i_remain_size < sizeof(u32))) { + for (i = 0 ; i < i_remain_size ; i++) + temp_32.byte.DATA[i] = p_buf_32->byte.DATA[i]; + _nbu2ss_ep_in_end(udc, 0, temp_32.dw, i_remain_size); - return iRemainSize; + return i_remain_size; } return 0; @@ -680,9 +680,9 @@ static int _nbu2ss_ep0_in_transfer( struct nbu2ss_req *req ) { - u8 *pBuffer; /* IN Data Buffer */ + u8 *p_buffer; /* IN Data Buffer */ u32 data; - u32 iRemainSize = 0; + u32 i_remain_size = 0; int result = 0; /*-------------------------------------------------------------*/ @@ -706,25 +706,25 @@ static int _nbu2ss_ep0_in_transfer( data &= ~(u32)EP0_INAK; _nbu2ss_writel(&udc->p_regs->EP0_CONTROL, data); - iRemainSize = req->req.length - req->req.actual; - pBuffer = (u8 *)req->req.buf; - pBuffer += req->req.actual; + i_remain_size = req->req.length - req->req.actual; + p_buffer = (u8 *)req->req.buf; + p_buffer += req->req.actual; /*-------------------------------------------------------------*/ /* Data transfer */ - result = EP0_in_PIO(udc, pBuffer, iRemainSize); + result = EP0_in_PIO(udc, p_buffer, i_remain_size); req->div_len = result; - iRemainSize -= result; + i_remain_size -= result; - if (iRemainSize == 0) { + if (i_remain_size == 0) { EP0_send_NULL(udc, FALSE); return result; } - if ((iRemainSize < sizeof(u32)) && (result != EP0_PACKETSIZE)) { - pBuffer += result; - result += ep0_in_overbytes(udc, pBuffer, iRemainSize); + if ((i_remain_size < sizeof(u32)) && (result != EP0_PACKETSIZE)) { + p_buffer += result; + result += ep0_in_overbytes(udc, p_buffer, i_remain_size); req->div_len = result; } @@ -737,40 +737,40 @@ static int _nbu2ss_ep0_out_transfer( struct nbu2ss_req *req ) { - u8 *pBuffer; - u32 iRemainSize; - u32 iRecvLength; + u8 *p_buffer; + u32 i_remain_size; + u32 i_recv_length; int result = 0; - int fRcvZero; + int f_rcv_zero; /*-------------------------------------------------------------*/ /* Receive data confirmation */ - iRecvLength = _nbu2ss_readl(&udc->p_regs->EP0_LENGTH) & EP0_LDATA; - if (iRecvLength != 0) { - fRcvZero = 0; + i_recv_length = _nbu2ss_readl(&udc->p_regs->EP0_LENGTH) & EP0_LDATA; + if (i_recv_length != 0) { + f_rcv_zero = 0; - iRemainSize = req->req.length - req->req.actual; - pBuffer = (u8 *)req->req.buf; - pBuffer += req->req.actual; + i_remain_size = req->req.length - req->req.actual; + p_buffer = (u8 *)req->req.buf; + p_buffer += req->req.actual; - result = ep0_out_pio(udc, pBuffer - , min(iRemainSize, iRecvLength)); + result = ep0_out_pio(udc, p_buffer + , min(i_remain_size, i_recv_length)); if (result < 0) return result; req->req.actual += result; - iRecvLength -= result; + i_recv_length -= result; - if ((iRecvLength > 0) && (iRecvLength < sizeof(u32))) { - pBuffer += result; - iRemainSize -= result; + if ((i_recv_length > 0) && (i_recv_length < sizeof(u32))) { + p_buffer += result; + i_remain_size -= result; - result = ep0_out_overbytes(udc, pBuffer - , min(iRemainSize, iRecvLength)); + result = ep0_out_overbytes(udc, p_buffer + , min(i_remain_size, i_recv_length)); req->req.actual += result; } } else { - fRcvZero = 1; + f_rcv_zero = 1; } /*-------------------------------------------------------------*/ @@ -795,9 +795,9 @@ static int _nbu2ss_ep0_out_transfer( return -EOVERFLOW; } - if (fRcvZero != 0) { - iRemainSize = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); - if (iRemainSize & EP0_ONAK) { + if (f_rcv_zero != 0) { + i_remain_size = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); + if (i_remain_size & EP0_ONAK) { /*---------------------------------------------------*/ /* NACK release */ _nbu2ss_bitclr(&udc->p_regs->EP0_CONTROL, EP0_ONAK); @@ -816,7 +816,7 @@ static int _nbu2ss_out_dma( u32 length ) { - dma_addr_t pBuffer; + dma_addr_t p_buffer; u32 mpkt; u32 lmpkt; u32 dmacnt; @@ -829,11 +829,11 @@ static int _nbu2ss_out_dma( return 1; /* DMA is forwarded */ req->dma_flag = TRUE; - pBuffer = req->req.dma; - pBuffer += req->req.actual; + p_buffer = req->req.dma; + p_buffer += req->req.actual; /* DMA Address */ - _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer); + _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)p_buffer); /* Number of transfer packets */ mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT; @@ -879,12 +879,12 @@ static int _nbu2ss_epn_out_pio( u32 length ) { - u8 *pBuffer; + u8 *p_buffer; u32 i; u32 data; - u32 iWordLength; - union usb_reg_access Temp32; - union usb_reg_access *pBuf32; + u32 i_word_length; + union usb_reg_access temp_32; + union usb_reg_access *p_buf_32; int result = 0; struct fc_regs *preg = udc->p_regs; @@ -894,28 +894,28 @@ static int _nbu2ss_epn_out_pio( if (length == 0) return 0; - pBuffer = (u8 *)req->req.buf; - pBuf32 = (union usb_reg_access *)(pBuffer + req->req.actual); + p_buffer = (u8 *)req->req.buf; + p_buf_32 = (union usb_reg_access *)(p_buffer + req->req.actual); - iWordLength = length / sizeof(u32); - if (iWordLength > 0) { + i_word_length = length / sizeof(u32); + if (i_word_length > 0) { /*---------------------------------------------------------*/ /* Copy of every four bytes */ - for (i = 0; i < iWordLength; i++) { - pBuf32->dw = + for (i = 0; i < i_word_length; i++) { + p_buf_32->dw = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); - pBuf32++; + p_buf_32++; } - result = iWordLength * sizeof(u32); + result = i_word_length * sizeof(u32); } data = length - result; if (data > 0) { /*---------------------------------------------------------*/ /* Copy of fraction byte */ - Temp32.dw = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); + temp_32.dw = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); for (i = 0 ; i < data ; i++) - pBuf32->byte.DATA[i] = Temp32.byte.DATA[i]; + p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; result += data; } @@ -938,7 +938,7 @@ static int _nbu2ss_epn_out_data( ) { u32 num; - u32 iBufSize; + u32 i_buf_size; int nret = 1; if (ep->epnum == 0) @@ -946,14 +946,14 @@ static int _nbu2ss_epn_out_data( num = ep->epnum - 1; - iBufSize = min((req->req.length - req->req.actual), data_size); + i_buf_size = min((req->req.length - req->req.actual), data_size); if ((ep->ep_type != USB_ENDPOINT_XFER_INT) && (req->req.dma != 0) && - (iBufSize >= sizeof(u32))) { - nret = _nbu2ss_out_dma(udc, req, num, iBufSize); + (i_buf_size >= sizeof(u32))) { + nret = _nbu2ss_out_dma(udc, req, num, i_buf_size); } else { - iBufSize = min_t(u32, iBufSize, ep->ep.maxpacket); - nret = _nbu2ss_epn_out_pio(udc, ep, req, iBufSize); + i_buf_size = min_t(u32, i_buf_size, ep->ep.maxpacket); + nret = _nbu2ss_epn_out_pio(udc, ep, req, i_buf_size); } return nret; @@ -967,7 +967,7 @@ static int _nbu2ss_epn_out_transfer( ) { u32 num; - u32 iRecvLength; + u32 i_recv_length; int result = 1; struct fc_regs *preg = udc->p_regs; @@ -978,13 +978,13 @@ static int _nbu2ss_epn_out_transfer( /*-------------------------------------------------------------*/ /* Receive Length */ - iRecvLength + i_recv_length = _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) & EPN_LDATA; - if (iRecvLength != 0) { - result = _nbu2ss_epn_out_data(udc, ep, req, iRecvLength); - if (iRecvLength < ep->ep.maxpacket) { - if (iRecvLength == result) { + if (i_recv_length != 0) { + result = _nbu2ss_epn_out_data(udc, ep, req, i_recv_length); + if (i_recv_length < ep->ep.maxpacket) { + if (i_recv_length == result) { req->req.actual += result; result = 0; } @@ -1024,11 +1024,11 @@ static int _nbu2ss_in_dma( u32 length ) { - dma_addr_t pBuffer; + dma_addr_t p_buffer; u32 mpkt; /* MaxPacketSize */ u32 lmpkt; /* Last Packet Data Size */ u32 dmacnt; /* IN Data Size */ - u32 iWriteLength; + u32 i_write_length; u32 data; int result = -EINVAL; struct fc_regs *preg = udc->p_regs; @@ -1046,15 +1046,15 @@ static int _nbu2ss_in_dma( mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT; if ((DMA_MAX_COUNT * mpkt) < length) - iWriteLength = DMA_MAX_COUNT * mpkt; + i_write_length = DMA_MAX_COUNT * mpkt; else - iWriteLength = length; + i_write_length = length; /*------------------------------------------------------------*/ /* Number of transmission packets */ - if (mpkt < iWriteLength) { - dmacnt = iWriteLength / mpkt; - lmpkt = (iWriteLength % mpkt) & ~(u32)0x3; + if (mpkt < i_write_length) { + dmacnt = i_write_length / mpkt; + lmpkt = (i_write_length % mpkt) & ~(u32)0x3; if (lmpkt != 0) dmacnt++; else @@ -1062,7 +1062,7 @@ static int _nbu2ss_in_dma( } else { dmacnt = 1; - lmpkt = iWriteLength & ~(u32)0x3; + lmpkt = i_write_length & ~(u32)0x3; } /* Packet setting */ @@ -1070,9 +1070,9 @@ static int _nbu2ss_in_dma( _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data); /* Address setting */ - pBuffer = req->req.dma; - pBuffer += req->req.actual; - _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer); + p_buffer = req->req.dma; + p_buffer += req->req.actual; + _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)p_buffer); /* Packet and DMA setting */ data = ((dmacnt & 0xff) << 16) | DCR1_EPN_REQEN; @@ -1085,7 +1085,7 @@ static int _nbu2ss_in_dma( /*DMA setting of EPC */ _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN); - result = iWriteLength & ~(u32)0x3; + result = i_write_length & ~(u32)0x3; req->div_len = result; return result; @@ -1099,12 +1099,12 @@ static int _nbu2ss_epn_in_pio( u32 length ) { - u8 *pBuffer; + u8 *p_buffer; u32 i; u32 data; - u32 iWordLength; - union usb_reg_access Temp32; - union usb_reg_access *pBuf32 = NULL; + u32 i_word_length; + union usb_reg_access temp_32; + union usb_reg_access *p_buf_32 = NULL; int result = 0; struct fc_regs *preg = udc->p_regs; @@ -1112,30 +1112,30 @@ static int _nbu2ss_epn_in_pio( return 1; /* DMA is forwarded */ if (length > 0) { - pBuffer = (u8 *)req->req.buf; - pBuf32 = (union usb_reg_access *)(pBuffer + req->req.actual); + p_buffer = (u8 *)req->req.buf; + p_buf_32 = (union usb_reg_access *)(p_buffer + req->req.actual); - iWordLength = length / sizeof(u32); - if (iWordLength > 0) { - for (i = 0; i < iWordLength; i++) { + i_word_length = length / sizeof(u32); + if (i_word_length > 0) { + for (i = 0; i < i_word_length; i++) { _nbu2ss_writel( &preg->EP_REGS[ep->epnum - 1].EP_WRITE - , pBuf32->dw + , p_buf_32->dw ); - pBuf32++; + p_buf_32++; } - result = iWordLength * sizeof(u32); + result = i_word_length * sizeof(u32); } } if (result != ep->ep.maxpacket) { data = length - result; - Temp32.dw = 0; + temp_32.dw = 0; for (i = 0 ; i < data ; i++) - Temp32.byte.DATA[i] = pBuf32->byte.DATA[i]; + temp_32.byte.DATA[i] = p_buf_32->byte.DATA[i]; - _nbu2ss_ep_in_end(udc, ep->epnum, Temp32.dw, data); + _nbu2ss_ep_in_end(udc, ep->epnum, temp_32.dw, data); result += data; } @@ -1179,7 +1179,7 @@ static int _nbu2ss_epn_in_transfer( ) { u32 num; - u32 iBufSize; + u32 i_buf_size; int result = 0; u32 status; @@ -1203,9 +1203,9 @@ static int _nbu2ss_epn_in_transfer( /*-------------------------------------------------------------*/ /* Start transfer */ - iBufSize = req->req.length - req->req.actual; - if (iBufSize > 0) - result = _nbu2ss_epn_in_data(udc, ep, req, iBufSize); + i_buf_size = req->req.length - req->req.actual; + if (i_buf_size > 0) + result = _nbu2ss_epn_in_data(udc, ep, req, i_buf_size); else if (req->req.length == 0) _nbu2ss_zero_len_pkt(udc, ep->epnum); @@ -1652,7 +1652,7 @@ static int std_req_set_address(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static int std_req_set_configuration(struct nbu2ss_udc *udc) { - u32 ConfigValue = (u32)(udc->ctrl.wValue & 0x00ff); + u32 config_value = (u32)(udc->ctrl.wValue & 0x00ff); if ((udc->ctrl.wIndex != 0x0000) || (udc->ctrl.wLength != 0x0000) || @@ -1660,9 +1660,9 @@ static int std_req_set_configuration(struct nbu2ss_udc *udc) return -EINVAL; } - udc->curr_config = ConfigValue; + udc->curr_config = config_value; - if (ConfigValue > 0) { + if (config_value > 0) { _nbu2ss_bitset(&udc->p_regs->USB_CONTROL, CONF); udc->devstate = USB_STATE_CONFIGURED; -- cgit v1.2.3-55-g7522 From e6b410c3e9d6c7e4a43682e59696f584bc973ba4 Mon Sep 17 00:00:00 2001 From: Alexis Lothoré Date: Wed, 10 May 2017 19:39:45 +0200 Subject: staging: emxx_udc: Update function parameters name Ensure that function parameters use snake_case (some mixed upper/lower case) Signed-off-by: Alexis Lothoré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 0e2392371e0e..84bdfebf0d48 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -574,12 +574,12 @@ static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *buf, u32 length) /*-------------------------------------------------------------------------*/ /* Endpoint 0 OUT Transfer (PIO, OverBytes) */ -static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) +static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) { u32 i; u32 i_read_size = 0; union usb_reg_access temp_32; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)pBuf; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; if ((length > 0) && (length < sizeof(u32))) { temp_32.dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); @@ -593,13 +593,13 @@ static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) /*-------------------------------------------------------------------------*/ /* Endpoint 0 IN Transfer (PIO) */ -static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) +static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) { u32 i; u32 i_max_length = EP0_PACKETSIZE; u32 i_word_length = 0; u32 i_write_length = 0; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)pBuf; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; /*------------------------------------------------------------*/ /* Transfer Length */ @@ -621,11 +621,11 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) /*-------------------------------------------------------------------------*/ /* Endpoint 0 IN Transfer (PIO, OverBytes) */ -static int ep0_in_overbytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 i_remain_size) +static int ep0_in_overbytes(struct nbu2ss_udc *udc, u8 *p_buf, u32 i_remain_size) { u32 i; union usb_reg_access temp_32; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)pBuf; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; if ((i_remain_size > 0) && (i_remain_size < sizeof(u32))) { for (i = 0 ; i < i_remain_size ; i++) -- cgit v1.2.3-55-g7522 From aa53aea933af9b6cba2818733ac66c068d9743bd Mon Sep 17 00:00:00 2001 From: Alexis Lothoré Date: Wed, 10 May 2017 19:39:46 +0200 Subject: staging: emxx_udc: Break long lines Make sure to break long lines to 80 Signed-off-by: Alexis Lothoré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 84bdfebf0d48..bb010cb98a1c 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -621,7 +621,9 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) /*-------------------------------------------------------------------------*/ /* Endpoint 0 IN Transfer (PIO, OverBytes) */ -static int ep0_in_overbytes(struct nbu2ss_udc *udc, u8 *p_buf, u32 i_remain_size) +static int ep0_in_overbytes(struct nbu2ss_udc *udc, + u8 *p_buf, + u32 i_remain_size) { u32 i; union usb_reg_access temp_32; @@ -913,7 +915,8 @@ static int _nbu2ss_epn_out_pio( if (data > 0) { /*---------------------------------------------------------*/ /* Copy of fraction byte */ - temp_32.dw = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); + temp_32.dw = + _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); for (i = 0 ; i < data ; i++) p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; result += data; @@ -2652,7 +2655,9 @@ static int nbu2ss_ep_queue( } req = container_of(_req, struct nbu2ss_req, req); - if (unlikely(!_req->complete || !_req->buf || !list_empty(&req->queue))) { + if (unlikely(!_req->complete || + !_req->buf || + !list_empty(&req->queue))) { if (!_req->complete) pr_err("udc: %s --- !_req->complete\n", __func__); -- cgit v1.2.3-55-g7522 From 2c513789b42e3a9447a2fb10a3287bf90f5b1c1f Mon Sep 17 00:00:00 2001 From: Alexis Lothoré Date: Wed, 10 May 2017 19:39:47 +0200 Subject: staging: emxx_udc: Update "reserved" registers name Ensure that "Reserved" members of registers mapping structure do not mix upper/lower case Signed-off-by: Alexis Lothoré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index 332332dd58e1..928d531a5115 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -471,7 +471,7 @@ struct fc_regs { u32 USB_ADDRESS; /* (0x0008) USB Address */ u32 UTMI_CHARACTER_1; /* (0x000C) UTMI Setting */ u32 TEST_CONTROL; /* (0x0010) TEST Control */ - u32 Reserved_14; /* (0x0014) Reserved */ + u32 reserved_14; /* (0x0014) Reserved */ u32 SETUP_DATA0; /* (0x0018) Setup Data0 */ u32 SETUP_DATA1; /* (0x001C) Setup Data1 */ u32 USB_INT_STA; /* (0x0020) USB Interrupt Status */ @@ -485,7 +485,7 @@ struct fc_regs { struct ep_regs EP_REGS[REG_EP_NUM]; /* Endpoint Register */ - u8 Reserved220[0x1000 - 0x220]; /* (0x0220:0x0FFF) Reserved */ + u8 reserved_220[0x1000 - 0x220]; /* (0x0220:0x0FFF) Reserved */ u32 AHBSCTR; /* (0x1000) AHBSCTR */ u32 AHBMCTR; /* (0x1004) AHBMCTR */ @@ -494,16 +494,16 @@ struct fc_regs { u32 EPCTR; /* (0x1010) EPCTR */ u32 USBF_EPTEST; /* (0x1014) USBF_EPTEST */ - u8 Reserved1018[0x20 - 0x18]; /* (0x1018:0x101F) Reserved */ + u8 reserved_1018[0x20 - 0x18]; /* (0x1018:0x101F) Reserved */ u32 USBSSVER; /* (0x1020) USBSSVER */ u32 USBSSCONF; /* (0x1024) USBSSCONF */ - u8 Reserved1028[0x110 - 0x28]; /* (0x1028:0x110F) Reserved */ + u8 reserved_1028[0x110 - 0x28]; /* (0x1028:0x110F) Reserved */ struct ep_dcr EP_DCR[REG_EP_NUM]; /* */ - u8 Reserved1200[0x1000 - 0x200]; /* Reserved */ + u8 reserved_1200[0x1000 - 0x200]; /* Reserved */ } __aligned(32); #define EP0_PACKETSIZE 64 -- cgit v1.2.3-55-g7522 From 52929b038baa321022924a3a25431e8fbfedd367 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 10 May 2017 14:29:17 +1200 Subject: Staging: rtl8192u - changed include of asm/io.h Changed include of to be Complies, but I don't have hardware. Found using checkpatch. Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index e702afb5a70e..4c7a5e3d3e5e 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "ieee80211/ieee80211.h" #define RTL8192U -- cgit v1.2.3-55-g7522 From 2fc0b7dd1d8fc524102c5e3d8f2254f2ef9d8d0c Mon Sep 17 00:00:00 2001 From: Juliana Rodrigues Date: Tue, 9 May 2017 23:20:10 -0300 Subject: staging: rtl8188eu: core: removed comparison to NULL Removed comparison to NULL fixing checkpatch issues. Signed-off-by: Juliana Rodrigues Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 519b4d3584a2..909406b2b8f4 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -991,7 +991,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) } break; } - if ((p == NULL) || (ie_len == 0)) + if ((!p) || (ie_len == 0)) break; } @@ -1015,7 +1015,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) break; } - if ((p == NULL) || (ie_len == 0)) + if ((!p) || (ie_len == 0)) break; } } @@ -1097,7 +1097,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress); if (!psta) { psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress); - if (psta == NULL) + if (!psta) return _FAIL; } @@ -1268,12 +1268,12 @@ static void update_bcn_wps_ie(struct adapter *padapter) DBG_88E("%s\n", __func__); pwps_ie_src = pmlmepriv->wps_beacon_ie; - if (pwps_ie_src == NULL) + if (!pwps_ie_src) return; pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen); - if (pwps_ie == NULL || wps_ielen == 0) + if (!pwps_ie || wps_ielen == 0) return; wps_offset = (uint)(pwps_ie-ie); -- cgit v1.2.3-55-g7522 From a974fb376de2298a9421932c216f00239170dfd0 Mon Sep 17 00:00:00 2001 From: Salvatore Benedetto Date: Sun, 7 May 2017 14:18:17 +0100 Subject: staging: vt6656: rtxt.c Fix PARENTHESIS_ALIGNMENT type errors Fix all PARENTHESIS_ALIGNMENT type errors reported by checkpatch in rtxt.c Signed-off-by: Salvatore Benedetto Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rxtx.c | 70 +++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 33 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 63413492e61d..1b87c080644b 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -114,7 +114,7 @@ static __le16 vnt_time_stamp_off(struct vnt_private *priv, u16 rate) } static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, - u32 frame_length, u16 rate, int need_ack) + u32 frame_length, u16 rate, int need_ack) { u32 data_time, ack_time; @@ -135,14 +135,15 @@ static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, } static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type, - u32 frame_length, u16 rate, int need_ack) + u32 frame_length, u16 rate, int need_ack) { return cpu_to_le16((u16)vnt_get_rsvtime(priv, pkt_type, frame_length, rate, need_ack)); } -static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, - u8 rsv_type, u8 pkt_type, u32 frame_length, u16 current_rate) +static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, u8 rsv_type, + u8 pkt_type, u32 frame_length, + u16 current_rate) { u32 rrv_time, rts_time, cts_time, ack_time, data_time; @@ -152,13 +153,14 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, frame_length, current_rate); if (rsv_type == 0) { - rts_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 20, priv->top_cck_basic_rate); + rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, + 20, priv->top_cck_basic_rate); cts_time = ack_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, priv->top_cck_basic_rate); + pkt_type, 14, + priv->top_cck_basic_rate); } else if (rsv_type == 1) { - rts_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 20, priv->top_cck_basic_rate); + rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, + 20, priv->top_cck_basic_rate); cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 14, priv->top_cck_basic_rate); ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, @@ -184,18 +186,20 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, return cpu_to_le16((u16)rrv_time); } -static __le16 vnt_get_duration_le(struct vnt_private *priv, - u8 pkt_type, int need_ack) +static __le16 vnt_get_duration_le(struct vnt_private *priv, u8 pkt_type, + int need_ack) { u32 ack_time = 0; if (need_ack) { if (pkt_type == PK_TYPE_11B) ack_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, priv->top_cck_basic_rate); + pkt_type, 14, + priv->top_cck_basic_rate); else ack_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, priv->top_ofdm_basic_rate); + pkt_type, 14, + priv->top_ofdm_basic_rate); return cpu_to_le16((u16)(priv->sifs + ack_time)); } @@ -216,8 +220,8 @@ static __le16 vnt_get_rtscts_duration_le(struct vnt_usb_send_context *context, case RTSDUR_BA: case RTSDUR_BA_F0: case RTSDUR_BA_F1: - cts_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, priv->top_cck_basic_rate); + cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, + 14, priv->top_cck_basic_rate); dur_time = cts_time + 2 * priv->sifs + vnt_get_rsvtime(priv, pkt_type, frame_length, rate, need_ack); @@ -226,8 +230,8 @@ static __le16 vnt_get_rtscts_duration_le(struct vnt_usb_send_context *context, case RTSDUR_AA: case RTSDUR_AA_F0: case RTSDUR_AA_F1: - cts_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, priv->top_ofdm_basic_rate); + cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, + 14, priv->top_ofdm_basic_rate); dur_time = cts_time + 2 * priv->sifs + vnt_get_rsvtime(priv, pkt_type, frame_length, rate, need_ack); @@ -248,7 +252,7 @@ static __le16 vnt_get_rtscts_duration_le(struct vnt_usb_send_context *context, } static u16 vnt_mac_hdr_pos(struct vnt_usb_send_context *tx_context, - struct ieee80211_hdr *hdr) + struct ieee80211_hdr *hdr) { u8 *head = tx_context->data + offsetof(struct vnt_tx_buffer, fifo_head); u8 *hdr_pos = (u8 *)hdr; @@ -274,7 +278,7 @@ static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context, /* Get SignalField,ServiceField,Length */ vnt_get_phy_field(priv, frame_len, rate, tx_context->pkt_type, &buf->a); vnt_get_phy_field(priv, frame_len, priv->top_cck_basic_rate, - PK_TYPE_11B, &buf->b); + PK_TYPE_11B, &buf->b); /* Get Duration and TimeStamp */ if (ieee80211_is_pspoll(hdr->frame_control)) { @@ -310,7 +314,7 @@ static u16 vnt_rxtx_datahead_g_fb(struct vnt_usb_send_context *tx_context, vnt_get_phy_field(priv, frame_len, rate, tx_context->pkt_type, &buf->a); vnt_get_phy_field(priv, frame_len, priv->top_cck_basic_rate, - PK_TYPE_11B, &buf->b); + PK_TYPE_11B, &buf->b); /* Get Duration and TimeStamp */ buf->duration_a = vnt_get_duration_le(priv, tx_context->pkt_type, @@ -387,7 +391,7 @@ static u16 vnt_rxtx_datahead_ab(struct vnt_usb_send_context *tx_context, } static int vnt_fill_ieee80211_rts(struct vnt_usb_send_context *tx_context, - struct ieee80211_rts *rts, __le16 duration) + struct ieee80211_rts *rts, __le16 duration) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx_context->skb->data; @@ -499,8 +503,8 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context, u16 current_rate = tx_context->tx_rate; u16 rts_frame_len = 20; - vnt_get_phy_field(priv, rts_frame_len, - priv->top_ofdm_basic_rate, tx_context->pkt_type, &buf->a); + vnt_get_phy_field(priv, rts_frame_len, priv->top_ofdm_basic_rate, + tx_context->pkt_type, &buf->a); buf->duration = vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA, tx_context->pkt_type, @@ -683,9 +687,9 @@ static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context, } static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context, - struct vnt_tx_buffer *tx_buffer, - struct vnt_mic_hdr **mic_hdr, u32 need_mic, - bool need_rts) + struct vnt_tx_buffer *tx_buffer, + struct vnt_mic_hdr **mic_hdr, u32 need_mic, + bool need_rts) { if (tx_context->pkt_type == PK_TYPE_11GB || @@ -712,8 +716,9 @@ static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context, } static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context, - u8 *key_buffer, struct ieee80211_key_conf *tx_key, struct sk_buff *skb, - u16 payload_len, struct vnt_mic_hdr *mic_hdr) + u8 *key_buffer, struct ieee80211_key_conf *tx_key, + struct sk_buff *skb, u16 payload_len, + struct vnt_mic_hdr *mic_hdr) { struct ieee80211_hdr *hdr = tx_context->hdr; u64 pn64; @@ -807,7 +812,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) current_rate = rate->hw_value; if (priv->current_rate != current_rate && - !(priv->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) { + !(priv->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) { priv->current_rate = current_rate; vnt_schedule_command(priv, WLAN_CMD_SETPOWER); } @@ -964,7 +969,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) tx_key = info->control.hw_key; if (tx_key->keylen > 0) vnt_fill_txkey(tx_context, tx_buffer_head->tx_key, - tx_key, skb, tx_body_size, mic_hdr); + tx_key, skb, tx_body_size, mic_hdr); } priv->seq_counter = (le16_to_cpu(hdr->seq_ctrl) & @@ -991,8 +996,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) return 0; } -static int vnt_beacon_xmit(struct vnt_private *priv, - struct sk_buff *skb) +static int vnt_beacon_xmit(struct vnt_private *priv, struct sk_buff *skb) { struct vnt_beacon_buffer *beacon_buffer; struct vnt_tx_short_buf_head *short_head; @@ -1101,7 +1105,7 @@ int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif) } int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *conf) + struct ieee80211_bss_conf *conf) { vnt_mac_reg_bits_off(priv, MAC_REG_TCR, TCR_AUTOBCNTX); -- cgit v1.2.3-55-g7522 From c27fbc9237cde91e8eb75220119cd4c2bbc7082a Mon Sep 17 00:00:00 2001 From: Tobin C. Harding Date: Mon, 8 May 2017 14:29:42 +1000 Subject: staging: ks7010: eap, change unsigned short to __be16 Sparse emits warning: cast to restricted __be16. EAP header uses network byte order. The structures used to describe it should use __beXX data types. Change data type unsigned short -> __be16. Signed-off-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/eap_packet.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/eap_packet.h b/drivers/staging/ks7010/eap_packet.h index b2d25ef1cd6b..ae03f7477324 100644 --- a/drivers/staging/ks7010/eap_packet.h +++ b/drivers/staging/ks7010/eap_packet.h @@ -18,7 +18,7 @@ struct ether_hdr { unsigned char h_source_snap; unsigned char h_command; unsigned char h_vendor_id[3]; - unsigned short h_proto; /* packet type ID field */ + __be16 h_proto; /* packet type ID field */ #define ETHER_PROTOCOL_TYPE_EAP 0x888e #define ETHER_PROTOCOL_TYPE_IP 0x0800 #define ETHER_PROTOCOL_TYPE_ARP 0x0806 @@ -91,7 +91,7 @@ struct ieee802_1x_eapol_key { struct wpa_eapol_key { unsigned char type; - unsigned short key_info; + __be16 key_info; unsigned short key_length; unsigned char replay_counter[WPA_REPLAY_COUNTER_LEN]; unsigned char key_nonce[WPA_NONCE_LEN]; -- cgit v1.2.3-55-g7522 From 683356d16b0f5f97058e2377590bf365fdc97d79 Mon Sep 17 00:00:00 2001 From: Tobin C. Harding Date: Mon, 8 May 2017 14:29:43 +1000 Subject: staging: ks7010: hostif, u16 data types to __le16 Target device is little endian. Host interface data structures used for building frames to pass to target device should use little endian data types. All u16 structure members in ks_hostif.h need to be changed to __le16, Sparse can then be used to make sure we update all code that touches these data. Change all u16 data types in host interface structures to be __le16. Update all code that touches modified data types. Check using Sparse. Signed-off-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 14 ++-- drivers/staging/ks7010/ks_hostif.h | 130 ++++++++++++++++++------------------- 2 files changed, 72 insertions(+), 72 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index caf2551bc087..cf9b22feb451 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -147,7 +147,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info_t *ap_info) /* noise */ ap->noise = ap_info->noise; /* capability */ - ap->capability = ap_info->capability; + ap->capability = le16_to_cpu(ap_info->capability); /* rsn */ if ((ap_info->rsn_mode & RSN_MODE_WPA2) && (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) { @@ -233,12 +233,12 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, /* noise */ ap->noise = ap_info->noise; /* capability */ - ap->capability = ap_info->capability; + ap->capability = le16_to_cpu(ap_info->capability); /* channel */ ap->channel = ap_info->ch_info; bp = ap_info->body; - bsize = ap_info->body_size; + bsize = le16_to_cpu(ap_info->body_size); offset = 0; while (bsize > offset) { @@ -948,18 +948,18 @@ void hostif_associate_indication(struct ks_wlan_private *priv) wrqu.data.length += sizeof(associnfo_leader0) - 1; pbuf += sizeof(associnfo_leader0) - 1; - for (i = 0; i < assoc_req->req_ies_size; i++) + for (i = 0; i < le16_to_cpu(assoc_req->req_ies_size); i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); - wrqu.data.length += (assoc_req->req_ies_size) * 2; + wrqu.data.length += (le16_to_cpu(assoc_req->req_ies_size)) * 2; memcpy(pbuf, associnfo_leader1, sizeof(associnfo_leader1) - 1); wrqu.data.length += sizeof(associnfo_leader1) - 1; pbuf += sizeof(associnfo_leader1) - 1; pb += assoc_req->req_ies_size; - for (i = 0; i < assoc_resp->resp_ies_size; i++) + for (i = 0; i < le16_to_cpu(assoc_resp->resp_ies_size); i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); - wrqu.data.length += (assoc_resp->resp_ies_size) * 2; + wrqu.data.length += (le16_to_cpu(assoc_resp->resp_ies_size)) * 2; pbuf += sprintf(pbuf, ")"); wrqu.data.length += 1; diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 538600f9e376..35d51fea46af 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -68,21 +68,21 @@ struct hostif_hdr { struct hostif_data_request_t { struct hostif_hdr header; - u16 auth_type; + __le16 auth_type; #define TYPE_DATA 0x0000 #define TYPE_AUTH 0x0001 - u16 reserved; + __le16 reserved; u8 data[0]; } __packed; struct hostif_data_indication_t { struct hostif_hdr header; - u16 auth_type; + __le16 auth_type; /* #define TYPE_DATA 0x0000 */ #define TYPE_PMK1 0x0001 #define TYPE_GMK1 0x0002 #define TYPE_GMK2 0x0003 - u16 reserved; + __le16 reserved; u8 data[0]; } __packed; @@ -147,8 +147,8 @@ struct hostif_mib_get_request_t { } __packed; struct hostif_mib_value_t { - u16 size; - u16 type; + __le16 size; + __le16 type; #define MIB_VALUE_TYPE_NULL 0 #define MIB_VALUE_TYPE_INT 1 #define MIB_VALUE_TYPE_BOOL 2 @@ -207,12 +207,12 @@ enum power_mgmt_mode_type { struct hostif_power_mgmt_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; struct hostif_start_request_t { struct hostif_hdr header; - u16 mode; + __le16 mode; #define MODE_PSEUDO_ADHOC 0 #define MODE_INFRASTRUCTURE 1 #define MODE_AP 2 /* not used */ @@ -221,7 +221,7 @@ struct hostif_start_request_t { struct hostif_start_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; #define SSID_MAX_SIZE 32 @@ -239,7 +239,7 @@ struct rate_set8_t { } __packed; struct fh_parms_t { - u16 dwell_time; + __le16 dwell_time; u8 hop_set; u8 hop_pattern; u8 hop_index; @@ -252,12 +252,12 @@ struct ds_parms_t { struct cf_parms_t { u8 count; u8 period; - u16 max_duration; - u16 dur_remaining; + __le16 max_duration; + __le16 dur_remaining; } __packed; struct ibss_parms_t { - u16 atim_window; + __le16 atim_window; } __packed; struct rsn_t { @@ -282,8 +282,8 @@ struct ap_info_t { u8 sq; /* +07 */ u8 noise; /* +08 */ u8 pad0; /* +09 */ - u16 beacon_period; /* +10 */ - u16 capability; /* +12 */ + __le16 beacon_period; /* +10 */ + __le16 capability; /* +12 */ #define BSS_CAP_ESS BIT(0) #define BSS_CAP_IBSS BIT(1) #define BSS_CAP_CF_POLABLE BIT(2) @@ -298,7 +298,7 @@ struct ap_info_t { u8 ch_info; /* +15 */ #define FRAME_TYPE_BEACON 0x80 #define FRAME_TYPE_PROBE_RESP 0x50 - u16 body_size; /* +16 */ + __le16 body_size; /* +16 */ u8 body[1024]; /* +18 */ /* +1032 */ } __packed; @@ -309,8 +309,8 @@ struct link_ap_info_t { u8 sq; /* +07 */ u8 noise; /* +08 */ u8 pad0; /* +09 */ - u16 beacon_period; /* +10 */ - u16 capability; /* +12 */ + __le16 beacon_period; /* +10 */ + __le16 capability; /* +12 */ struct rate_set8_t rate_set; /* +14 */ struct fh_parms_t fh_parameter; /* +24 */ struct ds_parms_t ds_parameter; /* +29 */ @@ -332,7 +332,7 @@ struct link_ap_info_t { struct hostif_connect_indication_t { struct hostif_hdr header; - u16 connect_code; + __le16 connect_code; #define RESULT_CONNECT 0 #define RESULT_DISCONNECT 1 struct link_ap_info_t link_ap_info; @@ -344,7 +344,7 @@ struct hostif_stop_request_t { struct hostif_stop_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; /** @@ -356,23 +356,23 @@ struct hostif_stop_confirm_t { */ struct hostif_ps_adhoc_set_request_t { struct hostif_hdr header; - u16 phy_type; + __le16 phy_type; #define D_11B_ONLY_MODE 0 #define D_11G_ONLY_MODE 1 #define D_11BG_COMPATIBLE_MODE 2 #define D_11A_ONLY_MODE 3 - u16 cts_mode; + __le16 cts_mode; #define CTS_MODE_FALSE 0 #define CTS_MODE_TRUE 1 - u16 channel; + __le16 channel; struct rate_set16_t rate_set; - u16 capability; - u16 scan_type; + __le16 capability; + __le16 scan_type; } __packed; struct hostif_ps_adhoc_set_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; /** @@ -384,17 +384,17 @@ struct hostif_ps_adhoc_set_confirm_t { */ struct hostif_infrastructure_set_request_t { struct hostif_hdr header; - u16 phy_type; - u16 cts_mode; + __le16 phy_type; + __le16 cts_mode; struct rate_set16_t rate_set; struct ssid_t ssid; - u16 capability; - u16 beacon_lost_count; - u16 auth_type; + __le16 capability; + __le16 beacon_lost_count; + __le16 auth_type; #define AUTH_TYPE_OPEN_SYSTEM 0 #define AUTH_TYPE_SHARED_KEY 1 struct channel_list_t channel_list; - u16 scan_type; + __le16 scan_type; } __packed; /** @@ -406,23 +406,23 @@ struct hostif_infrastructure_set_request_t { */ struct hostif_infrastructure_set2_request_t { struct hostif_hdr header; - u16 phy_type; - u16 cts_mode; + __le16 phy_type; + __le16 cts_mode; struct rate_set16_t rate_set; struct ssid_t ssid; - u16 capability; - u16 beacon_lost_count; - u16 auth_type; + __le16 capability; + __le16 beacon_lost_count; + __le16 auth_type; #define AUTH_TYPE_OPEN_SYSTEM 0 #define AUTH_TYPE_SHARED_KEY 1 struct channel_list_t channel_list; - u16 scan_type; + __le16 scan_type; u8 bssid[ETH_ALEN]; } __packed; struct hostif_infrastructure_set_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; /** @@ -434,13 +434,13 @@ struct hostif_infrastructure_set_confirm_t { */ struct hostif_adhoc_set_request_t { struct hostif_hdr header; - u16 phy_type; - u16 cts_mode; - u16 channel; + __le16 phy_type; + __le16 cts_mode; + __le16 channel; struct rate_set16_t rate_set; struct ssid_t ssid; - u16 capability; - u16 scan_type; + __le16 capability; + __le16 scan_type; } __packed; /** @@ -452,20 +452,20 @@ struct hostif_adhoc_set_request_t { */ struct hostif_adhoc_set2_request_t { struct hostif_hdr header; - u16 phy_type; - u16 cts_mode; - u16 reserved; + __le16 phy_type; + __le16 cts_mode; + __le16 reserved; struct rate_set16_t rate_set; struct ssid_t ssid; - u16 capability; - u16 scan_type; + __le16 capability; + __le16 scan_type; struct channel_list_t channel_list; u8 bssid[ETH_ALEN]; } __packed; struct hostif_adhoc_set_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; struct last_associate_t { @@ -478,10 +478,10 @@ struct association_request_t { #define FRAME_TYPE_ASSOC_REQ 0x00 #define FRAME_TYPE_REASSOC_REQ 0x20 u8 pad; - u16 capability; - u16 listen_interval; + __le16 capability; + __le16 listen_interval; u8 ap_address[6]; - u16 req_ies_size; + __le16 req_ies_size; } __packed; struct association_response_t { @@ -489,10 +489,10 @@ struct association_response_t { #define FRAME_TYPE_ASSOC_RESP 0x10 #define FRAME_TYPE_REASSOC_RESP 0x30 u8 pad; - u16 capability; - u16 status; - u16 association_id; - u16 resp_ies_size; + __le16 capability; + __le16 status; + __le16 association_id; + __le16 resp_ies_size; } __packed; struct hostif_associate_indication_t { @@ -517,16 +517,16 @@ struct hostif_bss_scan_request_t { struct hostif_bss_scan_confirm_t { struct hostif_hdr header; - u16 result_code; - u16 reserved; + __le16 result_code; + __le16 reserved; } __packed; struct hostif_phy_information_request_t { struct hostif_hdr header; - u16 type; + __le16 type; #define NORMAL_TYPE 0 #define TIME_TYPE 1 - u16 time; /* unit 100ms */ + __le16 time; /* unit 100ms */ } __packed; struct hostif_phy_information_confirm_t { @@ -552,18 +552,18 @@ struct hostif_sleep_request_t { struct hostif_sleep_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; struct hostif_mic_failure_request_t { struct hostif_hdr header; - u16 failure_count; - u16 timer; + __le16 failure_count; + __le16 timer; } __packed; struct hostif_mic_failure_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; #define BASIC_RATE 0x80 -- cgit v1.2.3-55-g7522 From 338dbc1ed42247f6426745f515802552185279ef Mon Sep 17 00:00:00 2001 From: Tobin C. Harding Date: Mon, 8 May 2017 14:29:44 +1000 Subject: staging: ks7010: hostif, u32 data types to __le32 Target device is little endian. Host interface data structures used for building frames to pass to target device should use little endian data types. All u32 structure members in ks_hostif.h need to be changed to __le32. Change all u16 data types in host interface structures to be __le32. Signed-off-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 35d51fea46af..45e3a01b0b6b 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -143,7 +143,7 @@ struct channel_list_t { struct hostif_mib_get_request_t { struct hostif_hdr header; - u32 mib_attribute; + __le32 mib_attribute; } __packed; struct hostif_mib_value_t { @@ -159,36 +159,36 @@ struct hostif_mib_value_t { struct hostif_mib_get_confirm_t { struct hostif_hdr header; - u32 mib_status; + __le32 mib_status; #define MIB_SUCCESS 0 #define MIB_INVALID 1 #define MIB_READ_ONLY 2 #define MIB_WRITE_ONLY 3 - u32 mib_attribute; + __le32 mib_attribute; struct hostif_mib_value_t mib_value; } __packed; struct hostif_mib_set_request_t { struct hostif_hdr header; - u32 mib_attribute; + __le32 mib_attribute; struct hostif_mib_value_t mib_value; } __packed; struct hostif_mib_set_confirm_t { struct hostif_hdr header; - u32 mib_status; - u32 mib_attribute; + __le32 mib_status; + __le32 mib_attribute; } __packed; struct hostif_power_mgmt_request_t { struct hostif_hdr header; - u32 mode; + __le32 mode; #define POWER_ACTIVE 1 #define POWER_SAVE 2 - u32 wake_up; + __le32 wake_up; #define SLEEP_FALSE 0 #define SLEEP_TRUE 1 /* not used */ - u32 receiveDTIMs; + __le32 receiveDTIMs; #define DTIM_FALSE 0 #define DTIM_TRUE 1 } __packed; @@ -509,8 +509,8 @@ struct hostif_bss_scan_request_t { #define ACTIVE_SCAN 0 #define PASSIVE_SCAN 1 u8 pad[3]; - u32 ch_time_min; - u32 ch_time_max; + __le32 ch_time_min; + __le32 ch_time_max; struct channel_list_t channel_list; struct ssid_t ssid; } __packed; @@ -535,10 +535,10 @@ struct hostif_phy_information_confirm_t { u8 sq; u8 noise; u8 link_speed; - u32 tx_frame; - u32 rx_frame; - u32 tx_error; - u32 rx_error; + __le32 tx_frame; + __le32 rx_frame; + __le32 tx_error; + __le32 rx_error; } __packed; enum sleep_mode_type { -- cgit v1.2.3-55-g7522 From 92abe42b3534203ab691f92ed71af766d54a8a38 Mon Sep 17 00:00:00 2001 From: Jaya Durga Date: Sun, 7 May 2017 23:10:14 +0530 Subject: Staging: rtl8712: ieee80211: fixed camelcase coding style issue Fixed coding style issue Signed-off-by: Jaya Durga Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/ieee80211.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c index 0689f4537b94..33e82a9dd462 100644 --- a/drivers/staging/rtl8712/ieee80211.c +++ b/drivers/staging/rtl8712/ieee80211.c @@ -166,7 +166,7 @@ static uint r8712_get_rateset_len(u8 *rateset) int r8712_generate_ie(struct registry_priv *pregistrypriv) { - int sz = 0, rateLen; + int sz = 0, rate_len; struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network; u8 *ie = pdev_network->IEs; @@ -191,15 +191,15 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv) pdev_network->Ssid.Ssid, &sz); /*supported rates*/ set_supported_rate(pdev_network->rates, pregistrypriv->wireless_mode); - rateLen = r8712_get_rateset_len(pdev_network->rates); - if (rateLen > 8) { + rate_len = r8712_get_rateset_len(pdev_network->rates); + if (rate_len > 8) { ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_, 8, pdev_network->rates, &sz); - ie = r8712_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), + ie = r8712_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (pdev_network->rates + 8), &sz); } else { ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_, - rateLen, pdev_network->rates, &sz); + rate_len, pdev_network->rates, &sz); } /*DS parameter set*/ ie = r8712_set_ie(ie, _DSSET_IE_, 1, -- cgit v1.2.3-55-g7522 From 9bbf84e6041fb0d7f67208ec8557473ffcd7157c Mon Sep 17 00:00:00 2001 From: Anton Bondarenko Date: Tue, 9 May 2017 01:33:15 +0200 Subject: staging: octeon-usb: use correct function for hcd cleanup Use usb_put_hdc to release hdc allocated by usb_create_hcd. This is needed to handle sub-allocations and HCD sharing correctly. Signed-off-by: Anton Bondarenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 9a7858a300fd..068aece25d37 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -3659,14 +3659,14 @@ static int octeon_usb_probe(struct platform_device *pdev) status = cvmx_usb_initialize(dev, usb); if (status) { dev_dbg(dev, "USB initialization failed with %d\n", status); - kfree(hcd); + usb_put_hcd(hcd); return -1; } status = usb_add_hcd(hcd, irq, 0); if (status) { dev_dbg(dev, "USB add HCD failed with %d\n", status); - kfree(hcd); + usb_put_hcd(hcd); return -1; } device_wakeup_enable(hcd->self.controller); @@ -3691,7 +3691,7 @@ static int octeon_usb_remove(struct platform_device *pdev) if (status) dev_dbg(dev, "USB shutdown failed with %d\n", status); - kfree(hcd); + usb_put_hcd(hcd); return 0; } -- cgit v1.2.3-55-g7522 From dea20579a69ab68cdca6adf79bb7c0c162eb9b72 Mon Sep 17 00:00:00 2001 From: Andrea della Porta Date: Sat, 29 Apr 2017 07:30:23 +0100 Subject: staging: wlan-ng: prism2mgmt.c: fixed a double endian conversion before calling hfa384x_drvr_setconfig16, also fixes relative sparse warning staging: wlan-ng: prism2mgmt.c: This patches fixes a double endian conversion. cpu_to_le16() was called twice first in prism2mgmt_scan and again inside hfa384x_drvr_setconfig16() for the same variable, hence it was swapped twice. Incidentally, it also fixed the following sparse warning: drivers/staging/wlan-ng/prism2mgmt.c:173:30: warning: incorrect type in assignment (different base types) drivers/staging/wlan-ng/prism2mgmt.c:173:30: expected unsigned short [unsigned] [usertype] word drivers/staging/wlan-ng/prism2mgmt.c:173:30: got restricted __le16 [usertype] Unfortunately, only compile tested. Signed-off-by: Andrea della Porta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c index e23a0d0e7b09..f4d6e4849987 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.c +++ b/drivers/staging/wlan-ng/prism2mgmt.c @@ -170,7 +170,7 @@ int prism2mgmt_scan(struct wlandevice *wlandev, void *msgp) hw->ident_sta_fw.variant) > HFA384x_FIRMWARE_VERSION(1, 5, 0)) { if (msg->scantype.data != P80211ENUM_scantype_active) - word = cpu_to_le16(msg->maxchanneltime.data); + word = msg->maxchanneltime.data; else word = 0; -- cgit v1.2.3-55-g7522 From 71913a098657e916badda760f9d639e8fd4fc6b9 Mon Sep 17 00:00:00 2001 From: Matthew Giassa Date: Thu, 11 May 2017 18:45:21 -0700 Subject: staging: rtl8723bs: checkpatch - remove multiple blank lines Resolving checkpatch issue: CHECK: Please don't use multiple blank lines All instances resolved. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/rtl8723b_spec.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 8d78f4ef5438..960d8e438ff5 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -17,7 +17,6 @@ #include - #define HAL_NAV_UPPER_UNIT_8723B 128 /* micro-second */ /* */ @@ -124,7 +123,6 @@ /* */ /* */ - /* */ /* SDIO Bus Specification */ /* */ @@ -142,7 +140,6 @@ /* */ #define SDIO_REG_HCPWM1_8723B 0x025 /* HCI Current Power Mode 1 */ - /* */ /* 8723 Regsiter Bit and Content definition */ /* */ @@ -161,7 +158,6 @@ /* */ /* */ - /* */ /* */ /* 0x0200h ~ 0x027Fh TXDMA Configuration */ @@ -207,7 +203,6 @@ #define EEPROM_RF_GAIN_OFFSET 0xC1 #define EEPROM_RF_GAIN_VAL 0x1F6 - /* */ /* 8195 IMR/ISR bits (offset 0xB0, 8bits) */ /* */ -- cgit v1.2.3-55-g7522 From 17f858d0799f8242d590a2cb213aab3bb2b8206c Mon Sep 17 00:00:00 2001 From: Matthew Giassa Date: Thu, 11 May 2017 18:45:22 -0700 Subject: staging: rtl8723bs: checkpatch - remove mixed spaces/hard-tabs Resolving checkpatch issue: WARNING: please, no space before tabs All instances resolved. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/rtl8723b_spec.h | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 960d8e438ff5..1f275a734ea7 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -21,7 +21,7 @@ /* */ /* */ -/* 0x0000h ~ 0x00FFh System Configuration */ +/* 0x0000h ~ 0x00FFh System Configuration */ /* */ /* */ #define REG_RSV_CTRL_8723B 0x001C /* 3 Byte */ @@ -41,7 +41,7 @@ /* */ /* */ -/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ +/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ /* */ /* */ #define REG_C2HEVT_CMD_ID_8723B 0x01A0 @@ -57,13 +57,13 @@ /* */ /* */ -/* 0x0200h ~ 0x027Fh TXDMA Configuration */ +/* 0x0200h ~ 0x027Fh TXDMA Configuration */ /* */ /* */ /* */ /* */ -/* 0x0280h ~ 0x02FFh RXDMA Configuration */ +/* 0x0280h ~ 0x02FFh RXDMA Configuration */ /* */ /* */ #define REG_RXDMA_CONTROL_8723B 0x0286 /* Control the RX DMA. */ @@ -71,7 +71,7 @@ /* */ /* */ -/* 0x0300h ~ 0x03FFh PCIe */ +/* 0x0300h ~ 0x03FFh PCIe */ /* */ /* */ #define REG_PCIE_CTRL_REG_8723B 0x0300 @@ -98,7 +98,7 @@ /* */ /* */ -/* 0x0400h ~ 0x047Fh Protocol Configuration */ +/* 0x0400h ~ 0x047Fh Protocol Configuration */ /* */ /* */ #define REG_TXPKTBUF_BCNQ_BDNY_8723B 0x0424 @@ -112,14 +112,14 @@ /* */ /* */ -/* 0x0500h ~ 0x05FFh EDCA Configuration */ +/* 0x0500h ~ 0x05FFh EDCA Configuration */ /* */ /* */ #define REG_SECONDARY_CCA_CTRL_8723B 0x0577 /* */ /* */ -/* 0x0600h ~ 0x07FFh WMAC Configuration */ +/* 0x0600h ~ 0x07FFh WMAC Configuration */ /* */ /* */ @@ -141,7 +141,7 @@ #define SDIO_REG_HCPWM1_8723B 0x025 /* HCI Current Power Mode 1 */ /* */ -/* 8723 Regsiter Bit and Content definition */ +/* 8723 Regsiter Bit and Content definition */ /* */ /* 2 HSISR */ @@ -154,19 +154,19 @@ /* */ /* */ -/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ +/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ /* */ /* */ /* */ /* */ -/* 0x0200h ~ 0x027Fh TXDMA Configuration */ +/* 0x0200h ~ 0x027Fh TXDMA Configuration */ /* */ /* */ /* */ /* */ -/* 0x0280h ~ 0x02FFh RXDMA Configuration */ +/* 0x0280h ~ 0x02FFh RXDMA Configuration */ /* */ /* */ #define BIT_USB_RXDMA_AGG_EN BIT(31) @@ -180,7 +180,7 @@ /* */ /* */ -/* 0x0400h ~ 0x047Fh Protocol Configuration */ +/* 0x0400h ~ 0x047Fh Protocol Configuration */ /* */ /* */ @@ -191,13 +191,13 @@ /* */ /* */ -/* 0x0500h ~ 0x05FFh EDCA Configuration */ +/* 0x0500h ~ 0x05FFh EDCA Configuration */ /* */ /* */ /* */ /* */ -/* 0x0600h ~ 0x07FFh WMAC Configuration */ +/* 0x0600h ~ 0x07FFh WMAC Configuration */ /* */ /* */ #define EEPROM_RF_GAIN_OFFSET 0xC1 -- cgit v1.2.3-55-g7522 From 592a55ef2a2611b2fae2a5e7d43127b5f06eb502 Mon Sep 17 00:00:00 2001 From: Matthew Giassa Date: Thu, 11 May 2017 18:45:23 -0700 Subject: staging: rtl8723bs: checkpatch - fix typos in comments Resolving checkpatch issue: CHECK: 'Regsiter' may be misspelled - perhaps 'Register'? CHECK: 'Interrup' may be misspelled - perhaps 'Interrupt'? All instances resolved. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/rtl8723b_spec.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 1f275a734ea7..1906ff2038f5 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -141,7 +141,7 @@ #define SDIO_REG_HCPWM1_8723B 0x025 /* HCI Current Power Mode 1 */ /* */ -/* 8723 Regsiter Bit and Content definition */ +/* 8723 Register Bit and Content definition */ /* */ /* 2 HSISR */ @@ -241,13 +241,13 @@ #define IMR_BCNDMAINT3_8723B BIT23 /* Beacon DMA Interrupt 3 */ #define IMR_BCNDMAINT2_8723B BIT22 /* Beacon DMA Interrupt 2 */ #define IMR_BCNDMAINT1_8723B BIT21 /* Beacon DMA Interrupt 1 */ -#define IMR_BCNDOK7_8723B BIT20 /* Beacon Queue DMA OK Interrup 7 */ -#define IMR_BCNDOK6_8723B BIT19 /* Beacon Queue DMA OK Interrup 6 */ -#define IMR_BCNDOK5_8723B BIT18 /* Beacon Queue DMA OK Interrup 5 */ -#define IMR_BCNDOK4_8723B BIT17 /* Beacon Queue DMA OK Interrup 4 */ -#define IMR_BCNDOK3_8723B BIT16 /* Beacon Queue DMA OK Interrup 3 */ -#define IMR_BCNDOK2_8723B BIT15 /* Beacon Queue DMA OK Interrup 2 */ -#define IMR_BCNDOK1_8723B BIT14 /* Beacon Queue DMA OK Interrup 1 */ +#define IMR_BCNDOK7_8723B BIT20 /* Beacon Queue DMA OK Interrupt 7 */ +#define IMR_BCNDOK6_8723B BIT19 /* Beacon Queue DMA OK Interrupt 6 */ +#define IMR_BCNDOK5_8723B BIT18 /* Beacon Queue DMA OK Interrupt 5 */ +#define IMR_BCNDOK4_8723B BIT17 /* Beacon Queue DMA OK Interrupt 4 */ +#define IMR_BCNDOK3_8723B BIT16 /* Beacon Queue DMA OK Interrupt 3 */ +#define IMR_BCNDOK2_8723B BIT15 /* Beacon Queue DMA OK Interrupt 2 */ +#define IMR_BCNDOK1_8723B BIT14 /* Beacon Queue DMA OK Interrupt 1 */ #define IMR_ATIMEND_E_8723B BIT13 /* ATIM Window End Extension for Win7 */ #define IMR_TXERR_8723B BIT11 /* Tx Error Flag Interrupt Status, write 1 clear. */ #define IMR_RXERR_8723B BIT10 /* Rx Error Flag INT Status, Write 1 clear */ -- cgit v1.2.3-55-g7522 From e06c1f6b4fff266f55ebd0a88992f9872a5779c3 Mon Sep 17 00:00:00 2001 From: Aviv Palivoda Date: Mon, 15 May 2017 08:55:01 +0300 Subject: staging: rtl8188eu: Put constant on right side of comparison Constants should be on the right side of comparisons. Issue found by checkpatch.pl script. Signed-off-by: Aviv Palivoda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 054f5996f60d..3039bbe44a25 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -1091,7 +1091,7 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 result[][8], } } - if (0x00 == path_a_ok) { + if (path_a_ok == 0x00) { ODM_RT_TRACE(dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK failed!!\n")); } @@ -1122,7 +1122,7 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 result[][8], } } - if (0x00 == path_b_ok) { + if (path_b_ok == 0x00) { ODM_RT_TRACE(dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK failed!!\n")); } -- cgit v1.2.3-55-g7522 From a73470f202ea8b39b70d802b973b8d4429b9ed4d Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:49 +0200 Subject: staging: most: net: remove useless variable channels_opened The function most_nd_stop is only called by successful return from the function most_nd_open, so the channels_opened is always true in the function most_nd_stop. The functions aim_resume_tx_channel and aim_rx_data are only called after successful most_start_channel in the function most_nd_open, so the channels_opened is always true in the functions aim_resume_tx_channel and aim_rx_data. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index ce1764cba5f0..004dd7b636cd 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -65,7 +65,6 @@ struct net_dev_channel { struct net_dev_context { struct most_interface *iface; - bool channels_opened; bool is_mamac; struct net_device *dev; struct net_dev_channel rx; @@ -187,9 +186,6 @@ static int most_nd_open(struct net_device *dev) BUG_ON(nd->dev != dev); - if (nd->channels_opened) - return -EFAULT; - BUG_ON(!nd->tx.linked || !nd->rx.linked); if (most_start_channel(nd->iface, nd->rx.ch_id, &aim)) { @@ -219,7 +215,6 @@ static int most_nd_open(struct net_device *dev) } } - nd->channels_opened = true; netif_wake_queue(dev); return 0; @@ -237,12 +232,8 @@ static int most_nd_stop(struct net_device *dev) BUG_ON(nd->dev != dev); netif_stop_queue(dev); - - if (nd->channels_opened) { - most_stop_channel(nd->iface, nd->rx.ch_id, &aim); - most_stop_channel(nd->iface, nd->tx.ch_id, &aim); - nd->channels_opened = false; - } + most_stop_channel(nd->iface, nd->rx.ch_id, &aim); + most_stop_channel(nd->iface, nd->tx.ch_id, &aim); return 0; } @@ -431,7 +422,7 @@ static int aim_resume_tx_channel(struct most_interface *iface, struct net_dev_context *nd; nd = get_net_dev_context(iface); - if (!nd || !nd->channels_opened || nd->tx.ch_id != channel_idx) + if (!nd || nd->tx.ch_id != channel_idx) return 0; if (!nd->dev) @@ -452,7 +443,7 @@ static int aim_rx_data(struct mbo *mbo) unsigned int skb_len; nd = get_net_dev_context(mbo->ifp); - if (!nd || !nd->channels_opened || nd->rx.ch_id != mbo->hdm_channel_id) + if (!nd || nd->rx.ch_id != mbo->hdm_channel_id) return -EIO; dev = nd->dev; -- cgit v1.2.3-55-g7522 From cf5b36b5d957abd718301dfd3ab03a63221bc145 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:50 +0200 Subject: staging: most: net: use dormant state This replaces the call of wait_for_completion in case of an invalid MAC address in the function most_nd_open() with the dormant state of the network device. As a side effect, opening the network device cannot fail anymore. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 31 ++++++--------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index 004dd7b636cd..ce2942729ecf 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -69,7 +69,6 @@ struct net_dev_context { struct net_device *dev; struct net_dev_channel rx; struct net_dev_channel tx; - struct completion mac_compl; struct list_head list; }; @@ -180,7 +179,6 @@ static int most_nd_set_mac_address(struct net_device *dev, void *p) static int most_nd_open(struct net_device *dev) { struct net_dev_context *nd = dev->ml_priv; - long ret; netdev_info(dev, "open net device\n"); @@ -199,29 +197,13 @@ static int most_nd_open(struct net_device *dev) return -EBUSY; } - if (!is_valid_ether_addr(dev->dev_addr)) { - nd->iface->request_netinfo(nd->iface, nd->tx.ch_id); - ret = wait_for_completion_interruptible_timeout( - &nd->mac_compl, msecs_to_jiffies(5000)); - if (!ret) { - netdev_err(dev, "mac timeout\n"); - ret = -EBUSY; - goto err; - } - - if (ret < 0) { - netdev_warn(dev, "mac waiting interrupted\n"); - goto err; - } - } - + if (is_valid_ether_addr(dev->dev_addr)) + netif_dormant_off(dev); + else + netif_dormant_on(dev); netif_wake_queue(dev); + nd->iface->request_netinfo(nd->iface, nd->tx.ch_id); return 0; - -err: - most_stop_channel(nd->iface, nd->tx.ch_id, &aim); - most_stop_channel(nd->iface, nd->rx.ch_id, &aim); - return ret; } static int most_nd_stop(struct net_device *dev) @@ -337,7 +319,6 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, if (!nd) return -ENOMEM; - init_completion(&nd->mac_compl); nd->iface = iface; spin_lock_irqsave(&list_lock, flags); @@ -569,7 +550,7 @@ void most_deliver_netinfo(struct most_interface *iface, netdev_info(dev, "set mac %02x-%02x-%02x-%02x-%02x-%02x\n", m[0], m[1], m[2], m[3], m[4], m[5]); ether_addr_copy(dev->dev_addr, m); - complete(&nd->mac_compl); + netif_dormant_off(dev); } else if (!ether_addr_equal(dev->dev_addr, m)) { netdev_warn(dev, "reject mac %02x-%02x-%02x-%02x-%02x-%02x\n", m[0], m[1], m[2], m[3], m[4], m[5]); -- cgit v1.2.3-55-g7522 From 29c1035fee5a28cb1b86883df02489b258cdca0e Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:51 +0200 Subject: staging: most: net: add carrier information This adds the carrier information for the network devices based on the INIC controllers. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index ce2942729ecf..5822902ecb4a 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -197,6 +197,7 @@ static int most_nd_open(struct net_device *dev) return -EBUSY; } + netif_carrier_off(dev); if (is_valid_ether_addr(dev->dev_addr)) netif_dormant_off(dev); else @@ -545,6 +546,11 @@ void most_deliver_netinfo(struct most_interface *iface, if (!dev) return; + if (link_stat) + netif_carrier_on(dev); + else + netif_carrier_off(dev); + if (m && is_valid_ether_addr(m)) { if (!is_valid_ether_addr(dev->dev_addr)) { netdev_info(dev, "set mac %02x-%02x-%02x-%02x-%02x-%02x\n", -- cgit v1.2.3-55-g7522 From a4d98fac51f321bc42bc64dd8584f67f751d69f6 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:52 +0200 Subject: staging: most: check availability of the callback request_netinfo Since not all HDMs implement the callback request_netinfo, this patch adds checking of its availability. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index 5822902ecb4a..03ddbd2459d6 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -203,7 +203,8 @@ static int most_nd_open(struct net_device *dev) else netif_dormant_on(dev); netif_wake_queue(dev); - nd->iface->request_netinfo(nd->iface, nd->tx.ch_id); + if (nd->iface->request_netinfo) + nd->iface->request_netinfo(nd->iface, nd->tx.ch_id); return 0; } -- cgit v1.2.3-55-g7522 From 78a900205cb917d45d6dd82c67c61ff707dc10d0 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:53 +0200 Subject: staging: most: i2c: remove empty callback request_netinfo Since the networking-aim checks the availability of the callback request_netinfo, this patch removes the empty callback request_netinfo from the i2c-hdm. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-i2c/hdm_i2c.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/hdm-i2c/hdm_i2c.c b/drivers/staging/most/hdm-i2c/hdm_i2c.c index 1d5b22927bcd..2b4de404e46a 100644 --- a/drivers/staging/most/hdm-i2c/hdm_i2c.c +++ b/drivers/staging/most/hdm-i2c/hdm_i2c.c @@ -185,12 +185,6 @@ static int poison_channel(struct most_interface *most_iface, return 0; } -static void request_netinfo(struct most_interface *most_iface, - int ch_idx) -{ - pr_info("request_netinfo()\n"); -} - static void do_rx_work(struct hdm_i2c *dev) { struct mbo *mbo; @@ -343,7 +337,6 @@ static int i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) dev->most_iface.configure = configure_channel; dev->most_iface.enqueue = enqueue; dev->most_iface.poison_channel = poison_channel; - dev->most_iface.request_netinfo = request_netinfo; INIT_LIST_HEAD(&dev->rx.list); mutex_init(&dev->rx.list_mutex); -- cgit v1.2.3-55-g7522 From d35bbfaa4a4fe17abccf54c67a1861a362ed0b52 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:54 +0200 Subject: staging: most: remove dependency on networking-aim The modules hdm-usb and hdm-dim2 depend on the module aim-network, because they use the function most_deliver_netinfo that it exports. To remove this dependency, this patch replaces the call of the function most_deliver_netinfo with the call of the function that is the parameter 'on_netinfo' of the function request_netinfo. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 15 +++++++++------ drivers/staging/most/aim-network/networking.h | 21 --------------------- drivers/staging/most/hdm-dim2/Kconfig | 1 - drivers/staging/most/hdm-dim2/dim2_hdm.c | 18 ++++++++++++++---- drivers/staging/most/hdm-usb/Kconfig | 2 +- drivers/staging/most/hdm-usb/hdm_usb.c | 15 ++++++++++++--- drivers/staging/most/mostcore/mostcore.h | 7 ++++++- 7 files changed, 42 insertions(+), 37 deletions(-) delete mode 100644 drivers/staging/most/aim-network/networking.h (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index 03ddbd2459d6..a3009fdfa278 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -22,7 +22,6 @@ #include #include #include "mostcore.h" -#include "networking.h" #define MEP_HDR_LEN 8 #define MDP_HDR_LEN 16 @@ -176,6 +175,9 @@ static int most_nd_set_mac_address(struct net_device *dev, void *p) return 0; } +static void on_netinfo(struct most_interface *iface, + unsigned char link_stat, unsigned char *mac_addr); + static int most_nd_open(struct net_device *dev) { struct net_dev_context *nd = dev->ml_priv; @@ -204,7 +206,7 @@ static int most_nd_open(struct net_device *dev) netif_dormant_on(dev); netif_wake_queue(dev); if (nd->iface->request_netinfo) - nd->iface->request_netinfo(nd->iface, nd->tx.ch_id); + nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, on_netinfo); return 0; } @@ -216,6 +218,8 @@ static int most_nd_stop(struct net_device *dev) BUG_ON(nd->dev != dev); netif_stop_queue(dev); + if (nd->iface->request_netinfo) + nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, NULL); most_stop_channel(nd->iface, nd->rx.ch_id, &aim); most_stop_channel(nd->iface, nd->tx.ch_id, &aim); @@ -527,13 +531,13 @@ static void __exit most_net_exit(void) } /** - * most_deliver_netinfo - callback for HDM to be informed about HW's MAC + * on_netinfo - callback for HDM to be informed about HW's MAC * @param iface - most interface instance * @param link_stat - link status * @param mac_addr - MAC address */ -void most_deliver_netinfo(struct most_interface *iface, - unsigned char link_stat, unsigned char *mac_addr) +static void on_netinfo(struct most_interface *iface, + unsigned char link_stat, unsigned char *mac_addr) { struct net_dev_context *nd; struct net_device *dev; @@ -564,7 +568,6 @@ void most_deliver_netinfo(struct most_interface *iface, } } } -EXPORT_SYMBOL(most_deliver_netinfo); module_init(most_net_init); module_exit(most_net_exit); diff --git a/drivers/staging/most/aim-network/networking.h b/drivers/staging/most/aim-network/networking.h deleted file mode 100644 index 6f346d410525..000000000000 --- a/drivers/staging/most/aim-network/networking.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Networking AIM - Networking Application Interface Module for MostCore - * - * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This file is licensed under GPLv2. - */ -#ifndef _NETWORKING_H_ -#define _NETWORKING_H_ - -#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/Kconfig b/drivers/staging/most/hdm-dim2/Kconfig index 28a0e1791600..663bfebff674 100644 --- a/drivers/staging/most/hdm-dim2/Kconfig +++ b/drivers/staging/most/hdm-dim2/Kconfig @@ -4,7 +4,6 @@ config HDM_DIM2 tristate "DIM2 HDM" - depends on AIM_NETWORK depends on HAS_IOMEM ---help--- diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 902824e728ea..4607d03c577b 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -26,7 +26,6 @@ #include #include -#include #include "dim2_hal.h" #include "dim2_hdm.h" #include "dim2_errors.h" @@ -107,6 +106,8 @@ struct dim2_hdm { unsigned char link_state; int atx_idx; struct medialb_bus bus; + void (*on_netinfo)(struct most_interface *, + unsigned char, unsigned char *); }; #define iface_to_hdm(iface) container_of(iface, struct dim2_hdm, most_iface) @@ -287,8 +288,11 @@ static int deliver_netinfo_thread(void *data) if (dev->deliver_netinfo) { dev->deliver_netinfo--; - most_deliver_netinfo(&dev->most_iface, dev->link_state, - dev->mac_addrs); + if (dev->on_netinfo) { + dev->on_netinfo(&dev->most_iface, + dev->link_state, + dev->mac_addrs); + } } } @@ -654,12 +658,18 @@ static int enqueue(struct most_interface *most_iface, int ch_idx, * Send a command to INIC which triggers retrieving of network info by means of * "Message exchange over MDP/MEP". Return 0 on success, negative on failure. */ -static void request_netinfo(struct most_interface *most_iface, int ch_idx) +static void request_netinfo(struct most_interface *most_iface, int ch_idx, + void (*on_netinfo)(struct most_interface *, + unsigned char, unsigned char *)) { struct dim2_hdm *dev = iface_to_hdm(most_iface); struct mbo *mbo; u8 *data; + dev->on_netinfo = on_netinfo; + if (!on_netinfo) + return; + if (dev->atx_idx < 0) { pr_err("Async Tx Not initialized\n"); return; diff --git a/drivers/staging/most/hdm-usb/Kconfig b/drivers/staging/most/hdm-usb/Kconfig index ec1546312ee6..487f1f34776c 100644 --- a/drivers/staging/most/hdm-usb/Kconfig +++ b/drivers/staging/most/hdm-usb/Kconfig @@ -5,7 +5,7 @@ config HDM_USB tristate "USB HDM" depends on USB && NET - select AIM_NETWORK + ---help--- Say Y here if you want to connect via USB to network tranceiver. This device driver depends on the networking AIM. diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c index a95b5910d9fc..d0f68cb3c173 100644 --- a/drivers/staging/most/hdm-usb/hdm_usb.c +++ b/drivers/staging/most/hdm-usb/hdm_usb.c @@ -30,7 +30,6 @@ #include #include #include "mostcore.h" -#include "networking.h" #define USB_MTU 512 #define NO_ISOCHRONOUS_URB 0 @@ -126,6 +125,8 @@ struct most_dev { struct mutex io_mutex; struct timer_list link_stat_timer; struct work_struct poll_work_obj; + void (*on_netinfo)(struct most_interface *, unsigned char, + unsigned char *); }; #define to_mdev(d) container_of(d, struct most_dev, iface) @@ -719,12 +720,19 @@ exit: * polls for the NI state of the INIC every 2 seconds. * */ -static void hdm_request_netinfo(struct most_interface *iface, int channel) +static void hdm_request_netinfo(struct most_interface *iface, int channel, + void (*on_netinfo)(struct most_interface *, + unsigned char, + unsigned char *)) { struct most_dev *mdev; BUG_ON(!iface); mdev = to_mdev(iface); + mdev->on_netinfo = on_netinfo; + if (!on_netinfo) + return; + mdev->link_stat_timer.expires = jiffies + HZ; mod_timer(&mdev->link_stat_timer, mdev->link_stat_timer.expires); } @@ -786,7 +794,8 @@ static void wq_netinfo(struct work_struct *wq_obj) hw_addr[4] = lo >> 8; hw_addr[5] = lo; - most_deliver_netinfo(&mdev->iface, link, hw_addr); + if (mdev->on_netinfo) + mdev->on_netinfo(&mdev->iface, link, hw_addr); } /** diff --git a/drivers/staging/most/mostcore/mostcore.h b/drivers/staging/most/mostcore/mostcore.h index 5f8339bd046f..915e5159d1eb 100644 --- a/drivers/staging/most/mostcore/mostcore.h +++ b/drivers/staging/most/mostcore/mostcore.h @@ -233,6 +233,8 @@ struct mbo { * The callback returns a negative value on error, otherwise 0. * @request_netinfo: triggers retrieving of network info from the HDM by * means of "Message exchange over MDP/MEP" + * The call of the function request_netinfo with the parameter on_netinfo as + * NULL prohibits use of the previously obtained function pointer. * @priv Private field used by mostcore to store context information. */ struct most_interface { @@ -246,7 +248,10 @@ struct most_interface { int (*enqueue)(struct most_interface *iface, int channel_idx, struct mbo *mbo); int (*poison_channel)(struct most_interface *iface, int channel_idx); - void (*request_netinfo)(struct most_interface *iface, int channel_idx); + void (*request_netinfo)(struct most_interface *iface, int channel_idx, + void (*on_netinfo)(struct most_interface *iface, + unsigned char link_stat, + unsigned char *mac_addr)); void *priv; }; -- cgit v1.2.3-55-g7522 From eec3546cb92a5dbb84e817692d306a5db6e6f416 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:55 +0200 Subject: staging: most: use unsafe version of list traversing The function get_net_dev_context does not remove elements of the list. Hence, list traversing does not need to be secured. This patch replaces list_for_each_entry_safe with the list_for_each_entry. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index a3009fdfa278..11f03d3cd565 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -290,11 +290,11 @@ static void most_net_rm_netdev_safe(struct net_dev_context *nd) static struct net_dev_context *get_net_dev_context( struct most_interface *iface) { - struct net_dev_context *nd, *tmp; + struct net_dev_context *nd; unsigned long flags; spin_lock_irqsave(&list_lock, flags); - list_for_each_entry_safe(nd, tmp, &net_devices, list) { + list_for_each_entry(nd, &net_devices, list) { if (nd->iface == iface) { spin_unlock_irqrestore(&list_lock, flags); return nd; -- cgit v1.2.3-55-g7522 From d54516086d95c8f2bd67716f54932e3fd3a904b8 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:56 +0200 Subject: staging: most: net: remove redundant cleanup code This removes redundant cleanup code that is executed anyway when the most_deregister_aim() is called. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index 11f03d3cd565..e2935ccd5b09 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -509,25 +509,8 @@ static int __init most_net_init(void) static void __exit most_net_exit(void) { - struct net_dev_context *nd, *tmp; - unsigned long flags; - - spin_lock_irqsave(&list_lock, flags); - list_for_each_entry_safe(nd, tmp, &net_devices, list) { - list_del(&nd->list); - spin_unlock_irqrestore(&list_lock, flags); - /* - * do not call most_stop_channel() here, because channels are - * going to be closed in ndo_stop() after unregister_netdev() - */ - most_net_rm_netdev_safe(nd); - kfree(nd); - spin_lock_irqsave(&list_lock, flags); - } - spin_unlock_irqrestore(&list_lock, flags); - - most_deregister_aim(&aim); pr_info("most_net_exit()\n"); + most_deregister_aim(&aim); } /** -- cgit v1.2.3-55-g7522 From 578bdec44cc02a4d7bfd6390adee50036152e67c Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 12:59:58 +0200 Subject: staging: most: allocate private net_dev_context with the alloc_netdev This moves the allocation of the net_dev to the aim_probe_channel() and uses the parameter sizeof_priv of the function alloc_netdev to reserve the space for the struct net_dev_context. As a side effect, the nd->dev always points to the existing net_dev. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 81 +++++++-------------------- 1 file changed, 20 insertions(+), 61 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index e2935ccd5b09..a2e37511341a 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -154,14 +154,12 @@ static int skb_to_mep(const struct sk_buff *skb, struct mbo *mbo) static int most_nd_set_mac_address(struct net_device *dev, void *p) { - struct net_dev_context *nd = dev->ml_priv; + struct net_dev_context *nd = netdev_priv(dev); int err = eth_mac_addr(dev, p); if (err) return err; - BUG_ON(nd->dev != dev); - nd->is_mamac = (dev->dev_addr[0] == 0 && dev->dev_addr[1] == 0 && dev->dev_addr[2] == 0 && dev->dev_addr[3] == 0); @@ -180,12 +178,10 @@ static void on_netinfo(struct most_interface *iface, static int most_nd_open(struct net_device *dev) { - struct net_dev_context *nd = dev->ml_priv; + struct net_dev_context *nd = netdev_priv(dev); netdev_info(dev, "open net device\n"); - BUG_ON(nd->dev != dev); - BUG_ON(!nd->tx.linked || !nd->rx.linked); if (most_start_channel(nd->iface, nd->rx.ch_id, &aim)) { @@ -212,11 +208,10 @@ static int most_nd_open(struct net_device *dev) static int most_nd_stop(struct net_device *dev) { - struct net_dev_context *nd = dev->ml_priv; + struct net_dev_context *nd = netdev_priv(dev); netdev_info(dev, "stop net device\n"); - BUG_ON(nd->dev != dev); netif_stop_queue(dev); if (nd->iface->request_netinfo) nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, NULL); @@ -229,12 +224,10 @@ static int most_nd_stop(struct net_device *dev) static netdev_tx_t most_nd_start_xmit(struct sk_buff *skb, struct net_device *dev) { - struct net_dev_context *nd = dev->ml_priv; + struct net_dev_context *nd = netdev_priv(dev); struct mbo *mbo; int ret; - BUG_ON(nd->dev != dev); - mbo = most_get_mbo(nd->iface, nd->tx.ch_id, &aim); if (!mbo) { @@ -275,18 +268,6 @@ static void most_nd_setup(struct net_device *dev) dev->netdev_ops = &most_nd_ops; } -static void most_net_rm_netdev_safe(struct net_dev_context *nd) -{ - if (!nd->dev) - return; - - pr_info("remove net device %p\n", nd->dev); - - unregister_netdev(nd->dev); - free_netdev(nd->dev); - nd->dev = NULL; -} - static struct net_dev_context *get_net_dev_context( struct most_interface *iface) { @@ -321,11 +302,16 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, nd = get_net_dev_context(iface); if (!nd) { - nd = kzalloc(sizeof(*nd), GFP_KERNEL); - if (!nd) + struct net_device *dev; + + dev = alloc_netdev(sizeof(struct net_dev_context), "meth%d", + NET_NAME_UNKNOWN, most_nd_setup); + if (!dev) return -ENOMEM; + nd = netdev_priv(dev); nd->iface = iface; + nd->dev = dev; spin_lock_irqsave(&list_lock, flags); list_add(&nd->list, &net_devices); @@ -338,31 +324,13 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, return -EINVAL; } - if (nd->tx.linked || nd->rx.linked) { - struct net_device *dev = - alloc_netdev(0, "meth%d", NET_NAME_UNKNOWN, - most_nd_setup); - - if (!dev) { - pr_err("no memory for net_device\n"); - return -ENOMEM; - } - - nd->dev = dev; - ch->ch_id = channel_idx; - ch->linked = true; - - dev->ml_priv = nd; - if (register_netdev(dev)) { - pr_err("registering net device failed\n"); - ch->linked = false; - free_netdev(dev); - return -EINVAL; - } - } - ch->ch_id = channel_idx; ch->linked = true; + if (nd->tx.linked && nd->rx.linked && register_netdev(nd->dev)) { + pr_err("register_netdev() failed\n"); + ch->linked = false; + return -EINVAL; + } return 0; } @@ -385,19 +353,19 @@ static int aim_disconnect_channel(struct most_interface *iface, else return -EINVAL; - ch->linked = false; - /* * do not call most_stop_channel() here, because channels are * going to be closed in ndo_stop() after unregister_netdev() */ - most_net_rm_netdev_safe(nd); + if (nd->rx.linked && nd->tx.linked) + unregister_netdev(nd->dev); + ch->linked = false; if (!nd->rx.linked && !nd->tx.linked) { spin_lock_irqsave(&list_lock, flags); list_del(&nd->list); spin_unlock_irqrestore(&list_lock, flags); - kfree(nd); + free_netdev(nd->dev); } return 0; @@ -412,9 +380,6 @@ static int aim_resume_tx_channel(struct most_interface *iface, if (!nd || nd->tx.ch_id != channel_idx) return 0; - if (!nd->dev) - return 0; - netif_wake_queue(nd->dev); return 0; } @@ -434,10 +399,6 @@ static int aim_rx_data(struct mbo *mbo) return -EIO; dev = nd->dev; - if (!dev) { - pr_err_once("drop packet: missing net_device\n"); - return -EIO; - } if (nd->is_mamac) { if (!PMS_IS_MAMAC(buf, len)) @@ -531,8 +492,6 @@ static void on_netinfo(struct most_interface *iface, return; dev = nd->dev; - if (!dev) - return; if (link_stat) netif_carrier_on(dev); -- cgit v1.2.3-55-g7522 From 648377cd21254220f78b6566e137ce1608dd3804 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 13:00:00 +0200 Subject: staging: most: dim2: enable flow control for isoc channels This patch enables the flow control feature for the isochronous channels of the DIM2 macro. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 ++ drivers/staging/most/hdm-dim2/dim2_reg.h | 1 + 2 files changed, 3 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index d604ec09df28..b9f34950b763 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -219,10 +219,12 @@ static inline void dim2_clear_ctr(u32 ctr_addr) static void dim2_configure_cat(u8 cat_base, u8 ch_addr, u8 ch_type, bool read_not_write, bool sync_mfe) { + bool isoc_fce = ch_type == CAT_CT_VAL_ISOC; u16 const cat = (read_not_write << CAT_RNW_BIT) | (ch_type << CAT_CT_SHIFT) | (ch_addr << CAT_CL_SHIFT) | + (isoc_fce << CAT_FCE_BIT) | (sync_mfe << CAT_MFE_BIT) | (false << CAT_MT_BIT) | (true << CAT_CE_BIT); diff --git a/drivers/staging/most/hdm-dim2/dim2_reg.h b/drivers/staging/most/hdm-dim2/dim2_reg.h index 01fe499411ff..f7d9fbcd29f2 100644 --- a/drivers/staging/most/hdm-dim2/dim2_reg.h +++ b/drivers/staging/most/hdm-dim2/dim2_reg.h @@ -141,6 +141,7 @@ enum { ADT1_CTRL_ASYNC_BD_MASK = DIM2_MASK(11), ADT1_ISOC_SYNC_BD_MASK = DIM2_MASK(13), + CAT_FCE_BIT = 14, CAT_MFE_BIT = 14, CAT_MT_BIT = 13, -- cgit v1.2.3-55-g7522 From d2892ebc5bb47f1d55dbf4d512551f3c18da2e07 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Fri, 12 May 2017 13:00:01 +0200 Subject: staging: most: dim2: replace function parameter with the expression This replaces the function parameter sync_mfe with the expression (ch_type == CAT_CT_VAL_SYNC) what is the same. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index b9f34950b763..91484643d289 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -217,9 +217,10 @@ static inline void dim2_clear_ctr(u32 ctr_addr) } static void dim2_configure_cat(u8 cat_base, u8 ch_addr, u8 ch_type, - bool read_not_write, bool sync_mfe) + bool read_not_write) { bool isoc_fce = ch_type == CAT_CT_VAL_ISOC; + bool sync_mfe = ch_type == CAT_CT_VAL_SYNC; u16 const cat = (read_not_write << CAT_RNW_BIT) | (ch_type << CAT_CT_SHIFT) | @@ -352,13 +353,13 @@ static void dim2_clear_ctram(void) static void dim2_configure_channel( u8 ch_addr, u8 type, u8 is_tx, u16 dbr_address, u16 hw_buffer_size, - u16 packet_length, bool sync_mfe) + u16 packet_length) { dim2_configure_cdt(ch_addr, dbr_address, hw_buffer_size, packet_length); - dim2_configure_cat(MLB_CAT, ch_addr, type, is_tx ? 1 : 0, sync_mfe); + dim2_configure_cat(MLB_CAT, ch_addr, type, is_tx ? 1 : 0); dim2_configure_adt(ch_addr); - dim2_configure_cat(AHB_CAT, ch_addr, type, is_tx ? 0 : 1, sync_mfe); + dim2_configure_cat(AHB_CAT, ch_addr, type, is_tx ? 0 : 1); /* unmask interrupt for used channel, enable mlb_sys_int[0] interrupt */ dimcb_io_write(&g.dim2->ACMR0, @@ -773,7 +774,7 @@ static u8 init_ctrl_async(struct dim_channel *ch, u8 type, u8 is_tx, channel_init(ch, ch_address / 2); dim2_configure_channel(ch->addr, type, is_tx, - ch->dbr_addr, ch->dbr_size, 0, false); + ch->dbr_addr, ch->dbr_size, 0); return DIM_NO_ERROR; } @@ -859,7 +860,7 @@ u8 dim_init_isoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, isoc_init(ch, ch_address / 2, packet_length); dim2_configure_channel(ch->addr, CAT_CT_VAL_ISOC, is_tx, ch->dbr_addr, - ch->dbr_size, packet_length, false); + ch->dbr_size, packet_length); return DIM_NO_ERROR; } @@ -887,7 +888,7 @@ u8 dim_init_sync(struct dim_channel *ch, u8 is_tx, u16 ch_address, dim2_clear_dbr(ch->dbr_addr, ch->dbr_size); dim2_configure_channel(ch->addr, CAT_CT_VAL_SYNC, is_tx, - ch->dbr_addr, ch->dbr_size, 0, true); + ch->dbr_addr, ch->dbr_size, 0); return DIM_NO_ERROR; } -- cgit v1.2.3-55-g7522 From ad645be806f1f5b8daf005950003dc038a7a7b83 Mon Sep 17 00:00:00 2001 From: Connor Kelleher Date: Fri, 12 May 2017 12:10:25 -0700 Subject: staging: ccree: switch spaces to tabs ssi_fips.c: fixing checkpatch.pl errors: ERROR: code indent should use tabs where possible + int rc = 0;$ ERROR: code indent should use tabs where possible + int rc = 0;$ Signed-off-by: Connor Kelleher Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index 34e5ddf55073..25ee23a1cecf 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -32,7 +32,7 @@ It should be called by kernel module. */ int ssi_fips_get_state(ssi_fips_state_t *p_state) { - int rc = 0; + int rc = 0; if (p_state == NULL) { return -EINVAL; @@ -51,7 +51,7 @@ It should be called by kernel module. */ int ssi_fips_get_error(ssi_fips_error_t *p_err) { - int rc = 0; + int rc = 0; if (p_err == NULL) { return -EINVAL; -- cgit v1.2.3-55-g7522 From be2496ffbea74c4d2ec49e4a9d9a37c6a1f0462c Mon Sep 17 00:00:00 2001 From: Alexander Mazyrin Date: Sat, 13 May 2017 19:48:35 +0300 Subject: staging: ccree: Fix blank lines codestyle issue Checkpatch emits CHECK: Please don't use multiple blank lines. Remove multiple blank lines. Signed-off-by: Alexander Mazyrin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index cfd0cb7b4af2..0941da7cb124 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -2827,6 +2827,3 @@ fail1: fail0: return rc; } - - - -- cgit v1.2.3-55-g7522 From 6c5ed91b0ca6480642eed4fd9862e2bb238f35ae Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Sun, 14 May 2017 09:36:08 +0300 Subject: staging: ccree: remove unused function argument "gcc -Wunused" warns about one argument being assigned but not used: drivers/staging/ccree/ssi_cipher.c: In function 'ssi_blkcipher_complete': drivers/staging/ccree/ssi_cipher.c:747:41: error: parameter 'info' set but not used [-Werror=unused-but-set-parameter] We can simply drop that argument here and in its callers. Fixes: 302ef8ebb4b2 ("staging: ccree: add skcipher support") Signed-off-by: Arnd Bergmann [ gby: rebased patch on latest revision and chopped >80 chars long lines ] Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_cipher.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index ea0e863169e4..d245a2baff70 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -744,7 +744,6 @@ static int ssi_blkcipher_complete(struct device *dev, struct ssi_ablkcipher_ctx *ctx_p, struct blkcipher_req_ctx *req_ctx, struct scatterlist *dst, struct scatterlist *src, - void *info, //req info unsigned int ivsize, void *areq, void __iomem *cc_base) @@ -755,7 +754,6 @@ static int ssi_blkcipher_complete(struct device *dev, START_CYCLE_COUNT(); ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - info = req_ctx->backup_info; END_CYCLE_COUNT(STAT_OP_TYPE_GENERIC, STAT_PHASE_4); @@ -895,7 +893,9 @@ static int ssi_blkcipher_process( END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); } else { END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); - rc = ssi_blkcipher_complete(dev, ctx_p, req_ctx, dst, src, info, ivsize, NULL, ctx_p->drvdata->cc_base); + rc = ssi_blkcipher_complete(dev, ctx_p, req_ctx, dst, + src, ivsize, NULL, + ctx_p->drvdata->cc_base); } } @@ -916,7 +916,8 @@ static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __io CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR(); - ssi_blkcipher_complete(dev, ctx_p, req_ctx, areq->dst, areq->src, areq->info, ivsize, areq, cc_base); + ssi_blkcipher_complete(dev, ctx_p, req_ctx, areq->dst, areq->src, + ivsize, areq, cc_base); } -- cgit v1.2.3-55-g7522 From 2a3e1437c1e3f5ef30d2bb533ca083d5da9c86f2 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sat, 13 May 2017 23:23:40 +0100 Subject: staging: rtl8188eu, rtl8723bs: fix spelling mistake "Cancle" -> "Cancel" Trivial fix to spelling mistakes in a comments and RT_TRACE text. Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 4 ++-- drivers/staging/rtl8723bs/core/rtw_mlme.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index 301085a459c9..de9ab59f898d 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -1081,10 +1081,10 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("adhoc mode, fw_state:%x", get_fwstate(pmlmepriv))); } - /* s5. Cancle assoc_timer */ + /* s5. Cancel assoc_timer */ del_timer_sync(&pmlmepriv->assoc_timer); - RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("Cancle assoc_timer\n")); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("Cancel assoc_timer\n")); } else { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("rtw_joinbss_event_callback err: fw_state:%x", get_fwstate(pmlmepriv))); diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 9e355734f0c0..e61638291df1 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -1482,10 +1482,10 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) } - /* s5. Cancle assoc_timer */ + /* s5. Cancel assoc_timer */ _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); - RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("Cancle assoc_timer\n")); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("Cancel assoc_timer\n")); } else{ RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("rtw_joinbss_event_callback err: fw_state:%x", get_fwstate(pmlmepriv))); -- cgit v1.2.3-55-g7522 From ca693dcd5c02645063210e2352ff4909d9ddc7e9 Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Sat, 29 Apr 2017 20:52:58 +0100 Subject: staging: speakup: make input functionality swappable This moves functions which take input from external synth, into struct spk_io_ops. The calling code then uses serial implementation of those methods through spk_io_ops. That way we can add a parallel TTY-based implementation and simply replace serial with TTY. That is what the next patch in this series does. speakup_decext.c has get_last_char function which reads the most recent available character from the synth. This patch changes that by defining read_buff_add callback method of spk_syth and letting that update the last_char global character read from the synth. read_buff_add is called from ISR, so there is a possibility for last_char to be stale. Therefore it is marked as volatile. It also pulls a repeated get_index implementation into synth.c, to be used as a utility function. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/serialio.c | 10 ++++++---- drivers/staging/speakup/speakup_audptr.c | 4 ++-- drivers/staging/speakup/speakup_decext.c | 14 +++++--------- drivers/staging/speakup/speakup_dectlk.c | 4 ++-- drivers/staging/speakup/speakup_dtlk.c | 2 +- drivers/staging/speakup/speakup_ltlk.c | 4 ++-- drivers/staging/speakup/speakup_soft.c | 4 ++-- drivers/staging/speakup/speakup_spkout.c | 2 +- drivers/staging/speakup/spk_priv.h | 3 +-- drivers/staging/speakup/spk_types.h | 4 +++- drivers/staging/speakup/synth.c | 10 ++++++++-- 11 files changed, 33 insertions(+), 28 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index ba060d0ceca2..5f96b5ba7acb 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -28,11 +28,15 @@ static int timeouts; static int spk_serial_out(struct spk_synth *in_synth, const char ch); static void spk_serial_send_xchar(char ch); static void spk_serial_tiocmset(unsigned int set, unsigned int clear); +static unsigned char spk_serial_in(void); +static unsigned char spk_serial_in_nowait(void); struct spk_io_ops spk_serial_io_ops = { .synth_out = spk_serial_out, .send_xchar = spk_serial_send_xchar, .tiocmset = spk_serial_tiocmset, + .synth_in = spk_serial_in, + .synth_in_nowait = spk_serial_in_nowait, }; EXPORT_SYMBOL_GPL(spk_serial_io_ops); @@ -240,7 +244,7 @@ int spk_wait_for_xmitr(struct spk_synth *in_synth) return 1; } -unsigned char spk_serial_in(void) +static unsigned char spk_serial_in(void) { int tmout = SPK_SERIAL_TIMEOUT; @@ -253,9 +257,8 @@ unsigned char spk_serial_in(void) } return inb_p(speakup_info.port_tts + UART_RX); } -EXPORT_SYMBOL_GPL(spk_serial_in); -unsigned char spk_serial_in_nowait(void) +static unsigned char spk_serial_in_nowait(void) { unsigned char lsr; @@ -264,7 +267,6 @@ unsigned char spk_serial_in_nowait(void) return 0; return inb_p(speakup_info.port_tts + UART_RX); } -EXPORT_SYMBOL_GPL(spk_serial_in_nowait); static int spk_serial_out(struct spk_synth *in_synth, const char ch) { diff --git a/drivers/staging/speakup/speakup_audptr.c b/drivers/staging/speakup/speakup_audptr.c index 6880352a7b74..800677bc1dad 100644 --- a/drivers/staging/speakup/speakup_audptr.c +++ b/drivers/staging/speakup/speakup_audptr.c @@ -138,11 +138,11 @@ static void synth_version(struct spk_synth *synth) char synth_id[40] = ""; synth->synth_immediate(synth, "\x05[Q]"); - synth_id[test] = spk_serial_in(); + synth_id[test] = synth->io_ops->synth_in(); if (synth_id[test] == 'A') { do { /* read version string from synth */ - synth_id[++test] = spk_serial_in(); + synth_id[++test] = synth->io_ops->synth_in(); } while (synth_id[test] != '\n' && test < 32); synth_id[++test] = 0x00; } diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index c564bf8e1531..da73b7649936 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -30,20 +30,16 @@ #define DRV_VERSION "2.14" #define SYNTH_CLEAR 0x03 #define PROCSPEECH 0x0b -static unsigned char last_char; +static volatile unsigned char last_char; -static inline u_char get_last_char(void) +static void read_buff_add(u_char ch) { - u_char avail = inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR; - - if (avail) - last_char = inb_p(speakup_info.port_tts + UART_RX); - return last_char; + last_char = ch; } static inline bool synth_full(void) { - return get_last_char() == 0x13; + return last_char == 0x13; } static void do_catch_up(struct spk_synth *synth); @@ -135,7 +131,7 @@ static struct spk_synth synth_decext = { .flush = synth_flush, .is_alive = spk_synth_is_alive_restart, .synth_adjust = NULL, - .read_buff_add = NULL, + .read_buff_add = read_buff_add, .get_index = NULL, .indexing = { .command = NULL, diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c index 0cdbd5e9b36b..74acd527dc86 100644 --- a/drivers/staging/speakup/speakup_dectlk.c +++ b/drivers/staging/speakup/speakup_dectlk.c @@ -42,7 +42,7 @@ static inline int synth_full(void) static void do_catch_up(struct spk_synth *synth); static void synth_flush(struct spk_synth *synth); static void read_buff_add(u_char c); -static unsigned char get_index(void); +static unsigned char get_index(struct spk_synth *synth); static int in_escape; static int is_flushing; @@ -163,7 +163,7 @@ static int is_indnum(u_char *ch) static u_char lastind; -static unsigned char get_index(void) +static unsigned char get_index(struct spk_synth *synth) { u_char rv; diff --git a/drivers/staging/speakup/speakup_dtlk.c b/drivers/staging/speakup/speakup_dtlk.c index 33180937222d..8999e3eb5c26 100644 --- a/drivers/staging/speakup/speakup_dtlk.c +++ b/drivers/staging/speakup/speakup_dtlk.c @@ -138,7 +138,7 @@ static struct spk_synth synth_dtlk = { .is_alive = spk_synth_is_alive_nop, .synth_adjust = NULL, .read_buff_add = NULL, - .get_index = spk_serial_in_nowait, + .get_index = spk_synth_get_index, .indexing = { .command = "\x01%di", .lowindex = 1, diff --git a/drivers/staging/speakup/speakup_ltlk.c b/drivers/staging/speakup/speakup_ltlk.c index 11275f49bea4..bd4ac63730b7 100644 --- a/drivers/staging/speakup/speakup_ltlk.c +++ b/drivers/staging/speakup/speakup_ltlk.c @@ -120,7 +120,7 @@ static struct spk_synth synth_ltlk = { .is_alive = spk_synth_is_alive_restart, .synth_adjust = NULL, .read_buff_add = NULL, - .get_index = spk_serial_in_nowait, + .get_index = spk_synth_get_index, .indexing = { .command = "\x01%di", .lowindex = 1, @@ -141,7 +141,7 @@ static void synth_interrogate(struct spk_synth *synth) synth->synth_immediate(synth, "\x18\x01?"); for (i = 0; i < 50; i++) { - buf[i] = spk_serial_in(); + buf[i] = synth->io_ops->synth_in(); if (i > 2 && buf[i] == 0x7f) break; } diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c index e454f5685f70..d99daf69e501 100644 --- a/drivers/staging/speakup/speakup_soft.c +++ b/drivers/staging/speakup/speakup_soft.c @@ -36,7 +36,7 @@ static int softsynth_probe(struct spk_synth *synth); static void softsynth_release(void); static int softsynth_is_alive(struct spk_synth *synth); -static unsigned char get_index(void); +static unsigned char get_index(struct spk_synth *synth); static struct miscdevice synth_device, synthu_device; static int init_pos; @@ -340,7 +340,7 @@ static unsigned int softsynth_poll(struct file *fp, struct poll_table_struct *wa return ret; } -static unsigned char get_index(void) +static unsigned char get_index(struct spk_synth *synth) { int rv; diff --git a/drivers/staging/speakup/speakup_spkout.c b/drivers/staging/speakup/speakup_spkout.c index d95c375a0736..5160e4afdbef 100644 --- a/drivers/staging/speakup/speakup_spkout.c +++ b/drivers/staging/speakup/speakup_spkout.c @@ -111,7 +111,7 @@ static struct spk_synth synth_spkout = { .is_alive = spk_synth_is_alive_restart, .synth_adjust = NULL, .read_buff_add = NULL, - .get_index = spk_serial_in_nowait, + .get_index = spk_synth_get_index, .indexing = { .command = "\x05[%c", .lowindex = 1, diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h index 995f586bddcd..6895373902de 100644 --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -43,8 +43,6 @@ const struct old_serial_port *spk_serial_init(int index); void spk_stop_serial_interrupt(void); int spk_wait_for_xmitr(struct spk_synth *in_synth); -unsigned char spk_serial_in(void); -unsigned char spk_serial_in_nowait(void); void spk_serial_release(void); void synth_buffer_skip_nonlatin1(void); @@ -61,6 +59,7 @@ int spk_serial_synth_probe(struct spk_synth *synth); const char *spk_serial_synth_immediate(struct spk_synth *synth, const char *buff); void spk_do_catch_up(struct spk_synth *synth); void spk_synth_flush(struct spk_synth *synth); +unsigned char spk_synth_get_index(struct spk_synth *synth); int spk_synth_is_alive_nop(struct spk_synth *synth); int spk_synth_is_alive_restart(struct spk_synth *synth); __printf(1, 2) diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h index c156975392c8..ad7b9480a37f 100644 --- a/drivers/staging/speakup/spk_types.h +++ b/drivers/staging/speakup/spk_types.h @@ -152,6 +152,8 @@ struct spk_io_ops { int (*synth_out)(struct spk_synth *synth, const char ch); void (*send_xchar)(char ch); void (*tiocmset)(unsigned int set, unsigned int clear); + unsigned char (*synth_in)(void); + unsigned char (*synth_in_nowait)(void); }; struct spk_synth { @@ -182,7 +184,7 @@ struct spk_synth { int (*is_alive)(struct spk_synth *synth); int (*synth_adjust)(struct st_var_header *var); void (*read_buff_add)(u_char); - unsigned char (*get_index)(void); + unsigned char (*get_index)(struct spk_synth *synth); struct synth_indexing indexing; int alive; struct attribute_group attributes; diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index 352e9eebc3de..9c2aa1b8b0ac 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -124,6 +124,12 @@ void spk_synth_flush(struct spk_synth *synth) } EXPORT_SYMBOL_GPL(spk_synth_flush); +unsigned char spk_synth_get_index(struct spk_synth *synth) +{ + return synth->io_ops->synth_in_nowait(); +} +EXPORT_SYMBOL_GPL(spk_synth_get_index); + int spk_synth_is_alive_nop(struct spk_synth *synth) { synth->alive = 1; @@ -249,7 +255,7 @@ void spk_reset_index_count(int sc) if (first) first = 0; else - synth->get_index(); + synth->get_index(synth); index_count = 0; sentence_count = sc; } @@ -282,7 +288,7 @@ void synth_insert_next_index(int sent_num) void spk_get_index_count(int *linecount, int *sentcount) { - int ind = synth->get_index(); + int ind = synth->get_index(synth); if (ind) { sentence_count = ind % 10; -- cgit v1.2.3-55-g7522 From c53e5c28170899c6eef224ca1635a345cedb674c Mon Sep 17 00:00:00 2001 From: Tiago Koji Castro Shibata Date: Mon, 1 May 2017 21:32:38 -0300 Subject: drivers/staging/speakup: Align block comments at * Fix checkpatch.pl "WARNING: Block comments should align the * on each line" Signed-off-by: Tiago Koji Castro Shibata Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/speakup_dtlk.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/speakup_dtlk.h b/drivers/staging/speakup/speakup_dtlk.h index 46d885fcfb20..51ac0f2fcded 100644 --- a/drivers/staging/speakup/speakup_dtlk.h +++ b/drivers/staging/speakup/speakup_dtlk.h @@ -24,11 +24,11 @@ * usec later. */ #define TTS_ALMOST_FULL 0x08 /* mask for AF bit: When set to 1, - * indicates that less than 300 bytes - * are available in the TTS input - * buffer. AF is always 0 in the PCM, - * TGN and CVSD modes. - */ + * indicates that less than 300 bytes + * are available in the TTS input + * buffer. AF is always 0 in the PCM, + * TGN and CVSD modes. + */ #define TTS_ALMOST_EMPTY 0x04 /* mask for AE bit: When set to 1, * indicates that less than 300 bytes * are remaining in DoubleTalk's input -- cgit v1.2.3-55-g7522 From 6bbd04c653bdbfe2b1908002c4f7feaf0f021dcc Mon Sep 17 00:00:00 2001 From: Michael Mera Date: Wed, 10 May 2017 08:48:11 +0900 Subject: staging: speakup: fix unnecessary long line Fix checkpatch message: WARNING: line over 80 characters Change "bit mask" for "bitmask" to have a line shorter than 80 characters. Signed-off-by: Michael Mera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/speakup_decpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c index 5d22c3b7edd4..7a8df7dc1e38 100644 --- a/drivers/staging/speakup/speakup_decpc.c +++ b/drivers/staging/speakup/speakup_decpc.c @@ -84,7 +84,7 @@ #define CTRL_last_index 0x0b00 /* get last index spoken */ #define CTRL_io_priority 0x0c00 /* change i/o priority */ #define CTRL_free_mem 0x0d00 /* get free paragraphs on module */ -#define CTRL_get_lang 0x0e00 /* return bit mask of loaded languages */ +#define CTRL_get_lang 0x0e00 /* return bitmask of loaded languages */ #define CMD_test 0x2000 /* self-test request */ #define TEST_mask 0x0F00 /* isolate test field */ #define TEST_null 0x0000 /* no test requested */ -- cgit v1.2.3-55-g7522 From b1bb2e33ae1fa93a8e00c2625fa344e6e6c234a6 Mon Sep 17 00:00:00 2001 From: Thibaut SAUTEREAU Date: Fri, 12 May 2017 11:37:54 +0200 Subject: staging: wlan-ng: convert endianness in situ for prism2fw Fix several sparse warnings about casts to restricted little-endian. Signed-off-by: Thibaut SAUTEREAU Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2fw.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c index afd877fb4557..1a0c786c7616 100644 --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -617,28 +617,28 @@ static int mkpdrlist(struct pda *pda) HFA384x_PDR_NICID) { memcpy(&nicid, &pda->rec[pda->nrec]->data.nicid, sizeof(nicid)); - nicid.id = le16_to_cpu(nicid.id); - nicid.variant = le16_to_cpu(nicid.variant); - nicid.major = le16_to_cpu(nicid.major); - nicid.minor = le16_to_cpu(nicid.minor); + le16_to_cpus(&nicid.id); + le16_to_cpus(&nicid.variant); + le16_to_cpus(&nicid.major); + le16_to_cpus(&nicid.minor); } if (le16_to_cpu(pda->rec[pda->nrec]->code) == HFA384x_PDR_MFISUPRANGE) { memcpy(&rfid, &pda->rec[pda->nrec]->data.mfisuprange, sizeof(rfid)); - rfid.id = le16_to_cpu(rfid.id); - rfid.variant = le16_to_cpu(rfid.variant); - rfid.bottom = le16_to_cpu(rfid.bottom); - rfid.top = le16_to_cpu(rfid.top); + le16_to_cpus(&rfid.id); + le16_to_cpus(&rfid.variant); + le16_to_cpus(&rfid.bottom); + le16_to_cpus(&rfid.top); } if (le16_to_cpu(pda->rec[pda->nrec]->code) == HFA384x_PDR_CFISUPRANGE) { memcpy(&macid, &pda->rec[pda->nrec]->data.cfisuprange, sizeof(macid)); - macid.id = le16_to_cpu(macid.id); - macid.variant = le16_to_cpu(macid.variant); - macid.bottom = le16_to_cpu(macid.bottom); - macid.top = le16_to_cpu(macid.top); + le16_to_cpus(&macid.id); + le16_to_cpus(&macid.variant); + le16_to_cpus(&macid.bottom); + le16_to_cpus(&macid.top); } (pda->nrec)++; -- cgit v1.2.3-55-g7522 From a6fce69fa3d2b13e3579c12872a1f08dd72342e1 Mon Sep 17 00:00:00 2001 From: Thibaut SAUTEREAU Date: Fri, 12 May 2017 11:39:25 +0200 Subject: staging: wlan-ng: convert endianness in situ for prism2sta Fix several sparse warnings about casts to restricted little-endian by using in situ conversions. Signed-off-by: Thibaut SAUTEREAU Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2sta.c | 100 ++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 9c2b4ef2de58..e16da34389cd 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -603,10 +603,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) } /* get all the nic id fields in host byte order */ - hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id); - hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant); - hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major); - hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor); + le16_to_cpus(&hw->ident_nic.id); + le16_to_cpus(&hw->ident_nic.variant); + le16_to_cpus(&hw->ident_nic.major); + le16_to_cpus(&hw->ident_nic.minor); netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n", hw->ident_nic.id, hw->ident_nic.major, @@ -622,10 +622,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) } /* get all the private fw id fields in host byte order */ - hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id); - hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant); - hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major); - hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor); + le16_to_cpus(&hw->ident_pri_fw.id); + le16_to_cpus(&hw->ident_pri_fw.variant); + le16_to_cpus(&hw->ident_pri_fw.major); + le16_to_cpus(&hw->ident_pri_fw.minor); netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n", hw->ident_pri_fw.id, hw->ident_pri_fw.major, @@ -648,10 +648,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) } /* get all the station fw id fields in host byte order */ - hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id); - hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant); - hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major); - hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor); + le16_to_cpus(&hw->ident_sta_fw.id); + le16_to_cpus(&hw->ident_sta_fw.variant); + le16_to_cpus(&hw->ident_sta_fw.major); + le16_to_cpus(&hw->ident_sta_fw.minor); /* strip out the 'special' variant bits */ hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14); @@ -683,11 +683,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, modem interface supplier * fields in byte order */ - hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role); - hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id); - hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant); - hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom); - hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top); + le16_to_cpus(&hw->cap_sup_mfi.role); + le16_to_cpus(&hw->cap_sup_mfi.id); + le16_to_cpus(&hw->cap_sup_mfi.variant); + le16_to_cpus(&hw->cap_sup_mfi.bottom); + le16_to_cpus(&hw->cap_sup_mfi.top); netdev_info(wlandev->netdev, "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -707,11 +707,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, controller interface supplier * fields in byte order */ - hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role); - hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id); - hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant); - hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom); - hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top); + le16_to_cpus(&hw->cap_sup_cfi.role); + le16_to_cpus(&hw->cap_sup_cfi.id); + le16_to_cpus(&hw->cap_sup_cfi.variant); + le16_to_cpus(&hw->cap_sup_cfi.bottom); + le16_to_cpus(&hw->cap_sup_cfi.top); netdev_info(wlandev->netdev, "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -731,11 +731,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, primary firmware supplier * fields in byte order */ - hw->cap_sup_pri.role = le16_to_cpu(hw->cap_sup_pri.role); - hw->cap_sup_pri.id = le16_to_cpu(hw->cap_sup_pri.id); - hw->cap_sup_pri.variant = le16_to_cpu(hw->cap_sup_pri.variant); - hw->cap_sup_pri.bottom = le16_to_cpu(hw->cap_sup_pri.bottom); - hw->cap_sup_pri.top = le16_to_cpu(hw->cap_sup_pri.top); + le16_to_cpus(&hw->cap_sup_pri.role); + le16_to_cpus(&hw->cap_sup_pri.id); + le16_to_cpus(&hw->cap_sup_pri.variant); + le16_to_cpus(&hw->cap_sup_pri.bottom); + le16_to_cpus(&hw->cap_sup_pri.top); netdev_info(wlandev->netdev, "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -755,11 +755,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, station firmware supplier * fields in byte order */ - hw->cap_sup_sta.role = le16_to_cpu(hw->cap_sup_sta.role); - hw->cap_sup_sta.id = le16_to_cpu(hw->cap_sup_sta.id); - hw->cap_sup_sta.variant = le16_to_cpu(hw->cap_sup_sta.variant); - hw->cap_sup_sta.bottom = le16_to_cpu(hw->cap_sup_sta.bottom); - hw->cap_sup_sta.top = le16_to_cpu(hw->cap_sup_sta.top); + le16_to_cpus(&hw->cap_sup_sta.role); + le16_to_cpus(&hw->cap_sup_sta.id); + le16_to_cpus(&hw->cap_sup_sta.variant); + le16_to_cpus(&hw->cap_sup_sta.bottom); + le16_to_cpus(&hw->cap_sup_sta.top); if (hw->cap_sup_sta.id == 0x04) { netdev_info(wlandev->netdev, @@ -787,11 +787,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, primary f/w actor, CFI supplier * fields in byte order */ - hw->cap_act_pri_cfi.role = le16_to_cpu(hw->cap_act_pri_cfi.role); - hw->cap_act_pri_cfi.id = le16_to_cpu(hw->cap_act_pri_cfi.id); - hw->cap_act_pri_cfi.variant = le16_to_cpu(hw->cap_act_pri_cfi.variant); - hw->cap_act_pri_cfi.bottom = le16_to_cpu(hw->cap_act_pri_cfi.bottom); - hw->cap_act_pri_cfi.top = le16_to_cpu(hw->cap_act_pri_cfi.top); + le16_to_cpus(&hw->cap_act_pri_cfi.role); + le16_to_cpus(&hw->cap_act_pri_cfi.id); + le16_to_cpus(&hw->cap_act_pri_cfi.variant); + le16_to_cpus(&hw->cap_act_pri_cfi.bottom); + le16_to_cpus(&hw->cap_act_pri_cfi.top); netdev_info(wlandev->netdev, "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -811,11 +811,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, station f/w actor, CFI supplier * fields in byte order */ - hw->cap_act_sta_cfi.role = le16_to_cpu(hw->cap_act_sta_cfi.role); - hw->cap_act_sta_cfi.id = le16_to_cpu(hw->cap_act_sta_cfi.id); - hw->cap_act_sta_cfi.variant = le16_to_cpu(hw->cap_act_sta_cfi.variant); - hw->cap_act_sta_cfi.bottom = le16_to_cpu(hw->cap_act_sta_cfi.bottom); - hw->cap_act_sta_cfi.top = le16_to_cpu(hw->cap_act_sta_cfi.top); + le16_to_cpus(&hw->cap_act_sta_cfi.role); + le16_to_cpus(&hw->cap_act_sta_cfi.id); + le16_to_cpus(&hw->cap_act_sta_cfi.variant); + le16_to_cpus(&hw->cap_act_sta_cfi.bottom); + le16_to_cpus(&hw->cap_act_sta_cfi.top); netdev_info(wlandev->netdev, "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -835,11 +835,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, station f/w actor, MFI supplier * fields in byte order */ - hw->cap_act_sta_mfi.role = le16_to_cpu(hw->cap_act_sta_mfi.role); - hw->cap_act_sta_mfi.id = le16_to_cpu(hw->cap_act_sta_mfi.id); - hw->cap_act_sta_mfi.variant = le16_to_cpu(hw->cap_act_sta_mfi.variant); - hw->cap_act_sta_mfi.bottom = le16_to_cpu(hw->cap_act_sta_mfi.bottom); - hw->cap_act_sta_mfi.top = le16_to_cpu(hw->cap_act_sta_mfi.top); + le16_to_cpus(&hw->cap_act_sta_mfi.role); + le16_to_cpus(&hw->cap_act_sta_mfi.id); + le16_to_cpus(&hw->cap_act_sta_mfi.variant); + le16_to_cpus(&hw->cap_act_sta_mfi.bottom); + le16_to_cpus(&hw->cap_act_sta_mfi.top); netdev_info(wlandev->netdev, "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -1478,8 +1478,8 @@ static void prism2sta_inf_assocstatus(struct wlandevice *wlandev, int i; memcpy(&rec, &inf->info.assocstatus, sizeof(rec)); - rec.assocstatus = le16_to_cpu(rec.assocstatus); - rec.reason = le16_to_cpu(rec.reason); + le16_to_cpus(&rec.assocstatus); + le16_to_cpus(&rec.reason); /* * Find the address in the list of authenticated stations. @@ -1748,7 +1748,7 @@ static void prism2sta_inf_psusercnt(struct wlandevice *wlandev, void prism2sta_ev_info(struct wlandevice *wlandev, struct hfa384x_inf_frame *inf) { - inf->infotype = le16_to_cpu(inf->infotype); + le16_to_cpus(&inf->infotype); /* Dispatch */ switch (inf->infotype) { case HFA384x_IT_HANDOVERADDR: -- cgit v1.2.3-55-g7522 From e0f6aae87b93caca0ff48a7956f4ef35f24af30e Mon Sep 17 00:00:00 2001 From: Sucha Supittayapornpong Date: Fri, 12 May 2017 10:55:58 -0700 Subject: staging: vt6655: Add identifier names to function definition This patch fixes the checkpatch.pl warnings: WARNING: function definition argument 'struct vnt_private *' should also have an identifier name +void CARDvSetRSPINF(struct vnt_private *, u8); Identifiers priv and bb_type, added to CARDvSetRSPINF definition, are the names used in the function declaration. Signed-off-by: Sucha Supittayapornpong Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/card.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h index 44420b5a445f..03369ffaa4d6 100644 --- a/drivers/staging/vt6655/card.h +++ b/drivers/staging/vt6655/card.h @@ -63,7 +63,7 @@ typedef enum _CARD_STATUS_TYPE { struct vnt_private; -void CARDvSetRSPINF(struct vnt_private *, u8); +void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type); void CARDvUpdateBasicTopRate(struct vnt_private *); bool CARDbIsOFDMinBasicRate(struct vnt_private *); void CARDvSetLoopbackMode(struct vnt_private *, unsigned short wLoopbackMode); -- cgit v1.2.3-55-g7522 From 7d4c9787b7c205804781ea9a2ecd47bbd5981473 Mon Sep 17 00:00:00 2001 From: Riccardo Marotti Date: Fri, 12 May 2017 11:37:42 +0200 Subject: Staging: rtl8192u: ieee80211: ieee80211_module.c: fix style issue Fixed a brace coding style issue, found via checkpatch. Signed-off-by: Riccardo Marotti Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index a791175b86f5..8f236b332a47 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -157,8 +157,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee80211_softmac_init(ieee); ieee->pHTInfo = kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); - if (ieee->pHTInfo == NULL) - { + if (ieee->pHTInfo == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n"); goto failed; } -- cgit v1.2.3-55-g7522 From 55031da457bab855d455b431177f79c7c15b67b0 Mon Sep 17 00:00:00 2001 From: Suniel Mahesh Date: Fri, 12 May 2017 21:16:35 +0530 Subject: staging: rtl8192u: Fix type mismatch warnings reported by sparse Mk16_le() is an inline function returning le16_to_cpu() which is causing type mismatch warnings. Removed Mk16_le() and replaced it with le16_to_cpu() with appropriate argument type as suggested by Greg K-H. Signed-off-by: Suniel Mahesh Signed-off-by: Greg Kroah-Hartman --- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 27 ++++++++-------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index 5039172409e3..60ecfec71112 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -171,13 +171,6 @@ static inline u16 Mk16(u8 hi, u8 lo) return lo | (((u16) hi) << 8); } - -static inline u16 Mk16_le(u16 *v) -{ - return le16_to_cpu(*v); -} - - static const u16 Sbox[256] = { 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, @@ -264,15 +257,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, PPK[5] = TTAK[4] + IV16; /* Step 2 - 96-bit bijective mixing using S-box */ - PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0])); - PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2])); - PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4])); - PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6])); - PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8])); - PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10])); - - PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12])); - PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14])); + PPK[0] += _S_(PPK[5] ^ le16_to_cpu(*(__le16 *)(&TK[0]))); + PPK[1] += _S_(PPK[0] ^ le16_to_cpu(*(__le16 *)(&TK[2]))); + PPK[2] += _S_(PPK[1] ^ le16_to_cpu(*(__le16 *)(&TK[4]))); + PPK[3] += _S_(PPK[2] ^ le16_to_cpu(*(__le16 *)(&TK[6]))); + PPK[4] += _S_(PPK[3] ^ le16_to_cpu(*(__le16 *)(&TK[8]))); + PPK[5] += _S_(PPK[4] ^ le16_to_cpu(*(__le16 *)(&TK[10]))); + + PPK[0] += RotR1(PPK[5] ^ le16_to_cpu(*(__le16 *)(&TK[12]))); + PPK[1] += RotR1(PPK[0] ^ le16_to_cpu(*(__le16 *)(&TK[14]))); PPK[2] += RotR1(PPK[1]); PPK[3] += RotR1(PPK[2]); PPK[4] += RotR1(PPK[3]); @@ -285,7 +278,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, WEPSeed[0] = Hi8(IV16); WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; WEPSeed[2] = Lo8(IV16); - WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1); + WEPSeed[3] = Lo8((PPK[5] ^ le16_to_cpu(*(__le16 *)(&TK[0]))) >> 1); #ifdef __BIG_ENDIAN { -- cgit v1.2.3-55-g7522 From ef6cf365ca0f9367420ca7402ca7e11d8a0fc689 Mon Sep 17 00:00:00 2001 From: Aleksey Kurbatov Date: Fri, 12 May 2017 21:23:16 +0300 Subject: staging: rtl8712: use octal permissions Using octal permissions instead of symbolic ones is preferred. Signed-off-by: Aleksey Kurbatov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/os_intfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 8836b31b4ef8..e698f6ede449 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -93,7 +93,7 @@ static char *initmac; */ static int wifi_test; -module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO | S_IWUSR); +module_param_string(ifname, ifname, sizeof(ifname), 0644); module_param(wifi_test, int, 0644); module_param(initmac, charp, 0644); module_param(video_mode, int, 0644); -- cgit v1.2.3-55-g7522 From 814f3be22e20bc848cc16e53ec325c3f6814c5ca Mon Sep 17 00:00:00 2001 From: Brett Hitchcock Date: Sun, 14 May 2017 13:20:03 -0700 Subject: staging: fsl-mc: Fix code alignment style issues Fixing recommendation from checkpatch.pl: "CHECK: Alignment should match open parenthesis" Signed-off-by: Brett Hitchcock Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 4 ++-- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index e4b0341d42d7..d723c69a9151 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -681,8 +681,8 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) } if (major_ver < DPRC_MIN_VER_MAJOR || - (major_ver == DPRC_MIN_VER_MAJOR && - minor_ver < DPRC_MIN_VER_MINOR)) { + (major_ver == DPRC_MIN_VER_MAJOR && + minor_ver < DPRC_MIN_VER_MINOR)) { dev_err(&mc_dev->dev, "ERROR: DPRC version %d.%d not supported\n", major_ver, minor_ver); diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 3be5f25ff113..50eb41588a65 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -644,10 +644,10 @@ static int get_mc_addr_translation_ranges(struct device *dev, const __be32 *cell; ret = parse_mc_ranges(dev, - &paddr_cells, - &mc_addr_cells, - &mc_size_cells, - &ranges_start); + &paddr_cells, + &mc_addr_cells, + &mc_size_cells, + &ranges_start); if (ret < 0) return ret; -- cgit v1.2.3-55-g7522 From 8f931dcd0c6919f7035d31773e8cd56f8ac6412b Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 13 May 2017 17:41:17 +0100 Subject: staging: rtl8192e: Remove RX: IEEE802.1X EAPOL frame! warning. RX will receive countless EAPOL frames over the life of the connection. A number of conditional calls to rtllib_is_eapol_frame are made in this function. So this call serves no purpose other than to spam logs with false warning that it is indeed a EAPOL frame, remove it. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 43a77745e6fb..0033dc6979e7 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1214,9 +1214,6 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, return -1; } - if (rtllib_is_eapol_frame(ieee, skb, hdrlen)) - netdev_warn(ieee->dev, "RX: IEEE802.1X EAPOL frame!\n"); - return 0; } -- cgit v1.2.3-55-g7522 From 6b675ad8b30c0daa7ba3b6705db9cf2071413f61 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 13 May 2017 17:41:18 +0100 Subject: staging: rtl8192e: print alg name as debug. alg name will be printed a number times during a connection it is only really useful as a debug message. Change to netdev_dbg. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index c5c0d9676dc8..f7eba01b5d15 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -595,7 +595,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, ret = -EINVAL; goto done; } - netdev_info(dev, "alg name:%s\n", alg); + netdev_dbg(dev, "alg name:%s\n", alg); ops = lib80211_get_crypto_ops(alg); if (ops == NULL) { -- cgit v1.2.3-55-g7522 From ad3cafd7b4c2543933fedf915663637b1797c531 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 13 May 2017 17:41:19 +0100 Subject: staging: rtl8192e: HTSetConnectBwMode message replace with debug. The flag status of bCurBW40MHz is printed as info and is only useful as debug message. Replace with netdev_dbg in line with rest of driver. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_HTProc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 4ae1d382ac5c..f0e11726a72a 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -908,8 +908,8 @@ void HTSetConnectBwMode(struct rtllib_device *ieee, pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT; } - pr_info("%s():pHTInfo->bCurBW40MHz:%x\n", __func__, - pHTInfo->bCurBW40MHz); + netdev_dbg(ieee->dev, "%s():pHTInfo->bCurBW40MHz:%x\n", __func__, + pHTInfo->bCurBW40MHz); pHTInfo->bSwBwInProgress = true; -- cgit v1.2.3-55-g7522 From 95b80b30e1734946ab2e0412dce9c28079340d67 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 13 May 2017 17:41:20 +0100 Subject: staging: rtl8192e: Let user know mac address associated with. User cannot tell which mac address(BSIDD) associated with so add this to info message. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index eeda17d6409b..776e99741431 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1525,7 +1525,8 @@ static void rtllib_associate_complete_wq(void *data) associate_complete_wq); struct rt_pwr_save_ctrl *pPSC = &(ieee->PowerSaveControl); - netdev_info(ieee->dev, "Associated successfully\n"); + netdev_info(ieee->dev, "Associated successfully with %pM\n", + ieee->current_network.bssid); if (!ieee->is_silent_reset) { netdev_info(ieee->dev, "normal associate\n"); notify_wx_assoc_event(ieee); -- cgit v1.2.3-55-g7522 From 0e3e19cbd8c46b58103433f2b284aef7cabcad92 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 13 May 2017 17:41:21 +0100 Subject: staging: rtl8192e: _rtl92e_dm_check_edca_turbo remove peername message. This kinda reports this as if it was an error message. Now that bssid is reported at associate remove this piece of code serves no purpose as there is no code for peers so remove it. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 1a43c684f9f3..b8205ebafd72 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1693,22 +1693,6 @@ static void _rtl92e_dm_check_edca_turbo(struct net_device *dev) if (priv->rtllib->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO) goto dm_CheckEdcaTurbo_EXIT; - { - u8 *peername[11] = { - "unknown", "realtek_90", "realtek_92se", "broadcom", - "ralink", "atheros", "cisco", "marvell", "92u_softap", - "self_softap" - }; - static int wb_tmp; - - if (wb_tmp == 0) { - netdev_info(dev, - "%s():iot peer is %s, bssid: %pM\n", - __func__, peername[pHTInfo->IOTPeer], - priv->rtllib->current_network.bssid); - wb_tmp = 1; - } - } if (!priv->rtllib->bis_any_nonbepkts) { curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt; curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt; -- cgit v1.2.3-55-g7522 From 1e029b836108d0b68ba574482604247c97cb4757 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Tue, 16 May 2017 10:01:38 +0200 Subject: staging: greybus: arche: remove timesync remains Remove the remaining timesync bits that were left in the arche platform driver and which prevented the driver from being compiled. Fixes: bdfb95c4baab ("staging: greybus: remove timesync protocol support") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/arche-apb-ctrl.c | 11 +-- drivers/staging/greybus/arche-platform.c | 143 ------------------------------- drivers/staging/greybus/arche_platform.h | 8 -- 3 files changed, 3 insertions(+), 159 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c index 02243b4fd898..0412f3d06efb 100644 --- a/drivers/staging/greybus/arche-apb-ctrl.c +++ b/drivers/staging/greybus/arche-apb-ctrl.c @@ -22,6 +22,8 @@ #include "arche_platform.h" +static void apb_bootret_deassert(struct device *dev); + struct arche_apb_ctrl_drvdata { /* Control GPIO signals to and from AP <=> AP Bridges */ int resetn_gpio; @@ -222,14 +224,7 @@ static void poweroff_seq(struct platform_device *pdev) /* TODO: May have to send an event to SVC about this exit */ } -void apb_bootret_assert(struct device *dev) -{ - struct arche_apb_ctrl_drvdata *apb = dev_get_drvdata(dev); - - gpio_set_value(apb->boot_ret_gpio, 1); -} - -void apb_bootret_deassert(struct device *dev) +static void apb_bootret_deassert(struct device *dev) { struct arche_apb_ctrl_drvdata *apb = dev_get_drvdata(dev); diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index aac1145f1983..9e644bfe2ae0 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -35,7 +35,6 @@ enum svc_wakedetect_state { WD_STATE_STANDBYBOOT_TRIG, /* As of now not used ?? */ WD_STATE_COLDBOOT_START, /* Cold boot process started */ WD_STATE_STANDBYBOOT_START, /* Not used */ - WD_STATE_TIMESYNC, }; struct arche_platform_drvdata { @@ -59,26 +58,12 @@ struct arche_platform_drvdata { int wake_detect_irq; spinlock_t wake_lock; /* Protect wake_detect_state */ struct mutex platform_state_mutex; /* Protect state */ - wait_queue_head_t wq; /* WQ for arche_pdata->state */ unsigned long wake_detect_start; struct notifier_block pm_notifier; struct device *dev; - struct gb_timesync_svc *timesync_svc_pdata; }; -static int arche_apb_bootret_assert(struct device *dev, void *data) -{ - apb_bootret_assert(dev); - return 0; -} - -static int arche_apb_bootret_deassert(struct device *dev, void *data) -{ - apb_bootret_deassert(dev); - return 0; -} - /* Requires calling context to hold arche_pdata->platform_state_mutex */ static void arche_platform_set_state(struct arche_platform_drvdata *arche_pdata, enum arche_platform_state state) @@ -86,112 +71,6 @@ static void arche_platform_set_state(struct arche_platform_drvdata *arche_pdata, arche_pdata->state = state; } -/* - * arche_platform_change_state: Change the operational state - * - * This exported function allows external drivers to change the state - * of the arche-platform driver. - * Note that this function only supports transitions between two states - * with limited functionality. - * - * - ARCHE_PLATFORM_STATE_TIME_SYNC: - * Once set, allows timesync operations between SVC <=> AP and makes - * sure that arche-platform driver ignores any subsequent events/pulses - * from SVC over wake/detect. - * - * - ARCHE_PLATFORM_STATE_ACTIVE: - * Puts back driver to active state, where any pulse from SVC on wake/detect - * line would trigger either cold/standby boot. - * Note: Transition request from this function does not trigger cold/standby - * boot. It just puts back driver book keeping variable back to ACTIVE - * state and restores the interrupt. - * - * Returns -ENODEV if device not found, -EAGAIN if the driver cannot currently - * satisfy the requested state-transition or -EINVAL for all other - * state-transition requests. - */ -int arche_platform_change_state(enum arche_platform_state state, - struct gb_timesync_svc *timesync_svc_pdata) -{ - struct arche_platform_drvdata *arche_pdata; - struct platform_device *pdev; - struct device_node *np; - int ret = -EAGAIN; - unsigned long flags; - - np = of_find_compatible_node(NULL, NULL, "google,arche-platform"); - if (!np) { - pr_err("google,arche-platform device node not found\n"); - return -ENODEV; - } - - pdev = of_find_device_by_node(np); - if (!pdev) { - pr_err("arche-platform device not found\n"); - of_node_put(np); - return -ENODEV; - } - - arche_pdata = platform_get_drvdata(pdev); - - mutex_lock(&arche_pdata->platform_state_mutex); - spin_lock_irqsave(&arche_pdata->wake_lock, flags); - - if (arche_pdata->state == state) { - ret = 0; - goto exit; - } - - switch (state) { - case ARCHE_PLATFORM_STATE_TIME_SYNC: - if (arche_pdata->state != ARCHE_PLATFORM_STATE_ACTIVE) { - ret = -EINVAL; - goto exit; - } - if (arche_pdata->wake_detect_state != WD_STATE_IDLE) { - dev_err(arche_pdata->dev, - "driver busy with wake/detect line ops\n"); - goto exit; - } - device_for_each_child(arche_pdata->dev, NULL, - arche_apb_bootret_assert); - arche_pdata->wake_detect_state = WD_STATE_TIMESYNC; - break; - case ARCHE_PLATFORM_STATE_ACTIVE: - if (arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC) { - ret = -EINVAL; - goto exit; - } - device_for_each_child(arche_pdata->dev, NULL, - arche_apb_bootret_deassert); - arche_pdata->wake_detect_state = WD_STATE_IDLE; - break; - case ARCHE_PLATFORM_STATE_OFF: - case ARCHE_PLATFORM_STATE_STANDBY: - case ARCHE_PLATFORM_STATE_FW_FLASHING: - dev_err(arche_pdata->dev, "busy, request to retry later\n"); - goto exit; - default: - ret = -EINVAL; - dev_err(arche_pdata->dev, - "invalid state transition request\n"); - goto exit; - } - arche_pdata->timesync_svc_pdata = timesync_svc_pdata; - arche_platform_set_state(arche_pdata, state); - if (state == ARCHE_PLATFORM_STATE_ACTIVE) - wake_up(&arche_pdata->wq); - - ret = 0; -exit: - spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); - mutex_unlock(&arche_pdata->platform_state_mutex); - put_device(&pdev->dev); - of_node_put(np); - return ret; -} -EXPORT_SYMBOL_GPL(arche_platform_change_state); - /* Requires arche_pdata->wake_lock is held by calling context */ static void arche_platform_set_wake_detect_state( struct arche_platform_drvdata *arche_pdata, @@ -275,11 +154,6 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid) spin_lock_irqsave(&arche_pdata->wake_lock, flags); - if (arche_pdata->wake_detect_state == WD_STATE_TIMESYNC) { - gb_timesync_irq(arche_pdata->timesync_svc_pdata); - goto exit; - } - if (gpio_get_value(arche_pdata->wake_detect_gpio)) { /* wake/detect rising */ @@ -323,7 +197,6 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid) } } -exit: spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); return IRQ_HANDLED; @@ -436,17 +309,7 @@ static ssize_t state_store(struct device *dev, struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev); int ret = 0; -retry: mutex_lock(&arche_pdata->platform_state_mutex); - if (arche_pdata->state == ARCHE_PLATFORM_STATE_TIME_SYNC) { - mutex_unlock(&arche_pdata->platform_state_mutex); - ret = wait_event_interruptible( - arche_pdata->wq, - arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC); - if (ret) - return ret; - goto retry; - } if (sysfs_streq(buf, "off")) { if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF) @@ -517,8 +380,6 @@ static ssize_t state_show(struct device *dev, return sprintf(buf, "standby\n"); case ARCHE_PLATFORM_STATE_FW_FLASHING: return sprintf(buf, "fw_flashing\n"); - case ARCHE_PLATFORM_STATE_TIME_SYNC: - return sprintf(buf, "time_sync\n"); default: return sprintf(buf, "unknown state\n"); } @@ -665,7 +526,6 @@ static int arche_platform_probe(struct platform_device *pdev) spin_lock_init(&arche_pdata->wake_lock); mutex_init(&arche_pdata->platform_state_mutex); - init_waitqueue_head(&arche_pdata->wq); arche_pdata->wake_detect_irq = gpio_to_irq(arche_pdata->wake_detect_gpio); @@ -701,9 +561,6 @@ static int arche_platform_probe(struct platform_device *pdev) goto err_device_remove; } - /* Register callback pointer */ - arche_platform_change_state_cb = arche_platform_change_state; - /* Explicitly power off if requested */ if (!of_property_read_bool(pdev->dev.of_node, "arche,init-off")) { mutex_lock(&arche_pdata->platform_state_mutex); diff --git a/drivers/staging/greybus/arche_platform.h b/drivers/staging/greybus/arche_platform.h index c0591df9b9d6..bcffc69d0960 100644 --- a/drivers/staging/greybus/arche_platform.h +++ b/drivers/staging/greybus/arche_platform.h @@ -15,14 +15,8 @@ enum arche_platform_state { ARCHE_PLATFORM_STATE_ACTIVE, ARCHE_PLATFORM_STATE_STANDBY, ARCHE_PLATFORM_STATE_FW_FLASHING, - ARCHE_PLATFORM_STATE_TIME_SYNC, }; -int arche_platform_change_state(enum arche_platform_state state, - struct gb_timesync_svc *pdata); - -extern int (*arche_platform_change_state_cb)(enum arche_platform_state state, - struct gb_timesync_svc *pdata); int __init arche_apb_init(void); void __exit arche_apb_exit(void); @@ -31,7 +25,5 @@ int apb_ctrl_coldboot(struct device *dev); int apb_ctrl_fw_flashing(struct device *dev); int apb_ctrl_standby_boot(struct device *dev); void apb_ctrl_poweroff(struct device *dev); -void apb_bootret_assert(struct device *dev); -void apb_bootret_deassert(struct device *dev); #endif /* __ARCHE_PLATFORM_H */ -- cgit v1.2.3-55-g7522 From 2eccd4aa19fc88e48e4be4d86f271a266d95e6d0 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Tue, 16 May 2017 10:01:39 +0200 Subject: staging: greybus: enable compile testing of arche driver Add Arche platform-driver config option and allow the driver to be compile tested also without the out-of-tree usb3613 driver. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/Kconfig | 10 ++++++++++ drivers/staging/greybus/Makefile | 2 +- drivers/staging/greybus/arche-platform.c | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig index 50de2d72dde0..ab096bcef98c 100644 --- a/drivers/staging/greybus/Kconfig +++ b/drivers/staging/greybus/Kconfig @@ -216,4 +216,14 @@ config GREYBUS_USB will be called gb-usb.ko endif # GREYBUS_BRIDGED_PHY + +config GREYBUS_ARCHE + tristate "Greybus Arche Platform driver" + depends on USB_HSIC_USB3613 || COMPILE_TEST + ---help--- + Select this option if you have an Arche device. + + To compile this code as a module, chose M here: the module + will be called gb-arche.ko + endif # GREYBUS diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile index b26b9a35bdd5..23e1cb7bff8e 100644 --- a/drivers/staging/greybus/Makefile +++ b/drivers/staging/greybus/Makefile @@ -91,4 +91,4 @@ obj-$(CONFIG_GREYBUS_USB) += gb-usb.o # Greybus Platform driver gb-arche-y := arche-platform.o arche-apb-ctrl.o -obj-$(CONFIG_USB_HSIC_USB3613) += gb-arche.o +obj-$(CONFIG_GREYBUS_ARCHE) += gb-arche.o diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index 9e644bfe2ae0..5bce5e039596 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -24,7 +24,14 @@ #include "arche_platform.h" #include "greybus.h" +#if IS_ENABLED(CONFIG_USB_HSIC_USB3613) #include +#else +static inline int usb3613_hub_mode_ctrl(bool unused) +{ + return 0; +} +#endif #define WD_COLDBOOT_PULSE_WIDTH_MS 30 -- cgit v1.2.3-55-g7522 From f14868defb9bf4e727a5afb891ed39777051b2b7 Mon Sep 17 00:00:00 2001 From: Pushkar Jambhlekar Date: Tue, 16 May 2017 14:01:51 +0530 Subject: drivers/staging/ccree: Replacing spaces by tab Fixing 'checkpatch.pl' ERROR: code indent should use tabs where possible Signed-off-by: Pushkar Jambhlekar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 0941da7cb124..26afa8794668 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -96,7 +96,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) SSI_LOG_DEBUG("Clearing context @%p for %s\n", crypto_aead_ctx(tfm), crypto_tfm_alg_name(&(tfm->base))); - dev = &ctx->drvdata->plat_dev->dev; + dev = &ctx->drvdata->plat_dev->dev; /* Unmap enckey buffer */ if (ctx->enckey != NULL) { SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->enckey_dma_addr); @@ -2334,22 +2334,22 @@ static int ssi_gcm_setauthsize(struct crypto_aead *authenc, static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, unsigned int authsize) { - SSI_LOG_DEBUG("ssi_rfc4106_gcm_setauthsize() authsize %d \n", authsize ); - - switch (authsize) { - case 8: - case 12: - case 16: - break; - default: - return -EINVAL; - } - - return ssi_aead_setauthsize(authenc, authsize); + SSI_LOG_DEBUG("ssi_rfc4106_gcm_setauthsize() authsize %d \n", authsize ); + + switch (authsize) { + case 8: + case 12: + case 16: + break; + default: + return -EINVAL; + } + + return ssi_aead_setauthsize(authenc, authsize); } static int ssi_rfc4543_gcm_setauthsize(struct crypto_aead *authenc, - unsigned int authsize) + unsigned int authsize) { SSI_LOG_DEBUG("ssi_rfc4543_gcm_setauthsize() authsize %d \n", authsize ); @@ -2364,7 +2364,7 @@ static int ssi_rfc4106_gcm_encrypt(struct aead_request *req) /* Very similar to ssi_aead_encrypt() above. */ struct aead_req_ctx *areq_ctx = aead_request_ctx(req); - int rc = -EINVAL; + int rc = -EINVAL; if (!valid_assoclen(req)) { SSI_LOG_ERR("invalid Assoclen:%u\n", req->assoclen); @@ -2416,7 +2416,7 @@ static int ssi_rfc4106_gcm_decrypt(struct aead_request *req) /* Very similar to ssi_aead_decrypt() above. */ struct aead_req_ctx *areq_ctx = aead_request_ctx(req); - int rc = -EINVAL; + int rc = -EINVAL; if (!valid_assoclen(req)) { SSI_LOG_ERR("invalid Assoclen:%u\n", req->assoclen); -- cgit v1.2.3-55-g7522 From 95dddaa9d1a723367409844d4e6423bcda09d582 Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Mon, 15 May 2017 20:55:46 +0200 Subject: staging: ks7010: avoid CamelCase: local variables in ks_hostif.c Replace CamelCase local variables' name with underscores to comply with the standard kernel coding style. Changed: - LinkSpeed - TransmittedFrameCount - ReceivedFragmentCount - FailedCount - FCSErrorCount Signed-off-by: Janusz Lisiecki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index cf9b22feb451..d9161be71f4a 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -994,22 +994,22 @@ void hostif_phy_information_confirm(struct ks_wlan_private *priv) { struct iw_statistics *wstats = &priv->wstats; unsigned char rssi, signal, noise; - unsigned char LinkSpeed; - unsigned int TransmittedFrameCount, ReceivedFragmentCount; - unsigned int FailedCount, FCSErrorCount; + unsigned char link_speed; + unsigned int transmitted_frame_count, received_fragment_count; + unsigned int failed_count, fcs_error_count; DPRINTK(3, "\n"); rssi = get_BYTE(priv); signal = get_BYTE(priv); noise = get_BYTE(priv); - LinkSpeed = get_BYTE(priv); - TransmittedFrameCount = get_DWORD(priv); - ReceivedFragmentCount = get_DWORD(priv); - FailedCount = get_DWORD(priv); - FCSErrorCount = get_DWORD(priv); + link_speed = get_BYTE(priv); + transmitted_frame_count = get_DWORD(priv); + received_fragment_count = get_DWORD(priv); + failed_count = get_DWORD(priv); + fcs_error_count = get_DWORD(priv); DPRINTK(4, "phyinfo confirm rssi=%d signal=%d\n", rssi, signal); - priv->current_rate = (LinkSpeed & RATE_MASK); + priv->current_rate = (link_speed & RATE_MASK); wstats->qual.qual = signal; wstats->qual.level = 256 - rssi; wstats->qual.noise = 0; /* invalid noise value */ @@ -1017,14 +1017,13 @@ void hostif_phy_information_confirm(struct ks_wlan_private *priv) DPRINTK(3, "\n rssi=%u\n" " signal=%u\n" - " LinkSpeed=%ux500Kbps\n" - " TransmittedFrameCount=%u\n" - " ReceivedFragmentCount=%u\n" - " FailedCount=%u\n" - " FCSErrorCount=%u\n", - rssi, signal, LinkSpeed, TransmittedFrameCount, - ReceivedFragmentCount, FailedCount, FCSErrorCount); - + " link_speed=%ux500Kbps\n" + " transmitted_frame_count=%u\n" + " received_fragment_count=%u\n" + " failed_count=%u\n" + " fcs_error_count=%u\n", + rssi, signal, link_speed, transmitted_frame_count, + received_fragment_count, failed_count, fcs_error_count); /* wake_up_interruptible_all(&priv->confirm_wait); */ complete(&priv->confirm_wait); } -- cgit v1.2.3-55-g7522 From d7206352fc327eb833e137739269022a1e6c0a7f Mon Sep 17 00:00:00 2001 From: Ammly Fredrick Date: Mon, 15 May 2017 12:35:09 +0300 Subject: Staging: rtl8723bs: core: rtw_mlme: Fix spelling issues Fixed spelling warnings produced by scripts/checkpatch.pl Signed-off-by: Ammly Fredrick Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index e61638291df1..d5ab12305e59 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -249,7 +249,7 @@ void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network * /* return the wlan_network with the matching addr - Shall be calle under atomic context... to avoid possible racing condition... + Shall be called under atomic context... to avoid possible racing condition... */ struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr) { @@ -412,7 +412,7 @@ void rtw_free_network_queue(struct adapter *dev, u8 isfreeall) /* return the wlan_network with the matching addr - Shall be calle under atomic context... to avoid possible racing condition... + Shall be called under atomic context... to avoid possible racing condition... */ struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr) { @@ -564,7 +564,7 @@ void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, sq_final = ((u32)(src->PhyInfo.SignalQuality)+(u32)(dst->PhyInfo.SignalQuality)*4)/5; rssi_final = (src->Rssi+dst->Rssi*4)/5; } else { - /* bss info not receving from the right channel, use the original RX signal infos */ + /* bss info not receiving from the right channel, use the original RX signal infos */ ss_final = dst->PhyInfo.SignalStrength; sq_final = dst->PhyInfo.SignalQuality; rssi_final = dst->Rssi; @@ -680,7 +680,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t pnetwork->aid = 0; pnetwork->join_res = 0; - /* bss info not receving from the right channel */ + /* bss info not receiving from the right channel */ if (pnetwork->network.PhyInfo.SignalQuality == 101) pnetwork->network.PhyInfo.SignalQuality = 0; } else { @@ -699,7 +699,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t pnetwork->last_scanned = jiffies; - /* bss info not receving from the right channel */ + /* bss info not receiving from the right channel */ if (pnetwork->network.PhyInfo.SignalQuality == 101) pnetwork->network.PhyInfo.SignalQuality = 0; @@ -715,7 +715,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t pnetwork->last_scanned = jiffies; - /* target.Reserved[0]== 1, means that scaned network is a bcn frame. */ + /* target.Reserved[0]== 1, means that scanned network is a bcn frame. */ if ((pnetwork->network.IELength > target->IELength) && (target->Reserved[0] == 1)) update_ie = false; @@ -1264,7 +1264,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str /* Commented by Albert 2012/07/21 */ /* When doing the WPS, the wps_ie_len won't equal to 0 */ - /* And the Wi-Fi driver shouldn't allow the data packet to be tramsmitted. */ + /* And the Wi-Fi driver shouldn't allow the data packet to be transmitted. */ if (padapter->securitypriv.wps_ie_len != 0) { psta->ieee8021x_blocked = true; padapter->securitypriv.wps_ie_len = 0; @@ -1272,7 +1272,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str /* for A-MPDU Rx reordering buffer control for bmc_sta & sta_info */ - /* if A-MPDU Rx is enabled, reseting rx_ordering_ctrl wstart_b(indicate_seq) to default value = 0xffff */ + /* if A-MPDU Rx is enabled, resetting rx_ordering_ctrl wstart_b(indicate_seq) to default value = 0xffff */ /* todo: check if AP can send A-MPDU packets */ for (i = 0; i < 16 ; i++) { /* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */ @@ -1374,7 +1374,7 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net rtw_update_ht_cap(padapter, cur_network->network.IEs, cur_network->network.IELength, (u8) cur_network->network.Configuration.DSConfig); } -/* Notes: the fucntion could be > passive_level (the same context as Rx tasklet) */ +/* Notes: the function could be > passive_level (the same context as Rx tasklet) */ /* pnetwork : returns from rtw_joinbss_event_callback */ /* ptarget_wlan: found from scanned_queue */ /* if join_res > 0, for (fw_state ==WIFI_STATION_STATE), we check if "ptarget_sta" & "ptarget_wlan" exist. */ @@ -1817,7 +1817,7 @@ void rtw_wmm_event_callback(struct adapter *padapter, u8 *pbuf) } /* -* _rtw_join_timeout_handler - Timeout/faliure handler for CMD JoinBss +* _rtw_join_timeout_handler - Timeout/failure handler for CMD JoinBss * @adapter: pointer to struct adapter structure */ void _rtw_join_timeout_handler (struct adapter *adapter) @@ -1870,7 +1870,7 @@ void _rtw_join_timeout_handler (struct adapter *adapter) } /* -* rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey +* rtw_scan_timeout_handler - Timeout/Failure handler for CMD SiteSurvey * @adapter: pointer to struct adapter structure */ void rtw_scan_timeout_handler (struct adapter *adapter) @@ -2622,7 +2622,7 @@ void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter) { } -/* the fucntion is at passive_level */ +/* the function is at passive_level */ void rtw_joinbss_reset(struct adapter *padapter) { u8 threshold; @@ -2727,7 +2727,7 @@ void rtw_build_wmm_ie_ht(struct adapter *padapter, u8 *out_ie, uint *pout_len) } } -/* the fucntion is >= passive_level */ +/* the function is >= passive_level */ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_len, uint *pout_len, u8 channel) { u32 ielen, out_len; @@ -2879,7 +2879,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ } -/* the fucntion is > passive_level (in critical_section) */ +/* the function is > passive_level (in critical_section) */ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channel) { u8 *p, max_ampdu_sz; -- cgit v1.2.3-55-g7522 From 9d156621751094293e9739debd77cc4751ba2dcf Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Mon, 15 May 2017 10:18:14 +0100 Subject: staging: vme: Use BIT macro for bit definitions Use the BIT(n) macro instead of '(1 << n)' in definitions where the bit semantics clearly applies. Fixes true positive "Prefer using the BIT macro" checks reported by checkpatch. Some of these checks are still triggering on definitions using '(1 << n)', namely for PIO2_CNTR_SC_DEV1, PIO2_CNTR_RW_LSB and PIO2_CNTR_MODE1. Leave them be, as the context there is more of a "multi-bit field value" ((val << n), where for some cases 'val' happens to be 1) rather than a "single bit" (1 << n), so keeping the value as is in the code makes it more readable that using a combination of BIT macros. Signed-off-by: Ricardo Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2.h | 80 +++++++++++++++++----------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vme/devices/vme_pio2.h b/drivers/staging/vme/devices/vme_pio2.h index 5577df3199e7..ac4a4bad4091 100644 --- a/drivers/staging/vme/devices/vme_pio2.h +++ b/drivers/staging/vme/devices/vme_pio2.h @@ -68,38 +68,38 @@ static const int PIO2_CHANNEL_BANK[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 }; -#define PIO2_CHANNEL0_BIT (1 << 0) -#define PIO2_CHANNEL1_BIT (1 << 1) -#define PIO2_CHANNEL2_BIT (1 << 2) -#define PIO2_CHANNEL3_BIT (1 << 3) -#define PIO2_CHANNEL4_BIT (1 << 4) -#define PIO2_CHANNEL5_BIT (1 << 5) -#define PIO2_CHANNEL6_BIT (1 << 6) -#define PIO2_CHANNEL7_BIT (1 << 7) -#define PIO2_CHANNEL8_BIT (1 << 0) -#define PIO2_CHANNEL9_BIT (1 << 1) -#define PIO2_CHANNEL10_BIT (1 << 2) -#define PIO2_CHANNEL11_BIT (1 << 3) -#define PIO2_CHANNEL12_BIT (1 << 4) -#define PIO2_CHANNEL13_BIT (1 << 5) -#define PIO2_CHANNEL14_BIT (1 << 6) -#define PIO2_CHANNEL15_BIT (1 << 7) -#define PIO2_CHANNEL16_BIT (1 << 0) -#define PIO2_CHANNEL17_BIT (1 << 1) -#define PIO2_CHANNEL18_BIT (1 << 2) -#define PIO2_CHANNEL19_BIT (1 << 3) -#define PIO2_CHANNEL20_BIT (1 << 4) -#define PIO2_CHANNEL21_BIT (1 << 5) -#define PIO2_CHANNEL22_BIT (1 << 6) -#define PIO2_CHANNEL23_BIT (1 << 7) -#define PIO2_CHANNEL24_BIT (1 << 0) -#define PIO2_CHANNEL25_BIT (1 << 1) -#define PIO2_CHANNEL26_BIT (1 << 2) -#define PIO2_CHANNEL27_BIT (1 << 3) -#define PIO2_CHANNEL28_BIT (1 << 4) -#define PIO2_CHANNEL29_BIT (1 << 5) -#define PIO2_CHANNEL30_BIT (1 << 6) -#define PIO2_CHANNEL31_BIT (1 << 7) +#define PIO2_CHANNEL0_BIT BIT(0) +#define PIO2_CHANNEL1_BIT BIT(1) +#define PIO2_CHANNEL2_BIT BIT(2) +#define PIO2_CHANNEL3_BIT BIT(3) +#define PIO2_CHANNEL4_BIT BIT(4) +#define PIO2_CHANNEL5_BIT BIT(5) +#define PIO2_CHANNEL6_BIT BIT(6) +#define PIO2_CHANNEL7_BIT BIT(7) +#define PIO2_CHANNEL8_BIT BIT(0) +#define PIO2_CHANNEL9_BIT BIT(1) +#define PIO2_CHANNEL10_BIT BIT(2) +#define PIO2_CHANNEL11_BIT BIT(3) +#define PIO2_CHANNEL12_BIT BIT(4) +#define PIO2_CHANNEL13_BIT BIT(5) +#define PIO2_CHANNEL14_BIT BIT(6) +#define PIO2_CHANNEL15_BIT BIT(7) +#define PIO2_CHANNEL16_BIT BIT(0) +#define PIO2_CHANNEL17_BIT BIT(1) +#define PIO2_CHANNEL18_BIT BIT(2) +#define PIO2_CHANNEL19_BIT BIT(3) +#define PIO2_CHANNEL20_BIT BIT(4) +#define PIO2_CHANNEL21_BIT BIT(5) +#define PIO2_CHANNEL22_BIT BIT(6) +#define PIO2_CHANNEL23_BIT BIT(7) +#define PIO2_CHANNEL24_BIT BIT(0) +#define PIO2_CHANNEL25_BIT BIT(1) +#define PIO2_CHANNEL26_BIT BIT(2) +#define PIO2_CHANNEL27_BIT BIT(3) +#define PIO2_CHANNEL28_BIT BIT(4) +#define PIO2_CHANNEL29_BIT BIT(5) +#define PIO2_CHANNEL30_BIT BIT(6) +#define PIO2_CHANNEL31_BIT BIT(7) static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT, PIO2_CHANNEL2_BIT, PIO2_CHANNEL3_BIT, @@ -120,12 +120,12 @@ static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT, }; /* PIO2_REGS_INT_STAT_CNTR (0xc) */ -#define PIO2_COUNTER0 (1 << 0) -#define PIO2_COUNTER1 (1 << 1) -#define PIO2_COUNTER2 (1 << 2) -#define PIO2_COUNTER3 (1 << 3) -#define PIO2_COUNTER4 (1 << 4) -#define PIO2_COUNTER5 (1 << 5) +#define PIO2_COUNTER0 BIT(0) +#define PIO2_COUNTER1 BIT(1) +#define PIO2_COUNTER2 BIT(2) +#define PIO2_COUNTER3 BIT(3) +#define PIO2_COUNTER4 BIT(4) +#define PIO2_COUNTER5 BIT(5) static const int PIO2_COUNTER[6] = { PIO2_COUNTER0, PIO2_COUNTER1, PIO2_COUNTER2, PIO2_COUNTER3, @@ -133,8 +133,8 @@ static const int PIO2_COUNTER[6] = { PIO2_COUNTER0, PIO2_COUNTER1, /* PIO2_REGS_CTRL (0x18) */ #define PIO2_VME_INT_MASK 0x7 -#define PIO2_LED (1 << 6) -#define PIO2_LOOP (1 << 7) +#define PIO2_LED BIT(6) +#define PIO2_LOOP BIT(7) /* PIO2_REGS_VME_VECTOR (0x19) */ #define PIO2_VME_VECTOR_SPUR 0x0 -- cgit v1.2.3-55-g7522 From 052181bb25621fc3ba214b46dcc29e894f024456 Mon Sep 17 00:00:00 2001 From: Remco Verhoef Date: Mon, 15 May 2017 22:37:35 +0200 Subject: staging: rtl8188eu: fix indentation error Fixes a 'code indent should use tabs where possible' checkpatch code style error by changing whitespace into tabs. Signed-off-by: Remco Verhoef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c index d9fa290c5f78..9f51f54f866a 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c @@ -58,7 +58,7 @@ static void process_link_qual(struct adapter *padapter, } void rtl8188e_process_phy_info(struct adapter *padapter, - struct recv_frame *precvframe) + struct recv_frame *precvframe) { /* Check RSSI */ process_rssi(padapter, precvframe); -- cgit v1.2.3-55-g7522 From e3b5fde7eb3797f6401542f99bf10ac253272b70 Mon Sep 17 00:00:00 2001 From: Haim Daniel Date: Mon, 15 May 2017 17:10:18 +0300 Subject: drivers/staging: refactor dgnc tty registration. -remove duplicate tty allocation code for serial and printer drivers. -add missing tty c_ispeed and c_ospeed initialization to 9600. -fix sparse warning: too long initializer-string for array of char. This patch was only unit tested due to lack of the actual hardware. Signed-off-by: Haim Daniel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.h | 13 ---- drivers/staging/dgnc/dgnc_tty.c | 150 +++++++++++++++---------------------- 2 files changed, 59 insertions(+), 104 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 980410fc4801..764d6fe0d030 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -52,19 +52,6 @@ #define dgnc_jiffies_from_ms(a) (((a) * HZ) / 1000) -/* - * Define a local default termios struct. All ports will be created - * with this termios initially. This is the same structure that is defined - * as the default in tty_io.c with the same settings overridden as in serial.c - * - * In short, this should match the internal serial ports' defaults. - */ -#define DEFAULT_IFLAGS (ICRNL | IXON) -#define DEFAULT_OFLAGS (OPOST | ONLCR) -#define DEFAULT_CFLAGS (B9600 | CS8 | CREAD | HUPCL | CLOCAL) -#define DEFAULT_LFLAGS (ISIG | ICANON | ECHO | ECHOE | ECHOK | \ - ECHOCTL | ECHOKE | IEXTEN) - #ifndef _POSIX_VDISABLE #define _POSIX_VDISABLE '\0' #endif diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 9e98781ca6fe..d3736daf8cf2 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -51,22 +51,6 @@ static const struct digi_t dgnc_digi_init = { .digi_term = "ansi" /* default terminal type */ }; -/* - * Define a local default termios struct. All ports will be created - * with this termios initially. - * - * This defines a raw port at 9600 baud, 8 data bits, no parity, - * 1 stop bit. - */ -static const struct ktermios default_termios = { - .c_iflag = (DEFAULT_IFLAGS), - .c_oflag = (DEFAULT_OFLAGS), - .c_cflag = (DEFAULT_CFLAGS), - .c_lflag = (DEFAULT_LFLAGS), - .c_cc = INIT_C_CC, - .c_line = 0, -}; - static int dgnc_tty_open(struct tty_struct *tty, struct file *file); static void dgnc_tty_close(struct tty_struct *tty, struct file *file); static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, @@ -129,6 +113,49 @@ static const struct tty_operations dgnc_tty_ops = { /* TTY Initialization/Cleanup Functions */ +static struct tty_driver *dgnc_tty_create(char *serial_name, uint maxports, + int major, int minor) +{ + int rc; + struct tty_driver *drv; + + drv = tty_alloc_driver(maxports, + TTY_DRIVER_REAL_RAW | + TTY_DRIVER_DYNAMIC_DEV | + TTY_DRIVER_HARDWARE_BREAK); + if (IS_ERR(drv)) + return drv; + + drv->name = serial_name; + drv->name_base = 0; + drv->major = major; + drv->minor_start = minor; + drv->type = TTY_DRIVER_TYPE_SERIAL; + drv->subtype = SERIAL_TYPE_NORMAL; + drv->init_termios = tty_std_termios; + drv->init_termios.c_cflag = (B9600 | CS8 | CREAD | HUPCL | CLOCAL); + drv->init_termios.c_ispeed = 9600; + drv->init_termios.c_ospeed = 9600; + drv->driver_name = DRVSTR; + /* + * Entry points for driver. Called by the kernel from + * tty_io.c and n_tty.c. + */ + tty_set_operations(drv, &dgnc_tty_ops); + rc = tty_register_driver(drv); + if (rc < 0) { + put_tty_driver(drv); + return ERR_PTR(rc); + } + return drv; +} + +static void dgnc_tty_free(struct tty_driver *drv) +{ + tty_unregister_driver(drv); + put_tty_driver(drv); +} + /** * dgnc_tty_register() - Init the tty subsystem for this board. */ @@ -136,95 +163,36 @@ int dgnc_tty_register(struct dgnc_board *brd) { int rc; - brd->serial_driver = tty_alloc_driver(brd->maxports, - TTY_DRIVER_REAL_RAW | - TTY_DRIVER_DYNAMIC_DEV | - TTY_DRIVER_HARDWARE_BREAK); - if (IS_ERR(brd->serial_driver)) - return PTR_ERR(brd->serial_driver); - snprintf(brd->serial_name, MAXTTYNAMELEN, "tty_dgnc_%d_", brd->boardnum); - brd->serial_driver->name = brd->serial_name; - brd->serial_driver->name_base = 0; - brd->serial_driver->major = 0; - brd->serial_driver->minor_start = 0; - brd->serial_driver->type = TTY_DRIVER_TYPE_SERIAL; - brd->serial_driver->subtype = SERIAL_TYPE_NORMAL; - brd->serial_driver->init_termios = default_termios; - brd->serial_driver->driver_name = DRVSTR; - - /* - * Entry points for driver. Called by the kernel from - * tty_io.c and n_tty.c. - */ - tty_set_operations(brd->serial_driver, &dgnc_tty_ops); - - rc = tty_register_driver(brd->serial_driver); - if (rc < 0) { - dev_dbg(&brd->pdev->dev, - "Can't register tty device (%d)\n", rc); - goto free_serial_driver; + brd->serial_driver = dgnc_tty_create(brd->serial_name, + brd->maxports, 0, 0); + if (IS_ERR(brd->serial_driver)) { + rc = PTR_ERR(brd->serial_driver); + dev_dbg(&brd->pdev->dev, "Can't register tty device (%d)\n", + rc); + return rc; } - /* - * If we're doing transparent print, we have to do all of the above - * again, separately so we don't get the LD confused about what major - * we are when we get into the dgnc_tty_open() routine. - */ - brd->print_driver = tty_alloc_driver(brd->maxports, - TTY_DRIVER_REAL_RAW | - TTY_DRIVER_DYNAMIC_DEV | - TTY_DRIVER_HARDWARE_BREAK); + snprintf(brd->print_name, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum); + brd->print_driver = dgnc_tty_create(brd->print_name, brd->maxports, + 0x80, + brd->serial_driver->major); if (IS_ERR(brd->print_driver)) { rc = PTR_ERR(brd->print_driver); - goto unregister_serial_driver; - } - - snprintf(brd->print_name, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum); - - brd->print_driver->name = brd->print_name; - brd->print_driver->name_base = 0; - brd->print_driver->major = brd->serial_driver->major; - brd->print_driver->minor_start = 0x80; - brd->print_driver->type = TTY_DRIVER_TYPE_SERIAL; - brd->print_driver->subtype = SERIAL_TYPE_NORMAL; - brd->print_driver->init_termios = default_termios; - brd->print_driver->driver_name = DRVSTR; - - /* - * Entry points for driver. Called by the kernel from - * tty_io.c and n_tty.c. - */ - tty_set_operations(brd->print_driver, &dgnc_tty_ops); - - rc = tty_register_driver(brd->print_driver); - if (rc < 0) { dev_dbg(&brd->pdev->dev, - "Can't register Transparent Print device(%d)\n", - rc); - goto free_print_driver; + "Can't register Transparent Print device(%d)\n", rc); + dgnc_tty_free(brd->serial_driver); + return rc; } - return 0; - -free_print_driver: - put_tty_driver(brd->print_driver); -unregister_serial_driver: - tty_unregister_driver(brd->serial_driver); -free_serial_driver: - put_tty_driver(brd->serial_driver); - - return rc; } void dgnc_tty_unregister(struct dgnc_board *brd) { - tty_unregister_driver(brd->print_driver); - tty_unregister_driver(brd->serial_driver); - put_tty_driver(brd->print_driver); - put_tty_driver(brd->serial_driver); + dgnc_tty_free(brd->print_driver); + dgnc_tty_free(brd->serial_driver); } /** -- cgit v1.2.3-55-g7522 From caaba6775ebe524642e2cd92f2f9e44840e9cd33 Mon Sep 17 00:00:00 2001 From: Jandy Gou Date: Tue, 16 May 2017 16:28:09 +0800 Subject: staging: fbtft: fix sparse warning fix the following sparse warning: drivers/staging/fbtft/fbtft-io.c:74:29: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fbtft-io.c:74:29: expected unsigned long long [unsigned] [long] [long long] [usertype] drivers/staging/fbtft/fbtft-io.c:74:29: got restricted __be64 [usertype] Signed-off-by: Jandy Gou Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c index d86840548b74..ffb9a3b4d454 100644 --- a/drivers/staging/fbtft/fbtft-io.c +++ b/drivers/staging/fbtft/fbtft-io.c @@ -71,7 +71,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len) src++; } tmp |= ((*src & 0x0100) ? 1 : 0); - *(u64 *)dst = cpu_to_be64(tmp); + *(__be64 *)dst = cpu_to_be64(tmp); dst += 8; *dst++ = (u8)(*src++ & 0x00FF); added++; -- cgit v1.2.3-55-g7522 From 1ab92da32e37758c0e2e2a455f06d5f40609f14e Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Mon, 15 May 2017 18:45:33 +0100 Subject: staging: speakup: add tty-based comms functions This adds spk_ttyio.c file. It contains a set of functions which implement those methods in spk_synth struct which relate to sending bytes out using serial comms. Implementations in this file perform the same function but using TTY subsystem instead. Currently synths access serial ports, directly poking standard ISA ports by trying to steal them from serial driver. Some ISA cards actually need this way of doing it, but most other synthesizers don't, and can actually work by using the proper TTY subsystem through a new N_SPEAKUP line discipline. So this adds the methods for drivers to switch to accessing serial ports through the TTY subsystem, whenever appropriate. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/Makefile | 1 + drivers/staging/speakup/spk_priv.h | 4 + drivers/staging/speakup/spk_ttyio.c | 143 ++++++++++++++++++++++++++++++++++++ drivers/tty/tty_ldisc.c | 2 + include/uapi/linux/tty.h | 1 + 5 files changed, 151 insertions(+) create mode 100644 drivers/staging/speakup/spk_ttyio.c (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/Makefile b/drivers/staging/speakup/Makefile index c5e43a59822f..c864ea69c40d 100644 --- a/drivers/staging/speakup/Makefile +++ b/drivers/staging/speakup/Makefile @@ -25,6 +25,7 @@ speakup-y := \ kobjects.o \ selection.o \ serialio.o \ + spk_ttyio.o \ synth.o \ thread.o \ varhandlers.o diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h index 6895373902de..53142fee0df6 100644 --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -44,6 +44,7 @@ const struct old_serial_port *spk_serial_init(int index); void spk_stop_serial_interrupt(void); int spk_wait_for_xmitr(struct spk_synth *in_synth); void spk_serial_release(void); +void spk_ttyio_release(void); void synth_buffer_skip_nonlatin1(void); u16 synth_buffer_getc(void); @@ -56,7 +57,9 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count); int spk_serial_synth_probe(struct spk_synth *synth); +int spk_ttyio_synth_probe(struct spk_synth *synth); const char *spk_serial_synth_immediate(struct spk_synth *synth, const char *buff); +const char *spk_ttyio_synth_immediate(struct spk_synth *synth, const char *buff); void spk_do_catch_up(struct spk_synth *synth); void spk_synth_flush(struct spk_synth *synth); unsigned char spk_synth_get_index(struct spk_synth *synth); @@ -78,5 +81,6 @@ extern struct speakup_info_t speakup_info; extern struct var_t synth_time_vars[]; extern struct spk_io_ops spk_serial_io_ops; +extern struct spk_io_ops spk_ttyio_ops; #endif diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c new file mode 100644 index 000000000000..ee37550e59b3 --- /dev/null +++ b/drivers/staging/speakup/spk_ttyio.c @@ -0,0 +1,143 @@ +#include +#include + +#include "speakup.h" +#include "spk_types.h" + +static struct tty_struct *speakup_tty; + +static int spk_ttyio_ldisc_open(struct tty_struct *tty) +{ + if (tty->ops->write == NULL) + return -EOPNOTSUPP; + speakup_tty = tty; + + return 0; +} + +static void spk_ttyio_ldisc_close(struct tty_struct *tty) +{ + speakup_tty = NULL; +} + +static struct tty_ldisc_ops spk_ttyio_ldisc_ops = { + .owner = THIS_MODULE, + .magic = TTY_LDISC_MAGIC, + .name = "speakup_ldisc", + .open = spk_ttyio_ldisc_open, + .close = spk_ttyio_ldisc_close, +}; + +static int spk_ttyio_out(struct spk_synth *in_synth, const char ch); +struct spk_io_ops spk_ttyio_ops = { + .synth_out = spk_ttyio_out, +}; +EXPORT_SYMBOL_GPL(spk_ttyio_ops); + +static int spk_ttyio_initialise_ldisc(int ser) +{ + int ret = 0; + struct tty_struct *tty; + + ret = tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops); + if (ret) { + pr_err("Error registering line discipline.\n"); + return ret; + } + + if (ser < 0 || ser > (255 - 64)) { + pr_err("speakup: Invalid ser param. Must be between 0 and 191 inclusive.\n"); + return -EINVAL; + } + + /* TODO: support more than ttyS* */ + tty = tty_open_by_driver(MKDEV(4, (ser + 64)), NULL, NULL); + if (IS_ERR(tty)) + return PTR_ERR(tty); + + if (tty->ops->open) + ret = tty->ops->open(tty, NULL); + else + ret = -ENODEV; + + if (ret) { + tty_unlock(tty); + return ret; + } + + clear_bit(TTY_HUPPED, &tty->flags); + tty_unlock(tty); + + ret = tty_set_ldisc(tty, N_SPEAKUP); + + return ret; +} + +static int spk_ttyio_out(struct spk_synth *in_synth, const char ch) +{ + if (in_synth->alive && speakup_tty && speakup_tty->ops->write) { + int ret = speakup_tty->ops->write(speakup_tty, &ch, 1); + if (ret == 0) + /* No room */ + return 0; + if (ret < 0) { + pr_warn("%s: I/O error, deactivating speakup\n", in_synth->long_name); + /* No synth any more, so nobody will restart TTYs, and we thus + * need to do it ourselves. Now that there is no synth we can + * let application flood anyway + */ + in_synth->alive = 0; + speakup_start_ttys(); + return 0; + } + return 1; + } + return 0; +} + +int spk_ttyio_synth_probe(struct spk_synth *synth) +{ + int rv = spk_ttyio_initialise_ldisc(synth->ser); + + if (rv) + return rv; + + synth->alive = 1; + + return 0; +} +EXPORT_SYMBOL_GPL(spk_ttyio_synth_probe); + +void spk_ttyio_release(void) +{ + int idx; + + if (!speakup_tty) + return; + + tty_lock(speakup_tty); + idx = speakup_tty->index; + + if (speakup_tty->ops->close) + speakup_tty->ops->close(speakup_tty, NULL); + + tty_ldisc_flush(speakup_tty); + tty_unlock(speakup_tty); + tty_ldisc_release(speakup_tty); +} +EXPORT_SYMBOL_GPL(spk_ttyio_release); + +const char *spk_ttyio_synth_immediate(struct spk_synth *synth, const char *buff) +{ + u_char ch; + + while ((ch = *buff)) { + if (ch == '\n') + ch = synth->procspeech; + if (tty_write_room(speakup_tty) < 1 || !synth->io_ops->synth_out(synth, ch)) + return buff; + buff++; + } + return NULL; +} +EXPORT_SYMBOL_GPL(spk_ttyio_synth_immediate); diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index e4603b09863a..f6ffe28b8a0d 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -605,6 +605,7 @@ err: tty_unlock(tty); return retval; } +EXPORT_SYMBOL_GPL(tty_set_ldisc); /** * tty_ldisc_kill - teardown ldisc @@ -797,6 +798,7 @@ void tty_ldisc_release(struct tty_struct *tty) tty_ldisc_debug(tty, "released\n"); } +EXPORT_SYMBOL_GPL(tty_ldisc_release); /** * tty_ldisc_init - ldisc setup for new tty diff --git a/include/uapi/linux/tty.h b/include/uapi/linux/tty.h index 01c4410352ff..e7855dffd592 100644 --- a/include/uapi/linux/tty.h +++ b/include/uapi/linux/tty.h @@ -35,5 +35,6 @@ #define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */ #define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */ #define N_NCI 25 /* NFC NCI UART */ +#define N_SPEAKUP 26 /* Speakup communication with synths */ #endif /* _UAPI_LINUX_TTY_H */ -- cgit v1.2.3-55-g7522 From bd697e299609b94a19287e14a3f7926bb44ffc26 Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Mon, 15 May 2017 18:45:34 +0100 Subject: staging: speakup: migrate acntsa, bns, dummy and txprt to ttyio This changes the above five synths to TTY-based comms. They were chosen as a first pass because their serial comms are straightforward, i.e. they don't use serial input and don't do internal port knocking. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/speakup_acntsa.c | 8 ++++---- drivers/staging/speakup/speakup_dummy.c | 8 ++++---- drivers/staging/speakup/speakup_txprt.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/speakup_acntsa.c b/drivers/staging/speakup/speakup_acntsa.c index de67ffda7d45..6e4f873eddbc 100644 --- a/drivers/staging/speakup/speakup_acntsa.c +++ b/drivers/staging/speakup/speakup_acntsa.c @@ -99,10 +99,10 @@ static struct spk_synth synth_acntsa = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, + .io_ops = &spk_ttyio_ops, .probe = synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, @@ -125,7 +125,7 @@ static int synth_probe(struct spk_synth *synth) { int failed; - failed = spk_serial_synth_probe(synth); + failed = spk_ttyio_synth_probe(synth); if (failed == 0) { synth->synth_immediate(synth, "\033=R\r"); mdelay(100); diff --git a/drivers/staging/speakup/speakup_dummy.c b/drivers/staging/speakup/speakup_dummy.c index 8db7aa358f31..3fdc768c8454 100644 --- a/drivers/staging/speakup/speakup_dummy.c +++ b/drivers/staging/speakup/speakup_dummy.c @@ -98,10 +98,10 @@ static struct spk_synth synth_dummy = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, diff --git a/drivers/staging/speakup/speakup_txprt.c b/drivers/staging/speakup/speakup_txprt.c index 3f531fb99fd3..e4c1b5424f94 100644 --- a/drivers/staging/speakup/speakup_txprt.c +++ b/drivers/staging/speakup/speakup_txprt.c @@ -95,10 +95,10 @@ static struct spk_synth synth_txprt = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, -- cgit v1.2.3-55-g7522 From 6b9ad1c742bf227b1005a41d8baa315b747e3e8d Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Mon, 15 May 2017 18:45:35 +0100 Subject: staging: speakup: add send_xchar, tiocmset and input functionality for tty This patch adds further TTY-based functionality, specifically implementation of send_xchar and tiocmset methods, and input. send_xchar and tiocmset methods simply delegate to corresponding TTY operations. For input, it implements the receive_buf2 callback in tty_ldisc_ops of speakup's ldisc. If a synth defines read_buff_add method then receive_buf2 simply delegates to that and returns. For spk_ttyio_in, the data is passed from receive_buf2 thread to spk_ttyio_in thread through spk_ldisc_data structure. It has following members: - char buf: represents data received - struct semaphore sem: used to signal to spk_ttyio_in thread that data is available to be read without having to busy wait - bool buf_free: this is used in comination with mb() calls to syncronise the two threads over buf receive_buf2 only writes to buf if buf_free is true. The check for buf_free and writing to buf are separated by mb() to ensure that spk_ttyio_in has read buf before receive_buf2 writes to it. After writing, it ups the semaphore to signal to spk_ttyio_in that there is now data to read. spk_ttyio_in waits for data to read by downing the semaphore. Thus when signalled by receive_buf2 thread above, it reads from buf and sets buf_free to true. These two operations are separated by mb() to ensure that receive_buf2 thread finds buf_free to be true only after buf has been read. After that spk_ttyio_in calls tty_schedule_flip for subsequent data to come in through receive_buf2. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/serialio.h | 4 +- drivers/staging/speakup/spk_priv.h | 1 + drivers/staging/speakup/spk_ttyio.c | 107 ++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/serialio.h b/drivers/staging/speakup/serialio.h index 3ad7ff0bc3c3..89de6fff9cb2 100644 --- a/drivers/staging/speakup/serialio.h +++ b/drivers/staging/speakup/serialio.h @@ -8,6 +8,8 @@ #endif #include +#include "spk_priv.h" + /* * this is cut&paste from 8250.h. Get rid of the structure, the definitions * and this whole broken driver. @@ -21,7 +23,7 @@ struct old_serial_port { }; /* countdown values for serial timeouts in us */ -#define SPK_SERIAL_TIMEOUT 100000 +#define SPK_SERIAL_TIMEOUT SPK_SYNTH_TIMEOUT /* countdown values transmitter/dsr timeouts in us */ #define SPK_XMITR_TIMEOUT 100000 /* countdown values cts timeouts in us */ diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h index 53142fee0df6..4f533667d312 100644 --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -39,6 +39,7 @@ #endif #define KT_SPKUP 15 +#define SPK_SYNTH_TIMEOUT 100000 /* in micro-seconds */ const struct old_serial_port *spk_serial_init(int index); void spk_stop_serial_interrupt(void); diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index ee37550e59b3..61c01bfe17a8 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -1,36 +1,97 @@ #include #include +#include +#include #include "speakup.h" #include "spk_types.h" +#include "spk_priv.h" +struct spk_ldisc_data { + char buf; + struct semaphore sem; + bool buf_free; +}; + +static struct spk_synth *spk_ttyio_synth; static struct tty_struct *speakup_tty; static int spk_ttyio_ldisc_open(struct tty_struct *tty) { + struct spk_ldisc_data *ldisc_data; + if (tty->ops->write == NULL) return -EOPNOTSUPP; speakup_tty = tty; + ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL); + if (!ldisc_data) { + pr_err("speakup: Failed to allocate ldisc_data.\n"); + return -ENOMEM; + } + + sema_init(&ldisc_data->sem, 0); + ldisc_data->buf_free = true; + speakup_tty->disc_data = ldisc_data; + return 0; } static void spk_ttyio_ldisc_close(struct tty_struct *tty) { + kfree(speakup_tty->disc_data); speakup_tty = NULL; } +static int spk_ttyio_receive_buf2(struct tty_struct *tty, + const unsigned char *cp, char *fp, int count) +{ + struct spk_ldisc_data *ldisc_data = tty->disc_data; + + if (spk_ttyio_synth->read_buff_add) { + int i; + for (i = 0; i < count; i++) + spk_ttyio_synth->read_buff_add(cp[i]); + + return count; + } + + if (!ldisc_data->buf_free) + /* ttyio_in will tty_schedule_flip */ + return 0; + + /* Make sure the consumer has read buf before we have seen + * buf_free == true and overwrite buf */ + mb(); + + ldisc_data->buf = cp[0]; + ldisc_data->buf_free = false; + up(&ldisc_data->sem); + + return 1; +} + static struct tty_ldisc_ops spk_ttyio_ldisc_ops = { .owner = THIS_MODULE, .magic = TTY_LDISC_MAGIC, .name = "speakup_ldisc", .open = spk_ttyio_ldisc_open, .close = spk_ttyio_ldisc_close, + .receive_buf2 = spk_ttyio_receive_buf2, }; static int spk_ttyio_out(struct spk_synth *in_synth, const char ch); +static void spk_ttyio_send_xchar(char ch); +static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear); +static unsigned char spk_ttyio_in(void); +static unsigned char spk_ttyio_in_nowait(void); + struct spk_io_ops spk_ttyio_ops = { .synth_out = spk_ttyio_out, + .send_xchar = spk_ttyio_send_xchar, + .tiocmset = spk_ttyio_tiocmset, + .synth_in = spk_ttyio_in, + .synth_in_nowait = spk_ttyio_in_nowait, }; EXPORT_SYMBOL_GPL(spk_ttyio_ops); @@ -95,6 +156,51 @@ static int spk_ttyio_out(struct spk_synth *in_synth, const char ch) return 0; } +static void spk_ttyio_send_xchar(char ch) +{ + speakup_tty->ops->send_xchar(speakup_tty, ch); +} + +static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear) +{ + speakup_tty->ops->tiocmset(speakup_tty, set, clear); +} + +static unsigned char ttyio_in(int timeout) +{ + struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data; + char rv; + + if (down_timeout(&ldisc_data->sem, usecs_to_jiffies(timeout)) == -ETIME) { + if (timeout) + pr_warn("spk_ttyio: timeout (%d) while waiting for input\n", + timeout); + return 0xff; + } + + rv = ldisc_data->buf; + /* Make sure we have read buf before we set buf_free to let + * the producer overwrite it */ + mb(); + ldisc_data->buf_free = true; + /* Let TTY push more characters */ + tty_schedule_flip(speakup_tty->port); + + return rv; +} + +static unsigned char spk_ttyio_in(void) +{ + return ttyio_in(SPK_SYNTH_TIMEOUT); +} + +static unsigned char spk_ttyio_in_nowait(void) +{ + char rv = ttyio_in(0); + + return (rv == 0xff) ? 0 : rv; +} + int spk_ttyio_synth_probe(struct spk_synth *synth) { int rv = spk_ttyio_initialise_ldisc(synth->ser); @@ -103,6 +209,7 @@ int spk_ttyio_synth_probe(struct spk_synth *synth) return rv; synth->alive = 1; + spk_ttyio_synth = synth; return 0; } -- cgit v1.2.3-55-g7522 From 470790eefede39ebc22594ce657f14cc83365aed Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Mon, 15 May 2017 18:45:36 +0100 Subject: staging: speakup: migrate apollo, ltlk, audptr, decext, dectlk and spkout This patch simply uses the changes introduced in previous patches and migrates apollo, ltlk, audptr, decext, spkout and dectlk. Migrations are straightforward function pointer updates. Signed-off by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/speakup_apollo.c | 10 +++++----- drivers/staging/speakup/speakup_audptr.c | 9 ++++----- drivers/staging/speakup/speakup_decext.c | 10 +++++----- drivers/staging/speakup/speakup_dectlk.c | 9 ++++----- drivers/staging/speakup/speakup_ltlk.c | 9 ++++----- drivers/staging/speakup/speakup_spkout.c | 9 ++++----- 6 files changed, 26 insertions(+), 30 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/speakup_apollo.c b/drivers/staging/speakup/speakup_apollo.c index cead8b1b1bfc..7d99fba734b5 100644 --- a/drivers/staging/speakup/speakup_apollo.c +++ b/drivers/staging/speakup/speakup_apollo.c @@ -22,9 +22,9 @@ #include #include #include +#include /* for UART_MCR* constants */ #include "spk_priv.h" -#include "serialio.h" #include "speakup.h" #define DRV_VERSION "2.21" @@ -108,10 +108,10 @@ static struct spk_synth synth_apollo = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, diff --git a/drivers/staging/speakup/speakup_audptr.c b/drivers/staging/speakup/speakup_audptr.c index 800677bc1dad..aa6c592ecc9d 100644 --- a/drivers/staging/speakup/speakup_audptr.c +++ b/drivers/staging/speakup/speakup_audptr.c @@ -20,7 +20,6 @@ */ #include "spk_priv.h" #include "speakup.h" -#include "serialio.h" #define DRV_VERSION "2.11" #define SYNTH_CLEAR 0x18 /* flush synth buffer */ @@ -104,10 +103,10 @@ static struct spk_synth synth_audptr = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, + .io_ops = &spk_ttyio_ops, .probe = synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = synth_flush, .is_alive = spk_synth_is_alive_restart, @@ -154,7 +153,7 @@ static int synth_probe(struct spk_synth *synth) { int failed; - failed = spk_serial_synth_probe(synth); + failed = spk_ttyio_synth_probe(synth); if (failed == 0) synth_version(synth); synth->alive = !failed; diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index da73b7649936..b70bba84e4fc 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -24,12 +24,12 @@ #include #include "spk_priv.h" -#include "serialio.h" #include "speakup.h" #define DRV_VERSION "2.14" #define SYNTH_CLEAR 0x03 #define PROCSPEECH 0x0b + static volatile unsigned char last_char; static void read_buff_add(u_char ch) @@ -123,10 +123,10 @@ static struct spk_synth synth_decext = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = do_catch_up, .flush = synth_flush, .is_alive = spk_synth_is_alive_restart, diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c index 74acd527dc86..ec968dd6b6c8 100644 --- a/drivers/staging/speakup/speakup_dectlk.c +++ b/drivers/staging/speakup/speakup_dectlk.c @@ -27,7 +27,6 @@ #include #include "speakup.h" #include "spk_priv.h" -#include "serialio.h" #define DRV_VERSION "2.20" #define SYNTH_CLEAR 0x03 @@ -130,10 +129,10 @@ static struct spk_synth synth_dectlk = { .vars = vars, .default_pitch = ap_defaults, .default_vol = g5_defaults, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = do_catch_up, .flush = synth_flush, .is_alive = spk_synth_is_alive_restart, diff --git a/drivers/staging/speakup/speakup_ltlk.c b/drivers/staging/speakup/speakup_ltlk.c index bd4ac63730b7..9606224bc4d6 100644 --- a/drivers/staging/speakup/speakup_ltlk.c +++ b/drivers/staging/speakup/speakup_ltlk.c @@ -20,7 +20,6 @@ */ #include "speakup.h" #include "spk_priv.h" -#include "serialio.h" #include "speakup_dtlk.h" /* local header file for LiteTalk values */ #define DRV_VERSION "2.11" @@ -111,10 +110,10 @@ static struct spk_synth synth_ltlk = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, + .io_ops = &spk_ttyio_ops, .probe = synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, @@ -159,7 +158,7 @@ static int synth_probe(struct spk_synth *synth) { int failed = 0; - failed = spk_serial_synth_probe(synth); + failed = spk_ttyio_synth_probe(synth); if (failed == 0) synth_interrogate(synth); synth->alive = !failed; diff --git a/drivers/staging/speakup/speakup_spkout.c b/drivers/staging/speakup/speakup_spkout.c index 5160e4afdbef..fa1a40be9134 100644 --- a/drivers/staging/speakup/speakup_spkout.c +++ b/drivers/staging/speakup/speakup_spkout.c @@ -20,7 +20,6 @@ */ #include "spk_priv.h" #include "speakup.h" -#include "serialio.h" #define DRV_VERSION "2.11" #define SYNTH_CLEAR 0x18 @@ -102,10 +101,10 @@ static struct spk_synth synth_spkout = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = synth_flush, .is_alive = spk_synth_is_alive_restart, -- cgit v1.2.3-55-g7522 From 1c5973675cee92d5e8ad3a8a6e53a3e822bae271 Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Mon, 15 May 2017 18:45:37 +0100 Subject: staging: speakup: flush tty buffers and ensure hardware flow control This patch fixes the issue where TTY-migrated synths would take a while to shut up after hitting numpad enter key. When calling synth_flush, even though XOFF character is sent as high priority, data buffered in TTY layer is still sent to the synth. This patch flushes that buffered data when synth_flush is called. It also tries to ensure that hardware flow control is enabled, by setting CRTSCTS using tty's termios. Reported-by: John Covici Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/serialio.c | 7 +++++++ drivers/staging/speakup/speakup_audptr.c | 1 + drivers/staging/speakup/speakup_decext.c | 1 + drivers/staging/speakup/speakup_dectlk.c | 1 + drivers/staging/speakup/speakup_spkout.c | 1 + drivers/staging/speakup/spk_ttyio.c | 29 +++++++++++++++++++++++++++++ drivers/staging/speakup/spk_types.h | 1 + drivers/staging/speakup/synth.c | 1 + 8 files changed, 42 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index 5f96b5ba7acb..969373201356 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -30,6 +30,7 @@ static void spk_serial_send_xchar(char ch); static void spk_serial_tiocmset(unsigned int set, unsigned int clear); static unsigned char spk_serial_in(void); static unsigned char spk_serial_in_nowait(void); +static void spk_serial_flush_buffer(void); struct spk_io_ops spk_serial_io_ops = { .synth_out = spk_serial_out, @@ -37,6 +38,7 @@ struct spk_io_ops spk_serial_io_ops = { .tiocmset = spk_serial_tiocmset, .synth_in = spk_serial_in, .synth_in_nowait = spk_serial_in_nowait, + .flush_buffer = spk_serial_flush_buffer, }; EXPORT_SYMBOL_GPL(spk_serial_io_ops); @@ -268,6 +270,11 @@ static unsigned char spk_serial_in_nowait(void) return inb_p(speakup_info.port_tts + UART_RX); } +static void spk_serial_flush_buffer(void) +{ + /* TODO: flush the UART 16550 buffer */ +} + static int spk_serial_out(struct spk_synth *in_synth, const char ch) { if (in_synth->alive && spk_wait_for_xmitr(in_synth)) { diff --git a/drivers/staging/speakup/speakup_audptr.c b/drivers/staging/speakup/speakup_audptr.c index aa6c592ecc9d..1ca476087ba3 100644 --- a/drivers/staging/speakup/speakup_audptr.c +++ b/drivers/staging/speakup/speakup_audptr.c @@ -127,6 +127,7 @@ static struct spk_synth synth_audptr = { static void synth_flush(struct spk_synth *synth) { + synth->io_ops->flush_buffer(); synth->io_ops->send_xchar(SYNTH_CLEAR); synth->io_ops->synth_out(synth, PROCSPEECH); } diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index b70bba84e4fc..bf44ac988bf8 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -221,6 +221,7 @@ static void do_catch_up(struct spk_synth *synth) static void synth_flush(struct spk_synth *synth) { in_escape = 0; + synth->io_ops->flush_buffer(); synth->synth_immediate(synth, "\033P;10z\033\\"); } diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c index ec968dd6b6c8..ccb3bdf58e2a 100644 --- a/drivers/staging/speakup/speakup_dectlk.c +++ b/drivers/staging/speakup/speakup_dectlk.c @@ -293,6 +293,7 @@ static void synth_flush(struct spk_synth *synth) synth->io_ops->synth_out(synth, ']'); in_escape = 0; is_flushing = 1; + synth->io_ops->flush_buffer(); synth->io_ops->synth_out(synth, SYNTH_CLEAR); } diff --git a/drivers/staging/speakup/speakup_spkout.c b/drivers/staging/speakup/speakup_spkout.c index fa1a40be9134..086d5349d8d8 100644 --- a/drivers/staging/speakup/speakup_spkout.c +++ b/drivers/staging/speakup/speakup_spkout.c @@ -125,6 +125,7 @@ static struct spk_synth synth_spkout = { static void synth_flush(struct spk_synth *synth) { + synth->io_ops->flush_buffer(); synth->io_ops->send_xchar(SYNTH_CLEAR); } diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 61c01bfe17a8..6e0f042f6a44 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -85,6 +85,7 @@ static void spk_ttyio_send_xchar(char ch); static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear); static unsigned char spk_ttyio_in(void); static unsigned char spk_ttyio_in_nowait(void); +static void spk_ttyio_flush_buffer(void); struct spk_io_ops spk_ttyio_ops = { .synth_out = spk_ttyio_out, @@ -92,13 +93,22 @@ struct spk_io_ops spk_ttyio_ops = { .tiocmset = spk_ttyio_tiocmset, .synth_in = spk_ttyio_in, .synth_in_nowait = spk_ttyio_in_nowait, + .flush_buffer = spk_ttyio_flush_buffer, }; EXPORT_SYMBOL_GPL(spk_ttyio_ops); +static inline void get_termios(struct tty_struct *tty, struct ktermios *out_termios) +{ + down_read(&tty->termios_rwsem); + *out_termios = tty->termios; + up_read(&tty->termios_rwsem); +} + static int spk_ttyio_initialise_ldisc(int ser) { int ret = 0; struct tty_struct *tty; + struct ktermios tmp_termios; ret = tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops); if (ret) { @@ -127,6 +137,20 @@ static int spk_ttyio_initialise_ldisc(int ser) } clear_bit(TTY_HUPPED, &tty->flags); + /* ensure hardware flow control is enabled */ + get_termios(tty, &tmp_termios); + if (!(tmp_termios.c_cflag & CRTSCTS)) { + tmp_termios.c_cflag |= CRTSCTS; + tty_set_termios(tty, &tmp_termios); + /* + * check c_cflag to see if it's updated as tty_set_termios may not return + * error even when no tty bits are changed by the request. + */ + get_termios(tty, &tmp_termios); + if (!(tmp_termios.c_cflag & CRTSCTS)) + pr_warn("speakup: Failed to set hardware flow control\n"); + } + tty_unlock(tty); ret = tty_set_ldisc(tty, N_SPEAKUP); @@ -201,6 +225,11 @@ static unsigned char spk_ttyio_in_nowait(void) return (rv == 0xff) ? 0 : rv; } +static void spk_ttyio_flush_buffer(void) +{ + speakup_tty->ops->flush_buffer(speakup_tty); +} + int spk_ttyio_synth_probe(struct spk_synth *synth) { int rv = spk_ttyio_initialise_ldisc(synth->ser); diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h index ad7b9480a37f..9e3889749d43 100644 --- a/drivers/staging/speakup/spk_types.h +++ b/drivers/staging/speakup/spk_types.h @@ -154,6 +154,7 @@ struct spk_io_ops { void (*tiocmset)(unsigned int set, unsigned int clear); unsigned char (*synth_in)(void); unsigned char (*synth_in_nowait)(void); + void (*flush_buffer)(void); }; struct spk_synth { diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index 9c2aa1b8b0ac..703553916097 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -120,6 +120,7 @@ EXPORT_SYMBOL_GPL(spk_do_catch_up); void spk_synth_flush(struct spk_synth *synth) { + synth->io_ops->flush_buffer(); synth->io_ops->synth_out(synth, synth->clear); } EXPORT_SYMBOL_GPL(spk_synth_flush); -- cgit v1.2.3-55-g7522 From c975045656bb7fac6c077d1f075ce67b26e5b875 Mon Sep 17 00:00:00 2001 From: Matej Dujava Date: Tue, 16 May 2017 11:20:17 +0200 Subject: staging: sm750fb: fix length of lines, function calls and declaration This patch breaks lines that are longer than 80 characters and joins together those, that are too short and can be placed at one. Function calls and declarations are updated to fit kernel code style. Signed-off-by: Matej Dujava Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 7 +++-- drivers/staging/sm750fb/ddk750_dvi.c | 35 +++++++++++++---------- drivers/staging/sm750fb/ddk750_dvi.h | 43 ++++++++++++++--------------- drivers/staging/sm750fb/ddk750_hwi2c.c | 33 ++++++++-------------- drivers/staging/sm750fb/ddk750_sii164.c | 49 ++++++++++++++------------------- drivers/staging/sm750fb/ddk750_sii164.h | 22 +++++++-------- drivers/staging/sm750fb/ddk750_swi2c.c | 21 ++++---------- drivers/staging/sm750fb/ddk750_swi2c.h | 18 ++++-------- drivers/staging/sm750fb/sm750.c | 26 ++++++++--------- drivers/staging/sm750fb/sm750_accel.c | 15 +++++----- drivers/staging/sm750fb/sm750_cursor.c | 17 +++++------- 11 files changed, 125 insertions(+), 161 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 5e4bfb601cea..944dd25924be 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -175,7 +175,7 @@ static void set_master_clock(unsigned int frequency) } sm750_set_current_gate(reg); - } + } } unsigned int ddk750_get_vm_size(void) @@ -224,7 +224,7 @@ int ddk750_init_hw(struct initchip_param *pInitParam) sm750_set_current_gate(reg); if (sm750_get_chip_type() != SM750LE) { - /* set panel pll and graphic mode via mmio_88 */ + /* set panel pll and graphic mode via mmio_88 */ reg = peek32(VGA_CONFIGURATION); reg |= (VGA_CONFIGURATION_PLL | VGA_CONFIGURATION_MODE); poke32(VGA_CONFIGURATION, reg); @@ -309,7 +309,8 @@ int ddk750_init_hw(struct initchip_param *pInitParam) * M = {1,...,255} * N = {2,...,15} */ -unsigned int sm750_calc_pll_value(unsigned int request_orig, struct pll_value *pll) +unsigned int sm750_calc_pll_value(unsigned int request_orig, + struct pll_value *pll) { /* * as sm750 register definition, diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index 171ae063f06f..87a199d6cdaf 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -29,26 +29,31 @@ static dvi_ctrl_device_t g_dcftSupportedDviController[] = { #endif }; -int dviInit( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue - ) +int dviInit(unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue) { dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; if (pCurrentDviCtrl->pfnInit) { - return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, - vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, - pllFilterEnable, pllFilterValue); + return pCurrentDviCtrl->pfnInit(edgeSelect, + busSelect, + dualEdgeClkSelect, + hsyncEnable, + vsyncEnable, + deskewEnable, + deskewSetting, + continuousSyncEnable, + pllFilterEnable, + pllFilterValue); } return -1; /* error */ } diff --git a/drivers/staging/sm750fb/ddk750_dvi.h b/drivers/staging/sm750fb/ddk750_dvi.h index 677939cb5130..4a8394561f76 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.h +++ b/drivers/staging/sm750fb/ddk750_dvi.h @@ -3,17 +3,16 @@ /* dvi chip stuffs structros */ -typedef long (*PFN_DVICTRL_INIT)( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue); +typedef long (*PFN_DVICTRL_INIT)(unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue); typedef void (*PFN_DVICTRL_RESETCHIP)(void); typedef char* (*PFN_DVICTRL_GETCHIPSTRING)(void); @@ -42,18 +41,16 @@ typedef struct _dvi_ctrl_device_t { #define DVI_CTRL_SII164 /* dvi functions prototype */ -int dviInit( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue -); +int dviInit(unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue); #endif diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c index fe814e4881f9..ec556a978a98 100644 --- a/drivers/staging/sm750fb/ddk750_hwi2c.c +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -8,9 +8,7 @@ #define MAX_HWI2C_FIFO 16 #define HWI2C_WAIT_TIMEOUT 0xF0000 -int sm750_hw_i2c_init( -unsigned char bus_speed_mode -) +int sm750_hw_i2c_init(unsigned char bus_speed_mode) { unsigned int value; @@ -81,11 +79,9 @@ static long hw_i2c_wait_tx_done(void) * Return Value: * Total number of bytes those are actually written. */ -static unsigned int hw_i2c_write_data( - unsigned char addr, - unsigned int length, - unsigned char *buf -) +static unsigned int hw_i2c_write_data(unsigned char addr, + unsigned int length, + unsigned char *buf) { unsigned char count, i; unsigned int total_bytes = 0; @@ -148,11 +144,9 @@ static unsigned int hw_i2c_write_data( * Return Value: * Total number of actual bytes read from the slave device */ -static unsigned int hw_i2c_read_data( - unsigned char addr, - unsigned int length, - unsigned char *buf -) +static unsigned int hw_i2c_read_data(unsigned char addr, + unsigned int length, + unsigned char *buf) { unsigned char count, i; unsigned int total_bytes = 0; @@ -212,10 +206,7 @@ static unsigned int hw_i2c_read_data( * Return Value: * Register value */ -unsigned char sm750_hw_i2c_read_reg( - unsigned char addr, - unsigned char reg -) +unsigned char sm750_hw_i2c_read_reg(unsigned char addr, unsigned char reg) { unsigned char value = 0xFF; @@ -238,11 +229,9 @@ unsigned char sm750_hw_i2c_read_reg( * 0 - Success * -1 - Fail */ -int sm750_hw_i2c_write_reg( - unsigned char addr, - unsigned char reg, - unsigned char data -) +int sm750_hw_i2c_write_reg(unsigned char addr, + unsigned char reg, + unsigned char data) { unsigned char value[2]; diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index 259006ace219..0431833de781 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -112,18 +112,16 @@ unsigned short sii164GetDeviceID(void) * 0 - Success * -1 - Fail. */ -long sii164InitChip( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue -) +long sii164InitChip(unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue) { unsigned char config; @@ -259,7 +257,6 @@ void sii164ResetChip(void) sii164SetPower(1); } - /* * sii164GetChipString * This function returns a char string name of the current DVI Controller chip. @@ -270,7 +267,6 @@ char *sii164GetChipString(void) return gDviCtrlChipName; } - /* * sii164SetPower * This function sets the power configuration of the DVI Controller Chip. @@ -278,9 +274,7 @@ char *sii164GetChipString(void) * Input: * powerUp - Flag to set the power down or up */ -void sii164SetPower( - unsigned char powerUp -) +void sii164SetPower(unsigned char powerUp) { unsigned char config; @@ -298,18 +292,16 @@ void sii164SetPower( } } - /* * sii164SelectHotPlugDetectionMode * This function selects the mode of the hot plug detection. */ -static void sii164SelectHotPlugDetectionMode( - sii164_hot_plug_mode_t hotPlugMode -) +static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode) { unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & + ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; switch (hotPlugMode) { case SII164_HOTPLUG_DISABLE: detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; @@ -336,9 +328,7 @@ static void sii164SelectHotPlugDetectionMode( * * enableHotPlug - Enable (=1) / disable (=0) Hot Plug detection */ -void sii164EnableHotPlugDetection( - unsigned char enableHotPlug -) +void sii164EnableHotPlugDetection(unsigned char enableHotPlug) { unsigned char detectReg; @@ -365,7 +355,8 @@ unsigned char sii164IsConnected(void) { unsigned char hotPlugValue; - hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; + hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & + SII164_DETECT_HOT_PLUG_STATUS_MASK; if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON) return 1; else @@ -384,7 +375,8 @@ unsigned char sii164CheckInterrupt(void) { unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & + SII164_DETECT_MONITOR_STATE_MASK; if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE) return 1; else @@ -401,7 +393,8 @@ void sii164ClearInterrupt(void) /* Clear the MDI interrupt */ detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, + detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); } #endif diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h index 664ad089f753..6968cf532f16 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.h +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -13,18 +13,16 @@ typedef enum _sii164_hot_plug_mode_t { /* Silicon Image SiI164 chip prototype */ -long sii164InitChip( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue -); +long sii164InitChip(unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue); unsigned short sii164GetVendorID(void); unsigned short sii164GetDeviceID(void); diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c index a4ac07cd50cb..19c5ffc72b16 100644 --- a/drivers/staging/sm750fb/ddk750_swi2c.c +++ b/drivers/staging/sm750fb/ddk750_swi2c.c @@ -349,8 +349,7 @@ static unsigned char sw_i2c_read_byte(unsigned char ack) * -1 - Fail to initialize the i2c * 0 - Success */ -static long sm750le_i2c_init(unsigned char clk_gpio, - unsigned char data_gpio) +static long sm750le_i2c_init(unsigned char clk_gpio, unsigned char data_gpio) { int i; @@ -388,10 +387,7 @@ static long sm750le_i2c_init(unsigned char clk_gpio, * -1 - Fail to initialize the i2c * 0 - Success */ -long sm750_sw_i2c_init( - unsigned char clk_gpio, - unsigned char data_gpio -) +long sm750_sw_i2c_init(unsigned char clk_gpio, unsigned char data_gpio) { int i; @@ -448,10 +444,7 @@ long sm750_sw_i2c_init( * Return Value: * Register value */ -unsigned char sm750_sw_i2c_read_reg( - unsigned char addr, - unsigned char reg -) +unsigned char sm750_sw_i2c_read_reg(unsigned char addr, unsigned char reg) { unsigned char data; @@ -488,11 +481,9 @@ unsigned char sm750_sw_i2c_read_reg( * 0 - Success * -1 - Fail */ -long sm750_sw_i2c_write_reg( - unsigned char addr, - unsigned char reg, - unsigned char data -) +long sm750_sw_i2c_write_reg(unsigned char addr, + unsigned char reg, + unsigned char data) { long ret = 0; diff --git a/drivers/staging/sm750fb/ddk750_swi2c.h b/drivers/staging/sm750fb/ddk750_swi2c.h index 5a9466efc7bd..3b8a96d6d25a 100644 --- a/drivers/staging/sm750fb/ddk750_swi2c.h +++ b/drivers/staging/sm750fb/ddk750_swi2c.h @@ -28,10 +28,7 @@ * -1 - Fail to initialize the i2c * 0 - Success */ -long sm750_sw_i2c_init( - unsigned char clk_gpio, - unsigned char data_gpio -); +long sm750_sw_i2c_init(unsigned char clk_gpio, unsigned char data_gpio); /* * This function reads the slave device's register @@ -44,10 +41,7 @@ long sm750_sw_i2c_init( * Return Value: * Register value */ -unsigned char sm750_sw_i2c_read_reg( - unsigned char addr, - unsigned char reg -); +unsigned char sm750_sw_i2c_read_reg(unsigned char addr, unsigned char reg); /* * This function writes a value to the slave device's register @@ -62,10 +56,8 @@ unsigned char sm750_sw_i2c_read_reg( * 0 - Success * -1 - Fail */ -long sm750_sw_i2c_write_reg( - unsigned char addr, - unsigned char reg, - unsigned char data -); +long sm750_sw_i2c_write_reg(unsigned char addr, + unsigned char reg, + unsigned char data); #endif /* _SWI2C_H_ */ diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 386d4adcd91d..a7f722ae30d5 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -112,42 +112,42 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) cursor = &crtc->cursor; if (fbcursor->image.width > cursor->maxW || - fbcursor->image.height > cursor->maxH || - fbcursor->image.depth > 1) { + fbcursor->image.height > cursor->maxH || + fbcursor->image.depth > 1) { return -ENXIO; } sm750_hw_cursor_disable(cursor); if (fbcursor->set & FB_CUR_SETSIZE) sm750_hw_cursor_setSize(cursor, - fbcursor->image.width, - fbcursor->image.height); + fbcursor->image.width, + fbcursor->image.height); if (fbcursor->set & FB_CUR_SETPOS) sm750_hw_cursor_setPos(cursor, - fbcursor->image.dx - info->var.xoffset, - fbcursor->image.dy - info->var.yoffset); + fbcursor->image.dx - info->var.xoffset, + fbcursor->image.dy - info->var.yoffset); if (fbcursor->set & FB_CUR_SETCMAP) { /* get the 16bit color of kernel means */ u16 fg, bg; fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800)) | - ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5) | - ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11); + ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5) | + ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11); bg = ((info->cmap.red[fbcursor->image.bg_color] & 0xf800)) | - ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5) | - ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11); + ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5) | + ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11); sm750_hw_cursor_setColor(cursor, fg, bg); } if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) { sm750_hw_cursor_setData(cursor, - fbcursor->rop, - fbcursor->image.data, - fbcursor->mask); + fbcursor->rop, + fbcursor->image.data, + fbcursor->mask); } if (fbcursor->enable) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 6be86e4963be..4b720cfa05de 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -42,10 +42,11 @@ void sm750_hw_de_init(struct lynx_accel *accel) /* dpr1c */ reg = 0x3; - clr = DE_STRETCH_FORMAT_PATTERN_XY | DE_STRETCH_FORMAT_PATTERN_Y_MASK | - DE_STRETCH_FORMAT_PATTERN_X_MASK | - DE_STRETCH_FORMAT_ADDRESSING_MASK | - DE_STRETCH_FORMAT_SOURCE_HEIGHT_MASK; + clr = DE_STRETCH_FORMAT_PATTERN_XY | + DE_STRETCH_FORMAT_PATTERN_Y_MASK | + DE_STRETCH_FORMAT_PATTERN_X_MASK | + DE_STRETCH_FORMAT_ADDRESSING_MASK | + DE_STRETCH_FORMAT_SOURCE_HEIGHT_MASK; /* DE_STRETCH bpp format need be initialized in setMode routine */ write_dpr(accel, DE_STRETCH_FORMAT, @@ -84,9 +85,9 @@ void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt) } int sm750_hw_fillrect(struct lynx_accel *accel, - u32 base, u32 pitch, u32 Bpp, - u32 x, u32 y, u32 width, u32 height, - u32 color, u32 rop) + u32 base, u32 pitch, u32 Bpp, + u32 x, u32 y, u32 width, u32 height, + u32 color, u32 rop) { u32 deCtrl; diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index b64dc8a4a8fb..aa47a16ac75c 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -60,15 +60,13 @@ void sm750_hw_cursor_disable(struct lynx_cursor *cursor) poke32(HWC_ADDRESS, 0); } -void sm750_hw_cursor_setSize(struct lynx_cursor *cursor, - int w, int h) +void sm750_hw_cursor_setSize(struct lynx_cursor *cursor, int w, int h) { cursor->w = w; cursor->h = h; } -void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, - int x, int y) +void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, int x, int y) { u32 reg; @@ -77,8 +75,7 @@ void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, poke32(HWC_LOCATION, reg); } -void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, - u32 fg, u32 bg) +void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, u32 fg, u32 bg) { u32 reg = (fg << HWC_COLOR_12_2_RGB565_SHIFT) & HWC_COLOR_12_2_RGB565_MASK; @@ -87,8 +84,8 @@ void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, poke32(HWC_COLOR_3, 0xffe0); } -void sm750_hw_cursor_setData(struct lynx_cursor *cursor, - u16 rop, const u8 *pcol, const u8 *pmsk) +void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 rop, + const u8 *pcol, const u8 *pmsk) { int i, j, count, pitch, offset; u8 color, mask, opr; @@ -138,8 +135,8 @@ void sm750_hw_cursor_setData(struct lynx_cursor *cursor, } -void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, - u16 rop, const u8 *pcol, const u8 *pmsk) +void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, u16 rop, + const u8 *pcol, const u8 *pmsk) { int i, j, count, pitch, offset; u8 color, mask; -- cgit v1.2.3-55-g7522 From 9df81ce975e754a260f7cfffd51d9f55cffa9389 Mon Sep 17 00:00:00 2001 From: Juan Manuel Torres Palma Date: Tue, 16 May 2017 21:39:54 +0900 Subject: staging: vt6656: remove multiple assignments Fix style in rxtx.c, breaking all multiple assignments in different lines. Signed-off-by: Juan Manuel Torres Palma Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rxtx.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 1b87c080644b..24c730879c65 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -147,7 +147,10 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, u8 rsv_type, { u32 rrv_time, rts_time, cts_time, ack_time, data_time; - rrv_time = rts_time = cts_time = ack_time = data_time = 0; + rrv_time = 0; + rts_time = 0; + cts_time = 0; + ack_time = 0; data_time = vnt_get_frame_time(priv->preamble_type, pkt_type, frame_length, current_rate); @@ -155,9 +158,11 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, u8 rsv_type, if (rsv_type == 0) { rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 20, priv->top_cck_basic_rate); - cts_time = ack_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, - priv->top_cck_basic_rate); + ack_time = vnt_get_frame_time(priv->preamble_type, + pkt_type, 14, + priv->top_cck_basic_rate); + cts_time = ack_time; + } else if (rsv_type == 1) { rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 20, priv->top_cck_basic_rate); @@ -168,8 +173,11 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, u8 rsv_type, } else if (rsv_type == 2) { rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 20, priv->top_ofdm_basic_rate); - cts_time = ack_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, priv->top_ofdm_basic_rate); + ack_time = vnt_get_frame_time(priv->preamble_type, + pkt_type, 14, + priv->top_ofdm_basic_rate); + cts_time = ack_time; + } else if (rsv_type == 3) { cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 14, priv->top_cck_basic_rate); -- cgit v1.2.3-55-g7522 From 26d701a85d670c727115f09f10f1f8692c4bbc07 Mon Sep 17 00:00:00 2001 From: Juan Manuel Torres Palma Date: Tue, 16 May 2017 21:39:55 +0900 Subject: staging: vt6656: remove unnecesary blank lines Fix style in rxtx.c, removing extra empty blank lines. Signed-off-by: Juan Manuel Torres Palma Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rxtx.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 24c730879c65..a44abcce6fb4 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -275,7 +275,6 @@ static u16 vnt_mac_hdr_pos(struct vnt_usb_send_context *tx_context, static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context, struct vnt_tx_datahead_g *buf) { - struct vnt_private *priv = tx_context->priv; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx_context->skb->data; @@ -699,7 +698,6 @@ static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context, struct vnt_mic_hdr **mic_hdr, u32 need_mic, bool need_rts) { - if (tx_context->pkt_type == PK_TYPE_11GB || tx_context->pkt_type == PK_TYPE_11GA) { if (need_rts) { @@ -787,14 +785,12 @@ static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context, if (ieee80211_has_a4(hdr->frame_control)) ether_addr_copy(mic_hdr->addr4, hdr->addr4); - memcpy(key_buffer, tx_key->key, WLAN_KEY_LEN_CCMP); break; default: break; } - } int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) -- cgit v1.2.3-55-g7522 From 16bd2c482c328e58ba50c0b03f41b885699208c4 Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Tue, 16 May 2017 17:34:57 +0200 Subject: staging: ks7010: avoid CamelCase: receiveDTIMs Replace CamelCase variable name with underscores to comply with the standard kernel coding style. Signed-off-by: Janusz Lisiecki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 26 +++++++++++++------------- drivers/staging/ks7010/ks_hostif.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index d9161be71f4a..79634be1b873 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1659,13 +1659,13 @@ void hostif_phy_information_request(struct ks_wlan_private *priv) static void hostif_power_mgmt_request(struct ks_wlan_private *priv, - unsigned long mode, unsigned long wake_up, - unsigned long receiveDTIMs) + unsigned long mode, unsigned long wake_up, + unsigned long receive_dtims) { struct hostif_power_mgmt_request_t *pp; - DPRINTK(3, "mode=%lu wake_up=%lu receiveDTIMs=%lu\n", mode, wake_up, - receiveDTIMs); + DPRINTK(3, "mode=%lu wake_up=%lu receive_dtims=%lu\n", mode, wake_up, + receive_dtims); pp = hostif_generic_request(sizeof(*pp), HIF_POWER_MGMT_REQ); if (!pp) @@ -1673,7 +1673,7 @@ void hostif_power_mgmt_request(struct ks_wlan_private *priv, pp->mode = cpu_to_le32((uint32_t)mode); pp->wake_up = cpu_to_le32((uint32_t)wake_up); - pp->receiveDTIMs = cpu_to_le32((uint32_t)receiveDTIMs); + pp->receive_dtims = cpu_to_le32((uint32_t)receive_dtims); /* send to device request */ ps_confirm_wait_inc(priv); @@ -2217,44 +2217,44 @@ spin_unlock: static void hostif_sme_power_mgmt_set(struct ks_wlan_private *priv) { - unsigned long mode, wake_up, receiveDTIMs; + unsigned long mode, wake_up, receive_dtims; DPRINTK(3, "\n"); switch (priv->reg.power_mgmt) { case POWER_MGMT_ACTIVE: mode = POWER_ACTIVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; break; case POWER_MGMT_SAVE1: if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) { mode = POWER_SAVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; } else { mode = POWER_ACTIVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; } break; case POWER_MGMT_SAVE2: if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) { mode = POWER_SAVE; wake_up = 0; - receiveDTIMs = 1; + receive_dtims = 1; } else { mode = POWER_ACTIVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; } break; default: mode = POWER_ACTIVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; break; } - hostif_power_mgmt_request(priv, mode, wake_up, receiveDTIMs); + hostif_power_mgmt_request(priv, mode, wake_up, receive_dtims); } static diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 45e3a01b0b6b..5bae8d468e23 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -188,7 +188,7 @@ struct hostif_power_mgmt_request_t { __le32 wake_up; #define SLEEP_FALSE 0 #define SLEEP_TRUE 1 /* not used */ - __le32 receiveDTIMs; + __le32 receive_dtims; #define DTIM_FALSE 0 #define DTIM_TRUE 1 } __packed; -- cgit v1.2.3-55-g7522 From e60a40c316702b898383dbd18b82a59c8d187193 Mon Sep 17 00:00:00 2001 From: Archit Taneja Date: Wed, 17 May 2017 13:45:46 +0530 Subject: staging: android: ion: Remove unused members from ion_buffer A few members in ion_buffer struct are unused after features like page faulting, ion_handle and ion_client were removed. Remove these members and the leftover references to them. Signed-off-by: Archit Taneja Reviewed-by: Sumit Semwal Acked-by: Laura Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 2 -- drivers/staging/android/ion/ion.h | 14 -------------- 2 files changed, 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 3a724ca1729c..c3e601ce261d 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -115,7 +115,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, buffer->dev = dev; buffer->size = len; - INIT_LIST_HEAD(&buffer->vmas); INIT_LIST_HEAD(&buffer->attachments); mutex_init(&buffer->lock); mutex_lock(&dev->buffer_lock); @@ -135,7 +134,6 @@ void ion_buffer_destroy(struct ion_buffer *buffer) if (WARN_ON(buffer->kmap_cnt > 0)) buffer->heap->ops->unmap_kernel(buffer->heap, buffer); buffer->heap->ops->free(buffer); - vfree(buffer->pages); kfree(buffer); } diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h index ace8416bd509..fa9ed81ab972 100644 --- a/drivers/staging/android/ion/ion.h +++ b/drivers/staging/android/ion/ion.h @@ -68,14 +68,6 @@ struct ion_platform_heap { * @kmap_cnt: number of times the buffer is mapped to the kernel * @vaddr: the kernel mapping if kmap_cnt is not zero * @sg_table: the sg table for the buffer if dmap_cnt is not zero - * @pages: flat array of pages in the buffer -- used by fault - * handler and only valid for buffers that are faulted in - * @vmas: list of vma's mapping this buffer - * @handle_count: count of handles referencing this buffer - * @task_comm: taskcomm of last client to reference this buffer in a - * handle, used for debugging - * @pid: pid of last client to reference this buffer in a - * handle, used for debugging */ struct ion_buffer { union { @@ -92,13 +84,7 @@ struct ion_buffer { int kmap_cnt; void *vaddr; struct sg_table *sg_table; - struct page **pages; - struct list_head vmas; struct list_head attachments; - /* used to track orphaned buffers */ - int handle_count; - char task_comm[TASK_COMM_LEN]; - pid_t pid; }; void ion_buffer_destroy(struct ion_buffer *buffer); -- cgit v1.2.3-55-g7522 From 83d952ee0f09a7a36970d3d85ddbfffc8bedf32b Mon Sep 17 00:00:00 2001 From: Archit Taneja Date: Wed, 17 May 2017 13:45:47 +0530 Subject: staging: android: ion: Remove ION_FLAG_CACHED_NEEDS_SYNC The flag ION_FLAG_CACHED_NEEDS_SYNC isn't used anymore. Remove it. Signed-off-by: Archit Taneja Reviewed-by: Sumit Semwal Acked-by: Laura Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/uapi/ion.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h index b76db1b2e197..d415589757e7 100644 --- a/drivers/staging/android/uapi/ion.h +++ b/drivers/staging/android/uapi/ion.h @@ -57,12 +57,6 @@ enum ion_heap_type { */ #define ION_FLAG_CACHED 1 -/* - * mappings of this buffer will created at mmap time, if this is set - * caches must be managed manually - */ -#define ION_FLAG_CACHED_NEEDS_SYNC 2 - /** * DOC: Ion Userspace API * -- cgit v1.2.3-55-g7522 From df794cfbb9660f098412481be7d41bcb8e842cc9 Mon Sep 17 00:00:00 2001 From: Archit Taneja Date: Wed, 17 May 2017 13:45:48 +0530 Subject: staging: android: ion: Avoid calling free_duped_table() twice Currently, the duplicated sg table is freed in the detach() and the error path of map_dma_buf() ion's dma_buf_ops. If a call to dma_buf_map_attachment() fails, the importer is expected to call dma_buf_detach() to remove the attachment. This will result in us trying to free the duped sg table twice. Don't call free_duped_table() in ion_map_dma_buf() to avoid this. Signed-off-by: Archit Taneja Acked-by: Laura Abbott Reviewed-by: Sumit Semwal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index c3e601ce261d..afa7c4553125 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -267,20 +267,14 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment, { struct ion_dma_buf_attachment *a = attachment->priv; struct sg_table *table; - int ret; table = a->table; if (!dma_map_sg(attachment->dev, table->sgl, table->nents, - direction)){ - ret = -ENOMEM; - goto err; - } - return table; + direction)) + return ERR_PTR(-ENOMEM); -err: - free_duped_table(table); - return ERR_PTR(ret); + return table; } static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment, -- cgit v1.2.3-55-g7522 From 0687090acf0d0bee585fa0ec29cf5b1fd48cefee Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 18 May 2017 15:28:00 +0200 Subject: staging: greybus: mark PM functions as __maybe_unused Enabling the arche platform for compile testing showed a harmless warning with CONFIG_PM=n: drivers/staging/greybus/arche-platform.c:632:12: error: 'arche_platform_resume' defined but not used [-Werror=unused-function] drivers/staging/greybus/arche-platform.c:618:12: error: 'arche_platform_suspend' defined but not used [-Werror=unused-function] This marks the functions as __maybe_unused to shut up the warnings. Fixes: 2eccd4aa19fc ("staging: greybus: enable compile testing of arche driver") Signed-off-by: Arnd Bergmann Acked-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/arche-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index 5bce5e039596..eced2d26467b 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -615,7 +615,7 @@ static int arche_platform_remove(struct platform_device *pdev) return 0; } -static int arche_platform_suspend(struct device *dev) +static __maybe_unused int arche_platform_suspend(struct device *dev) { /* * If timing profile premits, we may shutdown bridge @@ -629,7 +629,7 @@ static int arche_platform_suspend(struct device *dev) return 0; } -static int arche_platform_resume(struct device *dev) +static __maybe_unused int arche_platform_resume(struct device *dev) { /* * Atleast for ES2 we have to meet the delay requirement between -- cgit v1.2.3-55-g7522 From 52325ff42a9aa7bdcbcc5461f6eec4c4f93ed944 Mon Sep 17 00:00:00 2001 From: Surender Polsani Date: Fri, 19 May 2017 15:07:12 +0530 Subject: staging: iio: light: Replace symbolic permissions as per coding style Fixed the following checkpatch.pl warnings: octal permissions are more preferable than symbolic permissions Replaced DEVICE_ATTR family macros with DEVICE_ATTR_RW family as suggested by Greg K-H. Changed attributes and function names where ever required to satisfy internal macro definitions like __ATTR__RW(). Signed-off-by: Surender Polsani Signed-off-by: Jonathan Cameron --- drivers/staging/iio/light/tsl2x7x.c | 62 ++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 36 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c index a912e9ec87f2..146719928fb3 100644 --- a/drivers/staging/iio/light/tsl2x7x.c +++ b/drivers/staging/iio/light/tsl2x7x.c @@ -915,7 +915,7 @@ static void tsl2x7x_prox_cal(struct iio_dev *indio_dev) tsl2x7x_chip_on(indio_dev); } -static ssize_t tsl2x7x_power_state_show(struct device *dev, +static ssize_t power_state_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -924,7 +924,7 @@ static ssize_t tsl2x7x_power_state_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d\n", chip->tsl2x7x_chip_status); } -static ssize_t tsl2x7x_power_state_store(struct device *dev, +static ssize_t power_state_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -942,7 +942,7 @@ static ssize_t tsl2x7x_power_state_store(struct device *dev, return len; } -static ssize_t tsl2x7x_gain_available_show(struct device *dev, +static ssize_t in_illuminance0_calibscale_available_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -960,14 +960,14 @@ static ssize_t tsl2x7x_gain_available_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%s\n", "1 8 16 120"); } -static ssize_t tsl2x7x_prox_gain_available_show(struct device *dev, +static ssize_t in_proximity0_calibscale_available_show(struct device *dev, struct device_attribute *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%s\n", "1 2 4 8"); } -static ssize_t tsl2x7x_als_time_show(struct device *dev, +static ssize_t in_illuminance0_integration_time_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -982,7 +982,7 @@ static ssize_t tsl2x7x_als_time_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); } -static ssize_t tsl2x7x_als_time_store(struct device *dev, +static ssize_t in_illuminance0_integration_time_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -1010,7 +1010,7 @@ static ssize_t tsl2x7x_als_time_store(struct device *dev, static IIO_CONST_ATTR(in_illuminance0_integration_time_available, ".00272 - .696"); -static ssize_t tsl2x7x_als_cal_target_show(struct device *dev, +static ssize_t in_illuminance0_target_input_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1020,7 +1020,7 @@ static ssize_t tsl2x7x_als_cal_target_show(struct device *dev, chip->tsl2x7x_settings.als_cal_target); } -static ssize_t tsl2x7x_als_cal_target_store(struct device *dev, +static ssize_t in_illuminance0_target_input_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -1040,7 +1040,7 @@ static ssize_t tsl2x7x_als_cal_target_store(struct device *dev, } /* persistence settings */ -static ssize_t tsl2x7x_als_persistence_show(struct device *dev, +static ssize_t in_intensity0_thresh_period_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1057,7 +1057,7 @@ static ssize_t tsl2x7x_als_persistence_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); } -static ssize_t tsl2x7x_als_persistence_store(struct device *dev, +static ssize_t in_intensity0_thresh_period_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -1088,7 +1088,7 @@ static ssize_t tsl2x7x_als_persistence_store(struct device *dev, return IIO_VAL_INT_PLUS_MICRO; } -static ssize_t tsl2x7x_prox_persistence_show(struct device *dev, +static ssize_t in_proximity0_thresh_period_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1105,7 +1105,7 @@ static ssize_t tsl2x7x_prox_persistence_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z); } -static ssize_t tsl2x7x_prox_persistence_store(struct device *dev, +static ssize_t in_proximity0_thresh_period_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -1136,7 +1136,7 @@ static ssize_t tsl2x7x_prox_persistence_store(struct device *dev, return IIO_VAL_INT_PLUS_MICRO; } -static ssize_t tsl2x7x_do_calibrate(struct device *dev, +static ssize_t in_illuminance0_calibrate_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -1154,7 +1154,7 @@ static ssize_t tsl2x7x_do_calibrate(struct device *dev, return len; } -static ssize_t tsl2x7x_luxtable_show(struct device *dev, +static ssize_t in_illuminance0_lux_table_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1182,7 +1182,7 @@ static ssize_t tsl2x7x_luxtable_show(struct device *dev, return offset; } -static ssize_t tsl2x7x_luxtable_store(struct device *dev, +static ssize_t in_illuminance0_lux_table_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -1222,7 +1222,7 @@ static ssize_t tsl2x7x_luxtable_store(struct device *dev, return len; } -static ssize_t tsl2x7x_do_prox_calibrate(struct device *dev, +static ssize_t in_proximity0_calibrate_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -1494,35 +1494,25 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, return 0; } -static DEVICE_ATTR(power_state, 0644, - tsl2x7x_power_state_show, tsl2x7x_power_state_store); +static DEVICE_ATTR_RW(power_state); -static DEVICE_ATTR(in_proximity0_calibscale_available, 0444, - tsl2x7x_prox_gain_available_show, NULL); +static DEVICE_ATTR_RO(in_proximity0_calibscale_available); -static DEVICE_ATTR(in_illuminance0_calibscale_available, 0444, - tsl2x7x_gain_available_show, NULL); +static DEVICE_ATTR_RO(in_illuminance0_calibscale_available); -static DEVICE_ATTR(in_illuminance0_integration_time, 0644, - tsl2x7x_als_time_show, tsl2x7x_als_time_store); +static DEVICE_ATTR_RW(in_illuminance0_integration_time); -static DEVICE_ATTR(in_illuminance0_target_input, 0644, - tsl2x7x_als_cal_target_show, tsl2x7x_als_cal_target_store); +static DEVICE_ATTR_RW(in_illuminance0_target_input); -static DEVICE_ATTR(in_illuminance0_calibrate, 0200, NULL, - tsl2x7x_do_calibrate); +static DEVICE_ATTR_WO(in_illuminance0_calibrate); -static DEVICE_ATTR(in_proximity0_calibrate, 0200, NULL, - tsl2x7x_do_prox_calibrate); +static DEVICE_ATTR_WO(in_proximity0_calibrate); -static DEVICE_ATTR(in_illuminance0_lux_table, 0644, - tsl2x7x_luxtable_show, tsl2x7x_luxtable_store); +static DEVICE_ATTR_RW(in_illuminance0_lux_table); -static DEVICE_ATTR(in_intensity0_thresh_period, 0644, - tsl2x7x_als_persistence_show, tsl2x7x_als_persistence_store); +static DEVICE_ATTR_RW(in_intensity0_thresh_period); -static DEVICE_ATTR(in_proximity0_thresh_period, 0644, - tsl2x7x_prox_persistence_show, tsl2x7x_prox_persistence_store); +static DEVICE_ATTR_RW(in_proximity0_thresh_period); /* Use the default register values to identify the Taos device */ static int tsl2x7x_device_id(unsigned char *id, int target) -- cgit v1.2.3-55-g7522 From 6aec6c7a4718d256691e317eaa48c5ee0a549d46 Mon Sep 17 00:00:00 2001 From: Raphaël Beamonte Date: Tue, 23 May 2017 20:53:14 +0200 Subject: drivers: staging: ccree: ISO C forbids casting to and from non-scalar Fixes the following sparse warnings: drivers/staging/ccree/ssi_hash.c:2447:24: warning: cast to non-scalar drivers/staging/ccree/ssi_hash.c:2447:24: warning: cast from non-scalar drivers/staging/ccree/ssi_hash.c:2448:28: warning: cast to non-scalar drivers/staging/ccree/ssi_hash.c:2448:28: warning: cast from non-scalar Signed-off-by: Raphaël Beamonte Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 162d17dee2cd..8585f73161b3 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -2444,8 +2444,8 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) /* register hmac version */ - if ((((struct ssi_hash_template)driver_hash[alg]).hw_mode != DRV_CIPHER_XCBC_MAC) && - (((struct ssi_hash_template)driver_hash[alg]).hw_mode != DRV_CIPHER_CMAC)) { + if ((((struct ssi_hash_template *)&driver_hash[alg])->hw_mode != DRV_CIPHER_XCBC_MAC) && + (((struct ssi_hash_template *)&driver_hash[alg])->hw_mode != DRV_CIPHER_CMAC)) { t_alg = ssi_hash_create_alg(&driver_hash[alg], true); if (IS_ERR(t_alg)) { rc = PTR_ERR(t_alg); -- cgit v1.2.3-55-g7522 From c2b21f688aa4c2bd8e967ec8178e02dfc0a75914 Mon Sep 17 00:00:00 2001 From: Branislav Katreniak Date: Thu, 18 May 2017 22:28:33 +0200 Subject: staging: ccree: fix checkpatch no space before tabs Fixes checkpatch warning: WARNING: please, no space before tabs Signed-off-by: Branislav Katreniak Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 216d24791d5d..ac39d349060d 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -54,13 +54,13 @@ #define CC_AES_KEY_SIZE_MAX CC_AES_256_BIT_KEY_SIZE #define CC_AES_KEY_SIZE_WORDS_MAX (CC_AES_KEY_SIZE_MAX >> 2) -#define CC_MD5_DIGEST_SIZE 16 -#define CC_SHA1_DIGEST_SIZE 20 -#define CC_SHA224_DIGEST_SIZE 28 -#define CC_SHA256_DIGEST_SIZE 32 +#define CC_MD5_DIGEST_SIZE 16 +#define CC_SHA1_DIGEST_SIZE 20 +#define CC_SHA224_DIGEST_SIZE 28 +#define CC_SHA256_DIGEST_SIZE 32 #define CC_SHA256_DIGEST_SIZE_IN_WORDS 8 -#define CC_SHA384_DIGEST_SIZE 48 -#define CC_SHA512_DIGEST_SIZE 64 +#define CC_SHA384_DIGEST_SIZE 48 +#define CC_SHA512_DIGEST_SIZE 64 #define CC_SHA1_BLOCK_SIZE 64 #define CC_SHA1_BLOCK_SIZE_IN_WORDS 16 @@ -83,9 +83,9 @@ #define CC_HMAC_BLOCK_SIZE_MAX CC_HASH_BLOCK_SIZE_MAX -#define CC_MULTI2_SYSTEM_KEY_SIZE 32 -#define CC_MULTI2_DATA_KEY_SIZE 8 -#define CC_MULTI2_SYSTEM_N_DATA_KEY_SIZE (CC_MULTI2_SYSTEM_KEY_SIZE + CC_MULTI2_DATA_KEY_SIZE) +#define CC_MULTI2_SYSTEM_KEY_SIZE 32 +#define CC_MULTI2_DATA_KEY_SIZE 8 +#define CC_MULTI2_SYSTEM_N_DATA_KEY_SIZE (CC_MULTI2_SYSTEM_KEY_SIZE + CC_MULTI2_DATA_KEY_SIZE) #define CC_MULTI2_BLOCK_SIZE 8 #define CC_MULTI2_IV_SIZE 8 #define CC_MULTI2_MIN_NUM_ROUNDS 8 -- cgit v1.2.3-55-g7522 From 4f5d986592e761a4544234915bb5634fa4b74ea5 Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 24 May 2017 15:59:05 -0600 Subject: staging: ccree: Cleanup: remove references to page_link This is a layering violation so we replace it with calls to sg_page. This is a prep patch for replacing page_link and this is one of the very few uses outside of scatterlist.h. Signed-off-by: Logan Gunthorpe Signed-off-by: Stephen Bates Cc: Greg Kroah-Hartman Cc: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_buffer_mgr.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 77e490968db9..04515e70d2d3 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -43,8 +43,8 @@ #ifdef CC_DEBUG #define DUMP_SGL(sg) \ while (sg) { \ - SSI_LOG_DEBUG("page=%lu offset=%u length=%u (dma_len=%u) " \ - "dma_addr=%08x\n", (sg)->page_link, (sg)->offset, \ + SSI_LOG_DEBUG("page=%p offset=%u length=%u (dma_len=%u) " \ + "dma_addr=%08x\n", sg_page(sg), (sg)->offset, \ (sg)->length, sg_dma_len(sg), (sg)->dma_address); \ (sg) = sg_next(sg); \ } @@ -442,10 +442,10 @@ static int ssi_buffer_mgr_map_scatterlist( return -ENOMEM; } SSI_LOG_DEBUG("Mapped sg: dma_address=0x%llX " - "page_link=0x%08lX addr=%pK offset=%u " + "page=%p addr=%pK offset=%u " "length=%u\n", (unsigned long long)sg_dma_address(sg), - sg->page_link, + sg_page(sg), sg_virt(sg), sg->offset, sg->length); *lbytes = nbytes; @@ -505,10 +505,10 @@ ssi_aead_handle_config_buf(struct device *dev, return -ENOMEM; } SSI_LOG_DEBUG("Mapped curr_buff: dma_address=0x%llX " - "page_link=0x%08lX addr=%pK " + "page=%p addr=%pK " "offset=%u length=%u\n", (unsigned long long)sg_dma_address(&areq_ctx->ccm_adata_sg), - areq_ctx->ccm_adata_sg.page_link, + sg_page(&areq_ctx->ccm_adata_sg), sg_virt(&areq_ctx->ccm_adata_sg), areq_ctx->ccm_adata_sg.offset, areq_ctx->ccm_adata_sg.length); @@ -540,10 +540,10 @@ static inline int ssi_ahash_handle_curr_buf(struct device *dev, return -ENOMEM; } SSI_LOG_DEBUG("Mapped curr_buff: dma_address=0x%llX " - "page_link=0x%08lX addr=%pK " + "page=%p addr=%pK " "offset=%u length=%u\n", (unsigned long long)sg_dma_address(areq_ctx->buff_sg), - areq_ctx->buff_sg->page_link, + sg_page(areq_ctx->buff_sg), sg_virt(areq_ctx->buff_sg), areq_ctx->buff_sg->offset, areq_ctx->buff_sg->length); @@ -1870,4 +1870,3 @@ int ssi_buffer_mgr_fini(struct ssi_drvdata *drvdata) } return 0; } - -- cgit v1.2.3-55-g7522 From 603a1989c67785d2fec4d881067291adb904f1d7 Mon Sep 17 00:00:00 2001 From: Jon Frisch Date: Fri, 19 May 2017 16:17:35 -0400 Subject: staging: unisys: visorbus: rename typ to cr_type This patch renames enum crash_obj_type typ to cr_type. Signed-off-by: Jon Frisch Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 4cfd0fae9bd5..951e009a5dd6 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -470,7 +470,7 @@ enum crash_obj_type { }; static int -save_crash_message(struct controlvm_message *msg, enum crash_obj_type typ) +save_crash_message(struct controlvm_message *msg, enum crash_obj_type cr_type) { u32 local_crash_msg_offset; u16 local_crash_msg_count; @@ -502,7 +502,7 @@ save_crash_message(struct controlvm_message *msg, enum crash_obj_type typ) return err; } - switch (typ) { + switch (cr_type) { case CRASH_DEV: local_crash_msg_offset += sizeof(struct controlvm_message); err = visorchannel_write(chipset_dev->controlvm_channel, -- cgit v1.2.3-55-g7522 From ec17cb8a6c4b07472f03d950d6d2fb9d1b379d5d Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:36 -0400 Subject: staging: unisys: visorbus: renamed functions bus_create, bus_destroy and bus_configure to match driver namespace Renamed the functions bus_create() to visorbus_create(), bus_destroy() to visorbus_destroy() and bus_configure() to visorbus_configure Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 951e009a5dd6..68c2221eb35d 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -573,7 +573,7 @@ device_changestate_responder(enum controlvm_id cmd_id, } static int -bus_create(struct controlvm_message *inmsg) +visorbus_create(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_header *pmsg_hdr = NULL; @@ -585,7 +585,7 @@ bus_create(struct controlvm_message *inmsg) bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL); if (bus_info && (bus_info->state.created == 1)) { dev_err(&chipset_dev->acpi_device->dev, - "failed bus_create: already exists\n"); + "failed visorbus_create: already exists\n"); err = -EEXIST; goto err_respond; } @@ -654,7 +654,7 @@ err_respond: } static int -bus_destroy(struct controlvm_message *inmsg) +visorbus_destroy(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_header *pmsg_hdr = NULL; @@ -699,8 +699,8 @@ err_respond: } static int -bus_configure(struct controlvm_message *inmsg, - struct parser_context *parser_ctx) +visorbus_configure(struct controlvm_message *inmsg, + struct parser_context *parser_ctx) { struct controlvm_message_packet *cmd = &inmsg->cmd; u32 bus_no; @@ -737,7 +737,7 @@ bus_configure(struct controlvm_message *inmsg, err_respond: dev_err(&chipset_dev->acpi_device->dev, - "bus_configured exited with err: %d\n", err); + "visorbus_configure exited with err: %d\n", err); if (inmsg->hdr.flags.response_expected == 1) controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err); return err; @@ -1438,7 +1438,7 @@ setup_crash_devices_work_queue(struct work_struct *work) "no valid create_bus message\n"); return; } - bus_create(&local_crash_bus_msg); + visorbus_create(&local_crash_bus_msg); /* reuse create device message for storage device */ if (!local_crash_dev_msg.cmd.create_device.channel_addr) { @@ -1634,13 +1634,13 @@ handle_command(struct controlvm_message inmsg, u64 channel_addr) err = chipset_init(&inmsg); break; case CONTROLVM_BUS_CREATE: - err = bus_create(&inmsg); + err = visorbus_create(&inmsg); break; case CONTROLVM_BUS_DESTROY: - err = bus_destroy(&inmsg); + err = visorbus_destroy(&inmsg); break; case CONTROLVM_BUS_CONFIGURE: - err = bus_configure(&inmsg, parser_ctx); + err = visorbus_configure(&inmsg, parser_ctx); break; case CONTROLVM_DEVICE_CREATE: err = my_device_create(&inmsg); -- cgit v1.2.3-55-g7522 From 63847f17f7575fd71bbf6ebaed4f23a8b223b1c2 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:37 -0400 Subject: staging: unisys: visorbus: renamed functions like bus_*_response to match driver namespace Renamed functions bus_create_response() to visorbus_create_response() and bus_destroy_response() to visorbus_destroy_response(). Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++-- drivers/staging/unisys/visorbus/visorbus_private.h | 4 ++-- drivers/staging/unisys/visorbus/visorchipset.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index a692561c81c8..f02dfa7d28e3 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1086,7 +1086,7 @@ chipset_bus_create(struct visor_device *dev) if (err < 0) return err; - bus_create_response(dev, err); + visorbus_create_response(dev, err); return 0; } @@ -1095,7 +1095,7 @@ void chipset_bus_destroy(struct visor_device *dev) { remove_bus_instance(dev); - bus_destroy_response(dev, 0); + visorbus_destroy_response(dev, 0); } int diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 9f030b1f589f..b09268c1947d 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -34,8 +34,8 @@ void chipset_device_destroy(struct visor_device *dev_info); int chipset_device_pause(struct visor_device *dev_info); int chipset_device_resume(struct visor_device *dev_info); -void bus_create_response(struct visor_device *p, int response); -void bus_destroy_response(struct visor_device *p, int response); +void visorbus_create_response(struct visor_device *p, int response); +void visorbus_destroy_response(struct visor_device *p, int response); void device_create_response(struct visor_device *p, int response); void device_destroy_response(struct visor_device *p, int response); void device_resume_response(struct visor_device *p, int response); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 68c2221eb35d..a3ece142b386 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1450,7 +1450,7 @@ setup_crash_devices_work_queue(struct work_struct *work) } void -bus_create_response(struct visor_device *bus_info, int response) +visorbus_create_response(struct visor_device *bus_info, int response) { if (response >= 0) bus_info->state.created = 1; @@ -1463,7 +1463,7 @@ bus_create_response(struct visor_device *bus_info, int response) } void -bus_destroy_response(struct visor_device *bus_info, int response) +visorbus_destroy_response(struct visor_device *bus_info, int response) { controlvm_responder(CONTROLVM_BUS_DESTROY, bus_info->pending_msg_hdr, response); -- cgit v1.2.3-55-g7522 From f8b5a21febca4cbd5353ece7dcc0a3ed608b187e Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:38 -0400 Subject: staging: unisys: visorbus: renamed functions like device_*_response to match driver namespace Renamed functions * device_create_response() to visorbus_device_create_response() * device_destroy_response() to visorbus_device_destroy_response() * device_pause_response() to visorbus_device_pause_response() * device_resume_response() to visorbus_device_resume_response() Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 8 ++++---- drivers/staging/unisys/visorbus/visorbus_private.h | 8 ++++---- drivers/staging/unisys/visorbus/visorchipset.c | 9 ++++----- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index f02dfa7d28e3..c122ce62ca1e 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1107,7 +1107,7 @@ chipset_device_create(struct visor_device *dev_info) if (err < 0) return err; - device_create_response(dev_info, err); + visorbus_device_create_response(dev_info, err); return 0; } @@ -1117,7 +1117,7 @@ chipset_device_destroy(struct visor_device *dev_info) { remove_visor_device(dev_info); - device_destroy_response(dev_info, 0); + visorbus_device_destroy_response(dev_info, 0); } /* @@ -1137,7 +1137,7 @@ pause_state_change_complete(struct visor_device *dev, int status) dev->pausing = false; - device_pause_response(dev, status); + visorbus_device_pause_response(dev, status); } /* @@ -1162,7 +1162,7 @@ resume_state_change_complete(struct visor_device *dev, int status) * which will presumably want to send some sort of response to * the initiator. */ - device_resume_response(dev, status); + visorbus_device_resume_response(dev, status); } /* diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index b09268c1947d..4ecfd7b7e678 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -36,10 +36,10 @@ int chipset_device_resume(struct visor_device *dev_info); void visorbus_create_response(struct visor_device *p, int response); void visorbus_destroy_response(struct visor_device *p, int response); -void device_create_response(struct visor_device *p, int response); -void device_destroy_response(struct visor_device *p, int response); -void device_resume_response(struct visor_device *p, int response); -void device_pause_response(struct visor_device *p, int response); +void visorbus_device_create_response(struct visor_device *p, int response); +void visorbus_device_destroy_response(struct visor_device *p, int response); +void visorbus_device_resume_response(struct visor_device *p, int response); +void visorbus_device_pause_response(struct visor_device *p, int response); int visorbus_init(void); void visorbus_exit(void); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index a3ece142b386..3076b7728bd3 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1473,7 +1473,7 @@ visorbus_destroy_response(struct visor_device *bus_info, int response) } void -device_create_response(struct visor_device *dev_info, int response) +visorbus_device_create_response(struct visor_device *dev_info, int response) { if (response >= 0) dev_info->state.created = 1; @@ -1486,7 +1486,7 @@ device_create_response(struct visor_device *dev_info, int response) } void -device_destroy_response(struct visor_device *dev_info, int response) +visorbus_device_destroy_response(struct visor_device *dev_info, int response) { controlvm_responder(CONTROLVM_DEVICE_DESTROY, dev_info->pending_msg_hdr, response); @@ -1496,8 +1496,7 @@ device_destroy_response(struct visor_device *dev_info, int response) } void -device_pause_response(struct visor_device *dev_info, - int response) +visorbus_device_pause_response(struct visor_device *dev_info, int response) { device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, dev_info, response, @@ -1508,7 +1507,7 @@ device_pause_response(struct visor_device *dev_info, } void -device_resume_response(struct visor_device *dev_info, int response) +visorbus_device_resume_response(struct visor_device *dev_info, int response) { device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, dev_info, response, -- cgit v1.2.3-55-g7522 From 9e78fd35dfd1bb8443edf29e589de2e144d17937 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:39 -0400 Subject: staging: unisys: visorbus: renamed functions like *_bus_instance to match driver namespace Renamed functions * create_bus_instance() to visorbus_create_instance() * remove_bus_instance() to visorbus_remove_instance() Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index c122ce62ca1e..03e29b5031eb 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -981,14 +981,14 @@ int visorbus_register_visor_driver(struct visor_driver *drv) EXPORT_SYMBOL_GPL(visorbus_register_visor_driver); /* - * create_bus_instance() - create a device instance for the visor bus itself + * visorbus_create_instance() - create a device instance for the visorbus itself * @dev: struct visor_device indicating the bus instance * * Return: 0 for success, otherwise negative errno value indicating reason for * failure */ static int -create_bus_instance(struct visor_device *dev) +visorbus_create_instance(struct visor_device *dev) { int id = dev->chipset_bus_no; int err; @@ -1032,16 +1032,16 @@ create_bus_instance(struct visor_device *dev) err_debugfs_dir: debugfs_remove_recursive(dev->debugfs_dir); kfree(hdr_info); - dev_err(&dev->device, "create_bus_instance failed: %d\n", err); + dev_err(&dev->device, "visorbus_create_instance failed: %d\n", err); return err; } /* - * remove_bus_instance() - remove a device instance for the visor bus itself + * visorbus_remove_instance() - remove a device instance for the visorbus itself * @dev: struct visor_device indentifying the bus to remove */ static void -remove_bus_instance(struct visor_device *dev) +visorbus_remove_instance(struct visor_device *dev) { /* * Note that this will result in the release method for @@ -1061,7 +1061,7 @@ remove_bus_instance(struct visor_device *dev) } /* - * remove_all_visor_devices() - remove all child visor bus device instances + * remove_all_visor_devices() - remove all child visorbus device instances */ static void remove_all_visor_devices(void) @@ -1081,7 +1081,7 @@ chipset_bus_create(struct visor_device *dev) { int err; - err = create_bus_instance(dev); + err = visorbus_create_instance(dev); if (err < 0) return err; @@ -1094,7 +1094,7 @@ chipset_bus_create(struct visor_device *dev) void chipset_bus_destroy(struct visor_device *dev) { - remove_bus_instance(dev); + visorbus_remove_instance(dev); visorbus_destroy_response(dev, 0); } @@ -1289,7 +1289,7 @@ visorbus_exit(void) struct visor_device *dev = list_entry(listentry, struct visor_device, list_all); - remove_bus_instance(dev); + visorbus_remove_instance(dev); } bus_unregister(&visorbus_type); -- cgit v1.2.3-55-g7522 From 4f96c7308e8c24dc8e02863830703353c0099cdd Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:40 -0400 Subject: staging: unisys: visorbus: renamed functions like chipset_bus_* to match driver namespace Renamed functions * chipset_bus_create() to visorchipset_bus_create() * chipset_bus_destroy() to visorchipset_bus_destroy() Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++-- drivers/staging/unisys/visorbus/visorbus_private.h | 4 ++-- drivers/staging/unisys/visorbus/visorchipset.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 03e29b5031eb..5ba807ccc45b 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1077,7 +1077,7 @@ remove_all_visor_devices(void) } int -chipset_bus_create(struct visor_device *dev) +visorchipset_bus_create(struct visor_device *dev) { int err; @@ -1092,7 +1092,7 @@ chipset_bus_create(struct visor_device *dev) } void -chipset_bus_destroy(struct visor_device *dev) +visorchipset_bus_destroy(struct visor_device *dev) { visorbus_remove_instance(dev); visorbus_destroy_response(dev, 0); diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 4ecfd7b7e678..3c8993595b25 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -27,8 +27,8 @@ * command line */ -int chipset_bus_create(struct visor_device *bus_info); -void chipset_bus_destroy(struct visor_device *bus_info); +int visorchipset_bus_create(struct visor_device *bus_info); +void visorchipset_bus_destroy(struct visor_device *bus_info); int chipset_device_create(struct visor_device *dev_info); void chipset_device_destroy(struct visor_device *dev_info); int chipset_device_pause(struct visor_device *dev_info); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 3076b7728bd3..eea70f43e5a1 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -630,9 +630,9 @@ visorbus_create(struct controlvm_message *inmsg) } bus_info->visorchannel = visorchannel; - /* Response will be handled by chipset_bus_create */ - err = chipset_bus_create(bus_info); - /* If error chipset_bus_create didn't respond, need to respond here */ + /* Response will be handled by visorchipset_bus_create */ + err = visorchipset_bus_create(bus_info); + /* If visorchipset_bus_create didn't respond, need to respond here */ if (err) goto err_destroy_channel; @@ -688,8 +688,8 @@ visorbus_destroy(struct controlvm_message *inmsg) bus_info->pending_msg_hdr = pmsg_hdr; } - /* Response will be handled by chipset_bus_destroy */ - chipset_bus_destroy(bus_info); + /* Response will be handled by visorchipset_bus_destroy */ + visorchipset_bus_destroy(bus_info); return 0; err_respond: -- cgit v1.2.3-55-g7522 From c0b44136c8bcfbc38ee8d8c9bf3de1b950ecfcbc Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:41 -0400 Subject: staging: unisys: visorbus: renamed functions like chipset_device_* to match driver namespace Renamed functions * chipset_device_create() to visorchipset_device_create() * chipset_device_destroy() to visorchipset_device_destroy() * chipset_device_pause() to visorchipset_device_pause() * chipset_device_resume() to visorchipset_device_resume() Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 12 ++++++------ drivers/staging/unisys/visorbus/visorbus_private.h | 8 ++++---- drivers/staging/unisys/visorbus/visorchipset.c | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 5ba807ccc45b..f0b08d1d98c1 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1099,7 +1099,7 @@ visorchipset_bus_destroy(struct visor_device *dev) } int -chipset_device_create(struct visor_device *dev_info) +visorchipset_device_create(struct visor_device *dev_info) { int err; @@ -1113,7 +1113,7 @@ chipset_device_create(struct visor_device *dev_info) } void -chipset_device_destroy(struct visor_device *dev_info) +visorchipset_device_destroy(struct visor_device *dev_info) { remove_visor_device(dev_info); @@ -1211,7 +1211,7 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) } /** - * chipset_device_pause() - start a pause operation for a visor device + * visorchipset_device_pause() - start a pause operation for a visor device * @dev_info: struct visor_device identifying the device being paused * * Tell the subordinate function driver for a specific device to pause @@ -1219,7 +1219,7 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) * via a callback function; see pause_state_change_complete(). */ int -chipset_device_pause(struct visor_device *dev_info) +visorchipset_device_pause(struct visor_device *dev_info) { int err; @@ -1234,7 +1234,7 @@ chipset_device_pause(struct visor_device *dev_info) } /** - * chipset_device_resume() - start a resume operation for a visor device + * visorchipset_device_resume() - start a resume operation for a visor device * @dev_info: struct visor_device identifying the device being resumed * * Tell the subordinate function driver for a specific device to resume @@ -1242,7 +1242,7 @@ chipset_device_pause(struct visor_device *dev_info) * via a callback function; see resume_state_change_complete(). */ int -chipset_device_resume(struct visor_device *dev_info) +visorchipset_device_resume(struct visor_device *dev_info) { int err; diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 3c8993595b25..98a5af19189d 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -29,10 +29,10 @@ int visorchipset_bus_create(struct visor_device *bus_info); void visorchipset_bus_destroy(struct visor_device *bus_info); -int chipset_device_create(struct visor_device *dev_info); -void chipset_device_destroy(struct visor_device *dev_info); -int chipset_device_pause(struct visor_device *dev_info); -int chipset_device_resume(struct visor_device *dev_info); +int visorchipset_device_create(struct visor_device *dev_info); +void visorchipset_device_destroy(struct visor_device *dev_info); +int visorchipset_device_pause(struct visor_device *dev_info); +int visorchipset_device_resume(struct visor_device *dev_info); void visorbus_create_response(struct visor_device *p, int response); void visorbus_destroy_response(struct visor_device *p, int response); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index eea70f43e5a1..f9ef864ca15e 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -824,8 +824,8 @@ my_device_create(struct controlvm_message *inmsg) sizeof(struct controlvm_message_header)); dev_info->pending_msg_hdr = pmsg_hdr; } - /* Chipset_device_create will send response */ - err = chipset_device_create(dev_info); + /* visorchipset_device_create will send response */ + err = visorchipset_device_create(dev_info); if (err) goto err_destroy_visorchannel; @@ -882,16 +882,16 @@ my_device_changestate(struct controlvm_message *inmsg) if (state.alive == segment_state_running.alive && state.operating == segment_state_running.operating) - /* Response will be sent from chipset_device_resume */ - err = chipset_device_resume(dev_info); + /* Response will be sent from visorchipset_device_resume */ + err = visorchipset_device_resume(dev_info); /* ServerNotReady / ServerLost / SegmentStateStandby */ else if (state.alive == segment_state_standby.alive && state.operating == segment_state_standby.operating) /* * technically this is standby case where server is lost. - * Response will be sent from chipset_device_pause. + * Response will be sent from visorchipset_device_pause. */ - err = chipset_device_pause(dev_info); + err = visorchipset_device_pause(dev_info); if (err) goto err_respond; @@ -941,7 +941,7 @@ my_device_destroy(struct controlvm_message *inmsg) dev_info->pending_msg_hdr = pmsg_hdr; } - chipset_device_destroy(dev_info); + visorchipset_device_destroy(dev_info); return 0; err_respond: -- cgit v1.2.3-55-g7522 From 451072e3f0c7ff46e887765b225513ff0ee29aa2 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:42 -0400 Subject: staging: unisys: visorbus: renamed function initiate_chipset_device_pause_resume to match driver namespace Renamed function initiate_chipset_device_pause_resume() to visorchipset_initiate_device_pause_resume(). Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index f0b08d1d98c1..984d4d15fa93 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1166,8 +1166,8 @@ resume_state_change_complete(struct visor_device *dev, int status) } /* - * initiate_chipset_device_pause_resume() - start a pause or resume operation - * for a visor device + * visorchipset_initiate_device_pause_resume() - start a pause or resume + * operation for a visor device * @dev: struct visor_device identifying the device being paused or resumed * @is_pause: true to indicate pause operation, false to indicate resume * @@ -1177,7 +1177,8 @@ resume_state_change_complete(struct visor_device *dev, int status) * resume_state_change_complete(). */ static int -initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) +visorchipset_initiate_device_pause_resume(struct visor_device *dev, + bool is_pause) { int err; struct visor_driver *drv = NULL; @@ -1223,7 +1224,7 @@ visorchipset_device_pause(struct visor_device *dev_info) { int err; - err = initiate_chipset_device_pause_resume(dev_info, true); + err = visorchipset_initiate_device_pause_resume(dev_info, true); if (err < 0) { dev_info->pausing = false; @@ -1246,7 +1247,7 @@ visorchipset_device_resume(struct visor_device *dev_info) { int err; - err = initiate_chipset_device_pause_resume(dev_info, false); + err = visorchipset_initiate_device_pause_resume(dev_info, false); if (err < 0) { dev_info->resuming = false; -- cgit v1.2.3-55-g7522 From 8b0a6cfa7f91d980e50ee05446af4b9ff3131c2a Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:43 -0400 Subject: staging: unisys: visorbus: renamed functions like my_device_* to match driver namespace Renamed functions * my_device_create() to visorbus_device_create() * my_device_changestate() to visorbus_device_changestate() * my_device_destroy() to visorbus_device_destroy() Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index f9ef864ca15e..630dd05e1460 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -744,7 +744,7 @@ err_respond: } static int -my_device_create(struct controlvm_message *inmsg) +visorbus_device_create(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_header *pmsg_hdr = NULL; @@ -844,7 +844,7 @@ err_respond: } static int -my_device_changestate(struct controlvm_message *inmsg) +visorbus_device_changestate(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_header *pmsg_hdr = NULL; @@ -905,7 +905,7 @@ err_respond: } static int -my_device_destroy(struct controlvm_message *inmsg) +visorbus_device_destroy(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_header *pmsg_hdr = NULL; @@ -1446,7 +1446,7 @@ setup_crash_devices_work_queue(struct work_struct *work) "no valid create_device message\n"); return; } - my_device_create(&local_crash_dev_msg); + visorbus_device_create(&local_crash_dev_msg); } void @@ -1642,7 +1642,7 @@ handle_command(struct controlvm_message inmsg, u64 channel_addr) err = visorbus_configure(&inmsg, parser_ctx); break; case CONTROLVM_DEVICE_CREATE: - err = my_device_create(&inmsg); + err = visorbus_device_create(&inmsg); break; case CONTROLVM_DEVICE_CHANGESTATE: if (cmd->device_change_state.flags.phys_device) { @@ -1652,12 +1652,12 @@ handle_command(struct controlvm_message inmsg, u64 channel_addr) * save the hdr and cmd structures for later use * when sending back the response to Command */ - err = my_device_changestate(&inmsg); + err = visorbus_device_changestate(&inmsg); break; } break; case CONTROLVM_DEVICE_DESTROY: - err = my_device_destroy(&inmsg); + err = visorbus_device_destroy(&inmsg); break; case CONTROLVM_DEVICE_CONFIGURE: /* no op just send a respond that we passed */ -- cgit v1.2.3-55-g7522 From 734721746ec576f06788123628df2b0ad3ded54b Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:44 -0400 Subject: staging: unisys: visorbus: renamed #defines in vbuschannel.h to match driver namespace Renamed #defines: * SPAR_VBUS_CHANNEL_PROTOCOL_UUID to VISOR_VBUS_CHANNEL_UUID * SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE to VISOR_VBUS_CHANNEL_SIGNATURE * SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID to VISOR_VBUS_CHANNEL_VERSIONID Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/vbuschannel.h | 9 ++++----- drivers/staging/unisys/visorbus/visorbus_main.c | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h index f0ef5ecf3d7d..c87b190ccc66 100644 --- a/drivers/staging/unisys/visorbus/vbuschannel.h +++ b/drivers/staging/unisys/visorbus/vbuschannel.h @@ -27,13 +27,12 @@ #include "channel.h" /* {193b331b-c58f-11da-95a9-00e08161165f} */ -#define SPAR_VBUS_CHANNEL_PROTOCOL_UUID \ +#define VISOR_VBUS_CHANNEL_UUID \ UUID_LE(0x193b331b, 0xc58f, 0x11da, \ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) -static const uuid_le spar_vbus_channel_protocol_uuid = - SPAR_VBUS_CHANNEL_PROTOCOL_UUID; +static const uuid_le visor_vbus_channel_uuid = VISOR_VBUS_CHANNEL_UUID; -#define SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE +#define VISOR_VBUS_CHANNEL_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 @@ -41,7 +40,7 @@ static const uuid_le spar_vbus_channel_protocol_uuid = * usually add fields to the END of the channel struct withOUT needing to * increment this. */ -#define SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID 1 +#define VISOR_VBUS_CHANNEL_VERSIONID 1 /* * An array of this struct is present in the channel area for each vbus. diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 984d4d15fa93..f72ccd901760 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -689,11 +689,11 @@ get_vbus_header_info(struct visorchannel *chan, int err; if (!spar_check_channel(visorchannel_get_header(chan), - spar_vbus_channel_protocol_uuid, + visor_vbus_channel_uuid, "vbus", sizeof(struct spar_vbus_channel_protocol), - SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID, - SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE)) + VISOR_VBUS_CHANNEL_VERSIONID, + VISOR_VBUS_CHANNEL_SIGNATURE)) return -EINVAL; err = visorchannel_read(chan, sizeof(struct channel_header), hdr_info, -- cgit v1.2.3-55-g7522 From 55c71ebaf69ac64b4a4aec6ff1ea4e22c8883231 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:45 -0400 Subject: staging: unisys: visorbus: renamed structures in vbuschannel.h to match driver namespace Renamed structures * ultra_vbus_deviceinfo to visor_vbus_deviceinfo * spar_vbus_headerinfo to visor_vbus_headerinfo * spar_vbus_channel_protocol to visor_vbus_channel Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/vbuschannel.h | 16 +++---- drivers/staging/unisys/visorbus/visorbus_main.c | 58 ++++++++++++------------- 2 files changed, 36 insertions(+), 38 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h index c87b190ccc66..ee5c7b912366 100644 --- a/drivers/staging/unisys/visorbus/vbuschannel.h +++ b/drivers/staging/unisys/visorbus/vbuschannel.h @@ -48,16 +48,16 @@ static const uuid_le visor_vbus_channel_uuid = VISOR_VBUS_CHANNEL_UUID; * It is filled in by the client side to provide info about the device * and driver from the client's perspective. */ -struct ultra_vbus_deviceinfo { +struct visor_vbus_deviceinfo { u8 devtype[16]; /* short string identifying the device type */ u8 drvname[16]; /* driver .sys file name */ u8 infostrs[96]; /* kernel version */ u8 reserved[128]; /* pad size to 256 bytes */ } __packed; -struct spar_vbus_headerinfo { +struct visor_vbus_headerinfo { u32 struct_bytes; /* size of this struct in bytes */ - u32 device_info_struct_bytes; /* sizeof(ULTRA_VBUS_DEVICEINFO) */ + u32 device_info_struct_bytes; /* sizeof(VISOR_VBUS_DEVICEINFO) */ u32 dev_info_count; /* num of items in DevInfo member */ /* (this is the allocated size) */ u32 chp_info_offset; /* byte offset from beginning of this struct */ @@ -69,15 +69,15 @@ struct spar_vbus_headerinfo { u8 reserved[104]; } __packed; -struct spar_vbus_channel_protocol { +struct visor_vbus_channel { struct channel_header channel_header; /* initialized by server */ - struct spar_vbus_headerinfo hdr_info; /* initialized by server */ + struct visor_vbus_headerinfo hdr_info; /* initialized by server */ /* the remainder of this channel is filled in by the client */ - struct ultra_vbus_deviceinfo chp_info; + struct visor_vbus_deviceinfo chp_info; /* describes client chipset device and driver */ - struct ultra_vbus_deviceinfo bus_info; + struct visor_vbus_deviceinfo bus_info; /* describes client bus device and driver */ - struct ultra_vbus_deviceinfo dev_info[0]; + struct visor_vbus_deviceinfo dev_info[0]; /* describes client device and driver for each device on the bus */ } __packed; diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index f72ccd901760..e2631f553131 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -64,9 +64,9 @@ static const struct attribute_group *visorbus_dev_groups[] = { }; /* filled in with info about parent chipset driver when we register with it */ -static struct ultra_vbus_deviceinfo chipset_driverinfo; +static struct visor_vbus_deviceinfo chipset_driverinfo; /* filled in with info about this driver, wrt it servicing client busses */ -static struct ultra_vbus_deviceinfo clientbus_driverinfo; +static struct visor_vbus_deviceinfo clientbus_driverinfo; /* list of visor_device structs, linked via .list_all */ static LIST_HEAD(list_all_bus_instances); @@ -356,9 +356,9 @@ static const struct attribute_group *visorbus_groups[] = { * /sys/kernel/debug/visorbus/visorbus. */ /* - * vbuschannel_print_devinfo() - format a struct ultra_vbus_deviceinfo + * vbuschannel_print_devinfo() - format a struct visor_vbus_deviceinfo * and write it to a seq_file - * @devinfo: the struct ultra_vbus_deviceinfo to format + * @devinfo: the struct visor_vbus_deviceinfo to format * @seq: seq_file to write to * @devix: the device index to be included in the output data, or -1 if no * device index is to be included @@ -366,7 +366,7 @@ static const struct attribute_group *visorbus_groups[] = { * Reads @devInfo, and writes it in human-readable notation to @seq. */ static void -vbuschannel_print_devinfo(struct ultra_vbus_deviceinfo *devinfo, +vbuschannel_print_devinfo(struct visor_vbus_deviceinfo *devinfo, struct seq_file *seq, int devix) { if (!isprint(devinfo->devtype[0])) @@ -397,7 +397,7 @@ static int client_bus_info_debugfs_show(struct seq_file *seq, void *v) int i; unsigned long off; - struct ultra_vbus_deviceinfo dev_info; + struct visor_vbus_deviceinfo dev_info; if (!channel) return 0; @@ -407,16 +407,14 @@ static int client_bus_info_debugfs_show(struct seq_file *seq, void *v) ((vdev->name) ? (char *)(vdev->name) : ""), vdev->chipset_bus_no); if (visorchannel_read(channel, - offsetof(struct spar_vbus_channel_protocol, - chp_info), + offsetof(struct visor_vbus_channel, chp_info), &dev_info, sizeof(dev_info)) >= 0) vbuschannel_print_devinfo(&dev_info, seq, -1); if (visorchannel_read(channel, - offsetof(struct spar_vbus_channel_protocol, - bus_info), + offsetof(struct visor_vbus_channel, bus_info), &dev_info, sizeof(dev_info)) >= 0) vbuschannel_print_devinfo(&dev_info, seq, -1); - off = offsetof(struct spar_vbus_channel_protocol, dev_info); + off = offsetof(struct visor_vbus_channel, dev_info); i = 0; while (off + sizeof(dev_info) <= visorchannel_get_nbytes(channel)) { if (visorchannel_read(channel, off, &dev_info, @@ -684,14 +682,14 @@ remove_visor_device(struct visor_device *dev) static int get_vbus_header_info(struct visorchannel *chan, - struct spar_vbus_headerinfo *hdr_info) + struct visor_vbus_headerinfo *hdr_info) { int err; if (!spar_check_channel(visorchannel_get_header(chan), visor_vbus_channel_uuid, "vbus", - sizeof(struct spar_vbus_channel_protocol), + sizeof(struct visor_vbus_channel), VISOR_VBUS_CHANNEL_VERSIONID, VISOR_VBUS_CHANNEL_SIGNATURE)) return -EINVAL; @@ -701,11 +699,11 @@ get_vbus_header_info(struct visorchannel *chan, if (err < 0) return err; - if (hdr_info->struct_bytes < sizeof(struct spar_vbus_headerinfo)) + if (hdr_info->struct_bytes < sizeof(struct visor_vbus_headerinfo)) return -EINVAL; if (hdr_info->device_info_struct_bytes < - sizeof(struct ultra_vbus_deviceinfo)) + sizeof(struct visor_vbus_deviceinfo)) return -EINVAL; return 0; @@ -713,7 +711,7 @@ get_vbus_header_info(struct visorchannel *chan, /* * write_vbus_chp_info() - write the contents of to the struct - * spar_vbus_channel_protocol.chp_info + * visor_vbus_channel.chp_info * @chan: indentifies the s-Par channel that will be updated * @hdr_info: used to find appropriate channel offset to write data * @info: contains the information to write @@ -726,8 +724,8 @@ get_vbus_header_info(struct visorchannel *chan, */ static void write_vbus_chp_info(struct visorchannel *chan, - struct spar_vbus_headerinfo *hdr_info, - struct ultra_vbus_deviceinfo *info) + struct visor_vbus_headerinfo *hdr_info, + struct visor_vbus_deviceinfo *info) { int off = sizeof(struct channel_header) + hdr_info->chp_info_offset; @@ -739,7 +737,7 @@ write_vbus_chp_info(struct visorchannel *chan, /* * write_vbus_bus_info() - write the contents of to the struct - * spar_vbus_channel_protocol.bus_info + * visor_vbus_channel.bus_info * @chan: indentifies the s-Par channel that will be updated * @hdr_info: used to find appropriate channel offset to write data * @info: contains the information to write @@ -752,8 +750,8 @@ write_vbus_chp_info(struct visorchannel *chan, */ static void write_vbus_bus_info(struct visorchannel *chan, - struct spar_vbus_headerinfo *hdr_info, - struct ultra_vbus_deviceinfo *info) + struct visor_vbus_headerinfo *hdr_info, + struct visor_vbus_deviceinfo *info) { int off = sizeof(struct channel_header) + hdr_info->bus_info_offset; @@ -765,7 +763,7 @@ write_vbus_bus_info(struct visorchannel *chan, /* * write_vbus_dev_info() - write the contents of to the struct - * spar_vbus_channel_protocol.dev_info[] + * visor_vbus_channel.dev_info[] * @chan: indentifies the s-Par channel that will be updated * @hdr_info: used to find appropriate channel offset to write data * @info: contains the information to write @@ -779,8 +777,8 @@ write_vbus_bus_info(struct visorchannel *chan, */ static void write_vbus_dev_info(struct visorchannel *chan, - struct spar_vbus_headerinfo *hdr_info, - struct ultra_vbus_deviceinfo *info, unsigned int devix) + struct visor_vbus_headerinfo *hdr_info, + struct visor_vbus_deviceinfo *info, unsigned int devix) { int off = (sizeof(struct channel_header) + hdr_info->dev_info_offset) + @@ -793,10 +791,10 @@ write_vbus_dev_info(struct visorchannel *chan, } static void bus_device_info_init( - struct ultra_vbus_deviceinfo *bus_device_info_ptr, + struct visor_vbus_deviceinfo *bus_device_info_ptr, const char *dev_type, const char *drv_name) { - memset(bus_device_info_ptr, 0, sizeof(struct ultra_vbus_deviceinfo)); + memset(bus_device_info_ptr, 0, sizeof(struct visor_vbus_deviceinfo)); snprintf(bus_device_info_ptr->devtype, sizeof(bus_device_info_ptr->devtype), "%s", (dev_type) ? dev_type : "unknownType"); @@ -823,9 +821,9 @@ fix_vbus_dev_info(struct visor_device *visordev) struct visor_driver *visordrv; u32 bus_no = visordev->chipset_bus_no; u32 dev_no = visordev->chipset_dev_no; - struct ultra_vbus_deviceinfo dev_info; + struct visor_vbus_deviceinfo dev_info; const char *chan_type_name = NULL; - struct spar_vbus_headerinfo *hdr_info; + struct visor_vbus_headerinfo *hdr_info; if (!visordev->device.driver) return; @@ -833,7 +831,7 @@ fix_vbus_dev_info(struct visor_device *visordev) bdev = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL); if (!bdev) return; - hdr_info = (struct spar_vbus_headerinfo *)bdev->vbus_hdr_info; + hdr_info = (struct visor_vbus_headerinfo *)bdev->vbus_hdr_info; if (!hdr_info) return; visordrv = to_visor_driver(visordev->device.driver); @@ -992,7 +990,7 @@ visorbus_create_instance(struct visor_device *dev) { int id = dev->chipset_bus_no; int err; - struct spar_vbus_headerinfo *hdr_info; + struct visor_vbus_headerinfo *hdr_info; hdr_info = kzalloc(sizeof(*hdr_info), GFP_KERNEL); if (!hdr_info) -- cgit v1.2.3-55-g7522 From 2b8ec7da96c197368e5e59d38efb5a5265eb87a7 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:46 -0400 Subject: staging: unisys: visorbus: renamed #define in visorchannel.c to match driver namespace Renamed SPAR_CONSOLEVIDEO_CHANNEL_PROTOCOL_GUID to VISOR_CONSOLEVIDEO_CHANNEL_GUID and renamed const spar_video_guid to visor_video_guid Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchannel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 9e1cea22ce68..6885c2cb7135 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -28,11 +28,11 @@ #define MYDRVNAME "visorchannel" -#define SPAR_CONSOLEVIDEO_CHANNEL_PROTOCOL_GUID \ +#define VISOR_CONSOLEVIDEO_CHANNEL_GUID \ UUID_LE(0x3cd6e705, 0xd6a2, 0x4aa5, \ 0xad, 0x5c, 0x7b, 0x8, 0x88, 0x9d, 0xff, 0xe2) -static const uuid_le spar_video_guid = SPAR_CONSOLEVIDEO_CHANNEL_PROTOCOL_GUID; +static const uuid_le visor_video_guid = VISOR_CONSOLEVIDEO_CHANNEL_GUID; struct visorchannel { u64 physaddr; @@ -415,7 +415,7 @@ visorchannel_create_guts(u64 physaddr, unsigned long channel_bytes, * release later on. */ channel->requested = request_mem_region(physaddr, size, MYDRVNAME); - if (!channel->requested && uuid_le_cmp(guid, spar_video_guid)) + if (!channel->requested && uuid_le_cmp(guid, visor_video_guid)) /* we only care about errors if this is not the video channel */ goto err_destroy_channel; @@ -445,7 +445,7 @@ visorchannel_create_guts(u64 physaddr, unsigned long channel_bytes, channel->mapped = NULL; channel->requested = request_mem_region(channel->physaddr, channel_bytes, MYDRVNAME); - if (!channel->requested && uuid_le_cmp(guid, spar_video_guid)) + if (!channel->requested && uuid_le_cmp(guid, visor_video_guid)) /* we only care about errors if this is not the video channel */ goto err_destroy_channel; -- cgit v1.2.3-55-g7522 From a27ded9272c763e598adedd445f9c838265b46c1 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:47 -0400 Subject: staging: unisys: visorbus: renamed #defines in visorchipset.c to match driver namespace Renamed #defines * UNISYS_SPAR_LEAF_ID to UNISYS_VISOR_LEAF_ID * UNISYS_SPAR_ID_EBX to UNISYS_VISOR_ID_EBX * UNISYS_SPAR_ID_ECX to UNISYS_VISOR_ID_ECX * UNISYS_SPAR_ID_EDX to UNISYS_VISOR_ID_EDX Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 630dd05e1460..971ad9a2fe6f 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -34,12 +34,12 @@ #define MAX_CONTROLVM_PAYLOAD_BYTES (1024 * 128) -#define UNISYS_SPAR_LEAF_ID 0x40000000 +#define UNISYS_VISOR_LEAF_ID 0x40000000 /* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */ -#define UNISYS_SPAR_ID_EBX 0x73696e55 -#define UNISYS_SPAR_ID_ECX 0x70537379 -#define UNISYS_SPAR_ID_EDX 0x34367261 +#define UNISYS_VISOR_ID_EBX 0x73696e55 +#define UNISYS_VISOR_ID_ECX 0x70537379 +#define UNISYS_VISOR_ID_EDX 0x34367261 /* * When the controlvm channel is idle for at least MIN_IDLE_SECONDS, @@ -1927,10 +1927,10 @@ static __init int visorutil_spar_detect(void) if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) { /* check the ID */ - cpuid(UNISYS_SPAR_LEAF_ID, &eax, &ebx, &ecx, &edx); - return (ebx == UNISYS_SPAR_ID_EBX) && - (ecx == UNISYS_SPAR_ID_ECX) && - (edx == UNISYS_SPAR_ID_EDX); + cpuid(UNISYS_VISOR_LEAF_ID, &eax, &ebx, &ecx, &edx); + return (ebx == UNISYS_VISOR_ID_EBX) && + (ecx == UNISYS_VISOR_ID_ECX) && + (edx == UNISYS_VISOR_ID_EDX); } else { return 0; } -- cgit v1.2.3-55-g7522 From c5a28902b466b531d5170d08bc3ac610e27b2605 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:48 -0400 Subject: staging: unisys: visorbus: renamed #defines in controlvmchannel.h to match driver namespace Renamed #defines * SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID to VISOR_CONTROLVM_CHANNEL_UUID * ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE to VISOR_CONTROLVM_CHANNEL_SIGNATURE * ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID to VISOR_CONTROLVM_CHANNEL_VERSIONID * SPAR_CONTROLVM_CHANNEL_OK_CLIENT to VISOR_CONTROLVM_CHANNEL_OK_CLIENT Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/controlvmchannel.h | 19 +++++++++---------- drivers/staging/unisys/visorbus/visorchipset.c | 16 ++++++++-------- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h index 274f72422166..8cd214778978 100644 --- a/drivers/staging/unisys/visorbus/controlvmchannel.h +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h @@ -19,12 +19,11 @@ #include "channel.h" /* {2B3C2D10-7EF5-4ad8-B966-3448B7386B3D} */ -#define SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID \ +#define VISOR_CONTROLVM_CHANNEL_UUID \ UUID_LE(0x2b3c2d10, 0x7ef5, 0x4ad8, \ 0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d) -#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE \ - ULTRA_CHANNEL_PROTOCOL_SIGNATURE +#define VISOR_CONTROLVM_CHANNEL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE #define CONTROLVM_MESSAGE_MAX 64 /* Must increment this whenever you insert or delete fields within @@ -33,15 +32,15 @@ * software. Note that you can usually add fields to the END of the * channel struct withOUT needing to increment this. */ -#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID 1 +#define VISOR_CONTROLVM_CHANNEL_VERSIONID 1 -#define SPAR_CONTROLVM_CHANNEL_OK_CLIENT(ch) \ +#define VISOR_CONTROLVM_CHANNEL_OK_CLIENT(ch) \ (spar_check_channel(ch, \ - SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID, \ + VISOR_CONTROLVM_CHANNEL_UUID, \ "controlvm", \ sizeof(struct spar_controlvm_channel_protocol), \ - ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE)) + VISOR_CONTROLVM_CHANNEL_VERSIONID, \ + VISOR_CONTROLVM_CHANNEL_SIGNATURE)) /* Defines for various channel queues */ #define CONTROLVM_QUEUE_REQUEST 0 @@ -371,7 +370,7 @@ struct spar_controlvm_channel_protocol { u32 message_count; /* CONTROLVM_MESSAGE_MAX */ u64 gp_smbios_table; /* guest phys addr of SMBIOS tables */ u64 gp_physical_smbios_table; /* guest phys addr of SMBIOS table */ - /* ULTRA_MAX_GUESTS_PER_SERVICE */ + /* VISOR_MAX_GUESTS_PER_SERVICE */ char gp_reserved[2688]; /* guest physical address of EFI firmware image base */ @@ -402,7 +401,7 @@ struct spar_controlvm_channel_protocol { u32 installation_text_id; /* Id of string to display */ /* Number of remaining installation steps (for progress bars) */ u16 installation_remaining_steps; - /* ULTRA_TOOL_ACTIONS Installation Action field */ + /* VISOR_TOOL_ACTIONS Installation Action field */ u8 tool_action; u8 reserved; /* alignment */ struct efi_spar_indication efi_spar_ind; diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 971ad9a2fe6f..1a175df686a7 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1179,15 +1179,15 @@ parahotplug_request_kickoff(struct parahotplug_request *req) env_cmd, env_id, env_state, env_bus, env_dev, env_func, NULL }; - sprintf(env_cmd, "SPAR_PARAHOTPLUG=1"); - sprintf(env_id, "SPAR_PARAHOTPLUG_ID=%d", req->id); - sprintf(env_state, "SPAR_PARAHOTPLUG_STATE=%d", + sprintf(env_cmd, "VISOR_PARAHOTPLUG=1"); + sprintf(env_id, "VISOR_PARAHOTPLUG_ID=%d", req->id); + sprintf(env_state, "VISOR_PARAHOTPLUG_STATE=%d", cmd->device_change_state.state.active); - sprintf(env_bus, "SPAR_PARAHOTPLUG_BUS=%d", + sprintf(env_bus, "VISOR_PARAHOTPLUG_BUS=%d", cmd->device_change_state.bus_no); - sprintf(env_dev, "SPAR_PARAHOTPLUG_DEVICE=%d", + sprintf(env_dev, "VISOR_PARAHOTPLUG_DEVICE=%d", cmd->device_change_state.dev_no >> 3); - sprintf(env_func, "SPAR_PARAHOTPLUG_FUNCTION=%d", + sprintf(env_func, "VISOR_PARAHOTPLUG_FUNCTION=%d", cmd->device_change_state.dev_no & 0x7); return kobject_uevent_env(&chipset_dev->acpi_device->dev.kobj, @@ -1820,7 +1820,7 @@ visorchipset_init(struct acpi_device *acpi_device) { int err = -ENODEV; u64 addr; - uuid_le uuid = SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID; + uuid_le uuid = VISOR_CONTROLVM_CHANNEL_UUID; struct visorchannel *controlvm_channel; chipset_dev = kzalloc(sizeof(*chipset_dev), GFP_KERNEL); @@ -1848,7 +1848,7 @@ visorchipset_init(struct acpi_device *acpi_device) if (err < 0) goto error_destroy_channel; - if (!SPAR_CONTROLVM_CHANNEL_OK_CLIENT( + if (!VISOR_CONTROLVM_CHANNEL_OK_CLIENT( visorchannel_get_header(controlvm_channel))) goto error_delete_groups; -- cgit v1.2.3-55-g7522 From 545f091389011cdee7cd1313fe973f716a08fb85 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:49 -0400 Subject: staging: unisys: visorbus: renamed structures in controlvmchannel.h to match driver namespace Renamed structures * spar_segment_state to visor_segment_state * efi_spar_indication to efi_visor_indication * spar_controlvm_channel_protocol to visor_controlvm_channel * spar_controlvm_parameters_header to visor_controlvm_parameters_header Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/controlvmchannel.h | 25 +++--- drivers/staging/unisys/visorbus/visorchipset.c | 99 ++++++++++------------ 2 files changed, 59 insertions(+), 65 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h index 8cd214778978..1adc16a7785a 100644 --- a/drivers/staging/unisys/visorbus/controlvmchannel.h +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h @@ -38,7 +38,7 @@ (spar_check_channel(ch, \ VISOR_CONTROLVM_CHANNEL_UUID, \ "controlvm", \ - sizeof(struct spar_controlvm_channel_protocol), \ + sizeof(struct visor_controlvm_channel), \ VISOR_CONTROLVM_CHANNEL_VERSIONID, \ VISOR_CONTROLVM_CHANNEL_SIGNATURE)) @@ -51,7 +51,7 @@ /* Max num of messages stored during IOVM creation to be reused after crash */ #define CONTROLVM_CRASHMSG_MAX 2 -struct spar_segment_state { +struct visor_segment_state { /* Bit 0: May enter other states */ u16 enabled:1; /* Bit 1: Assigned to active partition */ @@ -75,15 +75,15 @@ struct spar_segment_state { */ } __packed; -static const struct spar_segment_state segment_state_running = { +static const struct visor_segment_state segment_state_running = { 1, 1, 1, 0, 1, 1, 1, 1 }; -static const struct spar_segment_state segment_state_paused = { +static const struct visor_segment_state segment_state_paused = { 1, 1, 1, 0, 1, 1, 1, 0 }; -static const struct spar_segment_state segment_state_standby = { +static const struct visor_segment_state segment_state_standby = { 1, 1, 0, 0, 1, 1, 1, 0 }; @@ -148,7 +148,7 @@ struct irq_info { u8 reserved[3]; /* Natural alignment purposes */ } __packed; -struct efi_spar_indication { +struct efi_visor_indication { u64 boot_to_fw_ui:1; /* Bit 0: Stop in uefi ui */ u64 clear_nvram:1; /* Bit 1: Clear NVRAM */ u64 clear_cmos:1; /* Bit 2: Clear CMOS */ @@ -297,13 +297,13 @@ struct controlvm_message_packet { /* for CONTROLVM_DEVICE_RECONFIGURE */ struct { u32 bus_no; - struct spar_segment_state state; + struct visor_segment_state state; u8 reserved[2]; /* Natural alignment purposes */ } __packed bus_change_state; /* for CONTROLVM_BUS_CHANGESTATE */ struct { u32 bus_no; u32 dev_no; - struct spar_segment_state state; + struct visor_segment_state state; struct { /* =1 if message is for a physical device */ u32 phys_device:1; @@ -316,7 +316,7 @@ struct controlvm_message_packet { struct { u32 bus_no; u32 dev_no; - struct spar_segment_state state; + struct visor_segment_state state; u8 reserved[6]; /* Natural alignment purposes */ } __packed device_change_state_event; /* for CONTROLVM_DEVICE_CHANGESTATE_EVENT */ @@ -348,7 +348,7 @@ struct controlvm_message { struct controlvm_message_packet cmd; } __packed; -struct spar_controlvm_channel_protocol { +struct visor_controlvm_channel { struct channel_header header; u64 gp_controlvm; /* guest phys addr of this channel */ u64 gp_partition_tables;/* guest phys addr of partition tables */ @@ -404,8 +404,7 @@ struct spar_controlvm_channel_protocol { /* VISOR_TOOL_ACTIONS Installation Action field */ u8 tool_action; u8 reserved; /* alignment */ - struct efi_spar_indication efi_spar_ind; - struct efi_spar_indication efi_spar_ind_supported; + struct efi_visor_indication efi_visor_ind; u32 sp_reserved; /* Force signals to begin on 128-byte cache line */ u8 reserved2[28]; @@ -443,7 +442,7 @@ struct spar_controlvm_channel_protocol { * of total_length should equal PayloadBytes. The format of the strings at * PayloadVmOffset will take different forms depending on the message. */ -struct spar_controlvm_parameters_header { +struct visor_controlvm_parameters_header { u32 total_length; u32 header_length; u32 connection_offset; diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 1a175df686a7..54e83437223b 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -101,7 +101,7 @@ static ssize_t toolaction_show(struct device *dev, int err; err = visorchannel_read(chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, + offsetof(struct visor_controlvm_channel, tool_action), &tool_action, sizeof(u8)); if (err) @@ -120,11 +120,10 @@ static ssize_t toolaction_store(struct device *dev, if (kstrtou8(buf, 10, &tool_action)) return -EINVAL; - err = visorchannel_write - (chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - tool_action), - &tool_action, sizeof(u8)); + err = visorchannel_write(chipset_dev->controlvm_channel, + offsetof(struct visor_controlvm_channel, + tool_action), + &tool_action, sizeof(u8)); if (err) return err; @@ -136,18 +135,18 @@ static ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct efi_spar_indication efi_spar_indication; + struct efi_visor_indication efi_visor_indication; int err; err = visorchannel_read(chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - efi_spar_ind), - &efi_spar_indication, - sizeof(struct efi_spar_indication)); + offsetof(struct visor_controlvm_channel, + efi_visor_ind), + &efi_visor_indication, + sizeof(struct efi_visor_indication)); if (err) return err; - return sprintf(buf, "%u\n", efi_spar_indication.boot_to_tool); + return sprintf(buf, "%u\n", efi_visor_indication.boot_to_tool); } static ssize_t boottotool_store(struct device *dev, @@ -155,17 +154,17 @@ static ssize_t boottotool_store(struct device *dev, const char *buf, size_t count) { int val, err; - struct efi_spar_indication efi_spar_indication; + struct efi_visor_indication efi_visor_indication; if (kstrtoint(buf, 10, &val)) return -EINVAL; - efi_spar_indication.boot_to_tool = val; - err = visorchannel_write - (chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - efi_spar_ind), &(efi_spar_indication), - sizeof(struct efi_spar_indication)); + efi_visor_indication.boot_to_tool = val; + err = visorchannel_write(chipset_dev->controlvm_channel, + offsetof(struct visor_controlvm_channel, + efi_visor_ind), + &(efi_visor_indication), + sizeof(struct efi_visor_indication)); if (err) return err; @@ -180,7 +179,7 @@ static ssize_t error_show(struct device *dev, struct device_attribute *attr, int err; err = visorchannel_read(chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, + offsetof(struct visor_controlvm_channel, installation_error), &error, sizeof(u32)); if (err) @@ -197,11 +196,10 @@ static ssize_t error_store(struct device *dev, struct device_attribute *attr, if (kstrtou32(buf, 10, &error)) return -EINVAL; - err = visorchannel_write - (chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - installation_error), - &error, sizeof(u32)); + err = visorchannel_write(chipset_dev->controlvm_channel, + offsetof(struct visor_controlvm_channel, + installation_error), + &error, sizeof(u32)); if (err) return err; return count; @@ -214,11 +212,10 @@ static ssize_t textid_show(struct device *dev, struct device_attribute *attr, u32 text_id = 0; int err; - err = visorchannel_read - (chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - installation_text_id), - &text_id, sizeof(u32)); + err = visorchannel_read(chipset_dev->controlvm_channel, + offsetof(struct visor_controlvm_channel, + installation_text_id), + &text_id, sizeof(u32)); if (err) return err; @@ -234,11 +231,10 @@ static ssize_t textid_store(struct device *dev, struct device_attribute *attr, if (kstrtou32(buf, 10, &text_id)) return -EINVAL; - err = visorchannel_write - (chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - installation_text_id), - &text_id, sizeof(u32)); + err = visorchannel_write(chipset_dev->controlvm_channel, + offsetof(struct visor_controlvm_channel, + installation_text_id), + &text_id, sizeof(u32)); if (err) return err; return count; @@ -252,7 +248,7 @@ static ssize_t remaining_steps_show(struct device *dev, int err; err = visorchannel_read(chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, + offsetof(struct visor_controlvm_channel, installation_remaining_steps), &remaining_steps, sizeof(u16)); if (err) @@ -271,11 +267,10 @@ static ssize_t remaining_steps_store(struct device *dev, if (kstrtou16(buf, 10, &remaining_steps)) return -EINVAL; - err = visorchannel_write - (chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - installation_remaining_steps), - &remaining_steps, sizeof(u16)); + err = visorchannel_write(chipset_dev->controlvm_channel, + offsetof(struct visor_controlvm_channel, + installation_remaining_steps), + &remaining_steps, sizeof(u16)); if (err) return err; return count; @@ -285,9 +280,9 @@ static DEVICE_ATTR_RW(remaining_steps); static uuid_le parser_id_get(struct parser_context *ctx) { - struct spar_controlvm_parameters_header *phdr = NULL; + struct visor_controlvm_parameters_header *phdr = NULL; - phdr = (struct spar_controlvm_parameters_header *)(ctx->data); + phdr = (struct visor_controlvm_parameters_header *)(ctx->data); return phdr->id; } @@ -331,9 +326,9 @@ parser_string_get(struct parser_context *ctx) static void * parser_name_get(struct parser_context *ctx) { - struct spar_controlvm_parameters_header *phdr = NULL; + struct visor_controlvm_parameters_header *phdr = NULL; - phdr = (struct spar_controlvm_parameters_header *)(ctx->data); + phdr = (struct visor_controlvm_parameters_header *)(ctx->data); if (phdr->name_offset + phdr->name_length > ctx->param_bytes) return NULL; @@ -447,7 +442,7 @@ out_respond: static int controlvm_respond(struct controlvm_message_header *msg_hdr, int response, - struct spar_segment_state *state) + struct visor_segment_state *state) { struct controlvm_message outmsg; @@ -477,7 +472,7 @@ save_crash_message(struct controlvm_message *msg, enum crash_obj_type cr_type) int err; err = visorchannel_read(chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, + offsetof(struct visor_controlvm_channel, saved_crash_message_count), &local_crash_msg_count, sizeof(u16)); if (err) { @@ -493,7 +488,7 @@ save_crash_message(struct controlvm_message *msg, enum crash_obj_type cr_type) } err = visorchannel_read(chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, + offsetof(struct visor_controlvm_channel, saved_crash_message_offset), &local_crash_msg_offset, sizeof(u32)); if (err) { @@ -551,7 +546,7 @@ controlvm_responder(enum controlvm_id cmd_id, static int device_changestate_responder(enum controlvm_id cmd_id, struct visor_device *p, int response, - struct spar_segment_state response_state) + struct visor_segment_state response_state) { struct controlvm_message outmsg; u32 bus_no = p->chipset_bus_no; @@ -850,7 +845,7 @@ visorbus_device_changestate(struct controlvm_message *inmsg) struct controlvm_message_header *pmsg_hdr = NULL; u32 bus_no = cmd->device_change_state.bus_no; u32 dev_no = cmd->device_change_state.dev_no; - struct spar_segment_state state = cmd->device_change_state.state; + struct visor_segment_state state = cmd->device_change_state.state; struct visor_device *dev_info; int err = 0; @@ -1387,7 +1382,7 @@ setup_crash_devices_work_queue(struct work_struct *work) /* get saved message count */ if (visorchannel_read(chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, + offsetof(struct visor_controlvm_channel, saved_crash_message_count), &local_crash_msg_count, sizeof(u16)) < 0) { dev_err(&chipset_dev->acpi_device->dev, @@ -1403,7 +1398,7 @@ setup_crash_devices_work_queue(struct work_struct *work) /* get saved crash message offset */ if (visorchannel_read(chipset_dev->controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, + offsetof(struct visor_controlvm_channel, saved_crash_message_offset), &local_crash_msg_offset, sizeof(u32)) < 0) { dev_err(&chipset_dev->acpi_device->dev, -- cgit v1.2.3-55-g7522 From d3ad6e69ca59241c35d0c1c3869f8cec92945d95 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:50 -0400 Subject: staging: unisys: visorbus: renamed enum in controlvmchannel.h to match driver namespace Renamed enum and its members * ultra_chipset_feature to visor_chipset_feature * ULTRA_CHIPSET_FEATURE_REPLY to VISOR_CHIPSET_FEATURE_REPLY * ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG to VISOR_CHIPSET_FEATURE_PARA_HOTPLUG Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/controlvmchannel.h | 8 ++++---- drivers/staging/unisys/visorbus/visorchipset.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h index 1adc16a7785a..e8716ca86d2d 100644 --- a/drivers/staging/unisys/visorbus/controlvmchannel.h +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h @@ -157,9 +157,9 @@ struct efi_visor_indication { u64 reserved:60; /* Natural alignment */ } __packed; -enum ultra_chipset_feature { - ULTRA_CHIPSET_FEATURE_REPLY = 0x00000001, - ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG = 0x00000002, +enum visor_chipset_feature { + VISOR_CHIPSET_FEATURE_REPLY = 0x00000001, + VISOR_CHIPSET_FEATURE_PARA_HOTPLUG = 0x00000002, }; /* This is the common structure that is at the beginning of every @@ -325,7 +325,7 @@ struct controlvm_message_packet { u32 bus_count; /* indicates the max number of switches */ u32 switch_count; - enum ultra_chipset_feature features; + enum visor_chipset_feature features; u32 platform_number; /* Platform Number */ } __packed init_chipset; /* for CONTROLVM_CHIPSET_INIT */ struct { diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 54e83437223b..9d140ac3dbd5 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -395,7 +395,7 @@ controlvm_init_response(struct controlvm_message *msg, static int controlvm_respond_chipset_init(struct controlvm_message_header *msg_hdr, int response, - enum ultra_chipset_feature features) + enum visor_chipset_feature features) { struct controlvm_message outmsg; @@ -409,7 +409,7 @@ static int chipset_init(struct controlvm_message *inmsg) { static int chipset_inited; - enum ultra_chipset_feature features = 0; + enum visor_chipset_feature features = 0; int rc = CONTROLVM_RESP_SUCCESS; int res = 0; @@ -425,13 +425,13 @@ chipset_init(struct controlvm_message *inmsg) * also supports it). */ features = inmsg->cmd.init_chipset.features & - ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG; + VISOR_CHIPSET_FEATURE_PARA_HOTPLUG; /* * Set the "reply" bit so Command knows this is a * features-aware driver. */ - features |= ULTRA_CHIPSET_FEATURE_REPLY; + features |= VISOR_CHIPSET_FEATURE_REPLY; out_respond: if (inmsg->hdr.flags.response_expected) -- cgit v1.2.3-55-g7522 From 785542c6606b986668787c0e819e61eed99edb31 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:51 -0400 Subject: staging: unisys: visorinput: renamed #defines in visorinput.c to match driver namespace Renamed #defines * SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID to VISOR_KEYBOARD_CHANNEL_UUID * SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID_STR to VISOR_KEYBOARD_CHANNEL_UUID_STR * SPAR_MOUSE_CHANNEL_PROTOCOL_UUID to VISOR_MOUSE_CHANNEL_UUID * SPAR_MOUSE_CHANNEL_PROTOCOL_UUID_STR to VISOR_MOUSE_CHANNEL_UUID_STR Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/Documentation/overview.txt | 6 ++--- drivers/staging/unisys/visorinput/visorinput.c | 27 ++++++++++------------- 2 files changed, 15 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/Documentation/overview.txt b/drivers/staging/unisys/Documentation/overview.txt index 1146c1cf5c2a..990315bc36b2 100644 --- a/drivers/staging/unisys/Documentation/overview.txt +++ b/drivers/staging/unisys/Documentation/overview.txt @@ -282,7 +282,7 @@ i.e.: The visorinput driver registers with visorbus as the function driver to handle human input devices, specified using the -SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID and SPAR_MOUSE_CHANNEL_PROTOCOL_UUID +VISOR_KEYBOARD_CHANNEL_UUID and VISOR_MOUSE_CHANNEL_UUID types in the visorbus_register_visor_driver() call. visorinput uses input_register_device() to expose devices of class input (e.g., /sys/class/input/) for virtual keyboard and virtual mouse devices. @@ -307,8 +307,8 @@ When compiled as a module, visorinput can be autoloaded by visorbus in standard udev/systemd environments, as it includes the modules.alias definition: - "visorbus:"+SPAR_MOUSE_CHANNEL_PROTOCOL_UUID_STR - "visorbus:"+SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID_STR + "visorbus:"+VISOR_MOUSE_CHANNEL_UUID_STR + "visorbus:"+VISOR_KEYBOARD_CHANNEL_UUID_STR i.e.: diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index cdd35437f0a0..2fc9ea1221e6 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -33,17 +33,16 @@ #include "ultrainputreport.h" /* Keyboard channel {c73416d0-b0b8-44af-b304-9d2ae99f1b3d} */ -#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID \ +#define VISOR_KEYBOARD_CHANNEL_UUID \ UUID_LE(0xc73416d0, 0xb0b8, 0x44af, \ 0xb3, 0x4, 0x9d, 0x2a, 0xe9, 0x9f, 0x1b, 0x3d) -#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID_STR "c73416d0-b0b8-44af-b304-9d2ae99f1b3d" +#define VISOR_KEYBOARD_CHANNEL_UUID_STR "c73416d0-b0b8-44af-b304-9d2ae99f1b3d" /* Mouse channel {addf07d4-94a9-46e2-81c3-61abcdbdbd87} */ -#define SPAR_MOUSE_CHANNEL_PROTOCOL_UUID \ +#define VISOR_MOUSE_CHANNEL_UUID \ UUID_LE(0xaddf07d4, 0x94a9, 0x46e2, \ 0x81, 0xc3, 0x61, 0xab, 0xcd, 0xbd, 0xbd, 0x87) -#define SPAR_MOUSE_CHANNEL_PROTOCOL_UUID_STR \ - "addf07d4-94a9-46e2-81c3-61abcdbdbd87" +#define VISOR_MOUSE_CHANNEL_UUID_STR "addf07d4-94a9-46e2-81c3-61abcdbdbd87" #define PIXELS_ACROSS_DEFAULT 800 #define PIXELS_DOWN_DEFAULT 600 @@ -70,10 +69,8 @@ struct visorinput_devdata { unsigned char keycode_table[0]; }; -static const uuid_le spar_keyboard_channel_protocol_uuid = - SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID; -static const uuid_le spar_mouse_channel_protocol_uuid = - SPAR_MOUSE_CHANNEL_PROTOCOL_UUID; +static const uuid_le visor_keyboard_channel_uuid = VISOR_KEYBOARD_CHANNEL_UUID; +static const uuid_le visor_mouse_channel_uuid = VISOR_MOUSE_CHANNEL_UUID; /* * Borrowed from drivers/input/keyboard/atakbd.c @@ -456,9 +453,9 @@ visorinput_probe(struct visor_device *dev) enum visorinput_device_type devtype; guid = visorchannel_get_uuid(dev->visorchannel); - if (uuid_le_cmp(guid, spar_mouse_channel_protocol_uuid) == 0) + if (uuid_le_cmp(guid, visor_mouse_channel_uuid) == 0) devtype = visorinput_mouse; - else if (uuid_le_cmp(guid, spar_keyboard_channel_protocol_uuid) == 0) + else if (uuid_le_cmp(guid, visor_keyboard_channel_uuid) == 0) devtype = visorinput_keyboard; else return -ENODEV; @@ -730,8 +727,8 @@ out: /* GUIDS for all channel types supported by this driver. */ static struct visor_channeltype_descriptor visorinput_channel_types[] = { - { SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID, "keyboard"}, - { SPAR_MOUSE_CHANNEL_PROTOCOL_UUID, "mouse"}, + { VISOR_KEYBOARD_CHANNEL_UUID, "keyboard"}, + { VISOR_MOUSE_CHANNEL_UUID, "mouse"}, { NULL_UUID_LE, NULL } }; @@ -767,5 +764,5 @@ MODULE_AUTHOR("Unisys"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("s-Par human input driver for virtual keyboard/mouse"); -MODULE_ALIAS("visorbus:" SPAR_MOUSE_CHANNEL_PROTOCOL_UUID_STR); -MODULE_ALIAS("visorbus:" SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID_STR); +MODULE_ALIAS("visorbus:" VISOR_MOUSE_CHANNEL_UUID_STR); +MODULE_ALIAS("visorbus:" VISOR_KEYBOARD_CHANNEL_UUID_STR); -- cgit v1.2.3-55-g7522 From c2093c804cf72266fbd35ce4edcfcbe36ef0cc9a Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:52 -0400 Subject: staging: unisys: visorinput: renamed structures in ultrainputreport.h to match driver namespace Renamed structures * ultra_inputactivity to visor_inputactivity * ultra_inputreport to visor_inputreport Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorinput/ultrainputreport.h | 6 +++--- drivers/staging/unisys/visorinput/visorinput.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h b/drivers/staging/unisys/visorinput/ultrainputreport.h index 53dde7c53809..b57f86808f23 100644 --- a/drivers/staging/unisys/visorinput/ultrainputreport.h +++ b/drivers/staging/unisys/visorinput/ultrainputreport.h @@ -64,16 +64,16 @@ enum ultra_inputaction { inputaction_last }; -struct ultra_inputactivity { +struct visor_inputactivity { u16 action; u16 arg1; u16 arg2; u16 arg3; } __packed; -struct ultra_inputreport { +struct visor_inputreport { u64 seq_no; - struct ultra_inputactivity activity; + struct visor_inputactivity activity; } __packed; #endif diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index 2fc9ea1221e6..4eaaa76f2347 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -565,7 +565,7 @@ calc_button(int x) static void visorinput_channel_interrupt(struct visor_device *dev) { - struct ultra_inputreport r; + struct visor_inputreport r; int scancode, keycode; struct input_dev *visorinput_dev; int xmotion, ymotion, button; -- cgit v1.2.3-55-g7522 From bac41a2f682f1e9f8e3aec889ed481d92cc7dadf Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:53 -0400 Subject: staging: unisys: visorinput: removed enum in ultrainputreport.h to match driver namespace Removed enum ultra_inputaction in ultrainputreport.h and changed elements to #defnes. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorinput/ultrainputreport.h | 43 ++++++++++------------ drivers/staging/unisys/visorinput/visorinput.c | 22 +++++------ 2 files changed, 30 insertions(+), 35 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h b/drivers/staging/unisys/visorinput/ultrainputreport.h index b57f86808f23..a4baea53c518 100644 --- a/drivers/staging/unisys/visorinput/ultrainputreport.h +++ b/drivers/staging/unisys/visorinput/ultrainputreport.h @@ -17,26 +17,23 @@ #include -/* Identifies mouse and keyboard activity which is specified by the firmware to - * the host using the cmsimpleinput protocol. @ingroup coretypes +/* These defines identify mouse and keyboard activity which is specified by the + * firmware to the host using the cmsimpleinput protocol. @ingroup coretypes */ -enum ultra_inputaction { - inputaction_none = 0, - inputaction_xy_motion = 1, /* only motion; arg1=x, arg2=y */ - inputaction_mouse_button_down = 2, /* arg1: 1=left,2=center,3=right */ - inputaction_mouse_button_up = 3, /* arg1: 1=left,2=center,3=right */ - inputaction_mouse_button_click = 4, /* arg1: 1=left,2=center,3=right */ - inputaction_mouse_button_dclick = 5, /* arg1: 1=left,2=center, - * 3=right - */ - inputaction_wheel_rotate_away = 6, /* arg1: wheel rotation away from - * user - */ - inputaction_wheel_rotate_toward = 7, /* arg1: wheel rotation toward - * user - */ - inputaction_set_max_xy = 8, /* set screen maxXY; arg1=x, arg2=y */ - inputaction_key_down = 64, /* arg1: scancode, as follows: +#define INPUTACTION_XY_MOTION 1 /* only motion; arg1=x, arg2=y */ +#define INPUTACTION_MOUSE_BUTTON_DOWN 2 /* arg1: 1=left,2=center,3=right */ +#define INPUTACTION_MOUSE_BUTTON_UP 3 /* arg1: 1=left,2=center,3=right */ +#define INPUTACTION_MOUSE_BUTTON_CLICK 4 /* arg1: 1=left,2=center,3=right */ +#define INPUTACTION_MOUSE_BUTTON_DCLICK 5 /* arg1: 1=left,2=center, + * 3=right + */ +#define INPUTACTION_WHEEL_ROTATE_AWAY 6 /* arg1: wheel rotation away from + * user + */ +#define INPUTACTION_WHEEL_ROTATE_TOWARD 7 /* arg1: wheel rotation toward + * user + */ +#define INPUTACTION_KEY_DOWN 64 /* arg1: scancode, as follows: * If arg1 <= 0xff, it's a 1-byte * scancode and arg1 is that scancode. * If arg1 > 0xff, it's a 2-byte @@ -45,10 +42,10 @@ enum ultra_inputaction { * high 8 bits. E.g., the right ALT key * would appear as x'38e0'. */ - inputaction_key_up = 65, /* arg1: scancode (in same format as +#define INPUTACTION_KEY_UP 65 /* arg1: scancode (in same format as * inputaction_keyDown) */ - inputaction_set_locking_key_state = 66, +#define INPUTACTION_SET_LOCKING_KEY_STATE 66 /* arg1: scancode (in same format * as inputaction_keyDown); * MUST refer to one of the @@ -58,11 +55,9 @@ enum ultra_inputaction { * in the LOCKED position * (e.g., light is ON) */ - inputaction_key_down_up = 67, /* arg1: scancode (in same format +#define INPUTACTION_KEY_DOWN_UP 67 /* arg1: scancode (in same format * as inputaction_keyDown) */ - inputaction_last -}; struct visor_inputactivity { u16 action; diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index 4eaaa76f2347..45bc340d4e9d 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -582,46 +582,46 @@ visorinput_channel_interrupt(struct visor_device *dev) scancode = r.activity.arg1; keycode = scancode_to_keycode(scancode); switch (r.activity.action) { - case inputaction_key_down: + case INPUTACTION_KEY_DOWN: input_report_key(visorinput_dev, keycode, 1); input_sync(visorinput_dev); break; - case inputaction_key_up: + case INPUTACTION_KEY_UP: input_report_key(visorinput_dev, keycode, 0); input_sync(visorinput_dev); break; - case inputaction_key_down_up: + case INPUTACTION_KEY_DOWN_UP: input_report_key(visorinput_dev, keycode, 1); input_sync(visorinput_dev); input_report_key(visorinput_dev, keycode, 0); input_sync(visorinput_dev); break; - case inputaction_set_locking_key_state: + case INPUTACTION_SET_LOCKING_KEY_STATE: handle_locking_key(visorinput_dev, keycode, r.activity.arg2); break; - case inputaction_xy_motion: + case INPUTACTION_XY_MOTION: xmotion = r.activity.arg1; ymotion = r.activity.arg2; input_report_abs(visorinput_dev, ABS_X, xmotion); input_report_abs(visorinput_dev, ABS_Y, ymotion); input_sync(visorinput_dev); break; - case inputaction_mouse_button_down: + case INPUTACTION_MOUSE_BUTTON_DOWN: button = calc_button(r.activity.arg1); if (button < 0) break; input_report_key(visorinput_dev, button, 1); input_sync(visorinput_dev); break; - case inputaction_mouse_button_up: + case INPUTACTION_MOUSE_BUTTON_UP: button = calc_button(r.activity.arg1); if (button < 0) break; input_report_key(visorinput_dev, button, 0); input_sync(visorinput_dev); break; - case inputaction_mouse_button_click: + case INPUTACTION_MOUSE_BUTTON_CLICK: button = calc_button(r.activity.arg1); if (button < 0) break; @@ -631,7 +631,7 @@ visorinput_channel_interrupt(struct visor_device *dev) input_report_key(visorinput_dev, button, 0); input_sync(visorinput_dev); break; - case inputaction_mouse_button_dclick: + case INPUTACTION_MOUSE_BUTTON_DCLICK: button = calc_button(r.activity.arg1); if (button < 0) break; @@ -642,11 +642,11 @@ visorinput_channel_interrupt(struct visor_device *dev) input_sync(visorinput_dev); } break; - case inputaction_wheel_rotate_away: + case INPUTACTION_WHEEL_ROTATE_AWAY: input_report_rel(visorinput_dev, REL_WHEEL, 1); input_sync(visorinput_dev); break; - case inputaction_wheel_rotate_toward: + case INPUTACTION_WHEEL_ROTATE_TOWARD: input_report_rel(visorinput_dev, REL_WHEEL, -1); input_sync(visorinput_dev); break; -- cgit v1.2.3-55-g7522 From 315dfc84d11f3624a684a426dcf8535367bbe130 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:54 -0400 Subject: staging: unisys: include: renamed function spar_check_channel in channel.h to match driver namespace Renamed function spar_check_channel() to visor_check_channel(). Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/channel.h | 12 ++++++------ drivers/staging/unisys/include/iochannel.h | 4 ++-- drivers/staging/unisys/visorbus/controlvmchannel.h | 12 ++++++------ drivers/staging/unisys/visorbus/visorbus_main.c | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h index 057421eeb1ae..e22a1519a8c3 100644 --- a/drivers/staging/unisys/include/channel.h +++ b/drivers/staging/unisys/include/channel.h @@ -204,12 +204,12 @@ struct signal_queue_header { * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. */ static inline int -spar_check_channel(struct channel_header *ch, - uuid_le expected_uuid, - char *chname, - u64 expected_min_bytes, - u32 expected_version, - u64 expected_signature) +visor_check_channel(struct channel_header *ch, + uuid_le expected_uuid, + char *chname, + u64 expected_min_bytes, + u32 expected_version, + u64 expected_signature) { if (uuid_le_cmp(expected_uuid, NULL_UUID_LE) != 0) { /* caller wants us to verify type GUID */ diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 9bde848a321c..ce0e2e2008cf 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -51,13 +51,13 @@ #define ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID 1 #define SPAR_VHBA_CHANNEL_OK_CLIENT(ch) \ - (spar_check_channel(ch, spar_vhba_channel_protocol_uuid, \ + (visor_check_channel(ch, spar_vhba_channel_protocol_uuid, \ "vhba", MIN_IO_CHANNEL_SIZE, \ ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \ ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE)) #define SPAR_VNIC_CHANNEL_OK_CLIENT(ch) \ - (spar_check_channel(ch, spar_vnic_channel_protocol_uuid, \ + (visor_check_channel(ch, spar_vnic_channel_protocol_uuid, \ "vnic", MIN_IO_CHANNEL_SIZE, \ ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \ ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE)) diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h index e8716ca86d2d..506ed0d70d32 100644 --- a/drivers/staging/unisys/visorbus/controlvmchannel.h +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h @@ -35,12 +35,12 @@ #define VISOR_CONTROLVM_CHANNEL_VERSIONID 1 #define VISOR_CONTROLVM_CHANNEL_OK_CLIENT(ch) \ - (spar_check_channel(ch, \ - VISOR_CONTROLVM_CHANNEL_UUID, \ - "controlvm", \ - sizeof(struct visor_controlvm_channel), \ - VISOR_CONTROLVM_CHANNEL_VERSIONID, \ - VISOR_CONTROLVM_CHANNEL_SIGNATURE)) + (visor_check_channel(ch, \ + VISOR_CONTROLVM_CHANNEL_UUID, \ + "controlvm", \ + sizeof(struct visor_controlvm_channel), \ + VISOR_CONTROLVM_CHANNEL_VERSIONID, \ + VISOR_CONTROLVM_CHANNEL_SIGNATURE)) /* Defines for various channel queues */ #define CONTROLVM_QUEUE_REQUEST 0 diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index e2631f553131..1c785dd19ddd 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -686,12 +686,12 @@ get_vbus_header_info(struct visorchannel *chan, { int err; - if (!spar_check_channel(visorchannel_get_header(chan), - visor_vbus_channel_uuid, - "vbus", - sizeof(struct visor_vbus_channel), - VISOR_VBUS_CHANNEL_VERSIONID, - VISOR_VBUS_CHANNEL_SIGNATURE)) + if (!visor_check_channel(visorchannel_get_header(chan), + visor_vbus_channel_uuid, + "vbus", + sizeof(struct visor_vbus_channel), + VISOR_VBUS_CHANNEL_VERSIONID, + VISOR_VBUS_CHANNEL_SIGNATURE)) return -EINVAL; err = visorchannel_read(chan, sizeof(struct channel_header), hdr_info, -- cgit v1.2.3-55-g7522 From c75ebe5e30a0e1ed7ffacd4e45798ff98eca4e86 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:55 -0400 Subject: staging: unisys: include: renamed #defines in channel.h to match driver namespace Renamed #defines * ULTRA_CHANNEL_PROTOCOL_SIGNATURE to VISOR_CHANNEL_SIGNATURE * SPAR_CHANNEL_SERVER_READY to VISOR_CHANNEL_SERVER_READY * ULTRA_VALID_CHANNELCLI_TRANSITION VISOR_VALID_CHANNELCLI_TRANSITION * ULTRA_CLIERRORBOOT_THROTTLEMSG_DISABLED to VISOR_CLIERRORBOOT_THROTTLEMSG_DISABLED * ULTRA_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED to VISOR_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED * ULTRA_CLIERRORBOOT_THROTTLEMSG_BUSY to VISOR_CLIERRORBOOT_THROTTLEMSG_BUSY * ULTRA_IO_DRIVER_ENABLES_INTS to VISOR_DRIVER_ENABLES_INTS * ULTRA_IO_CHANNEL_IS_POLLING to VISOR_CHANNEL_IS_POLLING * ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS to VISOR_IOVM_OK_DRIVER_DISABLING_INTS * ULTRA_IO_DRIVER_DISABLES_INTS to VISOR_DRIVER_DISABLES_INTS * ULTRA_IO_DRIVER_SUPPORTS_ENHANCED_RCVBUF_CHECKING to VISOR_DRIVER_ENHANCED_RCVBUF_CHECKING * ULTRA_CHANNEL_ENABLE_INTS to VISOR_CHANNEL_ENABLE_INTS * SPAR_VHBA_CHANNEL_PROTOCOL_UUID to VISOR_VHBA_CHANNEL_UUID * SPAR_VHBA_CHANNEL_PROTOCOL_UUID_STR to VISOR_VHBA_CHANNEL_UUID_STR * SPAR_VNIC_CHANNEL_PROTOCOL_UUID to VISOR_VNIC_CHANNEL_UUID * SPAR_VNIC_CHANNEL_PROTOCOL_UUID_STR to VISOR_VNIC_CHANNEL_UUID_STR * SPAR_SIOVM_UUID to VISOR_SIOVM_UUID Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/Documentation/overview.txt | 8 ++-- drivers/staging/unisys/include/channel.h | 48 +++++++++++----------- drivers/staging/unisys/include/iochannel.h | 11 +++-- drivers/staging/unisys/visorbus/controlvmchannel.h | 2 +- drivers/staging/unisys/visorbus/vbuschannel.h | 2 +- drivers/staging/unisys/visorbus/visorchipset.c | 4 +- drivers/staging/unisys/visorhba/visorhba_main.c | 8 ++-- drivers/staging/unisys/visornic/visornic_main.c | 10 ++--- 8 files changed, 45 insertions(+), 48 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/Documentation/overview.txt b/drivers/staging/unisys/Documentation/overview.txt index 990315bc36b2..e0466bfada2f 100644 --- a/drivers/staging/unisys/Documentation/overview.txt +++ b/drivers/staging/unisys/Documentation/overview.txt @@ -221,7 +221,7 @@ The following files exist under /sys/devices/visorbus/vbus:dev: The visorhba driver registers with visorbus as the function driver to handle virtual scsi disk devices, specified using the -SPAR_VHBA_CHANNEL_PROTOCOL_UUID type in the visorbus_register_visor_driver() +VISOR_VHBA_CHANNEL_UUID type in the visorbus_register_visor_driver() call. visorhba uses scsi_add_host() to expose a Linux block device (e.g., /sys/block/) in the guest environment for each s-Par virtual device. @@ -240,7 +240,7 @@ When compiled as a module, visorhba can be autoloaded by visorbus in standard udev/systemd environments, as it includes the modules.alias definition: - "visorbus:"+SPAR_VHBA_CHANNEL_PROTOCOL_UUID_STR + "visorbus:"+VISOR_VHBA_CHANNEL_UUID_STR i.e.: @@ -252,7 +252,7 @@ i.e.: The visornic driver registers with visorbus as the function driver to handle virtual network devices, specified using the -SPAR_VNIC_CHANNEL_PROTOCOL_UUID type in the visorbus_register_visor_driver() +VISOR_VNIC_CHANNEL_UUID type in the visorbus_register_visor_driver() call. visornic uses register_netdev() to expose a Linux device of class net (e.g., /sys/class/net/) in the guest environment for each s-Par virtual device. @@ -270,7 +270,7 @@ When compiled as a module, visornic can be autoloaded by visorbus in standard udev/systemd environments, as it includes the modules.alias definition: - "visorbus:"+SPAR_VNIC_CHANNEL_PROTOCOL_UUID_STR + "visorbus:"+VISOR_VNIC_CHANNEL_UUID_STR i.e.: diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h index e22a1519a8c3..692efcb38245 100644 --- a/drivers/staging/unisys/include/channel.h +++ b/drivers/staging/unisys/include/channel.h @@ -32,7 +32,7 @@ #define COVER(v, d) ((d) * DIV_ROUND_UP(v, d)) #endif -#define ULTRA_CHANNEL_PROTOCOL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L') +#define VISOR_CHANNEL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L') enum channel_serverstate { CHANNELSRV_UNINITIALIZED = 0, /* channel is in an undefined state */ @@ -59,10 +59,10 @@ enum channel_clientstate { /* access channel anytime */ }; -#define SPAR_CHANNEL_SERVER_READY(ch) \ +#define VISOR_CHANNEL_SERVER_READY(ch) \ (readl(&(ch)->srv_state) == CHANNELSRV_READY) -#define ULTRA_VALID_CHANNELCLI_TRANSITION(o, n) \ +#define VISOR_VALID_CHANNELCLI_TRANSITION(o, n) \ (((((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_DISABLED)) || \ (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_DISABLED)) || \ (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_DISABLED)) || \ @@ -80,33 +80,33 @@ enum channel_clientstate { (((o) == CHANNELCLI_BUSY) && ((n) == CHANNELCLI_OWNED)) || (0)) \ ? (1) : (0)) -/* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorBoot: */ +/* Values for VISORA_CHANNEL_PROTOCOL.CliErrorBoot: */ /* throttling invalid boot channel statetransition error due to client * disabled */ -#define ULTRA_CLIERRORBOOT_THROTTLEMSG_DISABLED 0x01 +#define VISOR_CLIERRORBOOT_THROTTLEMSG_DISABLED 0x01 /* throttling invalid boot channel statetransition error due to client * not attached */ -#define ULTRA_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02 +#define VISOR_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02 /* throttling invalid boot channel statetransition error due to busy channel */ -#define ULTRA_CLIERRORBOOT_THROTTLEMSG_BUSY 0x04 +#define VISOR_CLIERRORBOOT_THROTTLEMSG_BUSY 0x04 -/* Values for ULTRA_CHANNEL_PROTOCOL.Features: This define exists so +/* Values for VISOR_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 + * VISOR_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) -#define ULTRA_IO_DRIVER_DISABLES_INTS (0x1ULL << 5) -#define ULTRA_IO_DRIVER_SUPPORTS_ENHANCED_RCVBUF_CHECKING (0x1ULL << 6) +#define VISOR_DRIVER_ENABLES_INTS (0x1ULL << 1) +#define VISOR_CHANNEL_IS_POLLING (0x1ULL << 3) +#define VISOR_IOVM_OK_DRIVER_DISABLING_INTS (0x1ULL << 4) +#define VISOR_DRIVER_DISABLES_INTS (0x1ULL << 5) +#define VISOR_DRIVER_ENHANCED_RCVBUF_CHECKING (0x1ULL << 6) /* Common Channel Header */ struct channel_header { @@ -156,7 +156,7 @@ struct channel_header { u8 recover_channel; } __packed; -#define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0) +#define VISOR_CHANNEL_ENABLE_INTS (0x1ULL << 0) /* Subheader for the Signal Type variation of the Common Channel */ struct signal_queue_header { @@ -254,27 +254,25 @@ visor_check_channel(struct channel_header *ch, */ /* {414815ed-c58c-11da-95a9-00e08161165f} */ -#define SPAR_VHBA_CHANNEL_PROTOCOL_UUID \ +#define VISOR_VHBA_CHANNEL_UUID \ UUID_LE(0x414815ed, 0xc58c, 0x11da, \ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) -static const uuid_le spar_vhba_channel_protocol_uuid = - SPAR_VHBA_CHANNEL_PROTOCOL_UUID; -#define SPAR_VHBA_CHANNEL_PROTOCOL_UUID_STR \ +static const uuid_le visor_vhba_channel_uuid = VISOR_VHBA_CHANNEL_UUID; +#define VISOR_VHBA_CHANNEL_UUID_STR \ "414815ed-c58c-11da-95a9-00e08161165f" /* {8cd5994d-c58e-11da-95a9-00e08161165f} */ -#define SPAR_VNIC_CHANNEL_PROTOCOL_UUID \ +#define VISOR_VNIC_CHANNEL_UUID \ UUID_LE(0x8cd5994d, 0xc58e, 0x11da, \ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) -static const uuid_le spar_vnic_channel_protocol_uuid = - SPAR_VNIC_CHANNEL_PROTOCOL_UUID; -#define SPAR_VNIC_CHANNEL_PROTOCOL_UUID_STR \ +static const uuid_le visor_vnic_channel_uuid = VISOR_VNIC_CHANNEL_UUID; +#define VISOR_VNIC_CHANNEL_UUID_STR \ "8cd5994d-c58e-11da-95a9-00e08161165f" /* {72120008-4AAB-11DC-8530-444553544200} */ -#define SPAR_SIOVM_UUID \ +#define VISOR_SIOVM_UUID \ UUID_LE(0x72120008, 0x4AAB, 0x11DC, \ 0x85, 0x30, 0x44, 0x45, 0x53, 0x54, 0x42, 0x00) -static const uuid_le spar_siovm_uuid = SPAR_SIOVM_UUID; +static const uuid_le visor_siovm_uuid = VISOR_SIOVM_UUID; #endif diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index ce0e2e2008cf..d57b18023aac 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -34,10 +34,9 @@ #include #include "channel.h" -#define ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE -#define ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE -#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE \ - ULTRA_CHANNEL_PROTOCOL_SIGNATURE +#define ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE VISOR_CHANNEL_SIGNATURE +#define ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE VISOR_CHANNEL_SIGNATURE +#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE VISOR_CHANNEL_SIGNATURE /* * Must increment these whenever you insert or delete fields within this channel @@ -51,13 +50,13 @@ #define ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID 1 #define SPAR_VHBA_CHANNEL_OK_CLIENT(ch) \ - (visor_check_channel(ch, spar_vhba_channel_protocol_uuid, \ + (visor_check_channel(ch, visor_vhba_channel_uuid, \ "vhba", MIN_IO_CHANNEL_SIZE, \ ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \ ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE)) #define SPAR_VNIC_CHANNEL_OK_CLIENT(ch) \ - (visor_check_channel(ch, spar_vnic_channel_protocol_uuid, \ + (visor_check_channel(ch, visor_vnic_channel_uuid, \ "vnic", MIN_IO_CHANNEL_SIZE, \ ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \ ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE)) diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h index 506ed0d70d32..ed045eff0e33 100644 --- a/drivers/staging/unisys/visorbus/controlvmchannel.h +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h @@ -23,7 +23,7 @@ UUID_LE(0x2b3c2d10, 0x7ef5, 0x4ad8, \ 0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d) -#define VISOR_CONTROLVM_CHANNEL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE +#define VISOR_CONTROLVM_CHANNEL_SIGNATURE VISOR_CHANNEL_SIGNATURE #define CONTROLVM_MESSAGE_MAX 64 /* Must increment this whenever you insert or delete fields within diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h index ee5c7b912366..01d7d517dba7 100644 --- a/drivers/staging/unisys/visorbus/vbuschannel.h +++ b/drivers/staging/unisys/visorbus/vbuschannel.h @@ -32,7 +32,7 @@ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) static const uuid_le visor_vbus_channel_uuid = VISOR_VBUS_CHANNEL_UUID; -#define VISOR_VBUS_CHANNEL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE +#define VISOR_VBUS_CHANNEL_SIGNATURE VISOR_CHANNEL_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 diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 9d140ac3dbd5..c40a3701670a 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -595,7 +595,7 @@ visorbus_create(struct controlvm_message *inmsg) bus_info->chipset_bus_no = bus_no; bus_info->chipset_dev_no = BUS_ROOT_DEVICE; - if (uuid_le_cmp(cmd->create_bus.bus_inst_uuid, spar_siovm_uuid) == 0) { + if (uuid_le_cmp(cmd->create_bus.bus_inst_uuid, visor_siovm_uuid) == 0) { err = save_crash_message(inmsg, CRASH_BUS); if (err) goto err_free_bus_info; @@ -802,7 +802,7 @@ visorbus_device_create(struct controlvm_message *inmsg) dev_info->visorchannel = visorchannel; dev_info->channel_type_guid = cmd->create_device.data_type_uuid; if (uuid_le_cmp(cmd->create_device.data_type_uuid, - spar_vhba_channel_protocol_uuid) == 0) { + visor_vhba_channel_uuid) == 0) { err = save_crash_message(inmsg, CRASH_DEV); if (err) goto err_destroy_visorchannel; diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 46d33e65fbed..dcb10ac99b28 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -37,14 +37,14 @@ static struct dentry *visorhba_debugfs_dir; /* GUIDS for HBA channel type supported by this driver */ static struct visor_channeltype_descriptor visorhba_channel_types[] = { /* Note that the only channel type we expect to be reported by the - * bus driver is the SPAR_VHBA channel. + * bus driver is the VISOR_VHBA channel. */ - { SPAR_VHBA_CHANNEL_PROTOCOL_UUID, "sparvhba" }, + { VISOR_VHBA_CHANNEL_UUID, "sparvhba" }, { NULL_UUID_LE, NULL } }; MODULE_DEVICE_TABLE(visorbus, visorhba_channel_types); -MODULE_ALIAS("visorbus:" SPAR_VHBA_CHANNEL_PROTOCOL_UUID_STR); +MODULE_ALIAS("visorbus:" VISOR_VHBA_CHANNEL_UUID_STR); struct visordisk_info { u32 valid; @@ -1110,7 +1110,7 @@ static int visorhba_probe(struct visor_device *dev) err = visorbus_read_channel(dev, channel_offset, &features, 8); if (err) goto err_debugfs_info; - features |= ULTRA_IO_CHANNEL_IS_POLLING; + features |= VISOR_CHANNEL_IS_POLLING; err = visorbus_write_channel(dev, channel_offset, &features, 8); if (err) goto err_debugfs_info; diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index adebf224f73a..9b9af9e44fd6 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -39,9 +39,9 @@ /* GUIDS for director channel type supported by this driver. */ static struct visor_channeltype_descriptor visornic_channel_types[] = { /* Note that the only channel type we expect to be reported by the - * bus driver is the SPAR_VNIC channel. + * bus driver is the VISOR_VNIC channel. */ - { SPAR_VNIC_CHANNEL_PROTOCOL_UUID, "ultravnic" }, + { VISOR_VNIC_CHANNEL_UUID, "ultravnic" }, { NULL_UUID_LE, NULL } }; MODULE_DEVICE_TABLE(visorbus, visornic_channel_types); @@ -52,7 +52,7 @@ MODULE_DEVICE_TABLE(visorbus, visornic_channel_types); * must be added to scripts/mode/file2alias.c, etc., to get this working * properly. */ -MODULE_ALIAS("visorbus:" SPAR_VNIC_CHANNEL_PROTOCOL_UUID_STR); +MODULE_ALIAS("visorbus:" VISOR_VNIC_CHANNEL_UUID_STR); struct chanstat { unsigned long got_rcv; @@ -1916,8 +1916,8 @@ static int visornic_probe(struct visor_device *dev) goto cleanup_napi_add; } - features |= ULTRA_IO_CHANNEL_IS_POLLING; - features |= ULTRA_IO_DRIVER_SUPPORTS_ENHANCED_RCVBUF_CHECKING; + features |= VISOR_CHANNEL_IS_POLLING; + features |= VISOR_DRIVER_ENHANCED_RCVBUF_CHECKING; err = visorbus_write_channel(dev, channel_offset, &features, 8); if (err) { dev_err(&dev->device, -- cgit v1.2.3-55-g7522 From 68646323cd08e9dae69ea3a0bf58d31fc0963e35 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:56 -0400 Subject: staging: unisys: include: renamed #defines in iochannel.h to match driver namespace Renamed #defines * ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE to VISOR_VHBA_CHANNEL_SIGNATURE * ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE to VISOR_VNIC_CHANNEL_SIGNATURE * ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE to VISOR_VSWITCH_CHANNEL_SIGNATURE * ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID to VISOR_VHBA_CHANNEL_VERSIONID * ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID to VISOR_VNIC_CHANNEL_VERSIONID * ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID to VISOR_VSWITCH_CHANNEL_VERSIONID * SPAR_VHBA_CHANNEL_OK_CLIENT to VISOR_VHBA_CHANNEL_OK_CLIENT * SPAR_VNIC_CHANNEL_OK_CLIENT to VISOR_VNIC_CHANNEL_OK_CLIENT Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/iochannel.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index d57b18023aac..1365cb4a00f6 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -34,9 +34,9 @@ #include #include "channel.h" -#define ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE VISOR_CHANNEL_SIGNATURE -#define ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE VISOR_CHANNEL_SIGNATURE -#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE VISOR_CHANNEL_SIGNATURE +#define VISOR_VHBA_CHANNEL_SIGNATURE VISOR_CHANNEL_SIGNATURE +#define VISOR_VNIC_CHANNEL_SIGNATURE VISOR_CHANNEL_SIGNATURE +#define VISOR_VSWITCH_CHANNEL_SIGNATURE VISOR_CHANNEL_SIGNATURE /* * Must increment these whenever you insert or delete fields within this channel @@ -45,21 +45,21 @@ * usually add fields to the END of the channel struct without needing to * increment this. */ -#define ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID 2 -#define ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID 2 -#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID 1 +#define VISOR_VHBA_CHANNEL_VERSIONID 2 +#define VISOR_VNIC_CHANNEL_VERSIONID 2 +#define VISOR_VSWITCH_CHANNEL_VERSIONID 1 -#define SPAR_VHBA_CHANNEL_OK_CLIENT(ch) \ +#define VISOR_VHBA_CHANNEL_OK_CLIENT(ch) \ (visor_check_channel(ch, visor_vhba_channel_uuid, \ - "vhba", MIN_IO_CHANNEL_SIZE, \ - ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE)) + "vhba", MIN_IO_CHANNEL_SIZE, \ + VISOR_VHBA_CHANNEL_VERSIONID, \ + VISOR_VHBA_CHANNEL_SIGNATURE)) -#define SPAR_VNIC_CHANNEL_OK_CLIENT(ch) \ +#define VISOR_VNIC_CHANNEL_OK_CLIENT(ch) \ (visor_check_channel(ch, visor_vnic_channel_uuid, \ - "vnic", MIN_IO_CHANNEL_SIZE, \ - ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE)) + "vnic", MIN_IO_CHANNEL_SIZE, \ + VISOR_VNIC_CHANNEL_VERSIONID, \ + VISOR_VNIC_CHANNEL_SIGNATURE)) /* * Everything necessary to handle SCSI & NIC traffic between Guest Partition and -- cgit v1.2.3-55-g7522 From 172f4c367c7239b2390302402cb360ad94fcac4a Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:57 -0400 Subject: staging: unisys: include: renamed structure spar_io_channel_protocol in iochannel.h to match driver namespace Renamed structure spar_io_channel_protocol to visor_io_channel and changed "visor bus" to "visorbus" in a comment in visornic_main.c and visorhba_main.c. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/iochannel.h | 2 +- drivers/staging/unisys/visorhba/visorhba_main.c | 7 +++---- drivers/staging/unisys/visornic/visornic_main.c | 13 +++++-------- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 1365cb4a00f6..c7cb3fbde7b2 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -529,7 +529,7 @@ struct iochannel_vnic { * this header there is a large region of memory which contains the command and * response queues as specified in cmd_q and rsp_q SIGNAL_QUEUE_HEADERS. */ -struct spar_io_channel_protocol { +struct visor_io_channel { struct channel_header channel_header; struct signal_queue_header cmd_q; struct signal_queue_header rsp_q; diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index dcb10ac99b28..2fd31c9762c6 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -1060,8 +1060,7 @@ static int visorhba_probe(struct visor_device *dev) if (!scsihost) return -ENODEV; - channel_offset = offsetof(struct spar_io_channel_protocol, - vhba.max); + channel_offset = offsetof(struct visor_io_channel, vhba.max); err = visorbus_read_channel(dev, channel_offset, &max, sizeof(struct vhba_config_max)); if (err < 0) @@ -1105,7 +1104,7 @@ static int visorhba_probe(struct visor_device *dev) devdata->serverchangingstate = false; devdata->scsihost = scsihost; - channel_offset = offsetof(struct spar_io_channel_protocol, + channel_offset = offsetof(struct visor_io_channel, channel_header.features); err = visorbus_read_channel(dev, channel_offset, &features, 8); if (err) @@ -1166,7 +1165,7 @@ static void visorhba_remove(struct visor_device *dev) debugfs_remove_recursive(devdata->debugfs_dir); } -/* This is used to tell the visor bus driver which types of visor devices +/* This is used to tell the visorbus driver which types of visor devices * we support, and what functions to call when a visor device that we support * is attached or removed. */ diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 9b9af9e44fd6..2891622eef18 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1807,8 +1807,7 @@ static int visornic_probe(struct visor_device *dev) /* Get MAC address from channel and read it into the device. */ netdev->addr_len = ETH_ALEN; - channel_offset = offsetof(struct spar_io_channel_protocol, - vnic.macaddr); + channel_offset = offsetof(struct visor_io_channel, vnic.macaddr); err = visorbus_read_channel(dev, channel_offset, netdev->dev_addr, ETH_ALEN); if (err < 0) { @@ -1836,8 +1835,7 @@ static int visornic_probe(struct visor_device *dev) atomic_set(&devdata->usage, 1); /* Setup rcv bufs */ - channel_offset = offsetof(struct spar_io_channel_protocol, - vnic.num_rcv_bufs); + channel_offset = offsetof(struct visor_io_channel, vnic.num_rcv_bufs); err = visorbus_read_channel(dev, channel_offset, &devdata->num_rcv_bufs, 4); if (err) { @@ -1884,8 +1882,7 @@ static int visornic_probe(struct visor_device *dev) devdata->server_change_state = false; /*set the default mtu */ - channel_offset = offsetof(struct spar_io_channel_protocol, - vnic.mtu); + channel_offset = offsetof(struct visor_io_channel, vnic.mtu); err = visorbus_read_channel(dev, channel_offset, &netdev->mtu, 4); if (err) { dev_err(&dev->device, @@ -1906,7 +1903,7 @@ static int visornic_probe(struct visor_device *dev) */ mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2)); - channel_offset = offsetof(struct spar_io_channel_protocol, + channel_offset = offsetof(struct visor_io_channel, channel_header.features); err = visorbus_read_channel(dev, channel_offset, &features, 8); if (err) { @@ -2115,7 +2112,7 @@ static int visornic_resume(struct visor_device *dev, return 0; } -/* This is used to tell the visor bus driver which types of visor devices +/* This is used to tell the visorbus driver which types of visor devices * we support, and what functions to call when a visor device that we support * is attached or removed. */ -- cgit v1.2.3-55-g7522 From d36c4857cbaede959e012045711a3467e857e132 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:58 -0400 Subject: staging: unisys: visorbus: add comment to explain polling logic in controlvm_periodic_work Added a comment to explain polling frequency variation logic in controlvm_periodic_logic() in visorchipset.c. Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index c40a3701670a..8438b717b7b6 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1787,6 +1787,11 @@ controlvm_periodic_work(struct work_struct *work) /* parahotplug_worker */ parahotplug_process_list(); +/* + * The controlvm messages are sent in a bulk. If we start receiving messages, we + * want the polling to be fast. If we do not receive any message for + * MIN_IDLE_SECONDS, we can slow down the polling. + */ schedule_out: if (time_after(jiffies, chipset_dev->most_recent_message_jiffies + (HZ * MIN_IDLE_SECONDS))) { -- cgit v1.2.3-55-g7522 From d70dd245215d6456584119534e6870a9c7b9b9c2 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Fri, 19 May 2017 16:17:59 -0400 Subject: staging: unisys: visorbus: remove channel_addr check in handle_command Removed a check for physaddr=0 in handle_command() function in visorchipset.c. Signed-off-by: Sameer Wadgaonkar Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 8438b717b7b6..22150564b4fb 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1593,9 +1593,6 @@ handle_command(struct controlvm_message inmsg, u64 channel_addr) /* create parsing context if necessary */ local_addr = (inmsg.hdr.flags.test_message == 1); - if (channel_addr == 0) - return -EINVAL; - parm_addr = channel_addr + inmsg.hdr.payload_vm_offset; parm_bytes = inmsg.hdr.payload_bytes; -- cgit v1.2.3-55-g7522 From e45423d76f1c229b1a30ddde205a72774cdb12c6 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 20 May 2017 00:27:18 +0300 Subject: staging: speakup: signedness bug in spk_ttyio_in_nowait() On most of the common arches char is signed so it can't ever == 0xff. Let's fix this by making it a u8. Fixes: 6b9ad1c742bf ("staging: speakup: add send_xchar, tiocmset and input functionality for tty") Signed-off-by: Dan Carpenter Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_ttyio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 6e0f042f6a44..8ed7c71c712f 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -220,7 +220,7 @@ static unsigned char spk_ttyio_in(void) static unsigned char spk_ttyio_in_nowait(void) { - char rv = ttyio_in(0); + u8 rv = ttyio_in(0); return (rv == 0xff) ? 0 : rv; } -- cgit v1.2.3-55-g7522 From 7e4e3bca8900b34d1cffa1891745d83b07892fea Mon Sep 17 00:00:00 2001 From: Paolo Cretaro Date: Thu, 18 May 2017 23:59:41 +0200 Subject: staging: android: ion: set init function as static Fix warning issued by sparse: symbol 'ion_device_create' was not declared. Should it be static? Signed-off-by: Paolo Cretaro Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index afa7c4553125..43ecb4af1b41 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -586,7 +586,7 @@ void ion_device_add_heap(struct ion_heap *heap) } EXPORT_SYMBOL(ion_device_add_heap); -int ion_device_create(void) +static int ion_device_create(void) { struct ion_device *idev; int ret; -- cgit v1.2.3-55-g7522 From 5b5d636221057ae0f33aa906e1bf315f22f05b84 Mon Sep 17 00:00:00 2001 From: Marko Stankovic Date: Sat, 20 May 2017 18:50:37 +0200 Subject: staging: vt6655: add spaces around '%' operator Fix checkpatch issue by adding spaces around the '%' operator Signed-off-by: Marko Stankovic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index 5463cf869d1b..f5db2b3d9045 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -913,7 +913,7 @@ u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2) { unsigned short wRxBcnTSFOffst; - wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE]; + wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate % MAX_RATE]; qwTSF2 += (u64)wRxBcnTSFOffst; -- cgit v1.2.3-55-g7522 From 3621014af3847d95947a5baa528e53c2322ef934 Mon Sep 17 00:00:00 2001 From: Marko Stankovic Date: Tue, 23 May 2017 01:19:43 +0200 Subject: staging: vt6655: replace NULL comparison with '!' operator Fix comparison to NULL issues reported by checkpatch.pl Signed-off-by: Marko Stankovic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index da0f71191009..1c652f0ff3ba 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -157,7 +157,7 @@ static void vt6655_remove(struct pci_dev *pcid) { struct vnt_private *priv = pci_get_drvdata(pcid); - if (priv == NULL) + if (!priv) return; device_free_info(priv); } @@ -453,7 +453,7 @@ static bool device_init_rings(struct vnt_private *priv) priv->opts.tx_descs[0] * sizeof(struct vnt_tx_desc) + priv->opts.tx_descs[1] * sizeof(struct vnt_tx_desc), &priv->pool_dma, GFP_ATOMIC); - if (vir_pool == NULL) { + if (!vir_pool) { dev_err(&priv->pcid->dev, "allocate desc dma memory failed\n"); return false; } -- cgit v1.2.3-55-g7522 From 5c60befe6df8ec85282728677f4445f5e2aab3ee Mon Sep 17 00:00:00 2001 From: Marko Stankovic Date: Tue, 23 May 2017 01:19:44 +0200 Subject: staging: vt6655: remove unnecessary blank lines Fix unnecessary blank lines issues reported by checkpatch.pl Signed-off-by: Marko Stankovic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 1c652f0ff3ba..78804eaec608 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1018,7 +1018,6 @@ static void vnt_interrupt_process(struct vnt_private *priv) } /* TODO: adhoc PS mode */ - } if (isr & ISR_BNTX) { @@ -1702,7 +1701,6 @@ static int vt6655_suspend(struct pci_dev *pcid, pm_message_t state) static int vt6655_resume(struct pci_dev *pcid) { - pci_set_power_state(pcid, PCI_D0); pci_enable_wake(pcid, PCI_D0, 0); pci_restore_state(pcid); -- cgit v1.2.3-55-g7522 From fc0f0bd61230f4d85670928539db40ab5528b50c Mon Sep 17 00:00:00 2001 From: Rui Teng Date: Tue, 23 May 2017 10:04:15 +0800 Subject: drivers/staging/speakup: fix indent coding style problem in spk_ttyio.c This is a patch to the spk_ttyio.c file which fixes up the indent error reported by the checkpatch.pl tool. Signed-off-by: Rui Teng Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_ttyio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 8ed7c71c712f..ed36240cf382 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -61,7 +61,7 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty, return 0; /* Make sure the consumer has read buf before we have seen - * buf_free == true and overwrite buf */ + * buf_free == true and overwrite buf */ mb(); ldisc_data->buf = cp[0]; -- cgit v1.2.3-55-g7522 From 7959c3314cc333cac9e0b9becddd968cd4a48188 Mon Sep 17 00:00:00 2001 From: Marko Stankovic Date: Wed, 24 May 2017 00:25:24 +0200 Subject: staging: vt6655: align function parameters to open parenthesis Alignment styles are used interchangeably, align parameters to open parenthesis and fix issues reported by checkpatch.pl Signed-off-by: Marko Stankovic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 13 +++++++------ drivers/staging/vt6655/key.c | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 78804eaec608..9fcf2e223f71 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1310,8 +1310,8 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed) } static void vnt_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, struct ieee80211_bss_conf *conf, - u32 changed) + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *conf, u32 changed) { struct vnt_private *priv = hw->priv; @@ -1401,7 +1401,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, } static u64 vnt_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) + struct netdev_hw_addr_list *mc_list) { struct vnt_private *priv = hw->priv; struct netdev_hw_addr *ha; @@ -1420,7 +1420,8 @@ static u64 vnt_prepare_multicast(struct ieee80211_hw *hw, } static void vnt_configure(struct ieee80211_hw *hw, - unsigned int changed_flags, unsigned int *total_flags, u64 multicast) + unsigned int changed_flags, + unsigned int *total_flags, u64 multicast) { struct vnt_private *priv = hw->priv; u8 rx_mode = 0; @@ -1481,8 +1482,8 @@ static void vnt_configure(struct ieee80211_hw *hw, } static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) { struct vnt_private *priv = hw->priv; diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index dad9e292d4da..d7ede73a1a01 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c @@ -27,8 +27,8 @@ #include "mac.h" static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr, - struct ieee80211_key_conf *key, u32 key_type, u32 mode, - bool onfly_latch) + struct ieee80211_key_conf *key, u32 key_type, + u32 mode, bool onfly_latch) { struct vnt_private *priv = hw->priv; u8 broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -- cgit v1.2.3-55-g7522 From 13253d808d42dee88a53aa0fa57c5de4e6a460ed Mon Sep 17 00:00:00 2001 From: Aliza Minkov Date: Thu, 25 May 2017 16:46:45 +0300 Subject: dgnc: fix multiple blank lines coding style problem According to the coding-style documentation, functions in source files should be separated with one blank line. Redundant blank lines were removed from this source file, in accordance with coding-style documentation. Signed-off-by: Aliza Minkov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 253f38b25a54..c1b6079384e9 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -96,7 +96,6 @@ static int dgnc_do_remap(struct dgnc_board *brd) return 0; } - /* A board has been found, initialize it. */ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id) { @@ -287,7 +286,6 @@ static void dgnc_free_irq(struct dgnc_board *brd) free_irq(brd->irq, brd); } - /* * As each timer expires, it determines (a) whether the "transmit" * waiter needs to be woken up, and (b) whether the poller needs to -- cgit v1.2.3-55-g7522 From 9ce7b9cf64dc1a48a074033a83c8ea314b38540c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 19 May 2017 18:51:03 +0200 Subject: staging: bcm2835-audio: Deliver indirect-PCM transfer error Now that the indirect-PCM transfer helper gives back an error, we should return the error from ack callbacks. Acked-by: Eric Anholt Signed-off-by: Takashi Iwai --- drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c index e8cf0b97bf02..3637ddf909a4 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c @@ -353,9 +353,8 @@ static int snd_bcm2835_pcm_ack(struct snd_pcm_substream *substream) struct snd_pcm_indirect *pcm_indirect = &alsa_stream->pcm_indirect; pcm_indirect->hw_queue_size = runtime->hw.buffer_bytes_max; - snd_pcm_indirect_playback_transfer(substream, pcm_indirect, - snd_bcm2835_pcm_transfer); - return 0; + return snd_pcm_indirect_playback_transfer(substream, pcm_indirect, + snd_bcm2835_pcm_transfer); } /* trigger callback */ -- cgit v1.2.3-55-g7522 From 675b62d288908eaa6cb2b275c64bbd7973e01259 Mon Sep 17 00:00:00 2001 From: Rishiraj Manwatkar Date: Sat, 20 May 2017 06:33:17 +0000 Subject: staging: fbtft: Fix to avoid precedence issues Parentheses added to avoid operator precedence issues. Signed-off-by: Rishiraj Manwatkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_hx8340bn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_hx8340bn.c b/drivers/staging/fbtft/fb_hx8340bn.c index 1ca1fcd353d6..fbd5ef525243 100644 --- a/drivers/staging/fbtft/fb_hx8340bn.c +++ b/drivers/staging/fbtft/fb_hx8340bn.c @@ -157,7 +157,7 @@ static int set_var(struct fbtft_par *par) * OP0 OP1 CP0 CP1 CP2 CP3 CP4 MP0 MP1 MP2 MP3 MP4 MP5 CGM0 CGM1 * ON0 ON1 CN0 CN1 CN2 CN3 CN4 MN0 MN1 MN2 MN3 MN4 MN5 XXXX GC */ -#define CURVE(num, idx) curves[num * par->gamma.num_values + idx] +#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)] static int set_gamma(struct fbtft_par *par, u32 *curves) { unsigned long mask[] = { -- cgit v1.2.3-55-g7522 From 126ef7760b53585850c9091f35c552e65c209d57 Mon Sep 17 00:00:00 2001 From: Nikola Jelic Date: Tue, 23 May 2017 23:02:45 +0200 Subject: staging: wlan-ng: hfa384x: fix several type issues. There were several in-place conversions of 16 and 32-bit data, which caused sparse to detect them. Changed them to the in situ versions, such as: le16_to_cpu -> le16_to_cpus Signed-off-by: Nikola Jelic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x_usb.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index a812e55ba1b0..d3d1958675ed 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -1840,15 +1840,15 @@ int hfa384x_drvr_flashdl_enable(struct hfa384x *hw) if (result) return result; - hw->bufinfo.page = le16_to_cpu(hw->bufinfo.page); - hw->bufinfo.offset = le16_to_cpu(hw->bufinfo.offset); - hw->bufinfo.len = le16_to_cpu(hw->bufinfo.len); + le16_to_cpus(&hw->bufinfo.page); + le16_to_cpus(&hw->bufinfo.offset); + le16_to_cpus(&hw->bufinfo.len); result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_MAXLOADTIME, &hw->dltimeout); if (result) return result; - hw->dltimeout = le16_to_cpu(hw->dltimeout); + le16_to_cpus(&hw->dltimeout); pr_debug("flashdl_enable\n"); @@ -2644,8 +2644,7 @@ int hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb, HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0); #endif - hw->txbuff.txfrm.desc.tx_control = - cpu_to_le16(hw->txbuff.txfrm.desc.tx_control); + cpu_to_le16s(&hw->txbuff.txfrm.desc.tx_control); /* copy the header over to the txdesc */ memcpy(&hw->txbuff.txfrm.desc.frame_control, p80211_hdr, @@ -3380,8 +3379,8 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb) u16 fc; /* Byte order convert once up front. */ - usbin->rxfrm.desc.status = le16_to_cpu(usbin->rxfrm.desc.status); - usbin->rxfrm.desc.time = le32_to_cpu(usbin->rxfrm.desc.time); + le16_to_cpus(&usbin->rxfrm.desc.status); + le32_to_cpus(&usbin->rxfrm.desc.time); /* Now handle frame based on port# */ switch (HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status)) { @@ -3576,8 +3575,7 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev, static void hfa384x_usbin_info(struct wlandevice *wlandev, union hfa384x_usbin *usbin) { - usbin->infofrm.info.framelen = - le16_to_cpu(usbin->infofrm.info.framelen); + le16_to_cpus(&usbin->infofrm.info.framelen); prism2sta_ev_info(wlandev, &usbin->infofrm.info); } -- cgit v1.2.3-55-g7522 From 15e7681a21391e4600823f8bf3a1ee3df0b4596d Mon Sep 17 00:00:00 2001 From: Marko Stankovic Date: Thu, 25 May 2017 19:28:30 +0200 Subject: staging: wilc1000: remove excessive blank lines Fix the multiple blank lines issue reported by checkpatch.pl Signed-off-by: Marko Stankovic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 807aada308e3..98316a45abd1 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -84,7 +84,6 @@ static const struct wiphy_wowlan_support wowlan_support = { #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 @@ -163,7 +162,6 @@ static struct ieee80211_supported_band WILC_WFI_band_2ghz = { .n_bitrates = ARRAY_SIZE(ieee80211_bitrates), }; - struct add_key_params { u8 key_idx; bool pairwise; @@ -281,7 +279,6 @@ static void remove_network_from_shadow(unsigned long arg) unsigned long now = jiffies; int i, j; - for (i = 0; i < last_scanned_cnt; i++) { if (time_after(now, last_scanned_shadow[i].time_scan + (unsigned long)(SCAN_RESULT_EXPIRE))) { @@ -526,7 +523,6 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, memcpy(priv->au8AssociatedBss, pstrConnectInfo->bssid, ETH_ALEN); - for (i = 0; i < last_scanned_cnt; i++) { if (memcmp(last_scanned_shadow[i].bssid, pstrConnectInfo->bssid, @@ -626,7 +622,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) return -ENOMEM; strHiddenNetwork.n_ssids = request->n_ssids; - for (i = 0; i < request->n_ssids; i++) { if (request->ssids[i].ssid_len != 0) { strHiddenNetwork.net_info[i].ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL); @@ -927,8 +922,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, priv->wilc_ptk[key_index]->seq = NULL; } - - if (!pairwise) { if (params->cipher == WLAN_CIPHER_SUITE_TKIP) u8gmode = ENCRYPT_ENABLED | WPA | TKIP; @@ -968,7 +961,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, else u8pmode = priv->wilc_groupkey | AES; - if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { pu8TxMic = params->key + 24; pu8RxMic = params->key + 16; @@ -1153,7 +1145,6 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, priv = wiphy_priv(wiphy); - if (!pairwise) { key_params.key = priv->wilc_gtk[key_index]->key; key_params.cipher = priv->wilc_gtk[key_index]->cipher; @@ -1298,7 +1289,6 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, vif = netdev_priv(priv->dev); - for (i = 0; i < priv->pmkid_list.numpmkid; i++) { if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { @@ -1511,7 +1501,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)) { cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0); return; @@ -1533,7 +1522,6 @@ static void WILC_WFI_mgmt_tx_complete(void *priv, int status) { struct p2p_mgmt_data *pv_data = priv; - kfree(pv_data->buff); kfree(pv_data); } @@ -1653,7 +1641,6 @@ static int mgmt_tx(struct wiphy *wiphy, memcpy(mgmt_tx->buff, buf, len); mgmt_tx->size = len; - if (ieee80211_is_probe_resp(mgmt->frame_control)) { wilc_set_mac_chnl_num(vif, chan->hw_value); curr_channel = chan->hw_value; @@ -1832,7 +1819,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, if (wilc_enable_ps) wilc_set_power_mgmt(vif, enabled, timeout); - return 0; } @@ -2094,7 +2080,6 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, priv = wiphy_priv(wiphy); vif = netdev_priv(priv->wdev->netdev); - if (type == NL80211_IFTYPE_MONITOR) { new_ifc = WILC_WFI_init_mon_interface(name, vif->ndev); if (new_ifc) { -- cgit v1.2.3-55-g7522 From a135c4f6b548073982a49c26c0caf711369a5354 Mon Sep 17 00:00:00 2001 From: Marko Stankovic Date: Thu, 25 May 2017 19:28:31 +0200 Subject: staging: wilc1000: add missing blank line after struct declaration Fix a missing blank line issue reported by checkpatch.pl Signed-off-by: Marko Stankovic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 98316a45abd1..cae9c8ff80d8 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -167,6 +167,7 @@ struct add_key_params { bool pairwise; u8 *mac_addr; }; + 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; -- cgit v1.2.3-55-g7522 From ba3937d6a6c6da9bc096bc427d8b16fb784cdb92 Mon Sep 17 00:00:00 2001 From: Gennadii Altukhov Date: Fri, 26 May 2017 11:28:47 +0200 Subject: staging: ccree: fix cc_crypto_ctx.h white spaces Fix checkpatch.pl reported checks: spaces preferred around '/' and '<<' in cc_crypto_ctx.h Signed-off-by: Gennadii Altukhov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index ac39d349060d..2fabb5ca3f41 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -28,7 +28,7 @@ #define CC_CTX_SIZE_LOG2 7 #endif #endif -#define CC_CTX_SIZE (1<> 2) #define CC_DRV_DES_IV_SIZE 8 @@ -224,7 +224,7 @@ struct drv_ctx_hmac { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HMAC */ enum drv_hash_mode mode; u8 digest[CC_DIGEST_SIZE_MAX]; - u32 k0[CC_HMAC_BLOCK_SIZE_MAX/sizeof(u32)]; + u32 k0[CC_HMAC_BLOCK_SIZE_MAX / sizeof(u32)]; u32 k0_size; /* reserve to end of allocated context size */ u8 reserved[CC_CTX_SIZE - 3 * sizeof(u32) - @@ -248,8 +248,8 @@ struct drv_ctx_cipher { u8 xex_key[CC_AES_KEY_SIZE_MAX]; /* reserve to end of allocated context size */ u32 reserved[CC_DRV_CTX_SIZE_WORDS - 7 - - CC_AES_BLOCK_SIZE/sizeof(u32) - 2 * - (CC_AES_KEY_SIZE_MAX/sizeof(u32))]; + CC_AES_BLOCK_SIZE / sizeof(u32) - 2 * + (CC_AES_KEY_SIZE_MAX / sizeof(u32))]; }; /* authentication and encryption with associated data class */ @@ -269,8 +269,8 @@ struct drv_ctx_aead { u8 key[CC_AES_KEY_SIZE_MAX]; /* reserve to end of allocated context size */ u32 reserved[CC_DRV_CTX_SIZE_WORDS - 8 - - 3 * (CC_AES_BLOCK_SIZE/sizeof(u32)) - - CC_AES_KEY_SIZE_MAX/sizeof(u32)]; + 3 * (CC_AES_BLOCK_SIZE / sizeof(u32)) - + CC_AES_KEY_SIZE_MAX / sizeof(u32)]; }; /*******************************************************************/ -- cgit v1.2.3-55-g7522 From d057b3b78db1122178099918e760cca7940d8120 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:40:32 +1200 Subject: Drivers: ccree: ssi_sysfs.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_sysfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_sysfs.h b/drivers/staging/ccree/ssi_sysfs.h index cd456c5dccc4..4893e014adf7 100644 --- a/drivers/staging/ccree/ssi_sysfs.h +++ b/drivers/staging/ccree/ssi_sysfs.h @@ -15,7 +15,7 @@ */ /* \file ssi_sysfs.h - ARM CryptoCell sysfs APIs + * ARM CryptoCell sysfs APIs */ #ifndef __SSI_SYSFS_H__ -- cgit v1.2.3-55-g7522 From 6dbd671c0769c9014553e7fa23a9d8f833274134 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:41:11 +1200 Subject: Drivers: ccree: ssi_sysfs.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 89021c009872..69e1ae491098 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -355,7 +355,8 @@ static struct ssi_drvdata *sys_get_drvdata(void) { /* TODO: supporting multiple SeP devices would require avoiding * global "top_dir" and finding associated "top_dir" by traversing - * up the tree to the kobject which matches one of the top_dir's */ + * up the tree to the kobject which matches one of the top_dir's + */ return sys_top_dir.drvdata; } -- cgit v1.2.3-55-g7522 From 2f930981b88bcf0ac7fb2fb53d767bc1a91c9a5e Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:41:27 +1200 Subject: Drivers: ccree: ssi_request_mgr.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_request_mgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_request_mgr.h b/drivers/staging/ccree/ssi_request_mgr.h index ea685bb7fa2b..c4036ab715f1 100644 --- a/drivers/staging/ccree/ssi_request_mgr.h +++ b/drivers/staging/ccree/ssi_request_mgr.h @@ -15,7 +15,7 @@ */ /* \file request_mgr.h - Request Manager + * Request Manager */ #ifndef __REQUEST_MGR_H__ -- cgit v1.2.3-55-g7522 From 1010faa482f4f8494748316699b142cd7abb4fff Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:41:49 +1200 Subject: Drivers: ccree: ssi_request_mgr.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_request_mgr.c | 37 ++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 48c2450d65c6..1bc6811d63c5 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -300,8 +300,9 @@ static inline int request_mgr_queues_status_check( unsigned long poll_queue; /* SW queue is checked only once as it will not - be chaned during the poll becasue the spinlock_bh - is held by the thread */ + * be chaned during the poll becasue the spinlock_bh + * is held by the thread + */ if (unlikely(((req_mgr_h->req_queue_head + 1) & (MAX_REQUEST_QUEUE_SIZE - 1)) == req_mgr_h->req_queue_tail)) { @@ -384,8 +385,9 @@ int send_request( spin_lock_bh(&req_mgr_h->hw_lock); /* Check if there is enough place in the SW/HW queues - in case iv gen add the max size and in case of no dout add 1 - for the internal completion descriptor */ + * in case iv gen add the max size and in case of no dout add 1 + * for the internal completion descriptor + */ rc = request_mgr_queues_status_check(req_mgr_h, cc_base, max_required_seq_len); @@ -397,7 +399,8 @@ int send_request( if (rc != -EAGAIN) { /* Any error other than HW queue full - (SW queue is full) */ + * (SW queue is full) + */ #if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) ssi_power_mgr_runtime_put_suspend(&drvdata->plat_dev->dev); #endif @@ -409,7 +412,8 @@ int send_request( } while (1); /* Additional completion descriptor is needed incase caller did not - enabled any DLLI/MLLI DOUT bit in the given sequence */ + * enabled any DLLI/MLLI DOUT bit in the given sequence + */ if (!is_dout) { init_completion(&ssi_req->seq_compl); ssi_req->user_cb = request_mgr_complete; @@ -481,7 +485,8 @@ int send_request( if (!is_dout) { /* Wait upon sequence completion. - * Return "0" -Operation done successfully. */ + * Return "0" -Operation done successfully. + */ return wait_for_completion_interruptible(&ssi_req->seq_compl); } else { /* Operation still in process */ @@ -633,7 +638,8 @@ static void comp_handler(unsigned long devarg) /* ISR-to-Tasklet latency */ if (request_mgr_handle->axi_completed) { /* Only if actually reflects ISR-to-completion-handling latency, i.e., - not duplicate as a result of interrupt after AXIM_MON_ERR clear, before end of loop */ + * not duplicate as a result of interrupt after AXIM_MON_ERR clear, before end of loop + */ END_CYCLE_COUNT_AT(drvdata->isr_exit_cycles, STAT_OP_TYPE_GENERIC, STAT_PHASE_1); } @@ -641,7 +647,8 @@ static void comp_handler(unsigned long devarg) do { proc_completions(drvdata); /* At this point (after proc_completions()), request_mgr_handle->axi_completed is always 0. - The following assignment was changed to = (previously was +=) to conform KW restrictions. */ + * The following assignment was changed to = (previously was +=) to conform KW restrictions. + */ request_mgr_handle->axi_completed = CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); } while (request_mgr_handle->axi_completed > 0); @@ -663,9 +670,9 @@ static void comp_handler(unsigned long devarg) } /* -resume the queue configuration - no need to take the lock as this happens inside -the spin lock protection -*/ + * resume the queue configuration - no need to take the lock as this happens inside + * the spin lock protection + */ #if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) int ssi_request_mgr_runtime_resume_queue(struct ssi_drvdata *drvdata) { @@ -679,9 +686,9 @@ int ssi_request_mgr_runtime_resume_queue(struct ssi_drvdata *drvdata) } /* -suspend the queue configuration. Since it is used for the runtime suspend -only verify that the queue can be suspended. -*/ + * suspend the queue configuration. Since it is used for the runtime suspend + * only verify that the queue can be suspended. + */ int ssi_request_mgr_runtime_suspend_queue(struct ssi_drvdata *drvdata) { struct ssi_request_mgr_handle * request_mgr_handle = -- cgit v1.2.3-55-g7522 From 5d19caf6e95c071530f9bd874a9bc67520b139f3 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:42:08 +1200 Subject: Drivers: ccree: ssi_pm_ext.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_pm_ext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_pm_ext.h b/drivers/staging/ccree/ssi_pm_ext.h index 9049e6ffa8d3..dbe658b530bf 100644 --- a/drivers/staging/ccree/ssi_pm_ext.h +++ b/drivers/staging/ccree/ssi_pm_ext.h @@ -15,7 +15,7 @@ */ /* \file ssi_pm_ext.h - */ + */ #ifndef __PM_EXT_H__ #define __PM_EXT_H__ -- cgit v1.2.3-55-g7522 From ff7c2e41d4be593c4ec6858c9faf071097cb4914 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:42:24 +1200 Subject: Drivers: ccree: ssi_pm_ext.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_pm_ext.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_pm_ext.c b/drivers/staging/ccree/ssi_pm_ext.c index 5889d9f97479..453151cdd6b2 100644 --- a/drivers/staging/ccree/ssi_pm_ext.c +++ b/drivers/staging/ccree/ssi_pm_ext.c @@ -26,10 +26,10 @@ #include "ssi_pm_ext.h" /* -This function should suspend the HW (if possiable), It should be implemented by -the driver user. -The reference code clears the internal SRAM to imitate lose of state. -*/ + * This function should suspend the HW (if possiable), It should be implemented by + * the driver user. + * The reference code clears the internal SRAM to imitate lose of state. + */ void ssi_pm_ext_hw_suspend(struct device *dev) { struct ssi_drvdata *drvdata = @@ -50,9 +50,9 @@ void ssi_pm_ext_hw_suspend(struct device *dev) } /* -This function should resume the HW (if possiable).It should be implemented by -the driver user. -*/ + * This function should resume the HW (if possiable).It should be implemented by + * the driver user. + */ void ssi_pm_ext_hw_resume(struct device *dev) { return; -- cgit v1.2.3-55-g7522 From 3dc178b164e6bf0d21714917ad5866d59885f91a Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:42:41 +1200 Subject: Drivers: ccree: ssi_pm.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_pm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_pm.h b/drivers/staging/ccree/ssi_pm.h index f1fe1777c04a..8b0d8be95199 100644 --- a/drivers/staging/ccree/ssi_pm.h +++ b/drivers/staging/ccree/ssi_pm.h @@ -15,7 +15,7 @@ */ /* \file ssi_pm.h - */ + */ #ifndef __SSI_POWER_MGR_H__ #define __SSI_POWER_MGR_H__ -- cgit v1.2.3-55-g7522 From fc3d47b3ec037c375101348a6f53e997ef919170 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:42:57 +1200 Subject: Drivers: ccree: ssi_ivgen.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_ivgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index 1bb6f8919101..db4b831e82a3 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -26,7 +26,8 @@ /* The max. size of pool *MUST* be <= SRAM total size */ #define SSI_IVPOOL_SIZE 1024 /* The first 32B fraction of pool are dedicated to the - next encryption "key" & "IV" for pool regeneration */ + * next encryption "key" & "IV" for pool regeneration + */ #define SSI_IVPOOL_META_SIZE (CC_AES_IV_SIZE + AES_KEYSIZE_128) #define SSI_IVPOOL_GEN_SEQ_LEN 4 @@ -278,7 +279,8 @@ int ssi_ivgen_getiv( } /* Bypass operation is proceeded by crypto sequence, hence must - * assure bypass-write-transaction by a memory barrier */ + * assure bypass-write-transaction by a memory barrier + */ HW_DESC_INIT(&iv_seq[idx]); HW_DESC_SET_DIN_NO_DMA(&iv_seq[idx], 0, 0xfffff0); HW_DESC_SET_DOUT_NO_DMA(&iv_seq[idx], 0, 0, 1); -- cgit v1.2.3-55-g7522 From 77f34fc3f5a463c9cbe1b09ea99a616050e84367 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:43:11 +1200 Subject: Drivers: ccree: ssi_hash.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index b821d0c854b5..7c946614a1f9 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -15,7 +15,7 @@ */ /* \file ssi_hash.h - ARM CryptoCell Hash Crypto API + * ARM CryptoCell Hash Crypto API */ #ifndef __SSI_HASH_H__ -- cgit v1.2.3-55-g7522 From 1a3a8d2e869c997780bd61e592fd9bc5f497aca2 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:43:26 +1200 Subject: Drivers: ccree: ssi_hash.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_hash.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 8585f73161b3..da5915e4ce48 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -97,7 +97,8 @@ struct hash_key_req_ctx { struct ssi_hash_ctx { struct ssi_drvdata *drvdata; /* holds the origin digest; the digest after "setkey" if HMAC,* - the initial digest if HASH. */ + * the initial digest if HASH. + */ u8 digest_buff[SSI_MAX_HASH_DIGEST_SIZE] ____cacheline_aligned; u8 opad_tmp_keys_buff[SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE] ____cacheline_aligned; dma_addr_t opad_tmp_keys_dma_addr ____cacheline_aligned; @@ -250,7 +251,8 @@ static int ssi_hash_map_request(struct device *dev, } } else { /*hash*/ /* Copy the initial digests if hash flow. The SRAM contains the - initial digests in the expected order for all SHA* */ + * initial digests in the expected order for all SHA* + */ HW_DESC_INIT(&desc); HW_DESC_SET_DIN_SRAM(&desc, larval_digest_addr, ctx->inter_digestsize); HW_DESC_SET_DOUT_DLLI(&desc, state->digest_buff_dma_addr, ctx->inter_digestsize, NS_BIT, 0); @@ -1027,7 +1029,8 @@ static int ssi_hash_setkey(void *hash, ctx->drvdata, ctx->hash_mode); /* The keylen value distinguishes HASH in case keylen is ZERO bytes, - any NON-ZERO value utilizes HMAC flow */ + * any NON-ZERO value utilizes HMAC flow + */ ctx->key_params.keylen = keylen; ctx->key_params.key_dma_addr = 0; ctx->is_hmac = true; -- cgit v1.2.3-55-g7522 From 3ddf70e15dd740ec17b6fab4e901abb02dbf6291 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Wed, 24 May 2017 16:43:39 +1200 Subject: Drivers: ccree: ssi_fips_local.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips_local.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index 316507d88b4e..8076c771f750 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -15,8 +15,8 @@ */ /************************************************************** -This file defines the driver FIPS internal function, used by the driver itself. -***************************************************************/ + * This file defines the driver FIPS internal function, used by the driver itself. + ***************************************************************/ #include #include #include @@ -80,10 +80,10 @@ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) /* - This function should push the FIPS REE library status towards the TEE library. - By writing the error state to HOST_GPR0 register. The function is called from . - driver entry point so no need to protect by mutex. -*/ + * This function should push the FIPS REE library status towards the TEE library. + * By writing the error state to HOST_GPR0 register. The function is called from + * driver entry point so no need to protect by mutex. + */ static void ssi_fips_update_tee_upon_ree_status(struct ssi_drvdata *drvdata, ssi_fips_error_t err) { void __iomem *cc_base = drvdata->cc_base; @@ -232,7 +232,8 @@ ssi_fips_error_t cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) /* The function checks if FIPS supported and FIPS error exists.* -* It should be used in every driver API.*/ + * It should be used in every driver API. + */ int ssi_fips_check_fips_error(void) { ssi_fips_state_t fips_state; @@ -250,14 +251,16 @@ int ssi_fips_check_fips_error(void) /* The function sets the REE FIPS state.* -* It should be used while driver is being loaded .*/ + * It should be used while driver is being loaded. + */ int ssi_fips_set_state(ssi_fips_state_t state) { return ssi_fips_ext_set_state(state); } /* The function sets the REE FIPS error, and pushes the error to TEE library. * -* It should be used when any of the KAT tests fails .*/ + * It should be used when any of the KAT tests fails. + */ int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err) { int rc = 0; -- cgit v1.2.3-55-g7522 From 08eb23974e994a34776e7a83227509d4e4296aa5 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Wed, 24 May 2017 07:13:27 -0500 Subject: staging: fsl-dpaa2/eth: Fix address translations Use the correct mechanisms for translating a DMA-mapped IOVA address into a virtual one. Without this fix, once SMMU is enabled on Layerscape platforms, the Ethernet driver throws IOMMU translation faults. Signed-off-by: Nipun Gupta Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 25 +++++++++++++++++++------ drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 6f9eed66c64d..3fee0d6f17e0 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "../../fsl-mc/include/mc.h" #include "../../fsl-mc/include/mc-sys.h" @@ -54,6 +55,16 @@ MODULE_DESCRIPTION("Freescale DPAA2 Ethernet Driver"); const char dpaa2_eth_drv_version[] = "0.1"; +static void *dpaa2_iova_to_virt(struct iommu_domain *domain, + dma_addr_t iova_addr) +{ + phys_addr_t phys_addr; + + phys_addr = domain ? iommu_iova_to_phys(domain, iova_addr) : iova_addr; + + return phys_to_virt(phys_addr); +} + static void validate_rx_csum(struct dpaa2_eth_priv *priv, u32 fd_status, struct sk_buff *skb) @@ -98,12 +109,11 @@ static void free_rx_fd(struct dpaa2_eth_priv *priv, sgt = vaddr + dpaa2_fd_get_offset(fd); for (i = 0; i < DPAA2_ETH_MAX_SG_ENTRIES; i++) { addr = dpaa2_sg_get_addr(&sgt[i]); + sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE, DMA_FROM_DEVICE); - sg_vaddr = phys_to_virt(addr); skb_free_frag(sg_vaddr); - if (dpaa2_sg_is_final(&sgt[i])) break; } @@ -159,10 +169,10 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv *priv, /* Get the address and length from the S/G entry */ sg_addr = dpaa2_sg_get_addr(sge); + sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, sg_addr); dma_unmap_single(dev, sg_addr, DPAA2_ETH_RX_BUF_SIZE, DMA_FROM_DEVICE); - sg_vaddr = phys_to_virt(sg_addr); sg_length = dpaa2_sg_get_len(sge); if (i == 0) { @@ -222,8 +232,8 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, /* Tracing point */ trace_dpaa2_rx_fd(priv->net_dev, fd); + vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE, DMA_FROM_DEVICE); - vaddr = phys_to_virt(addr); prefetch(vaddr + priv->buf_layout.private_data_size); prefetch(vaddr + dpaa2_fd_get_offset(fd)); @@ -490,7 +500,7 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, struct dpaa2_fas *fas; fd_addr = dpaa2_fd_get_addr(fd); - skbh = phys_to_virt(fd_addr); + skbh = dpaa2_iova_to_virt(priv->iommu_domain, fd_addr); if (fd_format == dpaa2_fd_single) { skb = *skbh; @@ -802,10 +812,11 @@ static void drain_bufs(struct dpaa2_eth_priv *priv, int count) } for (i = 0; i < ret; i++) { /* Same logic as on regular Rx path */ + vaddr = dpaa2_iova_to_virt(priv->iommu_domain, + buf_array[i]); dma_unmap_single(dev, buf_array[i], DPAA2_ETH_RX_BUF_SIZE, DMA_FROM_DEVICE); - vaddr = phys_to_virt(buf_array[i]); skb_free_frag(vaddr); } } while (ret); @@ -2358,6 +2369,8 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev) priv = netdev_priv(net_dev); priv->net_dev = net_dev; + priv->iommu_domain = iommu_get_domain_for_dev(dev); + /* Obtain a MC portal */ err = fsl_mc_portal_allocate(dpni_dev, FSL_MC_IO_ATOMIC_CONTEXT_PORTAL, &priv->mc_io); diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index c67cced55b72..55b47623008c 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -301,6 +301,7 @@ struct dpaa2_eth_priv { struct fsl_mc_device *dpbp_dev; struct dpbp_attr dpbp_attrs; + struct iommu_domain *iommu_domain; u16 tx_qdid; struct fsl_mc_io *mc_io; -- cgit v1.2.3-55-g7522 From 1e5fa9e2607181ba198ffa3f0efe4ad067fda5b4 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Wed, 24 May 2017 07:13:28 -0500 Subject: staging: fsl-dpaa2/eth: Map Tx buffers as bidirectional WRIOP hardware may need to write to the hardware annotation area of Tx buffers (e.g. frame status bits) and also to the data area (e.g. L4 checksum in frame header). Map these buffers as DMA_BIDIRECTIONAL, otherwise the write transaction through SMMU will not be allowed. Signed-off-by: Nipun Gupta Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 3fee0d6f17e0..49c435bad706 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -355,7 +355,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, sg_init_table(scl, nr_frags + 1); num_sg = skb_to_sgvec(skb, scl, 0, skb->len); - num_dma_bufs = dma_map_sg(dev, scl, num_sg, DMA_TO_DEVICE); + num_dma_bufs = dma_map_sg(dev, scl, num_sg, DMA_BIDIRECTIONAL); if (unlikely(!num_dma_bufs)) { err = -ENOMEM; goto dma_map_sg_failed; @@ -406,7 +406,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, swa->num_dma_bufs = num_dma_bufs; /* Separately map the SGT buffer */ - addr = dma_map_single(dev, sgt_buf, sgt_buf_size, DMA_TO_DEVICE); + addr = dma_map_single(dev, sgt_buf, sgt_buf_size, DMA_BIDIRECTIONAL); if (unlikely(dma_mapping_error(dev, addr))) { err = -ENOMEM; goto dma_map_single_failed; @@ -423,7 +423,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, dma_map_single_failed: kfree(sgt_buf); sgt_buf_alloc_failed: - dma_unmap_sg(dev, scl, num_sg, DMA_TO_DEVICE); + dma_unmap_sg(dev, scl, num_sg, DMA_BIDIRECTIONAL); dma_map_sg_failed: kfree(scl); return err; @@ -461,7 +461,7 @@ static int build_single_fd(struct dpaa2_eth_priv *priv, addr = dma_map_single(dev, buffer_start, skb_tail_pointer(skb) - buffer_start, - DMA_TO_DEVICE); + DMA_BIDIRECTIONAL); if (unlikely(dma_mapping_error(dev, addr))) return -ENOMEM; @@ -510,7 +510,7 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, */ dma_unmap_single(dev, fd_addr, skb_tail_pointer(skb) - buffer_start, - DMA_TO_DEVICE); + DMA_BIDIRECTIONAL); } else if (fd_format == dpaa2_fd_sg) { swa = (struct dpaa2_eth_swa *)skbh; skb = swa->skb; @@ -519,13 +519,13 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, num_dma_bufs = swa->num_dma_bufs; /* Unmap the scatterlist */ - dma_unmap_sg(dev, scl, num_sg, DMA_TO_DEVICE); + dma_unmap_sg(dev, scl, num_sg, DMA_BIDIRECTIONAL); kfree(scl); /* Unmap the SGT buffer */ unmap_size = priv->tx_data_offset + sizeof(struct dpaa2_sg_entry) * (1 + num_dma_bufs); - dma_unmap_single(dev, fd_addr, unmap_size, DMA_TO_DEVICE); + dma_unmap_single(dev, fd_addr, unmap_size, DMA_BIDIRECTIONAL); } else { /* Unsupported format, mark it as errored and give up */ if (status) -- cgit v1.2.3-55-g7522 From 9415b671a9b03c602b3b4fb48bb2b341d2d64e30 Mon Sep 17 00:00:00 2001 From: Szilveszter Székely Date: Thu, 25 May 2017 19:26:06 +0100 Subject: staging: rtl8192u: swap comparison to constant Comparisons should place the constant on the right side of the test This patch fixes coding style issues as reported by checkpatch. Signed-off-by: Szilveszter Székely Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 9f370e8d84d3..779ecdbc4e17 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1797,8 +1797,8 @@ static void rtl8192_link_change(struct net_device *dev) * way, but there is no chance to set this as wep will not set * group key in wext. */ - if (KEY_TYPE_WEP40 == ieee->pairwise_key_type || - KEY_TYPE_WEP104 == ieee->pairwise_key_type) + if (ieee->pairwise_key_type == KEY_TYPE_WEP40 || + ieee->pairwise_key_type == KEY_TYPE_WEP104) EnableHWSecurityConfig8192(dev); } /*update timing params*/ @@ -2071,7 +2071,7 @@ static bool GetNmodeSupportBySecCfg8192(struct net_device *dev) */ encrypt = (network->capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && - (0 == strcmp(crypt->ops->name, "WEP"))); + (strcmp(crypt->ops->name, "WEP") == 0)); /* simply judge */ if (encrypt && (wpa_ie_len == 0)) { @@ -4498,7 +4498,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, praddr = hdr->addr1; /* Check if the received packet is acceptable. */ - bpacket_match_bssid = (IEEE80211_FTYPE_CTL != type) && + bpacket_match_bssid = (type != IEEE80211_FTYPE_CTL) && (eqMacAddr(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3)) && (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV); bpacket_toself = bpacket_match_bssid & @@ -5098,7 +5098,7 @@ void EnableHWSecurityConfig8192(struct net_device *dev) struct ieee80211_device *ieee = priv->ieee80211; SECR_value = SCR_TxEncEnable | SCR_RxDecEnable; - if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (priv->ieee80211->auth_mode != 2)) { + if (((ieee->pairwise_key_type == KEY_TYPE_WEP40) || (ieee->pairwise_key_type == KEY_TYPE_WEP104)) && (priv->ieee80211->auth_mode != 2)) { SECR_value |= SCR_RxUseDK; SECR_value |= SCR_TxUseDK; } else if ((ieee->iw_mode == IW_MODE_ADHOC) && (ieee->pairwise_key_type & (KEY_TYPE_CCMP | KEY_TYPE_TKIP))) { -- cgit v1.2.3-55-g7522 From 74e1e498e84ea957b7fe3d9842f04c346ca2fcbb Mon Sep 17 00:00:00 2001 From: Juliana Rodrigues Date: Thu, 25 May 2017 15:30:27 -0300 Subject: staging: rtl8188eu: fix comments with lines over 80 characters This patch fixes some checkpatch errors in which comments go over 80 characters per line. Signed-off-by: Juliana Rodrigues Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ap.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 909406b2b8f4..647a922d79d1 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -735,9 +735,11 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - /* check if there is wps ie, */ - /* if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd, */ - /* and at first time the security ie (RSN/WPA IE) will not include in beacon. */ + /* check if there is wps ie, + * if there is wpsie in beacon, the hostapd will update + * beacon twice when stating hostapd, and at first time the + * security ie (RSN/WPA IE) will not include in beacon. + */ if (!rtw_get_wps_ie(pnetwork->IEs + _FIXED_IE_LENGTH_, pnetwork->IELength - _FIXED_IE_LENGTH_, NULL, NULL)) pmlmeext->bstart_bss = true; @@ -751,8 +753,11 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) update_hw_ht_param(padapter); } - if (pmlmepriv->cur_network.join_res != true) { /* setting only at first time */ - /* WEP Key will be set before this function, do not clear CAM. */ + /* setting only at first time */ + if (!(pmlmepriv->cur_network.join_res)) { + /* WEP Key will be set before this function, do not + * clear CAM. + */ if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_)) flush_all_cam_entry(padapter); /* clear CAM */ @@ -809,7 +814,9 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) } } } - /* TODO: need to judge the phy parameters on concurrent mode for single phy */ + /* TODO: need to judge the phy parameters on concurrent + * mode for single phy + */ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); DBG_88E("CH =%d, BW =%d, offset =%d\n", cur_channel, cur_bwmode, cur_ch_offset); @@ -1005,9 +1012,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) if ((p) && !memcmp(p + 2, WMM_PARA_IE, 6)) { pmlmepriv->qospriv.qos_option = 1; - *(p + 8) |= BIT(7);/* QoS Info, support U-APSD */ + /* QoS Info, support U-APSD */ + *(p + 8) |= BIT(7); - /* disable all ACM bits since the WMM admission control is not supported */ + /* disable all ACM bits since the WMM + * admission control is not supported + */ *(p + 10) &= ~BIT(4); /* BE */ *(p + 14) &= ~BIT(4); /* BK */ *(p + 18) &= ~BIT(4); /* VI */ @@ -1834,7 +1844,9 @@ void stop_ap_mode(struct adapter *padapter) pmlmepriv->update_bcn = false; pmlmeext->bstart_bss = false; - /* reset and init security priv , this can refine with rtw_reset_securitypriv */ + /* reset and init security priv , this can refine with + * rtw_reset_securitypriv + */ memset((unsigned char *)&padapter->securitypriv, 0, sizeof(struct security_priv)); padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; -- cgit v1.2.3-55-g7522 From 31e6de00485f55a2938420e58a41b756ea1b3da2 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigues Date: Fri, 26 May 2017 21:58:35 -0300 Subject: staging: rtl8188eu: fixes block comments subsequent lines This patch adds * on block comments subsequent lines, which were causing a checkpatch styling warning. Signed-off-by: Juliana Rodrigues Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 9754322b506e..66aaa64c58a9 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -21,9 +21,9 @@ #include /* -Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. -No irqsave is necessary. -*/ + * Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. + * No irqsave is necessary. + */ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { @@ -35,14 +35,13 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) } /* -Calling Context: - -rtw_enqueue_cmd can only be called between kernel thread, -since only spin_lock is used. - -ISR/Call-Back functions can't call this sub-function. - -*/ + * Calling Context: + * + * rtw_enqueue_cmd can only be called between kernel thread, + * since only spin_lock is used. + * + * ISR/Call-Back functions can't call this sub-function. + */ static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) { @@ -241,10 +240,11 @@ _next: } /* -rtw_sitesurvey_cmd(~) - ### NOTE:#### (!!!!) - MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock -*/ + * rtw_sitesurvey_cmd(~) + * ### NOTE:#### (!!!!) + * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE + * LOCKED pmlmepriv->lock + */ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num) { @@ -1276,7 +1276,9 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); spin_unlock_bh(&pmlmepriv->scanned_queue.lock); - /* we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback) */ + /* we will set _FW_LINKED when there is one more sat to + * join us (rtw_stassoc_event_callback) + */ } createbss_cmd_fail: -- cgit v1.2.3-55-g7522 From ae94127b01b411fe9ba0cae2fd7cea170f729c62 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigues Date: Fri, 26 May 2017 21:59:48 -0300 Subject: staging: rtl8188eu: add spaces around character This patch solves a checkpatch issue caused by not using spaces around an OR sign. Signed-off-by: Juliana Rodrigues Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 66aaa64c58a9..8e9400e51f40 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -396,7 +396,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) /* for hidden ap to set fw_state here */ - if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) { + if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE)) { switch (ndis_network_mode) { case Ndis802_11IBSS: set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); -- cgit v1.2.3-55-g7522 From f6da172f21de6551dfe9203767a652ed4b409125 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigues Date: Fri, 26 May 2017 22:00:22 -0300 Subject: staging: rtl8188eu: removed function names from strings This patch fixes a checkpatch issue caused by using function names inside strings. Those function names were replaced by __func__. Signed-off-by: Juliana Rodrigues Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 8e9400e51f40..ccf3f1c96559 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -163,7 +163,8 @@ int rtw_cmd_thread(void *context) pcmdpriv->cmdthd_running = true; complete(&pcmdpriv->terminate_cmdthread_comp); - RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x rtw_cmd_thread !!!!\n")); + RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, + ("start r871x %s !!!!\n", __func__)); while (1) { if (wait_for_completion_interruptible(&pcmdpriv->cmd_queue_comp)) @@ -417,7 +418,8 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) res = _FAIL; - RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd :psecnetwork == NULL!!!\n")); + RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, + ("%s :psecnetwork == NULL!!!\n", __func__)); goto exit; } @@ -510,7 +512,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu u8 res = _SUCCESS; - RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_disassoc_cmd\n")); + RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+%s\n", __func__)); /* prepare cmd parameter */ param = kzalloc(sizeof(*param), GFP_KERNEL); @@ -740,7 +742,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) u8 res = _SUCCESS; - RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_chplan_cmd\n")); + RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+%s\n", __func__)); /* check input parameter */ if (!rtw_is_channel_plan_valid(chplan)) { @@ -1233,7 +1235,8 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->res != H2C_SUCCESS) { - RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); + RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, + ("\n **** Error: %s Fail ****\n\n.", __func__)); mod_timer(&pmlmepriv->assoc_timer, jiffies + msecs_to_jiffies(1)); } -- cgit v1.2.3-55-g7522 From 3e63e934f7ebc9c9ad1d854dafe5fa30e2f4512c Mon Sep 17 00:00:00 2001 From: Juliana Rodrigues Date: Fri, 26 May 2017 22:00:54 -0300 Subject: staging: rtl8188eu: removed unnecessary parentheses This patch removes numerous unnecessary parentheses in order to fix checkpatch styling issues. Signed-off-by: Juliana Rodrigues Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index ccf3f1c96559..4061e2a9b97f 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -30,7 +30,7 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) init_completion(&pcmdpriv->cmd_queue_comp); init_completion(&pcmdpriv->terminate_cmdthread_comp); - _rtw_init_queue(&(pcmdpriv->cmd_queue)); + _rtw_init_queue(&pcmdpriv->cmd_queue); return _SUCCESS; } @@ -156,7 +156,7 @@ int rtw_cmd_thread(void *context) u8 (*cmd_hdl)(struct adapter *padapter, u8 *pbuf); void (*pcmd_callback)(struct adapter *dev, struct cmd_obj *pcmd); struct adapter *padapter = context; - struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; allow_signal(SIGTERM); @@ -377,7 +377,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) struct ht_priv *phtpriv = &pmlmepriv->htpriv; enum ndis_802_11_network_infra ndis_network_mode = pnetwork->network.InfrastructureMode; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; LedControl8188eu(padapter, LED_CTL_START_TO_LINK); @@ -792,7 +792,7 @@ static void traffic_status_watchdog(struct adapter *padapter) u8 bEnterPS; u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; /* */ /* Determine if our traffic is busy now */ @@ -851,7 +851,7 @@ static void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz) struct mlme_priv *pmlmepriv; padapter = (struct adapter *)pbuf; - pmlmepriv = &(padapter->mlmepriv); + pmlmepriv = &padapter->mlmepriv; #ifdef CONFIG_88EU_AP_MODE if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) @@ -867,7 +867,7 @@ static void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz) static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) { struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; u8 mstatus; @@ -1231,7 +1231,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) struct wlan_network *pwlan = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf; - struct wlan_network *tgt_network = &(pmlmepriv->cur_network); + struct wlan_network *tgt_network = &pmlmepriv->cur_network; if (pcmd->res != H2C_SUCCESS) { @@ -1258,7 +1258,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) rtw_indicate_connect(padapter); } else { pwlan = _rtw_alloc_network(pmlmepriv); - spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); + spin_lock_bh(&pmlmepriv->scanned_queue.lock); if (pwlan == NULL) { pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue); if (pwlan == NULL) { @@ -1268,11 +1268,12 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) } pwlan->last_scanned = jiffies; } else { - list_add_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue); + list_add_tail(&pwlan->list, + &pmlmepriv->scanned_queue.queue); } pnetwork->Length = get_wlan_bssid_ex_sz(pnetwork); - memcpy(&(pwlan->network), pnetwork, pnetwork->Length); + memcpy(&pwlan->network, pnetwork, pnetwork->Length); memcpy(&tgt_network->network, pnetwork, (get_wlan_bssid_ex_sz(pnetwork))); -- cgit v1.2.3-55-g7522 From b2f98d02c72bb6c8db445291f97ab0a500bfb3e5 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigues Date: Fri, 26 May 2017 22:01:26 -0300 Subject: staging: rtl8188eu: removed unnecessary blank lines Removes numerous unnecessary blank lines in order to fix checkpatch styling issues. Signed-off-by: Juliana Rodrigues Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 41 +------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 4061e2a9b97f..e70086e1a2b1 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -47,7 +47,6 @@ static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) { unsigned long irqL; - if (obj == NULL) goto exit; @@ -59,7 +58,6 @@ static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) exit: - return _SUCCESS; } @@ -106,7 +104,6 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) int res = _FAIL; struct adapter *padapter = pcmdpriv->padapter; - if (cmd_obj == NULL) goto exit; @@ -125,13 +122,11 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) exit: - return res; } void rtw_free_cmd_obj(struct cmd_obj *pcmd) { - if ((pcmd->cmdcode != _JoinBss_CMD_) && (pcmd->cmdcode != _CreateBss_CMD_)) { /* free parmbuf in cmd_obj */ kfree(pcmd->parmbuf); @@ -146,7 +141,6 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) /* free cmd_obj */ kfree(pcmd); - } int rtw_cmd_thread(void *context) @@ -236,7 +230,6 @@ _next: complete(&pcmdpriv->terminate_cmdthread_comp); - complete_and_exit(NULL, 0); } @@ -316,13 +309,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } - return res; } void rtw_readtssi_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) { - kfree(pcmd->parmbuf); kfree(pcmd); } @@ -335,7 +326,6 @@ u8 rtw_createbss_cmd(struct adapter *padapter) struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; u8 res = _SUCCESS; - LedControl8188eu(padapter, LED_CTL_START_TO_LINK); if (pmlmepriv->assoc_ssid.SsidLength == 0) @@ -359,7 +349,6 @@ u8 rtw_createbss_cmd(struct adapter *padapter) res = rtw_enqueue_cmd(pcmdpriv, pcmd); exit: - return res; } @@ -379,7 +368,6 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - LedControl8188eu(padapter, LED_CTL_START_TO_LINK); if (pmlmepriv->assoc_ssid.SsidLength == 0) @@ -395,7 +383,6 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) /* for IEs is fix buf size */ t_len = sizeof(struct wlan_bssid_ex); - /* for hidden ap to set fw_state here */ if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE)) { switch (ndis_network_mode) { @@ -446,7 +433,6 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecnetwork->IELength = rtw_restruct_sec_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength); - pqospriv->qos_option = 0; if (pregistrypriv->wmm_enable) { @@ -500,7 +486,6 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) exit: - return res; } @@ -511,7 +496,6 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu struct cmd_priv *cmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+%s\n", __func__)); /* prepare cmd parameter */ @@ -541,7 +525,6 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu exit: - return res; } @@ -619,7 +602,6 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue) struct sta_info *sta = (struct sta_info *)psta; u8 res = _SUCCESS; - if (!enqueue) { clear_cam_entry(padapter, entry); } else { @@ -658,7 +640,6 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue) } exit: - return res; } @@ -669,7 +650,6 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) struct addBaReq_parm *paddbareq_parm; u8 res = _SUCCESS; - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (!ph2c) { res = _FAIL; @@ -695,7 +675,6 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) exit: - return res; } @@ -706,7 +685,6 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (!ph2c) { res = _FAIL; @@ -726,7 +704,6 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter) init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, _Set_Drv_Extra_CMD_); - /* rtw_enqueue_cmd(pcmdpriv, ph2c); */ res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: @@ -741,7 +718,6 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) u8 res = _SUCCESS; - RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+%s\n", __func__)); /* check input parameter */ @@ -783,7 +759,6 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) exit: - return res; } @@ -870,7 +845,6 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; u8 mstatus; - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) return; @@ -907,7 +881,6 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) default: break; } - } u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) @@ -945,7 +918,6 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) exit: - return res; } @@ -982,7 +954,6 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time) res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: - return res; } @@ -1028,7 +999,6 @@ u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue) } exit: - return res; } @@ -1171,7 +1141,6 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* need to make timeout handlerOS independent */ @@ -1185,13 +1154,12 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) /* free cmd */ rtw_free_cmd_obj(pcmd); - } + void rtw_disassoc_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if (pcmd->res != H2C_SUCCESS) { spin_lock_bh(&pmlmepriv->lock); set_fwstate(pmlmepriv, _FW_LINKED); @@ -1209,7 +1177,6 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* need to make timeout handlerOS independent */ @@ -1222,7 +1189,6 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) } rtw_free_cmd_obj(pcmd); - } void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) @@ -1233,7 +1199,6 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf; struct wlan_network *tgt_network = &pmlmepriv->cur_network; - if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n **** Error: %s Fail ****\n\n.", __func__)); @@ -1290,7 +1255,6 @@ createbss_cmd_fail: spin_unlock_bh(&pmlmepriv->lock); rtw_free_cmd_obj(pcmd); - } void rtw_setstaKey_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) @@ -1299,7 +1263,6 @@ void rtw_setstaKey_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pc struct set_stakey_rsp *psetstakey_rsp = (struct set_stakey_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr); - if (psta == NULL) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: %s => can't get sta_info\n\n", __func__)); goto exit; @@ -1316,7 +1279,6 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj * struct set_assocsta_rsp *passocsta_rsp = (struct set_assocsta_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr); - if (psta == NULL) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: %s => can't get sta_info\n\n", __func__)); goto exit; @@ -1332,5 +1294,4 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj * exit: rtw_free_cmd_obj(pcmd); - } -- cgit v1.2.3-55-g7522 From 5b29aaaa1e3c33829ab19a0da43fa637f0685603 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigues Date: Fri, 26 May 2017 22:02:03 -0300 Subject: staging: rtl8188eu: removes comparison to null This patch fixes multiple comparison to NULL checkpatch errors by rewriting the conditional as a negation. Signed-off-by: Juliana Rodrigues Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index e70086e1a2b1..002d09159896 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -47,7 +47,7 @@ static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) { unsigned long irqL; - if (obj == NULL) + if (!obj) goto exit; spin_lock_irqsave(&queue->lock, irqL); @@ -104,7 +104,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) int res = _FAIL; struct adapter *padapter = pcmdpriv->padapter; - if (cmd_obj == NULL) + if (!cmd_obj) goto exit; cmd_obj->padapter = padapter; @@ -132,7 +132,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) kfree(pcmd->parmbuf); } - if (pcmd->rsp != NULL) { + if (!pcmd->rsp) { if (pcmd->rspsz != 0) { /* free rsp in cmd_obj */ kfree(pcmd->rsp); @@ -202,7 +202,7 @@ _next: /* call callback function for post-processed */ if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) { pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; - if (pcmd_callback == NULL) { + if (!pcmd_callback) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("mlme_cmd_hdl(): pcmd_callback = 0x%p, cmdcode = 0x%x\n", pcmd_callback, pcmd->cmdcode)); rtw_free_cmd_obj(pcmd); } else { @@ -400,7 +400,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) } psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; - if (psecnetwork == NULL) { + if (!psecnetwork) { kfree(pcmd); res = _FAIL; @@ -1214,7 +1214,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->MacAddress); if (!psta) { psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress); - if (psta == NULL) { + if (!psta) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nCan't alloc sta_info when createbss_cmd_callback\n")); goto createbss_cmd_fail; } @@ -1224,9 +1224,9 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) } else { pwlan = _rtw_alloc_network(pmlmepriv); spin_lock_bh(&pmlmepriv->scanned_queue.lock); - if (pwlan == NULL) { + if (!pwlan) { pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue); - if (pwlan == NULL) { + if (!pwlan) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n Error: can't get pwlan in rtw_joinbss_event_callback\n")); spin_unlock_bh(&pmlmepriv->scanned_queue.lock); goto createbss_cmd_fail; @@ -1263,7 +1263,7 @@ void rtw_setstaKey_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pc struct set_stakey_rsp *psetstakey_rsp = (struct set_stakey_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr); - if (psta == NULL) { + if (!psta) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: %s => can't get sta_info\n\n", __func__)); goto exit; } @@ -1279,7 +1279,7 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj * struct set_assocsta_rsp *passocsta_rsp = (struct set_assocsta_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr); - if (psta == NULL) { + if (!psta) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: %s => can't get sta_info\n\n", __func__)); goto exit; } -- cgit v1.2.3-55-g7522 From d3de2bb882544798eae3958cfb458b1fe001988b Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:11 +0200 Subject: staging: vchiq_core: Use return value of mutex_lock_killable directly Instead of saving the return value of mutex_lock_killable in a local variable we could use the value directly. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 4f9e738abddf..6b24651e9eea 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1376,7 +1376,6 @@ resolve_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue) { VCHIQ_STATE_T *state = service->state; int resolved = 0; - int rc; while ((queue->process != queue->local_insert) && (queue->process != queue->remote_insert)) { @@ -1392,8 +1391,7 @@ resolve_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue) WARN_ON(!((int)(queue->local_insert - queue->process) > 0)); WARN_ON(!((int)(queue->remote_insert - queue->process) > 0)); - rc = mutex_lock_killable(&state->bulk_transfer_mutex); - if (rc != 0) + if (mutex_lock_killable(&state->bulk_transfer_mutex)) break; vchiq_transfer_bulk(bulk); -- cgit v1.2.3-55-g7522 From 158ef80a8741e55c0214c174509b42bc5de6c7e1 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:12 +0200 Subject: staging: vchiq_2835_arm: Reduce scope of i in free_pagelist We can reduce the scope of the counting variable i. This has been found by CppCheck. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index d04db3f55519..9105545a3656 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -577,7 +577,6 @@ static void free_pagelist(struct vchiq_pagelist_info *pagelistinfo, int actual) { - unsigned int i; PAGELIST_T *pagelist = pagelistinfo->pagelist; struct page **pages = pagelistinfo->pages; unsigned int num_pages = pagelistinfo->num_pages; @@ -633,6 +632,8 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo, /* Need to mark all the pages dirty. */ if (pagelist->type != PAGELIST_WRITE && pagelistinfo->pages_need_release) { + unsigned int i; + for (i = 0; i < num_pages; i++) set_page_dirty(pages[i]); } -- cgit v1.2.3-55-g7522 From 76262b2951948d03c85dd2659cfa2e0dc8584ef8 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:13 +0200 Subject: staging: vchiq_2835_arm: Remove unnecessary assignment to slot_mem_size The variable slot_mem_size is assigned a value which is never used. This issue has been found by CppCheck. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 9105545a3656..9406d1c6e948 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -153,7 +153,6 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) MAX_FRAGMENTS; g_fragments_base = (char *)slot_mem + slot_mem_size; - slot_mem_size += frag_mem_size; g_free_fragments = g_fragments_base; for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { -- cgit v1.2.3-55-g7522 From 42a6bd8f77be378d7b014248d559a1624705646d Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:14 +0200 Subject: staging: vchiq_arm: Fix variable names in comment This comment was apparently forgotten in the correction of CamelCase. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index e823f1d5d177..49d1ee29d2d4 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -2070,7 +2070,7 @@ dump_phys_mem(void *virt_addr, u32 num_bytes) struct page **pages; u8 *kmapped_virt_ptr; - /* Align virtAddr and endVirtAddr to 16 byte boundaries. */ + /* Align virt_addr and end_virt_addr to 16 byte boundaries. */ virt_addr = (void *)((unsigned long)virt_addr & ~0x0fuL); end_virt_addr = (void *)(((unsigned long)end_virt_addr + 15uL) & -- cgit v1.2.3-55-g7522 From b322396ce804e29804ee84ce17b94baf26fda169 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:15 +0200 Subject: staging: vchiq_arm: Avoid multiline dereference Reduce the indentation within vchiq_dump_service_use_state in order to avoid a multiline derefernce. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 49d1ee29d2d4..030bec855d86 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -3276,12 +3276,12 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state) if (only_nonzero && !service_ptr->service_use_count) continue; - if (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE) { - service_data[j].fourcc = service_ptr->base.fourcc; - service_data[j].clientid = service_ptr->client_id; - service_data[j++].use_count = service_ptr-> - service_use_count; - } + if (service_ptr->srvstate == VCHIQ_SRVSTATE_FREE) + continue; + + service_data[j].fourcc = service_ptr->base.fourcc; + service_data[j].clientid = service_ptr->client_id; + service_data[j++].use_count = service_ptr->service_use_count; } read_unlock_bh(&arm_state->susp_res_lock); -- cgit v1.2.3-55-g7522 From 804980adb9791e8b2449250c2a82d200a603835c Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:16 +0200 Subject: staging: vchiq_2835_arm: Fix function name cleaup_pagelistinfo Assuming the intension of the function is to clean up, so fix the function name accordingly. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 9406d1c6e948..8911e86a2cce 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -364,7 +364,7 @@ vchiq_doorbell_irq(int irq, void *dev_id) } static void -cleaup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo) +cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo) { if (pagelistinfo->scatterlist_mapped) { dma_unmap_sg(g_dev, pagelistinfo->scatterlist, @@ -488,7 +488,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, actual_pages--; put_page(pages[actual_pages]); } - cleaup_pagelistinfo(pagelistinfo); + cleanup_pagelistinfo(pagelistinfo); return NULL; } /* release user pages */ @@ -517,7 +517,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, pagelistinfo->dma_dir); if (dma_buffers == 0) { - cleaup_pagelistinfo(pagelistinfo); + cleanup_pagelistinfo(pagelistinfo); return NULL; } @@ -554,7 +554,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, char *fragments; if (down_interruptible(&g_free_fragments_sema) != 0) { - cleaup_pagelistinfo(pagelistinfo); + cleanup_pagelistinfo(pagelistinfo); return NULL; } @@ -637,5 +637,5 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo, set_page_dirty(pages[i]); } - cleaup_pagelistinfo(pagelistinfo); + cleanup_pagelistinfo(pagelistinfo); } -- cgit v1.2.3-55-g7522 From 025f69ade93952e9415ea5c5f48d729b03e04dfc Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:17 +0200 Subject: staging: vchiq_2835_arm: Handle vmalloc_to_page error case In case vmalloc_to_page returns NULL create_pagelist must abort imediatly. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 8911e86a2cce..eeeee1bf68b7 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -459,6 +459,11 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, PAGE_SIZE)); size_t bytes = PAGE_SIZE - off; + if (!pg) { + cleanup_pagelistinfo(pagelistinfo); + return NULL; + } + if (bytes > length) bytes = length; pages[actual_pages] = pg; -- cgit v1.2.3-55-g7522 From 244156ca90dceaec2bda8f9b664489d23a5b451f Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:18 +0200 Subject: staging: vchiq_2835_arm: Use PAGE_MASK macro Use the PAGE_MASK instead of open code it. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index eeeee1bf68b7..0159ca4407d8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -474,7 +474,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, } else { down_read(&task->mm->mmap_sem); actual_pages = get_user_pages( - (unsigned long)buf & ~(PAGE_SIZE - 1), + (unsigned long)buf & PAGE_MASK, num_pages, (type == PAGELIST_READ) ? FOLL_WRITE : 0, pages, -- cgit v1.2.3-55-g7522 From 7c35c6af0cd6896f6e293cf617a5e27116735e5b Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:19 +0200 Subject: staging: vchiq_core: Simplify VCHIQ init Since the ARM side of VCHIQ support only 1 state, we could simplify the init code. This makes it possible to avoid BUG_ON and a theoretical overflow of id. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 6b24651e9eea..c47de9692c8c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2349,7 +2349,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, VCHIQ_SHARED_STATE_T *remote; VCHIQ_STATUS_T status; char threadname[16]; - static int id; int i; vchiq_log_warning(vchiq_core_log_level, @@ -2437,7 +2436,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, memset(state, 0, sizeof(VCHIQ_STATE_T)); - state->id = id++; state->is_master = is_master; /* @@ -2556,8 +2554,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, set_user_nice(state->sync_thread, -20); wake_up_process(state->sync_thread); - BUG_ON(state->id >= VCHIQ_MAX_STATES); - vchiq_states[state->id] = state; + vchiq_states[0] = state; /* Indicate readiness to the other side */ local->initialised = 1; -- cgit v1.2.3-55-g7522 From 359afaccd97e6257bcda29efa4e83375d9a2cc34 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:20 +0200 Subject: staging: vchiq_core: Bailout if VCHIQ state is already initialized In case VCHIQ state is already initialized we need to bailout in order to aovid a memory leak. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index c47de9692c8c..0a46e1525d8c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2355,6 +2355,11 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, "%s: slot_zero = %pK, is_master = %d", __func__, slot_zero, is_master); + if (vchiq_states[0]) { + pr_err("%s: VCHIQ state already initialized\n", __func__); + return VCHIQ_ERROR; + } + /* Check the input configuration */ if (slot_zero->magic != VCHIQ_MAGIC) { -- cgit v1.2.3-55-g7522 From 00b9d0f560a6a7b667dda056423b2e50b52e574c Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:21 +0200 Subject: staging: vchiq_core: Don't BUG if sending RESUME fails VCHIQ suspend and resume isn't implemented, but even it was there is no need to call BUG(). Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 0a46e1525d8c..d40366c32f89 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2137,7 +2137,6 @@ slot_handler_func(void *v) vchiq_log_error(vchiq_core_log_level, "Failed to send RESUME " "message"); - BUG(); } break; -- cgit v1.2.3-55-g7522 From 6b8db0bce33d75b1181e86e55305e1e320102440 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:22 +0200 Subject: staging: vchiq_core: Bail out if service is NULL In the unlikely case that service is NULL we should bail out instead of calling BUG_ON(). The other BUG_ON calls will be fixed in separate patches. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 38 ++++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index d40366c32f89..a84b4ef36abe 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -289,9 +289,11 @@ void lock_service(VCHIQ_SERVICE_T *service) { spin_lock(&service_spinlock); - BUG_ON(!service || (service->ref_count == 0)); - if (service) + WARN_ON(!service); + if (service) { + BUG_ON(service->ref_count == 0); service->ref_count++; + } spin_unlock(&service_spinlock); } @@ -299,17 +301,21 @@ void unlock_service(VCHIQ_SERVICE_T *service) { spin_lock(&service_spinlock); - BUG_ON(!service || (service->ref_count == 0)); - if (service && service->ref_count) { - service->ref_count--; - if (!service->ref_count) { - VCHIQ_STATE_T *state = service->state; - - BUG_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); - state->services[service->localport] = NULL; - } else - service = NULL; + if (!service) { + WARN(1, "%s: service is NULL\n", __func__); + goto unlock; } + BUG_ON(service->ref_count == 0); + service->ref_count--; + if (!service->ref_count) { + VCHIQ_STATE_T *state = service->state; + + BUG_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); + state->services[service->localport] = NULL; + } else { + service = NULL; + } +unlock: spin_unlock(&service_spinlock); if (service && service->userdata_term) @@ -822,7 +828,12 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, if (type == VCHIQ_MSG_DATA) { int tx_end_index; - BUG_ON(!service); + if (!service) { + WARN(1, "%s: service is NULL\n", __func__); + mutex_unlock(&state->slot_mutex); + return VCHIQ_ERROR; + } + BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | QMFLAGS_NO_MUTEX_UNLOCK)) != 0); @@ -923,7 +934,6 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); - BUG_ON(!service); BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | QMFLAGS_NO_MUTEX_UNLOCK)) != 0); -- cgit v1.2.3-55-g7522 From 5d1a94bb284c8d97b056e8025169609e78b7052f Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:23 +0200 Subject: staging: vchiq_core: Bail out if ref_count is unexpected If the ref counter of service has an unexpected value then we better bail out. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index a84b4ef36abe..9cdc98570a22 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -175,7 +175,7 @@ find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle) service = handle_to_service(handle); if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE) && (service->handle == handle)) { - BUG_ON(service->ref_count == 0); + WARN_ON(service->ref_count == 0); service->ref_count++; } else service = NULL; @@ -197,7 +197,7 @@ find_service_by_port(VCHIQ_STATE_T *state, int localport) spin_lock(&service_spinlock); service = state->services[localport]; if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE)) { - BUG_ON(service->ref_count == 0); + WARN_ON(service->ref_count == 0); service->ref_count++; } else service = NULL; @@ -221,7 +221,7 @@ find_service_for_instance(VCHIQ_INSTANCE_T instance, if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE) && (service->handle == handle) && (service->instance == instance)) { - BUG_ON(service->ref_count == 0); + WARN_ON(service->ref_count == 0); service->ref_count++; } else service = NULL; @@ -246,7 +246,7 @@ find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, (service->srvstate == VCHIQ_SRVSTATE_CLOSED)) && (service->handle == handle) && (service->instance == instance)) { - BUG_ON(service->ref_count == 0); + WARN_ON(service->ref_count == 0); service->ref_count++; } else service = NULL; @@ -273,7 +273,7 @@ next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, if (srv && (srv->srvstate != VCHIQ_SRVSTATE_FREE) && (srv->instance == instance)) { service = srv; - BUG_ON(service->ref_count == 0); + WARN_ON(service->ref_count == 0); service->ref_count++; break; } @@ -291,7 +291,7 @@ lock_service(VCHIQ_SERVICE_T *service) spin_lock(&service_spinlock); WARN_ON(!service); if (service) { - BUG_ON(service->ref_count == 0); + WARN_ON(service->ref_count == 0); service->ref_count++; } spin_unlock(&service_spinlock); @@ -305,7 +305,10 @@ unlock_service(VCHIQ_SERVICE_T *service) WARN(1, "%s: service is NULL\n", __func__); goto unlock; } - BUG_ON(service->ref_count == 0); + if (!service->ref_count) { + WARN(1, "%s: ref_count is zero\n", __func__); + goto unlock; + } service->ref_count--; if (!service->ref_count) { VCHIQ_STATE_T *state = service->state; -- cgit v1.2.3-55-g7522 From 6f2370d260c4dc6eba1de2b4f55786f99abf937c Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:24 +0200 Subject: staging: vchiq_core: Don't BUG if process is unexpected Bail out properly if the process index doesn't match the remote insert. We also drop the BUG in case the process index is at local insert, so we can trigger the WARN_ON again some steps later. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 9cdc98570a22..b0119b80b776 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1963,9 +1963,14 @@ parse_rx_slots(VCHIQ_STATE_T *state) mutex_unlock(&service->bulk_mutex); break; } - - BUG_ON(queue->process == queue->local_insert); - BUG_ON(queue->process != queue->remote_insert); + if (queue->process != queue->remote_insert) { + pr_err("%s: p %x != ri %x\n", + __func__, + queue->process, + queue->remote_insert); + mutex_unlock(&service->bulk_mutex); + goto bail_not_ready; + } bulk = &queue->bulks[ BULK_INDEX(queue->remote_insert)]; -- cgit v1.2.3-55-g7522 From d1eab9dec6108e68d43d869a3b6645cc1df3fa9d Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:25 +0200 Subject: staging: vchiq_core: Bail out in case of invalid tx_pos Properly handle the error case in case of an invalid tx_pos. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index b0119b80b776..c61f5ac18b93 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -600,8 +600,10 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking) return NULL; /* No space available */ } - BUG_ON(tx_pos == - (state->slot_queue_available * VCHIQ_SLOT_SIZE)); + if (tx_pos == (state->slot_queue_available * VCHIQ_SLOT_SIZE)) { + pr_warn("%s: invalid tx_pos: %d\n", __func__, tx_pos); + return NULL; + } slot_index = local->slot_queue[ SLOT_QUEUE_INDEX_FROM_POS(tx_pos) & -- cgit v1.2.3-55-g7522 From 57d14635f976404fac165047389ff0dbe83bcd5b Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 26 May 2017 00:26:26 +0200 Subject: staging: vchiq_core: Replace remaining BUG_ON with WARN_ON This replaces all remaining BUG_ON with WARN_ON. So in case of a VCHIQ bug the system is still usable. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index c61f5ac18b93..486be990d7fc 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -313,7 +313,7 @@ unlock_service(VCHIQ_SERVICE_T *service) if (!service->ref_count) { VCHIQ_STATE_T *state = service->state; - BUG_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); + WARN_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); state->services[service->localport] = NULL; } else { service = NULL; @@ -839,8 +839,8 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, return VCHIQ_ERROR; } - BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | - QMFLAGS_NO_MUTEX_UNLOCK)) != 0); + WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | + QMFLAGS_NO_MUTEX_UNLOCK)) != 0); if (service->closing) { /* The service has been closed */ @@ -939,8 +939,8 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); - BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | - QMFLAGS_NO_MUTEX_UNLOCK)) != 0); + WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | + QMFLAGS_NO_MUTEX_UNLOCK)) != 0); callback_result = copy_message_data(copy_callback, context, @@ -3204,7 +3204,7 @@ vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle) if (current == service->state->slot_handler_thread) { status = vchiq_close_service_internal(service, 0/*!close_recvd*/); - BUG_ON(status == VCHIQ_RETRY); + WARN_ON(status == VCHIQ_RETRY); } else { /* Mark the service for termination by the slot handler */ request_poll(service->state, service, VCHIQ_POLL_TERMINATE); @@ -3266,7 +3266,7 @@ vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle) status = vchiq_close_service_internal(service, 0/*!close_recvd*/); - BUG_ON(status == VCHIQ_RETRY); + WARN_ON(status == VCHIQ_RETRY); } else { /* Mark the service for removal by the slot handler */ request_poll(service->state, service, VCHIQ_POLL_REMOVE); -- cgit v1.2.3-55-g7522 From 4a78cc644eed3cf2dae00c3a959910a86c140fd6 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 26 May 2017 17:10:15 +0200 Subject: mtd: nand: Make sure drivers not supporting SET/GET_FEATURES return -ENOTSUPP A lot of drivers are providing their own ->cmdfunc(), and most of the time this implementation does not support all possible NAND operations. But since ->cmdfunc() cannot return an error code, the core has no way to know that the operation it requested is not supported. This is a problem we cannot address for all kind of operations with the current design, but we can prevent these silent failures for the GET/SET FEATURES operation by overloading the default ->onfi_{set,get}_features() methods with one returning -ENOTSUPP. Reported-by: Chris Packham Signed-off-by: Boris Brezillon Tested-by: Chris Packham --- drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | 2 ++ drivers/mtd/nand/cafe_nand.c | 2 ++ drivers/mtd/nand/denali.c | 2 ++ drivers/mtd/nand/docg4.c | 2 ++ drivers/mtd/nand/fsl_elbc_nand.c | 2 ++ drivers/mtd/nand/fsl_ifc_nand.c | 2 ++ drivers/mtd/nand/hisi504_nand.c | 2 ++ drivers/mtd/nand/mpc5121_nfc.c | 2 ++ drivers/mtd/nand/nand_base.c | 19 +++++++++++++++++++ drivers/mtd/nand/pxa3xx_nand.c | 2 ++ drivers/mtd/nand/qcom_nandc.c | 2 ++ drivers/mtd/nand/sh_flctl.c | 2 ++ drivers/mtd/nand/vf610_nfc.c | 2 ++ drivers/staging/mt29f_spinand/mt29f_spinand.c | 2 ++ include/linux/mtd/nand.h | 5 +++++ 15 files changed, 50 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c index f1da4ea88f2c..54bac5b73f0a 100644 --- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c +++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c @@ -392,6 +392,8 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n) b47n->nand_chip.read_byte = bcm47xxnflash_ops_bcm4706_read_byte; b47n->nand_chip.read_buf = bcm47xxnflash_ops_bcm4706_read_buf; b47n->nand_chip.write_buf = bcm47xxnflash_ops_bcm4706_write_buf; + b47n->nand_chip.onfi_set_features = nand_onfi_get_set_features_notsupp; + b47n->nand_chip.onfi_get_features = nand_onfi_get_set_features_notsupp; nand_chip->chip_delay = 50; b47n->nand_chip.bbt_options = NAND_BBT_USE_FLASH; diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c index d40c32d311d8..2fd733eba0a3 100644 --- a/drivers/mtd/nand/cafe_nand.c +++ b/drivers/mtd/nand/cafe_nand.c @@ -654,6 +654,8 @@ static int cafe_nand_probe(struct pci_dev *pdev, cafe->nand.read_buf = cafe_read_buf; cafe->nand.write_buf = cafe_write_buf; cafe->nand.select_chip = cafe_select_chip; + cafe->nand.onfi_set_features = nand_onfi_get_set_features_notsupp; + cafe->nand.onfi_get_features = nand_onfi_get_set_features_notsupp; cafe->nand.chip_delay = 0; diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 16634df2e39a..b3c99d98fdee 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1531,6 +1531,8 @@ int denali_init(struct denali_nand_info *denali) chip->cmdfunc = denali_cmdfunc; chip->read_byte = denali_read_byte; chip->waitfunc = denali_waitfunc; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; /* * scan for NAND devices attached to the controller diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c index 7af2a3cd949e..a27a84fbfb84 100644 --- a/drivers/mtd/nand/docg4.c +++ b/drivers/mtd/nand/docg4.c @@ -1260,6 +1260,8 @@ static void __init init_mtd_structs(struct mtd_info *mtd) nand->read_buf = docg4_read_buf; nand->write_buf = docg4_write_buf16; nand->erase = docg4_erase_block; + nand->onfi_set_features = nand_onfi_get_set_features_notsupp; + nand->onfi_get_features = nand_onfi_get_set_features_notsupp; nand->ecc.read_page = docg4_read_page; nand->ecc.write_page = docg4_write_page; nand->ecc.read_page_raw = docg4_read_page_raw; diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 113f76e59937..b9ac16f05057 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c @@ -775,6 +775,8 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv) chip->select_chip = fsl_elbc_select_chip; chip->cmdfunc = fsl_elbc_cmdfunc; chip->waitfunc = fsl_elbc_wait; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->bbt_td = &bbt_main_descr; chip->bbt_md = &bbt_mirror_descr; diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c index d1570f512f0b..89e14daeaba6 100644 --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c @@ -831,6 +831,8 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv) chip->select_chip = fsl_ifc_select_chip; chip->cmdfunc = fsl_ifc_cmdfunc; chip->waitfunc = fsl_ifc_wait; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->bbt_td = &bbt_main_descr; chip->bbt_md = &bbt_mirror_descr; diff --git a/drivers/mtd/nand/hisi504_nand.c b/drivers/mtd/nand/hisi504_nand.c index e40364eeb556..530caa80b1b6 100644 --- a/drivers/mtd/nand/hisi504_nand.c +++ b/drivers/mtd/nand/hisi504_nand.c @@ -764,6 +764,8 @@ static int hisi_nfc_probe(struct platform_device *pdev) chip->write_buf = hisi_nfc_write_buf; chip->read_buf = hisi_nfc_read_buf; chip->chip_delay = HINFC504_CHIP_DELAY; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; hisi_nfc_host_init(host); diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c index 6d6eaed2d20c..0e86fb6277c3 100644 --- a/drivers/mtd/nand/mpc5121_nfc.c +++ b/drivers/mtd/nand/mpc5121_nfc.c @@ -708,6 +708,8 @@ static int mpc5121_nfc_probe(struct platform_device *op) chip->read_buf = mpc5121_nfc_read_buf; chip->write_buf = mpc5121_nfc_write_buf; chip->select_chip = mpc5121_nfc_select_chip; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->bbt_options = NAND_BBT_USE_FLASH; chip->ecc.mode = NAND_ECC_SOFT; chip->ecc.algo = NAND_ECC_HAMMING; diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 0b3b1a88091a..ed08e3946727 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -3420,6 +3420,25 @@ static int nand_onfi_get_features(struct mtd_info *mtd, struct nand_chip *chip, return 0; } +/** + * nand_onfi_get_set_features_notsupp - set/get features stub returning + * -ENOTSUPP + * @mtd: MTD device structure + * @chip: nand chip info structure + * @addr: feature address. + * @subfeature_param: the subfeature parameters, a four bytes array. + * + * Should be used by NAND controller drivers that do not support the SET/GET + * FEATURES operations. + */ +int nand_onfi_get_set_features_notsupp(struct mtd_info *mtd, + struct nand_chip *chip, int addr, + u8 *subfeature_param) +{ + return -ENOTSUPP; +} +EXPORT_SYMBOL(nand_onfi_get_set_features_notsupp); + /** * nand_suspend - [MTD Interface] Suspend the NAND flash * @mtd: MTD device structure diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 649ba8200832..74dae4bbdac8 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -1812,6 +1812,8 @@ static int alloc_nand_resource(struct platform_device *pdev) chip->write_buf = pxa3xx_nand_write_buf; chip->options |= NAND_NO_SUBPAGE_WRITE; chip->cmdfunc = nand_cmdfunc; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; } nand_hw_control_init(chip->controller); diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c index 57d483ac5765..88af7145a51a 100644 --- a/drivers/mtd/nand/qcom_nandc.c +++ b/drivers/mtd/nand/qcom_nandc.c @@ -2008,6 +2008,8 @@ static int qcom_nand_host_init(struct qcom_nand_controller *nandc, chip->read_byte = qcom_nandc_read_byte; chip->read_buf = qcom_nandc_read_buf; chip->write_buf = qcom_nandc_write_buf; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; /* * the bad block marker is readable only when we read the last codeword diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c index 442ce619b3b6..891ac7b99305 100644 --- a/drivers/mtd/nand/sh_flctl.c +++ b/drivers/mtd/nand/sh_flctl.c @@ -1183,6 +1183,8 @@ static int flctl_probe(struct platform_device *pdev) nand->read_buf = flctl_read_buf; nand->select_chip = flctl_select_chip; nand->cmdfunc = flctl_cmdfunc; + nand->onfi_set_features = nand_onfi_get_set_features_notsupp; + nand->onfi_get_features = nand_onfi_get_set_features_notsupp; if (pdata->flcmncr_val & SEL_16BIT) nand->options |= NAND_BUSWIDTH_16; diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c index 3ea4bb19e12d..744ab10e8962 100644 --- a/drivers/mtd/nand/vf610_nfc.c +++ b/drivers/mtd/nand/vf610_nfc.c @@ -703,6 +703,8 @@ static int vf610_nfc_probe(struct platform_device *pdev) chip->read_buf = vf610_nfc_read_buf; chip->write_buf = vf610_nfc_write_buf; chip->select_chip = vf610_nfc_select_chip; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->options |= NAND_NO_SUBPAGE_WRITE; diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c index e389009fca42..a4e3ae8f0c85 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c @@ -915,6 +915,8 @@ static int spinand_probe(struct spi_device *spi_nand) chip->waitfunc = spinand_wait; chip->options |= NAND_CACHEPRG; chip->select_chip = spinand_select_chip; + chip->onfi_set_features = nand_onfi_get_set_features_notsupp; + chip->onfi_get_features = nand_onfi_get_set_features_notsupp; mtd = nand_to_mtd(chip); diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 7a01d2eb7443..28f7dd9177e9 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -1259,6 +1259,11 @@ int nand_read_oob_std(struct mtd_info *mtd, struct nand_chip *chip, int page); int nand_read_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip, int page); +/* Stub used by drivers that do not support GET/SET FEATURES operations */ +int nand_onfi_get_set_features_notsupp(struct mtd_info *mtd, + struct nand_chip *chip, int addr, + u8 *subfeature_param); + /* Default read_page_raw implementation */ int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, uint8_t *buf, int oob_required, int page); -- cgit v1.2.3-55-g7522 From 93e7ea8ca0ba8959ccd8e7555fe2c3cb3a2530e5 Mon Sep 17 00:00:00 2001 From: Konrad Malkowski Date: Thu, 25 May 2017 23:01:20 -0400 Subject: staging: lustre: Replace printk_ratelimited with pr_warn_ratelimited This patch fixes the checkpoint.pl warning: WARNING: Prefer printk_ratelimited or pr__ratelimited to printk_ratelimit Signed-off-by: Konrad Malkowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/libcfs/tracefile.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c index 9599b7441feb..a0efea4be08d 100644 --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c @@ -191,10 +191,9 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len) } else { tage = cfs_tage_alloc(GFP_ATOMIC); if (unlikely(!tage)) { - if ((!memory_pressure_get() || - in_interrupt()) && printk_ratelimit()) - pr_warn("cannot allocate a tage (%ld)\n", - tcd->tcd_cur_pages); + if (!memory_pressure_get() || in_interrupt()) + pr_warn_ratelimited("cannot allocate a tage (%ld)\n", + tcd->tcd_cur_pages); return NULL; } } @@ -229,9 +228,8 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd) * from here: this will lead to infinite recursion. */ - if (printk_ratelimit()) - pr_warn("debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n", - pgcount + 1, tcd->tcd_cur_pages); + pr_warn_ratelimited("debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n", + pgcount + 1, tcd->tcd_cur_pages); INIT_LIST_HEAD(&pc.pc_pages); -- cgit v1.2.3-55-g7522 From 8b23093269c84b0da1201e1949c91d0beb9892ef Mon Sep 17 00:00:00 2001 From: Mathias Rav Date: Thu, 18 May 2017 22:49:21 -0400 Subject: staging: lustre: Use kstrtouint_from_user in ldlm_rw_uint Clean up the helper functions used to implement "dump_granted_max" in debugfs. Replace the lprocfs_rd_uint() and lprocfs_wr_uint() generic callbacks with a simpler, more direct implementation of ldlm_rw_uint_fops. There's a slight change in lustre debugfs write semantics: Using kstrtox causes EINVAL when the written number is followed by other (garbage) characters, whereas previously the garbage would be ignored and such a write would succeed. Signed-off-by: Mathias Rav Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 20 ++++++++++++- .../lustre/lustre/obdclass/lprocfs_status.c | 34 ---------------------- 2 files changed, 19 insertions(+), 35 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 633f65b078eb..1c8b0ea10c32 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -78,7 +78,25 @@ lprocfs_wr_dump_ns(struct file *file, const char __user *buffer, LPROC_SEQ_FOPS_WR_ONLY(ldlm, dump_ns); -LPROC_SEQ_FOPS_RW_TYPE(ldlm_rw, uint); +static int ldlm_rw_uint_seq_show(struct seq_file *m, void *v) +{ + seq_printf(m, "%u\n", *(unsigned int *)m->private); + return 0; +} + +static ssize_t +ldlm_rw_uint_seq_write(struct file *file, const char __user *buffer, + size_t count, loff_t *off) +{ + struct seq_file *seq = file->private_data; + + if (count == 0) + return 0; + return kstrtouint_from_user(buffer, count, 0, + (unsigned int *)seq->private); +} + +LPROC_SEQ_FOPS(ldlm_rw_uint); static struct lprocfs_vars ldlm_debugfs_list[] = { { "dump_namespaces", &ldlm_dump_ns_fops, NULL, 0222 }, diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 1ec6e3767d81..b42c4092bf22 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -389,40 +389,6 @@ out: EXPORT_SYMBOL_GPL(ldebugfs_register); /* Generic callbacks */ -int lprocfs_rd_uint(struct seq_file *m, void *data) -{ - seq_printf(m, "%u\n", *(unsigned int *)data); - return 0; -} -EXPORT_SYMBOL(lprocfs_rd_uint); - -int lprocfs_wr_uint(struct file *file, const char __user *buffer, - unsigned long count, void *data) -{ - unsigned *p = data; - char dummy[MAX_STRING_SIZE + 1], *end; - unsigned long tmp; - - if (count >= sizeof(dummy)) - return -EINVAL; - - if (count == 0) - return 0; - - if (copy_from_user(dummy, buffer, count)) - return -EFAULT; - - dummy[count] = '\0'; - - tmp = simple_strtoul(dummy, &end, 0); - if (dummy == end) - return -EINVAL; - - *p = (unsigned int)tmp; - return count; -} -EXPORT_SYMBOL(lprocfs_wr_uint); - static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr, char *buf) { -- cgit v1.2.3-55-g7522 From 82a52f8ee02bfbecc45bcc0b72daafb39304064b Mon Sep 17 00:00:00 2001 From: Mathias Rav Date: Thu, 18 May 2017 22:49:22 -0400 Subject: staging: lustre: lprocfs: Use seq_puts instead of seq_printf Reported by checkpatch.pl: "WARNING: Prefer seq_puts to seq_printf". Signed-off-by: Mathias Rav Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/obdclass/lprocfs_status.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index b42c4092bf22..6d1caed02733 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -702,7 +702,7 @@ static int obd_import_flags2str(struct obd_import *imp, struct seq_file *m) bool first = true; if (imp->imp_obd->obd_no_recov) { - seq_printf(m, "no_recov"); + seq_puts(m, "no_recov"); first = false; } @@ -768,15 +768,15 @@ int lprocfs_rd_import(struct seq_file *m, void *data) imp->imp_connect_data.ocd_instance); obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags, ", "); - seq_printf(m, " ]\n"); + seq_puts(m, " ]\n"); obd_connect_data_seqprint(m, ocd); - seq_printf(m, " import_flags: [ "); + seq_puts(m, " import_flags: [ "); obd_import_flags2str(imp, m); - seq_printf(m, - " ]\n" - " connection:\n" - " failover_nids: [ "); + seq_puts(m, + " ]\n" + " connection:\n" + " failover_nids: [ "); spin_lock(&imp->imp_lock); j = 0; list_for_each_entry(conn, &imp->imp_conn_list, oic_item) { @@ -909,7 +909,7 @@ int lprocfs_rd_state(struct seq_file *m, void *data) seq_printf(m, "current_state: %s\n", ptlrpc_import_state_name(imp->imp_state)); - seq_printf(m, "state_history:\n"); + seq_puts(m, "state_history:\n"); k = imp->imp_state_hist_idx; for (j = 0; j < IMP_STATE_HIST_LEN; j++) { struct import_state_hist *ish = @@ -931,7 +931,7 @@ int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at) for (i = 0; i < AT_BINS; i++) seq_printf(m, "%3u ", at->at_hist[i]); - seq_printf(m, "\n"); + seq_puts(m, "\n"); return 0; } EXPORT_SYMBOL(lprocfs_at_hist_helper); @@ -999,7 +999,7 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data) flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags; seq_printf(m, "flags=%#llx\n", flags); obd_connect_seq_flags2str(m, flags, "\n"); - seq_printf(m, "\n"); + seq_puts(m, "\n"); up_read(&obd->u.cli.cl_sem); return 0; } -- cgit v1.2.3-55-g7522 From 135e55f1d712fc4f92302aa9daa6304a51963678 Mon Sep 17 00:00:00 2001 From: Valentin Vidic Date: Fri, 5 May 2017 07:27:41 +0200 Subject: staging: lustre: cleanup le32 assignment to ldp_flags Introduces a local var to collect flags and convert them to le32. Fixes the following sparse warnings: drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: warning: invalid assignment: |= drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: left side has type restricted __le32 drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: right side has type int drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: warning: invalid assignment: |= drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: left side has type restricted __le32 drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: right side has type int Signed-off-by: Valentin Vidic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index aaff986f9287..b222dfa11a10 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2274,6 +2274,7 @@ static int lmv_read_striped_page(struct obd_export *exp, struct lu_fid master_fid = op_data->op_fid1; struct obd_device *obd = exp->exp_obd; __u64 hash_offset = offset; + __u32 ldp_flags; struct page *min_ent_page = NULL; struct page *ent_page = NULL; struct lu_dirent *min_ent = NULL; @@ -2301,7 +2302,7 @@ static int lmv_read_striped_page(struct obd_export *exp, dp = kmap(ent_page); memset(dp, 0, sizeof(*dp)); dp->ldp_hash_start = cpu_to_le64(offset); - dp->ldp_flags |= LDF_COLLIDE; + ldp_flags = LDF_COLLIDE; area = dp + 1; left_bytes = PAGE_SIZE - sizeof(*dp); @@ -2379,8 +2380,8 @@ out: ent_page = NULL; } else { if (ent == area) - dp->ldp_flags |= LDF_EMPTY; - dp->ldp_flags = cpu_to_le32(dp->ldp_flags); + ldp_flags |= LDF_EMPTY; + dp->ldp_flags |= cpu_to_le32(ldp_flags); dp->ldp_hash_end = cpu_to_le64(hash_offset); } -- cgit v1.2.3-55-g7522 From 78c486189dde9affd39a2a8b9d27ee32cea4a04e Mon Sep 17 00:00:00 2001 From: Nikola Jelic Date: Fri, 19 May 2017 20:48:07 +0200 Subject: lustre: ko2iblnd: removed forced u32 casts after htonl sockaddr_in.sin_addr.s_addr is __be32 integral type, so the (__force u32) cast after the htonl call is unnecessary, and also detected by sparse: drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:2309:33: warning: incorrect type in assignment (different base types) drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:2381:30: warning: incorrect type in assignment (different base types) Signed-off-by: Nikola Jelic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 79321e4aaf30..0520f02f670d 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2306,7 +2306,7 @@ static int kiblnd_dev_need_failover(struct kib_dev *dev) memset(&srcaddr, 0, sizeof(srcaddr)); srcaddr.sin_family = AF_INET; - srcaddr.sin_addr.s_addr = (__force u32)htonl(dev->ibd_ifip); + srcaddr.sin_addr.s_addr = htonl(dev->ibd_ifip); memset(&dstaddr, 0, sizeof(dstaddr)); dstaddr.sin_family = AF_INET; @@ -2378,7 +2378,7 @@ int kiblnd_dev_failover(struct kib_dev *dev) memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; - addr.sin_addr.s_addr = (__force u32)htonl(dev->ibd_ifip); + addr.sin_addr.s_addr = htonl(dev->ibd_ifip); addr.sin_port = htons(*kiblnd_tunables.kib_service); /* Bind to failover device or port */ -- cgit v1.2.3-55-g7522 From e4e5f9c6c7fc76daa8f6118ce2c4f822b366ed21 Mon Sep 17 00:00:00 2001 From: Nikola Jelic Date: Sat, 27 May 2017 23:37:28 +0200 Subject: staging: lustre: changed __u32 to __be32 Temporary variable is used only as __be32, for both assignments and reads, but the type is inconsistent (__u32). Signed-off-by: Nikola Jelic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 9fca8d225ee0..776f3c2fa486 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -89,7 +89,7 @@ lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask) struct ifreq ifr; int nob; int rc; - __u32 val; + __be32 val; nob = strnlen(name, IFNAMSIZ); if (nob == IFNAMSIZ) { -- cgit v1.2.3-55-g7522 From d0b112ac2ae3738a9f1a86f97dc5fbd23be7e123 Mon Sep 17 00:00:00 2001 From: Nikola Jelic Date: Sun, 28 May 2017 00:14:11 +0200 Subject: staging: lustre: in-place endianness functions lib-move.c file has a lot of expressions in the form of: v = le[32|64]_to_cpu(v); This caused a lot of sparse warnings. Replaced with: le[32|64]_to_cpus(&v); Signed-off-by: Nikola Jelic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/lib-move.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index a99c5c0aa672..20ebe247071f 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -1274,9 +1274,9 @@ lnet_parse_put(struct lnet_ni *ni, struct lnet_msg *msg) int rc; /* Convert put fields to host byte order */ - hdr->msg.put.match_bits = le64_to_cpu(hdr->msg.put.match_bits); - hdr->msg.put.ptl_index = le32_to_cpu(hdr->msg.put.ptl_index); - hdr->msg.put.offset = le32_to_cpu(hdr->msg.put.offset); + le64_to_cpus(&hdr->msg.put.match_bits); + le32_to_cpus(&hdr->msg.put.ptl_index); + le32_to_cpus(&hdr->msg.put.offset); info.mi_id.nid = hdr->src_nid; info.mi_id.pid = hdr->src_pid; @@ -1332,10 +1332,10 @@ lnet_parse_get(struct lnet_ni *ni, struct lnet_msg *msg, int rdma_get) int rc; /* Convert get fields to host byte order */ - hdr->msg.get.match_bits = le64_to_cpu(hdr->msg.get.match_bits); - hdr->msg.get.ptl_index = le32_to_cpu(hdr->msg.get.ptl_index); - hdr->msg.get.sink_length = le32_to_cpu(hdr->msg.get.sink_length); - hdr->msg.get.src_offset = le32_to_cpu(hdr->msg.get.src_offset); + le64_to_cpus(&hdr->msg.get.match_bits); + le32_to_cpus(&hdr->msg.get.ptl_index); + le32_to_cpus(&hdr->msg.get.sink_length); + le32_to_cpus(&hdr->msg.get.src_offset); info.mi_id.nid = hdr->src_nid; info.mi_id.pid = hdr->src_pid; @@ -1464,8 +1464,8 @@ lnet_parse_ack(struct lnet_ni *ni, struct lnet_msg *msg) src.pid = hdr->src_pid; /* Convert ack fields to host byte order */ - hdr->msg.ack.match_bits = le64_to_cpu(hdr->msg.ack.match_bits); - hdr->msg.ack.mlength = le32_to_cpu(hdr->msg.ack.mlength); + le64_to_cpus(&hdr->msg.ack.match_bits); + le32_to_cpus(&hdr->msg.ack.mlength); cpt = lnet_cpt_of_cookie(hdr->msg.ack.dst_wmd.wh_object_cookie); lnet_res_lock(cpt); @@ -1798,7 +1798,7 @@ lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid, /* convert common msg->hdr fields to host byteorder */ msg->msg_hdr.type = type; msg->msg_hdr.src_nid = src_nid; - msg->msg_hdr.src_pid = le32_to_cpu(msg->msg_hdr.src_pid); + le32_to_cpus(&msg->msg_hdr.src_pid); msg->msg_hdr.dest_nid = dest_nid; msg->msg_hdr.dest_pid = dest_pid; msg->msg_hdr.payload_length = payload_length; -- cgit v1.2.3-55-g7522 From 011cca558b6256ff14464e61c111707415a0484f Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Wed, 31 May 2017 20:50:12 +0100 Subject: staging: speakup: check for null before calling TTY's flush_buffer We should check the flush_buffer method of a tty for null before invoking it. Some drivers such as usbserial don't implement flush_buffer. This will be required for upcoming patches where we expand spk_ttyio to support more than just ttyS*. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_ttyio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index ed36240cf382..7b1eaf976f52 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -227,7 +227,8 @@ static unsigned char spk_ttyio_in_nowait(void) static void spk_ttyio_flush_buffer(void) { - speakup_tty->ops->flush_buffer(speakup_tty); + if (speakup_tty->ops->flush_buffer) + speakup_tty->ops->flush_buffer(speakup_tty); } int spk_ttyio_synth_probe(struct spk_synth *synth) -- cgit v1.2.3-55-g7522 From 349190d56be6eccb940df18831d8654b19a697aa Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Thu, 1 Jun 2017 14:15:29 +0100 Subject: staging: speakup: remove unused code In spk_ttyio_release we read tty's index but never do anything with it. The patch removes this dead code. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_ttyio.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 7b1eaf976f52..d55c056bbefe 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -247,13 +247,10 @@ EXPORT_SYMBOL_GPL(spk_ttyio_synth_probe); void spk_ttyio_release(void) { - int idx; - if (!speakup_tty) return; tty_lock(speakup_tty); - idx = speakup_tty->index; if (speakup_tty->ops->close) speakup_tty->ops->close(speakup_tty, NULL); -- cgit v1.2.3-55-g7522 From f7a320ffebe2bdce3a189ecb531a401c653f754f Mon Sep 17 00:00:00 2001 From: Gleb Fotengauer-Malinovskiy Date: Tue, 30 May 2017 17:11:35 +0300 Subject: staging: android: uapi: drop definitions of removed ION_IOC_{FREE,SHARE} ioctls This problem was found by strace ioctl list generator. Fixes: 15c6098cfec5 ("staging: android: ion: Remove ion_handle and ion_client") Signed-off-by: Gleb Fotengauer-Malinovskiy Acked-by: Laura Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/uapi/ion.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h index d415589757e7..9e21451149d0 100644 --- a/drivers/staging/android/uapi/ion.h +++ b/drivers/staging/android/uapi/ion.h @@ -124,24 +124,6 @@ struct ion_heap_query { #define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ struct ion_allocation_data) -/** - * DOC: ION_IOC_FREE - free memory - * - * Takes an ion_handle_data struct and frees the handle. - */ -#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) - -/** - * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation - * - * Takes an ion_fd_data struct with the handle field populated with a valid - * opaque handle. Returns the struct with the fd field set to a file - * descriptor open in the current address space. This file descriptor - * can then be passed to another process. The corresponding opaque handle can - * be retrieved via ION_IOC_IMPORT. - */ -#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data) - /** * DOC: ION_IOC_HEAP_QUERY - information about available heaps * -- cgit v1.2.3-55-g7522 From 9f5c6b7258619e5f486430c90bfae028a1ca963b Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 29 May 2017 20:31:45 +0200 Subject: Staging: gdm724x: Change spaces to tabs This patch fixes the following checkpatch.pl warning in gdm_usb.c: WARNING: suspect code indent for conditional statements (8, 12) Signed-off-by: Mart Lubbers Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c index 15a7e81ec2d2..87cd1f827455 100644 --- a/drivers/staging/gdm724x/gdm_usb.c +++ b/drivers/staging/gdm724x/gdm_usb.c @@ -738,11 +738,11 @@ static int gdm_usb_sdu_send(void *priv_dev, void *data, int len, sdu->cmd_evt = gdm_cpu_to_dev16(&udev->gdm_ed, LTE_TX_SDU); if (nic_type == NIC_TYPE_ARP) { send_len = len + SDU_PARAM_LEN; - memcpy(sdu->data, data, len); + memcpy(sdu->data, data, len); } else { - send_len = len - ETH_HLEN; - send_len += SDU_PARAM_LEN; - memcpy(sdu->data, data + ETH_HLEN, len - ETH_HLEN); + send_len = len - ETH_HLEN; + send_len += SDU_PARAM_LEN; + memcpy(sdu->data, data + ETH_HLEN, len - ETH_HLEN); } sdu->len = gdm_cpu_to_dev16(&udev->gdm_ed, send_len); -- cgit v1.2.3-55-g7522 From f9f28369a792384fda648614fff9c03ad1b4833d Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Thu, 1 Jun 2017 14:02:51 +0300 Subject: staging: ccree: remove spurious blank lines Remove spurious blanks lines from cc_crypto_ctx.h file Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 2fabb5ca3f41..e9023bd6507c 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -14,7 +14,6 @@ * along with this program; if not, see . */ - #ifndef _CC_CRYPTO_CTX_H_ #define _CC_CRYPTO_CTX_H_ @@ -91,10 +90,8 @@ #define CC_MULTI2_MIN_NUM_ROUNDS 8 #define CC_MULTI2_MAX_NUM_ROUNDS 128 - #define CC_DRV_ALG_MAX_BLOCK_SIZE CC_HASH_BLOCK_SIZE_MAX - enum drv_engine_type { DRV_ENGINE_NULL = 0, DRV_ENGINE_AES = 1, @@ -178,7 +175,6 @@ enum drv_multi2_mode { DRV_MULTI2_RESERVE32B = S32_MAX }; - /* drv_crypto_key_type[1:0] is mapped to cipher_do[1:0] */ /* drv_crypto_key_type[2] is mapped to cipher_config2 */ enum drv_crypto_key_type { @@ -208,7 +204,6 @@ struct drv_ctx_generic { enum drv_crypto_alg alg; } __attribute__((__may_alias__)); - struct drv_ctx_hash { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HASH */ enum drv_hash_mode mode; @@ -277,7 +272,6 @@ struct drv_ctx_aead { /***************** MESSAGE BASED CONTEXTS **************************/ /*******************************************************************/ - /* Get the address of a @member within a given @ctx address @ctx: The context address @type: Type of context structure -- cgit v1.2.3-55-g7522 From 3e008c17448ba6263934711e3575f9801601674f Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Thu, 1 Jun 2017 14:02:53 +0300 Subject: staging: ccree: fix longer than 80 chars lines Clip longer than 80 chars lines in header files worked on in the patch set. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 3 ++- drivers/staging/ccree/cc_regs.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index e9023bd6507c..b83d8eaab1f5 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -84,7 +84,8 @@ #define CC_MULTI2_SYSTEM_KEY_SIZE 32 #define CC_MULTI2_DATA_KEY_SIZE 8 -#define CC_MULTI2_SYSTEM_N_DATA_KEY_SIZE (CC_MULTI2_SYSTEM_KEY_SIZE + CC_MULTI2_DATA_KEY_SIZE) +#define CC_MULTI2_SYSTEM_N_DATA_KEY_SIZE \ + (CC_MULTI2_SYSTEM_KEY_SIZE + CC_MULTI2_DATA_KEY_SIZE) #define CC_MULTI2_BLOCK_SIZE 8 #define CC_MULTI2_IV_SIZE 8 #define CC_MULTI2_MIN_NUM_ROUNDS 8 diff --git a/drivers/staging/ccree/cc_regs.h b/drivers/staging/ccree/cc_regs.h index 8b89f0603f16..e272da44783e 100644 --- a/drivers/staging/ccree/cc_regs.h +++ b/drivers/staging/ccree/cc_regs.h @@ -17,7 +17,8 @@ /*! * @file - * @brief This file contains macro definitions for accessing ARM TrustZone CryptoCell register space. + * @brief This file contains macro definitions for accessing ARM TrustZone + * CryptoCell register space. */ #ifndef _CC_REGS_H_ -- cgit v1.2.3-55-g7522 From 33c73ae72e39caffca2f1be30a87c09504126b2f Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Thu, 1 Jun 2017 14:02:55 +0300 Subject: staging: ccree: fix comments formatting A few of the comments in cc_crypto_ctx.h where not formatted correctly. Format according to coding style guidelines. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index b83d8eaab1f5..46b6f3f3193a 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -214,8 +214,9 @@ struct drv_ctx_hash { CC_DIGEST_SIZE_MAX]; }; -/* !!!! drv_ctx_hmac should have the same structure as drv_ctx_hash except - k0, k0_size fields */ +/* NOTE! drv_ctx_hmac should have the same structure as drv_ctx_hash except + * k0, k0_size fields + */ struct drv_ctx_hmac { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HMAC */ enum drv_hash_mode mode; @@ -236,9 +237,10 @@ struct drv_ctx_cipher { u32 key_size; /* numeric value in bytes */ u32 data_unit_size; /* required for XTS */ /* block_state is the AES engine block state. - * It is used by the host to pass IV or counter at initialization. - * It is used by SeP for intermediate block chaining state and for - * returning MAC algorithms results. */ + * It is used by the host to pass IV or counter at initialization. + * It is used by SeP for intermediate block chaining state and for + * returning MAC algorithms results. + */ u8 block_state[CC_AES_BLOCK_SIZE]; u8 key[CC_AES_KEY_SIZE_MAX]; u8 xex_key[CC_AES_KEY_SIZE_MAX]; @@ -274,9 +276,10 @@ struct drv_ctx_aead { /*******************************************************************/ /* Get the address of a @member within a given @ctx address - @ctx: The context address - @type: Type of context structure - @member: Associated context field */ + * @ctx: The context address + * @type: Type of context structure + * @member: Associated context field + */ #define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member)) #endif /* _CC_CRYPTO_CTX_H_ */ -- cgit v1.2.3-55-g7522 From a0eee1b6dabd79019196fd1d1a66eeb93788867a Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Thu, 1 Jun 2017 14:02:56 +0300 Subject: staging: ccree: add parentheses to macro argument Add parentheses around macro argument to guard against precedence issues. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 46b6f3f3193a..1fc68defc59c 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -280,7 +280,7 @@ struct drv_ctx_aead { * @type: Type of context structure * @member: Associated context field */ -#define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member)) +#define GET_CTX_FIELD_ADDR(ctx, type, member) ((ctx) + offsetof(type, member)) #endif /* _CC_CRYPTO_CTX_H_ */ -- cgit v1.2.3-55-g7522 From 385cab7c7131083cbe09d5f1d06df4544caa272d Mon Sep 17 00:00:00 2001 From: Jia-Ju Bai Date: Thu, 1 Jun 2017 11:49:08 +0800 Subject: rts5208: Fix a sleep-in-atomic bug in sd_power_off_card3v3 The driver may sleep under a spin lock, and the function call path is: rtsx_exclusive_enter_ss (acquire the lock by spin_lock) rtsx_enter_ss rtsx_power_off_card sd_power_off_card3v3 wait_timeout schedule_timeout --> may sleep To fix it, "wait_timeout" is replaced with mdelay in sd_power_off_card3v3. Signed-off-by: Jia-Ju Bai Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index bdd35b611f27..aa144542e4e3 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -5231,7 +5231,7 @@ int sd_power_off_card3v3(struct rtsx_chip *chip) return STATUS_FAIL; } - wait_timeout(50); + mdelay(50); } if (chip->asic_code) { -- cgit v1.2.3-55-g7522 From ed99f0141b6a7ac0d197c28b814e67d85ac42452 Mon Sep 17 00:00:00 2001 From: Jia-Ju Bai Date: Thu, 1 Jun 2017 11:43:35 +0800 Subject: rts5208: Fix a sleep-in-atomic bug in rtsx_exclusive_enter_ss The driver may sleep under a spin lock, and the function call path is: rtsx_exclusive_enter_ss (acquire the lock by spin_lock) rtsx_enter_ss rtsx_power_off_card sd_cleanup_work sd_stop_seq_mode sd_switch_clock sd_ddr_tuning sd_ddr_pre_tuning_tx sd_change_phase wait_timeout schedule_timeout --> may sleep To fix it, "wait_timeout" is replaced with mdelay in sd_change_phase. Signed-off-by: Jia-Ju Bai Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index aa144542e4e3..c2eb072cbe1d 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -1057,7 +1057,7 @@ fail: rtsx_write_register(chip, SD_DCMPS_CTL, DCMPS_CHANGE, 0); rtsx_write_register(chip, SD_VP_CTL, PHASE_CHANGE, 0); - wait_timeout(10); + mdelay(10); sd_reset_dcm(chip, tune_dir); return STATUS_FAIL; } -- cgit v1.2.3-55-g7522 From 161d6dd8c8947748b627e015e30d718895d2f316 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:13:10 +1200 Subject: Drivers: ccree: ssi_fips_ll.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips_ll.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index 7c7c922f0788..ef0a9a580560 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -15,9 +15,9 @@ */ /************************************************************** -This file defines the driver FIPS Low Level implmentaion functions, -that executes the KAT. -***************************************************************/ + * This file defines the driver FIPS Low Level implmentaion functions, + * that executes the KAT. + ***************************************************************/ #include #include "ssi_driver.h" @@ -816,7 +816,8 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, dma_addr_t digest_bytes_len_dma_addr) { /* The implemented flow is not the same as the one implemented in ssi_hash.c (setkey + digest flows). - In this flow, there is no need to store and reload some of the intermidiate results. */ + * In this flow, there is no need to store and reload some of the intermidiate results. + */ /* max number of descriptors used for the flow */ #define FIPS_HMAC_MAX_SEQ_LEN 12 @@ -948,9 +949,9 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, idx++; /* at this point: - tmp_digest = H(o_key_pad) - k0 = H(i_key_pad || m) - */ + * tmp_digest = H(o_key_pad) + * k0 = H(i_key_pad || m) + */ /* Loading hash opad xor key state */ HW_DESC_INIT(&desc[idx]); @@ -1413,8 +1414,10 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, idx++; /* Configure Hash Engine to work with GHASH. - Since it was not possible to extend HASH submodes to add GHASH, - The following command is necessary in order to select GHASH (according to HW designers)*/ + * Since it was not possible to extend HASH submodes to add GHASH, + * The following command is necessary in order to + * select GHASH (according to HW designers) + */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); -- cgit v1.2.3-55-g7522 From f77aa70be3ed988dc770578611d0a7cc4582e719 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:13:26 +1200 Subject: Drivers: ccree: ssi_fips_ext.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips_ext.c | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips_ext.c b/drivers/staging/ccree/ssi_fips_ext.c index 291a880f567c..0f53a4bc43de 100644 --- a/drivers/staging/ccree/ssi_fips_ext.c +++ b/drivers/staging/ccree/ssi_fips_ext.c @@ -15,9 +15,9 @@ */ /************************************************************** -This file defines the driver FIPS functions that should be -implemented by the driver user. Current implementation is sample code only. -***************************************************************/ + * This file defines the driver FIPS functions that should be + * implemented by the driver user. Current implementation is sample code only. + ***************************************************************/ #include #include "ssi_fips_local.h" @@ -32,11 +32,11 @@ static ssi_fips_state_t fips_state = CC_FIPS_STATE_NOT_SUPPORTED; static ssi_fips_error_t fips_error = CC_REE_FIPS_ERROR_OK; /* -This function returns the FIPS REE state. -The function should be implemented by the driver user, depends on where . -the state value is stored. -The reference code uses global variable. -*/ + * This function returns the FIPS REE state. + * The function should be implemented by the driver user, depends on where + * the state value is stored. + * The reference code uses global variable. + */ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) { int rc = 0; @@ -51,11 +51,11 @@ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) } /* -This function returns the FIPS REE error. -The function should be implemented by the driver user, depends on where . -the error value is stored. -The reference code uses global variable. -*/ + * This function returns the FIPS REE error. + * The function should be implemented by the driver user, depends on where + * the error value is stored. + * The reference code uses global variable. + */ int ssi_fips_ext_get_error(ssi_fips_error_t *p_err) { int rc = 0; @@ -70,11 +70,11 @@ int ssi_fips_ext_get_error(ssi_fips_error_t *p_err) } /* -This function sets the FIPS REE state. -The function should be implemented by the driver user, depends on where . -the state value is stored. -The reference code uses global variable. -*/ + * This function sets the FIPS REE state. + * The function should be implemented by the driver user, depends on where + * the state value is stored. + * The reference code uses global variable. + */ int ssi_fips_ext_set_state(ssi_fips_state_t state) { fips_state = state; @@ -82,11 +82,11 @@ int ssi_fips_ext_set_state(ssi_fips_state_t state) } /* -This function sets the FIPS REE error. -The function should be implemented by the driver user, depends on where . -the error value is stored. -The reference code uses global variable. -*/ + * This function sets the FIPS REE error. + * The function should be implemented by the driver user, depends on where + * the error value is stored. + * The reference code uses global variable. + */ int ssi_fips_ext_set_error(ssi_fips_error_t err) { fips_error = err; -- cgit v1.2.3-55-g7522 From 7c3a293d43763641677a25897b75ac2abd335829 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:13:46 +1200 Subject: Drivers: ccree: ssi_fips_data.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips_data.h | 93 +++++++++++++++++------------------ 1 file changed, 46 insertions(+), 47 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips_data.h b/drivers/staging/ccree/ssi_fips_data.h index a4b78f1b4d48..fa6bf41c27e5 100644 --- a/drivers/staging/ccree/ssi_fips_data.h +++ b/drivers/staging/ccree/ssi_fips_data.h @@ -15,53 +15,52 @@ */ /* -The test vectors were taken from: - -* AES -NIST Special Publication 800-38A 2001 Edition -Recommendation for Block Cipher Modes of Operation -http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf -Appendix F: Example Vectors for Modes of Operation of the AES - -* AES CTS -Advanced Encryption Standard (AES) Encryption for Kerberos 5 -February 2005 -https://tools.ietf.org/html/rfc3962#appendix-B -B. Sample Test Vectors - -* AES XTS -http://csrc.nist.gov/groups/STM/cavp/#08 -http://csrc.nist.gov/groups/STM/cavp/documents/aes/XTSTestVectors.zip - -* AES CMAC -http://csrc.nist.gov/groups/STM/cavp/index.html#07 -http://csrc.nist.gov/groups/STM/cavp/documents/mac/cmactestvectors.zip - -* AES-CCM -http://csrc.nist.gov/groups/STM/cavp/#07 -http://csrc.nist.gov/groups/STM/cavp/documents/mac/ccmtestvectors.zip - -* AES-GCM -http://csrc.nist.gov/groups/STM/cavp/documents/mac/gcmtestvectors.zip - -* Triple-DES -NIST Special Publication 800-67 January 2012 -Recommendation for the Triple Data Encryption Algorithm (TDEA) Block Cipher -http://csrc.nist.gov/publications/nistpubs/800-67-Rev1/SP-800-67-Rev1.pdf -APPENDIX B: EXAMPLE OF TDEA FORWARD AND INVERSE CIPHER OPERATIONS -and -http://csrc.nist.gov/groups/STM/cavp/#01 -http://csrc.nist.gov/groups/STM/cavp/documents/des/tdesmct_intermediate.zip - -* HASH -http://csrc.nist.gov/groups/STM/cavp/#03 -http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip - -* HMAC -http://csrc.nist.gov/groups/STM/cavp/#07 -http://csrc.nist.gov/groups/STM/cavp/documents/mac/hmactestvectors.zip - -*/ + * The test vectors were taken from: + * + * * AES + * NIST Special Publication 800-38A 2001 Edition + * Recommendation for Block Cipher Modes of Operation + * http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf + * Appendix F: Example Vectors for Modes of Operation of the AES + * + * * AES CTS + * Advanced Encryption Standard (AES) Encryption for Kerberos 5 + * February 2005 + * https://tools.ietf.org/html/rfc3962#appendix-B + * B. Sample Test Vectors + * + * * AES XTS + * http://csrc.nist.gov/groups/STM/cavp/#08 + * http://csrc.nist.gov/groups/STM/cavp/documents/aes/XTSTestVectors.zip + * + * * AES CMAC + * http://csrc.nist.gov/groups/STM/cavp/index.html#07 + * http://csrc.nist.gov/groups/STM/cavp/documents/mac/cmactestvectors.zip + * + * * AES-CCM + * http://csrc.nist.gov/groups/STM/cavp/#07 + * http://csrc.nist.gov/groups/STM/cavp/documents/mac/ccmtestvectors.zip + * + * * AES-GCM + * http://csrc.nist.gov/groups/STM/cavp/documents/mac/gcmtestvectors.zip + * + * * Triple-DES + * NIST Special Publication 800-67 January 2012 + * Recommendation for the Triple Data Encryption Algorithm (TDEA) Block Cipher + * http://csrc.nist.gov/publications/nistpubs/800-67-Rev1/SP-800-67-Rev1.pdf + * APPENDIX B: EXAMPLE OF TDEA FORWARD AND INVERSE CIPHER OPERATIONS + * and + * http://csrc.nist.gov/groups/STM/cavp/#01 + * http://csrc.nist.gov/groups/STM/cavp/documents/des/tdesmct_intermediate.zip + * + * * HASH + * http://csrc.nist.gov/groups/STM/cavp/#03 + * http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip + * + * * HMAC + * http://csrc.nist.gov/groups/STM/cavp/#07 + * http://csrc.nist.gov/groups/STM/cavp/documents/mac/hmactestvectors.zip + */ /* NIST AES */ #define AES_128_BIT_KEY_SIZE 16 -- cgit v1.2.3-55-g7522 From cbff760259e369bae99a18dea8e4bb0e3dd5f99c Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:14:03 +1200 Subject: Drivers: ccree: ssi_fips.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h index 607c64b8c458..e108d89ef98c 100644 --- a/drivers/staging/ccree/ssi_fips.h +++ b/drivers/staging/ccree/ssi_fips.h @@ -18,9 +18,9 @@ #define __SSI_FIPS_H__ /*! -@file -@brief This file contains FIPS related defintions and APIs. -*/ + * @file + * @brief This file contains FIPS related defintions and APIs. + */ typedef enum ssi_fips_state { CC_FIPS_STATE_NOT_SUPPORTED = 0, -- cgit v1.2.3-55-g7522 From 3a82eb631f38db5b334f9b0eec078e434b65799b Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:14:20 +1200 Subject: Drivers: ccree: ssi_fips.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index 25ee23a1cecf..60a2452f7b0b 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -16,8 +16,8 @@ /************************************************************** -This file defines the driver FIPS APIs * -***************************************************************/ + * This file defines the driver FIPS APIs * + **************************************************************/ #include #include "ssi_fips.h" @@ -27,9 +27,9 @@ extern int ssi_fips_ext_get_state(ssi_fips_state_t *p_state); extern int ssi_fips_ext_get_error(ssi_fips_error_t *p_err); /* -This function returns the REE FIPS state. -It should be called by kernel module. -*/ + * This function returns the REE FIPS state. + * It should be called by kernel module. + */ int ssi_fips_get_state(ssi_fips_state_t *p_state) { int rc = 0; @@ -46,9 +46,9 @@ int ssi_fips_get_state(ssi_fips_state_t *p_state) EXPORT_SYMBOL(ssi_fips_get_state); /* -This function returns the REE FIPS error. -It should be called by kernel module. -*/ + * This function returns the REE FIPS error. + * It should be called by kernel module. + */ int ssi_fips_get_error(ssi_fips_error_t *p_err) { int rc = 0; -- cgit v1.2.3-55-g7522 From 250a00a7fc1e717e6060b754f9cdd28155018e0e Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:14:38 +1200 Subject: Drivers: ccree: ssi_driver.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_driver.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 45fc23fe169f..e034b0987137 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -15,7 +15,7 @@ */ /* \file ssi_driver.h - ARM CryptoCell Linux Crypto Driver + * ARM CryptoCell Linux Crypto Driver */ #ifndef __SSI_DRIVER_H__ @@ -86,7 +86,8 @@ #define NS_BIT 1 #define AXI_ID 0 /* AXI_ID is not actually the AXI ID of the transaction but the value of AXI_ID - field in the HW descriptor. The DMA engine +8 that value. */ + * field in the HW descriptor. The DMA engine +8 that value. + */ /* Logging macros */ #define SSI_LOG(level, format, ...) \ @@ -108,9 +109,11 @@ struct ssi_crypto_req { void (*user_cb)(struct device *dev, void *req, void __iomem *cc_base); void *user_arg; - dma_addr_t ivgen_dma_addr[SSI_MAX_IVGEN_DMA_ADDRESSES]; /* For the first 'ivgen_dma_addr_len' addresses of this array, - generated IV would be placed in it by send_request(). - Same generated IV for all addresses! */ + dma_addr_t ivgen_dma_addr[SSI_MAX_IVGEN_DMA_ADDRESSES]; + /* For the first 'ivgen_dma_addr_len' addresses of this array, + * generated IV would be placed in it by send_request(). + * Same generated IV for all addresses! + */ unsigned int ivgen_dma_addr_len; /* Amount of 'ivgen_dma_addr' elements to be filled. */ unsigned int ivgen_size; /* The generated IV size required, 8/16 B allowed. */ struct completion seq_compl; /* request completion */ @@ -136,7 +139,8 @@ struct ssi_drvdata { u32 irq_mask; u32 fw_ver; /* Calibration time of start/stop - * monitor descriptors */ + * monitor descriptors + */ u32 monitor_null_cycles; struct platform_device *plat_dev; ssi_sram_addr_t mlli_sram_addr; -- cgit v1.2.3-55-g7522 From f892b06826e1972680d7b940b6f9b2d7b8ce3c5c Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:14:54 +1200 Subject: Drivers: ccree: ssi_config.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_config.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_config.h b/drivers/staging/ccree/ssi_config.h index 431b518d893a..9feb692fff0d 100644 --- a/drivers/staging/ccree/ssi_config.h +++ b/drivers/staging/ccree/ssi_config.h @@ -15,7 +15,7 @@ */ /* \file ssi_config.h - Definitions for ARM CryptoCell Linux Crypto Driver + * Definitions for ARM CryptoCell Linux Crypto Driver */ #ifndef __SSI_CONFIG_H__ @@ -49,7 +49,8 @@ #define SSI_CACHE_PARAMS (0x000) /* CC attached to NONE-ACP such as HPP/ACE/AMBA4. * The customer is responsible to enable/disable this feature - * according to his platform type. */ + * according to his platform type. + */ #define DX_HAS_ACP 0 #else #define SSI_CACHE_PARAMS (0xEEE) -- cgit v1.2.3-55-g7522 From ef5d7bd9a913c3f4c2bf3fab66f5df4c87c0da42 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:15:09 +1200 Subject: Drivers: ccree: ssi_cipher.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_cipher.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_cipher.h b/drivers/staging/ccree/ssi_cipher.h index 7d58b56fc2c7..22d7b431edb9 100644 --- a/drivers/staging/ccree/ssi_cipher.h +++ b/drivers/staging/ccree/ssi_cipher.h @@ -15,7 +15,7 @@ */ /* \file ssi_cipher.h - ARM CryptoCell Cipher Crypto API + * ARM CryptoCell Cipher Crypto API */ #ifndef __SSI_CIPHER_H__ -- cgit v1.2.3-55-g7522 From 84e8a6cf4c418feadb33b68c0a6c8dd39618befb Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:15:26 +1200 Subject: Drivers: ccree: ssi_buffer_mgr.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_buffer_mgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_buffer_mgr.h b/drivers/staging/ccree/ssi_buffer_mgr.h index 4acbb4b6afc9..98355dd789e5 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.h +++ b/drivers/staging/ccree/ssi_buffer_mgr.h @@ -15,7 +15,7 @@ */ /* \file buffer_mgr.h - Buffer Manager + * Buffer Manager */ #ifndef __SSI_BUFFER_MGR_H__ -- cgit v1.2.3-55-g7522 From 2686444e5f7de44aff83f5022c9a3a4920d2a903 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:15:40 +1200 Subject: Drivers: ccree: ssi_buffer_mgr.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_buffer_mgr.c | 87 +++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 38 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 04515e70d2d3..edb88441e90d 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -330,7 +330,8 @@ static int ssi_buffer_mgr_generate_mlli( /* set last bit in the current table */ if (sg_data->mlli_nents[i] != NULL) { /*Calculate the current MLLI table length for the - length field in the descriptor*/ + *length field in the descriptor + */ *(sg_data->mlli_nents[i]) += (total_nents - prev_total_nents); prev_total_nents = total_nents; @@ -463,7 +464,8 @@ static int ssi_buffer_mgr_map_scatterlist( } if (!is_chained) { /* In case of mmu the number of mapped nents might - be changed from the original sgl nents */ + * be changed from the original sgl nents + */ *mapped_nents = dma_map_sg(dev, sg, *nents, direction); if (unlikely(*mapped_nents == 0)){ *nents = 0; @@ -472,7 +474,8 @@ static int ssi_buffer_mgr_map_scatterlist( } } else { /*In this case the driver maps entry by entry so it - must have the same nents before and after map */ + * must have the same nents before and after map + */ *mapped_nents = ssi_buffer_mgr_dma_map_sg(dev, sg, *nents, @@ -764,7 +767,8 @@ void ssi_buffer_mgr_unmap_aead_request( } /*In case a pool was set, a table was - allocated and should be released */ + *allocated and should be released + */ if (areq_ctx->mlli_params.curr_pool != NULL) { SSI_LOG_DEBUG("free MLLI buffer: dma=0x%08llX virt=%pK\n", (unsigned long long)areq_ctx->mlli_params.mlli_dma_addr, @@ -801,7 +805,8 @@ void ssi_buffer_mgr_unmap_aead_request( size_to_skip += crypto_aead_ivsize(tfm); } /* copy mac to a temporary location to deal with possible - data memory overriding that caused by cache coherence problem. */ + * data memory overriding that caused by cache coherence problem. + */ ssi_buffer_mgr_copy_scatterlist_portion( areq_ctx->backup_mac, req->src, size_to_skip+ req->cryptlen - areq_ctx->req_authsize, @@ -965,7 +970,8 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( areq_ctx->assoc.nents = mapped_nents; /* in CCM case we have additional entry for - * ccm header configurations */ + * ccm header configurations + */ if (areq_ctx->ccm_hdr_size != ccm_header_size_null) { if (unlikely((mapped_nents + 1) > LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES)) { @@ -1068,13 +1074,15 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( if (unlikely(areq_ctx->is_icv_fragmented == true)) { /* Backup happens only when ICV is fragmented, ICV - verification is made by CPU compare in order to simplify - MAC verification upon request completion */ + * verification is made by CPU compare in order to simplify + * MAC verification upon request completion + */ if (direct == DRV_CRYPTO_DIRECTION_DECRYPT) { #if !DX_HAS_ACP /* In ACP platform we already copying ICV - for any INPLACE-DECRYPT operation, hence - we must neglect this code. */ + * for any INPLACE-DECRYPT operation, hence + * we must neglect this code. + */ u32 size_to_skip = req->assoclen; if (areq_ctx->is_gcm4543) { size_to_skip += crypto_aead_ivsize(tfm); @@ -1120,8 +1128,9 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( if (unlikely(areq_ctx->is_icv_fragmented == true)) { /* Backup happens only when ICV is fragmented, ICV - verification is made by CPU compare in order to simplify - MAC verification upon request completion */ + * verification is made by CPU compare in order to simplify + * MAC verification upon request completion + */ u32 size_to_skip = req->assoclen; if (areq_ctx->is_gcm4543) { size_to_skip += crypto_aead_ivsize(tfm); @@ -1378,7 +1387,8 @@ int ssi_buffer_mgr_map_aead_request( size_to_skip += crypto_aead_ivsize(tfm); } /* copy mac to a temporary location to deal with possible - data memory overriding that caused by cache coherence problem. */ + * data memory overriding that caused by cache coherence problem. + */ ssi_buffer_mgr_copy_scatterlist_portion( areq_ctx->backup_mac, req->src, size_to_skip+ req->cryptlen - areq_ctx->req_authsize, @@ -1494,11 +1504,11 @@ int ssi_buffer_mgr_map_aead_request( if (likely(areq_ctx->is_single_pass == true)) { /* - * Create MLLI table for: - * (1) Assoc. data - * (2) Src/Dst SGLs - * Note: IV is contg. buffer (not an SGL) - */ + * Create MLLI table for: + * (1) Assoc. data + * (2) Src/Dst SGLs + * Note: IV is contg. buffer (not an SGL) + */ rc = ssi_buffer_mgr_aead_chain_assoc(drvdata, req, &sg_data, true, false); if (unlikely(rc != 0)) goto aead_map_failure; @@ -1510,25 +1520,25 @@ int ssi_buffer_mgr_map_aead_request( goto aead_map_failure; } else { /* DOUBLE-PASS flow */ /* - * Prepare MLLI table(s) in this order: - * - * If ENCRYPT/DECRYPT (inplace): - * (1) MLLI table for assoc - * (2) IV entry (chained right after end of assoc) - * (3) MLLI for src/dst (inplace operation) - * - * If ENCRYPT (non-inplace) - * (1) MLLI table for assoc - * (2) IV entry (chained right after end of assoc) - * (3) MLLI for dst - * (4) MLLI for src - * - * If DECRYPT (non-inplace) - * (1) MLLI table for assoc - * (2) IV entry (chained right after end of assoc) - * (3) MLLI for src - * (4) MLLI for dst - */ + * Prepare MLLI table(s) in this order: + * + * If ENCRYPT/DECRYPT (inplace): + * (1) MLLI table for assoc + * (2) IV entry (chained right after end of assoc) + * (3) MLLI for src/dst (inplace operation) + * + * If ENCRYPT (non-inplace) + * (1) MLLI table for assoc + * (2) IV entry (chained right after end of assoc) + * (3) MLLI for dst + * (4) MLLI for src + * + * If DECRYPT (non-inplace) + * (1) MLLI table for assoc + * (2) IV entry (chained right after end of assoc) + * (3) MLLI for src + * (4) MLLI for dst + */ rc = ssi_buffer_mgr_aead_chain_assoc(drvdata, req, &sg_data, false, true); if (unlikely(rc != 0)) goto aead_map_failure; @@ -1793,7 +1803,8 @@ void ssi_buffer_mgr_unmap_hash_request( &areq_ctx->buff1_cnt; /*In case a pool was set, a table was - allocated and should be released */ + *allocated and should be released + */ if (areq_ctx->mlli_params.curr_pool != NULL) { SSI_LOG_DEBUG("free MLLI buffer: dma=0x%llX virt=%pK\n", (unsigned long long)areq_ctx->mlli_params.mlli_dma_addr, -- cgit v1.2.3-55-g7522 From f5bd89b893d2d4cd5f3714fb0085820da572cd8f Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:15:59 +1200 Subject: Drivers: ccree: ssi_aead.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 654a181729d7..00a3680cb8ab 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -15,7 +15,7 @@ */ /* \file ssi_aead.h - ARM CryptoCell AEAD Crypto API + * ARM CryptoCell AEAD Crypto API */ #ifndef __SSI_AEAD_H__ @@ -62,8 +62,9 @@ enum aead_ccm_header_size { struct aead_req_ctx { /* Allocate cache line although only 4 bytes are needed to - * assure next field falls @ cache line - * Used for both: digest HW compare and CCM/GCM MAC value */ + * assure next field falls @ cache line + * Used for both: digest HW compare and CCM/GCM MAC value + */ u8 mac_buf[MAX_MAC_SIZE] ____cacheline_aligned; u8 ctr_iv[AES_BLOCK_SIZE] ____cacheline_aligned; -- cgit v1.2.3-55-g7522 From f4e929bbd87311b6d05c21b2175383bc4d6a55c6 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:16:22 +1200 Subject: Drivers: ccree: ssi_aead.c - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 45 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 26afa8794668..ecf9ff2ae336 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -250,7 +250,8 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c "(auth-size=%d, cipher=%d).\n", ctx->authsize, ctx->cipher_mode); /* In case of payload authentication failure, MUST NOT - revealed the decrypted message --> zero its memory. */ + * revealed the decrypted message --> zero its memory. + */ ssi_buffer_mgr_zero_sgl(areq->dst, areq_ctx->cryptlen); err = -EBADMSG; } @@ -279,7 +280,8 @@ static int xcbc_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) /* Load the AES key */ HW_DESC_INIT(&desc[0]); /* We are using for the source/user key the same buffer as for the output keys, - because after this key loading it is not needed anymore */ + * because after this key loading it is not needed anymore + */ HW_DESC_SET_DIN_TYPE(&desc[0], DMA_DLLI, ctx->auth_state.xcbc.xcbc_keys_dma_addr, ctx->auth_keylen, NS_BIT); HW_DESC_SET_CIPHER_MODE(&desc[0], DRV_CIPHER_ECB); HW_DESC_SET_CIPHER_CONFIG0(&desc[0], DRV_CRYPTO_DIRECTION_ENCRYPT); @@ -420,8 +422,9 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx) return 0; /* All tests of keys sizes passed */ } -/*This function prepers the user key so it can pass to the hmac processing - (copy to intenral buffer or hash in case of key longer than block */ +/* This function prepers the user key so it can pass to the hmac processing + * (copy to intenral buffer or hash in case of key longer than block + */ static int ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { @@ -600,7 +603,8 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) (AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE)) goto badkey; /* Copy nonce from last 4 bytes in CTR key to - * first 4 bytes in CTR IV */ + * first 4 bytes in CTR IV + */ memcpy(ctx->ctr_nonce, key + ctx->auth_keylen + ctx->enc_keylen - CTR_RFC3686_NONCE_SIZE, CTR_RFC3686_NONCE_SIZE); /* Set CTR key size */ @@ -829,7 +833,8 @@ ssi_aead_process_authenc_data_desc( { /* DOUBLE-PASS flow (as default) * assoc. + iv + data -compact in one table - * if assoclen is ZERO only IV perform */ + * if assoclen is ZERO only IV perform + */ ssi_sram_addr_t mlli_addr = areq_ctx->assoc.sram_addr; u32 mlli_nents = areq_ctx->assoc.mlli_nents; @@ -1287,7 +1292,8 @@ static inline void ssi_aead_hmac_authenc( /** * Double-pass flow * Fallback for unsupported single-pass modes, - * i.e. using assoc. data of non-word-multiple */ + * i.e. using assoc. data of non-word-multiple + */ if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { /* encrypt first.. */ ssi_aead_process_cipher(req, desc, seq_size, data_flow_mode); @@ -1305,7 +1311,8 @@ static inline void ssi_aead_hmac_authenc( /* decrypt after.. */ ssi_aead_process_cipher(req, desc, seq_size, data_flow_mode); /* read the digest result with setting the completion bit - must be after the cipher operation */ + * must be after the cipher operation + */ ssi_aead_process_digest_result_desc(req, desc, seq_size); } } @@ -1338,7 +1345,8 @@ ssi_aead_xcbc_authenc( /** * Double-pass flow * Fallback for unsupported single-pass modes, - * i.e. using assoc. data of non-word-multiple */ + * i.e. using assoc. data of non-word-multiple + */ if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { /* encrypt first.. */ ssi_aead_process_cipher(req, desc, seq_size, data_flow_mode); @@ -1353,7 +1361,8 @@ ssi_aead_xcbc_authenc( /* decrypt after..*/ ssi_aead_process_cipher(req, desc, seq_size, data_flow_mode); /* read the digest result with setting the completion bit - must be after the cipher operation */ + * must be after the cipher operation + */ ssi_aead_process_digest_result_desc(req, desc, seq_size); } } @@ -1712,8 +1721,10 @@ static inline void ssi_aead_gcm_setup_ghash_desc( idx++; /* Configure Hash Engine to work with GHASH. - Since it was not possible to extend HASH submodes to add GHASH, - The following command is necessary in order to select GHASH (according to HW designers)*/ + * Since it was not possible to extend HASH submodes to add GHASH, + * The following command is necessary in order to + * select GHASH (according to HW designers) + */ HW_DESC_INIT(&desc[idx]); HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); @@ -2044,7 +2055,8 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction if (ctx->cipher_mode == DRV_CIPHER_CTR) { /* Build CTR IV - Copy nonce from last 4 bytes in - * CTR key to first 4 bytes in CTR IV */ + * CTR key to first 4 bytes in CTR IV + */ memcpy(areq_ctx->ctr_iv, ctx->ctr_nonce, CTR_RFC3686_NONCE_SIZE); if (areq_ctx->backup_giv == NULL) /*User none-generated IV*/ memcpy(areq_ctx->ctr_iv + CTR_RFC3686_NONCE_SIZE, @@ -2106,9 +2118,10 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction ssi_req.ivgen_dma_addr_len = 1; } else if (ctx->cipher_mode == DRV_CIPHER_CCM) { /* In ccm, the IV needs to exist both inside B0 and inside the counter. - It is also copied to iv_dma_addr for other reasons (like returning - it to the user). - So, using 3 (identical) IV outputs. */ + * It is also copied to iv_dma_addr for other reasons (like returning + * it to the user). + * So, using 3 (identical) IV outputs. + */ ssi_req.ivgen_dma_addr[0] = areq_ctx->gen_ctx.iv_dma_addr + CCM_BLOCK_IV_OFFSET; ssi_req.ivgen_dma_addr[1] = sg_dma_address(&areq_ctx->ccm_adata_sg) + CCM_B0_OFFSET + CCM_BLOCK_IV_OFFSET; ssi_req.ivgen_dma_addr[2] = sg_dma_address(&areq_ctx->ccm_adata_sg) + CCM_CTR_COUNT_0_OFFSET + CCM_BLOCK_IV_OFFSET; -- cgit v1.2.3-55-g7522 From ebe22ecce11ee6e6f8e4234b9be43807c1a611a2 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:16:38 +1200 Subject: Drivers: ccree: hash_defs.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/hash_defs.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/hash_defs.h b/drivers/staging/ccree/hash_defs.h index 613897038f6d..3f2b2d1521c2 100644 --- a/drivers/staging/ccree/hash_defs.h +++ b/drivers/staging/ccree/hash_defs.h @@ -59,13 +59,14 @@ enum HashCipherDoPadding { typedef struct SepHashPrivateContext { /* The current length is placed at the end of the context buffer because the hash - context is used for all HMAC operations as well. HMAC context includes a 64 bytes - K0 field. The size of struct drv_ctx_hash reserved field is 88/184 bytes depend if t - he SHA512 is supported ( in this case teh context size is 256 bytes). - The size of struct drv_ctx_hash reseved field is 20 or 52 depend if the SHA512 is supported. - This means that this structure size (without the reserved field can be up to 20 bytes , - in case sha512 is not suppported it is 20 bytes (SEP_HASH_LENGTH_WORDS define to 2 ) and in the other - case it is 28 (SEP_HASH_LENGTH_WORDS define to 4) */ + * context is used for all HMAC operations as well. HMAC context includes a 64 bytes + * K0 field. The size of struct drv_ctx_hash reserved field is 88/184 bytes depend if t + * he SHA512 is supported ( in this case teh context size is 256 bytes). + * The size of struct drv_ctx_hash reseved field is 20 or 52 depend if the SHA512 is supported. + * This means that this structure size (without the reserved field can be up to 20 bytes , + * in case sha512 is not suppported it is 20 bytes (SEP_HASH_LENGTH_WORDS define to 2 ) and in the other + * case it is 28 (SEP_HASH_LENGTH_WORDS define to 4) + */ u32 reserved[(sizeof(struct drv_ctx_hash)/sizeof(u32)) - SEP_HASH_LENGTH_WORDS - 3]; u32 CurrentDigestedLength[SEP_HASH_LENGTH_WORDS]; u32 KeyType; -- cgit v1.2.3-55-g7522 From f6858e91eeb4d813150d116d4bcd76c3c52d51be Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:16:55 +1200 Subject: Drivers: ccree: cc_regs.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_regs.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_regs.h b/drivers/staging/ccree/cc_regs.h index e272da44783e..151341200d6a 100644 --- a/drivers/staging/ccree/cc_regs.h +++ b/drivers/staging/ccree/cc_regs.h @@ -56,8 +56,9 @@ do { \ BITFIELD_GET(reg_val, CC_ ## reg_name ## _ ## fld_name ## _BIT_SHIFT, \ CC_ ## reg_name ## _ ## fld_name ## _BIT_SIZE)) -/* yael TBD !!! - * -* all HW includes should start with CC_ and not DX_ !! */ +/* yael TBD !!! + * all HW includes should start with CC_ and not DX_ !! + */ /*! Bit fields set */ @@ -87,10 +88,10 @@ do { \ } while (0) /* Usage example: - u32 reg_shadow = READ_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL)); - CC_REG_FLD_SET(CRY_KERNEL,AES_CONTROL,NK_KEY0,reg_shadow, 3); - CC_REG_FLD_SET(CRY_KERNEL,AES_CONTROL,NK_KEY1,reg_shadow, 1); - WRITE_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL), reg_shadow); + * u32 reg_shadow = READ_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL)); + * CC_REG_FLD_SET(CRY_KERNEL,AES_CONTROL,NK_KEY0,reg_shadow, 3); + * CC_REG_FLD_SET(CRY_KERNEL,AES_CONTROL,NK_KEY1,reg_shadow, 1); + * WRITE_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL), reg_shadow); */ #endif /*_CC_REGS_H_*/ -- cgit v1.2.3-55-g7522 From ed5210cb07de90b8dc31a420466847755331536b Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Tue, 30 May 2017 18:17:10 +1200 Subject: Drivers: ccree: cc_hw_queue_defs.h - align block comments Fixed block comment alignment, Style fix only Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 71381760566d..bb64fddc371d 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -23,8 +23,8 @@ #include "dx_crys_kernel.h" /****************************************************************************** -* DEFINITIONS -******************************************************************************/ + * DEFINITIONS + ******************************************************************************/ /* Dma AXI Secure bit */ #define AXI_SECURE 0 @@ -36,8 +36,8 @@ #define _HW_DESC_MONITOR_KICK 0x7FFFC00 /****************************************************************************** -* TYPE DEFINITIONS -******************************************************************************/ + * TYPE DEFINITIONS + ******************************************************************************/ struct cc_hw_desc { u32 word[HW_DESC_SIZE_WORDS]; @@ -400,7 +400,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param numRounds number of rounds for Multi2 -*/ + */ #define HW_DESC_SET_MULTI2_NUM_ROUNDS(pDesc, numRounds) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(numRounds)); \ @@ -411,7 +411,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param flowMode Any one of the modes defined in [CC7x-DESC] -*/ + */ #define HW_DESC_SET_FLOW_MODE(pDesc, flowMode) \ do { \ @@ -423,7 +423,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param cipherMode Any one of the modes defined in [CC7x-DESC] -*/ + */ #define HW_DESC_SET_CIPHER_MODE(pDesc, cipherMode) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_MODE, (pDesc)->word[4], (cipherMode)); \ @@ -434,7 +434,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param cipherConfig Any one of the modes defined in [CC7x-DESC] -*/ + */ #define HW_DESC_SET_CIPHER_CONFIG0(pDesc, cipherConfig) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF0, (pDesc)->word[4], (cipherConfig)); \ @@ -445,7 +445,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param cipherConfig Any one of the modes defined in [CC7x-DESC] -*/ + */ #define HW_DESC_SET_CIPHER_CONFIG1(pDesc, cipherConfig) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF1, (pDesc)->word[4], (cipherConfig)); \ @@ -456,7 +456,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param hwKey The hw key number as in enun HwCryptoKey -*/ + */ #define HW_DESC_SET_HW_CRYPTO_KEY(pDesc, hwKey) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (hwKey) & HW_KEY_MASK_CIPHER_DO); \ @@ -468,7 +468,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param swapConfig Any one of the modes defined in [CC7x-DESC] -*/ + */ #define HW_DESC_SET_BYTES_SWAP(pDesc, swapConfig) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, BYTES_SWAP, (pDesc)->word[4], (swapConfig)); \ @@ -478,7 +478,7 @@ enum cc_hw_des_key_size { * This macro sets the CMAC_SIZE0 mode. * * \param pDesc pointer HW descriptor struct -*/ + */ #define HW_DESC_SET_CMAC_SIZE0_MODE(pDesc) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CMAC_SIZE0, (pDesc)->word[4], 0x1); \ @@ -489,7 +489,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param keySize key size in bytes (NOT size code) -*/ + */ #define HW_DESC_SET_KEY_SIZE_AES(pDesc, keySize) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, KEY_SIZE, (pDesc)->word[4], ((keySize) >> 3) - 2); \ @@ -500,7 +500,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param keySize key size in bytes (NOT size code) -*/ + */ #define HW_DESC_SET_KEY_SIZE_DES(pDesc, keySize) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, KEY_SIZE, (pDesc)->word[4], ((keySize) >> 3) - 1); \ @@ -511,7 +511,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param setupMode Any one of the setup modes defined in [CC7x-DESC] -*/ + */ #define HW_DESC_SET_SETUP_MODE(pDesc, setupMode) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, SETUP_OPERATION, (pDesc)->word[4], (setupMode)); \ @@ -522,7 +522,7 @@ enum cc_hw_des_key_size { * * \param pDesc pointer HW descriptor struct * \param cipherDo Any one of the cipher do defined in [CC7x-DESC] -*/ + */ #define HW_DESC_SET_CIPHER_DO(pDesc, cipherDo) \ do { \ CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (cipherDo) & HW_KEY_MASK_CIPHER_DO); \ -- cgit v1.2.3-55-g7522 From 6562e7db139f48d41d15fd2c3afb06017d6d8f97 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:22 +0300 Subject: staging: ccree: replace bit shift with BIT macro CC_CTX_SIZE was being defined using a hand rolled bit shift operation. Replace with use of BIT macro. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 1fc68defc59c..20f3f9fa0b56 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -27,7 +27,7 @@ #define CC_CTX_SIZE_LOG2 7 #endif #endif -#define CC_CTX_SIZE (1 << CC_CTX_SIZE_LOG2) +#define CC_CTX_SIZE BIT(CC_CTX_SIZE_LOG2) #define CC_DRV_CTX_SIZE_WORDS (CC_CTX_SIZE >> 2) #define CC_DRV_DES_IV_SIZE 8 -- cgit v1.2.3-55-g7522 From 8b64e512dea15c6af39e83ebc01f774e2541632a Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:23 +0300 Subject: staging: ccree: refactor HW command FIFO access The programming of the HW command FIFO in ccree was done via a set of macros which suffer a few problems: - Use of macros rather than inline leaves out parameter type checking and risks multiple macro parameter evaluation side effects. - Implemented via hand rolled versions of bitfield operations. This patch refactors the HW command queue access into a set of inline functions using generic kernel bitfield access infrastructure, thus resolving the above issues and opening the way later on to drop the hand rolled bitfield macros once additional users are dropped in later patches in the series. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_bitops.h | 8 +- drivers/staging/ccree/cc_hw_queue_defs.h | 644 ++++++++++++---------- drivers/staging/ccree/ssi_aead.c | 901 +++++++++++++++---------------- drivers/staging/ccree/ssi_cipher.c | 224 ++++---- drivers/staging/ccree/ssi_driver.h | 4 +- drivers/staging/ccree/ssi_fips_ll.c | 704 ++++++++++++------------ drivers/staging/ccree/ssi_hash.c | 832 ++++++++++++++-------------- drivers/staging/ccree/ssi_ivgen.c | 77 ++- drivers/staging/ccree/ssi_request_mgr.c | 23 +- drivers/staging/ccree/ssi_sram_mgr.c | 8 +- 10 files changed, 1745 insertions(+), 1680 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_bitops.h b/drivers/staging/ccree/cc_bitops.h index ee5238a9928d..cbdc1ab5cb5a 100644 --- a/drivers/staging/ccree/cc_bitops.h +++ b/drivers/staging/ccree/cc_bitops.h @@ -21,8 +21,12 @@ #ifndef _CC_BITOPS_H_ #define _CC_BITOPS_H_ -#define BITMASK(mask_size) (((mask_size) < 32) ? \ - ((1UL << (mask_size)) - 1) : 0xFFFFFFFFUL) +#include +#include + +#define BITMASK(mask_size) (((mask_size) < 32) ? \ + ((1UL << (mask_size)) - 1) : 0xFFFFFFFFUL) + #define BITMASK_AT(mask_size, mask_offset) (BITMASK(mask_size) << (mask_offset)) #define BITFIELD_GET(word, bit_offset, bit_size) \ diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index bb64fddc371d..c3f9d6a4b992 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -23,24 +23,68 @@ #include "dx_crys_kernel.h" /****************************************************************************** - * DEFINITIONS - ******************************************************************************/ - -/* Dma AXI Secure bit */ -#define AXI_SECURE 0 -#define AXI_NOT_SECURE 1 +* DEFINITIONS +******************************************************************************/ #define HW_DESC_SIZE_WORDS 6 #define HW_QUEUE_SLOTS_MAX 15 /* Max. available slots in HW queue */ #define _HW_DESC_MONITOR_KICK 0x7FFFC00 +#define CC_REG_NAME(word, name) DX_DSCRPTR_QUEUE_WORD ## word ## _ ## name + +#define CC_REG_LOW(word, name) \ + (DX_DSCRPTR_QUEUE_WORD ## word ## _ ## name ## _BIT_SHIFT) + +#define CC_REG_HIGH(word, name) \ + (CC_REG_LOW(word, name) + \ + DX_DSCRPTR_QUEUE_WORD ## word ## _ ## name ## _BIT_SIZE - 1) + +#define CC_GENMASK(word, name) \ + GENMASK(CC_REG_HIGH(word, name), CC_REG_LOW(word, name)) + +#define WORD0_VALUE CC_GENMASK(0, VALUE) +#define WORD1_DIN_CONST_VALUE CC_GENMASK(1, DIN_CONST_VALUE) +#define WORD1_DIN_DMA_MODE CC_GENMASK(1, DIN_DMA_MODE) +#define WORD1_DIN_SIZE CC_GENMASK(1, DIN_SIZE) +#define WORD1_NOT_LAST CC_GENMASK(1, NOT_LAST) +#define WORD1_NS_BIT CC_GENMASK(1, NS_BIT) +#define WORD2_VALUE CC_GENMASK(2, VALUE) +#define WORD3_DOUT_DMA_MODE CC_GENMASK(3, DOUT_DMA_MODE) +#define WORD3_DOUT_LAST_IND CC_GENMASK(3, DOUT_LAST_IND) +#define WORD3_DOUT_SIZE CC_GENMASK(3, DOUT_SIZE) +#define WORD3_HASH_XOR_BIT CC_GENMASK(3, HASH_XOR_BIT) +#define WORD3_NS_BIT CC_GENMASK(3, NS_BIT) +#define WORD3_QUEUE_LAST_IND CC_GENMASK(3, QUEUE_LAST_IND) +#define WORD4_ACK_NEEDED CC_GENMASK(4, ACK_NEEDED) +#define WORD4_AES_SEL_N_HASH CC_GENMASK(4, AES_SEL_N_HASH) +#define WORD4_BYTES_SWAP CC_GENMASK(4, BYTES_SWAP) +#define WORD4_CIPHER_CONF0 CC_GENMASK(4, CIPHER_CONF0) +#define WORD4_CIPHER_CONF1 CC_GENMASK(4, CIPHER_CONF1) +#define WORD4_CIPHER_CONF2 CC_GENMASK(4, CIPHER_CONF2) +#define WORD4_CIPHER_DO CC_GENMASK(4, CIPHER_DO) +#define WORD4_CIPHER_MODE CC_GENMASK(4, CIPHER_MODE) +#define WORD4_CMAC_SIZE0 CC_GENMASK(4, CMAC_SIZE0) +#define WORD4_DATA_FLOW_MODE CC_GENMASK(4, DATA_FLOW_MODE) +#define WORD4_KEY_SIZE CC_GENMASK(4, KEY_SIZE) +#define WORD4_SETUP_OPERATION CC_GENMASK(4, SETUP_OPERATION) +#define WORD5_DIN_ADDR_HIGH CC_GENMASK(5, DIN_ADDR_HIGH) +#define WORD5_DOUT_ADDR_HIGH CC_GENMASK(5, DOUT_ADDR_HIGH) + /****************************************************************************** - * TYPE DEFINITIONS - ******************************************************************************/ +* TYPE DEFINITIONS +******************************************************************************/ struct cc_hw_desc { - u32 word[HW_DESC_SIZE_WORDS]; + union { + u32 word[HW_DESC_SIZE_WORDS]; + u16 hword[HW_DESC_SIZE_WORDS * 2]; + }; +}; + +enum cc_axi_sec { + AXI_SECURE = 0, + AXI_NOT_SECURE = 1 }; enum cc_desc_direction { @@ -164,369 +208,403 @@ enum cc_hw_des_key_size { /* Descriptor packing macros */ /*****************************/ -#define GET_HW_Q_DESC_WORD_IDX(descWordIdx) (CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD ## descWordIdx)) - -#define HW_DESC_INIT(pDesc) memset(pDesc, 0, sizeof(struct cc_hw_desc)) +/* + * Init a HW descriptor struct + * @pdesc: pointer HW descriptor struct + */ +static inline void hw_desc_init(struct cc_hw_desc *pdesc) +{ + memset(pdesc, 0, sizeof(struct cc_hw_desc)); +} -/*! - * This macro indicates the end of current HW descriptors flow and release the HW engines. +/* + * Indicates the end of current HW descriptors flow and release the HW engines. * - * \param pDesc pointer HW descriptor struct + * @pdesc: pointer HW descriptor struct */ -#define HW_DESC_SET_QUEUE_LAST_IND(pDesc) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, QUEUE_LAST_IND, (pDesc)->word[3], 1); \ - } while (0) +static inline void set_queue_last_ind(struct cc_hw_desc *pdesc) +{ + pdesc->word[3] |= FIELD_PREP(WORD3_QUEUE_LAST_IND, 1); +} -/*! - * This macro signs the end of HW descriptors flow by asking for completion ack, and release the HW engines +/* + * Signs the end of HW descriptors flow by asking for completion ack, + * and release the HW engines * - * \param pDesc pointer HW descriptor struct + * @pdesc: pointer HW descriptor struct */ -#define HW_DESC_SET_ACK_LAST(pDesc) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, QUEUE_LAST_IND, (pDesc)->word[3], 1); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, ACK_NEEDED, (pDesc)->word[4], 1); \ - } while (0) +static inline void set_ack_last(struct cc_hw_desc *pdesc) +{ + pdesc->word[3] |= FIELD_PREP(WORD3_QUEUE_LAST_IND, 1); + pdesc->word[4] |= FIELD_PREP(WORD4_ACK_NEEDED, 1); +} #define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32) & U16_MAX) -/*! - * This macro sets the DIN field of a HW descriptors +/* + * Set the DIN field of a HW descriptors * - * \param pDesc pointer HW descriptor struct - * \param dmaMode The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT - * \param dinAdr DIN address - * \param dinSize Data size in bytes - * \param axiNs AXI secure bit - */ -#define HW_DESC_SET_DIN_TYPE(pDesc, dmaMode, dinAdr, dinSize, axiNs) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (dinAdr) & U32_MAX); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DIN_ADDR_HIGH, (pDesc)->word[5], MSB64(dinAdr)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], (dmaMode)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, NS_BIT, (pDesc)->word[1], (axiNs)); \ - } while (0) + * @pdesc: pointer HW descriptor struct + * @dma_mode: dmaMode The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT + * @addr: dinAdr DIN address + * @size: Data size in bytes + * @axi_sec: AXI secure bit + */ +static inline void set_din_type(struct cc_hw_desc *pdesc, + enum cc_dma_mode dma_mode, dma_addr_t addr, + u32 size, enum cc_axi_sec axi_sec) +{ + pdesc->word[0] = (u32)addr; +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT + pdesc->word[5] |= FIELD_PREP(WORD5_DIN_ADDR_HIGH, ((u16)(addr >> 32))); +#endif + pdesc->word[1] |= FIELD_PREP(WORD1_DIN_DMA_MODE, dma_mode) | + FIELD_PREP(WORD1_DIN_SIZE, size) | + FIELD_PREP(WORD1_NS_BIT, axi_sec); +} -/*! - * This macro sets the DIN field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and - * other special modes +/* + * Set the DIN field of a HW descriptors to NO DMA mode. + * Used for NOP descriptor, register patches and other special modes. * - * \param pDesc pointer HW descriptor struct - * \param dinAdr DIN address - * \param dinSize Data size in bytes + * @pdesc: pointer HW descriptor struct + * @addr: DIN address + * @size: Data size in bytes */ -#define HW_DESC_SET_DIN_NO_DMA(pDesc, dinAdr, dinSize) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(dinAdr)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ - } while (0) +static inline void set_din_no_dma(struct cc_hw_desc *pdesc, u32 addr, u32 size) +{ + pdesc->word[0] = addr; + pdesc->word[1] |= FIELD_PREP(WORD1_DIN_SIZE, size); +} -/*! - * This macro sets the DIN field of a HW descriptors to SRAM mode. +/* + * Set the DIN field of a HW descriptors to SRAM mode. * Note: No need to check SRAM alignment since host requests do not use SRAM and * adaptor will enforce alignment check. * - * \param pDesc pointer HW descriptor struct - * \param dinAdr DIN address - * \param dinSize Data size in bytes + * @pdesc: pointer HW descriptor struct + * @addr: DIN address + * @size Data size in bytes */ -#define HW_DESC_SET_DIN_SRAM(pDesc, dinAdr, dinSize) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(dinAdr)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], DMA_SRAM); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ - } while (0) +static inline void set_din_sram(struct cc_hw_desc *pdesc, dma_addr_t addr, + u32 size) +{ + pdesc->word[0] = (u32)addr; + pdesc->word[1] |= FIELD_PREP(WORD1_DIN_SIZE, size) | + FIELD_PREP(WORD1_DIN_DMA_MODE, DMA_SRAM); +} -/*! This macro sets the DIN field of a HW descriptors to CONST mode +/* + * Set the DIN field of a HW descriptors to CONST mode * - * \param pDesc pointer HW descriptor struct - * \param val DIN const value - * \param dinSize Data size in bytes + * @pdesc: pointer HW descriptor struct + * @val: DIN const value + * @size: Data size in bytes */ -#define HW_DESC_SET_DIN_CONST(pDesc, val, dinSize) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0, VALUE, (pDesc)->word[0], (u32)(val)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_CONST_VALUE, (pDesc)->word[1], 1); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_DMA_MODE, (pDesc)->word[1], DMA_SRAM); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, DIN_SIZE, (pDesc)->word[1], (dinSize)); \ - } while (0) +static inline void set_din_const(struct cc_hw_desc *pdesc, u32 val, u32 size) +{ + pdesc->word[0] = val; + pdesc->word[1] |= FIELD_PREP(WORD1_DIN_CONST_VALUE, 1) | + FIELD_PREP(WORD1_DIN_DMA_MODE, DMA_SRAM) | + FIELD_PREP(WORD1_DIN_SIZE, size); +} -/*! - * This macro sets the DIN not last input data indicator +/* + * Set the DIN not last input data indicator * - * \param pDesc pointer HW descriptor struct + * @pdesc: pointer HW descriptor struct */ -#define HW_DESC_SET_DIN_NOT_LAST_INDICATION(pDesc) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD1, NOT_LAST, (pDesc)->word[1], 1); \ - } while (0) +static inline void set_din_not_last_indication(struct cc_hw_desc *pdesc) +{ + pdesc->word[1] |= FIELD_PREP(WORD1_NOT_LAST, 1); +} -/*! - * This macro sets the DOUT field of a HW descriptors +/* + * Set the DOUT field of a HW descriptors * - * \param pDesc pointer HW descriptor struct - * \param dmaMode The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT - * \param doutAdr DOUT address - * \param doutSize Data size in bytes - * \param axiNs AXI secure bit + * @pdesc: pointer HW descriptor struct + * @dma_mode: The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT + * @addr: DOUT address + * @size: Data size in bytes + * @axi_sec: AXI secure bit */ -#define HW_DESC_SET_DOUT_TYPE(pDesc, dmaMode, doutAdr, doutSize, axiNs) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr) & U32_MAX); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], (dmaMode)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, NS_BIT, (pDesc)->word[3], (axiNs)); \ - } while (0) +static inline void set_dout_type(struct cc_hw_desc *pdesc, + enum cc_dma_mode dma_mode, dma_addr_t addr, + u32 size, enum cc_axi_sec axi_sec) +{ + pdesc->word[2] = (u32)addr; +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT + pdesc->word[5] |= FIELD_PREP(WORD5_DOUT_ADDR_HIGH, ((u16)(addr >> 32))); +#endif + pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_DMA_MODE, dma_mode) | + FIELD_PREP(WORD3_DOUT_SIZE, size) | + FIELD_PREP(WORD3_NS_BIT, axi_sec); +} -/*! - * This macro sets the DOUT field of a HW descriptors to DLLI type +/* + * Set the DOUT field of a HW descriptors to DLLI type * The LAST INDICATION is provided by the user * - * \param pDesc pointer HW descriptor struct - * \param doutAdr DOUT address - * \param doutSize Data size in bytes - * \param lastInd The last indication bit - * \param axiNs AXI secure bit - */ -#define HW_DESC_SET_DOUT_DLLI(pDesc, doutAdr, doutSize, axiNs, lastInd) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr) & U32_MAX); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_DLLI); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], lastInd); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, NS_BIT, (pDesc)->word[3], (axiNs)); \ - } while (0) + * @pdesc pointer HW descriptor struct + * @addr: DOUT address + * @size: Data size in bytes + * @last_ind: The last indication bit + * @axi_sec: AXI secure bit + */ +static inline void set_dout_dlli(struct cc_hw_desc *pdesc, dma_addr_t addr, + u32 size, enum cc_axi_sec axi_sec, + u32 last_ind) +{ + set_dout_type(pdesc, DMA_DLLI, addr, size, axi_sec); + pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_LAST_IND, last_ind); +} -/*! - * This macro sets the DOUT field of a HW descriptors to DLLI type +/* + * Set the DOUT field of a HW descriptors to DLLI type * The LAST INDICATION is provided by the user * - * \param pDesc pointer HW descriptor struct - * \param doutAdr DOUT address - * \param doutSize Data size in bytes - * \param lastInd The last indication bit - * \param axiNs AXI secure bit - */ -#define HW_DESC_SET_DOUT_MLLI(pDesc, doutAdr, doutSize, axiNs, lastInd) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (doutAdr) & U32_MAX); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD5, DOUT_ADDR_HIGH, (pDesc)->word[5], MSB64(doutAdr)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_MLLI); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], lastInd); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, NS_BIT, (pDesc)->word[3], (axiNs)); \ - } while (0) + * @pdesc: pointer HW descriptor struct + * @addr: DOUT address + * @size: Data size in bytes + * @last_ind: The last indication bit + * @axi_sec: AXI secure bit + */ +static inline void set_dout_mlli(struct cc_hw_desc *pdesc, dma_addr_t addr, + u32 size, enum cc_axi_sec axi_sec, + bool last_ind) +{ + set_dout_type(pdesc, DMA_MLLI, addr, size, axi_sec); + pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_LAST_IND, last_ind); +} -/*! - * This macro sets the DOUT field of a HW descriptors to NO DMA mode. Used for NOP descriptor, register patches and - * other special modes +/* + * Set the DOUT field of a HW descriptors to NO DMA mode. + * Used for NOP descriptor, register patches and other special modes. * - * \param pDesc pointer HW descriptor struct - * \param doutAdr DOUT address - * \param doutSize Data size in bytes - * \param registerWriteEnable Enables a write operation to a register - */ -#define HW_DESC_SET_DOUT_NO_DMA(pDesc, doutAdr, doutSize, registerWriteEnable) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(doutAdr)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_LAST_IND, (pDesc)->word[3], (registerWriteEnable)); \ - } while (0) + * @pdesc: pointer HW descriptor struct + * @addr: DOUT address + * @size: Data size in bytes + * @write_enable: Enables a write operation to a register + */ +static inline void set_dout_no_dma(struct cc_hw_desc *pdesc, u32 addr, + u32 size, bool write_enable) +{ + pdesc->word[2] = addr; + pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_SIZE, size) | + FIELD_PREP(WORD3_DOUT_LAST_IND, write_enable); +} -/*! - * This macro sets the word for the XOR operation. +/* + * Set the word for the XOR operation. * - * \param pDesc pointer HW descriptor struct - * \param xorVal xor data value + * @pdesc: pointer HW descriptor struct + * @val: xor data value */ -#define HW_DESC_SET_XOR_VAL(pDesc, xorVal) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(xorVal)); \ - } while (0) +static inline void set_xor_val(struct cc_hw_desc *pdesc, u32 val) +{ + pdesc->word[2] = val; +} -/*! - * This macro sets the XOR indicator bit in the descriptor +/* + * Sets the XOR indicator bit in the descriptor * - * \param pDesc pointer HW descriptor struct + * @pdesc: pointer HW descriptor struct */ -#define HW_DESC_SET_XOR_ACTIVE(pDesc) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, HASH_XOR_BIT, (pDesc)->word[3], 1); \ - } while (0) +static inline void set_xor_active(struct cc_hw_desc *pdesc) +{ + pdesc->word[3] |= FIELD_PREP(WORD3_HASH_XOR_BIT, 1); +} -/*! - * This macro selects the AES engine instead of HASH engine when setting up combined mode with AES XCBC MAC +/* + * Select the AES engine instead of HASH engine when setting up combined mode + * with AES XCBC MAC * - * \param pDesc pointer HW descriptor struct + * @pdesc: pointer HW descriptor struct */ -#define HW_DESC_SET_AES_NOT_HASH_MODE(pDesc) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, AES_SEL_N_HASH, (pDesc)->word[4], 1); \ - } while (0) +static inline void set_aes_not_hash_mode(struct cc_hw_desc *pdesc) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_AES_SEL_N_HASH, 1); +} -/*! - * This macro sets the DOUT field of a HW descriptors to SRAM mode +/* + * Set the DOUT field of a HW descriptors to SRAM mode * Note: No need to check SRAM alignment since host requests do not use SRAM and * adaptor will enforce alignment check. * - * \param pDesc pointer HW descriptor struct - * \param doutAdr DOUT address - * \param doutSize Data size in bytes + * @pdesc: pointer HW descriptor struct + * @addr: DOUT address + * @size: Data size in bytes */ -#define HW_DESC_SET_DOUT_SRAM(pDesc, doutAdr, doutSize) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(doutAdr)); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_DMA_MODE, (pDesc)->word[3], DMA_SRAM); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD3, DOUT_SIZE, (pDesc)->word[3], (doutSize)); \ - } while (0) +static inline void set_dout_sram(struct cc_hw_desc *pdesc, u32 addr, u32 size) +{ + pdesc->word[2] = addr; + pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_DMA_MODE, DMA_SRAM) | + FIELD_PREP(WORD3_DOUT_SIZE, size); +} -/*! - * This macro sets the data unit size for XEX mode in data_out_addr[15:0] +/* + * Sets the data unit size for XEX mode in data_out_addr[15:0] * - * \param pDesc pointer HW descriptor struct - * \param dataUnitSize data unit size for XEX mode + * @pdesc: pDesc pointer HW descriptor struct + * @size: data unit size for XEX mode */ -#define HW_DESC_SET_XEX_DATA_UNIT_SIZE(pDesc, dataUnitSize) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(dataUnitSize)); \ - } while (0) +static inline void set_xex_data_unit_size(struct cc_hw_desc *pdesc, u32 size) +{ + pdesc->word[2] = size; +} -/*! - * This macro sets the number of rounds for Multi2 in data_out_addr[15:0] +/* + * Set the number of rounds for Multi2 in data_out_addr[15:0] * - * \param pDesc pointer HW descriptor struct - * \param numRounds number of rounds for Multi2 + * @pdesc: pointer HW descriptor struct + * @num: number of rounds for Multi2 */ -#define HW_DESC_SET_MULTI2_NUM_ROUNDS(pDesc, numRounds) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD2, VALUE, (pDesc)->word[2], (u32)(numRounds)); \ - } while (0) +static inline void set_multi2_num_rounds(struct cc_hw_desc *pdesc, u32 num) +{ + pdesc->word[2] = num; +} -/*! - * This macro sets the flow mode. +/* + * Set the flow mode. * - * \param pDesc pointer HW descriptor struct - * \param flowMode Any one of the modes defined in [CC7x-DESC] + * @pdesc: pointer HW descriptor struct + * @mode: Any one of the modes defined in [CC7x-DESC] */ +static inline void set_flow_mode(struct cc_hw_desc *pdesc, + enum cc_flow_mode mode) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_DATA_FLOW_MODE, mode); +} -#define HW_DESC_SET_FLOW_MODE(pDesc, flowMode) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, DATA_FLOW_MODE, (pDesc)->word[4], (flowMode)); \ - } while (0) +/* + * Set the cipher mode. + * + * @pdesc: pointer HW descriptor struct + * @mode: Any one of the modes defined in [CC7x-DESC] + */ +static inline void set_cipher_mode(struct cc_hw_desc *pdesc, + enum drv_cipher_mode mode) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_MODE, mode); +} -/*! - * This macro sets the cipher mode. +/* + * Set the cipher configuration fields. * - * \param pDesc pointer HW descriptor struct - * \param cipherMode Any one of the modes defined in [CC7x-DESC] + * @pdesc: pointer HW descriptor struct + * @mode: Any one of the modes defined in [CC7x-DESC] */ -#define HW_DESC_SET_CIPHER_MODE(pDesc, cipherMode) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_MODE, (pDesc)->word[4], (cipherMode)); \ - } while (0) +static inline void set_cipher_config0(struct cc_hw_desc *pdesc, + enum drv_crypto_direction mode) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_CONF0, mode); +} -/*! - * This macro sets the cipher configuration fields. +/* + * Set the cipher configuration fields. * - * \param pDesc pointer HW descriptor struct - * \param cipherConfig Any one of the modes defined in [CC7x-DESC] + * @pdesc: pointer HW descriptor struct + * @config: Any one of the modes defined in [CC7x-DESC] */ -#define HW_DESC_SET_CIPHER_CONFIG0(pDesc, cipherConfig) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF0, (pDesc)->word[4], (cipherConfig)); \ - } while (0) +static inline void set_cipher_config1(struct cc_hw_desc *pdesc, + enum HashConfig1Padding config) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_CONF1, config); +} -/*! - * This macro sets the cipher configuration fields. +/* + * Set HW key configuration fields. * - * \param pDesc pointer HW descriptor struct - * \param cipherConfig Any one of the modes defined in [CC7x-DESC] + * @pdesc: pointer HW descriptor struct + * @hw_key: The HW key slot asdefined in enum cc_hw_crypto_key */ -#define HW_DESC_SET_CIPHER_CONFIG1(pDesc, cipherConfig) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF1, (pDesc)->word[4], (cipherConfig)); \ - } while (0) +static inline void set_hw_crypto_key(struct cc_hw_desc *pdesc, + enum cc_hw_crypto_key hw_key) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_DO, + (hw_key & HW_KEY_MASK_CIPHER_DO)) | + FIELD_PREP(WORD4_CIPHER_CONF2, + (hw_key >> HW_KEY_SHIFT_CIPHER_CFG2)); +} -/*! - * This macro sets HW key configuration fields. +/* + * Set byte order of all setup-finalize descriptors. * - * \param pDesc pointer HW descriptor struct - * \param hwKey The hw key number as in enun HwCryptoKey + * @pdesc: pointer HW descriptor struct + * @config: Any one of the modes defined in [CC7x-DESC] */ -#define HW_DESC_SET_HW_CRYPTO_KEY(pDesc, hwKey) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (hwKey) & HW_KEY_MASK_CIPHER_DO); \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_CONF2, (pDesc)->word[4], (hwKey >> HW_KEY_SHIFT_CIPHER_CFG2)); \ - } while (0) +static inline void set_bytes_swap(struct cc_hw_desc *pdesc, bool config) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_BYTES_SWAP, config); +} -/*! - * This macro changes the bytes order of all setup-finalize descriptosets. +/* + * Set CMAC_SIZE0 mode. * - * \param pDesc pointer HW descriptor struct - * \param swapConfig Any one of the modes defined in [CC7x-DESC] + * @pdesc: pointer HW descriptor struct */ -#define HW_DESC_SET_BYTES_SWAP(pDesc, swapConfig) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, BYTES_SWAP, (pDesc)->word[4], (swapConfig)); \ - } while (0) +static inline void set_cmac_size0_mode(struct cc_hw_desc *pdesc) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_CMAC_SIZE0, 1); +} -/*! - * This macro sets the CMAC_SIZE0 mode. +/* + * Set key size descriptor field. * - * \param pDesc pointer HW descriptor struct + * @pdesc: pointer HW descriptor struct + * @size: key size in bytes (NOT size code) */ -#define HW_DESC_SET_CMAC_SIZE0_MODE(pDesc) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CMAC_SIZE0, (pDesc)->word[4], 0x1); \ - } while (0) +static inline void set_key_size(struct cc_hw_desc *pdesc, u32 size) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_KEY_SIZE, size); +} -/*! - * This macro sets the key size for AES engine. +/* + * Set AES key size. * - * \param pDesc pointer HW descriptor struct - * \param keySize key size in bytes (NOT size code) + * @pdesc: pointer HW descriptor struct + * @size: key size in bytes (NOT size code) */ -#define HW_DESC_SET_KEY_SIZE_AES(pDesc, keySize) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, KEY_SIZE, (pDesc)->word[4], ((keySize) >> 3) - 2); \ - } while (0) +static inline void set_key_size_aes(struct cc_hw_desc *pdesc, u32 size) +{ + set_key_size(pdesc, ((size >> 3) - 2)); +} -/*! - * This macro sets the key size for DES engine. +/* + * Set DES key size. * - * \param pDesc pointer HW descriptor struct - * \param keySize key size in bytes (NOT size code) + * @pdesc: pointer HW descriptor struct + * @size: key size in bytes (NOT size code) */ -#define HW_DESC_SET_KEY_SIZE_DES(pDesc, keySize) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, KEY_SIZE, (pDesc)->word[4], ((keySize) >> 3) - 1); \ - } while (0) +static inline void set_key_size_des(struct cc_hw_desc *pdesc, u32 size) +{ + set_key_size(pdesc, ((size >> 3) - 1)); +} -/*! - * This macro sets the descriptor's setup mode +/* + * Set the descriptor setup mode * - * \param pDesc pointer HW descriptor struct - * \param setupMode Any one of the setup modes defined in [CC7x-DESC] + * @pdesc: pointer HW descriptor struct + * @mode: Any one of the setup modes defined in [CC7x-DESC] */ -#define HW_DESC_SET_SETUP_MODE(pDesc, setupMode) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, SETUP_OPERATION, (pDesc)->word[4], (setupMode)); \ - } while (0) +static inline void set_setup_mode(struct cc_hw_desc *pdesc, + enum cc_setup_op mode) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_SETUP_OPERATION, mode); +} -/*! - * This macro sets the descriptor's cipher do +/* + * Set the descriptor cipher DO * - * \param pDesc pointer HW descriptor struct - * \param cipherDo Any one of the cipher do defined in [CC7x-DESC] + * @pdesc: pointer HW descriptor struct + * @config: Any one of the cipher do defined in [CC7x-DESC] */ -#define HW_DESC_SET_CIPHER_DO(pDesc, cipherDo) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_QUEUE_WORD4, CIPHER_DO, (pDesc)->word[4], (cipherDo) & HW_KEY_MASK_CIPHER_DO); \ - } while (0) +static inline void set_cipher_do(struct cc_hw_desc *pdesc, + enum HashCipherDoPadding config) +{ + pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_DO, + (config & HW_KEY_MASK_CIPHER_DO)); +} /*! * This macro sets the DIN field of a HW descriptors to star/stop monitor descriptor. diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index ecf9ff2ae336..b0db815c9366 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -278,33 +278,36 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c static int xcbc_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) { /* Load the AES key */ - HW_DESC_INIT(&desc[0]); + hw_desc_init(&desc[0]); /* We are using for the source/user key the same buffer as for the output keys, * because after this key loading it is not needed anymore */ - HW_DESC_SET_DIN_TYPE(&desc[0], DMA_DLLI, ctx->auth_state.xcbc.xcbc_keys_dma_addr, ctx->auth_keylen, NS_BIT); - HW_DESC_SET_CIPHER_MODE(&desc[0], DRV_CIPHER_ECB); - HW_DESC_SET_CIPHER_CONFIG0(&desc[0], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[0], ctx->auth_keylen); - HW_DESC_SET_FLOW_MODE(&desc[0], S_DIN_to_AES); - HW_DESC_SET_SETUP_MODE(&desc[0], SETUP_LOAD_KEY0); - - HW_DESC_INIT(&desc[1]); - HW_DESC_SET_DIN_CONST(&desc[1], 0x01010101, CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[1], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[1], ctx->auth_state.xcbc.xcbc_keys_dma_addr, AES_KEYSIZE_128, NS_BIT, 0); - - HW_DESC_INIT(&desc[2]); - HW_DESC_SET_DIN_CONST(&desc[2], 0x02020202, CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[2], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[2], (ctx->auth_state.xcbc.xcbc_keys_dma_addr + set_din_type(&desc[0], DMA_DLLI, + ctx->auth_state.xcbc.xcbc_keys_dma_addr, ctx->auth_keylen, + NS_BIT); + set_cipher_mode(&desc[0], DRV_CIPHER_ECB); + set_cipher_config0(&desc[0], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_key_size_aes(&desc[0], ctx->auth_keylen); + set_flow_mode(&desc[0], S_DIN_to_AES); + set_setup_mode(&desc[0], SETUP_LOAD_KEY0); + + hw_desc_init(&desc[1]); + set_din_const(&desc[1], 0x01010101, CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[1], DIN_AES_DOUT); + set_dout_dlli(&desc[1], ctx->auth_state.xcbc.xcbc_keys_dma_addr, + AES_KEYSIZE_128, NS_BIT, 0); + + hw_desc_init(&desc[2]); + set_din_const(&desc[2], 0x02020202, CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[2], DIN_AES_DOUT); + set_dout_dlli(&desc[2], (ctx->auth_state.xcbc.xcbc_keys_dma_addr + AES_KEYSIZE_128), AES_KEYSIZE_128, NS_BIT, 0); - HW_DESC_INIT(&desc[3]); - HW_DESC_SET_DIN_CONST(&desc[3], 0x03030303, CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[3], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[3], (ctx->auth_state.xcbc.xcbc_keys_dma_addr + hw_desc_init(&desc[3]); + set_din_const(&desc[3], 0x03030303, CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[3], DIN_AES_DOUT); + set_dout_dlli(&desc[3], (ctx->auth_state.xcbc.xcbc_keys_dma_addr + 2 * AES_KEYSIZE_128), AES_KEYSIZE_128, NS_BIT, 0); @@ -326,52 +329,51 @@ static int hmac_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) /* calc derived HMAC key */ for (i = 0; i < 2; i++) { /* Load hash initial state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DIN_SRAM(&desc[idx], - ssi_ahash_get_larval_digest_sram_addr( + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hash_mode); + set_din_sram(&desc[idx], + ssi_ahash_get_larval_digest_sram_addr( ctx->drvdata, ctx->auth_mode), - digest_size); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + digest_size); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, HASH_LEN_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hash_mode); + set_din_const(&desc[idx], 0, HASH_LEN_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Prepare ipad key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_XOR_VAL(&desc[idx], hmacPadConst[i]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); + hw_desc_init(&desc[idx]); + set_xor_val(&desc[idx], hmacPadConst[i]); + set_cipher_mode(&desc[idx], hash_mode); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); idx++; /* Perform HASH update */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctx->auth_state.hmac.padded_authkey_dma_addr, - SHA256_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_XOR_ACTIVE(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + ctx->auth_state.hmac.padded_authkey_dma_addr, + SHA256_BLOCK_SIZE, NS_BIT); + set_cipher_mode(&desc[idx], hash_mode); + set_xor_active(&desc[idx]); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* Get the digset */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (ctx->auth_state.hmac.ipad_opad_dma_addr + - digest_ofs), - digest_size, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hash_mode); + set_dout_dlli(&desc[idx], + (ctx->auth_state.hmac.ipad_opad_dma_addr + + digest_ofs), digest_size, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); idx++; digest_ofs += digest_size; @@ -466,84 +468,74 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl SSI_UPDATE_DMA_ADDR_TO_48BIT(key_dma_addr, keylen); if (keylen > blocksize) { /* Load hash initial state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hashmode); - HW_DESC_SET_DIN_SRAM(&desc[idx], larval_addr, digestsize); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hashmode); + set_din_sram(&desc[idx], larval_addr, digestsize); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hashmode); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, HASH_LEN_SIZE); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hashmode); + set_din_const(&desc[idx], 0, HASH_LEN_SIZE); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, - keylen, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + key_dma_addr, keylen, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* Get hashed key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hashmode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - padded_authkey_dma_addr, - digestsize, - NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], - HASH_PADDING_DISABLED); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], - HASH_DIGEST_RESULT_LITTLE_ENDIAN); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hashmode); + set_dout_dlli(&desc[idx], padded_authkey_dma_addr, + digestsize, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); + set_cipher_config0(&desc[idx], + HASH_DIGEST_RESULT_LITTLE_ENDIAN); idx++; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, (blocksize - digestsize)); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (padded_authkey_dma_addr + digestsize), - (blocksize - digestsize), - NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0, (blocksize - digestsize)); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], (padded_authkey_dma_addr + + digestsize), (blocksize - digestsize), + NS_BIT, 0); idx++; } else { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, - keylen, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (padded_authkey_dma_addr), - keylen, NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, + keylen, NS_BIT); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], padded_authkey_dma_addr, + keylen, NS_BIT, 0); idx++; if ((blocksize - keylen) != 0) { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, - (blocksize - keylen)); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (padded_authkey_dma_addr + keylen), - (blocksize - keylen), - NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0, + (blocksize - keylen)); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], + (padded_authkey_dma_addr + + keylen), + (blocksize - keylen), NS_BIT, 0); idx++; } } } else { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, - (blocksize - keylen)); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - padded_authkey_dma_addr, - blocksize, - NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0, (blocksize - keylen)); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], padded_authkey_dma_addr, + blocksize, NS_BIT, 0); idx++; } @@ -772,24 +764,23 @@ ssi_aead_create_assoc_desc( switch (assoc_dma_type) { case SSI_DMA_BUF_DLLI: SSI_LOG_DEBUG("ASSOC buffer type DLLI\n"); - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - sg_dma_address(areq->src), - areq->assoclen, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); - if (ctx->auth_mode == DRV_HASH_XCBC_MAC && (areq_ctx->cryptlen > 0) ) - HW_DESC_SET_DIN_NOT_LAST_INDICATION(&desc[idx]); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, sg_dma_address(areq->src), + areq->assoclen, NS_BIT); set_flow_mode(&desc[idx], + flow_mode); + if ((ctx->auth_mode == DRV_HASH_XCBC_MAC) && + (areq_ctx->cryptlen > 0)) + set_din_not_last_indication(&desc[idx]); break; case SSI_DMA_BUF_MLLI: SSI_LOG_DEBUG("ASSOC buffer type MLLI\n"); - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_MLLI, - areq_ctx->assoc.sram_addr, - areq_ctx->assoc.mlli_nents, - NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); - if (ctx->auth_mode == DRV_HASH_XCBC_MAC && (areq_ctx->cryptlen > 0) ) - HW_DESC_SET_DIN_NOT_LAST_INDICATION(&desc[idx]); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_MLLI, areq_ctx->assoc.sram_addr, + areq_ctx->assoc.mlli_nents, NS_BIT); + set_flow_mode(&desc[idx], flow_mode); + if ((ctx->auth_mode == DRV_HASH_XCBC_MAC) && + (areq_ctx->cryptlen > 0)) + set_din_not_last_indication(&desc[idx]); break; case SSI_DMA_BUF_NULL: default: @@ -822,11 +813,11 @@ ssi_aead_process_authenc_data_desc( (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? areq_ctx->dstOffset : areq_ctx->srcOffset; SSI_LOG_DEBUG("AUTHENC: SRC/DST buffer type DLLI\n"); - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (sg_dma_address(cipher)+ offset), areq_ctx->cryptlen, - NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + (sg_dma_address(cipher) + offset), + areq_ctx->cryptlen, NS_BIT); + set_flow_mode(&desc[idx], flow_mode); break; } case SSI_DMA_BUF_MLLI: @@ -849,10 +840,10 @@ ssi_aead_process_authenc_data_desc( } SSI_LOG_DEBUG("AUTHENC: SRC/DST buffer type MLLI\n"); - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_MLLI, - mlli_addr, mlli_nents, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_MLLI, mlli_addr, mlli_nents, + NS_BIT); + set_flow_mode(&desc[idx], flow_mode); break; } case SSI_DMA_BUF_NULL: @@ -880,25 +871,24 @@ ssi_aead_process_cipher_data_desc( switch (data_dma_type) { case SSI_DMA_BUF_DLLI: SSI_LOG_DEBUG("CIPHER: SRC/DST buffer type DLLI\n"); - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (sg_dma_address(areq_ctx->srcSgl)+areq_ctx->srcOffset), - areq_ctx->cryptlen, NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (sg_dma_address(areq_ctx->dstSgl)+areq_ctx->dstOffset), - areq_ctx->cryptlen, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + (sg_dma_address(areq_ctx->srcSgl) + + areq_ctx->srcOffset), areq_ctx->cryptlen, NS_BIT); + set_dout_dlli(&desc[idx], + (sg_dma_address(areq_ctx->dstSgl) + + areq_ctx->dstOffset), + areq_ctx->cryptlen, NS_BIT, 0); + set_flow_mode(&desc[idx], flow_mode); break; case SSI_DMA_BUF_MLLI: SSI_LOG_DEBUG("CIPHER: SRC/DST buffer type MLLI\n"); - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_MLLI, - areq_ctx->src.sram_addr, - areq_ctx->src.mlli_nents, NS_BIT); - HW_DESC_SET_DOUT_MLLI(&desc[idx], - areq_ctx->dst.sram_addr, - areq_ctx->dst.mlli_nents, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_MLLI, areq_ctx->src.sram_addr, + areq_ctx->src.mlli_nents, NS_BIT); + set_dout_mlli(&desc[idx], areq_ctx->dst.sram_addr, + areq_ctx->dst.mlli_nents, NS_BIT, 0); + set_flow_mode(&desc[idx], flow_mode); break; case SSI_DMA_BUF_NULL: default: @@ -923,35 +913,36 @@ static inline void ssi_aead_process_digest_result_desc( /* Get final ICV result */ if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_DOUT_DLLI(&desc[idx], req_ctx->icv_dma_addr, - ctx->authsize, NS_BIT, 1); - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); + hw_desc_init(&desc[idx]); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_dout_dlli(&desc[idx], req_ctx->icv_dma_addr, ctx->authsize, + NS_BIT, 1); + set_queue_last_ind(&desc[idx]); if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_aes_not_hash_mode(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); } else { - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], - HASH_DIGEST_RESULT_LITTLE_ENDIAN); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); + set_cipher_config0(&desc[idx], + HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_cipher_mode(&desc[idx], hash_mode); } } else { /*Decrypt*/ /* Get ICV out from hardware */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], req_ctx->mac_buf_dma_addr, - ctx->authsize, NS_BIT, 1); - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); + hw_desc_init(&desc[idx]); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_dout_dlli(&desc[idx], req_ctx->mac_buf_dma_addr, + ctx->authsize, NS_BIT, 1); + set_queue_last_ind(&desc[idx]); + set_cipher_config0(&desc[idx], + HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_aes_not_hash_mode(&desc[idx]); } else { - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); + set_cipher_mode(&desc[idx], hash_mode); } } @@ -971,35 +962,35 @@ static inline void ssi_aead_setup_cipher_desc( int direct = req_ctx->gen_ctx.op_type; /* Setup cipher state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direct); - HW_DESC_SET_FLOW_MODE(&desc[idx], ctx->flow_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->gen_ctx.iv_dma_addr, hw_iv_size, NS_BIT); + hw_desc_init(&desc[idx]); + set_cipher_config0(&desc[idx], direct); + set_flow_mode(&desc[idx], ctx->flow_mode); + set_din_type(&desc[idx], DMA_DLLI, req_ctx->gen_ctx.iv_dma_addr, + hw_iv_size, NS_BIT); if (ctx->cipher_mode == DRV_CIPHER_CTR) { - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); } else { - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); } - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->cipher_mode); + set_cipher_mode(&desc[idx], ctx->cipher_mode); idx++; /* Setup enc. key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direct); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_FLOW_MODE(&desc[idx], ctx->flow_mode); + hw_desc_init(&desc[idx]); + set_cipher_config0(&desc[idx], direct); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_flow_mode(&desc[idx], ctx->flow_mode); if (ctx->flow_mode == S_DIN_to_AES) { - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ((ctx->enc_keylen == 24) ? - CC_AES_KEY_SIZE_MAX : ctx->enc_keylen), NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); + set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ((ctx->enc_keylen == 24) ? CC_AES_KEY_SIZE_MAX : + ctx->enc_keylen), NS_BIT); + set_key_size_aes(&desc[idx], ctx->enc_keylen); } else { - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ctx->enc_keylen, NS_BIT); - HW_DESC_SET_KEY_SIZE_DES(&desc[idx], ctx->enc_keylen); + set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ctx->enc_keylen, NS_BIT); + set_key_size_des(&desc[idx], ctx->enc_keylen); } - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->cipher_mode); + set_cipher_mode(&desc[idx], ctx->cipher_mode); idx++; *seq_size = idx; @@ -1022,9 +1013,9 @@ static inline void ssi_aead_process_cipher( ssi_aead_process_cipher_data_desc(req, data_flow_mode, desc, &idx); if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { /* We must wait for DMA to write all cipher */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; } @@ -1045,23 +1036,24 @@ static inline void ssi_aead_hmac_setup_digest_desc( unsigned int idx = *seq_size; /* Loading hash ipad xor key state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctx->auth_state.hmac.ipad_opad_dma_addr, - digest_size, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hash_mode); + set_din_type(&desc[idx], DMA_DLLI, + ctx->auth_state.hmac.ipad_opad_dma_addr, digest_size, + NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load init. digest len (64 bytes) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DIN_SRAM(&desc[idx], - ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata, hash_mode), - HASH_LEN_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hash_mode); + set_din_sram(&desc[idx], + ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata, + hash_mode), + HASH_LEN_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; *seq_size = idx; @@ -1077,55 +1069,53 @@ static inline void ssi_aead_xcbc_setup_digest_desc( unsigned int idx = *seq_size; /* Loading MAC state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, CC_AES_BLOCK_SIZE); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0, CC_AES_BLOCK_SIZE); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); idx++; /* Setup XCBC MAC K1 */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctx->auth_state.xcbc.xcbc_keys_dma_addr, - AES_KEYSIZE_128, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + ctx->auth_state.xcbc.xcbc_keys_dma_addr, + AES_KEYSIZE_128, NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); idx++; /* Setup XCBC MAC K2 */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (ctx->auth_state.xcbc.xcbc_keys_dma_addr + - AES_KEYSIZE_128), - AES_KEYSIZE_128, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + (ctx->auth_state.xcbc.xcbc_keys_dma_addr + + AES_KEYSIZE_128), AES_KEYSIZE_128, NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); idx++; /* Setup XCBC MAC K3 */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (ctx->auth_state.xcbc.xcbc_keys_dma_addr + - 2 * AES_KEYSIZE_128), - AES_KEYSIZE_128, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE2); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + (ctx->auth_state.xcbc.xcbc_keys_dma_addr + + 2 * AES_KEYSIZE_128), AES_KEYSIZE_128, NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE2); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); idx++; *seq_size = idx; @@ -1159,51 +1149,52 @@ static inline void ssi_aead_process_digest_scheme_desc( CC_SHA1_DIGEST_SIZE : CC_SHA256_DIGEST_SIZE; unsigned int idx = *seq_size; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DOUT_SRAM(&desc[idx], aead_handle->sram_workspace_addr, - HASH_LEN_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE1); - HW_DESC_SET_CIPHER_DO(&desc[idx], DO_PAD); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hash_mode); + set_dout_sram(&desc[idx], aead_handle->sram_workspace_addr, + HASH_LEN_SIZE); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE1); + set_cipher_do(&desc[idx], DO_PAD); idx++; /* Get final ICV result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DOUT_SRAM(&desc[idx], aead_handle->sram_workspace_addr, - digest_size); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); + hw_desc_init(&desc[idx]); + set_dout_sram(&desc[idx], aead_handle->sram_workspace_addr, + digest_size); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_cipher_mode(&desc[idx], hash_mode); idx++; /* Loading hash opad xor key state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (ctx->auth_state.hmac.ipad_opad_dma_addr + digest_size), - digest_size, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hash_mode); + set_din_type(&desc[idx], DMA_DLLI, + (ctx->auth_state.hmac.ipad_opad_dma_addr + digest_size), + digest_size, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load init. digest len (64 bytes) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hash_mode); - HW_DESC_SET_DIN_SRAM(&desc[idx], - ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata, hash_mode), - HASH_LEN_SIZE); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hash_mode); + set_din_sram(&desc[idx], + ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata, + hash_mode), + HASH_LEN_SIZE); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Perform HASH update */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_SRAM(&desc[idx], aead_handle->sram_workspace_addr, - digest_size); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_sram(&desc[idx], aead_handle->sram_workspace_addr, + digest_size); + set_flow_mode(&desc[idx], DIN_HASH); idx++; *seq_size = idx; @@ -1226,14 +1217,14 @@ static inline void ssi_aead_load_mlli_to_sram( (unsigned int)ctx->drvdata->mlli_sram_addr, req_ctx->mlli_params.mlli_len); /* Copy MLLI table host-to-sram */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - req_ctx->mlli_params.mlli_dma_addr, - req_ctx->mlli_params.mlli_len, NS_BIT); - HW_DESC_SET_DOUT_SRAM(&desc[*seq_size], - ctx->drvdata->mlli_sram_addr, - req_ctx->mlli_params.mlli_len); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], BYPASS); + hw_desc_init(&desc[*seq_size]); + set_din_type(&desc[*seq_size], DMA_DLLI, + req_ctx->mlli_params.mlli_dma_addr, + req_ctx->mlli_params.mlli_len, NS_BIT); + set_dout_sram(&desc[*seq_size], + ctx->drvdata->mlli_sram_addr, + req_ctx->mlli_params.mlli_len); + set_flow_mode(&desc[*seq_size], BYPASS); (*seq_size)++; } } @@ -1486,55 +1477,51 @@ static inline int ssi_aead_ccm( } /* load key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ((ctx->enc_keylen == 24) ? - CC_AES_KEY_SIZE_MAX : ctx->enc_keylen), - NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); + set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ((ctx->enc_keylen == 24) ? CC_AES_KEY_SIZE_MAX : + ctx->enc_keylen), NS_BIT); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* load ctr state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->gen_ctx.iv_dma_addr, - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_din_type(&desc[idx], DMA_DLLI, + req_ctx->gen_ctx.iv_dma_addr, AES_BLOCK_SIZE, NS_BIT); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* load MAC key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ((ctx->enc_keylen == 24) ? - CC_AES_KEY_SIZE_MAX : ctx->enc_keylen), - NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); + set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ((ctx->enc_keylen == 24) ? CC_AES_KEY_SIZE_MAX : + ctx->enc_keylen), NS_BIT); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); idx++; /* load MAC state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->mac_buf_dma_addr, - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_din_type(&desc[idx], DMA_DLLI, req_ctx->mac_buf_dma_addr, + AES_BLOCK_SIZE, NS_BIT); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); idx++; @@ -1542,12 +1529,11 @@ static inline int ssi_aead_ccm( if (req->assoclen > 0) { ssi_aead_create_assoc_desc(req, DIN_HASH, desc, &idx); } else { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - sg_dma_address(&req_ctx->ccm_adata_sg), - AES_BLOCK_SIZE + req_ctx->ccm_hdr_size, - NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + sg_dma_address(&req_ctx->ccm_adata_sg), + AES_BLOCK_SIZE + req_ctx->ccm_hdr_size, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; } @@ -1557,40 +1543,39 @@ static inline int ssi_aead_ccm( } /* Read temporal MAC */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); - HW_DESC_SET_DOUT_DLLI(&desc[idx], req_ctx->mac_buf_dma_addr, - ctx->authsize, NS_BIT, 0); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); + set_dout_dlli(&desc[idx], req_ctx->mac_buf_dma_addr, ctx->authsize, + NS_BIT, 0); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_aes_not_hash_mode(&desc[idx]); idx++; /* load AES-CTR state (for last MAC calculation)*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->ccm_iv0_dma_addr , - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_din_type(&desc[idx], DMA_DLLI, req_ctx->ccm_iv0_dma_addr, + AES_BLOCK_SIZE, NS_BIT); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* encrypt the "T" value and store MAC in mac_state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->mac_buf_dma_addr , ctx->authsize, NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_result , ctx->authsize, NS_BIT, 1); - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, req_ctx->mac_buf_dma_addr, + ctx->authsize, NS_BIT); + set_dout_dlli(&desc[idx], mac_result, ctx->authsize, NS_BIT, 1); + set_queue_last_ind(&desc[idx]); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; *seq_size = idx; @@ -1681,43 +1666,40 @@ static inline void ssi_aead_gcm_setup_ghash_desc( unsigned int idx = *seq_size; /* load key to AES*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ctx->enc_keylen, NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_ECB); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ctx->enc_keylen, NS_BIT); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* process one zero block to generate hkey */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0x0, AES_BLOCK_SIZE); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - req_ctx->hkey_dma_addr, - AES_BLOCK_SIZE, - NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0x0, AES_BLOCK_SIZE); + set_dout_dlli(&desc[idx], req_ctx->hkey_dma_addr, AES_BLOCK_SIZE, + NS_BIT, 0); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; /* Memory Barrier */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* Load GHASH subkey */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->hkey_dma_addr, - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, req_ctx->hkey_dma_addr, + AES_BLOCK_SIZE, NS_BIT); + set_dout_no_dma(&desc[idx], 0, 0, 1); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Configure Hash Engine to work with GHASH. @@ -1725,27 +1707,27 @@ static inline void ssi_aead_gcm_setup_ghash_desc( * The following command is necessary in order to * select GHASH (according to HW designers) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_DO(&desc[idx], 1); //1=AES_SK RKEK - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); + set_cipher_do(&desc[idx], 1); //1=AES_SK RKEK + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Load GHASH initial STATE (which is 0). (for any hash there is an initial state) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0x0, AES_BLOCK_SIZE); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0x0, AES_BLOCK_SIZE); + set_dout_no_dma(&desc[idx], 0, 0, 1); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; *seq_size = idx; @@ -1762,27 +1744,27 @@ static inline void ssi_aead_gcm_setup_gctr_desc( unsigned int idx = *seq_size; /* load key to AES*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, - ctx->enc_keylen, NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, + ctx->enc_keylen, NS_BIT); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; if ((req_ctx->cryptlen != 0) && (req_ctx->plaintext_authenticate_only==false)){ /* load AES/CTR initial CTR value inc by 2*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->gcm_iv_inc2_dma_addr, - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_din_type(&desc[idx], DMA_DLLI, + req_ctx->gcm_iv_inc2_dma_addr, AES_BLOCK_SIZE, + NS_BIT); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; } @@ -1807,52 +1789,49 @@ static inline void ssi_aead_process_gcm_result_desc( } /* process(ghash) gcm_block_len */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->gcm_block_len_dma_addr, - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, req_ctx->gcm_block_len_dma_addr, + AES_BLOCK_SIZE, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* Store GHASH state after GHASH(Associated Data + Cipher +LenBlock) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_DLLI(&desc[idx], req_ctx->mac_buf_dma_addr, - AES_BLOCK_SIZE, NS_BIT, 0); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_dlli(&desc[idx], req_ctx->mac_buf_dma_addr, AES_BLOCK_SIZE, + NS_BIT, 0); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_aes_not_hash_mode(&desc[idx]); idx++; /* load AES/CTR initial CTR value inc by 1*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->enc_keylen); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->gcm_iv_inc1_dma_addr, - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); + set_key_size_aes(&desc[idx], ctx->enc_keylen); + set_din_type(&desc[idx], DMA_DLLI, req_ctx->gcm_iv_inc1_dma_addr, + AES_BLOCK_SIZE, NS_BIT); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* Memory Barrier */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* process GCTR on stored GHASH and store MAC in mac_state*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - req_ctx->mac_buf_dma_addr, - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_result, ctx->authsize, NS_BIT, 1); - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); + set_din_type(&desc[idx], DMA_DLLI, req_ctx->mac_buf_dma_addr, + AES_BLOCK_SIZE, NS_BIT); + set_dout_dlli(&desc[idx], mac_result, ctx->authsize, NS_BIT, 1); + set_queue_last_ind(&desc[idx]); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; *seq_size = idx; diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index d245a2baff70..8f86fcdee879 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -489,96 +489,93 @@ ssi_blkcipher_create_setup_desc( case DRV_CIPHER_CTR: case DRV_CIPHER_OFB: /* Load cipher state */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - iv_dma_addr, ivsize, - NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], flow_mode); - HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], cipher_mode); + hw_desc_init(&desc[*seq_size]); + set_din_type(&desc[*seq_size], DMA_DLLI, iv_dma_addr, ivsize, + NS_BIT); + set_cipher_config0(&desc[*seq_size], direction); + set_flow_mode(&desc[*seq_size], flow_mode); + set_cipher_mode(&desc[*seq_size], cipher_mode); if ((cipher_mode == DRV_CIPHER_CTR) || (cipher_mode == DRV_CIPHER_OFB) ) { - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], - SETUP_LOAD_STATE1); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE1); } else { - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], - SETUP_LOAD_STATE0); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE0); } (*seq_size)++; /*FALLTHROUGH*/ case DRV_CIPHER_ECB: /* Load key */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); + hw_desc_init(&desc[*seq_size]); + set_cipher_mode(&desc[*seq_size], cipher_mode); + set_cipher_config0(&desc[*seq_size], direction); if (flow_mode == S_DIN_to_AES) { if (ssi_is_hw_key(tfm)) { - HW_DESC_SET_HW_CRYPTO_KEY(&desc[*seq_size], ctx_p->hw.key1_slot); + set_hw_crypto_key(&desc[*seq_size], + ctx_p->hw.key1_slot); } else { - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - key_dma_addr, - ((key_len == 24) ? AES_MAX_KEY_SIZE : key_len), - NS_BIT); + set_din_type(&desc[*seq_size], DMA_DLLI, + key_dma_addr, ((key_len == 24) ? + AES_MAX_KEY_SIZE : + key_len), NS_BIT); } - HW_DESC_SET_KEY_SIZE_AES(&desc[*seq_size], key_len); + set_key_size_aes(&desc[*seq_size], key_len); } else { /*des*/ - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - key_dma_addr, key_len, - NS_BIT); - HW_DESC_SET_KEY_SIZE_DES(&desc[*seq_size], key_len); + set_din_type(&desc[*seq_size], DMA_DLLI, key_dma_addr, + key_len, NS_BIT); + set_key_size_des(&desc[*seq_size], key_len); } - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], flow_mode); - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_KEY0); + set_flow_mode(&desc[*seq_size], flow_mode); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_KEY0); (*seq_size)++; break; case DRV_CIPHER_XTS: case DRV_CIPHER_ESSIV: case DRV_CIPHER_BITLOCKER: /* Load AES key */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); + hw_desc_init(&desc[*seq_size]); + set_cipher_mode(&desc[*seq_size], cipher_mode); + set_cipher_config0(&desc[*seq_size], direction); if (ssi_is_hw_key(tfm)) { - HW_DESC_SET_HW_CRYPTO_KEY(&desc[*seq_size], ctx_p->hw.key1_slot); + set_hw_crypto_key(&desc[*seq_size], + ctx_p->hw.key1_slot); } else { - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - key_dma_addr, key_len/2, - NS_BIT); + set_din_type(&desc[*seq_size], DMA_DLLI, key_dma_addr, + (key_len / 2), NS_BIT); } - HW_DESC_SET_KEY_SIZE_AES(&desc[*seq_size], key_len/2); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], flow_mode); - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_KEY0); + set_key_size_aes(&desc[*seq_size], (key_len / 2)); + set_flow_mode(&desc[*seq_size], flow_mode); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_KEY0); (*seq_size)++; /* load XEX key */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); + hw_desc_init(&desc[*seq_size]); + set_cipher_mode(&desc[*seq_size], cipher_mode); + set_cipher_config0(&desc[*seq_size], direction); if (ssi_is_hw_key(tfm)) { - HW_DESC_SET_HW_CRYPTO_KEY(&desc[*seq_size], ctx_p->hw.key2_slot); + set_hw_crypto_key(&desc[*seq_size], + ctx_p->hw.key2_slot); } else { - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - (key_dma_addr+key_len/2), key_len/2, - NS_BIT); + set_din_type(&desc[*seq_size], DMA_DLLI, + (key_dma_addr + (key_len / 2)), + (key_len / 2), NS_BIT); } - HW_DESC_SET_XEX_DATA_UNIT_SIZE(&desc[*seq_size], du_size); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], S_DIN_to_AES2); - HW_DESC_SET_KEY_SIZE_AES(&desc[*seq_size], key_len/2); - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_XEX_KEY); + set_xex_data_unit_size(&desc[*seq_size], du_size); + set_flow_mode(&desc[*seq_size], S_DIN_to_AES2); + set_key_size_aes(&desc[*seq_size], (key_len / 2)); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_XEX_KEY); (*seq_size)++; /* Set state */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_STATE1); - HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); - HW_DESC_SET_KEY_SIZE_AES(&desc[*seq_size], key_len/2); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], flow_mode); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - iv_dma_addr, CC_AES_BLOCK_SIZE, - NS_BIT); + hw_desc_init(&desc[*seq_size]); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE1); + set_cipher_mode(&desc[*seq_size], cipher_mode); + set_cipher_config0(&desc[*seq_size], direction); + set_key_size_aes(&desc[*seq_size], (key_len / 2)); + set_flow_mode(&desc[*seq_size], flow_mode); + set_din_type(&desc[*seq_size], DMA_DLLI, iv_dma_addr, + CC_AES_BLOCK_SIZE, NS_BIT); (*seq_size)++; break; default: @@ -599,40 +596,36 @@ static inline void ssi_blkcipher_create_multi2_setup_desc( int direction = req_ctx->gen_ctx.op_type; /* Load system key */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], ctx_p->cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, ctx_p->user.key_dma_addr, - CC_MULTI2_SYSTEM_KEY_SIZE, - NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], ctx_p->flow_mode); - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_KEY0); + hw_desc_init(&desc[*seq_size]); + set_cipher_mode(&desc[*seq_size], ctx_p->cipher_mode); + set_cipher_config0(&desc[*seq_size], direction); + set_din_type(&desc[*seq_size], DMA_DLLI, ctx_p->user.key_dma_addr, + CC_MULTI2_SYSTEM_KEY_SIZE, NS_BIT); + set_flow_mode(&desc[*seq_size], ctx_p->flow_mode); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_KEY0); (*seq_size)++; /* load data key */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - (ctx_p->user.key_dma_addr + - CC_MULTI2_SYSTEM_KEY_SIZE), - CC_MULTI2_DATA_KEY_SIZE, NS_BIT); - HW_DESC_SET_MULTI2_NUM_ROUNDS(&desc[*seq_size], - ctx_p->key_round_number); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], ctx_p->flow_mode); - HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], ctx_p->cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_STATE0 ); + hw_desc_init(&desc[*seq_size]); + set_din_type(&desc[*seq_size], DMA_DLLI, + (ctx_p->user.key_dma_addr + CC_MULTI2_SYSTEM_KEY_SIZE), + CC_MULTI2_DATA_KEY_SIZE, NS_BIT); + set_multi2_num_rounds(&desc[*seq_size], ctx_p->key_round_number); + set_flow_mode(&desc[*seq_size], ctx_p->flow_mode); + set_cipher_mode(&desc[*seq_size], ctx_p->cipher_mode); + set_cipher_config0(&desc[*seq_size], direction); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE0); (*seq_size)++; /* Set state */ - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - req_ctx->gen_ctx.iv_dma_addr, - ivsize, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[*seq_size], direction); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], ctx_p->flow_mode); - HW_DESC_SET_CIPHER_MODE(&desc[*seq_size], ctx_p->cipher_mode); - HW_DESC_SET_SETUP_MODE(&desc[*seq_size], SETUP_LOAD_STATE1); + hw_desc_init(&desc[*seq_size]); + set_din_type(&desc[*seq_size], DMA_DLLI, req_ctx->gen_ctx.iv_dma_addr, + ivsize, NS_BIT); + set_cipher_config0(&desc[*seq_size], direction); + set_flow_mode(&desc[*seq_size], ctx_p->flow_mode); + set_cipher_mode(&desc[*seq_size], ctx_p->cipher_mode); + set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE1); (*seq_size)++; } @@ -675,18 +668,15 @@ ssi_blkcipher_create_data_desc( SSI_LOG_DEBUG(" data params addr 0x%llX length 0x%X \n", (unsigned long long)sg_dma_address(dst), nbytes); - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - sg_dma_address(src), - nbytes, NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[*seq_size], - sg_dma_address(dst), - nbytes, - NS_BIT, (areq == NULL)? 0:1); + hw_desc_init(&desc[*seq_size]); + set_din_type(&desc[*seq_size], DMA_DLLI, sg_dma_address(src), + nbytes, NS_BIT); + set_dout_dlli(&desc[*seq_size], sg_dma_address(dst), + nbytes, NS_BIT, (!areq ? 0 : 1)); if (areq != NULL) { - HW_DESC_SET_QUEUE_LAST_IND(&desc[*seq_size]); + set_queue_last_ind(&desc[*seq_size]); } - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], flow_mode); + set_flow_mode(&desc[*seq_size], flow_mode); (*seq_size)++; } else { /* bypass */ @@ -695,30 +685,29 @@ ssi_blkcipher_create_data_desc( (unsigned long long)req_ctx->mlli_params.mlli_dma_addr, req_ctx->mlli_params.mlli_len, (unsigned int)ctx_p->drvdata->mlli_sram_addr); - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_DLLI, - req_ctx->mlli_params.mlli_dma_addr, - req_ctx->mlli_params.mlli_len, - NS_BIT); - HW_DESC_SET_DOUT_SRAM(&desc[*seq_size], - ctx_p->drvdata->mlli_sram_addr, - req_ctx->mlli_params.mlli_len); - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], BYPASS); + hw_desc_init(&desc[*seq_size]); + set_din_type(&desc[*seq_size], DMA_DLLI, + req_ctx->mlli_params.mlli_dma_addr, + req_ctx->mlli_params.mlli_len, NS_BIT); + set_dout_sram(&desc[*seq_size], + ctx_p->drvdata->mlli_sram_addr, + req_ctx->mlli_params.mlli_len); + set_flow_mode(&desc[*seq_size], BYPASS); (*seq_size)++; - HW_DESC_INIT(&desc[*seq_size]); - HW_DESC_SET_DIN_TYPE(&desc[*seq_size], DMA_MLLI, - ctx_p->drvdata->mlli_sram_addr, - req_ctx->in_mlli_nents, NS_BIT); + hw_desc_init(&desc[*seq_size]); + set_din_type(&desc[*seq_size], DMA_MLLI, + ctx_p->drvdata->mlli_sram_addr, + req_ctx->in_mlli_nents, NS_BIT); if (req_ctx->out_nents == 0) { SSI_LOG_DEBUG(" din/dout params addr 0x%08X " "addr 0x%08X\n", (unsigned int)ctx_p->drvdata->mlli_sram_addr, (unsigned int)ctx_p->drvdata->mlli_sram_addr); - HW_DESC_SET_DOUT_MLLI(&desc[*seq_size], - ctx_p->drvdata->mlli_sram_addr, - req_ctx->in_mlli_nents, - NS_BIT,(areq == NULL)? 0:1); + set_dout_mlli(&desc[*seq_size], + ctx_p->drvdata->mlli_sram_addr, + req_ctx->in_mlli_nents, NS_BIT, + (!areq ? 0 : 1)); } else { SSI_LOG_DEBUG(" din/dout params " "addr 0x%08X addr 0x%08X\n", @@ -726,16 +715,17 @@ ssi_blkcipher_create_data_desc( (unsigned int)ctx_p->drvdata->mlli_sram_addr + (u32)LLI_ENTRY_BYTE_SIZE * req_ctx->in_nents); - HW_DESC_SET_DOUT_MLLI(&desc[*seq_size], - (ctx_p->drvdata->mlli_sram_addr + - LLI_ENTRY_BYTE_SIZE * - req_ctx->in_mlli_nents), - req_ctx->out_mlli_nents, NS_BIT,(areq == NULL)? 0:1); + set_dout_mlli(&desc[*seq_size], + (ctx_p->drvdata->mlli_sram_addr + + (LLI_ENTRY_BYTE_SIZE * + req_ctx->in_mlli_nents)), + req_ctx->out_mlli_nents, NS_BIT, + (!areq ? 0 : 1)); } if (areq != NULL) { - HW_DESC_SET_QUEUE_LAST_IND(&desc[*seq_size]); + set_queue_last_ind(&desc[*seq_size]); } - HW_DESC_SET_FLOW_MODE(&desc[*seq_size], flow_mode); + set_flow_mode(&desc[*seq_size], flow_mode); (*seq_size)++; } } diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index e034b0987137..c0bb1a142b89 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -41,16 +41,16 @@ #include "dx_reg_base_host.h" #include "dx_host.h" #define DX_CC_HOST_VIRT /* must be defined before including dx_cc_regs.h */ -#include "cc_hw_queue_defs.h" #include "cc_regs.h" #include "dx_reg_common.h" #include "cc_hal.h" -#include "ssi_sram_mgr.h" #define CC_SUPPORT_SHA DX_DEV_SHA_MAX #include "cc_crypto_ctx.h" #include "ssi_sysfs.h" #include "hash_defs.h" #include "ssi_fips_local.h" +#include "cc_hw_queue_defs.h" +#include "ssi_sram_mgr.h" #define DRV_MODULE_VERSION "3.0" diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index ef0a9a580560..cdfbf04d7ad3 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -325,74 +325,73 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, case DRV_CIPHER_CTR: case DRV_CIPHER_OFB: /* Load cipher state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - iv_dma_addr, iv_len, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direction); - HW_DESC_SET_FLOW_MODE(&desc[idx], s_flow_mode); - HW_DESC_SET_CIPHER_MODE(&desc[idx], cipher_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + iv_dma_addr, iv_len, NS_BIT); + set_cipher_config0(&desc[idx], direction); + set_flow_mode(&desc[idx], s_flow_mode); + set_cipher_mode(&desc[idx], cipher_mode); if ((cipher_mode == DRV_CIPHER_CTR) || (cipher_mode == DRV_CIPHER_OFB) ) { - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); } else { - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); } idx++; /*FALLTHROUGH*/ case DRV_CIPHER_ECB: /* Load key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direction); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], cipher_mode); + set_cipher_config0(&desc[idx], direction); if (is_aes) { - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, - ((key_len == 24) ? AES_MAX_KEY_SIZE : key_len), - NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_len); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, + ((key_len == 24) ? AES_MAX_KEY_SIZE : + key_len), NS_BIT); + set_key_size_aes(&desc[idx], key_len); } else {/*des*/ - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, key_len, - NS_BIT); - HW_DESC_SET_KEY_SIZE_DES(&desc[idx], key_len); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, + key_len, NS_BIT); + set_key_size_des(&desc[idx], key_len); } - HW_DESC_SET_FLOW_MODE(&desc[idx], s_flow_mode); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + set_flow_mode(&desc[idx], s_flow_mode); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; break; case DRV_CIPHER_XTS: /* Load AES key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direction); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, key_len/2, NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_len/2); - HW_DESC_SET_FLOW_MODE(&desc[idx], s_flow_mode); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], cipher_mode); + set_cipher_config0(&desc[idx], direction); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, (key_len / 2), + NS_BIT); + set_key_size_aes(&desc[idx], (key_len / 2)); + set_flow_mode(&desc[idx], s_flow_mode); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* load XEX key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direction); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (key_dma_addr+key_len/2), key_len/2, NS_BIT); - HW_DESC_SET_XEX_DATA_UNIT_SIZE(&desc[idx], data_size); - HW_DESC_SET_FLOW_MODE(&desc[idx], s_flow_mode); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_len/2); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_XEX_KEY); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], cipher_mode); + set_cipher_config0(&desc[idx], direction); + set_din_type(&desc[idx], DMA_DLLI, + (key_dma_addr + (key_len / 2)), + (key_len / 2), NS_BIT); + set_xex_data_unit_size(&desc[idx], data_size); + set_flow_mode(&desc[idx], s_flow_mode); + set_key_size_aes(&desc[idx], (key_len / 2)); + set_setup_mode(&desc[idx], SETUP_LOAD_XEX_KEY); idx++; /* Set state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_CIPHER_MODE(&desc[idx], cipher_mode); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], direction); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_len/2); - HW_DESC_SET_FLOW_MODE(&desc[idx], s_flow_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - iv_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT); + hw_desc_init(&desc[idx]); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_cipher_mode(&desc[idx], cipher_mode); + set_cipher_config0(&desc[idx], direction); + set_key_size_aes(&desc[idx], (key_len / 2)); + set_flow_mode(&desc[idx], s_flow_mode); + set_din_type(&desc[idx], DMA_DLLI, iv_dma_addr, + CC_AES_BLOCK_SIZE, NS_BIT); idx++; break; default: @@ -401,10 +400,10 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, } /* create data descriptor */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, din_dma_addr, data_size, NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], dout_dma_addr, data_size, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], is_aes ? DIN_AES_DOUT : DIN_DES_DOUT); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, din_dma_addr, data_size, NS_BIT); + set_dout_dlli(&desc[idx], dout_dma_addr, data_size, NS_BIT, 0); + set_flow_mode(&desc[idx], is_aes ? DIN_AES_DOUT : DIN_DES_DOUT); idx++; /* perform the operation - Lock HW and push sequence */ @@ -499,42 +498,42 @@ ssi_cmac_fips_run_test(struct ssi_drvdata *drvdata, int idx = 0; /* Setup CMAC Key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, key_dma_addr, - ((key_len == 24) ? AES_MAX_KEY_SIZE : key_len), NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CMAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_len); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, + ((key_len == 24) ? AES_MAX_KEY_SIZE : key_len), NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_cipher_mode(&desc[idx], DRV_CIPHER_CMAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], key_len); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* Load MAC state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, digest_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CMAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_len); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, digest_dma_addr, CC_AES_BLOCK_SIZE, + NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); + set_cipher_mode(&desc[idx], DRV_CIPHER_CMAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], key_len); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; //ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, false, &idx); - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - din_dma_addr, - din_len, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, din_dma_addr, din_len, NS_BIT); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DOUT_DLLI(&desc[idx], digest_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CMAC); + hw_desc_init(&desc[idx]); + set_dout_dlli(&desc[idx], digest_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT, + 0); + set_flow_mode(&desc[idx], S_AES_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_cipher_mode(&desc[idx], DRV_CIPHER_CMAC); idx++; /* perform the operation - Lock HW and push sequence */ @@ -644,41 +643,43 @@ ssi_hash_fips_run_test(struct ssi_drvdata *drvdata, int idx = 0; /* Load initial digest */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, initial_digest_dma_addr, inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_din_type(&desc[idx], DMA_DLLI, initial_digest_dma_addr, + inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, HASH_LEN_SIZE); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_din_const(&desc[idx], 0, HASH_LEN_SIZE); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* data descriptor */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, din_dma_addr, data_in_size, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, din_dma_addr, data_in_size, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_res_dma_addr, digest_size, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_dout_dlli(&desc[idx], mac_res_dma_addr, digest_size, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); if (unlikely((hash_mode == DRV_HASH_MD5) || (hash_mode == DRV_HASH_SHA384) || (hash_mode == DRV_HASH_SHA512))) { - HW_DESC_SET_BYTES_SWAP(&desc[idx], 1); + set_bytes_swap(&desc[idx], 1); } else { - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_cipher_config0(&desc[idx], + HASH_DIGEST_RESULT_LITTLE_ENDIAN); } idx++; @@ -831,20 +832,19 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, unsigned int hmacPadConst[2] = { HMAC_OPAD_CONST, HMAC_IPAD_CONST }; // assume (key_size <= block_size) - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, key_dma_addr, key_size, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], k0_dma_addr, key_size, NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, key_size, NS_BIT); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], k0_dma_addr, key_size, NS_BIT, 0); idx++; // if needed, append Key with zeros to create K0 if ((block_size - key_size) != 0) { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, (block_size - key_size)); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (k0_dma_addr + key_size), (block_size - key_size), - NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0, (block_size - key_size)); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], (k0_dma_addr + key_size), + (block_size - key_size), NS_BIT, 0); idx++; } @@ -859,50 +859,48 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, /* calc derived HMAC key */ for (i = 0; i < 2; i++) { /* Load hash initial state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, initial_digest_dma_addr, inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_din_type(&desc[idx], DMA_DLLI, initial_digest_dma_addr, + inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, HASH_LEN_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_din_const(&desc[idx], 0, HASH_LEN_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Prepare opad/ipad key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_XOR_VAL(&desc[idx], hmacPadConst[i]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); + hw_desc_init(&desc[idx]); + set_xor_val(&desc[idx], hmacPadConst[i]); + set_cipher_mode(&desc[idx], hw_mode); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); idx++; /* Perform HASH update */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - k0_dma_addr, - block_size, NS_BIT); - HW_DESC_SET_CIPHER_MODE(&desc[idx],hw_mode); - HW_DESC_SET_XOR_ACTIVE(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, k0_dma_addr, block_size, + NS_BIT); + set_cipher_mode(&desc[idx], hw_mode); + set_xor_active(&desc[idx]); + set_flow_mode(&desc[idx], DIN_HASH); idx++; if (i == 0) { /* First iteration - calc H(K0^opad) into tmp_digest_dma_addr */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - tmp_digest_dma_addr, - inter_digestsize, - NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_dout_dlli(&desc[idx], tmp_digest_dma_addr, + inter_digestsize, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; // is this needed?? or continue with current descriptors?? @@ -917,35 +915,34 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, } /* data descriptor */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - din_dma_addr, data_in_size, - NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, din_dma_addr, data_in_size, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* HW last hash block padding (aka. "DO_PAD") */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], k0_dma_addr, HASH_LEN_SIZE, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE1); - HW_DESC_SET_CIPHER_DO(&desc[idx], DO_PAD); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_dout_dlli(&desc[idx], k0_dma_addr, HASH_LEN_SIZE, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE1); + set_cipher_do(&desc[idx], DO_PAD); idx++; /* store the hash digest result in the context */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], k0_dma_addr, digest_size, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_dout_dlli(&desc[idx], k0_dma_addr, digest_size, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); if (unlikely((hash_mode == DRV_HASH_MD5) || (hash_mode == DRV_HASH_SHA384) || (hash_mode == DRV_HASH_SHA512))) { - HW_DESC_SET_BYTES_SWAP(&desc[idx], 1); + set_bytes_swap(&desc[idx], 1); } else { - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_cipher_config0(&desc[idx], + HASH_DIGEST_RESULT_LITTLE_ENDIAN); } - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; /* at this point: @@ -954,48 +951,51 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, */ /* Loading hash opad xor key state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, tmp_digest_dma_addr, inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_din_type(&desc[idx], DMA_DLLI, tmp_digest_dma_addr, + inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, digest_bytes_len_dma_addr, HASH_LEN_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_din_type(&desc[idx], DMA_DLLI, digest_bytes_len_dma_addr, + HASH_LEN_SIZE, NS_BIT); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Memory Barrier: wait for IPAD/OPAD axi write to complete */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* Perform HASH update */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, k0_dma_addr, digest_size, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, k0_dma_addr, digest_size, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_res_dma_addr, digest_size, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], hw_mode); + set_dout_dlli(&desc[idx], mac_res_dma_addr, digest_size, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); if (unlikely((hash_mode == DRV_HASH_MD5) || (hash_mode == DRV_HASH_SHA384) || (hash_mode == DRV_HASH_SHA512))) { - HW_DESC_SET_BYTES_SWAP(&desc[idx], 1); + set_bytes_swap(&desc[idx], 1); } else { - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_cipher_config0(&desc[idx], + HASH_DIGEST_RESULT_LITTLE_ENDIAN); } idx++; @@ -1143,99 +1143,102 @@ ssi_ccm_fips_run_test(struct ssi_drvdata *drvdata, } /* load key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, key_dma_addr, - ((key_size == NIST_AESCCM_192_BIT_KEY_SIZE) ? CC_AES_KEY_SIZE_MAX : key_size), - NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, + ((key_size == NIST_AESCCM_192_BIT_KEY_SIZE) ? + CC_AES_KEY_SIZE_MAX : key_size), NS_BIT) + set_key_size_aes(&desc[idx], key_size); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* load ctr state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - iv_dma_addr, AES_BLOCK_SIZE, - NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); + set_key_size_aes(&desc[idx], key_size); + set_din_type(&desc[idx], DMA_DLLI, iv_dma_addr, AES_BLOCK_SIZE, + NS_BIT); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* load MAC key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, key_dma_addr, - ((key_size == NIST_AESCCM_192_BIT_KEY_SIZE) ? CC_AES_KEY_SIZE_MAX : key_size), - NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, + ((key_size == NIST_AESCCM_192_BIT_KEY_SIZE) ? + CC_AES_KEY_SIZE_MAX : key_size), NS_BIT); + set_key_size_aes(&desc[idx], key_size); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); idx++; /* load MAC state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); + set_key_size_aes(&desc[idx], key_size); + set_din_type(&desc[idx], DMA_DLLI, mac_res_dma_addr, + NIST_AESCCM_TAG_SIZE, NS_BIT); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); idx++; /* prcess assoc data */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, b0_a0_adata_dma_addr, b0_a0_adata_size, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, b0_a0_adata_dma_addr, + b0_a0_adata_size, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* process the cipher */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, din_dma_addr, din_size, NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], dout_dma_addr, din_size, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], cipher_flow_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, din_dma_addr, din_size, NS_BIT); + set_dout_dlli(&desc[idx], dout_dma_addr, din_size, NS_BIT, 0); + set_flow_mode(&desc[idx], cipher_flow_mode); idx++; /* Read temporal MAC */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CBC_MAC); - HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, NS_BIT, 0); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); + set_dout_dlli(&desc[idx], mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, + NS_BIT, 0); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_aes_not_hash_mode(&desc[idx]); idx++; /* load AES-CTR state (for last MAC calculation)*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CTR); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctr_cnt_0_dma_addr, - AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_din_type(&desc[idx], DMA_DLLI, ctr_cnt_0_dma_addr, AES_BLOCK_SIZE, + NS_BIT); + set_key_size_aes(&desc[idx], key_size); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* Memory Barrier */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* encrypt the "T" value and store MAC inplace */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, mac_res_dma_addr, + NIST_AESCCM_TAG_SIZE, NS_BIT); + set_dout_dlli(&desc[idx], mac_res_dma_addr, NIST_AESCCM_TAG_SIZE, + NS_BIT, 0); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; /* perform the operation - Lock HW and push sequence */ @@ -1373,44 +1376,39 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, // ssi_aead_gcm_setup_ghash_desc(req, desc, seq_size); ///////////////////////////////// 1 //////////////////////////////////// - /* load key to AES*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], - DMA_DLLI, key_dma_addr, key_size, - NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + /* load key to AES */ + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_ECB); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, key_size, NS_BIT); + set_key_size_aes(&desc[idx], key_size); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* process one zero block to generate hkey */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0x0, AES_BLOCK_SIZE); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - hkey_dma_addr, AES_BLOCK_SIZE, - NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0x0, AES_BLOCK_SIZE); + set_dout_dlli(&desc[idx], hkey_dma_addr, AES_BLOCK_SIZE, NS_BIT, 0); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; /* Memory Barrier */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* Load GHASH subkey */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - hkey_dma_addr, AES_BLOCK_SIZE, - NS_BIT); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, hkey_dma_addr, AES_BLOCK_SIZE, + NS_BIT); + set_dout_no_dma(&desc[idx], 0, 0, 1); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Configure Hash Engine to work with GHASH. @@ -1418,27 +1416,27 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, * The following command is necessary in order to * select GHASH (according to HW designers) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_DO(&desc[idx], 1); //1=AES_SK RKEK - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); + set_cipher_do(&desc[idx], 1); //1=AES_SK RKEK + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Load GHASH initial STATE (which is 0). (for any hash there is an initial state) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0x0, AES_BLOCK_SIZE); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0x0, AES_BLOCK_SIZE); + set_dout_no_dma(&desc[idx], 0, 0, 1); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_aes_not_hash_mode(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; @@ -1449,11 +1447,9 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, // ssi_aead_create_assoc_desc(req, DIN_HASH, desc, seq_size); ///////////////////////////////// 2 //////////////////////////////////// - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - adata_dma_addr, adata_size, - NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, adata_dma_addr, adata_size, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; @@ -1462,27 +1458,24 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, ///////////////////////////////// 3 //////////////////////////////////// /* load key to AES*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - key_dma_addr, key_size, - NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, key_size, NS_BIT); + set_key_size_aes(&desc[idx], key_size); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* load AES/CTR initial CTR value inc by 2*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - iv_inc2_dma_addr, AES_BLOCK_SIZE, - NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); + set_key_size_aes(&desc[idx], key_size); + set_din_type(&desc[idx], DMA_DLLI, iv_inc2_dma_addr, AES_BLOCK_SIZE, + NS_BIT); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; @@ -1492,14 +1485,10 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, // ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, seq_size); ///////////////////////////////// 4 //////////////////////////////////// - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - din_dma_addr, din_size, - NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - dout_dma_addr, din_size, - NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], cipher_flow_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, din_dma_addr, din_size, NS_BIT); + set_dout_dlli(&desc[idx], dout_dma_addr, din_size, NS_BIT, 0); + set_flow_mode(&desc[idx], cipher_flow_mode); idx++; @@ -1508,53 +1497,46 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, ///////////////////////////////// 5 //////////////////////////////////// /* prcess(ghash) gcm_block_len */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - block_len_dma_addr, AES_BLOCK_SIZE, - NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, block_len_dma_addr, AES_BLOCK_SIZE, + NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* Store GHASH state after GHASH(Associated Data + Cipher +LenBlock) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_HASH_HW_GHASH); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - mac_res_dma_addr, AES_BLOCK_SIZE, - NS_BIT, 0); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_AES_NOT_HASH_MODE(&desc[idx]); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_dlli(&desc[idx], mac_res_dma_addr, AES_BLOCK_SIZE, NS_BIT, 0); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_aes_not_hash_mode(&desc[idx]); idx++; /* load AES/CTR initial CTR value inc by 1*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_size); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - iv_inc1_dma_addr, AES_BLOCK_SIZE, - NS_BIT); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); + set_key_size_aes(&desc[idx], key_size); + set_din_type(&desc[idx], DMA_DLLI, iv_inc1_dma_addr, AES_BLOCK_SIZE, + NS_BIT); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* Memory Barrier */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* process GCTR on stored GHASH and store MAC inplace */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_GCTR); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - mac_res_dma_addr, AES_BLOCK_SIZE, - NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - mac_res_dma_addr, AES_BLOCK_SIZE, - NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); + set_din_type(&desc[idx], DMA_DLLI, mac_res_dma_addr, AES_BLOCK_SIZE, + NS_BIT); + set_dout_dlli(&desc[idx], mac_res_dma_addr, AES_BLOCK_SIZE, NS_BIT, 0); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; /* perform the operation - Lock HW and push sequence */ diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index da5915e4ce48..8ab6b9e1e264 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -126,9 +126,9 @@ static inline void ssi_set_hash_endianity(u32 mode, struct cc_hw_desc *desc) if (unlikely((mode == DRV_HASH_MD5) || (mode == DRV_HASH_SHA384) || (mode == DRV_HASH_SHA512))) { - HW_DESC_SET_BYTES_SWAP(desc, 1); + set_bytes_swap(desc, 1); } else { - HW_DESC_SET_CIPHER_CONFIG0(desc, HASH_DIGEST_RESULT_LITTLE_ENDIAN); + set_cipher_config0(desc, HASH_DIGEST_RESULT_LITTLE_ENDIAN); } } @@ -253,10 +253,11 @@ static int ssi_hash_map_request(struct device *dev, /* Copy the initial digests if hash flow. The SRAM contains the * initial digests in the expected order for all SHA* */ - HW_DESC_INIT(&desc); - HW_DESC_SET_DIN_SRAM(&desc, larval_digest_addr, ctx->inter_digestsize); - HW_DESC_SET_DOUT_DLLI(&desc, state->digest_buff_dma_addr, ctx->inter_digestsize, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc, BYPASS); + hw_desc_init(&desc); + set_din_sram(&desc, larval_digest_addr, ctx->inter_digestsize); + set_dout_dlli(&desc, state->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT, 0); + set_flow_mode(&desc, BYPASS); rc = send_request(ctx->drvdata, &ssi_req, &desc, 1, 0); if (unlikely(rc != 0)) { @@ -488,96 +489,108 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, } /* If HMAC then load hash IPAD xor key, if HASH then load initial digest */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); if (is_hmac) { - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, ctx->inter_digestsize, NS_BIT); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT); } else { - HW_DESC_SET_DIN_SRAM(&desc[idx], larval_digest_addr, ctx->inter_digestsize); + set_din_sram(&desc[idx], larval_digest_addr, + ctx->inter_digestsize); } - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); if (is_hmac) { - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, NS_BIT); + set_din_type(&desc[idx], DMA_DLLI, + state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, + NS_BIT); } else { - HW_DESC_SET_DIN_CONST(&desc[idx], 0, HASH_LEN_SIZE); + set_din_const(&desc[idx], 0, HASH_LEN_SIZE); if (likely(nbytes != 0)) { - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); } else { - HW_DESC_SET_CIPHER_DO(&desc[idx], DO_PAD); + set_cipher_do(&desc[idx], DO_PAD); } } - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; ssi_hash_create_data_desc(state, ctx, DIN_HASH, desc, false, &idx); if (is_hmac) { /* HW last hash block padding (aka. "DO_PAD") */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_buff_dma_addr, HASH_LEN_SIZE, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE1); - HW_DESC_SET_CIPHER_DO(&desc[idx], DO_PAD); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, + HASH_LEN_SIZE, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE1); + set_cipher_do(&desc[idx], DO_PAD); idx++; /* store the hash digest result in the context */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_buff_dma_addr, digestsize, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, + digestsize, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); ssi_set_hash_endianity(ctx->hash_mode, &desc[idx]); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; /* Loading hash opad xor key state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, ctx->inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, + ctx->inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_SRAM(&desc[idx], ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_sram(&desc[idx], + ssi_ahash_get_initial_digest_len_sram_addr( +ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Memory Barrier: wait for IPAD/OPAD axi write to complete */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* Perform HASH update */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + digestsize, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; } /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, async_req? 1:0); /*TODO*/ + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + /* TODO */ + set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, + NS_BIT, (async_req ? 1 : 0)); if (async_req) { - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); + set_queue_last_ind(&desc[idx]); } - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); ssi_set_hash_endianity(ctx->hash_mode, &desc[idx]); idx++; @@ -646,39 +659,43 @@ static int ssi_hash_update(struct ahash_req_ctx *state, } /* Restore hash digest */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, ctx->inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Restore hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; ssi_hash_create_data_desc(state, ctx, DIN_HASH, desc, false, &idx); /* store the hash digest result in context */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_buff_dma_addr, ctx->inter_digestsize, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; /* store current hash length in context */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, NS_BIT, async_req? 1:0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, NS_BIT, (async_req ? 1 : 0)); if (async_req) { - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); + set_queue_last_ind(&desc[idx]); } - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE1); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE1); idx++; if (async_req) { @@ -737,75 +754,84 @@ static int ssi_hash_finup(struct ahash_req_ctx *state, } /* Restore hash digest */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, ctx->inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Restore hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_din_type(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; ssi_hash_create_data_desc(state, ctx, DIN_HASH, desc, false, &idx); if (is_hmac) { /* Store the hash digest result in the context */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_buff_dma_addr, digestsize, NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, + digestsize, NS_BIT, 0); ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; /* Loading hash OPAD xor key state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, ctx->inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, + ctx->inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_SRAM(&desc[idx], ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_sram(&desc[idx], + ssi_ahash_get_initial_digest_len_sram_addr( +ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Memory Barrier: wait for IPAD/OPAD axi write to complete */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* Perform HASH update on last digest */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + digestsize, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; } /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, async_req? 1:0); /*TODO*/ + hw_desc_init(&desc[idx]); + /* TODO */ + set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, + NS_BIT, (async_req ? 1 : 0)); if (async_req) { - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); + set_queue_last_ind(&desc[idx]); } - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; if (async_req) { @@ -869,84 +895,93 @@ static int ssi_hash_final(struct ahash_req_ctx *state, } /* Restore hash digest */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, ctx->inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Restore hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); + set_din_type(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; ssi_hash_create_data_desc(state, ctx, DIN_HASH, desc, false, &idx); /* "DO-PAD" must be enabled only when writing current length to HW */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_DO(&desc[idx], DO_PAD); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, NS_BIT, 0); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE1); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); + hw_desc_init(&desc[idx]); + set_cipher_do(&desc[idx], DO_PAD); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, NS_BIT, 0); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE1); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); idx++; if (is_hmac) { /* Store the hash digest result in the context */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_buff_dma_addr, digestsize, NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, + digestsize, NS_BIT, 0); ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; /* Loading hash OPAD xor key state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, ctx->inter_digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, + ctx->inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_SRAM(&desc[idx], ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_sram(&desc[idx], + ssi_ahash_get_initial_digest_len_sram_addr( +ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Memory Barrier: wait for IPAD/OPAD axi write to complete */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; /* Perform HASH update on last digest */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, digestsize, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + digestsize, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; } /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, async_req? 1:0); + hw_desc_init(&desc[idx]); + set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, + NS_BIT, (async_req ? 1 : 0)); if (async_req) { - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); + set_queue_last_ind(&desc[idx]); } - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; if (async_req) { @@ -1054,79 +1089,76 @@ static int ssi_hash_setkey(void *hash, if (keylen > blocksize) { /* Load hash initial state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_SRAM(&desc[idx], larval_addr, - ctx->inter_digestsize); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_sram(&desc[idx], larval_addr, + ctx->inter_digestsize); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, HASH_LEN_SIZE); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_ENABLED); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_const(&desc[idx], 0, HASH_LEN_SIZE); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctx->key_params.key_dma_addr, - keylen, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + ctx->key_params.key_dma_addr, keylen, + NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* Get hashed key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], ctx->opad_tmp_keys_dma_addr, - digestsize, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG1(&desc[idx], HASH_PADDING_DISABLED); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], ctx->opad_tmp_keys_dma_addr, + digestsize, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); idx++; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, (blocksize - digestsize)); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (ctx->opad_tmp_keys_dma_addr + digestsize), - (blocksize - digestsize), - NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0, (blocksize - digestsize)); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], (ctx->opad_tmp_keys_dma_addr + + digestsize), + (blocksize - digestsize), NS_BIT, 0); idx++; } else { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctx->key_params.key_dma_addr, - keylen, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (ctx->opad_tmp_keys_dma_addr), - keylen, NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + ctx->key_params.key_dma_addr, keylen, + NS_BIT); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], ctx->opad_tmp_keys_dma_addr, + keylen, NS_BIT, 0); idx++; if ((blocksize - keylen) != 0) { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, (blocksize - keylen)); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (ctx->opad_tmp_keys_dma_addr + keylen), - (blocksize - keylen), - NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0, + (blocksize - keylen)); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], + (ctx->opad_tmp_keys_dma_addr + + keylen), (blocksize - keylen), + NS_BIT, 0); idx++; } } } else { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, blocksize); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); - HW_DESC_SET_DOUT_DLLI(&desc[idx], - (ctx->opad_tmp_keys_dma_addr), - blocksize, - NS_BIT, 0); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0, blocksize); + set_flow_mode(&desc[idx], BYPASS); + set_dout_dlli(&desc[idx], (ctx->opad_tmp_keys_dma_addr), + blocksize, NS_BIT, 0); idx++; } @@ -1139,55 +1171,49 @@ static int ssi_hash_setkey(void *hash, /* calc derived HMAC key */ for (idx = 0, i = 0; i < 2; i++) { /* Load hash initial state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_SRAM(&desc[idx], larval_addr, - ctx->inter_digestsize); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_sram(&desc[idx], larval_addr, ctx->inter_digestsize); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; /* Load the hash current length*/ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DIN_CONST(&desc[idx], 0, HASH_LEN_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_const(&desc[idx], 0, HASH_LEN_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Prepare ipad key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_XOR_VAL(&desc[idx], hmacPadConst[i]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_HASH); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); + hw_desc_init(&desc[idx]); + set_xor_val(&desc[idx], hmacPadConst[i]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); idx++; /* Perform HASH update */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - ctx->opad_tmp_keys_dma_addr, - blocksize, NS_BIT); - HW_DESC_SET_CIPHER_MODE(&desc[idx],ctx->hw_mode); - HW_DESC_SET_XOR_ACTIVE(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_HASH); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, ctx->opad_tmp_keys_dma_addr, + blocksize, NS_BIT); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_xor_active(&desc[idx]); + set_flow_mode(&desc[idx], DIN_HASH); idx++; /* Get the IPAD/OPAD xor key (Note, IPAD is the initial digest of the first HASH "update" state) */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); if (i > 0) /* Not first iteration */ - HW_DESC_SET_DOUT_DLLI(&desc[idx], - ctx->opad_tmp_keys_dma_addr, - ctx->inter_digestsize, - NS_BIT, 0); + set_dout_dlli(&desc[idx], ctx->opad_tmp_keys_dma_addr, + ctx->inter_digestsize, NS_BIT, 0); else /* First iteration */ - HW_DESC_SET_DOUT_DLLI(&desc[idx], - ctx->digest_buff_dma_addr, - ctx->inter_digestsize, - NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_HASH_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + set_dout_dlli(&desc[idx], ctx->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; } @@ -1255,35 +1281,36 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, ctx->is_hmac = true; /* 1. Load the AES key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->key_params.key_dma_addr, keylen, NS_BIT); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], keylen); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, ctx->key_params.key_dma_addr, + keylen, NS_BIT); + set_cipher_mode(&desc[idx], DRV_CIPHER_ECB); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); + set_key_size_aes(&desc[idx], keylen); + set_flow_mode(&desc[idx], S_DIN_to_AES); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0x01010101, CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0x01010101, CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], DIN_AES_DOUT); + set_dout_dlli(&desc[idx], (ctx->opad_tmp_keys_dma_addr + XCBC_MAC_K1_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT, 0); idx++; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0x02020202, CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0x02020202, CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], DIN_AES_DOUT); + set_dout_dlli(&desc[idx], (ctx->opad_tmp_keys_dma_addr + XCBC_MAC_K2_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT, 0); idx++; - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0x03030303, CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], (ctx->opad_tmp_keys_dma_addr + + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0x03030303, CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], DIN_AES_DOUT); + set_dout_dlli(&desc[idx], (ctx->opad_tmp_keys_dma_addr + XCBC_MAC_K3_OFFSET), CC_AES_128_BIT_KEY_SIZE, NS_BIT, 0); idx++; @@ -1506,12 +1533,13 @@ static int ssi_mac_update(struct ahash_request *req) ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, true, &idx); /* store the hash digest result in context */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_buff_dma_addr, ctx->inter_digestsize, NS_BIT, 1); - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT, 1); + set_queue_last_ind(&desc[idx]); + set_flow_mode(&desc[idx], S_AES_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; /* Setup DX request structure */ @@ -1576,30 +1604,31 @@ static int ssi_mac_final(struct ahash_request *req) if (state->xcbc_count && (rem_cnt == 0)) { /* Load key for ECB decryption */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_ECB); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DRV_CRYPTO_DIRECTION_DECRYPT); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - (ctx->opad_tmp_keys_dma_addr + - XCBC_MAC_K1_OFFSET), - keySize, NS_BIT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], keyLen); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], DRV_CIPHER_ECB); + set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_DECRYPT); + set_din_type(&desc[idx], DMA_DLLI, + (ctx->opad_tmp_keys_dma_addr + + XCBC_MAC_K1_OFFSET), keySize, NS_BIT); + set_key_size_aes(&desc[idx], keyLen); + set_flow_mode(&desc[idx], S_DIN_to_AES); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; /* Initiate decryption of block state to previous block_state-XOR-M[n] */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_buff_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT,0); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + CC_AES_BLOCK_SIZE, NS_BIT); + set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, + CC_AES_BLOCK_SIZE, NS_BIT, 0); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; /* Memory Barrier: wait for axi write to complete */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_NO_DMA(&desc[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&desc[idx], 0, 0, 1); + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); idx++; } @@ -1610,28 +1639,30 @@ static int ssi_mac_final(struct ahash_request *req) } if (state->xcbc_count == 0) { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], keyLen); - HW_DESC_SET_CMAC_SIZE0_MODE(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_key_size_aes(&desc[idx], keyLen); + set_cmac_size0_mode(&desc[idx]); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; } else if (rem_cnt > 0) { ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, false, &idx); } else { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_CONST(&desc[idx], 0x00, CC_AES_BLOCK_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], DIN_AES_DOUT); + hw_desc_init(&desc[idx]); + set_din_const(&desc[idx], 0x00, CC_AES_BLOCK_SIZE); + set_flow_mode(&desc[idx], DIN_AES_DOUT); idx++; } /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, 1); /*TODO*/ - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + hw_desc_init(&desc[idx]); + /* TODO */ + set_dout_dlli(&desc[idx], state->digest_result_dma_addr, + digestsize, NS_BIT, 1); + set_queue_last_ind(&desc[idx]); + set_flow_mode(&desc[idx], S_AES_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1); @@ -1688,23 +1719,25 @@ static int ssi_mac_finup(struct ahash_request *req) } if (req->nbytes == 0) { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], key_len); - HW_DESC_SET_CMAC_SIZE0_MODE(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_key_size_aes(&desc[idx], key_len); + set_cmac_size0_mode(&desc[idx]); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; } else { ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, false, &idx); } /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, 1); /*TODO*/ - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + hw_desc_init(&desc[idx]); + /* TODO */ + set_dout_dlli(&desc[idx], state->digest_result_dma_addr, + digestsize, NS_BIT, 1); + set_queue_last_ind(&desc[idx]); + set_flow_mode(&desc[idx], S_AES_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1); @@ -1763,24 +1796,25 @@ static int ssi_mac_digest(struct ahash_request *req) } if (req->nbytes == 0) { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], keyLen); - HW_DESC_SET_CMAC_SIZE0_MODE(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_key_size_aes(&desc[idx], keyLen); + set_cmac_size0_mode(&desc[idx]); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; } else { ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, false, &idx); } /* Get final MAC result */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DOUT_DLLI(&desc[idx], state->digest_result_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT,1); - HW_DESC_SET_QUEUE_LAST_IND(&desc[idx]); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_AES_to_DOUT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_WRITE_STATE0); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx],DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_CIPHER_MODE(&desc[idx], ctx->hw_mode); + hw_desc_init(&desc[idx]); + set_dout_dlli(&desc[idx], state->digest_result_dma_addr, + CC_AES_BLOCK_SIZE, NS_BIT, 1); + set_queue_last_ind(&desc[idx]); + set_flow_mode(&desc[idx], S_AES_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1); @@ -2554,49 +2588,50 @@ static void ssi_hash_create_xcbc_setup(struct ahash_request *areq, struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); /* Setup XCBC MAC K1 */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr - + XCBC_MAC_K1_OFFSET), - CC_AES_128_BIT_KEY_SIZE, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + + XCBC_MAC_K1_OFFSET), + CC_AES_128_BIT_KEY_SIZE, NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* Setup XCBC MAC K2 */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr - + XCBC_MAC_K2_OFFSET), - CC_AES_128_BIT_KEY_SIZE, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + + XCBC_MAC_K2_OFFSET), + CC_AES_128_BIT_KEY_SIZE, NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* Setup XCBC MAC K3 */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr - + XCBC_MAC_K3_OFFSET), - CC_AES_128_BIT_KEY_SIZE, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE2); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, (ctx->opad_tmp_keys_dma_addr + + XCBC_MAC_K3_OFFSET), + CC_AES_128_BIT_KEY_SIZE, NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE2); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* Loading MAC state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_XCBC_MAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + CC_AES_BLOCK_SIZE, NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); + set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; *seq_size = idx; } @@ -2611,24 +2646,26 @@ static void ssi_hash_create_cmac_setup(struct ahash_request *areq, struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm); /* Setup CMAC Key */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, ctx->opad_tmp_keys_dma_addr, - ((ctx->key_params.keylen == 24) ? AES_MAX_KEY_SIZE : ctx->key_params.keylen), NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CMAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->key_params.keylen); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, ctx->opad_tmp_keys_dma_addr, + ((ctx->key_params.keylen == 24) ? AES_MAX_KEY_SIZE : + ctx->key_params.keylen), NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + set_cipher_mode(&desc[idx], DRV_CIPHER_CMAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], ctx->key_params.keylen); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; /* Load MAC state */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, CC_AES_BLOCK_SIZE, NS_BIT); - HW_DESC_SET_SETUP_MODE(&desc[idx], SETUP_LOAD_STATE0); - HW_DESC_SET_CIPHER_MODE(&desc[idx], DRV_CIPHER_CMAC); - HW_DESC_SET_CIPHER_CONFIG0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_KEY_SIZE_AES(&desc[idx], ctx->key_params.keylen); - HW_DESC_SET_FLOW_MODE(&desc[idx], S_DIN_to_AES); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + CC_AES_BLOCK_SIZE, NS_BIT); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); + set_cipher_mode(&desc[idx], DRV_CIPHER_CMAC); + set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_key_size_aes(&desc[idx], ctx->key_params.keylen); + set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; *seq_size = idx; } @@ -2643,11 +2680,11 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, unsigned int idx = *seq_size; if (likely(areq_ctx->data_dma_buf_type == SSI_DMA_BUF_DLLI)) { - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - sg_dma_address(areq_ctx->curr_sg), - areq_ctx->curr_sg->length, NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + sg_dma_address(areq_ctx->curr_sg), + areq_ctx->curr_sg->length, NS_BIT); + set_flow_mode(&desc[idx], flow_mode); idx++; } else { if (areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) { @@ -2656,27 +2693,24 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, return; } /* bypass */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_DLLI, - areq_ctx->mlli_params.mlli_dma_addr, - areq_ctx->mlli_params.mlli_len, - NS_BIT); - HW_DESC_SET_DOUT_SRAM(&desc[idx], - ctx->drvdata->mlli_sram_addr, - areq_ctx->mlli_params.mlli_len); - HW_DESC_SET_FLOW_MODE(&desc[idx], BYPASS); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, + areq_ctx->mlli_params.mlli_dma_addr, + areq_ctx->mlli_params.mlli_len, NS_BIT); + set_dout_sram(&desc[idx], ctx->drvdata->mlli_sram_addr, + areq_ctx->mlli_params.mlli_len); + set_flow_mode(&desc[idx], BYPASS); idx++; /* process */ - HW_DESC_INIT(&desc[idx]); - HW_DESC_SET_DIN_TYPE(&desc[idx], DMA_MLLI, - ctx->drvdata->mlli_sram_addr, - areq_ctx->mlli_nents, - NS_BIT); - HW_DESC_SET_FLOW_MODE(&desc[idx], flow_mode); + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_MLLI, + ctx->drvdata->mlli_sram_addr, + areq_ctx->mlli_nents, NS_BIT); + set_flow_mode(&desc[idx], flow_mode); idx++; } if (is_not_last_data) { - HW_DESC_SET_DIN_NOT_LAST_INDICATION(&desc[idx-1]); + set_din_not_last_indication(&desc[(idx - 1)]); } /* return updated desc sequence size */ *seq_size = idx; diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index db4b831e82a3..233666b8d2eb 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -69,37 +69,37 @@ static int ssi_ivgen_generate_pool( return -EINVAL; } /* Setup key */ - HW_DESC_INIT(&iv_seq[idx]); - HW_DESC_SET_DIN_SRAM(&iv_seq[idx], ivgen_ctx->ctr_key, AES_KEYSIZE_128); - HW_DESC_SET_SETUP_MODE(&iv_seq[idx], SETUP_LOAD_KEY0); - HW_DESC_SET_CIPHER_CONFIG0(&iv_seq[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_FLOW_MODE(&iv_seq[idx], S_DIN_to_AES); - HW_DESC_SET_KEY_SIZE_AES(&iv_seq[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_CIPHER_MODE(&iv_seq[idx], DRV_CIPHER_CTR); + hw_desc_init(&iv_seq[idx]); + set_din_sram(&iv_seq[idx], ivgen_ctx->ctr_key, AES_KEYSIZE_128); + set_setup_mode(&iv_seq[idx], SETUP_LOAD_KEY0); + set_cipher_config0(&iv_seq[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_flow_mode(&iv_seq[idx], S_DIN_to_AES); + set_key_size_aes(&iv_seq[idx], CC_AES_128_BIT_KEY_SIZE); + set_cipher_mode(&iv_seq[idx], DRV_CIPHER_CTR); idx++; /* Setup cipher state */ - HW_DESC_INIT(&iv_seq[idx]); - HW_DESC_SET_DIN_SRAM(&iv_seq[idx], ivgen_ctx->ctr_iv, CC_AES_IV_SIZE); - HW_DESC_SET_CIPHER_CONFIG0(&iv_seq[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); - HW_DESC_SET_FLOW_MODE(&iv_seq[idx], S_DIN_to_AES); - HW_DESC_SET_SETUP_MODE(&iv_seq[idx], SETUP_LOAD_STATE1); - HW_DESC_SET_KEY_SIZE_AES(&iv_seq[idx], CC_AES_128_BIT_KEY_SIZE); - HW_DESC_SET_CIPHER_MODE(&iv_seq[idx], DRV_CIPHER_CTR); + hw_desc_init(&iv_seq[idx]); + set_din_sram(&iv_seq[idx], ivgen_ctx->ctr_iv, CC_AES_IV_SIZE); + set_cipher_config0(&iv_seq[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); + set_flow_mode(&iv_seq[idx], S_DIN_to_AES); + set_setup_mode(&iv_seq[idx], SETUP_LOAD_STATE1); + set_key_size_aes(&iv_seq[idx], CC_AES_128_BIT_KEY_SIZE); + set_cipher_mode(&iv_seq[idx], DRV_CIPHER_CTR); idx++; /* Perform dummy encrypt to skip first block */ - HW_DESC_INIT(&iv_seq[idx]); - HW_DESC_SET_DIN_CONST(&iv_seq[idx], 0, CC_AES_IV_SIZE); - HW_DESC_SET_DOUT_SRAM(&iv_seq[idx], ivgen_ctx->pool, CC_AES_IV_SIZE); - HW_DESC_SET_FLOW_MODE(&iv_seq[idx], DIN_AES_DOUT); + hw_desc_init(&iv_seq[idx]); + set_din_const(&iv_seq[idx], 0, CC_AES_IV_SIZE); + set_dout_sram(&iv_seq[idx], ivgen_ctx->pool, CC_AES_IV_SIZE); + set_flow_mode(&iv_seq[idx], DIN_AES_DOUT); idx++; /* Generate IV pool */ - HW_DESC_INIT(&iv_seq[idx]); - HW_DESC_SET_DIN_CONST(&iv_seq[idx], 0, SSI_IVPOOL_SIZE); - HW_DESC_SET_DOUT_SRAM(&iv_seq[idx], ivgen_ctx->pool, SSI_IVPOOL_SIZE); - HW_DESC_SET_FLOW_MODE(&iv_seq[idx], DIN_AES_DOUT); + hw_desc_init(&iv_seq[idx]); + set_din_const(&iv_seq[idx], 0, SSI_IVPOOL_SIZE); + set_dout_sram(&iv_seq[idx], ivgen_ctx->pool, SSI_IVPOOL_SIZE); + set_flow_mode(&iv_seq[idx], DIN_AES_DOUT); idx++; *iv_seq_len = idx; /* Update sequence length */ @@ -133,13 +133,12 @@ int ssi_ivgen_init_sram_pool(struct ssi_drvdata *drvdata) ivgen_ctx->ctr_iv = ivgen_ctx->pool + AES_KEYSIZE_128; /* Copy initial enc. key and IV to SRAM at a single descriptor */ - HW_DESC_INIT(&iv_seq[iv_seq_len]); - HW_DESC_SET_DIN_TYPE(&iv_seq[iv_seq_len], DMA_DLLI, - ivgen_ctx->pool_meta_dma, SSI_IVPOOL_META_SIZE, - NS_BIT); - HW_DESC_SET_DOUT_SRAM(&iv_seq[iv_seq_len], ivgen_ctx->pool, - SSI_IVPOOL_META_SIZE); - HW_DESC_SET_FLOW_MODE(&iv_seq[iv_seq_len], BYPASS); + hw_desc_init(&iv_seq[iv_seq_len]); + set_din_type(&iv_seq[iv_seq_len], DMA_DLLI, ivgen_ctx->pool_meta_dma, + SSI_IVPOOL_META_SIZE, NS_BIT); + set_dout_sram(&iv_seq[iv_seq_len], ivgen_ctx->pool, + SSI_IVPOOL_META_SIZE); + set_flow_mode(&iv_seq[iv_seq_len], BYPASS); iv_seq_len++; /* Generate initial pool */ @@ -268,22 +267,22 @@ int ssi_ivgen_getiv( for (t = 0; t < iv_out_dma_len; t++) { /* Acquire IV from pool */ - HW_DESC_INIT(&iv_seq[idx]); - HW_DESC_SET_DIN_SRAM(&iv_seq[idx], - ivgen_ctx->pool + ivgen_ctx->next_iv_ofs, - iv_out_size); - HW_DESC_SET_DOUT_DLLI(&iv_seq[idx], iv_out_dma[t], - iv_out_size, NS_BIT, 0); - HW_DESC_SET_FLOW_MODE(&iv_seq[idx], BYPASS); + hw_desc_init(&iv_seq[idx]); + set_din_sram(&iv_seq[idx], (ivgen_ctx->pool + + ivgen_ctx->next_iv_ofs), + iv_out_size); + set_dout_dlli(&iv_seq[idx], iv_out_dma[t], iv_out_size, + NS_BIT, 0); + set_flow_mode(&iv_seq[idx], BYPASS); idx++; } /* Bypass operation is proceeded by crypto sequence, hence must * assure bypass-write-transaction by a memory barrier */ - HW_DESC_INIT(&iv_seq[idx]); - HW_DESC_SET_DIN_NO_DMA(&iv_seq[idx], 0, 0xfffff0); - HW_DESC_SET_DOUT_NO_DMA(&iv_seq[idx], 0, 0, 1); + hw_desc_init(&iv_seq[idx]); + set_din_no_dma(&iv_seq[idx], 0, 0xfffff0); + set_dout_no_dma(&iv_seq[idx], 0, 0, 1); idx++; *iv_seq_len = idx; /* update seq length */ diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 1bc6811d63c5..02ad065d9e91 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -47,7 +47,7 @@ */ #define INIT_CC_MONITOR_DESC(desc_p) \ do { \ - HW_DESC_INIT(desc_p); \ + hw_desc_init(desc_p); \ HW_DESC_SET_DIN_MONITOR_CNTR(desc_p); \ } while (0) @@ -73,9 +73,9 @@ do { \ do { \ if ((is_monitored) == true) { \ struct cc_hw_desc barrier_desc; \ - HW_DESC_INIT(&barrier_desc); \ - HW_DESC_SET_DIN_NO_DMA(&barrier_desc, 0, 0xfffff0); \ - HW_DESC_SET_DOUT_NO_DMA(&barrier_desc, 0, 0, 1); \ + hw_desc_init(&barrier_desc); \ + set_din_no_dma(&barrier_desc, 0, 0xfffff0); \ + set_dout_no_dma(&barrier_desc, 0, 0, 1); \ enqueue_seq((cc_base_addr), &barrier_desc, 1); \ enqueue_seq((cc_base_addr), (desc_p), 1); \ } \ @@ -224,13 +224,12 @@ int request_mgr_init(struct ssi_drvdata *drvdata) sizeof(u32)); /* Init. "dummy" completion descriptor */ - HW_DESC_INIT(&req_mgr_h->compl_desc); - HW_DESC_SET_DIN_CONST(&req_mgr_h->compl_desc, 0, sizeof(u32)); - HW_DESC_SET_DOUT_DLLI(&req_mgr_h->compl_desc, - req_mgr_h->dummy_comp_buff_dma, - sizeof(u32), NS_BIT, 1); - HW_DESC_SET_FLOW_MODE(&req_mgr_h->compl_desc, BYPASS); - HW_DESC_SET_QUEUE_LAST_IND(&req_mgr_h->compl_desc); + hw_desc_init(&req_mgr_h->compl_desc); + set_din_const(&req_mgr_h->compl_desc, 0, sizeof(u32)); + set_dout_dlli(&req_mgr_h->compl_desc, req_mgr_h->dummy_comp_buff_dma, + sizeof(u32), NS_BIT, 1); + set_flow_mode(&req_mgr_h->compl_desc, BYPASS); + set_queue_last_ind(&req_mgr_h->compl_desc); #ifdef CC_CYCLE_COUNT /* For CC-HW cycle performance trace */ @@ -519,7 +518,7 @@ int send_request_init( if (unlikely(rc != 0 )) { return rc; } - HW_DESC_SET_QUEUE_LAST_IND(&desc[len-1]); + set_queue_last_ind(&desc[(len - 1)]); enqueue_seq(cc_base, desc, len); diff --git a/drivers/staging/ccree/ssi_sram_mgr.c b/drivers/staging/ccree/ssi_sram_mgr.c index bd7078d3e6aa..c8ab55ee2119 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.c +++ b/drivers/staging/ccree/ssi_sram_mgr.c @@ -127,10 +127,10 @@ void ssi_sram_mgr_const2sram_desc( unsigned int idx = *seq_len; for (i = 0; i < nelement; i++, idx++) { - HW_DESC_INIT(&seq[idx]); - HW_DESC_SET_DIN_CONST(&seq[idx], src[i], sizeof(u32)); - HW_DESC_SET_DOUT_SRAM(&seq[idx], dst + (i * sizeof(u32)), sizeof(u32)); - HW_DESC_SET_FLOW_MODE(&seq[idx], BYPASS); + hw_desc_init(&seq[idx]); + set_din_const(&seq[idx], src[i], sizeof(u32)); + set_dout_sram(&seq[idx], dst + (i * sizeof(u32)), sizeof(u32)); + set_flow_mode(&seq[idx], BYPASS); } *seq_len = idx; -- cgit v1.2.3-55-g7522 From 13ddf621568c5f9d2467fd46f8a0b11c6d5616f4 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:24 +0300 Subject: staging: ccree: remove 48 bit dma addr sim Remove no longer needed code used to simulate 48 bit dma addresses on 32 bit platforms for development purposes. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 19 -------- drivers/staging/ccree/ssi_buffer_mgr.c | 83 --------------------------------- drivers/staging/ccree/ssi_buffer_mgr.h | 16 ------- drivers/staging/ccree/ssi_cipher.c | 4 -- drivers/staging/ccree/ssi_hash.c | 35 -------------- drivers/staging/ccree/ssi_ivgen.c | 3 -- drivers/staging/ccree/ssi_request_mgr.c | 3 -- 7 files changed, 163 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index b0db815c9366..a42bb493e6dd 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -99,7 +99,6 @@ static void ssi_aead_exit(struct crypto_aead *tfm) dev = &ctx->drvdata->plat_dev->dev; /* Unmap enckey buffer */ if (ctx->enckey != NULL) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->enckey_dma_addr); dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, ctx->enckey_dma_addr); SSI_LOG_DEBUG("Freed enckey DMA buffer enckey_dma_addr=0x%llX\n", (unsigned long long)ctx->enckey_dma_addr); @@ -109,8 +108,6 @@ static void ssi_aead_exit(struct crypto_aead *tfm) if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { /* XCBC authetication */ if (ctx->auth_state.xcbc.xcbc_keys != NULL) { - SSI_RESTORE_DMA_ADDR_TO_48BIT( - ctx->auth_state.xcbc.xcbc_keys_dma_addr); dma_free_coherent(dev, CC_AES_128_BIT_KEY_SIZE * 3, ctx->auth_state.xcbc.xcbc_keys, ctx->auth_state.xcbc.xcbc_keys_dma_addr); @@ -121,8 +118,6 @@ static void ssi_aead_exit(struct crypto_aead *tfm) ctx->auth_state.xcbc.xcbc_keys = NULL; } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */ if (ctx->auth_state.hmac.ipad_opad != NULL) { - SSI_RESTORE_DMA_ADDR_TO_48BIT( - ctx->auth_state.hmac.ipad_opad_dma_addr); dma_free_coherent(dev, 2 * MAX_HMAC_DIGEST_SIZE, ctx->auth_state.hmac.ipad_opad, ctx->auth_state.hmac.ipad_opad_dma_addr); @@ -132,8 +127,6 @@ static void ssi_aead_exit(struct crypto_aead *tfm) ctx->auth_state.hmac.ipad_opad = NULL; } if (ctx->auth_state.hmac.padded_authkey != NULL) { - SSI_RESTORE_DMA_ADDR_TO_48BIT( - ctx->auth_state.hmac.padded_authkey_dma_addr); dma_free_coherent(dev, MAX_HMAC_BLOCK_SIZE, ctx->auth_state.hmac.padded_authkey, ctx->auth_state.hmac.padded_authkey_dma_addr); @@ -171,7 +164,6 @@ static int ssi_aead_init(struct crypto_aead *tfm) SSI_LOG_ERR("Failed allocating key buffer\n"); goto init_failed; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->enckey_dma_addr, AES_MAX_KEY_SIZE); SSI_LOG_DEBUG("Allocated enckey buffer in context ctx->enckey=@%p\n", ctx->enckey); /* Set default authlen value */ @@ -186,9 +178,6 @@ static int ssi_aead_init(struct crypto_aead *tfm) SSI_LOG_ERR("Failed allocating buffer for XCBC keys\n"); goto init_failed; } - SSI_UPDATE_DMA_ADDR_TO_48BIT( - ctx->auth_state.xcbc.xcbc_keys_dma_addr, - CC_AES_128_BIT_KEY_SIZE * 3); } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC authentication */ /* Allocate dma-coherent buffer for IPAD + OPAD */ ctx->auth_state.hmac.ipad_opad = dma_alloc_coherent(dev, @@ -198,9 +187,6 @@ static int ssi_aead_init(struct crypto_aead *tfm) SSI_LOG_ERR("Failed allocating IPAD/OPAD buffer\n"); goto init_failed; } - SSI_UPDATE_DMA_ADDR_TO_48BIT( - ctx->auth_state.hmac.ipad_opad_dma_addr, - 2 * MAX_HMAC_DIGEST_SIZE); SSI_LOG_DEBUG("Allocated authkey buffer in context ctx->authkey=@%p\n", ctx->auth_state.hmac.ipad_opad); @@ -211,9 +197,6 @@ static int ssi_aead_init(struct crypto_aead *tfm) SSI_LOG_ERR("failed to allocate padded_authkey\n"); goto init_failed; } - SSI_UPDATE_DMA_ADDR_TO_48BIT( - ctx->auth_state.hmac.padded_authkey_dma_addr, - MAX_HMAC_BLOCK_SIZE); } else { ctx->auth_state.hmac.ipad_opad = NULL; ctx->auth_state.hmac.padded_authkey = NULL; @@ -465,7 +448,6 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl " DMA failed\n", key, keylen); return -ENOMEM; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(key_dma_addr, keylen); if (keylen > blocksize) { /* Load hash initial state */ hw_desc_init(&desc[idx]); @@ -548,7 +530,6 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc); if (likely(key_dma_addr != 0)) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(key_dma_addr); dma_unmap_single(dev, key_dma_addr, keylen, DMA_TO_DEVICE); } diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index edb88441e90d..f21dd262d0e6 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -95,54 +95,6 @@ struct buffer_array { u32 * mlli_nents[MAX_NUM_OF_BUFFERS_IN_MLLI]; }; -#ifdef CC_DMA_48BIT_SIM -dma_addr_t ssi_buff_mgr_update_dma_addr(dma_addr_t orig_addr, u32 data_len) -{ - dma_addr_t tmp_dma_addr; -#ifdef CC_DMA_48BIT_SIM_FULL - /* With this code all addresses will be switched to 48 bits. */ - /* The if condition protects from double expention */ - if((((orig_addr >> 16) & 0xFFFF) != 0xFFFF) && - (data_len <= CC_MAX_MLLI_ENTRY_SIZE)) { -#else - if((!(((orig_addr >> 16) & 0xFF) % 2)) && - (data_len <= CC_MAX_MLLI_ENTRY_SIZE)) { -#endif - tmp_dma_addr = ((orig_addr<<16) | 0xFFFF0000 | - (orig_addr & U16_MAX)); - SSI_LOG_DEBUG("MAP DMA: orig address=0x%llX " - "dma_address=0x%llX\n", - orig_addr, tmp_dma_addr); - return tmp_dma_addr; - } - return orig_addr; -} - -dma_addr_t ssi_buff_mgr_restore_dma_addr(dma_addr_t orig_addr) -{ - dma_addr_t tmp_dma_addr; -#ifdef CC_DMA_48BIT_SIM_FULL - /* With this code all addresses will be restored from 48 bits. */ - /* The if condition protects from double restoring */ - if((orig_addr >> 32) & 0xFFFF ) { -#else - if(((orig_addr >> 32) & 0xFFFF) && - !(((orig_addr >> 32) & 0xFF) % 2) ) { -#endif - /*return high 16 bits*/ - tmp_dma_addr = ((orig_addr >> 16)); - /*clean the 0xFFFF in the lower bits (set in the add expansion)*/ - tmp_dma_addr &= 0xFFFF0000; - /* Set the original 16 bits */ - tmp_dma_addr |= (orig_addr & U16_MAX); - SSI_LOG_DEBUG("Release DMA: orig address=0x%llX " - "dma_address=0x%llX\n", - orig_addr, tmp_dma_addr); - return tmp_dma_addr; - } - return orig_addr; -} -#endif /** * ssi_buffer_mgr_get_sgl_nents() - Get scatterlist number of entries. * @@ -234,20 +186,17 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( /*handle buffer longer than 64 kbytes */ while (buff_size > CC_MAX_MLLI_ENTRY_SIZE ) { - SSI_UPDATE_DMA_ADDR_TO_48BIT(buff_dma, CC_MAX_MLLI_ENTRY_SIZE); LLI_SET_ADDR(mlli_entry_p,buff_dma); LLI_SET_SIZE(mlli_entry_p, CC_MAX_MLLI_ENTRY_SIZE); SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n",*curr_nents, mlli_entry_p[LLI_WORD0_OFFSET], mlli_entry_p[LLI_WORD1_OFFSET]); - SSI_RESTORE_DMA_ADDR_TO_48BIT(buff_dma); buff_dma += CC_MAX_MLLI_ENTRY_SIZE; buff_size -= CC_MAX_MLLI_ENTRY_SIZE; mlli_entry_p = mlli_entry_p + 2; (*curr_nents)++; } /*Last entry */ - SSI_UPDATE_DMA_ADDR_TO_48BIT(buff_dma, buff_size); LLI_SET_ADDR(mlli_entry_p,buff_dma); LLI_SET_SIZE(mlli_entry_p, buff_size); SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n",*curr_nents, @@ -306,9 +255,6 @@ static int ssi_buffer_mgr_generate_mlli( rc =-ENOMEM; goto build_mlli_exit; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(mlli_params->mlli_dma_addr, - (MAX_NUM_OF_TOTAL_MLLI_ENTRIES* - LLI_ENTRY_BYTE_SIZE)); /* Point to start of MLLI */ mlli_p = (u32 *)mlli_params->mlli_virt_addr; /* go over all SG's and link it to one MLLI table */ @@ -452,7 +398,6 @@ static int ssi_buffer_mgr_map_scatterlist( *lbytes = nbytes; *nents = 1; *mapped_nents = 1; - SSI_UPDATE_DMA_ADDR_TO_48BIT(sg_dma_address(sg), sg_dma_len(sg)); } else { /*sg_is_last*/ *nents = ssi_buffer_mgr_get_sgl_nents(sg, nbytes, lbytes, &is_chained); @@ -572,7 +517,6 @@ void ssi_buffer_mgr_unmap_blkcipher_request( SSI_LOG_DEBUG("Unmapped iv: iv_dma_addr=0x%llX iv_size=%u\n", (unsigned long long)req_ctx->gen_ctx.iv_dma_addr, ivsize); - SSI_RESTORE_DMA_ADDR_TO_48BIT(req_ctx->gen_ctx.iv_dma_addr); dma_unmap_single(dev, req_ctx->gen_ctx.iv_dma_addr, ivsize, req_ctx->is_giv ? DMA_BIDIRECTIONAL : @@ -580,20 +524,17 @@ void ssi_buffer_mgr_unmap_blkcipher_request( } /* Release pool */ if (req_ctx->dma_buf_type == SSI_DMA_BUF_MLLI) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(req_ctx->mlli_params.mlli_dma_addr); dma_pool_free(req_ctx->mlli_params.curr_pool, req_ctx->mlli_params.mlli_virt_addr, req_ctx->mlli_params.mlli_dma_addr); } - SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(src)); dma_unmap_sg(dev, src, req_ctx->in_nents, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped req->src=%pK\n", sg_virt(src)); if (src != dst) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(dst)); dma_unmap_sg(dev, dst, req_ctx->out_nents, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped req->dst=%pK\n", @@ -637,8 +578,6 @@ int ssi_buffer_mgr_map_blkcipher_request( "for DMA failed\n", ivsize, info); return -ENOMEM; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(req_ctx->gen_ctx.iv_dma_addr, - ivsize); SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=0x%llX\n", ivsize, info, (unsigned long long)req_ctx->gen_ctx.iv_dma_addr); @@ -718,7 +657,6 @@ void ssi_buffer_mgr_unmap_aead_request( u32 size_to_unmap = 0; if (areq_ctx->mac_buf_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->mac_buf_dma_addr); dma_unmap_single(dev, areq_ctx->mac_buf_dma_addr, MAX_MAC_SIZE, DMA_BIDIRECTIONAL); } @@ -726,25 +664,21 @@ void ssi_buffer_mgr_unmap_aead_request( #if SSI_CC_HAS_AES_GCM if (areq_ctx->cipher_mode == DRV_CIPHER_GCTR) { if (areq_ctx->hkey_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->hkey_dma_addr); dma_unmap_single(dev, areq_ctx->hkey_dma_addr, AES_BLOCK_SIZE, DMA_BIDIRECTIONAL); } if (areq_ctx->gcm_block_len_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_block_len_dma_addr); dma_unmap_single(dev, areq_ctx->gcm_block_len_dma_addr, AES_BLOCK_SIZE, DMA_TO_DEVICE); } if (areq_ctx->gcm_iv_inc1_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_iv_inc1_dma_addr); dma_unmap_single(dev, areq_ctx->gcm_iv_inc1_dma_addr, AES_BLOCK_SIZE, DMA_TO_DEVICE); } if (areq_ctx->gcm_iv_inc2_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_iv_inc2_dma_addr); dma_unmap_single(dev, areq_ctx->gcm_iv_inc2_dma_addr, AES_BLOCK_SIZE, DMA_TO_DEVICE); } @@ -753,7 +687,6 @@ void ssi_buffer_mgr_unmap_aead_request( if (areq_ctx->ccm_hdr_size != ccm_header_size_null) { if (areq_ctx->ccm_iv0_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->ccm_iv0_dma_addr); dma_unmap_single(dev, areq_ctx->ccm_iv0_dma_addr, AES_BLOCK_SIZE, DMA_TO_DEVICE); } @@ -761,7 +694,6 @@ void ssi_buffer_mgr_unmap_aead_request( dma_unmap_sg(dev, &areq_ctx->ccm_adata_sg, 1, DMA_TO_DEVICE); } if (areq_ctx->gen_ctx.iv_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->gen_ctx.iv_dma_addr); dma_unmap_single(dev, areq_ctx->gen_ctx.iv_dma_addr, hw_iv_size, DMA_BIDIRECTIONAL); } @@ -773,14 +705,12 @@ void ssi_buffer_mgr_unmap_aead_request( SSI_LOG_DEBUG("free MLLI buffer: dma=0x%08llX virt=%pK\n", (unsigned long long)areq_ctx->mlli_params.mlli_dma_addr, areq_ctx->mlli_params.mlli_virt_addr); - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->mlli_params.mlli_dma_addr); dma_pool_free(areq_ctx->mlli_params.curr_pool, areq_ctx->mlli_params.mlli_virt_addr, areq_ctx->mlli_params.mlli_dma_addr); } SSI_LOG_DEBUG("Unmapping src sgl: req->src=%pK areq_ctx->src.nents=%u areq_ctx->assoc.nents=%u assoclen:%u cryptlen=%u\n", sg_virt(req->src),areq_ctx->src.nents,areq_ctx->assoc.nents,req->assoclen,req->cryptlen); - SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(req->src)); size_to_unmap = req->assoclen+req->cryptlen; if(areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT){ size_to_unmap += areq_ctx->req_authsize; @@ -792,7 +722,6 @@ void ssi_buffer_mgr_unmap_aead_request( if (unlikely(req->src != req->dst)) { SSI_LOG_DEBUG("Unmapping dst sgl: req->dst=%pK\n", sg_virt(req->dst)); - SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(req->dst)); dma_unmap_sg(dev, req->dst, ssi_buffer_mgr_get_sgl_nents(req->dst,size_to_unmap,&dummy,&chained), DMA_BIDIRECTIONAL); } @@ -890,7 +819,6 @@ static inline int ssi_buffer_mgr_aead_chain_iv( rc = -ENOMEM; goto chain_iv_exit; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(areq_ctx->gen_ctx.iv_dma_addr, hw_iv_size); SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=0x%llX\n", hw_iv_size, req->iv, @@ -1410,7 +1338,6 @@ int ssi_buffer_mgr_map_aead_request( rc = -ENOMEM; goto aead_map_failure; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(areq_ctx->mac_buf_dma_addr, MAX_MAC_SIZE); if (areq_ctx->ccm_hdr_size != ccm_header_size_null) { areq_ctx->ccm_iv0_dma_addr = dma_map_single(dev, @@ -1425,8 +1352,6 @@ int ssi_buffer_mgr_map_aead_request( rc = -ENOMEM; goto aead_map_failure; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(areq_ctx->ccm_iv0_dma_addr, - AES_BLOCK_SIZE); if (ssi_aead_handle_config_buf(dev, areq_ctx, areq_ctx->ccm_config, &sg_data, req->assoclen) != 0) { rc = -ENOMEM; @@ -1444,7 +1369,6 @@ int ssi_buffer_mgr_map_aead_request( rc = -ENOMEM; goto aead_map_failure; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(areq_ctx->hkey_dma_addr, AES_BLOCK_SIZE); areq_ctx->gcm_block_len_dma_addr = dma_map_single(dev, &areq_ctx->gcm_len_block, AES_BLOCK_SIZE, DMA_TO_DEVICE); @@ -1454,7 +1378,6 @@ int ssi_buffer_mgr_map_aead_request( rc = -ENOMEM; goto aead_map_failure; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_block_len_dma_addr, AES_BLOCK_SIZE); areq_ctx->gcm_iv_inc1_dma_addr = dma_map_single(dev, areq_ctx->gcm_iv_inc1, @@ -1468,8 +1391,6 @@ int ssi_buffer_mgr_map_aead_request( rc = -ENOMEM; goto aead_map_failure; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_iv_inc1_dma_addr, - AES_BLOCK_SIZE); areq_ctx->gcm_iv_inc2_dma_addr = dma_map_single(dev, areq_ctx->gcm_iv_inc2, @@ -1483,8 +1404,6 @@ int ssi_buffer_mgr_map_aead_request( rc = -ENOMEM; goto aead_map_failure; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(areq_ctx->gcm_iv_inc2_dma_addr, - AES_BLOCK_SIZE); } #endif /*SSI_CC_HAS_AES_GCM*/ @@ -1809,7 +1728,6 @@ void ssi_buffer_mgr_unmap_hash_request( SSI_LOG_DEBUG("free MLLI buffer: dma=0x%llX virt=%pK\n", (unsigned long long)areq_ctx->mlli_params.mlli_dma_addr, areq_ctx->mlli_params.mlli_virt_addr); - SSI_RESTORE_DMA_ADDR_TO_48BIT(areq_ctx->mlli_params.mlli_dma_addr); dma_pool_free(areq_ctx->mlli_params.curr_pool, areq_ctx->mlli_params.mlli_virt_addr, areq_ctx->mlli_params.mlli_dma_addr); @@ -1820,7 +1738,6 @@ void ssi_buffer_mgr_unmap_hash_request( sg_virt(src), (unsigned long long)sg_dma_address(src), sg_dma_len(src)); - SSI_RESTORE_DMA_ADDR_TO_48BIT(sg_dma_address(src)); dma_unmap_sg(dev, src, areq_ctx->in_nents, DMA_TO_DEVICE); } diff --git a/drivers/staging/ccree/ssi_buffer_mgr.h b/drivers/staging/ccree/ssi_buffer_mgr.h index 98355dd789e5..bb5f8dc1adf4 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.h +++ b/drivers/staging/ccree/ssi_buffer_mgr.h @@ -85,21 +85,5 @@ void ssi_buffer_mgr_copy_scatterlist_portion(u8 *dest, struct scatterlist *sg, u void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, u32 data_len); - -#ifdef CC_DMA_48BIT_SIM -dma_addr_t ssi_buff_mgr_update_dma_addr(dma_addr_t orig_addr, u32 data_len); -dma_addr_t ssi_buff_mgr_restore_dma_addr(dma_addr_t orig_addr); - -#define SSI_UPDATE_DMA_ADDR_TO_48BIT(addr,size) addr = \ - ssi_buff_mgr_update_dma_addr(addr,size) -#define SSI_RESTORE_DMA_ADDR_TO_48BIT(addr) addr = \ - ssi_buff_mgr_restore_dma_addr(addr) -#else - -#define SSI_UPDATE_DMA_ADDR_TO_48BIT(addr,size) addr = addr -#define SSI_RESTORE_DMA_ADDR_TO_48BIT(addr) addr = addr - -#endif - #endif /*__BUFFER_MGR_H__*/ diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 8f86fcdee879..56e441c91359 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -215,7 +215,6 @@ static int ssi_blkcipher_init(struct crypto_tfm *tfm) max_key_buf_size, ctx_p->user.key); return -ENOMEM; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx_p->user.key_dma_addr, max_key_buf_size); SSI_LOG_DEBUG("Mapped key %u B at va=%pK to dma=0x%llX\n", max_key_buf_size, ctx_p->user.key, (unsigned long long)ctx_p->user.key_dma_addr); @@ -248,7 +247,6 @@ static void ssi_blkcipher_exit(struct crypto_tfm *tfm) } /* Unmap key buffer */ - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx_p->user.key_dma_addr); dma_unmap_single(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); SSI_LOG_DEBUG("Unmapped key buffer key_dma_addr=0x%llX\n", @@ -413,7 +411,6 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, /* STAT_PHASE_1: Copy key to ctx */ START_CYCLE_COUNT(); - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx_p->user.key_dma_addr); dma_sync_single_for_cpu(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); #if SSI_CC_HAS_MULTI2 @@ -449,7 +446,6 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, } dma_sync_single_for_device(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx_p->user.key_dma_addr ,max_key_buf_size); ctx_p->keylen = keylen; END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_1); diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 8ab6b9e1e264..66405e91fe7f 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -145,8 +145,6 @@ static int ssi_hash_map_result(struct device *dev, digestsize); return -ENOMEM; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(state->digest_result_dma_addr, - digestsize); SSI_LOG_DEBUG("Mapped digest result buffer %u B " "at va=%pK to dma=0x%llX\n", digestsize, state->digest_result_buff, @@ -212,17 +210,12 @@ static int ssi_hash_map_request(struct device *dev, ctx->inter_digestsize, state->digest_buff); goto fail3; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr, - ctx->inter_digestsize); SSI_LOG_DEBUG("Mapped digest %d B at va=%pK to dma=0x%llX\n", ctx->inter_digestsize, state->digest_buff, (unsigned long long)state->digest_buff_dma_addr); if (is_hmac) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->digest_buff_dma_addr); dma_sync_single_for_cpu(dev, ctx->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->digest_buff_dma_addr, - ctx->inter_digestsize); if ((ctx->hw_mode == DRV_CIPHER_XCBC_MAC) || (ctx->hw_mode == DRV_CIPHER_CMAC)) { memset(state->digest_buff, 0, ctx->inter_digestsize); } else { /*sha*/ @@ -237,17 +230,11 @@ static int ssi_hash_map_request(struct device *dev, memcpy(state->digest_bytes_len, digest_len_init, HASH_LEN_SIZE); #endif } - SSI_RESTORE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr); dma_sync_single_for_device(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); - SSI_UPDATE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr, - ctx->inter_digestsize); if (ctx->hash_mode != DRV_HASH_NULL) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr); dma_sync_single_for_cpu(dev, ctx->opad_tmp_keys_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); memcpy(state->opad_digest_buff, ctx->opad_tmp_keys_buff, ctx->inter_digestsize); - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr, - ctx->inter_digestsize); } } else { /*hash*/ /* Copy the initial digests if hash flow. The SRAM contains the @@ -273,8 +260,6 @@ static int ssi_hash_map_request(struct device *dev, HASH_LEN_SIZE, state->digest_bytes_len); goto fail4; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(state->digest_bytes_len_dma_addr, - HASH_LEN_SIZE); SSI_LOG_DEBUG("Mapped digest len %u B at va=%pK to dma=0x%llX\n", HASH_LEN_SIZE, state->digest_bytes_len, (unsigned long long)state->digest_bytes_len_dma_addr); @@ -289,8 +274,6 @@ static int ssi_hash_map_request(struct device *dev, ctx->inter_digestsize, state->opad_digest_buff); goto fail5; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(state->opad_digest_dma_addr, - ctx->inter_digestsize); SSI_LOG_DEBUG("Mapped opad digest %d B at va=%pK to dma=0x%llX\n", ctx->inter_digestsize, state->opad_digest_buff, (unsigned long long)state->opad_digest_dma_addr); @@ -306,13 +289,11 @@ static int ssi_hash_map_request(struct device *dev, fail5: if (state->digest_bytes_len_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(state->digest_bytes_len_dma_addr); dma_unmap_single(dev, state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, DMA_BIDIRECTIONAL); state->digest_bytes_len_dma_addr = 0; } fail4: if (state->digest_buff_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr); dma_unmap_single(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); state->digest_buff_dma_addr = 0; } @@ -346,7 +327,6 @@ static void ssi_hash_unmap_request(struct device *dev, struct ssi_hash_ctx *ctx) { if (state->digest_buff_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(state->digest_buff_dma_addr); dma_unmap_single(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped digest-buffer: digest_buff_dma_addr=0x%llX\n", @@ -354,7 +334,6 @@ static void ssi_hash_unmap_request(struct device *dev, state->digest_buff_dma_addr = 0; } if (state->digest_bytes_len_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(state->digest_bytes_len_dma_addr); dma_unmap_single(dev, state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped digest-bytes-len buffer: digest_bytes_len_dma_addr=0x%llX\n", @@ -362,7 +341,6 @@ static void ssi_hash_unmap_request(struct device *dev, state->digest_bytes_len_dma_addr = 0; } if (state->opad_digest_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(state->opad_digest_dma_addr); dma_unmap_single(dev, state->opad_digest_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped opad-digest: opad_digest_dma_addr=0x%llX\n", @@ -383,7 +361,6 @@ static void ssi_hash_unmap_result(struct device *dev, unsigned int digestsize, u8 *result) { if (state->digest_result_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(state->digest_result_dma_addr); dma_unmap_single(dev, state->digest_result_dma_addr, digestsize, @@ -1081,7 +1058,6 @@ static int ssi_hash_setkey(void *hash, " DMA failed\n", key, keylen); return -ENOMEM; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->key_params.key_dma_addr, keylen); SSI_LOG_DEBUG("mapping key-buffer: key_dma_addr=0x%llX " "keylen=%u\n", (unsigned long long)ctx->key_params.key_dma_addr, @@ -1229,7 +1205,6 @@ out: } if (ctx->key_params.key_dma_addr) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->key_params.key_dma_addr); dma_unmap_single(&ctx->drvdata->plat_dev->dev, ctx->key_params.key_dma_addr, ctx->key_params.keylen, DMA_TO_DEVICE); @@ -1273,7 +1248,6 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, " DMA failed\n", key, keylen); return -ENOMEM; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->key_params.key_dma_addr, keylen); SSI_LOG_DEBUG("mapping key-buffer: key_dma_addr=0x%llX " "keylen=%u\n", (unsigned long long)ctx->key_params.key_dma_addr, @@ -1320,7 +1294,6 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, if (rc != 0) crypto_ahash_set_flags(ahash, CRYPTO_TFM_RES_BAD_KEY_LEN); - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->key_params.key_dma_addr); dma_unmap_single(&ctx->drvdata->plat_dev->dev, ctx->key_params.key_dma_addr, ctx->key_params.keylen, DMA_TO_DEVICE); @@ -1355,7 +1328,6 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, /* STAT_PHASE_1: Copy key to ctx */ START_CYCLE_COUNT(); - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr); dma_sync_single_for_cpu(&ctx->drvdata->plat_dev->dev, ctx->opad_tmp_keys_dma_addr, keylen, DMA_TO_DEVICE); @@ -1367,7 +1339,6 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, dma_sync_single_for_device(&ctx->drvdata->plat_dev->dev, ctx->opad_tmp_keys_dma_addr, keylen, DMA_TO_DEVICE); - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr, keylen); ctx->key_params.keylen = keylen; @@ -1382,7 +1353,6 @@ static void ssi_hash_free_ctx(struct ssi_hash_ctx *ctx) struct device *dev = &ctx->drvdata->plat_dev->dev; if (ctx->digest_buff_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->digest_buff_dma_addr); dma_unmap_single(dev, ctx->digest_buff_dma_addr, sizeof(ctx->digest_buff), DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped digest-buffer: " @@ -1391,7 +1361,6 @@ static void ssi_hash_free_ctx(struct ssi_hash_ctx *ctx) ctx->digest_buff_dma_addr = 0; } if (ctx->opad_tmp_keys_dma_addr != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr); dma_unmap_single(dev, ctx->opad_tmp_keys_dma_addr, sizeof(ctx->opad_tmp_keys_buff), DMA_BIDIRECTIONAL); @@ -1418,8 +1387,6 @@ static int ssi_hash_alloc_ctx(struct ssi_hash_ctx *ctx) sizeof(ctx->digest_buff), ctx->digest_buff); goto fail; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->digest_buff_dma_addr, - sizeof(ctx->digest_buff)); SSI_LOG_DEBUG("Mapped digest %zu B at va=%pK to dma=0x%llX\n", sizeof(ctx->digest_buff), ctx->digest_buff, (unsigned long long)ctx->digest_buff_dma_addr); @@ -1431,8 +1398,6 @@ static int ssi_hash_alloc_ctx(struct ssi_hash_ctx *ctx) ctx->opad_tmp_keys_buff); goto fail; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(ctx->opad_tmp_keys_dma_addr, - sizeof(ctx->opad_tmp_keys_buff)); SSI_LOG_DEBUG("Mapped opad_tmp_keys %zu B at va=%pK to dma=0x%llX\n", sizeof(ctx->opad_tmp_keys_buff), ctx->opad_tmp_keys_buff, (unsigned long long)ctx->opad_tmp_keys_dma_addr); diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index 233666b8d2eb..cd606ab6cd53 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -165,7 +165,6 @@ void ssi_ivgen_fini(struct ssi_drvdata *drvdata) if (ivgen_ctx->pool_meta != NULL) { memset(ivgen_ctx->pool_meta, 0, SSI_IVPOOL_META_SIZE); - SSI_RESTORE_DMA_ADDR_TO_48BIT(ivgen_ctx->pool_meta_dma); dma_free_coherent(device, SSI_IVPOOL_META_SIZE, ivgen_ctx->pool_meta, ivgen_ctx->pool_meta_dma); } @@ -209,8 +208,6 @@ int ssi_ivgen_init(struct ssi_drvdata *drvdata) rc = -ENOMEM; goto out; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(ivgen_ctx->pool_meta_dma, - SSI_IVPOOL_META_SIZE); /* Allocate IV pool in SRAM */ ivgen_ctx->pool = ssi_sram_mgr_alloc(drvdata, SSI_IVPOOL_SIZE); if (ivgen_ctx->pool == NULL_SRAM_ADDR) { diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 02ad065d9e91..2ec296cc79d0 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -145,7 +145,6 @@ void request_mgr_fini(struct ssi_drvdata *drvdata) return; /* Not allocated */ if (req_mgr_h->dummy_comp_buff_dma != 0) { - SSI_RESTORE_DMA_ADDR_TO_48BIT(req_mgr_h->dummy_comp_buff_dma); dma_free_coherent(&drvdata->plat_dev->dev, sizeof(u32), req_mgr_h->dummy_comp_buff, req_mgr_h->dummy_comp_buff_dma); @@ -220,8 +219,6 @@ int request_mgr_init(struct ssi_drvdata *drvdata) rc = -ENOMEM; goto req_mgr_init_err; } - SSI_UPDATE_DMA_ADDR_TO_48BIT(req_mgr_h->dummy_comp_buff_dma, - sizeof(u32)); /* Init. "dummy" completion descriptor */ hw_desc_init(&req_mgr_h->compl_desc); -- cgit v1.2.3-55-g7522 From c6f7f2f4591f63ec0eba903fceb242af3af5d12c Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:25 +0300 Subject: staging: ccree: refactor LLI access macros The Linked List Item descriptors were being programmed via a set of macros which suffer a few problems: - Use of macros rather than inline leaves out parameter type checking and risks multiple macro parameter evaluation side effects. - Implemented via hand rolled versions of bitfield operations. This patch refactors LLI programming into a set of of inline functions using generic kernel bitfield access infrastructure, thus resolving the above issues and opening the way later on to drop the hand rolled bitfield macros once additional users are dropped in later patches in the series. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_lli_defs.h | 39 ++++++++++++++++++---------------- drivers/staging/ccree/ssi_buffer_mgr.c | 8 +++---- 2 files changed, 25 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index 857b94fc9c58..876dde00f6e3 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -26,24 +26,7 @@ */ #define DLLI_SIZE_BIT_SIZE 0x18 -#define CC_MAX_MLLI_ENTRY_SIZE 0x10000 - -#define LLI_SET_ADDR(__lli_p, __addr) do { \ - u32 *lli_p = (u32 *)__lli_p; \ - typeof(__addr) addr = __addr; \ - \ - BITFIELD_SET(lli_p[LLI_WORD0_OFFSET], \ - LLI_LADDR_BIT_OFFSET, \ - LLI_LADDR_BIT_SIZE, (addr & U32_MAX)); \ - \ - BITFIELD_SET(lli_p[LLI_WORD1_OFFSET], \ - LLI_HADDR_BIT_OFFSET, \ - LLI_HADDR_BIT_SIZE, MSB64(addr)); \ - } while (0) - -#define LLI_SET_SIZE(lli_p, size) \ - BITFIELD_SET(((u32 *)(lli_p))[LLI_WORD1_OFFSET], \ - LLI_SIZE_BIT_OFFSET, LLI_SIZE_BIT_SIZE, size) +#define CC_MAX_MLLI_ENTRY_SIZE 0xFFFF /* Size of entry */ #define LLI_ENTRY_WORD_SIZE 2 @@ -60,4 +43,24 @@ #define LLI_HADDR_BIT_OFFSET 16 #define LLI_HADDR_BIT_SIZE 16 +#define LLI_SIZE_MASK GENMASK((LLI_SIZE_BIT_SIZE - 1), LLI_SIZE_BIT_OFFSET) +#define LLI_HADDR_MASK GENMASK( \ + (LLI_HADDR_BIT_OFFSET + LLI_HADDR_BIT_SIZE - 1),\ + LLI_HADDR_BIT_OFFSET) + +static inline void cc_lli_set_addr(u32 *lli_p, dma_addr_t addr) +{ + lli_p[LLI_WORD0_OFFSET] = (addr & U32_MAX); +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT + lli_p[LLI_WORD1_OFFSET] &= ~LLI_HADDR_MASK; + lli_p[LLI_WORD1_OFFSET] |= FIELD_PREP(LLI_HADDR_MASK, (addr >> 16)); +#endif /* CONFIG_ARCH_DMA_ADDR_T_64BIT */ +} + +static inline void cc_lli_set_size(u32 *lli_p, u16 size) +{ + lli_p[LLI_WORD1_OFFSET] &= ~LLI_SIZE_MASK; + lli_p[LLI_WORD1_OFFSET] |= FIELD_PREP(LLI_SIZE_MASK, size); +} + #endif /*_CC_LLI_DEFS_H_*/ diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index f21dd262d0e6..24ba51d6e8cb 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -186,8 +186,8 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( /*handle buffer longer than 64 kbytes */ while (buff_size > CC_MAX_MLLI_ENTRY_SIZE ) { - LLI_SET_ADDR(mlli_entry_p,buff_dma); - LLI_SET_SIZE(mlli_entry_p, CC_MAX_MLLI_ENTRY_SIZE); + cc_lli_set_addr(mlli_entry_p, buff_dma); + cc_lli_set_size(mlli_entry_p, CC_MAX_MLLI_ENTRY_SIZE); SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n",*curr_nents, mlli_entry_p[LLI_WORD0_OFFSET], mlli_entry_p[LLI_WORD1_OFFSET]); @@ -197,8 +197,8 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( (*curr_nents)++; } /*Last entry */ - LLI_SET_ADDR(mlli_entry_p,buff_dma); - LLI_SET_SIZE(mlli_entry_p, buff_size); + cc_lli_set_addr(mlli_entry_p, buff_dma); + cc_lli_set_size(mlli_entry_p, buff_size); SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n",*curr_nents, mlli_entry_p[LLI_WORD0_OFFSET], mlli_entry_p[LLI_WORD1_OFFSET]); -- cgit v1.2.3-55-g7522 From b9532954214491354a07c6408c6275f09fe9775a Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:26 +0300 Subject: staging: ccree: move M/LLI defines to header file A bunch of macros used to define M/LLI descriptors where being defined in the C file. Move them over to private include file where other relevant definitions are stored. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_lli_defs.h | 8 ++++++++ drivers/staging/ccree/ssi_buffer_mgr.c | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index 876dde00f6e3..78811aa2c513 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -28,6 +28,14 @@ #define CC_MAX_MLLI_ENTRY_SIZE 0xFFFF +#define LLI_MAX_NUM_OF_DATA_ENTRIES 128 +#define LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES 4 +#define MLLI_TABLE_MIN_ALIGNMENT 4 /* 32 bit alignment */ +#define MAX_NUM_OF_BUFFERS_IN_MLLI 4 +#define MAX_NUM_OF_TOTAL_MLLI_ENTRIES \ + (2 * LLI_MAX_NUM_OF_DATA_ENTRIES + \ + LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES) + /* Size of entry */ #define LLI_ENTRY_WORD_SIZE 2 #define LLI_ENTRY_BYTE_SIZE (LLI_ENTRY_WORD_SIZE * sizeof(u32)) diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 24ba51d6e8cb..63ffcd5b63a5 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -33,13 +33,6 @@ #include "ssi_hash.h" #include "ssi_aead.h" -#define LLI_MAX_NUM_OF_DATA_ENTRIES 128 -#define LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES 4 -#define MLLI_TABLE_MIN_ALIGNMENT 4 /*Force the MLLI table to be align to uint32 */ -#define MAX_NUM_OF_BUFFERS_IN_MLLI 4 -#define MAX_NUM_OF_TOTAL_MLLI_ENTRIES (2*LLI_MAX_NUM_OF_DATA_ENTRIES + \ - LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES ) - #ifdef CC_DEBUG #define DUMP_SGL(sg) \ while (sg) { \ -- cgit v1.2.3-55-g7522 From 841d1d806cea997d4388cc6a18057d2d7d5f4d0e Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:27 +0300 Subject: staging: ccree: remove unused debug macros The DUMP_SGL() and DUMP_MLLI_TABLE() debug macros were defined but not used anywhere and the difference of their definitions for debug vs. none debug indicated this has not being used in a while. Remove the dead code. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_buffer_mgr.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 63ffcd5b63a5..3252114740d0 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -34,30 +34,11 @@ #include "ssi_aead.h" #ifdef CC_DEBUG -#define DUMP_SGL(sg) \ - while (sg) { \ - SSI_LOG_DEBUG("page=%p offset=%u length=%u (dma_len=%u) " \ - "dma_addr=%08x\n", sg_page(sg), (sg)->offset, \ - (sg)->length, sg_dma_len(sg), (sg)->dma_address); \ - (sg) = sg_next(sg); \ - } -#define DUMP_MLLI_TABLE(mlli_p, nents) \ - do { \ - SSI_LOG_DEBUG("mlli=%pK nents=%u\n", (mlli_p), (nents)); \ - while((nents)--) { \ - SSI_LOG_DEBUG("addr=0x%08X size=0x%08X\n", \ - (mlli_p)[LLI_WORD0_OFFSET], \ - (mlli_p)[LLI_WORD1_OFFSET]); \ - (mlli_p) += LLI_ENTRY_WORD_SIZE; \ - } \ - } while (0) #define GET_DMA_BUFFER_TYPE(buff_type) ( \ ((buff_type) == SSI_DMA_BUF_NULL) ? "BUF_NULL" : \ ((buff_type) == SSI_DMA_BUF_DLLI) ? "BUF_DLLI" : \ ((buff_type) == SSI_DMA_BUF_MLLI) ? "BUF_MLLI" : "BUF_INVALID") #else -#define DX_BUFFER_MGR_DUMP_SGL(sg) -#define DX_BUFFER_MGR_DUMP_MLLI_TABLE(mlli_p, nents) #define GET_DMA_BUFFER_TYPE(buff_type) #endif -- cgit v1.2.3-55-g7522 From 7f821f0c6ffa877278f9432df4905ddd30ee7e07 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:28 +0300 Subject: staging: ccree: remove cycle count debug support The ccree driver had support for rough performance debugging via cycle counting which has bit rotted and can easily be replcaed with perf. Remove it from the driver. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 14 ---- drivers/staging/ccree/ssi_aead.c | 33 --------- drivers/staging/ccree/ssi_cipher.c | 20 ------ drivers/staging/ccree/ssi_config.h | 6 -- drivers/staging/ccree/ssi_driver.c | 8 --- drivers/staging/ccree/ssi_driver.h | 25 ------- drivers/staging/ccree/ssi_hash.c | 28 -------- drivers/staging/ccree/ssi_request_mgr.c | 116 ------------------------------- 8 files changed, 250 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index c3f9d6a4b992..e75081710f0f 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -29,8 +29,6 @@ #define HW_DESC_SIZE_WORDS 6 #define HW_QUEUE_SLOTS_MAX 15 /* Max. available slots in HW queue */ -#define _HW_DESC_MONITOR_KICK 0x7FFFC00 - #define CC_REG_NAME(word, name) DX_DSCRPTR_QUEUE_WORD ## word ## _ ## name #define CC_REG_LOW(word, name) \ @@ -606,16 +604,4 @@ static inline void set_cipher_do(struct cc_hw_desc *pdesc, (config & HW_KEY_MASK_CIPHER_DO)); } -/*! - * This macro sets the DIN field of a HW descriptors to star/stop monitor descriptor. - * Used for performance measurements and debug purposes. - * - * \param pDesc pointer HW descriptor struct - */ -#define HW_DESC_SET_DIN_MONITOR_CNTR(pDesc) \ - do { \ - CC_REG_FLD_SET(CRY_KERNEL, DSCRPTR_MEASURE_CNTR, VALUE, (pDesc)->word[1], _HW_DESC_MONITOR_KICK); \ - } while (0) - - #endif /*__CC_HW_QUEUE_DEFS_H__*/ diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index a42bb493e6dd..e8936a324204 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -217,9 +217,6 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c struct crypto_aead *tfm = crypto_aead_reqtfm(ssi_req); struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); int err = 0; - DECL_CYCLE_COUNT_RESOURCES; - - START_CYCLE_COUNT(); ssi_buffer_mgr_unmap_aead_request(dev, areq); @@ -254,7 +251,6 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c } } - END_CYCLE_COUNT(STAT_OP_TYPE_GENERIC, STAT_PHASE_4); aead_request_complete(areq, err); } @@ -521,10 +517,6 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl idx++; } -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_SETKEY; -#endif - rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 0); if (unlikely(rc != 0)) SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc); @@ -546,14 +538,12 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) struct crypto_authenc_key_param *param; struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; int seq_len = 0, rc = -EINVAL; - DECL_CYCLE_COUNT_RESOURCES; SSI_LOG_DEBUG("Setting key in context @%p for %s. key=%p keylen=%u\n", ctx, crypto_tfm_alg_name(crypto_aead_tfm(tfm)), key, keylen); CHECK_AND_RETURN_UPON_FIPS_ERROR(); /* STAT_PHASE_0: Init and sanity checks */ - START_CYCLE_COUNT(); if (ctx->auth_mode != DRV_HASH_NULL) { /* authenc() alg. */ if (!RTA_OK(rta, keylen)) @@ -592,9 +582,7 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) if (unlikely(rc != 0)) goto badkey; - END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_0); /* STAT_PHASE_1: Copy key to ctx */ - START_CYCLE_COUNT(); /* Get key material */ memcpy(ctx->enckey, key + ctx->auth_keylen, ctx->enc_keylen); @@ -608,10 +596,8 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) goto badkey; } - END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_1); /* STAT_PHASE_2: Create sequence */ - START_CYCLE_COUNT(); switch (ctx->auth_mode) { case DRV_HASH_SHA1: @@ -629,15 +615,10 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) goto badkey; } - END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_2); /* STAT_PHASE_3: Submit sequence to HW */ - START_CYCLE_COUNT(); if (seq_len > 0) { /* For CCM there is no sequence to setup the key */ -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_SETKEY; -#endif rc = send_request(ctx->drvdata, &ssi_req, desc, seq_len, 0); if (unlikely(rc != 0)) { SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc); @@ -646,7 +627,6 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) } /* Update STAT_PHASE_3 */ - END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_3); return rc; badkey: @@ -1977,7 +1957,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction struct device *dev = &ctx->drvdata->plat_dev->dev; struct ssi_crypto_req ssi_req = {}; - DECL_CYCLE_COUNT_RESOURCES; SSI_LOG_DEBUG("%s context=%p req=%p iv=%p src=%p src_ofs=%d dst=%p dst_ofs=%d cryptolen=%d\n", ((direct==DRV_CRYPTO_DIRECTION_ENCRYPT)?"Encrypt":"Decrypt"), ctx, req, req->iv, @@ -1985,7 +1964,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction CHECK_AND_RETURN_UPON_FIPS_ERROR(); /* STAT_PHASE_0: Init and sanity checks */ - START_CYCLE_COUNT(); /* Check data length according to mode */ if (unlikely(validate_data_size(ctx, direct, req) != 0)) { @@ -1999,19 +1977,13 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction ssi_req.user_cb = (void *)ssi_aead_complete; ssi_req.user_arg = (void *)req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = (direct == DRV_CRYPTO_DIRECTION_DECRYPT) ? - STAT_OP_TYPE_DECODE : STAT_OP_TYPE_ENCODE; -#endif /* Setup request context */ areq_ctx->gen_ctx.op_type = direct; areq_ctx->req_authsize = ctx->authsize; areq_ctx->cipher_mode = ctx->cipher_mode; - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_0); /* STAT_PHASE_1: Map buffers */ - START_CYCLE_COUNT(); if (ctx->cipher_mode == DRV_CIPHER_CTR) { /* Build CTR IV - Copy nonce from last 4 bytes in @@ -2095,10 +2067,8 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction ssi_req.ivgen_size = crypto_aead_ivsize(tfm); } - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_1); /* STAT_PHASE_2: Create sequence */ - START_CYCLE_COUNT(); /* Load MLLI tables to SRAM if necessary */ ssi_aead_load_mlli_to_sram(req, desc, &seq_len); @@ -2133,10 +2103,8 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction goto exit; } - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_2); /* STAT_PHASE_3: Lock HW and push sequence */ - START_CYCLE_COUNT(); rc = send_request(ctx->drvdata, &ssi_req, desc, seq_len, 1); @@ -2146,7 +2114,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction } - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); exit: return rc; } diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 56e441c91359..e16fd36072e2 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -323,7 +323,6 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, struct device *dev = &ctx_p->drvdata->plat_dev->dev; u32 tmp[DES_EXPKEY_WORDS]; unsigned int max_key_buf_size = get_max_keysize(tfm); - DECL_CYCLE_COUNT_RESOURCES; SSI_LOG_DEBUG("Setting key in context @%p for %s. keylen=%u\n", ctx_p, crypto_tfm_alg_name(tfm), keylen); @@ -334,7 +333,6 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, SSI_LOG_DEBUG("ssi_blkcipher_setkey: after FIPS check"); /* STAT_PHASE_0: Init and sanity checks */ - START_CYCLE_COUNT(); #if SSI_CC_HAS_MULTI2 /*last byte of key buffer is round number and should not be a part of key size*/ @@ -379,7 +377,6 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, } ctx_p->keylen = keylen; - END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_0); SSI_LOG_DEBUG("ssi_blkcipher_setkey: ssi_is_hw_key ret 0"); return 0; @@ -407,10 +404,8 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, } - END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_0); /* STAT_PHASE_1: Copy key to ctx */ - START_CYCLE_COUNT(); dma_sync_single_for_cpu(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); #if SSI_CC_HAS_MULTI2 @@ -448,7 +443,6 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, max_key_buf_size, DMA_TO_DEVICE); ctx_p->keylen = keylen; - END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_1); SSI_LOG_DEBUG("ssi_blkcipher_setkey: return safely"); return 0; @@ -736,11 +730,8 @@ static int ssi_blkcipher_complete(struct device *dev, { int completion_error = 0; u32 inflight_counter; - DECL_CYCLE_COUNT_RESOURCES; - START_CYCLE_COUNT(); ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - END_CYCLE_COUNT(STAT_OP_TYPE_GENERIC, STAT_PHASE_4); /*Set the inflight couter value to local variable*/ @@ -771,7 +762,6 @@ static int ssi_blkcipher_process( struct cc_hw_desc desc[MAX_ABLKCIPHER_SEQ_LEN]; struct ssi_crypto_req ssi_req = {}; int rc, seq_len = 0,cts_restore_flag = 0; - DECL_CYCLE_COUNT_RESOURCES; SSI_LOG_DEBUG("%s areq=%p info=%p nbytes=%d\n", ((direction==DRV_CRYPTO_DIRECTION_ENCRYPT)?"Encrypt":"Decrypt"), @@ -779,7 +769,6 @@ static int ssi_blkcipher_process( CHECK_AND_RETURN_UPON_FIPS_ERROR(); /* STAT_PHASE_0: Init and sanity checks */ - START_CYCLE_COUNT(); /* TODO: check data length according to mode */ if (unlikely(validate_data_size(ctx_p, nbytes))) { @@ -811,10 +800,8 @@ static int ssi_blkcipher_process( /* Setup request context */ req_ctx->gen_ctx.op_type = direction; - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_0); /* STAT_PHASE_1: Map buffers */ - START_CYCLE_COUNT(); rc = ssi_buffer_mgr_map_blkcipher_request(ctx_p->drvdata, req_ctx, ivsize, nbytes, info, src, dst); if (unlikely(rc != 0)) { @@ -822,10 +809,8 @@ static int ssi_blkcipher_process( goto exit_process; } - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_1); /* STAT_PHASE_2: Create sequence */ - START_CYCLE_COUNT(); /* Setup processing */ #if SSI_CC_HAS_MULTI2 @@ -860,10 +845,8 @@ static int ssi_blkcipher_process( /* set the IV size (8/16 B long)*/ ssi_req.ivgen_size = ivsize; } - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_2); /* STAT_PHASE_3: Lock HW and push sequence */ - START_CYCLE_COUNT(); rc = send_request(ctx_p->drvdata, &ssi_req, desc, seq_len, (areq == NULL)? 0:1); if(areq != NULL) { @@ -872,13 +855,10 @@ static int ssi_blkcipher_process( ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); } - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); } else { if (rc != 0) { ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); } else { - END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); rc = ssi_blkcipher_complete(dev, ctx_p, req_ctx, dst, src, ivsize, NULL, ctx_p->drvdata->cc_base); diff --git a/drivers/staging/ccree/ssi_config.h b/drivers/staging/ccree/ssi_config.h index 9feb692fff0d..b7c05765b2bd 100644 --- a/drivers/staging/ccree/ssi_config.h +++ b/drivers/staging/ccree/ssi_config.h @@ -30,15 +30,9 @@ // #define DX_DUMP_BYTES // #define CC_DEBUG #define ENABLE_CC_SYSFS /* Enable sysfs interface for debugging REE driver */ -//#define ENABLE_CC_CYCLE_COUNT //#define DX_IRQ_DELAY 100000 #define DMA_BIT_MASK_LEN 48 /* was 32 bit, but for juno's sake it was enlarged to 48 bit */ -#if defined ENABLE_CC_CYCLE_COUNT && defined ENABLE_CC_SYSFS -#define CC_CYCLE_COUNT -#endif - - #if defined (CONFIG_ARM64) // TODO currently only this mode was test on Juno (which is ARM64), need to enable coherent also. #define DISABLE_COHERENT_DMA_OPS #endif diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 52c698431404..190922970bf0 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -118,10 +118,8 @@ static irqreturn_t cc_isr(int irq, void *dev_id) void __iomem *cc_base = drvdata->cc_base; u32 irr; u32 imr; - DECL_CYCLE_COUNT_RESOURCES; /* STAT_OP_TYPE_GENERIC STAT_PHASE_0: Interrupt */ - START_CYCLE_COUNT(); /* read the interrupt status */ irr = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRR)); @@ -168,9 +166,6 @@ static irqreturn_t cc_isr(int irq, void *dev_id) /* Just warning */ } - END_CYCLE_COUNT(STAT_OP_TYPE_GENERIC, STAT_PHASE_0); - START_CYCLE_COUNT_AT(drvdata->isr_exit_cycles); - return IRQ_HANDLED; } @@ -509,9 +504,6 @@ static int cc7x_remove(struct platform_device *plat_dev) cleanup_cc_resources(plat_dev); SSI_LOG(KERN_INFO, "ARM cc7x_ree device terminated\n"); -#ifdef ENABLE_CYCLE_COUNT - display_all_stat_db(); -#endif return 0; } diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index c0bb1a142b89..658a7ed12dc1 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -117,11 +117,6 @@ struct ssi_crypto_req { unsigned int ivgen_dma_addr_len; /* Amount of 'ivgen_dma_addr' elements to be filled. */ unsigned int ivgen_size; /* The generated IV size required, 8/16 B allowed. */ struct completion seq_compl; /* request completion */ -#ifdef ENABLE_CYCLE_COUNT - enum stat_op op_type; - cycles_t submit_cycle; - bool is_monitored_p; -#endif }; /** @@ -153,10 +148,6 @@ struct ssi_drvdata { void *fips_handle; void *ivgen_handle; void *sram_mgr_handle; - -#ifdef ENABLE_CYCLE_COUNT - cycles_t isr_exit_cycles; /* Save for isr-to-tasklet latency */ -#endif u32 inflight_counter; }; @@ -202,22 +193,6 @@ void dump_byte_array(const char *name, const u8 *the_array, unsigned long size); } while (0); #endif -#ifdef ENABLE_CYCLE_COUNT -#define DECL_CYCLE_COUNT_RESOURCES cycles_t _last_cycles_read -#define START_CYCLE_COUNT() do { _last_cycles_read = get_cycles(); } while (0) -#define END_CYCLE_COUNT(_stat_op_type, _stat_phase) update_host_stat(_stat_op_type, _stat_phase, get_cycles() - _last_cycles_read) -#define GET_START_CYCLE_COUNT() _last_cycles_read -#define START_CYCLE_COUNT_AT(_var) do { _var = get_cycles(); } while(0) -#define END_CYCLE_COUNT_AT(_var, _stat_op_type, _stat_phase) update_host_stat(_stat_op_type, _stat_phase, get_cycles() - _var) -#else -#define DECL_CYCLE_COUNT_RESOURCES -#define START_CYCLE_COUNT() do { } while (0) -#define END_CYCLE_COUNT(_stat_op_type, _stat_phase) do { } while (0) -#define GET_START_CYCLE_COUNT() 0 -#define START_CYCLE_COUNT_AT(_var) do { } while (0) -#define END_CYCLE_COUNT_AT(_var, _stat_op_type, _stat_phase) do { } while (0) -#endif /*ENABLE_CYCLE_COUNT*/ - int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe); void fini_cc_regs(struct ssi_drvdata *drvdata); diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 66405e91fe7f..47bc496243f4 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -460,9 +460,6 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_digest_complete; ssi_req.user_arg = (void *)async_req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ -#endif } /* If HMAC then load hash IPAD xor key, if HASH then load initial digest */ @@ -630,9 +627,6 @@ static int ssi_hash_update(struct ahash_req_ctx *state, /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_update_complete; ssi_req.user_arg = async_req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ -#endif } /* Restore hash digest */ @@ -725,9 +719,6 @@ static int ssi_hash_finup(struct ahash_req_ctx *state, /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_complete; ssi_req.user_arg = async_req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ -#endif } /* Restore hash digest */ @@ -866,9 +857,6 @@ static int ssi_hash_final(struct ahash_req_ctx *state, /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_complete; ssi_req.user_arg = async_req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ -#endif } /* Restore hash digest */ @@ -1308,7 +1296,6 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, const u8 *key, unsigned int keylen) { struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash); - DECL_CYCLE_COUNT_RESOURCES; SSI_LOG_DEBUG("===== setkey (%d) ====\n", keylen); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -1326,7 +1313,6 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, ctx->key_params.keylen = keylen; /* STAT_PHASE_1: Copy key to ctx */ - START_CYCLE_COUNT(); dma_sync_single_for_cpu(&ctx->drvdata->plat_dev->dev, ctx->opad_tmp_keys_dma_addr, @@ -1342,7 +1328,6 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, ctx->key_params.keylen = keylen; - END_CYCLE_COUNT(STAT_OP_TYPE_SETKEY, STAT_PHASE_1); return 0; } @@ -1510,9 +1495,6 @@ static int ssi_mac_update(struct ahash_request *req) /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_update_complete; ssi_req.user_arg = (void *)req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ -#endif rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1); if (unlikely(rc != -EINPROGRESS)) { @@ -1563,9 +1545,6 @@ static int ssi_mac_final(struct ahash_request *req) /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_complete; ssi_req.user_arg = (void *)req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ -#endif if (state->xcbc_count && (rem_cnt == 0)) { /* Load key for ECB decryption */ @@ -1671,9 +1650,6 @@ static int ssi_mac_finup(struct ahash_request *req) /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_complete; ssi_req.user_arg = (void *)req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ -#endif if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { key_len = CC_AES_128_BIT_KEY_SIZE; @@ -1747,10 +1723,6 @@ static int ssi_mac_digest(struct ahash_request *req) /* Setup DX request structure */ ssi_req.user_cb = (void *)ssi_hash_digest_complete; ssi_req.user_arg = (void *)req; -#ifdef ENABLE_CYCLE_COUNT - ssi_req.op_type = STAT_OP_TYPE_ENCODE; /* Use "Encode" stats */ -#endif - if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { keyLen = CC_AES_128_BIT_KEY_SIZE; diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 2ec296cc79d0..2382f32888bf 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -37,74 +37,6 @@ #define AXIM_MON_BASE_OFFSET CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_COMP) -#ifdef CC_CYCLE_COUNT - -#define MONITOR_CNTR_BIT 0 - -/** - * Monitor descriptor. - * Used to measure CC performance. - */ -#define INIT_CC_MONITOR_DESC(desc_p) \ -do { \ - hw_desc_init(desc_p); \ - HW_DESC_SET_DIN_MONITOR_CNTR(desc_p); \ -} while (0) - -/** - * Try adding monitor descriptor BEFORE enqueuing sequence. - */ -#define CC_CYCLE_DESC_HEAD(cc_base_addr, desc_p, lock_p, is_monitored_p) \ -do { \ - if (!test_and_set_bit(MONITOR_CNTR_BIT, (lock_p))) { \ - enqueue_seq((cc_base_addr), (desc_p), 1); \ - *(is_monitored_p) = true; \ - } else { \ - *(is_monitored_p) = false; \ - } \ -} while (0) - -/** - * If CC_CYCLE_DESC_HEAD was successfully added: - * 1. Add memory barrier descriptor to ensure last AXI transaction. - * 2. Add monitor descriptor to sequence tail AFTER enqueuing sequence. - */ -#define CC_CYCLE_DESC_TAIL(cc_base_addr, desc_p, is_monitored) \ -do { \ - if ((is_monitored) == true) { \ - struct cc_hw_desc barrier_desc; \ - hw_desc_init(&barrier_desc); \ - set_din_no_dma(&barrier_desc, 0, 0xfffff0); \ - set_dout_no_dma(&barrier_desc, 0, 0, 1); \ - enqueue_seq((cc_base_addr), &barrier_desc, 1); \ - enqueue_seq((cc_base_addr), (desc_p), 1); \ - } \ -} while (0) - -/** - * Try reading CC monitor counter value upon sequence complete. - * Can only succeed if the lock_p is taken by the owner of the given request. - */ -#define END_CC_MONITOR_COUNT(cc_base_addr, stat_op_type, stat_phase, monitor_null_cycles, lock_p, is_monitored) \ -do { \ - u32 elapsed_cycles; \ - if ((is_monitored) == true) { \ - elapsed_cycles = READ_REGISTER((cc_base_addr) + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_MEASURE_CNTR)); \ - clear_bit(MONITOR_CNTR_BIT, (lock_p)); \ - if (elapsed_cycles > 0) \ - update_cc_stat(stat_op_type, stat_phase, (elapsed_cycles - monitor_null_cycles)); \ - } \ -} while (0) - -#else /*CC_CYCLE_COUNT*/ - -#define INIT_CC_MONITOR_DESC(desc_p) do { } while (0) -#define CC_CYCLE_DESC_HEAD(cc_base_addr, desc_p, lock_p, is_monitored_p) do { } while (0) -#define CC_CYCLE_DESC_TAIL(cc_base_addr, desc_p, is_monitored) do { } while (0) -#define END_CC_MONITOR_COUNT(cc_base_addr, stat_op_type, stat_phase, monitor_null_cycles, lock_p, is_monitored) do { } while (0) -#endif /*CC_CYCLE_COUNT*/ - - struct ssi_request_mgr_handle { /* Request manager resources */ unsigned int hw_queue_size; /* HW capability */ @@ -168,10 +100,6 @@ void request_mgr_fini(struct ssi_drvdata *drvdata) int request_mgr_init(struct ssi_drvdata *drvdata) { -#ifdef CC_CYCLE_COUNT - struct cc_hw_desc monitor_desc[2]; - struct ssi_crypto_req monitor_req = {0}; -#endif struct ssi_request_mgr_handle *req_mgr_h; int rc = 0; @@ -228,24 +156,6 @@ int request_mgr_init(struct ssi_drvdata *drvdata) set_flow_mode(&req_mgr_h->compl_desc, BYPASS); set_queue_last_ind(&req_mgr_h->compl_desc); -#ifdef CC_CYCLE_COUNT - /* For CC-HW cycle performance trace */ - INIT_CC_MONITOR_DESC(&req_mgr_h->monitor_desc); - set_bit(MONITOR_CNTR_BIT, &req_mgr_h->monitor_lock); - monitor_desc[0] = req_mgr_h->monitor_desc; - monitor_desc[1] = req_mgr_h->monitor_desc; - - rc = send_request(drvdata, &monitor_req, monitor_desc, 2, 0); - if (unlikely(rc != 0)) - goto req_mgr_init_err; - - drvdata->monitor_null_cycles = READ_REGISTER(drvdata->cc_base + - CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_MEASURE_CNTR)); - SSI_LOG_ERR("Calibration time=0x%08x\n", drvdata->monitor_null_cycles); - - clear_bit(MONITOR_CNTR_BIT, &req_mgr_h->monitor_lock); -#endif - return 0; req_mgr_init_err: @@ -367,7 +277,6 @@ int send_request( ((ssi_req->ivgen_dma_addr_len == 0) ? 0 : SSI_IVPOOL_SEQ_LEN ) + ((is_dout == 0 )? 1 : 0)); - DECL_CYCLE_COUNT_RESOURCES; #if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) rc = ssi_power_mgr_runtime_get(&drvdata->plat_dev->dev); @@ -446,12 +355,8 @@ int send_request( req_mgr_h->max_used_sw_slots = used_sw_slots; } - CC_CYCLE_DESC_HEAD(cc_base, &req_mgr_h->monitor_desc, - &req_mgr_h->monitor_lock, &ssi_req->is_monitored_p); - /* Enqueue request - must be locked with HW lock*/ req_mgr_h->req_queue[req_mgr_h->req_queue_head] = *ssi_req; - START_CYCLE_COUNT_AT(req_mgr_h->req_queue[req_mgr_h->req_queue_head].submit_cycle); req_mgr_h->req_queue_head = (req_mgr_h->req_queue_head + 1) & (MAX_REQUEST_QUEUE_SIZE - 1); /* TODO: Use circ_buf.h ? */ @@ -462,13 +367,9 @@ int send_request( #endif /* STAT_PHASE_4: Push sequence */ - START_CYCLE_COUNT(); enqueue_seq(cc_base, iv_seq, iv_seq_len); enqueue_seq(cc_base, desc, len); enqueue_seq(cc_base, &req_mgr_h->compl_desc, (is_dout ? 0 : 1)); - END_CYCLE_COUNT(ssi_req->op_type, STAT_PHASE_4); - - CC_CYCLE_DESC_TAIL(cc_base, &req_mgr_h->monitor_desc, ssi_req->is_monitored_p); if (unlikely(req_mgr_h->q_free_slots < total_seq_len)) { /*This means that there was a problem with the resume*/ @@ -558,7 +459,6 @@ static void proc_completions(struct ssi_drvdata *drvdata) #if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) int rc = 0; #endif - DECL_CYCLE_COUNT_RESOURCES; while(request_mgr_handle->axi_completed) { request_mgr_handle->axi_completed--; @@ -570,9 +470,6 @@ static void proc_completions(struct ssi_drvdata *drvdata) } ssi_req = &request_mgr_handle->req_queue[request_mgr_handle->req_queue_tail]; - END_CYCLE_COUNT_AT(ssi_req->submit_cycle, ssi_req->op_type, STAT_PHASE_5); /* Seq. Comp. */ - END_CC_MONITOR_COUNT(drvdata->cc_base, ssi_req->op_type, STAT_PHASE_6, - drvdata->monitor_null_cycles, &request_mgr_handle->monitor_lock, ssi_req->is_monitored_p); #ifdef FLUSH_CACHE_ALL flush_cache_all(); @@ -591,9 +488,7 @@ static void proc_completions(struct ssi_drvdata *drvdata) #endif /* COMPLETION_DELAY */ if (likely(ssi_req->user_cb != NULL)) { - START_CYCLE_COUNT(); ssi_req->user_cb(&plat_dev->dev, ssi_req->user_arg, drvdata->cc_base); - END_CYCLE_COUNT(STAT_OP_TYPE_GENERIC, STAT_PHASE_3); } request_mgr_handle->req_queue_tail = (request_mgr_handle->req_queue_tail + 1) & (MAX_REQUEST_QUEUE_SIZE - 1); SSI_LOG_DEBUG("Dequeue request tail=%u\n", request_mgr_handle->req_queue_tail); @@ -617,9 +512,7 @@ static void comp_handler(unsigned long devarg) u32 irq; - DECL_CYCLE_COUNT_RESOURCES; - START_CYCLE_COUNT(); irq = (drvdata->irq & SSI_COMP_IRQ_MASK); @@ -631,14 +524,6 @@ static void comp_handler(unsigned long devarg) request_mgr_handle->axi_completed += CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); - /* ISR-to-Tasklet latency */ - if (request_mgr_handle->axi_completed) { - /* Only if actually reflects ISR-to-completion-handling latency, i.e., - * not duplicate as a result of interrupt after AXIM_MON_ERR clear, before end of loop - */ - END_CYCLE_COUNT_AT(drvdata->isr_exit_cycles, STAT_OP_TYPE_GENERIC, STAT_PHASE_1); - } - while (request_mgr_handle->axi_completed) { do { proc_completions(drvdata); @@ -662,7 +547,6 @@ static void comp_handler(unsigned long devarg) CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), CC_HAL_READ_REGISTER( CC_REG_OFFSET(HOST_RGF, HOST_IMR)) & ~irq); - END_CYCLE_COUNT(STAT_OP_TYPE_GENERIC, STAT_PHASE_2); } /* -- cgit v1.2.3-55-g7522 From 37a99c98313fc506d42109d6b70a63e8ac1136bc Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:29 +0300 Subject: staging: ccree: move request_mgr to generic bitfield ops request_mgr was using custom bit field macros. move over to standard kernel bitfield ops. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_regs.h | 5 +++++ drivers/staging/ccree/ssi_request_mgr.c | 27 +++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_regs.h b/drivers/staging/ccree/cc_regs.h index 151341200d6a..6abb6ffd600d 100644 --- a/drivers/staging/ccree/cc_regs.h +++ b/drivers/staging/ccree/cc_regs.h @@ -26,6 +26,11 @@ #include "cc_bitops.h" +#define AXIM_MON_BASE_OFFSET CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_COMP) +#define AXIM_MON_COMP_VALUE GENMASK(DX_AXIM_MON_COMP_VALUE_BIT_SIZE + \ + DX_AXIM_MON_COMP_VALUE_BIT_SHIFT, \ + DX_AXIM_MON_COMP_VALUE_BIT_SHIFT) + /* Register Offset macro */ #define CC_REG_OFFSET(unit_name, reg_name) \ (DX_BASE_ ## unit_name + DX_ ## reg_name ## _REG_OFFSET) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 2382f32888bf..7c2d88a8fe60 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -35,8 +35,6 @@ #define SSI_MAX_POLL_ITER 10 -#define AXIM_MON_BASE_OFFSET CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_COMP) - struct ssi_request_mgr_handle { /* Request manager resources */ unsigned int hw_queue_size; /* HW capability */ @@ -502,6 +500,15 @@ static void proc_completions(struct ssi_drvdata *drvdata) } } +static inline u32 cc_axi_comp_count(void __iomem *cc_base) +{ + /* The CC_HAL_READ_REGISTER macro implictly requires and uses + * a base MMIO register address variable named cc_base. + */ + return FIELD_GET(AXIM_MON_COMP_VALUE, + CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); +} + /* Deferred service handler, run as interrupt-fired tasklet */ static void comp_handler(unsigned long devarg) { @@ -521,25 +528,25 @@ static void comp_handler(unsigned long devarg) CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), SSI_COMP_IRQ_MASK); /* Avoid race with above clear: Test completion counter once more */ - request_mgr_handle->axi_completed += CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, - CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); + request_mgr_handle->axi_completed += + cc_axi_comp_count(cc_base); while (request_mgr_handle->axi_completed) { do { proc_completions(drvdata); - /* At this point (after proc_completions()), request_mgr_handle->axi_completed is always 0. - * The following assignment was changed to = (previously was +=) to conform KW restrictions. + /* At this point (after proc_completions()), + * request_mgr_handle->axi_completed is 0. */ - request_mgr_handle->axi_completed = CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, - CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); + request_mgr_handle->axi_completed = + cc_axi_comp_count(cc_base); } while (request_mgr_handle->axi_completed > 0); /* To avoid the interrupt from firing as we unmask it, we clear it now */ CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), SSI_COMP_IRQ_MASK); /* Avoid race with above clear: Test completion counter once more */ - request_mgr_handle->axi_completed += CC_REG_FLD_GET(CRY_KERNEL, AXIM_MON_COMP, VALUE, - CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET)); + request_mgr_handle->axi_completed += + cc_axi_comp_count(cc_base); } } -- cgit v1.2.3-55-g7522 From ed7443911ec1584b182304117f1f0b0adfa02079 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:30 +0300 Subject: staging: ccree: remove custom bitfield macros With all users removed or re-factored to use the standard kernel bit fields ops we can now drop the custom bit field macros. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_bitops.h | 39 ------------------ drivers/staging/ccree/cc_hw_queue_defs.h | 2 +- drivers/staging/ccree/cc_lli_defs.h | 2 - drivers/staging/ccree/cc_regs.h | 71 +++----------------------------- drivers/staging/ccree/ssi_driver.h | 1 - 5 files changed, 7 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/ccree/cc_bitops.h (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_bitops.h b/drivers/staging/ccree/cc_bitops.h deleted file mode 100644 index cbdc1ab5cb5a..000000000000 --- a/drivers/staging/ccree/cc_bitops.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -/*! - * \file cc_bitops.h - * Bit fields operations macros. - */ -#ifndef _CC_BITOPS_H_ -#define _CC_BITOPS_H_ - -#include -#include - -#define BITMASK(mask_size) (((mask_size) < 32) ? \ - ((1UL << (mask_size)) - 1) : 0xFFFFFFFFUL) - -#define BITMASK_AT(mask_size, mask_offset) (BITMASK(mask_size) << (mask_offset)) - -#define BITFIELD_GET(word, bit_offset, bit_size) \ - (((word) >> (bit_offset)) & BITMASK(bit_size)) -#define BITFIELD_SET(word, bit_offset, bit_size, new_val) do { \ - word = ((word) & ~BITMASK_AT(bit_size, bit_offset)) | \ - (((new_val) & BITMASK(bit_size)) << (bit_offset)); \ -} while (0) - -#endif /*_CC_BITOPS_H_*/ diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index e75081710f0f..8dc9b6ed07f9 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -19,8 +19,8 @@ #include -#include "cc_regs.h" #include "dx_crys_kernel.h" +#include /****************************************************************************** * DEFINITIONS diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index 78811aa2c513..851d3907167e 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -19,8 +19,6 @@ #include -#include "cc_bitops.h" - /* Max DLLI size * AKA DX_DSCRPTR_QUEUE_WORD1_DIN_SIZE_BIT_SIZE */ diff --git a/drivers/staging/ccree/cc_regs.h b/drivers/staging/ccree/cc_regs.h index 6abb6ffd600d..53675e3a7986 100644 --- a/drivers/staging/ccree/cc_regs.h +++ b/drivers/staging/ccree/cc_regs.h @@ -24,7 +24,12 @@ #ifndef _CC_REGS_H_ #define _CC_REGS_H_ -#include "cc_bitops.h" +#include + +#define AXIM_MON_BASE_OFFSET CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_COMP) +#define AXIM_MON_COMP_VALUE GENMASK(DX_AXIM_MON_COMP_VALUE_BIT_SIZE + \ + DX_AXIM_MON_COMP_VALUE_BIT_SHIFT, \ + DX_AXIM_MON_COMP_VALUE_BIT_SHIFT) #define AXIM_MON_BASE_OFFSET CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_COMP) #define AXIM_MON_COMP_VALUE GENMASK(DX_AXIM_MON_COMP_VALUE_BIT_SIZE + \ @@ -35,68 +40,4 @@ #define CC_REG_OFFSET(unit_name, reg_name) \ (DX_BASE_ ## unit_name + DX_ ## reg_name ## _REG_OFFSET) -#define CC_REG_BIT_SHIFT(reg_name, field_name) \ - (DX_ ## reg_name ## _ ## field_name ## _BIT_SHIFT) - -/* Read-Modify-Write a field of a register */ -#define MODIFY_REGISTER_FLD(unitName, regName, fldName, fldVal) \ -do { \ - u32 regVal; \ - regVal = READ_REGISTER(CC_REG_ADDR(unitName, regName)); \ - CC_REG_FLD_SET(unitName, regName, fldName, regVal, fldVal); \ - WRITE_REGISTER(CC_REG_ADDR(unitName, regName), regVal); \ -} while (0) - -/*! Bit fields get */ -#define CC_REG_FLD_GET(unit_name, reg_name, fld_name, reg_val) \ - (DX_ ## reg_name ## _ ## fld_name ## _BIT_SIZE == 0x20 ? \ - reg_val /*!< \internal Optimization for 32b fields */ : \ - BITFIELD_GET(reg_val, DX_ ## reg_name ## _ ## fld_name ## _BIT_SHIFT, \ - DX_ ## reg_name ## _ ## fld_name ## _BIT_SIZE)) - -/*! Bit fields access */ -#define CC_REG_FLD_GET2(unit_name, reg_name, fld_name, reg_val) \ - (CC_ ## reg_name ## _ ## fld_name ## _BIT_SIZE == 0x20 ? \ - reg_val /*!< \internal Optimization for 32b fields */ : \ - BITFIELD_GET(reg_val, CC_ ## reg_name ## _ ## fld_name ## _BIT_SHIFT, \ - CC_ ## reg_name ## _ ## fld_name ## _BIT_SIZE)) - -/* yael TBD !!! - * all HW includes should start with CC_ and not DX_ !! - */ - - -/*! Bit fields set */ -#define CC_REG_FLD_SET( \ - unit_name, reg_name, fld_name, reg_shadow_var, new_fld_val) \ -do { \ - if (DX_ ## reg_name ## _ ## fld_name ## _BIT_SIZE == 0x20) \ - reg_shadow_var = new_fld_val; /*!< \internal Optimization for 32b fields */\ - else \ - BITFIELD_SET(reg_shadow_var, \ - DX_ ## reg_name ## _ ## fld_name ## _BIT_SHIFT, \ - DX_ ## reg_name ## _ ## fld_name ## _BIT_SIZE, \ - new_fld_val); \ -} while (0) - -/*! Bit fields set */ -#define CC_REG_FLD_SET2( \ - unit_name, reg_name, fld_name, reg_shadow_var, new_fld_val) \ -do { \ - if (CC_ ## reg_name ## _ ## fld_name ## _BIT_SIZE == 0x20) \ - reg_shadow_var = new_fld_val; /*!< \internal Optimization for 32b fields */\ - else \ - BITFIELD_SET(reg_shadow_var, \ - CC_ ## reg_name ## _ ## fld_name ## _BIT_SHIFT, \ - CC_ ## reg_name ## _ ## fld_name ## _BIT_SIZE, \ - new_fld_val); \ -} while (0) - -/* Usage example: - * u32 reg_shadow = READ_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL)); - * CC_REG_FLD_SET(CRY_KERNEL,AES_CONTROL,NK_KEY0,reg_shadow, 3); - * CC_REG_FLD_SET(CRY_KERNEL,AES_CONTROL,NK_KEY1,reg_shadow, 1); - * WRITE_REGISTER(CC_REG_ADDR(CRY_KERNEL,AES_CONTROL), reg_shadow); - */ - #endif /*_CC_REGS_H_*/ diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 658a7ed12dc1..4c6eef9f97f5 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -40,7 +40,6 @@ /* Registers definitions from shared/hw/ree_include */ #include "dx_reg_base_host.h" #include "dx_host.h" -#define DX_CC_HOST_VIRT /* must be defined before including dx_cc_regs.h */ #include "cc_regs.h" #include "dx_reg_common.h" #include "cc_hal.h" -- cgit v1.2.3-55-g7522 From c928f1d7cb691584184fcb408b61ad9ed600130f Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:31 +0300 Subject: staging: ccree: remove unused struct struct SepHashPrivateContext is not used anywhere in the code. Remove it. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/hash_defs.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/hash_defs.h b/drivers/staging/ccree/hash_defs.h index 3f2b2d1521c2..9e01219f2b2a 100644 --- a/drivers/staging/ccree/hash_defs.h +++ b/drivers/staging/ccree/hash_defs.h @@ -57,23 +57,5 @@ enum HashCipherDoPadding { HASH_CIPHER_DO_PADDING_RESERVE32 = S32_MAX, }; -typedef struct SepHashPrivateContext { - /* The current length is placed at the end of the context buffer because the hash - * context is used for all HMAC operations as well. HMAC context includes a 64 bytes - * K0 field. The size of struct drv_ctx_hash reserved field is 88/184 bytes depend if t - * he SHA512 is supported ( in this case teh context size is 256 bytes). - * The size of struct drv_ctx_hash reseved field is 20 or 52 depend if the SHA512 is supported. - * This means that this structure size (without the reserved field can be up to 20 bytes , - * in case sha512 is not suppported it is 20 bytes (SEP_HASH_LENGTH_WORDS define to 2 ) and in the other - * case it is 28 (SEP_HASH_LENGTH_WORDS define to 4) - */ - u32 reserved[(sizeof(struct drv_ctx_hash)/sizeof(u32)) - SEP_HASH_LENGTH_WORDS - 3]; - u32 CurrentDigestedLength[SEP_HASH_LENGTH_WORDS]; - u32 KeyType; - u32 dataCompleted; - u32 hmacFinalization; - /* no space left */ -} SepHashPrivateContext_s; - #endif /*_HASH_DEFS_H__*/ -- cgit v1.2.3-55-g7522 From 84d69a7b03ea00864fff34ee3c95ee7ab679f26e Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:32 +0300 Subject: staging: ccree: use snake_case for hash enums Hash enum were named using CamelCase, move over to snake_case. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 4 ++-- drivers/staging/ccree/hash_defs.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 8dc9b6ed07f9..1cbd2e12c0ab 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -505,7 +505,7 @@ static inline void set_cipher_config0(struct cc_hw_desc *pdesc, * @config: Any one of the modes defined in [CC7x-DESC] */ static inline void set_cipher_config1(struct cc_hw_desc *pdesc, - enum HashConfig1Padding config) + enum cc_hash_conf_pad config) { pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_CONF1, config); } @@ -598,7 +598,7 @@ static inline void set_setup_mode(struct cc_hw_desc *pdesc, * @config: Any one of the cipher do defined in [CC7x-DESC] */ static inline void set_cipher_do(struct cc_hw_desc *pdesc, - enum HashCipherDoPadding config) + enum cc_hash_cipher_pad config) { pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_DO, (config & HW_KEY_MASK_CIPHER_DO)); diff --git a/drivers/staging/ccree/hash_defs.h b/drivers/staging/ccree/hash_defs.h index 9e01219f2b2a..872ed9756d27 100644 --- a/drivers/staging/ccree/hash_defs.h +++ b/drivers/staging/ccree/hash_defs.h @@ -44,14 +44,14 @@ #define HASH_LARVAL_SHA512 0x5be0cd19, 0x137e2179, 0x1f83d9ab, 0xfb41bd6b, 0x9b05688c, 0x2b3e6c1f, 0x510e527f, 0xade682d1, 0xa54ff53a, 0x5f1d36f1, 0x3c6ef372, 0xfe94f82b, 0xbb67ae85, 0x84caa73b, 0x6a09e667, 0xf3bcc908 #endif -enum HashConfig1Padding { +enum cc_hash_conf_pad { HASH_PADDING_DISABLED = 0, HASH_PADDING_ENABLED = 1, HASH_DIGEST_RESULT_LITTLE_ENDIAN = 2, HASH_CONFIG1_PADDING_RESERVE32 = S32_MAX, }; -enum HashCipherDoPadding { +enum cc_hash_cipher_pad { DO_NOT_PAD = 0, DO_PAD = 1, HASH_CIPHER_DO_PADDING_RESERVE32 = S32_MAX, -- cgit v1.2.3-55-g7522 From ef78342266fef6bbb07587be2b0c70e5cdad2519 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:33 +0300 Subject: staging: ccree: drop no longer used macro MSB64 macro is no longer used or needed. Drop it. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 1cbd2e12c0ab..aaa56c85bda2 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -237,8 +237,6 @@ static inline void set_ack_last(struct cc_hw_desc *pdesc) pdesc->word[4] |= FIELD_PREP(WORD4_ACK_NEEDED, 1); } -#define MSB64(_addr) (sizeof(_addr) == 4 ? 0 : ((_addr) >> 32) & U16_MAX) - /* * Set the DIN field of a HW descriptors * -- cgit v1.2.3-55-g7522 From 1c0cccd9aa33595849ce0e944be1d44e603e4e95 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:34 +0300 Subject: staging: ccree: remove dead code Remove some unused macro definitions from hash definitions. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/hash_defs.h | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/hash_defs.h b/drivers/staging/ccree/hash_defs.h index 872ed9756d27..f52656f5a3ea 100644 --- a/drivers/staging/ccree/hash_defs.h +++ b/drivers/staging/ccree/hash_defs.h @@ -14,36 +14,11 @@ * along with this program; if not, see . */ -#ifndef _HASH_DEFS_H__ -#define _HASH_DEFS_H__ +#ifndef _HASH_DEFS_H_ +#define _HASH_DEFS_H_ #include "cc_crypto_ctx.h" -/* this files provides definitions required for hash engine drivers */ -#ifndef CC_CONFIG_HASH_SHA_512_SUPPORTED -#define SEP_HASH_LENGTH_WORDS 2 -#else -#define SEP_HASH_LENGTH_WORDS 4 -#endif - -#ifdef BIG__ENDIAN -#define OPAD_CURRENT_LENGTH 0x40000000, 0x00000000 , 0x00000000, 0x00000000 -#define HASH_LARVAL_MD5 0x76543210, 0xFEDCBA98, 0x89ABCDEF, 0x01234567 -#define HASH_LARVAL_SHA1 0xF0E1D2C3, 0x76543210, 0xFEDCBA98, 0x89ABCDEF, 0x01234567 -#define HASH_LARVAL_SHA224 0XA44FFABE, 0XA78FF964, 0X11155868, 0X310BC0FF, 0X39590EF7, 0X17DD7030, 0X07D57C36, 0XD89E05C1 -#define HASH_LARVAL_SHA256 0X19CDE05B, 0XABD9831F, 0X8C68059B, 0X7F520E51, 0X3AF54FA5, 0X72F36E3C, 0X85AE67BB, 0X67E6096A -#define HASH_LARVAL_SHA384 0X1D48B547, 0XA44FFABE, 0X0D2E0CDB, 0XA78FF964, 0X874AB48E, 0X11155868, 0X67263367, 0X310BC0FF, 0XD8EC2F15, 0X39590EF7, 0X5A015991, 0X17DD7030, 0X2A299A62, 0X07D57C36, 0X5D9DBBCB, 0XD89E05C1 -#define HASH_LARVAL_SHA512 0X19CDE05B, 0X79217E13, 0XABD9831F, 0X6BBD41FB, 0X8C68059B, 0X1F6C3E2B, 0X7F520E51, 0XD182E6AD, 0X3AF54FA5, 0XF1361D5F, 0X72F36E3C, 0X2BF894FE, 0X85AE67BB, 0X3BA7CA84, 0X67E6096A, 0X08C9BCF3 -#else -#define OPAD_CURRENT_LENGTH 0x00000040, 0x00000000, 0x00000000, 0x00000000 -#define HASH_LARVAL_MD5 0x10325476, 0x98BADCFE, 0xEFCDAB89, 0x67452301 -#define HASH_LARVAL_SHA1 0xC3D2E1F0, 0x10325476, 0x98BADCFE, 0xEFCDAB89, 0x67452301 -#define HASH_LARVAL_SHA224 0xbefa4fa4, 0x64f98fa7, 0x68581511, 0xffc00b31, 0xf70e5939, 0x3070dd17, 0x367cd507, 0xc1059ed8 -#define HASH_LARVAL_SHA256 0x5be0cd19, 0x1f83d9ab, 0x9b05688c, 0x510e527f, 0xa54ff53a, 0x3c6ef372, 0xbb67ae85, 0x6a09e667 -#define HASH_LARVAL_SHA384 0X47B5481D, 0XBEFA4FA4, 0XDB0C2E0D, 0X64F98FA7, 0X8EB44A87, 0X68581511, 0X67332667, 0XFFC00B31, 0X152FECD8, 0XF70E5939, 0X9159015A, 0X3070DD17, 0X629A292A, 0X367CD507, 0XCBBB9D5D, 0XC1059ED8 -#define HASH_LARVAL_SHA512 0x5be0cd19, 0x137e2179, 0x1f83d9ab, 0xfb41bd6b, 0x9b05688c, 0x2b3e6c1f, 0x510e527f, 0xade682d1, 0xa54ff53a, 0x5f1d36f1, 0x3c6ef372, 0xfe94f82b, 0xbb67ae85, 0x84caa73b, 0x6a09e667, 0xf3bcc908 -#endif - enum cc_hash_conf_pad { HASH_PADDING_DISABLED = 0, HASH_PADDING_ENABLED = 1, @@ -57,5 +32,5 @@ enum cc_hash_cipher_pad { HASH_CIPHER_DO_PADDING_RESERVE32 = S32_MAX, }; -#endif /*_HASH_DEFS_H__*/ +#endif /*_HASH_DEFS_H_*/ -- cgit v1.2.3-55-g7522 From ee15d1694623f7c0398e3c06bd2b452eba8a0d05 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:35 +0300 Subject: staging: ccree: remove spurious blank line Remove spurious blank line from cc_regs.h Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_regs.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_regs.h b/drivers/staging/ccree/cc_regs.h index 53675e3a7986..4a893a6ba6ef 100644 --- a/drivers/staging/ccree/cc_regs.h +++ b/drivers/staging/ccree/cc_regs.h @@ -14,7 +14,6 @@ * along with this program; if not, see . */ - /*! * @file * @brief This file contains macro definitions for accessing ARM TrustZone -- cgit v1.2.3-55-g7522 From 087fabd1cd5f046b9b461a356465806077340db2 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:36 +0300 Subject: staging: ccree: fix wrong whitespace usage Some of the register definition files had none kernel coding style usage of tabs vs. spaces in macro definitions. This patch fixes them. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/dx_crys_kernel.h | 308 ++++++++++++++++----------------- drivers/staging/ccree/dx_host.h | 256 +++++++++++++-------------- 2 files changed, 282 insertions(+), 282 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/dx_crys_kernel.h b/drivers/staging/ccree/dx_crys_kernel.h index a776e24af55d..219603030344 100644 --- a/drivers/staging/ccree/dx_crys_kernel.h +++ b/drivers/staging/ccree/dx_crys_kernel.h @@ -20,161 +20,161 @@ // -------------------------------------- // BLOCK: DSCRPTR // -------------------------------------- -#define DX_DSCRPTR_COMPLETION_COUNTER_REG_OFFSET 0xE00UL -#define DX_DSCRPTR_COMPLETION_COUNTER_COMPLETION_COUNTER_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_COMPLETION_COUNTER_COMPLETION_COUNTER_BIT_SIZE 0x6UL -#define DX_DSCRPTR_COMPLETION_COUNTER_OVERFLOW_COUNTER_BIT_SHIFT 0x6UL -#define DX_DSCRPTR_COMPLETION_COUNTER_OVERFLOW_COUNTER_BIT_SIZE 0x1UL -#define DX_DSCRPTR_SW_RESET_REG_OFFSET 0xE40UL -#define DX_DSCRPTR_SW_RESET_VALUE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_SW_RESET_VALUE_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_SRAM_SIZE_REG_OFFSET 0xE60UL -#define DX_DSCRPTR_QUEUE_SRAM_SIZE_NUM_OF_DSCRPTR_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_SRAM_SIZE_NUM_OF_DSCRPTR_BIT_SIZE 0xAUL -#define DX_DSCRPTR_QUEUE_SRAM_SIZE_DSCRPTR_SRAM_SIZE_BIT_SHIFT 0xAUL -#define DX_DSCRPTR_QUEUE_SRAM_SIZE_DSCRPTR_SRAM_SIZE_BIT_SIZE 0xCUL -#define DX_DSCRPTR_QUEUE_SRAM_SIZE_SRAM_SIZE_BIT_SHIFT 0x16UL -#define DX_DSCRPTR_QUEUE_SRAM_SIZE_SRAM_SIZE_BIT_SIZE 0x3UL -#define DX_DSCRPTR_SINGLE_ADDR_EN_REG_OFFSET 0xE64UL -#define DX_DSCRPTR_SINGLE_ADDR_EN_VALUE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_SINGLE_ADDR_EN_VALUE_BIT_SIZE 0x1UL -#define DX_DSCRPTR_MEASURE_CNTR_REG_OFFSET 0xE68UL -#define DX_DSCRPTR_MEASURE_CNTR_VALUE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_MEASURE_CNTR_VALUE_BIT_SIZE 0x20UL -#define DX_DSCRPTR_QUEUE_WORD0_REG_OFFSET 0xE80UL -#define DX_DSCRPTR_QUEUE_WORD0_VALUE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_WORD0_VALUE_BIT_SIZE 0x20UL -#define DX_DSCRPTR_QUEUE_WORD1_REG_OFFSET 0xE84UL -#define DX_DSCRPTR_QUEUE_WORD1_DIN_DMA_MODE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_WORD1_DIN_DMA_MODE_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD1_DIN_SIZE_BIT_SHIFT 0x2UL -#define DX_DSCRPTR_QUEUE_WORD1_DIN_SIZE_BIT_SIZE 0x18UL -#define DX_DSCRPTR_QUEUE_WORD1_NS_BIT_BIT_SHIFT 0x1AUL -#define DX_DSCRPTR_QUEUE_WORD1_NS_BIT_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD1_DIN_CONST_VALUE_BIT_SHIFT 0x1BUL -#define DX_DSCRPTR_QUEUE_WORD1_DIN_CONST_VALUE_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD1_NOT_LAST_BIT_SHIFT 0x1CUL -#define DX_DSCRPTR_QUEUE_WORD1_NOT_LAST_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD1_LOCK_QUEUE_BIT_SHIFT 0x1DUL -#define DX_DSCRPTR_QUEUE_WORD1_LOCK_QUEUE_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD1_NOT_USED_BIT_SHIFT 0x1EUL -#define DX_DSCRPTR_QUEUE_WORD1_NOT_USED_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD2_REG_OFFSET 0xE88UL -#define DX_DSCRPTR_QUEUE_WORD2_VALUE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_WORD2_VALUE_BIT_SIZE 0x20UL -#define DX_DSCRPTR_QUEUE_WORD3_REG_OFFSET 0xE8CUL -#define DX_DSCRPTR_QUEUE_WORD3_DOUT_DMA_MODE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_WORD3_DOUT_DMA_MODE_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD3_DOUT_SIZE_BIT_SHIFT 0x2UL -#define DX_DSCRPTR_QUEUE_WORD3_DOUT_SIZE_BIT_SIZE 0x18UL -#define DX_DSCRPTR_QUEUE_WORD3_NS_BIT_BIT_SHIFT 0x1AUL -#define DX_DSCRPTR_QUEUE_WORD3_NS_BIT_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD3_DOUT_LAST_IND_BIT_SHIFT 0x1BUL -#define DX_DSCRPTR_QUEUE_WORD3_DOUT_LAST_IND_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD3_HASH_XOR_BIT_BIT_SHIFT 0x1DUL -#define DX_DSCRPTR_QUEUE_WORD3_HASH_XOR_BIT_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD3_NOT_USED_BIT_SHIFT 0x1EUL -#define DX_DSCRPTR_QUEUE_WORD3_NOT_USED_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD3_QUEUE_LAST_IND_BIT_SHIFT 0x1FUL -#define DX_DSCRPTR_QUEUE_WORD3_QUEUE_LAST_IND_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_REG_OFFSET 0xE90UL -#define DX_DSCRPTR_QUEUE_WORD4_DATA_FLOW_MODE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_WORD4_DATA_FLOW_MODE_BIT_SIZE 0x6UL -#define DX_DSCRPTR_QUEUE_WORD4_AES_SEL_N_HASH_BIT_SHIFT 0x6UL -#define DX_DSCRPTR_QUEUE_WORD4_AES_SEL_N_HASH_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_AES_XOR_CRYPTO_KEY_BIT_SHIFT 0x7UL -#define DX_DSCRPTR_QUEUE_WORD4_AES_XOR_CRYPTO_KEY_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_ACK_NEEDED_BIT_SHIFT 0x8UL -#define DX_DSCRPTR_QUEUE_WORD4_ACK_NEEDED_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_MODE_BIT_SHIFT 0xAUL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_MODE_BIT_SIZE 0x4UL -#define DX_DSCRPTR_QUEUE_WORD4_CMAC_SIZE0_BIT_SHIFT 0xEUL -#define DX_DSCRPTR_QUEUE_WORD4_CMAC_SIZE0_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_DO_BIT_SHIFT 0xFUL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_DO_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF0_BIT_SHIFT 0x11UL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF0_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF1_BIT_SHIFT 0x13UL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF1_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF2_BIT_SHIFT 0x14UL -#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF2_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD4_KEY_SIZE_BIT_SHIFT 0x16UL -#define DX_DSCRPTR_QUEUE_WORD4_KEY_SIZE_BIT_SIZE 0x2UL -#define DX_DSCRPTR_QUEUE_WORD4_SETUP_OPERATION_BIT_SHIFT 0x18UL -#define DX_DSCRPTR_QUEUE_WORD4_SETUP_OPERATION_BIT_SIZE 0x4UL -#define DX_DSCRPTR_QUEUE_WORD4_DIN_SRAM_ENDIANNESS_BIT_SHIFT 0x1CUL -#define DX_DSCRPTR_QUEUE_WORD4_DIN_SRAM_ENDIANNESS_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_DOUT_SRAM_ENDIANNESS_BIT_SHIFT 0x1DUL -#define DX_DSCRPTR_QUEUE_WORD4_DOUT_SRAM_ENDIANNESS_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_WORD_SWAP_BIT_SHIFT 0x1EUL -#define DX_DSCRPTR_QUEUE_WORD4_WORD_SWAP_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD4_BYTES_SWAP_BIT_SHIFT 0x1FUL -#define DX_DSCRPTR_QUEUE_WORD4_BYTES_SWAP_BIT_SIZE 0x1UL -#define DX_DSCRPTR_QUEUE_WORD5_REG_OFFSET 0xE94UL -#define DX_DSCRPTR_QUEUE_WORD5_DIN_ADDR_HIGH_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_WORD5_DIN_ADDR_HIGH_BIT_SIZE 0x10UL -#define DX_DSCRPTR_QUEUE_WORD5_DOUT_ADDR_HIGH_BIT_SHIFT 0x10UL -#define DX_DSCRPTR_QUEUE_WORD5_DOUT_ADDR_HIGH_BIT_SIZE 0x10UL -#define DX_DSCRPTR_QUEUE_WATERMARK_REG_OFFSET 0xE98UL -#define DX_DSCRPTR_QUEUE_WATERMARK_VALUE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_WATERMARK_VALUE_BIT_SIZE 0xAUL -#define DX_DSCRPTR_QUEUE_CONTENT_REG_OFFSET 0xE9CUL -#define DX_DSCRPTR_QUEUE_CONTENT_VALUE_BIT_SHIFT 0x0UL -#define DX_DSCRPTR_QUEUE_CONTENT_VALUE_BIT_SIZE 0xAUL +#define DX_DSCRPTR_COMPLETION_COUNTER_REG_OFFSET 0xE00UL +#define DX_DSCRPTR_COMPLETION_COUNTER_COMPLETION_COUNTER_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_COMPLETION_COUNTER_COMPLETION_COUNTER_BIT_SIZE 0x6UL +#define DX_DSCRPTR_COMPLETION_COUNTER_OVERFLOW_COUNTER_BIT_SHIFT 0x6UL +#define DX_DSCRPTR_COMPLETION_COUNTER_OVERFLOW_COUNTER_BIT_SIZE 0x1UL +#define DX_DSCRPTR_SW_RESET_REG_OFFSET 0xE40UL +#define DX_DSCRPTR_SW_RESET_VALUE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_SW_RESET_VALUE_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_SRAM_SIZE_REG_OFFSET 0xE60UL +#define DX_DSCRPTR_QUEUE_SRAM_SIZE_NUM_OF_DSCRPTR_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_SRAM_SIZE_NUM_OF_DSCRPTR_BIT_SIZE 0xAUL +#define DX_DSCRPTR_QUEUE_SRAM_SIZE_DSCRPTR_SRAM_SIZE_BIT_SHIFT 0xAUL +#define DX_DSCRPTR_QUEUE_SRAM_SIZE_DSCRPTR_SRAM_SIZE_BIT_SIZE 0xCUL +#define DX_DSCRPTR_QUEUE_SRAM_SIZE_SRAM_SIZE_BIT_SHIFT 0x16UL +#define DX_DSCRPTR_QUEUE_SRAM_SIZE_SRAM_SIZE_BIT_SIZE 0x3UL +#define DX_DSCRPTR_SINGLE_ADDR_EN_REG_OFFSET 0xE64UL +#define DX_DSCRPTR_SINGLE_ADDR_EN_VALUE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_SINGLE_ADDR_EN_VALUE_BIT_SIZE 0x1UL +#define DX_DSCRPTR_MEASURE_CNTR_REG_OFFSET 0xE68UL +#define DX_DSCRPTR_MEASURE_CNTR_VALUE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_MEASURE_CNTR_VALUE_BIT_SIZE 0x20UL +#define DX_DSCRPTR_QUEUE_WORD0_REG_OFFSET 0xE80UL +#define DX_DSCRPTR_QUEUE_WORD0_VALUE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_WORD0_VALUE_BIT_SIZE 0x20UL +#define DX_DSCRPTR_QUEUE_WORD1_REG_OFFSET 0xE84UL +#define DX_DSCRPTR_QUEUE_WORD1_DIN_DMA_MODE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_WORD1_DIN_DMA_MODE_BIT_SIZE 0x2UL +#define DX_DSCRPTR_QUEUE_WORD1_DIN_SIZE_BIT_SHIFT 0x2UL +#define DX_DSCRPTR_QUEUE_WORD1_DIN_SIZE_BIT_SIZE 0x18UL +#define DX_DSCRPTR_QUEUE_WORD1_NS_BIT_BIT_SHIFT 0x1AUL +#define DX_DSCRPTR_QUEUE_WORD1_NS_BIT_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD1_DIN_CONST_VALUE_BIT_SHIFT 0x1BUL +#define DX_DSCRPTR_QUEUE_WORD1_DIN_CONST_VALUE_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD1_NOT_LAST_BIT_SHIFT 0x1CUL +#define DX_DSCRPTR_QUEUE_WORD1_NOT_LAST_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD1_LOCK_QUEUE_BIT_SHIFT 0x1DUL +#define DX_DSCRPTR_QUEUE_WORD1_LOCK_QUEUE_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD1_NOT_USED_BIT_SHIFT 0x1EUL +#define DX_DSCRPTR_QUEUE_WORD1_NOT_USED_BIT_SIZE 0x2UL +#define DX_DSCRPTR_QUEUE_WORD2_REG_OFFSET 0xE88UL +#define DX_DSCRPTR_QUEUE_WORD2_VALUE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_WORD2_VALUE_BIT_SIZE 0x20UL +#define DX_DSCRPTR_QUEUE_WORD3_REG_OFFSET 0xE8CUL +#define DX_DSCRPTR_QUEUE_WORD3_DOUT_DMA_MODE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_WORD3_DOUT_DMA_MODE_BIT_SIZE 0x2UL +#define DX_DSCRPTR_QUEUE_WORD3_DOUT_SIZE_BIT_SHIFT 0x2UL +#define DX_DSCRPTR_QUEUE_WORD3_DOUT_SIZE_BIT_SIZE 0x18UL +#define DX_DSCRPTR_QUEUE_WORD3_NS_BIT_BIT_SHIFT 0x1AUL +#define DX_DSCRPTR_QUEUE_WORD3_NS_BIT_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD3_DOUT_LAST_IND_BIT_SHIFT 0x1BUL +#define DX_DSCRPTR_QUEUE_WORD3_DOUT_LAST_IND_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD3_HASH_XOR_BIT_BIT_SHIFT 0x1DUL +#define DX_DSCRPTR_QUEUE_WORD3_HASH_XOR_BIT_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD3_NOT_USED_BIT_SHIFT 0x1EUL +#define DX_DSCRPTR_QUEUE_WORD3_NOT_USED_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD3_QUEUE_LAST_IND_BIT_SHIFT 0x1FUL +#define DX_DSCRPTR_QUEUE_WORD3_QUEUE_LAST_IND_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD4_REG_OFFSET 0xE90UL +#define DX_DSCRPTR_QUEUE_WORD4_DATA_FLOW_MODE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_WORD4_DATA_FLOW_MODE_BIT_SIZE 0x6UL +#define DX_DSCRPTR_QUEUE_WORD4_AES_SEL_N_HASH_BIT_SHIFT 0x6UL +#define DX_DSCRPTR_QUEUE_WORD4_AES_SEL_N_HASH_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD4_AES_XOR_CRYPTO_KEY_BIT_SHIFT 0x7UL +#define DX_DSCRPTR_QUEUE_WORD4_AES_XOR_CRYPTO_KEY_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD4_ACK_NEEDED_BIT_SHIFT 0x8UL +#define DX_DSCRPTR_QUEUE_WORD4_ACK_NEEDED_BIT_SIZE 0x2UL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_MODE_BIT_SHIFT 0xAUL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_MODE_BIT_SIZE 0x4UL +#define DX_DSCRPTR_QUEUE_WORD4_CMAC_SIZE0_BIT_SHIFT 0xEUL +#define DX_DSCRPTR_QUEUE_WORD4_CMAC_SIZE0_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_DO_BIT_SHIFT 0xFUL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_DO_BIT_SIZE 0x2UL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF0_BIT_SHIFT 0x11UL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF0_BIT_SIZE 0x2UL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF1_BIT_SHIFT 0x13UL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF1_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF2_BIT_SHIFT 0x14UL +#define DX_DSCRPTR_QUEUE_WORD4_CIPHER_CONF2_BIT_SIZE 0x2UL +#define DX_DSCRPTR_QUEUE_WORD4_KEY_SIZE_BIT_SHIFT 0x16UL +#define DX_DSCRPTR_QUEUE_WORD4_KEY_SIZE_BIT_SIZE 0x2UL +#define DX_DSCRPTR_QUEUE_WORD4_SETUP_OPERATION_BIT_SHIFT 0x18UL +#define DX_DSCRPTR_QUEUE_WORD4_SETUP_OPERATION_BIT_SIZE 0x4UL +#define DX_DSCRPTR_QUEUE_WORD4_DIN_SRAM_ENDIANNESS_BIT_SHIFT 0x1CUL +#define DX_DSCRPTR_QUEUE_WORD4_DIN_SRAM_ENDIANNESS_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD4_DOUT_SRAM_ENDIANNESS_BIT_SHIFT 0x1DUL +#define DX_DSCRPTR_QUEUE_WORD4_DOUT_SRAM_ENDIANNESS_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD4_WORD_SWAP_BIT_SHIFT 0x1EUL +#define DX_DSCRPTR_QUEUE_WORD4_WORD_SWAP_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD4_BYTES_SWAP_BIT_SHIFT 0x1FUL +#define DX_DSCRPTR_QUEUE_WORD4_BYTES_SWAP_BIT_SIZE 0x1UL +#define DX_DSCRPTR_QUEUE_WORD5_REG_OFFSET 0xE94UL +#define DX_DSCRPTR_QUEUE_WORD5_DIN_ADDR_HIGH_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_WORD5_DIN_ADDR_HIGH_BIT_SIZE 0x10UL +#define DX_DSCRPTR_QUEUE_WORD5_DOUT_ADDR_HIGH_BIT_SHIFT 0x10UL +#define DX_DSCRPTR_QUEUE_WORD5_DOUT_ADDR_HIGH_BIT_SIZE 0x10UL +#define DX_DSCRPTR_QUEUE_WATERMARK_REG_OFFSET 0xE98UL +#define DX_DSCRPTR_QUEUE_WATERMARK_VALUE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_WATERMARK_VALUE_BIT_SIZE 0xAUL +#define DX_DSCRPTR_QUEUE_CONTENT_REG_OFFSET 0xE9CUL +#define DX_DSCRPTR_QUEUE_CONTENT_VALUE_BIT_SHIFT 0x0UL +#define DX_DSCRPTR_QUEUE_CONTENT_VALUE_BIT_SIZE 0xAUL // -------------------------------------- // BLOCK: AXI_P // -------------------------------------- -#define DX_AXIM_MON_INFLIGHT_REG_OFFSET 0xB00UL -#define DX_AXIM_MON_INFLIGHT_VALUE_BIT_SHIFT 0x0UL -#define DX_AXIM_MON_INFLIGHT_VALUE_BIT_SIZE 0x8UL -#define DX_AXIM_MON_INFLIGHTLAST_REG_OFFSET 0xB40UL -#define DX_AXIM_MON_INFLIGHTLAST_VALUE_BIT_SHIFT 0x0UL -#define DX_AXIM_MON_INFLIGHTLAST_VALUE_BIT_SIZE 0x8UL -#define DX_AXIM_MON_COMP_REG_OFFSET 0xB80UL -#define DX_AXIM_MON_COMP_VALUE_BIT_SHIFT 0x0UL -#define DX_AXIM_MON_COMP_VALUE_BIT_SIZE 0x10UL -#define DX_AXIM_MON_ERR_REG_OFFSET 0xBC4UL -#define DX_AXIM_MON_ERR_BRESP_BIT_SHIFT 0x0UL -#define DX_AXIM_MON_ERR_BRESP_BIT_SIZE 0x2UL -#define DX_AXIM_MON_ERR_BID_BIT_SHIFT 0x2UL -#define DX_AXIM_MON_ERR_BID_BIT_SIZE 0x4UL -#define DX_AXIM_MON_ERR_RRESP_BIT_SHIFT 0x10UL -#define DX_AXIM_MON_ERR_RRESP_BIT_SIZE 0x2UL -#define DX_AXIM_MON_ERR_RID_BIT_SHIFT 0x12UL -#define DX_AXIM_MON_ERR_RID_BIT_SIZE 0x4UL -#define DX_AXIM_CFG_REG_OFFSET 0xBE8UL -#define DX_AXIM_CFG_BRESPMASK_BIT_SHIFT 0x4UL -#define DX_AXIM_CFG_BRESPMASK_BIT_SIZE 0x1UL -#define DX_AXIM_CFG_RRESPMASK_BIT_SHIFT 0x5UL -#define DX_AXIM_CFG_RRESPMASK_BIT_SIZE 0x1UL -#define DX_AXIM_CFG_INFLTMASK_BIT_SHIFT 0x6UL -#define DX_AXIM_CFG_INFLTMASK_BIT_SIZE 0x1UL -#define DX_AXIM_CFG_COMPMASK_BIT_SHIFT 0x7UL -#define DX_AXIM_CFG_COMPMASK_BIT_SIZE 0x1UL -#define DX_AXIM_ACE_CONST_REG_OFFSET 0xBECUL -#define DX_AXIM_ACE_CONST_ARDOMAIN_BIT_SHIFT 0x0UL -#define DX_AXIM_ACE_CONST_ARDOMAIN_BIT_SIZE 0x2UL -#define DX_AXIM_ACE_CONST_AWDOMAIN_BIT_SHIFT 0x2UL -#define DX_AXIM_ACE_CONST_AWDOMAIN_BIT_SIZE 0x2UL -#define DX_AXIM_ACE_CONST_ARBAR_BIT_SHIFT 0x4UL -#define DX_AXIM_ACE_CONST_ARBAR_BIT_SIZE 0x2UL -#define DX_AXIM_ACE_CONST_AWBAR_BIT_SHIFT 0x6UL -#define DX_AXIM_ACE_CONST_AWBAR_BIT_SIZE 0x2UL -#define DX_AXIM_ACE_CONST_ARSNOOP_BIT_SHIFT 0x8UL -#define DX_AXIM_ACE_CONST_ARSNOOP_BIT_SIZE 0x4UL -#define DX_AXIM_ACE_CONST_AWSNOOP_NOT_ALIGNED_BIT_SHIFT 0xCUL -#define DX_AXIM_ACE_CONST_AWSNOOP_NOT_ALIGNED_BIT_SIZE 0x3UL -#define DX_AXIM_ACE_CONST_AWSNOOP_ALIGNED_BIT_SHIFT 0xFUL -#define DX_AXIM_ACE_CONST_AWSNOOP_ALIGNED_BIT_SIZE 0x3UL -#define DX_AXIM_ACE_CONST_AWADDR_NOT_MASKED_BIT_SHIFT 0x12UL -#define DX_AXIM_ACE_CONST_AWADDR_NOT_MASKED_BIT_SIZE 0x7UL -#define DX_AXIM_ACE_CONST_AWLEN_VAL_BIT_SHIFT 0x19UL -#define DX_AXIM_ACE_CONST_AWLEN_VAL_BIT_SIZE 0x4UL -#define DX_AXIM_CACHE_PARAMS_REG_OFFSET 0xBF0UL -#define DX_AXIM_CACHE_PARAMS_AWCACHE_LAST_BIT_SHIFT 0x0UL -#define DX_AXIM_CACHE_PARAMS_AWCACHE_LAST_BIT_SIZE 0x4UL -#define DX_AXIM_CACHE_PARAMS_AWCACHE_BIT_SHIFT 0x4UL -#define DX_AXIM_CACHE_PARAMS_AWCACHE_BIT_SIZE 0x4UL -#define DX_AXIM_CACHE_PARAMS_ARCACHE_BIT_SHIFT 0x8UL -#define DX_AXIM_CACHE_PARAMS_ARCACHE_BIT_SIZE 0x4UL +#define DX_AXIM_MON_INFLIGHT_REG_OFFSET 0xB00UL +#define DX_AXIM_MON_INFLIGHT_VALUE_BIT_SHIFT 0x0UL +#define DX_AXIM_MON_INFLIGHT_VALUE_BIT_SIZE 0x8UL +#define DX_AXIM_MON_INFLIGHTLAST_REG_OFFSET 0xB40UL +#define DX_AXIM_MON_INFLIGHTLAST_VALUE_BIT_SHIFT 0x0UL +#define DX_AXIM_MON_INFLIGHTLAST_VALUE_BIT_SIZE 0x8UL +#define DX_AXIM_MON_COMP_REG_OFFSET 0xB80UL +#define DX_AXIM_MON_COMP_VALUE_BIT_SHIFT 0x0UL +#define DX_AXIM_MON_COMP_VALUE_BIT_SIZE 0x10UL +#define DX_AXIM_MON_ERR_REG_OFFSET 0xBC4UL +#define DX_AXIM_MON_ERR_BRESP_BIT_SHIFT 0x0UL +#define DX_AXIM_MON_ERR_BRESP_BIT_SIZE 0x2UL +#define DX_AXIM_MON_ERR_BID_BIT_SHIFT 0x2UL +#define DX_AXIM_MON_ERR_BID_BIT_SIZE 0x4UL +#define DX_AXIM_MON_ERR_RRESP_BIT_SHIFT 0x10UL +#define DX_AXIM_MON_ERR_RRESP_BIT_SIZE 0x2UL +#define DX_AXIM_MON_ERR_RID_BIT_SHIFT 0x12UL +#define DX_AXIM_MON_ERR_RID_BIT_SIZE 0x4UL +#define DX_AXIM_CFG_REG_OFFSET 0xBE8UL +#define DX_AXIM_CFG_BRESPMASK_BIT_SHIFT 0x4UL +#define DX_AXIM_CFG_BRESPMASK_BIT_SIZE 0x1UL +#define DX_AXIM_CFG_RRESPMASK_BIT_SHIFT 0x5UL +#define DX_AXIM_CFG_RRESPMASK_BIT_SIZE 0x1UL +#define DX_AXIM_CFG_INFLTMASK_BIT_SHIFT 0x6UL +#define DX_AXIM_CFG_INFLTMASK_BIT_SIZE 0x1UL +#define DX_AXIM_CFG_COMPMASK_BIT_SHIFT 0x7UL +#define DX_AXIM_CFG_COMPMASK_BIT_SIZE 0x1UL +#define DX_AXIM_ACE_CONST_REG_OFFSET 0xBECUL +#define DX_AXIM_ACE_CONST_ARDOMAIN_BIT_SHIFT 0x0UL +#define DX_AXIM_ACE_CONST_ARDOMAIN_BIT_SIZE 0x2UL +#define DX_AXIM_ACE_CONST_AWDOMAIN_BIT_SHIFT 0x2UL +#define DX_AXIM_ACE_CONST_AWDOMAIN_BIT_SIZE 0x2UL +#define DX_AXIM_ACE_CONST_ARBAR_BIT_SHIFT 0x4UL +#define DX_AXIM_ACE_CONST_ARBAR_BIT_SIZE 0x2UL +#define DX_AXIM_ACE_CONST_AWBAR_BIT_SHIFT 0x6UL +#define DX_AXIM_ACE_CONST_AWBAR_BIT_SIZE 0x2UL +#define DX_AXIM_ACE_CONST_ARSNOOP_BIT_SHIFT 0x8UL +#define DX_AXIM_ACE_CONST_ARSNOOP_BIT_SIZE 0x4UL +#define DX_AXIM_ACE_CONST_AWSNOOP_NOT_ALIGNED_BIT_SHIFT 0xCUL +#define DX_AXIM_ACE_CONST_AWSNOOP_NOT_ALIGNED_BIT_SIZE 0x3UL +#define DX_AXIM_ACE_CONST_AWSNOOP_ALIGNED_BIT_SHIFT 0xFUL +#define DX_AXIM_ACE_CONST_AWSNOOP_ALIGNED_BIT_SIZE 0x3UL +#define DX_AXIM_ACE_CONST_AWADDR_NOT_MASKED_BIT_SHIFT 0x12UL +#define DX_AXIM_ACE_CONST_AWADDR_NOT_MASKED_BIT_SIZE 0x7UL +#define DX_AXIM_ACE_CONST_AWLEN_VAL_BIT_SHIFT 0x19UL +#define DX_AXIM_ACE_CONST_AWLEN_VAL_BIT_SIZE 0x4UL +#define DX_AXIM_CACHE_PARAMS_REG_OFFSET 0xBF0UL +#define DX_AXIM_CACHE_PARAMS_AWCACHE_LAST_BIT_SHIFT 0x0UL +#define DX_AXIM_CACHE_PARAMS_AWCACHE_LAST_BIT_SIZE 0x4UL +#define DX_AXIM_CACHE_PARAMS_AWCACHE_BIT_SHIFT 0x4UL +#define DX_AXIM_CACHE_PARAMS_AWCACHE_BIT_SIZE 0x4UL +#define DX_AXIM_CACHE_PARAMS_ARCACHE_BIT_SHIFT 0x8UL +#define DX_AXIM_CACHE_PARAMS_ARCACHE_BIT_SIZE 0x4UL #endif // __DX_CRYS_KERNEL_H__ diff --git a/drivers/staging/ccree/dx_host.h b/drivers/staging/ccree/dx_host.h index 3e75dc4d2657..863c2670d826 100644 --- a/drivers/staging/ccree/dx_host.h +++ b/drivers/staging/ccree/dx_host.h @@ -20,136 +20,136 @@ // -------------------------------------- // BLOCK: HOST_P // -------------------------------------- -#define DX_HOST_IRR_REG_OFFSET 0xA00UL -#define DX_HOST_IRR_DSCRPTR_COMPLETION_LOW_INT_BIT_SHIFT 0x2UL -#define DX_HOST_IRR_DSCRPTR_COMPLETION_LOW_INT_BIT_SIZE 0x1UL -#define DX_HOST_IRR_AXI_ERR_INT_BIT_SHIFT 0x8UL -#define DX_HOST_IRR_AXI_ERR_INT_BIT_SIZE 0x1UL -#define DX_HOST_IRR_GPR0_BIT_SHIFT 0xBUL -#define DX_HOST_IRR_GPR0_BIT_SIZE 0x1UL -#define DX_HOST_IRR_DSCRPTR_WATERMARK_INT_BIT_SHIFT 0x13UL -#define DX_HOST_IRR_DSCRPTR_WATERMARK_INT_BIT_SIZE 0x1UL -#define DX_HOST_IRR_AXIM_COMP_INT_BIT_SHIFT 0x17UL -#define DX_HOST_IRR_AXIM_COMP_INT_BIT_SIZE 0x1UL -#define DX_HOST_IMR_REG_OFFSET 0xA04UL -#define DX_HOST_IMR_NOT_USED_MASK_BIT_SHIFT 0x1UL -#define DX_HOST_IMR_NOT_USED_MASK_BIT_SIZE 0x1UL -#define DX_HOST_IMR_DSCRPTR_COMPLETION_MASK_BIT_SHIFT 0x2UL -#define DX_HOST_IMR_DSCRPTR_COMPLETION_MASK_BIT_SIZE 0x1UL -#define DX_HOST_IMR_AXI_ERR_MASK_BIT_SHIFT 0x8UL -#define DX_HOST_IMR_AXI_ERR_MASK_BIT_SIZE 0x1UL -#define DX_HOST_IMR_GPR0_BIT_SHIFT 0xBUL -#define DX_HOST_IMR_GPR0_BIT_SIZE 0x1UL -#define DX_HOST_IMR_DSCRPTR_WATERMARK_MASK0_BIT_SHIFT 0x13UL -#define DX_HOST_IMR_DSCRPTR_WATERMARK_MASK0_BIT_SIZE 0x1UL -#define DX_HOST_IMR_AXIM_COMP_INT_MASK_BIT_SHIFT 0x17UL -#define DX_HOST_IMR_AXIM_COMP_INT_MASK_BIT_SIZE 0x1UL -#define DX_HOST_ICR_REG_OFFSET 0xA08UL -#define DX_HOST_ICR_DSCRPTR_COMPLETION_BIT_SHIFT 0x2UL -#define DX_HOST_ICR_DSCRPTR_COMPLETION_BIT_SIZE 0x1UL -#define DX_HOST_ICR_AXI_ERR_CLEAR_BIT_SHIFT 0x8UL -#define DX_HOST_ICR_AXI_ERR_CLEAR_BIT_SIZE 0x1UL -#define DX_HOST_ICR_GPR_INT_CLEAR_BIT_SHIFT 0xBUL -#define DX_HOST_ICR_GPR_INT_CLEAR_BIT_SIZE 0x1UL -#define DX_HOST_ICR_DSCRPTR_WATERMARK_QUEUE0_CLEAR_BIT_SHIFT 0x13UL -#define DX_HOST_ICR_DSCRPTR_WATERMARK_QUEUE0_CLEAR_BIT_SIZE 0x1UL -#define DX_HOST_ICR_AXIM_COMP_INT_CLEAR_BIT_SHIFT 0x17UL -#define DX_HOST_ICR_AXIM_COMP_INT_CLEAR_BIT_SIZE 0x1UL -#define DX_HOST_SIGNATURE_REG_OFFSET 0xA24UL -#define DX_HOST_SIGNATURE_VALUE_BIT_SHIFT 0x0UL -#define DX_HOST_SIGNATURE_VALUE_BIT_SIZE 0x20UL -#define DX_HOST_BOOT_REG_OFFSET 0xA28UL -#define DX_HOST_BOOT_SYNTHESIS_CONFIG_BIT_SHIFT 0x0UL -#define DX_HOST_BOOT_SYNTHESIS_CONFIG_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_LARGE_RKEK_LOCAL_BIT_SHIFT 0x1UL -#define DX_HOST_BOOT_LARGE_RKEK_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_HASH_IN_FUSES_LOCAL_BIT_SHIFT 0x2UL -#define DX_HOST_BOOT_HASH_IN_FUSES_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_EXT_MEM_SECURED_LOCAL_BIT_SHIFT 0x3UL -#define DX_HOST_BOOT_EXT_MEM_SECURED_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_RKEK_ECC_EXISTS_LOCAL_N_BIT_SHIFT 0x5UL -#define DX_HOST_BOOT_RKEK_ECC_EXISTS_LOCAL_N_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_SRAM_SIZE_LOCAL_BIT_SHIFT 0x6UL -#define DX_HOST_BOOT_SRAM_SIZE_LOCAL_BIT_SIZE 0x3UL -#define DX_HOST_BOOT_DSCRPTR_EXISTS_LOCAL_BIT_SHIFT 0x9UL -#define DX_HOST_BOOT_DSCRPTR_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_PAU_EXISTS_LOCAL_BIT_SHIFT 0xAUL -#define DX_HOST_BOOT_PAU_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_RNG_EXISTS_LOCAL_BIT_SHIFT 0xBUL -#define DX_HOST_BOOT_RNG_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_PKA_EXISTS_LOCAL_BIT_SHIFT 0xCUL -#define DX_HOST_BOOT_PKA_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_RC4_EXISTS_LOCAL_BIT_SHIFT 0xDUL -#define DX_HOST_BOOT_RC4_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_SHA_512_PRSNT_LOCAL_BIT_SHIFT 0xEUL -#define DX_HOST_BOOT_SHA_512_PRSNT_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_SHA_256_PRSNT_LOCAL_BIT_SHIFT 0xFUL -#define DX_HOST_BOOT_SHA_256_PRSNT_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_MD5_PRSNT_LOCAL_BIT_SHIFT 0x10UL -#define DX_HOST_BOOT_MD5_PRSNT_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_HASH_EXISTS_LOCAL_BIT_SHIFT 0x11UL -#define DX_HOST_BOOT_HASH_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_C2_EXISTS_LOCAL_BIT_SHIFT 0x12UL -#define DX_HOST_BOOT_C2_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_DES_EXISTS_LOCAL_BIT_SHIFT 0x13UL -#define DX_HOST_BOOT_DES_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_AES_XCBC_MAC_EXISTS_LOCAL_BIT_SHIFT 0x14UL -#define DX_HOST_BOOT_AES_XCBC_MAC_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_AES_CMAC_EXISTS_LOCAL_BIT_SHIFT 0x15UL -#define DX_HOST_BOOT_AES_CMAC_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_AES_CCM_EXISTS_LOCAL_BIT_SHIFT 0x16UL -#define DX_HOST_BOOT_AES_CCM_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_AES_XEX_HW_T_CALC_LOCAL_BIT_SHIFT 0x17UL -#define DX_HOST_BOOT_AES_XEX_HW_T_CALC_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_AES_XEX_EXISTS_LOCAL_BIT_SHIFT 0x18UL -#define DX_HOST_BOOT_AES_XEX_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_CTR_EXISTS_LOCAL_BIT_SHIFT 0x19UL -#define DX_HOST_BOOT_CTR_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_AES_DIN_BYTE_RESOLUTION_LOCAL_BIT_SHIFT 0x1AUL -#define DX_HOST_BOOT_AES_DIN_BYTE_RESOLUTION_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_TUNNELING_ENB_LOCAL_BIT_SHIFT 0x1BUL -#define DX_HOST_BOOT_TUNNELING_ENB_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_SUPPORT_256_192_KEY_LOCAL_BIT_SHIFT 0x1CUL -#define DX_HOST_BOOT_SUPPORT_256_192_KEY_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_ONLY_ENCRYPT_LOCAL_BIT_SHIFT 0x1DUL -#define DX_HOST_BOOT_ONLY_ENCRYPT_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_BOOT_AES_EXISTS_LOCAL_BIT_SHIFT 0x1EUL -#define DX_HOST_BOOT_AES_EXISTS_LOCAL_BIT_SIZE 0x1UL -#define DX_HOST_VERSION_REG_OFFSET 0xA40UL -#define DX_HOST_VERSION_VALUE_BIT_SHIFT 0x0UL -#define DX_HOST_VERSION_VALUE_BIT_SIZE 0x20UL -#define DX_HOST_KFDE0_VALID_REG_OFFSET 0xA60UL -#define DX_HOST_KFDE0_VALID_VALUE_BIT_SHIFT 0x0UL -#define DX_HOST_KFDE0_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_HOST_KFDE1_VALID_REG_OFFSET 0xA64UL -#define DX_HOST_KFDE1_VALID_VALUE_BIT_SHIFT 0x0UL -#define DX_HOST_KFDE1_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_HOST_KFDE2_VALID_REG_OFFSET 0xA68UL -#define DX_HOST_KFDE2_VALID_VALUE_BIT_SHIFT 0x0UL -#define DX_HOST_KFDE2_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_HOST_KFDE3_VALID_REG_OFFSET 0xA6CUL -#define DX_HOST_KFDE3_VALID_VALUE_BIT_SHIFT 0x0UL -#define DX_HOST_KFDE3_VALID_VALUE_BIT_SIZE 0x1UL -#define DX_HOST_GPR0_REG_OFFSET 0xA70UL -#define DX_HOST_GPR0_VALUE_BIT_SHIFT 0x0UL -#define DX_HOST_GPR0_VALUE_BIT_SIZE 0x20UL -#define DX_GPR_HOST_REG_OFFSET 0xA74UL -#define DX_GPR_HOST_VALUE_BIT_SHIFT 0x0UL -#define DX_GPR_HOST_VALUE_BIT_SIZE 0x20UL -#define DX_HOST_POWER_DOWN_EN_REG_OFFSET 0xA78UL -#define DX_HOST_POWER_DOWN_EN_VALUE_BIT_SHIFT 0x0UL -#define DX_HOST_POWER_DOWN_EN_VALUE_BIT_SIZE 0x1UL +#define DX_HOST_IRR_REG_OFFSET 0xA00UL +#define DX_HOST_IRR_DSCRPTR_COMPLETION_LOW_INT_BIT_SHIFT 0x2UL +#define DX_HOST_IRR_DSCRPTR_COMPLETION_LOW_INT_BIT_SIZE 0x1UL +#define DX_HOST_IRR_AXI_ERR_INT_BIT_SHIFT 0x8UL +#define DX_HOST_IRR_AXI_ERR_INT_BIT_SIZE 0x1UL +#define DX_HOST_IRR_GPR0_BIT_SHIFT 0xBUL +#define DX_HOST_IRR_GPR0_BIT_SIZE 0x1UL +#define DX_HOST_IRR_DSCRPTR_WATERMARK_INT_BIT_SHIFT 0x13UL +#define DX_HOST_IRR_DSCRPTR_WATERMARK_INT_BIT_SIZE 0x1UL +#define DX_HOST_IRR_AXIM_COMP_INT_BIT_SHIFT 0x17UL +#define DX_HOST_IRR_AXIM_COMP_INT_BIT_SIZE 0x1UL +#define DX_HOST_IMR_REG_OFFSET 0xA04UL +#define DX_HOST_IMR_NOT_USED_MASK_BIT_SHIFT 0x1UL +#define DX_HOST_IMR_NOT_USED_MASK_BIT_SIZE 0x1UL +#define DX_HOST_IMR_DSCRPTR_COMPLETION_MASK_BIT_SHIFT 0x2UL +#define DX_HOST_IMR_DSCRPTR_COMPLETION_MASK_BIT_SIZE 0x1UL +#define DX_HOST_IMR_AXI_ERR_MASK_BIT_SHIFT 0x8UL +#define DX_HOST_IMR_AXI_ERR_MASK_BIT_SIZE 0x1UL +#define DX_HOST_IMR_GPR0_BIT_SHIFT 0xBUL +#define DX_HOST_IMR_GPR0_BIT_SIZE 0x1UL +#define DX_HOST_IMR_DSCRPTR_WATERMARK_MASK0_BIT_SHIFT 0x13UL +#define DX_HOST_IMR_DSCRPTR_WATERMARK_MASK0_BIT_SIZE 0x1UL +#define DX_HOST_IMR_AXIM_COMP_INT_MASK_BIT_SHIFT 0x17UL +#define DX_HOST_IMR_AXIM_COMP_INT_MASK_BIT_SIZE 0x1UL +#define DX_HOST_ICR_REG_OFFSET 0xA08UL +#define DX_HOST_ICR_DSCRPTR_COMPLETION_BIT_SHIFT 0x2UL +#define DX_HOST_ICR_DSCRPTR_COMPLETION_BIT_SIZE 0x1UL +#define DX_HOST_ICR_AXI_ERR_CLEAR_BIT_SHIFT 0x8UL +#define DX_HOST_ICR_AXI_ERR_CLEAR_BIT_SIZE 0x1UL +#define DX_HOST_ICR_GPR_INT_CLEAR_BIT_SHIFT 0xBUL +#define DX_HOST_ICR_GPR_INT_CLEAR_BIT_SIZE 0x1UL +#define DX_HOST_ICR_DSCRPTR_WATERMARK_QUEUE0_CLEAR_BIT_SHIFT 0x13UL +#define DX_HOST_ICR_DSCRPTR_WATERMARK_QUEUE0_CLEAR_BIT_SIZE 0x1UL +#define DX_HOST_ICR_AXIM_COMP_INT_CLEAR_BIT_SHIFT 0x17UL +#define DX_HOST_ICR_AXIM_COMP_INT_CLEAR_BIT_SIZE 0x1UL +#define DX_HOST_SIGNATURE_REG_OFFSET 0xA24UL +#define DX_HOST_SIGNATURE_VALUE_BIT_SHIFT 0x0UL +#define DX_HOST_SIGNATURE_VALUE_BIT_SIZE 0x20UL +#define DX_HOST_BOOT_REG_OFFSET 0xA28UL +#define DX_HOST_BOOT_SYNTHESIS_CONFIG_BIT_SHIFT 0x0UL +#define DX_HOST_BOOT_SYNTHESIS_CONFIG_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_LARGE_RKEK_LOCAL_BIT_SHIFT 0x1UL +#define DX_HOST_BOOT_LARGE_RKEK_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_HASH_IN_FUSES_LOCAL_BIT_SHIFT 0x2UL +#define DX_HOST_BOOT_HASH_IN_FUSES_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_EXT_MEM_SECURED_LOCAL_BIT_SHIFT 0x3UL +#define DX_HOST_BOOT_EXT_MEM_SECURED_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_RKEK_ECC_EXISTS_LOCAL_N_BIT_SHIFT 0x5UL +#define DX_HOST_BOOT_RKEK_ECC_EXISTS_LOCAL_N_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_SRAM_SIZE_LOCAL_BIT_SHIFT 0x6UL +#define DX_HOST_BOOT_SRAM_SIZE_LOCAL_BIT_SIZE 0x3UL +#define DX_HOST_BOOT_DSCRPTR_EXISTS_LOCAL_BIT_SHIFT 0x9UL +#define DX_HOST_BOOT_DSCRPTR_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_PAU_EXISTS_LOCAL_BIT_SHIFT 0xAUL +#define DX_HOST_BOOT_PAU_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_RNG_EXISTS_LOCAL_BIT_SHIFT 0xBUL +#define DX_HOST_BOOT_RNG_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_PKA_EXISTS_LOCAL_BIT_SHIFT 0xCUL +#define DX_HOST_BOOT_PKA_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_RC4_EXISTS_LOCAL_BIT_SHIFT 0xDUL +#define DX_HOST_BOOT_RC4_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_SHA_512_PRSNT_LOCAL_BIT_SHIFT 0xEUL +#define DX_HOST_BOOT_SHA_512_PRSNT_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_SHA_256_PRSNT_LOCAL_BIT_SHIFT 0xFUL +#define DX_HOST_BOOT_SHA_256_PRSNT_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_MD5_PRSNT_LOCAL_BIT_SHIFT 0x10UL +#define DX_HOST_BOOT_MD5_PRSNT_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_HASH_EXISTS_LOCAL_BIT_SHIFT 0x11UL +#define DX_HOST_BOOT_HASH_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_C2_EXISTS_LOCAL_BIT_SHIFT 0x12UL +#define DX_HOST_BOOT_C2_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_DES_EXISTS_LOCAL_BIT_SHIFT 0x13UL +#define DX_HOST_BOOT_DES_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_AES_XCBC_MAC_EXISTS_LOCAL_BIT_SHIFT 0x14UL +#define DX_HOST_BOOT_AES_XCBC_MAC_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_AES_CMAC_EXISTS_LOCAL_BIT_SHIFT 0x15UL +#define DX_HOST_BOOT_AES_CMAC_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_AES_CCM_EXISTS_LOCAL_BIT_SHIFT 0x16UL +#define DX_HOST_BOOT_AES_CCM_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_AES_XEX_HW_T_CALC_LOCAL_BIT_SHIFT 0x17UL +#define DX_HOST_BOOT_AES_XEX_HW_T_CALC_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_AES_XEX_EXISTS_LOCAL_BIT_SHIFT 0x18UL +#define DX_HOST_BOOT_AES_XEX_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_CTR_EXISTS_LOCAL_BIT_SHIFT 0x19UL +#define DX_HOST_BOOT_CTR_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_AES_DIN_BYTE_RESOLUTION_LOCAL_BIT_SHIFT 0x1AUL +#define DX_HOST_BOOT_AES_DIN_BYTE_RESOLUTION_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_TUNNELING_ENB_LOCAL_BIT_SHIFT 0x1BUL +#define DX_HOST_BOOT_TUNNELING_ENB_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_SUPPORT_256_192_KEY_LOCAL_BIT_SHIFT 0x1CUL +#define DX_HOST_BOOT_SUPPORT_256_192_KEY_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_ONLY_ENCRYPT_LOCAL_BIT_SHIFT 0x1DUL +#define DX_HOST_BOOT_ONLY_ENCRYPT_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_BOOT_AES_EXISTS_LOCAL_BIT_SHIFT 0x1EUL +#define DX_HOST_BOOT_AES_EXISTS_LOCAL_BIT_SIZE 0x1UL +#define DX_HOST_VERSION_REG_OFFSET 0xA40UL +#define DX_HOST_VERSION_VALUE_BIT_SHIFT 0x0UL +#define DX_HOST_VERSION_VALUE_BIT_SIZE 0x20UL +#define DX_HOST_KFDE0_VALID_REG_OFFSET 0xA60UL +#define DX_HOST_KFDE0_VALID_VALUE_BIT_SHIFT 0x0UL +#define DX_HOST_KFDE0_VALID_VALUE_BIT_SIZE 0x1UL +#define DX_HOST_KFDE1_VALID_REG_OFFSET 0xA64UL +#define DX_HOST_KFDE1_VALID_VALUE_BIT_SHIFT 0x0UL +#define DX_HOST_KFDE1_VALID_VALUE_BIT_SIZE 0x1UL +#define DX_HOST_KFDE2_VALID_REG_OFFSET 0xA68UL +#define DX_HOST_KFDE2_VALID_VALUE_BIT_SHIFT 0x0UL +#define DX_HOST_KFDE2_VALID_VALUE_BIT_SIZE 0x1UL +#define DX_HOST_KFDE3_VALID_REG_OFFSET 0xA6CUL +#define DX_HOST_KFDE3_VALID_VALUE_BIT_SHIFT 0x0UL +#define DX_HOST_KFDE3_VALID_VALUE_BIT_SIZE 0x1UL +#define DX_HOST_GPR0_REG_OFFSET 0xA70UL +#define DX_HOST_GPR0_VALUE_BIT_SHIFT 0x0UL +#define DX_HOST_GPR0_VALUE_BIT_SIZE 0x20UL +#define DX_GPR_HOST_REG_OFFSET 0xA74UL +#define DX_GPR_HOST_VALUE_BIT_SHIFT 0x0UL +#define DX_GPR_HOST_VALUE_BIT_SIZE 0x20UL +#define DX_HOST_POWER_DOWN_EN_REG_OFFSET 0xA78UL +#define DX_HOST_POWER_DOWN_EN_VALUE_BIT_SHIFT 0x0UL +#define DX_HOST_POWER_DOWN_EN_VALUE_BIT_SIZE 0x1UL // -------------------------------------- // BLOCK: HOST_SRAM // -------------------------------------- -#define DX_SRAM_DATA_REG_OFFSET 0xF00UL -#define DX_SRAM_DATA_VALUE_BIT_SHIFT 0x0UL -#define DX_SRAM_DATA_VALUE_BIT_SIZE 0x20UL -#define DX_SRAM_ADDR_REG_OFFSET 0xF04UL -#define DX_SRAM_ADDR_VALUE_BIT_SHIFT 0x0UL -#define DX_SRAM_ADDR_VALUE_BIT_SIZE 0xFUL -#define DX_SRAM_DATA_READY_REG_OFFSET 0xF08UL -#define DX_SRAM_DATA_READY_VALUE_BIT_SHIFT 0x0UL -#define DX_SRAM_DATA_READY_VALUE_BIT_SIZE 0x1UL +#define DX_SRAM_DATA_REG_OFFSET 0xF00UL +#define DX_SRAM_DATA_VALUE_BIT_SHIFT 0x0UL +#define DX_SRAM_DATA_VALUE_BIT_SIZE 0x20UL +#define DX_SRAM_ADDR_REG_OFFSET 0xF04UL +#define DX_SRAM_ADDR_VALUE_BIT_SHIFT 0x0UL +#define DX_SRAM_ADDR_VALUE_BIT_SIZE 0xFUL +#define DX_SRAM_DATA_READY_REG_OFFSET 0xF08UL +#define DX_SRAM_DATA_READY_VALUE_BIT_SHIFT 0x0UL +#define DX_SRAM_DATA_READY_VALUE_BIT_SIZE 0x1UL #endif //__DX_HOST_H__ -- cgit v1.2.3-55-g7522 From d3eff5722c5c2f550b24fd61ec173f038fcee447 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:37 +0300 Subject: staging: ccree: remove last remnants of sash algo The hash code had some left overs from a misguided attempt to support shash API with the HW. Remove the code handling this. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_hash.c | 448 +++++++++++---------------------------- 1 file changed, 127 insertions(+), 321 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 47bc496243f4..ed1c6725d69f 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -76,15 +76,11 @@ static void ssi_hash_create_cmac_setup(struct ahash_request *areq, struct ssi_hash_alg { struct list_head entry; - bool synchronize; int hash_mode; int hw_mode; int inter_digestsize; struct ssi_drvdata *drvdata; - union { - struct ahash_alg ahash_alg; - struct shash_alg shash_alg; - }; + struct ahash_alg ahash_alg; }; @@ -112,8 +108,6 @@ struct ssi_hash_ctx { bool is_hmac; }; -static const struct crypto_type crypto_shash_type; - static void ssi_hash_create_data_desc( struct ahash_req_ctx *areq_ctx, struct ssi_hash_ctx *ctx, @@ -1015,15 +1009,9 @@ static int ssi_hash_setkey(void *hash, SSI_LOG_DEBUG("ssi_hash_setkey: start keylen: %d", keylen); CHECK_AND_RETURN_UPON_FIPS_ERROR(); - if (synchronize) { - ctx = crypto_shash_ctx(((struct crypto_shash *)hash)); - blocksize = crypto_tfm_alg_blocksize(&((struct crypto_shash *)hash)->base); - digestsize = crypto_shash_digestsize(((struct crypto_shash *)hash)); - } else { - ctx = crypto_ahash_ctx(((struct crypto_ahash *)hash)); - blocksize = crypto_tfm_alg_blocksize(&((struct crypto_ahash *)hash)->base); - digestsize = crypto_ahash_digestsize(((struct crypto_ahash *)hash)); - } + ctx = crypto_ahash_ctx(((struct crypto_ahash *)hash)); + blocksize = crypto_tfm_alg_blocksize(&((struct crypto_ahash *)hash)->base); + digestsize = crypto_ahash_digestsize(((struct crypto_ahash *)hash)); larval_addr = ssi_ahash_get_larval_digest_sram_addr( ctx->drvdata, ctx->hash_mode); @@ -1184,13 +1172,8 @@ static int ssi_hash_setkey(void *hash, rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 0); out: - if (rc != 0) { - if (synchronize) { - crypto_shash_set_flags((struct crypto_shash *)hash, CRYPTO_TFM_RES_BAD_KEY_LEN); - } else { - crypto_ahash_set_flags((struct crypto_ahash *)hash, CRYPTO_TFM_RES_BAD_KEY_LEN); - } - } + if (rc) + crypto_ahash_set_flags((struct crypto_ahash *)hash, CRYPTO_TFM_RES_BAD_KEY_LEN); if (ctx->key_params.key_dma_addr) { dma_unmap_single(&ctx->drvdata->plat_dev->dev, @@ -1395,23 +1378,6 @@ fail: return -ENOMEM; } -static int ssi_shash_cra_init(struct crypto_tfm *tfm) -{ - struct ssi_hash_ctx *ctx = crypto_tfm_ctx(tfm); - struct shash_alg * shash_alg = - container_of(tfm->__crt_alg, struct shash_alg, base); - struct ssi_hash_alg *ssi_alg = - container_of(shash_alg, struct ssi_hash_alg, shash_alg); - - CHECK_AND_RETURN_UPON_FIPS_ERROR(); - ctx->hash_mode = ssi_alg->hash_mode; - ctx->hw_mode = ssi_alg->hw_mode; - ctx->inter_digestsize = ssi_alg->inter_digestsize; - ctx->drvdata = ssi_alg->drvdata; - - return ssi_hash_alloc_ctx(ctx); -} - static int ssi_ahash_cra_init(struct crypto_tfm *tfm) { struct ssi_hash_ctx *ctx = crypto_tfm_ctx(tfm); @@ -1764,100 +1730,6 @@ static int ssi_mac_digest(struct ahash_request *req) return rc; } -//shash wrap functions -#ifdef SYNC_ALGS -static int ssi_shash_digest(struct shash_desc *desc, - const u8 *data, unsigned int len, u8 *out) -{ - struct ahash_req_ctx *state = shash_desc_ctx(desc); - struct crypto_shash *tfm = desc->tfm; - struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - u32 digestsize = crypto_shash_digestsize(tfm); - struct scatterlist src; - - if (len == 0) { - return ssi_hash_digest(state, ctx, digestsize, NULL, 0, out, NULL); - } - - /* sg_init_one may crash when len is 0 (depends on kernel configuration) */ - sg_init_one(&src, (const void *)data, len); - - return ssi_hash_digest(state, ctx, digestsize, &src, len, out, NULL); -} - -static int ssi_shash_update(struct shash_desc *desc, - const u8 *data, unsigned int len) -{ - struct ahash_req_ctx *state = shash_desc_ctx(desc); - struct crypto_shash *tfm = desc->tfm; - struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - u32 blocksize = crypto_tfm_alg_blocksize(&tfm->base); - struct scatterlist src; - - sg_init_one(&src, (const void *)data, len); - - return ssi_hash_update(state, ctx, blocksize, &src, len, NULL); -} - -static int ssi_shash_finup(struct shash_desc *desc, - const u8 *data, unsigned int len, u8 *out) -{ - struct ahash_req_ctx *state = shash_desc_ctx(desc); - struct crypto_shash *tfm = desc->tfm; - struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - u32 digestsize = crypto_shash_digestsize(tfm); - struct scatterlist src; - - sg_init_one(&src, (const void *)data, len); - - return ssi_hash_finup(state, ctx, digestsize, &src, len, out, NULL); -} - -static int ssi_shash_final(struct shash_desc *desc, u8 *out) -{ - struct ahash_req_ctx *state = shash_desc_ctx(desc); - struct crypto_shash *tfm = desc->tfm; - struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - u32 digestsize = crypto_shash_digestsize(tfm); - - return ssi_hash_final(state, ctx, digestsize, NULL, 0, out, NULL); -} - -static int ssi_shash_init(struct shash_desc *desc) -{ - struct ahash_req_ctx *state = shash_desc_ctx(desc); - struct crypto_shash *tfm = desc->tfm; - struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - - return ssi_hash_init(state, ctx); -} - -#ifdef EXPORT_FIXED -static int ssi_shash_export(struct shash_desc *desc, void *out) -{ - struct crypto_shash *tfm = desc->tfm; - struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - - return ssi_hash_export(ctx, out); -} - -static int ssi_shash_import(struct shash_desc *desc, const void *in) -{ - struct crypto_shash *tfm = desc->tfm; - struct ssi_hash_ctx *ctx = crypto_shash_ctx(tfm); - - return ssi_hash_import(ctx, in); -} -#endif - -static int ssi_shash_setkey(struct crypto_shash *tfm, - const u8 *key, unsigned int keylen) -{ - return ssi_hash_setkey((void *) tfm, key, keylen, true); -} - -#endif /* SYNC_ALGS */ - //ahash wrap functions static int ssi_ahash_digest(struct ahash_request *req) { @@ -1941,10 +1813,7 @@ struct ssi_hash_template { char hmac_driver_name[CRYPTO_MAX_ALG_NAME]; unsigned int blocksize; bool synchronize; - union { - struct ahash_alg template_ahash; - struct shash_alg template_shash; - }; + struct ahash_alg template_ahash; int hash_mode; int hw_mode; int inter_digestsize; @@ -1961,22 +1830,20 @@ static struct ssi_hash_template driver_hash[] = { .hmac_driver_name = "hmac-sha1-dx", .blocksize = SHA1_BLOCK_SIZE, .synchronize = false, - { - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize = SHA1_DIGEST_SIZE, - .statesize = sizeof(struct sha1_state), - }, + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize = SHA1_DIGEST_SIZE, + .statesize = sizeof(struct sha1_state), }, }, .hash_mode = DRV_HASH_SHA1, @@ -1989,23 +1856,20 @@ static struct ssi_hash_template driver_hash[] = { .hmac_name = "hmac(sha256)", .hmac_driver_name = "hmac-sha256-dx", .blocksize = SHA256_BLOCK_SIZE, - .synchronize = false, - { - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize = SHA256_DIGEST_SIZE, - .statesize = sizeof(struct sha256_state), - }, + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize = SHA256_DIGEST_SIZE, + .statesize = sizeof(struct sha256_state), }, }, .hash_mode = DRV_HASH_SHA256, @@ -2018,23 +1882,20 @@ static struct ssi_hash_template driver_hash[] = { .hmac_name = "hmac(sha224)", .hmac_driver_name = "hmac-sha224-dx", .blocksize = SHA224_BLOCK_SIZE, - .synchronize = false, - { - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize = SHA224_DIGEST_SIZE, - .statesize = sizeof(struct sha256_state), - }, + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize = SHA224_DIGEST_SIZE, + .statesize = sizeof(struct sha256_state), }, }, .hash_mode = DRV_HASH_SHA224, @@ -2048,23 +1909,20 @@ static struct ssi_hash_template driver_hash[] = { .hmac_name = "hmac(sha384)", .hmac_driver_name = "hmac-sha384-dx", .blocksize = SHA384_BLOCK_SIZE, - .synchronize = false, - { - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize = SHA384_DIGEST_SIZE, - .statesize = sizeof(struct sha512_state), - }, + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize = SHA384_DIGEST_SIZE, + .statesize = sizeof(struct sha512_state), }, }, .hash_mode = DRV_HASH_SHA384, @@ -2077,23 +1935,20 @@ static struct ssi_hash_template driver_hash[] = { .hmac_name = "hmac(sha512)", .hmac_driver_name = "hmac-sha512-dx", .blocksize = SHA512_BLOCK_SIZE, - .synchronize = false, - { - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize = SHA512_DIGEST_SIZE, - .statesize = sizeof(struct sha512_state), - }, + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize = SHA512_DIGEST_SIZE, + .statesize = sizeof(struct sha512_state), }, }, .hash_mode = DRV_HASH_SHA512, @@ -2107,23 +1962,20 @@ static struct ssi_hash_template driver_hash[] = { .hmac_name = "hmac(md5)", .hmac_driver_name = "hmac-md5-dx", .blocksize = MD5_HMAC_BLOCK_SIZE, - .synchronize = false, - { - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize = MD5_DIGEST_SIZE, - .statesize = sizeof(struct md5_state), - }, + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize = MD5_DIGEST_SIZE, + .statesize = sizeof(struct md5_state), }, }, .hash_mode = DRV_HASH_MD5, @@ -2134,23 +1986,20 @@ static struct ssi_hash_template driver_hash[] = { .name = "xcbc(aes)", .driver_name = "xcbc-aes-dx", .blocksize = AES_BLOCK_SIZE, - .synchronize = false, - { - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_mac_update, - .final = ssi_mac_final, - .finup = ssi_mac_finup, - .digest = ssi_mac_digest, - .setkey = ssi_xcbc_setkey, + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_mac_update, + .final = ssi_mac_final, + .finup = ssi_mac_finup, + .digest = ssi_mac_digest, + .setkey = ssi_xcbc_setkey, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .halg = { - .digestsize = AES_BLOCK_SIZE, - .statesize = sizeof(struct aeshash_state), - }, + .halg = { + .digestsize = AES_BLOCK_SIZE, + .statesize = sizeof(struct aeshash_state), }, }, .hash_mode = DRV_HASH_NULL, @@ -2162,23 +2011,20 @@ static struct ssi_hash_template driver_hash[] = { .name = "cmac(aes)", .driver_name = "cmac-aes-dx", .blocksize = AES_BLOCK_SIZE, - .synchronize = false, - { - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_mac_update, - .final = ssi_mac_final, - .finup = ssi_mac_finup, - .digest = ssi_mac_digest, - .setkey = ssi_cmac_setkey, + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_mac_update, + .final = ssi_mac_final, + .finup = ssi_mac_finup, + .digest = ssi_mac_digest, + .setkey = ssi_cmac_setkey, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .halg = { - .digestsize = AES_BLOCK_SIZE, - .statesize = sizeof(struct aeshash_state), - }, + .halg = { + .digestsize = AES_BLOCK_SIZE, + .statesize = sizeof(struct aeshash_state), }, }, .hash_mode = DRV_HASH_NULL, @@ -2194,6 +2040,7 @@ ssi_hash_create_alg(struct ssi_hash_template *template, bool keyed) { struct ssi_hash_alg *t_crypto_alg; struct crypto_alg *alg; + struct ahash_alg *halg; t_crypto_alg = kzalloc(sizeof(struct ssi_hash_alg), GFP_KERNEL); if (!t_crypto_alg) { @@ -2201,20 +2048,9 @@ ssi_hash_create_alg(struct ssi_hash_template *template, bool keyed) return ERR_PTR(-ENOMEM); } - t_crypto_alg->synchronize = template->synchronize; - if (template->synchronize) { - struct shash_alg *halg; - t_crypto_alg->shash_alg = template->template_shash; - halg = &t_crypto_alg->shash_alg; - alg = &halg->base; - if (!keyed) halg->setkey = NULL; - } else { - struct ahash_alg *halg; - t_crypto_alg->ahash_alg = template->template_ahash; - halg = &t_crypto_alg->ahash_alg; - alg = &halg->halg.base; - if (!keyed) halg->setkey = NULL; - } + t_crypto_alg->ahash_alg = template->template_ahash; + halg = &t_crypto_alg->ahash_alg; + alg = &halg->halg.base; if (keyed) { snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", @@ -2222,6 +2058,7 @@ ssi_hash_create_alg(struct ssi_hash_template *template, bool keyed) snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", template->hmac_driver_name); } else { + halg->setkey = NULL; snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", template->name); snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", @@ -2234,17 +2071,10 @@ ssi_hash_create_alg(struct ssi_hash_template *template, bool keyed) alg->cra_alignmask = 0; alg->cra_exit = ssi_hash_cra_exit; - if (template->synchronize) { - alg->cra_init = ssi_shash_cra_init; - alg->cra_flags = CRYPTO_ALG_TYPE_SHASH | - CRYPTO_ALG_KERN_DRIVER_ONLY; - alg->cra_type = &crypto_shash_type; - } else { - alg->cra_init = ssi_ahash_cra_init; - alg->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_TYPE_AHASH | + alg->cra_init = ssi_ahash_cra_init; + alg->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_KERN_DRIVER_ONLY; - alg->cra_type = &crypto_ahash_type; - } + alg->cra_type = &crypto_ahash_type; t_crypto_alg->hash_mode = template->hash_mode; t_crypto_alg->hw_mode = template->hw_mode; @@ -2429,24 +2259,15 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) } t_alg->drvdata = drvdata; - if (t_alg->synchronize) { - rc = crypto_register_shash(&t_alg->shash_alg); - if (unlikely(rc != 0)) { - SSI_LOG_ERR("%s alg registration failed\n", - t_alg->shash_alg.base.cra_driver_name); - kfree(t_alg); - goto fail; - } else - list_add_tail(&t_alg->entry, &hash_handle->hash_list); + rc = crypto_register_ahash(&t_alg->ahash_alg); + if (unlikely(rc)) { + SSI_LOG_ERR("%s alg registration failed\n", + driver_hash[alg].driver_name); + kfree(t_alg); + goto fail; } else { - rc = crypto_register_ahash(&t_alg->ahash_alg); - if (unlikely(rc != 0)) { - SSI_LOG_ERR("%s alg registration failed\n", - t_alg->ahash_alg.halg.base.cra_driver_name); - kfree(t_alg); - goto fail; - } else - list_add_tail(&t_alg->entry, &hash_handle->hash_list); + list_add_tail(&t_alg->entry, + &hash_handle->hash_list); } } @@ -2460,25 +2281,14 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) } t_alg->drvdata = drvdata; - if (t_alg->synchronize) { - rc = crypto_register_shash(&t_alg->shash_alg); - if (unlikely(rc != 0)) { - SSI_LOG_ERR("%s alg registration failed\n", - t_alg->shash_alg.base.cra_driver_name); - kfree(t_alg); - goto fail; - } else - list_add_tail(&t_alg->entry, &hash_handle->hash_list); - + rc = crypto_register_ahash(&t_alg->ahash_alg); + if (unlikely(rc)) { + SSI_LOG_ERR("%s alg registration failed\n", + driver_hash[alg].driver_name); + kfree(t_alg); + goto fail; } else { - rc = crypto_register_ahash(&t_alg->ahash_alg); - if (unlikely(rc != 0)) { - SSI_LOG_ERR("%s alg registration failed\n", - t_alg->ahash_alg.halg.base.cra_driver_name); - kfree(t_alg); - goto fail; - } else - list_add_tail(&t_alg->entry, &hash_handle->hash_list); + list_add_tail(&t_alg->entry, &hash_handle->hash_list); } } @@ -2501,11 +2311,7 @@ int ssi_hash_free(struct ssi_drvdata *drvdata) if (hash_handle != NULL) { list_for_each_entry_safe(t_hash_alg, hash_n, &hash_handle->hash_list, entry) { - if (t_hash_alg->synchronize) { - crypto_unregister_shash(&t_hash_alg->shash_alg); - } else { - crypto_unregister_ahash(&t_hash_alg->ahash_alg); - } + crypto_unregister_ahash(&t_hash_alg->ahash_alg); list_del(&t_hash_alg->entry); kfree(t_hash_alg); } -- cgit v1.2.3-55-g7522 From da38a83ba7fffe34b8886f025aa9938479220dcd Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:38 +0300 Subject: staging: ccree: remove last remnants of sblkcipher The cipher code had some left overs of an attempt to support synch. cipher API with the HW. Remove the code handling this. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_cipher.c | 102 +++---------------------------------- drivers/staging/ccree/ssi_driver.h | 1 - 2 files changed, 6 insertions(+), 97 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index e16fd36072e2..2dfc6a3bd4c1 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -36,7 +36,6 @@ #define MAX_ABLKCIPHER_SEQ_LEN 6 #define template_ablkcipher template_u.ablkcipher -#define template_sblkcipher template_u.blkcipher #define SSI_MIN_AES_XTS_SIZE 0x10 #define SSI_MAX_AES_XTS_SIZE 0x2000 @@ -886,69 +885,6 @@ static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __io ivsize, areq, cc_base); } - - -static int ssi_sblkcipher_init(struct crypto_tfm *tfm) -{ - struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); - - /* Allocate sync ctx buffer */ - ctx_p->sync_ctx = kmalloc(sizeof(struct blkcipher_req_ctx), GFP_KERNEL|GFP_DMA); - if (!ctx_p->sync_ctx) { - SSI_LOG_ERR("Allocating sync ctx buffer in context failed\n"); - return -ENOMEM; - } - SSI_LOG_DEBUG("Allocated sync ctx buffer in context ctx_p->sync_ctx=@%p\n", - ctx_p->sync_ctx); - - return ssi_blkcipher_init(tfm); -} - - -static void ssi_sblkcipher_exit(struct crypto_tfm *tfm) -{ - struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); - - kfree(ctx_p->sync_ctx); - SSI_LOG_DEBUG("Free sync ctx buffer in context ctx_p->sync_ctx=@%p\n", ctx_p->sync_ctx); - - ssi_blkcipher_exit(tfm); -} - -#ifdef SYNC_ALGS -static int ssi_sblkcipher_encrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) -{ - struct crypto_blkcipher *blk_tfm = desc->tfm; - struct crypto_tfm *tfm = crypto_blkcipher_tfm(blk_tfm); - struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); - struct blkcipher_req_ctx *req_ctx = ctx_p->sync_ctx; - unsigned int ivsize = crypto_blkcipher_ivsize(blk_tfm); - - req_ctx->backup_info = desc->info; - req_ctx->is_giv = false; - - return ssi_blkcipher_process(tfm, req_ctx, dst, src, nbytes, desc->info, ivsize, NULL, DRV_CRYPTO_DIRECTION_ENCRYPT); -} - -static int ssi_sblkcipher_decrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) -{ - struct crypto_blkcipher *blk_tfm = desc->tfm; - struct crypto_tfm *tfm = crypto_blkcipher_tfm(blk_tfm); - struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm); - struct blkcipher_req_ctx *req_ctx = ctx_p->sync_ctx; - unsigned int ivsize = crypto_blkcipher_ivsize(blk_tfm); - - req_ctx->backup_info = desc->info; - req_ctx->is_giv = false; - - return ssi_blkcipher_process(tfm, req_ctx, dst, src, nbytes, desc->info, ivsize, NULL, DRV_CRYPTO_DIRECTION_DECRYPT); -} -#endif - /* Async wrap functions */ static int ssi_ablkcipher_init(struct crypto_tfm *tfm) @@ -1014,7 +950,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_XTS, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "xts(aes)", @@ -1031,7 +966,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_XTS, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "xts(aes)", @@ -1048,7 +982,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_XTS, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, #endif /*SSI_CC_HAS_AES_XTS*/ #if SSI_CC_HAS_AES_ESSIV @@ -1067,7 +1000,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_ESSIV, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "essiv(aes)", @@ -1084,7 +1016,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_ESSIV, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "essiv(aes)", @@ -1101,7 +1032,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_ESSIV, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, #endif /*SSI_CC_HAS_AES_ESSIV*/ #if SSI_CC_HAS_AES_BITLOCKER @@ -1120,7 +1050,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_BITLOCKER, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "bitlocker(aes)", @@ -1137,7 +1066,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_BITLOCKER, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "bitlocker(aes)", @@ -1154,7 +1082,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_BITLOCKER, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, #endif /*SSI_CC_HAS_AES_BITLOCKER*/ { @@ -1172,7 +1099,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_ECB, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "cbc(aes)", @@ -1186,10 +1112,9 @@ static struct ssi_alg_template blkcipher_algs[] = { .min_keysize = AES_MIN_KEY_SIZE, .max_keysize = AES_MAX_KEY_SIZE, .ivsize = AES_BLOCK_SIZE, - }, + }, .cipher_mode = DRV_CIPHER_CBC, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "ofb(aes)", @@ -1206,7 +1131,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_OFB, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, #if SSI_CC_HAS_AES_CTS { @@ -1224,7 +1148,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_CBC_CTS, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, #endif { @@ -1242,7 +1165,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_CTR, .flow_mode = S_DIN_to_AES, - .synchronous = false, }, { .name = "cbc(des3_ede)", @@ -1259,7 +1181,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_CBC, .flow_mode = S_DIN_to_DES, - .synchronous = false, }, { .name = "ecb(des3_ede)", @@ -1276,7 +1197,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_ECB, .flow_mode = S_DIN_to_DES, - .synchronous = false, }, { .name = "cbc(des)", @@ -1293,7 +1213,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_CBC, .flow_mode = S_DIN_to_DES, - .synchronous = false, }, { .name = "ecb(des)", @@ -1310,7 +1229,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_CIPHER_ECB, .flow_mode = S_DIN_to_DES, - .synchronous = false, }, #if SSI_CC_HAS_MULTI2 { @@ -1328,7 +1246,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_MULTI2_CBC, .flow_mode = S_DIN_to_MULTI2, - .synchronous = false, }, { .name = "ofb(multi2)", @@ -1345,7 +1262,6 @@ static struct ssi_alg_template blkcipher_algs[] = { }, .cipher_mode = DRV_MULTI2_OFB, .flow_mode = S_DIN_to_MULTI2, - .synchronous = false, }, #endif /*SSI_CC_HAS_MULTI2*/ }; @@ -1373,18 +1289,12 @@ struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct ssi_alg_template *templa alg->cra_alignmask = 0; alg->cra_ctxsize = sizeof(struct ssi_ablkcipher_ctx); - alg->cra_init = template->synchronous? ssi_sblkcipher_init:ssi_ablkcipher_init; - alg->cra_exit = template->synchronous? ssi_sblkcipher_exit:ssi_blkcipher_exit; - alg->cra_type = template->synchronous? &crypto_blkcipher_type:&crypto_ablkcipher_type; - if(template->synchronous) { - alg->cra_blkcipher = template->template_sblkcipher; - alg->cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | - template->type; - } else { - alg->cra_ablkcipher = template->template_ablkcipher; - alg->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY | + alg->cra_init = ssi_ablkcipher_init; + alg->cra_exit = ssi_blkcipher_exit; + alg->cra_type = &crypto_ablkcipher_type; + alg->cra_ablkcipher = template->template_ablkcipher; + alg->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY | template->type; - } t_alg->cipher_mode = template->cipher_mode; t_alg->flow_mode = template->flow_mode; diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 4c6eef9f97f5..34bd7efb1907 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -176,7 +176,6 @@ struct ssi_alg_template { int cipher_mode; int flow_mode; /* Note: currently, refers to the cipher mode only. */ int auth_mode; - bool synchronous; struct ssi_drvdata *drvdata; }; -- cgit v1.2.3-55-g7522 From b52fb1407269a2cbf94b29cb8003512b4f118dfe Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 4 Jun 2017 11:02:39 +0300 Subject: staging: ccree: remove descriptor context definitions Remove definitions of descriptor context which are not used in the driver. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_crypto_ctx.h | 86 ----------------------------------- 1 file changed, 86 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 20f3f9fa0b56..591f6fdadc59 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -196,91 +196,5 @@ enum drv_crypto_padding_type { DRV_PADDING_RESERVE32B = S32_MAX }; -/*******************************************************************/ -/***************** DESCRIPTOR BASED CONTEXTS ***********************/ -/*******************************************************************/ - - /* Generic context ("super-class") */ -struct drv_ctx_generic { - enum drv_crypto_alg alg; -} __attribute__((__may_alias__)); - -struct drv_ctx_hash { - enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HASH */ - enum drv_hash_mode mode; - u8 digest[CC_DIGEST_SIZE_MAX]; - /* reserve to end of allocated context size */ - u8 reserved[CC_CTX_SIZE - 2 * sizeof(u32) - - CC_DIGEST_SIZE_MAX]; -}; - -/* NOTE! drv_ctx_hmac should have the same structure as drv_ctx_hash except - * k0, k0_size fields - */ -struct drv_ctx_hmac { - enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HMAC */ - enum drv_hash_mode mode; - u8 digest[CC_DIGEST_SIZE_MAX]; - u32 k0[CC_HMAC_BLOCK_SIZE_MAX / sizeof(u32)]; - u32 k0_size; - /* reserve to end of allocated context size */ - u8 reserved[CC_CTX_SIZE - 3 * sizeof(u32) - - CC_DIGEST_SIZE_MAX - CC_HMAC_BLOCK_SIZE_MAX]; -}; - -struct drv_ctx_cipher { - enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_AES */ - enum drv_cipher_mode mode; - enum drv_crypto_direction direction; - enum drv_crypto_key_type crypto_key_type; - enum drv_crypto_padding_type padding_type; - u32 key_size; /* numeric value in bytes */ - u32 data_unit_size; /* required for XTS */ - /* block_state is the AES engine block state. - * It is used by the host to pass IV or counter at initialization. - * It is used by SeP for intermediate block chaining state and for - * returning MAC algorithms results. - */ - u8 block_state[CC_AES_BLOCK_SIZE]; - u8 key[CC_AES_KEY_SIZE_MAX]; - u8 xex_key[CC_AES_KEY_SIZE_MAX]; - /* reserve to end of allocated context size */ - u32 reserved[CC_DRV_CTX_SIZE_WORDS - 7 - - CC_AES_BLOCK_SIZE / sizeof(u32) - 2 * - (CC_AES_KEY_SIZE_MAX / sizeof(u32))]; -}; - -/* authentication and encryption with associated data class */ -struct drv_ctx_aead { - enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_AES */ - enum drv_cipher_mode mode; - enum drv_crypto_direction direction; - u32 key_size; /* numeric value in bytes */ - u32 nonce_size; /* nonce size (octets) */ - u32 header_size; /* finit additional data size (octets) */ - u32 text_size; /* finit text data size (octets) */ - u32 tag_size; /* mac size, element of {4, 6, 8, 10, 12, 14, 16} */ - /* block_state1/2 is the AES engine block state */ - u8 block_state[CC_AES_BLOCK_SIZE]; - u8 mac_state[CC_AES_BLOCK_SIZE]; /* MAC result */ - u8 nonce[CC_AES_BLOCK_SIZE]; /* nonce buffer */ - u8 key[CC_AES_KEY_SIZE_MAX]; - /* reserve to end of allocated context size */ - u32 reserved[CC_DRV_CTX_SIZE_WORDS - 8 - - 3 * (CC_AES_BLOCK_SIZE / sizeof(u32)) - - CC_AES_KEY_SIZE_MAX / sizeof(u32)]; -}; - -/*******************************************************************/ -/***************** MESSAGE BASED CONTEXTS **************************/ -/*******************************************************************/ - -/* Get the address of a @member within a given @ctx address - * @ctx: The context address - * @type: Type of context structure - * @member: Associated context field - */ -#define GET_CTX_FIELD_ADDR(ctx, type, member) ((ctx) + offsetof(type, member)) - #endif /* _CC_CRYPTO_CTX_H_ */ -- cgit v1.2.3-55-g7522 From 3137139a65822f331d4cce195da1440c1dc0a071 Mon Sep 17 00:00:00 2001 From: edcarter Date: Fri, 2 Jun 2017 18:18:24 -0700 Subject: Staging: comedi: s626.c: fixed trailing */ style issue Fixed coding style issue where trailing */ in block comments were not on separate lines. Signed-off-by: Elias Carter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s626.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 4b9c22665748..c906c9a5d944 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -580,11 +580,14 @@ static int s626_set_dac(struct comedi_device *dev, * running after the packet has been sent to the target DAC. */ val = 0x0F000000; /* Continue clock after target DAC data - * (write to non-existent trimdac). */ + * (write to non-existent trimdac). + */ val |= 0x00004000; /* Address the two main dual-DAC devices - * (TSL's chip select enables target device). */ + * (TSL's chip select enables target device). + */ val |= ((u32)(chan & 1) << 15); /* Address the DAC channel - * within the device. */ + * within the device. + */ val |= (u32)dacdata; /* Include DAC setpoint data. */ return s626_send_dac(dev, val); } -- cgit v1.2.3-55-g7522 From 66cd04714bfde78788543b45a6c474462c776f07 Mon Sep 17 00:00:00 2001 From: Konrad Malkowski Date: Fri, 2 Jun 2017 22:40:33 -0400 Subject: staging: rtl8192e: all lines in dot11d.h are less than 80 chars long This patch fixes the checkpoint.pl warning: WARNING: line over 80 characters Signed-off-by: Konrad Malkowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index 623075cf0c05..7fa3c4d963c4 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -30,8 +30,8 @@ enum dot11d_state { }; /** - * struct rt_dot11d_info * @CountryIeLen: value greater than 0 if @CountryIeBuf contains - * valid country information element. + * struct rt_dot11d_info * @CountryIeLen: value greater than 0 if + * @CountryIeBuf contains valid country information element. * @channel_map: holds channel values * 0 - invalid, * 1 - valid (active scan), -- cgit v1.2.3-55-g7522 From 54f6f4deed7344da7463d4d79872f9e2efb2daa8 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sat, 3 Jun 2017 23:44:41 +0100 Subject: staging: rtl8723bs: fix another spelling mistake I found one more spelling mistake in a DBG_8192C debug message, replace "avaliable" with "available", add some spacing between text and a number and split overly long line Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 163537faefd9..84a89ef74169 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -1741,7 +1741,8 @@ static u8 hal_EfusePgPacketWrite2ByteHeader( efuse_addr = *pAddr; if (efuse_addr >= efuse_max_available_len) { - DBG_8192C("%s: addr(%d) over avaliable(%d)!!\n", __func__, efuse_addr, efuse_max_available_len); + DBG_8192C("%s: addr(%d) over available (%d)!!\n", __func__, + efuse_addr, efuse_max_available_len); return false; } -- cgit v1.2.3-55-g7522 From 1d80d1bd176ac7e9414d49096bfb3da2c929ee8a Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sun, 4 Jun 2017 00:31:42 +0100 Subject: staging: ccree: fix spelling mistake: "chanined" -> "chained" Trivial fix to spelling mistake in SSI_LOG_ERR message Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_buffer_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 3252114740d0..1ff603f8f8f5 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -82,7 +82,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( unsigned int nents = 0; while (nbytes != 0) { if (sg_is_chain(sg_list)) { - SSI_LOG_ERR("Unexpected chanined entry " + SSI_LOG_ERR("Unexpected chained entry " "in sg (entry =0x%X) \n", nents); BUG(); } -- cgit v1.2.3-55-g7522 From 9f98c6e67ffd1961884e70023a33e81730cd7fcb Mon Sep 17 00:00:00 2001 From: Richard Porter Date: Sun, 4 Jun 2017 11:10:12 +0100 Subject: staging: ks7010: use le16_to_cpu() to access __le16 field Fixes sparse warning: drivers/staging/ks7010/ks_hostif.c:959:24: warning: restricted __le16 degrades to integer Signed-off-by: Richard Porter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 79634be1b873..697347bb8760 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -956,7 +956,7 @@ void hostif_associate_indication(struct ks_wlan_private *priv) wrqu.data.length += sizeof(associnfo_leader1) - 1; pbuf += sizeof(associnfo_leader1) - 1; - pb += assoc_req->req_ies_size; + pb += le16_to_cpu(assoc_req->req_ies_size); for (i = 0; i < le16_to_cpu(assoc_resp->resp_ies_size); i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); wrqu.data.length += (le16_to_cpu(assoc_resp->resp_ies_size)) * 2; -- cgit v1.2.3-55-g7522 From 97b30bad76960375a61b54832a8641c9b23b14b5 Mon Sep 17 00:00:00 2001 From: Adrian Stanciu Date: Sun, 4 Jun 2017 15:07:33 +0300 Subject: staging: comedi: ni_labpc_isadma: fixed a comment coding style issue Fixed a BLOCK_COMMENT_STYLE warning reported by checkpatch.pl script. Signed-off-by: Adrian Stanciu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_isadma.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_labpc_isadma.h b/drivers/staging/comedi/drivers/ni_labpc_isadma.h index b8a1b0ee6290..e93f79050e60 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_isadma.h +++ b/drivers/staging/comedi/drivers/ni_labpc_isadma.h @@ -1,6 +1,6 @@ /* * ni_labpc ISA DMA support. -*/ + */ #ifndef _NI_LABPC_ISADMA_H #define _NI_LABPC_ISADMA_H -- cgit v1.2.3-55-g7522 From ac669251087d876d6e51eb648f98e575f0d0499d Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Sun, 4 Jun 2017 20:36:54 +0100 Subject: staging: sm750fb: change default screen resolution Update the default screen resolution and also use 24bpp for a better screen performance. Tested-by: Teddy Wang Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index a7f722ae30d5..d5934f372387 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -33,7 +33,7 @@ static int g_hwcursor = 1; static int g_noaccel; static int g_nomtrr; static const char *g_fbmode[] = {NULL, NULL}; -static const char *g_def_fbmode = "800x600-16@60"; +static const char *g_def_fbmode = "1024x768-24@60"; static char *g_settings; static int g_dualview; static char *g_option; -- cgit v1.2.3-55-g7522 From 498c4b4e9c23855d17ecc2a108d949bb68020481 Mon Sep 17 00:00:00 2001 From: Jia-Ju Bai Date: Mon, 5 Jun 2017 15:30:16 +0800 Subject: staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page The driver may sleep under a spin lock, and the function call path is: rtsx_exclusive_enter_ss (acquire the lock by spin_lock) rtsx_enter_ss rtsx_power_off_card xd_cleanup_work xd_delay_write xd_finish_write xd_copy_page wait_timeout schedule_timeout --> may sleep To fix it, "wait_timeout" is replaced with mdelay in xd_copy_page. Signed-off-by: Jia-Ju Bai Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/xd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c index 85aba05acbc1..74d36f9a4c1d 100644 --- a/drivers/staging/rts5208/xd.c +++ b/drivers/staging/rts5208/xd.c @@ -1268,7 +1268,7 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk, reg = 0; rtsx_read_register(chip, XD_CTL, ®); if (reg & (XD_ECC1_ERROR | XD_ECC2_ERROR)) { - wait_timeout(100); + mdelay(100); if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { -- cgit v1.2.3-55-g7522 From 372bd1eb8484525832a3959cc0b878a7f01dd70b Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 5 Jun 2017 09:21:58 +0100 Subject: staging: rtl8723bs: fix a couple of spelling mistakes Replace cant with cannot, argumetns with arguments and add line break to overly long DBG_871X statement. Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_com.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 1880d4140bee..e3a98322f475 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -26,7 +26,7 @@ u8 rtw_hal_data_init(struct adapter *padapter) padapter->hal_data_sz = sizeof(struct hal_com_data); padapter->HalData = vzalloc(padapter->hal_data_sz); if (padapter->HalData == NULL) { - DBG_8192C("cant not alloc memory for HAL DATA\n"); + DBG_8192C("cannot alloc memory for HAL DATA\n"); return _FAIL; } } @@ -1415,7 +1415,8 @@ bool GetHexValueFromString(char *szStr, u32 *pu4bVal, u32 *pu4bMove) /* Check input parameter. */ if (szStr == NULL || pu4bVal == NULL || pu4bMove == NULL) { - DBG_871X("GetHexValueFromString(): Invalid inpur argumetns! szStr: %p, pu4bVal: %p, pu4bMove: %p\n", szStr, pu4bVal, pu4bMove); + DBG_871X("GetHexValueFromString(): Invalid input arguments! szStr: %p, pu4bVal: %p, pu4bMove: %p\n", + szStr, pu4bVal, pu4bMove); return false; } -- cgit v1.2.3-55-g7522 From 88a5b39b69ab1828fd4130e2baadd184109cea69 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 5 Jun 2017 21:52:34 -0700 Subject: staging/rts5208: Fix read overflow in memcpy Noticed by FORTIFY_SOURCE, this swaps memcpy() for strncpy() to zero-value fill the end of the buffer instead of over-reading a string from .rodata. Signed-off-by: Daniel Micay [kees: wrote commit log] Signed-off-by: Kees Cook Cc: Greg Kroah-Hartman Cc: Wayne Porter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/rtsx_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c index a95c5de1aa00..36b5a11f21d2 100644 --- a/drivers/staging/rts5208/rtsx_scsi.c +++ b/drivers/staging/rts5208/rtsx_scsi.c @@ -536,7 +536,7 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (sendbytes > 8) { memcpy(buf, inquiry_buf, 8); - memcpy(buf + 8, inquiry_string, sendbytes - 8); + strncpy(buf + 8, inquiry_string, sendbytes - 8); if (pro_formatter_flag) { /* Additional Length */ buf[4] = 0x33; -- cgit v1.2.3-55-g7522 From f6089ae42faf3132d9f02cec951a006be87edade Mon Sep 17 00:00:00 2001 From: Bo YU Date: Mon, 5 Jun 2017 23:43:55 -0400 Subject: staging: speakup: add a missing blank line after declaration Fixed checkpatch warning by adding a blank line after declare expression Signed-off-by: Bo YU Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/serialio.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index 969373201356..8d2f7c672cc6 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -162,6 +162,7 @@ static void spk_serial_send_xchar(char ch) static void spk_serial_tiocmset(unsigned int set, unsigned int clear) { int old = inb(speakup_info.port_tts + UART_MCR); + outb((old & ~clear) | set, speakup_info.port_tts + UART_MCR); } -- cgit v1.2.3-55-g7522 From 79de2d0e8dd33892489733f5efbe4ac53f5e7f7d Mon Sep 17 00:00:00 2001 From: Bo YU Date: Mon, 5 Jun 2017 23:44:11 -0400 Subject: staging: speakup: add a space around '|' Add a space around logical symbol '|' to wipe out checkpatch check Signed-off-by: Bo YU Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/serialio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index 8d2f7c672cc6..f38eb66943bf 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -138,7 +138,7 @@ static void start_serial_interrupt(int irq) outb(UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2, speakup_info.port_tts + UART_MCR); /* Turn on Interrupts */ - outb(UART_IER_MSI|UART_IER_RLSI|UART_IER_RDI, + outb(UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI, speakup_info.port_tts + UART_IER); inb(speakup_info.port_tts + UART_LSR); inb(speakup_info.port_tts + UART_RX); -- cgit v1.2.3-55-g7522 From 1f101456460cce9be7cdad5798a0ecdd671986c8 Mon Sep 17 00:00:00 2001 From: Bo YU Date: Mon, 5 Jun 2017 23:44:26 -0400 Subject: staging: speakup: in serialio.c no over 80 chars long Fixed the checkpatch.pl warning: WARNING: line over 80 characters Signed-off-by: Bo YU Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/serialio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index f38eb66943bf..00b25d3591d2 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -228,7 +228,8 @@ int spk_wait_for_xmitr(struct spk_synth *in_synth) } while (spk_serial_tx_busy()) { if (--tmout == 0) { - pr_warn("%s: timed out (tx busy)\n", in_synth->long_name); + pr_warn("%s: timed out (tx busy)\n", + in_synth->long_name); timeouts++; return 0; } @@ -285,7 +286,8 @@ static int spk_serial_out(struct spk_synth *in_synth, const char ch) return 0; } -const char *spk_serial_synth_immediate(struct spk_synth *synth, const char *buff) +const char *spk_serial_synth_immediate(struct spk_synth *synth, + const char *buff) { u_char ch; -- cgit v1.2.3-55-g7522 From e5770b7bdbfe9f23bb75a7d5a88c1f5e18e20738 Mon Sep 17 00:00:00 2001 From: Bo YU Date: Mon, 5 Jun 2017 23:44:40 -0400 Subject: staging: speakup: alignment match open parens I have aligned argument with parenthesis, so checkpatch no check also. Signed-off-by: Bo YU Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/serialio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index 00b25d3591d2..9cfc8142a318 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -139,7 +139,7 @@ static void start_serial_interrupt(int irq) speakup_info.port_tts + UART_MCR); /* Turn on Interrupts */ outb(UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI, - speakup_info.port_tts + UART_IER); + speakup_info.port_tts + UART_IER); inb(speakup_info.port_tts + UART_LSR); inb(speakup_info.port_tts + UART_RX); inb(speakup_info.port_tts + UART_IIR); -- cgit v1.2.3-55-g7522 From d9d2401f59355264a435c723aadee5b84b75881b Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 6 Jun 2017 23:59:37 -0700 Subject: greybus: hid: remove custom locking from gb_hid_open/close Now that HID core enforces serialization of transport driver open/close calls we can remove custom locking from greybus hid driver. Signed-off-by: Dmitry Torokhov Acked-by: Greg Kroah-Hartman Acked-by: Viresh Kumar Reviewed-by: Andy Shevchenko Reviewed-by: Benjamin Tissoires Signed-off-by: Jiri Kosina --- drivers/staging/greybus/hid.c | 43 ++++++++++++++----------------------------- 1 file changed, 14 insertions(+), 29 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c index 730d746fc4c2..465101bbab69 100644 --- a/drivers/staging/greybus/hid.c +++ b/drivers/staging/greybus/hid.c @@ -32,8 +32,6 @@ struct gb_hid { char *inbuf; }; -static DEFINE_MUTEX(gb_hid_open_mutex); - /* Routines to get controller's information over greybus */ /* Operations performed on greybus */ @@ -346,19 +344,14 @@ static void gb_hid_stop(struct hid_device *hid) static int gb_hid_open(struct hid_device *hid) { struct gb_hid *ghid = hid->driver_data; - int ret = 0; - - mutex_lock(&gb_hid_open_mutex); - if (!hid->open++) { - ret = gb_hid_set_power(ghid, GB_HID_TYPE_PWR_ON); - if (ret < 0) - hid->open--; - else - set_bit(GB_HID_STARTED, &ghid->flags); - } - mutex_unlock(&gb_hid_open_mutex); + int ret; - return ret; + ret = gb_hid_set_power(ghid, GB_HID_TYPE_PWR_ON); + if (ret < 0) + return ret; + + set_bit(GB_HID_STARTED, &ghid->flags); + return 0; } static void gb_hid_close(struct hid_device *hid) @@ -366,21 +359,13 @@ static void gb_hid_close(struct hid_device *hid) struct gb_hid *ghid = hid->driver_data; int ret; - /* - * Protecting hid->open to make sure we don't restart data acquistion - * due to a resumption we no longer care about.. - */ - mutex_lock(&gb_hid_open_mutex); - if (!--hid->open) { - clear_bit(GB_HID_STARTED, &ghid->flags); - - /* Save some power */ - ret = gb_hid_set_power(ghid, GB_HID_TYPE_PWR_OFF); - if (ret) - dev_err(&ghid->connection->bundle->dev, - "failed to power off (%d)\n", ret); - } - mutex_unlock(&gb_hid_open_mutex); + clear_bit(GB_HID_STARTED, &ghid->flags); + + /* Save some power */ + ret = gb_hid_set_power(ghid, GB_HID_TYPE_PWR_OFF); + if (ret) + dev_err(&ghid->connection->bundle->dev, + "failed to power off (%d)\n", ret); } static int gb_hid_power(struct hid_device *hid, int lvl) -- cgit v1.2.3-55-g7522 From acbff8e31ef07676c752a35d2991bc5cd989b24b Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:24 -0500 Subject: staging: fsl-dpaa2/eth: Add "static" keyword where needed Make a couple of locally used functions and structures static. Issue found through static analysis tool. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 6 +++--- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 2 -- drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 49c435bad706..8ff8951f31b9 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1162,8 +1162,8 @@ static int dpaa2_eth_set_addr(struct net_device *net_dev, void *addr) /** Fill in counters maintained by the GPP driver. These may be different from * the hardware counters obtained by ethtool. */ -void dpaa2_eth_get_stats(struct net_device *net_dev, - struct rtnl_link_stats64 *stats) +static void dpaa2_eth_get_stats(struct net_device *net_dev, + struct rtnl_link_stats64 *stats) { struct dpaa2_eth_priv *priv = netdev_priv(net_dev); struct rtnl_link_stats64 *percpu_stats; @@ -1958,7 +1958,7 @@ static const struct dpaa2_eth_hash_fields hash_fields[] = { /* Set RX hash options * flags is a combination of RXH_ bits */ -int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags) +static int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags) { struct device *dev = net_dev->dev.parent; struct dpaa2_eth_priv *priv = netdev_priv(net_dev); diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 55b47623008c..539da71470d9 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -339,8 +339,6 @@ struct dpaa2_eth_priv { extern const struct ethtool_ops dpaa2_ethtool_ops; extern const char dpaa2_eth_drv_version[]; -int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags); - static int dpaa2_eth_queue_count(struct dpaa2_eth_priv *priv) { return priv->dpni_attrs.num_queues; diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c index dd0cffa908ef..89888b6115bf 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c @@ -34,7 +34,7 @@ #include "dpaa2-eth.h" /* To be kept in sync with DPNI statistics */ -char dpaa2_ethtool_stats[][ETH_GSTRING_LEN] = { +static char dpaa2_ethtool_stats[][ETH_GSTRING_LEN] = { "rx frames", "rx bytes", "rx mcast frames", @@ -56,7 +56,7 @@ char dpaa2_ethtool_stats[][ETH_GSTRING_LEN] = { #define DPAA2_ETH_NUM_STATS ARRAY_SIZE(dpaa2_ethtool_stats) -char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = { +static char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = { /* per-cpu stats */ "tx conf frames", "tx conf bytes", -- cgit v1.2.3-55-g7522 From 8dffaf8a17c1d97a66306bd361798e0bcf562332 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:25 -0500 Subject: staging: fsl-dpaa2/eth: Initialize variable before use In dpni_get_irq_status(), status is both in and out parameter, so initialize before use. Issue found through static analysis tool. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 8ff8951f31b9..f0ef3a7c0f73 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -2252,7 +2252,7 @@ static irqreturn_t dpni_irq0_handler(int irq_num, void *arg) static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg) { - u32 status, clear = 0; + u32 status = 0, clear = 0; struct device *dev = (struct device *)arg; struct fsl_mc_device *dpni_dev = to_fsl_mc_device(dev); struct net_device *net_dev = dev_get_drvdata(dev); -- cgit v1.2.3-55-g7522 From c433db403bbc0b7b7e3e9b6abd5fc652a52c91c6 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:26 -0500 Subject: staging: fsl-dpaa2/eth: Fix return type of ndo_start_xmit ndo_start_xmit() returns a value of type netdev_tx_t. Update our ndo function to use the correct type. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index f0ef3a7c0f73..a9e245df2488 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -551,7 +551,7 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, dev_kfree_skb(skb); } -static int dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev) +static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev) { struct dpaa2_eth_priv *priv = netdev_priv(net_dev); struct dpaa2_fd fd; -- cgit v1.2.3-55-g7522 From e202c82c90a594782e51f47bb02d3529def214fa Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:27 -0500 Subject: staging: fsl-dpaa2/eth: Remove incorrect error path Not having Rx hashing distribution enabled for an interface is a valid configuration and shouldn't be treated as an error. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index a9e245df2488..f63054e071b3 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1969,8 +1969,8 @@ static int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags) int err = 0; if (!dpaa2_eth_hash_enabled(priv)) { - dev_err(dev, "Hashing support is not enabled\n"); - return -EOPNOTSUPP; + dev_dbg(dev, "Hashing support is not enabled\n"); + return 0; } memset(&cls_cfg, 0, sizeof(cls_cfg)); -- cgit v1.2.3-55-g7522 From 77160af37cc4e93612396db4d48c182e166d9b58 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:28 -0500 Subject: staging: fsl-dpaa2/eth: Add error message newlines A few error/warning messages lacked a newline at the end of the text. Add it for improved consistency and cosmetics. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 14 +++++++------- drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index f63054e071b3..c4252f47d57d 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -975,7 +975,7 @@ static int link_state_update(struct dpaa2_eth_priv *priv) netif_carrier_off(priv->net_dev); } - netdev_info(priv->net_dev, "Link Event: state %s", + netdev_info(priv->net_dev, "Link Event: state %s\n", state.up ? "up" : "down"); return 0; @@ -1806,7 +1806,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) } if ((priv->tx_data_offset % 64) != 0) - dev_warn(dev, "Tx data offset (%d) not a multiple of 64B", + dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n", priv->tx_data_offset); /* Accommodate software annotation space (SWA) */ @@ -2002,7 +2002,7 @@ static int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags) err = dpni_prepare_key_cfg(&cls_cfg, dma_mem); if (err) { - dev_err(dev, "dpni_prepare_key_cfg error %d", err); + dev_err(dev, "dpni_prepare_key_cfg error %d\n", err); goto err_prep_key; } @@ -2261,7 +2261,7 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg) err = dpni_get_irq_status(dpni_dev->mc_io, 0, dpni_dev->mc_handle, DPNI_IRQ_INDEX, &status); if (unlikely(err)) { - netdev_err(net_dev, "Can't get irq status (err %d)", err); + netdev_err(net_dev, "Can't get irq status (err %d)\n", err); clear = 0xffffffff; goto out; } @@ -2295,21 +2295,21 @@ static int setup_irqs(struct fsl_mc_device *ls_dev) IRQF_NO_SUSPEND | IRQF_ONESHOT, dev_name(&ls_dev->dev), &ls_dev->dev); if (err < 0) { - dev_err(&ls_dev->dev, "devm_request_threaded_irq(): %d", err); + dev_err(&ls_dev->dev, "devm_request_threaded_irq(): %d\n", err); goto free_mc_irq; } err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle, DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED); if (err < 0) { - dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d", err); + dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err); goto free_irq; } err = dpni_set_irq_enable(ls_dev->mc_io, 0, ls_dev->mc_handle, DPNI_IRQ_INDEX, 1); if (err < 0) { - dev_err(&ls_dev->dev, "dpni_set_irq_enable(): %d", err); + dev_err(&ls_dev->dev, "dpni_set_irq_enable(): %d\n", err); goto free_irq; } diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c index 89888b6115bf..6a331c74e542 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c @@ -94,7 +94,7 @@ dpaa2_eth_get_link_ksettings(struct net_device *net_dev, err = dpni_get_link_state(priv->mc_io, 0, priv->mc_token, &state); if (err) { - netdev_err(net_dev, "ERROR %d getting link state", err); + netdev_err(net_dev, "ERROR %d getting link state\n", err); goto out; } @@ -147,7 +147,7 @@ dpaa2_eth_set_link_ksettings(struct net_device *net_dev, /* ethtool will be loud enough if we return an error; no point * in putting our own error message on the console by default */ - netdev_dbg(net_dev, "ERROR %d setting link cfg", err); + netdev_dbg(net_dev, "ERROR %d setting link cfg\n", err); return err; } @@ -206,7 +206,7 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, err = dpni_get_statistics(priv->mc_io, 0, priv->mc_token, j, &dpni_stats); if (err != 0) - netdev_warn(net_dev, "dpni_get_stats(%d) failed", j); + netdev_warn(net_dev, "dpni_get_stats(%d) failed\n", j); switch (j) { case 0: num_cnt = sizeof(dpni_stats.page_0) / sizeof(u64); -- cgit v1.2.3-55-g7522 From d87d5baf64e90d81ea526e7cc32dbc015067c677 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:29 -0500 Subject: staging: fsl-dpaa2/eth: Minor cleanup in dpaa2_eth_set_hash We already have a variable for the DMA mapping device, so use that directly. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index c4252f47d57d..bf6f300affa7 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -2009,10 +2009,10 @@ static int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags) memset(&dist_cfg, 0, sizeof(dist_cfg)); /* Prepare for setting the rx dist */ - dist_cfg.key_cfg_iova = dma_map_single(net_dev->dev.parent, dma_mem, + dist_cfg.key_cfg_iova = dma_map_single(dev, dma_mem, DPAA2_CLASSIFIER_DMA_SIZE, DMA_TO_DEVICE); - if (dma_mapping_error(net_dev->dev.parent, dist_cfg.key_cfg_iova)) { + if (dma_mapping_error(dev, dist_cfg.key_cfg_iova)) { dev_err(dev, "DMA mapping failed\n"); err = -ENOMEM; goto err_dma_map; @@ -2022,7 +2022,7 @@ static int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags) dist_cfg.dist_mode = DPNI_DIST_MODE_HASH; err = dpni_set_rx_tc_dist(priv->mc_io, 0, priv->mc_token, 0, &dist_cfg); - dma_unmap_single(net_dev->dev.parent, dist_cfg.key_cfg_iova, + dma_unmap_single(dev, dist_cfg.key_cfg_iova, DPAA2_CLASSIFIER_DMA_SIZE, DMA_TO_DEVICE); if (err) dev_err(dev, "dpni_set_rx_tc_dist() error %d\n", err); -- cgit v1.2.3-55-g7522 From e40ef9e48fa44cb1b5d51bf6e602d4a292cc5dfb Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:30 -0500 Subject: staging: fsl-dpaa2/eth: Don't use GFP_DMA Don't use GFP_DMA when allocating memory for the hash key, as we don't actually need to allocate from the lowest zone. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index bf6f300affa7..57628cd3ecf2 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1996,7 +1996,7 @@ static int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags) priv->rx_hash_fields |= hash_fields[i].rxnfc_field; } - dma_mem = kzalloc(DPAA2_CLASSIFIER_DMA_SIZE, GFP_DMA | GFP_KERNEL); + dma_mem = kzalloc(DPAA2_CLASSIFIER_DMA_SIZE, GFP_KERNEL); if (!dma_mem) return -ENOMEM; -- cgit v1.2.3-55-g7522 From d4b3763d380c8e97e816ad1e268a002248ff2bc1 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:31 -0500 Subject: staging: fsl-dpaa2/eth: Always call napi_gro_receive() The function itself checks whether GRO support is enabled and acts accordingly, so we don't need to verify it in the driver as well. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 57628cd3ecf2..d3ec384c7364 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -273,10 +273,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, percpu_stats->rx_packets++; percpu_stats->rx_bytes += dpaa2_fd_get_len(fd); - if (priv->net_dev->features & NETIF_F_GRO) - napi_gro_receive(napi, skb); - else - netif_receive_skb(skb); + napi_gro_receive(napi, skb); return; -- cgit v1.2.3-55-g7522 From d00defe30a21eea6d952925dccc7e212b1baf1ff Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:32 -0500 Subject: staging: fsl-dpaa2/eth: Reset dpbp Reset the buffer pool object before using it, like we do for the other DPAA2 objects. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index d3ec384c7364..fd56fbd20087 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1687,6 +1687,12 @@ static int setup_dpbp(struct dpaa2_eth_priv *priv) goto err_open; } + err = dpbp_reset(priv->mc_io, 0, dpbp_dev->mc_handle); + if (err) { + dev_err(dev, "dpbp_reset() failed\n"); + goto err_reset; + } + err = dpbp_enable(priv->mc_io, 0, dpbp_dev->mc_handle); if (err) { dev_err(dev, "dpbp_enable() failed\n"); @@ -1705,6 +1711,7 @@ static int setup_dpbp(struct dpaa2_eth_priv *priv) err_get_attr: dpbp_disable(priv->mc_io, 0, dpbp_dev->mc_handle); err_enable: +err_reset: dpbp_close(priv->mc_io, 0, dpbp_dev->mc_handle); err_open: fsl_mc_object_free(dpbp_dev); -- cgit v1.2.3-55-g7522 From 5206d8d1d3e2e31f0cc2b5ec92a83ac344c4f2bb Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:33 -0500 Subject: staging: fsl-dpaa2/eth: Defer probing if no DPIOs found If the Ethernet driver doesn't find any DPIO devices during probe, it may be either because there's none available or because they haven't been probed yet. Request deferred probing in case it's the latter. Signed-off-by: Bharat Bhushan Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index fd56fbd20087..025b5f6559a4 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1510,6 +1510,7 @@ static int setup_dpio(struct dpaa2_eth_priv *priv) if (!channel) { dev_info(dev, "No affine channel for cpu %d and above\n", i); + err = -ENODEV; goto err_alloc_ch; } @@ -1524,10 +1525,13 @@ static int setup_dpio(struct dpaa2_eth_priv *priv) /* Register the new context */ err = dpaa2_io_service_register(NULL, nctx); if (err) { - dev_info(dev, "No affine DPIO for cpu %d\n", i); + dev_dbg(dev, "No affine DPIO for cpu %d\n", i); /* If no affine DPIO for this core, there's probably - * none available for next cores either. + * none available for next cores either. Signal we want + * to retry later, in case the DPIO devices weren't + * probed yet. */ + err = -EPROBE_DEFER; goto err_service_reg; } @@ -1565,7 +1569,7 @@ err_service_reg: err_alloc_ch: if (cpumask_empty(&priv->dpio_cpumask)) { dev_err(dev, "No cpu with an affine DPIO/DPCON\n"); - return -ENODEV; + return err; } dev_info(dev, "Cores %*pbl available for processing ingress traffic\n", -- cgit v1.2.3-55-g7522 From 12afee803cd9e48cd5de584f8f66d05e79ec5d9d Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:34 -0500 Subject: staging: fsl-dpaa2/eth: Update ethtool stats names Add a label to the ethtool statistics counters, to differentiate between hardware counters and driver specific ones. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c index 6a331c74e542..5312edc26f01 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c @@ -35,40 +35,40 @@ /* To be kept in sync with DPNI statistics */ static char dpaa2_ethtool_stats[][ETH_GSTRING_LEN] = { - "rx frames", - "rx bytes", - "rx mcast frames", - "rx mcast bytes", - "rx bcast frames", - "rx bcast bytes", - "tx frames", - "tx bytes", - "tx mcast frames", - "tx mcast bytes", - "tx bcast frames", - "tx bcast bytes", - "rx filtered frames", - "rx discarded frames", - "rx nobuffer discards", - "tx discarded frames", - "tx confirmed frames", + "[hw] rx frames", + "[hw] rx bytes", + "[hw] rx mcast frames", + "[hw] rx mcast bytes", + "[hw] rx bcast frames", + "[hw] rx bcast bytes", + "[hw] tx frames", + "[hw] tx bytes", + "[hw] tx mcast frames", + "[hw] tx mcast bytes", + "[hw] tx bcast frames", + "[hw] tx bcast bytes", + "[hw] rx filtered frames", + "[hw] rx discarded frames", + "[hw] rx nobuffer discards", + "[hw] tx discarded frames", + "[hw] tx confirmed frames", }; #define DPAA2_ETH_NUM_STATS ARRAY_SIZE(dpaa2_ethtool_stats) static char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = { /* per-cpu stats */ - "tx conf frames", - "tx conf bytes", - "tx sg frames", - "tx sg bytes", - "rx sg frames", - "rx sg bytes", - "enqueue portal busy", + "[drv] tx conf frames", + "[drv] tx conf bytes", + "[drv] tx sg frames", + "[drv] tx sg bytes", + "[drv] rx sg frames", + "[drv] rx sg bytes", + "[drv] enqueue portal busy", /* Channel stats */ - "dequeue portal busy", - "channel pull errors", - "cdan", + "[drv] dequeue portal busy", + "[drv] channel pull errors", + "[drv] cdan", }; #define DPAA2_ETH_NUM_EXTRA_STATS ARRAY_SIZE(dpaa2_ethtool_extras) -- cgit v1.2.3-55-g7522 From d695e764f26399443474482cd3396130cd38057b Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:35 -0500 Subject: staging: fsl-dpaa2/eth: Add accessor for FAS field Introduce a helper macro for accessing the frame annotation status field in a frame buffer. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 31 ++++++++++++-------------- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 6 +++++ 2 files changed, 20 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 025b5f6559a4..d81c56f4d859 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -227,6 +227,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, struct dpaa2_eth_drv_stats *percpu_extras; struct device *dev = priv->net_dev->dev.parent; struct dpaa2_fas *fas; + void *buf_data; u32 status = 0; /* Tracing point */ @@ -235,8 +236,10 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE, DMA_FROM_DEVICE); - prefetch(vaddr + priv->buf_layout.private_data_size); - prefetch(vaddr + dpaa2_fd_get_offset(fd)); + fas = dpaa2_get_fas(vaddr); + prefetch(fas); + buf_data = vaddr + dpaa2_fd_get_offset(fd); + prefetch(buf_data); percpu_stats = this_cpu_ptr(priv->percpu_stats); percpu_extras = this_cpu_ptr(priv->percpu_extras); @@ -244,9 +247,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, if (fd_format == dpaa2_fd_single) { skb = build_linear_skb(priv, ch, fd, vaddr); } else if (fd_format == dpaa2_fd_sg) { - struct dpaa2_sg_entry *sgt = - vaddr + dpaa2_fd_get_offset(fd); - skb = build_frag_skb(priv, ch, sgt); + skb = build_frag_skb(priv, ch, buf_data); skb_free_frag(vaddr); percpu_extras->rx_sg_frames++; percpu_extras->rx_sg_bytes += dpaa2_fd_get_len(fd); @@ -262,8 +263,6 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, /* Check if we need to validate the L4 csum */ if (likely(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) { - fas = (struct dpaa2_fas *) - (vaddr + priv->buf_layout.private_data_size); status = le32_to_cpu(fas->status); validate_rx_csum(priv, status, skb); } @@ -327,7 +326,6 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, { struct device *dev = priv->net_dev->dev.parent; void *sgt_buf = NULL; - void *hwa; dma_addr_t addr; int nr_frags = skb_shinfo(skb)->nr_frags; struct dpaa2_sg_entry *sgt; @@ -337,6 +335,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, int num_sg; int num_dma_bufs; struct dpaa2_eth_swa *swa; + struct dpaa2_fas *fas; /* Create and map scatterlist. * We don't advertise NETIF_F_FRAGLIST, so skb_to_sgvec() will not have @@ -373,8 +372,8 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, * on TX confirmation. We are clearing FAS (Frame Annotation Status) * field from the hardware annotation area */ - hwa = sgt_buf + priv->buf_layout.private_data_size; - memset(hwa + DPAA2_FAS_OFFSET, 0, DPAA2_FAS_SIZE); + fas = dpaa2_get_fas(sgt_buf); + memset(fas, 0, DPAA2_FAS_SIZE); sgt = (struct dpaa2_sg_entry *)(sgt_buf + priv->tx_data_offset); @@ -433,7 +432,7 @@ static int build_single_fd(struct dpaa2_eth_priv *priv, { struct device *dev = priv->net_dev->dev.parent; u8 *buffer_start; - void *hwa; + struct dpaa2_fas *fas; struct sk_buff **skbh; dma_addr_t addr; @@ -446,8 +445,8 @@ static int build_single_fd(struct dpaa2_eth_priv *priv, * on TX confirmation. We are clearing FAS (Frame Annotation Status) * field from the hardware annotation area */ - hwa = buffer_start + priv->buf_layout.private_data_size; - memset(hwa + DPAA2_FAS_OFFSET, 0, DPAA2_FAS_SIZE); + fas = dpaa2_get_fas(buffer_start); + memset(fas, 0, DPAA2_FAS_SIZE); /* Store a backpointer to the skb at the beginning of the buffer * (in the private data area) such that we can release it @@ -498,6 +497,7 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, fd_addr = dpaa2_fd_get_addr(fd); skbh = dpaa2_iova_to_virt(priv->iommu_domain, fd_addr); + fas = dpaa2_get_fas(skbh); if (fd_format == dpaa2_fd_single) { skb = *skbh; @@ -534,11 +534,8 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, * buffer but before we free it. The caller function is responsible * for checking the status value. */ - if (status && (dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) { - fas = (struct dpaa2_fas *) - ((void *)skbh + priv->buf_layout.private_data_size); + if (status && (dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) *status = le32_to_cpu(fas->status); - } /* Free SGT buffer kmalloc'ed on tx */ if (fd_format != dpaa2_fd_single) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 539da71470d9..6462e2cbe4be 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -139,6 +139,12 @@ struct dpaa2_fas { #define DPAA2_FAS_OFFSET 0 #define DPAA2_FAS_SIZE (sizeof(struct dpaa2_fas)) +/* Accessors for the hardware annotation fields that we use */ +#define dpaa2_get_hwa(buf_addr) \ + ((void *)(buf_addr) + DPAA2_ETH_SWA_SIZE) +#define dpaa2_get_fas(buf_addr) \ + (struct dpaa2_fas *)(dpaa2_get_hwa(buf_addr) + DPAA2_FAS_OFFSET) + /* Error and status bits in the frame annotation status word */ /* Debug frame, otherwise supposed to be discarded */ #define DPAA2_FAS_DISC 0x80000000 -- cgit v1.2.3-55-g7522 From 50eacbc8877e725314f140aec091e96c2536d17a Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:36 -0500 Subject: staging: fsl-dpaa2/eth: Remove unused fields from priv struct Remove the dpni_id and buffer_layout fields from device's private structure. They're only used at probe so we don't need to store them for further use. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 33 +++++++++++++------------- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 5 ---- 2 files changed, 16 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index d81c56f4d859..ee71e158b0a9 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1734,15 +1734,14 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) struct device *dev = &ls_dev->dev; struct dpaa2_eth_priv *priv; struct net_device *net_dev; + struct dpni_buffer_layout buf_layout = {0}; int err; net_dev = dev_get_drvdata(dev); priv = netdev_priv(net_dev); - priv->dpni_id = ls_dev->obj_desc.id; - /* get a handle for the DPNI object */ - err = dpni_open(priv->mc_io, 0, priv->dpni_id, &priv->mc_token); + err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, &priv->mc_token); if (err) { dev_err(dev, "dpni_open() failed\n"); goto err_open; @@ -1766,35 +1765,35 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) /* Configure buffer layouts */ /* rx buffer */ - priv->buf_layout.pass_parser_result = true; - priv->buf_layout.pass_frame_status = true; - priv->buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE; - priv->buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN; - priv->buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | - DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | - DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE | - DPNI_BUF_LAYOUT_OPT_DATA_ALIGN; + buf_layout.pass_parser_result = true; + buf_layout.pass_frame_status = true; + buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE; + buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN; + buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | + DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | + DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE | + DPNI_BUF_LAYOUT_OPT_DATA_ALIGN; err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token, - DPNI_QUEUE_RX, &priv->buf_layout); + DPNI_QUEUE_RX, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(RX) failed\n"); goto err_buf_layout; } /* tx buffer */ - priv->buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | - DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE; + buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | + DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE; err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token, - DPNI_QUEUE_TX, &priv->buf_layout); + DPNI_QUEUE_TX, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(TX) failed\n"); goto err_buf_layout; } /* tx-confirm buffer */ - priv->buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS; + buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS; err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token, - DPNI_QUEUE_TX_CONFIRM, &priv->buf_layout); + DPNI_QUEUE_TX_CONFIRM, &buf_layout); if (err) { dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n"); goto err_buf_layout; diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 6462e2cbe4be..6697b508cf23 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -297,12 +297,7 @@ struct dpaa2_eth_priv { u8 num_channels; struct dpaa2_eth_channel *channel[DPAA2_ETH_MAX_DPCONS]; - int dpni_id; struct dpni_attr dpni_attrs; - /* Insofar as the MC is concerned, we're using one layout on all 3 types - * of buffers (Rx, Tx, Tx-Conf). - */ - struct dpni_buffer_layout buf_layout; u16 tx_data_offset; struct fsl_mc_device *dpbp_dev; -- cgit v1.2.3-55-g7522 From 05fa39c6b93fd859cd768a48a1d9615edcff0a94 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:37 -0500 Subject: staging: fsl-dpaa2/eth: Only store bpid in priv struct We only need to know the buffer pool id, so save exactly that in the device's private structure, instead of the entire DPBP attributes struct. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 12 +++++++----- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index ee71e158b0a9..26f209c78ff9 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -798,7 +798,7 @@ static void drain_bufs(struct dpaa2_eth_priv *priv, int count) int ret, i; do { - ret = dpaa2_io_service_acquire(NULL, priv->dpbp_attrs.bpid, + ret = dpaa2_io_service_acquire(NULL, priv->bpid, buf_array, count); if (ret < 0) { netdev_err(priv->net_dev, "dpaa2_io_service_acquire() failed\n"); @@ -895,7 +895,7 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget) break; /* Refill pool if appropriate */ - refill_pool(priv, ch, priv->dpbp_attrs.bpid); + refill_pool(priv, ch, priv->bpid); store_cleaned = consume_frames(ch); cleaned += store_cleaned; @@ -980,14 +980,14 @@ static int dpaa2_eth_open(struct net_device *net_dev) struct dpaa2_eth_priv *priv = netdev_priv(net_dev); int err; - err = seed_pool(priv, priv->dpbp_attrs.bpid); + err = seed_pool(priv, priv->bpid); if (err) { /* Not much to do; the buffer pool, though not filled up, * may still contain some buffers which would enable us * to limp on. */ netdev_err(net_dev, "Buffer seeding failed for DPBP %d (bpid=%d)\n", - priv->dpbp_dev->obj_desc.id, priv->dpbp_attrs.bpid); + priv->dpbp_dev->obj_desc.id, priv->bpid); } /* We'll only start the txqs when the link is actually ready; make sure @@ -1671,6 +1671,7 @@ static int setup_dpbp(struct dpaa2_eth_priv *priv) int err; struct fsl_mc_device *dpbp_dev; struct device *dev = priv->net_dev->dev.parent; + struct dpbp_attr dpbp_attrs; err = fsl_mc_object_allocate(to_fsl_mc_device(dev), FSL_MC_POOL_DPBP, &dpbp_dev); @@ -1701,11 +1702,12 @@ static int setup_dpbp(struct dpaa2_eth_priv *priv) } err = dpbp_get_attributes(priv->mc_io, 0, dpbp_dev->mc_handle, - &priv->dpbp_attrs); + &dpbp_attrs); if (err) { dev_err(dev, "dpbp_get_attributes() failed\n"); goto err_get_attr; } + priv->bpid = dpbp_attrs.bpid; return 0; diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 6697b508cf23..886a0681fee1 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -301,7 +301,7 @@ struct dpaa2_eth_priv { u16 tx_data_offset; struct fsl_mc_device *dpbp_dev; - struct dpbp_attr dpbp_attrs; + u16 bpid; struct iommu_domain *iommu_domain; u16 tx_qdid; -- cgit v1.2.3-55-g7522 From 39163c0ce0f48557d0672fa2dd4cd7625e2cbaf7 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:39 -0500 Subject: staging: fsl-dpaa2/eth: Errors checking update On the egress path, frame errors are reported using both a FD control field and the frame annotation status. The current code only handles FAS errors. Update to look at both fields when accounting Tx errors. Signed-off-by: Bogdan Purcareata Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 36 ++++++++++++++++++++------ drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 17 ++++++++++-- 2 files changed, 43 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 26f209c78ff9..f7f6bede7be3 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -534,7 +534,7 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, * buffer but before we free it. The caller function is responsible * for checking the status value. */ - if (status && (dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) + if (status) *status = le32_to_cpu(fas->status); /* Free SGT buffer kmalloc'ed on tx */ @@ -638,6 +638,8 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv, struct rtnl_link_stats64 *percpu_stats; struct dpaa2_eth_drv_stats *percpu_extras; u32 status = 0; + u32 fd_errors; + bool has_fas_errors = false; /* Tracing point */ trace_dpaa2_tx_conf_fd(priv->net_dev, fd); @@ -646,13 +648,31 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv, percpu_extras->tx_conf_frames++; percpu_extras->tx_conf_bytes += dpaa2_fd_get_len(fd); - free_tx_fd(priv, fd, &status); - - if (unlikely(status & DPAA2_ETH_TXCONF_ERR_MASK)) { - percpu_stats = this_cpu_ptr(priv->percpu_stats); - /* Tx-conf logically pertains to the egress path. */ - percpu_stats->tx_errors++; + /* Check frame errors in the FD field */ + fd_errors = dpaa2_fd_get_ctrl(fd) & DPAA2_FD_TX_ERR_MASK; + if (unlikely(fd_errors)) { + /* We only check error bits in the FAS field if corresponding + * FAERR bit is set in FD and the FAS field is marked as valid + */ + has_fas_errors = (fd_errors & DPAA2_FD_CTRL_FAERR) && + !!(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV); + if (net_ratelimit()) + netdev_dbg(priv->net_dev, "TX frame FD error: %x08\n", + fd_errors); } + + free_tx_fd(priv, fd, has_fas_errors ? &status : NULL); + + if (likely(!fd_errors)) + return; + + percpu_stats = this_cpu_ptr(priv->percpu_stats); + /* Tx-conf logically pertains to the egress path. */ + percpu_stats->tx_errors++; + + if (has_fas_errors && net_ratelimit()) + netdev_dbg(priv->net_dev, "TX frame FAS error: %x08\n", + status & DPAA2_FAS_TX_ERR_MASK); } static int set_rx_csum(struct dpaa2_eth_priv *priv, bool enable) @@ -2069,7 +2089,7 @@ static int bind_dpni(struct dpaa2_eth_priv *priv) netdev_err(net_dev, "Failed to configure hashing\n"); /* Configure handling of error frames */ - err_cfg.errors = DPAA2_ETH_RX_ERR_MASK; + err_cfg.errors = DPAA2_FAS_RX_ERR_MASK; err_cfg.set_frame_annotation = 1; err_cfg.error_action = DPNI_ERROR_ACTION_DISCARD; err = dpni_set_errors_behavior(priv->mc_io, 0, priv->mc_token, diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 886a0681fee1..e6d28a249fc1 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -120,6 +120,19 @@ struct dpaa2_eth_swa { #define DPAA2_FD_FRC_FASWOV 0x0800 #define DPAA2_FD_FRC_FAICFDV 0x0400 +/* Error bits in FD CTRL */ +#define DPAA2_FD_CTRL_UFD 0x00000004 +#define DPAA2_FD_CTRL_SBE 0x00000008 +#define DPAA2_FD_CTRL_FSE 0x00000010 +#define DPAA2_FD_CTRL_FAERR 0x00000020 + +#define DPAA2_FD_RX_ERR_MASK (DPAA2_FD_CTRL_SBE | \ + DPAA2_FD_CTRL_FAERR) +#define DPAA2_FD_TX_ERR_MASK (DPAA2_FD_CTRL_UFD | \ + DPAA2_FD_CTRL_SBE | \ + DPAA2_FD_CTRL_FSE | \ + DPAA2_FD_CTRL_FAERR) + /* Annotation bits in FD CTRL */ #define DPAA2_FD_CTRL_ASAL 0x00020000 /* ASAL = 128 */ #define DPAA2_FD_CTRL_PTA 0x00800000 @@ -177,7 +190,7 @@ struct dpaa2_fas { /* L4 csum error */ #define DPAA2_FAS_L4CE 0x00000001 /* Possible errors on the ingress path */ -#define DPAA2_ETH_RX_ERR_MASK (DPAA2_FAS_KSE | \ +#define DPAA2_FAS_RX_ERR_MASK (DPAA2_FAS_KSE | \ DPAA2_FAS_EOFHE | \ DPAA2_FAS_MNLE | \ DPAA2_FAS_TIDE | \ @@ -191,7 +204,7 @@ struct dpaa2_fas { DPAA2_FAS_L3CE | \ DPAA2_FAS_L4CE) /* Tx errors */ -#define DPAA2_ETH_TXCONF_ERR_MASK (DPAA2_FAS_KSE | \ +#define DPAA2_FAS_TX_ERR_MASK (DPAA2_FAS_KSE | \ DPAA2_FAS_EOFHE | \ DPAA2_FAS_MNLE | \ DPAA2_FAS_TIDE) -- cgit v1.2.3-55-g7522 From 6ab00868464fb1acaed7276b47d92c64c4d8623f Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:40 -0500 Subject: staging: fsl-dpaa2/eth: Refactor MAC address setup The driver logic for allocating a MAC address to a net device is complicated enough to deserve a function of its own. While here, cleanup a bit the code comments. Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 46 ++++++++++++++++---------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index f7f6bede7be3..e674a01ce09d 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -2162,15 +2162,12 @@ static void free_rings(struct dpaa2_eth_priv *priv) dpaa2_io_store_destroy(priv->channel[i]->store); } -static int netdev_init(struct net_device *net_dev) +static int set_mac_addr(struct dpaa2_eth_priv *priv) { - int err; + struct net_device *net_dev = priv->net_dev; struct device *dev = net_dev->dev.parent; - struct dpaa2_eth_priv *priv = netdev_priv(net_dev); u8 mac_addr[ETH_ALEN], dpni_mac_addr[ETH_ALEN]; - u8 bcast_addr[ETH_ALEN]; - - net_dev->netdev_ops = &dpaa2_eth_ops; + int err; /* Get firmware address, if any */ err = dpni_get_port_mac_addr(priv->mc_io, 0, priv->mc_token, mac_addr); @@ -2183,7 +2180,7 @@ static int netdev_init(struct net_device *net_dev) err = dpni_get_primary_mac_addr(priv->mc_io, 0, priv->mc_token, dpni_mac_addr); if (err) { - dev_err(dev, "dpni_get_primary_mac_addr() failed (%d)\n", err); + dev_err(dev, "dpni_get_primary_mac_addr() failed\n"); return err; } @@ -2201,18 +2198,19 @@ static int netdev_init(struct net_device *net_dev) } memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len); } else if (is_zero_ether_addr(dpni_mac_addr)) { - /* Fills in net_dev->dev_addr, as required by - * register_netdevice() + /* No MAC address configured, fill in net_dev->dev_addr + * with a random one */ eth_hw_addr_random(net_dev); - /* Make the user aware, without cluttering the boot log */ - dev_dbg_once(dev, " device(s) have all-zero hwaddr, replaced with random\n"); + dev_dbg_once(dev, "device(s) have all-zero hwaddr, replaced with random\n"); + err = dpni_set_primary_mac_addr(priv->mc_io, 0, priv->mc_token, net_dev->dev_addr); if (err) { - dev_err(dev, "dpni_set_primary_mac_addr(): %d\n", err); + dev_err(dev, "dpni_set_primary_mac_addr() failed\n"); return err; } + /* Override NET_ADDR_RANDOM set by eth_hw_addr_random(); for all * practical purposes, this will be our "permanent" mac address, * at least until the next reboot. This move will also permit @@ -2226,14 +2224,28 @@ static int netdev_init(struct net_device *net_dev) memcpy(net_dev->dev_addr, dpni_mac_addr, net_dev->addr_len); } - /* Explicitly add the broadcast address to the MAC filtering table; - * the MC won't do that for us. - */ + return 0; +} + +static int netdev_init(struct net_device *net_dev) +{ + struct device *dev = net_dev->dev.parent; + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); + u8 bcast_addr[ETH_ALEN]; + int err; + + net_dev->netdev_ops = &dpaa2_eth_ops; + + err = set_mac_addr(priv); + if (err) + return err; + + /* Explicitly add the broadcast address to the MAC filtering table */ eth_broadcast_addr(bcast_addr); err = dpni_add_mac_addr(priv->mc_io, 0, priv->mc_token, bcast_addr); if (err) { - dev_warn(dev, "dpni_add_mac_addr() failed (%d)\n", err); - /* Won't return an error; at least, we'd have egress traffic */ + dev_err(dev, "dpni_add_mac_addr() failed\n"); + return err; } /* Reserve enough space to align buffer as per hardware requirement; -- cgit v1.2.3-55-g7522 From bb5b42c0d8d2352a266b19abb29db7c566a4a707 Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Tue, 6 Jun 2017 10:00:41 -0500 Subject: staging: fsl-dpaa2/eth: Update number of netdev queues Currently, the netdevice is allocated with a default number of Rx/Tx queues equal to CONFIG_NR_CPUS, meaning the maximum number of cores supported by the current kernel. The actual number of queues is reflected by the DPNI object attribute, so update the netdevice configuration based on that. Signed-off-by: Bogdan Purcareata Signed-off-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index e674a01ce09d..1f89274a03d3 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -2232,6 +2232,7 @@ static int netdev_init(struct net_device *net_dev) struct device *dev = net_dev->dev.parent; struct dpaa2_eth_priv *priv = netdev_priv(net_dev); u8 bcast_addr[ETH_ALEN]; + u8 num_queues; int err; net_dev->netdev_ops = &dpaa2_eth_ops; @@ -2257,6 +2258,19 @@ static int netdev_init(struct net_device *net_dev) net_dev->min_mtu = 68; net_dev->max_mtu = DPAA2_ETH_MAX_MTU; + /* Set actual number of queues in the net device */ + num_queues = dpaa2_eth_queue_count(priv); + err = netif_set_real_num_tx_queues(net_dev, num_queues); + if (err) { + dev_err(dev, "netif_set_real_num_tx_queues() failed\n"); + return err; + } + err = netif_set_real_num_rx_queues(net_dev, num_queues); + if (err) { + dev_err(dev, "netif_set_real_num_rx_queues() failed\n"); + return err; + } + /* Our .ndo_init will be called herein */ err = register_netdev(net_dev); if (err < 0) { -- cgit v1.2.3-55-g7522 From f6e8716a3acb7e9e8396450b359ce04f128e0e79 Mon Sep 17 00:00:00 2001 From: Perry Hooker Date: Thu, 8 Jun 2017 23:06:54 -0600 Subject: staging: ks7010: use little-endian types This patch fixes a number of sparse warnings of the form: drivers/staging/ks7010/ks_hostif.c:2187:29: warning: incorrect type in assignment (different base types) generated when storing little-endian data in variables that do not have a specified endianness. Signed-off-by: Perry Hooker Reviewed-By: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 697347bb8760..db01a486a5a4 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1821,7 +1821,7 @@ void hostif_receive(struct ks_wlan_private *priv, unsigned char *p, static void hostif_sme_set_wep(struct ks_wlan_private *priv, int type) { - u32 val; + __le32 val; switch (type) { case SME_WEP_INDEX_REQUEST: @@ -1870,13 +1870,13 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, int type) } struct wpa_suite_t { - unsigned short size; + __le16 size; unsigned char suite[4][CIPHER_ID_LEN]; } __packed; struct rsn_mode_t { - u32 rsn_mode; - u16 rsn_capability; + __le32 rsn_mode; + __le16 rsn_capability; } __packed; static @@ -1884,7 +1884,7 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type) { struct wpa_suite_t wpa_suite; struct rsn_mode_t rsn_mode; - u32 val; + __le32 val; memset(&wpa_suite, 0, sizeof(wpa_suite)); @@ -1936,7 +1936,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type) hostif_mib_set_request(priv, DOT11_RSN_CONFIG_UNICAST_CIPHER, sizeof(wpa_suite.size) + - CIPHER_ID_LEN * wpa_suite.size, + CIPHER_ID_LEN * + le16_to_cpu(wpa_suite.size), MIB_VALUE_TYPE_OSTRING, &wpa_suite); break; case SME_RSN_MCAST_REQUEST: @@ -2028,7 +2029,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type) hostif_mib_set_request(priv, DOT11_RSN_CONFIG_AUTH_SUITE, sizeof(wpa_suite.size) + - KEY_MGMT_ID_LEN * wpa_suite.size, + KEY_MGMT_ID_LEN * + le16_to_cpu(wpa_suite.size), MIB_VALUE_TYPE_OSTRING, &wpa_suite); break; case SME_RSN_ENABLED_REQUEST: @@ -2165,7 +2167,7 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv) int mc_count; struct netdev_hw_addr *ha; char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN]; - unsigned long filter_type; + __le32 filter_type; int i = 0; DPRINTK(3, "\n"); @@ -2276,7 +2278,7 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv) static void hostif_sme_set_key(struct ks_wlan_private *priv, int type) { - u32 val; + __le32 val; switch (type) { case SME_SET_FLAG: @@ -2335,7 +2337,7 @@ static void hostif_sme_set_pmksa(struct ks_wlan_private *priv) { struct pmk_cache_t { - u16 size; + __le16 size; struct { u8 bssid[ETH_ALEN]; u8 pmkid[IW_PMKID_LEN]; @@ -2366,7 +2368,7 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv) static void hostif_sme_execute(struct ks_wlan_private *priv, int event) { - u32 val; + __le32 val; DPRINTK(3, "event=%d\n", event); switch (event) { -- cgit v1.2.3-55-g7522 From bbe6fb5b96bd2d4c39d3ed26cad8bc4242688320 Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Wed, 7 Jun 2017 15:00:06 +0100 Subject: staging: speakup: migrate bns to tty Migration of bns was missed out in the patch https://patchwork.kernel.org/patch/9727725/. This patch does it by updating relevant function pointers, just like in the patch linked above. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/speakup_bns.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/speakup_bns.c b/drivers/staging/speakup/speakup_bns.c index a972a5147c6b..474c12770ff6 100644 --- a/drivers/staging/speakup/speakup_bns.c +++ b/drivers/staging/speakup/speakup_bns.c @@ -96,10 +96,10 @@ static struct spk_synth synth_bns = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, -- cgit v1.2.3-55-g7522 From 38d0353c6e5134e1a1e06a72909aab0e6187e5cc Mon Sep 17 00:00:00 2001 From: Amisha Singh Date: Thu, 8 Jun 2017 00:01:55 +0530 Subject: Staging: comedi: ni_labpc_regs: fixed a block comment alignment issue Fixed a coding style issue. Signed-off-by: Amisha Singh Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_labpc_regs.h b/drivers/staging/comedi/drivers/ni_labpc_regs.h index 8c52179e36fc..6003e9d5fe37 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_regs.h +++ b/drivers/staging/comedi/drivers/ni_labpc_regs.h @@ -1,6 +1,6 @@ /* * ni_labpc register definitions. -*/ + */ #ifndef _NI_LABPC_REGS_H #define _NI_LABPC_REGS_H -- cgit v1.2.3-55-g7522 From 46949b48568b175be23a844f6e7703f4b4f2dd14 Mon Sep 17 00:00:00 2001 From: Aditya Shankar Date: Thu, 8 Jun 2017 10:37:23 +0530 Subject: staging: wilc1000: New cfg packet format in handle_set_wfi_drv_handler Change the config packet format used in handle_set_wfi_drv_handler() to align the host driver with the new format used in the wilc firmware. The change updates the format in which the host driver provides the firmware with the drv_handler index and also uses two new fields viz. "mode" and 'name" in the config packet along with this index to directly provide details about the interface and its mode to the firmware instead of having multiple if-else statements in the host driver to decide which interface to configure. This change requires users to move to the newer version of the wilc firmware(14.02 or higher) available on the vendor tree on github or on the linux-firmware project. The existing firmware files on the linux-firmware project are very old and best not used. Signed-off-by: Aditya Shankar Reviewed-by: Arend Van Spriel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 68 +++++++++++++++++------ drivers/staging/wilc1000/host_interface.h | 9 ++- drivers/staging/wilc1000/linux_wlan.c | 37 ++++-------- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan_if.h | 2 +- 6 files changed, 71 insertions(+), 48 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c8e3229a2809..f7c22d7b28d1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -329,25 +329,53 @@ static void handle_set_channel(struct wilc_vif *vif, netdev_err(vif->ndev, "Failed to set channel\n"); } -static void handle_set_wfi_drv_handler(struct wilc_vif *vif, - struct drv_handler *hif_drv_handler) +static int handle_set_wfi_drv_handler(struct wilc_vif *vif, + struct drv_handler *hif_drv_handler) { int ret = 0; struct wid wid; + u8 *currbyte, *buffer; + struct host_if_drv *hif_drv = NULL; + + if (!vif->hif_drv) + return -EINVAL; + + if (!hif_drv_handler) + return -EINVAL; + + hif_drv = vif->hif_drv; + + buffer = kzalloc(DRV_HANDLER_SIZE, GFP_KERNEL); + if (!buffer) + return -ENOMEM; + + currbyte = buffer; + *currbyte = hif_drv->driver_handler_id & DRV_HANDLER_MASK; + currbyte++; + *currbyte = (u32)0 & DRV_HANDLER_MASK; + currbyte++; + *currbyte = (u32)0 & DRV_HANDLER_MASK; + currbyte++; + *currbyte = (u32)0 & DRV_HANDLER_MASK; + currbyte++; + *currbyte = (hif_drv_handler->name | (hif_drv_handler->mode << 1)); wid.id = (u16)WID_SET_DRV_HANDLER; wid.type = WID_STR; - wid.val = (s8 *)hif_drv_handler; - wid.size = sizeof(*hif_drv_handler); + wid.val = (s8 *)buffer; + wid.size = DRV_HANDLER_SIZE; ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1, - hif_drv_handler->handler); - - if (!hif_drv_handler->handler) - complete(&hif_driver_comp); - - if (ret) + hif_drv->driver_handler_id); + if (ret) { netdev_err(vif->ndev, "Failed to set driver handler\n"); + complete(&hif_driver_comp); + kfree(buffer); + return ret; + } + complete(&hif_driver_comp); + kfree(buffer); + return 0; } static void handle_set_operation_mode(struct wilc_vif *vif, @@ -2389,9 +2417,9 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif, pu8CurrByte = wid.val; *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); - *pu8CurrByte++ = 0; - *pu8CurrByte++ = 0; - *pu8CurrByte++ = 0; + *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); + *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); + *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF); @@ -2449,6 +2477,7 @@ static void host_if_work(struct work_struct *work) { struct host_if_msg *msg; struct wilc *wilc; + int ret = 0; msg = container_of(work, struct host_if_msg, work); wilc = msg->vif->wilc; @@ -2554,7 +2583,7 @@ static void host_if_work(struct work_struct *work) break; case HOST_IF_MSG_SET_WFIDRV_HANDLER: - handle_set_wfi_drv_handler(msg->vif, &msg->body.drv); + ret = handle_set_wfi_drv_handler(msg->vif, &msg->body.drv); break; case HOST_IF_MSG_SET_OPERATION_MODE: @@ -2608,6 +2637,8 @@ static void host_if_work(struct work_struct *work) break; } free_msg: + if (ret) + netdev_err(msg->vif->ndev, "Host cmd %d failed\n", msg->id); kfree(msg); complete(&hif_thread_comp); } @@ -3085,7 +3116,8 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel) return 0; } -int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx) +int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, + u8 ifc_id) { int result = 0; struct host_if_msg msg; @@ -3093,7 +3125,8 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; msg.body.drv.handler = index; - msg.body.drv.mac_idx = mac_idx; + msg.body.drv.mode = mode; + msg.body.drv.name = ifc_id; msg.vif = vif; result = wilc_enqueue_cmd(&msg); @@ -3316,6 +3349,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) for (i = 0; i < wilc->vif_num; i++) if (dev == wilc->vif[i]->ndev) { wilc->vif[i]->hif_drv = hif_drv; + hif_drv->driver_handler_id = i + 1; break; } @@ -3389,7 +3423,7 @@ int wilc_deinit(struct wilc_vif *vif) del_timer_sync(&periodic_rssi); del_timer_sync(&hif_drv->remain_on_ch_timer); - wilc_set_wfi_drv_handler(vif, 0, 0); + wilc_set_wfi_drv_handler(vif, 0, 0, 0); wait_for_completion(&hif_driver_comp); 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 0e72b9193734..1ce5ead318c7 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -50,6 +50,8 @@ #define WILC_ADD_STA_LENGTH 40 #define SCAN_EVENT_DONE_ABORTED #define NUM_CONCURRENT_IFC 2 +#define DRV_HANDLER_SIZE 5 +#define DRV_HANDLER_MASK 0x000000FF struct rf_info { u8 link_speed; @@ -216,7 +218,8 @@ struct user_conn_req { struct drv_handler { u32 handler; - u8 mac_idx; + u8 mode; + u8 name; }; struct op_mode { @@ -280,6 +283,7 @@ struct host_if_drv { struct timer_list remain_on_ch_timer; bool IFC_UP; + int driver_handler_id; }; struct add_sta_param { @@ -348,7 +352,8 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, void *user_arg); int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id); int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); -int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx); +int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, + u8 ifc_id); int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats); void wilc_resolve_disconnect_aberration(struct wilc_vif *vif); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d6d803416be2..308708450830 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -858,34 +858,15 @@ static int wilc_mac_open(struct net_device *ndev) for (i = 0; i < wl->vif_num; i++) { if (ndev == wl->vif[i]->ndev) { - if (vif->iftype == AP_MODE) { - wilc_set_wfi_drv_handler(vif, - wilc_get_vif_idx(vif), - 0); - } else if (!wilc_wlan_get_num_conn_ifcs(wl)) { - wilc_set_wfi_drv_handler(vif, - wilc_get_vif_idx(vif), - wl->open_ifcs); - } else { - if (memcmp(wl->vif[i ^ 1]->bssid, - wl->vif[i ^ 1]->src_addr, 6)) - wilc_set_wfi_drv_handler(vif, - wilc_get_vif_idx(vif), - 0); - else - wilc_set_wfi_drv_handler(vif, - wilc_get_vif_idx(vif), - 1); - } + wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), + vif->iftype, vif->ifc_id); wilc_set_operation_mode(vif, vif->iftype); - - wilc_get_mac_address(vif, mac_add); - netdev_dbg(ndev, "Mac address: %pM\n", mac_add); - memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN); - break; } } + wilc_get_mac_address(vif, mac_add); + netdev_dbg(ndev, "Mac address: %pM\n", mac_add); + memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN); memcpy(ndev->dev_addr, wl->vif[i]->src_addr, ETH_ALEN); @@ -1246,11 +1227,13 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, vif = netdev_priv(ndev); memset(vif, 0, sizeof(struct wilc_vif)); - if (i == 0) + if (i == 0) { strcpy(ndev->name, "wlan%d"); - else + vif->ifc_id = 1; + } else { strcpy(ndev->name, "p2p%d"); - + vif->ifc_id = 0; + } vif->wilc = *wilc; vif->ndev = ndev; wl->vif[i] = vif; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index cae9c8ff80d8..68fd5b3b8b2d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1874,7 +1874,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), - 0); + 0, vif->ifc_id); wilc_set_operation_mode(vif, AP_MODE); wilc_set_power_mgmt(vif, 0, 0); } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index d431673bc46c..c89bf4301096 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -158,6 +158,7 @@ struct wilc_vif { struct host_if_drv *hif_drv; struct net_device *ndev; u8 mode; + u8 ifc_id; }; struct wilc { diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 439ac6f8d533..f4d60057a06e 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -845,7 +845,7 @@ typedef enum { WID_MODEL_NAME = 0x3027, /*Added for CAPI tool */ WID_MODEL_NUM = 0x3028, /*Added for CAPI tool */ WID_DEVICE_NAME = 0x3029, /*Added for CAPI tool */ - WID_SET_DRV_HANDLER = 0x3030, + WID_SET_DRV_HANDLER = 0x3079, /* NMAC String WID list */ WID_11N_P_ACTION_REQ = 0x3080, -- cgit v1.2.3-55-g7522 From 72f3415f812c12b8dfb05996514d1248c213250c Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 8 Jun 2017 17:28:46 +0300 Subject: staging: fsl-mc: enclose macro params in parens Several macros didn't had macro params enclosed in parens. Fix them to avoid precedence issues. Found with checkpatch.pl who was issuing this message: "Macro argument 'id' may be better as '(id)' to avoid precedence issues" Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dpbp-cmd.h | 2 +- drivers/staging/fsl-mc/bus/dpmcp-cmd.h | 2 +- drivers/staging/fsl-mc/bus/dpmng-cmd.h | 2 +- drivers/staging/fsl-mc/bus/dprc-cmd.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h b/drivers/staging/fsl-mc/bus/dpbp-cmd.h index 8aa65452c872..5904836fd741 100644 --- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h +++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h @@ -40,7 +40,7 @@ #define DPBP_CMD_BASE_VERSION 1 #define DPBP_CMD_ID_OFFSET 4 -#define DPBP_CMD(id) ((id << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION) +#define DPBP_CMD(id) (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION) /* Command IDs */ #define DPBP_CMDID_CLOSE DPBP_CMD(0x800) diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h index 384a13d0b07f..861b2a708af8 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h +++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h @@ -40,7 +40,7 @@ #define DPMCP_CMD_BASE_VERSION 1 #define DPMCP_CMD_ID_OFFSET 4 -#define DPMCP_CMD(id) ((id << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION) +#define DPMCP_CMD(id) (((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION) /* Command IDs */ #define DPMCP_CMDID_CLOSE DPMCP_CMD(0x800) diff --git a/drivers/staging/fsl-mc/bus/dpmng-cmd.h b/drivers/staging/fsl-mc/bus/dpmng-cmd.h index cdddfb80eecc..d1f04ac18b78 100644 --- a/drivers/staging/fsl-mc/bus/dpmng-cmd.h +++ b/drivers/staging/fsl-mc/bus/dpmng-cmd.h @@ -44,7 +44,7 @@ #define DPMNG_CMD_BASE_VERSION 1 #define DPMNG_CMD_ID_OFFSET 4 -#define DPMNG_CMD(id) ((id << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION) +#define DPMNG_CMD(id) (((id) << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION) /* Command IDs */ #define DPMNG_CMDID_GET_VERSION DPMNG_CMD(0x831) diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h b/drivers/staging/fsl-mc/bus/dprc-cmd.h index e9fdca41f324..d9b2dcde468e 100644 --- a/drivers/staging/fsl-mc/bus/dprc-cmd.h +++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h @@ -48,7 +48,7 @@ #define DPRC_CMD_BASE_VERSION 1 #define DPRC_CMD_ID_OFFSET 4 -#define DPRC_CMD(id) ((id << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION) +#define DPRC_CMD(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION) /* Command IDs */ #define DPRC_CMDID_CLOSE DPRC_CMD(0x800) -- cgit v1.2.3-55-g7522 From a042fbed02904493ae6df26ec836045f5a7d3ce2 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 8 Jun 2017 17:28:48 +0300 Subject: staging: fsl-mc: simplify couple of deallocations Simplify a couple of deallocations code paths. This also fixes these checkpatch.pl false positives: "WARNING: kfree(NULL) is safe and this check is probably not required" Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 50eb41588a65..7b48ade1ca9c 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -420,15 +420,11 @@ bool fsl_mc_is_root_dprc(struct device *dev) static void fsl_mc_device_release(struct device *dev) { struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); - struct fsl_mc_bus *mc_bus = NULL; kfree(mc_dev->regions); if (strcmp(mc_dev->obj_desc.type, "dprc") == 0) - mc_bus = to_fsl_mc_bus(mc_dev); - - if (mc_bus) - kfree(mc_bus); + kfree(to_fsl_mc_bus(mc_dev)); else kfree(mc_dev); } @@ -559,10 +555,8 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, error_cleanup_dev: kfree(mc_dev->regions); - if (mc_bus) - kfree(mc_bus); - else - kfree(mc_dev); + kfree(mc_bus); + kfree(mc_dev); return error; } -- cgit v1.2.3-55-g7522 From 450638617374ceca5db09d0d9c4e66116579d363 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 8 Jun 2017 17:28:49 +0300 Subject: staging: fsl-mc: drop a few useless #includes Some #includes were needlessly done from header files. Drop them from there and update the only .c file that implicitly needed one of those #includes. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 1 + drivers/staging/fsl-mc/bus/fsl-mc-private.h | 1 - drivers/staging/fsl-mc/include/dprc.h | 2 -- 3 files changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index b8b2c86e63d4..a92fa5a3ff42 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -17,6 +17,7 @@ #include #include #include "../include/mc-bus.h" +#include "../include/mc-cmd.h" #include "fsl-mc-private.h" /* diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index 5c49c9d2df6a..01ef932905de 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -11,7 +11,6 @@ #define _FSL_MC_PRIVATE_H_ #include "../include/mc.h" -#include "../include/mc-bus.h" int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h index dc985cc1246f..8498a5e529f1 100644 --- a/drivers/staging/fsl-mc/include/dprc.h +++ b/drivers/staging/fsl-mc/include/dprc.h @@ -33,8 +33,6 @@ #ifndef _FSL_DPRC_H #define _FSL_DPRC_H -#include "mc-cmd.h" - /* * Data Path Resource Container API * Contains DPRC API for managing and querying DPAA resources -- cgit v1.2.3-55-g7522 From 6e0556cc93df9c74960162ac00176841fd2d6461 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 8 Jun 2017 17:28:50 +0300 Subject: staging: fsl-mc: remove extra blank line Remove extra blank line reported by checkpatch.pl. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/dprc.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h index 8498a5e529f1..2f4a7a75a572 100644 --- a/drivers/staging/fsl-mc/include/dprc.h +++ b/drivers/staging/fsl-mc/include/dprc.h @@ -49,7 +49,6 @@ int dprc_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token); - /* IRQ */ /* IRQ index */ -- cgit v1.2.3-55-g7522 From b5d5740a00ca26549b695d3c957bb14879a20952 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 8 Jun 2017 17:28:51 +0300 Subject: staging: fsl-mc: drop unused forward declaration This forward declaration of "struct fsl_mc_resource" is of no use so drop it. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-sys.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-sys.h b/drivers/staging/fsl-mc/include/mc-sys.h index dca7f9084e05..b5203707344a 100644 --- a/drivers/staging/fsl-mc/include/mc-sys.h +++ b/drivers/staging/fsl-mc/include/mc-sys.h @@ -46,7 +46,6 @@ */ #define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001 -struct fsl_mc_resource; struct mc_command; /** -- cgit v1.2.3-55-g7522 From 49df58e927c64bfeb901408df09e82646f059385 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 8 Jun 2017 17:28:53 +0300 Subject: staging: fsl-mc: drop reference to restool Drop reference to user space restool utility from the README. It will be added back together with the actual support in the bus driver. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/README.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/README.txt b/drivers/staging/fsl-mc/README.txt index 179536a9b7a1..d7cd70a33073 100644 --- a/drivers/staging/fsl-mc/README.txt +++ b/drivers/staging/fsl-mc/README.txt @@ -131,9 +131,7 @@ in creating a network interfaces. DPRCs can be defined statically and populated with objects via a config file passed to the MC when firmware starts - it. There is also a Linux user space tool called "restool" - that can be used to create/destroy containers and objects - dynamically. + it. -DPAA2 Objects for an Ethernet Network Interface -- cgit v1.2.3-55-g7522 From 5ebf8d2d874ced5a41d546d1a32f290b880cf96d Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 8 Jun 2017 17:28:54 +0300 Subject: staging: fsl-mc: add reference to mc-bus DT binding Update README to reference the mc-bus device tree node binding. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/README.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/README.txt b/drivers/staging/fsl-mc/README.txt index d7cd70a33073..524eda1de04f 100644 --- a/drivers/staging/fsl-mc/README.txt +++ b/drivers/staging/fsl-mc/README.txt @@ -320,6 +320,8 @@ A brief description of each driver is provided below. -creates an MSI IRQ domain -doing a 'device add' to expose the 'root' DPRC, in turn triggering a bind of the root DPRC to the DPRC driver + The binding for the MC-bus device-tree node can be consulted here: + Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt DPRC driver ----------- -- cgit v1.2.3-55-g7522 From 650b175d635d25c771eab2e8ff8a11584bb3273a Mon Sep 17 00:00:00 2001 From: Alexandre Ghiti Date: Fri, 9 Jun 2017 14:14:32 +0200 Subject: staging: speakup: Add missing blank line after declaration This patch fixes checkpatch warnings about adding a blank line after variable declaration. Signed-off-by: Alexandre Ghiti Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/main.c | 2 ++ drivers/staging/speakup/spk_ttyio.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index d2ad596850f3..82e5de248947 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -1945,6 +1945,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) goto oops; if (ch == 8) { u16 wch; + if (num == 0) return -1; wch = goto_buf[--num]; @@ -2287,6 +2288,7 @@ static int vt_notifier_call(struct notifier_block *nb, speakup_bs(vc); } else { u16 d = param->c; + speakup_con_write(vc, &d, 1); } break; diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index d55c056bbefe..4e346697e53d 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -50,6 +50,7 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty, if (spk_ttyio_synth->read_buff_add) { int i; + for (i = 0; i < count; i++) spk_ttyio_synth->read_buff_add(cp[i]); @@ -162,6 +163,7 @@ static int spk_ttyio_out(struct spk_synth *in_synth, const char ch) { if (in_synth->alive && speakup_tty && speakup_tty->ops->write) { int ret = speakup_tty->ops->write(speakup_tty, &ch, 1); + if (ret == 0) /* No room */ return 0; -- cgit v1.2.3-55-g7522 From 12cc28baeff94042b6b0691f4a962b6e8de0d54f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 12 Jun 2017 20:20:46 -0700 Subject: staging: rtl8723bs: Use vsnprintf extensions %pM and %pI4 Convert the uses of MAC_FMT, MAC_ARG and IP_FMT, IP_ARG to the kernel extensions. This could eventually be improved with an in-place substitution. This reduces object code size a bit too. $ size drivers/staging/rtl8723bs/r8723bs.o* text data bss dec hex filename 672812 27040 24232 724084 b0c74 drivers/staging/rtl8723bs/r8723bs.o.allyesconfig.new 676299 27040 24232 727571 b1a13 drivers/staging/rtl8723bs/r8723bs.o.allyesconfig.old 430398 27040 21528 478966 74ef6 drivers/staging/rtl8723bs/r8723bs.o.defconfig.new 431581 27040 21528 480149 75395 drivers/staging/rtl8723bs/r8723bs.o.defconfig.old Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/ieee80211.h | 8 ++++---- drivers/staging/rtl8723bs/include/osdep_service.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h index 6dc6dc73d72f..73ce63770c3c 100644 --- a/drivers/staging/rtl8723bs/include/ieee80211.h +++ b/drivers/staging/rtl8723bs/include/ieee80211.h @@ -1003,10 +1003,10 @@ enum ieee80211_state { #define DEFAULT_MAX_SCAN_AGE (15 * HZ) #define DEFAULT_FTS 2346 -#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" -#define MAC_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5] -#define IP_FMT "%d.%d.%d.%d" -#define IP_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3] +#define MAC_FMT "%pM" +#define MAC_ARG(x) (x) +#define IP_FMT "%pI4" +#define IP_ARG(x) (x) extern __inline int is_multicast_mac_addr(const u8 *addr) { diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h index fdeabc1daeca..ac9ffe0e3b84 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service.h +++ b/drivers/staging/rtl8723bs/include/osdep_service.h @@ -169,10 +169,10 @@ __inline static u32 _RND8(u32 sz) } #ifndef MAC_FMT -#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" +#define MAC_FMT "%pM" #endif #ifndef MAC_ARG -#define MAC_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5] +#define MAC_ARG(x) (x) #endif -- cgit v1.2.3-55-g7522 From f8fa77a8bc63d61139e7f4fcc3e0647d43a5ef36 Mon Sep 17 00:00:00 2001 From: Aviya Erenfeld Date: Tue, 13 Jun 2017 08:51:38 +0300 Subject: staging: rtl8188eu: Remove unneeded blank lines Remove unneeded blank lines Signed-off-by: Aviya Erenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 2ecfb117bf3f..22cf362b8528 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -61,7 +61,6 @@ static void _rtw_init_stainfo(struct sta_info *psta) psta->keep_alive_trycnt = 0; #endif /* CONFIG_88EU_AP_MODE */ - } u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) @@ -69,7 +68,6 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) struct sta_info *psta; s32 i; - pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA + 4); if (!pstapriv->pallocated_stainfo_buf) @@ -116,7 +114,6 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) pstapriv->max_num_sta = NUM_STA; #endif - return _SUCCESS; } @@ -263,7 +260,6 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct sta_priv *pstapriv = &padapter->stapriv; - if (!psta) goto exit; @@ -381,7 +377,6 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) exit: - return _SUCCESS; } @@ -394,7 +389,6 @@ void rtw_free_all_stainfo(struct adapter *padapter) struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo(padapter); - if (pstapriv->asoc_sta_count == 1) return; @@ -425,7 +419,6 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) u8 *addr; u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - if (!hwaddr) return NULL; @@ -463,7 +456,6 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter) unsigned char bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; struct sta_priv *pstapriv = &padapter->stapriv; - psta = rtw_alloc_stainfo(pstapriv, bcast_addr); if (!psta) { -- cgit v1.2.3-55-g7522 From 73905f2a702db24e522063812720ef5a1364e14d Mon Sep 17 00:00:00 2001 From: Roman Storozhenko Date: Tue, 13 Jun 2017 12:29:31 +0300 Subject: staging: lustre: fid: Fixes debug output style problem Fixes a style problems. Replaces non-standard 'Lx' specifier with a standard 'llx'. Signed-off-by: Roman Storozhenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fid/fid_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 999f250ceed0..cd84b426e3a6 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -259,7 +259,7 @@ int seq_client_alloc_fid(const struct lu_env *env, return rc; } - CDEBUG(D_INFO, "%s: Switch to sequence [0x%16.16Lx]\n", + CDEBUG(D_INFO, "%s: Switch to sequence [0x%16.16llx]\n", seq->lcs_name, seqnr); seq->lcs_fid.f_oid = LUSTRE_FID_INIT_OID; -- cgit v1.2.3-55-g7522 From dae24da62d3e767810115d03895f48a6bf4d5f98 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Mon, 12 Jun 2017 12:46:11 +0200 Subject: staging: rtl8723bs: wifi_regd.c: fix checkpatch.pl warning 'Statements should start on a tabstop' This patch fixes the checkpatch.pl warning 'Statements should start on a tabstop' by reformatting the affected lines. Signed-off-by: Fabian Wolff Signed-off-by: Mate Horvath Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index 9c61125f5910..6fbc935b08ca 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -41,9 +41,9 @@ static const struct ieee80211_regdomain rtw_regdom_rd = { .n_reg_rules = 3, .alpha2 = "99", .reg_rules = { - RTW_2GHZ_CH01_11, - RTW_2GHZ_CH12_13, - } + RTW_2GHZ_CH01_11, + RTW_2GHZ_CH12_13, + } }; static int rtw_ieee80211_channel_to_frequency(int chan, int band) -- cgit v1.2.3-55-g7522 From a8e1afccdcba281b8c529062cd5e4e055334c348 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Mon, 12 Jun 2017 12:46:13 +0200 Subject: staging: rtl8723bs: wifi_regd.c: remove superfluous braces This patch removes unnecessary braces in an if/else-construct, thereby fixing both a checkpatch.pl warning about superfluous braces and an error about an ill-placed closing brace preceding the "else" keyword. Signed-off-by: Fabian Wolff Signed-off-by: Mate Horvath Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index 6fbc935b08ca..115ba661d028 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -96,12 +96,10 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) ch = ieee80211_get_channel(wiphy, freq); if (ch) { - if (channel_set[i].ScanType == SCAN_PASSIVE) { + if (channel_set[i].ScanType == SCAN_PASSIVE) ch->flags = IEEE80211_CHAN_NO_IR; - } - else { + else ch->flags = 0; - } } } } -- cgit v1.2.3-55-g7522 From 5514174fe9c61c83bd8781c1e048ea6b4bf16a14 Mon Sep 17 00:00:00 2001 From: yuval.shaia@oracle.com Date: Tue, 13 Jun 2017 10:09:46 +0300 Subject: net: phy: Make phy_ethtool_ksettings_get return void Make return value void since function never return meaningfull value Signed-off-by: Yuval Shaia Acked-by: Sergei Shtylyov Signed-off-by: David S. Miller --- drivers/net/ethernet/apm/xgene-v2/ethtool.c | 4 +++- drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c | 8 ++++++-- drivers/net/ethernet/broadcom/b44.c | 4 +++- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 5 ++++- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 +++- drivers/net/ethernet/broadcom/tg3.c | 4 +++- drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 6 ++---- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 4 +++- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 2 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 5 ++--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 +++- drivers/net/ethernet/renesas/ravb_main.c | 14 +++++++------- drivers/net/ethernet/renesas/sh_eth.c | 5 ++--- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 5 ++--- drivers/net/ethernet/ti/cpsw.c | 8 ++++---- drivers/net/ethernet/ti/netcp_ethss.c | 8 +++----- drivers/net/phy/phy.c | 10 +++++----- drivers/net/usb/lan78xx.c | 2 +- drivers/staging/netlogic/xlr_net.c | 5 ++++- include/linux/phy.h | 4 ++-- net/dsa/slave.c | 9 +++++---- 21 files changed, 68 insertions(+), 52 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/net/ethernet/apm/xgene-v2/ethtool.c b/drivers/net/ethernet/apm/xgene-v2/ethtool.c index b6666e418e79..d31ad8270d93 100644 --- a/drivers/net/ethernet/apm/xgene-v2/ethtool.c +++ b/drivers/net/ethernet/apm/xgene-v2/ethtool.c @@ -157,7 +157,9 @@ static int xge_get_link_ksettings(struct net_device *ndev, if (!phydev) return -ENODEV; - return phy_ethtool_ksettings_get(phydev, cmd); + phy_ethtool_ksettings_get(phydev, cmd); + + return 0; } static int xge_set_link_ksettings(struct net_device *ndev, diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c index 559963b1aa32..4f50f11718f4 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c @@ -131,13 +131,17 @@ static int xgene_get_link_ksettings(struct net_device *ndev, if (phydev == NULL) return -ENODEV; - return phy_ethtool_ksettings_get(phydev, cmd); + phy_ethtool_ksettings_get(phydev, cmd); + + return 0; } else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { if (pdata->mdio_driver) { if (!phydev) return -ENODEV; - return phy_ethtool_ksettings_get(phydev, cmd); + phy_ethtool_ksettings_get(phydev, cmd); + + return 0; } supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg | diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 5b95bb48ce97..f411936b744c 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c @@ -1836,7 +1836,9 @@ static int b44_get_link_ksettings(struct net_device *dev, if (bp->flags & B44_FLAG_EXTERNAL_PHY) { BUG_ON(!dev->phydev); - return phy_ethtool_ksettings_get(dev->phydev, cmd); + phy_ethtool_ksettings_get(dev->phydev, cmd); + + return 0; } supported = (SUPPORTED_Autoneg); diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 50d88d3e03b6..ea3c906fa0e4 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -1453,7 +1453,10 @@ static int bcm_enet_get_link_ksettings(struct net_device *dev, if (priv->has_phy) { if (!dev->phydev) return -ENODEV; - return phy_ethtool_ksettings_get(dev->phydev, cmd); + + phy_ethtool_ksettings_get(dev->phydev, cmd); + + return 0; } else { cmd->base.autoneg = 0; cmd->base.speed = (priv->force_speed_100) ? diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index a205a9ff9e17..daca1c9d254b 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -477,7 +477,9 @@ static int bcmgenet_get_link_ksettings(struct net_device *dev, if (!priv->phydev) return -ENODEV; - return phy_ethtool_ksettings_get(priv->phydev, cmd); + phy_ethtool_ksettings_get(priv->phydev, cmd); + + return 0; } static int bcmgenet_set_link_ksettings(struct net_device *dev, diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 537d571ee601..d600c41fb1dc 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -12097,7 +12097,9 @@ static int tg3_get_link_ksettings(struct net_device *dev, if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) return -EAGAIN; phydev = mdiobus_get_phy(tp->mdio_bus, tp->phy_addr); - return phy_ethtool_ksettings_get(phydev, cmd); + phy_ethtool_ksettings_get(phydev, cmd); + + return 0; } supported = (SUPPORTED_Autoneg); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c index 15571e251fb9..aad825088357 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c @@ -75,16 +75,14 @@ static char dpaa_stats_global[][ETH_GSTRING_LEN] = { static int dpaa_get_link_ksettings(struct net_device *net_dev, struct ethtool_link_ksettings *cmd) { - int err; - if (!net_dev->phydev) { netdev_dbg(net_dev, "phy device not initialized\n"); return 0; } - err = phy_ethtool_ksettings_get(net_dev->phydev, cmd); + phy_ethtool_ksettings_get(net_dev->phydev, cmd); - return err; + return 0; } static int dpaa_set_link_ksettings(struct net_device *net_dev, diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c index b642990b549c..4df282ed22c7 100644 --- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c +++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c @@ -113,7 +113,9 @@ uec_get_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd) if (!phydev) return -ENODEV; - return phy_ethtool_ksettings_get(phydev, cmd); + phy_ethtool_ksettings_get(phydev, cmd); + + return 0; } static int diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index b8fab149690f..af1b15cc6a7f 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c @@ -150,7 +150,7 @@ static int hns_nic_get_link_ksettings(struct net_device *net_dev, cmd->base.duplex = duplex; if (net_dev->phydev) - (void)phy_ethtool_ksettings_get(net_dev->phydev, cmd); + phy_ethtool_ksettings_get(net_dev->phydev, cmd); link_stat = hns_nic_get_link(net_dev); if (!link_stat) { diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 25642dee49d3..5794d98d946f 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -1501,10 +1501,9 @@ mv643xx_eth_get_link_ksettings_phy(struct mv643xx_eth_private *mp, struct ethtool_link_ksettings *cmd) { struct net_device *dev = mp->dev; - int err; u32 supported, advertising; - err = phy_ethtool_ksettings_get(dev->phydev, cmd); + phy_ethtool_ksettings_get(dev->phydev, cmd); /* * The MAC does not support 1000baseT_Half. @@ -1520,7 +1519,7 @@ mv643xx_eth_get_link_ksettings_phy(struct mv643xx_eth_private *mp, ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, advertising); - return err; + return 0; } static int diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 16f97552ae98..962975d192d1 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -2056,7 +2056,9 @@ static int mtk_get_link_ksettings(struct net_device *ndev, if (unlikely(test_bit(MTK_RESETTING, &mac->hw->state))) return -EBUSY; - return phy_ethtool_ksettings_get(ndev->phydev, cmd); + phy_ethtool_ksettings_get(ndev->phydev, cmd); + + return 0; } static int mtk_set_link_ksettings(struct net_device *ndev, diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 784782da3a85..5931e859876c 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1076,16 +1076,16 @@ static int ravb_get_link_ksettings(struct net_device *ndev, struct ethtool_link_ksettings *cmd) { struct ravb_private *priv = netdev_priv(ndev); - int error = -ENODEV; unsigned long flags; - if (ndev->phydev) { - spin_lock_irqsave(&priv->lock, flags); - error = phy_ethtool_ksettings_get(ndev->phydev, cmd); - spin_unlock_irqrestore(&priv->lock, flags); - } + if (!ndev->phydev) + return -ENODEV; - return error; + spin_lock_irqsave(&priv->lock, flags); + phy_ethtool_ksettings_get(ndev->phydev, cmd); + spin_unlock_irqrestore(&priv->lock, flags); + + return 0; } static int ravb_set_link_ksettings(struct net_device *ndev, diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 48b66df88294..d2dc0a8ef305 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -1915,16 +1915,15 @@ static int sh_eth_get_link_ksettings(struct net_device *ndev, { struct sh_eth_private *mdp = netdev_priv(ndev); unsigned long flags; - int ret; if (!ndev->phydev) return -ENODEV; spin_lock_irqsave(&mdp->lock, flags); - ret = phy_ethtool_ksettings_get(ndev->phydev, cmd); + phy_ethtool_ksettings_get(ndev->phydev, cmd); spin_unlock_irqrestore(&mdp->lock, flags); - return ret; + return 0; } static int sh_eth_set_link_ksettings(struct net_device *ndev, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 16808e48ca1c..743170d57f62 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -273,7 +273,6 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, { struct stmmac_priv *priv = netdev_priv(dev); struct phy_device *phy = dev->phydev; - int rc; if (priv->hw->pcs & STMMAC_PCS_RGMII || priv->hw->pcs & STMMAC_PCS_SGMII) { @@ -364,8 +363,8 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, "link speed / duplex setting\n", dev->name); return -EBUSY; } - rc = phy_ethtool_ksettings_get(phy, cmd); - return rc; + phy_ethtool_ksettings_get(phy, cmd); + return 0; } static int diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index b6a0d92dd637..b7a0f5eeab62 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2170,11 +2170,11 @@ static int cpsw_get_link_ksettings(struct net_device *ndev, struct cpsw_common *cpsw = priv->cpsw; int slave_no = cpsw_slave_index(cpsw, priv); - if (cpsw->slaves[slave_no].phy) - return phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, - ecmd); - else + if (!cpsw->slaves[slave_no].phy) return -EOPNOTSUPP; + + phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, ecmd); + return 0; } static int cpsw_set_link_ksettings(struct net_device *ndev, diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index dd92950a4615..0847a8f48cfe 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -1927,7 +1927,6 @@ static int keystone_get_link_ksettings(struct net_device *ndev, struct netcp_intf *netcp = netdev_priv(ndev); struct phy_device *phy = ndev->phydev; struct gbe_intf *gbe_intf; - int ret; if (!phy) return -EINVAL; @@ -1939,11 +1938,10 @@ static int keystone_get_link_ksettings(struct net_device *ndev, if (!gbe_intf->slave) return -EINVAL; - ret = phy_ethtool_ksettings_get(phy, cmd); - if (!ret) - cmd->base.port = gbe_intf->slave->phy_port_t; + phy_ethtool_ksettings_get(phy, cmd); + cmd->base.port = gbe_intf->slave->phy_port_t; - return ret; + return 0; } static int keystone_set_link_ksettings(struct net_device *ndev, diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 14fc5bc75cd1..edcdf0d872ed 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -509,8 +509,8 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev, } EXPORT_SYMBOL(phy_ethtool_ksettings_set); -int phy_ethtool_ksettings_get(struct phy_device *phydev, - struct ethtool_link_ksettings *cmd) +void phy_ethtool_ksettings_get(struct phy_device *phydev, + struct ethtool_link_ksettings *cmd) { ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, phydev->supported); @@ -532,8 +532,6 @@ int phy_ethtool_ksettings_get(struct phy_device *phydev, cmd->base.autoneg = phydev->autoneg; cmd->base.eth_tp_mdix_ctrl = phydev->mdix_ctrl; cmd->base.eth_tp_mdix = phydev->mdix; - - return 0; } EXPORT_SYMBOL(phy_ethtool_ksettings_get); @@ -1449,7 +1447,9 @@ int phy_ethtool_get_link_ksettings(struct net_device *ndev, if (!phydev) return -ENODEV; - return phy_ethtool_ksettings_get(phydev, cmd); + phy_ethtool_ksettings_get(phydev, cmd); + + return 0; } EXPORT_SYMBOL(phy_ethtool_get_link_ksettings); diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 9eff97a650ae..5833f7e2a127 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -1490,7 +1490,7 @@ static int lan78xx_get_link_ksettings(struct net_device *net, if (ret < 0) return ret; - ret = phy_ethtool_ksettings_get(phydev, cmd); + phy_ethtool_ksettings_get(phydev, cmd); usb_autopm_put_interface(dev->intf); diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c index 781ef623233e..e05ae4645d91 100644 --- a/drivers/staging/netlogic/xlr_net.c +++ b/drivers/staging/netlogic/xlr_net.c @@ -179,7 +179,10 @@ static int xlr_get_link_ksettings(struct net_device *ndev, if (!phydev) return -ENODEV; - return phy_ethtool_ksettings_get(phydev, ecmd); + + phy_ethtool_ksettings_get(phydev, ecmd); + + return 0; } static int xlr_set_link_ksettings(struct net_device *ndev, diff --git a/include/linux/phy.h b/include/linux/phy.h index 51bea6593409..23d2e46dd322 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -872,8 +872,8 @@ void phy_start_machine(struct phy_device *phydev); void phy_stop_machine(struct phy_device *phydev); void phy_trigger_machine(struct phy_device *phydev, bool sync); int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); -int phy_ethtool_ksettings_get(struct phy_device *phydev, - struct ethtool_link_ksettings *cmd); +void phy_ethtool_ksettings_get(struct phy_device *phydev, + struct ethtool_link_ksettings *cmd); int phy_ethtool_ksettings_set(struct phy_device *phydev, const struct ethtool_link_ksettings *cmd); int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 5f3caee725ee..5e45ae5c3f71 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -387,12 +387,13 @@ dsa_slave_get_link_ksettings(struct net_device *dev, struct ethtool_link_ksettings *cmd) { struct dsa_slave_priv *p = netdev_priv(dev); - int err = -EOPNOTSUPP; - if (p->phy != NULL) - err = phy_ethtool_ksettings_get(p->phy, cmd); + if (!p->phy) + return -EOPNOTSUPP; - return err; + phy_ethtool_ksettings_get(p->phy, cmd); + + return 0; } static int -- cgit v1.2.3-55-g7522 From 0a3bbcbdf20b9d9a193edb954f77add55c81d5a2 Mon Sep 17 00:00:00 2001 From: Olav Haugan Date: Tue, 13 Jun 2017 14:14:46 -0700 Subject: staging: wlan-ng: prism2mib.c: Fix type cast issues Fix the following sparse warnings: prism2mib.c:717:45: warning: cast to restricted __le16 prism2mib.c:720:45: warning: incorrect type in assignment (different base types) prism2mib.c:720:45: expected unsigned short [unsigned] [addressable] [usertype] datalen prism2mib.c:720:45: got restricted __le16 [usertype] prism2mib.c:755:22: warning: incorrect type in assignment (different base types) prism2mib.c:755:22: expected unsigned short [unsigned] [usertype] len prism2mib.c:755:22: got restricted __le16 [usertype] Signed-off-by: Olav Haugan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x.h | 4 ++-- drivers/staging/wlan-ng/prism2mib.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h index 310e2c454590..60110b4b49f8 100644 --- a/drivers/staging/wlan-ng/hfa384x.h +++ b/drivers/staging/wlan-ng/hfa384x.h @@ -353,7 +353,7 @@ /*-------------------------------------------------------------*/ /* Commonly used basic types */ struct hfa384x_bytestr { - u16 len; + __le16 len; u8 data[0]; } __packed; @@ -419,7 +419,7 @@ struct hfa384x_authenticate_station_data { /*-- Configuration Record: WPAData (data portion only) --*/ struct hfa384x_wpa_data { - u16 datalen; + __le16 datalen; u8 data[0]; /* max 80 */ } __packed; diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c index 28df1f3d6f4a..e41207d97309 100644 --- a/drivers/staging/wlan-ng/prism2mib.c +++ b/drivers/staging/wlan-ng/prism2mib.c @@ -774,7 +774,7 @@ void prism2mgmt_pstr2bytestr(struct hfa384x_bytestr *bytestr, void prism2mgmt_bytestr2pstr(struct hfa384x_bytestr *bytestr, struct p80211pstrd *pstr) { - pstr->len = (u8)(le16_to_cpu((u16)(bytestr->len))); + pstr->len = (u8)(le16_to_cpu(bytestr->len)); memcpy(pstr->data, bytestr->data, pstr->len); } -- cgit v1.2.3-55-g7522 From a7941a08518959e07bdf6de8dc1c5dcd365fcaca Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Tue, 13 Jun 2017 23:01:48 +0200 Subject: staging: rtl8723bs: wifi_regd.c: put spaces around binary operators This patch adds spaces around the binary operators '-' and '+'. Signed-off-by: Fabian Wolff Signed-off-by: Mate Horvath Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index 115ba661d028..5bcf968702f6 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -20,7 +20,7 @@ /* 2G chan 01 - chan 11 */ #define RTW_2GHZ_CH01_11 \ - REG_RULE(2412-10, 2462+10, 40, 0, 20, 0) + REG_RULE(2412 - 10, 2462 + 10, 40, 0, 20, 0) /* *We enable active scan on these a case @@ -29,12 +29,12 @@ /* 2G chan 12 - chan 13, PASSIV SCAN */ #define RTW_2GHZ_CH12_13 \ - REG_RULE(2467-10, 2472+10, 40, 0, 20, \ + REG_RULE(2467 - 10, 2472 + 10, 40, 0, 20, \ NL80211_RRF_PASSIVE_SCAN) /* 2G chan 14, PASSIVS SCAN, NO OFDM (B only) */ #define RTW_2GHZ_CH14 \ - REG_RULE(2484-10, 2484+10, 40, 0, 20, \ + REG_RULE(2484 - 10, 2484 + 10, 40, 0, 20, \ NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM) static const struct ieee80211_regdomain rtw_regdom_rd = { -- cgit v1.2.3-55-g7522 From 7bb619813a497478cde5d8ecbc180140986e31df Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Tue, 13 Jun 2017 23:01:49 +0200 Subject: staging: rtl8723bs: wifi_regd.c: fix comment formatting This patch improves the formatting of block comments and removes one commented-out line of code entirely (keeping it would be redundant thanks to version control). Signed-off-by: Fabian Wolff Signed-off-by: Mate Horvath Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index 5bcf968702f6..53ff2ce071fb 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -14,8 +14,8 @@ */ /* - *Only these channels all allow active - *scan on all world regulatory domains + * Only these channels all allow active + * scan on all world regulatory domains */ /* 2G chan 01 - chan 11 */ @@ -23,8 +23,8 @@ REG_RULE(2412 - 10, 2462 + 10, 40, 0, 20, 0) /* - *We enable active scan on these a case - *by case basis by regulatory domain + * We enable active scan on these a case + * by case basis by regulatory domain */ /* 2G chan 12 - chan 13, PASSIV SCAN */ @@ -49,7 +49,8 @@ static const struct ieee80211_regdomain rtw_regdom_rd = { static int rtw_ieee80211_channel_to_frequency(int chan, int band) { /* see 802.11 17.3.8.3.2 and Annex J - * there are overlapping channel numbers in 5GHz and 2GHz bands */ + * there are overlapping channel numbers in 5GHz and 2GHz bands + */ /* NL80211_BAND_2GHZ */ if (chan == 14) @@ -73,7 +74,7 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) u16 channel; u32 freq; - /* all channels disable */ + /* all channels disable */ for (i = 0; i < NUM_NL80211_BANDS; i++) { sband = wiphy->bands[i]; @@ -87,7 +88,7 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) } } - /* channels apply by channel plans. */ + /* channels apply by channel plans. */ for (i = 0; i < max_chan_nums; i++) { channel = channel_set[i].ChannelNum; freq = @@ -145,7 +146,6 @@ int rtw_regd_init(struct adapter *padapter, void (*reg_notifier) (struct wiphy * wiphy, struct regulatory_request *request)) { - /* struct registry_priv *registrypriv = &padapter->registrypriv; */ struct wiphy *wiphy = padapter->rtw_wdev->wiphy; _rtw_regd_init_wiphy(NULL, wiphy, reg_notifier); -- cgit v1.2.3-55-g7522 From 4276cfd3e2cd22b0cf20deb13395790e52d61b82 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Tue, 13 Jun 2017 23:01:50 +0200 Subject: staging: rtl8723bs: wifi_regd.c: remove superfluous spaces from pointer arguments This patch implements the suggestions of checkpatch.pl to remove unnecessary spaces before function pointer arguments as well as in statements of the form "foo * bar" (which should be "foo *bar"). Signed-off-by: Fabian Wolff Signed-off-by: Mate Horvath Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index 53ff2ce071fb..6c8d4750dfab 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -123,7 +123,7 @@ static const struct ieee80211_regdomain *_rtw_regdomain_select(struct static void _rtw_regd_init_wiphy(struct rtw_regulatory *reg, struct wiphy *wiphy, - void (*reg_notifier) (struct wiphy * wiphy, + void (*reg_notifier)(struct wiphy *wiphy, struct regulatory_request * request)) { @@ -143,7 +143,7 @@ static void _rtw_regd_init_wiphy(struct rtw_regulatory *reg, } int rtw_regd_init(struct adapter *padapter, - void (*reg_notifier) (struct wiphy * wiphy, + void (*reg_notifier)(struct wiphy *wiphy, struct regulatory_request *request)) { struct wiphy *wiphy = padapter->rtw_wdev->wiphy; -- cgit v1.2.3-55-g7522 From 2b385530ce3aabbca7887de3aa6e137da4631f1b Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Tue, 13 Jun 2017 23:01:51 +0200 Subject: staging: rtl8723bs: wifi_regd.c: adjust alignment to match open parenthesis This patch adjusts the alignment of several lines to match their respective opening parenthesis. Signed-off-by: Fabian Wolff Signed-off-by: Mate Horvath Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index 6c8d4750dfab..68890b4528b1 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -122,10 +122,11 @@ static const struct ieee80211_regdomain *_rtw_regdomain_select(struct } static void _rtw_regd_init_wiphy(struct rtw_regulatory *reg, - struct wiphy *wiphy, - void (*reg_notifier)(struct wiphy *wiphy, - struct regulatory_request * - request)) + struct wiphy *wiphy, + void (*reg_notifier)(struct wiphy *wiphy, + struct + regulatory_request * + request)) { const struct ieee80211_regdomain *regd; -- cgit v1.2.3-55-g7522 From 845086076a138bb6dc971df9905504c7de33bcca Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Tue, 13 Jun 2017 23:01:52 +0200 Subject: staging: rtl8723bs: wifi_regd.c: insert blank line after declarations This patch inserts a missing blank line after variable declarations. Signed-off-by: Fabian Wolff Signed-off-by: Mate Horvath Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index 68890b4528b1..305e88a6b2ca 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -148,6 +148,7 @@ int rtw_regd_init(struct adapter *padapter, struct regulatory_request *request)) { struct wiphy *wiphy = padapter->rtw_wdev->wiphy; + _rtw_regd_init_wiphy(NULL, wiphy, reg_notifier); return 0; -- cgit v1.2.3-55-g7522 From 1802d96eb6f9548474e03acd1e28d71d0981290c Mon Sep 17 00:00:00 2001 From: Gabriel L. Somlo Date: Tue, 13 Jun 2017 09:51:25 -0400 Subject: staging: fsl-mc: fix typo in comment Resolving checkpatch issue: CHECK: 'successfuly' may be misspelled - perhaps 'successfully'? Signed-off-by: Gabriel Somlo Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c index e5d66749614c..8c45f817c472 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c @@ -514,7 +514,7 @@ EXPORT_SYMBOL(dpaa2_io_service_acquire); * The size of the storage is "max_frames*sizeof(struct dpaa2_dq)". * The 'dpaa2_io_store' returned is a DPIO service managed object. * - * Return pointer to dpaa2_io_store struct for successfuly created storage + * Return pointer to dpaa2_io_store struct for successfully created storage * memory, or NULL on error. */ struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames, -- cgit v1.2.3-55-g7522 From 1dbc269e95f34cc071c33db6cd02a5f5f746226e Mon Sep 17 00:00:00 2001 From: Roman Storozhenko Date: Tue, 13 Jun 2017 13:04:36 +0300 Subject: staging: lustre: llite: Replace the symbolic file permission mode with the numeric one Replaces S_IRWXUGO with 0777. The reason is that symbolic permissions considered harmful: https://lwn.net/Articles/696229/ Signed-off-by: Roman Storozhenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 13b35922a4ca..de5b4bf0dbd5 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1141,7 +1141,7 @@ out_free: } #if OBD_OCD_VERSION(2, 9, 50, 0) > LUSTRE_VERSION_CODE - mode = data->ioc_type != 0 ? data->ioc_type : S_IRWXUGO; + mode = data->ioc_type != 0 ? data->ioc_type : 0777; #else mode = data->ioc_type; #endif -- cgit v1.2.3-55-g7522 From d567b0fe2d63aaf5814f1b488a1b05db53f1849e Mon Sep 17 00:00:00 2001 From: Aliaksei Karaliou Date: Tue, 13 Jun 2017 13:06:21 +0300 Subject: staging: android: ion: Improve memory alloc style Use variable name instead of structure name to get size of memory to allocate as proposed by checkpatch.pl Signed-off-by: Aliaksei Karaliou Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_system_heap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index c50f2d9fc58c..5964bf21fd80 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -153,7 +153,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap, max_order = compound_order(page); i++; } - table = kmalloc(sizeof(struct sg_table), GFP_KERNEL); + table = kmalloc(sizeof(*table), GFP_KERNEL); if (!table) goto free_pages; @@ -383,7 +383,7 @@ static int ion_system_contig_heap_allocate(struct ion_heap *heap, for (i = len >> PAGE_SHIFT; i < (1 << order); i++) __free_page(page + i); - table = kmalloc(sizeof(struct sg_table), GFP_KERNEL); + table = kmalloc(sizeof(*table), GFP_KERNEL); if (!table) { ret = -ENOMEM; goto free_pages; @@ -433,7 +433,7 @@ static struct ion_heap *__ion_system_contig_heap_create(void) { struct ion_heap *heap; - heap = kzalloc(sizeof(struct ion_heap), GFP_KERNEL); + heap = kzalloc(sizeof(*heap), GFP_KERNEL); if (!heap) return ERR_PTR(-ENOMEM); heap->ops = &kmalloc_ops; -- cgit v1.2.3-55-g7522 From 59ae1d127ac0ae404baf414c434ba2651b793f46 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 16 Jun 2017 14:29:20 +0200 Subject: networking: introduce and use skb_put_data() A common pattern with skb_put() is to just want to memcpy() some data into the new space, introduce skb_put_data() for this. An spatch similar to the one for skb_put_zero() converts many of the places using it: @@ identifier p, p2; expression len, skb, data; type t, t2; @@ ( -p = skb_put(skb, len); +p = skb_put_data(skb, data, len); | -p = (t)skb_put(skb, len); +p = skb_put_data(skb, data, len); ) ( p2 = (t2)p; -memcpy(p2, data, len); | -memcpy(p, data, len); ) @@ type t, t2; identifier p, p2; expression skb, data; @@ t *p; ... ( -p = skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); | -p = (t *)skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); ) ( p2 = (t2)p; -memcpy(p2, data, sizeof(*p)); | -memcpy(p, data, sizeof(*p)); ) @@ expression skb, len, data; @@ -memcpy(skb_put(skb, len), data, len); +skb_put_data(skb, data, len); (again, manually post-processed to retain some comments) Reviewed-by: Stephen Hemminger Signed-off-by: Johannes Berg Signed-off-by: David S. Miller --- drivers/atm/fore200e.c | 2 +- drivers/atm/he.c | 2 +- drivers/atm/idt77252.c | 11 ++---- drivers/atm/solos-pci.c | 2 +- drivers/bluetooth/bfusb.c | 6 +-- drivers/bluetooth/bluecard_cs.c | 2 +- drivers/bluetooth/btmrvl_main.c | 2 +- drivers/bluetooth/btqcomsmd.c | 2 +- drivers/bluetooth/btusb.c | 12 +++--- drivers/bluetooth/hci_bcsp.c | 16 ++++---- drivers/bluetooth/hci_h4.c | 2 +- drivers/bluetooth/hci_h5.c | 12 +++--- drivers/bluetooth/hci_intel.c | 7 ++-- drivers/bluetooth/hci_ll.c | 2 +- drivers/bluetooth/hci_mrvl.c | 2 +- drivers/bluetooth/hci_qca.c | 2 +- drivers/char/pcmcia/synclink_cs.c | 2 +- drivers/firewire/net.c | 2 +- drivers/isdn/capi/capi.c | 2 +- drivers/isdn/capi/capidrv.c | 2 +- drivers/isdn/hardware/avm/b1.c | 6 +-- drivers/isdn/hardware/avm/b1dma.c | 6 +-- drivers/isdn/hardware/avm/c4.c | 6 +-- drivers/isdn/hardware/avm/t1isa.c | 6 +-- drivers/isdn/hardware/mISDN/hfcmulti.c | 5 +-- drivers/isdn/hardware/mISDN/hfcsusb.c | 2 +- drivers/isdn/hisax/amd7930_fn.c | 3 +- drivers/isdn/hisax/avm_pci.c | 5 ++- drivers/isdn/hisax/diva.c | 6 ++- drivers/isdn/hisax/elsa_ser.c | 4 +- drivers/isdn/hisax/hfc_usb.c | 2 +- drivers/isdn/hisax/hisax_fcpcipnp.c | 3 +- drivers/isdn/hisax/hisax_isac.c | 4 +- drivers/isdn/hisax/hscx_irq.c | 6 ++- drivers/isdn/hisax/icc.c | 2 +- drivers/isdn/hisax/ipacx.c | 8 ++-- drivers/isdn/hisax/isac.c | 2 +- drivers/isdn/hisax/isar.c | 6 +-- drivers/isdn/hisax/isdnl2.c | 4 +- drivers/isdn/hisax/jade_irq.c | 6 ++- drivers/isdn/hisax/l3_1tr6.c | 8 ++-- drivers/isdn/hisax/l3dss1.c | 28 ++++++------- drivers/isdn/hisax/l3ni1.c | 32 +++++++-------- drivers/isdn/hisax/netjet.c | 2 +- drivers/isdn/hisax/st5481_usb.c | 2 +- drivers/isdn/hisax/w6692.c | 9 +++-- drivers/isdn/hysdn/hycapi.c | 31 +++++++-------- drivers/isdn/hysdn/hysdn_net.c | 2 +- drivers/isdn/i4l/isdn_ppp.c | 3 +- drivers/isdn/i4l/isdn_tty.c | 2 +- drivers/isdn/i4l/isdn_v110.c | 6 +-- drivers/isdn/isdnloop/isdnloop.c | 2 +- drivers/isdn/mISDN/dsp_cmx.c | 3 +- drivers/isdn/mISDN/layer2.c | 8 ++-- drivers/isdn/mISDN/tei.c | 2 +- drivers/media/dvb-core/dvb_net.c | 3 +- drivers/media/radio/wl128x/fmdrv_common.c | 2 +- drivers/misc/ti-st/st_core.c | 2 +- drivers/misc/ti-st/st_kim.c | 2 +- drivers/net/bonding/bond_alb.c | 3 +- drivers/net/caif/caif_hsi.c | 6 +-- drivers/net/caif/caif_serial.c | 3 +- drivers/net/caif/caif_spi.c | 3 +- drivers/net/caif/caif_virtio.c | 2 +- drivers/net/can/slcan.c | 3 +- drivers/net/ethernet/3com/3c515.c | 6 +-- drivers/net/ethernet/3com/3c59x.c | 5 +-- drivers/net/ethernet/aeroflex/greth.c | 3 +- drivers/net/ethernet/agere/et131x.c | 2 +- drivers/net/ethernet/apple/macmace.c | 2 +- drivers/net/ethernet/aurora/nb8800.c | 4 +- drivers/net/ethernet/cadence/macb.c | 2 +- .../net/ethernet/cavium/liquidio/octeon_network.h | 4 +- drivers/net/ethernet/cirrus/cs89x0.c | 7 ++-- drivers/net/ethernet/dec/tulip/de4x5.c | 6 +-- drivers/net/ethernet/dec/tulip/interrupt.c | 12 +++--- drivers/net/ethernet/dec/tulip/uli526x.c | 6 +-- drivers/net/ethernet/ec_bhf.c | 2 +- drivers/net/ethernet/fealnx.c | 4 +- drivers/net/ethernet/i825xx/82596.c | 3 +- drivers/net/ethernet/i825xx/lib82596.c | 3 +- drivers/net/ethernet/intel/e1000/e1000_main.c | 2 +- drivers/net/ethernet/marvell/mvneta.c | 10 ++--- drivers/net/ethernet/micrel/ksz884x.c | 3 +- drivers/net/ethernet/nxp/lpc_eth.c | 7 ++-- drivers/net/ethernet/qlogic/qede/qede_fp.c | 3 +- drivers/net/ethernet/qlogic/qlge/qlge_main.c | 7 ++-- drivers/net/ethernet/silan/sc92031.c | 10 ++--- drivers/net/fjes/fjes_main.c | 3 +- drivers/net/hamradio/mkiss.c | 2 +- drivers/net/hippi/rrunner.c | 4 +- drivers/net/hyperv/netvsc_drv.c | 2 +- drivers/net/ieee802154/at86rf230.c | 2 +- drivers/net/ieee802154/ca8210.c | 2 +- drivers/net/ieee802154/mrf24j40.c | 2 +- drivers/net/irda/smsc-ircc2.c | 2 +- drivers/net/irda/vlsi_ir.c | 2 +- drivers/net/ppp/ppp_async.c | 3 +- drivers/net/ppp/ppp_synctty.c | 3 +- drivers/net/slip/slip.c | 2 +- drivers/net/usb/asix_common.c | 4 +- drivers/net/usb/cdc-phonet.c | 2 +- drivers/net/usb/cdc_mbim.c | 2 +- drivers/net/usb/cdc_ncm.c | 6 +-- drivers/net/usb/gl620a.c | 3 +- drivers/net/usb/hso.c | 13 +++--- drivers/net/usb/ipheth.c | 2 +- drivers/net/usb/lg-vl600.c | 2 +- drivers/net/usb/qmi_wwan.c | 2 +- drivers/net/virtio_net.c | 2 +- drivers/net/wan/farsync.c | 2 +- drivers/net/wan/hdlc_ppp.c | 4 +- drivers/net/wan/x25_asy.c | 2 +- drivers/net/wimax/i2400m/netdev.c | 2 +- drivers/net/wireless/admtek/adm8211.c | 6 +-- drivers/net/wireless/ath/ath10k/mac.c | 5 +-- drivers/net/wireless/ath/ath10k/wmi.c | 5 +-- drivers/net/wireless/ath/ath9k/channel.c | 5 +-- drivers/net/wireless/ath/ath9k/wmi.c | 3 +- drivers/net/wireless/ath/carl9170/rx.c | 6 +-- drivers/net/wireless/ath/wil6210/wmi.c | 2 +- drivers/net/wireless/atmel/atmel.c | 5 +-- drivers/net/wireless/broadcom/b43legacy/dma.c | 2 +- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 5 ++- drivers/net/wireless/intel/ipw2x00/libipw_tx.c | 6 +-- drivers/net/wireless/intel/iwlegacy/3945.c | 2 +- drivers/net/wireless/intel/iwlegacy/4965-mac.c | 2 +- drivers/net/wireless/intel/iwlwifi/dvm/rx.c | 2 +- drivers/net/wireless/intel/iwlwifi/dvm/tx.c | 3 +- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 4 +- drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 5 +-- drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 5 +-- .../net/wireless/intersil/hostap/hostap_80211_tx.c | 2 +- drivers/net/wireless/intersil/hostap/hostap_ap.c | 2 +- drivers/net/wireless/intersil/hostap/hostap_hw.c | 11 +++--- drivers/net/wireless/intersil/hostap/hostap_main.c | 2 +- drivers/net/wireless/intersil/orinoco/main.c | 2 +- drivers/net/wireless/intersil/p54/p54spi.c | 4 +- drivers/net/wireless/intersil/p54/txrx.c | 5 ++- drivers/net/wireless/mac80211_hwsim.c | 5 +-- drivers/net/wireless/marvell/libertas/if_sdio.c | 4 +- drivers/net/wireless/marvell/mwifiex/11n_aggr.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 ++--- drivers/net/wireless/marvell/mwifiex/tdls.c | 8 ++-- drivers/net/wireless/mediatek/mt7601u/dma.c | 4 +- drivers/net/wireless/mediatek/mt7601u/mcu.c | 2 +- .../net/wireless/quantenna/qtnfmac/pearl/pcie.c | 2 +- .../net/wireless/quantenna/qtnfmac/qlink_util.h | 3 +- drivers/net/wireless/ralink/rt2x00/rt2x00debug.c | 5 +-- drivers/net/wireless/realtek/rtlwifi/pci.c | 3 +- .../net/wireless/realtek/rtlwifi/rtl8188ee/fw.c | 3 +- .../net/wireless/realtek/rtlwifi/rtl8192se/fw.c | 7 ++-- drivers/net/wireless/realtek/rtlwifi/usb.c | 2 +- drivers/net/wireless/rsi/rsi_91x_mgmt.c | 8 ++-- drivers/net/wireless/st/cw1200/scan.c | 2 +- drivers/net/wireless/ti/wl1251/main.c | 2 +- drivers/net/wireless/ti/wlcore/cmd.c | 4 +- drivers/net/wireless/ti/wlcore/rx.c | 4 +- drivers/net/wireless/zydas/zd1201.c | 26 ++++++------ drivers/net/wireless/zydas/zd1211rw/zd_mac.c | 2 +- drivers/nfc/fdp/fdp.c | 3 +- drivers/nfc/fdp/i2c.c | 2 +- drivers/nfc/nfcmrvl/fw_dnld.c | 7 ++-- drivers/nfc/nfcmrvl/i2c.c | 2 +- drivers/nfc/nfcmrvl/usb.c | 4 +- drivers/nfc/nxp-nci/firmware.c | 3 +- drivers/nfc/nxp-nci/i2c.c | 5 +-- drivers/nfc/pn533/pn533.c | 28 ++++++------- drivers/nfc/pn533/usb.c | 4 +- drivers/nfc/port100.c | 14 +++---- drivers/nfc/s3fwrn5/firmware.c | 4 +- drivers/nfc/s3fwrn5/i2c.c | 2 +- drivers/nfc/st21nfca/dep.c | 2 +- drivers/nfc/st21nfca/i2c.c | 2 +- drivers/rpmsg/rpmsg_char.c | 2 +- drivers/s390/net/ctcm_fsms.c | 7 ++-- drivers/s390/net/ctcm_main.c | 10 ++--- drivers/s390/net/ctcm_mpc.c | 46 +++++++++------------- drivers/s390/net/lcs.c | 2 +- drivers/s390/net/netiucv.c | 10 ++--- drivers/s390/net/qeth_core_main.c | 10 ++--- drivers/staging/gdm724x/gdm_lte.c | 25 +++++------- drivers/staging/ks7010/ks_hostif.c | 11 +++--- drivers/staging/most/aim-network/networking.c | 8 ++-- drivers/staging/octeon/ethernet-rx.c | 10 ++--- drivers/staging/rtl8188eu/core/rtw_recv.c | 4 +- drivers/staging/rtl8188eu/os_dep/mon.c | 2 +- drivers/staging/rtl8192e/rtllib_rx.c | 11 ++---- drivers/staging/rtl8192e/rtllib_softmac.c | 9 ++--- drivers/staging/rtl8192e/rtllib_tx.c | 12 ++---- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 9 ++--- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 3 +- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 7 ++-- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 3 +- drivers/staging/rtl8712/rtl8712_recv.c | 3 +- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 4 +- drivers/staging/wilc1000/linux_mon.c | 6 +-- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wlan-ng/hfa384x_usb.c | 6 +-- drivers/tty/ipwireless/network.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/synclink.c | 2 +- drivers/tty/synclink_gt.c | 2 +- drivers/tty/synclinkmp.c | 2 +- drivers/usb/gadget/function/f_ncm.c | 11 +++--- drivers/usb/gadget/function/f_phonet.c | 2 +- include/linux/mISDNif.h | 2 +- include/linux/skbuff.h | 10 +++++ lib/nlattr.c | 2 +- net/batman-adv/bat_iv_ogm.c | 4 +- net/batman-adv/bat_v_ogm.c | 6 +-- net/batman-adv/fragmentation.c | 3 +- net/bluetooth/cmtp/core.c | 2 +- net/bluetooth/hci_core.c | 2 +- net/bluetooth/hci_request.c | 2 +- net/bluetooth/hci_sock.c | 8 ++-- net/bluetooth/hidp/core.c | 2 +- net/bluetooth/l2cap_core.c | 4 +- net/bluetooth/mgmt_util.c | 4 +- net/bluetooth/rfcomm/tty.c | 2 +- net/bridge/netfilter/nft_reject_bridge.c | 6 +-- net/can/bcm.c | 6 +-- net/decnet/dn_nsp_out.c | 10 ++--- net/ieee802154/6lowpan/tx.c | 7 ++-- net/ipv6/mcast.c | 4 +- net/irda/ircomm/ircomm_tty.c | 2 +- net/irda/irlap_frame.c | 6 +-- net/key/af_key.c | 3 +- net/mac80211/ibss.c | 2 +- net/mac80211/mesh.c | 8 ++-- net/mac80211/mlme.c | 16 ++++---- net/mac80211/offchannel.c | 3 +- net/mac80211/rx.c | 2 +- net/mac80211/tdls.c | 32 ++++++--------- net/mac80211/tx.c | 22 +++++------ net/mac80211/util.c | 5 +-- net/netlink/af_netlink.c | 2 +- net/nfc/digital_dep.c | 17 +++----- net/nfc/hci/core.c | 6 +-- net/nfc/llcp_commands.c | 15 ++++--- net/nfc/llcp_core.c | 2 +- net/nfc/nci/core.c | 4 +- net/nfc/nci/data.c | 2 +- net/nfc/nci/hci.c | 7 ++-- net/nfc/nci/uart.c | 2 +- net/qrtr/qrtr.c | 2 +- net/sctp/output.c | 3 +- net/sctp/sm_make_chunk.c | 4 +- net/vmw_vsock/virtio_transport_common.c | 6 +-- net/x25/x25_subr.c | 21 ++++------ 252 files changed, 622 insertions(+), 741 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 637c3e6b0f9e..7584ae1ded85 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c @@ -1104,7 +1104,7 @@ fore200e_push_rpd(struct fore200e* fore200e, struct atm_vcc* vcc, struct rpd* rp /* Make device DMA transfer visible to CPU. */ fore200e->bus->dma_sync_for_cpu(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, DMA_FROM_DEVICE); - memcpy(skb_put(skb, rpd->rsd[ i ].length), buffer->data.align_addr, rpd->rsd[ i ].length); + skb_put_data(skb, buffer->data.align_addr, rpd->rsd[i].length); /* Now let the device get at it again. */ fore200e->bus->dma_sync_for_device(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, DMA_FROM_DEVICE); diff --git a/drivers/atm/he.c b/drivers/atm/he.c index 3617659b9184..461da2bce8ef 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -1735,7 +1735,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) __net_timestamp(skb); list_for_each_entry(heb, &he_vcc->buffers, entry) - memcpy(skb_put(skb, heb->len), &heb->data, heb->len); + skb_put_data(skb, &heb->data, heb->len); switch (vcc->qos.aal) { case ATM_AAL0: diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 5ec109533bb9..4e64de380bda 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -1090,8 +1090,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) *((u32 *) sb->data) = aal0; skb_put(sb, sizeof(u32)); - memcpy(skb_put(sb, ATM_CELL_PAYLOAD), - cell, ATM_CELL_PAYLOAD); + skb_put_data(sb, cell, ATM_CELL_PAYLOAD); ATM_SKB(sb)->vcc = vcc; __net_timestamp(sb); @@ -1159,8 +1158,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) return; } skb_queue_walk(&rpp->queue, sb) - memcpy(skb_put(skb, sb->len), - sb->data, sb->len); + skb_put_data(skb, sb->data, sb->len); recycle_rx_pool_skb(card, rpp); @@ -1322,8 +1320,7 @@ idt77252_rx_raw(struct idt77252_dev *card) *((u32 *) sb->data) = header; skb_put(sb, sizeof(u32)); - memcpy(skb_put(sb, ATM_CELL_PAYLOAD), &(queue->data[16]), - ATM_CELL_PAYLOAD); + skb_put_data(sb, &(queue->data[16]), ATM_CELL_PAYLOAD); ATM_SKB(sb)->vcc = vcc; __net_timestamp(sb); @@ -2014,7 +2011,7 @@ idt77252_send_oam(struct atm_vcc *vcc, void *cell, int flags) } atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); - memcpy(skb_put(skb, 52), cell, 52); + skb_put_data(skb, cell, 52); return idt77252_send_skb(vcc, skb, 1); } diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 9115b292e680..077dd15c3a40 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c @@ -493,7 +493,7 @@ static int send_command(struct solos_card *card, int dev, const char *buf, size_ header->vci = cpu_to_le16(0); header->type = cpu_to_le16(PKT_COMMAND); - memcpy(skb_put(skb, size), buf, size); + skb_put_data(skb, buf, size); fpga_queue(card, dev, skb, NULL); diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 3bf4ec60e073..ab090a313a5f 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -335,7 +335,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch } if (len > 0) - memcpy(skb_put(data->reassembly, len), buf, len); + skb_put_data(data->reassembly, buf, len); if (hdr & 0x08) { hci_recv_frame(data->hdev, data->reassembly); @@ -505,7 +505,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) buf[1] = 0x00; buf[2] = (size == BFUSB_MAX_BLOCK_SIZE) ? 0 : size; - memcpy(skb_put(nskb, 3), buf, 3); + skb_put_data(nskb, buf, 3); skb_copy_from_linear_data_offset(skb, sent, skb_put(nskb, size), size); sent += size; @@ -516,7 +516,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) if ((nskb->len % data->bulk_pkt_size) == 0) { buf[0] = 0xdd; buf[1] = 0x00; - memcpy(skb_put(nskb, 2), buf, 2); + skb_put_data(nskb, buf, 2); } read_lock(&data->lock); diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 007c0a45f31b..1d30c116b2ee 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -597,7 +597,7 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud) break; } - memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd)); + skb_put_data(skb, cmd, sizeof(cmd)); skb_queue_tail(&(info->txq), skb); diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index c38cb5b91291..24a188eab360 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c @@ -194,7 +194,7 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, hdr->plen = len; if (len) - memcpy(skb_put(skb, len), param, len); + skb_put_data(skb, param, len); hci_skb_pkt_type(skb) = MRVL_VENDOR_PKT; diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index ef730c173d4b..d00c4fdae924 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -43,7 +43,7 @@ static int btqcomsmd_recv(struct hci_dev *hdev, unsigned int type, } hci_skb_pkt_type(skb) = type; - memcpy(skb_put(skb, count), data, count); + skb_put_data(skb, data, count); return hci_recv_frame(hdev, skb); } diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index bfd5f4bdec80..c7ea398e65c1 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -478,7 +478,7 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count) } len = min_t(uint, hci_skb_expect(skb), count); - memcpy(skb_put(skb, len), buffer, len); + skb_put_data(skb, buffer, len); count -= len; buffer += len; @@ -533,7 +533,7 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count) } len = min_t(uint, hci_skb_expect(skb), count); - memcpy(skb_put(skb, len), buffer, len); + skb_put_data(skb, buffer, len); count -= len; buffer += len; @@ -590,7 +590,7 @@ static int btusb_recv_isoc(struct btusb_data *data, void *buffer, int count) } len = min_t(uint, hci_skb_expect(skb), count); - memcpy(skb_put(skb, len), buffer, len); + skb_put_data(skb, buffer, len); count -= len; buffer += len; @@ -934,8 +934,8 @@ static void btusb_diag_complete(struct urb *urb) skb = bt_skb_alloc(urb->actual_length, GFP_ATOMIC); if (skb) { - memcpy(skb_put(skb, urb->actual_length), - urb->transfer_buffer, urb->actual_length); + skb_put_data(skb, urb->transfer_buffer, + urb->actual_length); hci_recv_diag(hdev, skb); } } else if (urb->status == -ENOENT) { @@ -2395,7 +2395,7 @@ static int marvell_config_oob_wake(struct hci_dev *hdev) return -ENOMEM; } - memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd)); + skb_put_data(skb, cmd, sizeof(cmd)); hci_skb_pkt_type(skb) = HCI_COMMAND_PKT; ret = btusb_send_frame(hdev, skb); diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index 910ec968f022..d880f4e33c75 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c @@ -125,7 +125,7 @@ static void bcsp_slip_msgdelim(struct sk_buff *skb) { const char pkt_delim = 0xc0; - memcpy(skb_put(skb, 1), &pkt_delim, 1); + skb_put_data(skb, &pkt_delim, 1); } static void bcsp_slip_one_byte(struct sk_buff *skb, u8 c) @@ -135,13 +135,13 @@ static void bcsp_slip_one_byte(struct sk_buff *skb, u8 c) switch (c) { case 0xc0: - memcpy(skb_put(skb, 2), &esc_c0, 2); + skb_put_data(skb, &esc_c0, 2); break; case 0xdb: - memcpy(skb_put(skb, 2), &esc_db, 2); + skb_put_data(skb, &esc_db, 2); break; default: - memcpy(skb_put(skb, 1), &c, 1); + skb_put_data(skb, &c, 1); } } @@ -423,7 +423,7 @@ static void bcsp_handle_le_pkt(struct hci_uart *hu) BT_DBG("Found a LE conf pkt"); if (!nskb) return; - memcpy(skb_put(nskb, 4), conf_rsp_pkt, 4); + skb_put_data(nskb, conf_rsp_pkt, 4); hci_skb_pkt_type(nskb) = BCSP_LE_PKT; skb_queue_head(&bcsp->unrel, nskb); @@ -447,7 +447,7 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned char bcsp->rx_esc_state = BCSP_ESCSTATE_ESC; break; default: - memcpy(skb_put(bcsp->rx_skb, 1), &byte, 1); + skb_put_data(bcsp->rx_skb, &byte, 1); if ((bcsp->rx_skb->data[0] & 0x40) != 0 && bcsp->rx_state != BCSP_W4_CRC) bcsp_crc_update(&bcsp->message_crc, byte); @@ -458,7 +458,7 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned char case BCSP_ESCSTATE_ESC: switch (byte) { case 0xdc: - memcpy(skb_put(bcsp->rx_skb, 1), &c0, 1); + skb_put_data(bcsp->rx_skb, &c0, 1); if ((bcsp->rx_skb->data[0] & 0x40) != 0 && bcsp->rx_state != BCSP_W4_CRC) bcsp_crc_update(&bcsp->message_crc, 0xc0); @@ -467,7 +467,7 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned char break; case 0xdd: - memcpy(skb_put(bcsp->rx_skb, 1), &db, 1); + skb_put_data(bcsp->rx_skb, &db, 1); if ((bcsp->rx_skb->data[0] & 0x40) != 0 && bcsp->rx_state != BCSP_W4_CRC) bcsp_crc_update(&bcsp->message_crc, 0xdb); diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c index 82e5a32b87a4..4e328d7d47bb 100644 --- a/drivers/bluetooth/hci_h4.c +++ b/drivers/bluetooth/hci_h4.c @@ -209,7 +209,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, } len = min_t(uint, hci_skb_expect(skb) - skb->len, count); - memcpy(skb_put(skb, len), buffer, len); + skb_put_data(skb, buffer, len); count -= len; buffer += len; diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 90d0456b6744..c0e4e26dc30d 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -109,7 +109,7 @@ static void h5_link_control(struct hci_uart *hu, const void *data, size_t len) hci_skb_pkt_type(nskb) = HCI_3WIRE_LINK_PKT; - memcpy(skb_put(nskb, len), data, len); + skb_put_data(nskb, data, len); skb_queue_tail(&h5->unrel, nskb); } @@ -487,7 +487,7 @@ static void h5_unslip_one_byte(struct h5 *h5, unsigned char c) } } - memcpy(skb_put(h5->rx_skb, 1), byte, 1); + skb_put_data(h5->rx_skb, byte, 1); h5->rx_pending--; BT_DBG("unsliped 0x%02hhx, rx_pending %zu", *byte, h5->rx_pending); @@ -579,7 +579,7 @@ static void h5_slip_delim(struct sk_buff *skb) { const char delim = SLIP_DELIMITER; - memcpy(skb_put(skb, 1), &delim, 1); + skb_put_data(skb, &delim, 1); } static void h5_slip_one_byte(struct sk_buff *skb, u8 c) @@ -589,13 +589,13 @@ static void h5_slip_one_byte(struct sk_buff *skb, u8 c) switch (c) { case SLIP_DELIMITER: - memcpy(skb_put(skb, 2), &esc_delim, 2); + skb_put_data(skb, &esc_delim, 2); break; case SLIP_ESC: - memcpy(skb_put(skb, 2), &esc_esc, 2); + skb_put_data(skb, &esc_esc, 2); break; default: - memcpy(skb_put(skb, 1), &c, 1); + skb_put_data(skb, &c, 1); } } diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index 851bee82df2a..16e728577cd8 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -185,7 +185,7 @@ static int intel_lpm_suspend(struct hci_uart *hu) return -ENOMEM; } - memcpy(skb_put(skb, sizeof(suspend)), suspend, sizeof(suspend)); + skb_put_data(skb, suspend, sizeof(suspend)); hci_skb_pkt_type(skb) = HCI_LPM_PKT; set_bit(STATE_LPM_TRANSACTION, &intel->flags); @@ -270,8 +270,7 @@ static int intel_lpm_host_wake(struct hci_uart *hu) return -ENOMEM; } - memcpy(skb_put(skb, sizeof(lpm_resume_ack)), lpm_resume_ack, - sizeof(lpm_resume_ack)); + skb_put_data(skb, lpm_resume_ack, sizeof(lpm_resume_ack)); hci_skb_pkt_type(skb) = HCI_LPM_PKT; /* LPM flow is a priority, enqueue packet at list head */ @@ -522,7 +521,7 @@ static int intel_set_baudrate(struct hci_uart *hu, unsigned int speed) return -ENOMEM; } - memcpy(skb_put(skb, sizeof(speed_cmd)), speed_cmd, sizeof(speed_cmd)); + skb_put_data(skb, speed_cmd, sizeof(speed_cmd)); hci_skb_pkt_type(skb) = HCI_COMMAND_PKT; hci_uart_set_flow_control(hu, true); diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index 2b16d48d82ee..cc2fa78b434e 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c @@ -413,7 +413,7 @@ static int ll_recv(struct hci_uart *hu, const void *data, int count) while (count) { if (ll->rx_count) { len = min_t(unsigned int, ll->rx_count, count); - memcpy(skb_put(ll->rx_skb, len), ptr, len); + skb_put_data(ll->rx_skb, ptr, len); ll->rx_count -= len; count -= len; ptr += len; if (ll->rx_count) diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c index bbc4b39b1dbf..ffb00669346f 100644 --- a/drivers/bluetooth/hci_mrvl.c +++ b/drivers/bluetooth/hci_mrvl.c @@ -328,7 +328,7 @@ static int mrvl_load_firmware(struct hci_dev *hdev, const char *name) } bt_cb(skb)->pkt_type = MRVL_RAW_DATA; - memcpy(skb_put(skb, mrvl->tx_len), fw_ptr, mrvl->tx_len); + skb_put_data(skb, fw_ptr, mrvl->tx_len); fw_ptr += mrvl->tx_len; set_bit(STATE_FW_REQ_PENDING, &mrvl->flags); diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index f242dfd0c2e2..b55f01320631 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -869,7 +869,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) } /* Assign commands to change baudrate and packet type. */ - memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd)); + skb_put_data(skb, cmd, sizeof(cmd)); hci_skb_pkt_type(skb) = HCI_COMMAND_PKT; skb_queue_tail(&qca->txq, skb); diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index d136db1a10f0..62be953e5fb0 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -4235,7 +4235,7 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size) return; } - memcpy(skb_put(skb, size), buf, size); + skb_put_data(skb, buf, size); skb->protocol = hdlc_type_trans(skb, dev); diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 5d3640264f2d..d5040bbd34e8 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -600,7 +600,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, return -ENOMEM; } skb_reserve(skb, LL_RESERVED_SPACE(net)); - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); return fwnet_finish_incoming_packet(net, skb, source_node_id, is_broadcast, ether_type); diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 6a2df3297e77..77be17590866 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1058,7 +1058,7 @@ static int capinc_tty_write(struct tty_struct *tty, } skb_reserve(skb, CAPI_DATA_B3_REQ_LEN); - memcpy(skb_put(skb, count), buf, count); + skb_put_data(skb, buf, count); __skb_queue_tail(&mp->outqueue, skb); mp->outbytes += skb->len; diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index 85cfa4f8691f..89dd1303a98a 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c @@ -516,7 +516,7 @@ static void send_message(capidrv_contr *card, _cmsg *cmsg) printk(KERN_ERR "capidrv::send_message: can't allocate mem\n"); return; } - memcpy(skb_put(skb, len), cmsg->buf, len); + skb_put_data(skb, cmsg->buf, len); if (capi20_put_message(&global.ap, skb) != CAPI_NOERROR) kfree_skb(skb); } diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c index 9fdbd99c7547..b1833d08a5fe 100644 --- a/drivers/isdn/hardware/avm/b1.c +++ b/drivers/isdn/hardware/avm/b1.c @@ -529,8 +529,8 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) printk(KERN_ERR "%s: incoming packet dropped\n", card->name); } else { - memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); - memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); + skb_put_data(skb, card->msgbuf, MsgLen); + skb_put_data(skb, card->databuf, DataB3Len); capi_ctr_handle_message(ctrl, ApplId, skb); } break; @@ -544,7 +544,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) card->name); spin_unlock_irqrestore(&card->lock, flags); } else { - memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); + skb_put_data(skb, card->msgbuf, MsgLen); if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) capilib_data_b3_conf(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data), diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 818bd8f231db..9538a9e5e1a8 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c @@ -474,8 +474,8 @@ static void b1dma_handle_rx(avmcard *card) printk(KERN_ERR "%s: incoming packet dropped\n", card->name); } else { - memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); - memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); + skb_put_data(skb, card->msgbuf, MsgLen); + skb_put_data(skb, card->databuf, DataB3Len); capi_ctr_handle_message(ctrl, ApplId, skb); } break; @@ -488,7 +488,7 @@ static void b1dma_handle_rx(avmcard *card) printk(KERN_ERR "%s: incoming packet dropped\n", card->name); } else { - memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); + skb_put_data(skb, card->msgbuf, MsgLen); if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) { spin_lock(&card->lock); capilib_data_b3_conf(&cinfo->ncci_head, ApplId, diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 17beb2869dc1..40c7e2cf423b 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c @@ -536,8 +536,8 @@ static void c4_handle_rx(avmcard *card) printk(KERN_ERR "%s: incoming packet dropped\n", card->name); } else { - memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); - memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); + skb_put_data(skb, card->msgbuf, MsgLen); + skb_put_data(skb, card->databuf, DataB3Len); capi_ctr_handle_message(ctrl, ApplId, skb); } break; @@ -555,7 +555,7 @@ static void c4_handle_rx(avmcard *card) printk(KERN_ERR "%s: incoming packet dropped\n", card->name); } else { - memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); + skb_put_data(skb, card->msgbuf, MsgLen); if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) capilib_data_b3_conf(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data), diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c index 9516203c735f..9f80d20ced87 100644 --- a/drivers/isdn/hardware/avm/t1isa.c +++ b/drivers/isdn/hardware/avm/t1isa.c @@ -171,8 +171,8 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) printk(KERN_ERR "%s: incoming packet dropped\n", card->name); } else { - memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); - memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); + skb_put_data(skb, card->msgbuf, MsgLen); + skb_put_data(skb, card->databuf, DataB3Len); capi_ctr_handle_message(ctrl, ApplId, skb); } break; @@ -186,7 +186,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) printk(KERN_ERR "%s: incoming packet dropped\n", card->name); } else { - memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); + skb_put_data(skb, card->msgbuf, MsgLen); if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3) capilib_data_b3_conf(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data), diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c index 961c07ee47b7..aea0c9616ea5 100644 --- a/drivers/isdn/hardware/mISDN/hfcmulti.c +++ b/drivers/isdn/hardware/mISDN/hfcmulti.c @@ -1926,7 +1926,7 @@ hfcmulti_dtmf(struct hfc_multi *hc) hh = mISDN_HEAD_P(skb); hh->prim = PH_CONTROL_IND; hh->id = DTMF_HFC_COEF; - memcpy(skb_put(skb, 512), hc->chan[ch].coeff, 512); + skb_put_data(skb, hc->chan[ch].coeff, 512); recv_Bchannel_skb(bch, skb); } } @@ -2332,8 +2332,7 @@ next_frame: skb = *sp; *sp = mI_alloc_skb(skb->len, GFP_ATOMIC); if (*sp) { - memcpy(skb_put(*sp, skb->len), - skb->data, skb->len); + skb_put_data(*sp, skb->data, skb->len); skb_trim(skb, 0); } else { printk(KERN_DEBUG "%s: No mem\n", diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 114f3bcba1b0..17cc879ad2bb 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c @@ -893,7 +893,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len, } } - memcpy(skb_put(rx_skb, len), data, len); + skb_put_data(rx_skb, data, len); if (hdlc) { /* we have a complete hdlc packet */ diff --git a/drivers/isdn/hisax/amd7930_fn.c b/drivers/isdn/hisax/amd7930_fn.c index 3a4c2f9e19e9..dcf4c2a9fcea 100644 --- a/drivers/isdn/hisax/amd7930_fn.c +++ b/drivers/isdn/hisax/amd7930_fn.c @@ -317,7 +317,8 @@ Amd7930_empty_Dfifo(struct IsdnCardState *cs, int flag) debugl1(cs, "%s", cs->dlog); } /* moves received data in sk-buffer */ - memcpy(skb_put(skb, cs->rcvidx), cs->rcvbuf, cs->rcvidx); + skb_put_data(skb, cs->rcvbuf, + cs->rcvidx); skb_queue_tail(&cs->rq, skb); } } diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c index d1427bd6452d..daf3742cdef6 100644 --- a/drivers/isdn/hisax/avm_pci.c +++ b/drivers/isdn/hisax/avm_pci.c @@ -378,8 +378,9 @@ HDLC_irq(struct BCState *bcs, u_int stat) { if (!(skb = dev_alloc_skb(bcs->hw.hdlc.rcvidx))) printk(KERN_WARNING "HDLC: receive out of memory\n"); else { - memcpy(skb_put(skb, bcs->hw.hdlc.rcvidx), - bcs->hw.hdlc.rcvbuf, bcs->hw.hdlc.rcvidx); + skb_put_data(skb, + bcs->hw.hdlc.rcvbuf, + bcs->hw.hdlc.rcvidx); skb_queue_tail(&bcs->rqueue, skb); } bcs->hw.hdlc.rcvidx = 0; diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index 079336e593f9..3fc94e7741ae 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c @@ -511,7 +511,8 @@ Memhscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) if (!(skb = dev_alloc_skb(count))) printk(KERN_WARNING "HSCX: receive out of memory\n"); else { - memcpy(skb_put(skb, count), bcs->hw.hscx.rcvbuf, count); + skb_put_data(skb, bcs->hw.hscx.rcvbuf, + count); skb_queue_tail(&bcs->rqueue, skb); } } @@ -526,7 +527,8 @@ Memhscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) if (!(skb = dev_alloc_skb(fifo_size))) printk(KERN_WARNING "HiSax: receive out of memory\n"); else { - memcpy(skb_put(skb, fifo_size), bcs->hw.hscx.rcvbuf, fifo_size); + skb_put_data(skb, bcs->hw.hscx.rcvbuf, + fifo_size); skb_queue_tail(&bcs->rqueue, skb); } bcs->hw.hscx.rcvidx = 0; diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c index a2a358c1dc8e..999effd7a276 100644 --- a/drivers/isdn/hisax/elsa_ser.c +++ b/drivers/isdn/hisax/elsa_ser.c @@ -333,8 +333,8 @@ static inline void receive_chars(struct IsdnCardState *cs, if (!(skb = dev_alloc_skb(cs->hw.elsa.rcvcnt))) printk(KERN_WARNING "ElsaSER: receive out of memory\n"); else { - memcpy(skb_put(skb, cs->hw.elsa.rcvcnt), cs->hw.elsa.rcvbuf, - cs->hw.elsa.rcvcnt); + skb_put_data(skb, cs->hw.elsa.rcvbuf, + cs->hw.elsa.rcvcnt); skb_queue_tail(&cs->hw.elsa.bcs->rqueue, skb); } schedule_event(cs->hw.elsa.bcs, B_RCVBUFREADY); diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 6dbd1f1da14f..ef4748083efd 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c @@ -799,7 +799,7 @@ collect_rx_frame(usb_fifo *fifo, __u8 *data, int len, int finish) } if (len) { if (fifo->skbuff->len + len < fifo->max_size) { - memcpy(skb_put(fifo->skbuff, len), data, len); + skb_put_data(fifo->skbuff, data, len); } else { DBG(HFCUSB_DBG_FIFO_ERR, "HCF-USB: got frame exceeded fifo->max_size(%d) fifo(%d)", diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c index 5e8a5d967162..5a9f39ed1d5d 100644 --- a/drivers/isdn/hisax/hisax_fcpcipnp.c +++ b/drivers/isdn/hisax/hisax_fcpcipnp.c @@ -495,8 +495,7 @@ static inline void hdlc_rpr_irq(struct fritz_bcs *bcs, u32 stat) if (!skb) { printk(KERN_WARNING "HDLC: receive out of memory\n"); } else { - memcpy(skb_put(skb, bcs->rcvidx), bcs->rcvbuf, - bcs->rcvidx); + skb_put_data(skb, bcs->rcvbuf, bcs->rcvidx); DBG_SKB(1, skb); B_L1L2(bcs, PH_DATA | INDICATION, skb); } diff --git a/drivers/isdn/hisax/hisax_isac.c b/drivers/isdn/hisax/hisax_isac.c index 5154c252a25f..0f36375478c5 100644 --- a/drivers/isdn/hisax/hisax_isac.c +++ b/drivers/isdn/hisax/hisax_isac.c @@ -557,7 +557,7 @@ static inline void isac_rme_interrupt(struct isac *isac) DBG(DBG_WARN, "no memory, dropping\n"); goto out; } - memcpy(skb_put(skb, count), isac->rcvbuf, count); + skb_put_data(skb, isac->rcvbuf, count); DBG_SKB(DBG_RPACKET, skb); D_L1L2(isac, PH_DATA | INDICATION, skb); out: @@ -687,7 +687,7 @@ static inline void isacsx_rme_interrupt(struct isac *isac) DBG(DBG_WARN, "no memory, dropping"); goto out; } - memcpy(skb_put(skb, count), isac->rcvbuf, count); + skb_put_data(skb, isac->rcvbuf, count); DBG_SKB(DBG_RPACKET, skb); D_L1L2(isac, PH_DATA | INDICATION, skb); out: diff --git a/drivers/isdn/hisax/hscx_irq.c b/drivers/isdn/hisax/hscx_irq.c index a8d6188402c6..0d7e783c8bef 100644 --- a/drivers/isdn/hisax/hscx_irq.c +++ b/drivers/isdn/hisax/hscx_irq.c @@ -169,7 +169,8 @@ hscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) if (!(skb = dev_alloc_skb(count))) printk(KERN_WARNING "HSCX: receive out of memory\n"); else { - memcpy(skb_put(skb, count), bcs->hw.hscx.rcvbuf, count); + skb_put_data(skb, bcs->hw.hscx.rcvbuf, + count); skb_queue_tail(&bcs->rqueue, skb); } } @@ -184,7 +185,8 @@ hscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) if (!(skb = dev_alloc_skb(fifo_size))) printk(KERN_WARNING "HiSax: receive out of memory\n"); else { - memcpy(skb_put(skb, fifo_size), bcs->hw.hscx.rcvbuf, fifo_size); + skb_put_data(skb, bcs->hw.hscx.rcvbuf, + fifo_size); skb_queue_tail(&bcs->rqueue, skb); } bcs->hw.hscx.rcvidx = 0; diff --git a/drivers/isdn/hisax/icc.c b/drivers/isdn/hisax/icc.c index c7c3797a817e..8d1804572b32 100644 --- a/drivers/isdn/hisax/icc.c +++ b/drivers/isdn/hisax/icc.c @@ -217,7 +217,7 @@ icc_interrupt(struct IsdnCardState *cs, u_char val) if (!(skb = alloc_skb(count, GFP_ATOMIC))) printk(KERN_WARNING "HiSax: D receive out of memory\n"); else { - memcpy(skb_put(skb, count), cs->rcvbuf, count); + skb_put_data(skb, cs->rcvbuf, count); skb_queue_tail(&cs->rq, skb); } } diff --git a/drivers/isdn/hisax/ipacx.c b/drivers/isdn/hisax/ipacx.c index 43effe7082ed..c426b4fea28a 100644 --- a/drivers/isdn/hisax/ipacx.c +++ b/drivers/isdn/hisax/ipacx.c @@ -350,7 +350,7 @@ dch_int(struct IsdnCardState *cs) if (!(skb = dev_alloc_skb(count))) printk(KERN_WARNING "HiSax dch_int(): receive out of memory\n"); else { - memcpy(skb_put(skb, count), cs->rcvbuf, count); + skb_put_data(skb, cs->rcvbuf, count); skb_queue_tail(&cs->rq, skb); } } @@ -627,7 +627,8 @@ bch_int(struct IsdnCardState *cs, u_char hscx) if (!(skb = dev_alloc_skb(count))) printk(KERN_WARNING "HiSax bch_int(): receive frame out of memory\n"); else { - memcpy(skb_put(skb, count), bcs->hw.hscx.rcvbuf, count); + skb_put_data(skb, bcs->hw.hscx.rcvbuf, + count); skb_queue_tail(&bcs->rqueue, skb); } } @@ -644,7 +645,8 @@ bch_int(struct IsdnCardState *cs, u_char hscx) if (!(skb = dev_alloc_skb(B_FIFO_SIZE))) printk(KERN_WARNING "HiSax bch_int(): receive transparent out of memory\n"); else { - memcpy(skb_put(skb, B_FIFO_SIZE), bcs->hw.hscx.rcvbuf, B_FIFO_SIZE); + skb_put_data(skb, bcs->hw.hscx.rcvbuf, + B_FIFO_SIZE); skb_queue_tail(&bcs->rqueue, skb); } bcs->hw.hscx.rcvidx = 0; diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c index 4273b4548825..ea965f29a555 100644 --- a/drivers/isdn/hisax/isac.c +++ b/drivers/isdn/hisax/isac.c @@ -222,7 +222,7 @@ isac_interrupt(struct IsdnCardState *cs, u_char val) if (!skb) printk(KERN_WARNING "HiSax: D receive out of memory\n"); else { - memcpy(skb_put(skb, count), cs->rcvbuf, count); + skb_put_data(skb, cs->rcvbuf, count); skb_queue_tail(&cs->rq, skb); } } diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c index 0dc60b287c4b..98b4b67ea337 100644 --- a/drivers/isdn/hisax/isar.c +++ b/drivers/isdn/hisax/isar.c @@ -458,7 +458,7 @@ send_DLE_ETX(struct BCState *bcs) struct sk_buff *skb; if ((skb = dev_alloc_skb(2))) { - memcpy(skb_put(skb, 2), dleetx, 2); + skb_put_data(skb, dleetx, 2); skb_queue_tail(&bcs->rqueue, skb); schedule_event(bcs, B_RCVBUFREADY); } else { @@ -550,8 +550,8 @@ isar_rcv_frame(struct IsdnCardState *cs, struct BCState *bcs) } else if (!(skb = dev_alloc_skb(bcs->hw.isar.rcvidx - 2))) { printk(KERN_WARNING "ISAR: receive out of memory\n"); } else { - memcpy(skb_put(skb, bcs->hw.isar.rcvidx - 2), - bcs->hw.isar.rcvbuf, bcs->hw.isar.rcvidx - 2); + skb_put_data(skb, bcs->hw.isar.rcvbuf, + bcs->hw.isar.rcvidx - 2); skb_queue_tail(&bcs->rqueue, skb); schedule_event(bcs, B_RCVBUFREADY); } diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c index c53a53f6efb6..1a40ed04cb52 100644 --- a/drivers/isdn/hisax/isdnl2.c +++ b/drivers/isdn/hisax/isdnl2.c @@ -433,7 +433,7 @@ send_uframe(struct PStack *st, u_char cmd, u_char cr) printk(KERN_WARNING "isdl2 can't alloc sbbuff for send_uframe\n"); return; } - memcpy(skb_put(skb, i), tmp, i); + skb_put_data(skb, tmp, i); enqueue_super(st, skb); } @@ -894,7 +894,7 @@ enquiry_cr(struct PStack *st, u_char typ, u_char cr, u_char pf) printk(KERN_WARNING "isdl2 can't alloc sbbuff for enquiry_cr\n"); return; } - memcpy(skb_put(skb, i), tmp, i); + skb_put_data(skb, tmp, i); enqueue_super(st, skb); } diff --git a/drivers/isdn/hisax/jade_irq.c b/drivers/isdn/hisax/jade_irq.c index b930da9b5aa6..a89e2df911c5 100644 --- a/drivers/isdn/hisax/jade_irq.c +++ b/drivers/isdn/hisax/jade_irq.c @@ -147,7 +147,8 @@ jade_interrupt(struct IsdnCardState *cs, u_char val, u_char jade) if (!(skb = dev_alloc_skb(count))) printk(KERN_WARNING "JADE %s receive out of memory\n", (jade ? "B" : "A")); else { - memcpy(skb_put(skb, count), bcs->hw.hscx.rcvbuf, count); + skb_put_data(skb, bcs->hw.hscx.rcvbuf, + count); skb_queue_tail(&bcs->rqueue, skb); } } @@ -162,7 +163,8 @@ jade_interrupt(struct IsdnCardState *cs, u_char val, u_char jade) if (!(skb = dev_alloc_skb(fifo_size))) printk(KERN_WARNING "HiSax: receive out of memory\n"); else { - memcpy(skb_put(skb, fifo_size), bcs->hw.hscx.rcvbuf, fifo_size); + skb_put_data(skb, bcs->hw.hscx.rcvbuf, + fifo_size); skb_queue_tail(&bcs->rqueue, skb); } bcs->hw.hscx.rcvidx = 0; diff --git a/drivers/isdn/hisax/l3_1tr6.c b/drivers/isdn/hisax/l3_1tr6.c index 875402e76d0a..da0a1c6aa329 100644 --- a/drivers/isdn/hisax/l3_1tr6.c +++ b/drivers/isdn/hisax/l3_1tr6.c @@ -149,7 +149,7 @@ l3_1tr6_setup_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); L3DelTimer(&pc->timer); L3AddTimer(&pc->timer, T303, CC_T303); newl3state(pc, 1); @@ -497,7 +497,7 @@ l3_1tr6_setup_rsp(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3DelTimer(&pc->timer); L3AddTimer(&pc->timer, T313, CC_T313); @@ -543,7 +543,7 @@ l3_1tr6_disconnect_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3AddTimer(&pc->timer, T305, CC_T305); } @@ -602,7 +602,7 @@ l3_1tr6_t305(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3AddTimer(&pc->timer, T308, CC_T308_1); } diff --git a/drivers/isdn/hisax/l3dss1.c b/drivers/isdn/hisax/l3dss1.c index cda700664e9c..18a3484b1f7e 100644 --- a/drivers/isdn/hisax/l3dss1.c +++ b/drivers/isdn/hisax/l3dss1.c @@ -525,7 +525,7 @@ l3dss1_message_cause(struct l3_process *pc, u_char mt, u_char cause) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); } @@ -551,7 +551,7 @@ l3dss1_status_send(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); } @@ -587,7 +587,7 @@ l3dss1_msg_without_setup(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); dss1_release_l3_process(pc); } @@ -944,7 +944,7 @@ l3dss1_msg_with_uus(struct l3_process *pc, u_char cmd) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); } /* l3dss1_msg_with_uus */ @@ -1420,7 +1420,7 @@ l3dss1_setup_req(struct l3_process *pc, u_char pr, l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); L3DelTimer(&pc->timer); L3AddTimer(&pc->timer, T303, CC_T303); newl3state(pc, 1); @@ -1786,7 +1786,7 @@ l3dss1_disconnect_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); newl3state(pc, 11); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3AddTimer(&pc->timer, T305, CC_T305); @@ -1848,7 +1848,7 @@ l3dss1_reject_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); pc->st->l3.l3l4(pc->st, CC_RELEASE | INDICATION, pc); newl3state(pc, 0); @@ -2145,7 +2145,7 @@ static void l3dss1_redir_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); } /* l3dss1_redir_req */ @@ -2216,7 +2216,7 @@ static int l3dss1_cmd_global(struct PStack *st, isdn_ctrl *ic) if (pc) dss1_release_l3_process(pc); return (-2); } - memcpy(skb_put(skb, l), temp, l); + skb_put_data(skb, temp, l); if (pc) { pc->prot.dss1.invoke_id = id; /* remember id */ @@ -2359,7 +2359,7 @@ l3dss1_t305(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); newl3state(pc, 19); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3AddTimer(&pc->timer, T308, CC_T308_1); @@ -2528,7 +2528,7 @@ l3dss1_suspend_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); newl3state(pc, 15); L3AddTimer(&pc->timer, T319, CC_T319); @@ -2603,7 +2603,7 @@ l3dss1_resume_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); newl3state(pc, 17); L3AddTimer(&pc->timer, T318, CC_T318); @@ -2721,7 +2721,7 @@ l3dss1_global_restart(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); newl3state(pc, 0); l3_msg(pc->st, DL_DATA | REQUEST, skb); } @@ -2929,7 +2929,7 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(proc->st, DL_DATA | REQUEST, skb); } else { if (st->l3.debug & L3_DEB_STATE) { diff --git a/drivers/isdn/hisax/l3ni1.c b/drivers/isdn/hisax/l3ni1.c index 8dc791bfaa6f..ea311e7df48e 100644 --- a/drivers/isdn/hisax/l3ni1.c +++ b/drivers/isdn/hisax/l3ni1.c @@ -454,7 +454,7 @@ l3ni1_message_plus_chid(struct l3_process *pc, u_char mt) if (!(skb = l3_alloc_skb(7))) return; - memcpy(skb_put(skb, 7), tmp, 7); + skb_put_data(skb, tmp, 7); l3_msg(pc->st, DL_DATA | REQUEST, skb); } @@ -475,7 +475,7 @@ l3ni1_message_cause(struct l3_process *pc, u_char mt, u_char cause) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); } @@ -501,7 +501,7 @@ l3ni1_status_send(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); } @@ -537,7 +537,7 @@ l3ni1_msg_without_setup(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); ni1_release_l3_process(pc); } @@ -894,7 +894,7 @@ l3ni1_msg_with_uus(struct l3_process *pc, u_char cmd) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); } /* l3ni1_msg_with_uus */ @@ -1274,7 +1274,7 @@ l3ni1_setup_req(struct l3_process *pc, u_char pr, { return; } - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); L3DelTimer(&pc->timer); L3AddTimer(&pc->timer, T303, CC_T303); newl3state(pc, 1); @@ -1640,7 +1640,7 @@ l3ni1_disconnect_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); newl3state(pc, 11); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3AddTimer(&pc->timer, T305, CC_T305); @@ -1704,7 +1704,7 @@ l3ni1_reject_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); pc->st->l3.l3l4(pc->st, CC_RELEASE | INDICATION, pc); newl3state(pc, 0); @@ -2001,7 +2001,7 @@ static void l3ni1_redir_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); } /* l3ni1_redir_req */ @@ -2076,7 +2076,7 @@ static int l3ni1_cmd_global(struct PStack *st, isdn_ctrl *ic) if (pc) ni1_release_l3_process(pc); return (-2); } - memcpy(skb_put(skb, l), temp, l); + skb_put_data(skb, temp, l); if (pc) { pc->prot.ni1.invoke_id = id; /* remember id */ @@ -2219,7 +2219,7 @@ l3ni1_t305(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); newl3state(pc, 19); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3AddTimer(&pc->timer, T308, CC_T308_1); @@ -2388,7 +2388,7 @@ l3ni1_suspend_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); newl3state(pc, 15); L3AddTimer(&pc->timer, T319, CC_T319); @@ -2463,7 +2463,7 @@ l3ni1_resume_req(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); newl3state(pc, 17); L3AddTimer(&pc->timer, T318, CC_T318); @@ -2582,7 +2582,7 @@ l3ni1_global_restart(struct l3_process *pc, u_char pr, void *arg) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); newl3state(pc, 0); l3_msg(pc->st, DL_DATA | REQUEST, skb); } @@ -2655,7 +2655,7 @@ static void l3ni1_SendSpid(struct l3_process *pc, u_char pr, struct sk_buff *skb *p++ = IE_SPID; *p++ = l; - memcpy(skb_put(skb, l), pSPID, l); + skb_put_data(skb, pSPID, l); newl3state(pc, iNewState); @@ -2873,7 +2873,7 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb) l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; - memcpy(skb_put(skb, l), tmp, l); + skb_put_data(skb, tmp, l); l3_msg(proc->st, DL_DATA | REQUEST, skb); } else { if (st->l3.debug & L3_DEB_STATE) { diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c index 233e432e06f6..b7f54fa29228 100644 --- a/drivers/isdn/hisax/netjet.c +++ b/drivers/isdn/hisax/netjet.c @@ -383,7 +383,7 @@ static void got_frame(struct BCState *bcs, int count) { if (!(skb = dev_alloc_skb(count))) printk(KERN_WARNING "TIGER: receive out of memory\n"); else { - memcpy(skb_put(skb, count), bcs->hw.tiger.rcvbuf, count); + skb_put_data(skb, bcs->hw.tiger.rcvbuf, count); skb_queue_tail(&bcs->rqueue, skb); } test_and_set_bit(B_RCVBUFREADY, &bcs->event); diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c index a0fdbc074b98..1cb9930d5e24 100644 --- a/drivers/isdn/hisax/st5481_usb.c +++ b/drivers/isdn/hisax/st5481_usb.c @@ -527,7 +527,7 @@ static void usb_in_complete(struct urb *urb) WARNING("receive out of memory\n"); break; } - memcpy(skb_put(skb, status), in->rcvbuf, status); + skb_put_data(skb, in->rcvbuf, status); in->hisax_if->l1l2(in->hisax_if, PH_DATA | INDICATION, skb); } else if (status == -HDLC_CRC_ERROR) { INFO("CRC error"); diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c index c99f0ec58a01..6f6733b7c1e4 100644 --- a/drivers/isdn/hisax/w6692.c +++ b/drivers/isdn/hisax/w6692.c @@ -309,7 +309,9 @@ W6692B_interrupt(struct IsdnCardState *cs, u_char bchan) if (!(skb = dev_alloc_skb(count))) printk(KERN_WARNING "W6692: Bchan receive out of memory\n"); else { - memcpy(skb_put(skb, count), bcs->hw.w6692.rcvbuf, count); + skb_put_data(skb, + bcs->hw.w6692.rcvbuf, + count); skb_queue_tail(&bcs->rqueue, skb); } } @@ -332,7 +334,8 @@ W6692B_interrupt(struct IsdnCardState *cs, u_char bchan) if (!(skb = dev_alloc_skb(W_B_FIFO_THRESH))) printk(KERN_WARNING "HiSax: receive out of memory\n"); else { - memcpy(skb_put(skb, W_B_FIFO_THRESH), bcs->hw.w6692.rcvbuf, W_B_FIFO_THRESH); + skb_put_data(skb, bcs->hw.w6692.rcvbuf, + W_B_FIFO_THRESH); skb_queue_tail(&bcs->rqueue, skb); } bcs->hw.w6692.rcvidx = 0; @@ -441,7 +444,7 @@ StartW6692: if (!(skb = alloc_skb(count, GFP_ATOMIC))) printk(KERN_WARNING "HiSax: D receive out of memory\n"); else { - memcpy(skb_put(skb, count), cs->rcvbuf, count); + skb_put_data(skb, cs->rcvbuf, count); skb_queue_tail(&cs->rq, skb); } } diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index 93bae94314a6..87119b517508 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c @@ -171,16 +171,16 @@ hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl, card->myid); return; } - memcpy(skb_put(skb, sizeof(__u16)), &len, sizeof(__u16)); - memcpy(skb_put(skb, sizeof(__u16)), &appl, sizeof(__u16)); + skb_put_data(skb, &len, sizeof(__u16)); + skb_put_data(skb, &appl, sizeof(__u16)); memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command)); memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand)); - memcpy(skb_put(skb, sizeof(__u16)), &MessageNumber, sizeof(__u16)); - memcpy(skb_put(skb, sizeof(__u16)), &MessageBufferSize, sizeof(__u16)); - memcpy(skb_put(skb, sizeof(__u16)), &(rp->level3cnt), sizeof(__u16)); - memcpy(skb_put(skb, sizeof(__u16)), &(rp->datablkcnt), sizeof(__u16)); - memcpy(skb_put(skb, sizeof(__u16)), &(rp->datablklen), sizeof(__u16)); - memcpy(skb_put(skb, slen), ExtFeatureDefaults, slen); + skb_put_data(skb, &MessageNumber, sizeof(__u16)); + skb_put_data(skb, &MessageBufferSize, sizeof(__u16)); + skb_put_data(skb, &(rp->level3cnt), sizeof(__u16)); + skb_put_data(skb, &(rp->datablkcnt), sizeof(__u16)); + skb_put_data(skb, &(rp->datablklen), sizeof(__u16)); + skb_put_data(skb, ExtFeatureDefaults, slen); hycapi_applications[appl - 1].ctrl_mask |= (1 << (ctrl->cnr - 1)); hycapi_send_message(ctrl, skb); } @@ -279,11 +279,11 @@ static void hycapi_release_internal(struct capi_ctr *ctrl, __u16 appl) card->myid); return; } - memcpy(skb_put(skb, sizeof(__u16)), &len, sizeof(__u16)); - memcpy(skb_put(skb, sizeof(__u16)), &appl, sizeof(__u16)); + skb_put_data(skb, &len, sizeof(__u16)); + skb_put_data(skb, &appl, sizeof(__u16)); memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command)); memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand)); - memcpy(skb_put(skb, sizeof(__u16)), &MessageNumber, sizeof(__u16)); + skb_put_data(skb, &MessageNumber, sizeof(__u16)); hycapi_send_message(ctrl, skb); hycapi_applications[appl - 1].ctrl_mask &= ~(1 << (ctrl->cnr - 1)); } @@ -557,10 +557,9 @@ hycapi_rx_capipkt(hysdn_card *card, unsigned char *buf, unsigned short len) card->myid); return; } - memcpy(skb_put(skb, MsgLen), buf, MsgLen); - memcpy(skb_put(skb, 2 * sizeof(__u32)), CP64, 2 * sizeof(__u32)); - memcpy(skb_put(skb, len - MsgLen), buf + MsgLen, - len - MsgLen); + skb_put_data(skb, buf, MsgLen); + skb_put_data(skb, CP64, 2 * sizeof(__u32)); + skb_put_data(skb, buf + MsgLen, len - MsgLen); CAPIMSG_SETLEN(skb->data, 30); } else { if (!(skb = alloc_skb(len, GFP_ATOMIC))) { @@ -568,7 +567,7 @@ hycapi_rx_capipkt(hysdn_card *card, unsigned char *buf, unsigned short len) card->myid); return; } - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); } switch (CAPIMSG_CMD(skb->data)) { diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index b93a4e9a8d34..8e9c34f33d86 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c @@ -201,7 +201,7 @@ hysdn_rx_netpkt(hysdn_card *card, unsigned char *buf, unsigned short len) return; } /* copy the data */ - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); /* determine the used protocol */ skb->protocol = eth_type_trans(skb, dev); diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 8aa158a09180..9ce23cf3d7d2 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c @@ -2258,8 +2258,7 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto, /* Now stuff remaining bytes */ if (len) { - p = skb_put(skb, len); - memcpy(p, data, len); + p = skb_put_data(skb, data, len); } /* skb is now ready for xmit */ diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index ddd8207e4e54..d30130c8d0f3 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -474,7 +474,7 @@ isdn_tty_senddown(modem_info *info) return; } skb_reserve(skb, skb_res); - memcpy(skb_put(skb, buflen), info->port.xmit_buf, buflen); + skb_put_data(skb, info->port.xmit_buf, buflen); info->xmit_count = 0; #ifdef CONFIG_ISDN_AUDIO if (info->vonline & 2) { diff --git a/drivers/isdn/i4l/isdn_v110.c b/drivers/isdn/i4l/isdn_v110.c index 52827a80c51f..8b74ce412524 100644 --- a/drivers/isdn/i4l/isdn_v110.c +++ b/drivers/isdn/i4l/isdn_v110.c @@ -421,7 +421,7 @@ isdn_v110_sync(isdn_v110_stream *v) } if ((skb = dev_alloc_skb(v->framelen + v->skbres))) { skb_reserve(skb, v->skbres); - memcpy(skb_put(skb, v->framelen), v->OfflineFrame, v->framelen); + skb_put_data(skb, v->OfflineFrame, v->framelen); } return skb; } @@ -441,7 +441,7 @@ isdn_v110_idle(isdn_v110_stream *v) } if ((skb = dev_alloc_skb(v->framelen + v->skbres))) { skb_reserve(skb, v->skbres); - memcpy(skb_put(skb, v->framelen), v->OnlineFrame, v->framelen); + skb_put_data(skb, v->OnlineFrame, v->framelen); } return skb; } @@ -486,7 +486,7 @@ isdn_v110_encode(isdn_v110_stream *v, struct sk_buff *skb) } skb_reserve(nskb, v->skbres + sizeof(int)); if (skb->len == 0) { - memcpy(skb_put(nskb, v->framelen), v->OnlineFrame, v->framelen); + skb_put_data(nskb, v->OnlineFrame, v->framelen); *((int *)skb_push(nskb, sizeof(int))) = 0; return nskb; } diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index ef9c8e4f1fa2..7ac7badb8f55 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c @@ -479,7 +479,7 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch) } if (ch >= 0) sprintf(skb_put(skb, 3), "%02d;", ch); - memcpy(skb_put(skb, strlen(s)), s, strlen(s)); + skb_put_data(skb, s, strlen(s)); skb_queue_tail(&card->dqueue, skb); return 0; } diff --git a/drivers/isdn/mISDN/dsp_cmx.c b/drivers/isdn/mISDN/dsp_cmx.c index 8e3aa002767b..d4b6f01a3f0e 100644 --- a/drivers/isdn/mISDN/dsp_cmx.c +++ b/drivers/isdn/mISDN/dsp_cmx.c @@ -1595,8 +1595,7 @@ send_packet: thh = mISDN_HEAD_P(txskb); thh->prim = DL_DATA_REQ; thh->id = 0; - memcpy(skb_put(txskb, len), nskb->data + preload, - len); + skb_put_data(txskb, nskb->data + preload, len); /* queue (trigger later) */ skb_queue_tail(&dsp->sendq, txskb); } diff --git a/drivers/isdn/mISDN/layer2.c b/drivers/isdn/mISDN/layer2.c index 5eb380a25903..7243a6746f8b 100644 --- a/drivers/isdn/mISDN/layer2.c +++ b/drivers/isdn/mISDN/layer2.c @@ -176,7 +176,7 @@ l2up_create(struct layer2 *l2, u_int prim, int len, void *arg) hh->prim = prim; hh->id = (l2->ch.nr << 16) | l2->ch.addr; if (len) - memcpy(skb_put(skb, len), arg, len); + skb_put_data(skb, arg, len); err = l2->up->send(l2->up, skb); if (err) { printk(KERN_WARNING "%s: dev %s err=%d\n", __func__, @@ -235,7 +235,7 @@ l2down_create(struct layer2 *l2, u_int prim, u_int id, int len, void *arg) hh->prim = prim; hh->id = id; if (len) - memcpy(skb_put(skb, len), arg, len); + skb_put_data(skb, arg, len); err = l2down_raw(l2, skb); if (err) dev_kfree_skb(skb); @@ -640,7 +640,7 @@ send_uframe(struct layer2 *l2, struct sk_buff *skb, u_char cmd, u_char cr) return; } } - memcpy(skb_put(skb, i), tmp, i); + skb_put_data(skb, tmp, i); enqueue_super(l2, skb); } @@ -1125,7 +1125,7 @@ enquiry_cr(struct layer2 *l2, u_char typ, u_char cr, u_char pf) mISDNDevName4ch(&l2->ch), __func__); return; } - memcpy(skb_put(skb, i), tmp, i); + skb_put_data(skb, tmp, i); enqueue_super(l2, skb); } diff --git a/drivers/isdn/mISDN/tei.c b/drivers/isdn/mISDN/tei.c index 592f597d8951..908127efccf8 100644 --- a/drivers/isdn/mISDN/tei.c +++ b/drivers/isdn/mISDN/tei.c @@ -312,7 +312,7 @@ teiup_create(struct manager *mgr, u_int prim, int len, void *arg) hh->prim = prim; hh->id = (mgr->ch.nr << 16) | mgr->ch.addr; if (len) - memcpy(skb_put(skb, len), arg, len); + skb_put_data(skb, arg, len); err = mgr->up->send(mgr->up, skb); if (err) { printk(KERN_WARNING "%s: err=%d\n", __func__, err); diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index 9947b342633e..bbaf0a8cae8b 100644 --- a/drivers/media/dvb-core/dvb_net.c +++ b/drivers/media/dvb-core/dvb_net.c @@ -828,8 +828,7 @@ static void dvb_net_ule(struct net_device *dev, const u8 *buf, size_t buf_len) /* Copy data into our current skb. */ h.how_much = min(h.priv->ule_sndu_remain, (int)h.ts_remain); - memcpy(skb_put(h.priv->ule_skb, h.how_much), - h.from_where, h.how_much); + skb_put_data(h.priv->ule_skb, h.from_where, h.how_much); h.priv->ule_sndu_remain -= h.how_much; h.ts_remain -= h.how_much; h.from_where += h.how_much; diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index 588e2d61c3b4..c67e055a12c9 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c @@ -442,7 +442,7 @@ static int fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, fm_cb(skb)->fm_op = *((u8 *)payload + 2); } if (payload != NULL) - memcpy(skb_put(skb, payload_len), payload, payload_len); + skb_put_data(skb, payload, payload_len); fm_cb(skb)->completion = wait_completion; skb_queue_tail(&fmdev->tx_q, skb); diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 00051590e00f..eda8d407be28 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -262,7 +262,7 @@ void st_int_recv(void *disc_data, while (count) { if (st_gdata->rx_count) { len = min_t(unsigned int, st_gdata->rx_count, count); - memcpy(skb_put(st_gdata->rx_skb, len), ptr, len); + skb_put_data(st_gdata->rx_skb, ptr, len); st_gdata->rx_count -= len; count -= len; ptr += len; diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index bf0d7708beac..e74413f882ab 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -152,7 +152,7 @@ static void kim_int_recv(struct kim_data_s *kim_gdata, while (count) { if (kim_gdata->rx_count) { len = min_t(unsigned int, kim_gdata->rx_count, count); - memcpy(skb_put(kim_gdata->rx_skb, len), ptr, len); + skb_put_data(kim_gdata->rx_skb, ptr, len); kim_gdata->rx_count -= len; count -= len; ptr += len; diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 7d7a3cec149a..b796db7dd621 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -936,8 +936,7 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[], if (!skb) return; - data = skb_put(skb, size); - memcpy(data, &pkt, size); + data = skb_put_data(skb, &pkt, size); skb_reset_mac_header(skb); skb->network_header = skb->mac_header + ETH_HLEN; diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c index 71a7c3b44fdd..4534326e20ac 100644 --- a/drivers/net/caif/caif_hsi.c +++ b/drivers/net/caif/caif_hsi.c @@ -454,8 +454,7 @@ static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi) } caif_assert(skb != NULL); - dst = skb_put(skb, len); - memcpy(dst, pfrm, len); + dst = skb_put_data(skb, pfrm, len); skb->protocol = htons(ETH_P_CAIF); skb_reset_mac_header(skb); @@ -585,8 +584,7 @@ static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi) } caif_assert(skb != NULL); - dst = skb_put(skb, len); - memcpy(dst, pcffrm, len); + dst = skb_put_data(skb, pcffrm, len); skb->protocol = htons(ETH_P_CAIF); skb_reset_mac_header(skb); diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 76e1d3545105..5c57be2082ba 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c @@ -198,8 +198,7 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data, skb = netdev_alloc_skb(ser->dev, count+1); if (skb == NULL) return; - p = skb_put(skb, count); - memcpy(p, data, count); + p = skb_put_data(skb, data, count); skb->protocol = htons(ETH_P_CAIF); skb_reset_mac_header(skb); diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c index fc21afe852b9..24a5f5ca2037 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c @@ -548,8 +548,7 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len) skb = netdev_alloc_skb(cfspi->ndev, pkt_len + 1); caif_assert(skb != NULL); - dst = skb_put(skb, pkt_len); - memcpy(dst, src, pkt_len); + dst = skb_put_data(skb, src, pkt_len); src += pkt_len; skb->protocol = htons(ETH_P_CAIF); diff --git a/drivers/net/caif/caif_virtio.c b/drivers/net/caif/caif_virtio.c index 1794ea0420b7..c3d104feee13 100644 --- a/drivers/net/caif/caif_virtio.c +++ b/drivers/net/caif/caif_virtio.c @@ -242,7 +242,7 @@ static struct sk_buff *cfv_alloc_and_copy_skb(int *err, skb_reserve(skb, cfv->rx_hr + pad_len); - memcpy(skb_put(skb, cfpkt_len), frm + cfv->rx_hr, cfpkt_len); + skb_put_data(skb, frm + cfv->rx_hr, cfpkt_len); return skb; } diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 6a6e896e52fa..5d067c1b987f 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c @@ -216,8 +216,7 @@ static void slc_bump(struct slcan *sl) can_skb_prv(skb)->ifindex = sl->dev->ifindex; can_skb_prv(skb)->skbcnt = 0; - memcpy(skb_put(skb, sizeof(struct can_frame)), - &cf, sizeof(struct can_frame)); + skb_put_data(skb, &cf, sizeof(struct can_frame)); sl->dev->stats.rx_packets++; sl->dev->stats.rx_bytes += cf.can_dlc; diff --git a/drivers/net/ethernet/3com/3c515.c b/drivers/net/ethernet/3com/3c515.c index e7b1fa56b290..c5987f518cb2 100644 --- a/drivers/net/ethernet/3com/3c515.c +++ b/drivers/net/ethernet/3com/3c515.c @@ -1370,9 +1370,9 @@ static int boomerang_rx(struct net_device *dev) (skb = netdev_alloc_skb(dev, pkt_len + 4)) != NULL) { skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ /* 'skb_put()' points to the start of sk_buff data area. */ - memcpy(skb_put(skb, pkt_len), - isa_bus_to_virt(vp->rx_ring[entry]. - addr), pkt_len); + skb_put_data(skb, + isa_bus_to_virt(vp->rx_ring[entry].addr), + pkt_len); rx_copy++; } else { void *temp; diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 14cff6017756..3b516ebeeddb 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c @@ -2628,9 +2628,8 @@ boomerang_rx(struct net_device *dev) skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ pci_dma_sync_single_for_cpu(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); /* 'skb_put()' points to the start of sk_buff data area. */ - memcpy(skb_put(skb, pkt_len), - vp->rx_skbuff[entry]->data, - pkt_len); + skb_put_data(skb, vp->rx_skbuff[entry]->data, + pkt_len); pci_dma_sync_single_for_device(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); vp->rx_copy++; } else { diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index d8e133ced7b8..4309be3724ad 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c @@ -807,7 +807,8 @@ static int greth_rx(struct net_device *dev, int limit) if (netif_msg_pktdata(greth)) greth_print_rx_packet(phys_to_virt(dma_addr), pkt_len); - memcpy(skb_put(skb, pkt_len), phys_to_virt(dma_addr), pkt_len); + skb_put_data(skb, phys_to_virt(dma_addr), + pkt_len); skb->protocol = eth_type_trans(skb, dev); dev->stats.rx_bytes += pkt_len; diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c index 87a11b9f0ea5..54eff90e2f02 100644 --- a/drivers/net/ethernet/agere/et131x.c +++ b/drivers/net/ethernet/agere/et131x.c @@ -2282,7 +2282,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter) adapter->netdev->stats.rx_bytes += rfd->len; - memcpy(skb_put(skb, rfd->len), fbr->virt[buff_index], rfd->len); + skb_put_data(skb, fbr->virt[buff_index], rfd->len); skb->protocol = eth_type_trans(skb, adapter->netdev); skb->ip_summed = CHECKSUM_NONE; diff --git a/drivers/net/ethernet/apple/macmace.c b/drivers/net/ethernet/apple/macmace.c index 857df9c45f04..f17a160dbff2 100644 --- a/drivers/net/ethernet/apple/macmace.c +++ b/drivers/net/ethernet/apple/macmace.c @@ -663,7 +663,7 @@ static void mace_dma_rx_frame(struct net_device *dev, struct mace_frame *mf) return; } skb_reserve(skb, 2); - memcpy(skb_put(skb, frame_length), mf->data, frame_length); + skb_put_data(skb, mf->data, frame_length); skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c index 5711fbbd6ae3..041cfb7952f8 100644 --- a/drivers/net/ethernet/aurora/nb8800.c +++ b/drivers/net/ethernet/aurora/nb8800.c @@ -251,7 +251,7 @@ static void nb8800_receive(struct net_device *dev, unsigned int i, if (len <= RX_COPYBREAK) { dma_sync_single_for_cpu(&dev->dev, dma, len, DMA_FROM_DEVICE); - memcpy(skb_put(skb, len), data, len); + skb_put_data(skb, data, len); dma_sync_single_for_device(&dev->dev, dma, len, DMA_FROM_DEVICE); } else { @@ -264,7 +264,7 @@ static void nb8800_receive(struct net_device *dev, unsigned int i, } dma_unmap_page(&dev->dev, dma, RX_BUF_SIZE, DMA_FROM_DEVICE); - memcpy(skb_put(skb, RX_COPYHDR), data, RX_COPYHDR); + skb_put_data(skb, data, RX_COPYHDR); skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, offset + RX_COPYHDR, len - RX_COPYHDR, RX_BUF_SIZE); diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 91f7492623d3..4b0168bcbc8a 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -2992,7 +2992,7 @@ static void at91ether_rx(struct net_device *dev) skb = netdev_alloc_skb(dev, pktlen + 2); if (skb) { skb_reserve(skb, 2); - memcpy(skb_put(skb, pktlen), p_recv, pktlen); + skb_put_data(skb, p_recv, pktlen); skb->protocol = eth_type_trans(skb, dev); dev->stats.rx_packets++; diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_network.h b/drivers/net/ethernet/cavium/liquidio/octeon_network.h index bf483932ff25..4b3507972243 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_network.h +++ b/drivers/net/ethernet/cavium/liquidio/octeon_network.h @@ -443,8 +443,8 @@ static inline void octeon_fast_packet_next(struct octeon_droq *droq, int copy_len, int idx) { - memcpy(skb_put(nicbuf, copy_len), - get_rbd(droq->recv_buf_list[idx].buffer), copy_len); + skb_put_data(nicbuf, get_rbd(droq->recv_buf_list[idx].buffer), + copy_len); } /** diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c index da5b58b853e2..410a0a95130b 100644 --- a/drivers/net/ethernet/cirrus/cs89x0.c +++ b/drivers/net/ethernet/cirrus/cs89x0.c @@ -450,11 +450,10 @@ skip_this_frame: if (bp + length > lp->end_dma_buff) { int semi_cnt = lp->end_dma_buff - bp; - memcpy(skb_put(skb, semi_cnt), bp, semi_cnt); - memcpy(skb_put(skb, length - semi_cnt), lp->dma_buff, - length - semi_cnt); + skb_put_data(skb, bp, semi_cnt); + skb_put_data(skb, lp->dma_buff, length - semi_cnt); } else { - memcpy(skb_put(skb, length), bp, length); + skb_put_data(skb, bp, length); } bp += (length + 3) & ~3; if (bp >= lp->end_dma_buff) diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c index fd6bcf024729..47be5018d35d 100644 --- a/drivers/net/ethernet/dec/tulip/de4x5.c +++ b/drivers/net/ethernet/dec/tulip/de4x5.c @@ -3624,10 +3624,10 @@ de4x5_alloc_rx_buff(struct net_device *dev, int index, int len) skb_reserve(p, 2); /* Align */ if (index < lp->rx_old) { /* Wrapped buffer */ short tlen = (lp->rxRingSize - lp->rx_old) * RX_BUFF_SZ; - memcpy(skb_put(p,tlen),lp->rx_bufs + lp->rx_old * RX_BUFF_SZ,tlen); - memcpy(skb_put(p,len-tlen),lp->rx_bufs,len-tlen); + skb_put_data(p, lp->rx_bufs + lp->rx_old * RX_BUFF_SZ, tlen); + skb_put_data(p, lp->rx_bufs, len - tlen); } else { /* Linear buffer */ - memcpy(skb_put(p,len),lp->rx_bufs + lp->rx_old * RX_BUFF_SZ,len); + skb_put_data(p, lp->rx_bufs + lp->rx_old * RX_BUFF_SZ, len); } return p; diff --git a/drivers/net/ethernet/dec/tulip/interrupt.c b/drivers/net/ethernet/dec/tulip/interrupt.c index ba6ae24acf62..8df80880ecaa 100644 --- a/drivers/net/ethernet/dec/tulip/interrupt.c +++ b/drivers/net/ethernet/dec/tulip/interrupt.c @@ -218,9 +218,9 @@ int tulip_poll(struct napi_struct *napi, int budget) pkt_len); skb_put(skb, pkt_len); #else - memcpy(skb_put(skb, pkt_len), - tp->rx_buffers[entry].skb->data, - pkt_len); + skb_put_data(skb, + tp->rx_buffers[entry].skb->data, + pkt_len); #endif pci_dma_sync_single_for_device(tp->pdev, tp->rx_buffers[entry].mapping, @@ -444,9 +444,9 @@ static int tulip_rx(struct net_device *dev) pkt_len); skb_put(skb, pkt_len); #else - memcpy(skb_put(skb, pkt_len), - tp->rx_buffers[entry].skb->data, - pkt_len); + skb_put_data(skb, + tp->rx_buffers[entry].skb->data, + pkt_len); #endif pci_dma_sync_single_for_device(tp->pdev, tp->rx_buffers[entry].mapping, diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c index 8d98b259d1ba..7fc248efc4ba 100644 --- a/drivers/net/ethernet/dec/tulip/uli526x.c +++ b/drivers/net/ethernet/dec/tulip/uli526x.c @@ -864,9 +864,9 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info skb = new_skb; /* size less than COPY_SIZE, allocate a rxlen SKB */ skb_reserve(skb, 2); /* 16byte align */ - memcpy(skb_put(skb, rxlen), - skb_tail_pointer(rxptr->rx_skb_ptr), - rxlen); + skb_put_data(skb, + skb_tail_pointer(rxptr->rx_skb_ptr), + rxlen); uli526x_reuse_skb(db, rxptr->rx_skb_ptr); } else skb_put(skb, rxlen); diff --git a/drivers/net/ethernet/ec_bhf.c b/drivers/net/ethernet/ec_bhf.c index 278f139f2a22..4ee042c034a1 100644 --- a/drivers/net/ethernet/ec_bhf.c +++ b/drivers/net/ethernet/ec_bhf.c @@ -223,7 +223,7 @@ static void ec_bhf_process_rx(struct ec_bhf_priv *priv) skb = netdev_alloc_skb_ip_align(priv->net_dev, pkt_size); if (skb) { - memcpy(skb_put(skb, pkt_size), data, pkt_size); + skb_put_data(skb, data, pkt_size); skb->protocol = eth_type_trans(skb, priv->net_dev); priv->stat_rx_bytes += pkt_size; diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c index 610f9c07c21d..e92859dab7ae 100644 --- a/drivers/net/ethernet/fealnx.c +++ b/drivers/net/ethernet/fealnx.c @@ -1711,8 +1711,8 @@ static int netdev_rx(struct net_device *dev) np->cur_rx->skbuff->data, pkt_len); skb_put(skb, pkt_len); #else - memcpy(skb_put(skb, pkt_len), - np->cur_rx->skbuff->data, pkt_len); + skb_put_data(skb, np->cur_rx->skbuff->data, + pkt_len); #endif pci_dma_sync_single_for_device(np->pci_dev, np->cur_rx->buffer, diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c index 945883842533..d719668a6684 100644 --- a/drivers/net/ethernet/i825xx/82596.c +++ b/drivers/net/ethernet/i825xx/82596.c @@ -809,7 +809,8 @@ memory_squeeze: if (!rx_in_place) { /* 16 byte align the data fields */ skb_reserve(skb, 2); - memcpy(skb_put(skb,pkt_len), rbd->v_data, pkt_len); + skb_put_data(skb, rbd->v_data, + pkt_len); } skb->protocol=eth_type_trans(skb,dev); skb->len = pkt_len; diff --git a/drivers/net/ethernet/i825xx/lib82596.c b/drivers/net/ethernet/i825xx/lib82596.c index e86773325cbe..8449c58f01fd 100644 --- a/drivers/net/ethernet/i825xx/lib82596.c +++ b/drivers/net/ethernet/i825xx/lib82596.c @@ -727,7 +727,8 @@ memory_squeeze: dma_sync_single_for_cpu(dev->dev.parent, (dma_addr_t)SWAP32(rbd->b_data), PKT_BUF_SZ, DMA_FROM_DEVICE); - memcpy(skb_put(skb, pkt_len), rbd->v_data, pkt_len); + skb_put_data(skb, rbd->v_data, + pkt_len); dma_sync_single_for_device(dev->dev.parent, (dma_addr_t)SWAP32(rbd->b_data), PKT_BUF_SZ, DMA_FROM_DEVICE); diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index bd8b05fe8258..98375e1e1185 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -4345,7 +4345,7 @@ static struct sk_buff *e1000_copybreak(struct e1000_adapter *adapter, dma_sync_single_for_cpu(&adapter->pdev->dev, buffer_info->dma, length, DMA_FROM_DEVICE); - memcpy(skb_put(skb, length), data, length); + skb_put_data(skb, data, length); return skb; } diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index d297011b535d..0aab74c2a209 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -1976,9 +1976,8 @@ err_drop_frame: MVNETA_MH_SIZE + NET_SKB_PAD, rx_bytes, DMA_FROM_DEVICE); - memcpy(skb_put(skb, rx_bytes), - data + MVNETA_MH_SIZE + NET_SKB_PAD, - rx_bytes); + skb_put_data(skb, data + MVNETA_MH_SIZE + NET_SKB_PAD, + rx_bytes); skb->protocol = eth_type_trans(skb, dev); mvneta_rx_csum(pp, rx_status, skb); @@ -2103,9 +2102,8 @@ err_drop_frame: MVNETA_MH_SIZE + NET_SKB_PAD, rx_bytes, DMA_FROM_DEVICE); - memcpy(skb_put(skb, rx_bytes), - data + MVNETA_MH_SIZE + NET_SKB_PAD, - rx_bytes); + skb_put_data(skb, data + MVNETA_MH_SIZE + NET_SKB_PAD, + rx_bytes); skb->protocol = eth_type_trans(skb, dev); mvneta_rx_csum(pp, rx_status, skb); diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index ee1c78abab0b..e798fbe08600 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -5020,8 +5020,7 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw, */ skb_reserve(skb, 2); - memcpy(skb_put(skb, packet_len), - dma_buf->skb->data, packet_len); + skb_put_data(skb, dma_buf->skb->data, packet_len); } while (0); skb->protocol = eth_type_trans(skb, dev); diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 9c7ffd649e9a..828bfd93cb54 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c @@ -959,11 +959,10 @@ static int __lpc_handle_recv(struct net_device *ndev, int budget) if (!skb) { ndev->stats.rx_dropped++; } else { - prdbuf = skb_put(skb, len); - /* Copy packet from buffer */ - memcpy(prdbuf, pldat->rx_buff_v + - rxconsidx * ENET_MAXF_SIZE, len); + prdbuf = skb_put_data(skb, + pldat->rx_buff_v + rxconsidx * ENET_MAXF_SIZE, + len); /* Pass to upper layer */ skb->protocol = eth_type_trans(skb, ndev); diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c index 892eb98290f6..6fc854b120b0 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c @@ -1079,8 +1079,7 @@ static struct sk_buff *qede_rx_allocate_skb(struct qede_dev *edev, * re-use the already allcoated & mapped memory. */ if (len + pad <= edev->rx_copybreak) { - memcpy(skb_put(skb, len), - page_address(page) + offset, len); + skb_put_data(skb, page_address(page) + offset, len); qede_reuse_page(rxq, bd); goto out; } diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 1188d420fe53..9feec7009443 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c @@ -1577,7 +1577,7 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, rx_ring->rx_dropped++; goto err_out; } - memcpy(skb_put(skb, hlen), addr, hlen); + skb_put_data(skb, addr, hlen); netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, "%d bytes of headers and data in large. Chain page to new skb and pull tail.\n", length); @@ -1654,7 +1654,7 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev, dma_unmap_len(sbq_desc, maplen), PCI_DMA_FROMDEVICE); - memcpy(skb_put(new_skb, length), skb->data, length); + skb_put_data(new_skb, skb->data, length); pci_dma_sync_single_for_device(qdev->pdev, dma_unmap_addr(sbq_desc, mapaddr), @@ -1817,8 +1817,7 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev, dma_unmap_len (sbq_desc, maplen), PCI_DMA_FROMDEVICE); - memcpy(skb_put(skb, length), - sbq_desc->p.skb->data, length); + skb_put_data(skb, sbq_desc->p.skb->data, length); pci_dma_sync_single_for_device(qdev->pdev, dma_unmap_addr (sbq_desc, diff --git a/drivers/net/ethernet/silan/sc92031.c b/drivers/net/ethernet/silan/sc92031.c index 751c81848f35..c07fd594fe71 100644 --- a/drivers/net/ethernet/silan/sc92031.c +++ b/drivers/net/ethernet/silan/sc92031.c @@ -795,12 +795,12 @@ static void _sc92031_rx_tasklet(struct net_device *dev) } if ((rx_ring_offset + pkt_size) > RX_BUF_LEN) { - memcpy(skb_put(skb, RX_BUF_LEN - rx_ring_offset), - rx_ring + rx_ring_offset, RX_BUF_LEN - rx_ring_offset); - memcpy(skb_put(skb, pkt_size - (RX_BUF_LEN - rx_ring_offset)), - rx_ring, pkt_size - (RX_BUF_LEN - rx_ring_offset)); + skb_put_data(skb, rx_ring + rx_ring_offset, + RX_BUF_LEN - rx_ring_offset); + skb_put_data(skb, rx_ring, + pkt_size - (RX_BUF_LEN - rx_ring_offset)); } else { - memcpy(skb_put(skb, pkt_size), rx_ring + rx_ring_offset, pkt_size); + skb_put_data(skb, rx_ring + rx_ring_offset, pkt_size); } skb->protocol = eth_type_trans(skb, dev); diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index b56e07fa44a8..750954be5a74 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -1156,8 +1156,7 @@ static int fjes_poll(struct napi_struct *napi, int budget) hw->ep_shm_info[cur_epid].net_stats .rx_errors += 1; } else { - memcpy(skb_put(skb, frame_len), - frame, frame_len); + skb_put_data(skb, frame, frame_len); skb->protocol = eth_type_trans(skb, netdev); skb->ip_summed = CHECKSUM_UNNECESSARY; diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 4a40a3d825b4..aec6c26563cf 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -298,7 +298,7 @@ static void ax_bump(struct mkiss *ax) return; } - memcpy(skb_put(skb,count), ax->rbuff, count); + skb_put_data(skb, ax->rbuff, count); skb->protocol = ax25_type_trans(skb, ax->dev); netif_rx(skb); ax->dev->stats.rx_packets++; diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c index 1ce6239a4849..7683fd544344 100644 --- a/drivers/net/hippi/rrunner.c +++ b/drivers/net/hippi/rrunner.c @@ -962,8 +962,8 @@ static void rx_int(struct net_device *dev, u32 rxlimit, u32 index) pkt_len, PCI_DMA_FROMDEVICE); - memcpy(skb_put(skb, pkt_len), - rx_skb->data, pkt_len); + skb_put_data(skb, rx_skb->data, + pkt_len); pci_dma_sync_single_for_device(rrpriv->pci_dev, desc->addr.addrlo, diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index b65a97ecb78e..9a6c5864bc04 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -593,7 +593,7 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, * Copy to skb. This copy is needed here since the memory pointed by * hv_netvsc_packet cannot be deallocated */ - memcpy(skb_put(skb, buflen), data, buflen); + skb_put_data(skb, data, buflen); skb->protocol = eth_type_trans(skb, net); diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 76ba7ecfe142..548d9d026a85 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -723,7 +723,7 @@ at86rf230_rx_read_frame_complete(void *context) return; } - memcpy(skb_put(skb, len), buf + 2, len); + skb_put_data(skb, buf + 2, len); ieee802154_rx_irqsafe(lp->hw, skb, lqi); kfree(ctx); } diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c index 7a218549c80a..a626c539fb17 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -1875,7 +1875,7 @@ static int ca8210_skb_rx( copy_payload: /* Add bytes of space to the back of the buffer */ /* Copy msdu to skb */ - memcpy(skb_put(skb, msdulen), &data_ind[29], msdulen); + skb_put_data(skb, &data_ind[29], msdulen); ieee802154_rx_irqsafe(hw, skb, mpdulinkquality); return 0; diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c index bd63289c55e8..7d334963dc08 100644 --- a/drivers/net/ieee802154/mrf24j40.c +++ b/drivers/net/ieee802154/mrf24j40.c @@ -774,7 +774,7 @@ static void mrf24j40_handle_rx_read_buf_complete(void *context) return; } - memcpy(skb_put(skb, len), rx_local_buf, len); + skb_put_data(skb, rx_local_buf, len); ieee802154_rx_irqsafe(devrec->hw, skb, 0); #ifdef DEBUG diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 23ed89ae5ddc..19a55cba6beb 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c @@ -1459,7 +1459,7 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self) /* Make sure IP header gets aligned */ skb_reserve(skb, 1); - memcpy(skb_put(skb, len), self->rx_buff.data, len); + skb_put_data(skb, self->rx_buff.data, len); self->netdev->stats.rx_packets++; self->netdev->stats.rx_bytes += len; diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index 15b920086251..6638784c082e 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c @@ -578,7 +578,7 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd) skb = rd->skb; rd->skb = NULL; skb->dev = ndev; - memcpy(skb_put(skb,len), rd->buf, len); + skb_put_data(skb, rd->buf, len); skb_reset_mac_header(skb); if (in_interrupt()) netif_rx(skb); diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c index feb9569e3345..32c72db654e2 100644 --- a/drivers/net/ppp/ppp_async.c +++ b/drivers/net/ppp/ppp_async.c @@ -894,8 +894,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, /* packet overflowed MRU */ ap->state |= SC_TOSS; } else { - sp = skb_put(skb, n); - memcpy(sp, buf, n); + sp = skb_put_data(skb, buf, n); if (ap->state & SC_ESCAPE) { sp[0] ^= PPP_TRANS; ap->state &= ~SC_ESCAPE; diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c index 9ae53986cb4a..ce2300c0bcbf 100644 --- a/drivers/net/ppp/ppp_synctty.c +++ b/drivers/net/ppp/ppp_synctty.c @@ -697,8 +697,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, goto err; } - p = skb_put(skb, count); - memcpy(p, buf, count); + p = skb_put_data(skb, buf, count); /* strip address/control field if present */ p = skb->data; diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index 74b907206aa7..436dd78c396a 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c @@ -364,7 +364,7 @@ static void sl_bump(struct slip *sl) return; } skb->dev = dev; - memcpy(skb_put(skb, count), sl->rbuff, count); + skb_put_data(skb, sl->rbuff, count); skb_reset_mac_header(skb); skb->protocol = htons(ETH_P_IP); netif_rx_ni(skb); diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c index 125cff57c759..90facc5ecab0 100644 --- a/drivers/net/usb/asix_common.c +++ b/drivers/net/usb/asix_common.c @@ -167,8 +167,8 @@ int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb, } if (rx->ax_skb) { - data = skb_put(rx->ax_skb, copy_length); - memcpy(data, skb->data + offset, copy_length); + data = skb_put_data(rx->ax_skb, skb->data + offset, + copy_length); if (!rx->remaining) usbnet_skb_return(dev, rx->ax_skb); } diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index c7a350bbaaa7..2952cb570996 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -162,7 +162,7 @@ static void rx_complete(struct urb *req) skb = pnd->rx_skb = netdev_alloc_skb(dev, 12); if (likely(skb)) { /* Can't use pskb_pull() on page in IRQ */ - memcpy(skb_put(skb, 1), page_address(page), 1); + skb_put_data(skb, page_address(page), 1); skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, 1, req->actual_length, PAGE_SIZE); diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index a6b997cffd3b..18fa45fc979b 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c @@ -399,7 +399,7 @@ static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_ memcpy(eth_hdr(skb)->h_dest, dev->net->dev_addr, ETH_ALEN); /* add datagram */ - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); /* map MBIM session to VLAN */ if (tci) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 7f02954772c6..8a4c8a1b9dd3 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1180,7 +1180,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) ndp16->dpe16[index].wDatagramLength = cpu_to_le16(skb->len); ndp16->dpe16[index].wDatagramIndex = cpu_to_le16(skb_out->len); ndp16->wLength = cpu_to_le16(ndplen + sizeof(struct usb_cdc_ncm_dpe16)); - memcpy(skb_put(skb_out, skb->len), skb->data, skb->len); + skb_put_data(skb_out, skb->data, skb->len); ctx->tx_curr_frame_payload += skb->len; /* count real tx payload data */ dev_kfree_skb_any(skb); skb = NULL; @@ -1229,7 +1229,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data; cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max); nth16->wNdpIndex = cpu_to_le16(skb_out->len); - memcpy(skb_put(skb_out, ctx->max_ndp_size), ctx->delayed_ndp16, ctx->max_ndp_size); + skb_put_data(skb_out, ctx->delayed_ndp16, ctx->max_ndp_size); /* Zero out delayed NDP - signature checking will naturally fail. */ ndp16 = memset(ctx->delayed_ndp16, 0, ctx->max_ndp_size); @@ -1497,7 +1497,7 @@ next_ndp: skb = netdev_alloc_skb_ip_align(dev->net, len); if (!skb) goto error; - memcpy(skb_put(skb, len), skb_in->data + offset, len); + skb_put_data(skb, skb_in->data + offset, len); usbnet_skb_return(dev, skb); payload += len; /* count payload bytes in this NTB */ } diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c index 1cc24e6f23e2..29276e54bb8b 100644 --- a/drivers/net/usb/gl620a.c +++ b/drivers/net/usb/gl620a.c @@ -121,8 +121,7 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (gl_skb) { // copy the packet data to the new skb - memcpy(skb_put(gl_skb, size), - packet->packet_data, size); + skb_put_data(gl_skb, packet->packet_data, size); usbnet_skb_return(dev, gl_skb); } diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 00067a0c51ca..908ada4ca21c 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -911,11 +911,9 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, /* Copy what we got so far. make room for iphdr * after tail. */ - tmp_rx_buf = - skb_put(odev->skb_rx_buf, - sizeof(struct iphdr)); - memcpy(tmp_rx_buf, (char *)&(odev->rx_ip_hdr), - sizeof(struct iphdr)); + tmp_rx_buf = skb_put_data(odev->skb_rx_buf, + (char *)&(odev->rx_ip_hdr), + sizeof(struct iphdr)); /* ETH_HLEN */ odev->rx_buf_size = sizeof(struct iphdr); @@ -934,8 +932,9 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, /* Copy the rest of the bytes that are left in the * buffer into the waiting sk_buf. */ /* Make room for temp_bytes after tail. */ - tmp_rx_buf = skb_put(odev->skb_rx_buf, temp_bytes); - memcpy(tmp_rx_buf, ip_pkt + buffer_offset, temp_bytes); + tmp_rx_buf = skb_put_data(odev->skb_rx_buf, + ip_pkt + buffer_offset, + temp_bytes); odev->rx_buf_missing -= temp_bytes; count -= temp_bytes; diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 76465b117b72..0f213ea22c75 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c @@ -253,7 +253,7 @@ static void ipheth_rcvbulk_callback(struct urb *urb) return; } - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); skb->dev = dev->net; skb->protocol = eth_type_trans(skb, dev->net); diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c index 5714107533bb..d633492bf9eb 100644 --- a/drivers/net/usb/lg-vl600.c +++ b/drivers/net/usb/lg-vl600.c @@ -135,7 +135,7 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb) } buf = s->current_rx_buf; - memcpy(skb_put(buf, skb->len), skb->data, skb->len); + skb_put_data(buf, skb->data, skb->len); } else if (skb->len < 4) { netif_err(dev, ifup, dev->net, "Frame too short\n"); dev->net->stats.rx_length_errors++; diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 32a22f4e8356..ffd229ec8352 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -188,7 +188,7 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb) goto skip; } - memcpy(skb_put(skbn, len), skb->data + offset, len); + skb_put_data(skbn, skb->data + offset, len); if (netif_rx(skbn) != NET_RX_SUCCESS) return 0; diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 1f8c15cb63b0..6bacbd2f0eca 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -305,7 +305,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, copy = len; if (copy > skb_tailroom(skb)) copy = skb_tailroom(skb); - memcpy(skb_put(skb, copy), p, copy); + skb_put_data(skb, p, copy); len -= copy; offset += copy; diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 33265eb50420..bd46b2552980 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c @@ -857,7 +857,7 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, dbg(DBG_TX, "fst_rx_dma_complete\n"); pi = port->index; - memcpy(skb_put(skb, len), card->rx_dma_handle_host, len); + skb_put_data(skb, card->rx_dma_handle_host, len); /* Reset buffer descriptor */ FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c index 47fdb87d3567..f5b4ad45831a 100644 --- a/drivers/net/wan/hdlc_ppp.c +++ b/drivers/net/wan/hdlc_ppp.c @@ -234,9 +234,9 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code, cp->len = htons(sizeof(struct cp_header) + magic_len + len); if (magic_len) - memcpy(skb_put(skb, magic_len), &magic, magic_len); + skb_put_data(skb, &magic, magic_len); if (len) - memcpy(skb_put(skb, len), data, len); + skb_put_data(skb, data, len); #if DEBUG_CP BUG_ON(code >= CP_CODES); diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 878b05d06fc7..40ee80c03c94 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c @@ -202,7 +202,7 @@ static void x25_asy_bump(struct x25_asy *sl) return; } skb_push(skb, 1); /* LAPB internal control */ - memcpy(skb_put(skb, count), sl->rbuff, count); + skb_put_data(skb, sl->rbuff, count); skb->protocol = x25_type_trans(skb, sl->dev); err = lapb_data_received(skb->dev, skb); if (err != LAPB_OK) { diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c index 7f64e74d746b..dd7f3168c07d 100644 --- a/drivers/net/wimax/i2400m/netdev.c +++ b/drivers/net/wimax/i2400m/netdev.c @@ -488,7 +488,7 @@ void i2400m_net_rx(struct i2400m *i2400m, struct sk_buff *skb_rx, net_dev->stats.rx_dropped++; goto error_skb_realloc; } - memcpy(skb_put(skb, buf_len), buf, buf_len); + skb_put_data(skb, buf, buf_len); } i2400m_rx_fake_eth_header(i2400m->wimax_dev.net_dev, skb->data - ETH_HLEN, diff --git a/drivers/net/wireless/admtek/adm8211.c b/drivers/net/wireless/admtek/adm8211.c index ed626f568b58..5f64f3928c35 100644 --- a/drivers/net/wireless/admtek/adm8211.c +++ b/drivers/net/wireless/admtek/adm8211.c @@ -390,9 +390,9 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev) priv->pdev, priv->rx_buffers[entry].mapping, pktlen, PCI_DMA_FROMDEVICE); - memcpy(skb_put(skb, pktlen), - skb_tail_pointer(priv->rx_buffers[entry].skb), - pktlen); + skb_put_data(skb, + skb_tail_pointer(priv->rx_buffers[entry].skb), + pktlen); pci_dma_sync_single_for_device( priv->pdev, priv->rx_buffers[entry].mapping, diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 4674ff33d320..16cf250f6c39 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3475,9 +3475,8 @@ static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, if (arvif->u.ap.noa_data) if (!pskb_expand_head(skb, 0, arvif->u.ap.noa_len, GFP_ATOMIC)) - memcpy(skb_put(skb, arvif->u.ap.noa_len), - arvif->u.ap.noa_data, - arvif->u.ap.noa_len); + skb_put_data(skb, arvif->u.ap.noa_data, + arvif->u.ap.noa_len); spin_unlock_bh(&ar->data_lock); } } diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 6afc8d27f0d5..a66e2482897f 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -3304,9 +3304,8 @@ static void ath10k_wmi_update_noa(struct ath10k *ar, struct ath10k_vif *arvif, if (arvif->u.ap.noa_data) if (!pskb_expand_head(bcn, 0, arvif->u.ap.noa_len, GFP_ATOMIC)) - memcpy(skb_put(bcn, arvif->u.ap.noa_len), - arvif->u.ap.noa_data, - arvif->u.ap.noa_len); + skb_put_data(bcn, arvif->u.ap.noa_data, + arvif->u.ap.noa_len); } static int ath10k_wmi_op_pull_swba_ev(struct ath10k *ar, struct sk_buff *skb, diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c index 373b1e9457fd..f0439f2d566b 100644 --- a/drivers/net/wireless/ath/ath9k/channel.c +++ b/drivers/net/wireless/ath/ath9k/channel.c @@ -1005,7 +1005,7 @@ static void ath_scan_send_probe(struct ath_softc *sc, info->flags |= IEEE80211_TX_CTL_NO_CCK_RATE; if (req->ie_len) - memcpy(skb_put(skb, req->ie_len), req->ie, req->ie_len); + skb_put_data(skb, req->ie, req->ie_len); skb_set_queue_mapping(skb, IEEE80211_AC_VO); @@ -1521,8 +1521,7 @@ void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp, noa_desc = !!avp->offchannel_duration + !!avp->noa_duration; noa_len = 2 + sizeof(struct ieee80211_p2p_noa_desc) * noa_desc; - hdr = skb_put(skb, sizeof(noa_ie_hdr)); - memcpy(hdr, noa_ie_hdr, sizeof(noa_ie_hdr)); + hdr = skb_put_data(skb, noa_ie_hdr, sizeof(noa_ie_hdr)); hdr[1] = sizeof(noa_ie_hdr) + noa_len - 2; hdr[7] = noa_len; diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index 9c16e2a6d185..c51c69b1ad96 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c @@ -312,8 +312,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, skb_reserve(skb, headroom); if (cmd_len != 0 && cmd_buf != NULL) { - data = (u8 *) skb_put(skb, cmd_len); - memcpy(data, cmd_buf, cmd_len); + data = skb_put_data(skb, cmd_buf, cmd_len); } mutex_lock(&wmi->op_mutex); diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c index b2166726b05d..705063259c8f 100644 --- a/drivers/net/wireless/ath/carl9170/rx.c +++ b/drivers/net/wireless/ath/carl9170/rx.c @@ -481,7 +481,7 @@ static struct sk_buff *carl9170_rx_copy_data(u8 *buf, int len) skb = dev_alloc_skb(len + reserved); if (likely(skb)) { skb_reserve(skb, reserved); - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); } return skb; @@ -916,7 +916,7 @@ static void carl9170_rx_stream(struct ar9170 *ar, void *buf, unsigned int len) } } - memcpy(skb_put(ar->rx_failover, tlen), tbuf, tlen); + skb_put_data(ar->rx_failover, tbuf, tlen); ar->rx_failover_missing -= tlen; if (ar->rx_failover_missing <= 0) { @@ -958,7 +958,7 @@ static void carl9170_rx_stream(struct ar9170 *ar, void *buf, unsigned int len) * the rx - descriptor comes round again. */ - memcpy(skb_put(ar->rx_failover, tlen), tbuf, tlen); + skb_put_data(ar->rx_failover, tbuf, tlen); ar->rx_failover_missing = clen - tlen; return; } diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 814c35645b73..cff9c585972f 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -681,7 +681,7 @@ static void wmi_evt_eapol_rx(struct wil6210_priv *wil, int id, ether_addr_copy(eth->h_dest, ndev->dev_addr); ether_addr_copy(eth->h_source, evt->src_mac); eth->h_proto = cpu_to_be16(ETH_P_PAE); - memcpy(skb_put(skb, eapol_len), evt->eapol, eapol_len); + skb_put_data(skb, evt->eapol, eapol_len); skb->protocol = eth_type_trans(skb, ndev); if (likely(netif_rx_ni(skb) == NET_RX_SUCCESS)) { ndev->stats.rx_packets++; diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c index 27b110dc8cc6..b68436b23a63 100644 --- a/drivers/net/wireless/atmel/atmel.c +++ b/drivers/net/wireless/atmel/atmel.c @@ -1036,9 +1036,8 @@ static void frag_rx_path(struct atmel_private *priv, priv->dev->stats.rx_dropped++; } else { skb_reserve(skb, 2); - memcpy(skb_put(skb, priv->frag_len + 12), - priv->rx_buf, - priv->frag_len + 12); + skb_put_data(skb, priv->rx_buf, + priv->frag_len + 12); skb->protocol = eth_type_trans(skb, priv->dev); skb->ip_summed = CHECKSUM_NONE; netif_rx(skb); diff --git a/drivers/net/wireless/broadcom/b43legacy/dma.c b/drivers/net/wireless/broadcom/b43legacy/dma.c index f9dd892b9f27..cfa617ddb2f1 100644 --- a/drivers/net/wireless/broadcom/b43legacy/dma.c +++ b/drivers/net/wireless/broadcom/b43legacy/dma.c @@ -1072,7 +1072,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring, goto out_unmap_hdr; } - memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len); + skb_put_data(bounce_skb, skb->data, skb->len); memcpy(bounce_skb->cb, skb->cb, sizeof(skb->cb)); bounce_skb->dev = skb->dev; skb_set_queue_mapping(bounce_skb, skb_get_queue_mapping(skb)); diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c index bbc579b647b6..e0c690b48d4e 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c @@ -10274,8 +10274,9 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb, printk(KERN_INFO "Adding frag %d %d...\n", j, size); - memcpy(skb_put(skb, size), - txb->fragments[j]->data + hdr_len, size); + skb_put_data(skb, + txb->fragments[j]->data + hdr_len, + size); } dev_kfree_skb_any(txb->fragments[i]); txb->fragments[i] = skb; diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c index 048f1e3ada11..5339d1eeb2f7 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c @@ -359,7 +359,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) goto failed; skb_reserve(skb_new, crypt->ops->extra_msdu_prefix_len); - memcpy(skb_put(skb_new, hdr_len), &header, hdr_len); + skb_put_data(skb_new, &header, hdr_len); snapped = 1; libipw_copy_snap(skb_put(skb_new, SNAP_SIZE + sizeof(u16)), ether_type); @@ -470,9 +470,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) skb_reserve(skb_frag, crypt->ops->extra_mpdu_prefix_len); - frag_hdr = - (struct libipw_hdr_3addrqos *)skb_put(skb_frag, hdr_len); - memcpy(frag_hdr, &header, hdr_len); + frag_hdr = skb_put_data(skb_frag, &header, hdr_len); /* If this is not the last fragment, then add the MOREFRAGS * bit to the frame control */ diff --git a/drivers/net/wireless/intel/iwlegacy/3945.c b/drivers/net/wireless/intel/iwlegacy/3945.c index 080ea8155b90..dbf164d48ed3 100644 --- a/drivers/net/wireless/intel/iwlegacy/3945.c +++ b/drivers/net/wireless/intel/iwlegacy/3945.c @@ -520,7 +520,7 @@ il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb, * and do not consume a full page */ if (len <= SMALL_PACKET_SIZE) { - memcpy(skb_put(skb, len), rx_hdr->payload, len); + skb_put_data(skb, rx_hdr->payload, len); } else { skb_add_rx_frag(skb, 0, rxb->page, (void *)rx_hdr->payload - (void *)pkt, len, diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c index 49a2ff15ddae..5b51fba75595 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c @@ -606,7 +606,7 @@ il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr, } if (len <= SMALL_PACKET_SIZE) { - memcpy(skb_put(skb, len), hdr, len); + skb_put_data(skb, hdr, len); } else { skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len, PAGE_SIZE << il->hw_params.rx_page_order); diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rx.c b/drivers/net/wireless/intel/iwlwifi/dvm/rx.c index adfd6307edca..eaad7389b67c 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rx.c @@ -657,7 +657,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, */ hdrlen = (len <= skb_tailroom(skb)) ? len : sizeof(*hdr); - memcpy(skb_put(skb, hdrlen), hdr, hdrlen); + skb_put_data(skb, hdr, hdrlen); fraglen = len - hdrlen; if (fraglen) { diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/tx.c b/drivers/net/wireless/intel/iwlwifi/dvm/tx.c index 4b97371c3b42..adaa2f0097cc 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/tx.c @@ -319,8 +319,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, if (noa_data && pskb_expand_head(skb, 0, noa_data->length, GFP_ATOMIC) == 0) { - memcpy(skb_put(skb, noa_data->length), - noa_data->data, noa_data->length); + skb_put_data(skb, noa_data->data, noa_data->length); hdr = (struct ieee80211_hdr *)skb->data; } } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c index 119a3bd92c50..7a56a0ac151c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c @@ -1431,7 +1431,7 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, if (!pkt) goto report; - memcpy(skb_put(pkt, hdrlen), pktdata, hdrlen); + skb_put_data(pkt, pktdata, hdrlen); pktdata += hdrlen; pktsize -= hdrlen; @@ -1463,7 +1463,7 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, pktsize -= ivlen + icvlen; pktdata += ivlen; - memcpy(skb_put(pkt, pktsize), pktdata, pktsize); + skb_put_data(pkt, pktdata, pktsize); if (ieee80211_data_to_8023(pkt, vif->addr, vif->type)) goto report; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index fd2fc46e2fe5..15d13017c1df 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c @@ -1596,7 +1596,7 @@ void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm, rx_status.band); /* copy the data */ - memcpy(skb_put(skb, size), sb->data, size); + skb_put_data(skb, sb->data, size); memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); /* pass it as regular rx to mac80211 */ diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index fd1dd06c4f18..2c07719aa45c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -133,7 +133,7 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, */ hdrlen = (len <= skb_tailroom(skb)) ? len : hdrlen + crypt_len + 8; - memcpy(skb_put(skb, hdrlen), hdr, hdrlen); + skb_put_data(skb, hdr, hdrlen); fraglen = len - hdrlen; if (fraglen) { diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c index 966cd7543629..cf48390f6f68 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -183,9 +183,8 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr, * present before copying packet data. */ hdrlen += crypt_len; - memcpy(skb_put(skb, hdrlen), hdr, hdrlen); - memcpy(skb_put(skb, headlen - hdrlen), (u8 *)hdr + hdrlen + pad_len, - headlen - hdrlen); + skb_put_data(skb, hdr, hdrlen); + skb_put_data(skb, (u8 *)hdr + hdrlen + pad_len, headlen - hdrlen); fraglen = len - headlen; diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c index 386950a2d616..01013d273aa7 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c @@ -2141,8 +2141,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, htons(ETH_P_IPV6), data_left); - memcpy(skb_put(csum_skb, tcp_hdrlen(skb)), - tcph, tcp_hdrlen(skb)); + skb_put_data(csum_skb, tcph, tcp_hdrlen(skb)); skb_reset_transport_header(csum_skb); csum_skb->csum_start = (unsigned char *)tcp_hdr(csum_skb) - @@ -2176,7 +2175,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, dma_addr_t tb_phys; if (trans_pcie->sw_csum_tx) - memcpy(skb_put(csum_skb, size), tso.data, size); + skb_put_data(csum_skb, tso.data, size); tb_phys = dma_map_single(trans->dev, tso.data, size, DMA_TO_DEVICE); diff --git a/drivers/net/wireless/intersil/hostap/hostap_80211_tx.c b/drivers/net/wireless/intersil/hostap/hostap_80211_tx.c index 055e11d353ca..c1b10d5117ad 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_80211_tx.c +++ b/drivers/net/wireless/intersil/hostap/hostap_80211_tx.c @@ -242,7 +242,7 @@ netdev_tx_t hostap_data_start_xmit(struct sk_buff *skb, memcpy(skb_push(skb, encaps_len), encaps_data, encaps_len); memcpy(skb_push(skb, hdr_len), &hdr, hdr_len); if (use_wds == WDS_OWN_FRAME) { - memcpy(skb_put(skb, ETH_ALEN), &hdr.addr4, ETH_ALEN); + skb_put_data(skb, &hdr.addr4, ETH_ALEN); } iface->stats.tx_packets++; diff --git a/drivers/net/wireless/intersil/hostap/hostap_ap.c b/drivers/net/wireless/intersil/hostap/hostap_ap.c index 89b5987303a4..91757defb9be 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_ap.c +++ b/drivers/net/wireless/intersil/hostap/hostap_ap.c @@ -1000,7 +1000,7 @@ static void prism2_send_mgmt(struct net_device *dev, hdrlen = hostap_80211_get_hdrlen(cpu_to_le16(type_subtype)); hdr = skb_put_zero(skb, hdrlen); if (body) - memcpy(skb_put(skb, body_len), body, body_len); + skb_put_data(skb, body, body_len); /* FIX: ctrl::ack sending used special HFA384X_TX_CTRL_802_11 * tx_control instead of using local->tx_control */ diff --git a/drivers/net/wireless/intersil/hostap/hostap_hw.c b/drivers/net/wireless/intersil/hostap/hostap_hw.c index d4f0b730796e..72b46eaf3de2 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_hw.c +++ b/drivers/net/wireless/intersil/hostap/hostap_hw.c @@ -2005,7 +2005,7 @@ static void prism2_rx(local_info_t *local) goto rx_dropped; } skb->dev = dev; - memcpy(skb_put(skb, hdr_len), &rxdesc, hdr_len); + skb_put_data(skb, &rxdesc, hdr_len); if (len > 0) res = hfa384x_from_bap(dev, BAP0, skb_put(skb, len), len); @@ -2209,9 +2209,9 @@ static void hostap_tx_callback(local_info_t *local, return; } - memcpy(skb_put(skb, hdrlen), (void *) &txdesc->frame_control, hdrlen); + skb_put_data(skb, (void *)&txdesc->frame_control, hdrlen); if (payload) - memcpy(skb_put(skb, len), payload, len); + skb_put_data(skb, payload, len); skb->dev = local->dev; skb_reset_mac_header(skb); @@ -2362,8 +2362,7 @@ static void prism2_txexc(local_info_t *local) struct sk_buff *skb; skb = dev_alloc_skb(sizeof(txdesc)); if (skb) { - memcpy(skb_put(skb, sizeof(txdesc)), &txdesc, - sizeof(txdesc)); + skb_put_data(skb, &txdesc, sizeof(txdesc)); skb_queue_tail(&local->sta_tx_exc_list, skb); tasklet_schedule(&local->sta_tx_exc_tasklet); } @@ -2460,7 +2459,7 @@ static void prism2_info(local_info_t *local) goto out; } - memcpy(skb_put(skb, sizeof(info)), &info, sizeof(info)); + skb_put_data(skb, &info, sizeof(info)); if (left > 0 && hfa384x_from_bap(dev, BAP0, skb_put(skb, left), left)) { spin_unlock(&local->baplock); diff --git a/drivers/net/wireless/intersil/hostap/hostap_main.c b/drivers/net/wireless/intersil/hostap/hostap_main.c index 400f9b5d620e..a3c066f90afc 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_main.c +++ b/drivers/net/wireless/intersil/hostap/hostap_main.c @@ -1045,7 +1045,7 @@ int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); memcpy(mgmt->bssid, dst, ETH_ALEN); if (body) - memcpy(skb_put(skb, bodylen), body, bodylen); + skb_put_data(skb, body, bodylen); meta = (struct hostap_skb_tx_data *) skb->cb; memset(meta, 0, sizeof(*meta)); diff --git a/drivers/net/wireless/intersil/orinoco/main.c b/drivers/net/wireless/intersil/orinoco/main.c index d9128bb25e85..f7abc439fb92 100644 --- a/drivers/net/wireless/intersil/orinoco/main.c +++ b/drivers/net/wireless/intersil/orinoco/main.c @@ -792,7 +792,7 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, } /* Copy the 802.11 header to the skb */ - memcpy(skb_put(skb, hdrlen), &(desc->frame_ctl), hdrlen); + skb_put_data(skb, &(desc->frame_ctl), hdrlen); skb_reset_mac_header(skb); /* If any, copy the data from the card to the skb */ diff --git a/drivers/net/wireless/intersil/p54/p54spi.c b/drivers/net/wireless/intersil/p54/p54spi.c index 7ab2f43ab425..e41bf042352e 100644 --- a/drivers/net/wireless/intersil/p54/p54spi.c +++ b/drivers/net/wireless/intersil/p54/p54spi.c @@ -372,9 +372,9 @@ static int p54spi_rx(struct p54s_priv *priv) } if (len <= READAHEAD_SZ) { - memcpy(skb_put(skb, len), rx_head + 1, len); + skb_put_data(skb, rx_head + 1, len); } else { - memcpy(skb_put(skb, READAHEAD_SZ), rx_head + 1, READAHEAD_SZ); + skb_put_data(skb, rx_head + 1, READAHEAD_SZ); p54spi_spi_read(priv, SPI_ADRS_DMA_DATA, skb_put(skb, len - READAHEAD_SZ), len - READAHEAD_SZ); diff --git a/drivers/net/wireless/intersil/p54/txrx.c b/drivers/net/wireless/intersil/p54/txrx.c index 60f9b678ef74..b00c07d72f95 100644 --- a/drivers/net/wireless/intersil/p54/txrx.c +++ b/drivers/net/wireless/intersil/p54/txrx.c @@ -905,8 +905,9 @@ void p54_tx_80211(struct ieee80211_hw *dev, if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { /* reserve space for the MIC key */ len += 8; - memcpy(skb_put(skb, 8), &(info->control.hw_key->key - [NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY]), 8); + skb_put_data(skb, + &(info->control.hw_key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY]), + 8); } /* reserve some space for ICV */ len += info->control.hw_key->icv_len; diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index c854a557998b..1d6e180052b8 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2020,8 +2020,7 @@ static void hw_scan_work(struct work_struct *work) memcpy(mgmt->bssid, req->bssid, ETH_ALEN); if (req->ie_len) - memcpy(skb_put(probe, req->ie_len), req->ie, - req->ie_len); + skb_put_data(probe, req->ie, req->ie_len); local_bh_disable(); mac80211_hwsim_tx_frame(hwsim->hw, probe, @@ -3021,7 +3020,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, goto err; /* Copy the data */ - memcpy(skb_put(skb, frame_data_len), frame_data, frame_data_len); + skb_put_data(skb, frame_data, frame_data_len); data2 = get_hwsim_data_ref_from_addr(dst); if (!data2) diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c index e0196208ab0d..a9e2b06b3175 100644 --- a/drivers/net/wireless/marvell/libertas/if_sdio.c +++ b/drivers/net/wireless/marvell/libertas/if_sdio.c @@ -256,9 +256,7 @@ static int if_sdio_handle_data(struct if_sdio_card *card, skb_reserve(skb, NET_IP_ALIGN); - data = skb_put(skb, size); - - memcpy(data, buffer, size); + data = skb_put_data(skb, buffer, size); lbs_process_rxed_packet(card->priv, skb); diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c index 53e67526f40d..bc12c37e7501 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c @@ -81,7 +81,7 @@ mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr, tx_header->eth803_hdr.h_proto = htons(skb_src->len + LLC_SNAP_LEN); /* Add payload */ - memcpy(skb_put(skb_aggr, skb_src->len), skb_src->data, skb_src->len); + skb_put_data(skb_aggr, skb_src->data, skb_src->len); /* Add padding for new MSDU to start from 4 byte boundary */ *pad = (4 - ((unsigned long)skb_aggr->tail & 0x3)) % 4; diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 025bc06a19d6..c20e4944ef87 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -176,12 +176,10 @@ mwifiex_form_mgmt_frame(struct sk_buff *skb, const u8 *buf, size_t len) memcpy(skb_push(skb, sizeof(pkt_type)), &pkt_type, sizeof(pkt_type)); /* Add packet data and address4 */ - memcpy(skb_put(skb, sizeof(struct ieee80211_hdr_3addr)), buf, - sizeof(struct ieee80211_hdr_3addr)); - memcpy(skb_put(skb, ETH_ALEN), addr, ETH_ALEN); - memcpy(skb_put(skb, len - sizeof(struct ieee80211_hdr_3addr)), - buf + sizeof(struct ieee80211_hdr_3addr), - len - sizeof(struct ieee80211_hdr_3addr)); + skb_put_data(skb, buf, sizeof(struct ieee80211_hdr_3addr)); + skb_put_data(skb, addr, ETH_ALEN); + skb_put_data(skb, buf + sizeof(struct ieee80211_hdr_3addr), + len - sizeof(struct ieee80211_hdr_3addr)); skb->priority = LOW_PRIO_TID; __net_timestamp(skb); diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c index c76b7315af55..d38555fe4284 100644 --- a/drivers/net/wireless/marvell/mwifiex/tdls.c +++ b/drivers/net/wireless/marvell/mwifiex/tdls.c @@ -679,8 +679,7 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, return ret; } if (extra_ies_len) - memcpy(skb_put(skb, extra_ies_len), extra_ies, - extra_ies_len); + skb_put_data(skb, extra_ies, extra_ies_len); mwifiex_tdls_add_link_ie(skb, priv->curr_addr, peer, priv->cfg_bssid); break; @@ -693,8 +692,7 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, return ret; } if (extra_ies_len) - memcpy(skb_put(skb, extra_ies_len), extra_ies, - extra_ies_len); + skb_put_data(skb, extra_ies, extra_ies_len); mwifiex_tdls_add_link_ie(skb, peer, priv->curr_addr, priv->cfg_bssid); break; @@ -865,7 +863,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, } if (extra_ies_len) - memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); + skb_put_data(skb, extra_ies, extra_ies_len); /* the TDLS link IE is always added last we are the responder */ diff --git a/drivers/net/wireless/mediatek/mt7601u/dma.c b/drivers/net/wireless/mediatek/mt7601u/dma.c index a8bc064bc14f..660267b359e4 100644 --- a/drivers/net/wireless/mediatek/mt7601u/dma.c +++ b/drivers/net/wireless/mediatek/mt7601u/dma.c @@ -52,7 +52,7 @@ mt7601u_rx_skb_from_seg(struct mt7601u_dev *dev, struct mt7601u_rxwi *rxwi, goto bad_frame; if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_L2PAD)) { - memcpy(skb_put(skb, hdr_len), data, hdr_len); + skb_put_data(skb, data, hdr_len); data += hdr_len + 2; true_len -= hdr_len; @@ -63,7 +63,7 @@ mt7601u_rx_skb_from_seg(struct mt7601u_dev *dev, struct mt7601u_rxwi *rxwi, copy = (true_len <= skb_tailroom(skb)) ? true_len : hdr_len + 8; frag = true_len - copy; - memcpy(skb_put(skb, copy), data, copy); + skb_put_data(skb, data, copy); data += copy; if (frag) { diff --git a/drivers/net/wireless/mediatek/mt7601u/mcu.c b/drivers/net/wireless/mediatek/mt7601u/mcu.c index a9f5f398b2f8..65a8004418ea 100644 --- a/drivers/net/wireless/mediatek/mt7601u/mcu.c +++ b/drivers/net/wireless/mediatek/mt7601u/mcu.c @@ -68,7 +68,7 @@ mt7601u_mcu_msg_alloc(struct mt7601u_dev *dev, const void *data, int len) skb = alloc_skb(len + MT_DMA_HDR_LEN + 4, GFP_KERNEL); if (skb) { skb_reserve(skb, MT_DMA_HDR_LEN); - memcpy(skb_put(skb, len), data, len); + skb_put_data(skb, data, len); } return skb; diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c index 4814d90c8040..f93b27f3a236 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c @@ -213,7 +213,7 @@ static void qtnf_pcie_control_rx_callback(void *arg, const u8 *buf, size_t len) return; } - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); qtnf_trans_handle_rx_ctl_packet(bus, skb); } diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h index d8de484b5995..9844ff0add2b 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h @@ -35,8 +35,7 @@ qtnf_cmd_skb_put_buffer(struct sk_buff *skb, const u8 *buf_src, size_t len) { u8 *buf_dst; - buf_dst = skb_put(skb, len); - memcpy(buf_dst, buf_src, len); + buf_dst = skb_put_data(skb, buf_src, len); } static inline void qtnf_cmd_skb_put_tlv_arr(struct sk_buff *skb, diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c index 4a1bca1b1e26..b70985e126bf 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c @@ -203,9 +203,8 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec); if (!(skbdesc->flags & SKBDESC_DESC_IN_SKB)) - memcpy(skb_put(skbcopy, skbdesc->desc_len), skbdesc->desc, - skbdesc->desc_len); - memcpy(skb_put(skbcopy, skb->len), skb->data, skb->len); + skb_put_data(skbcopy, skbdesc->desc, skbdesc->desc_len); + skb_put_data(skbcopy, skb->data, skb->len); skb_queue_tail(&intf->frame_dump_skbqueue, skbcopy); wake_up_interruptible(&intf->frame_dump_waitqueue); diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c index 2e6b888bd417..0c1f8307e179 100644 --- a/drivers/net/wireless/realtek/rtlwifi/pci.c +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c @@ -735,8 +735,7 @@ static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw, if (likely(uskb)) { memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status)); - pdata = (u8 *)skb_put(uskb, skb->len); - memcpy(pdata, skb->data, skb->len); + pdata = skb_put_data(uskb, skb->data, skb->len); dev_kfree_skb_any(skb); ieee80211_rx_irqsafe(hw, uskb); } else { diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c index 21ed9ad3be7a..a2eca669873b 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c @@ -620,8 +620,7 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) u1rsvdpageloc, 3); skb = dev_alloc_skb(totalpacketlen); - memcpy(skb_put(skb, totalpacketlen), - &reserved_page_packet, totalpacketlen); + skb_put_data(skb, &reserved_page_packet, totalpacketlen); rtstatus = rtl_cmd_send_packet(hw, skb); diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c index 89a0a28b8b20..dd3ba4810e7d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c @@ -188,10 +188,9 @@ static bool _rtl92s_firmware_downloadcode(struct ieee80211_hw *hw, if (!skb) return false; skb_reserve(skb, extra_descoffset); - seg_ptr = (u8 *)skb_put(skb, (u32)(frag_length - - extra_descoffset)); - memcpy(seg_ptr, code_virtual_address + frag_offset, - (u32)(frag_length - extra_descoffset)); + seg_ptr = skb_put_data(skb, + code_virtual_address + frag_offset, + (u32)(frag_length - extra_descoffset)); tcb_desc = (struct rtl_tcb_desc *)(skb->cb); tcb_desc->queue_index = TXCMD_QUEUE; diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c index 4d989b8ab185..5590d07d0918 100644 --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c @@ -653,7 +653,7 @@ static void _rtl_rx_completed(struct urb *_urb) /* reserve some space for mac80211's radiotap */ skb_reserve(skb, __RADIO_TAP_SIZE_RSV); - memcpy(skb_put(skb, size), _urb->transfer_buffer, size); + skb_put_data(skb, _urb->transfer_buffer, size); skb_queue_tail(&rtlusb->rx_queue, skb); tasklet_schedule(&rtlusb->rx_work_tasklet); diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c index fac87c06357b..4433cec4367c 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c @@ -412,11 +412,9 @@ static int rsi_mgmt_pkt_to_core(struct rsi_common *common, return -ENOMEM; } - buffer = skb_put(skb, msg_len); - - memcpy(buffer, - (u8 *)(msg + FRAME_DESC_SZ + pad_bytes), - msg_len); + buffer = skb_put_data(skb, + (u8 *)(msg + FRAME_DESC_SZ + pad_bytes), + msg_len); pkt_recv = buffer[0]; diff --git a/drivers/net/wireless/st/cw1200/scan.c b/drivers/net/wireless/st/cw1200/scan.c index 0a0ff7e31f5b..cc2ce60f4f09 100644 --- a/drivers/net/wireless/st/cw1200/scan.c +++ b/drivers/net/wireless/st/cw1200/scan.c @@ -84,7 +84,7 @@ int cw1200_hw_scan(struct ieee80211_hw *hw, return -ENOMEM; if (req->ie_len) - memcpy(skb_put(frame.skb, req->ie_len), req->ie, req->ie_len); + skb_put_data(frame.skb, req->ie, req->ie_len); /* will be unlocked in cw1200_scan_work() */ down(&priv->scan.lock); diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index bbf7604889b7..08f0477f78d9 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c @@ -1036,7 +1036,7 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw, goto out_idle; } if (req->ie_len) - memcpy(skb_put(skb, req->ie_len), req->ie, req->ie_len); + skb_put_data(skb, req->ie, req->ie_len); ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data, skb->len); diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index 4a39fb13c478..229f4d01f239 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c @@ -1156,9 +1156,9 @@ int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif, goto out; } if (ie0_len) - memcpy(skb_put(skb, ie0_len), ie0, ie0_len); + skb_put_data(skb, ie0, ie0_len); if (ie1_len) - memcpy(skb_put(skb, ie1_len), ie1, ie1_len); + skb_put_data(skb, ie1, ie1_len); if (sched_scan && (wl->quirks & WLCORE_QUIRK_DUAL_PROBE_TMPL)) { diff --git a/drivers/net/wireless/ti/wlcore/rx.c b/drivers/net/wireless/ti/wlcore/rx.c index 52a55f9acd80..53cd6d4d5b50 100644 --- a/drivers/net/wireless/ti/wlcore/rx.c +++ b/drivers/net/wireless/ti/wlcore/rx.c @@ -174,15 +174,13 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length, /* reserve the unaligned payload(if any) */ skb_reserve(skb, reserved); - buf = skb_put(skb, pkt_data_len); - /* * Copy packets from aggregation buffer to the skbs without rx * descriptor and with packet payload aligned care. In case of unaligned * packets copy the packets in offset of 2 bytes guarantee IP header * payload aligned to 4 bytes. */ - memcpy(buf, data + sizeof(*desc), pkt_data_len); + buf = skb_put_data(skb, data + sizeof(*desc), pkt_data_len); if (rx_align == WLCORE_RX_BUF_PADDED) skb_pull(skb, RX_BUF_ALIGN); diff --git a/drivers/net/wireless/zydas/zd1201.c b/drivers/net/wireless/zydas/zd1201.c index de7ff395977a..7f586d76cf17 100644 --- a/drivers/net/wireless/zydas/zd1201.c +++ b/drivers/net/wireless/zydas/zd1201.c @@ -326,13 +326,13 @@ static void zd1201_usbrx(struct urb *urb) if (!(skb = dev_alloc_skb(datalen+24))) goto resubmit; - memcpy(skb_put(skb, 2), &data[datalen-16], 2); - memcpy(skb_put(skb, 2), &data[datalen-2], 2); - memcpy(skb_put(skb, 6), &data[datalen-14], 6); - memcpy(skb_put(skb, 6), &data[datalen-22], 6); - memcpy(skb_put(skb, 6), &data[datalen-8], 6); - memcpy(skb_put(skb, 2), &data[datalen-24], 2); - memcpy(skb_put(skb, len), data, len); + skb_put_data(skb, &data[datalen - 16], 2); + skb_put_data(skb, &data[datalen - 2], 2); + skb_put_data(skb, &data[datalen - 14], 6); + skb_put_data(skb, &data[datalen - 22], 6); + skb_put_data(skb, &data[datalen - 8], 6); + skb_put_data(skb, &data[datalen - 24], 2); + skb_put_data(skb, data, len); skb->protocol = eth_type_trans(skb, zd->dev); zd->dev->stats.rx_packets++; zd->dev->stats.rx_bytes += skb->len; @@ -359,9 +359,9 @@ static void zd1201_usbrx(struct urb *urb) frag->skb = skb; frag->seq = seq & IEEE80211_SCTL_SEQ; skb_reserve(skb, 2); - memcpy(skb_put(skb, 12), &data[datalen-14], 12); - memcpy(skb_put(skb, 2), &data[6], 2); - memcpy(skb_put(skb, len), data+8, len); + skb_put_data(skb, &data[datalen - 14], 12); + skb_put_data(skb, &data[6], 2); + skb_put_data(skb, data + 8, len); hlist_add_head(&frag->fnode, &zd->fraglist); goto resubmit; } @@ -385,9 +385,9 @@ static void zd1201_usbrx(struct urb *urb) if (!skb) goto resubmit; skb_reserve(skb, 2); - memcpy(skb_put(skb, 12), &data[datalen-14], 12); - memcpy(skb_put(skb, 2), &data[6], 2); - memcpy(skb_put(skb, len), data+8, len); + skb_put_data(skb, &data[datalen - 14], 12); + skb_put_data(skb, &data[6], 2); + skb_put_data(skb, data + 8, len); } skb->protocol = eth_type_trans(skb, zd->dev); zd->dev->stats.rx_packets++; diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c index fe6517a621b0..2d929d2edb00 100644 --- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c @@ -1103,7 +1103,7 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) } /* FIXME : could we avoid this big memcpy ? */ - memcpy(skb_put(skb, length), buffer, length); + skb_put_data(skb, buffer, length); memcpy(IEEE80211_SKB_RXCB(skb), &stats, sizeof(stats)); ieee80211_rx_irqsafe(hw, skb); diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c index 7c1eaea3b685..badd8167ac73 100644 --- a/drivers/nfc/fdp/fdp.c +++ b/drivers/nfc/fdp/fdp.c @@ -228,8 +228,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type) skb_reserve(skb, NCI_CTRL_HDR_SIZE); - memcpy(skb_put(skb, payload_size), fw->data + (fw->size - len), - payload_size); + skb_put_data(skb, fw->data + (fw->size - len), payload_size); rc = nci_send_data(ndev, conn_id, skb); diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c index 712936f5d2d6..0877e2283f35 100644 --- a/drivers/nfc/fdp/i2c.c +++ b/drivers/nfc/fdp/i2c.c @@ -186,7 +186,7 @@ static int fdp_nci_i2c_read(struct fdp_i2c_phy *phy, struct sk_buff **skb) goto flush; } - memcpy(skb_put(*skb, len), tmp, len); + skb_put_data(*skb, tmp, len); fdp_nci_i2c_dump_skb(&client->dev, "fdp_rd", *skb); fdp_nci_i2c_remove_len_lrc(*skb); diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c index c38bdd6a5a82..7c710458568e 100644 --- a/drivers/nfc/nfcmrvl/fw_dnld.c +++ b/drivers/nfc/nfcmrvl/fw_dnld.c @@ -324,10 +324,9 @@ static int process_state_fw_dnld(struct nfcmrvl_private *priv, out_skb = alloc_lc_skb(priv, priv->fw_dnld.chunk_len); if (!out_skb) return -ENOMEM; - memcpy(skb_put(out_skb, priv->fw_dnld.chunk_len), - ((uint8_t *)priv->fw_dnld.fw->data) + - priv->fw_dnld.offset, - priv->fw_dnld.chunk_len); + skb_put_data(out_skb, + ((uint8_t *)priv->fw_dnld.fw->data) + priv->fw_dnld.offset, + priv->fw_dnld.chunk_len); nci_send_frame(priv->ndev, out_skb); priv->fw_dnld.substate = SUBSTATE_WAIT_DATA_CREDIT; } diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c index 78b7aa835c81..ffec103702f1 100644 --- a/drivers/nfc/nfcmrvl/i2c.c +++ b/drivers/nfc/nfcmrvl/i2c.c @@ -60,7 +60,7 @@ static int nfcmrvl_i2c_read(struct nfcmrvl_i2c_drv_data *drv_data, return -ENOMEM; /* Copy NCI header into the SKB */ - memcpy(skb_put(*skb, NCI_CTRL_HDR_SIZE), &nci_hdr, NCI_CTRL_HDR_SIZE); + skb_put_data(*skb, &nci_hdr, NCI_CTRL_HDR_SIZE); if (nci_hdr.plen) { /* Read the NCI payload */ diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c index 585a0f20835b..699aa9d16575 100644 --- a/drivers/nfc/nfcmrvl/usb.c +++ b/drivers/nfc/nfcmrvl/usb.c @@ -83,8 +83,8 @@ static void nfcmrvl_bulk_complete(struct urb *urb) if (!skb) { nfc_err(&drv_data->udev->dev, "failed to alloc mem\n"); } else { - memcpy(skb_put(skb, urb->actual_length), - urb->transfer_buffer, urb->actual_length); + skb_put_data(skb, urb->transfer_buffer, + urb->actual_length); if (nfcmrvl_nci_recv_frame(drv_data->priv, skb) < 0) nfc_err(&drv_data->udev->dev, "corrupted Rx packet\n"); diff --git a/drivers/nfc/nxp-nci/firmware.c b/drivers/nfc/nxp-nci/firmware.c index 553011f58339..99ffee1dfd1e 100644 --- a/drivers/nfc/nxp-nci/firmware.c +++ b/drivers/nfc/nxp-nci/firmware.c @@ -124,8 +124,7 @@ static int nxp_nci_fw_send_chunk(struct nxp_nci_info *info) header |= chunk_len & NXP_NCI_FW_FRAME_LEN_MASK; put_unaligned_be16(header, skb_put(skb, NXP_NCI_FW_HDR_LEN)); - memcpy(skb_put(skb, chunk_len), fw_info->data + fw_info->written, - chunk_len); + skb_put_data(skb, fw_info->data + fw_info->written, chunk_len); crc = nxp_nci_fw_crc(skb->data, chunk_len + NXP_NCI_FW_HDR_LEN); put_unaligned_be16(crc, skb_put(skb, NXP_NCI_FW_CRC_LEN)); diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index ff22d761183c..198585bbc771 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -135,7 +135,7 @@ static int nxp_nci_i2c_fw_read(struct nxp_nci_i2c_phy *phy, goto fw_read_exit; } - memcpy(skb_put(*skb, NXP_NCI_FW_HDR_LEN), &header, NXP_NCI_FW_HDR_LEN); + skb_put_data(*skb, &header, NXP_NCI_FW_HDR_LEN); r = i2c_master_recv(client, skb_put(*skb, frame_len), frame_len); if (r != frame_len) { @@ -176,8 +176,7 @@ static int nxp_nci_i2c_nci_read(struct nxp_nci_i2c_phy *phy, goto nci_read_exit; } - memcpy(skb_put(*skb, NCI_CTRL_HDR_SIZE), (void *) &header, - NCI_CTRL_HDR_SIZE); + skb_put_data(*skb, (void *)&header, NCI_CTRL_HDR_SIZE); r = i2c_master_recv(client, skb_put(*skb, header.plen), header.plen); if (r != header.plen) { diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index 70c304504a29..9200bb308e42 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c @@ -1035,11 +1035,10 @@ static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev) *skb_put(skb, 1) = PN533_INIT_TARGET_DEP; /* MIFARE params */ - memcpy(skb_put(skb, 6), mifare_params, 6); + skb_put_data(skb, mifare_params, 6); /* Felica params */ - felica = skb_put(skb, 18); - memcpy(felica, felica_params, 18); + felica = skb_put_data(skb, felica_params, 18); get_random_bytes(felica + 2, 6); /* NFCID3 */ @@ -1049,8 +1048,7 @@ static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev) /* General bytes */ *skb_put(skb, 1) = gbytes_len; - gb = skb_put(skb, gbytes_len); - memcpy(gb, gbytes, gbytes_len); + gb = skb_put_data(skb, gbytes, gbytes_len); /* Len Tk */ *skb_put(skb, 1) = 0; @@ -1384,15 +1382,14 @@ static int pn533_poll_dep(struct nfc_dev *nfc_dev) *next = 0; /* Copy passive data */ - memcpy(skb_put(skb, PASSIVE_DATA_LEN), passive_data, PASSIVE_DATA_LEN); + skb_put_data(skb, passive_data, PASSIVE_DATA_LEN); *next |= 1; /* Copy NFCID3 (which is NFCID2 from SENSF_RES) */ - memcpy(skb_put(skb, NFC_NFCID3_MAXSIZE), nfcid3, - NFC_NFCID3_MAXSIZE); + skb_put_data(skb, nfcid3, NFC_NFCID3_MAXSIZE); *next |= 2; - memcpy(skb_put(skb, dev->gb_len), dev->gb, dev->gb_len); + skb_put_data(skb, dev->gb, dev->gb_len); *next |= 4; /* We have some Gi */ rc = pn533_send_cmd_async(dev, PN533_CMD_IN_JUMP_FOR_DEP, skb, @@ -1472,7 +1469,7 @@ static struct sk_buff *pn533_alloc_poll_in_frame(struct pn533 *dev, if (!skb) return NULL; - memcpy(skb_put(skb, mod->len), &mod->data, mod->len); + skb_put_data(skb, &mod->data, mod->len); return skb; } @@ -1858,7 +1855,7 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, *next = 0; /* Copy passive data */ - memcpy(skb_put(skb, PASSIVE_DATA_LEN), passive_data, PASSIVE_DATA_LEN); + skb_put_data(skb, passive_data, PASSIVE_DATA_LEN); *next |= 1; /* Copy NFCID3 (which is NFCID2 from SENSF_RES) */ @@ -1866,12 +1863,11 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, memcpy(skb_put(skb, NFC_NFCID3_MAXSIZE), target->nfcid2, target->nfcid2_len); else - memcpy(skb_put(skb, NFC_NFCID3_MAXSIZE), nfcid3, - NFC_NFCID3_MAXSIZE); + skb_put_data(skb, nfcid3, NFC_NFCID3_MAXSIZE); *next |= 2; if (gb != NULL && gb_len > 0) { - memcpy(skb_put(skb, gb_len), gb, gb_len); + skb_put_data(skb, gb, gb_len); *next |= 4; /* We have some Gi */ } else { *next = 0; @@ -2100,7 +2096,7 @@ static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb) *skb_push(frag, sizeof(u8)) = 1; /* TG */ } - memcpy(skb_put(frag, frag_size), skb->data, frag_size); + skb_put_data(frag, skb->data, frag_size); /* Reduce the size of incoming buffer */ skb_pull(skb, frag_size); @@ -2375,7 +2371,7 @@ static int pn533_set_configuration(struct pn533 *dev, u8 cfgitem, u8 *cfgdata, return -ENOMEM; *skb_put(skb, sizeof(cfgitem)) = cfgitem; - memcpy(skb_put(skb, cfgdata_len), cfgdata, cfgdata_len); + skb_put_data(skb, cfgdata, cfgdata_len); resp = pn533_send_cmd_sync(dev, PN533_CMD_RF_CONFIGURATION, skb); if (IS_ERR(resp)) diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index 8ed203ea21ea..e153e8b64bb8 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c @@ -75,8 +75,8 @@ static void pn533_recv_response(struct urb *urb) if (!skb) { nfc_err(&phy->udev->dev, "failed to alloc memory\n"); } else { - memcpy(skb_put(skb, urb->actual_length), - urb->transfer_buffer, urb->actual_length); + skb_put_data(skb, urb->transfer_buffer, + urb->actual_length); } } diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index 19be93e177fe..e1260da73d45 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -1089,9 +1089,8 @@ static int port100_in_set_rf(struct nfc_digital_dev *ddev, u8 rf) if (!skb) return -ENOMEM; - memcpy(skb_put(skb, sizeof(struct port100_in_rf_setting)), - &in_rf_settings[rf], - sizeof(struct port100_in_rf_setting)); + skb_put_data(skb, &in_rf_settings[rf], + sizeof(struct port100_in_rf_setting)); resp = port100_send_cmd_sync(dev, PORT100_CMD_IN_SET_RF, skb); @@ -1133,7 +1132,7 @@ static int port100_in_set_framing(struct nfc_digital_dev *ddev, int param) if (!skb) return -ENOMEM; - memcpy(skb_put(skb, size), protocols, size); + skb_put_data(skb, protocols, size); resp = port100_send_cmd_sync(dev, PORT100_CMD_IN_SET_PROTOCOL, skb); @@ -1247,9 +1246,8 @@ static int port100_tg_set_rf(struct nfc_digital_dev *ddev, u8 rf) if (!skb) return -ENOMEM; - memcpy(skb_put(skb, sizeof(struct port100_tg_rf_setting)), - &tg_rf_settings[rf], - sizeof(struct port100_tg_rf_setting)); + skb_put_data(skb, &tg_rf_settings[rf], + sizeof(struct port100_tg_rf_setting)); resp = port100_send_cmd_sync(dev, PORT100_CMD_TG_SET_RF, skb); @@ -1291,7 +1289,7 @@ static int port100_tg_set_framing(struct nfc_digital_dev *ddev, int param) if (!skb) return -ENOMEM; - memcpy(skb_put(skb, size), protocols, size); + skb_put_data(skb, protocols, size); resp = port100_send_cmd_sync(dev, PORT100_CMD_TG_SET_PROTOCOL, skb); diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c index 5f97da1947e3..38548bd970cd 100644 --- a/drivers/nfc/s3fwrn5/firmware.c +++ b/drivers/nfc/s3fwrn5/firmware.c @@ -76,9 +76,9 @@ static int s3fwrn5_fw_prep_msg(struct s3fwrn5_fw_info *fw_info, if (!skb) return -ENOMEM; - memcpy(skb_put(skb, S3FWRN5_FW_HDR_SIZE), &hdr, S3FWRN5_FW_HDR_SIZE); + skb_put_data(skb, &hdr, S3FWRN5_FW_HDR_SIZE); if (len) - memcpy(skb_put(skb, len), data, len); + skb_put_data(skb, data, len); *msg = skb; diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c index 3ed0adf6479b..3f09d7fd2285 100644 --- a/drivers/nfc/s3fwrn5/i2c.c +++ b/drivers/nfc/s3fwrn5/i2c.c @@ -157,7 +157,7 @@ static int s3fwrn5_i2c_read(struct s3fwrn5_i2c_phy *phy) if (!skb) return -ENOMEM; - memcpy(skb_put(skb, hdr_size), hdr, hdr_size); + skb_put_data(skb, hdr, hdr_size); if (data_len == 0) goto out; diff --git a/drivers/nfc/st21nfca/dep.c b/drivers/nfc/st21nfca/dep.c index 798a32bbac5d..ada7b114b6c1 100644 --- a/drivers/nfc/st21nfca/dep.c +++ b/drivers/nfc/st21nfca/dep.c @@ -564,7 +564,7 @@ int st21nfca_im_send_atr_req(struct nfc_hci_dev *hdev, u8 *gb, size_t gb_len) atr_req->ppi = ST21NFCA_LR_BITS_PAYLOAD_SIZE_254B; if (gb_len) { atr_req->ppi |= ST21NFCA_GB_BIT; - memcpy(skb_put(skb, gb_len), gb, gb_len); + skb_put_data(skb, gb, gb_len); } atr_req->length = sizeof(struct st21nfca_atr_req) + hdev->gb_len; diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c index 02a920ca07c8..94d0b913b627 100644 --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c @@ -407,7 +407,7 @@ static int st21nfca_hci_i2c_read(struct st21nfca_i2c_phy *phy, phy->current_read_len = 0; } - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); if (skb->data[skb->len - 1] == ST21NFCA_SOF_EOF) { phy->current_read_len = 0; diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index 0ca2ccc09ca6..2576284f99a7 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -116,7 +116,7 @@ static int rpmsg_ept_cb(struct rpmsg_device *rpdev, void *buf, int len, if (!skb) return -ENOMEM; - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); spin_lock(&eptdev->queue_lock); skb_queue_tail(&eptdev->queue, skb); diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c index 730d9619400e..e9847ce3860d 100644 --- a/drivers/s390/net/ctcm_fsms.c +++ b/drivers/s390/net/ctcm_fsms.c @@ -1279,7 +1279,7 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) __func__, data_space); while ((skb = skb_dequeue(&ch->collect_queue))) { - memcpy(skb_put(ch->trans_skb, skb->len), skb->data, skb->len); + skb_put_data(ch->trans_skb, skb->data, skb->len); p_header = (struct pdu *) (skb_tail_pointer(ch->trans_skb) - skb->len); p_header->pdu_flag = 0x00; @@ -1431,13 +1431,12 @@ static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg) break; case MPCG_STATE_FLOWC: case MPCG_STATE_READY: - memcpy(skb_put(new_skb, block_len), - skb->data, block_len); + skb_put_data(new_skb, skb->data, block_len); skb_queue_tail(&ch->io_queue, new_skb); tasklet_schedule(&ch->ch_tasklet); break; default: - memcpy(skb_put(new_skb, len), skb->data, len); + skb_put_data(new_skb, skb->data, len); skb_queue_tail(&ch->io_queue, new_skb); tasklet_hi_schedule(&ch->ch_tasklet); break; diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 198842ce6876..99121352c57b 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c @@ -522,7 +522,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb) ctcm_clear_busy(ch->netdev); return -ENOMEM; } else { - memcpy(skb_put(nskb, skb->len), skb->data, skb->len); + skb_put_data(nskb, skb->data, skb->len); atomic_inc(&nskb->users); atomic_dec(&skb->users); dev_kfree_skb_irq(skb); @@ -638,7 +638,7 @@ static void ctcmpc_send_sweep_req(struct channel *rch) header->th.th_seq_num = 0x00; header->sw.th_last_seq = ch->th_seq_num; - memcpy(skb_put(sweep_skb, TH_SWEEP_LENGTH), header, TH_SWEEP_LENGTH); + skb_put_data(sweep_skb, header, TH_SWEEP_LENGTH); kfree(header); @@ -728,7 +728,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) if (!nskb) { goto nomem_exit; } else { - memcpy(skb_put(nskb, skb->len), skb->data, skb->len); + skb_put_data(nskb, skb->data, skb->len); atomic_inc(&nskb->users); atomic_dec(&skb->users); dev_kfree_skb_irq(skb); @@ -809,7 +809,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) skb_reset_tail_pointer(ch->trans_skb); ch->trans_skb->len = 0; ch->ccw[1].count = skb->len; - memcpy(skb_put(ch->trans_skb, skb->len), skb->data, skb->len); + skb_put_data(ch->trans_skb, skb->data, skb->len); atomic_dec(&skb->users); dev_kfree_skb_irq(skb); ccw_idx = 0; @@ -960,7 +960,7 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) } newskb->protocol = skb->protocol; skb_reserve(newskb, TH_HEADER_LENGTH + PDU_HEADER_LENGTH); - memcpy(skb_put(newskb, skb->len), skb->data, skb->len); + skb_put_data(newskb, skb->data, skb->len); dev_kfree_skb_any(skb); skb = newskb; } diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c index c103fc7efe9f..f8be39634f03 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c @@ -667,7 +667,7 @@ static void ctcmpc_send_sweep_resp(struct channel *rch) header->th.th_seq_num = 0x00; header->sw.th_last_seq = ch->th_seq_num; - memcpy(skb_put(sweep_skb, TH_SWEEP_LENGTH), header, TH_SWEEP_LENGTH); + skb_put_data(sweep_skb, header, TH_SWEEP_LENGTH); kfree(header); @@ -974,9 +974,8 @@ void mpc_channel_action(struct channel *ch, int direction, int action) skb_reset_tail_pointer(ch->xid_skb); ch->xid_skb->len = 0; - memcpy(skb_put(ch->xid_skb, grp->xid_skb->len), - grp->xid_skb->data, - grp->xid_skb->len); + skb_put_data(ch->xid_skb, grp->xid_skb->data, + grp->xid_skb->len); ch->xid->xid2_dlc_type = ((CHANNEL_DIRECTION(ch->flags) == CTCM_READ) @@ -1149,7 +1148,7 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); goto done; } - memcpy(skb_put(skb, new_len), pskb->data, new_len); + skb_put_data(skb, pskb->data, new_len); skb_reset_mac_header(skb); skb->dev = pskb->dev; @@ -1297,16 +1296,15 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) /* base xid for all channels in group */ grp->xid_skb_data = grp->xid_skb->data; grp->xid_th = (struct th_header *)grp->xid_skb->data; - memcpy(skb_put(grp->xid_skb, TH_HEADER_LENGTH), - &thnorm, TH_HEADER_LENGTH); + skb_put_data(grp->xid_skb, &thnorm, TH_HEADER_LENGTH); grp->xid = (struct xid2 *)skb_tail_pointer(grp->xid_skb); - memcpy(skb_put(grp->xid_skb, XID2_LENGTH), &init_xid, XID2_LENGTH); + skb_put_data(grp->xid_skb, &init_xid, XID2_LENGTH); grp->xid->xid2_adj_id = jiffies | 0xfff00000; grp->xid->xid2_sender_id = jiffies; grp->xid_id = skb_tail_pointer(grp->xid_skb); - memcpy(skb_put(grp->xid_skb, 4), "VTAM", 4); + skb_put_data(grp->xid_skb, "VTAM", 4); grp->rcvd_xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); @@ -1318,8 +1316,7 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) } grp->rcvd_xid_data = grp->rcvd_xid_skb->data; grp->rcvd_xid_th = (struct th_header *)grp->rcvd_xid_skb->data; - memcpy(skb_put(grp->rcvd_xid_skb, TH_HEADER_LENGTH), - &thnorm, TH_HEADER_LENGTH); + skb_put_data(grp->rcvd_xid_skb, &thnorm, TH_HEADER_LENGTH); grp->saved_xid2 = NULL; priv->xid = grp->xid; priv->mpcg = grp; @@ -1410,8 +1407,7 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) skb_reset_tail_pointer(grp->rcvd_xid_skb); grp->rcvd_xid_skb->len = 0; grp->rcvd_xid_th = (struct th_header *)grp->rcvd_xid_skb->data; - memcpy(skb_put(grp->rcvd_xid_skb, TH_HEADER_LENGTH), &thnorm, - TH_HEADER_LENGTH); + skb_put_data(grp->rcvd_xid_skb, &thnorm, TH_HEADER_LENGTH); if (grp->send_qllc_disc == 1) { grp->send_qllc_disc = 0; @@ -1590,8 +1586,7 @@ static int mpc_validate_xid(struct mpcg_info *mpcginfo) grp->saved_xid2 = (struct xid2 *)skb_tail_pointer(grp->rcvd_xid_skb); - memcpy(skb_put(grp->rcvd_xid_skb, - XID2_LENGTH), xid, XID2_LENGTH); + skb_put_data(grp->rcvd_xid_skb, xid, XID2_LENGTH); grp->rcvd_xid_skb->data = grp->rcvd_xid_data; skb_reset_tail_pointer(grp->rcvd_xid_skb); @@ -1908,17 +1903,15 @@ static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) if (fsm_getstate(ch->fsm) == CH_XID7_PENDING1) { fsm_newstate(ch->fsm, CH_XID7_PENDING2); ch->ccw[8].cmd_code = CCW_CMD_SENSE_CMD; - memcpy(skb_put(ch->xid_skb, - TH_HEADER_LENGTH), - &thdummy, TH_HEADER_LENGTH); + skb_put_data(ch->xid_skb, &thdummy, + TH_HEADER_LENGTH); send = 1; } } else if (fsm_getstate(ch->fsm) < CH_XID7_PENDING2) { fsm_newstate(ch->fsm, CH_XID7_PENDING2); ch->ccw[8].cmd_code = CCW_CMD_WRITE_CTL; - memcpy(skb_put(ch->xid_skb, - TH_HEADER_LENGTH), - &thnorm, TH_HEADER_LENGTH); + skb_put_data(ch->xid_skb, &thnorm, + TH_HEADER_LENGTH); send = 1; } } else { @@ -1926,17 +1919,16 @@ static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) if (grp->roll == YSIDE) { if (fsm_getstate(ch->fsm) < CH_XID7_PENDING4) { fsm_newstate(ch->fsm, CH_XID7_PENDING4); - memcpy(skb_put(ch->xid_skb, - TH_HEADER_LENGTH), - &thnorm, TH_HEADER_LENGTH); + skb_put_data(ch->xid_skb, &thnorm, + TH_HEADER_LENGTH); ch->ccw[8].cmd_code = CCW_CMD_WRITE_CTL; send = 1; } } else if (fsm_getstate(ch->fsm) == CH_XID7_PENDING3) { fsm_newstate(ch->fsm, CH_XID7_PENDING4); ch->ccw[8].cmd_code = CCW_CMD_SENSE_CMD; - memcpy(skb_put(ch->xid_skb, TH_HEADER_LENGTH), - &thdummy, TH_HEADER_LENGTH); + skb_put_data(ch->xid_skb, &thdummy, + TH_HEADER_LENGTH); send = 1; } } @@ -2122,7 +2114,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) return -ENOMEM; } - memcpy(skb_put(skb, new_len), qllcptr, new_len); + skb_put_data(skb, qllcptr, new_len); kfree(qllcptr); if (skb_headroom(skb) < 4) { diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 211b31d9f157..337bacb43d68 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c @@ -1796,7 +1796,7 @@ lcs_get_skb(struct lcs_card *card, char *skb_data, unsigned int skb_len) card->stats.rx_dropped++; return; } - memcpy(skb_put(skb, skb_len), skb_data, skb_len); + skb_put_data(skb, skb_data, skb_len); skb->protocol = card->lan_type_trans(skb, card->dev); card->stats.rx_bytes += skb_len; card->stats.rx_packets++; diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index fa732bd86729..7db427c0a6a4 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c @@ -759,8 +759,7 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg) spin_lock_irqsave(&conn->collect_lock, saveflags); while ((skb = skb_dequeue(&conn->collect_queue))) { header.next = conn->tx_buff->len + skb->len + NETIUCV_HDRLEN; - memcpy(skb_put(conn->tx_buff, NETIUCV_HDRLEN), &header, - NETIUCV_HDRLEN); + skb_put_data(conn->tx_buff, &header, NETIUCV_HDRLEN); skb_copy_from_linear_data(skb, skb_put(conn->tx_buff, skb->len), skb->len); @@ -780,7 +779,7 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg) } header.next = 0; - memcpy(skb_put(conn->tx_buff, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); + skb_put_data(conn->tx_buff, &header, NETIUCV_HDRLEN); conn->prof.send_stamp = jiffies; txmsg.class = 0; txmsg.tag = 0; @@ -1201,8 +1200,7 @@ static int netiucv_transmit_skb(struct iucv_connection *conn, return rc; } else { skb_reserve(nskb, NETIUCV_HDRLEN); - memcpy(skb_put(nskb, skb->len), - skb->data, skb->len); + skb_put_data(nskb, skb->data, skb->len); } copied = 1; } @@ -1212,7 +1210,7 @@ static int netiucv_transmit_skb(struct iucv_connection *conn, header.next = nskb->len + NETIUCV_HDRLEN; memcpy(skb_push(nskb, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); header.next = 0; - memcpy(skb_put(nskb, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); + skb_put_data(nskb, &header, NETIUCV_HDRLEN); fsm_newstate(conn->fsm, CONN_STATE_TX); conn->prof.send_stamp = jiffies; diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 1fb92e870040..08338f27c82c 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -5147,12 +5147,11 @@ static inline int qeth_create_skb_frag(struct qeth_qdio_buffer *qethbuffer, skb_reserve(*pskb, ETH_HLEN); if (data_len <= QETH_RX_PULL_LEN) { - memcpy(skb_put(*pskb, data_len), element->addr + offset, - data_len); + skb_put_data(*pskb, element->addr + offset, data_len); } else { get_page(page); - memcpy(skb_put(*pskb, QETH_RX_PULL_LEN), - element->addr + offset, QETH_RX_PULL_LEN); + skb_put_data(*pskb, element->addr + offset, + QETH_RX_PULL_LEN); skb_fill_page_desc(*pskb, *pfrag, page, offset + QETH_RX_PULL_LEN, data_len - QETH_RX_PULL_LEN); @@ -5248,8 +5247,7 @@ struct sk_buff *qeth_core_get_next_skb(struct qeth_card *card, &skb, offset, &frag, data_len)) goto no_mem; } else { - memcpy(skb_put(skb, data_len), data_ptr, - data_len); + skb_put_data(skb, data_ptr, data_len); } } skb_len -= data_len; diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index cf809987f79f..9ab6ce231f11 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -161,12 +161,9 @@ static int gdm_lte_emulate_arp(struct sk_buff *skb_in, u32 nic_type) return -ENOMEM; skb_reserve(skb_out, NET_IP_ALIGN); - memcpy(skb_put(skb_out, mac_header_len), mac_header_data, - mac_header_len); - memcpy(skb_put(skb_out, sizeof(struct arphdr)), arp_out, - sizeof(struct arphdr)); - memcpy(skb_put(skb_out, sizeof(struct arpdata)), arp_data_out, - sizeof(struct arpdata)); + skb_put_data(skb_out, mac_header_data, mac_header_len); + skb_put_data(skb_out, arp_out, sizeof(struct arphdr)); + skb_put_data(skb_out, arp_data_out, sizeof(struct arpdata)); skb_out->protocol = ((struct ethhdr *)mac_header_data)->h_proto; skb_out->dev = skb_in->dev; @@ -322,14 +319,10 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type) return -ENOMEM; skb_reserve(skb_out, NET_IP_ALIGN); - memcpy(skb_put(skb_out, mac_header_len), mac_header_data, - mac_header_len); - memcpy(skb_put(skb_out, sizeof(struct ipv6hdr)), &ipv6_out, - sizeof(struct ipv6hdr)); - memcpy(skb_put(skb_out, sizeof(struct icmp6hdr)), &icmp6_out, - sizeof(struct icmp6hdr)); - memcpy(skb_put(skb_out, sizeof(struct neighbour_advertisement)), &na, - sizeof(struct neighbour_advertisement)); + skb_put_data(skb_out, mac_header_data, mac_header_len); + skb_put_data(skb_out, &ipv6_out, sizeof(struct ipv6hdr)); + skb_put_data(skb_out, &icmp6_out, sizeof(struct icmp6hdr)); + skb_put_data(skb_out, &na, sizeof(struct neighbour_advertisement)); skb_out->protocol = ((struct ethhdr *)mac_header_data)->h_proto; skb_out->dev = skb_in->dev; @@ -669,8 +662,8 @@ static void gdm_lte_netif_rx(struct net_device *dev, char *buf, return; skb_reserve(skb, NET_IP_ALIGN); - memcpy(skb_put(skb, mac_header_len), mac_header_data, mac_header_len); - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, mac_header_data, mac_header_len); + skb_put_data(skb, buf, len); skb->protocol = ((struct ethhdr *)mac_header_data)->h_proto; skb->dev = dev; diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 49e95426ac30..da801d3e0585 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -466,12 +466,12 @@ void hostif_data_indication(struct ks_wlan_private *priv) DPRINTK(4, "SNAP, rx_ind_size = %d\n", rx_ind_size); size = ETH_ALEN * 2; - memcpy(skb_put(skb, size), priv->rxp, size); + skb_put_data(skb, priv->rxp, size); /* (SNAP+UI..) skip */ size = rx_ind_size - (ETH_ALEN * 2); - memcpy(skb_put(skb, size), ð_hdr->h_proto, size); + skb_put_data(skb, ð_hdr->h_proto, size); aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + ETHER_HDR_SIZE); break; @@ -484,14 +484,13 @@ void hostif_data_indication(struct ks_wlan_private *priv) } DPRINTK(3, "NETBEUI/NetBIOS rx_ind_size=%d\n", rx_ind_size); - memcpy(skb_put(skb, 12), priv->rxp, 12); /* 8802/FDDI MAC copy */ + skb_put_data(skb, priv->rxp, 12); /* 8802/FDDI MAC copy */ temp[0] = (((rx_ind_size - 12) >> 8) & 0xff); /* NETBEUI size add */ temp[1] = ((rx_ind_size - 12) & 0xff); - memcpy(skb_put(skb, 2), temp, 2); + skb_put_data(skb, temp, 2); - memcpy(skb_put(skb, rx_ind_size - 14), priv->rxp + 12, - rx_ind_size - 14); /* copy after Type */ + skb_put_data(skb, priv->rxp + 12, rx_ind_size - 14); /* copy after Type */ aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 14); break; diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index ce1764cba5f0..995674f25172 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -486,11 +486,11 @@ static int aim_rx_data(struct mbo *mbo) ether_addr_copy(skb_put(skb, ETH_ALEN), dev->dev_addr); /* src */ - memcpy(skb_put(skb, 4), &zero, 4); - memcpy(skb_put(skb, 2), buf + 5, 2); + skb_put_data(skb, &zero, 4); + skb_put_data(skb, buf + 5, 2); /* eth type */ - memcpy(skb_put(skb, 2), buf + 10, 2); + skb_put_data(skb, buf + 10, 2); buf += MDP_HDR_LEN; len -= MDP_HDR_LEN; @@ -499,7 +499,7 @@ static int aim_rx_data(struct mbo *mbo) len -= MEP_HDR_LEN; } - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); skb->protocol = eth_type_trans(skb, dev); skb_len = skb->len; if (netif_rx(skb) == NET_RX_SUCCESS) { diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index 65a285631994..72baedefa0f1 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c @@ -287,8 +287,7 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget) else ptr += 6; } - memcpy(skb_put(skb, work->word1.len), ptr, - work->word1.len); + skb_put_data(skb, ptr, work->word1.len); /* No packet buffers to free */ } else { int segments = work->word2.s.bufs; @@ -323,10 +322,9 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget) if (segment_size > len) segment_size = len; /* Copy the data into the packet */ - memcpy(skb_put(skb, segment_size), - cvmx_phys_to_ptr( - segment_ptr.s.addr), - segment_size); + skb_put_data(skb, + cvmx_phys_to_ptr(segment_ptr.s.addr), + segment_size); len -= segment_size; segment_ptr = next_ptr; } diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index c6c4404e717b..14173cf6e1e7 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -1544,8 +1544,8 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) sub_skb = dev_alloc_skb(nSubframe_Length + 12); if (sub_skb) { skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); - memcpy(data_ptr, pdata, nSubframe_Length); + data_ptr = skb_put_data(sub_skb, pdata, + nSubframe_Length); } else { sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC); if (sub_skb) { diff --git a/drivers/staging/rtl8188eu/os_dep/mon.c b/drivers/staging/rtl8188eu/os_dep/mon.c index 859d0d6051cd..225c23fc69dc 100644 --- a/drivers/staging/rtl8188eu/os_dep/mon.c +++ b/drivers/staging/rtl8188eu/os_dep/mon.c @@ -53,7 +53,7 @@ static void mon_recv_decrypted(struct net_device *dev, const u8 *data, skb = netdev_alloc_skb(dev, data_len); if (!skb) return; - memcpy(skb_put(skb, data_len), data, data_len); + skb_put_data(skb, data, data_len); /* * Frame data is not encrypted. Strip off protection so diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 43a77745e6fb..bae98ca0a9b6 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -817,8 +817,7 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, if (!sub_skb) return 0; skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, skb->len); - memcpy(data_ptr, skb->data, skb->len); + data_ptr = skb_put_data(sub_skb, skb->data, skb->len); sub_skb->dev = ieee->dev; rxb->subframes[0] = sub_skb; @@ -870,8 +869,7 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, if (!sub_skb) return 0; skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); - memcpy(data_ptr, skb->data, nSubframe_Length); + data_ptr = skb_put_data(sub_skb, skb->data, nSubframe_Length); sub_skb->dev = ieee->dev; rxb->subframes[rxb->nr_subframes++] = sub_skb; @@ -1141,13 +1139,12 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, /* copy first fragment (including full headers) into * beginning of the fragment cache skb */ - memcpy(skb_put(frag_skb, flen), skb->data, flen); + skb_put_data(frag_skb, skb->data, flen); } else { /* append frame payload to the end of the fragment * cache skb */ - memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, - flen); + skb_put_data(frag_skb, skb->data + hdrlen, flen); } dev_kfree_skb_any(skb); skb = NULL; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index eeda17d6409b..60d07d0bb4eb 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1272,8 +1272,7 @@ rtllib_association_req(struct rtllib_network *beacon, hdr->info_element[0].id = MFIE_TYPE_SSID; hdr->info_element[0].len = beacon->ssid_len; - tag = skb_put(skb, beacon->ssid_len); - memcpy(tag, beacon->ssid, beacon->ssid_len); + tag = skb_put_data(skb, beacon->ssid, beacon->ssid_len); tag = skb_put(skb, rate_len); @@ -1349,8 +1348,7 @@ rtllib_association_req(struct rtllib_network *beacon, } if (wpa_ie_len) { - tag = skb_put(skb, ieee->wpa_ie_len); - memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); + tag = skb_put_data(skb, ieee->wpa_ie, ieee->wpa_ie_len); if (PMKCacheIdx >= 0) { tag = skb_put(skb, 18); @@ -1366,8 +1364,7 @@ rtllib_association_req(struct rtllib_network *beacon, } if (wps_ie_len && ieee->wps_ie) { - tag = skb_put(skb, wps_ie_len); - memcpy(tag, ieee->wps_ie, wps_ie_len); + tag = skb_put_data(skb, ieee->wps_ie, wps_ie_len); } tag = skb_put(skb, turbo_info_len); diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 78a3ad5b231f..fc88d47dea43 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -624,8 +624,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) txb->encrypted = 0; txb->payload_size = cpu_to_le16(skb->len); - memcpy(skb_put(txb->fragments[0], skb->len), skb->data, - skb->len); + skb_put_data(txb->fragments[0], skb->data, skb->len); goto success; } @@ -818,9 +817,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } else { tcb_desc->bHwSec = 0; } - frag_hdr = (struct rtllib_hdr_3addrqos *) - skb_put(skb_frag, hdr_len); - memcpy(frag_hdr, &header, hdr_len); + frag_hdr = skb_put_data(skb_frag, &header, hdr_len); /* If this is not the last fragment, then add the * MOREFRAGS bit to the frame control @@ -852,7 +849,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) bytes -= SNAP_SIZE + sizeof(u16); } - memcpy(skb_put(skb_frag, bytes), skb->data, bytes); + skb_put_data(skb_frag, skb->data, bytes); /* Advance the SKB... */ skb_pull(skb, bytes); @@ -895,8 +892,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) txb->encrypted = 0; txb->payload_size = cpu_to_le16(skb->len); - memcpy(skb_put(txb->fragments[0], skb->len), skb->data, - skb->len); + skb_put_data(txb->fragments[0], skb->data, skb->len); } success: diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 7a31510f0524..c0e2f711cb4e 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -848,8 +848,8 @@ static u8 parse_subframe(struct sk_buff *skb, if (!sub_skb) return 0; skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); - memcpy(data_ptr, skb->data, nSubframe_Length); + data_ptr = skb_put_data(sub_skb, skb->data, + nSubframe_Length); #endif rxb->subframes[rxb->nr_subframes++] = sub_skb; if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { @@ -1180,12 +1180,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, if (frag == 0) { /* copy first fragment (including full headers) into * beginning of the fragment cache skb */ - memcpy(skb_put(frag_skb, flen), skb->data, flen); + skb_put_data(frag_skb, skb->data, flen); } else { /* append frame payload to the end of the fragment * cache skb */ - memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, - flen); + skb_put_data(frag_skb, skb->data + hdrlen, flen); } dev_kfree_skb_any(skb); skb = NULL; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 14aea26804f4..903a1d0269df 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1115,8 +1115,7 @@ ieee80211_association_req(struct ieee80211_network *beacon, hdr->info_element[0].id = MFIE_TYPE_SSID; hdr->info_element[0].len = beacon->ssid_len; - tag = skb_put(skb, beacon->ssid_len); - memcpy(tag, beacon->ssid, beacon->ssid_len); + tag = skb_put_data(skb, beacon->ssid, beacon->ssid_len); tag = skb_put(skb, rate_len); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index bdb96a45a9eb..f58971a4a2e3 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -794,8 +794,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) { tcb_desc->bHwSec = 0; } - frag_hdr = (struct rtl_80211_hdr_3addrqos *)skb_put(skb_frag, hdr_len); - memcpy(frag_hdr, &header, hdr_len); + frag_hdr = skb_put_data(skb_frag, &header, hdr_len); /* If this is not the last fragment, then add the MOREFRAGS * bit to the frame control @@ -826,7 +825,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) bytes -= SNAP_SIZE + sizeof(u16); } - memcpy(skb_put(skb_frag, bytes), skb->data, bytes); + skb_put_data(skb_frag, skb->data, bytes); /* Advance the SKB... */ skb_pull(skb, bytes); @@ -869,7 +868,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) txb->encrypted = 0; txb->payload_size = __cpu_to_le16(skb->len); - memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len); + skb_put_data(txb->fragments[0], skb->data, skb->len); } success: diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index bb6d8bd6c7ac..c3cf01c842a3 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -45,8 +45,7 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL; tcb_desc->bLastIniPkt = 0; skb_reserve(skb, USB_HWDESC_HEADER_LEN); - ptr_buf = skb_put(skb, DataLen); - memcpy(ptr_buf, pData, DataLen); + ptr_buf = skb_put_data(skb, pData, DataLen); tcb_desc->txbuf_size = (u16)DataLen; if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) || diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index 266ffefd55ed..f96c558b3c6a 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -372,8 +372,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe) if (!sub_skb) break; skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); - memcpy(data_ptr, pdata, nSubframe_Length); + data_ptr = skb_put_data(sub_skb, pdata, nSubframe_Length); subframes[nr_subframes++] = sub_skb; if (nr_subframes >= MAX_SUBFRAME_COUNT) { netdev_warn(padapter->pnetdev, "r8712u: ParseSubframe(): Too many Subframes! Packets dropped!\n"); diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index e731ab4e2bd7..1a6443dc3ff0 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -82,8 +82,8 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 if (sub_skb) { skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); - memcpy(data_ptr, (pdata + ETH_HLEN), nSubframe_Length); + data_ptr = skb_put_data(sub_skb, (pdata + ETH_HLEN), + nSubframe_Length); } else { diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index c9782d452b07..dbc266a37974 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -72,7 +72,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) if (!skb) return; - memcpy(skb_put(skb, size), buff, size); + skb_put_data(skb, buff, size); cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push(skb, sizeof(*cb_hdr)); memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr)); @@ -100,7 +100,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) if (!skb) return; - memcpy(skb_put(skb, size), buff, size); + skb_put_data(skb, buff, size); hdr = (struct wilc_wfi_radiotap_hdr *)skb_push(skb, sizeof(*hdr)); memset(hdr, 0, sizeof(struct wilc_wfi_radiotap_hdr)); hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */ @@ -200,7 +200,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, if (!skb2) return -ENOMEM; - memcpy(skb_put(skb2, skb->len), skb->data, skb->len); + skb_put_data(skb2, skb->data, skb->len); cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push(skb2, sizeof(*cb_hdr)); memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr)); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d6d803416be2..f36598a89ce0 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1160,7 +1160,7 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) skb->dev = wilc_netdev; - memcpy(skb_put(skb, frame_len), buff_to_send, frame_len); + skb_put_data(skb, buff_to_send, frame_len); skb->protocol = eth_type_trans(skb, wilc_netdev); vif->netstats.rx_packets++; diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index a812e55ba1b0..1de67f209f2c 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -3530,13 +3530,11 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev, /* Copy the 802.11 header to the skb * (ctl frames may be less than a full header) */ - datap = skb_put(skb, hdrlen); - memcpy(datap, &rxdesc->frame_control, hdrlen); + datap = skb_put_data(skb, &rxdesc->frame_control, hdrlen); /* If any, copy the data from the card to the skb */ if (datalen > 0) { - datap = skb_put(skb, datalen); - memcpy(datap, rxfrm->data, datalen); + datap = skb_put_data(skb, rxfrm->data, datalen); /* check for unencrypted stuff if WEP bit set. */ if (*(datap - hdrlen + 1) & 0x40) /* wep set */ diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c index c0dfb642383b..c2f9a3263b37 100644 --- a/drivers/tty/ipwireless/network.c +++ b/drivers/tty/ipwireless/network.c @@ -355,7 +355,7 @@ static struct sk_buff *ipw_packet_received_skb(unsigned char *data, if (skb == NULL) return NULL; skb_reserve(skb, 2); - memcpy(skb_put(skb, length), data, length); + skb_put_data(skb, data, length); return skb; } diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 2667a205a5ab..da830f833392 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2688,7 +2688,7 @@ static void gsm_mux_rx_netchar(struct gsm_dlci *dlci, return; } skb_reserve(skb, NET_IP_ALIGN); - memcpy(skb_put(skb, size), in_buf, size); + skb_put_data(skb, in_buf, size); skb->dev = net; skb->protocol = htons(ETH_P_IP); diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c index a2c308f7d637..3fafc5a1b2e0 100644 --- a/drivers/tty/synclink.c +++ b/drivers/tty/synclink.c @@ -7960,7 +7960,7 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size) return; } - memcpy(skb_put(skb, size), buf, size); + skb_put_data(skb, buf, size); skb->protocol = hdlc_type_trans(skb, dev); diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 31885f20fc15..7e947ecf15f1 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -1755,7 +1755,7 @@ static void hdlcdev_rx(struct slgt_info *info, char *buf, int size) return; } - memcpy(skb_put(skb, size), buf, size); + skb_put_data(skb, buf, size); skb->protocol = hdlc_type_trans(skb, dev); diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c index 51e8846cd68f..9b4fb0251c1a 100644 --- a/drivers/tty/synclinkmp.c +++ b/drivers/tty/synclinkmp.c @@ -1874,7 +1874,7 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size) return; } - memcpy(skb_put(skb, size), buf, size); + skb_put_data(skb, buf, size); skb->protocol = hdlc_type_trans(skb, dev); diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index 2882c6d3ae66..630616aaa861 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -1007,8 +1007,8 @@ static struct sk_buff *package_for_tx(struct f_ncm *ncm) ntb_iter = skb_put_zero(skb2, ndp_pad); /* Copy NTB across. */ - ntb_iter = (void *) skb_put(skb2, ncm->skb_tx_ndp->len); - memcpy(ntb_iter, ncm->skb_tx_ndp->data, ncm->skb_tx_ndp->len); + ntb_iter = skb_put_data(skb2, ncm->skb_tx_ndp->data, + ncm->skb_tx_ndp->len); dev_consume_skb_any(ncm->skb_tx_ndp); ncm->skb_tx_ndp = NULL; @@ -1129,8 +1129,7 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port, /* Add the new data to the skb */ ntb_data = skb_put_zero(ncm->skb_tx_data, dgram_pad); - ntb_data = (void *) skb_put(ncm->skb_tx_data, skb->len); - memcpy(ntb_data, skb->data, skb->len); + ntb_data = skb_put_data(ncm->skb_tx_data, skb->data, skb->len); dev_consume_skb_any(skb); skb = NULL; @@ -1313,8 +1312,8 @@ static int ncm_unwrap_ntb(struct gether *port, dg_len - crc_len); if (skb2 == NULL) goto err; - memcpy(skb_put(skb2, dg_len - crc_len), - skb->data + index, dg_len - crc_len); + skb_put_data(skb2, skb->data + index, + dg_len - crc_len); skb_queue_tail(list, skb2); diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c index 6a1ce6a55158..9c4c58e4a1a2 100644 --- a/drivers/usb/gadget/function/f_phonet.c +++ b/drivers/usb/gadget/function/f_phonet.c @@ -336,7 +336,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req) skb->protocol = htons(ETH_P_PHONET); skb_reset_mac_header(skb); /* Can't use pskb_pull() on page in IRQ */ - memcpy(skb_put(skb, 1), page_address(page), 1); + skb_put_data(skb, page_address(page), 1); } skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h index ac02c54520e9..a7330eb3ec64 100644 --- a/include/linux/mISDNif.h +++ b/include/linux/mISDNif.h @@ -554,7 +554,7 @@ _alloc_mISDN_skb(u_int prim, u_int id, u_int len, void *dp, gfp_t gfp_mask) if (!skb) return NULL; if (len) - memcpy(skb_put(skb, len), dp, len); + skb_put_data(skb, dp, len); hh = mISDN_HEAD_P(skb); hh->prim = prim; hh->id = id; diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 01ea64d0783a..5af5385a0e72 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1913,6 +1913,16 @@ static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len) return tmp; } +static inline void *skb_put_data(struct sk_buff *skb, const void *data, + unsigned int len) +{ + void *tmp = skb_put(skb, len); + + memcpy(tmp, data, len); + + return tmp; +} + unsigned char *skb_push(struct sk_buff *skb, unsigned int len); static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) { diff --git a/lib/nlattr.c b/lib/nlattr.c index d09d9746fc5d..ab15a6c095d3 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -616,7 +616,7 @@ int nla_append(struct sk_buff *skb, int attrlen, const void *data) if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen))) return -EMSGSIZE; - memcpy(skb_put(skb, attrlen), data, attrlen); + skb_put_data(skb, data, attrlen); return 0; } EXPORT_SYMBOL(nla_append); diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index fa8d6b475c06..a3501173e200 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -732,8 +732,8 @@ static void batadv_iv_ogm_aggregate(struct batadv_forw_packet *forw_packet_aggr, unsigned char *skb_buff; unsigned long new_direct_link_flag; - skb_buff = skb_put(forw_packet_aggr->skb, packet_len); - memcpy(skb_buff, packet_buff, packet_len); + skb_buff = skb_put_data(forw_packet_aggr->skb, packet_buff, + packet_len); forw_packet_aggr->packet_len += packet_len; forw_packet_aggr->num_packets++; diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 03a35c9f456d..1e3dc374bfde 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -166,8 +166,7 @@ static void batadv_v_ogm_send(struct work_struct *work) goto reschedule; skb_reserve(skb, ETH_HLEN); - pkt_buff = skb_put(skb, ogm_buff_len); - memcpy(pkt_buff, ogm_buff, ogm_buff_len); + pkt_buff = skb_put_data(skb, ogm_buff, ogm_buff_len); ogm_packet = (struct batadv_ogm2_packet *)skb->data; ogm_packet->seqno = htonl(atomic_read(&bat_priv->bat_v.ogm_seqno)); @@ -382,8 +381,7 @@ static void batadv_v_ogm_forward(struct batadv_priv *bat_priv, goto out; skb_reserve(skb, ETH_HLEN); - skb_buff = skb_put(skb, packet_len); - memcpy(skb_buff, ogm_received, packet_len); + skb_buff = skb_put_data(skb, ogm_received, packet_len); /* apply forward penalty */ ogm_forward = (struct batadv_ogm2_packet *)skb_buff; diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index 8f964beaac28..a98cf1104a30 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c @@ -296,8 +296,7 @@ batadv_frag_merge_packets(struct hlist_head *chain) /* Copy the payload of the each fragment into the last skb */ hlist_for_each_entry(entry, chain, list) { size = entry->skb->len - hdr_size; - memcpy(skb_put(skb_out, size), entry->skb->data + hdr_size, - size); + skb_put_data(skb_out, entry->skb->data + hdr_size, size); } free: diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 9e59b6654126..f4c64ef01c24 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -122,7 +122,7 @@ static inline void cmtp_add_msgpart(struct cmtp_session *session, int id, const if (skb && (skb->len > 0)) skb_copy_from_linear_data(skb, skb_put(nskb, skb->len), skb->len); - memcpy(skb_put(nskb, count), buf, count); + skb_put_data(nskb, buf, count); session->reassembly[id] = nskb; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 93806b959039..d860e3cc23cf 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3266,7 +3266,7 @@ int hci_reset_dev(struct hci_dev *hdev) return -ENOMEM; hci_skb_pkt_type(skb) = HCI_EVENT_PKT; - memcpy(skb_put(skb, 3), hw_err, 3); + skb_put_data(skb, hw_err, 3); /* Send Hardware Error to upper stack */ return hci_recv_frame(hdev, skb); diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index b5faff458d8b..4e4105a932bd 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -304,7 +304,7 @@ struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, hdr->plen = plen; if (plen) - memcpy(skb_put(skb, plen), param, plen); + skb_put_data(skb, param, plen); BT_DBG("skb len %d", skb->len); diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 638bf0e1a2e3..083e87f26a0f 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -379,7 +379,7 @@ void hci_send_monitor_ctrl_event(struct hci_dev *hdev, u16 event, put_unaligned_le16(event, skb_put(skb, 2)); if (data) - memcpy(skb_put(skb, data_len), data, data_len); + skb_put_data(skb, data, data_len); skb->tstamp = tstamp; @@ -515,10 +515,10 @@ static struct sk_buff *create_monitor_ctrl_open(struct sock *sk) put_unaligned_le32(hci_pi(sk)->cookie, skb_put(skb, 4)); put_unaligned_le16(format, skb_put(skb, 2)); - memcpy(skb_put(skb, sizeof(ver)), ver, sizeof(ver)); + skb_put_data(skb, ver, sizeof(ver)); put_unaligned_le32(flags, skb_put(skb, 4)); *skb_put(skb, 1) = TASK_COMM_LEN; - memcpy(skb_put(skb, TASK_COMM_LEN), hci_pi(sk)->comm, TASK_COMM_LEN); + skb_put_data(skb, hci_pi(sk)->comm, TASK_COMM_LEN); __net_timestamp(skb); @@ -586,7 +586,7 @@ static struct sk_buff *create_monitor_ctrl_command(struct sock *sk, u16 index, put_unaligned_le16(opcode, skb_put(skb, 2)); if (buf) - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); __net_timestamp(skb); diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 0bec4588c3c8..9e83713262e8 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -114,7 +114,7 @@ static int hidp_send_message(struct hidp_session *session, struct socket *sock, *skb_put(skb, 1) = hdr; if (data && size > 0) - memcpy(skb_put(skb, size), data, size); + skb_put_data(skb, data, size); skb_queue_tail(transmit, skb); wake_up_interruptible(sk_sleep(sk)); diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index f88ac99528ce..fe6a5529bdf5 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -2923,7 +2923,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code, if (dlen) { count -= L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE; - memcpy(skb_put(skb, count), data, count); + skb_put_data(skb, data, count); data += count; } @@ -2938,7 +2938,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code, if (!*frag) goto fail; - memcpy(skb_put(*frag, count), data, count); + skb_put_data(*frag, data, count); len -= count; data += count; diff --git a/net/bluetooth/mgmt_util.c b/net/bluetooth/mgmt_util.c index c933bd08c1fe..11d0ca64402b 100644 --- a/net/bluetooth/mgmt_util.c +++ b/net/bluetooth/mgmt_util.c @@ -44,7 +44,7 @@ static struct sk_buff *create_monitor_ctrl_event(__le16 index, u32 cookie, put_unaligned_le16(opcode, skb_put(skb, 2)); if (buf) - memcpy(skb_put(skb, len), buf, len); + skb_put_data(skb, buf, len); __net_timestamp(skb); @@ -75,7 +75,7 @@ int mgmt_send_event(u16 event, struct hci_dev *hdev, unsigned short channel, hdr->len = cpu_to_le16(data_len); if (data) - memcpy(skb_put(skb, data_len), data, data_len); + skb_put_data(skb, data, data_len); /* Time stamp */ __net_timestamp(skb); diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 2f2cb5e27cdd..5f3074cb6b4d 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -798,7 +798,7 @@ static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, in skb_reserve(skb, RFCOMM_SKB_HEAD_RESERVE); - memcpy(skb_put(skb, size), buf + sent, size); + skb_put_data(skb, buf + sent, size); rfcomm_dlc_send_noerror(dlc, skb); diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c index bb6ed8e97580..15bf0c5322ab 100644 --- a/net/bridge/netfilter/nft_reject_bridge.c +++ b/net/bridge/netfilter/nft_reject_bridge.c @@ -151,8 +151,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net, icmph->type = ICMP_DEST_UNREACH; icmph->code = code; - payload = skb_put(nskb, len); - memcpy(payload, skb_network_header(oldskb), len); + payload = skb_put_data(nskb, skb_network_header(oldskb), len); csum = csum_partial((void *)icmph, len + sizeof(struct icmphdr), 0); icmph->checksum = csum_fold(csum); @@ -278,8 +277,7 @@ static void nft_reject_br_send_v6_unreach(struct net *net, icmp6h->icmp6_type = ICMPV6_DEST_UNREACH; icmp6h->icmp6_code = code; - payload = skb_put(nskb, len); - memcpy(payload, skb_network_header(oldskb), len); + payload = skb_put_data(nskb, skb_network_header(oldskb), len); nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr)); icmp6h->icmp6_cksum = diff --git a/net/can/bcm.c b/net/can/bcm.c index 65432633a250..47a8748d953a 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -282,7 +282,7 @@ static void bcm_can_tx(struct bcm_op *op) can_skb_prv(skb)->ifindex = dev->ifindex; can_skb_prv(skb)->skbcnt = 0; - memcpy(skb_put(skb, op->cfsiz), cf, op->cfsiz); + skb_put_data(skb, cf, op->cfsiz); /* send with loopback */ skb->dev = dev; @@ -318,13 +318,13 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, if (!skb) return; - memcpy(skb_put(skb, sizeof(*head)), head, sizeof(*head)); + skb_put_data(skb, head, sizeof(*head)); if (head->nframes) { /* CAN frames starting here */ firstframe = (struct canfd_frame *)skb_tail_pointer(skb); - memcpy(skb_put(skb, datalen), frames, datalen); + skb_put_data(skb, frames, datalen); /* * the BCM uses the flags-element of the canfd_frame diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index 849805e7af52..b8a558715395 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c @@ -533,7 +533,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) *skb_put(skb,1) = len; if (len > 0) - memcpy(skb_put(skb, len), scp->conndata_out.opt_data, len); + skb_put_data(skb, scp->conndata_out.opt_data, len); dn_nsp_send(skb); @@ -691,22 +691,22 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) aux = scp->accessdata.acc_userl; *skb_put(skb, 1) = aux; if (aux > 0) - memcpy(skb_put(skb, aux), scp->accessdata.acc_user, aux); + skb_put_data(skb, scp->accessdata.acc_user, aux); aux = scp->accessdata.acc_passl; *skb_put(skb, 1) = aux; if (aux > 0) - memcpy(skb_put(skb, aux), scp->accessdata.acc_pass, aux); + skb_put_data(skb, scp->accessdata.acc_pass, aux); aux = scp->accessdata.acc_accl; *skb_put(skb, 1) = aux; if (aux > 0) - memcpy(skb_put(skb, aux), scp->accessdata.acc_acc, aux); + skb_put_data(skb, scp->accessdata.acc_acc, aux); aux = (__u8)le16_to_cpu(scp->conndata_out.opt_optl); *skb_put(skb, 1) = aux; if (aux > 0) - memcpy(skb_put(skb, aux), scp->conndata_out.opt_data, aux); + skb_put_data(skb, scp->conndata_out.opt_data, aux); scp->persist = dn_nsp_persist(sk); scp->persist_fxn = dn_nsp_retrans_conninit; diff --git a/net/ieee802154/6lowpan/tx.c b/net/ieee802154/6lowpan/tx.c index dbb476d7d38f..e6ff5128e61a 100644 --- a/net/ieee802154/6lowpan/tx.c +++ b/net/ieee802154/6lowpan/tx.c @@ -121,8 +121,7 @@ lowpan_alloc_frag(struct sk_buff *skb, int size, *mac_cb(frag) = *mac_cb(skb); if (frag1) { - memcpy(skb_put(frag, skb->mac_len), - skb_mac_header(skb), skb->mac_len); + skb_put_data(frag, skb_mac_header(skb), skb->mac_len); } else { rc = wpan_dev_hard_header(frag, wdev, &master_hdr->dest, @@ -152,8 +151,8 @@ lowpan_xmit_fragment(struct sk_buff *skb, const struct ieee802154_hdr *wpan_hdr, if (IS_ERR(frag)) return PTR_ERR(frag); - memcpy(skb_put(frag, frag_hdrlen), frag_hdr, frag_hdrlen); - memcpy(skb_put(frag, len), skb_network_header(skb) + offset, len); + skb_put_data(frag, frag_hdr, frag_hdrlen); + skb_put_data(frag, skb_network_header(skb) + offset, len); raw_dump_table(__func__, " fragment dump", frag->data, frag->len); diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 9098429e38bc..b64046ccae69 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1602,7 +1602,7 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu) ip6_mc_hdr(sk, skb, dev, saddr, &mld2_all_mcr, NEXTHDR_HOP, 0); - memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra)); + skb_put_data(skb, ra, sizeof(ra)); skb_set_transport_header(skb, skb_tail_pointer(skb) - skb->data); skb_put(skb, sizeof(*pmr)); @@ -2006,7 +2006,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ip6_mc_hdr(sk, skb, dev, saddr, snd_addr, NEXTHDR_HOP, payload_len); - memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra)); + skb_put_data(skb, ra, sizeof(ra)); hdr = skb_put_zero(skb, sizeof(struct mld_msg)); hdr->mld_type = type; diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index f6061c4bb0a8..ec157c3419b5 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -690,7 +690,7 @@ static int ircomm_tty_write(struct tty_struct *tty, } /* Copy data */ - memcpy(skb_put(skb,size), buf + len, size); + skb_put_data(skb, buf + len, size); count -= size; len += size; diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index b936b1251a66..bf56ac7dba96 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c @@ -392,8 +392,7 @@ void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s, info[0] = discovery->data.charset; len = IRDA_MIN(discovery->name_len, skb_tailroom(tx_skb)); - info = skb_put(tx_skb, len); - memcpy(info, discovery->data.info, len); + info = skb_put_data(tx_skb, discovery->data.info, len); } irlap_queue_xmit(self, tx_skb); } @@ -1216,8 +1215,7 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, frame->control = TEST_RSP | PF_BIT; /* Copy info */ - info = skb_put(tx_skb, cmd->len); - memcpy(info, cmd->data, cmd->len); + info = skb_put_data(tx_skb, cmd->data, cmd->len); /* Return to sender */ irlap_wait_min_turn_around(self, &self->qos_tx); diff --git a/net/key/af_key.c b/net/key/af_key.c index 8ad430edb5b8..3ebb4268973b 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -1706,8 +1706,7 @@ static int unicast_flush_resp(struct sock *sk, const struct sadb_msg *ihdr) if (!skb) return -ENOBUFS; - hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); - memcpy(hdr, ihdr, sizeof(struct sadb_msg)); + hdr = skb_put_data(skb, ihdr, sizeof(struct sadb_msg)); hdr->sadb_msg_errno = (uint8_t) 0; hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 660ac6a426f4..e9c6aa3ed05b 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -1569,7 +1569,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, return; skb_reserve(skb, local->tx_headroom); - memcpy(skb_put(skb, presp->head_len), presp->head, presp->head_len); + skb_put_data(skb, presp->head, presp->head_len); memcpy(((struct ieee80211_mgmt *) skb->data)->da, mgmt->sa, ETH_ALEN); ibss_dbg(sdata, "Sending ProbeResp to %pM\n", mgmt->sa); diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index e45c8d94952e..861697f2d75b 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -345,7 +345,7 @@ int mesh_add_vendor_ies(struct ieee80211_sub_if_data *sdata, data = ifmsh->ie + offset; if (skb_tailroom(skb) < len) return -ENOMEM; - memcpy(skb_put(skb, len), data, len); + skb_put_data(skb, data, len); } return 0; @@ -369,7 +369,7 @@ int mesh_add_rsn_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) if (skb_tailroom(skb) < len) return -ENOMEM; - memcpy(skb_put(skb, len), data, len); + skb_put_data(skb, data, len); return 0; } @@ -1125,8 +1125,8 @@ ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata, goto out; skb_reserve(presp, local->tx_headroom); - memcpy(skb_put(presp, bcn->head_len), bcn->head, bcn->head_len); - memcpy(skb_put(presp, bcn->tail_len), bcn->tail, bcn->tail_len); + skb_put_data(presp, bcn->head, bcn->head_len); + skb_put_data(presp, bcn->tail, bcn->tail_len); hdr = (struct ieee80211_mgmt *) presp->data; hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index e810334595ff..7be7917e1541 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -796,8 +796,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) after_ric, ARRAY_SIZE(after_ric), offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, assoc_data->ie + offset, noffset - offset); + pos = skb_put_data(skb, assoc_data->ie + offset, + noffset - offset); offset = noffset; } @@ -834,8 +834,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len, before_vht, ARRAY_SIZE(before_vht), offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, assoc_data->ie + offset, noffset - offset); + pos = skb_put_data(skb, assoc_data->ie + offset, + noffset - offset); offset = noffset; } @@ -848,8 +848,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) noffset = ieee80211_ie_split_vendor(assoc_data->ie, assoc_data->ie_len, offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, assoc_data->ie + offset, noffset - offset); + pos = skb_put_data(skb, assoc_data->ie + offset, + noffset - offset); offset = noffset; } @@ -868,8 +868,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) /* add any remaining custom (i.e. vendor specific here) IEs */ if (assoc_data->ie_len) { noffset = assoc_data->ie_len; - pos = skb_put(skb, noffset - offset); - memcpy(pos, assoc_data->ie + offset, noffset - offset); + pos = skb_put_data(skb, assoc_data->ie + offset, + noffset - offset); } if (assoc_data->fils_kek_len && diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index eede5c6db8d5..f8e7a8bbc618 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c @@ -885,8 +885,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, } skb_reserve(skb, local->hw.extra_tx_headroom); - data = skb_put(skb, params->len); - memcpy(data, params->buf, params->len); + data = skb_put_data(skb, params->buf, params->len); /* Update CSA counters */ if (sdata->vif.csa_active && diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index e1ab1c4af33c..53b00bb52095 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2098,7 +2098,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) } } while ((skb = __skb_dequeue(&entry->skb_list))) { - memcpy(skb_put(rx->skb, skb->len), skb->data, skb->len); + skb_put_data(rx->skb, skb->data, skb->len); dev_kfree_skb(skb); } diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index c379c99cd1d8..86740670102d 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -388,8 +388,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, before_ext_cap, ARRAY_SIZE(before_ext_cap), offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -418,8 +417,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, before_ht_cap, ARRAY_SIZE(before_ht_cap), offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -490,8 +488,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, before_vht_cap, ARRAY_SIZE(before_vht_cap), offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -532,8 +529,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, /* add any remaining IEs */ if (extra_ies_len) { noffset = extra_ies_len; - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); } } @@ -575,8 +571,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, before_qos, ARRAY_SIZE(before_qos), offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -596,8 +591,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, before_ht_op, ARRAY_SIZE(before_ht_op), offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -638,8 +632,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, /* add any remaining IEs */ if (extra_ies_len) { noffset = extra_ies_len; - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); } } @@ -670,8 +663,7 @@ ieee80211_tdls_add_chan_switch_req_ies(struct ieee80211_sub_if_data *sdata, before_lnkie, ARRAY_SIZE(before_lnkie), offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -680,8 +672,7 @@ ieee80211_tdls_add_chan_switch_req_ies(struct ieee80211_sub_if_data *sdata, /* add any remaining IEs */ if (extra_ies_len) { noffset = extra_ies_len; - pos = skb_put(skb, noffset - offset); - memcpy(pos, extra_ies + offset, noffset - offset); + pos = skb_put_data(skb, extra_ies + offset, noffset - offset); } } @@ -696,7 +687,7 @@ ieee80211_tdls_add_chan_switch_resp_ies(struct ieee80211_sub_if_data *sdata, ieee80211_tdls_add_link_ie(sdata, skb, peer, initiator); if (extra_ies_len) - memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); + skb_put_data(skb, extra_ies, extra_ies_len); } static void ieee80211_tdls_add_ies(struct ieee80211_sub_if_data *sdata, @@ -726,8 +717,7 @@ static void ieee80211_tdls_add_ies(struct ieee80211_sub_if_data *sdata, case WLAN_TDLS_TEARDOWN: case WLAN_TDLS_DISCOVERY_REQUEST: if (extra_ies_len) - memcpy(skb_put(skb, extra_ies_len), extra_ies, - extra_ies_len); + skb_put_data(skb, extra_ies, extra_ies_len); if (status_code == 0 || action_code == WLAN_TDLS_TEARDOWN) ieee80211_tdls_add_link_ie(sdata, skb, peer, initiator); break; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 1af9ed29a915..18c5d6e6305d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -903,8 +903,8 @@ static int ieee80211_fragment(struct ieee80211_tx_data *tx, tmp->dev = skb->dev; /* copy header and data */ - memcpy(skb_put(tmp, hdrlen), skb->data, hdrlen); - memcpy(skb_put(tmp, fraglen), skb->data + pos, fraglen); + skb_put_data(tmp, skb->data, hdrlen); + skb_put_data(tmp, skb->data + pos, fraglen); pos += fraglen; } @@ -4132,8 +4132,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw, goto out; skb_reserve(skb, local->tx_headroom); - memcpy(skb_put(skb, beacon->head_len), beacon->head, - beacon->head_len); + skb_put_data(skb, beacon->head, beacon->head_len); ieee80211_beacon_add_tim(sdata, &ap->ps, skb, is_template); @@ -4147,8 +4146,8 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw, } if (beacon->tail) - memcpy(skb_put(skb, beacon->tail_len), - beacon->tail, beacon->tail_len); + skb_put_data(skb, beacon->tail, + beacon->tail_len); } else goto out; } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { @@ -4171,8 +4170,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw, if (!skb) goto out; skb_reserve(skb, local->tx_headroom); - memcpy(skb_put(skb, beacon->head_len), beacon->head, - beacon->head_len); + skb_put_data(skb, beacon->head, beacon->head_len); hdr = (struct ieee80211_hdr *) skb->data; hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | @@ -4207,8 +4205,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw, if (!skb) goto out; skb_reserve(skb, local->tx_headroom); - memcpy(skb_put(skb, beacon->head_len), beacon->head, - beacon->head_len); + skb_put_data(skb, beacon->head, beacon->head_len); ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb, is_template); if (offs) { @@ -4216,8 +4213,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw, offs->tim_length = skb->len - beacon->head_len; } - memcpy(skb_put(skb, beacon->tail_len), beacon->tail, - beacon->tail_len); + skb_put_data(skb, beacon->tail, beacon->tail_len); } else { WARN_ON(1); goto out; @@ -4337,7 +4333,7 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, if (!skb) goto out; - memcpy(skb_put(skb, presp->len), presp->data, presp->len); + skb_put_data(skb, presp->data, presp->len); hdr = (struct ieee80211_hdr *) skb->data; memset(hdr->addr1, 0, sizeof(hdr->addr1)); diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 148c7276869c..259698de569f 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1252,7 +1252,7 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); mgmt->u.auth.status_code = cpu_to_le16(status); if (extra) - memcpy(skb_put(skb, extra_len), extra, extra_len); + skb_put_data(skb, extra, extra_len); if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); @@ -1292,8 +1292,7 @@ void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, skb_reserve(skb, local->hw.extra_tx_headroom); /* copy in frame */ - memcpy(skb_put(skb, IEEE80211_DEAUTH_FRAME_LEN), - mgmt, IEEE80211_DEAUTH_FRAME_LEN); + skb_put_data(skb, mgmt, IEEE80211_DEAUTH_FRAME_LEN); if (sdata->vif.type != NL80211_IFTYPE_STATION || !(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 7586d446d7dc..bd24a975fd49 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -170,7 +170,7 @@ static struct sk_buff *netlink_to_full_skb(const struct sk_buff *skb, NETLINK_CB(new).dst_group = NETLINK_CB(skb).dst_group; NETLINK_CB(new).creds = NETLINK_CB(skb).creds; - memcpy(skb_put(new, len), skb->data, len); + skb_put_data(new, skb->data, len); return new; } diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c index f864ce19e13d..f44f75a2a4d5 100644 --- a/net/nfc/digital_dep.c +++ b/net/nfc/digital_dep.c @@ -226,8 +226,7 @@ digital_send_dep_data_prep(struct nfc_digital_dev *ddev, struct sk_buff *skb, return ERR_PTR(-ENOMEM); } - memcpy(skb_put(new_skb, ddev->remote_payload_max), skb->data, - ddev->remote_payload_max); + skb_put_data(new_skb, skb->data, ddev->remote_payload_max); skb_pull(skb, ddev->remote_payload_max); ddev->chaining_skb = skb; @@ -277,8 +276,7 @@ digital_recv_dep_data_gather(struct nfc_digital_dev *ddev, u8 pfb, ddev->chaining_skb = new_skb; } - memcpy(skb_put(ddev->chaining_skb, resp->len), resp->data, - resp->len); + skb_put_data(ddev->chaining_skb, resp->data, resp->len); kfree_skb(resp); resp = NULL; @@ -525,7 +523,7 @@ int digital_in_send_atr_req(struct nfc_digital_dev *ddev, if (gb_len) { atr_req->pp |= DIGITAL_GB_BIT; - memcpy(skb_put(skb, gb_len), gb, gb_len); + skb_put_data(skb, gb, gb_len); } digital_skb_push_dep_sod(ddev, skb); @@ -1012,8 +1010,7 @@ static int digital_tg_send_ack(struct nfc_digital_dev *ddev, if (ddev->did) { dep_res->pfb |= DIGITAL_NFC_DEP_PFB_DID_BIT; - memcpy(skb_put(skb, sizeof(ddev->did)), &ddev->did, - sizeof(ddev->did)); + skb_put_data(skb, &ddev->did, sizeof(ddev->did)); } ddev->curr_nfc_dep_pni = @@ -1057,8 +1054,7 @@ static int digital_tg_send_atn(struct nfc_digital_dev *ddev) if (ddev->did) { dep_res->pfb |= DIGITAL_NFC_DEP_PFB_DID_BIT; - memcpy(skb_put(skb, sizeof(ddev->did)), &ddev->did, - sizeof(ddev->did)); + skb_put_data(skb, &ddev->did, sizeof(ddev->did)); } digital_skb_push_dep_sod(ddev, skb); @@ -1325,8 +1321,7 @@ int digital_tg_send_dep_res(struct nfc_digital_dev *ddev, struct sk_buff *skb) if (ddev->did) { dep_res->pfb |= DIGITAL_NFC_DEP_PFB_DID_BIT; - memcpy(skb_put(skb, sizeof(ddev->did)), &ddev->did, - sizeof(ddev->did)); + skb_put_data(skb, &ddev->did, sizeof(ddev->did)); } ddev->curr_nfc_dep_pni = diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 2b0f0ac498d2..8741ad47a6fb 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c @@ -878,9 +878,9 @@ static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb) skb_queue_walk(&hdev->rx_hcp_frags, frag_skb) { msg_len = frag_skb->len - NFC_HCI_HCP_PACKET_HEADER_LEN; - memcpy(skb_put(hcp_skb, msg_len), - frag_skb->data + NFC_HCI_HCP_PACKET_HEADER_LEN, - msg_len); + skb_put_data(hcp_skb, + frag_skb->data + NFC_HCI_HCP_PACKET_HEADER_LEN, + msg_len); } skb_queue_purge(&hdev->rx_hcp_frags); diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c index c5959ce503e6..367d8c027101 100644 --- a/net/nfc/llcp_commands.c +++ b/net/nfc/llcp_commands.c @@ -298,7 +298,7 @@ static struct sk_buff *llcp_add_header(struct sk_buff *pdu, pr_debug("header 0x%x 0x%x\n", header[0], header[1]); - memcpy(skb_put(pdu, LLCP_HEADER_SIZE), header, LLCP_HEADER_SIZE); + skb_put_data(pdu, header, LLCP_HEADER_SIZE); return pdu; } @@ -311,7 +311,7 @@ static struct sk_buff *llcp_add_tlv(struct sk_buff *pdu, u8 *tlv, if (tlv == NULL) return NULL; - memcpy(skb_put(pdu, tlv_length), tlv, tlv_length); + skb_put_data(pdu, tlv, tlv_length); return pdu; } @@ -549,7 +549,7 @@ int nfc_llcp_send_snl_sdres(struct nfc_llcp_local *local, return PTR_ERR(skb); hlist_for_each_entry_safe(sdp, n, tlv_list, node) { - memcpy(skb_put(skb, sdp->tlv_len), sdp->tlv, sdp->tlv_len); + skb_put_data(skb, sdp->tlv, sdp->tlv_len); hlist_del(&sdp->node); @@ -581,8 +581,7 @@ int nfc_llcp_send_snl_sdreq(struct nfc_llcp_local *local, hlist_for_each_entry_safe(sdreq, n, tlv_list, node) { pr_debug("tid %d for %s\n", sdreq->tid, sdreq->uri); - memcpy(skb_put(skb, sdreq->tlv_len), sdreq->tlv, - sdreq->tlv_len); + skb_put_data(skb, sdreq->tlv, sdreq->tlv_len); hlist_del(&sdreq->node); @@ -622,7 +621,7 @@ int nfc_llcp_send_dm(struct nfc_llcp_local *local, u8 ssap, u8 dsap, u8 reason) skb = llcp_add_header(skb, dsap, ssap, LLCP_PDU_DM); - memcpy(skb_put(skb, 1), &reason, 1); + skb_put_data(skb, &reason, 1); skb_queue_head(&local->tx_queue, skb); @@ -693,7 +692,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, skb_put(pdu, LLCP_SEQUENCE_SIZE); if (likely(frag_len > 0)) - memcpy(skb_put(pdu, frag_len), msg_ptr, frag_len); + skb_put_data(pdu, msg_ptr, frag_len); skb_queue_tail(&sock->tx_queue, pdu); @@ -759,7 +758,7 @@ int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap, pdu = llcp_add_header(pdu, dsap, ssap, LLCP_PDU_UI); if (likely(frag_len > 0)) - memcpy(skb_put(pdu, frag_len), msg_ptr, frag_len); + skb_put_data(pdu, msg_ptr, frag_len); /* No need to check for the peer RW for UI frames */ skb_queue_tail(&local->tx_queue, pdu); diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c index e69786c6804c..02eef5cf3cce 100644 --- a/net/nfc/llcp_core.c +++ b/net/nfc/llcp_core.c @@ -1390,7 +1390,7 @@ static void nfc_llcp_recv_agf(struct nfc_llcp_local *local, struct sk_buff *skb) return; } - memcpy(skb_put(new_skb, pdu_len), skb->data, pdu_len); + skb_put_data(new_skb, skb->data, pdu_len); nfc_llcp_rx_skb(local, new_skb); diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 61fff422424f..17b9f1ce23db 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -462,7 +462,7 @@ int nci_nfcc_loopback(struct nci_dev *ndev, void *data, size_t data_len, return -ENOMEM; skb_reserve(skb, NCI_DATA_HDR_SIZE); - memcpy(skb_put(skb, data_len), data, data_len); + skb_put_data(skb, data, data_len); loopback_data.conn_id = conn_id; loopback_data.data = skb; @@ -1350,7 +1350,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload) nci_pbf_set((__u8 *)hdr, NCI_PBF_LAST); if (plen) - memcpy(skb_put(skb, plen), payload, plen); + skb_put_data(skb, payload, plen); skb_queue_tail(&ndev->cmd_q, skb); queue_work(ndev->cmd_wq, &ndev->cmd_work); diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c index dbd24254412a..2488d9241f1d 100644 --- a/net/nfc/nci/data.c +++ b/net/nfc/nci/data.c @@ -138,7 +138,7 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev, skb_reserve(skb_frag, NCI_DATA_HDR_SIZE); /* first, copy the data */ - memcpy(skb_put(skb_frag, frag_len), data, frag_len); + skb_put_data(skb_frag, data, frag_len); /* second, set the header */ nci_push_data_hdr(ndev, conn_id, skb_frag, diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c index a0ab26d535dc..d4a53ce818c3 100644 --- a/net/nfc/nci/hci.c +++ b/net/nfc/nci/hci.c @@ -187,7 +187,7 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, *skb_push(skb, 1) = cb; if (len > 0) - memcpy(skb_put(skb, len), data + i, len); + skb_put_data(skb, data + i, len); r = nci_send_data(ndev, conn_info->conn_id, skb); if (r < 0) @@ -476,8 +476,9 @@ void nci_hci_data_received_cb(void *context, skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { msg_len = frag_skb->len - NCI_HCI_HCP_PACKET_HEADER_LEN; - memcpy(skb_put(hcp_skb, msg_len), frag_skb->data + - NCI_HCI_HCP_PACKET_HEADER_LEN, msg_len); + skb_put_data(hcp_skb, + frag_skb->data + NCI_HCI_HCP_PACKET_HEADER_LEN, + msg_len); } skb_queue_purge(&ndev->hci_dev->rx_hcp_frags); diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c index c468eabd6943..cfa7f352c1c3 100644 --- a/net/nfc/nci/uart.c +++ b/net/nfc/nci/uart.c @@ -371,7 +371,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data, chunk_len = nu->rx_packet_len - nu->rx_skb->len; if (count < chunk_len) chunk_len = count; - memcpy(skb_put(nu->rx_skb, chunk_len), data, chunk_len); + skb_put_data(nu->rx_skb, data, chunk_len); data += chunk_len; count -= chunk_len; diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 825f97671591..cff679167bdc 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -239,7 +239,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) return -ENOMEM; skb_reset_transport_header(skb); - memcpy(skb_put(skb, len), data, len); + skb_put_data(skb, data, len); skb_queue_tail(&node->rx_queue, skb); schedule_work(&node->work); diff --git a/net/sctp/output.c b/net/sctp/output.c index c339c682675a..febcc350cf00 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -469,8 +469,7 @@ merge: auth = (struct sctp_auth_chunk *) skb_tail_pointer(nskb); - memcpy(skb_put(nskb, chunk->skb->len), chunk->skb->data, - chunk->skb->len); + skb_put_data(nskb, chunk->skb->data, chunk->skb->len); pr_debug("*** Chunk:%p[%s] %s 0x%x, length:%d, chunk->skb->len:%d, rtt_in_progress:%d\n", chunk, diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index aaac2660aaf7..034e916362cf 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -1479,9 +1479,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) int padlen = SCTP_PAD4(chunklen) - chunklen; padding = skb_put_zero(chunk->skb, padlen); - target = skb_put(chunk->skb, len); - - memcpy(target, data, len); + target = skb_put_data(chunk->skb, data, len); /* Adjust the chunk length field. */ chunk->chunk_hdr->length = htons(chunklen + padlen + len); diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 18e24793659f..24e2054bfbaf 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -132,12 +132,10 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque) break; } - t_hdr = skb_put(skb, sizeof(pkt->hdr)); - memcpy(t_hdr, &pkt->hdr, sizeof(pkt->hdr)); + t_hdr = skb_put_data(skb, &pkt->hdr, sizeof(pkt->hdr)); if (pkt->len) { - payload = skb_put(skb, pkt->len); - memcpy(payload, pkt->buf, pkt->len); + payload = skb_put_data(skb, pkt->buf, pkt->len); } return skb; diff --git a/net/x25/x25_subr.c b/net/x25/x25_subr.c index 6b5af65f491f..eb466ece1730 100644 --- a/net/x25/x25_subr.c +++ b/net/x25/x25_subr.c @@ -188,17 +188,14 @@ void x25_write_internal(struct sock *sk, int frametype) *dptr++ = X25_CALL_REQUEST; len = x25_addr_aton(addresses, &x25->dest_addr, &x25->source_addr); - dptr = skb_put(skb, len); - memcpy(dptr, addresses, len); + dptr = skb_put_data(skb, addresses, len); len = x25_create_facilities(facilities, &x25->facilities, &x25->dte_facilities, x25->neighbour->global_facil_mask); - dptr = skb_put(skb, len); - memcpy(dptr, facilities, len); - dptr = skb_put(skb, x25->calluserdata.cudlength); - memcpy(dptr, x25->calluserdata.cuddata, - x25->calluserdata.cudlength); + dptr = skb_put_data(skb, facilities, len); + dptr = skb_put_data(skb, x25->calluserdata.cuddata, + x25->calluserdata.cudlength); x25->calluserdata.cudlength = 0; break; @@ -210,17 +207,15 @@ void x25_write_internal(struct sock *sk, int frametype) &x25->facilities, &x25->dte_facilities, x25->vc_facil_mask); - dptr = skb_put(skb, len); - memcpy(dptr, facilities, len); + dptr = skb_put_data(skb, facilities, len); /* fast select with no restriction on response allows call user data. Userland must ensure it is ours and not theirs */ if(x25->facilities.reverse & 0x80) { - dptr = skb_put(skb, - x25->calluserdata.cudlength); - memcpy(dptr, x25->calluserdata.cuddata, - x25->calluserdata.cudlength); + dptr = skb_put_data(skb, + x25->calluserdata.cuddata, + x25->calluserdata.cudlength); } x25->calluserdata.cudlength = 0; break; -- cgit v1.2.3-55-g7522 From 4df864c1d9afb46e2461a9f808d9f11a42d31bad Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 16 Jun 2017 14:29:21 +0200 Subject: networking: make skb_put & friends return void pointers It seems like a historic accident that these return unsigned char *, and in many places that means casts are required, more often than not. Make these functions (skb_put, __skb_put and pskb_put) return void * and remove all the casts across the tree, adding a (u8 *) cast only where the unsigned char pointer was used directly, all done with the following spatch: @@ expression SKB, LEN; typedef u8; identifier fn = { skb_put, __skb_put }; @@ - *(fn(SKB, LEN)) + *(u8 *)fn(SKB, LEN) @@ expression E, SKB, LEN; identifier fn = { skb_put, __skb_put }; type T; @@ - E = ((T *)(fn(SKB, LEN))) + E = fn(SKB, LEN) which actually doesn't cover pskb_put since there are only three users overall. A handful of stragglers were converted manually, notably a macro in drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many instances in net/bluetooth/hci_sock.c. In the former file, I also had to fix one whitespace problem spatch introduced. Signed-off-by: Johannes Berg Signed-off-by: David S. Miller --- drivers/atm/atmtcp.c | 4 +- drivers/atm/solos-pci.c | 12 +-- drivers/bluetooth/bluecard_cs.c | 2 +- drivers/bluetooth/bt3c_cs.c | 2 +- drivers/bluetooth/btmrvl_main.c | 2 +- drivers/bluetooth/btuart_cs.c | 2 +- drivers/bluetooth/btusb.c | 10 +- drivers/bluetooth/dtl1_cs.c | 4 +- drivers/bluetooth/hci_bcm.c | 6 +- drivers/bluetooth/hci_intel.c | 6 +- drivers/bluetooth/hci_ll.c | 2 +- drivers/bluetooth/hci_nokia.c | 10 +- drivers/bluetooth/hci_qca.c | 2 +- drivers/bluetooth/hci_vhci.c | 4 +- drivers/crypto/chelsio/chcr_algo.c | 10 +- drivers/infiniband/core/addr.c | 3 +- drivers/infiniband/core/sa_query.c | 3 +- drivers/infiniband/hw/cxgb3/cxio_hal.c | 2 +- drivers/infiniband/hw/cxgb3/iwch_cm.c | 22 ++-- drivers/infiniband/hw/cxgb4/cm.c | 22 ++-- drivers/infiniband/hw/cxgb4/cq.c | 4 +- drivers/infiniband/hw/cxgb4/mem.c | 4 +- drivers/infiniband/hw/cxgb4/qp.c | 8 +- drivers/isdn/capi/capi.c | 4 +- drivers/isdn/gigaset/asyncdata.c | 26 ++--- drivers/isdn/gigaset/isocdata.c | 2 +- drivers/isdn/i4l/isdn_audio.c | 4 +- drivers/isdn/i4l/isdn_bsdcomp.c | 8 +- drivers/isdn/i4l/isdn_x25iface.c | 4 +- drivers/media/dvb-core/dvb_net.c | 2 +- drivers/media/radio/wl128x/fmdrv_common.c | 2 +- drivers/net/bonding/bond_3ad.c | 4 +- drivers/net/can/dev.c | 4 +- drivers/net/ethernet/allwinner/sun4i-emac.c | 2 +- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 12 +-- drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c | 4 +- drivers/net/ethernet/chelsio/cxgb3/l2t.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 4 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 8 +- drivers/net/ethernet/chelsio/cxgb4/l2t.c | 2 +- drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h | 10 +- drivers/net/ethernet/davicom/dm9000.c | 2 +- drivers/net/ethernet/dnet.c | 2 +- drivers/net/ethernet/hp/hp100.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_fcoe.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_selftest.c | 4 +- .../net/ethernet/mellanox/mlx5/core/en_selftest.c | 6 +- drivers/net/ethernet/micrel/ks8842.c | 4 +- drivers/net/ethernet/sfc/falcon/selftest.c | 3 +- drivers/net/ethernet/sfc/selftest.c | 3 +- drivers/net/hamradio/scc.c | 4 +- drivers/net/ppp/pppoe.c | 2 +- drivers/net/usb/cdc_ncm.c | 2 +- drivers/net/usb/net1080.c | 4 +- drivers/net/usb/zaurus.c | 8 +- drivers/net/wan/hdlc_ppp.c | 2 +- drivers/net/wireless/ath/ath6kl/debug.c | 2 +- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 6 +- drivers/net/wireless/ath/ath9k/htc_hst.c | 9 +- drivers/net/wireless/ath/wil6210/wmi.c | 2 +- drivers/net/wireless/cisco/airo.c | 4 +- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 2 +- drivers/net/wireless/intel/ipw2x00/libipw_tx.c | 3 +- drivers/net/wireless/intersil/hostap/hostap_ap.c | 2 +- drivers/net/wireless/intersil/p54/fwio.c | 43 ++++---- drivers/net/wireless/mac80211_hwsim.c | 8 +- drivers/net/wireless/marvell/mwifiex/11n_aggr.c | 2 +- drivers/net/wireless/marvell/mwifiex/tdls.c | 38 +++---- .../net/wireless/quantenna/qtnfmac/qlink_util.h | 11 +- drivers/net/wireless/ralink/rt2x00/rt2x00debug.c | 2 +- .../net/wireless/realtek/rtlwifi/rtl8192se/fw.c | 2 +- drivers/nfc/fdp/i2c.c | 2 +- drivers/nfc/microread/i2c.c | 4 +- drivers/nfc/microread/microread.c | 4 +- drivers/nfc/nfcmrvl/fw_dnld.c | 6 +- drivers/nfc/pn533/pn533.c | 32 +++--- drivers/nfc/pn544/i2c.c | 6 +- drivers/nfc/port100.c | 4 +- drivers/nfc/st21nfca/i2c.c | 6 +- drivers/nfc/st95hf/core.c | 2 +- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 2 +- drivers/scsi/fcoe/fcoe.c | 2 +- drivers/scsi/qedf/qedf_main.c | 2 +- drivers/staging/rtl8192e/rtl819x_BAProc.c | 10 +- drivers/staging/rtl8192e/rtllib_softmac.c | 34 +++--- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 21 ++-- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 8 +- drivers/target/iscsi/cxgbit/cxgbit_cm.c | 8 +- drivers/target/iscsi/cxgbit/cxgbit_ddp.c | 2 +- drivers/usb/gadget/function/f_ncm.c | 5 +- include/linux/skbuff.h | 8 +- lib/nlattr.c | 2 +- net/802/garp.c | 6 +- net/802/mrp.c | 11 +- net/appletalk/ddp.c | 2 +- net/atm/clip.c | 2 +- net/batman-adv/icmp_socket.c | 2 +- net/batman-adv/tp_meter.c | 6 +- net/bluetooth/hci_request.c | 2 +- net/bluetooth/hci_sock.c | 12 +-- net/bluetooth/hidp/core.c | 2 +- net/bluetooth/l2cap_core.c | 14 +-- net/bluetooth/mgmt_util.c | 10 +- net/bluetooth/rfcomm/core.c | 2 +- net/core/pktgen.c | 32 +++--- net/core/skbuff.c | 6 +- net/decnet/dn_dev.c | 2 +- net/decnet/dn_nsp_out.c | 18 ++-- net/ipv4/arp.c | 2 +- net/ipv4/igmp.c | 6 +- net/ipv4/ipmr.c | 2 +- net/ipv4/netfilter/ipt_SYNPROXY.c | 10 +- net/ipv4/netfilter/nf_reject_ipv4.c | 2 +- net/ipv6/mcast.c | 4 +- net/ipv6/ndisc.c | 8 +- net/ipv6/netfilter/ip6t_SYNPROXY.c | 10 +- net/ipv6/netfilter/nf_reject_ipv6.c | 2 +- net/irda/irlap_frame.c | 17 ++- net/key/af_key.c | 116 +++++++++------------ net/mac80211/cfg.c | 4 +- net/mac80211/ht.c | 2 +- net/mac80211/mesh.c | 2 +- net/mac80211/mesh_ps.c | 2 +- net/mac80211/sta_info.c | 2 +- net/mac80211/tdls.c | 10 +- net/mac80211/tx.c | 2 +- net/mac80211/wpa.c | 6 +- net/netfilter/nfnetlink_log.c | 2 +- net/netfilter/nfnetlink_queue.c | 2 +- net/netlink/af_netlink.c | 2 +- net/nfc/digital_core.c | 4 +- net/nfc/digital_dep.c | 2 +- net/nfc/digital_technology.c | 18 ++-- net/nfc/hci/core.c | 2 +- net/nfc/hci/llc_shdlc.c | 4 +- net/nfc/nci/core.c | 2 +- net/nfc/nci/hci.c | 2 +- net/nfc/nci/spi.c | 8 +- net/nfc/nci/uart.c | 2 +- net/psample/psample.c | 2 +- net/qrtr/qrtr.c | 2 +- net/sctp/sm_make_chunk.c | 2 +- net/sctp/ulpevent.c | 29 ++---- net/vmw_vsock/virtio_transport_common.c | 2 +- 145 files changed, 486 insertions(+), 547 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c index 3ef6253e1cce..56fa16c85ebf 100644 --- a/drivers/atm/atmtcp.c +++ b/drivers/atm/atmtcp.c @@ -60,7 +60,7 @@ static int atmtcp_send_control(struct atm_vcc *vcc,int type, return -EUNATCH; } atm_force_charge(out_vcc,skb->truesize); - new_msg = (struct atmtcp_control *) skb_put(skb,sizeof(*new_msg)); + new_msg = skb_put(skb, sizeof(*new_msg)); *new_msg = *msg; new_msg->hdr.length = ATMTCP_HDR_MAGIC; new_msg->type = type; @@ -217,7 +217,7 @@ static int atmtcp_v_send(struct atm_vcc *vcc,struct sk_buff *skb) atomic_inc(&vcc->stats->tx_err); return -ENOBUFS; } - hdr = (void *) skb_put(new_skb,sizeof(struct atmtcp_hdr)); + hdr = skb_put(new_skb, sizeof(struct atmtcp_hdr)); hdr->vpi = htons(vcc->vpi); hdr->vci = htons(vcc->vci); hdr->length = htonl(skb->len); diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 077dd15c3a40..4fc99ae1c534 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c @@ -205,7 +205,7 @@ static ssize_t solos_param_show(struct device *dev, struct device_attribute *att return -ENOMEM; } - header = (void *)skb_put(skb, sizeof(*header)); + header = skb_put(skb, sizeof(*header)); buflen = snprintf((void *)&header[1], buflen - 1, "L%05d\n%s\n", current->pid, attr->attr.name); @@ -261,7 +261,7 @@ static ssize_t solos_param_store(struct device *dev, struct device_attribute *at return -ENOMEM; } - header = (void *)skb_put(skb, sizeof(*header)); + header = skb_put(skb, sizeof(*header)); buflen = snprintf((void *)&header[1], buflen - 1, "L%05d\n%s\n%s\n", current->pid, attr->attr.name, buf); @@ -486,7 +486,7 @@ static int send_command(struct solos_card *card, int dev, const char *buf, size_ return 0; } - header = (void *)skb_put(skb, sizeof(*header)); + header = skb_put(skb, sizeof(*header)); header->size = cpu_to_le16(size); header->vpi = cpu_to_le16(0); @@ -945,7 +945,7 @@ static int popen(struct atm_vcc *vcc) dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); return -ENOMEM; } - header = (void *)skb_put(skb, sizeof(*header)); + header = skb_put(skb, sizeof(*header)); header->size = cpu_to_le16(0); header->vpi = cpu_to_le16(vcc->vpi); @@ -982,7 +982,7 @@ static void pclose(struct atm_vcc *vcc) dev_warn(&card->dev->dev, "Failed to allocate sk_buff in pclose()\n"); return; } - header = (void *)skb_put(skb, sizeof(*header)); + header = skb_put(skb, sizeof(*header)); header->size = cpu_to_le16(0); header->vpi = cpu_to_le16(vcc->vpi); @@ -1398,7 +1398,7 @@ static int atm_init(struct solos_card *card, struct device *parent) continue; } - header = (void *)skb_put(skb, sizeof(*header)); + header = skb_put(skb, sizeof(*header)); header->size = cpu_to_le16(0); header->vpi = cpu_to_le16(0); diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 1d30c116b2ee..39a05b0c8998 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -448,7 +448,7 @@ static void bluecard_receive(struct bluecard_info *info, } else { - *skb_put(info->rx_skb, 1) = buf[i]; + *(u8 *)skb_put(info->rx_skb, 1) = buf[i]; info->rx_count--; if (info->rx_count == 0) { diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 8165ef2fe877..be2d431aa366 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -282,7 +282,7 @@ static void bt3c_receive(struct bt3c_info *info) __u8 x = inb(iobase + DATA_L); - *skb_put(info->rx_skb, 1) = x; + *(u8 *)skb_put(info->rx_skb, 1) = x; inb(iobase + DATA_H); info->rx_count--; diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 24a188eab360..8d3d9175d891 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c @@ -189,7 +189,7 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, return -ENOMEM; } - hdr = (struct hci_command_hdr *)skb_put(skb, HCI_COMMAND_HDR_SIZE); + hdr = skb_put(skb, HCI_COMMAND_HDR_SIZE); hdr->opcode = cpu_to_le16(opcode); hdr->plen = len; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 9624b29f8349..80b64e9684a3 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -233,7 +233,7 @@ static void btuart_receive(struct btuart_info *info) } else { - *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); + *(u8 *)skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); info->rx_count--; if (info->rx_count == 0) { diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c7ea398e65c1..ba207c787605 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1836,15 +1836,15 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode) if (!skb) return -ENOMEM; - hdr = (struct hci_event_hdr *)skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); hdr->evt = HCI_EV_CMD_COMPLETE; hdr->plen = sizeof(*evt) + 1; - evt = (struct hci_ev_cmd_complete *)skb_put(skb, sizeof(*evt)); + evt = skb_put(skb, sizeof(*evt)); evt->ncmd = 0x01; evt->opcode = cpu_to_le16(opcode); - *skb_put(skb, 1) = 0x00; + *(u8 *)skb_put(skb, 1) = 0x00; hci_skb_pkt_type(skb) = HCI_EVENT_PKT; @@ -2767,8 +2767,8 @@ static struct urb *alloc_diag_urb(struct hci_dev *hdev, bool enable) return ERR_PTR(-ENOMEM); } - *skb_put(skb, 1) = 0xf0; - *skb_put(skb, 1) = enable; + *(u8 *)skb_put(skb, 1) = 0xf0; + *(u8 *)skb_put(skb, 1) = enable; pipe = usb_sndbulkpipe(data->udev, data->diag_tx_ep->bEndpointAddress); diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 6317c6f323bf..6c5a3aa566a4 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -226,7 +226,7 @@ static void dtl1_receive(struct dtl1_info *info) } } - *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); + *(u8 *)skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); nsh = (struct nsh *)info->rx_skb->data; info->rx_count--; @@ -414,7 +414,7 @@ static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) skb_reserve(s, NSHL); skb_copy_from_linear_data(skb, skb_put(s, skb->len), skb->len); if (skb->len & 0x0001) - *skb_put(s, 1) = 0; /* PAD */ + *(u8 *)skb_put(s, 1) = 0; /* PAD */ /* Prepend skb with Nokia frame header and queue */ memcpy(skb_push(s, NSHL), &nsh, NSHL); diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index e2096c7803b3..c1c4048ee37d 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -262,9 +262,9 @@ static int bcm_set_diag(struct hci_dev *hdev, bool enable) if (!skb) return -ENOMEM; - *skb_put(skb, 1) = BCM_LM_DIAG_PKT; - *skb_put(skb, 1) = 0xf0; - *skb_put(skb, 1) = enable; + *(u8 *)skb_put(skb, 1) = BCM_LM_DIAG_PKT; + *(u8 *)skb_put(skb, 1) = 0xf0; + *(u8 *)skb_put(skb, 1) = enable; skb_queue_tail(&bcm->txq, skb); hci_uart_tx_wakeup(hu); diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index 16e728577cd8..ee97c465e32e 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -462,15 +462,15 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode) if (!skb) return -ENOMEM; - hdr = (struct hci_event_hdr *)skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); hdr->evt = HCI_EV_CMD_COMPLETE; hdr->plen = sizeof(*evt) + 1; - evt = (struct hci_ev_cmd_complete *)skb_put(skb, sizeof(*evt)); + evt = skb_put(skb, sizeof(*evt)); evt->ncmd = 0x01; evt->opcode = cpu_to_le16(opcode); - *skb_put(skb, 1) = 0x00; + *(u8 *)skb_put(skb, 1) = 0x00; hci_skb_pkt_type(skb) = HCI_EVENT_PKT; diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index cc2fa78b434e..c982943f0747 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c @@ -120,7 +120,7 @@ static int send_hcill_cmd(u8 cmd, struct hci_uart *hu) } /* prepare packet */ - hcill_packet = (struct hcill_cmd *) skb_put(skb, 1); + hcill_packet = skb_put(skb, 1); hcill_packet->cmd = cmd; /* send packet */ diff --git a/drivers/bluetooth/hci_nokia.c b/drivers/bluetooth/hci_nokia.c index a7d687d8d456..c1b081725b2c 100644 --- a/drivers/bluetooth/hci_nokia.c +++ b/drivers/bluetooth/hci_nokia.c @@ -246,9 +246,9 @@ static int nokia_send_alive_packet(struct hci_uart *hu) hci_skb_pkt_type(skb) = HCI_NOKIA_ALIVE_PKT; memset(skb->data, 0x00, len); - hdr = (struct hci_nokia_alive_hdr *)skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); hdr->dlen = sizeof(*pkt); - pkt = (struct hci_nokia_alive_pkt *)skb_put(skb, sizeof(*pkt)); + pkt = skb_put(skb, sizeof(*pkt)); pkt->mid = NOKIA_ALIVE_REQ; nokia_enqueue(hu, skb); @@ -285,10 +285,10 @@ static int nokia_send_negotiation(struct hci_uart *hu) hci_skb_pkt_type(skb) = HCI_NOKIA_NEG_PKT; - neg_hdr = (struct hci_nokia_neg_hdr *)skb_put(skb, sizeof(*neg_hdr)); + neg_hdr = skb_put(skb, sizeof(*neg_hdr)); neg_hdr->dlen = sizeof(*neg_cmd); - neg_cmd = (struct hci_nokia_neg_cmd *)skb_put(skb, sizeof(*neg_cmd)); + neg_cmd = skb_put(skb, sizeof(*neg_cmd)); neg_cmd->ack = NOKIA_NEG_REQ; neg_cmd->baud = cpu_to_le16(baud); neg_cmd->unused1 = 0x0000; @@ -532,7 +532,7 @@ static int nokia_enqueue(struct hci_uart *hu, struct sk_buff *skb) err = skb_pad(skb, 1); if (err) return err; - *skb_put(skb, 1) = 0x00; + *(u8 *)skb_put(skb, 1) = 0x00; } skb_queue_tail(&btdev->txq, skb); diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index b55f01320631..e2c88515340a 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -215,7 +215,7 @@ static int send_hci_ibs_cmd(u8 cmd, struct hci_uart *hu) } /* Assign HCI_IBS type */ - *skb_put(skb, 1) = cmd; + *(u8 *)skb_put(skb, 1) = cmd; skb_queue_tail(&qca->txq, skb); diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 233e850fdac7..1ef9c427a2d8 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c @@ -146,8 +146,8 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode) hci_skb_pkt_type(skb) = HCI_VENDOR_PKT; - *skb_put(skb, 1) = 0xff; - *skb_put(skb, 1) = opcode; + *(u8 *)skb_put(skb, 1) = 0xff; + *(u8 *)skb_put(skb, 1) = opcode; put_unaligned_le16(hdev->id, skb_put(skb, 2)); skb_queue_tail(&data->readq, skb); diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index f00e0d8bd039..92185ab6797d 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c @@ -604,7 +604,7 @@ static struct sk_buff if (!skb) return ERR_PTR(-ENOMEM); skb_reserve(skb, sizeof(struct sge_opaque_hdr)); - chcr_req = (struct chcr_wr *)__skb_put(skb, transhdr_len); + chcr_req = __skb_put(skb, transhdr_len); memset(chcr_req, 0, transhdr_len); chcr_req->sec_cpl.op_ivinsrtofst = FILL_SEC_CPL_OP_IVINSR(ctx->dev->rx_channel_id, 2, 1); @@ -881,7 +881,7 @@ static struct sk_buff *create_hash_wr(struct ahash_request *req, return skb; skb_reserve(skb, sizeof(struct sge_opaque_hdr)); - chcr_req = (struct chcr_wr *)__skb_put(skb, transhdr_len); + chcr_req = __skb_put(skb, transhdr_len); memset(chcr_req, 0, transhdr_len); chcr_req->sec_cpl.op_ivinsrtofst = @@ -1447,7 +1447,7 @@ static struct sk_buff *create_authenc_wr(struct aead_request *req, skb_reserve(skb, sizeof(struct sge_opaque_hdr)); /* Write WR */ - chcr_req = (struct chcr_wr *) __skb_put(skb, transhdr_len); + chcr_req = __skb_put(skb, transhdr_len); memset(chcr_req, 0, transhdr_len); stop_offset = (op_type == CHCR_ENCRYPT_OP) ? 0 : authsize; @@ -1779,7 +1779,7 @@ static struct sk_buff *create_aead_ccm_wr(struct aead_request *req, skb_reserve(skb, sizeof(struct sge_opaque_hdr)); - chcr_req = (struct chcr_wr *) __skb_put(skb, transhdr_len); + chcr_req = __skb_put(skb, transhdr_len); memset(chcr_req, 0, transhdr_len); fill_sec_cpl_for_aead(&chcr_req->sec_cpl, dst_size, req, op_type, ctx); @@ -1892,7 +1892,7 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, /* NIC driver is going to write the sge hdr. */ skb_reserve(skb, sizeof(struct sge_opaque_hdr)); - chcr_req = (struct chcr_wr *)__skb_put(skb, transhdr_len); + chcr_req = __skb_put(skb, transhdr_len); memset(chcr_req, 0, transhdr_len); if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106) diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 02971e239a18..d2957b38575f 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -179,8 +179,7 @@ static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr, } /* Construct the family header first */ - header = (struct rdma_ls_ip_resolve_header *) - skb_put(skb, NLMSG_ALIGN(sizeof(*header))); + header = skb_put(skb, NLMSG_ALIGN(sizeof(*header))); header->ifindex = dev_addr->bound_dev_if; nla_put(skb, attrtype, size, daddr); diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index fb7aec4047c8..70fa4cabe48e 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -759,8 +759,7 @@ static void ib_nl_set_path_rec_attrs(struct sk_buff *skb, query->mad_buf->context[1] = NULL; /* Construct the family header first */ - header = (struct rdma_ls_resolve_header *) - skb_put(skb, NLMSG_ALIGN(sizeof(*header))); + header = skb_put(skb, NLMSG_ALIGN(sizeof(*header))); memcpy(header->device_name, query->port->agent->device->name, LS_DEVICE_NAME_MAX); header->port_num = query->port->port_num; diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index 97f7f9544e70..3eff6541bd6f 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c @@ -835,7 +835,7 @@ int cxio_rdma_init(struct cxio_rdev *rdev_p, struct t3_rdma_init_attr *attr) if (!skb) return -ENOMEM; pr_debug("%s rdev_p %p\n", __func__, rdev_p); - wqe = (struct t3_rdma_init_wr *) __skb_put(skb, sizeof(*wqe)); + wqe = __skb_put(skb, sizeof(*wqe)); wqe->wrh.op_seop_flags = cpu_to_be32(V_FW_RIWR_OP(T3_WR_INIT)); wqe->wrh.gen_tid_len = cpu_to_be32(V_FW_RIWR_TID(attr->tid) | V_FW_RIWR_LEN(sizeof(*wqe) >> 3)); diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index f4c23a74f18c..9ae518c01bc2 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c @@ -175,7 +175,7 @@ static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb) skb = get_skb(skb, sizeof *req, GFP_KERNEL); if (!skb) return; - req = (struct cpl_tid_release *) skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid)); skb->priority = CPL_PRIORITY_SETUP; @@ -190,7 +190,7 @@ int iwch_quiesce_tid(struct iwch_ep *ep) if (!skb) return -ENOMEM; - req = (struct cpl_set_tcb_field *) skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, ep->hwtid)); @@ -211,7 +211,7 @@ int iwch_resume_tid(struct iwch_ep *ep) if (!skb) return -ENOMEM; - req = (struct cpl_set_tcb_field *) skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, ep->hwtid)); @@ -398,7 +398,7 @@ static int send_halfclose(struct iwch_ep *ep, gfp_t gfp) } skb->priority = CPL_PRIORITY_DATA; set_arp_failure_handler(skb, arp_failure_discard); - req = (struct cpl_close_con_req *) skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_CLOSE_CON)); req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, ep->hwtid)); @@ -455,7 +455,7 @@ static int send_connect(struct iwch_ep *ep) skb->priority = CPL_PRIORITY_SETUP; set_arp_failure_handler(skb, act_open_req_arp_failure); - req = (struct cpl_act_open_req *) skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, ep->atid)); req->local_port = ep->com.local_addr.sin_port; @@ -546,7 +546,7 @@ static int send_mpa_reject(struct iwch_ep *ep, const void *pdata, u8 plen) return -ENOMEM; } skb_reserve(skb, sizeof(*req)); - mpa = (struct mpa_message *) skb_put(skb, mpalen); + mpa = skb_put(skb, mpalen); memset(mpa, 0, sizeof(*mpa)); memcpy(mpa->key, MPA_KEY_REP, sizeof(mpa->key)); mpa->flags = MPA_REJECT; @@ -596,7 +596,7 @@ static int send_mpa_reply(struct iwch_ep *ep, const void *pdata, u8 plen) } skb->priority = CPL_PRIORITY_DATA; skb_reserve(skb, sizeof(*req)); - mpa = (struct mpa_message *) skb_put(skb, mpalen); + mpa = skb_put(skb, mpalen); memset(mpa, 0, sizeof(*mpa)); memcpy(mpa->key, MPA_KEY_REP, sizeof(mpa->key)); mpa->flags = (ep->mpa_attr.crc_enabled ? MPA_CRC : 0) | @@ -800,7 +800,7 @@ static int update_rx_credits(struct iwch_ep *ep, u32 credits) return 0; } - req = (struct cpl_rx_data_ack *) skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, ep->hwtid)); req->credit_dack = htonl(V_RX_CREDITS(credits) | V_RX_FORCE_ACK(1)); @@ -1205,7 +1205,7 @@ static int listen_start(struct iwch_listen_ep *ep) return -ENOMEM; } - req = (struct cpl_pass_open_req *) skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, ep->stid)); req->local_port = ep->com.local_addr.sin_port; @@ -1246,7 +1246,7 @@ static int listen_stop(struct iwch_listen_ep *ep) pr_err("%s - failed to alloc skb\n", __func__); return -ENOMEM; } - req = (struct cpl_close_listserv_req *) skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); req->cpu_idx = 0; OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid)); @@ -1614,7 +1614,7 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) goto out; } rpl_skb->priority = CPL_PRIORITY_DATA; - rpl = (struct cpl_abort_rpl *) skb_put(rpl_skb, sizeof(*rpl)); + rpl = skb_put(rpl_skb, sizeof(*rpl)); rpl->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL)); rpl->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid)); diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 7c32a7c7977d..36ae3023e703 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -597,7 +597,7 @@ static int send_flowc(struct c4iw_ep *ep) else nparams = 9; - flowc = (struct fw_flowc_wr *)__skb_put(skb, FLOWC_LEN); + flowc = __skb_put(skb, FLOWC_LEN); flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) | FW_FLOWC_WR_NPARAMS_V(nparams)); @@ -787,18 +787,16 @@ static int send_connect(struct c4iw_ep *ep) if (ep->com.remote_addr.ss_family == AF_INET) { switch (CHELSIO_CHIP_VERSION(adapter_type)) { case CHELSIO_T4: - req = (struct cpl_act_open_req *)skb_put(skb, wrlen); + req = skb_put(skb, wrlen); INIT_TP_WR(req, 0); break; case CHELSIO_T5: - t5req = (struct cpl_t5_act_open_req *)skb_put(skb, - wrlen); + t5req = skb_put(skb, wrlen); INIT_TP_WR(t5req, 0); req = (struct cpl_act_open_req *)t5req; break; case CHELSIO_T6: - t6req = (struct cpl_t6_act_open_req *)skb_put(skb, - wrlen); + t6req = skb_put(skb, wrlen); INIT_TP_WR(t6req, 0); req = (struct cpl_act_open_req *)t6req; t5req = (struct cpl_t5_act_open_req *)t6req; @@ -839,18 +837,16 @@ static int send_connect(struct c4iw_ep *ep) } else { switch (CHELSIO_CHIP_VERSION(adapter_type)) { case CHELSIO_T4: - req6 = (struct cpl_act_open_req6 *)skb_put(skb, wrlen); + req6 = skb_put(skb, wrlen); INIT_TP_WR(req6, 0); break; case CHELSIO_T5: - t5req6 = (struct cpl_t5_act_open_req6 *)skb_put(skb, - wrlen); + t5req6 = skb_put(skb, wrlen); INIT_TP_WR(t5req6, 0); req6 = (struct cpl_act_open_req6 *)t5req6; break; case CHELSIO_T6: - t6req6 = (struct cpl_t6_act_open_req6 *)skb_put(skb, - wrlen); + t6req6 = skb_put(skb, wrlen); INIT_TP_WR(t6req6, 0); req6 = (struct cpl_act_open_req6 *)t6req6; t5req6 = (struct cpl_t5_act_open_req6 *)t6req6; @@ -1904,7 +1900,7 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) int win; skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); - req = (struct fw_ofld_connection_wr *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); memset(req, 0, sizeof(*req)); req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR)); req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); @@ -3807,7 +3803,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL); if (!req_skb) return; - req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req)); + req = __skb_put(req_skb, sizeof(*req)); memset(req, 0, sizeof(*req)); req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F); req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index 14de5bde1b63..394cfe2625fe 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c @@ -44,7 +44,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, wr_len = sizeof *res_wr + sizeof *res; set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - res_wr = (struct fw_ri_res_wr *)__skb_put(skb, wr_len); + res_wr = __skb_put(skb, wr_len); memset(res_wr, 0, wr_len); res_wr->op_nres = cpu_to_be32( FW_WR_OP_V(FW_RI_RES_WR) | @@ -114,7 +114,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, } set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - res_wr = (struct fw_ri_res_wr *)__skb_put(skb, wr_len); + res_wr = __skb_put(skb, wr_len); memset(res_wr, 0, wr_len); res_wr->op_nres = cpu_to_be32( FW_WR_OP_V(FW_RI_RES_WR) | diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index 3ee7f43e419a..ca992e4b66e4 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c @@ -81,7 +81,7 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr, } set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - req = (struct ulp_mem_io *)__skb_put(skb, wr_len); + req = __skb_put(skb, wr_len); memset(req, 0, wr_len); INIT_ULPTX_WR(req, wr_len, 0, 0); req->wr.wr_hi = cpu_to_be32(FW_WR_OP_V(FW_ULPTX_WR) | @@ -142,7 +142,7 @@ static int _c4iw_write_mem_inline(struct c4iw_rdev *rdev, u32 addr, u32 len, } set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - req = (struct ulp_mem_io *)__skb_put(skb, wr_len); + req = __skb_put(skb, wr_len); memset(req, 0, wr_len); INIT_ULPTX_WR(req, wr_len, 0, 0); diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 8e4154b4253e..b23a0b057347 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c @@ -293,7 +293,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, } set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - res_wr = (struct fw_ri_res_wr *)__skb_put(skb, wr_len); + res_wr = __skb_put(skb, wr_len); memset(res_wr, 0, wr_len); res_wr->op_nres = cpu_to_be32( FW_WR_OP_V(FW_RI_RES_WR) | @@ -1228,7 +1228,7 @@ static void post_terminate(struct c4iw_qp *qhp, struct t4_cqe *err_cqe, set_wr_txq(skb, CPL_PRIORITY_DATA, qhp->ep->txq_idx); - wqe = (struct fw_ri_wr *)__skb_put(skb, sizeof(*wqe)); + wqe = __skb_put(skb, sizeof(*wqe)); memset(wqe, 0, sizeof *wqe); wqe->op_compl = cpu_to_be32(FW_WR_OP_V(FW_RI_INIT_WR)); wqe->flowid_len16 = cpu_to_be32( @@ -1350,7 +1350,7 @@ static int rdma_fini(struct c4iw_dev *rhp, struct c4iw_qp *qhp, set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); - wqe = (struct fw_ri_wr *)__skb_put(skb, sizeof(*wqe)); + wqe = __skb_put(skb, sizeof(*wqe)); memset(wqe, 0, sizeof *wqe); wqe->op_compl = cpu_to_be32( FW_WR_OP_V(FW_RI_INIT_WR) | @@ -1419,7 +1419,7 @@ static int rdma_init(struct c4iw_dev *rhp, struct c4iw_qp *qhp) } set_wr_txq(skb, CPL_PRIORITY_DATA, qhp->ep->txq_idx); - wqe = (struct fw_ri_wr *)__skb_put(skb, sizeof(*wqe)); + wqe = __skb_put(skb, sizeof(*wqe)); memset(wqe, 0, sizeof *wqe); wqe->op_compl = cpu_to_be32( FW_WR_OP_V(FW_RI_INIT_WR) | diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 77be17590866..96f586d34d2d 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1082,7 +1082,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) skb = mp->outskb; if (skb) { if (skb_tailroom(skb) > 0) { - *(skb_put(skb, 1)) = ch; + *(u8 *)skb_put(skb, 1) = ch; goto unlock_out; } mp->outskb = NULL; @@ -1094,7 +1094,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) skb = alloc_skb(CAPI_DATA_B3_REQ_LEN + CAPI_MAX_BLKSIZE, GFP_ATOMIC); if (skb) { skb_reserve(skb, CAPI_DATA_B3_REQ_LEN); - *(skb_put(skb, 1)) = ch; + *(u8 *)skb_put(skb, 1) = ch; mp->outskb = skb; } else { printk(KERN_ERR "capinc_put_char: char %u lost\n", ch); diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c index c90dca5abeac..03ac9fbfe318 100644 --- a/drivers/isdn/gigaset/asyncdata.c +++ b/drivers/isdn/gigaset/asyncdata.c @@ -264,7 +264,7 @@ byte_stuff: /* skip remainder of packet */ bcs->rx_skb = skb = NULL; } else { - *__skb_put(skb, 1) = c; + *(u8 *)__skb_put(skb, 1) = c; fcs = crc_ccitt_byte(fcs, c); } } @@ -315,7 +315,7 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) /* regular data byte: append to current skb */ inputstate |= INS_have_data; - *__skb_put(skb, 1) = bitrev8(c); + *(u8 *)__skb_put(skb, 1) = bitrev8(c); } /* pass data up */ @@ -492,33 +492,33 @@ static struct sk_buff *HDLC_Encode(struct sk_buff *skb) hdlc_skb->mac_len = skb->mac_len; /* Add flag sequence in front of everything.. */ - *(skb_put(hdlc_skb, 1)) = PPP_FLAG; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_FLAG; /* Perform byte stuffing while copying data. */ while (skb->len--) { if (muststuff(*skb->data)) { - *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE; - *(skb_put(hdlc_skb, 1)) = (*skb->data++) ^ PPP_TRANS; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_ESCAPE; + *(u8 *)skb_put(hdlc_skb, 1) = (*skb->data++) ^ PPP_TRANS; } else - *(skb_put(hdlc_skb, 1)) = *skb->data++; + *(u8 *)skb_put(hdlc_skb, 1) = *skb->data++; } /* Finally add FCS (byte stuffed) and flag sequence */ c = (fcs & 0x00ff); /* least significant byte first */ if (muststuff(c)) { - *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_ESCAPE; c ^= PPP_TRANS; } - *(skb_put(hdlc_skb, 1)) = c; + *(u8 *)skb_put(hdlc_skb, 1) = c; c = ((fcs >> 8) & 0x00ff); if (muststuff(c)) { - *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_ESCAPE; c ^= PPP_TRANS; } - *(skb_put(hdlc_skb, 1)) = c; + *(u8 *)skb_put(hdlc_skb, 1) = c; - *(skb_put(hdlc_skb, 1)) = PPP_FLAG; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_FLAG; dev_kfree_skb_any(skb); return hdlc_skb; @@ -561,8 +561,8 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb) while (len--) { c = bitrev8(*cp++); if (c == DLE_FLAG) - *(skb_put(iraw_skb, 1)) = c; - *(skb_put(iraw_skb, 1)) = c; + *(u8 *)skb_put(iraw_skb, 1) = c; + *(u8 *)skb_put(iraw_skb, 1) = c; } dev_kfree_skb_any(skb); return iraw_skb; diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index bc29f1d52a2f..74e250664ce9 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c @@ -511,7 +511,7 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) bcs->rx_skb = NULL; return; } - *__skb_put(bcs->rx_skb, 1) = c; + *(u8 *)__skb_put(bcs->rx_skb, 1) = c; } /* hdlc_flush diff --git a/drivers/isdn/i4l/isdn_audio.c b/drivers/isdn/i4l/isdn_audio.c index 78ce42214713..b6bcd1eca128 100644 --- a/drivers/isdn/i4l/isdn_audio.c +++ b/drivers/isdn/i4l/isdn_audio.c @@ -462,7 +462,7 @@ isdn_audio_goertzel(int *sample, modem_info *info) info->line); return; } - result = (int *) skb_put(skb, sizeof(int) * NCOEFF); + result = skb_put(skb, sizeof(int) * NCOEFF); for (k = 0; k < NCOEFF; k++) { sk = sk1 = sk2 = 0; for (n = 0; n < DTMF_NPOINTS; n++) { @@ -672,7 +672,7 @@ isdn_audio_put_dle_code(modem_info *info, u_char code) info->line); return; } - p = (char *) skb_put(skb, 2); + p = skb_put(skb, 2); p[0] = 0x10; p[1] = code; ISDN_AUDIO_SKB_DLECOUNT(skb) = 0; diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c index 8837ac5a492d..6ade0916da4e 100644 --- a/drivers/isdn/i4l/isdn_bsdcomp.c +++ b/drivers/isdn/i4l/isdn_bsdcomp.c @@ -472,7 +472,7 @@ static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb accm |= ((ent) << bitno); \ do { \ if (skb_out && skb_tailroom(skb_out) > 0) \ - *(skb_put(skb_out, 1)) = (unsigned char)(accm >> 24); \ + *(u8 *)skb_put(skb_out, 1) = (u8)(accm >> 24); \ accm <<= 8; \ bitno += 8; \ } while (bitno <= 24); \ @@ -602,7 +602,7 @@ static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb * Do not emit a completely useless byte of ones. */ if (bitno < 32 && skb_out && skb_tailroom(skb_out) > 0) - *(skb_put(skb_out, 1)) = (unsigned char)((accm | (0xff << (bitno - 8))) >> 24); + *(u8 *)skb_put(skb_out, 1) = (unsigned char)((accm | (0xff << (bitno - 8))) >> 24); /* * Increase code size if we would have without the packet @@ -698,7 +698,7 @@ static int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *s db->bytes_out += ilen; if (skb_tailroom(skb_out) > 0) - *(skb_put(skb_out, 1)) = 0; + *(u8 *)skb_put(skb_out, 1) = 0; else return DECOMP_ERR_NOMEM; @@ -816,7 +816,7 @@ static int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *s #endif if (extra) /* the KwKwK case again */ - *(skb_put(skb_out, 1)) = finchar; + *(u8 *)skb_put(skb_out, 1) = finchar; /* * If not first code in a packet, and diff --git a/drivers/isdn/i4l/isdn_x25iface.c b/drivers/isdn/i4l/isdn_x25iface.c index ba60076e0b95..e33fa3073f74 100644 --- a/drivers/isdn/i4l/isdn_x25iface.c +++ b/drivers/isdn/i4l/isdn_x25iface.c @@ -224,7 +224,7 @@ static int isdn_x25iface_connect_ind(struct concap_proto *cprot) skb = dev_alloc_skb(1); if (skb) { - *(skb_put(skb, 1)) = X25_IFACE_CONNECT; + *(u8 *)skb_put(skb, 1) = X25_IFACE_CONNECT; skb->protocol = x25_type_trans(skb, cprot->net_dev); netif_rx(skb); return 0; @@ -253,7 +253,7 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *cprot) *state_p = WAN_DISCONNECTED; skb = dev_alloc_skb(1); if (skb) { - *(skb_put(skb, 1)) = X25_IFACE_DISCONNECT; + *(u8 *)skb_put(skb, 1) = X25_IFACE_DISCONNECT; skb->protocol = x25_type_trans(skb, cprot->net_dev); netif_rx(skb); return 0; diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index bbaf0a8cae8b..06b0dcc13695 100644 --- a/drivers/media/dvb-core/dvb_net.c +++ b/drivers/media/dvb-core/dvb_net.c @@ -963,7 +963,7 @@ static void dvb_net_sec(struct net_device *dev, skb->dev = dev; /* copy L3 payload */ - eth = (u8 *) skb_put(skb, pkt_len - 12 - 4 + 14 - snap); + eth = skb_put(skb, pkt_len - 12 - 4 + 14 - snap); memcpy(eth + 14, pkt + 12 + snap, pkt_len - 12 - 4 - snap); /* create ethernet header: */ diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index c67e055a12c9..ab3428bf63fe 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c @@ -416,7 +416,7 @@ static int fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, if (!test_bit(FM_FW_DW_INPROGRESS, &fmdev->flag) || test_bit(FM_INTTASK_RUNNING, &fmdev->flag)) { /* Fill command header info */ - hdr = (struct fm_cmd_msg_hdr *)skb_put(skb, FM_CMD_MSG_HDR_SIZE); + hdr = skb_put(skb, FM_CMD_MSG_HDR_SIZE); hdr->hdr = FM_PKT_LOGICAL_CHAN_NUMBER; /* 0x08 */ /* 3 (fm_opcode,rd_wr,dlen) + payload len) */ diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 5427032aa05e..f43fb2f958a5 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -857,7 +857,7 @@ static int ad_lacpdu_send(struct port *port) skb->protocol = PKT_TYPE_LACPDU; skb->priority = TC_PRIO_CONTROL; - lacpdu_header = (struct lacpdu_header *)skb_put(skb, length); + lacpdu_header = skb_put(skb, length); ether_addr_copy(lacpdu_header->hdr.h_dest, lacpdu_mcast_addr); /* Note: source address is set to be the member's PERMANENT address, @@ -899,7 +899,7 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker) skb->network_header = skb->mac_header + ETH_HLEN; skb->protocol = PKT_TYPE_LACPDU; - marker_header = (struct bond_marker_header *)skb_put(skb, length); + marker_header = skb_put(skb, length); ether_addr_copy(marker_header->hdr.h_dest, lacpdu_mcast_addr); /* Note: source address is set to be the member's PERMANENT address, diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index ae4ed03dc642..a3011c001080 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -648,7 +648,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) can_skb_prv(skb)->ifindex = dev->ifindex; can_skb_prv(skb)->skbcnt = 0; - *cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); + *cf = skb_put(skb, sizeof(struct can_frame)); memset(*cf, 0, sizeof(struct can_frame)); return skb; @@ -677,7 +677,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev, can_skb_prv(skb)->ifindex = dev->ifindex; can_skb_prv(skb)->skbcnt = 0; - *cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame)); + *cfd = skb_put(skb, sizeof(struct canfd_frame)); memset(*cfd, 0, sizeof(struct canfd_frame)); return skb; diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index c8f4d26fc9d4..3143de45baaa 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -633,7 +633,7 @@ static void emac_rx(struct net_device *dev) if (!skb) continue; skb_reserve(skb, 2); - rdptr = (u8 *) skb_put(skb, rxlen - 4); + rdptr = skb_put(skb, rxlen - 4); /* Read received packet from RX SRAM */ if (netif_msg_rx_status(db)) diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 2ff6bd139c96..e1a50c87c9a9 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -471,7 +471,7 @@ static int init_tp_parity(struct adapter *adap) if (!skb) goto alloc_skb_fail; - req = (struct cpl_smt_write_req *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); memset(req, 0, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i)); @@ -495,7 +495,7 @@ static int init_tp_parity(struct adapter *adap) if (!skb) goto alloc_skb_fail; - req = (struct cpl_l2t_write_req *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); memset(req, 0, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, i)); @@ -518,7 +518,7 @@ static int init_tp_parity(struct adapter *adap) if (!skb) goto alloc_skb_fail; - req = (struct cpl_rte_write_req *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); memset(req, 0, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RTE_WRITE_REQ, i)); @@ -538,7 +538,7 @@ static int init_tp_parity(struct adapter *adap) if (!skb) goto alloc_skb_fail; - greq = (struct cpl_set_tcb_field *)__skb_put(skb, sizeof(*greq)); + greq = __skb_put(skb, sizeof(*greq)); memset(greq, 0, sizeof(*greq)); greq->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(greq) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, 0)); @@ -909,7 +909,7 @@ static int write_smt_entry(struct adapter *adapter, int idx) if (!skb) return -ENOMEM; - req = (struct cpl_smt_write_req *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, idx)); req->mtu_idx = NMTUS - 1; /* should be 0 but there's a T3 bug */ @@ -952,7 +952,7 @@ static int send_pktsched_cmd(struct adapter *adap, int sched, int qidx, int lo, if (!skb) return -ENOMEM; - req = (struct mngt_pktsched_wr *)skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_MNGT)); req->mngt_opcode = FW_MNGTOPCODE_PKTSCHED_SET; req->sched = sched; diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c index fa81445e334c..50cd660732c5 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c @@ -552,7 +552,7 @@ static inline void mk_tid_release(struct sk_buff *skb, unsigned int tid) struct cpl_tid_release *req; skb->priority = CPL_PRIORITY_SETUP; - req = (struct cpl_tid_release *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, tid)); } @@ -1096,7 +1096,7 @@ static void set_l2t_ix(struct t3cdev *tdev, u32 tid, struct l2t_entry *e) return; } skb->priority = CPL_PRIORITY_CONTROL; - req = (struct cpl_set_tcb_field *)skb_put(skb, sizeof(*req)); + req = skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); req->reply = 0; diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.c b/drivers/net/ethernet/chelsio/cxgb3/l2t.c index 26264125865f..248e40c6966c 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/l2t.c +++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.c @@ -96,7 +96,7 @@ static int setup_l2e_send_pending(struct t3cdev *dev, struct sk_buff *skb, return -ENOMEM; } - req = (struct cpl_l2t_write_req *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, e->idx)); req->params = htonl(V_L2T_W_IDX(e->idx) | V_L2T_W_IFF(e->smt_idx) | diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c index 10736738ff30..a0fab65e80e8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c @@ -190,7 +190,7 @@ static int del_filter_wr(struct adapter *adapter, int fidx) if (!skb) return -ENOMEM; - fwr = (struct fw_filter_wr *)__skb_put(skb, len); + fwr = __skb_put(skb, len); t4_mk_filtdelwr(f->tid, fwr, adapter->sge.fw_evtq.abs_id); /* Mark the filter as "pending" and ship off the Filter Work Request. @@ -231,7 +231,7 @@ int set_filter_wr(struct adapter *adapter, int fidx) } } - fwr = (struct fw_filter_wr *)__skb_put(skb, sizeof(*fwr)); + fwr = __skb_put(skb, sizeof(*fwr)); memset(fwr, 0, sizeof(*fwr)); /* It would be nice to put most of the following in t4_hw.c but most diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 2c6de769f4e6..15fb284eafc0 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -1175,7 +1175,7 @@ static void mk_tid_release(struct sk_buff *skb, unsigned int chan, struct cpl_tid_release *req; set_wr_txq(skb, CPL_PRIORITY_SETUP, chan); - req = (struct cpl_tid_release *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); INIT_TP_WR(req, tid); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, tid)); } @@ -1359,7 +1359,7 @@ int cxgb4_create_server(const struct net_device *dev, unsigned int stid, return -ENOMEM; adap = netdev2adap(dev); - req = (struct cpl_pass_open_req *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); INIT_TP_WR(req, 0); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, stid)); req->local_port = sport; @@ -1400,7 +1400,7 @@ int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, return -ENOMEM; adap = netdev2adap(dev); - req = (struct cpl_pass_open_req6 *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); INIT_TP_WR(req, 0); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ6, stid)); req->local_port = sport; @@ -1432,7 +1432,7 @@ int cxgb4_remove_server(const struct net_device *dev, unsigned int stid, if (!skb) return -ENOMEM; - req = (struct cpl_close_listsvr_req *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); INIT_TP_WR(req, 0); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, stid)); req->reply_ctrl = htons(NO_REPLY_V(0) | (ipv6 ? LISTSVR_IPV6_V(1) : diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c index 6f3692db29af..f7ef8871dd0b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c +++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c @@ -146,7 +146,7 @@ static int write_l2e(struct adapter *adap, struct l2t_entry *e, int sync) if (!skb) return -ENOMEM; - req = (struct cpl_l2t_write_req *)__skb_put(skb, sizeof(*req)); + req = __skb_put(skb, sizeof(*req)); INIT_TP_WR(req, 0); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h index 515b94ff9080..4b5aacc09cab 100644 --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h @@ -90,7 +90,7 @@ cxgb_mk_tid_release(struct sk_buff *skb, u32 len, u32 tid, u16 chan) { struct cpl_tid_release *req; - req = (struct cpl_tid_release *)__skb_put(skb, len); + req = __skb_put(skb, len); memset(req, 0, len); INIT_TP_WR(req, tid); @@ -104,7 +104,7 @@ cxgb_mk_close_con_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan, { struct cpl_close_con_req *req; - req = (struct cpl_close_con_req *)__skb_put(skb, len); + req = __skb_put(skb, len); memset(req, 0, len); INIT_TP_WR(req, tid); @@ -119,7 +119,7 @@ cxgb_mk_abort_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan, { struct cpl_abort_req *req; - req = (struct cpl_abort_req *)__skb_put(skb, len); + req = __skb_put(skb, len); memset(req, 0, len); INIT_TP_WR(req, tid); @@ -134,7 +134,7 @@ cxgb_mk_abort_rpl(struct sk_buff *skb, u32 len, u32 tid, u16 chan) { struct cpl_abort_rpl *rpl; - rpl = (struct cpl_abort_rpl *)__skb_put(skb, len); + rpl = __skb_put(skb, len); memset(rpl, 0, len); INIT_TP_WR(rpl, tid); @@ -149,7 +149,7 @@ cxgb_mk_rx_data_ack(struct sk_buff *skb, u32 len, u32 tid, u16 chan, { struct cpl_rx_data_ack *req; - req = (struct cpl_rx_data_ack *)__skb_put(skb, len); + req = __skb_put(skb, len); memset(req, 0, len); INIT_TP_WR(req, tid); diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 008dc8161775..16fe776ddbe5 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c @@ -1171,7 +1171,7 @@ dm9000_rx(struct net_device *dev) if (GoodPacket && ((skb = netdev_alloc_skb(dev, RxLen + 4)) != NULL)) { skb_reserve(skb, 2); - rdptr = (u8 *) skb_put(skb, RxLen - 4); + rdptr = skb_put(skb, RxLen - 4); /* Read received packet from RX SRAM */ diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c index 3e77dd863175..5a847941c46b 100644 --- a/drivers/net/ethernet/dnet.c +++ b/drivers/net/ethernet/dnet.c @@ -399,7 +399,7 @@ static int dnet_poll(struct napi_struct *napi, int budget) * 'skb_put()' points to the start of sk_buff * data area. */ - data_ptr = (unsigned int *)skb_put(skb, pkt_len); + data_ptr = skb_put(skb, pkt_len); for (i = 0; i < (pkt_len + 3) >> 2; i++) *data_ptr++ = dnet_readl(bp, RX_DATA_FIFO); skb->protocol = eth_type_trans(skb, dev); diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c index 5673b071e39d..c6164a98f257 100644 --- a/drivers/net/ethernet/hp/hp100.c +++ b/drivers/net/ethernet/hp/hp100.c @@ -1281,7 +1281,7 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, */ skb_reserve(ringptr->skb, 2); - ringptr->skb->data = (u_char *) skb_put(ringptr->skb, MAX_ETHER_SIZE); + ringptr->skb->data = skb_put(ringptr->skb, MAX_ETHER_SIZE); /* ringptr->pdl points to the beginning of the PDL, i.e. the PDH */ /* Note: 1st Fragment is used for the 4 byte packet status diff --git a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c index b077ef8b00fa..2d1253c5b7a1 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c +++ b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c @@ -762,7 +762,7 @@ int i40e_fcoe_handle_offload(struct i40e_ring *rx_ring, (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA)) { struct fcoe_crc_eof *crc = NULL; - crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); + crc = skb_put(skb, sizeof(*crc)); crc->fcoe_eof = FC_EOF_T; } else { /* otherwise, drop the header only frame */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 2a653ec954f5..a23c2b5411a0 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c @@ -491,7 +491,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && (fctl & FC_FC_END_SEQ)) { skb_linearize(skb); - crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); + crc = skb_put(skb, sizeof(*crc)); crc->fcoe_eof = FC_EOF_T; } diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c index 17112faafbcc..88699b181946 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c @@ -63,8 +63,8 @@ static int mlx4_en_test_loopback_xmit(struct mlx4_en_priv *priv) skb_reserve(skb, NET_IP_ALIGN); - ethh = (struct ethhdr *)skb_put(skb, sizeof(struct ethhdr)); - packet = (unsigned char *)skb_put(skb, packet_size); + ethh = skb_put(skb, sizeof(struct ethhdr)); + packet = skb_put(skb, packet_size); memcpy(ethh->h_dest, priv->dev->dev_addr, ETH_ALEN); eth_zero_addr(ethh->h_source); ethh->h_proto = htons(ETH_P_ARP); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c index 601abf240d63..c456ca07b562 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c @@ -136,10 +136,10 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) skb_reset_mac_header(skb); skb_set_network_header(skb, skb->len); - iph = (struct iphdr *)skb_put(skb, sizeof(struct iphdr)); + iph = skb_put(skb, sizeof(struct iphdr)); skb_set_transport_header(skb, skb->len); - udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); + udph = skb_put(skb, sizeof(struct udphdr)); /* Fill ETH header */ ether_addr_copy(ethh->h_dest, priv->netdev->dev_addr); @@ -167,7 +167,7 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) ip_send_check(iph); /* Fill test header and data */ - mlxh = (struct mlx5ehdr *)skb_put(skb, sizeof(*mlxh)); + mlxh = skb_put(skb, sizeof(*mlxh)); mlxh->version = 0; mlxh->magic = cpu_to_be64(MLX5E_TEST_MAGIC); strlcpy(mlxh->text, mlx5e_test_text, sizeof(mlxh->text)); diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c index cb0102dd7f70..e3d7c74d47bb 100644 --- a/drivers/net/ethernet/micrel/ks8842.c +++ b/drivers/net/ethernet/micrel/ks8842.c @@ -669,7 +669,7 @@ static void ks8842_rx_frame(struct net_device *netdev, ks8842_update_rx_counters(netdev, status, len); if (adapter->conf_flags & KS884X_16BIT) { - u16 *data16 = (u16 *)skb_put(skb, len); + u16 *data16 = skb_put(skb, len); ks8842_select_bank(adapter, 17); while (len > 0) { *data16++ = ioread16(adapter->hw_addr + @@ -679,7 +679,7 @@ static void ks8842_rx_frame(struct net_device *netdev, len -= sizeof(u32); } } else { - u32 *data = (u32 *)skb_put(skb, len); + u32 *data = skb_put(skb, len); ks8842_select_bank(adapter, 17); while (len > 0) { diff --git a/drivers/net/ethernet/sfc/falcon/selftest.c b/drivers/net/ethernet/sfc/falcon/selftest.c index 92bc34c91547..55c0fbbc4fb8 100644 --- a/drivers/net/ethernet/sfc/falcon/selftest.c +++ b/drivers/net/ethernet/sfc/falcon/selftest.c @@ -431,8 +431,7 @@ static int ef4_begin_loopback(struct ef4_tx_queue *tx_queue) /* Copy the payload in, incrementing the source address to * exercise the rss vectors */ - payload = ((struct ef4_loopback_payload *) - skb_put(skb, sizeof(state->payload))); + payload = skb_put(skb, sizeof(state->payload)); memcpy(payload, &state->payload, sizeof(state->payload)); payload->ip.saddr = htonl(INADDR_LOOPBACK | (i << 2)); diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/selftest.c index dab286a337a6..f6936949fc85 100644 --- a/drivers/net/ethernet/sfc/selftest.c +++ b/drivers/net/ethernet/sfc/selftest.c @@ -431,8 +431,7 @@ static int efx_begin_loopback(struct efx_tx_queue *tx_queue) /* Copy the payload in, incrementing the source address to * exercise the rss vectors */ - payload = ((struct efx_loopback_payload *) - skb_put(skb, sizeof(state->payload))); + payload = skb_put(skb, sizeof(state->payload)); memcpy(payload, &state->payload, sizeof(state->payload)); payload->ip.saddr = htonl(INADDR_LOOPBACK | (i << 2)); diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index 6754cd01c605..140a209f22ab 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c @@ -540,7 +540,7 @@ static inline void scc_rxint(struct scc_channel *scc) } scc->rx_buff = skb; - *(skb_put(skb, 1)) = 0; /* KISS data */ + *(u8 *)skb_put(skb, 1) = 0; /* KISS data */ } if (skb->len >= scc->stat.bufsize) @@ -555,7 +555,7 @@ static inline void scc_rxint(struct scc_channel *scc) return; } - *(skb_put(skb, 1)) = Inb(scc->data); + *(u8 *)skb_put(skb, 1) = Inb(scc->data); } diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index d7e405268983..4e1da1645b15 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -877,7 +877,7 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m, skb->priority = sk->sk_priority; skb->protocol = cpu_to_be16(ETH_P_PPP_SES); - ph = (struct pppoe_hdr *)skb_put(skb, total_len + sizeof(struct pppoe_hdr)); + ph = skb_put(skb, total_len + sizeof(struct pppoe_hdr)); start = (char *)&ph->tag[0]; error = memcpy_from_msg(start, m, total_len); diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 8a4c8a1b9dd3..4d4837a0645b 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1250,7 +1250,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) skb_put_zero(skb_out, padding_count); } else if (skb_out->len < ctx->tx_max && (skb_out->len % dev->maxpacket) == 0) { - *skb_put(skb_out, 1) = 0; /* force short packet */ + *(u8 *)skb_put(skb_out, 1) = 0; /* force short packet */ } /* set final frame length */ diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index 3202c19df83d..861ff45f0b09 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c @@ -473,8 +473,8 @@ encapsulate: /* maybe pad; then trailer */ if (!((skb->len + sizeof *trailer) & 0x01)) - *skb_put(skb, 1) = PAD_BYTE; - trailer = (struct nc_trailer *) skb_put(skb, sizeof *trailer); + *(u8 *)skb_put(skb, 1) = PAD_BYTE; + trailer = skb_put(skb, sizeof *trailer); put_unaligned(header->packet_id, &trailer->packet_id); #if 0 netdev_dbg(dev->net, "frame >tx h %d p %d id %d\n", diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c index 6aaa6eb9df72..dc3cd03763af 100644 --- a/drivers/net/usb/zaurus.c +++ b/drivers/net/usb/zaurus.c @@ -74,10 +74,10 @@ done: fcs = crc32_le(~0, skb->data, skb->len); fcs = ~fcs; - *skb_put (skb, 1) = fcs & 0xff; - *skb_put (skb, 1) = (fcs>> 8) & 0xff; - *skb_put (skb, 1) = (fcs>>16) & 0xff; - *skb_put (skb, 1) = (fcs>>24) & 0xff; + *(u8 *)skb_put(skb, 1) = fcs & 0xff; + *(u8 *)skb_put(skb, 1) = (fcs>> 8) & 0xff; + *(u8 *)skb_put(skb, 1) = (fcs>>16) & 0xff; + *(u8 *)skb_put(skb, 1) = (fcs>>24) & 0xff; } return skb; } diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c index f5b4ad45831a..fa3460a0dbbe 100644 --- a/drivers/net/wan/hdlc_ppp.c +++ b/drivers/net/wan/hdlc_ppp.c @@ -228,7 +228,7 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code, } skb_reserve(skb, sizeof(struct hdlc_header)); - cp = (struct cp_header *)skb_put(skb, sizeof(struct cp_header)); + cp = skb_put(skb, sizeof(struct cp_header)); cp->code = code; cp->id = id; cp->len = htons(sizeof(struct cp_header) + magic_len + len); diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index e2b7809d7886..1eea6c23976f 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c @@ -348,7 +348,7 @@ void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len) if (!skb) return; - slot = (struct ath6kl_fwlog_slot *) skb_put(skb, slot_len); + slot = skb_put(skb, slot_len); slot->timestamp = cpu_to_le32(jiffies); slot->length = cpu_to_le32(len); memcpy(slot->payload, buf, len); diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c index d127a08d60df..b13d61111072 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c +++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c @@ -1274,8 +1274,7 @@ static int ath6kl_htc_pipe_conn_service(struct htc_target *target, length = sizeof(struct htc_conn_service_msg); /* assemble connect service message */ - conn_msg = (struct htc_conn_service_msg *) skb_put(skb, - length); + conn_msg = skb_put(skb, length); if (conn_msg == NULL) { WARN_ON_ONCE(1); status = -EINVAL; @@ -1504,8 +1503,7 @@ static int ath6kl_htc_pipe_start(struct htc_target *target) skb = packet->skb; /* assemble setup complete message */ - setup = (struct htc_setup_comp_ext_msg *) skb_put(skb, - sizeof(*setup)); + setup = skb_put(skb, sizeof(*setup)); memset(setup, 0, sizeof(struct htc_setup_comp_ext_msg)); setup->msg_id = cpu_to_le16(HTC_MSG_SETUP_COMPLETE_EX_ID); diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index 8e6dae23669b..9fa8970a1f7d 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -156,8 +156,7 @@ static int htc_config_pipe_credits(struct htc_target *target) } skb_reserve(skb, sizeof(struct htc_frame_hdr)); - cp_msg = (struct htc_config_pipe_msg *) - skb_put(skb, sizeof(struct htc_config_pipe_msg)); + cp_msg = skb_put(skb, sizeof(struct htc_config_pipe_msg)); cp_msg->message_id = cpu_to_be16(HTC_MSG_CONFIG_PIPE_ID); cp_msg->pipe_id = USB_WLAN_TX_PIPE; @@ -195,8 +194,7 @@ static int htc_setup_complete(struct htc_target *target) } skb_reserve(skb, sizeof(struct htc_frame_hdr)); - comp_msg = (struct htc_comp_msg *) - skb_put(skb, sizeof(struct htc_comp_msg)); + comp_msg = skb_put(skb, sizeof(struct htc_comp_msg)); comp_msg->msg_id = cpu_to_be16(HTC_MSG_SETUP_COMPLETE_ID); target->htc_flags |= HTC_OP_START_WAIT; @@ -265,8 +263,7 @@ int htc_connect_service(struct htc_target *target, skb_reserve(skb, sizeof(struct htc_frame_hdr)); - conn_msg = (struct htc_conn_svc_msg *) - skb_put(skb, sizeof(struct htc_conn_svc_msg)); + conn_msg = skb_put(skb, sizeof(struct htc_conn_svc_msg)); conn_msg->service_id = cpu_to_be16(service_connreq->service_id); conn_msg->msg_id = cpu_to_be16(HTC_MSG_CONNECT_SERVICE_ID); conn_msg->con_flags = cpu_to_be16(service_connreq->con_flags); diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index cff9c585972f..0a5020f31de1 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -677,7 +677,7 @@ static void wmi_evt_eapol_rx(struct wil6210_priv *wil, int id, return; } - eth = (struct ethhdr *)skb_put(skb, ETH_HLEN); + eth = skb_put(skb, ETH_HLEN); ether_addr_copy(eth->h_dest, ndev->dev_addr); ether_addr_copy(eth->h_source, evt->src_mac); eth->h_proto = cpu_to_be16(ETH_P_PAE); diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 1b7e125a28e2..4623155ec36e 100644 --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -3330,7 +3330,7 @@ static void airo_handle_rx(struct airo_info *ai) } skb_reserve(skb, 2); /* This way the IP header is aligned */ - buffer = (__le16 *) skb_put(skb, len + hdrlen); + buffer = skb_put(skb, len + hdrlen); if (test_bit(FLAG_802_11, &ai->flags)) { buffer[0] = fc; bap_read(ai, buffer + 1, hdrlen - 2, BAP0); @@ -3734,7 +3734,7 @@ static void mpi_receive_802_11(struct airo_info *ai) ai->dev->stats.rx_dropped++; goto badrx; } - buffer = (u16*)skb_put (skb, len + hdrlen); + buffer = skb_put(skb, len + hdrlen); memcpy ((char *)buffer, ptr, hdrlen); ptr += hdrlen; if (hdrlen == 24) diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c index e0c690b48d4e..5e4ce4abd62e 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c @@ -10371,7 +10371,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv, if (!dst) continue; - rt_hdr = (void *)skb_put(dst, sizeof(*rt_hdr)); + rt_hdr = skb_put(dst, sizeof(*rt_hdr)); rt_hdr->it_version = PKTHDR_RADIOTAP_VERSION; rt_hdr->it_pad = 0; diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c index 5339d1eeb2f7..84205aa508df 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c @@ -439,8 +439,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) if (rts_required) { skb_frag = txb->fragments[0]; - frag_hdr = - (struct libipw_hdr_3addrqos *)skb_put(skb_frag, hdr_len); + frag_hdr = skb_put(skb_frag, hdr_len); /* * Set header frame_ctl to the RTS. diff --git a/drivers/net/wireless/intersil/hostap/hostap_ap.c b/drivers/net/wireless/intersil/hostap/hostap_ap.c index 91757defb9be..eb9cd6fa9c4d 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_ap.c +++ b/drivers/net/wireless/intersil/hostap/hostap_ap.c @@ -2361,7 +2361,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta) return; } - hdr = (struct ieee80211_hdr *) skb_put(skb, 16); + hdr = skb_put(skb, 16); /* Generate a fake pspoll frame to start packet delivery */ hdr->frame_control = cpu_to_le16( diff --git a/drivers/net/wireless/intersil/p54/fwio.c b/drivers/net/wireless/intersil/p54/fwio.c index 3076f646c829..52c095c7765f 100644 --- a/drivers/net/wireless/intersil/p54/fwio.c +++ b/drivers/net/wireless/intersil/p54/fwio.c @@ -206,7 +206,7 @@ static struct sk_buff *p54_alloc_skb(struct p54_common *priv, u16 hdr_flags, return NULL; skb_reserve(skb, priv->tx_hdr_len); - hdr = (struct p54_hdr *) skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); hdr->flags = cpu_to_le16(hdr_flags); hdr->len = cpu_to_le16(payload_len); hdr->type = cpu_to_le16(type); @@ -236,8 +236,7 @@ int p54_download_eeprom(struct p54_common *priv, void *buf, mutex_lock(&priv->eeprom_mutex); priv->eeprom = buf; - eeprom_hdr = (struct p54_eeprom_lm86 *) skb_put(skb, - eeprom_hdr_size + len); + eeprom_hdr = skb_put(skb, eeprom_hdr_size + len); if (priv->fw_var < 0x509) { eeprom_hdr->v1.offset = cpu_to_le16(offset); @@ -273,7 +272,7 @@ int p54_update_beacon_tim(struct p54_common *priv, u16 aid, bool set) if (unlikely(!skb)) return -ENOMEM; - tim = (struct p54_tim *) skb_put(skb, sizeof(*tim)); + tim = skb_put(skb, sizeof(*tim)); tim->count = 1; tim->entry[0] = cpu_to_le16(set ? (aid | 0x8000) : aid); p54_tx(priv, skb); @@ -290,7 +289,7 @@ int p54_sta_unlock(struct p54_common *priv, u8 *addr) if (unlikely(!skb)) return -ENOMEM; - sta = (struct p54_sta_unlock *)skb_put(skb, sizeof(*sta)); + sta = skb_put(skb, sizeof(*sta)); memcpy(sta->addr, addr, ETH_ALEN); p54_tx(priv, skb); return 0; @@ -310,7 +309,7 @@ int p54_tx_cancel(struct p54_common *priv, __le32 req_id) if (unlikely(!skb)) return -ENOMEM; - cancel = (struct p54_txcancel *)skb_put(skb, sizeof(*cancel)); + cancel = skb_put(skb, sizeof(*cancel)); cancel->req_id = req_id; p54_tx(priv, skb); return 0; @@ -327,7 +326,7 @@ int p54_setup_mac(struct p54_common *priv) if (!skb) return -ENOMEM; - setup = (struct p54_setup_mac *) skb_put(skb, sizeof(*setup)); + setup = skb_put(skb, sizeof(*setup)); if (!(priv->hw->conf.flags & IEEE80211_CONF_IDLE)) { switch (priv->mode) { case NL80211_IFTYPE_STATION: @@ -413,18 +412,18 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell) if (!skb) return -ENOMEM; - head = (struct p54_scan_head *) skb_put(skb, sizeof(*head)); + head = skb_put(skb, sizeof(*head)); memset(head->scan_params, 0, sizeof(head->scan_params)); head->mode = cpu_to_le16(mode); head->dwell = cpu_to_le16(dwell); head->freq = freq; if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) { - __le16 *pa_power_points = (__le16 *) skb_put(skb, 2); + __le16 *pa_power_points = skb_put(skb, 2); *pa_power_points = cpu_to_le16(0x0c); } - iq_autocal = (void *) skb_put(skb, sizeof(*iq_autocal)); + iq_autocal = skb_put(skb, sizeof(*iq_autocal)); for (i = 0; i < priv->iq_autocal_len; i++) { if (priv->iq_autocal[i].freq != freq) continue; @@ -437,9 +436,9 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell) goto err; if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) - body = (void *) skb_put(skb, sizeof(body->longbow)); + body = skb_put(skb, sizeof(body->longbow)); else - body = (void *) skb_put(skb, sizeof(body->normal)); + body = skb_put(skb, sizeof(body->normal)); for (i = 0; i < priv->output_limit->entries; i++) { __le16 *entry_freq = (void *) (priv->output_limit->data + @@ -500,25 +499,25 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell) goto err; if ((priv->fw_var >= 0x500) && (priv->fw_var < 0x509)) { - rate = (void *) skb_put(skb, sizeof(*rate)); + rate = skb_put(skb, sizeof(*rate)); rate->basic_rate_mask = cpu_to_le32(priv->basic_rate_mask); for (i = 0; i < sizeof(rate->rts_rates); i++) rate->rts_rates[i] = i; } - rssi = (struct pda_rssi_cal_entry *) skb_put(skb, sizeof(*rssi)); + rssi = skb_put(skb, sizeof(*rssi)); rssi_data = p54_rssi_find(priv, le16_to_cpu(freq)); rssi->mul = cpu_to_le16(rssi_data->mul); rssi->add = cpu_to_le16(rssi_data->add); if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) { /* Longbow frontend needs ever more */ - rssi = (void *) skb_put(skb, sizeof(*rssi)); + rssi = skb_put(skb, sizeof(*rssi)); rssi->mul = cpu_to_le16(rssi_data->longbow_unkn); rssi->add = cpu_to_le16(rssi_data->longbow_unk2); } if (priv->fw_var >= 0x509) { - rate = (void *) skb_put(skb, sizeof(*rate)); + rate = skb_put(skb, sizeof(*rate)); rate->basic_rate_mask = cpu_to_le32(priv->basic_rate_mask); for (i = 0; i < sizeof(rate->rts_rates); i++) rate->rts_rates[i] = i; @@ -550,7 +549,7 @@ int p54_set_leds(struct p54_common *priv) if (unlikely(!skb)) return -ENOMEM; - led = (struct p54_led *) skb_put(skb, sizeof(*led)); + led = skb_put(skb, sizeof(*led)); led->flags = cpu_to_le16(0x0003); led->mask[0] = led->mask[1] = cpu_to_le16(priv->softled_state); led->delay[0] = cpu_to_le16(1); @@ -570,7 +569,7 @@ int p54_set_edcf(struct p54_common *priv) if (unlikely(!skb)) return -ENOMEM; - edcf = (struct p54_edcf *)skb_put(skb, sizeof(*edcf)); + edcf = skb_put(skb, sizeof(*edcf)); if (priv->use_short_slot) { edcf->slottime = 9; edcf->sifs = 0x10; @@ -615,7 +614,7 @@ int p54_set_ps(struct p54_common *priv) if (!skb) return -ENOMEM; - psm = (struct p54_psm *)skb_put(skb, sizeof(*psm)); + psm = skb_put(skb, sizeof(*psm)); psm->mode = cpu_to_le16(mode); psm->aid = cpu_to_le16(priv->aid); for (i = 0; i < ARRAY_SIZE(psm->intervals); i++) { @@ -644,7 +643,7 @@ int p54_init_xbow_synth(struct p54_common *priv) if (unlikely(!skb)) return -ENOMEM; - xbow = (struct p54_xbow_synth *)skb_put(skb, sizeof(*xbow)); + xbow = skb_put(skb, sizeof(*xbow)); xbow->magic1 = cpu_to_le16(0x1); xbow->magic2 = cpu_to_le16(0x2); xbow->freq = cpu_to_le16(5390); @@ -664,7 +663,7 @@ int p54_upload_key(struct p54_common *priv, u8 algo, int slot, u8 idx, u8 len, if (unlikely(!skb)) return -ENOMEM; - rxkey = (struct p54_keycache *)skb_put(skb, sizeof(*rxkey)); + rxkey = skb_put(skb, sizeof(*rxkey)); rxkey->entry = slot; rxkey->key_id = idx; rxkey->key_type = algo; @@ -744,7 +743,7 @@ int p54_set_groupfilter(struct p54_common *priv) if (!skb) return -ENOMEM; - grp = (struct p54_group_address_table *)skb_put(skb, sizeof(*grp)); + grp = skb_put(skb, sizeof(*grp)); on = !(priv->filter_flags & FIF_ALLMULTI) && (priv->mc_maclist_num > 0 && diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 1d6e180052b8..7418088e296f 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -650,7 +650,7 @@ static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif) skb = dev_alloc_skb(sizeof(*pspoll)); if (!skb) return; - pspoll = (void *) skb_put(skb, sizeof(*pspoll)); + pspoll = skb_put(skb, sizeof(*pspoll)); pspoll->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL | IEEE80211_FCTL_PM); @@ -681,7 +681,7 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac, skb = dev_alloc_skb(sizeof(*hdr)); if (!skb) return; - hdr = (void *) skb_put(skb, sizeof(*hdr) - ETH_ALEN); + hdr = skb_put(skb, sizeof(*hdr) - ETH_ALEN); hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC | (ps ? IEEE80211_FCTL_PM : 0)); @@ -892,7 +892,7 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, if (skb == NULL) return; - hdr = (struct hwsim_radiotap_ack_hdr *) skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION; hdr->hdr.it_pad = 0; hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); @@ -904,7 +904,7 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, flags = IEEE80211_CHAN_2GHZ; hdr->rt_chbitmask = cpu_to_le16(flags); - hdr11 = (struct ieee80211_hdr *) skb_put(skb, 10); + hdr11 = skb_put(skb, 10); hdr11->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK); hdr11->duration_id = cpu_to_le16(0); diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c index bc12c37e7501..042a1d07f686 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c @@ -62,7 +62,7 @@ mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr, }; struct tx_packet_hdr *tx_header; - tx_header = (void *)skb_put(skb_aggr, sizeof(*tx_header)); + tx_header = skb_put(skb_aggr, sizeof(*tx_header)); /* Copy DA and SA */ dt_offset = 2 * ETH_ALEN; diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c index d38555fe4284..39cd677d4159 100644 --- a/drivers/net/wireless/marvell/mwifiex/tdls.c +++ b/drivers/net/wireless/marvell/mwifiex/tdls.c @@ -158,7 +158,7 @@ static void mwifiex_tdls_add_aid(struct mwifiex_private *priv, u8 *pos; assoc_rsp = (struct ieee_types_assoc_rsp *)&priv->assoc_rsp_buf; - pos = (void *)skb_put(skb, 4); + pos = skb_put(skb, 4); *pos++ = WLAN_EID_AID; *pos++ = 2; memcpy(pos, &assoc_rsp->a_id, sizeof(assoc_rsp->a_id)); @@ -172,7 +172,7 @@ static int mwifiex_tdls_add_vht_capab(struct mwifiex_private *priv, struct ieee80211_vht_cap vht_cap; u8 *pos; - pos = (void *)skb_put(skb, sizeof(struct ieee80211_vht_cap) + 2); + pos = skb_put(skb, sizeof(struct ieee80211_vht_cap) + 2); *pos++ = WLAN_EID_VHT_CAPABILITY; *pos++ = sizeof(struct ieee80211_vht_cap); @@ -207,7 +207,7 @@ mwifiex_tdls_add_ht_oper(struct mwifiex_private *priv, const u8 *mac, return 0; } - pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_operation) + 2); + pos = skb_put(skb, sizeof(struct ieee80211_ht_operation) + 2); *pos++ = WLAN_EID_HT_OPERATION; *pos++ = sizeof(struct ieee80211_ht_operation); ht_oper = (void *)pos; @@ -272,7 +272,7 @@ static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv, ap_vht_cap = bss_desc->bcn_vht_cap; } - pos = (void *)skb_put(skb, sizeof(struct ieee80211_vht_operation) + 2); + pos = skb_put(skb, sizeof(struct ieee80211_vht_operation) + 2); *pos++ = WLAN_EID_VHT_OPERATION; *pos++ = sizeof(struct ieee80211_vht_operation); vht_oper = (struct ieee80211_vht_operation *)pos; @@ -359,7 +359,7 @@ static void mwifiex_tdls_add_ext_capab(struct mwifiex_private *priv, { struct ieee_types_extcap *extcap; - extcap = (void *)skb_put(skb, sizeof(struct ieee_types_extcap)); + extcap = skb_put(skb, sizeof(struct ieee_types_extcap)); extcap->ieee_hdr.element_id = WLAN_EID_EXT_CAPABILITY; extcap->ieee_hdr.len = 8; memset(extcap->ext_capab, 0, 8); @@ -372,7 +372,7 @@ static void mwifiex_tdls_add_ext_capab(struct mwifiex_private *priv, static void mwifiex_tdls_add_qos_capab(struct sk_buff *skb) { - u8 *pos = (void *)skb_put(skb, 3); + u8 *pos = skb_put(skb, 3); *pos++ = WLAN_EID_QOS_CAPA; *pos++ = 1; @@ -413,8 +413,8 @@ mwifiex_add_wmm_info_ie(struct mwifiex_private *priv, struct sk_buff *skb, { u8 *buf; - buf = (void *)skb_put(skb, MWIFIEX_TDLS_WMM_INFO_SIZE + - sizeof(struct ieee_types_header)); + buf = skb_put(skb, + MWIFIEX_TDLS_WMM_INFO_SIZE + sizeof(struct ieee_types_header)); *buf++ = WLAN_EID_VENDOR_SPECIFIC; *buf++ = 7; /* len */ @@ -431,7 +431,7 @@ static void mwifiex_tdls_add_bss_co_2040(struct sk_buff *skb) { struct ieee_types_bss_co_2040 *bssco; - bssco = (void *)skb_put(skb, sizeof(struct ieee_types_bss_co_2040)); + bssco = skb_put(skb, sizeof(struct ieee_types_bss_co_2040)); bssco->ieee_hdr.element_id = WLAN_EID_BSS_COEX_2040; bssco->ieee_hdr.len = sizeof(struct ieee_types_bss_co_2040) - sizeof(struct ieee_types_header); @@ -443,8 +443,8 @@ static void mwifiex_tdls_add_supported_chan(struct sk_buff *skb) struct ieee_types_generic *supp_chan; u8 chan_supp[] = {1, 11}; - supp_chan = (void *)skb_put(skb, (sizeof(struct ieee_types_header) + - sizeof(chan_supp))); + supp_chan = skb_put(skb, + (sizeof(struct ieee_types_header) + sizeof(chan_supp))); supp_chan->ieee_hdr.element_id = WLAN_EID_SUPPORTED_CHANNELS; supp_chan->ieee_hdr.len = sizeof(chan_supp); memcpy(supp_chan->data, chan_supp, sizeof(chan_supp)); @@ -455,8 +455,8 @@ static void mwifiex_tdls_add_oper_class(struct sk_buff *skb) struct ieee_types_generic *reg_class; u8 rc_list[] = {1, 1, 2, 3, 4, 12, 22, 23, 24, 25, 27, 28, 29, 30, 32, 33}; - reg_class = (void *)skb_put(skb, (sizeof(struct ieee_types_header) + - sizeof(rc_list))); + reg_class = skb_put(skb, + (sizeof(struct ieee_types_header) + sizeof(rc_list))); reg_class->ieee_hdr.element_id = WLAN_EID_SUPPORTED_REGULATORY_CLASSES; reg_class->ieee_hdr.len = sizeof(rc_list); memcpy(reg_class->data, rc_list, sizeof(rc_list)); @@ -475,7 +475,7 @@ static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, capab = priv->curr_bss_params.bss_descriptor.cap_info_bitmap; - tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); + tf = skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); memcpy(tf->da, peer, ETH_ALEN); memcpy(tf->sa, priv->curr_addr, ETH_ALEN); tf->ether_type = cpu_to_be16(ETH_P_TDLS); @@ -494,7 +494,7 @@ static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, return ret; } - pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); + pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); *pos++ = WLAN_EID_HT_CAPABILITY; *pos++ = sizeof(struct ieee80211_ht_cap); ht_cap = (void *)pos; @@ -534,7 +534,7 @@ static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, return ret; } - pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); + pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); *pos++ = WLAN_EID_HT_CAPABILITY; *pos++ = sizeof(struct ieee80211_ht_cap); ht_cap = (void *)pos; @@ -616,7 +616,7 @@ mwifiex_tdls_add_link_ie(struct sk_buff *skb, const u8 *src_addr, { struct ieee80211_tdls_lnkie *lnkid; - lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); + lnkid = skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); lnkid->ie_type = WLAN_EID_LINK_ID; lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - sizeof(struct ieee_types_header); @@ -741,7 +741,7 @@ mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, capab = priv->curr_bss_params.bss_descriptor.cap_info_bitmap; - mgmt = (void *)skb_put(skb, offsetof(struct ieee80211_mgmt, u)); + mgmt = skb_put(skb, offsetof(struct ieee80211_mgmt, u)); memset(mgmt, 0, 24); memcpy(mgmt->da, peer, ETH_ALEN); @@ -775,7 +775,7 @@ mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, return ret; } - pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); + pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); *pos++ = WLAN_EID_HT_CAPABILITY; *pos++ = sizeof(struct ieee80211_ht_cap); ht_cap = (void *)pos; diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h index 9844ff0add2b..f6ac39973b5d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h @@ -26,7 +26,7 @@ static inline void qtnf_cmd_skb_put_action(struct sk_buff *skb, u16 action) { __le16 *buf_ptr; - buf_ptr = (__le16 *)skb_put(skb, sizeof(action)); + buf_ptr = skb_put(skb, sizeof(action)); *buf_ptr = cpu_to_le16(action); } @@ -42,8 +42,7 @@ static inline void qtnf_cmd_skb_put_tlv_arr(struct sk_buff *skb, u16 tlv_id, const u8 arr[], size_t arr_len) { - struct qlink_tlv_hdr *hdr = - (void *)skb_put(skb, sizeof(*hdr) + arr_len); + struct qlink_tlv_hdr *hdr = skb_put(skb, sizeof(*hdr) + arr_len); hdr->type = cpu_to_le16(tlv_id); hdr->len = cpu_to_le16(arr_len); @@ -53,8 +52,7 @@ static inline void qtnf_cmd_skb_put_tlv_arr(struct sk_buff *skb, static inline void qtnf_cmd_skb_put_tlv_u8(struct sk_buff *skb, u16 tlv_id, u8 value) { - struct qlink_tlv_hdr *hdr = - (void *)skb_put(skb, sizeof(*hdr) + sizeof(value)); + struct qlink_tlv_hdr *hdr = skb_put(skb, sizeof(*hdr) + sizeof(value)); hdr->type = cpu_to_le16(tlv_id); hdr->len = cpu_to_le16(sizeof(value)); @@ -64,8 +62,7 @@ static inline void qtnf_cmd_skb_put_tlv_u8(struct sk_buff *skb, u16 tlv_id, static inline void qtnf_cmd_skb_put_tlv_u16(struct sk_buff *skb, u16 tlv_id, u16 value) { - struct qlink_tlv_hdr *hdr = - (void *)skb_put(skb, sizeof(*hdr) + sizeof(value)); + struct qlink_tlv_hdr *hdr = skb_put(skb, sizeof(*hdr) + sizeof(value)); __le16 tmp = cpu_to_le16(value); hdr->type = cpu_to_le16(tlv_id); diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c index b70985e126bf..51520a0e2138 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c @@ -188,7 +188,7 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, return; } - dump_hdr = (struct rt2x00dump_hdr *)skb_put(skbcopy, sizeof(*dump_hdr)); + dump_hdr = skb_put(skbcopy, sizeof(*dump_hdr)); dump_hdr->version = cpu_to_le32(DUMP_HEADER_VERSION); dump_hdr->header_length = cpu_to_le32(sizeof(*dump_hdr)); dump_hdr->desc_length = cpu_to_le32(skbdesc->desc_len); diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c index dd3ba4810e7d..e7b1d7c0f542 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c @@ -462,7 +462,7 @@ static u32 _rtl92s_fill_h2c_cmd(struct sk_buff *skb, u32 h2cbufferlen, break; /* Clear content */ - ph2c_buffer = (u8 *)skb_put(skb, (u32)len); + ph2c_buffer = skb_put(skb, (u32)len); memset((ph2c_buffer + totallen + tx_desclen), 0, len); /* CMD len */ diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c index 0877e2283f35..97f003e84381 100644 --- a/drivers/nfc/fdp/i2c.c +++ b/drivers/nfc/fdp/i2c.c @@ -86,7 +86,7 @@ static void fdp_nci_i2c_add_len_lrc(struct sk_buff *skb) for (i = 0; i < len + 2; i++) lrc ^= skb->data[i]; - *skb_put(skb, 1) = lrc; + *(u8 *)skb_put(skb, 1) = lrc; } static void fdp_nci_i2c_remove_len_lrc(struct sk_buff *skb) diff --git a/drivers/nfc/microread/i2c.c b/drivers/nfc/microread/i2c.c index e0e8afd27849..8e328c36a816 100644 --- a/drivers/nfc/microread/i2c.c +++ b/drivers/nfc/microread/i2c.c @@ -75,7 +75,7 @@ static void microread_i2c_add_len_crc(struct sk_buff *skb) for (i = 0; i < skb->len; i++) crc = crc ^ skb->data[i]; - *skb_put(skb, 1) = crc; + *(u8 *)skb_put(skb, 1) = crc; } static void microread_i2c_remove_len_crc(struct sk_buff *skb) @@ -173,7 +173,7 @@ static int microread_i2c_read(struct microread_i2c_phy *phy, goto flush; } - *skb_put(*skb, 1) = len; + *(u8 *)skb_put(*skb, 1) = len; r = i2c_master_recv(client, skb_put(*skb, len), len); if (r != len) { diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c index f454dc68cc03..9d0dd1be0923 100644 --- a/drivers/nfc/microread/microread.c +++ b/drivers/nfc/microread/microread.c @@ -441,8 +441,8 @@ static int microread_im_transceive(struct nfc_hci_dev *hdev, crc = crc_ccitt(0xffff, skb->data, skb->len); crc = ~crc; - *skb_put(skb, 1) = crc & 0xff; - *skb_put(skb, 1) = crc >> 8; + *(u8 *)skb_put(skb, 1) = crc & 0xff; + *(u8 *)skb_put(skb, 1) = crc >> 8; break; case MICROREAD_GATE_ID_MREAD_NFC_T3: control_bits = 0xDB; diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c index 7c710458568e..788599de9d8a 100644 --- a/drivers/nfc/nfcmrvl/fw_dnld.c +++ b/drivers/nfc/nfcmrvl/fw_dnld.c @@ -92,7 +92,7 @@ static struct sk_buff *alloc_lc_skb(struct nfcmrvl_private *priv, uint8_t plen) return NULL; } - hdr = (struct nci_data_hdr *) skb_put(skb, NCI_DATA_HDR_SIZE); + hdr = skb_put(skb, NCI_DATA_HDR_SIZE); hdr->conn_id = NCI_CORE_LC_CONNID_PROP_FW_DL; hdr->rfu = 0; hdr->plen = plen; @@ -292,7 +292,7 @@ static int process_state_fw_dnld(struct nfcmrvl_private *priv, out_skb = alloc_lc_skb(priv, 1); if (!out_skb) return -ENOMEM; - *skb_put(out_skb, 1) = 0xBF; + *(u8 *)skb_put(out_skb, 1) = 0xBF; nci_send_frame(priv->ndev, out_skb); priv->fw_dnld.substate = SUBSTATE_WAIT_NACK_CREDIT; return 0; @@ -301,7 +301,7 @@ static int process_state_fw_dnld(struct nfcmrvl_private *priv, out_skb = alloc_lc_skb(priv, 1); if (!out_skb) return -ENOMEM; - *skb_put(out_skb, 1) = HELPER_ACK_PACKET_FORMAT; + *(u8 *)skb_put(out_skb, 1) = HELPER_ACK_PACKET_FORMAT; nci_send_frame(priv->ndev, out_skb); priv->fw_dnld.substate = SUBSTATE_WAIT_ACK_CREDIT; break; diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index 9200bb308e42..68a3cd0287f6 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c @@ -1032,7 +1032,7 @@ static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev) return NULL; /* DEP support only */ - *skb_put(skb, 1) = PN533_INIT_TARGET_DEP; + *(u8 *)skb_put(skb, 1) = PN533_INIT_TARGET_DEP; /* MIFARE params */ skb_put_data(skb, mifare_params, 6); @@ -1046,12 +1046,12 @@ static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev) memcpy(nfcid3, felica, 8); /* General bytes */ - *skb_put(skb, 1) = gbytes_len; + *(u8 *)skb_put(skb, 1) = gbytes_len; gb = skb_put_data(skb, gbytes, gbytes_len); /* Len Tk */ - *skb_put(skb, 1) = 0; + *(u8 *)skb_put(skb, 1) = 0; return skb; } @@ -1280,8 +1280,8 @@ static void pn533_wq_rf(struct work_struct *work) if (!skb) return; - *skb_put(skb, 1) = PN533_CFGITEM_RF_FIELD; - *skb_put(skb, 1) = PN533_CFGITEM_RF_FIELD_AUTO_RFCA; + *(u8 *)skb_put(skb, 1) = PN533_CFGITEM_RF_FIELD; + *(u8 *)skb_put(skb, 1) = PN533_CFGITEM_RF_FIELD_AUTO_RFCA; rc = pn533_send_cmd_async(dev, PN533_CMD_RF_CONFIGURATION, skb, pn533_rf_complete, NULL); @@ -1375,8 +1375,8 @@ static int pn533_poll_dep(struct nfc_dev *nfc_dev) if (!skb) return -ENOMEM; - *skb_put(skb, 1) = 0x01; /* Active */ - *skb_put(skb, 1) = 0x02; /* 424 kbps */ + *(u8 *)skb_put(skb, 1) = 0x01; /* Active */ + *(u8 *)skb_put(skb, 1) = 0x02; /* 424 kbps */ next = skb_put(skb, 1); /* Next */ *next = 0; @@ -1620,8 +1620,8 @@ static int pn533_activate_target_nfcdep(struct pn533 *dev) if (!skb) return -ENOMEM; - *skb_put(skb, sizeof(u8)) = 1; /* TG */ - *skb_put(skb, sizeof(u8)) = 0; /* Next */ + *(u8 *)skb_put(skb, sizeof(u8)) = 1; /* TG */ + *(u8 *)skb_put(skb, sizeof(u8)) = 0; /* Next */ resp = pn533_send_cmd_sync(dev, PN533_CMD_IN_ATR, skb); if (IS_ERR(resp)) @@ -1737,7 +1737,7 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev, if (!skb) return; - *skb_put(skb, 1) = 1; /* TG*/ + *(u8 *)skb_put(skb, 1) = 1; /* TG*/ rc = pn533_send_cmd_async(dev, PN533_CMD_IN_RELEASE, skb, pn533_deactivate_target_complete, NULL); @@ -1848,8 +1848,8 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, if (!skb) return -ENOMEM; - *skb_put(skb, 1) = !comm_mode; /* ActPass */ - *skb_put(skb, 1) = 0x02; /* 424 kbps */ + *(u8 *)skb_put(skb, 1) = !comm_mode; /* ActPass */ + *(u8 *)skb_put(skb, 1) = 0x02; /* 424 kbps */ next = skb_put(skb, 1); /* Next */ *next = 0; @@ -2274,7 +2274,7 @@ static void pn533_wq_mi_recv(struct work_struct *work) break; } default: - *skb_put(skb, sizeof(u8)) = 1; /*TG*/ + *(u8 *)skb_put(skb, sizeof(u8)) = 1; /*TG*/ rc = pn533_send_cmd_direct_async(dev, PN533_CMD_IN_DATA_EXCHANGE, @@ -2370,7 +2370,7 @@ static int pn533_set_configuration(struct pn533 *dev, u8 cfgitem, u8 *cfgdata, if (!skb) return -ENOMEM; - *skb_put(skb, sizeof(cfgitem)) = cfgitem; + *(u8 *)skb_put(skb, sizeof(cfgitem)) = cfgitem; skb_put_data(skb, cfgdata, cfgdata_len); resp = pn533_send_cmd_sync(dev, PN533_CMD_RF_CONFIGURATION, skb); @@ -2415,7 +2415,7 @@ static int pn533_pasori_fw_reset(struct pn533 *dev) if (!skb) return -ENOMEM; - *skb_put(skb, sizeof(u8)) = 0x1; + *(u8 *)skb_put(skb, sizeof(u8)) = 0x1; resp = pn533_send_cmd_sync(dev, 0x18, skb); if (IS_ERR(resp)) @@ -2454,7 +2454,7 @@ static int pn532_sam_configuration(struct nfc_dev *nfc_dev) if (!skb) return -ENOMEM; - *skb_put(skb, 1) = 0x01; + *(u8 *)skb_put(skb, 1) = 0x01; resp = pn533_send_cmd_sync(dev, PN533_CMD_SAM_CONFIGURATION, skb); if (IS_ERR(resp)) diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index 71ac0836c9f4..dc1e3768cee6 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -287,8 +287,8 @@ static void pn544_hci_i2c_add_len_crc(struct sk_buff *skb) crc = crc_ccitt(0xffff, skb->data, skb->len); crc = ~crc; - *skb_put(skb, 1) = crc & 0xff; - *skb_put(skb, 1) = crc >> 8; + *(u8 *)skb_put(skb, 1) = crc & 0xff; + *(u8 *)skb_put(skb, 1) = crc >> 8; } static void pn544_hci_i2c_remove_len_crc(struct sk_buff *skb) @@ -391,7 +391,7 @@ static int pn544_hci_i2c_read(struct pn544_i2c_phy *phy, struct sk_buff **skb) goto flush; } - *skb_put(*skb, 1) = len; + *(u8 *)skb_put(*skb, 1) = len; r = i2c_master_recv(client, skb_put(*skb, len), len); if (r != len) { diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index e1260da73d45..5fa3cf0fabd6 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -991,7 +991,7 @@ static int port100_set_command_type(struct port100 *dev, u8 command_type) if (!skb) return -ENOMEM; - *skb_put(skb, sizeof(u8)) = command_type; + *(u8 *)skb_put(skb, sizeof(u8)) = command_type; resp = port100_send_cmd_sync(dev, PORT100_CMD_SET_COMMAND_TYPE, skb); if (IS_ERR(resp)) @@ -1059,7 +1059,7 @@ static int port100_switch_rf(struct nfc_digital_dev *ddev, bool on) if (!skb) return -ENOMEM; - *skb_put(skb, 1) = on ? 1 : 0; + *(u8 *)skb_put(skb, 1) = on ? 1 : 0; /* Cancel the last command if the device is being switched off */ if (!on) diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c index 94d0b913b627..c36f0e0afdfd 100644 --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c @@ -177,10 +177,10 @@ static void st21nfca_hci_add_len_crc(struct sk_buff *skb) crc = ~crc; tmp = crc & 0x00ff; - *skb_put(skb, 1) = tmp; + *(u8 *)skb_put(skb, 1) = tmp; tmp = (crc >> 8) & 0x00ff; - *skb_put(skb, 1) = tmp; + *(u8 *)skb_put(skb, 1) = tmp; } static void st21nfca_hci_remove_len_crc(struct sk_buff *skb) @@ -214,7 +214,7 @@ static int st21nfca_hci_i2c_write(void *phy_id, struct sk_buff *skb) st21nfca_hci_add_len_crc(skb); /* add ST21NFCA_SOF_EOF on tail */ - *skb_put(skb, 1) = ST21NFCA_SOF_EOF; + *(u8 *)skb_put(skb, 1) = ST21NFCA_SOF_EOF; /* add ST21NFCA_SOF_EOF on head */ *skb_push(skb, 1) = ST21NFCA_SOF_EOF; diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c index c2840e412962..168adcc46cb8 100644 --- a/drivers/nfc/st95hf/core.c +++ b/drivers/nfc/st95hf/core.c @@ -949,7 +949,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev, switch (stcontext->current_rf_tech) { case NFC_DIGITAL_RF_TECH_106A: len_data_to_tag = skb->len + 1; - *skb_put(skb, 1) = stcontext->sendrcv_trflag; + *(u8 *)skb_put(skb, 1) = stcontext->sendrcv_trflag; break; case NFC_DIGITAL_RF_TECH_106B: case NFC_DIGITAL_RF_TECH_ISO15693: diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 902722dc4ce3..b025ee5da1ba 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c @@ -351,7 +351,7 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp) frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1]; cp = kmap_atomic(skb_frag_page(frag)) + frag->page_offset; } else { - cp = (struct fcoe_crc_eof *)skb_put(skb, tlen); + cp = skb_put(skb, tlen); } memset(cp, 0, sizeof(*cp)); diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 90939f66bc0d..539e23ec0e59 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c @@ -1543,7 +1543,7 @@ static int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp) cp = kmap_atomic(skb_frag_page(frag)) + frag->page_offset; } else { - cp = (struct fcoe_crc_eof *)skb_put(skb, tlen); + cp = skb_put(skb, tlen); } memset(cp, 0, sizeof(*cp)); diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index b97405ed6cae..da0fcce6f842 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -874,7 +874,7 @@ static int qedf_xmit(struct fc_lport *lport, struct fc_frame *fp) frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1]; cp = kmap_atomic(skb_frag_page(frag)) + frag->page_offset; } else { - cp = (struct fcoe_crc_eof *)skb_put(skb, tlen); + cp = skb_put(skb, tlen); } memset(cp, 0, sizeof(*cp)); diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 1d3963136295..1720e1b6ae04 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -95,8 +95,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, skb_reserve(skb, ieee->tx_headroom); - BAReq = (struct rtllib_hdr_3addr *)skb_put(skb, - sizeof(struct rtllib_hdr_3addr)); + BAReq = skb_put(skb, sizeof(struct rtllib_hdr_3addr)); ether_addr_copy(BAReq->addr1, Dst); ether_addr_copy(BAReq->addr2, ieee->dev->dev_addr); @@ -104,7 +103,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, ether_addr_copy(BAReq->addr3, ieee->current_network.bssid); BAReq->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT); - tag = (u8 *)skb_put(skb, 9); + tag = skb_put(skb, 9); *tag++ = ACT_CAT_BA; *tag++ = type; *tag++ = pBA->DialogToken; @@ -159,15 +158,14 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, skb_reserve(skb, ieee->tx_headroom); - Delba = (struct rtllib_hdr_3addr *) skb_put(skb, - sizeof(struct rtllib_hdr_3addr)); + Delba = skb_put(skb, sizeof(struct rtllib_hdr_3addr)); ether_addr_copy(Delba->addr1, dst); ether_addr_copy(Delba->addr2, ieee->dev->dev_addr); ether_addr_copy(Delba->addr3, ieee->current_network.bssid); Delba->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT); - tag = (u8 *)skb_put(skb, 6); + tag = skb_put(skb, 6); *tag++ = ACT_CAT_BA; *tag++ = ACT_DELBA; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 60d07d0bb4eb..5f2751d4d464 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -351,8 +351,7 @@ static inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee) skb_reserve(skb, ieee->tx_headroom); - req = (struct rtllib_probe_request *) skb_put(skb, - sizeof(struct rtllib_probe_request)); + req = skb_put(skb, sizeof(struct rtllib_probe_request)); req->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_PROBE_REQ); req->header.duration_id = 0; @@ -360,7 +359,7 @@ static inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee) ether_addr_copy(req->header.addr2, ieee->dev->dev_addr); eth_broadcast_addr(req->header.addr3); - tag = (u8 *) skb_put(skb, len + 2 + rate_len); + tag = skb_put(skb, len + 2 + rate_len); *tag++ = MFIE_TYPE_SSID; *tag++ = len; @@ -789,8 +788,7 @@ rtllib_authentication_req(struct rtllib_network *beacon, skb_reserve(skb, ieee->tx_headroom); - auth = (struct rtllib_authentication *) - skb_put(skb, sizeof(struct rtllib_authentication)); + auth = skb_put(skb, sizeof(struct rtllib_authentication)); auth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_AUTH); if (challengelen) @@ -889,8 +887,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, skb_reserve(skb, ieee->tx_headroom); - beacon_buf = (struct rtllib_probe_response *) skb_put(skb, - (beacon_size - ieee->tx_headroom)); + beacon_buf = skb_put(skb, (beacon_size - ieee->tx_headroom)); ether_addr_copy(beacon_buf->header.addr1, dest); ether_addr_copy(beacon_buf->header.addr2, ieee->dev->dev_addr); ether_addr_copy(beacon_buf->header.addr3, ieee->current_network.bssid); @@ -984,8 +981,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest) skb_reserve(skb, ieee->tx_headroom); - assoc = (struct rtllib_assoc_response_frame *) - skb_put(skb, sizeof(struct rtllib_assoc_response_frame)); + assoc = skb_put(skb, sizeof(struct rtllib_assoc_response_frame)); assoc->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_ASSOC_RESP); ether_addr_copy(assoc->header.addr1, dest); @@ -1016,7 +1012,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest) else ieee->assoc_id++; - tag = (u8 *) skb_put(skb, rate_len); + tag = skb_put(skb, rate_len); rtllib_MFIE_Brate(ieee, &tag); rtllib_MFIE_Grate(ieee, &tag); @@ -1038,8 +1034,7 @@ static struct sk_buff *rtllib_auth_resp(struct rtllib_device *ieee, int status, skb_reserve(skb, ieee->tx_headroom); - auth = (struct rtllib_authentication *) - skb_put(skb, sizeof(struct rtllib_authentication)); + auth = skb_put(skb, sizeof(struct rtllib_authentication)); auth->status = cpu_to_le16(status); auth->transaction = cpu_to_le16(2); @@ -1065,8 +1060,7 @@ static struct sk_buff *rtllib_null_func(struct rtllib_device *ieee, short pwr) skb_reserve(skb, ieee->tx_headroom); - hdr = (struct rtllib_hdr_3addr *)skb_put(skb, - sizeof(struct rtllib_hdr_3addr)); + hdr = skb_put(skb, sizeof(struct rtllib_hdr_3addr)); ether_addr_copy(hdr->addr1, ieee->current_network.bssid); ether_addr_copy(hdr->addr2, ieee->dev->dev_addr); @@ -1092,8 +1086,7 @@ static struct sk_buff *rtllib_pspoll_func(struct rtllib_device *ieee) skb_reserve(skb, ieee->tx_headroom); - hdr = (struct rtllib_pspoll_hdr *)skb_put(skb, - sizeof(struct rtllib_pspoll_hdr)); + hdr = skb_put(skb, sizeof(struct rtllib_pspoll_hdr)); ether_addr_copy(hdr->bssid, ieee->current_network.bssid); ether_addr_copy(hdr->ta, ieee->dev->dev_addr); @@ -1243,8 +1236,7 @@ rtllib_association_req(struct rtllib_network *beacon, skb_reserve(skb, ieee->tx_headroom); - hdr = (struct rtllib_assoc_request_frame *) - skb_put(skb, sizeof(struct rtllib_assoc_request_frame) + 2); + hdr = skb_put(skb, sizeof(struct rtllib_assoc_request_frame) + 2); hdr->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_ASSOC_REQ); @@ -3414,8 +3406,7 @@ rtllib_disauth_skb(struct rtllib_network *beacon, skb_reserve(skb, ieee->tx_headroom); - disauth = (struct rtllib_disauth *) skb_put(skb, - sizeof(struct rtllib_disauth)); + disauth = skb_put(skb, sizeof(struct rtllib_disauth)); disauth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_DEAUTH); disauth->header.duration_id = 0; @@ -3442,8 +3433,7 @@ rtllib_disassociate_skb(struct rtllib_network *beacon, skb_reserve(skb, ieee->tx_headroom); - disass = (struct rtllib_disassoc *) skb_put(skb, - sizeof(struct rtllib_disassoc)); + disass = skb_put(skb, sizeof(struct rtllib_disassoc)); disass->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_DISASSOC); disass->header.duration_id = 0; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 903a1d0269df..107069180ed2 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -341,7 +341,7 @@ static inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) skb_reserve(skb, ieee->tx_headroom); - req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); + req = skb_put(skb, sizeof(struct ieee80211_probe_request)); req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); req->header.duration_id = 0; /* FIXME: is this OK? */ @@ -349,7 +349,7 @@ static inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); eth_broadcast_addr(req->header.addr3); - tag = (u8 *) skb_put(skb,len+2+rate_len); + tag = skb_put(skb, len + 2 + rate_len); *tag++ = MFIE_TYPE_SSID; *tag++ = len; @@ -659,8 +659,7 @@ ieee80211_authentication_req(struct ieee80211_network *beacon, if (!skb) return NULL; skb_reserve(skb, ieee->tx_headroom); - auth = (struct ieee80211_authentication *) - skb_put(skb, sizeof(struct ieee80211_authentication)); + auth = skb_put(skb, sizeof(struct ieee80211_authentication)); if (challengelen) auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH @@ -768,7 +767,7 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d if (!skb) return NULL; skb_reserve(skb, ieee->tx_headroom); - beacon_buf = (struct ieee80211_probe_response *) skb_put(skb, (beacon_size - ieee->tx_headroom)); + beacon_buf = skb_put(skb, (beacon_size - ieee->tx_headroom)); memcpy (beacon_buf->header.addr1, dest,ETH_ALEN); memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); @@ -864,8 +863,7 @@ static struct sk_buff *ieee80211_assoc_resp(struct ieee80211_device *ieee, skb_reserve(skb, ieee->tx_headroom); - assoc = (struct ieee80211_assoc_response_frame *) - skb_put(skb, sizeof(struct ieee80211_assoc_response_frame)); + assoc = skb_put(skb, sizeof(struct ieee80211_assoc_response_frame)); assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP); memcpy(assoc->header.addr1, dest,ETH_ALEN); @@ -892,7 +890,7 @@ static struct sk_buff *ieee80211_assoc_resp(struct ieee80211_device *ieee, if (ieee->assoc_id == 0x2007) ieee->assoc_id=0; else ieee->assoc_id++; - tag = (u8 *) skb_put(skb, rate_len); + tag = skb_put(skb, rate_len); ieee80211_MFIE_Brate(ieee, &tag); ieee80211_MFIE_Grate(ieee, &tag); @@ -940,7 +938,7 @@ static struct sk_buff *ieee80211_null_func(struct ieee80211_device *ieee, if (!skb) return NULL; - hdr = (struct rtl_80211_hdr_3addr *)skb_put(skb,sizeof(struct rtl_80211_hdr_3addr)); + hdr = skb_put(skb, sizeof(struct rtl_80211_hdr_3addr)); memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN); memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); @@ -1086,8 +1084,7 @@ ieee80211_association_req(struct ieee80211_network *beacon, skb_reserve(skb, ieee->tx_headroom); - hdr = (struct ieee80211_assoc_request_frame *) - skb_put(skb, sizeof(struct ieee80211_assoc_request_frame)+2); + hdr = skb_put(skb, sizeof(struct ieee80211_assoc_request_frame) + 2); hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ; @@ -3110,7 +3107,7 @@ static inline struct sk_buff *ieee80211_disassociate_skb( if (!skb) return NULL; - disass = (struct ieee80211_disassoc *) skb_put(skb, sizeof(struct ieee80211_disassoc)); + disass = skb_put(skb, sizeof(struct ieee80211_disassoc)); disass->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_DISASSOC); disass->header.duration_id = 0; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index e82b5073c3f1..8aa38dcf0dfd 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -125,7 +125,7 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P memset(skb->data, 0, sizeof( struct rtl_80211_hdr_3addr)); //I wonder whether it's necessary. Apparently kernel will not do it when alloc a skb. skb_reserve(skb, ieee->tx_headroom); - BAReq = ( struct rtl_80211_hdr_3addr *) skb_put(skb,sizeof( struct rtl_80211_hdr_3addr)); + BAReq = skb_put(skb, sizeof(struct rtl_80211_hdr_3addr)); memcpy(BAReq->addr1, Dst, ETH_ALEN); memcpy(BAReq->addr2, ieee->dev->dev_addr, ETH_ALEN); @@ -135,7 +135,7 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P BAReq->frame_ctl = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame //tag += sizeof( struct rtl_80211_hdr_3addr); //move to action field - tag = (u8 *)skb_put(skb, 9); + tag = skb_put(skb, 9); *tag ++= ACT_CAT_BA; *tag ++= type; // Dialog Token @@ -209,14 +209,14 @@ static struct sk_buff *ieee80211_DELBA( // memset(skb->data, 0, len+sizeof( struct rtl_80211_hdr_3addr)); skb_reserve(skb, ieee->tx_headroom); - Delba = ( struct rtl_80211_hdr_3addr *) skb_put(skb,sizeof( struct rtl_80211_hdr_3addr)); + Delba = skb_put(skb, sizeof(struct rtl_80211_hdr_3addr)); memcpy(Delba->addr1, dst, ETH_ALEN); memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy(Delba->addr3, ieee->current_network.bssid, ETH_ALEN); Delba->frame_ctl = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame - tag = (u8 *)skb_put(skb, 6); + tag = skb_put(skb, 6); *tag ++= ACT_CAT_BA; *tag ++= ACT_DELBA; diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c index 939c6ec51e4d..15cd1e33b16b 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c @@ -1085,7 +1085,7 @@ cxgbit_pass_accept_rpl(struct cxgbit_sock *csk, struct cpl_pass_accept_req *req) return; } - rpl5 = (struct cpl_t5_pass_accept_rpl *)__skb_put(skb, len); + rpl5 = __skb_put(skb, len); memset(rpl5, 0, len); INIT_TP_WR(rpl5, csk->tid); @@ -1367,7 +1367,7 @@ u32 cxgbit_send_tx_flowc_wr(struct cxgbit_sock *csk) flowclen16 = cxgbit_tx_flowc_wr_credits(csk, &nparams, &flowclen); skb = __skb_dequeue(&csk->skbq); - flowc = (struct fw_flowc_wr *)__skb_put(skb, flowclen); + flowc = __skb_put(skb, flowclen); memset(flowc, 0, flowclen); flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) | @@ -1439,7 +1439,7 @@ int cxgbit_setup_conn_digest(struct cxgbit_sock *csk) return -ENOMEM; /* set up ulp submode */ - req = (struct cpl_set_tcb_field *)__skb_put(skb, len); + req = __skb_put(skb, len); memset(req, 0, len); INIT_TP_WR(req, csk->tid); @@ -1476,7 +1476,7 @@ int cxgbit_setup_conn_pgidx(struct cxgbit_sock *csk, u32 pg_idx) if (!skb) return -ENOMEM; - req = (struct cpl_set_tcb_field *)__skb_put(skb, len); + req = __skb_put(skb, len); memset(req, 0, len); INIT_TP_WR(req, csk->tid); diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c index 5d78bdb7fc64..5fdb57cac968 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c @@ -79,7 +79,7 @@ cxgbit_ppod_init_idata(struct cxgbit_device *cdev, struct cxgbi_ppm *ppm, if (!skb) return NULL; - req = (struct ulp_mem_io *)__skb_put(skb, wr_len); + req = __skb_put(skb, wr_len); INIT_ULPTX_WR(req, wr_len, 0, tid); req->wr.wr_hi = htonl(FW_WR_OP_V(FW_ULPTX_WR) | FW_WR_ATOMIC_V(0)); diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index 630616aaa861..a9c28c72c1c7 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -1047,7 +1047,7 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port, crc = ~crc32_le(~0, skb->data, skb->len); - crc_pos = (void *) skb_put(skb, sizeof(uint32_t)); + crc_pos = skb_put(skb, sizeof(uint32_t)); put_unaligned_le32(crc, crc_pos); } @@ -1097,8 +1097,7 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port, goto err; ncm->skb_tx_ndp->dev = ncm->netdev; - ntb_ndp = (void *) skb_put(ncm->skb_tx_ndp, - opts->ndp_size); + ntb_ndp = skb_put(ncm->skb_tx_ndp, opts->ndp_size); memset(ntb_ndp, 0, ncb_len); /* dwSignature */ put_unaligned_le32(ncm->ndp_sign, ntb_ndp); diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5af5385a0e72..454ea37dddbb 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1893,11 +1893,11 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) /* * Add data to an sk_buff */ -unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); -unsigned char *skb_put(struct sk_buff *skb, unsigned int len); -static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) +void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); +void *skb_put(struct sk_buff *skb, unsigned int len); +static inline void *__skb_put(struct sk_buff *skb, unsigned int len) { - unsigned char *tmp = skb_tail_pointer(skb); + void *tmp = skb_tail_pointer(skb); SKB_LINEAR_ASSERT(skb); skb->tail += len; skb->len += len; diff --git a/lib/nlattr.c b/lib/nlattr.c index ab15a6c095d3..a0c738aa6a79 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -352,7 +352,7 @@ struct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen) { struct nlattr *nla; - nla = (struct nlattr *) skb_put(skb, nla_total_size(attrlen)); + nla = skb_put(skb, nla_total_size(attrlen)); nla->nla_type = attrtype; nla->nla_len = nla_attr_size(attrlen); diff --git a/net/802/garp.c b/net/802/garp.c index b38ee6dcba45..a9a266569293 100644 --- a/net/802/garp.c +++ b/net/802/garp.c @@ -221,7 +221,7 @@ static int garp_pdu_init(struct garp_applicant *app) skb->protocol = htons(ETH_P_802_2); skb_reserve(skb, LL_RESERVED_SPACE(app->dev) + LLC_RESERVE); - gp = (struct garp_pdu_hdr *)__skb_put(skb, sizeof(*gp)); + gp = __skb_put(skb, sizeof(*gp)); put_unaligned(htons(GARP_PROTOCOL_ID), &gp->protocol); app->pdu = skb; @@ -268,7 +268,7 @@ static int garp_pdu_append_msg(struct garp_applicant *app, u8 attrtype) if (skb_tailroom(app->pdu) < sizeof(*gm)) return -1; - gm = (struct garp_msg_hdr *)__skb_put(app->pdu, sizeof(*gm)); + gm = __skb_put(app->pdu, sizeof(*gm)); gm->attrtype = attrtype; garp_cb(app->pdu)->cur_type = attrtype; return 0; @@ -299,7 +299,7 @@ again: len = sizeof(*ga) + attr->dlen; if (skb_tailroom(app->pdu) < len) goto queue; - ga = (struct garp_attr_hdr *)__skb_put(app->pdu, len); + ga = __skb_put(app->pdu, len); ga->len = len; ga->event = event; memcpy(ga->data, attr->data, attr->dlen); diff --git a/net/802/mrp.c b/net/802/mrp.c index 72db2785ef2c..be4dd3165347 100644 --- a/net/802/mrp.c +++ b/net/802/mrp.c @@ -311,7 +311,7 @@ static int mrp_pdu_init(struct mrp_applicant *app) skb_reset_network_header(skb); skb_reset_transport_header(skb); - ph = (struct mrp_pdu_hdr *)__skb_put(skb, sizeof(*ph)); + ph = __skb_put(skb, sizeof(*ph)); ph->version = app->app->version; app->pdu = skb; @@ -324,7 +324,7 @@ static int mrp_pdu_append_end_mark(struct mrp_applicant *app) if (skb_tailroom(app->pdu) < sizeof(*endmark)) return -1; - endmark = (__be16 *)__skb_put(app->pdu, sizeof(*endmark)); + endmark = __skb_put(app->pdu, sizeof(*endmark)); put_unaligned(MRP_END_MARK, endmark); return 0; } @@ -368,7 +368,7 @@ static int mrp_pdu_append_msg_hdr(struct mrp_applicant *app, if (skb_tailroom(app->pdu) < sizeof(*mh)) return -1; - mh = (struct mrp_msg_hdr *)__skb_put(app->pdu, sizeof(*mh)); + mh = __skb_put(app->pdu, sizeof(*mh)); mh->attrtype = attrtype; mh->attrlen = attrlen; mrp_cb(app->pdu)->mh = mh; @@ -382,8 +382,7 @@ static int mrp_pdu_append_vecattr_hdr(struct mrp_applicant *app, if (skb_tailroom(app->pdu) < sizeof(*vah) + attrlen) return -1; - vah = (struct mrp_vecattr_hdr *)__skb_put(app->pdu, - sizeof(*vah) + attrlen); + vah = __skb_put(app->pdu, sizeof(*vah) + attrlen); put_unaligned(0, &vah->lenflags); memcpy(vah->firstattrvalue, firstattrvalue, attrlen); mrp_cb(app->pdu)->vah = vah; @@ -435,7 +434,7 @@ again: if (!pos) { if (skb_tailroom(app->pdu) < sizeof(u8)) goto queue; - vaevents = (u8 *)__skb_put(app->pdu, sizeof(u8)); + vaevents = __skb_put(app->pdu, sizeof(u8)); } else { vaevents = (u8 *)(skb_tail_pointer(app->pdu) - sizeof(u8)); } diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 465cc24b41e5..c7af6dc70fa2 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -1647,7 +1647,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk); - ddp = (struct ddpehdr *)skb_put(skb, sizeof(struct ddpehdr)); + ddp = skb_put(skb, sizeof(struct ddpehdr)); ddp->deh_len_hops = htons(len + sizeof(*ddp)); ddp->deh_dnet = usat->sat_addr.s_net; ddp->deh_snet = at->src_net; diff --git a/net/atm/clip.c b/net/atm/clip.c index ec527b62f79d..a7e4018370b4 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c @@ -60,7 +60,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip) skb = alloc_skb(sizeof(struct atmarp_ctrl), GFP_ATOMIC); if (!skb) return -ENOMEM; - ctrl = (struct atmarp_ctrl *)skb_put(skb, sizeof(struct atmarp_ctrl)); + ctrl = skb_put(skb, sizeof(struct atmarp_ctrl)); ctrl->type = type; ctrl->itf_num = itf; ctrl->ip = ip; diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 6308c9f0fd96..8ead292886d1 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c @@ -207,7 +207,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, skb->priority = TC_PRIO_CONTROL; skb_reserve(skb, ETH_HLEN); - icmp_header = (struct batadv_icmp_header *)skb_put(skb, packet_len); + icmp_header = skb_put(skb, packet_len); if (copy_from_user(icmp_header, buff, packet_len)) { len = -EFAULT; diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index e3e2585d0977..bfe8effe9238 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -595,7 +595,7 @@ static int batadv_tp_send_msg(struct batadv_tp_vars *tp_vars, const u8 *src, return BATADV_TP_REASON_MEMORY_ERROR; skb_reserve(skb, ETH_HLEN); - icmp = (struct batadv_icmp_tp_packet *)skb_put(skb, sizeof(*icmp)); + icmp = skb_put(skb, sizeof(*icmp)); /* fill the icmp header */ ether_addr_copy(icmp->dst, orig_node->orig); @@ -612,7 +612,7 @@ static int batadv_tp_send_msg(struct batadv_tp_vars *tp_vars, const u8 *src, icmp->timestamp = htonl(timestamp); data_len = len - sizeof(*icmp); - data = (u8 *)skb_put(skb, data_len); + data = skb_put(skb, data_len); batadv_tp_fill_prerandom(tp_vars, data, data_len); r = batadv_send_skb_to_orig(skb, orig_node, NULL); @@ -1190,7 +1190,7 @@ static int batadv_tp_send_ack(struct batadv_priv *bat_priv, const u8 *dst, } skb_reserve(skb, ETH_HLEN); - icmp = (struct batadv_icmp_tp_packet *)skb_put(skb, sizeof(*icmp)); + icmp = skb_put(skb, sizeof(*icmp)); icmp->packet_type = BATADV_ICMP; icmp->version = BATADV_COMPAT_VERSION; icmp->ttl = BATADV_TTL; diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 4e4105a932bd..b73ac149de34 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -299,7 +299,7 @@ struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, if (!skb) return NULL; - hdr = (struct hci_command_hdr *) skb_put(skb, HCI_COMMAND_HDR_SIZE); + hdr = skb_put(skb, HCI_COMMAND_HDR_SIZE); hdr->opcode = cpu_to_le16(opcode); hdr->plen = plen; diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 083e87f26a0f..1301a8786d8d 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -410,7 +410,7 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event) if (!skb) return NULL; - ni = (void *)skb_put(skb, HCI_MON_NEW_INDEX_SIZE); + ni = skb_put(skb, HCI_MON_NEW_INDEX_SIZE); ni->type = hdev->dev_type; ni->bus = hdev->bus; bacpy(&ni->bdaddr, &hdev->bdaddr); @@ -438,7 +438,7 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event) if (!skb) return NULL; - ii = (void *)skb_put(skb, HCI_MON_INDEX_INFO_SIZE); + ii = skb_put(skb, HCI_MON_INDEX_INFO_SIZE); bacpy(&ii->bdaddr, &hdev->bdaddr); ii->manufacturer = cpu_to_le16(hdev->manufacturer); @@ -517,7 +517,7 @@ static struct sk_buff *create_monitor_ctrl_open(struct sock *sk) put_unaligned_le16(format, skb_put(skb, 2)); skb_put_data(skb, ver, sizeof(ver)); put_unaligned_le32(flags, skb_put(skb, 4)); - *skb_put(skb, 1) = TASK_COMM_LEN; + *(u8 *)skb_put(skb, 1) = TASK_COMM_LEN; skb_put_data(skb, hci_pi(sk)->comm, TASK_COMM_LEN); __net_timestamp(skb); @@ -616,7 +616,7 @@ send_monitor_note(struct sock *sk, const char *fmt, ...) va_start(args, fmt); vsprintf(skb_put(skb, len), fmt, args); - *skb_put(skb, 1) = 0; + *(u8 *)skb_put(skb, 1) = 0; va_end(args); __net_timestamp(skb); @@ -703,11 +703,11 @@ static void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data) if (!skb) return; - hdr = (void *)skb_put(skb, HCI_EVENT_HDR_SIZE); + hdr = skb_put(skb, HCI_EVENT_HDR_SIZE); hdr->evt = HCI_EV_STACK_INTERNAL; hdr->plen = sizeof(*ev) + dlen; - ev = (void *)skb_put(skb, sizeof(*ev) + dlen); + ev = skb_put(skb, sizeof(*ev) + dlen); ev->type = type; memcpy(ev->data, data, dlen); diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 9e83713262e8..c0d0832a023d 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -112,7 +112,7 @@ static int hidp_send_message(struct hidp_session *session, struct socket *sock, return -ENOMEM; } - *skb_put(skb, 1) = hdr; + *(u8 *)skb_put(skb, 1) = hdr; if (data && size > 0) skb_put_data(skb, data, size); diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index fe6a5529bdf5..303c779bfe38 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1048,7 +1048,7 @@ static struct sk_buff *l2cap_create_sframe_pdu(struct l2cap_chan *chan, if (!skb) return ERR_PTR(-ENOMEM); - lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); + lh = skb_put(skb, L2CAP_HDR_SIZE); lh->len = cpu_to_le16(hlen - L2CAP_HDR_SIZE); lh->cid = cpu_to_le16(chan->dcid); @@ -2182,7 +2182,7 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, return skb; /* Create L2CAP header */ - lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); + lh = skb_put(skb, L2CAP_HDR_SIZE); lh->cid = cpu_to_le16(chan->dcid); lh->len = cpu_to_le16(len + L2CAP_PSMLEN_SIZE); put_unaligned(chan->psm, (__le16 *) skb_put(skb, L2CAP_PSMLEN_SIZE)); @@ -2213,7 +2213,7 @@ static struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, return skb; /* Create L2CAP header */ - lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); + lh = skb_put(skb, L2CAP_HDR_SIZE); lh->cid = cpu_to_le16(chan->dcid); lh->len = cpu_to_le16(len); @@ -2255,7 +2255,7 @@ static struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, return skb; /* Create L2CAP header */ - lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); + lh = skb_put(skb, L2CAP_HDR_SIZE); lh->cid = cpu_to_le16(chan->dcid); lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); @@ -2373,7 +2373,7 @@ static struct sk_buff *l2cap_create_le_flowctl_pdu(struct l2cap_chan *chan, return skb; /* Create L2CAP header */ - lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); + lh = skb_put(skb, L2CAP_HDR_SIZE); lh->cid = cpu_to_le16(chan->dcid); lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); @@ -2908,7 +2908,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code, if (!skb) return NULL; - lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); + lh = skb_put(skb, L2CAP_HDR_SIZE); lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen); if (conn->hcon->type == LE_LINK) @@ -2916,7 +2916,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code, else lh->cid = cpu_to_le16(L2CAP_CID_SIGNALING); - cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE); + cmd = skb_put(skb, L2CAP_CMD_HDR_SIZE); cmd->code = code; cmd->ident = ident; cmd->len = cpu_to_le16(dlen); diff --git a/net/bluetooth/mgmt_util.c b/net/bluetooth/mgmt_util.c index 11d0ca64402b..d057113e0d4b 100644 --- a/net/bluetooth/mgmt_util.c +++ b/net/bluetooth/mgmt_util.c @@ -66,7 +66,7 @@ int mgmt_send_event(u16 event, struct hci_dev *hdev, unsigned short channel, if (!skb) return -ENOMEM; - hdr = (void *) skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); hdr->opcode = cpu_to_le16(event); if (hdev) hdr->index = cpu_to_le16(hdev->id); @@ -103,13 +103,13 @@ int mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status) if (!skb) return -ENOMEM; - hdr = (void *) skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); hdr->opcode = cpu_to_le16(MGMT_EV_CMD_STATUS); hdr->index = cpu_to_le16(index); hdr->len = cpu_to_le16(sizeof(*ev)); - ev = (void *) skb_put(skb, sizeof(*ev)); + ev = skb_put(skb, sizeof(*ev)); ev->status = status; ev->opcode = cpu_to_le16(cmd); @@ -147,13 +147,13 @@ int mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status, if (!skb) return -ENOMEM; - hdr = (void *) skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); hdr->opcode = cpu_to_le16(MGMT_EV_CMD_COMPLETE); hdr->index = cpu_to_le16(index); hdr->len = cpu_to_le16(sizeof(*ev) + rp_len); - ev = (void *) skb_put(skb, sizeof(*ev) + rp_len); + ev = skb_put(skb, sizeof(*ev) + rp_len); ev->opcode = cpu_to_le16(cmd); ev->status = status; diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 8ebca9033d60..1a9b906c5a35 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -863,7 +863,7 @@ static int rfcomm_queue_disc(struct rfcomm_dlc *d) if (!skb) return -ENOMEM; - cmd = (void *) __skb_put(skb, sizeof(*cmd)); + cmd = __skb_put(skb, sizeof(*cmd)); cmd->addr = d->addr; cmd->ctrl = __ctrl(RFCOMM_DISC, 1); cmd->len = __len8(0); diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 8860ad985d68..b8bcf9021329 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2714,7 +2714,7 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb, struct timeval timestamp; struct pktgen_hdr *pgh; - pgh = (struct pktgen_hdr *)skb_put(skb, sizeof(*pgh)); + pgh = skb_put(skb, sizeof(*pgh)); datalen -= sizeof(*pgh); if (pkt_dev->nfrags <= 0) { @@ -2845,33 +2845,34 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, /* Reserve for ethernet and IP header */ eth = (__u8 *) skb_push(skb, 14); - mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32)); + mpls = skb_put(skb, pkt_dev->nr_labels * sizeof(__u32)); if (pkt_dev->nr_labels) mpls_push(mpls, pkt_dev); if (pkt_dev->vlan_id != 0xffff) { if (pkt_dev->svlan_id != 0xffff) { - svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); + svlan_tci = skb_put(skb, sizeof(__be16)); *svlan_tci = build_tci(pkt_dev->svlan_id, pkt_dev->svlan_cfi, pkt_dev->svlan_p); - svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); + svlan_encapsulated_proto = skb_put(skb, + sizeof(__be16)); *svlan_encapsulated_proto = htons(ETH_P_8021Q); } - vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); + vlan_tci = skb_put(skb, sizeof(__be16)); *vlan_tci = build_tci(pkt_dev->vlan_id, pkt_dev->vlan_cfi, pkt_dev->vlan_p); - vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); + vlan_encapsulated_proto = skb_put(skb, sizeof(__be16)); *vlan_encapsulated_proto = htons(ETH_P_IP); } skb_reset_mac_header(skb); skb_set_network_header(skb, skb->len); - iph = (struct iphdr *) skb_put(skb, sizeof(struct iphdr)); + iph = skb_put(skb, sizeof(struct iphdr)); skb_set_transport_header(skb, skb->len); - udph = (struct udphdr *) skb_put(skb, sizeof(struct udphdr)); + udph = skb_put(skb, sizeof(struct udphdr)); skb_set_queue_mapping(skb, queue_map); skb->priority = pkt_dev->skb_priority; @@ -2972,33 +2973,34 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, /* Reserve for ethernet and IP header */ eth = (__u8 *) skb_push(skb, 14); - mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32)); + mpls = skb_put(skb, pkt_dev->nr_labels * sizeof(__u32)); if (pkt_dev->nr_labels) mpls_push(mpls, pkt_dev); if (pkt_dev->vlan_id != 0xffff) { if (pkt_dev->svlan_id != 0xffff) { - svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); + svlan_tci = skb_put(skb, sizeof(__be16)); *svlan_tci = build_tci(pkt_dev->svlan_id, pkt_dev->svlan_cfi, pkt_dev->svlan_p); - svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); + svlan_encapsulated_proto = skb_put(skb, + sizeof(__be16)); *svlan_encapsulated_proto = htons(ETH_P_8021Q); } - vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); + vlan_tci = skb_put(skb, sizeof(__be16)); *vlan_tci = build_tci(pkt_dev->vlan_id, pkt_dev->vlan_cfi, pkt_dev->vlan_p); - vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); + vlan_encapsulated_proto = skb_put(skb, sizeof(__be16)); *vlan_encapsulated_proto = htons(ETH_P_IPV6); } skb_reset_mac_header(skb); skb_set_network_header(skb, skb->len); - iph = (struct ipv6hdr *) skb_put(skb, sizeof(struct ipv6hdr)); + iph = skb_put(skb, sizeof(struct ipv6hdr)); skb_set_transport_header(skb, skb->len); - udph = (struct udphdr *) skb_put(skb, sizeof(struct udphdr)); + udph = skb_put(skb, sizeof(struct udphdr)); skb_set_queue_mapping(skb, queue_map); skb->priority = pkt_dev->skb_priority; diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c4d2c1f824bb..0baa7f2dd8ef 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -1421,7 +1421,7 @@ EXPORT_SYMBOL(skb_pad); * returned. */ -unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len) +void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len) { if (tail != skb) { skb->data_len += len; @@ -1440,9 +1440,9 @@ EXPORT_SYMBOL_GPL(pskb_put); * exceed the total buffer size the kernel will panic. A pointer to the * first byte of the extra data is returned. */ -unsigned char *skb_put(struct sk_buff *skb, unsigned int len) +void *skb_put(struct sk_buff *skb, unsigned int len) { - unsigned char *tmp = skb_tail_pointer(skb); + void *tmp = skb_tail_pointer(skb); SKB_LINEAR_ASSERT(skb); skb->tail += len; skb->len += len; diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 9017a9a73ab5..1d84f6dae315 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -846,7 +846,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) skb->dev = dev; - msg = (struct endnode_hello_message *)skb_put(skb,sizeof(*msg)); + msg = skb_put(skb, sizeof(*msg)); msg->msgflg = 0x0D; memcpy(msg->tiver, dn_eco_version, 3); diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index b8a558715395..7e054b2f270a 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c @@ -484,7 +484,7 @@ void dn_send_conn_ack (struct sock *sk) if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL) return; - msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3); + msg = skb_put(skb, 3); msg->msgflg = 0x24; msg->dstaddr = scp->addrrem; @@ -522,7 +522,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) return; - msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); + msg = skb_put(skb, sizeof(*msg)); msg->msgflg = 0x28; msg->dstaddr = scp->addrrem; msg->srcaddr = scp->addrloc; @@ -530,7 +530,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) msg->info = scp->info_loc; msg->segsize = cpu_to_le16(scp->segsize_loc); - *skb_put(skb,1) = len; + *(u8 *)skb_put(skb, 1) = len; if (len > 0) skb_put_data(skb, scp->conndata_out.opt_data, len); @@ -662,7 +662,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) return; cb = DN_SKB_CB(skb); - msg = (struct nsp_conn_init_msg *)skb_put(skb,sizeof(*msg)); + msg = skb_put(skb, sizeof(*msg)); msg->msgflg = msgflg; msg->dstaddr = 0x0000; /* Remote Node will assign it*/ @@ -686,25 +686,25 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) if (scp->peer.sdn_flags & SDF_UICPROXY) menuver |= DN_MENUVER_UIC; - *skb_put(skb, 1) = menuver; /* Menu Version */ + *(u8 *)skb_put(skb, 1) = menuver; /* Menu Version */ aux = scp->accessdata.acc_userl; - *skb_put(skb, 1) = aux; + *(u8 *)skb_put(skb, 1) = aux; if (aux > 0) skb_put_data(skb, scp->accessdata.acc_user, aux); aux = scp->accessdata.acc_passl; - *skb_put(skb, 1) = aux; + *(u8 *)skb_put(skb, 1) = aux; if (aux > 0) skb_put_data(skb, scp->accessdata.acc_pass, aux); aux = scp->accessdata.acc_accl; - *skb_put(skb, 1) = aux; + *(u8 *)skb_put(skb, 1) = aux; if (aux > 0) skb_put_data(skb, scp->accessdata.acc_acc, aux); aux = (__u8)le16_to_cpu(scp->conndata_out.opt_optl); - *skb_put(skb, 1) = aux; + *(u8 *)skb_put(skb, 1) = aux; if (aux > 0) skb_put_data(skb, scp->conndata_out.opt_data, aux); diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index a651c53260ec..8b52179ddc6e 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -539,7 +539,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, skb_reserve(skb, hlen); skb_reset_network_header(skb); - arp = (struct arphdr *) skb_put(skb, arp_hdr_len(dev)); + arp = skb_put(skb, arp_hdr_len(dev)); skb->dev = dev; skb->protocol = htons(ETH_P_ARP); if (!src_hw) diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 8f6b5bbcbf69..2202edf31884 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -414,7 +414,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, skb = igmpv3_newpack(dev, dev->mtu); if (!skb) return NULL; - pgr = (struct igmpv3_grec *)skb_put(skb, sizeof(struct igmpv3_grec)); + pgr = skb_put(skb, sizeof(struct igmpv3_grec)); pgr->grec_type = type; pgr->grec_auxwords = 0; pgr->grec_nsrcs = 0; @@ -508,7 +508,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, } if (!skb) return NULL; - psrc = (__be32 *)skb_put(skb, sizeof(__be32)); + psrc = skb_put(skb, sizeof(__be32)); *psrc = psf->sf_inaddr; scount++; stotal++; if ((type == IGMPV3_ALLOW_NEW_SOURCES || @@ -742,7 +742,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, ((u8 *)&iph[1])[2] = 0; ((u8 *)&iph[1])[3] = 0; - ih = (struct igmphdr *)skb_put(skb, sizeof(struct igmphdr)); + ih = skb_put(skb, sizeof(struct igmphdr)); ih->type = type; ih->code = 0; ih->csum = 0; diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index a1199895b8a6..abbd7c992960 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -1044,7 +1044,7 @@ static int ipmr_cache_report(struct mr_table *mrt, msg->im_vif = vifi; skb_dst_set(skb, dst_clone(skb_dst(pkt))); /* Add our header */ - igmp = (struct igmphdr *)skb_put(skb, sizeof(struct igmphdr)); + igmp = skb_put(skb, sizeof(struct igmphdr)); igmp->type = assert; msg->im_msgtype = assert; igmp->code = 0; diff --git a/net/ipv4/netfilter/ipt_SYNPROXY.c b/net/ipv4/netfilter/ipt_SYNPROXY.c index af2b69b6895f..f1528f7175a8 100644 --- a/net/ipv4/netfilter/ipt_SYNPROXY.c +++ b/net/ipv4/netfilter/ipt_SYNPROXY.c @@ -24,7 +24,7 @@ synproxy_build_ip(struct net *net, struct sk_buff *skb, __be32 saddr, struct iphdr *iph; skb_reset_network_header(skb); - iph = (struct iphdr *)skb_put(skb, sizeof(*iph)); + iph = skb_put(skb, sizeof(*iph)); iph->version = 4; iph->ihl = sizeof(*iph) / 4; iph->tos = 0; @@ -91,7 +91,7 @@ synproxy_send_client_synack(struct net *net, niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr); skb_reset_transport_header(nskb); - nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); + nth = skb_put(nskb, tcp_hdr_size); nth->source = th->dest; nth->dest = th->source; nth->seq = htonl(__cookie_v4_init_sequence(iph, th, &mss)); @@ -133,7 +133,7 @@ synproxy_send_server_syn(struct net *net, niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr); skb_reset_transport_header(nskb); - nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); + nth = skb_put(nskb, tcp_hdr_size); nth->source = th->source; nth->dest = th->dest; nth->seq = htonl(recv_seq - 1); @@ -178,7 +178,7 @@ synproxy_send_server_ack(struct net *net, niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr); skb_reset_transport_header(nskb); - nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); + nth = skb_put(nskb, tcp_hdr_size); nth->source = th->dest; nth->dest = th->source; nth->seq = htonl(ntohl(th->ack_seq)); @@ -216,7 +216,7 @@ synproxy_send_client_ack(struct net *net, niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr); skb_reset_transport_header(nskb); - nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); + nth = skb_put(nskb, tcp_hdr_size); nth->source = th->source; nth->dest = th->dest; nth->seq = htonl(ntohl(th->seq) + 1); diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c index 52b7dcc5aaf3..eeacbdaf7cdf 100644 --- a/net/ipv4/netfilter/nf_reject_ipv4.c +++ b/net/ipv4/netfilter/nf_reject_ipv4.c @@ -51,7 +51,7 @@ struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, struct iphdr *niph, *oiph = ip_hdr(oldskb); skb_reset_network_header(nskb); - niph = (struct iphdr *)skb_put(nskb, sizeof(struct iphdr)); + niph = skb_put(nskb, sizeof(struct iphdr)); niph->version = 4; niph->ihl = sizeof(struct iphdr) / 4; niph->tos = 0; diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index b64046ccae69..e2221135858b 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1692,7 +1692,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, skb = mld_newpack(pmc->idev, dev->mtu); if (!skb) return NULL; - pgr = (struct mld2_grec *)skb_put(skb, sizeof(struct mld2_grec)); + pgr = skb_put(skb, sizeof(struct mld2_grec)); pgr->grec_type = type; pgr->grec_auxwords = 0; pgr->grec_nsrcs = 0; @@ -1784,7 +1784,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, } if (!skb) return NULL; - psrc = (struct in6_addr *)skb_put(skb, sizeof(*psrc)); + psrc = skb_put(skb, sizeof(*psrc)); *psrc = psf->sf_addr; scount++; stotal++; if ((type == MLD2_ALLOW_NEW_SOURCES || diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index d310dc41209a..0327c1f2e6fc 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -528,7 +528,7 @@ void ndisc_send_na(struct net_device *dev, const struct in6_addr *daddr, if (!skb) return; - msg = (struct nd_msg *)skb_put(skb, sizeof(*msg)); + msg = skb_put(skb, sizeof(*msg)); *msg = (struct nd_msg) { .icmph = { .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT, @@ -597,7 +597,7 @@ void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit, if (!skb) return; - msg = (struct nd_msg *)skb_put(skb, sizeof(*msg)); + msg = skb_put(skb, sizeof(*msg)); *msg = (struct nd_msg) { .icmph = { .icmp6_type = NDISC_NEIGHBOUR_SOLICITATION, @@ -657,7 +657,7 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, if (!skb) return; - msg = (struct rs_msg *)skb_put(skb, sizeof(*msg)); + msg = skb_put(skb, sizeof(*msg)); *msg = (struct rs_msg) { .icmph = { .icmp6_type = NDISC_ROUTER_SOLICITATION, @@ -1633,7 +1633,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) if (!buff) goto release; - msg = (struct rd_msg *)skb_put(buff, sizeof(*msg)); + msg = skb_put(buff, sizeof(*msg)); *msg = (struct rd_msg) { .icmph = { .icmp6_type = NDISC_REDIRECT, diff --git a/net/ipv6/netfilter/ip6t_SYNPROXY.c b/net/ipv6/netfilter/ip6t_SYNPROXY.c index d3c4daa708b9..ce203dd729e0 100644 --- a/net/ipv6/netfilter/ip6t_SYNPROXY.c +++ b/net/ipv6/netfilter/ip6t_SYNPROXY.c @@ -27,7 +27,7 @@ synproxy_build_ip(struct net *net, struct sk_buff *skb, struct ipv6hdr *iph; skb_reset_network_header(skb); - iph = (struct ipv6hdr *)skb_put(skb, sizeof(*iph)); + iph = skb_put(skb, sizeof(*iph)); ip6_flow_hdr(iph, 0, 0); iph->hop_limit = net->ipv6.devconf_all->hop_limit; iph->nexthdr = IPPROTO_TCP; @@ -105,7 +105,7 @@ synproxy_send_client_synack(struct net *net, niph = synproxy_build_ip(net, nskb, &iph->daddr, &iph->saddr); skb_reset_transport_header(nskb); - nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); + nth = skb_put(nskb, tcp_hdr_size); nth->source = th->dest; nth->dest = th->source; nth->seq = htonl(__cookie_v6_init_sequence(iph, th, &mss)); @@ -147,7 +147,7 @@ synproxy_send_server_syn(struct net *net, niph = synproxy_build_ip(net, nskb, &iph->saddr, &iph->daddr); skb_reset_transport_header(nskb); - nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); + nth = skb_put(nskb, tcp_hdr_size); nth->source = th->source; nth->dest = th->dest; nth->seq = htonl(recv_seq - 1); @@ -192,7 +192,7 @@ synproxy_send_server_ack(struct net *net, niph = synproxy_build_ip(net, nskb, &iph->daddr, &iph->saddr); skb_reset_transport_header(nskb); - nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); + nth = skb_put(nskb, tcp_hdr_size); nth->source = th->dest; nth->dest = th->source; nth->seq = htonl(ntohl(th->ack_seq)); @@ -230,7 +230,7 @@ synproxy_send_client_ack(struct net *net, niph = synproxy_build_ip(net, nskb, &iph->saddr, &iph->daddr); skb_reset_transport_header(nskb); - nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); + nth = skb_put(nskb, tcp_hdr_size); nth->source = th->source; nth->dest = th->dest; nth->seq = htonl(ntohl(th->seq) + 1); diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c index f63b18e05c69..24858402e374 100644 --- a/net/ipv6/netfilter/nf_reject_ipv6.c +++ b/net/ipv6/netfilter/nf_reject_ipv6.c @@ -95,7 +95,7 @@ void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, int needs_ack; skb_reset_transport_header(nskb); - tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); + tcph = skb_put(nskb, sizeof(struct tcphdr)); /* Truncate to length (no data) */ tcph->doff = sizeof(struct tcphdr)/4; tcph->source = oth->dest; diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index bf56ac7dba96..82e71e5622c2 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c @@ -133,7 +133,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos) if (!tx_skb) return; - frame = (struct snrm_frame *) skb_put(tx_skb, 2); + frame = skb_put(tx_skb, 2); /* Insert connection address field */ if (qos) @@ -228,7 +228,7 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos) if (!tx_skb) return; - frame = (struct ua_frame *) skb_put(tx_skb, 10); + frame = skb_put(tx_skb, 10); /* Build UA response */ frame->caddr = self->caddr; @@ -268,7 +268,7 @@ void irlap_send_dm_frame( struct irlap_cb *self) if (!tx_skb) return; - frame = (struct dm_frame *)skb_put(tx_skb, 2); + frame = skb_put(tx_skb, 2); if (self->state == LAP_NDM) frame->caddr = CBROADCAST; @@ -298,7 +298,7 @@ void irlap_send_disc_frame(struct irlap_cb *self) if (!tx_skb) return; - frame = (struct disc_frame *)skb_put(tx_skb, 2); + frame = skb_put(tx_skb, 2); frame->caddr = self->caddr | CMD_FRAME; frame->control = DISC_CMD | PF_BIT; @@ -587,7 +587,7 @@ void irlap_send_rr_frame(struct irlap_cb *self, int command) if (!tx_skb) return; - frame = (struct rr_frame *)skb_put(tx_skb, 2); + frame = skb_put(tx_skb, 2); frame->caddr = self->caddr; frame->caddr |= (command) ? CMD_FRAME : 0; @@ -612,7 +612,7 @@ void irlap_send_rd_frame(struct irlap_cb *self) if (!tx_skb) return; - frame = (struct rd_frame *)skb_put(tx_skb, 2); + frame = skb_put(tx_skb, 2); frame->caddr = self->caddr; frame->control = RD_RSP | PF_BIT; @@ -1202,14 +1202,13 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, /* Broadcast frames must include saddr and daddr fields */ if (caddr == CBROADCAST) { - frame = (struct test_frame *) - skb_put(tx_skb, sizeof(struct test_frame)); + frame = skb_put(tx_skb, sizeof(struct test_frame)); /* Insert the swapped addresses */ frame->saddr = cpu_to_le32(self->saddr); frame->daddr = cpu_to_le32(daddr); } else - frame = (struct test_frame *) skb_put(tx_skb, LAP_ADDR_HEADER + LAP_CTRL_HEADER); + frame = skb_put(tx_skb, LAP_ADDR_HEADER + LAP_CTRL_HEADER); frame->caddr = caddr; frame->control = TEST_RSP | PF_BIT; diff --git a/net/key/af_key.c b/net/key/af_key.c index 3ebb4268973b..daa4e90dc4db 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -349,7 +349,7 @@ static int pfkey_error(const struct sadb_msg *orig, int err, struct sock *sk) err = EINVAL; BUG_ON(err <= 0 || err >= 256); - hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); + hdr = skb_put(skb, sizeof(struct sadb_msg)); pfkey_hdr_dup(hdr, orig); hdr->sadb_msg_errno = (uint8_t) err; hdr->sadb_msg_len = (sizeof(struct sadb_msg) / @@ -810,12 +810,12 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, return ERR_PTR(-ENOBUFS); /* call should fill header later */ - hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); + hdr = skb_put(skb, sizeof(struct sadb_msg)); memset(hdr, 0, size); /* XXX do we need this ? */ hdr->sadb_msg_len = size / sizeof(uint64_t); /* sa */ - sa = (struct sadb_sa *) skb_put(skb, sizeof(struct sadb_sa)); + sa = skb_put(skb, sizeof(struct sadb_sa)); sa->sadb_sa_len = sizeof(struct sadb_sa)/sizeof(uint64_t); sa->sadb_sa_exttype = SADB_EXT_SA; sa->sadb_sa_spi = x->id.spi; @@ -862,8 +862,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, /* hard time */ if (hsc & 2) { - lifetime = (struct sadb_lifetime *) skb_put(skb, - sizeof(struct sadb_lifetime)); + lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD; @@ -874,8 +873,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, } /* soft time */ if (hsc & 1) { - lifetime = (struct sadb_lifetime *) skb_put(skb, - sizeof(struct sadb_lifetime)); + lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; @@ -885,8 +883,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, lifetime->sadb_lifetime_usetime = x->lft.soft_use_expires_seconds; } /* current time */ - lifetime = (struct sadb_lifetime *) skb_put(skb, - sizeof(struct sadb_lifetime)); + lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT; @@ -895,8 +892,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, lifetime->sadb_lifetime_addtime = x->curlft.add_time; lifetime->sadb_lifetime_usetime = x->curlft.use_time; /* src address */ - addr = (struct sadb_address*) skb_put(skb, - sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -915,8 +911,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, BUG(); /* dst address */ - addr = (struct sadb_address*) skb_put(skb, - sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -933,8 +928,8 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, if (!xfrm_addr_equal(&x->sel.saddr, &x->props.saddr, x->props.family)) { - addr = (struct sadb_address*) skb_put(skb, - sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, + sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -951,8 +946,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, /* auth key */ if (add_keys && auth_key_size) { - key = (struct sadb_key *) skb_put(skb, - sizeof(struct sadb_key)+auth_key_size); + key = skb_put(skb, sizeof(struct sadb_key) + auth_key_size); key->sadb_key_len = (sizeof(struct sadb_key) + auth_key_size) / sizeof(uint64_t); key->sadb_key_exttype = SADB_EXT_KEY_AUTH; @@ -962,8 +956,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, } /* encrypt key */ if (add_keys && encrypt_key_size) { - key = (struct sadb_key *) skb_put(skb, - sizeof(struct sadb_key)+encrypt_key_size); + key = skb_put(skb, sizeof(struct sadb_key) + encrypt_key_size); key->sadb_key_len = (sizeof(struct sadb_key) + encrypt_key_size) / sizeof(uint64_t); key->sadb_key_exttype = SADB_EXT_KEY_ENCRYPT; @@ -974,7 +967,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, } /* sa */ - sa2 = (struct sadb_x_sa2 *) skb_put(skb, sizeof(struct sadb_x_sa2)); + sa2 = skb_put(skb, sizeof(struct sadb_x_sa2)); sa2->sadb_x_sa2_len = sizeof(struct sadb_x_sa2)/sizeof(uint64_t); sa2->sadb_x_sa2_exttype = SADB_X_EXT_SA2; if ((mode = pfkey_mode_from_xfrm(x->props.mode)) < 0) { @@ -992,7 +985,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, struct sadb_x_nat_t_port *n_port; /* type */ - n_type = (struct sadb_x_nat_t_type*) skb_put(skb, sizeof(*n_type)); + n_type = skb_put(skb, sizeof(*n_type)); n_type->sadb_x_nat_t_type_len = sizeof(*n_type)/sizeof(uint64_t); n_type->sadb_x_nat_t_type_exttype = SADB_X_EXT_NAT_T_TYPE; n_type->sadb_x_nat_t_type_type = natt->encap_type; @@ -1001,14 +994,14 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, n_type->sadb_x_nat_t_type_reserved[2] = 0; /* source port */ - n_port = (struct sadb_x_nat_t_port*) skb_put(skb, sizeof (*n_port)); + n_port = skb_put(skb, sizeof(*n_port)); n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT; n_port->sadb_x_nat_t_port_port = natt->encap_sport; n_port->sadb_x_nat_t_port_reserved = 0; /* dest port */ - n_port = (struct sadb_x_nat_t_port*) skb_put(skb, sizeof (*n_port)); + n_port = skb_put(skb, sizeof(*n_port)); n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT; n_port->sadb_x_nat_t_port_port = natt->encap_dport; @@ -1017,8 +1010,8 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, /* security context */ if (xfrm_ctx) { - sec_ctx = (struct sadb_x_sec_ctx *) skb_put(skb, - sizeof(struct sadb_x_sec_ctx) + ctx_size); + sec_ctx = skb_put(skb, + sizeof(struct sadb_x_sec_ctx) + ctx_size); sec_ctx->sadb_x_sec_len = (sizeof(struct sadb_x_sec_ctx) + ctx_size) / sizeof(uint64_t); sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; @@ -1617,7 +1610,7 @@ static struct sk_buff *compose_sadb_supported(const struct sadb_msg *orig, if (!skb) goto out_put_algs; - hdr = (struct sadb_msg *) skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); pfkey_hdr_dup(hdr, orig); hdr->sadb_msg_errno = 0; hdr->sadb_msg_len = len / sizeof(uint64_t); @@ -1626,7 +1619,7 @@ static struct sk_buff *compose_sadb_supported(const struct sadb_msg *orig, struct sadb_supported *sp; struct sadb_alg *ap; - sp = (struct sadb_supported *) skb_put(skb, auth_len); + sp = skb_put(skb, auth_len); ap = (struct sadb_alg *) (sp + 1); sp->sadb_supported_len = auth_len / sizeof(uint64_t); @@ -1647,7 +1640,7 @@ static struct sk_buff *compose_sadb_supported(const struct sadb_msg *orig, struct sadb_supported *sp; struct sadb_alg *ap; - sp = (struct sadb_supported *) skb_put(skb, enc_len); + sp = skb_put(skb, enc_len); ap = (struct sadb_alg *) (sp + 1); sp->sadb_supported_len = enc_len / sizeof(uint64_t); @@ -1721,7 +1714,7 @@ static int key_notify_sa_flush(const struct km_event *c) skb = alloc_skb(sizeof(struct sadb_msg) + 16, GFP_ATOMIC); if (!skb) return -ENOBUFS; - hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); + hdr = skb_put(skb, sizeof(struct sadb_msg)); hdr->sadb_msg_satype = pfkey_proto2satype(c->data.proto); hdr->sadb_msg_type = SADB_FLUSH; hdr->sadb_msg_seq = c->seq; @@ -2046,12 +2039,11 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * size = pfkey_xfrm_policy2msg_size(xp); /* call should fill header later */ - hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); + hdr = skb_put(skb, sizeof(struct sadb_msg)); memset(hdr, 0, size); /* XXX do we need this ? */ /* src address */ - addr = (struct sadb_address*) skb_put(skb, - sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -2066,8 +2058,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * BUG(); /* dst address */ - addr = (struct sadb_address*) skb_put(skb, - sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -2081,8 +2072,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * xp->family); /* hard time */ - lifetime = (struct sadb_lifetime *) skb_put(skb, - sizeof(struct sadb_lifetime)); + lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD; @@ -2091,8 +2081,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * lifetime->sadb_lifetime_addtime = xp->lft.hard_add_expires_seconds; lifetime->sadb_lifetime_usetime = xp->lft.hard_use_expires_seconds; /* soft time */ - lifetime = (struct sadb_lifetime *) skb_put(skb, - sizeof(struct sadb_lifetime)); + lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; @@ -2101,8 +2090,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * lifetime->sadb_lifetime_addtime = xp->lft.soft_add_expires_seconds; lifetime->sadb_lifetime_usetime = xp->lft.soft_use_expires_seconds; /* current time */ - lifetime = (struct sadb_lifetime *) skb_put(skb, - sizeof(struct sadb_lifetime)); + lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT; @@ -2111,7 +2099,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * lifetime->sadb_lifetime_addtime = xp->curlft.add_time; lifetime->sadb_lifetime_usetime = xp->curlft.use_time; - pol = (struct sadb_x_policy *) skb_put(skb, sizeof(struct sadb_x_policy)); + pol = skb_put(skb, sizeof(struct sadb_x_policy)); pol->sadb_x_policy_len = sizeof(struct sadb_x_policy)/sizeof(uint64_t); pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; pol->sadb_x_policy_type = IPSEC_POLICY_DISCARD; @@ -2139,7 +2127,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * } else { size -= 2*socklen; } - rq = (void*)skb_put(skb, req_size); + rq = skb_put(skb, req_size); pol->sadb_x_policy_len += req_size/8; memset(rq, 0, sizeof(*rq)); rq->sadb_x_ipsecrequest_len = req_size; @@ -2169,7 +2157,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * if ((xfrm_ctx = xp->security)) { int ctx_size = pfkey_xfrm_policy2sec_ctx_size(xp); - sec_ctx = (struct sadb_x_sec_ctx *) skb_put(skb, ctx_size); + sec_ctx = skb_put(skb, ctx_size); sec_ctx->sadb_x_sec_len = ctx_size / sizeof(uint64_t); sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; sec_ctx->sadb_x_ctx_doi = xfrm_ctx->ctx_doi; @@ -2733,7 +2721,7 @@ static int key_notify_policy_flush(const struct km_event *c) skb_out = alloc_skb(sizeof(struct sadb_msg) + 16, GFP_ATOMIC); if (!skb_out) return -ENOBUFS; - hdr = (struct sadb_msg *) skb_put(skb_out, sizeof(struct sadb_msg)); + hdr = skb_put(skb_out, sizeof(struct sadb_msg)); hdr->sadb_msg_type = SADB_X_SPDFLUSH; hdr->sadb_msg_seq = c->seq; hdr->sadb_msg_pid = c->portid; @@ -2917,7 +2905,7 @@ static void dump_ah_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) struct sadb_prop *p; int i; - p = (struct sadb_prop*)skb_put(skb, sizeof(struct sadb_prop)); + p = skb_put(skb, sizeof(struct sadb_prop)); p->sadb_prop_len = sizeof(struct sadb_prop)/8; p->sadb_prop_exttype = SADB_EXT_PROPOSAL; p->sadb_prop_replay = 32; @@ -2951,7 +2939,7 @@ static void dump_esp_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) struct sadb_prop *p; int i, k; - p = (struct sadb_prop*)skb_put(skb, sizeof(struct sadb_prop)); + p = skb_put(skb, sizeof(struct sadb_prop)); p->sadb_prop_len = sizeof(struct sadb_prop)/8; p->sadb_prop_exttype = SADB_EXT_PROPOSAL; p->sadb_prop_replay = 32; @@ -2977,7 +2965,7 @@ static void dump_esp_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) continue; if (!(aalg_tmpl_set(t, aalg) && aalg->available)) continue; - c = (struct sadb_comb*)skb_put(skb, sizeof(struct sadb_comb)); + c = skb_put(skb, sizeof(struct sadb_comb)); memset(c, 0, sizeof(*c)); p->sadb_prop_len += sizeof(struct sadb_comb)/8; c->sadb_comb_auth = aalg->desc.sadb_alg_id; @@ -3144,7 +3132,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct if (skb == NULL) return -ENOMEM; - hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); + hdr = skb_put(skb, sizeof(struct sadb_msg)); hdr->sadb_msg_version = PF_KEY_V2; hdr->sadb_msg_type = SADB_ACQUIRE; hdr->sadb_msg_satype = pfkey_proto2satype(x->id.proto); @@ -3155,8 +3143,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct hdr->sadb_msg_pid = 0; /* src address */ - addr = (struct sadb_address*) skb_put(skb, - sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -3171,8 +3158,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct BUG(); /* dst address */ - addr = (struct sadb_address*) skb_put(skb, - sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -3186,7 +3172,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct if (!addr->sadb_address_prefixlen) BUG(); - pol = (struct sadb_x_policy *) skb_put(skb, sizeof(struct sadb_x_policy)); + pol = skb_put(skb, sizeof(struct sadb_x_policy)); pol->sadb_x_policy_len = sizeof(struct sadb_x_policy)/sizeof(uint64_t); pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; @@ -3203,8 +3189,8 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct /* security context */ if (xfrm_ctx) { - sec_ctx = (struct sadb_x_sec_ctx *) skb_put(skb, - sizeof(struct sadb_x_sec_ctx) + ctx_size); + sec_ctx = skb_put(skb, + sizeof(struct sadb_x_sec_ctx) + ctx_size); sec_ctx->sadb_x_sec_len = (sizeof(struct sadb_x_sec_ctx) + ctx_size) / sizeof(uint64_t); sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; @@ -3346,7 +3332,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, if (skb == NULL) return -ENOMEM; - hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); + hdr = skb_put(skb, sizeof(struct sadb_msg)); hdr->sadb_msg_version = PF_KEY_V2; hdr->sadb_msg_type = SADB_X_NAT_T_NEW_MAPPING; hdr->sadb_msg_satype = satype; @@ -3357,7 +3343,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, hdr->sadb_msg_pid = 0; /* SA */ - sa = (struct sadb_sa *) skb_put(skb, sizeof(struct sadb_sa)); + sa = skb_put(skb, sizeof(struct sadb_sa)); sa->sadb_sa_len = sizeof(struct sadb_sa)/sizeof(uint64_t); sa->sadb_sa_exttype = SADB_EXT_SA; sa->sadb_sa_spi = x->id.spi; @@ -3368,8 +3354,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, sa->sadb_sa_flags = 0; /* ADDRESS_SRC (old addr) */ - addr = (struct sadb_address*) - skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -3384,15 +3369,14 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, BUG(); /* NAT_T_SPORT (old port) */ - n_port = (struct sadb_x_nat_t_port*) skb_put(skb, sizeof (*n_port)); + n_port = skb_put(skb, sizeof(*n_port)); n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT; n_port->sadb_x_nat_t_port_port = natt->encap_sport; n_port->sadb_x_nat_t_port_reserved = 0; /* ADDRESS_DST (new addr) */ - addr = (struct sadb_address*) - skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); + addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); @@ -3407,7 +3391,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, BUG(); /* NAT_T_DPORT (new port) */ - n_port = (struct sadb_x_nat_t_port*) skb_put(skb, sizeof (*n_port)); + n_port = skb_put(skb, sizeof(*n_port)); n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT; n_port->sadb_x_nat_t_port_port = sport; @@ -3421,7 +3405,7 @@ static int set_sadb_address(struct sk_buff *skb, int sasize, int type, const struct xfrm_selector *sel) { struct sadb_address *addr; - addr = (struct sadb_address *)skb_put(skb, sizeof(struct sadb_address) + sasize); + addr = skb_put(skb, sizeof(struct sadb_address) + sasize); addr->sadb_address_len = (sizeof(struct sadb_address) + sasize)/8; addr->sadb_address_exttype = type; addr->sadb_address_proto = sel->proto; @@ -3553,7 +3537,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, if (skb == NULL) return -ENOMEM; - hdr = (struct sadb_msg *)skb_put(skb, sizeof(struct sadb_msg)); + hdr = skb_put(skb, sizeof(struct sadb_msg)); hdr->sadb_msg_version = PF_KEY_V2; hdr->sadb_msg_type = SADB_X_MIGRATE; hdr->sadb_msg_satype = pfkey_proto2satype(m->proto); @@ -3574,7 +3558,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_DST, sel); /* policy information */ - pol = (struct sadb_x_policy *)skb_put(skb, sizeof(struct sadb_x_policy)); + pol = skb_put(skb, sizeof(struct sadb_x_policy)); pol->sadb_x_policy_len = size_pol / 8; pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index f9eb2486d550..a354f1939e49 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1107,7 +1107,7 @@ static void ieee80211_send_layer2_update(struct sta_info *sta) skb = dev_alloc_skb(sizeof(*msg)); if (!skb) return; - msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); + msg = skb_put(skb, sizeof(*msg)); /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ @@ -3414,7 +3414,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev, skb_reserve(skb, local->hw.extra_tx_headroom); - nullfunc = (void *) skb_put(skb, size); + nullfunc = skb_put(skb, size); nullfunc->frame_control = fc; nullfunc->duration_id = 0; memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 927215d4dd8f..c92df492e898 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c @@ -459,7 +459,7 @@ int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, return -ENOMEM; skb_reserve(skb, local->hw.extra_tx_headroom); - action_frame = (void *)skb_put(skb, 27); + action_frame = skb_put(skb, 27); memcpy(action_frame->da, da, ETH_ALEN); memcpy(action_frame->sa, sdata->dev->dev_addr, ETH_ALEN); memcpy(action_frame->bssid, bssid, ETH_ALEN); diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 861697f2d75b..a550c707cd8a 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -1265,7 +1265,7 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata, if (!skb) return -ENOMEM; skb_reserve(skb, local->tx_headroom); - mgmt_fwd = (struct ieee80211_mgmt *) skb_put(skb, len); + mgmt_fwd = skb_put(skb, len); /* offset_ttl is based on whether the secondary channel * offset is available or not. Subtract 1 from the mesh TTL diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c index 96c987e641b3..d8cd91424175 100644 --- a/net/mac80211/mesh_ps.c +++ b/net/mac80211/mesh_ps.c @@ -30,7 +30,7 @@ static struct sk_buff *mps_qos_null_get(struct sta_info *sta) return NULL; skb_reserve(skb, local->hw.extra_tx_headroom); - nullfunc = (struct ieee80211_hdr *) skb_put(skb, size); + nullfunc = skb_put(skb, size); fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); ieee80211_fill_mesh_addresses(nullfunc, &fc, sta->sta.addr, sdata->vif.addr); diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 46e1809356f6..69615016d5bf 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1312,7 +1312,7 @@ static void ieee80211_send_null_response(struct sta_info *sta, int tid, skb_reserve(skb, local->hw.extra_tx_headroom); - nullfunc = (void *) skb_put(skb, size); + nullfunc = skb_put(skb, size); nullfunc->frame_control = fc; nullfunc->duration_id = 0; memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index 86740670102d..709ef02fe67e 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -49,7 +49,7 @@ static void ieee80211_tdls_add_ext_capab(struct ieee80211_sub_if_data *sdata, !ifmgd->tdls_wider_bw_prohibited; struct ieee80211_supported_band *sband = ieee80211_get_sband(sdata); bool vht = sband && sband->vht_cap.vht_supported; - u8 *pos = (void *)skb_put(skb, 10); + u8 *pos = skb_put(skb, 10); *pos++ = WLAN_EID_EXT_CAPABILITY; *pos++ = 8; /* len */ @@ -168,7 +168,7 @@ static void ieee80211_tdls_add_oper_classes(struct ieee80211_sub_if_data *sdata, static void ieee80211_tdls_add_bss_coex_ie(struct sk_buff *skb) { - u8 *pos = (void *)skb_put(skb, 3); + u8 *pos = skb_put(skb, 3); *pos++ = WLAN_EID_BSS_COEX_2040; *pos++ = 1; /* len */ @@ -209,7 +209,7 @@ static void ieee80211_tdls_add_link_ie(struct ieee80211_sub_if_data *sdata, rsp_addr = sdata->vif.addr; } - lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); + lnkid = skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); lnkid->ie_type = WLAN_EID_LINK_ID; lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; @@ -223,7 +223,7 @@ static void ieee80211_tdls_add_aid(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) { struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - u8 *pos = (void *)skb_put(skb, 4); + u8 *pos = skb_put(skb, 4); *pos++ = WLAN_EID_AID; *pos++ = 2; /* len */ @@ -745,7 +745,7 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_tdls_data *tf; - tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); + tf = skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); memcpy(tf->da, peer, ETH_ALEN); memcpy(tf->sa, sdata->vif.addr, ETH_ALEN); diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 18c5d6e6305d..ec5a9a72797e 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3874,7 +3874,7 @@ static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, ps->dtim_count--; } - tim = pos = (u8 *) skb_put(skb, 6); + tim = pos = skb_put(skb, 6); *pos++ = WLAN_EID_TIM; *pos++ = 4; *pos++ = ps->dtim_count; diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index cc19614ff4e6..0d722ea98a1b 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c @@ -949,7 +949,7 @@ ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx) if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) return TX_DROP; - mmie = (struct ieee80211_mmie *) skb_put(skb, sizeof(*mmie)); + mmie = skb_put(skb, sizeof(*mmie)); mmie->element_id = WLAN_EID_MMIE; mmie->length = sizeof(*mmie) - 2; mmie->key_id = cpu_to_le16(key->conf.keyidx); @@ -993,7 +993,7 @@ ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx) if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) return TX_DROP; - mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie)); + mmie = skb_put(skb, sizeof(*mmie)); mmie->element_id = WLAN_EID_MMIE; mmie->length = sizeof(*mmie) - 2; mmie->key_id = cpu_to_le16(key->conf.keyidx); @@ -1138,7 +1138,7 @@ ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx) if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) return TX_DROP; - mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie)); + mmie = skb_put(skb, sizeof(*mmie)); mmie->element_id = WLAN_EID_MMIE; mmie->length = sizeof(*mmie) - 2; mmie->key_id = cpu_to_le16(key->conf.keyidx); diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index da9704971a83..94ec0d0765a8 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -590,7 +590,7 @@ __build_packet_message(struct nfnl_log_net *log, if (skb_tailroom(inst->skb) < nla_total_size(data_len)) goto nla_put_failure; - nla = (struct nlattr *)skb_put(inst->skb, nla_total_size(data_len)); + nla = skb_put(inst->skb, nla_total_size(data_len)); nla->nla_type = NFULA_PAYLOAD; nla->nla_len = size; diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 8a0f218b7938..1b17a1b445a3 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c @@ -589,7 +589,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, if (skb_tailroom(skb) < sizeof(*nla) + hlen) goto nla_put_failure; - nla = (struct nlattr *)skb_put(skb, sizeof(*nla)); + nla = skb_put(skb, sizeof(*nla)); nla->nla_type = NFQA_PAYLOAD; nla->nla_len = nla_attr_size(data_len); diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index bd24a975fd49..a88745e4b7df 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -2104,7 +2104,7 @@ __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int fla struct nlmsghdr *nlh; int size = nlmsg_msg_size(len); - nlh = (struct nlmsghdr *)skb_put(skb, NLMSG_ALIGN(size)); + nlh = skb_put(skb, NLMSG_ALIGN(size)); nlh->nlmsg_type = type; nlh->nlmsg_len = size; nlh->nlmsg_flags = flags; diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c index 0fd5518bf252..fec47a7d0092 100644 --- a/net/nfc/digital_core.c +++ b/net/nfc/digital_core.c @@ -74,8 +74,8 @@ void digital_skb_add_crc(struct sk_buff *skb, crc_func_t crc_func, u16 init, if (msb_first) crc = __fswab16(crc); - *skb_put(skb, 1) = crc & 0xFF; - *skb_put(skb, 1) = (crc >> 8) & 0xFF; + *(u8 *)skb_put(skb, 1) = crc & 0xFF; + *(u8 *)skb_put(skb, 1) = (crc >> 8) & 0xFF; } int digital_skb_check_crc(struct sk_buff *skb, crc_func_t crc_func, diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c index f44f75a2a4d5..82471af5553e 100644 --- a/net/nfc/digital_dep.c +++ b/net/nfc/digital_dep.c @@ -654,7 +654,7 @@ static int digital_in_send_rtox(struct nfc_digital_dev *ddev, if (!skb) return -ENOMEM; - *skb_put(skb, 1) = rtox; + *(u8 *)skb_put(skb, 1) = rtox; skb_push(skb, sizeof(struct digital_dep_req_res)); diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c index d9080dec5d27..fae6d31b377c 100644 --- a/net/nfc/digital_technology.c +++ b/net/nfc/digital_technology.c @@ -266,8 +266,8 @@ static int digital_in_send_rats(struct nfc_digital_dev *ddev, if (!skb) return -ENOMEM; - *skb_put(skb, 1) = DIGITAL_RATS_BYTE1; - *skb_put(skb, 1) = DIGITAL_RATS_PARAM; + *(u8 *)skb_put(skb, 1) = DIGITAL_RATS_BYTE1; + *(u8 *)skb_put(skb, 1) = DIGITAL_RATS_PARAM; rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_ats, target); @@ -470,8 +470,8 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev, else sel_cmd = DIGITAL_CMD_SEL_REQ_CL3; - *skb_put(skb, sizeof(u8)) = sel_cmd; - *skb_put(skb, sizeof(u8)) = DIGITAL_SDD_REQ_SEL_PAR; + *(u8 *)skb_put(skb, sizeof(u8)) = sel_cmd; + *(u8 *)skb_put(skb, sizeof(u8)) = DIGITAL_SDD_REQ_SEL_PAR; return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, target); @@ -541,7 +541,7 @@ int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech) if (!skb) return -ENOMEM; - *skb_put(skb, sizeof(u8)) = DIGITAL_CMD_SENS_REQ; + *(u8 *)skb_put(skb, sizeof(u8)) = DIGITAL_CMD_SENS_REQ; rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sens_res, NULL); if (rc) @@ -625,8 +625,7 @@ static int digital_in_send_attrib_req(struct nfc_digital_dev *ddev, if (!skb) return -ENOMEM; - attrib_req = (struct digital_attrib_req *)skb_put(skb, - sizeof(*attrib_req)); + attrib_req = skb_put(skb, sizeof(*attrib_req)); attrib_req->cmd = DIGITAL_CMD_ATTRIB_REQ; memcpy(attrib_req->nfcid0, sensb_res->nfcid0, @@ -730,8 +729,7 @@ int digital_in_send_sensb_req(struct nfc_digital_dev *ddev, u8 rf_tech) if (!skb) return -ENOMEM; - sensb_req = (struct digital_sensb_req *)skb_put(skb, - sizeof(*sensb_req)); + sensb_req = skb_put(skb, sizeof(*sensb_req)); sensb_req->cmd = DIGITAL_CMD_SENSB_REQ; sensb_req->afi = 0x00; /* All families and sub-families */ @@ -939,7 +937,7 @@ static int digital_tg_send_sel_res(struct nfc_digital_dev *ddev) if (!skb) return -ENOMEM; - *skb_put(skb, 1) = DIGITAL_SEL_RES_NFC_DEP; + *(u8 *)skb_put(skb, 1) = DIGITAL_SEL_RES_NFC_DEP; if (!DIGITAL_DRV_CAPS_TG_CRC(ddev)) digital_skb_add_crc_a(skb); diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 8741ad47a6fb..3a0c94590411 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c @@ -874,7 +874,7 @@ static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb) return; } - *skb_put(hcp_skb, NFC_HCI_HCP_PACKET_HEADER_LEN) = pipe; + *(u8 *)skb_put(hcp_skb, NFC_HCI_HCP_PACKET_HEADER_LEN) = pipe; skb_queue_walk(&hdev->rx_hcp_frags, frag_skb) { msg_len = frag_skb->len - NFC_HCI_HCP_PACKET_HEADER_LEN; diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c index 401c7e255273..9ab4a05f086f 100644 --- a/net/nfc/hci/llc_shdlc.c +++ b/net/nfc/hci/llc_shdlc.c @@ -382,8 +382,8 @@ static int llc_shdlc_connect_initiate(struct llc_shdlc *shdlc) if (skb == NULL) return -ENOMEM; - *skb_put(skb, 1) = SHDLC_MAX_WINDOW; - *skb_put(skb, 1) = SHDLC_SREJ_SUPPORT ? 1 : 0; + *(u8 *)skb_put(skb, 1) = SHDLC_MAX_WINDOW; + *(u8 *)skb_put(skb, 1) = SHDLC_SREJ_SUPPORT ? 1 : 0; return llc_shdlc_send_u_frame(shdlc, skb, U_FRAME_RSET); } diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 17b9f1ce23db..a3dac34cf790 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -1341,7 +1341,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload) return -ENOMEM; } - hdr = (struct nci_ctrl_hdr *) skb_put(skb, NCI_CTRL_HDR_SIZE); + hdr = skb_put(skb, NCI_CTRL_HDR_SIZE); hdr->gid = nci_opcode_gid(opcode); hdr->oid = nci_opcode_oid(opcode); hdr->plen = plen; diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c index d4a53ce818c3..d1119bb35f24 100644 --- a/net/nfc/nci/hci.c +++ b/net/nfc/nci/hci.c @@ -472,7 +472,7 @@ void nci_hci_data_received_cb(void *context, return; } - *skb_put(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN) = pipe; + *(u8 *)skb_put(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN) = pipe; skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { msg_len = frag_skb->len - NCI_HCI_HCP_PACKET_HEADER_LEN; diff --git a/net/nfc/nci/spi.c b/net/nfc/nci/spi.c index d904cd2f1442..a502a334918a 100644 --- a/net/nfc/nci/spi.c +++ b/net/nfc/nci/spi.c @@ -86,8 +86,8 @@ int nci_spi_send(struct nci_spi *nspi, u16 crc; crc = crc_ccitt(CRC_INIT, skb->data, skb->len); - *skb_put(skb, 1) = crc >> 8; - *skb_put(skb, 1) = crc & 0xFF; + *(u8 *)skb_put(skb, 1) = crc >> 8; + *(u8 *)skb_put(skb, 1) = crc & 0xFF; } if (write_handshake_completion) { @@ -172,8 +172,8 @@ static int send_acknowledge(struct nci_spi *nspi, u8 acknowledge) hdr[3] = 0; crc = crc_ccitt(CRC_INIT, skb->data, skb->len); - *skb_put(skb, 1) = crc >> 8; - *skb_put(skb, 1) = crc & 0xFF; + *(u8 *)skb_put(skb, 1) = crc >> 8; + *(u8 *)skb_put(skb, 1) = crc & 0xFF; ret = __nci_spi_send(nspi, skb, 0); diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c index cfa7f352c1c3..442f8eadfc76 100644 --- a/net/nfc/nci/uart.c +++ b/net/nfc/nci/uart.c @@ -355,7 +355,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data, /* Eat byte after byte till full packet header is received */ if (nu->rx_skb->len < NCI_CTRL_HDR_SIZE) { - *skb_put(nu->rx_skb, 1) = *data++; + *(u8 *)skb_put(nu->rx_skb, 1) = *data++; --count; continue; } diff --git a/net/psample/psample.c b/net/psample/psample.c index 8aa58a918783..3a6ad0f438dc 100644 --- a/net/psample/psample.c +++ b/net/psample/psample.c @@ -264,7 +264,7 @@ void psample_sample_packet(struct psample_group *group, struct sk_buff *skb, int nla_len = nla_total_size(data_len); struct nlattr *nla; - nla = (struct nlattr *)skb_put(nl_skb, nla_len); + nla = skb_put(nl_skb, nla_len); nla->nla_type = PSAMPLE_ATTR_DATA; nla->nla_len = nla_attr_size(data_len); diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index cff679167bdc..5586609afa27 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -259,7 +259,7 @@ static struct sk_buff *qrtr_alloc_ctrl_packet(u32 type, size_t pkt_len, return NULL; skb_reset_transport_header(skb); - hdr = (struct qrtr_hdr *)skb_put(skb, QRTR_HDR_SIZE); + hdr = skb_put(skb, QRTR_HDR_SIZE); hdr->version = cpu_to_le32(QRTR_PROTO_VER); hdr->type = cpu_to_le32(type); hdr->src_node_id = cpu_to_le32(src_node); diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 034e916362cf..2c196b3e9cd3 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -1389,7 +1389,7 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, goto nodata; /* Make room for the chunk header. */ - chunk_hdr = (sctp_chunkhdr_t *)skb_put(skb, sizeof(sctp_chunkhdr_t)); + chunk_hdr = skb_put(skb, sizeof(sctp_chunkhdr_t)); chunk_hdr->type = type; chunk_hdr->flags = flags; chunk_hdr->length = htons(sizeof(sctp_chunkhdr_t)); diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index ec2b3e013c2f..e361f0b57fb6 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c @@ -167,8 +167,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( goto fail; skb = sctp_event2skb(event); - sac = (struct sctp_assoc_change *) skb_put(skb, - sizeof(struct sctp_assoc_change)); + sac = skb_put(skb, sizeof(struct sctp_assoc_change)); } /* Socket Extensions for SCTP @@ -270,8 +269,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( goto fail; skb = sctp_event2skb(event); - spc = (struct sctp_paddr_change *) - skb_put(skb, sizeof(struct sctp_paddr_change)); + spc = skb_put(skb, sizeof(struct sctp_paddr_change)); /* Sockets API Extensions for SCTP * Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE @@ -549,8 +547,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( goto fail; skb = sctp_event2skb(event); - sse = (struct sctp_shutdown_event *) - skb_put(skb, sizeof(struct sctp_shutdown_event)); + sse = skb_put(skb, sizeof(struct sctp_shutdown_event)); /* Socket Extensions for SCTP * 5.3.1.5 SCTP_SHUTDOWN_EVENT @@ -612,8 +609,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_adaptation_indication( goto fail; skb = sctp_event2skb(event); - sai = (struct sctp_adaptation_event *) - skb_put(skb, sizeof(struct sctp_adaptation_event)); + sai = skb_put(skb, sizeof(struct sctp_adaptation_event)); sai->sai_type = SCTP_ADAPTATION_INDICATION; sai->sai_flags = 0; @@ -751,8 +747,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_pdapi( goto fail; skb = sctp_event2skb(event); - pd = (struct sctp_pdapi_event *) - skb_put(skb, sizeof(struct sctp_pdapi_event)); + pd = skb_put(skb, sizeof(struct sctp_pdapi_event)); /* pdapi_type * It should be SCTP_PARTIAL_DELIVERY_EVENT @@ -803,8 +798,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey( goto fail; skb = sctp_event2skb(event); - ak = (struct sctp_authkey_event *) - skb_put(skb, sizeof(struct sctp_authkey_event)); + ak = skb_put(skb, sizeof(struct sctp_authkey_event)); ak->auth_type = SCTP_AUTHENTICATION_EVENT; ak->auth_flags = 0; @@ -842,8 +836,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event( return NULL; skb = sctp_event2skb(event); - sdry = (struct sctp_sender_dry_event *) - skb_put(skb, sizeof(struct sctp_sender_dry_event)); + sdry = skb_put(skb, sizeof(struct sctp_sender_dry_event)); sdry->sender_dry_type = SCTP_SENDER_DRY_EVENT; sdry->sender_dry_flags = 0; @@ -869,7 +862,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( return NULL; skb = sctp_event2skb(event); - sreset = (struct sctp_stream_reset_event *)skb_put(skb, length); + sreset = skb_put(skb, length); sreset->strreset_type = SCTP_STREAM_RESET_EVENT; sreset->strreset_flags = flags; @@ -897,8 +890,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event( return NULL; skb = sctp_event2skb(event); - areset = (struct sctp_assoc_reset_event *) - skb_put(skb, sizeof(struct sctp_assoc_reset_event)); + areset = skb_put(skb, sizeof(struct sctp_assoc_reset_event)); areset->assocreset_type = SCTP_ASSOC_RESET_EVENT; areset->assocreset_flags = flags; @@ -925,8 +917,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_change_event( return NULL; skb = sctp_event2skb(event); - schange = (struct sctp_stream_change_event *) - skb_put(skb, sizeof(struct sctp_stream_change_event)); + schange = skb_put(skb, sizeof(struct sctp_stream_change_event)); schange->strchange_type = SCTP_STREAM_CHANGE_EVENT; schange->strchange_flags = flags; diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 24e2054bfbaf..7d6ee03f2762 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -99,7 +99,7 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque) if (!skb) return NULL; - hdr = (struct af_vsockmon_hdr *)skb_put(skb, sizeof(*hdr)); + hdr = skb_put(skb, sizeof(*hdr)); /* pkt->hdr is little-endian so no need to byteswap here */ hdr->src_cid = pkt->hdr.src_cid; -- cgit v1.2.3-55-g7522 From d58ff35122847a83ba55394e2ae3a1527b6febf5 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 16 Jun 2017 14:29:23 +0200 Subject: networking: make skb_push & __skb_push return void pointers It seems like a historic accident that these return unsigned char *, and in many places that means casts are required, more often than not. Make these functions return void * and remove all the casts across the tree, adding a (u8 *) cast only where the unsigned char pointer was used directly, all done with the following spatch: @@ expression SKB, LEN; typedef u8; identifier fn = { skb_push, __skb_push, skb_push_rcsum }; @@ - *(fn(SKB, LEN)) + *(u8 *)fn(SKB, LEN) @@ expression E, SKB, LEN; identifier fn = { skb_push, __skb_push, skb_push_rcsum }; type T; @@ - E = ((T *)(fn(SKB, LEN))) + E = fn(SKB, LEN) @@ expression SKB, LEN; identifier fn = { skb_push, __skb_push, skb_push_rcsum }; @@ - fn(SKB, LEN)[0] + *(u8 *)fn(SKB, LEN) Note that the last part there converts from push(...)[0] to the more idiomatic *(u8 *)push(...). Signed-off-by: Johannes Berg Signed-off-by: David S. Miller --- drivers/atm/solos-pci.c | 2 +- drivers/bluetooth/bpa10x.c | 2 +- drivers/firewire/net.c | 8 +++--- drivers/infiniband/hw/cxgb3/iwch_cm.c | 6 ++--- drivers/infiniband/hw/cxgb4/cm.c | 2 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 4 +-- drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c | 2 +- drivers/infiniband/ulp/opa_vnic/opa_vnic_netdev.c | 2 +- drivers/isdn/i4l/isdn_ppp.c | 2 +- drivers/net/arcnet/arc-rawmode.c | 2 +- drivers/net/arcnet/capmode.c | 2 +- drivers/net/arcnet/rfc1051.c | 2 +- drivers/net/arcnet/rfc1201.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- drivers/net/ethernet/chelsio/cxgb/sge.c | 4 +-- drivers/net/ethernet/freescale/gianfar.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_selftest.c | 2 +- drivers/net/ethernet/sun/niu.c | 2 +- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 2 +- drivers/net/geneve.c | 3 +-- drivers/net/gtp.c | 4 +-- drivers/net/hippi/rrunner.c | 2 +- drivers/net/macsec.c | 2 +- drivers/net/ppp/ppp_async.c | 2 +- drivers/net/ppp/ppp_generic.c | 6 ++--- drivers/net/ppp/ppp_synctty.c | 2 +- drivers/net/ppp/pptp.c | 2 +- drivers/net/usb/gl620a.c | 2 +- drivers/net/usb/int51x1.c | 2 +- drivers/net/usb/kaweth.c | 2 +- drivers/net/usb/lg-vl600.c | 2 +- drivers/net/usb/net1080.c | 2 +- drivers/net/usb/qmi_wwan.c | 2 +- drivers/net/usb/rndis_host.c | 2 +- drivers/net/vrf.c | 2 +- drivers/net/vxlan.c | 2 +- drivers/net/wimax/i2400m/netdev.c | 2 +- drivers/net/wireless/admtek/adm8211.c | 2 +- drivers/net/wireless/ath/ar5523/ar5523.c | 4 +-- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 3 +-- drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +- drivers/net/wireless/ath/ath9k/htc_hst.c | 3 +-- drivers/net/wireless/ath/ath9k/wmi.c | 2 +- drivers/net/wireless/ath/carl9170/tx.c | 2 +- drivers/net/wireless/ath/wil6210/txrx.c | 2 +- .../net/wireless/intersil/hostap/hostap_80211_rx.c | 8 +++--- drivers/net/wireless/intersil/orinoco/main.c | 7 +++-- drivers/net/wireless/intersil/p54/txrx.c | 4 +-- drivers/net/wireless/intersil/prism54/islpci_eth.c | 5 +--- drivers/net/wireless/mac80211_hwsim.c | 4 +-- drivers/net/wireless/marvell/libertas/rx.c | 2 +- drivers/net/wireless/marvell/libertas_tf/main.c | 2 +- drivers/net/wireless/mediatek/mt7601u/tx.c | 2 +- drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c | 6 ++--- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- .../net/wireless/realtek/rtlwifi/rtl8192cu/trx.c | 2 +- drivers/net/wireless/st/cw1200/txrx.c | 2 +- drivers/net/wireless/ti/wl1251/tx.c | 3 +-- drivers/net/wireless/ti/wlcore/cmd.c | 2 +- drivers/net/wireless/ti/wlcore/tx.c | 3 +-- drivers/net/wireless/zydas/zd1211rw/zd_mac.c | 3 +-- drivers/nfc/fdp/i2c.c | 4 +-- drivers/nfc/microread/i2c.c | 2 +- drivers/nfc/microread/microread.c | 4 +-- drivers/nfc/nfcmrvl/main.c | 2 +- drivers/nfc/pn533/pn533.c | 8 +++--- drivers/nfc/pn544/i2c.c | 2 +- drivers/nfc/pn544/pn544.c | 8 +++--- drivers/nfc/st-nci/ndlc.c | 2 +- drivers/nfc/st21nfca/core.c | 6 ++--- drivers/nfc/st21nfca/dep.c | 30 +++++++++++----------- drivers/nfc/st21nfca/i2c.c | 4 +-- drivers/s390/net/qeth_l2_main.c | 3 +-- drivers/s390/net/qeth_l3_main.c | 6 ++--- drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 2 +- drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 2 +- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- drivers/scsi/fnic/fnic_fcs.c | 7 +++-- drivers/scsi/qedf/qedf_fip.c | 3 +-- drivers/staging/wilc1000/linux_mon.c | 6 ++--- drivers/staging/wlan-ng/p80211conv.c | 14 ++++------ drivers/target/iscsi/cxgbit/cxgbit_target.c | 5 ++-- drivers/usb/gadget/function/rndis.c | 2 +- include/linux/if_vlan.h | 2 +- include/linux/skbuff.h | 7 +++-- net/802/fc.c | 4 +-- net/802/fddi.c | 2 +- net/802/hippi.c | 2 +- net/8021q/vlan_dev.c | 2 +- net/appletalk/ddp.c | 2 +- net/ax25/af_ax25.c | 2 +- net/bluetooth/hci_sock.c | 12 ++++----- net/bluetooth/mgmt_util.c | 2 +- net/bluetooth/rfcomm/core.c | 4 +-- net/bridge/netfilter/nft_reject_bridge.c | 2 +- net/core/netpoll.c | 4 +-- net/core/pktgen.c | 6 ++--- net/core/skbuff.c | 2 +- net/dccp/options.c | 2 +- net/decnet/dn_dev.c | 4 +-- net/ethernet/eth.c | 2 +- net/ipv4/esp4.c | 2 +- net/ipv4/ip_gre.c | 2 +- net/ipv6/esp6.c | 2 +- net/ipv6/exthdrs.c | 6 ++--- net/ipv6/ip6_gre.c | 2 +- net/ipv6/ip6_output.c | 4 +-- net/ipv6/tcp_ipv6.c | 2 +- net/irda/irnet/irnet_irda.c | 2 +- net/iucv/af_iucv.c | 3 +-- net/mac80211/rx.c | 2 +- net/mac80211/status.c | 2 +- net/mac80211/tx.c | 4 +-- net/ncsi/ncsi-cmd.c | 2 +- net/nfc/digital_dep.c | 2 +- net/nfc/digital_technology.c | 4 +-- net/nfc/hci/core.c | 2 +- net/nfc/hci/llc_shdlc.c | 8 +++--- net/nfc/nci/data.c | 2 +- net/nfc/nci/hci.c | 4 +-- net/nfc/nci/spi.c | 4 +-- net/nfc/rawsock.c | 2 +- net/sctp/output.c | 2 +- net/sctp/sm_statefuns.c | 4 +-- net/sctp/ulpevent.c | 8 +++--- net/wireless/util.c | 2 +- 126 files changed, 204 insertions(+), 234 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 4fc99ae1c534..c8f2ca6d8b29 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c @@ -1174,7 +1174,7 @@ static int psend(struct atm_vcc *vcc, struct sk_buff *skb) } } - header = (void *)skb_push(skb, sizeof(*header)); + header = skb_push(skb, sizeof(*header)); /* This does _not_ include the size of the header */ header->size = cpu_to_le16(pktlen); diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index a9932fe57d92..48d10cb5c9a1 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c @@ -297,7 +297,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) return -ENOMEM; /* Prepend skb with frame type */ - *skb_push(skb, 1) = hci_skb_pkt_type(skb); + *(u8 *)skb_push(skb, 1) = hci_skb_pkt_type(skb); switch (hci_skb_pkt_type(skb)) { case HCI_COMMAND_PKT: diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index d5040bbd34e8..242359c2d1f1 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -219,7 +219,7 @@ static int fwnet_header_create(struct sk_buff *skb, struct net_device *net, { struct fwnet_header *h; - h = (struct fwnet_header *)skb_push(skb, sizeof(*h)); + h = skb_push(skb, sizeof(*h)); put_unaligned_be16(type, &h->h_proto); if (net->flags & (IFF_LOOPBACK | IFF_NOARP)) { @@ -961,16 +961,14 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask) tx_len = ptask->max_payload; switch (fwnet_get_hdr_lf(&ptask->hdr)) { case RFC2374_HDR_UNFRAG: - bufhdr = (struct rfc2734_header *) - skb_push(ptask->skb, RFC2374_UNFRAG_HDR_SIZE); + bufhdr = skb_push(ptask->skb, RFC2374_UNFRAG_HDR_SIZE); put_unaligned_be32(ptask->hdr.w0, &bufhdr->w0); break; case RFC2374_HDR_FIRSTFRAG: case RFC2374_HDR_INTFRAG: case RFC2374_HDR_LASTFRAG: - bufhdr = (struct rfc2734_header *) - skb_push(ptask->skb, RFC2374_FRAG_HDR_SIZE); + bufhdr = skb_push(ptask->skb, RFC2374_FRAG_HDR_SIZE); put_unaligned_be32(ptask->hdr.w0, &bufhdr->w0); put_unaligned_be32(ptask->hdr.w1, &bufhdr->w1); break; diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index 9ae518c01bc2..86975370a4c0 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c @@ -513,7 +513,7 @@ static void send_mpa_req(struct iwch_ep *ep, struct sk_buff *skb) set_arp_failure_handler(skb, arp_failure_discard); skb_reset_transport_header(skb); len = skb->len; - req = (struct tx_data_wr *) skb_push(skb, sizeof(*req)); + req = skb_push(skb, sizeof(*req)); req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA)|F_WR_COMPL); req->wr_lo = htonl(V_WR_TID(ep->hwtid)); req->len = htonl(len); @@ -564,7 +564,7 @@ static int send_mpa_reject(struct iwch_ep *ep, const void *pdata, u8 plen) skb->priority = CPL_PRIORITY_DATA; set_arp_failure_handler(skb, arp_failure_discard); skb_reset_transport_header(skb); - req = (struct tx_data_wr *) skb_push(skb, sizeof(*req)); + req = skb_push(skb, sizeof(*req)); req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA)|F_WR_COMPL); req->wr_lo = htonl(V_WR_TID(ep->hwtid)); req->len = htonl(mpalen); @@ -615,7 +615,7 @@ static int send_mpa_reply(struct iwch_ep *ep, const void *pdata, u8 plen) set_arp_failure_handler(skb, arp_failure_discard); skb_reset_transport_header(skb); len = skb->len; - req = (struct tx_data_wr *) skb_push(skb, sizeof(*req)); + req = skb_push(skb, sizeof(*req)); req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA)|F_WR_COMPL); req->wr_lo = htonl(V_WR_TID(ep->hwtid)); req->len = htonl(len); diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 36ae3023e703..76fb39415e18 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -3751,7 +3751,7 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos) tcp_clear_options(&tmp_opt); tcp_parse_options(&init_net, skb, &tmp_opt, 0, NULL); - req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req)); + req = __skb_push(skb, sizeof(*req)); memset(req, 0, sizeof(*req)); req->l2info = cpu_to_be16(SYN_INTF_V(intf) | SYN_MAC_IDX_V(RX_MACIDX_G( diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index a115c0b7a310..5da6f2e9f22e 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -681,7 +681,7 @@ static void push_pseudo_header(struct sk_buff *skb, const char *daddr) { struct ipoib_pseudo_header *phdr; - phdr = (struct ipoib_pseudo_header *)skb_push(skb, sizeof(*phdr)); + phdr = skb_push(skb, sizeof(*phdr)); memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN); } @@ -1129,7 +1129,7 @@ static int ipoib_hard_header(struct sk_buff *skb, { struct ipoib_header *header; - header = (struct ipoib_header *) skb_push(skb, sizeof *header); + header = skb_push(skb, sizeof *header); header->proto = htons(type); header->reserved = 0; diff --git a/drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c b/drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c index 2e8fee982436..afa938bd26d6 100644 --- a/drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c +++ b/drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c @@ -460,7 +460,7 @@ void opa_vnic_encap_skb(struct opa_vnic_adapter *adapter, struct sk_buff *skb) sc = opa_vnic_get_sc(info, skb); l4_hdr = info->vesw.vesw_id; - mdata = (struct opa_vnic_skb_mdata *)skb_push(skb, sizeof(*mdata)); + mdata = skb_push(skb, sizeof(*mdata)); mdata->vl = opa_vnic_get_vl(adapter, skb); mdata->entropy = entropy; mdata->flags = 0; diff --git a/drivers/infiniband/ulp/opa_vnic/opa_vnic_netdev.c b/drivers/infiniband/ulp/opa_vnic/opa_vnic_netdev.c index 905f39dda5aa..fcf75323d62a 100644 --- a/drivers/infiniband/ulp/opa_vnic/opa_vnic_netdev.c +++ b/drivers/infiniband/ulp/opa_vnic/opa_vnic_netdev.c @@ -103,7 +103,7 @@ static u16 opa_vnic_select_queue(struct net_device *netdev, struct sk_buff *skb, int rc; /* pass entropy and vl as metadata in skb */ - mdata = (struct opa_vnic_skb_mdata *)skb_push(skb, sizeof(*mdata)); + mdata = skb_push(skb, sizeof(*mdata)); mdata->entropy = opa_vnic_calc_entropy(adapter, skb); mdata->vl = opa_vnic_get_vl(adapter, skb); rc = adapter->rn_ops->ndo_select_queue(netdev, skb, diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index e26cae9baf17..b7e3f1cde683 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c @@ -1312,7 +1312,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) /* check if we should pass this packet * the filter instructions are constructed assuming * a four-byte PPP header on each packet */ - *skb_push(skb, 4) = 1; /* indicate outbound */ + *(u8 *)skb_push(skb, 4) = 1; /* indicate outbound */ { __be16 *p = (__be16 *)skb->data; diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c index d78f30186642..8c651fdee039 100644 --- a/drivers/net/arcnet/arc-rawmode.c +++ b/drivers/net/arcnet/arc-rawmode.c @@ -85,7 +85,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, uint8_t daddr) { int hdr_size = ARC_HDR_SIZE; - struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size); + struct archdr *pkt = skb_push(skb, hdr_size); /* Set the source hardware address. * diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index 2056878fb087..a80f4eb9262d 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c @@ -101,7 +101,7 @@ static int build_header(struct sk_buff *skb, uint8_t daddr) { int hdr_size = ARC_HDR_SIZE; - struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size); + struct archdr *pkt = skb_push(skb, hdr_size); arc_printk(D_PROTO, dev, "Preparing header for cap packet %x.\n", *((int *)&pkt->soft.cap.cookie[0])); diff --git a/drivers/net/arcnet/rfc1051.c b/drivers/net/arcnet/rfc1051.c index 4b1a75469cb1..a7752a5b647f 100644 --- a/drivers/net/arcnet/rfc1051.c +++ b/drivers/net/arcnet/rfc1051.c @@ -162,7 +162,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, uint8_t daddr) { int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE; - struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size); + struct archdr *pkt = skb_push(skb, hdr_size); struct arc_rfc1051 *soft = &pkt->soft.rfc1051; /* set the protocol ID according to RFC1051 */ diff --git a/drivers/net/arcnet/rfc1201.c b/drivers/net/arcnet/rfc1201.c index 566da5ecdc9d..a4c856282674 100644 --- a/drivers/net/arcnet/rfc1201.c +++ b/drivers/net/arcnet/rfc1201.c @@ -379,7 +379,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev, { struct arcnet_local *lp = netdev_priv(dev); int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE; - struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size); + struct archdr *pkt = skb_push(skb, hdr_size); struct arc_rfc1201 *soft = &pkt->soft.rfc1201; /* set the protocol ID according to RFC1201 */ diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 5274501428e4..5333601f855f 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -1099,7 +1099,7 @@ static struct sk_buff *bcm_sysport_insert_tsb(struct sk_buff *skb, skb = nskb; } - tsb = (struct bcm_tsb *)skb_push(skb, sizeof(*tsb)); + tsb = skb_push(skb, sizeof(*tsb)); /* Zero-out TSB by default */ memset(tsb, 0, sizeof(*tsb)); diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c index d56142b98534..0f13a7f7c1d3 100644 --- a/drivers/net/ethernet/chelsio/cxgb/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb/sge.c @@ -1801,7 +1801,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev) eth_type = skb_network_offset(skb) == ETH_HLEN ? CPL_ETH_II : CPL_ETH_II_VLAN; - hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr)); + hdr = skb_push(skb, sizeof(*hdr)); hdr->opcode = CPL_TX_PKT_LSO; hdr->ip_csum_dis = hdr->l4_csum_dis = 0; hdr->ip_hdr_words = ip_hdr(skb)->ihl; @@ -1849,7 +1849,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev) } } - cpl = (struct cpl_tx_pkt *)__skb_push(skb, sizeof(*cpl)); + cpl = __skb_push(skb, sizeof(*cpl)); cpl->opcode = CPL_TX_PKT; cpl->ip_csum_dis = 1; /* SW calculates IP csum */ cpl->l4_csum_dis = skb->ip_summed == CHECKSUM_PARTIAL ? 0 : 1; diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 0ff166ec3e7e..a79e257bc338 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -2250,7 +2250,7 @@ static int gfar_enet_open(struct net_device *dev) static inline struct txfcb *gfar_add_fcb(struct sk_buff *skb) { - struct txfcb *fcb = (struct txfcb *)skb_push(skb, GMAC_FCB_LEN); + struct txfcb *fcb = skb_push(skb, GMAC_FCB_LEN); memset(fcb, 0, GMAC_FCB_LEN); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c index c456ca07b562..898759fcf9ec 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c @@ -132,7 +132,7 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) skb_reserve(skb, NET_IP_ALIGN); /* Reserve for ethernet and IP header */ - ethh = (struct ethhdr *)skb_push(skb, ETH_HLEN); + ethh = skb_push(skb, ETH_HLEN); skb_reset_mac_header(skb); skb_set_network_header(skb, skb->len); diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 2dcca249eb9c..46cb7f8955a2 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -6667,7 +6667,7 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb, headroom = align + sizeof(struct tx_pkt_hdr); ehdr = (struct ethhdr *) skb->data; - tp = (struct tx_pkt_hdr *) skb_push(skb, headroom); + tp = skb_push(skb, headroom); len = skb->len - sizeof(struct tx_pkt_hdr); tp->flags = cpu_to_le64(niu_compute_tx_flags(skb, ehdr, align, len)); diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index fa6a06571187..88d74aef218a 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c @@ -754,7 +754,7 @@ static struct sk_buff *gelic_put_vlan_tag(struct sk_buff *skb, return NULL; dev_kfree_skb_any(sk_tmp); } - veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); + veth = skb_push(skb, VLAN_HLEN); /* Move the mac addresses to the top of buffer */ memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN); diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 7bcf1b52020e..d586ad93aaff 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -687,8 +687,7 @@ static int geneve_build_skb(struct dst_entry *dst, struct sk_buff *skb, if (err) goto free_dst; - gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + - info->options_len); + gnvh = __skb_push(skb, sizeof(*gnvh) + info->options_len); geneve_build_header(gnvh, info); skb_set_inner_protocol(skb, htons(ETH_P_TEB)); return 0; diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index ca110cd2a4e4..8e333a8a2295 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -398,7 +398,7 @@ static inline void gtp0_push_header(struct sk_buff *skb, struct pdp_ctx *pctx) int payload_len = skb->len; struct gtp0_header *gtp0; - gtp0 = (struct gtp0_header *) skb_push(skb, sizeof(*gtp0)); + gtp0 = skb_push(skb, sizeof(*gtp0)); gtp0->flags = 0x1e; /* v0, GTP-non-prime. */ gtp0->type = GTP_TPDU; @@ -415,7 +415,7 @@ static inline void gtp1_push_header(struct sk_buff *skb, struct pdp_ctx *pctx) int payload_len = skb->len; struct gtp1_header *gtp1; - gtp1 = (struct gtp1_header *) skb_push(skb, sizeof(*gtp1)); + gtp1 = skb_push(skb, sizeof(*gtp1)); /* Bits 8 7 6 5 4 3 2 1 * +--+--+--+--+--+--+--+--+ diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c index 7683fd544344..71ddadbf2368 100644 --- a/drivers/net/hippi/rrunner.c +++ b/drivers/net/hippi/rrunner.c @@ -1422,7 +1422,7 @@ static netdev_tx_t rr_start_xmit(struct sk_buff *skb, skb = new_skb; } - ifield = (u32 *)skb_push(skb, 8); + ifield = skb_push(skb, 8); ifield[0] = 0; ifield[1] = hcb->ifield; diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 2067dcc71535..e370d7c894cb 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -697,7 +697,7 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb, unprotected_len = skb->len; eth = eth_hdr(skb); sci_present = send_sci(secy); - hh = (struct macsec_eth_header *)skb_push(skb, macsec_extra_len(sci_present)); + hh = skb_push(skb, macsec_extra_len(sci_present)); memmove(hh, eth, 2 * ETH_ALEN); pn = tx_sa_update_pn(tx_sa, secy); diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c index 32c72db654e2..814fd8fae67d 100644 --- a/drivers/net/ppp/ppp_async.c +++ b/drivers/net/ppp/ppp_async.c @@ -802,7 +802,7 @@ process_input_packet(struct asyncppp *ap) proto = p[0]; if (proto & 1) { /* protocol is compressed */ - skb_push(skb, 1)[0] = 0; + *(u8 *)skb_push(skb, 1) = 0; } else { if (skb->len < 2) goto err; diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index bbded33120fe..d42091f11eb8 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -1490,7 +1490,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) /* check if we should pass this packet */ /* the filter instructions are constructed assuming a four-byte PPP header on each packet */ - *skb_push(skb, 2) = 1; + *(u8 *)skb_push(skb, 2) = 1; if (ppp->pass_filter && BPF_PROG_RUN(ppp->pass_filter, skb) == 0) { if (ppp->debug & 1) @@ -2133,7 +2133,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) if (skb_unclone(skb, GFP_ATOMIC)) goto err; - *skb_push(skb, 2) = 0; + *(u8 *)skb_push(skb, 2) = 0; if (ppp->pass_filter && BPF_PROG_RUN(ppp->pass_filter, skb) == 0) { if (ppp->debug & 1) @@ -2267,7 +2267,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) * Do protocol ID decompression on the first fragment of each packet. */ if ((PPP_MP_CB(skb)->BEbits & B) && (skb->data[0] & 1)) - *skb_push(skb, 1) = 0; + *(u8 *)skb_push(skb, 1) = 0; /* * Expand sequence number to 32 bits, making it as close diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c index ce2300c0bcbf..ef08590db873 100644 --- a/drivers/net/ppp/ppp_synctty.c +++ b/drivers/net/ppp/ppp_synctty.c @@ -711,7 +711,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, /* decompress protocol field if compressed */ if (p[0] & 1) { /* protocol is compressed */ - skb_push(skb, 1)[0] = 0; + *(u8 *)skb_push(skb, 1) = 0; } else if (skb->len < 2) goto err; diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index 1951b1085cb8..2f22e318a67f 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c @@ -328,7 +328,7 @@ allow_packet: if ((*skb->data) & 1) { /* protocol is compressed */ - skb_push(skb, 1)[0] = 0; + *(u8 *)skb_push(skb, 1) = 0; } skb->ip_summed = CHECKSUM_NONE; diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c index 29276e54bb8b..ba1ce1006c4f 100644 --- a/drivers/net/usb/gl620a.c +++ b/drivers/net/usb/gl620a.c @@ -174,7 +174,7 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) } // attach the packet count to the header - packet_count = (__le32 *) skb_push(skb, (4 + 4*1)); + packet_count = skb_push(skb, (4 + 4 * 1)); packet_len = packet_count + 1; *packet_count = cpu_to_le32(1); diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c index 5a43b77a6b9c..be63a829b8fe 100644 --- a/drivers/net/usb/int51x1.c +++ b/drivers/net/usb/int51x1.c @@ -106,7 +106,7 @@ static struct sk_buff *int51x1_tx_fixup(struct usbnet *dev, pack_len += need_tail; pack_len &= 0x07ff; - len = (__le16 *) __skb_push(skb, INT51X1_HEADER_SIZE); + len = __skb_push(skb, INT51X1_HEADER_SIZE); *len = cpu_to_le16(pack_len); if(need_tail) diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 37fb621fde86..92e4fd29ae44 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c @@ -809,7 +809,7 @@ static netdev_tx_t kaweth_start_xmit(struct sk_buff *skb, return NETDEV_TX_OK; } - private_header = (__le16 *)__skb_push(skb, 2); + private_header = __skb_push(skb, 2); *private_header = cpu_to_le16(skb->len-2); kaweth->tx_skb = skb; diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c index d633492bf9eb..dbabd7ca5268 100644 --- a/drivers/net/usb/lg-vl600.c +++ b/drivers/net/usb/lg-vl600.c @@ -304,7 +304,7 @@ encapsulate: memset(&packet->dummy, 0, sizeof(packet->dummy)); packet->len = cpu_to_le32(orig_len); - frame = (struct vl600_frame_hdr *) skb_push(skb, sizeof(*frame)); + frame = skb_push(skb, sizeof(*frame)); memset(frame, 0, sizeof(*frame)); frame->len = cpu_to_le32(full_len); frame->serial = cpu_to_le32(serial++); diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index 861ff45f0b09..be53ff30b7b5 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c @@ -466,7 +466,7 @@ net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) encapsulate: /* header first */ - header = (struct nc_header *) skb_push(skb, sizeof *header); + header = skb_push(skb, sizeof *header); header->hdr_len = cpu_to_le16(sizeof (*header)); header->packet_len = cpu_to_le16(len); header->packet_id = cpu_to_le16((u16)dev->xid++); diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index ffd229ec8352..5894e3c9468f 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -101,7 +101,7 @@ static netdev_tx_t qmimux_start_xmit(struct sk_buff *skb, struct net_device *dev unsigned int len = skb->len; struct qmimux_hdr *hdr; - hdr = (struct qmimux_hdr *)skb_push(skb, sizeof(struct qmimux_hdr)); + hdr = skb_push(skb, sizeof(struct qmimux_hdr)); hdr->pad = 0; hdr->mux_id = priv->mux_id; hdr->pkt_len = cpu_to_be16(len); diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index e96e2e5673d7..a151f267aebb 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c @@ -578,7 +578,7 @@ rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) * packets; Linux minimizes wasted bandwidth through tx queues. */ fill: - hdr = (void *) __skb_push(skb, sizeof *hdr); + hdr = __skb_push(skb, sizeof *hdr); memset(hdr, 0, sizeof *hdr); hdr->msg_type = cpu_to_le32(RNDIS_MSG_PACKET); hdr->msg_len = cpu_to_le32(skb->len); diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index 022c0b5f9844..c6c0595d267b 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -383,7 +383,7 @@ static int vrf_finish_direct(struct net *net, struct sock *sk, if (!list_empty(&vrf_dev->ptype_all) && likely(skb_headroom(skb) >= ETH_HLEN)) { - struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); + struct ethhdr *eth = skb_push(skb, ETH_HLEN); ether_addr_copy(eth->h_source, vrf_dev->dev_addr); eth_zero_addr(eth->h_dest); diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 4e1d427d340c..94ce98229828 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1827,7 +1827,7 @@ static int vxlan_build_skb(struct sk_buff *skb, struct dst_entry *dst, if (err) return err; - vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh)); + vxh = __skb_push(skb, sizeof(*vxh)); vxh->vx_flags = VXLAN_HF_VNI; vxh->vx_vni = vxlan_vni_field(vni); diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c index dd7f3168c07d..a654687b5fa2 100644 --- a/drivers/net/wimax/i2400m/netdev.c +++ b/drivers/net/wimax/i2400m/netdev.c @@ -221,7 +221,7 @@ void i2400m_tx_prep_header(struct sk_buff *skb) { struct i2400m_pl_data_hdr *pl_hdr; skb_pull(skb, ETH_HLEN); - pl_hdr = (struct i2400m_pl_data_hdr *) skb_push(skb, sizeof(*pl_hdr)); + pl_hdr = skb_push(skb, sizeof(*pl_hdr)); pl_hdr->reserved = 0; } diff --git a/drivers/net/wireless/admtek/adm8211.c b/drivers/net/wireless/admtek/adm8211.c index 5f64f3928c35..3b0802fc5bf5 100644 --- a/drivers/net/wireless/admtek/adm8211.c +++ b/drivers/net/wireless/admtek/adm8211.c @@ -1700,7 +1700,7 @@ static void adm8211_tx(struct ieee80211_hw *dev, skb_pull(skb, hdrlen); payload_len = skb->len; - txhdr = (struct adm8211_tx_hdr *) skb_push(skb, sizeof(*txhdr)); + txhdr = skb_push(skb, sizeof(*txhdr)); memset(txhdr, 0, sizeof(*txhdr)); memcpy(txhdr->da, ieee80211_get_DA(hdr), ETH_ALEN); txhdr->signal = plcp_signal; diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c index f2f4ccfdf8da..106d6f8d471a 100644 --- a/drivers/net/wireless/ath/ar5523/ar5523.c +++ b/drivers/net/wireless/ath/ar5523/ar5523.c @@ -829,8 +829,8 @@ static void ar5523_tx_work_locked(struct ar5523 *ar) data->ar = ar; data->urb = urb; - desc = (struct ar5523_tx_desc *)skb_push(skb, sizeof(*desc)); - chunk = (struct ar5523_chunk *)skb_push(skb, sizeof(*chunk)); + desc = skb_push(skb, sizeof(*desc)); + chunk = skb_push(skb, sizeof(*chunk)); chunk->seqnum = 0; chunk->flags = UATH_CFLAGS_FINAL; diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c index b13d61111072..5c0ba83a44aa 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c +++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c @@ -228,8 +228,7 @@ static int htc_issue_packets(struct htc_target *target, payload_len = packet->act_len; /* setup HTC frame header */ - htc_hdr = (struct htc_frame_hdr *) skb_push(skb, - sizeof(*htc_hdr)); + htc_hdr = skb_push(skb, sizeof(*htc_hdr)); if (!htc_hdr) { WARN_ON_ONCE(1); status = -EINVAL; diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 12aa8abbcba4..0d9687a2aa98 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -199,7 +199,7 @@ static int hif_usb_send_mgmt(struct hif_device_usb *hif_dev, cmd->skb = skb; cmd->hif_dev = hif_dev; - hdr = (__le16 *) skb_push(skb, 4); + hdr = skb_push(skb, 4); *hdr++ = cpu_to_le16(skb->len - 4); *hdr++ = cpu_to_le16(ATH_USB_TX_STREAM_MODE_TAG); diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index 9fa8970a1f7d..1bf63a4efb4c 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -26,8 +26,7 @@ static int htc_issue_send(struct htc_target *target, struct sk_buff* skb, struct htc_endpoint *endpoint = &target->endpoint[epid]; int status; - hdr = (struct htc_frame_hdr *) - skb_push(skb, sizeof(struct htc_frame_hdr)); + hdr = skb_push(skb, sizeof(struct htc_frame_hdr)); hdr->endpoint_id = epid; hdr->flags = flags; hdr->payload_len = cpu_to_be16(len); diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index c51c69b1ad96..85d09fdef8dc 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c @@ -277,7 +277,7 @@ static int ath9k_wmi_cmd_issue(struct wmi *wmi, struct wmi_cmd_hdr *hdr; unsigned long flags; - hdr = (struct wmi_cmd_hdr *) skb_push(skb, sizeof(struct wmi_cmd_hdr)); + hdr = skb_push(skb, sizeof(struct wmi_cmd_hdr)); hdr->command_id = cpu_to_be16(cmd); hdr->seq_no = cpu_to_be16(++wmi->tx_seq_id); diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c index 2bf04c9edc98..0cb5b58925dc 100644 --- a/drivers/net/wireless/ath/carl9170/tx.c +++ b/drivers/net/wireless/ath/carl9170/tx.c @@ -991,7 +991,7 @@ static int carl9170_tx_prepare(struct ar9170 *ar, else cvif = NULL; - txc = (void *)skb_push(skb, sizeof(*txc)); + txc = skb_push(skb, sizeof(*txc)); memset(txc, 0, sizeof(*txc)); SET_VAL(CARL9170_TX_SUPER_MISC_QUEUE, txc->s.misc, hw_queue); diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index edab4c0a900f..84d91606e6f3 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -363,7 +363,7 @@ static void wil_rx_add_radiotap_header(struct wil6210_priv *wil, return; } - rtap_vendor = (void *)skb_push(skb, rtap_len); + rtap_vendor = skb_push(skb, rtap_len); memset(rtap_vendor, 0, rtap_len); rtap_vendor->rtap.rthdr.it_version = PKTHDR_RADIOTAP_VERSION; diff --git a/drivers/net/wireless/intersil/hostap/hostap_80211_rx.c b/drivers/net/wireless/intersil/hostap/hostap_80211_rx.c index 34dbddbf3f9b..6d8b64ca1a63 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/intersil/hostap/hostap_80211_rx.c @@ -131,8 +131,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, if (prism_header == 1) { struct linux_wlan_ng_prism_hdr *hdr; - hdr = (struct linux_wlan_ng_prism_hdr *) - skb_push(skb, phdrlen); + hdr = skb_push(skb, phdrlen); memset(hdr, 0, phdrlen); hdr->msgcode = LWNG_CAP_DID_BASE; hdr->msglen = sizeof(*hdr); @@ -153,8 +152,7 @@ hdr->f.status = s; hdr->f.len = l; hdr->f.data = d #undef LWNG_SETVAL } else if (prism_header == 2) { struct linux_wlan_ng_cap_hdr *hdr; - hdr = (struct linux_wlan_ng_cap_hdr *) - skb_push(skb, phdrlen); + hdr = skb_push(skb, phdrlen); memset(hdr, 0, phdrlen); hdr->version = htonl(LWNG_CAPHDR_VERSION); hdr->length = htonl(phdrlen); @@ -172,7 +170,7 @@ hdr->f.status = s; hdr->f.len = l; hdr->f.data = d hdr->encoding = htonl(1); /* cck */ } else if (prism_header == 3) { struct hostap_radiotap_rx *hdr; - hdr = (struct hostap_radiotap_rx *)skb_push(skb, phdrlen); + hdr = skb_push(skb, phdrlen); memset(hdr, 0, phdrlen); hdr->hdr.it_len = cpu_to_le16(phdrlen); hdr->hdr.it_present = diff --git a/drivers/net/wireless/intersil/orinoco/main.c b/drivers/net/wireless/intersil/orinoco/main.c index f7abc439fb92..28dac36d7c4c 100644 --- a/drivers/net/wireless/intersil/orinoco/main.c +++ b/drivers/net/wireless/intersil/orinoco/main.c @@ -396,7 +396,7 @@ int orinoco_process_xmit_skb(struct sk_buff *skb, memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr)); /* Make room for the new header, and copy it in */ - eh = (struct ethhdr *) skb_push(skb, ENCAPS_OVERHEAD); + eh = skb_push(skb, ENCAPS_OVERHEAD); memcpy(eh, &hdr, sizeof(hdr)); } @@ -1029,11 +1029,10 @@ static void orinoco_rx(struct net_device *dev, /* These indicate a SNAP within 802.2 LLC within 802.11 frame which we'll need to de-encapsulate to the original EthernetII frame. */ - hdr = (struct ethhdr *)skb_push(skb, - ETH_HLEN - ENCAPS_OVERHEAD); + hdr = skb_push(skb, ETH_HLEN - ENCAPS_OVERHEAD); } else { /* 802.3 frame - prepend 802.3 header as is */ - hdr = (struct ethhdr *)skb_push(skb, ETH_HLEN); + hdr = skb_push(skb, ETH_HLEN); hdr->h_proto = htons(length); } memcpy(hdr->h_dest, desc->addr1, ETH_ALEN); diff --git a/drivers/net/wireless/intersil/p54/txrx.c b/drivers/net/wireless/intersil/p54/txrx.c index b00c07d72f95..3a4214d362ff 100644 --- a/drivers/net/wireless/intersil/p54/txrx.c +++ b/drivers/net/wireless/intersil/p54/txrx.c @@ -815,8 +815,8 @@ void p54_tx_80211(struct ieee80211_hw *dev, } } - txhdr = (struct p54_tx_data *) skb_push(skb, sizeof(*txhdr) + padding); - hdr = (struct p54_hdr *) skb_push(skb, sizeof(*hdr)); + txhdr = skb_push(skb, sizeof(*txhdr) + padding); + hdr = skb_push(skb, sizeof(*hdr)); if (padding) hdr_flags |= P54_HDR_FLAG_DATA_ALIGN; diff --git a/drivers/net/wireless/intersil/prism54/islpci_eth.c b/drivers/net/wireless/intersil/prism54/islpci_eth.c index d83f6332019e..9b0ded733294 100644 --- a/drivers/net/wireless/intersil/prism54/islpci_eth.c +++ b/drivers/net/wireless/intersil/prism54/islpci_eth.c @@ -276,10 +276,7 @@ islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb) } /* make room for the new header and fill it. */ - avs = - (struct avs_80211_1_header *) skb_push(*skb, - sizeof (struct - avs_80211_1_header)); + avs = skb_push(*skb, sizeof(struct avs_80211_1_header)); avs->version = cpu_to_be32(P80211CAPTURE_VERSION); avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header)); diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 7418088e296f..c8852acc1462 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -848,7 +848,7 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, if (skb == NULL) return; - hdr = (struct hwsim_radiotap_hdr *) skb_push(skb, sizeof(*hdr)); + hdr = skb_push(skb, sizeof(*hdr)); hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION; hdr->hdr.it_pad = 0; hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); @@ -1146,7 +1146,7 @@ static void mac80211_hwsim_add_vendor_rtap(struct sk_buff *skb) * Note that this code requires the headroom in the SKB * that was allocated earlier. */ - rtap = (void *)skb_push(skb, sizeof(*rtap) + 8 + 4); + rtap = skb_push(skb, sizeof(*rtap) + 8 + 4); rtap->oui[0] = HWSIM_RADIOTAP_OUI[0]; rtap->oui[1] = HWSIM_RADIOTAP_OUI[1]; rtap->oui[2] = HWSIM_RADIOTAP_OUI[2]; diff --git a/drivers/net/wireless/marvell/libertas/rx.c b/drivers/net/wireless/marvell/libertas/rx.c index a18bb7a9889c..7586ff681b23 100644 --- a/drivers/net/wireless/marvell/libertas/rx.c +++ b/drivers/net/wireless/marvell/libertas/rx.c @@ -257,7 +257,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, goto done; } - pradiotap_hdr = (void *)skb_push(skb, sizeof(struct rx_radiotap_hdr)); + pradiotap_hdr = skb_push(skb, sizeof(struct rx_radiotap_hdr)); memcpy(pradiotap_hdr, &radiotap_hdr, sizeof(struct rx_radiotap_hdr)); priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate); diff --git a/drivers/net/wireless/marvell/libertas_tf/main.c b/drivers/net/wireless/marvell/libertas_tf/main.c index d80333117989..81228bf73043 100644 --- a/drivers/net/wireless/marvell/libertas_tf/main.c +++ b/drivers/net/wireless/marvell/libertas_tf/main.c @@ -260,7 +260,7 @@ static void lbtf_tx_work(struct work_struct *work) len = skb->len; info = IEEE80211_SKB_CB(skb); - txpd = (struct txpd *) skb_push(skb, sizeof(struct txpd)); + txpd = skb_push(skb, sizeof(struct txpd)); if (priv->surpriseremoved) { dev_kfree_skb_any(skb); diff --git a/drivers/net/wireless/mediatek/mt7601u/tx.c b/drivers/net/wireless/mediatek/mt7601u/tx.c index ad77bec1ba0f..3600e911a63e 100644 --- a/drivers/net/wireless/mediatek/mt7601u/tx.c +++ b/drivers/net/wireless/mediatek/mt7601u/tx.c @@ -148,7 +148,7 @@ mt7601u_push_txwi(struct mt7601u_dev *dev, struct sk_buff *skb, u16 rate_ctl; u8 nss; - txwi = (struct mt76_txwi *)skb_push(skb, sizeof(struct mt76_txwi)); + txwi = skb_push(skb, sizeof(struct mt76_txwi)); memset(txwi, 0, sizeof(*txwi)); if (!wcid->tx_rate_set) diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c index 35fe991dcc56..55198ac2b755 100644 --- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c @@ -278,8 +278,7 @@ static void rtl8187_tx(struct ieee80211_hw *dev, } if (!priv->is_rtl8187b) { - struct rtl8187_tx_hdr *hdr = - (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); + struct rtl8187_tx_hdr *hdr = skb_push(skb, sizeof(*hdr)); hdr->flags = cpu_to_le32(flags); hdr->len = 0; hdr->rts_duration = rts_dur; @@ -292,8 +291,7 @@ static void rtl8187_tx(struct ieee80211_hw *dev, unsigned int epmap[4] = { 6, 7, 5, 4 }; u16 fc = le16_to_cpu(tx_hdr->frame_control); - struct rtl8187b_tx_hdr *hdr = - (struct rtl8187b_tx_hdr *)skb_push(skb, sizeof(*hdr)); + struct rtl8187b_tx_hdr *hdr = skb_push(skb, sizeof(*hdr)); struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, info); memset(hdr, 0, sizeof(*hdr)); diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 39d56313bc94..21e5ef021260 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4952,7 +4952,7 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, if (control && control->sta) sta = control->sta; - tx_desc = (struct rtl8xxxu_txdesc32 *)skb_push(skb, tx_desc_size); + tx_desc = skb_push(skb, tx_desc_size); memset(tx_desc, 0, tx_desc_size); tx_desc->pkt_size = cpu_to_le16(pktlen); diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c index 41422e4da8b7..de6c3428f7c6 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c @@ -512,7 +512,7 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; rtl_get_tcb_desc(hw, info, sta, skb, tcb_desc); - txdesc = (u8 *)skb_push(skb, RTL_TX_HEADER_SIZE); + txdesc = skb_push(skb, RTL_TX_HEADER_SIZE); memset(txdesc, 0, RTL_TX_HEADER_SIZE); SET_TX_DESC_PKT_SIZE(txdesc, pktlen); SET_TX_DESC_LINIP(txdesc, 0); diff --git a/drivers/net/wireless/st/cw1200/txrx.c b/drivers/net/wireless/st/cw1200/txrx.c index cd63ffef025a..e9050b41157a 100644 --- a/drivers/net/wireless/st/cw1200/txrx.c +++ b/drivers/net/wireless/st/cw1200/txrx.c @@ -574,7 +574,7 @@ cw1200_tx_h_wsm(struct cw1200_common *priv, return NULL; } - wsm = (struct wsm_tx *)skb_push(t->skb, sizeof(struct wsm_tx)); + wsm = skb_push(t->skb, sizeof(struct wsm_tx)); t->txpriv.offset += sizeof(struct wsm_tx); memset(wsm, 0, sizeof(*wsm)); wsm->hdr.len = __cpu_to_le16(t->skb->len); diff --git a/drivers/net/wireless/ti/wl1251/tx.c b/drivers/net/wireless/ti/wl1251/tx.c index 81de83c6fcf6..de2fa6705574 100644 --- a/drivers/net/wireless/ti/wl1251/tx.c +++ b/drivers/net/wireless/ti/wl1251/tx.c @@ -161,8 +161,7 @@ static int wl1251_tx_fill_hdr(struct wl1251 *wl, struct sk_buff *skb, return id; fc = *(u16 *)skb->data; - tx_hdr = (struct tx_double_buffer_desc *) skb_push(skb, - sizeof(*tx_hdr)); + tx_hdr = skb_push(skb, sizeof(*tx_hdr)); tx_hdr->length = cpu_to_le16(skb->len - sizeof(*tx_hdr)); rate = ieee80211_get_tx_rate(wl->hw, control); diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index 229f4d01f239..2bfc12fdc929 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c @@ -1282,7 +1282,7 @@ int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif) memset(skb_push(skb, sizeof(__le16)), 0, sizeof(__le16)); /* mac80211 header */ - hdr = (struct ieee80211_hdr_3addr *)skb_push(skb, sizeof(*hdr)); + hdr = skb_push(skb, sizeof(*hdr)); memset(hdr, 0, sizeof(*hdr)); fc = IEEE80211_FTYPE_DATA | IEEE80211_FCTL_TODS; if (wlvif->sta.qos) diff --git a/drivers/net/wireless/ti/wlcore/tx.c b/drivers/net/wireless/ti/wlcore/tx.c index c1b8e4e9d70b..a3f5e9ca492a 100644 --- a/drivers/net/wireless/ti/wlcore/tx.c +++ b/drivers/net/wireless/ti/wlcore/tx.c @@ -223,8 +223,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif, total_blocks = wlcore_hw_calc_tx_blocks(wl, total_len, spare_blocks); if (total_blocks <= wl->tx_blocks_available) { - desc = (struct wl1271_tx_hw_descr *)skb_push( - skb, total_len - skb->len); + desc = skb_push(skb, total_len - skb->len); wlcore_hw_set_tx_desc_blocks(wl, desc, total_blocks, spare_blocks); diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c index 2d929d2edb00..b785742bfd9e 100644 --- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c @@ -868,8 +868,7 @@ static int fill_ctrlset(struct zd_mac *mac, unsigned int frag_len = skb->len + FCS_LEN; unsigned int packet_length; struct ieee80211_rate *txrate; - struct zd_ctrlset *cs = (struct zd_ctrlset *) - skb_push(skb, sizeof(struct zd_ctrlset)); + struct zd_ctrlset *cs = skb_push(skb, sizeof(struct zd_ctrlset)); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ZD_ASSERT(frag_len <= 0xffff); diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c index 97f003e84381..d5781aa0f791 100644 --- a/drivers/nfc/fdp/i2c.c +++ b/drivers/nfc/fdp/i2c.c @@ -79,8 +79,8 @@ static void fdp_nci_i2c_add_len_lrc(struct sk_buff *skb) /* Add length header */ len = skb->len; - *skb_push(skb, 1) = len & 0xff; - *skb_push(skb, 1) = len >> 8; + *(u8 *)skb_push(skb, 1) = len & 0xff; + *(u8 *)skb_push(skb, 1) = len >> 8; /* Compute and add lrc */ for (i = 0; i < len + 2; i++) diff --git a/drivers/nfc/microread/i2c.c b/drivers/nfc/microread/i2c.c index 8e328c36a816..386cc61d95b9 100644 --- a/drivers/nfc/microread/i2c.c +++ b/drivers/nfc/microread/i2c.c @@ -70,7 +70,7 @@ static void microread_i2c_add_len_crc(struct sk_buff *skb) int len; len = skb->len; - *skb_push(skb, 1) = len; + *(u8 *)skb_push(skb, 1) = len; for (i = 0; i < skb->len; i++) crc = crc ^ skb->data[i]; diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c index 9d0dd1be0923..38a979eacc29 100644 --- a/drivers/nfc/microread/microread.c +++ b/drivers/nfc/microread/microread.c @@ -419,7 +419,7 @@ static int microread_im_transceive(struct nfc_hci_dev *hdev, pr_info("data exchange to gate 0x%x\n", target->hci_reader_gate); if (target->hci_reader_gate == MICROREAD_GATE_ID_P2P_INITIATOR) { - *skb_push(skb, 1) = 0; + *(u8 *)skb_push(skb, 1) = 0; return nfc_hci_send_event(hdev, target->hci_reader_gate, MICROREAD_EVT_P2P_INITIATOR_EXCHANGE_TO_RF, @@ -453,7 +453,7 @@ static int microread_im_transceive(struct nfc_hci_dev *hdev, return 1; } - *skb_push(skb, 1) = control_bits; + *(u8 *)skb_push(skb, 1) = control_bits; info->async_cb_type = MICROREAD_CB_TYPE_READER_ALL; info->async_cb = cb; diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c index 51c8240a1672..c5038e6447bd 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c @@ -68,7 +68,7 @@ static int nfcmrvl_nci_send(struct nci_dev *ndev, struct sk_buff *skb) unsigned char *hdr; unsigned char len = skb->len; - hdr = (char *) skb_push(skb, NFCMRVL_HCI_EVENT_HEADER_SIZE); + hdr = skb_push(skb, NFCMRVL_HCI_EVENT_HEADER_SIZE); hdr[0] = NFCMRVL_HCI_COMMAND_CODE; hdr[1] = NFCMRVL_HCI_OGF; hdr[2] = NFCMRVL_HCI_OCF; diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index 68a3cd0287f6..6a711b5b9490 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c @@ -2090,10 +2090,10 @@ static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb) /* MI + TG */ if (frag_size == PN533_CMD_DATAFRAME_MAXLEN) - *skb_push(frag, sizeof(u8)) = - (PN533_CMD_MI_MASK | 1); + *(u8 *)skb_push(frag, sizeof(u8)) = + (PN533_CMD_MI_MASK | 1); else - *skb_push(frag, sizeof(u8)) = 1; /* TG */ + *(u8 *)skb_push(frag, sizeof(u8)) = 1; /* TG */ } skb_put_data(frag, skb->data, frag_size); @@ -2160,7 +2160,7 @@ static int pn533_transceive(struct nfc_dev *nfc_dev, goto error; } } else { - *skb_push(skb, sizeof(u8)) = 1; /* TG */ + *(u8 *)skb_push(skb, sizeof(u8)) = 1; /* TG */ } rc = pn533_send_data_async(dev, PN533_CMD_IN_DATA_EXCHANGE, diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index dc1e3768cee6..b7be6c25b7e6 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -283,7 +283,7 @@ static void pn544_hci_i2c_add_len_crc(struct sk_buff *skb) int len; len = skb->len + 2; - *skb_push(skb, 1) = len; + *(u8 *)skb_push(skb, 1) = len; crc = crc_ccitt(0xffff, skb->data, skb->len); crc = ~crc; diff --git a/drivers/nfc/pn544/pn544.c b/drivers/nfc/pn544/pn544.c index 12e819ddf17a..70e898e38b16 100644 --- a/drivers/nfc/pn544/pn544.c +++ b/drivers/nfc/pn544/pn544.c @@ -649,8 +649,8 @@ static int pn544_hci_im_transceive(struct nfc_hci_dev *hdev, } else return 1; case PN544_RF_READER_F_GATE: - *skb_push(skb, 1) = 0; - *skb_push(skb, 1) = 0; + *(u8 *)skb_push(skb, 1) = 0; + *(u8 *)skb_push(skb, 1) = 0; info->async_cb_type = PN544_CB_TYPE_READER_F; info->async_cb = cb; @@ -665,7 +665,7 @@ static int pn544_hci_im_transceive(struct nfc_hci_dev *hdev, PN544_JEWEL_RAW_CMD, skb->data, skb->len, cb, cb_context); case PN544_RF_READER_NFCIP1_INITIATOR_GATE: - *skb_push(skb, 1) = 0; + *(u8 *)skb_push(skb, 1) = 0; return nfc_hci_send_event(hdev, target->hci_reader_gate, PN544_HCI_EVT_SND_DATA, skb->data, @@ -680,7 +680,7 @@ static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb) int r; /* Set default false for multiple information chaining */ - *skb_push(skb, 1) = 0; + *(u8 *)skb_push(skb, 1) = 0; r = nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE, PN544_HCI_EVT_SND_DATA, skb->data, skb->len); diff --git a/drivers/nfc/st-nci/ndlc.c b/drivers/nfc/st-nci/ndlc.c index 50880d747b02..9477994cf975 100644 --- a/drivers/nfc/st-nci/ndlc.c +++ b/drivers/nfc/st-nci/ndlc.c @@ -87,7 +87,7 @@ int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb) u8 pcb = PCB_TYPE_DATAFRAME | PCB_DATAFRAME_RETRANSMIT_NO | PCB_FRAME_CRC_INFO_NOTPRESENT; - *skb_push(skb, 1) = pcb; + *(u8 *)skb_push(skb, 1) = pcb; skb_queue_tail(&ndlc->send_q, skb); schedule_work(&ndlc->sm_work); diff --git a/drivers/nfc/st21nfca/core.c b/drivers/nfc/st21nfca/core.c index 50be3b788f1c..e803fdfa9189 100644 --- a/drivers/nfc/st21nfca/core.c +++ b/drivers/nfc/st21nfca/core.c @@ -782,12 +782,12 @@ static int st21nfca_hci_im_transceive(struct nfc_hci_dev *hdev, if (target->supported_protocols == NFC_PROTO_NFC_DEP_MASK) return st21nfca_im_send_dep_req(hdev, skb); - *skb_push(skb, 1) = 0x1a; + *(u8 *)skb_push(skb, 1) = 0x1a; return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, ST21NFCA_WR_XCHG_DATA, skb->data, skb->len, cb, cb_context); case ST21NFCA_RF_READER_14443_3_A_GATE: - *skb_push(skb, 1) = 0x1a; /* CTR, see spec:10.2.2.1 */ + *(u8 *)skb_push(skb, 1) = 0x1a; /* CTR, see spec:10.2.2.1 */ return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, ST21NFCA_WR_XCHG_DATA, skb->data, @@ -797,7 +797,7 @@ static int st21nfca_hci_im_transceive(struct nfc_hci_dev *hdev, info->async_cb = cb; info->async_cb_context = cb_context; - *skb_push(skb, 1) = 0x17; + *(u8 *)skb_push(skb, 1) = 0x17; return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, ST21NFCA_WR_XCHG_DATA, skb->data, diff --git a/drivers/nfc/st21nfca/dep.c b/drivers/nfc/st21nfca/dep.c index ada7b114b6c1..fd08be2917e6 100644 --- a/drivers/nfc/st21nfca/dep.c +++ b/drivers/nfc/st21nfca/dep.c @@ -315,10 +315,10 @@ int st21nfca_tm_send_dep_res(struct nfc_hci_dev *hdev, struct sk_buff *skb) int r; struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); - *skb_push(skb, 1) = info->dep_info.curr_nfc_dep_pni; - *skb_push(skb, 1) = ST21NFCA_NFCIP1_DEP_RES; - *skb_push(skb, 1) = ST21NFCA_NFCIP1_RES; - *skb_push(skb, 1) = skb->len; + *(u8 *)skb_push(skb, 1) = info->dep_info.curr_nfc_dep_pni; + *(u8 *)skb_push(skb, 1) = ST21NFCA_NFCIP1_DEP_RES; + *(u8 *)skb_push(skb, 1) = ST21NFCA_NFCIP1_RES; + *(u8 *)skb_push(skb, 1) = skb->len; r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, ST21NFCA_EVT_SEND_DATA, skb->data, skb->len); @@ -466,7 +466,7 @@ static void st21nfca_im_send_psl_req(struct nfc_hci_dev *hdev, u8 did, u8 bsi, psl_req->brs = (0x30 & bsi << 4) | (bri & 0x03); psl_req->fsl = lri; - *skb_push(skb, 1) = info->dep_info.to | 0x10; + *(u8 *)skb_push(skb, 1) = info->dep_info.to | 0x10; st21nfca_im_send_pdu(info, skb); } @@ -568,7 +568,7 @@ int st21nfca_im_send_atr_req(struct nfc_hci_dev *hdev, u8 *gb, size_t gb_len) } atr_req->length = sizeof(struct st21nfca_atr_req) + hdev->gb_len; - *skb_push(skb, 1) = info->dep_info.to | 0x10; /* timeout */ + *(u8 *)skb_push(skb, 1) = info->dep_info.to | 0x10; /* timeout */ info->async_cb_type = ST21NFCA_CB_TYPE_READER_F; info->async_cb_context = info; @@ -629,10 +629,10 @@ static void st21nfca_im_recv_dep_res_cb(void *context, struct sk_buff *skb, case ST21NFCA_NFC_DEP_PFB_SUPERVISOR_PDU: pr_err("Received a SUPERVISOR PDU\n"); skb_pull(skb, size); - *skb_push(skb, 1) = ST21NFCA_NFCIP1_DEP_REQ; - *skb_push(skb, 1) = ST21NFCA_NFCIP1_REQ; - *skb_push(skb, 1) = skb->len; - *skb_push(skb, 1) = info->dep_info.to | 0x10; + *(u8 *)skb_push(skb, 1) = ST21NFCA_NFCIP1_DEP_REQ; + *(u8 *)skb_push(skb, 1) = ST21NFCA_NFCIP1_REQ; + *(u8 *)skb_push(skb, 1) = skb->len; + *(u8 *)skb_push(skb, 1) = info->dep_info.to | 0x10; st21nfca_im_send_pdu(info, skb); break; @@ -655,12 +655,12 @@ int st21nfca_im_send_dep_req(struct nfc_hci_dev *hdev, struct sk_buff *skb) info->async_cb_context = info; info->async_cb = st21nfca_im_recv_dep_res_cb; - *skb_push(skb, 1) = info->dep_info.curr_nfc_dep_pni; - *skb_push(skb, 1) = ST21NFCA_NFCIP1_DEP_REQ; - *skb_push(skb, 1) = ST21NFCA_NFCIP1_REQ; - *skb_push(skb, 1) = skb->len; + *(u8 *)skb_push(skb, 1) = info->dep_info.curr_nfc_dep_pni; + *(u8 *)skb_push(skb, 1) = ST21NFCA_NFCIP1_DEP_REQ; + *(u8 *)skb_push(skb, 1) = ST21NFCA_NFCIP1_REQ; + *(u8 *)skb_push(skb, 1) = skb->len; - *skb_push(skb, 1) = info->dep_info.to | 0x10; + *(u8 *)skb_push(skb, 1) = info->dep_info.to | 0x10; return nfc_hci_send_cmd_async(hdev, ST21NFCA_RF_READER_F_GATE, ST21NFCA_WR_XCHG_DATA, diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c index c36f0e0afdfd..396cdafb3e36 100644 --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c @@ -171,7 +171,7 @@ static void st21nfca_hci_add_len_crc(struct sk_buff *skb) u16 crc; u8 tmp; - *skb_push(skb, 1) = 0; + *(u8 *)skb_push(skb, 1) = 0; crc = crc_ccitt(0xffff, skb->data, skb->len); crc = ~crc; @@ -216,7 +216,7 @@ static int st21nfca_hci_i2c_write(void *phy_id, struct sk_buff *skb) /* add ST21NFCA_SOF_EOF on tail */ *(u8 *)skb_put(skb, 1) = ST21NFCA_SOF_EOF; /* add ST21NFCA_SOF_EOF on head */ - *skb_push(skb, 1) = ST21NFCA_SOF_EOF; + *(u8 *)skb_push(skb, 1) = ST21NFCA_SOF_EOF; /* * Compute byte stuffing diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 70b633f951ea..c6bc63b8b295 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -759,8 +759,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb, sizeof(struct qeth_hdr)); if (!new_skb) goto tx_drop; - hdr = (struct qeth_hdr *)skb_push(new_skb, - sizeof(struct qeth_hdr)); + hdr = skb_push(new_skb, sizeof(struct qeth_hdr)); skb_set_mac_header(new_skb, sizeof(struct qeth_hdr)); qeth_l2_fill_header(card, hdr, new_skb, cast_type); if (new_skb->ip_summed == CHECKSUM_PARTIAL) diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 37b594231b76..3062cde33a3d 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -2729,16 +2729,14 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb, } if (use_tso) { - hdr = (struct qeth_hdr *)skb_push(new_skb, - sizeof(struct qeth_hdr_tso)); + hdr = skb_push(new_skb, sizeof(struct qeth_hdr_tso)); memset(hdr, 0, sizeof(struct qeth_hdr_tso)); qeth_l3_fill_header(card, hdr, new_skb, ipv, cast_type); qeth_tso_fill_header(card, hdr, new_skb); hdr_elements++; } else { if (data_offset < 0) { - hdr = (struct qeth_hdr *)skb_push(new_skb, - sizeof(struct qeth_hdr)); + hdr = skb_push(new_skb, sizeof(struct qeth_hdr)); qeth_l3_fill_header(card, hdr, new_skb, ipv, cast_type); } else { diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c index 1880eb6c68f7..7b09e7ddf35e 100644 --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c @@ -354,7 +354,7 @@ static inline void make_tx_data_wr(struct cxgbi_sock *csk, struct sk_buff *skb, struct l2t_entry *l2t = csk->l2t; skb_reset_transport_header(skb); - req = (struct tx_data_wr *)__skb_push(skb, sizeof(*req)); + req = __skb_push(skb, sizeof(*req)); req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA) | (req_completion ? F_WR_COMPL : 0)); req->wr_lo = htonl(V_WR_TID(csk->tid)); diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 397094b8bad6..5485d68f286a 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c @@ -644,7 +644,7 @@ static inline void make_tx_data_wr(struct cxgbi_sock *csk, struct sk_buff *skb, unsigned int wr_ulp_mode = 0, val; bool imm = is_ofld_imm(skb); - req = (struct fw_ofld_tx_data_wr *)__skb_push(skb, sizeof(*req)); + req = __skb_push(skb, sizeof(*req)); if (imm) { req->op_to_immdlen = htonl(FW_WR_OP_V(FW_OFLD_TX_DATA_WR) | diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index e17bdb3adf9e..fff6f1851dc1 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c @@ -626,7 +626,7 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip, struct fc_lport *lport, fh = (struct fc_frame_header *)skb->data; op = *(u8 *)(fh + 1); dlen = sizeof(struct fip_encaps) + skb->len; /* len before push */ - cap = (struct fip_encaps_head *)skb_push(skb, sizeof(*cap)); + cap = skb_push(skb, sizeof(*cap)); memset(cap, 0, sizeof(*cap)); if (lport->point_to_multipoint) { diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c index e3b964b7235a..e72becaad8a5 100644 --- a/drivers/scsi/fnic/fnic_fcs.c +++ b/drivers/scsi/fnic/fnic_fcs.c @@ -1000,8 +1000,7 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) if (!fnic->vlan_hw_insert) { eth_hdr = (struct ethhdr *)skb_mac_header(skb); - vlan_hdr = (struct vlan_ethhdr *)skb_push(skb, - sizeof(*vlan_hdr) - sizeof(*eth_hdr)); + vlan_hdr = skb_push(skb, sizeof(*vlan_hdr) - sizeof(*eth_hdr)); memcpy(vlan_hdr, eth_hdr, 2 * ETH_ALEN); vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q); vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto; @@ -1067,7 +1066,7 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp) if (!fnic->vlan_hw_insert) { eth_hdr_len = sizeof(*vlan_hdr) + sizeof(*fcoe_hdr); - vlan_hdr = (struct vlan_ethhdr *)skb_push(skb, eth_hdr_len); + vlan_hdr = skb_push(skb, eth_hdr_len); eth_hdr = (struct ethhdr *)vlan_hdr; vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q); vlan_hdr->h_vlan_encapsulated_proto = htons(ETH_P_FCOE); @@ -1075,7 +1074,7 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp) fcoe_hdr = (struct fcoe_hdr *)(vlan_hdr + 1); } else { eth_hdr_len = sizeof(*eth_hdr) + sizeof(*fcoe_hdr); - eth_hdr = (struct ethhdr *)skb_push(skb, eth_hdr_len); + eth_hdr = skb_push(skb, eth_hdr_len); eth_hdr->h_proto = htons(ETH_P_FCOE); fcoe_hdr = (struct fcoe_hdr *)(eth_hdr + 1); } diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c index e10b91cc3c62..0d4bf70803ae 100644 --- a/drivers/scsi/qedf/qedf_fip.c +++ b/drivers/scsi/qedf/qedf_fip.c @@ -125,8 +125,7 @@ void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb) sub = fiph->fip_subcode; if (!qedf->vlan_hw_insert) { - vlan_hdr = (struct vlan_ethhdr *)skb_push(skb, sizeof(*vlan_hdr) - - sizeof(*eth_hdr)); + vlan_hdr = skb_push(skb, sizeof(*vlan_hdr) - sizeof(*eth_hdr)); memcpy(vlan_hdr, eth_hdr, 2 * ETH_ALEN); vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q); vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto; diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index dbc266a37974..01efa80b4f88 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -74,7 +74,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) skb_put_data(skb, buff, size); - cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push(skb, sizeof(*cb_hdr)); + cb_hdr = skb_push(skb, sizeof(*cb_hdr)); memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr)); cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */ @@ -101,7 +101,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) return; skb_put_data(skb, buff, size); - hdr = (struct wilc_wfi_radiotap_hdr *)skb_push(skb, sizeof(*hdr)); + hdr = skb_push(skb, sizeof(*hdr)); memset(hdr, 0, sizeof(struct wilc_wfi_radiotap_hdr)); hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */ hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_hdr)); @@ -202,7 +202,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, skb_put_data(skb2, skb->data, skb->len); - cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push(skb2, sizeof(*cb_hdr)); + cb_hdr = skb_push(skb2, sizeof(*cb_hdr)); memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr)); cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */ diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index a062e80361ef..fc8ad33ade9f 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -148,9 +148,7 @@ int skb_ether_to_p80211(struct wlandevice *wlandev, u32 ethconv, skb_pull(skb, ETH_HLEN); /* tack on SNAP */ - e_snap = - (struct wlan_snap *)skb_push(skb, - sizeof(struct wlan_snap)); + e_snap = skb_push(skb, sizeof(struct wlan_snap)); e_snap->type = htons(proto); if (ethconv == WLAN_ETHCONV_8021h && p80211_stt_findproto(proto)) { @@ -162,9 +160,7 @@ int skb_ether_to_p80211(struct wlandevice *wlandev, u32 ethconv, } /* tack on llc */ - e_llc = - (struct wlan_llc *)skb_push(skb, - sizeof(struct wlan_llc)); + e_llc = skb_push(skb, sizeof(struct wlan_llc)); e_llc->dsap = 0xAA; /* SNAP, see IEEE 802 */ e_llc->ssap = 0xAA; e_llc->ctl = 0x03; @@ -407,7 +403,7 @@ int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv, skb_pull(skb, payload_offset); /* create 802.3 header at beginning of skb. */ - e_hdr = (struct wlan_ethhdr *)skb_push(skb, ETH_HLEN); + e_hdr = skb_push(skb, ETH_HLEN); ether_addr_copy(e_hdr->daddr, daddr); ether_addr_copy(e_hdr->saddr, saddr); e_hdr->type = htons(payload_length); @@ -448,7 +444,7 @@ int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv, skb_pull(skb, sizeof(struct wlan_snap)); /* create 802.3 header at beginning of skb. */ - e_hdr = (struct wlan_ethhdr *)skb_push(skb, ETH_HLEN); + e_hdr = skb_push(skb, ETH_HLEN); e_hdr->type = e_snap->type; ether_addr_copy(e_hdr->daddr, daddr); ether_addr_copy(e_hdr->saddr, saddr); @@ -475,7 +471,7 @@ int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv, skb_pull(skb, payload_offset); /* create 802.3 header at beginning of skb. */ - e_hdr = (struct wlan_ethhdr *)skb_push(skb, ETH_HLEN); + e_hdr = skb_push(skb, ETH_HLEN); ether_addr_copy(e_hdr->daddr, daddr); ether_addr_copy(e_hdr->saddr, saddr); e_hdr->type = htons(payload_length); diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c index bdcc8b4c522a..dda13f1af38e 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_target.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c @@ -136,7 +136,7 @@ cxgbit_cpl_tx_data_iso(struct sk_buff *skb, struct cxgbit_iso_info *iso_info) unsigned int fslice = !!(iso_info->flags & CXGBIT_ISO_FSLICE); unsigned int lslice = !!(iso_info->flags & CXGBIT_ISO_LSLICE); - cpl = (struct cpl_tx_data_iso *)__skb_push(skb, sizeof(*cpl)); + cpl = __skb_push(skb, sizeof(*cpl)); cpl->op_to_scsi = htonl(CPL_TX_DATA_ISO_OP_V(CPL_TX_DATA_ISO) | CPL_TX_DATA_ISO_FIRST_V(fslice) | @@ -183,8 +183,7 @@ cxgbit_tx_data_wr(struct cxgbit_sock *csk, struct sk_buff *skb, u32 dlen, if (cxgbit_is_ofld_imm(skb)) immlen += dlen; - req = (struct fw_ofld_tx_data_wr *)__skb_push(skb, - hdr_size); + req = __skb_push(skb, hdr_size); req->op_to_immdlen = cpu_to_be32(FW_WR_OP_V(opcode) | FW_WR_COMPL_V(compl) | FW_WR_IMMDLEN_V(immlen)); diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c index a3b5e468b116..d6341045c631 100644 --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -999,7 +999,7 @@ void rndis_add_hdr(struct sk_buff *skb) if (!skb) return; - header = (void *)skb_push(skb, sizeof(*header)); + header = skb_push(skb, sizeof(*header)); memset(header, 0, sizeof *header); header->MessageType = cpu_to_le32(RNDIS_MSG_PACKET); header->MessageLength = cpu_to_le32(skb->len); diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 283dc2f5364d..5e6a2d4dc366 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -318,7 +318,7 @@ static inline int __vlan_insert_tag(struct sk_buff *skb, if (skb_cow_head(skb, VLAN_HLEN) < 0) return -ENOMEM; - veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); + veth = skb_push(skb, VLAN_HLEN); /* Move the mac addresses to the beginning of the new header. */ memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN); diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ac9d10dadd1a..46bd514e719c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1923,8 +1923,8 @@ static inline void *skb_put_data(struct sk_buff *skb, const void *data, return tmp; } -unsigned char *skb_push(struct sk_buff *skb, unsigned int len); -static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) +void *skb_push(struct sk_buff *skb, unsigned int len); +static inline void *__skb_push(struct sk_buff *skb, unsigned int len) { skb->data -= len; skb->len += len; @@ -2951,8 +2951,7 @@ void *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); * that the checksum difference is zero (e.g., a valid IP header) * or you are setting ip_summed to CHECKSUM_NONE. */ -static inline unsigned char *skb_push_rcsum(struct sk_buff *skb, - unsigned int len) +static inline void *skb_push_rcsum(struct sk_buff *skb, unsigned int len) { skb_push(skb, len); skb_postpush_rcsum(skb, skb->data, len); diff --git a/net/802/fc.c b/net/802/fc.c index 1bb496ea997e..058a9f708918 100644 --- a/net/802/fc.c +++ b/net/802/fc.c @@ -49,7 +49,7 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev, struct fcllc *fcllc; hdr_len = sizeof(struct fch_hdr) + sizeof(struct fcllc); - fch = (struct fch_hdr *)skb_push(skb, hdr_len); + fch = skb_push(skb, hdr_len); fcllc = (struct fcllc *)(fch+1); fcllc->dsap = fcllc->ssap = EXTENDED_SAP; fcllc->llc = UI_CMD; @@ -59,7 +59,7 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev, else { hdr_len = sizeof(struct fch_hdr); - fch = (struct fch_hdr *)skb_push(skb, hdr_len); + fch = skb_push(skb, hdr_len); } if(saddr) diff --git a/net/802/fddi.c b/net/802/fddi.c index 6356623fc238..90f1416567a1 100644 --- a/net/802/fddi.c +++ b/net/802/fddi.c @@ -58,7 +58,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev, if(type != ETH_P_IP && type != ETH_P_IPV6 && type != ETH_P_ARP) hl=FDDI_K_8022_HLEN-3; - fddi = (struct fddihdr *)skb_push(skb, hl); + fddi = skb_push(skb, hl); fddi->fc = FDDI_FC_K_ASYNC_LLC_DEF; if(type == ETH_P_IP || type == ETH_P_IPV6 || type == ETH_P_ARP) { diff --git a/net/802/hippi.c b/net/802/hippi.c index 4460606e9c36..690308b9b94a 100644 --- a/net/802/hippi.c +++ b/net/802/hippi.c @@ -47,7 +47,7 @@ static int hippi_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *daddr, const void *saddr, unsigned int len) { - struct hippi_hdr *hip = (struct hippi_hdr *)skb_push(skb, HIPPI_HLEN); + struct hippi_hdr *hip = skb_push(skb, HIPPI_HLEN); struct hippi_cb *hcb = (struct hippi_cb *) skb->cb; if (!len){ diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index c1742322f7d2..f7e83f6d2e64 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -58,7 +58,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, int rc; if (!(vlan->flags & VLAN_FLAG_REORDER_HDR)) { - vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN); + vhdr = skb_push(skb, VLAN_HLEN); vlan_tci = vlan->vlan_id; vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb->priority); diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index c7af6dc70fa2..5d035c1f1156 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -1529,7 +1529,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, * The push leaves us with a ddephdr not an shdr, and * handily the port bytes in the right place preset. */ - ddp = (struct ddpehdr *) skb_push(skb, sizeof(*ddp) - 4); + ddp = skb_push(skb, sizeof(*ddp) - 4); /* Now fill in the long header */ diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index b7c486752b3a..0c92ba0cbe0b 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1562,7 +1562,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) /* Add the PID if one is not supplied by the user in the skb */ if (!ax25->pidincl) - *skb_push(skb, 1) = sk->sk_protocol; + *(u8 *)skb_push(skb, 1) = sk->sk_protocol; if (sk->sk_type == SOCK_SEQPACKET) { /* Connected mode sockets go via the LAPB machine */ diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 1301a8786d8d..cdb5c1a7481e 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -332,7 +332,7 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb) return; /* Put header before the data */ - hdr = (void *)skb_push(skb_copy, HCI_MON_HDR_SIZE); + hdr = skb_push(skb_copy, HCI_MON_HDR_SIZE); hdr->opcode = opcode; hdr->index = cpu_to_le16(hdev->id); hdr->len = cpu_to_le16(skb->len); @@ -383,7 +383,7 @@ void hci_send_monitor_ctrl_event(struct hci_dev *hdev, u16 event, skb->tstamp = tstamp; - hdr = (void *)skb_push(skb, HCI_MON_HDR_SIZE); + hdr = skb_push(skb, HCI_MON_HDR_SIZE); hdr->opcode = cpu_to_le16(HCI_MON_CTRL_EVENT); hdr->index = index; hdr->len = cpu_to_le16(skb->len - HCI_MON_HDR_SIZE); @@ -467,7 +467,7 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event) __net_timestamp(skb); - hdr = (void *)skb_push(skb, HCI_MON_HDR_SIZE); + hdr = skb_push(skb, HCI_MON_HDR_SIZE); hdr->opcode = opcode; hdr->index = cpu_to_le16(hdev->id); hdr->len = cpu_to_le16(skb->len - HCI_MON_HDR_SIZE); @@ -522,7 +522,7 @@ static struct sk_buff *create_monitor_ctrl_open(struct sock *sk) __net_timestamp(skb); - hdr = (void *)skb_push(skb, HCI_MON_HDR_SIZE); + hdr = skb_push(skb, HCI_MON_HDR_SIZE); hdr->opcode = cpu_to_le16(HCI_MON_CTRL_OPEN); if (hci_pi(sk)->hdev) hdr->index = cpu_to_le16(hci_pi(sk)->hdev->id); @@ -560,7 +560,7 @@ static struct sk_buff *create_monitor_ctrl_close(struct sock *sk) __net_timestamp(skb); - hdr = (void *)skb_push(skb, HCI_MON_HDR_SIZE); + hdr = skb_push(skb, HCI_MON_HDR_SIZE); hdr->opcode = cpu_to_le16(HCI_MON_CTRL_CLOSE); if (hci_pi(sk)->hdev) hdr->index = cpu_to_le16(hci_pi(sk)->hdev->id); @@ -590,7 +590,7 @@ static struct sk_buff *create_monitor_ctrl_command(struct sock *sk, u16 index, __net_timestamp(skb); - hdr = (void *)skb_push(skb, HCI_MON_HDR_SIZE); + hdr = skb_push(skb, HCI_MON_HDR_SIZE); hdr->opcode = cpu_to_le16(HCI_MON_CTRL_COMMAND); hdr->index = cpu_to_le16(index); hdr->len = cpu_to_le16(skb->len - HCI_MON_HDR_SIZE); diff --git a/net/bluetooth/mgmt_util.c b/net/bluetooth/mgmt_util.c index d057113e0d4b..0d0a6d77b9e8 100644 --- a/net/bluetooth/mgmt_util.c +++ b/net/bluetooth/mgmt_util.c @@ -48,7 +48,7 @@ static struct sk_buff *create_monitor_ctrl_event(__le16 index, u32 cookie, __net_timestamp(skb); - hdr = (void *)skb_push(skb, HCI_MON_HDR_SIZE); + hdr = skb_push(skb, HCI_MON_HDR_SIZE); hdr->opcode = cpu_to_le16(HCI_MON_CTRL_EVENT); hdr->index = index; hdr->len = cpu_to_le16(skb->len - HCI_MON_HDR_SIZE); diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 1a9b906c5a35..4a0b41d75c84 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -1149,10 +1149,10 @@ static void rfcomm_make_uih(struct sk_buff *skb, u8 addr) u8 *crc; if (len > 127) { - hdr = (void *) skb_push(skb, 4); + hdr = skb_push(skb, 4); put_unaligned(cpu_to_le16(__len16(len)), (__le16 *) &hdr->len); } else { - hdr = (void *) skb_push(skb, 3); + hdr = skb_push(skb, 3); hdr->len = __len8(len); } hdr->addr = addr; diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c index 15bf0c5322ab..a05775afa44b 100644 --- a/net/bridge/netfilter/nft_reject_bridge.c +++ b/net/bridge/netfilter/nft_reject_bridge.c @@ -28,7 +28,7 @@ static void nft_reject_br_push_etherhdr(struct sk_buff *oldskb, { struct ethhdr *eth; - eth = (struct ethhdr *)skb_push(nskb, ETH_HLEN); + eth = skb_push(nskb, ETH_HLEN); skb_reset_mac_header(nskb); ether_addr_copy(eth->h_source, eth_hdr(oldskb)->h_dest); ether_addr_copy(eth->h_dest, eth_hdr(oldskb)->h_source); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 29be2466970c..37c1e34ddd85 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -441,7 +441,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) ip6h->saddr = np->local_ip.in6; ip6h->daddr = np->remote_ip.in6; - eth = (struct ethhdr *) skb_push(skb, ETH_HLEN); + eth = skb_push(skb, ETH_HLEN); skb_reset_mac_header(skb); skb->protocol = eth->h_proto = htons(ETH_P_IPV6); } else { @@ -470,7 +470,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) put_unaligned(np->remote_ip.ip, &(iph->daddr)); iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); - eth = (struct ethhdr *) skb_push(skb, ETH_HLEN); + eth = skb_push(skb, ETH_HLEN); skb_reset_mac_header(skb); skb->protocol = eth->h_proto = htons(ETH_P_IP); } diff --git a/net/core/pktgen.c b/net/core/pktgen.c index b8bcf9021329..2dd42c5b0366 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2675,7 +2675,7 @@ static int process_ipsec(struct pktgen_dev *pkt_dev, goto err; } /* restore ll */ - eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); + eth = skb_push(skb, ETH_HLEN); memcpy(eth, pkt_dev->hh, 2 * ETH_ALEN); eth->h_proto = protocol; @@ -2844,7 +2844,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, skb_reserve(skb, 16); /* Reserve for ethernet and IP header */ - eth = (__u8 *) skb_push(skb, 14); + eth = skb_push(skb, 14); mpls = skb_put(skb, pkt_dev->nr_labels * sizeof(__u32)); if (pkt_dev->nr_labels) mpls_push(mpls, pkt_dev); @@ -2972,7 +2972,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, skb_reserve(skb, 16); /* Reserve for ethernet and IP header */ - eth = (__u8 *) skb_push(skb, 14); + eth = skb_push(skb, 14); mpls = skb_put(skb, pkt_dev->nr_labels * sizeof(__u32)); if (pkt_dev->nr_labels) mpls_push(mpls, pkt_dev); diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 9a1639f7d61a..f75897a33fa4 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -1461,7 +1461,7 @@ EXPORT_SYMBOL(skb_put); * start. If this would exceed the total buffer headroom the kernel will * panic. A pointer to the first byte of the extra data is returned. */ -unsigned char *skb_push(struct sk_buff *skb, unsigned int len) +void *skb_push(struct sk_buff *skb, unsigned int len) { skb->data -= len; skb->len += len; diff --git a/net/dccp/options.c b/net/dccp/options.c index 74d29c56c367..51cdfc3bd8ca 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c @@ -484,7 +484,7 @@ int dccp_insert_option_mandatory(struct sk_buff *skb) return -1; DCCP_SKB_CB(skb)->dccpd_opt_len++; - *skb_push(skb, 1) = DCCPO_MANDATORY; + *(u8 *)skb_push(skb, 1) = DCCPO_MANDATORY; return 0; } diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 1d84f6dae315..fa0110b57ca1 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -867,7 +867,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) msg->datalen = 0x02; memset(msg->data, 0xAA, 2); - pktlen = (__le16 *)skb_push(skb,2); + pktlen = skb_push(skb, 2); *pktlen = cpu_to_le16(skb->len - 2); skb_reset_network_header(skb); @@ -959,7 +959,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa) skb_trim(skb, (27 + *i2)); - pktlen = (__le16 *)skb_push(skb, 2); + pktlen = skb_push(skb, 2); *pktlen = cpu_to_le16(skb->len - 2); skb_reset_network_header(skb); diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 1446810047f5..eaeba9b99a73 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -83,7 +83,7 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *daddr, const void *saddr, unsigned int len) { - struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); + struct ethhdr *eth = skb_push(skb, ETH_HLEN); if (type != ETH_P_802_3 && type != ETH_P_802_2) eth->h_proto = htons(type); diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index d815d1755473..1f18b4650253 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -609,7 +609,7 @@ static void esp_input_set_header(struct sk_buff *skb, __be32 *seqhi) * decryption. */ if ((x->props.flags & XFRM_STATE_ESN)) { - esph = (void *)skb_push(skb, 4); + esph = skb_push(skb, 4); *seqhi = esph->spi; esph->spi = esph->seq_no; esph->seq_no = XFRM_SKB_CB(skb)->seq.input.hi; diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index e90c80a548ad..41394a4b9af9 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -592,7 +592,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, struct iphdr *iph; struct gre_base_hdr *greh; - iph = (struct iphdr *)skb_push(skb, t->hlen + sizeof(*iph)); + iph = skb_push(skb, t->hlen + sizeof(*iph)); greh = (struct gre_base_hdr *)(iph+1); greh->flags = gre_tnl_flags_to_gre_flags(t->parms.o_flags); greh->protocol = htons(type); diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 2ede4e459c4e..d8b40ff4b2e6 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -538,7 +538,7 @@ static void esp_input_set_header(struct sk_buff *skb, __be32 *seqhi) * decryption. */ if ((x->props.flags & XFRM_STATE_ESN)) { - esph = (void *)skb_push(skb, 4); + esph = skb_push(skb, 4); *seqhi = esph->spi; esph->spi = esph->seq_no; esph->seq_no = XFRM_SKB_CB(skb)->seq.input.hi; diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index b636f1da9aec..0460af226011 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -847,7 +847,7 @@ static void ipv6_push_rthdr0(struct sk_buff *skb, u8 *proto, ihdr = (struct rt0_hdr *) opt; - phdr = (struct rt0_hdr *) skb_push(skb, (ihdr->rt_hdr.hdrlen + 1) << 3); + phdr = skb_push(skb, (ihdr->rt_hdr.hdrlen + 1) << 3); memcpy(phdr, ihdr, sizeof(struct rt0_hdr)); hops = ihdr->rt_hdr.hdrlen >> 1; @@ -873,7 +873,7 @@ static void ipv6_push_rthdr4(struct sk_buff *skb, u8 *proto, sr_ihdr = (struct ipv6_sr_hdr *)opt; plen = (sr_ihdr->hdrlen + 1) << 3; - sr_phdr = (struct ipv6_sr_hdr *)skb_push(skb, plen); + sr_phdr = skb_push(skb, plen); memcpy(sr_phdr, sr_ihdr, sizeof(struct ipv6_sr_hdr)); hops = sr_ihdr->first_segment + 1; @@ -923,7 +923,7 @@ static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto, static void ipv6_push_exthdr(struct sk_buff *skb, u8 *proto, u8 type, struct ipv6_opt_hdr *opt) { - struct ipv6_opt_hdr *h = (struct ipv6_opt_hdr *)skb_push(skb, ipv6_optlen(opt)); + struct ipv6_opt_hdr *h = skb_push(skb, ipv6_optlen(opt)); memcpy(h, opt, ipv6_optlen(opt)); h->nexthdr = *proto; diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 64eea3962733..e0e726c338a7 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -942,7 +942,7 @@ static int ip6gre_header(struct sk_buff *skb, struct net_device *dev, const void *daddr, const void *saddr, unsigned int len) { struct ip6_tnl *t = netdev_priv(dev); - struct ipv6hdr *ipv6h = (struct ipv6hdr *)skb_push(skb, t->hlen); + struct ipv6hdr *ipv6h = skb_push(skb, t->hlen); __be16 *p = (__be16 *)(ipv6h+1); ip6_flow_hdr(ipv6h, 0, diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 0d6f3b6345de..8b8efb0e55bf 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -682,7 +682,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, skb_frag_list_init(skb); __skb_pull(skb, hlen); - fh = (struct frag_hdr *)__skb_push(skb, sizeof(struct frag_hdr)); + fh = __skb_push(skb, sizeof(struct frag_hdr)); __skb_push(skb, hlen); skb_reset_network_header(skb); memcpy(skb_network_header(skb), tmp_hdr, hlen); @@ -706,7 +706,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, if (frag) { frag->ip_summed = CHECKSUM_NONE; skb_reset_transport_header(frag); - fh = (struct frag_hdr *)__skb_push(frag, sizeof(struct frag_hdr)); + fh = __skb_push(frag, sizeof(struct frag_hdr)); __skb_push(frag, hlen); skb_reset_network_header(frag); memcpy(skb_network_header(frag), tmp_hdr, diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 84ad50218255..6264917fe4c7 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -789,7 +789,7 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); - t1 = (struct tcphdr *) skb_push(buff, tot_len); + t1 = skb_push(buff, tot_len); skb_reset_transport_header(buff); /* Swap the send and the receive. */ diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c index 7f17a8020e8a..e390bceeb2f8 100644 --- a/net/irda/irnet/irnet_irda.c +++ b/net/irda/irnet/irnet_irda.c @@ -1065,7 +1065,7 @@ irnet_data_indication(void * instance, if(p[0] & 1) { /* protocol is compressed */ - skb_push(skb, 1)[0] = 0; + *(u8 *)skb_push(skb, 1) = 0; } else if(skb->len < 2) diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index 84de7b6326dc..2cf9d59f1b72 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c @@ -322,8 +322,7 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock, int err, confirm_recv = 0; memset(skb->head, 0, ETH_HLEN); - phs_hdr = (struct af_iucv_trans_hdr *)skb_push(skb, - sizeof(struct af_iucv_trans_hdr)); + phs_hdr = skb_push(skb, sizeof(struct af_iucv_trans_hdr)); skb_reset_mac_header(skb); skb_reset_network_header(skb); skb_push(skb, ETH_HLEN); diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 53b00bb52095..70e9d2ca8bbe 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -273,7 +273,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, if (!(has_fcs && ieee80211_hw_check(&local->hw, RX_INCLUDES_FCS))) mpdulen += FCS_LEN; - rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len); + rthdr = skb_push(skb, rtap_len); memset(rthdr, 0, rtap_len - rtap.len - rtap.pad); it_present = &rthdr->it_present; diff --git a/net/mac80211/status.c b/net/mac80211/status.c index a9fa6ee57e8f..da7427a41529 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -288,7 +288,7 @@ ieee80211_add_tx_radiotap_header(struct ieee80211_local *local, unsigned char *pos; u16 txflags; - rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); + rthdr = skb_push(skb, rtap_len); memset(rthdr, 0, rtap_len); rthdr->it_len = cpu_to_le16(rtap_len); diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index ec5a9a72797e..8858f4f185e9 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2708,7 +2708,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, if (ieee80211_is_data_qos(fc)) { __le16 *qos_control; - qos_control = (__le16 *) skb_push(skb, 2); + qos_control = skb_push(skb, 2); memcpy(skb_push(skb, hdrlen - 2), &hdr, hdrlen - 2); /* * Maybe we could actually set some fields here, for now just @@ -3347,7 +3347,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, } memcpy(ð, skb->data, ETH_HLEN - 2); - hdr = (void *)skb_push(skb, extra_head); + hdr = skb_push(skb, extra_head); memcpy(skb->data, fast_tx->hdr, fast_tx->hdr_len); memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); diff --git a/net/ncsi/ncsi-cmd.c b/net/ncsi/ncsi-cmd.c index b010ae94175b..5e03ed190e18 100644 --- a/net/ncsi/ncsi-cmd.c +++ b/net/ncsi/ncsi-cmd.c @@ -331,7 +331,7 @@ int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca) } /* Fill the ethernet header */ - eh = (struct ethhdr *)skb_push(nr->cmd, sizeof(*eh)); + eh = skb_push(nr->cmd, sizeof(*eh)); eh->h_proto = htons(ETH_P_NCSI); eth_broadcast_addr(eh->h_dest); eth_broadcast_addr(eh->h_source); diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c index 82471af5553e..f948fc2099d2 100644 --- a/net/nfc/digital_dep.c +++ b/net/nfc/digital_dep.c @@ -185,7 +185,7 @@ static void digital_skb_push_dep_sod(struct nfc_digital_dev *ddev, skb->data[0] = skb->len; if (ddev->curr_rf_tech == NFC_DIGITAL_RF_TECH_106A) - *skb_push(skb, sizeof(u8)) = DIGITAL_NFC_DEP_NFCA_SOD_SB; + *(u8 *)skb_push(skb, sizeof(u8)) = DIGITAL_NFC_DEP_NFCA_SOD_SB; } static int digital_skb_pull_dep_sod(struct nfc_digital_dev *ddev, diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c index fae6d31b377c..492204e440ec 100644 --- a/net/nfc/digital_technology.c +++ b/net/nfc/digital_technology.c @@ -828,7 +828,7 @@ int digital_in_send_sensf_req(struct nfc_digital_dev *ddev, u8 rf_tech) sensf_req->rc = 0; sensf_req->tsn = 0; - *skb_push(skb, 1) = size + 1; + *(u8 *)skb_push(skb, 1) = size + 1; if (!DIGITAL_DRV_CAPS_IN_CRC(ddev)) digital_skb_add_crc_f(skb); @@ -1161,7 +1161,7 @@ static int digital_tg_send_sensf_res(struct nfc_digital_dev *ddev, break; } - *skb_push(skb, sizeof(u8)) = size + 1; + *(u8 *)skb_push(skb, sizeof(u8)) = size + 1; if (!DIGITAL_DRV_CAPS_TG_CRC(ddev)) digital_skb_add_crc_f(skb); diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 3a0c94590411..7b2bdda1514c 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c @@ -727,7 +727,7 @@ static int hci_transceive(struct nfc_dev *nfc_dev, struct nfc_target *target, break; } - *skb_push(skb, 1) = 0; /* CTR, see spec:10.2.2.1 */ + *(u8 *)skb_push(skb, 1) = 0; /* CTR, see spec:10.2.2.1 */ hdev->async_cb_type = HCI_CB_TYPE_TRANSCEIVE; hdev->async_cb = cb; diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c index 9ab4a05f086f..5bd4529279f5 100644 --- a/net/nfc/hci/llc_shdlc.c +++ b/net/nfc/hci/llc_shdlc.c @@ -160,7 +160,7 @@ static int llc_shdlc_send_s_frame(struct llc_shdlc *shdlc, if (skb == NULL) return -ENOMEM; - *skb_push(skb, 1) = SHDLC_CONTROL_HEAD_S | (sframe_type << 3) | nr; + *(u8 *)skb_push(skb, 1) = SHDLC_CONTROL_HEAD_S | (sframe_type << 3) | nr; r = shdlc->xmit_to_drv(shdlc->hdev, skb); @@ -178,7 +178,7 @@ static int llc_shdlc_send_u_frame(struct llc_shdlc *shdlc, pr_debug("uframe_modifier=%d\n", uframe_modifier); - *skb_push(skb, 1) = SHDLC_CONTROL_HEAD_U | uframe_modifier; + *(u8 *)skb_push(skb, 1) = SHDLC_CONTROL_HEAD_U | uframe_modifier; r = shdlc->xmit_to_drv(shdlc->hdev, skb); @@ -551,8 +551,8 @@ static void llc_shdlc_handle_send_queue(struct llc_shdlc *shdlc) skb = skb_dequeue(&shdlc->send_q); - *skb_push(skb, 1) = SHDLC_CONTROL_HEAD_I | (shdlc->ns << 3) | - shdlc->nr; + *(u8 *)skb_push(skb, 1) = SHDLC_CONTROL_HEAD_I | (shdlc->ns << 3) | + shdlc->nr; pr_debug("Sending I-Frame %d, waiting to rcv %d\n", shdlc->ns, shdlc->nr); diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c index 2488d9241f1d..908f25e3773e 100644 --- a/net/nfc/nci/data.c +++ b/net/nfc/nci/data.c @@ -81,7 +81,7 @@ static inline void nci_push_data_hdr(struct nci_dev *ndev, struct nci_data_hdr *hdr; int plen = skb->len; - hdr = (struct nci_data_hdr *) skb_push(skb, NCI_DATA_HDR_SIZE); + hdr = skb_push(skb, NCI_DATA_HDR_SIZE); hdr->conn_id = conn_id; hdr->rfu = 0; hdr->plen = plen; diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c index d1119bb35f24..3f93df58d9f1 100644 --- a/net/nfc/nci/hci.c +++ b/net/nfc/nci/hci.c @@ -170,7 +170,7 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, return -ENOMEM; skb_reserve(skb, NCI_DATA_HDR_SIZE + 2); - *skb_push(skb, 1) = data_type; + *(u8 *)skb_push(skb, 1) = data_type; do { len = conn_info->max_pkt_payload_len; @@ -184,7 +184,7 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, len = conn_info->max_pkt_payload_len - skb->len - 1; } - *skb_push(skb, 1) = cb; + *(u8 *)skb_push(skb, 1) = cb; if (len > 0) skb_put_data(skb, data + i, len); diff --git a/net/nfc/nci/spi.c b/net/nfc/nci/spi.c index a502a334918a..3b4512731a2f 100644 --- a/net/nfc/nci/spi.c +++ b/net/nfc/nci/spi.c @@ -238,8 +238,8 @@ static struct sk_buff *__nci_spi_read(struct nci_spi *nspi) goto receive_error; if (nspi->acknowledge_mode == NCI_SPI_CRC_ENABLED) { - *skb_push(skb, 1) = resp_hdr[1]; - *skb_push(skb, 1) = resp_hdr[0]; + *(u8 *)skb_push(skb, 1) = resp_hdr[1]; + *(u8 *)skb_push(skb, 1) = resp_hdr[0]; } return skb; diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c index e386e6c90b17..e2188deb08dc 100644 --- a/net/nfc/rawsock.c +++ b/net/nfc/rawsock.c @@ -142,7 +142,7 @@ error: static int rawsock_add_header(struct sk_buff *skb) { - *skb_push(skb, NFC_HEADER_SIZE) = 0; + *(u8 *)skb_push(skb, NFC_HEADER_SIZE) = 0; return 0; } diff --git a/net/sctp/output.c b/net/sctp/output.c index febcc350cf00..89cee1482d35 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -585,7 +585,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) sctp_packet_set_owner_w(head, sk); /* set sctp header */ - sh = (struct sctphdr *)skb_push(head, sizeof(struct sctphdr)); + sh = skb_push(head, sizeof(struct sctphdr)); skb_reset_transport_header(head); sh->source = htons(packet->source_port); sh->dest = htons(packet->destination_port); diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index df73190da761..8feff96a5bef 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -770,8 +770,8 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, auth.skb = chunk->auth_chunk; auth.asoc = chunk->asoc; auth.sctp_hdr = chunk->sctp_hdr; - auth.chunk_hdr = (sctp_chunkhdr_t *)skb_push(chunk->auth_chunk, - sizeof(sctp_chunkhdr_t)); + auth.chunk_hdr = skb_push(chunk->auth_chunk, + sizeof(sctp_chunkhdr_t)); skb_pull(chunk->auth_chunk, sizeof(sctp_chunkhdr_t)); auth.transport = chunk->transport; diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index e361f0b57fb6..17854fb0e512 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c @@ -153,8 +153,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); /* Include the notification structure */ - sac = (struct sctp_assoc_change *) - skb_push(skb, sizeof(struct sctp_assoc_change)); + sac = skb_push(skb, sizeof(struct sctp_assoc_change)); /* Trim the buffer to the right length. */ skb_trim(skb, sizeof(struct sctp_assoc_change) + @@ -400,7 +399,7 @@ sctp_ulpevent_make_remote_error(const struct sctp_association *asoc, event = sctp_skb2event(skb); sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); - sre = (struct sctp_remote_error *) skb_push(skb, sizeof(*sre)); + sre = skb_push(skb, sizeof(*sre)); /* Trim the buffer to the right length. */ skb_trim(skb, sizeof(*sre) + elen); @@ -451,8 +450,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_send_failed( event = sctp_skb2event(skb); sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); - ssf = (struct sctp_send_failed *) - skb_push(skb, sizeof(struct sctp_send_failed)); + ssf = skb_push(skb, sizeof(struct sctp_send_failed)); /* Socket Extensions for SCTP * 5.3.1.4 SCTP_SEND_FAILED diff --git a/net/wireless/util.c b/net/wireless/util.c index 96613fe2c6b1..bcb1284c3415 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -522,7 +522,7 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, pskb_pull(skb, hdrlen); if (!ehdr) - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr)); + ehdr = skb_push(skb, sizeof(struct ethhdr)); memcpy(ehdr, &tmp, sizeof(tmp)); return 0; -- cgit v1.2.3-55-g7522 From ac6424b981bce1c4bc55675c6ce11bfe1bbfa64f Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Tue, 20 Jun 2017 12:06:13 +0200 Subject: sched/wait: Rename wait_queue_t => wait_queue_entry_t Rename: wait_queue_t => wait_queue_entry_t 'wait_queue_t' was always a slight misnomer: its name implies that it's a "queue", but in reality it's a queue *entry*. The 'real' queue is the wait queue head, which had to carry the name. Start sorting this out by renaming it to 'wait_queue_entry_t'. This also allows the real structure name 'struct __wait_queue' to lose its double underscore and become 'struct wait_queue_entry', which is the more canonical nomenclature for such data types. Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- Documentation/DocBook/kernel-hacking.tmpl | 2 +- Documentation/filesystems/autofs4.txt | 12 ++-- block/blk-mq.c | 2 +- block/blk-wbt.c | 2 +- block/kyber-iosched.c | 8 +-- drivers/bluetooth/btmrvl_main.c | 2 +- drivers/char/ipmi/ipmi_watchdog.c | 2 +- drivers/gpu/drm/i915/i915_gem_request.h | 2 +- drivers/gpu/drm/i915/i915_sw_fence.c | 14 ++--- drivers/gpu/drm/i915/i915_sw_fence.h | 2 +- drivers/gpu/drm/radeon/radeon.h | 2 +- drivers/gpu/drm/radeon/radeon_fence.c | 2 +- drivers/gpu/vga/vgaarb.c | 2 +- drivers/infiniband/hw/i40iw/i40iw_main.c | 2 +- drivers/md/bcache/btree.h | 2 +- drivers/net/ethernet/cavium/liquidio/octeon_main.h | 4 +- drivers/net/wireless/cisco/airo.c | 2 +- .../net/wireless/intersil/hostap/hostap_ioctl.c | 2 +- drivers/net/wireless/marvell/libertas/main.c | 2 +- drivers/scsi/dpt/dpti_i2o.h | 2 +- drivers/scsi/ips.c | 12 ++-- drivers/scsi/ips.h | 4 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 6 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 4 +- drivers/staging/lustre/lnet/libcfs/debug.c | 2 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 6 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 4 +- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 2 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 2 +- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +- drivers/tty/synclink_gt.c | 2 +- drivers/vfio/virqfd.c | 2 +- drivers/vhost/vhost.c | 2 +- drivers/vhost/vhost.h | 2 +- fs/autofs4/autofs_i.h | 2 +- fs/autofs4/waitq.c | 18 +++--- fs/cachefiles/internal.h | 2 +- fs/cachefiles/namei.c | 2 +- fs/cachefiles/rdwr.c | 2 +- fs/dax.c | 4 +- fs/eventfd.c | 2 +- fs/eventpoll.c | 10 ++-- fs/fs_pin.c | 2 +- fs/nfs/nfs4proc.c | 4 +- fs/nilfs2/segment.c | 2 +- fs/orangefs/orangefs-bufmap.c | 4 +- fs/reiserfs/journal.c | 2 +- fs/select.c | 4 +- fs/signalfd.c | 2 +- fs/userfaultfd.c | 8 +-- include/linux/blk-mq.h | 2 +- include/linux/eventfd.h | 4 +- include/linux/kvm_irqfd.h | 2 +- include/linux/pagemap.h | 2 +- include/linux/poll.h | 2 +- include/linux/vfio.h | 2 +- include/linux/wait.h | 67 +++++++++++----------- include/net/af_unix.h | 2 +- include/uapi/linux/auto_fs.h | 4 +- include/uapi/linux/auto_fs4.h | 4 +- kernel/exit.c | 4 +- kernel/futex.c | 2 +- kernel/sched/completion.c | 2 +- kernel/sched/core.c | 2 +- kernel/sched/wait.c | 42 +++++++------- kernel/workqueue.c | 4 +- mm/filemap.c | 10 ++-- mm/memcontrol.c | 8 +-- mm/mempool.c | 2 +- mm/shmem.c | 2 +- net/9p/trans_fd.c | 4 +- net/bluetooth/bnep/core.c | 2 +- net/bluetooth/cmtp/core.c | 2 +- net/bluetooth/hidp/core.c | 2 +- net/core/datagram.c | 2 +- net/unix/af_unix.c | 4 +- sound/core/control.c | 2 +- sound/core/hwdep.c | 2 +- sound/core/init.c | 2 +- sound/core/oss/pcm_oss.c | 4 +- sound/core/pcm_lib.c | 2 +- sound/core/pcm_native.c | 4 +- sound/core/rawmidi.c | 8 +-- sound/core/seq/seq_fifo.c | 2 +- sound/core/seq/seq_memory.c | 2 +- sound/core/timer.c | 2 +- sound/isa/wavefront/wavefront_synth.c | 2 +- sound/pci/mixart/mixart_core.c | 4 +- sound/pci/ymfpci/ymfpci_main.c | 2 +- virt/kvm/eventfd.c | 2 +- 94 files changed, 216 insertions(+), 213 deletions(-) (limited to 'drivers/staging') diff --git a/Documentation/DocBook/kernel-hacking.tmpl b/Documentation/DocBook/kernel-hacking.tmpl index da5c087462b1..c3c705591532 100644 --- a/Documentation/DocBook/kernel-hacking.tmpl +++ b/Documentation/DocBook/kernel-hacking.tmpl @@ -819,7 +819,7 @@ printk(KERN_INFO "my ip: %pI4\n", &ipaddress); certain condition is true. They must be used carefully to ensure there is no race condition. You declare a wait_queue_head_t, and then processes which want to - wait for that condition declare a wait_queue_t + wait for that condition declare a wait_queue_entry_t referring to themselves, and place that in the queue. diff --git a/Documentation/filesystems/autofs4.txt b/Documentation/filesystems/autofs4.txt index f10dd590f69f..8444dc3d57e8 100644 --- a/Documentation/filesystems/autofs4.txt +++ b/Documentation/filesystems/autofs4.txt @@ -316,7 +316,7 @@ For version 5, the format of the message is: struct autofs_v5_packet { int proto_version; /* Protocol version */ int type; /* Type of packet */ - autofs_wqt_t wait_queue_token; + autofs_wqt_t wait_queue_entry_token; __u32 dev; __u64 ino; __u32 uid; @@ -341,12 +341,12 @@ The pipe will be set to "packet mode" (equivalent to passing `O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at most one packet, and any unread portion of a packet will be discarded. -The `wait_queue_token` is a unique number which can identify a +The `wait_queue_entry_token` is a unique number which can identify a particular request to be acknowledged. When a message is sent over the pipe the affected dentry is marked as either "active" or "expiring" and other accesses to it block until the message is acknowledged using one of the ioctls below and the relevant -`wait_queue_token`. +`wait_queue_entry_token`. Communicating with autofs: root directory ioctls ------------------------------------------------ @@ -358,7 +358,7 @@ capability, or must be the automount daemon. The available ioctl commands are: - **AUTOFS_IOC_READY**: a notification has been handled. The argument - to the ioctl command is the "wait_queue_token" number + to the ioctl command is the "wait_queue_entry_token" number corresponding to the notification being acknowledged. - **AUTOFS_IOC_FAIL**: similar to above, but indicates failure with the error code `ENOENT`. @@ -382,14 +382,14 @@ The available ioctl commands are: struct autofs_packet_expire_multi { int proto_version; /* Protocol version */ int type; /* Type of packet */ - autofs_wqt_t wait_queue_token; + autofs_wqt_t wait_queue_entry_token; int len; char name[NAME_MAX+1]; }; is required. This is filled in with the name of something that can be unmounted or removed. If nothing can be expired, - `errno` is set to `EAGAIN`. Even though a `wait_queue_token` + `errno` is set to `EAGAIN`. Even though a `wait_queue_entry_token` is present in the structure, no "wait queue" is established and no acknowledgment is needed. - **AUTOFS_IOC_EXPIRE_MULTI**: This is similar to diff --git a/block/blk-mq.c b/block/blk-mq.c index bb66c96850b1..a083f95e04b1 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -926,7 +926,7 @@ static bool reorder_tags_to_front(struct list_head *list) return first != NULL; } -static int blk_mq_dispatch_wake(wait_queue_t *wait, unsigned mode, int flags, +static int blk_mq_dispatch_wake(wait_queue_entry_t *wait, unsigned mode, int flags, void *key) { struct blk_mq_hw_ctx *hctx; diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 17676f4d7fd1..5f3a37c2784c 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -503,7 +503,7 @@ static inline unsigned int get_limit(struct rq_wb *rwb, unsigned long rw) } static inline bool may_queue(struct rq_wb *rwb, struct rq_wait *rqw, - wait_queue_t *wait, unsigned long rw) + wait_queue_entry_t *wait, unsigned long rw) { /* * inc it here even if disabled, since we'll dec it at completion. diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c index b9faabc75fdb..b95d6bd714c0 100644 --- a/block/kyber-iosched.c +++ b/block/kyber-iosched.c @@ -99,7 +99,7 @@ struct kyber_hctx_data { struct list_head rqs[KYBER_NUM_DOMAINS]; unsigned int cur_domain; unsigned int batching; - wait_queue_t domain_wait[KYBER_NUM_DOMAINS]; + wait_queue_entry_t domain_wait[KYBER_NUM_DOMAINS]; atomic_t wait_index[KYBER_NUM_DOMAINS]; }; @@ -507,7 +507,7 @@ static void kyber_flush_busy_ctxs(struct kyber_hctx_data *khd, } } -static int kyber_domain_wake(wait_queue_t *wait, unsigned mode, int flags, +static int kyber_domain_wake(wait_queue_entry_t *wait, unsigned mode, int flags, void *key) { struct blk_mq_hw_ctx *hctx = READ_ONCE(wait->private); @@ -523,7 +523,7 @@ static int kyber_get_domain_token(struct kyber_queue_data *kqd, { unsigned int sched_domain = khd->cur_domain; struct sbitmap_queue *domain_tokens = &kqd->domain_tokens[sched_domain]; - wait_queue_t *wait = &khd->domain_wait[sched_domain]; + wait_queue_entry_t *wait = &khd->domain_wait[sched_domain]; struct sbq_wait_state *ws; int nr; @@ -734,7 +734,7 @@ static int kyber_##name##_waiting_show(void *data, struct seq_file *m) \ { \ struct blk_mq_hw_ctx *hctx = data; \ struct kyber_hctx_data *khd = hctx->sched_data; \ - wait_queue_t *wait = &khd->domain_wait[domain]; \ + wait_queue_entry_t *wait = &khd->domain_wait[domain]; \ \ seq_printf(m, "%d\n", !list_empty_careful(&wait->task_list)); \ return 0; \ diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index c38cb5b91291..fe850f0567cb 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c @@ -602,7 +602,7 @@ static int btmrvl_service_main_thread(void *data) struct btmrvl_thread *thread = data; struct btmrvl_private *priv = thread->priv; struct btmrvl_adapter *adapter = priv->adapter; - wait_queue_t wait; + wait_queue_entry_t wait; struct sk_buff *skb; ulong flags; diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index d165af8abe36..a5c6cfe71a8e 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -821,7 +821,7 @@ static ssize_t ipmi_read(struct file *file, loff_t *ppos) { int rv = 0; - wait_queue_t wait; + wait_queue_entry_t wait; if (count <= 0) return 0; diff --git a/drivers/gpu/drm/i915/i915_gem_request.h b/drivers/gpu/drm/i915/i915_gem_request.h index 129c58bb4805..a4a920c4c454 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.h +++ b/drivers/gpu/drm/i915/i915_gem_request.h @@ -123,7 +123,7 @@ struct drm_i915_gem_request { * It is used by the driver to then queue the request for execution. */ struct i915_sw_fence submit; - wait_queue_t submitq; + wait_queue_entry_t submitq; wait_queue_head_t execute; /* A list of everyone we wait upon, and everyone who waits upon us. diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c index a277f8eb7beb..8669bfa33064 100644 --- a/drivers/gpu/drm/i915/i915_sw_fence.c +++ b/drivers/gpu/drm/i915/i915_sw_fence.c @@ -152,7 +152,7 @@ static void __i915_sw_fence_wake_up_all(struct i915_sw_fence *fence, struct list_head *continuation) { wait_queue_head_t *x = &fence->wait; - wait_queue_t *pos, *next; + wait_queue_entry_t *pos, *next; unsigned long flags; debug_fence_deactivate(fence); @@ -254,7 +254,7 @@ void i915_sw_fence_commit(struct i915_sw_fence *fence) __i915_sw_fence_commit(fence); } -static int i915_sw_fence_wake(wait_queue_t *wq, unsigned mode, int flags, void *key) +static int i915_sw_fence_wake(wait_queue_entry_t *wq, unsigned mode, int flags, void *key) { list_del(&wq->task_list); __i915_sw_fence_complete(wq->private, key); @@ -267,7 +267,7 @@ static int i915_sw_fence_wake(wait_queue_t *wq, unsigned mode, int flags, void * static bool __i915_sw_fence_check_if_after(struct i915_sw_fence *fence, const struct i915_sw_fence * const signaler) { - wait_queue_t *wq; + wait_queue_entry_t *wq; if (__test_and_set_bit(I915_SW_FENCE_CHECKED_BIT, &fence->flags)) return false; @@ -288,7 +288,7 @@ static bool __i915_sw_fence_check_if_after(struct i915_sw_fence *fence, static void __i915_sw_fence_clear_checked_bit(struct i915_sw_fence *fence) { - wait_queue_t *wq; + wait_queue_entry_t *wq; if (!__test_and_clear_bit(I915_SW_FENCE_CHECKED_BIT, &fence->flags)) return; @@ -320,7 +320,7 @@ static bool i915_sw_fence_check_if_after(struct i915_sw_fence *fence, static int __i915_sw_fence_await_sw_fence(struct i915_sw_fence *fence, struct i915_sw_fence *signaler, - wait_queue_t *wq, gfp_t gfp) + wait_queue_entry_t *wq, gfp_t gfp) { unsigned long flags; int pending; @@ -359,7 +359,7 @@ static int __i915_sw_fence_await_sw_fence(struct i915_sw_fence *fence, spin_lock_irqsave(&signaler->wait.lock, flags); if (likely(!i915_sw_fence_done(signaler))) { - __add_wait_queue_tail(&signaler->wait, wq); + __add_wait_queue_entry_tail(&signaler->wait, wq); pending = 1; } else { i915_sw_fence_wake(wq, 0, 0, NULL); @@ -372,7 +372,7 @@ static int __i915_sw_fence_await_sw_fence(struct i915_sw_fence *fence, int i915_sw_fence_await_sw_fence(struct i915_sw_fence *fence, struct i915_sw_fence *signaler, - wait_queue_t *wq) + wait_queue_entry_t *wq) { return __i915_sw_fence_await_sw_fence(fence, signaler, wq, 0); } diff --git a/drivers/gpu/drm/i915/i915_sw_fence.h b/drivers/gpu/drm/i915/i915_sw_fence.h index d31cefbbcc04..fd3c3bf6c8b7 100644 --- a/drivers/gpu/drm/i915/i915_sw_fence.h +++ b/drivers/gpu/drm/i915/i915_sw_fence.h @@ -66,7 +66,7 @@ void i915_sw_fence_commit(struct i915_sw_fence *fence); int i915_sw_fence_await_sw_fence(struct i915_sw_fence *fence, struct i915_sw_fence *after, - wait_queue_t *wq); + wait_queue_entry_t *wq); int i915_sw_fence_await_sw_fence_gfp(struct i915_sw_fence *fence, struct i915_sw_fence *after, gfp_t gfp); diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index c1c8e2208a21..e562a78510ff 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -375,7 +375,7 @@ struct radeon_fence { unsigned ring; bool is_vm_update; - wait_queue_t fence_wake; + wait_queue_entry_t fence_wake; }; int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring); diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index ef09f0a63754..e86f2bd38410 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -158,7 +158,7 @@ int radeon_fence_emit(struct radeon_device *rdev, * for the fence locking itself, so unlocked variants are used for * fence_signal, and remove_wait_queue. */ -static int radeon_fence_check_signaled(wait_queue_t *wait, unsigned mode, int flags, void *key) +static int radeon_fence_check_signaled(wait_queue_entry_t *wait, unsigned mode, int flags, void *key) { struct radeon_fence *fence; u64 seq; diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index 92f1452dad57..76875f6299b8 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c @@ -417,7 +417,7 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible) { struct vga_device *vgadev, *conflict; unsigned long flags; - wait_queue_t wait; + wait_queue_entry_t wait; int rc = 0; vga_check_first_use(); diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c index a3f18a22f5ed..e0f47cc2effc 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_main.c +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c @@ -1939,7 +1939,7 @@ static int i40iw_virtchnl_receive(struct i40e_info *ldev, bool i40iw_vf_clear_to_send(struct i40iw_sc_dev *dev) { struct i40iw_device *iwdev; - wait_queue_t wait; + wait_queue_entry_t wait; iwdev = dev->back_dev; diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h index 9b80417cd547..73da1f5626cb 100644 --- a/drivers/md/bcache/btree.h +++ b/drivers/md/bcache/btree.h @@ -207,7 +207,7 @@ void bkey_put(struct cache_set *c, struct bkey *k); struct btree_op { /* for waiting on btree reserve in btree_split() */ - wait_queue_t wait; + wait_queue_entry_t wait; /* Btree level at which we start taking write locks */ short lock; diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_main.h b/drivers/net/ethernet/cavium/liquidio/octeon_main.h index bed9ef17bc26..7ccffbb0019e 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_main.h +++ b/drivers/net/ethernet/cavium/liquidio/octeon_main.h @@ -144,7 +144,7 @@ static inline int sleep_cond(wait_queue_head_t *wait_queue, int *condition) { int errno = 0; - wait_queue_t we; + wait_queue_entry_t we; init_waitqueue_entry(&we, current); add_wait_queue(wait_queue, &we); @@ -171,7 +171,7 @@ sleep_timeout_cond(wait_queue_head_t *wait_queue, int *condition, int timeout) { - wait_queue_t we; + wait_queue_entry_t we; init_waitqueue_entry(&we, current); add_wait_queue(wait_queue, &we); diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 1b7e125a28e2..6a13303af2b7 100644 --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -3066,7 +3066,7 @@ static int airo_thread(void *data) { if (ai->jobs) { locked = down_interruptible(&ai->sem); } else { - wait_queue_t wait; + wait_queue_entry_t wait; init_waitqueue_entry(&wait, current); add_wait_queue(&ai->thr_wait, &wait); diff --git a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c index b2c6b065b542..ff153ce29539 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c @@ -2544,7 +2544,7 @@ static int prism2_ioctl_priv_prism2_param(struct net_device *dev, ret = -EINVAL; } if (local->iw_mode == IW_MODE_MASTER) { - wait_queue_t __wait; + wait_queue_entry_t __wait; init_waitqueue_entry(&__wait, current); add_wait_queue(&local->hostscan_wq, &__wait); set_current_state(TASK_INTERRUPTIBLE); diff --git a/drivers/net/wireless/marvell/libertas/main.c b/drivers/net/wireless/marvell/libertas/main.c index e3500203715c..dde065d0d5c1 100644 --- a/drivers/net/wireless/marvell/libertas/main.c +++ b/drivers/net/wireless/marvell/libertas/main.c @@ -453,7 +453,7 @@ static int lbs_thread(void *data) { struct net_device *dev = data; struct lbs_private *priv = dev->ml_priv; - wait_queue_t wait; + wait_queue_entry_t wait; lbs_deb_enter(LBS_DEB_THREAD); diff --git a/drivers/scsi/dpt/dpti_i2o.h b/drivers/scsi/dpt/dpti_i2o.h index bd9e31e16249..16fc380b5512 100644 --- a/drivers/scsi/dpt/dpti_i2o.h +++ b/drivers/scsi/dpt/dpti_i2o.h @@ -48,7 +48,7 @@ #include typedef wait_queue_head_t adpt_wait_queue_head_t; #define ADPT_DECLARE_WAIT_QUEUE_HEAD(wait) DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait) -typedef wait_queue_t adpt_wait_queue_t; +typedef wait_queue_entry_t adpt_wait_queue_entry_t; /* * message structures diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 3419e1bcdff6..67621308eb9c 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -301,13 +301,13 @@ static uint32_t ips_statupd_copperhead_memio(ips_ha_t *); static uint32_t ips_statupd_morpheus(ips_ha_t *); static ips_scb_t *ips_getscb(ips_ha_t *); static void ips_putq_scb_head(ips_scb_queue_t *, ips_scb_t *); -static void ips_putq_wait_tail(ips_wait_queue_t *, struct scsi_cmnd *); +static void ips_putq_wait_tail(ips_wait_queue_entry_t *, struct scsi_cmnd *); static void ips_putq_copp_tail(ips_copp_queue_t *, ips_copp_wait_item_t *); static ips_scb_t *ips_removeq_scb_head(ips_scb_queue_t *); static ips_scb_t *ips_removeq_scb(ips_scb_queue_t *, ips_scb_t *); -static struct scsi_cmnd *ips_removeq_wait_head(ips_wait_queue_t *); -static struct scsi_cmnd *ips_removeq_wait(ips_wait_queue_t *, +static struct scsi_cmnd *ips_removeq_wait_head(ips_wait_queue_entry_t *); +static struct scsi_cmnd *ips_removeq_wait(ips_wait_queue_entry_t *, struct scsi_cmnd *); static ips_copp_wait_item_t *ips_removeq_copp(ips_copp_queue_t *, ips_copp_wait_item_t *); @@ -2871,7 +2871,7 @@ ips_removeq_scb(ips_scb_queue_t * queue, ips_scb_t * item) /* ASSUMED to be called from within the HA lock */ /* */ /****************************************************************************/ -static void ips_putq_wait_tail(ips_wait_queue_t *queue, struct scsi_cmnd *item) +static void ips_putq_wait_tail(ips_wait_queue_entry_t *queue, struct scsi_cmnd *item) { METHOD_TRACE("ips_putq_wait_tail", 1); @@ -2902,7 +2902,7 @@ static void ips_putq_wait_tail(ips_wait_queue_t *queue, struct scsi_cmnd *item) /* ASSUMED to be called from within the HA lock */ /* */ /****************************************************************************/ -static struct scsi_cmnd *ips_removeq_wait_head(ips_wait_queue_t *queue) +static struct scsi_cmnd *ips_removeq_wait_head(ips_wait_queue_entry_t *queue) { struct scsi_cmnd *item; @@ -2936,7 +2936,7 @@ static struct scsi_cmnd *ips_removeq_wait_head(ips_wait_queue_t *queue) /* ASSUMED to be called from within the HA lock */ /* */ /****************************************************************************/ -static struct scsi_cmnd *ips_removeq_wait(ips_wait_queue_t *queue, +static struct scsi_cmnd *ips_removeq_wait(ips_wait_queue_entry_t *queue, struct scsi_cmnd *item) { struct scsi_cmnd *p; diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h index b782bb60baf0..366be3b2f9b4 100644 --- a/drivers/scsi/ips.h +++ b/drivers/scsi/ips.h @@ -989,7 +989,7 @@ typedef struct ips_wait_queue { struct scsi_cmnd *head; struct scsi_cmnd *tail; int count; -} ips_wait_queue_t; +} ips_wait_queue_entry_t; typedef struct ips_copp_wait_item { struct scsi_cmnd *scsi_cmd; @@ -1035,7 +1035,7 @@ typedef struct ips_ha { ips_stat_t sp; /* Status packer pointer */ struct ips_scb *scbs; /* Array of all CCBS */ struct ips_scb *scb_freelist; /* SCB free list */ - ips_wait_queue_t scb_waitlist; /* Pending SCB list */ + ips_wait_queue_entry_t scb_waitlist; /* Pending SCB list */ ips_copp_queue_t copp_waitlist; /* Pending PT list */ ips_scb_queue_t scb_activelist; /* Active SCB list */ IPS_IO_CMD *dummy; /* dummy command */ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 0db662d6abdd..85b242ec5f9b 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -3267,7 +3267,7 @@ int kiblnd_connd(void *arg) { spinlock_t *lock = &kiblnd_data.kib_connd_lock; - wait_queue_t wait; + wait_queue_entry_t wait; unsigned long flags; struct kib_conn *conn; int timeout; @@ -3521,7 +3521,7 @@ kiblnd_scheduler(void *arg) long id = (long)arg; struct kib_sched_info *sched; struct kib_conn *conn; - wait_queue_t wait; + wait_queue_entry_t wait; unsigned long flags; struct ib_wc wc; int did_something; @@ -3656,7 +3656,7 @@ kiblnd_failover_thread(void *arg) { rwlock_t *glock = &kiblnd_data.kib_global_lock; struct kib_dev *dev; - wait_queue_t wait; + wait_queue_entry_t wait; unsigned long flags; int rc; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 3ed3b08c122c..6b38d5a8fe92 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -2166,7 +2166,7 @@ ksocknal_connd(void *arg) { spinlock_t *connd_lock = &ksocknal_data.ksnd_connd_lock; struct ksock_connreq *cr; - wait_queue_t wait; + wait_queue_entry_t wait; int nloops = 0; int cons_retry = 0; @@ -2554,7 +2554,7 @@ ksocknal_check_peer_timeouts(int idx) int ksocknal_reaper(void *arg) { - wait_queue_t wait; + wait_queue_entry_t wait; struct ksock_conn *conn; struct ksock_sched *sched; struct list_head enomem_conns; diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c b/drivers/staging/lustre/lnet/libcfs/debug.c index c56e9922cd5b..49deb448b044 100644 --- a/drivers/staging/lustre/lnet/libcfs/debug.c +++ b/drivers/staging/lustre/lnet/libcfs/debug.c @@ -361,7 +361,7 @@ static int libcfs_debug_dumplog_thread(void *arg) void libcfs_debug_dumplog(void) { - wait_queue_t wait; + wait_queue_entry_t wait; struct task_struct *dumper; /* we're being careful to ensure that the kernel thread is diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c index 9599b7441feb..27082d2f7938 100644 --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c @@ -990,7 +990,7 @@ static int tracefiled(void *arg) complete(&tctl->tctl_start); while (1) { - wait_queue_t __wait; + wait_queue_entry_t __wait; pc.pc_want_daemon_pages = 0; collect_pages(&pc); diff --git a/drivers/staging/lustre/lnet/lnet/lib-eq.c b/drivers/staging/lustre/lnet/lnet/lib-eq.c index ce4b83584e17..9ebba4ef5f90 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-eq.c +++ b/drivers/staging/lustre/lnet/lnet/lib-eq.c @@ -312,7 +312,7 @@ __must_hold(&the_lnet.ln_eq_wait_lock) { int tms = *timeout_ms; int wait; - wait_queue_t wl; + wait_queue_entry_t wl; unsigned long now; if (!tms) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 9fca8d225ee0..f075706bba6d 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -516,7 +516,7 @@ lnet_sock_listen(struct socket **sockp, __u32 local_ip, int local_port, int lnet_sock_accept(struct socket **newsockp, struct socket *sock) { - wait_queue_t wait; + wait_queue_entry_t wait; struct socket *newsock; int rc; diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 999f250ceed0..bf31bc200d27 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -192,7 +192,7 @@ static int seq_client_alloc_seq(const struct lu_env *env, } static int seq_fid_alloc_prep(struct lu_client_seq *seq, - wait_queue_t *link) + wait_queue_entry_t *link) { if (seq->lcs_update) { add_wait_queue(&seq->lcs_waitq, link); @@ -223,7 +223,7 @@ static void seq_fid_alloc_fini(struct lu_client_seq *seq) int seq_client_alloc_fid(const struct lu_env *env, struct lu_client_seq *seq, struct lu_fid *fid) { - wait_queue_t link; + wait_queue_entry_t link; int rc; LASSERT(seq); @@ -290,7 +290,7 @@ EXPORT_SYMBOL(seq_client_alloc_fid); */ void seq_client_flush(struct lu_client_seq *seq) { - wait_queue_t link; + wait_queue_entry_t link; LASSERT(seq); init_waitqueue_entry(&link, current); diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h index b04d613846ee..f24970da8323 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lib.h +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h @@ -201,7 +201,7 @@ struct l_wait_info { sigmask(SIGALRM)) /** - * wait_queue_t of Linux (version < 2.6.34) is a FIFO list for exclusively + * wait_queue_entry_t of Linux (version < 2.6.34) is a FIFO list for exclusively * waiting threads, which is not always desirable because all threads will * be waken up again and again, even user only needs a few of them to be * active most time. This is not good for performance because cache can @@ -228,7 +228,7 @@ struct l_wait_info { */ #define __l_wait_event(wq, condition, info, ret, l_add_wait) \ do { \ - wait_queue_t __wait; \ + wait_queue_entry_t __wait; \ long __timeout = info->lwi_timeout; \ sigset_t __blocked; \ int __allow_intr = info->lwi_allow_intr; \ diff --git a/drivers/staging/lustre/lustre/llite/lcommon_cl.c b/drivers/staging/lustre/lustre/llite/lcommon_cl.c index 8af611033e12..96515b839436 100644 --- a/drivers/staging/lustre/lustre/llite/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/llite/lcommon_cl.c @@ -207,7 +207,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) static void cl_object_put_last(struct lu_env *env, struct cl_object *obj) { struct lu_object_header *header = obj->co_lu.lo_header; - wait_queue_t waiter; + wait_queue_entry_t waiter; if (unlikely(atomic_read(&header->loh_ref) != 1)) { struct lu_site *site = obj->co_lu.lo_dev->ld_site; diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index 391c632365ae..e889d3a7de9c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -370,7 +370,7 @@ struct lov_thread_info { struct ost_lvb lti_lvb; struct cl_2queue lti_cl2q; struct cl_page_list lti_plist; - wait_queue_t lti_waiter; + wait_queue_entry_t lti_waiter; struct cl_attr lti_attr; }; diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index ab3ecfeeadc8..eddabbe31e5c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -371,7 +371,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov, struct lov_layout_raid0 *r0; struct lu_site *site; struct lu_site_bkt_data *bkt; - wait_queue_t *waiter; + wait_queue_entry_t *waiter; r0 = &lov->u.raid0; LASSERT(r0->lo_sub[idx] == los); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index abcf951208d2..76ae600ae2c8 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -556,7 +556,7 @@ EXPORT_SYMBOL(lu_object_print); static struct lu_object *htable_lookup(struct lu_site *s, struct cfs_hash_bd *bd, const struct lu_fid *f, - wait_queue_t *waiter, + wait_queue_entry_t *waiter, __u64 *version) { struct lu_site_bkt_data *bkt; @@ -670,7 +670,7 @@ static struct lu_object *lu_object_find_try(const struct lu_env *env, struct lu_device *dev, const struct lu_fid *f, const struct lu_object_conf *conf, - wait_queue_t *waiter) + wait_queue_entry_t *waiter) { struct lu_object *o; struct lu_object *shadow; @@ -750,7 +750,7 @@ struct lu_object *lu_object_find_at(const struct lu_env *env, { struct lu_site_bkt_data *bkt; struct lu_object *obj; - wait_queue_t wait; + wait_queue_entry_t wait; while (1) { obj = lu_object_find_try(env, dev, f, conf, &wait); diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 31885f20fc15..cc047de72e2a 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -184,7 +184,7 @@ static void hdlcdev_exit(struct slgt_info *info); struct cond_wait { struct cond_wait *next; wait_queue_head_t q; - wait_queue_t wait; + wait_queue_entry_t wait; unsigned int data; }; static void init_cond_wait(struct cond_wait *w, unsigned int data); diff --git a/drivers/vfio/virqfd.c b/drivers/vfio/virqfd.c index 27c89cd5d70b..4797217e5e72 100644 --- a/drivers/vfio/virqfd.c +++ b/drivers/vfio/virqfd.c @@ -43,7 +43,7 @@ static void virqfd_deactivate(struct virqfd *virqfd) queue_work(vfio_irqfd_cleanup_wq, &virqfd->shutdown); } -static int virqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key) +static int virqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct virqfd *virqfd = container_of(wait, struct virqfd, wait); unsigned long flags = (unsigned long)key; diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 042030e5a035..e4613a3c362d 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -165,7 +165,7 @@ static void vhost_poll_func(struct file *file, wait_queue_head_t *wqh, add_wait_queue(wqh, &poll->wait); } -static int vhost_poll_wakeup(wait_queue_t *wait, unsigned mode, int sync, +static int vhost_poll_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct vhost_poll *poll = container_of(wait, struct vhost_poll, wait); diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index f55671d53f28..f72095868b93 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -31,7 +31,7 @@ struct vhost_work { struct vhost_poll { poll_table table; wait_queue_head_t *wqh; - wait_queue_t wait; + wait_queue_entry_t wait; struct vhost_work work; unsigned long mask; struct vhost_dev *dev; diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index beef981aa54f..974f5346458a 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h @@ -83,7 +83,7 @@ struct autofs_info { struct autofs_wait_queue { wait_queue_head_t queue; struct autofs_wait_queue *next; - autofs_wqt_t wait_queue_token; + autofs_wqt_t wait_queue_entry_token; /* We use the following to see what we are waiting for */ struct qstr name; u32 dev; diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 24a58bf9ca72..7071895b0678 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c @@ -104,7 +104,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, size_t pktsz; pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n", - (unsigned long) wq->wait_queue_token, + (unsigned long) wq->wait_queue_entry_token, wq->name.len, wq->name.name, type); memset(&pkt, 0, sizeof(pkt)); /* For security reasons */ @@ -120,7 +120,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, pktsz = sizeof(*mp); - mp->wait_queue_token = wq->wait_queue_token; + mp->wait_queue_entry_token = wq->wait_queue_entry_token; mp->len = wq->name.len; memcpy(mp->name, wq->name.name, wq->name.len); mp->name[wq->name.len] = '\0'; @@ -133,7 +133,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, pktsz = sizeof(*ep); - ep->wait_queue_token = wq->wait_queue_token; + ep->wait_queue_entry_token = wq->wait_queue_entry_token; ep->len = wq->name.len; memcpy(ep->name, wq->name.name, wq->name.len); ep->name[wq->name.len] = '\0'; @@ -153,7 +153,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, pktsz = sizeof(*packet); - packet->wait_queue_token = wq->wait_queue_token; + packet->wait_queue_entry_token = wq->wait_queue_entry_token; packet->len = wq->name.len; memcpy(packet->name, wq->name.name, wq->name.len); packet->name[wq->name.len] = '\0'; @@ -428,7 +428,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, return -ENOMEM; } - wq->wait_queue_token = autofs4_next_wait_queue; + wq->wait_queue_entry_token = autofs4_next_wait_queue; if (++autofs4_next_wait_queue == 0) autofs4_next_wait_queue = 1; wq->next = sbi->queues; @@ -461,7 +461,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, } pr_debug("new wait id = 0x%08lx, name = %.*s, nfy=%d\n", - (unsigned long) wq->wait_queue_token, wq->name.len, + (unsigned long) wq->wait_queue_entry_token, wq->name.len, wq->name.name, notify); /* @@ -471,7 +471,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, } else { wq->wait_ctr++; pr_debug("existing wait id = 0x%08lx, name = %.*s, nfy=%d\n", - (unsigned long) wq->wait_queue_token, wq->name.len, + (unsigned long) wq->wait_queue_entry_token, wq->name.len, wq->name.name, notify); mutex_unlock(&sbi->wq_mutex); kfree(qstr.name); @@ -550,13 +550,13 @@ int autofs4_wait(struct autofs_sb_info *sbi, } -int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_token, int status) +int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_entry_token, int status) { struct autofs_wait_queue *wq, **wql; mutex_lock(&sbi->wq_mutex); for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) { - if (wq->wait_queue_token == wait_queue_token) + if (wq->wait_queue_entry_token == wait_queue_entry_token) break; } diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index 9bf90bcc56ac..54a4fcd679ed 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h @@ -97,7 +97,7 @@ struct cachefiles_cache { * backing file read tracking */ struct cachefiles_one_read { - wait_queue_t monitor; /* link into monitored waitqueue */ + wait_queue_entry_t monitor; /* link into monitored waitqueue */ struct page *back_page; /* backing file page we're waiting for */ struct page *netfs_page; /* netfs page we're going to fill */ struct fscache_retrieval *op; /* retrieval op covering this */ diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 41df8a27d7eb..3978b324cbca 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -204,7 +204,7 @@ wait_for_old_object: wait_queue_head_t *wq; signed long timeout = 60 * HZ; - wait_queue_t wait; + wait_queue_entry_t wait; bool requeue; /* if the object we're waiting for is queued for processing, diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index afbdc418966d..8be33b33b981 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c @@ -21,7 +21,7 @@ * - we use this to detect read completion of backing pages * - the caller holds the waitqueue lock */ -static int cachefiles_read_waiter(wait_queue_t *wait, unsigned mode, +static int cachefiles_read_waiter(wait_queue_entry_t *wait, unsigned mode, int sync, void *_key) { struct cachefiles_one_read *monitor = diff --git a/fs/dax.c b/fs/dax.c index 2a6889b3585f..323ea481d4a8 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -84,7 +84,7 @@ struct exceptional_entry_key { }; struct wait_exceptional_entry_queue { - wait_queue_t wait; + wait_queue_entry_t wait; struct exceptional_entry_key key; }; @@ -108,7 +108,7 @@ static wait_queue_head_t *dax_entry_waitqueue(struct address_space *mapping, return wait_table + hash; } -static int wake_exceptional_entry_func(wait_queue_t *wait, unsigned int mode, +static int wake_exceptional_entry_func(wait_queue_entry_t *wait, unsigned int mode, int sync, void *keyp) { struct exceptional_entry_key *key = keyp; diff --git a/fs/eventfd.c b/fs/eventfd.c index 68b9fffcb2c8..9736df2ce89d 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -191,7 +191,7 @@ static void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt) * This is used to atomically remove a wait queue entry from the eventfd wait * queue head, and read/reset the counter value. */ -int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, +int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait, __u64 *cnt) { unsigned long flags; diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 5420767c9b68..5ac1cba5ef72 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -244,7 +244,7 @@ struct eppoll_entry { * Wait queue item that will be linked to the target file wait * queue head. */ - wait_queue_t wait; + wait_queue_entry_t wait; /* The wait queue head that linked the "wait" wait queue item */ wait_queue_head_t *whead; @@ -347,13 +347,13 @@ static inline int ep_is_linked(struct list_head *p) return !list_empty(p); } -static inline struct eppoll_entry *ep_pwq_from_wait(wait_queue_t *p) +static inline struct eppoll_entry *ep_pwq_from_wait(wait_queue_entry_t *p) { return container_of(p, struct eppoll_entry, wait); } /* Get the "struct epitem" from a wait queue pointer */ -static inline struct epitem *ep_item_from_wait(wait_queue_t *p) +static inline struct epitem *ep_item_from_wait(wait_queue_entry_t *p) { return container_of(p, struct eppoll_entry, wait)->base; } @@ -1078,7 +1078,7 @@ static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd) * mechanism. It is called by the stored file descriptors when they * have events to report. */ -static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *key) +static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { int pwake = 0; unsigned long flags; @@ -1699,7 +1699,7 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, int res = 0, eavail, timed_out = 0; unsigned long flags; u64 slack = 0; - wait_queue_t wait; + wait_queue_entry_t wait; ktime_t expires, *to = NULL; if (timeout > 0) { diff --git a/fs/fs_pin.c b/fs/fs_pin.c index 611b5408f6ec..7b447a245760 100644 --- a/fs/fs_pin.c +++ b/fs/fs_pin.c @@ -34,7 +34,7 @@ void pin_insert(struct fs_pin *pin, struct vfsmount *m) void pin_kill(struct fs_pin *p) { - wait_queue_t wait; + wait_queue_entry_t wait; if (!p) { rcu_read_unlock(); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index c08c46a3b8cd..be5a8f84e5bb 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -6372,7 +6372,7 @@ struct nfs4_lock_waiter { }; static int -nfs4_wake_lock_waiter(wait_queue_t *wait, unsigned int mode, int flags, void *key) +nfs4_wake_lock_waiter(wait_queue_entry_t *wait, unsigned int mode, int flags, void *key) { int ret; struct cb_notify_lock_args *cbnl = key; @@ -6415,7 +6415,7 @@ nfs4_retry_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) .inode = state->inode, .owner = &owner, .notified = false }; - wait_queue_t wait; + wait_queue_entry_t wait; /* Don't bother with waitqueue if we don't expect a callback */ if (!test_bit(NFS_STATE_MAY_NOTIFY_LOCK, &state->flags)) diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index febed1217b3f..775304e7f96f 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -2161,7 +2161,7 @@ void nilfs_flush_segment(struct super_block *sb, ino_t ino) } struct nilfs_segctor_wait_request { - wait_queue_t wq; + wait_queue_entry_t wq; __u32 seq; int err; atomic_t done; diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c index 83b506020718..9e37b7028ea4 100644 --- a/fs/orangefs/orangefs-bufmap.c +++ b/fs/orangefs/orangefs-bufmap.c @@ -47,7 +47,7 @@ static void run_down(struct slot_map *m) if (m->c != -1) { for (;;) { if (likely(list_empty(&wait.task_list))) - __add_wait_queue_tail(&m->q, &wait); + __add_wait_queue_entry_tail(&m->q, &wait); set_current_state(TASK_UNINTERRUPTIBLE); if (m->c == -1) @@ -85,7 +85,7 @@ static int wait_for_free(struct slot_map *m) do { long n = left, t; if (likely(list_empty(&wait.task_list))) - __add_wait_queue_tail_exclusive(&m->q, &wait); + __add_wait_queue_entry_tail_exclusive(&m->q, &wait); set_current_state(TASK_INTERRUPTIBLE); if (m->c > 0) diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 39bb1e838d8d..a11d773e5ff3 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -2956,7 +2956,7 @@ void reiserfs_wait_on_write_block(struct super_block *s) static void queue_log_writer(struct super_block *s) { - wait_queue_t wait; + wait_queue_entry_t wait; struct reiserfs_journal *journal = SB_JOURNAL(s); set_bit(J_WRITERS_QUEUED, &journal->j_state); diff --git a/fs/select.c b/fs/select.c index d6c652a31e99..5b524a977d91 100644 --- a/fs/select.c +++ b/fs/select.c @@ -180,7 +180,7 @@ static struct poll_table_entry *poll_get_entry(struct poll_wqueues *p) return table->entry++; } -static int __pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key) +static int __pollwake(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct poll_wqueues *pwq = wait->private; DECLARE_WAITQUEUE(dummy_wait, pwq->polling_task); @@ -206,7 +206,7 @@ static int __pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key) return default_wake_function(&dummy_wait, mode, sync, key); } -static int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key) +static int pollwake(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct poll_table_entry *entry; diff --git a/fs/signalfd.c b/fs/signalfd.c index 7e3d71109f51..593b022ac11b 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c @@ -43,7 +43,7 @@ void signalfd_cleanup(struct sighand_struct *sighand) if (likely(!waitqueue_active(wqh))) return; - /* wait_queue_t->func(POLLFREE) should do remove_wait_queue() */ + /* wait_queue_entry_t->func(POLLFREE) should do remove_wait_queue() */ wake_up_poll(wqh, POLLHUP | POLLFREE); } diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 1d622f276e3a..bda64fcd8a0c 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -81,7 +81,7 @@ struct userfaultfd_unmap_ctx { struct userfaultfd_wait_queue { struct uffd_msg msg; - wait_queue_t wq; + wait_queue_entry_t wq; struct userfaultfd_ctx *ctx; bool waken; }; @@ -91,7 +91,7 @@ struct userfaultfd_wake_range { unsigned long len; }; -static int userfaultfd_wake_function(wait_queue_t *wq, unsigned mode, +static int userfaultfd_wake_function(wait_queue_entry_t *wq, unsigned mode, int wake_flags, void *key) { struct userfaultfd_wake_range *range = key; @@ -860,7 +860,7 @@ wakeup: static inline struct userfaultfd_wait_queue *find_userfault_in( wait_queue_head_t *wqh) { - wait_queue_t *wq; + wait_queue_entry_t *wq; struct userfaultfd_wait_queue *uwq; VM_BUG_ON(!spin_is_locked(&wqh->lock)); @@ -1747,7 +1747,7 @@ static long userfaultfd_ioctl(struct file *file, unsigned cmd, static void userfaultfd_show_fdinfo(struct seq_file *m, struct file *f) { struct userfaultfd_ctx *ctx = f->private_data; - wait_queue_t *wq; + wait_queue_entry_t *wq; struct userfaultfd_wait_queue *uwq; unsigned long pending = 0, total = 0; diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index fcd641032f8d..95ba83806c5d 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -33,7 +33,7 @@ struct blk_mq_hw_ctx { struct blk_mq_ctx **ctxs; unsigned int nr_ctx; - wait_queue_t dispatch_wait; + wait_queue_entry_t dispatch_wait; atomic_t wait_index; struct blk_mq_tags *tags; diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index ff0b981f078e..9e4befd95bc7 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -37,7 +37,7 @@ struct eventfd_ctx *eventfd_ctx_fdget(int fd); struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); __u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n); ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt); -int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, +int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait, __u64 *cnt); #else /* CONFIG_EVENTFD */ @@ -73,7 +73,7 @@ static inline ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, } static inline int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, - wait_queue_t *wait, __u64 *cnt) + wait_queue_entry_t *wait, __u64 *cnt) { return -ENOSYS; } diff --git a/include/linux/kvm_irqfd.h b/include/linux/kvm_irqfd.h index 0c1de05098c8..76c2fbc59f35 100644 --- a/include/linux/kvm_irqfd.h +++ b/include/linux/kvm_irqfd.h @@ -46,7 +46,7 @@ struct kvm_kernel_irqfd_resampler { struct kvm_kernel_irqfd { /* Used for MSI fast-path */ struct kvm *kvm; - wait_queue_t wait; + wait_queue_entry_t wait; /* Update side is protected by irqfds.lock */ struct kvm_kernel_irq_routing_entry irq_entry; seqcount_t irq_entry_sc; diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 316a19f6b635..e7bbd9d4dc6c 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -524,7 +524,7 @@ void page_endio(struct page *page, bool is_write, int err); /* * Add an arbitrary waiter to a page's wait queue */ -extern void add_page_wait_queue(struct page *page, wait_queue_t *waiter); +extern void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter); /* * Fault everything in given userspace address range in. diff --git a/include/linux/poll.h b/include/linux/poll.h index 75ffc5729e4c..2889f09a1c60 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -75,7 +75,7 @@ static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) struct poll_table_entry { struct file *filp; unsigned long key; - wait_queue_t wait; + wait_queue_entry_t wait; wait_queue_head_t *wait_address; }; diff --git a/include/linux/vfio.h b/include/linux/vfio.h index edf9b2cad277..f57076b958b7 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -183,7 +183,7 @@ struct virqfd { void (*thread)(void *, void *); void *data; struct work_struct inject; - wait_queue_t wait; + wait_queue_entry_t wait; poll_table pt; struct work_struct shutdown; struct virqfd **pvirqfd; diff --git a/include/linux/wait.h b/include/linux/wait.h index db076ca7f11d..5889f0c86ff7 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -10,15 +10,18 @@ #include #include -typedef struct __wait_queue wait_queue_t; -typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key); -int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key); +typedef struct wait_queue_entry wait_queue_entry_t; +typedef int (*wait_queue_func_t)(wait_queue_entry_t *wait, unsigned mode, int flags, void *key); +int default_wake_function(wait_queue_entry_t *wait, unsigned mode, int flags, void *key); -/* __wait_queue::flags */ +/* wait_queue_entry::flags */ #define WQ_FLAG_EXCLUSIVE 0x01 #define WQ_FLAG_WOKEN 0x02 -struct __wait_queue { +/* + * A single wait-queue entry structure: + */ +struct wait_queue_entry { unsigned int flags; void *private; wait_queue_func_t func; @@ -34,7 +37,7 @@ struct wait_bit_key { struct wait_bit_queue { struct wait_bit_key key; - wait_queue_t wait; + wait_queue_entry_t wait; }; struct __wait_queue_head { @@ -55,7 +58,7 @@ struct task_struct; .task_list = { NULL, NULL } } #define DECLARE_WAITQUEUE(name, tsk) \ - wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk) + wait_queue_entry_t name = __WAITQUEUE_INITIALIZER(name, tsk) #define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ .lock = __SPIN_LOCK_UNLOCKED(name.lock), \ @@ -88,7 +91,7 @@ extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct # define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) DECLARE_WAIT_QUEUE_HEAD(name) #endif -static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) +static inline void init_waitqueue_entry(wait_queue_entry_t *q, struct task_struct *p) { q->flags = 0; q->private = p; @@ -96,7 +99,7 @@ static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) } static inline void -init_waitqueue_func_entry(wait_queue_t *q, wait_queue_func_t func) +init_waitqueue_func_entry(wait_queue_entry_t *q, wait_queue_func_t func) { q->flags = 0; q->private = NULL; @@ -159,11 +162,11 @@ static inline bool wq_has_sleeper(wait_queue_head_t *wq) return waitqueue_active(wq); } -extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); -extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait); -extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); +extern void add_wait_queue(wait_queue_head_t *q, wait_queue_entry_t *wait); +extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_entry_t *wait); +extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_entry_t *wait); -static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) +static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_entry_t *new) { list_add(&new->task_list, &head->task_list); } @@ -172,27 +175,27 @@ static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) * Used for wake-one threads: */ static inline void -__add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait) +__add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_entry_t *wait) { wait->flags |= WQ_FLAG_EXCLUSIVE; __add_wait_queue(q, wait); } -static inline void __add_wait_queue_tail(wait_queue_head_t *head, - wait_queue_t *new) +static inline void __add_wait_queue_entry_tail(wait_queue_head_t *head, + wait_queue_entry_t *new) { list_add_tail(&new->task_list, &head->task_list); } static inline void -__add_wait_queue_tail_exclusive(wait_queue_head_t *q, wait_queue_t *wait) +__add_wait_queue_entry_tail_exclusive(wait_queue_head_t *q, wait_queue_entry_t *wait) { wait->flags |= WQ_FLAG_EXCLUSIVE; - __add_wait_queue_tail(q, wait); + __add_wait_queue_entry_tail(q, wait); } static inline void -__remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old) +__remove_wait_queue(wait_queue_head_t *head, wait_queue_entry_t *old) { list_del(&old->task_list); } @@ -249,7 +252,7 @@ wait_queue_head_t *bit_waitqueue(void *, int); (!__builtin_constant_p(state) || \ state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \ -extern void init_wait_entry(wait_queue_t *__wait, int flags); +extern void init_wait_entry(wait_queue_entry_t *__wait, int flags); /* * The below macro ___wait_event() has an explicit shadow of the __ret @@ -266,7 +269,7 @@ extern void init_wait_entry(wait_queue_t *__wait, int flags); #define ___wait_event(wq, condition, state, exclusive, ret, cmd) \ ({ \ __label__ __out; \ - wait_queue_t __wait; \ + wait_queue_entry_t __wait; \ long __ret = ret; /* explicit shadow */ \ \ init_wait_entry(&__wait, exclusive ? WQ_FLAG_EXCLUSIVE : 0); \ @@ -620,8 +623,8 @@ do { \ __ret; \ }) -extern int do_wait_intr(wait_queue_head_t *, wait_queue_t *); -extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_t *); +extern int do_wait_intr(wait_queue_head_t *, wait_queue_entry_t *); +extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); #define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \ ({ \ @@ -967,17 +970,17 @@ do { \ /* * Waitqueues which are removed from the waitqueue_head at wakeup time */ -void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); -void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); -long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state); -void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); -long wait_woken(wait_queue_t *wait, unsigned mode, long timeout); -int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); -int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); -int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); +void prepare_to_wait(wait_queue_head_t *q, wait_queue_entry_t *wait, int state); +void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_entry_t *wait, int state); +long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_entry_t *wait, int state); +void finish_wait(wait_queue_head_t *q, wait_queue_entry_t *wait); +long wait_woken(wait_queue_entry_t *wait, unsigned mode, long timeout); +int woken_wake_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *key); +int autoremove_wake_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *key); +int wake_bit_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *key); #define DEFINE_WAIT_FUNC(name, function) \ - wait_queue_t name = { \ + wait_queue_entry_t name = { \ .private = current, \ .func = function, \ .task_list = LIST_HEAD_INIT((name).task_list), \ diff --git a/include/net/af_unix.h b/include/net/af_unix.h index fd60eccb59a6..75e612a45824 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h @@ -62,7 +62,7 @@ struct unix_sock { #define UNIX_GC_CANDIDATE 0 #define UNIX_GC_MAYBE_CYCLE 1 struct socket_wq peer_wq; - wait_queue_t peer_wake; + wait_queue_entry_t peer_wake; }; static inline struct unix_sock *unix_sk(const struct sock *sk) diff --git a/include/uapi/linux/auto_fs.h b/include/uapi/linux/auto_fs.h index aa63451ef20a..1953f8d6063b 100644 --- a/include/uapi/linux/auto_fs.h +++ b/include/uapi/linux/auto_fs.h @@ -26,7 +26,7 @@ #define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION /* - * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed + * The wait_queue_entry_token (autofs_wqt_t) is part of a structure which is passed * back to the kernel via ioctl from userspace. On architectures where 32- and * 64-bit userspace binaries can be executed it's important that the size of * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we @@ -49,7 +49,7 @@ struct autofs_packet_hdr { struct autofs_packet_missing { struct autofs_packet_hdr hdr; - autofs_wqt_t wait_queue_token; + autofs_wqt_t wait_queue_entry_token; int len; char name[NAME_MAX+1]; }; diff --git a/include/uapi/linux/auto_fs4.h b/include/uapi/linux/auto_fs4.h index 7c6da423d54e..65b72d0222e7 100644 --- a/include/uapi/linux/auto_fs4.h +++ b/include/uapi/linux/auto_fs4.h @@ -108,7 +108,7 @@ enum autofs_notify { /* v4 multi expire (via pipe) */ struct autofs_packet_expire_multi { struct autofs_packet_hdr hdr; - autofs_wqt_t wait_queue_token; + autofs_wqt_t wait_queue_entry_token; int len; char name[NAME_MAX+1]; }; @@ -123,7 +123,7 @@ union autofs_packet_union { /* autofs v5 common packet struct */ struct autofs_v5_packet { struct autofs_packet_hdr hdr; - autofs_wqt_t wait_queue_token; + autofs_wqt_t wait_queue_entry_token; __u32 dev; __u64 ino; __u32 uid; diff --git a/kernel/exit.c b/kernel/exit.c index 516acdb0e0ec..7d694437ab44 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1004,7 +1004,7 @@ struct wait_opts { int __user *wo_stat; struct rusage __user *wo_rusage; - wait_queue_t child_wait; + wait_queue_entry_t child_wait; int notask_error; }; @@ -1541,7 +1541,7 @@ static int ptrace_do_wait(struct wait_opts *wo, struct task_struct *tsk) return 0; } -static int child_wait_callback(wait_queue_t *wait, unsigned mode, +static int child_wait_callback(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct wait_opts *wo = container_of(wait, struct wait_opts, diff --git a/kernel/futex.c b/kernel/futex.c index 357348a6cf6b..d6cf71d08f21 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -225,7 +225,7 @@ struct futex_pi_state { * @requeue_pi_key: the requeue_pi target futex key * @bitset: bitset for the optional bitmasked wakeup * - * We use this hashed waitqueue, instead of a normal wait_queue_t, so + * We use this hashed waitqueue, instead of a normal wait_queue_entry_t, so * we can wake only the relevant ones (hashed queues may be shared). * * A futex_q has a woken state, just like tasks have TASK_RUNNING. diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c index 53f9558fa925..13fc5ae9bf2f 100644 --- a/kernel/sched/completion.c +++ b/kernel/sched/completion.c @@ -66,7 +66,7 @@ do_wait_for_common(struct completion *x, if (!x->done) { DECLARE_WAITQUEUE(wait, current); - __add_wait_queue_tail_exclusive(&x->wait, &wait); + __add_wait_queue_entry_tail_exclusive(&x->wait, &wait); do { if (signal_pending_state(state, current)) { timeout = -ERESTARTSYS; diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 326d4f88e2b1..5b36644536ab 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3687,7 +3687,7 @@ asmlinkage __visible void __sched preempt_schedule_irq(void) exception_exit(prev_state); } -int default_wake_function(wait_queue_t *curr, unsigned mode, int wake_flags, +int default_wake_function(wait_queue_entry_t *curr, unsigned mode, int wake_flags, void *key) { return try_to_wake_up(curr->private, mode, wake_flags); diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index b8c84c6dee64..301ea02dede0 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c @@ -21,7 +21,7 @@ void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_c EXPORT_SYMBOL(__init_waitqueue_head); -void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) +void add_wait_queue(wait_queue_head_t *q, wait_queue_entry_t *wait) { unsigned long flags; @@ -32,18 +32,18 @@ void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) } EXPORT_SYMBOL(add_wait_queue); -void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait) +void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_entry_t *wait) { unsigned long flags; wait->flags |= WQ_FLAG_EXCLUSIVE; spin_lock_irqsave(&q->lock, flags); - __add_wait_queue_tail(q, wait); + __add_wait_queue_entry_tail(q, wait); spin_unlock_irqrestore(&q->lock, flags); } EXPORT_SYMBOL(add_wait_queue_exclusive); -void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) +void remove_wait_queue(wait_queue_head_t *q, wait_queue_entry_t *wait) { unsigned long flags; @@ -66,7 +66,7 @@ EXPORT_SYMBOL(remove_wait_queue); static void __wake_up_common(wait_queue_head_t *q, unsigned int mode, int nr_exclusive, int wake_flags, void *key) { - wait_queue_t *curr, *next; + wait_queue_entry_t *curr, *next; list_for_each_entry_safe(curr, next, &q->task_list, task_list) { unsigned flags = curr->flags; @@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */ * loads to move into the critical region). */ void -prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state) +prepare_to_wait(wait_queue_head_t *q, wait_queue_entry_t *wait, int state) { unsigned long flags; @@ -184,20 +184,20 @@ prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state) EXPORT_SYMBOL(prepare_to_wait); void -prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state) +prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_entry_t *wait, int state) { unsigned long flags; wait->flags |= WQ_FLAG_EXCLUSIVE; spin_lock_irqsave(&q->lock, flags); if (list_empty(&wait->task_list)) - __add_wait_queue_tail(q, wait); + __add_wait_queue_entry_tail(q, wait); set_current_state(state); spin_unlock_irqrestore(&q->lock, flags); } EXPORT_SYMBOL(prepare_to_wait_exclusive); -void init_wait_entry(wait_queue_t *wait, int flags) +void init_wait_entry(wait_queue_entry_t *wait, int flags) { wait->flags = flags; wait->private = current; @@ -206,7 +206,7 @@ void init_wait_entry(wait_queue_t *wait, int flags) } EXPORT_SYMBOL(init_wait_entry); -long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state) +long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_entry_t *wait, int state) { unsigned long flags; long ret = 0; @@ -230,7 +230,7 @@ long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state) } else { if (list_empty(&wait->task_list)) { if (wait->flags & WQ_FLAG_EXCLUSIVE) - __add_wait_queue_tail(q, wait); + __add_wait_queue_entry_tail(q, wait); else __add_wait_queue(q, wait); } @@ -249,10 +249,10 @@ EXPORT_SYMBOL(prepare_to_wait_event); * condition in the caller before they add the wait * entry to the wake queue. */ -int do_wait_intr(wait_queue_head_t *wq, wait_queue_t *wait) +int do_wait_intr(wait_queue_head_t *wq, wait_queue_entry_t *wait) { if (likely(list_empty(&wait->task_list))) - __add_wait_queue_tail(wq, wait); + __add_wait_queue_entry_tail(wq, wait); set_current_state(TASK_INTERRUPTIBLE); if (signal_pending(current)) @@ -265,10 +265,10 @@ int do_wait_intr(wait_queue_head_t *wq, wait_queue_t *wait) } EXPORT_SYMBOL(do_wait_intr); -int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_t *wait) +int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_entry_t *wait) { if (likely(list_empty(&wait->task_list))) - __add_wait_queue_tail(wq, wait); + __add_wait_queue_entry_tail(wq, wait); set_current_state(TASK_INTERRUPTIBLE); if (signal_pending(current)) @@ -290,7 +290,7 @@ EXPORT_SYMBOL(do_wait_intr_irq); * the wait descriptor from the given waitqueue if still * queued. */ -void finish_wait(wait_queue_head_t *q, wait_queue_t *wait) +void finish_wait(wait_queue_head_t *q, wait_queue_entry_t *wait) { unsigned long flags; @@ -316,7 +316,7 @@ void finish_wait(wait_queue_head_t *q, wait_queue_t *wait) } EXPORT_SYMBOL(finish_wait); -int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key) +int autoremove_wake_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { int ret = default_wake_function(wait, mode, sync, key); @@ -351,7 +351,7 @@ static inline bool is_kthread_should_stop(void) * remove_wait_queue(&wq, &wait); * */ -long wait_woken(wait_queue_t *wait, unsigned mode, long timeout) +long wait_woken(wait_queue_entry_t *wait, unsigned mode, long timeout) { set_current_state(mode); /* A */ /* @@ -375,7 +375,7 @@ long wait_woken(wait_queue_t *wait, unsigned mode, long timeout) } EXPORT_SYMBOL(wait_woken); -int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key) +int woken_wake_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { /* * Although this function is called under waitqueue lock, LOCK @@ -391,7 +391,7 @@ int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key) } EXPORT_SYMBOL(woken_wake_function); -int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *arg) +int wake_bit_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *arg) { struct wait_bit_key *key = arg; struct wait_bit_queue *wait_bit @@ -534,7 +534,7 @@ static inline wait_queue_head_t *atomic_t_waitqueue(atomic_t *p) return bit_waitqueue(p, 0); } -static int wake_atomic_t_function(wait_queue_t *wait, unsigned mode, int sync, +static int wake_atomic_t_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *arg) { struct wait_bit_key *key = arg; diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c74bf39ef764..a86688fabc55 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2864,11 +2864,11 @@ bool flush_work(struct work_struct *work) EXPORT_SYMBOL_GPL(flush_work); struct cwt_wait { - wait_queue_t wait; + wait_queue_entry_t wait; struct work_struct *work; }; -static int cwt_wakefn(wait_queue_t *wait, unsigned mode, int sync, void *key) +static int cwt_wakefn(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct cwt_wait *cwait = container_of(wait, struct cwt_wait, wait); diff --git a/mm/filemap.c b/mm/filemap.c index 6f1be573a5e6..80c19ee81e95 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -768,10 +768,10 @@ struct wait_page_key { struct wait_page_queue { struct page *page; int bit_nr; - wait_queue_t wait; + wait_queue_entry_t wait; }; -static int wake_page_function(wait_queue_t *wait, unsigned mode, int sync, void *arg) +static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *arg) { struct wait_page_key *key = arg; struct wait_page_queue *wait_page @@ -834,7 +834,7 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q, struct page *page, int bit_nr, int state, bool lock) { struct wait_page_queue wait_page; - wait_queue_t *wait = &wait_page.wait; + wait_queue_entry_t *wait = &wait_page.wait; int ret = 0; init_wait(wait); @@ -847,7 +847,7 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q, if (likely(list_empty(&wait->task_list))) { if (lock) - __add_wait_queue_tail_exclusive(q, wait); + __add_wait_queue_entry_tail_exclusive(q, wait); else __add_wait_queue(q, wait); SetPageWaiters(page); @@ -907,7 +907,7 @@ int wait_on_page_bit_killable(struct page *page, int bit_nr) * * Add an arbitrary @waiter to the wait queue for the nominated @page. */ -void add_page_wait_queue(struct page *page, wait_queue_t *waiter) +void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter) { wait_queue_head_t *q = page_waitqueue(page); unsigned long flags; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 94172089f52f..9a90b096dc6b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -170,7 +170,7 @@ struct mem_cgroup_event { */ poll_table pt; wait_queue_head_t *wqh; - wait_queue_t wait; + wait_queue_entry_t wait; struct work_struct remove; }; @@ -1479,10 +1479,10 @@ static DECLARE_WAIT_QUEUE_HEAD(memcg_oom_waitq); struct oom_wait_info { struct mem_cgroup *memcg; - wait_queue_t wait; + wait_queue_entry_t wait; }; -static int memcg_oom_wake_function(wait_queue_t *wait, +static int memcg_oom_wake_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *arg) { struct mem_cgroup *wake_memcg = (struct mem_cgroup *)arg; @@ -3725,7 +3725,7 @@ static void memcg_event_remove(struct work_struct *work) * * Called with wqh->lock held and interrupts disabled. */ -static int memcg_event_wake(wait_queue_t *wait, unsigned mode, +static int memcg_event_wake(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct mem_cgroup_event *event = diff --git a/mm/mempool.c b/mm/mempool.c index 47a659dedd44..1c0294858527 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -312,7 +312,7 @@ void *mempool_alloc(mempool_t *pool, gfp_t gfp_mask) { void *element; unsigned long flags; - wait_queue_t wait; + wait_queue_entry_t wait; gfp_t gfp_temp; VM_WARN_ON_ONCE(gfp_mask & __GFP_ZERO); diff --git a/mm/shmem.c b/mm/shmem.c index e67d6ba4e98e..a6c7dece4660 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1902,7 +1902,7 @@ unlock: * entry unconditionally - even if something else had already woken the * target. */ -static int synchronous_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key) +static int synchronous_wake_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { int ret = default_wake_function(wait, mode, sync, key); list_del_init(&wait->task_list); diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 7bc2208b6cc4..dca3cdd1a014 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -95,7 +95,7 @@ enum { struct p9_poll_wait { struct p9_conn *conn; - wait_queue_t wait; + wait_queue_entry_t wait; wait_queue_head_t *wait_addr; }; @@ -522,7 +522,7 @@ error: clear_bit(Wworksched, &m->wsched); } -static int p9_pollwake(wait_queue_t *wait, unsigned int mode, int sync, void *key) +static int p9_pollwake(wait_queue_entry_t *wait, unsigned int mode, int sync, void *key) { struct p9_poll_wait *pwait = container_of(wait, struct p9_poll_wait, wait); diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index fbf251fef70f..5c4808b3da2d 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -484,7 +484,7 @@ static int bnep_session(void *arg) struct net_device *dev = s->dev; struct sock *sk = s->sock->sk; struct sk_buff *skb; - wait_queue_t wait; + wait_queue_entry_t wait; BT_DBG(""); diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 9e59b6654126..14f7c8135c31 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -280,7 +280,7 @@ static int cmtp_session(void *arg) struct cmtp_session *session = arg; struct sock *sk = session->sock->sk; struct sk_buff *skb; - wait_queue_t wait; + wait_queue_entry_t wait; BT_DBG("session %p", session); diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 0bec4588c3c8..fc31161e98f2 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -1244,7 +1244,7 @@ static void hidp_session_run(struct hidp_session *session) static int hidp_session_thread(void *arg) { struct hidp_session *session = arg; - wait_queue_t ctrl_wait, intr_wait; + wait_queue_entry_t ctrl_wait, intr_wait; BT_DBG("session %p", session); diff --git a/net/core/datagram.c b/net/core/datagram.c index db1866f2ffcf..34678828e2bb 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -68,7 +68,7 @@ static inline int connection_based(struct sock *sk) return sk->sk_type == SOCK_SEQPACKET || sk->sk_type == SOCK_STREAM; } -static int receiver_wake_function(wait_queue_t *wait, unsigned int mode, int sync, +static int receiver_wake_function(wait_queue_entry_t *wait, unsigned int mode, int sync, void *key) { unsigned long bits = (unsigned long)key; diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 1a0c961f4ffe..c77ced0109b7 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -343,7 +343,7 @@ found: * are still connected to it and there's no way to inform "a polling * implementation" that it should let go of a certain wait queue * - * In order to propagate a wake up, a wait_queue_t of the client + * In order to propagate a wake up, a wait_queue_entry_t of the client * socket is enqueued on the peer_wait queue of the server socket * whose wake function does a wake_up on the ordinary client socket * wait queue. This connection is established whenever a write (or @@ -352,7 +352,7 @@ found: * was relayed. */ -static int unix_dgram_peer_wake_relay(wait_queue_t *q, unsigned mode, int flags, +static int unix_dgram_peer_wake_relay(wait_queue_entry_t *q, unsigned mode, int flags, void *key) { struct unix_sock *u; diff --git a/sound/core/control.c b/sound/core/control.c index c109b82eef4b..6362da17ac3f 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1577,7 +1577,7 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, struct snd_ctl_event ev; struct snd_kctl_event *kev; while (list_empty(&ctl->events)) { - wait_queue_t wait; + wait_queue_entry_t wait; if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) { err = -EAGAIN; goto __end_lock; diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 9602a7e38d8a..a73baa1242be 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -85,7 +85,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) int major = imajor(inode); struct snd_hwdep *hw; int err; - wait_queue_t wait; + wait_queue_entry_t wait; if (major == snd_major) { hw = snd_lookup_minor_data(iminor(inode), diff --git a/sound/core/init.c b/sound/core/init.c index 6bda8436d765..d61d2b3cd521 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -989,7 +989,7 @@ EXPORT_SYMBOL(snd_card_file_remove); */ int snd_power_wait(struct snd_card *card, unsigned int power_state) { - wait_queue_t wait; + wait_queue_entry_t wait; int result = 0; /* fastpath */ diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 36baf962f9b0..cd8b7bef8d06 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -1554,7 +1554,7 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) ssize_t result = 0; snd_pcm_state_t state; long res; - wait_queue_t wait; + wait_queue_entry_t wait; runtime = substream->runtime; init_waitqueue_entry(&wait, current); @@ -2387,7 +2387,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) struct snd_pcm_oss_file *pcm_oss_file; struct snd_pcm_oss_setup setup[2]; int nonblock; - wait_queue_t wait; + wait_queue_entry_t wait; err = nonseekable_open(inode, file); if (err < 0) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 5088d4b8db22..dd5254077ef7 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1904,7 +1904,7 @@ static int wait_for_avail(struct snd_pcm_substream *substream, { struct snd_pcm_runtime *runtime = substream->runtime; int is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; - wait_queue_t wait; + wait_queue_entry_t wait; int err = 0; snd_pcm_uframes_t avail = 0; long wait_time, tout; diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 13dec5ec93f2..faa2e2be6f2e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1652,7 +1652,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, struct snd_card *card; struct snd_pcm_runtime *runtime; struct snd_pcm_substream *s; - wait_queue_t wait; + wait_queue_entry_t wait; int result = 0; int nonblock = 0; @@ -2353,7 +2353,7 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) { int err; - wait_queue_t wait; + wait_queue_entry_t wait; if (pcm == NULL) { err = -ENODEV; diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index ab890336175f..32588ad05653 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -368,7 +368,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) int err; struct snd_rawmidi *rmidi; struct snd_rawmidi_file *rawmidi_file = NULL; - wait_queue_t wait; + wait_queue_entry_t wait; if ((file->f_flags & O_APPEND) && !(file->f_flags & O_NONBLOCK)) return -EINVAL; /* invalid combination */ @@ -1002,7 +1002,7 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun while (count > 0) { spin_lock_irq(&runtime->lock); while (!snd_rawmidi_ready(substream)) { - wait_queue_t wait; + wait_queue_entry_t wait; if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) { spin_unlock_irq(&runtime->lock); return result > 0 ? result : -EAGAIN; @@ -1306,7 +1306,7 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, while (count > 0) { spin_lock_irq(&runtime->lock); while (!snd_rawmidi_ready_append(substream, count)) { - wait_queue_t wait; + wait_queue_entry_t wait; if (file->f_flags & O_NONBLOCK) { spin_unlock_irq(&runtime->lock); return result > 0 ? result : -EAGAIN; @@ -1338,7 +1338,7 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, if (file->f_flags & O_DSYNC) { spin_lock_irq(&runtime->lock); while (runtime->avail != runtime->buffer_size) { - wait_queue_t wait; + wait_queue_entry_t wait; unsigned int last_avail = runtime->avail; init_waitqueue_entry(&wait, current); add_wait_queue(&runtime->sleep, &wait); diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index 01c4cfe30c9f..a8c2822e0198 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c @@ -179,7 +179,7 @@ int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, { struct snd_seq_event_cell *cell; unsigned long flags; - wait_queue_t wait; + wait_queue_entry_t wait; if (snd_BUG_ON(!f)) return -EINVAL; diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index d4c61ec9be13..d6e9aacdc36b 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -227,7 +227,7 @@ static int snd_seq_cell_alloc(struct snd_seq_pool *pool, struct snd_seq_event_cell *cell; unsigned long flags; int err = -EAGAIN; - wait_queue_t wait; + wait_queue_entry_t wait; if (pool == NULL) return -EINVAL; diff --git a/sound/core/timer.c b/sound/core/timer.c index cd67d1c12cf1..884c3066b028 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1964,7 +1964,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, spin_lock_irq(&tu->qlock); while ((long)count - result >= unit) { while (!tu->qused) { - wait_queue_t wait; + wait_queue_entry_t wait; if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) { err = -EAGAIN; diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index 4dae9ff9ef5a..0b1e4b34b299 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -1782,7 +1782,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev, int val, int port, unsigned long timeout) { - wait_queue_t wait; + wait_queue_entry_t wait; init_waitqueue_entry(&wait, current); spin_lock_irq(&dev->irq_lock); diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c index dccf3db48fe0..8bf2ce32d4a8 100644 --- a/sound/pci/mixart/mixart_core.c +++ b/sound/pci/mixart/mixart_core.c @@ -239,7 +239,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int struct mixart_msg resp; u32 msg_frame = 0; /* set to 0, so it's no notification to wait for, but the answer */ int err; - wait_queue_t wait; + wait_queue_entry_t wait; long timeout; init_waitqueue_entry(&wait, current); @@ -284,7 +284,7 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr, struct mixart_msg *request, u32 notif_event) { int err; - wait_queue_t wait; + wait_queue_entry_t wait; long timeout; if (snd_BUG_ON(!notif_event)) diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index fe4ba463b57c..1114166c685c 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -781,7 +781,7 @@ static snd_pcm_uframes_t snd_ymfpci_capture_pointer(struct snd_pcm_substream *su static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip) { - wait_queue_t wait; + wait_queue_entry_t wait; int loops = 4; while (loops-- > 0) { diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index a8d540398bbd..9120edf3c94b 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -184,7 +184,7 @@ int __attribute__((weak)) kvm_arch_set_irq_inatomic( * Called with wqh->lock held and interrupts disabled */ static int -irqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key) +irqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct kvm_kernel_irqfd *irqfd = container_of(wait, struct kvm_kernel_irqfd, wait); -- cgit v1.2.3-55-g7522 From de77b966ce8adcb4c58d50e2f087320d5479812a Mon Sep 17 00:00:00 2001 From: yuan linyu Date: Sun, 18 Jun 2017 22:48:17 +0800 Subject: net: introduce __skb_put_[zero, data, u8] follow Johannes Berg, semantic patch file as below, @@ identifier p, p2; expression len; expression skb; type t, t2; @@ ( -p = __skb_put(skb, len); +p = __skb_put_zero(skb, len); | -p = (t)__skb_put(skb, len); +p = __skb_put_zero(skb, len); ) ... when != p ( p2 = (t2)p; -memset(p2, 0, len); | -memset(p, 0, len); ) @@ identifier p; expression len; expression skb; type t; @@ ( -t p = __skb_put(skb, len); +t p = __skb_put_zero(skb, len); ) ... when != p ( -memset(p, 0, len); ) @@ type t, t2; identifier p, p2; expression skb; @@ t *p; ... ( -p = __skb_put(skb, sizeof(t)); +p = __skb_put_zero(skb, sizeof(t)); | -p = (t *)__skb_put(skb, sizeof(t)); +p = __skb_put_zero(skb, sizeof(t)); ) ... when != p ( p2 = (t2)p; -memset(p2, 0, sizeof(*p)); | -memset(p, 0, sizeof(*p)); ) @@ expression skb, len; @@ -memset(__skb_put(skb, len), 0, len); +__skb_put_zero(skb, len); @@ expression skb, len, data; @@ -memcpy(__skb_put(skb, len), data, len); +__skb_put_data(skb, data, len); @@ expression SKB, C, S; typedef u8; identifier fn = {__skb_put}; fresh identifier fn2 = fn ## "_u8"; @@ - *(u8 *)fn(SKB, S) = C; + fn2(SKB, C); Signed-off-by: yuan linyu Signed-off-by: David S. Miller --- drivers/crypto/chelsio/chcr_algo.c | 15 +++++---------- drivers/infiniband/hw/cxgb4/cm.c | 6 ++---- drivers/infiniband/hw/cxgb4/cq.c | 6 ++---- drivers/infiniband/hw/cxgb4/mem.c | 6 ++---- drivers/infiniband/hw/cxgb4/qp.c | 3 +-- drivers/isdn/gigaset/asyncdata.c | 4 ++-- drivers/isdn/gigaset/isocdata.c | 2 +- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 12 ++++-------- drivers/net/ethernet/chelsio/cxgb3/sge.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 3 +-- drivers/net/usb/int51x1.c | 2 +- drivers/staging/octeon/ethernet-tx.c | 3 +-- drivers/target/iscsi/cxgbit/cxgbit_cm.c | 12 ++++-------- include/linux/skbuff.h | 22 ++++++++++++++++++++++ lib/test_bpf.c | 2 +- net/802/garp.c | 2 +- net/bluetooth/bnep/core.c | 15 ++++++--------- net/bluetooth/bnep/netdev.c | 12 ++++++------ net/bridge/br_stp_bpdu.c | 2 +- 19 files changed, 64 insertions(+), 67 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index 92185ab6797d..b75b8beed68f 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c @@ -604,8 +604,7 @@ static struct sk_buff if (!skb) return ERR_PTR(-ENOMEM); skb_reserve(skb, sizeof(struct sge_opaque_hdr)); - chcr_req = __skb_put(skb, transhdr_len); - memset(chcr_req, 0, transhdr_len); + chcr_req = __skb_put_zero(skb, transhdr_len); chcr_req->sec_cpl.op_ivinsrtofst = FILL_SEC_CPL_OP_IVINSR(ctx->dev->rx_channel_id, 2, 1); @@ -881,8 +880,7 @@ static struct sk_buff *create_hash_wr(struct ahash_request *req, return skb; skb_reserve(skb, sizeof(struct sge_opaque_hdr)); - chcr_req = __skb_put(skb, transhdr_len); - memset(chcr_req, 0, transhdr_len); + chcr_req = __skb_put_zero(skb, transhdr_len); chcr_req->sec_cpl.op_ivinsrtofst = FILL_SEC_CPL_OP_IVINSR(ctx->dev->rx_channel_id, 2, 0); @@ -1447,8 +1445,7 @@ static struct sk_buff *create_authenc_wr(struct aead_request *req, skb_reserve(skb, sizeof(struct sge_opaque_hdr)); /* Write WR */ - chcr_req = __skb_put(skb, transhdr_len); - memset(chcr_req, 0, transhdr_len); + chcr_req = __skb_put_zero(skb, transhdr_len); stop_offset = (op_type == CHCR_ENCRYPT_OP) ? 0 : authsize; @@ -1779,8 +1776,7 @@ static struct sk_buff *create_aead_ccm_wr(struct aead_request *req, skb_reserve(skb, sizeof(struct sge_opaque_hdr)); - chcr_req = __skb_put(skb, transhdr_len); - memset(chcr_req, 0, transhdr_len); + chcr_req = __skb_put_zero(skb, transhdr_len); fill_sec_cpl_for_aead(&chcr_req->sec_cpl, dst_size, req, op_type, ctx); @@ -1892,8 +1888,7 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, /* NIC driver is going to write the sge hdr. */ skb_reserve(skb, sizeof(struct sge_opaque_hdr)); - chcr_req = __skb_put(skb, transhdr_len); - memset(chcr_req, 0, transhdr_len); + chcr_req = __skb_put_zero(skb, transhdr_len); if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106) req->assoclen -= 8; diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 76fb39415e18..e49b34c3b136 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -1900,8 +1900,7 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) int win; skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); - req = __skb_put(skb, sizeof(*req)); - memset(req, 0, sizeof(*req)); + req = __skb_put_zero(skb, sizeof(*req)); req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR)); req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); req->le.filter = cpu_to_be32(cxgb4_select_ntuple( @@ -3803,8 +3802,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL); if (!req_skb) return; - req = __skb_put(req_skb, sizeof(*req)); - memset(req, 0, sizeof(*req)); + req = __skb_put_zero(req_skb, sizeof(*req)); req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F); req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); req->le.version_cpl = htonl(FW_OFLD_CONNECTION_WR_CPL_F); diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index 394cfe2625fe..e16fcaf6b5a3 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c @@ -44,8 +44,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, wr_len = sizeof *res_wr + sizeof *res; set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - res_wr = __skb_put(skb, wr_len); - memset(res_wr, 0, wr_len); + res_wr = __skb_put_zero(skb, wr_len); res_wr->op_nres = cpu_to_be32( FW_WR_OP_V(FW_RI_RES_WR) | FW_RI_RES_WR_NRES_V(1) | @@ -114,8 +113,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, } set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - res_wr = __skb_put(skb, wr_len); - memset(res_wr, 0, wr_len); + res_wr = __skb_put_zero(skb, wr_len); res_wr->op_nres = cpu_to_be32( FW_WR_OP_V(FW_RI_RES_WR) | FW_RI_RES_WR_NRES_V(1) | diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index ca992e4b66e4..5332f06b99ba 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c @@ -81,8 +81,7 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr, } set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - req = __skb_put(skb, wr_len); - memset(req, 0, wr_len); + req = __skb_put_zero(skb, wr_len); INIT_ULPTX_WR(req, wr_len, 0, 0); req->wr.wr_hi = cpu_to_be32(FW_WR_OP_V(FW_ULPTX_WR) | (wait ? FW_WR_COMPL_F : 0)); @@ -142,8 +141,7 @@ static int _c4iw_write_mem_inline(struct c4iw_rdev *rdev, u32 addr, u32 len, } set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - req = __skb_put(skb, wr_len); - memset(req, 0, wr_len); + req = __skb_put_zero(skb, wr_len); INIT_ULPTX_WR(req, wr_len, 0, 0); if (i == (num_wqe-1)) { diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index b23a0b057347..bfc77596acbe 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c @@ -293,8 +293,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, } set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); - res_wr = __skb_put(skb, wr_len); - memset(res_wr, 0, wr_len); + res_wr = __skb_put_zero(skb, wr_len); res_wr->op_nres = cpu_to_be32( FW_WR_OP_V(FW_RI_RES_WR) | FW_RI_RES_WR_NRES_V(2) | diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c index 4caecdcc6f29..bc208557f783 100644 --- a/drivers/isdn/gigaset/asyncdata.c +++ b/drivers/isdn/gigaset/asyncdata.c @@ -264,7 +264,7 @@ byte_stuff: /* skip remainder of packet */ bcs->rx_skb = skb = NULL; } else { - *(u8 *)__skb_put(skb, 1) = c; + __skb_put_u8(skb, c); fcs = crc_ccitt_byte(fcs, c); } } @@ -315,7 +315,7 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) /* regular data byte: append to current skb */ inputstate |= INS_have_data; - *(u8 *)__skb_put(skb, 1) = bitrev8(c); + __skb_put_u8(skb, bitrev8(c)); } /* pass data up */ diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index 74e250664ce9..97e00118ccfe 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c @@ -511,7 +511,7 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) bcs->rx_skb = NULL; return; } - *(u8 *)__skb_put(bcs->rx_skb, 1) = c; + __skb_put_u8(bcs->rx_skb, c); } /* hdlc_flush diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index e1a50c87c9a9..0bc6a4ffce30 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -471,8 +471,7 @@ static int init_tp_parity(struct adapter *adap) if (!skb) goto alloc_skb_fail; - req = __skb_put(skb, sizeof(*req)); - memset(req, 0, sizeof(*req)); + req = __skb_put_zero(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i)); req->mtu_idx = NMTUS - 1; @@ -495,8 +494,7 @@ static int init_tp_parity(struct adapter *adap) if (!skb) goto alloc_skb_fail; - req = __skb_put(skb, sizeof(*req)); - memset(req, 0, sizeof(*req)); + req = __skb_put_zero(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, i)); req->params = htonl(V_L2T_W_IDX(i)); @@ -518,8 +516,7 @@ static int init_tp_parity(struct adapter *adap) if (!skb) goto alloc_skb_fail; - req = __skb_put(skb, sizeof(*req)); - memset(req, 0, sizeof(*req)); + req = __skb_put_zero(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RTE_WRITE_REQ, i)); req->l2t_idx = htonl(V_L2T_W_IDX(i)); @@ -538,8 +535,7 @@ static int init_tp_parity(struct adapter *adap) if (!skb) goto alloc_skb_fail; - greq = __skb_put(skb, sizeof(*greq)); - memset(greq, 0, sizeof(*greq)); + greq = __skb_put_zero(skb, sizeof(*greq)); greq->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(greq) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, 0)); greq->mask = cpu_to_be64(1); diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c index 1b9d154f1149..e2d342647b19 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c @@ -2282,7 +2282,7 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs, if (!skb) goto no_mem; - memcpy(__skb_put(skb, AN_PKT_SIZE), r, AN_PKT_SIZE); + __skb_put_data(skb, r, AN_PKT_SIZE); skb->data[0] = CPL_ASYNC_NOTIF; rss_hi = htonl(CPL_ASYNC_NOTIF << 24); q->async_notif++; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c index a0fab65e80e8..45b5853ca2f1 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c @@ -231,8 +231,7 @@ int set_filter_wr(struct adapter *adapter, int fidx) } } - fwr = __skb_put(skb, sizeof(*fwr)); - memset(fwr, 0, sizeof(*fwr)); + fwr = __skb_put_zero(skb, sizeof(*fwr)); /* It would be nice to put most of the following in t4_hw.c but most * of the work is translating the cxgbtool ch_filter_specification diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c index be63a829b8fe..ae2b2563460b 100644 --- a/drivers/net/usb/int51x1.c +++ b/drivers/net/usb/int51x1.c @@ -110,7 +110,7 @@ static struct sk_buff *int51x1_tx_fixup(struct usbnet *dev, *len = cpu_to_le16(pack_len); if(need_tail) - memset(__skb_put(skb, need_tail), 0, need_tail); + __skb_put_zero(skb, need_tail); return skb; } diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index ff4119e8de42..31f35025d19e 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c @@ -251,8 +251,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) if ((skb_tail_pointer(skb) + add_bytes) <= skb_end_pointer(skb)) - memset(__skb_put(skb, add_bytes), 0, - add_bytes); + __skb_put_zero(skb, add_bytes); } } } diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c index 15cd1e33b16b..e583dd8a418b 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c @@ -1085,8 +1085,7 @@ cxgbit_pass_accept_rpl(struct cxgbit_sock *csk, struct cpl_pass_accept_req *req) return; } - rpl5 = __skb_put(skb, len); - memset(rpl5, 0, len); + rpl5 = __skb_put_zero(skb, len); INIT_TP_WR(rpl5, csk->tid); OPCODE_TID(rpl5) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL, @@ -1367,8 +1366,7 @@ u32 cxgbit_send_tx_flowc_wr(struct cxgbit_sock *csk) flowclen16 = cxgbit_tx_flowc_wr_credits(csk, &nparams, &flowclen); skb = __skb_dequeue(&csk->skbq); - flowc = __skb_put(skb, flowclen); - memset(flowc, 0, flowclen); + flowc = __skb_put_zero(skb, flowclen); flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) | FW_FLOWC_WR_NPARAMS_V(nparams)); @@ -1439,8 +1437,7 @@ int cxgbit_setup_conn_digest(struct cxgbit_sock *csk) return -ENOMEM; /* set up ulp submode */ - req = __skb_put(skb, len); - memset(req, 0, len); + req = __skb_put_zero(skb, len); INIT_TP_WR(req, csk->tid); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid)); @@ -1476,8 +1473,7 @@ int cxgbit_setup_conn_pgidx(struct cxgbit_sock *csk, u32 pg_idx) if (!skb) return -ENOMEM; - req = __skb_put(skb, len); - memset(req, 0, len); + req = __skb_put_zero(skb, len); INIT_TP_WR(req, csk->tid); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid)); diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 852feacf4bbf..a17e235639ae 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1904,6 +1904,28 @@ static inline void *__skb_put(struct sk_buff *skb, unsigned int len) return tmp; } +static inline void *__skb_put_zero(struct sk_buff *skb, unsigned int len) +{ + void *tmp = __skb_put(skb, len); + + memset(tmp, 0, len); + return tmp; +} + +static inline void *__skb_put_data(struct sk_buff *skb, const void *data, + unsigned int len) +{ + void *tmp = __skb_put(skb, len); + + memcpy(tmp, data, len); + return tmp; +} + +static inline void __skb_put_u8(struct sk_buff *skb, u8 val) +{ + *(u8 *)__skb_put(skb, 1) = val; +} + static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len) { void *tmp = skb_put(skb, len); diff --git a/lib/test_bpf.c b/lib/test_bpf.c index c871e0e76c2a..d9d5a410955c 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -5717,7 +5717,7 @@ static struct sk_buff *populate_skb(char *buf, int size) if (!skb) return NULL; - memcpy(__skb_put(skb, size), buf, size); + __skb_put_data(skb, buf, size); /* Initialize a fake skb with test pattern. */ skb_reset_mac_header(skb); diff --git a/net/802/garp.c b/net/802/garp.c index a9a266569293..2dac647ff420 100644 --- a/net/802/garp.c +++ b/net/802/garp.c @@ -232,7 +232,7 @@ static int garp_pdu_append_end_mark(struct garp_applicant *app) { if (skb_tailroom(app->pdu) < sizeof(u8)) return -1; - *(u8 *)__skb_put(app->pdu, sizeof(u8)) = GARP_END_MARK; + __skb_put_u8(app->pdu, GARP_END_MARK); return 0; } diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index fbf251fef70f..9a40013da915 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -374,25 +374,22 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) /* Decompress header and construct ether frame */ switch (type & BNEP_TYPE_MASK) { case BNEP_COMPRESSED: - memcpy(__skb_put(nskb, ETH_HLEN), &s->eh, ETH_HLEN); + __skb_put_data(nskb, &s->eh, ETH_HLEN); break; case BNEP_COMPRESSED_SRC_ONLY: - memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN); - memcpy(__skb_put(nskb, ETH_ALEN), skb_mac_header(skb), ETH_ALEN); + __skb_put_data(nskb, s->eh.h_dest, ETH_ALEN); + __skb_put_data(nskb, skb_mac_header(skb), ETH_ALEN); put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); break; case BNEP_COMPRESSED_DST_ONLY: - memcpy(__skb_put(nskb, ETH_ALEN), skb_mac_header(skb), - ETH_ALEN); - memcpy(__skb_put(nskb, ETH_ALEN + 2), s->eh.h_source, - ETH_ALEN + 2); + __skb_put_data(nskb, skb_mac_header(skb), ETH_ALEN); + __skb_put_data(nskb, s->eh.h_source, ETH_ALEN + 2); break; case BNEP_GENERAL: - memcpy(__skb_put(nskb, ETH_ALEN * 2), skb_mac_header(skb), - ETH_ALEN * 2); + __skb_put_data(nskb, skb_mac_header(skb), ETH_ALEN * 2); put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); break; } diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c index 2b875edf77e1..1d4d7d415730 100644 --- a/net/bluetooth/bnep/netdev.c +++ b/net/bluetooth/bnep/netdev.c @@ -75,16 +75,16 @@ static void bnep_net_set_mc_list(struct net_device *dev) u8 start[ETH_ALEN] = { 0x01 }; /* Request all addresses */ - memcpy(__skb_put(skb, ETH_ALEN), start, ETH_ALEN); - memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); + __skb_put_data(skb, start, ETH_ALEN); + __skb_put_data(skb, dev->broadcast, ETH_ALEN); r->len = htons(ETH_ALEN * 2); } else { struct netdev_hw_addr *ha; int i, len = skb->len; if (dev->flags & IFF_BROADCAST) { - memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); - memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); + __skb_put_data(skb, dev->broadcast, ETH_ALEN); + __skb_put_data(skb, dev->broadcast, ETH_ALEN); } /* FIXME: We should group addresses here. */ @@ -93,8 +93,8 @@ static void bnep_net_set_mc_list(struct net_device *dev) netdev_for_each_mc_addr(ha, dev) { if (i == BNEP_MAX_MULTICAST_FILTERS) break; - memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN); - memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN); + __skb_put_data(skb, ha->addr, ETH_ALEN); + __skb_put_data(skb, ha->addr, ETH_ALEN); i++; } diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 5881fbc114a9..1b75d6bf12bd 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c @@ -50,7 +50,7 @@ static void br_send_bpdu(struct net_bridge_port *p, skb->priority = TC_PRIO_CONTROL; skb_reserve(skb, LLC_RESERVE); - memcpy(__skb_put(skb, length), data, length); + __skb_put_data(skb, data, length); llc_pdu_header_init(skb, LLC_PDU_TYPE_U, LLC_SAP_BSPAN, LLC_SAP_BSPAN, LLC_PDU_CMD); -- cgit v1.2.3-55-g7522 From b952f4dff2751252db073c27c0f8a16a416a2ddc Mon Sep 17 00:00:00 2001 From: yuan linyu Date: Sun, 18 Jun 2017 22:52:04 +0800 Subject: net: manual clean code which call skb_put_[data:zero] Signed-off-by: yuan linyu Signed-off-by: David S. Miller --- drivers/isdn/hysdn/hycapi.c | 8 ++++---- drivers/isdn/i4l/isdn_bsdcomp.c | 2 +- drivers/isdn/i4l/isdn_ppp.c | 2 +- drivers/net/bonding/bond_alb.c | 3 +-- drivers/net/caif/caif_hsi.c | 6 ++---- drivers/net/caif/caif_serial.c | 3 +-- drivers/net/caif/caif_spi.c | 3 +-- drivers/net/ethernet/nxp/lpc_eth.c | 7 +++---- drivers/net/ethernet/packetengines/hamachi.c | 4 ++-- drivers/net/ppp/ppp_synctty.c | 2 +- drivers/net/usb/asix_common.c | 5 ++--- drivers/net/usb/hso.c | 13 ++++++------- drivers/net/wireless/ath/ath9k/wmi.c | 3 +-- drivers/net/wireless/marvell/libertas/if_sdio.c | 3 +-- drivers/net/wireless/quantenna/qtnfmac/qlink_util.h | 4 +--- drivers/net/wireless/realtek/rtlwifi/pci.c | 3 +-- drivers/net/wireless/rsi/rsi_91x_mgmt.c | 10 +++------- drivers/net/wireless/ti/wlcore/rx.c | 3 +-- drivers/nfc/pn533/pn533.c | 4 ++-- drivers/staging/rtl8188eu/core/rtw_recv.c | 4 +--- drivers/staging/rtl8192e/rtllib_rx.c | 5 ++--- drivers/staging/rtl8192e/rtllib_softmac.c | 11 ++++++----- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 +--- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 11 +++++------ drivers/staging/rtl8192u/r819xU_cmdpkt.c | 3 +-- drivers/staging/rtl8712/rtl8712_recv.c | 4 ++-- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 4 +--- drivers/staging/wlan-ng/hfa384x_usb.c | 2 +- drivers/usb/gadget/function/f_ncm.c | 11 +++++------ lib/nlattr.c | 6 +----- net/bridge/netfilter/nft_reject_bridge.c | 6 ++---- net/dsa/tag_trailer.c | 3 +-- net/hsr/hsr_device.c | 6 +++--- net/irda/irlap_frame.c | 5 ++--- net/mac80211/mlme.c | 12 ++++-------- net/mac80211/tdls.c | 19 +++++++++---------- net/sctp/sm_make_chunk.c | 3 +-- net/vmw_vsock/virtio_transport_common.c | 5 ++--- net/x25/x25_subr.c | 16 ++++++++-------- 39 files changed, 93 insertions(+), 135 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index 87119b517508..eac0f51a0f60 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c @@ -173,8 +173,8 @@ hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl, } skb_put_data(skb, &len, sizeof(__u16)); skb_put_data(skb, &appl, sizeof(__u16)); - memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command)); - memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand)); + skb_put_data(skb, &_command, sizeof(__u8)); + skb_put_data(skb, &_subcommand, sizeof(__u8)); skb_put_data(skb, &MessageNumber, sizeof(__u16)); skb_put_data(skb, &MessageBufferSize, sizeof(__u16)); skb_put_data(skb, &(rp->level3cnt), sizeof(__u16)); @@ -281,8 +281,8 @@ static void hycapi_release_internal(struct capi_ctr *ctrl, __u16 appl) } skb_put_data(skb, &len, sizeof(__u16)); skb_put_data(skb, &appl, sizeof(__u16)); - memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command)); - memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand)); + skb_put_data(skb, &_command, sizeof(__u8)); + skb_put_data(skb, &_subcommand, sizeof(__u8)); skb_put_data(skb, &MessageNumber, sizeof(__u16)); hycapi_send_message(ctrl, skb); hycapi_applications[appl - 1].ctrl_mask &= ~(1 << (ctrl->cnr - 1)); diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c index 3035210a6119..5b64a1389a7c 100644 --- a/drivers/isdn/i4l/isdn_bsdcomp.c +++ b/drivers/isdn/i4l/isdn_bsdcomp.c @@ -472,7 +472,7 @@ static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb accm |= ((ent) << bitno); \ do { \ if (skb_out && skb_tailroom(skb_out) > 0) \ - *(u8 *)skb_put(skb_out, 1) = (u8)(accm >> 24); \ + skb_put(skb_out, (u8)(accm >> 24)); \ accm <<= 8; \ bitno += 8; \ } while (bitno <= 24); \ diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index b7e3f1cde683..88e5a025cea7 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c @@ -2258,7 +2258,7 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto, /* Now stuff remaining bytes */ if (len) { - p = skb_put_data(skb, data, len); + skb_put_data(skb, data, len); } /* skb is now ready for xmit */ diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index b796db7dd621..c02cc817a490 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -925,7 +925,6 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[], struct learning_pkt pkt; struct sk_buff *skb; int size = sizeof(struct learning_pkt); - char *data; memset(&pkt, 0, size); ether_addr_copy(pkt.mac_dst, mac_addr); @@ -936,7 +935,7 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[], if (!skb) return; - data = skb_put_data(skb, &pkt, size); + skb_put_data(skb, &pkt, size); skb_reset_mac_header(skb); skb->network_header = skb->mac_header + ETH_HLEN; diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c index 4534326e20ac..11ba6e3eea22 100644 --- a/drivers/net/caif/caif_hsi.c +++ b/drivers/net/caif/caif_hsi.c @@ -426,7 +426,6 @@ static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi) /* Check for embedded CAIF frame. */ if (desc->offset) { struct sk_buff *skb; - u8 *dst = NULL; int len = 0; pfrm = ((u8 *)desc) + desc->offset; @@ -454,7 +453,7 @@ static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi) } caif_assert(skb != NULL); - dst = skb_put_data(skb, pfrm, len); + skb_put_data(skb, pfrm, len); skb->protocol = htons(ETH_P_CAIF); skb_reset_mac_header(skb); @@ -555,7 +554,6 @@ static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi) /* Parse payload. */ while (nfrms < CFHSI_MAX_PKTS && *plen) { struct sk_buff *skb; - u8 *dst = NULL; u8 *pcffrm = NULL; int len; @@ -584,7 +582,7 @@ static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi) } caif_assert(skb != NULL); - dst = skb_put_data(skb, pcffrm, len); + skb_put_data(skb, pcffrm, len); skb->protocol = htons(ETH_P_CAIF); skb_reset_mac_header(skb); diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 5c57be2082ba..709838e4c062 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c @@ -171,7 +171,6 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data, struct sk_buff *skb = NULL; struct ser_device *ser; int ret; - u8 *p; ser = tty->disc_data; @@ -198,7 +197,7 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data, skb = netdev_alloc_skb(ser->dev, count+1); if (skb == NULL) return; - p = skb_put_data(skb, data, count); + skb_put_data(skb, data, count); skb->protocol = htons(ETH_P_CAIF); skb_reset_mac_header(skb); diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c index 24a5f5ca2037..207cb8423de0 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c @@ -526,7 +526,6 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len) struct sk_buff *skb = NULL; int spad = 0; int epad = 0; - u8 *dst = NULL; int pkt_len = 0; /* @@ -548,7 +547,7 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len) skb = netdev_alloc_skb(cfspi->ndev, pkt_len + 1); caif_assert(skb != NULL); - dst = skb_put_data(skb, src, pkt_len); + skb_put_data(skb, src, pkt_len); src += pkt_len; skb->protocol = htons(ETH_P_CAIF); diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 828bfd93cb54..08381ef8bdb4 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c @@ -919,7 +919,6 @@ static int __lpc_handle_recv(struct net_device *ndev, int budget) struct sk_buff *skb; u32 rxconsidx, len, ethst; struct rx_status_t *prxstat; - u8 *prdbuf; int rx_done = 0; /* Get the current RX buffer indexes */ @@ -960,9 +959,9 @@ static int __lpc_handle_recv(struct net_device *ndev, int budget) ndev->stats.rx_dropped++; } else { /* Copy packet from buffer */ - prdbuf = skb_put_data(skb, - pldat->rx_buff_v + rxconsidx * ENET_MAXF_SIZE, - len); + skb_put_data(skb, + pldat->rx_buff_v + rxconsidx * ENET_MAXF_SIZE, + len); /* Pass to upper layer */ skb->protocol = eth_type_trans(skb, ndev); diff --git a/drivers/net/ethernet/packetengines/hamachi.c b/drivers/net/ethernet/packetengines/hamachi.c index 8b026dbf0d8d..482b85e4d665 100644 --- a/drivers/net/ethernet/packetengines/hamachi.c +++ b/drivers/net/ethernet/packetengines/hamachi.c @@ -1495,8 +1495,8 @@ static int hamachi_rx(struct net_device *dev) hmp->rx_skbuff[entry]->data, pkt_len); skb_put(skb, pkt_len); #else - memcpy(skb_put(skb, pkt_len), hmp->rx_ring_dma - + entry*sizeof(*desc), pkt_len); + skb_put_data(skb, hmp->rx_ring_dma + + entry*sizeof(*desc), pkt_len); #endif pci_dma_sync_single_for_device(hmp->pci_dev, leXX_to_cpu(hmp->rx_ring[entry].addr), diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c index ef08590db873..7868c29071d4 100644 --- a/drivers/net/ppp/ppp_synctty.c +++ b/drivers/net/ppp/ppp_synctty.c @@ -697,7 +697,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, goto err; } - p = skb_put_data(skb, buf, count); + skb_put_data(skb, buf, count); /* strip address/control field if present */ p = skb->data; diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c index 90facc5ecab0..7847436c441e 100644 --- a/drivers/net/usb/asix_common.c +++ b/drivers/net/usb/asix_common.c @@ -113,7 +113,6 @@ int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb, while (offset + sizeof(u16) <= skb->len) { u16 copy_length; - unsigned char *data; if (!rx->remaining) { if (skb->len - offset == sizeof(u16)) { @@ -167,8 +166,8 @@ int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb, } if (rx->ax_skb) { - data = skb_put_data(rx->ax_skb, skb->data + offset, - copy_length); + skb_put_data(rx->ax_skb, skb->data + offset, + copy_length); if (!rx->remaining) usbnet_skb_return(dev, rx->ax_skb); } diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 908ada4ca21c..d7a3379ea668 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -861,7 +861,6 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, unsigned short temp_bytes; unsigned short buffer_offset = 0; unsigned short frame_len; - unsigned char *tmp_rx_buf; /* log if needed */ hso_dbg(0x1, "Rx %d bytes\n", count); @@ -911,9 +910,9 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, /* Copy what we got so far. make room for iphdr * after tail. */ - tmp_rx_buf = skb_put_data(odev->skb_rx_buf, - (char *)&(odev->rx_ip_hdr), - sizeof(struct iphdr)); + skb_put_data(odev->skb_rx_buf, + (char *)&(odev->rx_ip_hdr), + sizeof(struct iphdr)); /* ETH_HLEN */ odev->rx_buf_size = sizeof(struct iphdr); @@ -932,9 +931,9 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, /* Copy the rest of the bytes that are left in the * buffer into the waiting sk_buf. */ /* Make room for temp_bytes after tail. */ - tmp_rx_buf = skb_put_data(odev->skb_rx_buf, - ip_pkt + buffer_offset, - temp_bytes); + skb_put_data(odev->skb_rx_buf, + ip_pkt + buffer_offset, + temp_bytes); odev->rx_buf_missing -= temp_bytes; count -= temp_bytes; diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index 85d09fdef8dc..64a354fa78ab 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c @@ -298,7 +298,6 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, u16 headroom = sizeof(struct htc_frame_hdr) + sizeof(struct wmi_cmd_hdr); struct sk_buff *skb; - u8 *data; unsigned long time_left; int ret = 0; @@ -312,7 +311,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, skb_reserve(skb, headroom); if (cmd_len != 0 && cmd_buf != NULL) { - data = skb_put_data(skb, cmd_buf, cmd_len); + skb_put_data(skb, cmd_buf, cmd_len); } mutex_lock(&wmi->op_mutex); diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c index a9e2b06b3175..2300e796c6ab 100644 --- a/drivers/net/wireless/marvell/libertas/if_sdio.c +++ b/drivers/net/wireless/marvell/libertas/if_sdio.c @@ -239,7 +239,6 @@ static int if_sdio_handle_data(struct if_sdio_card *card, { int ret; struct sk_buff *skb; - char *data; if (size > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { lbs_deb_sdio("response packet too large (%d bytes)\n", @@ -256,7 +255,7 @@ static int if_sdio_handle_data(struct if_sdio_card *card, skb_reserve(skb, NET_IP_ALIGN); - data = skb_put_data(skb, buffer, size); + skb_put_data(skb, buffer, size); lbs_process_rxed_packet(card->priv, skb); diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h index f6ac39973b5d..90d7d09a6c63 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h @@ -33,9 +33,7 @@ static inline void qtnf_cmd_skb_put_action(struct sk_buff *skb, u16 action) static inline void qtnf_cmd_skb_put_buffer(struct sk_buff *skb, const u8 *buf_src, size_t len) { - u8 *buf_dst; - - buf_dst = skb_put_data(skb, buf_src, len); + skb_put_data(skb, buf_src, len); } static inline void qtnf_cmd_skb_put_tlv_arr(struct sk_buff *skb, diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c index 0c1f8307e179..df5f6795f650 100644 --- a/drivers/net/wireless/realtek/rtlwifi/pci.c +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c @@ -729,13 +729,12 @@ static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw, dev_kfree_skb_any(skb); } else { struct sk_buff *uskb = NULL; - u8 *pdata; uskb = dev_alloc_skb(skb->len + 128); if (likely(uskb)) { memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status)); - pdata = skb_put_data(uskb, skb->data, skb->len); + skb_put_data(uskb, skb->data, skb->len); dev_kfree_skb_any(skb); ieee80211_rx_irqsafe(hw, uskb); } else { diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c index 4433cec4367c..a0f04371d93b 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c @@ -389,9 +389,7 @@ static int rsi_mgmt_pkt_to_core(struct rsi_common *common, struct ieee80211_tx_info *info; struct skb_info *rx_params; u8 pad_bytes = msg[4]; - u8 pkt_recv; struct sk_buff *skb; - char *buffer; if (type == RX_DOT11_MGMT) { if (!adapter->sc_nvifs) @@ -412,11 +410,9 @@ static int rsi_mgmt_pkt_to_core(struct rsi_common *common, return -ENOMEM; } - buffer = skb_put_data(skb, - (u8 *)(msg + FRAME_DESC_SZ + pad_bytes), - msg_len); - - pkt_recv = buffer[0]; + skb_put_data(skb, + (u8 *)(msg + FRAME_DESC_SZ + pad_bytes), + msg_len); info = IEEE80211_SKB_CB(skb); rx_params = (struct skb_info *)info->driver_data; diff --git a/drivers/net/wireless/ti/wlcore/rx.c b/drivers/net/wireless/ti/wlcore/rx.c index 53cd6d4d5b50..0f15696195f8 100644 --- a/drivers/net/wireless/ti/wlcore/rx.c +++ b/drivers/net/wireless/ti/wlcore/rx.c @@ -117,7 +117,6 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length, struct wl1271_rx_descriptor *desc; struct sk_buff *skb; struct ieee80211_hdr *hdr; - u8 *buf; u8 beacon = 0; u8 is_data = 0; u8 reserved = 0, offset_to_data = 0; @@ -180,7 +179,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length, * packets copy the packets in offset of 2 bytes guarantee IP header * payload aligned to 4 bytes. */ - buf = skb_put_data(skb, data + sizeof(*desc), pkt_data_len); + skb_put_data(skb, data + sizeof(*desc), pkt_data_len); if (rx_align == WLCORE_RX_BUF_PADDED) skb_pull(skb, RX_BUF_ALIGN); diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index c8a8f5badb5b..c05cb637ba92 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c @@ -1006,7 +1006,7 @@ static int pn533_start_poll_complete(struct pn533 *dev, struct sk_buff *resp) static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev) { struct sk_buff *skb; - u8 *felica, *nfcid3, *gb; + u8 *felica, *nfcid3; u8 *gbytes = dev->gb; size_t gbytes_len = dev->gb_len; @@ -1048,7 +1048,7 @@ static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev) /* General bytes */ skb_put_u8(skb, gbytes_len); - gb = skb_put_data(skb, gbytes, gbytes_len); + skb_put_data(skb, gbytes, gbytes_len); /* Len Tk */ skb_put_u8(skb, 0); diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 14173cf6e1e7..afb9dadc1cfe 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -1510,7 +1510,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) u8 nr_subframes, i; unsigned char *pdata; struct rx_pkt_attrib *pattrib; - unsigned char *data_ptr; struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT]; struct recv_priv *precvpriv = &padapter->recvpriv; struct __queue *pfree_recv_queue = &(precvpriv->free_recv_queue); @@ -1544,8 +1543,7 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) sub_skb = dev_alloc_skb(nSubframe_Length + 12); if (sub_skb) { skb_reserve(sub_skb, 12); - data_ptr = skb_put_data(sub_skb, pdata, - nSubframe_Length); + skb_put_data(sub_skb, pdata, nSubframe_Length); } else { sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC); if (sub_skb) { diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index bae98ca0a9b6..03a81ba136b2 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -782,7 +782,6 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, u8 nPadding_Length = 0; u16 SeqNum = 0; struct sk_buff *sub_skb; - u8 *data_ptr; /* just for debug purpose */ SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl)); if ((RTLLIB_QOS_HAS_SEQ(fc)) && @@ -817,7 +816,7 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, if (!sub_skb) return 0; skb_reserve(sub_skb, 12); - data_ptr = skb_put_data(sub_skb, skb->data, skb->len); + skb_put_data(sub_skb, skb->data, skb->len); sub_skb->dev = ieee->dev; rxb->subframes[0] = sub_skb; @@ -869,7 +868,7 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, if (!sub_skb) return 0; skb_reserve(sub_skb, 12); - data_ptr = skb_put_data(sub_skb, skb->data, nSubframe_Length); + skb_put_data(sub_skb, skb->data, nSubframe_Length); sub_skb->dev = ieee->dev; rxb->subframes[rxb->nr_subframes++] = sub_skb; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 5f2751d4d464..09d2c8649171 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1264,7 +1264,7 @@ rtllib_association_req(struct rtllib_network *beacon, hdr->info_element[0].id = MFIE_TYPE_SSID; hdr->info_element[0].len = beacon->ssid_len; - tag = skb_put_data(skb, beacon->ssid, beacon->ssid_len); + skb_put_data(skb, beacon->ssid, beacon->ssid_len); tag = skb_put(skb, rate_len); @@ -1340,7 +1340,7 @@ rtllib_association_req(struct rtllib_network *beacon, } if (wpa_ie_len) { - tag = skb_put_data(skb, ieee->wpa_ie, ieee->wpa_ie_len); + skb_put_data(skb, ieee->wpa_ie, ieee->wpa_ie_len); if (PMKCacheIdx >= 0) { tag = skb_put(skb, 18); @@ -1356,12 +1356,13 @@ rtllib_association_req(struct rtllib_network *beacon, } if (wps_ie_len && ieee->wps_ie) { - tag = skb_put_data(skb, ieee->wps_ie, wps_ie_len); + skb_put_data(skb, ieee->wps_ie, wps_ie_len); } - tag = skb_put(skb, turbo_info_len); - if (turbo_info_len) + if (turbo_info_len) { + tag = skb_put(skb, turbo_info_len); rtllib_TURBO_Info(ieee, &tag); + } if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) { if (ieee->pHTInfo->ePeerHTSpecVer == HT_SPEC_VER_EWC) { diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index c0e2f711cb4e..a4aedb489e92 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -780,7 +780,6 @@ static u8 parse_subframe(struct sk_buff *skb, u16 SeqNum=0; struct sk_buff *sub_skb; - u8 *data_ptr; /* just for debug purpose */ SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl)); @@ -848,8 +847,7 @@ static u8 parse_subframe(struct sk_buff *skb, if (!sub_skb) return 0; skb_reserve(sub_skb, 12); - data_ptr = skb_put_data(sub_skb, skb->data, - nSubframe_Length); + skb_put_data(sub_skb, skb->data, nSubframe_Length); #endif rxb->subframes[rxb->nr_subframes++] = sub_skb; if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 107069180ed2..fe6f38b7ec35 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1112,7 +1112,7 @@ ieee80211_association_req(struct ieee80211_network *beacon, hdr->info_element[0].id = MFIE_TYPE_SSID; hdr->info_element[0].len = beacon->ssid_len; - tag = skb_put_data(skb, beacon->ssid, beacon->ssid_len); + skb_put_data(skb, beacon->ssid, beacon->ssid_len); tag = skb_put(skb, rate_len); @@ -1184,18 +1184,17 @@ ieee80211_association_req(struct ieee80211_network *beacon, //choose what wpa_supplicant gives to associate. - tag = skb_put(skb, wpa_ie_len); if (wpa_ie_len) { - memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); + skb_put_data(skb, ieee->wpa_ie, wpa_ie_len); } - tag = skb_put(skb, wmm_info_len); if (wmm_info_len) { - ieee80211_WMM_Info(ieee, &tag); + tag = skb_put(skb, wmm_info_len); + ieee80211_WMM_Info(ieee, &tag); } #ifdef THOMAS_TURBO - tag = skb_put(skb, turbo_info_len); if (turbo_info_len) { + tag = skb_put(skb, turbo_info_len); ieee80211_TURBO_Info(ieee, &tag); } #endif diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index c3cf01c842a3..87ab3ba760fc 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -31,7 +31,6 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) struct r8192_priv *priv = ieee80211_priv(dev); struct sk_buff *skb; struct cb_desc *tcb_desc; - unsigned char *ptr_buf; /* Get TCB and local buffer from common pool. * (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) @@ -45,7 +44,7 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL; tcb_desc->bLastIniPkt = 0; skb_reserve(skb, USB_HWDESC_HEADER_LEN); - ptr_buf = skb_put_data(skb, pData, DataLen); + skb_put_data(skb, pData, DataLen); tcb_desc->txbuf_size = (u16)DataLen; if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) || diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index f96c558b3c6a..ea3eb94b28b3 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -340,7 +340,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe) int a_len, padding_len; u16 eth_type, nSubframe_Length; u8 nr_subframes, i; - unsigned char *data_ptr, *pdata; + unsigned char *pdata; struct rx_pkt_attrib *pattrib; _pkt *sub_skb, *subframes[MAX_SUBFRAME_COUNT]; struct recv_priv *precvpriv = &padapter->recvpriv; @@ -372,7 +372,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe) if (!sub_skb) break; skb_reserve(sub_skb, 12); - data_ptr = skb_put_data(sub_skb, pdata, nSubframe_Length); + skb_put_data(sub_skb, pdata, nSubframe_Length); subframes[nr_subframes++] = sub_skb; if (nr_subframes >= MAX_SUBFRAME_COUNT) { netdev_warn(padapter->pnetdev, "r8712u: ParseSubframe(): Too many Subframes! Packets dropped!\n"); diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index 1a6443dc3ff0..f42e00081e0e 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -72,7 +72,6 @@ int rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *prec _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata) { u16 eth_type; - u8 *data_ptr; _pkt *sub_skb; struct rx_pkt_attrib *pattrib; @@ -82,8 +81,7 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 if (sub_skb) { skb_reserve(sub_skb, 12); - data_ptr = skb_put_data(sub_skb, (pdata + ETH_HLEN), - nSubframe_Length); + skb_put_data(sub_skb, (pdata + ETH_HLEN), nSubframe_Length); } else { diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index 1de67f209f2c..83ea8ab4f2f4 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -3530,7 +3530,7 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev, /* Copy the 802.11 header to the skb * (ctl frames may be less than a full header) */ - datap = skb_put_data(skb, &rxdesc->frame_control, hdrlen); + skb_put_data(skb, &rxdesc->frame_control, hdrlen); /* If any, copy the data from the card to the skb */ if (datalen > 0) { diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index a9c28c72c1c7..24e34cfcb4bd 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -1004,16 +1004,15 @@ static struct sk_buff *package_for_tx(struct f_ncm *ncm) } /* Insert NDP alignment. */ - ntb_iter = skb_put_zero(skb2, ndp_pad); + skb_put_zero(skb2, ndp_pad); /* Copy NTB across. */ - ntb_iter = skb_put_data(skb2, ncm->skb_tx_ndp->data, - ncm->skb_tx_ndp->len); + skb_put_data(skb2, ncm->skb_tx_ndp->data, ncm->skb_tx_ndp->len); dev_consume_skb_any(ncm->skb_tx_ndp); ncm->skb_tx_ndp = NULL; /* Insert zero'd datagram. */ - ntb_iter = skb_put_zero(skb2, dgram_idx_len); + skb_put_zero(skb2, dgram_idx_len); return skb2; } @@ -1127,8 +1126,8 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port, ncm->ndp_dgram_count++; /* Add the new data to the skb */ - ntb_data = skb_put_zero(ncm->skb_tx_data, dgram_pad); - ntb_data = skb_put_data(ncm->skb_tx_data, skb->data, skb->len); + skb_put_zero(ncm->skb_tx_data, dgram_pad); + skb_put_data(ncm->skb_tx_data, skb->data, skb->len); dev_consume_skb_any(skb); skb = NULL; diff --git a/lib/nlattr.c b/lib/nlattr.c index a0c738aa6a79..fb52435be42d 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -398,11 +398,7 @@ EXPORT_SYMBOL(__nla_reserve_64bit); */ void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen) { - void *start; - - start = skb_put_zero(skb, NLA_ALIGN(attrlen)); - - return start; + return skb_put_zero(skb, NLA_ALIGN(attrlen)); } EXPORT_SYMBOL(__nla_reserve_nohdr); diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c index a05775afa44b..eaf05de37f75 100644 --- a/net/bridge/netfilter/nft_reject_bridge.c +++ b/net/bridge/netfilter/nft_reject_bridge.c @@ -107,7 +107,6 @@ static void nft_reject_br_send_v4_unreach(struct net *net, struct iphdr *niph; struct icmphdr *icmph; unsigned int len; - void *payload; __wsum csum; u8 proto; @@ -151,7 +150,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net, icmph->type = ICMP_DEST_UNREACH; icmph->code = code; - payload = skb_put_data(nskb, skb_network_header(oldskb), len); + skb_put_data(nskb, skb_network_header(oldskb), len); csum = csum_partial((void *)icmph, len + sizeof(struct icmphdr), 0); icmph->checksum = csum_fold(csum); @@ -247,7 +246,6 @@ static void nft_reject_br_send_v6_unreach(struct net *net, struct ipv6hdr *nip6h; struct icmp6hdr *icmp6h; unsigned int len; - void *payload; if (!nft_bridge_ip6hdr_validate(oldskb)) return; @@ -277,7 +275,7 @@ static void nft_reject_br_send_v6_unreach(struct net *net, icmp6h->icmp6_type = ICMPV6_DEST_UNREACH; icmp6h->icmp6_code = code; - payload = skb_put_data(nskb, skb_network_header(oldskb), len); + skb_put_data(nskb, skb_network_header(oldskb), len); nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr)); icmp6h->icmp6_cksum = diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c index 172f13167896..b09e56214005 100644 --- a/net/dsa/tag_trailer.c +++ b/net/dsa/tag_trailer.c @@ -43,8 +43,7 @@ static struct sk_buff *trailer_xmit(struct sk_buff *skb, struct net_device *dev) kfree_skb(skb); if (padlen) { - u8 *pad = skb_put(nskb, padlen); - memset(pad, 0, padlen); + skb_put_zero(nskb, padlen); } trailer = skb_put(nskb, 4); diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 0a0a392dc2bd..4e7bdb213cd0 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -284,12 +284,12 @@ static void send_hsr_supervision_frame(struct hsr_port *master, skb_reset_mac_header(skb); if (hsrVer > 0) { - hsr_tag = (typeof(hsr_tag)) skb_put(skb, sizeof(struct hsr_tag)); + hsr_tag = skb_put(skb, sizeof(struct hsr_tag)); hsr_tag->encap_proto = htons(ETH_P_PRP); set_hsr_tag_LSDU_size(hsr_tag, HSR_V1_SUP_LSDUSIZE); } - hsr_stag = (typeof(hsr_stag)) skb_put(skb, sizeof(struct hsr_sup_tag)); + hsr_stag = skb_put(skb, sizeof(struct hsr_sup_tag)); set_hsr_stag_path(hsr_stag, (hsrVer ? 0x0 : 0xf)); set_hsr_stag_HSR_Ver(hsr_stag, hsrVer); @@ -311,7 +311,7 @@ static void send_hsr_supervision_frame(struct hsr_port *master, hsr_stag->HSR_TLV_Length = hsrVer ? sizeof(struct hsr_sup_payload) : 12; /* Payload: MacAddressA */ - hsr_sp = (typeof(hsr_sp)) skb_put(skb, sizeof(struct hsr_sup_payload)); + hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload)); ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr); skb_put_padto(skb, ETH_ZLEN + HSR_HLEN); diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index 82e71e5622c2..debda3de4726 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c @@ -392,7 +392,7 @@ void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s, info[0] = discovery->data.charset; len = IRDA_MIN(discovery->name_len, skb_tailroom(tx_skb)); - info = skb_put_data(tx_skb, discovery->data.info, len); + skb_put_data(tx_skb, discovery->data.info, len); } irlap_queue_xmit(self, tx_skb); } @@ -1194,7 +1194,6 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, { struct sk_buff *tx_skb; struct test_frame *frame; - __u8 *info; tx_skb = alloc_skb(cmd->len + sizeof(struct test_frame), GFP_ATOMIC); if (!tx_skb) @@ -1214,7 +1213,7 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, frame->control = TEST_RSP | PF_BIT; /* Copy info */ - info = skb_put_data(tx_skb, cmd->data, cmd->len); + skb_put_data(tx_skb, cmd->data, cmd->len); /* Return to sender */ irlap_wait_min_turn_around(self, &self->qos_tx); diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 7be7917e1541..b588e593b0ec 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -796,8 +796,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) after_ric, ARRAY_SIZE(after_ric), offset); - pos = skb_put_data(skb, assoc_data->ie + offset, - noffset - offset); + skb_put_data(skb, assoc_data->ie + offset, noffset - offset); offset = noffset; } @@ -834,8 +833,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len, before_vht, ARRAY_SIZE(before_vht), offset); - pos = skb_put_data(skb, assoc_data->ie + offset, - noffset - offset); + skb_put_data(skb, assoc_data->ie + offset, noffset - offset); offset = noffset; } @@ -848,8 +846,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) noffset = ieee80211_ie_split_vendor(assoc_data->ie, assoc_data->ie_len, offset); - pos = skb_put_data(skb, assoc_data->ie + offset, - noffset - offset); + skb_put_data(skb, assoc_data->ie + offset, noffset - offset); offset = noffset; } @@ -868,8 +865,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) /* add any remaining custom (i.e. vendor specific here) IEs */ if (assoc_data->ie_len) { noffset = assoc_data->ie_len; - pos = skb_put_data(skb, assoc_data->ie + offset, - noffset - offset); + skb_put_data(skb, assoc_data->ie + offset, noffset - offset); } if (assoc_data->fils_kek_len && diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index 709ef02fe67e..91093d4a2f84 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -388,7 +388,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, before_ext_cap, ARRAY_SIZE(before_ext_cap), offset); - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -417,7 +417,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, before_ht_cap, ARRAY_SIZE(before_ht_cap), offset); - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -488,7 +488,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, before_vht_cap, ARRAY_SIZE(before_vht_cap), offset); - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -529,7 +529,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, /* add any remaining IEs */ if (extra_ies_len) { noffset = extra_ies_len; - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); } } @@ -571,7 +571,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, before_qos, ARRAY_SIZE(before_qos), offset); - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -591,7 +591,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, before_ht_op, ARRAY_SIZE(before_ht_op), offset); - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -632,7 +632,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, /* add any remaining IEs */ if (extra_ies_len) { noffset = extra_ies_len; - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); } } @@ -645,7 +645,6 @@ ieee80211_tdls_add_chan_switch_req_ies(struct ieee80211_sub_if_data *sdata, { struct ieee80211_tdls_data *tf; size_t offset = 0, noffset; - u8 *pos; if (WARN_ON_ONCE(!chandef)) return; @@ -663,7 +662,7 @@ ieee80211_tdls_add_chan_switch_req_ies(struct ieee80211_sub_if_data *sdata, before_lnkie, ARRAY_SIZE(before_lnkie), offset); - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); offset = noffset; } @@ -672,7 +671,7 @@ ieee80211_tdls_add_chan_switch_req_ies(struct ieee80211_sub_if_data *sdata, /* add any remaining IEs */ if (extra_ies_len) { noffset = extra_ies_len; - pos = skb_put_data(skb, extra_ies + offset, noffset - offset); + skb_put_data(skb, extra_ies + offset, noffset - offset); } } diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 2c196b3e9cd3..4b1967997c16 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -1474,11 +1474,10 @@ void sctp_chunk_put(struct sctp_chunk *ch) void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) { void *target; - void *padding; int chunklen = ntohs(chunk->chunk_hdr->length); int padlen = SCTP_PAD4(chunklen) - chunklen; - padding = skb_put_zero(chunk->skb, padlen); + skb_put_zero(chunk->skb, padlen); target = skb_put_data(chunk->skb, data, len); /* Adjust the chunk length field. */ diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 7d6ee03f2762..edba7ab97563 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -90,7 +90,6 @@ out_pkt: static struct sk_buff *virtio_transport_build_skb(void *opaque) { struct virtio_vsock_pkt *pkt = opaque; - unsigned char *t_hdr, *payload; struct af_vsockmon_hdr *hdr; struct sk_buff *skb; @@ -132,10 +131,10 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque) break; } - t_hdr = skb_put_data(skb, &pkt->hdr, sizeof(pkt->hdr)); + skb_put_data(skb, &pkt->hdr, sizeof(pkt->hdr)); if (pkt->len) { - payload = skb_put_data(skb, pkt->buf, pkt->len); + skb_put_data(skb, pkt->buf, pkt->len); } return skb; diff --git a/net/x25/x25_subr.c b/net/x25/x25_subr.c index eb466ece1730..db0b1315d577 100644 --- a/net/x25/x25_subr.c +++ b/net/x25/x25_subr.c @@ -188,14 +188,14 @@ void x25_write_internal(struct sock *sk, int frametype) *dptr++ = X25_CALL_REQUEST; len = x25_addr_aton(addresses, &x25->dest_addr, &x25->source_addr); - dptr = skb_put_data(skb, addresses, len); + skb_put_data(skb, addresses, len); len = x25_create_facilities(facilities, &x25->facilities, &x25->dte_facilities, x25->neighbour->global_facil_mask); - dptr = skb_put_data(skb, facilities, len); - dptr = skb_put_data(skb, x25->calluserdata.cuddata, - x25->calluserdata.cudlength); + skb_put_data(skb, facilities, len); + skb_put_data(skb, x25->calluserdata.cuddata, + x25->calluserdata.cudlength); x25->calluserdata.cudlength = 0; break; @@ -207,15 +207,15 @@ void x25_write_internal(struct sock *sk, int frametype) &x25->facilities, &x25->dte_facilities, x25->vc_facil_mask); - dptr = skb_put_data(skb, facilities, len); + skb_put_data(skb, facilities, len); /* fast select with no restriction on response allows call user data. Userland must ensure it is ours and not theirs */ if(x25->facilities.reverse & 0x80) { - dptr = skb_put_data(skb, - x25->calluserdata.cuddata, - x25->calluserdata.cudlength); + skb_put_data(skb, + x25->calluserdata.cuddata, + x25->calluserdata.cudlength); } x25->calluserdata.cudlength = 0; break; -- cgit v1.2.3-55-g7522 From 96f0d93a487e13233c95397aa3ecaf9cc8ff04bf Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Thu, 22 Jun 2017 11:42:50 +0100 Subject: irqchip/MSI: Use irq_domain_update_bus_token instead of an open coded access Now that we have irq_domain_update_bus_token(), switch everyone over to it. The debugfs code thanks you for your continued support. Signed-off-by: Marc Zyngier Signed-off-by: Thomas Gleixner --- drivers/base/platform-msi.c | 2 +- drivers/irqchip/irq-armada-370-xp.c | 2 +- drivers/irqchip/irq-gic-v2m.c | 2 +- drivers/irqchip/irq-gic-v3-its.c | 2 +- drivers/irqchip/irq-mips-cpu.c | 2 +- drivers/irqchip/irq-mips-gic.c | 2 +- drivers/pci/msi.c | 2 +- drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c index d35e9a20caf7..e5473525e7b2 100644 --- a/drivers/base/platform-msi.c +++ b/drivers/base/platform-msi.c @@ -195,7 +195,7 @@ struct irq_domain *platform_msi_create_irq_domain(struct fwnode_handle *fwnode, domain = msi_create_irq_domain(fwnode, info, parent); if (domain) - domain->bus_token = DOMAIN_BUS_PLATFORM_MSI; + irq_domain_update_bus_token(domain, DOMAIN_BUS_PLATFORM_MSI); return domain; } diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index eb0d4d41b156..5e16d042f281 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -563,7 +563,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, irq_domain_add_linear(node, nr_irqs, &armada_370_xp_mpic_irq_ops, NULL); BUG_ON(!armada_370_xp_mpic_domain); - armada_370_xp_mpic_domain->bus_token = DOMAIN_BUS_WIRED; + irq_domain_update_bus_token(armada_370_xp_mpic_domain, DOMAIN_BUS_WIRED); /* Setup for the boot CPU */ armada_xp_mpic_perf_init(); diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index 863e073c6f7f..993a8426a453 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -280,7 +280,7 @@ static int gicv2m_allocate_domains(struct irq_domain *parent) return -ENOMEM; } - inner_domain->bus_token = DOMAIN_BUS_NEXUS; + irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_NEXUS); inner_domain->parent = parent; pci_domain = pci_msi_create_irq_domain(v2m->fwnode, &gicv2m_msi_domain_info, diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 45ea193325d2..059016541277 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1661,7 +1661,7 @@ static int its_init_domain(struct fwnode_handle *handle, struct its_node *its) } inner_domain->parent = its_parent; - inner_domain->bus_token = DOMAIN_BUS_NEXUS; + irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_NEXUS); inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_REMAP; info->ops = &its_msi_domain_ops; info->data = its; diff --git a/drivers/irqchip/irq-mips-cpu.c b/drivers/irqchip/irq-mips-cpu.c index b247f3c743ac..0a8ed1c05518 100644 --- a/drivers/irqchip/irq-mips-cpu.c +++ b/drivers/irqchip/irq-mips-cpu.c @@ -240,7 +240,7 @@ static void mips_cpu_register_ipi_domain(struct device_node *of_node) ipi_domain_state); if (!ipi_domain) panic("Failed to add MIPS CPU IPI domain"); - ipi_domain->bus_token = DOMAIN_BUS_IPI; + irq_domain_update_bus_token(ipi_domain, DOMAIN_BUS_IPI); } #else /* !CONFIG_GENERIC_IRQ_IPI */ diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index eb7fbe159963..d3a6dc800e3c 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -960,7 +960,7 @@ static void __init __gic_init(unsigned long gic_base_addr, panic("Failed to add GIC IPI domain"); gic_ipi_domain->name = "mips-gic-ipi"; - gic_ipi_domain->bus_token = DOMAIN_BUS_IPI; + irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI); if (node && !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) { diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index ba44fdfda66b..fbad5dca3219 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1463,7 +1463,7 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode, if (!domain) return NULL; - domain->bus_token = DOMAIN_BUS_PCI_MSI; + irq_domain_update_bus_token(domain, DOMAIN_BUS_PCI_MSI); return domain; } EXPORT_SYMBOL_GPL(pci_msi_create_irq_domain); diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index b8b2c86e63d4..17d5cf9f91d4 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -170,7 +170,7 @@ struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, domain = msi_create_irq_domain(fwnode, info, parent); if (domain) - domain->bus_token = DOMAIN_BUS_FSL_MC_MSI; + irq_domain_update_bus_token(domain, DOMAIN_BUS_FSL_MC_MSI); return domain; } -- cgit v1.2.3-55-g7522 From 1ada25dc24466c3877a4119ed9d5092e1a143d63 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 14 Jun 2017 11:01:16 -0400 Subject: staging: lustre: lustre: resolve "use spaces between elements" checkpatch errors Due to the way the DFID was embedded in our debug strings checkpatch would report the following error: CHECK: Concatenated strings should use spaces between elements This patch introduces proper space to resolve these reports. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fid/fid_request.c | 2 +- drivers/staging/lustre/lustre/fld/fld_cache.c | 6 ++-- .../lustre/lustre/include/lustre/lustre_idl.h | 6 ++-- .../lustre/lustre/include/lustre/lustre_user.h | 2 +- drivers/staging/lustre/lustre/include/lustre_fid.h | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 6 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 4 +-- drivers/staging/lustre/lustre/llite/dcache.c | 4 +-- drivers/staging/lustre/lustre/llite/dir.c | 12 +++---- drivers/staging/lustre/lustre/llite/file.c | 42 +++++++++++----------- .../staging/lustre/lustre/llite/llite_internal.h | 4 +-- drivers/staging/lustre/lustre/llite/llite_lib.c | 34 +++++++++--------- drivers/staging/lustre/lustre/llite/llite_mmap.c | 2 +- drivers/staging/lustre/lustre/llite/llite_nfs.c | 10 +++--- drivers/staging/lustre/lustre/llite/namei.c | 38 ++++++++++---------- drivers/staging/lustre/lustre/llite/rw26.c | 2 +- drivers/staging/lustre/lustre/llite/statahead.c | 14 ++++---- drivers/staging/lustre/lustre/llite/symlink.c | 4 +-- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 2 +- drivers/staging/lustre/lustre/llite/xattr.c | 6 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 4 +-- drivers/staging/lustre/lustre/lmv/lmv_fld.c | 2 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 6 ++-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 40 ++++++++++----------- drivers/staging/lustre/lustre/lov/lov_io.c | 2 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 4 +-- drivers/staging/lustre/lustre/lov/lov_object.c | 7 ++-- drivers/staging/lustre/lustre/lov/lov_pack.c | 6 ++-- drivers/staging/lustre/lustre/lov/lov_pool.c | 8 ++--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 6 ++-- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 16 ++++----- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 +- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 12 +++---- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- .../staging/lustre/lustre/obdecho/echo_client.c | 4 +-- drivers/staging/lustre/lustre/osc/osc_cache.c | 8 ++--- drivers/staging/lustre/lustre/osc/osc_request.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 4 +-- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 2 +- 45 files changed, 175 insertions(+), 177 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index cd84b426e3a6..c05e92846a5b 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -279,7 +279,7 @@ int seq_client_alloc_fid(const struct lu_env *env, *fid = seq->lcs_fid; mutex_unlock(&seq->lcs_mutex); - CDEBUG(D_INFO, "%s: Allocated FID "DFID"\n", seq->lcs_name, PFID(fid)); + CDEBUG(D_INFO, "%s: Allocated FID " DFID "\n", seq->lcs_name, PFID(fid)); return rc; } EXPORT_SYMBOL(seq_client_alloc_fid); diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index 11f697496180..b852fed0b10f 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -151,7 +151,7 @@ restart_fixup: continue; LASSERTF(c_range->lsr_start <= n_range->lsr_start, - "cur lsr_start "DRANGE" next lsr_start "DRANGE"\n", + "cur lsr_start " DRANGE " next lsr_start " DRANGE "\n", PRANGE(c_range), PRANGE(n_range)); /* check merge possibility with next range */ @@ -349,7 +349,7 @@ static void fld_cache_overlap_handle(struct fld_cache *cache, f_curr->fce_range.lsr_end = new_start; fld_cache_entry_add(cache, f_new, &f_curr->fce_list); } else - CERROR("NEW range ="DRANGE" curr = "DRANGE"\n", + CERROR("NEW range =" DRANGE " curr = " DRANGE "\n", PRANGE(range), PRANGE(&f_curr->fce_range)); } @@ -415,7 +415,7 @@ static int fld_cache_insert_nolock(struct fld_cache *cache, if (!prev) prev = head; - CDEBUG(D_INFO, "insert range "DRANGE"\n", PRANGE(&f_new->fce_range)); + CDEBUG(D_INFO, "insert range " DRANGE "\n", PRANGE(&f_new->fce_range)); /* Add new entry to cache and lru list. */ fld_cache_entry_add(cache, f_new, prev); out: diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index df48b8d6fe52..77995fa47691 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -546,7 +546,7 @@ static inline void ostid_set_id(struct ost_id *oi, __u64 oid) static inline int fid_set_id(struct lu_fid *fid, __u64 oid) { if (unlikely(fid_seq_is_igif(fid->f_seq))) { - CERROR("bad IGIF, "DFID"\n", PFID(fid)); + CERROR("bad IGIF, " DFID "\n", PFID(fid)); return -EBADF; } @@ -585,7 +585,7 @@ static inline int ostid_to_fid(struct lu_fid *fid, struct ost_id *ostid, __u64 seq = ostid_seq(ostid); if (ost_idx > 0xffff) { - CERROR("bad ost_idx, "DOSTID" ost_idx:%u\n", POSTID(ostid), + CERROR("bad ost_idx, " DOSTID " ost_idx:%u\n", POSTID(ostid), ost_idx); return -EBADF; } @@ -630,7 +630,7 @@ static inline int ostid_to_fid(struct lu_fid *fid, struct ost_id *ostid, static inline int fid_to_ostid(const struct lu_fid *fid, struct ost_id *ostid) { if (unlikely(fid_seq_is_igif(fid->f_seq))) { - CERROR("bad IGIF, "DFID"\n", PFID(fid)); + CERROR("bad IGIF, " DFID "\n", PFID(fid)); return -EBADF; } diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index 7d8628ce0d3b..edff8dc34430 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -532,7 +532,7 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen) #define FID_NOBRACE_LEN 40 #define FID_LEN (FID_NOBRACE_LEN + 2) #define DFID_NOBRACE "%#llx:0x%x:0x%x" -#define DFID "["DFID_NOBRACE"]" +#define DFID "[" DFID_NOBRACE "]" #define PFID(fid) (unsigned long long)(fid)->f_seq, (fid)->f_oid, (fid)->f_ver /* scanf input parse format for fids in DFID_NOBRACE format diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index b5a1aadbcb93..6dc24a76ddb6 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -606,7 +606,7 @@ static inline __u32 fid_flatten32(const struct lu_fid *fid) static inline int lu_fid_diff(const struct lu_fid *fid1, const struct lu_fid *fid2) { - LASSERTF(fid_seq(fid1) == fid_seq(fid2), "fid1:"DFID", fid2:"DFID"\n", + LASSERTF(fid_seq(fid1) == fid_seq(fid2), "fid1:" DFID ", fid2:" DFID "\n", PFID(fid1), PFID(fid2)); if (fid_is_idif(fid1) && fid_is_idif(fid2)) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 84eeaa552113..4028e11249a2 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -445,8 +445,8 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, if (!ldlm_res_eq(&reply->lock_desc.l_resource.lr_name, &lock->l_resource->lr_name)) { - CDEBUG(D_INFO, "remote intent success, locking "DLDLMRES - " instead of "DLDLMRES"\n", + CDEBUG(D_INFO, "remote intent success, locking " DLDLMRES + " instead of " DLDLMRES "\n", PLDLMRES(&reply->lock_desc.l_resource), PLDLMRES(lock->l_resource)); @@ -1677,7 +1677,7 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns, 0, flags | LCF_BL_AST, opaque); rc = ldlm_cli_cancel_list(&cancels, count, NULL, flags); if (rc != ELDLM_OK) - CERROR("canceling unused lock "DLDLMRES": rc = %d\n", + CERROR("canceling unused lock " DLDLMRES ": rc = %d\n", PLDLMRES(res), rc); LDLM_RESOURCE_DELREF(res); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 1c8b0ea10c32..c9ef247d9be4 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -849,7 +849,7 @@ static int ldlm_resource_complain(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct ldlm_resource *res = cfs_hash_object(hs, hnode); lock_res(res); - CERROR("%s: namespace resource "DLDLMRES + CERROR("%s: namespace resource " DLDLMRES " (%p) refcount nonzero (%d) after lock cleanup; forcing cleanup.\n", ldlm_ns_name(ldlm_res_to_ns(res)), PLDLMRES(res), res, atomic_read(&res->lr_refcount) - 1); @@ -1391,7 +1391,7 @@ void ldlm_resource_dump(int level, struct ldlm_resource *res) if (!((libcfs_debug | D_ERROR) & level)) return; - CDEBUG(level, "--- Resource: "DLDLMRES" (%p) refcount = %d\n", + CDEBUG(level, "--- Resource: " DLDLMRES " (%p) refcount = %d\n", PLDLMRES(res), res, atomic_read(&res->lr_refcount)); if (!list_empty(&res->lr_granted)) { diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 38f84662cf02..d20425fb8cbe 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -180,7 +180,7 @@ void ll_invalidate_aliases(struct inode *inode) { struct dentry *dentry; - CDEBUG(D_INODE, "marking dentries for ino "DFID"(%p) invalid\n", + CDEBUG(D_INODE, "marking dentries for ino " DFID "(%p) invalid\n", PFID(ll_inode2fid(inode)), inode); spin_lock(&inode->i_lock); @@ -216,7 +216,7 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode) if (it->it_lock_mode && inode) { struct ll_sb_info *sbi = ll_i2sbi(inode); - CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"(%p)\n", + CDEBUG(D_DLMTRACE, "setting l_data to inode " DFID "(%p)\n", PFID(ll_inode2fid(inode)), inode); ll_set_lock_data(sbi->ll_md_exp, inode, it, NULL); } diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index de5b4bf0dbd5..03a72c07f57c 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -303,7 +303,7 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) struct md_op_data *op_data; int rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p) pos/size %lu/%llu 32bit_api %d\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p) pos/size %lu/%llu 32bit_api %d\n", PFID(ll_inode2fid(inode)), inode, (unsigned long)pos, i_size_read(inode), api32); @@ -419,7 +419,7 @@ static int ll_dir_setdirstripe(struct inode *parent, struct lmv_user_md *lump, if (unlikely(lump->lum_magic != LMV_USER_MAGIC)) return -EINVAL; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p) name %s stripe_offset %d, stripe_count: %u\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p) name %s stripe_offset %d, stripe_count: %u\n", PFID(ll_inode2fid(parent)), parent, dirname, (int)lump->lum_stripe_offset, lump->lum_stripe_count); @@ -606,7 +606,7 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size, rc = md_getattr(sbi->ll_md_exp, op_data, &req); ll_finish_md_op_data(op_data); if (rc < 0) { - CDEBUG(D_INFO, "md_getattr failed on inode "DFID": rc %d\n", + CDEBUG(D_INFO, "md_getattr failed on inode " DFID ": rc %d\n", PFID(ll_inode2fid(inode)), rc); goto out; } @@ -733,7 +733,7 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) iput(inode); if (rc != 0) { CDEBUG(D_HSM, "Could not read file data version of " - DFID" (rc = %d). Archive request (%#llx) could not be done.\n", + DFID " (rc = %d). Archive request (%#llx) could not be done.\n", PFID(©->hc_hai.hai_fid), rc, copy->hc_hai.hai_cookie); hpk.hpk_flags |= HP_FLAG_RETRY; @@ -833,7 +833,7 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) if ((copy->hc_hai.hai_action == HSMA_ARCHIVE) && (copy->hc_data_version != data_version)) { CDEBUG(D_HSM, "File data version mismatched. File content was changed during archiving. " - DFID", start:%#llx current:%#llx\n", + DFID ", start:%#llx current:%#llx\n", PFID(©->hc_hai.hai_fid), copy->hc_data_version, data_version); /* File was changed, send error to cdt. Do not ask for @@ -1037,7 +1037,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct obd_ioctl_data *data; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), cmd=%#x\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), cmd=%#x\n", PFID(ll_inode2fid(inode)), inode, cmd); /* asm-ppc{,64} declares TCGETS, et. al. as type 't' not 'T' */ diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 67c4b9cc6e75..711fbb004c9b 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -316,7 +316,7 @@ int ll_file_release(struct inode *inode, struct file *file) struct ll_inode_info *lli = ll_i2info(inode); int rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p)\n", PFID(ll_inode2fid(inode)), inode); if (!is_root_inode(inode)) @@ -494,7 +494,7 @@ int ll_file_open(struct inode *inode, struct file *file) struct ll_file_data *fd; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), flags %o\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), flags %o\n", PFID(ll_inode2fid(inode)), inode, file->f_flags); it = file->private_data; /* XXX: compat macro */ @@ -834,7 +834,7 @@ out_close: } rc2 = ll_close_inode_openhandle(inode, och, 0, NULL); if (rc2 < 0) - CERROR("%s: error closing file "DFID": %d\n", + CERROR("%s: error closing file " DFID ": %d\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(&ll_i2info(inode)->lli_fid), rc2); och = NULL; /* och has been freed in ll_close_inode_openhandle() */ @@ -1665,7 +1665,7 @@ int ll_hsm_release(struct inode *inode) int rc; u16 refcheck; - CDEBUG(D_INODE, "%s: Releasing file "DFID".\n", + CDEBUG(D_INODE, "%s: Releasing file " DFID ".\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(&ll_i2info(inode)->lli_fid)); @@ -1928,7 +1928,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int flags, rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p),cmd=%x\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p),cmd=%x\n", PFID(ll_inode2fid(inode)), inode, cmd); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_IOCTL, 1); @@ -2263,7 +2263,7 @@ static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) retval = offset + ((origin == SEEK_END) ? i_size_read(inode) : (origin == SEEK_CUR) ? file->f_pos : 0); - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), to=%llu=%#llx(%d)\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), to=%llu=%#llx(%d)\n", PFID(ll_inode2fid(inode)), inode, retval, retval, origin); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LLSEEK, 1); @@ -2360,7 +2360,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) struct ptlrpc_request *req; int rc, err; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p)\n", PFID(ll_inode2fid(inode)), inode); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FSYNC, 1); @@ -2422,7 +2422,7 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) int rc; int rc2 = 0; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID" file_lock=%p\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID " file_lock=%p\n", PFID(ll_inode2fid(inode)), file_lock); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FLOCK, 1); @@ -2507,7 +2507,7 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) if (IS_ERR(op_data)) return PTR_ERR(op_data); - CDEBUG(D_DLMTRACE, "inode="DFID", pid=%u, flags=%#llx, mode=%u, start=%llu, end=%llu\n", + CDEBUG(D_DLMTRACE, "inode=" DFID ", pid=%u, flags=%#llx, mode=%u, start=%llu, end=%llu\n", PFID(ll_inode2fid(inode)), flock.l_flock.pid, flags, einfo.ei_mode, flock.l_flock.start, flock.l_flock.end); @@ -2582,7 +2582,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, struct qstr qstr; int rc; - CDEBUG(D_VFSTRACE, "migrate %s under "DFID" to MDT%d\n", + CDEBUG(D_VFSTRACE, "migrate %s under " DFID " to MDT%d\n", name, PFID(ll_inode2fid(parent)), mdtidx); op_data = ll_prep_md_op_data(NULL, parent, NULL, name, namelen, @@ -2617,7 +2617,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, inode_lock(child_inode); op_data->op_fid3 = *ll_inode2fid(child_inode); if (!fid_is_sane(&op_data->op_fid3)) { - CERROR("%s: migrate %s, but fid "DFID" is insane\n", + CERROR("%s: migrate %s, but fid " DFID " is insane\n", ll_get_fsname(parent->i_sb, NULL, 0), name, PFID(&op_data->op_fid3)); rc = -EINVAL; @@ -2629,7 +2629,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, goto out_unlock; if (rc == mdtidx) { - CDEBUG(D_INFO, "%s:"DFID" is already on MDT%d.\n", name, + CDEBUG(D_INFO, "%s: " DFID " is already on MDT%d.\n", name, PFID(&op_data->op_fid3), mdtidx); rc = 0; goto out_unlock; @@ -2733,7 +2733,7 @@ int ll_have_md_lock(struct inode *inode, __u64 *bits, return 0; fid = &ll_i2info(inode)->lli_fid; - CDEBUG(D_INFO, "trying to match res "DFID" mode %s\n", PFID(fid), + CDEBUG(D_INFO, "trying to match res " DFID " mode %s\n", PFID(fid), ldlm_lockname[mode]); flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING | LDLM_FL_TEST_LOCK; @@ -2767,7 +2767,7 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits, struct lu_fid *fid; fid = &ll_i2info(inode)->lli_fid; - CDEBUG(D_INFO, "trying to match res "DFID"\n", PFID(fid)); + CDEBUG(D_INFO, "trying to match res " DFID "\n", PFID(fid)); return md_lock_match(ll_i2mdexp(inode), flags | LDLM_FL_BLOCK_GRANTED, fid, LDLM_IBITS, &policy, mode, lockh); @@ -2792,7 +2792,7 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc) return 0; } else if (rc != 0) { CDEBUG_LIMIT((rc == -EACCES || rc == -EIDRM) ? D_INFO : D_ERROR, - "%s: revalidate FID "DFID" error: rc = %d\n", + "%s: revalidate FID " DFID " error: rc = %d\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(ll_inode2fid(inode)), rc); } @@ -2807,7 +2807,7 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) struct obd_export *exp; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p),name=%pd\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p),name=%pd\n", PFID(ll_inode2fid(inode)), inode, dentry); exp = ll_i2mdexp(inode); @@ -3067,7 +3067,7 @@ int ll_inode_permission(struct inode *inode, int mask) return rc; } - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), inode mode %x mask %o\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), inode mode %x mask %o\n", PFID(ll_inode2fid(inode)), inode, inode->i_mode, mask); /* squash fsuid/fsgid if needed */ @@ -3322,7 +3322,7 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock) int lmmsize; int rc; - CDEBUG(D_INODE, DFID" LVB_READY=%d l_lvb_data=%p l_lvb_len=%d\n", + CDEBUG(D_INODE, DFID " LVB_READY=%d l_lvb_data=%p l_lvb_len=%d\n", PFID(ll_inode2fid(inode)), ldlm_is_lvb_ready(lock), lock->l_lvb_data, lock->l_lvb_len); @@ -3447,7 +3447,7 @@ out: /* wait for IO to complete if it's still being used. */ if (wait_layout) { - CDEBUG(D_INODE, "%s: "DFID"(%p) wait for layout reconf\n", + CDEBUG(D_INODE, "%s: " DFID "(%p) wait for layout reconf\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid), inode); @@ -3458,7 +3458,7 @@ out: if (rc == 0) rc = -EAGAIN; - CDEBUG(D_INODE, "%s: file="DFID" waiting layout return: %d.\n", + CDEBUG(D_INODE, "%s: file=" DFID " waiting layout return: %d.\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid), rc); } @@ -3504,7 +3504,7 @@ again: it.it_op = IT_LAYOUT; lockh.cookie = 0ULL; - LDLM_DEBUG_NOLOCK("%s: requeue layout lock for file "DFID"(%p)", + LDLM_DEBUG_NOLOCK("%s: requeue layout lock for file " DFID "(%p)", ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid), inode); diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index d2a0fabd8a69..de09ddfdfa6a 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -1253,7 +1253,7 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, */ if (it->it_remote_lock_mode) { handle.cookie = it->it_remote_lock_handle; - CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"%p for remote lock %#llx\n", + CDEBUG(D_DLMTRACE, "setting l_data to inode " DFID "%p for remote lock %#llx\n", PFID(ll_inode2fid(inode)), inode, handle.cookie); md_set_lock_data(exp, &handle, inode, NULL); @@ -1261,7 +1261,7 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, handle.cookie = it->it_lock_handle; - CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"%p for lock %#llx\n", + CDEBUG(D_DLMTRACE, "setting l_data to inode " DFID "%p for lock %#llx\n", PFID(ll_inode2fid(inode)), inode, handle.cookie); md_set_lock_data(exp, &handle, inode, &it->it_lock_bits); diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index ca5040c69217..974a05d6c969 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -427,13 +427,13 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, goto out_lock_cn_cb; } if (!fid_is_sane(&sbi->ll_root_fid)) { - CERROR("%s: Invalid root fid "DFID" during mount\n", + CERROR("%s: Invalid root fid " DFID " during mount\n", sbi->ll_md_exp->exp_obd->obd_name, PFID(&sbi->ll_root_fid)); err = -EINVAL; goto out_lock_cn_cb; } - CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid)); + CDEBUG(D_SUPER, "rootfid " DFID "\n", PFID(&sbi->ll_root_fid)); sb->s_op = &lustre_super_operations; sb->s_xattr = ll_xattr_handlers; @@ -1079,7 +1079,7 @@ static struct inode *ll_iget_anon_dir(struct super_block *sb, ino = cl_fid_build_ino(fid, sbi->ll_flags & LL_SBI_32BIT_API); inode = iget_locked(sb, ino); if (!inode) { - CERROR("%s: failed get simple inode "DFID": rc = -ENOENT\n", + CERROR("%s: failed get simple inode " DFID ": rc = -ENOENT\n", ll_get_fsname(sb, NULL, 0), PFID(fid)); return ERR_PTR(-ENOENT); } @@ -1090,7 +1090,7 @@ static struct inode *ll_iget_anon_dir(struct super_block *sb, inode->i_mode = (inode->i_mode & ~S_IFMT) | (body->mbo_mode & S_IFMT); - LASSERTF(S_ISDIR(inode->i_mode), "Not slave inode "DFID"\n", + LASSERTF(S_ISDIR(inode->i_mode), "Not slave inode " DFID "\n", PFID(fid)); LTIME_S(inode->i_mtime) = 0; @@ -1106,7 +1106,7 @@ static struct inode *ll_iget_anon_dir(struct super_block *sb, LASSERT(lsm); /* master object FID */ lli->lli_pfid = body->mbo_fid1; - CDEBUG(D_INODE, "lli %p slave "DFID" master "DFID"\n", + CDEBUG(D_INODE, "lli %p slave " DFID " master " DFID "\n", lli, PFID(fid), PFID(&lli->lli_pfid)); unlock_new_inode(inode); } @@ -1174,7 +1174,7 @@ static int ll_update_lsm_md(struct inode *inode, struct lustre_md *md) int rc; LASSERT(S_ISDIR(inode->i_mode)); - CDEBUG(D_INODE, "update lsm %p of "DFID"\n", lli->lli_lsm_md, + CDEBUG(D_INODE, "update lsm %p of " DFID "\n", lli->lli_lsm_md, PFID(ll_inode2fid(inode))); /* no striped information from request. */ @@ -1187,7 +1187,7 @@ static int ll_update_lsm_md(struct inode *inode, struct lustre_md *md) * migration is done, the temporay MIGRATE layout has * been removed */ - CDEBUG(D_INODE, DFID" finish migration.\n", + CDEBUG(D_INODE, DFID " finish migration.\n", PFID(ll_inode2fid(inode))); lmv_free_memmd(lli->lli_lsm_md); lli->lli_lsm_md = NULL; @@ -1241,7 +1241,7 @@ static int ll_update_lsm_md(struct inode *inode, struct lustre_md *md) kfree(attr); - CDEBUG(D_INODE, "Set lsm %p magic %x to "DFID"\n", lsm, + CDEBUG(D_INODE, "Set lsm %p magic %x to " DFID "\n", lsm, lsm->lsm_md_magic, PFID(ll_inode2fid(inode))); return 0; } @@ -1251,7 +1251,7 @@ static int ll_update_lsm_md(struct inode *inode, struct lustre_md *md) struct lmv_stripe_md *old_lsm = lli->lli_lsm_md; int idx; - CERROR("%s: inode "DFID"(%p)'s lmv layout mismatch (%p)/(%p) magic:0x%x/0x%x stripe count: %d/%d master_mdt: %d/%d hash_type:0x%x/0x%x layout: 0x%x/0x%x pool:%s/%s\n", + CERROR("%s: inode " DFID "(%p)'s lmv layout mismatch (%p)/(%p) magic:0x%x/0x%x stripe count: %d/%d master_mdt: %d/%d hash_type:0x%x/0x%x layout: 0x%x/0x%x pool:%s/%s\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid), inode, lsm, old_lsm, lsm->lsm_md_magic, old_lsm->lsm_md_magic, @@ -1266,13 +1266,13 @@ static int ll_update_lsm_md(struct inode *inode, struct lustre_md *md) old_lsm->lsm_md_pool_name); for (idx = 0; idx < old_lsm->lsm_md_stripe_count; idx++) { - CERROR("%s: sub FIDs in old lsm idx %d, old: "DFID"\n", + CERROR("%s: sub FIDs in old lsm idx %d, old: " DFID "\n", ll_get_fsname(inode->i_sb, NULL, 0), idx, PFID(&old_lsm->lsm_md_oinfo[idx].lmo_fid)); } for (idx = 0; idx < lsm->lsm_md_stripe_count; idx++) { - CERROR("%s: sub FIDs in new lsm idx %d, new: "DFID"\n", + CERROR("%s: sub FIDs in new lsm idx %d, new: " DFID "\n", ll_get_fsname(inode->i_sb, NULL, 0), idx, PFID(&lsm->lsm_md_oinfo[idx].lmo_fid)); } @@ -1288,7 +1288,7 @@ void ll_clear_inode(struct inode *inode) struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p)\n", PFID(ll_inode2fid(inode)), inode); if (S_ISDIR(inode->i_mode)) { @@ -1421,7 +1421,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) struct md_op_data *op_data = NULL; int rc = 0; - CDEBUG(D_VFSTRACE, "%s: setattr inode "DFID"(%p) from %llu to %llu, valid %x, hsm_import %d\n", + CDEBUG(D_VFSTRACE, "%s: setattr inode " DFID "(%p) from %llu to %llu, valid %x, hsm_import %d\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid), inode, i_size_read(inode), attr->ia_size, attr->ia_valid, hsm_import); @@ -1436,7 +1436,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) * needs another check in addition to the VFS check above. */ if (attr->ia_size > ll_file_maxbytes(inode)) { - CDEBUG(D_INODE, "file "DFID" too large %llu > %llu\n", + CDEBUG(D_INODE, "file " DFID " too large %llu > %llu\n", PFID(&lli->lli_fid), attr->ia_size, ll_file_maxbytes(inode)); return -EFBIG; @@ -1785,7 +1785,7 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md) /* FID shouldn't be changed! */ if (fid_is_sane(&lli->lli_fid)) { LASSERTF(lu_fid_eq(&lli->lli_fid, &body->mbo_fid1), - "Trying to change FID "DFID" to the "DFID", inode "DFID"(%p)\n", + "Trying to change FID " DFID " to the " DFID ", inode " DFID "(%p)\n", PFID(&lli->lli_fid), PFID(&body->mbo_fid1), PFID(ll_inode2fid(inode)), inode); } else { @@ -1820,7 +1820,7 @@ int ll_read_inode2(struct inode *inode, void *opaque) struct ll_inode_info *lli = ll_i2info(inode); int rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p)\n", PFID(&lli->lli_fid), inode); /* Core attributes from the MDS first. This is a new inode, and @@ -1902,7 +1902,7 @@ int ll_iocontrol(struct inode *inode, struct file *file, rc = md_getattr(sbi->ll_md_exp, op_data, &req); ll_finish_md_op_data(op_data); if (rc) { - CERROR("%s: failure inode "DFID": rc = %d\n", + CERROR("%s: failure inode " DFID ": rc = %d\n", sbi->ll_md_exp->exp_obd->obd_name, PFID(ll_inode2fid(inode)), rc); return -abs(rc); diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index cbbfdaf127a7..ccc7ae15a943 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -378,7 +378,7 @@ static int ll_page_mkwrite(struct vm_fault *vmf) if (!printed && ++count > 16) { const struct dentry *de = vma->vm_file->f_path.dentry; - CWARN("app(%s): the page %lu of file "DFID" is under heavy contention\n", + CWARN("app(%s): the page %lu of file " DFID " is under heavy contention\n", current->comm, vmf->pgoff, PFID(ll_inode2fid(de->d_inode))); printed = true; diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index 49a930f0fc5d..e50c637fab54 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c @@ -84,7 +84,7 @@ struct inode *search_inode_for_lustre(struct super_block *sb, struct md_op_data *op_data; int rc; - CDEBUG(D_INFO, "searching inode for:(%lu,"DFID")\n", hash, PFID(fid)); + CDEBUG(D_INFO, "searching inode for:(%lu," DFID ")\n", hash, PFID(fid)); inode = ilookup5(sb, hash, ll_test_inode_by_fid, (void *)fid); if (inode) @@ -109,7 +109,7 @@ struct inode *search_inode_for_lustre(struct super_block *sb, rc = md_getattr(sbi->ll_md_exp, op_data, &req); kfree(op_data); if (rc) { - CDEBUG(D_INFO, "can't get object attrs, fid "DFID", rc %d\n", + CDEBUG(D_INFO, "can't get object attrs, fid " DFID ", rc %d\n", PFID(fid), rc); return ERR_PTR(rc); } @@ -195,7 +195,7 @@ static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen, int fileid_len = sizeof(struct lustre_nfs_fid) / 4; struct lustre_nfs_fid *nfs_fid = (void *)fh; - CDEBUG(D_INFO, "%s: encoding for ("DFID") maxlen=%d minlen=%d\n", + CDEBUG(D_INFO, "%s: encoding for (" DFID ") maxlen=%d minlen=%d\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(ll_inode2fid(inode)), *plen, fileid_len); @@ -312,7 +312,7 @@ int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid) sbi = ll_s2sbi(dir->i_sb); - CDEBUG(D_INFO, "%s: getting parent for ("DFID")\n", + CDEBUG(D_INFO, "%s: getting parent for (" DFID ")\n", ll_get_fsname(dir->i_sb, NULL, 0), PFID(ll_inode2fid(dir))); @@ -329,7 +329,7 @@ int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid) rc = md_getattr_name(sbi->ll_md_exp, op_data, &req); ll_finish_md_op_data(op_data); if (rc) { - CERROR("%s: failure inode "DFID" get parent: rc = %d\n", + CERROR("%s: failure inode " DFID " get parent: rc = %d\n", ll_get_fsname(dir->i_sb, NULL, 0), PFID(ll_inode2fid(dir)), rc); return rc; diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index d583696e8378..9f118a1a57fc 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -86,7 +86,7 @@ static int ll_set_inode(struct inode *inode, void *opaque) inode->i_mode = (inode->i_mode & ~S_IFMT) | (body->mbo_mode & S_IFMT); if (unlikely(inode->i_mode == 0)) { - CERROR("Invalid inode "DFID" type\n", PFID(&lli->lli_fid)); + CERROR("Invalid inode " DFID " type\n", PFID(&lli->lli_fid)); return -EINVAL; } @@ -134,7 +134,7 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, } } else if (!(inode->i_state & (I_FREEING | I_CLEAR))) { rc = ll_update_inode(inode, md); - CDEBUG(D_VFSTRACE, "got inode: "DFID"(%p): rc = %d\n", + CDEBUG(D_VFSTRACE, "got inode: " DFID "(%p): rc = %d\n", PFID(&md->body->mbo_fid1), inode, rc); if (rc) { if (S_ISDIR(inode->i_mode)) @@ -205,7 +205,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, if (!fid_res_name_eq(ll_inode2fid(inode), &lock->l_resource->lr_name)) { - LDLM_ERROR(lock, "data mismatch with object "DFID"(%p)", + LDLM_ERROR(lock, "data mismatch with object " DFID "(%p)", PFID(ll_inode2fid(inode)), inode); LBUG(); } @@ -257,7 +257,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, rc = ll_layout_conf(inode, &conf); if (rc < 0) CDEBUG(D_INODE, "cannot invalidate layout of " - DFID": rc = %d\n", + DFID ": rc = %d\n", PFID(ll_inode2fid(inode)), rc); } @@ -274,7 +274,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, if ((bits & MDS_INODELOCK_UPDATE) && S_ISDIR(inode->i_mode)) { struct ll_inode_info *lli = ll_i2info(inode); - CDEBUG(D_INODE, "invalidating inode "DFID" lli = %p, pfid = "DFID"\n", + CDEBUG(D_INODE, "invalidating inode " DFID " lli = %p, pfid = " DFID "\n", PFID(ll_inode2fid(inode)), lli, PFID(&lli->lli_pfid)); @@ -290,7 +290,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, * we have to invalidate the negative children * on master inode */ - CDEBUG(D_INODE, "Invalidate s"DFID" m"DFID"\n", + CDEBUG(D_INODE, "Invalidate s" DFID " m" DFID "\n", PFID(ll_inode2fid(inode)), PFID(&lli->lli_pfid)); @@ -542,7 +542,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen) return ERR_PTR(-ENAMETOOLONG); - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),intent=%s\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p),intent=%s\n", dentry, PFID(ll_inode2fid(parent)), parent, LL_IT2STR(it)); if (d_mountpoint(dentry)) @@ -650,7 +650,7 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, struct lookup_intent *itp, it = { .it_op = IT_GETATTR }; struct dentry *de; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),flags=%u\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p),flags=%u\n", dentry, PFID(ll_inode2fid(parent)), parent, flags); /* Optimize away (CREATE && !OPEN). Let .create handle the race. @@ -685,7 +685,7 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, struct dentry *de; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),file %p,open_flags %x,mode %x opened %d\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p),file %p,open_flags %x,mode %x opened %d\n", dentry, PFID(ll_inode2fid(dir)), dir, file, open_flags, mode, *opened); @@ -792,7 +792,7 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it) * lock on the inode. Since we finally have an inode pointer, * stuff it in the lock. */ - CDEBUG(D_DLMTRACE, "setting l_ast_data to inode "DFID"(%p)\n", + CDEBUG(D_DLMTRACE, "setting l_ast_data to inode " DFID "(%p)\n", PFID(ll_inode2fid(dir)), inode); ll_set_lock_data(sbi->ll_md_exp, inode, it, NULL); out: @@ -820,7 +820,7 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, struct inode *inode; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p), intent=%s\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p), intent=%s\n", dentry, PFID(ll_inode2fid(dir)), dir, LL_IT2STR(it)); rc = it_open_error(DISP_OPEN_CREATE, it); @@ -844,7 +844,7 @@ void ll_update_times(struct ptlrpc_request *request, struct inode *inode) LASSERT(body); if (body->mbo_valid & OBD_MD_FLMTIME && body->mbo_mtime > LTIME_S(inode->i_mtime)) { - CDEBUG(D_INODE, "setting fid "DFID" mtime from %lu to %llu\n", + CDEBUG(D_INODE, "setting fid " DFID " mtime from %lu to %llu\n", PFID(ll_inode2fid(inode)), LTIME_S(inode->i_mtime), body->mbo_mtime); LTIME_S(inode->i_mtime) = body->mbo_mtime; @@ -942,7 +942,7 @@ static int ll_mknod(struct inode *dir, struct dentry *dchild, { int err; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p) mode %o dev %x\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p) mode %o dev %x\n", dchild, PFID(ll_inode2fid(dir)), dir, mode, old_encode_dev(rdev)); @@ -982,7 +982,7 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, { int rc; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p), flags=%u, excl=%d\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p), flags=%u, excl=%d\n", dentry, PFID(ll_inode2fid(dir)), dir, mode, want_excl); rc = ll_mknod(dir, dentry, mode, 0); @@ -1032,7 +1032,7 @@ static int ll_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) { int err; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir"DFID"(%p)\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir" DFID "(%p)\n", dentry, PFID(ll_inode2fid(dir)), dir); if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir))) @@ -1052,7 +1052,7 @@ static int ll_rmdir(struct inode *dir, struct dentry *dchild) struct md_op_data *op_data; int rc; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p)\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p)\n", dchild, PFID(ll_inode2fid(dir)), dir); op_data = ll_prep_md_op_data(NULL, dir, NULL, @@ -1082,7 +1082,7 @@ static int ll_symlink(struct inode *dir, struct dentry *dentry, { int err; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),target=%.*s\n", + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p),target=%.*s\n", dentry, PFID(ll_inode2fid(dir)), dir, 3000, oldname); err = ll_new_node(dir, dentry, oldname, S_IFLNK | 0777, @@ -1103,7 +1103,7 @@ static int ll_link(struct dentry *old_dentry, struct inode *dir, struct md_op_data *op_data; int err; - CDEBUG(D_VFSTRACE, "VFS Op: inode="DFID"(%p), dir="DFID"(%p), target=%pd\n", + CDEBUG(D_VFSTRACE, "VFS Op: inode=" DFID "(%p), dir=" DFID "(%p), target=%pd\n", PFID(ll_inode2fid(src)), src, PFID(ll_inode2fid(dir)), dir, new_dentry); @@ -1138,7 +1138,7 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, return -EINVAL; CDEBUG(D_VFSTRACE, - "VFS Op:oldname=%pd, src_dir="DFID"(%p), newname=%pd, tgt_dir="DFID"(%p)\n", + "VFS Op:oldname=%pd, src_dir=" DFID "(%p), newname=%pd, tgt_dir=" DFID "(%p)\n", src_dchild, PFID(ll_inode2fid(src)), src, tgt_dchild, PFID(ll_inode2fid(tgt)), tgt); diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 420f296f9658..22dc6a59e332 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -327,7 +327,7 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter) if ((file_offset & ~PAGE_MASK) || (count & ~PAGE_MASK)) return -EINVAL; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), size=%zd (max %lu), offset=%lld=%llx, pages %zd (max %lu)\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), size=%zd (max %lu), offset=%lld=%llx, pages %zd (max %lu)\n", PFID(ll_inode2fid(inode)), inode, count, MAX_DIO_SIZE, file_offset, file_offset, count >> PAGE_SHIFT, MAX_DIO_SIZE >> PAGE_SHIFT); diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index fb7c315b33cb..9bbca018a5fe 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -528,7 +528,7 @@ static void ll_agl_trigger(struct inode *inode, struct ll_statahead_info *sai) } CDEBUG(D_READA, "Handling (init) async glimpse: inode = " - DFID", idx = %llu\n", PFID(&lli->lli_fid), index); + DFID ", idx = %llu\n", PFID(&lli->lli_fid), index); cl_agl(inode); lli->lli_agl_index = 0; @@ -536,7 +536,7 @@ static void ll_agl_trigger(struct inode *inode, struct ll_statahead_info *sai) up_write(&lli->lli_glimpse_sem); CDEBUG(D_READA, "Handled (init) async glimpse: inode= " - DFID", idx = %llu, rc = %d\n", + DFID ", idx = %llu, rc = %d\n", PFID(&lli->lli_fid), index, rc); iput(inode); @@ -1008,7 +1008,7 @@ static int ll_statahead_thread(void *arg) sai->sai_in_readpage = 0; if (IS_ERR(page)) { rc = PTR_ERR(page); - CDEBUG(D_READA, "error reading dir "DFID" at %llu/%llu: opendir_pid = %u: rc = %d\n", + CDEBUG(D_READA, "error reading dir " DFID " at %llu/%llu: opendir_pid = %u: rc = %d\n", PFID(ll_inode2fid(dir)), pos, sai->sai_index, lli->lli_opendir_pid, rc); break; @@ -1105,7 +1105,7 @@ static int ll_statahead_thread(void *arg) if (sa_low_hit(sai)) { rc = -EFAULT; atomic_inc(&sbi->ll_sa_wrong); - CDEBUG(D_READA, "Statahead for dir "DFID" hit ratio too low: hit/miss %llu/%llu, sent/replied %llu/%llu, stopping statahead thread: pid %d\n", + CDEBUG(D_READA, "Statahead for dir " DFID " hit ratio too low: hit/miss %llu/%llu, sent/replied %llu/%llu, stopping statahead thread: pid %d\n", PFID(&lli->lli_fid), sai->sai_hit, sai->sai_miss, sai->sai_sent, sai->sai_replied, current_pid()); @@ -1211,7 +1211,7 @@ void ll_deauthorize_statahead(struct inode *dir, void *key) LASSERT(lli->lli_opendir_key == key); LASSERT(lli->lli_opendir_pid); - CDEBUG(D_READA, "deauthorize statahead for "DFID"\n", + CDEBUG(D_READA, "deauthorize statahead for " DFID "\n", PFID(&lli->lli_fid)); spin_lock(&lli->lli_sa_lock); @@ -1274,7 +1274,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) struct ll_inode_info *lli = ll_i2info(dir); rc = PTR_ERR(page); - CERROR("%s: error reading dir "DFID" at %llu: opendir_pid = %u : rc = %d\n", + CERROR("%s: error reading dir " DFID " at %llu: opendir_pid = %u : rc = %d\n", ll_get_fsname(dir->i_sb, NULL, 0), PFID(ll_inode2fid(dir)), pos, lli->lli_opendir_pid, rc); @@ -1471,7 +1471,7 @@ static int revalidate_statahead_dentry(struct inode *dir, } else if ((*dentryp)->d_inode != inode) { /* revalidate, but inode is recreated */ CDEBUG(D_READA, - "%s: stale dentry %pd inode "DFID", statahead inode "DFID"\n", + "%s: stale dentry %pd inode " DFID ", statahead inode " DFID "\n", ll_get_fsname((*dentryp)->d_inode->i_sb, NULL, 0), *dentryp, diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c index 60aac42e5344..3cd33483afaf 100644 --- a/drivers/staging/lustre/lustre/llite/symlink.c +++ b/drivers/staging/lustre/lustre/llite/symlink.c @@ -72,7 +72,7 @@ static int ll_readlink_internal(struct inode *inode, ll_finish_md_op_data(op_data); if (rc) { if (rc != -ENOENT) - CERROR("%s: inode "DFID": rc = %d\n", + CERROR("%s: inode " DFID ": rc = %d\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(ll_inode2fid(inode)), rc); goto failed; @@ -87,7 +87,7 @@ static int ll_readlink_internal(struct inode *inode, LASSERT(symlen != 0); if (body->mbo_eadatasize != symlen) { - CERROR("%s: inode "DFID": symlink length %d not expected %d\n", + CERROR("%s: inode " DFID ": symlink length %d not expected %d\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(ll_inode2fid(inode)), body->mbo_eadatasize - 1, symlen - 1); diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index aa31bc0a58a6..c5ba265ef6ad 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -325,7 +325,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) io->ci_need_restart = vio->vui_layout_gen != gen; if (io->ci_need_restart) { CDEBUG(D_VFSTRACE, - DFID" layout changed from %d to %d.\n", + DFID " layout changed from %d to %d.\n", PFID(lu_object_fid(&obj->co_lu)), vio->vui_layout_gen, gen); /* today successful restore is the only possible case */ diff --git a/drivers/staging/lustre/lustre/llite/vvp_object.c b/drivers/staging/lustre/lustre/llite/vvp_object.c index 8e18cf86cefc..9bfd72e514d1 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_object.c +++ b/drivers/staging/lustre/lustre/llite/vvp_object.c @@ -70,7 +70,7 @@ static int vvp_object_print(const struct lu_env *env, void *cookie, atomic_read(&obj->vob_mmap_cnt), inode); if (inode) { lli = ll_i2info(inode); - (*p)(env, cookie, "%lu/%u %o %u %d %p "DFID, + (*p)(env, cookie, "%lu/%u %o %u %d %p " DFID, inode->i_ino, inode->i_generation, inode->i_mode, inode->i_nlink, atomic_read(&inode->i_count), lli->lli_clob, PFID(&lli->lli_fid)); diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 6187bffec8c4..bd30abdecfb9 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -195,7 +195,7 @@ static int ll_xattr_set(const struct xattr_handler *handler, LASSERT(inode); LASSERT(name); - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), xattr %s\n", PFID(ll_inode2fid(inode)), inode, name); if (!strcmp(name, "lov")) { @@ -370,7 +370,7 @@ static int ll_xattr_get_common(const struct xattr_handler *handler, #endif int rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p)\n", PFID(ll_inode2fid(inode)), inode); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR, 1); @@ -523,7 +523,7 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size) LASSERT(inode); - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p)\n", PFID(ll_inode2fid(inode)), inode); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LISTXATTR, 1); diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index 38f75f6aa887..82cf4211cc0f 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -311,7 +311,7 @@ static int ll_xattr_find_get_lock(struct inode *inode, if (rc < 0) { CDEBUG(D_CACHE, - "md_intent_lock failed with %d for fid "DFID"\n", + "md_intent_lock failed with %d for fid " DFID "\n", rc, PFID(ll_inode2fid(inode))); mutex_unlock(&lli->lli_xattrs_enq_lock); return rc; @@ -365,7 +365,7 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit) } if (oit->it_status < 0) { - CDEBUG(D_CACHE, "getxattr intent returned %d for fid "DFID"\n", + CDEBUG(D_CACHE, "getxattr intent returned %d for fid " DFID "\n", oit->it_status, PFID(ll_inode2fid(inode))); rc = oit->it_status; /* xattr data is so large that we don't want to cache it */ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_fld.c b/drivers/staging/lustre/lustre/lmv/lmv_fld.c index a5265f9b5797..6f8070fb3226 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_fld.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_fld.c @@ -70,7 +70,7 @@ int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, u32 *mds) return rc; } - CDEBUG(D_INODE, "FLD lookup got mds #%x for fid="DFID"\n", + CDEBUG(D_INODE, "FLD lookup got mds #%x for fid=" DFID "\n", *mds, PFID(fid)); if (*mds >= lmv->desc.ld_tgt_count) { diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index aa42066678e0..f49db6c23217 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -213,7 +213,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, lockh = (struct lustre_handle *)&it.it_lock_handle; if (rc > 0 && !req) { /* slave inode is still valid */ - CDEBUG(D_INODE, "slave "DFID" is still valid.\n", + CDEBUG(D_INODE, "slave " DFID " is still valid.\n", PFID(&fid)); rc = 0; } else { @@ -435,7 +435,7 @@ static int lmv_intent_lookup(struct obd_export *exp, if (IS_ERR(tgt)) return PTR_ERR(tgt); - CDEBUG(D_INODE, "Try other stripes " DFID"\n", + CDEBUG(D_INODE, "Try other stripes " DFID "\n", PFID(&oinfo->lmo_fid)); op_data->op_fid1 = oinfo->lmo_fid; @@ -479,7 +479,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, LASSERT(fid_is_sane(&op_data->op_fid1)); - CDEBUG(D_INODE, "INTENT LOCK '%s' for "DFID" '%*s' on "DFID"\n", + CDEBUG(D_INODE, "INTENT LOCK '%s' for " DFID " '%*s' on " DFID "\n", LL_IT2STR(it), PFID(&op_data->op_fid2), (int)op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1)); diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index b222dfa11a10..63a10a936e4b 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -673,7 +673,7 @@ repeat_fid2path: *ptr = '/'; } - CDEBUG(D_INFO, "%s: get path %s "DFID" rec: %llu ln: %u\n", + CDEBUG(D_INFO, "%s: get path %s " DFID " rec: %llu ln: %u\n", tgt->ltd_exp->exp_obd->obd_name, gf->gf_path, PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno); @@ -693,7 +693,7 @@ repeat_fid2path: } if (!fid_is_sane(&gf->gf_fid)) { - CERROR("%s: invalid FID "DFID": rc = %d\n", + CERROR("%s: invalid FID " DFID ": rc = %d\n", tgt->ltd_exp->exp_obd->obd_name, PFID(&gf->gf_fid), -EINVAL); rc = -EINVAL; @@ -1508,7 +1508,7 @@ static int lmv_null_inode(struct obd_export *exp, const struct lu_fid *fid) if (rc) return rc; - CDEBUG(D_INODE, "CBDATA for "DFID"\n", PFID(fid)); + CDEBUG(D_INODE, "CBDATA for " DFID "\n", PFID(fid)); /* * With DNE every object can have two locks in different namespaces: @@ -1540,7 +1540,7 @@ static int lmv_close(struct obd_export *exp, struct md_op_data *op_data, if (IS_ERR(tgt)) return PTR_ERR(tgt); - CDEBUG(D_INODE, "CLOSE "DFID"\n", PFID(&op_data->op_fid1)); + CDEBUG(D_INODE, "CLOSE " DFID "\n", PFID(&op_data->op_fid1)); return md_close(tgt->ltd_exp, op_data, mod, request); } @@ -1672,7 +1672,7 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, if (IS_ERR(tgt)) return PTR_ERR(tgt); - CDEBUG(D_INODE, "CREATE name '%.*s' on "DFID" -> mds #%x\n", + CDEBUG(D_INODE, "CREATE name '%.*s' on " DFID " -> mds #%x\n", (int)op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1), op_data->op_mds); @@ -1694,7 +1694,7 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, CDEBUG(D_CONFIG, "Server doesn't support striped dirs\n"); } - CDEBUG(D_INODE, "CREATE obj "DFID" -> mds #%x\n", + CDEBUG(D_INODE, "CREATE obj " DFID " -> mds #%x\n", PFID(&op_data->op_fid1), op_data->op_mds); op_data->op_flags |= MF_MDC_CANCEL_FID1; @@ -1704,7 +1704,7 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, if (rc == 0) { if (!*request) return rc; - CDEBUG(D_INODE, "Created - "DFID"\n", PFID(&op_data->op_fid2)); + CDEBUG(D_INODE, "Created - " DFID "\n", PFID(&op_data->op_fid2)); } return rc; } @@ -1724,7 +1724,7 @@ lmv_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, if (rc) return rc; - CDEBUG(D_INODE, "ENQUEUE '%s' on "DFID"\n", + CDEBUG(D_INODE, "ENQUEUE '%s' on " DFID "\n", LL_IT2STR(it), PFID(&op_data->op_fid1)); tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1); @@ -1769,7 +1769,7 @@ lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data, if (body->mbo_valid & OBD_MD_MDS) { struct lu_fid rid = body->mbo_fid1; - CDEBUG(D_INODE, "Request attrs for "DFID"\n", + CDEBUG(D_INODE, "Request attrs for " DFID "\n", PFID(&rid)); tgt = lmv_find_target(lmv, &rid); @@ -1818,13 +1818,13 @@ static int lmv_early_cancel(struct obd_export *exp, struct lmv_tgt_desc *tgt, } if (tgt->ltd_idx != op_tgt) { - CDEBUG(D_INODE, "EARLY_CANCEL on "DFID"\n", PFID(fid)); + CDEBUG(D_INODE, "EARLY_CANCEL on " DFID "\n", PFID(fid)); policy.l_inodebits.bits = bits; rc = md_cancel_unused(tgt->ltd_exp, fid, &policy, mode, LCF_ASYNC, NULL); } else { CDEBUG(D_INODE, - "EARLY_CANCEL skip operation target %d on "DFID"\n", + "EARLY_CANCEL skip operation target %d on " DFID "\n", op_tgt, PFID(fid)); op_data->op_flags |= flag; rc = 0; @@ -1851,7 +1851,7 @@ static int lmv_link(struct obd_export *exp, struct md_op_data *op_data, LASSERT(op_data->op_namelen != 0); - CDEBUG(D_INODE, "LINK "DFID":%*s to "DFID"\n", + CDEBUG(D_INODE, "LINK " DFID ":%*s to " DFID "\n", PFID(&op_data->op_fid2), (int)op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1)); @@ -1901,7 +1901,7 @@ static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data, LASSERT(oldlen != 0); - CDEBUG(D_INODE, "RENAME %.*s in "DFID":%d to %.*s in "DFID":%d\n", + CDEBUG(D_INODE, "RENAME %.*s in " DFID ":%d to %.*s in " DFID ":%d\n", (int)oldlen, old, PFID(&op_data->op_fid1), op_data->op_mea1 ? op_data->op_mea1->lsm_md_stripe_count : 0, (int)newlen, new, PFID(&op_data->op_fid2), @@ -1916,7 +1916,7 @@ static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data, op_data->op_cap = cfs_curproc_cap_pack(); if (op_data->op_cli_flags & CLI_MIGRATE) { - LASSERTF(fid_is_sane(&op_data->op_fid3), "invalid FID "DFID"\n", + LASSERTF(fid_is_sane(&op_data->op_fid3), "invalid FID " DFID "\n", PFID(&op_data->op_fid3)); if (op_data->op_mea1) { @@ -2069,7 +2069,7 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data, if (rc) return rc; - CDEBUG(D_INODE, "SETATTR for "DFID", valid 0x%x\n", + CDEBUG(D_INODE, "SETATTR for " DFID ", valid 0x%x\n", PFID(&op_data->op_fid1), op_data->op_attr.ia_valid); op_data->op_flags |= MF_MDC_CANCEL_FID1; @@ -2577,7 +2577,7 @@ try_next_stripe: if (likely(!(body->mbo_valid & OBD_MD_MDS))) return rc; - CDEBUG(D_INODE, "%s: try unlink to another MDT for "DFID"\n", + CDEBUG(D_INODE, "%s: try unlink to another MDT for " DFID "\n", exp->exp_obd->obd_name, PFID(&body->mbo_fid1)); /* This is a remote object, try remote MDT, Note: it may @@ -2781,7 +2781,7 @@ static int lmv_unpack_md_v1(struct obd_export *exp, struct lmv_stripe_md *lsm, &lsm->lsm_md_oinfo[i].lmo_mds); if (rc) return rc; - CDEBUG(D_INFO, "unpack fid #%d "DFID"\n", i, + CDEBUG(D_INFO, "unpack fid #%d " DFID "\n", i, PFID(&lsm->lsm_md_oinfo[i].lmo_fid)); } @@ -2925,7 +2925,7 @@ static enum ldlm_mode lmv_lock_match(struct obd_export *exp, __u64 flags, int tgt; u32 i; - CDEBUG(D_INODE, "Lock match for "DFID"\n", PFID(fid)); + CDEBUG(D_INODE, "Lock match for " DFID "\n", PFID(fid)); /* * With DNE every object can have two locks in different namespaces: @@ -2937,7 +2937,7 @@ static enum ldlm_mode lmv_lock_match(struct obd_export *exp, __u64 flags, i < lmv->desc.ld_tgt_count; i++, tgt = (tgt + 1) % lmv->desc.ld_tgt_count) { if (tgt < 0) { - CDEBUG(D_HA, "%s: "DFID" is inaccessible: rc = %d\n", + CDEBUG(D_HA, "%s: " DFID " is inaccessible: rc = %d\n", obd->obd_name, PFID(fid), tgt); tgt = 0; } @@ -3148,7 +3148,7 @@ static int lmv_merge_attr(struct obd_export *exp, for (i = 0; i < lsm->lsm_md_stripe_count; i++) { struct inode *inode = lsm->lsm_md_oinfo[i].lmo_root; - CDEBUG(D_INFO, ""DFID" size %llu, blocks %llu nlink %u, atime %lu ctime %lu, mtime %lu.\n", + CDEBUG(D_INFO, "" DFID " size %llu, blocks %llu nlink %u, atime %lu ctime %lu, mtime %lu.\n", PFID(&lsm->lsm_md_oinfo[i].lmo_fid), i_size_read(inode), (unsigned long long)inode->i_blocks, inode->i_nlink, LTIME_S(inode->i_atime), diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index df77b2586612..babf39adef85 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -1021,7 +1021,7 @@ int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj, break; case CIT_FAULT: result = -EFAULT; - CERROR("Page fault on a file without stripes: "DFID"\n", + CERROR("Page fault on a file without stripes: " DFID "\n", PFID(lu_object_fid(&obj->co_lu))); break; } diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index 391dfd207177..034b4fcb38f5 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -57,7 +57,7 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, assert_spin_locked(&lsm->lsm_lock); LASSERT(lsm->lsm_lock_owner == current_pid()); - CDEBUG(D_INODE, "MDT ID "DOSTID" initial value: s=%llu m=%llu a=%llu c=%llu b=%llu\n", + CDEBUG(D_INODE, "MDT ID " DOSTID " initial value: s=%llu m=%llu a=%llu c=%llu b=%llu\n", POSTID(&lsm->lsm_oi), lvb->lvb_size, lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks); for (i = 0; i < lsm->lsm_stripe_count; i++) { @@ -89,7 +89,7 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, if (loi->loi_lvb.lvb_ctime > current_ctime) current_ctime = loi->loi_lvb.lvb_ctime; - CDEBUG(D_INODE, "MDT ID "DOSTID" on OST[%u]: s=%llu m=%llu a=%llu c=%llu b=%llu\n", + CDEBUG(D_INODE, "MDT ID " DOSTID " on OST[%u]: s=%llu m=%llu a=%llu c=%llu b=%llu\n", POSTID(&lsm->lsm_oi), loi->loi_ost_idx, loi->loi_lvb.lvb_size, loi->loi_lvb.lvb_mtime, loi->loi_lvb.lvb_atime, loi->loi_lvb.lvb_ctime, diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index ab3ecfeeadc8..d31895e1a5ce 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -153,8 +153,7 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, subhdr = cl_object_header(stripe); oinfo = lov->lo_lsm->lsm_oinfo[idx]; - CDEBUG(D_INODE, DFID"@%p[%d] -> "DFID"@%p: ostid: "DOSTID - " idx: %d gen: %d\n", + CDEBUG(D_INODE, DFID "@%p[%d] -> " DFID "@%p: ostid: " DOSTID " idx: %d gen: %d\n", PFID(&subhdr->coh_lu.loh_fid), subhdr, idx, PFID(&hdr->coh_lu.loh_fid), hdr, POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx, oinfo->loi_ost_gen); @@ -757,7 +756,7 @@ static int lov_layout_change(const struct lu_env *unused, LASSERT(0 <= llt && llt < ARRAY_SIZE(lov_dispatch)); - CDEBUG(D_INODE, DFID" from %s to %s\n", + CDEBUG(D_INODE, DFID " from %s to %s\n", PFID(lu_object_fid(lov2lu(lov))), llt2str(lov->lo_type), llt2str(llt)); @@ -904,7 +903,7 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj, out: lov_conf_unlock(lov); lov_lsm_put(lsm); - CDEBUG(D_INODE, DFID" lo_layout_invalid=%d\n", + CDEBUG(D_INODE, DFID " lo_layout_invalid=%d\n", PFID(lu_object_fid(lov2lu(lov))), lov->lo_layout_invalid); return result; } diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index e6727cefde05..638b7646ca2c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -56,7 +56,7 @@ void lov_dump_lmm_common(int level, void *lmmp) struct ost_id oi; lmm_oi_le_to_cpu(&oi, &lmm->lmm_oi); - CDEBUG(level, "objid "DOSTID", magic 0x%08x, pattern %#x\n", + CDEBUG(level, "objid " DOSTID ", magic 0x%08x, pattern %#x\n", POSTID(&oi), le32_to_cpu(lmm->lmm_magic), le32_to_cpu(lmm->lmm_pattern)); CDEBUG(level, "stripe_size %u, stripe_count %u, layout_gen %u\n", @@ -80,7 +80,7 @@ static void lov_dump_lmm_objects(int level, struct lov_ost_data *lod, struct ost_id oi; ostid_le_to_cpu(&lod->l_ost_oi, &oi); - CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n", i, + CDEBUG(level, "stripe %u idx %u subobj " DOSTID "\n", i, le32_to_cpu(lod->l_ost_idx), POSTID(&oi)); } } @@ -95,7 +95,7 @@ void lov_dump_lmm_v1(int level, struct lov_mds_md_v1 *lmm) void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *lmm) { lov_dump_lmm_common(level, lmm); - CDEBUG(level, "pool_name "LOV_POOLNAMEF"\n", lmm->lmm_pool_name); + CDEBUG(level, "pool_name " LOV_POOLNAMEF "\n", lmm->lmm_pool_name); lov_dump_lmm_objects(level, lmm->lmm_objects, le16_to_cpu(lmm->lmm_stripe_count)); } diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index 7daa8671fdc3..1952bbdeb29e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -429,7 +429,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname) poolname, new_pool, &pool_proc_operations); if (IS_ERR_OR_NULL(new_pool->pool_debugfs_entry)) { - CWARN("Cannot add debugfs pool entry "LOV_POOLNAMEF"\n", + CWARN("Cannot add debugfs pool entry " LOV_POOLNAMEF "\n", poolname); new_pool->pool_debugfs_entry = NULL; lov_pool_putref(new_pool); @@ -450,7 +450,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname) goto out_err; } - CDEBUG(D_CONFIG, LOV_POOLNAMEF" is pool #%d\n", + CDEBUG(D_CONFIG, LOV_POOLNAMEF " is pool #%d\n", poolname, lov->lov_pool_count); return 0; @@ -531,7 +531,7 @@ int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname) if (rc) goto out; - CDEBUG(D_CONFIG, "Added %s to "LOV_POOLNAMEF" as member %d\n", + CDEBUG(D_CONFIG, "Added %s to " LOV_POOLNAMEF " as member %d\n", ostname, poolname, pool_tgt_count(pool)); out: @@ -575,7 +575,7 @@ int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname) lov_ost_pool_remove(&pool->pool_obds, lov_idx); - CDEBUG(D_CONFIG, "%s removed from "LOV_POOLNAMEF"\n", ostname, + CDEBUG(D_CONFIG, "%s removed from " LOV_POOLNAMEF "\n", ostname, poolname); out: diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 9e06078c1e79..3eb66cea65db 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -830,7 +830,7 @@ resend: ptlrpc_req_finished(req); resends++; - CDEBUG(D_HA, "%s: resend:%d op:%d "DFID"/"DFID"\n", + CDEBUG(D_HA, "%s: resend:%d op:%d " DFID "/" DFID "\n", obddev->obd_name, resends, it->it_op, PFID(&op_data->op_fid1), PFID(&op_data->op_fid2)); @@ -933,7 +933,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp, LASSERTF(fid_res_name_eq(&mdt_body->mbo_fid1, &lock->l_resource->lr_name), - "Lock res_id: "DLDLMRES", fid: "DFID"\n", + "Lock res_id: " DLDLMRES ", fid: " DFID "\n", PLDLMRES(lock->l_resource), PFID(&mdt_body->mbo_fid1)); LDLM_LOCK_PUT(lock); @@ -1063,7 +1063,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, LASSERT(it); - CDEBUG(D_DLMTRACE, "(name: %.*s,"DFID") in obj "DFID + CDEBUG(D_DLMTRACE, "(name: %.*s," DFID ") in obj " DFID ", intent: %s flags %#Lo\n", (int)op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid2), PFID(&op_data->op_fid1), ldlm_it2str(it->it_op), diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c index 07b168490f09..2287bd46d527 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c @@ -227,7 +227,7 @@ rebuild: ptlrpc_req_finished(req); resends++; - CDEBUG(D_HA, "%s: resend:%d create on "DFID"/"DFID"\n", + CDEBUG(D_HA, "%s: resend:%d create on " DFID "/" DFID "\n", exp->exp_obd->obd_name, resends, PFID(&op_data->op_fid1), PFID(&op_data->op_fid2)); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 6bc2fb858680..1a3fa1bb7f25 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -105,7 +105,7 @@ static int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid) *rootfid = body->mbo_fid1; CDEBUG(D_NET, - "root fid="DFID", last_committed=%llu\n", + "root fid=" DFID ", last_committed=%llu\n", PFID(rootfid), lustre_msg_get_last_committed(req->rq_repmsg)); out: @@ -713,7 +713,7 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, /* allocate a FID for volatile file */ rc = mdc_fid_alloc(NULL, exp, &op_data->op_fid2, op_data); if (rc < 0) { - CERROR("%s: "DFID" failed to allocate FID: %d\n", + CERROR("%s: " DFID " failed to allocate FID: %d\n", obd->obd_name, PFID(&op_data->op_fid1), rc); /* save the errcode and proceed to close */ saved_rc = rc; @@ -753,7 +753,7 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, /* * TODO: repeat close after errors */ - CWARN("%s: close of FID "DFID" failed, file reference will be dropped when this client unmounts or is evicted\n", + CWARN("%s: close of FID " DFID " failed, file reference will be dropped when this client unmounts or is evicted\n", obd->obd_name, PFID(&op_data->op_fid1)); rc = -ENOMEM; goto out; @@ -1254,7 +1254,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, ptlrpc_req_finished(enq_req); if (rc < 0) { - CERROR("%s: "DFID" lock enqueue fails: rc = %d\n", + CERROR("%s: " DFID " lock enqueue fails: rc = %d\n", exp->exp_obd->obd_name, PFID(&op_data->op_fid1), rc); return rc; } @@ -1298,7 +1298,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, rp_param.rp_hash64), mdc_read_page_remote, &rp_param); if (IS_ERR(page)) { - CERROR("%s: read cache page: "DFID" at %llu: rc %ld\n", + CERROR("%s: read cache page: " DFID " at %llu: rc %ld\n", exp->exp_obd->obd_name, PFID(&op_data->op_fid1), rp_param.rp_off, PTR_ERR(page)); rc = PTR_ERR(page); @@ -1308,7 +1308,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, wait_on_page_locked(page); (void)kmap(page); if (!PageUptodate(page)) { - CERROR("%s: page not updated: "DFID" at %llu: rc %d\n", + CERROR("%s: page not updated: " DFID " at %llu: rc %d\n", exp->exp_obd->obd_name, PFID(&op_data->op_fid1), rp_param.rp_off, -5); goto fail; @@ -1316,7 +1316,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, if (!PageChecked(page)) SetPageChecked(page); if (PageError(page)) { - CERROR("%s: page error: "DFID" at %llu: rc %d\n", + CERROR("%s: page error: " DFID " at %llu: rc %d\n", exp->exp_obd->obd_name, PFID(&op_data->op_fid1), rp_param.rp_off, -5); goto fail; @@ -1436,7 +1436,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf) memcpy(key, KEY_FID2PATH, sizeof(KEY_FID2PATH)); memcpy(key + cfs_size_round(sizeof(KEY_FID2PATH)), gf, sizeof(*gf)); - CDEBUG(D_IOCTL, "path get "DFID" from %llu #%d\n", + CDEBUG(D_IOCTL, "path get " DFID " from %llu #%d\n", PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno); if (!fid_is_sane(&gf->gf_fid)) { diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 6a76605b3c3d..eee0b667a33c 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -800,7 +800,7 @@ static int mgc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, /* We've given up the lock, prepare ourselves to update. */ LDLM_DEBUG(lock, "MGC cancel CB"); - CDEBUG(D_MGC, "Lock res "DLDLMRES" (%.8s)\n", + CDEBUG(D_MGC, "Lock res " DLDLMRES " (%.8s)\n", PLDLMRES(lock->l_resource), (char *)&lock->l_resource->lr_name.name[0]); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c index 9d7b5939b0fd..a343e3ab2257 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c @@ -246,7 +246,7 @@ void cl_lock_descr_print(const struct lu_env *env, void *cookie, const struct lu_fid *fid; fid = lu_object_fid(&descr->cld_obj->co_lu); - (*printer)(env, cookie, DDESCR"@"DFID, PDESCR(descr), PFID(fid)); + (*printer)(env, cookie, DDESCR "@" DFID, PDESCR(descr), PFID(fid)); } EXPORT_SYMBOL(cl_lock_descr_print); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 71fcc4cc9e72..6b8c41b6f379 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -193,7 +193,7 @@ struct cl_page *cl_page_find(const struct lu_env *env, hdr = cl_object_header(o); - CDEBUG(D_PAGE, "%lu@"DFID" %p %lx %d\n", + CDEBUG(D_PAGE, "%lu@" DFID " %p %lx %d\n", idx, PFID(&hdr->coh_lu.loh_fid), vmpage, vmpage->private, type); /* fast path. */ if (type == CPT_CACHEABLE) { diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index ce8e2f6f002a..8f1533c127a8 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -78,7 +78,7 @@ static int llog_cat_id2handle(const struct lu_env *env, if (ostid_id(&cgl->lgl_oi) == ostid_id(&logid->lgl_oi) && ostid_seq(&cgl->lgl_oi) == ostid_seq(&logid->lgl_oi)) { if (cgl->lgl_ogen != logid->lgl_ogen) { - CERROR("%s: log "DOSTID" generation %x != %x\n", + CERROR("%s: log " DOSTID " generation %x != %x\n", loghandle->lgh_ctxt->loc_obd->obd_name, POSTID(&logid->lgl_oi), cgl->lgl_ogen, logid->lgl_ogen); @@ -95,7 +95,7 @@ static int llog_cat_id2handle(const struct lu_env *env, rc = llog_open(env, cathandle->lgh_ctxt, &loghandle, logid, NULL, LLOG_OPEN_EXISTS); if (rc < 0) { - CERROR("%s: error opening log id "DOSTID":%x: rc = %d\n", + CERROR("%s: error opening log id " DOSTID ":%x: rc = %d\n", cathandle->lgh_ctxt->loc_obd->obd_name, POSTID(&logid->lgl_oi), logid->lgl_ogen, rc); return rc; @@ -152,13 +152,13 @@ static int llog_cat_process_cb(const struct lu_env *env, CERROR("invalid record in catalog\n"); return -EINVAL; } - CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog " - DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen, + CDEBUG(D_HA, "processing log " DOSTID ":%x at index %u of catalog " + DOSTID "\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen, rec->lrh_index, POSTID(&cat_llh->lgh_id.lgl_oi)); rc = llog_cat_id2handle(env, cat_llh, &llh, &lir->lid_id); if (rc) { - CERROR("%s: cannot find handle for llog "DOSTID": %d\n", + CERROR("%s: cannot find handle for llog " DOSTID ": %d\n", cat_llh->lgh_ctxt->loc_obd->obd_name, POSTID(&lir->lid_id.lgl_oi), rc); return rc; @@ -204,7 +204,7 @@ static int llog_cat_process_or_fork(const struct lu_env *env, if (llh->llh_cat_idx > cat_llh->lgh_last_idx) { struct llog_process_cat_data cd; - CWARN("catlog "DOSTID" crosses index zero\n", + CWARN("catlog " DOSTID " crosses index zero\n", POSTID(&cat_llh->lgh_id.lgl_oi)); cd.lpcd_first_idx = llh->llh_cat_idx; diff --git a/drivers/staging/lustre/lustre/obdclass/llog_swab.c b/drivers/staging/lustre/lustre/obdclass/llog_swab.c index 723c212c6747..016046d26010 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_swab.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_swab.c @@ -44,7 +44,7 @@ static void print_llogd_body(struct llogd_body *d) { CDEBUG(D_OTHER, "llogd body: %p\n", d); - CDEBUG(D_OTHER, "\tlgd_logid.lgl_oi: "DOSTID"\n", + CDEBUG(D_OTHER, "\tlgd_logid.lgl_oi: " DOSTID "\n", POSTID(&d->lgd_logid.lgl_oi)); CDEBUG(D_OTHER, "\tlgd_logid.lgl_ogen: %#x\n", d->lgd_logid.lgl_ogen); CDEBUG(D_OTHER, "\tlgd_ctxt_idx: %#x\n", d->lgd_ctxt_idx); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 94c8ae5a106a..b7ba351cffc3 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -512,7 +512,7 @@ void lu_object_header_print(const struct lu_env *env, void *cookie, lu_printer_t printer, const struct lu_object_header *hdr) { - (*printer)(env, cookie, "header@%p[%#lx, %d, "DFID"%s%s%s]", + (*printer)(env, cookie, "header@%p[%#lx, %d, " DFID "%s%s%s]", hdr, hdr->loh_flags, atomic_read(&hdr->loh_ref), PFID(&hdr->loh_fid), hlist_unhashed(&hdr->loh_hash) ? "" : " hash", diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index d4768311cf92..1c4a8fe87dd8 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -277,7 +277,7 @@ static int echo_page_print(const struct lu_env *env, { struct echo_page *ep = cl2echo_page(slice); - (*printer)(env, cookie, LUSTRE_ECHO_CLIENT_NAME"-page@%p %d vm@%p\n", + (*printer)(env, cookie, LUSTRE_ECHO_CLIENT_NAME "-page@%p %d vm@%p\n", ep, mutex_is_locked(&ep->ep_lock), slice->cpl_page->cp_vmpage); return 0; @@ -1121,7 +1121,7 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed, } cl_echo_object_put(eco); - CDEBUG(D_INFO, "oa oid "DOSTID"\n", POSTID(&oa->o_oi)); + CDEBUG(D_INFO, "oa oid " DOSTID "\n", POSTID(&oa->o_oi)); failed: if (created && rc) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 33d769c625e7..4db8116d2c32 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -472,7 +472,7 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) else if (ext->oe_start > tmp->oe_end) n = &(*n)->rb_right; else - EASSERTF(0, tmp, EXTSTR"\n", EXTPARA(ext)); + EASSERTF(0, tmp, EXTSTR "\n", EXTPARA(ext)); } rb_link_node(&ext->oe_node, parent, n); rb_insert_color(&ext->oe_node, &obj->oo_root); @@ -690,7 +690,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, /* grants has been allocated by caller */ LASSERTF(*grants >= chunksize + cli->cl_extent_tax, "%u/%u/%u.\n", *grants, chunksize, cli->cl_extent_tax); - LASSERTF((max_end - cur->oe_start) < max_pages, EXTSTR"\n", + LASSERTF((max_end - cur->oe_start) < max_pages, EXTSTR "\n", EXTPARA(cur)); restart: @@ -709,7 +709,7 @@ restart: /* if covering by different locks, no chance to match */ if (olck->ols_dlmlock != ext->oe_dlmlock) { EASSERTF(!overlapped(ext, cur), ext, - EXTSTR"\n", EXTPARA(cur)); + EXTSTR "\n", EXTPARA(cur)); ext = next_extent(ext); continue; @@ -732,7 +732,7 @@ restart: */ EASSERTF((ext->oe_start <= cur->oe_start && ext->oe_end >= cur->oe_end), - ext, EXTSTR"\n", EXTPARA(cur)); + ext, EXTSTR "\n", EXTPARA(cur)); if (ext->oe_state > OES_CACHE || ext->oe_fsync_wait) { /* for simplicity, we wait for this extent to diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index d8aa3fb468c7..922d0cbe83dc 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1227,8 +1227,7 @@ static int check_write_checksum(struct obdo *oa, msg = "changed in transit AND doesn't match the original - likely false positive due to mmap IO (bug 11742)" ; - LCONSOLE_ERROR_MSG(0x132, "BAD WRITE CHECKSUM: %s: from %s inode "DFID - " object "DOSTID" extent [%llu-%llu]\n", + LCONSOLE_ERROR_MSG(0x132, "BAD WRITE CHECKSUM: %s: from %s inode " DFID " object " DOSTID " extent [%llu-%llu]\n", msg, libcfs_nid2str(peer->nid), oa->o_valid & OBD_MD_FLFID ? oa->o_parent_seq : (__u64)0, oa->o_valid & OBD_MD_FLFID ? oa->o_parent_oid : 0, diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 6466974a43e7..1c7779215eed 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -367,8 +367,8 @@ void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req, */ CDEBUG((lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) ? D_ADAPTTO : D_WARNING, - "Reported service time %u > total measured time " - CFS_DURATION_T"\n", service_time, + "Reported service time %u > total measured time " CFS_DURATION_T "\n", + service_time, (long)(now - req->rq_sent)); return; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 9456a1825918..55e8696e7d86 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -2089,7 +2089,7 @@ static void dump_obdo(struct obdo *oa) CDEBUG(D_RPCTRACE, "obdo: o_valid = %08x\n", valid); if (valid & OBD_MD_FLID) - CDEBUG(D_RPCTRACE, "obdo: id = "DOSTID"\n", POSTID(&oa->o_oi)); + CDEBUG(D_RPCTRACE, "obdo: id = " DOSTID "\n", POSTID(&oa->o_oi)); if (valid & OBD_MD_FLFID) CDEBUG(D_RPCTRACE, "obdo: o_parent_seq = %#llx\n", oa->o_parent_seq); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index b8091c118302..759aa6c16e28 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1565,7 +1565,7 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt, /* req_in handling should/must be fast */ if (ktime_get_real_seconds() - req->rq_arrival_time.tv_sec > 5) - DEBUG_REQ(D_WARNING, req, "Slow req_in handling "CFS_DURATION_T"s", + DEBUG_REQ(D_WARNING, req, "Slow req_in handling " CFS_DURATION_T "s", (long)(ktime_get_real_seconds() - req->rq_arrival_time.tv_sec)); -- cgit v1.2.3-55-g7522 From ae839184d354b1251bf928307e663ed80806be6e Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 14 Jun 2017 11:01:17 -0400 Subject: staging: lustre: lustre: make all struct file_operations constant Checkpatch reported several cases of struct file_operations not being const. This resolves those warnings. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/lproc_fld.c | 2 +- drivers/staging/lustre/lustre/include/lprocfs_status.h | 8 ++++---- drivers/staging/lustre/lustre/llite/file.c | 6 +++--- drivers/staging/lustre/lustre/llite/llite_internal.h | 8 ++++---- drivers/staging/lustre/lustre/llite/lproc_llite.c | 6 +++--- drivers/staging/lustre/lustre/lov/lov_pool.c | 2 +- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c b/drivers/staging/lustre/lustre/fld/lproc_fld.c index 61ac420798af..b83d7ebb2d18 100644 --- a/drivers/staging/lustre/lustre/fld/lproc_fld.c +++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c @@ -136,7 +136,7 @@ fld_debugfs_cache_flush_release(struct inode *inode, struct file *file) return 0; } -static struct file_operations fld_debugfs_cache_flush_fops = { +static const struct file_operations fld_debugfs_cache_flush_fops = { .owner = THIS_MODULE, .open = simple_open, .write = fld_debugfs_cache_flush_write, diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 242abb881766..1e68c77d0cdf 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -49,7 +49,7 @@ struct lprocfs_vars { const char *name; - struct file_operations *fops; + const struct file_operations *fops; void *data; /** * sysfs file mode. @@ -449,7 +449,7 @@ int lprocfs_exp_cleanup(struct obd_export *exp); struct dentry *ldebugfs_add_simple(struct dentry *root, char *name, void *data, - struct file_operations *fops); + const struct file_operations *fops); int ldebugfs_register_stats(struct dentry *parent, const char *name, @@ -536,7 +536,7 @@ static int name##_single_open(struct inode *inode, struct file *file) \ { \ return single_open(file, name##_seq_show, inode->i_private); \ } \ -static struct file_operations name##_fops = { \ +static const struct file_operations name##_fops = { \ .owner = THIS_MODULE, \ .open = name##_single_open, \ .read = seq_read, \ @@ -581,7 +581,7 @@ static struct file_operations name##_fops = { \ { \ return single_open(file, NULL, inode->i_private); \ } \ - static struct file_operations name##_##type##_fops = { \ + static const struct file_operations name##_##type##_fops = { \ .open = name##_##type##_open, \ .write = name##_##type##_write, \ .release = lprocfs_single_release, \ diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 711fbb004c9b..ab1c85c1ed38 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3114,7 +3114,7 @@ int ll_inode_permission(struct inode *inode, int mask) } /* -o localflock - only provides locally consistent flock locks */ -struct file_operations ll_file_operations = { +const struct file_operations ll_file_operations = { .read_iter = ll_file_read_iter, .write_iter = ll_file_write_iter, .unlocked_ioctl = ll_file_ioctl, @@ -3127,7 +3127,7 @@ struct file_operations ll_file_operations = { .flush = ll_flush }; -struct file_operations ll_file_operations_flock = { +const struct file_operations ll_file_operations_flock = { .read_iter = ll_file_read_iter, .write_iter = ll_file_write_iter, .unlocked_ioctl = ll_file_ioctl, @@ -3143,7 +3143,7 @@ struct file_operations ll_file_operations_flock = { }; /* These are for -o noflock - to return ENOSYS on flock calls */ -struct file_operations ll_file_operations_noflock = { +const struct file_operations ll_file_operations_noflock = { .read_iter = ll_file_read_iter, .write_iter = ll_file_write_iter, .unlocked_ioctl = ll_file_ioctl, diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index de09ddfdfa6a..41a0c8d95a00 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -470,7 +470,7 @@ struct ll_sb_info { struct ll_ra_info ll_ra_info; unsigned int ll_namelen; - struct file_operations *ll_fop; + const struct file_operations *ll_fop; unsigned int ll_md_brw_pages; /* readdir pages per RPC */ @@ -736,9 +736,9 @@ void ll_cl_remove(struct file *file, const struct lu_env *env); extern const struct address_space_operations ll_aops; /* llite/file.c */ -extern struct file_operations ll_file_operations; -extern struct file_operations ll_file_operations_flock; -extern struct file_operations ll_file_operations_noflock; +extern const struct file_operations ll_file_operations; +extern const struct file_operations ll_file_operations_flock; +extern const struct file_operations ll_file_operations_noflock; extern const struct inode_operations ll_file_inode_operations; int ll_have_md_lock(struct inode *inode, __u64 *bits, enum ldlm_mode l_req_mode); diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index c742cba60199..aeae6670e262 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -39,9 +39,9 @@ #include "vvp_internal.h" /* debugfs llite mount point registration */ -static struct file_operations ll_rw_extents_stats_fops; -static struct file_operations ll_rw_extents_stats_pp_fops; -static struct file_operations ll_rw_offset_stats_fops; +static const struct file_operations ll_rw_extents_stats_fops; +static const struct file_operations ll_rw_extents_stats_pp_fops; +static const struct file_operations ll_rw_offset_stats_fops; static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr, char *buf) diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index 1952bbdeb29e..39daa17e0736 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -286,7 +286,7 @@ static int pool_proc_open(struct inode *inode, struct file *file) return rc; } -static struct file_operations pool_proc_operations = { +static const struct file_operations pool_proc_operations = { .open = pool_proc_open, .read = seq_read, .llseek = seq_lseek, diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 6d1caed02733..bc19f19d38d9 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -301,7 +301,7 @@ EXPORT_SYMBOL(lprocfs_seq_release); struct dentry *ldebugfs_add_simple(struct dentry *root, char *name, void *data, - struct file_operations *fops) + const struct file_operations *fops) { struct dentry *entry; umode_t mode = 0; -- cgit v1.2.3-55-g7522 From e7738506c5f29e1877b39ebaaa550a476370336a Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 14 Jun 2017 11:01:18 -0400 Subject: staging: lustre: lustre: fix all bare unsigned usage Turn all bare unsigned usage in the lustre code to proper unsigned int. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/cl_object.h | 4 ++-- drivers/staging/lustre/lustre/include/lu_object.h | 4 ++-- drivers/staging/lustre/lustre/llite/namei.c | 2 +- drivers/staging/lustre/lustre/llite/rw26.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 6 +++--- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 +++--- drivers/staging/lustre/lustre/osc/osc_internal.h | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 2bc3ee51b069..90a0c501e1ea 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -1287,7 +1287,7 @@ do { \ * @{ */ struct cl_page_list { - unsigned pl_nr; + unsigned int pl_nr; struct list_head pl_pages; struct task_struct *pl_owner; }; @@ -1842,7 +1842,7 @@ struct cl_io { /** * Number of pages owned by this IO. For invariant checking. */ - unsigned ci_owned_nr; + unsigned int ci_owned_nr; }; /** @} cl_io */ diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 73ecc232967b..2e70602dc2e2 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -968,11 +968,11 @@ struct lu_context { * Version counter used to skip calls to lu_context_refill() when no * keys were registered. */ - unsigned lc_version; + unsigned int lc_version; /** * Debugging cookie. */ - unsigned lc_cookie; + unsigned int lc_cookie; }; /** diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 9f118a1a57fc..a208a8b02c2c 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -678,7 +678,7 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, * together. */ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, - struct file *file, unsigned open_flags, + struct file *file, unsigned int open_flags, umode_t mode, int *opened) { struct lookup_intent *it; diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 22dc6a59e332..3619cd8bb5f3 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -547,7 +547,7 @@ out: } static int ll_write_end(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, + loff_t pos, unsigned int len, unsigned int copied, struct page *vmpage, void *fsdata) { struct ll_cl_context *lcc = fsdata; diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index 6cb2db28eb60..8e45672b4617 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -381,11 +381,11 @@ int cl_sb_fini(struct super_block *sb) #define PGC_DEPTH_SHIFT (32) struct vvp_pgcache_id { - unsigned vpi_bucket; - unsigned vpi_depth; + unsigned int vpi_bucket; + unsigned int vpi_depth; uint32_t vpi_index; - unsigned vpi_curdep; + unsigned int vpi_curdep; struct lu_object_header *vpi_obj; }; diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 4db8116d2c32..d8a95f8fe1ff 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1889,10 +1889,10 @@ struct extent_rpc_data { unsigned int erd_max_chunks; }; -static inline unsigned osc_extent_chunks(const struct osc_extent *ext) +static inline unsigned int osc_extent_chunks(const struct osc_extent *ext) { struct client_obd *cli = osc_cli(ext->oe_obj); - unsigned ppc_bits = cli->cl_chunkbits - PAGE_SHIFT; + unsigned int ppc_bits = cli->cl_chunkbits - PAGE_SHIFT; return (ext->oe_end >> ppc_bits) - (ext->oe_start >> ppc_bits) + 1; } @@ -1950,7 +1950,7 @@ static int try_to_add_extent_for_io(struct client_obd *cli, return 1; } -static inline unsigned osc_max_write_chunks(const struct client_obd *cli) +static inline unsigned int osc_max_write_chunks(const struct client_obd *cli) { /* * LU-8135: diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index 845e795d8795..13a40f6423ff 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -62,7 +62,7 @@ struct osc_async_page { struct list_head oap_rpc_item; u64 oap_obj_off; - unsigned oap_page_off; + unsigned int oap_page_off; enum async_flags oap_async_flags; struct brw_page oap_brw_page; -- cgit v1.2.3-55-g7522 From bd9a53e67ee6c3c51f4d4b53a6f0753897e358ee Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 14 Jun 2017 11:01:19 -0400 Subject: staging: lustre: lustre: add all missing indentifier names Create identifier names missing from function prototypes as reported by checkpatch. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/lprocfs_status.h | 4 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 27 ++++++++++++---------- .../staging/lustre/lustre/llite/llite_internal.h | 14 +++++------ drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 4 ++-- 5 files changed, 27 insertions(+), 24 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 1e68c77d0cdf..915283c04094 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -523,8 +523,8 @@ unsigned long lprocfs_oh_sum(struct obd_histogram *oh); void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, struct lprocfs_counter *cnt); -int lprocfs_single_release(struct inode *, struct file *); -int lprocfs_seq_release(struct inode *, struct file *); +int lprocfs_single_release(struct inode *inode, struct file *file); +int lprocfs_seq_release(struct inode *inode, struct file *file); /* 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 diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 5d24b4825796..ec3b23cd09ec 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -79,11 +79,11 @@ static inline int ldlm_ns_empty(struct ldlm_namespace *ns) return atomic_read(&ns->ns_bref) == 0; } -void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *, - enum ldlm_side); -void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *, - enum ldlm_side); -struct ldlm_namespace *ldlm_namespace_first_locked(enum ldlm_side); +void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *ns, + enum ldlm_side client); +void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *ns, + enum ldlm_side client); +struct ldlm_namespace *ldlm_namespace_first_locked(enum ldlm_side client); /* ldlm_request.c */ /* Cancel lru flag, it indicates we cancel aged locks. */ @@ -130,16 +130,19 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list); int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill, enum req_location loc, void *data, int size); struct ldlm_lock * -ldlm_lock_create(struct ldlm_namespace *ns, const struct ldlm_res_id *, +ldlm_lock_create(struct ldlm_namespace *ns, const struct ldlm_res_id *id, enum ldlm_type type, enum ldlm_mode mode, const struct ldlm_callback_suite *cbs, void *data, __u32 lvb_len, enum lvb_type lvb_type); -enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *, struct ldlm_lock **, - void *cookie, __u64 *flags); -void ldlm_lock_addref_internal(struct ldlm_lock *, enum ldlm_mode mode); -void ldlm_lock_addref_internal_nolock(struct ldlm_lock *, enum ldlm_mode mode); -void ldlm_lock_decref_internal(struct ldlm_lock *, enum ldlm_mode mode); -void ldlm_lock_decref_internal_nolock(struct ldlm_lock *, enum ldlm_mode mode); +enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, + struct ldlm_lock **lock, void *cookie, + __u64 *flags); +void ldlm_lock_addref_internal(struct ldlm_lock *lock, enum ldlm_mode mode); +void ldlm_lock_addref_internal_nolock(struct ldlm_lock *lock, + enum ldlm_mode mode); +void ldlm_lock_decref_internal(struct ldlm_lock *lock, enum ldlm_mode mode); +void ldlm_lock_decref_internal_nolock(struct ldlm_lock *lock, + enum ldlm_mode mode); int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list, enum ldlm_desc_ast_t ast_type); int ldlm_lock_remove_from_lru_check(struct ldlm_lock *lock, time_t last_use); diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 41a0c8d95a00..cd3311abf999 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -718,14 +718,14 @@ extern const struct inode_operations ll_special_inode_operations; struct inode *ll_iget(struct super_block *sb, ino_t hash, struct lustre_md *lic); int ll_test_inode_by_fid(struct inode *inode, void *opaque); -int ll_md_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *, +int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, void *data, int flag); struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de); void ll_update_times(struct ptlrpc_request *request, struct inode *inode); /* llite/rw.c */ int ll_writepage(struct page *page, struct writeback_control *wbc); -int ll_writepages(struct address_space *, struct writeback_control *wbc); +int ll_writepages(struct address_space *mapping, struct writeback_control *wbc); int ll_readpage(struct file *file, struct page *page); void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras); int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io); @@ -747,7 +747,7 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits, enum ldlm_mode mode); int ll_file_open(struct inode *inode, struct file *file); int ll_file_release(struct inode *inode, struct file *file); -int ll_release_openhandle(struct inode *, struct lookup_intent *); +int ll_release_openhandle(struct inode *inode, struct lookup_intent *it); int ll_md_real_close(struct inode *inode, fmode_t fmode); int ll_getattr(const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags); @@ -778,9 +778,9 @@ int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss); /* llite/dcache.c */ extern const struct dentry_operations ll_d_ops; -void ll_intent_drop_lock(struct lookup_intent *); -void ll_intent_release(struct lookup_intent *); -void ll_invalidate_aliases(struct inode *); +void ll_intent_drop_lock(struct lookup_intent *it); +void ll_intent_release(struct lookup_intent *it); +void ll_invalidate_aliases(struct inode *inode); void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode); int ll_revalidate_it_finish(struct ptlrpc_request *request, struct lookup_intent *it, struct inode *inode); @@ -811,7 +811,7 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data); int ll_show_options(struct seq_file *seq, struct dentry *dentry); void ll_dirty_page_discard_warn(struct page *page, int ioret); int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, - struct super_block *, struct lookup_intent *); + struct super_block *sb, struct lookup_intent *it); int ll_obd_statfs(struct inode *inode, void __user *arg); int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize); int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize); diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 63a10a936e4b..64fcaef0bacd 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -75,7 +75,7 @@ static void lmv_activate_target(struct lmv_obd *lmv, static int lmv_set_mdc_active(struct lmv_obd *lmv, const struct obd_uuid *uuid, int activate) { - struct lmv_tgt_desc *uninitialized_var(tgt); + struct lmv_tgt_desc *tgt = NULL; struct obd_device *obd; u32 i; int rc = 0; diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index d2707a323c47..c38e166f1502 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -68,7 +68,7 @@ void ptlrpc_init_xid(void); void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc, struct ptlrpc_request *req); int ptlrpc_expired_set(void *data); -int ptlrpc_set_next_timeout(struct ptlrpc_request_set *); +int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set); void ptlrpc_resend_req(struct ptlrpc_request *request); void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req); void ptlrpc_assign_next_xid_nolock(struct ptlrpc_request *req); @@ -79,7 +79,7 @@ void ptlrpc_add_unreplied(struct ptlrpc_request *req); int ptlrpc_init_portals(void); void ptlrpc_exit_portals(void); -void ptlrpc_request_handle_notconn(struct ptlrpc_request *); +void ptlrpc_request_handle_notconn(struct ptlrpc_request *req); 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); -- cgit v1.2.3-55-g7522 From b9778d910d58ab2b0fc36c20e762e95984035402 Mon Sep 17 00:00:00 2001 From: Jhih-Ming Hunag Date: Tue, 20 Jun 2017 22:51:59 +0800 Subject: Staging: ccree: add space around comma, brace and operator. Add space around comma, brace, and opertor. Signed-off-by: Jhih-Ming Hunag Acked-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index e8936a324204..ca3f11fdbd29 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -155,7 +155,7 @@ static int ssi_aead_init(struct crypto_aead *tfm) ctx->auth_mode = ssi_alg->auth_mode; ctx->drvdata = ssi_alg->drvdata; dev = &ctx->drvdata->plat_dev->dev; - crypto_aead_set_reqsize(tfm,sizeof(struct aead_req_ctx)); + crypto_aead_set_reqsize(tfm, sizeof(struct aead_req_ctx)); /* Allocate key buffer, cache line aligned */ ctx->enckey = dma_alloc_coherent(dev, AES_MAX_KEY_SIZE, @@ -663,7 +663,7 @@ static int ssi_aead_setauthsize( CHECK_AND_RETURN_UPON_FIPS_ERROR(); /* Unsupported auth. sizes */ if ((authsize == 0) || - (authsize >crypto_aead_maxauthsize(authenc))) { + (authsize > crypto_aead_maxauthsize(authenc))) { return -ENOTSUPP; } @@ -791,7 +791,7 @@ ssi_aead_process_authenc_data_desc( u32 mlli_nents = areq_ctx->assoc.mlli_nents; if (likely(areq_ctx->is_single_pass == true)) { - if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT){ + if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { mlli_addr = areq_ctx->dst.sram_addr; mlli_nents = areq_ctx->dst.mlli_nents; } else { @@ -1566,7 +1566,7 @@ static int config_ccm_adata(struct aead_request *req) { /* taken from crypto/ccm.c */ /* 2 <= L <= 8, so 1 <= L' <= 7. */ if (2 > l || l > 8) { - SSI_LOG_ERR("illegal iv value %X\n",req->iv[0]); + SSI_LOG_ERR("illegal iv value %X\n", req->iv[0]); return -EINVAL; } memcpy(b0, req->iv, AES_BLOCK_SIZE); @@ -1715,7 +1715,7 @@ static inline void ssi_aead_gcm_setup_gctr_desc( set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; - if ((req_ctx->cryptlen != 0) && (req_ctx->plaintext_authenticate_only==false)){ + if ((req_ctx->cryptlen != 0) && (req_ctx->plaintext_authenticate_only == false)) { /* load AES/CTR initial CTR value inc by 2*/ hw_desc_init(&desc[idx]); set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); @@ -1815,7 +1815,7 @@ static inline int ssi_aead_gcm( //in RFC4543 no data to encrypt. just copy data from src to dest. - if (req_ctx->plaintext_authenticate_only==true){ + if (req_ctx->plaintext_authenticate_only == true) { ssi_aead_process_cipher_data_desc(req, BYPASS, desc, seq_size); ssi_aead_gcm_setup_ghash_desc(req, desc, seq_size); /* process(ghash) assoc data */ @@ -1862,27 +1862,27 @@ static inline void ssi_aead_dump_gcm( ctx->cipher_mode, ctx->authsize, ctx->enc_keylen, req->assoclen, req_ctx->cryptlen ); if ( ctx->enckey != NULL ) { - dump_byte_array("mac key",ctx->enckey, 16); + dump_byte_array("mac key", ctx->enckey, 16); } - dump_byte_array("req->iv",req->iv, AES_BLOCK_SIZE); + dump_byte_array("req->iv", req->iv, AES_BLOCK_SIZE); - dump_byte_array("gcm_iv_inc1",req_ctx->gcm_iv_inc1, AES_BLOCK_SIZE); + dump_byte_array("gcm_iv_inc1", req_ctx->gcm_iv_inc1, AES_BLOCK_SIZE); - dump_byte_array("gcm_iv_inc2",req_ctx->gcm_iv_inc2, AES_BLOCK_SIZE); + dump_byte_array("gcm_iv_inc2", req_ctx->gcm_iv_inc2, AES_BLOCK_SIZE); - dump_byte_array("hkey",req_ctx->hkey, AES_BLOCK_SIZE); + dump_byte_array("hkey", req_ctx->hkey, AES_BLOCK_SIZE); - dump_byte_array("mac_buf",req_ctx->mac_buf, AES_BLOCK_SIZE); + dump_byte_array("mac_buf", req_ctx->mac_buf, AES_BLOCK_SIZE); - dump_byte_array("gcm_len_block",req_ctx->gcm_len_block.lenA, AES_BLOCK_SIZE); + dump_byte_array("gcm_len_block", req_ctx->gcm_len_block.lenA, AES_BLOCK_SIZE); - if (req->src!=NULL && req->cryptlen) { - dump_byte_array("req->src",sg_virt(req->src), req->cryptlen+req->assoclen); + if (req->src != NULL && req->cryptlen) { + dump_byte_array("req->src", sg_virt(req->src), req->cryptlen+req->assoclen); } - if (req->dst!=NULL) { - dump_byte_array("req->dst",sg_virt(req->dst), req->cryptlen+ctx->authsize+req->assoclen); + if (req->dst != NULL) { + dump_byte_array("req->dst", sg_virt(req->dst), req->cryptlen+ctx->authsize+req->assoclen); } } #endif @@ -1959,7 +1959,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction SSI_LOG_DEBUG("%s context=%p req=%p iv=%p src=%p src_ofs=%d dst=%p dst_ofs=%d cryptolen=%d\n", - ((direct==DRV_CRYPTO_DIRECTION_ENCRYPT)?"Encrypt":"Decrypt"), ctx, req, req->iv, + ((direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? "Encrypt" : "Decrypt"), ctx, req, req->iv, sg_virt(req->src), req->src->offset, sg_virt(req->dst), req->dst->offset, req->cryptlen); CHECK_AND_RETURN_UPON_FIPS_ERROR(); -- cgit v1.2.3-55-g7522 From b803d57df57d2f61fe7e21a807d39ed6f5a67d94 Mon Sep 17 00:00:00 2001 From: Jhih-Ming Hunag Date: Tue, 20 Jun 2017 22:52:00 +0800 Subject: staging: ccree: move brace { to previous line for if. Move brace { to previous line for if. Signed-off-by: Jhih-Ming Hunag Acked-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index ca3f11fdbd29..6bcab5abceb1 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -1340,8 +1340,7 @@ static int validate_data_size(struct ssi_aead_ctx *ctx, goto data_size_err; if (ctx->cipher_mode == DRV_CIPHER_CCM) break; - if (ctx->cipher_mode == DRV_CIPHER_GCTR) - { + if (ctx->cipher_mode == DRV_CIPHER_GCTR) { if (areq_ctx->plaintext_authenticate_only == true) areq_ctx->is_single_pass = false; break; @@ -1912,8 +1911,7 @@ static int config_gcm_context(struct aead_request *req) { memcpy(req_ctx->gcm_iv_inc1, req->iv, 16); - if (req_ctx->plaintext_authenticate_only == false) - { + if (req_ctx->plaintext_authenticate_only == false) { __be64 temp64; temp64 = cpu_to_be64(req->assoclen * 8); memcpy ( &req_ctx->gcm_len_block.lenA , &temp64, sizeof(temp64) ); -- cgit v1.2.3-55-g7522 From 4e09b077a031097d755e9baf9ddee2b78e19c564 Mon Sep 17 00:00:00 2001 From: Jhih-Ming Hunag Date: Tue, 20 Jun 2017 22:52:01 +0800 Subject: staging: ccree: move '{' to next line for function. Move '{' to next line for function. Signed-off-by: Jhih-Ming Hunag Acked-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 6bcab5abceb1..3d9957fce11c 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -1542,7 +1542,8 @@ static inline int ssi_aead_ccm( return 0; } -static int config_ccm_adata(struct aead_request *req) { +static int config_ccm_adata(struct aead_request *req) +{ struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); @@ -1886,7 +1887,8 @@ static inline void ssi_aead_dump_gcm( } #endif -static int config_gcm_context(struct aead_request *req) { +static int config_gcm_context(struct aead_request *req) +{ struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); -- cgit v1.2.3-55-g7522 From 134a8ca1c9b4fca4846995f5c06f90cdead6f920 Mon Sep 17 00:00:00 2001 From: Jhih-Ming Hunag Date: Tue, 20 Jun 2017 22:52:02 +0800 Subject: staging: ccree: move * to close variable name instead of type. Move * to close variable name instead of type. Signed-off-by: Jhih-Ming Hunag Acked-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 3d9957fce11c..6b9de35ea0a7 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -1843,7 +1843,7 @@ static inline int ssi_aead_gcm( #ifdef CC_DEBUG static inline void ssi_aead_dump_gcm( - const char* title, + const char *title, struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); -- cgit v1.2.3-55-g7522 From fe2d182332aac66573d51af437b5332b22acde4d Mon Sep 17 00:00:00 2001 From: Jhih-Ming Hunag Date: Tue, 20 Jun 2017 22:52:03 +0800 Subject: staging: ccree: remove improper space Remove improper space. Signed-off-by: Jhih-Ming Hunag Acked-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 6b9de35ea0a7..57c7c68db2c4 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -1375,10 +1375,10 @@ data_size_err: static unsigned int format_ccm_a0(u8 *pA0Buff, u32 headerSize) { unsigned int len = 0; - if ( headerSize == 0 ) { + if (headerSize == 0) { return 0; } - if ( headerSize < ((1UL << 16) - (1UL << 8) )) { + if (headerSize < ((1UL << 16) - (1UL << 8))) { len = 2; pA0Buff[0] = (headerSize >> 8) & 0xFF; @@ -1588,7 +1588,7 @@ static int config_ccm_adata(struct aead_request *req) req_ctx->ccm_hdr_size = format_ccm_a0 (a0, req->assoclen); memset(req->iv + 15 - req->iv[0], 0, req->iv[0] + 1); - req->iv [15] = 1; + req->iv[15] = 1; memcpy(ctr_count_0, req->iv, AES_BLOCK_SIZE) ; ctr_count_0[15] = 0; @@ -1859,9 +1859,9 @@ static inline void ssi_aead_dump_gcm( } SSI_LOG_DEBUG("cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, cryptlen %d \n", \ - ctx->cipher_mode, ctx->authsize, ctx->enc_keylen, req->assoclen, req_ctx->cryptlen ); + ctx->cipher_mode, ctx->authsize, ctx->enc_keylen, req->assoclen, req_ctx->cryptlen); - if ( ctx->enckey != NULL ) { + if (ctx->enckey != NULL) { dump_byte_array("mac key", ctx->enckey, 16); } @@ -1916,16 +1916,16 @@ static int config_gcm_context(struct aead_request *req) if (req_ctx->plaintext_authenticate_only == false) { __be64 temp64; temp64 = cpu_to_be64(req->assoclen * 8); - memcpy ( &req_ctx->gcm_len_block.lenA , &temp64, sizeof(temp64) ); + memcpy (&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); temp64 = cpu_to_be64(cryptlen * 8); - memcpy ( &req_ctx->gcm_len_block.lenC , &temp64, 8 ); + memcpy (&req_ctx->gcm_len_block.lenC, &temp64, 8); } else { //rfc4543=> all data(AAD,IV,Plain) are considered additional data that is nothing is encrypted. __be64 temp64; temp64 = cpu_to_be64((req->assoclen+GCM_BLOCK_RFC4_IV_SIZE+cryptlen) * 8); - memcpy ( &req_ctx->gcm_len_block.lenA , &temp64, sizeof(temp64) ); + memcpy (&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); temp64 = 0; - memcpy ( &req_ctx->gcm_len_block.lenC , &temp64, 8 ); + memcpy (&req_ctx->gcm_len_block.lenC, &temp64, 8); } return 0; @@ -2001,7 +2001,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction req->iv = areq_ctx->ctr_iv; areq_ctx->hw_iv_size = CTR_RFC3686_BLOCK_SIZE; } else if ((ctx->cipher_mode == DRV_CIPHER_CCM) || - (ctx->cipher_mode == DRV_CIPHER_GCTR) ) { + (ctx->cipher_mode == DRV_CIPHER_GCTR)) { areq_ctx->hw_iv_size = AES_BLOCK_SIZE; if (areq_ctx->ctr_iv != req->iv) { memcpy(areq_ctx->ctr_iv, req->iv, crypto_aead_ivsize(tfm)); @@ -2082,7 +2082,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction case DRV_HASH_XCBC_MAC: ssi_aead_xcbc_authenc(req, desc, &seq_len); break; -#if ( SSI_CC_HAS_AES_CCM || SSI_CC_HAS_AES_GCM ) +#if (SSI_CC_HAS_AES_CCM || SSI_CC_HAS_AES_GCM) case DRV_HASH_NULL: #if SSI_CC_HAS_AES_CCM if (ctx->cipher_mode == DRV_CIPHER_CCM) { @@ -2146,7 +2146,7 @@ static int ssi_rfc4309_ccm_encrypt(struct aead_request *req) int rc = -EINVAL; if (!valid_assoclen(req)) { - SSI_LOG_ERR("invalid Assoclen:%u\n", req->assoclen ); + SSI_LOG_ERR("invalid Assoclen:%u\n", req->assoclen); goto out; } @@ -2221,7 +2221,7 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); int rc = 0; - SSI_LOG_DEBUG("ssi_rfc4106_gcm_setkey() keylen %d, key %p \n", keylen, key ); + SSI_LOG_DEBUG("ssi_rfc4106_gcm_setkey() keylen %d, key %p \n", keylen, key); if (keylen < 4) return -EINVAL; @@ -2239,7 +2239,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); int rc = 0; - SSI_LOG_DEBUG("ssi_rfc4543_gcm_setkey() keylen %d, key %p \n", keylen, key ); + SSI_LOG_DEBUG("ssi_rfc4543_gcm_setkey() keylen %d, key %p \n", keylen, key); if (keylen < 4) return -EINVAL; @@ -2274,7 +2274,7 @@ static int ssi_gcm_setauthsize(struct crypto_aead *authenc, static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, unsigned int authsize) { - SSI_LOG_DEBUG("ssi_rfc4106_gcm_setauthsize() authsize %d \n", authsize ); + SSI_LOG_DEBUG("ssi_rfc4106_gcm_setauthsize() authsize %d \n", authsize); switch (authsize) { case 8: @@ -2291,7 +2291,7 @@ static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, static int ssi_rfc4543_gcm_setauthsize(struct crypto_aead *authenc, unsigned int authsize) { - SSI_LOG_DEBUG("ssi_rfc4543_gcm_setauthsize() authsize %d \n", authsize ); + SSI_LOG_DEBUG("ssi_rfc4543_gcm_setauthsize() authsize %d \n", authsize); if (authsize != 16) return -EINVAL; -- cgit v1.2.3-55-g7522 From 2bd251513051a9e287d9726e42ad8aea5c77c7c9 Mon Sep 17 00:00:00 2001 From: Jhih-Ming Hunag Date: Tue, 20 Jun 2017 22:52:04 +0800 Subject: staging: ccree: move else to follow close brace '}' Move else to follow close brace '}' Signed-off-by: Jhih-Ming Hunag Acked-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 57c7c68db2c4..c70e45023d06 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -1919,8 +1919,7 @@ static int config_gcm_context(struct aead_request *req) memcpy (&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); temp64 = cpu_to_be64(cryptlen * 8); memcpy (&req_ctx->gcm_len_block.lenC, &temp64, 8); - } - else { //rfc4543=> all data(AAD,IV,Plain) are considered additional data that is nothing is encrypted. + } else { //rfc4543=> all data(AAD,IV,Plain) are considered additional data that is nothing is encrypted. __be64 temp64; temp64 = cpu_to_be64((req->assoclen+GCM_BLOCK_RFC4_IV_SIZE+cryptlen) * 8); memcpy (&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); -- cgit v1.2.3-55-g7522 From 4f71fecd78ee0399fca91c56c857c947017e18c1 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Sat, 17 Jun 2017 14:44:05 +1200 Subject: staging: ccree: - style fix, spaces and tabs Changed code indent to be tabs across whole driver Found using checkpatch Signed-off-by: Derek Robson Acked-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_cipher.c | 45 +++++++++++++++++----------------- drivers/staging/ccree/ssi_driver.c | 6 ++--- drivers/staging/ccree/ssi_driver.h | 6 ++--- drivers/staging/ccree/ssi_fips.h | 8 +++--- drivers/staging/ccree/ssi_fips_ext.c | 4 +-- drivers/staging/ccree/ssi_fips_ll.c | 40 +++++++++++++++--------------- drivers/staging/ccree/ssi_fips_local.c | 28 ++++++++++----------- drivers/staging/ccree/ssi_fips_local.h | 12 ++++----- 8 files changed, 75 insertions(+), 74 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 2dfc6a3bd4c1..34450a5e6573 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -258,45 +258,45 @@ static void ssi_blkcipher_exit(struct crypto_tfm *tfm) typedef struct tdes_keys{ - u8 key1[DES_KEY_SIZE]; - u8 key2[DES_KEY_SIZE]; - u8 key3[DES_KEY_SIZE]; + u8 key1[DES_KEY_SIZE]; + u8 key2[DES_KEY_SIZE]; + u8 key3[DES_KEY_SIZE]; }tdes_keys_t; -static const u8 zero_buff[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; +static const u8 zero_buff[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; /* The function verifies that tdes keys are not weak.*/ static int ssi_fips_verify_3des_keys(const u8 *key, unsigned int keylen) { #ifdef CCREE_FIPS_SUPPORT - tdes_keys_t *tdes_key = (tdes_keys_t*)key; + tdes_keys_t *tdes_key = (tdes_keys_t*)key; /* verify key1 != key2 and key3 != key2*/ - if (unlikely( (memcmp((u8*)tdes_key->key1, (u8*)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || + if (unlikely( (memcmp((u8*)tdes_key->key1, (u8*)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || (memcmp((u8*)tdes_key->key3, (u8*)tdes_key->key2, sizeof(tdes_key->key3)) == 0) )) { - return -ENOEXEC; - } + return -ENOEXEC; + } #endif /* CCREE_FIPS_SUPPORT */ - return 0; + return 0; } /* The function verifies that xts keys are not weak.*/ static int ssi_fips_verify_xts_keys(const u8 *key, unsigned int keylen) { #ifdef CCREE_FIPS_SUPPORT - /* Weak key is define as key that its first half (128/256 lsb) equals its second half (128/256 msb) */ - int singleKeySize = keylen >> 1; + /* Weak key is define as key that its first half (128/256 lsb) equals its second half (128/256 msb) */ + int singleKeySize = keylen >> 1; if (unlikely(memcmp(key, &key[singleKeySize], singleKeySize) == 0)) { return -ENOEXEC; } #endif /* CCREE_FIPS_SUPPORT */ - return 0; + return 0; } static enum cc_hw_crypto_key hw_key_to_cc_hw_key(int slot_num) @@ -720,12 +720,13 @@ ssi_blkcipher_create_data_desc( } static int ssi_blkcipher_complete(struct device *dev, - struct ssi_ablkcipher_ctx *ctx_p, - struct blkcipher_req_ctx *req_ctx, - struct scatterlist *dst, struct scatterlist *src, - unsigned int ivsize, - void *areq, - void __iomem *cc_base) + struct ssi_ablkcipher_ctx *ctx_p, + struct blkcipher_req_ctx *req_ctx, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int ivsize, + void *areq, + void __iomem *cc_base) { int completion_error = 0; u32 inflight_counter; @@ -779,7 +780,7 @@ static int ssi_blkcipher_process( /* No data to process is valid */ return 0; } - /*For CTS in case of data size aligned to 16 use CBC mode*/ + /*For CTS in case of data size aligned to 16 use CBC mode*/ if (((nbytes % AES_BLOCK_SIZE) == 0) && (ctx_p->cipher_mode == DRV_CIPHER_CBC_CTS)){ ctx_p->cipher_mode = DRV_CIPHER_CBC; diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 190922970bf0..b9d0dd27e853 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -437,9 +437,9 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) struct ssi_drvdata *drvdata = (struct ssi_drvdata *)dev_get_drvdata(&plat_dev->dev); - ssi_aead_free(drvdata); - ssi_hash_free(drvdata); - ssi_ablkcipher_free(drvdata); + ssi_aead_free(drvdata); + ssi_hash_free(drvdata); + ssi_ablkcipher_free(drvdata); ssi_ivgen_fini(drvdata); ssi_power_mgr_fini(drvdata); ssi_buffer_mgr_fini(drvdata); diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 34bd7efb1907..78a327aa9029 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -110,9 +110,9 @@ struct ssi_crypto_req { void *user_arg; dma_addr_t ivgen_dma_addr[SSI_MAX_IVGEN_DMA_ADDRESSES]; /* For the first 'ivgen_dma_addr_len' addresses of this array, - * generated IV would be placed in it by send_request(). - * Same generated IV for all addresses! - */ + * generated IV would be placed in it by send_request(). + * Same generated IV for all addresses! + */ unsigned int ivgen_dma_addr_len; /* Amount of 'ivgen_dma_addr' elements to be filled. */ unsigned int ivgen_size; /* The generated IV size required, 8/16 B allowed. */ struct completion seq_compl; /* request completion */ diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h index e108d89ef98c..2fdb1b90a890 100644 --- a/drivers/staging/ccree/ssi_fips.h +++ b/drivers/staging/ccree/ssi_fips.h @@ -23,10 +23,10 @@ */ typedef enum ssi_fips_state { - CC_FIPS_STATE_NOT_SUPPORTED = 0, - CC_FIPS_STATE_SUPPORTED, - CC_FIPS_STATE_ERROR, - CC_FIPS_STATE_RESERVE32B = S32_MAX + CC_FIPS_STATE_NOT_SUPPORTED = 0, + CC_FIPS_STATE_SUPPORTED, + CC_FIPS_STATE_ERROR, + CC_FIPS_STATE_RESERVE32B = S32_MAX } ssi_fips_state_t; diff --git a/drivers/staging/ccree/ssi_fips_ext.c b/drivers/staging/ccree/ssi_fips_ext.c index 0f53a4bc43de..aa90ddd14b99 100644 --- a/drivers/staging/ccree/ssi_fips_ext.c +++ b/drivers/staging/ccree/ssi_fips_ext.c @@ -39,7 +39,7 @@ static ssi_fips_error_t fips_error = CC_REE_FIPS_ERROR_OK; */ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) { - int rc = 0; + int rc = 0; if (p_state == NULL) { return -EINVAL; @@ -58,7 +58,7 @@ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) */ int ssi_fips_ext_get_error(ssi_fips_error_t *p_err) { - int rc = 0; + int rc = 0; if (p_err == NULL) { return -EINVAL; diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index cdfbf04d7ad3..6c79e7de207f 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -233,8 +233,8 @@ static const FipsCmacData FipsCmacDataTable[] = { #define FIPS_CMAC_NUM_OF_TESTS (sizeof(FipsCmacDataTable) / sizeof(FipsCmacData)) static const FipsHashData FipsHashDataTable[] = { - { DRV_HASH_SHA1, NIST_SHA_1_MSG, NIST_SHA_MSG_SIZE, NIST_SHA_1_MD }, - { DRV_HASH_SHA256, NIST_SHA_256_MSG, NIST_SHA_MSG_SIZE, NIST_SHA_256_MD }, + { DRV_HASH_SHA1, NIST_SHA_1_MSG, NIST_SHA_MSG_SIZE, NIST_SHA_1_MD }, + { DRV_HASH_SHA256, NIST_SHA_256_MSG, NIST_SHA_MSG_SIZE, NIST_SHA_256_MD }, #if (CC_SUPPORT_SHA > 256) // { DRV_HASH_SHA512, NIST_SHA_512_MSG, NIST_SHA_MSG_SIZE, NIST_SHA_512_MD }, #endif @@ -242,8 +242,8 @@ static const FipsHashData FipsHashDataTable[] = { #define FIPS_HASH_NUM_OF_TESTS (sizeof(FipsHashDataTable) / sizeof(FipsHashData)) static const FipsHmacData FipsHmacDataTable[] = { - { DRV_HASH_SHA1, NIST_HMAC_SHA1_KEY, NIST_HMAC_SHA1_KEY_SIZE, NIST_HMAC_SHA1_MSG, NIST_HMAC_MSG_SIZE, NIST_HMAC_SHA1_MD }, - { DRV_HASH_SHA256, NIST_HMAC_SHA256_KEY, NIST_HMAC_SHA256_KEY_SIZE, NIST_HMAC_SHA256_MSG, NIST_HMAC_MSG_SIZE, NIST_HMAC_SHA256_MD }, + { DRV_HASH_SHA1, NIST_HMAC_SHA1_KEY, NIST_HMAC_SHA1_KEY_SIZE, NIST_HMAC_SHA1_MSG, NIST_HMAC_MSG_SIZE, NIST_HMAC_SHA1_MD }, + { DRV_HASH_SHA256, NIST_HMAC_SHA256_KEY, NIST_HMAC_SHA256_KEY_SIZE, NIST_HMAC_SHA256_MSG, NIST_HMAC_MSG_SIZE, NIST_HMAC_SHA256_MD }, #if (CC_SUPPORT_SHA > 256) // { DRV_HASH_SHA512, NIST_HMAC_SHA512_KEY, NIST_HMAC_SHA512_KEY_SIZE, NIST_HMAC_SHA512_MSG, NIST_HMAC_MSG_SIZE, NIST_HMAC_SHA512_MD }, #endif @@ -251,22 +251,22 @@ static const FipsHmacData FipsHmacDataTable[] = { #define FIPS_HMAC_NUM_OF_TESTS (sizeof(FipsHmacDataTable) / sizeof(FipsHmacData)) static const FipsCcmData FipsCcmDataTable[] = { - { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESCCM_128_KEY, NIST_AESCCM_128_BIT_KEY_SIZE, NIST_AESCCM_128_NONCE, NIST_AESCCM_128_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_128_PLAIN_TEXT, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_128_CIPHER, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_128_MAC }, - { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESCCM_128_KEY, NIST_AESCCM_128_BIT_KEY_SIZE, NIST_AESCCM_128_NONCE, NIST_AESCCM_128_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_128_CIPHER, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_128_PLAIN_TEXT, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_128_MAC }, - { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESCCM_192_KEY, NIST_AESCCM_192_BIT_KEY_SIZE, NIST_AESCCM_192_NONCE, NIST_AESCCM_192_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_192_PLAIN_TEXT, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_192_CIPHER, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_192_MAC }, - { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESCCM_192_KEY, NIST_AESCCM_192_BIT_KEY_SIZE, NIST_AESCCM_192_NONCE, NIST_AESCCM_192_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_192_CIPHER, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_192_PLAIN_TEXT, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_192_MAC }, - { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESCCM_256_KEY, NIST_AESCCM_256_BIT_KEY_SIZE, NIST_AESCCM_256_NONCE, NIST_AESCCM_256_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_256_PLAIN_TEXT, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_256_CIPHER, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_256_MAC }, - { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESCCM_256_KEY, NIST_AESCCM_256_BIT_KEY_SIZE, NIST_AESCCM_256_NONCE, NIST_AESCCM_256_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_256_CIPHER, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_256_PLAIN_TEXT, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_256_MAC }, + { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESCCM_128_KEY, NIST_AESCCM_128_BIT_KEY_SIZE, NIST_AESCCM_128_NONCE, NIST_AESCCM_128_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_128_PLAIN_TEXT, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_128_CIPHER, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_128_MAC }, + { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESCCM_128_KEY, NIST_AESCCM_128_BIT_KEY_SIZE, NIST_AESCCM_128_NONCE, NIST_AESCCM_128_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_128_CIPHER, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_128_PLAIN_TEXT, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_128_MAC }, + { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESCCM_192_KEY, NIST_AESCCM_192_BIT_KEY_SIZE, NIST_AESCCM_192_NONCE, NIST_AESCCM_192_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_192_PLAIN_TEXT, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_192_CIPHER, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_192_MAC }, + { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESCCM_192_KEY, NIST_AESCCM_192_BIT_KEY_SIZE, NIST_AESCCM_192_NONCE, NIST_AESCCM_192_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_192_CIPHER, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_192_PLAIN_TEXT, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_192_MAC }, + { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESCCM_256_KEY, NIST_AESCCM_256_BIT_KEY_SIZE, NIST_AESCCM_256_NONCE, NIST_AESCCM_256_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_256_PLAIN_TEXT, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_256_CIPHER, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_256_MAC }, + { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESCCM_256_KEY, NIST_AESCCM_256_BIT_KEY_SIZE, NIST_AESCCM_256_NONCE, NIST_AESCCM_256_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_256_CIPHER, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_256_PLAIN_TEXT, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_256_MAC }, }; #define FIPS_CCM_NUM_OF_TESTS (sizeof(FipsCcmDataTable) / sizeof(FipsCcmData)) static const FipsGcmData FipsGcmDataTable[] = { - { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESGCM_128_KEY, NIST_AESGCM_128_BIT_KEY_SIZE, NIST_AESGCM_128_IV, NIST_AESGCM_128_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_128_PLAIN_TEXT, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_128_CIPHER, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_128_MAC }, - { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESGCM_128_KEY, NIST_AESGCM_128_BIT_KEY_SIZE, NIST_AESGCM_128_IV, NIST_AESGCM_128_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_128_CIPHER, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_128_PLAIN_TEXT, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_128_MAC }, - { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESGCM_192_KEY, NIST_AESGCM_192_BIT_KEY_SIZE, NIST_AESGCM_192_IV, NIST_AESGCM_192_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_192_PLAIN_TEXT, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_192_CIPHER, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_192_MAC }, - { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESGCM_192_KEY, NIST_AESGCM_192_BIT_KEY_SIZE, NIST_AESGCM_192_IV, NIST_AESGCM_192_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_192_CIPHER, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_192_PLAIN_TEXT, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_192_MAC }, - { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESGCM_256_KEY, NIST_AESGCM_256_BIT_KEY_SIZE, NIST_AESGCM_256_IV, NIST_AESGCM_256_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_256_PLAIN_TEXT, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_256_CIPHER, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_256_MAC }, - { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESGCM_256_KEY, NIST_AESGCM_256_BIT_KEY_SIZE, NIST_AESGCM_256_IV, NIST_AESGCM_256_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_256_CIPHER, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_256_PLAIN_TEXT, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_256_MAC }, + { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESGCM_128_KEY, NIST_AESGCM_128_BIT_KEY_SIZE, NIST_AESGCM_128_IV, NIST_AESGCM_128_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_128_PLAIN_TEXT, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_128_CIPHER, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_128_MAC }, + { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESGCM_128_KEY, NIST_AESGCM_128_BIT_KEY_SIZE, NIST_AESGCM_128_IV, NIST_AESGCM_128_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_128_CIPHER, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_128_PLAIN_TEXT, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_128_MAC }, + { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESGCM_192_KEY, NIST_AESGCM_192_BIT_KEY_SIZE, NIST_AESGCM_192_IV, NIST_AESGCM_192_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_192_PLAIN_TEXT, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_192_CIPHER, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_192_MAC }, + { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESGCM_192_KEY, NIST_AESGCM_192_BIT_KEY_SIZE, NIST_AESGCM_192_IV, NIST_AESGCM_192_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_192_CIPHER, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_192_PLAIN_TEXT, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_192_MAC }, + { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESGCM_256_KEY, NIST_AESGCM_256_BIT_KEY_SIZE, NIST_AESGCM_256_IV, NIST_AESGCM_256_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_256_PLAIN_TEXT, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_256_CIPHER, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_256_MAC }, + { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESGCM_256_KEY, NIST_AESGCM_256_BIT_KEY_SIZE, NIST_AESGCM_256_IV, NIST_AESGCM_256_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_256_CIPHER, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_256_PLAIN_TEXT, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_256_MAC }, }; #define FIPS_GCM_NUM_OF_TESTS (sizeof(FipsGcmDataTable) / sizeof(FipsGcmData)) @@ -758,7 +758,7 @@ ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, FIPS_LOG("ssi_hash_fips_run_test %d returned error - rc = %d \n", i, rc); error = FIPS_HashToFipsError(hash_data->hash_mode); break; - } + } /* compare actual mac result to expected */ if (memcmp(virt_ctx->mac_res, hash_data->mac_res, digest_size) != 0) @@ -773,7 +773,7 @@ ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, error = FIPS_HashToFipsError(hash_data->hash_mode); break; - } + } } return error; @@ -1317,9 +1317,9 @@ ssi_ccm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, if (memcmp(virt_ctx->dout, ccmData->dataOut, ccmData->dataInSize) != 0) { FIPS_LOG("dout comparison error %d - size=%d \n", i, ccmData->dataInSize); - error = CC_REE_FIPS_ERROR_AESCCM_PUT; + error = CC_REE_FIPS_ERROR_AESCCM_PUT; break; - } + } /* compare actual mac result to expected */ if (memcmp(virt_ctx->mac_res, ccmData->macResOut, ccmData->tagSize) != 0) diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index 8076c771f750..d6c994a2362c 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -264,32 +264,32 @@ int ssi_fips_set_state(ssi_fips_state_t state) int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err) { int rc = 0; - ssi_fips_error_t current_err; + ssi_fips_error_t current_err; - FIPS_LOG("ssi_fips_set_error - fips_error = %d \n", err); + FIPS_LOG("ssi_fips_set_error - fips_error = %d \n", err); // setting no error is not allowed if (err == CC_REE_FIPS_ERROR_OK) { - return -ENOEXEC; + return -ENOEXEC; + } + // If error exists, do not set new error + if (ssi_fips_get_error(¤t_err) != 0) { + return -ENOEXEC; } - // If error exists, do not set new error - if (ssi_fips_get_error(¤t_err) != 0) { - return -ENOEXEC; - } - if (current_err != CC_REE_FIPS_ERROR_OK) { - return -ENOEXEC; - } - // set REE internal error and state + if (current_err != CC_REE_FIPS_ERROR_OK) { + return -ENOEXEC; + } + // set REE internal error and state rc = ssi_fips_ext_set_error(err); if (rc != 0) { - return -ENOEXEC; + return -ENOEXEC; } rc = ssi_fips_ext_set_state(CC_FIPS_STATE_ERROR); if (rc != 0) { - return -ENOEXEC; + return -ENOEXEC; } - // push error towards TEE libraray, if it's not TEE error + // push error towards TEE libraray, if it's not TEE error if (err != CC_REE_FIPS_ERROR_FROM_TEE) { ssi_fips_update_tee_upon_ree_status(p_drvdata, err); } diff --git a/drivers/staging/ccree/ssi_fips_local.h b/drivers/staging/ccree/ssi_fips_local.h index 038dd3b24903..ac1ab967def5 100644 --- a/drivers/staging/ccree/ssi_fips_local.h +++ b/drivers/staging/ccree/ssi_fips_local.h @@ -34,14 +34,14 @@ typedef enum CC_FipsSyncStatus{ #define CHECK_AND_RETURN_UPON_FIPS_ERROR() {\ - if (ssi_fips_check_fips_error() != 0) {\ - return -ENOEXEC;\ - }\ + if (ssi_fips_check_fips_error() != 0) {\ + return -ENOEXEC;\ + }\ } #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR() {\ - if (ssi_fips_check_fips_error() != 0) {\ - return;\ - }\ + if (ssi_fips_check_fips_error() != 0) {\ + return;\ + }\ } #define SSI_FIPS_INIT(p_drvData) (ssi_fips_init(p_drvData)) #define SSI_FIPS_FINI(p_drvData) (ssi_fips_fini(p_drvData)) -- cgit v1.2.3-55-g7522 From d4f3d4b150cee6aad5d11d121189cb7e68b1bff1 Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Sun, 18 Jun 2017 17:58:02 +0100 Subject: staging: ccree: removed spaces after opening parentheses. Removed spaces after opening parentheses in ssi_ivgen.c. Signed-off-by: Jeremy Sowden Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_ivgen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index cd606ab6cd53..88f208017323 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -64,7 +64,7 @@ static int ssi_ivgen_generate_pool( { unsigned int idx = *iv_seq_len; - if ( (*iv_seq_len + SSI_IVPOOL_GEN_SEQ_LEN) > SSI_IVPOOL_SEQ_LEN) { + if ((*iv_seq_len + SSI_IVPOOL_GEN_SEQ_LEN) > SSI_IVPOOL_SEQ_LEN) { /* The sequence will be longer than allowed */ return -EINVAL; } @@ -251,13 +251,13 @@ int ssi_ivgen_getiv( (iv_out_size != CTR_RFC3686_IV_SIZE)) { return -EINVAL; } - if ( (iv_out_dma_len + 1) > SSI_IVPOOL_SEQ_LEN) { + if ((iv_out_dma_len + 1) > SSI_IVPOOL_SEQ_LEN) { /* The sequence will be longer than allowed */ return -EINVAL; } //check that number of generated IV is limited to max dma address iv buffer size - if ( iv_out_dma_len > SSI_MAX_IVGEN_DMA_ADDRESSES) { + if (iv_out_dma_len > SSI_MAX_IVGEN_DMA_ADDRESSES) { /* The sequence will be longer than allowed */ return -EINVAL; } -- cgit v1.2.3-55-g7522 From 3c1746edd12d4e3279b47a9fb8dc0eedc77d679d Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Tue, 20 Jun 2017 17:11:48 +0200 Subject: staging: most: net: remove redundant traces This removes redundant netdev_info/pr_info. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index a2e37511341a..86353836470c 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -180,8 +180,6 @@ static int most_nd_open(struct net_device *dev) { struct net_dev_context *nd = netdev_priv(dev); - netdev_info(dev, "open net device\n"); - BUG_ON(!nd->tx.linked || !nd->rx.linked); if (most_start_channel(nd->iface, nd->rx.ch_id, &aim)) { @@ -210,8 +208,6 @@ static int most_nd_stop(struct net_device *dev) { struct net_dev_context *nd = netdev_priv(dev); - netdev_info(dev, "stop net device\n"); - netif_stop_queue(dev); if (nd->iface->request_netinfo) nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, NULL); @@ -463,14 +459,12 @@ static struct most_aim aim = { static int __init most_net_init(void) { - pr_info("most_net_init()\n"); spin_lock_init(&list_lock); return most_register_aim(&aim); } static void __exit most_net_exit(void) { - pr_info("most_net_exit()\n"); most_deregister_aim(&aim); } -- cgit v1.2.3-55-g7522 From 606c21759774a6694d4219d5bb96704ab13e20a0 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Tue, 20 Jun 2017 17:11:49 +0200 Subject: staging: most: net: make net device lifetime obvious The function aim_probe_channel calls only one of the functions alloc_netdev and register_netdev per run. Correspondingly, the function aim_disconnect_channel calls only one of the functions unregister_netdev and free_netdev per run. This patch makes it obvious by using the 'else' part of the 'if' statement. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 47 ++++++++++++++------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index 86353836470c..750652de90a8 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -287,6 +287,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, { struct net_dev_context *nd; struct net_dev_channel *ch; + struct net_device *dev; unsigned long flags; if (!iface) @@ -298,8 +299,6 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, nd = get_net_dev_context(iface); if (!nd) { - struct net_device *dev; - dev = alloc_netdev(sizeof(struct net_dev_context), "meth%d", NET_NAME_UNKNOWN, most_nd_setup); if (!dev) @@ -312,20 +311,24 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, spin_lock_irqsave(&list_lock, flags); list_add(&nd->list, &net_devices); spin_unlock_irqrestore(&list_lock, flags); - } - ch = ccfg->direction == MOST_CH_TX ? &nd->tx : &nd->rx; - if (ch->linked) { - pr_err("only one channel per instance & direction allowed\n"); - return -EINVAL; - } + ch = ccfg->direction == MOST_CH_TX ? &nd->tx : &nd->rx; + ch->ch_id = channel_idx; + ch->linked = true; + } else { + ch = ccfg->direction == MOST_CH_TX ? &nd->tx : &nd->rx; + if (ch->linked) { + pr_err("direction is allocated\n"); + return -EINVAL; + } - ch->ch_id = channel_idx; - ch->linked = true; - if (nd->tx.linked && nd->rx.linked && register_netdev(nd->dev)) { - pr_err("register_netdev() failed\n"); - ch->linked = false; - return -EINVAL; + ch->ch_id = channel_idx; + ch->linked = true; + if (register_netdev(nd->dev)) { + pr_err("register_netdev() failed\n"); + ch->linked = false; + return -EINVAL; + } } return 0; @@ -349,18 +352,18 @@ static int aim_disconnect_channel(struct most_interface *iface, else return -EINVAL; - /* - * do not call most_stop_channel() here, because channels are - * going to be closed in ndo_stop() after unregister_netdev() - */ - if (nd->rx.linked && nd->tx.linked) + if (nd->rx.linked && nd->tx.linked) { + /* + * do not call most_stop_channel() here, because channels are + * going to be closed in ndo_stop() after unregister_netdev() + */ unregister_netdev(nd->dev); - - ch->linked = false; - if (!nd->rx.linked && !nd->tx.linked) { + ch->linked = false; + } else { spin_lock_irqsave(&list_lock, flags); list_del(&nd->list); spin_unlock_irqrestore(&list_lock, flags); + free_netdev(nd->dev); } -- cgit v1.2.3-55-g7522 From 2338652c3346df68f5b95a42d41e021e2977ddf0 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Tue, 20 Jun 2017 17:11:50 +0200 Subject: staging: most: net: protect consistency of the state This introduces the mutex that protects the consistency between the tx.linked, rx.linked and the presence of the net divice. Additionally, this patch optimizes the setup of the ch->linked in the function aim_probe_channel. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 64 ++++++++++++++++++--------- 1 file changed, 42 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index 750652de90a8..217265cbf03b 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -72,6 +72,7 @@ struct net_dev_context { }; static struct list_head net_devices = LIST_HEAD_INIT(net_devices); +static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */ static struct spinlock list_lock; static struct most_aim aim; @@ -179,18 +180,21 @@ static void on_netinfo(struct most_interface *iface, static int most_nd_open(struct net_device *dev) { struct net_dev_context *nd = netdev_priv(dev); + int ret = 0; - BUG_ON(!nd->tx.linked || !nd->rx.linked); + mutex_lock(&probe_disc_mt); if (most_start_channel(nd->iface, nd->rx.ch_id, &aim)) { netdev_err(dev, "most_start_channel() failed\n"); - return -EBUSY; + ret = -EBUSY; + goto unlock; } if (most_start_channel(nd->iface, nd->tx.ch_id, &aim)) { netdev_err(dev, "most_start_channel() failed\n"); most_stop_channel(nd->iface, nd->rx.ch_id, &aim); - return -EBUSY; + ret = -EBUSY; + goto unlock; } netif_carrier_off(dev); @@ -201,7 +205,10 @@ static int most_nd_open(struct net_device *dev) netif_wake_queue(dev); if (nd->iface->request_netinfo) nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, on_netinfo); - return 0; + +unlock: + mutex_unlock(&probe_disc_mt); + return ret; } static int most_nd_stop(struct net_device *dev) @@ -289,6 +296,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, struct net_dev_channel *ch; struct net_device *dev; unsigned long flags; + int ret = 0; if (!iface) return -EINVAL; @@ -296,13 +304,15 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, if (ccfg->data_type != MOST_CH_ASYNC) return -EINVAL; + mutex_lock(&probe_disc_mt); nd = get_net_dev_context(iface); - if (!nd) { dev = alloc_netdev(sizeof(struct net_dev_context), "meth%d", NET_NAME_UNKNOWN, most_nd_setup); - if (!dev) - return -ENOMEM; + if (!dev) { + ret = -ENOMEM; + goto unlock; + } nd = netdev_priv(dev); nd->iface = iface; @@ -313,25 +323,26 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, spin_unlock_irqrestore(&list_lock, flags); ch = ccfg->direction == MOST_CH_TX ? &nd->tx : &nd->rx; - ch->ch_id = channel_idx; - ch->linked = true; } else { ch = ccfg->direction == MOST_CH_TX ? &nd->tx : &nd->rx; if (ch->linked) { pr_err("direction is allocated\n"); - return -EINVAL; + ret = -EINVAL; + goto unlock; } - ch->ch_id = channel_idx; - ch->linked = true; if (register_netdev(nd->dev)) { pr_err("register_netdev() failed\n"); - ch->linked = false; - return -EINVAL; + ret = -EINVAL; + goto unlock; } } + ch->ch_id = channel_idx; + ch->linked = true; - return 0; +unlock: + mutex_unlock(&probe_disc_mt); + return ret; } static int aim_disconnect_channel(struct most_interface *iface, @@ -340,17 +351,23 @@ static int aim_disconnect_channel(struct most_interface *iface, struct net_dev_context *nd; struct net_dev_channel *ch; unsigned long flags; + int ret = 0; + mutex_lock(&probe_disc_mt); nd = get_net_dev_context(iface); - if (!nd) - return -EINVAL; + if (!nd) { + ret = -EINVAL; + goto unlock; + } - if (nd->rx.linked && channel_idx == nd->rx.ch_id) + if (nd->rx.linked && channel_idx == nd->rx.ch_id) { ch = &nd->rx; - else if (nd->tx.linked && channel_idx == nd->tx.ch_id) + } else if (nd->tx.linked && channel_idx == nd->tx.ch_id) { ch = &nd->tx; - else - return -EINVAL; + } else { + ret = -EINVAL; + goto unlock; + } if (nd->rx.linked && nd->tx.linked) { /* @@ -367,7 +384,9 @@ static int aim_disconnect_channel(struct most_interface *iface, free_netdev(nd->dev); } - return 0; +unlock: + mutex_unlock(&probe_disc_mt); + return ret; } static int aim_resume_tx_channel(struct most_interface *iface, @@ -463,6 +482,7 @@ static struct most_aim aim = { static int __init most_net_init(void) { spin_lock_init(&list_lock); + mutex_init(&probe_disc_mt); return most_register_aim(&aim); } -- cgit v1.2.3-55-g7522 From 4271eabb487d72d7818e273a6dbf44bfb4253a44 Mon Sep 17 00:00:00 2001 From: Andrey Shvetsov Date: Tue, 20 Jun 2017 17:11:51 +0200 Subject: staging: most: net: hold used net device This adds the dev_hold and dev_put calls to the functions aim_resume_tx_channel, aim_rx_data and on_netinfo to postpone the unregistration of the used net device. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 78 +++++++++++++++++++-------- 1 file changed, 55 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index 217265cbf03b..4c259c20048f 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -73,7 +73,7 @@ struct net_dev_context { static struct list_head net_devices = LIST_HEAD_INIT(net_devices); static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */ -static struct spinlock list_lock; +static struct spinlock list_lock; /* list_head, ch->linked = false, dev_hold */ static struct most_aim aim; static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo) @@ -271,21 +271,29 @@ static void most_nd_setup(struct net_device *dev) dev->netdev_ops = &most_nd_ops; } -static struct net_dev_context *get_net_dev_context( - struct most_interface *iface) +static struct net_dev_context *get_net_dev(struct most_interface *iface) +{ + struct net_dev_context *nd; + + list_for_each_entry(nd, &net_devices, list) + if (nd->iface == iface) + return nd; + return NULL; +} + +static struct net_dev_context *get_net_dev_hold(struct most_interface *iface) { struct net_dev_context *nd; unsigned long flags; spin_lock_irqsave(&list_lock, flags); - list_for_each_entry(nd, &net_devices, list) { - if (nd->iface == iface) { - spin_unlock_irqrestore(&list_lock, flags); - return nd; - } - } + nd = get_net_dev(iface); + if (nd && nd->rx.linked && nd->tx.linked) + dev_hold(nd->dev); + else + nd = NULL; spin_unlock_irqrestore(&list_lock, flags); - return NULL; + return nd; } static int aim_probe_channel(struct most_interface *iface, int channel_idx, @@ -305,7 +313,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, return -EINVAL; mutex_lock(&probe_disc_mt); - nd = get_net_dev_context(iface); + nd = get_net_dev(iface); if (!nd) { dev = alloc_netdev(sizeof(struct net_dev_context), "meth%d", NET_NAME_UNKNOWN, most_nd_setup); @@ -354,7 +362,7 @@ static int aim_disconnect_channel(struct most_interface *iface, int ret = 0; mutex_lock(&probe_disc_mt); - nd = get_net_dev_context(iface); + nd = get_net_dev(iface); if (!nd) { ret = -EINVAL; goto unlock; @@ -370,12 +378,15 @@ static int aim_disconnect_channel(struct most_interface *iface, } if (nd->rx.linked && nd->tx.linked) { + spin_lock_irqsave(&list_lock, flags); + ch->linked = false; + spin_unlock_irqrestore(&list_lock, flags); + /* * do not call most_stop_channel() here, because channels are * going to be closed in ndo_stop() after unregister_netdev() */ unregister_netdev(nd->dev); - ch->linked = false; } else { spin_lock_irqsave(&list_lock, flags); list_del(&nd->list); @@ -394,11 +405,17 @@ static int aim_resume_tx_channel(struct most_interface *iface, { struct net_dev_context *nd; - nd = get_net_dev_context(iface); - if (!nd || nd->tx.ch_id != channel_idx) + nd = get_net_dev_hold(iface); + if (!nd) return 0; + if (nd->tx.ch_id != channel_idx) + goto put_nd; + netif_wake_queue(nd->dev); + +put_nd: + dev_put(nd->dev); return 0; } @@ -411,21 +428,31 @@ static int aim_rx_data(struct mbo *mbo) struct sk_buff *skb; struct net_device *dev; unsigned int skb_len; + int ret = 0; - nd = get_net_dev_context(mbo->ifp); - if (!nd || nd->rx.ch_id != mbo->hdm_channel_id) + nd = get_net_dev_hold(mbo->ifp); + if (!nd) return -EIO; + if (nd->rx.ch_id != mbo->hdm_channel_id) { + ret = -EIO; + goto put_nd; + } + dev = nd->dev; if (nd->is_mamac) { - if (!PMS_IS_MAMAC(buf, len)) - return -EIO; + if (!PMS_IS_MAMAC(buf, len)) { + ret = -EIO; + goto put_nd; + } skb = dev_alloc_skb(len - MDP_HDR_LEN + 2 * ETH_ALEN + 2); } else { - if (!PMS_IS_MEP(buf, len)) - return -EIO; + if (!PMS_IS_MEP(buf, len)) { + ret = -EIO; + goto put_nd; + } skb = dev_alloc_skb(len - MEP_HDR_LEN); } @@ -468,7 +495,10 @@ static int aim_rx_data(struct mbo *mbo) out: most_put_mbo(mbo); - return 0; + +put_nd: + dev_put(nd->dev); + return ret; } static struct most_aim aim = { @@ -504,7 +534,7 @@ static void on_netinfo(struct most_interface *iface, struct net_device *dev; const u8 *m = mac_addr; - nd = get_net_dev_context(iface); + nd = get_net_dev_hold(iface); if (!nd) return; @@ -526,6 +556,8 @@ static void on_netinfo(struct most_interface *iface, m[0], m[1], m[2], m[3], m[4], m[5]); } } + + dev_put(nd->dev); } module_init(most_net_init); -- cgit v1.2.3-55-g7522 From af8d0d97d6071babe4565bedfec97ea3d92e7663 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 14 Jun 2017 20:08:24 +0100 Subject: staging: rtl8192e: remove dead private call to _rtl92e_ioctl. A RTL_IOCTL_WPA_SUPPLICANT call is a proprietary version of wpa supplicant. All kernel calls use SIOCSIWENCODEEXT call via wireless handlers already used in this driver. Remove dead code. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 126 --------------------------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 - 2 files changed, 128 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index a4d1bac4a844..aca52654825b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2275,131 +2275,6 @@ static int _rtl92e_set_mac_adr(struct net_device *dev, void *mac) return 0; } -/* based on ipw2200 driver */ -static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - struct r8192_priv *priv = rtllib_priv(dev); - struct iwreq *wrq = (struct iwreq *)rq; - int ret = -1; - struct rtllib_device *ieee = priv->rtllib; - u32 key[4]; - const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - struct iw_point *p = &wrq->u.data; - struct ieee_param *ipw = NULL; - - mutex_lock(&priv->wx_mutex); - - switch (cmd) { - case RTL_IOCTL_WPA_SUPPLICANT: - if (p->length < sizeof(struct ieee_param) || !p->pointer) { - ret = -EINVAL; - goto out; - } - - ipw = memdup_user(p->pointer, p->length); - if (IS_ERR(ipw)) { - ret = PTR_ERR(ipw); - goto out; - } - - if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) { - if (ipw->u.crypt.set_tx) { - if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) - ieee->pairwise_key_type = KEY_TYPE_CCMP; - else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) - ieee->pairwise_key_type = KEY_TYPE_TKIP; - else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) { - if (ipw->u.crypt.key_len == 13) - ieee->pairwise_key_type = - KEY_TYPE_WEP104; - else if (ipw->u.crypt.key_len == 5) - ieee->pairwise_key_type = - KEY_TYPE_WEP40; - } else { - ieee->pairwise_key_type = KEY_TYPE_NA; - } - - if (ieee->pairwise_key_type) { - if (is_zero_ether_addr(ieee->ap_mac_addr)) - ieee->iw_mode = IW_MODE_ADHOC; - memcpy((u8 *)key, ipw->u.crypt.key, 16); - rtl92e_enable_hw_security_config(dev); - rtl92e_set_swcam(dev, 4, - ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key, 0); - rtl92e_set_key(dev, 4, ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key); - if (ieee->iw_mode == IW_MODE_ADHOC) { - rtl92e_set_swcam(dev, - ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key, 0); - rtl92e_set_key(dev, - ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key); - } - } - if ((ieee->pairwise_key_type == - KEY_TYPE_CCMP) && - ieee->pHTInfo->bCurrentHTSupport) { - rtl92e_writeb(dev, 0x173, 1); - } - - } else { - memcpy((u8 *)key, ipw->u.crypt.key, 16); - if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) - ieee->group_key_type = KEY_TYPE_CCMP; - else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) - ieee->group_key_type = KEY_TYPE_TKIP; - else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) { - if (ipw->u.crypt.key_len == 13) - ieee->group_key_type = - KEY_TYPE_WEP104; - else if (ipw->u.crypt.key_len == 5) - ieee->group_key_type = - KEY_TYPE_WEP40; - } else - ieee->group_key_type = KEY_TYPE_NA; - - if (ieee->group_key_type) { - rtl92e_set_swcam(dev, ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->group_key_type, - broadcast_addr, 0, key, - 0); - rtl92e_set_key(dev, ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->group_key_type, - broadcast_addr, 0, key); - } - } - } - - ret = rtllib_wpa_supplicant_ioctl(priv->rtllib, &wrq->u.data, - 0); - kfree(ipw); - break; - default: - ret = -EOPNOTSUPP; - break; - } - -out: - mutex_unlock(&priv->wx_mutex); - - return ret; -} - - static irqreturn_t _rtl92e_irq(int irq, void *netdev) { struct net_device *dev = netdev; @@ -2542,7 +2417,6 @@ static const struct net_device_ops rtl8192_netdev_ops = { .ndo_open = _rtl92e_open, .ndo_stop = _rtl92e_close, .ndo_tx_timeout = _rtl92e_tx_timeout, - .ndo_do_ioctl = _rtl92e_ioctl, .ndo_set_rx_mode = _rtl92e_set_multicast, .ndo_set_mac_address = _rtl92e_set_mac_adr, .ndo_validate_addr = eth_validate_addr, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 0335823e2766..9d3089cb6a5a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -102,8 +102,6 @@ #define PHY_RSSI_SLID_WIN_MAX 100 -#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) - #define TxBBGainTableLength 37 #define CCKTxBBGainTableLength 23 -- cgit v1.2.3-55-g7522 From f0836fd2a683bafbf738672e429221e4e9a3d7a6 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 14 Jun 2017 20:08:25 +0100 Subject: staging: rtl8192e: remove dead code rtllib_wpa_supplicant_ioctl Following removal of _rtl92e_ioctl this function along with associated macros, structure ieee_param and functions become dead code. Remove functions rtllib_wpa_enable, rtllib_wpa_assoc_frame, rtllib_wpa_mlme, rtllib_wpa_set_wpa_ie, rtllib_wpa_set_auth_algs, rtllib_wpa_set_param, rtllib_wpa_set_encryption and rtllib_wpa_supplicant_ioctl. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 54 ----- drivers/staging/rtl8192e/rtllib_softmac.c | 383 ------------------------------ 2 files changed, 437 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 827651b62791..0042a0f6cf79 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -335,60 +335,8 @@ enum rt_op_mode { #define MGMT_QUEUE_NUM 5 -#define IEEE_CMD_SET_WPA_PARAM 1 -#define IEEE_CMD_SET_WPA_IE 2 -#define IEEE_CMD_SET_ENCRYPTION 3 -#define IEEE_CMD_MLME 4 - -#define IEEE_PARAM_WPA_ENABLED 1 -#define IEEE_PARAM_TKIP_COUNTERMEASURES 2 -#define IEEE_PARAM_DROP_UNENCRYPTED 3 -#define IEEE_PARAM_PRIVACY_INVOKED 4 -#define IEEE_PARAM_AUTH_ALGS 5 -#define IEEE_PARAM_IEEE_802_1X 6 -#define IEEE_PARAM_WPAX_SELECT 7 - -#define IEEE_MLME_STA_DEAUTH 1 -#define IEEE_MLME_STA_DISASSOC 2 - - -#define IEEE_CRYPT_ERR_UNKNOWN_ALG 2 -#define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4 -#define IEEE_CRYPT_ERR_KEY_SET_FAILED 5 -#define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7 -#define IEEE_CRYPT_ALG_NAME_LEN 16 - #define MAX_IE_LEN 0xff -struct ieee_param { - u32 cmd; - u8 sta_addr[ETH_ALEN]; - union { - struct { - u8 name; - u32 value; - } wpa_param; - struct { - u32 len; - u8 reserved[32]; - u8 data[0]; - } wpa_ie; - struct { - int command; - int reason_code; - } mlme; - struct { - u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; - u8 set_tx; - u32 err; - u8 idx; - u8 seq[8]; /* sequence counter (set: RX, get: TX) */ - u16 key_len; - u8 key[0]; - } crypt; - } u; -}; - #define msleep_interruptible_rsl msleep_interruptible /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section @@ -2066,8 +2014,6 @@ void rtllib_stop_all_queues(struct rtllib_device *ieee); struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee); void rtllib_start_send_beacons(struct rtllib_device *ieee); void rtllib_stop_send_beacons(struct rtllib_device *ieee); -int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, - struct iw_point *p, u8 is_mesh); void notify_wx_assoc_event(struct rtllib_device *ieee); void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success); diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 776e99741431..f629e99956b7 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -3077,333 +3077,6 @@ void rtllib_softmac_free(struct rtllib_device *ieee) tasklet_kill(&ieee->ps_task); } -/******************************************************** - * Start of WPA code. * - * this is stolen from the ipw2200 driver * - ********************************************************/ - - -static int rtllib_wpa_enable(struct rtllib_device *ieee, int value) -{ - /* This is called when wpa_supplicant loads and closes the driver - * interface. - */ - netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling"); - ieee->wpa_enabled = value; - eth_zero_addr(ieee->ap_mac_addr); - return 0; -} - - -static void rtllib_wpa_assoc_frame(struct rtllib_device *ieee, char *wpa_ie, - int wpa_ie_len) -{ - /* make sure WPA is enabled */ - rtllib_wpa_enable(ieee, 1); - - rtllib_disassociate(ieee); -} - - -static int rtllib_wpa_mlme(struct rtllib_device *ieee, int command, int reason) -{ - - int ret = 0; - - switch (command) { - case IEEE_MLME_STA_DEAUTH: - break; - - case IEEE_MLME_STA_DISASSOC: - rtllib_disassociate(ieee); - break; - - default: - netdev_info(ieee->dev, "Unknown MLME request: %d\n", command); - ret = -EOPNOTSUPP; - } - - return ret; -} - - -static int rtllib_wpa_set_wpa_ie(struct rtllib_device *ieee, - struct ieee_param *param, int plen) -{ - u8 *buf; - - if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || - (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) - return -EINVAL; - - if (param->u.wpa_ie.len) { - buf = kmemdup(param->u.wpa_ie.data, param->u.wpa_ie.len, - GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - kfree(ieee->wpa_ie); - ieee->wpa_ie = buf; - ieee->wpa_ie_len = param->u.wpa_ie.len; - } else { - kfree(ieee->wpa_ie); - ieee->wpa_ie = NULL; - ieee->wpa_ie_len = 0; - } - - rtllib_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len); - return 0; -} - -#define AUTH_ALG_OPEN_SYSTEM 0x1 -#define AUTH_ALG_SHARED_KEY 0x2 -#define AUTH_ALG_LEAP 0x4 -static int rtllib_wpa_set_auth_algs(struct rtllib_device *ieee, int value) -{ - - struct rtllib_security sec = { - .flags = SEC_AUTH_MODE, - }; - - if (value & AUTH_ALG_SHARED_KEY) { - sec.auth_mode = WLAN_AUTH_SHARED_KEY; - ieee->open_wep = 0; - ieee->auth_mode = 1; - } else if (value & AUTH_ALG_OPEN_SYSTEM) { - sec.auth_mode = WLAN_AUTH_OPEN; - ieee->open_wep = 1; - ieee->auth_mode = 0; - } else if (value & AUTH_ALG_LEAP) { - sec.auth_mode = WLAN_AUTH_LEAP >> 6; - ieee->open_wep = 1; - ieee->auth_mode = 2; - } - - - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - - return 0; -} - -static int rtllib_wpa_set_param(struct rtllib_device *ieee, u8 name, u32 value) -{ - int ret = 0; - unsigned long flags; - - switch (name) { - case IEEE_PARAM_WPA_ENABLED: - ret = rtllib_wpa_enable(ieee, value); - break; - - case IEEE_PARAM_TKIP_COUNTERMEASURES: - ieee->tkip_countermeasures = value; - break; - - case IEEE_PARAM_DROP_UNENCRYPTED: - { - /* HACK: - * - * wpa_supplicant calls set_wpa_enabled when the driver - * is loaded and unloaded, regardless of if WPA is being - * used. No other calls are made which can be used to - * determine if encryption will be used or not prior to - * association being expected. If encryption is not being - * used, drop_unencrypted is set to false, else true -- we - * can use this to determine if the CAP_PRIVACY_ON bit should - * be set. - */ - struct rtllib_security sec = { - .flags = SEC_ENABLED, - .enabled = value, - }; - ieee->drop_unencrypted = value; - /* We only change SEC_LEVEL for open mode. Others - * are set by ipw_wpa_set_encryption. - */ - if (!value) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_0; - } else { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - break; - } - - case IEEE_PARAM_PRIVACY_INVOKED: - ieee->privacy_invoked = value; - break; - - case IEEE_PARAM_AUTH_ALGS: - ret = rtllib_wpa_set_auth_algs(ieee, value); - break; - - case IEEE_PARAM_IEEE_802_1X: - ieee->ieee802_1x = value; - break; - case IEEE_PARAM_WPAX_SELECT: - spin_lock_irqsave(&ieee->wpax_suitlist_lock, flags); - spin_unlock_irqrestore(&ieee->wpax_suitlist_lock, flags); - break; - - default: - netdev_info(ieee->dev, "Unknown WPA param: %d\n", name); - ret = -EOPNOTSUPP; - } - - return ret; -} - -/* implementation borrowed from hostap driver */ -static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, - struct ieee_param *param, int param_len, - u8 is_mesh) -{ - int ret = 0; - struct lib80211_crypto_ops *ops; - struct lib80211_crypt_data **crypt; - - struct rtllib_security sec = { - .flags = 0, - }; - - param->u.crypt.err = 0; - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - if (param_len != - (int) ((char *) param->u.crypt.key - (char *) param) + - param->u.crypt.key_len) { - netdev_info(ieee->dev, "Len mismatch %d, %d\n", param_len, - param->u.crypt.key_len); - return -EINVAL; - } - if (is_broadcast_ether_addr(param->sta_addr)) { - if (param->u.crypt.idx >= NUM_WEP_KEYS) - return -EINVAL; - crypt = &ieee->crypt_info.crypt[param->u.crypt.idx]; - } else { - return -EINVAL; - } - - if (strcmp(param->u.crypt.alg, "none") == 0) { - if (crypt) { - sec.enabled = 0; - sec.level = SEC_LEVEL_0; - sec.flags |= SEC_ENABLED | SEC_LEVEL; - lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - } - goto done; - } - sec.enabled = 1; - sec.flags |= SEC_ENABLED; - - /* IPW HW cannot build TKIP MIC, host decryption still needed. */ - if (!(ieee->host_encrypt || ieee->host_decrypt) && - strcmp(param->u.crypt.alg, "R-TKIP")) - goto skip_host_crypt; - - ops = lib80211_get_crypto_ops(param->u.crypt.alg); - if (ops == NULL && strcmp(param->u.crypt.alg, "R-WEP") == 0) { - request_module("rtllib_crypt_wep"); - ops = lib80211_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "R-TKIP") == 0) { - request_module("rtllib_crypt_tkip"); - ops = lib80211_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "R-CCMP") == 0) { - request_module("rtllib_crypt_ccmp"); - ops = lib80211_get_crypto_ops(param->u.crypt.alg); - } - if (ops == NULL) { - netdev_info(ieee->dev, "unknown crypto alg '%s'\n", - param->u.crypt.alg); - param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; - ret = -EINVAL; - goto done; - } - if (*crypt == NULL || (*crypt)->ops != ops) { - struct lib80211_crypt_data *new_crypt; - - lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - - new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); - if (new_crypt == NULL) { - ret = -ENOMEM; - goto done; - } - new_crypt->ops = ops; - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = - new_crypt->ops->init(param->u.crypt.idx); - - if (new_crypt->priv == NULL) { - kfree(new_crypt); - param->u.crypt.err = IEEE_CRYPT_ERR_CRYPT_INIT_FAILED; - ret = -EINVAL; - goto done; - } - - *crypt = new_crypt; - } - - if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && - (*crypt)->ops->set_key(param->u.crypt.key, - param->u.crypt.key_len, param->u.crypt.seq, - (*crypt)->priv) < 0) { - netdev_info(ieee->dev, "key setting failed\n"); - param->u.crypt.err = IEEE_CRYPT_ERR_KEY_SET_FAILED; - ret = -EINVAL; - goto done; - } - - skip_host_crypt: - if (param->u.crypt.set_tx) { - ieee->crypt_info.tx_keyidx = param->u.crypt.idx; - sec.active_key = param->u.crypt.idx; - sec.flags |= SEC_ACTIVE_KEY; - } else - sec.flags &= ~SEC_ACTIVE_KEY; - - memcpy(sec.keys[param->u.crypt.idx], - param->u.crypt.key, - param->u.crypt.key_len); - sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; - sec.flags |= (1 << param->u.crypt.idx); - - if (strcmp(param->u.crypt.alg, "R-WEP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } else if (strcmp(param->u.crypt.alg, "R-TKIP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_2; - } else if (strcmp(param->u.crypt.alg, "R-CCMP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_3; - } - done: - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - - /* Do not reset port if card is in Managed mode since resetting will - * generate new IEEE 802.11 authentication which may end up in looping - * with IEEE 802.1X. If your hardware requires a reset after WEP - * configuration (for example... Prism2), implement the reset_port in - * the callbacks structures used to initialize the 802.11 stack. - */ - if (ieee->reset_on_keychange && - ieee->iw_mode != IW_MODE_INFRA && - ieee->reset_port && - ieee->reset_port(ieee->dev)) { - netdev_info(ieee->dev, "reset_port failed\n"); - param->u.crypt.err = IEEE_CRYPT_ERR_CARD_CONF_FAILED; - return -EINVAL; - } - - return ret; -} - static inline struct sk_buff * rtllib_disauth_skb(struct rtllib_network *beacon, struct rtllib_device *ieee, u16 asRsn) @@ -3502,62 +3175,6 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee) } } -int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, struct iw_point *p, - u8 is_mesh) -{ - struct ieee_param *param; - int ret = 0; - - mutex_lock(&ieee->wx_mutex); - - if (p->length < sizeof(struct ieee_param) || !p->pointer) { - ret = -EINVAL; - goto out; - } - - param = memdup_user(p->pointer, p->length); - if (IS_ERR(param)) { - ret = PTR_ERR(param); - goto out; - } - - switch (param->cmd) { - case IEEE_CMD_SET_WPA_PARAM: - ret = rtllib_wpa_set_param(ieee, param->u.wpa_param.name, - param->u.wpa_param.value); - break; - - case IEEE_CMD_SET_WPA_IE: - ret = rtllib_wpa_set_wpa_ie(ieee, param, p->length); - break; - - case IEEE_CMD_SET_ENCRYPTION: - ret = rtllib_wpa_set_encryption(ieee, param, p->length, 0); - break; - - case IEEE_CMD_MLME: - ret = rtllib_wpa_mlme(ieee, param->u.mlme.command, - param->u.mlme.reason_code); - break; - - default: - netdev_info(ieee->dev, "Unknown WPA supplicant request: %d\n", - param->cmd); - ret = -EOPNOTSUPP; - break; - } - - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) - ret = -EFAULT; - - kfree(param); -out: - mutex_unlock(&ieee->wx_mutex); - - return ret; -} -EXPORT_SYMBOL(rtllib_wpa_supplicant_ioctl); - static void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib) { u8 OpMode; -- cgit v1.2.3-55-g7522 From a9332e9ad09c2644c99058fcf6ae2f355e93ce74 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 16 Jun 2017 19:35:34 +0100 Subject: staging: comedi: fix clean-up of comedi_class in comedi_init() There is a clean-up bug in the core comedi module initialization functions, `comedi_init()`. If the `comedi_num_legacy_minors` module parameter is non-zero (and valid), it creates that many "legacy" devices and registers them in SysFS. A failure causes the function to clean up and return an error. Unfortunately, it fails to destroy the "comedi" class that was created earlier. Fix it by adding a call to `class_destroy(comedi_class)` at the appropriate place in the clean-up sequence. Signed-off-by: Ian Abbott Cc: # 3.9+ Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index f191c2a75732..4ed485a99c68 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2915,6 +2915,7 @@ static int __init comedi_init(void) dev = comedi_alloc_board_minor(NULL); if (IS_ERR(dev)) { comedi_cleanup_board_minors(); + class_destroy(comedi_class); cdev_del(&comedi_cdev); unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); -- cgit v1.2.3-55-g7522 From 125178d1ebd6d76a5fb152cfb3cd50a3316cf3ba Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 16 Jun 2017 19:35:35 +0100 Subject: staging: comedi: use centralized error clean-up in comedi_init() Centralize the "clean-up on error" handling in `comedi_init()` using `goto` statements. Also change some of the explicit `-EIO` return values to the error return values from the failing functions as there is no good reason to use `-EIO` explicitly. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 43 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 4ed485a99c68..ca11be21f64b 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2881,29 +2881,25 @@ static int __init comedi_init(void) retval = register_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS, "comedi"); if (retval) - return -EIO; + return retval; + cdev_init(&comedi_cdev, &comedi_fops); comedi_cdev.owner = THIS_MODULE; retval = kobject_set_name(&comedi_cdev.kobj, "comedi"); - if (retval) { - unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), - COMEDI_NUM_MINORS); - return retval; - } + if (retval) + goto out_unregister_chrdev_region; + + retval = cdev_add(&comedi_cdev, MKDEV(COMEDI_MAJOR, 0), + COMEDI_NUM_MINORS); + if (retval) + goto out_unregister_chrdev_region; - if (cdev_add(&comedi_cdev, MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS)) { - unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), - COMEDI_NUM_MINORS); - return -EIO; - } comedi_class = class_create(THIS_MODULE, "comedi"); if (IS_ERR(comedi_class)) { + retval = PTR_ERR(comedi_class); pr_err("failed to create class\n"); - cdev_del(&comedi_cdev); - unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), - COMEDI_NUM_MINORS); - return PTR_ERR(comedi_class); + goto out_cdev_del; } comedi_class->dev_groups = comedi_dev_groups; @@ -2914,12 +2910,8 @@ static int __init comedi_init(void) dev = comedi_alloc_board_minor(NULL); if (IS_ERR(dev)) { - comedi_cleanup_board_minors(); - class_destroy(comedi_class); - cdev_del(&comedi_cdev); - unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), - COMEDI_NUM_MINORS); - return PTR_ERR(dev); + retval = PTR_ERR(dev); + goto out_cleanup_board_minors; } /* comedi_alloc_board_minor() locked the mutex */ mutex_unlock(&dev->mutex); @@ -2929,6 +2921,15 @@ static int __init comedi_init(void) comedi_proc_init(); return 0; + +out_cleanup_board_minors: + comedi_cleanup_board_minors(); + class_destroy(comedi_class); +out_cdev_del: + cdev_del(&comedi_cdev); +out_unregister_chrdev_region: + unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); + return retval; } module_init(comedi_init); -- cgit v1.2.3-55-g7522 From 30c9dbf3174e75e8c721aa2c7d47bf8fcd40d8cb Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Thu, 15 Jun 2017 03:55:06 -0500 Subject: staging: fsl-mc/dpio: Propagate error code dpaa2_io_service_register() returns zero even if qbman_swp_CDAN_set() encountered an error. Fix this by propagating the error code so the caller is informed data availability notifications are not properly set for a channel. Signed-off-by: Ioana Radulescu Acked-by: Bogdan Purcareata Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c index 8c45f817c472..f8096828f5b7 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c @@ -260,9 +260,9 @@ int dpaa2_io_service_register(struct dpaa2_io *d, /* Enable the generation of CDAN notifications */ if (ctx->is_cdan) - qbman_swp_CDAN_set_context_enable(d->swp, - (u16)ctx->id, - ctx->qman64); + return qbman_swp_CDAN_set_context_enable(d->swp, + (u16)ctx->id, + ctx->qman64); return 0; } EXPORT_SYMBOL(dpaa2_io_service_register); -- cgit v1.2.3-55-g7522 From d2176b325f8a640d7adbf882f4e0f29767d04b8e Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 15:52:10 +0300 Subject: staging: fsl-dpaa2/eth: fix a couple of implicit includes dpni.c is using byte order macros and error codes but does not explicitly include the required kernel header, so add it. Signed-off-by: Laurentiu Tudor Acked-by: Ioana Radulescu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpni.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c index cea46edec6a2..2c4b1a89c2c1 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c @@ -30,6 +30,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include +#include #include "../../fsl-mc/include/mc-sys.h" #include "../../fsl-mc/include/mc-cmd.h" #include "dpni.h" -- cgit v1.2.3-55-g7522 From 410ab9b5f8a925ce082ddd001c4e73aab8b699de Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:47 +0300 Subject: staging: fsl-mc: drop macros with possible side effects Several macros were triggering this checkpatch.pl warning: "Macro argument reuse '$arg' - possible side-effects?" Fix the warning by turning them into real functions. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 15 +++++++++------ drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 18 ++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index d723c69a9151..80c080f20da1 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -21,15 +21,18 @@ #define FSL_MC_DPRC_DRIVER_NAME "fsl_mc_dprc" -#define FSL_MC_DEVICE_MATCH(_mc_dev, _obj_desc) \ - (strcmp((_mc_dev)->obj_desc.type, (_obj_desc)->type) == 0 && \ - (_mc_dev)->obj_desc.id == (_obj_desc)->id) - struct dprc_child_objs { int child_count; struct dprc_obj_desc *child_array; }; +static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, + struct dprc_obj_desc *obj_desc) +{ + return !strcmp(mc_dev->obj_desc.type, obj_desc->type) && + mc_dev->obj_desc.id == obj_desc->id; +} + static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) { int i; @@ -45,7 +48,7 @@ static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) struct dprc_obj_desc *obj_desc = &objs->child_array[i]; if (strlen(obj_desc->type) != 0 && - FSL_MC_DEVICE_MATCH(mc_dev, obj_desc)) + fsl_mc_device_match(mc_dev, obj_desc)) break; } @@ -105,7 +108,7 @@ static int __fsl_mc_device_match(struct device *dev, void *data) struct dprc_obj_desc *obj_desc = data; struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); - return FSL_MC_DEVICE_MATCH(mc_dev, obj_desc); + return fsl_mc_device_match(mc_dev, obj_desc); } static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index ce07096c3b1f..9291847b1d14 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -17,10 +17,12 @@ #include "dpcon-cmd.h" #include "fsl-mc-private.h" -#define FSL_MC_IS_ALLOCATABLE(_obj_type) \ - (strcmp(_obj_type, "dpbp") == 0 || \ - strcmp(_obj_type, "dpmcp") == 0 || \ - strcmp(_obj_type, "dpcon") == 0) +static bool __must_check fsl_mc_is_allocatable(const char *obj_type) +{ + return strcmp(obj_type, "dpbp") == 0 || + strcmp(obj_type, "dpmcp") == 0 || + strcmp(obj_type, "dpcon") == 0; +} /** * fsl_mc_resource_pool_add_device - add allocatable object to a resource @@ -44,7 +46,7 @@ static int __must_check fsl_mc_resource_pool_add_device(struct fsl_mc_bus if (WARN_ON(pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)) goto out; - if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type))) + if (WARN_ON(!fsl_mc_is_allocatable(mc_dev->obj_desc.type))) goto out; if (WARN_ON(mc_dev->resource)) goto out; @@ -106,7 +108,7 @@ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device struct fsl_mc_resource *resource; int error = -EINVAL; - if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type))) + if (WARN_ON(!fsl_mc_is_allocatable(mc_dev->obj_desc.type))) goto out; resource = mc_dev->resource; @@ -586,7 +588,7 @@ static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev) struct fsl_mc_bus *mc_bus; int error; - if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type))) + if (WARN_ON(!fsl_mc_is_allocatable(mc_dev->obj_desc.type))) return -EINVAL; mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); @@ -615,7 +617,7 @@ static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev) { int error; - if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type))) + if (WARN_ON(!fsl_mc_is_allocatable(mc_dev->obj_desc.type))) return -EINVAL; if (mc_dev->resource) { -- cgit v1.2.3-55-g7522 From bb4a64b79f3b9973316e775f6c2910a98b6a562a Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:48 +0300 Subject: staging: fsl-mc: drop useless #includes These couple of header files are not needed in the source so remove them. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index 9291847b1d14..c2af5b570222 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -13,8 +13,6 @@ #include "../include/mc-bus.h" #include "../include/mc-sys.h" -#include "dpbp-cmd.h" -#include "dpcon-cmd.h" #include "fsl-mc-private.h" static bool __must_check fsl_mc_is_allocatable(const char *obj_type) -- cgit v1.2.3-55-g7522 From c6ce019edb0c9c09b8150011d4f66181952631e9 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:49 +0300 Subject: staging: fsl-mc: decouple the mc-bus public headers from dprc.h In its current form, the public headers of the mc-bus depend only on a structure "dprc_obj_desc" defined in dprc.h. Move it to the bus public header together with its associated defines and, in order to keep the naming prefixes consistent rename it to "fsl_mc_obj_desc". This will allow making dprc.h private in future patches. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 38 ++++++++++++------------ drivers/staging/fsl-mc/bus/dprc.c | 3 +- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 12 ++++---- drivers/staging/fsl-mc/bus/fsl-mc-private.h | 2 +- drivers/staging/fsl-mc/include/dprc.h | 46 ++--------------------------- drivers/staging/fsl-mc/include/mc.h | 41 ++++++++++++++++++++++++- 6 files changed, 71 insertions(+), 71 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 80c080f20da1..ff65e70a67a6 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -21,13 +21,13 @@ #define FSL_MC_DPRC_DRIVER_NAME "fsl_mc_dprc" -struct dprc_child_objs { +struct fsl_mc_child_objs { int child_count; - struct dprc_obj_desc *child_array; + struct fsl_mc_obj_desc *child_array; }; static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, - struct dprc_obj_desc *obj_desc) + struct fsl_mc_obj_desc *obj_desc) { return !strcmp(mc_dev->obj_desc.type, obj_desc->type) && mc_dev->obj_desc.id == obj_desc->id; @@ -36,7 +36,7 @@ static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) { int i; - struct dprc_child_objs *objs; + struct fsl_mc_child_objs *objs; struct fsl_mc_device *mc_dev; WARN_ON(!dev); @@ -45,7 +45,7 @@ static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) objs = data; for (i = 0; i < objs->child_count; i++) { - struct dprc_obj_desc *obj_desc = &objs->child_array[i]; + struct fsl_mc_obj_desc *obj_desc = &objs->child_array[i]; if (strlen(obj_desc->type) != 0 && fsl_mc_device_match(mc_dev, obj_desc)) @@ -79,7 +79,7 @@ static int __fsl_mc_device_remove(struct device *dev, void *data) * been dynamically removed in the physical DPRC. */ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, - struct dprc_obj_desc *obj_desc_array, + struct fsl_mc_obj_desc *obj_desc_array, int num_child_objects_in_mc) { if (num_child_objects_in_mc != 0) { @@ -87,7 +87,7 @@ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, * Remove child objects that are in the DPRC in Linux, * but not in the MC: */ - struct dprc_child_objs objs; + struct fsl_mc_child_objs objs; objs.child_count = num_child_objects_in_mc; objs.child_array = obj_desc_array; @@ -105,13 +105,13 @@ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, static int __fsl_mc_device_match(struct device *dev, void *data) { - struct dprc_obj_desc *obj_desc = data; + struct fsl_mc_obj_desc *obj_desc = data; struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); return fsl_mc_device_match(mc_dev, obj_desc); } -static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc +static struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_device *mc_bus_dev) @@ -136,16 +136,16 @@ static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc * device is unbound from the corresponding device driver. */ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, - struct dprc_obj_desc *obj_desc) + struct fsl_mc_obj_desc *obj_desc) { int error; u32 plugged_flag_at_mc = - obj_desc->state & DPRC_OBJ_STATE_PLUGGED; + obj_desc->state & FSL_MC_OBJ_STATE_PLUGGED; if (plugged_flag_at_mc != - (mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED)) { + (mc_dev->obj_desc.state & FSL_MC_OBJ_STATE_PLUGGED)) { if (plugged_flag_at_mc) { - mc_dev->obj_desc.state |= DPRC_OBJ_STATE_PLUGGED; + mc_dev->obj_desc.state |= FSL_MC_OBJ_STATE_PLUGGED; error = device_attach(&mc_dev->dev); if (error < 0) { dev_err(&mc_dev->dev, @@ -153,7 +153,7 @@ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, error); } } else { - mc_dev->obj_desc.state &= ~DPRC_OBJ_STATE_PLUGGED; + mc_dev->obj_desc.state &= ~FSL_MC_OBJ_STATE_PLUGGED; device_release_driver(&mc_dev->dev); } } @@ -172,7 +172,7 @@ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, * in the physical DPRC. */ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, - struct dprc_obj_desc *obj_desc_array, + struct fsl_mc_obj_desc *obj_desc_array, int num_child_objects_in_mc) { int error; @@ -180,7 +180,7 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, for (i = 0; i < num_child_objects_in_mc; i++) { struct fsl_mc_device *child_dev; - struct dprc_obj_desc *obj_desc = &obj_desc_array[i]; + struct fsl_mc_obj_desc *obj_desc = &obj_desc_array[i]; if (strlen(obj_desc->type) == 0) continue; @@ -227,7 +227,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, int dprc_get_obj_failures; int error; unsigned int irq_count = mc_bus_dev->obj_desc.irq_count; - struct dprc_obj_desc *child_obj_desc_array = NULL; + struct fsl_mc_obj_desc *child_obj_desc_array = NULL; error = dprc_get_obj_count(mc_bus_dev->mc_io, 0, @@ -254,7 +254,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, */ dprc_get_obj_failures = 0; for (i = 0; i < num_child_objects; i++) { - struct dprc_obj_desc *obj_desc = + struct fsl_mc_obj_desc *obj_desc = &child_obj_desc_array[i]; error = dprc_get_obj(mc_bus_dev->mc_io, @@ -282,7 +282,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, if ((strcmp(obj_desc->type, "dpseci") == 0) && (obj_desc->ver_major < 4)) obj_desc->flags |= - DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY; + FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY; irq_count += obj_desc->irq_count; dev_dbg(&mc_bus_dev->dev, diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index fcf7b4767dc0..a47f31d5ffe6 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include "../include/mc.h" #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dprc.h" @@ -496,7 +497,7 @@ int dprc_get_obj(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int obj_index, - struct dprc_obj_desc *obj_desc) + struct fsl_mc_obj_desc *obj_desc) { struct mc_command cmd = { 0 }; struct dprc_cmd_get_obj *cmd_params; diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 7b48ade1ca9c..8725a5cbc3aa 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -82,7 +82,7 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv) * If the object is not 'plugged' don't match. * Only exception is the root DPRC, which is a special case. */ - if ((mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED) == 0 && + if ((mc_dev->obj_desc.state & FSL_MC_OBJ_STATE_PLUGGED) == 0 && !fsl_mc_is_root_dprc(&mc_dev->dev)) goto out; @@ -339,7 +339,7 @@ static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev, int i; int error; struct resource *regions; - struct dprc_obj_desc *obj_desc = &mc_dev->obj_desc; + struct fsl_mc_obj_desc *obj_desc = &mc_dev->obj_desc; struct device *parent_dev = mc_dev->dev.parent; enum dprc_region_type mc_region_type; @@ -432,7 +432,7 @@ static void fsl_mc_device_release(struct device *dev) /** * Add a newly discovered fsl-mc device to be visible in Linux */ -int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, +int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, struct device *parent_dev, struct fsl_mc_device **new_mc_dev) @@ -534,7 +534,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, } /* Objects are coherent, unless 'no shareability' flag set. */ - if (!(obj_desc->flags & DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY)) + if (!(obj_desc->flags & FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY)) arch_setup_dma_ops(&mc_dev->dev, 0, 0, NULL, true); /* @@ -687,7 +687,7 @@ static int get_mc_addr_translation_ranges(struct device *dev, */ static int fsl_mc_bus_probe(struct platform_device *pdev) { - struct dprc_obj_desc obj_desc; + struct fsl_mc_obj_desc obj_desc; int error; struct fsl_mc *mc; struct fsl_mc_device *mc_bus_dev = NULL; @@ -746,7 +746,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) goto error_cleanup_mc_io; } - memset(&obj_desc, 0, sizeof(struct dprc_obj_desc)); + memset(&obj_desc, 0, sizeof(struct fsl_mc_obj_desc)); error = dprc_get_api_version(mc_io, 0, &obj_desc.ver_major, &obj_desc.ver_minor); diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index 01ef932905de..7f5406f75908 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -12,7 +12,7 @@ #include "../include/mc.h" -int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc, +int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, struct device *parent_dev, struct fsl_mc_device **new_mc_dev); diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h index 2f4a7a75a572..21295e4feb04 100644 --- a/drivers/staging/fsl-mc/include/dprc.h +++ b/drivers/staging/fsl-mc/include/dprc.h @@ -39,6 +39,7 @@ */ struct fsl_mc_io; +struct fsl_mc_obj_desc; int dprc_open(struct fsl_mc_io *mc_io, u32 cmd_flags, @@ -167,59 +168,18 @@ int dprc_get_obj_count(struct fsl_mc_io *mc_io, u16 token, int *obj_count); -/* Objects Attributes Flags */ - -/* Opened state - Indicates that an object is open by at least one owner */ -#define DPRC_OBJ_STATE_OPEN 0x00000001 -/* Plugged state - Indicates that the object is plugged */ -#define DPRC_OBJ_STATE_PLUGGED 0x00000002 - -/** - * Shareability flag - Object flag indicating no memory shareability. - * the object generates memory accesses that are non coherent with other - * masters; - * user is responsible for proper memory handling through IOMMU configuration. - */ -#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 - -/** - * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj() - * @type: Type of object: NULL terminated string - * @id: ID of logical object resource - * @vendor: Object vendor identifier - * @ver_major: Major version number - * @ver_minor: Minor version number - * @irq_count: Number of interrupts supported by the object - * @region_count: Number of mappable regions supported by the object - * @state: Object state: combination of DPRC_OBJ_STATE_ states - * @label: Object label - * @flags: Object's flags - */ -struct dprc_obj_desc { - char type[16]; - int id; - u16 vendor; - u16 ver_major; - u16 ver_minor; - u8 irq_count; - u8 region_count; - u32 state; - char label[16]; - u16 flags; -}; - int dprc_get_obj(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int obj_index, - struct dprc_obj_desc *obj_desc); + struct fsl_mc_obj_desc *obj_desc); int dprc_get_obj_desc(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, char *obj_type, int obj_id, - struct dprc_obj_desc *obj_desc); + struct fsl_mc_obj_desc *obj_desc); int dprc_set_obj_irq(struct fsl_mc_io *mc_io, u32 cmd_flags, diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 1c46c0c2a895..60c706720531 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -104,6 +104,45 @@ struct fsl_mc_device_irq { #define to_fsl_mc_irq(_mc_resource) \ container_of(_mc_resource, struct fsl_mc_device_irq, resource) +/* Opened state - Indicates that an object is open by at least one owner */ +#define FSL_MC_OBJ_STATE_OPEN 0x00000001 +/* Plugged state - Indicates that the object is plugged */ +#define FSL_MC_OBJ_STATE_PLUGGED 0x00000002 + +/** + * Shareability flag - Object flag indicating no memory shareability. + * the object generates memory accesses that are non coherent with other + * masters; + * user is responsible for proper memory handling through IOMMU configuration. + */ +#define FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 + +/** + * struct fsl_mc_obj_desc - Object descriptor + * @type: Type of object: NULL terminated string + * @id: ID of logical object resource + * @vendor: Object vendor identifier + * @ver_major: Major version number + * @ver_minor: Minor version number + * @irq_count: Number of interrupts supported by the object + * @region_count: Number of mappable regions supported by the object + * @state: Object state: combination of FSL_MC_OBJ_STATE_ states + * @label: Object label: NULL terminated string + * @flags: Object's flags + */ +struct fsl_mc_obj_desc { + char type[16]; + int id; + u16 vendor; + u16 ver_major; + u16 ver_minor; + u8 irq_count; + u8 region_count; + u32 state; + char label[16]; + u16 flags; +}; + /** * Bit masks for a MC object device (struct fsl_mc_device) flags */ @@ -150,7 +189,7 @@ struct fsl_mc_device { u16 icid; u16 mc_handle; struct fsl_mc_io *mc_io; - struct dprc_obj_desc obj_desc; + struct fsl_mc_obj_desc obj_desc; struct resource *regions; struct fsl_mc_device_irq **irqs; struct fsl_mc_resource *resource; -- cgit v1.2.3-55-g7522 From 48d3cfb3189a88e1670f609f8bd7d55839d531cf Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:50 +0300 Subject: staging: fsl-mc: delete duplicated function prototypes These functions already have their prototypes in fsl-mc-private.h header file so delete them from mc-bus.h. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index 42700de94d59..8f9bf8dd6495 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -75,14 +75,6 @@ int dprc_scan_container(struct fsl_mc_device *mc_bus_dev); int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, unsigned int *total_irq_count); -int __init dprc_driver_init(void); - -void dprc_driver_exit(void); - -int __init fsl_mc_allocator_driver_init(void); - -void fsl_mc_allocator_driver_exit(void); - struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, struct msi_domain_info *info, struct irq_domain *parent); -- cgit v1.2.3-55-g7522 From be6faff74cda2ac1838c0f85dca3c3ce4975fa73 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:51 +0300 Subject: staging: fsl-mc: delete prototype of unimplemented function The function fsl_mc_bus_exists() has a prototype but is never implemented so delete it from the header file. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index 8f9bf8dd6495..aac062e2b6ef 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -91,8 +91,6 @@ void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); -bool fsl_mc_bus_exists(void); - void fsl_mc_get_root_dprc(struct device *dev, struct device **root_dprc_dev); -- cgit v1.2.3-55-g7522 From 10a8593a76c7719e110e334f84a6ef2068dd4c0f Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:52 +0300 Subject: staging: fsl-mc: turn several exported functions static They are never used outside the source they are implemented in and very likely never will, so it's safe to make them static. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 8 +++----- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 5 ++--- drivers/staging/fsl-mc/include/mc-bus.h | 8 -------- 3 files changed, 5 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index ff65e70a67a6..844796189586 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -220,8 +220,8 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, * populated before they can get allocation requests from probe callbacks * of the device drivers for the non-allocatable devices. */ -int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, - unsigned int *total_irq_count) +static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, + unsigned int *total_irq_count) { int num_child_objects; int dprc_get_obj_failures; @@ -309,7 +309,6 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, return 0; } -EXPORT_SYMBOL_GPL(dprc_scan_objects); /** * dprc_scan_container - Scans a physical DPRC and synchronizes Linux bus state @@ -320,7 +319,7 @@ EXPORT_SYMBOL_GPL(dprc_scan_objects); * bus driver with the actual state of the MC by adding and removing * devices as appropriate. */ -int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) +static int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) { int error; unsigned int irq_count; @@ -356,7 +355,6 @@ error: fsl_mc_cleanup_all_resource_pools(mc_bus_dev); return error; } -EXPORT_SYMBOL_GPL(dprc_scan_container); /** * dprc_irq0_handler - Regular ISR for DPRC interrupt 0 diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 8725a5cbc3aa..60b2a40b4a2f 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -241,8 +241,8 @@ EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister); /** * fsl_mc_get_root_dprc - function to traverse to the root dprc */ -void fsl_mc_get_root_dprc(struct device *dev, - struct device **root_dprc_dev) +static void fsl_mc_get_root_dprc(struct device *dev, + struct device **root_dprc_dev) { if (WARN_ON(!dev)) { *root_dprc_dev = NULL; @@ -254,7 +254,6 @@ void fsl_mc_get_root_dprc(struct device *dev, *root_dprc_dev = (*root_dprc_dev)->parent; } } -EXPORT_SYMBOL_GPL(fsl_mc_get_root_dprc); static int get_dprc_attr(struct fsl_mc_io *mc_io, int container_id, struct dprc_attributes *attr) diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index aac062e2b6ef..c1df43357c56 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -70,11 +70,6 @@ struct fsl_mc_bus { #define to_fsl_mc_bus(_mc_dev) \ container_of(_mc_dev, struct fsl_mc_bus, mc_dev) -int dprc_scan_container(struct fsl_mc_device *mc_bus_dev); - -int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, - unsigned int *total_irq_count); - struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, struct msi_domain_info *info, struct irq_domain *parent); @@ -91,9 +86,6 @@ void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); -void fsl_mc_get_root_dprc(struct device *dev, - struct device **root_dprc_dev); - bool fsl_mc_is_root_dprc(struct device *dev); extern struct bus_type fsl_mc_bus_type; -- cgit v1.2.3-55-g7522 From b32cdde14edec1c75a2190a39e810bf41fa29a7a Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:53 +0300 Subject: staging: fsl-mc: move irq domain creation prototype to public header fsl_mc_msi_create_irq_domain() will is used from the irqchip glue code so it needs to be in the public headers. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 7 ------- drivers/staging/fsl-mc/include/mc.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index c1df43357c56..0860681bddc6 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -14,9 +14,6 @@ #include "../include/mc.h" #include -struct irq_domain; -struct msi_domain_info; - /** * Maximum number of total IRQs that can be pre-allocated for an MC bus' * IRQ pool @@ -70,10 +67,6 @@ struct fsl_mc_bus { #define to_fsl_mc_bus(_mc_dev) \ container_of(_mc_dev, struct fsl_mc_bus, mc_dev) -struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, - struct msi_domain_info *info, - struct irq_domain *parent); - int fsl_mc_find_msi_domain(struct device *mc_platform_dev, struct irq_domain **mc_msi_domain); diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 60c706720531..adb237845b40 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -18,6 +18,9 @@ #define FSL_MC_VENDOR_FREESCALE 0x1957 +struct irq_domain; +struct msi_domain_info; + struct fsl_mc_device; struct fsl_mc_io; @@ -233,6 +236,10 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, void fsl_mc_object_free(struct fsl_mc_device *mc_adev); +struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, + struct msi_domain_info *info, + struct irq_domain *parent); + int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); -- cgit v1.2.3-55-g7522 From 7eba570ece326ea0da2da72f1d4142100c145827 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:54 +0300 Subject: staging: fsl-mc: move couple of definitions to public header Define dev_is_fsl_mc() and the bus type definition (fsl_mc_bus_type) are used externally so move them to the public header. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 9 --------- drivers/staging/fsl-mc/include/mc.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index 0860681bddc6..a79a679578d2 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -20,13 +20,6 @@ */ #define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 -#ifdef CONFIG_FSL_MC_BUS -#define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) -#else -/* If fsl-mc bus is not present device cannot belong to fsl-mc bus */ -#define dev_is_fsl_mc(_dev) (0) -#endif - /** * struct fsl_mc_resource_pool - Pool of MC resources of a given * type @@ -81,6 +74,4 @@ void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); bool fsl_mc_is_root_dprc(struct device *dev); -extern struct bus_type fsl_mc_bus_type; - #endif /* _FSL_MC_MCBUS_H_ */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index adb237845b40..d37e2c7ed55a 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -201,6 +201,13 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) +#ifdef CONFIG_FSL_MC_BUS +#define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) +#else +/* If fsl-mc bus is not present device cannot belong to fsl-mc bus */ +#define dev_is_fsl_mc(_dev) (0) +#endif + /* * module_fsl_mc_driver() - Helper macro for drivers that don't do * anything special in module init/exit. This eliminates a lot of @@ -244,4 +251,6 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); +extern struct bus_type fsl_mc_bus_type; + #endif /* _FSL_MC_H_ */ -- cgit v1.2.3-55-g7522 From af4376710cc5188c42eb473676f6c9d2a16692c4 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:55 +0300 Subject: staging: fsl-mc: move rest of mc-bus.h to private header All the mc-bus.h contents is only used privately in the bus driver so move everything to the private header and get rid of the mc-bus.h header file. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-private.h | 61 +++++++++++++++++ .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 1 - drivers/staging/fsl-mc/bus/mc-io.c | 1 - drivers/staging/fsl-mc/include/mc-bus.h | 77 ---------------------- 8 files changed, 61 insertions(+), 83 deletions(-) delete mode 100644 drivers/staging/fsl-mc/include/mc-bus.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 844796189586..142dfa7b534b 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -13,7 +13,6 @@ #include #include #include -#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index c2af5b570222..e6a2857a9a98 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -10,7 +10,6 @@ #include #include -#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 60b2a40b4a2f..3dec3e991d86 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,7 +20,6 @@ #include #include #include -#include "../include/mc-bus.h" #include "../include/dpmng.h" #include "../include/mc-sys.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index a92fa5a3ff42..81dca7a3a317 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -16,7 +16,6 @@ #include #include #include -#include "../include/mc-bus.h" #include "../include/mc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index 7f5406f75908..e5839992e128 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -11,6 +11,53 @@ #define _FSL_MC_PRIVATE_H_ #include "../include/mc.h" +#include + +/** + * Maximum number of total IRQs that can be pre-allocated for an MC bus' + * IRQ pool + */ +#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 + +/** + * struct fsl_mc_resource_pool - Pool of MC resources of a given + * type + * @type: type of resources in the pool + * @max_count: maximum number of resources in the pool + * @free_count: number of free resources in the pool + * @mutex: mutex to serialize access to the pool's free list + * @free_list: anchor node of list of free resources in the pool + * @mc_bus: pointer to the MC bus that owns this resource pool + */ +struct fsl_mc_resource_pool { + enum fsl_mc_pool_type type; + int max_count; + int free_count; + struct mutex mutex; /* serializes access to free_list */ + struct list_head free_list; + struct fsl_mc_bus *mc_bus; +}; + +/** + * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC + * @mc_dev: fsl-mc device for the bus device itself. + * @resource_pools: array of resource pools (one pool per resource type) + * for this MC bus. These resources represent allocatable entities + * from the physical DPRC. + * @irq_resources: Pointer to array of IRQ objects for the IRQ pool + * @scan_mutex: Serializes bus scanning + * @dprc_attr: DPRC attributes + */ +struct fsl_mc_bus { + struct fsl_mc_device mc_dev; + struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; + struct fsl_mc_device_irq *irq_resources; + struct mutex scan_mutex; /* serializes bus scanning */ + struct dprc_attributes dprc_attr; +}; + +#define to_fsl_mc_bus(_mc_dev) \ + container_of(_mc_dev, struct fsl_mc_bus, mc_dev) int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, @@ -27,6 +74,10 @@ int __init fsl_mc_allocator_driver_init(void); void fsl_mc_allocator_driver_exit(void); +void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); + +void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); + int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, enum fsl_mc_pool_type pool_type, struct fsl_mc_resource @@ -43,6 +94,14 @@ int __init its_fsl_mc_msi_init(void); void its_fsl_mc_msi_cleanup(void); +int fsl_mc_find_msi_domain(struct device *mc_platform_dev, + struct irq_domain **mc_msi_domain); + +int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, + unsigned int irq_count); + +void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus); + int __must_check fsl_create_mc_io(struct device *dev, phys_addr_t mc_portal_phys_addr, u32 mc_portal_size, @@ -51,4 +110,6 @@ int __must_check fsl_create_mc_io(struct device *dev, void fsl_destroy_mc_io(struct fsl_mc_io *mc_io); +bool fsl_mc_is_root_dprc(struct device *dev); + #endif /* _FSL_MC_PRIVATE_H_ */ diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c index 49127acb85b2..865d38517508 100644 --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c @@ -16,7 +16,6 @@ #include #include #include -#include "../include/mc-bus.h" #include "fsl-mc-private.h" static struct irq_chip its_msi_irq_chip = { diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index d66b87f0903b..ec2835fb2a83 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -31,7 +31,6 @@ */ #include -#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h deleted file mode 100644 index a79a679578d2..000000000000 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Freescale Management Complex (MC) bus declarations - * - * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. - * Author: German Rivera - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ -#ifndef _FSL_MC_MCBUS_H_ -#define _FSL_MC_MCBUS_H_ - -#include "../include/mc.h" -#include - -/** - * Maximum number of total IRQs that can be pre-allocated for an MC bus' - * IRQ pool - */ -#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 - -/** - * struct fsl_mc_resource_pool - Pool of MC resources of a given - * type - * @type: type of resources in the pool - * @max_count: maximum number of resources in the pool - * @free_count: number of free resources in the pool - * @mutex: mutex to serialize access to the pool's free list - * @free_list: anchor node of list of free resources in the pool - * @mc_bus: pointer to the MC bus that owns this resource pool - */ -struct fsl_mc_resource_pool { - enum fsl_mc_pool_type type; - int max_count; - int free_count; - struct mutex mutex; /* serializes access to free_list */ - struct list_head free_list; - struct fsl_mc_bus *mc_bus; -}; - -/** - * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC - * @mc_dev: fsl-mc device for the bus device itself. - * @resource_pools: array of resource pools (one pool per resource type) - * for this MC bus. These resources represent allocatable entities - * from the physical DPRC. - * @irq_resources: Pointer to array of IRQ objects for the IRQ pool - * @scan_mutex: Serializes bus scanning - * @dprc_attr: DPRC attributes - */ -struct fsl_mc_bus { - struct fsl_mc_device mc_dev; - struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; - struct fsl_mc_device_irq *irq_resources; - struct mutex scan_mutex; /* serializes bus scanning */ - struct dprc_attributes dprc_attr; -}; - -#define to_fsl_mc_bus(_mc_dev) \ - container_of(_mc_dev, struct fsl_mc_bus, mc_dev) - -int fsl_mc_find_msi_domain(struct device *mc_platform_dev, - struct irq_domain **mc_msi_domain); - -int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, - unsigned int irq_count); - -void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus); - -void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); - -void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); - -bool fsl_mc_is_root_dprc(struct device *dev); - -#endif /* _FSL_MC_MCBUS_H_ */ -- cgit v1.2.3-55-g7522 From b065307fe0ad7859f01ce8560e6bdc590324561a Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:56 +0300 Subject: staging: fsl-mc: remove dpmng API files dpmng.h & dpmng.c files expose an API of just one function which is only used by the bus driver. Move that single API in the bus source as static and remove the two files. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dpmng.c | 74 --------------------------------- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 53 ++++++++++++++++++++++- drivers/staging/fsl-mc/include/dpmng.h | 67 ----------------------------- 3 files changed, 52 insertions(+), 142 deletions(-) delete mode 100644 drivers/staging/fsl-mc/bus/dpmng.c delete mode 100644 drivers/staging/fsl-mc/include/dpmng.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dpmng.c b/drivers/staging/fsl-mc/bus/dpmng.c deleted file mode 100644 index ad5d5bbec529..000000000000 --- a/drivers/staging/fsl-mc/bus/dpmng.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 "../include/mc-sys.h" -#include "../include/mc-cmd.h" -#include "../include/dpmng.h" - -#include "dpmng-cmd.h" - -/** - * mc_get_version() - Retrieves the Management Complex firmware - * version information - * @mc_io: Pointer to opaque I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @mc_ver_info: Returned version information structure - * - * Return: '0' on Success; Error code otherwise. - */ -int mc_get_version(struct fsl_mc_io *mc_io, - u32 cmd_flags, - struct mc_version *mc_ver_info) -{ - struct mc_command cmd = { 0 }; - struct dpmng_rsp_get_version *rsp_params; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, - cmd_flags, - 0); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - rsp_params = (struct dpmng_rsp_get_version *)cmd.params; - mc_ver_info->revision = le32_to_cpu(rsp_params->revision); - mc_ver_info->major = le32_to_cpu(rsp_params->version_major); - mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor); - - return 0; -} -EXPORT_SYMBOL(mc_get_version); - diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 3dec3e991d86..75f8dc330f38 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,11 +20,12 @@ #include #include #include -#include "../include/dpmng.h" #include "../include/mc-sys.h" +#include "../include/mc-cmd.h" #include "fsl-mc-private.h" #include "dprc-cmd.h" +#include "dpmng-cmd.h" /** * Default DMA mask for devices on a fsl-mc bus @@ -59,6 +60,20 @@ struct fsl_mc_addr_translation_range { phys_addr_t start_phys_addr; }; +/** + * struct mc_version + * @major: Major version number: incremented on API compatibility changes + * @minor: Minor version number: incremented on API additions (that are + * backward compatible); reset when major version is incremented + * @revision: Internal revision number: incremented on implementation changes + * and/or bug fixes that have no impact on API + */ +struct mc_version { + u32 major; + u32 minor; + u32 revision; +}; + /** * fsl_mc_bus_match - device to driver matching callback * @dev: the fsl-mc device to match against @@ -237,6 +252,42 @@ void fsl_mc_driver_unregister(struct fsl_mc_driver *mc_driver) } EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister); +/** + * mc_get_version() - Retrieves the Management Complex firmware + * version information + * @mc_io: Pointer to opaque I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @mc_ver_info: Returned version information structure + * + * Return: '0' on Success; Error code otherwise. + */ +static int mc_get_version(struct fsl_mc_io *mc_io, + u32 cmd_flags, + struct mc_version *mc_ver_info) +{ + struct mc_command cmd = { 0 }; + struct dpmng_rsp_get_version *rsp_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, + cmd_flags, + 0); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpmng_rsp_get_version *)cmd.params; + mc_ver_info->revision = le32_to_cpu(rsp_params->revision); + mc_ver_info->major = le32_to_cpu(rsp_params->version_major); + mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor); + + return 0; +} + /** * fsl_mc_get_root_dprc - function to traverse to the root dprc */ diff --git a/drivers/staging/fsl-mc/include/dpmng.h b/drivers/staging/fsl-mc/include/dpmng.h deleted file mode 100644 index 170c07dd376a..000000000000 --- a/drivers/staging/fsl-mc/include/dpmng.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 __FSL_DPMNG_H -#define __FSL_DPMNG_H - -/* - * Management Complex General API - * Contains general API for the Management Complex firmware - */ - -struct fsl_mc_io; - -/** - * Management Complex firmware version information - */ -#define MC_VER_MAJOR 8 -#define MC_VER_MINOR 0 - -/** - * struct mc_version - * @major: Major version number: incremented on API compatibility changes - * @minor: Minor version number: incremented on API additions (that are - * backward compatible); reset when major version is incremented - * @revision: Internal revision number: incremented on implementation changes - * and/or bug fixes that have no impact on API - */ -struct mc_version { - u32 major; - u32 minor; - u32 revision; -}; - -int mc_get_version(struct fsl_mc_io *mc_io, - u32 cmd_flags, - struct mc_version *mc_ver_info); - -#endif /* __FSL_DPMNG_H */ -- cgit v1.2.3-55-g7522 From 5776aad3fe1bb87f3e4816cde8735647597da336 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:57 +0300 Subject: staging: fsl-mc: fix a few implicit includes Few files using byte order macros but did not explicitly included the required kernel header, so add it. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dpbp.c | 1 + drivers/staging/fsl-mc/bus/dpcon.c | 1 + drivers/staging/fsl-mc/bus/dpio/dpio.c | 1 + drivers/staging/fsl-mc/bus/dpmcp.c | 1 + drivers/staging/fsl-mc/bus/dprc.c | 1 + 5 files changed, 5 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index d9e450a6bad6..e92d887de716 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dpbp.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index eb713578b817..20df185aea5c 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dpcon.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index d81e0232f6c1..a18ca897ec3a 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -30,6 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../../include/mc-sys.h" #include "../../include/mc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index ad4c8b43f065..66011e86c805 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index a47f31d5ffe6..e5dfc335dc4e 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../include/mc.h" #include "../include/mc-sys.h" #include "../include/mc-cmd.h" -- cgit v1.2.3-55-g7522 From 7d6e221d73904aedcbd46ce2db6a545be55d2296 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:58 +0300 Subject: staging: fsl-mc: move mc-sys.h contents in the public header mc-sys.h contains the API to send commands to the MC and is used by drivers. Move it to the public headers and get rid of the mc-sys.h header. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 1 - drivers/staging/fsl-dpaa2/ethernet/dpni.c | 2 +- drivers/staging/fsl-mc/bus/dpbp.c | 2 +- drivers/staging/fsl-mc/bus/dpcon.c | 2 +- drivers/staging/fsl-mc/bus/dpio/dpio.c | 2 +- drivers/staging/fsl-mc/bus/dpmcp.c | 2 +- drivers/staging/fsl-mc/bus/dprc-driver.c | 2 +- drivers/staging/fsl-mc/bus/dprc.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 2 +- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 - drivers/staging/fsl-mc/bus/mc-io.c | 2 +- drivers/staging/fsl-mc/bus/mc-sys.c | 1 - drivers/staging/fsl-mc/include/mc-sys.h | 98 -------------------------- drivers/staging/fsl-mc/include/mc.h | 53 ++++++++++++++ 14 files changed, 61 insertions(+), 110 deletions(-) delete mode 100644 drivers/staging/fsl-mc/include/mc-sys.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 1f89274a03d3..b9a0a315e6fb 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -40,7 +40,6 @@ #include #include "../../fsl-mc/include/mc.h" -#include "../../fsl-mc/include/mc-sys.h" #include "dpaa2-eth.h" /* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c index 2c4b1a89c2c1..160eaf88a3ae 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c @@ -32,7 +32,7 @@ */ #include #include -#include "../../fsl-mc/include/mc-sys.h" +#include "../../fsl-mc/include/mc.h" #include "../../fsl-mc/include/mc-cmd.h" #include "dpni.h" #include "dpni-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index e92d887de716..b71467391a59 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "../include/mc-cmd.h" #include "../include/dpbp.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index 20df185aea5c..2272a9c45528 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "../include/mc-cmd.h" #include "../include/dpcon.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index a18ca897ec3a..48dce4af9363 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -31,7 +31,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../../include/mc-sys.h" +#include "../../include/mc.h" #include "../../include/mc-cmd.h" #include "dpio.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index 66011e86c805..7b3dd19a46ef 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "../include/mc-cmd.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 142dfa7b534b..8e17cd862c3f 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -13,7 +13,7 @@ #include #include #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "dprc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index e5dfc335dc4e..f93fe009fb18 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dprc.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index e6a2857a9a98..8ea3920400a0 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -10,7 +10,7 @@ #include #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 75f8dc330f38..166604e22952 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,7 +20,6 @@ #include #include #include -#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index ec2835fb2a83..35221a17858b 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -31,7 +31,7 @@ */ #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "fsl-mc-private.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index 4d82802b384d..c537bf8b5685 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -37,7 +37,6 @@ #include #include #include -#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/mc.h" diff --git a/drivers/staging/fsl-mc/include/mc-sys.h b/drivers/staging/fsl-mc/include/mc-sys.h deleted file mode 100644 index b5203707344a..000000000000 --- a/drivers/staging/fsl-mc/include/mc-sys.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * Interface of the I/O services to send MC commands to the MC hardware - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 _FSL_MC_SYS_H -#define _FSL_MC_SYS_H - -#include -#include -#include -#include - -/** - * Bit masks for a MC I/O object (struct fsl_mc_io) flags - */ -#define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001 - -struct mc_command; - -/** - * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command() - * @dev: device associated with this Mc I/O object - * @flags: flags for mc_send_command() - * @portal_size: MC command portal size in bytes - * @portal_phys_addr: MC command portal physical address - * @portal_virt_addr: MC command portal virtual address - * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal. - * - * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not - * set: - * @mutex: Mutex to serialize mc_send_command() calls that use the same MC - * portal, if the fsl_mc_io object was created with the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this - * fsl_mc_io object must be made only from non-atomic context. - * - * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is - * set: - * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC - * portal, if the fsl_mc_io object was created with the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this - * fsl_mc_io object can be made from atomic or non-atomic context. - */ -struct fsl_mc_io { - struct device *dev; - u16 flags; - u16 portal_size; - phys_addr_t portal_phys_addr; - void __iomem *portal_virt_addr; - struct fsl_mc_device *dpmcp_dev; - union { - /* - * This field is only meaningful if the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set - */ - struct mutex mutex; /* serializes mc_send_command() */ - - /* - * This field is only meaningful if the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set - */ - spinlock_t spinlock; /* serializes mc_send_command() */ - }; -}; - -int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); - -#endif /* _FSL_MC_SYS_H */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index d37e2c7ed55a..33bb3b8b641c 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -23,6 +23,7 @@ struct msi_domain_info; struct fsl_mc_device; struct fsl_mc_io; +struct mc_command; /** * struct fsl_mc_driver - MC object device driver object @@ -201,6 +202,58 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) +/** + * Bit masks for a MC I/O object (struct fsl_mc_io) flags + */ +#define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001 + +/** + * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command() + * @dev: device associated with this Mc I/O object + * @flags: flags for mc_send_command() + * @portal_size: MC command portal size in bytes + * @portal_phys_addr: MC command portal physical address + * @portal_virt_addr: MC command portal virtual address + * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal. + * + * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not + * set: + * @mutex: Mutex to serialize mc_send_command() calls that use the same MC + * portal, if the fsl_mc_io object was created with the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this + * fsl_mc_io object must be made only from non-atomic context. + * + * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is + * set: + * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC + * portal, if the fsl_mc_io object was created with the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this + * fsl_mc_io object can be made from atomic or non-atomic context. + */ +struct fsl_mc_io { + struct device *dev; + u16 flags; + u16 portal_size; + phys_addr_t portal_phys_addr; + void __iomem *portal_virt_addr; + struct fsl_mc_device *dpmcp_dev; + union { + /* + * This field is only meaningful if the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set + */ + struct mutex mutex; /* serializes mc_send_command() */ + + /* + * This field is only meaningful if the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set + */ + spinlock_t spinlock; /* serializes mc_send_command() */ + }; +}; + +int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); + #ifdef CONFIG_FSL_MC_BUS #define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) #else -- cgit v1.2.3-55-g7522 From 9b1aa45539fb8389deb79e4a939bfc05ee45aeb5 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:35:59 +0300 Subject: staging: fsl-mc: move mc-cmd.h contents in the public header mc-cmd.h contains some low level functions used to encode and decode commands to the MC. They are used by the drivers so move them to the public headers and get rid of the mc-cmd.h header. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpni.c | 1 - drivers/staging/fsl-mc/bus/dpbp.c | 1 - drivers/staging/fsl-mc/bus/dpcon.c | 1 - drivers/staging/fsl-mc/bus/dpio/dpio.c | 1 - drivers/staging/fsl-mc/bus/dpmcp.c | 1 - drivers/staging/fsl-mc/bus/dprc.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 1 - drivers/staging/fsl-mc/bus/mc-sys.c | 1 - drivers/staging/fsl-mc/include/mc-cmd.h | 130 ------------------------------ drivers/staging/fsl-mc/include/mc.h | 95 +++++++++++++++++++++- 11 files changed, 94 insertions(+), 140 deletions(-) delete mode 100644 drivers/staging/fsl-mc/include/mc-cmd.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c index 160eaf88a3ae..5b9d4424e4fb 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c @@ -33,7 +33,6 @@ #include #include #include "../../fsl-mc/include/mc.h" -#include "../../fsl-mc/include/mc-cmd.h" #include "dpni.h" #include "dpni-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index b71467391a59..363730a80cbb 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-cmd.h" #include "../include/dpbp.h" #include "dpbp-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index 2272a9c45528..ca1da85c6dda 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-cmd.h" #include "../include/dpcon.h" #include "dpcon-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index 48dce4af9363..00eb22186f42 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -32,7 +32,6 @@ */ #include #include "../../include/mc.h" -#include "../../include/mc-cmd.h" #include "dpio.h" #include "dpio-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index 7b3dd19a46ef..eea42f61af86 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-cmd.h" #include "dpmcp.h" #include "dpmcp-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index f93fe009fb18..138fe80577d8 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-cmd.h" #include "../include/dprc.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 166604e22952..19606e8d25dd 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,7 +20,6 @@ #include #include #include -#include "../include/mc-cmd.h" #include "fsl-mc-private.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index 81dca7a3a317..2b64651bea90 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -16,7 +16,6 @@ #include #include #include -#include "../include/mc-cmd.h" #include "fsl-mc-private.h" /* diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index c537bf8b5685..a1704c3a6a78 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -37,7 +37,6 @@ #include #include #include -#include "../include/mc-cmd.h" #include "../include/mc.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/include/mc-cmd.h b/drivers/staging/fsl-mc/include/mc-cmd.h deleted file mode 100644 index 2e08aa31b084..000000000000 --- a/drivers/staging/fsl-mc/include/mc-cmd.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 __FSL_MC_CMD_H -#define __FSL_MC_CMD_H - -#define MC_CMD_NUM_OF_PARAMS 7 - -struct mc_cmd_header { - u8 src_id; - u8 flags_hw; - u8 status; - u8 flags_sw; - __le16 token; - __le16 cmd_id; -}; - -struct mc_command { - u64 header; - u64 params[MC_CMD_NUM_OF_PARAMS]; -}; - -struct mc_rsp_create { - __le32 object_id; -}; - -struct mc_rsp_api_ver { - __le16 major_ver; - __le16 minor_ver; -}; - -enum mc_cmd_status { - MC_CMD_STATUS_OK = 0x0, /* Completed successfully */ - MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */ - MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */ - MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */ - MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */ - MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */ - MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */ - MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */ - MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */ - MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */ - MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */ - MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ -}; - -/* - * MC command flags - */ - -/* High priority flag */ -#define MC_CMD_FLAG_PRI 0x80 -/* Command completion flag */ -#define MC_CMD_FLAG_INTR_DIS 0x01 - -static inline u64 mc_encode_cmd_header(u16 cmd_id, - u32 cmd_flags, - u16 token) -{ - u64 header = 0; - struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header; - - hdr->cmd_id = cpu_to_le16(cmd_id); - hdr->token = cpu_to_le16(token); - hdr->status = MC_CMD_STATUS_READY; - if (cmd_flags & MC_CMD_FLAG_PRI) - hdr->flags_hw = MC_CMD_FLAG_PRI; - if (cmd_flags & MC_CMD_FLAG_INTR_DIS) - hdr->flags_sw = MC_CMD_FLAG_INTR_DIS; - - return header; -} - -static inline u16 mc_cmd_hdr_read_token(struct mc_command *cmd) -{ - struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; - u16 token = le16_to_cpu(hdr->token); - - return token; -} - -static inline u32 mc_cmd_read_object_id(struct mc_command *cmd) -{ - struct mc_rsp_create *rsp_params; - - rsp_params = (struct mc_rsp_create *)cmd->params; - return le32_to_cpu(rsp_params->object_id); -} - -static inline void mc_cmd_read_api_version(struct mc_command *cmd, - u16 *major_ver, - u16 *minor_ver) -{ - struct mc_rsp_api_ver *rsp_params; - - rsp_params = (struct mc_rsp_api_ver *)cmd->params; - *major_ver = le16_to_cpu(rsp_params->major_ver); - *minor_ver = le16_to_cpu(rsp_params->minor_ver); -} - -#endif /* __FSL_MC_CMD_H */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 33bb3b8b641c..38f87144324a 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -23,7 +23,6 @@ struct msi_domain_info; struct fsl_mc_device; struct fsl_mc_io; -struct mc_command; /** * struct fsl_mc_driver - MC object device driver object @@ -202,6 +201,100 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) +#define MC_CMD_NUM_OF_PARAMS 7 + +struct mc_cmd_header { + u8 src_id; + u8 flags_hw; + u8 status; + u8 flags_sw; + __le16 token; + __le16 cmd_id; +}; + +struct mc_command { + u64 header; + u64 params[MC_CMD_NUM_OF_PARAMS]; +}; + +enum mc_cmd_status { + MC_CMD_STATUS_OK = 0x0, /* Completed successfully */ + MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */ + MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */ + MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */ + MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */ + MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */ + MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */ + MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */ + MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */ + MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */ + MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */ + MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ +}; + +/* + * MC command flags + */ + +/* High priority flag */ +#define MC_CMD_FLAG_PRI 0x80 +/* Command completion flag */ +#define MC_CMD_FLAG_INTR_DIS 0x01 + +static inline u64 mc_encode_cmd_header(u16 cmd_id, + u32 cmd_flags, + u16 token) +{ + u64 header = 0; + struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header; + + hdr->cmd_id = cpu_to_le16(cmd_id); + hdr->token = cpu_to_le16(token); + hdr->status = MC_CMD_STATUS_READY; + if (cmd_flags & MC_CMD_FLAG_PRI) + hdr->flags_hw = MC_CMD_FLAG_PRI; + if (cmd_flags & MC_CMD_FLAG_INTR_DIS) + hdr->flags_sw = MC_CMD_FLAG_INTR_DIS; + + return header; +} + +static inline u16 mc_cmd_hdr_read_token(struct mc_command *cmd) +{ + struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; + u16 token = le16_to_cpu(hdr->token); + + return token; +} + +struct mc_rsp_create { + __le32 object_id; +}; + +struct mc_rsp_api_ver { + __le16 major_ver; + __le16 minor_ver; +}; + +static inline u32 mc_cmd_read_object_id(struct mc_command *cmd) +{ + struct mc_rsp_create *rsp_params; + + rsp_params = (struct mc_rsp_create *)cmd->params; + return le32_to_cpu(rsp_params->object_id); +} + +static inline void mc_cmd_read_api_version(struct mc_command *cmd, + u16 *major_ver, + u16 *minor_ver) +{ + struct mc_rsp_api_ver *rsp_params; + + rsp_params = (struct mc_rsp_api_ver *)cmd->params; + *major_ver = le16_to_cpu(rsp_params->major_ver); + *minor_ver = le16_to_cpu(rsp_params->minor_ver); +} + /** * Bit masks for a MC I/O object (struct fsl_mc_io) flags */ -- cgit v1.2.3-55-g7522 From 1877e4ba2d0890244284eea101681b6f990aa2be Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Thu, 22 Jun 2017 16:36:00 +0300 Subject: staging: fsl-mc: make dprc.h header private dprc.h is only used in the mc bus driver so move it together with the sources thus making it private. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc.c | 2 +- drivers/staging/fsl-mc/bus/dprc.h | 268 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/bus/fsl-mc-private.h | 1 + drivers/staging/fsl-mc/include/dprc.h | 268 ---------------------------- drivers/staging/fsl-mc/include/mc.h | 1 - 5 files changed, 270 insertions(+), 270 deletions(-) create mode 100644 drivers/staging/fsl-mc/bus/dprc.h delete mode 100644 drivers/staging/fsl-mc/include/dprc.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index 138fe80577d8..6f6c65a42166 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,7 +31,7 @@ */ #include #include "../include/mc.h" -#include "../include/dprc.h" +#include "dprc.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.h b/drivers/staging/fsl-mc/bus/dprc.h new file mode 100644 index 000000000000..21295e4feb04 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dprc.h @@ -0,0 +1,268 @@ +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 _FSL_DPRC_H +#define _FSL_DPRC_H + +/* + * Data Path Resource Container API + * Contains DPRC API for managing and querying DPAA resources + */ + +struct fsl_mc_io; +struct fsl_mc_obj_desc; + +int dprc_open(struct fsl_mc_io *mc_io, + u32 cmd_flags, + int container_id, + u16 *token); + +int dprc_close(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token); + +/* IRQ */ + +/* IRQ index */ +#define DPRC_IRQ_INDEX 0 + +/* Number of dprc's IRQs */ +#define DPRC_NUM_OF_IRQS 1 + +/* DPRC IRQ events */ + +/* IRQ event - Indicates that a new object added to the container */ +#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001 +/* IRQ event - Indicates that an object was removed from the container */ +#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002 +/* IRQ event - Indicates that resources added to the container */ +#define DPRC_IRQ_EVENT_RES_ADDED 0x00000004 +/* IRQ event - Indicates that resources removed from the container */ +#define DPRC_IRQ_EVENT_RES_REMOVED 0x00000008 +/* + * IRQ event - Indicates that one of the descendant containers that opened by + * this container is destroyed + */ +#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010 + +/* + * IRQ event - Indicates that on one of the container's opened object is + * destroyed + */ +#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020 + +/* Irq event - Indicates that object is created at the container */ +#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040 + +/** + * struct dprc_irq_cfg - IRQ configuration + * @paddr: Address that must be written to signal a message-based interrupt + * @val: Value to write into irq_addr address + * @irq_num: A user defined number associated with this IRQ + */ +struct dprc_irq_cfg { + phys_addr_t paddr; + u32 val; + int irq_num; +}; + +int dprc_set_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + int *type, + struct dprc_irq_cfg *irq_cfg); + +int dprc_set_irq_enable(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u8 en); + +int dprc_get_irq_enable(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u8 *en); + +int dprc_set_irq_mask(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 mask); + +int dprc_get_irq_mask(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 *mask); + +int dprc_get_irq_status(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 *status); + +int dprc_clear_irq_status(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 status); + +/** + * struct dprc_attributes - Container attributes + * @container_id: Container's ID + * @icid: Container's ICID + * @portal_id: Container's portal ID + * @options: Container's options as set at container's creation + */ +struct dprc_attributes { + int container_id; + u16 icid; + int portal_id; + u64 options; +}; + +int dprc_get_attributes(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + struct dprc_attributes *attributes); + +int dprc_get_obj_count(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + int *obj_count); + +int dprc_get_obj(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + int obj_index, + struct fsl_mc_obj_desc *obj_desc); + +int dprc_get_obj_desc(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + struct fsl_mc_obj_desc *obj_desc); + +int dprc_set_obj_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 irq_index, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_obj_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 irq_index, + int *type, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_res_count(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *type, + int *res_count); + +/** + * enum dprc_iter_status - Iteration status + * @DPRC_ITER_STATUS_FIRST: Perform first iteration + * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed + * @DPRC_ITER_STATUS_LAST: Indicates last iteration + */ +enum dprc_iter_status { + DPRC_ITER_STATUS_FIRST = 0, + DPRC_ITER_STATUS_MORE = 1, + DPRC_ITER_STATUS_LAST = 2 +}; + +/* Region flags */ +/* Cacheable - Indicates that region should be mapped as cacheable */ +#define DPRC_REGION_CACHEABLE 0x00000001 + +/** + * enum dprc_region_type - Region type + * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region + * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region + */ +enum dprc_region_type { + DPRC_REGION_TYPE_MC_PORTAL, + DPRC_REGION_TYPE_QBMAN_PORTAL +}; + +/** + * struct dprc_region_desc - Mappable region descriptor + * @base_offset: Region offset from region's base address. + * For DPMCP and DPRC objects, region base is offset from SoC MC portals + * base address; For DPIO, region base is offset from SoC QMan portals + * base address + * @size: Region size (in bytes) + * @flags: Region attributes + * @type: Portal region type + */ +struct dprc_region_desc { + u32 base_offset; + u32 size; + u32 flags; + enum dprc_region_type type; +}; + +int dprc_get_obj_region(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 region_index, + struct dprc_region_desc *region_desc); + +int dprc_get_api_version(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 *major_ver, + u16 *minor_ver); + +int dprc_get_container_id(struct fsl_mc_io *mc_io, + u32 cmd_flags, + int *container_id); + +#endif /* _FSL_DPRC_H */ + diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index e5839992e128..62d398947605 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -11,6 +11,7 @@ #define _FSL_MC_PRIVATE_H_ #include "../include/mc.h" +#include "dprc.h" #include /** diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h deleted file mode 100644 index 21295e4feb04..000000000000 --- a/drivers/staging/fsl-mc/include/dprc.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 _FSL_DPRC_H -#define _FSL_DPRC_H - -/* - * Data Path Resource Container API - * Contains DPRC API for managing and querying DPAA resources - */ - -struct fsl_mc_io; -struct fsl_mc_obj_desc; - -int dprc_open(struct fsl_mc_io *mc_io, - u32 cmd_flags, - int container_id, - u16 *token); - -int dprc_close(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token); - -/* IRQ */ - -/* IRQ index */ -#define DPRC_IRQ_INDEX 0 - -/* Number of dprc's IRQs */ -#define DPRC_NUM_OF_IRQS 1 - -/* DPRC IRQ events */ - -/* IRQ event - Indicates that a new object added to the container */ -#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001 -/* IRQ event - Indicates that an object was removed from the container */ -#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002 -/* IRQ event - Indicates that resources added to the container */ -#define DPRC_IRQ_EVENT_RES_ADDED 0x00000004 -/* IRQ event - Indicates that resources removed from the container */ -#define DPRC_IRQ_EVENT_RES_REMOVED 0x00000008 -/* - * IRQ event - Indicates that one of the descendant containers that opened by - * this container is destroyed - */ -#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010 - -/* - * IRQ event - Indicates that on one of the container's opened object is - * destroyed - */ -#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020 - -/* Irq event - Indicates that object is created at the container */ -#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040 - -/** - * struct dprc_irq_cfg - IRQ configuration - * @paddr: Address that must be written to signal a message-based interrupt - * @val: Value to write into irq_addr address - * @irq_num: A user defined number associated with this IRQ - */ -struct dprc_irq_cfg { - phys_addr_t paddr; - u32 val; - int irq_num; -}; - -int dprc_set_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - int *type, - struct dprc_irq_cfg *irq_cfg); - -int dprc_set_irq_enable(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u8 en); - -int dprc_get_irq_enable(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u8 *en); - -int dprc_set_irq_mask(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 mask); - -int dprc_get_irq_mask(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 *mask); - -int dprc_get_irq_status(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 *status); - -int dprc_clear_irq_status(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 status); - -/** - * struct dprc_attributes - Container attributes - * @container_id: Container's ID - * @icid: Container's ICID - * @portal_id: Container's portal ID - * @options: Container's options as set at container's creation - */ -struct dprc_attributes { - int container_id; - u16 icid; - int portal_id; - u64 options; -}; - -int dprc_get_attributes(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - struct dprc_attributes *attributes); - -int dprc_get_obj_count(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - int *obj_count); - -int dprc_get_obj(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - int obj_index, - struct fsl_mc_obj_desc *obj_desc); - -int dprc_get_obj_desc(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - struct fsl_mc_obj_desc *obj_desc); - -int dprc_set_obj_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 irq_index, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_obj_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 irq_index, - int *type, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_res_count(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *type, - int *res_count); - -/** - * enum dprc_iter_status - Iteration status - * @DPRC_ITER_STATUS_FIRST: Perform first iteration - * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed - * @DPRC_ITER_STATUS_LAST: Indicates last iteration - */ -enum dprc_iter_status { - DPRC_ITER_STATUS_FIRST = 0, - DPRC_ITER_STATUS_MORE = 1, - DPRC_ITER_STATUS_LAST = 2 -}; - -/* Region flags */ -/* Cacheable - Indicates that region should be mapped as cacheable */ -#define DPRC_REGION_CACHEABLE 0x00000001 - -/** - * enum dprc_region_type - Region type - * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region - * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region - */ -enum dprc_region_type { - DPRC_REGION_TYPE_MC_PORTAL, - DPRC_REGION_TYPE_QBMAN_PORTAL -}; - -/** - * struct dprc_region_desc - Mappable region descriptor - * @base_offset: Region offset from region's base address. - * For DPMCP and DPRC objects, region base is offset from SoC MC portals - * base address; For DPIO, region base is offset from SoC QMan portals - * base address - * @size: Region size (in bytes) - * @flags: Region attributes - * @type: Portal region type - */ -struct dprc_region_desc { - u32 base_offset; - u32 size; - u32 flags; - enum dprc_region_type type; -}; - -int dprc_get_obj_region(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 region_index, - struct dprc_region_desc *region_desc); - -int dprc_get_api_version(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 *major_ver, - u16 *minor_ver); - -int dprc_get_container_id(struct fsl_mc_io *mc_io, - u32 cmd_flags, - int *container_id); - -#endif /* _FSL_DPRC_H */ - diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 38f87144324a..aafe63a21f49 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -14,7 +14,6 @@ #include #include #include -#include "../include/dprc.h" #define FSL_MC_VENDOR_FREESCALE 0x1957 -- cgit v1.2.3-55-g7522 From b9e8caa7a67535fc544c2504fae3e71a02cfb01a Mon Sep 17 00:00:00 2001 From: Frans Klaver Date: Fri, 16 Jun 2017 19:45:56 +0200 Subject: staging: fusb302: don't bitshift __le16 type The header field in struct pd_message is declared as an __le16 type. The data in the message is supposed to be little endian. This means we don't have to go and shift the individual bytes into position when we're filling the buffer, we can just copy the contents right away. As an added benefit we don't get fishy results on big endian systems anymore. Signed-off-by: Frans Klaver Reviewed-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/staging/typec/fusb302/fusb302.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c index 4a356e509fe4..03a3809d18f0 100644 --- a/drivers/staging/typec/fusb302/fusb302.c +++ b/drivers/staging/typec/fusb302/fusb302.c @@ -1039,8 +1039,8 @@ static int fusb302_pd_send_message(struct fusb302_chip *chip, } /* packsym tells the FUSB302 chip that the next X bytes are payload */ buf[pos++] = FUSB302_TKN_PACKSYM | (len & 0x1F); - buf[pos++] = msg->header & 0xFF; - buf[pos++] = (msg->header >> 8) & 0xFF; + memcpy(&buf[pos], &msg->header, sizeof(msg->header)); + pos += sizeof(msg->header); len -= 2; memcpy(&buf[pos], msg->payload, len); -- cgit v1.2.3-55-g7522 From 5ef61f593c3351e7df984f32b0a0fe7fa0fde2ac Mon Sep 17 00:00:00 2001 From: Matthew Reed Date: Tue, 20 Jun 2017 22:39:52 -0400 Subject: staging: fb_xgi: vb_table: Remove white space after tabstop Remove white space after tabstop on closing bracket as suggested by checkpatch.pl. Additional white space removed for page consistency. Signed-off-by: Matthew Reed <4d5452@gmail.com> Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xgifb/vb_table.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index f9f98e06e6d5..31dd52c513df 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -2448,15 +2448,15 @@ static const struct XGI301C_Tap4TimingStruct PALTap4Timing[] = { } }, {0xFFFF, { - 0x04, 0x1A, 0x04, 0x7E, 0x02, 0x1B, 0x05, 0x7E, /* ; C0-C7 */ - 0x01, 0x1A, 0x07, 0x7E, 0x00, 0x1A, 0x09, 0x7D, /* ; C8-CF */ - 0x7F, 0x19, 0x0B, 0x7D, 0x7E, 0x18, 0x0D, 0x7D, /* ; D0-D7 */ - 0x7D, 0x17, 0x10, 0x7C, 0x7D, 0x15, 0x12, 0x7C, /* ; D8-DF */ - 0x7C, 0x14, 0x14, 0x7C, 0x7C, 0x12, 0x15, 0x7D, /* ; E0-E7 */ - 0x7C, 0x10, 0x17, 0x7D, 0x7C, 0x0D, 0x18, 0x7F, /* ; EA-EF */ - 0x7D, 0x0B, 0x19, 0x7F, 0x7D, 0x09, 0x1A, 0x00, /* ; F0-F7 */ - 0x7D, 0x07, 0x1A, 0x02, 0x7E, 0x05, 0x1B, 0x02 /* ; F8-FF */ - } + 0x04, 0x1A, 0x04, 0x7E, 0x02, 0x1B, 0x05, 0x7E, /* ; C0-C7 */ + 0x01, 0x1A, 0x07, 0x7E, 0x00, 0x1A, 0x09, 0x7D, /* ; C8-CF */ + 0x7F, 0x19, 0x0B, 0x7D, 0x7E, 0x18, 0x0D, 0x7D, /* ; D0-D7 */ + 0x7D, 0x17, 0x10, 0x7C, 0x7D, 0x15, 0x12, 0x7C, /* ; D8-DF */ + 0x7C, 0x14, 0x14, 0x7C, 0x7C, 0x12, 0x15, 0x7D, /* ; E0-E7 */ + 0x7C, 0x10, 0x17, 0x7D, 0x7C, 0x0D, 0x18, 0x7F, /* ; EA-EF */ + 0x7D, 0x0B, 0x19, 0x7F, 0x7D, 0x09, 0x1A, 0x00, /* ; F0-F7 */ + 0x7D, 0x07, 0x1A, 0x02, 0x7E, 0x05, 0x1B, 0x02 /* ; F8-FF */ + } } }; -- cgit v1.2.3-55-g7522 From 888db9a6e02c8bf82c2753acf146c71b662c5ba5 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Mon, 19 Jun 2017 21:32:58 +0100 Subject: staging: sm750fb: change default screen resolution The previous patch which updated screen resolution was tested under wrong environment. sm750 driver does not support 24bpp. It only supports 8bpp, 16bpp and 32bpp. Lets update the default screen resolution to use 32bpp for a better screen performance. Fixes: ac669251087d ("staging: sm750fb: change default screen resolution") Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index d5934f372387..664c220f1df4 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -33,7 +33,7 @@ static int g_hwcursor = 1; static int g_noaccel; static int g_nomtrr; static const char *g_fbmode[] = {NULL, NULL}; -static const char *g_def_fbmode = "1024x768-24@60"; +static const char *g_def_fbmode = "1024x768-32@60"; static char *g_settings; static int g_dualview; static char *g_option; -- cgit v1.2.3-55-g7522 From 7bb0dffd0516b07cf23fe5121a0b1d4f55566cf6 Mon Sep 17 00:00:00 2001 From: simran singhal Date: Tue, 20 Jun 2017 10:57:28 +0530 Subject: staging: rtl8723bs: hal: Use (true/false) in assignment to bool This patch assigns (true/false) to boolean EDCCA_State instead of (1/0). And, there is no need of comparing EDCCA_State explicitly with constant 1. Signed-off-by: simran singhal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/odm_DIG.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c b/drivers/staging/rtl8723bs/hal/odm_DIG.c index 202c52f488ae..0bde9444471d 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.c +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c @@ -278,11 +278,11 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI) if (!pDM_Odm->ForceEDCCA) { if (pDM_Odm->RSSI_Min > pDM_Odm->AdapEn_RSSI) - EDCCA_State = 1; + EDCCA_State = true; else if (pDM_Odm->RSSI_Min < (pDM_Odm->AdapEn_RSSI - 5)) - EDCCA_State = 0; + EDCCA_State = false; } else - EDCCA_State = 1; + EDCCA_State = true; if ( pDM_Odm->bLinked && @@ -305,7 +305,7 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI) ) ); - if (EDCCA_State == 1) { + if (EDCCA_State) { Diff = IGI_target-(s8)IGI; TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; if (TH_L2H_dmc > 10) -- cgit v1.2.3-55-g7522 From 428715bac69b98253e33c0034c829114481d5b32 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Wed, 14 Jun 2017 18:33:03 -0400 Subject: staging: rtl8723bs: Remove unnecessary cast in kfree Remove unnecassary casts in the argument to kfree. Found using Coccinelle. The semantic patch used to find this is as follows: // @@ type T; expression *f; @@ - kfree((T *)(f)); + kfree(f); // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 916741371bee..79d8383d4b9b 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -766,7 +766,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, exit: - kfree((u8 *)pwep); + kfree(pwep); return ret; } @@ -2500,7 +2500,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, ret = wpa_set_encryption(dev, param, param_len); exit: - kfree((u8 *)param); + kfree(param); return ret; } @@ -3767,7 +3767,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) if (copy_from_user(param, p->pointer, p->length)) { - kfree((u8 *)param); + kfree(param); ret = -EFAULT; goto out; } @@ -3801,7 +3801,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) if (ret == 0 && copy_to_user(p->pointer, param, p->length)) ret = -EFAULT; - kfree((u8 *)param); + kfree(param); out: @@ -4130,7 +4130,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, } exit: - kfree((u8 *)pwep); + kfree(pwep); return ret; @@ -4713,7 +4713,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) if (copy_from_user(param, p->pointer, p->length)) { - kfree((u8 *)param); + kfree(param); ret = -EFAULT; goto out; } @@ -4817,7 +4817,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) ret = -EFAULT; - kfree((u8 *)param); + kfree(param); out: -- cgit v1.2.3-55-g7522 From 18cd9021ea035db85519391dbc429a5b1d0dd25b Mon Sep 17 00:00:00 2001 From: Suniel Mahesh Date: Fri, 16 Jun 2017 11:01:45 +0530 Subject: staging: wlan-ng: Fix struct definition's and variable type le16_to_cpu() accepts argument of type __le16 and cpu_to_le16() returns an argument of type __le16. This patch fixes: (a) the type of the variable that end's up getting return from cpu_to_le16(). (b) the member types of struct hfa384x_host_scan_request_data, struct hfa384x_bytestr32 and struct hfa384x_hscan_result_sub. The following type mismatch warnings reported by sparse have been fixed: warning: incorrect type in assignment (different base types) warning: cast to restricted __le16 Signed-off-by: Suniel Mahesh Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x.h | 18 +++++++++--------- drivers/staging/wlan-ng/prism2mgmt.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h index 60110b4b49f8..018db2299d0c 100644 --- a/drivers/staging/wlan-ng/hfa384x.h +++ b/drivers/staging/wlan-ng/hfa384x.h @@ -358,7 +358,7 @@ struct hfa384x_bytestr { } __packed; struct hfa384x_bytestr32 { - u16 len; + __le16 len; u8 data[32]; } __packed; @@ -399,8 +399,8 @@ struct hfa384x_caplevel { /*-- Configuration Record: HostScanRequest (data portion only) --*/ struct hfa384x_host_scan_request_data { - u16 channel_list; - u16 tx_rate; + __le16 channel_list; + __le16 tx_rate; struct hfa384x_bytestr32 ssid; } __packed; @@ -682,16 +682,16 @@ struct hfa384x_ch_info_result { /*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/ struct hfa384x_hscan_result_sub { - u16 chid; - u16 anl; - u16 sl; + __le16 chid; + __le16 anl; + __le16 sl; u8 bssid[WLAN_BSSID_LEN]; - u16 bcnint; - u16 capinfo; + __le16 bcnint; + __le16 capinfo; struct hfa384x_bytestr32 ssid; u8 supprates[10]; /* 802.11 info element */ u16 proberesp_rate; - u16 atim; + __le16 atim; } __packed; struct hfa384x_hscan_result { diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c index f4d6e4849987..c4aa9e7e7003 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.c +++ b/drivers/staging/wlan-ng/prism2mgmt.c @@ -213,7 +213,7 @@ int prism2mgmt_scan(struct wlandevice *wlandev, void *msgp) goto exit; } if (word == HFA384x_PORTSTATUS_DISABLED) { - u16 wordbuf[17]; + __le16 wordbuf[17]; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFROAMINGMODE, -- cgit v1.2.3-55-g7522 From 454527d0d94f49f96d893e6aa6d6df1b90f2a45f Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 25 Jun 2017 10:47:19 +0300 Subject: staging: ccree: fix hash import/export Hash import and export was saving and restoring the wrong context and therefore disabled. Fix it by restoring intermediate digest and additional state needed. The hash and mac transform now pass testmgr partial hash tests. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_hash.c | 143 +++++++++++++++++++++++++++------------ drivers/staging/ccree/ssi_hash.h | 2 + 2 files changed, 101 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index ed1c6725d69f..ffe8e1aff96a 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -976,22 +976,6 @@ static int ssi_hash_init(struct ahash_req_ctx *state, struct ssi_hash_ctx *ctx) return 0; } -#ifdef EXPORT_FIXED -static int ssi_hash_export(struct ssi_hash_ctx *ctx, void *out) -{ - CHECK_AND_RETURN_UPON_FIPS_ERROR(); - memcpy(out, ctx, sizeof(struct ssi_hash_ctx)); - return 0; -} - -static int ssi_hash_import(struct ssi_hash_ctx *ctx, const void *in) -{ - CHECK_AND_RETURN_UPON_FIPS_ERROR(); - memcpy(ctx, in, sizeof(struct ssi_hash_ctx)); - return 0; -} -#endif - static int ssi_hash_setkey(void *hash, const u8 *key, unsigned int keylen, @@ -1782,23 +1766,107 @@ static int ssi_ahash_init(struct ahash_request *req) return ssi_hash_init(state, ctx); } -#ifdef EXPORT_FIXED static int ssi_ahash_export(struct ahash_request *req, void *out) { struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash); + struct device *dev = &ctx->drvdata->plat_dev->dev; + struct ahash_req_ctx *state = ahash_request_ctx(req); + u8 *curr_buff = state->buff_index ? state->buff1 : state->buff0; + u32 curr_buff_cnt = state->buff_index ? state->buff1_cnt : + state->buff0_cnt; + const u32 tmp = CC_EXPORT_MAGIC; + + CHECK_AND_RETURN_UPON_FIPS_ERROR(); - return ssi_hash_export(ctx, out); + memcpy(out, &tmp, sizeof(u32)); + out += sizeof(u32); + + dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr, + ctx->inter_digestsize, DMA_BIDIRECTIONAL); + memcpy(out, state->digest_buff, ctx->inter_digestsize); + out += ctx->inter_digestsize; + + if (state->digest_bytes_len_dma_addr) { + dma_sync_single_for_cpu(dev, state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, DMA_BIDIRECTIONAL); + memcpy(out, state->digest_bytes_len, HASH_LEN_SIZE); + } else { + /* Poison the unused exported digest len field. */ + memset(out, 0x5F, HASH_LEN_SIZE); + } + out += HASH_LEN_SIZE; + + memcpy(out, &curr_buff_cnt, sizeof(u32)); + out += sizeof(u32); + + memcpy(out, curr_buff, curr_buff_cnt); + + /* No sync for device ineeded since we did not change the data, + * we only copy it + */ + + return 0; } static int ssi_ahash_import(struct ahash_request *req, const void *in) { struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash); + struct device *dev = &ctx->drvdata->plat_dev->dev; + struct ahash_req_ctx *state = ahash_request_ctx(req); + u32 tmp; + int rc; + + CHECK_AND_RETURN_UPON_FIPS_ERROR(); - return ssi_hash_import(ctx, in); + memcpy(&tmp, in, sizeof(u32)); + if (tmp != CC_EXPORT_MAGIC) { + rc = -EINVAL; + goto out; + } + in += sizeof(u32); + + rc = ssi_hash_init(state, ctx); + if (rc) + goto out; + + dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr, + ctx->inter_digestsize, DMA_BIDIRECTIONAL); + memcpy(state->digest_buff, in, ctx->inter_digestsize); + in += ctx->inter_digestsize; + + if (state->digest_bytes_len_dma_addr) { + dma_sync_single_for_cpu(dev, state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, DMA_BIDIRECTIONAL); + memcpy(state->digest_bytes_len, in, HASH_LEN_SIZE); + } + in += HASH_LEN_SIZE; + + dma_sync_single_for_device(dev, state->digest_buff_dma_addr, + ctx->inter_digestsize, DMA_BIDIRECTIONAL); + + if (state->digest_bytes_len_dma_addr) + dma_sync_single_for_device(dev, + state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, DMA_BIDIRECTIONAL); + + state->buff_index = 0; + + /* Sanity check the data as much as possible */ + memcpy(&tmp, in, sizeof(u32)); + if (tmp > SSI_MAX_HASH_BLCK_SIZE) { + rc = -EINVAL; + goto out; + } + in += sizeof(u32); + + state->buff0_cnt = tmp; + memcpy(state->buff0, in, state->buff0_cnt); + +out: + return rc; } -#endif static int ssi_ahash_setkey(struct crypto_ahash *ahash, const u8 *key, unsigned int keylen) @@ -1820,6 +1888,9 @@ struct ssi_hash_template { struct ssi_drvdata *drvdata; }; +#define CC_STATE_SIZE(_x) \ + ((_x) + HASH_LEN_SIZE + SSI_MAX_HASH_BLCK_SIZE + (2 * sizeof(u32))) + /* hash descriptors */ static struct ssi_hash_template driver_hash[] = { //Asynchronize hash template @@ -1836,14 +1907,12 @@ static struct ssi_hash_template driver_hash[] = { .final = ssi_ahash_final, .finup = ssi_ahash_finup, .digest = ssi_ahash_digest, -#ifdef EXPORT_FIXED .export = ssi_ahash_export, .import = ssi_ahash_import, -#endif .setkey = ssi_ahash_setkey, .halg = { .digestsize = SHA1_DIGEST_SIZE, - .statesize = sizeof(struct sha1_state), + .statesize = CC_STATE_SIZE(SHA1_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA1, @@ -1862,14 +1931,12 @@ static struct ssi_hash_template driver_hash[] = { .final = ssi_ahash_final, .finup = ssi_ahash_finup, .digest = ssi_ahash_digest, -#ifdef EXPORT_FIXED .export = ssi_ahash_export, .import = ssi_ahash_import, -#endif .setkey = ssi_ahash_setkey, .halg = { .digestsize = SHA256_DIGEST_SIZE, - .statesize = sizeof(struct sha256_state), + .statesize = CC_STATE_SIZE(SHA256_DIGEST_SIZE) }, }, .hash_mode = DRV_HASH_SHA256, @@ -1888,14 +1955,12 @@ static struct ssi_hash_template driver_hash[] = { .final = ssi_ahash_final, .finup = ssi_ahash_finup, .digest = ssi_ahash_digest, -#ifdef EXPORT_FIXED .export = ssi_ahash_export, .import = ssi_ahash_import, -#endif .setkey = ssi_ahash_setkey, .halg = { .digestsize = SHA224_DIGEST_SIZE, - .statesize = sizeof(struct sha256_state), + .statesize = CC_STATE_SIZE(SHA224_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA224, @@ -1915,14 +1980,12 @@ static struct ssi_hash_template driver_hash[] = { .final = ssi_ahash_final, .finup = ssi_ahash_finup, .digest = ssi_ahash_digest, -#ifdef EXPORT_FIXED .export = ssi_ahash_export, .import = ssi_ahash_import, -#endif .setkey = ssi_ahash_setkey, .halg = { .digestsize = SHA384_DIGEST_SIZE, - .statesize = sizeof(struct sha512_state), + .statesize = CC_STATE_SIZE(SHA384_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA384, @@ -1941,14 +2004,12 @@ static struct ssi_hash_template driver_hash[] = { .final = ssi_ahash_final, .finup = ssi_ahash_finup, .digest = ssi_ahash_digest, -#ifdef EXPORT_FIXED .export = ssi_ahash_export, .import = ssi_ahash_import, -#endif .setkey = ssi_ahash_setkey, .halg = { .digestsize = SHA512_DIGEST_SIZE, - .statesize = sizeof(struct sha512_state), + .statesize = CC_STATE_SIZE(SHA512_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA512, @@ -1968,14 +2029,12 @@ static struct ssi_hash_template driver_hash[] = { .final = ssi_ahash_final, .finup = ssi_ahash_finup, .digest = ssi_ahash_digest, -#ifdef EXPORT_FIXED .export = ssi_ahash_export, .import = ssi_ahash_import, -#endif .setkey = ssi_ahash_setkey, .halg = { .digestsize = MD5_DIGEST_SIZE, - .statesize = sizeof(struct md5_state), + .statesize = CC_STATE_SIZE(MD5_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_MD5, @@ -1993,13 +2052,11 @@ static struct ssi_hash_template driver_hash[] = { .finup = ssi_mac_finup, .digest = ssi_mac_digest, .setkey = ssi_xcbc_setkey, -#ifdef EXPORT_FIXED .export = ssi_ahash_export, .import = ssi_ahash_import, -#endif .halg = { .digestsize = AES_BLOCK_SIZE, - .statesize = sizeof(struct aeshash_state), + .statesize = CC_STATE_SIZE(AES_BLOCK_SIZE), }, }, .hash_mode = DRV_HASH_NULL, @@ -2018,13 +2075,11 @@ static struct ssi_hash_template driver_hash[] = { .finup = ssi_mac_finup, .digest = ssi_mac_digest, .setkey = ssi_cmac_setkey, -#ifdef EXPORT_FIXED .export = ssi_ahash_export, .import = ssi_ahash_import, -#endif .halg = { .digestsize = AES_BLOCK_SIZE, - .statesize = sizeof(struct aeshash_state), + .statesize = CC_STATE_SIZE(AES_BLOCK_SIZE), }, }, .hash_mode = DRV_HASH_NULL, diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index 7c946614a1f9..0bb99cb406f4 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -39,6 +39,8 @@ #define XCBC_MAC_K2_OFFSET 16 #define XCBC_MAC_K3_OFFSET 32 +#define CC_EXPORT_MAGIC 0xC2EE1070U + // this struct was taken from drivers/crypto/nx/nx-aes-xcbc.c and it is used for xcbc/cmac statesize struct aeshash_state { u8 state[AES_BLOCK_SIZE]; -- cgit v1.2.3-55-g7522 From c51831be99e13f117721d6e1908d12849e31cab9 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 25 Jun 2017 10:47:20 +0300 Subject: staging: ccree: register setkey for none hash macs The original ccree driver was registering a useless setkey method even for non-MAC hash transformations. Somewhere around v4.9 a check was added that failed hash operations if a setkey method was registered but was not called, so during the initial upstream port code was added to only register the setkey method for MAC type hash transform. Unfortunately, the ccree driver also registers non-hash based MAC transforms and the code had a logic error that stopped it registering a setkey callback even for those, thus rendering them useless. This commit fixes the logic mistake, thus correctly registering a setkey method only for MAC transformations, leaving it out for non-MAC ones, whether they are hash based on not. Fixes: 50cfbbb7e627 ("staging: ccree: add ahash support"). Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_hash.c | 83 ++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 41 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index ffe8e1aff96a..bfe2becfcbad 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1877,8 +1877,8 @@ static int ssi_ahash_setkey(struct crypto_ahash *ahash, struct ssi_hash_template { char name[CRYPTO_MAX_ALG_NAME]; char driver_name[CRYPTO_MAX_ALG_NAME]; - char hmac_name[CRYPTO_MAX_ALG_NAME]; - char hmac_driver_name[CRYPTO_MAX_ALG_NAME]; + char mac_name[CRYPTO_MAX_ALG_NAME]; + char mac_driver_name[CRYPTO_MAX_ALG_NAME]; unsigned int blocksize; bool synchronize; struct ahash_alg template_ahash; @@ -1897,8 +1897,8 @@ static struct ssi_hash_template driver_hash[] = { { .name = "sha1", .driver_name = "sha1-dx", - .hmac_name = "hmac(sha1)", - .hmac_driver_name = "hmac-sha1-dx", + .mac_name = "hmac(sha1)", + .mac_driver_name = "hmac-sha1-dx", .blocksize = SHA1_BLOCK_SIZE, .synchronize = false, .template_ahash = { @@ -1922,8 +1922,8 @@ static struct ssi_hash_template driver_hash[] = { { .name = "sha256", .driver_name = "sha256-dx", - .hmac_name = "hmac(sha256)", - .hmac_driver_name = "hmac-sha256-dx", + .mac_name = "hmac(sha256)", + .mac_driver_name = "hmac-sha256-dx", .blocksize = SHA256_BLOCK_SIZE, .template_ahash = { .init = ssi_ahash_init, @@ -1946,8 +1946,8 @@ static struct ssi_hash_template driver_hash[] = { { .name = "sha224", .driver_name = "sha224-dx", - .hmac_name = "hmac(sha224)", - .hmac_driver_name = "hmac-sha224-dx", + .mac_name = "hmac(sha224)", + .mac_driver_name = "hmac-sha224-dx", .blocksize = SHA224_BLOCK_SIZE, .template_ahash = { .init = ssi_ahash_init, @@ -1971,8 +1971,8 @@ static struct ssi_hash_template driver_hash[] = { { .name = "sha384", .driver_name = "sha384-dx", - .hmac_name = "hmac(sha384)", - .hmac_driver_name = "hmac-sha384-dx", + .mac_name = "hmac(sha384)", + .mac_driver_name = "hmac-sha384-dx", .blocksize = SHA384_BLOCK_SIZE, .template_ahash = { .init = ssi_ahash_init, @@ -1995,8 +1995,8 @@ static struct ssi_hash_template driver_hash[] = { { .name = "sha512", .driver_name = "sha512-dx", - .hmac_name = "hmac(sha512)", - .hmac_driver_name = "hmac-sha512-dx", + .mac_name = "hmac(sha512)", + .mac_driver_name = "hmac-sha512-dx", .blocksize = SHA512_BLOCK_SIZE, .template_ahash = { .init = ssi_ahash_init, @@ -2020,8 +2020,8 @@ static struct ssi_hash_template driver_hash[] = { { .name = "md5", .driver_name = "md5-dx", - .hmac_name = "hmac(md5)", - .hmac_driver_name = "hmac-md5-dx", + .mac_name = "hmac(md5)", + .mac_driver_name = "hmac-md5-dx", .blocksize = MD5_HMAC_BLOCK_SIZE, .template_ahash = { .init = ssi_ahash_init, @@ -2042,8 +2042,8 @@ static struct ssi_hash_template driver_hash[] = { .inter_digestsize = MD5_DIGEST_SIZE, }, { - .name = "xcbc(aes)", - .driver_name = "xcbc-aes-dx", + .mac_name = "xcbc(aes)", + .mac_driver_name = "xcbc-aes-dx", .blocksize = AES_BLOCK_SIZE, .template_ahash = { .init = ssi_ahash_init, @@ -2065,8 +2065,8 @@ static struct ssi_hash_template driver_hash[] = { }, #if SSI_CC_HAS_CMAC { - .name = "cmac(aes)", - .driver_name = "cmac-aes-dx", + .mac_name = "cmac(aes)", + .mac_driver_name = "cmac-aes-dx", .blocksize = AES_BLOCK_SIZE, .template_ahash = { .init = ssi_ahash_init, @@ -2109,9 +2109,9 @@ ssi_hash_create_alg(struct ssi_hash_template *template, bool keyed) if (keyed) { snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", - template->hmac_name); + template->mac_name); snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", - template->hmac_driver_name); + template->mac_driver_name); } else { halg->setkey = NULL; snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", @@ -2300,32 +2300,33 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) /* ahash registration */ for (alg = 0; alg < ARRAY_SIZE(driver_hash); alg++) { struct ssi_hash_alg *t_alg; + int hw_mode = driver_hash[alg].hw_mode; /* register hmac version */ + t_alg = ssi_hash_create_alg(&driver_hash[alg], true); + if (IS_ERR(t_alg)) { + rc = PTR_ERR(t_alg); + SSI_LOG_ERR("%s alg allocation failed\n", + driver_hash[alg].driver_name); + goto fail; + } + t_alg->drvdata = drvdata; - if ((((struct ssi_hash_template *)&driver_hash[alg])->hw_mode != DRV_CIPHER_XCBC_MAC) && - (((struct ssi_hash_template *)&driver_hash[alg])->hw_mode != DRV_CIPHER_CMAC)) { - t_alg = ssi_hash_create_alg(&driver_hash[alg], true); - if (IS_ERR(t_alg)) { - rc = PTR_ERR(t_alg); - SSI_LOG_ERR("%s alg allocation failed\n", - driver_hash[alg].driver_name); - goto fail; - } - t_alg->drvdata = drvdata; - - rc = crypto_register_ahash(&t_alg->ahash_alg); - if (unlikely(rc)) { - SSI_LOG_ERR("%s alg registration failed\n", - driver_hash[alg].driver_name); - kfree(t_alg); - goto fail; - } else { - list_add_tail(&t_alg->entry, - &hash_handle->hash_list); - } + rc = crypto_register_ahash(&t_alg->ahash_alg); + if (unlikely(rc)) { + SSI_LOG_ERR("%s alg registration failed\n", + driver_hash[alg].driver_name); + kfree(t_alg); + goto fail; + } else { + list_add_tail(&t_alg->entry, + &hash_handle->hash_list); } + if ((hw_mode == DRV_CIPHER_XCBC_MAC) || + (hw_mode == DRV_CIPHER_CMAC)) + continue; + /* register hash version */ t_alg = ssi_hash_create_alg(&driver_hash[alg], false); if (IS_ERR(t_alg)) { -- cgit v1.2.3-55-g7522 From b091fadb12b5544e632a5361302b5580b82bfa5b Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 25 Jun 2017 10:47:21 +0300 Subject: staging: ccree: remove unused function The function set_ack_last was not used anywhere. Remove it. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index aaa56c85bda2..f11487a7c969 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -225,18 +225,6 @@ static inline void set_queue_last_ind(struct cc_hw_desc *pdesc) pdesc->word[3] |= FIELD_PREP(WORD3_QUEUE_LAST_IND, 1); } -/* - * Signs the end of HW descriptors flow by asking for completion ack, - * and release the HW engines - * - * @pdesc: pointer HW descriptor struct - */ -static inline void set_ack_last(struct cc_hw_desc *pdesc) -{ - pdesc->word[3] |= FIELD_PREP(WORD3_QUEUE_LAST_IND, 1); - pdesc->word[4] |= FIELD_PREP(WORD4_ACK_NEEDED, 1); -} - /* * Set the DIN field of a HW descriptors * -- cgit v1.2.3-55-g7522 From 675ef02fcb1b958eebbd6cd013ab227396f1d2d5 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 25 Jun 2017 10:47:22 +0300 Subject: staging: ccree: add clock management support Some SoC which implement CryptoCell have a dedicated clock tied to it, some do not. Implement clock support if exists based on device tree data and tie power management to it. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/Makefile | 2 +- drivers/staging/ccree/ssi_driver.c | 43 +++++++++++++++++++++++---- drivers/staging/ccree/ssi_driver.h | 5 +++- drivers/staging/ccree/ssi_pm.c | 13 +++++---- drivers/staging/ccree/ssi_pm_ext.c | 60 -------------------------------------- drivers/staging/ccree/ssi_pm_ext.h | 33 --------------------- 6 files changed, 50 insertions(+), 106 deletions(-) delete mode 100644 drivers/staging/ccree/ssi_pm_ext.c delete mode 100644 drivers/staging/ccree/ssi_pm_ext.h (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/Makefile b/drivers/staging/ccree/Makefile index 44f3e3e33989..318c2b39acf6 100644 --- a/drivers/staging/ccree/Makefile +++ b/drivers/staging/ccree/Makefile @@ -1,3 +1,3 @@ obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o -ccree-y := ssi_driver.o ssi_sysfs.o ssi_buffer_mgr.o ssi_request_mgr.o ssi_cipher.o ssi_hash.o ssi_aead.o ssi_ivgen.o ssi_sram_mgr.o ssi_pm.o ssi_pm_ext.o +ccree-y := ssi_driver.o ssi_sysfs.o ssi_buffer_mgr.o ssi_request_mgr.o ssi_cipher.o ssi_hash.o ssi_aead.o ssi_ivgen.o ssi_sram_mgr.o ssi_pm.o ccree-$(CCREE_FIPS_SUPPORT) += ssi_fips.o ssi_fips_ll.o ssi_fips_ext.o ssi_fips_local.o diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index b9d0dd27e853..c516675558c9 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -57,6 +57,7 @@ #include #include #include +#include #include "ssi_config.h" #include "ssi_driver.h" @@ -219,6 +220,8 @@ static int init_cc_resources(struct platform_device *plat_dev) void __iomem *cc_base = NULL; bool irq_registered = false; struct ssi_drvdata *new_drvdata = kzalloc(sizeof(struct ssi_drvdata), GFP_KERNEL); + struct device *dev = &plat_dev->dev; + struct device_node *np = dev->of_node; u32 signature_val; int rc = 0; @@ -228,6 +231,8 @@ static int init_cc_resources(struct platform_device *plat_dev) goto init_cc_res_err; } + new_drvdata->clk = of_clk_get(np, 0); + /*Initialize inflight counter used in dx_ablkcipher_secure_complete used for count of BYSPASS blocks operations*/ new_drvdata->inflight_counter = 0; @@ -286,6 +291,10 @@ static int init_cc_resources(struct platform_device *plat_dev) new_drvdata->plat_dev = plat_dev; + rc = cc_clk_on(new_drvdata); + if (rc) + goto init_cc_res_err; + if(new_drvdata->plat_dev->dev.dma_mask == NULL) { new_drvdata->plat_dev->dev.dma_mask = & new_drvdata->plat_dev->dev.coherent_dma_mask; @@ -450,14 +459,11 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) ssi_sysfs_fini(); #endif - /* Mask all interrupts */ - WRITE_REGISTER(drvdata->cc_base + CC_REG_OFFSET(HOST_RGF, HOST_IMR), - 0xFFFFFFFF); + fini_cc_regs(drvdata); + cc_clk_off(drvdata); free_irq(drvdata->res_irq->start, drvdata); drvdata->res_irq = NULL; - fini_cc_regs(drvdata); - if (drvdata->cc_base != NULL) { iounmap(drvdata->cc_base); release_mem_region(drvdata->res_mem->start, @@ -470,6 +476,33 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) dev_set_drvdata(&plat_dev->dev, NULL); } +int cc_clk_on(struct ssi_drvdata *drvdata) +{ + struct clk *clk = drvdata->clk; + int rc; + + if (IS_ERR(clk)) + /* Not all devices have a clock associated with CCREE */ + return 0; + + rc = clk_prepare_enable(clk); + if (rc) + return rc; + + return 0; +} + +void cc_clk_off(struct ssi_drvdata *drvdata) +{ + struct clk *clk = drvdata->clk; + + if (IS_ERR(clk)) + /* Not all devices have a clock associated with CCREE */ + return; + + clk_disable_unprepare(clk); +} + static int cc7x_probe(struct platform_device *plat_dev) { int rc; diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 78a327aa9029..faf47b180134 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -36,6 +36,7 @@ #include #include #include +#include /* Registers definitions from shared/hw/ree_include */ #include "dx_reg_base_host.h" @@ -148,7 +149,7 @@ struct ssi_drvdata { void *ivgen_handle; void *sram_mgr_handle; u32 inflight_counter; - + struct clk *clk; }; struct ssi_crypto_alg { @@ -193,6 +194,8 @@ void dump_byte_array(const char *name, const u8 *the_array, unsigned long size); int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe); void fini_cc_regs(struct ssi_drvdata *drvdata); +int cc_clk_on(struct ssi_drvdata *drvdata); +void cc_clk_off(struct ssi_drvdata *drvdata); #endif /*__SSI_DRIVER_H__*/ diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c index 5bfbdd06dec2..67ae1dce1273 100644 --- a/drivers/staging/ccree/ssi_pm.c +++ b/drivers/staging/ccree/ssi_pm.c @@ -29,7 +29,6 @@ #include "ssi_ivgen.h" #include "ssi_hash.h" #include "ssi_pm.h" -#include "ssi_pm_ext.h" #if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) @@ -52,9 +51,7 @@ int ssi_power_mgr_runtime_suspend(struct device *dev) return rc; } fini_cc_regs(drvdata); - - /* Specific HW suspend code */ - ssi_pm_ext_hw_suspend(dev); + cc_clk_off(drvdata); return 0; } @@ -66,8 +63,12 @@ int ssi_power_mgr_runtime_resume(struct device *dev) SSI_LOG_DEBUG("ssi_power_mgr_runtime_resume , unset HOST_POWER_DOWN_EN\n"); WRITE_REGISTER(drvdata->cc_base + CC_REG_OFFSET(HOST_RGF, HOST_POWER_DOWN_EN), POWER_DOWN_DISABLE); - /* Specific HW resume code */ - ssi_pm_ext_hw_resume(dev); + + rc = cc_clk_on(drvdata); + if (rc) { + SSI_LOG_ERR("failed getting clock back on. We're toast.\n"); + return rc; + } rc = init_cc_regs(drvdata, false); if (rc !=0) { diff --git a/drivers/staging/ccree/ssi_pm_ext.c b/drivers/staging/ccree/ssi_pm_ext.c deleted file mode 100644 index 453151cdd6b2..000000000000 --- a/drivers/staging/ccree/ssi_pm_ext.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - - -#include "ssi_config.h" -#include -#include -#include -#include -#include -#include "ssi_driver.h" -#include "ssi_sram_mgr.h" -#include "ssi_pm_ext.h" - -/* - * This function should suspend the HW (if possiable), It should be implemented by - * the driver user. - * The reference code clears the internal SRAM to imitate lose of state. - */ -void ssi_pm_ext_hw_suspend(struct device *dev) -{ - struct ssi_drvdata *drvdata = - (struct ssi_drvdata *)dev_get_drvdata(dev); - unsigned int val; - void __iomem *cc_base = drvdata->cc_base; - unsigned int sram_addr = 0; - - CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, SRAM_ADDR), sram_addr); - - for (;sram_addr < SSI_CC_SRAM_SIZE ; sram_addr+=4) { - CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, SRAM_DATA), 0x0); - - do { - val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, SRAM_DATA_READY)); - } while (!(val &0x1)); - } -} - -/* - * This function should resume the HW (if possiable).It should be implemented by - * the driver user. - */ -void ssi_pm_ext_hw_resume(struct device *dev) -{ - return; -} - diff --git a/drivers/staging/ccree/ssi_pm_ext.h b/drivers/staging/ccree/ssi_pm_ext.h deleted file mode 100644 index dbe658b530bf..000000000000 --- a/drivers/staging/ccree/ssi_pm_ext.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -/* \file ssi_pm_ext.h - */ - -#ifndef __PM_EXT_H__ -#define __PM_EXT_H__ - - -#include "ssi_config.h" -#include "ssi_driver.h" - -void ssi_pm_ext_hw_suspend(struct device *dev); - -void ssi_pm_ext_hw_resume(struct device *dev); - - -#endif /*__POWER_MGR_H__*/ - -- cgit v1.2.3-55-g7522 From d255b343f52b78acff3d0af95b235a3b4f353377 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 25 Jun 2017 10:47:23 +0300 Subject: staging: ccree: add DT bus coherency detection The ccree driver has build time configurable support to work on top of coherent (e.g. ACP) vs. none coherent bus connections. Turn it to run-time configurable option based on device tree. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/Kconfig | 9 --------- drivers/staging/ccree/ssi_buffer_mgr.c | 37 ++++++++++++++++++---------------- drivers/staging/ccree/ssi_config.h | 20 ------------------ drivers/staging/ccree/ssi_driver.c | 12 ++++++++--- drivers/staging/ccree/ssi_driver.h | 3 +++ 5 files changed, 32 insertions(+), 49 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/Kconfig b/drivers/staging/ccree/Kconfig index 4be87f503e3b..ec3749d318d2 100644 --- a/drivers/staging/ccree/Kconfig +++ b/drivers/staging/ccree/Kconfig @@ -32,12 +32,3 @@ config CCREE_FIPS_SUPPORT Say 'Y' to enable support for FIPS compliant mode by the CCREE driver. If unsure say N. - -config CCREE_DISABLE_COHERENT_DMA_OPS - bool "Disable Coherent DMA operations for the CCREE driver" - depends on CRYPTO_DEV_CCREE - default n - help - Say 'Y' to disable the use of coherent DMA operations by the - CCREE driver for debugging purposes. - If unsure say N. diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 88ebda854377..4373d1dcc408 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -627,6 +627,7 @@ void ssi_buffer_mgr_unmap_aead_request( struct aead_req_ctx *areq_ctx = aead_request_ctx(req); unsigned int hw_iv_size = areq_ctx->hw_iv_size; struct crypto_aead *tfm = crypto_aead_reqtfm(req); + struct ssi_drvdata *drvdata = dev_get_drvdata(dev); u32 dummy; bool chained; u32 size_to_unmap = 0; @@ -700,8 +701,8 @@ void ssi_buffer_mgr_unmap_aead_request( dma_unmap_sg(dev, req->dst, ssi_buffer_mgr_get_sgl_nents(req->dst,size_to_unmap,&dummy,&chained), DMA_BIDIRECTIONAL); } -#if DX_HAS_ACP - if ((areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) && + if (drvdata->coherent && + (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) && likely(req->src == req->dst)) { u32 size_to_skip = req->assoclen; @@ -716,7 +717,6 @@ void ssi_buffer_mgr_unmap_aead_request( size_to_skip+ req->cryptlen - areq_ctx->req_authsize, size_to_skip+ req->cryptlen, SSI_SG_FROM_BUF); } -#endif } static inline int ssi_buffer_mgr_get_aead_icv_nents( @@ -981,20 +981,24 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( * MAC verification upon request completion */ if (direct == DRV_CRYPTO_DIRECTION_DECRYPT) { -#if !DX_HAS_ACP - /* In ACP platform we already copying ICV - * for any INPLACE-DECRYPT operation, hence + if (!drvdata->coherent) { + /* In coherent platforms (e.g. ACP) + * already copying ICV for any + * INPLACE-DECRYPT operation, hence * we must neglect this code. */ - u32 size_to_skip = req->assoclen; - if (areq_ctx->is_gcm4543) { - size_to_skip += crypto_aead_ivsize(tfm); + u32 skip = req->assoclen; + + if (areq_ctx->is_gcm4543) + skip += crypto_aead_ivsize(tfm); + + ssi_buffer_mgr_copy_scatterlist_portion( + areq_ctx->backup_mac, req->src, + (skip + req->cryptlen - + areq_ctx->req_authsize), + skip + req->cryptlen, + SSI_SG_TO_BUF); } - ssi_buffer_mgr_copy_scatterlist_portion( - areq_ctx->backup_mac, req->src, - size_to_skip+ req->cryptlen - areq_ctx->req_authsize, - size_to_skip+ req->cryptlen, SSI_SG_TO_BUF); -#endif areq_ctx->icv_virt_addr = areq_ctx->backup_mac; } else { areq_ctx->icv_virt_addr = areq_ctx->mac_buf; @@ -1281,8 +1285,8 @@ int ssi_buffer_mgr_map_aead_request( mlli_params->curr_pool = NULL; sg_data.num_of_buffers = 0; -#if DX_HAS_ACP - if ((areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) && + if (drvdata->coherent && + (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) && likely(req->src == req->dst)) { u32 size_to_skip = req->assoclen; @@ -1297,7 +1301,6 @@ int ssi_buffer_mgr_map_aead_request( size_to_skip+ req->cryptlen - areq_ctx->req_authsize, size_to_skip+ req->cryptlen, SSI_SG_TO_BUF); } -#endif /* cacluate the size for cipher remove ICV in decrypt*/ areq_ctx->cryptlen = (areq_ctx->gen_ctx.op_type == diff --git a/drivers/staging/ccree/ssi_config.h b/drivers/staging/ccree/ssi_config.h index b7c05765b2bd..ff7597c2d77e 100644 --- a/drivers/staging/ccree/ssi_config.h +++ b/drivers/staging/ccree/ssi_config.h @@ -23,7 +23,6 @@ #include -#define DISABLE_COHERENT_DMA_OPS //#define FLUSH_CACHE_ALL //#define COMPLETION_DELAY //#define DX_DUMP_DESCS @@ -33,24 +32,5 @@ //#define DX_IRQ_DELAY 100000 #define DMA_BIT_MASK_LEN 48 /* was 32 bit, but for juno's sake it was enlarged to 48 bit */ -#if defined (CONFIG_ARM64) // TODO currently only this mode was test on Juno (which is ARM64), need to enable coherent also. -#define DISABLE_COHERENT_DMA_OPS -#endif - -/* Define the CryptoCell DMA cache coherency signals configuration */ -#if defined (DISABLE_COHERENT_DMA_OPS) - /* Software Controlled Cache Coherency (SCCC) */ - #define SSI_CACHE_PARAMS (0x000) - /* CC attached to NONE-ACP such as HPP/ACE/AMBA4. - * The customer is responsible to enable/disable this feature - * according to his platform type. - */ - #define DX_HAS_ACP 0 -#else - #define SSI_CACHE_PARAMS (0xEEE) - /* CC attached to ACP */ - #define DX_HAS_ACP 1 -#endif - #endif /*__DX_CONFIG_H__*/ diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index c516675558c9..151afcfa602d 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -58,6 +58,7 @@ #include #include #include +#include #include "ssi_config.h" #include "ssi_driver.h" @@ -172,7 +173,7 @@ static irqreturn_t cc_isr(int irq, void *dev_id) int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe) { - unsigned int val; + unsigned int val, cache_params; void __iomem *cc_base = drvdata->cc_base; /* Unmask all AXI interrupt sources AXI_CFG1 register */ @@ -201,14 +202,18 @@ int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe) } #endif + cache_params = (drvdata->coherent ? CC_COHERENT_CACHE_PARAMS : 0x0); + val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS)); if (is_probe == true) { SSI_LOG_INFO("Cache params previous: 0x%08X\n", val); } - CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS), SSI_CACHE_PARAMS); + CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS), + cache_params); val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS)); if (is_probe == true) { - SSI_LOG_INFO("Cache params current: 0x%08X (expected: 0x%08X)\n", val, SSI_CACHE_PARAMS); + SSI_LOG_INFO("Cache params current: 0x%08X (expect: 0x%08X)\n", + val, cache_params); } return 0; @@ -232,6 +237,7 @@ static int init_cc_resources(struct platform_device *plat_dev) } new_drvdata->clk = of_clk_get(np, 0); + new_drvdata->coherent = of_dma_is_coherent(np); /*Initialize inflight counter used in dx_ablkcipher_secure_complete used for count of BYSPASS blocks operations*/ new_drvdata->inflight_counter = 0; diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index faf47b180134..1b8471bc1531 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -55,6 +55,8 @@ #define DRV_MODULE_VERSION "3.0" #define SSI_DEV_NAME_STR "cc715ree" +#define CC_COHERENT_CACHE_PARAMS 0xEEE + #define SSI_CC_HAS_AES_CCM 1 #define SSI_CC_HAS_AES_GCM 1 #define SSI_CC_HAS_AES_XTS 1 @@ -150,6 +152,7 @@ struct ssi_drvdata { void *sram_mgr_handle; u32 inflight_counter; struct clk *clk; + bool coherent; }; struct ssi_crypto_alg { -- cgit v1.2.3-55-g7522 From 0f2f02d1b57220951b9ae69abbcaa403163ee41b Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Sun, 25 Jun 2017 10:47:24 +0300 Subject: staging: ccree: use signal safe completion wait We were waiting for a completion notification of HW DMA operation using an interruptible wait which can result in data corruption if a signal interrupted us while DMA was not yet completed. Fix this by moving to uninterrupted wait. Fixes: abefd6741d ("staging: ccree: introduce CryptoCell HW driver"). Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_request_mgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 7c2d88a8fe60..2c6937af995d 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -382,7 +382,8 @@ int send_request( /* Wait upon sequence completion. * Return "0" -Operation done successfully. */ - return wait_for_completion_interruptible(&ssi_req->seq_compl); + wait_for_completion(&ssi_req->seq_compl); + return 0; } else { /* Operation still in process */ return -EINPROGRESS; -- cgit v1.2.3-55-g7522 From 81a6a4f0921249c24b490325a178d5ac3847ea55 Mon Sep 17 00:00:00 2001 From: Galo Navarro Date: Sat, 24 Jun 2017 20:32:55 +0200 Subject: staging: rtl8188eu: style fixes Fix multiple style issues (CHECK spaces preferred around that $operator). Signed-off-by: Galo Navarro Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index de9ab59f898d..fde306087844 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -370,7 +370,7 @@ void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, sq_final = padapter->recvpriv.signal_qual; /* the rssi value here is undecorated, and will be used for antenna diversity */ if (sq_smp != 101) /* from the right channel */ - rssi_final = (src->Rssi+dst->Rssi*4)/5; + rssi_final = (src->Rssi + dst->Rssi * 4) / 5; else rssi_final = rssi_ori; } else { @@ -1926,7 +1926,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ if (pqospriv->qos_option == 0) { out_len = *pout_len; - rtw_set_ie(out_ie+out_len, _VENDOR_SPECIFIC_IE_, + rtw_set_ie(out_ie + out_len, _VENDOR_SPECIFIC_IE_, _WMM_IE_Length_, WMM_IE, pout_len); pqospriv->qos_option = 1; @@ -2058,8 +2058,8 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr phtpriv = &psta->htpriv; if ((phtpriv->ht_option) && (phtpriv->ampdu_enable)) { - issued = (phtpriv->agg_enable_bitmap>>priority)&0x1; - issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1; + issued = (phtpriv->agg_enable_bitmap >> priority) & 0x1; + issued |= (phtpriv->candidate_tid_bitmap >> priority) & 0x1; if (issued == 0) { DBG_88E("rtw_issue_addbareq_cmd, p=%d\n", priority); -- cgit v1.2.3-55-g7522 From b8edc44c423cc5fbe42c42600c3254c51f5d8199 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Sun, 25 Jun 2017 13:43:56 +1200 Subject: staging: unisys: visorhba - octal permissions Fixed style of permissions to octal. Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorhba/visorhba_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 2fd31c9762c6..a6e7a6bbc428 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -1090,7 +1090,7 @@ static int visorhba_probe(struct visor_device *dev) goto err_scsi_remove_host; } devdata->debugfs_info = - debugfs_create_file("info", S_IRUSR | S_IRGRP, + debugfs_create_file("info", 0440, devdata->debugfs_dir, devdata, &info_debugfs_fops); if (!devdata->debugfs_info) { -- cgit v1.2.3-55-g7522 From d1c7b52c9695dc9449533b6b4cbbbf0589aa92ab Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Sun, 25 Jun 2017 13:49:38 +1200 Subject: staging: rtl8723bs - remove asm includes Fixed checkpatch warnings "Use #include instead of " Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/osdep_service_linux.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723bs/include/osdep_service_linux.h b/drivers/staging/rtl8723bs/include/osdep_service_linux.h index 486e8184b0b2..0c9b4f622fee 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service_linux.h +++ b/drivers/staging/rtl8723bs/include/osdep_service_linux.h @@ -26,10 +26,10 @@ /* include */ #include #include - #include + #include #include - #include - #include + #include + #include #include #include #include -- cgit v1.2.3-55-g7522 From 3fa4b5e58efd5c6278375be3ef30847a2914e9ce Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Sun, 25 Jun 2017 13:54:59 +1200 Subject: staging: sm750fb - add parameter names Fixed checkpatch.pl warnings of the form "function definition argument 'foo' should also have an identifier name" in header files. Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 5b186dafedec..4386122799b2 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -189,14 +189,22 @@ void hw_sm750_initAccel(struct sm750_dev *sm750_dev); int hw_sm750_deWait(void); int hw_sm750le_deWait(void); -int hw_sm750_output_setMode(struct lynxfb_output*, struct fb_var_screeninfo*, - struct fb_fix_screeninfo*); -int hw_sm750_crtc_checkMode(struct lynxfb_crtc*, struct fb_var_screeninfo*); -int hw_sm750_crtc_setMode(struct lynxfb_crtc*, struct fb_var_screeninfo*, - struct fb_fix_screeninfo*); -int hw_sm750_setColReg(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); -int hw_sm750_setBLANK(struct lynxfb_output*, int); -int hw_sm750le_setBLANK(struct lynxfb_output*, int); +int hw_sm750_output_setMode(struct lynxfb_output *output, + struct fb_var_screeninfo *var, + struct fb_fix_screeninfo *fix); + +int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc, + struct fb_var_screeninfo *var); + +int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, + struct fb_var_screeninfo *var, + struct fb_fix_screeninfo *fix); + +int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, + ushort red, ushort green, ushort blue); + +int hw_sm750_setBLANK(struct lynxfb_output *output, int blank); +int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank); int hw_sm750_pan_display(struct lynxfb_crtc *crtc, const struct fb_var_screeninfo *var, const struct fb_info *info); -- cgit v1.2.3-55-g7522 From 178f5f0f08e3b19294faed627312876e95ba1a86 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Sun, 25 Jun 2017 14:00:12 +1200 Subject: staging: rtl8192u - add parameter names Fixed checkpatch.pl warnings of "function definition argument FOO should also have an identifier name" Found using checkpatch Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h | 4 ++-- drivers/staging/rtl8192u/r8192U.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 899c77ed2a43..b062cad052b9 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -2187,7 +2187,7 @@ int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, struct sk_buff *frag, int hdr_len); int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); -void ieee80211_txb_free(struct ieee80211_txb *); +void ieee80211_txb_free(struct ieee80211_txb *txb); /* ieee80211_rx.c */ diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h index 005bf89aae65..a0aa0f5be63a 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h @@ -82,8 +82,8 @@ struct ieee80211_crypt_data { int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); -void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); -void ieee80211_crypt_deinit_handler(unsigned long); +void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force); +void ieee80211_crypt_deinit_handler(unsigned long data); void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, struct ieee80211_crypt_data **crypt); diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 4c7a5e3d3e5e..51c150a39fc2 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1147,9 +1147,9 @@ int write_nic_word(struct net_device *dev, int x, u16 y); int write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); -void rtl8192_rtx_disable(struct net_device *); -void rtl8192_rx_enable(struct net_device *); -void rtl8192_tx_enable(struct net_device *); +void rtl8192_rtx_disable(struct net_device *dev); +void rtl8192_rx_enable(struct net_device *dev); +void rtl8192_tx_enable(struct net_device *dev); void rtl8192_disassociate(struct net_device *dev); void rtl8185_set_rf_pins_enable(struct net_device *dev, u32 a); -- cgit v1.2.3-55-g7522 From 24c8bd8feb30f9762ef6c37ada656f80c3871df7 Mon Sep 17 00:00:00 2001 From: Derek Robson Date: Sun, 25 Jun 2017 13:38:17 +1200 Subject: staging: vt6655 - add parameter names Fix checkpatch.pl warnings of the form "function definition argument 'foo' should also have an identifier name" in header files. Signed-off-by: Derek Robson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/card.h | 30 ++++++++++----------- drivers/staging/vt6655/channel.h | 4 +-- drivers/staging/vt6655/mac.h | 58 ++++++++++++++++++++-------------------- drivers/staging/vt6655/power.h | 16 +++-------- drivers/staging/vt6655/rf.h | 16 +++++------ 5 files changed, 57 insertions(+), 67 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h index 03369ffaa4d6..1a04dbb57d42 100644 --- a/drivers/staging/vt6655/card.h +++ b/drivers/staging/vt6655/card.h @@ -64,25 +64,25 @@ typedef enum _CARD_STATUS_TYPE { struct vnt_private; void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type); -void CARDvUpdateBasicTopRate(struct vnt_private *); -bool CARDbIsOFDMinBasicRate(struct vnt_private *); -void CARDvSetLoopbackMode(struct vnt_private *, unsigned short wLoopbackMode); -bool CARDbSoftwareReset(struct vnt_private *); -void CARDvSetFirstNextTBTT(struct vnt_private *, +void CARDvUpdateBasicTopRate(struct vnt_private *priv); +bool CARDbIsOFDMinBasicRate(struct vnt_private *priv); +void CARDvSetLoopbackMode(struct vnt_private *priv, unsigned short wLoopbackMode); +bool CARDbSoftwareReset(struct vnt_private *priv); +void CARDvSetFirstNextTBTT(struct vnt_private *priv, unsigned short wBeaconInterval); -void CARDvUpdateNextTBTT(struct vnt_private *, u64 qwTSF, +void CARDvUpdateNextTBTT(struct vnt_private *priv, u64 qwTSF, unsigned short wBeaconInterval); -bool CARDbGetCurrentTSF(struct vnt_private *, u64 *pqwCurrTSF); +bool CARDbGetCurrentTSF(struct vnt_private *priv, u64 *pqwCurrTSF); u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval); u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2); -unsigned char CARDbyGetPktType(struct vnt_private *); -void CARDvSafeResetTx(struct vnt_private *); -void CARDvSafeResetRx(struct vnt_private *); -bool CARDbRadioPowerOff(struct vnt_private *); -bool CARDbRadioPowerOn(struct vnt_private *); -bool CARDbSetPhyParameter(struct vnt_private *, u8); -bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate, +unsigned char CARDbyGetPktType(struct vnt_private *priv); +void CARDvSafeResetTx(struct vnt_private *priv); +void CARDvSafeResetRx(struct vnt_private *priv); +bool CARDbRadioPowerOff(struct vnt_private *priv); +bool CARDbRadioPowerOn(struct vnt_private *priv); +bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type); +bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate, u64 qwBSSTimestamp); -bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval); +bool CARDbSetBeaconPeriod(struct vnt_private *priv, unsigned short wBeaconInterval); #endif /* __CARD_H__ */ diff --git a/drivers/staging/vt6655/channel.h b/drivers/staging/vt6655/channel.h index 2621dfabff06..8fe70760e548 100644 --- a/drivers/staging/vt6655/channel.h +++ b/drivers/staging/vt6655/channel.h @@ -21,8 +21,8 @@ #include "card.h" -void vnt_init_bands(struct vnt_private *); +void vnt_init_bands(struct vnt_private *priv); -bool set_channel(struct vnt_private *, struct ieee80211_channel *); +bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch); #endif /* _CHANNEL_H_ */ diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h index 33b758cb79d4..db401e32ae23 100644 --- a/drivers/staging/vt6655/mac.h +++ b/drivers/staging/vt6655/mac.h @@ -885,57 +885,57 @@ do { \ #define MACvSetRFLE_LatchBase(iobase) \ MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT) -bool MACbIsRegBitsOn(struct vnt_private *, unsigned char byRegOfs, +bool MACbIsRegBitsOn(struct vnt_private *priv, unsigned char byRegOfs, unsigned char byTestBits); -bool MACbIsRegBitsOff(struct vnt_private *, unsigned char byRegOfs, +bool MACbIsRegBitsOff(struct vnt_private *priv, unsigned char byRegOfs, unsigned char byTestBits); -bool MACbIsIntDisable(struct vnt_private *); +bool MACbIsIntDisable(struct vnt_private *priv); -void MACvSetShortRetryLimit(struct vnt_private *, unsigned char byRetryLimit); +void MACvSetShortRetryLimit(struct vnt_private *priv, unsigned char byRetryLimit); -void MACvSetLongRetryLimit(struct vnt_private *, unsigned char byRetryLimit); -void MACvGetLongRetryLimit(struct vnt_private *, +void MACvSetLongRetryLimit(struct vnt_private *priv, unsigned char byRetryLimit); +void MACvGetLongRetryLimit(struct vnt_private *priv, unsigned char *pbyRetryLimit); -void MACvSetLoopbackMode(struct vnt_private *, unsigned char byLoopbackMode); +void MACvSetLoopbackMode(struct vnt_private *priv, unsigned char byLoopbackMode); -void MACvSaveContext(struct vnt_private *, unsigned char *pbyCxtBuf); -void MACvRestoreContext(struct vnt_private *, unsigned char *pbyCxtBuf); +void MACvSaveContext(struct vnt_private *priv, unsigned char *pbyCxtBuf); +void MACvRestoreContext(struct vnt_private *priv, unsigned char *pbyCxtBuf); -bool MACbSoftwareReset(struct vnt_private *); -bool MACbSafeSoftwareReset(struct vnt_private *); -bool MACbSafeRxOff(struct vnt_private *); -bool MACbSafeTxOff(struct vnt_private *); -bool MACbSafeStop(struct vnt_private *); -bool MACbShutdown(struct vnt_private *); -void MACvInitialize(struct vnt_private *); -void MACvSetCurrRx0DescAddr(struct vnt_private *, +bool MACbSoftwareReset(struct vnt_private *priv); +bool MACbSafeSoftwareReset(struct vnt_private *priv); +bool MACbSafeRxOff(struct vnt_private *priv); +bool MACbSafeTxOff(struct vnt_private *priv); +bool MACbSafeStop(struct vnt_private *priv); +bool MACbShutdown(struct vnt_private *priv); +void MACvInitialize(struct vnt_private *priv); +void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 curr_desc_addr); -void MACvSetCurrRx1DescAddr(struct vnt_private *, +void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 curr_desc_addr); -void MACvSetCurrTXDescAddr(int iTxType, struct vnt_private *, +void MACvSetCurrTXDescAddr(int iTxType, struct vnt_private *priv, u32 curr_desc_addr); -void MACvSetCurrTx0DescAddrEx(struct vnt_private *, +void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv, u32 curr_desc_addr); -void MACvSetCurrAC0DescAddrEx(struct vnt_private *, +void MACvSetCurrAC0DescAddrEx(struct vnt_private *priv, u32 curr_desc_addr); -void MACvSetCurrSyncDescAddrEx(struct vnt_private *, +void MACvSetCurrSyncDescAddrEx(struct vnt_private *priv, u32 curr_desc_addr); -void MACvSetCurrATIMDescAddrEx(struct vnt_private *, +void MACvSetCurrATIMDescAddrEx(struct vnt_private *priv, u32 curr_desc_addr); -void MACvTimer0MicroSDelay(struct vnt_private *, unsigned int uDelay); -void MACvOneShotTimer1MicroSec(struct vnt_private *, unsigned int uDelayTime); +void MACvTimer0MicroSDelay(struct vnt_private *priv, unsigned int uDelay); +void MACvOneShotTimer1MicroSec(struct vnt_private *priv, unsigned int uDelayTime); -void MACvSetMISCFifo(struct vnt_private *, unsigned short wOffset, +void MACvSetMISCFifo(struct vnt_private *priv, unsigned short wOffset, u32 dwData); -bool MACbPSWakeup(struct vnt_private *); +bool MACbPSWakeup(struct vnt_private *priv); -void MACvSetKeyEntry(struct vnt_private *, unsigned short wKeyCtl, +void MACvSetKeyEntry(struct vnt_private *priv, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned int uKeyIdx, unsigned char *pbyAddr, u32 *pdwKey, unsigned char byLocalID); -void MACvDisableKeyEntry(struct vnt_private *, unsigned int uEntryIdx); +void MACvDisableKeyEntry(struct vnt_private *priv, unsigned int uEntryIdx); #endif /* __MAC_H__ */ diff --git a/drivers/staging/vt6655/power.h b/drivers/staging/vt6655/power.h index dfcb0ca8b448..f360c5966523 100644 --- a/drivers/staging/vt6655/power.h +++ b/drivers/staging/vt6655/power.h @@ -31,20 +31,10 @@ #define PS_FAST_INTERVAL 1 /* Fast power saving listen interval */ #define PS_MAX_INTERVAL 4 /* MAX power saving listen interval */ -void -PSvDisablePowerSaving( - struct vnt_private * -); +void PSvDisablePowerSaving(struct vnt_private *priv); -void -PSvEnablePowerSaving( - struct vnt_private *, - unsigned short wListenInterval -); +void PSvEnablePowerSaving(struct vnt_private *priv, unsigned short wListenInterval); -bool -PSbIsNextTBTTWakeUp( - struct vnt_private * -); +bool PSbIsNextTBTTWakeUp(struct vnt_private *priv); #endif /* __POWER_H__ */ diff --git a/drivers/staging/vt6655/rf.h b/drivers/staging/vt6655/rf.h index 37600093cab2..ba222301d49d 100644 --- a/drivers/staging/vt6655/rf.h +++ b/drivers/staging/vt6655/rf.h @@ -68,28 +68,28 @@ /*--------------------- Export Functions --------------------------*/ -bool IFRFbWriteEmbedded(struct vnt_private *, unsigned long dwData); -bool RFbSelectChannel(struct vnt_private *, unsigned char byRFType, u16); +bool IFRFbWriteEmbedded(struct vnt_private *priv, unsigned long dwData); +bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType, u16 byChannel); bool RFbInit( - struct vnt_private * + struct vnt_private *priv ); -bool RFvWriteWakeProgSyn(struct vnt_private *, unsigned char byRFType, u16); -bool RFbSetPower(struct vnt_private *, unsigned int rate, u16); +bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char byRFType, u16 uChannel); +bool RFbSetPower(struct vnt_private *priv, unsigned int rate, u16 uCH); bool RFbRawSetPower( - struct vnt_private *, + struct vnt_private *priv, unsigned char byPwr, unsigned int rate ); void RFvRSSITodBm( - struct vnt_private *, + struct vnt_private *priv, unsigned char byCurrRSSI, long *pldBm ); /* {{ RobertYu: 20050104 */ -bool RFbAL7230SelectChannelPostProcess(struct vnt_private *, u16, u16); +bool RFbAL7230SelectChannelPostProcess(struct vnt_private *priv, u16 byOldChannel, u16 byNewChannel); /* }} RobertYu */ #endif /* __RF_H__ */ -- cgit v1.2.3-55-g7522 From eebdd3f61bac853e1a42acc59f18c642d2a02eef Mon Sep 17 00:00:00 2001 From: Jaya Durga Date: Fri, 23 Jun 2017 16:54:40 +0530 Subject: Staging: rtl8712 : wifi.h: Fixed Macro argument reuse CHECK: Macro argument reuse 'pframe' - possible side-effects? Convert get_tofr_ds macro to inline functions to fix checkpatch check Signed-off-by: Jaya Durga Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/wifi.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h index 556367bfbe8a..0ed2f44ab4e9 100644 --- a/drivers/staging/rtl8712/wifi.h +++ b/drivers/staging/rtl8712/wifi.h @@ -170,8 +170,10 @@ enum WIFI_REG_DOMAIN { *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)); \ }) -#define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe)) - +static inline unsigned char get_tofr_ds(unsigned char *pframe) +{ + return ((GetToDs(pframe) << 1) | GetFrDs(pframe)); +} #define SetMFrag(pbuf) ({ \ *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \ -- cgit v1.2.3-55-g7522 From e4dd8bca3d5153503c1c923feb5c056124ea56ae Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Tue, 20 Jun 2017 11:07:32 +0100 Subject: staging: speakup: fix synth caching when synth init fails synths[] array caches currently loaded synths. synth_add checks synths[] before adding a new one. It however ignores the result of do_synth_init. So when do_synth_init fails, the failed synth is still cached. Since, as a result module loading fails too, synth_remove - which is responsible for removing the cached synth - is never called. Next time the failing synth is added again it succeeds because synth_add finds it cached inside synths[]. This patch fixes this by caching a synth only after do_synth_init succeeds. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/synth.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index 703553916097..a1ca68c76579 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -445,10 +445,15 @@ int synth_add(struct spk_synth *in_synth) mutex_unlock(&spk_mutex); return -1; } - synths[i++] = in_synth; - synths[i] = NULL; + if (in_synth->startup) status = do_synth_init(in_synth); + + if (!status) { + synths[i++] = in_synth; + synths[i] = NULL; + } + mutex_unlock(&spk_mutex); return status; } -- cgit v1.2.3-55-g7522 From 63307cb1230f739c23d6b5c6a2127be4b6cd4574 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:49:15 +0200 Subject: Revert "staging: fsl-mc: make dprc.h header private" This reverts commit 1877e4ba2d0890244284eea101681b6f990aa2be. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc.c | 2 +- drivers/staging/fsl-mc/bus/dprc.h | 268 ---------------------------- drivers/staging/fsl-mc/bus/fsl-mc-private.h | 1 - drivers/staging/fsl-mc/include/dprc.h | 268 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/include/mc.h | 1 + 5 files changed, 270 insertions(+), 270 deletions(-) delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h create mode 100644 drivers/staging/fsl-mc/include/dprc.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index 6f6c65a42166..138fe80577d8 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,7 +31,7 @@ */ #include #include "../include/mc.h" -#include "dprc.h" +#include "../include/dprc.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.h b/drivers/staging/fsl-mc/bus/dprc.h deleted file mode 100644 index 21295e4feb04..000000000000 --- a/drivers/staging/fsl-mc/bus/dprc.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 _FSL_DPRC_H -#define _FSL_DPRC_H - -/* - * Data Path Resource Container API - * Contains DPRC API for managing and querying DPAA resources - */ - -struct fsl_mc_io; -struct fsl_mc_obj_desc; - -int dprc_open(struct fsl_mc_io *mc_io, - u32 cmd_flags, - int container_id, - u16 *token); - -int dprc_close(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token); - -/* IRQ */ - -/* IRQ index */ -#define DPRC_IRQ_INDEX 0 - -/* Number of dprc's IRQs */ -#define DPRC_NUM_OF_IRQS 1 - -/* DPRC IRQ events */ - -/* IRQ event - Indicates that a new object added to the container */ -#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001 -/* IRQ event - Indicates that an object was removed from the container */ -#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002 -/* IRQ event - Indicates that resources added to the container */ -#define DPRC_IRQ_EVENT_RES_ADDED 0x00000004 -/* IRQ event - Indicates that resources removed from the container */ -#define DPRC_IRQ_EVENT_RES_REMOVED 0x00000008 -/* - * IRQ event - Indicates that one of the descendant containers that opened by - * this container is destroyed - */ -#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010 - -/* - * IRQ event - Indicates that on one of the container's opened object is - * destroyed - */ -#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020 - -/* Irq event - Indicates that object is created at the container */ -#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040 - -/** - * struct dprc_irq_cfg - IRQ configuration - * @paddr: Address that must be written to signal a message-based interrupt - * @val: Value to write into irq_addr address - * @irq_num: A user defined number associated with this IRQ - */ -struct dprc_irq_cfg { - phys_addr_t paddr; - u32 val; - int irq_num; -}; - -int dprc_set_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - int *type, - struct dprc_irq_cfg *irq_cfg); - -int dprc_set_irq_enable(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u8 en); - -int dprc_get_irq_enable(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u8 *en); - -int dprc_set_irq_mask(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 mask); - -int dprc_get_irq_mask(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 *mask); - -int dprc_get_irq_status(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 *status); - -int dprc_clear_irq_status(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 status); - -/** - * struct dprc_attributes - Container attributes - * @container_id: Container's ID - * @icid: Container's ICID - * @portal_id: Container's portal ID - * @options: Container's options as set at container's creation - */ -struct dprc_attributes { - int container_id; - u16 icid; - int portal_id; - u64 options; -}; - -int dprc_get_attributes(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - struct dprc_attributes *attributes); - -int dprc_get_obj_count(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - int *obj_count); - -int dprc_get_obj(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - int obj_index, - struct fsl_mc_obj_desc *obj_desc); - -int dprc_get_obj_desc(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - struct fsl_mc_obj_desc *obj_desc); - -int dprc_set_obj_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 irq_index, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_obj_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 irq_index, - int *type, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_res_count(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *type, - int *res_count); - -/** - * enum dprc_iter_status - Iteration status - * @DPRC_ITER_STATUS_FIRST: Perform first iteration - * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed - * @DPRC_ITER_STATUS_LAST: Indicates last iteration - */ -enum dprc_iter_status { - DPRC_ITER_STATUS_FIRST = 0, - DPRC_ITER_STATUS_MORE = 1, - DPRC_ITER_STATUS_LAST = 2 -}; - -/* Region flags */ -/* Cacheable - Indicates that region should be mapped as cacheable */ -#define DPRC_REGION_CACHEABLE 0x00000001 - -/** - * enum dprc_region_type - Region type - * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region - * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region - */ -enum dprc_region_type { - DPRC_REGION_TYPE_MC_PORTAL, - DPRC_REGION_TYPE_QBMAN_PORTAL -}; - -/** - * struct dprc_region_desc - Mappable region descriptor - * @base_offset: Region offset from region's base address. - * For DPMCP and DPRC objects, region base is offset from SoC MC portals - * base address; For DPIO, region base is offset from SoC QMan portals - * base address - * @size: Region size (in bytes) - * @flags: Region attributes - * @type: Portal region type - */ -struct dprc_region_desc { - u32 base_offset; - u32 size; - u32 flags; - enum dprc_region_type type; -}; - -int dprc_get_obj_region(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 region_index, - struct dprc_region_desc *region_desc); - -int dprc_get_api_version(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 *major_ver, - u16 *minor_ver); - -int dprc_get_container_id(struct fsl_mc_io *mc_io, - u32 cmd_flags, - int *container_id); - -#endif /* _FSL_DPRC_H */ - diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index 62d398947605..e5839992e128 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -11,7 +11,6 @@ #define _FSL_MC_PRIVATE_H_ #include "../include/mc.h" -#include "dprc.h" #include /** diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h new file mode 100644 index 000000000000..21295e4feb04 --- /dev/null +++ b/drivers/staging/fsl-mc/include/dprc.h @@ -0,0 +1,268 @@ +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 _FSL_DPRC_H +#define _FSL_DPRC_H + +/* + * Data Path Resource Container API + * Contains DPRC API for managing and querying DPAA resources + */ + +struct fsl_mc_io; +struct fsl_mc_obj_desc; + +int dprc_open(struct fsl_mc_io *mc_io, + u32 cmd_flags, + int container_id, + u16 *token); + +int dprc_close(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token); + +/* IRQ */ + +/* IRQ index */ +#define DPRC_IRQ_INDEX 0 + +/* Number of dprc's IRQs */ +#define DPRC_NUM_OF_IRQS 1 + +/* DPRC IRQ events */ + +/* IRQ event - Indicates that a new object added to the container */ +#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001 +/* IRQ event - Indicates that an object was removed from the container */ +#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002 +/* IRQ event - Indicates that resources added to the container */ +#define DPRC_IRQ_EVENT_RES_ADDED 0x00000004 +/* IRQ event - Indicates that resources removed from the container */ +#define DPRC_IRQ_EVENT_RES_REMOVED 0x00000008 +/* + * IRQ event - Indicates that one of the descendant containers that opened by + * this container is destroyed + */ +#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010 + +/* + * IRQ event - Indicates that on one of the container's opened object is + * destroyed + */ +#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020 + +/* Irq event - Indicates that object is created at the container */ +#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040 + +/** + * struct dprc_irq_cfg - IRQ configuration + * @paddr: Address that must be written to signal a message-based interrupt + * @val: Value to write into irq_addr address + * @irq_num: A user defined number associated with this IRQ + */ +struct dprc_irq_cfg { + phys_addr_t paddr; + u32 val; + int irq_num; +}; + +int dprc_set_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + int *type, + struct dprc_irq_cfg *irq_cfg); + +int dprc_set_irq_enable(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u8 en); + +int dprc_get_irq_enable(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u8 *en); + +int dprc_set_irq_mask(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 mask); + +int dprc_get_irq_mask(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 *mask); + +int dprc_get_irq_status(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 *status); + +int dprc_clear_irq_status(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 status); + +/** + * struct dprc_attributes - Container attributes + * @container_id: Container's ID + * @icid: Container's ICID + * @portal_id: Container's portal ID + * @options: Container's options as set at container's creation + */ +struct dprc_attributes { + int container_id; + u16 icid; + int portal_id; + u64 options; +}; + +int dprc_get_attributes(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + struct dprc_attributes *attributes); + +int dprc_get_obj_count(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + int *obj_count); + +int dprc_get_obj(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + int obj_index, + struct fsl_mc_obj_desc *obj_desc); + +int dprc_get_obj_desc(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + struct fsl_mc_obj_desc *obj_desc); + +int dprc_set_obj_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 irq_index, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_obj_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 irq_index, + int *type, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_res_count(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *type, + int *res_count); + +/** + * enum dprc_iter_status - Iteration status + * @DPRC_ITER_STATUS_FIRST: Perform first iteration + * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed + * @DPRC_ITER_STATUS_LAST: Indicates last iteration + */ +enum dprc_iter_status { + DPRC_ITER_STATUS_FIRST = 0, + DPRC_ITER_STATUS_MORE = 1, + DPRC_ITER_STATUS_LAST = 2 +}; + +/* Region flags */ +/* Cacheable - Indicates that region should be mapped as cacheable */ +#define DPRC_REGION_CACHEABLE 0x00000001 + +/** + * enum dprc_region_type - Region type + * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region + * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region + */ +enum dprc_region_type { + DPRC_REGION_TYPE_MC_PORTAL, + DPRC_REGION_TYPE_QBMAN_PORTAL +}; + +/** + * struct dprc_region_desc - Mappable region descriptor + * @base_offset: Region offset from region's base address. + * For DPMCP and DPRC objects, region base is offset from SoC MC portals + * base address; For DPIO, region base is offset from SoC QMan portals + * base address + * @size: Region size (in bytes) + * @flags: Region attributes + * @type: Portal region type + */ +struct dprc_region_desc { + u32 base_offset; + u32 size; + u32 flags; + enum dprc_region_type type; +}; + +int dprc_get_obj_region(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 region_index, + struct dprc_region_desc *region_desc); + +int dprc_get_api_version(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 *major_ver, + u16 *minor_ver); + +int dprc_get_container_id(struct fsl_mc_io *mc_io, + u32 cmd_flags, + int *container_id); + +#endif /* _FSL_DPRC_H */ + diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index aafe63a21f49..38f87144324a 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -14,6 +14,7 @@ #include #include #include +#include "../include/dprc.h" #define FSL_MC_VENDOR_FREESCALE 0x1957 -- cgit v1.2.3-55-g7522 From 57ebab2de359bb5def553ee3bdc7059b0f277bcb Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:50:33 +0200 Subject: Revert "staging: fsl-mc: move mc-cmd.h contents in the public header" This reverts commit 9b1aa45539fb8389deb79e4a939bfc05ee45aeb5. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpni.c | 1 + drivers/staging/fsl-mc/bus/dpbp.c | 1 + drivers/staging/fsl-mc/bus/dpcon.c | 1 + drivers/staging/fsl-mc/bus/dpio/dpio.c | 1 + drivers/staging/fsl-mc/bus/dpmcp.c | 1 + drivers/staging/fsl-mc/bus/dprc.c | 1 + drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 + drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 1 + drivers/staging/fsl-mc/bus/mc-sys.c | 1 + drivers/staging/fsl-mc/include/mc-cmd.h | 130 ++++++++++++++++++++++++++++++ drivers/staging/fsl-mc/include/mc.h | 95 +--------------------- 11 files changed, 140 insertions(+), 94 deletions(-) create mode 100644 drivers/staging/fsl-mc/include/mc-cmd.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c index 5b9d4424e4fb..160eaf88a3ae 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c @@ -33,6 +33,7 @@ #include #include #include "../../fsl-mc/include/mc.h" +#include "../../fsl-mc/include/mc-cmd.h" #include "dpni.h" #include "dpni-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index 363730a80cbb..b71467391a59 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -31,6 +31,7 @@ */ #include #include "../include/mc.h" +#include "../include/mc-cmd.h" #include "../include/dpbp.h" #include "dpbp-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index ca1da85c6dda..2272a9c45528 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -31,6 +31,7 @@ */ #include #include "../include/mc.h" +#include "../include/mc-cmd.h" #include "../include/dpcon.h" #include "dpcon-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index 00eb22186f42..48dce4af9363 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -32,6 +32,7 @@ */ #include #include "../../include/mc.h" +#include "../../include/mc-cmd.h" #include "dpio.h" #include "dpio-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index eea42f61af86..7b3dd19a46ef 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -31,6 +31,7 @@ */ #include #include "../include/mc.h" +#include "../include/mc-cmd.h" #include "dpmcp.h" #include "dpmcp-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index 138fe80577d8..f93fe009fb18 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,6 +31,7 @@ */ #include #include "../include/mc.h" +#include "../include/mc-cmd.h" #include "../include/dprc.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 19606e8d25dd..166604e22952 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,6 +20,7 @@ #include #include #include +#include "../include/mc-cmd.h" #include "fsl-mc-private.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index 2b64651bea90..81dca7a3a317 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -16,6 +16,7 @@ #include #include #include +#include "../include/mc-cmd.h" #include "fsl-mc-private.h" /* diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index a1704c3a6a78..c537bf8b5685 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -37,6 +37,7 @@ #include #include #include +#include "../include/mc-cmd.h" #include "../include/mc.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/include/mc-cmd.h b/drivers/staging/fsl-mc/include/mc-cmd.h new file mode 100644 index 000000000000..2e08aa31b084 --- /dev/null +++ b/drivers/staging/fsl-mc/include/mc-cmd.h @@ -0,0 +1,130 @@ +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 __FSL_MC_CMD_H +#define __FSL_MC_CMD_H + +#define MC_CMD_NUM_OF_PARAMS 7 + +struct mc_cmd_header { + u8 src_id; + u8 flags_hw; + u8 status; + u8 flags_sw; + __le16 token; + __le16 cmd_id; +}; + +struct mc_command { + u64 header; + u64 params[MC_CMD_NUM_OF_PARAMS]; +}; + +struct mc_rsp_create { + __le32 object_id; +}; + +struct mc_rsp_api_ver { + __le16 major_ver; + __le16 minor_ver; +}; + +enum mc_cmd_status { + MC_CMD_STATUS_OK = 0x0, /* Completed successfully */ + MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */ + MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */ + MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */ + MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */ + MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */ + MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */ + MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */ + MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */ + MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */ + MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */ + MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ +}; + +/* + * MC command flags + */ + +/* High priority flag */ +#define MC_CMD_FLAG_PRI 0x80 +/* Command completion flag */ +#define MC_CMD_FLAG_INTR_DIS 0x01 + +static inline u64 mc_encode_cmd_header(u16 cmd_id, + u32 cmd_flags, + u16 token) +{ + u64 header = 0; + struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header; + + hdr->cmd_id = cpu_to_le16(cmd_id); + hdr->token = cpu_to_le16(token); + hdr->status = MC_CMD_STATUS_READY; + if (cmd_flags & MC_CMD_FLAG_PRI) + hdr->flags_hw = MC_CMD_FLAG_PRI; + if (cmd_flags & MC_CMD_FLAG_INTR_DIS) + hdr->flags_sw = MC_CMD_FLAG_INTR_DIS; + + return header; +} + +static inline u16 mc_cmd_hdr_read_token(struct mc_command *cmd) +{ + struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; + u16 token = le16_to_cpu(hdr->token); + + return token; +} + +static inline u32 mc_cmd_read_object_id(struct mc_command *cmd) +{ + struct mc_rsp_create *rsp_params; + + rsp_params = (struct mc_rsp_create *)cmd->params; + return le32_to_cpu(rsp_params->object_id); +} + +static inline void mc_cmd_read_api_version(struct mc_command *cmd, + u16 *major_ver, + u16 *minor_ver) +{ + struct mc_rsp_api_ver *rsp_params; + + rsp_params = (struct mc_rsp_api_ver *)cmd->params; + *major_ver = le16_to_cpu(rsp_params->major_ver); + *minor_ver = le16_to_cpu(rsp_params->minor_ver); +} + +#endif /* __FSL_MC_CMD_H */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 38f87144324a..33bb3b8b641c 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -23,6 +23,7 @@ struct msi_domain_info; struct fsl_mc_device; struct fsl_mc_io; +struct mc_command; /** * struct fsl_mc_driver - MC object device driver object @@ -201,100 +202,6 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) -#define MC_CMD_NUM_OF_PARAMS 7 - -struct mc_cmd_header { - u8 src_id; - u8 flags_hw; - u8 status; - u8 flags_sw; - __le16 token; - __le16 cmd_id; -}; - -struct mc_command { - u64 header; - u64 params[MC_CMD_NUM_OF_PARAMS]; -}; - -enum mc_cmd_status { - MC_CMD_STATUS_OK = 0x0, /* Completed successfully */ - MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */ - MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */ - MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */ - MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */ - MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */ - MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */ - MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */ - MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */ - MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */ - MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */ - MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ -}; - -/* - * MC command flags - */ - -/* High priority flag */ -#define MC_CMD_FLAG_PRI 0x80 -/* Command completion flag */ -#define MC_CMD_FLAG_INTR_DIS 0x01 - -static inline u64 mc_encode_cmd_header(u16 cmd_id, - u32 cmd_flags, - u16 token) -{ - u64 header = 0; - struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header; - - hdr->cmd_id = cpu_to_le16(cmd_id); - hdr->token = cpu_to_le16(token); - hdr->status = MC_CMD_STATUS_READY; - if (cmd_flags & MC_CMD_FLAG_PRI) - hdr->flags_hw = MC_CMD_FLAG_PRI; - if (cmd_flags & MC_CMD_FLAG_INTR_DIS) - hdr->flags_sw = MC_CMD_FLAG_INTR_DIS; - - return header; -} - -static inline u16 mc_cmd_hdr_read_token(struct mc_command *cmd) -{ - struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; - u16 token = le16_to_cpu(hdr->token); - - return token; -} - -struct mc_rsp_create { - __le32 object_id; -}; - -struct mc_rsp_api_ver { - __le16 major_ver; - __le16 minor_ver; -}; - -static inline u32 mc_cmd_read_object_id(struct mc_command *cmd) -{ - struct mc_rsp_create *rsp_params; - - rsp_params = (struct mc_rsp_create *)cmd->params; - return le32_to_cpu(rsp_params->object_id); -} - -static inline void mc_cmd_read_api_version(struct mc_command *cmd, - u16 *major_ver, - u16 *minor_ver) -{ - struct mc_rsp_api_ver *rsp_params; - - rsp_params = (struct mc_rsp_api_ver *)cmd->params; - *major_ver = le16_to_cpu(rsp_params->major_ver); - *minor_ver = le16_to_cpu(rsp_params->minor_ver); -} - /** * Bit masks for a MC I/O object (struct fsl_mc_io) flags */ -- cgit v1.2.3-55-g7522 From c409c18b1409c824736570a0e14a4255a8b1cf88 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:50:41 +0200 Subject: Revert "staging: fsl-mc: move mc-sys.h contents in the public header" This reverts commit 7d6e221d73904aedcbd46ce2db6a545be55d2296. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 1 + drivers/staging/fsl-dpaa2/ethernet/dpni.c | 2 +- drivers/staging/fsl-mc/bus/dpbp.c | 2 +- drivers/staging/fsl-mc/bus/dpcon.c | 2 +- drivers/staging/fsl-mc/bus/dpio/dpio.c | 2 +- drivers/staging/fsl-mc/bus/dpmcp.c | 2 +- drivers/staging/fsl-mc/bus/dprc-driver.c | 2 +- drivers/staging/fsl-mc/bus/dprc.c | 1 + drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 2 +- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 + drivers/staging/fsl-mc/bus/mc-io.c | 2 +- drivers/staging/fsl-mc/bus/mc-sys.c | 1 + drivers/staging/fsl-mc/include/mc-sys.h | 98 ++++++++++++++++++++++++++ drivers/staging/fsl-mc/include/mc.h | 53 -------------- 14 files changed, 110 insertions(+), 61 deletions(-) create mode 100644 drivers/staging/fsl-mc/include/mc-sys.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index b9a0a315e6fb..1f89274a03d3 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -40,6 +40,7 @@ #include #include "../../fsl-mc/include/mc.h" +#include "../../fsl-mc/include/mc-sys.h" #include "dpaa2-eth.h" /* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c index 160eaf88a3ae..2c4b1a89c2c1 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c @@ -32,7 +32,7 @@ */ #include #include -#include "../../fsl-mc/include/mc.h" +#include "../../fsl-mc/include/mc-sys.h" #include "../../fsl-mc/include/mc-cmd.h" #include "dpni.h" #include "dpni-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index b71467391a59..e92d887de716 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc.h" +#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dpbp.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index 2272a9c45528..20df185aea5c 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc.h" +#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dpcon.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index 48dce4af9363..a18ca897ec3a 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -31,7 +31,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../../include/mc.h" +#include "../../include/mc-sys.h" #include "../../include/mc-cmd.h" #include "dpio.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index 7b3dd19a46ef..66011e86c805 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc.h" +#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 8e17cd862c3f..142dfa7b534b 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -13,7 +13,7 @@ #include #include #include -#include "../include/mc.h" +#include "../include/mc-sys.h" #include "dprc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index f93fe009fb18..e5dfc335dc4e 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,6 +31,7 @@ */ #include #include "../include/mc.h" +#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dprc.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index 8ea3920400a0..e6a2857a9a98 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -10,7 +10,7 @@ #include #include -#include "../include/mc.h" +#include "../include/mc-sys.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 166604e22952..75f8dc330f38 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,6 +20,7 @@ #include #include #include +#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index 35221a17858b..ec2835fb2a83 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -31,7 +31,7 @@ */ #include -#include "../include/mc.h" +#include "../include/mc-sys.h" #include "fsl-mc-private.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index c537bf8b5685..4d82802b384d 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -37,6 +37,7 @@ #include #include #include +#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/mc.h" diff --git a/drivers/staging/fsl-mc/include/mc-sys.h b/drivers/staging/fsl-mc/include/mc-sys.h new file mode 100644 index 000000000000..b5203707344a --- /dev/null +++ b/drivers/staging/fsl-mc/include/mc-sys.h @@ -0,0 +1,98 @@ +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. + * + * Interface of the I/O services to send MC commands to the MC hardware + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 _FSL_MC_SYS_H +#define _FSL_MC_SYS_H + +#include +#include +#include +#include + +/** + * Bit masks for a MC I/O object (struct fsl_mc_io) flags + */ +#define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001 + +struct mc_command; + +/** + * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command() + * @dev: device associated with this Mc I/O object + * @flags: flags for mc_send_command() + * @portal_size: MC command portal size in bytes + * @portal_phys_addr: MC command portal physical address + * @portal_virt_addr: MC command portal virtual address + * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal. + * + * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not + * set: + * @mutex: Mutex to serialize mc_send_command() calls that use the same MC + * portal, if the fsl_mc_io object was created with the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this + * fsl_mc_io object must be made only from non-atomic context. + * + * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is + * set: + * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC + * portal, if the fsl_mc_io object was created with the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this + * fsl_mc_io object can be made from atomic or non-atomic context. + */ +struct fsl_mc_io { + struct device *dev; + u16 flags; + u16 portal_size; + phys_addr_t portal_phys_addr; + void __iomem *portal_virt_addr; + struct fsl_mc_device *dpmcp_dev; + union { + /* + * This field is only meaningful if the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set + */ + struct mutex mutex; /* serializes mc_send_command() */ + + /* + * This field is only meaningful if the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set + */ + spinlock_t spinlock; /* serializes mc_send_command() */ + }; +}; + +int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); + +#endif /* _FSL_MC_SYS_H */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 33bb3b8b641c..d37e2c7ed55a 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -23,7 +23,6 @@ struct msi_domain_info; struct fsl_mc_device; struct fsl_mc_io; -struct mc_command; /** * struct fsl_mc_driver - MC object device driver object @@ -202,58 +201,6 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) -/** - * Bit masks for a MC I/O object (struct fsl_mc_io) flags - */ -#define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001 - -/** - * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command() - * @dev: device associated with this Mc I/O object - * @flags: flags for mc_send_command() - * @portal_size: MC command portal size in bytes - * @portal_phys_addr: MC command portal physical address - * @portal_virt_addr: MC command portal virtual address - * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal. - * - * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not - * set: - * @mutex: Mutex to serialize mc_send_command() calls that use the same MC - * portal, if the fsl_mc_io object was created with the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this - * fsl_mc_io object must be made only from non-atomic context. - * - * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is - * set: - * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC - * portal, if the fsl_mc_io object was created with the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this - * fsl_mc_io object can be made from atomic or non-atomic context. - */ -struct fsl_mc_io { - struct device *dev; - u16 flags; - u16 portal_size; - phys_addr_t portal_phys_addr; - void __iomem *portal_virt_addr; - struct fsl_mc_device *dpmcp_dev; - union { - /* - * This field is only meaningful if the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set - */ - struct mutex mutex; /* serializes mc_send_command() */ - - /* - * This field is only meaningful if the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set - */ - spinlock_t spinlock; /* serializes mc_send_command() */ - }; -}; - -int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); - #ifdef CONFIG_FSL_MC_BUS #define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) #else -- cgit v1.2.3-55-g7522 From 94ff934d8247bd9150142d31ef3d8ef898b6ba28 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:50:45 +0200 Subject: Revert "staging: fsl-mc: fix a few implicit includes" This reverts commit 5776aad3fe1bb87f3e4816cde8735647597da336. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dpbp.c | 1 - drivers/staging/fsl-mc/bus/dpcon.c | 1 - drivers/staging/fsl-mc/bus/dpio/dpio.c | 1 - drivers/staging/fsl-mc/bus/dpmcp.c | 1 - drivers/staging/fsl-mc/bus/dprc.c | 1 - 5 files changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index e92d887de716..d9e450a6bad6 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -29,7 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dpbp.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index 20df185aea5c..eb713578b817 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -29,7 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dpcon.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index a18ca897ec3a..d81e0232f6c1 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -30,7 +30,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include #include "../../include/mc-sys.h" #include "../../include/mc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index 66011e86c805..ad4c8b43f065 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -29,7 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index e5dfc335dc4e..a47f31d5ffe6 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -29,7 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include #include "../include/mc.h" #include "../include/mc-sys.h" #include "../include/mc-cmd.h" -- cgit v1.2.3-55-g7522 From 1b06739ca6b47646af368635f393235eba82e749 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:50:48 +0200 Subject: Revert "staging: fsl-mc: remove dpmng API files" This reverts commit b065307fe0ad7859f01ce8560e6bdc590324561a. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dpmng.c | 74 +++++++++++++++++++++++++++++++++ drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 53 +---------------------- drivers/staging/fsl-mc/include/dpmng.h | 67 +++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 52 deletions(-) create mode 100644 drivers/staging/fsl-mc/bus/dpmng.c create mode 100644 drivers/staging/fsl-mc/include/dpmng.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dpmng.c b/drivers/staging/fsl-mc/bus/dpmng.c new file mode 100644 index 000000000000..ad5d5bbec529 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dpmng.c @@ -0,0 +1,74 @@ +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 "../include/mc-sys.h" +#include "../include/mc-cmd.h" +#include "../include/dpmng.h" + +#include "dpmng-cmd.h" + +/** + * mc_get_version() - Retrieves the Management Complex firmware + * version information + * @mc_io: Pointer to opaque I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @mc_ver_info: Returned version information structure + * + * Return: '0' on Success; Error code otherwise. + */ +int mc_get_version(struct fsl_mc_io *mc_io, + u32 cmd_flags, + struct mc_version *mc_ver_info) +{ + struct mc_command cmd = { 0 }; + struct dpmng_rsp_get_version *rsp_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, + cmd_flags, + 0); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpmng_rsp_get_version *)cmd.params; + mc_ver_info->revision = le32_to_cpu(rsp_params->revision); + mc_ver_info->major = le32_to_cpu(rsp_params->version_major); + mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor); + + return 0; +} +EXPORT_SYMBOL(mc_get_version); + diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 75f8dc330f38..3dec3e991d86 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,12 +20,11 @@ #include #include #include +#include "../include/dpmng.h" #include "../include/mc-sys.h" -#include "../include/mc-cmd.h" #include "fsl-mc-private.h" #include "dprc-cmd.h" -#include "dpmng-cmd.h" /** * Default DMA mask for devices on a fsl-mc bus @@ -60,20 +59,6 @@ struct fsl_mc_addr_translation_range { phys_addr_t start_phys_addr; }; -/** - * struct mc_version - * @major: Major version number: incremented on API compatibility changes - * @minor: Minor version number: incremented on API additions (that are - * backward compatible); reset when major version is incremented - * @revision: Internal revision number: incremented on implementation changes - * and/or bug fixes that have no impact on API - */ -struct mc_version { - u32 major; - u32 minor; - u32 revision; -}; - /** * fsl_mc_bus_match - device to driver matching callback * @dev: the fsl-mc device to match against @@ -252,42 +237,6 @@ void fsl_mc_driver_unregister(struct fsl_mc_driver *mc_driver) } EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister); -/** - * mc_get_version() - Retrieves the Management Complex firmware - * version information - * @mc_io: Pointer to opaque I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @mc_ver_info: Returned version information structure - * - * Return: '0' on Success; Error code otherwise. - */ -static int mc_get_version(struct fsl_mc_io *mc_io, - u32 cmd_flags, - struct mc_version *mc_ver_info) -{ - struct mc_command cmd = { 0 }; - struct dpmng_rsp_get_version *rsp_params; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, - cmd_flags, - 0); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - rsp_params = (struct dpmng_rsp_get_version *)cmd.params; - mc_ver_info->revision = le32_to_cpu(rsp_params->revision); - mc_ver_info->major = le32_to_cpu(rsp_params->version_major); - mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor); - - return 0; -} - /** * fsl_mc_get_root_dprc - function to traverse to the root dprc */ diff --git a/drivers/staging/fsl-mc/include/dpmng.h b/drivers/staging/fsl-mc/include/dpmng.h new file mode 100644 index 000000000000..170c07dd376a --- /dev/null +++ b/drivers/staging/fsl-mc/include/dpmng.h @@ -0,0 +1,67 @@ +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 __FSL_DPMNG_H +#define __FSL_DPMNG_H + +/* + * Management Complex General API + * Contains general API for the Management Complex firmware + */ + +struct fsl_mc_io; + +/** + * Management Complex firmware version information + */ +#define MC_VER_MAJOR 8 +#define MC_VER_MINOR 0 + +/** + * struct mc_version + * @major: Major version number: incremented on API compatibility changes + * @minor: Minor version number: incremented on API additions (that are + * backward compatible); reset when major version is incremented + * @revision: Internal revision number: incremented on implementation changes + * and/or bug fixes that have no impact on API + */ +struct mc_version { + u32 major; + u32 minor; + u32 revision; +}; + +int mc_get_version(struct fsl_mc_io *mc_io, + u32 cmd_flags, + struct mc_version *mc_ver_info); + +#endif /* __FSL_DPMNG_H */ -- cgit v1.2.3-55-g7522 From 8a325e9f77fe3c1de760328c5e52ea48d617725f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:50:51 +0200 Subject: Revert "staging: fsl-mc: move rest of mc-bus.h to private header" This reverts commit af4376710cc5188c42eb473676f6c9d2a16692c4. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 1 + drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 1 + drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 + drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 1 + drivers/staging/fsl-mc/bus/fsl-mc-private.h | 61 ----------------- .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 1 + drivers/staging/fsl-mc/bus/mc-io.c | 1 + drivers/staging/fsl-mc/include/mc-bus.h | 77 ++++++++++++++++++++++ 8 files changed, 83 insertions(+), 61 deletions(-) create mode 100644 drivers/staging/fsl-mc/include/mc-bus.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 142dfa7b534b..844796189586 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -13,6 +13,7 @@ #include #include #include +#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index e6a2857a9a98..c2af5b570222 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -10,6 +10,7 @@ #include #include +#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 3dec3e991d86..60b2a40b4a2f 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,6 +20,7 @@ #include #include #include +#include "../include/mc-bus.h" #include "../include/dpmng.h" #include "../include/mc-sys.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index 81dca7a3a317..a92fa5a3ff42 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -16,6 +16,7 @@ #include #include #include +#include "../include/mc-bus.h" #include "../include/mc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index e5839992e128..7f5406f75908 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -11,53 +11,6 @@ #define _FSL_MC_PRIVATE_H_ #include "../include/mc.h" -#include - -/** - * Maximum number of total IRQs that can be pre-allocated for an MC bus' - * IRQ pool - */ -#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 - -/** - * struct fsl_mc_resource_pool - Pool of MC resources of a given - * type - * @type: type of resources in the pool - * @max_count: maximum number of resources in the pool - * @free_count: number of free resources in the pool - * @mutex: mutex to serialize access to the pool's free list - * @free_list: anchor node of list of free resources in the pool - * @mc_bus: pointer to the MC bus that owns this resource pool - */ -struct fsl_mc_resource_pool { - enum fsl_mc_pool_type type; - int max_count; - int free_count; - struct mutex mutex; /* serializes access to free_list */ - struct list_head free_list; - struct fsl_mc_bus *mc_bus; -}; - -/** - * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC - * @mc_dev: fsl-mc device for the bus device itself. - * @resource_pools: array of resource pools (one pool per resource type) - * for this MC bus. These resources represent allocatable entities - * from the physical DPRC. - * @irq_resources: Pointer to array of IRQ objects for the IRQ pool - * @scan_mutex: Serializes bus scanning - * @dprc_attr: DPRC attributes - */ -struct fsl_mc_bus { - struct fsl_mc_device mc_dev; - struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; - struct fsl_mc_device_irq *irq_resources; - struct mutex scan_mutex; /* serializes bus scanning */ - struct dprc_attributes dprc_attr; -}; - -#define to_fsl_mc_bus(_mc_dev) \ - container_of(_mc_dev, struct fsl_mc_bus, mc_dev) int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, @@ -74,10 +27,6 @@ int __init fsl_mc_allocator_driver_init(void); void fsl_mc_allocator_driver_exit(void); -void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); - -void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); - int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, enum fsl_mc_pool_type pool_type, struct fsl_mc_resource @@ -94,14 +43,6 @@ int __init its_fsl_mc_msi_init(void); void its_fsl_mc_msi_cleanup(void); -int fsl_mc_find_msi_domain(struct device *mc_platform_dev, - struct irq_domain **mc_msi_domain); - -int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, - unsigned int irq_count); - -void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus); - int __must_check fsl_create_mc_io(struct device *dev, phys_addr_t mc_portal_phys_addr, u32 mc_portal_size, @@ -110,6 +51,4 @@ int __must_check fsl_create_mc_io(struct device *dev, void fsl_destroy_mc_io(struct fsl_mc_io *mc_io); -bool fsl_mc_is_root_dprc(struct device *dev); - #endif /* _FSL_MC_PRIVATE_H_ */ diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c index 865d38517508..49127acb85b2 100644 --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c @@ -16,6 +16,7 @@ #include #include #include +#include "../include/mc-bus.h" #include "fsl-mc-private.h" static struct irq_chip its_msi_irq_chip = { diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index ec2835fb2a83..d66b87f0903b 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -31,6 +31,7 @@ */ #include +#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h new file mode 100644 index 000000000000..a79a679578d2 --- /dev/null +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -0,0 +1,77 @@ +/* + * Freescale Management Complex (MC) bus declarations + * + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. + * Author: German Rivera + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ +#ifndef _FSL_MC_MCBUS_H_ +#define _FSL_MC_MCBUS_H_ + +#include "../include/mc.h" +#include + +/** + * Maximum number of total IRQs that can be pre-allocated for an MC bus' + * IRQ pool + */ +#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 + +/** + * struct fsl_mc_resource_pool - Pool of MC resources of a given + * type + * @type: type of resources in the pool + * @max_count: maximum number of resources in the pool + * @free_count: number of free resources in the pool + * @mutex: mutex to serialize access to the pool's free list + * @free_list: anchor node of list of free resources in the pool + * @mc_bus: pointer to the MC bus that owns this resource pool + */ +struct fsl_mc_resource_pool { + enum fsl_mc_pool_type type; + int max_count; + int free_count; + struct mutex mutex; /* serializes access to free_list */ + struct list_head free_list; + struct fsl_mc_bus *mc_bus; +}; + +/** + * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC + * @mc_dev: fsl-mc device for the bus device itself. + * @resource_pools: array of resource pools (one pool per resource type) + * for this MC bus. These resources represent allocatable entities + * from the physical DPRC. + * @irq_resources: Pointer to array of IRQ objects for the IRQ pool + * @scan_mutex: Serializes bus scanning + * @dprc_attr: DPRC attributes + */ +struct fsl_mc_bus { + struct fsl_mc_device mc_dev; + struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; + struct fsl_mc_device_irq *irq_resources; + struct mutex scan_mutex; /* serializes bus scanning */ + struct dprc_attributes dprc_attr; +}; + +#define to_fsl_mc_bus(_mc_dev) \ + container_of(_mc_dev, struct fsl_mc_bus, mc_dev) + +int fsl_mc_find_msi_domain(struct device *mc_platform_dev, + struct irq_domain **mc_msi_domain); + +int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, + unsigned int irq_count); + +void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus); + +void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); + +void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); + +bool fsl_mc_is_root_dprc(struct device *dev); + +#endif /* _FSL_MC_MCBUS_H_ */ -- cgit v1.2.3-55-g7522 From 2f81d686ad91d6ad4a2818a657500c80962cf25f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:50:54 +0200 Subject: Revert "staging: fsl-mc: move couple of definitions to public header" This reverts commit 7eba570ece326ea0da2da72f1d4142100c145827. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 9 +++++++++ drivers/staging/fsl-mc/include/mc.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index a79a679578d2..0860681bddc6 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -20,6 +20,13 @@ */ #define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 +#ifdef CONFIG_FSL_MC_BUS +#define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) +#else +/* If fsl-mc bus is not present device cannot belong to fsl-mc bus */ +#define dev_is_fsl_mc(_dev) (0) +#endif + /** * struct fsl_mc_resource_pool - Pool of MC resources of a given * type @@ -74,4 +81,6 @@ void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); bool fsl_mc_is_root_dprc(struct device *dev); +extern struct bus_type fsl_mc_bus_type; + #endif /* _FSL_MC_MCBUS_H_ */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index d37e2c7ed55a..adb237845b40 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -201,13 +201,6 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) -#ifdef CONFIG_FSL_MC_BUS -#define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) -#else -/* If fsl-mc bus is not present device cannot belong to fsl-mc bus */ -#define dev_is_fsl_mc(_dev) (0) -#endif - /* * module_fsl_mc_driver() - Helper macro for drivers that don't do * anything special in module init/exit. This eliminates a lot of @@ -251,6 +244,4 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); -extern struct bus_type fsl_mc_bus_type; - #endif /* _FSL_MC_H_ */ -- cgit v1.2.3-55-g7522 From 3943749bc4518645c9440ed206f7e44038234f37 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:50:58 +0200 Subject: Revert "staging: fsl-mc: move irq domain creation prototype to public header" This reverts commit b32cdde14edec1c75a2190a39e810bf41fa29a7a. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 7 +++++++ drivers/staging/fsl-mc/include/mc.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index 0860681bddc6..c1df43357c56 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -14,6 +14,9 @@ #include "../include/mc.h" #include +struct irq_domain; +struct msi_domain_info; + /** * Maximum number of total IRQs that can be pre-allocated for an MC bus' * IRQ pool @@ -67,6 +70,10 @@ struct fsl_mc_bus { #define to_fsl_mc_bus(_mc_dev) \ container_of(_mc_dev, struct fsl_mc_bus, mc_dev) +struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, + struct msi_domain_info *info, + struct irq_domain *parent); + int fsl_mc_find_msi_domain(struct device *mc_platform_dev, struct irq_domain **mc_msi_domain); diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index adb237845b40..60c706720531 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -18,9 +18,6 @@ #define FSL_MC_VENDOR_FREESCALE 0x1957 -struct irq_domain; -struct msi_domain_info; - struct fsl_mc_device; struct fsl_mc_io; @@ -236,10 +233,6 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, void fsl_mc_object_free(struct fsl_mc_device *mc_adev); -struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, - struct msi_domain_info *info, - struct irq_domain *parent); - int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); -- cgit v1.2.3-55-g7522 From ae74754d5484b88bc9f5415254dc028cc24bbf65 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:51:01 +0200 Subject: Revert "staging: fsl-mc: turn several exported functions static" This reverts commit 10a8593a76c7719e110e334f84a6ef2068dd4c0f. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 8 +++++--- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 5 +++-- drivers/staging/fsl-mc/include/mc-bus.h | 8 ++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 844796189586..ff65e70a67a6 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -220,8 +220,8 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, * populated before they can get allocation requests from probe callbacks * of the device drivers for the non-allocatable devices. */ -static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, - unsigned int *total_irq_count) +int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, + unsigned int *total_irq_count) { int num_child_objects; int dprc_get_obj_failures; @@ -309,6 +309,7 @@ static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, return 0; } +EXPORT_SYMBOL_GPL(dprc_scan_objects); /** * dprc_scan_container - Scans a physical DPRC and synchronizes Linux bus state @@ -319,7 +320,7 @@ static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, * bus driver with the actual state of the MC by adding and removing * devices as appropriate. */ -static int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) +int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) { int error; unsigned int irq_count; @@ -355,6 +356,7 @@ error: fsl_mc_cleanup_all_resource_pools(mc_bus_dev); return error; } +EXPORT_SYMBOL_GPL(dprc_scan_container); /** * dprc_irq0_handler - Regular ISR for DPRC interrupt 0 diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 60b2a40b4a2f..8725a5cbc3aa 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -241,8 +241,8 @@ EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister); /** * fsl_mc_get_root_dprc - function to traverse to the root dprc */ -static void fsl_mc_get_root_dprc(struct device *dev, - struct device **root_dprc_dev) +void fsl_mc_get_root_dprc(struct device *dev, + struct device **root_dprc_dev) { if (WARN_ON(!dev)) { *root_dprc_dev = NULL; @@ -254,6 +254,7 @@ static void fsl_mc_get_root_dprc(struct device *dev, *root_dprc_dev = (*root_dprc_dev)->parent; } } +EXPORT_SYMBOL_GPL(fsl_mc_get_root_dprc); static int get_dprc_attr(struct fsl_mc_io *mc_io, int container_id, struct dprc_attributes *attr) diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index c1df43357c56..aac062e2b6ef 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -70,6 +70,11 @@ struct fsl_mc_bus { #define to_fsl_mc_bus(_mc_dev) \ container_of(_mc_dev, struct fsl_mc_bus, mc_dev) +int dprc_scan_container(struct fsl_mc_device *mc_bus_dev); + +int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, + unsigned int *total_irq_count); + struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, struct msi_domain_info *info, struct irq_domain *parent); @@ -86,6 +91,9 @@ void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); +void fsl_mc_get_root_dprc(struct device *dev, + struct device **root_dprc_dev); + bool fsl_mc_is_root_dprc(struct device *dev); extern struct bus_type fsl_mc_bus_type; -- cgit v1.2.3-55-g7522 From a39476d62acee1520a1e59cf72b8ff4de4e09ce0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:51:05 +0200 Subject: Revert "staging: fsl-mc: delete prototype of unimplemented function" This reverts commit be6faff74cda2ac1838c0f85dca3c3ce4975fa73. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index aac062e2b6ef..8f9bf8dd6495 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -91,6 +91,8 @@ void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); +bool fsl_mc_bus_exists(void); + void fsl_mc_get_root_dprc(struct device *dev, struct device **root_dprc_dev); -- cgit v1.2.3-55-g7522 From e903e20d7e027a3d49b52dedf419cc25dffb537b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:51:08 +0200 Subject: Revert "staging: fsl-mc: delete duplicated function prototypes" This reverts commit 48d3cfb3189a88e1670f609f8bd7d55839d531cf. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index 8f9bf8dd6495..42700de94d59 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -75,6 +75,14 @@ int dprc_scan_container(struct fsl_mc_device *mc_bus_dev); int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, unsigned int *total_irq_count); +int __init dprc_driver_init(void); + +void dprc_driver_exit(void); + +int __init fsl_mc_allocator_driver_init(void); + +void fsl_mc_allocator_driver_exit(void); + struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, struct msi_domain_info *info, struct irq_domain *parent); -- cgit v1.2.3-55-g7522 From 2246ad16be757e4eaa4a32114ae0b623bb4bf6e2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:51:11 +0200 Subject: Revert "staging: fsl-mc: decouple the mc-bus public headers from dprc.h" This reverts commit c6ce019edb0c9c09b8150011d4f66181952631e9. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 38 ++++++++++++------------ drivers/staging/fsl-mc/bus/dprc.c | 3 +- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 12 ++++---- drivers/staging/fsl-mc/bus/fsl-mc-private.h | 2 +- drivers/staging/fsl-mc/include/dprc.h | 46 +++++++++++++++++++++++++++-- drivers/staging/fsl-mc/include/mc.h | 41 +------------------------ 6 files changed, 71 insertions(+), 71 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index ff65e70a67a6..80c080f20da1 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -21,13 +21,13 @@ #define FSL_MC_DPRC_DRIVER_NAME "fsl_mc_dprc" -struct fsl_mc_child_objs { +struct dprc_child_objs { int child_count; - struct fsl_mc_obj_desc *child_array; + struct dprc_obj_desc *child_array; }; static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, - struct fsl_mc_obj_desc *obj_desc) + struct dprc_obj_desc *obj_desc) { return !strcmp(mc_dev->obj_desc.type, obj_desc->type) && mc_dev->obj_desc.id == obj_desc->id; @@ -36,7 +36,7 @@ static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) { int i; - struct fsl_mc_child_objs *objs; + struct dprc_child_objs *objs; struct fsl_mc_device *mc_dev; WARN_ON(!dev); @@ -45,7 +45,7 @@ static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) objs = data; for (i = 0; i < objs->child_count; i++) { - struct fsl_mc_obj_desc *obj_desc = &objs->child_array[i]; + struct dprc_obj_desc *obj_desc = &objs->child_array[i]; if (strlen(obj_desc->type) != 0 && fsl_mc_device_match(mc_dev, obj_desc)) @@ -79,7 +79,7 @@ static int __fsl_mc_device_remove(struct device *dev, void *data) * been dynamically removed in the physical DPRC. */ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, - struct fsl_mc_obj_desc *obj_desc_array, + struct dprc_obj_desc *obj_desc_array, int num_child_objects_in_mc) { if (num_child_objects_in_mc != 0) { @@ -87,7 +87,7 @@ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, * Remove child objects that are in the DPRC in Linux, * but not in the MC: */ - struct fsl_mc_child_objs objs; + struct dprc_child_objs objs; objs.child_count = num_child_objects_in_mc; objs.child_array = obj_desc_array; @@ -105,13 +105,13 @@ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, static int __fsl_mc_device_match(struct device *dev, void *data) { - struct fsl_mc_obj_desc *obj_desc = data; + struct dprc_obj_desc *obj_desc = data; struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); return fsl_mc_device_match(mc_dev, obj_desc); } -static struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc +static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc *obj_desc, struct fsl_mc_device *mc_bus_dev) @@ -136,16 +136,16 @@ static struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc * device is unbound from the corresponding device driver. */ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, - struct fsl_mc_obj_desc *obj_desc) + struct dprc_obj_desc *obj_desc) { int error; u32 plugged_flag_at_mc = - obj_desc->state & FSL_MC_OBJ_STATE_PLUGGED; + obj_desc->state & DPRC_OBJ_STATE_PLUGGED; if (plugged_flag_at_mc != - (mc_dev->obj_desc.state & FSL_MC_OBJ_STATE_PLUGGED)) { + (mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED)) { if (plugged_flag_at_mc) { - mc_dev->obj_desc.state |= FSL_MC_OBJ_STATE_PLUGGED; + mc_dev->obj_desc.state |= DPRC_OBJ_STATE_PLUGGED; error = device_attach(&mc_dev->dev); if (error < 0) { dev_err(&mc_dev->dev, @@ -153,7 +153,7 @@ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, error); } } else { - mc_dev->obj_desc.state &= ~FSL_MC_OBJ_STATE_PLUGGED; + mc_dev->obj_desc.state &= ~DPRC_OBJ_STATE_PLUGGED; device_release_driver(&mc_dev->dev); } } @@ -172,7 +172,7 @@ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, * in the physical DPRC. */ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, - struct fsl_mc_obj_desc *obj_desc_array, + struct dprc_obj_desc *obj_desc_array, int num_child_objects_in_mc) { int error; @@ -180,7 +180,7 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, for (i = 0; i < num_child_objects_in_mc; i++) { struct fsl_mc_device *child_dev; - struct fsl_mc_obj_desc *obj_desc = &obj_desc_array[i]; + struct dprc_obj_desc *obj_desc = &obj_desc_array[i]; if (strlen(obj_desc->type) == 0) continue; @@ -227,7 +227,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, int dprc_get_obj_failures; int error; unsigned int irq_count = mc_bus_dev->obj_desc.irq_count; - struct fsl_mc_obj_desc *child_obj_desc_array = NULL; + struct dprc_obj_desc *child_obj_desc_array = NULL; error = dprc_get_obj_count(mc_bus_dev->mc_io, 0, @@ -254,7 +254,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, */ dprc_get_obj_failures = 0; for (i = 0; i < num_child_objects; i++) { - struct fsl_mc_obj_desc *obj_desc = + struct dprc_obj_desc *obj_desc = &child_obj_desc_array[i]; error = dprc_get_obj(mc_bus_dev->mc_io, @@ -282,7 +282,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, if ((strcmp(obj_desc->type, "dpseci") == 0) && (obj_desc->ver_major < 4)) obj_desc->flags |= - FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY; + DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY; irq_count += obj_desc->irq_count; dev_dbg(&mc_bus_dev->dev, diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index a47f31d5ffe6..fcf7b4767dc0 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -29,7 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include "../include/mc.h" #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dprc.h" @@ -497,7 +496,7 @@ int dprc_get_obj(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int obj_index, - struct fsl_mc_obj_desc *obj_desc) + struct dprc_obj_desc *obj_desc) { struct mc_command cmd = { 0 }; struct dprc_cmd_get_obj *cmd_params; diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 8725a5cbc3aa..7b48ade1ca9c 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -82,7 +82,7 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv) * If the object is not 'plugged' don't match. * Only exception is the root DPRC, which is a special case. */ - if ((mc_dev->obj_desc.state & FSL_MC_OBJ_STATE_PLUGGED) == 0 && + if ((mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED) == 0 && !fsl_mc_is_root_dprc(&mc_dev->dev)) goto out; @@ -339,7 +339,7 @@ static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev, int i; int error; struct resource *regions; - struct fsl_mc_obj_desc *obj_desc = &mc_dev->obj_desc; + struct dprc_obj_desc *obj_desc = &mc_dev->obj_desc; struct device *parent_dev = mc_dev->dev.parent; enum dprc_region_type mc_region_type; @@ -432,7 +432,7 @@ static void fsl_mc_device_release(struct device *dev) /** * Add a newly discovered fsl-mc device to be visible in Linux */ -int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, +int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, struct device *parent_dev, struct fsl_mc_device **new_mc_dev) @@ -534,7 +534,7 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, } /* Objects are coherent, unless 'no shareability' flag set. */ - if (!(obj_desc->flags & FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY)) + if (!(obj_desc->flags & DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY)) arch_setup_dma_ops(&mc_dev->dev, 0, 0, NULL, true); /* @@ -687,7 +687,7 @@ static int get_mc_addr_translation_ranges(struct device *dev, */ static int fsl_mc_bus_probe(struct platform_device *pdev) { - struct fsl_mc_obj_desc obj_desc; + struct dprc_obj_desc obj_desc; int error; struct fsl_mc *mc; struct fsl_mc_device *mc_bus_dev = NULL; @@ -746,7 +746,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) goto error_cleanup_mc_io; } - memset(&obj_desc, 0, sizeof(struct fsl_mc_obj_desc)); + memset(&obj_desc, 0, sizeof(struct dprc_obj_desc)); error = dprc_get_api_version(mc_io, 0, &obj_desc.ver_major, &obj_desc.ver_minor); diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index 7f5406f75908..01ef932905de 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -12,7 +12,7 @@ #include "../include/mc.h" -int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, +int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, struct device *parent_dev, struct fsl_mc_device **new_mc_dev); diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h index 21295e4feb04..2f4a7a75a572 100644 --- a/drivers/staging/fsl-mc/include/dprc.h +++ b/drivers/staging/fsl-mc/include/dprc.h @@ -39,7 +39,6 @@ */ struct fsl_mc_io; -struct fsl_mc_obj_desc; int dprc_open(struct fsl_mc_io *mc_io, u32 cmd_flags, @@ -168,18 +167,59 @@ int dprc_get_obj_count(struct fsl_mc_io *mc_io, u16 token, int *obj_count); +/* Objects Attributes Flags */ + +/* Opened state - Indicates that an object is open by at least one owner */ +#define DPRC_OBJ_STATE_OPEN 0x00000001 +/* Plugged state - Indicates that the object is plugged */ +#define DPRC_OBJ_STATE_PLUGGED 0x00000002 + +/** + * Shareability flag - Object flag indicating no memory shareability. + * the object generates memory accesses that are non coherent with other + * masters; + * user is responsible for proper memory handling through IOMMU configuration. + */ +#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 + +/** + * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj() + * @type: Type of object: NULL terminated string + * @id: ID of logical object resource + * @vendor: Object vendor identifier + * @ver_major: Major version number + * @ver_minor: Minor version number + * @irq_count: Number of interrupts supported by the object + * @region_count: Number of mappable regions supported by the object + * @state: Object state: combination of DPRC_OBJ_STATE_ states + * @label: Object label + * @flags: Object's flags + */ +struct dprc_obj_desc { + char type[16]; + int id; + u16 vendor; + u16 ver_major; + u16 ver_minor; + u8 irq_count; + u8 region_count; + u32 state; + char label[16]; + u16 flags; +}; + int dprc_get_obj(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int obj_index, - struct fsl_mc_obj_desc *obj_desc); + struct dprc_obj_desc *obj_desc); int dprc_get_obj_desc(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, char *obj_type, int obj_id, - struct fsl_mc_obj_desc *obj_desc); + struct dprc_obj_desc *obj_desc); int dprc_set_obj_irq(struct fsl_mc_io *mc_io, u32 cmd_flags, diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 60c706720531..1c46c0c2a895 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -104,45 +104,6 @@ struct fsl_mc_device_irq { #define to_fsl_mc_irq(_mc_resource) \ container_of(_mc_resource, struct fsl_mc_device_irq, resource) -/* Opened state - Indicates that an object is open by at least one owner */ -#define FSL_MC_OBJ_STATE_OPEN 0x00000001 -/* Plugged state - Indicates that the object is plugged */ -#define FSL_MC_OBJ_STATE_PLUGGED 0x00000002 - -/** - * Shareability flag - Object flag indicating no memory shareability. - * the object generates memory accesses that are non coherent with other - * masters; - * user is responsible for proper memory handling through IOMMU configuration. - */ -#define FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 - -/** - * struct fsl_mc_obj_desc - Object descriptor - * @type: Type of object: NULL terminated string - * @id: ID of logical object resource - * @vendor: Object vendor identifier - * @ver_major: Major version number - * @ver_minor: Minor version number - * @irq_count: Number of interrupts supported by the object - * @region_count: Number of mappable regions supported by the object - * @state: Object state: combination of FSL_MC_OBJ_STATE_ states - * @label: Object label: NULL terminated string - * @flags: Object's flags - */ -struct fsl_mc_obj_desc { - char type[16]; - int id; - u16 vendor; - u16 ver_major; - u16 ver_minor; - u8 irq_count; - u8 region_count; - u32 state; - char label[16]; - u16 flags; -}; - /** * Bit masks for a MC object device (struct fsl_mc_device) flags */ @@ -189,7 +150,7 @@ struct fsl_mc_device { u16 icid; u16 mc_handle; struct fsl_mc_io *mc_io; - struct fsl_mc_obj_desc obj_desc; + struct dprc_obj_desc obj_desc; struct resource *regions; struct fsl_mc_device_irq **irqs; struct fsl_mc_resource *resource; -- cgit v1.2.3-55-g7522 From 97ae021ab818fe29ac78d3acc0ecc6d85fc7cd5b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 13:51:14 +0200 Subject: Revert "staging: fsl-mc: drop useless #includes" This reverts commit bb4a64b79f3b9973316e775f6c2910a98b6a562a. The whole series is broken, so back it all out. Reported-by: kbuild test robot Cc: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index c2af5b570222..9291847b1d14 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -13,6 +13,8 @@ #include "../include/mc-bus.h" #include "../include/mc-sys.h" +#include "dpbp-cmd.h" +#include "dpcon-cmd.h" #include "fsl-mc-private.h" static bool __must_check fsl_mc_is_allocatable(const char *obj_type) -- cgit v1.2.3-55-g7522 From a5525dc0b8341cfa2d6c8bfe2796168a0ce83dfd Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Sun, 25 Jun 2017 19:40:01 +0100 Subject: staging: speakup: check and convert dev name or ser to dev_t This patch adds functionality to validate and convert either a device name or 'ser' memmber of synth into dev_t. Subsequent patch in this set will call it to convert user-specified device into device number. For device name, this patch does some basic sanity checks on the string passed in. It currently supports ttyS*, ttyUSB* and, for selected synths, lp*. The patch also introduces a string member variable named 'dev_name' to struct spk_synth. 'dev_name' represents the device name - ttyUSB0 etc - which needs conversion to dev_t. Signed-off-by: Okash Khawaja Reviewed-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_priv.h | 2 ++ drivers/staging/speakup/spk_ttyio.c | 42 +++++++++++++++++++++++++++++++++++++ drivers/staging/speakup/spk_types.h | 1 + 3 files changed, 45 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h index 4f533667d312..87b6a0a4c54d 100644 --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -40,6 +40,8 @@ #define KT_SPKUP 15 #define SPK_SYNTH_TIMEOUT 100000 /* in micro-seconds */ +#define SYNTH_DEFAULT_DEV "ttyS0" +#define SYNTH_DEFAULT_SER 0 const struct old_serial_port *spk_serial_init(int index); void spk_stop_serial_interrupt(void); diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 4e346697e53d..0a5436706e74 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -7,6 +7,11 @@ #include "spk_types.h" #include "spk_priv.h" +#define DEV_PREFIX_LP "lp" + +static const char * const lp_supported[] = { "acntsa", "bns", "dummy", + "txprt" }; + struct spk_ldisc_data { char buf; struct semaphore sem; @@ -16,6 +21,43 @@ struct spk_ldisc_data { static struct spk_synth *spk_ttyio_synth; static struct tty_struct *speakup_tty; +int ser_to_dev(int ser, dev_t *dev_no) +{ + if (ser < 0 || ser > (255 - 64)) { + pr_err("speakup: Invalid ser param. Must be between 0 and 191 inclusive.\n"); + return -EINVAL; + } + + *dev_no = MKDEV(4, (64 + ser)); + return 0; +} + +static int get_dev_to_use(struct spk_synth *synth, dev_t *dev_no) +{ + /* use ser only when dev is not specified */ + if (strcmp(synth->dev_name, SYNTH_DEFAULT_DEV) || + synth->ser == SYNTH_DEFAULT_SER) { + /* for /dev/lp* check if synth is supported */ + if (strncmp(synth->dev_name, DEV_PREFIX_LP, + strlen(DEV_PREFIX_LP)) == 0) + if (match_string(lp_supported, ARRAY_SIZE(lp_supported), + synth->name) < 0) { + int i; + + pr_err("speakup: lp* is only supported on:"); + for (i = 0; i < ARRAY_SIZE(lp_supported); i++) + pr_cont(" %s", lp_supported[i]); + pr_cont("\n"); + + return -ENOTSUPP; + } + + return tty_dev_name_to_number(synth->dev_name, dev_no); + } + + return ser_to_dev(synth->ser, dev_no); +} + static int spk_ttyio_ldisc_open(struct tty_struct *tty) { struct spk_ldisc_data *ldisc_data; diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h index 9e3889749d43..22f657d45e46 100644 --- a/drivers/staging/speakup/spk_types.h +++ b/drivers/staging/speakup/spk_types.h @@ -169,6 +169,7 @@ struct spk_synth { int jiffies; int full; int ser; + char *dev_name; short flags; short startup; const int checkval; /* for validating a proper synth module */ -- cgit v1.2.3-55-g7522 From 8a21ff775f5654eb078ae57ba64cdbd32b9297c4 Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Sun, 25 Jun 2017 19:40:02 +0100 Subject: staging: speakup: make ttyio synths use device name This patch introduces new module parameter, dev, which takes a string representing the device that the external synth is connected to, e.g. ttyS0, ttyUSB0 etc. This is then used to communicate with the synth. That way, speakup can support more than ttyS*. As of this patch, it only supports ttyS*, ttyUSB* and selected synths for lp*. dev parameter is only available for tty-migrated synths. Users will either use dev or ser as both serve same purpose. This patch maintains backward compatility by allowing ser to be specified. When both are specified, whichever is non-default, i.e. not ttyS0, is used. If both are non-default then dev is used. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Reviewed-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/speakup_acntsa.c | 3 +++ drivers/staging/speakup/speakup_apollo.c | 3 +++ drivers/staging/speakup/speakup_audptr.c | 3 +++ drivers/staging/speakup/speakup_bns.c | 3 +++ drivers/staging/speakup/speakup_decext.c | 3 +++ drivers/staging/speakup/speakup_dectlk.c | 3 +++ drivers/staging/speakup/speakup_dummy.c | 3 +++ drivers/staging/speakup/speakup_ltlk.c | 3 +++ drivers/staging/speakup/speakup_spkout.c | 3 +++ drivers/staging/speakup/speakup_txprt.c | 3 +++ drivers/staging/speakup/spk_ttyio.c | 15 +++++++-------- 11 files changed, 37 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/speakup_acntsa.c b/drivers/staging/speakup/speakup_acntsa.c index 6e4f873eddbc..0e10404e2e8c 100644 --- a/drivers/staging/speakup/speakup_acntsa.c +++ b/drivers/staging/speakup/speakup_acntsa.c @@ -96,6 +96,7 @@ static struct spk_synth synth_acntsa = { .trigger = 50, .jiffies = 30, .full = 40000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -135,9 +136,11 @@ static int synth_probe(struct spk_synth *synth) } module_param_named(ser, synth_acntsa.ser, int, 0444); +module_param_named(dev, synth_acntsa.dev_name, charp, S_IRUGO); module_param_named(start, synth_acntsa.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_acntsa); diff --git a/drivers/staging/speakup/speakup_apollo.c b/drivers/staging/speakup/speakup_apollo.c index 7d99fba734b5..2edb56c8a559 100644 --- a/drivers/staging/speakup/speakup_apollo.c +++ b/drivers/staging/speakup/speakup_apollo.c @@ -105,6 +105,7 @@ static struct spk_synth synth_apollo = { .trigger = 50, .jiffies = 50, .full = 40000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -199,9 +200,11 @@ static void do_catch_up(struct spk_synth *synth) } module_param_named(ser, synth_apollo.ser, int, 0444); +module_param_named(dev, synth_apollo.dev_name, charp, S_IRUGO); module_param_named(start, synth_apollo.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_apollo); diff --git a/drivers/staging/speakup/speakup_audptr.c b/drivers/staging/speakup/speakup_audptr.c index 1ca476087ba3..8ae826eba71c 100644 --- a/drivers/staging/speakup/speakup_audptr.c +++ b/drivers/staging/speakup/speakup_audptr.c @@ -100,6 +100,7 @@ static struct spk_synth synth_audptr = { .trigger = 50, .jiffies = 30, .full = 18000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -162,9 +163,11 @@ static int synth_probe(struct spk_synth *synth) } module_param_named(ser, synth_audptr.ser, int, 0444); +module_param_named(dev, synth_audptr.dev_name, charp, S_IRUGO); module_param_named(start, synth_audptr.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_audptr); diff --git a/drivers/staging/speakup/speakup_bns.c b/drivers/staging/speakup/speakup_bns.c index 474c12770ff6..60bcf0df8123 100644 --- a/drivers/staging/speakup/speakup_bns.c +++ b/drivers/staging/speakup/speakup_bns.c @@ -93,6 +93,7 @@ static struct spk_synth synth_bns = { .trigger = 50, .jiffies = 50, .full = 40000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -119,9 +120,11 @@ static struct spk_synth synth_bns = { }; module_param_named(ser, synth_bns.ser, int, 0444); +module_param_named(dev, synth_bns.dev_name, charp, S_IRUGO); module_param_named(start, synth_bns.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_bns); diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index bf44ac988bf8..95f4b2116d0c 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -120,6 +120,7 @@ static struct spk_synth synth_decext = { .jiffies = 50, .full = 40000, .flags = SF_DEC, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -226,9 +227,11 @@ static void synth_flush(struct spk_synth *synth) } module_param_named(ser, synth_decext.ser, int, 0444); +module_param_named(dev, synth_decext.dev_name, charp, S_IRUGO); module_param_named(start, synth_decext.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_decext); diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c index ccb3bdf58e2a..f06995480022 100644 --- a/drivers/staging/speakup/speakup_dectlk.c +++ b/drivers/staging/speakup/speakup_dectlk.c @@ -124,6 +124,7 @@ static struct spk_synth synth_dectlk = { .trigger = 50, .jiffies = 50, .full = 40000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -298,9 +299,11 @@ static void synth_flush(struct spk_synth *synth) } module_param_named(ser, synth_dectlk.ser, int, 0444); +module_param_named(dev, synth_dectlk.dev_name, charp, S_IRUGO); module_param_named(start, synth_dectlk.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_dectlk); diff --git a/drivers/staging/speakup/speakup_dummy.c b/drivers/staging/speakup/speakup_dummy.c index 3fdc768c8454..851953d5eefb 100644 --- a/drivers/staging/speakup/speakup_dummy.c +++ b/drivers/staging/speakup/speakup_dummy.c @@ -95,6 +95,7 @@ static struct spk_synth synth_dummy = { .trigger = 50, .jiffies = 50, .full = 40000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -121,9 +122,11 @@ static struct spk_synth synth_dummy = { }; module_param_named(ser, synth_dummy.ser, int, 0444); +module_param_named(dev, synth_dummy.dev_name, charp, S_IRUGO); module_param_named(start, synth_dummy.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_dummy); diff --git a/drivers/staging/speakup/speakup_ltlk.c b/drivers/staging/speakup/speakup_ltlk.c index 9606224bc4d6..423795f88f53 100644 --- a/drivers/staging/speakup/speakup_ltlk.c +++ b/drivers/staging/speakup/speakup_ltlk.c @@ -107,6 +107,7 @@ static struct spk_synth synth_ltlk = { .trigger = 50, .jiffies = 50, .full = 40000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -166,9 +167,11 @@ static int synth_probe(struct spk_synth *synth) } module_param_named(ser, synth_ltlk.ser, int, 0444); +module_param_named(dev, synth_ltlk.dev_name, charp, S_IRUGO); module_param_named(start, synth_ltlk.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_ltlk); diff --git a/drivers/staging/speakup/speakup_spkout.c b/drivers/staging/speakup/speakup_spkout.c index 086d5349d8d8..9ca21edc42ce 100644 --- a/drivers/staging/speakup/speakup_spkout.c +++ b/drivers/staging/speakup/speakup_spkout.c @@ -98,6 +98,7 @@ static struct spk_synth synth_spkout = { .trigger = 50, .jiffies = 50, .full = 40000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -130,9 +131,11 @@ static void synth_flush(struct spk_synth *synth) } module_param_named(ser, synth_spkout.ser, int, 0444); +module_param_named(dev, synth_spkout.dev_name, charp, S_IRUGO); module_param_named(start, synth_spkout.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_spkout); diff --git a/drivers/staging/speakup/speakup_txprt.c b/drivers/staging/speakup/speakup_txprt.c index e4c1b5424f94..831ee404e7a1 100644 --- a/drivers/staging/speakup/speakup_txprt.c +++ b/drivers/staging/speakup/speakup_txprt.c @@ -92,6 +92,7 @@ static struct spk_synth synth_txprt = { .trigger = 50, .jiffies = 50, .full = 40000, + .dev_name = SYNTH_DEFAULT_DEV, .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, @@ -118,9 +119,11 @@ static struct spk_synth synth_txprt = { }; module_param_named(ser, synth_txprt.ser, int, 0444); +module_param_named(dev, synth_txprt.dev_name, charp, S_IRUGO); module_param_named(start, synth_txprt.startup, short, 0444); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); +MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); module_spk_synth(synth_txprt); diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 0a5436706e74..442f191a017e 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -147,11 +147,12 @@ static inline void get_termios(struct tty_struct *tty, struct ktermios *out_term up_read(&tty->termios_rwsem); } -static int spk_ttyio_initialise_ldisc(int ser) +static int spk_ttyio_initialise_ldisc(struct spk_synth *synth) { int ret = 0; struct tty_struct *tty; struct ktermios tmp_termios; + dev_t dev; ret = tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops); if (ret) { @@ -159,13 +160,11 @@ static int spk_ttyio_initialise_ldisc(int ser) return ret; } - if (ser < 0 || ser > (255 - 64)) { - pr_err("speakup: Invalid ser param. Must be between 0 and 191 inclusive.\n"); - return -EINVAL; - } + ret = get_dev_to_use(synth, &dev); + if (ret) + return ret; - /* TODO: support more than ttyS* */ - tty = tty_open_by_driver(MKDEV(4, (ser + 64)), NULL, NULL); + tty = tty_open_by_driver(dev, NULL, NULL); if (IS_ERR(tty)) return PTR_ERR(tty); @@ -277,7 +276,7 @@ static void spk_ttyio_flush_buffer(void) int spk_ttyio_synth_probe(struct spk_synth *synth) { - int rv = spk_ttyio_initialise_ldisc(synth->ser); + int rv = spk_ttyio_initialise_ldisc(synth); if (rv) return rv; -- cgit v1.2.3-55-g7522 From 97af1ce27844a4303139b06df962e3a8d738d23b Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Thu, 29 Jun 2017 13:24:35 +0200 Subject: drivers: staging: sm750: Hold lock irrespective of fb numbers. Start holding the lock for all cases irrespective of number of fb, there could be a deadlock since this number could change in the lifetime of this lock Signed-off-by: Dhananjay Balan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 664c220f1df4..3aa4128703d5 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -183,19 +183,19 @@ static void lynxfb_ops_fillrect(struct fb_info *info, rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR : HW_ROP2_COPY; /* - * If not use spin_lock,system will die if user load driver + * If not use spin_lock, system will die if user load driver * and immediately unload driver frequently (dual) + * since they fb_count could change during the lifetime of + * this lock, we are holding it for all cases. */ - if (sm750_dev->fb_count > 1) - spin_lock(&sm750_dev->slock); + spin_lock(&sm750_dev->slock); sm750_dev->accel.de_fillrect(&sm750_dev->accel, base, pitch, Bpp, region->dx, region->dy, region->width, region->height, color, rop); - if (sm750_dev->fb_count > 1) - spin_unlock(&sm750_dev->slock); + spin_unlock(&sm750_dev->slock); } static void lynxfb_ops_copyarea(struct fb_info *info, @@ -219,17 +219,17 @@ static void lynxfb_ops_copyarea(struct fb_info *info, /* * If not use spin_lock, system will die if user load driver * and immediately unload driver frequently (dual) + * since they fb_count could change during the lifetime of + * this lock, we are holding it for all cases. */ - if (sm750_dev->fb_count > 1) - spin_lock(&sm750_dev->slock); + spin_lock(&sm750_dev->slock); sm750_dev->accel.de_copyarea(&sm750_dev->accel, base, pitch, region->sx, region->sy, base, pitch, Bpp, region->dx, region->dy, region->width, region->height, HW_ROP2_COPY); - if (sm750_dev->fb_count > 1) - spin_unlock(&sm750_dev->slock); + spin_unlock(&sm750_dev->slock); } static void lynxfb_ops_imageblit(struct fb_info *info, @@ -268,9 +268,10 @@ static void lynxfb_ops_imageblit(struct fb_info *info, /* * If not use spin_lock, system will die if user load driver * and immediately unload driver frequently (dual) + * since they fb_count could change during the lifetime of + * this lock, we are holding it for all cases. */ - if (sm750_dev->fb_count > 1) - spin_lock(&sm750_dev->slock); + spin_lock(&sm750_dev->slock); sm750_dev->accel.de_imageblit(&sm750_dev->accel, image->data, image->width >> 3, 0, @@ -278,8 +279,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info, image->dx, image->dy, image->width, image->height, fgcol, bgcol, HW_ROP2_COPY); - if (sm750_dev->fb_count > 1) - spin_unlock(&sm750_dev->slock); + spin_unlock(&sm750_dev->slock); } static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, -- cgit v1.2.3-55-g7522 From e7258b6a228bdb176ef6c00a01a322f8e8ea6e8a Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:13 +0300 Subject: staging: ccree: fix missing or redundant spaces Add and/or remove redundant and/or missing spaces in ccree source Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/Kconfig | 2 +- drivers/staging/ccree/ssi_aead.c | 38 ++++---- drivers/staging/ccree/ssi_aead.h | 12 +-- drivers/staging/ccree/ssi_buffer_mgr.c | 158 ++++++++++++++++---------------- drivers/staging/ccree/ssi_cipher.c | 44 ++++----- drivers/staging/ccree/ssi_driver.c | 18 ++-- drivers/staging/ccree/ssi_driver.h | 4 +- drivers/staging/ccree/ssi_fips_data.h | 12 +-- drivers/staging/ccree/ssi_fips_ll.c | 12 +-- drivers/staging/ccree/ssi_fips_local.c | 8 +- drivers/staging/ccree/ssi_fips_local.h | 18 ++-- drivers/staging/ccree/ssi_hash.c | 38 ++++---- drivers/staging/ccree/ssi_pm.c | 16 ++-- drivers/staging/ccree/ssi_pm.h | 2 +- drivers/staging/ccree/ssi_request_mgr.c | 62 ++++++------- drivers/staging/ccree/ssi_request_mgr.h | 6 +- drivers/staging/ccree/ssi_sysfs.c | 56 +++++------ 17 files changed, 253 insertions(+), 253 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/Kconfig b/drivers/staging/ccree/Kconfig index ec3749d318d2..36a87c686a2a 100644 --- a/drivers/staging/ccree/Kconfig +++ b/drivers/staging/ccree/Kconfig @@ -18,7 +18,7 @@ config CRYPTO_DEV_CCREE select CRYPTO_CTR select CRYPTO_XTS help - Say 'Y' to enable a driver for the Arm TrustZone CryptoCell + Say 'Y' to enable a driver for the Arm TrustZone CryptoCell C7xx. Currently only the CryptoCell 712 REE is supported. Choose this if you wish to use hardware acceleration of cryptographic operations on the system REE. diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index c70e45023d06..2e8dc3fa89ce 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -238,8 +238,8 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c } else { /*ENCRYPT*/ if (unlikely(areq_ctx->is_icv_fragmented == true)) ssi_buffer_mgr_copy_scatterlist_portion( - areq_ctx->mac_buf, areq_ctx->dstSgl, areq->cryptlen+areq_ctx->dstOffset, - areq->cryptlen+areq_ctx->dstOffset + ctx->authsize, SSI_SG_FROM_BUF); + areq_ctx->mac_buf, areq_ctx->dstSgl, areq->cryptlen + areq_ctx->dstOffset, + areq->cryptlen + areq_ctx->dstOffset + ctx->authsize, SSI_SG_FROM_BUF); /* If an IV was generated, copy it back to the user provided buffer. */ if (areq_ctx->backup_giv != NULL) { @@ -1561,7 +1561,7 @@ static int config_ccm_adata(struct aead_request *req) (req->cryptlen - ctx->authsize); int rc; memset(req_ctx->mac_buf, 0, AES_BLOCK_SIZE); - memset(req_ctx->ccm_config, 0, AES_BLOCK_SIZE*3); + memset(req_ctx->ccm_config, 0, AES_BLOCK_SIZE * 3); /* taken from crypto/ccm.c */ /* 2 <= L <= 8, so 1 <= L' <= 7. */ @@ -1585,12 +1585,12 @@ static int config_ccm_adata(struct aead_request *req) /* END of "taken from crypto/ccm.c" */ /* l(a) - size of associated data. */ - req_ctx->ccm_hdr_size = format_ccm_a0 (a0, req->assoclen); + req_ctx->ccm_hdr_size = format_ccm_a0(a0, req->assoclen); memset(req->iv + 15 - req->iv[0], 0, req->iv[0] + 1); req->iv[15] = 1; - memcpy(ctr_count_0, req->iv, AES_BLOCK_SIZE) ; + memcpy(ctr_count_0, req->iv, AES_BLOCK_SIZE); ctr_count_0[15] = 0; return 0; @@ -1858,7 +1858,7 @@ static inline void ssi_aead_dump_gcm( SSI_LOG_DEBUG("%s\n", title); } - SSI_LOG_DEBUG("cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, cryptlen %d \n", \ + SSI_LOG_DEBUG("cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, cryptlen %d\n", \ ctx->cipher_mode, ctx->authsize, ctx->enc_keylen, req->assoclen, req_ctx->cryptlen); if (ctx->enckey != NULL) { @@ -1878,12 +1878,12 @@ static inline void ssi_aead_dump_gcm( dump_byte_array("gcm_len_block", req_ctx->gcm_len_block.lenA, AES_BLOCK_SIZE); if (req->src != NULL && req->cryptlen) { - dump_byte_array("req->src", sg_virt(req->src), req->cryptlen+req->assoclen); + dump_byte_array("req->src", sg_virt(req->src), req->cryptlen + req->assoclen); } if (req->dst != NULL) { - dump_byte_array("req->dst", sg_virt(req->dst), req->cryptlen+ctx->authsize+req->assoclen); - } + dump_byte_array("req->dst", sg_virt(req->dst), req->cryptlen + ctx->authsize + req->assoclen); + } } #endif @@ -1899,7 +1899,7 @@ static int config_gcm_context(struct aead_request *req) (req->cryptlen - ctx->authsize); __be32 counter = cpu_to_be32(2); - SSI_LOG_DEBUG("config_gcm_context() cryptlen = %d, req->assoclen = %d ctx->authsize = %d \n", cryptlen, req->assoclen, ctx->authsize); + SSI_LOG_DEBUG("config_gcm_context() cryptlen = %d, req->assoclen = %d ctx->authsize = %d\n", cryptlen, req->assoclen, ctx->authsize); memset(req_ctx->hkey, 0, AES_BLOCK_SIZE); @@ -1916,15 +1916,15 @@ static int config_gcm_context(struct aead_request *req) if (req_ctx->plaintext_authenticate_only == false) { __be64 temp64; temp64 = cpu_to_be64(req->assoclen * 8); - memcpy (&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); + memcpy(&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); temp64 = cpu_to_be64(cryptlen * 8); - memcpy (&req_ctx->gcm_len_block.lenC, &temp64, 8); + memcpy(&req_ctx->gcm_len_block.lenC, &temp64, 8); } else { //rfc4543=> all data(AAD,IV,Plain) are considered additional data that is nothing is encrypted. __be64 temp64; - temp64 = cpu_to_be64((req->assoclen+GCM_BLOCK_RFC4_IV_SIZE+cryptlen) * 8); - memcpy (&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); + temp64 = cpu_to_be64((req->assoclen + GCM_BLOCK_RFC4_IV_SIZE + cryptlen) * 8); + memcpy(&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); temp64 = 0; - memcpy (&req_ctx->gcm_len_block.lenC, &temp64, 8); + memcpy(&req_ctx->gcm_len_block.lenC, &temp64, 8); } return 0; @@ -2220,7 +2220,7 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); int rc = 0; - SSI_LOG_DEBUG("ssi_rfc4106_gcm_setkey() keylen %d, key %p \n", keylen, key); + SSI_LOG_DEBUG("ssi_rfc4106_gcm_setkey() keylen %d, key %p\n", keylen, key); if (keylen < 4) return -EINVAL; @@ -2238,7 +2238,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); int rc = 0; - SSI_LOG_DEBUG("ssi_rfc4543_gcm_setkey() keylen %d, key %p \n", keylen, key); + SSI_LOG_DEBUG("ssi_rfc4543_gcm_setkey() keylen %d, key %p\n", keylen, key); if (keylen < 4) return -EINVAL; @@ -2273,7 +2273,7 @@ static int ssi_gcm_setauthsize(struct crypto_aead *authenc, static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, unsigned int authsize) { - SSI_LOG_DEBUG("ssi_rfc4106_gcm_setauthsize() authsize %d \n", authsize); + SSI_LOG_DEBUG("ssi_rfc4106_gcm_setauthsize() authsize %d\n", authsize); switch (authsize) { case 8: @@ -2290,7 +2290,7 @@ static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, static int ssi_rfc4543_gcm_setauthsize(struct crypto_aead *authenc, unsigned int authsize) { - SSI_LOG_DEBUG("ssi_rfc4543_gcm_setauthsize() authsize %d \n", authsize); + SSI_LOG_DEBUG("ssi_rfc4543_gcm_setauthsize() authsize %d\n", authsize); if (authsize != 16) return -EINVAL; diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 00a3680cb8ab..07cab84b83f4 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -28,17 +28,17 @@ /* mac_cmp - HW writes 8 B but all bytes hold the same value */ #define ICV_CMP_SIZE 8 -#define CCM_CONFIG_BUF_SIZE (AES_BLOCK_SIZE*3) +#define CCM_CONFIG_BUF_SIZE (AES_BLOCK_SIZE * 3) #define MAX_MAC_SIZE MAX(SHA256_DIGEST_SIZE, AES_BLOCK_SIZE) /* defines for AES GCM configuration buffer */ #define GCM_BLOCK_LEN_SIZE 8 -#define GCM_BLOCK_RFC4_IV_OFFSET 4 -#define GCM_BLOCK_RFC4_IV_SIZE 8 /* IV size for rfc's */ -#define GCM_BLOCK_RFC4_NONCE_OFFSET 0 -#define GCM_BLOCK_RFC4_NONCE_SIZE 4 +#define GCM_BLOCK_RFC4_IV_OFFSET 4 +#define GCM_BLOCK_RFC4_IV_SIZE 8 /* IV size for rfc's */ +#define GCM_BLOCK_RFC4_NONCE_OFFSET 0 +#define GCM_BLOCK_RFC4_NONCE_SIZE 4 @@ -74,7 +74,7 @@ struct aead_req_ctx { u8 hkey[AES_BLOCK_SIZE] ____cacheline_aligned; struct { u8 lenA[GCM_BLOCK_LEN_SIZE] ____cacheline_aligned; - u8 lenC[GCM_BLOCK_LEN_SIZE] ; + u8 lenC[GCM_BLOCK_LEN_SIZE]; } gcm_len_block; u8 ccm_config[CCM_CONFIG_BUF_SIZE] ____cacheline_aligned; diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 4373d1dcc408..00d95c15071a 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -83,14 +83,14 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( while (nbytes != 0) { if (sg_is_chain(sg_list)) { SSI_LOG_ERR("Unexpected chained entry " - "in sg (entry =0x%X) \n", nents); + "in sg (entry =0x%X)\n", nents); BUG(); } if (sg_list->length != 0) { nents++; /* get the number of bytes in the last entry */ *lbytes = nbytes; - nbytes -= ( sg_list->length > nbytes ) ? nbytes : sg_list->length; + nbytes -= (sg_list->length > nbytes) ? nbytes : sg_list->length; sg_list = sg_next(sg_list); } else { sg_list = (struct scatterlist *)sg_page(sg_list); @@ -99,7 +99,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( } } } - SSI_LOG_DEBUG("nents %d last bytes %d\n",nents, *lbytes); + SSI_LOG_DEBUG("nents %d last bytes %d\n", nents, *lbytes); return nents; } @@ -154,16 +154,16 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( u32 new_nents;; /* Verify there is no memory overflow*/ - new_nents = (*curr_nents + buff_size/CC_MAX_MLLI_ENTRY_SIZE + 1); - if (new_nents > MAX_NUM_OF_TOTAL_MLLI_ENTRIES ) { + new_nents = (*curr_nents + buff_size / CC_MAX_MLLI_ENTRY_SIZE + 1); + if (new_nents > MAX_NUM_OF_TOTAL_MLLI_ENTRIES) { return -ENOMEM; } /*handle buffer longer than 64 kbytes */ - while (buff_size > CC_MAX_MLLI_ENTRY_SIZE ) { + while (buff_size > CC_MAX_MLLI_ENTRY_SIZE) { cc_lli_set_addr(mlli_entry_p, buff_dma); cc_lli_set_size(mlli_entry_p, CC_MAX_MLLI_ENTRY_SIZE); - SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n",*curr_nents, + SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n", *curr_nents, mlli_entry_p[LLI_WORD0_OFFSET], mlli_entry_p[LLI_WORD1_OFFSET]); buff_dma += CC_MAX_MLLI_ENTRY_SIZE; @@ -174,7 +174,7 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( /*Last entry */ cc_lli_set_addr(mlli_entry_p, buff_dma); cc_lli_set_size(mlli_entry_p, buff_size); - SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n",*curr_nents, + SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n", *curr_nents, mlli_entry_p[LLI_WORD0_OFFSET], mlli_entry_p[LLI_WORD1_OFFSET]); mlli_entry_p = mlli_entry_p + 2; @@ -196,15 +196,15 @@ static inline int ssi_buffer_mgr_render_scatterlist_to_mlli( curr_sgl = sg_next(curr_sgl)) { u32 entry_data_len = (sgl_data_len > sg_dma_len(curr_sgl) - sglOffset) ? - sg_dma_len(curr_sgl) - sglOffset : sgl_data_len ; + sg_dma_len(curr_sgl) - sglOffset : sgl_data_len; sgl_data_len -= entry_data_len; rc = ssi_buffer_mgr_render_buff_to_mlli( sg_dma_address(curr_sgl) + sglOffset, entry_data_len, curr_nents, &mlli_entry_p); - if(rc != 0) { + if (rc != 0) { return rc; } - sglOffset=0; + sglOffset = 0; } *mlli_entry_pp = mlli_entry_p; return 0; @@ -216,7 +216,7 @@ static int ssi_buffer_mgr_generate_mlli( struct mlli_params *mlli_params) { u32 *mlli_p; - u32 total_nents = 0,prev_total_nents = 0; + u32 total_nents = 0, prev_total_nents = 0; int rc = 0, i; SSI_LOG_DEBUG("NUM of SG's = %d\n", sg_data->num_of_buffers); @@ -227,7 +227,7 @@ static int ssi_buffer_mgr_generate_mlli( &(mlli_params->mlli_dma_addr)); if (unlikely(mlli_params->mlli_virt_addr == NULL)) { SSI_LOG_ERR("dma_pool_alloc() failed\n"); - rc =-ENOMEM; + rc = -ENOMEM; goto build_mlli_exit; } /* Point to start of MLLI */ @@ -244,7 +244,7 @@ static int ssi_buffer_mgr_generate_mlli( sg_data->entry[i].buffer_dma, sg_data->total_data_len[i], &total_nents, &mlli_p); - if(rc != 0) { + if (rc != 0) { return rc; } @@ -323,13 +323,13 @@ static int ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, u32 nents, enum dma_data_direction direction) { - u32 i , j; + u32 i, j; struct scatterlist *l_sg = sg; for (i = 0; i < nents; i++) { if (l_sg == NULL) { break; } - if (unlikely(dma_map_sg(dev, l_sg, 1, direction) != 1)){ + if (unlikely(dma_map_sg(dev, l_sg, 1, direction) != 1)) { SSI_LOG_ERR("dma_map_page() sg buffer failed\n"); goto err; } @@ -343,7 +343,7 @@ err: if (sg == NULL) { break; } - dma_unmap_sg(dev,sg,1,direction); + dma_unmap_sg(dev, sg, 1, direction); sg = sg_next(sg); } return 0; @@ -387,7 +387,7 @@ static int ssi_buffer_mgr_map_scatterlist( * be changed from the original sgl nents */ *mapped_nents = dma_map_sg(dev, sg, *nents, direction); - if (unlikely(*mapped_nents == 0)){ + if (unlikely(*mapped_nents == 0)) { *nents = 0; SSI_LOG_ERR("dma_map_sg() sg buffer failed\n"); return -ENOMEM; @@ -400,7 +400,7 @@ static int ssi_buffer_mgr_map_scatterlist( sg, *nents, direction); - if (unlikely(*mapped_nents != *nents)){ + if (unlikely(*mapped_nents != *nents)) { *nents = *mapped_nents; SSI_LOG_ERR("dma_map_sg() sg buffer failed\n"); return -ENOMEM; @@ -418,7 +418,7 @@ ssi_aead_handle_config_buf(struct device *dev, struct buffer_array *sg_data, unsigned int assoclen) { - SSI_LOG_DEBUG(" handle additional data config set to DLLI \n"); + SSI_LOG_DEBUG(" handle additional data config set to DLLI\n"); /* create sg for the current buffer */ sg_init_one(&areq_ctx->ccm_adata_sg, config_data, AES_BLOCK_SIZE + areq_ctx->ccm_hdr_size); if (unlikely(dma_map_sg(dev, &areq_ctx->ccm_adata_sg, 1, @@ -453,9 +453,9 @@ static inline int ssi_ahash_handle_curr_buf(struct device *dev, u32 curr_buff_cnt, struct buffer_array *sg_data) { - SSI_LOG_DEBUG(" handle curr buff %x set to DLLI \n", curr_buff_cnt); + SSI_LOG_DEBUG(" handle curr buff %x set to DLLI\n", curr_buff_cnt); /* create sg for the current buffer */ - sg_init_one(areq_ctx->buff_sg,curr_buff, curr_buff_cnt); + sg_init_one(areq_ctx->buff_sg, curr_buff, curr_buff_cnt); if (unlikely(dma_map_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE) != 1)) { SSI_LOG_ERR("dma_map_sg() " @@ -540,12 +540,12 @@ int ssi_buffer_mgr_map_blkcipher_request( sg_data.num_of_buffers = 0; /* Map IV buffer */ - if (likely(ivsize != 0) ) { + if (likely(ivsize != 0)) { dump_byte_array("iv", (u8 *)info, ivsize); req_ctx->gen_ctx.iv_dma_addr = dma_map_single(dev, (void *)info, ivsize, - req_ctx->is_giv ? DMA_BIDIRECTIONAL: + req_ctx->is_giv ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE); if (unlikely(dma_mapping_error(dev, req_ctx->gen_ctx.iv_dma_addr))) { @@ -581,7 +581,7 @@ int ssi_buffer_mgr_map_blkcipher_request( } else { /* Map the dst sg */ if (unlikely(ssi_buffer_mgr_map_scatterlist( - dev,dst, nbytes, + dev, dst, nbytes, DMA_BIDIRECTIONAL, &req_ctx->out_nents, LLI_MAX_NUM_OF_DATA_ENTRIES, &dummy, &mapped_nents))){ @@ -606,7 +606,7 @@ int ssi_buffer_mgr_map_blkcipher_request( if (unlikely(req_ctx->dma_buf_type == SSI_DMA_BUF_MLLI)) { mlli_params->curr_pool = buff_mgr->mlli_buffs_pool; rc = ssi_buffer_mgr_generate_mlli(dev, &sg_data, mlli_params); - if (unlikely(rc!= 0)) + if (unlikely(rc != 0)) goto ablkcipher_exit; } @@ -686,19 +686,19 @@ void ssi_buffer_mgr_unmap_aead_request( areq_ctx->mlli_params.mlli_dma_addr); } - SSI_LOG_DEBUG("Unmapping src sgl: req->src=%pK areq_ctx->src.nents=%u areq_ctx->assoc.nents=%u assoclen:%u cryptlen=%u\n", sg_virt(req->src),areq_ctx->src.nents,areq_ctx->assoc.nents,req->assoclen,req->cryptlen); - size_to_unmap = req->assoclen+req->cryptlen; - if(areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT){ + SSI_LOG_DEBUG("Unmapping src sgl: req->src=%pK areq_ctx->src.nents=%u areq_ctx->assoc.nents=%u assoclen:%u cryptlen=%u\n", sg_virt(req->src), areq_ctx->src.nents, areq_ctx->assoc.nents, req->assoclen, req->cryptlen); + size_to_unmap = req->assoclen + req->cryptlen; + if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT) { size_to_unmap += areq_ctx->req_authsize; } if (areq_ctx->is_gcm4543) size_to_unmap += crypto_aead_ivsize(tfm); - dma_unmap_sg(dev, req->src, ssi_buffer_mgr_get_sgl_nents(req->src,size_to_unmap,&dummy,&chained) , DMA_BIDIRECTIONAL); + dma_unmap_sg(dev, req->src, ssi_buffer_mgr_get_sgl_nents(req->src, size_to_unmap, &dummy, &chained), DMA_BIDIRECTIONAL); if (unlikely(req->src != req->dst)) { SSI_LOG_DEBUG("Unmapping dst sgl: req->dst=%pK\n", sg_virt(req->dst)); - dma_unmap_sg(dev, req->dst, ssi_buffer_mgr_get_sgl_nents(req->dst,size_to_unmap,&dummy,&chained), + dma_unmap_sg(dev, req->dst, ssi_buffer_mgr_get_sgl_nents(req->dst, size_to_unmap, &dummy, &chained), DMA_BIDIRECTIONAL); } if (drvdata->coherent && @@ -714,8 +714,8 @@ void ssi_buffer_mgr_unmap_aead_request( */ ssi_buffer_mgr_copy_scatterlist_portion( areq_ctx->backup_mac, req->src, - size_to_skip+ req->cryptlen - areq_ctx->req_authsize, - size_to_skip+ req->cryptlen, SSI_SG_FROM_BUF); + size_to_skip + req->cryptlen - areq_ctx->req_authsize, + size_to_skip + req->cryptlen, SSI_SG_FROM_BUF); } } @@ -736,7 +736,7 @@ static inline int ssi_buffer_mgr_get_aead_icv_nents( return 0; } - for( i = 0 ; i < (sgl_nents - MAX_ICV_NENTS_SUPPORTED) ; i++) { + for (i = 0 ; i < (sgl_nents - MAX_ICV_NENTS_SUPPORTED) ; i++) { if (sgl == NULL) { break; } @@ -798,7 +798,7 @@ static inline int ssi_buffer_mgr_aead_chain_iv( SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=0x%llX\n", hw_iv_size, req->iv, (unsigned long long)areq_ctx->gen_ctx.iv_dma_addr); - if (do_chain == true && areq_ctx->plaintext_authenticate_only == true){ // TODO: what about CTR?? ask Ron + if (do_chain == true && areq_ctx->plaintext_authenticate_only == true) { // TODO: what about CTR?? ask Ron struct crypto_aead *tfm = crypto_aead_reqtfm(req); unsigned int iv_size_to_authenc = crypto_aead_ivsize(tfm); unsigned int iv_ofs = GCM_BLOCK_RFC4_IV_OFFSET; @@ -858,7 +858,7 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( current_sg = sg_next(current_sg); //if have reached the end of the sgl, then this is unexpected if (current_sg == NULL) { - SSI_LOG_ERR("reached end of sg list. unexpected \n"); + SSI_LOG_ERR("reached end of sg list. unexpected\n"); BUG(); } sg_index += current_sg->length; @@ -923,7 +923,7 @@ static inline void ssi_buffer_mgr_prepare_aead_data_dlli( if (likely(req->src == req->dst)) { /*INPLACE*/ areq_ctx->icv_dma_addr = sg_dma_address( - areq_ctx->srcSgl)+ + areq_ctx->srcSgl) + (*src_last_bytes - authsize); areq_ctx->icv_virt_addr = sg_virt( areq_ctx->srcSgl) + @@ -942,7 +942,7 @@ static inline void ssi_buffer_mgr_prepare_aead_data_dlli( areq_ctx->dstSgl) + (*dst_last_bytes - authsize); areq_ctx->icv_virt_addr = sg_virt( - areq_ctx->dstSgl)+ + areq_ctx->dstSgl) + (*dst_last_bytes - authsize); } } @@ -964,7 +964,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( /*INPLACE*/ ssi_buffer_mgr_add_scatterlist_entry(sg_data, areq_ctx->src.nents, areq_ctx->srcSgl, - areq_ctx->cryptlen,areq_ctx->srcOffset, is_last_table, + areq_ctx->cryptlen, areq_ctx->srcOffset, is_last_table, &areq_ctx->src.mlli_nents); icv_nents = ssi_buffer_mgr_get_aead_icv_nents(areq_ctx->srcSgl, @@ -1018,11 +1018,11 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( /*NON-INPLACE and DECRYPT*/ ssi_buffer_mgr_add_scatterlist_entry(sg_data, areq_ctx->src.nents, areq_ctx->srcSgl, - areq_ctx->cryptlen, areq_ctx->srcOffset,is_last_table, + areq_ctx->cryptlen, areq_ctx->srcOffset, is_last_table, &areq_ctx->src.mlli_nents); ssi_buffer_mgr_add_scatterlist_entry(sg_data, areq_ctx->dst.nents, areq_ctx->dstSgl, - areq_ctx->cryptlen,areq_ctx->dstOffset, is_last_table, + areq_ctx->cryptlen, areq_ctx->dstOffset, is_last_table, &areq_ctx->dst.mlli_nents); icv_nents = ssi_buffer_mgr_get_aead_icv_nents(areq_ctx->srcSgl, @@ -1044,8 +1044,8 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( } ssi_buffer_mgr_copy_scatterlist_portion( areq_ctx->backup_mac, req->src, - size_to_skip+ req->cryptlen - areq_ctx->req_authsize, - size_to_skip+ req->cryptlen, SSI_SG_TO_BUF); + size_to_skip + req->cryptlen - areq_ctx->req_authsize, + size_to_skip + req->cryptlen, SSI_SG_TO_BUF); areq_ctx->icv_virt_addr = areq_ctx->backup_mac; } else { /* Contig. ICV */ /*Should hanlde if the sg is not contig.*/ @@ -1061,11 +1061,11 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( /*NON-INPLACE and ENCRYPT*/ ssi_buffer_mgr_add_scatterlist_entry(sg_data, areq_ctx->dst.nents, areq_ctx->dstSgl, - areq_ctx->cryptlen,areq_ctx->dstOffset, is_last_table, + areq_ctx->cryptlen, areq_ctx->dstOffset, is_last_table, &areq_ctx->dst.mlli_nents); ssi_buffer_mgr_add_scatterlist_entry(sg_data, areq_ctx->src.nents, areq_ctx->srcSgl, - areq_ctx->cryptlen, areq_ctx->srcOffset,is_last_table, + areq_ctx->cryptlen, areq_ctx->srcOffset, is_last_table, &areq_ctx->src.mlli_nents); icv_nents = ssi_buffer_mgr_get_aead_icv_nents(areq_ctx->dstSgl, @@ -1108,7 +1108,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( int rc = 0; u32 src_mapped_nents = 0, dst_mapped_nents = 0; u32 offset = 0; - unsigned int size_for_map = req->assoclen +req->cryptlen; /*non-inplace mode*/ + unsigned int size_for_map = req->assoclen + req->cryptlen; /*non-inplace mode*/ struct crypto_aead *tfm = crypto_aead_reqtfm(req); u32 sg_index = 0; bool chained = false; @@ -1130,8 +1130,8 @@ static inline int ssi_buffer_mgr_aead_chain_data( size_for_map += crypto_aead_ivsize(tfm); } - size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? authsize:0; - src_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->src,size_for_map,&src_last_bytes, &chained); + size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? authsize : 0; + src_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->src, size_for_map, &src_last_bytes, &chained); sg_index = areq_ctx->srcSgl->length; //check where the data starts while (sg_index <= size_to_skip) { @@ -1139,7 +1139,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( areq_ctx->srcSgl = sg_next(areq_ctx->srcSgl); //if have reached the end of the sgl, then this is unexpected if (areq_ctx->srcSgl == NULL) { - SSI_LOG_ERR("reached end of sg list. unexpected \n"); + SSI_LOG_ERR("reached end of sg list. unexpected\n"); BUG(); } sg_index += areq_ctx->srcSgl->length; @@ -1157,7 +1157,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( areq_ctx->srcOffset = offset; if (req->src != req->dst) { - size_for_map = req->assoclen +req->cryptlen; + size_for_map = req->assoclen + req->cryptlen; size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? authsize : 0; if (is_gcm4543) { size_for_map += crypto_aead_ivsize(tfm); @@ -1173,7 +1173,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( } } - dst_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->dst,size_for_map,&dst_last_bytes, &chained); + dst_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->dst, size_for_map, &dst_last_bytes, &chained); sg_index = areq_ctx->dstSgl->length; offset = size_to_skip; @@ -1184,7 +1184,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( areq_ctx->dstSgl = sg_next(areq_ctx->dstSgl); //if have reached the end of the sgl, then this is unexpected if (areq_ctx->dstSgl == NULL) { - SSI_LOG_ERR("reached end of sg list. unexpected \n"); + SSI_LOG_ERR("reached end of sg list. unexpected\n"); BUG(); } sg_index += areq_ctx->dstSgl->length; @@ -1214,7 +1214,7 @@ chain_data_exit: return rc; } -static void ssi_buffer_mgr_update_aead_mlli_nents( struct ssi_drvdata *drvdata, +static void ssi_buffer_mgr_update_aead_mlli_nents(struct ssi_drvdata *drvdata, struct aead_request *req) { struct aead_req_ctx *areq_ctx = aead_request_ctx(req); @@ -1298,8 +1298,8 @@ int ssi_buffer_mgr_map_aead_request( */ ssi_buffer_mgr_copy_scatterlist_portion( areq_ctx->backup_mac, req->src, - size_to_skip+ req->cryptlen - areq_ctx->req_authsize, - size_to_skip+ req->cryptlen, SSI_SG_TO_BUF); + size_to_skip + req->cryptlen - areq_ctx->req_authsize, + size_to_skip + req->cryptlen, SSI_SG_TO_BUF); } /* cacluate the size for cipher remove ICV in decrypt*/ @@ -1393,7 +1393,7 @@ int ssi_buffer_mgr_map_aead_request( size_to_map += crypto_aead_ivsize(tfm); rc = ssi_buffer_mgr_map_scatterlist(dev, req->src, size_to_map, DMA_BIDIRECTIONAL, &(areq_ctx->src.nents), - LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES+LLI_MAX_NUM_OF_DATA_ENTRIES, &dummy, &mapped_nents); + LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES + LLI_MAX_NUM_OF_DATA_ENTRIES, &dummy, &mapped_nents); if (unlikely(rc != 0)) { rc = -ENOMEM; goto aead_map_failure; @@ -1459,9 +1459,9 @@ int ssi_buffer_mgr_map_aead_request( } ssi_buffer_mgr_update_aead_mlli_nents(drvdata, req); - SSI_LOG_DEBUG("assoc params mn %d\n",areq_ctx->assoc.mlli_nents); - SSI_LOG_DEBUG("src params mn %d\n",areq_ctx->src.mlli_nents); - SSI_LOG_DEBUG("dst params mn %d\n",areq_ctx->dst.mlli_nents); + SSI_LOG_DEBUG("assoc params mn %d\n", areq_ctx->assoc.mlli_nents); + SSI_LOG_DEBUG("src params mn %d\n", areq_ctx->src.mlli_nents); + SSI_LOG_DEBUG("dst params mn %d\n", areq_ctx->dst.mlli_nents); } return 0; @@ -1503,7 +1503,7 @@ int ssi_buffer_mgr_map_hash_request_final( /*TODO: copy data in case that buffer is enough for operation */ /* map the previous buffer */ - if (*curr_buff_cnt != 0 ) { + if (*curr_buff_cnt != 0) { if (ssi_ahash_handle_curr_buf(dev, areq_ctx, curr_buff, *curr_buff_cnt, &sg_data) != 0) { return -ENOMEM; @@ -1511,7 +1511,7 @@ int ssi_buffer_mgr_map_hash_request_final( } if (src && (nbytes > 0) && do_update) { - if ( unlikely( ssi_buffer_mgr_map_scatterlist( dev,src, + if (unlikely(ssi_buffer_mgr_map_scatterlist(dev, src, nbytes, DMA_TO_DEVICE, &areq_ctx->in_nents, @@ -1519,9 +1519,9 @@ int ssi_buffer_mgr_map_hash_request_final( &dummy, &mapped_nents))){ goto unmap_curr_buff; } - if ( src && (mapped_nents == 1) - && (areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) ) { - memcpy(areq_ctx->buff_sg,src, + if (src && (mapped_nents == 1) + && (areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL)) { + memcpy(areq_ctx->buff_sg, src, sizeof(struct scatterlist)); areq_ctx->buff_sg->length = nbytes; areq_ctx->curr_sg = areq_ctx->buff_sg; @@ -1547,7 +1547,7 @@ int ssi_buffer_mgr_map_hash_request_final( } } /* change the buffer index for the unmap function */ - areq_ctx->buff_index = (areq_ctx->buff_index^1); + areq_ctx->buff_index = (areq_ctx->buff_index ^ 1); SSI_LOG_DEBUG("areq_ctx->data_dma_buf_type = %s\n", GET_DMA_BUFFER_TYPE(areq_ctx->data_dma_buf_type)); return 0; @@ -1556,7 +1556,7 @@ fail_unmap_din: dma_unmap_sg(dev, src, areq_ctx->in_nents, DMA_TO_DEVICE); unmap_curr_buff: - if (*curr_buff_cnt != 0 ) { + if (*curr_buff_cnt != 0) { dma_unmap_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE); } return -ENOMEM; @@ -1586,7 +1586,7 @@ int ssi_buffer_mgr_map_hash_request_update( SSI_LOG_DEBUG(" update params : curr_buff=%pK " "curr_buff_cnt=0x%X nbytes=0x%X " - "src=%pK curr_index=%u \n", + "src=%pK curr_index=%u\n", curr_buff, *curr_buff_cnt, nbytes, src, areq_ctx->buff_index); /* Init the type of the dma buffer */ @@ -1623,12 +1623,12 @@ int ssi_buffer_mgr_map_hash_request_update( /* Copy the new residue to next buffer */ if (*next_buff_cnt != 0) { SSI_LOG_DEBUG(" handle residue: next buff %pK skip data %u" - " residue %u \n", next_buff, + " residue %u\n", next_buff, (update_data_len - *curr_buff_cnt), *next_buff_cnt); ssi_buffer_mgr_copy_scatterlist_portion(next_buff, src, - (update_data_len -*curr_buff_cnt), - nbytes,SSI_SG_TO_BUF); + (update_data_len - *curr_buff_cnt), + nbytes, SSI_SG_TO_BUF); /* change the buffer index for next operation */ swap_index = 1; } @@ -1642,19 +1642,19 @@ int ssi_buffer_mgr_map_hash_request_update( swap_index = 1; } - if ( update_data_len > *curr_buff_cnt ) { - if ( unlikely( ssi_buffer_mgr_map_scatterlist( dev,src, - (update_data_len -*curr_buff_cnt), + if (update_data_len > *curr_buff_cnt) { + if (unlikely(ssi_buffer_mgr_map_scatterlist(dev, src, + (update_data_len - *curr_buff_cnt), DMA_TO_DEVICE, &areq_ctx->in_nents, LLI_MAX_NUM_OF_DATA_ENTRIES, &dummy, &mapped_nents))){ goto unmap_curr_buff; } - if ( (mapped_nents == 1) - && (areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) ) { + if ((mapped_nents == 1) + && (areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL)) { /* only one entry in the SG and no previous data */ - memcpy(areq_ctx->buff_sg,src, + memcpy(areq_ctx->buff_sg, src, sizeof(struct scatterlist)); areq_ctx->buff_sg->length = update_data_len; areq_ctx->data_dma_buf_type = SSI_DMA_BUF_DLLI; @@ -1678,7 +1678,7 @@ int ssi_buffer_mgr_map_hash_request_update( } } - areq_ctx->buff_index = (areq_ctx->buff_index^swap_index); + areq_ctx->buff_index = (areq_ctx->buff_index ^ swap_index); return 0; @@ -1686,7 +1686,7 @@ fail_unmap_din: dma_unmap_sg(dev, src, areq_ctx->in_nents, DMA_TO_DEVICE); unmap_curr_buff: - if (*curr_buff_cnt != 0 ) { + if (*curr_buff_cnt != 0) { dma_unmap_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE); } return -ENOMEM; @@ -1722,7 +1722,7 @@ void ssi_buffer_mgr_unmap_hash_request( if (*prev_len != 0) { SSI_LOG_DEBUG("Unmapped buffer: areq_ctx->buff_sg=%pK" - "dma=0x%llX len 0x%X\n", + " dma=0x%llX len 0x%X\n", sg_virt(areq_ctx->buff_sg), (unsigned long long)sg_dma_address(areq_ctx->buff_sg), sg_dma_len(areq_ctx->buff_sg)); diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 34450a5e6573..519e04ef6e70 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -69,9 +69,9 @@ static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __io static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { - switch (ctx_p->flow_mode){ + switch (ctx_p->flow_mode) { case S_DIN_to_AES: - switch (size){ + switch (size) { case CC_AES_128_BIT_KEY_SIZE: case CC_AES_192_BIT_KEY_SIZE: if (likely((ctx_p->cipher_mode != DRV_CIPHER_XTS) && @@ -81,8 +81,8 @@ static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { break; case CC_AES_256_BIT_KEY_SIZE: return 0; - case (CC_AES_192_BIT_KEY_SIZE*2): - case (CC_AES_256_BIT_KEY_SIZE*2): + case (CC_AES_192_BIT_KEY_SIZE * 2): + case (CC_AES_256_BIT_KEY_SIZE * 2): if (likely((ctx_p->cipher_mode == DRV_CIPHER_XTS) || (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) || (ctx_p->cipher_mode == DRV_CIPHER_BITLOCKER))) @@ -111,9 +111,9 @@ static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { static int validate_data_size(struct ssi_ablkcipher_ctx *ctx_p, unsigned int size) { - switch (ctx_p->flow_mode){ + switch (ctx_p->flow_mode) { case S_DIN_to_AES: - switch (ctx_p->cipher_mode){ + switch (ctx_p->cipher_mode) { case DRV_CIPHER_XTS: if ((size >= SSI_MIN_AES_XTS_SIZE) && (size <= SSI_MAX_AES_XTS_SIZE) && @@ -198,7 +198,7 @@ static int ssi_blkcipher_init(struct crypto_tfm *tfm) dev = &ctx_p->drvdata->plat_dev->dev; /* Allocate key buffer, cache line aligned */ - ctx_p->user.key = kmalloc(max_key_buf_size, GFP_KERNEL|GFP_DMA); + ctx_p->user.key = kmalloc(max_key_buf_size, GFP_KERNEL | GFP_DMA); if (!ctx_p->user.key) { SSI_LOG_ERR("Allocating key buffer in context failed\n"); rc = -ENOMEM; @@ -257,11 +257,11 @@ static void ssi_blkcipher_exit(struct crypto_tfm *tfm) } -typedef struct tdes_keys{ +typedef struct tdes_keys { u8 key1[DES_KEY_SIZE]; u8 key2[DES_KEY_SIZE]; u8 key3[DES_KEY_SIZE]; -}tdes_keys_t; +} tdes_keys_t; static const u8 zero_buff[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -275,8 +275,8 @@ static int ssi_fips_verify_3des_keys(const u8 *key, unsigned int keylen) tdes_keys_t *tdes_key = (tdes_keys_t*)key; /* verify key1 != key2 and key3 != key2*/ - if (unlikely( (memcmp((u8*)tdes_key->key1, (u8*)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || - (memcmp((u8*)tdes_key->key3, (u8*)tdes_key->key2, sizeof(tdes_key->key3)) == 0) )) { + if (unlikely((memcmp((u8*)tdes_key->key1, (u8*)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || + (memcmp((u8*)tdes_key->key3, (u8*)tdes_key->key2, sizeof(tdes_key->key3)) == 0))) { return -ENOEXEC; } #endif /* CCREE_FIPS_SUPPORT */ @@ -336,11 +336,11 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, #if SSI_CC_HAS_MULTI2 /*last byte of key buffer is round number and should not be a part of key size*/ if (ctx_p->flow_mode == S_DIN_to_MULTI2) { - keylen -=1; + keylen -= 1; } #endif /*SSI_CC_HAS_MULTI2*/ - if (unlikely(validate_keys_sizes(ctx_p,keylen) != 0)) { + if (unlikely(validate_keys_sizes(ctx_p, keylen) != 0)) { SSI_LOG_ERR("Unsupported key size %d.\n", keylen); crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); return -EINVAL; @@ -485,7 +485,7 @@ ssi_blkcipher_create_setup_desc( set_flow_mode(&desc[*seq_size], flow_mode); set_cipher_mode(&desc[*seq_size], cipher_mode); if ((cipher_mode == DRV_CIPHER_CTR) || - (cipher_mode == DRV_CIPHER_OFB) ) { + (cipher_mode == DRV_CIPHER_OFB)) { set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE1); } else { set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE0); @@ -650,7 +650,7 @@ ssi_blkcipher_create_data_desc( return; } /* Process */ - if (likely(req_ctx->dma_buf_type == SSI_DMA_BUF_DLLI)){ + if (likely(req_ctx->dma_buf_type == SSI_DMA_BUF_DLLI)) { SSI_LOG_DEBUG(" data params addr 0x%llX length 0x%X \n", (unsigned long long)sg_dma_address(src), nbytes); @@ -737,10 +737,10 @@ static int ssi_blkcipher_complete(struct device *dev, /*Set the inflight couter value to local variable*/ inflight_counter = ctx_p->drvdata->inflight_counter; /*Decrease the inflight counter*/ - if(ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) + if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0) ctx_p->drvdata->inflight_counter--; - if(areq){ + if (areq) { ablkcipher_request_complete(areq, completion_error); return 0; } @@ -761,10 +761,10 @@ static int ssi_blkcipher_process( struct device *dev = &ctx_p->drvdata->plat_dev->dev; struct cc_hw_desc desc[MAX_ABLKCIPHER_SEQ_LEN]; struct ssi_crypto_req ssi_req = {}; - int rc, seq_len = 0,cts_restore_flag = 0; + int rc, seq_len = 0, cts_restore_flag = 0; SSI_LOG_DEBUG("%s areq=%p info=%p nbytes=%d\n", - ((direction==DRV_CRYPTO_DIRECTION_ENCRYPT)?"Encrypt":"Decrypt"), + ((direction == DRV_CRYPTO_DIRECTION_ENCRYPT) ? "Encrypt" : "Decrypt"), areq, info, nbytes); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -781,7 +781,7 @@ static int ssi_blkcipher_process( return 0; } /*For CTS in case of data size aligned to 16 use CBC mode*/ - if (((nbytes % AES_BLOCK_SIZE) == 0) && (ctx_p->cipher_mode == DRV_CIPHER_CBC_CTS)){ + if (((nbytes % AES_BLOCK_SIZE) == 0) && (ctx_p->cipher_mode == DRV_CIPHER_CBC_CTS)) { ctx_p->cipher_mode = DRV_CIPHER_CBC; cts_restore_flag = 1; @@ -848,8 +848,8 @@ static int ssi_blkcipher_process( /* STAT_PHASE_3: Lock HW and push sequence */ - rc = send_request(ctx_p->drvdata, &ssi_req, desc, seq_len, (areq == NULL)? 0:1); - if(areq != NULL) { + rc = send_request(ctx_p->drvdata, &ssi_req, desc, seq_len, (areq == NULL) ? 0 : 1); + if (areq != NULL) { if (unlikely(rc != -EINPROGRESS)) { /* Failed to send the request or request completed synchronously */ ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 151afcfa602d..7c94354c8dd3 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -77,7 +77,7 @@ #ifdef DX_DUMP_BYTES void dump_byte_array(const char *name, const u8 *the_array, unsigned long size) { - int i , line_offset = 0, ret = 0; + int i, line_offset = 0, ret = 0; const u8 *cur_byte; char line_buf[80]; @@ -89,17 +89,17 @@ void dump_byte_array(const char *name, const u8 *the_array, unsigned long size) ret = snprintf(line_buf, sizeof(line_buf), "%s[%lu]: ", name, size); if (ret < 0) { - SSI_LOG_ERR("snprintf returned %d . aborting buffer array dump\n",ret); + SSI_LOG_ERR("snprintf returned %d . aborting buffer array dump\n", ret); return; } line_offset = ret; - for (i = 0 , cur_byte = the_array; + for (i = 0, cur_byte = the_array; (i < size) && (line_offset < sizeof(line_buf)); i++, cur_byte++) { ret = snprintf(line_buf + line_offset, sizeof(line_buf) - line_offset, "0x%02X ", *cur_byte); if (ret < 0) { - SSI_LOG_ERR("snprintf returned %d . aborting buffer array dump\n",ret); + SSI_LOG_ERR("snprintf returned %d . aborting buffer array dump\n", ret); return; } line_offset += ret; @@ -301,9 +301,9 @@ static int init_cc_resources(struct platform_device *plat_dev) if (rc) goto init_cc_res_err; - if(new_drvdata->plat_dev->dev.dma_mask == NULL) + if (new_drvdata->plat_dev->dev.dma_mask == NULL) { - new_drvdata->plat_dev->dev.dma_mask = & new_drvdata->plat_dev->dev.coherent_dma_mask; + new_drvdata->plat_dev->dev.dma_mask = &new_drvdata->plat_dev->dev.coherent_dma_mask; } if (!new_drvdata->plat_dev->dev.coherent_dma_mask) { @@ -523,7 +523,7 @@ static int cc7x_probe(struct platform_device *plat_dev) asm volatile("mrc p15, 0, %0, c0, c0, 0" : "=r" (ctr)); SSI_LOG_DEBUG("Main ID register (MIDR): Implementer 0x%02X, Arch 0x%01X," " Part 0x%03X, Rev r%dp%d\n", - (ctr>>24), (ctr>>16)&0xF, (ctr>>4)&0xFFF, (ctr>>20)&0xF, ctr&0xF); + (ctr >> 24), (ctr >> 16) & 0xF, (ctr >> 4) & 0xFFF, (ctr >> 20) & 0xF, ctr & 0xF); #endif /* Map registers space */ @@ -546,13 +546,13 @@ static int cc7x_remove(struct platform_device *plat_dev) return 0; } -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) static struct dev_pm_ops arm_cc7x_driver_pm = { SET_RUNTIME_PM_OPS(ssi_power_mgr_runtime_suspend, ssi_power_mgr_runtime_resume, NULL) }; #endif -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) #define DX_DRIVER_RUNTIME_PM (&arm_cc7x_driver_pm) #else #define DX_DRIVER_RUNTIME_PM NULL diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 1b8471bc1531..c1ed61f1a202 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -93,7 +93,7 @@ /* Logging macros */ #define SSI_LOG(level, format, ...) \ - printk(level "cc715ree::%s: " format , __func__, ##__VA_ARGS__) + printk(level "cc715ree::%s: " format, __func__, ##__VA_ARGS__) #define SSI_LOG_ERR(format, ...) SSI_LOG(KERN_ERR, format, ##__VA_ARGS__) #define SSI_LOG_WARNING(format, ...) SSI_LOG(KERN_WARNING, format, ##__VA_ARGS__) #define SSI_LOG_NOTICE(format, ...) SSI_LOG(KERN_NOTICE, format, ##__VA_ARGS__) @@ -107,7 +107,7 @@ #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#define SSI_MAX_IVGEN_DMA_ADDRESSES 3 +#define SSI_MAX_IVGEN_DMA_ADDRESSES 3 struct ssi_crypto_req { void (*user_cb)(struct device *dev, void *req, void __iomem *cc_base); void *user_arg; diff --git a/drivers/staging/ccree/ssi_fips_data.h b/drivers/staging/ccree/ssi_fips_data.h index fa6bf41c27e5..27b2866b4cd9 100644 --- a/drivers/staging/ccree/ssi_fips_data.h +++ b/drivers/staging/ccree/ssi_fips_data.h @@ -153,20 +153,20 @@ #define NIST_TDES_VECTOR_SIZE 8 #define NIST_TDES_IV_SIZE 8 -#define NIST_TDES_ECB_IV { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define NIST_TDES_ECB_IV { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } #define NIST_TDES_ECB3_KEY { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, \ 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, \ 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23 } -#define NIST_TDES_ECB3_PLAIN_DATA { 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x66, 0x63 } -#define NIST_TDES_ECB3_CIPHER { 0xa8, 0x26, 0xfd, 0x8c, 0xe5, 0x3b, 0x85, 0x5f } +#define NIST_TDES_ECB3_PLAIN_DATA { 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x66, 0x63 } +#define NIST_TDES_ECB3_CIPHER { 0xa8, 0x26, 0xfd, 0x8c, 0xe5, 0x3b, 0x85, 0x5f } -#define NIST_TDES_CBC3_IV { 0xf8, 0xee, 0xe1, 0x35, 0x9c, 0x6e, 0x54, 0x40 } +#define NIST_TDES_CBC3_IV { 0xf8, 0xee, 0xe1, 0x35, 0x9c, 0x6e, 0x54, 0x40 } #define NIST_TDES_CBC3_KEY { 0xe9, 0xda, 0x37, 0xf8, 0xdc, 0x97, 0x6d, 0x5b, \ 0xb6, 0x8c, 0x04, 0xe3, 0xec, 0x98, 0x20, 0x15, \ 0xf4, 0x0e, 0x08, 0xb5, 0x97, 0x29, 0xf2, 0x8f } -#define NIST_TDES_CBC3_PLAIN_DATA { 0x3b, 0xb7, 0xa7, 0xdb, 0xa3, 0xd5, 0x92, 0x91 } -#define NIST_TDES_CBC3_CIPHER { 0x5b, 0x84, 0x24, 0xd2, 0x39, 0x3e, 0x55, 0xa2 } +#define NIST_TDES_CBC3_PLAIN_DATA { 0x3b, 0xb7, 0xa7, 0xdb, 0xa3, 0xd5, 0x92, 0x91 } +#define NIST_TDES_CBC3_CIPHER { 0x5b, 0x84, 0x24, 0xd2, 0x39, 0x3e, 0x55, 0xa2 } /* NIST AES-CCM */ diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index 6c79e7de207f..804384d5c2be 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -214,8 +214,8 @@ static const FipsCipherData FipsCipherDataTable[] = { { 1, NIST_AES_256_XTS_KEY, CC_AES_256_BIT_KEY_SIZE, NIST_AES_256_XTS_IV, DRV_CRYPTO_DIRECTION_ENCRYPT, DRV_CIPHER_XTS, NIST_AES_256_XTS_PLAIN, NIST_AES_256_XTS_CIPHER, NIST_AES_256_XTS_VECTOR_SIZE }, { 1, NIST_AES_256_XTS_KEY, CC_AES_256_BIT_KEY_SIZE, NIST_AES_256_XTS_IV, DRV_CRYPTO_DIRECTION_DECRYPT, DRV_CIPHER_XTS, NIST_AES_256_XTS_CIPHER, NIST_AES_256_XTS_PLAIN, NIST_AES_256_XTS_VECTOR_SIZE }, #if (CC_SUPPORT_SHA > 256) - { 1, NIST_AES_512_XTS_KEY, 2*CC_AES_256_BIT_KEY_SIZE, NIST_AES_512_XTS_IV, DRV_CRYPTO_DIRECTION_ENCRYPT, DRV_CIPHER_XTS, NIST_AES_512_XTS_PLAIN, NIST_AES_512_XTS_CIPHER, NIST_AES_512_XTS_VECTOR_SIZE }, - { 1, NIST_AES_512_XTS_KEY, 2*CC_AES_256_BIT_KEY_SIZE, NIST_AES_512_XTS_IV, DRV_CRYPTO_DIRECTION_DECRYPT, DRV_CIPHER_XTS, NIST_AES_512_XTS_CIPHER, NIST_AES_512_XTS_PLAIN, NIST_AES_512_XTS_VECTOR_SIZE }, + { 1, NIST_AES_512_XTS_KEY, 2 * CC_AES_256_BIT_KEY_SIZE, NIST_AES_512_XTS_IV, DRV_CRYPTO_DIRECTION_ENCRYPT, DRV_CIPHER_XTS, NIST_AES_512_XTS_PLAIN, NIST_AES_512_XTS_CIPHER, NIST_AES_512_XTS_VECTOR_SIZE }, + { 1, NIST_AES_512_XTS_KEY, 2 * CC_AES_256_BIT_KEY_SIZE, NIST_AES_512_XTS_IV, DRV_CRYPTO_DIRECTION_DECRYPT, DRV_CIPHER_XTS, NIST_AES_512_XTS_CIPHER, NIST_AES_512_XTS_PLAIN, NIST_AES_512_XTS_VECTOR_SIZE }, #endif /* DES */ { 0, NIST_TDES_ECB3_KEY, CC_DRV_DES_TRIPLE_KEY_SIZE, NIST_TDES_ECB_IV, DRV_CRYPTO_DIRECTION_ENCRYPT, DRV_CIPHER_ECB, NIST_TDES_ECB3_PLAIN_DATA, NIST_TDES_ECB3_CIPHER, NIST_TDES_VECTOR_SIZE }, @@ -277,9 +277,9 @@ FIPS_CipherToFipsError(enum drv_cipher_mode mode, bool is_aes) switch (mode) { case DRV_CIPHER_ECB: - return is_aes ? CC_REE_FIPS_ERROR_AES_ECB_PUT : CC_REE_FIPS_ERROR_DES_ECB_PUT ; + return is_aes ? CC_REE_FIPS_ERROR_AES_ECB_PUT : CC_REE_FIPS_ERROR_DES_ECB_PUT; case DRV_CIPHER_CBC: - return is_aes ? CC_REE_FIPS_ERROR_AES_CBC_PUT : CC_REE_FIPS_ERROR_DES_CBC_PUT ; + return is_aes ? CC_REE_FIPS_ERROR_AES_CBC_PUT : CC_REE_FIPS_ERROR_DES_CBC_PUT; case DRV_CIPHER_OFB: return CC_REE_FIPS_ERROR_AES_OFB_PUT; case DRV_CIPHER_CTR: @@ -332,7 +332,7 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, set_flow_mode(&desc[idx], s_flow_mode); set_cipher_mode(&desc[idx], cipher_mode); if ((cipher_mode == DRV_CIPHER_CTR) || - (cipher_mode == DRV_CIPHER_OFB) ) { + (cipher_mode == DRV_CIPHER_OFB)) { set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); } else { set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); @@ -432,7 +432,7 @@ ssi_cipher_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffe { FipsCipherData *cipherData = (FipsCipherData*)&FipsCipherDataTable[i]; int rc = 0; - size_t iv_size = cipherData->isAes ? NIST_AES_IV_SIZE : NIST_TDES_IV_SIZE ; + size_t iv_size = cipherData->isAes ? NIST_AES_IV_SIZE : NIST_TDES_IV_SIZE; memset(cpu_addr_buffer, 0, sizeof(struct fips_cipher_ctx)); diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index d6c994a2362c..33a07e47b698 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -88,9 +88,9 @@ static void ssi_fips_update_tee_upon_ree_status(struct ssi_drvdata *drvdata, ssi { void __iomem *cc_base = drvdata->cc_base; if (err == CC_REE_FIPS_ERROR_OK) { - CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), (CC_FIPS_SYNC_REE_STATUS|CC_FIPS_SYNC_MODULE_OK)); + CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), (CC_FIPS_SYNC_REE_STATUS | CC_FIPS_SYNC_MODULE_OK)); } else { - CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), (CC_FIPS_SYNC_REE_STATUS|CC_FIPS_SYNC_MODULE_ERROR)); + CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), (CC_FIPS_SYNC_REE_STATUS | CC_FIPS_SYNC_MODULE_ERROR)); } } @@ -305,7 +305,7 @@ int ssi_fips_init(struct ssi_drvdata *p_drvdata) FIPS_DBG("CC FIPS code .. (fips=%d) \n", ssi_fips_support); - fips_h = kzalloc(sizeof(struct ssi_fips_handle),GFP_KERNEL); + fips_h = kzalloc(sizeof(struct ssi_fips_handle), GFP_KERNEL); if (fips_h == NULL) { ssi_fips_set_error(p_drvdata, CC_REE_FIPS_ERROR_GENERAL); return -ENOMEM; @@ -329,7 +329,7 @@ int ssi_fips_init(struct ssi_drvdata *p_drvdata) #endif /* init fips driver data */ - rc = ssi_fips_set_state((ssi_fips_support == 0)? CC_FIPS_STATE_NOT_SUPPORTED : CC_FIPS_STATE_SUPPORTED); + rc = ssi_fips_set_state((ssi_fips_support == 0) ? CC_FIPS_STATE_NOT_SUPPORTED : CC_FIPS_STATE_SUPPORTED); if (unlikely(rc != 0)) { ssi_fips_set_error(p_drvdata, CC_REE_FIPS_ERROR_GENERAL); rc = -EAGAIN; diff --git a/drivers/staging/ccree/ssi_fips_local.h b/drivers/staging/ccree/ssi_fips_local.h index ac1ab967def5..fa0908434602 100644 --- a/drivers/staging/ccree/ssi_fips_local.h +++ b/drivers/staging/ccree/ssi_fips_local.h @@ -24,24 +24,24 @@ struct ssi_drvdata; // IG - how to make 1 file for TEE and REE -typedef enum CC_FipsSyncStatus{ - CC_FIPS_SYNC_MODULE_OK = 0x0, - CC_FIPS_SYNC_MODULE_ERROR = 0x1, - CC_FIPS_SYNC_REE_STATUS = 0x4, - CC_FIPS_SYNC_TEE_STATUS = 0x8, - CC_FIPS_SYNC_STATUS_RESERVE32B = S32_MAX -}CCFipsSyncStatus_t; +typedef enum CC_FipsSyncStatus { + CC_FIPS_SYNC_MODULE_OK = 0x0, + CC_FIPS_SYNC_MODULE_ERROR = 0x1, + CC_FIPS_SYNC_REE_STATUS = 0x4, + CC_FIPS_SYNC_TEE_STATUS = 0x8, + CC_FIPS_SYNC_STATUS_RESERVE32B = S32_MAX +} CCFipsSyncStatus_t; #define CHECK_AND_RETURN_UPON_FIPS_ERROR() {\ if (ssi_fips_check_fips_error() != 0) {\ return -ENOEXEC;\ - }\ + } \ } #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR() {\ if (ssi_fips_check_fips_error() != 0) {\ return;\ - }\ + } \ } #define SSI_FIPS_INIT(p_drvData) (ssi_fips_init(p_drvData)) #define SSI_FIPS_FINI(p_drvData) (ssi_fips_fini(p_drvData)) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index bfe2becfcbad..64e969e6ca4f 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -111,7 +111,7 @@ struct ssi_hash_ctx { static void ssi_hash_create_data_desc( struct ahash_req_ctx *areq_ctx, struct ssi_hash_ctx *ctx, - unsigned int flow_mode,struct cc_hw_desc desc[], + unsigned int flow_mode, struct cc_hw_desc desc[], bool is_not_last_data, unsigned int *seq_size); @@ -158,22 +158,22 @@ static int ssi_hash_map_request(struct device *dev, struct cc_hw_desc desc; int rc = -ENOMEM; - state->buff0 = kzalloc(SSI_MAX_HASH_BLCK_SIZE ,GFP_KERNEL|GFP_DMA); + state->buff0 = kzalloc(SSI_MAX_HASH_BLCK_SIZE, GFP_KERNEL | GFP_DMA); if (!state->buff0) { SSI_LOG_ERR("Allocating buff0 in context failed\n"); goto fail0; } - state->buff1 = kzalloc(SSI_MAX_HASH_BLCK_SIZE ,GFP_KERNEL|GFP_DMA); + state->buff1 = kzalloc(SSI_MAX_HASH_BLCK_SIZE, GFP_KERNEL | GFP_DMA); if (!state->buff1) { SSI_LOG_ERR("Allocating buff1 in context failed\n"); goto fail_buff0; } - state->digest_result_buff = kzalloc(SSI_MAX_HASH_DIGEST_SIZE ,GFP_KERNEL|GFP_DMA); + state->digest_result_buff = kzalloc(SSI_MAX_HASH_DIGEST_SIZE, GFP_KERNEL | GFP_DMA); if (!state->digest_result_buff) { SSI_LOG_ERR("Allocating digest_result_buff in context failed\n"); goto fail_buff1; } - state->digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL|GFP_DMA); + state->digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL | GFP_DMA); if (!state->digest_buff) { SSI_LOG_ERR("Allocating digest-buffer in context failed\n"); goto fail_digest_result_buff; @@ -181,7 +181,7 @@ static int ssi_hash_map_request(struct device *dev, SSI_LOG_DEBUG("Allocated digest-buffer in context ctx->digest_buff=@%p\n", state->digest_buff); if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) { - state->digest_bytes_len = kzalloc(HASH_LEN_SIZE, GFP_KERNEL|GFP_DMA); + state->digest_bytes_len = kzalloc(HASH_LEN_SIZE, GFP_KERNEL | GFP_DMA); if (!state->digest_bytes_len) { SSI_LOG_ERR("Allocating digest-bytes-len in context failed\n"); goto fail1; @@ -191,7 +191,7 @@ static int ssi_hash_map_request(struct device *dev, state->digest_bytes_len = NULL; } - state->opad_digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL|GFP_DMA); + state->opad_digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL | GFP_DMA); if (!state->opad_digest_buff) { SSI_LOG_ERR("Allocating opad-digest-buffer in context failed\n"); goto fail2; @@ -431,7 +431,7 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, int rc = 0; - SSI_LOG_DEBUG("===== %s-digest (%d) ====\n", is_hmac?"hmac":"hash", nbytes); + SSI_LOG_DEBUG("===== %s-digest (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -598,7 +598,7 @@ static int ssi_hash_update(struct ahash_req_ctx *state, int rc; SSI_LOG_DEBUG("===== %s-update (%d) ====\n", ctx->is_hmac ? - "hmac":"hash", nbytes); + "hmac" : "hash", nbytes); CHECK_AND_RETURN_UPON_FIPS_ERROR(); if (nbytes == 0) { @@ -696,11 +696,11 @@ static int ssi_hash_finup(struct ahash_req_ctx *state, int idx = 0; int rc; - SSI_LOG_DEBUG("===== %s-finup (%d) ====\n", is_hmac?"hmac":"hash", nbytes); + SSI_LOG_DEBUG("===== %s-finup (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); CHECK_AND_RETURN_UPON_FIPS_ERROR(); - if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, src , nbytes, 1) != 0)) { + if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1) != 0)) { SSI_LOG_ERR("map_ahash_request_final() failed\n"); return -ENOMEM; } @@ -742,7 +742,7 @@ static int ssi_hash_finup(struct ahash_req_ctx *state, set_cipher_mode(&desc[idx], ctx->hw_mode); set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, digestsize, NS_BIT, 0); - ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); + ssi_set_hash_endianity(ctx->hash_mode, &desc[idx]); set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; @@ -792,7 +792,7 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); - ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); + ssi_set_hash_endianity(ctx->hash_mode, &desc[idx]); set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; @@ -833,7 +833,7 @@ static int ssi_hash_final(struct ahash_req_ctx *state, int idx = 0; int rc; - SSI_LOG_DEBUG("===== %s-final (%d) ====\n", is_hmac?"hmac":"hash", nbytes); + SSI_LOG_DEBUG("===== %s-final (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -890,7 +890,7 @@ static int ssi_hash_final(struct ahash_req_ctx *state, set_cipher_mode(&desc[idx], ctx->hw_mode); set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, digestsize, NS_BIT, 0); - ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); + ssi_set_hash_endianity(ctx->hash_mode, &desc[idx]); set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); idx++; @@ -939,7 +939,7 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); - ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); + ssi_set_hash_endianity(ctx->hash_mode, &desc[idx]); set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; @@ -1057,7 +1057,7 @@ static int ssi_hash_setkey(void *hash, set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); - ssi_set_hash_endianity(ctx->hash_mode,&desc[idx]); + ssi_set_hash_endianity(ctx->hash_mode, &desc[idx]); idx++; hw_desc_init(&desc[idx]); @@ -1871,7 +1871,7 @@ out: static int ssi_ahash_setkey(struct crypto_ahash *ahash, const u8 *key, unsigned int keylen) { - return ssi_hash_setkey((void *) ahash, key, keylen, false); + return ssi_hash_setkey((void *)ahash, key, keylen, false); } struct ssi_hash_template { @@ -2143,7 +2143,7 @@ int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata) struct ssi_hash_handle *hash_handle = drvdata->hash_handle; ssi_sram_addr_t sram_buff_ofs = hash_handle->digest_len_sram_addr; unsigned int larval_seq_len = 0; - struct cc_hw_desc larval_seq[CC_DIGEST_SIZE_MAX/sizeof(u32)]; + struct cc_hw_desc larval_seq[CC_DIGEST_SIZE_MAX / sizeof(u32)]; int rc = 0; #if (DX_DEV_SHA_MAX > 256) int i; diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c index 67ae1dce1273..c8c58754a792 100644 --- a/drivers/staging/ccree/ssi_pm.c +++ b/drivers/staging/ccree/ssi_pm.c @@ -31,7 +31,7 @@ #include "ssi_pm.h" -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) #define POWER_DOWN_ENABLE 0x01 #define POWER_DOWN_DISABLE 0x00 @@ -71,14 +71,14 @@ int ssi_power_mgr_runtime_resume(struct device *dev) } rc = init_cc_regs(drvdata, false); - if (rc !=0) { - SSI_LOG_ERR("init_cc_regs (%x)\n",rc); + if (rc != 0) { + SSI_LOG_ERR("init_cc_regs (%x)\n", rc); return rc; } rc = ssi_request_mgr_runtime_resume_queue(drvdata); - if (rc !=0) { - SSI_LOG_ERR("ssi_request_mgr_runtime_resume_queue (%x)\n",rc); + if (rc != 0) { + SSI_LOG_ERR("ssi_request_mgr_runtime_resume_queue (%x)\n", rc); return rc; } @@ -126,10 +126,10 @@ int ssi_power_mgr_runtime_put_suspend(struct device *dev) int ssi_power_mgr_init(struct ssi_drvdata *drvdata) { int rc = 0; -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) struct platform_device *plat_dev = drvdata->plat_dev; /* must be before the enabling to avoid resdundent suspending */ - pm_runtime_set_autosuspend_delay(&plat_dev->dev,SSI_SUSPEND_TIMEOUT); + pm_runtime_set_autosuspend_delay(&plat_dev->dev, SSI_SUSPEND_TIMEOUT); pm_runtime_use_autosuspend(&plat_dev->dev); /* activate the PM module */ rc = pm_runtime_set_active(&plat_dev->dev); @@ -143,7 +143,7 @@ int ssi_power_mgr_init(struct ssi_drvdata *drvdata) void ssi_power_mgr_fini(struct ssi_drvdata *drvdata) { -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) struct platform_device *plat_dev = drvdata->plat_dev; pm_runtime_disable(&plat_dev->dev); diff --git a/drivers/staging/ccree/ssi_pm.h b/drivers/staging/ccree/ssi_pm.h index 8b0d8be95199..4874987ffa77 100644 --- a/drivers/staging/ccree/ssi_pm.h +++ b/drivers/staging/ccree/ssi_pm.h @@ -32,7 +32,7 @@ int ssi_power_mgr_init(struct ssi_drvdata *drvdata); void ssi_power_mgr_fini(struct ssi_drvdata *drvdata); -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) int ssi_power_mgr_runtime_suspend(struct device *dev); int ssi_power_mgr_runtime_resume(struct device *dev); diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 2c6937af995d..31765788017b 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -57,7 +57,7 @@ struct ssi_request_mgr_handle { #else struct tasklet_struct comptask; #endif -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) bool is_runtime_suspended; #endif }; @@ -81,7 +81,7 @@ void request_mgr_fini(struct ssi_drvdata *drvdata) } SSI_LOG_DEBUG("max_used_hw_slots=%d\n", (req_mgr_h->hw_queue_size - - req_mgr_h->min_free_hw_slots) ); + req_mgr_h->min_free_hw_slots)); SSI_LOG_DEBUG("max_used_sw_slots=%d\n", req_mgr_h->max_used_sw_slots); #ifdef COMP_IN_WQ @@ -101,7 +101,7 @@ int request_mgr_init(struct ssi_drvdata *drvdata) struct ssi_request_mgr_handle *req_mgr_h; int rc = 0; - req_mgr_h = kzalloc(sizeof(struct ssi_request_mgr_handle),GFP_KERNEL); + req_mgr_h = kzalloc(sizeof(struct ssi_request_mgr_handle), GFP_KERNEL); if (req_mgr_h == NULL) { rc = -ENOMEM; goto req_mgr_init_err; @@ -168,13 +168,13 @@ static inline void enqueue_seq( int i; for (i = 0; i < seq_len; i++) { - writel_relaxed(seq[i].word[0], (volatile void __iomem *)(cc_base+CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[1], (volatile void __iomem *)(cc_base+CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[2], (volatile void __iomem *)(cc_base+CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[3], (volatile void __iomem *)(cc_base+CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[4], (volatile void __iomem *)(cc_base+CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); + writel_relaxed(seq[i].word[0], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); + writel_relaxed(seq[i].word[1], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); + writel_relaxed(seq[i].word[2], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); + writel_relaxed(seq[i].word[3], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); + writel_relaxed(seq[i].word[4], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); wmb(); - writel_relaxed(seq[i].word[5], (volatile void __iomem *)(cc_base+CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); + writel_relaxed(seq[i].word[5], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); #ifdef DX_DUMP_DESCS SSI_LOG_DEBUG("desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n", i, seq[i].word[0], seq[i].word[1], seq[i].word[2], seq[i].word[3], seq[i].word[4], seq[i].word[5]); @@ -215,11 +215,11 @@ static inline int request_mgr_queues_status_check( return -EBUSY; } - if ((likely(req_mgr_h->q_free_slots >= total_seq_len)) ) { + if ((likely(req_mgr_h->q_free_slots >= total_seq_len))) { return 0; } /* Wait for space in HW queue. Poll constant num of iterations. */ - for (poll_queue =0; poll_queue < SSI_MAX_POLL_ITER ; poll_queue ++) { + for (poll_queue = 0; poll_queue < SSI_MAX_POLL_ITER ; poll_queue++) { req_mgr_h->q_free_slots = CC_HAL_READ_REGISTER( CC_REG_OFFSET(CRY_KERNEL, @@ -229,7 +229,7 @@ static inline int request_mgr_queues_status_check( req_mgr_h->min_free_hw_slots = req_mgr_h->q_free_slots; } - if (likely (req_mgr_h->q_free_slots >= total_seq_len)) { + if (likely(req_mgr_h->q_free_slots >= total_seq_len)) { /* If there is enough place return */ return 0; } @@ -255,8 +255,8 @@ static inline int request_mgr_queues_status_check( * \param desc The crypto sequence * \param len The crypto sequence length * \param is_dout If "true": completion is handled by the caller - * If "false": this function adds a dummy descriptor completion - * and waits upon completion signal. + * If "false": this function adds a dummy descriptor completion + * and waits upon completion signal. * * \return int Returns -EINPROGRESS if "is_dout=true"; "0" if "is_dout=false" */ @@ -273,13 +273,13 @@ int send_request( int rc; unsigned int max_required_seq_len = (total_seq_len + ((ssi_req->ivgen_dma_addr_len == 0) ? 0 : - SSI_IVPOOL_SEQ_LEN ) + - ((is_dout == 0 )? 1 : 0)); + SSI_IVPOOL_SEQ_LEN) + + ((is_dout == 0) ? 1 : 0)); -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) rc = ssi_power_mgr_runtime_get(&drvdata->plat_dev->dev); if (rc != 0) { - SSI_LOG_ERR("ssi_power_mgr_runtime_get returned %x\n",rc); + SSI_LOG_ERR("ssi_power_mgr_runtime_get returned %x\n", rc); return rc; } #endif @@ -294,7 +294,7 @@ int send_request( rc = request_mgr_queues_status_check(req_mgr_h, cc_base, max_required_seq_len); - if (likely(rc == 0 )) + if (likely(rc == 0)) /* There is enough place in the queue */ break; /* something wrong release the spinlock*/ @@ -304,7 +304,7 @@ int send_request( /* Any error other than HW queue full * (SW queue is full) */ -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) ssi_power_mgr_runtime_put_suspend(&drvdata->plat_dev->dev); #endif return rc; @@ -339,7 +339,7 @@ int send_request( if (unlikely(rc != 0)) { SSI_LOG_ERR("Failed to generate IV (rc=%d)\n", rc); spin_unlock_bh(&req_mgr_h->hw_lock); -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) ssi_power_mgr_runtime_put_suspend(&drvdata->plat_dev->dev); #endif return rc; @@ -348,7 +348,7 @@ int send_request( total_seq_len += iv_seq_len; } - used_sw_slots = ((req_mgr_h->req_queue_head - req_mgr_h->req_queue_tail) & (MAX_REQUEST_QUEUE_SIZE-1)); + used_sw_slots = ((req_mgr_h->req_queue_head - req_mgr_h->req_queue_tail) & (MAX_REQUEST_QUEUE_SIZE - 1)); if (unlikely(used_sw_slots > req_mgr_h->max_used_sw_slots)) { req_mgr_h->max_used_sw_slots = used_sw_slots; } @@ -412,7 +412,7 @@ int send_request_init( /* Wait for space in HW and SW FIFO. Poll for as much as FIFO_TIMEOUT. */ rc = request_mgr_queues_status_check(req_mgr_h, cc_base, total_seq_len); - if (unlikely(rc != 0 )) { + if (unlikely(rc != 0)) { return rc; } set_queue_last_ind(&desc[(len - 1)]); @@ -455,11 +455,11 @@ static void proc_completions(struct ssi_drvdata *drvdata) struct platform_device *plat_dev = drvdata->plat_dev; struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) int rc = 0; #endif - while(request_mgr_handle->axi_completed) { + while (request_mgr_handle->axi_completed) { request_mgr_handle->axi_completed--; /* Dequeue request */ @@ -480,7 +480,7 @@ static void proc_completions(struct ssi_drvdata *drvdata) u32 axi_err; int i; SSI_LOG_INFO("Delay\n"); - for (i=0;i<1000000;i++) { + for (i = 0; i < 1000000; i++) { axi_err = READ_REGISTER(drvdata->cc_base + CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR)); } } @@ -492,10 +492,10 @@ static void proc_completions(struct ssi_drvdata *drvdata) request_mgr_handle->req_queue_tail = (request_mgr_handle->req_queue_tail + 1) & (MAX_REQUEST_QUEUE_SIZE - 1); SSI_LOG_DEBUG("Dequeue request tail=%u\n", request_mgr_handle->req_queue_tail); SSI_LOG_DEBUG("Request completed. axi_completed=%d\n", request_mgr_handle->axi_completed); -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) rc = ssi_power_mgr_runtime_put_suspend(&plat_dev->dev); if (rc != 0) { - SSI_LOG_ERR("Failed to set runtime suspension %d\n",rc); + SSI_LOG_ERR("Failed to set runtime suspension %d\n", rc); } #endif } @@ -561,7 +561,7 @@ static void comp_handler(unsigned long devarg) * resume the queue configuration - no need to take the lock as this happens inside * the spin lock protection */ -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) int ssi_request_mgr_runtime_resume_queue(struct ssi_drvdata *drvdata) { struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; @@ -570,7 +570,7 @@ int ssi_request_mgr_runtime_resume_queue(struct ssi_drvdata *drvdata) request_mgr_handle->is_runtime_suspended = false; spin_unlock_bh(&request_mgr_handle->hw_lock); - return 0 ; + return 0; } /* @@ -600,7 +600,7 @@ bool ssi_request_mgr_is_queue_runtime_suspend(struct ssi_drvdata *drvdata) struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; - return request_mgr_handle->is_runtime_suspended; + return request_mgr_handle->is_runtime_suspended; } #endif diff --git a/drivers/staging/ccree/ssi_request_mgr.h b/drivers/staging/ccree/ssi_request_mgr.h index c4036ab715f1..bdbbf89e5367 100644 --- a/drivers/staging/ccree/ssi_request_mgr.h +++ b/drivers/staging/ccree/ssi_request_mgr.h @@ -33,8 +33,8 @@ int request_mgr_init(struct ssi_drvdata *drvdata); * \param desc The crypto sequence * \param len The crypto sequence length * \param is_dout If "true": completion is handled by the caller - * If "false": this function adds a dummy descriptor completion - * and waits upon completion signal. + * If "false": this function adds a dummy descriptor completion + * and waits upon completion signal. * * \return int Returns -EINPROGRESS if "is_dout=ture"; "0" if "is_dout=false" */ @@ -49,7 +49,7 @@ void complete_request(struct ssi_drvdata *drvdata); void request_mgr_fini(struct ssi_drvdata *drvdata); -#if defined (CONFIG_PM_RUNTIME) || defined (CONFIG_PM_SLEEP) +#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) int ssi_request_mgr_runtime_resume_queue(struct ssi_drvdata *drvdata); int ssi_request_mgr_runtime_suspend_queue(struct ssi_drvdata *drvdata); diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 69e1ae491098..db703005aafb 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -66,7 +66,7 @@ static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] = .stat_phase_name[STAT_PHASE_5] = "Sequence completion", .stat_phase_name[STAT_PHASE_6] = "HW cycles", }, - { .op_type_name = "Setkey", + { .op_type_name = "Setkey", .stat_phase_name[STAT_PHASE_0] = "Init and sanity checks", .stat_phase_name[STAT_PHASE_1] = "Copy key to ctx", .stat_phase_name[STAT_PHASE_2] = "Create sequence", @@ -114,8 +114,8 @@ static void init_db(struct stat_item item[MAX_STAT_OP_TYPES][MAX_STAT_PHASES]) unsigned int i, j; /* Clear db */ - for (i=0; isum += result; if (result < item->min) item->min = result; - if (result > item->max ) + if (result > item->max) item->max = result; } @@ -139,8 +139,8 @@ static void display_db(struct stat_item item[MAX_STAT_OP_TYPES][MAX_STAT_PHASES] unsigned int i, j; u64 avg; - for (i=STAT_OP_TYPE_ENCODE; i 0) { avg = (u64)item[i][j].sum; do_div(avg, item[i][j].count); @@ -174,18 +174,18 @@ static ssize_t ssi_sys_stats_cc_db_clear(struct kobject *kobj, static ssize_t ssi_sys_stat_host_db_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int i, j ; + int i, j; char line[512]; u32 min_cyc, max_cyc; u64 avg; - ssize_t buf_len, tmp_len=0; + ssize_t buf_len, tmp_len = 0; - buf_len = scnprintf(buf,PAGE_SIZE, + buf_len = scnprintf(buf, PAGE_SIZE, "phase\t\t\t\t\t\t\tmin[cy]\tavg[cy]\tmax[cy]\t#samples\n"); - if ( buf_len <0 )/* scnprintf shouldn't return negative value according to its implementation*/ + if (buf_len < 0)/* scnprintf shouldn't return negative value according to its implementation*/ return buf_len; - for (i=STAT_OP_TYPE_ENCODE; i 0) { avg = (u64)stat_host_db[i][j].sum; do_div(avg, stat_host_db[i][j].count); @@ -194,18 +194,18 @@ static ssize_t ssi_sys_stat_host_db_show(struct kobject *kobj, } else { avg = min_cyc = max_cyc = 0; } - tmp_len = scnprintf(line,512, + tmp_len = scnprintf(line, 512, "%s::%s\t\t\t\t\t%6u\t%6u\t%6u\t%7u\n", stat_name_db[i].op_type_name, stat_name_db[i].stat_phase_name[j], min_cyc, (unsigned int)avg, max_cyc, stat_host_db[i][j].count); - if ( tmp_len <0 )/* scnprintf shouldn't return negative value according to its implementation*/ + if (tmp_len < 0)/* scnprintf shouldn't return negative value according to its implementation*/ return buf_len; - if ( buf_len + tmp_len >= PAGE_SIZE) + if (buf_len + tmp_len >= PAGE_SIZE) return buf_len; buf_len += tmp_len; - strncat(buf, line,512); + strncat(buf, line, 512); } } return buf_len; @@ -218,13 +218,13 @@ static ssize_t ssi_sys_stat_cc_db_show(struct kobject *kobj, char line[256]; u32 min_cyc, max_cyc; u64 avg; - ssize_t buf_len,tmp_len=0; + ssize_t buf_len, tmp_len = 0; - buf_len = scnprintf(buf,PAGE_SIZE, + buf_len = scnprintf(buf, PAGE_SIZE, "phase\tmin[cy]\tavg[cy]\tmax[cy]\t#samples\n"); - if ( buf_len <0 )/* scnprintf shouldn't return negative value according to its implementation*/ + if (buf_len < 0)/* scnprintf shouldn't return negative value according to its implementation*/ return buf_len; - for (i=STAT_OP_TYPE_ENCODE; i 0) { avg = (u64)stat_cc_db[i][STAT_PHASE_6].sum; do_div(avg, stat_cc_db[i][STAT_PHASE_6].count); @@ -233,7 +233,7 @@ static ssize_t ssi_sys_stat_cc_db_show(struct kobject *kobj, } else { avg = min_cyc = max_cyc = 0; } - tmp_len = scnprintf(line,256, + tmp_len = scnprintf(line, 256, "%s\t%6u\t%6u\t%6u\t%7u\n", stat_name_db[i].op_type_name, min_cyc, @@ -241,13 +241,13 @@ static ssize_t ssi_sys_stat_cc_db_show(struct kobject *kobj, max_cyc, stat_cc_db[i][STAT_PHASE_6].count); - if ( tmp_len < 0 )/* scnprintf shouldn't return negative value according to its implementation*/ + if (tmp_len < 0)/* scnprintf shouldn't return negative value according to its implementation*/ return buf_len; - if ( buf_len + tmp_len >= PAGE_SIZE) + if (buf_len + tmp_len >= PAGE_SIZE) return buf_len; buf_len += tmp_len; - strncat(buf, line,256); + strncat(buf, line, 256); } return buf_len; } @@ -304,7 +304,7 @@ static ssize_t ssi_sys_regdump_show(struct kobject *kobj, static ssize_t ssi_sys_help_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - char* help_str[]={ + char* help_str[] = { "cat reg_dump ", "Print several of CC register values", #if defined CC_CYCLE_COUNT "cat stats_host ", "Print host statistics", @@ -313,11 +313,11 @@ static ssize_t ssi_sys_help_show(struct kobject *kobj, "echo > stats_cc ", "Clear CC statistics database", #endif }; - int i=0, offset = 0; + int i = 0, offset = 0; offset += scnprintf(buf + offset, PAGE_SIZE - offset, "Usage:\n"); - for ( i = 0; i < ARRAY_SIZE(help_str); i+=2) { - offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s\t\t%s\n", help_str[i], help_str[i+1]); + for (i = 0; i < ARRAY_SIZE(help_str); i += 2) { + offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s\t\t%s\n", help_str[i], help_str[i + 1]); } return offset; } -- cgit v1.2.3-55-g7522 From 7331916cff9874ec1659d2d69e321e00b26e68e3 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:14 +0300 Subject: staging: ccree: drop comparsion to true/false Fix cases in ccree where explicit comparsion to true/false was made. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 18 +++++++++--------- drivers/staging/ccree/ssi_buffer_mgr.c | 20 ++++++++++---------- drivers/staging/ccree/ssi_cipher.c | 2 +- drivers/staging/ccree/ssi_driver.c | 4 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 2e8dc3fa89ce..00375b6fa67a 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -236,7 +236,7 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c err = -EBADMSG; } } else { /*ENCRYPT*/ - if (unlikely(areq_ctx->is_icv_fragmented == true)) + if (unlikely(areq_ctx->is_icv_fragmented)) ssi_buffer_mgr_copy_scatterlist_portion( areq_ctx->mac_buf, areq_ctx->dstSgl, areq->cryptlen + areq_ctx->dstOffset, areq->cryptlen + areq_ctx->dstOffset + ctx->authsize, SSI_SG_FROM_BUF); @@ -790,7 +790,7 @@ ssi_aead_process_authenc_data_desc( ssi_sram_addr_t mlli_addr = areq_ctx->assoc.sram_addr; u32 mlli_nents = areq_ctx->assoc.mlli_nents; - if (likely(areq_ctx->is_single_pass == true)) { + if (likely(areq_ctx->is_single_pass)) { if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { mlli_addr = areq_ctx->dst.sram_addr; mlli_nents = areq_ctx->dst.mlli_nents; @@ -1173,7 +1173,7 @@ static inline void ssi_aead_load_mlli_to_sram( if (unlikely( (req_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI) || (req_ctx->data_buff_type == SSI_DMA_BUF_MLLI) || - (req_ctx->is_single_pass == false))) { + !req_ctx->is_single_pass)) { SSI_LOG_DEBUG("Copy-to-sram: mlli_dma=%08x, mlli_size=%u\n", (unsigned int)ctx->drvdata->mlli_sram_addr, req_ctx->mlli_params.mlli_len); @@ -1228,7 +1228,7 @@ static inline void ssi_aead_hmac_authenc( unsigned int data_flow_mode = ssi_aead_get_data_flow_mode( direct, ctx->flow_mode, req_ctx->is_single_pass); - if (req_ctx->is_single_pass == true) { + if (req_ctx->is_single_pass) { /** * Single-pass flow */ @@ -1282,7 +1282,7 @@ ssi_aead_xcbc_authenc( unsigned int data_flow_mode = ssi_aead_get_data_flow_mode( direct, ctx->flow_mode, req_ctx->is_single_pass); - if (req_ctx->is_single_pass == true) { + if (req_ctx->is_single_pass) { /** * Single-pass flow */ @@ -1341,7 +1341,7 @@ static int validate_data_size(struct ssi_aead_ctx *ctx, if (ctx->cipher_mode == DRV_CIPHER_CCM) break; if (ctx->cipher_mode == DRV_CIPHER_GCTR) { - if (areq_ctx->plaintext_authenticate_only == true) + if (areq_ctx->plaintext_authenticate_only) areq_ctx->is_single_pass = false; break; } @@ -1715,7 +1715,7 @@ static inline void ssi_aead_gcm_setup_gctr_desc( set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; - if ((req_ctx->cryptlen != 0) && (req_ctx->plaintext_authenticate_only == false)) { + if ((req_ctx->cryptlen != 0) && (!req_ctx->plaintext_authenticate_only)) { /* load AES/CTR initial CTR value inc by 2*/ hw_desc_init(&desc[idx]); set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); @@ -1815,7 +1815,7 @@ static inline int ssi_aead_gcm( //in RFC4543 no data to encrypt. just copy data from src to dest. - if (req_ctx->plaintext_authenticate_only == true) { + if (req_ctx->plaintext_authenticate_only) { ssi_aead_process_cipher_data_desc(req, BYPASS, desc, seq_size); ssi_aead_gcm_setup_ghash_desc(req, desc, seq_size); /* process(ghash) assoc data */ @@ -1913,7 +1913,7 @@ static int config_gcm_context(struct aead_request *req) memcpy(req_ctx->gcm_iv_inc1, req->iv, 16); - if (req_ctx->plaintext_authenticate_only == false) { + if (!req_ctx->plaintext_authenticate_only) { __be64 temp64; temp64 = cpu_to_be64(req->assoclen * 8); memcpy(&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 00d95c15071a..5c46145a2955 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -798,7 +798,7 @@ static inline int ssi_buffer_mgr_aead_chain_iv( SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=0x%llX\n", hw_iv_size, req->iv, (unsigned long long)areq_ctx->gen_ctx.iv_dma_addr); - if (do_chain == true && areq_ctx->plaintext_authenticate_only == true) { // TODO: what about CTR?? ask Ron + if (do_chain && areq_ctx->plaintext_authenticate_only) { // TODO: what about CTR?? ask Ron struct crypto_aead *tfm = crypto_aead_reqtfm(req); unsigned int iv_size_to_authenc = crypto_aead_ivsize(tfm); unsigned int iv_ofs = GCM_BLOCK_RFC4_IV_OFFSET; @@ -894,7 +894,7 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( else areq_ctx->assoc_buff_type = SSI_DMA_BUF_MLLI; - if (unlikely((do_chain == true) || + if (unlikely((do_chain) || (areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI))) { SSI_LOG_DEBUG("Chain assoc: buff_type=%s nents=%u\n", @@ -975,7 +975,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( goto prepare_data_mlli_exit; } - if (unlikely(areq_ctx->is_icv_fragmented == true)) { + if (unlikely(areq_ctx->is_icv_fragmented)) { /* Backup happens only when ICV is fragmented, ICV * verification is made by CPU compare in order to simplify * MAC verification upon request completion @@ -1033,7 +1033,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( goto prepare_data_mlli_exit; } - if (unlikely(areq_ctx->is_icv_fragmented == true)) { + if (unlikely(areq_ctx->is_icv_fragmented)) { /* Backup happens only when ICV is fragmented, ICV * verification is made by CPU compare in order to simplify * MAC verification upon request completion @@ -1076,7 +1076,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( goto prepare_data_mlli_exit; } - if (likely(areq_ctx->is_icv_fragmented == false)) { + if (likely(!areq_ctx->is_icv_fragmented)) { /* Contig. ICV */ areq_ctx->icv_dma_addr = sg_dma_address( &areq_ctx->dstSgl[areq_ctx->dst.nents - 1]) + @@ -1200,7 +1200,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( areq_ctx->dstOffset = offset; if ((src_mapped_nents > 1) || (dst_mapped_nents > 1) || - (do_chain == true)) { + do_chain) { areq_ctx->data_buff_type = SSI_DMA_BUF_MLLI; rc = ssi_buffer_mgr_prepare_aead_data_mlli(drvdata, req, sg_data, &src_last_bytes, &dst_last_bytes, is_last_table); @@ -1233,7 +1233,7 @@ static void ssi_buffer_mgr_update_aead_mlli_nents(struct ssi_drvdata *drvdata, areq_ctx->src.sram_addr = drvdata->mlli_sram_addr + curr_mlli_size; areq_ctx->dst.sram_addr = areq_ctx->src.sram_addr; - if (areq_ctx->is_single_pass == false) + if (!areq_ctx->is_single_pass) areq_ctx->assoc.mlli_nents += areq_ctx->src.mlli_nents; } else { @@ -1246,7 +1246,7 @@ static void ssi_buffer_mgr_update_aead_mlli_nents(struct ssi_drvdata *drvdata, areq_ctx->src.sram_addr + areq_ctx->src.mlli_nents * LLI_ENTRY_BYTE_SIZE; - if (areq_ctx->is_single_pass == false) + if (!areq_ctx->is_single_pass) areq_ctx->assoc.mlli_nents += areq_ctx->src.mlli_nents; } else { @@ -1257,7 +1257,7 @@ static void ssi_buffer_mgr_update_aead_mlli_nents(struct ssi_drvdata *drvdata, areq_ctx->dst.sram_addr + areq_ctx->dst.mlli_nents * LLI_ENTRY_BYTE_SIZE; - if (areq_ctx->is_single_pass == false) + if (!areq_ctx->is_single_pass) areq_ctx->assoc.mlli_nents += areq_ctx->dst.mlli_nents; } @@ -1399,7 +1399,7 @@ int ssi_buffer_mgr_map_aead_request( goto aead_map_failure; } - if (likely(areq_ctx->is_single_pass == true)) { + if (likely(areq_ctx->is_single_pass)) { /* * Create MLLI table for: * (1) Assoc. data diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 519e04ef6e70..1dab3e6cabeb 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -839,7 +839,7 @@ static int ssi_blkcipher_process( desc, &seq_len); /* do we need to generate IV? */ - if (req_ctx->is_giv == true) { + if (req_ctx->is_giv) { ssi_req.ivgen_dma_addr[0] = req_ctx->gen_ctx.iv_dma_addr; ssi_req.ivgen_dma_addr_len = 1; /* set the IV size (8/16 B long)*/ diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 7c94354c8dd3..05930e8df7d8 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -205,13 +205,13 @@ int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe) cache_params = (drvdata->coherent ? CC_COHERENT_CACHE_PARAMS : 0x0); val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS)); - if (is_probe == true) { + if (is_probe) { SSI_LOG_INFO("Cache params previous: 0x%08X\n", val); } CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS), cache_params); val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS)); - if (is_probe == true) { + if (is_probe) { SSI_LOG_INFO("Cache params current: 0x%08X (expect: 0x%08X)\n", val, cache_params); } -- cgit v1.2.3-55-g7522 From 8683e6272de45e9e2df9da811e9eac7c63644072 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:15 +0300 Subject: staging: ccree: fix else placement Fix cases where the else clause was not located correctly after the if brace. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_buffer_mgr.c | 3 +-- drivers/staging/ccree/ssi_pm.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 5c46145a2955..3c74ae3228e1 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -852,8 +852,7 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( sg_index = current_sg->length; if (sg_index > size_of_assoc) { //the first entry in the scatter list contains all the associated data mapped_nents++; - } - else{ + } else { while (sg_index <= size_of_assoc) { current_sg = sg_next(current_sg); //if have reached the end of the sgl, then this is unexpected diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c index c8c58754a792..ae1f7f0bb715 100644 --- a/drivers/staging/ccree/ssi_pm.c +++ b/drivers/staging/ccree/ssi_pm.c @@ -110,8 +110,7 @@ int ssi_power_mgr_runtime_put_suspend(struct device *dev) (struct ssi_drvdata *)dev_get_drvdata(dev))) { pm_runtime_mark_last_busy(dev); rc = pm_runtime_put_autosuspend(dev); - } - else { + } else { /* Something wrong happens*/ BUG(); } -- cgit v1.2.3-55-g7522 From b4562b61cf084bbd7f8d10b19e5428d7a0e50034 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:16 +0300 Subject: staging: ccree: remove redundant blank lines Remove redundant blank lines in brace blocks Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 2 -- drivers/staging/ccree/ssi_buffer_mgr.c | 8 -------- drivers/staging/ccree/ssi_cipher.c | 5 ----- drivers/staging/ccree/ssi_driver.c | 1 - drivers/staging/ccree/ssi_hash.c | 2 -- drivers/staging/ccree/ssi_pm.c | 1 - drivers/staging/ccree/ssi_request_mgr.c | 1 - 7 files changed, 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 00375b6fa67a..5782c9d256a9 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -2042,7 +2042,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction /* do we need to generate IV? */ if (areq_ctx->backup_giv != NULL) { - /* set the DMA mapped IV address*/ if (ctx->cipher_mode == DRV_CIPHER_CTR) { ssi_req.ivgen_dma_addr[0] = areq_ctx->gen_ctx.iv_dma_addr + CTR_RFC3686_NONCE_SIZE; @@ -2181,7 +2180,6 @@ static int ssi_aead_decrypt(struct aead_request *req) req->iv = areq_ctx->backup_iv; return rc; - } #if SSI_CC_HAS_AES_CCM diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 3c74ae3228e1..63f057e1b50d 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -608,7 +608,6 @@ int ssi_buffer_mgr_map_blkcipher_request( rc = ssi_buffer_mgr_generate_mlli(dev, &sg_data, mlli_params); if (unlikely(rc != 0)) goto ablkcipher_exit; - } SSI_LOG_DEBUG("areq_ctx->dma_buf_type = %s\n", @@ -877,7 +876,6 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( if (areq_ctx->ccm_hdr_size != ccm_header_size_null) { if (unlikely((mapped_nents + 1) > LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES)) { - SSI_LOG_ERR("CCM case.Too many fragments. " "Current %d max %d\n", (areq_ctx->assoc.nents + 1), @@ -895,7 +893,6 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( if (unlikely((do_chain) || (areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI))) { - SSI_LOG_DEBUG("Chain assoc: buff_type=%s nents=%u\n", GET_DMA_BUFFER_TYPE(areq_ctx->assoc_buff_type), areq_ctx->assoc.nents); @@ -1178,7 +1175,6 @@ static inline int ssi_buffer_mgr_aead_chain_data( //check where the data starts while (sg_index <= size_to_skip) { - offset -= areq_ctx->dstSgl->length; areq_ctx->dstSgl = sg_next(areq_ctx->dstSgl); //if have reached the end of the sgl, then this is unexpected @@ -1450,7 +1446,6 @@ int ssi_buffer_mgr_map_aead_request( if (unlikely( (areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI) || (areq_ctx->data_buff_type == SSI_DMA_BUF_MLLI))) { - mlli_params->curr_pool = buff_mgr->mlli_buffs_pool; rc = ssi_buffer_mgr_generate_mlli(dev, &sg_data, mlli_params); if (unlikely(rc != 0)) { @@ -1528,7 +1523,6 @@ int ssi_buffer_mgr_map_hash_request_final( } else { areq_ctx->data_dma_buf_type = SSI_DMA_BUF_MLLI; } - } /*build mlli */ @@ -1675,7 +1669,6 @@ int ssi_buffer_mgr_map_hash_request_update( mlli_params) != 0)) { goto fail_unmap_din; } - } areq_ctx->buff_index = (areq_ctx->buff_index ^ swap_index); @@ -1771,7 +1764,6 @@ int ssi_buffer_mgr_fini(struct ssi_drvdata *drvdata) dma_pool_destroy(buff_mgr_handle->mlli_buffs_pool); kfree(drvdata->buff_mgr_handle); drvdata->buff_mgr_handle = NULL; - } return 0; } diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 1dab3e6cabeb..722b30754175 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -104,7 +104,6 @@ static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { #endif default: break; - } return -EINVAL; } @@ -158,7 +157,6 @@ static int validate_data_size(struct ssi_ablkcipher_ctx *ctx_p, unsigned int siz #endif /*SSI_CC_HAS_MULTI2*/ default: break; - } return -EINVAL; } @@ -498,7 +496,6 @@ ssi_blkcipher_create_setup_desc( set_cipher_mode(&desc[*seq_size], cipher_mode); set_cipher_config0(&desc[*seq_size], direction); if (flow_mode == S_DIN_to_AES) { - if (ssi_is_hw_key(tfm)) { set_hw_crypto_key(&desc[*seq_size], ctx_p->hw.key1_slot); @@ -616,7 +613,6 @@ static inline void ssi_blkcipher_create_multi2_setup_desc( set_cipher_mode(&desc[*seq_size], ctx_p->cipher_mode); set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE1); (*seq_size)++; - } #endif /*SSI_CC_HAS_MULTI2*/ @@ -782,7 +778,6 @@ static int ssi_blkcipher_process( } /*For CTS in case of data size aligned to 16 use CBC mode*/ if (((nbytes % AES_BLOCK_SIZE) == 0) && (ctx_p->cipher_mode == DRV_CIPHER_CBC_CTS)) { - ctx_p->cipher_mode = DRV_CIPHER_CBC; cts_restore_flag = 1; } diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 05930e8df7d8..31689305e1dc 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -444,7 +444,6 @@ void fini_cc_regs(struct ssi_drvdata *drvdata) /* Mask all interrupts */ WRITE_REGISTER(drvdata->cc_base + CC_REG_OFFSET(HOST_RGF, HOST_IMR), 0xFFFFFFFF); - } static void cleanup_cc_resources(struct platform_device *plat_dev) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 64e969e6ca4f..9d5e54d56080 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1323,7 +1323,6 @@ static void ssi_hash_free_ctx(struct ssi_hash_ctx *ctx) } ctx->key_params.keylen = 0; - } @@ -2365,7 +2364,6 @@ int ssi_hash_free(struct ssi_drvdata *drvdata) struct ssi_hash_handle *hash_handle = drvdata->hash_handle; if (hash_handle != NULL) { - list_for_each_entry_safe(t_hash_alg, hash_n, &hash_handle->hash_list, entry) { crypto_unregister_ahash(&t_hash_alg->ahash_alg); list_del(&t_hash_alg->entry); diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c index ae1f7f0bb715..d3ddfb1f5303 100644 --- a/drivers/staging/ccree/ssi_pm.c +++ b/drivers/staging/ccree/ssi_pm.c @@ -115,7 +115,6 @@ int ssi_power_mgr_runtime_put_suspend(struct device *dev) BUG(); } return rc; - } #endif diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 31765788017b..8f7d2ecab5fd 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -549,7 +549,6 @@ static void comp_handler(unsigned long devarg) request_mgr_handle->axi_completed += cc_axi_comp_count(cc_base); } - } /* after verifing that there is nothing to do, Unmask AXI completion interrupt */ CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), -- cgit v1.2.3-55-g7522 From a8f6cbaad29b3e7570570f819d3577c4f4ab0f59 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:17 +0300 Subject: staging: ccree: no need for braces for single statements Fix several cases of needless braces around single statement blocks. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 38 +++++++----------- drivers/staging/ccree/ssi_buffer_mgr.c | 70 ++++++++++++++------------------- drivers/staging/ccree/ssi_cipher.c | 41 +++++++------------ drivers/staging/ccree/ssi_driver.c | 9 +++-- drivers/staging/ccree/ssi_fips.c | 6 +-- drivers/staging/ccree/ssi_fips_ext.c | 6 +-- drivers/staging/ccree/ssi_fips_local.c | 39 +++++++++--------- drivers/staging/ccree/ssi_hash.c | 35 ++++++----------- drivers/staging/ccree/ssi_ivgen.c | 4 +- drivers/staging/ccree/ssi_request_mgr.c | 20 ++++------ drivers/staging/ccree/ssi_sysfs.c | 4 +- 11 files changed, 110 insertions(+), 162 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 5782c9d256a9..fdb257dc0712 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -243,11 +243,10 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c /* If an IV was generated, copy it back to the user provided buffer. */ if (areq_ctx->backup_giv != NULL) { - if (ctx->cipher_mode == DRV_CIPHER_CTR) { + if (ctx->cipher_mode == DRV_CIPHER_CTR) memcpy(areq_ctx->backup_giv, areq_ctx->ctr_iv + CTR_RFC3686_NONCE_SIZE, CTR_RFC3686_IV_SIZE); - } else if (ctx->cipher_mode == DRV_CIPHER_CCM) { + else if (ctx->cipher_mode == DRV_CIPHER_CCM) memcpy(areq_ctx->backup_giv, areq_ctx->ctr_iv + CCM_BLOCK_IV_OFFSET, CCM_BLOCK_IV_SIZE); - } } } @@ -521,9 +520,8 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl if (unlikely(rc != 0)) SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc); - if (likely(key_dma_addr != 0)) { + if (likely(key_dma_addr != 0)) dma_unmap_single(dev, key_dma_addr, keylen, DMA_TO_DEVICE); - } return rc; } @@ -928,11 +926,10 @@ static inline void ssi_aead_setup_cipher_desc( set_flow_mode(&desc[idx], ctx->flow_mode); set_din_type(&desc[idx], DMA_DLLI, req_ctx->gen_ctx.iv_dma_addr, hw_iv_size, NS_BIT); - if (ctx->cipher_mode == DRV_CIPHER_CTR) { + if (ctx->cipher_mode == DRV_CIPHER_CTR) set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); - } else { + else set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); - } set_cipher_mode(&desc[idx], ctx->cipher_mode); idx++; @@ -1375,9 +1372,9 @@ data_size_err: static unsigned int format_ccm_a0(u8 *pA0Buff, u32 headerSize) { unsigned int len = 0; - if (headerSize == 0) { + if (headerSize == 0) return 0; - } + if (headerSize < ((1UL << 16) - (1UL << 8))) { len = 2; @@ -1498,9 +1495,8 @@ static inline int ssi_aead_ccm( } /* process the cipher */ - if (req_ctx->cryptlen != 0) { + if (req_ctx->cryptlen != 0) ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, &idx); - } /* Read temporal MAC */ hw_desc_init(&desc[idx]); @@ -1579,9 +1575,8 @@ static int config_ccm_adata(struct aead_request *req) *b0 |= 64; /* Enable bit 6 if Adata exists. */ rc = set_msg_len(b0 + 16 - l, cryptlen, l); /* Write L'. */ - if (rc != 0) { + if (rc != 0) return rc; - } /* END of "taken from crypto/ccm.c" */ /* l(a) - size of associated data. */ @@ -1861,9 +1856,8 @@ static inline void ssi_aead_dump_gcm( SSI_LOG_DEBUG("cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, cryptlen %d\n", \ ctx->cipher_mode, ctx->authsize, ctx->enc_keylen, req->assoclen, req_ctx->cryptlen); - if (ctx->enckey != NULL) { + if (ctx->enckey != NULL) dump_byte_array("mac key", ctx->enckey, 16); - } dump_byte_array("req->iv", req->iv, AES_BLOCK_SIZE); @@ -1877,13 +1871,11 @@ static inline void ssi_aead_dump_gcm( dump_byte_array("gcm_len_block", req_ctx->gcm_len_block.lenA, AES_BLOCK_SIZE); - if (req->src != NULL && req->cryptlen) { + if (req->src != NULL && req->cryptlen) dump_byte_array("req->src", sg_virt(req->src), req->cryptlen + req->assoclen); - } - if (req->dst != NULL) { + if (req->dst != NULL) dump_byte_array("req->dst", sg_virt(req->dst), req->cryptlen + ctx->authsize + req->assoclen); - } } #endif @@ -2083,14 +2075,12 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction #if (SSI_CC_HAS_AES_CCM || SSI_CC_HAS_AES_GCM) case DRV_HASH_NULL: #if SSI_CC_HAS_AES_CCM - if (ctx->cipher_mode == DRV_CIPHER_CCM) { + if (ctx->cipher_mode == DRV_CIPHER_CCM) ssi_aead_ccm(req, desc, &seq_len); - } #endif /*SSI_CC_HAS_AES_CCM*/ #if SSI_CC_HAS_AES_GCM - if (ctx->cipher_mode == DRV_CIPHER_GCTR) { + if (ctx->cipher_mode == DRV_CIPHER_GCTR) ssi_aead_gcm(req, desc, &seq_len); - } #endif /*SSI_CC_HAS_AES_GCM*/ break; #endif diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 63f057e1b50d..9e8a1343e9b1 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -94,9 +94,8 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( sg_list = sg_next(sg_list); } else { sg_list = (struct scatterlist *)sg_page(sg_list); - if (is_chained != NULL) { + if (is_chained != NULL) *is_chained = true; - } } } SSI_LOG_DEBUG("nents %d last bytes %d\n", nents, *lbytes); @@ -155,9 +154,8 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( /* Verify there is no memory overflow*/ new_nents = (*curr_nents + buff_size / CC_MAX_MLLI_ENTRY_SIZE + 1); - if (new_nents > MAX_NUM_OF_TOTAL_MLLI_ENTRIES) { + if (new_nents > MAX_NUM_OF_TOTAL_MLLI_ENTRIES) return -ENOMEM; - } /*handle buffer longer than 64 kbytes */ while (buff_size > CC_MAX_MLLI_ENTRY_SIZE) { @@ -201,9 +199,9 @@ static inline int ssi_buffer_mgr_render_scatterlist_to_mlli( rc = ssi_buffer_mgr_render_buff_to_mlli( sg_dma_address(curr_sgl) + sglOffset, entry_data_len, curr_nents, &mlli_entry_p); - if (rc != 0) { + if (rc != 0) return rc; - } + sglOffset = 0; } *mlli_entry_pp = mlli_entry_p; @@ -244,9 +242,8 @@ static int ssi_buffer_mgr_generate_mlli( sg_data->entry[i].buffer_dma, sg_data->total_data_len[i], &total_nents, &mlli_p); - if (rc != 0) { + if (rc != 0) return rc; - } /* set last bit in the current table */ if (sg_data->mlli_nents[i] != NULL) { @@ -326,9 +323,8 @@ ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, u32 nents, u32 i, j; struct scatterlist *l_sg = sg; for (i = 0; i < nents; i++) { - if (l_sg == NULL) { + if (l_sg == NULL) break; - } if (unlikely(dma_map_sg(dev, l_sg, 1, direction) != 1)) { SSI_LOG_ERR("dma_map_page() sg buffer failed\n"); goto err; @@ -340,9 +336,8 @@ ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, u32 nents, err: /* Restore mapped parts */ for (j = 0; j < i; j++) { - if (sg == NULL) { + if (sg == NULL) break; - } dma_unmap_sg(dev, sg, 1, direction); sg = sg_next(sg); } @@ -687,9 +682,8 @@ void ssi_buffer_mgr_unmap_aead_request( SSI_LOG_DEBUG("Unmapping src sgl: req->src=%pK areq_ctx->src.nents=%u areq_ctx->assoc.nents=%u assoclen:%u cryptlen=%u\n", sg_virt(req->src), areq_ctx->src.nents, areq_ctx->assoc.nents, req->assoclen, req->cryptlen); size_to_unmap = req->assoclen + req->cryptlen; - if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT) { + if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT) size_to_unmap += areq_ctx->req_authsize; - } if (areq_ctx->is_gcm4543) size_to_unmap += crypto_aead_ivsize(tfm); @@ -705,9 +699,9 @@ void ssi_buffer_mgr_unmap_aead_request( likely(req->src == req->dst)) { u32 size_to_skip = req->assoclen; - if (areq_ctx->is_gcm4543) { + if (areq_ctx->is_gcm4543) size_to_skip += crypto_aead_ivsize(tfm); - } + /* copy mac to a temporary location to deal with possible * data memory overriding that caused by cache coherence problem. */ @@ -736,15 +730,13 @@ static inline int ssi_buffer_mgr_get_aead_icv_nents( } for (i = 0 ; i < (sgl_nents - MAX_ICV_NENTS_SUPPORTED) ; i++) { - if (sgl == NULL) { + if (sgl == NULL) break; - } sgl = sg_next(sgl); } - if (sgl != NULL) { + if (sgl != NULL) icv_max_size = sgl->length; - } if (last_entry_data_size > authsize) { nents = 0; /* ICV attached to data in last entry (not fragmented!) */ @@ -827,9 +819,8 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( unsigned int sg_index = 0; u32 size_of_assoc = req->assoclen; - if (areq_ctx->is_gcm4543) { + if (areq_ctx->is_gcm4543) size_of_assoc += crypto_aead_ivsize(tfm); - } if (sg_data == NULL) { rc = -EINVAL; @@ -1035,9 +1026,9 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( * MAC verification upon request completion */ u32 size_to_skip = req->assoclen; - if (areq_ctx->is_gcm4543) { + if (areq_ctx->is_gcm4543) size_to_skip += crypto_aead_ivsize(tfm); - } + ssi_buffer_mgr_copy_scatterlist_portion( areq_ctx->backup_mac, req->src, size_to_skip + req->cryptlen - areq_ctx->req_authsize, @@ -1110,9 +1101,10 @@ static inline int ssi_buffer_mgr_aead_chain_data( bool chained = false; bool is_gcm4543 = areq_ctx->is_gcm4543; u32 size_to_skip = req->assoclen; - if (is_gcm4543) { + + if (is_gcm4543) size_to_skip += crypto_aead_ivsize(tfm); - } + offset = size_to_skip; if (sg_data == NULL) { @@ -1122,9 +1114,8 @@ static inline int ssi_buffer_mgr_aead_chain_data( areq_ctx->srcSgl = req->src; areq_ctx->dstSgl = req->dst; - if (is_gcm4543) { + if (is_gcm4543) size_for_map += crypto_aead_ivsize(tfm); - } size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? authsize : 0; src_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->src, size_for_map, &src_last_bytes, &chained); @@ -1155,9 +1146,8 @@ static inline int ssi_buffer_mgr_aead_chain_data( if (req->src != req->dst) { size_for_map = req->assoclen + req->cryptlen; size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? authsize : 0; - if (is_gcm4543) { + if (is_gcm4543) size_for_map += crypto_aead_ivsize(tfm); - } rc = ssi_buffer_mgr_map_scatterlist(dev, req->dst, size_for_map, DMA_BIDIRECTIONAL, &(areq_ctx->dst.nents), @@ -1285,9 +1275,10 @@ int ssi_buffer_mgr_map_aead_request( likely(req->src == req->dst)) { u32 size_to_skip = req->assoclen; - if (is_gcm4543) { + + if (is_gcm4543) size_to_skip += crypto_aead_ivsize(tfm); - } + /* copy mac to a temporary location to deal with possible * data memory overriding that caused by cache coherence problem. */ @@ -1381,9 +1372,9 @@ int ssi_buffer_mgr_map_aead_request( #endif /*SSI_CC_HAS_AES_GCM*/ size_to_map = req->cryptlen + req->assoclen; - if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT) { + if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT) size_to_map += authsize; - } + if (is_gcm4543) size_to_map += crypto_aead_ivsize(tfm); rc = ssi_buffer_mgr_map_scatterlist(dev, req->src, @@ -1448,9 +1439,8 @@ int ssi_buffer_mgr_map_aead_request( (areq_ctx->data_buff_type == SSI_DMA_BUF_MLLI))) { mlli_params->curr_pool = buff_mgr->mlli_buffs_pool; rc = ssi_buffer_mgr_generate_mlli(dev, &sg_data, mlli_params); - if (unlikely(rc != 0)) { + if (unlikely(rc != 0)) goto aead_map_failure; - } ssi_buffer_mgr_update_aead_mlli_nents(drvdata, req); SSI_LOG_DEBUG("assoc params mn %d\n", areq_ctx->assoc.mlli_nents); @@ -1549,9 +1539,9 @@ fail_unmap_din: dma_unmap_sg(dev, src, areq_ctx->in_nents, DMA_TO_DEVICE); unmap_curr_buff: - if (*curr_buff_cnt != 0) { + if (*curr_buff_cnt != 0) dma_unmap_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE); - } + return -ENOMEM; } @@ -1678,9 +1668,9 @@ fail_unmap_din: dma_unmap_sg(dev, src, areq_ctx->in_nents, DMA_TO_DEVICE); unmap_curr_buff: - if (*curr_buff_cnt != 0) { + if (*curr_buff_cnt != 0) dma_unmap_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE); - } + return -ENOMEM; } diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 722b30754175..c233b7c722e1 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -165,13 +165,11 @@ static unsigned int get_max_keysize(struct crypto_tfm *tfm) { struct ssi_crypto_alg *ssi_alg = container_of(tfm->__crt_alg, struct ssi_crypto_alg, crypto_alg); - if ((ssi_alg->crypto_alg.cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_ABLKCIPHER) { + if ((ssi_alg->crypto_alg.cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_ABLKCIPHER) return ssi_alg->crypto_alg.cra_ablkcipher.max_keysize; - } - if ((ssi_alg->crypto_alg.cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_BLKCIPHER) { + if ((ssi_alg->crypto_alg.cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_BLKCIPHER) return ssi_alg->crypto_alg.cra_blkcipher.max_keysize; - } return 0; } @@ -289,9 +287,8 @@ static int ssi_fips_verify_xts_keys(const u8 *key, unsigned int keylen) /* Weak key is define as key that its first half (128/256 lsb) equals its second half (128/256 msb) */ int singleKeySize = keylen >> 1; - if (unlikely(memcmp(key, &key[singleKeySize], singleKeySize) == 0)) { + if (unlikely(memcmp(key, &key[singleKeySize], singleKeySize) == 0)) return -ENOEXEC; - } #endif /* CCREE_FIPS_SUPPORT */ return 0; @@ -333,9 +330,8 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, #if SSI_CC_HAS_MULTI2 /*last byte of key buffer is round number and should not be a part of key size*/ - if (ctx_p->flow_mode == S_DIN_to_MULTI2) { + if (ctx_p->flow_mode == S_DIN_to_MULTI2) keylen -= 1; - } #endif /*SSI_CC_HAS_MULTI2*/ if (unlikely(validate_keys_sizes(ctx_p, keylen) != 0)) { @@ -658,9 +654,9 @@ ssi_blkcipher_create_data_desc( nbytes, NS_BIT); set_dout_dlli(&desc[*seq_size], sg_dma_address(dst), nbytes, NS_BIT, (!areq ? 0 : 1)); - if (areq != NULL) { + if (areq != NULL) set_queue_last_ind(&desc[*seq_size]); - } + set_flow_mode(&desc[*seq_size], flow_mode); (*seq_size)++; } else { @@ -707,9 +703,9 @@ ssi_blkcipher_create_data_desc( req_ctx->out_mlli_nents, NS_BIT, (!areq ? 0 : 1)); } - if (areq != NULL) { + if (areq != NULL) set_queue_last_ind(&desc[*seq_size]); - } + set_flow_mode(&desc[*seq_size], flow_mode); (*seq_size)++; } @@ -809,22 +805,13 @@ static int ssi_blkcipher_process( /* Setup processing */ #if SSI_CC_HAS_MULTI2 - if (ctx_p->flow_mode == S_DIN_to_MULTI2) { - ssi_blkcipher_create_multi2_setup_desc(tfm, - req_ctx, - ivsize, - desc, - &seq_len); - } else + if (ctx_p->flow_mode == S_DIN_to_MULTI2) + ssi_blkcipher_create_multi2_setup_desc(tfm, req_ctx, ivsize, + desc, &seq_len); + else #endif /*SSI_CC_HAS_MULTI2*/ - { - ssi_blkcipher_create_setup_desc(tfm, - req_ctx, - ivsize, - nbytes, - desc, - &seq_len); - } + ssi_blkcipher_create_setup_desc(tfm, req_ctx, ivsize, nbytes, + desc, &seq_len); /* Data processing */ ssi_blkcipher_create_data_desc(tfm, req_ctx, diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 31689305e1dc..330d24d38d83 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -205,16 +205,17 @@ int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe) cache_params = (drvdata->coherent ? CC_COHERENT_CACHE_PARAMS : 0x0); val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS)); - if (is_probe) { + + if (is_probe) SSI_LOG_INFO("Cache params previous: 0x%08X\n", val); - } + CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS), cache_params); val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS)); - if (is_probe) { + + if (is_probe) SSI_LOG_INFO("Cache params current: 0x%08X (expect: 0x%08X)\n", val, cache_params); - } return 0; } diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index 60a2452f7b0b..2e01a0a61011 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -34,9 +34,8 @@ int ssi_fips_get_state(ssi_fips_state_t *p_state) { int rc = 0; - if (p_state == NULL) { + if (p_state == NULL) return -EINVAL; - } rc = ssi_fips_ext_get_state(p_state); @@ -53,9 +52,8 @@ int ssi_fips_get_error(ssi_fips_error_t *p_err) { int rc = 0; - if (p_err == NULL) { + if (p_err == NULL) return -EINVAL; - } rc = ssi_fips_ext_get_error(p_err); diff --git a/drivers/staging/ccree/ssi_fips_ext.c b/drivers/staging/ccree/ssi_fips_ext.c index aa90ddd14b99..8b14061f9e75 100644 --- a/drivers/staging/ccree/ssi_fips_ext.c +++ b/drivers/staging/ccree/ssi_fips_ext.c @@ -41,9 +41,8 @@ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) { int rc = 0; - if (p_state == NULL) { + if (p_state == NULL) return -EINVAL; - } *p_state = fips_state; @@ -60,9 +59,8 @@ int ssi_fips_ext_get_error(ssi_fips_error_t *p_err) { int rc = 0; - if (p_err == NULL) { + if (p_err == NULL) return -EINVAL; - } *p_err = fips_error; diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index 33a07e47b698..84d458a10c4e 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -72,9 +72,9 @@ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) void __iomem *cc_base = drvdata->cc_base; regVal = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, GPR_HOST)); - if (regVal == (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)) { + if (regVal == (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)) return CC_REE_FIPS_ERROR_OK; - } + return CC_REE_FIPS_ERROR_FROM_TEE; } @@ -87,11 +87,10 @@ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) static void ssi_fips_update_tee_upon_ree_status(struct ssi_drvdata *drvdata, ssi_fips_error_t err) { void __iomem *cc_base = drvdata->cc_base; - if (err == CC_REE_FIPS_ERROR_OK) { + if (err == CC_REE_FIPS_ERROR_OK) CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), (CC_FIPS_SYNC_REE_STATUS | CC_FIPS_SYNC_MODULE_OK)); - } else { + else CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), (CC_FIPS_SYNC_REE_STATUS | CC_FIPS_SYNC_MODULE_ERROR)); - } } @@ -152,9 +151,8 @@ static void fips_dsr(unsigned long devarg) if (irq & SSI_GPR0_IRQ_MASK) { teeFipsError = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, GPR_HOST)); - if (teeFipsError != (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)) { + if (teeFipsError != (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)) ssi_fips_set_error(drvdata, CC_REE_FIPS_ERROR_FROM_TEE); - } } /* after verifing that there is nothing to do, Unmask AXI completion interrupt */ @@ -177,9 +175,9 @@ ssi_fips_error_t cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) // the dma_handle is the returned phy address - use it in the HW descriptor FIPS_DBG("dma_alloc_coherent \n"); cpu_addr_buffer = dma_alloc_coherent(dev, alloc_buff_size, &dma_handle, GFP_KERNEL); - if (cpu_addr_buffer == NULL) { + if (cpu_addr_buffer == NULL) return CC_REE_FIPS_ERROR_GENERAL; - } + FIPS_DBG("allocated coherent buffer - addr 0x%08X , size = %d \n", (size_t)cpu_addr_buffer, alloc_buff_size); #if FIPS_POWER_UP_TEST_CIPHER @@ -269,30 +267,29 @@ int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err) FIPS_LOG("ssi_fips_set_error - fips_error = %d \n", err); // setting no error is not allowed - if (err == CC_REE_FIPS_ERROR_OK) { + if (err == CC_REE_FIPS_ERROR_OK) return -ENOEXEC; - } + // If error exists, do not set new error - if (ssi_fips_get_error(¤t_err) != 0) { + if (ssi_fips_get_error(¤t_err) != 0) return -ENOEXEC; - } - if (current_err != CC_REE_FIPS_ERROR_OK) { + + if (current_err != CC_REE_FIPS_ERROR_OK) return -ENOEXEC; - } + // set REE internal error and state rc = ssi_fips_ext_set_error(err); - if (rc != 0) { + if (rc != 0) return -ENOEXEC; - } + rc = ssi_fips_ext_set_state(CC_FIPS_STATE_ERROR); - if (rc != 0) { + if (rc != 0) return -ENOEXEC; - } // push error towards TEE libraray, if it's not TEE error - if (err != CC_REE_FIPS_ERROR_FROM_TEE) { + if (err != CC_REE_FIPS_ERROR_FROM_TEE) ssi_fips_update_tee_upon_ree_status(p_drvdata, err); - } + return rc; } diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 9d5e54d56080..265df94989da 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -215,11 +215,10 @@ static int ssi_hash_map_request(struct device *dev, } else { /*sha*/ memcpy(state->digest_buff, ctx->digest_buff, ctx->inter_digestsize); #if (DX_DEV_SHA_MAX > 256) - if (unlikely((ctx->hash_mode == DRV_HASH_SHA512) || (ctx->hash_mode == DRV_HASH_SHA384))) { + if (unlikely((ctx->hash_mode == DRV_HASH_SHA512) || (ctx->hash_mode == DRV_HASH_SHA384))) memcpy(state->digest_bytes_len, digest_len_sha512_init, HASH_LEN_SIZE); - } else { + else memcpy(state->digest_bytes_len, digest_len_init, HASH_LEN_SIZE); - } #else memcpy(state->digest_bytes_len, digest_len_init, HASH_LEN_SIZE); #endif @@ -480,11 +479,10 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, NS_BIT); } else { set_din_const(&desc[idx], 0, HASH_LEN_SIZE); - if (likely(nbytes != 0)) { + if (likely(nbytes != 0)) set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); - } else { + else set_cipher_do(&desc[idx], DO_PAD); - } } set_flow_mode(&desc[idx], S_DIN_to_HASH); set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); @@ -553,9 +551,8 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); /* TODO */ set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, (async_req ? 1 : 0)); - if (async_req) { + if (async_req) set_queue_last_ind(&desc[idx]); - } set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); @@ -656,9 +653,8 @@ static int ssi_hash_update(struct ahash_req_ctx *state, set_cipher_mode(&desc[idx], ctx->hw_mode); set_dout_dlli(&desc[idx], state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, NS_BIT, (async_req ? 1 : 0)); - if (async_req) { + if (async_req) set_queue_last_ind(&desc[idx]); - } set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_setup_mode(&desc[idx], SETUP_WRITE_STATE1); idx++; @@ -786,9 +782,8 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); /* TODO */ set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, (async_req ? 1 : 0)); - if (async_req) { + if (async_req) set_queue_last_ind(&desc[idx]); - } set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); @@ -933,9 +928,8 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); hw_desc_init(&desc[idx]); set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, NS_BIT, (async_req ? 1 : 0)); - if (async_req) { + if (async_req) set_queue_last_ind(&desc[idx]); - } set_flow_mode(&desc[idx], S_HASH_to_DOUT); set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); @@ -1423,11 +1417,10 @@ static int ssi_mac_update(struct ahash_request *req) return -ENOMEM; } - if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { + if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) ssi_hash_create_xcbc_setup(req, desc, &idx); - } else { + else ssi_hash_create_cmac_setup(req, desc, &idx); - } ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, true, &idx); @@ -1525,11 +1518,10 @@ static int ssi_mac_final(struct ahash_request *req) idx++; } - if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { + if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) ssi_hash_create_xcbc_setup(req, desc, &idx); - } else { + else ssi_hash_create_cmac_setup(req, desc, &idx); - } if (state->xcbc_count == 0) { hw_desc_init(&desc[idx]); @@ -2506,9 +2498,8 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, set_flow_mode(&desc[idx], flow_mode); idx++; } - if (is_not_last_data) { + if (is_not_last_data) set_din_not_last_indication(&desc[(idx - 1)]); - } /* return updated desc sequence size */ *seq_size = idx; } diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index 88f208017323..d81bf683d877 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -143,9 +143,9 @@ int ssi_ivgen_init_sram_pool(struct ssi_drvdata *drvdata) /* Generate initial pool */ rc = ssi_ivgen_generate_pool(ivgen_ctx, iv_seq, &iv_seq_len); - if (unlikely(rc != 0)) { + if (unlikely(rc != 0)) return rc; - } + /* Fire-and-forget */ return send_request_init(drvdata, iv_seq, iv_seq_len); } diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 8f7d2ecab5fd..2a39c128e07c 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -215,9 +215,9 @@ static inline int request_mgr_queues_status_check( return -EBUSY; } - if ((likely(req_mgr_h->q_free_slots >= total_seq_len))) { + if ((likely(req_mgr_h->q_free_slots >= total_seq_len))) return 0; - } + /* Wait for space in HW queue. Poll constant num of iterations. */ for (poll_queue = 0; poll_queue < SSI_MAX_POLL_ITER ; poll_queue++) { req_mgr_h->q_free_slots = @@ -349,9 +349,8 @@ int send_request( } used_sw_slots = ((req_mgr_h->req_queue_head - req_mgr_h->req_queue_tail) & (MAX_REQUEST_QUEUE_SIZE - 1)); - if (unlikely(used_sw_slots > req_mgr_h->max_used_sw_slots)) { + if (unlikely(used_sw_slots > req_mgr_h->max_used_sw_slots)) req_mgr_h->max_used_sw_slots = used_sw_slots; - } /* Enqueue request - must be locked with HW lock*/ req_mgr_h->req_queue[req_mgr_h->req_queue_head] = *ssi_req; @@ -412,9 +411,9 @@ int send_request_init( /* Wait for space in HW and SW FIFO. Poll for as much as FIFO_TIMEOUT. */ rc = request_mgr_queues_status_check(req_mgr_h, cc_base, total_seq_len); - if (unlikely(rc != 0)) { + if (unlikely(rc != 0)) return rc; - } + set_queue_last_ind(&desc[(len - 1)]); enqueue_seq(cc_base, desc, len); @@ -480,23 +479,20 @@ static void proc_completions(struct ssi_drvdata *drvdata) u32 axi_err; int i; SSI_LOG_INFO("Delay\n"); - for (i = 0; i < 1000000; i++) { + for (i = 0; i < 1000000; i++) axi_err = READ_REGISTER(drvdata->cc_base + CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR)); - } } #endif /* COMPLETION_DELAY */ - if (likely(ssi_req->user_cb != NULL)) { + if (likely(ssi_req->user_cb != NULL)) ssi_req->user_cb(&plat_dev->dev, ssi_req->user_arg, drvdata->cc_base); - } request_mgr_handle->req_queue_tail = (request_mgr_handle->req_queue_tail + 1) & (MAX_REQUEST_QUEUE_SIZE - 1); SSI_LOG_DEBUG("Dequeue request tail=%u\n", request_mgr_handle->req_queue_tail); SSI_LOG_DEBUG("Request completed. axi_completed=%d\n", request_mgr_handle->axi_completed); #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) rc = ssi_power_mgr_runtime_put_suspend(&plat_dev->dev); - if (rc != 0) { + if (rc != 0) SSI_LOG_ERR("Failed to set runtime suspension %d\n", rc); - } #endif } } diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index db703005aafb..749ec362fd0c 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -316,9 +316,9 @@ static ssize_t ssi_sys_help_show(struct kobject *kobj, int i = 0, offset = 0; offset += scnprintf(buf + offset, PAGE_SIZE - offset, "Usage:\n"); - for (i = 0; i < ARRAY_SIZE(help_str); i += 2) { + for (i = 0; i < ARRAY_SIZE(help_str); i += 2) offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s\t\t%s\n", help_str[i], help_str[i + 1]); - } + return offset; } -- cgit v1.2.3-55-g7522 From 44c891af576997763d1d4c790d50d10db9eff00f Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:18 +0300 Subject: staging: ccree: fix unmatched if/else braces Fix mismatched braces between if and else. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_buffer_mgr.c | 3 ++- drivers/staging/ccree/ssi_cipher.c | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 9e8a1343e9b1..f9720fc5dd19 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -551,8 +551,9 @@ int ssi_buffer_mgr_map_blkcipher_request( SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=0x%llX\n", ivsize, info, (unsigned long long)req_ctx->gen_ctx.iv_dma_addr); - } else + } else { req_ctx->gen_ctx.iv_dma_addr = 0; + } /* Map the src SGL */ rc = ssi_buffer_mgr_map_scatterlist(dev, src, diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index c233b7c722e1..88ed7772c231 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -401,8 +401,9 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, /* STAT_PHASE_1: Copy key to ctx */ dma_sync_single_for_cpu(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); -#if SSI_CC_HAS_MULTI2 + if (ctx_p->flow_mode == S_DIN_to_MULTI2) { +#if SSI_CC_HAS_MULTI2 memcpy(ctx_p->user.key, key, CC_MULTI2_SYSTEM_N_DATA_KEY_SIZE); ctx_p->key_round_number = key[CC_MULTI2_SYSTEM_N_DATA_KEY_SIZE]; if (ctx_p->key_round_number < CC_MULTI2_MIN_NUM_ROUNDS || @@ -410,10 +411,8 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); SSI_LOG_DEBUG("ssi_blkcipher_setkey: SSI_CC_HAS_MULTI2 einval"); return -EINVAL; - } - } else #endif /*SSI_CC_HAS_MULTI2*/ - { + } else { memcpy(ctx_p->user.key, key, keylen); if (keylen == 24) memset(ctx_p->user.key + 24, 0, CC_AES_KEY_SIZE_MAX - 24); -- cgit v1.2.3-55-g7522 From 6191eb1dc817d78b147a6e4a485b2406be9bf15e Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:19 +0300 Subject: staging: ccree: remove comparisons to NULL Remove explicit comparisons to NULL in ccree driver. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 34 ++++++++++++------------- drivers/staging/ccree/ssi_buffer_mgr.c | 44 ++++++++++++++++----------------- drivers/staging/ccree/ssi_cipher.c | 12 ++++----- drivers/staging/ccree/ssi_driver.c | 20 +++++++-------- drivers/staging/ccree/ssi_fips.c | 4 +-- drivers/staging/ccree/ssi_fips_ext.c | 4 +-- drivers/staging/ccree/ssi_fips_local.c | 10 ++++---- drivers/staging/ccree/ssi_hash.c | 12 ++++----- drivers/staging/ccree/ssi_ivgen.c | 4 +-- drivers/staging/ccree/ssi_request_mgr.c | 8 +++--- drivers/staging/ccree/ssi_sram_mgr.c | 2 +- drivers/staging/ccree/ssi_sysfs.c | 2 +- 12 files changed, 78 insertions(+), 78 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index fdb257dc0712..53105ddb7012 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -98,7 +98,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) dev = &ctx->drvdata->plat_dev->dev; /* Unmap enckey buffer */ - if (ctx->enckey != NULL) { + if (ctx->enckey) { dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, ctx->enckey_dma_addr); SSI_LOG_DEBUG("Freed enckey DMA buffer enckey_dma_addr=0x%llX\n", (unsigned long long)ctx->enckey_dma_addr); @@ -107,7 +107,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) } if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { /* XCBC authetication */ - if (ctx->auth_state.xcbc.xcbc_keys != NULL) { + if (ctx->auth_state.xcbc.xcbc_keys) { dma_free_coherent(dev, CC_AES_128_BIT_KEY_SIZE * 3, ctx->auth_state.xcbc.xcbc_keys, ctx->auth_state.xcbc.xcbc_keys_dma_addr); @@ -117,7 +117,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) ctx->auth_state.xcbc.xcbc_keys_dma_addr = 0; ctx->auth_state.xcbc.xcbc_keys = NULL; } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */ - if (ctx->auth_state.hmac.ipad_opad != NULL) { + if (ctx->auth_state.hmac.ipad_opad) { dma_free_coherent(dev, 2 * MAX_HMAC_DIGEST_SIZE, ctx->auth_state.hmac.ipad_opad, ctx->auth_state.hmac.ipad_opad_dma_addr); @@ -126,7 +126,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) ctx->auth_state.hmac.ipad_opad_dma_addr = 0; ctx->auth_state.hmac.ipad_opad = NULL; } - if (ctx->auth_state.hmac.padded_authkey != NULL) { + if (ctx->auth_state.hmac.padded_authkey) { dma_free_coherent(dev, MAX_HMAC_BLOCK_SIZE, ctx->auth_state.hmac.padded_authkey, ctx->auth_state.hmac.padded_authkey_dma_addr); @@ -160,7 +160,7 @@ static int ssi_aead_init(struct crypto_aead *tfm) /* Allocate key buffer, cache line aligned */ ctx->enckey = dma_alloc_coherent(dev, AES_MAX_KEY_SIZE, &ctx->enckey_dma_addr, GFP_KERNEL); - if (ctx->enckey == NULL) { + if (!ctx->enckey) { SSI_LOG_ERR("Failed allocating key buffer\n"); goto init_failed; } @@ -174,7 +174,7 @@ static int ssi_aead_init(struct crypto_aead *tfm) ctx->auth_state.xcbc.xcbc_keys = dma_alloc_coherent(dev, CC_AES_128_BIT_KEY_SIZE * 3, &ctx->auth_state.xcbc.xcbc_keys_dma_addr, GFP_KERNEL); - if (ctx->auth_state.xcbc.xcbc_keys == NULL) { + if (!ctx->auth_state.xcbc.xcbc_keys) { SSI_LOG_ERR("Failed allocating buffer for XCBC keys\n"); goto init_failed; } @@ -183,7 +183,7 @@ static int ssi_aead_init(struct crypto_aead *tfm) ctx->auth_state.hmac.ipad_opad = dma_alloc_coherent(dev, 2 * MAX_HMAC_DIGEST_SIZE, &ctx->auth_state.hmac.ipad_opad_dma_addr, GFP_KERNEL); - if (ctx->auth_state.hmac.ipad_opad == NULL) { + if (!ctx->auth_state.hmac.ipad_opad) { SSI_LOG_ERR("Failed allocating IPAD/OPAD buffer\n"); goto init_failed; } @@ -193,7 +193,7 @@ static int ssi_aead_init(struct crypto_aead *tfm) ctx->auth_state.hmac.padded_authkey = dma_alloc_coherent(dev, MAX_HMAC_BLOCK_SIZE, &ctx->auth_state.hmac.padded_authkey_dma_addr, GFP_KERNEL); - if (ctx->auth_state.hmac.padded_authkey == NULL) { + if (!ctx->auth_state.hmac.padded_authkey) { SSI_LOG_ERR("failed to allocate padded_authkey\n"); goto init_failed; } @@ -242,7 +242,7 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c areq->cryptlen + areq_ctx->dstOffset + ctx->authsize, SSI_SG_FROM_BUF); /* If an IV was generated, copy it back to the user provided buffer. */ - if (areq_ctx->backup_giv != NULL) { + if (areq_ctx->backup_giv) { if (ctx->cipher_mode == DRV_CIPHER_CTR) memcpy(areq_ctx->backup_giv, areq_ctx->ctr_iv + CTR_RFC3686_NONCE_SIZE, CTR_RFC3686_IV_SIZE); else if (ctx->cipher_mode == DRV_CIPHER_CCM) @@ -1848,7 +1848,7 @@ static inline void ssi_aead_dump_gcm( if (ctx->cipher_mode != DRV_CIPHER_GCTR) return; - if (title != NULL) { + if (title) { SSI_LOG_DEBUG("----------------------------------------------------------------------------------"); SSI_LOG_DEBUG("%s\n", title); } @@ -1856,7 +1856,7 @@ static inline void ssi_aead_dump_gcm( SSI_LOG_DEBUG("cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, cryptlen %d\n", \ ctx->cipher_mode, ctx->authsize, ctx->enc_keylen, req->assoclen, req_ctx->cryptlen); - if (ctx->enckey != NULL) + if (ctx->enckey) dump_byte_array("mac key", ctx->enckey, 16); dump_byte_array("req->iv", req->iv, AES_BLOCK_SIZE); @@ -1871,10 +1871,10 @@ static inline void ssi_aead_dump_gcm( dump_byte_array("gcm_len_block", req_ctx->gcm_len_block.lenA, AES_BLOCK_SIZE); - if (req->src != NULL && req->cryptlen) + if (req->src && req->cryptlen) dump_byte_array("req->src", sg_virt(req->src), req->cryptlen + req->assoclen); - if (req->dst != NULL) + if (req->dst) dump_byte_array("req->dst", sg_virt(req->dst), req->cryptlen + ctx->authsize + req->assoclen); } #endif @@ -1981,7 +1981,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction * CTR key to first 4 bytes in CTR IV */ memcpy(areq_ctx->ctr_iv, ctx->ctr_nonce, CTR_RFC3686_NONCE_SIZE); - if (areq_ctx->backup_giv == NULL) /*User none-generated IV*/ + if (!areq_ctx->backup_giv) /*User none-generated IV*/ memcpy(areq_ctx->ctr_iv + CTR_RFC3686_NONCE_SIZE, req->iv, CTR_RFC3686_IV_SIZE); /* Initialize counter portion of counter block */ @@ -2033,7 +2033,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction } /* do we need to generate IV? */ - if (areq_ctx->backup_giv != NULL) { + if (areq_ctx->backup_giv) { /* set the DMA mapped IV address*/ if (ctx->cipher_mode == DRV_CIPHER_CTR) { ssi_req.ivgen_dma_addr[0] = areq_ctx->gen_ctx.iv_dma_addr + CTR_RFC3686_NONCE_SIZE; @@ -2685,7 +2685,7 @@ int ssi_aead_free(struct ssi_drvdata *drvdata) struct ssi_aead_handle *aead_handle = (struct ssi_aead_handle *)drvdata->aead_handle; - if (aead_handle != NULL) { + if (aead_handle) { /* Remove registered algs */ list_for_each_entry_safe(t_alg, n, &aead_handle->aead_list, entry) { crypto_unregister_aead(&t_alg->aead_alg); @@ -2707,7 +2707,7 @@ int ssi_aead_alloc(struct ssi_drvdata *drvdata) int alg; aead_handle = kmalloc(sizeof(struct ssi_aead_handle), GFP_KERNEL); - if (aead_handle == NULL) { + if (!aead_handle) { rc = -ENOMEM; goto fail0; } diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index f9720fc5dd19..e060ea17dc21 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -94,7 +94,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( sg_list = sg_next(sg_list); } else { sg_list = (struct scatterlist *)sg_page(sg_list); - if (is_chained != NULL) + if (is_chained) *is_chained = true; } } @@ -113,7 +113,7 @@ void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, u32 data_len) int sg_index = 0; while (sg_index <= data_len) { - if (current_sg == NULL) { + if (!current_sg) { /* reached the end of the sgl --> just return back */ return; } @@ -190,7 +190,7 @@ static inline int ssi_buffer_mgr_render_scatterlist_to_mlli( u32 *mlli_entry_p = *mlli_entry_pp; s32 rc = 0; - for ( ; (curr_sgl != NULL) && (sgl_data_len != 0); + for ( ; (curr_sgl) && (sgl_data_len != 0); curr_sgl = sg_next(curr_sgl)) { u32 entry_data_len = (sgl_data_len > sg_dma_len(curr_sgl) - sglOffset) ? @@ -223,7 +223,7 @@ static int ssi_buffer_mgr_generate_mlli( mlli_params->mlli_virt_addr = dma_pool_alloc( mlli_params->curr_pool, GFP_KERNEL, &(mlli_params->mlli_dma_addr)); - if (unlikely(mlli_params->mlli_virt_addr == NULL)) { + if (unlikely(!mlli_params->mlli_virt_addr)) { SSI_LOG_ERR("dma_pool_alloc() failed\n"); rc = -ENOMEM; goto build_mlli_exit; @@ -246,7 +246,7 @@ static int ssi_buffer_mgr_generate_mlli( return rc; /* set last bit in the current table */ - if (sg_data->mlli_nents[i] != NULL) { + if (sg_data->mlli_nents[i]) { /*Calculate the current MLLI table length for the *length field in the descriptor */ @@ -286,7 +286,7 @@ static inline void ssi_buffer_mgr_add_buffer_entry( sgl_data->type[index] = DMA_BUFF_TYPE; sgl_data->is_last[index] = is_last_entry; sgl_data->mlli_nents[index] = mlli_nents; - if (sgl_data->mlli_nents[index] != NULL) + if (sgl_data->mlli_nents[index]) *sgl_data->mlli_nents[index] = 0; sgl_data->num_of_buffers++; } @@ -311,7 +311,7 @@ static inline void ssi_buffer_mgr_add_scatterlist_entry( sgl_data->type[index] = DMA_SGL_TYPE; sgl_data->is_last[index] = is_last_table; sgl_data->mlli_nents[index] = mlli_nents; - if (sgl_data->mlli_nents[index] != NULL) + if (sgl_data->mlli_nents[index]) *sgl_data->mlli_nents[index] = 0; sgl_data->num_of_buffers++; } @@ -323,7 +323,7 @@ ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, u32 nents, u32 i, j; struct scatterlist *l_sg = sg; for (i = 0; i < nents; i++) { - if (l_sg == NULL) + if (!l_sg) break; if (unlikely(dma_map_sg(dev, l_sg, 1, direction) != 1)) { SSI_LOG_ERR("dma_map_page() sg buffer failed\n"); @@ -336,7 +336,7 @@ ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, u32 nents, err: /* Restore mapped parts */ for (j = 0; j < i; j++) { - if (sg == NULL) + if (!sg) break; dma_unmap_sg(dev, sg, 1, direction); sg = sg_next(sg); @@ -672,7 +672,7 @@ void ssi_buffer_mgr_unmap_aead_request( /*In case a pool was set, a table was *allocated and should be released */ - if (areq_ctx->mlli_params.curr_pool != NULL) { + if (areq_ctx->mlli_params.curr_pool) { SSI_LOG_DEBUG("free MLLI buffer: dma=0x%08llX virt=%pK\n", (unsigned long long)areq_ctx->mlli_params.mlli_dma_addr, areq_ctx->mlli_params.mlli_virt_addr); @@ -731,12 +731,12 @@ static inline int ssi_buffer_mgr_get_aead_icv_nents( } for (i = 0 ; i < (sgl_nents - MAX_ICV_NENTS_SUPPORTED) ; i++) { - if (sgl == NULL) + if (!sgl) break; sgl = sg_next(sgl); } - if (sgl != NULL) + if (sgl) icv_max_size = sgl->length; if (last_entry_data_size > authsize) { @@ -773,7 +773,7 @@ static inline int ssi_buffer_mgr_aead_chain_iv( struct device *dev = &drvdata->plat_dev->dev; int rc = 0; - if (unlikely(req->iv == NULL)) { + if (unlikely(!req->iv)) { areq_ctx->gen_ctx.iv_dma_addr = 0; goto chain_iv_exit; } @@ -823,7 +823,7 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( if (areq_ctx->is_gcm4543) size_of_assoc += crypto_aead_ivsize(tfm); - if (sg_data == NULL) { + if (!sg_data) { rc = -EINVAL; goto chain_assoc_exit; } @@ -847,7 +847,7 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( while (sg_index <= size_of_assoc) { current_sg = sg_next(current_sg); //if have reached the end of the sgl, then this is unexpected - if (current_sg == NULL) { + if (!current_sg) { SSI_LOG_ERR("reached end of sg list. unexpected\n"); BUG(); } @@ -1108,7 +1108,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( offset = size_to_skip; - if (sg_data == NULL) { + if (!sg_data) { rc = -EINVAL; goto chain_data_exit; } @@ -1126,7 +1126,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( offset -= areq_ctx->srcSgl->length; areq_ctx->srcSgl = sg_next(areq_ctx->srcSgl); //if have reached the end of the sgl, then this is unexpected - if (areq_ctx->srcSgl == NULL) { + if (!areq_ctx->srcSgl) { SSI_LOG_ERR("reached end of sg list. unexpected\n"); BUG(); } @@ -1169,7 +1169,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( offset -= areq_ctx->dstSgl->length; areq_ctx->dstSgl = sg_next(areq_ctx->dstSgl); //if have reached the end of the sgl, then this is unexpected - if (areq_ctx->dstSgl == NULL) { + if (!areq_ctx->dstSgl) { SSI_LOG_ERR("reached end of sg list. unexpected\n"); BUG(); } @@ -1685,7 +1685,7 @@ void ssi_buffer_mgr_unmap_hash_request( /*In case a pool was set, a table was *allocated and should be released */ - if (areq_ctx->mlli_params.curr_pool != NULL) { + if (areq_ctx->mlli_params.curr_pool) { SSI_LOG_DEBUG("free MLLI buffer: dma=0x%llX virt=%pK\n", (unsigned long long)areq_ctx->mlli_params.mlli_dma_addr, areq_ctx->mlli_params.mlli_virt_addr); @@ -1726,7 +1726,7 @@ int ssi_buffer_mgr_init(struct ssi_drvdata *drvdata) buff_mgr_handle = (struct buff_mgr_handle *) kmalloc(sizeof(struct buff_mgr_handle), GFP_KERNEL); - if (buff_mgr_handle == NULL) + if (!buff_mgr_handle) return -ENOMEM; drvdata->buff_mgr_handle = buff_mgr_handle; @@ -1737,7 +1737,7 @@ int ssi_buffer_mgr_init(struct ssi_drvdata *drvdata) LLI_ENTRY_BYTE_SIZE, MLLI_TABLE_MIN_ALIGNMENT, 0); - if (unlikely(buff_mgr_handle->mlli_buffs_pool == NULL)) + if (unlikely(!buff_mgr_handle->mlli_buffs_pool)) goto error; return 0; @@ -1751,7 +1751,7 @@ int ssi_buffer_mgr_fini(struct ssi_drvdata *drvdata) { struct buff_mgr_handle *buff_mgr_handle = drvdata->buff_mgr_handle; - if (buff_mgr_handle != NULL) { + if (buff_mgr_handle) { dma_pool_destroy(buff_mgr_handle->mlli_buffs_pool); kfree(drvdata->buff_mgr_handle); drvdata->buff_mgr_handle = NULL; diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 88ed7772c231..1baa2157e9f1 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -653,7 +653,7 @@ ssi_blkcipher_create_data_desc( nbytes, NS_BIT); set_dout_dlli(&desc[*seq_size], sg_dma_address(dst), nbytes, NS_BIT, (!areq ? 0 : 1)); - if (areq != NULL) + if (areq) set_queue_last_ind(&desc[*seq_size]); set_flow_mode(&desc[*seq_size], flow_mode); @@ -702,7 +702,7 @@ ssi_blkcipher_create_data_desc( req_ctx->out_mlli_nents, NS_BIT, (!areq ? 0 : 1)); } - if (areq != NULL) + if (areq) set_queue_last_ind(&desc[*seq_size]); set_flow_mode(&desc[*seq_size], flow_mode); @@ -829,8 +829,8 @@ static int ssi_blkcipher_process( /* STAT_PHASE_3: Lock HW and push sequence */ - rc = send_request(ctx_p->drvdata, &ssi_req, desc, seq_len, (areq == NULL) ? 0 : 1); - if (areq != NULL) { + rc = send_request(ctx_p->drvdata, &ssi_req, desc, seq_len, (!areq) ? 0 : 1); + if (areq) { if (unlikely(rc != -EINPROGRESS)) { /* Failed to send the request or request completed synchronously */ ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); @@ -1292,7 +1292,7 @@ int ssi_ablkcipher_free(struct ssi_drvdata *drvdata) struct device *dev; dev = &drvdata->plat_dev->dev; - if (blkcipher_handle != NULL) { + if (blkcipher_handle) { /* Remove registered algs */ list_for_each_entry_safe(t_alg, n, &blkcipher_handle->blkcipher_alg_list, @@ -1318,7 +1318,7 @@ int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata) ablkcipher_handle = kmalloc(sizeof(struct ssi_blkcipher_handle), GFP_KERNEL); - if (ablkcipher_handle == NULL) + if (!ablkcipher_handle) return -ENOMEM; drvdata->blkcipher_handle = ablkcipher_handle; diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 330d24d38d83..5c1d295b5b7c 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -81,7 +81,7 @@ void dump_byte_array(const char *name, const u8 *the_array, unsigned long size) const u8 *cur_byte; char line_buf[80]; - if (the_array == NULL) { + if (!the_array) { SSI_LOG_ERR("cannot dump_byte_array - NULL pointer\n"); return; } @@ -231,7 +231,7 @@ static int init_cc_resources(struct platform_device *plat_dev) u32 signature_val; int rc = 0; - if (unlikely(new_drvdata == NULL)) { + if (unlikely(!new_drvdata)) { SSI_LOG_ERR("Failed to allocate drvdata"); rc = -ENOMEM; goto init_cc_res_err; @@ -247,7 +247,7 @@ static int init_cc_resources(struct platform_device *plat_dev) /* Get device resources */ /* First CC registers space */ new_drvdata->res_mem = platform_get_resource(plat_dev, IORESOURCE_MEM, 0); - if (unlikely(new_drvdata->res_mem == NULL)) { + if (unlikely(!new_drvdata->res_mem)) { SSI_LOG_ERR("Failed getting IO memory resource\n"); rc = -ENODEV; goto init_cc_res_err; @@ -258,14 +258,14 @@ static int init_cc_resources(struct platform_device *plat_dev) (unsigned long long)new_drvdata->res_mem->end); /* Map registers space */ req_mem_cc_regs = request_mem_region(new_drvdata->res_mem->start, resource_size(new_drvdata->res_mem), "arm_cc7x_regs"); - if (unlikely(req_mem_cc_regs == NULL)) { + if (unlikely(!req_mem_cc_regs)) { SSI_LOG_ERR("Couldn't allocate registers memory region at " "0x%08X\n", (unsigned int)new_drvdata->res_mem->start); rc = -EBUSY; goto init_cc_res_err; } cc_base = ioremap(new_drvdata->res_mem->start, resource_size(new_drvdata->res_mem)); - if (unlikely(cc_base == NULL)) { + if (unlikely(!cc_base)) { SSI_LOG_ERR("ioremap[CC](0x%08X,0x%08X) failed\n", (unsigned int)new_drvdata->res_mem->start, (unsigned int)resource_size(new_drvdata->res_mem)); rc = -ENOMEM; @@ -277,7 +277,7 @@ static int init_cc_resources(struct platform_device *plat_dev) /* Then IRQ */ new_drvdata->res_irq = platform_get_resource(plat_dev, IORESOURCE_IRQ, 0); - if (unlikely(new_drvdata->res_irq == NULL)) { + if (unlikely(!new_drvdata->res_irq)) { SSI_LOG_ERR("Failed getting IRQ resource\n"); rc = -ENODEV; goto init_cc_res_err; @@ -302,7 +302,7 @@ static int init_cc_resources(struct platform_device *plat_dev) if (rc) goto init_cc_res_err; - if (new_drvdata->plat_dev->dev.dma_mask == NULL) + if (!new_drvdata->plat_dev->dev.dma_mask) { new_drvdata->plat_dev->dev.dma_mask = &new_drvdata->plat_dev->dev.coherent_dma_mask; } @@ -408,7 +408,7 @@ static int init_cc_resources(struct platform_device *plat_dev) init_cc_res_err: SSI_LOG_ERR("Freeing CC HW resources!\n"); - if (new_drvdata != NULL) { + if (new_drvdata) { ssi_aead_free(new_drvdata); ssi_hash_free(new_drvdata); ssi_ablkcipher_free(new_drvdata); @@ -422,7 +422,7 @@ init_cc_res_err: ssi_sysfs_fini(); #endif - if (req_mem_cc_regs != NULL) { + if (req_mem_cc_regs) { if (irq_registered) { free_irq(new_drvdata->res_irq->start, new_drvdata); new_drvdata->res_irq = NULL; @@ -470,7 +470,7 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) free_irq(drvdata->res_irq->start, drvdata); drvdata->res_irq = NULL; - if (drvdata->cc_base != NULL) { + if (drvdata->cc_base) { iounmap(drvdata->cc_base); release_mem_region(drvdata->res_mem->start, resource_size(drvdata->res_mem)); diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index 2e01a0a61011..2b8a616b5f01 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -34,7 +34,7 @@ int ssi_fips_get_state(ssi_fips_state_t *p_state) { int rc = 0; - if (p_state == NULL) + if (!p_state) return -EINVAL; rc = ssi_fips_ext_get_state(p_state); @@ -52,7 +52,7 @@ int ssi_fips_get_error(ssi_fips_error_t *p_err) { int rc = 0; - if (p_err == NULL) + if (!p_err) return -EINVAL; rc = ssi_fips_ext_get_error(p_err); diff --git a/drivers/staging/ccree/ssi_fips_ext.c b/drivers/staging/ccree/ssi_fips_ext.c index 8b14061f9e75..b897c0386264 100644 --- a/drivers/staging/ccree/ssi_fips_ext.c +++ b/drivers/staging/ccree/ssi_fips_ext.c @@ -41,7 +41,7 @@ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) { int rc = 0; - if (p_state == NULL) + if (!p_state) return -EINVAL; *p_state = fips_state; @@ -59,7 +59,7 @@ int ssi_fips_ext_get_error(ssi_fips_error_t *p_err) { int rc = 0; - if (p_err == NULL) + if (!p_err) return -EINVAL; *p_err = fips_error; diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index 84d458a10c4e..c571b85304e9 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -99,11 +99,11 @@ void ssi_fips_fini(struct ssi_drvdata *drvdata) { struct ssi_fips_handle *fips_h = drvdata->fips_handle; - if (fips_h == NULL) + if (!fips_h) return; /* Not allocated */ #ifdef COMP_IN_WQ - if (fips_h->workq != NULL) { + if (fips_h->workq) { flush_workqueue(fips_h->workq); destroy_workqueue(fips_h->workq); } @@ -175,7 +175,7 @@ ssi_fips_error_t cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) // the dma_handle is the returned phy address - use it in the HW descriptor FIPS_DBG("dma_alloc_coherent \n"); cpu_addr_buffer = dma_alloc_coherent(dev, alloc_buff_size, &dma_handle, GFP_KERNEL); - if (cpu_addr_buffer == NULL) + if (!cpu_addr_buffer) return CC_REE_FIPS_ERROR_GENERAL; FIPS_DBG("allocated coherent buffer - addr 0x%08X , size = %d \n", (size_t)cpu_addr_buffer, alloc_buff_size); @@ -303,7 +303,7 @@ int ssi_fips_init(struct ssi_drvdata *p_drvdata) FIPS_DBG("CC FIPS code .. (fips=%d) \n", ssi_fips_support); fips_h = kzalloc(sizeof(struct ssi_fips_handle), GFP_KERNEL); - if (fips_h == NULL) { + if (!fips_h) { ssi_fips_set_error(p_drvdata, CC_REE_FIPS_ERROR_GENERAL); return -ENOMEM; } @@ -313,7 +313,7 @@ int ssi_fips_init(struct ssi_drvdata *p_drvdata) #ifdef COMP_IN_WQ SSI_LOG_DEBUG("Initializing fips workqueue\n"); fips_h->workq = create_singlethread_workqueue("arm_cc7x_fips_wq"); - if (unlikely(fips_h->workq == NULL)) { + if (unlikely(!fips_h->workq)) { SSI_LOG_ERR("Failed creating fips work queue\n"); ssi_fips_set_error(p_drvdata, CC_REE_FIPS_ERROR_GENERAL); rc = -ENOMEM; diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 265df94989da..7a70d87a215b 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -297,17 +297,17 @@ fail2: fail1: kfree(state->digest_buff); fail_digest_result_buff: - if (state->digest_result_buff != NULL) { + if (state->digest_result_buff) { kfree(state->digest_result_buff); state->digest_result_buff = NULL; } fail_buff1: - if (state->buff1 != NULL) { + if (state->buff1) { kfree(state->buff1); state->buff1 = NULL; } fail_buff0: - if (state->buff0 != NULL) { + if (state->buff0) { kfree(state->buff0); state->buff0 = NULL; } @@ -2249,7 +2249,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) int alg; hash_handle = kzalloc(sizeof(struct ssi_hash_handle), GFP_KERNEL); - if (hash_handle == NULL) { + if (!hash_handle) { SSI_LOG_ERR("kzalloc failed to allocate %zu B\n", sizeof(struct ssi_hash_handle)); rc = -ENOMEM; @@ -2343,7 +2343,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) fail: - if (drvdata->hash_handle != NULL) { + if (drvdata->hash_handle) { kfree(drvdata->hash_handle); drvdata->hash_handle = NULL; } @@ -2355,7 +2355,7 @@ int ssi_hash_free(struct ssi_drvdata *drvdata) struct ssi_hash_alg *t_hash_alg, *hash_n; struct ssi_hash_handle *hash_handle = drvdata->hash_handle; - if (hash_handle != NULL) { + if (hash_handle) { list_for_each_entry_safe(t_hash_alg, hash_n, &hash_handle->hash_list, entry) { crypto_unregister_ahash(&t_hash_alg->ahash_alg); list_del(&t_hash_alg->entry); diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index d81bf683d877..a275151ab91a 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -160,10 +160,10 @@ void ssi_ivgen_fini(struct ssi_drvdata *drvdata) struct ssi_ivgen_ctx *ivgen_ctx = drvdata->ivgen_handle; struct device *device = &(drvdata->plat_dev->dev); - if (ivgen_ctx == NULL) + if (!ivgen_ctx) return; - if (ivgen_ctx->pool_meta != NULL) { + if (ivgen_ctx->pool_meta) { memset(ivgen_ctx->pool_meta, 0, SSI_IVPOOL_META_SIZE); dma_free_coherent(device, SSI_IVPOOL_META_SIZE, ivgen_ctx->pool_meta, ivgen_ctx->pool_meta_dma); diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 2a39c128e07c..ecd4a8b53f5a 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -71,7 +71,7 @@ void request_mgr_fini(struct ssi_drvdata *drvdata) { struct ssi_request_mgr_handle *req_mgr_h = drvdata->request_mgr_handle; - if (req_mgr_h == NULL) + if (!req_mgr_h) return; /* Not allocated */ if (req_mgr_h->dummy_comp_buff_dma != 0) { @@ -102,7 +102,7 @@ int request_mgr_init(struct ssi_drvdata *drvdata) int rc = 0; req_mgr_h = kzalloc(sizeof(struct ssi_request_mgr_handle), GFP_KERNEL); - if (req_mgr_h == NULL) { + if (!req_mgr_h) { rc = -ENOMEM; goto req_mgr_init_err; } @@ -113,7 +113,7 @@ int request_mgr_init(struct ssi_drvdata *drvdata) #ifdef COMP_IN_WQ SSI_LOG_DEBUG("Initializing completion workqueue\n"); req_mgr_h->workq = create_singlethread_workqueue("arm_cc7x_wq"); - if (unlikely(req_mgr_h->workq == NULL)) { + if (unlikely(!req_mgr_h->workq)) { SSI_LOG_ERR("Failed creating work queue\n"); rc = -ENOMEM; goto req_mgr_init_err; @@ -484,7 +484,7 @@ static void proc_completions(struct ssi_drvdata *drvdata) } #endif /* COMPLETION_DELAY */ - if (likely(ssi_req->user_cb != NULL)) + if (likely(ssi_req->user_cb)) ssi_req->user_cb(&plat_dev->dev, ssi_req->user_arg, drvdata->cc_base); request_mgr_handle->req_queue_tail = (request_mgr_handle->req_queue_tail + 1) & (MAX_REQUEST_QUEUE_SIZE - 1); SSI_LOG_DEBUG("Dequeue request tail=%u\n", request_mgr_handle->req_queue_tail); diff --git a/drivers/staging/ccree/ssi_sram_mgr.c b/drivers/staging/ccree/ssi_sram_mgr.c index c8ab55ee2119..cf03df376039 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.c +++ b/drivers/staging/ccree/ssi_sram_mgr.c @@ -37,7 +37,7 @@ void ssi_sram_mgr_fini(struct ssi_drvdata *drvdata) struct ssi_sram_mgr_ctx *smgr_ctx = drvdata->sram_mgr_handle; /* Free "this" context */ - if (smgr_ctx != NULL) { + if (smgr_ctx) { memset(smgr_ctx, 0, sizeof(struct ssi_sram_mgr_ctx)); kfree(smgr_ctx); } diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 749ec362fd0c..8de43530fd13 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -408,7 +408,7 @@ static void sys_free_dir(struct sys_dir *sys_dir) kfree(sys_dir->sys_dir_attr_list); - if (sys_dir->sys_dir_kobj != NULL) + if (sys_dir->sys_dir_kobj) kobject_put(sys_dir->sys_dir_kobj); } -- cgit v1.2.3-55-g7522 From d32a0b6db88a70e613dc90df8f1bbe545f4ce049 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:20 +0300 Subject: staging: ccree: fix pointer location Fix location of pointer in variables definitions and dereference. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.h | 4 ++-- drivers/staging/ccree/ssi_buffer_mgr.c | 12 ++++++------ drivers/staging/ccree/ssi_cipher.c | 8 ++++---- drivers/staging/ccree/ssi_fips_ll.c | 24 ++++++++++++------------ drivers/staging/ccree/ssi_fips_local.c | 2 +- drivers/staging/ccree/ssi_hash.c | 2 +- drivers/staging/ccree/ssi_hash.h | 6 +++--- drivers/staging/ccree/ssi_request_mgr.c | 10 +++++----- drivers/staging/ccree/ssi_sysfs.c | 4 ++-- 9 files changed, 36 insertions(+), 36 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 07cab84b83f4..d69e72909209 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -98,8 +98,8 @@ struct aead_req_ctx { struct ssi_mlli assoc; struct ssi_mlli src; struct ssi_mlli dst; - struct scatterlist* srcSgl; - struct scatterlist* dstSgl; + struct scatterlist *srcSgl; + struct scatterlist *dstSgl; unsigned int srcOffset; unsigned int dstOffset; enum ssi_req_dma_buf_type assoc_buff_type; diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index e060ea17dc21..1b41c12780fc 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -66,7 +66,7 @@ struct buffer_array { int total_data_len[MAX_NUM_OF_BUFFERS_IN_MLLI]; enum dma_buffer_type type[MAX_NUM_OF_BUFFERS_IN_MLLI]; bool is_last[MAX_NUM_OF_BUFFERS_IN_MLLI]; - u32 * mlli_nents[MAX_NUM_OF_BUFFERS_IN_MLLI]; + u32 *mlli_nents[MAX_NUM_OF_BUFFERS_IN_MLLI]; }; /** @@ -409,7 +409,7 @@ static int ssi_buffer_mgr_map_scatterlist( static inline int ssi_aead_handle_config_buf(struct device *dev, struct aead_req_ctx *areq_ctx, - u8* config_data, + u8 *config_data, struct buffer_array *sg_data, unsigned int assoclen) { @@ -444,7 +444,7 @@ ssi_aead_handle_config_buf(struct device *dev, static inline int ssi_ahash_handle_curr_buf(struct device *dev, struct ahash_req_ctx *areq_ctx, - u8* curr_buff, + u8 *curr_buff, u32 curr_buff_cnt, struct buffer_array *sg_data) { @@ -1460,7 +1460,7 @@ int ssi_buffer_mgr_map_hash_request_final( { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; struct device *dev = &drvdata->plat_dev->dev; - u8* curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : + u8 *curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : areq_ctx->buff0; u32 *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : &areq_ctx->buff0_cnt; @@ -1551,11 +1551,11 @@ int ssi_buffer_mgr_map_hash_request_update( { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; struct device *dev = &drvdata->plat_dev->dev; - u8* curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : + u8 *curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : areq_ctx->buff0; u32 *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : &areq_ctx->buff0_cnt; - u8* next_buff = areq_ctx->buff_index ? areq_ctx->buff0 : + u8 *next_buff = areq_ctx->buff_index ? areq_ctx->buff0 : areq_ctx->buff1; u32 *next_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : &areq_ctx->buff1_cnt; diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 1baa2157e9f1..b4fc9a69d3b7 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -268,11 +268,11 @@ static const u8 zero_buff[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, static int ssi_fips_verify_3des_keys(const u8 *key, unsigned int keylen) { #ifdef CCREE_FIPS_SUPPORT - tdes_keys_t *tdes_key = (tdes_keys_t*)key; + tdes_keys_t *tdes_key = (tdes_keys_t *)key; /* verify key1 != key2 and key3 != key2*/ - if (unlikely((memcmp((u8*)tdes_key->key1, (u8*)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || - (memcmp((u8*)tdes_key->key3, (u8*)tdes_key->key2, sizeof(tdes_key->key3)) == 0))) { + if (unlikely((memcmp((u8 *)tdes_key->key1, (u8 *)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || + (memcmp((u8 *)tdes_key->key3, (u8 *)tdes_key->key2, sizeof(tdes_key->key3)) == 0))) { return -ENOEXEC; } #endif /* CCREE_FIPS_SUPPORT */ @@ -342,7 +342,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, if (ssi_is_hw_key(tfm)) { /* setting HW key slots */ - struct arm_hw_key_info *hki = (struct arm_hw_key_info*)key; + struct arm_hw_key_info *hki = (struct arm_hw_key_info *)key; if (unlikely(ctx_p->flow_mode != S_DIN_to_AES)) { SSI_LOG_ERR("HW key not supported for non-AES flows\n"); diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index 804384d5c2be..4a11f15b18af 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -430,7 +430,7 @@ ssi_cipher_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffe for (i = 0; i < FIPS_CIPHER_NUM_OF_TESTS; ++i) { - FipsCipherData *cipherData = (FipsCipherData*)&FipsCipherDataTable[i]; + FipsCipherData *cipherData = (FipsCipherData *)&FipsCipherDataTable[i]; int rc = 0; size_t iv_size = cipherData->isAes ? NIST_AES_IV_SIZE : NIST_TDES_IV_SIZE; @@ -558,7 +558,7 @@ ssi_cmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, for (i = 0; i < FIPS_CMAC_NUM_OF_TESTS; ++i) { - FipsCmacData *cmac_data = (FipsCmacData*)&FipsCmacDataTable[i]; + FipsCmacData *cmac_data = (FipsCmacData *)&FipsCmacDataTable[i]; int rc = 0; memset(cpu_addr_buffer, 0, sizeof(struct fips_cmac_ctx)); @@ -704,7 +704,7 @@ ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, for (i = 0; i < FIPS_HASH_NUM_OF_TESTS; ++i) { - FipsHashData *hash_data = (FipsHashData*)&FipsHashDataTable[i]; + FipsHashData *hash_data = (FipsHashData *)&FipsHashDataTable[i]; int rc = 0; enum drv_hash_hw_mode hw_mode = 0; int digest_size = 0; @@ -718,20 +718,20 @@ ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, digest_size = CC_SHA1_DIGEST_SIZE; inter_digestsize = CC_SHA1_DIGEST_SIZE; /* copy the initial digest into the allocated cache coherent buffer */ - memcpy(virt_ctx->initial_digest, (void*)sha1_init, CC_SHA1_DIGEST_SIZE); + memcpy(virt_ctx->initial_digest, (void *)sha1_init, CC_SHA1_DIGEST_SIZE); break; case DRV_HASH_SHA256: hw_mode = DRV_HASH_HW_SHA256; digest_size = CC_SHA256_DIGEST_SIZE; inter_digestsize = CC_SHA256_DIGEST_SIZE; - memcpy(virt_ctx->initial_digest, (void*)sha256_init, CC_SHA256_DIGEST_SIZE); + memcpy(virt_ctx->initial_digest, (void *)sha256_init, CC_SHA256_DIGEST_SIZE); break; #if (CC_SUPPORT_SHA > 256) case DRV_HASH_SHA512: hw_mode = DRV_HASH_HW_SHA512; digest_size = CC_SHA512_DIGEST_SIZE; inter_digestsize = CC_SHA512_DIGEST_SIZE; - memcpy(virt_ctx->initial_digest, (void*)sha512_init, CC_SHA512_DIGEST_SIZE); + memcpy(virt_ctx->initial_digest, (void *)sha512_init, CC_SHA512_DIGEST_SIZE); break; #endif default: @@ -1024,7 +1024,7 @@ ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, for (i = 0; i < FIPS_HMAC_NUM_OF_TESTS; ++i) { - FipsHmacData *hmac_data = (FipsHmacData*)&FipsHmacDataTable[i]; + FipsHmacData *hmac_data = (FipsHmacData *)&FipsHmacDataTable[i]; int rc = 0; enum drv_hash_hw_mode hw_mode = 0; int digest_size = 0; @@ -1039,7 +1039,7 @@ ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, digest_size = CC_SHA1_DIGEST_SIZE; block_size = CC_SHA1_BLOCK_SIZE; inter_digestsize = CC_SHA1_DIGEST_SIZE; - memcpy(virt_ctx->initial_digest, (void*)sha1_init, CC_SHA1_DIGEST_SIZE); + memcpy(virt_ctx->initial_digest, (void *)sha1_init, CC_SHA1_DIGEST_SIZE); memcpy(virt_ctx->digest_bytes_len, digest_len_init, HASH_LEN_SIZE); break; case DRV_HASH_SHA256: @@ -1047,7 +1047,7 @@ ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, digest_size = CC_SHA256_DIGEST_SIZE; block_size = CC_SHA256_BLOCK_SIZE; inter_digestsize = CC_SHA256_DIGEST_SIZE; - memcpy(virt_ctx->initial_digest, (void*)sha256_init, CC_SHA256_DIGEST_SIZE); + memcpy(virt_ctx->initial_digest, (void *)sha256_init, CC_SHA256_DIGEST_SIZE); memcpy(virt_ctx->digest_bytes_len, digest_len_init, HASH_LEN_SIZE); break; #if (CC_SUPPORT_SHA > 256) @@ -1056,7 +1056,7 @@ ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, digest_size = CC_SHA512_DIGEST_SIZE; block_size = CC_SHA512_BLOCK_SIZE; inter_digestsize = CC_SHA512_DIGEST_SIZE; - memcpy(virt_ctx->initial_digest, (void*)sha512_init, CC_SHA512_DIGEST_SIZE); + memcpy(virt_ctx->initial_digest, (void *)sha512_init, CC_SHA512_DIGEST_SIZE); memcpy(virt_ctx->digest_bytes_len, digest_len_sha512_init, HASH_LEN_SIZE); break; #endif @@ -1266,7 +1266,7 @@ ssi_ccm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, for (i = 0; i < FIPS_CCM_NUM_OF_TESTS; ++i) { - FipsCcmData *ccmData = (FipsCcmData*)&FipsCcmDataTable[i]; + FipsCcmData *ccmData = (FipsCcmData *)&FipsCcmDataTable[i]; int rc = 0; memset(cpu_addr_buffer, 0, sizeof(struct fips_ccm_ctx)); @@ -1566,7 +1566,7 @@ ssi_gcm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, for (i = 0; i < FIPS_GCM_NUM_OF_TESTS; ++i) { - FipsGcmData *gcmData = (FipsGcmData*)&FipsGcmDataTable[i]; + FipsGcmData *gcmData = (FipsGcmData *)&FipsGcmDataTable[i]; int rc = 0; memset(cpu_addr_buffer, 0, sizeof(struct fips_gcm_ctx)); diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index c571b85304e9..50d7189994e9 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -165,7 +165,7 @@ static void fips_dsr(unsigned long devarg) ssi_fips_error_t cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) { ssi_fips_error_t fips_error = CC_REE_FIPS_ERROR_OK; - void * cpu_addr_buffer = NULL; + void *cpu_addr_buffer = NULL; dma_addr_t dma_handle; size_t alloc_buff_size = ssi_fips_max_mem_alloc_size(); struct device *dev = &drvdata->plat_dev->dev; diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 7a70d87a215b..79655bba8611 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1358,7 +1358,7 @@ fail: static int ssi_ahash_cra_init(struct crypto_tfm *tfm) { struct ssi_hash_ctx *ctx = crypto_tfm_ctx(tfm); - struct hash_alg_common * hash_alg_common = + struct hash_alg_common *hash_alg_common = container_of(tfm->__crt_alg, struct hash_alg_common, base); struct ahash_alg *ahash_alg = container_of(hash_alg_common, struct ahash_alg, halg); diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index 0bb99cb406f4..2400e389d65a 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -50,9 +50,9 @@ struct aeshash_state { /* ahash state */ struct ahash_req_ctx { - u8* buff0; - u8* buff1; - u8* digest_result_buff; + u8 *buff0; + u8 *buff1; + u8 *digest_result_buff; struct async_gen_req_ctx gen_ctx; enum ssi_req_dma_buf_type data_dma_buf_type; u8 *digest_buff; diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index ecd4a8b53f5a..f6f7ea8e9036 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -452,7 +452,7 @@ static void proc_completions(struct ssi_drvdata *drvdata) { struct ssi_crypto_req *ssi_req; struct platform_device *plat_dev = drvdata->plat_dev; - struct ssi_request_mgr_handle * request_mgr_handle = + struct ssi_request_mgr_handle *request_mgr_handle = drvdata->request_mgr_handle; #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) int rc = 0; @@ -511,7 +511,7 @@ static void comp_handler(unsigned long devarg) { struct ssi_drvdata *drvdata = (struct ssi_drvdata *)devarg; void __iomem *cc_base = drvdata->cc_base; - struct ssi_request_mgr_handle * request_mgr_handle = + struct ssi_request_mgr_handle *request_mgr_handle = drvdata->request_mgr_handle; u32 irq; @@ -559,7 +559,7 @@ static void comp_handler(unsigned long devarg) #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) int ssi_request_mgr_runtime_resume_queue(struct ssi_drvdata *drvdata) { - struct ssi_request_mgr_handle * request_mgr_handle = drvdata->request_mgr_handle; + struct ssi_request_mgr_handle *request_mgr_handle = drvdata->request_mgr_handle; spin_lock_bh(&request_mgr_handle->hw_lock); request_mgr_handle->is_runtime_suspended = false; @@ -574,7 +574,7 @@ int ssi_request_mgr_runtime_resume_queue(struct ssi_drvdata *drvdata) */ int ssi_request_mgr_runtime_suspend_queue(struct ssi_drvdata *drvdata) { - struct ssi_request_mgr_handle * request_mgr_handle = + struct ssi_request_mgr_handle *request_mgr_handle = drvdata->request_mgr_handle; /* lock the send_request */ @@ -592,7 +592,7 @@ int ssi_request_mgr_runtime_suspend_queue(struct ssi_drvdata *drvdata) bool ssi_request_mgr_is_queue_runtime_suspend(struct ssi_drvdata *drvdata) { - struct ssi_request_mgr_handle * request_mgr_handle = + struct ssi_request_mgr_handle *request_mgr_handle = drvdata->request_mgr_handle; return request_mgr_handle->is_runtime_suspended; diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 8de43530fd13..75c9a89f31c4 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -285,7 +285,7 @@ static ssize_t ssi_sys_regdump_show(struct kobject *kobj, { struct ssi_drvdata *drvdata = sys_get_drvdata(); u32 register_value; - void __iomem* cc_base = drvdata->cc_base; + void __iomem *cc_base = drvdata->cc_base; int offset = 0; register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_SIGNATURE)); @@ -304,7 +304,7 @@ static ssize_t ssi_sys_regdump_show(struct kobject *kobj, static ssize_t ssi_sys_help_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - char* help_str[] = { + char *help_str[] = { "cat reg_dump ", "Print several of CC register values", #if defined CC_CYCLE_COUNT "cat stats_host ", "Print host statistics", -- cgit v1.2.3-55-g7522 From 1de8f59fa44b070d5ae6c3f2f4b06d42ab4c8b46 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:21 +0300 Subject: staging: ccree: remove custom type tdes_keys_t Replace references to type tdes_keys_t with struct tdes_keys. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_cipher.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index b4fc9a69d3b7..eb3e8e63431a 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -253,11 +253,11 @@ static void ssi_blkcipher_exit(struct crypto_tfm *tfm) } -typedef struct tdes_keys { +struct tdes_keys { u8 key1[DES_KEY_SIZE]; u8 key2[DES_KEY_SIZE]; u8 key3[DES_KEY_SIZE]; -} tdes_keys_t; +}; static const u8 zero_buff[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -268,7 +268,7 @@ static const u8 zero_buff[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, static int ssi_fips_verify_3des_keys(const u8 *key, unsigned int keylen) { #ifdef CCREE_FIPS_SUPPORT - tdes_keys_t *tdes_key = (tdes_keys_t *)key; + struct tdes_keys *tdes_key = (struct tdes_keys *)key; /* verify key1 != key2 and key3 != key2*/ if (unlikely((memcmp((u8 *)tdes_key->key1, (u8 *)tdes_key->key2, sizeof(tdes_key->key1)) == 0) || -- cgit v1.2.3-55-g7522 From 8422f1120bcfacc724a1928ea691d3953c62756e Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:22 +0300 Subject: staging: ccree: remove custom type ssi_fips_error_t Replace custom type ssi_fips_error_t with underlying enum. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips.c | 4 ++-- drivers/staging/ccree/ssi_fips.h | 6 +++--- drivers/staging/ccree/ssi_fips_ext.c | 6 +++--- drivers/staging/ccree/ssi_fips_ll.c | 30 +++++++++++++++--------------- drivers/staging/ccree/ssi_fips_local.c | 28 ++++++++++++++-------------- drivers/staging/ccree/ssi_fips_local.h | 2 +- 6 files changed, 38 insertions(+), 38 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index 2b8a616b5f01..948ea4996ef0 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -24,7 +24,7 @@ extern int ssi_fips_ext_get_state(ssi_fips_state_t *p_state); -extern int ssi_fips_ext_get_error(ssi_fips_error_t *p_err); +extern int ssi_fips_ext_get_error(enum cc_fips_error *p_err); /* * This function returns the REE FIPS state. @@ -48,7 +48,7 @@ EXPORT_SYMBOL(ssi_fips_get_state); * This function returns the REE FIPS error. * It should be called by kernel module. */ -int ssi_fips_get_error(ssi_fips_error_t *p_err) +int ssi_fips_get_error(enum cc_fips_error *p_err) { int rc = 0; diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h index 2fdb1b90a890..d1cd489eb465 100644 --- a/drivers/staging/ccree/ssi_fips.h +++ b/drivers/staging/ccree/ssi_fips.h @@ -30,7 +30,7 @@ typedef enum ssi_fips_state { } ssi_fips_state_t; -typedef enum ssi_fips_error { +enum cc_fips_error { CC_REE_FIPS_ERROR_OK = 0, CC_REE_FIPS_ERROR_GENERAL, CC_REE_FIPS_ERROR_FROM_TEE, @@ -53,12 +53,12 @@ typedef enum ssi_fips_error { CC_REE_FIPS_ERROR_HMAC_SHA512_PUT, CC_REE_FIPS_ERROR_ROM_CHECKSUM, CC_REE_FIPS_ERROR_RESERVE32B = S32_MAX -} ssi_fips_error_t; +}; int ssi_fips_get_state(ssi_fips_state_t *p_state); -int ssi_fips_get_error(ssi_fips_error_t *p_err); +int ssi_fips_get_error(enum cc_fips_error *p_err); #endif /*__SSI_FIPS_H__*/ diff --git a/drivers/staging/ccree/ssi_fips_ext.c b/drivers/staging/ccree/ssi_fips_ext.c index b897c0386264..aab2805d63ac 100644 --- a/drivers/staging/ccree/ssi_fips_ext.c +++ b/drivers/staging/ccree/ssi_fips_ext.c @@ -29,7 +29,7 @@ module_param(tee_error, bool, 0644); MODULE_PARM_DESC(tee_error, "Simulate TEE library failure flag: 0 - no error (default), 1 - TEE error occured "); static ssi_fips_state_t fips_state = CC_FIPS_STATE_NOT_SUPPORTED; -static ssi_fips_error_t fips_error = CC_REE_FIPS_ERROR_OK; +static enum cc_fips_error fips_error = CC_REE_FIPS_ERROR_OK; /* * This function returns the FIPS REE state. @@ -55,7 +55,7 @@ int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) * the error value is stored. * The reference code uses global variable. */ -int ssi_fips_ext_get_error(ssi_fips_error_t *p_err) +int ssi_fips_ext_get_error(enum cc_fips_error *p_err) { int rc = 0; @@ -85,7 +85,7 @@ int ssi_fips_ext_set_state(ssi_fips_state_t state) * the error value is stored. * The reference code uses global variable. */ -int ssi_fips_ext_set_error(ssi_fips_error_t err) +int ssi_fips_ext_set_error(enum cc_fips_error err) { fips_error = err; return 0; diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index 4a11f15b18af..cbb0fe26722c 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -271,7 +271,7 @@ static const FipsGcmData FipsGcmDataTable[] = { #define FIPS_GCM_NUM_OF_TESTS (sizeof(FipsGcmDataTable) / sizeof(FipsGcmData)) -static inline ssi_fips_error_t +static inline enum cc_fips_error FIPS_CipherToFipsError(enum drv_cipher_mode mode, bool is_aes) { switch (mode) @@ -415,10 +415,10 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, } -ssi_fips_error_t +enum cc_fips_error ssi_cipher_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer) { - ssi_fips_error_t error = CC_REE_FIPS_ERROR_OK; + enum cc_fips_error error = CC_REE_FIPS_ERROR_OK; size_t i; struct fips_cipher_ctx *virt_ctx = (struct fips_cipher_ctx *)cpu_addr_buffer; @@ -544,10 +544,10 @@ ssi_cmac_fips_run_test(struct ssi_drvdata *drvdata, return rc; } -ssi_fips_error_t +enum cc_fips_error ssi_cmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer) { - ssi_fips_error_t error = CC_REE_FIPS_ERROR_OK; + enum cc_fips_error error = CC_REE_FIPS_ERROR_OK; size_t i; struct fips_cmac_ctx *virt_ctx = (struct fips_cmac_ctx *)cpu_addr_buffer; @@ -604,7 +604,7 @@ ssi_cmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, } -static inline ssi_fips_error_t +static inline enum cc_fips_error FIPS_HashToFipsError(enum drv_hash_mode hash_mode) { switch (hash_mode) { @@ -690,10 +690,10 @@ ssi_hash_fips_run_test(struct ssi_drvdata *drvdata, return rc; } -ssi_fips_error_t +enum cc_fips_error ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer) { - ssi_fips_error_t error = CC_REE_FIPS_ERROR_OK; + enum cc_fips_error error = CC_REE_FIPS_ERROR_OK; size_t i; struct fips_hash_ctx *virt_ctx = (struct fips_hash_ctx *)cpu_addr_buffer; @@ -780,7 +780,7 @@ ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, } -static inline ssi_fips_error_t +static inline enum cc_fips_error FIPS_HmacToFipsError(enum drv_hash_mode hash_mode) { switch (hash_mode) { @@ -1006,10 +1006,10 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, return rc; } -ssi_fips_error_t +enum cc_fips_error ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer) { - ssi_fips_error_t error = CC_REE_FIPS_ERROR_OK; + enum cc_fips_error error = CC_REE_FIPS_ERROR_OK; size_t i; struct fips_hmac_ctx *virt_ctx = (struct fips_hmac_ctx *)cpu_addr_buffer; @@ -1248,10 +1248,10 @@ ssi_ccm_fips_run_test(struct ssi_drvdata *drvdata, return rc; } -ssi_fips_error_t +enum cc_fips_error ssi_ccm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer) { - ssi_fips_error_t error = CC_REE_FIPS_ERROR_OK; + enum cc_fips_error error = CC_REE_FIPS_ERROR_OK; size_t i; struct fips_ccm_ctx *virt_ctx = (struct fips_ccm_ctx *)cpu_addr_buffer; @@ -1546,10 +1546,10 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, return rc; } -ssi_fips_error_t +enum cc_fips_error ssi_gcm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer) { - ssi_fips_error_t error = CC_REE_FIPS_ERROR_OK; + enum cc_fips_error error = CC_REE_FIPS_ERROR_OK; size_t i; struct fips_gcm_ctx *virt_ctx = (struct fips_gcm_ctx *)cpu_addr_buffer; diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index 50d7189994e9..dfc871da5efb 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -51,17 +51,17 @@ struct ssi_fips_handle { extern int ssi_fips_get_state(ssi_fips_state_t *p_state); -extern int ssi_fips_get_error(ssi_fips_error_t *p_err); +extern int ssi_fips_get_error(enum cc_fips_error *p_err); extern int ssi_fips_ext_set_state(ssi_fips_state_t state); -extern int ssi_fips_ext_set_error(ssi_fips_error_t err); +extern int ssi_fips_ext_set_error(enum cc_fips_error err); /* FIPS power-up tests */ -extern ssi_fips_error_t ssi_cipher_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); -extern ssi_fips_error_t ssi_cmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); -extern ssi_fips_error_t ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); -extern ssi_fips_error_t ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); -extern ssi_fips_error_t ssi_ccm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); -extern ssi_fips_error_t ssi_gcm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); +extern enum cc_fips_error ssi_cipher_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); +extern enum cc_fips_error ssi_cmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); +extern enum cc_fips_error ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); +extern enum cc_fips_error ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); +extern enum cc_fips_error ssi_ccm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); +extern enum cc_fips_error ssi_gcm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); extern size_t ssi_fips_max_mem_alloc_size(void); @@ -84,7 +84,7 @@ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) * By writing the error state to HOST_GPR0 register. The function is called from * driver entry point so no need to protect by mutex. */ -static void ssi_fips_update_tee_upon_ree_status(struct ssi_drvdata *drvdata, ssi_fips_error_t err) +static void ssi_fips_update_tee_upon_ree_status(struct ssi_drvdata *drvdata, enum cc_fips_error err) { void __iomem *cc_base = drvdata->cc_base; if (err == CC_REE_FIPS_ERROR_OK) @@ -162,9 +162,9 @@ static void fips_dsr(unsigned long devarg) } -ssi_fips_error_t cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) +enum cc_fips_error cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) { - ssi_fips_error_t fips_error = CC_REE_FIPS_ERROR_OK; + enum cc_fips_error fips_error = CC_REE_FIPS_ERROR_OK; void *cpu_addr_buffer = NULL; dma_addr_t dma_handle; size_t alloc_buff_size = ssi_fips_max_mem_alloc_size(); @@ -259,10 +259,10 @@ int ssi_fips_set_state(ssi_fips_state_t state) /* The function sets the REE FIPS error, and pushes the error to TEE library. * * It should be used when any of the KAT tests fails. */ -int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err) +int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, enum cc_fips_error err) { int rc = 0; - ssi_fips_error_t current_err; + enum cc_fips_error current_err; FIPS_LOG("ssi_fips_set_error - fips_error = %d \n", err); @@ -297,7 +297,7 @@ int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err) /* The function called once at driver entry point .*/ int ssi_fips_init(struct ssi_drvdata *p_drvdata) { - ssi_fips_error_t rc = CC_REE_FIPS_ERROR_OK; + enum cc_fips_error rc = CC_REE_FIPS_ERROR_OK; struct ssi_fips_handle *fips_h; FIPS_DBG("CC FIPS code .. (fips=%d) \n", ssi_fips_support); diff --git a/drivers/staging/ccree/ssi_fips_local.h b/drivers/staging/ccree/ssi_fips_local.h index fa0908434602..0fbb1e0cea31 100644 --- a/drivers/staging/ccree/ssi_fips_local.h +++ b/drivers/staging/ccree/ssi_fips_local.h @@ -53,7 +53,7 @@ typedef enum CC_FipsSyncStatus { int ssi_fips_init(struct ssi_drvdata *p_drvdata); void ssi_fips_fini(struct ssi_drvdata *drvdata); int ssi_fips_check_fips_error(void); -int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err); +int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, enum cc_fips_error err); void fips_handler(struct ssi_drvdata *drvdata); #else /* CONFIG_CC7XXREE_FIPS_SUPPORT */ -- cgit v1.2.3-55-g7522 From dff5e61e90476ee85a544daf9ba71dbd9404620d Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:23 +0300 Subject: staging: ccree: remove custom type ssi_fips_state_t Replace custom type ssi_fips_state_t with underlying enum. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips.c | 4 ++-- drivers/staging/ccree/ssi_fips.h | 6 +++--- drivers/staging/ccree/ssi_fips_ext.c | 6 +++--- drivers/staging/ccree/ssi_fips_local.c | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index 948ea4996ef0..d34d9eff78a2 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -23,14 +23,14 @@ #include "ssi_fips.h" -extern int ssi_fips_ext_get_state(ssi_fips_state_t *p_state); +extern int ssi_fips_ext_get_state(enum cc_fips_state_t *p_state); extern int ssi_fips_ext_get_error(enum cc_fips_error *p_err); /* * This function returns the REE FIPS state. * It should be called by kernel module. */ -int ssi_fips_get_state(ssi_fips_state_t *p_state) +int ssi_fips_get_state(enum cc_fips_state_t *p_state) { int rc = 0; diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h index d1cd489eb465..ce5fa45d7ffa 100644 --- a/drivers/staging/ccree/ssi_fips.h +++ b/drivers/staging/ccree/ssi_fips.h @@ -22,12 +22,12 @@ * @brief This file contains FIPS related defintions and APIs. */ -typedef enum ssi_fips_state { +enum cc_fips_state { CC_FIPS_STATE_NOT_SUPPORTED = 0, CC_FIPS_STATE_SUPPORTED, CC_FIPS_STATE_ERROR, CC_FIPS_STATE_RESERVE32B = S32_MAX -} ssi_fips_state_t; +}; enum cc_fips_error { @@ -57,7 +57,7 @@ enum cc_fips_error { -int ssi_fips_get_state(ssi_fips_state_t *p_state); +int ssi_fips_get_state(enum cc_fips_state *p_state); int ssi_fips_get_error(enum cc_fips_error *p_err); #endif /*__SSI_FIPS_H__*/ diff --git a/drivers/staging/ccree/ssi_fips_ext.c b/drivers/staging/ccree/ssi_fips_ext.c index aab2805d63ac..295aeb60c16b 100644 --- a/drivers/staging/ccree/ssi_fips_ext.c +++ b/drivers/staging/ccree/ssi_fips_ext.c @@ -28,7 +28,7 @@ static bool tee_error; module_param(tee_error, bool, 0644); MODULE_PARM_DESC(tee_error, "Simulate TEE library failure flag: 0 - no error (default), 1 - TEE error occured "); -static ssi_fips_state_t fips_state = CC_FIPS_STATE_NOT_SUPPORTED; +static enum cc_fips_state_t fips_state = CC_FIPS_STATE_NOT_SUPPORTED; static enum cc_fips_error fips_error = CC_REE_FIPS_ERROR_OK; /* @@ -37,7 +37,7 @@ static enum cc_fips_error fips_error = CC_REE_FIPS_ERROR_OK; * the state value is stored. * The reference code uses global variable. */ -int ssi_fips_ext_get_state(ssi_fips_state_t *p_state) +int ssi_fips_ext_get_state(enum cc_fips_state_t *p_state) { int rc = 0; @@ -73,7 +73,7 @@ int ssi_fips_ext_get_error(enum cc_fips_error *p_err) * the state value is stored. * The reference code uses global variable. */ -int ssi_fips_ext_set_state(ssi_fips_state_t state) +int ssi_fips_ext_set_state(enum cc_fips_state_t state) { fips_state = state; return 0; diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index dfc871da5efb..9b84876b47aa 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -50,9 +50,9 @@ struct ssi_fips_handle { }; -extern int ssi_fips_get_state(ssi_fips_state_t *p_state); +extern int ssi_fips_get_state(enum cc_fips_state_t *p_state); extern int ssi_fips_get_error(enum cc_fips_error *p_err); -extern int ssi_fips_ext_set_state(ssi_fips_state_t state); +extern int ssi_fips_ext_set_state(enum cc_fips_state_t state); extern int ssi_fips_ext_set_error(enum cc_fips_error err); /* FIPS power-up tests */ @@ -234,7 +234,7 @@ enum cc_fips_error cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) */ int ssi_fips_check_fips_error(void) { - ssi_fips_state_t fips_state; + enum cc_fips_state_t fips_state; if (ssi_fips_get_state(&fips_state) != 0) { FIPS_LOG("ssi_fips_get_state FAILED, returning.. \n"); @@ -251,7 +251,7 @@ int ssi_fips_check_fips_error(void) /* The function sets the REE FIPS state.* * It should be used while driver is being loaded. */ -int ssi_fips_set_state(ssi_fips_state_t state) +int ssi_fips_set_state(enum cc_fips_state_t state) { return ssi_fips_ext_set_state(state); } -- cgit v1.2.3-55-g7522 From e8e5110e6be0889abd0913dc00d8731e3c0f7742 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:24 +0300 Subject: staging: ccree: remove unused type CCFipsSyncStatus_t The CCFipsSyncStatus_t type was not being used in the code. Remove it. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_fips_local.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_fips_local.h b/drivers/staging/ccree/ssi_fips_local.h index 0fbb1e0cea31..4bc7f37a6e6b 100644 --- a/drivers/staging/ccree/ssi_fips_local.h +++ b/drivers/staging/ccree/ssi_fips_local.h @@ -23,16 +23,6 @@ #include "ssi_fips.h" struct ssi_drvdata; -// IG - how to make 1 file for TEE and REE -typedef enum CC_FipsSyncStatus { - CC_FIPS_SYNC_MODULE_OK = 0x0, - CC_FIPS_SYNC_MODULE_ERROR = 0x1, - CC_FIPS_SYNC_REE_STATUS = 0x4, - CC_FIPS_SYNC_TEE_STATUS = 0x8, - CC_FIPS_SYNC_STATUS_RESERVE32B = S32_MAX -} CCFipsSyncStatus_t; - - #define CHECK_AND_RETURN_UPON_FIPS_ERROR() {\ if (ssi_fips_check_fips_error() != 0) {\ return -ENOEXEC;\ -- cgit v1.2.3-55-g7522 From 492ddcbb2103ea28217e5fea1a5c769254934c46 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:25 +0300 Subject: staging: ccree: remove/add (un)needed blank lines Remove or add blank lines as needed to match coding style. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_aead.c | 20 +++++-------------- drivers/staging/ccree/ssi_aead.h | 4 ---- drivers/staging/ccree/ssi_buffer_mgr.c | 7 ++++--- drivers/staging/ccree/ssi_buffer_mgr.h | 1 - drivers/staging/ccree/ssi_cipher.c | 17 +++------------- drivers/staging/ccree/ssi_cipher.h | 6 ------ drivers/staging/ccree/ssi_driver.c | 4 +--- drivers/staging/ccree/ssi_fips.c | 2 -- drivers/staging/ccree/ssi_fips.h | 3 --- drivers/staging/ccree/ssi_fips_data.h | 8 -------- drivers/staging/ccree/ssi_fips_ext.c | 2 -- drivers/staging/ccree/ssi_fips_ll.c | 35 +++++++++------------------------ drivers/staging/ccree/ssi_fips_local.c | 14 +------------ drivers/staging/ccree/ssi_fips_local.h | 4 ++-- drivers/staging/ccree/ssi_hash.c | 12 ++++------- drivers/staging/ccree/ssi_ivgen.c | 1 - drivers/staging/ccree/ssi_ivgen.h | 1 - drivers/staging/ccree/ssi_pm.c | 5 ----- drivers/staging/ccree/ssi_pm.h | 3 --- drivers/staging/ccree/ssi_request_mgr.c | 9 +++------ drivers/staging/ccree/ssi_sram_mgr.c | 2 -- drivers/staging/ccree/ssi_sram_mgr.h | 1 - drivers/staging/ccree/ssi_sysfs.c | 4 ---- drivers/staging/ccree/ssi_sysfs.h | 1 + 24 files changed, 33 insertions(+), 133 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 53105ddb7012..1fc0b05ea0d5 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -49,7 +49,6 @@ #define AES_CCM_RFC4309_NONCE_SIZE 3 #define MAX_NONCE_SIZE CTR_RFC3686_NONCE_SIZE - /* Value of each ICV_CMP byte (of 8) in case of success */ #define ICV_VERIF_OK 0x01 @@ -209,7 +208,6 @@ init_failed: return -ENOMEM; } - static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *cc_base) { struct aead_request *areq = (struct aead_request *)ssi_req; @@ -402,6 +400,7 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx) return 0; /* All tests of keys sizes passed */ } + /* This function prepers the user key so it can pass to the hmac processing * (copy to intenral buffer or hash in case of key longer than block */ @@ -526,7 +525,6 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl return rc; } - static int ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { @@ -594,7 +592,6 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) goto badkey; } - /* STAT_PHASE_2: Create sequence */ switch (ctx->auth_mode) { @@ -613,7 +610,6 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) goto badkey; } - /* STAT_PHASE_3: Submit sequence to HW */ if (seq_len > 0) { /* For CCM there is no sequence to setup the key */ @@ -1372,6 +1368,7 @@ data_size_err: static unsigned int format_ccm_a0(u8 *pA0Buff, u32 headerSize) { unsigned int len = 0; + if (headerSize == 0) return 0; @@ -1424,7 +1421,6 @@ static inline int ssi_aead_ccm( unsigned int cipher_flow_mode; dma_addr_t mac_result; - if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) { cipher_flow_mode = AES_to_HASH_and_DOUT; mac_result = req_ctx->mac_buf_dma_addr; @@ -1481,7 +1477,6 @@ static inline int ssi_aead_ccm( set_aes_not_hash_mode(&desc[idx]); idx++; - /* process assoc data */ if (req->assoclen > 0) { ssi_aead_create_assoc_desc(req, DIN_HASH, desc, &idx); @@ -1556,6 +1551,7 @@ static int config_ccm_adata(struct aead_request *req) req->cryptlen : (req->cryptlen - ctx->authsize); int rc; + memset(req_ctx->mac_buf, 0, AES_BLOCK_SIZE); memset(req_ctx->ccm_config, 0, AES_BLOCK_SIZE * 3); @@ -1808,7 +1804,6 @@ static inline int ssi_aead_gcm( cipher_flow_mode = AES_to_HASH_and_DOUT; } - //in RFC4543 no data to encrypt. just copy data from src to dest. if (req_ctx->plaintext_authenticate_only) { ssi_aead_process_cipher_data_desc(req, BYPASS, desc, seq_size); @@ -1904,15 +1899,16 @@ static int config_gcm_context(struct aead_request *req) memcpy(req->iv + 12, &counter, 4); memcpy(req_ctx->gcm_iv_inc1, req->iv, 16); - if (!req_ctx->plaintext_authenticate_only) { __be64 temp64; + temp64 = cpu_to_be64(req->assoclen * 8); memcpy(&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); temp64 = cpu_to_be64(cryptlen * 8); memcpy(&req_ctx->gcm_len_block.lenC, &temp64, 8); } else { //rfc4543=> all data(AAD,IV,Plain) are considered additional data that is nothing is encrypted. __be64 temp64; + temp64 = cpu_to_be64((req->assoclen + GCM_BLOCK_RFC4_IV_SIZE + cryptlen) * 8); memcpy(&req_ctx->gcm_len_block.lenA, &temp64, sizeof(temp64)); temp64 = 0; @@ -1934,7 +1930,6 @@ static void ssi_rfc4_gcm_process(struct aead_request *req) req->assoclen -= GCM_BLOCK_RFC4_IV_SIZE; } - #endif /*SSI_CC_HAS_AES_GCM*/ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction direct) @@ -1948,7 +1943,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction struct device *dev = &ctx->drvdata->plat_dev->dev; struct ssi_crypto_req ssi_req = {}; - SSI_LOG_DEBUG("%s context=%p req=%p iv=%p src=%p src_ofs=%d dst=%p dst_ofs=%d cryptolen=%d\n", ((direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? "Encrypt" : "Decrypt"), ctx, req, req->iv, sg_virt(req->src), req->src->offset, sg_virt(req->dst), req->dst->offset, req->cryptlen); @@ -1973,7 +1967,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction areq_ctx->req_authsize = ctx->authsize; areq_ctx->cipher_mode = ctx->cipher_mode; - /* STAT_PHASE_1: Map buffers */ if (ctx->cipher_mode == DRV_CIPHER_CTR) { @@ -2057,7 +2050,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction ssi_req.ivgen_size = crypto_aead_ivsize(tfm); } - /* STAT_PHASE_2: Create sequence */ /* Load MLLI tables to SRAM if necessary */ @@ -2091,7 +2083,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction goto exit; } - /* STAT_PHASE_3: Lock HW and push sequence */ rc = send_request(ctx->drvdata, &ssi_req, desc, seq_len, 1); @@ -2101,7 +2092,6 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction ssi_buffer_mgr_unmap_aead_request(dev, req); } - exit: return rc; } diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index d69e72909209..39cc633a3ffa 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -25,13 +25,11 @@ #include #include - /* mac_cmp - HW writes 8 B but all bytes hold the same value */ #define ICV_CMP_SIZE 8 #define CCM_CONFIG_BUF_SIZE (AES_BLOCK_SIZE * 3) #define MAX_MAC_SIZE MAX(SHA256_DIGEST_SIZE, AES_BLOCK_SIZE) - /* defines for AES GCM configuration buffer */ #define GCM_BLOCK_LEN_SIZE 8 @@ -40,8 +38,6 @@ #define GCM_BLOCK_RFC4_NONCE_OFFSET 0 #define GCM_BLOCK_RFC4_NONCE_SIZE 4 - - /* Offsets into AES CCM configuration buffer */ #define CCM_B0_OFFSET 0 #define CCM_A0_OFFSET 16 diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 1b41c12780fc..b35871eeabd1 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -42,7 +42,6 @@ #define GET_DMA_BUFFER_TYPE(buff_type) #endif - enum dma_buffer_type { DMA_NULL_TYPE = -1, DMA_SGL_TYPE = 1, @@ -80,6 +79,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( struct scatterlist *sg_list, unsigned int nbytes, u32 *lbytes, bool *is_chained) { unsigned int nents = 0; + while (nbytes != 0) { if (sg_is_chain(sg_list)) { SSI_LOG_ERR("Unexpected chained entry " @@ -181,7 +181,6 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( return 0; } - static inline int ssi_buffer_mgr_render_scatterlist_to_mlli( struct scatterlist *sgl, u32 sgl_data_len, u32 sglOffset, u32 *curr_nents, u32 **mlli_entry_pp) @@ -322,6 +321,7 @@ ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, u32 nents, { u32 i, j; struct scatterlist *l_sg = sg; + for (i = 0; i < nents; i++) { if (!l_sg) break; @@ -441,7 +441,6 @@ ssi_aead_handle_config_buf(struct device *dev, return 0; } - static inline int ssi_ahash_handle_curr_buf(struct device *dev, struct ahash_req_ctx *areq_ctx, u8 *curr_buff, @@ -700,6 +699,7 @@ void ssi_buffer_mgr_unmap_aead_request( likely(req->src == req->dst)) { u32 size_to_skip = req->assoclen; + if (areq_ctx->is_gcm4543) size_to_skip += crypto_aead_ivsize(tfm); @@ -1027,6 +1027,7 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( * MAC verification upon request completion */ u32 size_to_skip = req->assoclen; + if (areq_ctx->is_gcm4543) size_to_skip += crypto_aead_ivsize(tfm); diff --git a/drivers/staging/ccree/ssi_buffer_mgr.h b/drivers/staging/ccree/ssi_buffer_mgr.h index bb5f8dc1adf4..41f5223730f8 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.h +++ b/drivers/staging/ccree/ssi_buffer_mgr.h @@ -26,7 +26,6 @@ #include "ssi_config.h" #include "ssi_driver.h" - enum ssi_req_dma_buf_type { SSI_DMA_BUF_NULL = 0, SSI_DMA_BUF_DLLI, diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index eb3e8e63431a..cd2eafc04232 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -47,6 +47,7 @@ struct cc_user_key_info { u8 *key; dma_addr_t key_dma_addr; }; + struct cc_hw_key_info { enum cc_hw_crypto_key key1_slot; enum cc_hw_crypto_key key2_slot; @@ -67,7 +68,6 @@ struct ssi_ablkcipher_ctx { static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __iomem *cc_base); - static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { switch (ctx_p->flow_mode) { case S_DIN_to_AES: @@ -108,7 +108,6 @@ static int validate_keys_sizes(struct ssi_ablkcipher_ctx *ctx_p, u32 size) { return -EINVAL; } - static int validate_data_size(struct ssi_ablkcipher_ctx *ctx_p, unsigned int size) { switch (ctx_p->flow_mode) { case S_DIN_to_AES: @@ -252,7 +251,6 @@ static void ssi_blkcipher_exit(struct crypto_tfm *tfm) SSI_LOG_DEBUG("Free key buffer in context. key=@%p\n", ctx_p->user.key); } - struct tdes_keys { u8 key1[DES_KEY_SIZE]; u8 key2[DES_KEY_SIZE]; @@ -396,8 +394,6 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, return -EINVAL; } - - /* STAT_PHASE_1: Copy key to ctx */ dma_sync_single_for_cpu(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); @@ -422,6 +418,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, int key_len = keylen >> 1; int err; SHASH_DESC_ON_STACK(desc, ctx_p->shash_tfm); + desc->tfm = ctx_p->shash_tfm; err = crypto_shash_digest(desc, ctx_p->user.key, key_len, ctx_p->user.key + key_len); @@ -435,7 +432,6 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, max_key_buf_size, DMA_TO_DEVICE); ctx_p->keylen = keylen; - SSI_LOG_DEBUG("ssi_blkcipher_setkey: return safely"); return 0; } @@ -598,7 +594,6 @@ static inline void ssi_blkcipher_create_multi2_setup_desc( set_setup_mode(&desc[*seq_size], SETUP_LOAD_STATE0); (*seq_size)++; - /* Set state */ hw_desc_init(&desc[*seq_size]); set_din_type(&desc[*seq_size], DMA_DLLI, req_ctx->gen_ctx.iv_dma_addr, @@ -724,7 +719,6 @@ static int ssi_blkcipher_complete(struct device *dev, ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - /*Set the inflight couter value to local variable*/ inflight_counter = ctx_p->drvdata->inflight_counter; /*Decrease the inflight counter*/ @@ -790,7 +784,6 @@ static int ssi_blkcipher_process( /* Setup request context */ req_ctx->gen_ctx.op_type = direction; - /* STAT_PHASE_1: Map buffers */ rc = ssi_buffer_mgr_map_blkcipher_request(ctx_p->drvdata, req_ctx, ivsize, nbytes, info, src, dst); @@ -799,7 +792,6 @@ static int ssi_blkcipher_process( goto exit_process; } - /* STAT_PHASE_2: Create sequence */ /* Setup processing */ @@ -878,7 +870,6 @@ static int ssi_ablkcipher_init(struct crypto_tfm *tfm) return ssi_blkcipher_init(tfm); } - static int ssi_ablkcipher_setkey(struct crypto_ablkcipher *tfm, const u8 *key, unsigned int keylen) @@ -911,7 +902,6 @@ static int ssi_ablkcipher_decrypt(struct ablkcipher_request *req) return ssi_blkcipher_process(tfm, req_ctx, req->dst, req->src, req->nbytes, req->info, ivsize, (void *)req, DRV_CRYPTO_DIRECTION_DECRYPT); } - /* DX Block cipher alg */ static struct ssi_alg_template blkcipher_algs[] = { /* Async template */ @@ -1290,6 +1280,7 @@ int ssi_ablkcipher_free(struct ssi_drvdata *drvdata) struct ssi_blkcipher_handle *blkcipher_handle = drvdata->blkcipher_handle; struct device *dev; + dev = &drvdata->plat_dev->dev; if (blkcipher_handle) { @@ -1307,8 +1298,6 @@ int ssi_ablkcipher_free(struct ssi_drvdata *drvdata) return 0; } - - int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata) { struct ssi_blkcipher_handle *ablkcipher_handle; diff --git a/drivers/staging/ccree/ssi_cipher.h b/drivers/staging/ccree/ssi_cipher.h index 22d7b431edb9..296b375d5d89 100644 --- a/drivers/staging/ccree/ssi_cipher.h +++ b/drivers/staging/ccree/ssi_cipher.h @@ -26,7 +26,6 @@ #include "ssi_driver.h" #include "ssi_buffer_mgr.h" - /* Crypto cipher flags */ #define CC_CRYPTO_CIPHER_KEY_KFDE0 (1 << 0) #define CC_CRYPTO_CIPHER_KEY_KFDE1 (1 << 1) @@ -36,7 +35,6 @@ #define CC_CRYPTO_CIPHER_KEY_KFDE_MASK (CC_CRYPTO_CIPHER_KEY_KFDE0 | CC_CRYPTO_CIPHER_KEY_KFDE1 | CC_CRYPTO_CIPHER_KEY_KFDE2 | CC_CRYPTO_CIPHER_KEY_KFDE3) - struct blkcipher_req_ctx { struct async_gen_req_ctx gen_ctx; enum ssi_req_dma_buf_type dma_buf_type; @@ -49,8 +47,6 @@ struct blkcipher_req_ctx { struct mlli_params mlli_params; }; - - int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata); int ssi_ablkcipher_free(struct ssi_drvdata *drvdata); @@ -63,7 +59,6 @@ int ssi_ablkcipher_free(struct ssi_drvdata *drvdata); CRYPTO_ALG_BULK_DU_4096) #endif /* CRYPTO_ALG_BULK_MASK */ - #ifdef CRYPTO_TFM_REQ_HW_KEY static inline bool ssi_is_hw_key(struct crypto_tfm *tfm) @@ -85,5 +80,4 @@ static inline bool ssi_is_hw_key(struct crypto_tfm *tfm) #endif /* CRYPTO_TFM_REQ_HW_KEY */ - #endif /*__SSI_CIPHER_H__*/ diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 5c1d295b5b7c..78709b92736d 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -73,7 +73,6 @@ #include "ssi_pm.h" #include "ssi_fips_local.h" - #ifdef DX_DUMP_BYTES void dump_byte_array(const char *name, const u8 *the_array, unsigned long size) { @@ -274,7 +273,6 @@ static int init_cc_resources(struct platform_device *plat_dev) SSI_LOG_DEBUG("CC registers mapped from %pa to 0x%p\n", &new_drvdata->res_mem->start, cc_base); new_drvdata->cc_base = cc_base; - /* Then IRQ */ new_drvdata->res_irq = platform_get_resource(plat_dev, IORESOURCE_IRQ, 0); if (unlikely(!new_drvdata->res_irq)) { @@ -546,6 +544,7 @@ static int cc7x_remove(struct platform_device *plat_dev) return 0; } + #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) static struct dev_pm_ops arm_cc7x_driver_pm = { SET_RUNTIME_PM_OPS(ssi_power_mgr_runtime_suspend, ssi_power_mgr_runtime_resume, NULL) @@ -558,7 +557,6 @@ static struct dev_pm_ops arm_cc7x_driver_pm = { #define DX_DRIVER_RUNTIME_PM NULL #endif - #ifdef CONFIG_OF static const struct of_device_id arm_cc7x_dev_of_match[] = { {.compatible = "arm,cryptocell-712-ree"}, diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index d34d9eff78a2..fdc40f38332a 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -14,7 +14,6 @@ * along with this program; if not, see . */ - /************************************************************** * This file defines the driver FIPS APIs * **************************************************************/ @@ -22,7 +21,6 @@ #include #include "ssi_fips.h" - extern int ssi_fips_ext_get_state(enum cc_fips_state_t *p_state); extern int ssi_fips_ext_get_error(enum cc_fips_error *p_err); diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h index ce5fa45d7ffa..4f5c6a9a8363 100644 --- a/drivers/staging/ccree/ssi_fips.h +++ b/drivers/staging/ccree/ssi_fips.h @@ -29,7 +29,6 @@ enum cc_fips_state { CC_FIPS_STATE_RESERVE32B = S32_MAX }; - enum cc_fips_error { CC_REE_FIPS_ERROR_OK = 0, CC_REE_FIPS_ERROR_GENERAL, @@ -55,8 +54,6 @@ enum cc_fips_error { CC_REE_FIPS_ERROR_RESERVE32B = S32_MAX }; - - int ssi_fips_get_state(enum cc_fips_state *p_state); int ssi_fips_get_error(enum cc_fips_error *p_err); diff --git a/drivers/staging/ccree/ssi_fips_data.h b/drivers/staging/ccree/ssi_fips_data.h index 27b2866b4cd9..c41671dbee40 100644 --- a/drivers/staging/ccree/ssi_fips_data.h +++ b/drivers/staging/ccree/ssi_fips_data.h @@ -98,14 +98,12 @@ #define NIST_AES_192_CTR_CIPHER { 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b } #define NIST_AES_256_CTR_CIPHER { 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28 } - #define RFC3962_AES_128_KEY { 0x63, 0x68, 0x69, 0x63, 0x6b, 0x65, 0x6e, 0x20, 0x74, 0x65, 0x72, 0x69, 0x79, 0x61, 0x6b, 0x69 } #define RFC3962_AES_VECTOR_SIZE 17 #define RFC3962_AES_PLAIN_DATA { 0x49, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20 } #define RFC3962_AES_CBC_CTS_IV { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } #define RFC3962_AES_128_CBC_CTS_CIPHER { 0xc6, 0x35, 0x35, 0x68, 0xf2, 0xbf, 0x8c, 0xb4, 0xd8, 0xa5, 0x80, 0x36, 0x2d, 0xa7, 0xff, 0x7f, 0x97 } - #define NIST_AES_256_XTS_KEY { 0xa1, 0xb9, 0x0c, 0xba, 0x3f, 0x06, 0xac, 0x35, 0x3b, 0x2c, 0x34, 0x38, 0x76, 0x08, 0x17, 0x62, \ 0x09, 0x09, 0x23, 0x02, 0x6e, 0x91, 0x77, 0x18, 0x15, 0xf2, 0x9d, 0xab, 0x01, 0x93, 0x2f, 0x2f } #define NIST_AES_256_XTS_IV { 0x4f, 0xae, 0xf7, 0x11, 0x7c, 0xda, 0x59, 0xc6, 0x6e, 0x4b, 0x92, 0x01, 0x3e, 0x76, 0x8a, 0xd5 } @@ -124,7 +122,6 @@ #define NIST_AES_512_XTS_CIPHER { 0xcb, 0xaa, 0xd0, 0xe2, 0xf6, 0xce, 0xa3, 0xf5, 0x0b, 0x37, 0xf9, 0x34, 0xd4, 0x6a, 0x9b, 0x13, \ 0x0b, 0x9d, 0x54, 0xf0, 0x7e, 0x34, 0xf3, 0x6a, 0xf7, 0x93, 0xe8, 0x6f, 0x73, 0xc6, 0xd7, 0xdb } - /* NIST AES-CMAC */ #define NIST_AES_128_CMAC_KEY { 0x67, 0x08, 0xc9, 0x88, 0x7b, 0x84, 0x70, 0x84, 0xf1, 0x23, 0xd3, 0xdd, 0x9c, 0x3a, 0x81, 0x36 } #define NIST_AES_128_CMAC_PLAIN_DATA { 0xa8, 0xde, 0x55, 0x17, 0x0c, 0x6d, 0xc0, 0xd8, 0x0d, 0xe3, 0x2f, 0x50, 0x8b, 0xf4, 0x9b, 0x70 } @@ -147,7 +144,6 @@ #define NIST_AES_256_CMAC_VECTOR_SIZE 16 #define NIST_AES_256_CMAC_OUTPUT_SIZE 10 - /* NIST TDES */ #define TDES_NUM_OF_KEYS 3 #define NIST_TDES_VECTOR_SIZE 8 @@ -168,7 +164,6 @@ #define NIST_TDES_CBC3_PLAIN_DATA { 0x3b, 0xb7, 0xa7, 0xdb, 0xa3, 0xd5, 0x92, 0x91 } #define NIST_TDES_CBC3_CIPHER { 0x5b, 0x84, 0x24, 0xd2, 0x39, 0x3e, 0x55, 0xa2 } - /* NIST AES-CCM */ #define NIST_AESCCM_128_BIT_KEY_SIZE 16 #define NIST_AESCCM_192_BIT_KEY_SIZE 24 @@ -207,7 +202,6 @@ #define NIST_AESCCM_256_CIPHER { 0xcc, 0x17, 0xbf, 0x87, 0x94, 0xc8, 0x43, 0x45, 0x7d, 0x89, 0x93, 0x91, 0x89, 0x8e, 0xd2, 0x2a } #define NIST_AESCCM_256_MAC { 0x6f, 0x9d, 0x28, 0xfc, 0xb6, 0x42, 0x34, 0xe1, 0xcd, 0x79, 0x3c, 0x41, 0x44, 0xf1, 0xda, 0x50 } - /* NIST AES-GCM */ #define NIST_AESGCM_128_BIT_KEY_SIZE 16 #define NIST_AESGCM_192_BIT_KEY_SIZE 24 @@ -241,7 +235,6 @@ #define NIST_AESGCM_256_CIPHER { 0x42, 0x6e, 0x0e, 0xfc, 0x69, 0x3b, 0x7b, 0xe1, 0xf3, 0x01, 0x8d, 0xb7, 0xdd, 0xbb, 0x7e, 0x4d } #define NIST_AESGCM_256_MAC { 0xee, 0x82, 0x57, 0x79, 0x5b, 0xe6, 0xa1, 0x16, 0x4d, 0x7e, 0x1d, 0x2d, 0x6c, 0xac, 0x77, 0xa7 } - /* NIST HASH */ #define NIST_SHA_MSG_SIZE 16 @@ -259,7 +252,6 @@ 0x8f, 0x2b, 0xa9, 0x1c, 0x3a, 0x9f, 0x0c, 0x16, 0x53, 0xc4, 0xbf, 0x0a, 0xda, 0x35, 0x64, 0x55, \ 0xea, 0x36, 0xfd, 0x31, 0xf8, 0xe7, 0x3e, 0x39, 0x51, 0xca, 0xd4, 0xeb, 0xba, 0x8c, 0x6e, 0x04 } - /* NIST HMAC */ #define NIST_HMAC_MSG_SIZE 128 diff --git a/drivers/staging/ccree/ssi_fips_ext.c b/drivers/staging/ccree/ssi_fips_ext.c index 295aeb60c16b..e7bf1843f60c 100644 --- a/drivers/staging/ccree/ssi_fips_ext.c +++ b/drivers/staging/ccree/ssi_fips_ext.c @@ -23,7 +23,6 @@ #include "ssi_fips_local.h" #include "ssi_driver.h" - static bool tee_error; module_param(tee_error, bool, 0644); MODULE_PARM_DESC(tee_error, "Simulate TEE library failure flag: 0 - no error (default), 1 - TEE error occured "); @@ -91,4 +90,3 @@ int ssi_fips_ext_set_error(enum cc_fips_error err) return 0; } - diff --git a/drivers/staging/ccree/ssi_fips_ll.c b/drivers/staging/ccree/ssi_fips_ll.c index cbb0fe26722c..3557e20c9e36 100644 --- a/drivers/staging/ccree/ssi_fips_ll.c +++ b/drivers/staging/ccree/ssi_fips_ll.c @@ -27,7 +27,6 @@ #include "ssi_hash.h" #include "ssi_request_mgr.h" - static const u32 digest_len_init[] = { 0x00000040, 0x00000000, 0x00000000, 0x00000000 }; static const u32 sha1_init[] = { @@ -43,7 +42,6 @@ static const u64 sha512_init[] = { SHA512_H3, SHA512_H2, SHA512_H1, SHA512_H0 }; #endif - #define NIST_CIPHER_AES_MAX_VECTOR_SIZE 32 struct fips_cipher_ctx { @@ -65,7 +63,6 @@ typedef struct _FipsCipherData { size_t dataInSize; } FipsCipherData; - struct fips_cmac_ctx { u8 key[AES_256_BIT_KEY_SIZE]; u8 din[NIST_CIPHER_AES_MAX_VECTOR_SIZE]; @@ -82,7 +79,6 @@ typedef struct _FipsCmacData { size_t mac_res_size; } FipsCmacData; - struct fips_hash_ctx { u8 initial_digest[CC_DIGEST_SIZE_MAX]; u8 din[NIST_SHA_MSG_SIZE]; @@ -96,7 +92,6 @@ typedef struct _FipsHashData { u8 mac_res[CC_DIGEST_SIZE_MAX]; } FipsHashData; - /* note that the hmac key length must be equal or less than block size (block size is 64 up to sha256 and 128 for sha384/512) */ struct fips_hmac_ctx { u8 initial_digest[CC_DIGEST_SIZE_MAX]; @@ -117,7 +112,6 @@ typedef struct _FipsHmacData { u8 mac_res[CC_DIGEST_SIZE_MAX]; } FipsHmacData; - #define FIPS_CCM_B0_A0_ADATA_SIZE (NIST_AESCCM_IV_SIZE + NIST_AESCCM_IV_SIZE + NIST_AESCCM_ADATA_SIZE) struct fips_ccm_ctx { @@ -144,7 +138,6 @@ typedef struct _FipsCcmData { u8 macResOut[NIST_AESCCM_TAG_SIZE]; } FipsCcmData; - struct fips_gcm_ctx { u8 adata[NIST_AESGCM_ADATA_SIZE]; u8 key[CC_AES_KEY_SIZE_MAX]; @@ -171,7 +164,6 @@ typedef struct _FipsGcmData { u8 macResOut[NIST_AESGCM_TAG_SIZE]; } FipsGcmData; - typedef union _fips_ctx { struct fips_cipher_ctx cipher; struct fips_cmac_ctx cmac; @@ -181,7 +173,6 @@ typedef union _fips_ctx { struct fips_gcm_ctx gcm; } fips_ctx; - /* test data tables */ static const FipsCipherData FipsCipherDataTable[] = { /* AES */ @@ -223,6 +214,7 @@ static const FipsCipherData FipsCipherDataTable[] = { { 0, NIST_TDES_CBC3_KEY, CC_DRV_DES_TRIPLE_KEY_SIZE, NIST_TDES_CBC3_IV, DRV_CRYPTO_DIRECTION_ENCRYPT, DRV_CIPHER_CBC, NIST_TDES_CBC3_PLAIN_DATA, NIST_TDES_CBC3_CIPHER, NIST_TDES_VECTOR_SIZE }, { 0, NIST_TDES_CBC3_KEY, CC_DRV_DES_TRIPLE_KEY_SIZE, NIST_TDES_CBC3_IV, DRV_CRYPTO_DIRECTION_DECRYPT, DRV_CIPHER_CBC, NIST_TDES_CBC3_CIPHER, NIST_TDES_CBC3_PLAIN_DATA, NIST_TDES_VECTOR_SIZE }, }; + #define FIPS_CIPHER_NUM_OF_TESTS (sizeof(FipsCipherDataTable) / sizeof(FipsCipherData)) static const FipsCmacData FipsCmacDataTable[] = { @@ -230,6 +222,7 @@ static const FipsCmacData FipsCmacDataTable[] = { { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AES_192_CMAC_KEY, AES_192_BIT_KEY_SIZE, NIST_AES_192_CMAC_PLAIN_DATA, NIST_AES_192_CMAC_VECTOR_SIZE, NIST_AES_192_CMAC_MAC, NIST_AES_192_CMAC_OUTPUT_SIZE }, { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AES_256_CMAC_KEY, AES_256_BIT_KEY_SIZE, NIST_AES_256_CMAC_PLAIN_DATA, NIST_AES_256_CMAC_VECTOR_SIZE, NIST_AES_256_CMAC_MAC, NIST_AES_256_CMAC_OUTPUT_SIZE }, }; + #define FIPS_CMAC_NUM_OF_TESTS (sizeof(FipsCmacDataTable) / sizeof(FipsCmacData)) static const FipsHashData FipsHashDataTable[] = { @@ -239,6 +232,7 @@ static const FipsHashData FipsHashDataTable[] = { // { DRV_HASH_SHA512, NIST_SHA_512_MSG, NIST_SHA_MSG_SIZE, NIST_SHA_512_MD }, #endif }; + #define FIPS_HASH_NUM_OF_TESTS (sizeof(FipsHashDataTable) / sizeof(FipsHashData)) static const FipsHmacData FipsHmacDataTable[] = { @@ -248,6 +242,7 @@ static const FipsHmacData FipsHmacDataTable[] = { // { DRV_HASH_SHA512, NIST_HMAC_SHA512_KEY, NIST_HMAC_SHA512_KEY_SIZE, NIST_HMAC_SHA512_MSG, NIST_HMAC_MSG_SIZE, NIST_HMAC_SHA512_MD }, #endif }; + #define FIPS_HMAC_NUM_OF_TESTS (sizeof(FipsHmacDataTable) / sizeof(FipsHmacData)) static const FipsCcmData FipsCcmDataTable[] = { @@ -258,6 +253,7 @@ static const FipsCcmData FipsCcmDataTable[] = { { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESCCM_256_KEY, NIST_AESCCM_256_BIT_KEY_SIZE, NIST_AESCCM_256_NONCE, NIST_AESCCM_256_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_256_PLAIN_TEXT, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_256_CIPHER, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_256_MAC }, { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESCCM_256_KEY, NIST_AESCCM_256_BIT_KEY_SIZE, NIST_AESCCM_256_NONCE, NIST_AESCCM_256_ADATA, NIST_AESCCM_ADATA_SIZE, NIST_AESCCM_256_CIPHER, NIST_AESCCM_TEXT_SIZE, NIST_AESCCM_256_PLAIN_TEXT, NIST_AESCCM_TAG_SIZE, NIST_AESCCM_256_MAC }, }; + #define FIPS_CCM_NUM_OF_TESTS (sizeof(FipsCcmDataTable) / sizeof(FipsCcmData)) static const FipsGcmData FipsGcmDataTable[] = { @@ -268,8 +264,8 @@ static const FipsGcmData FipsGcmDataTable[] = { { DRV_CRYPTO_DIRECTION_ENCRYPT, NIST_AESGCM_256_KEY, NIST_AESGCM_256_BIT_KEY_SIZE, NIST_AESGCM_256_IV, NIST_AESGCM_256_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_256_PLAIN_TEXT, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_256_CIPHER, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_256_MAC }, { DRV_CRYPTO_DIRECTION_DECRYPT, NIST_AESGCM_256_KEY, NIST_AESGCM_256_BIT_KEY_SIZE, NIST_AESGCM_256_IV, NIST_AESGCM_256_ADATA, NIST_AESGCM_ADATA_SIZE, NIST_AESGCM_256_CIPHER, NIST_AESGCM_TEXT_SIZE, NIST_AESGCM_256_PLAIN_TEXT, NIST_AESGCM_TAG_SIZE, NIST_AESGCM_256_MAC }, }; -#define FIPS_GCM_NUM_OF_TESTS (sizeof(FipsGcmDataTable) / sizeof(FipsGcmData)) +#define FIPS_GCM_NUM_OF_TESTS (sizeof(FipsGcmDataTable) / sizeof(FipsGcmData)) static inline enum cc_fips_error FIPS_CipherToFipsError(enum drv_cipher_mode mode, bool is_aes) @@ -295,7 +291,6 @@ FIPS_CipherToFipsError(enum drv_cipher_mode mode, bool is_aes) return CC_REE_FIPS_ERROR_GENERAL; } - static inline int ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, bool is_aes, @@ -414,7 +409,6 @@ ssi_cipher_fips_run_test(struct ssi_drvdata *drvdata, return rc; } - enum cc_fips_error ssi_cipher_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer) { @@ -479,7 +473,6 @@ ssi_cipher_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffe return error; } - static inline int ssi_cmac_fips_run_test(struct ssi_drvdata *drvdata, dma_addr_t key_dma_addr, @@ -519,7 +512,6 @@ ssi_cmac_fips_run_test(struct ssi_drvdata *drvdata, set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; - //ssi_hash_create_data_desc(state, ctx, DIN_AES_DOUT, desc, false, &idx); hw_desc_init(&desc[idx]); set_din_type(&desc[idx], DMA_DLLI, din_dma_addr, din_len, NS_BIT); @@ -603,7 +595,6 @@ ssi_cmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, return error; } - static inline enum cc_fips_error FIPS_HashToFipsError(enum drv_hash_mode hash_mode) { @@ -779,7 +770,6 @@ ssi_hash_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, return error; } - static inline enum cc_fips_error FIPS_HmacToFipsError(enum drv_hash_mode hash_mode) { @@ -867,7 +857,6 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; - /* Load the hash current length*/ hw_desc_init(&desc[idx]); set_cipher_mode(&desc[idx], hw_mode); @@ -981,7 +970,6 @@ ssi_hmac_fips_run_test(struct ssi_drvdata *drvdata, set_flow_mode(&desc[idx], DIN_HASH); idx++; - /* Get final MAC result */ hw_desc_init(&desc[idx]); set_cipher_mode(&desc[idx], hw_mode); @@ -1112,7 +1100,6 @@ ssi_hmac_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, return error; } - static inline int ssi_ccm_fips_run_test(struct ssi_drvdata *drvdata, enum drv_crypto_direction direction, @@ -1277,6 +1264,7 @@ ssi_ccm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, { /* build B0 -- B0, nonce, l(m) */ __be16 data = cpu_to_be16(NIST_AESCCM_TEXT_SIZE); + virt_ctx->b0_a0_adata[0] = NIST_AESCCM_B0_VAL; memcpy(virt_ctx->b0_a0_adata + 1, ccmData->nonce, NIST_AESCCM_NONCE_SIZE); memcpy(virt_ctx->b0_a0_adata + 14, (u8 *)&data, sizeof(__be16)); @@ -1340,7 +1328,6 @@ ssi_ccm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, return error; } - static inline int ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, enum drv_crypto_direction direction, @@ -1439,8 +1426,6 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); idx++; - - ///////////////////////////////// 2 //////////////////////////////////// /* prcess(ghash) assoc data */ // if (req->assoclen > 0) @@ -1452,7 +1437,6 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, set_flow_mode(&desc[idx], DIN_HASH); idx++; - ///////////////////////////////// 3 //////////////////////////////////// // ssi_aead_gcm_setup_gctr_desc(req, desc, seq_size); ///////////////////////////////// 3 //////////////////////////////////// @@ -1478,7 +1462,6 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, set_flow_mode(&desc[idx], S_DIN_to_AES); idx++; - ///////////////////////////////// 4 //////////////////////////////////// /* process(gctr+ghash) */ // if (req_ctx->cryptlen != 0) @@ -1491,7 +1474,6 @@ ssi_gcm_fips_run_test(struct ssi_drvdata *drvdata, set_flow_mode(&desc[idx], cipher_flow_mode); idx++; - ///////////////////////////////// 5 //////////////////////////////////// // ssi_aead_process_gcm_result_desc(req, desc, seq_size); ///////////////////////////////// 5 //////////////////////////////////// @@ -1579,6 +1561,7 @@ ssi_gcm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, /* len_block */ { __be64 len_bits; + len_bits = cpu_to_be64(gcmData->adataSize * 8); memcpy(virt_ctx->len_block, &len_bits, sizeof(len_bits)); len_bits = cpu_to_be64(gcmData->dataInSize * 8); @@ -1587,6 +1570,7 @@ ssi_gcm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, /* iv_inc1, iv_inc2 */ { __be32 counter = cpu_to_be32(1); + memcpy(virt_ctx->iv_inc1, gcmData->iv, NIST_AESGCM_IV_SIZE); memcpy(virt_ctx->iv_inc1 + NIST_AESGCM_IV_SIZE, &counter, sizeof(counter)); counter = cpu_to_be32(2); @@ -1651,7 +1635,6 @@ ssi_gcm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, return error; } - size_t ssi_fips_max_mem_alloc_size(void) { FIPS_DBG("sizeof(struct fips_cipher_ctx) %d \n", sizeof(struct fips_cipher_ctx)); diff --git a/drivers/staging/ccree/ssi_fips_local.c b/drivers/staging/ccree/ssi_fips_local.c index 9b84876b47aa..aefb71dc9e9a 100644 --- a/drivers/staging/ccree/ssi_fips_local.c +++ b/drivers/staging/ccree/ssi_fips_local.c @@ -26,7 +26,6 @@ #include "ssi_driver.h" #include "cc_hal.h" - #define FIPS_POWER_UP_TEST_CIPHER 1 #define FIPS_POWER_UP_TEST_CMAC 1 #define FIPS_POWER_UP_TEST_HASH 1 @@ -49,7 +48,6 @@ struct ssi_fips_handle { #endif }; - extern int ssi_fips_get_state(enum cc_fips_state_t *p_state); extern int ssi_fips_get_error(enum cc_fips_error *p_err); extern int ssi_fips_ext_set_state(enum cc_fips_state_t state); @@ -64,7 +62,6 @@ extern enum cc_fips_error ssi_ccm_fips_power_up_tests(struct ssi_drvdata *drvdat extern enum cc_fips_error ssi_gcm_fips_power_up_tests(struct ssi_drvdata *drvdata, void *cpu_addr_buffer, dma_addr_t dma_coherent_buffer); extern size_t ssi_fips_max_mem_alloc_size(void); - /* The function called once at driver entry point to check whether TEE FIPS error occured.*/ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) { @@ -78,7 +75,6 @@ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) return CC_REE_FIPS_ERROR_FROM_TEE; } - /* * This function should push the FIPS REE library status towards the TEE library. * By writing the error state to HOST_GPR0 register. The function is called from @@ -87,14 +83,13 @@ static enum ssi_fips_error ssi_fips_get_tee_error(struct ssi_drvdata *drvdata) static void ssi_fips_update_tee_upon_ree_status(struct ssi_drvdata *drvdata, enum cc_fips_error err) { void __iomem *cc_base = drvdata->cc_base; + if (err == CC_REE_FIPS_ERROR_OK) CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), (CC_FIPS_SYNC_REE_STATUS | CC_FIPS_SYNC_MODULE_OK)); else CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), (CC_FIPS_SYNC_REE_STATUS | CC_FIPS_SYNC_MODULE_ERROR)); } - - void ssi_fips_fini(struct ssi_drvdata *drvdata) { struct ssi_fips_handle *fips_h = drvdata->fips_handle; @@ -127,8 +122,6 @@ void fips_handler(struct ssi_drvdata *drvdata) #endif } - - #ifdef COMP_IN_WQ static void fips_wq_handler(struct work_struct *work) { @@ -161,7 +154,6 @@ static void fips_dsr(unsigned long devarg) CC_REG_OFFSET(HOST_RGF, HOST_IMR)) & ~irq); } - enum cc_fips_error cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) { enum cc_fips_error fips_error = CC_REE_FIPS_ERROR_OK; @@ -227,8 +219,6 @@ enum cc_fips_error cc_fips_run_power_up_tests(struct ssi_drvdata *drvdata) return fips_error; } - - /* The function checks if FIPS supported and FIPS error exists.* * It should be used in every driver API. */ @@ -247,7 +237,6 @@ int ssi_fips_check_fips_error(void) return 0; } - /* The function sets the REE FIPS state.* * It should be used while driver is being loaded. */ @@ -293,7 +282,6 @@ int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, enum cc_fips_error err) return rc; } - /* The function called once at driver entry point .*/ int ssi_fips_init(struct ssi_drvdata *p_drvdata) { diff --git a/drivers/staging/ccree/ssi_fips_local.h b/drivers/staging/ccree/ssi_fips_local.h index 4bc7f37a6e6b..8c7994fe9fae 100644 --- a/drivers/staging/ccree/ssi_fips_local.h +++ b/drivers/staging/ccree/ssi_fips_local.h @@ -17,7 +17,6 @@ #ifndef __SSI_FIPS_LOCAL_H__ #define __SSI_FIPS_LOCAL_H__ - #ifdef CONFIG_CCX7REE_FIPS_SUPPORT #include "ssi_fips.h" @@ -28,11 +27,13 @@ struct ssi_drvdata; return -ENOEXEC;\ } \ } + #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR() {\ if (ssi_fips_check_fips_error() != 0) {\ return;\ } \ } + #define SSI_FIPS_INIT(p_drvData) (ssi_fips_init(p_drvData)) #define SSI_FIPS_FINI(p_drvData) (ssi_fips_fini(p_drvData)) @@ -62,6 +63,5 @@ void fips_handler(struct ssi_drvdata *drvdata); #endif /* CONFIG_CC7XXREE_FIPS_SUPPORT */ - #endif /*__SSI_FIPS_LOCAL_H__*/ diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 79655bba8611..ae8f36af3837 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -83,7 +83,6 @@ struct ssi_hash_alg { struct ahash_alg ahash_alg; }; - struct hash_key_req_ctx { u32 keylen; dma_addr_t key_dma_addr; @@ -97,6 +96,7 @@ struct ssi_hash_ctx { */ u8 digest_buff[SSI_MAX_HASH_DIGEST_SIZE] ____cacheline_aligned; u8 opad_tmp_keys_buff[SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE] ____cacheline_aligned; + dma_addr_t opad_tmp_keys_dma_addr ____cacheline_aligned; dma_addr_t digest_buff_dma_addr; /* use for hmac with key large then mode block size */ @@ -429,7 +429,6 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, int idx = 0; int rc = 0; - SSI_LOG_DEBUG("===== %s-digest (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -962,6 +961,7 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); static int ssi_hash_init(struct ahash_req_ctx *state, struct ssi_hash_ctx *ctx) { struct device *dev = &ctx->drvdata->plat_dev->dev; + state->xcbc_count = 0; CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -1164,7 +1164,6 @@ out: return rc; } - static int ssi_xcbc_setkey(struct crypto_ahash *ahash, const u8 *key, unsigned int keylen) { @@ -1252,11 +1251,13 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, return rc; } + #if SSI_CC_HAS_CMAC static int ssi_cmac_setkey(struct crypto_ahash *ahash, const u8 *key, unsigned int keylen) { struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash); + SSI_LOG_DEBUG("===== setkey (%d) ====\n", keylen); CHECK_AND_RETURN_UPON_FIPS_ERROR(); @@ -1289,7 +1290,6 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, ctx->key_params.keylen = keylen; - return 0; } #endif @@ -1319,7 +1319,6 @@ static void ssi_hash_free_ctx(struct ssi_hash_ctx *ctx) ctx->key_params.keylen = 0; } - static int ssi_hash_alloc_ctx(struct ssi_hash_ctx *ctx) { struct device *dev = &ctx->drvdata->plat_dev->dev; @@ -1365,7 +1364,6 @@ static int ssi_ahash_cra_init(struct crypto_tfm *tfm) struct ssi_hash_alg *ssi_alg = container_of(ahash_alg, struct ssi_hash_alg, ahash_alg); - CHECK_AND_RETURN_UPON_FIPS_ERROR(); crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm), sizeof(struct ahash_req_ctx)); @@ -1462,7 +1460,6 @@ static int ssi_mac_final(struct ahash_request *req) u32 rem_cnt = state->buff_index ? state->buff1_cnt : state->buff0_cnt; - CHECK_AND_RETURN_UPON_FIPS_ERROR(); if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { keySize = CC_AES_128_BIT_KEY_SIZE; @@ -1501,7 +1498,6 @@ static int ssi_mac_final(struct ahash_request *req) set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); idx++; - /* Initiate decryption of block state to previous block_state-XOR-M[n] */ hw_desc_init(&desc[idx]); set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index a275151ab91a..5ff3368c04d9 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -296,4 +296,3 @@ int ssi_ivgen_getiv( return 0; } - diff --git a/drivers/staging/ccree/ssi_ivgen.h b/drivers/staging/ccree/ssi_ivgen.h index d466124a8b27..961aea411cb3 100644 --- a/drivers/staging/ccree/ssi_ivgen.h +++ b/drivers/staging/ccree/ssi_ivgen.h @@ -19,7 +19,6 @@ #include "cc_hw_queue_defs.h" - #define SSI_IVPOOL_SEQ_LEN 8 /*! diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c index d3ddfb1f5303..52a8ed579177 100644 --- a/drivers/staging/ccree/ssi_pm.c +++ b/drivers/staging/ccree/ssi_pm.c @@ -14,7 +14,6 @@ * along with this program; if not, see . */ - #include "ssi_config.h" #include #include @@ -30,13 +29,11 @@ #include "ssi_hash.h" #include "ssi_pm.h" - #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) #define POWER_DOWN_ENABLE 0x01 #define POWER_DOWN_DISABLE 0x00 - int ssi_power_mgr_runtime_suspend(struct device *dev) { struct ssi_drvdata *drvdata = @@ -119,8 +116,6 @@ int ssi_power_mgr_runtime_put_suspend(struct device *dev) #endif - - int ssi_power_mgr_init(struct ssi_drvdata *drvdata) { int rc = 0; diff --git a/drivers/staging/ccree/ssi_pm.h b/drivers/staging/ccree/ssi_pm.h index 4874987ffa77..63673f60d2d8 100644 --- a/drivers/staging/ccree/ssi_pm.h +++ b/drivers/staging/ccree/ssi_pm.h @@ -20,14 +20,11 @@ #ifndef __SSI_POWER_MGR_H__ #define __SSI_POWER_MGR_H__ - #include "ssi_config.h" #include "ssi_driver.h" - #define SSI_SUSPEND_TIMEOUT 3000 - int ssi_power_mgr_init(struct ssi_drvdata *drvdata); void ssi_power_mgr_fini(struct ssi_drvdata *drvdata); diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index f6f7ea8e9036..46d9396f9ff9 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -50,6 +50,7 @@ struct ssi_request_mgr_handle { u8 *dummy_comp_buff; dma_addr_t dummy_comp_buff_dma; struct cc_hw_desc monitor_desc; + volatile unsigned long monitor_lock; #ifdef COMP_IN_WQ struct workqueue_struct *workq; @@ -135,7 +136,6 @@ int request_mgr_init(struct ssi_drvdata *drvdata) req_mgr_h->min_free_hw_slots = req_mgr_h->hw_queue_size; req_mgr_h->max_used_sw_slots = 0; - /* Allocate DMA word for "dummy" completion descriptor use */ req_mgr_h->dummy_comp_buff = dma_alloc_coherent(&drvdata->plat_dev->dev, sizeof(u32), &req_mgr_h->dummy_comp_buff_dma, GFP_KERNEL); @@ -192,10 +192,10 @@ static inline void enqueue_seq( static void request_mgr_complete(struct device *dev, void *dx_compl_h, void __iomem *cc_base) { struct completion *this_compl = dx_compl_h; + complete(this_compl); } - static inline int request_mgr_queues_status_check( struct ssi_request_mgr_handle *req_mgr_h, void __iomem *cc_base, @@ -389,7 +389,6 @@ int send_request( } } - /*! * Enqueue caller request to crypto hardware during init process. * assume this function is not called in middle of a flow, @@ -426,7 +425,6 @@ int send_request_init( return 0; } - void complete_request(struct ssi_drvdata *drvdata) { struct ssi_request_mgr_handle *request_mgr_handle = @@ -478,6 +476,7 @@ static void proc_completions(struct ssi_drvdata *drvdata) { u32 axi_err; int i; + SSI_LOG_INFO("Delay\n"); for (i = 0; i < 1000000; i++) axi_err = READ_REGISTER(drvdata->cc_base + CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR)); @@ -516,8 +515,6 @@ static void comp_handler(unsigned long devarg) u32 irq; - - irq = (drvdata->irq & SSI_COMP_IRQ_MASK); if (irq & SSI_COMP_IRQ_MASK) { diff --git a/drivers/staging/ccree/ssi_sram_mgr.c b/drivers/staging/ccree/ssi_sram_mgr.c index cf03df376039..e05c0c13c2eb 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.c +++ b/drivers/staging/ccree/ssi_sram_mgr.c @@ -17,7 +17,6 @@ #include "ssi_driver.h" #include "ssi_sram_mgr.h" - /** * struct ssi_sram_mgr_ctx -Internal RAM context manager * @sram_free_offset: the offset to the non-allocated area @@ -26,7 +25,6 @@ struct ssi_sram_mgr_ctx { ssi_sram_addr_t sram_free_offset; }; - /** * ssi_sram_mgr_fini() - Cleanup SRAM pool. * diff --git a/drivers/staging/ccree/ssi_sram_mgr.h b/drivers/staging/ccree/ssi_sram_mgr.h index ece63594cb62..9ba1d59a0bae 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.h +++ b/drivers/staging/ccree/ssi_sram_mgr.h @@ -17,7 +17,6 @@ #ifndef __SSI_SRAM_MGR_H__ #define __SSI_SRAM_MGR_H__ - #ifndef SSI_CC_SRAM_SIZE #define SSI_CC_SRAM_SIZE 4096 #endif diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 75c9a89f31c4..dbcd1634aad1 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -108,7 +108,6 @@ static DEFINE_SPINLOCK(stat_lock); static struct stat_item stat_host_db[MAX_STAT_OP_TYPES][MAX_STAT_PHASES]; static struct stat_item stat_cc_db[MAX_STAT_OP_TYPES][MAX_STAT_PHASES]; - static void init_db(struct stat_item item[MAX_STAT_OP_TYPES][MAX_STAT_PHASES]) { unsigned int i, j; @@ -152,7 +151,6 @@ static void display_db(struct stat_item item[MAX_STAT_OP_TYPES][MAX_STAT_PHASES] } } - /************************************** * Attributes show functions section * **************************************/ @@ -278,8 +276,6 @@ void display_all_stat_db(void) } #endif /*CC_CYCLE_COUNT*/ - - static ssize_t ssi_sys_regdump_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { diff --git a/drivers/staging/ccree/ssi_sysfs.h b/drivers/staging/ccree/ssi_sysfs.h index 4893e014adf7..44ae3d4c40b3 100644 --- a/drivers/staging/ccree/ssi_sysfs.h +++ b/drivers/staging/ccree/ssi_sysfs.h @@ -36,6 +36,7 @@ enum stat_phase { STAT_PHASE_6, MAX_STAT_PHASES, }; + enum stat_op { STAT_OP_TYPE_NULL = 0, STAT_OP_TYPE_ENCODE, -- cgit v1.2.3-55-g7522 From fb0cb50d6e5aebf8671db7ab4b582f782abe8477 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Tue, 27 Jun 2017 10:27:26 +0300 Subject: staging: ccree: fix block comment style Align block comments according to coding style. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/cc_hw_queue_defs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index f11487a7c969..e6b8cea3f88d 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -23,8 +23,8 @@ #include /****************************************************************************** -* DEFINITIONS -******************************************************************************/ + * DEFINITIONS + ******************************************************************************/ #define HW_DESC_SIZE_WORDS 6 #define HW_QUEUE_SLOTS_MAX 15 /* Max. available slots in HW queue */ @@ -70,8 +70,8 @@ #define WORD5_DOUT_ADDR_HIGH CC_GENMASK(5, DOUT_ADDR_HIGH) /****************************************************************************** -* TYPE DEFINITIONS -******************************************************************************/ + * TYPE DEFINITIONS + ******************************************************************************/ struct cc_hw_desc { union { -- cgit v1.2.3-55-g7522 From e171da0d09b14fa5f67ae6ef1095fcd7e23b67fc Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 27 Jun 2017 10:29:06 +0100 Subject: staging: wilc1000: fix spelling mistake: "dissconect" -> "disconnect" Trivial fix to spelling mistake in netdev_err error message Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f7c22d7b28d1..2568dfc15181 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1216,7 +1216,7 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif) result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) - netdev_err(vif->ndev, "Failed to send dissconect\n"); + netdev_err(vif->ndev, "Failed to send disconnect\n"); hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.ssid); -- cgit v1.2.3-55-g7522 From 8ad33de53afedd064926c64f2ffa896c21e4bc28 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 27 Jun 2017 15:23:26 +0100 Subject: staging: rtl8192e: fix spelling mistake: "respose" -> "response" Trivial fix to spelling mistake in netdev_info message and split line to clean up an checkpatch line too wide warning. Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index f629e99956b7..64b0034c9c37 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2310,7 +2310,8 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) if (errcode) { ieee->softmac_stats.rx_auth_rs_err++; netdev_info(ieee->dev, - "Authentication respose status code 0x%x", errcode); + "Authentication response status code 0x%x", + errcode); rtllib_associate_abort(ieee); return; } -- cgit v1.2.3-55-g7522 From a9cbe2ad656f3e9fc2054853ffc4adda71477fe6 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Wed, 28 Jun 2017 17:11:29 +0100 Subject: staging: ks7010: fix spelling mistake: "errror" -> "error" Trivial fix to spelling mistake in netdev_err message Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_wlan_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 0c778aa4bb7a..8aa12e813bd7 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -2273,7 +2273,7 @@ static int ks_wlan_set_sleep_mode(struct net_device *dev, netdev_info(dev, "SET_SLEEP_MODE %d\n", priv->sleep_mode); hostif_sme_enqueue(priv, SME_SLEEP_REQUEST); } else { - netdev_err(dev, "SET_SLEEP_MODE %d errror\n", *uwrq); + netdev_err(dev, "SET_SLEEP_MODE %d error\n", *uwrq); return -EINVAL; } -- cgit v1.2.3-55-g7522 From ce73724d4d4f5f807ca0739b8993394ece9f4212 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Wed, 28 Jun 2017 14:13:51 +0100 Subject: staging: speakup: make function ser_to_dev static The helper function ser_to_dev does not need to be in global scope, so make it static. Cleans up sparse warning: "warning: symbol 'ser_to_dev' was not declared. Should it be static?" Signed-off-by: Colin Ian King Reviewed-by: Okash Khawaja Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_ttyio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 442f191a017e..ed8e96b06ead 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -21,7 +21,7 @@ struct spk_ldisc_data { static struct spk_synth *spk_ttyio_synth; static struct tty_struct *speakup_tty; -int ser_to_dev(int ser, dev_t *dev_no) +static int ser_to_dev(int ser, dev_t *dev_no) { if (ser < 0 || ser > (255 - 64)) { pr_err("speakup: Invalid ser param. Must be between 0 and 191 inclusive.\n"); -- cgit v1.2.3-55-g7522 From 714cc27d41b5676257e6b23851ff4afacf395883 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:21 +0300 Subject: staging: fsl-mc: move comparison before strcmp() call Move comparison before the strcmp() in this if statement, and slightly increase efficiency by not making the strcmp() each time the if gets evaluated but only when the comparison is true. This was suggested in a review comment. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 80c080f20da1..1765e2ddba11 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -29,8 +29,9 @@ struct dprc_child_objs { static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, struct dprc_obj_desc *obj_desc) { - return !strcmp(mc_dev->obj_desc.type, obj_desc->type) && - mc_dev->obj_desc.id == obj_desc->id; + return mc_dev->obj_desc.id == obj_desc->id && + !strcmp(mc_dev->obj_desc.type, obj_desc->type); + } static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) -- cgit v1.2.3-55-g7522 From b93ad9a067e1515af42da7d56bc61f1a25075f94 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:22 +0300 Subject: staging: fsl-mc: be consistent when checking strcmp() return Stick to one way of checking the return code of strcmp(): use '!'. This was suggested in a review comment. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index 9291847b1d14..d34e2ff80e37 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -19,9 +19,9 @@ static bool __must_check fsl_mc_is_allocatable(const char *obj_type) { - return strcmp(obj_type, "dpbp") == 0 || - strcmp(obj_type, "dpmcp") == 0 || - strcmp(obj_type, "dpcon") == 0; + return strcmp(obj_type, "dpbp") || + strcmp(obj_type, "dpmcp") || + strcmp(obj_type, "dpcon"); } /** -- cgit v1.2.3-55-g7522 From 5b4813cb1e8b2ce19fad4a0134b318f5ce3b85f0 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:23 +0300 Subject: staging: fsl-mc: drop useless #includes These couple of header files are not needed in the source so remove them. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index d34e2ff80e37..d9a06b968dc5 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -13,8 +13,6 @@ #include "../include/mc-bus.h" #include "../include/mc-sys.h" -#include "dpbp-cmd.h" -#include "dpcon-cmd.h" #include "fsl-mc-private.h" static bool __must_check fsl_mc_is_allocatable(const char *obj_type) -- cgit v1.2.3-55-g7522 From 0cf9f5096da2200b52cee0e38139c99c4fc0151c Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:24 +0300 Subject: staging: fsl-mc: decouple the mc-bus public headers from dprc.h In its current form, the public headers of the mc-bus depend only on a structure "dprc_obj_desc" defined in dprc.h. Move it to the bus public header together with its associated defines and, in order to keep the naming prefixes consistent rename it to "fsl_mc_obj_desc". This will allow making dprc.h private in future patches. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 38 ++++++++++++------------ drivers/staging/fsl-mc/bus/dprc.c | 3 +- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 12 ++++---- drivers/staging/fsl-mc/bus/fsl-mc-private.h | 2 +- drivers/staging/fsl-mc/include/dprc.h | 46 ++--------------------------- drivers/staging/fsl-mc/include/mc.h | 41 ++++++++++++++++++++++++- 6 files changed, 71 insertions(+), 71 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 1765e2ddba11..329ab10dcff0 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -21,13 +21,13 @@ #define FSL_MC_DPRC_DRIVER_NAME "fsl_mc_dprc" -struct dprc_child_objs { +struct fsl_mc_child_objs { int child_count; - struct dprc_obj_desc *child_array; + struct fsl_mc_obj_desc *child_array; }; static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, - struct dprc_obj_desc *obj_desc) + struct fsl_mc_obj_desc *obj_desc) { return mc_dev->obj_desc.id == obj_desc->id && !strcmp(mc_dev->obj_desc.type, obj_desc->type); @@ -37,7 +37,7 @@ static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) { int i; - struct dprc_child_objs *objs; + struct fsl_mc_child_objs *objs; struct fsl_mc_device *mc_dev; WARN_ON(!dev); @@ -46,7 +46,7 @@ static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) objs = data; for (i = 0; i < objs->child_count; i++) { - struct dprc_obj_desc *obj_desc = &objs->child_array[i]; + struct fsl_mc_obj_desc *obj_desc = &objs->child_array[i]; if (strlen(obj_desc->type) != 0 && fsl_mc_device_match(mc_dev, obj_desc)) @@ -80,7 +80,7 @@ static int __fsl_mc_device_remove(struct device *dev, void *data) * been dynamically removed in the physical DPRC. */ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, - struct dprc_obj_desc *obj_desc_array, + struct fsl_mc_obj_desc *obj_desc_array, int num_child_objects_in_mc) { if (num_child_objects_in_mc != 0) { @@ -88,7 +88,7 @@ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, * Remove child objects that are in the DPRC in Linux, * but not in the MC: */ - struct dprc_child_objs objs; + struct fsl_mc_child_objs objs; objs.child_count = num_child_objects_in_mc; objs.child_array = obj_desc_array; @@ -106,13 +106,13 @@ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, static int __fsl_mc_device_match(struct device *dev, void *data) { - struct dprc_obj_desc *obj_desc = data; + struct fsl_mc_obj_desc *obj_desc = data; struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); return fsl_mc_device_match(mc_dev, obj_desc); } -static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc +static struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_device *mc_bus_dev) @@ -137,16 +137,16 @@ static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc * device is unbound from the corresponding device driver. */ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, - struct dprc_obj_desc *obj_desc) + struct fsl_mc_obj_desc *obj_desc) { int error; u32 plugged_flag_at_mc = - obj_desc->state & DPRC_OBJ_STATE_PLUGGED; + obj_desc->state & FSL_MC_OBJ_STATE_PLUGGED; if (plugged_flag_at_mc != - (mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED)) { + (mc_dev->obj_desc.state & FSL_MC_OBJ_STATE_PLUGGED)) { if (plugged_flag_at_mc) { - mc_dev->obj_desc.state |= DPRC_OBJ_STATE_PLUGGED; + mc_dev->obj_desc.state |= FSL_MC_OBJ_STATE_PLUGGED; error = device_attach(&mc_dev->dev); if (error < 0) { dev_err(&mc_dev->dev, @@ -154,7 +154,7 @@ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, error); } } else { - mc_dev->obj_desc.state &= ~DPRC_OBJ_STATE_PLUGGED; + mc_dev->obj_desc.state &= ~FSL_MC_OBJ_STATE_PLUGGED; device_release_driver(&mc_dev->dev); } } @@ -173,7 +173,7 @@ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, * in the physical DPRC. */ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, - struct dprc_obj_desc *obj_desc_array, + struct fsl_mc_obj_desc *obj_desc_array, int num_child_objects_in_mc) { int error; @@ -181,7 +181,7 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, for (i = 0; i < num_child_objects_in_mc; i++) { struct fsl_mc_device *child_dev; - struct dprc_obj_desc *obj_desc = &obj_desc_array[i]; + struct fsl_mc_obj_desc *obj_desc = &obj_desc_array[i]; if (strlen(obj_desc->type) == 0) continue; @@ -228,7 +228,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, int dprc_get_obj_failures; int error; unsigned int irq_count = mc_bus_dev->obj_desc.irq_count; - struct dprc_obj_desc *child_obj_desc_array = NULL; + struct fsl_mc_obj_desc *child_obj_desc_array = NULL; error = dprc_get_obj_count(mc_bus_dev->mc_io, 0, @@ -255,7 +255,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, */ dprc_get_obj_failures = 0; for (i = 0; i < num_child_objects; i++) { - struct dprc_obj_desc *obj_desc = + struct fsl_mc_obj_desc *obj_desc = &child_obj_desc_array[i]; error = dprc_get_obj(mc_bus_dev->mc_io, @@ -283,7 +283,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, if ((strcmp(obj_desc->type, "dpseci") == 0) && (obj_desc->ver_major < 4)) obj_desc->flags |= - DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY; + FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY; irq_count += obj_desc->irq_count; dev_dbg(&mc_bus_dev->dev, diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index fcf7b4767dc0..a47f31d5ffe6 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include "../include/mc.h" #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dprc.h" @@ -496,7 +497,7 @@ int dprc_get_obj(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int obj_index, - struct dprc_obj_desc *obj_desc) + struct fsl_mc_obj_desc *obj_desc) { struct mc_command cmd = { 0 }; struct dprc_cmd_get_obj *cmd_params; diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 7b48ade1ca9c..8725a5cbc3aa 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -82,7 +82,7 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv) * If the object is not 'plugged' don't match. * Only exception is the root DPRC, which is a special case. */ - if ((mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED) == 0 && + if ((mc_dev->obj_desc.state & FSL_MC_OBJ_STATE_PLUGGED) == 0 && !fsl_mc_is_root_dprc(&mc_dev->dev)) goto out; @@ -339,7 +339,7 @@ static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev, int i; int error; struct resource *regions; - struct dprc_obj_desc *obj_desc = &mc_dev->obj_desc; + struct fsl_mc_obj_desc *obj_desc = &mc_dev->obj_desc; struct device *parent_dev = mc_dev->dev.parent; enum dprc_region_type mc_region_type; @@ -432,7 +432,7 @@ static void fsl_mc_device_release(struct device *dev) /** * Add a newly discovered fsl-mc device to be visible in Linux */ -int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, +int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, struct device *parent_dev, struct fsl_mc_device **new_mc_dev) @@ -534,7 +534,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, } /* Objects are coherent, unless 'no shareability' flag set. */ - if (!(obj_desc->flags & DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY)) + if (!(obj_desc->flags & FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY)) arch_setup_dma_ops(&mc_dev->dev, 0, 0, NULL, true); /* @@ -687,7 +687,7 @@ static int get_mc_addr_translation_ranges(struct device *dev, */ static int fsl_mc_bus_probe(struct platform_device *pdev) { - struct dprc_obj_desc obj_desc; + struct fsl_mc_obj_desc obj_desc; int error; struct fsl_mc *mc; struct fsl_mc_device *mc_bus_dev = NULL; @@ -746,7 +746,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) goto error_cleanup_mc_io; } - memset(&obj_desc, 0, sizeof(struct dprc_obj_desc)); + memset(&obj_desc, 0, sizeof(struct fsl_mc_obj_desc)); error = dprc_get_api_version(mc_io, 0, &obj_desc.ver_major, &obj_desc.ver_minor); diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index 01ef932905de..7f5406f75908 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -12,7 +12,7 @@ #include "../include/mc.h" -int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc, +int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, struct device *parent_dev, struct fsl_mc_device **new_mc_dev); diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h index 2f4a7a75a572..21295e4feb04 100644 --- a/drivers/staging/fsl-mc/include/dprc.h +++ b/drivers/staging/fsl-mc/include/dprc.h @@ -39,6 +39,7 @@ */ struct fsl_mc_io; +struct fsl_mc_obj_desc; int dprc_open(struct fsl_mc_io *mc_io, u32 cmd_flags, @@ -167,59 +168,18 @@ int dprc_get_obj_count(struct fsl_mc_io *mc_io, u16 token, int *obj_count); -/* Objects Attributes Flags */ - -/* Opened state - Indicates that an object is open by at least one owner */ -#define DPRC_OBJ_STATE_OPEN 0x00000001 -/* Plugged state - Indicates that the object is plugged */ -#define DPRC_OBJ_STATE_PLUGGED 0x00000002 - -/** - * Shareability flag - Object flag indicating no memory shareability. - * the object generates memory accesses that are non coherent with other - * masters; - * user is responsible for proper memory handling through IOMMU configuration. - */ -#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 - -/** - * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj() - * @type: Type of object: NULL terminated string - * @id: ID of logical object resource - * @vendor: Object vendor identifier - * @ver_major: Major version number - * @ver_minor: Minor version number - * @irq_count: Number of interrupts supported by the object - * @region_count: Number of mappable regions supported by the object - * @state: Object state: combination of DPRC_OBJ_STATE_ states - * @label: Object label - * @flags: Object's flags - */ -struct dprc_obj_desc { - char type[16]; - int id; - u16 vendor; - u16 ver_major; - u16 ver_minor; - u8 irq_count; - u8 region_count; - u32 state; - char label[16]; - u16 flags; -}; - int dprc_get_obj(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int obj_index, - struct dprc_obj_desc *obj_desc); + struct fsl_mc_obj_desc *obj_desc); int dprc_get_obj_desc(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, char *obj_type, int obj_id, - struct dprc_obj_desc *obj_desc); + struct fsl_mc_obj_desc *obj_desc); int dprc_set_obj_irq(struct fsl_mc_io *mc_io, u32 cmd_flags, diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 1c46c0c2a895..60c706720531 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -104,6 +104,45 @@ struct fsl_mc_device_irq { #define to_fsl_mc_irq(_mc_resource) \ container_of(_mc_resource, struct fsl_mc_device_irq, resource) +/* Opened state - Indicates that an object is open by at least one owner */ +#define FSL_MC_OBJ_STATE_OPEN 0x00000001 +/* Plugged state - Indicates that the object is plugged */ +#define FSL_MC_OBJ_STATE_PLUGGED 0x00000002 + +/** + * Shareability flag - Object flag indicating no memory shareability. + * the object generates memory accesses that are non coherent with other + * masters; + * user is responsible for proper memory handling through IOMMU configuration. + */ +#define FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 + +/** + * struct fsl_mc_obj_desc - Object descriptor + * @type: Type of object: NULL terminated string + * @id: ID of logical object resource + * @vendor: Object vendor identifier + * @ver_major: Major version number + * @ver_minor: Minor version number + * @irq_count: Number of interrupts supported by the object + * @region_count: Number of mappable regions supported by the object + * @state: Object state: combination of FSL_MC_OBJ_STATE_ states + * @label: Object label: NULL terminated string + * @flags: Object's flags + */ +struct fsl_mc_obj_desc { + char type[16]; + int id; + u16 vendor; + u16 ver_major; + u16 ver_minor; + u8 irq_count; + u8 region_count; + u32 state; + char label[16]; + u16 flags; +}; + /** * Bit masks for a MC object device (struct fsl_mc_device) flags */ @@ -150,7 +189,7 @@ struct fsl_mc_device { u16 icid; u16 mc_handle; struct fsl_mc_io *mc_io; - struct dprc_obj_desc obj_desc; + struct fsl_mc_obj_desc obj_desc; struct resource *regions; struct fsl_mc_device_irq **irqs; struct fsl_mc_resource *resource; -- cgit v1.2.3-55-g7522 From fda0d1d57e66a1c0ad45424e185108addbaf3f79 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:25 +0300 Subject: staging: fsl-mc: delete duplicated function prototypes These functions already have their prototypes in fsl-mc-private.h header file so delete them from mc-bus.h. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index 42700de94d59..8f9bf8dd6495 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -75,14 +75,6 @@ int dprc_scan_container(struct fsl_mc_device *mc_bus_dev); int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, unsigned int *total_irq_count); -int __init dprc_driver_init(void); - -void dprc_driver_exit(void); - -int __init fsl_mc_allocator_driver_init(void); - -void fsl_mc_allocator_driver_exit(void); - struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, struct msi_domain_info *info, struct irq_domain *parent); -- cgit v1.2.3-55-g7522 From a8d77e43bd35cbb839279c338b1757745958ea9e Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:26 +0300 Subject: staging: fsl-mc: delete prototype of unimplemented function The function fsl_mc_bus_exists() has a prototype but is never implemented so delete it from the header file. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index 8f9bf8dd6495..aac062e2b6ef 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -91,8 +91,6 @@ void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); -bool fsl_mc_bus_exists(void); - void fsl_mc_get_root_dprc(struct device *dev, struct device **root_dprc_dev); -- cgit v1.2.3-55-g7522 From ad62553f03635371ba22d69614c5a25c3454b371 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:27 +0300 Subject: staging: fsl-mc: turn several exported functions static They are never used outside the source they are implemented in and very likely never will, so it's safe to make them static. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 8 +++----- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 5 ++--- drivers/staging/fsl-mc/include/mc-bus.h | 8 -------- 3 files changed, 5 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 329ab10dcff0..adf2ffb70dd3 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -221,8 +221,8 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, * populated before they can get allocation requests from probe callbacks * of the device drivers for the non-allocatable devices. */ -int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, - unsigned int *total_irq_count) +static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, + unsigned int *total_irq_count) { int num_child_objects; int dprc_get_obj_failures; @@ -310,7 +310,6 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, return 0; } -EXPORT_SYMBOL_GPL(dprc_scan_objects); /** * dprc_scan_container - Scans a physical DPRC and synchronizes Linux bus state @@ -321,7 +320,7 @@ EXPORT_SYMBOL_GPL(dprc_scan_objects); * bus driver with the actual state of the MC by adding and removing * devices as appropriate. */ -int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) +static int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) { int error; unsigned int irq_count; @@ -357,7 +356,6 @@ error: fsl_mc_cleanup_all_resource_pools(mc_bus_dev); return error; } -EXPORT_SYMBOL_GPL(dprc_scan_container); /** * dprc_irq0_handler - Regular ISR for DPRC interrupt 0 diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 8725a5cbc3aa..60b2a40b4a2f 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -241,8 +241,8 @@ EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister); /** * fsl_mc_get_root_dprc - function to traverse to the root dprc */ -void fsl_mc_get_root_dprc(struct device *dev, - struct device **root_dprc_dev) +static void fsl_mc_get_root_dprc(struct device *dev, + struct device **root_dprc_dev) { if (WARN_ON(!dev)) { *root_dprc_dev = NULL; @@ -254,7 +254,6 @@ void fsl_mc_get_root_dprc(struct device *dev, *root_dprc_dev = (*root_dprc_dev)->parent; } } -EXPORT_SYMBOL_GPL(fsl_mc_get_root_dprc); static int get_dprc_attr(struct fsl_mc_io *mc_io, int container_id, struct dprc_attributes *attr) diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index aac062e2b6ef..c1df43357c56 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -70,11 +70,6 @@ struct fsl_mc_bus { #define to_fsl_mc_bus(_mc_dev) \ container_of(_mc_dev, struct fsl_mc_bus, mc_dev) -int dprc_scan_container(struct fsl_mc_device *mc_bus_dev); - -int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, - unsigned int *total_irq_count); - struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, struct msi_domain_info *info, struct irq_domain *parent); @@ -91,9 +86,6 @@ void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); -void fsl_mc_get_root_dprc(struct device *dev, - struct device **root_dprc_dev); - bool fsl_mc_is_root_dprc(struct device *dev); extern struct bus_type fsl_mc_bus_type; -- cgit v1.2.3-55-g7522 From 7211e711bf9d41ade0cc9ce9251144944c186854 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:28 +0300 Subject: staging: fsl-mc: move irq domain creation prototype to public header fsl_mc_msi_create_irq_domain() will is used from the irqchip glue code so it needs to be in the public headers. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 7 ------- drivers/staging/fsl-mc/include/mc.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index c1df43357c56..0860681bddc6 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -14,9 +14,6 @@ #include "../include/mc.h" #include -struct irq_domain; -struct msi_domain_info; - /** * Maximum number of total IRQs that can be pre-allocated for an MC bus' * IRQ pool @@ -70,10 +67,6 @@ struct fsl_mc_bus { #define to_fsl_mc_bus(_mc_dev) \ container_of(_mc_dev, struct fsl_mc_bus, mc_dev) -struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, - struct msi_domain_info *info, - struct irq_domain *parent); - int fsl_mc_find_msi_domain(struct device *mc_platform_dev, struct irq_domain **mc_msi_domain); diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 60c706720531..adb237845b40 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -18,6 +18,9 @@ #define FSL_MC_VENDOR_FREESCALE 0x1957 +struct irq_domain; +struct msi_domain_info; + struct fsl_mc_device; struct fsl_mc_io; @@ -233,6 +236,10 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, void fsl_mc_object_free(struct fsl_mc_device *mc_adev); +struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, + struct msi_domain_info *info, + struct irq_domain *parent); + int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); -- cgit v1.2.3-55-g7522 From 61aa52c7742b1de3afa583f06de320da5ad79b60 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:29 +0300 Subject: staging: fsl-mc: move couple of definitions to public header Define dev_is_fsl_mc() and the bus type definition (fsl_mc_bus_type) are used externally so move them to the public header. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/include/mc-bus.h | 9 --------- drivers/staging/fsl-mc/include/mc.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h index 0860681bddc6..a79a679578d2 100644 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ b/drivers/staging/fsl-mc/include/mc-bus.h @@ -20,13 +20,6 @@ */ #define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 -#ifdef CONFIG_FSL_MC_BUS -#define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) -#else -/* If fsl-mc bus is not present device cannot belong to fsl-mc bus */ -#define dev_is_fsl_mc(_dev) (0) -#endif - /** * struct fsl_mc_resource_pool - Pool of MC resources of a given * type @@ -81,6 +74,4 @@ void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); bool fsl_mc_is_root_dprc(struct device *dev); -extern struct bus_type fsl_mc_bus_type; - #endif /* _FSL_MC_MCBUS_H_ */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index adb237845b40..d37e2c7ed55a 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -201,6 +201,13 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) +#ifdef CONFIG_FSL_MC_BUS +#define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) +#else +/* If fsl-mc bus is not present device cannot belong to fsl-mc bus */ +#define dev_is_fsl_mc(_dev) (0) +#endif + /* * module_fsl_mc_driver() - Helper macro for drivers that don't do * anything special in module init/exit. This eliminates a lot of @@ -244,4 +251,6 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); +extern struct bus_type fsl_mc_bus_type; + #endif /* _FSL_MC_H_ */ -- cgit v1.2.3-55-g7522 From 5e0d2d01435725ed533cfe7ca91368408fab4552 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:30 +0300 Subject: staging: fsl-mc: move rest of mc-bus.h to private header All the mc-bus.h contents is only used privately in the bus driver so move everything to the private header and get rid of the mc-bus.h header file. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-private.h | 61 +++++++++++++++++ .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 1 - drivers/staging/fsl-mc/bus/mc-io.c | 1 - drivers/staging/fsl-mc/include/mc-bus.h | 77 ---------------------- 8 files changed, 61 insertions(+), 83 deletions(-) delete mode 100644 drivers/staging/fsl-mc/include/mc-bus.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index adf2ffb70dd3..7c6c4ac9efb6 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -13,7 +13,6 @@ #include #include #include -#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index d9a06b968dc5..04ae2ccfe0b8 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -10,7 +10,6 @@ #include #include -#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 60b2a40b4a2f..3dec3e991d86 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,7 +20,6 @@ #include #include #include -#include "../include/mc-bus.h" #include "../include/dpmng.h" #include "../include/mc-sys.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index a92fa5a3ff42..81dca7a3a317 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -16,7 +16,6 @@ #include #include #include -#include "../include/mc-bus.h" #include "../include/mc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index 7f5406f75908..e5839992e128 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -11,6 +11,53 @@ #define _FSL_MC_PRIVATE_H_ #include "../include/mc.h" +#include + +/** + * Maximum number of total IRQs that can be pre-allocated for an MC bus' + * IRQ pool + */ +#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 + +/** + * struct fsl_mc_resource_pool - Pool of MC resources of a given + * type + * @type: type of resources in the pool + * @max_count: maximum number of resources in the pool + * @free_count: number of free resources in the pool + * @mutex: mutex to serialize access to the pool's free list + * @free_list: anchor node of list of free resources in the pool + * @mc_bus: pointer to the MC bus that owns this resource pool + */ +struct fsl_mc_resource_pool { + enum fsl_mc_pool_type type; + int max_count; + int free_count; + struct mutex mutex; /* serializes access to free_list */ + struct list_head free_list; + struct fsl_mc_bus *mc_bus; +}; + +/** + * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC + * @mc_dev: fsl-mc device for the bus device itself. + * @resource_pools: array of resource pools (one pool per resource type) + * for this MC bus. These resources represent allocatable entities + * from the physical DPRC. + * @irq_resources: Pointer to array of IRQ objects for the IRQ pool + * @scan_mutex: Serializes bus scanning + * @dprc_attr: DPRC attributes + */ +struct fsl_mc_bus { + struct fsl_mc_device mc_dev; + struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; + struct fsl_mc_device_irq *irq_resources; + struct mutex scan_mutex; /* serializes bus scanning */ + struct dprc_attributes dprc_attr; +}; + +#define to_fsl_mc_bus(_mc_dev) \ + container_of(_mc_dev, struct fsl_mc_bus, mc_dev) int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, @@ -27,6 +74,10 @@ int __init fsl_mc_allocator_driver_init(void); void fsl_mc_allocator_driver_exit(void); +void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); + +void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); + int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, enum fsl_mc_pool_type pool_type, struct fsl_mc_resource @@ -43,6 +94,14 @@ int __init its_fsl_mc_msi_init(void); void its_fsl_mc_msi_cleanup(void); +int fsl_mc_find_msi_domain(struct device *mc_platform_dev, + struct irq_domain **mc_msi_domain); + +int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, + unsigned int irq_count); + +void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus); + int __must_check fsl_create_mc_io(struct device *dev, phys_addr_t mc_portal_phys_addr, u32 mc_portal_size, @@ -51,4 +110,6 @@ int __must_check fsl_create_mc_io(struct device *dev, void fsl_destroy_mc_io(struct fsl_mc_io *mc_io); +bool fsl_mc_is_root_dprc(struct device *dev); + #endif /* _FSL_MC_PRIVATE_H_ */ diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c index 49127acb85b2..865d38517508 100644 --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c @@ -16,7 +16,6 @@ #include #include #include -#include "../include/mc-bus.h" #include "fsl-mc-private.h" static struct irq_chip its_msi_irq_chip = { diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index d66b87f0903b..ec2835fb2a83 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -31,7 +31,6 @@ */ #include -#include "../include/mc-bus.h" #include "../include/mc-sys.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/include/mc-bus.h b/drivers/staging/fsl-mc/include/mc-bus.h deleted file mode 100644 index a79a679578d2..000000000000 --- a/drivers/staging/fsl-mc/include/mc-bus.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Freescale Management Complex (MC) bus declarations - * - * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. - * Author: German Rivera - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ -#ifndef _FSL_MC_MCBUS_H_ -#define _FSL_MC_MCBUS_H_ - -#include "../include/mc.h" -#include - -/** - * Maximum number of total IRQs that can be pre-allocated for an MC bus' - * IRQ pool - */ -#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256 - -/** - * struct fsl_mc_resource_pool - Pool of MC resources of a given - * type - * @type: type of resources in the pool - * @max_count: maximum number of resources in the pool - * @free_count: number of free resources in the pool - * @mutex: mutex to serialize access to the pool's free list - * @free_list: anchor node of list of free resources in the pool - * @mc_bus: pointer to the MC bus that owns this resource pool - */ -struct fsl_mc_resource_pool { - enum fsl_mc_pool_type type; - int max_count; - int free_count; - struct mutex mutex; /* serializes access to free_list */ - struct list_head free_list; - struct fsl_mc_bus *mc_bus; -}; - -/** - * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC - * @mc_dev: fsl-mc device for the bus device itself. - * @resource_pools: array of resource pools (one pool per resource type) - * for this MC bus. These resources represent allocatable entities - * from the physical DPRC. - * @irq_resources: Pointer to array of IRQ objects for the IRQ pool - * @scan_mutex: Serializes bus scanning - * @dprc_attr: DPRC attributes - */ -struct fsl_mc_bus { - struct fsl_mc_device mc_dev; - struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; - struct fsl_mc_device_irq *irq_resources; - struct mutex scan_mutex; /* serializes bus scanning */ - struct dprc_attributes dprc_attr; -}; - -#define to_fsl_mc_bus(_mc_dev) \ - container_of(_mc_dev, struct fsl_mc_bus, mc_dev) - -int fsl_mc_find_msi_domain(struct device *mc_platform_dev, - struct irq_domain **mc_msi_domain); - -int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, - unsigned int irq_count); - -void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus); - -void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev); - -void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev); - -bool fsl_mc_is_root_dprc(struct device *dev); - -#endif /* _FSL_MC_MCBUS_H_ */ -- cgit v1.2.3-55-g7522 From 3ea73a4b7742d49621a369f1ce2c702c17bf83ca Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:31 +0300 Subject: staging: fsl-mc: remove dpmng API files dpmng.h & dpmng.c files expose an API of just one function which is only used by the bus driver. Move that single API in the bus source as static and remove the two files. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/Makefile | 1 - drivers/staging/fsl-mc/bus/dpmng.c | 74 --------------------------------- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 53 ++++++++++++++++++++++- drivers/staging/fsl-mc/include/dpmng.h | 67 ----------------------------- 4 files changed, 52 insertions(+), 143 deletions(-) delete mode 100644 drivers/staging/fsl-mc/bus/dpmng.c delete mode 100644 drivers/staging/fsl-mc/include/dpmng.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile index 659eccf52a4f..6df407edfade 100644 --- a/drivers/staging/fsl-mc/bus/Makefile +++ b/drivers/staging/fsl-mc/bus/Makefile @@ -11,7 +11,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \ mc-sys.o \ mc-io.o \ dprc.o \ - dpmng.o \ dprc-driver.o \ fsl-mc-allocator.o \ fsl-mc-msi.o \ diff --git a/drivers/staging/fsl-mc/bus/dpmng.c b/drivers/staging/fsl-mc/bus/dpmng.c deleted file mode 100644 index ad5d5bbec529..000000000000 --- a/drivers/staging/fsl-mc/bus/dpmng.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 "../include/mc-sys.h" -#include "../include/mc-cmd.h" -#include "../include/dpmng.h" - -#include "dpmng-cmd.h" - -/** - * mc_get_version() - Retrieves the Management Complex firmware - * version information - * @mc_io: Pointer to opaque I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' - * @mc_ver_info: Returned version information structure - * - * Return: '0' on Success; Error code otherwise. - */ -int mc_get_version(struct fsl_mc_io *mc_io, - u32 cmd_flags, - struct mc_version *mc_ver_info) -{ - struct mc_command cmd = { 0 }; - struct dpmng_rsp_get_version *rsp_params; - int err; - - /* prepare command */ - cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, - cmd_flags, - 0); - - /* send command to mc*/ - err = mc_send_command(mc_io, &cmd); - if (err) - return err; - - /* retrieve response parameters */ - rsp_params = (struct dpmng_rsp_get_version *)cmd.params; - mc_ver_info->revision = le32_to_cpu(rsp_params->revision); - mc_ver_info->major = le32_to_cpu(rsp_params->version_major); - mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor); - - return 0; -} -EXPORT_SYMBOL(mc_get_version); - diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 3dec3e991d86..75f8dc330f38 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,11 +20,12 @@ #include #include #include -#include "../include/dpmng.h" #include "../include/mc-sys.h" +#include "../include/mc-cmd.h" #include "fsl-mc-private.h" #include "dprc-cmd.h" +#include "dpmng-cmd.h" /** * Default DMA mask for devices on a fsl-mc bus @@ -59,6 +60,20 @@ struct fsl_mc_addr_translation_range { phys_addr_t start_phys_addr; }; +/** + * struct mc_version + * @major: Major version number: incremented on API compatibility changes + * @minor: Minor version number: incremented on API additions (that are + * backward compatible); reset when major version is incremented + * @revision: Internal revision number: incremented on implementation changes + * and/or bug fixes that have no impact on API + */ +struct mc_version { + u32 major; + u32 minor; + u32 revision; +}; + /** * fsl_mc_bus_match - device to driver matching callback * @dev: the fsl-mc device to match against @@ -237,6 +252,42 @@ void fsl_mc_driver_unregister(struct fsl_mc_driver *mc_driver) } EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister); +/** + * mc_get_version() - Retrieves the Management Complex firmware + * version information + * @mc_io: Pointer to opaque I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @mc_ver_info: Returned version information structure + * + * Return: '0' on Success; Error code otherwise. + */ +static int mc_get_version(struct fsl_mc_io *mc_io, + u32 cmd_flags, + struct mc_version *mc_ver_info) +{ + struct mc_command cmd = { 0 }; + struct dpmng_rsp_get_version *rsp_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, + cmd_flags, + 0); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpmng_rsp_get_version *)cmd.params; + mc_ver_info->revision = le32_to_cpu(rsp_params->revision); + mc_ver_info->major = le32_to_cpu(rsp_params->version_major); + mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor); + + return 0; +} + /** * fsl_mc_get_root_dprc - function to traverse to the root dprc */ diff --git a/drivers/staging/fsl-mc/include/dpmng.h b/drivers/staging/fsl-mc/include/dpmng.h deleted file mode 100644 index 170c07dd376a..000000000000 --- a/drivers/staging/fsl-mc/include/dpmng.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 __FSL_DPMNG_H -#define __FSL_DPMNG_H - -/* - * Management Complex General API - * Contains general API for the Management Complex firmware - */ - -struct fsl_mc_io; - -/** - * Management Complex firmware version information - */ -#define MC_VER_MAJOR 8 -#define MC_VER_MINOR 0 - -/** - * struct mc_version - * @major: Major version number: incremented on API compatibility changes - * @minor: Minor version number: incremented on API additions (that are - * backward compatible); reset when major version is incremented - * @revision: Internal revision number: incremented on implementation changes - * and/or bug fixes that have no impact on API - */ -struct mc_version { - u32 major; - u32 minor; - u32 revision; -}; - -int mc_get_version(struct fsl_mc_io *mc_io, - u32 cmd_flags, - struct mc_version *mc_ver_info); - -#endif /* __FSL_DPMNG_H */ -- cgit v1.2.3-55-g7522 From 409acdd0412e9343095d965a9228f6e6a83a416f Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:32 +0300 Subject: staging: fsl-mc: fix a few implicit includes Few files using byte order macros but did not explicitly included the required kernel header, so add it. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dpbp.c | 1 + drivers/staging/fsl-mc/bus/dpcon.c | 1 + drivers/staging/fsl-mc/bus/dpio/dpio.c | 1 + drivers/staging/fsl-mc/bus/dpmcp.c | 1 + drivers/staging/fsl-mc/bus/dprc.c | 1 + 5 files changed, 5 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index d9e450a6bad6..e92d887de716 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dpbp.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index eb713578b817..20df185aea5c 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dpcon.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index d81e0232f6c1..a18ca897ec3a 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -30,6 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../../include/mc-sys.h" #include "../../include/mc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index ad4c8b43f065..66011e86c805 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../include/mc-sys.h" #include "../include/mc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index a47f31d5ffe6..e5dfc335dc4e 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -29,6 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include "../include/mc.h" #include "../include/mc-sys.h" #include "../include/mc-cmd.h" -- cgit v1.2.3-55-g7522 From fab8ca582796796d869924839839dbc940367a3a Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:33 +0300 Subject: staging: fsl-mc: move mc-sys.h contents in the public header mc-sys.h contains the API to send commands to the MC and is used by drivers. Move it to the public headers and get rid of the mc-sys.h header. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 1 - drivers/staging/fsl-dpaa2/ethernet/dpni.c | 2 +- drivers/staging/fsl-mc/bus/dpbp.c | 2 +- drivers/staging/fsl-mc/bus/dpcon.c | 2 +- drivers/staging/fsl-mc/bus/dpio/dpio.c | 2 +- drivers/staging/fsl-mc/bus/dpmcp.c | 2 +- drivers/staging/fsl-mc/bus/dprc-driver.c | 2 +- drivers/staging/fsl-mc/bus/dprc.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 2 +- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 - drivers/staging/fsl-mc/bus/mc-io.c | 2 +- drivers/staging/fsl-mc/bus/mc-sys.c | 1 - drivers/staging/fsl-mc/include/mc-sys.h | 98 -------------------------- drivers/staging/fsl-mc/include/mc.h | 53 ++++++++++++++ 14 files changed, 61 insertions(+), 110 deletions(-) delete mode 100644 drivers/staging/fsl-mc/include/mc-sys.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 1f89274a03d3..b9a0a315e6fb 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -40,7 +40,6 @@ #include #include "../../fsl-mc/include/mc.h" -#include "../../fsl-mc/include/mc-sys.h" #include "dpaa2-eth.h" /* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c index 2c4b1a89c2c1..160eaf88a3ae 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c @@ -32,7 +32,7 @@ */ #include #include -#include "../../fsl-mc/include/mc-sys.h" +#include "../../fsl-mc/include/mc.h" #include "../../fsl-mc/include/mc-cmd.h" #include "dpni.h" #include "dpni-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index e92d887de716..b71467391a59 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "../include/mc-cmd.h" #include "../include/dpbp.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index 20df185aea5c..2272a9c45528 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "../include/mc-cmd.h" #include "../include/dpcon.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index a18ca897ec3a..48dce4af9363 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -31,7 +31,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../../include/mc-sys.h" +#include "../../include/mc.h" #include "../../include/mc-cmd.h" #include "dpio.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index 66011e86c805..7b3dd19a46ef 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "../include/mc-cmd.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 7c6c4ac9efb6..4cdd190a338b 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -13,7 +13,7 @@ #include #include #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "dprc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index e5dfc335dc4e..f93fe009fb18 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/dprc.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index 04ae2ccfe0b8..b37a6f48225f 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -10,7 +10,7 @@ #include #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 75f8dc330f38..166604e22952 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,7 +20,6 @@ #include #include #include -#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index ec2835fb2a83..35221a17858b 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -31,7 +31,7 @@ */ #include -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "fsl-mc-private.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index 4d82802b384d..c537bf8b5685 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -37,7 +37,6 @@ #include #include #include -#include "../include/mc-sys.h" #include "../include/mc-cmd.h" #include "../include/mc.h" diff --git a/drivers/staging/fsl-mc/include/mc-sys.h b/drivers/staging/fsl-mc/include/mc-sys.h deleted file mode 100644 index b5203707344a..000000000000 --- a/drivers/staging/fsl-mc/include/mc-sys.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * Interface of the I/O services to send MC commands to the MC hardware - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 _FSL_MC_SYS_H -#define _FSL_MC_SYS_H - -#include -#include -#include -#include - -/** - * Bit masks for a MC I/O object (struct fsl_mc_io) flags - */ -#define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001 - -struct mc_command; - -/** - * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command() - * @dev: device associated with this Mc I/O object - * @flags: flags for mc_send_command() - * @portal_size: MC command portal size in bytes - * @portal_phys_addr: MC command portal physical address - * @portal_virt_addr: MC command portal virtual address - * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal. - * - * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not - * set: - * @mutex: Mutex to serialize mc_send_command() calls that use the same MC - * portal, if the fsl_mc_io object was created with the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this - * fsl_mc_io object must be made only from non-atomic context. - * - * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is - * set: - * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC - * portal, if the fsl_mc_io object was created with the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this - * fsl_mc_io object can be made from atomic or non-atomic context. - */ -struct fsl_mc_io { - struct device *dev; - u16 flags; - u16 portal_size; - phys_addr_t portal_phys_addr; - void __iomem *portal_virt_addr; - struct fsl_mc_device *dpmcp_dev; - union { - /* - * This field is only meaningful if the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set - */ - struct mutex mutex; /* serializes mc_send_command() */ - - /* - * This field is only meaningful if the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set - */ - spinlock_t spinlock; /* serializes mc_send_command() */ - }; -}; - -int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); - -#endif /* _FSL_MC_SYS_H */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index d37e2c7ed55a..33bb3b8b641c 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -23,6 +23,7 @@ struct msi_domain_info; struct fsl_mc_device; struct fsl_mc_io; +struct mc_command; /** * struct fsl_mc_driver - MC object device driver object @@ -201,6 +202,58 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) +/** + * Bit masks for a MC I/O object (struct fsl_mc_io) flags + */ +#define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001 + +/** + * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command() + * @dev: device associated with this Mc I/O object + * @flags: flags for mc_send_command() + * @portal_size: MC command portal size in bytes + * @portal_phys_addr: MC command portal physical address + * @portal_virt_addr: MC command portal virtual address + * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal. + * + * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not + * set: + * @mutex: Mutex to serialize mc_send_command() calls that use the same MC + * portal, if the fsl_mc_io object was created with the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this + * fsl_mc_io object must be made only from non-atomic context. + * + * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is + * set: + * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC + * portal, if the fsl_mc_io object was created with the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this + * fsl_mc_io object can be made from atomic or non-atomic context. + */ +struct fsl_mc_io { + struct device *dev; + u16 flags; + u16 portal_size; + phys_addr_t portal_phys_addr; + void __iomem *portal_virt_addr; + struct fsl_mc_device *dpmcp_dev; + union { + /* + * This field is only meaningful if the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set + */ + struct mutex mutex; /* serializes mc_send_command() */ + + /* + * This field is only meaningful if the + * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set + */ + spinlock_t spinlock; /* serializes mc_send_command() */ + }; +}; + +int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); + #ifdef CONFIG_FSL_MC_BUS #define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) #else -- cgit v1.2.3-55-g7522 From d30a41dbcb79ba2918f07acd86e447802fd1b527 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:34 +0300 Subject: staging: fsl-mc: move mc-cmd.h contents in the public header mc-cmd.h contains some low level functions used to encode and decode commands to the MC. They are used by the drivers so move them to the public headers and get rid of the mc-cmd.h header. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-dpaa2/ethernet/dpni.c | 1 - drivers/staging/fsl-mc/bus/dpbp.c | 1 - drivers/staging/fsl-mc/bus/dpcon.c | 1 - drivers/staging/fsl-mc/bus/dpio/dpio.c | 1 - drivers/staging/fsl-mc/bus/dpmcp.c | 1 - drivers/staging/fsl-mc/bus/dprc.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 - drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 1 - drivers/staging/fsl-mc/bus/mc-sys.c | 1 - drivers/staging/fsl-mc/include/mc-cmd.h | 130 ------------------------------ drivers/staging/fsl-mc/include/mc.h | 95 +++++++++++++++++++++- 11 files changed, 94 insertions(+), 140 deletions(-) delete mode 100644 drivers/staging/fsl-mc/include/mc-cmd.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c index 160eaf88a3ae..5b9d4424e4fb 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c @@ -33,7 +33,6 @@ #include #include #include "../../fsl-mc/include/mc.h" -#include "../../fsl-mc/include/mc-cmd.h" #include "dpni.h" #include "dpni-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index b71467391a59..363730a80cbb 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-cmd.h" #include "../include/dpbp.h" #include "dpbp-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index 2272a9c45528..ca1da85c6dda 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-cmd.h" #include "../include/dpcon.h" #include "dpcon-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index 48dce4af9363..00eb22186f42 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -32,7 +32,6 @@ */ #include #include "../../include/mc.h" -#include "../../include/mc-cmd.h" #include "dpio.h" #include "dpio-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c index 7b3dd19a46ef..eea42f61af86 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-cmd.h" #include "dpmcp.h" #include "dpmcp-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index f93fe009fb18..138fe80577d8 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,7 +31,6 @@ */ #include #include "../include/mc.h" -#include "../include/mc-cmd.h" #include "../include/dprc.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 166604e22952..19606e8d25dd 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -20,7 +20,6 @@ #include #include #include -#include "../include/mc-cmd.h" #include "fsl-mc-private.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index 81dca7a3a317..2b64651bea90 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -16,7 +16,6 @@ #include #include #include -#include "../include/mc-cmd.h" #include "fsl-mc-private.h" /* diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index c537bf8b5685..a1704c3a6a78 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -37,7 +37,6 @@ #include #include #include -#include "../include/mc-cmd.h" #include "../include/mc.h" #include "dpmcp.h" diff --git a/drivers/staging/fsl-mc/include/mc-cmd.h b/drivers/staging/fsl-mc/include/mc-cmd.h deleted file mode 100644 index 2e08aa31b084..000000000000 --- a/drivers/staging/fsl-mc/include/mc-cmd.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 __FSL_MC_CMD_H -#define __FSL_MC_CMD_H - -#define MC_CMD_NUM_OF_PARAMS 7 - -struct mc_cmd_header { - u8 src_id; - u8 flags_hw; - u8 status; - u8 flags_sw; - __le16 token; - __le16 cmd_id; -}; - -struct mc_command { - u64 header; - u64 params[MC_CMD_NUM_OF_PARAMS]; -}; - -struct mc_rsp_create { - __le32 object_id; -}; - -struct mc_rsp_api_ver { - __le16 major_ver; - __le16 minor_ver; -}; - -enum mc_cmd_status { - MC_CMD_STATUS_OK = 0x0, /* Completed successfully */ - MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */ - MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */ - MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */ - MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */ - MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */ - MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */ - MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */ - MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */ - MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */ - MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */ - MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ -}; - -/* - * MC command flags - */ - -/* High priority flag */ -#define MC_CMD_FLAG_PRI 0x80 -/* Command completion flag */ -#define MC_CMD_FLAG_INTR_DIS 0x01 - -static inline u64 mc_encode_cmd_header(u16 cmd_id, - u32 cmd_flags, - u16 token) -{ - u64 header = 0; - struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header; - - hdr->cmd_id = cpu_to_le16(cmd_id); - hdr->token = cpu_to_le16(token); - hdr->status = MC_CMD_STATUS_READY; - if (cmd_flags & MC_CMD_FLAG_PRI) - hdr->flags_hw = MC_CMD_FLAG_PRI; - if (cmd_flags & MC_CMD_FLAG_INTR_DIS) - hdr->flags_sw = MC_CMD_FLAG_INTR_DIS; - - return header; -} - -static inline u16 mc_cmd_hdr_read_token(struct mc_command *cmd) -{ - struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; - u16 token = le16_to_cpu(hdr->token); - - return token; -} - -static inline u32 mc_cmd_read_object_id(struct mc_command *cmd) -{ - struct mc_rsp_create *rsp_params; - - rsp_params = (struct mc_rsp_create *)cmd->params; - return le32_to_cpu(rsp_params->object_id); -} - -static inline void mc_cmd_read_api_version(struct mc_command *cmd, - u16 *major_ver, - u16 *minor_ver) -{ - struct mc_rsp_api_ver *rsp_params; - - rsp_params = (struct mc_rsp_api_ver *)cmd->params; - *major_ver = le16_to_cpu(rsp_params->major_ver); - *minor_ver = le16_to_cpu(rsp_params->minor_ver); -} - -#endif /* __FSL_MC_CMD_H */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 33bb3b8b641c..38f87144324a 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -23,7 +23,6 @@ struct msi_domain_info; struct fsl_mc_device; struct fsl_mc_io; -struct mc_command; /** * struct fsl_mc_driver - MC object device driver object @@ -202,6 +201,100 @@ struct fsl_mc_device { #define to_fsl_mc_device(_dev) \ container_of(_dev, struct fsl_mc_device, dev) +#define MC_CMD_NUM_OF_PARAMS 7 + +struct mc_cmd_header { + u8 src_id; + u8 flags_hw; + u8 status; + u8 flags_sw; + __le16 token; + __le16 cmd_id; +}; + +struct mc_command { + u64 header; + u64 params[MC_CMD_NUM_OF_PARAMS]; +}; + +enum mc_cmd_status { + MC_CMD_STATUS_OK = 0x0, /* Completed successfully */ + MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */ + MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */ + MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */ + MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */ + MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */ + MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */ + MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */ + MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */ + MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */ + MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */ + MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ +}; + +/* + * MC command flags + */ + +/* High priority flag */ +#define MC_CMD_FLAG_PRI 0x80 +/* Command completion flag */ +#define MC_CMD_FLAG_INTR_DIS 0x01 + +static inline u64 mc_encode_cmd_header(u16 cmd_id, + u32 cmd_flags, + u16 token) +{ + u64 header = 0; + struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header; + + hdr->cmd_id = cpu_to_le16(cmd_id); + hdr->token = cpu_to_le16(token); + hdr->status = MC_CMD_STATUS_READY; + if (cmd_flags & MC_CMD_FLAG_PRI) + hdr->flags_hw = MC_CMD_FLAG_PRI; + if (cmd_flags & MC_CMD_FLAG_INTR_DIS) + hdr->flags_sw = MC_CMD_FLAG_INTR_DIS; + + return header; +} + +static inline u16 mc_cmd_hdr_read_token(struct mc_command *cmd) +{ + struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; + u16 token = le16_to_cpu(hdr->token); + + return token; +} + +struct mc_rsp_create { + __le32 object_id; +}; + +struct mc_rsp_api_ver { + __le16 major_ver; + __le16 minor_ver; +}; + +static inline u32 mc_cmd_read_object_id(struct mc_command *cmd) +{ + struct mc_rsp_create *rsp_params; + + rsp_params = (struct mc_rsp_create *)cmd->params; + return le32_to_cpu(rsp_params->object_id); +} + +static inline void mc_cmd_read_api_version(struct mc_command *cmd, + u16 *major_ver, + u16 *minor_ver) +{ + struct mc_rsp_api_ver *rsp_params; + + rsp_params = (struct mc_rsp_api_ver *)cmd->params; + *major_ver = le16_to_cpu(rsp_params->major_ver); + *minor_ver = le16_to_cpu(rsp_params->minor_ver); +} + /** * Bit masks for a MC I/O object (struct fsl_mc_io) flags */ -- cgit v1.2.3-55-g7522 From bd18c0c9c8ed77ad73301752d04cbdc3f0af3b77 Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 27 Jun 2017 17:41:35 +0300 Subject: staging: fsl-mc: make dprc.h header private dprc.h is only used in the mc bus driver so move it together with the sources thus making it private. Signed-off-by: Laurentiu Tudor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc.c | 2 +- drivers/staging/fsl-mc/bus/dprc.h | 268 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/bus/fsl-mc-private.h | 1 + drivers/staging/fsl-mc/include/dprc.h | 268 ---------------------------- drivers/staging/fsl-mc/include/mc.h | 1 - 5 files changed, 270 insertions(+), 270 deletions(-) create mode 100644 drivers/staging/fsl-mc/bus/dprc.h delete mode 100644 drivers/staging/fsl-mc/include/dprc.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c index 138fe80577d8..6f6c65a42166 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -31,7 +31,7 @@ */ #include #include "../include/mc.h" -#include "../include/dprc.h" +#include "dprc.h" #include "dprc-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.h b/drivers/staging/fsl-mc/bus/dprc.h new file mode 100644 index 000000000000..21295e4feb04 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dprc.h @@ -0,0 +1,268 @@ +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 _FSL_DPRC_H +#define _FSL_DPRC_H + +/* + * Data Path Resource Container API + * Contains DPRC API for managing and querying DPAA resources + */ + +struct fsl_mc_io; +struct fsl_mc_obj_desc; + +int dprc_open(struct fsl_mc_io *mc_io, + u32 cmd_flags, + int container_id, + u16 *token); + +int dprc_close(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token); + +/* IRQ */ + +/* IRQ index */ +#define DPRC_IRQ_INDEX 0 + +/* Number of dprc's IRQs */ +#define DPRC_NUM_OF_IRQS 1 + +/* DPRC IRQ events */ + +/* IRQ event - Indicates that a new object added to the container */ +#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001 +/* IRQ event - Indicates that an object was removed from the container */ +#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002 +/* IRQ event - Indicates that resources added to the container */ +#define DPRC_IRQ_EVENT_RES_ADDED 0x00000004 +/* IRQ event - Indicates that resources removed from the container */ +#define DPRC_IRQ_EVENT_RES_REMOVED 0x00000008 +/* + * IRQ event - Indicates that one of the descendant containers that opened by + * this container is destroyed + */ +#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010 + +/* + * IRQ event - Indicates that on one of the container's opened object is + * destroyed + */ +#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020 + +/* Irq event - Indicates that object is created at the container */ +#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040 + +/** + * struct dprc_irq_cfg - IRQ configuration + * @paddr: Address that must be written to signal a message-based interrupt + * @val: Value to write into irq_addr address + * @irq_num: A user defined number associated with this IRQ + */ +struct dprc_irq_cfg { + phys_addr_t paddr; + u32 val; + int irq_num; +}; + +int dprc_set_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + int *type, + struct dprc_irq_cfg *irq_cfg); + +int dprc_set_irq_enable(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u8 en); + +int dprc_get_irq_enable(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u8 *en); + +int dprc_set_irq_mask(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 mask); + +int dprc_get_irq_mask(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 *mask); + +int dprc_get_irq_status(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 *status); + +int dprc_clear_irq_status(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 irq_index, + u32 status); + +/** + * struct dprc_attributes - Container attributes + * @container_id: Container's ID + * @icid: Container's ICID + * @portal_id: Container's portal ID + * @options: Container's options as set at container's creation + */ +struct dprc_attributes { + int container_id; + u16 icid; + int portal_id; + u64 options; +}; + +int dprc_get_attributes(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + struct dprc_attributes *attributes); + +int dprc_get_obj_count(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + int *obj_count); + +int dprc_get_obj(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + int obj_index, + struct fsl_mc_obj_desc *obj_desc); + +int dprc_get_obj_desc(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + struct fsl_mc_obj_desc *obj_desc); + +int dprc_set_obj_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 irq_index, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_obj_irq(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 irq_index, + int *type, + struct dprc_irq_cfg *irq_cfg); + +int dprc_get_res_count(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *type, + int *res_count); + +/** + * enum dprc_iter_status - Iteration status + * @DPRC_ITER_STATUS_FIRST: Perform first iteration + * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed + * @DPRC_ITER_STATUS_LAST: Indicates last iteration + */ +enum dprc_iter_status { + DPRC_ITER_STATUS_FIRST = 0, + DPRC_ITER_STATUS_MORE = 1, + DPRC_ITER_STATUS_LAST = 2 +}; + +/* Region flags */ +/* Cacheable - Indicates that region should be mapped as cacheable */ +#define DPRC_REGION_CACHEABLE 0x00000001 + +/** + * enum dprc_region_type - Region type + * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region + * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region + */ +enum dprc_region_type { + DPRC_REGION_TYPE_MC_PORTAL, + DPRC_REGION_TYPE_QBMAN_PORTAL +}; + +/** + * struct dprc_region_desc - Mappable region descriptor + * @base_offset: Region offset from region's base address. + * For DPMCP and DPRC objects, region base is offset from SoC MC portals + * base address; For DPIO, region base is offset from SoC QMan portals + * base address + * @size: Region size (in bytes) + * @flags: Region attributes + * @type: Portal region type + */ +struct dprc_region_desc { + u32 base_offset; + u32 size; + u32 flags; + enum dprc_region_type type; +}; + +int dprc_get_obj_region(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + char *obj_type, + int obj_id, + u8 region_index, + struct dprc_region_desc *region_desc); + +int dprc_get_api_version(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 *major_ver, + u16 *minor_ver); + +int dprc_get_container_id(struct fsl_mc_io *mc_io, + u32 cmd_flags, + int *container_id); + +#endif /* _FSL_DPRC_H */ + diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/staging/fsl-mc/bus/fsl-mc-private.h index e5839992e128..62d398947605 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h @@ -11,6 +11,7 @@ #define _FSL_MC_PRIVATE_H_ #include "../include/mc.h" +#include "dprc.h" #include /** diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h deleted file mode 100644 index 21295e4feb04..000000000000 --- a/drivers/staging/fsl-mc/include/dprc.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright 2013-2016 Freescale Semiconductor Inc. - * - * 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 the above-listed copyright holders nor the - * names of any contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * 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 HOLDERS 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 _FSL_DPRC_H -#define _FSL_DPRC_H - -/* - * Data Path Resource Container API - * Contains DPRC API for managing and querying DPAA resources - */ - -struct fsl_mc_io; -struct fsl_mc_obj_desc; - -int dprc_open(struct fsl_mc_io *mc_io, - u32 cmd_flags, - int container_id, - u16 *token); - -int dprc_close(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token); - -/* IRQ */ - -/* IRQ index */ -#define DPRC_IRQ_INDEX 0 - -/* Number of dprc's IRQs */ -#define DPRC_NUM_OF_IRQS 1 - -/* DPRC IRQ events */ - -/* IRQ event - Indicates that a new object added to the container */ -#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001 -/* IRQ event - Indicates that an object was removed from the container */ -#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002 -/* IRQ event - Indicates that resources added to the container */ -#define DPRC_IRQ_EVENT_RES_ADDED 0x00000004 -/* IRQ event - Indicates that resources removed from the container */ -#define DPRC_IRQ_EVENT_RES_REMOVED 0x00000008 -/* - * IRQ event - Indicates that one of the descendant containers that opened by - * this container is destroyed - */ -#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010 - -/* - * IRQ event - Indicates that on one of the container's opened object is - * destroyed - */ -#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020 - -/* Irq event - Indicates that object is created at the container */ -#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040 - -/** - * struct dprc_irq_cfg - IRQ configuration - * @paddr: Address that must be written to signal a message-based interrupt - * @val: Value to write into irq_addr address - * @irq_num: A user defined number associated with this IRQ - */ -struct dprc_irq_cfg { - phys_addr_t paddr; - u32 val; - int irq_num; -}; - -int dprc_set_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - int *type, - struct dprc_irq_cfg *irq_cfg); - -int dprc_set_irq_enable(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u8 en); - -int dprc_get_irq_enable(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u8 *en); - -int dprc_set_irq_mask(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 mask); - -int dprc_get_irq_mask(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 *mask); - -int dprc_get_irq_status(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 *status); - -int dprc_clear_irq_status(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - u8 irq_index, - u32 status); - -/** - * struct dprc_attributes - Container attributes - * @container_id: Container's ID - * @icid: Container's ICID - * @portal_id: Container's portal ID - * @options: Container's options as set at container's creation - */ -struct dprc_attributes { - int container_id; - u16 icid; - int portal_id; - u64 options; -}; - -int dprc_get_attributes(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - struct dprc_attributes *attributes); - -int dprc_get_obj_count(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - int *obj_count); - -int dprc_get_obj(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - int obj_index, - struct fsl_mc_obj_desc *obj_desc); - -int dprc_get_obj_desc(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - struct fsl_mc_obj_desc *obj_desc); - -int dprc_set_obj_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 irq_index, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_obj_irq(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 irq_index, - int *type, - struct dprc_irq_cfg *irq_cfg); - -int dprc_get_res_count(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *type, - int *res_count); - -/** - * enum dprc_iter_status - Iteration status - * @DPRC_ITER_STATUS_FIRST: Perform first iteration - * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed - * @DPRC_ITER_STATUS_LAST: Indicates last iteration - */ -enum dprc_iter_status { - DPRC_ITER_STATUS_FIRST = 0, - DPRC_ITER_STATUS_MORE = 1, - DPRC_ITER_STATUS_LAST = 2 -}; - -/* Region flags */ -/* Cacheable - Indicates that region should be mapped as cacheable */ -#define DPRC_REGION_CACHEABLE 0x00000001 - -/** - * enum dprc_region_type - Region type - * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region - * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region - */ -enum dprc_region_type { - DPRC_REGION_TYPE_MC_PORTAL, - DPRC_REGION_TYPE_QBMAN_PORTAL -}; - -/** - * struct dprc_region_desc - Mappable region descriptor - * @base_offset: Region offset from region's base address. - * For DPMCP and DPRC objects, region base is offset from SoC MC portals - * base address; For DPIO, region base is offset from SoC QMan portals - * base address - * @size: Region size (in bytes) - * @flags: Region attributes - * @type: Portal region type - */ -struct dprc_region_desc { - u32 base_offset; - u32 size; - u32 flags; - enum dprc_region_type type; -}; - -int dprc_get_obj_region(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 token, - char *obj_type, - int obj_id, - u8 region_index, - struct dprc_region_desc *region_desc); - -int dprc_get_api_version(struct fsl_mc_io *mc_io, - u32 cmd_flags, - u16 *major_ver, - u16 *minor_ver); - -int dprc_get_container_id(struct fsl_mc_io *mc_io, - u32 cmd_flags, - int *container_id); - -#endif /* _FSL_DPRC_H */ - diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 38f87144324a..aafe63a21f49 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -14,7 +14,6 @@ #include #include #include -#include "../include/dprc.h" #define FSL_MC_VENDOR_FREESCALE 0x1957 -- cgit v1.2.3-55-g7522 From 878c33a78811f90795f17333bc3a7c819a1589a7 Mon Sep 17 00:00:00 2001 From: Quytelda Kahja Date: Tue, 27 Jun 2017 14:35:46 -0700 Subject: Staging: ion: fix code style warning from NULL comparisons This patch replaces several instances where a pointer is compared to NULL (i.e., `ptr == NULL`) with `!ptr`, which is preferred. Signed-off-by: Quytelda Kahja Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 43ecb4af1b41..93e2c90fa77d 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -103,7 +103,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, goto err2; } - if (buffer->sg_table == NULL) { + if (!buffer->sg_table) { WARN_ONCE(1, "This heap needs to set the sgtable"); ret = -EINVAL; goto err1; @@ -161,7 +161,7 @@ static void *ion_buffer_kmap_get(struct ion_buffer *buffer) return buffer->vaddr; } vaddr = buffer->heap->ops->map_kernel(buffer->heap, buffer); - if (WARN_ONCE(vaddr == NULL, + if (WARN_ONCE(!vaddr, "heap->ops->map_kernel should return ERR_PTR on error")) return ERR_PTR(-EINVAL); if (IS_ERR(vaddr)) @@ -425,7 +425,7 @@ int ion_alloc(size_t len, unsigned int heap_id_mask, unsigned int flags) } up_read(&dev->lock); - if (buffer == NULL) + if (!buffer) return -ENODEV; if (IS_ERR(buffer)) -- cgit v1.2.3-55-g7522 From 9b326dfce12afb429915c63f5a3df4afa4bea957 Mon Sep 17 00:00:00 2001 From: Denis Petrovic Date: Sun, 25 Jun 2017 14:52:48 +0200 Subject: staging: lustre: replace kmalloc with kmalloc_array This patch fixes the following checkpatch.pl warning: WARNING: Prefer kmalloc_array over kmalloc with multiply Signed-off-by: Denis Petrovic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c index 75eb84e7f0f8..a5a94788f11f 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c @@ -57,8 +57,9 @@ int cfs_tracefile_init_arch(void) memset(cfs_trace_data, 0, sizeof(cfs_trace_data)); for (i = 0; i < CFS_TCD_TYPE_MAX; i++) { cfs_trace_data[i] = - kmalloc(sizeof(union cfs_trace_data_union) * - num_possible_cpus(), GFP_KERNEL); + kmalloc_array(num_possible_cpus(), + sizeof(union cfs_trace_data_union), + GFP_KERNEL); if (!cfs_trace_data[i]) goto out; } -- cgit v1.2.3-55-g7522