diff options
215 files changed, 7349 insertions, 7987 deletions
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c index e67bb912bd19..253684ebc572 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c @@ -28,7 +28,6 @@ #include <linux/iio/buffer.h> #include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> -#include "../common/hid-sensors/hid-sensor-attributes.h" #include "../common/hid-sensors/hid-sensor-trigger.h" /*Format: HID-SENSOR-usage_id_in_hex*/ @@ -44,7 +43,7 @@ enum accel_3d_channel { struct accel_3d_state { struct hid_sensor_hub_callbacks callbacks; - struct hid_sensor_iio_common common_attributes; + struct hid_sensor_common common_attributes; struct hid_sensor_hub_attribute_info accel[ACCEL_3D_CHANNEL_MAX]; u32 accel_val[ACCEL_3D_CHANNEL_MAX]; }; diff --git a/drivers/iio/adc/lp8788_adc.c b/drivers/iio/adc/lp8788_adc.c index a93aaf0bb841..f8ae81cae9cf 100644 --- a/drivers/iio/adc/lp8788_adc.c +++ b/drivers/iio/adc/lp8788_adc.c @@ -179,7 +179,7 @@ static int lp8788_iio_map_register(struct iio_dev *indio_dev, ret = iio_map_array_register(indio_dev, map); if (ret) { - dev_err(adc->lp->dev, "iio map err: %d\n", ret); + dev_err(&indio_dev->dev, "iio map err: %d\n", ret); return ret; } @@ -214,7 +214,7 @@ static int __devinit lp8788_adc_probe(struct platform_device *pdev) mutex_init(&adc->lock); - indio_dev->dev.parent = lp->dev; + indio_dev->dev.parent = &pdev->dev; indio_dev->name = pdev->name; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->info = &lp8788_adc_info; @@ -223,7 +223,7 @@ static int __devinit lp8788_adc_probe(struct platform_device *pdev) ret = iio_device_register(indio_dev); if (ret) { - dev_err(lp->dev, "iio dev register err: %d\n", ret); + dev_err(&pdev->dev, "iio dev register err: %d\n", ret); goto err_iio_device; } diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c index 31f3485303d0..aac572290cbf 100644 --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c @@ -39,6 +39,7 @@ #include <linux/iio/driver.h> #include <linux/iio/kfifo_buf.h> #include <linux/iio/trigger_consumer.h> +#include <linux/iio/triggered_buffer.h> #define MAX1363_SETUP_BYTE(a) ((a) | 0x80) @@ -55,7 +56,7 @@ #define MAX1363_SETUP_POWER_UP_INT_REF 0x10 #define MAX1363_SETUP_POWER_DOWN_INT_REF 0x00 -/* think about includeing max11600 etc - more settings */ +/* think about including max11600 etc - more settings */ #define MAX1363_SETUP_EXT_CLOCK 0x08 #define MAX1363_SETUP_INT_CLOCK 0x00 #define MAX1363_SETUP_UNIPOLAR 0x00 @@ -86,7 +87,7 @@ /* max123{6-9} only */ #define MAX1236_SCAN_MID_TO_CHANNEL 0x40 -/* max1363 only - merely part of channel selects or don't care for others*/ +/* max1363 only - merely part of channel selects or don't care for others */ #define MAX1363_CONFIG_EN_MON_MODE_READ 0x18 #define MAX1363_CHANNEL_SEL(a) ((a) << 1) @@ -133,7 +134,7 @@ enum max1363_modes { * @mode_list: array of available scan modes * @default_mode: the scan mode in which the chip starts up * @int_vref_mv: the internal reference voltage - * @num_channels: number of channels + * @num_modes: number of modes * @bits: accuracy of the adc in bits */ struct max1363_chip_info { @@ -152,7 +153,7 @@ struct max1363_chip_info { * @client: i2c_client * @setupbyte: cache of current device setup byte * @configbyte: cache of current device config byte - * @chip_info: chip model specific constants, available modes etc + * @chip_info: chip model specific constants, available modes, etc. * @current_mode: the scan mode of this chip * @requestedmask: a valid requested set of channels * @reg: supply regulator @@ -293,7 +294,7 @@ static const struct max1363_mode max1363_mode_table[] = { static const struct max1363_mode *max1363_match_mode(const unsigned long *mask, -const struct max1363_chip_info *ci) + const struct max1363_chip_info *ci) { int i; if (mask) @@ -1394,7 +1395,7 @@ static int max1363_initial_setup(struct max1363_state *st) | MAX1363_SETUP_UNIPOLAR | MAX1363_SETUP_NORESET; - /* Set scan mode writes the config anyway so wait until then*/ + /* Set scan mode writes the config anyway so wait until then */ st->setupbyte = MAX1363_SETUP_BYTE(st->setupbyte); st->current_mode = &max1363_mode_table[st->chip_info->default_mode]; st->configbyte = MAX1363_CONFIG_BYTE(st->configbyte); @@ -1423,7 +1424,6 @@ static int __devinit max1363_alloc_scan_masks(struct iio_dev *indio_dev) return 0; } - static irqreturn_t max1363_trigger_handler(int irq, void *p) { struct iio_poll_func *pf = p; @@ -1483,48 +1483,6 @@ static const struct iio_buffer_setup_ops max1363_buffered_setup_ops = { .predisable = &iio_triggered_buffer_predisable, }; -static int max1363_register_buffered_funcs_and_init(struct iio_dev *indio_dev) -{ - struct max1363_state *st = iio_priv(indio_dev); - int ret = 0; - - indio_dev->buffer = iio_kfifo_allocate(indio_dev); - if (!indio_dev->buffer) { - ret = -ENOMEM; - goto error_ret; - } - indio_dev->pollfunc = iio_alloc_pollfunc(NULL, - &max1363_trigger_handler, - IRQF_ONESHOT, - indio_dev, - "%s_consumer%d", - st->client->name, - indio_dev->id); - if (indio_dev->pollfunc == NULL) { - ret = -ENOMEM; - goto error_deallocate_sw_rb; - } - /* Buffer functions - here trigger setup related */ - indio_dev->setup_ops = &max1363_buffered_setup_ops; - - /* Flag that polled buffering is possible */ - indio_dev->modes |= INDIO_BUFFER_TRIGGERED; - - return 0; - -error_deallocate_sw_rb: - iio_kfifo_free(indio_dev->buffer); -error_ret: - return ret; -} - -static void max1363_buffer_cleanup(struct iio_dev *indio_dev) -{ - /* ensure that the trigger has been detached */ - iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_kfifo_free(indio_dev->buffer); -} - static int __devinit max1363_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1564,7 +1522,7 @@ static int __devinit max1363_probe(struct i2c_client *client, if (ret) goto error_disable_reg; - /* Estabilish that the iio_dev is a child of the i2c device */ + /* Establish that the iio_dev is a child of the i2c device */ indio_dev->dev.parent = &client->dev; indio_dev->name = id->name; indio_dev->channels = st->chip_info->channels; @@ -1577,16 +1535,11 @@ static int __devinit max1363_probe(struct i2c_client *client, if (ret < 0) goto error_free_available_scan_masks; - ret = max1363_register_buffered_funcs_and_init(indio_dev); + ret = iio_triggered_buffer_setup(indio_dev, NULL, + &max1363_trigger_handler, &max1363_buffered_setup_ops); if (ret) goto error_free_available_scan_masks; - ret = iio_buffer_register(indio_dev, - st->chip_info->channels, - st->chip_info->num_channels); - if (ret) - goto error_cleanup_buffer; - if (client->irq) { ret = request_threaded_irq(st->client->irq, NULL, @@ -1608,9 +1561,7 @@ error_free_irq: if (client->irq) free_irq(st->client->irq, indio_dev); error_uninit_buffer: - iio_buffer_unregister(indio_dev); -error_cleanup_buffer: - max1363_buffer_cleanup(indio_dev); + iio_triggered_buffer_cleanup(indio_dev); error_free_available_scan_masks: kfree(indio_dev->available_scan_masks); error_disable_reg: @@ -1633,8 +1584,7 @@ static int __devexit max1363_remove(struct i2c_client *client) iio_device_unregister(indio_dev); if (client->irq) free_irq(st->client->irq, indio_dev); - iio_buffer_unregister(indio_dev); - max1363_buffer_cleanup(indio_dev); + iio_triggered_buffer_cleanup(indio_dev); kfree(indio_dev->available_scan_masks); regulator_disable(st->reg); regulator_put(st->reg); diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c index 75374955caba..75b54730a963 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c @@ -25,7 +25,6 @@ #include <linux/hid-sensor-hub.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> -#include "hid-sensor-attributes.h" static int pow_10(unsigned power) { @@ -114,7 +113,7 @@ static u32 convert_to_vtf_format(int size, int exp, int val1, int val2) return value; } -int hid_sensor_read_samp_freq_value(struct hid_sensor_iio_common *st, +int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, int *val1, int *val2) { s32 value; @@ -141,7 +140,7 @@ int hid_sensor_read_samp_freq_value(struct hid_sensor_iio_common *st, } EXPORT_SYMBOL(hid_sensor_read_samp_freq_value); -int hid_sensor_write_samp_freq_value(struct hid_sensor_iio_common *st, +int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st, int val1, int val2) { s32 value; @@ -169,7 +168,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_iio_common *st, } EXPORT_SYMBOL(hid_sensor_write_samp_freq_value); -int hid_sensor_read_raw_hyst_value(struct hid_sensor_iio_common *st, +int hid_sensor_read_raw_hyst_value(struct hid_sensor_common *st, int *val1, int *val2) { s32 value; @@ -191,7 +190,7 @@ int hid_sensor_read_raw_hyst_value(struct hid_sensor_iio_common *st, } EXPORT_SYMBOL(hid_sensor_read_raw_hyst_value); -int hid_sensor_write_raw_hyst_value(struct hid_sensor_iio_common *st, +int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st, int val1, int val2) { s32 value; @@ -212,7 +211,7 @@ EXPORT_SYMBOL(hid_sensor_write_raw_hyst_value); int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev, u32 usage_id, - struct hid_sensor_iio_common *st) + struct hid_sensor_common *st) { sensor_hub_input_get_attribute_info(hsdev, diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.h b/drivers/iio/common/hid-sensors/hid-sensor-attributes.h deleted file mode 100644 index a4676a0c3de5..000000000000 --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * HID Sensors Driver - * Copyright (c) 2012, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * 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 St - Fifth Floor, Boston, MA 02110-1301 USA. - * - */ -#ifndef _HID_SENSORS_ATTRIBUTES_H -#define _HID_SENSORS_ATTRIBUTES_H - -/* Common hid sensor iio structure */ -struct hid_sensor_iio_common { - struct hid_sensor_hub_device *hsdev; - struct platform_device *pdev; - unsigned usage_id; - bool data_ready; - struct hid_sensor_hub_attribute_info poll; - struct hid_sensor_hub_attribute_info report_state; - struct hid_sensor_hub_attribute_info power_state; - struct hid_sensor_hub_attribute_info sensitivity; -}; - -/*Convert from hid unit expo to regular exponent*/ -static inline int hid_sensor_convert_exponent(int unit_expo) -{ - if (unit_expo < 0x08) - return unit_expo; - else if (unit_expo <= 0x0f) - return -(0x0f-unit_expo+1); - else - return 0; -} - -int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev, - u32 usage_id, - struct hid_sensor_iio_common *st); -int hid_sensor_write_raw_hyst_value(struct hid_sensor_iio_common *st, - int val1, int val2); -int hid_sensor_read_raw_hyst_value(struct hid_sensor_iio_common *st, - int *val1, int *val2); -int hid_sensor_write_samp_freq_value(struct hid_sensor_iio_common *st, - int val1, int val2); -int hid_sensor_read_samp_freq_value(struct hid_sensor_iio_common *st, - int *val1, int *val2); - -#endif diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index d60198a6ca29..7a525a91105d 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c @@ -26,13 +26,12 @@ #include <linux/iio/iio.h> #include <linux/iio/trigger.h> #include <linux/iio/sysfs.h> -#include "hid-sensor-attributes.h" #include "hid-sensor-trigger.h" static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, bool state) { - struct hid_sensor_iio_common *st = trig->private_data; + struct hid_sensor_common *st = trig->private_data; int state_val; state_val = state ? 1 : 0; @@ -64,7 +63,7 @@ static const struct iio_trigger_ops hid_sensor_trigger_ops = { }; int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, - struct hid_sensor_iio_common *attrb) + struct hid_sensor_common *attrb) { int ret; struct iio_trigger *trig; diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.h b/drivers/iio/common/hid-sensors/hid-sensor-trigger.h index fd982971b1b8..9a8731478eda 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.h +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.h @@ -20,7 +20,7 @@ #define _HID_SENSOR_TRIGGER_H int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, - struct hid_sensor_iio_common *attrb); + struct hid_sensor_common *attrb); void hid_sensor_remove_trigger(struct iio_dev *indio_dev); #endif diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c index 4c8b158e40e1..1a64f88d1e89 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c @@ -28,7 +28,6 @@ #include <linux/iio/buffer.h> #include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> -#include "../common/hid-sensors/hid-sensor-attributes.h" #include "../common/hid-sensors/hid-sensor-trigger.h" /*Format: HID-SENSOR-usage_id_in_hex*/ @@ -44,7 +43,7 @@ enum gyro_3d_channel { struct gyro_3d_state { struct hid_sensor_hub_callbacks callbacks; - struct hid_sensor_iio_common common_attributes; + struct hid_sensor_common common_attributes; struct hid_sensor_hub_attribute_info gyro[GYRO_3D_CHANNEL_MAX]; u32 gyro_val[GYRO_3D_CHANNEL_MAX]; }; diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index 23eeeef64e84..6ab987a13c79 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -28,7 +28,6 @@ #include <linux/iio/buffer.h> #include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> -#include "../common/hid-sensors/hid-sensor-attributes.h" #include "../common/hid-sensors/hid-sensor-trigger.h" /*Format: HID-SENSOR-usage_id_in_hex*/ @@ -39,7 +38,7 @@ struct als_state { struct hid_sensor_hub_callbacks callbacks; - struct hid_sensor_iio_common common_attributes; + struct hid_sensor_common common_attributes; struct hid_sensor_hub_attribute_info als_illum; u32 illum; }; diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c index 8e75eb76ccd9..28026e2ab06b 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c @@ -28,7 +28,6 @@ #include <linux/iio/buffer.h> #include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> -#include "../common/hid-sensors/hid-sensor-attributes.h" #include "../common/hid-sensors/hid-sensor-trigger.h" /*Format: HID-SENSOR-usage_id_in_hex*/ @@ -44,7 +43,7 @@ enum magn_3d_channel { struct magn_3d_state { struct hid_sensor_hub_callbacks callbacks; - struct hid_sensor_iio_common common_attributes; + struct hid_sensor_common common_attributes; struct hid_sensor_hub_attribute_info magn[MAGN_3D_CHANNEL_MAX]; u32 magn_val[MAGN_3D_CHANNEL_MAX]; }; diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index d0cea02b5dfc..eed335c16cb0 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1165,4 +1165,20 @@ config RTC_DRV_SNVS This driver can also be built as a module, if so, the module will be called "rtc-snvs". +comment "HID Sensor RTC drivers" + +config RTC_DRV_HID_SENSOR_TIME + tristate "HID Sensor Time" + depends on USB_HID + select IIO + select HID_SENSOR_HUB + select HID_SENSOR_IIO_COMMON + help + Say yes here to build support for the HID Sensors of type Time. + This drivers makes such sensors available as RTCs. + + If this driver is compiled as a module, it will be named + rtc-hid-sensor-time. + + endif # RTC_CLASS diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index c3f62c80dc06..63be277d9ff6 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_RTC_DRV_EM3027) += rtc-em3027.o obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o obj-$(CONFIG_RTC_DRV_FM3130) += rtc-fm3130.o obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o +obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o obj-$(CONFIG_RTC_DRV_IMXDI) += rtc-imxdi.o obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c new file mode 100644 index 000000000000..0438c9ee9a3b --- /dev/null +++ b/drivers/rtc/rtc-hid-sensor-time.c @@ -0,0 +1,291 @@ +/* + * HID Sensor Time Driver + * Copyright (c) 2012, Alexander Holler. + * + * 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, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +#include <linux/device.h> +#include <linux/platform_device.h> +#include <linux/module.h> +#include <linux/hid-sensor-hub.h> +#include <linux/iio/iio.h> +#include <linux/rtc.h> + +/* Format: HID-SENSOR-usage_id_in_hex */ +/* Usage ID from spec for Time: 0x2000A0 */ +#define DRIVER_NAME "HID-SENSOR-2000a0" /* must be lowercase */ + +enum hid_time_channel { + CHANNEL_SCAN_INDEX_YEAR, + CHANNEL_SCAN_INDEX_MONTH, + CHANNEL_SCAN_INDEX_DAY, + CHANNEL_SCAN_INDEX_HOUR, + CHANNEL_SCAN_INDEX_MINUTE, + CHANNEL_SCAN_INDEX_SECOND, + TIME_RTC_CHANNEL_MAX, +}; + +struct hid_time_state { + struct hid_sensor_hub_callbacks callbacks; + struct hid_sensor_common common_attributes; + struct hid_sensor_hub_attribute_info info[TIME_RTC_CHANNEL_MAX]; + struct rtc_time last_time; + spinlock_t lock_last_time; + struct completion comp_last_time; + struct rtc_time time_buf; + struct rtc_device *rtc; +}; + +static const u32 hid_time_addresses[TIME_RTC_CHANNEL_MAX] = { + HID_USAGE_SENSOR_TIME_YEAR, + HID_USAGE_SENSOR_TIME_MONTH, + HID_USAGE_SENSOR_TIME_DAY, + HID_USAGE_SENSOR_TIME_HOUR, + HID_USAGE_SENSOR_TIME_MINUTE, + HID_USAGE_SENSOR_TIME_SECOND, +}; + +/* Channel names for verbose error messages */ +static const char * const hid_time_channel_names[TIME_RTC_CHANNEL_MAX] = { + "year", "month", "day", "hour", "minute", "second", +}; + +/* Callback handler to send event after all samples are received and captured */ +static int hid_time_proc_event(struct hid_sensor_hub_device *hsdev, + unsigned usage_id, void *priv) +{ + unsigned long flags; + struct hid_time_state *time_state = platform_get_drvdata(priv); + + spin_lock_irqsave(&time_state->lock_last_time, flags); + time_state->last_time = time_state->time_buf; + spin_unlock_irqrestore(&time_state->lock_last_time, flags); + complete(&time_state->comp_last_time); + return 0; +} + +static int hid_time_capture_sample(struct hid_sensor_hub_device *hsdev, + unsigned usage_id, size_t raw_len, + char *raw_data, void *priv) +{ + struct hid_time_state *time_state = platform_get_drvdata(priv); + struct rtc_time *time_buf = &time_state->time_buf; + + switch (usage_id) { + case HID_USAGE_SENSOR_TIME_YEAR: + time_buf->tm_year = *(u8 *)raw_data; + if (time_buf->tm_year < 70) + /* assume we are in 1970...2069 */ + time_buf->tm_year += 100; + break; + case HID_USAGE_SENSOR_TIME_MONTH: + /* sensor sending the month as 1-12, we need 0-11 */ + time_buf->tm_mon = *(u8 *)raw_data-1; + break; + case HID_USAGE_SENSOR_TIME_DAY: + time_buf->tm_mday = *(u8 *)raw_data; + break; + case HID_USAGE_SENSOR_TIME_HOUR: + time_buf->tm_hour = *(u8 *)raw_data; + break; + case HID_USAGE_SENSOR_TIME_MINUTE: + time_buf->tm_min = *(u8 *)raw_data; + break; + case HID_USAGE_SENSOR_TIME_SECOND: + time_buf->tm_sec = *(u8 *)raw_data; + break; + default: + return -EINVAL; + } + return 0; +} + +/* small helper, haven't found any other way */ +static const char *hid_time_attrib_name(u32 attrib_id) +{ + static const char unknown[] = "unknown"; + unsigned i; + + for (i = 0; i < TIME_RTC_CHANNEL_MAX; ++i) { + if (hid_time_addresses[i] == attrib_id) + return hid_time_channel_names[i]; + } + return unknown; /* should never happen */ +} + +static int hid_time_parse_report(struct platform_device *pdev, + struct hid_sensor_hub_device *hsdev, + unsigned usage_id, + struct hid_time_state *time_state) +{ + int report_id, i; + + for (i = 0; i < TIME_RTC_CHANNEL_MAX; ++i) + if (sensor_hub_input_get_attribute_info(hsdev, + HID_INPUT_REPORT, usage_id, + hid_time_addresses[i], + &time_state->info[i]) < 0) + return -EINVAL; + /* Check the (needed) attributes for sanity */ + report_id = time_state->info[0].report_id; + if (report_id < 0) { + dev_err(&pdev->dev, "bad report ID!\n"); + return -EINVAL; + } + for (i = 0; i < TIME_RTC_CHANNEL_MAX; ++i) { + if (time_state->info[i].report_id != report_id) { + dev_err(&pdev->dev, + "not all needed attributes inside the same report!\n"); + return -EINVAL; + } + if (time_state->info[i].size != 1) { + dev_err(&pdev->dev, + "attribute '%s' not 8 bits wide!\n", + hid_time_attrib_name( + time_state->info[i].attrib_id)); + return -EINVAL; + } + if (time_state->info[i].units != + HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED && + /* allow attribute seconds with unit seconds */ + !(time_state->info[i].attrib_id == + HID_USAGE_SENSOR_TIME_SECOND && + time_state->info[i].units == + HID_USAGE_SENSOR_UNITS_SECOND)) { + dev_err(&pdev->dev, + "attribute '%s' hasn't a unit of type 'none'!\n", + hid_time_attrib_name( + time_state->info[i].attrib_id)); + return -EINVAL; + } + if (time_state->info[i].unit_expo) { + dev_err(&pdev->dev, + "attribute '%s' hasn't a unit exponent of 1!\n", + hid_time_attrib_name( + time_state->info[i].attrib_id)); + return -EINVAL; + } + } + + return 0; +} + +static int hid_rtc_read_time(struct device *dev, struct rtc_time *tm) +{ + unsigned long flags; + struct hid_time_state *time_state = + platform_get_drvdata(to_platform_device(dev)); + int ret; + + INIT_COMPLETION(time_state->comp_last_time); + /* get a report with all values through requesting one value */ + sensor_hub_input_attr_get_raw_value(time_state->common_attributes.hsdev, + HID_USAGE_SENSOR_TIME, hid_time_addresses[0], + time_state->info[0].report_id); + /* wait for all values (event) */ + ret = wait_for_completion_killable_timeout( + &time_state->comp_last_time, HZ*6); + if (ret > 0) { + /* no error */ + spin_lock_irqsave(&time_state->lock_last_time, flags); + *tm = time_state->last_time; + spin_unlock_irqrestore(&time_state->lock_last_time, flags); + return 0; + } + if (!ret) + return -EIO; /* timeouted */ + return ret; /* killed (-ERESTARTSYS) */ +} + +static const struct rtc_class_ops hid_time_rtc_ops = { + .read_time = hid_rtc_read_time, +}; + +static int hid_time_probe(struct platform_device *pdev) +{ + int ret = 0; + struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; + struct hid_time_state *time_state = devm_kzalloc(&pdev->dev, + sizeof(struct hid_time_state), GFP_KERNEL); + + if (time_state == NULL) + return -ENOMEM; + + platform_set_drvdata(pdev, time_state); + + init_completion(&time_state->comp_last_time); + time_state->common_attributes.hsdev = hsdev; + time_state->common_attributes.pdev = pdev; + + ret = hid_sensor_parse_common_attributes(hsdev, + HID_USAGE_SENSOR_TIME, + &time_state->common_attributes); + if (ret) { + dev_err(&pdev->dev, "failed to setup common attributes!\n"); + return ret; + } + + ret = hid_time_parse_report(pdev, hsdev, HID_USAGE_SENSOR_TIME, + time_state); + if (ret) { + dev_err(&pdev->dev, "failed to setup attributes!\n"); + return ret; + } + + time_state->callbacks.send_event = hid_time_proc_event; + time_state->callbacks.capture_sample = hid_time_capture_sample; + time_state->callbacks.pdev = pdev; + ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_TIME, + &time_state->callbacks); + if (ret < 0) { + dev_err(&pdev->dev, "register callback failed!\n"); + return ret; + } + + time_state->rtc = rtc_device_register("hid-sensor-time", + &pdev->dev, &hid_time_rtc_ops, THIS_MODULE); + + if (IS_ERR(time_state->rtc)) { + dev_err(&pdev->dev, "rtc device register failed!\n"); + return PTR_ERR(time_state->rtc); + } + + return ret; +} + +static int hid_time_remove(struct platform_device *pdev) +{ + struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; + struct hid_time_state *time_state = platform_get_drvdata(pdev); + + rtc_device_unregister(time_state->rtc); + sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME); + + return 0; +} + +static struct platform_driver hid_time_platform_driver = { + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + }, + .probe = hid_time_probe, + .remove = hid_time_remove, +}; +module_platform_driver(hid_time_platform_driver); + +MODULE_DESCRIPTION("HID Sensor Time"); +MODULE_AUTHOR("Alexander Holler <holler@ahsoftware.de>"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 0ce50d12c30f..465a28c08f20 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -11,19 +11,42 @@ if ANDROID config ANDROID_BINDER_IPC bool "Android Binder IPC Driver" default n + ---help--- + Binder is used in Android for both communication between processes, + and remote method invocation. + + This means one Android process can call a method/routine in another + Android process, using Binder to identify, invoke and pass arguments + between said processes. config ASHMEM bool "Enable the Anonymous Shared Memory Subsystem" default n depends on SHMEM || TINY_SHMEM - help + ---help--- The ashmem subsystem is a new shared memory allocator, similar to POSIX SHM but with different behavior and sporting a simpler file-based API. + It is, in theory, a good memory allocator for low-memory devices, + because it can discard shared memory units when under memory pressure. + config ANDROID_LOGGER tristate "Android log driver" default n + ---help--- + This adds support for system-wide logging using four log buffers. + + These are: + + 1: main + 2: events + 3: radio + 4: system + + Log reading and writing is performed via normal Linux reads and + optimized writes. This optimization avoids logging having too + much overhead in the system. config ANDROID_TIMED_OUTPUT bool "Timed output class driver" @@ -38,13 +61,13 @@ config ANDROID_LOW_MEMORY_KILLER bool "Android Low Memory Killer" default N ---help--- - Register processes to be killed when memory is low + Registers processes to be killed when memory is low config ANDROID_INTF_ALARM_DEV bool "Android alarm driver" depends on RTC_CLASS default n - help + ---help--- Provides non-wakeup and rtc backed wakeup alarms based on rtc or elapsed realtime, and a non-wakeup alarm on the monotonic clock. Also exports the alarm interface to user-space. diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 2d12e8a1f82e..538ebe213129 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c @@ -3227,7 +3227,7 @@ static void print_binder_proc(struct seq_file *m, m->count = start_pos; } -static const char *binder_return_strings[] = { +static const char * const binder_return_strings[] = { "BR_ERROR", "BR_OK", "BR_TRANSACTION", @@ -3248,7 +3248,7 @@ static const char *binder_return_strings[] = { "BR_FAILED_REPLY" }; -static const char *binder_command_strings[] = { +static const char * const binder_command_strings[] = { "BC_TRANSACTION", "BC_REPLY", "BC_ACQUIRE_RESULT", @@ -3268,7 +3268,7 @@ static const char *binder_command_strings[] = { "BC_DEAD_BINDER_DONE" }; -static const char *binder_objstat_strings[] = { +static const char * const binder_objstat_strings[] = { "proc", "thread", "node", diff --git a/drivers/staging/android/binder.h b/drivers/staging/android/binder.h index 2f7d195d8b15..76ead8dac265 100644 --- a/drivers/staging/android/binder.h +++ b/drivers/staging/android/binder.h @@ -163,7 +163,7 @@ struct binder_pri_ptr_cookie { void *cookie; }; -enum BinderDriverReturnProtocol { +enum binder_driver_return_protocol { BR_ERROR = _IOR('r', 0, int), /* * int: error code @@ -251,7 +251,7 @@ enum BinderDriverReturnProtocol { */ }; -enum BinderDriverCommandProtocol { +enum binder_driver_command_protocol { BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), BC_REPLY = _IOW('c', 1, struct binder_transaction_data), /* diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index f57794827f73..1d8bf08b5bfd 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -95,7 +95,7 @@ struct bcm_classifier_rule { UCHAR ucDirection; BOOLEAN bIpv6Protocol; UINT32 u32PHSRuleID; - S_PHS_RULE sPhsRule; + struct bcm_phs_rule sPhsRule; UCHAR u8AssociatedPHSI; /* Classification fields for ETH CS */ @@ -288,7 +288,7 @@ struct bcm_mini_adapter { wait_queue_head_t ioctl_fw_dnld_wait_queue; BOOLEAN waiting_to_fw_download_done; pid_t fw_download_process_pid; - PSTARGETPARAMS pstargetparams; + struct bcm_target_params *pstargetparams; BOOLEAN device_removed; BOOLEAN DeviceAccess; BOOLEAN bIsAutoCorrectEnabled; @@ -303,10 +303,10 @@ struct bcm_mini_adapter { struct task_struct *transmit_packet_thread; /* LED Related Structures */ - LED_INFO_STRUCT LEDInfo; + struct bcm_led_info LEDInfo; /* Driver State for LED Blinking */ - LedEventInfo_t DriverState; + enum bcm_led_events DriverState; /* Interface Specific */ PVOID pvInterfaceAdapter; int (*bcm_file_download)(PVOID, @@ -333,7 +333,7 @@ struct bcm_mini_adapter { /* BOOLEAN bTriedToWakeUpFromShutdown; */ BOOLEAN bLinkDownRequested; int downloadDDR; - PHS_DEVICE_EXTENSION stBCMPhsContext; + struct bcm_phs_extension stBCMPhsContext; struct bcm_hdr_suppression_contextinfo stPhsTxContextInfo; uint8_t ucaPHSPktRestoreBuf[2048]; uint8_t bPHSEnabled; @@ -345,7 +345,7 @@ struct bcm_mini_adapter { struct bcm_fragmented_packet_info astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES]; atomic_t uiMBupdate; UINT32 PmuMode; - NVM_TYPE eNVMType; + enum bcm_nvm_type eNVMType; UINT uiSectorSize; UINT uiSectorSizeInCFG; BOOLEAN bSectorSizeOverride; @@ -366,9 +366,9 @@ struct bcm_mini_adapter { struct device *pstCreatedClassDevice; /* BOOLEAN InterfaceUpStatus; */ - PFLASH2X_CS_INFO psFlash2xCSInfo; - PFLASH_CS_INFO psFlashCSInfo; - PFLASH2X_VENDORSPECIFIC_INFO psFlash2xVendorInfo; + struct bcm_flash2x_cs_info *psFlash2xCSInfo; + struct bcm_flash_cs_info *psFlashCSInfo; + struct bcm_flash2x_vendor_info *psFlash2xVendorInfo; UINT uiFlashBaseAdd; /* Flash start address */ UINT uiActiveISOOffset; /* Active ISO offset chosen before f/w download */ enum bcm_flash2x_section_val eActiveISO; /* Active ISO section val */ @@ -392,7 +392,7 @@ struct bcm_mini_adapter { struct semaphore LowPowerModeSync; ULONG liDrainCalculated; UINT gpioBitMap; - S_BCM_DEBUG_STATE stDebugState; + struct bcm_debug_state stDebugState; }; #define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index efad33e3ba73..4ba1a5d1bf96 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -1013,7 +1013,7 @@ cntrlEnd: } case IOCTL_BCM_GET_CURRENT_STATUS: { - LINK_STATE link_state; + struct bcm_link_state link_state; /* Copy Ioctl Buffer structure */ if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer))) { @@ -1229,13 +1229,13 @@ cntrlEnd: case IOCTL_BCM_SET_DEBUG: #ifdef DEBUG { - USER_BCM_DBG_STATE sUserDebugState; + struct bcm_user_debug_state sUserDebugState; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "In SET_DEBUG ioctl\n"); if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer))) return -EFAULT; - if (copy_from_user(&sUserDebugState, IoBuffer.InputBuffer, sizeof(USER_BCM_DBG_STATE))) + if (copy_from_user(&sUserDebugState, IoBuffer.InputBuffer, sizeof(struct bcm_user_debug_state))) return -EFAULT; BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0, "IOCTL_BCM_SET_DEBUG: OnOff=%d Type = 0x%x ", @@ -1783,16 +1783,16 @@ cntrlEnd: } if (IsFlash2x(Adapter) == TRUE) { - if (IoBuffer.OutputLength < sizeof(FLASH2X_CS_INFO)) + if (IoBuffer.OutputLength < sizeof(struct bcm_flash2x_cs_info)) return -EINVAL; - if (copy_to_user(IoBuffer.OutputBuffer, Adapter->psFlash2xCSInfo, sizeof(FLASH2X_CS_INFO))) + if (copy_to_user(IoBuffer.OutputBuffer, Adapter->psFlash2xCSInfo, sizeof(struct bcm_flash2x_cs_info))) return -EFAULT; } else { - if (IoBuffer.OutputLength < sizeof(FLASH_CS_INFO)) + if (IoBuffer.OutputLength < sizeof(struct bcm_flash_cs_info)) return -EINVAL; - if (copy_to_user(IoBuffer.OutputBuffer, Adapter->psFlashCSInfo, sizeof(FLASH_CS_INFO))) + if (copy_to_user(IoBuffer.OutputBuffer, Adapter->psFlashCSInfo, sizeof(struct bcm_flash2x_cs_info))) return -EFAULT; } } diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 23ddc3d7c9ea..976514502927 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -113,7 +113,7 @@ static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIn static inline VOID CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, B_UINT8 u8IpAddressLen, B_UINT8 *pu8IpAddressMaskSrc, - BOOLEAN bIpVersion6, E_IPADDR_CONTEXT eIpAddrContext) + BOOLEAN bIpVersion6, enum bcm_ipaddr_context eIpAddrContext) { int i = 0; UINT nSizeOfIPAddressInBytes = IP_LENGTH_OF_ADDRESS; @@ -440,7 +440,7 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* <Pointer B_UINT16 u16PacketClassificationRuleIndex = 0; int i; struct bcm_convergence_types *psfCSType = NULL; - S_PHS_RULE sPhsRule; + struct bcm_phs_rule sPhsRule; USHORT uVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value; UINT UGIValue = 0; @@ -703,7 +703,7 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* <Pointer /* Update PHS Rule For the Classifier */ if (sPhsRule.u8PHSI) { Adapter->astClassifierTable[uiClassifierIndex].u32PHSRuleID = sPhsRule.u8PHSI; - memcpy(&Adapter->astClassifierTable[uiClassifierIndex].sPhsRule, &sPhsRule, sizeof(S_PHS_RULE)); + memcpy(&Adapter->astClassifierTable[uiClassifierIndex].sPhsRule, &sPhsRule, sizeof(struct bcm_phs_rule)); } } } diff --git a/drivers/staging/bcm/CmHost.h b/drivers/staging/bcm/CmHost.h index eecad8d90aea..4ddfc3d45bc0 100644 --- a/drivers/staging/bcm/CmHost.h +++ b/drivers/staging/bcm/CmHost.h @@ -27,32 +27,28 @@ struct bcm_add_indication_alt { u8 u8Type; u8 u8Direction; u16 u16TID; - /* brief 16bitCID */ u16 u16CID; - /* brief 16bitVCID */ u16 u16VCID; struct bcm_connect_mgr_params sfAuthorizedSet; struct bcm_connect_mgr_params sfAdmittedSet; struct bcm_connect_mgr_params sfActiveSet; u8 u8CC; /* < Confirmation Code */ - u8 u8Padd; /* < 8-bit Padding */ - u16 u16Padd; /* < 16 bit Padding */ + u8 u8Padd; + u16 u16Padd; }; struct bcm_change_indication { u8 u8Type; u8 u8Direction; u16 u16TID; - /* brief 16bitCID */ u16 u16CID; - /* brief 16bitVCID */ u16 u16VCID; struct bcm_connect_mgr_params sfAuthorizedSet; struct bcm_connect_mgr_params sfAdmittedSet; struct bcm_connect_mgr_params sfActiveSet; u8 u8CC; /* < Confirmation Code */ - u8 u8Padd; /* < 8-bit Padding */ - u16 u16Padd; /* < 16 bit */ + u8 u8Padd; + u16 u16Padd; }; unsigned long StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, void *pvBuffer, unsigned int *puBufferLength); diff --git a/drivers/staging/bcm/Debug.h b/drivers/staging/bcm/Debug.h index 8018a189f817..7b331215c1ac 100644 --- a/drivers/staging/bcm/Debug.h +++ b/drivers/staging/bcm/Debug.h @@ -9,142 +9,129 @@ #include <linux/string.h> #define NONE 0xFFFF - -//-------------------------------------------------------------------------------- - /* TYPE and SUBTYPE * Define valid TYPE (or category or code-path, however you like to think of it) * and SUBTYPE s. * Type and SubType are treated as bitmasks. */ -/*-----------------BEGIN TYPEs------------------------------------------*/ -#define DBG_TYPE_INITEXIT (1 << 0) // 1 -#define DBG_TYPE_TX (1 << 1) // 2 -#define DBG_TYPE_RX (1 << 2) // 4 -#define DBG_TYPE_OTHERS (1 << 3) // 8 -/*-----------------END TYPEs------------------------------------------*/ -#define NUMTYPES 4 // careful! - -/*-----------------BEGIN SUBTYPEs---------------------------------------*/ - -/*-SUBTYPEs for TX : TYPE is DBG_TYPE_TX -----// - Transmit.c ,Arp.c, LeakyBucket.c, And Qos.c - total 17 macros */ -// Transmit.c -#define TX 1 -#define MP_SEND (TX<<0) -#define NEXT_SEND (TX<<1) -#define TX_FIFO (TX<<2) -#define TX_CONTROL (TX<<3) - -// Arp.c -#define IP_ADDR (TX<<4) -#define ARP_REQ (TX<<5) -#define ARP_RESP (TX<<6) - -// Leakybucket.c -#define TOKEN_COUNTS (TX<<8) -#define CHECK_TOKENS (TX<<9) -#define TX_PACKETS (TX<<10) -#define TIMER (TX<<11) - -// Qos.c -#define QOS TX -#define QUEUE_INDEX (QOS<<12) -#define IPV4_DBG (QOS<<13) -#define IPV6_DBG (QOS<<14) -#define PRUNE_QUEUE (QOS<<15) -#define SEND_QUEUE (QOS<<16) - -//TX_Misc -#define TX_OSAL_DBG (TX<<17) - - -//--SUBTYPEs for ------INIT & EXIT--------------------- -/*------------ TYPE is DBG_TYPE_INITEXIT -----// -DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c */ -#define MP 1 -#define DRV_ENTRY (MP<<0) -#define MP_INIT (MP<<1) -#define READ_REG (MP<<3) -#define DISPATCH (MP<<2) -#define CLAIM_ADAP (MP<<4) -#define REG_IO_PORT (MP<<5) -#define INIT_DISP (MP<<6) -#define RX_INIT (MP<<7) - - -//-SUBTYPEs for --RX---------------------------------- -//------------RX : TYPE is DBG_TYPE_RX -----// -// Receive.c -#define RX 1 -#define RX_DPC (RX<<0) -#define RX_CTRL (RX<<3) -#define RX_DATA (RX<<4) -#define MP_RETURN (RX<<1) -#define LINK_MSG (RX<<2) - - -//-SUBTYPEs for ----OTHER ROUTINES------------------ -//------------OTHERS : TYPE is DBG_TYPE_OTHER -----// -// HaltnReset,CheckForHang,PnP,Misc,CmHost -// total 12 macros -#define OTHERS 1 -// ??ISR.C - -#define ISR OTHERS -#define MP_DPC (ISR<<0) - -// HaltnReset.c -#define HALT OTHERS -#define MP_HALT (HALT<<1) -#define CHECK_HANG (HALT<<2) -#define MP_RESET (HALT<<3) -#define MP_SHUTDOWN (HALT<<4) - -// pnp.c -#define PNP OTHERS -#define MP_PNP (PNP<<5) - -// Misc.c -#define MISC OTHERS -#define DUMP_INFO (MISC<<6) -#define CLASSIFY (MISC<<7) -#define LINK_UP_MSG (MISC<<8) -#define CP_CTRL_PKT (MISC<<9) -#define DUMP_CONTROL (MISC<<10) -#define LED_DUMP_INFO (MISC<<11) - -// CmHost.c -#define CMHOST OTHERS - - -#define SERIAL (OTHERS<<12) -#define IDLE_MODE (OTHERS<<13) - -#define WRM (OTHERS<<14) -#define RDM (OTHERS<<15) - -// TODO - put PHS_SEND in Tx PHS_RECEIVE in Rx path ? -#define PHS_SEND (OTHERS<<16) -#define PHS_RECEIVE (OTHERS<<17) -#define PHS_MODULE (OTHERS<<18) - -#define INTF_INIT (OTHERS<<19) -#define INTF_ERR (OTHERS<<20) -#define INTF_WARN (OTHERS<<21) -#define INTF_NORM (OTHERS<<22) - -#define IRP_COMPLETION (OTHERS<<23) -#define SF_DESCRIPTOR_CNTS (OTHERS<<24) -#define PHS_DISPATCH (OTHERS << 25) -#define OSAL_DBG (OTHERS << 26) -#define NVM_RW (OTHERS << 27) - -#define HOST_MIBS (OTHERS << 28) -#define CONN_MSG (CMHOST << 29) -/*-----------------END SUBTYPEs------------------------------------------*/ - +#define DBG_TYPE_INITEXIT (1 << 0) /* 1 */ +#define DBG_TYPE_TX (1 << 1) /* 2 */ +#define DBG_TYPE_RX (1 << 2) /* 4 */ +#define DBG_TYPE_OTHERS (1 << 3) /* 8 */ +#define NUMTYPES 4 + +/* -SUBTYPEs for TX : TYPE is DBG_TYPE_TX -----// + * Transmit.c ,Arp.c, LeakyBucket.c, And Qos.c + * total 17 macros + */ +/* Transmit.c */ +#define TX 1 +#define MP_SEND (TX << 0) +#define NEXT_SEND (TX << 1) +#define TX_FIFO (TX << 2) +#define TX_CONTROL (TX << 3) + +/* Arp.c */ +#define IP_ADDR (TX << 4) +#define ARP_REQ (TX << 5) +#define ARP_RESP (TX << 6) + +/* Leakybucket.c */ +#define TOKEN_COUNTS (TX << 8) +#define CHECK_TOKENS (TX << 9) +#define TX_PACKETS (TX << 10) +#define TIMER (TX << 11) + +/* Qos.c */ +#define QOS TX +#define QUEUE_INDEX (QOS << 12) +#define IPV4_DBG (QOS << 13) +#define IPV6_DBG (QOS << 14) +#define PRUNE_QUEUE (QOS << 15) +#define SEND_QUEUE (QOS << 16) + +/* TX_Misc */ +#define TX_OSAL_DBG (TX << 17) + +/* --SUBTYPEs for ------INIT & EXIT--------------------- + * ------------ TYPE is DBG_TYPE_INITEXIT -----// + * DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c + */ +#define MP 1 +#define DRV_ENTRY (MP << 0) +#define MP_INIT (MP << 1) +#define READ_REG (MP << 3) +#define DISPATCH (MP << 2) +#define CLAIM_ADAP (MP << 4) +#define REG_IO_PORT (MP << 5) +#define INIT_DISP (MP << 6) +#define RX_INIT (MP << 7) + +/* -SUBTYPEs for --RX---------------------------------- + * ------------RX : TYPE is DBG_TYPE_RX -----// + * Receive.c + */ +#define RX 1 +#define RX_DPC (RX << 0) +#define RX_CTRL (RX << 3) +#define RX_DATA (RX << 4) +#define MP_RETURN (RX << 1) +#define LINK_MSG (RX << 2) + +/* -SUBTYPEs for ----OTHER ROUTINES------------------ + * ------------OTHERS : TYPE is DBG_TYPE_OTHER -----// + * HaltnReset,CheckForHang,PnP,Misc,CmHost + * total 12 macros + */ +#define OTHERS 1 +#define ISR OTHERS +#define MP_DPC (ISR << 0) + +/* HaltnReset.c */ +#define HALT OTHERS +#define MP_HALT (HALT << 1) +#define CHECK_HANG (HALT << 2) +#define MP_RESET (HALT << 3) +#define MP_SHUTDOWN (HALT << 4) + +/* pnp.c */ +#define PNP OTHERS +#define MP_PNP (PNP << 5) + +/* Misc.c */ +#define MISC OTHERS +#define DUMP_INFO (MISC << 6) +#define CLASSIFY (MISC << 7) +#define LINK_UP_MSG (MISC << 8) +#define CP_CTRL_PKT (MISC << 9) +#define DUMP_CONTROL (MISC << 10) +#define LED_DUMP_INFO (MISC << 11) + +/* CmHost.c */ +#define CMHOST OTHERS +#define SERIAL (OTHERS << 12) +#define IDLE_MODE (OTHERS << 13) +#define WRM (OTHERS << 14) +#define RDM (OTHERS << 15) + +/* TODO - put PHS_SEND in Tx PHS_RECEIVE in Rx path ? */ +#define PHS_SEND (OTHERS << 16) +#define PHS_RECEIVE (OTHERS << 17) +#define PHS_MODULE (OTHERS << 18) + +#define INTF_INIT (OTHERS << 19) +#define INTF_ERR (OTHERS << 20) +#define INTF_WARN (OTHERS << 21) +#define INTF_NORM (OTHERS << 22) + +#define IRP_COMPLETION (OTHERS << 23) +#define SF_DESCRIPTOR_CNTS (OTHERS << 24) +#define PHS_DISPATCH (OTHERS << 25) +#define OSAL_DBG (OTHERS << 26) +#define NVM_RW (OTHERS << 27) + +#define HOST_MIBS (OTHERS << 28) +#define CONN_MSG (CMHOST << 29) /* Debug level * We have 8 debug levels, in (numerical) increasing order of verbosity. @@ -157,57 +144,58 @@ DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c */ * You can compile-time change that to any of the below, if you wish to. However, as of now, there's * no dynamic facility to have the userspace 'TestApp' set debug_level. Slated for future expansion. */ -#define BCM_ALL 7 -#define BCM_LOW 6 -#define BCM_PRINT 5 -#define BCM_NORMAL 4 -#define BCM_MEDIUM 3 -#define BCM_SCREAM 2 -#define BCM_ERR 1 +#define BCM_ALL 7 +#define BCM_LOW 6 +#define BCM_PRINT 5 +#define BCM_NORMAL 4 +#define BCM_MEDIUM 3 +#define BCM_SCREAM 2 +#define BCM_ERR 1 /* Not meant for developer in debug prints. - * To be used to disable all prints by setting the DBG_LVL_CURR to this value */ -#define BCM_NONE 0 + * To be used to disable all prints by setting the DBG_LVL_CURR to this value + */ +#define BCM_NONE 0 /* The current driver logging level. * Everything at this level and (numerically) lower (meaning higher prio) * is logged. -* Replace 'BCM_ALL' in the DBG_LVL_CURR macro with the logging level desired. + * Replace 'BCM_ALL' in the DBG_LVL_CURR macro with the logging level desired. * For eg. to set the logging level to 'errors only' use: * #define DBG_LVL_CURR (BCM_ERR) */ #define DBG_LVL_CURR (BCM_ALL) -#define DBG_LVL_ALL BCM_ALL +#define DBG_LVL_ALL BCM_ALL -/*---Userspace mapping of Debug State. +/* ---Userspace mapping of Debug State. * Delibrately matches that of the Windows driver.. * The TestApp's ioctl passes this struct to us. */ -typedef struct -{ +struct bcm_user_debug_state { unsigned int Subtype, Type; unsigned int OnOff; -// unsigned int debug_level; /* future expansion */ -} __attribute__((packed)) USER_BCM_DBG_STATE; +/* unsigned int debug_level; future expansion */ +} __packed; -//---Kernel-space mapping of Debug State -typedef struct _S_BCM_DEBUG_STATE { - UINT type; +/* ---Kernel-space mapping of Debug State */ +struct bcm_debug_state { + unsigned int type; /* A bitmap of 32 bits for Subtype per Type. * Valid indexes in 'subtype' array are *only* 1,2,4 and 8, * corresponding to valid Type values. Hence we use the 'Type' field * as the index value, ignoring the array entries 0,3,5,6,7 ! */ - UINT subtype[(NUMTYPES*2)+1]; - UINT debug_level; -} S_BCM_DEBUG_STATE; -/* Instantiated in the Adapter structure */ -/* We'll reuse the debug level parameter to include a bit (the MSB) to indicate whether or not - * we want the function's name printed. */ -#define DBG_NO_FUNC_PRINT 1 << 31 + unsigned int subtype[(NUMTYPES*2)+1]; + unsigned int debug_level; +}; +/* Instantiated in the Adapter structure + * We'll reuse the debug level parameter to include a bit (the MSB) to indicate whether or not + * we want the function's name printed. + */ +#define DBG_NO_FUNC_PRINT (1 << 31) #define DBG_LVL_BITMASK 0xFF -//--- Only for direct printk's; "hidden" to API. +/* --- Only for direct printk's; "hidden" to API. */ #define DBG_TYPE_PRINTK 3 #define BCM_DEBUG_PRINT(Adapter, Type, SubType, dbg_level, string, args...) \ @@ -215,40 +203,40 @@ typedef struct _S_BCM_DEBUG_STATE { if (DBG_TYPE_PRINTK == Type) \ pr_info("%s:" string, __func__, ##args); \ else if (Adapter && \ - (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \ - (Type & Adapter->stDebugState.type) && \ - (SubType & Adapter->stDebugState.subtype[Type])) { \ + (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \ + (Type & Adapter->stDebugState.type) && \ + (SubType & Adapter->stDebugState.subtype[Type])) { \ if (dbg_level & DBG_NO_FUNC_PRINT) \ - printk(KERN_DEBUG string, ##args); \ + pr_debug("%s:\n", string); \ else \ - printk(KERN_DEBUG "%s:" string, __func__, ##args); \ + pr_debug("%s:\n" string, __func__, ##args); \ } \ } while (0) -#define BCM_DEBUG_PRINT_BUFFER(Adapter, Type, SubType, dbg_level, buffer, bufferlen) do { \ - if (DBG_TYPE_PRINTK == Type || \ - (Adapter && \ - (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \ - (Type & Adapter->stDebugState.type) && \ - (SubType & Adapter->stDebugState.subtype[Type]))) { \ - printk(KERN_DEBUG "%s:\n", __func__); \ - print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET, \ - 16, 1, buffer, bufferlen, false); \ - } \ -} while(0) - - -#define BCM_SHOW_DEBUG_BITMAP(Adapter) do { \ - int i; \ - for (i=0; i<(NUMTYPES*2)+1; i++) { \ +#define BCM_DEBUG_PRINT_BUFFER(Adapter, Type, SubType, dbg_level, buffer, bufferlen) \ + do { \ + if (DBG_TYPE_PRINTK == Type || \ + (Adapter && \ + (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \ + (Type & Adapter->stDebugState.type) && \ + (SubType & Adapter->stDebugState.subtype[Type]))) { \ + pr_debug("%s:\n", __func__); \ + print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET, \ + 16, 1, buffer, bufferlen, false); \ + } \ + } while (0) + +#define BCM_SHOW_DEBUG_BITMAP(Adapter) do { \ + int i; \ + for (i = 0; i < (NUMTYPES * 2) + 1; i++) { \ if ((i == 1) || (i == 2) || (i == 4) || (i == 8)) { \ - /* CAUTION! Forcefully turn on ALL debug paths and subpaths! \ - Adapter->stDebugState.subtype[i] = 0xffffffff; */ \ - BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0, "subtype[%d] = 0x%08x\n", \ - i, Adapter->stDebugState.subtype[i]); \ + /* CAUTION! Forcefully turn on ALL debug paths and subpaths! \ + * Adapter->stDebugState.subtype[i] = 0xffffffff; \ + */ \ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "subtype[%d] = 0x%08x\n", \ + i, Adapter->stDebugState.subtype[i]); \ } \ } \ } while (0) #endif - diff --git a/drivers/staging/bcm/IPv6Protocol.c b/drivers/staging/bcm/IPv6Protocol.c index 4745ddd62f5b..6d803e7b094a 100644 --- a/drivers/staging/bcm/IPv6Protocol.c +++ b/drivers/staging/bcm/IPv6Protocol.c @@ -1,10 +1,10 @@ #include "headers.h" static BOOLEAN MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule, - IPV6Header *pstIpv6Header); + struct bcm_ipv6_hdr *pstIpv6Header); static BOOLEAN MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule, - IPV6Header *pstIpv6Header); -static VOID DumpIpv6Header(IPV6Header *pstIpv6Header); + struct bcm_ipv6_hdr *pstIpv6Header); +static VOID DumpIpv6Header(struct bcm_ipv6_hdr *pstIpv6Header); static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload, UCHAR *pucNextHeader, BOOLEAN *bParseDone, USHORT *pusPayloadLength) @@ -38,17 +38,17 @@ static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 HopByHop Header"); - usNextHeaderOffset += sizeof(IPV6HopByHopOptionsHeader); + usNextHeaderOffset += sizeof(struct bcm_ipv6_options_hdr); } break; case IPV6HDR_TYPE_ROUTING: { - IPV6RoutingHeader *pstIpv6RoutingHeader; + struct bcm_ipv6_routing_hdr *pstIpv6RoutingHeader; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Routing Header"); - pstIpv6RoutingHeader = (IPV6RoutingHeader *)pucPayloadPtr; - usNextHeaderOffset += sizeof(IPV6RoutingHeader); + pstIpv6RoutingHeader = (struct bcm_ipv6_routing_hdr *)pucPayloadPtr; + usNextHeaderOffset += sizeof(struct bcm_ipv6_routing_hdr); usNextHeaderOffset += pstIpv6RoutingHeader->ucNumAddresses * IPV6_ADDRESS_SIZEINBYTES; } @@ -58,25 +58,25 @@ static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Fragmentation Header"); - usNextHeaderOffset += sizeof(IPV6FragmentHeader); + usNextHeaderOffset += sizeof(struct bcm_ipv6_fragment_hdr); } break; case IPV6HDR_TYPE_DESTOPTS: { - IPV6DestOptionsHeader *pstIpv6DestOptsHdr = (IPV6DestOptionsHeader *)pucPayloadPtr; + struct bcm_ipv6_dest_options_hdr *pstIpv6DestOptsHdr = (struct bcm_ipv6_dest_options_hdr *)pucPayloadPtr; int nTotalOptions = pstIpv6DestOptsHdr->ucHdrExtLen; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 DestOpts Header Header"); - usNextHeaderOffset += sizeof(IPV6DestOptionsHeader); + usNextHeaderOffset += sizeof(struct bcm_ipv6_dest_options_hdr); usNextHeaderOffset += nTotalOptions * IPV6_DESTOPTS_HDR_OPTIONSIZE ; } break; case IPV6HDR_TYPE_AUTHENTICATION: { - IPV6AuthenticationHeader *pstIpv6AuthHdr = (IPV6AuthenticationHeader *)pucPayloadPtr; + struct bcm_ipv6_authentication_hdr *pstIpv6AuthHdr = (struct bcm_ipv6_authentication_hdr *)pucPayloadPtr; int nHdrLen = pstIpv6AuthHdr->ucLength; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, @@ -186,13 +186,13 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, USHORT ushDestPort = 0; USHORT ushSrcPort = 0; UCHAR ucNextProtocolAboveIP = 0; - IPV6Header *pstIpv6Header = NULL; + struct bcm_ipv6_hdr *pstIpv6Header = NULL; BOOLEAN bClassificationSucceed = FALSE; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "IpVersion6 ==========>\n"); - pstIpv6Header = (IPV6Header *)pcIpHeader; + pstIpv6Header = (struct bcm_ipv6_hdr *)pcIpHeader; DumpIpv6Header(pstIpv6Header); @@ -200,7 +200,7 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, * Try to get the next higher layer protocol * and the Ports Nos if TCP or UDP */ - ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader + sizeof(IPV6Header)), + ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader + sizeof(struct bcm_ipv6_hdr)), &ushSrcPort, &ushDestPort, pstIpv6Header->usPayloadLength, @@ -289,7 +289,7 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, static BOOLEAN MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule, - IPV6Header *pstIpv6Header) + struct bcm_ipv6_hdr *pstIpv6Header) { UINT uiLoopIndex = 0; UINT uiIpv6AddIndex = 0; @@ -345,7 +345,7 @@ static BOOLEAN MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule } static BOOLEAN MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule, - IPV6Header *pstIpv6Header) + struct bcm_ipv6_hdr *pstIpv6Header) { UINT uiLoopIndex = 0; UINT uiIpv6AddIndex = 0; @@ -414,7 +414,7 @@ VOID DumpIpv6Address(ULONG *puIpv6Address) } -static VOID DumpIpv6Header(IPV6Header *pstIpv6Header) +static VOID DumpIpv6Header(struct bcm_ipv6_hdr *pstIpv6Header) { UCHAR ucVersion; UCHAR ucPrio; diff --git a/drivers/staging/bcm/IPv6ProtocolHdr.h b/drivers/staging/bcm/IPv6ProtocolHdr.h index 8ba88a5b081c..96b36a579af2 100644 --- a/drivers/staging/bcm/IPv6ProtocolHdr.h +++ b/drivers/staging/bcm/IPv6ProtocolHdr.h @@ -1,7 +1,6 @@ #ifndef _IPV6_PROTOCOL_DEFINES_ #define _IPV6_PROTOCOL_DEFINES_ - #define IPV6HDR_TYPE_HOPBYHOP 0x0 #define IPV6HDR_TYPE_ROUTING 0x2B #define IPV6HDR_TYPE_FRAGMENTATION 0x2C @@ -10,107 +9,77 @@ #define IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD 0x34 #define MASK_IPV6_CS_SPEC 0x2 - -#define TCP_HEADER_TYPE 0x6 -#define UDP_HEADER_TYPE 0x11 +#define TCP_HEADER_TYPE 0x6 +#define UDP_HEADER_TYPE 0x11 #define IPV6_ICMP_HDR_TYPE 0x2 #define IPV6_FLOWLABEL_BITOFFSET 9 #define IPV6_MAX_CHAINEDHDR_BUFFBYTES 0x64 /* -// Size of Dest Options field of Destinations Options Header -// in bytes. -*/ + * Size of Dest Options field of Destinations Options Header + * in bytes. + */ #define IPV6_DESTOPTS_HDR_OPTIONSIZE 0x8 -//typedef unsigned char UCHAR; -//typedef unsigned short USHORT; -//typedef unsigned long int ULONG; - -typedef struct IPV6HeaderFormatTag -{ - UCHAR ucVersionPrio; - UCHAR aucFlowLabel[3]; - USHORT usPayloadLength; - UCHAR ucNextHeader; - UCHAR ucHopLimit; - ULONG ulSrcIpAddress[4]; - ULONG ulDestIpAddress[4]; -}IPV6Header; - -typedef struct IPV6RoutingHeaderFormatTag -{ - UCHAR ucNextHeader; - UCHAR ucRoutingType; - UCHAR ucNumAddresses; - UCHAR ucNextAddress; - ULONG ulReserved; - //UCHAR aucAddressList[0]; - -}IPV6RoutingHeader; - -typedef struct IPV6FragmentHeaderFormatTag -{ - UCHAR ucNextHeader; - UCHAR ucReserved; - USHORT usFragmentOffset; - ULONG ulIdentification; -}IPV6FragmentHeader; - -typedef struct IPV6DestOptionsHeaderFormatTag -{ - UCHAR ucNextHeader; - UCHAR ucHdrExtLen; - UCHAR ucDestOptions[6]; - //UCHAR udExtDestOptions[0]; -}IPV6DestOptionsHeader; - -typedef struct IPV6HopByHopOptionsHeaderFormatTag -{ - UCHAR ucNextHeader; - UCHAR ucMisc[3]; - ULONG ulJumboPayloadLen; -}IPV6HopByHopOptionsHeader; - -typedef struct IPV6AuthenticationHeaderFormatTag -{ - UCHAR ucNextHeader; - UCHAR ucLength; - USHORT usReserved; - ULONG ulSecurityParametersIndex; - //UCHAR ucAuthenticationData[0]; - -}IPV6AuthenticationHeader; - -typedef struct IPV6IcmpHeaderFormatTag -{ - UCHAR ucType; - UCHAR ucCode; - USHORT usChecksum; - //UCHAR ucIcmpMsg[0]; - -}IPV6IcmpHeader; - -typedef enum _E_IPADDR_CONTEXT -{ +struct bcm_ipv6_hdr { + unsigned char ucVersionPrio; + unsigned char aucFlowLabel[3]; + unsigned short usPayloadLength; + unsigned char ucNextHeader; + unsigned char ucHopLimit; + unsigned long ulSrcIpAddress[4]; + unsigned long ulDestIpAddress[4]; +}; + +struct bcm_ipv6_routing_hdr { + unsigned char ucNextHeader; + unsigned char ucRoutingType; + unsigned char ucNumAddresses; + unsigned char ucNextAddress; + unsigned long ulReserved; +}; + +struct bcm_ipv6_fragment_hdr { + unsigned char ucNextHeader; + unsigned char ucReserved; + unsigned short usFragmentOffset; + unsigned long ulIdentification; +}; + +struct bcm_ipv6_dest_options_hdr { + unsigned char ucNextHeader; + unsigned char ucHdrExtLen; + unsigned char ucDestOptions[6]; +}; + +struct bcm_ipv6_options_hdr { + unsigned char ucNextHeader; + unsigned char ucMisc[3]; + unsigned long ulJumboPayloadLen; +}; + +struct bcm_ipv6_authentication_hdr { + unsigned char ucNextHeader; + unsigned char ucLength; + unsigned short usReserved; + unsigned long ulSecurityParametersIndex; +}; + +enum bcm_ipaddr_context { eSrcIpAddress, eDestIpAddress +}; -}E_IPADDR_CONTEXT; - - - -//Function Prototypes - -USHORT IpVersion6(struct bcm_mini_adapter *Adapter, /**< Pointer to the driver control structure */ - PVOID pcIpHeader, /**<Pointer to the IP Hdr of the packet*/ - struct bcm_classifier_rule *pstClassifierRule ); +/* Function Prototypes */ -VOID DumpIpv6Address(ULONG *puIpv6Address); +unsigned short IpVersion6(struct bcm_mini_adapter *Adapter, /* < Pointer to the driver control structure */ + void *pcIpHeader, /* <Pointer to the IP Hdr of the packet */ + struct bcm_classifier_rule *pstClassifierRule); -extern BOOLEAN MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort); -extern BOOLEAN MatchDestPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort); -extern BOOLEAN MatchProtocol(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucProtocol); +void DumpIpv6Address(unsigned long *puIpv6Address); +extern bool MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule, unsigned short ushSrcPort); +extern bool MatchDestPort(struct bcm_classifier_rule *pstClassifierRule, unsigned short ushSrcPort); +extern bool MatchProtocol(struct bcm_classifier_rule *pstClassifierRule, unsigned char ucProtocol); #endif diff --git a/drivers/staging/bcm/InterfaceDld.c b/drivers/staging/bcm/InterfaceDld.c index 87117a797d5b..64ea6edb9dc2 100644 --- a/drivers/staging/bcm/InterfaceDld.c +++ b/drivers/staging/bcm/InterfaceDld.c @@ -138,12 +138,12 @@ static int bcm_download_config_file(struct bcm_mini_adapter *Adapter, struct bcm B_UINT32 value = 0; if (Adapter->pstargetparams == NULL) { - Adapter->pstargetparams = kmalloc(sizeof(STARGETPARAMS), GFP_KERNEL); + Adapter->pstargetparams = kmalloc(sizeof(struct bcm_target_params), GFP_KERNEL); if (Adapter->pstargetparams == NULL) return -ENOMEM; } - if (psFwInfo->u32FirmwareLength != sizeof(STARGETPARAMS)) + if (psFwInfo->u32FirmwareLength != sizeof(struct bcm_target_params)) return -EIO; retval = copy_from_user(Adapter->pstargetparams, psFwInfo->pvMappedFirmwareAddress, psFwInfo->u32FirmwareLength); @@ -195,7 +195,7 @@ static int bcm_download_config_file(struct bcm_mini_adapter *Adapter, struct bcm } } - retval = buffDnldVerify(Adapter, (PUCHAR)Adapter->pstargetparams, sizeof(STARGETPARAMS), CONFIG_BEGIN_ADDR); + retval = buffDnldVerify(Adapter, (PUCHAR)Adapter->pstargetparams, sizeof(struct bcm_target_params), CONFIG_BEGIN_ADDR); if (retval) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "configuration file not downloaded properly"); diff --git a/drivers/staging/bcm/Ioctl.h b/drivers/staging/bcm/Ioctl.h index 8c70af90969b..e253c080a787 100644 --- a/drivers/staging/bcm/Ioctl.h +++ b/drivers/staging/bcm/Ioctl.h @@ -108,7 +108,7 @@ enum bcm_interface_type { }; struct bcm_driver_info { - NVM_TYPE u32NVMType; + enum bcm_nvm_type u32NVMType; unsigned int MaxRDMBufferSize; enum bcm_interface_type u32InterfaceType; unsigned int u32DSDStartOffset; @@ -202,8 +202,8 @@ struct bcm_flash2x_bitmap { }; struct bcm_time_elapsed { - unsigned long long ul64TimeElapsedSinceNetEntry; - u32 uiReserved[4]; + u64 ul64TimeElapsedSinceNetEntry; + u32 uiReserved[4]; }; enum { diff --git a/drivers/staging/bcm/Macros.h b/drivers/staging/bcm/Macros.h index 46f5f0feea88..dc01e3016d4f 100644 --- a/drivers/staging/bcm/Macros.h +++ b/drivers/staging/bcm/Macros.h @@ -162,13 +162,11 @@ #define GPIO_MODE_REGISTER 0x0F000034 #define GPIO_PIN_STATE_REGISTER 0x0F000038 - -typedef struct _LINK_STATE { - UCHAR ucLinkStatus; - UCHAR bIdleMode; - UCHAR bShutdownMode; -} LINK_STATE, *PLINK_STATE; - +struct bcm_link_state { + unsigned char ucLinkStatus; + unsigned char bIdleMode; + unsigned char bShutdownMode; +}; enum enLinkStatus { WAIT_FOR_SYNC = 1, @@ -182,13 +180,12 @@ enum enLinkStatus { COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW = 9 }; -typedef enum _E_PHS_DSC_ACTION { +enum bcm_phs_dsc_action { eAddPHSRule = 0, eSetPHSRule, eDeletePHSRule, eDeleteAllPHSRules -} E_PHS_DSC_ACTION; - +}; #define CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ 0x89 /* Host to Mac */ #define CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP 0xA9 /* Mac to Host */ @@ -324,18 +321,18 @@ typedef enum _E_PHS_DSC_ACTION { #define HPM_CONFIG_MSW 0x0F000D58 #define T3B 0xbece0310 -typedef enum eNVM_TYPE { +enum bcm_nvm_type { NVM_AUTODETECT = 0, NVM_EEPROM, NVM_FLASH, NVM_UNKNOWN -} NVM_TYPE; +}; -typedef enum ePMU_MODES { +enum bcm_pmu_modes { HYBRID_MODE_7C = 0, INTERNAL_MODE_6 = 1, HYBRID_MODE_6 = 2 -} PMU_MODE; +}; #define MAX_RDM_WRM_RETIRES 1 diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index c92078e7fe86..b5c2c4c15f92 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -956,7 +956,7 @@ int InitCardAndDownloadFirmware(struct bcm_mini_adapter *ps_adapter) /* Download cfg file */ status = buffDnldVerify(ps_adapter, (PUCHAR)ps_adapter->pstargetparams, - sizeof(STARGETPARAMS), + sizeof(struct bcm_target_params), CONFIG_BEGIN_ADDR); if (status) { BCM_DEBUG_PRINT(ps_adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Error downloading CFG file"); @@ -1053,7 +1053,7 @@ static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter) if (!buff) return -ENOMEM; - Adapter->pstargetparams = kmalloc(sizeof(STARGETPARAMS), GFP_KERNEL); + Adapter->pstargetparams = kmalloc(sizeof(struct bcm_target_params), GFP_KERNEL); if (Adapter->pstargetparams == NULL) { kfree(buff); return -ENOMEM; @@ -1070,7 +1070,7 @@ static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter) len = kernel_read(flp, 0, buff, BUFFER_1K); filp_close(flp, NULL); - if (len != sizeof(STARGETPARAMS)) { + if (len != sizeof(struct bcm_target_params)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Mismatch in Target Param Structure!\n"); kfree(buff); kfree(Adapter->pstargetparams); @@ -1082,7 +1082,7 @@ static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter) /* * Values in Adapter->pstargetparams are in network byte order */ - memcpy(Adapter->pstargetparams, buff, sizeof(STARGETPARAMS)); + memcpy(Adapter->pstargetparams, buff, sizeof(struct bcm_target_params)); kfree(buff); beceem_parse_target_struct(Adapter); return STATUS_SUCCESS; @@ -1134,7 +1134,7 @@ void beceem_parse_target_struct(struct bcm_mini_adapter *Adapter) uiEEPROMFlag = ntohl(Adapter->pstargetparams->m_u32EEPROMFlag); pr_info(DRV_NAME ": uiEEPROMFlag : 0x%X\n", uiEEPROMFlag); - Adapter->eNVMType = (NVM_TYPE)((uiEEPROMFlag>>4)&0x3); + Adapter->eNVMType = (enum bcm_nvm_type)((uiEEPROMFlag>>4)&0x3); Adapter->bStatusWrite = (uiEEPROMFlag>>6)&0x1; Adapter->uiSectorSizeInCFG = 1024*(0xFFFF & ntohl(Adapter->pstargetparams->HostDrvrConfig4)); Adapter->bSectorSizeOverride = (bool) ((ntohl(Adapter->pstargetparams->HostDrvrConfig4))>>16)&0x1; diff --git a/drivers/staging/bcm/PHSDefines.h b/drivers/staging/bcm/PHSDefines.h index 6016fc502d2d..cd78ee4ffa22 100644 --- a/drivers/staging/bcm/PHSDefines.h +++ b/drivers/staging/bcm/PHSDefines.h @@ -1,124 +1,94 @@ #ifndef BCM_PHS_DEFINES_H #define BCM_PHS_DEFINES_H -#define PHS_INVALID_TABLE_INDEX 0xffffffff - -/************************* MACROS **********************************************/ +#define PHS_INVALID_TABLE_INDEX 0xffffffff #define PHS_MEM_TAG "_SHP" - - -//PHS Defines -#define STATUS_PHS_COMPRESSED 0xa1 -#define STATUS_PHS_NOCOMPRESSION 0xa2 -#define APPLY_PHS 1 -#define MAX_NO_BIT 7 -#define ZERO_PHSI 0 -#define VERIFY 0 -#define SIZE_MULTIPLE_32 4 -#define UNCOMPRESSED_PACKET 0 -#define DYNAMIC 0 -#define SUPPRESS 0x80 -#define NO_CLASSIFIER_MATCH 0 -#define SEND_PACKET_UNCOMPRESSED 0 -#define PHSI_IS_ZERO 0 -#define PHSI_LEN 1 -#define ERROR_LEN 0 -#define PHS_BUFFER_SIZE 1532 - - -#define MAX_PHSRULE_PER_SF 20 -#define MAX_SERVICEFLOWS 17 - -//PHS Error Defines -#define PHS_SUCCESS 0 -#define ERR_PHS_INVALID_DEVICE_EXETENSION 0x800 -#define ERR_PHS_INVALID_PHS_RULE 0x801 -#define ERR_PHS_RULE_ALREADY_EXISTS 0x802 -#define ERR_SF_MATCH_FAIL 0x803 -#define ERR_INVALID_CLASSIFIERTABLE_FOR_SF 0x804 -#define ERR_SFTABLE_FULL 0x805 -#define ERR_CLSASSIFIER_TABLE_FULL 0x806 -#define ERR_PHSRULE_MEMALLOC_FAIL 0x807 -#define ERR_CLSID_MATCH_FAIL 0x808 -#define ERR_PHSRULE_MATCH_FAIL 0x809 - -typedef struct _S_PHS_RULE -{ - /// brief 8bit PHSI Of The Service Flow - B_UINT8 u8PHSI; - /// brief PHSF Of The Service Flow - B_UINT8 u8PHSFLength; - B_UINT8 u8PHSF[MAX_PHS_LENGTHS]; - /// brief PHSM Of The Service Flow - B_UINT8 u8PHSMLength; - B_UINT8 u8PHSM[MAX_PHS_LENGTHS]; - /// brief 8bit PHSS Of The Service Flow - B_UINT8 u8PHSS; - /// brief 8bit PHSV Of The Service Flow - B_UINT8 u8PHSV; - //Reference Count for this PHS Rule - B_UINT8 u8RefCnt; - //Flag to Store Unclassified PHS rules only in DL - B_UINT8 bUnclassifiedPHSRule; - - B_UINT8 u8Reserved[3]; - - LONG PHSModifiedBytes; - ULONG PHSModifiedNumPackets; - ULONG PHSErrorNumPackets; -}S_PHS_RULE; - - -typedef enum _E_CLASSIFIER_ENTRY_CONTEXT -{ +/* PHS Defines */ +#define STATUS_PHS_COMPRESSED 0xa1 +#define STATUS_PHS_NOCOMPRESSION 0xa2 +#define APPLY_PHS 1 +#define MAX_NO_BIT 7 +#define ZERO_PHSI 0 +#define VERIFY 0 +#define SIZE_MULTIPLE_32 4 +#define UNCOMPRESSED_PACKET 0 +#define DYNAMIC 0 +#define SUPPRESS 0x80 +#define NO_CLASSIFIER_MATCH 0 +#define SEND_PACKET_UNCOMPRESSED 0 +#define PHSI_IS_ZERO 0 +#define PHSI_LEN 1 +#define ERROR_LEN 0 +#define PHS_BUFFER_SIZE 1532 +#define MAX_PHSRULE_PER_SF 20 +#define MAX_SERVICEFLOWS 17 + +/* PHS Error Defines */ +#define PHS_SUCCESS 0 +#define ERR_PHS_INVALID_DEVICE_EXETENSION 0x800 +#define ERR_PHS_INVALID_PHS_RULE 0x801 +#define ERR_PHS_RULE_ALREADY_EXISTS 0x802 +#define ERR_SF_MATCH_FAIL 0x803 +#define ERR_INVALID_CLASSIFIERTABLE_FOR_SF 0x804 +#define ERR_SFTABLE_FULL 0x805 +#define ERR_CLSASSIFIER_TABLE_FULL 0x806 +#define ERR_PHSRULE_MEMALLOC_FAIL 0x807 +#define ERR_CLSID_MATCH_FAIL 0x808 +#define ERR_PHSRULE_MATCH_FAIL 0x809 + +struct bcm_phs_rule { + u8 u8PHSI; + u8 u8PHSFLength; + u8 u8PHSF[MAX_PHS_LENGTHS]; + u8 u8PHSMLength; + u8 u8PHSM[MAX_PHS_LENGTHS]; + u8 u8PHSS; + u8 u8PHSV; + u8 u8RefCnt; + u8 bUnclassifiedPHSRule; + u8 u8Reserved[3]; + long PHSModifiedBytes; + unsigned long PHSModifiedNumPackets; + unsigned long PHSErrorNumPackets; +}; + +enum bcm_phs_classifier_context { eActiveClassifierRuleContext, eOldClassifierRuleContext -}E_CLASSIFIER_ENTRY_CONTEXT; - -typedef struct _S_CLASSIFIER_ENTRY -{ - B_UINT8 bUsed; - B_UINT16 uiClassifierRuleId; - B_UINT8 u8PHSI; - S_PHS_RULE *pstPhsRule; - B_UINT8 bUnclassifiedPHSRule; - -}S_CLASSIFIER_ENTRY; - - -typedef struct _S_CLASSIFIER_TABLE -{ - B_UINT16 uiTotalClassifiers; - S_CLASSIFIER_ENTRY stActivePhsRulesList[MAX_PHSRULE_PER_SF]; - S_CLASSIFIER_ENTRY stOldPhsRulesList[MAX_PHSRULE_PER_SF]; - B_UINT16 uiOldestPhsRuleIndex; - -}S_CLASSIFIER_TABLE; - - -typedef struct _S_SERVICEFLOW_ENTRY -{ - B_UINT8 bUsed; - B_UINT16 uiVcid; - S_CLASSIFIER_TABLE *pstClassifierTable; -}S_SERVICEFLOW_ENTRY; - -typedef struct _S_SERVICEFLOW_TABLE -{ - B_UINT16 uiTotalServiceFlows; - S_SERVICEFLOW_ENTRY stSFList[MAX_SERVICEFLOWS]; - -}S_SERVICEFLOW_TABLE; - - -typedef struct _PHS_DEVICE_EXTENSION -{ - /* PHS Specific data*/ - S_SERVICEFLOW_TABLE *pstServiceFlowPhsRulesTable; - void *CompressedTxBuffer; - void *UnCompressedRxBuffer; -}PHS_DEVICE_EXTENSION,*PPHS_DEVICE_EXTENSION; - +}; + +struct bcm_phs_classifier_entry { + u8 bUsed; + u16 uiClassifierRuleId; + u8 u8PHSI; + struct bcm_phs_rule *pstPhsRule; + u8 bUnclassifiedPHSRule; +}; + +struct bcm_phs_classifier_table { + u16 uiTotalClassifiers; + struct bcm_phs_classifier_entry stActivePhsRulesList[MAX_PHSRULE_PER_SF]; + struct bcm_phs_classifier_entry stOldPhsRulesList[MAX_PHSRULE_PER_SF]; + u16 uiOldestPhsRuleIndex; +}; + +struct bcm_phs_entry { + u8 bUsed; + u16 uiVcid; + struct bcm_phs_classifier_table *pstClassifierTable; +}; + +struct bcm_phs_table { + u16 uiTotalServiceFlows; + struct bcm_phs_entry stSFList[MAX_SERVICEFLOWS]; +}; + +struct bcm_phs_extension { + /* PHS Specific data */ + struct bcm_phs_table *pstServiceFlowPhsRulesTable; + void *CompressedTxBuffer; + void *UnCompressedRxBuffer; +}; #endif diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c index 6dc0bbcfeab0..7028bc95b4f9 100644 --- a/drivers/staging/bcm/PHSModule.c +++ b/drivers/staging/bcm/PHSModule.c @@ -1,24 +1,24 @@ #include "headers.h" -static UINT CreateSFToClassifierRuleMapping(B_UINT16 uiVcid,B_UINT16 uiClsId,S_SERVICEFLOW_TABLE *psServiceFlowTable,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI); +static UINT CreateSFToClassifierRuleMapping(B_UINT16 uiVcid,B_UINT16 uiClsId, struct bcm_phs_table *psServiceFlowTable, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI); -static UINT CreateClassiferToPHSRuleMapping(B_UINT16 uiVcid,B_UINT16 uiClsId,S_SERVICEFLOW_ENTRY *pstServiceFlowEntry,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI); +static UINT CreateClassiferToPHSRuleMapping(B_UINT16 uiVcid,B_UINT16 uiClsId, struct bcm_phs_entry *pstServiceFlowEntry, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI); -static UINT CreateClassifierPHSRule(B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule,E_CLASSIFIER_ENTRY_CONTEXT eClsContext,B_UINT8 u8AssociatedPHSI); +static UINT CreateClassifierPHSRule(B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, enum bcm_phs_classifier_context eClsContext,B_UINT8 u8AssociatedPHSI); -static UINT UpdateClassifierPHSRule(B_UINT16 uiClsId,S_CLASSIFIER_ENTRY *pstClassifierEntry,S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI); +static UINT UpdateClassifierPHSRule(B_UINT16 uiClsId, struct bcm_phs_classifier_entry *pstClassifierEntry, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI); -static BOOLEAN ValidatePHSRuleComplete(S_PHS_RULE *psPhsRule); +static BOOLEAN ValidatePHSRuleComplete(struct bcm_phs_rule *psPhsRule); -static BOOLEAN DerefPhsRule(B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable,S_PHS_RULE *pstPhsRule); +static BOOLEAN DerefPhsRule(B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *pstPhsRule); -static UINT GetClassifierEntry(S_CLASSIFIER_TABLE *pstClassifierTable,B_UINT32 uiClsid,E_CLASSIFIER_ENTRY_CONTEXT eClsContext, S_CLASSIFIER_ENTRY **ppstClassifierEntry); +static UINT GetClassifierEntry(struct bcm_phs_classifier_table *pstClassifierTable,B_UINT32 uiClsid, enum bcm_phs_classifier_context eClsContext, struct bcm_phs_classifier_entry **ppstClassifierEntry); -static UINT GetPhsRuleEntry(S_CLASSIFIER_TABLE *pstClassifierTable,B_UINT32 uiPHSI,E_CLASSIFIER_ENTRY_CONTEXT eClsContext,S_PHS_RULE **ppstPhsRule); +static UINT GetPhsRuleEntry(struct bcm_phs_classifier_table *pstClassifierTable,B_UINT32 uiPHSI, enum bcm_phs_classifier_context eClsContext, struct bcm_phs_rule **ppstPhsRule); -static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable); +static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesTable); -static int phs_compress(S_PHS_RULE *phs_members,unsigned char *in_buf, +static int phs_compress(struct bcm_phs_rule *phs_members, unsigned char *in_buf, unsigned char *out_buf,unsigned int *header_size,UINT *new_header_size ); @@ -26,7 +26,7 @@ static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buff unsigned char *phsf,unsigned char *phsm,unsigned int phss,unsigned int phsv,UINT *new_header_size ); static int phs_decompress(unsigned char *in_buf,unsigned char *out_buf,\ - S_PHS_RULE *phs_rules,UINT *header_size); + struct bcm_phs_rule *phs_rules, UINT *header_size); static ULONG PhsCompress(void* pvContext, @@ -291,17 +291,17 @@ void DumpFullPacket(UCHAR *pBuf,UINT nPktLen) // TRUE(1) -If allocation of memory was success full. // FALSE -If allocation of memory fails. //----------------------------------------------------------------------------- -int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension, struct bcm_mini_adapter *Adapter) +int phs_init(struct bcm_phs_extension *pPhsdeviceExtension, struct bcm_mini_adapter *Adapter) { int i; - S_SERVICEFLOW_TABLE *pstServiceFlowTable; + struct bcm_phs_table *pstServiceFlowTable; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nPHS:phs_init function "); if(pPhsdeviceExtension->pstServiceFlowPhsRulesTable) return -EINVAL; pPhsdeviceExtension->pstServiceFlowPhsRulesTable = - kzalloc(sizeof(S_SERVICEFLOW_TABLE), GFP_KERNEL); + kzalloc(sizeof(struct bcm_phs_table), GFP_KERNEL); if(!pPhsdeviceExtension->pstServiceFlowPhsRulesTable) { @@ -312,8 +312,8 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension, struct bcm_mini_adapter pstServiceFlowTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable; for(i=0;i<MAX_SERVICEFLOWS;i++) { - S_SERVICEFLOW_ENTRY sServiceFlow = pstServiceFlowTable->stSFList[i]; - sServiceFlow.pstClassifierTable = kzalloc(sizeof(S_CLASSIFIER_TABLE), GFP_KERNEL); + struct bcm_phs_entry sServiceFlow = pstServiceFlowTable->stSFList[i]; + sServiceFlow.pstClassifierTable = kzalloc(sizeof(struct bcm_phs_classifier_table), GFP_KERNEL); if(!sServiceFlow.pstClassifierTable) { BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed"); @@ -351,7 +351,7 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension, struct bcm_mini_adapter } -int PhsCleanup(IN PPHS_DEVICE_EXTENSION pPHSDeviceExt) +int PhsCleanup(IN struct bcm_phs_extension *pPHSDeviceExt) { if(pPHSDeviceExt->pstServiceFlowPhsRulesTable) { @@ -381,7 +381,7 @@ Arguments: IN void* pvContext - PHS Driver Specific Context IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies. - IN S_PHS_RULE *psPhsRule - The PHS Rule strcuture to be added to the PHS Rule table. + IN struct bcm_phs_rule *psPhsRule - The PHS Rule strcuture to be added to the PHS Rule table. Return Value: @@ -392,17 +392,17 @@ Return Value: ULONG PhsUpdateClassifierRule(IN void* pvContext, IN B_UINT16 uiVcid , IN B_UINT16 uiClsId , - IN S_PHS_RULE *psPhsRule, + IN struct bcm_phs_rule *psPhsRule, IN B_UINT8 u8AssociatedPHSI) { ULONG lStatus =0; UINT nSFIndex =0 ; - S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; + struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; + struct bcm_phs_extension *pDeviceExtension= (struct bcm_phs_extension *)pvContext; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"PHS With Corr2 Changes \n"); @@ -460,12 +460,12 @@ ULONG PhsDeletePHSRule(IN void* pvContext,IN B_UINT16 uiVcid,IN B_UINT8 u8PHSI) { ULONG lStatus =0; UINT nSFIndex =0, nClsidIndex =0 ; - S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; - S_CLASSIFIER_TABLE *pstClassifierRulesTable = NULL; + struct bcm_phs_entry *pstServiceFlowEntry = NULL; + struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; + struct bcm_phs_extension *pDeviceExtension= (struct bcm_phs_extension *)pvContext; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "======>\n"); @@ -495,7 +495,7 @@ ULONG PhsDeletePHSRule(IN void* pvContext,IN B_UINT16 uiVcid,IN B_UINT8 u8PHSI) if(0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule); memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, - sizeof(S_CLASSIFIER_ENTRY)); + sizeof(struct bcm_phs_classifier_entry)); } } } @@ -526,10 +526,10 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 { ULONG lStatus =0; UINT nSFIndex =0, nClsidIndex =0 ; - S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; - S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL; + struct bcm_phs_entry *pstServiceFlowEntry = NULL; + struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; + struct bcm_phs_extension *pDeviceExtension= (struct bcm_phs_extension *)pvContext; if(pDeviceExtension) { @@ -554,7 +554,7 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 kfree(pstClassifierEntry->pstPhsRule); } - memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY)); + memset(pstClassifierEntry, 0, sizeof(struct bcm_phs_classifier_entry)); } nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, @@ -563,7 +563,7 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) { kfree(pstClassifierEntry->pstPhsRule); - memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY)); + memset(pstClassifierEntry, 0, sizeof(struct bcm_phs_classifier_entry)); } } return lStatus; @@ -590,10 +590,10 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) ULONG lStatus =0; UINT nSFIndex =0, nClsidIndex =0 ; - S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; - S_CLASSIFIER_TABLE *pstClassifierRulesTable = NULL; + struct bcm_phs_entry *pstServiceFlowEntry = NULL; + struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; + struct bcm_phs_extension *pDeviceExtension= (struct bcm_phs_extension *)pvContext; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"====> \n"); if(pDeviceExtension) @@ -624,7 +624,7 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] .pstPhsRule = NULL; } - memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY)); + memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(struct bcm_phs_classifier_entry)); if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) { if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] @@ -638,7 +638,7 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] .pstPhsRule = NULL; } - memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY)); + memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex], 0, sizeof(struct bcm_phs_classifier_entry)); } } pstServiceFlowEntry->bUsed = FALSE; @@ -680,15 +680,15 @@ ULONG PhsCompress(IN void* pvContext, OUT UINT *pNewHeaderSize ) { UINT nSFIndex =0, nClsidIndex =0 ; - S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; - S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL; - S_PHS_RULE *pstPhsRule = NULL; + struct bcm_phs_entry *pstServiceFlowEntry = NULL; + struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; + struct bcm_phs_rule *pstPhsRule = NULL; ULONG lStatus =0; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; + struct bcm_phs_extension *pDeviceExtension= (struct bcm_phs_extension *)pvContext; if(pDeviceExtension == NULL) @@ -775,12 +775,12 @@ ULONG PhsDeCompress(IN void* pvContext, OUT UINT *pOutHeaderSize ) { UINT nSFIndex =0, nPhsRuleIndex =0 ; - S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; - S_PHS_RULE *pstPhsRule = NULL; + struct bcm_phs_entry *pstServiceFlowEntry = NULL; + struct bcm_phs_rule *pstPhsRule = NULL; UINT phsi; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - PPHS_DEVICE_EXTENSION pDeviceExtension= - (PPHS_DEVICE_EXTENSION)pvContext; + struct bcm_phs_extension *pDeviceExtension= + (struct bcm_phs_extension *)pvContext; *pInHeaderSize = 0; @@ -844,7 +844,7 @@ ULONG PhsDeCompress(IN void* pvContext, // Does not return any value. //----------------------------------------------------------------------------- -static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable) +static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesTable) { int i,j; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); @@ -854,9 +854,9 @@ static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTa { for(i=0;i<MAX_SERVICEFLOWS;i++) { - S_SERVICEFLOW_ENTRY stServiceFlowEntry = + struct bcm_phs_entry stServiceFlowEntry = psServiceFlowRulesTable->stSFList[i]; - S_CLASSIFIER_TABLE *pstClassifierRulesTable = + struct bcm_phs_classifier_table *pstClassifierRulesTable = stServiceFlowEntry.pstClassifierTable; if(pstClassifierRulesTable) @@ -898,7 +898,7 @@ static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTa -static BOOLEAN ValidatePHSRuleComplete(IN S_PHS_RULE *psPhsRule) +static BOOLEAN ValidatePHSRuleComplete(IN struct bcm_phs_rule *psPhsRule) { if(psPhsRule) { @@ -927,8 +927,8 @@ static BOOLEAN ValidatePHSRuleComplete(IN S_PHS_RULE *psPhsRule) } } -UINT GetServiceFlowEntry(IN S_SERVICEFLOW_TABLE *psServiceFlowTable, - IN B_UINT16 uiVcid,S_SERVICEFLOW_ENTRY **ppstServiceFlowEntry) +UINT GetServiceFlowEntry(IN struct bcm_phs_table *psServiceFlowTable, + IN B_UINT16 uiVcid, struct bcm_phs_entry **ppstServiceFlowEntry) { int i; for(i=0;i<MAX_SERVICEFLOWS;i++) @@ -948,12 +948,12 @@ UINT GetServiceFlowEntry(IN S_SERVICEFLOW_TABLE *psServiceFlowTable, } -UINT GetClassifierEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable, - IN B_UINT32 uiClsid,E_CLASSIFIER_ENTRY_CONTEXT eClsContext, - OUT S_CLASSIFIER_ENTRY **ppstClassifierEntry) +UINT GetClassifierEntry(IN struct bcm_phs_classifier_table *pstClassifierTable, + IN B_UINT32 uiClsid, enum bcm_phs_classifier_context eClsContext, + OUT struct bcm_phs_classifier_entry **ppstClassifierEntry) { int i; - S_CLASSIFIER_ENTRY *psClassifierRules = NULL; + struct bcm_phs_classifier_entry *psClassifierRules = NULL; for(i=0;i<MAX_PHSRULE_PER_SF;i++) { @@ -981,12 +981,12 @@ UINT GetClassifierEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable, return PHS_INVALID_TABLE_INDEX; } -static UINT GetPhsRuleEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable, - IN B_UINT32 uiPHSI,E_CLASSIFIER_ENTRY_CONTEXT eClsContext, - OUT S_PHS_RULE **ppstPhsRule) +static UINT GetPhsRuleEntry(IN struct bcm_phs_classifier_table *pstClassifierTable, + IN B_UINT32 uiPHSI, enum bcm_phs_classifier_context eClsContext, + OUT struct bcm_phs_rule **ppstPhsRule) { int i; - S_CLASSIFIER_ENTRY *pstClassifierRule = NULL; + struct bcm_phs_classifier_entry *pstClassifierRule = NULL; for(i=0;i<MAX_PHSRULE_PER_SF;i++) { if(eClsContext == eActiveClassifierRuleContext) @@ -1013,11 +1013,11 @@ static UINT GetPhsRuleEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable, } UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId, - IN S_SERVICEFLOW_TABLE *psServiceFlowTable,S_PHS_RULE *psPhsRule, + IN struct bcm_phs_table *psServiceFlowTable, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI) { - S_CLASSIFIER_TABLE *psaClassifiertable = NULL; + struct bcm_phs_classifier_table *psaClassifiertable = NULL; UINT uiStatus = 0; int iSfIndex; BOOLEAN bFreeEntryFound =FALSE; @@ -1050,13 +1050,13 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId, } UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, - IN B_UINT16 uiClsId,IN S_SERVICEFLOW_ENTRY *pstServiceFlowEntry, - S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI) + IN B_UINT16 uiClsId,IN struct bcm_phs_entry *pstServiceFlowEntry, + struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI) { - S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL; + struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; UINT uiStatus =PHS_SUCCESS; UINT nClassifierIndex = 0; - S_CLASSIFIER_TABLE *psaClassifiertable = NULL; + struct bcm_phs_classifier_table *psaClassifiertable = NULL; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); psaClassifiertable = pstServiceFlowEntry->pstClassifierTable; @@ -1141,12 +1141,12 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, } static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, - S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule, - E_CLASSIFIER_ENTRY_CONTEXT eClsContext,B_UINT8 u8AssociatedPHSI) + struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, + enum bcm_phs_classifier_context eClsContext,B_UINT8 u8AssociatedPHSI) { UINT iClassifierIndex = 0; BOOLEAN bFreeEntryFound = FALSE; - S_CLASSIFIER_ENTRY *psClassifierRules = NULL; + struct bcm_phs_classifier_entry *psClassifierRules = NULL; UINT nStatus = PHS_SUCCESS; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"Inside CreateClassifierPHSRule"); @@ -1227,7 +1227,7 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, { if(psClassifierRules->pstPhsRule == NULL) { - psClassifierRules->pstPhsRule = kmalloc(sizeof(S_PHS_RULE),GFP_KERNEL); + psClassifierRules->pstPhsRule = kmalloc(sizeof(struct bcm_phs_rule),GFP_KERNEL); if(NULL == psClassifierRules->pstPhsRule) return ERR_PHSRULE_MEMALLOC_FAIL; @@ -1240,7 +1240,7 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, /* Update The PHS rule */ memcpy(psClassifierRules->pstPhsRule, - psPhsRule, sizeof(S_PHS_RULE)); + psPhsRule, sizeof(struct bcm_phs_rule)); } else { @@ -1252,11 +1252,11 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, - IN S_CLASSIFIER_ENTRY *pstClassifierEntry, - S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule, + IN struct bcm_phs_classifier_entry *pstClassifierEntry, + struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI) { - S_PHS_RULE *pstAddPhsRule = NULL; + struct bcm_phs_rule *pstAddPhsRule = NULL; UINT nPhsRuleIndex = 0; BOOLEAN bPHSRuleOrphaned = FALSE; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); @@ -1281,13 +1281,13 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, //Step 2.a PHS Rule Does Not Exist .Create New PHS Rule for uiClsId if(FALSE == bPHSRuleOrphaned) { - pstClassifierEntry->pstPhsRule = kmalloc(sizeof(S_PHS_RULE), GFP_KERNEL); + pstClassifierEntry->pstPhsRule = kmalloc(sizeof(struct bcm_phs_rule), GFP_KERNEL); if(NULL == pstClassifierEntry->pstPhsRule) { return ERR_PHSRULE_MEMALLOC_FAIL; } } - memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(S_PHS_RULE)); + memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(struct bcm_phs_rule)); } else @@ -1312,7 +1312,7 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, } -static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable,S_PHS_RULE *pstPhsRule) +static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *pstPhsRule) { if(pstPhsRule==NULL) return FALSE; @@ -1331,14 +1331,14 @@ static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifi } } -void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension) +void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension) { int i,j,k,l; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n Dumping PHS Rules : \n"); for(i=0;i<MAX_SERVICEFLOWS;i++) { - S_SERVICEFLOW_ENTRY stServFlowEntry = + struct bcm_phs_entry stServFlowEntry = pDeviceExtension->pstServiceFlowPhsRulesTable->stSFList[i]; if(stServFlowEntry.bUsed) { @@ -1346,7 +1346,7 @@ void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension) { for(l=0;l<2;l++) { - S_CLASSIFIER_ENTRY stClsEntry; + struct bcm_phs_classifier_entry stClsEntry; if(l==0) { stClsEntry = stServFlowEntry.pstClassifierTable->stActivePhsRulesList[j]; @@ -1408,10 +1408,10 @@ void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension) //----------------------------------------------------------------------------- int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, - S_PHS_RULE *decomp_phs_rules,UINT *header_size) + struct bcm_phs_rule *decomp_phs_rules, UINT *header_size) { int phss,size=0; - S_PHS_RULE *tmp_memb; + struct bcm_phs_rule *tmp_memb; int bit,i=0; unsigned char *phsf,*phsm; int in_buf_len = *header_size-1; @@ -1490,7 +1490,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, // size-The number of bytes copied into the output buffer i.e dynamic fields // 0 -If PHS rule is NULL.If PHSV field is not set.If the verification fails. //----------------------------------------------------------------------------- -static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf +static int phs_compress(struct bcm_phs_rule *phs_rule, unsigned char *in_buf ,unsigned char *out_buf,UINT *header_size,UINT *new_header_size) { unsigned char *old_addr = out_buf; diff --git a/drivers/staging/bcm/PHSModule.h b/drivers/staging/bcm/PHSModule.h index b5f21157ac47..82d868284180 100644 --- a/drivers/staging/bcm/PHSModule.h +++ b/drivers/staging/bcm/PHSModule.h @@ -22,15 +22,15 @@ void DumpDataPacketHeader(PUCHAR pPkt); void DumpFullPacket(UCHAR *pBuf,UINT nPktLen); -void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension); +void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension); -int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,struct bcm_mini_adapter *Adapter); +int phs_init(struct bcm_phs_extension *pPhsdeviceExtension,struct bcm_mini_adapter *Adapter); -int PhsCleanup(PPHS_DEVICE_EXTENSION pPHSDeviceExt); +int PhsCleanup(struct bcm_phs_extension *pPHSDeviceExt); //Utility Functions -ULONG PhsUpdateClassifierRule(void* pvContext,B_UINT16 uiVcid,B_UINT16 uiClsId,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI ); +ULONG PhsUpdateClassifierRule(void* pvContext,B_UINT16 uiVcid,B_UINT16 uiClsId, struct bcm_phs_rule *psPhsRule,B_UINT8 u8AssociatedPHSI ); ULONG PhsDeletePHSRule(void* pvContext,B_UINT16 uiVcid,B_UINT8 u8PHSI); @@ -39,12 +39,12 @@ ULONG PhsDeleteClassifierRule(void* pvContext, B_UINT16 uiVcid ,B_UINT16 uiClsI ULONG PhsDeleteSFRules(void* pvContext,B_UINT16 uiVcid) ; -BOOLEAN ValidatePHSRule(S_PHS_RULE *psPhsRule); +BOOLEAN ValidatePHSRule(struct bcm_phs_rule *psPhsRule); -UINT GetServiceFlowEntry(S_SERVICEFLOW_TABLE *psServiceFlowTable,B_UINT16 uiVcid,S_SERVICEFLOW_ENTRY **ppstServiceFlowEntry); +UINT GetServiceFlowEntry(struct bcm_phs_table *psServiceFlowTable,B_UINT16 uiVcid, struct bcm_phs_entry **ppstServiceFlowEntry); -void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension); +void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension); #endif diff --git a/drivers/staging/bcm/Protocol.h b/drivers/staging/bcm/Protocol.h index 562d4dd81a7c..9818128d9320 100644 --- a/drivers/staging/bcm/Protocol.h +++ b/drivers/staging/bcm/Protocol.h @@ -1,98 +1,83 @@ /************************************ -* Protocol.h +* Protocol.h *************************************/ #ifndef __PROTOCOL_H__ #define __PROTOCOL_H__ - -#define IPV4 4 -#define IPV6 6 - +#define IPV4 4 +#define IPV6 6 struct ArpHeader { - struct arphdr arp; - unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ - unsigned char ar_sip[4]; /* sender IP address */ - unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ - unsigned char ar_tip[4]; /* target IP address */ -}/*__attribute__((packed))*/; - - -struct TransportHeaderT -{ - union - { + struct arphdr arp; + unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ + unsigned char ar_sip[4]; /* sender IP address */ + unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ + unsigned char ar_tip[4]; /* target IP address */ +}; + +struct bcm_transport_header { + union { struct udphdr uhdr; struct tcphdr thdr; }; -} __attribute__((packed)); -typedef struct TransportHeaderT xporthdr; - +} __packed; -typedef enum _E_NWPKT_IPFRAME_TYPE -{ +enum bcm_ip_frame_type { eNonIPPacket, eIPv4Packet, eIPv6Packet -}E_NWPKT_IPFRAME_TYPE; +}; -typedef enum _E_NWPKT_ETHFRAME_TYPE -{ +enum bcm_eth_frame_type { eEthUnsupportedFrame, eEth802LLCFrame, eEth802LLCSNAPFrame, eEth802QVLANFrame, eEthOtherFrame -} E_NWPKT_ETHFRAME_TYPE; - -typedef struct _S_ETHCS_PKT_INFO -{ - E_NWPKT_IPFRAME_TYPE eNwpktIPFrameType; - E_NWPKT_ETHFRAME_TYPE eNwpktEthFrameType; - USHORT usEtherType; - UCHAR ucDSAP; -}S_ETHCS_PKT_INFO,*PS_ETHCS_PKT_INFO; - -typedef struct _ETH_CS_802_Q_FRAME -{ +}; + +struct bcm_eth_packet_info { + enum bcm_ip_frame_type eNwpktIPFrameType; + enum bcm_eth_frame_type eNwpktEthFrameType; + unsigned short usEtherType; + unsigned char ucDSAP; +}; + +struct bcm_eth_q_frame { struct bcm_eth_header EThHdr; - USHORT UserPriority:3; - USHORT CFI:1; - USHORT VLANID:12; - USHORT EthType; -} __attribute__((packed)) ETH_CS_802_Q_FRAME; - -typedef struct _ETH_CS_802_LLC_FRAME -{ + unsigned short UserPriority:3; + unsigned short CFI:1; + unsigned short VLANID:12; + unsigned short EthType; +} __packed; + +struct bcm_eth_llc_frame { struct bcm_eth_header EThHdr; unsigned char DSAP; unsigned char SSAP; unsigned char Control; -}__attribute__((packed)) ETH_CS_802_LLC_FRAME; +} __packed; -typedef struct _ETH_CS_802_LLC_SNAP_FRAME -{ +struct bcm_eth_llc_snap_frame { struct bcm_eth_header EThHdr; unsigned char DSAP; unsigned char SSAP; unsigned char Control; unsigned char OUI[3]; unsigned short usEtherType; -} __attribute__((packed)) ETH_CS_802_LLC_SNAP_FRAME; +} __packed; -typedef struct _ETH_CS_ETH2_FRAME -{ +struct bcm_ethernet2_frame { struct bcm_eth_header EThHdr; -} __attribute__((packed)) ETH_CS_ETH2_FRAME; +} __packed; #define ETHERNET_FRAMETYPE_IPV4 ntohs(0x0800) -#define ETHERNET_FRAMETYPE_IPV6 ntohs(0x86dd) -#define ETHERNET_FRAMETYPE_802QVLAN ntohs(0x8100) +#define ETHERNET_FRAMETYPE_IPV6 ntohs(0x86dd) +#define ETHERNET_FRAMETYPE_802QVLAN ntohs(0x8100) -//Per SF CS Specification Encodings -typedef enum _E_SERVICEFLOW_CS_SPEC_ -{ - eCSSpecUnspecified =0, +/* Per SF CS Specification Encodings */ +enum bcm_spec_encoding { + eCSSpecUnspecified = 0, eCSPacketIPV4, eCSPacketIPV6, eCS802_3PacketEthernet, @@ -102,50 +87,42 @@ typedef enum _E_SERVICEFLOW_CS_SPEC_ eCSPacketIPV4Over802_1QVLAN, eCSPacketIPV6Over802_1QVLAN, eCSPacketUnsupported -}E_SERVICEFLOW_CS_SPEC; - - -#define IP6_HEADER_LEN 40 - -#define IP_VERSION(byte) (((byte&0xF0)>>4)) - +}; +#define IP6_HEADER_LEN 40 +#define IP_VERSION(byte) (((byte&0xF0)>>4)) #define MAC_ADDRESS_SIZE 6 -#define ETH_AND_IP_HEADER_LEN 14 + 20 -#define L4_SRC_PORT_LEN 2 -#define L4_DEST_PORT_LEN 2 - - - -#define CTRL_PKT_LEN 8 + ETH_AND_IP_HEADER_LEN - -#define ETH_ARP_FRAME 0x806 -#define ETH_IPV4_FRAME 0x800 -#define ETH_IPV6_FRAME 0x86DD -#define UDP 0x11 -#define TCP 0x06 - -#define ARP_OP_REQUEST 0x01 -#define ARP_OP_REPLY 0x02 -#define ARP_PKT_SIZE 60 - -// This is the format for the TCP packet header -typedef struct _TCP_HEADER -{ - USHORT usSrcPort; - USHORT usDestPort; - ULONG ulSeqNumber; - ULONG ulAckNumber; - UCHAR HeaderLength; - UCHAR ucFlags; - USHORT usWindowsSize; - USHORT usChkSum; - USHORT usUrgetPtr; -} TCP_HEADER,*PTCP_HEADER; -#define TCP_HEADER_LEN sizeof(TCP_HEADER) -#define TCP_ACK 0x10 //Bit 4 in tcpflags field. +#define ETH_AND_IP_HEADER_LEN (14 + 20) +#define L4_SRC_PORT_LEN 2 +#define L4_DEST_PORT_LEN 2 +#define CTRL_PKT_LEN (8 + ETH_AND_IP_HEADER_LEN) + +#define ETH_ARP_FRAME 0x806 +#define ETH_IPV4_FRAME 0x800 +#define ETH_IPV6_FRAME 0x86DD +#define UDP 0x11 +#define TCP 0x06 + +#define ARP_OP_REQUEST 0x01 +#define ARP_OP_REPLY 0x02 +#define ARP_PKT_SIZE 60 + +/* This is the format for the TCP packet header */ +struct bcm_tcp_header { + unsigned short usSrcPort; + unsigned short usDestPort; + unsigned long ulSeqNumber; + unsigned long ulAckNumber; + unsigned char HeaderLength; + unsigned char ucFlags; + unsigned short usWindowsSize; + unsigned short usChkSum; + unsigned short usUrgetPtr; +}; + +#define TCP_HEADER_LEN sizeof(struct bcm_tcp_header) +#define TCP_ACK 0x10 /* Bit 4 in tcpflags field. */ #define GET_TCP_HEADER_LEN(byte) ((byte&0xF0)>>4) - -#endif //__PROTOCOL_H__ +#endif /* __PROTOCOL_H__ */ diff --git a/drivers/staging/bcm/Prototypes.h b/drivers/staging/bcm/Prototypes.h index 90dbe0f4785e..2a673b125f00 100644 --- a/drivers/staging/bcm/Prototypes.h +++ b/drivers/staging/bcm/Prototypes.h @@ -33,9 +33,9 @@ INT SearchSfid(struct bcm_mini_adapter *Adapter,UINT uiSfid); USHORT ClassifyPacket(struct bcm_mini_adapter *Adapter,struct sk_buff* skb); -BOOLEAN MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort); -BOOLEAN MatchDestPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort); -BOOLEAN MatchProtocol(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucProtocol); +bool MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort); +bool MatchDestPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort); +bool MatchProtocol(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucProtocol); INT SetupNextSend(struct bcm_mini_adapter *Adapter, /**<Logical Adapter*/ diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c index 1b857bd887f0..8d142a547e7f 100644 --- a/drivers/staging/bcm/Qos.c +++ b/drivers/staging/bcm/Qos.c @@ -4,8 +4,8 @@ This file contains the routines related to Quality of Service. */ #include "headers.h" -static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,PVOID pvEthPayload,PS_ETHCS_PKT_INFO pstEthCsPktInfo); -static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo,struct bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport); +static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,PVOID pvEthPayload, struct bcm_eth_packet_info *pstEthCsPktInfo); +static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter,struct sk_buff* skb, struct bcm_eth_packet_info *pstEthCsPktInfo,struct bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport); static USHORT IpVersion4(struct bcm_mini_adapter *Adapter, struct iphdr *iphd, struct bcm_classifier_rule *pstClassifierRule ); @@ -117,7 +117,7 @@ BOOLEAN MatchTos(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucTypeOfSer * * Returns - TRUE(If address matches) else FAIL. ****************************************************************************/ -BOOLEAN MatchProtocol(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucProtocol) +bool MatchProtocol(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucProtocol) { UCHAR ucLoopIndex=0; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); @@ -146,7 +146,7 @@ BOOLEAN MatchProtocol(struct bcm_classifier_rule *pstClassifierRule,UCHAR ucProt * * Returns - TRUE(If address matches) else FAIL. ***************************************************************************/ -BOOLEAN MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort) +bool MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrcPort) { UCHAR ucLoopIndex=0; @@ -178,7 +178,7 @@ BOOLEAN MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushSrc * * Returns - TRUE(If address matches) else FAIL. ***************************************************************************/ -BOOLEAN MatchDestPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushDestPort) +bool MatchDestPort(struct bcm_classifier_rule *pstClassifierRule,USHORT ushDestPort) { UCHAR ucLoopIndex=0; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); @@ -208,12 +208,12 @@ static USHORT IpVersion4(struct bcm_mini_adapter *Adapter, struct iphdr *iphd, struct bcm_classifier_rule *pstClassifierRule) { - xporthdr *xprt_hdr=NULL; + struct bcm_transport_header *xprt_hdr = NULL; BOOLEAN bClassificationSucceed=FALSE; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "========>"); - xprt_hdr=(xporthdr *)((PUCHAR)iphd + sizeof(struct iphdr)); + xprt_hdr=(struct bcm_transport_header *)((PUCHAR)iphd + sizeof(struct iphdr)); do { BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Trying to see Direction = %d %d", @@ -446,7 +446,7 @@ USHORT ClassifyPacket(struct bcm_mini_adapter *Adapter,struct sk_buff* skb) { INT uiLoopIndex=0; struct bcm_classifier_rule *pstClassifierRule = NULL; - S_ETHCS_PKT_INFO stEthCsPktInfo; + struct bcm_eth_packet_info stEthCsPktInfo; PVOID pvEThPayload = NULL; struct iphdr *pIpHeader = NULL; INT uiSfIndex=0; @@ -454,7 +454,7 @@ USHORT ClassifyPacket(struct bcm_mini_adapter *Adapter,struct sk_buff* skb) BOOLEAN bFragmentedPkt=FALSE,bClassificationSucceed=FALSE; USHORT usCurrFragment =0; - PTCP_HEADER pTcpHeader; + struct bcm_tcp_header *pTcpHeader; UCHAR IpHeaderLength; UCHAR TcpHeaderLength; @@ -467,32 +467,32 @@ USHORT ClassifyPacket(struct bcm_mini_adapter *Adapter,struct sk_buff* skb) case eEth802LLCFrame: { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : 802LLCFrame\n"); - pIpHeader = pvEThPayload + sizeof(ETH_CS_802_LLC_FRAME); + pIpHeader = pvEThPayload + sizeof(struct bcm_eth_llc_frame); break; } case eEth802LLCSNAPFrame: { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : 802LLC SNAP Frame\n"); - pIpHeader = pvEThPayload + sizeof(ETH_CS_802_LLC_SNAP_FRAME); + pIpHeader = pvEThPayload + sizeof(struct bcm_eth_llc_snap_frame); break; } case eEth802QVLANFrame: { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : 802.1Q VLANFrame\n"); - pIpHeader = pvEThPayload + sizeof(ETH_CS_802_Q_FRAME); + pIpHeader = pvEThPayload + sizeof(struct bcm_eth_q_frame); break; } case eEthOtherFrame: { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : ETH Other Frame\n"); - pIpHeader = pvEThPayload + sizeof(ETH_CS_ETH2_FRAME); + pIpHeader = pvEThPayload + sizeof(struct bcm_ethernet2_frame); break; } default: { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : Unrecognized ETH Frame\n"); - pIpHeader = pvEThPayload + sizeof(ETH_CS_ETH2_FRAME); + pIpHeader = pvEThPayload + sizeof(struct bcm_ethernet2_frame); break; } } @@ -614,7 +614,7 @@ USHORT ClassifyPacket(struct bcm_mini_adapter *Adapter,struct sk_buff* skb) if((TCP == pIpHeader->protocol ) && !bFragmentedPkt && (ETH_AND_IP_HEADER_LEN + TCP_HEADER_LEN <= skb->len) ) { IpHeaderLength = pIpHeader->ihl; - pTcpHeader = (PTCP_HEADER)(((PUCHAR)pIpHeader)+(IpHeaderLength*4)); + pTcpHeader = (struct bcm_tcp_header *)(((PUCHAR)pIpHeader)+(IpHeaderLength*4)); TcpHeaderLength = GET_TCP_HEADER_LEN(pTcpHeader->HeaderLength); if((pTcpHeader->ucFlags & TCP_ACK) && @@ -683,7 +683,7 @@ static BOOLEAN EthCSMatchDestMACAddress(struct bcm_classifier_rule *pstClassifie return TRUE; } -static BOOLEAN EthCSMatchEThTypeSAP(struct bcm_classifier_rule *pstClassifierRule,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo) +static BOOLEAN EthCSMatchEThTypeSAP(struct bcm_classifier_rule *pstClassifierRule,struct sk_buff* skb, struct bcm_eth_packet_info *pstEthCsPktInfo) { struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if((pstClassifierRule->ucEtherTypeLen==0)|| @@ -718,7 +718,7 @@ static BOOLEAN EthCSMatchEThTypeSAP(struct bcm_classifier_rule *pstClassifierRul } -static BOOLEAN EthCSMatchVLANRules(struct bcm_classifier_rule *pstClassifierRule,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo) +static BOOLEAN EthCSMatchVLANRules(struct bcm_classifier_rule *pstClassifierRule,struct sk_buff* skb, struct bcm_eth_packet_info *pstEthCsPktInfo) { BOOLEAN bClassificationSucceed = FALSE; USHORT usVLANID; @@ -769,7 +769,7 @@ static BOOLEAN EthCSMatchVLANRules(struct bcm_classifier_rule *pstClassifierRule static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter,struct sk_buff* skb, - PS_ETHCS_PKT_INFO pstEthCsPktInfo, + struct bcm_eth_packet_info *pstEthCsPktInfo, struct bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport) { @@ -802,7 +802,7 @@ static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter,struct sk_buff* } static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,PVOID pvEthPayload, - PS_ETHCS_PKT_INFO pstEthCsPktInfo) + struct bcm_eth_packet_info *pstEthCsPktInfo) { USHORT u16Etype = ntohs(((struct bcm_eth_header *)pvEthPayload)->u16Etype); @@ -815,7 +815,7 @@ static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,PVOID pvEthPayload, { //802.1Q VLAN Header pstEthCsPktInfo->eNwpktEthFrameType = eEth802QVLANFrame; - u16Etype = ((ETH_CS_802_Q_FRAME*)pvEthPayload)->EthType; + u16Etype = ((struct bcm_eth_q_frame *)pvEthPayload)->EthType; //((ETH_CS_802_Q_FRAME*)pvEthPayload)->UserPriority } else @@ -830,12 +830,12 @@ static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,PVOID pvEthPayload, //802.2 LLC BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "802.2 LLC Frame \n"); pstEthCsPktInfo->eNwpktEthFrameType = eEth802LLCFrame; - pstEthCsPktInfo->ucDSAP = ((ETH_CS_802_LLC_FRAME*)pvEthPayload)->DSAP; - if(pstEthCsPktInfo->ucDSAP == 0xAA && ((ETH_CS_802_LLC_FRAME*)pvEthPayload)->SSAP == 0xAA) + pstEthCsPktInfo->ucDSAP = ((struct bcm_eth_llc_frame *)pvEthPayload)->DSAP; + if(pstEthCsPktInfo->ucDSAP == 0xAA && ((struct bcm_eth_llc_frame *)pvEthPayload)->SSAP == 0xAA) { //SNAP Frame pstEthCsPktInfo->eNwpktEthFrameType = eEth802LLCSNAPFrame; - u16Etype = ((ETH_CS_802_LLC_SNAP_FRAME*)pvEthPayload)->usEtherType; + u16Etype = ((struct bcm_eth_llc_snap_frame *)pvEthPayload)->usEtherType; } } if(u16Etype == ETHERNET_FRAMETYPE_IPV4) diff --git a/drivers/staging/bcm/hostmibs.c b/drivers/staging/bcm/hostmibs.c index 3c5f4a5f0376..f55300db1d48 100644 --- a/drivers/staging/bcm/hostmibs.c +++ b/drivers/staging/bcm/hostmibs.c @@ -11,11 +11,11 @@ INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter, struct bcm_host_stats_mibs *pstHostMibs) { - S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; - S_PHS_RULE *pstPhsRule = NULL; - S_CLASSIFIER_TABLE *pstClassifierTable = NULL; - S_CLASSIFIER_ENTRY *pstClassifierRule = NULL; - PPHS_DEVICE_EXTENSION pDeviceExtension = (PPHS_DEVICE_EXTENSION) &Adapter->stBCMPhsContext; + struct bcm_phs_entry *pstServiceFlowEntry = NULL; + struct bcm_phs_rule *pstPhsRule = NULL; + struct bcm_phs_classifier_table *pstClassifierTable = NULL; + struct bcm_phs_classifier_entry *pstClassifierRule = NULL; + struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *) &Adapter->stBCMPhsContext; UINT nClassifierIndex = 0, nPhsTableIndex = 0, nSfIndex = 0, uiIndex = 0; @@ -70,7 +70,7 @@ INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter, struct bcm_host_stats_m memcpy(&pstHostMibs-> astPhsRulesTable[nPhsTableIndex].u8PHSI, - &pstPhsRule->u8PHSI, sizeof(S_PHS_RULE)); + &pstPhsRule->u8PHSI, sizeof(struct bcm_phs_rule)); nPhsTableIndex++; } diff --git a/drivers/staging/bcm/led_control.c b/drivers/staging/bcm/led_control.c index 252a1b31d618..05a948a3698c 100644 --- a/drivers/staging/bcm/led_control.c +++ b/drivers/staging/bcm/led_control.c @@ -24,7 +24,7 @@ BOOLEAN IsReqGpioIsLedInNVM(struct bcm_mini_adapter *Adapter, UINT gpios) } static INT LED_Blink(struct bcm_mini_adapter *Adapter, UINT GPIO_Num, UCHAR uiLedIndex, - ULONG timeout, INT num_of_time, LedEventInfo_t currdriverstate) + ULONG timeout, INT num_of_time, enum bcm_led_events currdriverstate) { int Status = STATUS_SUCCESS; BOOLEAN bInfinite = FALSE; @@ -97,7 +97,7 @@ static INT ScaleRateofTransfer(ULONG rate) static INT LED_Proportional_Blink(struct bcm_mini_adapter *Adapter, UCHAR GPIO_Num_tx, UCHAR uiTxLedIndex, UCHAR GPIO_Num_rx, UCHAR uiRxLedIndex, - LedEventInfo_t currdriverstate) + enum bcm_led_events currdriverstate) { /* Initial values of TX and RX packets */ ULONG64 Initial_num_of_packts_tx = 0, Initial_num_of_packts_rx = 0; @@ -607,7 +607,7 @@ static VOID LedGpioInit(struct bcm_mini_adapter *Adapter) static INT BcmGetGPIOPinInfo(struct bcm_mini_adapter *Adapter, UCHAR *GPIO_num_tx, UCHAR *GPIO_num_rx, UCHAR *uiLedTxIndex, UCHAR *uiLedRxIndex, - LedEventInfo_t currdriverstate) + enum bcm_led_events currdriverstate) { UINT uiIndex = 0; @@ -651,7 +651,7 @@ static VOID LEDControlThread(struct bcm_mini_adapter *Adapter) UCHAR GPIO_num = 0; UCHAR uiLedIndex = 0; UINT uiResetValue = 0; - LedEventInfo_t currdriverstate = 0; + enum bcm_led_events currdriverstate = 0; ulong timeout = 0; INT Status = 0; diff --git a/drivers/staging/bcm/led_control.h b/drivers/staging/bcm/led_control.h index ed8fbc091115..bae40e22e11b 100644 --- a/drivers/staging/bcm/led_control.h +++ b/drivers/staging/bcm/led_control.h @@ -1,102 +1,84 @@ #ifndef _LED_CONTROL_H #define _LED_CONTROL_H -/*************************TYPE DEF**********************/ -#define NUM_OF_LEDS 4 - +#define NUM_OF_LEDS 4 #define DSD_START_OFFSET 0x0200 #define EEPROM_VERSION_OFFSET 0x020E #define EEPROM_HW_PARAM_POINTER_ADDRESS 0x0218 #define EEPROM_HW_PARAM_POINTER_ADDRRES_MAP5 0x0220 #define GPIO_SECTION_START_OFFSET 0x03 - -#define COMPATIBILITY_SECTION_LENGTH 42 -#define COMPATIBILITY_SECTION_LENGTH_MAP5 84 - - -#define EEPROM_MAP5_MAJORVERSION 5 -#define EEPROM_MAP5_MINORVERSION 0 - - +#define COMPATIBILITY_SECTION_LENGTH 42 +#define COMPATIBILITY_SECTION_LENGTH_MAP5 84 +#define EEPROM_MAP5_MAJORVERSION 5 +#define EEPROM_MAP5_MINORVERSION 0 #define MAX_NUM_OF_BLINKS 10 #define NUM_OF_GPIO_PINS 16 - #define DISABLE_GPIO_NUM 0xFF #define EVENT_SIGNALED 1 - #define MAX_FILE_NAME_BUFFER_SIZE 100 -#define TURN_ON_LED(GPIO, index) do { \ - UINT gpio_val = GPIO; \ - (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \ - wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)) : \ - wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \ - } while (0); - -#define TURN_OFF_LED(GPIO, index) do { \ - UINT gpio_val = GPIO; \ - (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \ - wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)) : \ - wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)); \ - } while (0); - -#define B_ULONG32 unsigned long - -/*******************************************************/ - - -typedef enum _LEDColors{ - RED_LED = 1, - BLUE_LED = 2, - YELLOW_LED = 3, - GREEN_LED = 4 -} LEDColors; /*Enumerated values of different LED types*/ - -typedef enum LedEvents { - SHUTDOWN_EXIT = 0x00, - DRIVER_INIT = 0x1, - FW_DOWNLOAD = 0x2, - FW_DOWNLOAD_DONE = 0x4, - NO_NETWORK_ENTRY = 0x8, - NORMAL_OPERATION = 0x10, - LOWPOWER_MODE_ENTER = 0x20, - IDLEMODE_CONTINUE = 0x40, - IDLEMODE_EXIT = 0x80, - LED_THREAD_INACTIVE = 0x100, /* Makes the LED thread Inactivce. It wil be equivallent to putting the thread on hold. */ - LED_THREAD_ACTIVE = 0x200, /* Makes the LED Thread Active back. */ - DRIVER_HALT = 0xff -} LedEventInfo_t; /* Enumerated values of different driver states */ +#define TURN_ON_LED(GPIO, index) do { \ + unsigned int gpio_val = GPIO; \ + (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \ + wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)) : \ + wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \ + } while (0) + +#define TURN_OFF_LED(GPIO, index) do { \ + unsigned int gpio_val = GPIO; \ + (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \ + wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)) : \ + wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)); \ + } while (0) + +enum bcm_led_colors { + RED_LED = 1, + BLUE_LED = 2, + YELLOW_LED = 3, + GREEN_LED = 4 +}; + +enum bcm_led_events { + SHUTDOWN_EXIT = 0x00, + DRIVER_INIT = 0x1, + FW_DOWNLOAD = 0x2, + FW_DOWNLOAD_DONE = 0x4, + NO_NETWORK_ENTRY = 0x8, + NORMAL_OPERATION = 0x10, + LOWPOWER_MODE_ENTER = 0x20, + IDLEMODE_CONTINUE = 0x40, + IDLEMODE_EXIT = 0x80, + LED_THREAD_INACTIVE = 0x100, /* Makes the LED thread Inactivce. It wil be equivallent to putting the thread on hold. */ + LED_THREAD_ACTIVE = 0x200, /* Makes the LED Thread Active back. */ + DRIVER_HALT = 0xff +}; /* Enumerated values of different driver states */ /* * Structure which stores the information of different LED types * and corresponding LED state information of driver states */ -typedef struct LedStateInfo_t { - UCHAR LED_Type; /* specify GPIO number - use 0xFF if not used */ - UCHAR LED_On_State; /* Bits set or reset for different states */ - UCHAR LED_Blink_State; /* Bits set or reset for blinking LEDs for different states */ - UCHAR GPIO_Num; - UCHAR BitPolarity; /* To represent whether H/W is normal polarity or reverse polarity */ -} LEDStateInfo, *pLEDStateInfo; - - -typedef struct _LED_INFO_STRUCT { - LEDStateInfo LEDState[NUM_OF_LEDS]; - BOOLEAN bIdleMode_tx_from_host; /* Variable to notify whether driver came out from idlemode due to Host or target*/ - BOOLEAN bIdle_led_off; - wait_queue_head_t notify_led_event; +struct bcm_led_state_info { + unsigned char LED_Type; /* specify GPIO number - use 0xFF if not used */ + unsigned char LED_On_State; /* Bits set or reset for different states */ + unsigned char LED_Blink_State; /* Bits set or reset for blinking LEDs for different states */ + unsigned char GPIO_Num; + unsigned char BitPolarity; /* To represent whether H/W is normal polarity or reverse polarity */ +}; + +struct bcm_led_info { + struct bcm_led_state_info LEDState[NUM_OF_LEDS]; + bool bIdleMode_tx_from_host; /* Variable to notify whether driver came out from idlemode due to Host or target */ + bool bIdle_led_off; + wait_queue_head_t notify_led_event; wait_queue_head_t idleModeSyncEvent; - struct task_struct *led_cntrl_threadid; - int led_thread_running; - BOOLEAN bLedInitDone; + struct task_struct *led_cntrl_threadid; + int led_thread_running; + bool bLedInitDone; +}; -} LED_INFO_STRUCT, *PLED_INFO_STRUCT; /* LED Thread state. */ -#define BCM_LED_THREAD_DISABLED 0 /* LED Thread is not running. */ -#define BCM_LED_THREAD_RUNNING_ACTIVELY 1 /* LED thread is running. */ -#define BCM_LED_THREAD_RUNNING_INACTIVELY 2 /*LED thread has been put on hold*/ - - +#define BCM_LED_THREAD_DISABLED 0 /* LED Thread is not running. */ +#define BCM_LED_THREAD_RUNNING_ACTIVELY 1 /* LED thread is running. */ +#define BCM_LED_THREAD_RUNNING_INACTIVELY 2 /* LED thread has been put on hold */ #endif - diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index eab676fe53a6..428375395f88 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -12,7 +12,7 @@ static unsigned int BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, unsi static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter); static int BcmGetNvmSize(struct bcm_mini_adapter *Adapter); static unsigned int BcmGetFlashSize(struct bcm_mini_adapter *Adapter); -static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter); +static enum bcm_nvm_type BcmGetNvmType(struct bcm_mini_adapter *Adapter); static int BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_val eFlash2xSectionVal); @@ -472,7 +472,7 @@ static int BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, static unsigned int BcmGetFlashSize(struct bcm_mini_adapter *Adapter) { if (IsFlash2x(Adapter)) - return Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER); + return Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(struct bcm_dsd_header); else return 32 * 1024; } @@ -1978,7 +1978,7 @@ int BeceemNVMWrite(struct bcm_mini_adapter *Adapter, int BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, unsigned int uiSectorSize) { int Status = -1; - FLASH_CS_INFO sFlashCsInfo = {0}; + struct bcm_flash_cs_info sFlashCsInfo = {0}; unsigned int uiTemp = 0; unsigned int uiSectorSig = 0; unsigned int uiCurrentSectorSize = 0; @@ -2228,20 +2228,20 @@ int BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Adapter structure point is NULL"); return -EINVAL; } - psAdapter->psFlashCSInfo = (PFLASH_CS_INFO)kzalloc(sizeof(FLASH_CS_INFO), GFP_KERNEL); + psAdapter->psFlashCSInfo = (struct bcm_flash_cs_info *)kzalloc(sizeof(struct bcm_flash_cs_info), GFP_KERNEL); if (psAdapter->psFlashCSInfo == NULL) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate memory for Flash 1.x"); return -ENOMEM; } - psAdapter->psFlash2xCSInfo = (PFLASH2X_CS_INFO)kzalloc(sizeof(FLASH2X_CS_INFO), GFP_KERNEL); + psAdapter->psFlash2xCSInfo = (struct bcm_flash2x_cs_info *)kzalloc(sizeof(struct bcm_flash2x_cs_info), GFP_KERNEL); if (!psAdapter->psFlash2xCSInfo) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate memory for Flash 2.x"); kfree(psAdapter->psFlashCSInfo); return -ENOMEM; } - psAdapter->psFlash2xVendorInfo = (PFLASH2X_VENDORSPECIFIC_INFO)kzalloc(sizeof(FLASH2X_VENDORSPECIFIC_INFO), GFP_KERNEL); + psAdapter->psFlash2xVendorInfo = (struct bcm_flash2x_vendor_info *)kzalloc(sizeof(struct bcm_flash2x_vendor_info), GFP_KERNEL); if (!psAdapter->psFlash2xVendorInfo) { BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_PRINTK, 0, 0, "Can't Allocate Vendor Info Memory for Flash 2.x"); kfree(psAdapter->psFlashCSInfo); @@ -2264,7 +2264,7 @@ int BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter) return STATUS_SUCCESS; } -static int BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bcm_mini_adapter *Adapter) +static int BcmDumpFlash2XCSStructure(struct bcm_flash2x_cs_info *psFlash2xCSInfo, struct bcm_mini_adapter *Adapter) { unsigned int Index = 0; @@ -2324,7 +2324,7 @@ static int BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo, struct bc return STATUS_SUCCESS; } -static int ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) +static int ConvertEndianOf2XCSStructure(struct bcm_flash2x_cs_info *psFlash2xCSInfo) { unsigned int Index = 0; @@ -2381,7 +2381,7 @@ static int ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) return STATUS_SUCCESS; } -static int ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) +static int ConvertEndianOfCSStructure(struct bcm_flash_cs_info *psFlashCSInfo) { /* unsigned int Index = 0; */ psFlashCSInfo->MagicNumber = ntohl(psFlashCSInfo->MagicNumber); @@ -2446,7 +2446,7 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) switch (i) { case DSD0: - if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(struct bcm_dsd_header))) && (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = VENDOR_PTR_IN_CS; else @@ -2454,7 +2454,7 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) break; case DSD1: - if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(struct bcm_dsd_header))) && (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = VENDOR_PTR_IN_CS; else @@ -2462,7 +2462,7 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) break; case DSD2: - if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + if ((uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(struct bcm_dsd_header))) && (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = VENDOR_PTR_IN_CS; else @@ -2509,7 +2509,7 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) { - /* FLASH_CS_INFO sFlashCsInfo = {0}; */ + /* struct bcm_flash_cs_info sFlashCsInfo = {0}; */ #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) unsigned int value; @@ -2522,8 +2522,8 @@ static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) Adapter->uiFlashBaseAdd = 0; Adapter->ulFlashCalStart = 0; - memset(Adapter->psFlashCSInfo, 0 , sizeof(FLASH_CS_INFO)); - memset(Adapter->psFlash2xCSInfo, 0 , sizeof(FLASH2X_CS_INFO)); + memset(Adapter->psFlashCSInfo, 0 , sizeof(struct bcm_flash_cs_info)); + memset(Adapter->psFlash2xCSInfo, 0 , sizeof(struct bcm_flash2x_cs_info)); if (!Adapter->bDDRInitDone) { value = FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; @@ -2551,7 +2551,7 @@ static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "FLASH LAYOUT MAJOR VERSION :%X", uiFlashLayoutMajorVersion); if (uiFlashLayoutMajorVersion < FLASH_2X_MAJOR_NUMBER) { - BeceemFlashBulkRead(Adapter, (PUINT)Adapter->psFlashCSInfo, Adapter->ulFlashControlSectionStart, sizeof(FLASH_CS_INFO)); + BeceemFlashBulkRead(Adapter, (PUINT)Adapter->psFlashCSInfo, Adapter->ulFlashControlSectionStart, sizeof(struct bcm_flash_cs_info)); ConvertEndianOfCSStructure(Adapter->psFlashCSInfo); Adapter->ulFlashCalStart = (Adapter->psFlashCSInfo->OffsetFromZeroForCalibrationStart); @@ -2576,7 +2576,7 @@ static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) Adapter->uiFlashBaseAdd = Adapter->psFlashCSInfo->FlashBaseAddr & 0xFCFFFFFF; } else { if (BcmFlash2xBulkRead(Adapter, (PUINT)Adapter->psFlash2xCSInfo, NO_SECTION_VAL, - Adapter->ulFlashControlSectionStart, sizeof(FLASH2X_CS_INFO))) { + Adapter->ulFlashControlSectionStart, sizeof(struct bcm_flash2x_cs_info))) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Unable to read CS structure\n"); return STATUS_FAILURE; } @@ -2629,7 +2629,7 @@ static int BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) * */ -static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) +static enum bcm_nvm_type BcmGetNvmType(struct bcm_mini_adapter *Adapter) { unsigned int uiData = 0; @@ -3101,7 +3101,7 @@ static int BcmDumpFlash2xSectionBitMap(struct bcm_flash2x_bitmap *psFlash2xBitMa int BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, struct bcm_flash2x_bitmap *psFlash2xBitMap) { - PFLASH2X_CS_INFO psFlash2xCSInfo = Adapter->psFlash2xCSInfo; + struct bcm_flash2x_cs_info *psFlash2xCSInfo = Adapter->psFlash2xCSInfo; enum bcm_flash2x_section_val uiHighestPriDSD = 0; enum bcm_flash2x_section_val uiHighestPriISO = 0; BOOLEAN SetActiveDSDDone = FALSE; @@ -3354,8 +3354,8 @@ int BcmSetActiveSection(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_secti unsigned int SectImagePriority = 0; int Status = STATUS_SUCCESS; - /* DSD_HEADER sDSD = {0}; - * ISO_HEADER sISO = {0}; + /* struct bcm_dsd_header sDSD = {0}; + * struct bcm_iso_header sISO = {0}; */ int HighestPriDSD = 0 ; int HighestPriISO = 0; @@ -3391,7 +3391,7 @@ int BcmSetActiveSection(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_secti Status = BcmFlash2xBulkWrite(Adapter, &SectImagePriority, HighestPriISO, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), + 0 + FIELD_OFFSET_IN_HEADER(struct bcm_iso_header *, ISOImagePriority), SIGNATURE_SIZE, TRUE); if (Status) { @@ -3416,7 +3416,7 @@ int BcmSetActiveSection(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_secti Status = BcmFlash2xBulkWrite(Adapter, &SectImagePriority, eFlash2xSectVal, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), + 0 + FIELD_OFFSET_IN_HEADER(struct bcm_iso_header *, ISOImagePriority), SIGNATURE_SIZE, TRUE); if (Status) { @@ -3452,7 +3452,7 @@ int BcmSetActiveSection(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_secti Status = BcmFlash2xBulkWrite(Adapter, &SectImagePriority, HighestPriDSD, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(struct bcm_dsd_header *, DSDImagePriority), SIGNATURE_SIZE, TRUE); if (Status) { @@ -3472,7 +3472,7 @@ int BcmSetActiveSection(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_secti Status = BcmFlash2xBulkWrite(Adapter, &SectImagePriority, HighestPriDSD, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(struct bcm_dsd_header *, DSDImagePriority), SIGNATURE_SIZE, TRUE); if (Status) { @@ -3492,7 +3492,7 @@ int BcmSetActiveSection(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_secti Status = BcmFlash2xBulkWrite(Adapter, &SectImagePriority, eFlash2xSectVal, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(struct bcm_dsd_header *, DSDImagePriority), SIGNATURE_SIZE, TRUE); if (Status) { @@ -3550,7 +3550,7 @@ int BcmCopyISO(struct bcm_mini_adapter *Adapter, struct bcm_flash2x_copy_section Status = BcmFlash2xBulkRead(Adapter, &ISOLength, sCopySectStrut.SrcSection, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageSize), + 0 + FIELD_OFFSET_IN_HEADER(struct bcm_iso_header *, ISOImageSize), 4); if (Status) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Read failed while copying ISO\n"); @@ -3561,7 +3561,7 @@ int BcmCopyISO(struct bcm_mini_adapter *Adapter, struct bcm_flash2x_copy_section if (ISOLength % Adapter->uiSectorSize) ISOLength = Adapter->uiSectorSize * (1 + ISOLength/Adapter->uiSectorSize); - sigOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber); + sigOffset = FIELD_OFFSET_IN_HEADER(struct bcm_iso_header *, ISOImageMagicNumber); Buff = kzalloc(Adapter->uiSectorSize, GFP_KERNEL); @@ -3846,7 +3846,7 @@ int BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_sectio unsigned int uiSignature = 0; unsigned int uiOffset = 0; - /* DSD_HEADER dsdHeader = {0}; */ + /* struct bcm_dsd_header dsdHeader = {0}; */ if (Adapter->bSigCorrupted == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is not corrupted by driver, hence not restoring\n"); return STATUS_SUCCESS; @@ -3863,7 +3863,7 @@ int BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_sectio uiSignature = htonl(DSD_IMAGE_MAGIC_NUMBER); uiOffset = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader; - uiOffset += FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber); + uiOffset += FIELD_OFFSET_IN_HEADER(struct bcm_dsd_header *, DSDImageMagicNumber); if ((ReadDSDSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Corrupted Pattern is not there. Hence won't write sig"); @@ -3872,7 +3872,7 @@ int BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_sectio } else if ((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) { uiSignature = htonl(ISO_IMAGE_MAGIC_NUMBER); /* uiOffset = 0; */ - uiOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber); + uiOffset = FIELD_OFFSET_IN_HEADER(struct bcm_iso_header *, ISOImageMagicNumber); if ((ReadISOSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Currupted Pattern is not there. Hence won't write sig"); return STATUS_FAILURE; @@ -4141,14 +4141,14 @@ int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, unsigned (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD0) - Adapter->uiSectorSize)) { /* offset from the sector boundary having the header map */ offsetToProtect = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader % Adapter->uiSectorSize; - HeaderSizeToProtect = sizeof(DSD_HEADER); + HeaderSizeToProtect = sizeof(struct bcm_dsd_header); bHasHeader = TRUE; } if (uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter, ISO_IMAGE1) || uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2)) { offsetToProtect = 0; - HeaderSizeToProtect = sizeof(ISO_HEADER); + HeaderSizeToProtect = sizeof(struct bcm_iso_header); bHasHeader = TRUE; } /* If Header is present overwrite passed buffer with this */ @@ -4167,7 +4167,7 @@ int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, unsigned kfree(pTempBuff); } if (bHasHeader && Adapter->bSigCorrupted) { - sig = *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber))); + sig = *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(struct bcm_dsd_header *, DSDImageMagicNumber))); sig = ntohl(sig); if ((sig & 0xFF000000) != CORRUPTED_PATTERN) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Desired pattern is not at sig offset. Hence won't restore"); @@ -4175,7 +4175,7 @@ int SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, unsigned return STATUS_SUCCESS; } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, " Corrupted sig is :%X", sig); - *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber))) = htonl(DSD_IMAGE_MAGIC_NUMBER); + *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(struct bcm_dsd_header *, DSDImageMagicNumber))) = htonl(DSD_IMAGE_MAGIC_NUMBER); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Restoring the signature in Header Write only"); Adapter->bSigCorrupted = FALSE; } @@ -4268,7 +4268,7 @@ int ReadDSDSignature(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_ { unsigned int uiDSDsig = 0; /* unsigned int sigoffsetInMap = 0; - * DSD_HEADER dsdHeader = {0}; + * struct bcm_dsd_header dsdHeader = {0}; */ /* sigoffsetInMap =(PUCHAR)&(dsdHeader.DSDImageMagicNumber) -(PUCHAR)&dsdHeader; */ @@ -4280,7 +4280,7 @@ int ReadDSDSignature(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_ BcmFlash2xBulkRead(Adapter, &uiDSDsig, dsd, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImageMagicNumber), + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(struct bcm_dsd_header *, DSDImageMagicNumber), SIGNATURE_SIZE); uiDSDsig = ntohl(uiDSDsig); @@ -4293,7 +4293,7 @@ int ReadDSDPriority(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_v { /* unsigned int priOffsetInMap = 0 ; */ unsigned int uiDSDPri = STATUS_FAILURE; - /* DSD_HEADER dsdHeader = {0}; + /* struct bcm_dsd_header dsdHeader = {0}; * priOffsetInMap = (PUCHAR)&(dsdHeader.DSDImagePriority) -(PUCHAR)&dsdHeader; */ if (IsSectionWritable(Adapter, dsd)) { @@ -4301,7 +4301,7 @@ int ReadDSDPriority(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_v BcmFlash2xBulkRead(Adapter, &uiDSDPri, dsd, - Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), + Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(struct bcm_dsd_header *, DSDImagePriority), 4); uiDSDPri = ntohl(uiDSDPri); @@ -4348,7 +4348,7 @@ int ReadISOSignature(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_ { unsigned int uiISOsig = 0; /* unsigned int sigoffsetInMap = 0; - * ISO_HEADER ISOHeader = {0}; + * struct bcm_iso_header ISOHeader = {0}; * sigoffsetInMap =(PUCHAR)&(ISOHeader.ISOImageMagicNumber) -(PUCHAR)&ISOHeader; */ if (iso != ISO_IMAGE1 && iso != ISO_IMAGE2) { @@ -4358,7 +4358,7 @@ int ReadISOSignature(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_ BcmFlash2xBulkRead(Adapter, &uiISOsig, iso, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber), + 0 + FIELD_OFFSET_IN_HEADER(struct bcm_iso_header *, ISOImageMagicNumber), SIGNATURE_SIZE); uiISOsig = ntohl(uiISOsig); @@ -4375,7 +4375,7 @@ int ReadISOPriority(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_v BcmFlash2xBulkRead(Adapter, &ISOPri, iso, - 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), + 0 + FIELD_OFFSET_IN_HEADER(struct bcm_iso_header *, ISOImagePriority), 4); ISOPri = ntohl(ISOPri); @@ -4568,7 +4568,7 @@ static int CorruptDSDSig(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_sect return -ENOMEM; } - uiOffset = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER); + uiOffset = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(struct bcm_dsd_header); uiOffset -= MAX_RW_SIZE; BcmFlash2xBulkRead(Adapter, (PUINT)pBuff, eFlash2xSectionVal, uiOffset, MAX_RW_SIZE); diff --git a/drivers/staging/bcm/nvm.h b/drivers/staging/bcm/nvm.h index 651b5a455b32..e765cca5d966 100644 --- a/drivers/staging/bcm/nvm.h +++ b/drivers/staging/bcm/nvm.h @@ -1,409 +1,286 @@ /*************************************************************************************** -// -// Copyright (c) Beceem Communications Inc. -// -// Module Name: -// NVM.h -// -// Abstract: -// This file has the prototypes,preprocessors and definitions various NVM libraries. -// -// -// Revision History: -// Who When What -// -------- -------- ---------------------------------------------- -// Name Date Created/reviewed/modified -// -// Notes: -// -****************************************************************************************/ - + * + * Copyright (c) Beceem Communications Inc. + * + * Module Name: + * NVM.h + * + * Abstract: + * This file has the prototypes,preprocessors and definitions various NVM libraries. + * + * + * Revision History: + * Who When What + * -------- -------- ---------------------------------------------- + * Name Date Created/reviewed/modified + * + * Notes: + * + ****************************************************************************************/ #ifndef _NVM_H_ #define _NVM_H_ -typedef struct _FLASH_SECTOR_INFO -{ - UINT uiSectorSig; - UINT uiSectorSize; - -}FLASH_SECTOR_INFO,*PFLASH_SECTOR_INFO; - -typedef struct _FLASH_CS_INFO -{ - B_UINT32 MagicNumber; -// let the magic number be 0xBECE-F1A5 - F1A5 for "flas-h" - - B_UINT32 FlashLayoutVersion ; - - // ISO Image/Format/BuildTool versioning - B_UINT32 ISOImageVersion; - - // SCSI/Flash BootLoader versioning - B_UINT32 SCSIFirmwareVersion; - - - B_UINT32 OffsetFromZeroForPart1ISOImage; -// typically 0 - - B_UINT32 OffsetFromZeroForScsiFirmware; -//typically at 12MB - - B_UINT32 SizeOfScsiFirmware ; -//size of the firmware - depends on binary size - - B_UINT32 OffsetFromZeroForPart2ISOImage; -// typically at first Word Aligned offset 12MB + sizeOfScsiFirmware. - - B_UINT32 OffsetFromZeroForCalibrationStart; -// typically at 15MB - - B_UINT32 OffsetFromZeroForCalibrationEnd; - -// VSA0 offsets - B_UINT32 OffsetFromZeroForVSAStart; - B_UINT32 OffsetFromZeroForVSAEnd; - -// Control Section offsets - B_UINT32 OffsetFromZeroForControlSectionStart; - B_UINT32 OffsetFromZeroForControlSectionData; - -// NO Data Activity timeout to switch from MSC to NW Mode - B_UINT32 CDLessInactivityTimeout; - -// New ISO Image Signature - B_UINT32 NewImageSignature; - -// Signature to validate the sector size. - B_UINT32 FlashSectorSizeSig; - -// Sector Size - B_UINT32 FlashSectorSize; - -// Write Size Support - B_UINT32 FlashWriteSupportSize; - -// Total Flash Size - B_UINT32 TotalFlashSize; - -// Flash Base Address for offset specified - B_UINT32 FlashBaseAddr; - -// Flash Part Max Size - B_UINT32 FlashPartMaxSize; - -// Is CDLess or Flash Bootloader - B_UINT32 IsCDLessDeviceBootSig; - -// MSC Timeout after reset to switch from MSC to NW Mode - B_UINT32 MassStorageTimeout; - - -}FLASH_CS_INFO,*PFLASH_CS_INFO; - -#define FLASH2X_TOTAL_SIZE (64*1024*1024) -#define DEFAULT_SECTOR_SIZE (64*1024) - -typedef struct _FLASH_2X_CS_INFO -{ - - // magic number as 0xBECE-F1A5 - F1A5 for "flas-h" - B_UINT32 MagicNumber; - - B_UINT32 FlashLayoutVersion ; - - // ISO Image/Format/BuildTool versioning - B_UINT32 ISOImageVersion; - - // SCSI/Flash BootLoader versioning - B_UINT32 SCSIFirmwareVersion; - - // ISO Image1 Part1/SCSI Firmware/Flash Bootloader Start offset, size - B_UINT32 OffsetFromZeroForPart1ISOImage; - B_UINT32 OffsetFromZeroForScsiFirmware; - B_UINT32 SizeOfScsiFirmware ; - - // ISO Image1 Part2 start offset - B_UINT32 OffsetFromZeroForPart2ISOImage; - - - // DSD0 offset - B_UINT32 OffsetFromZeroForDSDStart; - B_UINT32 OffsetFromZeroForDSDEnd; - - // VSA0 offset - B_UINT32 OffsetFromZeroForVSAStart; - B_UINT32 OffsetFromZeroForVSAEnd; - - // Control Section offset - B_UINT32 OffsetFromZeroForControlSectionStart; - B_UINT32 OffsetFromZeroForControlSectionData; - - // NO Data Activity timeout to switch from MSC to NW Mode - B_UINT32 CDLessInactivityTimeout; - - // New ISO Image Signature - B_UINT32 NewImageSignature; - - B_UINT32 FlashSectorSizeSig; // Sector Size Signature - B_UINT32 FlashSectorSize; // Sector Size - B_UINT32 FlashWriteSupportSize; // Write Size Support - - B_UINT32 TotalFlashSize; // Total Flash Size - - // Flash Base Address for offset specified - B_UINT32 FlashBaseAddr; - B_UINT32 FlashPartMaxSize; // Flash Part Max Size - - // Is CDLess or Flash Bootloader - B_UINT32 IsCDLessDeviceBootSig; - - // MSC Timeout after reset to switch from MSC to NW Mode - B_UINT32 MassStorageTimeout; - +struct bcm_flash_cs_info { + u32 MagicNumber; + /* let the magic number be 0xBECE-F1A5 - F1A5 for "flas-h" */ + u32 FlashLayoutVersion; + u32 ISOImageVersion; + u32 SCSIFirmwareVersion; + u32 OffsetFromZeroForPart1ISOImage; + u32 OffsetFromZeroForScsiFirmware; + u32 SizeOfScsiFirmware; + u32 OffsetFromZeroForPart2ISOImage; + u32 OffsetFromZeroForCalibrationStart; + u32 OffsetFromZeroForCalibrationEnd; + u32 OffsetFromZeroForVSAStart; + u32 OffsetFromZeroForVSAEnd; + u32 OffsetFromZeroForControlSectionStart; + u32 OffsetFromZeroForControlSectionData; + u32 CDLessInactivityTimeout; + u32 NewImageSignature; + u32 FlashSectorSizeSig; + u32 FlashSectorSize; + u32 FlashWriteSupportSize; + u32 TotalFlashSize; + u32 FlashBaseAddr; + u32 FlashPartMaxSize; + u32 IsCDLessDeviceBootSig; + /* MSC Timeout after reset to switch from MSC to NW Mode */ + u32 MassStorageTimeout; +}; + +#define FLASH2X_TOTAL_SIZE (64 * 1024 * 1024) +#define DEFAULT_SECTOR_SIZE (64 * 1024) + +struct bcm_flash2x_cs_info { + /* magic number as 0xBECE-F1A5 - F1A5 for "flas-h" */ + u32 MagicNumber; + u32 FlashLayoutVersion; + u32 ISOImageVersion; + u32 SCSIFirmwareVersion; + u32 OffsetFromZeroForPart1ISOImage; + u32 OffsetFromZeroForScsiFirmware; + u32 SizeOfScsiFirmware; + u32 OffsetFromZeroForPart2ISOImage; + u32 OffsetFromZeroForDSDStart; + u32 OffsetFromZeroForDSDEnd; + u32 OffsetFromZeroForVSAStart; + u32 OffsetFromZeroForVSAEnd; + u32 OffsetFromZeroForControlSectionStart; + u32 OffsetFromZeroForControlSectionData; + /* NO Data Activity timeout to switch from MSC to NW Mode */ + u32 CDLessInactivityTimeout; + u32 NewImageSignature; + u32 FlashSectorSizeSig; + u32 FlashSectorSize; + u32 FlashWriteSupportSize; + u32 TotalFlashSize; + u32 FlashBaseAddr; + u32 FlashPartMaxSize; + u32 IsCDLessDeviceBootSig; + /* MSC Timeout after reset to switch from MSC to NW Mode */ + u32 MassStorageTimeout; /* Flash Map 2.0 Field */ - B_UINT32 OffsetISOImage1Part1Start; // ISO Image1 Part1 offset - B_UINT32 OffsetISOImage1Part1End; - B_UINT32 OffsetISOImage1Part2Start; // ISO Image1 Part2 offset - B_UINT32 OffsetISOImage1Part2End; - B_UINT32 OffsetISOImage1Part3Start; // ISO Image1 Part3 offset - B_UINT32 OffsetISOImage1Part3End; - - B_UINT32 OffsetISOImage2Part1Start; // ISO Image2 Part1 offset - B_UINT32 OffsetISOImage2Part1End; - B_UINT32 OffsetISOImage2Part2Start; // ISO Image2 Part2 offset - B_UINT32 OffsetISOImage2Part2End; - B_UINT32 OffsetISOImage2Part3Start; // ISO Image2 Part3 offset - B_UINT32 OffsetISOImage2Part3End; - - - // DSD Header offset from start of DSD - B_UINT32 OffsetFromDSDStartForDSDHeader; - B_UINT32 OffsetFromZeroForDSD1Start; // DSD 1 offset - B_UINT32 OffsetFromZeroForDSD1End; - B_UINT32 OffsetFromZeroForDSD2Start; // DSD 2 offset - B_UINT32 OffsetFromZeroForDSD2End; - - B_UINT32 OffsetFromZeroForVSA1Start; // VSA 1 offset - B_UINT32 OffsetFromZeroForVSA1End; - B_UINT32 OffsetFromZeroForVSA2Start; // VSA 2 offset - B_UINT32 OffsetFromZeroForVSA2End; - + u32 OffsetISOImage1Part1Start; + u32 OffsetISOImage1Part1End; + u32 OffsetISOImage1Part2Start; + u32 OffsetISOImage1Part2End; + u32 OffsetISOImage1Part3Start; + u32 OffsetISOImage1Part3End; + u32 OffsetISOImage2Part1Start; + u32 OffsetISOImage2Part1End; + u32 OffsetISOImage2Part2Start; + u32 OffsetISOImage2Part2End; + u32 OffsetISOImage2Part3Start; + u32 OffsetISOImage2Part3End; + /* DSD Header offset from start of DSD */ + u32 OffsetFromDSDStartForDSDHeader; + u32 OffsetFromZeroForDSD1Start; + u32 OffsetFromZeroForDSD1End; + u32 OffsetFromZeroForDSD2Start; + u32 OffsetFromZeroForDSD2End; + u32 OffsetFromZeroForVSA1Start; + u32 OffsetFromZeroForVSA1End; + u32 OffsetFromZeroForVSA2Start; + u32 OffsetFromZeroForVSA2End; /* -* ACCESS_BITS_PER_SECTOR 2 -* ACCESS_RW 0 -* ACCESS_RO 1 -* ACCESS_RESVD 2 -* ACCESS_RESVD 3 -* */ - B_UINT32 SectorAccessBitMap[FLASH2X_TOTAL_SIZE/(DEFAULT_SECTOR_SIZE *16)]; - -// All expansions to the control data structure should add here - -}FLASH2X_CS_INFO,*PFLASH2X_CS_INFO; - -typedef struct _VENDOR_SECTION_INFO -{ - B_UINT32 OffsetFromZeroForSectionStart; - B_UINT32 OffsetFromZeroForSectionEnd; - B_UINT32 AccessFlags; - B_UINT32 Reserved[16]; - -} VENDOR_SECTION_INFO, *PVENDOR_SECTION_INFO; - -typedef struct _FLASH2X_VENDORSPECIFIC_INFO -{ - VENDOR_SECTION_INFO VendorSection[TOTAL_SECTIONS]; - B_UINT32 Reserved[16]; - -} FLASH2X_VENDORSPECIFIC_INFO, *PFLASH2X_VENDORSPECIFIC_INFO; - -typedef struct _DSD_HEADER -{ - B_UINT32 DSDImageSize; - B_UINT32 DSDImageCRC; - B_UINT32 DSDImagePriority; - //We should not consider right now. Reading reserve is worthless. - B_UINT32 Reserved[252]; // Resvd for DSD Header - B_UINT32 DSDImageMagicNumber; - -}DSD_HEADER, *PDSD_HEADER; - -typedef struct _ISO_HEADER -{ - B_UINT32 ISOImageMagicNumber; - B_UINT32 ISOImageSize; - B_UINT32 ISOImageCRC; - B_UINT32 ISOImagePriority; - //We should not consider right now. Reading reserve is worthless. - B_UINT32 Reserved[60]; //Resvd for ISO Header extension - -}ISO_HEADER, *PISO_HEADER; - -#define EEPROM_BEGIN_CIS (0) -#define EEPROM_BEGIN_NON_CIS (0x200) -#define EEPROM_END (0x2000) - -#define INIT_PARAMS_SIGNATURE (0x95a7a597) - -#define MAX_INIT_PARAMS_LENGTH (2048) - - -#define MAC_ADDRESS_OFFSET 0x200 - - -#define INIT_PARAMS_1_SIGNATURE_ADDRESS EEPROM_BEGIN_NON_CIS -#define INIT_PARAMS_1_DATA_ADDRESS (INIT_PARAMS_1_SIGNATURE_ADDRESS+16) -#define INIT_PARAMS_1_MACADDRESS_ADDRESS (MAC_ADDRESS_OFFSET) -#define INIT_PARAMS_1_LENGTH_ADDRESS (INIT_PARAMS_1_SIGNATURE_ADDRESS+4) - -#define INIT_PARAMS_2_SIGNATURE_ADDRESS (EEPROM_BEGIN_NON_CIS+2048+16) -#define INIT_PARAMS_2_DATA_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS+16) -#define INIT_PARAMS_2_MACADDRESS_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS+8) -#define INIT_PARAMS_2_LENGTH_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS+4) - -#define EEPROM_SPI_DEV_CONFIG_REG 0x0F003000 -#define EEPROM_SPI_Q_STATUS1_REG 0x0F003004 -#define EEPROM_SPI_Q_STATUS1_MASK_REG 0x0F00300C - -#define EEPROM_SPI_Q_STATUS_REG 0x0F003008 -#define EEPROM_CMDQ_SPI_REG 0x0F003018 -#define EEPROM_WRITE_DATAQ_REG 0x0F00301C -#define EEPROM_READ_DATAQ_REG 0x0F003020 -#define SPI_FLUSH_REG 0x0F00304C - -#define EEPROM_WRITE_ENABLE 0x06000000 -#define EEPROM_READ_STATUS_REGISTER 0x05000000 -#define EEPROM_16_BYTE_PAGE_WRITE 0xFA000000 -#define EEPROM_WRITE_QUEUE_EMPTY 0x00001000 -#define EEPROM_WRITE_QUEUE_AVAIL 0x00002000 -#define EEPROM_WRITE_QUEUE_FULL 0x00004000 -#define EEPROM_16_BYTE_PAGE_READ 0xFB000000 -#define EEPROM_4_BYTE_PAGE_READ 0x3B000000 - -#define EEPROM_CMD_QUEUE_FLUSH 0x00000001 -#define EEPROM_WRITE_QUEUE_FLUSH 0x00000002 -#define EEPROM_READ_QUEUE_FLUSH 0x00000004 -#define EEPROM_ETH_QUEUE_FLUSH 0x00000008 -#define EEPROM_ALL_QUEUE_FLUSH 0x0000000f -#define EEPROM_READ_ENABLE 0x06000000 -#define EEPROM_16_BYTE_PAGE_WRITE 0xFA000000 -#define EEPROM_READ_DATA_FULL 0x00000010 -#define EEPROM_READ_DATA_AVAIL 0x00000020 -#define EEPROM_READ_QUEUE_EMPTY 0x00000002 -#define EEPROM_CMD_QUEUE_EMPTY 0x00000100 -#define EEPROM_CMD_QUEUE_AVAIL 0x00000200 -#define EEPROM_CMD_QUEUE_FULL 0x00000400 + * ACCESS_BITS_PER_SECTOR 2 + * ACCESS_RW 0 + * ACCESS_RO 1 + * ACCESS_RESVD 2 + * ACCESS_RESVD 3 + */ + u32 SectorAccessBitMap[FLASH2X_TOTAL_SIZE / (DEFAULT_SECTOR_SIZE * 16)]; + /* All expansions to the control data structure should add here */ +}; + +struct bcm_vendor_section_info { + u32 OffsetFromZeroForSectionStart; + u32 OffsetFromZeroForSectionEnd; + u32 AccessFlags; + u32 Reserved[16]; +}; + +struct bcm_flash2x_vendor_info { + struct bcm_vendor_section_info VendorSection[TOTAL_SECTIONS]; + u32 Reserved[16]; +}; + +struct bcm_dsd_header { + u32 DSDImageSize; + u32 DSDImageCRC; + u32 DSDImagePriority; + /* We should not consider right now. Reading reserve is worthless. */ + u32 Reserved[252]; /* Resvd for DSD Header */ + u32 DSDImageMagicNumber; +}; + +struct bcm_iso_header { + u32 ISOImageMagicNumber; + u32 ISOImageSize; + u32 ISOImageCRC; + u32 ISOImagePriority; + /* We should not consider right now. Reading reserve is worthless. */ + u32 Reserved[60]; /* Resvd for ISO Header extension */ +}; + +#define EEPROM_BEGIN_CIS (0) +#define EEPROM_BEGIN_NON_CIS (0x200) +#define EEPROM_END (0x2000) +#define INIT_PARAMS_SIGNATURE (0x95a7a597) +#define MAX_INIT_PARAMS_LENGTH (2048) +#define MAC_ADDRESS_OFFSET 0x200 + +#define INIT_PARAMS_1_SIGNATURE_ADDRESS EEPROM_BEGIN_NON_CIS +#define INIT_PARAMS_1_DATA_ADDRESS (INIT_PARAMS_1_SIGNATURE_ADDRESS+16) +#define INIT_PARAMS_1_MACADDRESS_ADDRESS (MAC_ADDRESS_OFFSET) +#define INIT_PARAMS_1_LENGTH_ADDRESS (INIT_PARAMS_1_SIGNATURE_ADDRESS+4) + +#define INIT_PARAMS_2_SIGNATURE_ADDRESS (EEPROM_BEGIN_NON_CIS + 2048 + 16) +#define INIT_PARAMS_2_DATA_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS + 16) +#define INIT_PARAMS_2_MACADDRESS_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS + 8) +#define INIT_PARAMS_2_LENGTH_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS + 4) + +#define EEPROM_SPI_DEV_CONFIG_REG 0x0F003000 +#define EEPROM_SPI_Q_STATUS1_REG 0x0F003004 +#define EEPROM_SPI_Q_STATUS1_MASK_REG 0x0F00300C + +#define EEPROM_SPI_Q_STATUS_REG 0x0F003008 +#define EEPROM_CMDQ_SPI_REG 0x0F003018 +#define EEPROM_WRITE_DATAQ_REG 0x0F00301C +#define EEPROM_READ_DATAQ_REG 0x0F003020 +#define SPI_FLUSH_REG 0x0F00304C + +#define EEPROM_WRITE_ENABLE 0x06000000 +#define EEPROM_READ_STATUS_REGISTER 0x05000000 +#define EEPROM_16_BYTE_PAGE_WRITE 0xFA000000 +#define EEPROM_WRITE_QUEUE_EMPTY 0x00001000 +#define EEPROM_WRITE_QUEUE_AVAIL 0x00002000 +#define EEPROM_WRITE_QUEUE_FULL 0x00004000 +#define EEPROM_16_BYTE_PAGE_READ 0xFB000000 +#define EEPROM_4_BYTE_PAGE_READ 0x3B000000 + +#define EEPROM_CMD_QUEUE_FLUSH 0x00000001 +#define EEPROM_WRITE_QUEUE_FLUSH 0x00000002 +#define EEPROM_READ_QUEUE_FLUSH 0x00000004 +#define EEPROM_ETH_QUEUE_FLUSH 0x00000008 +#define EEPROM_ALL_QUEUE_FLUSH 0x0000000f +#define EEPROM_READ_ENABLE 0x06000000 +#define EEPROM_16_BYTE_PAGE_WRITE 0xFA000000 +#define EEPROM_READ_DATA_FULL 0x00000010 +#define EEPROM_READ_DATA_AVAIL 0x00000020 +#define EEPROM_READ_QUEUE_EMPTY 0x00000002 +#define EEPROM_CMD_QUEUE_EMPTY 0x00000100 +#define EEPROM_CMD_QUEUE_AVAIL 0x00000200 +#define EEPROM_CMD_QUEUE_FULL 0x00000400 /* Most EEPROM status register bit 0 indicates if the EEPROM is busy * with a write if set 1. See the details of the EEPROM Status Register - * in the EEPROM data sheet. */ -#define EEPROM_STATUS_REG_WRITE_BUSY 0x00000001 - -// We will have 1 mSec for every RETRIES_PER_DELAY count and have a max attempts of MAX_EEPROM_RETRIES -// This will give us 80 mSec minimum of delay = 80mSecs -#define MAX_EEPROM_RETRIES 80 -#define RETRIES_PER_DELAY 64 - - -#define MAX_RW_SIZE 0x10 -#define MAX_READ_SIZE 0x10 -#define MAX_SECTOR_SIZE (512*1024) -#define MIN_SECTOR_SIZE (1024) -#define FLASH_SECTOR_SIZE_OFFSET 0xEFFFC -#define FLASH_SECTOR_SIZE_SIG_OFFSET 0xEFFF8 -#define FLASH_SECTOR_SIZE_SIG 0xCAFEBABE -#define FLASH_CS_INFO_START_ADDR 0xFF0000 -#define FLASH_CONTROL_STRUCT_SIGNATURE 0xBECEF1A5 -#define SCSI_FIRMWARE_MAJOR_VERSION 0x1 -#define SCSI_FIRMWARE_MINOR_VERSION 0x5 -#define BYTE_WRITE_SUPPORT 0x1 - -#define FLASH_AUTO_INIT_BASE_ADDR 0xF00000 - - - - -#define FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT 0x1C000000 -#define FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT 0x1F000000 - -#define FLASH_CONTIGIOUS_START_ADDR_BCS350 0x08000000 -#define FLASH_CONTIGIOUS_END_ADDR_BCS350 0x08FFFFFF - - - -#define FLASH_SIZE_ADDR 0xFFFFEC - -#define FLASH_SPI_CMDQ_REG 0xAF003040 -#define FLASH_SPI_WRITEQ_REG 0xAF003044 -#define FLASH_SPI_READQ_REG 0xAF003048 -#define FLASH_CONFIG_REG 0xAF003050 -#define FLASH_GPIO_CONFIG_REG 0xAF000030 - -#define FLASH_CMD_WRITE_ENABLE 0x06 -#define FLASH_CMD_READ_ENABLE 0x03 -#define FLASH_CMD_RESET_WRITE_ENABLE 0x04 -#define FLASH_CMD_STATUS_REG_READ 0x05 -#define FLASH_CMD_STATUS_REG_WRITE 0x01 -#define FLASH_CMD_READ_ID 0x9F - -#define PAD_SELECT_REGISTER 0xAF000410 - -#define FLASH_PART_SST25VF080B 0xBF258E - -#define EEPROM_CAL_DATA_INTERNAL_LOC 0xbFB00008 - -#define EEPROM_CALPARAM_START 0x200 -#define EEPROM_SIZE_OFFSET 524 - -//As Read/Write time vaires from 1.5 to 3.0 ms. -//so After Ignoring the rdm/wrm time(that is dependent on many factor like interface etc.), -//here time calculated meets the worst case delay, 3.0 ms -#define MAX_FLASH_RETRIES 4 -#define FLASH_PER_RETRIES_DELAY 16 - - -#define EEPROM_MAX_CAL_AREA_SIZE 0xF0000 - - - -#define BECM ntohl(0x4245434d) - -#define FLASH_2X_MAJOR_NUMBER 0x2 -#define DSD_IMAGE_MAGIC_NUMBER 0xBECE0D5D -#define ISO_IMAGE_MAGIC_NUMBER 0xBECE0150 -#define NON_CDLESS_DEVICE_BOOT_SIG 0xBECEB007 -#define MINOR_VERSION(x) ((x >>16) & 0xFFFF) + * in the EEPROM data sheet. + */ +#define EEPROM_STATUS_REG_WRITE_BUSY 0x00000001 + +/* We will have 1 mSec for every RETRIES_PER_DELAY count and have a max attempts of MAX_EEPROM_RETRIES + * This will give us 80 mSec minimum of delay = 80mSecs + */ +#define MAX_EEPROM_RETRIES 80 +#define RETRIES_PER_DELAY 64 +#define MAX_RW_SIZE 0x10 +#define MAX_READ_SIZE 0x10 +#define MAX_SECTOR_SIZE (512 * 1024) +#define MIN_SECTOR_SIZE (1024) +#define FLASH_SECTOR_SIZE_OFFSET 0xEFFFC +#define FLASH_SECTOR_SIZE_SIG_OFFSET 0xEFFF8 +#define FLASH_SECTOR_SIZE_SIG 0xCAFEBABE +#define FLASH_CS_INFO_START_ADDR 0xFF0000 +#define FLASH_CONTROL_STRUCT_SIGNATURE 0xBECEF1A5 +#define SCSI_FIRMWARE_MAJOR_VERSION 0x1 +#define SCSI_FIRMWARE_MINOR_VERSION 0x5 +#define BYTE_WRITE_SUPPORT 0x1 +#define FLASH_AUTO_INIT_BASE_ADDR 0xF00000 +#define FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT 0x1C000000 +#define FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT 0x1F000000 +#define FLASH_CONTIGIOUS_START_ADDR_BCS350 0x08000000 +#define FLASH_CONTIGIOUS_END_ADDR_BCS350 0x08FFFFFF +#define FLASH_SIZE_ADDR 0xFFFFEC +#define FLASH_SPI_CMDQ_REG 0xAF003040 +#define FLASH_SPI_WRITEQ_REG 0xAF003044 +#define FLASH_SPI_READQ_REG 0xAF003048 +#define FLASH_CONFIG_REG 0xAF003050 +#define FLASH_GPIO_CONFIG_REG 0xAF000030 +#define FLASH_CMD_WRITE_ENABLE 0x06 +#define FLASH_CMD_READ_ENABLE 0x03 +#define FLASH_CMD_RESET_WRITE_ENABLE 0x04 +#define FLASH_CMD_STATUS_REG_READ 0x05 +#define FLASH_CMD_STATUS_REG_WRITE 0x01 +#define FLASH_CMD_READ_ID 0x9F +#define PAD_SELECT_REGISTER 0xAF000410 +#define FLASH_PART_SST25VF080B 0xBF258E +#define EEPROM_CAL_DATA_INTERNAL_LOC 0xbFB00008 +#define EEPROM_CALPARAM_START 0x200 +#define EEPROM_SIZE_OFFSET 524 + +/* As Read/Write time vaires from 1.5 to 3.0 ms. + * so After Ignoring the rdm/wrm time(that is dependent on many factor like interface etc.), + * here time calculated meets the worst case delay, 3.0 ms + */ +#define MAX_FLASH_RETRIES 4 +#define FLASH_PER_RETRIES_DELAY 16 +#define EEPROM_MAX_CAL_AREA_SIZE 0xF0000 +#define BECM ntohl(0x4245434d) +#define FLASH_2X_MAJOR_NUMBER 0x2 +#define DSD_IMAGE_MAGIC_NUMBER 0xBECE0D5D +#define ISO_IMAGE_MAGIC_NUMBER 0xBECE0150 +#define NON_CDLESS_DEVICE_BOOT_SIG 0xBECEB007 + +#define MINOR_VERSION(x) ((x >> 16) & 0xFFFF) #define MAJOR_VERSION(x) (x & 0xFFFF) -#define CORRUPTED_PATTERN 0x0 -#define UNINIT_PTR_IN_CS 0xBBBBDDDD - -#define VENDOR_PTR_IN_CS 0xAAAACCCC - - -#define FLASH2X_SECTION_PRESENT 1<<0 -#define FLASH2X_SECTION_VALID 1<<1 -#define FLASH2X_SECTION_RO 1<<2 -#define FLASH2X_SECTION_ACT 1<<3 -#define SECTOR_IS_NOT_WRITABLE STATUS_FAILURE -#define INVALID_OFFSET STATUS_FAILURE -#define INVALID_SECTION STATUS_FAILURE -#define SECTOR_1K 1024 -#define SECTOR_64K (64 *SECTOR_1K) -#define SECTOR_128K (2 * SECTOR_64K) -#define SECTOR_256k (2 * SECTOR_128K) -#define SECTOR_512K (2 * SECTOR_256k) -#define FLASH_PART_SIZE (16 * 1024 * 1024) -#define RESET_CHIP_SELECT -1 -#define CHIP_SELECT_BIT12 12 - -#define SECTOR_READWRITE_PERMISSION 0 -#define SECTOR_READONLY 1 -#define SIGNATURE_SIZE 4 -#define DEFAULT_BUFF_SIZE 0x10000 - -#define FIELD_OFFSET_IN_HEADER(HeaderPointer,Field) ((PUCHAR)&((HeaderPointer)(NULL))->Field - (PUCHAR)(NULL)) +#define CORRUPTED_PATTERN 0x0 +#define UNINIT_PTR_IN_CS 0xBBBBDDDD +#define VENDOR_PTR_IN_CS 0xAAAACCCC +#define FLASH2X_SECTION_PRESENT (1 << 0) +#define FLASH2X_SECTION_VALID (1 << 1) +#define FLASH2X_SECTION_RO (1 << 2) +#define FLASH2X_SECTION_ACT (1 << 3) +#define SECTOR_IS_NOT_WRITABLE STATUS_FAILURE +#define INVALID_OFFSET STATUS_FAILURE +#define INVALID_SECTION STATUS_FAILURE +#define SECTOR_1K 1024 +#define SECTOR_64K (64 * SECTOR_1K) +#define SECTOR_128K (2 * SECTOR_64K) +#define SECTOR_256k (2 * SECTOR_128K) +#define SECTOR_512K (2 * SECTOR_256k) +#define FLASH_PART_SIZE (16 * 1024 * 1024) +#define RESET_CHIP_SELECT -1 +#define CHIP_SELECT_BIT12 12 +#define SECTOR_READWRITE_PERMISSION 0 +#define SECTOR_READONLY 1 +#define SIGNATURE_SIZE 4 +#define DEFAULT_BUFF_SIZE 0x10000 + +#define FIELD_OFFSET_IN_HEADER(HeaderPointer, Field) ((u8 *)&((HeaderPointer)(NULL))->Field - (u8 *)(NULL)) #endif diff --git a/drivers/staging/bcm/target_params.h b/drivers/staging/bcm/target_params.h index ad7ec0054938..dc45f9ab854d 100644 --- a/drivers/staging/bcm/target_params.h +++ b/drivers/staging/bcm/target_params.h @@ -1,81 +1,57 @@ #ifndef TARGET_PARAMS_H #define TARGET_PARAMS_H -typedef struct _TARGET_PARAMS -{ - B_UINT32 m_u32CfgVersion; - - // Scanning Related Params - B_UINT32 m_u32CenterFrequency; - B_UINT32 m_u32BandAScan; - B_UINT32 m_u32BandBScan; - B_UINT32 m_u32BandCScan; - - - // QoS Params - B_UINT32 m_u32ErtpsOptions; - - B_UINT32 m_u32PHSEnable; - - - // HO Params - B_UINT32 m_u32HoEnable; - - B_UINT32 m_u32HoReserved1; - B_UINT32 m_u32HoReserved2; - // Power Control Params - - B_UINT32 m_u32MimoEnable; - - B_UINT32 m_u32SecurityEnable; - - B_UINT32 m_u32PowerSavingModesEnable; //bit 1: 1 Idlemode enable; bit2: 1 Sleepmode Enable - /* PowerSaving Mode Options: - bit 0 = 1: CPE mode - to keep pcmcia if alive; - bit 1 = 1: CINR reporting in Idlemode Msg - bit 2 = 1: Default PSC Enable in sleepmode*/ - B_UINT32 m_u32PowerSavingModeOptions; - - B_UINT32 m_u32ArqEnable; - - // From Version #3, the HARQ section renamed as general - B_UINT32 m_u32HarqEnable; - // EEPROM Param Location - B_UINT32 m_u32EEPROMFlag; - // BINARY TYPE - 4th MSByte: Interface Type - 3rd MSByte: Vendor Type - 2nd MSByte - // Unused - LSByte - B_UINT32 m_u32Customize; - B_UINT32 m_u32ConfigBW; /* In Hz */ - B_UINT32 m_u32ShutDownInitThresholdTimer; - - B_UINT32 m_u32RadioParameter; - B_UINT32 m_u32PhyParameter1; - B_UINT32 m_u32PhyParameter2; - B_UINT32 m_u32PhyParameter3; - - B_UINT32 m_u32TestOptions; // in eval mode only; lower 16bits = basic cid for testing; then bit 16 is test cqich,bit 17 test init rang; bit 18 test periodic rang and bit 19 is test harq ack/nack - - B_UINT32 m_u32MaxMACDataperDLFrame; - B_UINT32 m_u32MaxMACDataperULFrame; - - B_UINT32 m_u32Corr2MacFlags; - - //adding driver params. - B_UINT32 HostDrvrConfig1; - B_UINT32 HostDrvrConfig2; - B_UINT32 HostDrvrConfig3; - B_UINT32 HostDrvrConfig4; - B_UINT32 HostDrvrConfig5; - B_UINT32 HostDrvrConfig6; - B_UINT32 m_u32SegmentedPUSCenable; - - // removed SHUT down related 'unused' params from here to sync 4.x and 5.x CFG files.. - - //BAMC Related Parameters - //Bit 0-15 Band AMC signaling configuration: Bit 1 = 1 – Enable Band AMC signaling. - //bit 16-31 Band AMC Data configuration: Bit 16 = 1 – Band AMC 2x3 support. - B_UINT32 m_u32BandAMCEnable; - -} stTargetParams,TARGET_PARAMS,*PTARGET_PARAMS, STARGETPARAMS, *PSTARGETPARAMS; +struct bcm_target_params { + u32 m_u32CfgVersion; + u32 m_u32CenterFrequency; + u32 m_u32BandAScan; + u32 m_u32BandBScan; + u32 m_u32BandCScan; + u32 m_u32ErtpsOptions; + u32 m_u32PHSEnable; + u32 m_u32HoEnable; + u32 m_u32HoReserved1; + u32 m_u32HoReserved2; + u32 m_u32MimoEnable; + u32 m_u32SecurityEnable; + u32 m_u32PowerSavingModesEnable; /* bit 1: 1 Idlemode enable; bit2: 1 Sleepmode Enable */ + /* PowerSaving Mode Options: + * bit 0 = 1: CPE mode - to keep pcmcia if alive; + * bit 1 = 1: CINR reporting in Idlemode Msg + * bit 2 = 1: Default PSC Enable in sleepmode + */ + u32 m_u32PowerSavingModeOptions; + u32 m_u32ArqEnable; + /* From Version #3, the HARQ section renamed as general */ + u32 m_u32HarqEnable; + u32 m_u32EEPROMFlag; + /* BINARY TYPE - 4th MSByte: Interface Type - 3rd MSByte: Vendor Type - 2nd MSByte + * Unused - LSByte + */ + u32 m_u32Customize; + u32 m_u32ConfigBW; /* In Hz */ + u32 m_u32ShutDownInitThresholdTimer; + u32 m_u32RadioParameter; + u32 m_u32PhyParameter1; + u32 m_u32PhyParameter2; + u32 m_u32PhyParameter3; + u32 m_u32TestOptions; /* in eval mode only; lower 16bits = basic cid for testing; then bit 16 is test cqich,bit 17 test init rang; bit 18 test periodic rang and bit 19 is test harq ack/nack */ + u32 m_u32MaxMACDataperDLFrame; + u32 m_u32MaxMACDataperULFrame; + u32 m_u32Corr2MacFlags; + u32 HostDrvrConfig1; + u32 HostDrvrConfig2; + u32 HostDrvrConfig3; + u32 HostDrvrConfig4; + u32 HostDrvrConfig5; + u32 HostDrvrConfig6; + u32 m_u32SegmentedPUSCenable; + /* removed SHUT down related 'unused' params from here to sync 4.x and 5.x CFG files.. + * BAMC Related Parameters + * Bit 0-15 Band AMC signaling configuration: Bit 1 = 1 – Enable Band AMC signaling. + * bit 16-31 Band AMC Data configuration: Bit 16 = 1 – Band AMC 2x3 support. + */ + u32 m_u32BandAMCEnable; +}; #endif diff --git a/drivers/staging/bcm/vendorspecificextn.c b/drivers/staging/bcm/vendorspecificextn.c index 40be60aa909a..be1f91d955aa 100644 --- a/drivers/staging/bcm/vendorspecificextn.c +++ b/drivers/staging/bcm/vendorspecificextn.c @@ -11,7 +11,7 @@ // STATUS_SUCCESS/STATUS_FAILURE // //----------------------------------------------------------------------------- -INT vendorextnGetSectionInfo(PVOID pContext,PFLASH2X_VENDORSPECIFIC_INFO pVendorInfo) +INT vendorextnGetSectionInfo(PVOID pContext, struct bcm_flash2x_vendor_info *pVendorInfo) { return STATUS_FAILURE; } diff --git a/drivers/staging/bcm/vendorspecificextn.h b/drivers/staging/bcm/vendorspecificextn.h index 834410e29e75..52890d216edf 100644 --- a/drivers/staging/bcm/vendorspecificextn.h +++ b/drivers/staging/bcm/vendorspecificextn.h @@ -4,7 +4,7 @@ #define CONTINUE_COMMON_PATH 0xFFFF -INT vendorextnGetSectionInfo(PVOID pContext,PFLASH2X_VENDORSPECIFIC_INFO pVendorInfo); +INT vendorextnGetSectionInfo(PVOID pContext, struct bcm_flash2x_vendor_info *pVendorInfo); INT vendorextnExit(struct bcm_mini_adapter *Adapter); INT vendorextnInit(struct bcm_mini_adapter *Adapter); INT vendorextnIoctl(struct bcm_mini_adapter *Adapter, UINT cmd, ULONG arg); diff --git a/drivers/staging/comedi/Makefile b/drivers/staging/comedi/Makefile index 8dbd306fef88..f895c0ccc3c8 100644 --- a/drivers/staging/comedi/Makefile +++ b/drivers/staging/comedi/Makefile @@ -1,11 +1,8 @@ -obj-$(CONFIG_COMEDI) += comedi.o +comedi-y := comedi_fops.o range.o drivers.o +comedi-$(CONFIG_PROC_FS) += proc.o +comedi-$(CONFIG_COMPAT) += comedi_compat32.o -obj-$(CONFIG_COMEDI) += kcomedilib/ -obj-$(CONFIG_COMEDI) += drivers/ +obj-$(CONFIG_COMEDI) += comedi.o -comedi-y := \ - comedi_fops.o \ - proc.o \ - range.o \ - drivers.o \ - comedi_compat32.o \ +obj-$(CONFIG_COMEDI) += kcomedilib/ +obj-$(CONFIG_COMEDI) += drivers/ diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 4b7cbfad1d74..ad208cdd53d4 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -30,8 +30,6 @@ #include "comedi.h" #include "comedi_compat32.h" -#ifdef CONFIG_COMPAT - #define COMEDI32_CHANINFO _IOR(CIO, 3, struct comedi32_chaninfo_struct) #define COMEDI32_RANGEINFO _IOR(CIO, 8, struct comedi32_rangeinfo_struct) /* N.B. COMEDI32_CMD and COMEDI_CMD ought to use _IOWR, not _IOR. @@ -460,5 +458,3 @@ long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { return raw_ioctl(file, cmd, arg); } - -#endif /* CONFIG_COMPAT */ diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 9b038e4a7e71..cd2c7d40d4db 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -49,10 +49,6 @@ #include "comedi_internal.h" -MODULE_AUTHOR("http://www.comedi.org"); -MODULE_DESCRIPTION("Comedi core module"); -MODULE_LICENSE("GPL"); - #ifdef CONFIG_COMEDI_DEBUG int comedi_debug; EXPORT_SYMBOL(comedi_debug); @@ -86,17 +82,56 @@ MODULE_PARM_DESC(comedi_default_buf_maxsize_kb, "default maximum size of asynchronous buffer in KiB (default " __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB) ")"); +struct comedi_file_info { + struct comedi_device *device; + struct comedi_subdevice *read_subdevice; + struct comedi_subdevice *write_subdevice; + struct device *hardware_device; +}; + static DEFINE_SPINLOCK(comedi_file_info_table_lock); -static struct comedi_device_file_info -*comedi_file_info_table[COMEDI_NUM_MINORS]; +static struct comedi_file_info *comedi_file_info_table[COMEDI_NUM_MINORS]; -static void do_become_nonbusy(struct comedi_device *dev, - struct comedi_subdevice *s); -static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s); +static struct comedi_file_info *comedi_file_info_from_minor(unsigned minor) +{ + struct comedi_file_info *info; + + BUG_ON(minor >= COMEDI_NUM_MINORS); + spin_lock(&comedi_file_info_table_lock); + info = comedi_file_info_table[minor]; + spin_unlock(&comedi_file_info_table_lock); + return info; +} -static int comedi_fasync(int fd, struct file *file, int on); +struct comedi_device *comedi_dev_from_minor(unsigned minor) +{ + struct comedi_file_info *info; + + info = comedi_file_info_from_minor(minor); + + return info ? info->device : NULL; +} +EXPORT_SYMBOL_GPL(comedi_dev_from_minor); -static int is_device_busy(struct comedi_device *dev); +static struct comedi_subdevice * +comedi_read_subdevice(const struct comedi_file_info *info) +{ + if (info->read_subdevice) + return info->read_subdevice; + if (info->device) + return info->device->read_subdev; + return NULL; +} + +static struct comedi_subdevice * +comedi_write_subdevice(const struct comedi_file_info *info) +{ + if (info->write_subdevice) + return info->write_subdevice; + if (info->device) + return info->device->write_subdev; + return NULL; +} static int resize_async_buffer(struct comedi_device *dev, struct comedi_subdevice *s, @@ -134,7 +169,7 @@ static int resize_async_buffer(struct comedi_device *dev, } DPRINTK("comedi%i subd %d buffer resized to %i bytes\n", - dev->minor, (int)(s - dev->subdevices), async->prealloc_bufsz); + dev->minor, s->index, async->prealloc_bufsz); return 0; } @@ -143,8 +178,8 @@ static int resize_async_buffer(struct comedi_device *dev, static ssize_t show_max_read_buffer_kb(struct device *dev, struct device_attribute *attr, char *buf) { - struct comedi_device_file_info *info = dev_get_drvdata(dev); - struct comedi_subdevice *s = comedi_get_read_subdevice(info); + struct comedi_file_info *info = dev_get_drvdata(dev); + struct comedi_subdevice *s = comedi_read_subdevice(info); unsigned int size = 0; mutex_lock(&info->device->mutex); @@ -159,8 +194,8 @@ static ssize_t store_max_read_buffer_kb(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct comedi_device_file_info *info = dev_get_drvdata(dev); - struct comedi_subdevice *s = comedi_get_read_subdevice(info); + struct comedi_file_info *info = dev_get_drvdata(dev); + struct comedi_subdevice *s = comedi_read_subdevice(info); unsigned int size; int err; @@ -184,8 +219,8 @@ static ssize_t store_max_read_buffer_kb(struct device *dev, static ssize_t show_read_buffer_kb(struct device *dev, struct device_attribute *attr, char *buf) { - struct comedi_device_file_info *info = dev_get_drvdata(dev); - struct comedi_subdevice *s = comedi_get_read_subdevice(info); + struct comedi_file_info *info = dev_get_drvdata(dev); + struct comedi_subdevice *s = comedi_read_subdevice(info); unsigned int size = 0; mutex_lock(&info->device->mutex); @@ -200,8 +235,8 @@ static ssize_t store_read_buffer_kb(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct comedi_device_file_info *info = dev_get_drvdata(dev); - struct comedi_subdevice *s = comedi_get_read_subdevice(info); + struct comedi_file_info *info = dev_get_drvdata(dev); + struct comedi_subdevice *s = comedi_read_subdevice(info); unsigned int size; int err; @@ -226,8 +261,8 @@ static ssize_t show_max_write_buffer_kb(struct device *dev, struct device_attribute *attr, char *buf) { - struct comedi_device_file_info *info = dev_get_drvdata(dev); - struct comedi_subdevice *s = comedi_get_write_subdevice(info); + struct comedi_file_info *info = dev_get_drvdata(dev); + struct comedi_subdevice *s = comedi_write_subdevice(info); unsigned int size = 0; mutex_lock(&info->device->mutex); @@ -242,8 +277,8 @@ static ssize_t store_max_write_buffer_kb(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct comedi_device_file_info *info = dev_get_drvdata(dev); - struct comedi_subdevice *s = comedi_get_write_subdevice(info); + struct comedi_file_info *info = dev_get_drvdata(dev); + struct comedi_subdevice *s = comedi_write_subdevice(info); unsigned int size; int err; @@ -267,8 +302,8 @@ static ssize_t store_max_write_buffer_kb(struct device *dev, static ssize_t show_write_buffer_kb(struct device *dev, struct device_attribute *attr, char *buf) { - struct comedi_device_file_info *info = dev_get_drvdata(dev); - struct comedi_subdevice *s = comedi_get_write_subdevice(info); + struct comedi_file_info *info = dev_get_drvdata(dev); + struct comedi_subdevice *s = comedi_write_subdevice(info); unsigned int size = 0; mutex_lock(&info->device->mutex); @@ -283,8 +318,8 @@ static ssize_t store_write_buffer_kb(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct comedi_device_file_info *info = dev_get_drvdata(dev); - struct comedi_subdevice *s = comedi_get_write_subdevice(info); + struct comedi_file_info *info = dev_get_drvdata(dev); + struct comedi_subdevice *s = comedi_write_subdevice(info); unsigned int size; int err; @@ -317,6 +352,103 @@ static struct device_attribute comedi_dev_attrs[] = { __ATTR_NULL }; +static void comedi_set_subdevice_runflags(struct comedi_subdevice *s, + unsigned mask, unsigned bits) +{ + unsigned long flags; + + spin_lock_irqsave(&s->spin_lock, flags); + s->runflags &= ~mask; + s->runflags |= (bits & mask); + spin_unlock_irqrestore(&s->spin_lock, flags); +} + +static unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s) +{ + unsigned long flags; + unsigned runflags; + + spin_lock_irqsave(&s->spin_lock, flags); + runflags = s->runflags; + spin_unlock_irqrestore(&s->spin_lock, flags); + return runflags; +} + +bool comedi_is_subdevice_running(struct comedi_subdevice *s) +{ + unsigned runflags = comedi_get_subdevice_runflags(s); + + return (runflags & SRF_RUNNING) ? true : false; +} +EXPORT_SYMBOL_GPL(comedi_is_subdevice_running); + +static bool comedi_is_subdevice_in_error(struct comedi_subdevice *s) +{ + unsigned runflags = comedi_get_subdevice_runflags(s); + + return (runflags & SRF_ERROR) ? true : false; +} + +static bool comedi_is_subdevice_idle(struct comedi_subdevice *s) +{ + unsigned runflags = comedi_get_subdevice_runflags(s); + + return (runflags & (SRF_ERROR | SRF_RUNNING)) ? false : true; +} + +/* + This function restores a subdevice to an idle state. + */ +static void do_become_nonbusy(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct comedi_async *async = s->async; + + comedi_set_subdevice_runflags(s, SRF_RUNNING, 0); + if (async) { + comedi_reset_async_buf(async); + async->inttrig = NULL; + kfree(async->cmd.chanlist); + async->cmd.chanlist = NULL; + } else { + dev_err(dev->class_dev, + "BUG: (?) do_become_nonbusy called with async=NULL\n"); + } + + s->busy = NULL; +} + +static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s) +{ + int ret = 0; + + if (comedi_is_subdevice_running(s) && s->cancel) + ret = s->cancel(dev, s); + + do_become_nonbusy(dev, s); + + return ret; +} + +static int is_device_busy(struct comedi_device *dev) +{ + struct comedi_subdevice *s; + int i; + + if (!dev->attached) + return 0; + + for (i = 0; i < dev->n_subdevices; i++) { + s = &dev->subdevices[i]; + if (s->busy) + return 1; + if (s->async && s->async->mmap_count) + return 1; + } + + return 0; +} + /* COMEDI_DEVCONFIG device config ioctl @@ -352,7 +484,7 @@ static int do_devconfig_ioctl(struct comedi_device *dev, return 0; } - if (copy_from_user(&it, arg, sizeof(struct comedi_devconfig))) + if (copy_from_user(&it, arg, sizeof(it))) return -EFAULT; it.board_name[COMEDI_NAMELEN - 1] = 0; @@ -420,7 +552,7 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, struct comedi_subdevice *s; int retval = 0; - if (copy_from_user(&bc, arg, sizeof(struct comedi_bufconfig))) + if (copy_from_user(&bc, arg, sizeof(bc))) return -EFAULT; if (bc.subdevice >= dev->n_subdevices || bc.subdevice < 0) @@ -453,7 +585,7 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, bc.maximum_size = async->max_bufsize; copyback: - if (copy_to_user(arg, &bc, sizeof(struct comedi_bufconfig))) + if (copy_to_user(arg, &bc, sizeof(bc))) return -EFAULT; return 0; @@ -477,14 +609,10 @@ static int do_devinfo_ioctl(struct comedi_device *dev, struct comedi_devinfo __user *arg, struct file *file) { - struct comedi_devinfo devinfo; const unsigned minor = iminor(file->f_dentry->d_inode); - struct comedi_device_file_info *dev_file_info = - comedi_get_device_file_info(minor); - struct comedi_subdevice *read_subdev = - comedi_get_read_subdevice(dev_file_info); - struct comedi_subdevice *write_subdev = - comedi_get_write_subdevice(dev_file_info); + struct comedi_file_info *info = comedi_file_info_from_minor(minor); + struct comedi_subdevice *s; + struct comedi_devinfo devinfo; memset(&devinfo, 0, sizeof(devinfo)); @@ -494,17 +622,19 @@ static int do_devinfo_ioctl(struct comedi_device *dev, strlcpy(devinfo.driver_name, dev->driver->driver_name, COMEDI_NAMELEN); strlcpy(devinfo.board_name, dev->board_name, COMEDI_NAMELEN); - if (read_subdev) - devinfo.read_subdevice = read_subdev - dev->subdevices; + s = comedi_read_subdevice(info); + if (s) + devinfo.read_subdevice = s->index; else devinfo.read_subdevice = -1; - if (write_subdev) - devinfo.write_subdevice = write_subdev - dev->subdevices; + s = comedi_write_subdevice(info); + if (s) + devinfo.write_subdevice = s->index; else devinfo.write_subdevice = -1; - if (copy_to_user(arg, &devinfo, sizeof(struct comedi_devinfo))) + if (copy_to_user(arg, &devinfo, sizeof(devinfo))) return -EFAULT; return 0; @@ -531,9 +661,7 @@ static int do_subdinfo_ioctl(struct comedi_device *dev, struct comedi_subdinfo *tmp, *us; struct comedi_subdevice *s; - tmp = - kcalloc(dev->n_subdevices, sizeof(struct comedi_subdinfo), - GFP_KERNEL); + tmp = kcalloc(dev->n_subdevices, sizeof(*tmp), GFP_KERNEL); if (!tmp) return -ENOMEM; @@ -545,7 +673,7 @@ static int do_subdinfo_ioctl(struct comedi_device *dev, us->type = s->type; us->n_chan = s->n_chan; us->subd_flags = s->subdev_flags; - if (comedi_get_subdevice_runflags(s) & SRF_RUNNING) + if (comedi_is_subdevice_running(s)) us->subd_flags |= SDF_RUNNING; #define TIMER_nanosec 5 /* backwards compatibility */ us->timer_type = TIMER_nanosec; @@ -584,8 +712,7 @@ static int do_subdinfo_ioctl(struct comedi_device *dev, us->settling_time_0 = s->settling_time_0; } - ret = copy_to_user(arg, tmp, - dev->n_subdevices * sizeof(struct comedi_subdinfo)); + ret = copy_to_user(arg, tmp, dev->n_subdevices * sizeof(*tmp)); kfree(tmp); @@ -612,7 +739,7 @@ static int do_chaninfo_ioctl(struct comedi_device *dev, struct comedi_subdevice *s; struct comedi_chaninfo it; - if (copy_from_user(&it, arg, sizeof(struct comedi_chaninfo))) + if (copy_from_user(&it, arg, sizeof(it))) return -EFAULT; if (it.subdev >= dev->n_subdevices) @@ -679,7 +806,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev, struct comedi_subdevice *s; struct comedi_async *async; - if (copy_from_user(&bi, arg, sizeof(struct comedi_bufinfo))) + if (copy_from_user(&bi, arg, sizeof(bi))) return -EFAULT; if (bi.subdevice >= dev->n_subdevices || bi.subdevice < 0) @@ -714,9 +841,8 @@ static int do_bufinfo_ioctl(struct comedi_device *dev, bi.bytes_read = comedi_buf_read_alloc(async, bi.bytes_read); comedi_buf_read_free(async, bi.bytes_read); - if (!(comedi_get_subdevice_runflags(s) & (SRF_ERROR | - SRF_RUNNING)) - && async->buf_write_count == async->buf_read_count) { + if (comedi_is_subdevice_idle(s) && + async->buf_write_count == async->buf_read_count) { do_become_nonbusy(dev, s); } } @@ -734,7 +860,7 @@ copyback_position: bi.buf_read_ptr = async->buf_read_ptr; copyback: - if (copy_to_user(arg, &bi, sizeof(struct comedi_bufinfo))) + if (copy_to_user(arg, &bi, sizeof(bi))) return -EFAULT; return 0; @@ -768,7 +894,7 @@ static int do_insnlist_ioctl(struct comedi_device *dev, int i = 0; int ret = 0; - if (copy_from_user(&insnlist, arg, sizeof(struct comedi_insnlist))) + if (copy_from_user(&insnlist, arg, sizeof(insnlist))) return -EFAULT; data = kmalloc(sizeof(unsigned int) * MAX_SAMPLES, GFP_KERNEL); @@ -778,8 +904,7 @@ static int do_insnlist_ioctl(struct comedi_device *dev, goto error; } - insns = - kcalloc(insnlist.n_insns, sizeof(struct comedi_insn), GFP_KERNEL); + insns = kcalloc(insnlist.n_insns, sizeof(*insns), GFP_KERNEL); if (!insns) { DPRINTK("kmalloc failed\n"); ret = -ENOMEM; @@ -787,7 +912,7 @@ static int do_insnlist_ioctl(struct comedi_device *dev, } if (copy_from_user(insns, insnlist.insns, - sizeof(struct comedi_insn) * insnlist.n_insns)) { + sizeof(*insns) * insnlist.n_insns)) { DPRINTK("copy_from_user failed\n"); ret = -EFAULT; goto error; @@ -1088,7 +1213,7 @@ static int do_insn_ioctl(struct comedi_device *dev, goto error; } - if (copy_from_user(&insn, arg, sizeof(struct comedi_insn))) { + if (copy_from_user(&insn, arg, sizeof(insn))) { ret = -EFAULT; goto error; } @@ -1123,17 +1248,6 @@ error: return ret; } -static void comedi_set_subdevice_runflags(struct comedi_subdevice *s, - unsigned mask, unsigned bits) -{ - unsigned long flags; - - spin_lock_irqsave(&s->spin_lock, flags); - s->runflags &= ~mask; - s->runflags |= (bits & mask); - spin_unlock_irqrestore(&s->spin_lock, flags); -} - static int do_cmd_ioctl(struct comedi_device *dev, struct comedi_cmd __user *arg, void *file) { @@ -1143,7 +1257,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, int ret = 0; unsigned int __user *user_chanlist; - if (copy_from_user(&cmd, arg, sizeof(struct comedi_cmd))) { + if (copy_from_user(&cmd, arg, sizeof(cmd))) { DPRINTK("bad cmd address\n"); return -EFAULT; } @@ -1233,7 +1347,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, /* restore chanlist pointer before copying back */ cmd.chanlist = (unsigned int __force *)user_chanlist; cmd.data = NULL; - if (copy_to_user(arg, &cmd, sizeof(struct comedi_cmd))) { + if (copy_to_user(arg, &cmd, sizeof(cmd))) { DPRINTK("fault writing cmd\n"); ret = -EFAULT; goto cleanup; @@ -1292,7 +1406,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev, unsigned int *chanlist = NULL; unsigned int __user *user_chanlist; - if (copy_from_user(&cmd, arg, sizeof(struct comedi_cmd))) { + if (copy_from_user(&cmd, arg, sizeof(cmd))) { DPRINTK("bad cmd address\n"); return -EFAULT; } @@ -1356,7 +1470,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev, /* restore chanlist pointer before copying back */ cmd.chanlist = (unsigned int __force *)user_chanlist; - if (copy_to_user(arg, &cmd, sizeof(struct comedi_cmd))) { + if (copy_to_user(arg, &cmd, sizeof(cmd))) { DPRINTK("bad cmd address\n"); ret = -EFAULT; goto cleanup; @@ -1533,14 +1647,12 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { const unsigned minor = iminor(file->f_dentry->d_inode); - struct comedi_device_file_info *dev_file_info = - comedi_get_device_file_info(minor); - struct comedi_device *dev; + struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_file_info *info = comedi_file_info_from_minor(minor); int rc; - if (dev_file_info == NULL || dev_file_info->device == NULL) + if (!dev) return -ENODEV; - dev = dev_file_info->device; mutex_lock(&dev->mutex); @@ -1551,7 +1663,7 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, (struct comedi_devconfig __user *)arg); if (rc == 0) /* Evade comedi_auto_unconfig(). */ - dev_file_info->hardware_device = NULL; + info->hardware_device = NULL; goto done; } @@ -1624,19 +1736,6 @@ done: return rc; } -static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s) -{ - int ret = 0; - - if ((comedi_get_subdevice_runflags(s) & SRF_RUNNING) && s->cancel) - ret = s->cancel(dev, s); - - do_become_nonbusy(dev, s); - - return ret; -} - - static void comedi_vm_open(struct vm_area_struct *area) { struct comedi_async *async; @@ -1671,40 +1770,38 @@ static struct vm_operations_struct comedi_vm_ops = { static int comedi_mmap(struct file *file, struct vm_area_struct *vma) { const unsigned minor = iminor(file->f_dentry->d_inode); - struct comedi_async *async = NULL; + struct comedi_file_info *info = comedi_file_info_from_minor(minor); + struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_subdevice *s; + struct comedi_async *async; unsigned long start = vma->vm_start; unsigned long size; int n_pages; int i; int retval; - struct comedi_subdevice *s; - struct comedi_device_file_info *dev_file_info; - struct comedi_device *dev; - dev_file_info = comedi_get_device_file_info(minor); - if (dev_file_info == NULL) - return -ENODEV; - dev = dev_file_info->device; - if (dev == NULL) + if (!dev) return -ENODEV; mutex_lock(&dev->mutex); + if (!dev->attached) { DPRINTK("no driver configured on comedi%i\n", dev->minor); retval = -ENODEV; goto done; } + if (vma->vm_flags & VM_WRITE) - s = comedi_get_write_subdevice(dev_file_info); + s = comedi_write_subdevice(info); else - s = comedi_get_read_subdevice(dev_file_info); - - if (s == NULL) { + s = comedi_read_subdevice(info); + if (!s) { retval = -EINVAL; goto done; } + async = s->async; - if (async == NULL) { + if (!async) { retval = -EINVAL; goto done; } @@ -1727,11 +1824,11 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) n_pages = size >> PAGE_SHIFT; for (i = 0; i < n_pages; ++i) { + struct comedi_buf_page *buf = &async->buf_page_list[i]; + if (remap_pfn_range(vma, start, - page_to_pfn(virt_to_page - (async->buf_page_list - [i].virt_addr)), PAGE_SIZE, - PAGE_SHARED)) { + page_to_pfn(virt_to_page(buf->virt_addr)), + PAGE_SIZE, PAGE_SHARED)) { retval = -EAGAIN; goto done; } @@ -1753,50 +1850,40 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait) { unsigned int mask = 0; const unsigned minor = iminor(file->f_dentry->d_inode); - struct comedi_subdevice *read_subdev; - struct comedi_subdevice *write_subdev; - struct comedi_device_file_info *dev_file_info; - struct comedi_device *dev; - dev_file_info = comedi_get_device_file_info(minor); + struct comedi_file_info *info = comedi_file_info_from_minor(minor); + struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_subdevice *s; - if (dev_file_info == NULL) - return -ENODEV; - dev = dev_file_info->device; - if (dev == NULL) + if (!dev) return -ENODEV; mutex_lock(&dev->mutex); + if (!dev->attached) { DPRINTK("no driver configured on comedi%i\n", dev->minor); - mutex_unlock(&dev->mutex); - return 0; + goto done; } - mask = 0; - read_subdev = comedi_get_read_subdevice(dev_file_info); - if (read_subdev) { - poll_wait(file, &read_subdev->async->wait_head, wait); - if (!read_subdev->busy - || comedi_buf_read_n_available(read_subdev->async) > 0 - || !(comedi_get_subdevice_runflags(read_subdev) & - SRF_RUNNING)) { + s = comedi_read_subdevice(info); + if (s) { + poll_wait(file, &s->async->wait_head, wait); + if (!s->busy || !comedi_is_subdevice_running(s) || + comedi_buf_read_n_available(s->async) > 0) mask |= POLLIN | POLLRDNORM; - } } - write_subdev = comedi_get_write_subdevice(dev_file_info); - if (write_subdev) { - poll_wait(file, &write_subdev->async->wait_head, wait); - comedi_buf_write_alloc(write_subdev->async, - write_subdev->async->prealloc_bufsz); - if (!write_subdev->busy - || !(comedi_get_subdevice_runflags(write_subdev) & - SRF_RUNNING) - || comedi_buf_write_n_allocated(write_subdev->async) >= - bytes_per_sample(write_subdev->async->subdevice)) { + + s = comedi_write_subdevice(info); + if (s) { + unsigned int bps = bytes_per_sample(s->async->subdevice); + + poll_wait(file, &s->async->wait_head, wait); + comedi_buf_write_alloc(s->async, s->async->prealloc_bufsz); + if (!s->busy || !comedi_is_subdevice_running(s) || + comedi_buf_write_n_allocated(s->async) >= bps) mask |= POLLOUT | POLLWRNORM; - } } +done: mutex_unlock(&dev->mutex); return mask; } @@ -1809,53 +1896,38 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, int n, m, count = 0, retval = 0; DECLARE_WAITQUEUE(wait, current); const unsigned minor = iminor(file->f_dentry->d_inode); - struct comedi_device_file_info *dev_file_info; - struct comedi_device *dev; - dev_file_info = comedi_get_device_file_info(minor); + struct comedi_file_info *info = comedi_file_info_from_minor(minor); + struct comedi_device *dev = comedi_dev_from_minor(minor); - if (dev_file_info == NULL) - return -ENODEV; - dev = dev_file_info->device; - if (dev == NULL) + if (!dev) return -ENODEV; if (!dev->attached) { DPRINTK("no driver configured on comedi%i\n", dev->minor); - retval = -ENODEV; - goto done; + return -ENODEV; } - s = comedi_get_write_subdevice(dev_file_info); - if (s == NULL) { - retval = -EIO; - goto done; - } + s = comedi_write_subdevice(info); + if (!s) + return -EIO; + async = s->async; - if (!nbytes) { - retval = 0; - goto done; - } - if (!s->busy) { - retval = 0; - goto done; - } - if (s->busy != file) { - retval = -EACCES; - goto done; - } + if (!s->busy || !nbytes) + return 0; + if (s->busy != file) + return -EACCES; + add_wait_queue(&async->wait_head, &wait); while (nbytes > 0 && !retval) { set_current_state(TASK_INTERRUPTIBLE); - if (!(comedi_get_subdevice_runflags(s) & SRF_RUNNING)) { + if (!comedi_is_subdevice_running(s)) { if (count == 0) { - if (comedi_get_subdevice_runflags(s) & - SRF_ERROR) { + if (comedi_is_subdevice_in_error(s)) retval = -EPIPE; - } else { + else retval = 0; - } do_become_nonbusy(dev, s); } break; @@ -1908,7 +1980,6 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, set_current_state(TASK_RUNNING); remove_wait_queue(&async->wait_head, &wait); -done: return count ? count : retval; } @@ -1920,40 +1991,26 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, int n, m, count = 0, retval = 0; DECLARE_WAITQUEUE(wait, current); const unsigned minor = iminor(file->f_dentry->d_inode); - struct comedi_device_file_info *dev_file_info; - struct comedi_device *dev; - dev_file_info = comedi_get_device_file_info(minor); + struct comedi_file_info *info = comedi_file_info_from_minor(minor); + struct comedi_device *dev = comedi_dev_from_minor(minor); - if (dev_file_info == NULL) - return -ENODEV; - dev = dev_file_info->device; - if (dev == NULL) + if (!dev) return -ENODEV; if (!dev->attached) { DPRINTK("no driver configured on comedi%i\n", dev->minor); - retval = -ENODEV; - goto done; + return -ENODEV; } - s = comedi_get_read_subdevice(dev_file_info); - if (s == NULL) { - retval = -EIO; - goto done; - } + s = comedi_read_subdevice(info); + if (!s) + return -EIO; + async = s->async; - if (!nbytes) { - retval = 0; - goto done; - } - if (!s->busy) { - retval = 0; - goto done; - } - if (s->busy != file) { - retval = -EACCES; - goto done; - } + if (!s->busy || !nbytes) + return 0; + if (s->busy != file) + return -EACCES; add_wait_queue(&async->wait_head, &wait); while (nbytes > 0 && !retval) { @@ -1970,14 +2027,12 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, n = m; if (n == 0) { - if (!(comedi_get_subdevice_runflags(s) & SRF_RUNNING)) { + if (!comedi_is_subdevice_running(s)) { do_become_nonbusy(dev, s); - if (comedi_get_subdevice_runflags(s) & - SRF_ERROR) { + if (comedi_is_subdevice_in_error(s)) retval = -EPIPE; - } else { + else retval = 0; - } break; } if (file->f_flags & O_NONBLOCK) { @@ -2015,48 +2070,22 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, buf += n; break; /* makes device work like a pipe */ } - if (!(comedi_get_subdevice_runflags(s) & (SRF_ERROR | SRF_RUNNING)) && + if (comedi_is_subdevice_idle(s) && async->buf_read_count - async->buf_write_count == 0) { do_become_nonbusy(dev, s); } set_current_state(TASK_RUNNING); remove_wait_queue(&async->wait_head, &wait); -done: return count ? count : retval; } -/* - This function restores a subdevice to an idle state. - */ -static void do_become_nonbusy(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - struct comedi_async *async = s->async; - - comedi_set_subdevice_runflags(s, SRF_RUNNING, 0); - if (async) { - comedi_reset_async_buf(async); - async->inttrig = NULL; - kfree(async->cmd.chanlist); - async->cmd.chanlist = NULL; - } else { - dev_err(dev->class_dev, - "BUG: (?) do_become_nonbusy called with async=NULL\n"); - } - - s->busy = NULL; -} - static int comedi_open(struct inode *inode, struct file *file) { const unsigned minor = iminor(inode); - struct comedi_device_file_info *dev_file_info = - comedi_get_device_file_info(minor); - struct comedi_device *dev = - dev_file_info ? dev_file_info->device : NULL; + struct comedi_device *dev = comedi_dev_from_minor(minor); - if (dev == NULL) { + if (!dev) { DPRINTK("invalid minor number\n"); return -ENODEV; } @@ -2128,19 +2157,25 @@ ok: return 0; } +static int comedi_fasync(int fd, struct file *file, int on) +{ + const unsigned minor = iminor(file->f_dentry->d_inode); + struct comedi_device *dev = comedi_dev_from_minor(minor); + + if (!dev) + return -ENODEV; + + return fasync_helper(fd, file, on, &dev->async_queue); +} + static int comedi_close(struct inode *inode, struct file *file) { const unsigned minor = iminor(inode); + struct comedi_device *dev = comedi_dev_from_minor(minor); struct comedi_subdevice *s = NULL; int i; - struct comedi_device_file_info *dev_file_info; - struct comedi_device *dev; - dev_file_info = comedi_get_device_file_info(minor); - if (dev_file_info == NULL) - return -ENODEV; - dev = dev_file_info->device; - if (dev == NULL) + if (!dev) return -ENODEV; mutex_lock(&dev->mutex); @@ -2172,22 +2207,6 @@ static int comedi_close(struct inode *inode, struct file *file) return 0; } -static int comedi_fasync(int fd, struct file *file, int on) -{ - const unsigned minor = iminor(file->f_dentry->d_inode); - struct comedi_device_file_info *dev_file_info; - struct comedi_device *dev; - dev_file_info = comedi_get_device_file_info(minor); - - if (dev_file_info == NULL) - return -ENODEV; - dev = dev_file_info->device; - if (dev == NULL) - return -ENODEV; - - return fasync_helper(fd, file, on, &dev->async_queue); -} - static const struct file_operations comedi_fops = { .owner = THIS_MODULE, .unlocked_ioctl = comedi_unlocked_ioctl, @@ -2205,99 +2224,6 @@ static const struct file_operations comedi_fops = { static struct class *comedi_class; static struct cdev comedi_cdev; -static void comedi_cleanup_legacy_minors(void) -{ - unsigned i; - - for (i = 0; i < comedi_num_legacy_minors; i++) - comedi_free_board_minor(i); -} - -static int __init comedi_init(void) -{ - int i; - int retval; - - pr_info("comedi: version " COMEDI_RELEASE " - http://www.comedi.org\n"); - - if (comedi_num_legacy_minors < 0 || - comedi_num_legacy_minors > COMEDI_NUM_BOARD_MINORS) { - pr_err("comedi: error: invalid value for module parameter \"comedi_num_legacy_minors\". Valid values are 0 through %i.\n", - COMEDI_NUM_BOARD_MINORS); - return -EINVAL; - } - - /* - * comedi is unusable if both comedi_autoconfig and - * comedi_num_legacy_minors are zero, so we might as well adjust the - * defaults in that case - */ - if (comedi_autoconfig == 0 && comedi_num_legacy_minors == 0) - comedi_num_legacy_minors = 16; - - memset(comedi_file_info_table, 0, - sizeof(struct comedi_device_file_info *) * COMEDI_NUM_MINORS); - - retval = register_chrdev_region(MKDEV(COMEDI_MAJOR, 0), - COMEDI_NUM_MINORS, "comedi"); - if (retval) - return -EIO; - cdev_init(&comedi_cdev, &comedi_fops); - comedi_cdev.owner = THIS_MODULE; - kobject_set_name(&comedi_cdev.kobj, "comedi"); - 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)) { - pr_err("comedi: failed to create class\n"); - cdev_del(&comedi_cdev); - unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), - COMEDI_NUM_MINORS); - return PTR_ERR(comedi_class); - } - - comedi_class->dev_attrs = comedi_dev_attrs; - - /* XXX requires /proc interface */ - comedi_proc_init(); - - /* create devices files for legacy/manual use */ - for (i = 0; i < comedi_num_legacy_minors; i++) { - int minor; - minor = comedi_alloc_board_minor(NULL); - if (minor < 0) { - comedi_cleanup_legacy_minors(); - cdev_del(&comedi_cdev); - unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), - COMEDI_NUM_MINORS); - return minor; - } - } - - return 0; -} - -static void __exit comedi_cleanup(void) -{ - int i; - - comedi_cleanup_legacy_minors(); - for (i = 0; i < COMEDI_NUM_MINORS; ++i) - BUG_ON(comedi_file_info_table[i]); - - class_destroy(comedi_class); - cdev_del(&comedi_cdev); - unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); - - comedi_proc_cleanup(); -} - -module_init(comedi_init); -module_exit(comedi_cleanup); - void comedi_error(const struct comedi_device *dev, const char *s) { dev_err(dev->class_dev, "%s: %s\n", dev->driver->driver_name, s); @@ -2312,7 +2238,7 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) /* DPRINTK("comedi_event 0x%x\n",mask); */ - if ((comedi_get_subdevice_runflags(s) & SRF_RUNNING) == 0) + if (!comedi_is_subdevice_running(s)) return; if (s-> @@ -2347,40 +2273,9 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) } EXPORT_SYMBOL(comedi_event); -unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s) -{ - unsigned long flags; - unsigned runflags; - - spin_lock_irqsave(&s->spin_lock, flags); - runflags = s->runflags; - spin_unlock_irqrestore(&s->spin_lock, flags); - return runflags; -} -EXPORT_SYMBOL(comedi_get_subdevice_runflags); - -static int is_device_busy(struct comedi_device *dev) -{ - struct comedi_subdevice *s; - int i; - - if (!dev->attached) - return 0; - - for (i = 0; i < dev->n_subdevices; i++) { - s = &dev->subdevices[i]; - if (s->busy) - return 1; - if (s->async && s->async->mmap_count) - return 1; - } - - return 0; -} - static void comedi_device_init(struct comedi_device *dev) { - memset(dev, 0, sizeof(struct comedi_device)); + memset(dev, 0, sizeof(*dev)); spin_lock_init(&dev->spinlock); mutex_init(&dev->mutex); dev->minor = -1; @@ -2398,11 +2293,11 @@ static void comedi_device_cleanup(struct comedi_device *dev) int comedi_alloc_board_minor(struct device *hardware_device) { - struct comedi_device_file_info *info; + struct comedi_file_info *info; struct device *csdev; unsigned i; - info = kzalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL); + info = kzalloc(sizeof(*info), GFP_KERNEL); if (info == NULL) return -ENOMEM; info->device = kzalloc(sizeof(struct comedi_device), GFP_KERNEL); @@ -2439,7 +2334,7 @@ int comedi_alloc_board_minor(struct device *hardware_device) void comedi_free_board_minor(unsigned minor) { - struct comedi_device_file_info *info; + struct comedi_file_info *info; BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS); spin_lock(&comedi_file_info_table_lock); @@ -2464,7 +2359,7 @@ void comedi_free_board_minor(unsigned minor) int comedi_find_board_minor(struct device *hardware_device) { int minor; - struct comedi_device_file_info *info; + struct comedi_file_info *info; for (minor = 0; minor < COMEDI_NUM_BOARD_MINORS; minor++) { spin_lock(&comedi_file_info_table_lock); @@ -2481,12 +2376,12 @@ int comedi_find_board_minor(struct device *hardware_device) int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdevice *s) { - struct comedi_device_file_info *info; + struct comedi_file_info *info; struct device *csdev; unsigned i; - info = kmalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL); - if (info == NULL) + info = kzalloc(sizeof(*info), GFP_KERNEL); + if (!info) return -ENOMEM; info->device = dev; info->read_subdevice = s; @@ -2507,7 +2402,7 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, s->minor = i; csdev = device_create(comedi_class, dev->class_dev, MKDEV(COMEDI_MAJOR, i), NULL, "comedi%i_subd%i", - dev->minor, (int)(s - dev->subdevices)); + dev->minor, s->index); if (!IS_ERR(csdev)) s->class_dev = csdev; dev_set_drvdata(csdev, info); @@ -2517,7 +2412,7 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, void comedi_free_subdevice_minor(struct comedi_subdevice *s) { - struct comedi_device_file_info *info; + struct comedi_file_info *info; if (s == NULL) return; @@ -2539,14 +2434,98 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s) kfree(info); } -struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor) +static void comedi_cleanup_legacy_minors(void) { - struct comedi_device_file_info *info; + unsigned i; - BUG_ON(minor >= COMEDI_NUM_MINORS); - spin_lock(&comedi_file_info_table_lock); - info = comedi_file_info_table[minor]; - spin_unlock(&comedi_file_info_table_lock); - return info; + for (i = 0; i < comedi_num_legacy_minors; i++) + comedi_free_board_minor(i); } -EXPORT_SYMBOL_GPL(comedi_get_device_file_info); + +static int __init comedi_init(void) +{ + int i; + int retval; + + pr_info("comedi: version " COMEDI_RELEASE " - http://www.comedi.org\n"); + + if (comedi_num_legacy_minors < 0 || + comedi_num_legacy_minors > COMEDI_NUM_BOARD_MINORS) { + pr_err("comedi: error: invalid value for module parameter \"comedi_num_legacy_minors\". Valid values are 0 through %i.\n", + COMEDI_NUM_BOARD_MINORS); + return -EINVAL; + } + + /* + * comedi is unusable if both comedi_autoconfig and + * comedi_num_legacy_minors are zero, so we might as well adjust the + * defaults in that case + */ + if (comedi_autoconfig == 0 && comedi_num_legacy_minors == 0) + comedi_num_legacy_minors = 16; + + memset(comedi_file_info_table, 0, + sizeof(struct comedi_file_info *) * COMEDI_NUM_MINORS); + + retval = register_chrdev_region(MKDEV(COMEDI_MAJOR, 0), + COMEDI_NUM_MINORS, "comedi"); + if (retval) + return -EIO; + cdev_init(&comedi_cdev, &comedi_fops); + comedi_cdev.owner = THIS_MODULE; + kobject_set_name(&comedi_cdev.kobj, "comedi"); + 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)) { + pr_err("comedi: failed to create class\n"); + cdev_del(&comedi_cdev); + unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), + COMEDI_NUM_MINORS); + return PTR_ERR(comedi_class); + } + + comedi_class->dev_attrs = comedi_dev_attrs; + + /* XXX requires /proc interface */ + comedi_proc_init(); + + /* create devices files for legacy/manual use */ + for (i = 0; i < comedi_num_legacy_minors; i++) { + int minor; + minor = comedi_alloc_board_minor(NULL); + if (minor < 0) { + comedi_cleanup_legacy_minors(); + cdev_del(&comedi_cdev); + unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), + COMEDI_NUM_MINORS); + return minor; + } + } + + return 0; +} +module_init(comedi_init); + +static void __exit comedi_cleanup(void) +{ + int i; + + comedi_cleanup_legacy_minors(); + for (i = 0; i < COMEDI_NUM_MINORS; ++i) + BUG_ON(comedi_file_info_table[i]); + + class_destroy(comedi_class); + cdev_del(&comedi_cdev); + unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); + + comedi_proc_cleanup(); +} +module_exit(comedi_cleanup); + +MODULE_AUTHOR("http://www.comedi.org"); +MODULE_DESCRIPTION("Comedi core module"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 692e1e615d44..34a85d3941c3 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -77,6 +77,7 @@ struct comedi_subdevice { struct comedi_device *device; + int index; int type; int n_chan; int subdev_flags; @@ -250,13 +251,6 @@ static inline const void *comedi_board(const struct comedi_device *dev) return dev->board_ptr; } -struct comedi_device_file_info { - struct comedi_device *device; - struct comedi_subdevice *read_subdevice; - struct comedi_subdevice *write_subdevice; - struct device *hardware_device; -}; - #ifdef CONFIG_COMEDI_DEBUG extern int comedi_debug; #else @@ -280,27 +274,7 @@ enum comedi_minor_bits { static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4; static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1; -struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor); - -static inline struct comedi_subdevice *comedi_get_read_subdevice( - const struct comedi_device_file_info *info) -{ - if (info->read_subdevice) - return info->read_subdevice; - if (info->device == NULL) - return NULL; - return info->device->read_subdev; -} - -static inline struct comedi_subdevice *comedi_get_write_subdevice( - const struct comedi_device_file_info *info) -{ - if (info->write_subdevice) - return info->write_subdevice; - if (info->device == NULL) - return NULL; - return info->device->write_subdev; -} +struct comedi_device *comedi_dev_from_minor(unsigned minor); int comedi_alloc_subdevices(struct comedi_device *, int); @@ -389,10 +363,11 @@ enum subdevice_runflags { SRF_RUNNING = 0x08000000 }; +bool comedi_is_subdevice_running(struct comedi_subdevice *s); + int comedi_check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist); -unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s); /* range stuff */ @@ -489,7 +464,7 @@ static inline unsigned comedi_buf_read_n_allocated(struct comedi_async *async) static inline void *comedi_aux_data(int options[], int n) { unsigned long address; - unsigned long addressLow; + unsigned long address_low; int bit_shift; if (sizeof(int) >= sizeof(void *)) address = options[COMEDI_DEVCONF_AUX_DATA_LO]; @@ -497,9 +472,9 @@ static inline void *comedi_aux_data(int options[], int n) address = options[COMEDI_DEVCONF_AUX_DATA_HI]; bit_shift = sizeof(int) * 8; address <<= bit_shift; - addressLow = options[COMEDI_DEVCONF_AUX_DATA_LO]; - addressLow &= (1UL << bit_shift) - 1; - address |= addressLow; + address_low = options[COMEDI_DEVCONF_AUX_DATA_LO]; + address_low &= (1UL << bit_shift) - 1; + address |= address_low; } if (n >= 1) address += options[COMEDI_DEVCONF_AUX_DATA0_LENGTH]; diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 50cf498698e2..b67a0c9b149e 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -70,6 +70,7 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices) for (i = 0; i < num_subdevices; ++i) { s = &dev->subdevices[i]; s->device = dev; + s->index = i; s->async_dma_dir = DMA_NONE; spin_lock_init(&s->spin_lock); s->minor = -1; @@ -213,13 +214,10 @@ int comedi_driver_unregister(struct comedi_driver *driver) /* check for devices using this driver */ for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { - struct comedi_device_file_info *dev_file_info = - comedi_get_device_file_info(i); - struct comedi_device *dev; + struct comedi_device *dev = comedi_dev_from_minor(i); - if (dev_file_info == NULL) + if (!dev) continue; - dev = dev_file_info->device; mutex_lock(&dev->mutex); if (dev->attached && dev->driver == driver) { @@ -834,7 +832,6 @@ int comedi_auto_config(struct device *hardware_device, struct comedi_driver *driver, unsigned long context) { int minor; - struct comedi_device_file_info *dev_file_info; struct comedi_device *comedi_dev; int ret; @@ -852,8 +849,7 @@ int comedi_auto_config(struct device *hardware_device, if (minor < 0) return minor; - dev_file_info = comedi_get_device_file_info(minor); - comedi_dev = dev_file_info->device; + comedi_dev = comedi_dev_from_minor(minor); mutex_lock(&comedi_dev->mutex); if (comedi_dev->attached) diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 0de4d2eb76fc..3a04e3035c21 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -2,7 +2,6 @@ # # Comedi "helper" modules -obj-$(CONFIG_COMEDI) += pcm_common.o # Comedi misc drivers obj-$(CONFIG_COMEDI_BOND) += comedi_bond.o diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 90cc43263aee..1051fa5ce8f7 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -11,13 +11,21 @@ Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. http://www.addi-data.com info@addi-data.com -This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. -This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. -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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +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., +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -You should also find the complete GPL in the COPYING file accompanying this source code. +You should also find the complete GPL in the COPYING file accompanying this +source code. @endverbatim */ @@ -29,10 +37,10 @@ You should also find the complete GPL in the COPYING file accompanying this sour | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : ADDI DATA | Compiler : GCC | + | Project : ADDI DATA | Compiler : GCC | | Modulname : addi_common.c | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : | Date : | + | Author : | Date : | +-----------------------------------------------------------------------+ | Description : ADDI COMMON Main Module | +-----------------------------------------------------------------------+ @@ -167,11 +175,11 @@ static int addi_auto_attach(struct comedi_device *dev, if (this_board->i_PCIEeprom) { if (!(strcmp(this_board->pc_EepromChip, "S5920"))) { /* Set 3 wait stait */ - if (!(strcmp(dev->board_name, "apci035"))) { + if (!(strcmp(dev->board_name, "apci035"))) outl(0x80808082, devpriv->i_IobaseAmcc + 0x60); - } else { + else outl(0x83838383, devpriv->i_IobaseAmcc + 0x60); - } + /* Enable the interrupt for the controller */ dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38); outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38); diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c index 8f8d3e95fc78..31e1259f8822 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2032.c +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c @@ -58,6 +58,13 @@ struct apci2032_private { unsigned int wdog_ctrl; }; +struct apci2032_int_private { + spinlock_t spinlock; + unsigned int stop_count; + bool active; + unsigned char enabled_isns; +}; + static int apci2032_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -159,10 +166,44 @@ static int apci2032_int_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - data[1] = s->state; + data[1] = inl(dev->iobase + APCI2032_INT_STATUS_REG) & 3; return insn->n; } +static void apci2032_int_stop(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct apci2032_int_private *subpriv = s->private; + + subpriv->active = false; + subpriv->enabled_isns = 0; + outl(0x0, dev->iobase + APCI2032_INT_CTRL_REG); +} + +static bool apci2032_int_start(struct comedi_device *dev, + struct comedi_subdevice *s, + unsigned char enabled_isns) +{ + struct apci2032_int_private *subpriv = s->private; + struct comedi_cmd *cmd = &s->async->cmd; + bool do_event; + + subpriv->enabled_isns = enabled_isns; + subpriv->stop_count = cmd->stop_arg; + if (cmd->stop_src == TRIG_COUNT && subpriv->stop_count == 0) { + /* An empty acquisition! */ + s->async->events |= COMEDI_CB_EOA; + subpriv->active = false; + do_event = true; + } else { + subpriv->active = true; + outl(enabled_isns, dev->iobase + APCI2032_INT_CTRL_REG); + do_event = false; + } + + return do_event; +} + static int apci2032_int_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) @@ -172,15 +213,17 @@ static int apci2032_int_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_OTHER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ + err |= cfc_check_trigger_is_unique(cmd->stop_src); + /* Step 2b : and mutually compatible */ if (err) @@ -189,18 +232,11 @@ static int apci2032_int_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - - /* - * 0 == no trigger - * 1 == trigger on VCC interrupt - * 2 == trigger on CC interrupt - * 3 == trigger on either VCC or CC interrupt - */ - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 3); - + err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, 1); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + if (cmd->stop_src == TRIG_NONE) + err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -217,8 +253,22 @@ static int apci2032_int_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; + struct apci2032_int_private *subpriv = s->private; + unsigned char enabled_isns; + unsigned int n; + unsigned long flags; + bool do_event; + + enabled_isns = 0; + for (n = 0; n < cmd->chanlist_len; n++) + enabled_isns |= 1 << CR_CHAN(cmd->chanlist[n]); + + spin_lock_irqsave(&subpriv->spinlock, flags); + do_event = apci2032_int_start(dev, s, enabled_isns); + spin_unlock_irqrestore(&subpriv->spinlock, flags); - outl(cmd->scan_begin_arg, dev->iobase + APCI2032_INT_CTRL_REG); + if (do_event) + comedi_event(dev, s); return 0; } @@ -226,7 +276,13 @@ static int apci2032_int_cmd(struct comedi_device *dev, static int apci2032_int_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { - outl(0x0, dev->iobase + APCI2032_INT_CTRL_REG); + struct apci2032_int_private *subpriv = s->private; + unsigned long flags; + + spin_lock_irqsave(&subpriv->spinlock, flags); + if (subpriv->active) + apci2032_int_stop(dev, s); + spin_unlock_irqrestore(&subpriv->spinlock, flags); return 0; } @@ -235,19 +291,64 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->read_subdev; + struct apci2032_int_private *subpriv; unsigned int val; + bool do_event = false; + + if (!dev->attached) + return IRQ_NONE; /* Check if VCC OR CC interrupt has occurred */ val = inl(dev->iobase + APCI2032_STATUS_REG) & APCI2032_STATUS_IRQ; if (!val) return IRQ_NONE; - s->state = inl(dev->iobase + APCI2032_INT_STATUS_REG); - outl(0x0, dev->iobase + APCI2032_INT_CTRL_REG); + subpriv = s->private; + spin_lock(&subpriv->spinlock); - comedi_buf_put(s->async, s->state); - s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; - comedi_event(dev, s); + val = inl(dev->iobase + APCI2032_INT_STATUS_REG) & 3; + /* Disable triggered interrupt sources. */ + outl(~val & 3, dev->iobase + APCI2032_INT_CTRL_REG); + /* + * Note: We don't reenable the triggered interrupt sources because they + * are level-sensitive, hardware error status interrupt sources and + * they'd keep triggering interrupts repeatedly. + */ + + if (subpriv->active && (val & subpriv->enabled_isns) != 0) { + unsigned short bits; + unsigned int n, len; + unsigned int *chanlist; + + /* Bits in scan data correspond to indices in channel list. */ + bits = 0; + len = s->async->cmd.chanlist_len; + chanlist = &s->async->cmd.chanlist[0]; + for (n = 0; n < len; n++) + if ((val & (1U << CR_CHAN(chanlist[n]))) != 0) + bits |= 1U << n; + + if (comedi_buf_put(s->async, bits)) { + s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; + if (s->async->cmd.stop_src == TRIG_COUNT && + subpriv->stop_count > 0) { + subpriv->stop_count--; + if (subpriv->stop_count == 0) { + /* end of acquisition */ + s->async->events |= COMEDI_CB_EOA; + apci2032_int_stop(dev, s); + } + } + } else { + apci2032_int_stop(dev, s); + s->async->events |= COMEDI_CB_OVERFLOW; + } + do_event = true; + } + + spin_unlock(&subpriv->spinlock); + if (do_event) + comedi_event(dev, s); return IRQ_HANDLED; } @@ -281,6 +382,7 @@ static int apci2032_auto_attach(struct comedi_device *dev, if (ret) return ret; dev->iobase = pci_resource_start(pcidev, 1); + apci2032_reset(dev); if (pcidev->irq > 0) { ret = request_irq(pcidev->irq, apci2032_interrupt, @@ -314,22 +416,28 @@ static int apci2032_auto_attach(struct comedi_device *dev, /* Initialize the interrupt subdevice */ s = &dev->subdevices[2]; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 2; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci2032_int_insn_bits; if (dev->irq) { + struct apci2032_int_private *subpriv; + dev->read_subdev = s; - s->type = COMEDI_SUBD_DI | SDF_CMD_READ; - s->subdev_flags = SDF_READABLE; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci2032_int_insn_bits; + subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL); + if (!subpriv) + return -ENOMEM; + spin_lock_init(&subpriv->spinlock); + s->private = subpriv; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->len_chanlist = 2; s->do_cmdtest = apci2032_int_cmdtest; s->do_cmd = apci2032_int_cmd; s->cancel = apci2032_int_cancel; - } else { - s->type = COMEDI_SUBD_UNUSED; } - apci2032_reset(dev); return 0; } @@ -341,6 +449,8 @@ static void apci2032_detach(struct comedi_device *dev) apci2032_reset(dev); if (dev->irq) free_irq(dev->irq, dev); + if (dev->read_subdev) + kfree(dev->read_subdev->private); if (pcidev) { if (dev->iobase) comedi_pci_disable(pcidev); diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index 01de996239f1..270fea5c6b51 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -62,15 +62,14 @@ zero volts). /* Data unique to this driver */ struct waveform_private { struct timer_list timer; - struct timeval last; /* time at which last timer interrupt occurred */ + struct timeval last; /* time last timer interrupt occurred */ unsigned int uvolt_amplitude; /* waveform amplitude in microvolts */ unsigned long usec_period; /* waveform period in microseconds */ - unsigned long usec_current; /* current time (modulo waveform period) */ - unsigned long usec_remainder; /* usec since last scan; */ - unsigned long ai_count; /* number of conversions remaining */ + unsigned long usec_current; /* current time (mod waveform period) */ + unsigned long usec_remainder; /* usec since last scan */ + unsigned long ai_count; /* number of conversions remaining */ unsigned int scan_period; /* scan period in usec */ unsigned int convert_period; /* conversion period in usec */ - unsigned timer_running:1; unsigned int ao_loopbacks[N_CHANS]; }; @@ -86,8 +85,9 @@ static const struct comedi_lrange waveform_ai_ranges = { } }; -static short fake_sawtooth(struct comedi_device *dev, unsigned int range_index, - unsigned long current_time) +static unsigned short fake_sawtooth(struct comedi_device *dev, + unsigned int range_index, + unsigned long current_time) { struct waveform_private *devpriv = dev->private; struct comedi_subdevice *s = dev->read_subdev; @@ -110,9 +110,9 @@ static short fake_sawtooth(struct comedi_device *dev, unsigned int range_index, return offset + value; } -static short fake_squarewave(struct comedi_device *dev, - unsigned int range_index, - unsigned long current_time) +static unsigned short fake_squarewave(struct comedi_device *dev, + unsigned int range_index, + unsigned long current_time) { struct waveform_private *devpriv = dev->private; struct comedi_subdevice *s = dev->read_subdev; @@ -132,15 +132,17 @@ static short fake_squarewave(struct comedi_device *dev, return offset + value; } -static short fake_flatline(struct comedi_device *dev, unsigned int range_index, - unsigned long current_time) +static unsigned short fake_flatline(struct comedi_device *dev, + unsigned int range_index, + unsigned long current_time) { return dev->read_subdev->maxdata / 2; } /* generates a different waveform depending on what channel is read */ -static short fake_waveform(struct comedi_device *dev, unsigned int channel, - unsigned int range, unsigned long current_time) +static unsigned short fake_waveform(struct comedi_device *dev, + unsigned int channel, unsigned int range, + unsigned long current_time) { enum { SAWTOOTH_CHAN, @@ -176,6 +178,7 @@ static void waveform_ai_interrupt(unsigned long arg) unsigned long elapsed_time; unsigned int num_scans; struct timeval now; + bool stopping = false; do_gettimeofday(&now); @@ -189,37 +192,35 @@ static void waveform_ai_interrupt(unsigned long arg) (devpriv->usec_remainder + elapsed_time) % devpriv->scan_period; async->events = 0; + if (cmd->stop_src == TRIG_COUNT) { + unsigned int remaining = cmd->stop_arg - devpriv->ai_count; + if (num_scans >= remaining) { + /* about to finish */ + num_scans = remaining; + stopping = true; + } + } + for (i = 0; i < num_scans; i++) { for (j = 0; j < cmd->chanlist_len; j++) { - cfc_write_to_buffer(dev->read_subdev, - fake_waveform(dev, - CR_CHAN(cmd-> - chanlist[j]), - CR_RANGE(cmd-> - chanlist[j]), - devpriv-> - usec_current + - i * - devpriv->scan_period + - j * - devpriv-> - convert_period)); - } - devpriv->ai_count++; - if (cmd->stop_src == TRIG_COUNT - && devpriv->ai_count >= cmd->stop_arg) { - async->events |= COMEDI_CB_EOA; - break; + unsigned short sample; + sample = fake_waveform(dev, CR_CHAN(cmd->chanlist[j]), + CR_RANGE(cmd->chanlist[j]), + devpriv->usec_current + + i * devpriv->scan_period + + j * devpriv->convert_period); + cfc_write_to_buffer(dev->read_subdev, sample); } } + devpriv->ai_count += i; devpriv->usec_current += elapsed_time; devpriv->usec_current %= devpriv->usec_period; - if ((async->events & COMEDI_CB_EOA) == 0 && devpriv->timer_running) - mod_timer(&devpriv->timer, jiffies + 1); + if (stopping) + async->events |= COMEDI_CB_EOA; else - del_timer(&devpriv->timer); + mod_timer(&devpriv->timer, jiffies + 1); comedi_event(dev, dev->read_subdev); } @@ -317,7 +318,6 @@ static int waveform_ai_cmd(struct comedi_device *dev, return -1; } - devpriv->timer_running = 1; devpriv->ai_count = 0; devpriv->scan_period = cmd->scan_begin_arg / nano_per_micro; @@ -344,7 +344,6 @@ static int waveform_ai_cancel(struct comedi_device *dev, { struct waveform_private *devpriv = dev->private; - devpriv->timer_running = 0; del_timer_sync(&devpriv->timer); return 0; } diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 56dc59908d36..b7403597e905 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -986,7 +986,7 @@ static void ni_event(struct comedi_device *dev, struct comedi_subdevice *s) if (s-> async->events & (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW | COMEDI_CB_EOA)) { - switch (s - dev->subdevices) { + switch (s->index) { case NI_AI_SUBDEV: ni_ai_reset(dev, s); break; @@ -1086,7 +1086,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status, ("ni_mio_common: a_status=0xffff. Card removed?\n"); /* we probably aren't even running a command now, * so it's a good idea to be careful. */ - if (comedi_get_subdevice_runflags(s) & SRF_RUNNING) { + if (comedi_is_subdevice_running(s)) { s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; ni_event(dev, s); diff --git a/drivers/staging/comedi/drivers/pcm_common.c b/drivers/staging/comedi/drivers/pcm_common.c deleted file mode 100644 index 8a718aea6f3c..000000000000 --- a/drivers/staging/comedi/drivers/pcm_common.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "../comedidev.h" - -#include "comedi_fc.h" -#include "pcm_common.h" - -int comedi_pcm_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) -{ - int err = 0; - - /* Step 1 : check if triggers are trivially valid */ - - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); - - if (err) - return 1; - - /* Step 2a : make sure trigger sources are unique */ - - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); - - /* Step 2b : and mutually compatible */ - - if (err) - return 2; - - /* Step 3: check if arguments are trivially valid */ - - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - - switch (cmd->stop_src) { - case TRIG_COUNT: - /* any count allowed */ - break; - case TRIG_NONE: - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); - break; - default: - break; - } - - if (err) - return 3; - - /* step 4: fix up any arguments */ - - /* if (err) return 4; */ - - return 0; -} -EXPORT_SYMBOL(comedi_pcm_cmdtest); - -MODULE_AUTHOR("Comedi http://www.comedi.org"); -MODULE_DESCRIPTION("Comedi low-level driver"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/comedi/drivers/pcm_common.h b/drivers/staging/comedi/drivers/pcm_common.h deleted file mode 100644 index cd4840c11444..000000000000 --- a/drivers/staging/comedi/drivers/pcm_common.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _comedi_common_H -#define _comedi_common_H - -extern int comedi_pcm_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); - -#endif diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c index 0882dafaf57b..48b049b7d36a 100644 --- a/drivers/staging/comedi/drivers/pcmda12.c +++ b/drivers/staging/comedi/drivers/pcmda12.c @@ -55,7 +55,6 @@ Configuration Options: #include <linux/pci.h> /* for PCI devices */ -#define SDEV_NO ((int)(s - dev->subdevices)) #define CHANS 8 #define IOSIZE 16 #define LSB(x) ((unsigned char)((x) & 0xff)) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 7522bfb6db08..d6d3d9584ea4 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -78,9 +78,10 @@ Configuration Options: #include <linux/interrupt.h> #include <linux/slab.h> +#include <linux/pci.h> + #include "../comedidev.h" -#include "pcm_common.h" -#include <linux/pci.h> /* for PCI devices */ +#include "comedi_fc.h" /* This stuff is all from pcmuio.c -- it refers to the DIO subdevices only */ #define CHANS_PER_PORT 8 @@ -93,7 +94,6 @@ Configuration Options: #define INTR_PORTS_PER_SUBDEV (INTR_CHANS_PER_ASIC/CHANS_PER_PORT) #define MAX_DIO_CHANS (PORTS_PER_ASIC*1*CHANS_PER_PORT) #define MAX_ASICS (MAX_DIO_CHANS/CHANS_PER_ASIC) -#define SDEV_NO ((int)(s - dev->subdevices)) #define CALC_N_DIO_SUBDEVS(nchans) ((nchans)/MAX_CHANS_PER_SUBDEV + (!!((nchans)%MAX_CHANS_PER_SUBDEV)) /*+ (nchans > INTR_CHANS_PER_ASIC ? 2 : 1)*/) /* IO Memory sizes */ #define ASIC_IOSIZE (0x0B) @@ -802,11 +802,59 @@ static int pcmmio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -static int -pcmmio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) +static int pcmmio_cmdtest(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd) { - return comedi_pcm_cmdtest(dev, s, cmd); + int err = 0; + + /* Step 1 : check if triggers are trivially valid */ + + err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + + if (err) + return 1; + + /* Step 2a : make sure trigger sources are unique */ + + err |= cfc_check_trigger_is_unique(cmd->start_src); + err |= cfc_check_trigger_is_unique(cmd->stop_src); + + /* Step 2b : and mutually compatible */ + + if (err) + return 2; + + /* Step 3: check if arguments are trivially valid */ + + err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + + switch (cmd->stop_src) { + case TRIG_COUNT: + /* any count allowed */ + break; + case TRIG_NONE: + err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + break; + default: + break; + } + + if (err) + return 3; + + /* step 4: fix up any arguments */ + + /* if (err) return 4; */ + + return 0; } static int adc_wait_ready(unsigned long iobase) diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 31ea20c2d39e..b74431fba151 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -77,10 +77,10 @@ Configuration Options: #include <linux/interrupt.h> #include <linux/slab.h> -#include "../comedidev.h" -#include "pcm_common.h" +#include <linux/pci.h> -#include <linux/pci.h> /* for PCI devices */ +#include "../comedidev.h" +#include "comedi_fc.h" #define CHANS_PER_PORT 8 #define PORTS_PER_ASIC 6 @@ -92,7 +92,6 @@ Configuration Options: #define INTR_PORTS_PER_SUBDEV (INTR_CHANS_PER_ASIC/CHANS_PER_PORT) #define MAX_DIO_CHANS (PORTS_PER_ASIC*2*CHANS_PER_PORT) #define MAX_ASICS (MAX_DIO_CHANS/CHANS_PER_ASIC) -#define SDEV_NO ((int)(s - dev->subdevices)) #define CALC_N_SUBDEVS(nchans) ((nchans)/MAX_CHANS_PER_SUBDEV + (!!((nchans)%MAX_CHANS_PER_SUBDEV)) /*+ (nchans > INTR_CHANS_PER_ASIC ? 2 : 1)*/) /* IO Memory sizes */ #define ASIC_IOSIZE (0x10) @@ -740,11 +739,59 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -static int -pcmuio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) +static int pcmuio_cmdtest(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd) { - return comedi_pcm_cmdtest(dev, s, cmd); + int err = 0; + + /* Step 1 : check if triggers are trivially valid */ + + err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + + if (err) + return 1; + + /* Step 2a : make sure trigger sources are unique */ + + err |= cfc_check_trigger_is_unique(cmd->start_src); + err |= cfc_check_trigger_is_unique(cmd->stop_src); + + /* Step 2b : and mutually compatible */ + + if (err) + return 2; + + /* Step 3: check if arguments are trivially valid */ + + err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + + switch (cmd->stop_src) { + case TRIG_COUNT: + /* any count allowed */ + break; + case TRIG_NONE: + err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + break; + default: + break; + } + + if (err) + return 3; + + /* step 4: fix up any arguments */ + + /* if (err) return 4; */ + + return 0; } static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c index 4dc09a210883..8932a510d96c 100644 --- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c @@ -42,7 +42,6 @@ MODULE_LICENSE("GPL"); struct comedi_device *comedi_open(const char *filename) { - struct comedi_device_file_info *dev_file_info; struct comedi_device *dev; unsigned int minor; @@ -54,12 +53,9 @@ struct comedi_device *comedi_open(const char *filename) if (minor >= COMEDI_NUM_BOARD_MINORS) return NULL; - dev_file_info = comedi_get_device_file_info(minor); - if (dev_file_info == NULL) - return NULL; - dev = dev_file_info->device; + dev = comedi_dev_from_minor(minor); - if (dev == NULL || !dev->attached) + if (!dev || !dev->attached) return NULL; if (!try_module_get(dev->driver->module)) diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c index 01acbe97653c..362c214bcc0b 100644 --- a/drivers/staging/comedi/proc.c +++ b/drivers/staging/comedi/proc.c @@ -33,7 +33,6 @@ #include <linux/proc_fs.h> #include <linux/string.h> -#ifdef CONFIG_PROC_FS static int comedi_read(char *buf, char **start, off_t offset, int len, int *eof, void *data) { @@ -49,13 +48,10 @@ static int comedi_read(char *buf, char **start, off_t offset, int len, "driver_name, board_name, n_subdevices"); for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { - struct comedi_device_file_info *dev_file_info = - comedi_get_device_file_info(i); - struct comedi_device *dev; + struct comedi_device *dev = comedi_dev_from_minor(i); - if (dev_file_info == NULL) + if (!dev) continue; - dev = dev_file_info->device; if (dev->attached) { devices_q = 1; @@ -95,4 +91,3 @@ void comedi_proc_cleanup(void) { remove_proc_entry("comedi", NULL); } -#endif diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index 2b068197ed44..b1151a28d8e3 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -280,7 +280,7 @@ void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) CSR_SIGNAL *signal; u16 interfaceTag = 0; CSR_MA_PACKET_REQUEST *req; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + netInterface_priv_t *interfacePriv; if (priv == NULL) { return; @@ -294,6 +294,8 @@ void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) return; } + interfacePriv = priv->interfacePriv[interfaceTag]; + /* Initialize bulkdata to avoid os_net_buf is garbage */ memset(&bulkdata, 0, sizeof(bulk_data_param_t)); @@ -1498,7 +1500,7 @@ void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) u8 *daddr, *saddr; u16 interfaceTag = mareq->interfaceTag & 0x00ff; int queue; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; + netInterface_priv_t *interfacePriv; if (!mareq->frame || !priv || !priv->smepriv) { @@ -1510,6 +1512,8 @@ void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) unifi_error(priv, "CsrWifiRouterMaPacketReqHandler: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n"); return; } + + interfacePriv = priv->interfacePriv[interfaceTag]; /* get a pointer to dest & source Mac address */ daddr = mareq->frame; saddr = (mareq->frame + ETH_ALEN); @@ -2056,9 +2060,9 @@ void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) CsrWifiRouterCtrlPeerDelReq* req = (CsrWifiRouterCtrlPeerDelReq*)msg; CsrResult status = CSR_RESULT_SUCCESS; unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + netInterface_priv_t *interfacePriv; - unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerDelReqHandler \n"); + unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerDelReqHandler\n"); if (priv == NULL) { unifi_error(priv, "CsrWifiRouterCtrlPeerDelReqHandler: invalid smepriv\n"); @@ -2071,6 +2075,8 @@ void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) return; } + interfacePriv = priv->interfacePriv[req->interfaceTag]; + switch(interfacePriv->interfaceMode) { case CSR_WIFI_ROUTER_CTRL_MODE_AP: @@ -2471,7 +2477,7 @@ void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv,CsrWifiFsmEvent* msg) CsrResult status = CSR_RESULT_SUCCESS; unifi_priv_t *priv = (unifi_priv_t*)drvpriv; u32 handle = 0; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + netInterface_priv_t *interfacePriv; unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerAddReqHandler \n"); if (priv == NULL) @@ -2486,6 +2492,8 @@ void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv,CsrWifiFsmEvent* msg) return; } + interfacePriv = priv->interfacePriv[req->interfaceTag]; + switch(interfacePriv->interfaceMode) { case CSR_WIFI_ROUTER_CTRL_MODE_AP: @@ -3036,21 +3044,24 @@ void CsrWifiRouterCtrlWapiRxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) ul_client_t *client; CSR_SIGNAL signal; CSR_MA_PACKET_INDICATION *pkt_ind; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; + netInterface_priv_t *interfacePriv; + + if (priv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid priv\n", __func__); + return; + } + + if (priv->smepriv == NULL) { + unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid sme priv\n", __func__); + return; + } + + interfacePriv = priv->interfacePriv[req->interfaceTag]; if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid priv\n",__FUNCTION__); - return; - } - - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid sme priv\n",__FUNCTION__); - return; - } if (req->dataLength == 0 || req->data == NULL) { unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq: invalid request\n",__FUNCTION__); diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c index 7c6c4138fc76..76690374246c 100644 --- a/drivers/staging/csr/unifi_sme.c +++ b/drivers/staging/csr/unifi_sme.c @@ -1196,7 +1196,6 @@ void uf_send_pkt_to_encrypt(struct work_struct *work) if (pktBulkDataLength > 0) { pktBulkData = kmalloc(pktBulkDataLength, GFP_KERNEL); - memset(pktBulkData, 0, pktBulkDataLength); } else { unifi_error(priv, "uf_send_pkt_to_encrypt() : invalid buffer\n"); return; diff --git a/drivers/staging/echo/echo.c b/drivers/staging/echo/echo.c index ca87ce9874b1..5882139d49af 100644 --- a/drivers/staging/echo/echo.c +++ b/drivers/staging/echo/echo.c @@ -119,7 +119,6 @@ static inline void lms_adapt_bg(struct oslec_state *ec, int clean, int shift) { int i; - int j; int offset1; int offset2; int factor; @@ -142,7 +141,7 @@ static inline void lms_adapt_bg(struct oslec_state *ec, int clean, int shift) /* asm("st:"); */ n = ec->taps; - for (i = 0, j = offset2; i < n; i++, j++) { + for (i = 0; i < n; i++) { exp = *phist++ * factor; ec->fir_taps16[1][i] += (int16_t) ((exp + (1 << 14)) >> 15); } @@ -230,6 +229,7 @@ struct oslec_state *oslec_create(int len, int adaption_mode) { struct oslec_state *ec; int i; + const int16_t *history; ec = kzalloc(sizeof(*ec), GFP_KERNEL); if (!ec) @@ -239,15 +239,22 @@ struct oslec_state *oslec_create(int len, int adaption_mode) ec->log2taps = top_bit(len); ec->curr_pos = ec->taps - 1; - for (i = 0; i < 2; i++) { - ec->fir_taps16[i] = - kcalloc(ec->taps, sizeof(int16_t), GFP_KERNEL); - if (!ec->fir_taps16[i]) - goto error_oom; - } + ec->fir_taps16[0] = + kcalloc(ec->taps, sizeof(int16_t), GFP_KERNEL); + if (!ec->fir_taps16[0]) + goto error_oom_0; + + ec->fir_taps16[1] = + kcalloc(ec->taps, sizeof(int16_t), GFP_KERNEL); + if (!ec->fir_taps16[1]) + goto error_oom_1; - fir16_create(&ec->fir_state, ec->fir_taps16[0], ec->taps); - fir16_create(&ec->fir_state_bg, ec->fir_taps16[1], ec->taps); + history = fir16_create(&ec->fir_state, ec->fir_taps16[0], ec->taps); + if (!history) + goto error_state; + history = fir16_create(&ec->fir_state_bg, ec->fir_taps16[1], ec->taps); + if (!history) + goto error_state_bg; for (i = 0; i < 5; i++) ec->xvtx[i] = ec->yvtx[i] = ec->xvrx[i] = ec->yvrx[i] = 0; @@ -257,7 +264,7 @@ struct oslec_state *oslec_create(int len, int adaption_mode) ec->snapshot = kcalloc(ec->taps, sizeof(int16_t), GFP_KERNEL); if (!ec->snapshot) - goto error_oom; + goto error_snap; ec->cond_met = 0; ec->Pstates = 0; @@ -270,10 +277,15 @@ struct oslec_state *oslec_create(int len, int adaption_mode) return ec; -error_oom: - for (i = 0; i < 2; i++) - kfree(ec->fir_taps16[i]); - +error_snap: + fir16_free(&ec->fir_state_bg); +error_state_bg: + fir16_free(&ec->fir_state); +error_state: + kfree(ec->fir_taps16[1]); +error_oom_1: + kfree(ec->fir_taps16[0]); +error_oom_0: kfree(ec); return NULL; } diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 84bbcd48e264..e2d555529c6e 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -344,6 +344,10 @@ struct rx_ring { * 14: UDP checksum assist */ +#define TXDESC_FLAG_LASTPKT 0x0001 +#define TXDESC_FLAG_FIRSTPKT 0x0002 +#define TXDESC_FLAG_INTPROC 0x0004 + /* struct tx_desc represents each descriptor on the ring */ struct tx_desc { u32 addr_hi; @@ -577,7 +581,6 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) return -ETIMEDOUT; } - /** * eeprom_write - Write a byte to the ET1310's EEPROM * @adapter: pointer to our private adapter structure @@ -775,13 +778,12 @@ static int et131x_init_eeprom(struct et131x_adapter *adapter) /* We first need to check the EEPROM Status code located at offset * 0xB2 of config space */ - pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, - &eestatus); + pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, &eestatus); /* THIS IS A WORKAROUND: * I need to call this function twice to get my card in a * LG M1 Express Dual running. I tried also a msleep before this - * function, because I thought there could be some time condidions + * function, because I thought there could be some time conditions * but it didn't work. Call the whole function twice also work. */ if (pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, &eestatus)) { @@ -843,29 +845,29 @@ static int et131x_init_eeprom(struct et131x_adapter *adapter) static void et131x_rx_dma_enable(struct et131x_adapter *adapter) { /* Setup the receive dma configuration register for normal operation */ - u32 csr = 0x2000; /* FBR1 enable */ + u32 csr = ET_RXDMA_CSR_FBR1_ENABLE; if (adapter->rx_ring.fbr[1]->buffsize == 4096) - csr |= 0x0800; + csr |= ET_RXDMA_CSR_FBR1_SIZE_LO; else if (adapter->rx_ring.fbr[1]->buffsize == 8192) - csr |= 0x1000; + csr |= ET_RXDMA_CSR_FBR1_SIZE_HI; else if (adapter->rx_ring.fbr[1]->buffsize == 16384) - csr |= 0x1800; + csr |= ET_RXDMA_CSR_FBR1_SIZE_LO | ET_RXDMA_CSR_FBR1_SIZE_HI; - csr |= 0x0400; /* FBR0 enable */ + csr |= ET_RXDMA_CSR_FBR0_ENABLE; if (adapter->rx_ring.fbr[0]->buffsize == 256) - csr |= 0x0100; + csr |= ET_RXDMA_CSR_FBR0_SIZE_LO; else if (adapter->rx_ring.fbr[0]->buffsize == 512) - csr |= 0x0200; + csr |= ET_RXDMA_CSR_FBR0_SIZE_HI; else if (adapter->rx_ring.fbr[0]->buffsize == 1024) - csr |= 0x0300; + csr |= ET_RXDMA_CSR_FBR0_SIZE_LO | ET_RXDMA_CSR_FBR0_SIZE_HI; writel(csr, &adapter->regs->rxdma.csr); csr = readl(&adapter->regs->rxdma.csr); - if (csr & 0x00020000) { + if (csr & ET_RXDMA_CSR_HALT_STATUS) { udelay(5); csr = readl(&adapter->regs->rxdma.csr); - if (csr & 0x00020000) { + if (csr & ET_RXDMA_CSR_HALT_STATUS) { dev_err(&adapter->pdev->dev, "RX Dma failed to exit halt state. CSR 0x%08x\n", csr); @@ -881,15 +883,16 @@ static void et131x_rx_dma_disable(struct et131x_adapter *adapter) { u32 csr; /* Setup the receive dma configuration register */ - writel(0x00002001, &adapter->regs->rxdma.csr); + writel(ET_RXDMA_CSR_HALT | ET_RXDMA_CSR_FBR1_ENABLE, + &adapter->regs->rxdma.csr); csr = readl(&adapter->regs->rxdma.csr); - if ((csr & 0x00020000) == 0) { /* Check halt status (bit 17) */ + if (!(csr & ET_RXDMA_CSR_HALT_STATUS)) { udelay(5); csr = readl(&adapter->regs->rxdma.csr); - if ((csr & 0x00020000) == 0) + if (!(csr & ET_RXDMA_CSR_HALT_STATUS)) dev_err(&adapter->pdev->dev, - "RX Dma failed to enter halt state. CSR 0x%08x\n", - csr); + "RX Dma failed to enter halt state. CSR 0x%08x\n", + csr); } } @@ -932,7 +935,10 @@ static void et1310_config_mac_regs1(struct et131x_adapter *adapter) /* First we need to reset everything. Write to MAC configuration * register 1 to perform reset. */ - writel(0xC00F0000, ¯egs->cfg1); + writel(ET_MAC_CFG1_SOFT_RESET | ET_MAC_CFG1_SIM_RESET | + ET_MAC_CFG1_RESET_RXMC | ET_MAC_CFG1_RESET_TXMC | + ET_MAC_CFG1_RESET_RXFUNC | ET_MAC_CFG1_RESET_TXFUNC, + ¯egs->cfg1); /* Next lets configure the MAC Inter-packet gap register */ ipg = 0x38005860; /* IPG1 0x38 IPG2 0x58 B2B 0x60 */ @@ -947,7 +953,7 @@ static void et1310_config_mac_regs1(struct et131x_adapter *adapter) writel(0, ¯egs->if_ctrl); /* Let's move on to setting up the mii management configuration */ - writel(0x07, ¯egs->mii_mgmt_cfg); /* Clock reset 0x7 */ + writel(ET_MAC_MIIMGMT_CLK_RST, ¯egs->mii_mgmt_cfg); /* Next lets configure the MAC Station Address register. These * values are read from the EEPROM during initialization and stored @@ -998,38 +1004,43 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) ifctrl = readl(&mac->if_ctrl); /* Set up the if mode bits */ - cfg2 &= ~0x300; + cfg2 &= ~ET_MAC_CFG2_IFMODE_MASK; if (phydev && phydev->speed == SPEED_1000) { - cfg2 |= 0x200; + cfg2 |= ET_MAC_CFG2_IFMODE_1000; /* Phy mode bit */ - ifctrl &= ~(1 << 24); + ifctrl &= ~ET_MAC_IFCTRL_PHYMODE; } else { - cfg2 |= 0x100; - ifctrl |= (1 << 24); + cfg2 |= ET_MAC_CFG2_IFMODE_100; + ifctrl |= ET_MAC_IFCTRL_PHYMODE; } /* We need to enable Rx/Tx */ - cfg1 |= CFG1_RX_ENABLE | CFG1_TX_ENABLE | CFG1_TX_FLOW; + cfg1 |= ET_MAC_CFG1_RX_ENABLE | ET_MAC_CFG1_TX_ENABLE | + ET_MAC_CFG1_TX_FLOW; /* Initialize loop back to off */ - cfg1 &= ~(CFG1_LOOPBACK | CFG1_RX_FLOW); + cfg1 &= ~(ET_MAC_CFG1_LOOPBACK | ET_MAC_CFG1_RX_FLOW); if (adapter->flowcontrol == FLOW_RXONLY || adapter->flowcontrol == FLOW_BOTH) - cfg1 |= CFG1_RX_FLOW; + cfg1 |= ET_MAC_CFG1_RX_FLOW; writel(cfg1, &mac->cfg1); /* Now we need to initialize the MAC Configuration 2 register */ /* preamble 7, check length, huge frame off, pad crc, crc enable full duplex off */ - cfg2 |= 0x7016; - cfg2 &= ~0x0021; + cfg2 |= 0x7 << ET_MAC_CFG2_PREAMBLE_SHIFT; + cfg2 |= ET_MAC_CFG2_IFMODE_LEN_CHECK; + cfg2 |= ET_MAC_CFG2_IFMODE_PAD_CRC; + cfg2 |= ET_MAC_CFG2_IFMODE_CRC_ENABLE; + cfg2 &= ~ET_MAC_CFG2_IFMODE_HUGE_FRAME; + cfg2 &= ~ET_MAC_CFG2_IFMODE_FULL_DPLX; /* Turn on duplex if needed */ if (phydev && phydev->duplex == DUPLEX_FULL) - cfg2 |= 0x01; + cfg2 |= ET_MAC_CFG2_IFMODE_FULL_DPLX; - ifctrl &= ~(1 << 26); + ifctrl &= ~ET_MAC_IFCTRL_GHDMODE; if (phydev && phydev->duplex == DUPLEX_HALF) - ifctrl |= (1<<26); /* Enable ghd */ + ifctrl |= ET_MAC_IFCTRL_GHDMODE; writel(ifctrl, &mac->if_ctrl); writel(cfg2, &mac->cfg2); @@ -1038,7 +1049,7 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) udelay(10); delay++; cfg1 = readl(&mac->cfg1); - } while ((cfg1 & CFG1_WAIT) != CFG1_WAIT && delay < 100); + } while ((cfg1 & ET_MAC_CFG1_WAIT) != ET_MAC_CFG1_WAIT && delay < 100); if (delay == 100) { dev_warn(&adapter->pdev->dev, @@ -1047,7 +1058,7 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) } /* Enable txmac */ - ctl |= 0x09; /* TX mac enable, FC disable */ + ctl |= ET_TX_CTRL_TXMAC_ENABLE | ET_TX_CTRL_FC_DISABLE; writel(ctl, &adapter->regs->txmac.ctl); /* Ready to start the RXDMA/TXDMA engine */ @@ -1139,19 +1150,19 @@ static void et1310_setup_device_for_unicast(struct et131x_adapter *adapter) * Set up unicast packet filter reg 3 to be the octets 2 - 5 of the * MAC address for first address */ - uni_pf3 = (adapter->addr[0] << ET_UNI_PF_ADDR2_1_SHIFT) | - (adapter->addr[1] << ET_UNI_PF_ADDR2_2_SHIFT) | - (adapter->addr[0] << ET_UNI_PF_ADDR1_1_SHIFT) | + uni_pf3 = (adapter->addr[0] << ET_RX_UNI_PF_ADDR2_1_SHIFT) | + (adapter->addr[1] << ET_RX_UNI_PF_ADDR2_2_SHIFT) | + (adapter->addr[0] << ET_RX_UNI_PF_ADDR1_1_SHIFT) | adapter->addr[1]; - uni_pf2 = (adapter->addr[2] << ET_UNI_PF_ADDR2_3_SHIFT) | - (adapter->addr[3] << ET_UNI_PF_ADDR2_4_SHIFT) | - (adapter->addr[4] << ET_UNI_PF_ADDR2_5_SHIFT) | + uni_pf2 = (adapter->addr[2] << ET_RX_UNI_PF_ADDR2_3_SHIFT) | + (adapter->addr[3] << ET_RX_UNI_PF_ADDR2_4_SHIFT) | + (adapter->addr[4] << ET_RX_UNI_PF_ADDR2_5_SHIFT) | adapter->addr[5]; - uni_pf1 = (adapter->addr[2] << ET_UNI_PF_ADDR1_3_SHIFT) | - (adapter->addr[3] << ET_UNI_PF_ADDR1_4_SHIFT) | - (adapter->addr[4] << ET_UNI_PF_ADDR1_5_SHIFT) | + uni_pf1 = (adapter->addr[2] << ET_RX_UNI_PF_ADDR1_3_SHIFT) | + (adapter->addr[3] << ET_RX_UNI_PF_ADDR1_4_SHIFT) | + (adapter->addr[4] << ET_RX_UNI_PF_ADDR1_5_SHIFT) | adapter->addr[5]; pm_csr = readl(&adapter->regs->global.pm_csr); @@ -1208,13 +1219,13 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter) writel(0, &rxmac->mask4_word3); /* Lets setup the WOL Source Address */ - sa_lo = (adapter->addr[2] << ET_WOL_LO_SA3_SHIFT) | - (adapter->addr[3] << ET_WOL_LO_SA4_SHIFT) | - (adapter->addr[4] << ET_WOL_LO_SA5_SHIFT) | + sa_lo = (adapter->addr[2] << ET_RX_WOL_LO_SA3_SHIFT) | + (adapter->addr[3] << ET_RX_WOL_LO_SA4_SHIFT) | + (adapter->addr[4] << ET_RX_WOL_LO_SA5_SHIFT) | adapter->addr[5]; writel(sa_lo, &rxmac->sa_lo); - sa_hi = (u32) (adapter->addr[0] << ET_WOL_HI_SA1_SHIFT) | + sa_hi = (u32) (adapter->addr[0] << ET_RX_WOL_HI_SA1_SHIFT) | adapter->addr[1]; writel(sa_hi, &rxmac->sa_hi); @@ -1224,7 +1235,7 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter) /* Let's initialize the Unicast Packet filtering address */ if (adapter->packet_filter & ET131X_PACKET_TYPE_DIRECTED) { et1310_setup_device_for_unicast(adapter); - pf_ctrl |= 4; /* Unicast filter */ + pf_ctrl |= ET_RX_PFCTRL_UNICST_FILTER_ENABLE; } else { writel(0, &rxmac->uni_pf_addr1); writel(0, &rxmac->uni_pf_addr2); @@ -1233,13 +1244,13 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter) /* Let's initialize the Multicast hash */ if (!(adapter->packet_filter & ET131X_PACKET_TYPE_ALL_MULTICAST)) { - pf_ctrl |= 2; /* Multicast filter */ + pf_ctrl |= ET_RX_PFCTRL_MLTCST_FILTER_ENABLE; et1310_setup_device_for_multicast(adapter); } /* Runt packet filtering. Didn't work in version A silicon. */ - pf_ctrl |= (NIC_MIN_PACKET_SIZE + 4) << 16; - pf_ctrl |= 8; /* Fragment filter */ + pf_ctrl |= (NIC_MIN_PACKET_SIZE + 4) << ET_RX_PFCTRL_MIN_PKT_SZ_SHIFT; + pf_ctrl |= ET_RX_PFCTRL_FRAG_FILTER_ENABLE; if (adapter->registry_jumbo_packet > 8192) /* In order to transmit jumbo packets greater than 8k, the @@ -1290,7 +1301,7 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter) * but we still leave the packet filter on. */ writel(pf_ctrl, &rxmac->pf_ctrl); - writel(0x9, &rxmac->ctrl); + writel(ET_RX_CTRL_RXMAC_ENABLE | ET_RX_CTRL_WOL_DISABLE, &rxmac->ctrl); } static void et1310_config_txmac_regs(struct et131x_adapter *adapter) @@ -1401,7 +1412,7 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, writel(0, &mac->mii_mgmt_cmd); /* Set up the register we need to read from on the correct PHY */ - writel(MII_ADDR(addr, reg), &mac->mii_mgmt_addr); + writel(ET_MAC_MII_ADDR(addr, reg), &mac->mii_mgmt_addr); writel(0x1, &mac->mii_mgmt_cmd); @@ -1409,7 +1420,7 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, udelay(50); delay++; mii_indicator = readl(&mac->mii_mgmt_indicator); - } while ((mii_indicator & MGMT_WAIT) && delay < 50); + } while ((mii_indicator & ET_MAC_MGMT_WAIT) && delay < 50); /* If we hit the max delay, we could not read the register */ if (delay == 50) { @@ -1423,7 +1434,7 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, /* If we hit here we were able to read the register and we need to * return the value to the caller */ - *value = readl(&mac->mii_mgmt_stat) & 0xFFFF; + *value = readl(&mac->mii_mgmt_stat) & ET_MAC_MIIMGMT_STAT_PHYCRTL_MASK; /* Stop the read operation */ writel(0, &mac->mii_mgmt_cmd); @@ -1483,7 +1494,7 @@ static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value) writel(0, &mac->mii_mgmt_cmd); /* Set up the register we need to write to on the correct PHY */ - writel(MII_ADDR(addr, reg), &mac->mii_mgmt_addr); + writel(ET_MAC_MII_ADDR(addr, reg), &mac->mii_mgmt_addr); /* Add the value to write to the registers to the mac */ writel(value, &mac->mii_mgmt_ctrl); @@ -1492,7 +1503,7 @@ static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value) udelay(50); delay++; mii_indicator = readl(&mac->mii_mgmt_indicator); - } while ((mii_indicator & MGMT_BUSY) && delay < 100); + } while ((mii_indicator & ET_MAC_MGMT_BUSY) && delay < 100); /* If we hit the max delay, we could not write the register */ if (delay == 100) { @@ -1528,7 +1539,7 @@ static void et1310_phy_access_mii_bit(struct et131x_adapter *adapter, u8 *value) { u16 reg; - u16 mask = 0x0001 << bitnum; + u16 mask = 1 << bitnum; /* Read the requested register */ et131x_mii_read(adapter, regnum, ®); @@ -1839,7 +1850,7 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) writel(rx_local->psr_num_entries - 1, &rx_dma->psr_num_des); writel(0, &rx_dma->psr_full_offset); - psr_num_des = readl(&rx_dma->psr_num_des) & 0xFFF; + psr_num_des = readl(&rx_dma->psr_num_des) & ET_RXDMA_PSR_NUM_DES_MASK; writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100, &rx_dma->psr_min_des); @@ -1983,13 +1994,21 @@ static void et131x_adapter_setup(struct et131x_adapter *adapter) */ static void et131x_soft_reset(struct et131x_adapter *adapter) { - /* Disable MAC Core */ - writel(0xc00f0000, &adapter->regs->mac.cfg1); + u32 reg; - /* Set everything to a reset value */ - writel(0x7F, &adapter->regs->global.sw_reset); - writel(0x000f0000, &adapter->regs->mac.cfg1); - writel(0x00000000, &adapter->regs->mac.cfg1); + /* Disable MAC Core */ + reg = ET_MAC_CFG1_SOFT_RESET | ET_MAC_CFG1_SIM_RESET | + ET_MAC_CFG1_RESET_RXMC | ET_MAC_CFG1_RESET_TXMC | + ET_MAC_CFG1_RESET_RXFUNC | ET_MAC_CFG1_RESET_TXFUNC; + writel(reg, &adapter->regs->mac.cfg1); + + reg = ET_RESET_ALL; + writel(reg, &adapter->regs->global.sw_reset); + + reg = ET_MAC_CFG1_RESET_RXMC | ET_MAC_CFG1_RESET_TXMC | + ET_MAC_CFG1_RESET_RXFUNC | ET_MAC_CFG1_RESET_TXFUNC; + writel(reg, &adapter->regs->mac.cfg1); + writel(0, &adapter->regs->mac.cfg1); } /** @@ -2032,7 +2051,7 @@ static void et131x_disable_interrupts(struct et131x_adapter *adapter) static void et131x_tx_dma_disable(struct et131x_adapter *adapter) { /* Setup the tramsmit dma configuration register */ - writel(ET_TXDMA_CSR_HALT|ET_TXDMA_SNGL_EPKT, + writel(ET_TXDMA_CSR_HALT | ET_TXDMA_SNGL_EPKT, &adapter->regs->txdma.csr); } @@ -3022,23 +3041,22 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb) if (phydev && phydev->speed == SPEED_1000) { if (++adapter->tx_ring.since_irq == PARM_TX_NUM_BUFS_DEF) { /* Last element & Interrupt flag */ - desc[frag - 1].flags = 0x5; + desc[frag - 1].flags = TXDESC_FLAG_INTPROC | TXDESC_FLAG_LASTPKT; adapter->tx_ring.since_irq = 0; } else { /* Last element */ - desc[frag - 1].flags = 0x1; + desc[frag - 1].flags = TXDESC_FLAG_LASTPKT; } } else - desc[frag - 1].flags = 0x5; + desc[frag - 1].flags = TXDESC_FLAG_INTPROC | TXDESC_FLAG_LASTPKT; - desc[0].flags |= 2; /* First element flag */ + desc[0].flags |= TXDESC_FLAG_FIRSTPKT; tcb->index_start = adapter->tx_ring.send_idx; tcb->stale = 0; spin_lock_irqsave(&adapter->send_hw_lock, flags); - thiscopy = NUM_DESC_PER_RING_TX - - INDEX10(adapter->tx_ring.send_idx); + thiscopy = NUM_DESC_PER_RING_TX - INDEX10(adapter->tx_ring.send_idx); if (thiscopy >= frag) { remainder = 0; diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h index 347e63ddde1f..bbe78a703a23 100644 --- a/drivers/staging/et131x/et131x.h +++ b/drivers/staging/et131x/et131x.h @@ -145,6 +145,8 @@ *31: selfclr_disable */ +#define ET_RESET_ALL 0x007F; + /* * SLV Timer reg at address 0x002C (low 24 bits) */ @@ -317,6 +319,14 @@ struct txdma_regs { /* Location: */ * 18-31: unused */ +#define ET_RXDMA_CSR_HALT 0x0001 +#define ET_RXDMA_CSR_FBR0_SIZE_LO 0x0100 +#define ET_RXDMA_CSR_FBR0_SIZE_HI 0x0200 +#define ET_RXDMA_CSR_FBR0_ENABLE 0x0400 +#define ET_RXDMA_CSR_FBR1_SIZE_LO 0x0800 +#define ET_RXDMA_CSR_FBR1_SIZE_HI 0x1000 +#define ET_RXDMA_CSR_FBR1_ENABLE 0x2000 +#define ET_RXDMA_CSR_HALT_STATUS 0x00020000 /* * structure for dma writeback lo reg in rxdma address map @@ -384,6 +394,8 @@ struct txdma_regs { /* Location: */ * 11-0: psr ndes */ +#define ET_RXDMA_PSR_NUM_DES_MASK 0xFFF; + /* * structure for packet status ring available offset reg in rxdma address map * located at address 0x202C @@ -559,6 +571,9 @@ struct rxdma_regs { /* Location: */ * 0: txmac_en */ +#define ET_TX_CTRL_FC_DISABLE 0x0008 +#define ET_TX_CTRL_TXMAC_ENABLE 0x0001 + /* * structure for shadow pointer reg in txmac address map * located at address 0x3004 @@ -674,6 +689,9 @@ struct txmac_regs { /* Location: */ * 0: rxmac_en */ +#define ET_RX_CTRL_WOL_DISABLE 0x0008 +#define ET_RX_CTRL_RXMAC_ENABLE 0x0001 + /* * structure for Wake On Lan Control and CRC 0 reg in rxmac address map * located at address 0x4004 @@ -715,9 +733,9 @@ struct txmac_regs { /* Location: */ * 7-0: sa6 */ -#define ET_WOL_LO_SA3_SHIFT 24 -#define ET_WOL_LO_SA4_SHIFT 16 -#define ET_WOL_LO_SA5_SHIFT 8 +#define ET_RX_WOL_LO_SA3_SHIFT 24 +#define ET_RX_WOL_LO_SA4_SHIFT 16 +#define ET_RX_WOL_LO_SA5_SHIFT 8 /* * structure for Wake On Lan Source Address Hi reg in rxmac address map @@ -728,7 +746,7 @@ struct txmac_regs { /* Location: */ * 7-0: sa2 */ -#define ET_WOL_HI_SA1_SHIFT 8 +#define ET_RX_WOL_HI_SA1_SHIFT 8 /* * structure for Wake On Lan mask reg in rxmac address map @@ -746,9 +764,9 @@ struct txmac_regs { /* Location: */ * 7-0: addr1_6 */ -#define ET_UNI_PF_ADDR1_3_SHIFT 24 -#define ET_UNI_PF_ADDR1_4_SHIFT 16 -#define ET_UNI_PF_ADDR1_5_SHIFT 8 +#define ET_RX_UNI_PF_ADDR1_3_SHIFT 24 +#define ET_RX_UNI_PF_ADDR1_4_SHIFT 16 +#define ET_RX_UNI_PF_ADDR1_5_SHIFT 8 /* * structure for Unicast Paket Filter Address 2 reg in rxmac address map @@ -760,9 +778,9 @@ struct txmac_regs { /* Location: */ * 7-0: addr2_6 */ -#define ET_UNI_PF_ADDR2_3_SHIFT 24 -#define ET_UNI_PF_ADDR2_4_SHIFT 16 -#define ET_UNI_PF_ADDR2_5_SHIFT 8 +#define ET_RX_UNI_PF_ADDR2_3_SHIFT 24 +#define ET_RX_UNI_PF_ADDR2_4_SHIFT 16 +#define ET_RX_UNI_PF_ADDR2_5_SHIFT 8 /* * structure for Unicast Paket Filter Address 1 & 2 reg in rxmac address map @@ -774,10 +792,9 @@ struct txmac_regs { /* Location: */ * 7-0: addr1_2 */ -#define ET_UNI_PF_ADDR2_1_SHIFT 24 -#define ET_UNI_PF_ADDR2_2_SHIFT 16 -#define ET_UNI_PF_ADDR1_1_SHIFT 8 - +#define ET_RX_UNI_PF_ADDR2_1_SHIFT 24 +#define ET_RX_UNI_PF_ADDR2_2_SHIFT 16 +#define ET_RX_UNI_PF_ADDR1_1_SHIFT 8 /* * structure for Multicast Hash reg in rxmac address map @@ -798,6 +815,12 @@ struct txmac_regs { /* Location: */ * 0: filter_broad_en */ +#define ET_RX_PFCTRL_MIN_PKT_SZ_SHIFT 16; +#define ET_RX_PFCTRL_FRAG_FILTER_ENABLE 0x0008; +#define ET_RX_PFCTRL_UNICST_FILTER_ENABLE 0x0004; +#define ET_RX_PFCTRL_MLTCST_FILTER_ENABLE 0x0002; +#define ET_RX_PFCTRL_BRDCST_FILTER_ENABLE 0x0001; + /* * structure for Memory Controller Interface Control Max Segment reg in rxmac * address map. Located at address 0x4088 @@ -808,6 +831,10 @@ struct txmac_regs { /* Location: */ * 0: seg_en */ +#define ET_RX_MCIF_CTRL_MAX_SEG_SIZE_SHIFT 2; +#define ET_RX_MCIF_CTRL_MAX_SEG_FC_ENABLE 0x0002; +#define ET_RX_MCIF_CTRL_MAX_SEG_ENABLE 0x0001; + /* * structure for Memory Controller Interface Water Mark reg in rxmac address * map. Located at address 0x408C @@ -907,7 +934,6 @@ struct rxmac_regs { /* Location: */ /* END OF RXMAC REGISTER ADDRESS MAP */ - /* START OF MAC REGISTER ADDRESS MAP */ /* @@ -932,12 +958,18 @@ struct rxmac_regs { /* Location: */ * 0: tx enable */ -#define CFG1_LOOPBACK 0x00000100 -#define CFG1_RX_FLOW 0x00000020 -#define CFG1_TX_FLOW 0x00000010 -#define CFG1_RX_ENABLE 0x00000004 -#define CFG1_TX_ENABLE 0x00000001 -#define CFG1_WAIT 0x0000000A /* RX & TX syncd */ +#define ET_MAC_CFG1_SOFT_RESET 0x80000000 +#define ET_MAC_CFG1_SIM_RESET 0x40000000 +#define ET_MAC_CFG1_RESET_RXMC 0x00080000 +#define ET_MAC_CFG1_RESET_TXMC 0x00040000 +#define ET_MAC_CFG1_RESET_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RESET_TXFUNC 0x00010000 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RX_FLOW 0x00000020 +#define ET_MAC_CFG1_TX_FLOW 0x00000010 +#define ET_MAC_CFG1_RX_ENABLE 0x00000004 +#define ET_MAC_CFG1_TX_ENABLE 0x00000001 +#define ET_MAC_CFG1_WAIT 0x0000000A /* RX & TX syncd */ /* * structure for configuration #2 reg in mac address map. @@ -955,6 +987,15 @@ struct rxmac_regs { /* Location: */ * 0: full duplex */ +#define ET_MAC_CFG2_PREAMBLE_SHIFT 12; +#define ET_MAC_CFG2_IFMODE_MASK 0x0300; +#define ET_MAC_CFG2_IFMODE_1000 0x0200; +#define ET_MAC_CFG2_IFMODE_100 0x0100; +#define ET_MAC_CFG2_IFMODE_HUGE_FRAME 0x0020; +#define ET_MAC_CFG2_IFMODE_LEN_CHECK 0x0010; +#define ET_MAC_CFG2_IFMODE_PAD_CRC 0x0004; +#define ET_MAC_CFG2_IFMODE_CRC_ENABLE 0x0002; +#define ET_MAC_CFG2_IFMODE_FULL_DPLX 0x0001; /* * structure for Interpacket gap reg in mac address map. @@ -1009,6 +1050,8 @@ struct rxmac_regs { /* Location: */ * 2-0: mgmt clock reset */ +#define ET_MAC_MIIMGMT_CLK_RST 0x0007 + /* * structure for MII Management Command reg in mac address map. * located at address 0x5024 @@ -1025,7 +1068,7 @@ struct rxmac_regs { /* Location: */ * 4-0: register */ -#define MII_ADDR(phy, reg) ((phy) << 8 | (reg)) +#define ET_MAC_MII_ADDR(phy, reg) ((phy) << 8 | (reg)) /* * structure for MII Management Control reg in mac address map. @@ -1041,6 +1084,8 @@ struct rxmac_regs { /* Location: */ * 15-0: phy control */ +#define ET_MAC_MIIMGMT_STAT_PHYCRTL_MASK 0xFFFF; + /* * structure for MII Management Indicators reg in mac address map. * located at address 0x5034 @@ -1050,8 +1095,8 @@ struct rxmac_regs { /* Location: */ * 0: busy */ -#define MGMT_BUSY 0x00000001 /* busy */ -#define MGMT_WAIT 0x00000005 /* busy | not valid */ +#define ET_MAC_MGMT_BUSY 0x00000001 /* busy */ +#define ET_MAC_MGMT_WAIT 0x00000005 /* busy | not valid */ /* * structure for Interface Control reg in mac address map. @@ -1076,6 +1121,9 @@ struct rxmac_regs { /* Location: */ * 0: enable jabber protection */ +#define ET_MAC_IFCTRL_GHDMODE (1 << 26) +#define ET_MAC_IFCTRL_PHYMODE (1 << 24) + /* * structure for Interface Status reg in mac address map. * located at address 0x503C diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h index adb436ed2511..65f7ab6cb467 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h @@ -31,41 +31,10 @@ #define SUCCESS 0x00 #define FAILURE 0x01 -struct ft1000_info { - struct net_device_stats stats; - u16 DrvErrNum; - u16 AsicID; +struct ft1000_pcmcia { int PktIntfErr; - int CardReady; - int registered; - int mediastate; u16 packetseqnum; - u8 squeseqnum; /* sequence number on slow queue */ - spinlock_t dpram_lock; - u16 fifo_cnt; - u8 DspVer[DSPVERSZ]; /* DSP version number */ - u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */ - u8 Sku[SKUSZ]; /* SKU */ - u8 eui64[EUISZ]; /* EUI64 */ - time_t ConTm; /* Connection Time */ - u16 LedStat; - u16 ConStat; - u16 ProgConStat; - u8 ProductMode[MODESZ]; - u8 RfCalVer[CALVERSZ]; - u8 RfCalDate[CALDATESZ]; - u16 DSP_TIME[4]; - struct list_head prov_list; - u16 DSPInfoBlklen; - int (*ft1000_reset)(void *); void *link; - u16 DSPInfoBlk[MAX_DSP_SESS_REC]; - union { - u16 Rec[MAX_DSP_SESS_REC]; - u32 MagRec[MAX_DSP_SESS_REC/2]; - } DSPSess; - struct proc_dir_entry *proc_ft1000; - char netdevname[IFNAMSIZ]; }; struct pcmcia_device; diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 86a680c09ba2..3fd499f09bca 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -328,11 +328,12 @@ static void ft1000_disable_interrupts(struct net_device *dev) static void ft1000_reset_asic(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); + struct ft1000_pcmcia *pcmcia = info->priv; u16 tempword; DEBUG(1, "ft1000_hw:ft1000_reset_asic called\n"); - (*info->ft1000_reset) (info->link); + (*info->ft1000_reset) (pcmcia->link); // Let's use the register provided by the Magnemite ASIC to reset the // ASIC and DSP. @@ -1397,12 +1398,13 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) { struct ft1000_info *info = netdev_priv(dev); + struct ft1000_pcmcia *pcmcia = info->priv; u16 i; u32 templong; u16 tempword; DEBUG(1, "ft1000:ft1000_hw:ft1000_flush_fifo called\n"); - if (info->PktIntfErr > MAX_PH_ERR) { + if (pcmcia->PktIntfErr > MAX_PH_ERR) { if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = ft1000_read_dpram(dev, FT1000_DSP_TIMER0); @@ -1491,7 +1493,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) FIFO_FLUSH_BADCNT; } else { // Let's assume that we really flush the FIFO - info->PktIntfErr++; + pcmcia->PktIntfErr++; return; } } else { @@ -1522,7 +1524,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) DEBUG(0, "FT1000_REG_MAG_DFSR = 0x%x\n", tempword); } if (DrvErrNum) { - info->PktIntfErr++; + pcmcia->PktIntfErr++; } } } @@ -1731,6 +1733,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) { struct ft1000_info *info = netdev_priv(dev); + struct ft1000_pcmcia *pcmcia = info->priv; union { struct pseudo_hdr blk; u16 buff[sizeof(struct pseudo_hdr) >> 1]; @@ -1780,7 +1783,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) pseudo.blk.control = 0; pseudo.blk.rsvd1 = 0; pseudo.blk.seq_num = 0; - pseudo.blk.rsvd2 = info->packetseqnum++; + pseudo.blk.rsvd2 = pcmcia->packetseqnum++; pseudo.blk.qos_class = 0; /* Calculate pseudo header checksum */ pseudo.blk.checksum = pseudo.buff[0]; @@ -2058,6 +2061,8 @@ void stop_ft1000_card(struct net_device *dev) kfree(ptr); } + kfree(info->priv); + if (info->registered) { unregister_netdev(dev); info->registered = 0; @@ -2100,6 +2105,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, void *ft1000_reset) { struct ft1000_info *info; + struct ft1000_pcmcia *pcmcia; struct net_device *dev; static const struct net_device_ops ft1000ops = // Slavius 21.10.2009 due to kernel changes @@ -2141,10 +2147,13 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, memset(&info->stats, 0, sizeof(struct net_device_stats)); + info->priv = kzalloc(sizeof(struct ft1000_pcmcia), GFP_KERNEL); + pcmcia = info->priv; + pcmcia->link = link; + spin_lock_init(&info->dpram_lock); info->DrvErrNum = 0; info->registered = 1; - info->link = link; info->ft1000_reset = ft1000_reset; info->mediastate = 0; info->fifo_cnt = 0; diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c index 72727c6b9e2e..5337b415d450 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c @@ -175,8 +175,8 @@ static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, switch (event) { case NETDEV_CHANGENAME: - remove_proc_entry(info->netdevname, info->proc_ft1000); - create_proc_read_entry(dev->name, 0644, info->proc_ft1000, + remove_proc_entry(info->netdevname, info->ft1000_proc_dir); + create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir, ft1000ReadProc, dev); snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); break; @@ -194,8 +194,8 @@ void ft1000InitProc(struct net_device *dev) info = netdev_priv(dev); - info->proc_ft1000 = proc_mkdir(FT1000_PROC, init_net.proc_net); - create_proc_read_entry(dev->name, 0644, info->proc_ft1000, + info->ft1000_proc_dir = proc_mkdir(FT1000_PROC, init_net.proc_net); + create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir, ft1000ReadProc, dev); snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); register_netdevice_notifier(&ft1000_netdev_notifier); @@ -207,7 +207,7 @@ void ft1000CleanupProc(struct net_device *dev) info = netdev_priv(dev); - remove_proc_entry(dev->name, info->proc_ft1000); + remove_proc_entry(dev->name, info->ft1000_proc_dir); remove_proc_entry(FT1000_PROC, init_net.proc_net); unregister_netdevice_notifier(&ft1000_netdev_notifier); } diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index 6d911fda47fb..297389e8c608 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -137,29 +137,28 @@ void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist) // Notes: Only called by init_module(). // //--------------------------------------------------------------------------- -int ft1000_create_dev(struct ft1000_device *dev) +int ft1000_create_dev(struct ft1000_usb *dev) { - struct ft1000_info *info = netdev_priv(dev->net); int result; int i; struct dentry *dir, *file; struct ft1000_debug_dirs *tmp; // make a new device name - sprintf(info->DeviceName, "%s%d", "FT1000_", info->CardNumber); + sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber); DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt); - DEBUG("DeviceCreated = %x\n", info->DeviceCreated); + DEBUG("DeviceCreated = %x\n", dev->DeviceCreated); - if (info->DeviceCreated) + if (dev->DeviceCreated) { - DEBUG("%s: \"%s\" already registered\n", __func__, info->DeviceName); + DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName); return -EIO; } // register the device - DEBUG("%s: \"%s\" debugfs device registration\n", __func__, info->DeviceName); + DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName); tmp = kmalloc(sizeof(struct ft1000_debug_dirs), GFP_KERNEL); if (tmp == NULL) { @@ -167,7 +166,7 @@ int ft1000_create_dev(struct ft1000_device *dev) goto fail; } - dir = debugfs_create_dir(info->DeviceName, NULL); + dir = debugfs_create_dir(dev->DeviceName, NULL); if (IS_ERR(dir)) { result = PTR_ERR(dir); goto debug_dir_fail; @@ -182,27 +181,27 @@ int ft1000_create_dev(struct ft1000_device *dev) tmp->dent = dir; tmp->file = file; - tmp->int_number = info->CardNumber; - list_add(&(tmp->list), &(info->nodes.list)); + tmp->int_number = dev->CardNumber; + list_add(&(tmp->list), &(dev->nodes.list)); - DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, info->DeviceName); + DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName); // initialize application information - info->appcnt = 0; + dev->appcnt = 0; for (i=0; i<MAX_NUM_APP; i++) { - info->app_info[i].nTxMsg = 0; - info->app_info[i].nRxMsg = 0; - info->app_info[i].nTxMsgReject = 0; - info->app_info[i].nRxMsgMiss = 0; - info->app_info[i].fileobject = NULL; - info->app_info[i].app_id = i+1; - info->app_info[i].DspBCMsgFlag = 0; - info->app_info[i].NumOfMsg = 0; - init_waitqueue_head(&info->app_info[i].wait_dpram_msg); - INIT_LIST_HEAD (&info->app_info[i].app_sqlist); + dev->app_info[i].nTxMsg = 0; + dev->app_info[i].nRxMsg = 0; + dev->app_info[i].nTxMsgReject = 0; + dev->app_info[i].nRxMsgMiss = 0; + dev->app_info[i].fileobject = NULL; + dev->app_info[i].app_id = i+1; + dev->app_info[i].DspBCMsgFlag = 0; + dev->app_info[i].NumOfMsg = 0; + init_waitqueue_head(&dev->app_info[i].wait_dpram_msg); + INIT_LIST_HEAD (&dev->app_info[i].app_sqlist); } - info->DeviceCreated = TRUE; + dev->DeviceCreated = TRUE; ft1000_flarion_cnt++; return 0; @@ -225,9 +224,10 @@ fail: // Notes: Only called by cleanup_module(). // //--------------------------------------------------------------------------- -void ft1000_destroy_dev(struct net_device *dev) +void ft1000_destroy_dev(struct net_device *netdev) { - struct ft1000_info *info = netdev_priv(dev); + struct ft1000_info *info = netdev_priv(netdev); + struct ft1000_usb *dev = info->priv; int i; struct dpram_blk *pdpram_blk; struct dpram_blk *ptr; @@ -238,12 +238,12 @@ void ft1000_destroy_dev(struct net_device *dev) - if (info->DeviceCreated) + if (dev->DeviceCreated) { ft1000_flarion_cnt--; - list_for_each_safe(pos, q, &info->nodes.list) { + list_for_each_safe(pos, q, &dev->nodes.list) { dir = list_entry(pos, struct ft1000_debug_dirs, list); - if (dir->int_number == info->CardNumber) { + if (dir->int_number == dev->CardNumber) { debugfs_remove(dir->file); debugfs_remove(dir->dent); list_del(pos); @@ -251,17 +251,17 @@ void ft1000_destroy_dev(struct net_device *dev) } } DEBUG("%s: unregistered device \"%s\"\n", __func__, - info->DeviceName); + dev->DeviceName); // Make sure we free any memory reserve for slow Queue for (i=0; i<MAX_NUM_APP; i++) { - while (list_empty(&info->app_info[i].app_sqlist) == 0) { - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list); + while (list_empty(&dev->app_info[i].app_sqlist) == 0) { + pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list); list_del(&pdpram_blk->list); ft1000_free_buffer(pdpram_blk, &freercvpool); } - wake_up_interruptible(&info->app_info[i].wait_dpram_msg); + wake_up_interruptible(&dev->app_info[i].wait_dpram_msg); } // Remove buffer allocated for receive command data @@ -273,7 +273,7 @@ void ft1000_destroy_dev(struct net_device *dev) kfree(ptr); } } - info->DeviceCreated = FALSE; + dev->DeviceCreated = FALSE; } @@ -292,7 +292,7 @@ void ft1000_destroy_dev(struct net_device *dev) static int ft1000_open (struct inode *inode, struct file *file) { struct ft1000_info *info; - struct ft1000_device *dev = (struct ft1000_device *)inode->i_private; + struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private; int i,num; DEBUG("%s called\n", __func__); @@ -301,17 +301,17 @@ static int ft1000_open (struct inode *inode, struct file *file) info = file->private_data = netdev_priv(dev->net); - DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), info->appcnt ); + DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt ); // Check if maximum number of application exceeded - if (info->appcnt > MAX_NUM_APP) { + if (dev->appcnt > MAX_NUM_APP) { DEBUG("Maximum number of application exceeded\n"); return -EACCES; } // Search for available application info block for (i=0; i<MAX_NUM_APP; i++) { - if ( (info->app_info[i].fileobject == NULL) ) { + if ( (dev->app_info[i].fileobject == NULL) ) { break; } } @@ -322,12 +322,12 @@ static int ft1000_open (struct inode *inode, struct file *file) return -EACCES; } - info->appcnt++; - info->app_info[i].fileobject = &file->f_owner; - info->app_info[i].nTxMsg = 0; - info->app_info[i].nRxMsg = 0; - info->app_info[i].nTxMsgReject = 0; - info->app_info[i].nRxMsgMiss = 0; + dev->appcnt++; + dev->app_info[i].fileobject = &file->f_owner; + dev->app_info[i].nTxMsg = 0; + dev->app_info[i].nRxMsg = 0; + dev->app_info[i].nTxMsgReject = 0; + dev->app_info[i].nRxMsgMiss = 0; nonseekable_open(inode, file); return 0; @@ -347,8 +347,9 @@ static int ft1000_open (struct inode *inode, struct file *file) static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait) { - struct net_device *dev = file->private_data; - struct ft1000_info *info; + struct net_device *netdev = file->private_data; + struct ft1000_info *info = netdev_priv(netdev); + struct ft1000_usb *dev = info->priv; int i; //DEBUG("ft1000_poll_dev called\n"); @@ -357,12 +358,10 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait) return (-EBADF); } - info = netdev_priv(dev); - // Search for matching file object for (i=0; i<MAX_NUM_APP; i++) { - if ( info->app_info[i].fileobject == &file->f_owner) { - //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", info->app_info[i].app_id); + if ( dev->app_info[i].fileobject == &file->f_owner) { + //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); break; } } @@ -373,12 +372,12 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait) return ( -EACCES ); } - if (list_empty(&info->app_info[i].app_sqlist) == 0) { + if (list_empty(&dev->app_info[i].app_sqlist) == 0) { DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n"); return(POLLIN | POLLRDNORM | POLLPRI); } - poll_wait (file, &info->app_info[i].wait_dpram_msg, wait); + poll_wait (file, &dev->app_info[i].wait_dpram_msg, wait); //DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); return (0); @@ -399,7 +398,7 @@ static long ft1000_ioctl (struct file *file, unsigned int command, { void __user *argp = (void __user *)argument; struct ft1000_info *info; - struct ft1000_device *ft1000dev; + struct ft1000_usb *ft1000dev; int result=0; int cmd; int i; @@ -428,7 +427,7 @@ static long ft1000_ioctl (struct file *file, unsigned int command, //DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument); info = file->private_data; - ft1000dev = info->pFt1000Dev; + ft1000dev = info->priv; cmd = _IOC_NR(command); //DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd); @@ -444,8 +443,8 @@ static long ft1000_ioctl (struct file *file, unsigned int command, if (tempword == DSPBCMSGID) { // Search for matching file object for (i=0; i<MAX_NUM_APP; i++) { - if ( info->app_info[i].fileobject == &file->f_owner) { - info->app_info[i].DspBCMsgFlag = 1; + if (ft1000dev->app_info[i].fileobject == &file->f_owner) { + ft1000dev->app_info[i].DspBCMsgFlag = 1; DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n"); break; } @@ -534,15 +533,15 @@ static long ft1000_ioctl (struct file *file, unsigned int command, return (-EBADF); } - if (info->DrvMsgPend) { + if (ft1000dev->DrvMsgPend) { return (-ENOTTY); } - if ( (info->DspAsicReset) || (info->fProvComplete == 0) ) { + if (ft1000dev->fProvComplete == 0) { return (-EACCES); } - info->fAppMsgPend = 1; + ft1000dev->fAppMsgPend = 1; if (info->CardReady) { @@ -571,7 +570,7 @@ static long ft1000_ioctl (struct file *file, unsigned int command, else { // Check if this message came from a registered application for (i=0; i<MAX_NUM_APP; i++) { - if ( info->app_info[i].fileobject == &file->f_owner) { + if (ft1000dev->app_info[i].fileobject == &file->f_owner) { break; } } @@ -632,7 +631,7 @@ static long ft1000_ioctl (struct file *file, unsigned int command, // Insert slow queue sequence number ppseudo_hdr->seq_num = info->squeseqnum++; - ppseudo_hdr->portsrc = info->app_info[app_index].app_id; + ppseudo_hdr->portsrc = ft1000dev->app_info[app_index].app_id; // Calculate new checksum ppseudo_hdr->checksum = *pmsg++; //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); @@ -645,7 +644,7 @@ static long ft1000_ioctl (struct file *file, unsigned int command, card_send_command(ft1000dev,(unsigned short*)dpram_data,total_len+2); - info->app_info[app_index].nTxMsg++; + ft1000dev->app_info[app_index].nTxMsg++; } else { result = -EINVAL; @@ -675,8 +674,8 @@ static long ft1000_ioctl (struct file *file, unsigned int command, // Search for matching file object for (i=0; i<MAX_NUM_APP; i++) { - if ( info->app_info[i].fileobject == &file->f_owner) { - //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", info->app_info[i].app_id); + if (ft1000dev->app_info[i].fileobject == &file->f_owner) { + //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); break; } } @@ -690,13 +689,13 @@ static long ft1000_ioctl (struct file *file, unsigned int command, result = 0; pioctl_dpram = argp; - if (list_empty(&info->app_info[i].app_sqlist) == 0) { + if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) { //DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n"); spin_lock_irqsave(&free_buff_lock, flags); - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list); + pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list); list_del(&pdpram_blk->list); - info->app_info[i].NumOfMsg--; - //DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, info->app_info[i].NumOfMsg); + ft1000dev->app_info[i].NumOfMsg--; + //DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); spin_unlock_irqrestore(&free_buff_lock, flags); msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ; result = get_user(msglen, &pioctl_dpram->total_len); @@ -723,7 +722,7 @@ static long ft1000_ioctl (struct file *file, unsigned int command, result = -ENOTTY; break; } - info->fAppMsgPend = 0; + ft1000dev->fAppMsgPend = 0; return result; } @@ -741,6 +740,7 @@ static int ft1000_release (struct inode *inode, struct file *file) { struct ft1000_info *info; struct net_device *dev; + struct ft1000_usb *ft1000dev; int i; struct dpram_blk *pdpram_blk; @@ -748,16 +748,17 @@ static int ft1000_release (struct inode *inode, struct file *file) dev = file->private_data; info = netdev_priv(dev); + ft1000dev = info->priv; if (ft1000_flarion_cnt == 0) { - info->appcnt--; + ft1000dev->appcnt--; return (-EBADF); } // Search for matching file object for (i=0; i<MAX_NUM_APP; i++) { - if ( info->app_info[i].fileobject == &file->f_owner) { - //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", info->app_info[i].app_id); + if ( ft1000dev->app_info[i].fileobject == &file->f_owner) { + //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); break; } } @@ -765,17 +766,17 @@ static int ft1000_release (struct inode *inode, struct file *file) if (i==MAX_NUM_APP) return 0; - while (list_empty(&info->app_info[i].app_sqlist) == 0) { + while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) { DEBUG("Remove and free memory queue up on slow queue\n"); - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list); + pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list); list_del(&pdpram_blk->list); ft1000_free_buffer(pdpram_blk, &freercvpool); } // initialize application information - info->appcnt--; - DEBUG("ft1000_chdev:%s:appcnt = %d\n", __FUNCTION__, info->appcnt); - info->app_info[i].fileobject = NULL; + ft1000dev->appcnt--; + DEBUG("ft1000_chdev:%s:appcnt = %d\n", __FUNCTION__, ft1000dev->appcnt); + ft1000dev->app_info[i].fileobject = NULL; return 0; } diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index 1972b72450d4..5190c8ac4e0a 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -114,7 +114,7 @@ struct dsp_image_info { //--------------------------------------------------------------------------- // Function: check_usb_db // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // // Returns: 0 - success // @@ -123,7 +123,7 @@ struct dsp_image_info { // Notes: // //--------------------------------------------------------------------------- -static u32 check_usb_db (struct ft1000_device *ft1000dev) +static u32 check_usb_db (struct ft1000_usb *ft1000dev) { int loopcnt; u16 temp; @@ -172,7 +172,7 @@ static u32 check_usb_db (struct ft1000_device *ft1000dev) //--------------------------------------------------------------------------- // Function: get_handshake // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // u16 expected_value - the handshake value expected // // Returns: handshakevalue - success @@ -183,12 +183,11 @@ static u32 check_usb_db (struct ft1000_device *ft1000dev) // Notes: // //--------------------------------------------------------------------------- -static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value) +static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value) { u16 handshake; int loopcnt; u32 status = 0; - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net); loopcnt = 0; @@ -196,10 +195,10 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value) /* Need to clear downloader doorbell if Hartley ASIC */ status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL); - if (pft1000info->fcodeldr) { + if (ft1000dev->fcodeldr) { DEBUG(" get_handshake: fcodeldr is %d\n", - pft1000info->fcodeldr); - pft1000info->fcodeldr = 0; + ft1000dev->fcodeldr); + ft1000dev->fcodeldr = 0; status = check_usb_db(ft1000dev); if (status != STATUS_SUCCESS) { DEBUG("get_handshake: check_usb_db failed\n"); @@ -233,7 +232,7 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value) //--------------------------------------------------------------------------- // Function: put_handshake // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // u16 handshake_value - handshake to be written // // Returns: none @@ -244,7 +243,7 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value) // Notes: // //--------------------------------------------------------------------------- -static void put_handshake(struct ft1000_device *ft1000dev,u16 handshake_value) +static void put_handshake(struct ft1000_usb *ft1000dev,u16 handshake_value) { u32 tempx; u16 tempword; @@ -263,36 +262,35 @@ static void put_handshake(struct ft1000_device *ft1000dev,u16 handshake_value) FT1000_REG_DOORBELL); } -static u16 get_handshake_usb(struct ft1000_device *ft1000dev, u16 expected_value) +static u16 get_handshake_usb(struct ft1000_usb *ft1000dev, u16 expected_value) { u16 handshake; int loopcnt; u16 temp; u32 status = 0; - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net); loopcnt = 0; handshake = 0; while (loopcnt < 100) { - if (pft1000info->usbboot == 2) { + if (ft1000dev->usbboot == 2) { status = ft1000_read_dpram32(ft1000dev, 0, - (u8 *)&(pft1000info->tempbuf[0]), 64); + (u8 *)&(ft1000dev->tempbuf[0]), 64); for (temp = 0; temp < 16; temp++) { DEBUG("tempbuf %d = 0x%x\n", temp, - pft1000info->tempbuf[temp]); + ft1000dev->tempbuf[temp]); } status = ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, (u8 *)&handshake, 1); DEBUG("handshake from read_dpram16 = 0x%x\n", handshake); - if (pft1000info->dspalive == pft1000info->tempbuf[6]) { + if (ft1000dev->dspalive == ft1000dev->tempbuf[6]) { handshake = 0; } else { - handshake = pft1000info->tempbuf[1]; - pft1000info->dspalive = - pft1000info->tempbuf[6]; + handshake = ft1000dev->tempbuf[1]; + ft1000dev->dspalive = + ft1000dev->tempbuf[6]; } } else { status = ft1000_read_dpram16(ft1000dev, @@ -311,7 +309,7 @@ static u16 get_handshake_usb(struct ft1000_device *ft1000dev, u16 expected_value return HANDSHAKE_TIMEOUT_VALUE; } -static void put_handshake_usb(struct ft1000_device *ft1000dev,u16 handshake_value) +static void put_handshake_usb(struct ft1000_usb *ft1000dev,u16 handshake_value) { int i; @@ -321,7 +319,7 @@ static void put_handshake_usb(struct ft1000_device *ft1000dev,u16 handshake_valu //--------------------------------------------------------------------------- // Function: get_request_type // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // // Returns: request type - success // @@ -330,15 +328,14 @@ static void put_handshake_usb(struct ft1000_device *ft1000dev,u16 handshake_valu // Notes: // //--------------------------------------------------------------------------- -static u16 get_request_type(struct ft1000_device *ft1000dev) +static u16 get_request_type(struct ft1000_usb *ft1000dev) { u16 request_type; u32 status; u16 tempword; u32 tempx; - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net); - if (pft1000info->bootmode == 1) { + if (ft1000dev->bootmode == 1) { status = fix_ft1000_read_dpram32(ft1000dev, DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx); tempx = ntohl(tempx); @@ -354,22 +351,21 @@ static u16 get_request_type(struct ft1000_device *ft1000dev) return request_type; } -static u16 get_request_type_usb(struct ft1000_device *ft1000dev) +static u16 get_request_type_usb(struct ft1000_usb *ft1000dev) { u16 request_type; u32 status; u16 tempword; u32 tempx; - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net); - if (pft1000info->bootmode == 1) { + if (ft1000dev->bootmode == 1) { status = fix_ft1000_read_dpram32(ft1000dev, DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx); tempx = ntohl(tempx); } else { - if (pft1000info->usbboot == 2) { - tempx = pft1000info->tempbuf[2]; - tempword = pft1000info->tempbuf[3]; + if (ft1000dev->usbboot == 2) { + tempx = ft1000dev->tempbuf[2]; + tempword = ft1000dev->tempbuf[3]; } else { tempx = 0; status = ft1000_read_dpram16(ft1000dev, @@ -387,7 +383,7 @@ static u16 get_request_type_usb(struct ft1000_device *ft1000dev) //--------------------------------------------------------------------------- // Function: get_request_value // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // // Returns: request value - success // @@ -396,14 +392,13 @@ static u16 get_request_type_usb(struct ft1000_device *ft1000dev) // Notes: // //--------------------------------------------------------------------------- -static long get_request_value(struct ft1000_device *ft1000dev) +static long get_request_value(struct ft1000_usb *ft1000dev) { u32 value; u16 tempword; u32 status; - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net); - if (pft1000info->bootmode == 1) { + if (ft1000dev->bootmode == 1) { status = fix_ft1000_read_dpram32(ft1000dev, DWNLD_MAG1_SIZE_LOC, (u8 *)&value); value = ntohl(value); @@ -424,7 +419,7 @@ static long get_request_value(struct ft1000_device *ft1000dev) //--------------------------------------------------------------------------- // Function: put_request_value // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // long lvalue - value to be put into DPRAM location DWNLD_MAG1_SIZE_LOC // // Returns: none @@ -434,7 +429,7 @@ static long get_request_value(struct ft1000_device *ft1000dev) // Notes: // //--------------------------------------------------------------------------- -static void put_request_value(struct ft1000_device *ft1000dev, long lvalue) +static void put_request_value(struct ft1000_usb *ft1000dev, long lvalue) { u32 tempx; u32 status; @@ -485,7 +480,7 @@ static int check_buffers(u16 *buff_w, u16 *buff_r, int len, int offset) //--------------------------------------------------------------------------- // Function: write_blk // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // u16 **pUsFile - DSP image file pointer in u16 // u8 **pUcFile - DSP image file pointer in u8 // long word_length - length of the buffer to be written @@ -499,7 +494,7 @@ static int check_buffers(u16 *buff_w, u16 *buff_r, int len, int offset) // Notes: // //--------------------------------------------------------------------------- -static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFile, long word_length) +static u32 write_blk (struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, long word_length) { u32 Status = STATUS_SUCCESS; u16 dpram; @@ -507,7 +502,6 @@ static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFi u16 tempword; u16 tempbuffer[64]; u16 resultbuffer[64]; - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net); //DEBUG("FT1000:download:start word_length = %d\n",(int)word_length); dpram = (u16)DWNLD_MAG1_PS_HDR_LOC; @@ -548,7 +542,7 @@ static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFi //DEBUG("write_blk: loopcnt is %d\n", loopcnt); //DEBUG("write_blk: bootmode = %d\n", bootmode); //DEBUG("write_blk: dpram = %x\n", dpram); - if (pft1000info->bootmode == 0) + if (ft1000dev->bootmode == 0) { if (dpram >= 0x3F4) Status = ft1000_write_dpram32 (ft1000dev, dpram, (u8 *)&tempbuffer[0], 8); @@ -625,7 +619,7 @@ static void usb_dnld_complete (struct urb *urb) //--------------------------------------------------------------------------- // Function: write_blk_fifo // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // u16 **pUsFile - DSP image file pointer in u16 // u8 **pUcFile - DSP image file pointer in u8 // long word_length - length of the buffer to be written @@ -639,7 +633,7 @@ static void usb_dnld_complete (struct urb *urb) // Notes: // //--------------------------------------------------------------------------- -static u32 write_blk_fifo(struct ft1000_device *ft1000dev, u16 **pUsFile, +static u32 write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, long word_length) { u32 Status = STATUS_SUCCESS; @@ -682,7 +676,7 @@ static u32 write_blk_fifo(struct ft1000_device *ft1000dev, u16 **pUsFile, // Returns: status - return code //--------------------------------------------------------------------------- -u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, +u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, u32 FileLength) { u16 status = STATUS_SUCCESS; @@ -718,9 +712,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, DEBUG("Entered scram_dnldr...\n"); - pft1000info->fcodeldr = 0; - pft1000info->usbboot = 0; - pft1000info->dspalive = 0xffff; + ft1000dev->fcodeldr = 0; + ft1000dev->usbboot = 0; + ft1000dev->dspalive = 0xffff; // // Get version id of file, at first 4 bytes of file, for newer files. @@ -745,7 +739,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, switch (state) { case STATE_START_DWNLD: DEBUG("FT1000:STATE_START_DWNLD\n"); - if (pft1000info->usbboot) + if (ft1000dev->usbboot) handshake = get_handshake_usb(ft1000dev, HANDSHAKE_DSP_BL_READY); @@ -771,7 +765,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, case STATE_BOOT_DWNLD: DEBUG("FT1000:STATE_BOOT_DWNLD\n"); - pft1000info->bootmode = 1; + ft1000dev->bootmode = 1; handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST); if (handshake == HANDSHAKE_REQUEST) { /* @@ -797,7 +791,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, //DEBUG("FT1000:download:s_file = 0x%8x\n", (int)s_file); //DEBUG("FT1000:download:c_file = 0x%8x\n", (int)c_file); state = STATE_CODE_DWNLD; - pft1000info->fcodeldr = 1; + ft1000dev->fcodeldr = 1; break; case REQUEST_CODE_SEGMENT: //DEBUG("FT1000:REQUEST_CODE_SEGMENT\n"); @@ -842,7 +836,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, status = STATUS_FAILURE; break; } - if (pft1000info->usbboot) + if (ft1000dev->usbboot) put_handshake_usb(ft1000dev, HANDSHAKE_RESPONSE); else @@ -858,8 +852,8 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, case STATE_CODE_DWNLD: //DEBUG("FT1000:STATE_CODE_DWNLD\n"); - pft1000info->bootmode = 0; - if (pft1000info->usbboot) + ft1000dev->bootmode = 0; + if (ft1000dev->usbboot) handshake = get_handshake_usb(ft1000dev, HANDSHAKE_REQUEST); @@ -870,7 +864,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, /* * Get type associated with the request. */ - if (pft1000info->usbboot) + if (ft1000dev->usbboot) request = get_request_type_usb(ft1000dev); else @@ -916,7 +910,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, } break; case REQUEST_DONE_CL: - pft1000info->usbboot = 3; + ft1000dev->usbboot = 3; /* Reposition ptrs to beginning of provisioning section */ s_file = (u16 *) (pFileStart + @@ -965,9 +959,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, write_blk_fifo(ft1000dev, &s_file, &c_file, word_length); - if (pft1000info->usbboot == 0) - pft1000info->usbboot++; - if (pft1000info->usbboot == 1) { + if (ft1000dev->usbboot == 0) + ft1000dev->usbboot++; + if (ft1000dev->usbboot == 1) { tempword = 0; ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_PS_HDR_LOC, @@ -1117,7 +1111,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, status = STATUS_FAILURE; break; } - if (pft1000info->usbboot) + if (ft1000dev->usbboot) put_handshake_usb(ft1000dev, HANDSHAKE_RESPONSE); else diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 809fa4886961..9b8fed7b405b 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -29,12 +29,12 @@ //#define JDEBUG -static int ft1000_reset(struct net_device *ft1000dev); +static int ft1000_reset(void *ft1000dev); static int ft1000_submit_rx_urb(struct ft1000_info *info); static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev); static int ft1000_open (struct net_device *dev); static struct net_device_stats *ft1000_netdev_stats(struct net_device *dev); -static int ft1000_chkcard (struct ft1000_device *dev); +static int ft1000_chkcard (struct ft1000_usb *dev); static u8 tempbuffer[1600]; @@ -43,7 +43,7 @@ static u8 tempbuffer[1600]; //--------------------------------------------------------------------------- // Function: ft1000_control // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // pipe - usb control message pipe // request - control request // requesttype - control message request type @@ -61,7 +61,7 @@ static u8 tempbuffer[1600]; // Notes: // //--------------------------------------------------------------------------- -static int ft1000_control(struct ft1000_device *ft1000dev, unsigned int pipe, +static int ft1000_control(struct ft1000_usb *ft1000dev, unsigned int pipe, u8 request, u8 requesttype, u16 value, u16 index, void *data, u16 size, int timeout) { @@ -84,7 +84,7 @@ static int ft1000_control(struct ft1000_device *ft1000dev, unsigned int pipe, //--------------------------------------------------------------------------- // Function: ft1000_read_register // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // Data - data buffer to hold the value read // nRegIndex - register index // @@ -97,7 +97,7 @@ static int ft1000_control(struct ft1000_device *ft1000dev, unsigned int pipe, // //--------------------------------------------------------------------------- -int ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, +int ft1000_read_register(struct ft1000_usb *ft1000dev, u16* Data, u16 nRegIndx) { int ret = STATUS_SUCCESS; @@ -118,7 +118,7 @@ int ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, //--------------------------------------------------------------------------- // Function: ft1000_write_register // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // value - value to write into a register // nRegIndex - register index // @@ -130,7 +130,7 @@ int ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, // Notes: // //--------------------------------------------------------------------------- -int ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, +int ft1000_write_register(struct ft1000_usb *ft1000dev, u16 value, u16 nRegIndx) { int ret = STATUS_SUCCESS; @@ -151,7 +151,7 @@ int ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, //--------------------------------------------------------------------------- // Function: ft1000_read_dpram32 // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // indx - starting address to read // buffer - data buffer to hold the data read // cnt - number of byte read from DPRAM @@ -165,7 +165,7 @@ int ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, // //--------------------------------------------------------------------------- -int ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, +int ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u16 cnt) { int ret = STATUS_SUCCESS; @@ -186,7 +186,7 @@ int ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, //--------------------------------------------------------------------------- // Function: ft1000_write_dpram32 // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // indx - starting address to write the data // buffer - data buffer to write into DPRAM // cnt - number of bytes to write @@ -199,7 +199,7 @@ int ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, // Notes: // //--------------------------------------------------------------------------- -int ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, +int ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u16 cnt) { int ret = STATUS_SUCCESS; @@ -223,7 +223,7 @@ int ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, //--------------------------------------------------------------------------- // Function: ft1000_read_dpram16 // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // indx - starting address to read // buffer - data buffer to hold the data read // hightlow - high or low 16 bit word @@ -236,7 +236,7 @@ int ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, // Notes: // //--------------------------------------------------------------------------- -int ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, +int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u8 highlow) { int ret = STATUS_SUCCESS; @@ -263,7 +263,7 @@ int ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, //--------------------------------------------------------------------------- // Function: ft1000_write_dpram16 // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // indx - starting address to write the data // value - 16bits value to write // hightlow - high or low 16 bit word @@ -276,7 +276,7 @@ int ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, // Notes: // //--------------------------------------------------------------------------- -int ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u8 highlow) +int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value, u8 highlow) { int ret = STATUS_SUCCESS; u8 request; @@ -302,7 +302,7 @@ int ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u //--------------------------------------------------------------------------- // Function: fix_ft1000_read_dpram32 // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // indx - starting address to read // buffer - data buffer to hold the data read // @@ -315,7 +315,7 @@ int ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u // Notes: // //--------------------------------------------------------------------------- -int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, +int fix_ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer) { u8 buf[16]; @@ -346,7 +346,7 @@ int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, //--------------------------------------------------------------------------- // Function: fix_ft1000_write_dpram32 // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // indx - starting address to write // buffer - data buffer to write // @@ -359,7 +359,7 @@ int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, // Notes: // //--------------------------------------------------------------------------- -int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer) +int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer) { u16 pos1; u16 pos2; @@ -426,7 +426,7 @@ int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buff // // Returns: None //----------------------------------------------------------------------- -static void card_reset_dsp(struct ft1000_device *ft1000dev, bool value) +static void card_reset_dsp(struct ft1000_usb *ft1000dev, bool value) { u16 status = STATUS_SUCCESS; u16 tempword; @@ -465,7 +465,7 @@ static void card_reset_dsp(struct ft1000_device *ft1000dev, bool value) //--------------------------------------------------------------------------- // Function: card_send_command // -// Parameters: ft1000_device - device structure +// Parameters: ft1000_usb - device structure // ptempbuffer - command buffer // size - command buffer size // @@ -477,7 +477,7 @@ static void card_reset_dsp(struct ft1000_device *ft1000dev, bool value) // Notes: // //--------------------------------------------------------------------------- -void card_send_command(struct ft1000_device *ft1000dev, void *ptempbuffer, +void card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, int size) { unsigned short temp; @@ -524,7 +524,7 @@ void card_send_command(struct ft1000_device *ft1000dev, void *ptempbuffer, // // Returns: None //----------------------------------------------------------------------- -int dsp_reload(struct ft1000_device *ft1000dev) +int dsp_reload(struct ft1000_usb *ft1000dev) { u16 status; u16 tempword; @@ -588,7 +588,7 @@ int dsp_reload(struct ft1000_device *ft1000dev) static void ft1000_reset_asic(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); - struct ft1000_device *ft1000dev = info->pFt1000Dev; + struct ft1000_usb *ft1000dev = info->priv; u16 tempword; DEBUG("ft1000_hw:ft1000_reset_asic called\n"); @@ -627,15 +627,15 @@ static void ft1000_reset_asic(struct net_device *dev) static int ft1000_reset_card(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); - struct ft1000_device *ft1000dev = info->pFt1000Dev; + struct ft1000_usb *ft1000dev = info->priv; u16 tempword; struct prov_record *ptr; DEBUG("ft1000_hw:ft1000_reset_card called.....\n"); - info->fCondResetPend = 1; + ft1000dev->fCondResetPend = 1; info->CardReady = 0; - info->fProvComplete = 0; + ft1000dev->fProvComplete = 0; /* Make sure we free any memory reserve for provisioning */ while (list_empty(&info->prov_list) == 0) { @@ -666,7 +666,7 @@ static int ft1000_reset_card(struct net_device *dev) info->CardReady = 1; - info->fCondResetPend = 0; + ft1000dev->fCondResetPend = 0; return TRUE; } @@ -694,7 +694,7 @@ static const struct net_device_ops ftnet_ops = // Notes: // //--------------------------------------------------------------------------- -int init_ft1000_netdev(struct ft1000_device *ft1000dev) +int init_ft1000_netdev(struct ft1000_usb *ft1000dev) { struct net_device *netdev; struct ft1000_info *pInfo = NULL; @@ -702,7 +702,7 @@ int init_ft1000_netdev(struct ft1000_device *ft1000dev) int i, ret_val; struct list_head *cur, *tmp; char card_nr[2]; - unsigned long gCardIndex = 0; + u8 gCardIndex = 0; DEBUG("Enter init_ft1000_netdev...\n"); @@ -723,14 +723,14 @@ int init_ft1000_netdev(struct ft1000_device *ft1000dev) if (strncmp(netdev->name, "eth", 3) == 0) { card_nr[0] = netdev->name[3]; card_nr[1] = '\0'; - ret_val = strict_strtoul(card_nr, 10, &gCardIndex); + ret_val = kstrtou8(card_nr, 10, &gCardIndex); if (ret_val) { printk(KERN_ERR "Can't parse netdev\n"); goto err_net; } - pInfo->CardNumber = gCardIndex; - DEBUG("card number = %d\n", pInfo->CardNumber); + ft1000dev->CardNumber = gCardIndex; + DEBUG("card number = %d\n", ft1000dev->CardNumber); } else { printk(KERN_ERR "ft1000: Invalid device name\n"); ret_val = -ENXIO; @@ -740,27 +740,27 @@ int init_ft1000_netdev(struct ft1000_device *ft1000dev) memset(&pInfo->stats, 0, sizeof(struct net_device_stats)); spin_lock_init(&pInfo->dpram_lock); - pInfo->pFt1000Dev = ft1000dev; + pInfo->priv = ft1000dev; pInfo->DrvErrNum = 0; pInfo->registered = 1; pInfo->ft1000_reset = ft1000_reset; pInfo->mediastate = 0; pInfo->fifo_cnt = 0; - pInfo->DeviceCreated = FALSE; + ft1000dev->DeviceCreated = FALSE; pInfo->CardReady = 0; pInfo->DSP_TIME[0] = 0; pInfo->DSP_TIME[1] = 0; pInfo->DSP_TIME[2] = 0; pInfo->DSP_TIME[3] = 0; - pInfo->fAppMsgPend = 0; - pInfo->fCondResetPend = 0; - pInfo->usbboot = 0; - pInfo->dspalive = 0; - memset(&pInfo->tempbuf[0], 0, sizeof(pInfo->tempbuf)); + ft1000dev->fAppMsgPend = 0; + ft1000dev->fCondResetPend = 0; + ft1000dev->usbboot = 0; + ft1000dev->dspalive = 0; + memset(&ft1000dev->tempbuf[0], 0, sizeof(ft1000dev->tempbuf)); INIT_LIST_HEAD(&pInfo->prov_list); - INIT_LIST_HEAD(&pInfo->nodes.list); + INIT_LIST_HEAD(&ft1000dev->nodes.list); netdev->netdev_ops = &ftnet_ops; @@ -822,7 +822,7 @@ err_net: // Notes: // //--------------------------------------------------------------------------- -int reg_ft1000_netdev(struct ft1000_device *ft1000dev, +int reg_ft1000_netdev(struct ft1000_usb *ft1000dev, struct usb_interface *intf) { struct net_device *netdev; @@ -854,7 +854,7 @@ int reg_ft1000_netdev(struct ft1000_device *ft1000dev, return 0; } -static int ft1000_reset(struct net_device *dev) +int ft1000_reset(void *dev) { ft1000_reset_card(dev); return 0; @@ -876,7 +876,7 @@ static int ft1000_reset(struct net_device *dev) static void ft1000_usb_transmit_complete(struct urb *urb) { - struct ft1000_device *ft1000dev = urb->context; + struct ft1000_usb *ft1000dev = urb->context; if (urb->status) pr_err("%s: TX status %d\n", ft1000dev->net->name, urb->status); @@ -902,7 +902,7 @@ static void ft1000_usb_transmit_complete(struct urb *urb) static int ft1000_copy_down_pkt(struct net_device *netdev, u8 * packet, u16 len) { struct ft1000_info *pInfo = netdev_priv(netdev); - struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev; + struct ft1000_usb *pFt1000Dev = pInfo->priv; int count, ret; u8 *t; @@ -981,7 +981,7 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 * packet, u16 len) static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct ft1000_info *pInfo = netdev_priv(dev); - struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev; + struct ft1000_usb *pFt1000Dev = pInfo->priv; u8 *pdata; int maxlen, pipe; @@ -1039,7 +1039,7 @@ err: static int ft1000_copy_up_pkt(struct urb *urb) { struct ft1000_info *info = urb->context; - struct ft1000_device *ft1000dev = info->pFt1000Dev; + struct ft1000_usb *ft1000dev = info->priv; struct net_device *net = ft1000dev->net; u16 tempword; @@ -1134,7 +1134,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) static int ft1000_submit_rx_urb(struct ft1000_info *info) { int result; - struct ft1000_device *pFt1000Dev = info->pFt1000Dev; + struct ft1000_usb *pFt1000Dev = info->priv; if (pFt1000Dev->status & FT1000_STATUS_CLOSING) { DEBUG("network driver is closed, return\n"); @@ -1177,9 +1177,10 @@ static int ft1000_submit_rx_urb(struct ft1000_info *info) static int ft1000_open(struct net_device *dev) { struct ft1000_info *pInfo = netdev_priv(dev); + struct ft1000_usb *pFt1000Dev = pInfo->priv; struct timeval tv; - DEBUG("ft1000_open is called for card %d\n", pInfo->CardNumber); + DEBUG("ft1000_open is called for card %d\n", pFt1000Dev->CardNumber); pInfo->stats.rx_bytes = 0; pInfo->stats.tx_bytes = 0; @@ -1213,7 +1214,7 @@ static int ft1000_open(struct net_device *dev) int ft1000_close(struct net_device *net) { struct ft1000_info *pInfo = netdev_priv(net); - struct ft1000_device *ft1000dev = pInfo->pFt1000Dev; + struct ft1000_usb *ft1000dev = pInfo->priv; ft1000dev->status |= FT1000_STATUS_CLOSING; @@ -1247,13 +1248,12 @@ static struct net_device_stats *ft1000_netdev_stats(struct net_device *dev) // TRUE (device is present) // //--------------------------------------------------------------------------- -static int ft1000_chkcard(struct ft1000_device *dev) +static int ft1000_chkcard(struct ft1000_usb *dev) { u16 tempword; u16 status; - struct ft1000_info *info = netdev_priv(dev->net); - if (info->fCondResetPend) { + if (dev->fCondResetPend) { DEBUG ("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n"); return TRUE; @@ -1293,7 +1293,7 @@ static int ft1000_chkcard(struct ft1000_device *dev) // = 1 (successful) // //--------------------------------------------------------------------------- -static bool ft1000_receive_cmd(struct ft1000_device *dev, u16 *pbuffer, +static bool ft1000_receive_cmd(struct ft1000_usb *dev, u16 *pbuffer, int maxsz, u16 *pnxtph) { u16 size, ret; @@ -1360,7 +1360,7 @@ static bool ft1000_receive_cmd(struct ft1000_device *dev, u16 *pbuffer, static int ft1000_dsp_prov(void *arg) { - struct ft1000_device *dev = (struct ft1000_device *)arg; + struct ft1000_usb *dev = (struct ft1000_usb *)arg; struct ft1000_info *info = netdev_priv(dev->net); u16 tempword; u16 len; @@ -1441,13 +1441,13 @@ static int ft1000_dsp_prov(void *arg) msleep(100); - info->fProvComplete = 1; + dev->fProvComplete = 1; info->CardReady = 1; return STATUS_SUCCESS; } -static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) +static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) { struct ft1000_info *info = netdev_priv(dev->net); u16 msgtype; @@ -1498,7 +1498,7 @@ static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) if (pmediamsg->state) { DEBUG("Media is up\n"); if (info->mediastate == 0) { - if (info->NetDevRegDone) { + if (dev->NetDevRegDone) { netif_wake_queue(dev-> net); } @@ -1508,7 +1508,7 @@ static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) DEBUG("Media is down\n"); if (info->mediastate == 1) { info->mediastate = 0; - if (info->NetDevRegDone) { + if (dev->NetDevRegDone) { } info->ConTm = 0; } @@ -1567,12 +1567,12 @@ static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) * Send provisioning data to DSP */ if (list_empty(&info->prov_list) == 0) { - info->fProvComplete = 0; + dev->fProvComplete = 0; status = ft1000_dsp_prov(dev); if (status != STATUS_SUCCESS) goto out; } else { - info->fProvComplete = 1; + dev->fProvComplete = 1; status = ft1000_write_register(dev, FT1000_DB_HB, FT1000_REG_DOORBELL); @@ -1605,7 +1605,7 @@ static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) case DSP_GET_INFO:{ DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n"); /* copy dsp info block to dsp */ - info->DrvMsgPend = 1; + dev->DrvMsgPend = 1; /* allow any outstanding ioctl to finish */ mdelay(10); status = @@ -1667,7 +1667,7 @@ static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) status = ft1000_write_register(dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL); - info->DrvMsgPend = 0; + dev->DrvMsgPend = 0; break; } @@ -1675,7 +1675,7 @@ static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) case GET_DRV_ERR_RPT_MSG:{ DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n"); /* copy driver error message to dsp */ - info->DrvMsgPend = 1; + dev->DrvMsgPend = 1; /* allow any outstanding ioctl to finish */ mdelay(10); status = @@ -1735,7 +1735,7 @@ static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) (u16) (0x0012 + PSEUDOSZ)); info->DrvErrNum = 0; } - info->DrvMsgPend = 0; + dev->DrvMsgPend = 0; break; } @@ -1753,7 +1753,7 @@ out: int ft1000_poll(void* dev_id) { - struct ft1000_device *dev = (struct ft1000_device *)dev_id; + struct ft1000_usb *dev = (struct ft1000_usb *)dev_id; struct ft1000_info *info = netdev_priv(dev->net); u16 tempword; @@ -1804,8 +1804,8 @@ int ft1000_poll(void* dev_id) // Check which application has registered for dsp broadcast messages for (i=0; i<MAX_NUM_APP; i++) { - if ( (info->app_info[i].DspBCMsgFlag) && (info->app_info[i].fileobject) && - (info->app_info[i].NumOfMsg < MAX_MSG_LIMIT) ) + if ( (dev->app_info[i].DspBCMsgFlag) && (dev->app_info[i].fileobject) && + (dev->app_info[i].NumOfMsg < MAX_MSG_LIMIT) ) { nxtph = FT1000_DPRAM_RX_BASE + 2; pdpram_blk = ft1000_get_buffer (&freercvpool); @@ -1813,15 +1813,15 @@ int ft1000_poll(void* dev_id) if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE, &nxtph) ) { ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer; // Put message into the appropriate application block - info->app_info[i].nRxMsg++; + dev->app_info[i].nRxMsg++; spin_lock_irqsave(&free_buff_lock, flags); - list_add_tail(&pdpram_blk->list, &info->app_info[i].app_sqlist); - info->app_info[i].NumOfMsg++; + list_add_tail(&pdpram_blk->list, &dev->app_info[i].app_sqlist); + dev->app_info[i].NumOfMsg++; spin_unlock_irqrestore(&free_buff_lock, flags); - wake_up_interruptible(&info->app_info[i].wait_dpram_msg); + wake_up_interruptible(&dev->app_info[i].wait_dpram_msg); } else { - info->app_info[i].nRxMsgMiss++; + dev->app_info[i].nRxMsgMiss++; // Put memory back to free pool ft1000_free_buffer(pdpram_blk, &freercvpool); DEBUG("pdpram_blk::ft1000_get_buffer NULL\n"); @@ -1829,7 +1829,7 @@ int ft1000_poll(void* dev_id) } else { DEBUG("Out of memory in free receive command pool\n"); - info->app_info[i].nRxMsgMiss++; + dev->app_info[i].nRxMsgMiss++; } } } @@ -1842,7 +1842,7 @@ int ft1000_poll(void* dev_id) ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer; // Search for correct application block for (i=0; i<MAX_NUM_APP; i++) { - if (info->app_info[i].app_id == ppseudo_hdr->portdest) { + if (dev->app_info[i].app_id == ppseudo_hdr->portdest) { break; } } @@ -1853,15 +1853,15 @@ int ft1000_poll(void* dev_id) ft1000_free_buffer(pdpram_blk, &freercvpool); } else { - if (info->app_info[i].NumOfMsg > MAX_MSG_LIMIT) { + if (dev->app_info[i].NumOfMsg > MAX_MSG_LIMIT) { // Put memory back to free pool ft1000_free_buffer(pdpram_blk, &freercvpool); } else { - info->app_info[i].nRxMsg++; + dev->app_info[i].nRxMsg++; // Put message into the appropriate application block - list_add_tail(&pdpram_blk->list, &info->app_info[i].app_sqlist); - info->app_info[i].NumOfMsg++; + list_add_tail(&pdpram_blk->list, &dev->app_info[i].app_sqlist); + dev->app_info[i].NumOfMsg++; } } } @@ -1921,7 +1921,7 @@ int ft1000_poll(void* dev_id) else if (tempword & FT1000_DB_COND_RESET) { DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n"); - if (info->fAppMsgPend == 0) { + if (dev->fAppMsgPend == 0) { // Reset ASIC and DSP status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (u8 *)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX); @@ -1934,8 +1934,8 @@ int ft1000_poll(void* dev_id) info->ft1000_reset(dev->net); } else { - info->fProvComplete = 0; - info->fCondResetPend = 1; + dev->fProvComplete = 0; + dev->fCondResetPend = 1; } ft1000_write_register(dev, FT1000_DB_COND_RESET, FT1000_REG_DOORBELL); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c index 1edaddba816f..b99640637fe0 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c @@ -51,7 +51,7 @@ #define FTNET_PROC init_net.proc_net -int ft1000_read_dpram16 (struct ft1000_device *ft1000dev, u16 indx, +int ft1000_read_dpram16 (struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u8 highlow); @@ -94,11 +94,11 @@ ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof, if (info->ProgConStat != 0xFF) { - ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_LED, + ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_LED, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); info->LedStat = ntohs(ledStat); - ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_CON_STATE, + ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); info->ConStat = ntohs(conStat); do_gettimeofday(&tv); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index b2ecd0e6780e..1bf3792ffebe 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -63,11 +63,11 @@ static int ft1000_probe(struct usb_interface *interface, unsigned numaltsetting; int i, ret = 0, size; - struct ft1000_device *ft1000dev; + struct ft1000_usb *ft1000dev; struct ft1000_info *pft1000info = NULL; const struct firmware *dsp_fw; - ft1000dev = kzalloc(sizeof(struct ft1000_device), GFP_KERNEL); + ft1000dev = kzalloc(sizeof(struct ft1000_usb), GFP_KERNEL); if (!ft1000dev) { pr_err("out of memory allocating device structure\n"); @@ -171,11 +171,11 @@ static int ft1000_probe(struct usb_interface *interface, } gPollingfailed = FALSE; - pft1000info->pPollThread = + ft1000dev->pPollThread = kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll"); - if (IS_ERR(pft1000info->pPollThread)) { - ret = PTR_ERR(pft1000info->pPollThread); + if (IS_ERR(ft1000dev->pPollThread)) { + ret = PTR_ERR(ft1000dev->pPollThread); goto err_load; } @@ -200,7 +200,7 @@ static int ft1000_probe(struct usb_interface *interface, if (ret) goto err_proc; - pft1000info->NetDevRegDone = 1; + ft1000dev->NetDevRegDone = 1; return 0; @@ -208,7 +208,7 @@ err_proc: unregister_netdev(ft1000dev->net); free_netdev(ft1000dev->net); err_thread: - kthread_stop(pft1000info->pPollThread); + kthread_stop(ft1000dev->pPollThread); err_load: kfree(pFileStart); err_fw: @@ -219,6 +219,7 @@ err_fw: static void ft1000_disconnect(struct usb_interface *interface) { struct ft1000_info *pft1000info; + struct ft1000_usb *ft1000dev; DEBUG("ft1000_disconnect is called\n"); @@ -226,28 +227,29 @@ static void ft1000_disconnect(struct usb_interface *interface) DEBUG("In disconnect pft1000info=%p\n", pft1000info); if (pft1000info) { + ft1000dev = pft1000info->priv; ft1000_cleanup_proc(pft1000info); - if (pft1000info->pPollThread) - kthread_stop(pft1000info->pPollThread); + if (ft1000dev->pPollThread) + kthread_stop(ft1000dev->pPollThread); DEBUG("ft1000_disconnect: threads are terminated\n"); - if (pft1000info->pFt1000Dev->net) { + if (ft1000dev->net) { DEBUG("ft1000_disconnect: destroy char driver\n"); - ft1000_destroy_dev(pft1000info->pFt1000Dev->net); - unregister_netdev(pft1000info->pFt1000Dev->net); + ft1000_destroy_dev(ft1000dev->net); + unregister_netdev(ft1000dev->net); DEBUG ("ft1000_disconnect: network device unregistered\n"); - free_netdev(pft1000info->pFt1000Dev->net); + free_netdev(ft1000dev->net); } - usb_free_urb(pft1000info->pFt1000Dev->rx_urb); - usb_free_urb(pft1000info->pFt1000Dev->tx_urb); + usb_free_urb(ft1000dev->rx_urb); + usb_free_urb(ft1000dev->tx_urb); DEBUG("ft1000_disconnect: urb freed\n"); - kfree(pft1000info->pFt1000Dev); + kfree(ft1000dev); } kfree(pFileStart); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index 2aa6a1c7fd38..bd1da1f19cd2 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -55,7 +55,14 @@ struct app_info_block { #define MAX_BUF_SIZE 4096 -struct ft1000_device { +struct ft1000_debug_dirs { + struct list_head list; + struct dentry *dent; + struct dentry *file; + int int_number; +}; + +struct ft1000_usb { struct usb_device *dev; struct net_device *net; @@ -69,71 +76,26 @@ struct ft1000_device { u8 bulk_in_endpointAddr; u8 bulk_out_endpointAddr; -} __packed; - -struct ft1000_debug_dirs { - struct list_head list; - struct dentry *dent; - struct dentry *file; - int int_number; -}; - -struct ft1000_info { - struct ft1000_device *pFt1000Dev; - struct net_device_stats stats; struct task_struct *pPollThread; - unsigned char fcodeldr; unsigned char bootmode; unsigned char usbboot; unsigned short dspalive; - u16 ASIC_ID; bool fProvComplete; bool fCondResetPend; bool fAppMsgPend; - u16 DrvErrNum; - u16 AsicID; - int DspAsicReset; int DeviceCreated; - int CardReady; int NetDevRegDone; u8 CardNumber; u8 DeviceName[15]; struct ft1000_debug_dirs nodes; - int registered; - int mediastate; - u8 squeseqnum; /* sequence number on slow queue */ - spinlock_t dpram_lock; spinlock_t fifo_lock; - u16 fifo_cnt; - u8 DspVer[DSPVERSZ]; /* DSP version number */ - u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */ - u8 Sku[SKUSZ]; /* SKU */ - u8 eui64[EUISZ]; /* EUI64 */ - time_t ConTm; /* Connection Time */ - u8 ProductMode[MODESZ]; - u8 RfCalVer[CALVERSZ]; - u8 RfCalDate[CALDATESZ]; - u16 DSP_TIME[4]; - u16 LedStat; - u16 ConStat; - u16 ProgConStat; - struct list_head prov_list; int appcnt; struct app_info_block app_info[MAX_NUM_APP]; - u16 DSPInfoBlklen; u16 DrvMsgPend; - int (*ft1000_reset)(struct net_device *dev); - u16 DSPInfoBlk[MAX_DSP_SESS_REC]; - union { - u16 Rec[MAX_DSP_SESS_REC]; - u32 MagRec[MAX_DSP_SESS_REC/2]; - } DSPSess; unsigned short tempbuf[32]; - char netdevname[IFNAMSIZ]; - struct proc_dir_entry *ft1000_proc_dir; -}; +} __packed; struct dpram_blk { @@ -141,21 +103,21 @@ struct dpram_blk { u16 *pbuffer; } __packed; -int ft1000_read_register(struct ft1000_device *ft1000dev, +int ft1000_read_register(struct ft1000_usb *ft1000dev, u16 *Data, u16 nRegIndx); -int ft1000_write_register(struct ft1000_device *ft1000dev, +int ft1000_write_register(struct ft1000_usb *ft1000dev, u16 value, u16 nRegIndx); -int ft1000_read_dpram32(struct ft1000_device *ft1000dev, +int ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u16 cnt); -int ft1000_write_dpram32(struct ft1000_device *ft1000dev, +int ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u16 cnt); -int ft1000_read_dpram16(struct ft1000_device *ft1000dev, +int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u8 highlow); -int ft1000_write_dpram16(struct ft1000_device *ft1000dev, +int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value, u8 highlow); -int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, +int fix_ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer); -int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, +int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer); extern void *pFileStart; @@ -163,25 +125,25 @@ extern size_t FileLength; extern int numofmsgbuf; int ft1000_close(struct net_device *dev); -u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, +u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, u32 FileLength); extern struct list_head freercvpool; extern spinlock_t free_buff_lock; /* lock to arbitrate free buffer list for receive command data */ -int ft1000_create_dev(struct ft1000_device *dev); +int ft1000_create_dev(struct ft1000_usb *dev); void ft1000_destroy_dev(struct net_device *dev); -extern void card_send_command(struct ft1000_device *ft1000dev, +extern void card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, int size); struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist); void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist); -int dsp_reload(struct ft1000_device *ft1000dev); -int init_ft1000_netdev(struct ft1000_device *ft1000dev); +int dsp_reload(struct ft1000_usb *ft1000dev); +int init_ft1000_netdev(struct ft1000_usb *ft1000dev); struct usb_interface; -int reg_ft1000_netdev(struct ft1000_device *ft1000dev, +int reg_ft1000_netdev(struct ft1000_usb *ft1000dev, struct usb_interface *intf); int ft1000_poll(void *dev_id); diff --git a/drivers/staging/ft1000/ft1000.h b/drivers/staging/ft1000/ft1000.h index 03baa5779234..175abfa7682e 100644 --- a/drivers/staging/ft1000/ft1000.h +++ b/drivers/staging/ft1000/ft1000.h @@ -250,3 +250,38 @@ struct prov_record { struct list_head list; u8 *pprov_data; }; + +struct ft1000_info { + void *priv; + struct net_device_stats stats; + u16 DrvErrNum; + u16 AsicID; + int CardReady; + int registered; + int mediastate; + u8 squeseqnum; /* sequence number on slow queue */ + spinlock_t dpram_lock; + u16 fifo_cnt; + u8 DspVer[DSPVERSZ]; /* DSP version number */ + u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */ + u8 Sku[SKUSZ]; /* SKU */ + u8 eui64[EUISZ]; /* EUI64 */ + time_t ConTm; /* Connection Time */ + u8 ProductMode[MODESZ]; + u8 RfCalVer[CALVERSZ]; + u8 RfCalDate[CALDATESZ]; + u16 DSP_TIME[4]; + u16 LedStat; + u16 ConStat; + u16 ProgConStat; + struct list_head prov_list; + u16 DSPInfoBlklen; + int (*ft1000_reset)(void *); + u16 DSPInfoBlk[MAX_DSP_SESS_REC]; + union { + u16 Rec[MAX_DSP_SESS_REC]; + u32 MagRec[MAX_DSP_SESS_REC/2]; + } DSPSess; + struct proc_dir_entry *ft1000_proc_dir; + char netdevname[IFNAMSIZ]; +}; diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index fb31b457a56a..3a4d5f06beed 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -75,11 +75,6 @@ static const char * const mxs_lradc_irq_name[] = { "mxs-lradc-button1", }; -struct mxs_lradc_chan { - uint8_t slot; - uint8_t flags; -}; - struct mxs_lradc { struct device *dev; void __iomem *base; @@ -90,8 +85,6 @@ struct mxs_lradc { struct mutex lock; - uint8_t enable; - struct completion completion; }; diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index a865adf81938..aee76c710a3b 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -54,7 +54,7 @@ struct iio_dummy_accel_calibscale { static const struct iio_dummy_accel_calibscale dummy_scales[] = { { 0, 100, 0x8 }, /* 0.000100 */ { 0, 133, 0x7 }, /* 0.000133 */ - { 733, 13, 0x9 }, /* 733.00013 */ + { 733, 13, 0x9 }, /* 733.000013 */ }; /* @@ -284,7 +284,7 @@ static int iio_dummy_read_raw(struct iio_dev *indio_dev, /** * iio_dummy_write_raw() - data write function. * @indio_dev: the struct iio_dev associated with this device instance - * @chan: the channel whose data is to be read + * @chan: the channel whose data is to be written * @val: first element of value to set (typically INT) * @val2: second element of value to set (typically MICRO) * @mask: what we actually want to write. 0 is the channel, everything else diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index dee16f0e7570..72f400c3cbcb 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -155,7 +155,7 @@ int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev, * occurs, this function is run. Typically this grabs data * from the device. * - * NULL for the top half. This is normally implemented only if we + * NULL for the bottom half. This is normally implemented only if we * either want to ping a capture now pin (no sleeping) or grab * a timestamp as close as possible to a data ready trigger firing. * diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c index 55a0b82c6391..4dec93d046fa 100644 --- a/drivers/staging/keucr/usb.c +++ b/drivers/staging/keucr/usb.c @@ -42,19 +42,12 @@ static int eucr_suspend(struct usb_interface *iface, pm_message_t message) /* Wait until no command is running */ mutex_lock(&us->dev_mutex); - //US_DEBUGP("%s\n", __func__); if (us->suspend_resume_hook) (us->suspend_resume_hook)(us, US_SUSPEND); - /* When runtime PM is working, we'll set a flag to indicate - * whether we should autoresume when a SCSI request arrives. */ - // us->Power_IsResum = true; - //us->SD_Status.Ready = 0; - mutex_unlock(&us->dev_mutex); return 0; } -//EXPORT_SYMBOL_GPL(eucr_suspend); static int eucr_resume(struct usb_interface *iface) { @@ -64,43 +57,40 @@ static int eucr_resume(struct usb_interface *iface) pr_info("--- eucr_resume---\n"); mutex_lock(&us->dev_mutex); - //US_DEBUGP("%s\n", __func__); if (us->suspend_resume_hook) (us->suspend_resume_hook)(us, US_RESUME); mutex_unlock(&us->dev_mutex); - - us->Power_IsResum = true; - // - //us->SD_Status.Ready = 0; //?? - us->SM_Status = *(PSM_STATUS)&tmp; - + us->Power_IsResum = true; + + us->SM_Status = *(PSM_STATUS)&tmp; + return 0; } -//EXPORT_SYMBOL_GPL(eucr_resume); + static int eucr_reset_resume(struct usb_interface *iface) { BYTE tmp = 0; struct us_data *us = usb_get_intfdata(iface); pr_info("--- eucr_reset_resume---\n"); - //US_DEBUGP("%s\n", __func__); /* Report the reset to the SCSI core */ usb_stor_report_bus_reset(us); - /* FIXME: Notify the subdrivers that they need to reinitialize - * the device */ - //ENE_InitMedia(us); + /* + * FIXME: Notify the subdrivers that they need to reinitialize + * the device + */ + us->Power_IsResum = true; - // - //us->SD_Status.Ready = 0; //?? - us->SM_Status = *(PSM_STATUS)&tmp; + + us->SM_Status = *(PSM_STATUS)&tmp; + return 0; } -//EXPORT_SYMBOL_GPL(usb_stor_reset_resume); #else @@ -110,7 +100,6 @@ static int eucr_reset_resume(struct usb_interface *iface) #endif -//----- eucr_pre_reset() --------------------- static int eucr_pre_reset(struct usb_interface *iface) { struct us_data *us = usb_get_intfdata(iface); @@ -122,7 +111,6 @@ static int eucr_pre_reset(struct usb_interface *iface) return 0; } -//----- eucr_post_reset() --------------------- static int eucr_post_reset(struct usb_interface *iface) { struct us_data *us = usb_get_intfdata(iface); @@ -136,19 +124,15 @@ static int eucr_post_reset(struct usb_interface *iface) return 0; } -//----- fill_inquiry_response() --------------------- void fill_inquiry_response(struct us_data *us, unsigned char *data, unsigned int data_len) { pr_info("usb --- fill_inquiry_response\n"); - if (data_len<36) // You lose. + if (data_len < 36) /* You lose. */ return; - if (data[0]&0x20) - { + if (data[0]&0x20) { memset(data+8,0,28); - } - else - { + } else { u16 bcdDevice = le16_to_cpu(us->pusb_dev->descriptor.bcdDevice); memcpy(data+8, us->unusual_dev->vendorName, strlen(us->unusual_dev->vendorName) > 8 ? 8 : @@ -164,18 +148,16 @@ void fill_inquiry_response(struct us_data *us, unsigned char *data, unsigned int usb_stor_set_xfer_buf(us, data, data_len, us->srb, TO_XFER_BUF); } -//----- usb_stor_control_thread() --------------------- static int usb_stor_control_thread(void * __us) { struct us_data *us = (struct us_data *)__us; struct Scsi_Host *host = us_to_host(us); pr_info("usb --- usb_stor_control_thread\n"); - for(;;) - { + for (;;) { if (wait_for_completion_interruptible(&us->cmnd_ready)) break; - + /* lock the device pointers */ mutex_lock(&(us->dev_mutex)); @@ -189,44 +171,34 @@ static int usb_stor_control_thread(void * __us) scsi_lock(host); /* When we are called with no command pending, we're done */ - if (us->srb == NULL) - { + if (us->srb == NULL) { scsi_unlock(host); mutex_unlock(&us->dev_mutex); - //US_DEBUGP("-- exiting\n"); break; } /* has the command timed out *already* ? */ - if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) - { + if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { us->srb->result = DID_ABORT << 16; goto SkipForAbort; } scsi_unlock(host); - if (us->srb->sc_data_direction == DMA_BIDIRECTIONAL) - { + if (us->srb->sc_data_direction == DMA_BIDIRECTIONAL) { us->srb->result = DID_ERROR << 16; - } - else if (us->srb->device->id && !(us->fflags & US_FL_SCM_MULT_TARG)) - { + } else if (us->srb->device->id + && !(us->fflags & US_FL_SCM_MULT_TARG)) { us->srb->result = DID_BAD_TARGET << 16; - } - else if (us->srb->device->lun > us->max_lun) - { + } else if (us->srb->device->lun > us->max_lun) { us->srb->result = DID_BAD_TARGET << 16; - } - else if ((us->srb->cmnd[0] == INQUIRY) && (us->fflags & US_FL_FIX_INQUIRY)) - { + } else if ((us->srb->cmnd[0] == INQUIRY) + && (us->fflags & US_FL_FIX_INQUIRY)) { unsigned char data_ptr[36] = {0x00, 0x80, 0x02, 0x02, 0x1F, 0x00, 0x00, 0x00}; fill_inquiry_response(us, data_ptr, 36); us->srb->result = SAM_STAT_GOOD; - } - else - { + } else { us->proto_handler(us->srb, us); } @@ -234,18 +206,14 @@ static int usb_stor_control_thread(void * __us) scsi_lock(host); /* indicate that the command is done */ - if (us->srb->result != DID_ABORT << 16) - { + if (us->srb->result != DID_ABORT << 16) { us->srb->scsi_done(us->srb); - } - else - { + } else { SkipForAbort: pr_info("scsi command aborted\n"); } - if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) - { + if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { complete(&(us->notify)); /* Allow USB transfers to resume */ @@ -262,8 +230,7 @@ SkipForAbort: } /* for (;;) */ /* Wait until we are told to stop */ - for (;;) - { + for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (kthread_should_stop()) break; @@ -271,9 +238,8 @@ SkipForAbort: } __set_current_state(TASK_RUNNING); return 0; -} +} -//----- associate_dev() --------------------- static int associate_dev(struct us_data *us, struct usb_interface *intf) { pr_info("usb --- associate_dev\n"); @@ -288,29 +254,25 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) /* Allocate the device-related DMA-mapped buffers */ us->cr = usb_alloc_coherent(us->pusb_dev, sizeof(*us->cr), GFP_KERNEL, &us->cr_dma); - if (!us->cr) - { + if (!us->cr) { pr_info("usb_ctrlrequest allocation failed\n"); return -ENOMEM; } us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE, GFP_KERNEL, &us->iobuf_dma); - if (!us->iobuf) - { + if (!us->iobuf) { pr_info("I/O buffer allocation failed\n"); return -ENOMEM; } us->sensebuf = kmalloc(US_SENSE_SIZE, GFP_KERNEL); - if (!us->sensebuf) - { + if (!us->sensebuf) { pr_info("Sense buffer allocation failed\n"); return -ENOMEM; } return 0; } -//----- get_device_info() --------------------- static int get_device_info(struct us_data *us, const struct usb_device_id *id) { struct usb_device *dev = us->pusb_dev; @@ -323,8 +285,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id) us->fflags = id->driver_info; us->Power_IsResum = false; - if (us->fflags & US_FL_IGNORE_DEVICE) - { + if (us->fflags & US_FL_IGNORE_DEVICE) { pr_info("device ignored\n"); return -ENODEV; } @@ -335,7 +296,6 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id) return 0; } -//----- get_transport() --------------------- static int get_transport(struct us_data *us) { pr_info("usb --- get_transport\n"); @@ -349,7 +309,6 @@ static int get_transport(struct us_data *us) default: return -EIO; } - /* pr_info("Transport: %s\n", us->transport_name); */ /* fix for single-lun devices */ if (us->fflags & US_FL_SINGLE_LUN) @@ -357,7 +316,6 @@ static int get_transport(struct us_data *us) return 0; } -//----- get_protocol() --------------------- static int get_protocol(struct us_data *us) { pr_info("usb --- get_protocol\n"); @@ -368,7 +326,8 @@ static int get_protocol(struct us_data *us) switch (us->subclass) { case USB_SC_SCSI: us->protocol_name = "Transparent SCSI"; - if( (us->pusb_dev->descriptor.idVendor == 0x0CF2) && (us->pusb_dev->descriptor.idProduct == 0x6250) ) + if ((us->pusb_dev->descriptor.idVendor == 0x0CF2) + && (us->pusb_dev->descriptor.idProduct == 0x6250)) us->proto_handler = ENE_stor_invoke_transport; else us->proto_handler = usb_stor_invoke_transport; @@ -377,11 +336,9 @@ static int get_protocol(struct us_data *us) default: return -EIO; } - /* pr_info("Protocol: %s\n", us->protocol_name); */ return 0; } -//----- get_pipes() --------------------- static int get_pipes(struct us_data *us) { struct usb_host_interface *altsetting = us->pusb_intf->cur_altsetting; @@ -393,32 +350,24 @@ static int get_pipes(struct us_data *us) pr_info("usb --- get_pipes\n"); - for (i = 0; i < altsetting->desc.bNumEndpoints; i++) - { + for (i = 0; i < altsetting->desc.bNumEndpoints; i++) { ep = &altsetting->endpoint[i].desc; - if (usb_endpoint_xfer_bulk(ep)) - { - if (usb_endpoint_dir_in(ep)) - { + if (usb_endpoint_xfer_bulk(ep)) { + if (usb_endpoint_dir_in(ep)) { if (!ep_in) ep_in = ep; - } - else - { + } else { if (!ep_out) ep_out = ep; } - } - else if (usb_endpoint_is_int_in(ep)) - { + } else if (usb_endpoint_is_int_in(ep)) { if (!ep_int) ep_int = ep; } } - if (!ep_in || !ep_out || (us->protocol == USB_PR_CBI && !ep_int)) - { + if (!ep_in || !ep_out || (us->protocol == USB_PR_CBI && !ep_int)) { pr_info("Endpoint sanity check failed! Rejecting dev.\n"); return -EIO; } @@ -428,31 +377,27 @@ static int get_pipes(struct us_data *us) us->recv_ctrl_pipe = usb_rcvctrlpipe(us->pusb_dev, 0); us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev, ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev, ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); - if (ep_int) - { + if (ep_int) { us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev, ep_int->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); us->ep_bInterval = ep_int->bInterval; } return 0; } -//----- usb_stor_acquire_resources() --------------------- static int usb_stor_acquire_resources(struct us_data *us) { struct task_struct *th; pr_info("usb --- usb_stor_acquire_resources\n"); us->current_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!us->current_urb) - { + if (!us->current_urb) { pr_info("URB allocation failed\n"); return -ENOMEM; } /* Start up our control thread */ th = kthread_run(usb_stor_control_thread, us, "eucr-storage"); - if (IS_ERR(th)) - { + if (IS_ERR(th)) { pr_info("Unable to start control thread\n"); return PTR_ERR(th); } @@ -461,7 +406,6 @@ static int usb_stor_acquire_resources(struct us_data *us) return 0; } -//----- usb_stor_release_resources() --------------------- static void usb_stor_release_resources(struct us_data *us) { pr_info("usb --- usb_stor_release_resources\n"); @@ -473,8 +417,7 @@ static void usb_stor_release_resources(struct us_data *us) kthread_stop(us->ctl_thread); /* Call the destructor routine, if it exists */ - if (us->extra_destructor) - { + if (us->extra_destructor) { pr_info("-- calling extra_destructor()\n"); us->extra_destructor(us->extra); } @@ -484,7 +427,6 @@ static void usb_stor_release_resources(struct us_data *us) usb_free_urb(us->current_urb); } -//----- dissociate_dev() --------------------- static void dissociate_dev(struct us_data *us) { pr_info("usb --- dissociate_dev\n"); @@ -501,7 +443,6 @@ static void dissociate_dev(struct us_data *us) usb_set_intfdata(us->pusb_intf, NULL); } -//----- quiesce_and_remove_host() --------------------- static void quiesce_and_remove_host(struct us_data *us) { struct Scsi_Host *host = us_to_host(us); @@ -512,19 +453,22 @@ static void quiesce_and_remove_host(struct us_data *us) if (us->pusb_dev->state == USB_STATE_NOTATTACHED) set_bit(US_FLIDX_DISCONNECTING, &us->dflags); - /* Prevent SCSI-scanning (if it hasn't started yet) + /* + * Prevent SCSI-scanning (if it hasn't started yet) * and wait for the SCSI-scanning thread to stop. */ set_bit(US_FLIDX_DONT_SCAN, &us->dflags); wake_up(&us->delay_wait); wait_for_completion(&us->scanning_done); - /* Removing the host will perform an orderly shutdown: caches + /* + * Removing the host will perform an orderly shutdown: caches * synchronized, disks spun down, etc. */ scsi_remove_host(host); - /* Prevent any new commands from being accepted and cut short + /* + * Prevent any new commands from being accepted and cut short * reset delays. */ scsi_lock(host); @@ -533,7 +477,6 @@ static void quiesce_and_remove_host(struct us_data *us) wake_up(&us->delay_wait); } -//----- release_everything() --------------------- static void release_everything(struct us_data *us) { pr_info("usb --- release_everything\n"); @@ -543,7 +486,6 @@ static void release_everything(struct us_data *us) scsi_host_put(us_to_host(us)); } -//----- usb_stor_scan_thread() --------------------- static int usb_stor_scan_thread(void * __us) { struct us_data *us = (struct us_data *)__us; @@ -560,11 +502,10 @@ static int usb_stor_scan_thread(void * __us) } /* If the device is still connected, perform the scanning */ - if (!test_bit(US_FLIDX_DONT_SCAN, &us->dflags)) - { + if (!test_bit(US_FLIDX_DONT_SCAN, &us->dflags)) { /* For bulk-only devices, determine the max LUN value */ - if (us->protocol == USB_PR_BULK && !(us->fflags & US_FL_SINGLE_LUN)) - { + if (us->protocol == USB_PR_BULK + && !(us->fflags & US_FL_SINGLE_LUN)) { mutex_lock(&us->dev_mutex); us->max_lun = usb_stor_Bulk_max_lun(us); mutex_unlock(&us->dev_mutex); @@ -575,7 +516,6 @@ static int usb_stor_scan_thread(void * __us) complete_and_exit(&us->scanning_done, 0); } -//----- eucr_probe() --------------------- static int eucr_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct Scsi_Host *host; @@ -587,8 +527,7 @@ static int eucr_probe(struct usb_interface *intf, const struct usb_device_id *id pr_info("usb --- eucr_probe\n"); host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us)); - if (!host) - { + if (!host) { pr_info("Unable to allocate the scsi host\n"); return -ENOMEM; } @@ -630,8 +569,7 @@ static int eucr_probe(struct usb_interface *intf, const struct usb_device_id *id goto BadDevice; result = scsi_add_host(host, &intf->dev); - if (result) - { + if (result) { pr_info("Unable to add the scsi host\n"); goto BadDevice; } @@ -673,7 +611,6 @@ BadDevice: return result; } -//----- eucr_disconnect() --------------------- static void eucr_disconnect(struct usb_interface *intf) { struct us_data *us = usb_get_intfdata(intf); @@ -683,11 +620,7 @@ static void eucr_disconnect(struct usb_interface *intf) release_everything(us); } -/*********************************************************************** - * Initialization and registration - ***********************************************************************/ - -//----- usb_storage_driver() --------------------- +/* Initialization and registration */ static struct usb_driver usb_storage_driver = { .name = "eucr", .probe = eucr_probe, diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index 1e4ce50069a9..ecb461e3580d 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -307,14 +307,13 @@ int line6_version_request_async(struct usb_line6 *line6) char *buffer; int retval; - buffer = kmalloc(sizeof(line6_request_version), GFP_ATOMIC); + buffer = kmemdup(line6_request_version, + sizeof(line6_request_version), GFP_ATOMIC); if (buffer == NULL) { dev_err(line6->ifcdev, "Out of memory"); return -ENOMEM; } - memcpy(buffer, line6_request_version, sizeof(line6_request_version)); - retval = line6_send_raw_message_async(line6, buffer, sizeof(line6_request_version)); kfree(buffer); @@ -333,17 +332,6 @@ int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, } /* - Send sysex message in pieces of wMaxPacketSize bytes. -*/ -int line6_send_sysex_message_async(struct usb_line6 *line6, const char *buffer, - int size) -{ - return line6_send_raw_message_async(line6, buffer, - size + SYSEX_EXTRA_SIZE) - - SYSEX_EXTRA_SIZE; -} - -/* Allocate buffer for sysex message and prepare header. @param code sysex message code @param size number of bytes between code and sysex end diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h index f0be5a2adaba..1dd768c26990 100644 --- a/drivers/staging/line6/driver.h +++ b/drivers/staging/line6/driver.h @@ -208,8 +208,6 @@ extern int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer, int size); extern int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, int size); -extern int line6_send_sysex_message_async(struct usb_line6 *line6, - const char *buffer, int size); extern ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); extern void line6_start_timer(struct timer_list *timer, unsigned int msecs, diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c index 6c1e31335d19..17969c656648 100644 --- a/drivers/staging/line6/pcm.c +++ b/drivers/staging/line6/pcm.c @@ -49,11 +49,11 @@ static ssize_t pcm_set_impulse_volume(struct device *dev, { struct snd_line6_pcm *line6pcm = dev2pcm(dev); int value; - int rv; + int ret; - rv = kstrtoint(buf, 10, &value); - if (rv < 0) - return rv; + ret = kstrtoint(buf, 10, &value); + if (ret < 0) + return ret; line6pcm->impulse_volume = value; @@ -81,7 +81,14 @@ static ssize_t pcm_set_impulse_period(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - dev2pcm(dev)->impulse_period = simple_strtoul(buf, NULL, 10); + int value; + int ret; + + ret = kstrtoint(buf, 10, &value); + if (ret < 0) + return ret; + + dev2pcm(dev)->impulse_period = value; return count; } @@ -455,13 +462,12 @@ int line6_init_pcm(struct usb_line6 *line6, ep_write = 0x01; break; - /* this is for interface_number == 1: - case LINE6_DEVID_TONEPORT_UX2: - case LINE6_DEVID_PODSTUDIO_UX2: - ep_read = 0x87; - ep_write = 0x00; - break; - */ + /* this is for interface_number == 1: + case LINE6_DEVID_TONEPORT_UX2: + case LINE6_DEVID_PODSTUDIO_UX2: + ep_read = 0x87; + ep_write = 0x00; + break; */ default: MISSING_CASE; diff --git a/drivers/staging/omap-thermal/omap-thermal-common.c b/drivers/staging/omap-thermal/omap-thermal-common.c index 61f1070c6667..79a55aaae5a3 100644 --- a/drivers/staging/omap-thermal/omap-thermal-common.c +++ b/drivers/staging/omap-thermal/omap-thermal-common.c @@ -260,7 +260,7 @@ int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id, data = omap_bandgap_get_sensor_data(bg_ptr, id); - if (!data) + if (IS_ERR(data)) data = omap_thermal_build_data(bg_ptr, id); if (!data) @@ -309,7 +309,7 @@ int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id) struct omap_thermal_data *data; data = omap_bandgap_get_sensor_data(bg_ptr, id); - if (!data) + if (IS_ERR(data)) data = omap_thermal_build_data(bg_ptr, id); if (!data) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c index 0e93eb0735a7..9d2d5c58add2 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c @@ -39,12 +39,11 @@ Dot11d_Reset(struct ieee80211_device *ieee) memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); // Set new channel map - for (i=1; i<=11; i++) { + for (i = 1; i <= 11; i++) (pDot11dInfo->channel_map)[i] = 1; - } - for (i=12; i<=14; i++) { + + for (i = 12; i <= 14; i++) (pDot11dInfo->channel_map)[i] = 2; - } pDot11dInfo->State = DOT11D_STATE_NONE; pDot11dInfo->CountryIeLen = 0; @@ -68,17 +67,16 @@ Dot11d_Reset(struct ieee80211_device *ieee) void Dot11d_UpdateCountryIe( struct ieee80211_device *dev, - u8 * pTaddr, + u8 *pTaddr, u16 CoutryIeLen, - u8 * pCoutryIe + u8 *pCoutryIe ) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); u8 i, j, NumTriples, MaxChnlNum; PCHNL_TXPOWER_TRIPLE pTriple; - if((CoutryIeLen - 3)%3 != 0) - { + if ((CoutryIeLen - 3)%3 != 0) { printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); Dot11d_Reset(dev); return; @@ -89,35 +87,33 @@ Dot11d_UpdateCountryIe( MaxChnlNum = 0; NumTriples = (CoutryIeLen - 3) / 3; // skip 3-byte country string. pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3); - for(i = 0; i < NumTriples; i++) - { - if(MaxChnlNum >= pTriple->FirstChnl) - { // It is not in a monotonically increasing order, so stop processing. + for (i = 0; i < NumTriples; i++) { + if (MaxChnlNum >= pTriple->FirstChnl) { + // It is not in a monotonically increasing order, so stop processing. printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); Dot11d_Reset(dev); return; } - if(MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls)) - { // It is not a valid set of channel id, so stop processing. + if (MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls)) { + // It is not a valid set of channel id, so stop processing. printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); Dot11d_Reset(dev); return; } - for(j = 0 ; j < pTriple->NumChnls; j++) - { + for (j = 0 ; j < pTriple->NumChnls; j++) { pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1; pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm; MaxChnlNum = pTriple->FirstChnl + j; } - pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3); + pTriple = (PCHNL_TXPOWER_TRIPLE)((u8 *)pTriple + 3); } #if 1 //printk("Dot11d_UpdateCountryIe(): Channel List:\n"); printk("Channel List:"); - for(i=1; i<= MAX_CHANNEL_NUMBER; i++) - if(pDot11dInfo->channel_map[i] > 0) + for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) + if (pDot11dInfo->channel_map[i] > 0) printk(" %d", i); printk("\n"); #endif @@ -125,7 +121,7 @@ Dot11d_UpdateCountryIe( UPDATE_CIE_SRC(dev, pTaddr); pDot11dInfo->CountryIeLen = CoutryIeLen; - memcpy(pDot11dInfo->CountryIeBuf, pCoutryIe,CoutryIeLen); + memcpy(pDot11dInfo->CountryIeBuf, pCoutryIe, CoutryIeLen); pDot11dInfo->State = DOT11D_STATE_LEARNED; } @@ -138,13 +134,11 @@ DOT11D_GetMaxTxPwrInDbm( PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); u8 MaxTxPwrInDbm = 255; - if(MAX_CHANNEL_NUMBER < Channel) - { + if (MAX_CHANNEL_NUMBER < Channel) { printk("DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); return MaxTxPwrInDbm; } - if(pDot11dInfo->channel_map[Channel]) - { + if (pDot11dInfo->channel_map[Channel]) { MaxTxPwrInDbm = pDot11dInfo->MaxTxPwrDbmList[Channel]; } @@ -154,20 +148,19 @@ DOT11D_GetMaxTxPwrInDbm( void DOT11D_ScanComplete( - struct ieee80211_device * dev + struct ieee80211_device *dev ) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); - switch(pDot11dInfo->State) - { + switch (pDot11dInfo->State) { case DOT11D_STATE_LEARNED: pDot11dInfo->State = DOT11D_STATE_DONE; break; case DOT11D_STATE_DONE: - if( GET_CIE_WATCHDOG(dev) == 0 ) - { // Reset country IE if previous one is gone. + if (GET_CIE_WATCHDOG(dev) == 0) { + // Reset country IE if previous one is gone. Dot11d_Reset(dev); } break; @@ -177,24 +170,23 @@ DOT11D_ScanComplete( } int IsLegalChannel( - struct ieee80211_device * dev, + struct ieee80211_device *dev, u8 channel ) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); - if(MAX_CHANNEL_NUMBER < channel) - { + if (MAX_CHANNEL_NUMBER < channel) { printk("IsLegalChannel(): Invalid Channel\n"); return 0; } - if(pDot11dInfo->channel_map[channel] > 0) + if (pDot11dInfo->channel_map[channel] > 0) return 1; return 0; } int ToLegalChannel( - struct ieee80211_device * dev, + struct ieee80211_device *dev, u8 channel ) { @@ -202,22 +194,19 @@ int ToLegalChannel( u8 default_chn = 0; u32 i = 0; - for (i=1; i<= MAX_CHANNEL_NUMBER; i++) - { - if(pDot11dInfo->channel_map[i] > 0) - { + for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) { + if (pDot11dInfo->channel_map[i] > 0) { default_chn = i; break; } } - if(MAX_CHANNEL_NUMBER < channel) - { + if (MAX_CHANNEL_NUMBER < channel) { printk("IsLegalChannel(): Invalid Channel\n"); return default_chn; } - if(pDot11dInfo->channel_map[channel] > 0) + if (pDot11dInfo->channel_map[channel] > 0) return channel; return default_chn; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c index c7917b24425c..e014f7e74397 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c @@ -41,9 +41,9 @@ static const char *ieee80211_modes[] = { #define MAX_CUSTOM_LEN 64 static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, - char *start, char *stop, - struct ieee80211_network *network, - struct iw_request_info *info) + char *start, char *stop, + struct ieee80211_network *network, + struct iw_request_info *info) { char custom[MAX_CUSTOM_LEN]; char *p; @@ -78,9 +78,9 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]); start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); - /* Add mode */ - iwe.cmd = SIOCGIWMODE; - if (network->capability & + /* Add mode */ + iwe.cmd = SIOCGIWMODE; + if (network->capability & (WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) { if (network->capability & WLAN_CAPABILITY_BSS) iwe.u.mode = IW_MODE_MASTER; @@ -90,7 +90,7 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN); } - /* Add frequency/channel */ + /* Add frequency/channel */ iwe.cmd = SIOCGIWFREQ; /* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode); iwe.u.freq.e = 3; */ @@ -168,23 +168,23 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, if (iwe.u.data.length) start = iwe_stream_add_point(info, start, stop, &iwe, custom); - memset(&iwe, 0, sizeof(iwe)); - if (network->wpa_ie_len) { + memset(&iwe, 0, sizeof(iwe)); + if (network->wpa_ie_len) { // printk("wpa_ie_len:%d\n", network->wpa_ie_len); - char buf[MAX_WPA_IE_LEN]; - memcpy(buf, network->wpa_ie, network->wpa_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = network->wpa_ie_len; - start = iwe_stream_add_point(info, start, stop, &iwe, buf); - } - - memset(&iwe, 0, sizeof(iwe)); - if (network->rsn_ie_len) { + char buf[MAX_WPA_IE_LEN]; + memcpy(buf, network->wpa_ie, network->wpa_ie_len); + iwe.cmd = IWEVGENIE; + iwe.u.data.length = network->wpa_ie_len; + start = iwe_stream_add_point(info, start, stop, &iwe, buf); + } + + memset(&iwe, 0, sizeof(iwe)); + if (network->rsn_ie_len) { // printk("=====>rsn_ie_len:\n", network->rsn_ie_len); - char buf[MAX_WPA_IE_LEN]; - memcpy(buf, network->rsn_ie, network->rsn_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = network->rsn_ie_len; + char buf[MAX_WPA_IE_LEN]; + memcpy(buf, network->rsn_ie, network->rsn_ie_len); + iwe.cmd = IWEVGENIE; + iwe.u.data.length = network->rsn_ie_len; start = iwe_stream_add_point(info, start, stop, &iwe, buf); } @@ -217,22 +217,18 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, down(&ieee->wx_sem); spin_lock_irqsave(&ieee->lock, flags); - if(!ieee->bHwRadioOff) - { + if (!ieee->bHwRadioOff) { list_for_each_entry(network, &ieee->network_list, list) { i++; - if((stop-ev)<200) - { + if ((stop-ev) < 200) { err = -E2BIG; break; } if (ieee->scan_age == 0 || - time_after(network->last_scanned + ieee->scan_age, jiffies)) - { + time_after(network->last_scanned + ieee->scan_age, jiffies)) { ev = rtl818x_translate_scan(ieee, ev, stop, network, info); - } - else + } else IEEE80211_DEBUG_SCAN( "Not showing network '%s (" "%pM)' due to age (%lums).\n", @@ -340,9 +336,8 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, kfree(new_crypt); new_crypt = NULL; - printk(KERN_WARNING "%s: could not initialize WEP: " - "load module ieee80211_crypt_wep\n", - dev->name); + netdev_warn(ieee->dev, + "could not initialize WEP: load module ieee80211_crypt_wep\n"); return -EOPNOTSUPP; } *crypt = new_crypt; @@ -359,7 +354,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, key, escape_essid(sec.keys[key], len), erq->length, len); sec.key_sizes[key] = len; - (*crypt)->ops->set_key(sec.keys[key], len, NULL, + (*crypt)->ops->set_key(sec.keys[key], len, NULL, (*crypt)->priv); sec.flags |= (1 << key); /* This ensures a key will be activated if no key is @@ -414,7 +409,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, if (ieee->reset_on_keychange && ieee->iw_mode != IW_MODE_INFRA && ieee->reset_port && ieee->reset_port(dev)) { - printk(KERN_DEBUG "%s: reset_port failed\n", dev->name); + netdev_dbg(ieee->dev, "reset_port failed\n"); return -EINVAL; } return 0; @@ -430,7 +425,7 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, IEEE80211_DEBUG_WX("GET_ENCODE\n"); - if(ieee->iw_mode == IW_MODE_MONITOR) + if (ieee->iw_mode == IW_MODE_MONITOR) return -1; key = erq->flags & IW_ENCODE_INDEX; @@ -472,240 +467,240 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, } int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct net_device *dev = ieee->dev; - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int i, idx, ret = 0; - int group_key = 0; - const char *alg; - struct ieee80211_crypto_ops *ops; - struct ieee80211_crypt_data **crypt; - - struct ieee80211_security sec = { - .flags = 0, - }; + struct iw_point *encoding = &wrqu->encoding; + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + int i, idx, ret = 0; + int group_key = 0; + const char *alg; + struct ieee80211_crypto_ops *ops; + struct ieee80211_crypt_data **crypt; + + struct ieee80211_security sec = { + .flags = 0, + }; //printk("======>encoding flag:%x,ext flag:%x, ext alg:%d\n", encoding->flags,ext->ext_flags, ext->alg); - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if (idx < 1 || idx > WEP_KEYS) - return -EINVAL; - idx--; - } else - idx = ieee->tx_keyidx; - - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - crypt = &ieee->crypt[idx]; - group_key = 1; - } else { - /* some Cisco APs use idx>0 for unicast in dynamic WEP */ + idx = encoding->flags & IW_ENCODE_INDEX; + if (idx) { + if (idx < 1 || idx > WEP_KEYS) + return -EINVAL; + idx--; + } else + idx = ieee->tx_keyidx; + + if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { + crypt = &ieee->crypt[idx]; + group_key = 1; + } else { + /* some Cisco APs use idx>0 for unicast in dynamic WEP */ //printk("not group key, flags:%x, ext->alg:%d\n", ext->ext_flags, ext->alg); - if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) - return -EINVAL; - if (ieee->iw_mode == IW_MODE_INFRA) - crypt = &ieee->crypt[idx]; - else - return -EINVAL; - } - - sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT; - if ((encoding->flags & IW_ENCODE_DISABLED) || - ext->alg == IW_ENCODE_ALG_NONE) { - if (*crypt) - ieee80211_crypt_delayed_deinit(ieee, crypt); - - for (i = 0; i < WEP_KEYS; i++) - if (ieee->crypt[i] != NULL) - break; - - if (i == WEP_KEYS) { - sec.enabled = 0; - // sec.encrypt = 0; - sec.level = SEC_LEVEL_0; - sec.flags |= SEC_LEVEL; - } + if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) + return -EINVAL; + if (ieee->iw_mode == IW_MODE_INFRA) + crypt = &ieee->crypt[idx]; + else + return -EINVAL; + } + + sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT; + if ((encoding->flags & IW_ENCODE_DISABLED) || + ext->alg == IW_ENCODE_ALG_NONE) { + if (*crypt) + ieee80211_crypt_delayed_deinit(ieee, crypt); + + for (i = 0; i < WEP_KEYS; i++) + if (ieee->crypt[i] != NULL) + break; + + if (i == WEP_KEYS) { + sec.enabled = 0; + // sec.encrypt = 0; + sec.level = SEC_LEVEL_0; + sec.flags |= SEC_LEVEL; + } //printk("disabled: flag:%x\n", encoding->flags); - goto done; - } + goto done; + } sec.enabled = 1; // sec.encrypt = 1; - switch (ext->alg) { - case IW_ENCODE_ALG_WEP: - alg = "WEP"; - break; - case IW_ENCODE_ALG_TKIP: - alg = "TKIP"; - break; - case IW_ENCODE_ALG_CCMP: - alg = "CCMP"; - break; - default: - IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", - dev->name, ext->alg); - ret = -EINVAL; - goto done; - } + switch (ext->alg) { + case IW_ENCODE_ALG_WEP: + alg = "WEP"; + break; + case IW_ENCODE_ALG_TKIP: + alg = "TKIP"; + break; + case IW_ENCODE_ALG_CCMP: + alg = "CCMP"; + break; + default: + IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", + dev->name, ext->alg); + ret = -EINVAL; + goto done; + } // printk("8-09-08-9=====>%s, alg name:%s\n",__func__, alg); - ops = ieee80211_get_crypto_ops(alg); - if (ops == NULL) - ops = ieee80211_get_crypto_ops(alg); - if (ops == NULL) { - IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", - dev->name, ext->alg); + ops = ieee80211_get_crypto_ops(alg); + if (ops == NULL) + ops = ieee80211_get_crypto_ops(alg); + if (ops == NULL) { + IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", + dev->name, ext->alg); printk("========>unknown crypto alg %d\n", ext->alg); - ret = -EINVAL; - goto done; - } - - if (*crypt == NULL || (*crypt)->ops != ops) { - struct ieee80211_crypt_data *new_crypt; - - ieee80211_crypt_delayed_deinit(ieee, 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) - new_crypt->priv = new_crypt->ops->init(idx); - if (new_crypt->priv == NULL) { - kfree(new_crypt); - ret = -EINVAL; - goto done; - } - *crypt = new_crypt; - - } - - if (ext->key_len > 0 && (*crypt)->ops->set_key && - (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, - (*crypt)->priv) < 0) { - IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); + ret = -EINVAL; + goto done; + } + + if (*crypt == NULL || (*crypt)->ops != ops) { + struct ieee80211_crypt_data *new_crypt; + + ieee80211_crypt_delayed_deinit(ieee, 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) + new_crypt->priv = new_crypt->ops->init(idx); + if (new_crypt->priv == NULL) { + kfree(new_crypt); + ret = -EINVAL; + goto done; + } + *crypt = new_crypt; + + } + + if (ext->key_len > 0 && (*crypt)->ops->set_key && + (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, + (*crypt)->priv) < 0) { + IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); printk("key setting failed\n"); - ret = -EINVAL; - goto done; - } + ret = -EINVAL; + goto done; + } #if 1 //skip_host_crypt: //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags); - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - ieee->tx_keyidx = idx; - sec.active_key = idx; - sec.flags |= SEC_ACTIVE_KEY; - } - - if (ext->alg != IW_ENCODE_ALG_NONE) { - memcpy(sec.keys[idx], ext->key, ext->key_len); - sec.key_sizes[idx] = ext->key_len; - sec.flags |= (1 << idx); - if (ext->alg == IW_ENCODE_ALG_WEP) { - // sec.encode_alg[idx] = SEC_ALG_WEP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } else if (ext->alg == IW_ENCODE_ALG_TKIP) { - // sec.encode_alg[idx] = SEC_ALG_TKIP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_2; - } else if (ext->alg == IW_ENCODE_ALG_CCMP) { - // sec.encode_alg[idx] = SEC_ALG_CCMP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_3; - } - /* Don't set sec level for group keys. */ - if (group_key) - sec.flags &= ~SEC_LEVEL; - } + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { + ieee->tx_keyidx = idx; + sec.active_key = idx; + sec.flags |= SEC_ACTIVE_KEY; + } + + if (ext->alg != IW_ENCODE_ALG_NONE) { + memcpy(sec.keys[idx], ext->key, ext->key_len); + sec.key_sizes[idx] = ext->key_len; + sec.flags |= (1 << idx); + if (ext->alg == IW_ENCODE_ALG_WEP) { + // sec.encode_alg[idx] = SEC_ALG_WEP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } else if (ext->alg == IW_ENCODE_ALG_TKIP) { + // sec.encode_alg[idx] = SEC_ALG_TKIP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_2; + } else if (ext->alg == IW_ENCODE_ALG_CCMP) { + // sec.encode_alg[idx] = SEC_ALG_CCMP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_3; + } + /* Don't set sec level for group keys. */ + if (group_key) + sec.flags &= ~SEC_LEVEL; + } #endif done: - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); if (ieee->reset_on_keychange && - ieee->iw_mode != IW_MODE_INFRA && - ieee->reset_port && ieee->reset_port(dev)) { - IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); - return -EINVAL; - } + ieee->iw_mode != IW_MODE_INFRA && + ieee->reset_port && ieee->reset_port(dev)) { + IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); + return -EINVAL; + } - return ret; + return ret; } int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct iw_mlme *mlme = (struct iw_mlme *) extra; // printk("\ndkgadfslkdjgalskdf===============>%s(), cmd:%x\n", __func__, mlme->cmd); #if 1 switch (mlme->cmd) { - case IW_MLME_DEAUTH: + case IW_MLME_DEAUTH: case IW_MLME_DISASSOC: // printk("disassoc now\n"); ieee80211_disassociate(ieee); break; default: - return -EOPNOTSUPP; - } + return -EOPNOTSUPP; + } #endif return 0; } int ieee80211_wx_set_auth(struct ieee80211_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra) + struct iw_request_info *info, + struct iw_param *data, char *extra) { /* struct ieee80211_security sec = { - .flags = SEC_AUTH_MODE, + .flags = SEC_AUTH_MODE, } */ //printk("set auth:flag:%x, data value:%x\n", data->flags, data->value); switch (data->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: + case IW_AUTH_WPA_VERSION: /*need to support wpa2 here*/ //printk("wpa version:%x\n", data->value); break; - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - /* + case IW_AUTH_CIPHER_PAIRWISE: + case IW_AUTH_CIPHER_GROUP: + case IW_AUTH_KEY_MGMT: + /* * * Host AP driver does not use these parameters and allows * * wpa_supplicant to control them internally. * */ - break; - case IW_AUTH_TKIP_COUNTERMEASURES: - ieee->tkip_countermeasures = data->value; - break; - case IW_AUTH_DROP_UNENCRYPTED: - ieee->drop_unencrypted = data->value; + break; + case IW_AUTH_TKIP_COUNTERMEASURES: + ieee->tkip_countermeasures = data->value; + break; + case IW_AUTH_DROP_UNENCRYPTED: + ieee->drop_unencrypted = data->value; break; case IW_AUTH_80211_AUTH_ALG: - ieee->open_wep = (data->value&IW_AUTH_ALG_OPEN_SYSTEM)?1:0; + ieee->open_wep = (data->value&IW_AUTH_ALG_OPEN_SYSTEM) ? 1 : 0; //printk("open_wep:%d\n", ieee->open_wep); break; #if 1 case IW_AUTH_WPA_ENABLED: - ieee->wpa_enabled = (data->value)?1:0; + ieee->wpa_enabled = (data->value) ? 1 : 0; //printk("enable wpa:%d\n", ieee->wpa_enabled); break; #endif case IW_AUTH_RX_UNENCRYPTED_EAPOL: - ieee->ieee802_1x = data->value; + ieee->ieee802_1x = data->value; break; case IW_AUTH_PRIVACY_INVOKED: ieee->privacy_invoked = data->value; break; default: - return -EOPNOTSUPP; + return -EOPNOTSUPP; } return 0; } @@ -715,15 +710,13 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) { u8 *buf = NULL; - if (len>MAX_WPA_IE_LEN || (len && ie == NULL)) - { + if (len > MAX_WPA_IE_LEN || (len && ie == NULL)) { printk("return error out, len:%zu\n", len); return -EINVAL; } - if (len) - { - if (len != ie[1]+2){ + if (len) { + if (len != ie[1]+2) { printk("len:%zu, ie:%d\n", len, ie[1]); return -EINVAL; } @@ -733,8 +726,7 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) kfree(ieee->wpa_ie); ieee->wpa_ie = buf; ieee->wpa_ie_len = len; - } - else{ + } else { kfree(ieee->wpa_ie); ieee->wpa_ie = NULL; ieee->wpa_ie_len = 0; diff --git a/drivers/staging/rtl8192u/changes b/drivers/staging/rtl8192u/changes index 87c33fdb9526..0485d6eec7b5 100644 --- a/drivers/staging/rtl8192u/changes +++ b/drivers/staging/rtl8192u/changes @@ -2,4 +2,3 @@ v 0.1 First version. This is based on the rtl8180-sa2400 pre-0.22-CVS code.. - diff --git a/drivers/staging/rtl8192u/ieee80211/Makefile b/drivers/staging/rtl8192u/ieee80211/Makefile index 51effd6412ac..b5d0c2eb045b 100644 --- a/drivers/staging/rtl8192u/ieee80211/Makefile +++ b/drivers/staging/rtl8192u/ieee80211/Makefile @@ -25,4 +25,3 @@ obj-m +=ieee80211_crypt-rsl.o obj-m +=ieee80211_crypt_wep-rsl.o obj-m +=ieee80211_crypt_tkip-rsl.o obj-m +=ieee80211_crypt_ccmp-rsl.o - diff --git a/drivers/staging/rtl8192u/ieee80211/aes.c b/drivers/staging/rtl8192u/ieee80211/aes.c index a6bb6c9207d3..abc1023cef65 100644 --- a/drivers/staging/rtl8192u/ieee80211/aes.c +++ b/drivers/staging/rtl8192u/ieee80211/aes.c @@ -443,7 +443,7 @@ static struct crypto_alg aes_alg = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE, .cia_max_keysize = AES_MAX_KEY_SIZE, - .cia_setkey = aes_set_key, + .cia_setkey = aes_set_key, .cia_encrypt = aes_encrypt, .cia_decrypt = aes_decrypt } @@ -466,4 +466,3 @@ module_exit(aes_fini); MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); MODULE_LICENSE("Dual BSD/GPL"); - diff --git a/drivers/staging/rtl8192u/ieee80211/arc4.c b/drivers/staging/rtl8192u/ieee80211/arc4.c index e3ad8d2f415e..b790e9ad104c 100644 --- a/drivers/staging/rtl8192u/ieee80211/arc4.c +++ b/drivers/staging/rtl8192u/ieee80211/arc4.c @@ -79,7 +79,7 @@ static struct crypto_alg arc4_alg = { .cra_u = { .cipher = { .cia_min_keysize = ARC4_MIN_KEY_SIZE, .cia_max_keysize = ARC4_MAX_KEY_SIZE, - .cia_setkey = arc4_set_key, + .cia_setkey = arc4_set_key, .cia_encrypt = arc4_crypt, .cia_decrypt = arc4_crypt } } }; diff --git a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h index da486588f1c0..2ba374a64178 100644 --- a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h +++ b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h @@ -56,5 +56,3 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, } //EXPORT_SYMBOL_GPL(crypto_alloc_tfm); //EXPORT_SYMBOL_GPL(crypto_free_tfm); - - diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c index ce63fc341c6e..f10fd5a93c38 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.c +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c @@ -218,4 +218,3 @@ EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm); EXPORT_SYMBOL(DOT11D_ScanComplete); EXPORT_SYMBOL(IsLegalChannel); EXPORT_SYMBOL(ToLegalChannel); - diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 502bfdbcc84b..210898c8e66c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -64,7 +64,7 @@ #endif #define KEY_TYPE_NA 0x0 -#define KEY_TYPE_WEP40 0x1 +#define KEY_TYPE_WEP40 0x1 #define KEY_TYPE_TKIP 0x2 #define KEY_TYPE_CCMP 0x4 #define KEY_TYPE_WEP104 0x5 @@ -195,21 +195,21 @@ enum _ReasonCode{ auth_not_valid = 0x2, deauth_lv_ss = 0x3, inactivity = 0x4, - ap_overload = 0x5, + ap_overload = 0x5, class2_err = 0x6, class3_err = 0x7, - disas_lv_ss = 0x8, + disas_lv_ss = 0x8, asoc_not_auth = 0x9, //----MIC_CHECK - mic_failure = 0xe, + mic_failure = 0xe, //----END MIC_CHECK // Reason code defined in 802.11i D10.0 p.28. invalid_IE = 0x0d, four_way_tmout = 0x0f, two_way_tmout = 0x10, - IE_dismatch = 0x11, + IE_dismatch = 0x11, invalid_Gcipher = 0x12, invalid_Pcipher = 0x13, invalid_AKMP = 0x14, @@ -222,7 +222,7 @@ enum _ReasonCode{ QoS_unspec = 0x20, // 32 QAP_bandwidth = 0x21, // 33 poor_condition = 0x22, // 34 - no_facility = 0x23, // 35 + no_facility = 0x23, // 35 // Where is 36??? req_declined = 0x25, // 37 invalid_param = 0x26, // 38 @@ -265,7 +265,7 @@ enum _ReasonCode{ #define IEEE_WPAX_USEGROUP 0 #define IEEE_WPAX_WEP40 1 #define IEEE_WPAX_TKIP 2 -#define IEEE_WPAX_WRAP 3 +#define IEEE_WPAX_WRAP 3 #define IEEE_WPAX_CCMP 4 #define IEEE_WPAX_WEP104 5 @@ -289,12 +289,12 @@ enum _ReasonCode{ #define MAX_IE_LEN 0xff // added for kernel conflict -#define ieee80211_crypt_deinit_entries ieee80211_crypt_deinit_entries_rsl -#define ieee80211_crypt_deinit_handler ieee80211_crypt_deinit_handler_rsl -#define ieee80211_crypt_delayed_deinit ieee80211_crypt_delayed_deinit_rsl -#define ieee80211_register_crypto_ops ieee80211_register_crypto_ops_rsl +#define ieee80211_crypt_deinit_entries ieee80211_crypt_deinit_entries_rsl +#define ieee80211_crypt_deinit_handler ieee80211_crypt_deinit_handler_rsl +#define ieee80211_crypt_delayed_deinit ieee80211_crypt_delayed_deinit_rsl +#define ieee80211_register_crypto_ops ieee80211_register_crypto_ops_rsl #define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl -#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl +#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl #define ieee80211_ccmp_null ieee80211_ccmp_null_rsl @@ -302,10 +302,10 @@ enum _ReasonCode{ #define ieee80211_wep_null ieee80211_wep_null_rsl -#define free_ieee80211 free_ieee80211_rsl -#define alloc_ieee80211 alloc_ieee80211_rsl +#define free_ieee80211 free_ieee80211_rsl +#define alloc_ieee80211 alloc_ieee80211_rsl -#define ieee80211_rx ieee80211_rx_rsl +#define ieee80211_rx ieee80211_rx_rsl #define ieee80211_rx_mgt ieee80211_rx_mgt_rsl #define ieee80211_get_beacon ieee80211_get_beacon_rsl @@ -450,7 +450,7 @@ typedef struct ieee_param { /* management */ #define IEEE80211_STYPE_ASSOC_REQ 0x0000 -#define IEEE80211_STYPE_ASSOC_RESP 0x0010 +#define IEEE80211_STYPE_ASSOC_RESP 0x0010 #define IEEE80211_STYPE_REASSOC_REQ 0x0020 #define IEEE80211_STYPE_REASSOC_RESP 0x0030 #define IEEE80211_STYPE_PROBE_REQ 0x0040 @@ -536,7 +536,7 @@ do { if (ieee80211_debug_level & (level)) \ //if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA #define IEEE80211_DEBUG_DATA(level, data, datalen) \ do{ if ((ieee80211_debug_level & (level)) == (level)) \ - { \ + { \ int i; \ u8* pdata = (u8*) data; \ printk(KERN_DEBUG "ieee80211: %s()\n", __FUNCTION__); \ @@ -623,20 +623,20 @@ do { if (ieee80211_debug_level & (level)) \ #define MAX_STR_LEN 64 /* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/ #define PRINTABLE(_ch) (_ch>'!' && _ch<'~') -#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ - if((_Comp) & level) \ +#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ + if((_Comp) & level) \ { \ int __i; \ - u8 buffer[MAX_STR_LEN]; \ - int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \ - memset(buffer, 0, MAX_STR_LEN); \ - memcpy(buffer, (u8 *)_Ptr, length ); \ + u8 buffer[MAX_STR_LEN]; \ + int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \ + memset(buffer, 0, MAX_STR_LEN); \ + memcpy(buffer, (u8 *)_Ptr, length ); \ for( __i=0; __i<MAX_STR_LEN; __i++ ) \ { \ - if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \ + if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \ } \ buffer[length] = '\0'; \ - printk("Rtl819x: "); \ + printk("Rtl819x: "); \ printk(_TitleString); \ printk(": %d, <%s>\n", _Len, buffer); \ } @@ -785,12 +785,12 @@ enum ieee80211_reasoncode { #define IEEE80211_24GHZ_BAND (1<<0) #define IEEE80211_52GHZ_BAND (1<<1) -#define IEEE80211_CCK_RATE_LEN 4 +#define IEEE80211_CCK_RATE_LEN 4 #define IEEE80211_CCK_RATE_1MB 0x02 #define IEEE80211_CCK_RATE_2MB 0x04 #define IEEE80211_CCK_RATE_5MB 0x0B #define IEEE80211_CCK_RATE_11MB 0x16 -#define IEEE80211_OFDM_RATE_LEN 8 +#define IEEE80211_OFDM_RATE_LEN 8 #define IEEE80211_OFDM_RATE_6MB 0x0C #define IEEE80211_OFDM_RATE_9MB 0x12 #define IEEE80211_OFDM_RATE_12MB 0x18 @@ -919,10 +919,10 @@ struct ieee80211_rx_stats { u16 fraglength; // FragLength should equal to PacketLength in non-fragment case u16 fragoffset; // Data offset for this fragment u16 ntotalfrag; - bool bisrxaggrsubframe; + bool bisrxaggrsubframe; bool bPacketBeacon; //cosa add for rssi bool bToSelfBA; //cosa add for rssi - char cck_adc_pwdb[4]; //cosa add for rx path selection + char cck_adc_pwdb[4]; //cosa add for rx path selection u16 Seq_Num; }; @@ -992,7 +992,7 @@ struct ieee80211_device; #define SEC_ALG_TKIP 2 #define SEC_ALG_CCMP 3 -#define WEP_KEYS 4 +#define WEP_KEYS 4 #define WEP_KEY_LEN 13 #define SCM_KEY_LEN 32 #define SCM_TEMPORAL_KEY_LENGTH 16 @@ -1205,7 +1205,7 @@ struct ieee80211_drv_agg_txb { struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT]; }__attribute__((packed)); -#define MAX_SUBFRAME_COUNT 64 +#define MAX_SUBFRAME_COUNT 64 struct ieee80211_rxb { u8 nr_subframes; struct sk_buff *subframes[MAX_SUBFRAME_COUNT]; @@ -1534,7 +1534,7 @@ struct ieee80211_network { bool bWithAironetIE; bool bCkipSupported; bool bCcxRmEnable; - u16 CcxRmState[2]; + u16 CcxRmState[2]; // CCXv4 S59, MBSSID. bool bMBssidValid; u8 MBssidMask; @@ -1655,8 +1655,7 @@ typedef struct tx_pending_t{ struct ieee80211_txb *txb; }tx_pending_t; -typedef struct _bandwidth_autoswitch -{ +typedef struct _bandwidth_autoswitch { long threshold_20Mhzto40Mhz; long threshold_40Mhzto20Mhz; bool bforced_tx20Mhz; @@ -1668,8 +1667,7 @@ typedef struct _bandwidth_autoswitch #define REORDER_WIN_SIZE 128 #define REORDER_ENTRY_NUM 128 -typedef struct _RX_REORDER_ENTRY -{ +typedef struct _RX_REORDER_ENTRY { struct list_head List; u16 SeqNum; struct ieee80211_rxb* prxb; @@ -1709,15 +1707,13 @@ typedef struct _IbssParms{ #define MAX_NUM_RATES 264 // Max num of support rates element: 8, Max num of ext. support rate: 255. 061122, by rcnjko. // RF state. -typedef enum _RT_RF_POWER_STATE -{ +typedef enum _RT_RF_POWER_STATE { eRfOn, eRfSleep, eRfOff }RT_RF_POWER_STATE; -typedef struct _RT_POWER_SAVE_CONTROL -{ +typedef struct _RT_POWER_SAVE_CONTROL { // // Inactive Power Save(IPS) : Disable RF when disconnected @@ -1726,7 +1722,7 @@ typedef struct _RT_POWER_SAVE_CONTROL bool bIPSModeBackup; bool bSwRfProcessing; RT_RF_POWER_STATE eInactivePowerState; - struct work_struct InactivePsWorkItem; + struct work_struct InactivePsWorkItem; struct timer_list InactivePsTimer; // Return point for join action @@ -1837,11 +1833,11 @@ struct ieee80211_device { u8 HTHighestOperaRate; //wb added for rate operation mode to firmware u8 bTxDisableRateFallBack; - u8 bTxUseDriverAssingedRate; + u8 bTxUseDriverAssingedRate; atomic_t atm_chnlop; atomic_t atm_swbw; // u8 HTHighestOperaRate; -// u8 HTCurrentOperaRate; +// u8 HTCurrentOperaRate; // 802.11e and WMM Traffic Stream Info (TX) struct list_head Tx_TS_Admit_List; @@ -2055,9 +2051,9 @@ struct ieee80211_device { bool bdynamic_txpower_enable; bool bCTSToSelfEnable; - u8 CTSToSelfTH; + u8 CTSToSelfTH; - u32 fsync_time_interval; + u32 fsync_time_interval; u32 fsync_rate_bitmap; u8 fsync_rssi_threshold; bool bfsync_enable; @@ -2092,10 +2088,10 @@ struct ieee80211_device { struct delayed_work start_ibss_wq; struct work_struct wx_sync_scan_wq; struct workqueue_struct *wq; - // Qos related. Added by Annie, 2005-11-01. - //STA_QOS StaQos; + // Qos related. Added by Annie, 2005-11-01. + //STA_QOS StaQos; - //u32 STA_EDCA_PARAM[4]; + //u32 STA_EDCA_PARAM[4]; //CHANNEL_ACCESS_SETTING ChannelAccessSetting; @@ -2111,11 +2107,11 @@ struct ieee80211_device { struct net_device *dev); int (*reset_port)(struct net_device *dev); - int (*is_queue_full) (struct net_device * dev, int pri); + int (*is_queue_full) (struct net_device * dev, int pri); - int (*handle_management) (struct net_device * dev, - struct ieee80211_network * network, u16 type); - int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); + int (*handle_management) (struct net_device * dev, + struct ieee80211_network * network, u16 type); + int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); /* Softmac-generated frames (management) are TXed via this * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is @@ -2214,7 +2210,7 @@ struct ieee80211_device { #define IEEE_A (1<<0) #define IEEE_B (1<<1) #define IEEE_G (1<<2) -#define IEEE_N_24G (1<<4) +#define IEEE_N_24G (1<<4) #define IEEE_N_5G (1<<5) #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 82d4bf6a86a5..76c56e5aed79 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -220,7 +220,7 @@ void free_ieee80211(struct net_device *dev) #ifdef CONFIG_IEEE80211_DEBUG -u32 ieee80211_debug_level = 0; +u32 ieee80211_debug_level; static int debug = \ // IEEE80211_DL_INFO | // IEEE80211_DL_WX | @@ -233,15 +233,15 @@ static int debug = \ // IEEE80211_DL_TX | // IEEE80211_DL_RX | //IEEE80211_DL_QOS | - // IEEE80211_DL_HT | + // IEEE80211_DL_HT | // IEEE80211_DL_TS | -// IEEE80211_DL_BA | +// IEEE80211_DL_BA | // IEEE80211_DL_REORDER| // IEEE80211_DL_TRACE | //IEEE80211_DL_DATA | IEEE80211_DL_ERR //awayls open this flags to show error out ; -struct proc_dir_entry *ieee80211_proc = NULL; +struct proc_dir_entry *ieee80211_proc; static int show_debug_level(char *page, char **start, off_t offset, int count, int *eof, void *data) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index e3cf7a45b900..ee7ce5fca462 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -52,7 +52,7 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, u16 fc = le16_to_cpu(hdr->frame_ctl); skb->dev = ieee->dev; - skb_reset_mac_header(skb); + skb_reset_mac_header(skb); skb_pull(skb, ieee80211_get_hdrlen(fc)); skb->pkt_type = PACKET_OTHERHOST; @@ -218,16 +218,16 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, * this is not mandatory.... but seems that the probe * response parser uses it */ - struct ieee80211_hdr_3addr * hdr = (struct ieee80211_hdr_3addr *)skb->data; + struct ieee80211_hdr_3addr * hdr = (struct ieee80211_hdr_3addr *)skb->data; rx_stats->len = skb->len; ieee80211_rx_mgt(ieee,(struct ieee80211_hdr_4addr *)skb->data,rx_stats); - //if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) - if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))//use ADDR1 to perform address matching for Management frames - { - dev_kfree_skb_any(skb); - return 0; - } + //if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) + if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))//use ADDR1 to perform address matching for Management frames + { + dev_kfree_skb_any(skb); + return 0; + } ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype); @@ -608,7 +608,7 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, u16 SeqNum) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; - PRX_REORDER_ENTRY pReorderEntry = NULL; + PRX_REORDER_ENTRY pReorderEntry = NULL; struct ieee80211_rxb* prxbIndicateArray[REORDER_WIN_SIZE]; u8 WinSize = pHTInfo->RxReorderWinSize; u16 WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096; @@ -773,7 +773,7 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, } u8 parse_subframe(struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats, + struct ieee80211_rx_stats *rx_stats, struct ieee80211_rxb *rxb,u8* src,u8* dst) { struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr* )skb->data; @@ -1043,7 +1043,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, { // IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): pRxTS->RxLastFragNum is %d,frag is %d,pRxTS->RxLastSeqNum is %d,seq is %d\n",__FUNCTION__,pRxTS->RxLastFragNum,frag,pRxTS->RxLastSeqNum,WLAN_GET_SEQ_SEQ(sc)); - if( (fc & (1<<11)) && + if( (fc & (1<<11)) && (frag == pRxTS->RxLastFragNum) && (WLAN_GET_SEQ_SEQ(sc) == pRxTS->RxLastSeqNum) ) { @@ -1154,8 +1154,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, type, stype, skb->len); goto rx_dropped; } - if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN)) - goto rx_dropped; + if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN)) + goto rx_dropped; /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ @@ -1402,19 +1402,19 @@ static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; * the right values */ static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element - *info_element, int sub_type) + *info_element, int sub_type) { - if (info_element->qui_subtype != sub_type) - return -1; - if (memcmp(info_element->qui, qos_oui, QOS_OUI_LEN)) - return -1; - if (info_element->qui_type != QOS_OUI_TYPE) - return -1; - if (info_element->version != QOS_VERSION_1) - return -1; + if (info_element->qui_subtype != sub_type) + return -1; + if (memcmp(info_element->qui, qos_oui, QOS_OUI_LEN)) + return -1; + if (info_element->qui_type != QOS_OUI_TYPE) + return -1; + if (info_element->version != QOS_VERSION_1) + return -1; - return 0; + return 0; } @@ -1422,56 +1422,56 @@ static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element * Parse a QoS parameter element */ static int ieee80211_read_qos_param_element(struct ieee80211_qos_parameter_info - *element_param, struct ieee80211_info_element - *info_element) + *element_param, struct ieee80211_info_element + *info_element) { - int ret = 0; - u16 size = sizeof(struct ieee80211_qos_parameter_info) - 2; - - if ((info_element == NULL) || (element_param == NULL)) - return -1; - - if (info_element->id == QOS_ELEMENT_ID && info_element->len == size) { - memcpy(element_param->info_element.qui, info_element->data, - info_element->len); - element_param->info_element.elementID = info_element->id; - element_param->info_element.length = info_element->len; - } else - ret = -1; - if (ret == 0) - ret = ieee80211_verify_qos_info(&element_param->info_element, - QOS_OUI_PARAM_SUB_TYPE); - return ret; + int ret = 0; + u16 size = sizeof(struct ieee80211_qos_parameter_info) - 2; + + if ((info_element == NULL) || (element_param == NULL)) + return -1; + + if (info_element->id == QOS_ELEMENT_ID && info_element->len == size) { + memcpy(element_param->info_element.qui, info_element->data, + info_element->len); + element_param->info_element.elementID = info_element->id; + element_param->info_element.length = info_element->len; + } else + ret = -1; + if (ret == 0) + ret = ieee80211_verify_qos_info(&element_param->info_element, + QOS_OUI_PARAM_SUB_TYPE); + return ret; } /* * Parse a QoS information element */ static int ieee80211_read_qos_info_element(struct - ieee80211_qos_information_element - *element_info, struct ieee80211_info_element - *info_element) + ieee80211_qos_information_element + *element_info, struct ieee80211_info_element + *info_element) { - int ret = 0; - u16 size = sizeof(struct ieee80211_qos_information_element) - 2; - - if (element_info == NULL) - return -1; - if (info_element == NULL) - return -1; - - if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) { - memcpy(element_info->qui, info_element->data, - info_element->len); - element_info->elementID = info_element->id; - element_info->length = info_element->len; - } else - ret = -1; - - if (ret == 0) - ret = ieee80211_verify_qos_info(element_info, - QOS_OUI_INFO_SUB_TYPE); - return ret; + int ret = 0; + u16 size = sizeof(struct ieee80211_qos_information_element) - 2; + + if (element_info == NULL) + return -1; + if (info_element == NULL) + return -1; + + if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) { + memcpy(element_info->qui, info_element->data, + info_element->len); + element_info->elementID = info_element->id; + element_info->length = info_element->len; + } else + ret = -1; + + if (ret == 0) + ret = ieee80211_verify_qos_info(element_info, + QOS_OUI_INFO_SUB_TYPE); + return ret; } @@ -1479,39 +1479,39 @@ static int ieee80211_read_qos_info_element(struct * Write QoS parameters from the ac parameters. */ static int ieee80211_qos_convert_ac_to_parameters(struct - ieee80211_qos_parameter_info - *param_elm, struct - ieee80211_qos_parameters - *qos_param) + ieee80211_qos_parameter_info + *param_elm, struct + ieee80211_qos_parameters + *qos_param) { - int rc = 0; - int i; - struct ieee80211_qos_ac_parameter *ac_params; + int rc = 0; + int i; + struct ieee80211_qos_ac_parameter *ac_params; u8 aci; - //u8 cw_min; - //u8 cw_max; + //u8 cw_min; + //u8 cw_max; - for (i = 0; i < QOS_QUEUE_NUM; i++) { - ac_params = &(param_elm->ac_params_record[i]); + for (i = 0; i < QOS_QUEUE_NUM; i++) { + ac_params = &(param_elm->ac_params_record[i]); aci = (ac_params->aci_aifsn & 0x60) >> 5; if(aci >= QOS_QUEUE_NUM) continue; - qos_param->aifs[aci] = (ac_params->aci_aifsn) & 0x0f; + qos_param->aifs[aci] = (ac_params->aci_aifsn) & 0x0f; /* WMM spec P.11: The minimum value for AIFSN shall be 2 */ - qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2:qos_param->aifs[aci]; + qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2:qos_param->aifs[aci]; - qos_param->cw_min[aci] = ac_params->ecw_min_max & 0x0F; + qos_param->cw_min[aci] = ac_params->ecw_min_max & 0x0F; - qos_param->cw_max[aci] = (ac_params->ecw_min_max & 0xF0) >> 4; + qos_param->cw_max[aci] = (ac_params->ecw_min_max & 0xF0) >> 4; - qos_param->flag[aci] = - (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00; - qos_param->tx_op_limit[aci] = le16_to_cpu(ac_params->tx_op_limit); - } - return rc; + qos_param->flag[aci] = + (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00; + qos_param->tx_op_limit[aci] = le16_to_cpu(ac_params->tx_op_limit); + } + return rc; } /* @@ -1520,38 +1520,38 @@ static int ieee80211_qos_convert_ac_to_parameters(struct * which type to read */ static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element - *info_element, - struct ieee80211_network *network) + *info_element, + struct ieee80211_network *network) { - int rc = 0; - struct ieee80211_qos_parameters *qos_param = NULL; - struct ieee80211_qos_information_element qos_info_element; - - rc = ieee80211_read_qos_info_element(&qos_info_element, info_element); - - if (rc == 0) { - network->qos_data.param_count = qos_info_element.ac_info & 0x0F; - network->flags |= NETWORK_HAS_QOS_INFORMATION; - } else { - struct ieee80211_qos_parameter_info param_element; - - rc = ieee80211_read_qos_param_element(¶m_element, - info_element); - if (rc == 0) { - qos_param = &(network->qos_data.parameters); - ieee80211_qos_convert_ac_to_parameters(¶m_element, - qos_param); - network->flags |= NETWORK_HAS_QOS_PARAMETERS; - network->qos_data.param_count = - param_element.info_element.ac_info & 0x0F; - } - } - - if (rc == 0) { - IEEE80211_DEBUG_QOS("QoS is supported\n"); - network->qos_data.supported = 1; - } - return rc; + int rc = 0; + struct ieee80211_qos_parameters *qos_param = NULL; + struct ieee80211_qos_information_element qos_info_element; + + rc = ieee80211_read_qos_info_element(&qos_info_element, info_element); + + if (rc == 0) { + network->qos_data.param_count = qos_info_element.ac_info & 0x0F; + network->flags |= NETWORK_HAS_QOS_INFORMATION; + } else { + struct ieee80211_qos_parameter_info param_element; + + rc = ieee80211_read_qos_param_element(¶m_element, + info_element); + if (rc == 0) { + qos_param = &(network->qos_data.parameters); + ieee80211_qos_convert_ac_to_parameters(¶m_element, + qos_param); + network->flags |= NETWORK_HAS_QOS_PARAMETERS; + network->qos_data.param_count = + param_element.info_element.ac_info & 0x0F; + } + } + + if (rc == 0) { + IEEE80211_DEBUG_QOS("QoS is supported\n"); + network->qos_data.supported = 1; + } + return rc; } #ifdef CONFIG_IEEE80211_DEBUG @@ -1559,37 +1559,37 @@ static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element static const char *get_info_element_string(u16 id) { - switch (id) { - MFIE_STRING(SSID); - MFIE_STRING(RATES); - MFIE_STRING(FH_SET); - MFIE_STRING(DS_SET); - MFIE_STRING(CF_SET); - MFIE_STRING(TIM); - MFIE_STRING(IBSS_SET); - MFIE_STRING(COUNTRY); - MFIE_STRING(HOP_PARAMS); - MFIE_STRING(HOP_TABLE); - MFIE_STRING(REQUEST); - MFIE_STRING(CHALLENGE); - MFIE_STRING(POWER_CONSTRAINT); - MFIE_STRING(POWER_CAPABILITY); - MFIE_STRING(TPC_REQUEST); - MFIE_STRING(TPC_REPORT); - MFIE_STRING(SUPP_CHANNELS); - MFIE_STRING(CSA); - MFIE_STRING(MEASURE_REQUEST); - MFIE_STRING(MEASURE_REPORT); - MFIE_STRING(QUIET); - MFIE_STRING(IBSS_DFS); - // MFIE_STRING(ERP_INFO); - MFIE_STRING(RSN); - MFIE_STRING(RATES_EX); - MFIE_STRING(GENERIC); - MFIE_STRING(QOS_PARAMETER); - default: - return "UNKNOWN"; - } + switch (id) { + MFIE_STRING(SSID); + MFIE_STRING(RATES); + MFIE_STRING(FH_SET); + MFIE_STRING(DS_SET); + MFIE_STRING(CF_SET); + MFIE_STRING(TIM); + MFIE_STRING(IBSS_SET); + MFIE_STRING(COUNTRY); + MFIE_STRING(HOP_PARAMS); + MFIE_STRING(HOP_TABLE); + MFIE_STRING(REQUEST); + MFIE_STRING(CHALLENGE); + MFIE_STRING(POWER_CONSTRAINT); + MFIE_STRING(POWER_CAPABILITY); + MFIE_STRING(TPC_REQUEST); + MFIE_STRING(TPC_REPORT); + MFIE_STRING(SUPP_CHANNELS); + MFIE_STRING(CSA); + MFIE_STRING(MEASURE_REQUEST); + MFIE_STRING(MEASURE_REPORT); + MFIE_STRING(QUIET); + MFIE_STRING(IBSS_DFS); + // MFIE_STRING(ERP_INFO); + MFIE_STRING(RSN); + MFIE_STRING(RATES_EX); + MFIE_STRING(GENERIC); + MFIE_STRING(QOS_PARAMETER); + default: + return "UNKNOWN"; + } } #endif @@ -1634,7 +1634,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, { u8 i; short offset; - u16 tmp_htcap_len=0; + u16 tmp_htcap_len=0; u16 tmp_htinfo_len=0; u16 ht_realtek_agg_len=0; u8 ht_realtek_agg_buf[MAX_IE_LEN]; @@ -1752,34 +1752,34 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, network->tim.tim_count = info_element->data[0]; network->tim.tim_period = info_element->data[1]; - network->dtim_period = info_element->data[1]; - if(ieee->state != IEEE80211_LINKED) - break; + network->dtim_period = info_element->data[1]; + if(ieee->state != IEEE80211_LINKED) + break; - network->last_dtim_sta_time[0] = stats->mac_time[0]; - network->last_dtim_sta_time[1] = stats->mac_time[1]; + network->last_dtim_sta_time[0] = stats->mac_time[0]; + network->last_dtim_sta_time[1] = stats->mac_time[1]; - network->dtim_data = IEEE80211_DTIM_VALID; + network->dtim_data = IEEE80211_DTIM_VALID; - if(info_element->data[0] != 0) - break; + if(info_element->data[0] != 0) + break; - if(info_element->data[2] & 1) - network->dtim_data |= IEEE80211_DTIM_MBCAST; + if(info_element->data[2] & 1) + network->dtim_data |= IEEE80211_DTIM_MBCAST; - offset = (info_element->data[2] >> 1)*2; + offset = (info_element->data[2] >> 1)*2; - //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); + //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); - if(ieee->assoc_id < 8*offset || - ieee->assoc_id > 8*(offset + info_element->len -3)) + if(ieee->assoc_id < 8*offset || + ieee->assoc_id > 8*(offset + info_element->len -3)) - break; + break; - offset = (ieee->assoc_id / 8) - offset;// + ((aid % 8)? 0 : 1) ; + offset = (ieee->assoc_id / 8) - offset;// + ((aid % 8)? 0 : 1) ; - if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) - network->dtim_data |= IEEE80211_DTIM_UCAST; + if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) + network->dtim_data |= IEEE80211_DTIM_UCAST; //IEEE80211_DEBUG_MGMT("MFIE_TYPE_TIM: partially ignored\n"); break; @@ -1820,17 +1820,17 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, } #ifdef THOMAS_TURBO - if (info_element->len == 7 && - info_element->data[0] == 0x00 && - info_element->data[1] == 0xe0 && - info_element->data[2] == 0x4c && - info_element->data[3] == 0x01 && - info_element->data[4] == 0x02) { - network->Turbo_Enable = 1; - } + if (info_element->len == 7 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0xe0 && + info_element->data[2] == 0x4c && + info_element->data[3] == 0x01 && + info_element->data[4] == 0x02) { + network->Turbo_Enable = 1; + } #endif - //for HTcap and HTinfo parameters + //for HTcap and HTinfo parameters if(tmp_htcap_len == 0){ if(info_element->len >= 4 && info_element->data[0] == 0x00 && @@ -1839,12 +1839,12 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, info_element->data[3] == 0x033){ tmp_htcap_len = min(info_element->len,(u8)MAX_IE_LEN); - if(tmp_htcap_len != 0){ - network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; + if(tmp_htcap_len != 0){ + network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf)?\ sizeof(network->bssht.bdHTCapBuf):tmp_htcap_len; memcpy(network->bssht.bdHTCapBuf,info_element->data,network->bssht.bdHTCapLen); - } + } } if(tmp_htcap_len != 0) network->bssht.bdSupportHT = true; @@ -1856,9 +1856,9 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, if(tmp_htinfo_len == 0){ if(info_element->len >= 4 && info_element->data[0] == 0x00 && - info_element->data[1] == 0x90 && - info_element->data[2] == 0x4c && - info_element->data[3] == 0x034){ + info_element->data[1] == 0x90 && + info_element->data[2] == 0x4c && + info_element->data[3] == 0x034){ tmp_htinfo_len = min(info_element->len,(u8)MAX_IE_LEN); if(tmp_htinfo_len != 0){ @@ -2014,7 +2014,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, network->rsn_ie_len); break; - //HT related element. + //HT related element. case MFIE_TYPE_HT_CAP: IEEE80211_DEBUG_SCAN("MFIE_TYPE_HT_CAP: %d bytes\n", info_element->len); @@ -2027,7 +2027,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, //If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT() // windows driver will update WMM parameters each beacon received once connected - // Linux driver is a bit different. + // Linux driver is a bit different. network->bssht.bdSupportHT = true; } else @@ -2060,7 +2060,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, if( (info_element->data[IE_CISCO_FLAG_POSITION]&SUPPORT_CKIP_MIC) || (info_element->data[IE_CISCO_FLAG_POSITION]&SUPPORT_CKIP_PK) ) { - network->bCkipSupported = true; + network->bCkipSupported = true; } else { @@ -2070,7 +2070,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, else { network->bWithAironetIE = false; - network->bCkipSupported = false; + network->bCkipSupported = false; } break; case MFIE_TYPE_QOS_PARAMETER: @@ -2189,10 +2189,10 @@ static inline int ieee80211_network_init( //char *p; #endif - network->qos_data.active = 0; - network->qos_data.supported = 0; - network->qos_data.param_count = 0; - network->qos_data.old_param_count = 0; + network->qos_data.active = 0; + network->qos_data.supported = 0; + network->qos_data.param_count = 0; + network->qos_data.old_param_count = 0; /* Pull out fixed field data */ memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); @@ -2209,9 +2209,9 @@ static inline int ieee80211_network_init( network->flags = 0; network->atim_window = 0; network->erp_value = (network->capability & WLAN_CAPABILITY_IBSS) ? - 0x3 : 0x0; + 0x3 : 0x0; network->berp_info_valid = false; - network->broadcom_cap_exist = false; + network->broadcom_cap_exist = false; network->ralink_cap_exist = false; network->atheros_cap_exist = false; network->cisco_cap_exist = false; @@ -2230,12 +2230,12 @@ static inline int ieee80211_network_init( } else network->flags |= NETWORK_HAS_CCK; - network->wpa_ie_len = 0; - network->rsn_ie_len = 0; + network->wpa_ie_len = 0; + network->rsn_ie_len = 0; - if (ieee80211_parse_info_param - (ieee,beacon->info_element, stats->len - sizeof(*beacon), network, stats)) - return 1; + if (ieee80211_parse_info_param + (ieee,beacon->info_element, stats->len - sizeof(*beacon), network, stats)) + return 1; network->mode = 0; if (stats->freq == IEEE80211_52GHZ_BAND) @@ -2329,7 +2329,7 @@ static inline void update_network(struct ieee80211_network *dst, dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1]; memcpy(&dst->tim, &src->tim, sizeof(struct ieee80211_tim_parameters)); - dst->bssht.bdSupportHT = src->bssht.bdSupportHT; + dst->bssht.bdSupportHT = src->bssht.bdSupportHT; dst->bssht.bdRT2RTAggregation = src->bssht.bdRT2RTAggregation; dst->bssht.bdHTCapLen= src->bssht.bdHTCapLen; memcpy(dst->bssht.bdHTCapBuf,src->bssht.bdHTCapBuf,src->bssht.bdHTCapLen); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 7a0707810fd0..454f8895d211 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -498,7 +498,7 @@ void ieee80211_softmac_scan_wq(struct work_struct *work) { struct delayed_work *dwork = container_of(work, struct delayed_work, work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); - static short watchdog = 0; + static short watchdog; u8 channel_map[MAX_CHANNEL_NUMBER+1]; memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); if(!ieee->ieee_up) @@ -1948,166 +1948,166 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { - case IEEE80211_STYPE_ASSOC_RESP: - case IEEE80211_STYPE_REASSOC_RESP: - - IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", - WLAN_FC_GET_STYPE(header->frame_ctl)); - if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && - ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && - ieee->iw_mode == IW_MODE_INFRA){ - struct ieee80211_network network_resp; - struct ieee80211_network *network = &network_resp; - - if (0 == (errcode=assoc_parse(ieee,skb, &aid))){ - ieee->state=IEEE80211_LINKED; - ieee->assoc_id = aid; - ieee->softmac_stats.rx_ass_ok++; - /* station support qos */ - /* Let the register setting defaultly with Legacy station */ - if(ieee->qos_support) { - assoc_resp = (struct ieee80211_assoc_response_frame*)skb->data; - memset(network, 0, sizeof(*network)); - if (ieee80211_parse_info_param(ieee,assoc_resp->info_element,\ - rx_stats->len - sizeof(*assoc_resp),\ - network,rx_stats)){ - return 1; - } - else - { //filling the PeerHTCap. //maybe not necessary as we can get its info from current_network. - memcpy(ieee->pHTInfo->PeerHTCapBuf, network->bssht.bdHTCapBuf, network->bssht.bdHTCapLen); - memcpy(ieee->pHTInfo->PeerHTInfoBuf, network->bssht.bdHTInfoBuf, network->bssht.bdHTInfoLen); - } - if (ieee->handle_assoc_response != NULL) - ieee->handle_assoc_response(ieee->dev, (struct ieee80211_assoc_response_frame*)header, network); + case IEEE80211_STYPE_ASSOC_RESP: + case IEEE80211_STYPE_REASSOC_RESP: + + IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", + WLAN_FC_GET_STYPE(header->frame_ctl)); + if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && + ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && + ieee->iw_mode == IW_MODE_INFRA){ + struct ieee80211_network network_resp; + struct ieee80211_network *network = &network_resp; + + if (0 == (errcode=assoc_parse(ieee,skb, &aid))){ + ieee->state=IEEE80211_LINKED; + ieee->assoc_id = aid; + ieee->softmac_stats.rx_ass_ok++; + /* station support qos */ + /* Let the register setting defaultly with Legacy station */ + if(ieee->qos_support) { + assoc_resp = (struct ieee80211_assoc_response_frame*)skb->data; + memset(network, 0, sizeof(*network)); + if (ieee80211_parse_info_param(ieee,assoc_resp->info_element,\ + rx_stats->len - sizeof(*assoc_resp),\ + network,rx_stats)){ + return 1; } - ieee80211_associate_complete(ieee); - } else { - /* aid could not been allocated */ - ieee->softmac_stats.rx_ass_err++; - printk( - "Association response status code 0x%x\n", - errcode); - IEEE80211_DEBUG_MGMT( - "Association response status code 0x%x\n", - errcode); - if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) { - queue_work(ieee->wq, &ieee->associate_procedure_wq); - } else { - ieee80211_associate_abort(ieee); + else + { //filling the PeerHTCap. //maybe not necessary as we can get its info from current_network. + memcpy(ieee->pHTInfo->PeerHTCapBuf, network->bssht.bdHTCapBuf, network->bssht.bdHTCapLen); + memcpy(ieee->pHTInfo->PeerHTInfoBuf, network->bssht.bdHTInfoBuf, network->bssht.bdHTInfoLen); } + if (ieee->handle_assoc_response != NULL) + ieee->handle_assoc_response(ieee->dev, (struct ieee80211_assoc_response_frame*)header, network); + } + ieee80211_associate_complete(ieee); + } else { + /* aid could not been allocated */ + ieee->softmac_stats.rx_ass_err++; + printk( + "Association response status code 0x%x\n", + errcode); + IEEE80211_DEBUG_MGMT( + "Association response status code 0x%x\n", + errcode); + if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) { + queue_work(ieee->wq, &ieee->associate_procedure_wq); + } else { + ieee80211_associate_abort(ieee); } } - break; + } + break; - case IEEE80211_STYPE_ASSOC_REQ: - case IEEE80211_STYPE_REASSOC_REQ: + case IEEE80211_STYPE_ASSOC_REQ: + case IEEE80211_STYPE_REASSOC_REQ: - if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && - ieee->iw_mode == IW_MODE_MASTER) + if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && + ieee->iw_mode == IW_MODE_MASTER) - ieee80211_rx_assoc_rq(ieee, skb); - break; + ieee80211_rx_assoc_rq(ieee, skb); + break; - case IEEE80211_STYPE_AUTH: + case IEEE80211_STYPE_AUTH: - if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ - if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && - ieee->iw_mode == IW_MODE_INFRA){ + if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ + if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && + ieee->iw_mode == IW_MODE_INFRA){ - IEEE80211_DEBUG_MGMT("Received authentication response"); + IEEE80211_DEBUG_MGMT("Received authentication response"); - if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){ - if(ieee->open_wep || !challenge){ - ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; - ieee->softmac_stats.rx_auth_rs_ok++; - if(!(ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE)) + if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){ + if(ieee->open_wep || !challenge){ + ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; + ieee->softmac_stats.rx_auth_rs_ok++; + if(!(ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE)) + { + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) + // WEP or TKIP encryption + if(IsHTHalfNmodeAPs(ieee)) { - // WEP or TKIP encryption - if(IsHTHalfNmodeAPs(ieee)) - { - bSupportNmode = true; - bHalfSupportNmode = true; - } - else - { - bSupportNmode = false; - bHalfSupportNmode = false; - } - printk("==========>to link with AP using SEC(%d, %d)", bSupportNmode, bHalfSupportNmode); + bSupportNmode = true; + bHalfSupportNmode = true; } + else + { + bSupportNmode = false; + bHalfSupportNmode = false; + } + printk("==========>to link with AP using SEC(%d, %d)", bSupportNmode, bHalfSupportNmode); } - /* Dummy wirless mode setting to avoid encryption issue */ - if(bSupportNmode) { - //N mode setting - ieee->SetWirelessMode(ieee->dev, \ - ieee->current_network.mode); - }else{ - //b/g mode setting - /*TODO*/ - ieee->SetWirelessMode(ieee->dev, IEEE_G); - } - - if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode == true) - { - printk("===============>entern half N mode\n"); - ieee->bHalfWirelessN24GMode = true; - } - else - ieee->bHalfWirelessN24GMode = false; - - ieee80211_associate_step2(ieee); + } + /* Dummy wirless mode setting to avoid encryption issue */ + if(bSupportNmode) { + //N mode setting + ieee->SetWirelessMode(ieee->dev, \ + ieee->current_network.mode); }else{ - ieee80211_auth_challenge(ieee, challenge, chlen); + //b/g mode setting + /*TODO*/ + ieee->SetWirelessMode(ieee->dev, IEEE_G); } + + if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode == true) + { + printk("===============>entern half N mode\n"); + ieee->bHalfWirelessN24GMode = true; + } + else + ieee->bHalfWirelessN24GMode = false; + + ieee80211_associate_step2(ieee); }else{ - ieee->softmac_stats.rx_auth_rs_err++; - IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x",errcode); - ieee80211_associate_abort(ieee); + ieee80211_auth_challenge(ieee, challenge, chlen); } - - }else if (ieee->iw_mode == IW_MODE_MASTER){ - ieee80211_rx_auth_rq(ieee, skb); + }else{ + ieee->softmac_stats.rx_auth_rs_err++; + IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x",errcode); + ieee80211_associate_abort(ieee); } + + }else if (ieee->iw_mode == IW_MODE_MASTER){ + ieee80211_rx_auth_rq(ieee, skb); } - break; + } + break; - case IEEE80211_STYPE_PROBE_REQ: + case IEEE80211_STYPE_PROBE_REQ: - if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && - ((ieee->iw_mode == IW_MODE_ADHOC || - ieee->iw_mode == IW_MODE_MASTER) && - ieee->state == IEEE80211_LINKED)){ - ieee80211_rx_probe_rq(ieee, skb); - } - break; + if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && + ((ieee->iw_mode == IW_MODE_ADHOC || + ieee->iw_mode == IW_MODE_MASTER) && + ieee->state == IEEE80211_LINKED)){ + ieee80211_rx_probe_rq(ieee, skb); + } + break; - case IEEE80211_STYPE_DISASSOC: - case IEEE80211_STYPE_DEAUTH: - /* FIXME for now repeat all the association procedure - * both for disassociation and deauthentication - */ - if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && - ieee->state == IEEE80211_LINKED && - ieee->iw_mode == IW_MODE_INFRA){ - - ieee->state = IEEE80211_ASSOCIATING; - ieee->softmac_stats.reassoc++; - - notify_wx_assoc_event(ieee); - //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); - RemovePeerTS(ieee, header->addr2); - queue_work(ieee->wq, &ieee->associate_procedure_wq); - } - break; - case IEEE80211_STYPE_MANAGE_ACT: - ieee80211_process_action(ieee,skb); - break; - default: - return -1; - break; + case IEEE80211_STYPE_DISASSOC: + case IEEE80211_STYPE_DEAUTH: + /* FIXME for now repeat all the association procedure + * both for disassociation and deauthentication + */ + if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && + ieee->state == IEEE80211_LINKED && + ieee->iw_mode == IW_MODE_INFRA){ + + ieee->state = IEEE80211_ASSOCIATING; + ieee->softmac_stats.reassoc++; + + notify_wx_assoc_event(ieee); + //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + RemovePeerTS(ieee, header->addr2); + queue_work(ieee->wq, &ieee->associate_procedure_wq); + } + break; + case IEEE80211_STYPE_MANAGE_ACT: + ieee80211_process_action(ieee,skb); + break; + default: + return -1; + break; } //dev_kfree_skb_any(skb); @@ -2503,8 +2503,8 @@ void ieee80211_disassociate(struct ieee80211_device *ieee) } void ieee80211_associate_retry_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); - struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); + struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); unsigned long flags; down(&ieee->wx_sem); @@ -3124,7 +3124,7 @@ inline struct sk_buff *ieee80211_disassociate_skb( void SendDisassociation( struct ieee80211_device *ieee, - u8* asSta, + u8* asSta, u8 asRsn ) { diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index 421da8a07697..45422db81488 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -302,7 +302,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work) HT_EXTCHNL_OFFSET chan_offset=0; HT_CHANNEL_WIDTH bandwidth=0; int b40M = 0; - static int count = 0; + static int count; chan = ieee->current_network.channel; netif_carrier_off(ieee->dev); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 3f5ceeb88b6c..c39e680bb0ac 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -70,7 +70,7 @@ val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | '-----------------------------------------------------------------------------------------' - /\ + /\ | 802.11 Data Frame | ,--------- 'ctrl' expands to >-----------' @@ -283,22 +283,22 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); ip = ip_hdr(skb); switch (ip->tos & 0xfc) { - case 0x20: - return 2; - case 0x40: - return 1; - case 0x60: - return 3; - case 0x80: - return 4; - case 0xa0: - return 5; - case 0xc0: - return 6; - case 0xe0: - return 7; - default: - return 0; + case 0x20: + return 2; + case 0x40: + return 1; + case 0x60: + return 3; + case 0x80: + return 4; + case 0xa0: + return 5; + case 0xc0: + return 6; + case 0xe0: + return 7; + default: + return 0; } } @@ -395,7 +395,7 @@ ieee80211_query_HTCapShortGI(struct ieee80211_device *ieee, cb_desc *tcb_desc) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; - tcb_desc->bUseShortGI = false; + tcb_desc->bUseShortGI = false; if(!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) return; @@ -514,7 +514,7 @@ void ieee80211_query_protectionmode(struct ieee80211_device* ieee, cb_desc* tcb_ if(pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) { tcb_desc->bCTSEnable = true; - tcb_desc->rts_rate = MGN_24M; + tcb_desc->rts_rate = MGN_24M; tcb_desc->bRTSEnable = true; break; } @@ -527,7 +527,7 @@ void ieee80211_query_protectionmode(struct ieee80211_device* ieee, cb_desc* tcb_ { tcb_desc->bCTSEnable = true; tcb_desc->rts_rate = MGN_24M; - tcb_desc->bRTSEnable = true; + tcb_desc->bRTSEnable = true; } if (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE) tcb_desc->bUseShortPreamble = true; @@ -656,17 +656,17 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) memcpy(&dest, skb->data, ETH_ALEN); memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN); - /* Advance the SKB to the start of the payload */ - skb_pull(skb, sizeof(struct ethhdr)); + /* Advance the SKB to the start of the payload */ + skb_pull(skb, sizeof(struct ethhdr)); - /* Determine total amount of storage required for TXB packets */ - bytes = skb->len + SNAP_SIZE + sizeof(u16); + /* Determine total amount of storage required for TXB packets */ + bytes = skb->len + SNAP_SIZE + sizeof(u16); if (encrypt) fc = IEEE80211_FTYPE_DATA | IEEE80211_FCTL_WEP; else - fc = IEEE80211_FTYPE_DATA; + fc = IEEE80211_FTYPE_DATA; //if(ieee->current_network.QoS_Enable) if(qos_actived) @@ -689,7 +689,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); } - header.frame_ctl = cpu_to_le16(fc); + header.frame_ctl = cpu_to_le16(fc); /* Determine fragmentation size based on destination (multicast * and broadcast are not fragmented) */ @@ -833,7 +833,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) else ieee->seq_ctrl[UP2AC(skb->priority) + 1]++; } else { - if (ieee->seq_ctrl[0] == 0xFFF) + if (ieee->seq_ctrl[0] == 0xFFF) ieee->seq_ctrl[0] = 0; else ieee->seq_ctrl[0]++; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index f0ba7f467493..e1fe54acb4b8 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -761,7 +761,7 @@ int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, case IW_MLME_DISASSOC: ieee80211_disassociate(ieee); break; - default: + default: return -EOPNOTSUPP; } return 0; diff --git a/drivers/staging/rtl8192u/ieee80211/internal.h b/drivers/staging/rtl8192u/ieee80211/internal.h index bebe13ac53b7..6f54cfe8a467 100644 --- a/drivers/staging/rtl8192u/ieee80211/internal.h +++ b/drivers/staging/rtl8192u/ieee80211/internal.h @@ -79,4 +79,3 @@ void crypto_exit_cipher_ops(struct crypto_tfm *tfm); void crypto_exit_compress_ops(struct crypto_tfm *tfm); #endif /* _CRYPTO_INTERNAL_H */ - diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h index 8ddc8bf9dc26..2c398ca9a8ac 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h @@ -1,7 +1,7 @@ #ifndef _BATYPE_H_ #define _BATYPE_H_ -#define TOTAL_TXBA_NUM 16 +#define TOTAL_TXBA_NUM 16 #define TOTAL_RXBA_NUM 16 #define BA_SETUP_TIMEOUT 200 @@ -28,8 +28,7 @@ struct ieee80211_ADDBA_Req{ //Is this need?I put here just to make it easier to define structure BA_RECORD //WB typedef union _SEQUENCE_CONTROL{ u16 ShortData; - struct - { + struct { u16 FragNum:4; u16 SeqNum:12; }field; @@ -66,4 +65,3 @@ typedef struct _BA_RECORD { } BA_RECORD, *PBA_RECORD; #endif //end _BATYPE_H_ - diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 1ebea3daea2d..69735d320315 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -9,8 +9,8 @@ /******************************************************************************************************************** *function: Activate BA entry. And if Time is nozero, start timer. - * input: PBA_RECORD pBA //BA entry to be enabled - * u16 Time //indicate time delay. + * input: PBA_RECORD pBA //BA entry to be enabled + * u16 Time //indicate time delay. * output: none ********************************************************************************************************************/ void ActivateBAEntry(struct ieee80211_device* ieee, PBA_RECORD pBA, u16 Time) @@ -22,7 +22,7 @@ void ActivateBAEntry(struct ieee80211_device* ieee, PBA_RECORD pBA, u16 Time) /******************************************************************************************************************** *function: deactivate BA entry, including its timer. - * input: PBA_RECORD pBA //BA entry to be disabled + * input: PBA_RECORD pBA //BA entry to be disabled * output: none ********************************************************************************************************************/ void DeActivateBAEntry( struct ieee80211_device* ieee, PBA_RECORD pBA) @@ -33,7 +33,7 @@ void DeActivateBAEntry( struct ieee80211_device* ieee, PBA_RECORD pBA) /******************************************************************************************************************** *function: deactivete BA entry in Tx Ts, and send DELBA. * input: - * PTX_TS_RECORD pTxTs //Tx Ts which is to deactivate BA entry. + * PTX_TS_RECORD pTxTs //Tx Ts which is to deactivate BA entry. * output: none * notice: As PTX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME ********************************************************************************************************************/ @@ -63,7 +63,7 @@ u8 TxTsDeleteBA( struct ieee80211_device* ieee, PTX_TS_RECORD pTxTs) /******************************************************************************************************************** *function: deactivete BA entry in Tx Ts, and send DELBA. * input: - * PRX_TS_RECORD pRxTs //Rx Ts which is to deactivate BA entry. + * PRX_TS_RECORD pRxTs //Rx Ts which is to deactivate BA entry. * output: none * notice: As PRX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME, same with above ********************************************************************************************************************/ @@ -84,7 +84,7 @@ u8 RxTsDeleteBA( struct ieee80211_device* ieee, PRX_TS_RECORD pRxTs) /******************************************************************************************************************** *function: reset BA entry * input: - * PBA_RECORD pBA //entry to be reset + * PBA_RECORD pBA //entry to be reset * output: none ********************************************************************************************************************/ void ResetBaEntry( PBA_RECORD pBA) @@ -98,12 +98,12 @@ void ResetBaEntry( PBA_RECORD pBA) //These functions need porting here or not? /******************************************************************************************************************************* *function: construct ADDBAREQ and ADDBARSP frame here together. - * input: u8* Dst //ADDBA frame's destination - * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA. - * u16 StatusCode //status code in RSP and I will use it to indicate whether it's RSP or REQ(will I?) - * u8 type //indicate whether it's RSP(ACT_ADDBARSP) ow REQ(ACT_ADDBAREQ) + * input: u8* Dst //ADDBA frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA. + * u16 StatusCode //status code in RSP and I will use it to indicate whether it's RSP or REQ(will I?) + * u8 type //indicate whether it's RSP(ACT_ADDBARSP) ow REQ(ACT_ADDBAREQ) * output: none - * return: sk_buff* skb //return constructed skb to xmit + * return: sk_buff* skb //return constructed skb to xmit *******************************************************************************************************************************/ static struct sk_buff* ieee80211_ADDBA(struct ieee80211_device* ieee, u8* Dst, PBA_RECORD pBA, u16 StatusCode, u8 type) { @@ -126,7 +126,7 @@ static struct sk_buff* ieee80211_ADDBA(struct ieee80211_device* ieee, u8* Dst, P return NULL; } - memset(skb->data, 0, sizeof( struct ieee80211_hdr_3addr)); //I wonder whether it's necessary. Apparently kernel will not do it when alloc a skb. + memset(skb->data, 0, sizeof( struct ieee80211_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 ieee80211_hdr_3addr *) skb_put(skb,sizeof( struct ieee80211_hdr_3addr)); @@ -177,12 +177,12 @@ static struct sk_buff* ieee80211_ADDBA(struct ieee80211_device* ieee, u8* Dst, P /******************************************************************************************************************** *function: construct DELBA frame - * input: u8* dst //DELBA frame's destination - * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA - * TR_SELECT TxRxSelect //TX RX direction - * u16 ReasonCode //status code. + * input: u8* dst //DELBA frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA + * TR_SELECT TxRxSelect //TX RX direction + * u16 ReasonCode //status code. * output: none - * return: sk_buff* skb //return constructed skb to xmit + * return: sk_buff* skb //return constructed skb to xmit ********************************************************************************************************************/ static struct sk_buff* ieee80211_DELBA( struct ieee80211_device* ieee, @@ -246,8 +246,8 @@ static struct sk_buff* ieee80211_DELBA( /******************************************************************************************************************** *function: send ADDBAReq frame out - * input: u8* dst //ADDBAReq frame's destination - * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA + * input: u8* dst //ADDBAReq frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does ********************************************************************************************************************/ @@ -272,9 +272,9 @@ void ieee80211_send_ADDBAReq(struct ieee80211_device* ieee, u8* dst, PBA_RECORD /******************************************************************************************************************** *function: send ADDBARSP frame out - * input: u8* dst //DELBA frame's destination - * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA - * u16 StatusCode //RSP StatusCode + * input: u8* dst //DELBA frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA + * u16 StatusCode //RSP StatusCode * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does ********************************************************************************************************************/ @@ -297,10 +297,10 @@ void ieee80211_send_ADDBARsp(struct ieee80211_device* ieee, u8* dst, PBA_RECORD } /******************************************************************************************************************** *function: send ADDBARSP frame out - * input: u8* dst //DELBA frame's destination - * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA - * TR_SELECT TxRxSelect //TX or RX - * u16 ReasonCode //DEL ReasonCode + * input: u8* dst //DELBA frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA + * TR_SELECT TxRxSelect //TX or RX + * u16 ReasonCode //DEL ReasonCode * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does ********************************************************************************************************************/ @@ -340,7 +340,7 @@ int ieee80211_rx_ADDBAReq( struct ieee80211_device* ieee, struct sk_buff *skb) if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9) { - IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BAREQ(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); + IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BAREQ(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); return -1; } @@ -439,7 +439,7 @@ int ieee80211_rx_ADDBARsp( struct ieee80211_device* ieee, struct sk_buff *skb) if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9) { - IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BARSP(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); + IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BARSP(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); return -1; } rsp = ( struct ieee80211_hdr_3addr*)skb->data; @@ -569,7 +569,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb) if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 6) { - IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in DELBA(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 6)); + IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in DELBA(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 6)); return -1; } @@ -589,7 +589,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb) if(pDelBaParamSet->field.Initiator == 1) { - PRX_TS_RECORD pRxTs; + PRX_TS_RECORD pRxTs; if( !GetTs( ieee, @@ -657,7 +657,7 @@ TsInitAddBA( // BufferSize: This need to be set according to A-MPDU vector pBA->BaParamSet.field.BufferSize = 32; // BufferSize: This need to be set according to A-MPDU vector pBA->BaTimeoutValue = 0; // Timeout value: Set 0 to disable Timer - pBA->BaStartSeqCtrl.field.SeqNum = (pTS->TxCurSeq + 3) % 4096; // Block Ack will start after 3 packets later. + pBA->BaStartSeqCtrl.field.SeqNum = (pTS->TxCurSeq + 3) % 4096; // Block Ack will start after 3 packets later. ActivateBAEntry(ieee, pBA, BA_SETUP_TIMEOUT); @@ -734,4 +734,3 @@ void RxBaInactTimeout(unsigned long data) DELBA_REASON_TIMEOUT); return ; } - diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h index a60b39cdb472..2b8283534be4 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h @@ -121,7 +121,7 @@ typedef union _HT_CAPABILITY_MACPARA{ typedef enum _HT_ACTION{ ACT_RECOMMAND_WIDTH = 0, - ACT_MIMO_PWR_SAVE = 1, + ACT_MIMO_PWR_SAVE = 1, ACT_PSMP = 2, ACT_SET_PCO_PHASE = 3, ACT_MIMO_CHL_MEASURE = 4, @@ -398,9 +398,9 @@ typedef struct _BSS_HT{ typedef struct _MIMO_RSSI{ u32 EnableAntenna; u32 AntennaA; - u32 AntennaB; - u32 AntennaC; - u32 AntennaD; + u32 AntennaB; + u32 AntennaC; + u32 AntennaD; u32 Average; }MIMO_RSSI, *PMIMO_RSSI; @@ -436,11 +436,11 @@ extern u8 MCS_FILTER_1SS[16]; // MCS Bw 40 {1~7, 12~15,32} -#define RATE_ADPT_1SS_MASK 0xFF +#define RATE_ADPT_1SS_MASK 0xFF #define RATE_ADPT_2SS_MASK 0xF0 //Skip MCS8~11 because mcs7 > mcs6, 9, 10, 11. 2007.01.16 by Emily #define RATE_ADPT_MCS32_MASK 0x01 -#define IS_11N_MCS_RATE(rate) (rate&0x80) +#define IS_11N_MCS_RATE(rate) (rate&0x80) typedef enum _HT_AGGRE_SIZE{ HT_AGG_SIZE_8K = 0, @@ -478,4 +478,3 @@ typedef enum _HT_IOT_ACTION{ }HT_IOT_ACTION_E, *PHT_IOT_ACTION_E; #endif //_RTL819XU_HTTYPE_H_ - diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index ebb523904edc..268b270e9495 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -21,7 +21,7 @@ u16 MCS_DATA_RATE[2][2][77] = 81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 648, 864, 972, 1080, 12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 378, 378, 432, 324, 405, 405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 486, 432, 486, 540, 540, - 594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 810, 891}, // Long GI, 40MHz + 594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 810, 891}, // Long GI, 40MHz {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, 90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 720, 960, 1080, 1200, 13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 420, 420, 480, 360, 450, @@ -88,7 +88,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device* ieee) ieee->bTxDisableRateFallBack = 0; ieee->bTxUseDriverAssingedRate = 0; -#ifdef TO_DO_LIST +#ifdef TO_DO_LIST // 8190 only. Assign duration operation mode to firmware pMgntInfo->bTxEnableFwCalcDur = (BOOLEAN)pNdisCommon->bRegTxEnableFwCalcDur; #endif @@ -116,7 +116,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device* ieee) /******************************************************************************************************************** *function: This function print out each field on HT capability IE mainly from (Beacon/ProbeRsp/AssocReq) * input: u8* CapIE //Capability IE to be printed out - * u8* TitleString //mainly print out caller function + * u8* TitleString //mainly print out caller function * output: none * return: none * notice: Driver should not print out this message by default. @@ -125,7 +125,7 @@ void HTDebugHTCapability(u8* CapIE, u8* TitleString ) { static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily - PHT_CAPABILITY_ELE pCapELE; + PHT_CAPABILITY_ELE pCapELE; if(!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) { @@ -153,7 +153,7 @@ void HTDebugHTCapability(u8* CapIE, u8* TitleString ) /******************************************************************************************************************** *function: This function print out each field on HT Information IE mainly from (Beacon/ProbeRsp) * input: u8* InfoIE //Capability IE to be printed out - * u8* TitleString //mainly print out caller function + * u8* TitleString //mainly print out caller function * output: none * return: none * notice: Driver should not print out this message by default. @@ -217,7 +217,7 @@ void HTDebugHTInfo(u8* InfoIE, u8* TitleString) } /* -* Return: true if station in half n mode and AP supports 40 bw +* Return: true if station in half n mode and AP supports 40 bw */ bool IsHTHalfNmode40Bandwidth(struct ieee80211_device* ieee) { @@ -228,7 +228,7 @@ bool IsHTHalfNmode40Bandwidth(struct ieee80211_device* ieee) retValue = false; else if(pHTInfo->bRegBW40MHz == false) // station supports 40 bw retValue = false; - else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode + else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode retValue = false; else if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap support 40 bw retValue = true; @@ -245,7 +245,7 @@ bool IsHTHalfNmodeSGI(struct ieee80211_device* ieee, bool is40MHz) if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode retValue = false; - else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode + else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode retValue = false; else if(is40MHz) // ap support 40 bw { @@ -265,7 +265,7 @@ bool IsHTHalfNmodeSGI(struct ieee80211_device* ieee, bool is40MHz) return retValue; } -u16 HTHalfMcsToDataRate(struct ieee80211_device* ieee, u8 nMcsRate) +u16 HTHalfMcsToDataRate(struct ieee80211_device* ieee, u8 nMcsRate) { u8 is40MHz; @@ -291,8 +291,8 @@ u16 HTMcsToDataRate( struct ieee80211_device* ieee, u8 nMcsRate) /******************************************************************************************************************** *function: This function returns current datarate. - * input: struct ieee80211_device* ieee - * u8 nDataRate + * input: struct ieee80211_device* ieee + * u8 nDataRate * output: none * return: tx rate * notice: quite unsure about how to use this function //wb @@ -371,7 +371,7 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee) /******************************************************************************************************************** *function: This function returns peer IOT. - * input: struct ieee80211_device* ieee + * input: struct ieee80211_device* ieee * output: none * return: * notice: @@ -408,8 +408,8 @@ void HTIOTPeerDetermine(struct ieee80211_device* ieee) /******************************************************************************************************************** *function: Check whether driver should declare received rate up to MCS13 only since some chipset is not good * at receiving MCS14~15 frame from some AP. - * input: struct ieee80211_device* ieee - * u8 * PeerMacAddr + * input: struct ieee80211_device* ieee + * u8 * PeerMacAddr * output: none * return: return 1 if driver should declare MCS13 only(otherwise return 0) * *****************************************************************************************************************/ @@ -429,7 +429,7 @@ u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr) * PADAPTER Adapter, * * Output: None -* Return: true if driver should disable MCS15 +* Return: true if driver should disable MCS15 * 2008.04.15 Emily */ bool HTIOTActIsDisableMCS15(struct ieee80211_device* ieee) @@ -466,7 +466,7 @@ bool HTIOTActIsDisableMCS15(struct ieee80211_device* ieee) * PADAPTER Adapter, * * Output: None -* Return: true if driver should disable all two spatial stream packet +* Return: true if driver should disable all two spatial stream packet * 2008.04.21 Emily */ bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device* ieee, u8 *PeerMacAddr) @@ -481,12 +481,12 @@ bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device* ieee, u8 *Pee /******************************************************************************************************************** *function: Check whether driver should disable EDCA turbo mode - * input: struct ieee80211_device* ieee - * u8* PeerMacAddr + * input: struct ieee80211_device* ieee + * u8* PeerMacAddr * output: none * return: return 1 if driver should disable EDCA turbo mode(otherwise return 0) * *****************************************************************************************************************/ -u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device* ieee, u8* PeerMacAddr) +u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device* ieee, u8* PeerMacAddr) { u8 retValue = false; // default enable EDCA Turbo mode. // Set specific EDCA parameter for different AP in DM handler. @@ -539,10 +539,10 @@ void HTResetIOTSetting( /******************************************************************************************************************** *function: Construct Capablility Element in Beacon... if HTEnable is turned on - * input: struct ieee80211_device* ieee - * u8* posHTCap //pointer to store Capability Ele - * u8* len //store length of CE - * u8 IsEncrypt //whether encrypt, needed further + * input: struct ieee80211_device* ieee + * u8* posHTCap //pointer to store Capability Ele + * u8* len //store length of CE + * u8 IsEncrypt //whether encrypt, needed further * output: none * return: none * notice: posHTCap can't be null and should be initialized before. @@ -550,7 +550,7 @@ void HTResetIOTSetting( void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u8* len, u8 IsEncrypt) { PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo; - PHT_CAPABILITY_ELE pCapELE = NULL; + PHT_CAPABILITY_ELE pCapELE = NULL; //u8 bIsDeclareMCS13; if ((posHTCap == NULL) || (pHT == NULL)) @@ -571,7 +571,7 @@ void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u //HT capability info - pCapELE->AdvCoding = 0; // This feature is not supported now!! + pCapELE->AdvCoding = 0; // This feature is not supported now!! if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) { pCapELE->ChlWidth = 0; @@ -581,18 +581,18 @@ void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0); } -// pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0); - pCapELE->MimoPwrSave = pHT->SelfMimoPs; +// pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0); + pCapELE->MimoPwrSave = pHT->SelfMimoPs; pCapELE->GreenField = 0; // This feature is not supported now!! pCapELE->ShortGI20Mhz = 1; // We can receive Short GI!! pCapELE->ShortGI40Mhz = 1; // We can receive Short GI!! //DbgPrint("TX HT cap/info ele BW=%d SG20=%d SG40=%d\n\r", //pCapELE->ChlWidth, pCapELE->ShortGI20Mhz, pCapELE->ShortGI40Mhz); - pCapELE->TxSTBC = 1; - pCapELE->RxSTBC = 0; + pCapELE->TxSTBC = 1; + pCapELE->RxSTBC = 0; pCapELE->DelayBA = 0; // Do not support now!! pCapELE->MaxAMSDUSize = (MAX_RECEIVE_BUFFER_SIZE>=7935)?1:0; - pCapELE->DssCCk = ((pHT->bRegBW40MHz)?(pHT->bRegSuppCCK?1:0):0); + pCapELE->DssCCk = ((pHT->bRegBW40MHz)?(pHT->bRegSuppCCK?1:0):0); pCapELE->PSMP = 0; // Do not support now!! pCapELE->LSigTxopProtect = 0; // Do not support now!! @@ -603,13 +603,13 @@ void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u if( IsEncrypt) { - pCapELE->MPDUDensity = 7; // 8us - pCapELE->MaxRxAMPDUFactor = 2; // 2 is for 32 K and 3 is 64K + pCapELE->MPDUDensity = 7; // 8us + pCapELE->MaxRxAMPDUFactor = 2; // 2 is for 32 K and 3 is 64K } else { - pCapELE->MaxRxAMPDUFactor = 3; // 2 is for 32 K and 3 is 64K - pCapELE->MPDUDensity = 0; // no density + pCapELE->MaxRxAMPDUFactor = 3; // 2 is for 32 K and 3 is 64K + pCapELE->MPDUDensity = 0; // no density } //Supported MCS set @@ -658,10 +658,10 @@ void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u } /******************************************************************************************************************** *function: Construct Information Element in Beacon... if HTEnable is turned on - * input: struct ieee80211_device* ieee - * u8* posHTCap //pointer to store Information Ele - * u8* len //store len of - * u8 IsEncrypt //whether encrypt, needed further + * input: struct ieee80211_device* ieee + * u8* posHTCap //pointer to store Information Ele + * u8* len //store len of + * u8 IsEncrypt //whether encrypt, needed further * output: none * return: none * notice: posHTCap can't be null and be initialized before. only AP and IBSS sta should do this @@ -679,12 +679,12 @@ void HTConstructInfoElement(struct ieee80211_device* ieee, u8* posHTInfo, u8* le memset(posHTInfo, 0, *len); if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == IW_MODE_MASTER)) //ap mode is not currently supported { - pHTInfoEle->ControlChl = ieee->current_network.channel; - pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false)?HT_EXTCHNL_OFFSET_NO_EXT: + pHTInfoEle->ControlChl = ieee->current_network.channel; + pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false)?HT_EXTCHNL_OFFSET_NO_EXT: (ieee->current_network.channel<=6)? HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER); pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz; - pHTInfoEle->RIFS = 0; + pHTInfoEle->RIFS = 0; pHTInfoEle->PSMPAccessOnly = 0; pHTInfoEle->SrvIntGranularity = 0; pHTInfoEle->OptMode = pHT->CurrentOpMode; @@ -723,17 +723,17 @@ void HTConstructInfoElement(struct ieee80211_device* ieee, u8* posHTInfo, u8* le * Element ID Length OUI Type1 Reserved * 1 byte 1 byte 3 bytes 1 byte 1 byte * - * OUI = 0x00, 0xe0, 0x4c, - * Type = 0x02 - * Reserved = 0x00 + * OUI = 0x00, 0xe0, 0x4c, + * Type = 0x02 + * Reserved = 0x00 * * 2007.8.21 by Emily */ /******************************************************************************************************************** *function: Construct Information Element in Beacon... in RT2RT condition - * input: struct ieee80211_device* ieee - * u8* posRT2RTAgg //pointer to store Information Ele - * u8* len //store len + * input: struct ieee80211_device* ieee + * u8* posRT2RTAgg //pointer to store Information Ele + * u8* len //store len * output: none * return: none * notice: @@ -787,8 +787,8 @@ void HTConstructRT2RTAggElement(struct ieee80211_device* ieee, u8* posRT2RTAgg, /******************************************************************************************************************** *function: Pick the right Rate Adaptive table to use - * input: struct ieee80211_device* ieee - * u8* pOperateMCS //A pointer to MCS rate bitmap + * input: struct ieee80211_device* ieee + * u8* pOperateMCS //A pointer to MCS rate bitmap * return: always we return true * notice: * *****************************************************************************************************************/ @@ -840,7 +840,7 @@ u8 HT_PickMCSRate(struct ieee80211_device* ieee, u8* pOperateMCS) * Description: * This function will get the highest speed rate in input MCS set. * -* /param Adapter Pionter to Adapter entity +* /param Adapter Pionter to Adapter entity * pMCSRateSet Pointer to MCS rate bitmap * pMCSFilter Pointer to MCS rate filter * @@ -849,9 +849,9 @@ u8 HT_PickMCSRate(struct ieee80211_device* ieee, u8* pOperateMCS) */ /******************************************************************************************************************** *function: This function will get the highest speed rate in input MCS set. - * input: struct ieee80211_device* ieee - * u8* pMCSRateSet //Pointer to MCS rate bitmap - * u8* pMCSFilter //Pointer to MCS rate filter + * input: struct ieee80211_device* ieee + * u8* pMCSRateSet //Pointer to MCS rate bitmap + * u8* pMCSFilter //Pointer to MCS rate filter * return: Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter * notice: * *****************************************************************************************************************/ @@ -1062,7 +1062,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) else pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity; if(ieee->pairwise_key_type != KEY_TYPE_NA ) - pHTInfo->CurrentMPDUDensity = 7; // 8us + pHTInfo->CurrentMPDUDensity = 7; // 8us // Force TX AMSDU // Lanhsin: mark for tmp to avoid deauth by ap from s3 @@ -1118,7 +1118,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) void HTSetConnectBwModeCallback(struct ieee80211_device* ieee); /******************************************************************************************************************** *function: initialize HT info(struct PRT_HIGH_THROUGHPUT) - * input: struct ieee80211_device* ieee + * input: struct ieee80211_device* ieee * output: none * return: none * notice: This function is called when * (1) MPInitialization Phase * (2) Receiving of Deauthentication from AP @@ -1208,13 +1208,13 @@ void HTInitializeBssDesc(PBSS_HT pBssHT) } /******************************************************************************************************************** *function: initialize Bss HT structure(struct PBSS_HT) - * input: struct ieee80211_device *ieee - * struct ieee80211_network *pNetwork //usually current network we are live in + * input: struct ieee80211_device *ieee + * struct ieee80211_network *pNetwork //usually current network we are live in * output: none * return: none * notice: This function should ONLY be called before association ********************************************************************************************************************/ -void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork) +void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; // u16 nMaxAMSDUSize; @@ -1235,7 +1235,7 @@ void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80 pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer; // Save HTCap and HTInfo information Element - if(pNetwork->bssht.bdHTCapLen > 0 && pNetwork->bssht.bdHTCapLen <= sizeof(pHTInfo->PeerHTCapBuf)) + if(pNetwork->bssht.bdHTCapLen > 0 && pNetwork->bssht.bdHTCapLen <= sizeof(pHTInfo->PeerHTCapBuf)) memcpy(pHTInfo->PeerHTCapBuf, pNetwork->bssht.bdHTCapBuf, pNetwork->bssht.bdHTCapLen); if(pNetwork->bssht.bdHTInfoLen > 0 && pNetwork->bssht.bdHTInfoLen <= sizeof(pHTInfo->PeerHTInfoBuf)) @@ -1297,7 +1297,7 @@ void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80 } -void HTUpdateSelfAndPeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork) +void HTUpdateSelfAndPeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; // PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf; @@ -1364,8 +1364,8 @@ void HTUseDefaultSetting(struct ieee80211_device* ieee) } /******************************************************************************************************************** *function: check whether HT control field exists - * input: struct ieee80211_device *ieee - * u8* pFrame //coming skb->data + * input: struct ieee80211_device *ieee + * u8* pFrame //coming skb->data * output: none * return: return true if HT control field exists(false otherwise) * notice: diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h index 9e4ced15edf5..2348ccd70be0 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h @@ -81,8 +81,7 @@ typedef union _QOS_CTRL_FIELD{ u16 shortData; // WMM spec - struct - { + struct { u8 UP:3; u8 usRsvd1:1; u8 EOSP:1; @@ -92,8 +91,7 @@ typedef union _QOS_CTRL_FIELD{ }WMM; // 802.11e: QoS data type frame sent by non-AP QSTAs. - struct - { + struct { u8 TID:4; u8 bIsQsize:1;// 0: BIT[8:15] is TXOP Duration Requested, 1: BIT[8:15] is Queue Size. u8 AckPolicy:2; @@ -102,8 +100,7 @@ typedef union _QOS_CTRL_FIELD{ }BySta; // 802.11e: QoS data, QoS Null, and QoS Data+CF-Ack frames sent by HC. - struct - { + struct { u8 TID:4; u8 EOSP:1; u8 AckPolicy:2; @@ -112,8 +109,7 @@ typedef union _QOS_CTRL_FIELD{ }ByHc_Data; // 802.11e: QoS (+) CF-Poll frames sent by HC. - struct - { + struct { u8 TID:4; u8 EOSP:1; u8 AckPolicy:2; @@ -133,14 +129,12 @@ typedef union _QOS_CTRL_FIELD{ typedef union _QOS_INFO_FIELD{ u8 charData; - struct - { + struct { u8 ucParameterSetCount:4; u8 ucReserved:4; }WMM; - struct - { + struct { //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah u8 ucAC_VO_UAPSD:1; u8 ucAC_VI_UAPSD:1; @@ -152,16 +146,14 @@ typedef union _QOS_INFO_FIELD{ }ByWmmPsSta; - struct - { + struct { //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah u8 ucParameterSetCount:4; u8 ucReserved:3; u8 ucApUapsd:1; }ByWmmPsAp; - struct - { + struct { u8 ucAC3_UAPSD:1; u8 ucAC2_UAPSD:1; u8 ucAC1_UAPSD:1; @@ -171,8 +163,7 @@ typedef union _QOS_INFO_FIELD{ u8 ucMoreDataAck:1; } By11eSta; - struct - { + struct { u8 ucParameterSetCount:4; u8 ucQAck:1; u8 ucQueueReq:1; @@ -180,16 +171,14 @@ typedef union _QOS_INFO_FIELD{ u8 ucReserved:1; } By11eAp; - struct - { + struct { u8 ucReserved1:4; u8 ucQAck:1; u8 ucReserved2:2; u8 ucMoreDataAck:1; } ByWmmsaSta; - struct - { + struct { u8 ucReserved1:4; u8 ucQAck:1; u8 ucQueueReq:1; @@ -197,8 +186,7 @@ typedef union _QOS_INFO_FIELD{ u8 ucReserved2:1; } ByWmmsaAp; - struct - { + struct { u8 ucAC3_UAPSD:1; u8 ucAC2_UAPSD:1; u8 ucAC1_UAPSD:1; @@ -208,8 +196,7 @@ typedef union _QOS_INFO_FIELD{ u8 ucMoreDataAck:1; } ByAllSta; - struct - { + struct { u8 ucParameterSetCount:4; u8 ucQAck:1; u8 ucQueueReq:1; @@ -246,8 +233,7 @@ typedef u32 AC_CODING; typedef union _ACI_AIFSN{ u8 charData; - struct - { + struct { u8 AIFSN:4; u8 ACM:1; u8 ACI:2; @@ -261,8 +247,7 @@ typedef union _ACI_AIFSN{ // typedef union _ECW{ u8 charData; - struct - { + struct { u8 ECWmin:4; u8 ECWmax:4; }f; // Field @@ -276,8 +261,7 @@ typedef union _AC_PARAM{ u32 longData; u8 charData[4]; - struct - { + struct { ACI_AIFSN AciAifsn; ECW Ecw; u16 TXOPLimit; @@ -336,8 +320,7 @@ typedef union _QOS_TSINFO{ typedef union _TSPEC_BODY{ u8 charData[55]; - struct - { + struct { QOS_TSINFO TSInfo; //u8 TSInfo[3]; u16 NominalMSDUsize; u16 MaxMSDUsize; @@ -412,14 +395,14 @@ typedef union _QOS_TCLAS{ struct _TYPE_GENERAL{ u8 Priority; - u8 ClassifierType; - u8 Mask; + u8 ClassifierType; + u8 Mask; } TYPE_GENERAL; struct _TYPE0_ETH{ u8 Priority; - u8 ClassifierType; - u8 Mask; + u8 ClassifierType; + u8 Mask; u8 SrcAddr[6]; u8 DstAddr[6]; u16 Type; @@ -427,9 +410,9 @@ typedef union _QOS_TCLAS{ struct _TYPE1_IPV4{ u8 Priority; - u8 ClassifierType; - u8 Mask; - u8 Version; + u8 ClassifierType; + u8 Mask; + u8 Version; u8 SrcIP[4]; u8 DstIP[4]; u16 SrcPort; @@ -441,9 +424,9 @@ typedef union _QOS_TCLAS{ struct _TYPE1_IPV6{ u8 Priority; - u8 ClassifierType; - u8 Mask; - u8 Version; + u8 ClassifierType; + u8 Mask; + u8 Version; u8 SrcIP[16]; u8 DstIP[16]; u16 SrcPort; @@ -453,8 +436,8 @@ typedef union _QOS_TCLAS{ struct _TYPE2_8021Q{ u8 Priority; - u8 ClassifierType; - u8 Mask; + u8 ClassifierType; + u8 Mask; u16 TagType; } TYPE2_8021Q; } QOS_TCLAS, *PQOS_TCLAS; @@ -481,7 +464,7 @@ typedef struct _QOS_TSTREAM{ // "Qos control field" and "Qos info field" //typedef struct _QOS_UAPSD{ // u8 bTriggerEnable[4]; -// u8 MaxSPLength; +// u8 MaxSPLength; // u8 HighestBufAC; //} QOS_UAPSD, *PQOS_APSD; @@ -489,7 +472,7 @@ typedef struct _QOS_TSTREAM{ // 802.11 Management frame Status Code field //---------------------------------------------------------------------------- typedef struct _OCTET_STRING{ - u8 *Octet; + u8 *Octet; u16 Length; }OCTET_STRING, *POCTET_STRING; @@ -512,7 +495,7 @@ typedef struct _STA_QOS{ AC_UAPSD Curr4acUapsd; u8 bInServicePeriod; u8 MaxSPLength; - int NumBcnBeforeTrigger; + int NumBcnBeforeTrigger; // Part 2. EDCA Parameter (perAC) u8 * pWMMInfoEle; @@ -523,7 +506,7 @@ typedef struct _STA_QOS{ //2 ToDo: remove the Qos Info Field and replace it by the above WMM Info element. // By Bruce, 2008-01-30. // Part 2. EDCA Parameter (perAC) - QOS_INFO_FIELD QosInfoField_STA; // Maintained by STA + QOS_INFO_FIELD QosInfoField_STA; // Maintained by STA QOS_INFO_FIELD QosInfoField_AP; // Retrieved from AP AC_PARAM CurAcParameters[4]; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h index e7e26fd96395..7ed7243b1fb0 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h @@ -28,7 +28,7 @@ typedef struct _TS_COMMON_INFO{ typedef struct _TX_TS_RECORD{ TS_COMMON_INFO TsCommonInfo; u16 TxCurSeq; - BA_RECORD TxPendingBARecord; // For BA Originator + BA_RECORD TxPendingBARecord; // For BA Originator BA_RECORD TxAdmittedBARecord; // For BA Originator // QOS_DL_RECORD DLRecord; u8 bAddBaReqInProgress; @@ -53,4 +53,3 @@ typedef struct _RX_TS_RECORD { #endif - diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index 06a9824bbff1..0310d07287a1 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -27,7 +27,7 @@ void RxPktPendingTimeout(unsigned long data) PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data; struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]); - PRX_REORDER_ENTRY pReorderEntry = NULL; + PRX_REORDER_ENTRY pReorderEntry = NULL; //u32 flags = 0; unsigned long flags = 0; @@ -236,8 +236,8 @@ void AdmitTS(struct ieee80211_device *ieee, PTS_COMMON_INFO pTsCommonInfo, u32 I PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee, u8* Addr, u8 TID, TR_SELECT TxRxSelect) { - //DIRECTION_VALUE dir; - u8 dir; + //DIRECTION_VALUE dir; + u8 dir; bool search_dir[4] = {0, 0, 0, 0}; struct list_head* psearch_list; //FIXME PTS_COMMON_INFO pRet = NULL; @@ -250,14 +250,14 @@ PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee, u8* Addr, u8 } else { - search_dir[DIR_UP] = true; + search_dir[DIR_UP] = true; search_dir[DIR_BI_DIR]= true; } } else if(ieee->iw_mode == IW_MODE_ADHOC) { if(TxRxSelect == TX_DIR) - search_dir[DIR_UP] = true; + search_dir[DIR_UP] = true; else search_dir[DIR_DOWN] = true; } @@ -265,7 +265,7 @@ PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee, u8* Addr, u8 { if(TxRxSelect == TX_DIR) { - search_dir[DIR_UP] = true; + search_dir[DIR_UP] = true; search_dir[DIR_BI_DIR]= true; search_dir[DIR_DIRECT]= true; } @@ -450,8 +450,8 @@ bool GetTs( pTSInfo->field.ucTSID = UP; // TSID pTSInfo->field.ucDirection = Dir; // Direction: if there is DirectLink, this need additional consideration. pTSInfo->field.ucAccessPolicy = 1; // Access policy - pTSInfo->field.ucAggregation = 0; // Aggregation - pTSInfo->field.ucPSB = 0; // Aggregation + pTSInfo->field.ucAggregation = 0; // Aggregation + pTSInfo->field.ucPSB = 0; // Aggregation pTSInfo->field.ucUP = UP; // User priority pTSInfo->field.ucTSInfoAckPolicy = 0; // Ack policy pTSInfo->field.ucSchedule = 0; // Schedule @@ -488,7 +488,7 @@ void RemoveTsEntry( { //#ifdef TO_DO_LIST PRX_REORDER_ENTRY pRxReorderEntry; - PRX_TS_RECORD pRxTS = (PRX_TS_RECORD)pTs; + PRX_TS_RECORD pRxTS = (PRX_TS_RECORD)pTs; if(timer_pending(&pRxTS->RxPktPendingTimer)) del_timer_sync(&pRxTS->RxPktPendingTimer); diff --git a/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h b/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h index ccf6ae763572..c3c87108ee9e 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h @@ -52,10 +52,10 @@ #define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 #define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 -#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 -#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 -#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000 -#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000 +#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 +#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 +#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000 +#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000 /* * Miscellaneous stuff. @@ -73,7 +73,7 @@ struct cipher_alg { unsigned int cia_min_keysize; unsigned int cia_max_keysize; int (*cia_setkey)(void *ctx, const u8 *key, - unsigned int keylen, u32 *flags); + unsigned int keylen, u32 *flags); void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); }; @@ -84,16 +84,16 @@ struct digest_alg { void (*dia_update)(void *ctx, const u8 *data, unsigned int len); void (*dia_final)(void *ctx, u8 *out); int (*dia_setkey)(void *ctx, const u8 *key, - unsigned int keylen, u32 *flags); + unsigned int keylen, u32 *flags); }; struct compress_alg { int (*coa_init)(void *ctx); void (*coa_exit)(void *ctx); int (*coa_compress)(void *ctx, const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen); + u8 *dst, unsigned int *dlen); int (*coa_decompress)(void *ctx, const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen); + u8 *dst, unsigned int *dlen); }; #define cra_cipher cra_u.cipher @@ -139,15 +139,15 @@ struct cipher_tfm { unsigned int cit_ivsize; u32 cit_mode; int (*cit_setkey)(struct crypto_tfm *tfm, - const u8 *key, unsigned int keylen); + const u8 *key, unsigned int keylen); int (*cit_encrypt)(struct crypto_tfm *tfm, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes); int (*cit_encrypt_iv)(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes, u8 *iv); + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv); int (*cit_decrypt)(struct crypto_tfm *tfm, struct scatterlist *dst, struct scatterlist *src, @@ -162,12 +162,12 @@ struct cipher_tfm { struct digest_tfm { void (*dit_init)(struct crypto_tfm *tfm); void (*dit_update)(struct crypto_tfm *tfm, - struct scatterlist *sg, unsigned int nsg); + struct scatterlist *sg, unsigned int nsg); void (*dit_final)(struct crypto_tfm *tfm, u8 *out); void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg, - unsigned int nsg, u8 *out); + unsigned int nsg, u8 *out); int (*dit_setkey)(struct crypto_tfm *tfm, - const u8 *key, unsigned int keylen); + const u8 *key, unsigned int keylen); #ifdef CONFIG_CRYPTO_HMAC void *dit_hmac_block; #endif @@ -175,11 +175,11 @@ struct digest_tfm { struct compress_tfm { int (*cot_compress)(struct crypto_tfm *tfm, - const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen); + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen); int (*cot_decompress)(struct crypto_tfm *tfm, - const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen); + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen); }; #define crt_cipher crt_u.cipher @@ -277,8 +277,8 @@ static inline void crypto_digest_init(struct crypto_tfm *tfm) } static inline void crypto_digest_update(struct crypto_tfm *tfm, - struct scatterlist *sg, - unsigned int nsg) + struct scatterlist *sg, + unsigned int nsg) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); tfm->crt_digest.dit_update(tfm, sg, nsg); @@ -291,15 +291,15 @@ static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out) } static inline void crypto_digest_digest(struct crypto_tfm *tfm, - struct scatterlist *sg, - unsigned int nsg, u8 *out) + struct scatterlist *sg, + unsigned int nsg, u8 *out) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); tfm->crt_digest.dit_digest(tfm, sg, nsg, out); } static inline int crypto_digest_setkey(struct crypto_tfm *tfm, - const u8 *key, unsigned int keylen) + const u8 *key, unsigned int keylen) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); if (tfm->crt_digest.dit_setkey == NULL) @@ -308,25 +308,25 @@ static inline int crypto_digest_setkey(struct crypto_tfm *tfm, } static inline int crypto_cipher_setkey(struct crypto_tfm *tfm, - const u8 *key, unsigned int keylen) + const u8 *key, unsigned int keylen) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); return tfm->crt_cipher.cit_setkey(tfm, key, keylen); } static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); } static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes, u8 *iv) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB); @@ -334,18 +334,18 @@ static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, } static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); } static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes, u8 *iv) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB); @@ -353,30 +353,30 @@ static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, } static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, - const u8 *src, unsigned int len) + const u8 *src, unsigned int len) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); memcpy(tfm->crt_cipher.cit_iv, src, len); } static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, - u8 *dst, unsigned int len) + u8 *dst, unsigned int len) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); memcpy(dst, tfm->crt_cipher.cit_iv, len); } static inline int crypto_comp_compress(struct crypto_tfm *tfm, - const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen) + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen); } static inline int crypto_comp_decompress(struct crypto_tfm *tfm, - const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen) + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen); @@ -388,12 +388,11 @@ static inline int crypto_comp_decompress(struct crypto_tfm *tfm, #ifdef CONFIG_CRYPTO_HMAC void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen); void crypto_hmac_update(struct crypto_tfm *tfm, - struct scatterlist *sg, unsigned int nsg); + struct scatterlist *sg, unsigned int nsg); void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key, - unsigned int *keylen, u8 *out); + unsigned int *keylen, u8 *out); void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen, - struct scatterlist *sg, unsigned int nsg, u8 *out); + struct scatterlist *sg, unsigned int nsg, u8 *out); #endif /* CONFIG_CRYPTO_HMAC */ #endif /* _LINUX_CRYPTO_H */ - diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index 3c515b7bc542..7e49ad8f48f6 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -95,7 +95,7 @@ u32 eprom_read(struct net_device *dev, u32 addr) u32 ret; ret=0; - //enable EPROM programming + //enable EPROM programming write_nic_byte_E(dev, EPROM_CMD, (EPROM_CMD_PROGRAM<<EPROM_CMD_OPERATING_MODE_SHIFT)); force_pci_posting(dev); diff --git a/drivers/staging/rtl8192u/r8180_pm.h b/drivers/staging/rtl8192u/r8180_pm.h index c7d18a8b79a1..52d6fba99deb 100644 --- a/drivers/staging/rtl8192u/r8180_pm.h +++ b/drivers/staging/rtl8192u/r8180_pm.h @@ -1,5 +1,5 @@ /* - Power management interface routines. + Power management interface routines. Written by Mariusz Matuszek. This code is currently just a placeholder for later work and does not do anything useful. diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c index 74ff337b0583..cf9713fa8b9d 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.c +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -16,9 +16,9 @@ #include "r8190_rtl8256.h" /*-------------------------------------------------------------------------- - * Overview: set RF band width (20M or 40M) + * Overview: set RF band width (20M or 40M) * Input: struct net_device* dev - * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M + * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M * Output: NONE * Return: NONE * Note: 8226 support both 20M and 40 MHz @@ -106,16 +106,16 @@ void PHY_RF8256_Config(struct net_device* dev) *---------------------------------------------------------------------------*/ void phy_RF8256_Config_ParaFile(struct net_device* dev) { - u32 u4RegValue = 0; + u32 u4RegValue = 0; //static s1Byte szRadioAFile[] = RTL819X_PHY_RADIO_A; //static s1Byte szRadioBFile[] = RTL819X_PHY_RADIO_B; //static s1Byte szRadioCFile[] = RTL819X_PHY_RADIO_C; //static s1Byte szRadioDFile[] = RTL819X_PHY_RADIO_D; - u8 eRFPath; + u8 eRFPath; BB_REGISTER_DEFINITION_T *pPhyReg; struct r8192_priv *priv = ieee80211_priv(dev); u32 RegOffSetToBeCheck = 0x3; - u32 RegValueToBeCheck = 0x7f1; + u32 RegValueToBeCheck = 0x7f1; u32 RF3_Final_Value = 0; u8 ConstRetryTimes = 5, RetryTimes = 5; u8 ret = 0; @@ -152,7 +152,7 @@ void phy_RF8256_Config_ParaFile(struct net_device* dev) rtl8192_setBBreg(dev, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); /* Set bit number of Address and Data for RF register */ - rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); // Set 0 to 4 bits for Z-serial and set 1 to 6 bits for 8258 + rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); // Set 0 to 4 bits for Z-serial and set 1 to 6 bits for 8258 rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); // Set 0 to 12 bits for Z-serial and 8258, and set 1 to 14 bits for ??? rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E) eRFPath, 0x0, bMask12Bits, 0xbf); @@ -309,4 +309,3 @@ void PHY_SetRF8256OFDMTxPower(struct net_device* dev, u8 powerlevel) return; } - diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 57e3383cc935..e538e026b512 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -110,7 +110,7 @@ do { if(rt_global_debug_component & component) \ #define COMP_RATE BIT12 // For Rate Adaptive mechanism, 2006.07.02, by rcnjko. #define COMP_RM BIT13 // For Radio Measurement. #define COMP_DIG BIT14 // For DIG, 2006.09.25, by rcnjko. -#define COMP_PHY BIT15 +#define COMP_PHY BIT15 #define COMP_CH BIT16 //channel setting debug #define COMP_TXAGC BIT17 // For Tx power, 060928, by rcnjko. #define COMP_HIPWR BIT18 // For High Power Mechanism, 060928, by rcnjko. @@ -136,26 +136,26 @@ do { if(rt_global_debug_component & component) \ #define RTL819x_DEBUG #ifdef RTL819x_DEBUG #define assert(expr) \ - if (!(expr)) { \ - printk( "Assertion failed! %s,%s,%s,line=%d\n", \ - #expr,__FILE__,__FUNCTION__,__LINE__); \ - } + if (!(expr)) { \ + printk( "Assertion failed! %s,%s,%s,line=%d\n", \ + #expr,__FILE__,__FUNCTION__,__LINE__); \ + } //wb added to debug out data buf //if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA #define RT_DEBUG_DATA(level, data, datalen) \ - do{ if ((rt_global_debug_component & (level)) == (level)) \ - { \ - int i; \ - u8* pdata = (u8*) data; \ - printk(KERN_DEBUG RTL819xU_MODULE_NAME ": %s()\n", __FUNCTION__); \ - for(i=0; i<(int)(datalen); i++) \ - { \ - printk("%2x ", pdata[i]); \ - if ((i+1)%16 == 0) printk("\n"); \ - } \ - printk("\n"); \ - } \ - } while (0) + do{ if ((rt_global_debug_component & (level)) == (level)) \ + { \ + int i; \ + u8* pdata = (u8*) data; \ + printk(KERN_DEBUG RTL819xU_MODULE_NAME ": %s()\n", __FUNCTION__); \ + for(i=0; i<(int)(datalen); i++) \ + { \ + printk("%2x ", pdata[i]); \ + if ((i+1)%16 == 0) printk("\n"); \ + } \ + printk("\n"); \ + } \ + } while (0) #else #define assert(expr) do {} while (0) #define RT_DEBUG_DATA(level, data, datalen) do {} while(0) @@ -209,47 +209,47 @@ do { if(rt_global_debug_component & component) \ #define IEEE80211_WATCH_DOG_TIME 2000 #define PHY_Beacon_RSSI_SLID_WIN_MAX 10 //for txpowertracking by amy -#define OFDM_Table_Length 19 +#define OFDM_Table_Length 19 #define CCK_Table_length 12 /* for rtl819x */ typedef struct _tx_desc_819x_usb { - //DWORD 0 - u16 PktSize; - u8 Offset; - u8 Reserved0:3; - u8 CmdInit:1; - u8 LastSeg:1; - u8 FirstSeg:1; - u8 LINIP:1; - u8 OWN:1; - - //DWORD 1 - u8 TxFWInfoSize; - u8 RATid:3; - u8 DISFB:1; - u8 USERATE:1; - u8 MOREFRAG:1; - u8 NoEnc:1; - u8 PIFS:1; - u8 QueueSelect:5; - u8 NoACM:1; - u8 Reserved1:2; - u8 SecCAMID:5; - u8 SecDescAssign:1; - u8 SecType:2; - - //DWORD 2 - u16 TxBufferSize; - //u16 Reserved2; - u8 ResvForPaddingLen:7; - u8 Reserved3:1; - u8 Reserved4; - - //DWORD 3, 4, 5 - u32 Reserved5; - u32 Reserved6; - u32 Reserved7; + //DWORD 0 + u16 PktSize; + u8 Offset; + u8 Reserved0:3; + u8 CmdInit:1; + u8 LastSeg:1; + u8 FirstSeg:1; + u8 LINIP:1; + u8 OWN:1; + + //DWORD 1 + u8 TxFWInfoSize; + u8 RATid:3; + u8 DISFB:1; + u8 USERATE:1; + u8 MOREFRAG:1; + u8 NoEnc:1; + u8 PIFS:1; + u8 QueueSelect:5; + u8 NoACM:1; + u8 Reserved1:2; + u8 SecCAMID:5; + u8 SecDescAssign:1; + u8 SecType:2; + + //DWORD 2 + u16 TxBufferSize; + //u16 Reserved2; + u8 ResvForPaddingLen:7; + u8 Reserved3:1; + u8 Reserved4; + + //DWORD 3, 4, 5 + u32 Reserved5; + u32 Reserved6; + u32 Reserved7; }tx_desc_819x_usb, *ptx_desc_819x_usb; #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE @@ -280,7 +280,7 @@ typedef struct _tx_desc_819x_usb_aggr_subframe { typedef struct _tx_desc_cmd_819x_usb { - //DWORD 0 + //DWORD 0 u16 Reserved0; u8 Reserved1; u8 Reserved2:3; @@ -290,15 +290,15 @@ typedef struct _tx_desc_cmd_819x_usb { u8 LINIP:1; u8 OWN:1; - //DOWRD 1 + //DOWRD 1 //u32 Reserved3; u8 TxFWInfoSize; u8 Reserved3; u8 QueueSelect; u8 Reserved4; - //DOWRD 2 - u16 TxBufferSize; + //DOWRD 2 + u16 TxBufferSize; u16 Reserved5; //DWORD 3,4,5 @@ -311,34 +311,34 @@ typedef struct _tx_desc_cmd_819x_usb { typedef struct _tx_fwinfo_819x_usb { - //DOWRD 0 - u8 TxRate:7; - u8 CtsEnable:1; - u8 RtsRate:7; - u8 RtsEnable:1; - u8 TxHT:1; - u8 Short:1; //Short PLCP for CCK, or short GI for 11n MCS - u8 TxBandwidth:1; // This is used for HT MCS rate only. - u8 TxSubCarrier:2; // This is used for legacy OFDM rate only. - u8 STBC:2; - u8 AllowAggregation:1; - u8 RtsHT:1; //Interpret RtsRate field as high throughput data rate - u8 RtsShort:1; //Short PLCP for CCK, or short GI for 11n MCS - u8 RtsBandwidth:1; // This is used for HT MCS rate only. - u8 RtsSubcarrier:2; // This is used for legacy OFDM rate only. - u8 RtsSTBC:2; - u8 EnableCPUDur:1; //Enable firmware to recalculate and assign packet duration - - //DWORD 1 - u32 RxMF:2; - u32 RxAMD:3; - u32 TxPerPktInfoFeedback:1;//1 indicate Tx info gathtered by firmware and returned by Rx Cmd - u32 Reserved1:2; - u32 TxAGCOffSet:4; - u32 TxAGCSign:1; - u32 Tx_INFO_RSVD:6; + //DOWRD 0 + u8 TxRate:7; + u8 CtsEnable:1; + u8 RtsRate:7; + u8 RtsEnable:1; + u8 TxHT:1; + u8 Short:1; //Short PLCP for CCK, or short GI for 11n MCS + u8 TxBandwidth:1; // This is used for HT MCS rate only. + u8 TxSubCarrier:2; // This is used for legacy OFDM rate only. + u8 STBC:2; + u8 AllowAggregation:1; + u8 RtsHT:1; //Interpret RtsRate field as high throughput data rate + u8 RtsShort:1; //Short PLCP for CCK, or short GI for 11n MCS + u8 RtsBandwidth:1; // This is used for HT MCS rate only. + u8 RtsSubcarrier:2; // This is used for legacy OFDM rate only. + u8 RtsSTBC:2; + u8 EnableCPUDur:1; //Enable firmware to recalculate and assign packet duration + + //DWORD 1 + u32 RxMF:2; + u32 RxAMD:3; + u32 TxPerPktInfoFeedback:1;//1 indicate Tx info gathtered by firmware and returned by Rx Cmd + u32 Reserved1:2; + u32 TxAGCOffSet:4; + u32 TxAGCSign:1; + u32 Tx_INFO_RSVD:6; u32 PacketID:13; - //u32 Reserved; + //u32 Reserved; }tx_fwinfo_819x_usb, *ptx_fwinfo_819x_usb; typedef struct rtl8192_rx_info { @@ -391,7 +391,7 @@ typedef struct _rx_desc_819x_usb_aggr_subframe{ //DWORD 2 //u4Byte Reserved3; //DWORD 3 - //u4Byte BufferAddress; + //u4Byte BufferAddress; }rx_desc_819x_usb_aggr_subframe, *prx_desc_819x_usb_aggr_subframe; #endif @@ -424,7 +424,7 @@ typedef struct rx_drvinfo_819x_usb{ #define MAX_802_11_HEADER_LENGTH (40 + MAX_FIRMWARE_INFORMATION_SIZE) #define ENCRYPTION_MAX_OVERHEAD 128 #define USB_HWDESC_HEADER_LEN sizeof(tx_desc_819x_usb) -#define TX_PACKET_SHIFT_BYTES (USB_HWDESC_HEADER_LEN + sizeof(tx_fwinfo_819x_usb)) +#define TX_PACKET_SHIFT_BYTES (USB_HWDESC_HEADER_LEN + sizeof(tx_fwinfo_819x_usb)) #define MAX_FRAGMENT_COUNT 8 #ifdef RTL8192U #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE @@ -433,7 +433,7 @@ typedef struct rx_drvinfo_819x_usb{ #define MAX_TRANSMIT_BUFFER_SIZE 8000 #endif #else -#define MAX_TRANSMIT_BUFFER_SIZE (1600+(MAX_802_11_HEADER_LENGTH+ENCRYPTION_MAX_OVERHEAD)*MAX_FRAGMENT_COUNT) +#define MAX_TRANSMIT_BUFFER_SIZE (1600+(MAX_802_11_HEADER_LENGTH+ENCRYPTION_MAX_OVERHEAD)*MAX_FRAGMENT_COUNT) #endif #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE #define TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES (sizeof(tx_desc_819x_usb_aggr_subframe) + sizeof(tx_fwinfo_819x_usb)) @@ -559,22 +559,21 @@ typedef enum _WIRELESS_MODE { #define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 -typedef struct buffer -{ +typedef struct buffer { struct buffer *next; u32 *buf; } buffer; typedef struct rtl_reg_debug{ - unsigned int cmd; - struct { - unsigned char type; - unsigned char addr; - unsigned char page; - unsigned char length; - } head; - unsigned char buf[0xff]; + unsigned int cmd; + struct { + unsigned char type; + unsigned char addr; + unsigned char page; + unsigned char length; + } head; + unsigned char buf[0xff]; }rtl_reg_debug; @@ -600,8 +599,7 @@ typedef struct _RT_SMOOTH_DATA_4RF { #define MAX_8192U_RX_SIZE 8192 // This maybe changed for D-cut larger aggregation size //stats seems messed up, clean it ASAP -typedef struct Stats -{ +typedef struct Stats { unsigned long txrdu; // unsigned long rxrdu; //unsigned long rxnolast; @@ -711,7 +709,7 @@ typedef struct Stats //+by amy 080507 -typedef struct ChnlAccessSetting { +typedef struct ChnlAccessSetting { u16 SIFS_Timer; u16 DIFS_Timer; u16 SlotTimeTimer; @@ -721,35 +719,34 @@ typedef struct ChnlAccessSetting { }*PCHANNEL_ACCESS_SETTING,CHANNEL_ACCESS_SETTING; typedef struct _BB_REGISTER_DEFINITION{ - u32 rfintfs; // set software control: // 0x870~0x877[8 bytes] - u32 rfintfi; // readback data: // 0x8e0~0x8e7[8 bytes] - u32 rfintfo; // output data: // 0x860~0x86f [16 bytes] - u32 rfintfe; // output enable: // 0x860~0x86f [16 bytes] - u32 rf3wireOffset; // LSSI data: // 0x840~0x84f [16 bytes] - u32 rfLSSI_Select; // BB Band Select: // 0x878~0x87f [8 bytes] + u32 rfintfs; // set software control: // 0x870~0x877[8 bytes] + u32 rfintfi; // readback data: // 0x8e0~0x8e7[8 bytes] + u32 rfintfo; // output data: // 0x860~0x86f [16 bytes] + u32 rfintfe; // output enable: // 0x860~0x86f [16 bytes] + u32 rf3wireOffset; // LSSI data: // 0x840~0x84f [16 bytes] + u32 rfLSSI_Select; // BB Band Select: // 0x878~0x87f [8 bytes] u32 rfTxGainStage; // Tx gain stage: // 0x80c~0x80f [4 bytes] - u32 rfHSSIPara1; // wire parameter control1 : // 0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes] - u32 rfHSSIPara2; // wire parameter control2 : // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes] - u32 rfSwitchControl; //Tx Rx antenna control : // 0x858~0x85f [16 bytes] - u32 rfAGCControl1; //AGC parameter control1 : // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] - u32 rfAGCControl2; //AGC parameter control2 : // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] - u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : // 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] - u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : // 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes] - u32 rfTxIQImbalance; //OFDM Tx IQ imbalance matrix // 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes] - u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type // 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] - u32 rfLSSIReadBack; //LSSI RF readback data // 0x8a0~0x8af [16 bytes] + u32 rfHSSIPara1; // wire parameter control1 : // 0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes] + u32 rfHSSIPara2; // wire parameter control2 : // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes] + u32 rfSwitchControl; //Tx Rx antenna control : // 0x858~0x85f [16 bytes] + u32 rfAGCControl1; //AGC parameter control1 : // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] + u32 rfAGCControl2; //AGC parameter control2 : // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] + u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : // 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] + u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : // 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes] + u32 rfTxIQImbalance; //OFDM Tx IQ imbalance matrix // 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes] + u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type // 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] + u32 rfLSSIReadBack; //LSSI RF readback data // 0x8a0~0x8af [16 bytes] }BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T; typedef enum _RT_RF_TYPE_819xU{ - RF_TYPE_MIN = 0, - RF_8225, - RF_8256, - RF_8258, - RF_PSEUDO_11N = 4, + RF_TYPE_MIN = 0, + RF_8225, + RF_8256, + RF_8258, + RF_PSEUDO_11N = 4, }RT_RF_TYPE_819xU, *PRT_RF_TYPE_819xU; -typedef struct _rate_adaptive -{ +typedef struct _rate_adaptive { u8 rate_adaptive_disabled; u8 ratr_state; u16 reserve; @@ -775,21 +772,18 @@ typedef struct _rate_adaptive #define TxBBGainTableLength 37 #define CCKTxBBGainTableLength 23 -typedef struct _txbbgain_struct -{ +typedef struct _txbbgain_struct { long txbb_iq_amplifygain; u32 txbbgain_value; } txbbgain_struct, *ptxbbgain_struct; -typedef struct _ccktxbbgain_struct -{ +typedef struct _ccktxbbgain_struct { //The Value is from a22 to a29 one Byte one time is much Safer u8 ccktxbb_valuearray[8]; } ccktxbbgain_struct,*pccktxbbgain_struct; -typedef struct _init_gain -{ +typedef struct _init_gain { u8 xaagccore1; u8 xbagccore1; u8 xcagccore1; @@ -799,8 +793,7 @@ typedef struct _init_gain } init_gain, *pinit_gain; //by amy 0606 -typedef struct _phy_ofdm_rx_status_report_819xusb -{ +typedef struct _phy_ofdm_rx_status_report_819xusb { u8 trsw_gain_X[4]; u8 pwdb_all; u8 cfosho_X[4]; @@ -816,8 +809,7 @@ typedef struct _phy_ofdm_rx_status_report_819xusb u8 rxsc_sgien_exflg; }phy_sts_ofdm_819xusb_t; -typedef struct _phy_cck_rx_status_report_819xusb -{ +typedef struct _phy_cck_rx_status_report_819xusb { /* For CCK rate descriptor. This is a unsigned 8:1 variable. LSB bit presend 0.5. And MSB 7 bts presend a signed value. Range from -64~+63.5. */ u8 adc_pwdb_X[4]; @@ -881,8 +873,7 @@ typedef enum _tag_TxCmd_Config_Index{ TXCMD_XXXX_CTRL, }DCMD_TXCMD_OP; -typedef struct r8192_priv -{ +typedef struct r8192_priv { struct usb_device *udev; //added for maintain info from eeprom short epromtype; @@ -907,7 +898,7 @@ typedef struct r8192_priv spinlock_t irq_lock; // spinlock_t irq_th_lock; spinlock_t tx_lock; - struct mutex mutex; + struct mutex mutex; //spinlock_t rf_lock; //used to lock rf write operation added by wb u16 irq_mask; @@ -970,8 +961,8 @@ typedef struct r8192_priv atomic_t irt_counter;//count for irq_rx_tasklet #endif #ifdef JACKSON_NEW_RX - struct sk_buff **pp_rxskb; - int rx_inx; + struct sk_buff **pp_rxskb; + int rx_inx; #endif /* modified by davad for Rx process */ @@ -1006,7 +997,7 @@ typedef struct r8192_priv u8 retry_rts; u16 rts; - struct ChnlAccessSetting ChannelAccessSetting; + struct ChnlAccessSetting ChannelAccessSetting; struct work_struct reset_wq; /**********************************************************/ @@ -1014,7 +1005,7 @@ typedef struct r8192_priv u16 basic_rate; u8 short_preamble; u8 slot_time; - bool bDcut; + bool bDcut; bool bCurrentRxAggrEnable; u8 Rf_Mode; //add for Firmware RF -R/W switch prt_firmware pFirmware; @@ -1050,7 +1041,7 @@ typedef struct r8192_priv //for set channel u8 SwChnlInProgress; - u8 SwChnlStage; + u8 SwChnlStage; u8 SwChnlStep; u8 SetBWModeInProgress; HT_CHANNEL_WIDTH CurrentChannelBW; @@ -1062,8 +1053,8 @@ typedef struct r8192_priv // We save RF reg0 in this variable to reduce RF reading. // u32 RfReg0Value[4]; - u8 NumTotalRFPath; - bool brfpath_rxenable[4]; + u8 NumTotalRFPath; + bool brfpath_rxenable[4]; //RF set related bool SetRFPowerStateInProgress; //+by amy 080507 @@ -1104,7 +1095,7 @@ typedef struct r8192_priv bool btxpower_tracking; bool bcck_in_ch14; bool btxpowerdata_readfromEEPORM; - u16 TSSI_13dBm; + u16 TSSI_13dBm; //For Backup Initial Gain init_gain initgain_backup; u8 DefaultInitialGain[4]; @@ -1114,17 +1105,17 @@ typedef struct r8192_priv bool bis_cur_rdlstate; struct timer_list fsync_timer; bool bfsync_processing; // 500ms Fsync timer is active or not - u32 rate_record; - u32 rateCountDiffRecord; + u32 rate_record; + u32 rateCountDiffRecord; u32 ContinueDiffCount; bool bswitch_fsync; u8 framesync; - u32 framesyncC34; - u8 framesyncMonitor; - //Added by amy 080516 for RX related - u16 nrxAMPDU_size; - u8 nrxAMPDU_aggr_num; + u32 framesyncC34; + u8 framesyncMonitor; + //Added by amy 080516 for RX related + u16 nrxAMPDU_size; + u8 nrxAMPDU_aggr_num; //by amy for gpio bool bHwRadioOff; @@ -1204,7 +1195,7 @@ typedef enum{ #ifdef JOHN_HWSEC struct ssid_thread { struct net_device *dev; - u8 name[IW_ESSID_MAX_SIZE + 1]; + u8 name[IW_ESSID_MAX_SIZE + 1]; }; #endif diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 56367f23112f..01f82d36fcf6 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -80,9 +80,9 @@ double __extendsfdf2(float a) {return a;} #include "dot11d.h" //set here to open your trace code. //WB u32 rt_global_debug_component = \ - // COMP_INIT | + // COMP_INIT | // COMP_DBG | - // COMP_EPROM | + // COMP_EPROM | // COMP_PHY | // COMP_RF | // COMP_FIRMWARE | @@ -159,23 +159,22 @@ static struct usb_driver rtl8192_usb_driver = { .resume = rtl8192_resume, /* PM resume fn */ #else .suspend = NULL, /* PM suspend fn */ - .resume = NULL, /* PM resume fn */ + .resume = NULL, /* PM resume fn */ #endif }; -typedef struct _CHANNEL_LIST -{ +typedef struct _CHANNEL_LIST { u8 Channel[32]; u8 Len; }CHANNEL_LIST, *PCHANNEL_LIST; static CHANNEL_LIST ChannelPlan[] = { - {{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64,149,153,157,161,165},24}, //FCC - {{1,2,3,4,5,6,7,8,9,10,11},11}, //IC - {{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21}, //ETSI + {{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64,149,153,157,161,165},24}, //FCC + {{1,2,3,4,5,6,7,8,9,10,11},11}, //IC + {{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21}, //ETSI {{1,2,3,4,5,6,7,8,9,10,11,12,13},13}, //Spain. Change to ETSI. - {{1,2,3,4,5,6,7,8,9,10,11,12,13},13}, //France. Change to ETSI. + {{1,2,3,4,5,6,7,8,9,10,11,12,13},13}, //France. Change to ETSI. {{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,44,48,52,56,60,64},22}, //MKK //MKK {{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,44,48,52,56,60,64},22},//MKK1 {{1,2,3,4,5,6,7,8,9,10,11,12,13},13}, //Israel. @@ -240,7 +239,7 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv) } -#define rx_hal_is_cck_rate(_pdrvinfo)\ +#define rx_hal_is_cck_rate(_pdrvinfo)\ (_pdrvinfo->RxRate == DESC90_RATE1M ||\ _pdrvinfo->RxRate == DESC90_RATE2M ||\ _pdrvinfo->RxRate == DESC90_RATE5_5M ||\ @@ -1272,8 +1271,8 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv { struct ieee80211_device *ieee = netdev_priv(dev); struct r8192_priv *priv = ieee80211_priv(dev); - cb_desc *tcb_desc = NULL; - u8 i; + cb_desc *tcb_desc = NULL; + u8 i; u32 TotalLength; struct sk_buff *skb; struct sk_buff *agg_skb; @@ -1444,7 +1443,7 @@ u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb, struct ieee80211_device *ieee = netdev_priv(dev); PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 QueueID = tcb_desc->queue_index; do { @@ -1812,7 +1811,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) int status; struct urb *tx_urb; //int urb_buf_len; - unsigned int idx_pipe; + unsigned int idx_pipe; tx_desc_cmd_819x_usb *pdesc = (tx_desc_cmd_819x_usb *)skb->data; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; @@ -1876,43 +1875,43 @@ u8 MapHwQueueToFirmwareQueue(u8 QueueID) u8 QueueSelect = 0x0; //defualt set to switch(QueueID) { - case BE_QUEUE: - QueueSelect = QSLT_BE; //or QSelect = pTcb->priority; - break; + case BE_QUEUE: + QueueSelect = QSLT_BE; //or QSelect = pTcb->priority; + break; - case BK_QUEUE: - QueueSelect = QSLT_BK; //or QSelect = pTcb->priority; - break; + case BK_QUEUE: + QueueSelect = QSLT_BK; //or QSelect = pTcb->priority; + break; - case VO_QUEUE: - QueueSelect = QSLT_VO; //or QSelect = pTcb->priority; - break; + case VO_QUEUE: + QueueSelect = QSLT_VO; //or QSelect = pTcb->priority; + break; - case VI_QUEUE: - QueueSelect = QSLT_VI; //or QSelect = pTcb->priority; - break; - case MGNT_QUEUE: - QueueSelect = QSLT_MGNT; - break; + case VI_QUEUE: + QueueSelect = QSLT_VI; //or QSelect = pTcb->priority; + break; + case MGNT_QUEUE: + QueueSelect = QSLT_MGNT; + break; - case BEACON_QUEUE: - QueueSelect = QSLT_BEACON; - break; + case BEACON_QUEUE: + QueueSelect = QSLT_BEACON; + break; - // TODO: 2006.10.30 mark other queue selection until we verify it is OK - // TODO: Remove Assertions + // TODO: 2006.10.30 mark other queue selection until we verify it is OK + // TODO: Remove Assertions //#if (RTL819X_FPGA_VER & RTL819X_FPGA_GUANGAN_070502) - case TXCMD_QUEUE: - QueueSelect = QSLT_CMD; - break; + case TXCMD_QUEUE: + QueueSelect = QSLT_CMD; + break; //#endif - case HIGH_QUEUE: - QueueSelect = QSLT_HIGH; - break; + case HIGH_QUEUE: + QueueSelect = QSLT_HIGH; + break; - default: - RT_TRACE(COMP_ERR, "TransmitTCB(): Impossible Queue Selection: %d \n", QueueID); - break; + default: + RT_TRACE(COMP_ERR, "TransmitTCB(): Impossible Queue Selection: %d \n", QueueID); + break; } return QueueSelect; } @@ -1922,39 +1921,39 @@ u8 MRateToHwRate8190Pci(u8 rate) u8 ret = DESC90_RATE1M; switch(rate) { - case MGN_1M: ret = DESC90_RATE1M; break; - case MGN_2M: ret = DESC90_RATE2M; break; - case MGN_5_5M: ret = DESC90_RATE5_5M; break; - case MGN_11M: ret = DESC90_RATE11M; break; - case MGN_6M: ret = DESC90_RATE6M; break; - case MGN_9M: ret = DESC90_RATE9M; break; - case MGN_12M: ret = DESC90_RATE12M; break; - case MGN_18M: ret = DESC90_RATE18M; break; - case MGN_24M: ret = DESC90_RATE24M; break; - case MGN_36M: ret = DESC90_RATE36M; break; - case MGN_48M: ret = DESC90_RATE48M; break; - case MGN_54M: ret = DESC90_RATE54M; break; - - // HT rate since here - case MGN_MCS0: ret = DESC90_RATEMCS0; break; - case MGN_MCS1: ret = DESC90_RATEMCS1; break; - case MGN_MCS2: ret = DESC90_RATEMCS2; break; - case MGN_MCS3: ret = DESC90_RATEMCS3; break; - case MGN_MCS4: ret = DESC90_RATEMCS4; break; - case MGN_MCS5: ret = DESC90_RATEMCS5; break; - case MGN_MCS6: ret = DESC90_RATEMCS6; break; - case MGN_MCS7: ret = DESC90_RATEMCS7; break; - case MGN_MCS8: ret = DESC90_RATEMCS8; break; - case MGN_MCS9: ret = DESC90_RATEMCS9; break; - case MGN_MCS10: ret = DESC90_RATEMCS10; break; - case MGN_MCS11: ret = DESC90_RATEMCS11; break; - case MGN_MCS12: ret = DESC90_RATEMCS12; break; - case MGN_MCS13: ret = DESC90_RATEMCS13; break; - case MGN_MCS14: ret = DESC90_RATEMCS14; break; - case MGN_MCS15: ret = DESC90_RATEMCS15; break; - case (0x80|0x20): ret = DESC90_RATEMCS32; break; - - default: break; + case MGN_1M: ret = DESC90_RATE1M; break; + case MGN_2M: ret = DESC90_RATE2M; break; + case MGN_5_5M: ret = DESC90_RATE5_5M; break; + case MGN_11M: ret = DESC90_RATE11M; break; + case MGN_6M: ret = DESC90_RATE6M; break; + case MGN_9M: ret = DESC90_RATE9M; break; + case MGN_12M: ret = DESC90_RATE12M; break; + case MGN_18M: ret = DESC90_RATE18M; break; + case MGN_24M: ret = DESC90_RATE24M; break; + case MGN_36M: ret = DESC90_RATE36M; break; + case MGN_48M: ret = DESC90_RATE48M; break; + case MGN_54M: ret = DESC90_RATE54M; break; + + // HT rate since here + case MGN_MCS0: ret = DESC90_RATEMCS0; break; + case MGN_MCS1: ret = DESC90_RATEMCS1; break; + case MGN_MCS2: ret = DESC90_RATEMCS2; break; + case MGN_MCS3: ret = DESC90_RATEMCS3; break; + case MGN_MCS4: ret = DESC90_RATEMCS4; break; + case MGN_MCS5: ret = DESC90_RATEMCS5; break; + case MGN_MCS6: ret = DESC90_RATEMCS6; break; + case MGN_MCS7: ret = DESC90_RATEMCS7; break; + case MGN_MCS8: ret = DESC90_RATEMCS8; break; + case MGN_MCS9: ret = DESC90_RATEMCS9; break; + case MGN_MCS10: ret = DESC90_RATEMCS10; break; + case MGN_MCS11: ret = DESC90_RATEMCS11; break; + case MGN_MCS12: ret = DESC90_RATEMCS12; break; + case MGN_MCS13: ret = DESC90_RATEMCS13; break; + case MGN_MCS14: ret = DESC90_RATEMCS14; break; + case MGN_MCS15: ret = DESC90_RATEMCS15; break; + case (0x80|0x20): ret = DESC90_RATEMCS32; break; + + default: break; } return ret; } @@ -2320,33 +2319,33 @@ void rtl8192_link_change(struct net_device *dev) // RT_TRACE(COMP_CH, "========>%s(), chan:%d\n", __FUNCTION__, priv->chan); // rtl8192_set_chan(dev, priv->chan); if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC) - { - u32 reg = 0; - reg = read_nic_dword(dev, RCR); - if (priv->ieee80211->state == IEEE80211_LINKED) - priv->ReceiveConfig = reg |= RCR_CBSSID; - else - priv->ReceiveConfig = reg &= ~RCR_CBSSID; - write_nic_dword(dev, RCR, reg); - } + { + u32 reg = 0; + reg = read_nic_dword(dev, RCR); + if (priv->ieee80211->state == IEEE80211_LINKED) + priv->ReceiveConfig = reg |= RCR_CBSSID; + else + priv->ReceiveConfig = reg &= ~RCR_CBSSID; + write_nic_dword(dev, RCR, reg); + } // rtl8192_set_rxconf(dev); } static struct ieee80211_qos_parameters def_qos_parameters = { - {3,3,3,3},/* cw_min */ - {7,7,7,7},/* cw_max */ - {2,2,2,2},/* aifs */ - {0,0,0,0},/* flags */ - {0,0,0,0} /* tx_op_limit */ + {3,3,3,3},/* cw_min */ + {7,7,7,7},/* cw_max */ + {2,2,2,2},/* aifs */ + {0,0,0,0},/* flags */ + {0,0,0,0} /* tx_op_limit */ }; void rtl8192_update_beacon(struct work_struct * work) { - struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work); - struct net_device *dev = priv->ieee80211->dev; - struct ieee80211_device* ieee = priv->ieee80211; + struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work); + struct net_device *dev = priv->ieee80211->dev; + struct ieee80211_device* ieee = priv->ieee80211; struct ieee80211_network* net = &ieee->current_network; if (ieee->pHTInfo->bCurrentHTSupport) @@ -2717,7 +2716,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->bDisableNormalResetCheck = false; priv->force_reset = false; - priv->ieee80211->FwRWRF = 0; //we don't use FW read/write RF until stable firmware is available. + priv->ieee80211->FwRWRF = 0; //we don't use FW read/write RF until stable firmware is available. priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL; priv->ieee80211->iw_mode = IW_MODE_INFRA; priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN | @@ -2778,11 +2777,11 @@ static void rtl8192_init_priv_variable(struct net_device* dev) #ifdef TO_DO_LIST if(Adapter->bInHctTest) pHalData->ReceiveConfig = pHalData->CSMethod | - RCR_AMF | RCR_ADF | //RCR_AAP | //accept management/data + RCR_AMF | RCR_ADF | //RCR_AAP | //accept management/data //guangan200710 RCR_ACF | //accept control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko. RCR_AB | RCR_AM | RCR_APM | //accept BC/MC/UC - RCR_AICV | RCR_ACRC32 | //accept ICV/CRC error packet + RCR_AICV | RCR_ACRC32 | //accept ICV/CRC error packet ((u32)7<<RCR_MXDMA_OFFSET) | // Max DMA Burst Size per Rx DMA Burst, 7: unlimited. (pHalData->EarlyRxThreshold<<RCR_FIFO_OFFSET) | // Rx FIFO Threshold, 7: No Rx threshold. (pHalData->EarlyRxThreshold == 7 ? RCR_OnlyErlPkt:0); @@ -2793,7 +2792,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev) RCR_AMF | RCR_ADF | //accept management/data RCR_ACF | //accept control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko. RCR_AB | RCR_AM | RCR_APM | //accept BC/MC/UC - //RCR_AICV | RCR_ACRC32 | //accept ICV/CRC error packet + //RCR_AICV | RCR_ACRC32 | //accept ICV/CRC error packet ((u32)7<<RCR_MXDMA_OFFSET)| // Max DMA Burst Size per Rx DMA Burst, 7: unlimited. (priv->EarlyRxThreshold<<RX_FIFO_THRESHOLD_SHIFT) | // Rx FIFO Threshold, 7: No Rx threshold. (priv->EarlyRxThreshold == 7 ? RCR_ONLYERLPKT:0); @@ -3549,7 +3548,7 @@ HalTxCheckStuck819xUsb( ) { struct r8192_priv *priv = ieee80211_priv(dev); - u16 RegTxCounter = read_nic_word(dev, 0x128); + u16 RegTxCounter = read_nic_word(dev, 0x128); bool bStuck = FALSE; RT_TRACE(COMP_RESET,"%s():RegTxCounter is %d,TxCounter is %d\n",__FUNCTION__,RegTxCounter,priv->TxCounter); if(priv->TxCounter==RegTxCounter) @@ -3583,16 +3582,16 @@ TxCheckStuck(struct net_device *dev) // spin_lock_irqsave(&priv->ieee80211->lock,flags); for (QueueID = 0; QueueID<=BEACON_QUEUE;QueueID ++) { - if(QueueID == TXCMD_QUEUE) - continue; + if(QueueID == TXCMD_QUEUE) + continue; #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_drv_aggQ[QueueID]) == 0)) #else - if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0)) + if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0)) #endif - continue; + continue; - bCheckFwTxCnt = true; + bCheckFwTxCnt = true; } // PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); // spin_unlock_irqrestore(&priv->ieee80211->lock,flags); @@ -3611,10 +3610,10 @@ TxCheckStuck(struct net_device *dev) bool HalRxCheckStuck819xUsb(struct net_device *dev) { - u16 RegRxCounter = read_nic_word(dev, 0x130); + u16 RegRxCounter = read_nic_word(dev, 0x130); struct r8192_priv *priv = ieee80211_priv(dev); bool bStuck = FALSE; - static u8 rx_chk_cnt = 0; + static u8 rx_chk_cnt; RT_TRACE(COMP_RESET,"%s(): RegRxCounter is %d,RxCounter is %d\n",__FUNCTION__,RegRxCounter,priv->RxCounter); // If rssi is small, we should check rx for long time because of bad rx. // or maybe it will continuous silent reset every 2 seconds. @@ -3718,7 +3717,7 @@ rtl819x_ifcheck_resetornot(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); RESET_TYPE TxResetType = RESET_TYPE_NORESET; RESET_TYPE RxResetType = RESET_TYPE_NORESET; - RT_RF_POWER_STATE rfState; + RT_RF_POWER_STATE rfState; rfState = priv->ieee80211->eRFPowerState; @@ -4006,18 +4005,18 @@ RESET_START: void CAM_read_entry( struct net_device *dev, - u32 iIndex + u32 iIndex ) { - u32 target_command=0; + u32 target_command=0; u32 target_content=0; u8 entry_i=0; u32 ulStatus; s32 i=100; // printk("=======>start read CAM\n"); - for(entry_i=0;entry_i<CAM_CONTENT_COUNT;entry_i++) - { - // polling bit, and No Write enable, and address + for(entry_i=0;entry_i<CAM_CONTENT_COUNT;entry_i++) + { + // polling bit, and No Write enable, and address target_command= entry_i+CAM_CONTENT_COUNT*iIndex; target_command= target_command | BIT31; @@ -4049,7 +4048,7 @@ void rtl819x_update_rxcounts( u32* TotalRxDataNum ) { - u16 SlotIndex; + u16 SlotIndex; u8 i; *TotalRxBcnNum = 0; @@ -4072,7 +4071,7 @@ extern void rtl819x_watchdog_wqcallback(struct work_struct *work) struct net_device *dev = priv->ieee80211->dev; struct ieee80211_device* ieee = priv->ieee80211; RESET_TYPE ResetType = RESET_TYPE_NORESET; - static u8 check_reset_cnt=0; + static u8 check_reset_cnt; bool bBusyTraffic = false; if(!priv->up) @@ -4111,7 +4110,7 @@ extern void rtl819x_watchdog_wqcallback(struct work_struct *work) notify_wx_assoc_event(priv->ieee80211); RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid); priv->ieee80211->link_change(dev); - queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq); + queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq); } } @@ -4122,7 +4121,7 @@ extern void rtl819x_watchdog_wqcallback(struct work_struct *work) //check if reset the driver if(check_reset_cnt++ >= 3) { - ResetType = rtl819x_ifcheck_resetornot(dev); + ResetType = rtl819x_ifcheck_resetornot(dev); check_reset_cnt = 3; //DbgPrint("Start to check silent reset\n"); } @@ -4365,66 +4364,66 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } switch (cmd) { - case RTL_IOCTL_WPA_SUPPLICANT: + case RTL_IOCTL_WPA_SUPPLICANT: //parse here for HW security - if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) + if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) + { + if (ipw->u.crypt.set_tx) { - 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 (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) - { - memcpy((u8*)key, ipw->u.crypt.key, 16); - EnableHWSecurityConfig8192(dev); - //we fill both index entry and 4th entry for pairwise key as in IPW interface, adhoc will only get here, so we need index entry for its default key serching! - //added by WB. - setKey(dev, 4, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key); - if (ieee->auth_mode != 2) - setKey(dev, ipw->u.crypt.idx, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key); - } + 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 //if (ipw->u.crypt.idx) //group key use idx > 0 + else + ieee->pairwise_key_type = KEY_TYPE_NA; + + if (ieee->pairwise_key_type) { 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; + EnableHWSecurityConfig8192(dev); + //we fill both index entry and 4th entry for pairwise key as in IPW interface, adhoc will only get here, so we need index entry for its default key serching! + //added by WB. + setKey(dev, 4, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key); + if (ieee->auth_mode != 2) + setKey(dev, ipw->u.crypt.idx, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key); + } + } + else //if (ipw->u.crypt.idx) //group key use idx > 0 + { + 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) - { - setKey( dev, - ipw->u.crypt.idx, - ipw->u.crypt.idx, //KeyIndex - ieee->group_key_type, //KeyType - broadcast_addr, //MacAddr - 0, //DefaultKey - key); //KeyContent - } + if (ieee->group_key_type) + { + setKey( dev, + ipw->u.crypt.idx, + ipw->u.crypt.idx, //KeyIndex + ieee->group_key_type, //KeyType + broadcast_addr, //MacAddr + 0, //DefaultKey + key); //KeyContent } } + } #ifdef JOHN_HWSEC_DEBUG //john's test 0711 printk("@@ wrq->u pointer = "); @@ -4437,7 +4436,7 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data); break; - default: + default: ret = -EOPNOTSUPP; break; } @@ -4454,49 +4453,49 @@ u8 HwRateToMRate90(bool bIsHT, u8 rate) if(!bIsHT) { switch(rate) { - case DESC90_RATE1M: ret_rate = MGN_1M; break; - case DESC90_RATE2M: ret_rate = MGN_2M; break; - case DESC90_RATE5_5M: ret_rate = MGN_5_5M; break; - case DESC90_RATE11M: ret_rate = MGN_11M; break; - case DESC90_RATE6M: ret_rate = MGN_6M; break; - case DESC90_RATE9M: ret_rate = MGN_9M; break; - case DESC90_RATE12M: ret_rate = MGN_12M; break; - case DESC90_RATE18M: ret_rate = MGN_18M; break; - case DESC90_RATE24M: ret_rate = MGN_24M; break; - case DESC90_RATE36M: ret_rate = MGN_36M; break; - case DESC90_RATE48M: ret_rate = MGN_48M; break; - case DESC90_RATE54M: ret_rate = MGN_54M; break; - - default: - ret_rate = 0xff; - RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); - break; + case DESC90_RATE1M: ret_rate = MGN_1M; break; + case DESC90_RATE2M: ret_rate = MGN_2M; break; + case DESC90_RATE5_5M: ret_rate = MGN_5_5M; break; + case DESC90_RATE11M: ret_rate = MGN_11M; break; + case DESC90_RATE6M: ret_rate = MGN_6M; break; + case DESC90_RATE9M: ret_rate = MGN_9M; break; + case DESC90_RATE12M: ret_rate = MGN_12M; break; + case DESC90_RATE18M: ret_rate = MGN_18M; break; + case DESC90_RATE24M: ret_rate = MGN_24M; break; + case DESC90_RATE36M: ret_rate = MGN_36M; break; + case DESC90_RATE48M: ret_rate = MGN_48M; break; + case DESC90_RATE54M: ret_rate = MGN_54M; break; + + default: + ret_rate = 0xff; + RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); + break; } } else { switch(rate) { - case DESC90_RATEMCS0: ret_rate = MGN_MCS0; break; - case DESC90_RATEMCS1: ret_rate = MGN_MCS1; break; - case DESC90_RATEMCS2: ret_rate = MGN_MCS2; break; - case DESC90_RATEMCS3: ret_rate = MGN_MCS3; break; - case DESC90_RATEMCS4: ret_rate = MGN_MCS4; break; - case DESC90_RATEMCS5: ret_rate = MGN_MCS5; break; - case DESC90_RATEMCS6: ret_rate = MGN_MCS6; break; - case DESC90_RATEMCS7: ret_rate = MGN_MCS7; break; - case DESC90_RATEMCS8: ret_rate = MGN_MCS8; break; - case DESC90_RATEMCS9: ret_rate = MGN_MCS9; break; - case DESC90_RATEMCS10: ret_rate = MGN_MCS10; break; - case DESC90_RATEMCS11: ret_rate = MGN_MCS11; break; - case DESC90_RATEMCS12: ret_rate = MGN_MCS12; break; - case DESC90_RATEMCS13: ret_rate = MGN_MCS13; break; - case DESC90_RATEMCS14: ret_rate = MGN_MCS14; break; - case DESC90_RATEMCS15: ret_rate = MGN_MCS15; break; - case DESC90_RATEMCS32: ret_rate = (0x80|0x20); break; - - default: - ret_rate = 0xff; - RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n",rate, bIsHT); - break; + case DESC90_RATEMCS0: ret_rate = MGN_MCS0; break; + case DESC90_RATEMCS1: ret_rate = MGN_MCS1; break; + case DESC90_RATEMCS2: ret_rate = MGN_MCS2; break; + case DESC90_RATEMCS3: ret_rate = MGN_MCS3; break; + case DESC90_RATEMCS4: ret_rate = MGN_MCS4; break; + case DESC90_RATEMCS5: ret_rate = MGN_MCS5; break; + case DESC90_RATEMCS6: ret_rate = MGN_MCS6; break; + case DESC90_RATEMCS7: ret_rate = MGN_MCS7; break; + case DESC90_RATEMCS8: ret_rate = MGN_MCS8; break; + case DESC90_RATEMCS9: ret_rate = MGN_MCS9; break; + case DESC90_RATEMCS10: ret_rate = MGN_MCS10; break; + case DESC90_RATEMCS11: ret_rate = MGN_MCS11; break; + case DESC90_RATEMCS12: ret_rate = MGN_MCS12; break; + case DESC90_RATEMCS13: ret_rate = MGN_MCS13; break; + case DESC90_RATEMCS14: ret_rate = MGN_MCS14; break; + case DESC90_RATEMCS15: ret_rate = MGN_MCS15; break; + case DESC90_RATEMCS32: ret_rate = (0x80|0x20); break; + + default: + ret_rate = 0xff; + RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n",rate, bIsHT); + break; } } @@ -4555,12 +4554,12 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802 u8 rfpath; u32 nspatial_stream, tmp_val; //u8 i; - static u32 slide_rssi_index=0, slide_rssi_statistics=0; - static u32 slide_evm_index=0, slide_evm_statistics=0; - static u32 last_rssi=0, last_evm=0; + static u32 slide_rssi_index, slide_rssi_statistics; + static u32 slide_evm_index, slide_evm_statistics; + static u32 last_rssi, last_evm; - static u32 slide_beacon_adc_pwdb_index=0, slide_beacon_adc_pwdb_statistics=0; - static u32 last_beacon_adc_pwdb=0; + static u32 slide_beacon_adc_pwdb_index, slide_beacon_adc_pwdb_statistics; + static u32 last_beacon_adc_pwdb; struct ieee80211_hdr_3addr *hdr; u16 sc ; @@ -4808,9 +4807,9 @@ rtl819x_evm_dbtopercentage( ret_val = value; if(ret_val >= 0) - ret_val = 0; + ret_val = 0; if(ret_val <= -33) - ret_val = -33; + ret_val = -33; ret_val = 0 - ret_val; ret_val*=3; if(ret_val == 99) @@ -4819,7 +4818,7 @@ rtl819x_evm_dbtopercentage( } // // Description: -// We want good-looking for signal strength/quality +// We want good-looking for signal strength/quality // 2007/7/19 01:09, by cosa. // long @@ -5203,7 +5202,7 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, * Overview: Record the received data rate * * Input: -* struct net_device *dev +* struct net_device *dev * struct ieee80211_rx_stats *stats * * Output: @@ -5581,7 +5580,7 @@ rtl819xusb_process_received_packet( ) { // bool bfreerfd=false, bqueued=false; - u8* frame; + u8* frame; u16 frame_len=0; struct r8192_priv *priv = ieee80211_priv(dev); // u8 index = 0; @@ -5697,25 +5696,25 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) info = (struct rtl8192_rx_info *)skb->cb; switch (info->out_pipe) { /* Nomal packet pipe */ - case 3: - //RT_TRACE(COMP_RECV, "normal in-pipe index(%d)\n",info->out_pipe); - priv->IrpPendingCount--; - rtl8192_rx_nomal(skb); - break; + case 3: + //RT_TRACE(COMP_RECV, "normal in-pipe index(%d)\n",info->out_pipe); + priv->IrpPendingCount--; + rtl8192_rx_nomal(skb); + break; - /* Command packet pipe */ - case 9: - RT_TRACE(COMP_RECV, "command in-pipe index(%d)\n",\ - info->out_pipe); + /* Command packet pipe */ + case 9: + RT_TRACE(COMP_RECV, "command in-pipe index(%d)\n",\ + info->out_pipe); - rtl8192_rx_cmd(skb); - break; + rtl8192_rx_cmd(skb); + break; - default: /* should never get here! */ - RT_TRACE(COMP_ERR, "Unknown in-pipe index(%d)\n",\ - info->out_pipe); - dev_kfree_skb(skb); - break; + default: /* should never get here! */ + RT_TRACE(COMP_ERR, "Unknown in-pipe index(%d)\n",\ + info->out_pipe); + dev_kfree_skb(skb); + break; } } @@ -6007,7 +6006,7 @@ void setKey( struct net_device *dev, // printk("setkey cam =%8x\n", read_cam(dev, i+6*EntryNo)); } else if(i==1){//MAC - TargetContent = (u32)(*(MacAddr+2)) | + TargetContent = (u32)(*(MacAddr+2)) | (u32)(*(MacAddr+3)) << 8| (u32)(*(MacAddr+4)) << 16| (u32)(*(MacAddr+5)) << 24; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index cd8dc85e9c0f..ea46717f1fad 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -8,7 +8,7 @@ Abstract: HW dynamic mechanism. Major Change History: - When Who What + When Who What ---------- --------------- ------------------------------- 2008-05-14 amy create version 0 porting from windows code. @@ -25,9 +25,9 @@ Major Change History: // Indicate different AP vendor for IOT issue. // static u32 edca_setting_DL[HT_IOT_PEER_MAX] = - { 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f}; + { 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f}; static u32 edca_setting_UL[HT_IOT_PEER_MAX] = - { 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f}; + { 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f}; #define RTK_UL_EDCA 0xa44f @@ -134,7 +134,7 @@ static void dm_check_pbc_gpio(struct net_device *dev); // DM --> Check current RX RF path state static void dm_check_rx_path_selection(struct net_device *dev); -static void dm_init_rxpath_selection(struct net_device *dev); +static void dm_init_rxpath_selection(struct net_device *dev); static void dm_rxpath_sel_byrssi(struct net_device *dev); @@ -201,8 +201,8 @@ extern void deinit_hal_dm(struct net_device *dev) void dm_CheckRxAggregation(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; - static unsigned long lastTxOkCnt = 0; - static unsigned long lastRxOkCnt = 0; + static unsigned long lastTxOkCnt; + static unsigned long lastRxOkCnt; unsigned long curTxOkCnt = 0; unsigned long curRxOkCnt = 0; @@ -259,7 +259,7 @@ extern void hal_dm_watchdog(struct net_device *dev) { //struct r8192_priv *priv = ieee80211_priv(dev); - //static u8 previous_bssid[6] ={0}; + //static u8 previous_bssid[6] ={0}; /*Add by amy 2008/05/15 ,porting from windows code.*/ dm_check_rate_adaptive(dev); @@ -315,21 +315,21 @@ extern void init_rate_adaptive(struct net_device * dev) { // 07/10/08 MH Modify for RA smooth scheme. /* 2008/01/11 MH Modify 2T RATR table for different RSSI. 080515 porting by amy from windows code.*/ - pra->upper_rssi_threshold_ratr = 0x8f0f0000; - pra->middle_rssi_threshold_ratr = 0x8f0ff000; - pra->low_rssi_threshold_ratr = 0x8f0ff001; - pra->low_rssi_threshold_ratr_40M = 0x8f0ff005; - pra->low_rssi_threshold_ratr_20M = 0x8f0ff001; - pra->ping_rssi_ratr = 0x0000000d;//cosa add for test + pra->upper_rssi_threshold_ratr = 0x8f0f0000; + pra->middle_rssi_threshold_ratr = 0x8f0ff000; + pra->low_rssi_threshold_ratr = 0x8f0ff001; + pra->low_rssi_threshold_ratr_40M = 0x8f0ff005; + pra->low_rssi_threshold_ratr_20M = 0x8f0ff001; + pra->ping_rssi_ratr = 0x0000000d;//cosa add for test } else if (priv->rf_type == RF_1T2R) { - pra->upper_rssi_threshold_ratr = 0x000f0000; - pra->middle_rssi_threshold_ratr = 0x000ff000; - pra->low_rssi_threshold_ratr = 0x000ff001; - pra->low_rssi_threshold_ratr_40M = 0x000ff005; - pra->low_rssi_threshold_ratr_20M = 0x000ff001; - pra->ping_rssi_ratr = 0x0000000d;//cosa add for test + pra->upper_rssi_threshold_ratr = 0x000f0000; + pra->middle_rssi_threshold_ratr = 0x000ff000; + pra->low_rssi_threshold_ratr = 0x000ff001; + pra->low_rssi_threshold_ratr_40M = 0x000ff005; + pra->low_rssi_threshold_ratr_20M = 0x000ff001; + pra->ping_rssi_ratr = 0x0000000d;//cosa add for test } } // InitRateAdaptive @@ -348,7 +348,7 @@ extern void init_rate_adaptive(struct net_device * dev) * * Revised History: * When Who Remark - * 05/26/08 amy Create version 0 porting from windows code. + * 05/26/08 amy Create version 0 porting from windows code. * *---------------------------------------------------------------------------*/ static void dm_check_rate_adaptive(struct net_device * dev) @@ -359,7 +359,7 @@ static void dm_check_rate_adaptive(struct net_device * dev) u32 currentRATR, targetRATR = 0; u32 LowRSSIThreshForRA = 0, HighRSSIThreshForRA = 0; bool bshort_gi_enabled = false; - static u8 ping_rssi_state=0; + static u8 ping_rssi_state; if(!priv->up) @@ -413,14 +413,14 @@ static void dm_check_rate_adaptive(struct net_device * dev) to prevent jumping frequently. */ if (pra->ratr_state == DM_RATR_STA_HIGH) { - HighRSSIThreshForRA = pra->high2low_rssi_thresh_for_ra; + HighRSSIThreshForRA = pra->high2low_rssi_thresh_for_ra; LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)? (pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M); } else if (pra->ratr_state == DM_RATR_STA_LOW) { HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra; - LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)? + LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)? (pra->low2high_rssi_thresh_for_ra40M):(pra->low2high_rssi_thresh_for_ra20M); } else @@ -599,7 +599,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device * dev) u32 Value; u8 Pwr_Flag; u16 Avg_TSSI_Meas, TSSI_13dBm, Avg_TSSI_Meas_from_driver=0; - //RT_STATUS rtStatus = RT_STATUS_SUCCESS; + //RT_STATUS rtStatus = RT_STATUS_SUCCESS; bool rtStatus = true; u32 delta=0; @@ -954,79 +954,79 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); //Initial the Tx BB index and mapping value - priv->txbbgain_table[0].txbb_iq_amplifygain = 12; + priv->txbbgain_table[0].txbb_iq_amplifygain = 12; priv->txbbgain_table[0].txbbgain_value=0x7f8001fe; - priv->txbbgain_table[1].txbb_iq_amplifygain = 11; + priv->txbbgain_table[1].txbb_iq_amplifygain = 11; priv->txbbgain_table[1].txbbgain_value=0x788001e2; - priv->txbbgain_table[2].txbb_iq_amplifygain = 10; + priv->txbbgain_table[2].txbb_iq_amplifygain = 10; priv->txbbgain_table[2].txbbgain_value=0x71c001c7; - priv->txbbgain_table[3].txbb_iq_amplifygain = 9; + priv->txbbgain_table[3].txbb_iq_amplifygain = 9; priv->txbbgain_table[3].txbbgain_value=0x6b8001ae; - priv->txbbgain_table[4].txbb_iq_amplifygain = 8; + priv->txbbgain_table[4].txbb_iq_amplifygain = 8; priv->txbbgain_table[4].txbbgain_value=0x65400195; - priv->txbbgain_table[5].txbb_iq_amplifygain = 7; + priv->txbbgain_table[5].txbb_iq_amplifygain = 7; priv->txbbgain_table[5].txbbgain_value=0x5fc0017f; - priv->txbbgain_table[6].txbb_iq_amplifygain = 6; + priv->txbbgain_table[6].txbb_iq_amplifygain = 6; priv->txbbgain_table[6].txbbgain_value=0x5a400169; - priv->txbbgain_table[7].txbb_iq_amplifygain = 5; + priv->txbbgain_table[7].txbb_iq_amplifygain = 5; priv->txbbgain_table[7].txbbgain_value=0x55400155; - priv->txbbgain_table[8].txbb_iq_amplifygain = 4; + priv->txbbgain_table[8].txbb_iq_amplifygain = 4; priv->txbbgain_table[8].txbbgain_value=0x50800142; - priv->txbbgain_table[9].txbb_iq_amplifygain = 3; + priv->txbbgain_table[9].txbb_iq_amplifygain = 3; priv->txbbgain_table[9].txbbgain_value=0x4c000130; - priv->txbbgain_table[10].txbb_iq_amplifygain = 2; + priv->txbbgain_table[10].txbb_iq_amplifygain = 2; priv->txbbgain_table[10].txbbgain_value=0x47c0011f; - priv->txbbgain_table[11].txbb_iq_amplifygain = 1; + priv->txbbgain_table[11].txbb_iq_amplifygain = 1; priv->txbbgain_table[11].txbbgain_value=0x43c0010f; - priv->txbbgain_table[12].txbb_iq_amplifygain = 0; + priv->txbbgain_table[12].txbb_iq_amplifygain = 0; priv->txbbgain_table[12].txbbgain_value=0x40000100; - priv->txbbgain_table[13].txbb_iq_amplifygain = -1; + priv->txbbgain_table[13].txbb_iq_amplifygain = -1; priv->txbbgain_table[13].txbbgain_value=0x3c8000f2; - priv->txbbgain_table[14].txbb_iq_amplifygain = -2; + priv->txbbgain_table[14].txbb_iq_amplifygain = -2; priv->txbbgain_table[14].txbbgain_value=0x390000e4; - priv->txbbgain_table[15].txbb_iq_amplifygain = -3; + priv->txbbgain_table[15].txbb_iq_amplifygain = -3; priv->txbbgain_table[15].txbbgain_value=0x35c000d7; - priv->txbbgain_table[16].txbb_iq_amplifygain = -4; + priv->txbbgain_table[16].txbb_iq_amplifygain = -4; priv->txbbgain_table[16].txbbgain_value=0x32c000cb; - priv->txbbgain_table[17].txbb_iq_amplifygain = -5; + priv->txbbgain_table[17].txbb_iq_amplifygain = -5; priv->txbbgain_table[17].txbbgain_value=0x300000c0; - priv->txbbgain_table[18].txbb_iq_amplifygain = -6; + priv->txbbgain_table[18].txbb_iq_amplifygain = -6; priv->txbbgain_table[18].txbbgain_value=0x2d4000b5; - priv->txbbgain_table[19].txbb_iq_amplifygain = -7; + priv->txbbgain_table[19].txbb_iq_amplifygain = -7; priv->txbbgain_table[19].txbbgain_value=0x2ac000ab; - priv->txbbgain_table[20].txbb_iq_amplifygain = -8; + priv->txbbgain_table[20].txbb_iq_amplifygain = -8; priv->txbbgain_table[20].txbbgain_value=0x288000a2; - priv->txbbgain_table[21].txbb_iq_amplifygain = -9; + priv->txbbgain_table[21].txbb_iq_amplifygain = -9; priv->txbbgain_table[21].txbbgain_value=0x26000098; - priv->txbbgain_table[22].txbb_iq_amplifygain = -10; + priv->txbbgain_table[22].txbb_iq_amplifygain = -10; priv->txbbgain_table[22].txbbgain_value=0x24000090; - priv->txbbgain_table[23].txbb_iq_amplifygain = -11; + priv->txbbgain_table[23].txbb_iq_amplifygain = -11; priv->txbbgain_table[23].txbbgain_value=0x22000088; - priv->txbbgain_table[24].txbb_iq_amplifygain = -12; + priv->txbbgain_table[24].txbb_iq_amplifygain = -12; priv->txbbgain_table[24].txbbgain_value=0x20000080; - priv->txbbgain_table[25].txbb_iq_amplifygain = -13; + priv->txbbgain_table[25].txbb_iq_amplifygain = -13; priv->txbbgain_table[25].txbbgain_value=0x1a00006c; - priv->txbbgain_table[26].txbb_iq_amplifygain = -14; + priv->txbbgain_table[26].txbb_iq_amplifygain = -14; priv->txbbgain_table[26].txbbgain_value=0x1c800072; - priv->txbbgain_table[27].txbb_iq_amplifygain = -15; + priv->txbbgain_table[27].txbb_iq_amplifygain = -15; priv->txbbgain_table[27].txbbgain_value=0x18000060; - priv->txbbgain_table[28].txbb_iq_amplifygain = -16; + priv->txbbgain_table[28].txbb_iq_amplifygain = -16; priv->txbbgain_table[28].txbbgain_value=0x19800066; - priv->txbbgain_table[29].txbb_iq_amplifygain = -17; + priv->txbbgain_table[29].txbb_iq_amplifygain = -17; priv->txbbgain_table[29].txbbgain_value=0x15800056; - priv->txbbgain_table[30].txbb_iq_amplifygain = -18; + priv->txbbgain_table[30].txbb_iq_amplifygain = -18; priv->txbbgain_table[30].txbbgain_value=0x26c0005b; - priv->txbbgain_table[31].txbb_iq_amplifygain = -19; + priv->txbbgain_table[31].txbb_iq_amplifygain = -19; priv->txbbgain_table[31].txbbgain_value=0x14400051; - priv->txbbgain_table[32].txbb_iq_amplifygain = -20; + priv->txbbgain_table[32].txbb_iq_amplifygain = -20; priv->txbbgain_table[32].txbbgain_value=0x24400051; - priv->txbbgain_table[33].txbb_iq_amplifygain = -21; + priv->txbbgain_table[33].txbb_iq_amplifygain = -21; priv->txbbgain_table[33].txbbgain_value=0x1300004c; - priv->txbbgain_table[34].txbb_iq_amplifygain = -22; + priv->txbbgain_table[34].txbb_iq_amplifygain = -22; priv->txbbgain_table[34].txbbgain_value=0x12000048; - priv->txbbgain_table[35].txbb_iq_amplifygain = -23; + priv->txbbgain_table[35].txbb_iq_amplifygain = -23; priv->txbbgain_table[35].txbbgain_value=0x11000044; - priv->txbbgain_table[36].txbb_iq_amplifygain = -24; + priv->txbbgain_table[36].txbb_iq_amplifygain = -24; priv->txbbgain_table[36].txbbgain_value=0x10000040; //ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29 @@ -1486,7 +1486,7 @@ void dm_initialize_txpower_tracking(struct net_device *dev) static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - static u32 tx_power_track_counter = 0; + static u32 tx_power_track_counter; if(!priv->btxpower_tracking) return; @@ -1505,7 +1505,7 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev) static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - static u8 TM_Trigger=0; + static u8 TM_Trigger; //DbgPrint("dm_CheckTXPowerTracking() \n"); if(!priv->btxpower_tracking) return; @@ -1564,40 +1564,40 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) TempVal = 0; if(!bInCH14){ //Write 0xa22 0xa23 - TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] + + TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ; rtl8192_setBBreg(dev, rCCK0_TxFilter1,bMaskHWord, TempVal); //Write 0xa24 ~ 0xa27 TempVal = 0; - TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] + + TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[3]<<8) + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[4]<<16 )+ (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[5]<<24); rtl8192_setBBreg(dev, rCCK0_TxFilter2,bMaskDWord, TempVal); //Write 0xa28 0xa29 TempVal = 0; - TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] + + TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ; rtl8192_setBBreg(dev, rCCK0_DebugPort,bMaskLWord, TempVal); } else { - TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] + + TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ; rtl8192_setBBreg(dev, rCCK0_TxFilter1,bMaskHWord, TempVal); //Write 0xa24 ~ 0xa27 TempVal = 0; - TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] + + TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[3]<<8) + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[4]<<16 )+ (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[5]<<24); rtl8192_setBBreg(dev, rCCK0_TxFilter2,bMaskDWord, TempVal); //Write 0xa28 0xa29 TempVal = 0; - TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] + + TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ; rtl8192_setBBreg(dev, rCCK0_DebugPort,bMaskLWord, TempVal); @@ -1615,14 +1615,14 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH if(!bInCH14) { //Write 0xa22 0xa23 - TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] + + TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8) ; rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter1, TempVal); //Write 0xa24 ~ 0xa27 TempVal = 0; - TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][2] + + TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][2] + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][3]<<8) + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][4]<<16 )+ (CCKSwingTable_Ch1_Ch13[priv->CCK_index][5]<<24); @@ -1631,7 +1631,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH rCCK0_TxFilter2, TempVal); //Write 0xa28 0xa29 TempVal = 0; - TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] + + TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8) ; rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); @@ -1642,7 +1642,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH { // priv->CCKTxPowerAdjustCntNotCh14++; //cosa add for debug. //Write 0xa22 0xa23 - TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] + + TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] + (CCKSwingTable_Ch14[priv->CCK_index][1]<<8) ; rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); @@ -1650,7 +1650,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH rCCK0_TxFilter1, TempVal); //Write 0xa24 ~ 0xa27 TempVal = 0; - TempVal = CCKSwingTable_Ch14[priv->CCK_index][2] + + TempVal = CCKSwingTable_Ch14[priv->CCK_index][2] + (CCKSwingTable_Ch14[priv->CCK_index][3]<<8) + (CCKSwingTable_Ch14[priv->CCK_index][4]<<16 )+ (CCKSwingTable_Ch14[priv->CCK_index][5]<<24); @@ -1659,7 +1659,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH rCCK0_TxFilter2, TempVal); //Write 0xa28 0xa29 TempVal = 0; - TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] + + TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] + (CCKSwingTable_Ch14[priv->CCK_index][7]<<8) ; rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); @@ -1713,7 +1713,7 @@ static void dm_txpower_reset_recovery( extern void dm_restore_dynamic_mechanism_state(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - u32 reg_ratr = priv->rate_adaptive.last_ratr; + u32 reg_ratr = priv->rate_adaptive.last_ratr; if(!priv->up) { @@ -1934,7 +1934,7 @@ dm_change_rxpath_selection_setting( s32 DM_Value) { struct r8192_priv *priv = ieee80211_priv(dev); - prate_adaptive pRA = (prate_adaptive)&(priv->rate_adaptive); + prate_adaptive pRA = (prate_adaptive)&(priv->rate_adaptive); if(DM_Type == 0) @@ -2036,8 +2036,8 @@ static void dm_dig_init(struct net_device *dev) dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX; dm_digtable.initialgain_lowerbound_state = false; - dm_digtable.rssi_low_thresh = DM_DIG_THRESH_LOW; - dm_digtable.rssi_high_thresh = DM_DIG_THRESH_HIGH; + dm_digtable.rssi_low_thresh = DM_DIG_THRESH_LOW; + dm_digtable.rssi_high_thresh = DM_DIG_THRESH_HIGH; dm_digtable.rssi_high_power_lowthresh = DM_DIG_HIGH_PWR_THRESH_LOW; dm_digtable.rssi_high_power_highthresh = DM_DIG_HIGH_PWR_THRESH_HIGH; @@ -2091,7 +2091,7 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi( { struct r8192_priv *priv = ieee80211_priv(dev); u8 i; - static u8 fw_dig=0; + static u8 fw_dig; if (dm_digtable.dig_enable_flag == false) return; @@ -2131,7 +2131,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - static u32 reset_cnt = 0; + static u32 reset_cnt; u8 i; if (dm_digtable.dig_enable_flag == false) @@ -2319,7 +2319,7 @@ static void dm_ctrl_initgain_byrssi_highpwr( struct net_device * dev) { struct r8192_priv *priv = ieee80211_priv(dev); - static u32 reset_cnt_highpwr = 0; + static u32 reset_cnt_highpwr; // For smooth, we can not change high power DIG state in the range. if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_high_power_lowthresh) && @@ -2395,8 +2395,8 @@ static void dm_initial_gain( { struct r8192_priv *priv = ieee80211_priv(dev); u8 initial_gain=0; - static u8 initialized=0, force_write=0; - static u32 reset_cnt=0; + static u8 initialized, force_write; + static u32 reset_cnt; if(dm_digtable.dig_algorithm_switch) { @@ -2462,8 +2462,8 @@ static void dm_pd_th( struct net_device * dev) { struct r8192_priv *priv = ieee80211_priv(dev); - static u8 initialized=0, force_write=0; - static u32 reset_cnt = 0; + static u8 initialized, force_write; + static u32 reset_cnt; if(dm_digtable.dig_algorithm_switch) { @@ -2574,8 +2574,8 @@ static void dm_cs_ratio( struct net_device * dev) { struct r8192_priv *priv = ieee80211_priv(dev); - static u8 initialized=0,force_write=0; - static u32 reset_cnt = 0; + static u8 initialized,force_write; + static u32 reset_cnt; if(dm_digtable.dig_algorithm_switch) { @@ -2651,8 +2651,8 @@ static void dm_check_edca_turbo( //PSTA_QOS pStaQos = pMgntInfo->pStaQos; // Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. - static unsigned long lastTxOkCnt = 0; - static unsigned long lastRxOkCnt = 0; + static unsigned long lastTxOkCnt; + static unsigned long lastRxOkCnt; unsigned long curTxOkCnt = 0; unsigned long curRxOkCnt = 0; @@ -2785,8 +2785,8 @@ static void dm_ctstoself(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; - static unsigned long lastTxOkCnt = 0; - static unsigned long lastRxOkCnt = 0; + static unsigned long lastTxOkCnt; + static unsigned long lastRxOkCnt; unsigned long curTxOkCnt = 0; unsigned long curRxOkCnt = 0; @@ -2871,7 +2871,7 @@ static void dm_check_rfctrl_gpio(struct net_device * dev) * * Revised History: * When Who Remark - * 05/28/2008 amy Create Version 0 porting from windows code. + * 05/28/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ static void dm_check_pbc_gpio(struct net_device *dev) @@ -3044,7 +3044,7 @@ static void dm_rxpath_sel_byrssi(struct net_device * dev) u8 cck_rx_ver2_max_index=0, cck_rx_ver2_min_index=0, cck_rx_ver2_sec_index=0; u8 cur_rf_rssi; long cur_cck_pwdb; - static u8 disabled_rf_cnt=0, cck_Rx_Path_initialized=0; + static u8 disabled_rf_cnt, cck_Rx_Path_initialized; u8 update_cck_rx_path; if(priv->rf_type != RF_2T4R) @@ -3517,8 +3517,8 @@ static void dm_EndSWFsync(struct net_device *dev) static void dm_StartSWFsync(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - u32 rateIndex; - u32 rateBitmap; + u32 rateIndex; + u32 rateBitmap; RT_TRACE(COMP_HALDM,"%s\n", __FUNCTION__); // Initial rate record to zero, start to record. @@ -3569,9 +3569,9 @@ void dm_check_fsync(struct net_device *dev) #define RegC38_NonFsync_Other_AP 1 #define RegC38_Fsync_AP_BCM 2 struct r8192_priv *priv = ieee80211_priv(dev); - //u32 framesyncC34; + //u32 framesyncC34; static u8 reg_c38_State=RegC38_Default; - static u32 reset_cnt=0; + static u32 reset_cnt; RT_TRACE(COMP_HALDM, "RSSI %d TimeInterval %d MultipleTimeInterval %d\n", priv->ieee80211->fsync_rssi_threshold, priv->ieee80211->fsync_time_interval, priv->ieee80211->fsync_multiple_timeinterval); RT_TRACE(COMP_HALDM, "RateBitmap 0x%x FirstDiffRateThreshold %d SecondDiffRateThreshold %d\n", priv->ieee80211->fsync_rate_bitmap, priv->ieee80211->fsync_firstdiff_ratethreshold, priv->ieee80211->fsync_seconddiff_ratethreshold); @@ -3887,4 +3887,3 @@ static void dm_send_rssi_tofw(struct net_device *dev) } /*---------------------------Define function prototype------------------------*/ - diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index 3ceb59b9eca7..ffb083c958ad 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -13,7 +13,7 @@ * * History: * Data Who Remark - * 10/04/2007 MHC Create initial version. + * 10/04/2007 MHC Create initial version. * *****************************************************************************/ /* Check to see if the file has been included already. */ @@ -55,20 +55,19 @@ #define TX_POWER_NEAR_FIELD_THRESH_LOW 62 //added by amy for atheros AP #define TX_POWER_ATHEROAP_THRESH_HIGH 78 -#define TX_POWER_ATHEROAP_THRESH_LOW 72 +#define TX_POWER_ATHEROAP_THRESH_LOW 72 //defined by vivi, for showing on UI -#define Current_Tx_Rate_Reg 0x1b8 -#define Initial_Tx_Rate_Reg 0x1b9 -#define Tx_Retry_Count_Reg 0x1ac +#define Current_Tx_Rate_Reg 0x1b8 +#define Initial_Tx_Rate_Reg 0x1b9 +#define Tx_Retry_Count_Reg 0x1ac #define RegC38_TH 20 /*--------------------------Define Parameters-------------------------------*/ /*------------------------------Define structure----------------------------*/ /* 2007/10/04 MH Define upper and lower threshold of DIG enable or disable. */ -typedef struct _dynamic_initial_gain_threshold_ -{ +typedef struct _dynamic_initial_gain_threshold_ { u8 dig_enable_flag; u8 dig_algorithm; u8 dbg_mode; @@ -132,8 +131,8 @@ typedef enum tag_dynamic_init_gain_operation_type_definition DIG_TYPE_PWDB_FACTOR = 8, DIG_TYPE_RX_GAIN_MIN = 9, DIG_TYPE_RX_GAIN_MAX = 10, - DIG_TYPE_ENABLE = 20, - DIG_TYPE_DISABLE = 30, + DIG_TYPE_ENABLE = 20, + DIG_TYPE_DISABLE = 30, DIG_OP_TYPE_MAX }dm_dig_op_e; @@ -172,8 +171,7 @@ typedef enum tag_dig_cck_cs_ratio_state_definition DIG_CS_RATIO_HIGHER = 1, DIG_CS_MAX }dm_dig_cs_ratio_e; -typedef struct _Dynamic_Rx_Path_Selection_ -{ +typedef struct _Dynamic_Rx_Path_Selection_ { u8 Enable; u8 DbgMode; u8 cck_method; @@ -203,8 +201,7 @@ typedef enum tag_DM_DbgMode_Definition DM_DBG_MAX }DM_DBG_E; -typedef struct tag_Tx_Config_Cmd_Format -{ +typedef struct tag_Tx_Config_Cmd_Format { u32 Op; /* Command packet type. */ u32 Length; /* Command packet length. */ u32 Value; @@ -251,4 +248,3 @@ extern void dm_initialize_txpower_tracking(struct net_device *dev); /* End of r8192U_dm.h */ - diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h index 1bfe871dcfb2..15b0423356f8 100644 --- a/drivers/staging/rtl8192u/r8192U_hw.h +++ b/drivers/staging/rtl8192u/r8192U_hw.h @@ -122,7 +122,7 @@ enum _RTL8192Usb_HW { SIFS = 0x03E, // SIFS register TCR = 0x040, // Transmit Configuration Register -#define TCR_MXDMA_2048 7 +#define TCR_MXDMA_2048 7 #define TCR_LRL_OFFSET 0 #define TCR_SRL_OFFSET 8 #define TCR_MXDMA_OFFSET 21 @@ -379,7 +379,7 @@ enum _RTL8192Usb_HW { // IMR_POLL = 0x360, MacBlkCtrl = 0x403, // Mac block on/off control register - EPROM_CMD = 0xfe58, + EPROM_CMD = 0xfe58, #define Cmd9346CR_9356SEL (1<<4) #define EPROM_CMD_RESERVED_MASK (1<<5) #define EPROM_CMD_OPERATING_MODE_SHIFT 6 @@ -392,12 +392,12 @@ enum _RTL8192Usb_HW { #define EPROM_CK_SHIFT 2 #define EPROM_W_SHIFT 1 #define EPROM_R_SHIFT 0 - MAC0 = 0x000, - MAC1 = 0x001, - MAC2 = 0x002, - MAC3 = 0x003, - MAC4 = 0x004, - MAC5 = 0x005, + MAC0 = 0x000, + MAC1 = 0x001, + MAC2 = 0x002, + MAC3 = 0x003, + MAC4 = 0x004, + MAC5 = 0x005, }; //---------------------------------------------------------------------------- diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 71f2d2349c38..c904aa8cc0a6 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -354,8 +354,7 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, return ret; } -struct iw_range_with_scan_capa -{ +struct iw_range_with_scan_capa { /* Informative stuff (to choose between different interface) */ __u32 throughput; /* To give an idea... */ /* In theory this value should be the maximum benchmarked @@ -711,12 +710,12 @@ static int r8192_wx_set_enc(struct net_device *dev, #define CONF_WEP104 0x14 switch(wrqu->encoding.flags & IW_ENCODE_INDEX){ - case 0: key_idx = ieee->tx_keyidx; break; - case 1: key_idx = 0; break; - case 2: key_idx = 1; break; - case 3: key_idx = 2; break; - case 4: key_idx = 3; break; - default: break; + case 0: key_idx = ieee->tx_keyidx; break; + case 1: key_idx = 0; break; + case 2: key_idx = 1; break; + case 3: key_idx = 2; break; + case 4: key_idx = 3; break; + default: break; } if(wrqu->encoding.length==0x5){ @@ -1021,7 +1020,7 @@ static int dummy(struct net_device *dev, struct iw_request_info *a, static iw_handler r8192_wx_handlers[] = { NULL, /* SIOCSIWCOMMIT */ - r8192_wx_get_name, /* SIOCGIWNAME */ + r8192_wx_get_name, /* SIOCGIWNAME */ dummy, /* SIOCSIWNWID */ dummy, /* SIOCGIWNWID */ r8192_wx_set_freq, /* SIOCSIWFREQ */ @@ -1040,7 +1039,7 @@ static iw_handler r8192_wx_handlers[] = dummy, /* SIOCGIWSPY */ NULL, /* SIOCGIWTHRSPY */ NULL, /* SIOCWIWTHRSPY */ - r8192_wx_set_wap, /* SIOCSIWAP */ + r8192_wx_set_wap, /* SIOCSIWAP */ r8192_wx_get_wap, /* SIOCGIWAP */ #if (WIRELESS_EXT >= 18) r8192_wx_set_mlme, /* MLME-- */ @@ -1071,23 +1070,23 @@ static iw_handler r8192_wx_handlers[] = r8192_wx_set_power, /* SIOCSIWPOWER */ r8192_wx_get_power, /* SIOCGIWPOWER */ NULL, /*---hole---*/ - NULL, /*---hole---*/ - r8192_wx_set_gen_ie,//NULL, /* SIOCSIWGENIE */ - NULL, /* SIOCSIWGENIE */ + NULL, /*---hole---*/ + r8192_wx_set_gen_ie,//NULL, /* SIOCSIWGENIE */ + NULL, /* SIOCSIWGENIE */ #if (WIRELESS_EXT >= 18) - r8192_wx_set_auth,//NULL, /* SIOCSIWAUTH */ - NULL,//r8192_wx_get_auth,//NULL, /* SIOCSIWAUTH */ - r8192_wx_set_enc_ext, /* SIOCSIWENCODEEXT */ - NULL,//r8192_wx_get_enc_ext,//NULL, /* SIOCSIWENCODEEXT */ + r8192_wx_set_auth,//NULL, /* SIOCSIWAUTH */ + NULL,//r8192_wx_get_auth,//NULL, /* SIOCSIWAUTH */ + r8192_wx_set_enc_ext, /* SIOCSIWENCODEEXT */ + NULL,//r8192_wx_get_enc_ext,//NULL, /* SIOCSIWENCODEEXT */ #else NULL, NULL, NULL, NULL, #endif - NULL, /* SIOCSIWPMKSA */ - NULL, /*---hole---*/ + NULL, /* SIOCSIWPMKSA */ + NULL, /*---hole---*/ }; diff --git a/drivers/staging/rtl8192u/r819xU_HTGen.h b/drivers/staging/rtl8192u/r819xU_HTGen.h index f37b6d69b404..6a4678f7da5f 100644 --- a/drivers/staging/rtl8192u/r819xU_HTGen.h +++ b/drivers/staging/rtl8192u/r819xU_HTGen.h @@ -10,4 +10,3 @@ typedef enum _HT_IOT_ACTION{ HT_IOT_ACT_CDD_FSYNC = 0x00000020, HT_IOT_ACT_PURE_N_MODE = 0x00000040, }HT_IOT_ACTION_E, *PHT_IOT_ACTION_E; - diff --git a/drivers/staging/rtl8192u/r819xU_HTType.h b/drivers/staging/rtl8192u/r819xU_HTType.h index 6c1d05e1e820..19a7bdd1973a 100644 --- a/drivers/staging/rtl8192u/r819xU_HTType.h +++ b/drivers/staging/rtl8192u/r819xU_HTType.h @@ -89,7 +89,7 @@ typedef enum _CHNLOP{ typedef enum _HT_ACTION{ ACT_RECOMMAND_WIDTH = 0, - ACT_MIMO_PWR_SAVE = 1, + ACT_MIMO_PWR_SAVE = 1, ACT_PSMP = 2, ACT_SET_PCO_PHASE = 3, ACT_MIMO_CHL_MEASURE = 4, @@ -367,9 +367,9 @@ typedef struct _BSS_HT{ typedef struct _MIMO_RSSI{ u32 EnableAntenna; u32 AntennaA; - u32 AntennaB; - u32 AntennaC; - u32 AntennaD; + u32 AntennaB; + u32 AntennaC; + u32 AntennaD; u32 Average; }MIMO_RSSI, *PMIMO_RSSI; @@ -388,4 +388,3 @@ typedef struct _FALSE_ALARM_STATISTICS{ #endif //__INC_HTTYPE_H - diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index a8a6dc2c365f..b755eb46341f 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -18,7 +18,7 @@ History: Data Who Remark - 05/06/2008 amy Create initial version porting from windows driver. + 05/06/2008 amy Create initial version porting from windows driver. ******************************************************************************/ #include "r8192U.h" @@ -41,7 +41,7 @@ rt_status SendTxCommandPacket( struct net_device *dev, - void* pData, + void* pData, u32 DataLen ) { @@ -106,7 +106,7 @@ SendTxCommandPacket( u32 buffer_len) { - bool rt_status = true; + bool rt_status = true; #ifdef RTL8192U return rt_status; #else @@ -188,7 +188,7 @@ SendTxCommandPacket( * * Overview: * - * Input: PADAPTER pAdapter - . + * Input: PADAPTER pAdapter - . * CMPK_TXFB_T *psTx_FB - . * * Output: NONE @@ -197,7 +197,7 @@ SendTxCommandPacket( * * Revised History: * When Who Remark - * 05/12/2008 amy Create Version 0 porting from windows code. + * 05/12/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ static void @@ -289,7 +289,7 @@ cmpk_count_txstatistic( * in the command packet. * * Input: struct net_device * dev - * u8 * pmsg - Msg Ptr of the command packet. + * u8 * pmsg - Msg Ptr of the command packet. * * Output: NONE * @@ -369,7 +369,7 @@ cmdpkt_beacontimerinterrupt_819xusb( * Overview: The function is responsible for extract the message from * firmware. It will contain dedicated info in * ws-07-0063-v06-rtl819x-command-packet-specification-070315.doc. - * Please refer to chapter "Interrupt Status Element". + * Please refer to chapter "Interrupt Status Element". * * Input: struct net_device *dev, * u8* pmsg - Message Pointer of the command packet. @@ -400,8 +400,8 @@ cmpk_handle_interrupt_status( /* It seems that FW use big endian(MIPS) and DRV use little endian in windows OS. So we have to read the content byte by byte or transfer endian type before copy the message copy. */ - //rx_bcn_state.Element_ID = pMsg[0]; - //rx_bcn_state.Length = pMsg[1]; + //rx_bcn_state.Element_ID = pMsg[0]; + //rx_bcn_state.Length = pMsg[1]; rx_intr_status.length = pmsg[1]; if (rx_intr_status.length != (sizeof(cmpk_intr_sta_t) - 2)) { @@ -478,16 +478,16 @@ cmpk_handle_query_config_rx( /* It seems that FW use big endian(MIPS) and DRV use little endian in windows OS. So we have to read the content byte by byte or transfer endian type before copy the message copy. */ - //rx_query_cfg.Element_ID = pMsg[0]; - //rx_query_cfg.Length = pMsg[1]; - rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000)>>31; - rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5; - rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3; - rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0; - rx_query_cfg.cfg_offset = pmsg[7]; - rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) | + //rx_query_cfg.Element_ID = pMsg[0]; + //rx_query_cfg.Length = pMsg[1]; + rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000)>>31; + rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5; + rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3; + rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0; + rx_query_cfg.cfg_offset = pmsg[7]; + rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) | (pmsg[10] << 8) | (pmsg[11] << 0); - rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) | + rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) | (pmsg[14] << 8) | (pmsg[15] << 0); } /* cmpk_Handle_Query_Config_Rx */ @@ -511,7 +511,7 @@ cmpk_handle_query_config_rx( * *---------------------------------------------------------------------------*/ static void cmpk_count_tx_status( struct net_device *dev, - cmpk_tx_status_t *pstx_status) + cmpk_tx_status_t *pstx_status) { struct r8192_priv *priv = ieee80211_priv(dev); diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h index a8855e61b0e5..59caa4e05323 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.h +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h @@ -19,8 +19,7 @@ /*------------------------------Define structure----------------------------*/ /* Define different command packet structure. */ /* 1. RX side: TX feedback packet. */ -typedef struct tag_cmd_pkt_tx_feedback -{ +typedef struct tag_cmd_pkt_tx_feedback { // DWORD 0 u8 element_id; /* Command packet type. */ u8 length; /* Command packet length. */ @@ -57,8 +56,7 @@ typedef struct tag_cmd_pkt_tx_feedback /* 2. RX side: Interrupt status packet. It includes Beacon State, Beacon Timer Interrupt and other useful informations in MAC ISR Reg. */ -typedef struct tag_cmd_pkt_interrupt_status -{ +typedef struct tag_cmd_pkt_interrupt_status { u8 element_id; /* Command packet type. */ u8 length; /* Command packet length. */ u16 reserve; @@ -67,12 +65,11 @@ typedef struct tag_cmd_pkt_interrupt_status /* 3. TX side: Set configuration packet. */ -typedef struct tag_cmd_pkt_set_configuration -{ +typedef struct tag_cmd_pkt_set_configuration { u8 element_id; /* Command packet type. */ u8 length; /* Command packet length. */ u16 reserve1; /* */ - u8 cfg_reserve1:3; + u8 cfg_reserve1:3; u8 cfg_size:2; /* Configuration info. */ u8 cfg_type:2; /* Configuration info. */ u8 cfg_action:1; /* Configuration info. */ @@ -89,25 +86,24 @@ typedef struct tag_cmd_pkt_set_configuration #define cmpk_query_cfg_t cmpk_set_cfg_t /* 5. Multi packet feedback status. */ -typedef struct tag_tx_stats_feedback // PJ quick rxcmd 09042007 -{ +typedef struct tag_tx_stats_feedback { // PJ quick rxcmd 09042007 // For endian transfer --> Driver will not the same as firmware structure. // DW 0 u16 reserve1; - u8 length; // Command packet length - u8 element_id; // Command packet type + u8 length; // Command packet length + u8 element_id; // Command packet type // DW 1 u16 txfail; // Tx Fail count - u16 txok; // Tx ok count + u16 txok; // Tx ok count // DW 2 - u16 txmcok; // tx multicast - u16 txretry; // Tx Retry count + u16 txmcok; // tx multicast + u16 txretry; // Tx Retry count // DW 3 u16 txucok; // tx unicast - u16 txbcok; // tx broadcast + u16 txbcok; // tx broadcast // DW 4 u16 txbcfail; // @@ -130,13 +126,12 @@ typedef struct tag_tx_stats_feedback // PJ quick rxcmd 09042007 /* 6. Debug feedback message. */ /* 2007/10/23 MH Define RX debug message */ -typedef struct tag_rx_debug_message_feedback -{ +typedef struct tag_rx_debug_message_feedback { // For endian transfer --> for driver // DW 0 u16 reserve1; - u8 length; // Command packet length - u8 element_id; // Command packet type + u8 length; // Command packet length + u8 element_id; // Command packet type // DW 1-?? // Variable debug message. @@ -144,19 +139,18 @@ typedef struct tag_rx_debug_message_feedback }cmpk_rx_dbginfo_t; /* 2008/03/20 MH Define transmit rate history. For big endian format. */ -typedef struct tag_tx_rate_history -{ +typedef struct tag_tx_rate_history { // For endian transfer --> for driver // DW 0 - u8 element_id; // Command packet type - u8 length; // Command packet length + u8 element_id; // Command packet type + u8 length; // Command packet length u16 reserved1; // DW 1-2 CCK rate counter - u16 cck[4]; + u16 cck[4]; // DW 3-6 - u16 ofdm[8]; + u16 ofdm[8]; // DW 7-14 //UINT16 MCS_BW0_SG0[16]; diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index b12d19079798..573e9cd68509 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -2,7 +2,7 @@ * Procedure: Init boot code/firmware code/data session * * Description: This routine will initialize firmware. If any error occurs during the initialization - * process, the routine shall terminate immediately and return fail. + * process, the routine shall terminate immediately and return fail. * NIC driver should call NdisOpenFile only from MiniportInitialize. * * Arguments: The pointer of the adapter @@ -19,7 +19,7 @@ #include <linux/firmware.h> void firmware_init_param(struct net_device *dev) { - struct r8192_priv *priv = ieee80211_priv(dev); + struct r8192_priv *priv = ieee80211_priv(dev); rt_firmware *pfirmware = priv->pFirmware; pfirmware->cmdpacket_frag_thresold = GET_COMMAND_PACKET_FRAG_THRESHOLD(MAX_TRANSMIT_BUFFER_SIZE); @@ -32,7 +32,7 @@ void firmware_init_param(struct net_device *dev) bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) { struct r8192_priv *priv = ieee80211_priv(dev); - bool rt_status = true; + bool rt_status = true; u16 frag_threshold; u16 frag_length, frag_offset = 0; //u16 total_size; @@ -241,17 +241,17 @@ CPUCheckFirmwareReady_Fail: bool init_firmware(struct net_device *dev) { - struct r8192_priv *priv = ieee80211_priv(dev); + struct r8192_priv *priv = ieee80211_priv(dev); bool rt_status = TRUE; u32 file_length = 0; u8 *mapped_file = NULL; u32 init_step = 0; opt_rst_type_e rst_opt = OPT_SYSTEM_RESET; - firmware_init_step_e starting_state = FW_INIT_STEP0_BOOT; + firmware_init_step_e starting_state = FW_INIT_STEP0_BOOT; rt_firmware *pfirmware = priv->pFirmware; - const struct firmware *fw_entry; + const struct firmware *fw_entry; const char *fw_name[3] = { "RTL8192U/boot.img", "RTL8192U/main.img", "RTL8192U/data.img"}; @@ -334,56 +334,56 @@ bool init_firmware(struct net_device *dev) } switch(init_step) { - case FW_INIT_STEP0_BOOT: - /* Download boot - * initialize command descriptor. - * will set polling bit when firmware code is also configured - */ - pfirmware->firmware_status = FW_STATUS_1_MOVE_BOOT_CODE; + case FW_INIT_STEP0_BOOT: + /* Download boot + * initialize command descriptor. + * will set polling bit when firmware code is also configured + */ + pfirmware->firmware_status = FW_STATUS_1_MOVE_BOOT_CODE; #ifdef RTL8190P - // To initialize IMEM, CPU move code from 0x80000080, hence, we send 0x80 byte packet - rt_status = fwSendNullPacket(dev, RTL8190_CPU_START_OFFSET); - if(rt_status != true) - { - RT_TRACE(COMP_INIT, "fwSendNullPacket() fail ! \n"); - goto download_firmware_fail; - } + // To initialize IMEM, CPU move code from 0x80000080, hence, we send 0x80 byte packet + rt_status = fwSendNullPacket(dev, RTL8190_CPU_START_OFFSET); + if(rt_status != true) + { + RT_TRACE(COMP_INIT, "fwSendNullPacket() fail ! \n"); + goto download_firmware_fail; + } #endif - //mdelay(1000); - /* - * To initialize IMEM, CPU move code from 0x80000080, - * hence, we send 0x80 byte packet - */ - break; - - case FW_INIT_STEP1_MAIN: - /* Download firmware code. Wait until Boot Ready and Turn on CPU */ - pfirmware->firmware_status = FW_STATUS_2_MOVE_MAIN_CODE; - - /* Check Put Code OK and Turn On CPU */ - rt_status = CPUcheck_maincodeok_turnonCPU(dev); - if(rt_status != TRUE) { - RT_TRACE(COMP_ERR, "CPUcheck_maincodeok_turnonCPU fail!\n"); - goto download_firmware_fail; - } - - pfirmware->firmware_status = FW_STATUS_3_TURNON_CPU; - break; - - case FW_INIT_STEP2_DATA: - /* download initial data code */ - pfirmware->firmware_status = FW_STATUS_4_MOVE_DATA_CODE; - mdelay(1); - - rt_status = CPUcheck_firmware_ready(dev); - if(rt_status != TRUE) { - RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status); - goto download_firmware_fail; - } - - /* wait until data code is initialized ready.*/ - pfirmware->firmware_status = FW_STATUS_5_READY; - break; + //mdelay(1000); + /* + * To initialize IMEM, CPU move code from 0x80000080, + * hence, we send 0x80 byte packet + */ + break; + + case FW_INIT_STEP1_MAIN: + /* Download firmware code. Wait until Boot Ready and Turn on CPU */ + pfirmware->firmware_status = FW_STATUS_2_MOVE_MAIN_CODE; + + /* Check Put Code OK and Turn On CPU */ + rt_status = CPUcheck_maincodeok_turnonCPU(dev); + if(rt_status != TRUE) { + RT_TRACE(COMP_ERR, "CPUcheck_maincodeok_turnonCPU fail!\n"); + goto download_firmware_fail; + } + + pfirmware->firmware_status = FW_STATUS_3_TURNON_CPU; + break; + + case FW_INIT_STEP2_DATA: + /* download initial data code */ + pfirmware->firmware_status = FW_STATUS_4_MOVE_DATA_CODE; + mdelay(1); + + rt_status = CPUcheck_firmware_ready(dev); + if(rt_status != TRUE) { + RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status); + goto download_firmware_fail; + } + + /* wait until data code is initialized ready.*/ + pfirmware->firmware_status = FW_STATUS_5_READY; + break; } } @@ -402,4 +402,3 @@ download_firmware_fail: MODULE_FIRMWARE("RTL8192U/boot.img"); MODULE_FIRMWARE("RTL8192U/main.img"); MODULE_FIRMWARE("RTL8192U/data.img"); - diff --git a/drivers/staging/rtl8192u/r819xU_firmware.h b/drivers/staging/rtl8192u/r819xU_firmware.h index a4bceeef33d3..c48c884aa1af 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.h +++ b/drivers/staging/rtl8192u/r819xU_firmware.h @@ -24,4 +24,3 @@ typedef enum _opt_rst_type{ }opt_rst_type_e; #endif - diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index dd1954daea2d..17fac41c12d9 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -124,10 +124,10 @@ static void phy_FwRFSerialWrite( struct net_device* dev, RF90_RADIO_PATH_E /****************************************************************************** *function: This function read register from RF chip * input: net_device dev - * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D + * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D * u32 Offset //target address to be read * output: none - * return: u32 readback value + * return: u32 readback value * notice: There are three types of serial operations:(1) Software serial write.(2)Hardware LSSI-Low Speed Serial Interface.(3)Hardware HSSI-High speed serial write. Driver here need to implement (1) and (2)---need more spec for this information. * ****************************************************************************/ u32 rtl8192_phy_RFSerialRead(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 Offset) @@ -201,7 +201,7 @@ u32 rtl8192_phy_RFSerialRead(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, /****************************************************************************** *function: This function write data to RF register * input: net_device dev - * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D + * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D * u32 Offset //target address to be written * u32 Data //The new register data to be written * output: none @@ -283,7 +283,7 @@ void rtl8192_phy_RFSerialWrite(struct net_device* dev, RF90_RADIO_PATH_E eRFPath /****************************************************************************** *function: This function set specific bits to RF register * input: net_device dev - * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D + * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D * u32 RegAddr //target addr to be modified * u32 BitMask //taget bit pos in the addr to be modified * u32 Data //value to be write @@ -684,8 +684,8 @@ void rtl8192_InitBBRFRegDef(struct net_device* dev) /****************************************************************************** *function: This function is to write register and then readback to make sure whether BB and RF is OK * input: net_device dev - * HW90_BLOCK_E CheckBlock - * RF90_RADIO_PATH_E eRFPath //only used when checkblock is HW90_BLOCK_RF + * HW90_BLOCK_E CheckBlock + * RF90_RADIO_PATH_E eRFPath //only used when checkblock is HW90_BLOCK_RF * output: none * return: return whether BB and RF is ok(0:OK; 1:Fail) * notice: This function may be removed in the ASIC @@ -957,56 +957,56 @@ u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device* dev, RF90_RADIO_PATH_E u8 ret = 0; switch(eRFPath){ - case RF90_PATH_A: - for(i = 0;i<RadioA_ArrayLength; i=i+2){ - - if(rtl819XRadioA_Array[i] == 0xfe){ - mdelay(100); - continue; - } - rtl8192_phy_SetRFReg(dev, eRFPath, rtl819XRadioA_Array[i], bMask12Bits, rtl819XRadioA_Array[i+1]); - mdelay(1); + case RF90_PATH_A: + for(i = 0;i<RadioA_ArrayLength; i=i+2){ + if(rtl819XRadioA_Array[i] == 0xfe){ + mdelay(100); + continue; } - break; - case RF90_PATH_B: - for(i = 0;i<RadioB_ArrayLength; i=i+2){ + rtl8192_phy_SetRFReg(dev, eRFPath, rtl819XRadioA_Array[i], bMask12Bits, rtl819XRadioA_Array[i+1]); + mdelay(1); - if(rtl819XRadioB_Array[i] == 0xfe){ - mdelay(100); - continue; - } - rtl8192_phy_SetRFReg(dev, eRFPath, rtl819XRadioB_Array[i], bMask12Bits, rtl819XRadioB_Array[i+1]); - mdelay(1); + } + break; + case RF90_PATH_B: + for(i = 0;i<RadioB_ArrayLength; i=i+2){ + if(rtl819XRadioB_Array[i] == 0xfe){ + mdelay(100); + continue; } - break; - case RF90_PATH_C: - for(i = 0;i<RadioC_ArrayLength; i=i+2){ + rtl8192_phy_SetRFReg(dev, eRFPath, rtl819XRadioB_Array[i], bMask12Bits, rtl819XRadioB_Array[i+1]); + mdelay(1); - if(rtl819XRadioC_Array[i] == 0xfe){ - mdelay(100); - continue; - } - rtl8192_phy_SetRFReg(dev, eRFPath, rtl819XRadioC_Array[i], bMask12Bits, rtl819XRadioC_Array[i+1]); - mdelay(1); + } + break; + case RF90_PATH_C: + for(i = 0;i<RadioC_ArrayLength; i=i+2){ + if(rtl819XRadioC_Array[i] == 0xfe){ + mdelay(100); + continue; } - break; - case RF90_PATH_D: - for(i = 0;i<RadioD_ArrayLength; i=i+2){ + rtl8192_phy_SetRFReg(dev, eRFPath, rtl819XRadioC_Array[i], bMask12Bits, rtl819XRadioC_Array[i+1]); + mdelay(1); - if(rtl819XRadioD_Array[i] == 0xfe){ - mdelay(100); - continue; - } - rtl8192_phy_SetRFReg(dev, eRFPath, rtl819XRadioD_Array[i], bMask12Bits, rtl819XRadioD_Array[i+1]); - mdelay(1); + } + break; + case RF90_PATH_D: + for(i = 0;i<RadioD_ArrayLength; i=i+2){ + if(rtl819XRadioD_Array[i] == 0xfe){ + mdelay(100); + continue; } - break; - default: - break; + rtl8192_phy_SetRFReg(dev, eRFPath, rtl819XRadioD_Array[i], bMask12Bits, rtl819XRadioD_Array[i+1]); + mdelay(1); + + } + break; + default: + break; } return ret; @@ -1015,7 +1015,7 @@ u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device* dev, RF90_RADIO_PATH_E /****************************************************************************** *function: This function set Tx Power of the channel * input: struct net_device *dev - * u8 channel + * u8 channel * output: none * return: none * Note: @@ -1052,7 +1052,7 @@ void rtl8192_SetTxPowerLevel(struct net_device *dev, u8 channel) /****************************************************************************** *function: This function set RF state on or off * input: struct net_device *dev - * RT_RF_POWER_STATE eRFPowerState //Power State to set + * RT_RF_POWER_STATE eRFPowerState //Power State to set * output: none * return: none * Note: @@ -1183,10 +1183,10 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerS /**************************************************************************************** *function: This function set command table variable(struct SwChnlCmd). - * input: SwChnlCmd* CmdTable //table to be set. - * u32 CmdTableIdx //variable index in table to be set - * u32 CmdTableSz //table size. - * SwChnlCmdID CmdID //command ID to set. + * input: SwChnlCmd* CmdTable //table to be set. + * u32 CmdTableIdx //variable index in table to be set + * u32 CmdTableSz //table size. + * SwChnlCmdID CmdID //command ID to set. * u32 Para1 * u32 Para2 * u32 msDelay @@ -1229,10 +1229,10 @@ u8 rtl8192_phy_SetSwChnlCmdArray( /****************************************************************************** *function: This function set channel step by step * input: struct net_device *dev - * u8 channel - * u8* stage //3 stages - * u8* step // - * u32* delay //whether need to delay + * u8 channel + * u8* stage //3 stages + * u8* step // + * u32* delay //whether need to delay * output: store new stage, step and delay for next step(combine with function above) * return: true if finished, false otherwise * Note: Wait for simpler function to replace it //wb @@ -1386,7 +1386,7 @@ u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, u8* stage, u /****************************************************************************** *function: This function does actually set channel work * input: struct net_device *dev - * u8 channel + * u8 channel * output: none * return: noin * Note: We should not call this function directly @@ -1427,7 +1427,7 @@ void rtl8192_SwChnl_WorkItem(struct net_device *dev) /****************************************************************************** *function: This function scheduled actual work item to set channel * input: net_device dev - * u8 channel //channel to set + * u8 channel //channel to set * output: none * return: return code show if workitem is scheduled(1:pass, 0:fail) * Note: Delay may be required for RF configuration @@ -1501,12 +1501,12 @@ if (0) //to test current channel from RF reg 0x7. /****************************************************************************** *function: Callback routine of the work item for set bandwidth mode. * input: struct net_device *dev - * HT_CHANNEL_WIDTH Bandwidth //20M or 40M - * HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care + * HT_CHANNEL_WIDTH Bandwidth //20M or 40M + * HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care * output: none * return: none * Note: I doubt whether SetBWModeInProgress flag is necessary as we can - * test whether current work in the queue or not.//do I? + * test whether current work in the queue or not.//do I? * ***************************************************************************/ void rtl8192_SetBWModeWorkItem(struct net_device *dev) { @@ -1649,12 +1649,12 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) /****************************************************************************** *function: This function schedules bandwidth switch work. * input: struct net_device *dev - * HT_CHANNEL_WIDTH Bandwidth //20M or 40M - * HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care + * HT_CHANNEL_WIDTH Bandwidth //20M or 40M + * HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care * output: none * return: none * Note: I doubt whether SetBWModeInProgress flag is necessary as we can - * test whether current work in the queue or not.//do I? + * test whether current work in the queue or not.//do I? * ***************************************************************************/ void rtl8192_SetBWMode(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset) { @@ -1770,4 +1770,3 @@ extern void InitialGainOperateWorkItemCallBack(struct work_struct *work) break; } } - diff --git a/drivers/staging/rtl8192u/r819xU_phyreg.h b/drivers/staging/rtl8192u/r819xU_phyreg.h index cca34c05f6a5..64285d6a33f8 100644 --- a/drivers/staging/rtl8192u/r819xU_phyreg.h +++ b/drivers/staging/rtl8192u/r819xU_phyreg.h @@ -6,185 +6,185 @@ //Register //duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF //page 1 -#define rPMAC_Reset 0x100 -#define rPMAC_TxStart 0x104 -#define rPMAC_TxLegacySIG 0x108 -#define rPMAC_TxHTSIG1 0x10c -#define rPMAC_TxHTSIG2 0x110 -#define rPMAC_PHYDebug 0x114 -#define rPMAC_TxPacketNum 0x118 -#define rPMAC_TxIdle 0x11c -#define rPMAC_TxMACHeader0 0x120 -#define rPMAC_TxMACHeader1 0x124 -#define rPMAC_TxMACHeader2 0x128 -#define rPMAC_TxMACHeader3 0x12c -#define rPMAC_TxMACHeader4 0x130 -#define rPMAC_TxMACHeader5 0x134 -#define rPMAC_TxDataType 0x138 -#define rPMAC_TxRandomSeed 0x13c -#define rPMAC_CCKPLCPPreamble 0x140 -#define rPMAC_CCKPLCPHeader 0x144 -#define rPMAC_CCKCRC16 0x148 -#define rPMAC_OFDMRxCRC32OK 0x170 -#define rPMAC_OFDMRxCRC32Er 0x174 -#define rPMAC_OFDMRxParityEr 0x178 -#define rPMAC_OFDMRxCRC8Er 0x17c -#define rPMAC_CCKCRxRC16Er 0x180 -#define rPMAC_CCKCRxRC32Er 0x184 -#define rPMAC_CCKCRxRC32OK 0x188 -#define rPMAC_TxStatus 0x18c +#define rPMAC_Reset 0x100 +#define rPMAC_TxStart 0x104 +#define rPMAC_TxLegacySIG 0x108 +#define rPMAC_TxHTSIG1 0x10c +#define rPMAC_TxHTSIG2 0x110 +#define rPMAC_PHYDebug 0x114 +#define rPMAC_TxPacketNum 0x118 +#define rPMAC_TxIdle 0x11c +#define rPMAC_TxMACHeader0 0x120 +#define rPMAC_TxMACHeader1 0x124 +#define rPMAC_TxMACHeader2 0x128 +#define rPMAC_TxMACHeader3 0x12c +#define rPMAC_TxMACHeader4 0x130 +#define rPMAC_TxMACHeader5 0x134 +#define rPMAC_TxDataType 0x138 +#define rPMAC_TxRandomSeed 0x13c +#define rPMAC_CCKPLCPPreamble 0x140 +#define rPMAC_CCKPLCPHeader 0x144 +#define rPMAC_CCKCRC16 0x148 +#define rPMAC_OFDMRxCRC32OK 0x170 +#define rPMAC_OFDMRxCRC32Er 0x174 +#define rPMAC_OFDMRxParityEr 0x178 +#define rPMAC_OFDMRxCRC8Er 0x17c +#define rPMAC_CCKCRxRC16Er 0x180 +#define rPMAC_CCKCRxRC32Er 0x184 +#define rPMAC_CCKCRxRC32OK 0x188 +#define rPMAC_TxStatus 0x18c //page8 -#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC -#define rFPGA0_TxInfo 0x804 -#define rFPGA0_PSDFunction 0x808 -#define rFPGA0_TxGainStage 0x80c -#define rFPGA0_RFTiming1 0x810 -#define rFPGA0_RFTiming2 0x814 -//#define rFPGA0_XC_RFTiming 0x818 -//#define rFPGA0_XD_RFTiming 0x81c -#define rFPGA0_XA_HSSIParameter1 0x820 -#define rFPGA0_XA_HSSIParameter2 0x824 -#define rFPGA0_XB_HSSIParameter1 0x828 -#define rFPGA0_XB_HSSIParameter2 0x82c -#define rFPGA0_XC_HSSIParameter1 0x830 -#define rFPGA0_XC_HSSIParameter2 0x834 -#define rFPGA0_XD_HSSIParameter1 0x838 -#define rFPGA0_XD_HSSIParameter2 0x83c -#define rFPGA0_XA_LSSIParameter 0x840 -#define rFPGA0_XB_LSSIParameter 0x844 -#define rFPGA0_XC_LSSIParameter 0x848 -#define rFPGA0_XD_LSSIParameter 0x84c -#define rFPGA0_RFWakeUpParameter 0x850 -#define rFPGA0_RFSleepUpParameter 0x854 -#define rFPGA0_XAB_SwitchControl 0x858 -#define rFPGA0_XCD_SwitchControl 0x85c -#define rFPGA0_XA_RFInterfaceOE 0x860 -#define rFPGA0_XB_RFInterfaceOE 0x864 -#define rFPGA0_XC_RFInterfaceOE 0x868 -#define rFPGA0_XD_RFInterfaceOE 0x86c -#define rFPGA0_XAB_RFInterfaceSW 0x870 -#define rFPGA0_XCD_RFInterfaceSW 0x874 -#define rFPGA0_XAB_RFParameter 0x878 -#define rFPGA0_XCD_RFParameter 0x87c -#define rFPGA0_AnalogParameter1 0x880 -#define rFPGA0_AnalogParameter2 0x884 -#define rFPGA0_AnalogParameter3 0x888 -#define rFPGA0_AnalogParameter4 0x88c -#define rFPGA0_XA_LSSIReadBack 0x8a0 -#define rFPGA0_XB_LSSIReadBack 0x8a4 -#define rFPGA0_XC_LSSIReadBack 0x8a8 -#define rFPGA0_XD_LSSIReadBack 0x8ac -#define rFPGA0_PSDReport 0x8b4 -#define rFPGA0_XAB_RFInterfaceRB 0x8e0 -#define rFPGA0_XCD_RFInterfaceRB 0x8e4 +#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC +#define rFPGA0_TxInfo 0x804 +#define rFPGA0_PSDFunction 0x808 +#define rFPGA0_TxGainStage 0x80c +#define rFPGA0_RFTiming1 0x810 +#define rFPGA0_RFTiming2 0x814 +//#define rFPGA0_XC_RFTiming 0x818 +//#define rFPGA0_XD_RFTiming 0x81c +#define rFPGA0_XA_HSSIParameter1 0x820 +#define rFPGA0_XA_HSSIParameter2 0x824 +#define rFPGA0_XB_HSSIParameter1 0x828 +#define rFPGA0_XB_HSSIParameter2 0x82c +#define rFPGA0_XC_HSSIParameter1 0x830 +#define rFPGA0_XC_HSSIParameter2 0x834 +#define rFPGA0_XD_HSSIParameter1 0x838 +#define rFPGA0_XD_HSSIParameter2 0x83c +#define rFPGA0_XA_LSSIParameter 0x840 +#define rFPGA0_XB_LSSIParameter 0x844 +#define rFPGA0_XC_LSSIParameter 0x848 +#define rFPGA0_XD_LSSIParameter 0x84c +#define rFPGA0_RFWakeUpParameter 0x850 +#define rFPGA0_RFSleepUpParameter 0x854 +#define rFPGA0_XAB_SwitchControl 0x858 +#define rFPGA0_XCD_SwitchControl 0x85c +#define rFPGA0_XA_RFInterfaceOE 0x860 +#define rFPGA0_XB_RFInterfaceOE 0x864 +#define rFPGA0_XC_RFInterfaceOE 0x868 +#define rFPGA0_XD_RFInterfaceOE 0x86c +#define rFPGA0_XAB_RFInterfaceSW 0x870 +#define rFPGA0_XCD_RFInterfaceSW 0x874 +#define rFPGA0_XAB_RFParameter 0x878 +#define rFPGA0_XCD_RFParameter 0x87c +#define rFPGA0_AnalogParameter1 0x880 +#define rFPGA0_AnalogParameter2 0x884 +#define rFPGA0_AnalogParameter3 0x888 +#define rFPGA0_AnalogParameter4 0x88c +#define rFPGA0_XA_LSSIReadBack 0x8a0 +#define rFPGA0_XB_LSSIReadBack 0x8a4 +#define rFPGA0_XC_LSSIReadBack 0x8a8 +#define rFPGA0_XD_LSSIReadBack 0x8ac +#define rFPGA0_PSDReport 0x8b4 +#define rFPGA0_XAB_RFInterfaceRB 0x8e0 +#define rFPGA0_XCD_RFInterfaceRB 0x8e4 //page 9 -#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC -#define rFPGA1_TxBlock 0x904 -#define rFPGA1_DebugSelect 0x908 -#define rFPGA1_TxInfo 0x90c +#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC +#define rFPGA1_TxBlock 0x904 +#define rFPGA1_DebugSelect 0x908 +#define rFPGA1_TxInfo 0x90c //page a -#define rCCK0_System 0xa00 -#define rCCK0_AFESetting 0xa04 -#define rCCK0_CCA 0xa08 -#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level -#define rCCK0_RxAGC2 0xa10 //AGC & DAGC -#define rCCK0_RxHP 0xa14 -#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold -#define rCCK0_DSPParameter2 0xa1c //SQ threshold -#define rCCK0_TxFilter1 0xa20 -#define rCCK0_TxFilter2 0xa24 -#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 -#define rCCK0_FalseAlarmReport 0xa2c //0xa2d -#define rCCK0_TRSSIReport 0xa50 -#define rCCK0_RxReport 0xa54 //0xa57 -#define rCCK0_FACounterLower 0xa5c //0xa5b -#define rCCK0_FACounterUpper 0xa58 //0xa5c +#define rCCK0_System 0xa00 +#define rCCK0_AFESetting 0xa04 +#define rCCK0_CCA 0xa08 +#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level +#define rCCK0_RxAGC2 0xa10 //AGC & DAGC +#define rCCK0_RxHP 0xa14 +#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold +#define rCCK0_DSPParameter2 0xa1c //SQ threshold +#define rCCK0_TxFilter1 0xa20 +#define rCCK0_TxFilter2 0xa24 +#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 +#define rCCK0_FalseAlarmReport 0xa2c //0xa2d +#define rCCK0_TRSSIReport 0xa50 +#define rCCK0_RxReport 0xa54 //0xa57 +#define rCCK0_FACounterLower 0xa5c //0xa5b +#define rCCK0_FACounterUpper 0xa58 //0xa5c //page c -#define rOFDM0_LSTF 0xc00 -#define rOFDM0_TRxPathEnable 0xc04 -#define rOFDM0_TRMuxPar 0xc08 -#define rOFDM0_TRSWIsolation 0xc0c -#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter -#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix -#define rOFDM0_XBRxAFE 0xc18 -#define rOFDM0_XBRxIQImbalance 0xc1c -#define rOFDM0_XCRxAFE 0xc20 -#define rOFDM0_XCRxIQImbalance 0xc24 -#define rOFDM0_XDRxAFE 0xc28 -#define rOFDM0_XDRxIQImbalance 0xc2c -#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD -#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. -#define rOFDM0_RxDetector3 0xc38 //Frame Sync. -#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI -#define rOFDM0_RxDSP 0xc40 //Rx Sync Path -#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC -#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold -#define rOFDM0_ECCAThreshold 0xc4c // energy CCA -#define rOFDM0_XAAGCCore1 0xc50 -#define rOFDM0_XAAGCCore2 0xc54 -#define rOFDM0_XBAGCCore1 0xc58 -#define rOFDM0_XBAGCCore2 0xc5c -#define rOFDM0_XCAGCCore1 0xc60 -#define rOFDM0_XCAGCCore2 0xc64 -#define rOFDM0_XDAGCCore1 0xc68 -#define rOFDM0_XDAGCCore2 0xc6c -#define rOFDM0_AGCParameter1 0xc70 -#define rOFDM0_AGCParameter2 0xc74 -#define rOFDM0_AGCRSSITable 0xc78 -#define rOFDM0_HTSTFAGC 0xc7c -#define rOFDM0_XATxIQImbalance 0xc80 -#define rOFDM0_XATxAFE 0xc84 -#define rOFDM0_XBTxIQImbalance 0xc88 -#define rOFDM0_XBTxAFE 0xc8c -#define rOFDM0_XCTxIQImbalance 0xc90 -#define rOFDM0_XCTxAFE 0xc94 -#define rOFDM0_XDTxIQImbalance 0xc98 -#define rOFDM0_XDTxAFE 0xc9c -#define rOFDM0_RxHPParameter 0xce0 -#define rOFDM0_TxPseudoNoiseWgt 0xce4 -#define rOFDM0_FrameSync 0xcf0 -#define rOFDM0_DFSReport 0xcf4 -#define rOFDM0_TxCoeff1 0xca4 -#define rOFDM0_TxCoeff2 0xca8 -#define rOFDM0_TxCoeff3 0xcac -#define rOFDM0_TxCoeff4 0xcb0 -#define rOFDM0_TxCoeff5 0xcb4 -#define rOFDM0_TxCoeff6 0xcb8 +#define rOFDM0_LSTF 0xc00 +#define rOFDM0_TRxPathEnable 0xc04 +#define rOFDM0_TRMuxPar 0xc08 +#define rOFDM0_TRSWIsolation 0xc0c +#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter +#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix +#define rOFDM0_XBRxAFE 0xc18 +#define rOFDM0_XBRxIQImbalance 0xc1c +#define rOFDM0_XCRxAFE 0xc20 +#define rOFDM0_XCRxIQImbalance 0xc24 +#define rOFDM0_XDRxAFE 0xc28 +#define rOFDM0_XDRxIQImbalance 0xc2c +#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD +#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. +#define rOFDM0_RxDetector3 0xc38 //Frame Sync. +#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI +#define rOFDM0_RxDSP 0xc40 //Rx Sync Path +#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC +#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold +#define rOFDM0_ECCAThreshold 0xc4c // energy CCA +#define rOFDM0_XAAGCCore1 0xc50 +#define rOFDM0_XAAGCCore2 0xc54 +#define rOFDM0_XBAGCCore1 0xc58 +#define rOFDM0_XBAGCCore2 0xc5c +#define rOFDM0_XCAGCCore1 0xc60 +#define rOFDM0_XCAGCCore2 0xc64 +#define rOFDM0_XDAGCCore1 0xc68 +#define rOFDM0_XDAGCCore2 0xc6c +#define rOFDM0_AGCParameter1 0xc70 +#define rOFDM0_AGCParameter2 0xc74 +#define rOFDM0_AGCRSSITable 0xc78 +#define rOFDM0_HTSTFAGC 0xc7c +#define rOFDM0_XATxIQImbalance 0xc80 +#define rOFDM0_XATxAFE 0xc84 +#define rOFDM0_XBTxIQImbalance 0xc88 +#define rOFDM0_XBTxAFE 0xc8c +#define rOFDM0_XCTxIQImbalance 0xc90 +#define rOFDM0_XCTxAFE 0xc94 +#define rOFDM0_XDTxIQImbalance 0xc98 +#define rOFDM0_XDTxAFE 0xc9c +#define rOFDM0_RxHPParameter 0xce0 +#define rOFDM0_TxPseudoNoiseWgt 0xce4 +#define rOFDM0_FrameSync 0xcf0 +#define rOFDM0_DFSReport 0xcf4 +#define rOFDM0_TxCoeff1 0xca4 +#define rOFDM0_TxCoeff2 0xca8 +#define rOFDM0_TxCoeff3 0xcac +#define rOFDM0_TxCoeff4 0xcb0 +#define rOFDM0_TxCoeff5 0xcb4 +#define rOFDM0_TxCoeff6 0xcb8 //page d -#define rOFDM1_LSTF 0xd00 -#define rOFDM1_TRxPathEnable 0xd04 -#define rOFDM1_CFO 0xd08 -#define rOFDM1_CSI1 0xd10 -#define rOFDM1_SBD 0xd14 -#define rOFDM1_CSI2 0xd18 -#define rOFDM1_CFOTracking 0xd2c -#define rOFDM1_TRxMesaure1 0xd34 -#define rOFDM1_IntfDet 0xd3c +#define rOFDM1_LSTF 0xd00 +#define rOFDM1_TRxPathEnable 0xd04 +#define rOFDM1_CFO 0xd08 +#define rOFDM1_CSI1 0xd10 +#define rOFDM1_SBD 0xd14 +#define rOFDM1_CSI2 0xd18 +#define rOFDM1_CFOTracking 0xd2c +#define rOFDM1_TRxMesaure1 0xd34 +#define rOFDM1_IntfDet 0xd3c #define rOFDM1_PseudoNoiseStateAB 0xd50 #define rOFDM1_PseudoNoiseStateCD 0xd54 #define rOFDM1_RxPseudoNoiseWgt 0xd58 -#define rOFDM_PHYCounter1 0xda0 //cca, parity fail -#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail -#define rOFDM_PHYCounter3 0xda8 //MCS not support -#define rOFDM_ShortCFOAB 0xdac -#define rOFDM_ShortCFOCD 0xdb0 -#define rOFDM_LongCFOAB 0xdb4 -#define rOFDM_LongCFOCD 0xdb8 -#define rOFDM_TailCFOAB 0xdbc -#define rOFDM_TailCFOCD 0xdc0 -#define rOFDM_PWMeasure1 0xdc4 -#define rOFDM_PWMeasure2 0xdc8 -#define rOFDM_BWReport 0xdcc -#define rOFDM_AGCReport 0xdd0 -#define rOFDM_RxSNR 0xdd4 -#define rOFDM_RxEVMCSI 0xdd8 -#define rOFDM_SIGReport 0xddc +#define rOFDM_PHYCounter1 0xda0 //cca, parity fail +#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail +#define rOFDM_PHYCounter3 0xda8 //MCS not support +#define rOFDM_ShortCFOAB 0xdac +#define rOFDM_ShortCFOCD 0xdb0 +#define rOFDM_LongCFOAB 0xdb4 +#define rOFDM_LongCFOCD 0xdb8 +#define rOFDM_TailCFOAB 0xdbc +#define rOFDM_TailCFOCD 0xdc0 +#define rOFDM_PWMeasure1 0xdc4 +#define rOFDM_PWMeasure2 0xdc8 +#define rOFDM_BWReport 0xdcc +#define rOFDM_AGCReport 0xdd0 +#define rOFDM_RxSNR 0xdd4 +#define rOFDM_RxEVMCSI 0xdd8 +#define rOFDM_SIGReport 0xddc //page e #define rTxAGC_Rate18_06 0xe00 @@ -198,373 +198,373 @@ //RF //Zebra1 -#define rZebra1_HSSIEnable 0x0 -#define rZebra1_TRxEnable1 0x1 -#define rZebra1_TRxEnable2 0x2 -#define rZebra1_AGC 0x4 -#define rZebra1_ChargePump 0x5 -#define rZebra1_Channel 0x7 -#define rZebra1_TxGain 0x8 -#define rZebra1_TxLPF 0x9 -#define rZebra1_RxLPF 0xb -#define rZebra1_RxHPFCorner 0xc +#define rZebra1_HSSIEnable 0x0 +#define rZebra1_TRxEnable1 0x1 +#define rZebra1_TRxEnable2 0x2 +#define rZebra1_AGC 0x4 +#define rZebra1_ChargePump 0x5 +#define rZebra1_Channel 0x7 +#define rZebra1_TxGain 0x8 +#define rZebra1_TxLPF 0x9 +#define rZebra1_RxLPF 0xb +#define rZebra1_RxHPFCorner 0xc //Zebra4 -#define rGlobalCtrl 0 -#define rRTL8256_TxLPF 19 -#define rRTL8256_RxLPF 11 +#define rGlobalCtrl 0 +#define rRTL8256_TxLPF 19 +#define rRTL8256_RxLPF 11 //RTL8258 -#define rRTL8258_TxLPF 0x11 -#define rRTL8258_RxLPF 0x13 -#define rRTL8258_RSSILPF 0xa +#define rRTL8258_TxLPF 0x11 +#define rRTL8258_RxLPF 0x13 +#define rRTL8258_RSSILPF 0xa //Bit Mask //page-1 -#define bBBResetB 0x100 -#define bGlobalResetB 0x200 -#define bOFDMTxStart 0x4 -#define bCCKTxStart 0x8 -#define bCRC32Debug 0x100 -#define bPMACLoopback 0x10 -#define bTxLSIG 0xffffff -#define bOFDMTxRate 0xf -#define bOFDMTxReserved 0x10 -#define bOFDMTxLength 0x1ffe0 -#define bOFDMTxParity 0x20000 -#define bTxHTSIG1 0xffffff -#define bTxHTMCSRate 0x7f -#define bTxHTBW 0x80 -#define bTxHTLength 0xffff00 -#define bTxHTSIG2 0xffffff -#define bTxHTSmoothing 0x1 -#define bTxHTSounding 0x2 -#define bTxHTReserved 0x4 -#define bTxHTAggreation 0x8 -#define bTxHTSTBC 0x30 -#define bTxHTAdvanceCoding 0x40 -#define bTxHTShortGI 0x80 -#define bTxHTNumberHT_LTF 0x300 -#define bTxHTCRC8 0x3fc00 -#define bCounterReset 0x10000 -#define bNumOfOFDMTx 0xffff -#define bNumOfCCKTx 0xffff0000 -#define bTxIdleInterval 0xffff -#define bOFDMService 0xffff0000 -#define bTxMACHeader 0xffffffff -#define bTxDataInit 0xff -#define bTxHTMode 0x100 -#define bTxDataType 0x30000 -#define bTxRandomSeed 0xffffffff -#define bCCKTxPreamble 0x1 -#define bCCKTxSFD 0xffff0000 -#define bCCKTxSIG 0xff -#define bCCKTxService 0xff00 -#define bCCKLengthExt 0x8000 -#define bCCKTxLength 0xffff0000 -#define bCCKTxCRC16 0xffff -#define bCCKTxStatus 0x1 -#define bOFDMTxStatus 0x2 +#define bBBResetB 0x100 +#define bGlobalResetB 0x200 +#define bOFDMTxStart 0x4 +#define bCCKTxStart 0x8 +#define bCRC32Debug 0x100 +#define bPMACLoopback 0x10 +#define bTxLSIG 0xffffff +#define bOFDMTxRate 0xf +#define bOFDMTxReserved 0x10 +#define bOFDMTxLength 0x1ffe0 +#define bOFDMTxParity 0x20000 +#define bTxHTSIG1 0xffffff +#define bTxHTMCSRate 0x7f +#define bTxHTBW 0x80 +#define bTxHTLength 0xffff00 +#define bTxHTSIG2 0xffffff +#define bTxHTSmoothing 0x1 +#define bTxHTSounding 0x2 +#define bTxHTReserved 0x4 +#define bTxHTAggreation 0x8 +#define bTxHTSTBC 0x30 +#define bTxHTAdvanceCoding 0x40 +#define bTxHTShortGI 0x80 +#define bTxHTNumberHT_LTF 0x300 +#define bTxHTCRC8 0x3fc00 +#define bCounterReset 0x10000 +#define bNumOfOFDMTx 0xffff +#define bNumOfCCKTx 0xffff0000 +#define bTxIdleInterval 0xffff +#define bOFDMService 0xffff0000 +#define bTxMACHeader 0xffffffff +#define bTxDataInit 0xff +#define bTxHTMode 0x100 +#define bTxDataType 0x30000 +#define bTxRandomSeed 0xffffffff +#define bCCKTxPreamble 0x1 +#define bCCKTxSFD 0xffff0000 +#define bCCKTxSIG 0xff +#define bCCKTxService 0xff00 +#define bCCKLengthExt 0x8000 +#define bCCKTxLength 0xffff0000 +#define bCCKTxCRC16 0xffff +#define bCCKTxStatus 0x1 +#define bOFDMTxStatus 0x2 //page-8 -#define bRFMOD 0x1 -#define bJapanMode 0x2 -#define bCCKTxSC 0x30 -#define bCCKEn 0x1000000 -#define bOFDMEn 0x2000000 -#define bOFDMRxADCPhase 0x10000 -#define bOFDMTxDACPhase 0x40000 -#define bXATxAGC 0x3f -#define bXBTxAGC 0xf00 -#define bXCTxAGC 0xf000 -#define bXDTxAGC 0xf0000 -#define bPAStart 0xf0000000 -#define bTRStart 0x00f00000 -#define bRFStart 0x0000f000 -#define bBBStart 0x000000f0 -#define bBBCCKStart 0x0000000f -#define bPAEnd 0xf //Reg0x814 -#define bTREnd 0x0f000000 -#define bRFEnd 0x000f0000 -#define bCCAMask 0x000000f0 //T2R -#define bR2RCCAMask 0x00000f00 -#define bHSSI_R2TDelay 0xf8000000 -#define bHSSI_T2RDelay 0xf80000 -#define bContTxHSSI 0x400 //chane gain at continue Tx -#define bIGFromCCK 0x200 -#define bAGCAddress 0x3f -#define bRxHPTx 0x7000 -#define bRxHPT2R 0x38000 -#define bRxHPCCKIni 0xc0000 -#define bAGCTxCode 0xc00000 -#define bAGCRxCode 0x300000 -#define b3WireDataLength 0x800 -#define b3WireAddressLength 0x400 -#define b3WireRFPowerDown 0x1 -//#define bHWSISelect 0x8 -#define b5GPAPEPolarity 0x40000000 -#define b2GPAPEPolarity 0x80000000 -#define bRFSW_TxDefaultAnt 0x3 -#define bRFSW_TxOptionAnt 0x30 -#define bRFSW_RxDefaultAnt 0x300 -#define bRFSW_RxOptionAnt 0x3000 -#define bRFSI_3WireData 0x1 -#define bRFSI_3WireClock 0x2 -#define bRFSI_3WireLoad 0x4 -#define bRFSI_3WireRW 0x8 -#define bRFSI_3Wire 0xf //3-wire total control -#define bRFSI_RFENV 0x10 -#define bRFSI_TRSW 0x20 -#define bRFSI_TRSWB 0x40 -#define bRFSI_ANTSW 0x100 -#define bRFSI_ANTSWB 0x200 -#define bRFSI_PAPE 0x400 -#define bRFSI_PAPE5G 0x800 -#define bBandSelect 0x1 -#define bHTSIG2_GI 0x80 -#define bHTSIG2_Smoothing 0x01 -#define bHTSIG2_Sounding 0x02 -#define bHTSIG2_Aggreaton 0x08 -#define bHTSIG2_STBC 0x30 -#define bHTSIG2_AdvCoding 0x40 -#define bHTSIG2_NumOfHTLTF 0x300 -#define bHTSIG2_CRC8 0x3fc -#define bHTSIG1_MCS 0x7f -#define bHTSIG1_BandWidth 0x80 -#define bHTSIG1_HTLength 0xffff -#define bLSIG_Rate 0xf -#define bLSIG_Reserved 0x10 -#define bLSIG_Length 0x1fffe -#define bLSIG_Parity 0x20 -#define bCCKRxPhase 0x4 -#define bLSSIReadAddress 0x3f000000 //LSSI "Read" Address -#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal -#define bLSSIReadBackData 0xfff -#define bLSSIReadOKFlag 0x1000 -#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz - -#define bRegulator0Standby 0x1 -#define bRegulatorPLLStandby 0x2 -#define bRegulator1Standby 0x4 -#define bPLLPowerUp 0x8 -#define bDPLLPowerUp 0x10 -#define bDA10PowerUp 0x20 -#define bAD7PowerUp 0x200 -#define bDA6PowerUp 0x2000 -#define bXtalPowerUp 0x4000 -#define b40MDClkPowerUP 0x8000 -#define bDA6DebugMode 0x20000 -#define bDA6Swing 0x380000 -#define bADClkPhase 0x4000000 -#define b80MClkDelay 0x18000000 -#define bAFEWatchDogEnable 0x20000000 -#define bXtalCap 0x0f000000 -#define bIntDifClkEnable 0x400 -#define bExtSigClkEnable 0x800 -#define bBandgapMbiasPowerUp 0x10000 -#define bAD11SHGain 0xc0000 -#define bAD11InputRange 0x700000 -#define bAD11OPCurrent 0x3800000 -#define bIPathLoopback 0x4000000 -#define bQPathLoopback 0x8000000 -#define bAFELoopback 0x10000000 -#define bDA10Swing 0x7e0 -#define bDA10Reverse 0x800 -#define bDAClkSource 0x1000 -#define bAD7InputRange 0x6000 -#define bAD7Gain 0x38000 -#define bAD7OutputCMMode 0x40000 -#define bAD7InputCMMode 0x380000 -#define bAD7Current 0xc00000 -#define bRegulatorAdjust 0x7000000 -#define bAD11PowerUpAtTx 0x1 -#define bDA10PSAtTx 0x10 -#define bAD11PowerUpAtRx 0x100 -#define bDA10PSAtRx 0x1000 - -#define bCCKRxAGCFormat 0x200 - -#define bPSDFFTSamplepPoint 0xc000 -#define bPSDAverageNum 0x3000 -#define bIQPathControl 0xc00 -#define bPSDFreq 0x3ff -#define bPSDAntennaPath 0x30 -#define bPSDIQSwitch 0x40 -#define bPSDRxTrigger 0x400000 -#define bPSDTxTrigger 0x80000000 -#define bPSDSineToneScale 0x7f000000 -#define bPSDReport 0xffff +#define bRFMOD 0x1 +#define bJapanMode 0x2 +#define bCCKTxSC 0x30 +#define bCCKEn 0x1000000 +#define bOFDMEn 0x2000000 +#define bOFDMRxADCPhase 0x10000 +#define bOFDMTxDACPhase 0x40000 +#define bXATxAGC 0x3f +#define bXBTxAGC 0xf00 +#define bXCTxAGC 0xf000 +#define bXDTxAGC 0xf0000 +#define bPAStart 0xf0000000 +#define bTRStart 0x00f00000 +#define bRFStart 0x0000f000 +#define bBBStart 0x000000f0 +#define bBBCCKStart 0x0000000f +#define bPAEnd 0xf //Reg0x814 +#define bTREnd 0x0f000000 +#define bRFEnd 0x000f0000 +#define bCCAMask 0x000000f0 //T2R +#define bR2RCCAMask 0x00000f00 +#define bHSSI_R2TDelay 0xf8000000 +#define bHSSI_T2RDelay 0xf80000 +#define bContTxHSSI 0x400 //chane gain at continue Tx +#define bIGFromCCK 0x200 +#define bAGCAddress 0x3f +#define bRxHPTx 0x7000 +#define bRxHPT2R 0x38000 +#define bRxHPCCKIni 0xc0000 +#define bAGCTxCode 0xc00000 +#define bAGCRxCode 0x300000 +#define b3WireDataLength 0x800 +#define b3WireAddressLength 0x400 +#define b3WireRFPowerDown 0x1 +//#define bHWSISelect 0x8 +#define b5GPAPEPolarity 0x40000000 +#define b2GPAPEPolarity 0x80000000 +#define bRFSW_TxDefaultAnt 0x3 +#define bRFSW_TxOptionAnt 0x30 +#define bRFSW_RxDefaultAnt 0x300 +#define bRFSW_RxOptionAnt 0x3000 +#define bRFSI_3WireData 0x1 +#define bRFSI_3WireClock 0x2 +#define bRFSI_3WireLoad 0x4 +#define bRFSI_3WireRW 0x8 +#define bRFSI_3Wire 0xf //3-wire total control +#define bRFSI_RFENV 0x10 +#define bRFSI_TRSW 0x20 +#define bRFSI_TRSWB 0x40 +#define bRFSI_ANTSW 0x100 +#define bRFSI_ANTSWB 0x200 +#define bRFSI_PAPE 0x400 +#define bRFSI_PAPE5G 0x800 +#define bBandSelect 0x1 +#define bHTSIG2_GI 0x80 +#define bHTSIG2_Smoothing 0x01 +#define bHTSIG2_Sounding 0x02 +#define bHTSIG2_Aggreaton 0x08 +#define bHTSIG2_STBC 0x30 +#define bHTSIG2_AdvCoding 0x40 +#define bHTSIG2_NumOfHTLTF 0x300 +#define bHTSIG2_CRC8 0x3fc +#define bHTSIG1_MCS 0x7f +#define bHTSIG1_BandWidth 0x80 +#define bHTSIG1_HTLength 0xffff +#define bLSIG_Rate 0xf +#define bLSIG_Reserved 0x10 +#define bLSIG_Length 0x1fffe +#define bLSIG_Parity 0x20 +#define bCCKRxPhase 0x4 +#define bLSSIReadAddress 0x3f000000 //LSSI "Read" Address +#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal +#define bLSSIReadBackData 0xfff +#define bLSSIReadOKFlag 0x1000 +#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz + +#define bRegulator0Standby 0x1 +#define bRegulatorPLLStandby 0x2 +#define bRegulator1Standby 0x4 +#define bPLLPowerUp 0x8 +#define bDPLLPowerUp 0x10 +#define bDA10PowerUp 0x20 +#define bAD7PowerUp 0x200 +#define bDA6PowerUp 0x2000 +#define bXtalPowerUp 0x4000 +#define b40MDClkPowerUP 0x8000 +#define bDA6DebugMode 0x20000 +#define bDA6Swing 0x380000 +#define bADClkPhase 0x4000000 +#define b80MClkDelay 0x18000000 +#define bAFEWatchDogEnable 0x20000000 +#define bXtalCap 0x0f000000 +#define bIntDifClkEnable 0x400 +#define bExtSigClkEnable 0x800 +#define bBandgapMbiasPowerUp 0x10000 +#define bAD11SHGain 0xc0000 +#define bAD11InputRange 0x700000 +#define bAD11OPCurrent 0x3800000 +#define bIPathLoopback 0x4000000 +#define bQPathLoopback 0x8000000 +#define bAFELoopback 0x10000000 +#define bDA10Swing 0x7e0 +#define bDA10Reverse 0x800 +#define bDAClkSource 0x1000 +#define bAD7InputRange 0x6000 +#define bAD7Gain 0x38000 +#define bAD7OutputCMMode 0x40000 +#define bAD7InputCMMode 0x380000 +#define bAD7Current 0xc00000 +#define bRegulatorAdjust 0x7000000 +#define bAD11PowerUpAtTx 0x1 +#define bDA10PSAtTx 0x10 +#define bAD11PowerUpAtRx 0x100 +#define bDA10PSAtRx 0x1000 + +#define bCCKRxAGCFormat 0x200 + +#define bPSDFFTSamplepPoint 0xc000 +#define bPSDAverageNum 0x3000 +#define bIQPathControl 0xc00 +#define bPSDFreq 0x3ff +#define bPSDAntennaPath 0x30 +#define bPSDIQSwitch 0x40 +#define bPSDRxTrigger 0x400000 +#define bPSDTxTrigger 0x80000000 +#define bPSDSineToneScale 0x7f000000 +#define bPSDReport 0xffff //page-9 -#define bOFDMTxSC 0x30000000 -#define bCCKTxOn 0x1 -#define bOFDMTxOn 0x2 -#define bDebugPage 0xfff //reset debug page and also HWord, LWord -#define bDebugItem 0xff //reset debug page and LWord -#define bAntL 0x10 -#define bAntNonHT 0x100 -#define bAntHT1 0x1000 -#define bAntHT2 0x10000 -#define bAntHT1S1 0x100000 -#define bAntNonHTS1 0x1000000 +#define bOFDMTxSC 0x30000000 +#define bCCKTxOn 0x1 +#define bOFDMTxOn 0x2 +#define bDebugPage 0xfff //reset debug page and also HWord, LWord +#define bDebugItem 0xff //reset debug page and LWord +#define bAntL 0x10 +#define bAntNonHT 0x100 +#define bAntHT1 0x1000 +#define bAntHT2 0x10000 +#define bAntHT1S1 0x100000 +#define bAntNonHTS1 0x1000000 //page-a -#define bCCKBBMode 0x3 -#define bCCKTxPowerSaving 0x80 -#define bCCKRxPowerSaving 0x40 -#define bCCKSideBand 0x10 -#define bCCKScramble 0x8 -#define bCCKAntDiversity 0x8000 -#define bCCKCarrierRecovery 0x4000 -#define bCCKTxRate 0x3000 -#define bCCKDCCancel 0x0800 -#define bCCKISICancel 0x0400 -#define bCCKMatchFilter 0x0200 -#define bCCKEqualizer 0x0100 -#define bCCKPreambleDetect 0x800000 -#define bCCKFastFalseCCA 0x400000 -#define bCCKChEstStart 0x300000 -#define bCCKCCACount 0x080000 -#define bCCKcs_lim 0x070000 -#define bCCKBistMode 0x80000000 -#define bCCKCCAMask 0x40000000 -#define bCCKTxDACPhase 0x4 -#define bCCKRxADCPhase 0x20000000 //r_rx_clk -#define bCCKr_cp_mode0 0x0100 -#define bCCKTxDCOffset 0xf0 -#define bCCKRxDCOffset 0xf -#define bCCKCCAMode 0xc000 -#define bCCKFalseCS_lim 0x3f00 -#define bCCKCS_ratio 0xc00000 -#define bCCKCorgBit_sel 0x300000 -#define bCCKPD_lim 0x0f0000 -#define bCCKNewCCA 0x80000000 -#define bCCKRxHPofIG 0x8000 -#define bCCKRxIG 0x7f00 -#define bCCKLNAPolarity 0x800000 -#define bCCKRx1stGain 0x7f0000 -#define bCCKRFExtend 0x20000000 //CCK Rx initial gain polarity -#define bCCKRxAGCSatLevel 0x1f000000 -#define bCCKRxAGCSatCount 0xe0 -#define bCCKRxRFSettle 0x1f //AGCsamp_dly -#define bCCKFixedRxAGC 0x8000 -//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 -#define bCCKAntennaPolarity 0x2000 -#define bCCKTxFilterType 0x0c00 -#define bCCKRxAGCReportType 0x0300 -#define bCCKRxDAGCEn 0x80000000 -#define bCCKRxDAGCPeriod 0x20000000 -#define bCCKRxDAGCSatLevel 0x1f000000 -#define bCCKTimingRecovery 0x800000 -#define bCCKTxC0 0x3f0000 -#define bCCKTxC1 0x3f000000 -#define bCCKTxC2 0x3f -#define bCCKTxC3 0x3f00 -#define bCCKTxC4 0x3f0000 -#define bCCKTxC5 0x3f000000 -#define bCCKTxC6 0x3f -#define bCCKTxC7 0x3f00 -#define bCCKDebugPort 0xff0000 -#define bCCKDACDebug 0x0f000000 -#define bCCKFalseAlarmEnable 0x8000 -#define bCCKFalseAlarmRead 0x4000 -#define bCCKTRSSI 0x7f -#define bCCKRxAGCReport 0xfe -#define bCCKRxReport_AntSel 0x80000000 -#define bCCKRxReport_MFOff 0x40000000 -#define bCCKRxRxReport_SQLoss 0x20000000 -#define bCCKRxReport_Pktloss 0x10000000 -#define bCCKRxReport_Lockedbit 0x08000000 -#define bCCKRxReport_RateError 0x04000000 -#define bCCKRxReport_RxRate 0x03000000 -#define bCCKRxFACounterLower 0xff -#define bCCKRxFACounterUpper 0xff000000 -#define bCCKRxHPAGCStart 0xe000 -#define bCCKRxHPAGCFinal 0x1c00 - -#define bCCKRxFalseAlarmEnable 0x8000 -#define bCCKFACounterFreeze 0x4000 - -#define bCCKTxPathSel 0x10000000 -#define bCCKDefaultRxPath 0xc000000 -#define bCCKOptionRxPath 0x3000000 +#define bCCKBBMode 0x3 +#define bCCKTxPowerSaving 0x80 +#define bCCKRxPowerSaving 0x40 +#define bCCKSideBand 0x10 +#define bCCKScramble 0x8 +#define bCCKAntDiversity 0x8000 +#define bCCKCarrierRecovery 0x4000 +#define bCCKTxRate 0x3000 +#define bCCKDCCancel 0x0800 +#define bCCKISICancel 0x0400 +#define bCCKMatchFilter 0x0200 +#define bCCKEqualizer 0x0100 +#define bCCKPreambleDetect 0x800000 +#define bCCKFastFalseCCA 0x400000 +#define bCCKChEstStart 0x300000 +#define bCCKCCACount 0x080000 +#define bCCKcs_lim 0x070000 +#define bCCKBistMode 0x80000000 +#define bCCKCCAMask 0x40000000 +#define bCCKTxDACPhase 0x4 +#define bCCKRxADCPhase 0x20000000 //r_rx_clk +#define bCCKr_cp_mode0 0x0100 +#define bCCKTxDCOffset 0xf0 +#define bCCKRxDCOffset 0xf +#define bCCKCCAMode 0xc000 +#define bCCKFalseCS_lim 0x3f00 +#define bCCKCS_ratio 0xc00000 +#define bCCKCorgBit_sel 0x300000 +#define bCCKPD_lim 0x0f0000 +#define bCCKNewCCA 0x80000000 +#define bCCKRxHPofIG 0x8000 +#define bCCKRxIG 0x7f00 +#define bCCKLNAPolarity 0x800000 +#define bCCKRx1stGain 0x7f0000 +#define bCCKRFExtend 0x20000000 //CCK Rx initial gain polarity +#define bCCKRxAGCSatLevel 0x1f000000 +#define bCCKRxAGCSatCount 0xe0 +#define bCCKRxRFSettle 0x1f //AGCsamp_dly +#define bCCKFixedRxAGC 0x8000 +//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 +#define bCCKAntennaPolarity 0x2000 +#define bCCKTxFilterType 0x0c00 +#define bCCKRxAGCReportType 0x0300 +#define bCCKRxDAGCEn 0x80000000 +#define bCCKRxDAGCPeriod 0x20000000 +#define bCCKRxDAGCSatLevel 0x1f000000 +#define bCCKTimingRecovery 0x800000 +#define bCCKTxC0 0x3f0000 +#define bCCKTxC1 0x3f000000 +#define bCCKTxC2 0x3f +#define bCCKTxC3 0x3f00 +#define bCCKTxC4 0x3f0000 +#define bCCKTxC5 0x3f000000 +#define bCCKTxC6 0x3f +#define bCCKTxC7 0x3f00 +#define bCCKDebugPort 0xff0000 +#define bCCKDACDebug 0x0f000000 +#define bCCKFalseAlarmEnable 0x8000 +#define bCCKFalseAlarmRead 0x4000 +#define bCCKTRSSI 0x7f +#define bCCKRxAGCReport 0xfe +#define bCCKRxReport_AntSel 0x80000000 +#define bCCKRxReport_MFOff 0x40000000 +#define bCCKRxRxReport_SQLoss 0x20000000 +#define bCCKRxReport_Pktloss 0x10000000 +#define bCCKRxReport_Lockedbit 0x08000000 +#define bCCKRxReport_RateError 0x04000000 +#define bCCKRxReport_RxRate 0x03000000 +#define bCCKRxFACounterLower 0xff +#define bCCKRxFACounterUpper 0xff000000 +#define bCCKRxHPAGCStart 0xe000 +#define bCCKRxHPAGCFinal 0x1c00 + +#define bCCKRxFalseAlarmEnable 0x8000 +#define bCCKFACounterFreeze 0x4000 + +#define bCCKTxPathSel 0x10000000 +#define bCCKDefaultRxPath 0xc000000 +#define bCCKOptionRxPath 0x3000000 //page c -#define bNumOfSTF 0x3 -#define bShift_L 0xc0 -#define bGI_TH 0xc -#define bRxPathA 0x1 -#define bRxPathB 0x2 -#define bRxPathC 0x4 -#define bRxPathD 0x8 -#define bTxPathA 0x1 -#define bTxPathB 0x2 -#define bTxPathC 0x4 -#define bTxPathD 0x8 -#define bTRSSIFreq 0x200 -#define bADCBackoff 0x3000 -#define bDFIRBackoff 0xc000 -#define bTRSSILatchPhase 0x10000 -#define bRxIDCOffset 0xff -#define bRxQDCOffset 0xff00 -#define bRxDFIRMode 0x1800000 -#define bRxDCNFType 0xe000000 -#define bRXIQImb_A 0x3ff -#define bRXIQImb_B 0xfc00 -#define bRXIQImb_C 0x3f0000 -#define bRXIQImb_D 0xffc00000 -#define bDC_dc_Notch 0x60000 -#define bRxNBINotch 0x1f000000 -#define bPD_TH 0xf -#define bPD_TH_Opt2 0xc000 -#define bPWED_TH 0x700 -#define bIfMF_Win_L 0x800 -#define bPD_Option 0x1000 -#define bMF_Win_L 0xe000 -#define bBW_Search_L 0x30000 -#define bwin_enh_L 0xc0000 -#define bBW_TH 0x700000 -#define bED_TH2 0x3800000 -#define bBW_option 0x4000000 -#define bRatio_TH 0x18000000 -#define bWindow_L 0xe0000000 -#define bSBD_Option 0x1 -#define bFrame_TH 0x1c -#define bFS_Option 0x60 -#define bDC_Slope_check 0x80 -#define bFGuard_Counter_DC_L 0xe00 -#define bFrame_Weight_Short 0x7000 -#define bSub_Tune 0xe00000 -#define bFrame_DC_Length 0xe000000 -#define bSBD_start_offset 0x30000000 -#define bFrame_TH_2 0x7 -#define bFrame_GI2_TH 0x38 -#define bGI2_Sync_en 0x40 -#define bSarch_Short_Early 0x300 -#define bSarch_Short_Late 0xc00 -#define bSarch_GI2_Late 0x70000 -#define bCFOAntSum 0x1 -#define bCFOAcc 0x2 -#define bCFOStartOffset 0xc -#define bCFOLookBack 0x70 -#define bCFOSumWeight 0x80 -#define bDAGCEnable 0x10000 -#define bTXIQImb_A 0x3ff -#define bTXIQImb_B 0xfc00 -#define bTXIQImb_C 0x3f0000 -#define bTXIQImb_D 0xffc00000 -#define bTxIDCOffset 0xff -#define bTxQDCOffset 0xff00 -#define bTxDFIRMode 0x10000 -#define bTxPesudoNoiseOn 0x4000000 -#define bTxPesudoNoise_A 0xff -#define bTxPesudoNoise_B 0xff00 -#define bTxPesudoNoise_C 0xff0000 -#define bTxPesudoNoise_D 0xff000000 -#define bCCADropOption 0x20000 -#define bCCADropThres 0xfff00000 -#define bEDCCA_H 0xf -#define bEDCCA_L 0xf0 +#define bNumOfSTF 0x3 +#define bShift_L 0xc0 +#define bGI_TH 0xc +#define bRxPathA 0x1 +#define bRxPathB 0x2 +#define bRxPathC 0x4 +#define bRxPathD 0x8 +#define bTxPathA 0x1 +#define bTxPathB 0x2 +#define bTxPathC 0x4 +#define bTxPathD 0x8 +#define bTRSSIFreq 0x200 +#define bADCBackoff 0x3000 +#define bDFIRBackoff 0xc000 +#define bTRSSILatchPhase 0x10000 +#define bRxIDCOffset 0xff +#define bRxQDCOffset 0xff00 +#define bRxDFIRMode 0x1800000 +#define bRxDCNFType 0xe000000 +#define bRXIQImb_A 0x3ff +#define bRXIQImb_B 0xfc00 +#define bRXIQImb_C 0x3f0000 +#define bRXIQImb_D 0xffc00000 +#define bDC_dc_Notch 0x60000 +#define bRxNBINotch 0x1f000000 +#define bPD_TH 0xf +#define bPD_TH_Opt2 0xc000 +#define bPWED_TH 0x700 +#define bIfMF_Win_L 0x800 +#define bPD_Option 0x1000 +#define bMF_Win_L 0xe000 +#define bBW_Search_L 0x30000 +#define bwin_enh_L 0xc0000 +#define bBW_TH 0x700000 +#define bED_TH2 0x3800000 +#define bBW_option 0x4000000 +#define bRatio_TH 0x18000000 +#define bWindow_L 0xe0000000 +#define bSBD_Option 0x1 +#define bFrame_TH 0x1c +#define bFS_Option 0x60 +#define bDC_Slope_check 0x80 +#define bFGuard_Counter_DC_L 0xe00 +#define bFrame_Weight_Short 0x7000 +#define bSub_Tune 0xe00000 +#define bFrame_DC_Length 0xe000000 +#define bSBD_start_offset 0x30000000 +#define bFrame_TH_2 0x7 +#define bFrame_GI2_TH 0x38 +#define bGI2_Sync_en 0x40 +#define bSarch_Short_Early 0x300 +#define bSarch_Short_Late 0xc00 +#define bSarch_GI2_Late 0x70000 +#define bCFOAntSum 0x1 +#define bCFOAcc 0x2 +#define bCFOStartOffset 0xc +#define bCFOLookBack 0x70 +#define bCFOSumWeight 0x80 +#define bDAGCEnable 0x10000 +#define bTXIQImb_A 0x3ff +#define bTXIQImb_B 0xfc00 +#define bTXIQImb_C 0x3f0000 +#define bTXIQImb_D 0xffc00000 +#define bTxIDCOffset 0xff +#define bTxQDCOffset 0xff00 +#define bTxDFIRMode 0x10000 +#define bTxPesudoNoiseOn 0x4000000 +#define bTxPesudoNoise_A 0xff +#define bTxPesudoNoise_B 0xff00 +#define bTxPesudoNoise_C 0xff0000 +#define bTxPesudoNoise_D 0xff000000 +#define bCCADropOption 0x20000 +#define bCCADropThres 0xfff00000 +#define bEDCCA_H 0xf +#define bEDCCA_L 0xf0 #define bLambda_ED 0x300 #define bRxInitialGain 0x7f #define bRxAntDivEn 0x80 @@ -862,10 +862,10 @@ #define PathD 0x3 #define rRTL8256RxMixerPole 0xb -#define bZebraRxMixerPole 0x6 -#define rRTL8256TxBBOPBias 0x9 -#define bRTL8256TxBBOPBias 0x400 -#define rRTL8256TxBBBW 19 -#define bRTL8256TxBBBW 0x18 +#define bZebraRxMixerPole 0x6 +#define rRTL8256TxBBOPBias 0x9 +#define bRTL8256TxBBOPBias 0x400 +#define rRTL8256TxBBBW 19 +#define bRTL8256TxBBBW 0x18 #endif //__INC_HAL8190PCIPHYREG_H diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 3a6479064519..72c51b31830a 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -1131,11 +1131,11 @@ static int r8711_wx_get_wap(struct net_device *dev, struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; wrqu->ap_addr.sa_family = ARPHRD_ETHER; - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); - if (check_fwstate(pmlmepriv, _FW_LINKED | - WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) { + if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE | + WIFI_AP_STATE)) memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN); - } + else + memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); return 0; } diff --git a/drivers/staging/speakup/Kconfig b/drivers/staging/speakup/Kconfig index d288cf03e14b..b416aceb13f2 100644 --- a/drivers/staging/speakup/Kconfig +++ b/drivers/staging/speakup/Kconfig @@ -8,7 +8,7 @@ config SPEAKUP video console for blind people. If built in to the kernel, it can speak everything on the text console from boot up to shutdown. For more information on Speakup, - point your browser at http://www.linux-speakup.org/. + point your browser at <http://www.linux-speakup.org/>. There is also a mailing list at the above url that you can subscribe to. diff --git a/drivers/staging/speakup/fakekey.c b/drivers/staging/speakup/fakekey.c index 1b34a8771641..4299cf45f947 100644 --- a/drivers/staging/speakup/fakekey.c +++ b/drivers/staging/speakup/fakekey.c @@ -28,7 +28,7 @@ #define PRESSED 1 #define RELEASED 0 -DEFINE_PER_CPU(bool, reporting_keystroke); +static DEFINE_PER_CPU(bool, reporting_keystroke); static struct input_dev *virt_keyboard; diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c index 7c1658b971dc..2add1fcfd122 100644 --- a/drivers/staging/speakup/i18n.c +++ b/drivers/staging/speakup/i18n.c @@ -390,7 +390,7 @@ static struct msg_group_t all_groups[] = { static const int num_groups = sizeof(all_groups) / sizeof(struct msg_group_t); -char *msg_get(enum msg_index_t index) +char *spk_msg_get(enum msg_index_t index) { char *ch; @@ -540,7 +540,7 @@ static int fmt_validate(char *template, char *user) * -EINVAL - Invalid format specifiers in formatted message or illegal index. * -ENOMEM - Unable to allocate memory. */ -ssize_t msg_set(enum msg_index_t index, char *text, size_t length) +ssize_t spk_msg_set(enum msg_index_t index, char *text, size_t length) { int rc = 0; char *newstr = NULL; @@ -576,7 +576,7 @@ ssize_t msg_set(enum msg_index_t index, char *text, size_t length) * Find a message group, given its name. Return a pointer to the structure * if found, or NULL otherwise. */ -struct msg_group_t *find_msg_group(const char *group_name) +struct msg_group_t *spk_find_msg_group(const char *group_name) { struct msg_group_t *group = NULL; int i; @@ -590,7 +590,7 @@ struct msg_group_t *find_msg_group(const char *group_name) return group; } -void reset_msg_group(struct msg_group_t *group) +void spk_reset_msg_group(struct msg_group_t *group) { unsigned long flags; enum msg_index_t i; @@ -606,14 +606,14 @@ void reset_msg_group(struct msg_group_t *group) } /* Called at initialization time, to establish default messages. */ -void initialize_msgs(void) +void spk_initialize_msgs(void) { memcpy(speakup_msgs, speakup_default_msgs, sizeof(speakup_default_msgs)); } /* Free user-supplied strings when module is unloaded: */ -void free_user_msgs(void) +void spk_free_user_msgs(void) { enum msg_index_t index; unsigned long flags; diff --git a/drivers/staging/speakup/i18n.h b/drivers/staging/speakup/i18n.h index 65caa8010776..dd338f4218de 100644 --- a/drivers/staging/speakup/i18n.h +++ b/drivers/staging/speakup/i18n.h @@ -218,11 +218,11 @@ struct msg_group_t { enum msg_index_t end; }; -extern char *msg_get(enum msg_index_t index); -extern ssize_t msg_set(enum msg_index_t index, char *text, size_t length); -extern struct msg_group_t *find_msg_group(const char *group_name); -extern void reset_msg_group(struct msg_group_t *group); -extern void initialize_msgs(void); -extern void free_user_msgs(void); +extern char *spk_msg_get(enum msg_index_t index); +extern ssize_t spk_msg_set(enum msg_index_t index, char *text, size_t length); +extern struct msg_group_t *spk_find_msg_group(const char *group_name); +extern void spk_reset_msg_group(struct msg_group_t *group); +extern void spk_initialize_msgs(void); +extern void spk_free_user_msgs(void); #endif diff --git a/drivers/staging/speakup/keyhelp.c b/drivers/staging/speakup/keyhelp.c index 170f38815ffd..4c584ecbd1fa 100644 --- a/drivers/staging/speakup/keyhelp.c +++ b/drivers/staging/speakup/keyhelp.c @@ -115,10 +115,10 @@ static void say_key(int key) key &= 0xff; for (i = 0; i < 6; i++) { if (state & masks[i]) - synth_printf(" %s", msg_get(MSG_STATES_START + i)); + synth_printf(" %s", spk_msg_get(MSG_STATES_START + i)); } if ((key > 0) && (key <= num_key_names)) - synth_printf(" %s\n", msg_get(MSG_KEYNAMES_START + (key - 1))); + synth_printf(" %s\n", spk_msg_get(MSG_KEYNAMES_START + (key - 1))); } static int help_init(void) @@ -126,9 +126,9 @@ static int help_init(void) char start = SPACE; int i; int num_funcs = MSG_FUNCNAMES_END - MSG_FUNCNAMES_START + 1; -state_tbl = our_keys[0]+SHIFT_TBL_SIZE+2; +state_tbl = spk_our_keys[0]+SHIFT_TBL_SIZE+2; for (i = 0; i < num_funcs; i++) { - char *cur_funcname = msg_get(MSG_FUNCNAMES_START + i); + char *cur_funcname = spk_msg_get(MSG_FUNCNAMES_START + i); if (start == *cur_funcname) continue; start = *cur_funcname; @@ -137,7 +137,7 @@ state_tbl = our_keys[0]+SHIFT_TBL_SIZE+2; return 0; } -int handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key) +int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key) { int i, n; char *name; @@ -147,15 +147,15 @@ int handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key) help_init(); if (type == KT_LATIN) { if (ch == SPACE) { - special_handler = NULL; - synth_printf("%s\n", msg_get(MSG_LEAVING_HELP)); + spk_special_handler = NULL; + synth_printf("%s\n", spk_msg_get(MSG_LEAVING_HELP)); return 1; } ch |= 32; /* lower case */ if (ch < 'a' || ch > 'z') return -1; if (letter_offsets[ch-'a'] == -1) { - synth_printf(msg_get(MSG_NO_COMMAND), ch); + synth_printf(spk_msg_get(MSG_NO_COMMAND), ch); synth_printf("\n"); return 1; } @@ -169,47 +169,47 @@ int handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key) cur_item--; else return -1; - } else if (type == KT_SPKUP && ch == SPEAKUP_HELP && !special_handler) { - special_handler = handle_help; - synth_printf("%s\n", msg_get(MSG_HELP_INFO)); + } else if (type == KT_SPKUP && ch == SPEAKUP_HELP && !spk_special_handler) { + spk_special_handler = spk_handle_help; + synth_printf("%s\n", spk_msg_get(MSG_HELP_INFO)); build_key_data(); /* rebuild each time in case new mapping */ return 1; } else { name = NULL; if ((type != KT_SPKUP) && (key > 0) && (key <= num_key_names)) { synth_printf("%s\n", - msg_get(MSG_KEYNAMES_START + key-1)); + spk_msg_get(MSG_KEYNAMES_START + key-1)); return 1; } for (i = 0; funcvals[i] != 0 && !name; i++) { if (ch == funcvals[i]) - name = msg_get(MSG_FUNCNAMES_START + i); + name = spk_msg_get(MSG_FUNCNAMES_START + i); } if (!name) return -1; - kp = our_keys[key]+1; + kp = spk_our_keys[key]+1; for (i = 0; i < nstates; i++) { if (ch == kp[i]) break; } key += (state_tbl[i] << 8); say_key(key); - synth_printf(msg_get(MSG_KEYDESC), name); + synth_printf(spk_msg_get(MSG_KEYDESC), name); synth_printf("\n"); return 1; } - name = msg_get(MSG_FUNCNAMES_START + cur_item); + name = spk_msg_get(MSG_FUNCNAMES_START + cur_item); func = funcvals[cur_item]; synth_printf("%s", name); if (key_offsets[func] == 0) { - synth_printf(" %s\n", msg_get(MSG_IS_UNASSIGNED)); + synth_printf(" %s\n", spk_msg_get(MSG_IS_UNASSIGNED)); return 1; } p_keys = key_data + key_offsets[func]; for (n = 0; p_keys[n]; n++) { val = p_keys[n]; if (n > 0) - synth_printf("%s ", msg_get(MSG_DISJUNCTION)); + synth_printf("%s ", spk_msg_get(MSG_DISJUNCTION)); say_key(val); } return 1; diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 2093896c546b..86387f48b30c 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -41,7 +41,7 @@ static ssize_t chars_chartab_show(struct kobject *kobj, break; if (strcmp("characters", attr->attr.name) == 0) { len = scnprintf(buf_pointer, bufsize, "%d\t%s\n", - i, characters[i]); + i, spk_characters[i]); } else { /* show chartab entry */ if (IS_TYPE(i, B_CTL)) cp = "B_CTL"; @@ -185,12 +185,12 @@ static ssize_t chars_chartab_store(struct kobject *kobj, outptr[desc_length] = '\0'; if (do_characters) { - if (characters[index] != default_chars[index]) - kfree(characters[index]); - characters[index] = desc; + if (spk_characters[index] != spk_default_chars[index]) + kfree(spk_characters[index]); + spk_characters[index] = desc; used++; } else { - charclass = chartab_get_value(keyword); + charclass = spk_chartab_get_value(keyword); if (charclass == 0) { rejected++; cp = linefeed + 1; @@ -206,9 +206,9 @@ static ssize_t chars_chartab_store(struct kobject *kobj, if (reset) { if (do_characters) - reset_default_chars(); + spk_reset_default_chars(); else - reset_default_chartab(); + spk_reset_default_chartab(); } spk_unlock(flags); @@ -232,7 +232,7 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr, u_char ch; unsigned long flags; spk_lock(flags); - cp1 = key_buf + SHIFT_TBL_SIZE; + cp1 = spk_key_buf + SHIFT_TBL_SIZE; num_keys = (int)(*cp1); nstates = (int)cp1[1]; cp += sprintf(cp, "%d, %d, %d,\n", KEY_MAP_VER, num_keys, nstates); @@ -271,7 +271,7 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr, return -ENOMEM; } if (strchr("dDrR", *in_buff)) { - set_key_info(key_defaults, key_buf); + spk_set_key_info(spk_key_defaults, spk_key_buf); pr_info("keymap set to default values\n"); kfree(in_buff); spk_unlock(flags); @@ -282,14 +282,14 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr, cp = in_buff; cp1 = (u_char *)in_buff; for (i = 0; i < 3; i++) { - cp = s2uchar(cp, cp1); + cp = spk_s2uchar(cp, cp1); cp1++; } i = (int)cp1[-2]+1; i *= (int)cp1[-1]+1; i += 2; /* 0 and last map ver */ if (cp1[-3] != KEY_MAP_VER || cp1[-1] > 10 || - i+SHIFT_TBL_SIZE+4 >= sizeof(key_buf)) { + i+SHIFT_TBL_SIZE+4 >= sizeof(spk_key_buf)) { pr_warn("i %d %d %d %d\n", i, (int)cp1[-3], (int)cp1[-2], (int)cp1[-1]); kfree(in_buff); @@ -297,7 +297,7 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr, return -EINVAL; } while (--i >= 0) { - cp = s2uchar(cp, cp1); + cp = spk_s2uchar(cp, cp1); cp1++; if (!(*cp)) break; @@ -307,8 +307,8 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr, pr_warn("end %d %d %d %d\n", i, (int)cp1[-3], (int)cp1[-2], (int)cp1[-1]); } else { - if (set_key_info(in_buff, key_buf)) { - set_key_info(key_defaults, key_buf); + if (spk_set_key_info(in_buff, spk_key_buf)) { + spk_set_key_info(spk_key_defaults, spk_key_buf); ret = -EINVAL; pr_warn("set key failed\n"); } @@ -343,7 +343,7 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr, spk_lock(flags); if (ch&2) { shut = 1; - do_flush(); + spk_do_flush(); } else { shut = 0; } @@ -388,7 +388,7 @@ static ssize_t synth_store(struct kobject *kobj, struct kobj_attribute *attr, if (new_synth_name[len - 1] == '\n') len--; new_synth_name[len] = '\0'; - strlwr(new_synth_name); + spk_strlwr(new_synth_name); if ((synth != NULL) && (!strcmp(new_synth_name, synth->name))) { pr_warn("%s already in use\n", new_synth_name); } else if (synth_init(new_synth_name) != 0) { @@ -417,7 +417,7 @@ static ssize_t synth_direct_store(struct kobject *kobj, bytes = min_t(size_t, len, 250); strncpy(tmp, ptr, bytes); tmp[bytes] = '\0'; - xlate(tmp); + spk_xlate(tmp); synth_printf("%s", tmp); ptr += bytes; len -= bytes; @@ -455,14 +455,14 @@ static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr, short mask; unsigned long flags; - p_header = var_header_by_name(attr->attr.name); + p_header = spk_var_header_by_name(attr->attr.name); if (p_header == NULL) { pr_warn("p_header is null, attr->attr.name is %s\n", attr->attr.name); return -EINVAL; } - var = get_punc_var(p_header->var_id); + var = spk_get_punc_var(p_header->var_id); if (var == NULL) { pr_warn("var is null, p_header->var_id is %i\n", p_header->var_id); @@ -470,7 +470,7 @@ static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr, } spk_lock(flags); - pb = (struct st_bits_data *) &punc_info[var->value]; + pb = (struct st_bits_data *) &spk_punc_info[var->value]; mask = pb->mask; for (i = 33; i < 128; i++) { if (!(spk_chartab[i]&mask)) @@ -497,14 +497,14 @@ static ssize_t punc_store(struct kobject *kobj, struct kobj_attribute *attr, if (x < 1 || x > 99) return -EINVAL; - p_header = var_header_by_name(attr->attr.name); + p_header = spk_var_header_by_name(attr->attr.name); if (p_header == NULL) { pr_warn("p_header is null, attr->attr.name is %s\n", attr->attr.name); return -EINVAL; } - var = get_punc_var(p_header->var_id); + var = spk_get_punc_var(p_header->var_id); if (var == NULL) { pr_warn("var is null, p_header->var_id is %i\n", p_header->var_id); @@ -520,9 +520,9 @@ static ssize_t punc_store(struct kobject *kobj, struct kobj_attribute *attr, spk_lock(flags); if (*punc_buf == 'd' || *punc_buf == 'r') - x = set_mask_bits(0, var->value, 3); + x = spk_set_mask_bits(0, var->value, 3); else - x = set_mask_bits(punc_buf, var->value, 3); + x = spk_set_mask_bits(punc_buf, var->value, 3); spk_unlock(flags); return count; @@ -542,7 +542,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr, char ch; unsigned long flags; - param = var_header_by_name(attr->attr.name); + param = spk_var_header_by_name(attr->attr.name); if (param == NULL) return -EINVAL; @@ -599,13 +599,13 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, int value; unsigned long flags; - param = var_header_by_name(attr->attr.name); + param = spk_var_header_by_name(attr->attr.name); if (param == NULL) return -EINVAL; if (param->data == NULL) return 0; ret = 0; - cp = xlate((char *) buf); + cp = spk_xlate((char *) buf); spk_lock(flags); switch (param->var_type) { @@ -618,7 +618,7 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, else len = E_SET; speakup_s2i(cp, &value); - ret = set_num_var(value, param, len); + ret = spk_set_num_var(value, param, len); if (ret == E_RANGE) { var_data = param->data; pr_warn("value for %s out of range, expect %d to %d\n", @@ -636,7 +636,7 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, } cp = (char *) buf; cp[len] = '\0'; - ret = set_string_var(buf, param, len); + ret = spk_set_string_var(buf, param, len); if (ret == E_TOOLONG) pr_warn("value too long for %s\n", attr->attr.name); @@ -652,19 +652,19 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, */ if (strcmp(attr->attr.name, "voice") == 0) { if (synth && synth->default_pitch) { - param = var_header_by_name("pitch"); + param = spk_var_header_by_name("pitch"); if (param) { - set_num_var(synth->default_pitch[value], param, + spk_set_num_var(synth->default_pitch[value], param, E_NEW_DEFAULT); - set_num_var(0, param, E_DEFAULT); + spk_set_num_var(0, param, E_DEFAULT); } } if (synth && synth->default_vol) { - param = var_header_by_name("vol"); + param = spk_var_header_by_name("vol"); if (param) { - set_num_var(synth->default_vol[value], param, + spk_set_num_var(synth->default_vol[value], param, E_NEW_DEFAULT); - set_num_var(0, param, E_DEFAULT); + spk_set_num_var(0, param, E_DEFAULT); } } } @@ -694,7 +694,7 @@ static ssize_t message_show_helper(char *buf, enum msg_index_t first, if (bufsize <= 1) break; printed = scnprintf(buf_pointer, bufsize, "%d\t%s\n", - index, msg_get(cursor)); + index, spk_msg_get(cursor)); buf_pointer += printed; bufsize -= printed; } @@ -788,7 +788,7 @@ static ssize_t message_store_helper(const char *buf, size_t count, continue; } - msg_stored = msg_set(curmessage, temp, desc_length); + msg_stored = spk_msg_set(curmessage, temp, desc_length); if (msg_stored < 0) { retval = msg_stored; if (msg_stored == -ENOMEM) @@ -802,7 +802,7 @@ static ssize_t message_store_helper(const char *buf, size_t count, } if (reset) - reset_msg_group(group); + spk_reset_msg_group(group); report_msg_status(reset, received, used, rejected, group->name); return retval; @@ -812,7 +812,7 @@ static ssize_t message_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { ssize_t retval = 0; - struct msg_group_t *group = find_msg_group(attr->attr.name); + struct msg_group_t *group = spk_find_msg_group(attr->attr.name); unsigned long flags; BUG_ON(!group); @@ -826,7 +826,7 @@ static ssize_t message_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { ssize_t retval = 0; - struct msg_group_t *group = find_msg_group(attr->attr.name); + struct msg_group_t *group = spk_find_msg_group(attr->attr.name); BUG_ON(!group); retval = message_store_helper(buf, count, group); diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index 40e2488b9679..9916e94aa361 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -65,23 +65,23 @@ MODULE_VERSION(SPEAKUP_VERSION); char *synth_name; module_param_named(synth, synth_name, charp, S_IRUGO); -module_param_named(quiet, quiet_boot, bool, S_IRUGO); +module_param_named(quiet, spk_quiet_boot, bool, S_IRUGO); MODULE_PARM_DESC(synth, "Synth to start if speakup is built in."); MODULE_PARM_DESC(quiet, "Do not announce when the synthesizer is found."); -special_func special_handler; +special_func spk_special_handler; -short pitch_shift, synth_flags; +short spk_pitch_shift, synth_flags; static char buf[256]; -int attrib_bleep, bleeps, bleep_time = 10; -int no_intr, spell_delay; -int key_echo, say_word_ctl; -int say_ctrl, bell_pos; -short punc_mask; -int punc_level, reading_punc; -char str_caps_start[MAXVARLEN + 1] = "\0", str_caps_stop[MAXVARLEN + 1] = "\0"; -const struct st_bits_data punc_info[] = { +int spk_attrib_bleep, spk_bleeps, spk_bleep_time = 10; +int spk_no_intr, spk_spell_delay; +int spk_key_echo, spk_say_word_ctl; +int spk_say_ctrl, spk_bell_pos; +short spk_punc_mask; +int spk_punc_level, spk_reading_punc; +char spk_str_caps_start[MAXVARLEN + 1] = "\0", spk_str_caps_stop[MAXVARLEN + 1] = "\0"; +const struct st_bits_data spk_punc_info[] = { {"none", "", 0}, {"some", "/$%&@", SOME}, {"most", "$%&#()=+*/@^<>|\\", MOST}, @@ -95,9 +95,9 @@ const struct st_bits_data punc_info[] = { static char mark_cut_flag; #define MAX_KEY 160 -u_char *our_keys[MAX_KEY], *shift_table; -u_char key_buf[600]; -const u_char key_defaults[] = { +u_char *spk_our_keys[MAX_KEY], *spk_shift_table; +u_char spk_key_buf[600]; +const u_char spk_key_defaults[] = { #include "speakupmap.h" }; @@ -129,9 +129,9 @@ static char *phonetic[] = { /* array of 256 char pointers (one for each character description) * initialized to default_chars and user selectable via * /proc/speakup/characters */ -char *characters[256]; +char *spk_characters[256]; -char *default_chars[256] = { +char *spk_default_chars[256] = { /*000*/ "null", "^a", "^b", "^c", "^d", "^e", "^f", "^g", /*008*/ "^h", "^i", "^j", "^k", "^l", "^m", "^n", "^o", /*016*/ "^p", "^q", "^r", "^s", "^t", "^u", "^v", "^w", @@ -238,7 +238,7 @@ static u_short default_chartab[256] = { }; struct task_struct *speakup_task; -struct bleep unprocessed_sound; +struct bleep spk_unprocessed_sound; static int spk_keydown; static u_char spk_lastkey, spk_close_press, keymap_flags; static u_char last_keycode, this_speakup_key; @@ -251,14 +251,14 @@ DEFINE_MUTEX(spk_mutex); static int keyboard_notifier_call(struct notifier_block *, unsigned long code, void *param); -struct notifier_block keyboard_notifier_block = { +static struct notifier_block keyboard_notifier_block = { .notifier_call = keyboard_notifier_call, }; static int vt_notifier_call(struct notifier_block *, unsigned long code, void *param); -struct notifier_block vt_notifier_block = { +static struct notifier_block vt_notifier_block = { .notifier_call = vt_notifier_call, }; @@ -282,13 +282,13 @@ static void bleep(u_short val) 350, 370, 392, 414, 440, 466, 491, 523, 554, 587, 619, 659 }; short freq; - int time = bleep_time; + int time = spk_bleep_time; freq = vals[val % 12]; if (val > 11) freq *= (1 << (val / 12)); - unprocessed_sound.freq = freq; - unprocessed_sound.jiffies = msecs_to_jiffies(time); - unprocessed_sound.active = 1; + spk_unprocessed_sound.freq = freq; + spk_unprocessed_sound.jiffies = msecs_to_jiffies(time); + spk_unprocessed_sound.active = 1; /* We can only have 1 active sound at a time. */ } @@ -300,7 +300,7 @@ static void speakup_shut_up(struct vc_data *vc) spk_parked &= 0xfe; speakup_date(vc); if (synth != NULL) - do_flush(); + spk_do_flush(); } static void speech_kill(struct vc_data *vc) @@ -313,9 +313,9 @@ static void speech_kill(struct vc_data *vc) if (val == 2 || spk_killed) { /* dead */ spk_shut_up &= ~0x40; - synth_printf("%s\n", msg_get(MSG_IAM_ALIVE)); + synth_printf("%s\n", spk_msg_get(MSG_IAM_ALIVE)); } else { - synth_printf("%s\n", msg_get(MSG_YOU_KILLED_SPEAKUP)); + synth_printf("%s\n", spk_msg_get(MSG_YOU_KILLED_SPEAKUP)); spk_shut_up |= 0x40; } } @@ -324,10 +324,10 @@ static void speakup_off(struct vc_data *vc) { if (spk_shut_up & 0x80) { spk_shut_up &= 0x7f; - synth_printf("%s\n", msg_get(MSG_HEY_THATS_BETTER)); + synth_printf("%s\n", spk_msg_get(MSG_HEY_THATS_BETTER)); } else { spk_shut_up |= 0x80; - synth_printf("%s\n", msg_get(MSG_YOU_TURNED_ME_OFF)); + synth_printf("%s\n", spk_msg_get(MSG_YOU_TURNED_ME_OFF)); } speakup_date(vc); } @@ -336,10 +336,10 @@ static void speakup_parked(struct vc_data *vc) { if (spk_parked & 0x80) { spk_parked = 0; - synth_printf("%s\n", msg_get(MSG_UNPARKED)); + synth_printf("%s\n", spk_msg_get(MSG_UNPARKED)); } else { spk_parked |= 0x80; - synth_printf("%s\n", msg_get(MSG_PARKED)); + synth_printf("%s\n", spk_msg_get(MSG_PARKED)); } } @@ -350,16 +350,16 @@ static void speakup_cut(struct vc_data *vc) if (!mark_cut_flag) { mark_cut_flag = 1; - xs = (u_short) spk_x; - ys = (u_short) spk_y; + spk_xs = (u_short) spk_x; + spk_ys = (u_short) spk_y; spk_sel_cons = vc; - synth_printf("%s\n", msg_get(MSG_MARK)); + synth_printf("%s\n", spk_msg_get(MSG_MARK)); return; } - xe = (u_short) spk_x; - ye = (u_short) spk_y; + spk_xe = (u_short) spk_x; + spk_ye = (u_short) spk_y; mark_cut_flag = 0; - synth_printf("%s\n", msg_get(MSG_CUT)); + synth_printf("%s\n", spk_msg_get(MSG_CUT)); speakup_clear_selection(); ret = speakup_set_selection(tty); @@ -383,9 +383,9 @@ static void speakup_paste(struct vc_data *vc) { if (mark_cut_flag) { mark_cut_flag = 0; - synth_printf("%s\n", msg_get(MSG_MARK_CLEARED)); + synth_printf("%s\n", spk_msg_get(MSG_MARK_CLEARED)); } else { - synth_printf("%s\n", msg_get(MSG_PASTE)); + synth_printf("%s\n", spk_msg_get(MSG_PASTE)); speakup_paste_selection(tty); } } @@ -395,16 +395,16 @@ static void say_attributes(struct vc_data *vc) int fg = spk_attr & 0x0f; int bg = spk_attr >> 4; if (fg > 8) { - synth_printf("%s ", msg_get(MSG_BRIGHT)); + synth_printf("%s ", spk_msg_get(MSG_BRIGHT)); fg -= 8; } - synth_printf("%s", msg_get(MSG_COLORS_START + fg)); + synth_printf("%s", spk_msg_get(MSG_COLORS_START + fg)); if (bg > 7) { - synth_printf(" %s ", msg_get(MSG_ON_BLINKING)); + synth_printf(" %s ", spk_msg_get(MSG_ON_BLINKING)); bg -= 8; } else - synth_printf(" %s ", msg_get(MSG_ON)); - synth_printf("%s\n", msg_get(MSG_COLORS_START + bg)); + synth_printf(" %s ", spk_msg_get(MSG_ON)); + synth_printf("%s\n", spk_msg_get(MSG_COLORS_START + bg)); } enum { @@ -417,24 +417,24 @@ enum { static void announce_edge(struct vc_data *vc, int msg_id) { - if (bleeps & 1) + if (spk_bleeps & 1) bleep(spk_y); - if ((bleeps & 2) && (msg_id < edge_quiet)) - synth_printf("%s\n", msg_get(MSG_EDGE_MSGS_START + msg_id - 1)); + if ((spk_bleeps & 2) && (msg_id < edge_quiet)) + synth_printf("%s\n", spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 1)); } static void speak_char(u_char ch) { - char *cp = characters[ch]; - struct var_t *direct = get_var(DIRECT); + char *cp = spk_characters[ch]; + struct var_t *direct = spk_get_var(DIRECT); if (direct && direct->u.n.value) { if (IS_CHAR(ch, B_CAP)) { - pitch_shift++; - synth_printf("%s", str_caps_start); + spk_pitch_shift++; + synth_printf("%s", spk_str_caps_start); } synth_printf("%c", ch); if (IS_CHAR(ch, B_CAP)) - synth_printf("%s", str_caps_stop); + synth_printf("%s", spk_str_caps_stop); return; } if (cp == NULL) { @@ -443,13 +443,13 @@ static void speak_char(u_char ch) } synth_buffer_add(SPACE); if (IS_CHAR(ch, B_CAP)) { - pitch_shift++; - synth_printf("%s", str_caps_start); + spk_pitch_shift++; + synth_printf("%s", spk_str_caps_start); synth_printf("%s", cp); - synth_printf("%s", str_caps_stop); + synth_printf("%s", spk_str_caps_stop); } else { if (*cp == '^') { - synth_printf("%s", msg_get(MSG_CTRL)); + synth_printf("%s", spk_msg_get(MSG_CTRL)); cp++; } synth_printf("%s", cp); @@ -479,9 +479,9 @@ static void say_char(struct vc_data *vc) spk_old_attr = spk_attr; ch = get_char(vc, (u_short *) spk_pos, &spk_attr); if (spk_attr != spk_old_attr) { - if (attrib_bleep & 1) + if (spk_attrib_bleep & 1) bleep(spk_y); - if (attrib_bleep & 2) + if (spk_attrib_bleep & 2) say_attributes(vc); } speak_char(ch & 0xff); @@ -497,7 +497,7 @@ static void say_phonetic_char(struct vc_data *vc) synth_printf("%s\n", phonetic[--ch]); } else { if (IS_CHAR(ch, B_NUM)) - synth_printf("%s ", msg_get(MSG_NUMBER)); + synth_printf("%s ", spk_msg_get(MSG_NUMBER)); speak_char(ch); } } @@ -527,8 +527,8 @@ static void say_next_char(struct vc_data *vc) } /* get_word - will first check to see if the character under the - * reading cursor is a space and if say_word_ctl is true it will - * return the word space. If say_word_ctl is not set it will check to + * reading cursor is a space and if spk_say_word_ctl is true it will + * return the word space. If spk_say_word_ctl is not set it will check to * see if there is a word starting on the next position to the right * and return that word if it exists. If it does not exist it will * move left to the beginning of any previous word on the line or the @@ -544,9 +544,9 @@ static u_long get_word(struct vc_data *vc) ch = (char)get_char(vc, (u_short *) tmp_pos, &temp); /* decided to take out the sayword if on a space (mis-information */ - if (say_word_ctl && ch == SPACE) { + if (spk_say_word_ctl && ch == SPACE) { *buf = '\0'; - synth_printf("%s\n", msg_get(MSG_SPACE)); + synth_printf("%s\n", spk_msg_get(MSG_SPACE)); return 0; } else if ((tmpx < vc->vc_cols - 2) && (ch == SPACE || ch == 0 || IS_WDLM(ch)) @@ -582,13 +582,13 @@ static u_long get_word(struct vc_data *vc) static void say_word(struct vc_data *vc) { u_long cnt = get_word(vc); - u_short saved_punc_mask = punc_mask; + u_short saved_punc_mask = spk_punc_mask; if (cnt == 0) return; - punc_mask = PUNC; + spk_punc_mask = PUNC; buf[cnt++] = SPACE; spkup_write(buf, cnt); - punc_mask = saved_punc_mask; + spk_punc_mask = saved_punc_mask; } static void say_prev_word(struct vc_data *vc) @@ -686,22 +686,22 @@ static void say_next_word(struct vc_data *vc) static void spell_word(struct vc_data *vc) { static char *delay_str[] = { "", ",", ".", ". .", ". . ." }; - char *cp = buf, *str_cap = str_caps_stop; - char *cp1, *last_cap = str_caps_stop; + char *cp = buf, *str_cap = spk_str_caps_stop; + char *cp1, *last_cap = spk_str_caps_stop; u_char ch; if (!get_word(vc)) return; while ((ch = (u_char) *cp)) { if (cp != buf) - synth_printf(" %s ", delay_str[spell_delay]); + synth_printf(" %s ", delay_str[spk_spell_delay]); if (IS_CHAR(ch, B_CAP)) { - str_cap = str_caps_start; - if (*str_caps_stop) - pitch_shift++; + str_cap = spk_str_caps_start; + if (*spk_str_caps_stop) + spk_pitch_shift++; else /* synth has no pitch */ - last_cap = str_caps_stop; + last_cap = spk_str_caps_stop; } else - str_cap = str_caps_stop; + str_cap = spk_str_caps_stop; if (str_cap != last_cap) { synth_printf("%s", str_cap); last_cap = str_cap; @@ -711,17 +711,17 @@ static void spell_word(struct vc_data *vc) ch &= 31; cp1 = phonetic[--ch]; } else { - cp1 = characters[ch]; + cp1 = spk_characters[ch]; if (*cp1 == '^') { - synth_printf("%s", msg_get(MSG_CTRL)); + synth_printf("%s", spk_msg_get(MSG_CTRL)); cp1++; } } synth_printf("%s", cp1); cp++; } - if (str_cap != str_caps_stop) - synth_printf("%s", str_caps_stop); + if (str_cap != spk_str_caps_stop) + synth_printf("%s", spk_str_caps_stop); } static int get_line(struct vc_data *vc) @@ -746,9 +746,9 @@ static void say_line(struct vc_data *vc) { int i = get_line(vc); char *cp; - u_short saved_punc_mask = punc_mask; + u_short saved_punc_mask = spk_punc_mask; if (i == 0) { - synth_printf("%s\n", msg_get(MSG_BLANK)); + synth_printf("%s\n", spk_msg_get(MSG_BLANK)); return; } buf[i++] = '\n'; @@ -758,9 +758,9 @@ static void say_line(struct vc_data *vc) cp++; synth_printf("%d, ", (cp - buf) + 1); } - punc_mask = punc_masks[reading_punc]; + spk_punc_mask = spk_punc_masks[spk_reading_punc]; spkup_write(buf, i); - punc_mask = saved_punc_mask; + spk_punc_mask = saved_punc_mask; } static void say_prev_line(struct vc_data *vc) @@ -792,7 +792,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to, { int i = 0; u_char tmp; - u_short saved_punc_mask = punc_mask; + u_short saved_punc_mask = spk_punc_mask; spk_old_attr = spk_attr; spk_attr = get_attributes((u_short *) from); while (from < to) { @@ -809,10 +809,10 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to, if (i < 1) return i; if (read_punc) - punc_mask = punc_info[reading_punc].mask; + spk_punc_mask = spk_punc_info[spk_reading_punc].mask; spkup_write(buf, i); if (read_punc) - punc_mask = saved_punc_mask; + spk_punc_mask = saved_punc_mask; return i - 1; } @@ -824,7 +824,7 @@ static void say_line_from_to(struct vc_data *vc, u_long from, u_long to, start += from * 2; if (say_from_to(vc, start, end, read_punc) <= 0) if (cursor_track != read_all_mode) - synth_printf("%s\n", msg_get(MSG_BLANK)); + synth_printf("%s\n", spk_msg_get(MSG_BLANK)); } /* Sentence Reading Commands */ @@ -924,7 +924,7 @@ static void speakup_win_say(struct vc_data *vc) { u_long start, end, from, to; if (win_start < 2) { - synth_printf("%s\n", msg_get(MSG_NO_WINDOW)); + synth_printf("%s\n", spk_msg_get(MSG_NO_WINDOW)); return; } start = vc->vc_origin + (win_top * vc->vc_size_row); @@ -975,7 +975,7 @@ static void say_first_char(struct vc_data *vc) u_char ch; spk_parked |= 0x01; if (len == 0) { - synth_printf("%s\n", msg_get(MSG_BLANK)); + synth_printf("%s\n", spk_msg_get(MSG_BLANK)); return; } for (i = 0; i < len; i++) @@ -994,7 +994,7 @@ static void say_last_char(struct vc_data *vc) u_char ch; spk_parked |= 0x01; if (len == 0) { - synth_printf("%s\n", msg_get(MSG_BLANK)); + synth_printf("%s\n", spk_msg_get(MSG_BLANK)); return; } ch = buf[--len]; @@ -1006,7 +1006,7 @@ static void say_last_char(struct vc_data *vc) static void say_position(struct vc_data *vc) { - synth_printf(msg_get(MSG_POS_INFO), spk_y + 1, spk_x + 1, + synth_printf(spk_msg_get(MSG_POS_INFO), spk_y + 1, spk_x + 1, vc->vc_num + 1); synth_printf("\n"); } @@ -1017,7 +1017,7 @@ static void say_char_num(struct vc_data *vc) u_char tmp; u_short ch = get_char(vc, (u_short *) spk_pos, &tmp); ch &= 0xff; - synth_printf(msg_get(MSG_CHAR_INFO), ch, ch); + synth_printf(spk_msg_get(MSG_CHAR_INFO), ch, ch); } /* these are stub functions to keep keyboard.c happy. */ @@ -1066,7 +1066,7 @@ static void spkup_write(const char *in_buf, int count) } else { if ((last_type & CH_RPT) && rep_count > 2) { synth_printf(" "); - synth_printf(msg_get(MSG_REPEAT_DESC), + synth_printf(spk_msg_get(MSG_REPEAT_DESC), ++rep_count); synth_printf(" "); } @@ -1074,7 +1074,7 @@ static void spkup_write(const char *in_buf, int count) } if (ch == spk_lastkey) { rep_count = 0; - if (key_echo == 1 && ch >= MINECHOCHAR) + if (spk_key_echo == 1 && ch >= MINECHOCHAR) speak_char(ch); } else if (char_type & B_ALPHA) { if ((synth_flags & SF_DEC) && (last_type & PUNC)) @@ -1083,7 +1083,7 @@ static void spkup_write(const char *in_buf, int count) } else if (char_type & B_NUM) { rep_count = 0; synth_printf("%c", ch); - } else if (char_type & punc_mask) { + } else if (char_type & spk_punc_mask) { speak_char(ch); char_type &= ~PUNC; /* for dec nospell processing */ } else if (char_type & SYNTH_OK) { @@ -1111,7 +1111,7 @@ static void spkup_write(const char *in_buf, int count) if (in_count > 2 && rep_count > 2) { if (last_type & CH_RPT) { synth_printf(" "); - synth_printf(msg_get(MSG_REPEAT_DESC2), ++rep_count); + synth_printf(spk_msg_get(MSG_REPEAT_DESC2), ++rep_count); synth_printf(" "); } rep_count = 0; @@ -1135,22 +1135,22 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag) case KVAL(K_SHIFT): del_timer(&cursor_timer); spk_shut_up &= 0xfe; - do_flush(); + spk_do_flush(); read_all_doc(vc); break; case KVAL(K_CTRL): del_timer(&cursor_timer); cursor_track = prev_cursor_track; spk_shut_up &= 0xfe; - do_flush(); + spk_do_flush(); break; } } else { spk_shut_up &= 0xfe; - do_flush(); + spk_do_flush(); } - if (say_ctrl && value < NUM_CTL_LABELS) - synth_printf("%s", msg_get(MSG_CTL_START + value)); + if (spk_say_ctrl && value < NUM_CTL_LABELS) + synth_printf("%s", spk_msg_get(MSG_CTL_START + value)); spk_unlock(flags); } @@ -1171,12 +1171,12 @@ static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag) spk_lastkey = value; spk_keydown++; spk_parked &= 0xfe; - if (key_echo == 2 && value >= MINECHOCHAR) + if (spk_key_echo == 2 && value >= MINECHOCHAR) speak_char(value); spk_unlock(flags); } -int set_key_info(const u_char *key_info, u_char *k_buffer) +int spk_set_key_info(const u_char *key_info, u_char *k_buffer) { int i = 0, states, key_data_len; const u_char *cp = key_info; @@ -1188,12 +1188,12 @@ int set_key_info(const u_char *key_info, u_char *k_buffer) num_keys = *cp; states = (int)cp[1]; key_data_len = (states + 1) * (num_keys + 1); - if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(key_buf)) + if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) return -2; memset(k_buffer, 0, SHIFT_TBL_SIZE); - memset(our_keys, 0, sizeof(our_keys)); - shift_table = k_buffer; - our_keys[0] = shift_table; + memset(spk_our_keys, 0, sizeof(spk_our_keys)); + spk_shift_table = k_buffer; + spk_our_keys[0] = spk_shift_table; cp1 += SHIFT_TBL_SIZE; memcpy(cp1, cp, key_data_len + 3); /* get num_keys, states and data */ @@ -1202,13 +1202,13 @@ int set_key_info(const u_char *key_info, u_char *k_buffer) ch = *cp1++; if (ch >= SHIFT_TBL_SIZE) return -3; - shift_table[ch] = i; + spk_shift_table[ch] = i; } keymap_flags = *cp1++; while ((ch = *cp1)) { if (ch >= MAX_KEY) return -4; - our_keys[ch] = cp1; + spk_our_keys[ch] = cp1; cp1 += states + 1; } return 0; @@ -1237,24 +1237,24 @@ static void toggle_cursoring(struct vc_data *vc) cursor_track = prev_cursor_track; if (++cursor_track >= CT_Max) cursor_track = 0; - synth_printf("%s\n", msg_get(MSG_CURSOR_MSGS_START + cursor_track)); + synth_printf("%s\n", spk_msg_get(MSG_CURSOR_MSGS_START + cursor_track)); } -void reset_default_chars(void) +void spk_reset_default_chars(void) { int i; /* First, free any non-default */ for (i = 0; i < 256; i++) { - if ((characters[i] != NULL) - && (characters[i] != default_chars[i])) - kfree(characters[i]); + if ((spk_characters[i] != NULL) + && (spk_characters[i] != spk_default_chars[i])) + kfree(spk_characters[i]); } - memcpy(characters, default_chars, sizeof(default_chars)); + memcpy(spk_characters, spk_default_chars, sizeof(spk_default_chars)); } -void reset_default_chartab(void) +void spk_reset_default_chartab(void) { memcpy(spk_chartab, default_chartab, sizeof(default_chartab)); } @@ -1267,8 +1267,8 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key) if (type != KT_LATIN || (ch_type & B_NUM) || ch < SPACE) return -1; if (ch == SPACE) { - synth_printf("%s\n", msg_get(MSG_EDIT_DONE)); - special_handler = NULL; + synth_printf("%s\n", spk_msg_get(MSG_EDIT_DONE)); + spk_special_handler = NULL; return 1; } if (mask < PUNC && !(ch_type & PUNC)) @@ -1276,8 +1276,8 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key) spk_chartab[ch] ^= mask; speak_char(ch); synth_printf(" %s\n", - (spk_chartab[ch] & mask) ? msg_get(MSG_ON) : - msg_get(MSG_OFF)); + (spk_chartab[ch] & mask) ? spk_msg_get(MSG_ON) : + spk_msg_get(MSG_OFF)); return 1; } @@ -1346,7 +1346,7 @@ static void read_all_doc(struct vc_data *vc) if (cursor_track != read_all_mode) prev_cursor_track = cursor_track; cursor_track = read_all_mode; - reset_index_count(0); + spk_reset_index_count(0); if (get_sentence_buf(vc, 0) == -1) kbd_fakekey2(vc, RA_DOWN_ARROW); else { @@ -1361,7 +1361,7 @@ static void stop_read_all(struct vc_data *vc) del_timer(&cursor_timer); cursor_track = prev_cursor_track; spk_shut_up &= 0xfe; - do_flush(); + spk_do_flush(); } static void start_read_all_timer(struct vc_data *vc, int command) @@ -1370,7 +1370,7 @@ static void start_read_all_timer(struct vc_data *vc, int command) cursor_con = vc->vc_num; read_all_key = command; - cursor_timeout = get_var(CURSOR_TIME); + cursor_timeout = spk_get_var(CURSOR_TIME); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); } @@ -1382,9 +1382,9 @@ static void handle_cursor_read_all(struct vc_data *vc, int command) switch (command) { case RA_NEXT_SENT: /* Get Current Sentence */ - get_index_count(&indcount, &sentcount); + spk_get_index_count(&indcount, &sentcount); /*printk("%d %d ", indcount, sentcount); */ - reset_index_count(sentcount + 1); + spk_reset_index_count(sentcount + 1); if (indcount == 1) { if (!say_sentence_num(sentcount + 1, 0)) { kbd_fakekey2(vc, RA_FIND_NEXT_SENT); @@ -1395,7 +1395,7 @@ static void handle_cursor_read_all(struct vc_data *vc, int command) sn = 0; if (!say_sentence_num(sentcount + 1, 1)) { sn = 1; - reset_index_count(sn); + spk_reset_index_count(sn); } else synth_insert_next_index(0); if (!say_sentence_num(sn, 0)) { @@ -1437,7 +1437,7 @@ static void handle_cursor_read_all(struct vc_data *vc, int command) case RA_FIND_PREV_SENT: break; case RA_TIMER: - get_index_count(&indcount, &sentcount); + spk_get_index_count(&indcount, &sentcount); if (indcount < 2) kbd_fakekey2(vc, RA_DOWN_ARROW); else @@ -1458,7 +1458,7 @@ static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag) } del_timer(&cursor_timer); spk_shut_up &= 0xfe; - do_flush(); + spk_do_flush(); start_read_all_timer(vc, value + 1); spk_unlock(flags); return NOTIFY_STOP; @@ -1479,8 +1479,8 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) return; } spk_shut_up &= 0xfe; - if (no_intr) - do_flush(); + if (spk_no_intr) + spk_do_flush(); /* the key press flushes if !no_inter but we want to flush on cursor * moves regardless of no_inter state */ is_cursor = value + 1; @@ -1491,7 +1491,7 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) cursor_con = vc->vc_num; if (cursor_track == CT_Highlight) reset_highlight_buffers(vc); - cursor_timeout = get_var(CURSOR_TIME); + cursor_timeout = spk_get_var(CURSOR_TIME); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); spk_unlock(flags); @@ -1603,7 +1603,7 @@ static int speak_highlight(struct vc_data *vc) if (speakup_console[vc_num]->ht.ry[hc] != vc->vc_y) return 0; spk_parked |= 0x01; - do_flush(); + spk_do_flush(); spkup_write(speakup_console[vc_num]->ht.highbuf[hc], speakup_console[vc_num]->ht.highsize[hc]); spk_pos = spk_cp = speakup_console[vc_num]->ht.rpos[hc]; @@ -1685,7 +1685,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) if (!spk_trylock(flags)) /* Speakup output, discard */ return; - if (bell_pos && spk_keydown && (vc->vc_x == bell_pos - 1)) + if (spk_bell_pos && spk_keydown && (vc->vc_x == spk_bell_pos - 1)) bleep(3); if ((is_cursor) || (cursor_track == read_all_mode)) { if (cursor_track == CT_Highlight) @@ -1726,19 +1726,19 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) return; spk_lock(flags); spk_shut_up &= 0xfe; - if (no_intr) - do_flush(); + if (spk_no_intr) + spk_do_flush(); switch (value) { case KVAL(K_CAPS): - label = msg_get(MSG_KEYNAME_CAPSLOCK); + label = spk_msg_get(MSG_KEYNAME_CAPSLOCK); on_off = vt_get_leds(fg_console, VC_CAPSLOCK); break; case KVAL(K_NUM): - label = msg_get(MSG_KEYNAME_NUMLOCK); + label = spk_msg_get(MSG_KEYNAME_NUMLOCK); on_off = vt_get_leds(fg_console, VC_NUMLOCK); break; case KVAL(K_HOLD): - label = msg_get(MSG_KEYNAME_SCROLLLOCK); + label = spk_msg_get(MSG_KEYNAME_SCROLLLOCK); on_off = vt_get_leds(fg_console, VC_SCROLLOCK); if (speakup_console[vc->vc_num]) speakup_console[vc->vc_num]->tty_stopped = on_off; @@ -1750,7 +1750,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) } if (on_off < 2) synth_printf("%s %s\n", - label, msg_get(MSG_STATUS_START + on_off)); + label, spk_msg_get(MSG_STATUS_START + on_off)); spk_unlock(flags); } @@ -1764,13 +1764,13 @@ static int inc_dec_var(u_char value) int var_id = (int)value - VAR_START; int how = (var_id & 1) ? E_INC : E_DEC; var_id = var_id / 2 + FIRST_SET_VAR; - p_header = get_var_header(var_id); + p_header = spk_get_var_header(var_id); if (p_header == NULL) return -1; if (p_header->var_type != VAR_NUM) return -1; var_data = p_header->data; - if (set_num_var(1, p_header, how) != 0) + if (spk_set_num_var(1, p_header, how) != 0) return -1; if (!spk_close_press) { for (pn = p_header->name; *pn; pn++) { @@ -1790,18 +1790,18 @@ static void speakup_win_set(struct vc_data *vc) { char info[40]; if (win_start > 1) { - synth_printf("%s\n", msg_get(MSG_WINDOW_ALREADY_SET)); + synth_printf("%s\n", spk_msg_get(MSG_WINDOW_ALREADY_SET)); return; } if (spk_x < win_left || spk_y < win_top) { - synth_printf("%s\n", msg_get(MSG_END_BEFORE_START)); + synth_printf("%s\n", spk_msg_get(MSG_END_BEFORE_START)); return; } if (win_start && spk_x == win_left && spk_y == win_top) { win_left = 0; win_right = vc->vc_cols - 1; win_bottom = spk_y; - snprintf(info, sizeof(info), msg_get(MSG_WINDOW_LINE), + snprintf(info, sizeof(info), spk_msg_get(MSG_WINDOW_LINE), (int)win_top + 1); } else { if (!win_start) { @@ -1811,8 +1811,8 @@ static void speakup_win_set(struct vc_data *vc) win_bottom = spk_y; win_right = spk_x; } - snprintf(info, sizeof(info), msg_get(MSG_WINDOW_BOUNDARY), - (win_start) ? msg_get(MSG_END) : msg_get(MSG_START), + snprintf(info, sizeof(info), spk_msg_get(MSG_WINDOW_BOUNDARY), + (win_start) ? spk_msg_get(MSG_END) : spk_msg_get(MSG_START), (int)spk_y + 1, (int)spk_x + 1); } synth_printf("%s\n", info); @@ -1824,32 +1824,32 @@ static void speakup_win_clear(struct vc_data *vc) win_top = win_bottom = 0; win_left = win_right = 0; win_start = 0; - synth_printf("%s\n", msg_get(MSG_WINDOW_CLEARED)); + synth_printf("%s\n", spk_msg_get(MSG_WINDOW_CLEARED)); } static void speakup_win_enable(struct vc_data *vc) { if (win_start < 2) { - synth_printf("%s\n", msg_get(MSG_NO_WINDOW)); + synth_printf("%s\n", spk_msg_get(MSG_NO_WINDOW)); return; } win_enabled ^= 1; if (win_enabled) - synth_printf("%s\n", msg_get(MSG_WINDOW_SILENCED)); + synth_printf("%s\n", spk_msg_get(MSG_WINDOW_SILENCED)); else - synth_printf("%s\n", msg_get(MSG_WINDOW_SILENCE_DISABLED)); + synth_printf("%s\n", spk_msg_get(MSG_WINDOW_SILENCE_DISABLED)); } static void speakup_bits(struct vc_data *vc) { int val = this_speakup_key - (FIRST_EDIT_BITS - 1); - if (special_handler != NULL || val < 1 || val > 6) { - synth_printf("%s\n", msg_get(MSG_ERROR)); + if (spk_special_handler != NULL || val < 1 || val > 6) { + synth_printf("%s\n", spk_msg_get(MSG_ERROR)); return; } - pb_edit = &punc_info[val]; - synth_printf(msg_get(MSG_EDIT_PROMPT), pb_edit->name); - special_handler = edit_bits; + pb_edit = &spk_punc_info[val]; + synth_printf(spk_msg_get(MSG_EDIT_PROMPT), pb_edit->name); + spk_special_handler = edit_bits; } static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) @@ -1887,9 +1887,9 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) if (ch < 'x' || ch > 'y') { oops: if (!spk_killed) - synth_printf(" %s\n", msg_get(MSG_GOTO_CANCELED)); + synth_printf(" %s\n", spk_msg_get(MSG_GOTO_CANCELED)); goto_buf[num = 0] = '\0'; - special_handler = NULL; + spk_special_handler = NULL; return 1; } cp = speakup_s2i(goto_buf, &go_pos); @@ -1917,7 +1917,7 @@ oops: } goto_buf[num = 0] = '\0'; do_goto: - special_handler = NULL; + spk_special_handler = NULL; spk_parked |= 0x01; if (goto_x) { spk_pos -= spk_x * 2; @@ -1934,18 +1934,18 @@ do_goto: static void speakup_goto(struct vc_data *vc) { - if (special_handler != NULL) { - synth_printf("%s\n", msg_get(MSG_ERROR)); + if (spk_special_handler != NULL) { + synth_printf("%s\n", spk_msg_get(MSG_ERROR)); return; } - synth_printf("%s\n", msg_get(MSG_GOTO)); - special_handler = handle_goto; + synth_printf("%s\n", spk_msg_get(MSG_GOTO)); + spk_special_handler = handle_goto; return; } static void speakup_help(struct vc_data *vc) { - handle_help(vc, KT_SPKUP, SPEAKUP_HELP, 0); + spk_handle_help(vc, KT_SPKUP, SPEAKUP_HELP, 0); } static void do_nothing(struct vc_data *vc) @@ -1992,7 +1992,7 @@ static void do_spkup(struct vc_data *vc, u_char value) spk_shut_up &= 0xfe; this_speakup_key = value; if (value < SPKUP_MAX_FUNC && spkup_handler[value]) { - do_flush(); + spk_do_flush(); (*spkup_handler[value]) (vc); } else { if (inc_dec_var(value) < 0) @@ -2032,7 +2032,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, } if (keycode >= MAX_KEY) goto no_map; - key_info = our_keys[keycode]; + key_info = spk_our_keys[keycode]; if (key_info == 0) goto no_map; /* Check valid read all mode keys */ @@ -2051,7 +2051,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, } } shift_info = (shift_state & 0x0f) + key_speakup; - offset = shift_table[shift_info]; + offset = spk_shift_table[shift_info]; if (offset) { new_key = key_info[offset]; if (new_key) { @@ -2062,7 +2062,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, if (up_flag || spk_killed) goto out; spk_shut_up &= 0xfe; - do_flush(); + spk_do_flush(); goto out; } if (up_flag) @@ -2070,7 +2070,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, if (last_keycode == keycode && last_spk_jiffy + MAX_DELAY > jiffies) { spk_close_press = 1; - offset = shift_table[shift_info + 32]; + offset = spk_shift_table[shift_info + 32]; /* double press? */ if (offset && key_info[offset]) new_key = key_info[offset]; @@ -2082,7 +2082,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, } } no_map: - if (type == KT_SPKUP && special_handler == NULL) { + if (type == KT_SPKUP && spk_special_handler == NULL) { do_spkup(vc, new_key); spk_close_press = 0; ret = 1; @@ -2096,9 +2096,9 @@ no_map: || (value == KVAL(K_LEFT)) || (value == KVAL(K_RIGHT)); if ((cursor_track != read_all_mode) || !kh) - if (!no_intr) - do_flush(); - if (special_handler) { + if (!spk_no_intr) + spk_do_flush(); + if (spk_special_handler) { if (type == KT_SPEC && value == 1) { value = '\n'; type = KT_LATIN; @@ -2106,7 +2106,7 @@ no_map: type = KT_LATIN; else if (value == 0x7f) value = 8; /* make del = backspace */ - ret = (*special_handler) (vc, type, value, keycode); + ret = (*spk_special_handler) (vc, type, value, keycode); spk_close_press = 0; if (ret < 0) bleep(9); @@ -2237,11 +2237,11 @@ static void __exit speakup_exit(void) speakup_unregister_var(i); for (i = 0; i < 256; i++) { - if (characters[i] != default_chars[i]) - kfree(characters[i]); + if (spk_characters[i] != spk_default_chars[i]) + kfree(spk_characters[i]); } - free_user_msgs(); + spk_free_user_msgs(); } /* call by: module_init() */ @@ -2254,20 +2254,20 @@ static int __init speakup_init(void) struct var_t *var; /* These first few initializations cannot fail. */ - initialize_msgs(); /* Initialize arrays for i18n. */ - reset_default_chars(); - reset_default_chartab(); - strlwr(synth_name); + spk_initialize_msgs(); /* Initialize arrays for i18n. */ + spk_reset_default_chars(); + spk_reset_default_chartab(); + spk_strlwr(synth_name); spk_vars[0].u.n.high = vc->vc_cols; for (var = spk_vars; var->var_id != MAXVARS; var++) speakup_register_var(var); for (var = synth_time_vars; (var->var_id >= 0) && (var->var_id < MAXVARS); var++) speakup_register_var(var); - for (i = 1; punc_info[i].mask != 0; i++) - set_mask_bits(0, i, 2); + for (i = 1; spk_punc_info[i].mask != 0; i++) + spk_set_mask_bits(0, i, 2); - set_key_info(key_defaults, key_buf); + spk_set_key_info(spk_key_defaults, spk_key_buf); /* From here on out, initializations can fail. */ err = speakup_add_virtual_keyboard(); @@ -2290,7 +2290,7 @@ static int __init speakup_init(void) goto error_kobjects; } - if (quiet_boot) + if (spk_quiet_boot) spk_shut_up |= 0x01; err = speakup_kobj_init(); @@ -2352,11 +2352,11 @@ error_virtkeyboard: speakup_unregister_var(i); for (i = 0; i < 256; i++) { - if (characters[i] != default_chars[i]) - kfree(characters[i]); + if (spk_characters[i] != spk_default_chars[i]) + kfree(spk_characters[i]); } - free_user_msgs(); + spk_free_user_msgs(); out: return err; diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c index 0612df06a4bf..d6558faea3e0 100644 --- a/drivers/staging/speakup/selection.c +++ b/drivers/staging/speakup/selection.c @@ -10,7 +10,7 @@ /* Don't take this from <ctype.h>: 011-015 on the screen aren't spaces */ #define ishardspace(c) ((c) == ' ') -unsigned short xs, ys, xe, ye; /* our region points */ +unsigned short spk_xs, spk_ys, spk_xe, spk_ye; /* our region points */ /* Variables for selection control. */ /* must not be disallocated */ @@ -51,12 +51,12 @@ int speakup_set_selection(struct tty_struct *tty) int i, ps, pe; struct vc_data *vc = vc_cons[fg_console].d; - xs = limit(xs, vc->vc_cols - 1); - ys = limit(ys, vc->vc_rows - 1); - xe = limit(xe, vc->vc_cols - 1); - ye = limit(ye, vc->vc_rows - 1); - ps = ys * vc->vc_size_row + (xs << 1); - pe = ye * vc->vc_size_row + (xe << 1); + spk_xs = limit(spk_xs, vc->vc_cols - 1); + spk_ys = limit(spk_ys, vc->vc_rows - 1); + spk_xe = limit(spk_xe, vc->vc_cols - 1); + spk_ye = limit(spk_ye, vc->vc_rows - 1); + ps = spk_ys * vc->vc_size_row + (spk_xs << 1); + pe = spk_ye * vc->vc_size_row + (spk_xe << 1); if (ps > pe) { /* make sel_start <= sel_end */ diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index a97d3d5b58a4..e4d27aa2898f 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -116,7 +116,7 @@ static void start_serial_interrupt(int irq) outb(1, speakup_info.port_tts + UART_FCR); /* Turn FIFO On */ } -void stop_serial_interrupt(void) +void spk_stop_serial_interrupt(void) { if (speakup_info.port_tts == 0) return; @@ -130,7 +130,7 @@ void stop_serial_interrupt(void) free_irq(serstate->irq, (void *) synth_readbuf_handler); } -int wait_for_xmitr(void) +int spk_wait_for_xmitr(void) { int tmout = SPK_XMITR_TIMEOUT; if ((synth->alive) && (timeouts >= NUM_DISABLE_TIMEOUTS)) { @@ -195,7 +195,7 @@ EXPORT_SYMBOL_GPL(spk_serial_in_nowait); int spk_serial_out(const char ch) { - if (synth->alive && wait_for_xmitr()) { + if (synth->alive && spk_wait_for_xmitr()) { outb_p(ch, speakup_info.port_tts); return 1; } diff --git a/drivers/staging/speakup/speakup.h b/drivers/staging/speakup/speakup.h index e66579e6147a..22f0fbb85f42 100644 --- a/drivers/staging/speakup/speakup.h +++ b/drivers/staging/speakup/speakup.h @@ -50,34 +50,34 @@ #define E_UNDEF -1 extern int speakup_thread(void *data); -extern void reset_default_chars(void); -extern void reset_default_chartab(void); +extern void spk_reset_default_chars(void); +extern void spk_reset_default_chartab(void); extern void synth_start(void); void synth_insert_next_index(int sent_num); -void reset_index_count(int sc); -void get_index_count(int *linecount, int *sentcount); -extern int set_key_info(const u_char *key_info, u_char *k_buffer); -extern char *strlwr(char *s); +void spk_reset_index_count(int sc); +void spk_get_index_count(int *linecount, int *sentcount); +extern int spk_set_key_info(const u_char *key_info, u_char *k_buffer); +extern char *spk_strlwr(char *s); extern char *speakup_s2i(char *start, int *dest); -extern char *s2uchar(char *start, char *dest); -extern char *xlate(char *s); +extern char *spk_s2uchar(char *start, char *dest); +extern char *spk_xlate(char *s); extern int speakup_kobj_init(void); extern void speakup_kobj_exit(void); -extern int chartab_get_value(char *keyword); +extern int spk_chartab_get_value(char *keyword); extern void speakup_register_var(struct var_t *var); extern void speakup_unregister_var(enum var_id_t var_id); -extern struct st_var_header *get_var_header(enum var_id_t var_id); -extern struct st_var_header *var_header_by_name(const char *name); -extern struct punc_var_t *get_punc_var(enum var_id_t var_id); -extern int set_num_var(int val, struct st_var_header *var, int how); -extern int set_string_var(const char *page, struct st_var_header *var, int len); -extern int set_mask_bits(const char *input, const int which, const int how); -extern special_func special_handler; -extern int handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key); +extern struct st_var_header *spk_get_var_header(enum var_id_t var_id); +extern struct st_var_header *spk_var_header_by_name(const char *name); +extern struct punc_var_t *spk_get_punc_var(enum var_id_t var_id); +extern int spk_set_num_var(int val, struct st_var_header *var, int how); +extern int spk_set_string_var(const char *page, struct st_var_header *var, int len); +extern int spk_set_mask_bits(const char *input, const int which, const int how); +extern special_func spk_special_handler; +extern int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key); extern int synth_init(char *name); extern void synth_release(void); -extern void do_flush(void); +extern void spk_do_flush(void); extern void speakup_start_ttys(void); extern void synth_buffer_add(char ch); extern void synth_buffer_clear(void); @@ -90,35 +90,35 @@ extern void synth_write(const char *buf, size_t count); extern int synth_supports_indexing(void); extern struct vc_data *spk_sel_cons; -extern unsigned short xs, ys, xe, ye; /* our region points */ +extern unsigned short spk_xs, spk_ys, spk_xe, spk_ye; /* our region points */ extern wait_queue_head_t speakup_event; extern struct kobject *speakup_kobj; extern struct task_struct *speakup_task; -extern const u_char key_defaults[]; +extern const u_char spk_key_defaults[]; /* Protect speakup synthesizer list */ extern struct mutex spk_mutex; extern struct st_spk_t *speakup_console[]; extern struct spk_synth *synth; -extern char pitch_buff[]; -extern u_char *our_keys[]; -extern short punc_masks[]; -extern char str_caps_start[], str_caps_stop[]; -extern const struct st_bits_data punc_info[]; -extern u_char key_buf[600]; -extern char *characters[]; -extern char *default_chars[]; +extern char spk_pitch_buff[]; +extern u_char *spk_our_keys[]; +extern short spk_punc_masks[]; +extern char spk_str_caps_start[], spk_str_caps_stop[]; +extern const struct st_bits_data spk_punc_info[]; +extern u_char spk_key_buf[600]; +extern char *spk_characters[]; +extern char *spk_default_chars[]; extern u_short spk_chartab[]; -extern int no_intr, say_ctrl, say_word_ctl, punc_level; -extern int reading_punc, attrib_bleep, bleeps; -extern int bleep_time, bell_pos; -extern int spell_delay, key_echo; -extern short punc_mask; -extern short pitch_shift, synth_flags; -extern bool quiet_boot; +extern int spk_no_intr, spk_say_ctrl, spk_say_word_ctl, spk_punc_level; +extern int spk_reading_punc, spk_attrib_bleep, spk_bleeps; +extern int spk_bleep_time, spk_bell_pos; +extern int spk_spell_delay, spk_key_echo; +extern short spk_punc_mask; +extern short spk_pitch_shift, synth_flags; +extern bool spk_quiet_boot; extern char *synth_name; -extern struct bleep unprocessed_sound; +extern struct bleep spk_unprocessed_sound; /* Prototypes from fakekey.c. */ int speakup_add_virtual_keyboard(void); diff --git a/drivers/staging/speakup/speakup_acntpc.c b/drivers/staging/speakup/speakup_acntpc.c index bbe28b6809e0..1c1f0d560449 100644 --- a/drivers/staging/speakup/speakup_acntpc.c +++ b/drivers/staging/speakup/speakup_acntpc.c @@ -182,9 +182,9 @@ static void do_catch_up(struct spk_synth *synth) struct var_t *full_time; struct var_t *jiffy_delta; - jiffy_delta = get_var(JIFFY); - delay_time = get_var(DELAY); - full_time = get_var(FULL); + jiffy_delta = spk_get_var(JIFFY); + delay_time = spk_get_var(DELAY); + full_time = spk_get_var(FULL); spk_lock(flags); jiffy_delta_val = jiffy_delta->u.n.value; diff --git a/drivers/staging/speakup/speakup_acntsa.c b/drivers/staging/speakup/speakup_acntsa.c index 590fa6bb0ed4..22a8b7291098 100644 --- a/drivers/staging/speakup/speakup_acntsa.c +++ b/drivers/staging/speakup/speakup_acntsa.c @@ -128,7 +128,7 @@ static int synth_probe(struct spk_synth *synth) { int failed; - failed = serial_synth_probe(synth); + failed = spk_serial_synth_probe(synth); if (failed == 0) { spk_synth_immediate(synth, "\033=R\r"); mdelay(100); diff --git a/drivers/staging/speakup/speakup_apollo.c b/drivers/staging/speakup/speakup_apollo.c index 00d5cedd00ab..3e450ccbda66 100644 --- a/drivers/staging/speakup/speakup_apollo.c +++ b/drivers/staging/speakup/speakup_apollo.c @@ -112,7 +112,7 @@ static struct spk_synth synth_apollo = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .probe = serial_synth_probe, + .probe = spk_serial_synth_probe, .release = spk_serial_release, .synth_immediate = spk_synth_immediate, .catch_up = do_catch_up, @@ -145,9 +145,9 @@ static void do_catch_up(struct spk_synth *synth) int delay_time_val = 0; int jiffy_delta_val = 0; - jiffy_delta = get_var(JIFFY); - delay_time = get_var(DELAY); - full_time = get_var(FULL); + jiffy_delta = spk_get_var(JIFFY); + delay_time = spk_get_var(DELAY); + full_time = spk_get_var(FULL); spk_lock(flags); jiffy_delta_val = jiffy_delta->u.n.value; spk_unlock(flags); diff --git a/drivers/staging/speakup/speakup_audptr.c b/drivers/staging/speakup/speakup_audptr.c index 94e509992c8b..3508aee98ab0 100644 --- a/drivers/staging/speakup/speakup_audptr.c +++ b/drivers/staging/speakup/speakup_audptr.c @@ -162,7 +162,7 @@ static int synth_probe(struct spk_synth *synth) { int failed = 0; - failed = serial_synth_probe(synth); + failed = spk_serial_synth_probe(synth); if (failed == 0) synth_version(synth); synth->alive = !failed; diff --git a/drivers/staging/speakup/speakup_bns.c b/drivers/staging/speakup/speakup_bns.c index 43e5b54f344c..4bfe3d458dc0 100644 --- a/drivers/staging/speakup/speakup_bns.c +++ b/drivers/staging/speakup/speakup_bns.c @@ -100,7 +100,7 @@ static struct spk_synth synth_bns = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .probe = serial_synth_probe, + .probe = spk_serial_synth_probe, .release = spk_serial_release, .synth_immediate = spk_synth_immediate, .catch_up = spk_do_catch_up, diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index b4ef9153f42e..d39a0de286fb 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -130,7 +130,7 @@ static struct spk_synth synth_decext = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .probe = serial_synth_probe, + .probe = spk_serial_synth_probe, .release = spk_serial_release, .synth_immediate = spk_synth_immediate, .catch_up = do_catch_up, @@ -162,8 +162,8 @@ static void do_catch_up(struct spk_synth *synth) int jiffy_delta_val = 0; int delay_time_val = 0; - jiffy_delta = get_var(JIFFY); - delay_time = get_var(DELAY); + jiffy_delta = spk_get_var(JIFFY); + delay_time = spk_get_var(DELAY); spk_lock(flags); jiffy_delta_val = jiffy_delta->u.n.value; diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c index a09a0c9975df..6c88b55bdac8 100644 --- a/drivers/staging/speakup/speakup_decpc.c +++ b/drivers/staging/speakup/speakup_decpc.c @@ -375,8 +375,8 @@ static void do_catch_up(struct spk_synth *synth) int jiffy_delta_val; int delay_time_val; - jiffy_delta = get_var(JIFFY); - delay_time = get_var(DELAY); + jiffy_delta = spk_get_var(JIFFY); + delay_time = spk_get_var(DELAY); spk_lock(flags); jiffy_delta_val = jiffy_delta->u.n.value; spk_unlock(flags); diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c index daff3b9a4a6d..0dd2eb96cb28 100644 --- a/drivers/staging/speakup/speakup_dectlk.c +++ b/drivers/staging/speakup/speakup_dectlk.c @@ -134,7 +134,7 @@ static struct spk_synth synth_dectlk = { .vars = vars, .default_pitch = ap_defaults, .default_vol = g5_defaults, - .probe = serial_synth_probe, + .probe = spk_serial_synth_probe, .release = spk_serial_release, .synth_immediate = spk_synth_immediate, .catch_up = do_catch_up, @@ -214,8 +214,8 @@ static void do_catch_up(struct spk_synth *synth) int jiffy_delta_val; int delay_time_val; - jiffy_delta = get_var(JIFFY); - delay_time = get_var(DELAY); + jiffy_delta = spk_get_var(JIFFY); + delay_time = spk_get_var(DELAY); spk_lock(flags); jiffy_delta_val = jiffy_delta->u.n.value; spk_unlock(flags); diff --git a/drivers/staging/speakup/speakup_dtlk.c b/drivers/staging/speakup/speakup_dtlk.c index 97bc476746cd..a9cefbd3ea93 100644 --- a/drivers/staging/speakup/speakup_dtlk.c +++ b/drivers/staging/speakup/speakup_dtlk.c @@ -198,8 +198,8 @@ static void do_catch_up(struct spk_synth *synth) int jiffy_delta_val; int delay_time_val; - jiffy_delta = get_var(JIFFY); - delay_time = get_var(DELAY); + jiffy_delta = spk_get_var(JIFFY); + delay_time = spk_get_var(DELAY); spk_lock(flags); jiffy_delta_val = jiffy_delta->u.n.value; spk_unlock(flags); diff --git a/drivers/staging/speakup/speakup_dummy.c b/drivers/staging/speakup/speakup_dummy.c index c20f41188be1..4a24b9c1e8e3 100644 --- a/drivers/staging/speakup/speakup_dummy.c +++ b/drivers/staging/speakup/speakup_dummy.c @@ -102,7 +102,7 @@ static struct spk_synth synth_dummy = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .probe = serial_synth_probe, + .probe = spk_serial_synth_probe, .release = spk_serial_release, .synth_immediate = spk_synth_immediate, .catch_up = spk_do_catch_up, diff --git a/drivers/staging/speakup/speakup_keypc.c b/drivers/staging/speakup/speakup_keypc.c index 496e01481f9e..feb5f22cc169 100644 --- a/drivers/staging/speakup/speakup_keypc.c +++ b/drivers/staging/speakup/speakup_keypc.c @@ -184,9 +184,9 @@ static void do_catch_up(struct spk_synth *synth) int full_time_val; int jiffy_delta_val; - jiffy_delta = get_var(JIFFY); - delay_time = get_var(DELAY); - full_time = get_var(FULL); + jiffy_delta = spk_get_var(JIFFY); + delay_time = spk_get_var(DELAY); + full_time = spk_get_var(FULL); spk_lock(flags); jiffy_delta_val = jiffy_delta->u.n.value; spk_unlock(flags); diff --git a/drivers/staging/speakup/speakup_ltlk.c b/drivers/staging/speakup/speakup_ltlk.c index 971de1a13712..326f94d6b079 100644 --- a/drivers/staging/speakup/speakup_ltlk.c +++ b/drivers/staging/speakup/speakup_ltlk.c @@ -161,7 +161,7 @@ static int synth_probe(struct spk_synth *synth) { int failed = 0; - failed = serial_synth_probe(synth); + failed = spk_serial_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 9a3a80d9701e..e74f85620c68 100644 --- a/drivers/staging/speakup/speakup_spkout.c +++ b/drivers/staging/speakup/speakup_spkout.c @@ -107,7 +107,7 @@ static struct spk_synth synth_spkout = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .probe = serial_synth_probe, + .probe = spk_serial_synth_probe, .release = spk_serial_release, .synth_immediate = spk_synth_immediate, .catch_up = spk_do_catch_up, diff --git a/drivers/staging/speakup/speakup_txprt.c b/drivers/staging/speakup/speakup_txprt.c index 5d5bf7c3d0b1..5a29b9fcc930 100644 --- a/drivers/staging/speakup/speakup_txprt.c +++ b/drivers/staging/speakup/speakup_txprt.c @@ -100,7 +100,7 @@ static struct spk_synth synth_txprt = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .probe = serial_synth_probe, + .probe = spk_serial_synth_probe, .release = spk_serial_release, .synth_immediate = spk_synth_immediate, .catch_up = spk_do_catch_up, diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h index a47c5b78d57d..303105b46013 100644 --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -45,8 +45,8 @@ #define KT_SPKUP 15 extern const struct old_serial_port *spk_serial_init(int index); -extern void stop_serial_interrupt(void); -extern int wait_for_xmitr(void); +extern void spk_stop_serial_interrupt(void); +extern int spk_wait_for_xmitr(void); extern unsigned char spk_serial_in(void); extern unsigned char spk_serial_in_nowait(void); extern int spk_serial_out(const char ch); @@ -55,13 +55,13 @@ extern void spk_serial_release(void); extern char synth_buffer_getc(void); extern char synth_buffer_peek(void); extern int synth_buffer_empty(void); -extern struct var_t *get_var(enum var_id_t var_id); +extern struct var_t *spk_get_var(enum var_id_t var_id); extern ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf); extern ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count); -extern int serial_synth_probe(struct spk_synth *synth); +extern int spk_serial_synth_probe(struct spk_synth *synth); extern const char *spk_synth_immediate(struct spk_synth *synth, const char *buff); extern void spk_do_catch_up(struct spk_synth *synth); extern void spk_synth_flush(struct spk_synth *synth); diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index 7616f058a00b..d867dd9109ed 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -20,9 +20,9 @@ #define MAXSYNTHS 16 /* Max number of synths in array. */ static struct spk_synth *synths[MAXSYNTHS]; struct spk_synth *synth; -char pitch_buff[32] = ""; +char spk_pitch_buff[32] = ""; static int module_status; -bool quiet_boot; +bool spk_quiet_boot; struct speakup_info_t speakup_info = { .spinlock = __SPIN_LOCK_UNLOCKED(speakup_info.spinlock), @@ -32,7 +32,7 @@ EXPORT_SYMBOL_GPL(speakup_info); static int do_synth_init(struct spk_synth *in_synth); -int serial_synth_probe(struct spk_synth *synth) +int spk_serial_synth_probe(struct spk_synth *synth) { const struct old_serial_port *ser; int failed = 0; @@ -59,7 +59,7 @@ int serial_synth_probe(struct spk_synth *synth) synth->alive = 1; return 0; } -EXPORT_SYMBOL_GPL(serial_synth_probe); +EXPORT_SYMBOL_GPL(spk_serial_synth_probe); /* Main loop of the progression thread: keep eating from the buffer * and push to the serial port, waiting as needed @@ -79,9 +79,9 @@ void spk_do_catch_up(struct spk_synth *synth) int delay_time_val; int full_time_val; - jiffy_delta = get_var(JIFFY); - full_time = get_var(FULL); - delay_time = get_var(DELAY); + jiffy_delta = spk_get_var(JIFFY); + full_time = spk_get_var(FULL); + delay_time = spk_get_var(DELAY); spk_lock(flags); jiffy_delta_val = jiffy_delta->u.n.value; @@ -139,7 +139,7 @@ const char *spk_synth_immediate(struct spk_synth *synth, const char *buff) while ((ch = *buff)) { if (ch == '\n') ch = synth->procspeech; - if (wait_for_xmitr()) + if (spk_wait_for_xmitr()) outb(ch, speakup_info.port_tts); else return buff; @@ -166,7 +166,7 @@ int spk_synth_is_alive_restart(struct spk_synth *synth) { if (synth->alive) return 1; - if (!synth->alive && wait_for_xmitr() > 0) { + if (!synth->alive && spk_wait_for_xmitr() > 0) { /* restart */ synth->alive = 1; synth_printf("%s", synth->init); @@ -192,20 +192,20 @@ void synth_start(void) synth_buffer_clear(); return; } - trigger_time = get_var(TRIGGER); + trigger_time = spk_get_var(TRIGGER); if (!timer_pending(&thread_timer)) mod_timer(&thread_timer, jiffies + msecs_to_jiffies(trigger_time->u.n.value)); } -void do_flush(void) +void spk_do_flush(void) { speakup_info.flushing = 1; synth_buffer_clear(); if (synth->alive) { - if (pitch_shift) { - synth_printf("%s", pitch_buff); - pitch_shift = 0; + if (spk_pitch_shift) { + synth_printf("%s", spk_pitch_buff); + spk_pitch_shift = 0; } } wake_up_interruptible_all(&speakup_event); @@ -241,7 +241,7 @@ EXPORT_SYMBOL_GPL(synth_printf); static int index_count; static int sentence_count; -void reset_index_count(int sc) +void spk_reset_index_count(int sc) { static int first = 1; if (first) @@ -277,7 +277,7 @@ void synth_insert_next_index(int sent_num) } } -void get_index_count(int *linecount, int *sentcount) +void spk_get_index_count(int *linecount, int *sentcount) { int ind = synth->get_index(); if (ind) { @@ -384,7 +384,7 @@ static int do_synth_init(struct spk_synth *in_synth) for (var = synth->vars; (var->var_id >= 0) && (var->var_id < MAXVARS); var++) speakup_register_var(var); - if (!quiet_boot) + if (!spk_quiet_boot) synth_printf("%s found\n", synth->long_name); if (synth->attributes.name && sysfs_create_group(speakup_kobj, &(synth->attributes)) < 0) @@ -412,7 +412,7 @@ void synth_release(void) sysfs_remove_group(speakup_kobj, &(synth->attributes)); for (var = synth->vars; var->var_id != MAXVARS; var++) speakup_unregister_var(var->var_id); - stop_serial_interrupt(); + spk_stop_serial_interrupt(); synth->release(); synth = NULL; } @@ -460,4 +460,4 @@ void synth_remove(struct spk_synth *in_synth) } EXPORT_SYMBOL_GPL(synth_remove); -short punc_masks[] = { 0, SOME, MOST, PUNC, PUNC|B_SYM }; +short spk_punc_masks[] = { 0, SOME, MOST, PUNC, PUNC|B_SYM }; diff --git a/drivers/staging/speakup/thread.c b/drivers/staging/speakup/thread.c index 103c5c81ee85..42fa660a7e0d 100644 --- a/drivers/staging/speakup/thread.c +++ b/drivers/staging/speakup/thread.c @@ -23,8 +23,8 @@ int speakup_thread(void *data) DEFINE_WAIT(wait); while (1) { spk_lock(flags); - our_sound = unprocessed_sound; - unprocessed_sound.active = 0; + our_sound = spk_unprocessed_sound; + spk_unprocessed_sound.active = 0; prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE); should_break = kthread_should_stop() || diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index ab7de9389dd6..f8c1e457d389 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c @@ -16,24 +16,24 @@ static struct st_var_header var_headers[] = { { "ex_num", EXNUMBER, VAR_PROC, NULL, NULL }, { "characters", CHARS, VAR_PROC, NULL, NULL }, { "synth_direct", SYNTH_DIRECT, VAR_PROC, NULL, NULL }, - { "caps_start", CAPS_START, VAR_STRING, str_caps_start, NULL }, - { "caps_stop", CAPS_STOP, VAR_STRING, str_caps_stop, NULL }, + { "caps_start", CAPS_START, VAR_STRING, spk_str_caps_start, NULL }, + { "caps_stop", CAPS_STOP, VAR_STRING, spk_str_caps_stop, NULL }, { "delay_time", DELAY, VAR_TIME, NULL, NULL }, { "trigger_time", TRIGGER, VAR_TIME, NULL, NULL }, { "jiffy_delta", JIFFY, VAR_TIME, NULL, NULL }, { "full_time", FULL, VAR_TIME, NULL, NULL }, - { "spell_delay", SPELL_DELAY, VAR_NUM, &spell_delay, NULL }, - { "bleeps", BLEEPS, VAR_NUM, &bleeps, NULL }, - { "attrib_bleep", ATTRIB_BLEEP, VAR_NUM, &attrib_bleep, NULL }, - { "bleep_time", BLEEP_TIME, VAR_TIME, &bleep_time, NULL }, + { "spell_delay", SPELL_DELAY, VAR_NUM, &spk_spell_delay, NULL }, + { "bleeps", BLEEPS, VAR_NUM, &spk_bleeps, NULL }, + { "attrib_bleep", ATTRIB_BLEEP, VAR_NUM, &spk_attrib_bleep, NULL }, + { "bleep_time", BLEEP_TIME, VAR_TIME, &spk_bleep_time, NULL }, { "cursor_time", CURSOR_TIME, VAR_TIME, NULL, NULL }, - { "punc_level", PUNC_LEVEL, VAR_NUM, &punc_level, NULL }, - { "reading_punc", READING_PUNC, VAR_NUM, &reading_punc, NULL }, - { "say_control", SAY_CONTROL, VAR_NUM, &say_ctrl, NULL }, - { "say_word_ctl", SAY_WORD_CTL, VAR_NUM, &say_word_ctl, NULL }, - { "no_interrupt", NO_INTERRUPT, VAR_NUM, &no_intr, NULL }, - { "key_echo", KEY_ECHO, VAR_NUM, &key_echo, NULL }, - { "bell_pos", BELL_POS, VAR_NUM, &bell_pos, NULL }, + { "punc_level", PUNC_LEVEL, VAR_NUM, &spk_punc_level, NULL }, + { "reading_punc", READING_PUNC, VAR_NUM, &spk_reading_punc, NULL }, + { "say_control", SAY_CONTROL, VAR_NUM, &spk_say_ctrl, NULL }, + { "say_word_ctl", SAY_WORD_CTL, VAR_NUM, &spk_say_word_ctl, NULL }, + { "no_interrupt", NO_INTERRUPT, VAR_NUM, &spk_no_intr, NULL }, + { "key_echo", KEY_ECHO, VAR_NUM, &spk_key_echo, NULL }, + { "bell_pos", BELL_POS, VAR_NUM, &spk_bell_pos, NULL }, { "rate", RATE, VAR_NUM, NULL, NULL }, { "pitch", PITCH, VAR_NUM, NULL, NULL }, { "vol", VOL, VAR_NUM, NULL, NULL }, @@ -58,7 +58,7 @@ static struct punc_var_t punc_vars[] = { { -1, -1 }, }; -int chartab_get_value(char *keyword) +int spk_chartab_get_value(char *keyword) { int value = 0; @@ -103,11 +103,11 @@ void speakup_register_var(struct var_t *var) p_header->data = var; switch (p_header->var_type) { case VAR_STRING: - set_string_var(nothing, p_header, 0); + spk_set_string_var(nothing, p_header, 0); break; case VAR_NUM: case VAR_TIME: - set_num_var(0, p_header, E_DEFAULT); + spk_set_num_var(0, p_header, E_DEFAULT); break; default: break; @@ -123,7 +123,7 @@ void speakup_unregister_var(enum var_id_t var_id) p_header->data = NULL; } -struct st_var_header *get_var_header(enum var_id_t var_id) +struct st_var_header *spk_get_var_header(enum var_id_t var_id) { struct st_var_header *p_header; if (var_id < 0 || var_id >= MAXVARS) @@ -134,7 +134,7 @@ struct st_var_header *get_var_header(enum var_id_t var_id) return p_header; } -struct st_var_header *var_header_by_name(const char *name) +struct st_var_header *spk_var_header_by_name(const char *name) { int i; struct st_var_header *where = NULL; @@ -151,15 +151,15 @@ struct st_var_header *var_header_by_name(const char *name) return where; } -struct var_t *get_var(enum var_id_t var_id) +struct var_t *spk_get_var(enum var_id_t var_id) { BUG_ON(var_id < 0 || var_id >= MAXVARS); BUG_ON(!var_ptrs[var_id]); return var_ptrs[var_id]->data; } -EXPORT_SYMBOL_GPL(get_var); +EXPORT_SYMBOL_GPL(spk_get_var); -struct punc_var_t *get_punc_var(enum var_id_t var_id) +struct punc_var_t *spk_get_punc_var(enum var_id_t var_id) { struct punc_var_t *rv = NULL; struct punc_var_t *where; @@ -175,7 +175,7 @@ struct punc_var_t *get_punc_var(enum var_id_t var_id) } /* handlers for setting vars */ -int set_num_var(int input, struct st_var_header *var, int how) +int spk_set_num_var(int input, struct st_var_header *var, int how) { int val; short ret = 0; @@ -217,7 +217,7 @@ int set_num_var(int input, struct st_var_header *var, int how) if (p_val != NULL) *p_val = val; if (var->var_id == PUNC_LEVEL) { - punc_mask = punc_masks[val]; + spk_punc_mask = spk_punc_masks[val]; return ret; } if (var_data->u.n.multiplier != 0) @@ -232,7 +232,7 @@ int set_num_var(int input, struct st_var_header *var, int how) if (!var_data->u.n.synth_fmt) return ret; if (var->var_id == PITCH) - cp = pitch_buff; + cp = spk_pitch_buff; else cp = buf; if (!var_data->u.n.out_str) @@ -244,7 +244,7 @@ int set_num_var(int input, struct st_var_header *var, int how) return ret; } -int set_string_var(const char *page, struct st_var_header *var, int len) +int spk_set_string_var(const char *page, struct st_var_header *var, int len) { int ret = 0; struct var_t *var_data = var->data; @@ -267,21 +267,21 @@ int set_string_var(const char *page, struct st_var_header *var, int len) return ret; } -/* set_mask_bits sets or clears the punc/delim/repeat bits, +/* spk_set_mask_bits sets or clears the punc/delim/repeat bits, * if input is null uses the defaults. * values for how: 0 clears bits of chars supplied, * 1 clears allk, 2 sets bits for chars */ -int set_mask_bits(const char *input, const int which, const int how) +int spk_set_mask_bits(const char *input, const int which, const int how) { u_char *cp; - short mask = punc_info[which].mask; + short mask = spk_punc_info[which].mask; if (how&1) { - for (cp = (u_char *)punc_info[3].value; *cp; cp++) + for (cp = (u_char *)spk_punc_info[3].value; *cp; cp++) spk_chartab[*cp] &= ~mask; } cp = (u_char *)input; if (cp == 0) - cp = punc_info[which].value; + cp = spk_punc_info[which].value; else { for ( ; *cp; cp++) { if (*cp < SPACE) @@ -308,7 +308,7 @@ int set_mask_bits(const char *input, const int which, const int how) return 0; } -char *strlwr(char *s) +char *spk_strlwr(char *s) { char *p; if (s == NULL) @@ -341,7 +341,7 @@ char *speakup_s2i(char *start, int *dest) return start; } -char *s2uchar(char *start, char *dest) +char *spk_s2uchar(char *start, char *dest) { int val = 0; while (*start && *start <= SPACE) @@ -357,7 +357,7 @@ char *s2uchar(char *start, char *dest) return start; } -char *xlate(char *s) +char *spk_xlate(char *s) { static const char finds[] = "nrtvafe"; static const char subs[] = "\n\r\t\013\001\014\033"; diff --git a/drivers/staging/usbip/Kconfig b/drivers/staging/usbip/Kconfig index 199b1d4c0b85..886000980474 100644 --- a/drivers/staging/usbip/Kconfig +++ b/drivers/staging/usbip/Kconfig @@ -8,7 +8,7 @@ config USBIP_CORE USB/IP core that is required by both drivers. For more details, and to get the userspace utility - programs, please see http://usbip.sourceforge.net/. + programs, please see <http://usbip.sourceforge.net/>. To compile this as a module, choose M here: the module will be called usbip-core. diff --git a/drivers/staging/usbip/userspace/.gitignore b/drivers/staging/usbip/userspace/.gitignore new file mode 100644 index 000000000000..9aad9e30a8ba --- /dev/null +++ b/drivers/staging/usbip/userspace/.gitignore @@ -0,0 +1,28 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +config.guess +config.h +config.h.in +config.log +config.status +config.sub +configure +depcomp +install-sh +libsrc/Makefile +libsrc/Makefile.in +libtool +ltmain.sh +missing +src/Makefile +src/Makefile.in +stamp-h1 +libsrc/libusbip.la +libsrc/libusbip_la-names.lo +libsrc/libusbip_la-usbip_common.lo +libsrc/libusbip_la-usbip_host_driver.lo +libsrc/libusbip_la-vhci_driver.lo +src/usbip +src/usbipd diff --git a/drivers/staging/usbip/userspace/Makefile.am b/drivers/staging/usbip/userspace/Makefile.am index 9ab19499fe00..66f8bf038c9f 100644 --- a/drivers/staging/usbip/userspace/Makefile.am +++ b/drivers/staging/usbip/userspace/Makefile.am @@ -3,4 +3,4 @@ includedir = @includedir@/usbip include_HEADERS := $(addprefix libsrc/, \ usbip_common.h vhci_driver.h usbip_host_driver.h) -dist_man_MANS := $(addprefix doc/, usbip.8 usbipd.8 usbip_bind_driver.8) +dist_man_MANS := $(addprefix doc/, usbip.8 usbipd.8) diff --git a/drivers/staging/usbip/userspace/README b/drivers/staging/usbip/userspace/README index 63cd10719059..233d1d7aef92 100644 --- a/drivers/staging/usbip/userspace/README +++ b/drivers/staging/usbip/userspace/README @@ -17,8 +17,6 @@ - gcc >= 4.0 - - libglib2.0-dev >= 2.6.0 - - libtool, automake >= 1.9, autoconf >= 2.5.0, pkg-config diff --git a/drivers/staging/usbip/userspace/configure.ac b/drivers/staging/usbip/userspace/configure.ac index 43e641e5ac06..2be4060f9036 100644 --- a/drivers/staging/usbip/userspace/configure.ac +++ b/drivers/staging/usbip/userspace/configure.ac @@ -91,10 +91,22 @@ AC_ARG_WITH([usbids-dir], [USBIDS_DIR=$withval], [USBIDS_DIR="/usr/share/hwdata/"]) AC_SUBST([USBIDS_DIR]) -GLIB2_REQUIRED=2.6.0 -PKG_CHECK_MODULES([PACKAGE], [glib-2.0 >= $GLIB2_REQUIRED]) -AC_SUBST([PACKAGE_CFLAGS]) -AC_SUBST([PACKAGE_LIBS]) +# use _FORTIFY_SOURCE +AC_MSG_CHECKING([whether to use fortify]) +AC_ARG_WITH([fortify], + [AS_HELP_STRING([--with-fortify], + [use _FORTIFY_SROUCE option when compiling)])], + dnl [ACTION-IF-GIVEN] + [if test "$withval" = "yes"; then + AC_MSG_RESULT([yes]) + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE -O" + else + AC_MSG_RESULT([no]) + CFLAGS="$CFLAGS -U_FORTIFY_SOURCE" + fi + ], + dnl [ACTION-IF-NOT-GIVEN] + [AC_MSG_RESULT([default])]) AC_CONFIG_FILES([Makefile libsrc/Makefile src/Makefile]) AC_OUTPUT diff --git a/drivers/staging/usbip/userspace/src/Makefile.am b/drivers/staging/usbip/userspace/src/Makefile.am index c365a3fada90..a11300361392 100644 --- a/drivers/staging/usbip/userspace/src/Makefile.am +++ b/drivers/staging/usbip/userspace/src/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/libsrc -DUSBIDS_FILE='"@USBIDS_DIR@/usb.ids"' -AM_CFLAGS = @EXTRA_CFLAGS@ @PACKAGE_CFLAGS@ -LDADD = $(top_builddir)/libsrc/libusbip.la @PACKAGE_LIBS@ +AM_CFLAGS = @EXTRA_CFLAGS@ +LDADD = $(top_builddir)/libsrc/libusbip.la sbin_PROGRAMS := usbip usbipd diff --git a/drivers/staging/usbip/userspace/src/usbip_attach.c b/drivers/staging/usbip/userspace/src/usbip_attach.c index bdf61c0fe699..2da4e44e1633 100644 --- a/drivers/staging/usbip/userspace/src/usbip_attach.c +++ b/drivers/staging/usbip/userspace/src/usbip_attach.c @@ -27,6 +27,7 @@ #include <fcntl.h> #include <getopt.h> #include <unistd.h> +#include <errno.h> #include "vhci_driver.h" #include "usbip_common.h" @@ -52,8 +53,18 @@ static int record_connection(char *host, char *port, char *busid, int rhport) int ret; ret = mkdir(VHCI_STATE_PATH, 0700); - if (ret < 0) - return -1; + if (ret < 0) { + /* if VHCI_STATE_PATH exists, then it better be a directory */ + if (errno == EEXIST) { + struct stat s; + ret = stat(VHCI_STATE_PATH, &s); + if (ret < 0) + return -1; + if (!(s.st_mode & S_IFDIR)) + return -1; + } else + return -1; + } snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d", rhport); diff --git a/drivers/staging/usbip/userspace/src/usbipd.c b/drivers/staging/usbip/userspace/src/usbipd.c index 8668a8092d4d..34760cc1d10e 100644 --- a/drivers/staging/usbip/userspace/src/usbipd.c +++ b/drivers/staging/usbip/userspace/src/usbipd.c @@ -20,6 +20,7 @@ #include "../config.h" #endif +#define _GNU_SOURCE #include <errno.h> #include <unistd.h> #include <netdb.h> @@ -35,10 +36,9 @@ #include <tcpd.h> #endif -#define _GNU_SOURCE #include <getopt.h> -#include <glib.h> #include <signal.h> +#include <poll.h> #include "usbip_host_driver.h" #include "usbip_common.h" @@ -48,7 +48,7 @@ #define PROGNAME "usbipd" #define MAXSOCKFD 20 -GMainLoop *main_loop; +#define MAIN_LOOP_TIMEOUT 10 static const char usbip_version_string[] = PACKAGE_STRING; @@ -310,30 +310,22 @@ static int do_accept(int listenfd) return connfd; } -gboolean process_request(GIOChannel *gio, GIOCondition condition, - gpointer unused_data) +int process_request(int listenfd) { - int listenfd; + pid_t childpid; int connfd; - (void) unused_data; - - if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { - err("unknown condition"); - BUG(); - } - - if (condition & G_IO_IN) { - listenfd = g_io_channel_unix_get_fd(gio); - connfd = do_accept(listenfd); - if (connfd < 0) - return TRUE; - + connfd = do_accept(listenfd); + if (connfd < 0) + return -1; + childpid = fork(); + if (childpid == 0) { + close(listenfd); recv_pdu(connfd); - close(connfd); + exit(0); } - - return TRUE; + close(connfd); + return 0; } static void log_addrinfo(struct addrinfo *ai) @@ -418,10 +410,7 @@ static struct addrinfo *do_getaddrinfo(char *host, int ai_family) static void signal_handler(int i) { - dbg("received signal: code %d", i); - - if (main_loop) - g_main_loop_quit(main_loop); + dbg("received '%s' signal", strsignal(i)); } static void set_signal(void) @@ -433,14 +422,19 @@ static void set_signal(void) sigemptyset(&act.sa_mask); sigaction(SIGTERM, &act, NULL); sigaction(SIGINT, &act, NULL); + act.sa_handler = SIG_IGN; + sigaction(SIGCLD, &act, NULL); } -static int do_standalone_mode(gboolean daemonize) +static int do_standalone_mode(int daemonize) { struct addrinfo *ai_head; int sockfdlist[MAXSOCKFD]; int nsockfd; - int i; + int i, terminate; + struct pollfd *fds; + struct timespec timeout; + sigset_t sigmask; if (usbip_names_init(USBIDS_FILE)) err("failed to open %s", USBIDS_FILE); @@ -456,7 +450,7 @@ static int do_standalone_mode(gboolean daemonize) err("daemonizing failed: %s", strerror(errno)); return -1; } - + umask(0); usbip_use_syslog = 1; } set_signal(); @@ -472,20 +466,40 @@ static int do_standalone_mode(gboolean daemonize) err("failed to open a listening socket"); return -1; } - + fds = calloc(nsockfd, sizeof(struct pollfd)); for (i = 0; i < nsockfd; i++) { - GIOChannel *gio; - - gio = g_io_channel_unix_new(sockfdlist[i]); - g_io_add_watch(gio, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL), - process_request, NULL); + fds[i].fd = sockfdlist[i]; + fds[i].events = POLLIN; + } + timeout.tv_sec = MAIN_LOOP_TIMEOUT; + timeout.tv_nsec = 0; + + sigfillset(&sigmask); + sigdelset(&sigmask, SIGTERM); + sigdelset(&sigmask, SIGINT); + + terminate = 0; + while (!terminate) { + int r; + + r = ppoll(fds, nsockfd, &timeout, &sigmask); + if (r < 0) { + dbg("%s", strerror(errno)); + terminate = 1; + } else if (r) { + for (i = 0; i < nsockfd; i++) { + if (fds[i].revents & POLLIN) { + dbg("read event on fd[%d]=%d", + i, sockfdlist[i]); + process_request(sockfdlist[i]); + } + } + } else + dbg("heartbeat timeout on ppoll()"); } - - main_loop = g_main_loop_new(FALSE, FALSE); - g_main_loop_run(main_loop); info("shutting down " PROGNAME); - + free(fds); freeaddrinfo(ai_head); usbip_host_driver_close(); usbip_names_free(); @@ -509,7 +523,7 @@ int main(int argc, char *argv[]) cmd_version } cmd; - gboolean daemonize = FALSE; + int daemonize = 0; int opt, rc = -1; usbip_use_stderr = 1; @@ -527,7 +541,7 @@ int main(int argc, char *argv[]) switch (opt) { case 'D': - daemonize = TRUE; + daemonize = 1; break; case 'd': usbip_use_debug = 1; diff --git a/drivers/staging/vme/devices/Kconfig b/drivers/staging/vme/devices/Kconfig index d0cab1766190..8e8bbb1dcd9b 100644 --- a/drivers/staging/vme/devices/Kconfig +++ b/drivers/staging/vme/devices/Kconfig @@ -6,7 +6,7 @@ config VME_USER help If you say Y here you want to be able to access a limited number of VME windows in a manner at least semi-compatible with the interface - provided with the original driver at http://vmelinux.org/. + provided with the original driver at <http://www.vmelinux.org/>. config VME_PIO2 tristate "GE PIO2 VME" diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 875ee4442386..d66854f5b304 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -2421,7 +2421,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { pTxBufHead->wFragCtl |= cpu_to_le16((unsigned short)(cbMacHdLen << 10)); // Notes: - // Although spec says MMPDU can be fragmented; In most case, + // Although spec says MMPDU can be fragmented; In most cases, // no one will send a MMPDU under fragmentation. With RTS may occur. pDevice->bAES = false; //Set FRAGCTL_WEPTYP @@ -2510,7 +2510,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { pbyPayloadHead = (unsigned char *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen); //Fill TXKEY - //Kyle: Need fix: TKIP and AES did't encryt Mnt Packet. + //Kyle: Need fix: TKIP and AES did't encrypt Mnt Packet. //s_vFillTxKey(pDevice, (unsigned char *)pTxBufHead->adwTxKey, NULL); //Fill IV(ExtIV,RSNHDR) @@ -2957,7 +2957,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un pTxBufHead->wFragCtl |= cpu_to_le16((unsigned short)cbMacHdLen << 10); // Notes: - // Although spec says MMPDU can be fragmented; In most casses, + // Although spec says MMPDU can be fragmented; In most cases, // no one will send a MMPDU under fragmentation. With RTS may occur. pDevice->bAES = false; //Set FRAGCTL_WEPTYP diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index 6d0b87a14267..101c7359f414 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -720,7 +720,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS pDevice->nTxDataTimeCout = 0; } else { - // printk("mike:-->First time triger TimerTxData InSleep\n"); + // printk("mike:-->First time trigger TimerTxData InSleep\n"); } pDevice->IsTxDataTrigger = true; add_timer(&pDevice->sTimerTxData); diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index b6f99ecbbeb5..b08a611a184a 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -2068,7 +2068,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) if (pBSSList != NULL) { - // Compare PHY paramater setting + // Compare PHY parameter setting if (pMgmt->wCurrCapInfo != pBSSList->wCapInfo) { bUpdatePhyParameter = true; pMgmt->wCurrCapInfo = pBSSList->wCapInfo; diff --git a/drivers/staging/vt6656/80211mgr.c b/drivers/staging/vt6656/80211mgr.c index e6ced95e6fa7..8221d65ccedc 100644 --- a/drivers/staging/vt6656/80211mgr.c +++ b/drivers/staging/vt6656/80211mgr.c @@ -96,9 +96,10 @@ vMgrEncodeBeacon( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_BEACON_OFF_TS); + /* Fixed Fields */ + pFrame->pqwTimestamp = + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_TS); pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_BCN_INT); pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) @@ -130,9 +131,10 @@ vMgrDecodeBeacon( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_BEACON_OFF_TS); + /* Fixed Fields */ + pFrame->pqwTimestamp = + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_BEACON_OFF_TS); pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_BEACON_OFF_BCN_INT); pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) @@ -671,9 +673,10 @@ vMgrEncodeProbeResponse( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_PROBERESP_OFF_TS); + /* Fixed Fields */ + pFrame->pqwTimestamp = + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_PROBERESP_OFF_TS); pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_BCN_INT); pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) @@ -706,9 +709,10 @@ vMgrDecodeProbeResponse( pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ - pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_PROBERESP_OFF_TS); + /* Fixed Fields */ + pFrame->pqwTimestamp = + (u64 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + + WLAN_PROBERESP_OFF_TS); pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_PROBERESP_OFF_BCN_INT); pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) diff --git a/drivers/staging/vt6656/80211mgr.h b/drivers/staging/vt6656/80211mgr.h index e5db73be0e71..29fad08e97cc 100644 --- a/drivers/staging/vt6656/80211mgr.h +++ b/drivers/staging/vt6656/80211mgr.h @@ -526,7 +526,7 @@ typedef struct tagWLAN_FR_BEACON { PBYTE pBuf; PUWLAN_80211HDR pHdr; // fixed fields - PQWORD pqwTimestamp; + u64 *pqwTimestamp; PWORD pwBeaconInterval; PWORD pwCapInfo; /*-- info elements ----------*/ @@ -683,7 +683,7 @@ typedef struct tagWLAN_FR_PROBERESP { PBYTE pBuf; PUWLAN_80211HDR pHdr; /*-- fixed fields -----------*/ - PQWORD pqwTimestamp; + u64 *pqwTimestamp; PWORD pwBeaconInterval; PWORD pwCapInfo; /*-- info elements ----------*/ diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 385501595b4d..cccd8107627a 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -690,7 +690,7 @@ s_vClearSQ3Value(PSDevice pDevice); * */ unsigned int -BBuGetFrameTime ( +BBuGetFrameTime( BYTE byPreambleType, BYTE byPktType, unsigned int cbFrameLength, @@ -756,23 +756,16 @@ BBuGetFrameTime ( * Return Value: none * */ -void -BBvCalculateParameter ( - PSDevice pDevice, - unsigned int cbFrameLength, - WORD wRate, - BYTE byPacketType, - PWORD pwPhyLen, - PBYTE pbyPhySrv, - PBYTE pbyPhySgn - ) +void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, + u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv, + u8 *pbyPhySgn) { - unsigned int cbBitCount; - unsigned int cbUsCount = 0; - unsigned int cbTmp; - BOOL bExtBit; - BYTE byPreambleType = pDevice->byPreambleType; - BOOL bCCK = pDevice->bCCK; + u32 cbBitCount; + u32 cbUsCount = 0; + u32 cbTmp; + int bExtBit; + u8 byPreambleType = pDevice->byPreambleType; + int bCCK = pDevice->bCCK; cbBitCount = cbFrameLength * 8; bExtBit = FALSE; @@ -929,8 +922,7 @@ BBvCalculateParameter ( * Return Value: none * */ -void -BBvSetAntennaMode (PSDevice pDevice, BYTE byAntennaMode) +void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode) { switch (byAntennaMode) { case ANT_TXA: @@ -968,7 +960,7 @@ BBvSetAntennaMode (PSDevice pDevice, BYTE byAntennaMode) * */ -BOOL BBbVT3184Init(PSDevice pDevice) +int BBbVT3184Init(struct vnt_private *pDevice) { int ntStatus; WORD wLength; @@ -1161,7 +1153,7 @@ else { * Return Value: none * */ -void BBvLoopbackOn (PSDevice pDevice) +void BBvLoopbackOn(struct vnt_private *pDevice) { BYTE byData; @@ -1214,9 +1206,9 @@ void BBvLoopbackOn (PSDevice pDevice) * Return Value: none * */ -void BBvLoopbackOff (PSDevice pDevice) +void BBvLoopbackOff(struct vnt_private *pDevice) { - BYTE byData; + u8 byData; ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, pDevice->byBBCRc9);//CR201 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, pDevice->byBBCR88);//CR136 @@ -1249,8 +1241,7 @@ void BBvLoopbackOff (PSDevice pDevice) * Return Value: none * */ -void -BBvSetShortSlotTime (PSDevice pDevice) +void BBvSetShortSlotTime(struct vnt_private *pDevice) { BYTE byBBVGA=0; @@ -1267,7 +1258,7 @@ BBvSetShortSlotTime (PSDevice pDevice) } -void BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData) +void BBvSetVGAGainOffset(struct vnt_private *pDevice, BYTE byData) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData); @@ -1294,8 +1285,7 @@ void BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData) * Return Value: none * */ -void -BBvSoftwareReset (PSDevice pDevice) +void BBvSoftwareReset(struct vnt_private *pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40); ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0); @@ -1315,22 +1305,20 @@ BBvSoftwareReset (PSDevice pDevice) * Return Value: none * */ -void -BBvSetDeepSleep (PSDevice pDevice) +void BBvSetDeepSleep(struct vnt_private *pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13 } -void -BBvExitDeepSleep (PSDevice pDevice) +void BBvExitDeepSleep(struct vnt_private *pDevice) { ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13 } -static unsigned long s_ulGetLowSQ3(PSDevice pDevice) +static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice) { int ii; unsigned long ulSQ3 = 0; @@ -1349,7 +1337,7 @@ static unsigned long s_ulGetLowSQ3(PSDevice pDevice) return ulSQ3; } -static unsigned long s_ulGetRatio(PSDevice pDevice) +static unsigned long s_ulGetRatio(struct vnt_private *pDevice) { int ii, jj; unsigned long ulRatio = 0; @@ -1377,9 +1365,7 @@ static unsigned long s_ulGetRatio(PSDevice pDevice) } -static -void -s_vClearSQ3Value (PSDevice pDevice) +static void s_vClearSQ3Value(struct vnt_private *pDevice) { int ii; pDevice->uDiversityCnt = 0; @@ -1406,8 +1392,8 @@ s_vClearSQ3Value (PSDevice pDevice) * */ -void -BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) +void BBvAntennaDiversity(struct vnt_private *pDevice, + u8 byRxRate, u8 bySQ3) { pDevice->uDiversityCnt++; @@ -1541,9 +1527,8 @@ BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) * -*/ -void TimerSQ3CallBack(void *hDeviceContext) +void TimerSQ3CallBack(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack..."); spin_lock_irq(&pDevice->lock); @@ -1579,9 +1564,8 @@ void TimerSQ3CallBack(void *hDeviceContext) * -*/ -void TimerSQ3Tmax3CallBack(void *hDeviceContext) +void TimerSQ3Tmax3CallBack(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack..."); spin_lock_irq(&pDevice->lock); @@ -1607,10 +1591,7 @@ void TimerSQ3Tmax3CallBack(void *hDeviceContext) spin_unlock_irq(&pDevice->lock); } -void -BBvUpdatePreEDThreshold( - PSDevice pDevice, - BOOL bScanning) +void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) { diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index 844d5a8b13e5..df5cf0d434c2 100644 --- a/drivers/staging/vt6656/baseband.h +++ b/drivers/staging/vt6656/baseband.h @@ -104,33 +104,26 @@ BBuGetFrameTime( WORD wRate ); -void BBvCalculateParameter(PSDevice pDevice, - unsigned int cbFrameLength, - WORD wRate, - BYTE byPacketType, - PWORD pwPhyLen, - PBYTE pbyPhySrv, - PBYTE pbyPhySgn); +void BBvCalculateParameter(struct vnt_private *, u32 cbFrameLength, + u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv, + u8 *pbyPhySgn); // timer for antenna diversity -void TimerSQ3CallBack(void *hDeviceContext); -void TimerSQ3Tmax3CallBack(void *hDeviceContext); - -void BBvAntennaDiversity(PSDevice pDevice, BYTE byRxRate, BYTE bySQ3); -void BBvLoopbackOn(PSDevice pDevice); -void BBvLoopbackOff(PSDevice pDevice); -void BBvSoftwareReset(PSDevice pDevice); - -void BBvSetShortSlotTime(PSDevice pDevice); -void BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData); -void BBvSetAntennaMode(PSDevice pDevice, BYTE byAntennaMode); -BOOL BBbVT3184Init(PSDevice pDevice); -void BBvSetDeepSleep(PSDevice pDevice); -void BBvExitDeepSleep(PSDevice pDevice); -void BBvUpdatePreEDThreshold( - PSDevice pDevice, - BOOL bScanning - ); +void TimerSQ3CallBack(struct vnt_private *); +void TimerSQ3Tmax3CallBack(struct vnt_private *); + +void BBvAntennaDiversity(struct vnt_private *, u8 byRxRate, u8 bySQ3); +void BBvLoopbackOn(struct vnt_private *); +void BBvLoopbackOff(struct vnt_private *); +void BBvSoftwareReset(struct vnt_private *); + +void BBvSetShortSlotTime(struct vnt_private *); +void BBvSetVGAGainOffset(struct vnt_private *, u8 byData); +void BBvSetAntennaMode(struct vnt_private *, u8 byAntennaMode); +int BBbVT3184Init(struct vnt_private *); +void BBvSetDeepSleep(struct vnt_private *); +void BBvExitDeepSleep(struct vnt_private *); +void BBvUpdatePreEDThreshold(struct vnt_private *, int bScanning); #endif /* __BASEBAND_H__ */ diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index 6a1394192248..d1757cfe5898 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -240,7 +240,6 @@ pDevice->bSameBSSMaxNum = jj; pSelect->bSelected = TRUE; if (pDevice->bRoaming == FALSE) { // Einsn Add @20070907 - memset(pbyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ; } @@ -339,7 +338,7 @@ PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext, BOOL BSSbInsertToBSSList(void *hDeviceContext, PBYTE abyBSSIDAddr, - QWORD qwTimestamp, + u64 qwTimestamp, WORD wBeaconInterval, WORD wCapInfo, BYTE byCurrChannel, @@ -380,8 +379,7 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, // save the BSS info pBSSList->bActive = TRUE; memcpy( pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN); - HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); - LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp)); + pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->uClearCount = 0; @@ -519,7 +517,7 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, // TODO: input structure modify BOOL BSSbUpdateToBSSList(void *hDeviceContext, - QWORD qwTimestamp, + u64 qwTimestamp, WORD wBeaconInterval, WORD wCapInfo, BYTE byCurrChannel, @@ -548,8 +546,8 @@ BOOL BSSbUpdateToBSSList(void *hDeviceContext, return FALSE; - HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); - LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp)); + pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); + pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->uClearCount = 0; diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h index 6b2ec390e775..125edc2725c7 100644 --- a/drivers/staging/vt6656/bssdb.h +++ b/drivers/staging/vt6656/bssdb.h @@ -142,8 +142,8 @@ typedef struct tagKnownBSS { unsigned int uClearCount; // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN]; unsigned int uIELength; - QWORD qwBSSTimestamp; - QWORD qwLocalTSF; // local TSF timer + u64 qwBSSTimestamp; + u64 qwLocalTSF;/* local TSF timer */ CARD_PHY_TYPE eNetworkTypeInUse; @@ -239,7 +239,7 @@ void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID); BOOL BSSbInsertToBSSList(void *hDeviceContext, PBYTE abyBSSIDAddr, - QWORD qwTimestamp, + u64 qwTimestamp, WORD wBeaconInterval, WORD wCapInfo, BYTE byCurrChannel, @@ -256,7 +256,7 @@ BOOL BSSbInsertToBSSList(void *hDeviceContext, void *pRxPacketContext); BOOL BSSbUpdateToBSSList(void *hDeviceContext, - QWORD qwTimestamp, + u64 qwTimestamp, WORD wBeaconInterval, WORD wCapInfo, BYTE byCurrChannel, diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 826520b03383..93983d941f92 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -45,6 +45,7 @@ * */ +#include "device.h" #include "tmacro.h" #include "card.h" #include "baseband.h" @@ -91,9 +92,8 @@ const WORD cwRXBCNTSFOff[MAX_RATE] = * Out: * none */ -void CARDbSetMediaChannel(void *pDeviceHandler, unsigned int uConnectionChannel) +void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel) { -PSDevice pDevice = (PSDevice) pDeviceHandler; if (pDevice->byBBType == BB_TYPE_11A) { // 15 ~ 38 if ((uConnectionChannel < (CB_MAX_CHANNEL_24G+1)) || (uConnectionChannel > CB_MAX_CHANNEL)) @@ -149,17 +149,17 @@ PSDevice pDevice = (PSDevice) pDeviceHandler; * Return Value: response Control frame rate * */ -static WORD swGetCCKControlRate(void *pDeviceHandler, WORD wRateIdx) +static u16 swGetCCKControlRate(struct vnt_private *pDevice, u16 wRateIdx) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - unsigned int ui = (unsigned int)wRateIdx; - while (ui > RATE_1M) { - if (pDevice->wBasicRate & ((WORD)1 << ui)) { - return (WORD)ui; - } - ui --; - } - return (WORD)RATE_1M; + u16 ui = wRateIdx; + + while (ui > RATE_1M) { + if (pDevice->wBasicRate & (1 << ui)) + return ui; + ui--; + } + + return RATE_1M; } /* @@ -175,28 +175,33 @@ static WORD swGetCCKControlRate(void *pDeviceHandler, WORD wRateIdx) * Return Value: response Control frame rate * */ -static WORD swGetOFDMControlRate(void *pDeviceHandler, WORD wRateIdx) +static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - unsigned int ui = (unsigned int)wRateIdx; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", pDevice->wBasicRate); - - if (!CARDbIsOFDMinBasicRate(pDevice)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); - if (wRateIdx > RATE_24M) - wRateIdx = RATE_24M; - return wRateIdx; - } - while (ui > RATE_11M) { - if (pDevice->wBasicRate & ((WORD)1 << ui)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate : %d\n", ui); - return (WORD)ui; - } - ui --; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate: 6M\n"); - return (WORD)RATE_24M; + u16 ui = wRateIdx; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", + pDevice->wBasicRate); + + if (!CARDbIsOFDMinBasicRate(pDevice)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); + if (wRateIdx > RATE_24M) + wRateIdx = RATE_24M; + return wRateIdx; + } + + while (ui > RATE_11M) { + if (pDevice->wBasicRate & (1 << ui)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "swGetOFDMControlRate: %d\n", ui); + return ui; + } + ui--; + } + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate: 6M\n"); + + return RATE_24M; } /* @@ -325,16 +330,15 @@ CARDvCalculateOFDMRParameter ( * Return Value: None. * */ -void CARDvSetRSPINF(void *pDeviceHandler, BYTE byBBType) +void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - BYTE abyServ[4] = {0,0,0,0}; // For CCK - BYTE abySignal[4] = {0,0,0,0}; - WORD awLen[4] = {0,0,0,0}; - BYTE abyTxRate[9] = {0,0,0,0,0,0,0,0,0}; // For OFDM - BYTE abyRsvTime[9] = {0,0,0,0,0,0,0,0,0}; - BYTE abyData[34]; - int i; + u8 abyServ[4] = {0, 0, 0, 0}; /* For CCK */ + u8 abySignal[4] = {0, 0, 0, 0}; + u16 awLen[4] = {0, 0, 0, 0}; + u8 abyTxRate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */ + u8 abyRsvTime[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + u8 abyData[34]; + int i; //RSPINF_b_1 BBvCalculateParameter(pDevice, @@ -476,12 +480,10 @@ void CARDvSetRSPINF(void *pDeviceHandler, BYTE byBBType) * Return Value: None. * */ -void vUpdateIFS(void *pDeviceHandler) +void vUpdateIFS(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - //Set SIFS, DIFS, EIFS, SlotTime, CwMin - BYTE byMaxMin = 0; - BYTE byData[4]; + u8 byMaxMin = 0; + u8 byData[4]; if (pDevice->byPacketType==PK_TYPE_11A) {//0000 0000 0000 0000,11a pDevice->uSlot = C_SLOT_SHORT; @@ -561,11 +563,10 @@ void vUpdateIFS(void *pDeviceHandler) &byMaxMin); } -void CARDvUpdateBasicTopRate(void *pDeviceHandler) +void CARDvUpdateBasicTopRate(struct vnt_private *pDevice) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -BYTE byTopOFDM = RATE_24M, byTopCCK = RATE_1M; -BYTE ii; + u8 byTopOFDM = RATE_24M, byTopCCK = RATE_1M; + u8 ii; //Determines the highest basic rate. for (ii = RATE_54M; ii >= RATE_6M; ii --) { @@ -600,10 +601,9 @@ BYTE ii; * Return Value: TRUE if succeeded; FALSE if failed. * */ -void CARDbAddBasicRate(void *pDeviceHandler, WORD wRateIdx) +void CARDbAddBasicRate(struct vnt_private *pDevice, u16 wRateIdx) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -WORD wRate = (WORD)(1<<wRateIdx); + u16 wRate = (1 << wRateIdx); pDevice->wBasicRate |= wRate; @@ -611,10 +611,9 @@ WORD wRate = (WORD)(1<<wRateIdx); CARDvUpdateBasicTopRate(pDevice); } -BOOL CARDbIsOFDMinBasicRate(void *pDeviceHandler) +int CARDbIsOFDMinBasicRate(struct vnt_private *pDevice) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -int ii; + int ii; for (ii = RATE_54M; ii >= RATE_6M; ii --) { if ((pDevice->wBasicRate) & ((WORD)(1<<ii))) @@ -623,9 +622,8 @@ int ii; return FALSE; } -BYTE CARDbyGetPktType(void *pDeviceHandler) +u8 CARDbyGetPktType(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) { return (BYTE)pDevice->byBBType; @@ -654,28 +652,18 @@ BYTE CARDbyGetPktType(void *pDeviceHandler) * Return Value: TSF Offset value * */ -QWORD CARDqGetTSFOffset (BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2) +u64 CARDqGetTSFOffset(BYTE byRxRate, u64 qwTSF1, u64 qwTSF2) { - QWORD qwTSFOffset; - WORD wRxBcnTSFOffst = 0; + u64 qwTSFOffset = 0; + WORD wRxBcnTSFOffst = 0; - HIDWORD(qwTSFOffset) = 0; - LODWORD(qwTSFOffset) = 0; + wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate % MAX_RATE]; - wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE]; - (qwTSF2).u.dwLowDword += (DWORD)(wRxBcnTSFOffst); - if ((qwTSF2).u.dwLowDword < (DWORD)(wRxBcnTSFOffst)) { - (qwTSF2).u.dwHighDword++; - } - LODWORD(qwTSFOffset) = LODWORD(qwTSF1) - LODWORD(qwTSF2); - if (LODWORD(qwTSF1) < LODWORD(qwTSF2)) { - // if borrow needed - HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1 ; - } - else { - HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2); - }; - return (qwTSFOffset); + qwTSF2 += (u64)wRxBcnTSFOffst; + + qwTSFOffset = qwTSF1 - qwTSF2; + + return qwTSFOffset; } @@ -695,33 +683,25 @@ QWORD CARDqGetTSFOffset (BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2) * Return Value: none * */ -void CARDvAdjustTSF(void *pDeviceHandler, BYTE byRxRate, - QWORD qwBSSTimestamp, QWORD qwLocalTSF) +void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate, + u64 qwBSSTimestamp, u64 qwLocalTSF) { + u64 qwTSFOffset = 0; + u8 pbyData[8]; - PSDevice pDevice = (PSDevice) pDeviceHandler; - QWORD qwTSFOffset; - DWORD dwTSFOffset1,dwTSFOffset2; - BYTE pbyData[8]; - - HIDWORD(qwTSFOffset) = 0; - LODWORD(qwTSFOffset) = 0; qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF); // adjust TSF // HW's TSF add TSF Offset reg - dwTSFOffset1 = LODWORD(qwTSFOffset); - dwTSFOffset2 = HIDWORD(qwTSFOffset); - - pbyData[0] = (BYTE)dwTSFOffset1; - pbyData[1] = (BYTE)(dwTSFOffset1>>8); - pbyData[2] = (BYTE)(dwTSFOffset1>>16); - pbyData[3] = (BYTE)(dwTSFOffset1>>24); - pbyData[4] = (BYTE)dwTSFOffset2; - pbyData[5] = (BYTE)(dwTSFOffset2>>8); - pbyData[6] = (BYTE)(dwTSFOffset2>>16); - pbyData[7] = (BYTE)(dwTSFOffset2>>24); + pbyData[0] = (u8)qwTSFOffset; + pbyData[1] = (u8)(qwTSFOffset >> 8); + pbyData[2] = (u8)(qwTSFOffset >> 16); + pbyData[3] = (u8)(qwTSFOffset >> 24); + pbyData[4] = (u8)(qwTSFOffset >> 32); + pbyData[5] = (u8)(qwTSFOffset >> 40); + pbyData[6] = (u8)(qwTSFOffset >> 48); + pbyData[7] = (u8)(qwTSFOffset >> 56); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SET_TSFTBTT, @@ -745,14 +725,12 @@ void CARDvAdjustTSF(void *pDeviceHandler, BYTE byRxRate, * Return Value: TRUE if success; otherwise FALSE * */ -BOOL CARDbGetCurrentTSF(void *pDeviceHandler, PQWORD pqwCurrTSF) +int CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - LODWORD(*pqwCurrTSF) = LODWORD(pDevice->qwCurrTSF); - HIDWORD(*pqwCurrTSF) = HIDWORD(pDevice->qwCurrTSF); + *pqwCurrTSF = pDevice->qwCurrTSF; - return(TRUE); + return TRUE; } @@ -767,16 +745,14 @@ BOOL CARDbGetCurrentTSF(void *pDeviceHandler, PQWORD pqwCurrTSF) * Return Value: TRUE if success; otherwise FALSE * */ -BOOL CARDbClearCurrentTSF(void *pDeviceHandler) +int CARDbClearCurrentTSF(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - MACvRegBitsOn(pDevice,MAC_REG_TFTCTL,TFTCTL_TSFCNTRST); + MACvRegBitsOn(pDevice, MAC_REG_TFTCTL, TFTCTL_TSFCNTRST); - LODWORD(pDevice->qwCurrTSF) = 0; - HIDWORD(pDevice->qwCurrTSF) = 0; + pDevice->qwCurrTSF = 0; - return(TRUE); + return TRUE; } /* @@ -793,7 +769,7 @@ BOOL CARDbClearCurrentTSF(void *pDeviceHandler) * Return Value: TSF value of next Beacon * */ -QWORD CARDqGetNextTBTT (QWORD qwTSF, WORD wBeaconInterval) +u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval) { unsigned int uLowNextTBTT; @@ -802,18 +778,19 @@ QWORD CARDqGetNextTBTT (QWORD qwTSF, WORD wBeaconInterval) uBeaconInterval = wBeaconInterval * 1024; // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval - uLowNextTBTT = (LODWORD(qwTSF) >> 10) << 10; - uLowRemain = (uLowNextTBTT) % uBeaconInterval; - uHighRemain = ((0x80000000 % uBeaconInterval)* 2 * HIDWORD(qwTSF)) - % uBeaconInterval; - uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval; - uLowRemain = uBeaconInterval - uLowRemain; + uLowNextTBTT = ((qwTSF & 0xffffffffU) >> 10) << 10; + uLowRemain = (uLowNextTBTT) % uBeaconInterval; + uHighRemain = ((0x80000000 % uBeaconInterval) * 2 * (u32)(qwTSF >> 32)) + % uBeaconInterval; + uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval; + uLowRemain = uBeaconInterval - uLowRemain; // check if carry when add one beacon interval - if ((~uLowNextTBTT) < uLowRemain) - HIDWORD(qwTSF) ++ ; + if ((~uLowNextTBTT) < uLowRemain) + qwTSF = ((qwTSF >> 32) + 1) << 32; - LODWORD(qwTSF) = uLowNextTBTT + uLowRemain; + qwTSF = (qwTSF & 0xffffffff00000000U) | + (u64)(uLowNextTBTT + uLowRemain); return (qwTSF); } @@ -833,32 +810,24 @@ QWORD CARDqGetNextTBTT (QWORD qwTSF, WORD wBeaconInterval) * Return Value: none * */ -void CARDvSetFirstNextTBTT(void *pDeviceHandler, WORD wBeaconInterval) +void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, WORD wBeaconInterval) { + u64 qwNextTBTT = 0; + u8 pbyData[8]; - PSDevice pDevice = (PSDevice) pDeviceHandler; - QWORD qwNextTBTT; - DWORD dwLoTBTT,dwHiTBTT; - BYTE pbyData[8]; - - HIDWORD(qwNextTBTT) = 0; - LODWORD(qwNextTBTT) = 0; - CARDbClearCurrentTSF(pDevice); + CARDbClearCurrentTSF(pDevice); //CARDbGetCurrentTSF(pDevice, &qwNextTBTT); //Get Local TSF counter - qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); + qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); // Set NextTBTT - dwLoTBTT = LODWORD(qwNextTBTT); - dwHiTBTT = HIDWORD(qwNextTBTT); - - pbyData[0] = (BYTE)dwLoTBTT; - pbyData[1] = (BYTE)(dwLoTBTT>>8); - pbyData[2] = (BYTE)(dwLoTBTT>>16); - pbyData[3] = (BYTE)(dwLoTBTT>>24); - pbyData[4] = (BYTE)dwHiTBTT; - pbyData[5] = (BYTE)(dwHiTBTT>>8); - pbyData[6] = (BYTE)(dwHiTBTT>>16); - pbyData[7] = (BYTE)(dwHiTBTT>>24); + pbyData[0] = (u8)qwNextTBTT; + pbyData[1] = (u8)(qwNextTBTT >> 8); + pbyData[2] = (u8)(qwNextTBTT >> 16); + pbyData[3] = (u8)(qwNextTBTT >> 24); + pbyData[4] = (u8)(qwNextTBTT >> 32); + pbyData[5] = (u8)(qwNextTBTT >> 40); + pbyData[6] = (u8)(qwNextTBTT >> 48); + pbyData[7] = (u8)(qwNextTBTT >> 56); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SET_TSFTBTT, @@ -887,27 +856,23 @@ void CARDvSetFirstNextTBTT(void *pDeviceHandler, WORD wBeaconInterval) * Return Value: none * */ -void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, - WORD wBeaconInterval) +void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, + u16 wBeaconInterval) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - DWORD dwLoTBTT,dwHiTBTT; - BYTE pbyData[8]; + u8 pbyData[8]; qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval); // Set NextTBTT - dwLoTBTT = LODWORD(qwTSF); - dwHiTBTT = HIDWORD(qwTSF); - - pbyData[0] = (BYTE)dwLoTBTT; - pbyData[1] = (BYTE)(dwLoTBTT>>8); - pbyData[2] = (BYTE)(dwLoTBTT>>16); - pbyData[3] = (BYTE)(dwLoTBTT>>24); - pbyData[4] = (BYTE)dwHiTBTT; - pbyData[5] = (BYTE)(dwHiTBTT>>8); - pbyData[6] = (BYTE)(dwHiTBTT>>16); - pbyData[7] = (BYTE)(dwHiTBTT>>24); + + pbyData[0] = (u8)qwTSF; + pbyData[1] = (u8)(qwTSF >> 8); + pbyData[2] = (u8)(qwTSF >> 16); + pbyData[3] = (u8)(qwTSF >> 24); + pbyData[4] = (u8)(qwTSF >> 32); + pbyData[5] = (u8)(qwTSF >> 40); + pbyData[6] = (u8)(qwTSF >> 48); + pbyData[7] = (u8)(qwTSF >> 56); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SET_TSFTBTT, @@ -918,7 +883,8 @@ void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:Update Next TBTT[%8xh:%8xh] \n",(int)HIDWORD(qwTSF), (int)LODWORD(qwTSF)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "Card:Update Next TBTT[%8lx]\n", (unsigned long)qwTSF); return; } @@ -935,10 +901,9 @@ void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, * Return Value: TRUE if success; otherwise FALSE * */ -BOOL CARDbRadioPowerOff(void *pDeviceHandler) +int CARDbRadioPowerOff(struct vnt_private *pDevice) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -BOOL bResult = TRUE; + int bResult = TRUE; //if (pDevice->bRadioOff == TRUE) // return TRUE; @@ -976,11 +941,9 @@ BOOL bResult = TRUE; * Return Value: TRUE if success; otherwise FALSE * */ -BOOL CARDbRadioPowerOn(void *pDeviceHandler) +int CARDbRadioPowerOn(struct vnt_private *pDevice) { -PSDevice pDevice = (PSDevice) pDeviceHandler; -BOOL bResult = TRUE; - + int bResult = TRUE; if ((pDevice->bHWRadioOff == TRUE) || (pDevice->bRadioControlOff == TRUE)) { return FALSE; @@ -1009,9 +972,8 @@ BOOL bResult = TRUE; return bResult; } -void CARDvSetBSSMode(void *pDeviceHandler) +void CARDvSetBSSMode(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; // Set BB and packet type at the same time.//{{RobertYu:20050222, AL7230 have two TX PA output, only connet to b/g now // so in 11a mode need to set the MAC Reg0x4C to 11b/g mode to turn on PA if( (pDevice->byRFType == RF_AIROHA7230 ) && (pDevice->byBBType == BB_TYPE_11A) ) @@ -1068,16 +1030,10 @@ void CARDvSetBSSMode(void *pDeviceHandler) * Return Value: none. * -*/ -BOOL -CARDbChannelSwitch ( - void *pDeviceHandler, - BYTE byMode, - BYTE byNewChannel, - BYTE byCount - ) +int CARDbChannelSwitch(struct vnt_private *pDevice, u8 byMode, + u8 byNewChannel, u8 byCount) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - BOOL bResult = TRUE; + int bResult = TRUE; if (byCount == 0) { pDevice->sMgmtObj.uCurrChannel = byNewChannel; diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index 55962b198831..720643f4fcc2 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -28,7 +28,7 @@ #ifndef __CARD_H__ #define __CARD_H__ - +#include "device.h" #include "ttype.h" /*--------------------- Export Definitions -------------------------*/ @@ -58,31 +58,28 @@ typedef enum _CARD_OP_MODE { /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ +struct vnt_private; -void CARDbSetMediaChannel(void *pDeviceHandler, - unsigned int uConnectionChannel); -void CARDvSetRSPINF(void *pDeviceHandler, BYTE byBBType); -void vUpdateIFS(void *pDeviceHandler); -void CARDvUpdateBasicTopRate(void *pDeviceHandler); -void CARDbAddBasicRate(void *pDeviceHandler, WORD wRateIdx); -BOOL CARDbIsOFDMinBasicRate(void *pDeviceHandler); -void CARDvAdjustTSF(void *pDeviceHandler, BYTE byRxRate, - QWORD qwBSSTimestamp, QWORD qwLocalTSF); -BOOL CARDbGetCurrentTSF(void *pDeviceHandler, PQWORD pqwCurrTSF); -BOOL CARDbClearCurrentTSF(void *pDeviceHandler); -void CARDvSetFirstNextTBTT(void *pDeviceHandler, WORD wBeaconInterval); -void CARDvUpdateNextTBTT(void *pDeviceHandler, QWORD qwTSF, +void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel); +void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType); +void vUpdateIFS(struct vnt_private *pDevice); +void CARDvUpdateBasicTopRate(struct vnt_private *pDevice); +void CARDbAddBasicRate(struct vnt_private *pDevice, u16 wRateIdx); +int CARDbIsOFDMinBasicRate(struct vnt_private *pDevice); +void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate, + u64 qwBSSTimestamp, u64 qwLocalTSF); +BOOL CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF); +BOOL CARDbClearCurrentTSF(struct vnt_private *pDevice); +void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, WORD wBeaconInterval); +void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, WORD wBeaconInterval); -QWORD CARDqGetNextTBTT(QWORD qwTSF, WORD wBeaconInterval); -QWORD CARDqGetTSFOffset(BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2); -BOOL CARDbRadioPowerOff(void *pDeviceHandler); -BOOL CARDbRadioPowerOn(void *pDeviceHandler); -BYTE CARDbyGetPktType(void *pDeviceHandler); -void CARDvSetBSSMode(void *pDeviceHandler); - -BOOL CARDbChannelSwitch(void *pDeviceHandler, - BYTE byMode, - BYTE byNewChannel, - BYTE byCount); +u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval); +u64 CARDqGetTSFOffset(BYTE byRxRate, u64 qwTSF1, u64 qwTSF2); +int CARDbRadioPowerOff(struct vnt_private *pDevice); +int CARDbRadioPowerOn(struct vnt_private *pDevice); +u8 CARDbyGetPktType(struct vnt_private *pDevice); +void CARDvSetBSSMode(struct vnt_private *pDevice); +int CARDbChannelSwitch(struct vnt_private *pDevice, u8 byMode, + u8 byNewChannel, u8 byCount); #endif /* __CARD_H__ */ diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index 650217607858..95f00ba1d3fe 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -436,11 +436,10 @@ CHvChannelGetList ( } -void CHvInitChannelTable(void *pDeviceHandler) +void CHvInitChannelTable(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - BOOL bMultiBand = FALSE; - unsigned int ii; + int bMultiBand = FALSE; + int ii; for (ii = 1; ii <= CB_MAX_CHANNEL; ii++) sChannelTbl[ii].bValid = FALSE; diff --git a/drivers/staging/vt6656/channel.h b/drivers/staging/vt6656/channel.h index e7b3c1231825..8031491b8109 100644 --- a/drivers/staging/vt6656/channel.h +++ b/drivers/staging/vt6656/channel.h @@ -30,6 +30,7 @@ #ifndef _CHANNEL_H_ #define _CHANNEL_H_ +#include "device.h" #include "ttype.h" /*--------------------- Export Definitions -------------------------*/ @@ -47,7 +48,7 @@ typedef struct tagSChannelTblElement { /*--------------------- Export Functions --------------------------*/ BOOL ChannelValid(unsigned int CountryCode, unsigned int ChannelNum); -void CHvInitChannelTable(void *pDeviceHandler); +void CHvInitChannelTable(struct vnt_private *pDevice); BYTE CHbyGetChannelMapping(BYTE byChannelNumber); BOOL CHvChannelGetList(unsigned int uCountryCodeIdx, PBYTE pbyChannelTable); diff --git a/drivers/staging/vt6656/control.c b/drivers/staging/vt6656/control.c index 5d8c5719419b..743ef5fb7fe7 100644 --- a/drivers/staging/vt6656/control.c +++ b/drivers/staging/vt6656/control.c @@ -56,43 +56,34 @@ /*--------------------- Export Functions --------------------------*/ -void ControlvWriteByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, - BYTE byData) +void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, + u8 data) { - BYTE byData1; - byData1 = byData; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - byRegOfs, - byRegType, - 1, - &byData1); + + CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, reg_off, reg, + sizeof(u8), &data); + + return; } -void ControlvReadByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, - PBYTE pbyData) +void ControlvReadByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, + u8 *data) { - int ntStatus; - BYTE byData1; - ntStatus = CONTROLnsRequestIn(pDevice, - MESSAGE_TYPE_READ, - byRegOfs, - byRegType, - 1, - &byData1); - *pbyData = byData1; + CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, + reg_off, reg, sizeof(u8), data); + return; } -void ControlvMaskByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, - BYTE byMask, BYTE byData) +void ControlvMaskByte(struct vnt_private *pDevice, u8 reg_type, u8 reg_off, + u8 reg_mask, u8 data) { - BYTE pbyData[2]; - pbyData[0] = byData; - pbyData[1] = byMask; - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - byRegOfs, - byRegType, - 2, - pbyData); + u8 reg_data[2]; + + reg_data[0] = data; + reg_data[1] = reg_mask; + + CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE_MASK, reg_off, + reg_type, ARRAY_SIZE(reg_data), reg_data); + + return; } diff --git a/drivers/staging/vt6656/control.h b/drivers/staging/vt6656/control.h index bbe610fd8b5a..76ce0244e100 100644 --- a/drivers/staging/vt6656/control.h +++ b/drivers/staging/vt6656/control.h @@ -51,28 +51,14 @@ /*--------------------- Export Functions --------------------------*/ -void ControlvWriteByte( - PSDevice pDevice, - BYTE byRegType, - BYTE byRegOfs, - BYTE byData - ); +void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, + u8 data); +void ControlvReadByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, + u8 *data); -void ControlvReadByte( - PSDevice pDevice, - BYTE byRegType, - BYTE byRegOfs, - PBYTE pbyData - ); +void ControlvMaskByte(struct vnt_private *pDevice, u8 reg_type, u8 reg_off, + u8 reg_mask, u8 data); -void ControlvMaskByte( - PSDevice pDevice, - BYTE byRegType, - BYTE byRegOfs, - BYTE byMask, - BYTE byData - ); - #endif /* __CONTROL_H__ */ diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 25bf03af7733..eb8a311e74d3 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -174,13 +174,13 @@ typedef enum _CONTEXT_TYPE { // RCB (Receive Control Block) typedef struct _RCB { - void *Next; - signed long Ref; - void *pDevice; - struct urb *pUrb; - SRxMgmtPacket sMngPacket; - struct sk_buff* skb; - BOOL bBoolInUse; + void *Next; + signed long Ref; + void *pDevice; + struct urb *pUrb; + struct vnt_rx_mgmt sMngPacket; + struct sk_buff *skb; + int bBoolInUse; } RCB, *PRCB; @@ -392,7 +392,7 @@ typedef struct __device_opt { } OPTIONS, *POPTIONS; -typedef struct __device_info { +typedef struct vnt_private { // netdev struct usb_device* usb; @@ -525,9 +525,10 @@ typedef struct __device_info { // 802.11 management + struct vnt_manager vnt_mgmt; SMgmtObject sMgmtObj; - QWORD qwCurrTSF; + u64 qwCurrTSF; unsigned int cbBulkInMax; BOOL bPSRxBeacon; @@ -871,9 +872,6 @@ typedef struct __device_info { /*--------------------- Export Functions --------------------------*/ -/* BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, - * unsigned int uNodeIndex); - */ -BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF); +int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); #endif diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index e94f6a1647a3..8f21bc7a4d60 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -328,7 +328,7 @@ RXbBulkInProcessData ( PBYTE pbyRsr; PBYTE pbyNewRsr; PBYTE pbyRSSI; - PQWORD pqwTSFTime; + u64 *pqwTSFTime; PBYTE pbyFrame; BOOL bDeFragRx = FALSE; unsigned int cbHeaderOffset; @@ -411,7 +411,7 @@ RXbBulkInProcessData ( wPLCPwithPadding = ( (*pwPLCP_Length / 4) + ( (*pwPLCP_Length % 4) ? 1:0 ) ) *4; - pqwTSFTime = (PQWORD) (pbyDAddress + 8 + wPLCPwithPadding); + pqwTSFTime = (u64 *)(pbyDAddress + 8 + wPLCPwithPadding); if(pDevice->byBBType == BB_TYPE_11G) { pby3SQ = pbyDAddress + 8 + wPLCPwithPadding + 12; pbySQ = pby3SQ; @@ -598,8 +598,7 @@ RXbBulkInProcessData ( pRxPacket->cbMPDULen = FrameSize; pRxPacket->uRSSI = *pbyRSSI; pRxPacket->bySQ = *pbySQ; - HIDWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(HIDWORD(*pqwTSFTime)); - LODWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(LODWORD(*pqwTSFTime)); + pRxPacket->qwLocalTSF = cpu_to_le64(*pqwTSFTime); if (bIsWEP) { // strip IV pbyData1 = WLAN_HDR_A3_DATA_PTR(pbyFrame); @@ -910,7 +909,7 @@ RXbBulkInProcessData ( RSC = dwRxTSC47_16; RSC <<= 16; RSC += wRxTSC15_0; - memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD)); + memcpy(&(pKey->KeyRSC), &RSC, sizeof(u64)); if ( (pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->sMgmtObj.eCurrState == WMAC_STATE_ASSOC)) { diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index 8831ea03c001..93d7301bc294 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -56,10 +56,7 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Export Functions --------------------------*/ -BOOL -FIRMWAREbDownload( - PSDevice pDevice - ) +int FIRMWAREbDownload(struct vnt_private *pDevice) { struct device *dev = &pDevice->usb->dev; const struct firmware *fw; @@ -114,12 +111,9 @@ out: } MODULE_FIRMWARE(FIRMWARE_NAME); -BOOL -FIRMWAREbBrach2Sram( - PSDevice pDevice - ) +int FIRMWAREbBrach2Sram(struct vnt_private *pDevice) { - int NdisStatus; + int NdisStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Branch to Sram\n"); @@ -139,10 +133,7 @@ FIRMWAREbBrach2Sram( } -BOOL -FIRMWAREbCheckVersion( - PSDevice pDevice - ) +int FIRMWAREbCheckVersion(struct vnt_private *pDevice) { int ntStatus; diff --git a/drivers/staging/vt6656/firmware.h b/drivers/staging/vt6656/firmware.h index b2f5b5818a93..ebab3a6351b3 100644 --- a/drivers/staging/vt6656/firmware.h +++ b/drivers/staging/vt6656/firmware.h @@ -41,19 +41,8 @@ /*--------------------- Export Functions --------------------------*/ -BOOL -FIRMWAREbDownload( - PSDevice pDevice - ); - -BOOL -FIRMWAREbBrach2Sram( - PSDevice pDevice - ); - -BOOL -FIRMWAREbCheckVersion( - PSDevice pDevice - ); +int FIRMWAREbDownload(struct vnt_private *); +int FIRMWAREbBrach2Sram(struct vnt_private *); +int FIRMWAREbCheckVersion(struct vnt_private *); #endif /* __FIRMWARE_H__ */ diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 26a7d0e4b048..332285531383 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -512,14 +512,12 @@ static int hostap_set_encryption(PSDevice pDevice, } else { // 8021x enable, individual key dwKeyIndex |= (1 << 30); // set pairwise key - if (KeybSetKey(pDevice, - &(pDevice->sKey), - ¶m->sta_addr[0], - dwKeyIndex & ~(USE_KEYRSC), - param->u.crypt.key_len, - (PQWORD) &(KeyRSC), - (PBYTE)abyKey, - KEY_CTL_WEP + if (KeybSetKey(pDevice, &(pDevice->sKey), + ¶m->sta_addr[0], + dwKeyIndex & ~(USE_KEYRSC), + param->u.crypt.key_len, + &KeyRSC, (PBYTE)abyKey, + KEY_CTL_WEP ) == TRUE) { @@ -574,7 +572,7 @@ static int hostap_set_encryption(PSDevice pDevice, &(pDevice->sKey), dwKeyIndex, param->u.crypt.key_len, - (PQWORD) &(KeyRSC), + &KeyRSC, abyKey, byKeyDecMode ); @@ -587,7 +585,7 @@ static int hostap_set_encryption(PSDevice pDevice, ¶m->sta_addr[0], dwKeyIndex, param->u.crypt.key_len, - (PQWORD) &(KeyRSC), + &KeyRSC, (PBYTE)abyKey, byKeyDecMode ) == TRUE) { diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index bba31caae036..97c6896bd3b2 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -75,9 +75,8 @@ static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */ * if we've gotten no data * -*/ -void INTvWorkItem(void *Context) +void INTvWorkItem(struct vnt_private *pDevice) { - PSDevice pDevice = Context; int ntStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n"); @@ -88,10 +87,10 @@ void INTvWorkItem(void *Context) spin_unlock_irq(&pDevice->lock); } -void INTnsProcessData(PSDevice pDevice) +void INTnsProcessData(struct vnt_private *pDevice) { PSINTData pINTData; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct net_device_stats *pStats = &pDevice->stats; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n"); @@ -179,8 +178,7 @@ void INTnsProcessData(PSDevice pDevice) NULL); } } - LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF; - HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF; + pDevice->qwCurrTSF = cpu_to_le64(pINTData->qwTSF); /*DBG_PRN_GRP01(("ISR0 = %02x , LoTsf = %08x, HiTsf = %08x\n", diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h index 5d8faf9f96ec..444b6c2ea412 100644 --- a/drivers/staging/vt6656/int.h +++ b/drivers/staging/vt6656/int.h @@ -48,8 +48,7 @@ typedef struct tagSINTData { BYTE byTSR3; BYTE byPkt3; WORD wTime3; - u32 dwLoTSF; - u32 dwHiTSF; + u64 qwTSF; BYTE byISR0; BYTE byISR1; BYTE byRTSSuccess; @@ -66,7 +65,7 @@ SINTData, *PSINTData; /*--------------------- Export Functions --------------------------*/ -void INTvWorkItem(void *Context); -void INTnsProcessData(PSDevice pDevice); +void INTvWorkItem(struct vnt_private *); +void INTnsProcessData(struct vnt_private *); #endif /* __INT_H__ */ diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 52fce6902508..880c025496da 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -55,7 +55,7 @@ static int msglevel = MSG_LEVEL_INFO; struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); long ldBm; pDevice->wstats.status = pDevice->eOPMode; @@ -91,9 +91,9 @@ int iwctl_giwname(struct net_device *dev, struct iw_request_info *info, int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_point *wrq = &wrqu->data; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_scan_req *req = (struct iw_scan_req *)extra; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; PWLAN_IE_SSID pItemSSID = NULL; @@ -169,8 +169,8 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, int ii; int jj; int kk; - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PKnownBSS pBSS; PWLAN_IE_SSID pItemSSID; PWLAN_IE_SUPP_RATES pSuppRates; @@ -309,7 +309,7 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_freq *wrq = &wrqu->freq; int rc = 0; @@ -348,9 +348,9 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_freq *wrq = &wrqu->freq; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ\n"); @@ -379,9 +379,9 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); __u32 *wmode = &wrqu->mode; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int rc = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE\n"); @@ -492,9 +492,9 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, int iwctl_giwmode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); __u32 *wmode = &wrqu->mode; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE\n"); @@ -631,9 +631,9 @@ int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info, int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct sockaddr *wrq = &wrqu->ap_addr; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int rc = 0; BYTE ZeroBSSID[WLAN_BSSID_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -683,9 +683,9 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, int iwctl_giwap(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct sockaddr *wrq = &wrqu->ap_addr; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP\n"); @@ -713,8 +713,8 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq = &wrqu->data; struct sockaddr *sock; struct iw_quality *qual; - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &pDevice->sMgmtObj; + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PKnownBSS pBSS = &pMgmt->sBSSList[0]; int ii; int jj; @@ -771,9 +771,9 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_point *wrq = &wrqu->essid; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PWLAN_IE_SSID pItemSSID; if (pMgmt == NULL) @@ -878,9 +878,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_point *wrq = &wrqu->essid; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PWLAN_IE_SSID pItemSSID; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID\n"); @@ -908,7 +908,7 @@ int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info, int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->bitrate; int rc = 0; u8 brate = 0; @@ -986,9 +986,9 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info, int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->bitrate; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE\n"); @@ -1037,7 +1037,7 @@ int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info, int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->rts; if ((wrq->value < 0 || wrq->value > 2312) && !wrq->disabled) @@ -1057,7 +1057,7 @@ int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info, int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->rts; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS\n"); @@ -1073,7 +1073,7 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info, int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->frag; int rc = 0; int fthr = wrq->value; @@ -1097,7 +1097,7 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->frag; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG\n"); @@ -1113,7 +1113,7 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info, int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->retry; int rc = 0; @@ -1146,7 +1146,7 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->retry; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY\n"); wrq->disabled = 0; // Can't be disabled @@ -1173,8 +1173,8 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->encoding; u32 dwKeyIndex = (u32)(wrq->flags & IW_ENCODE_INDEX); int ii; @@ -1271,8 +1271,8 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->encoding; char abyKey[WLAN_WEP232_KEYLEN]; @@ -1333,8 +1333,8 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info, int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_param *wrq = &wrqu->power; int rc = 0; @@ -1385,8 +1385,8 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_param *wrq = &wrqu->power; int mode = pDevice->ePSMode; @@ -1418,7 +1418,7 @@ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info, int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iw_param *wrq = &wrqu->sens; long ldBm; @@ -1437,8 +1437,8 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info, int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_param *wrq = &wrqu->param; int ret = 0; static int wpa_version = 0; // must be static to save the last value, einsn liu @@ -1547,8 +1547,8 @@ int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info, int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->data; int ret = 0; @@ -1582,8 +1582,8 @@ out: // not completely ...not necessary in wpa_supplicant 0.5.8 int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->data; int ret = 0; int space = wrq->length; @@ -1608,8 +1608,8 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_point *wrq = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct viawget_wpa_param *param=NULL; @@ -1741,8 +1741,8 @@ int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PSDevice pDevice = netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct iw_mlme *mlme = (struct iw_mlme *)extra; int ret = 0; diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 8c78b86b5c80..87eab91293c1 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -60,13 +60,12 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ -static void s_vCheckKeyTableValid(void *pDeviceHandler, - PSKeyManagement pTable) +static void s_vCheckKeyTableValid(struct vnt_private *pDevice, + PSKeyManagement pTable) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i; - WORD wLength = 0; - BYTE pbyData[MAX_KEY_TABLE]; + int i; + u16 wLength = 0; + u8 pbyData[MAX_KEY_TABLE]; for (i=0;i<MAX_KEY_TABLE;i++) { if ((pTable->KeyTable[i].bInUse == TRUE) && @@ -112,12 +111,10 @@ static void s_vCheckKeyTableValid(void *pDeviceHandler, * Return Value: none * */ -void KeyvInitTable(void *pDeviceHandler, PSKeyManagement pTable) +void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i; - int jj; - BYTE pbyData[MAX_KEY_TABLE+1]; + int i, jj; + u8 pbyData[MAX_KEY_TABLE+1]; spin_lock_irq(&pDevice->lock); for (i=0;i<MAX_KEY_TABLE;i++) { @@ -164,12 +161,12 @@ void KeyvInitTable(void *pDeviceHandler, PSKeyManagement pTable) * Return Value: TRUE if found otherwise FALSE * */ -BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, - PSKeyItem *pKey) +int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, + PSKeyItem *pKey) { - int i; + int i; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetKey() \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetKey()\n"); *pKey = NULL; for (i=0;i<MAX_KEY_TABLE;i++) { @@ -218,22 +215,13 @@ BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybSetKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ) +int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u8 *pbyBSSID, u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i,j; - unsigned int ii; - PSKeyItem pKey; - unsigned int uKeyIdx; + PSKeyItem pKey; + int i, j, ii; + u32 uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetKey: %X\n", dwKeyIndex); @@ -286,13 +274,11 @@ BOOL KeybSetKey( } MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (PDWORD)pKey->abyKey); - if ((dwKeyIndex & USE_KEYRSC) == 0) { - // RSC set by NIC - memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); - } - else { - memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); - } + if ((dwKeyIndex & USE_KEYRSC) == 0) + pKey->KeyRSC = 0; /* RSC set by NIC */ + else + pKey->KeyRSC = *KeyRSC; + pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; @@ -356,13 +342,11 @@ BOOL KeybSetKey( } MACvSetKeyEntry(pDevice, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (PDWORD)pKey->abyKey); - if ((dwKeyIndex & USE_KEYRSC) == 0) { - // RSC set by NIC - memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); - } - else { - memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); - } + if ((dwKeyIndex & USE_KEYRSC) == 0) + pKey->KeyRSC = 0; /* RSC set by NIC */ + else + pKey->KeyRSC = *KeyRSC; + pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; @@ -401,16 +385,12 @@ BOOL KeybSetKey( * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybRemoveKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID, - DWORD dwKeyIndex - ) + +int KeybRemoveKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u8 *pbyBSSID, u32 dwKeyIndex) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i; - BOOL bReturnValue = FALSE; + int i; + int bReturnValue = FALSE; if (is_broadcast_ether_addr(pbyBSSID)) { // delete all keys @@ -482,14 +462,10 @@ BOOL KeybRemoveKey( * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybRemoveAllKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID - ) +int KeybRemoveAllKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u8 *pbyBSSID) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i,u; + int i, u; for (i=0;i<MAX_KEY_TABLE;i++) { if ((pTable->KeyTable[i].bInUse == TRUE) && @@ -518,13 +494,9 @@ BOOL KeybRemoveAllKey( * Return Value: TRUE if success otherwise FALSE * */ -void KeyvRemoveWEPKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex - ) +void KeyvRemoveWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u32 dwKeyIndex) { - PSDevice pDevice = (PSDevice) pDeviceHandler; if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == TRUE) { @@ -541,9 +513,8 @@ void KeyvRemoveWEPKey( return; } -void KeyvRemoveAllWEPKey(void *pDeviceHandler, PSKeyManagement pTable) +void KeyvRemoveAllWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable) { - PSDevice pDevice = (PSDevice) pDeviceHandler; int i; for (i = 0; i < MAX_GROUP_KEY; i++) @@ -563,12 +534,13 @@ void KeyvRemoveAllWEPKey(void *pDeviceHandler, PSKeyManagement pTable) * Return Value: TRUE if found otherwise FALSE * */ -BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, - PSKeyItem *pKey) +int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, + PSKeyItem *pKey) { - int i, ii; + int i, ii; + + *pKey = NULL; - *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { if ((pTable->KeyTable[i].bInUse == TRUE) && !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { @@ -640,11 +612,12 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, * Return Value: TRUE if found otherwise FALSE * */ -BOOL KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) +int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) { - int i; + int i; + + *pKey = NULL; - *pKey = NULL; for (i=0;i<MAX_KEY_TABLE;i++) { if ((pTable->KeyTable[i].bInUse == TRUE) && (pTable->KeyTable[i].PairwiseKey.bKeyValid == TRUE)) { @@ -671,20 +644,14 @@ BOOL KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybSetDefaultKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ) + +int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - unsigned int ii; - PSKeyItem pKey; - unsigned int uKeyIdx; + int ii; + PSKeyItem pKey; + u32 uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d\n", (int) dwKeyIndex, (int) uKeyLength); @@ -742,12 +709,12 @@ BOOL KeybSetDefaultKey( MACvSetKeyEntry(pDevice, pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl, MAX_KEY_TABLE-1, uKeyIdx, pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID, (PDWORD) pKey->abyKey); - if ((dwKeyIndex & USE_KEYRSC) == 0) { - // RSC set by NIC - memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); - } else { - memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); - } + if ((dwKeyIndex & USE_KEYRSC) == 0) + pKey->KeyRSC = 0; /* RSC set by NIC */ + else + pKey->KeyRSC = *KeyRSC; + + pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; @@ -787,21 +754,14 @@ BOOL KeybSetDefaultKey( * Return Value: TRUE if success otherwise FALSE * */ -BOOL KeybSetAllGroupKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ) + +int KeybSetAllGroupKey(struct vnt_private *pDevice, PSKeyManagement pTable, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode) { - PSDevice pDevice = (PSDevice) pDeviceHandler; - int i; - unsigned int ii; - PSKeyItem pKey; - unsigned int uKeyIdx; + int i, ii; + PSKeyItem pKey; + u32 uKeyIdx; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n", dwKeyIndex); @@ -847,13 +807,11 @@ BOOL KeybSetAllGroupKey( MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pTable->KeyTable[i].abyBSSID, (PDWORD) pKey->abyKey); - if ((dwKeyIndex & USE_KEYRSC) == 0) { - // RSC set by NIC - memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); - } - else { - memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); - } + if ((dwKeyIndex & USE_KEYRSC) == 0) + pKey->KeyRSC = 0; /* RSC set by NIC */ + else + pKey->KeyRSC = *KeyRSC; + pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index bd35d39621ae..888942331ea0 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -60,7 +60,7 @@ typedef struct tagSKeyItem BOOL bKeyValid; u32 uKeyLength; BYTE abyKey[MAX_KEY_LEN]; - QWORD KeyRSC; + u64 KeyRSC; DWORD dwTSC47_16; WORD wTSC15_0; BYTE byCipherSuite; @@ -97,69 +97,37 @@ typedef struct tagSKeyManagement /*--------------------- Export Functions --------------------------*/ -void KeyvInitTable(void *pDeviceHandler, PSKeyManagement pTable); - -BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, - PSKeyItem *pKey); - -BOOL KeybSetKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ); - -BOOL KeybRemoveKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID, - DWORD dwKeyIndex - ); - -BOOL KeybRemoveAllKey( - void *pDeviceHandler, - PSKeyManagement pTable, - PBYTE pbyBSSID - ); - -void KeyvRemoveWEPKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex - ); - -void KeyvRemoveAllWEPKey( - void *pDeviceHandler, - PSKeyManagement pTable - ); - -BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, - PSKeyItem *pKey); - -BOOL KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey); - -BOOL KeybSetDefaultKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ); - -BOOL KeybSetAllGroupKey( - void *pDeviceHandler, - PSKeyManagement pTable, - DWORD dwKeyIndex, - u32 uKeyLength, - PQWORD pKeyRSC, - PBYTE pbyKey, - BYTE byKeyDecMode - ); +void KeyvInitTable(struct vnt_private *, PSKeyManagement pTable); + +int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, + PSKeyItem *pKey); + +int KeybSetKey(struct vnt_private *, PSKeyManagement pTable, u8 *pbyBSSID, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); + +int KeybRemoveKey(struct vnt_private *, PSKeyManagement pTable, + u8 *pbyBSSID, u32 dwKeyIndex); + +int KeybRemoveAllKey(struct vnt_private *, PSKeyManagement pTable, + u8 *pbyBSSID); + +void KeyvRemoveWEPKey(struct vnt_private *, PSKeyManagement pTable, + u32 dwKeyIndex); + +void KeyvRemoveAllWEPKey(struct vnt_private *, PSKeyManagement pTable); + +int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, + PSKeyItem *pKey); + +int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey); + +int KeybSetDefaultKey(struct vnt_private *, PSKeyManagement pTable, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); + +int KeybSetAllGroupKey(struct vnt_private *, PSKeyManagement pTable, + u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, + u8 byKeyDecMode); #endif /* __KEY_H__ */ diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 8fddc7b3930b..dd732bcb9092 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -68,11 +68,11 @@ static int msglevel =MSG_LEVEL_INFO; * Return Value: none * */ -void MACvSetMultiAddrByHash (PSDevice pDevice, BYTE byHashIdx) +void MACvSetMultiAddrByHash(struct vnt_private *pDevice, u8 byHashIdx) { - unsigned int uByteIdx; - BYTE byBitMask; - BYTE pbyData[2]; + u8 uByteIdx; + u8 byBitMask; + u8 pbyData[2]; // calculate byte position @@ -110,9 +110,9 @@ void MACvSetMultiAddrByHash (PSDevice pDevice, BYTE byHashIdx) * Return Value: none * */ -void MACvWriteMultiAddr(PSDevice pDevice, unsigned int uByteIdx, BYTE byData) +void MACvWriteMultiAddr(struct vnt_private *pDevice, u32 uByteIdx, u8 byData) { - BYTE byData1; + u8 byData1; byData1 = byData; CONTROLnsRequestOut(pDevice, @@ -135,7 +135,7 @@ void MACvWriteMultiAddr(PSDevice pDevice, unsigned int uByteIdx, BYTE byData) * * */ -void MACbShutdown(PSDevice pDevice) +void MACbShutdown(struct vnt_private *pDevice) { CONTROLnsRequestOutAsyn(pDevice, MESSAGE_TYPE_MACSHUTDOWN, @@ -146,9 +146,9 @@ void MACbShutdown(PSDevice pDevice) ); } -void MACvSetBBType(PSDevice pDevice,BYTE byType) +void MACvSetBBType(struct vnt_private *pDevice, u8 byType) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = byType; @@ -163,9 +163,9 @@ BYTE pbyData[2]; ); } -void MACvSetMISCFifo (PSDevice pDevice, WORD wOffset, DWORD dwData) +void MACvSetMISCFifo(struct vnt_private *pDevice, u16 wOffset, u32 dwData) { -BYTE pbyData[4]; + u8 pbyData[4]; if (wOffset > 273) return; @@ -197,10 +197,10 @@ BYTE pbyData[4]; * Return Value: none * */ -void MACvDisableKeyEntry(PSDevice pDevice, unsigned int uEntryIdx) +void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) { -WORD wOffset; -BYTE byData; + u16 wOffset; + u8 byData; byData = (BYTE) uEntryIdx; @@ -237,15 +237,14 @@ BYTE byData; * Return Value: none * */ -void MACvSetKeyEntry(PSDevice pDevice, WORD wKeyCtl, - unsigned int uEntryIdx, unsigned int uKeyIdx, - PBYTE pbyAddr, PDWORD pdwKey) +void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, + u32 uKeyIdx, u8 *pbyAddr, u32 *pdwKey) { -PBYTE pbyKey; -WORD wOffset; -DWORD dwData1,dwData2; -int ii; -BYTE pbyData[24]; + u8 *pbyKey; + u16 wOffset; + u32 dwData1, dwData2; + int ii; + u8 pbyData[24]; if ( pDevice->byLocalID <= MAC_REVISION_A1 ) { if ( pDevice->sMgmtObj.byCSSPK == KEY_CTL_CCMP ) @@ -321,9 +320,9 @@ BYTE pbyData[24]; } -void MACvRegBitsOff(PSDevice pDevice, BYTE byRegOfs, BYTE byBits) +void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = 0; pbyData[1] = byBits; @@ -338,9 +337,9 @@ BYTE pbyData[2]; } -void MACvRegBitsOn(PSDevice pDevice, BYTE byRegOfs, BYTE byBits) +void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = byBits; @@ -355,9 +354,9 @@ BYTE pbyData[2]; ); } -void MACvWriteWord(PSDevice pDevice, BYTE byRegOfs, WORD wData) +void MACvWriteWord(struct vnt_private *pDevice, u8 byRegOfs, u16 wData) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = (BYTE)(wData & 0xff); @@ -373,9 +372,9 @@ BYTE pbyData[2]; } -void MACvWriteBSSIDAddress(PSDevice pDevice, PBYTE pbyEtherAddr) +void MACvWriteBSSIDAddress(struct vnt_private *pDevice, u8 *pbyEtherAddr) { -BYTE pbyData[6]; + u8 pbyData[6]; pbyData[0] = *((PBYTE)pbyEtherAddr); @@ -394,9 +393,9 @@ BYTE pbyData[6]; ); } -void MACvEnableProtectMD(PSDevice pDevice) +void MACvEnableProtectMD(struct vnt_private *pDevice) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = EnCFG_ProtectMd; @@ -411,9 +410,9 @@ BYTE pbyData[2]; ); } -void MACvDisableProtectMD(PSDevice pDevice) +void MACvDisableProtectMD(struct vnt_private *pDevice) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = 0; @@ -428,9 +427,9 @@ BYTE pbyData[2]; ); } -void MACvEnableBarkerPreambleMd(PSDevice pDevice) +void MACvEnableBarkerPreambleMd(struct vnt_private *pDevice) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = EnCFG_BarkerPream; @@ -445,9 +444,9 @@ BYTE pbyData[2]; ); } -void MACvDisableBarkerPreambleMd(PSDevice pDevice) +void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) { -BYTE pbyData[2]; + u8 pbyData[2]; pbyData[0] = 0; @@ -463,12 +462,12 @@ BYTE pbyData[2]; } -void MACvWriteBeaconInterval(PSDevice pDevice, WORD wInterval) +void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval) { -BYTE pbyData[2]; + u8 pbyData[2]; - pbyData[0] = (BYTE) (wInterval & 0xff); - pbyData[1] = (BYTE) (wInterval >> 8); + pbyData[0] = (u8)(wInterval & 0xff); + pbyData[1] = (u8)(wInterval >> 8); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h index 147ac50218d3..6e28500ae5f8 100644 --- a/drivers/staging/vt6656/mac.h +++ b/drivers/staging/vt6656/mac.h @@ -420,24 +420,21 @@ /*--------------------- Export Functions --------------------------*/ -void MACvSetMultiAddrByHash(PSDevice pDevice, BYTE byHashIdx); -void MACvWriteMultiAddr(PSDevice pDevice, unsigned int uByteIdx, BYTE byData); -void MACbShutdown(PSDevice pDevice); -void MACvSetBBType(PSDevice pDevice, BYTE byType); -void MACvSetMISCFifo(PSDevice pDevice, WORD wOffset, DWORD dwData); -void MACvDisableKeyEntry(PSDevice pDevice, unsigned int uEntryIdx); -void MACvSetKeyEntry(PSDevice pDevice, WORD wKeyCtl, unsigned int uEntryIdx, - unsigned int uKeyIdx, PBYTE pbyAddr, PDWORD pdwKey); - -void MACvRegBitsOff(PSDevice pDevice, BYTE byRegOfs, BYTE byBits); -void MACvRegBitsOn(PSDevice pDevice, BYTE byRegOfs, BYTE byBits); -void MACvWriteWord(PSDevice pDevice, BYTE byRegOfs, WORD wData); - -void MACvWriteBSSIDAddress(PSDevice pDevice, PBYTE pbyEtherAddr); -void MACvEnableProtectMD(PSDevice pDevice); -void MACvDisableProtectMD(PSDevice pDevice); -void MACvEnableBarkerPreambleMd(PSDevice pDevice); -void MACvDisableBarkerPreambleMd(PSDevice pDevice); -void MACvWriteBeaconInterval(PSDevice pDevice, WORD wInterval); +void MACvSetMultiAddrByHash(struct vnt_private *, u8); +void MACvWriteMultiAddr(struct vnt_private *, u32, u8); +void MACbShutdown(struct vnt_private *); +void MACvSetBBType(struct vnt_private *, u8); +void MACvSetMISCFifo(struct vnt_private *pDevice, u16, u32); +void MACvDisableKeyEntry(struct vnt_private *, u32); +void MACvSetKeyEntry(struct vnt_private *, u16, u32, u32, u8 *, u32 *); +void MACvRegBitsOff(struct vnt_private *, u8, u8); +void MACvRegBitsOn(struct vnt_private *, u8, u8); +void MACvWriteWord(struct vnt_private *, u8, u16); +void MACvWriteBSSIDAddress(struct vnt_private *, u8 *); +void MACvEnableProtectMD(struct vnt_private *); +void MACvDisableProtectMD(struct vnt_private *); +void MACvEnableBarkerPreambleMd(struct vnt_private *); +void MACvDisableBarkerPreambleMd(struct vnt_private *); +void MACvWriteBeaconInterval(struct vnt_private *, u16); #endif /* __MAC_H__ */ diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index f33086d66496..a316d8905fb8 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -225,26 +225,27 @@ static void device_set_multi(struct net_device *dev); static int device_close(struct net_device *dev); static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType); -static BOOL device_init_defrag_cb(PSDevice pDevice); -static void device_init_diversity_timer(PSDevice pDevice); +static int device_init_registers(struct vnt_private *pDevice, + DEVICE_INIT_TYPE InitType); +static BOOL device_init_defrag_cb(struct vnt_private *pDevice); +static void device_init_diversity_timer(struct vnt_private *pDevice); static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev); static int ethtool_ioctl(struct net_device *dev, void *useraddr); -static void device_free_tx_bufs(PSDevice pDevice); -static void device_free_rx_bufs(PSDevice pDevice); -static void device_free_int_bufs(PSDevice pDevice); -static void device_free_frag_bufs(PSDevice pDevice); -static BOOL device_alloc_bufs(PSDevice pDevice); - -static int Read_config_file(PSDevice pDevice); -static unsigned char *Config_FileOperation(PSDevice pDevice); +static void device_free_tx_bufs(struct vnt_private *pDevice); +static void device_free_rx_bufs(struct vnt_private *pDevice); +static void device_free_int_bufs(struct vnt_private *pDevice); +static void device_free_frag_bufs(struct vnt_private *pDevice); +static BOOL device_alloc_bufs(struct vnt_private *pDevice); + +static int Read_config_file(struct vnt_private *pDevice); +static unsigned char *Config_FileOperation(struct vnt_private *pDevice); static int Config_FileGetParameter(unsigned char *string, unsigned char *dest, unsigned char *source); -static void usb_device_reset(PSDevice pDevice); +static void usb_device_reset(struct vnt_private *pDevice); @@ -254,7 +255,7 @@ static void usb_device_reset(PSDevice pDevice); static void -device_set_options(PSDevice pDevice) { +device_set_options(struct vnt_private *pDevice) { BYTE abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; BYTE abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; @@ -292,7 +293,7 @@ device_set_options(PSDevice pDevice) { } -static void device_init_diversity_timer(PSDevice pDevice) +static void device_init_diversity_timer(struct vnt_private *pDevice) { init_timer(&pDevice->TimerSQ3Tmax1); pDevice->TimerSQ3Tmax1.data = (unsigned long)pDevice; @@ -317,21 +318,21 @@ static void device_init_diversity_timer(PSDevice pDevice) // Initialization of MAC & BBP registers // -static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) +static int device_init_registers(struct vnt_private *pDevice, + DEVICE_INIT_TYPE InitType) { - u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - u8 abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - u8 abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; - BYTE byAntenna; - unsigned int ii; - CMD_CARD_INIT sInitCmd; - int ntStatus = STATUS_SUCCESS; - RSP_CARD_INIT sInitRsp; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BYTE byTmp; - BYTE byCalibTXIQ = 0; - BYTE byCalibTXDC = 0; - BYTE byCalibRXIQ = 0; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + u8 abySNAP_RFC1042[ETH_ALEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; + u8 abySNAP_Bridgetunnel[ETH_ALEN] + = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8}; + u8 byAntenna; + int ii; + CMD_CARD_INIT sInitCmd; + int ntStatus = STATUS_SUCCESS; + RSP_CARD_INIT sInitRsp; + u8 byTmp; + u8 byCalibTXIQ = 0, byCalibTXDC = 0, byCalibRXIQ = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", InitType, pDevice->byPacketType); spin_lock_irq(&pDevice->lock); @@ -636,7 +637,7 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) { - PSDevice device = usb_get_intfdata(intf); + struct vnt_private *device = usb_get_intfdata(intf); if (!device || !device->dev) return -ENODEV; @@ -651,7 +652,7 @@ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) static int vt6656_resume(struct usb_interface *intf) { - PSDevice device = usb_get_intfdata(intf); + struct vnt_private *device = usb_get_intfdata(intf); if (!device || !device->dev) return -ENODEV; @@ -682,13 +683,13 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) struct usb_device *udev = interface_to_usbdev(intf); int rc = 0; struct net_device *netdev = NULL; - PSDevice pDevice = NULL; + struct vnt_private *pDevice; printk(KERN_NOTICE "%s Ver. %s\n", DEVICE_FULL_DRV_NAM, DEVICE_VERSION); printk(KERN_NOTICE "Copyright (c) 2004 VIA Networking Technologies, Inc.\n"); udev = usb_get_dev(udev); - netdev = alloc_etherdev(sizeof(DEVICE_INFO)); + netdev = alloc_etherdev(sizeof(struct vnt_private)); if (!netdev) { printk(KERN_ERR DEVICE_NAME ": allocate net device failed\n"); rc = -ENOMEM; @@ -696,7 +697,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) } pDevice = netdev_priv(netdev); - memset(pDevice, 0, sizeof(DEVICE_INFO)); + memset(pDevice, 0, sizeof(struct vnt_private)); pDevice->dev = netdev; pDevice->usb = udev; @@ -732,7 +733,7 @@ err_nomem: return rc; } -static void device_free_tx_bufs(PSDevice pDevice) +static void device_free_tx_bufs(struct vnt_private *pDevice) { PUSB_SEND_CONTEXT pTxContext; int ii; @@ -751,7 +752,7 @@ static void device_free_tx_bufs(PSDevice pDevice) } -static void device_free_rx_bufs(PSDevice pDevice) +static void device_free_rx_bufs(struct vnt_private *pDevice) { PRCB pRCB; int ii; @@ -773,7 +774,7 @@ static void device_free_rx_bufs(PSDevice pDevice) return; } -static void usb_device_reset(PSDevice pDevice) +static void usb_device_reset(struct vnt_private *pDevice) { int status; status = usb_reset_device(pDevice->usb); @@ -782,14 +783,15 @@ static void usb_device_reset(PSDevice pDevice) return ; } -static void device_free_int_bufs(PSDevice pDevice) +static void device_free_int_bufs(struct vnt_private *pDevice) { kfree(pDevice->intBuf.pDataBuf); return; } -static BOOL device_alloc_bufs(PSDevice pDevice) { +static BOOL device_alloc_bufs(struct vnt_private *pDevice) +{ PUSB_SEND_CONTEXT pTxContext; PRCB pRCB; @@ -888,9 +890,10 @@ free_tx: -static BOOL device_init_defrag_cb(PSDevice pDevice) { - int i; - PSDeFragControlBlock pDeF; +static BOOL device_init_defrag_cb(struct vnt_private *pDevice) +{ + int i; + PSDeFragControlBlock pDeF; /* Init the fragment ctl entries */ for (i = 0; i < CB_MAX_RX_FRAG; i++) { @@ -912,9 +915,10 @@ free_frag: -static void device_free_frag_bufs(PSDevice pDevice) { - PSDeFragControlBlock pDeF; - int i; +static void device_free_frag_bufs(struct vnt_private *pDevice) +{ + PSDeFragControlBlock pDeF; + int i; for (i = 0; i < CB_MAX_RX_FRAG; i++) { @@ -927,7 +931,9 @@ static void device_free_frag_bufs(PSDevice pDevice) { -BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) { +int device_alloc_frag_buf(struct vnt_private *pDevice, + PSDeFragControlBlock pDeF) +{ pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); if (pDeF->skb == NULL) @@ -941,8 +947,9 @@ BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) { /*-----------------------------------------------------------------*/ -static int device_open(struct net_device *dev) { - PSDevice pDevice=(PSDevice) netdev_priv(dev); +static int device_open(struct net_device *dev) +{ + struct vnt_private *pDevice = netdev_priv(dev); pDevice->fWPA_Authened = FALSE; @@ -1061,13 +1068,13 @@ free_rx_tx: -static int device_close(struct net_device *dev) { - PSDevice pDevice=(PSDevice) netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - - int uu; +static int device_close(struct net_device *dev) +{ + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int uu; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close1 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close1\n"); if (pDevice == NULL) return -ENODEV; @@ -1136,7 +1143,7 @@ static int device_close(struct net_device *dev) { static void vt6656_disconnect(struct usb_interface *intf) { - PSDevice device = usb_get_intfdata(intf); + struct vnt_private *device = usb_get_intfdata(intf); if (!device) return; @@ -1156,7 +1163,7 @@ static void vt6656_disconnect(struct usb_interface *intf) static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); spin_lock_irq(&pDevice->lock); @@ -1172,7 +1179,7 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) static int device_xmit(struct sk_buff *skb, struct net_device *dev) { - PSDevice pDevice = netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct net_device_stats *stats = &pDevice->stats; spin_lock_irq(&pDevice->lock); @@ -1290,7 +1297,7 @@ static int Config_FileGetParameter(unsigned char *string, } //if read fail,return NULL,or return data pointer; -static unsigned char *Config_FileOperation(PSDevice pDevice) +static unsigned char *Config_FileOperation(struct vnt_private *pDevice) { unsigned char *config_path = CONFIG_PATH; unsigned char *buffer = NULL; @@ -1354,10 +1361,11 @@ if(result!=0) { } //return --->-1:fail; >=0:successful -static int Read_config_file(PSDevice pDevice) { - int result = 0; - unsigned char tmpbuffer[100]; - unsigned char *buffer = NULL; +static int Read_config_file(struct vnt_private *pDevice) +{ + int result = 0; + unsigned char tmpbuffer[100]; + unsigned char *buffer = NULL; //init config setting pDevice->config_file.ZoneType = -1; @@ -1406,15 +1414,16 @@ static int Read_config_file(PSDevice pDevice) { return result; } -static void device_set_multi(struct net_device *dev) { - PSDevice pDevice = (PSDevice) netdev_priv(dev); - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - u32 mc_filter[2]; - int ii; - struct netdev_hw_addr *ha; - BYTE pbyData[8] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; - BYTE byTmpMode = 0; - int rc; +static void device_set_multi(struct net_device *dev) +{ + struct vnt_private *pDevice = netdev_priv(dev); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct netdev_hw_addr *ha; + u32 mc_filter[2]; + int ii; + u8 pbyData[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + u8 byTmpMode = 0; + int rc; spin_lock_irq(&pDevice->lock); @@ -1472,14 +1481,14 @@ static void device_set_multi(struct net_device *dev) { static struct net_device_stats *device_get_stats(struct net_device *dev) { - PSDevice pDevice=(PSDevice) netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); - return &pDevice->stats; + return &pDevice->stats; } static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - PSDevice pDevice = (PSDevice)netdev_priv(dev); + struct vnt_private *pDevice = netdev_priv(dev); struct iwreq *wrq = (struct iwreq *) rq; int rc = 0; diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 74c0598e37b7..06cff8b2cfb5 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -69,7 +69,7 @@ static int msglevel =MSG_LEVEL_INFO; -BYTE abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { +u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { {0x03, 0xF7, 0x90}, {0x03, 0x33, 0x31}, {0x01, 0xB8, 0x02}, @@ -87,7 +87,7 @@ BYTE abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { {0x00, 0x58, 0x0F} }; -BYTE abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = { +u8 abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0xF7, 0x90}, // channel = 1, Tf = 2412MHz {0x03, 0xF7, 0x90}, // channel = 2, Tf = 2417MHz {0x03, 0xE7, 0x90}, // channel = 3, Tf = 2422MHz @@ -104,7 +104,7 @@ BYTE abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0xE7, 0xC0} // channel = 14, Tf = 2412M }; -BYTE abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = { +u8 abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = { {0x03, 0x33, 0x31}, // channel = 1, Tf = 2412MHz {0x0B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz @@ -123,7 +123,7 @@ BYTE abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = { // 40MHz reference frequency // Need to Pull PLLON(PE3) low when writing channel registers through 3-wire. -BYTE abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = { +u8 abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = { {0x20, 0x37, 0x90}, // Channel1 // Need modify for 11a {0x13, 0x33, 0x31}, // Channel1 // Need modify for 11a {0x84, 0x1F, 0xF2}, // Need modify for 11a: 451FE2 @@ -146,7 +146,7 @@ BYTE abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = { {0x1A, 0xBA, 0x8F} // Need modify for 11a: 12BACF }; -BYTE abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = { +u8 abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = { {0x2F, 0xF5, 0x20}, // Channel184 // Need modify for 11b/g {0x00, 0x00, 0x01}, // Channel184 // Need modify for 11b/g {0x45, 0x1F, 0xE2}, // Need modify for 11b/g @@ -165,7 +165,7 @@ BYTE abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = { {0x12, 0xBA, 0xCF} // Need modify for 11b/g }; -BYTE abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = { +u8 abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = { {0x20, 0x37, 0x90}, // channel = 1, Tf = 2412MHz {0x20, 0x37, 0x90}, // channel = 2, Tf = 2417MHz {0x20, 0x37, 0x90}, // channel = 3, Tf = 2422MHz @@ -231,7 +231,7 @@ BYTE abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = { {0x2F, 0xF6, 0x10} // channel = 165, Tf = 5825MHz (56) }; -BYTE abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = { +u8 abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = { {0x13, 0x33, 0x31}, // channel = 1, Tf = 2412MHz {0x1B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz @@ -295,7 +295,7 @@ BYTE abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = { {0x02, 0xAA, 0xB1} // channel = 165, Tf = 5825MHz (56) }; -BYTE abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = { +u8 abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = { {0x7F, 0xD7, 0x84}, // channel = 1, Tf = 2412MHz {0x7F, 0xD7, 0x84}, // channel = 2, Tf = 2417MHz {0x7F, 0xD7, 0x84}, // channel = 3, Tf = 2422MHz @@ -360,7 +360,7 @@ BYTE abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = { }; ///{{RobertYu:20051111 -BYTE abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = { +u8 abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x03, 0xFF, 0x80}, {0x02, 0x82, 0xA1}, {0x03, 0xC6, 0xA2}, @@ -374,7 +374,7 @@ BYTE abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x02, 0x00, 0x2A} }; -BYTE abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { +u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x03, 0xFF, 0x80}, {0x03, 0x02, 0x21}, //RobertYu:20060327 {0x03, 0xC6, 0xA2}, @@ -389,7 +389,7 @@ BYTE abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { }; -BYTE abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { +u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz {0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz {0x01, 0x97, 0x93}, // channel = 3, Tf = 2422MHz @@ -406,7 +406,7 @@ BYTE abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0x37, 0xC3} // channel = 14, Tf = 2484MHz }; -BYTE abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { +u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { {0x02, 0x66, 0x64}, // channel = 1, Tf = 2412MHz {0x03, 0x66, 0x64}, // channel = 2, Tf = 2417MHz {0x00, 0x66, 0x64}, // channel = 3, Tf = 2422MHz @@ -426,7 +426,7 @@ BYTE abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { //{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode -DWORD dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { +u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz @@ -446,7 +446,7 @@ DWORD dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { //{{RobertYu:20060609 -BYTE abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { // 11b/g mode +u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ {0x03, 0xFF, 0x80}, //update for mode// {0x02, 0x08, 0x81}, {0x00, 0xC6, 0x02}, @@ -469,7 +469,7 @@ BYTE abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { // 11b/g mode // channel56, 5280MHz 0x00C402 for disable Frac // other channels 0x00C602 -BYTE abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = { +u8 abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = { {0x02, 0x05, 0x03}, // channel = 1, Tf = 2412MHz {0x01, 0x15, 0x03}, // channel = 2, Tf = 2417MHz {0x03, 0xC5, 0x03}, // channel = 3, Tf = 2422MHz @@ -535,7 +535,7 @@ BYTE abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = { {0x00, 0x06, 0x03} // channel = 165, Tf = 5825MHz (56), TBD }; -BYTE abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { +u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { {0x01, 0x99, 0x94}, // channel = 1, Tf = 2412MHz {0x02, 0x44, 0x44}, // channel = 2, Tf = 2417MHz {0x02, 0xEE, 0xE4}, // channel = 3, Tf = 2422MHz @@ -606,7 +606,7 @@ BYTE abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { * -*/ -const DWORD dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { +const u32 dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { 0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, @@ -682,7 +682,7 @@ const DWORD dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) -const BYTE RFaby11aChannelIndex[200] = { +const u8 RFaby11aChannelIndex[200] = { // 1 2 3 4 5 6 7 8 9 10 00, 00, 00, 00, 00, 00, 23, 24, 25, 00, // 10 26, 27, 00, 00, 00, 28, 00, 00, 00, 00, // 20 @@ -722,24 +722,20 @@ const BYTE RFaby11aChannelIndex[200] = { * Return Value: TRUE if succeeded; FALSE if failed. * */ -BOOL IFRFbWriteEmbedded (PSDevice pDevice, DWORD dwData) +int IFRFbWriteEmbedded(struct vnt_private *pDevice, u32 dwData) { - BYTE pbyData[4]; + u8 pbyData[4]; - pbyData[0] = (BYTE)dwData; - pbyData[1] = (BYTE)(dwData>>8); - pbyData[2] = (BYTE)(dwData>>16); - pbyData[3] = (BYTE)(dwData>>24); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_IFRF, - 0, - 0, - 4, - pbyData - ); + pbyData[0] = (u8)dwData; + pbyData[1] = (u8)(dwData >> 8); + pbyData[2] = (u8)(dwData >> 16); + pbyData[3] = (u8)(dwData >> 24); + + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_WRITE_IFRF, 0, 0, 4, pbyData); - return TRUE; + return TRUE; } @@ -756,18 +752,13 @@ BOOL IFRFbWriteEmbedded (PSDevice pDevice, DWORD dwData) * Return Value: TRUE if succeeded; FALSE if failed. * */ -BOOL RFbSetPower ( - PSDevice pDevice, - unsigned int uRATE, - unsigned int uCH - ) +int RFbSetPower(struct vnt_private *pDevice, u32 uRATE, u32 uCH) { -BOOL bResult = TRUE; -BYTE byPwr = pDevice->byCCKPwr; + int bResult = TRUE; + u8 byPwr = pDevice->byCCKPwr; - if (pDevice->dwDiagRefCount != 0) { - return TRUE; - } + if (pDevice->dwDiagRefCount) + return TRUE; if (uCH == 0) return -EINVAL; @@ -813,13 +804,10 @@ BYTE byPwr = pDevice->byCCKPwr; * Return Value: TRUE if succeeded; FALSE if failed. * */ -BOOL RFbRawSetPower ( - PSDevice pDevice, - BYTE byPwr, - unsigned int uRATE - ) + +int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) { -BOOL bResult = TRUE; + int bResult = TRUE; if (pDevice->byCurPwr == byPwr) return TRUE; @@ -957,17 +945,12 @@ BOOL bResult = TRUE; * Return Value: none * -*/ -void -RFvRSSITodBm ( - PSDevice pDevice, - BYTE byCurrRSSI, - long * pldBm - ) +void RFvRSSITodBm(struct vnt_private *pDevice, u8 byCurrRSSI, long *pldBm) { - BYTE byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03); - signed long b = (byCurrRSSI & 0x3F); - signed long a = 0; - BYTE abyAIROHARF[4] = {0, 18, 0, 40}; + u8 byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03); + signed long b = (byCurrRSSI & 0x3F); + signed long a = 0; + u8 abyAIROHARF[4] = {0, 18, 0, 40}; switch (pDevice->byRFType) { case RF_AL2230: @@ -987,15 +970,12 @@ RFvRSSITodBm ( -void -RFbRFTableDownload ( - PSDevice pDevice - ) +void RFbRFTableDownload(struct vnt_private *pDevice) { -WORD wLength1 = 0,wLength2 = 0 ,wLength3 = 0; -PBYTE pbyAddr1 = NULL,pbyAddr2 = NULL,pbyAddr3 = NULL; -WORD wLength,wValue; -BYTE abyArray[256]; + u16 wLength1 = 0, wLength2 = 0, wLength3 = 0; + u8 *pbyAddr1 = NULL, *pbyAddr2 = NULL, *pbyAddr3 = NULL; + u16 wLength, wValue; + u8 abyArray[256]; switch ( pDevice->byRFType ) { case RF_AL2230: @@ -1134,21 +1114,19 @@ BYTE abyArray[256]; } -// RobertYu:20060412, TWIF1.11 adjust LO Current for 11b mode -BOOL s_bVT3226D0_11bLoCurrentAdjust( - PSDevice pDevice, - BYTE byChannel, - BOOL b11bMode) +int s_bVT3226D0_11bLoCurrentAdjust(struct vnt_private *pDevice, u8 byChannel, + int b11bMode) { - BOOL bResult; + int bResult = TRUE; - bResult = TRUE; - if( b11bMode ) - bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226D0LoCurrentTable[byChannel-1]); - else - bResult &= IFRFbWriteEmbedded(pDevice, 0x016BC600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060412 + if (b11bMode) + bResult &= IFRFbWriteEmbedded(pDevice, + dwVT3226D0LoCurrentTable[byChannel-1]); + else + bResult &= IFRFbWriteEmbedded(pDevice, 0x016bc600 + + (BY_VT3226_REG_LEN << 3) + IFREGCTL_REGW); - return bResult; + return bResult; } diff --git a/drivers/staging/vt6656/rf.h b/drivers/staging/vt6656/rf.h index 72eb27ac436b..9f70cf740bae 100644 --- a/drivers/staging/vt6656/rf.h +++ b/drivers/staging/vt6656/rf.h @@ -60,25 +60,15 @@ /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ -extern const BYTE RFaby11aChannelIndex[200]; +extern const u8 RFaby11aChannelIndex[200]; /*--------------------- Export Functions --------------------------*/ -BOOL IFRFbWriteEmbedded(PSDevice pDevice, DWORD dwData); -BOOL RFbSetPower(PSDevice pDevice, unsigned int uRATE, unsigned int uCH); - -BOOL RFbRawSetPower( - PSDevice pDevice, - BYTE byPwr, - unsigned int uRATE - ); - -void RFvRSSITodBm(PSDevice pDevice, BYTE byCurrRSSI, long *pldBm); -void RFbRFTableDownload(PSDevice pDevice); - -BOOL s_bVT3226D0_11bLoCurrentAdjust( - PSDevice pDevice, - BYTE byChannel, - BOOL b11bMode - ); +int IFRFbWriteEmbedded(struct vnt_private *, u32 dwData); +int RFbSetPower(struct vnt_private *, u32 uRATE, u32 uCH); +int RFbRawSetPower(struct vnt_private *, u8 byPwr, u32 uRATE); +void RFvRSSITodBm(struct vnt_private *, u8 byCurrRSSI, long *pldBm); +void RFbRFTableDownload(struct vnt_private *pDevice); +int s_bVT3226D0_11bLoCurrentAdjust(struct vnt_private *, u8 byChannel, + int b11bMode); #endif /* __RF_H__ */ diff --git a/drivers/staging/vt6656/ttype.h b/drivers/staging/vt6656/ttype.h index dfbf74713a80..89ab49492202 100644 --- a/drivers/staging/vt6656/ttype.h +++ b/drivers/staging/vt6656/ttype.h @@ -48,18 +48,6 @@ typedef u8 BYTE; typedef u16 WORD; typedef u32 DWORD; -// QWORD is for those situation that we want -// an 8-byte-aligned 8 byte long structure -// which is NOT really a floating point number. -typedef union tagUQuadWord { - struct { - u32 dwLowDword; - u32 dwHighDword; - } u; - double DoNotUseThisField; -} UQuadWord; -typedef UQuadWord QWORD; // 64-bit - /****** Common pointer types ***********************************************/ typedef u32 ULONG_PTR; @@ -73,6 +61,4 @@ typedef WORD * PWORD; typedef DWORD * PDWORD; -typedef QWORD * PQWORD; - #endif /* __TTYPE_H__ */ diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index fc68518526e0..2a020672a14b 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -67,51 +67,18 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ -static -void -s_nsInterruptUsbIoCompleteRead( - struct urb *urb - ); - - -static -void -s_nsBulkInUsbIoCompleteRead( - struct urb *urb - ); - - -static -void -s_nsBulkOutIoCompleteWrite( - struct urb *urb - ); - - -static -void -s_nsControlInUsbIoCompleteRead( - struct urb *urb - ); - -static -void -s_nsControlInUsbIoCompleteWrite( - struct urb *urb - ); +static void s_nsInterruptUsbIoCompleteRead(struct urb *urb); +static void s_nsBulkInUsbIoCompleteRead(struct urb *urb); +static void s_nsBulkOutIoCompleteWrite(struct urb *urb); +static void s_nsControlInUsbIoCompleteRead(struct urb *urb); +static void s_nsControlInUsbIoCompleteWrite(struct urb *urb); /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -int PIPEnsControlOutAsyn( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ) +int PIPEnsControlOutAsyn(struct vnt_private *pDevice, u8 byRequest, + u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer) { int ntStatus; @@ -147,17 +114,11 @@ int PIPEnsControlOutAsyn( return ntStatus; } -int PIPEnsControlOut( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ) +int PIPEnsControlOut(struct vnt_private *pDevice, u8 byRequest, u16 wValue, + u16 wIndex, u16 wLength, u8 *pbyBuffer) { int ntStatus = 0; - int ii; + int ii; if (pDevice->Flags & fMP_DISCONNECTED) return STATUS_FAILURE; @@ -206,17 +167,11 @@ int PIPEnsControlOut( return STATUS_SUCCESS; } -int PIPEnsControlIn( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ) +int PIPEnsControlIn(struct vnt_private *pDevice, u8 byRequest, u16 wValue, + u16 wIndex, u16 wLength, u8 *pbyBuffer) { int ntStatus = 0; - int ii; + int ii; if (pDevice->Flags & fMP_DISCONNECTED) return STATUS_FAILURE; @@ -263,13 +218,9 @@ int PIPEnsControlIn( return ntStatus; } -static -void -s_nsControlInUsbIoCompleteWrite( - struct urb *urb - ) +static void s_nsControlInUsbIoCompleteWrite(struct urb *urb) { - PSDevice pDevice; + struct vnt_private *pDevice = (struct vnt_private *)urb->context; pDevice = urb->context; switch (urb->status) { @@ -304,15 +255,11 @@ s_nsControlInUsbIoCompleteWrite( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -static -void -s_nsControlInUsbIoCompleteRead( - struct urb *urb - ) + +static void s_nsControlInUsbIoCompleteRead(struct urb *urb) { - PSDevice pDevice; + struct vnt_private *pDevice = (struct vnt_private *)urb->context; - pDevice = urb->context; switch (urb->status) { case 0: break; @@ -345,9 +292,10 @@ s_nsControlInUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -int PIPEnsInterruptRead(PSDevice pDevice) + +int PIPEnsInterruptRead(struct vnt_private *pDevice) { - int ntStatus = STATUS_FAILURE; + int ntStatus = STATUS_FAILURE; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartInterruptUsbRead()\n"); @@ -396,21 +344,16 @@ usb_fill_bulk_urb(pDevice->pInterruptURB, * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -static -void -s_nsInterruptUsbIoCompleteRead( - struct urb *urb - ) +static void s_nsInterruptUsbIoCompleteRead(struct urb *urb) { - PSDevice pDevice; - int ntStatus; + struct vnt_private *pDevice = (struct vnt_private *)urb->context; + int ntStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptUsbIoCompleteRead\n"); // // The context given to IoSetCompletionRoutine is the receive buffer object // - pDevice = (PSDevice)urb->context; // // We have a number of cases: @@ -483,10 +426,11 @@ s_nsInterruptUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB) + +int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB) { int ntStatus = 0; - struct urb *pUrb; + struct urb *pUrb; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n"); @@ -543,19 +487,15 @@ int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB) * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -static -void -s_nsBulkInUsbIoCompleteRead( - struct urb *urb - ) +static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) { - PRCB pRCB = (PRCB)urb->context; - PSDevice pDevice = (PSDevice)pRCB->pDevice; - unsigned long bytesRead; - BOOL bIndicateReceive = FALSE; - BOOL bReAllocSkb = FALSE; - int status; + PRCB pRCB = (PRCB)urb->context; + struct vnt_private *pDevice = pRCB->pDevice; + unsigned long bytesRead; + int bIndicateReceive = FALSE; + int bReAllocSkb = FALSE; + int status; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkInUsbIoCompleteRead\n"); status = urb->status; @@ -618,14 +558,11 @@ s_nsBulkInUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -int -PIPEnsSendBulkOut( - PSDevice pDevice, - PUSB_SEND_CONTEXT pContext - ) + +int PIPEnsSendBulkOut(struct vnt_private *pDevice, PUSB_SEND_CONTEXT pContext) { - int status; - struct urb *pUrb; + int status; + struct urb *pUrb; @@ -699,17 +636,14 @@ PIPEnsSendBulkOut( * (IofCompleteRequest) to stop working on the irp. * */ -static -void -s_nsBulkOutIoCompleteWrite( - struct urb *urb - ) + +static void s_nsBulkOutIoCompleteWrite(struct urb *urb) { - PSDevice pDevice; - int status; - CONTEXT_TYPE ContextType; - unsigned long ulBufLen; - PUSB_SEND_CONTEXT pContext; + struct vnt_private *pDevice; + int status; + CONTEXT_TYPE ContextType; + unsigned long ulBufLen; + PUSB_SEND_CONTEXT pContext; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n"); diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h index b3673474a9e1..b3023559c15b 100644 --- a/drivers/staging/vt6656/usbpipe.h +++ b/drivers/staging/vt6656/usbpipe.h @@ -41,35 +41,15 @@ /*--------------------- Export Functions --------------------------*/ -int PIPEnsControlOut( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ); - -int PIPEnsControlOutAsyn( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ); - -int PIPEnsControlIn( - PSDevice pDevice, - BYTE byRequest, - WORD wValue, - WORD wIndex, - WORD wLength, - PBYTE pbyBuffer - ); - -int PIPEnsInterruptRead(PSDevice pDevice); -int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB); -int PIPEnsSendBulkOut(PSDevice pDevice, PUSB_SEND_CONTEXT pContext); +int PIPEnsControlOut(struct vnt_private *, u8 byRequest, u16 wValue, + u16 wIndex, u16 wLength, u8 *pbyBuffer); +int PIPEnsControlOutAsyn(struct vnt_private *, u8 byRequest, + u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer); +int PIPEnsControlIn(struct vnt_private *, u8 byRequest, u16 wValue, + u16 wIndex, u16 wLength, u8 *pbyBuffer); + +int PIPEnsInterruptRead(struct vnt_private *); +int PIPEnsBulkInUsbRead(struct vnt_private *, PRCB pRCB); +int PIPEnsSendBulkOut(struct vnt_private *, PUSB_SEND_CONTEXT pContext); #endif /* __USBPIPE_H__ */ diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 22f6b41cfd19..51f48c1244f6 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -68,33 +68,17 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; /*--------------------- Static Functions --------------------------*/ -static -void -s_vProbeChannel( - PSDevice pDevice - ); +static void s_vProbeChannel(struct vnt_private *); +static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *, + struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -static -PSTxMgmtPacket -s_MgrMakeProbeRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pScanBSSID, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +static int s_bCommandComplete(struct vnt_private *); -static -BOOL -s_bCommandComplete ( - PSDevice pDevice - ); - -static BOOL s_bClearBSSID_SCAN(void *hDeviceContext); +static int s_bClearBSSID_SCAN(struct vnt_private *); /*--------------------- Export Variables --------------------------*/ @@ -114,13 +98,10 @@ static BOOL s_bClearBSSID_SCAN(void *hDeviceContext); * */ -static -void -vAdHocBeaconStop(PSDevice pDevice) +static void vAdHocBeaconStop(struct vnt_private *pDevice) { - - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - BOOL bStop; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int bStop; /* * temporarily stop Beacon packet for AdHoc Server @@ -171,11 +152,9 @@ vAdHocBeaconStop(PSDevice pDevice) * Return Value: none * */ -static -void -vAdHocBeaconRestart(PSDevice pDevice) +static void vAdHocBeaconRestart(struct vnt_private *pDevice) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; /* * Restart Beacon packet for AdHoc Server @@ -204,22 +183,22 @@ vAdHocBeaconRestart(PSDevice pDevice) * -*/ -static -void -s_vProbeChannel( - PSDevice pDevice - ) +static void s_vProbeChannel(struct vnt_private *pDevice) { - //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M - BYTE abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; - BYTE abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60}; - //6M, 9M, 12M, 48M - BYTE abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; - BYTE abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; - PBYTE pbyRate; - PSTxMgmtPacket pTxPacket; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - unsigned int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_tx_mgmt *pTxPacket; + u8 abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, + 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; + /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ + u8 abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, + 4, 0x0C, 0x12, 0x18, 0x60}; + /* 6M, 9M, 12M, 48M*/ + u8 abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, + 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; + u8 abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, + 4, 0x02, 0x04, 0x0B, 0x16}; + u8 *pbyRate; + int ii; if (pDevice->byBBType == BB_TYPE_11A) { @@ -268,24 +247,19 @@ s_vProbeChannel( -*/ -PSTxMgmtPacket -s_MgrMakeProbeRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pScanBSSID, - PWLAN_IE_SSID pSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - - ) +struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_PROBEREQ sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_PROBEREQ sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBEREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_PROBEREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_PROBEREQ_FR_MAXLEN; vMgrEncodeProbeRequest(&sFrame); @@ -316,9 +290,8 @@ s_MgrMakeProbeRequest( return pTxPacket; } -void vCommandTimerWait(void *hDeviceContext, unsigned long MSecond) +void vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond) { - PSDevice pDevice = (PSDevice)hDeviceContext; init_timer(&pDevice->sTimerCommand); @@ -331,18 +304,17 @@ void vCommandTimerWait(void *hDeviceContext, unsigned long MSecond) return; } -void vRunCommand(void *hDeviceContext) +void vRunCommand(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PWLAN_IE_SSID pItemSSID; - PWLAN_IE_SSID pItemSSIDCurr; - CMD_STATUS Status; - unsigned int ii; - BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; - struct sk_buff *skb; - BYTE byData; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PWLAN_IE_SSID pItemSSID; + PWLAN_IE_SSID pItemSSIDCurr; + CMD_STATUS Status; + struct sk_buff *skb; union iwreq_data wrqu; + int ii; + u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; + u8 byData; if (pDevice->dwDiagRefCount != 0) @@ -1043,17 +1015,12 @@ void vRunCommand(void *hDeviceContext) } -static -BOOL -s_bCommandComplete ( - PSDevice pDevice - ) +static int s_bCommandComplete(struct vnt_private *pDevice) { - PWLAN_IE_SSID pSSID; - BOOL bRadioCmd = FALSE; - //WORD wDeAuthenReason = 0; - BOOL bForceSCAN = TRUE; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PWLAN_IE_SSID pSSID; + int bRadioCmd = FALSE; + int bForceSCAN = TRUE; pDevice->eCommandState = WLAN_CMD_IDLE; @@ -1146,18 +1113,15 @@ s_bCommandComplete ( break; } - vCommandTimerWait((void *) pDevice, 0); + vCommandTimerWait(pDevice, 0); } return TRUE; } -BOOL bScheduleCommand(void *hDeviceContext, - CMD_CODE eCommand, - PBYTE pbyItem0) +int bScheduleCommand(struct vnt_private *pDevice, + CMD_CODE eCommand, u8 *pbyItem0) { - PSDevice pDevice = (PSDevice)hDeviceContext; - if (pDevice->cbFreeCmdQueue == 0) { return (FALSE); @@ -1222,11 +1186,10 @@ BOOL bScheduleCommand(void *hDeviceContext, * Return Value: TRUE if success; otherwise FALSE * */ -static BOOL s_bClearBSSID_SCAN(void *hDeviceContext) +static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; - unsigned int ii; + unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; + unsigned int ii; if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii ++) { @@ -1242,9 +1205,8 @@ static BOOL s_bClearBSSID_SCAN(void *hDeviceContext) //mike add:reset command timer -void vResetCommandTimer(void *hDeviceContext) +void vResetCommandTimer(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; //delete timer del_timer(&pDevice->sTimerCommand); @@ -1261,10 +1223,9 @@ void vResetCommandTimer(void *hDeviceContext) pDevice->bCmdClear = FALSE; } -void BSSvSecondTxData(void *hDeviceContext) +void BSSvSecondTxData(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; pDevice->nTxDataTimeCout++; diff --git a/drivers/staging/vt6656/wcmd.h b/drivers/staging/vt6656/wcmd.h index d24a79dce61a..a3d03234d0a1 100644 --- a/drivers/staging/vt6656/wcmd.h +++ b/drivers/staging/vt6656/wcmd.h @@ -28,7 +28,6 @@ #ifndef __WCMD_H__ #define __WCMD_H__ - #include "ttype.h" #include "80211hdr.h" #include "80211mgr.h" @@ -112,14 +111,13 @@ typedef enum tagCMD_STATE { /*--------------------- Export Types ------------------------------*/ /*--------------------- Export Functions --------------------------*/ +struct vnt_private; -void vResetCommandTimer(void *hDeviceContext); +void vResetCommandTimer(struct vnt_private *); -BOOL bScheduleCommand(void *hDeviceContext, - CMD_CODE eCommand, - PBYTE pbyItem0); +int bScheduleCommand(struct vnt_private *, CMD_CODE eCommand, u8 *pbyItem0); -void vRunCommand(void *hDeviceContext); +void vRunCommand(struct vnt_private *); /* void @@ -128,6 +126,6 @@ WCMDvCommandThread( ); */ -void BSSvSecondTxData(void *hDeviceContext); +void BSSvSecondTxData(struct vnt_private *); #endif /* __WCMD_H__ */ diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index 9249263b2da8..18a09a3a4130 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -113,7 +113,8 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) * */ -unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) +unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice, + PS802_11Header pMACHeader) { unsigned int ii; @@ -141,7 +142,8 @@ unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) * Return Value: index number in Defragment Database * */ -unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) +unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, + PS802_11Header pMACHeader) { unsigned int ii; @@ -180,10 +182,10 @@ unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) * Return Value: TRUE if it is valid fragment packet and we have resource to defragment; otherwise FALSE * */ -BOOL WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, - unsigned int cbFrameLength, BOOL bWEP, BOOL bExtIV) +int WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader, + unsigned int cbFrameLength, int bWEP, int bExtIV) { -unsigned int uHeaderSize; + unsigned int uHeaderSize; if (bWEP == TRUE) { diff --git a/drivers/staging/vt6656/wctl.h b/drivers/staging/vt6656/wctl.h index 7270af68c89d..a509f6330801 100644 --- a/drivers/staging/vt6656/wctl.h +++ b/drivers/staging/vt6656/wctl.h @@ -97,9 +97,9 @@ /*--------------------- Export Functions --------------------------*/ BOOL WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); -BOOL WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, - unsigned int cbFrameLength, BOOL bWEP, BOOL bExtIV); -unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader); -unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader); +int WCTLbHandleFragment(struct vnt_private *, PS802_11Header pMACHeader, + unsigned int cbFrameLength, BOOL bWEP, BOOL bExtIV); +unsigned int WCTLuSearchDFCB(struct vnt_private *, PS802_11Header pMACHeader); +unsigned int WCTLuInsertDFCB(struct vnt_private *, PS802_11Header pMACHeader); #endif /* __WCTL_H__ */ diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index 95ddc8303bb3..89491ae71b4e 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -93,227 +93,98 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ -static BOOL ChannelExceedZoneType( - PSDevice pDevice, - BYTE byCurrChannel - ); +static int ChannelExceedZoneType(struct vnt_private *, u8 byCurrChannel); -// Association/diassociation functions -static -PSTxMgmtPacket -s_MgrMakeAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pDAddr, - WORD wCurrCapInfo, - WORD wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +/* Association/diassociation functions */ +static struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *, + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -static -void -s_vMgrRxAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - unsigned int uNodeIndex - ); +static void s_vMgrRxAssocRequest(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex); -static -PSTxMgmtPacket -s_MgrMakeReAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pDAddr, - WORD wCurrCapInfo, - WORD wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +static struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *, + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -static -void -s_vMgrRxAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - BOOL bReAssocType - ); +static void s_vMgrRxAssocResponse(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bReAssocType); -static -void -s_vMgrRxDisassociation( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +static void s_vMgrRxDisassociation(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -// Authentication/deauthen functions -static -void -s_vMgrRxAuthenSequence_1( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ); +/* Authentication/deauthen functions */ +static void s_vMgrRxAuthenSequence_1(struct vnt_private *, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); -static -void -s_vMgrRxAuthenSequence_2( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ); +static void s_vMgrRxAuthenSequence_2(struct vnt_private *, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); -static -void -s_vMgrRxAuthenSequence_3( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ); +static void s_vMgrRxAuthenSequence_3(struct vnt_private *, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); -static -void -s_vMgrRxAuthenSequence_4( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ); +static void s_vMgrRxAuthenSequence_4(struct vnt_private *, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame); -static -void -s_vMgrRxAuthentication( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +static void s_vMgrRxAuthentication(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -static -void -s_vMgrRxDeauthentication( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +static void s_vMgrRxDeauthentication(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -// Scan functions -// probe request/response functions -static -void -s_vMgrRxProbeRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +/* Scan functions +* probe request/response functions */ -static -void -s_vMgrRxProbeResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ); +static void s_vMgrRxProbeRequest(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -// beacon functions -static -void -s_vMgrRxBeacon( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - BOOL bInScan - ); +static void s_vMgrRxProbeResponse(struct vnt_private *, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket); -static -void -s_vMgrFormatTIM( - PSMgmtObject pMgmt, - PWLAN_IE_TIM pTIM - ); +/* beacon functions */ +static void s_vMgrRxBeacon(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bInScan); -static -PSTxMgmtPacket -s_MgrMakeBeacon( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wCurrBeaconPeriod, - unsigned int uCurrChannel, - WORD wCurrATIMWinodw, - PWLAN_IE_SSID pCurrSSID, - PBYTE pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM); +static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, PWLAN_IE_SSID pCurrSSID, + u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -// Association response -static -PSTxMgmtPacket -s_MgrMakeAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wAssocStatus, - WORD wAssocAID, - PBYTE pDstAddr, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); -// ReAssociation response -static -PSTxMgmtPacket -s_MgrMakeReAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wAssocStatus, - WORD wAssocAID, - PBYTE pDstAddr, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ); +/* Association response */ +static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -// Probe response -static -PSTxMgmtPacket -s_MgrMakeProbeResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wCurrBeaconPeriod, - unsigned int uCurrChannel, - WORD wCurrATIMWinodw, - PBYTE pDstAddr, - PWLAN_IE_SSID pCurrSSID, - PBYTE pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates, - BYTE byPHYType - ); +/* ReAssociation response */ +static struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates); -// received status -static -void -s_vMgrLogStatus( - PSMgmtObject pMgmt, - WORD wStatus - ); +/* Probe response */ +static struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, + PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates, u8 byPHYType); +/* received status */ +static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus); -static -void -s_vMgrSynchBSS ( - PSDevice pDevice, - unsigned int uBSSMode, - PKnownBSS pCurr, - PCMD_STATUS pStatus - ); + +static void s_vMgrSynchBSS(struct vnt_private *, u32 uBSSMode, + PKnownBSS pCurr, PCMD_STATUS pStatus); static BOOL @@ -324,10 +195,7 @@ s_bCipherMatch ( PBYTE pbyCCSGK ); - static void Encyption_Rebuild( - PSDevice pDevice, - PKnownBSS pCurr - ); +static void Encyption_Rebuild(struct vnt_private *, PKnownBSS pCurr); /*--------------------- Export Variables --------------------------*/ @@ -343,11 +211,10 @@ s_bCipherMatch ( * -*/ -void vMgrObjectInit(void *hDeviceContext) +void vMgrObjectInit(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - int ii; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + int ii; pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0]; @@ -402,12 +269,10 @@ void vMgrObjectInit(void *hDeviceContext) * -*/ -void vMgrAssocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus) +void vMgrAssocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket; + struct vnt_tx_mgmt *pTxPacket; pMgmt->wCurrCapInfo = 0; @@ -475,14 +340,10 @@ void vMgrAssocBeginSta(void *hDeviceContext, * -*/ -void vMgrReAssocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus) +void vMgrReAssocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket; - - + struct vnt_tx_mgmt *pTxPacket; pMgmt->wCurrCapInfo = 0; pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); @@ -551,19 +412,18 @@ void vMgrReAssocBeginSta(void *hDeviceContext, * -*/ -void vMgrDisassocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PBYTE abyDestAddress, - WORD wReason, - PCMD_STATUS pStatus) +void vMgrDisassocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_DISASSOC sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_DISASSOC sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DISASSOC_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_DISASSOC_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; @@ -610,23 +470,18 @@ void vMgrDisassocBeginSta(void *hDeviceContext, * -*/ -static -void -s_vMgrRxAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - unsigned int uNodeIndex - ) +static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex) { - WLAN_FR_ASSOCREQ sFrame; - CMD_STATUS Status; - PSTxMgmtPacket pTxPacket; - WORD wAssocStatus = 0; - WORD wAssocAID = 0; - unsigned int uRateLen = WLAN_RATES_MAXLEN; - BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + WLAN_FR_ASSOCREQ sFrame; + CMD_STATUS Status; + struct vnt_tx_mgmt *pTxPacket; + u16 wAssocStatus = 0; + u16 wAssocAID = 0; + u32 uRateLen = WLAN_RATES_MAXLEN; + u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) @@ -766,23 +621,18 @@ s_vMgrRxAssocRequest( * -*/ -static -void -s_vMgrRxReAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - unsigned int uNodeIndex - ) +static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + u32 uNodeIndex) { - WLAN_FR_REASSOCREQ sFrame; - CMD_STATUS Status; - PSTxMgmtPacket pTxPacket; - WORD wAssocStatus = 0; - WORD wAssocAID = 0; - unsigned int uRateLen = WLAN_RATES_MAXLEN; - BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + WLAN_FR_REASSOCREQ sFrame; + CMD_STATUS Status; + struct vnt_tx_mgmt *pTxPacket; + u16 wAssocStatus = 0; + u16 wAssocAID = 0; + u32 uRateLen = WLAN_RATES_MAXLEN; + u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; + u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) return; @@ -913,18 +763,13 @@ s_vMgrRxReAssocRequest( * -*/ -static -void -s_vMgrRxAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - BOOL bReAssocType - ) +static void s_vMgrRxAssocResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bReAssocType) { - WLAN_FR_ASSOCRESP sFrame; - PWLAN_IE_SSID pItemSSID; - PBYTE pbyIEs; + WLAN_FR_ASSOCRESP sFrame; + PWLAN_IE_SSID pItemSSID; + u8 *pbyIEs; @@ -1050,17 +895,17 @@ if(pMgmt->eCurrState == WMAC_STATE_ASSOC) * -*/ -void vMgrAuthenBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus) +void vMgrAuthenBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - WLAN_FR_AUTHEN sFrame; - PSTxMgmtPacket pTxPacket = NULL; - - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + WLAN_FR_AUTHEN sFrame; + struct vnt_tx_mgmt *pTxPacket = + (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_AUTHEN_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; vMgrEncodeAuthen(&sFrame); @@ -1103,20 +948,18 @@ void vMgrAuthenBeginSta(void *hDeviceContext, * -*/ -void vMgrDeAuthenBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PBYTE abyDestAddress, - WORD wReason, - PCMD_STATUS pStatus) +void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - WLAN_FR_DEAUTHEN sFrame; - PSTxMgmtPacket pTxPacket = NULL; - - - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DEAUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + WLAN_FR_DEAUTHEN sFrame; + struct vnt_tx_mgmt *pTxPacket = + (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_DEAUTHEN_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_DEAUTHEN_FR_MAXLEN; vMgrEncodeDeauthen(&sFrame); @@ -1156,15 +999,10 @@ void vMgrDeAuthenBeginSta(void *hDeviceContext, * -*/ -static -void -s_vMgrRxAuthentication( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxAuthentication(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - WLAN_FR_AUTHEN sFrame; + WLAN_FR_AUTHEN sFrame; // we better be an AP or a STA in AUTHPENDING otherwise ignore if (!(pMgmt->eCurrMode == WMAC_MODE_ESS_AP || @@ -1214,25 +1052,21 @@ s_vMgrRxAuthentication( -*/ -static -void -s_vMgrRxAuthenSequence_1( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ) +static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { - PSTxMgmtPacket pTxPacket = NULL; - unsigned int uNodeIndex; - WLAN_FR_AUTHEN sFrame; - PSKeyItem pTransmitKey; - - // Insert a Node entry - if (!BSSbIsSTAInNodeDB(pDevice, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) { - BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); - memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, pFrame->pHdr->sA3.abyAddr2, - WLAN_ADDR_LEN); - } + struct vnt_tx_mgmt *pTxPacket = NULL; + u32 uNodeIndex; + WLAN_FR_AUTHEN sFrame; + PSKeyItem pTransmitKey; + + /* Insert a Node entry */ + if (!BSSbIsSTAInNodeDB(pDevice, pFrame->pHdr->sA3.abyAddr2, + &uNodeIndex)) { + BSSvCreateOneNode(pDevice, &uNodeIndex); + memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, + pFrame->pHdr->sA3.abyAddr2, WLAN_ADDR_LEN); + } if (pMgmt->bShareKeyAlgorithm) { pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_KNOWN; @@ -1243,9 +1077,11 @@ s_vMgrRxAuthenSequence_1( } // send auth reply - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_AUTHEN_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure @@ -1320,16 +1156,11 @@ s_vMgrRxAuthenSequence_1( * -*/ -static -void -s_vMgrRxAuthenSequence_2( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ) +static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { - WLAN_FR_AUTHEN sFrame; - PSTxMgmtPacket pTxPacket = NULL; + WLAN_FR_AUTHEN sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) @@ -1355,9 +1186,13 @@ s_vMgrRxAuthenSequence_2( case WLAN_AUTH_ALG_SHAREDKEY: if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) { - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *) + pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_AUTHEN_FR_MAXLEN); + pTxPacket->p80211Header + = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure @@ -1421,18 +1256,13 @@ s_vMgrRxAuthenSequence_2( * -*/ -static -void -s_vMgrRxAuthenSequence_3( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ) +static void s_vMgrRxAuthenSequence_3(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { - PSTxMgmtPacket pTxPacket = NULL; - unsigned int uStatusCode = 0 ; - unsigned int uNodeIndex = 0; - WLAN_FR_AUTHEN sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + u32 uStatusCode = 0 ; + u32 uNodeIndex = 0; + WLAN_FR_AUTHEN sFrame; if (!WLAN_GET_FC_ISWEP(pFrame->pHdr->sA3.wFrameCtl)) { uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL; @@ -1462,9 +1292,11 @@ s_vMgrRxAuthenSequence_3( reply: // send auth reply - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_AUTHEN_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_AUTHEN_FR_MAXLEN; // format buffer structure @@ -1509,13 +1341,8 @@ reply: * None. * -*/ -static -void -s_vMgrRxAuthenSequence_4( - PSDevice pDevice, - PSMgmtObject pMgmt, - PWLAN_FR_AUTHEN pFrame - ) +static void s_vMgrRxAuthenSequence_4(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ @@ -1547,17 +1374,12 @@ s_vMgrRxAuthenSequence_4( * -*/ -static -void -s_vMgrRxDisassociation( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxDisassociation(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - WLAN_FR_DISASSOC sFrame; - unsigned int uNodeIndex = 0; - CMD_STATUS CmdStatus; + WLAN_FR_DISASSOC sFrame; + u32 uNodeIndex = 0; + CMD_STATUS CmdStatus; if ( pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){ // if is acting an AP.. @@ -1587,7 +1409,7 @@ s_vMgrRxDisassociation( pDevice->byReAssocCount = 0; pMgmt->eCurrState = WMAC_STATE_AUTH; // jump back to the auth state! pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; - vMgrReAssocBeginSta((PSDevice)pDevice, pMgmt, &CmdStatus); + vMgrReAssocBeginSta(pDevice, pMgmt, &CmdStatus); if(CmdStatus == CMD_STATUS_PENDING) { pDevice->byReAssocCount ++; return; //mike add: you'll retry for many times, so it cann't be regarded as disconnected! @@ -1620,16 +1442,11 @@ s_vMgrRxDisassociation( * -*/ -static -void -s_vMgrRxDeauthentication( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxDeauthentication(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - WLAN_FR_DEAUTHEN sFrame; - unsigned int uNodeIndex = 0; + WLAN_FR_DEAUTHEN sFrame; + u32 uNodeIndex = 0; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){ @@ -1692,13 +1509,9 @@ s_vMgrRxDeauthentication( * True:exceed; * False:normal case -*/ -static BOOL -ChannelExceedZoneType( - PSDevice pDevice, - BYTE byCurrChannel - ) +static int ChannelExceedZoneType(struct vnt_private *pDevice, u8 byCurrChannel) { - BOOL exceed=FALSE; + int exceed = FALSE; switch(pDevice->byZoneType) { case 0x00: //USA:1~11 @@ -1728,39 +1541,33 @@ ChannelExceedZoneType( * -*/ -static -void -s_vMgrRxBeacon( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket, - BOOL bInScan - ) +static void s_vMgrRxBeacon(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket, + int bInScan) { - - PKnownBSS pBSSList; - WLAN_FR_BEACON sFrame; - QWORD qwTSFOffset; - BOOL bIsBSSIDEqual = FALSE; - BOOL bIsSSIDEqual = FALSE; - BOOL bTSFLargeDiff = FALSE; - BOOL bTSFOffsetPostive = FALSE; - BOOL bUpdateTSF = FALSE; - BOOL bIsAPBeacon = FALSE; - BOOL bIsChannelEqual = FALSE; - unsigned int uLocateByteIndex; - BYTE byTIMBitOn = 0; - WORD wAIDNumber = 0; - unsigned int uNodeIndex; - QWORD qwTimestamp, qwLocalTSF; - QWORD qwCurrTSF; - WORD wStartIndex = 0; - WORD wAIDIndex = 0; - BYTE byCurrChannel = pRxPacket->byRxChannel; - ERPObject sERP; - unsigned int uRateLen = WLAN_RATES_MAXLEN; - BOOL bChannelHit = FALSE; - BYTE byOldPreambleType; + PKnownBSS pBSSList; + WLAN_FR_BEACON sFrame; + u64 qwTSFOffset; + int bIsBSSIDEqual = FALSE; + int bIsSSIDEqual = FALSE; + int bTSFLargeDiff = FALSE; + int bTSFOffsetPostive = FALSE; + int bUpdateTSF = FALSE; + int bIsAPBeacon = FALSE; + int bIsChannelEqual = FALSE; + u32 uLocateByteIndex; + u8 byTIMBitOn = 0; + u16 wAIDNumber = 0; + u32 uNodeIndex; + u64 qwTimestamp, qwLocalTSF; + u64 qwCurrTSF; + u16 wStartIndex = 0; + u16 wAIDIndex = 0; + u8 byCurrChannel = pRxPacket->byRxChannel; + ERPObject sERP; + u32 uRateLen = WLAN_RATES_MAXLEN; + int bChannelHit = FALSE; + u8 byOldPreambleType; @@ -2013,26 +1820,14 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) } } - HIDWORD(qwTimestamp) = cpu_to_le32(HIDWORD(*sFrame.pqwTimestamp)); - LODWORD(qwTimestamp) = cpu_to_le32(LODWORD(*sFrame.pqwTimestamp)); - HIDWORD(qwLocalTSF) = HIDWORD(pRxPacket->qwLocalTSF); - LODWORD(qwLocalTSF) = LODWORD(pRxPacket->qwLocalTSF); + qwTimestamp = cpu_to_le64(*sFrame.pqwTimestamp); + qwLocalTSF = pRxPacket->qwLocalTSF; // check if beacon TSF larger or small than our local TSF - if (HIDWORD(qwTimestamp) == HIDWORD(qwLocalTSF)) { - if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF)) { - bTSFOffsetPostive = TRUE; - } - else { - bTSFOffsetPostive = FALSE; - } - } - else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF)) { - bTSFOffsetPostive = TRUE; - } - else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF)) { - bTSFOffsetPostive = FALSE; - } + if (qwTimestamp >= qwLocalTSF) + bTSFOffsetPostive = TRUE; + else + bTSFOffsetPostive = FALSE; if (bTSFOffsetPostive) { qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF)); @@ -2041,10 +1836,8 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp)); } - if (HIDWORD(qwTSFOffset) != 0 || - (LODWORD(qwTSFOffset) > TRIVIAL_SYNC_DIFFERENCE )) { - bTSFLargeDiff = TRUE; - } + if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE) + bTSFLargeDiff = TRUE; // if infra mode @@ -2085,12 +1878,9 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) if (pMgmt->bInTIM || (pMgmt->bMulticastTIM && (pMgmt->byDTIMCount == 0))) { pMgmt->bInTIMWake = TRUE; - // send out ps-poll packet -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:In TIM\n"); - if (pMgmt->bInTIM) { - PSvSendPSPOLL((PSDevice)pDevice); -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:PS-POLL sent..\n"); - } + /* send out ps-poll packet */ + if (pMgmt->bInTIM) + PSvSendPSPOLL(pDevice); } else { @@ -2144,8 +1934,8 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) pMgmt->sNodeDBTable[uNodeIndex].uInActiveCount = 0; } else { - // Todo, initial Node content - BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); + /* Todo, initial Node content */ + BSSvCreateOneNode(pDevice, &uNodeIndex); pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, @@ -2256,26 +2046,22 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) * -*/ -void vMgrCreateOwnIBSS(void *hDeviceContext, - PCMD_STATUS pStatus) +void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - WORD wMaxBasicRate; - WORD wMaxSuppRate; - BYTE byTopCCKBasicRate; - BYTE byTopOFDMBasicRate; - QWORD qwCurrTSF; - unsigned int ii; - BYTE abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60}; - BYTE abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96}; - BYTE abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; - WORD wSuppRate; - + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u16 wMaxBasicRate; + u16 wMaxSuppRate; + u8 byTopCCKBasicRate; + u8 byTopOFDMBasicRate; + u64 qwCurrTSF = 0; + int ii; + u8 abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, + 0x12, 0x18, 0x60}; + u8 abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96}; + u8 abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; + u16 wSuppRate; - HIDWORD(qwCurrTSF) = 0; - LODWORD(qwCurrTSF) = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n"); @@ -2420,12 +2206,12 @@ void vMgrCreateOwnIBSS(void *hDeviceContext, if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { // BSSID selected must be randomized as spec 11.1.3 - pMgmt->abyCurrBSSID[5] = (BYTE) (LODWORD(qwCurrTSF)& 0x000000ff); - pMgmt->abyCurrBSSID[4] = (BYTE)((LODWORD(qwCurrTSF)& 0x0000ff00) >> 8); - pMgmt->abyCurrBSSID[3] = (BYTE)((LODWORD(qwCurrTSF)& 0x00ff0000) >> 16); - pMgmt->abyCurrBSSID[2] = (BYTE)((LODWORD(qwCurrTSF)& 0x00000ff0) >> 4); - pMgmt->abyCurrBSSID[1] = (BYTE)((LODWORD(qwCurrTSF)& 0x000ff000) >> 12); - pMgmt->abyCurrBSSID[0] = (BYTE)((LODWORD(qwCurrTSF)& 0x0ff00000) >> 20); + pMgmt->abyCurrBSSID[5] = (u8)(qwCurrTSF & 0x000000ff); + pMgmt->abyCurrBSSID[4] = (u8)((qwCurrTSF & 0x0000ff00) >> 8); + pMgmt->abyCurrBSSID[3] = (u8)((qwCurrTSF & 0x00ff0000) >> 16); + pMgmt->abyCurrBSSID[2] = (u8)((qwCurrTSF & 0x00000ff0) >> 4); + pMgmt->abyCurrBSSID[1] = (u8)((qwCurrTSF & 0x000ff000) >> 12); + pMgmt->abyCurrBSSID[0] = (u8)((qwCurrTSF & 0x0ff00000) >> 20); pMgmt->abyCurrBSSID[5] ^= pMgmt->abyMACAddr[0]; pMgmt->abyCurrBSSID[4] ^= pMgmt->abyMACAddr[1]; pMgmt->abyCurrBSSID[3] ^= pMgmt->abyMACAddr[2]; @@ -2511,22 +2297,21 @@ void vMgrCreateOwnIBSS(void *hDeviceContext, * -*/ -void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) +void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - PKnownBSS pCurr = NULL; - unsigned int ii, uu; - PWLAN_IE_SUPP_RATES pItemRates = NULL; - PWLAN_IE_SUPP_RATES pItemExtRates = NULL; - PWLAN_IE_SSID pItemSSID; - unsigned int uRateLen = WLAN_RATES_MAXLEN; - WORD wMaxBasicRate = RATE_1M; - WORD wMaxSuppRate = RATE_1M; - WORD wSuppRate; - BYTE byTopCCKBasicRate = RATE_1M; - BYTE byTopOFDMBasicRate = RATE_1M; - BOOL bShortSlotTime = FALSE; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + PKnownBSS pCurr = NULL; + int ii, uu; + PWLAN_IE_SUPP_RATES pItemRates = NULL; + PWLAN_IE_SUPP_RATES pItemExtRates = NULL; + PWLAN_IE_SSID pItemSSID; + u32 uRateLen = WLAN_RATES_MAXLEN; + u16 wMaxBasicRate = RATE_1M; + u16 wMaxSuppRate = RATE_1M; + u16 wSuppRate; + u8 byTopCCKBasicRate = RATE_1M; + u8 byTopOFDMBasicRate = RATE_1M; + u8 bShortSlotTime = FALSE; for (ii = 0; ii < MAX_BSS_NUM; ii++) { @@ -2836,23 +2621,20 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus) * PCM_STATUS * -*/ -static -void -s_vMgrSynchBSS ( - PSDevice pDevice, - unsigned int uBSSMode, - PKnownBSS pCurr, - PCMD_STATUS pStatus - ) +static void s_vMgrSynchBSS(struct vnt_private *pDevice, u32 uBSSMode, + PKnownBSS pCurr, PCMD_STATUS pStatus) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M - BYTE abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; - BYTE abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60}; - //6M, 9M, 12M, 48M - BYTE abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; - BYTE abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; - + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + u8 abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, + 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; + /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ + u8 abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, + 4, 0x0C, 0x12, 0x18, 0x60}; + /* 6M, 9M, 12M, 48M*/ + u8 abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, + 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; + u8 abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, + 4, 0x02, 0x04, 0x0B, 0x16}; *pStatus = CMD_STATUS_FAILURE; @@ -2991,21 +2773,13 @@ s_vMgrSynchBSS ( return; }; - -//mike add: fix NetworkManager 0.7.0 hidden ssid mode in WPA encryption -// ,need reset eAuthenMode and eEncryptionStatus - static void Encyption_Rebuild( - PSDevice pDevice, - PKnownBSS pCurr - ) +static void Encyption_Rebuild(struct vnt_private *pDevice, PKnownBSS pCurr) { - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - /* unsigned int ii, uSameBssidNum=0; */ + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - // if( uSameBssidNum>=2) { //we only check AP in hidden sssid mode - if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || //networkmanager 0.7.0 does not give the pairwise-key selsection, - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { // so we need re-selsect it according to real pairwise-key info. - if(pCurr->bWPAValid == TRUE) { //WPA-PSK + if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || + (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { + if (pCurr->bWPAValid == TRUE) { /*WPA-PSK */ pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; if(pCurr->abyPKType[0] == WPA_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP @@ -3044,20 +2818,15 @@ s_vMgrSynchBSS ( * -*/ -static -void -s_vMgrFormatTIM( - PSMgmtObject pMgmt, - PWLAN_IE_TIM pTIM - ) +static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) { - BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; - BYTE byMap; - unsigned int ii, jj; - BOOL bStartFound = FALSE; - BOOL bMulticast = FALSE; - WORD wStartIndex = 0; - WORD wEndIndex = 0; + u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; + u8 byMap; + int ii, jj; + int bStartFound = FALSE; + int bMulticast = FALSE; + u16 wStartIndex = 0; + u16 wEndIndex = 0; // Find size of partial virtual bitmap @@ -3119,30 +2888,23 @@ s_vMgrFormatTIM( * -*/ -static -PSTxMgmtPacket -s_MgrMakeBeacon( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wCurrBeaconPeriod, - unsigned int uCurrChannel, - WORD wCurrATIMWinodw, - PWLAN_IE_SSID pCurrSSID, - PBYTE pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, PWLAN_IE_SSID pCurrSSID, + u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_BEACON sFrame; - BYTE abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_BEACON sFrame; + u8 abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - // prepare beacon frame - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_BEACON_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + /* prepare beacon frame */ + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_BEACON_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_BEACON_FR_MAXLEN; @@ -3294,30 +3056,22 @@ s_MgrMakeBeacon( -PSTxMgmtPacket -s_MgrMakeProbeResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wCurrBeaconPeriod, - unsigned int uCurrChannel, - WORD wCurrATIMWinodw, - PBYTE pDstAddr, - PWLAN_IE_SSID pCurrSSID, - PBYTE pCurrBSSID, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates, - BYTE byPHYType - ) +struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, + u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, + PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, + PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates, u8 byPHYType) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_PROBERESP sFrame; - + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_PROBERESP sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBERESP_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_PROBERESP_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_PROBERESP_FR_MAXLEN; @@ -3426,27 +3180,24 @@ s_MgrMakeProbeResponse( -*/ -PSTxMgmtPacket -s_MgrMakeAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pDAddr, - WORD wCurrCapInfo, - WORD wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, + PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_ASSOCREQ sFrame; - PBYTE pbyIEs; - PBYTE pbyRSN; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_ASSOCREQ sFrame; + u8 *pbyIEs; + u8 *pbyRSN; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_ASSOCREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure. sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_ASSOCREQ_FR_MAXLEN; @@ -3688,27 +3439,23 @@ s_MgrMakeAssocRequest( -*/ -PSTxMgmtPacket -s_MgrMakeReAssocRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PBYTE pDAddr, - WORD wCurrCapInfo, - WORD wListenInterval, - PWLAN_IE_SSID pCurrSSID, - PWLAN_IE_SUPP_RATES pCurrRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, + u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, + PWLAN_IE_SUPP_RATES pCurrRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_REASSOCREQ sFrame; - PBYTE pbyIEs; - PBYTE pbyRSN; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_REASSOCREQ sFrame; + u8 *pbyIEs; + u8 *pbyRSN; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset( pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_REASSOCREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_REASSOCREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); /* Setup the sFrame structure. */ sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCREQ_FR_MAXLEN; @@ -3942,25 +3689,20 @@ s_MgrMakeReAssocRequest( * -*/ -PSTxMgmtPacket -s_MgrMakeAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wAssocStatus, - WORD wAssocAID, - PBYTE pDstAddr, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_ASSOCRESP sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_ASSOCRESP sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_ASSOCREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; @@ -4016,25 +3758,20 @@ s_MgrMakeAssocResponse( -*/ -PSTxMgmtPacket -s_MgrMakeReAssocResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - WORD wCurrCapInfo, - WORD wAssocStatus, - WORD wAssocAID, - PBYTE pDstAddr, - PWLAN_IE_SUPP_RATES pCurrSuppRates, - PWLAN_IE_SUPP_RATES pCurrExtSuppRates - ) +struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, + u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, + PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { - PSTxMgmtPacket pTxPacket = NULL; - WLAN_FR_REASSOCRESP sFrame; + struct vnt_tx_mgmt *pTxPacket = NULL; + WLAN_FR_REASSOCRESP sFrame; - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket)); + pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + + WLAN_ASSOCREQ_FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + + sizeof(struct vnt_tx_mgmt)); // Setup the sFrame structure sFrame.pBuf = (PBYTE)pTxPacket->p80211Header; sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN; @@ -4089,19 +3826,14 @@ s_MgrMakeReAssocResponse( * -*/ -static -void -s_vMgrRxProbeResponse( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxProbeResponse(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - PKnownBSS pBSSList = NULL; - WLAN_FR_PROBERESP sFrame; - BYTE byCurrChannel = pRxPacket->byRxChannel; - ERPObject sERP; - BOOL bChannelHit = TRUE; + PKnownBSS pBSSList = NULL; + WLAN_FR_PROBERESP sFrame; + u8 byCurrChannel = pRxPacket->byRxChannel; + ERPObject sERP; + int bChannelHit = TRUE; memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP)); @@ -4221,18 +3953,13 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) -*/ -static -void -s_vMgrRxProbeRequest( - PSDevice pDevice, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket - ) +static void s_vMgrRxProbeRequest(struct vnt_private *pDevice, + struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { - WLAN_FR_PROBEREQ sFrame; - CMD_STATUS Status; - PSTxMgmtPacket pTxPacket; - BYTE byPHYType = BB_TYPE_11B; + WLAN_FR_PROBEREQ sFrame; + CMD_STATUS Status; + struct vnt_tx_mgmt *pTxPacket; + u8 byPHYType = BB_TYPE_11B; // STA in Ad-hoc mode: when latest TBTT beacon transmit success, // STA have to response this request. @@ -4307,15 +4034,13 @@ s_vMgrRxProbeRequest( * -*/ -void vMgrRxManagePacket(void *hDeviceContext, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket) +void vMgrRxManagePacket(struct vnt_private *pDevice, struct vnt_manager *pMgmt, + struct vnt_rx_mgmt *pRxPacket) { - PSDevice pDevice = (PSDevice)hDeviceContext; - BOOL bInScan = FALSE; - unsigned int uNodeIndex = 0; - NODE_STATE eNodeState = 0; - CMD_STATUS Status; + int bInScan = FALSE; + u32 uNodeIndex = 0; + NODE_STATE eNodeState = 0; + CMD_STATUS Status; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { @@ -4453,10 +4178,10 @@ void vMgrRxManagePacket(void *hDeviceContext, * TRUE if success; FALSE if failed. * -*/ -BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, PSMgmtObject pMgmt) +int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, + struct vnt_manager *pMgmt) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PSTxMgmtPacket pTxPacket; + struct vnt_tx_mgmt *pTxPacket; // pDevice->bBeaconBufReady = FALSE; if (pDevice->bEncryptionEnable || pDevice->bEnable8021x){ @@ -4504,12 +4229,7 @@ BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, PSMgmtObject pMgmt) * none. * -*/ -static -void -s_vMgrLogStatus( - PSMgmtObject pMgmt, - WORD wStatus - ) +static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus) { switch( wStatus ){ case WLAN_MGMT_STATUS_UNSPEC_FAILURE: @@ -4574,13 +4294,11 @@ s_vMgrLogStatus( * -*/ -BOOL bAdd_PMKID_Candidate(void *hDeviceContext, - PBYTE pbyBSSID, - PSRSNCapObject psRSNCapObj) +int bAdd_PMKID_Candidate(struct vnt_private *pDevice, u8 *pbyBSSID, + PSRSNCapObject psRSNCapObj) { - PSDevice pDevice = (PSDevice)hDeviceContext; - PPMKID_CANDIDATE pCandidateList; - unsigned int ii = 0; + PPMKID_CANDIDATE pCandidateList; + int ii = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); @@ -4636,14 +4354,14 @@ BOOL bAdd_PMKID_Candidate(void *hDeviceContext, * -*/ -void vFlush_PMKID_Candidate(void *hDeviceContext) +void vFlush_PMKID_Candidate(struct vnt_private *pDevice) { - PSDevice pDevice = (PSDevice)hDeviceContext; + if (pDevice == NULL) + return; - if (pDevice == NULL) - return; + memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent)); - memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent)); + return; } static BOOL diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h index 52b1b562b141..86c15050d034 100644 --- a/drivers/staging/vt6656/wmgr.h +++ b/drivers/staging/vt6656/wmgr.h @@ -218,34 +218,28 @@ typedef enum tagWMAC_POWER_MODE { -// Tx Management Packet descriptor -typedef struct tagSTxMgmtPacket { - - PUWLAN_80211HDR p80211Header; - unsigned int cbMPDULen; - unsigned int cbPayloadLen; - +/* Tx Management Packet descriptor */ +typedef struct vnt_tx_mgmt { + PUWLAN_80211HDR p80211Header; + u32 cbMPDULen; + u32 cbPayloadLen; } STxMgmtPacket, *PSTxMgmtPacket; -// Rx Management Packet descriptor -typedef struct tagSRxMgmtPacket { - - PUWLAN_80211HDR p80211Header; - QWORD qwLocalTSF; - unsigned int cbMPDULen; - unsigned int cbPayloadLen; - unsigned int uRSSI; - BYTE bySQ; - BYTE byRxRate; - BYTE byRxChannel; - +/* Rx Management Packet descriptor */ +typedef struct vnt_rx_mgmt { + PUWLAN_80211HDR p80211Header; + u64 qwLocalTSF; + u32 cbMPDULen; + u32 cbPayloadLen; + u32 uRSSI; + u8 bySQ; + u8 byRxRate; + u8 byRxChannel; } SRxMgmtPacket, *PSRxMgmtPacket; - -typedef struct tagSMgmtObject -{ +typedef struct vnt_manager { void *pAdapter; // MAC address BYTE abyMACAddr[WLAN_ADDR_LEN]; @@ -334,7 +328,8 @@ typedef struct tagSMgmtObject WORD wCountToWakeUp; BOOL bInTIMWake; PBYTE pbyPSPacketPool; - BYTE byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN]; + u8 byPSPacketPool[sizeof(struct vnt_tx_mgmt) + + WLAN_NULLDATA_FR_MAXLEN]; BOOL bRxBeaconInTBTTWake; BYTE abyPSTxMap[MAX_NODE_NUM + 1]; @@ -344,14 +339,15 @@ typedef struct tagSMgmtObject // management packet pool PBYTE pbyMgmtPacketPool; - BYTE byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; + u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt) + + WLAN_A3FR_MAXLEN]; // One second callback timer struct timer_list sTimerSecondCallback; - // Temporarily Rx Mgmt Packet Descriptor - SRxMgmtPacket sRxPacket; + /* Temporarily Rx Mgmt Packet Descriptor */ + struct vnt_rx_mgmt sRxPacket; // link list of known bss's (scan results) KnownBSS sBSSList[MAX_BSS_NUM]; @@ -385,8 +381,10 @@ typedef struct tagSMgmtObject BYTE byNewChannel; PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep; unsigned int uLengthOfRepEIDs; - BYTE abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; - BYTE abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; + u8 abyCurrentMSRReq[sizeof(struct vnt_tx_mgmt) + + WLAN_A3FR_MAXLEN]; + u8 abyCurrentMSRRep[sizeof(struct vnt_tx_mgmt) + + WLAN_A3FR_MAXLEN]; BYTE abyIECountry[WLAN_A3FR_MAXLEN]; BYTE abyIBSSDFSOwner[6]; BYTE byIBSSDFSRecovery; @@ -399,35 +397,29 @@ typedef struct tagSMgmtObject /*--------------------- Export Functions --------------------------*/ -void vMgrObjectInit(void *hDeviceContext); +void vMgrObjectInit(struct vnt_private *pDevice); -void vMgrAssocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus); +void vMgrAssocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, PCMD_STATUS pStatus); -void vMgrReAssocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus); +void vMgrReAssocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, PCMD_STATUS pStatus); -void vMgrDisassocBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PBYTE abyDestAddress, - WORD wReason, - PCMD_STATUS pStatus); +void vMgrDisassocBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus); -void vMgrAuthenBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PCMD_STATUS pStatus); +void vMgrAuthenBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, PCMD_STATUS pStatus); -void vMgrCreateOwnIBSS(void *hDeviceContext, - PCMD_STATUS pStatus); +void vMgrCreateOwnIBSS(struct vnt_private *pDevice, + PCMD_STATUS pStatus); -void vMgrJoinBSSBegin(void *hDeviceContext, - PCMD_STATUS pStatus); +void vMgrJoinBSSBegin(struct vnt_private *pDevice, + PCMD_STATUS pStatus); -void vMgrRxManagePacket(void *hDeviceContext, - PSMgmtObject pMgmt, - PSRxMgmtPacket pRxPacket); +void vMgrRxManagePacket(struct vnt_private *pDevice, + struct vnt_manager *, struct vnt_rx_mgmt *); /* void @@ -437,19 +429,16 @@ vMgrScanBegin( ); */ -void vMgrDeAuthenBeginSta(void *hDeviceContext, - PSMgmtObject pMgmt, - PBYTE abyDestAddress, - WORD wReason, - PCMD_STATUS pStatus); +void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, + struct vnt_manager *, u8 *abyDestAddress, u16 wReason, + PCMD_STATUS pStatus); -BOOL bMgrPrepareBeaconToSend(void *hDeviceContext, - PSMgmtObject pMgmt); +int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, + struct vnt_manager *); -BOOL bAdd_PMKID_Candidate(void *hDeviceContext, - PBYTE pbyBSSID, - PSRSNCapObject psRSNCapObj); +int bAdd_PMKID_Candidate(struct vnt_private *pDevice, + u8 *pbyBSSID, PSRSNCapObject psRSNCapObj); -void vFlush_PMKID_Candidate(void *hDeviceContext); +void vFlush_PMKID_Candidate(struct vnt_private *pDevice); #endif /* __WMGR_H__ */ diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c index cc1d48bced2d..569d1a726285 100644 --- a/drivers/staging/vt6656/wpactl.c +++ b/drivers/staging/vt6656/wpactl.c @@ -67,14 +67,14 @@ static int msglevel = MSG_LEVEL_INFO; * Return Value: * */ -int wpa_set_keys(PSDevice pDevice, void *ctx) +int wpa_set_keys(struct vnt_private *pDevice, void *ctx) { struct viawget_wpa_param *param = ctx; - PSMgmtObject pMgmt = &pDevice->sMgmtObj; + struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; DWORD dwKeyIndex = 0; BYTE abyKey[MAX_KEY_LEN]; BYTE abySeq[MAX_KEY_LEN]; - QWORD KeyRSC; + u64 KeyRSC; BYTE byKeyDecMode = KEY_CTL_WEP; int ret = 0; int uu; @@ -136,9 +136,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) if (param->u.wpa_key.seq_len > 0) { for (ii = 0 ; ii < param->u.wpa_key.seq_len ; ii++) { if (ii < 4) - LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8)); + KeyRSC |= (abySeq[ii] << (ii * 8)); else - HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8)); + KeyRSC |= (abySeq[ii] << ((ii-4) * 8)); } dwKeyIndex |= 1 << 29; } @@ -203,7 +203,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) if ((KeybSetAllGroupKey(pDevice, &(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), + &KeyRSC, (PBYTE)abyKey, byKeyDecMode ) == TRUE) && @@ -211,7 +211,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) &(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), + &KeyRSC, (PBYTE)abyKey, byKeyDecMode ) == TRUE) ) { @@ -234,7 +234,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx) } if (KeybSetKey(pDevice, &(pDevice->sKey), ¶m->addr[0], dwKeyIndex, param->u.wpa_key.key_len, - (PQWORD) &(KeyRSC), (PBYTE)abyKey, byKeyDecMode + &KeyRSC, (PBYTE)abyKey, byKeyDecMode ) == TRUE) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); } else { diff --git a/drivers/staging/vt6656/wpactl.h b/drivers/staging/vt6656/wpactl.h index b4ec6b0e1c67..2235ee97012e 100644 --- a/drivers/staging/vt6656/wpactl.h +++ b/drivers/staging/vt6656/wpactl.h @@ -52,6 +52,6 @@ typedef unsigned long long NDIS_802_11_KEY_RSC; /*--------------------- Export Functions --------------------------*/ -int wpa_set_keys(PSDevice pDevice, void *ctx); +int wpa_set_keys(struct vnt_private *, void *ctx); #endif /* __WPACL_H__ */ diff --git a/drivers/staging/winbond/Kconfig b/drivers/staging/winbond/Kconfig index a29f60836b77..db5b053d9bc2 100644 --- a/drivers/staging/winbond/Kconfig +++ b/drivers/staging/winbond/Kconfig @@ -8,4 +8,4 @@ config W35UND Hardware is present in some Kohjinsha subnotebooks, and in some stand-alone USB modules. Chipset name seems to be w89c35d. - Check http://code.google.com/p/winbondport/ for new version. + Check <http://code.google.com/p/winbondport/> for new version. diff --git a/drivers/staging/wlags49_h2/ap_h2.c b/drivers/staging/wlags49_h2/ap_h2.c index e524153e925d..3a08d421c735 100644 --- a/drivers/staging/wlags49_h2/ap_h2.c +++ b/drivers/staging/wlags49_h2/ap_h2.c @@ -3256,7 +3256,7 @@ static const CFG_PROG_STRCT fw_image_code[] = { 0x0146, /* sizeof(fw_image_1_data), */ 0x00000060, /* Target address in NIC Memory */ 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ - (hcf_8 FAR *) fw_image_1_data + (hcf_8 *)fw_image_1_data }, { 8, @@ -3265,7 +3265,7 @@ static const CFG_PROG_STRCT fw_image_code[] = { 0x1918, /* sizeof(fw_image_2_data), */ 0x00000C16, /* Target address in NIC Memory */ 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ - (hcf_8 FAR *) fw_image_2_data + (hcf_8 *)fw_image_2_data }, { 8, @@ -3274,7 +3274,7 @@ static const CFG_PROG_STRCT fw_image_code[] = { 0x01bc, /* sizeof(fw_image_3_data), */ 0x001E252E, /* Target address in NIC Memory */ 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ - (hcf_8 FAR *) fw_image_3_data + (hcf_8 *)fw_image_3_data }, { 8, @@ -3283,7 +3283,7 @@ static const CFG_PROG_STRCT fw_image_code[] = { 0xab28, /* sizeof(fw_image_4_data), */ 0x001F4000, /* Target address in NIC Memory */ 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ - (hcf_8 FAR *) fw_image_4_data + (hcf_8 *)fw_image_4_data }, { 5, diff --git a/drivers/staging/wlags49_h2/ap_h25.c b/drivers/staging/wlags49_h2/ap_h25.c index f4491cbd08d3..d3a0faa3ab97 100644 --- a/drivers/staging/wlags49_h2/ap_h25.c +++ b/drivers/staging/wlags49_h2/ap_h25.c @@ -24,10 +24,10 @@ */ -#include "hcfcfg.h" // to get hcf_16 etc defined as well as - // possible settings which inluence mdd.h or dhf.h -#include "mdd.h" //to get COMP_ID_STA etc defined -#include "dhf.h" //used to be "fhfmem.h", to get memblock,plugrecord, +#include "hcfcfg.h" /* to get hcf_16 etc defined as well as */ + /* possible settings which inluence mdd.h or dhf.h */ +#include "mdd.h" /* to get COMP_ID_STA etc defined */ +#include "dhf.h" /* used to be fhfmem.h, to get memblock,plugrecord, */ static const hcf_8 fw_image_1_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -3996,59 +3996,59 @@ static const hcf_8 fw_image_4_data[] = { static const CFG_IDENTITY_STRCT fw_image_infoidentity[] = { { - sizeof( CFG_IDENTITY_STRCT ) / sizeof(hcf_16) - 1, + sizeof(CFG_IDENTITY_STRCT) / sizeof(hcf_16) - 1, CFG_FW_IDENTITY, COMP_ID_FW_AP, - 3, //Variant - 1, //Major - 24 //Minor + 3, /* Variant */ + 1, /* Major */ + 24 /* Minor */ }, - { 0000, 0000, 0000, 0000, 0000, 0000 } //endsentinel + { 0000, 0000, 0000, 0000, 0000, 0000 } /* endsentinel */ }; static const CFG_PROG_STRCT fw_image_code[] = { { 8, CFG_PROG, - CFG_PROG_VOLATILE, // mode - 0x0148, // sizeof(fw_image_1_data), - 0x00000060, // Target address in NIC Memory - 0x0000, // CRC: yes/no TYPE: primary/station/tertiary - (hcf_8 FAR *) fw_image_1_data + CFG_PROG_VOLATILE, /* mode */ + 0x0148, /* sizeof(fw_image_1_data), */ + 0x00000060, /* Target address in NIC Memory */ + 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ + (hcf_8 *)fw_image_1_data }, { 8, CFG_PROG, - CFG_PROG_VOLATILE, // mode - 0x2432, // sizeof(fw_image_2_data), - 0x00000C16, // Target address in NIC Memory - 0x0000, // CRC: yes/no TYPE: primary/station/tertiary - (hcf_8 FAR *) fw_image_2_data + CFG_PROG_VOLATILE, /* mode */ + 0x2432, /* sizeof(fw_image_2_data), */ + 0x00000C16, /* Target address in NIC Memory */ + 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ + (hcf_8 *)fw_image_2_data }, { 8, CFG_PROG, - CFG_PROG_VOLATILE, // mode - 0x194c, // sizeof(fw_image_3_data), - 0x001E3048, // Target address in NIC Memory - 0x0000, // CRC: yes/no TYPE: primary/station/tertiary - (hcf_8 FAR *) fw_image_3_data + CFG_PROG_VOLATILE, /* mode */ + 0x194c, /* sizeof(fw_image_3_data), */ + 0x001E3048, /* Target address in NIC Memory */ + 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ + (hcf_8 *)fw_image_3_data }, { 8, CFG_PROG, - CFG_PROG_VOLATILE, // mode - 0xb7e4, // sizeof(fw_image_4_data), - 0x001F4000, // Target address in NIC Memory - 0x0000, // CRC: yes/no TYPE: primary/station/tertiary - (hcf_8 FAR *) fw_image_4_data + CFG_PROG_VOLATILE, /* mode*/ + 0xb7e4, /* sizeof(fw_image_4_data),*/ + 0x001F4000, /* Target address in NIC Memory*/ + 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary*/ + (hcf_8 *)fw_image_4_data }, { 5, CFG_PROG, - CFG_PROG_STOP, // mode + CFG_PROG_STOP, /* mode*/ 0000, - 0x000F2101, // Start execution address + 0x000F2101, /* Start execution address*/ }, { 0000, 0000, 0000, 0000, 00000000, 0000, 00000000} }; @@ -4059,7 +4059,7 @@ static const CFG_RANGE20_STRCT fw_image_infocompat[] = { COMP_ROLE_SUPL, COMP_ID_APF, { - { 4, 1, 1 } //variant, bottom, top + { 4, 1, 1 } /* variant, bottom, top*/ } }, { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), @@ -4067,8 +4067,8 @@ static const CFG_RANGE20_STRCT fw_image_infocompat[] = { COMP_ROLE_ACT, COMP_ID_MFI, { - { 7, 3, 3 }, //variant, bottom, top - { 8, 1, 1 } //variant, bottom, top + { 7, 3, 3 }, /* variant, bottom, top */ + { 8, 1, 1 } /* variant, bottom, top */ } }, { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), @@ -4076,18 +4076,18 @@ static const CFG_RANGE20_STRCT fw_image_infocompat[] = { COMP_ROLE_ACT, COMP_ID_CFI, { - { 4, 1, 2 } //variant, bottom, top + { 4, 1, 2 } /* variant, bottom, top */ } }, - { 0000, 0000, 0000, 0000, { { 0000, 0000, 0000 } } } //endsentinel + { 0000, 0000, 0000, 0000, { { 0000, 0000, 0000 } } } /* endsentinel */ }; memimage fw_image = { - "FUPU7D37dhfwci\001C", //signature, <format number>, C/Bin type + "FUPU7D37dhfwci\001C", /* signature, <format number>, C/Bin type */ (CFG_PROG_STRCT *) fw_image_code, 0x000F2101, - 00000000, //(dummy) pdaplug - 00000000, //(dummy) priplug + 00000000, /* (dummy) pdaplug */ + 00000000, /* (dummy) priplug */ (CFG_RANGE20_STRCT *) fw_image_infocompat, (CFG_IDENTITY_STRCT *) fw_image_infoidentity, }; diff --git a/drivers/staging/wlags49_h2/sta_h2.c b/drivers/staging/wlags49_h2/sta_h2.c index 00dffe2ed8f1..19bed819df1e 100644 --- a/drivers/staging/wlags49_h2/sta_h2.c +++ b/drivers/staging/wlags49_h2/sta_h2.c @@ -25,10 +25,10 @@ */ -#include "hcfcfg.h" // to get hcf_16 etc defined as well as - // possible settings which influence mdd.h or dhf.h -#include "mdd.h" //to get COMP_ID_STA etc defined -#include "dhf.h" //used to be "fhfmem.h", to get memblock,plugrecord, +#include "hcfcfg.h" /* to get hcf_16 etc defined as well as */ + /* possible settings which influence mdd.h or dhf.h */ +#include "mdd.h" /* to get COMP_ID_STA etc defined */ +#include "dhf.h" /* used to be fhfmem.h, to get memblock,plugrecord, */ static const hcf_8 fw_image_1_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -4381,59 +4381,59 @@ static const hcf_8 fw_image_4_data[] = { static const CFG_IDENTITY_STRCT fw_image_infoidentity[] = { { - sizeof( CFG_IDENTITY_STRCT ) / sizeof(hcf_16) - 1, + sizeof(CFG_IDENTITY_STRCT) / sizeof(hcf_16) - 1, CFG_FW_IDENTITY, COMP_ID_FW_STA, - 3, //Variant - 2, //Major - 36 //Minor + 3, /* Variant */ + 2, /* Major */ + 36 /* Minor */ }, - { 0000, 0000, 0000, 0000, 0000, 0000 } //endsentinel + { 0000, 0000, 0000, 0000, 0000, 0000 } /* endsentinel */ }; static const CFG_PROG_STRCT fw_image_code[] = { { 8, CFG_PROG, - CFG_PROG_VOLATILE, // mode - 0x0186, // sizeof(fw_image_1_data), - 0x00000060, // Target address in NIC Memory - 0x0000, // CRC: yes/no TYPE: primary/station/tertiary - (hcf_8 FAR *) fw_image_1_data + CFG_PROG_VOLATILE, /* mode */ + 0x0186, /* sizeof(fw_image_1_data), */ + 0x00000060, /* Target address in NIC Memory */ + 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ + (hcf_8 *)fw_image_1_data }, { 8, CFG_PROG, - CFG_PROG_VOLATILE, // mode - 0x2518, // sizeof(fw_image_2_data), - 0x00000C16, // Target address in NIC Memory - 0x0000, // CRC: yes/no TYPE: primary/station/tertiary - (hcf_8 FAR *) fw_image_2_data + CFG_PROG_VOLATILE, /* mode */ + 0x2518, /* sizeof(fw_image_2_data), */ + 0x00000C16, /* Target address in NIC Memory */ + 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ + (hcf_8 *)fw_image_2_data }, { 8, CFG_PROG, - CFG_PROG_VOLATILE, // mode - 0x3daa, // sizeof(fw_image_3_data), - 0x001E312E, // Target address in NIC Memory - 0x0000, // CRC: yes/no TYPE: primary/station/tertiary - (hcf_8 FAR *) fw_image_3_data + CFG_PROG_VOLATILE, /* mode */ + 0x3daa, /* sizeof(fw_image_3_data), */ + 0x001E312E, /* Target address in NIC Memory */ + 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ + (hcf_8 *)fw_image_3_data }, { 8, CFG_PROG, - CFG_PROG_VOLATILE, // mode - 0xaa66, // sizeof(fw_image_4_data), - 0x001F4000, // Target address in NIC Memory - 0x0000, // CRC: yes/no TYPE: primary/station/tertiary - (hcf_8 FAR *) fw_image_4_data + CFG_PROG_VOLATILE, /* mode */ + 0xaa66, /* sizeof(fw_image_4_data), */ + 0x001F4000, /* Target address in NIC Memory */ + 0x0000, /* CRC: yes/no TYPE: primary/station/tertiary */ + (hcf_8 *)fw_image_4_data }, { 5, CFG_PROG, - CFG_PROG_STOP, // mode + CFG_PROG_STOP, /* mode */ 0000, - 0x000F368E, // Start execution address + 0x000F368E, /* Start execution address */ }, { 0000, 0000, 0000, 0000, 00000000, 0000, 00000000} }; @@ -4444,7 +4444,7 @@ static const CFG_RANGE20_STRCT fw_image_infocompat[] = { COMP_ROLE_SUPL, COMP_ID_STA, { - { 2, 2, 5 } //variant, bottom, top + { 2, 2, 5 } /* variant, bottom, top */ } }, { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), @@ -4452,9 +4452,9 @@ static const CFG_RANGE20_STRCT fw_image_infocompat[] = { COMP_ROLE_ACT, COMP_ID_MFI, { - { 4, 6, 7 }, //variant, bottom, top - { 5, 6, 7 }, //variant, bottom, top - { 6, 6, 7 } //variant, bottom, top + { 4, 6, 7 }, /* variant, bottom, top */ + { 5, 6, 7 }, /* variant, bottom, top */ + { 6, 6, 7 } /* variant, bottom, top */ } }, { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), @@ -4462,18 +4462,18 @@ static const CFG_RANGE20_STRCT fw_image_infocompat[] = { COMP_ROLE_ACT, COMP_ID_CFI, { - { 2, 1, 2 } //variant, bottom, top + { 2, 1, 2 } /* variant, bottom, top */ } }, - { 0000, 0000, 0000, 0000, { { 0000, 0000, 0000 } } } //endsentinel + { 0000, 0000, 0000, 0000, { { 0000, 0000, 0000 } } } /* endsentinel */ }; memimage fw_image = { - "FUPU7D37dhfwci\001C", //signature, <format number>, C/Bin type + "FUPU7D37dhfwci\001C", /* signature, <format number>, C/Bin type */ (CFG_PROG_STRCT *) fw_image_code, 0x000F368E, - 00000000, //(dummy) pdaplug - 00000000, //(dummy) priplug + 00000000, /* (dummy) pdaplug */ + 00000000, /* (dummy) priplug */ (CFG_RANGE20_STRCT *) fw_image_infocompat, (CFG_IDENTITY_STRCT *) fw_image_infoidentity, }; diff --git a/drivers/staging/wlags49_h2/wl_enc.c b/drivers/staging/wlags49_h2/wl_enc.c index 4c6f776cc4da..51293d9f2be9 100644 --- a/drivers/staging/wlags49_h2/wl_enc.c +++ b/drivers/staging/wlags49_h2/wl_enc.c @@ -105,57 +105,57 @@ extern dbg_info_t *DbgInfo; * OK * ******************************************************************************/ -int wl_wep_code( char *szCrypt, char *szDest, void *Data, int nLen ) +int wl_wep_code(char *szCrypt, char *szDest, void *Data, int nLen) { - int i; - int t; - int k ; - char bits; - char *szData = (char *) Data; - /*------------------------------------------------------------------------*/ + int i; + int t; + int k ; + char bits; + char *szData = (char *) Data; + /*------------------------------------------------------------------------*/ - for( i = bits = 0 ; i < MACADDRESS_STR_LEN; i++ ) { - bits ^= szCrypt[i]; - bits += szCrypt[i]; - } + for (i = bits = 0; i < MACADDRESS_STR_LEN; i++) { + bits ^= szCrypt[i]; + bits += szCrypt[i]; + } - for( i = t = *szDest = 0; i < nLen; i++, t++ ) { - k = szData[i] ^ ( bits + i ); + for (i = t = *szDest = 0; i < nLen; i++, t++) { + k = szData[i] ^ (bits + i); - switch( i % 3 ) { + switch (i % 3) { - case 0 : + case 0: - szDest[t] = ((k & 0xFC) >> 2) + CH_START ; - szDest[t+1] = ((k & 0x03) << 4) + CH_START ; - szDest[t+2] = '\0'; + szDest[t] = ((k & 0xFC) >> 2) + CH_START ; + szDest[t+1] = ((k & 0x03) << 4) + CH_START ; + szDest[t+2] = '\0'; - break; + break; - case 1 : + case 1: - szDest[t] += (( k & 0xF0 ) >> 4 ); - szDest[t+1] = (( k & 0x0F ) << 2 ) + CH_START ; - szDest[t+2] = '\0'; + szDest[t] += ((k & 0xF0) >> 4); + szDest[t+1] = ((k & 0x0F) << 2) + CH_START ; + szDest[t+2] = '\0'; - break; + break; - case 2 : + case 2: - szDest[t] += (( k & 0xC0 ) >> 6 ); - szDest[t+1] = ( k & 0x3F ) + CH_START ; - szDest[t+2] = '\0'; - t++; + szDest[t] += ((k & 0xC0) >> 6); + szDest[t+1] = (k & 0x3F) + CH_START ; + szDest[t+2] = '\0'; + t++; - break; - } - } + break; + } + } - return( strlen( szDest )) ; + return strlen(szDest); } /*============================================================================*/ @@ -182,50 +182,50 @@ int wl_wep_code( char *szCrypt, char *szDest, void *Data, int nLen ) * OK * ******************************************************************************/ -int wl_wep_decode( char *szCrypt, void *Dest, char *szData ) +int wl_wep_decode(char *szCrypt, void *Dest, char *szData) { - int i; - int t; - int nLen; - char bits; - char *szDest = Dest; - /*------------------------------------------------------------------------*/ + int i; + int t; + int nLen; + char bits; + char *szDest = Dest; + /*------------------------------------------------------------------------*/ - for( i = bits = 0 ; i < 12; i++ ) { - bits ^= szCrypt[i] ; - bits += szCrypt[i] ; - } + for (i = bits = 0; i < 12; i++) { + bits ^= szCrypt[i] ; + bits += szCrypt[i] ; + } - nLen = ( strlen( szData ) * 3) / 4 ; + nLen = (strlen(szData) * 3) / 4 ; - for( i = t = 0; i < nLen; i++, t++ ) { - switch( i % 3 ) { - case 0 : + for (i = t = 0; i < nLen; i++, t++) { + switch (i % 3) { + case 0: - szDest[i] = ((( szData[t]-CH_START ) & 0x3f ) << 2 ) + - ((( szData[t+1]-CH_START ) & 0x30 ) >> 4 ); - break; + szDest[i] = (((szData[t] - CH_START) & 0x3f) << 2) + + (((szData[t+1] - CH_START) & 0x30) >> 4); + break; - case 1 : - szDest[i] = ((( szData[t]-CH_START ) & 0x0f ) << 4 ) + - ((( szData[t+1]-CH_START ) & 0x3c ) >> 2 ); - break; + case 1: + szDest[i] = (((szData[t] - CH_START) & 0x0f) << 4) + + (((szData[t+1] - CH_START) & 0x3c) >> 2); + break; - case 2 : - szDest[i] = ((( szData[t]-CH_START ) & 0x03 ) << 6 ) + - (( szData[t+1]-CH_START ) & 0x3f ); - t++; - break; - } + case 2: + szDest[i] = (((szData[t] - CH_START) & 0x03) << 6) + + ((szData[t+1] - CH_START) & 0x3f); + t++; + break; + } - szDest[i] ^= ( bits + i ) ; + szDest[i] ^= (bits + i); - } + } - return( i ) ; + return i; } /*============================================================================*/ diff --git a/drivers/staging/wlags49_h2/wl_netdev.h b/drivers/staging/wlags49_h2/wl_netdev.h index 61f040f26d97..95bfbebf35d6 100644 --- a/drivers/staging/wlags49_h2/wl_netdev.h +++ b/drivers/staging/wlags49_h2/wl_netdev.h @@ -68,87 +68,87 @@ /******************************************************************************* * function prototypes ******************************************************************************/ -int wl_init( struct net_device *dev ); +int wl_init(struct net_device *dev); -int wl_config( struct net_device *dev, struct ifmap *map ); +int wl_config(struct net_device *dev, struct ifmap *map); -struct net_device *wl_device_alloc( void ); +struct net_device *wl_device_alloc(void); -void wl_device_dealloc( struct net_device *dev ); +void wl_device_dealloc(struct net_device *dev); -int wl_open( struct net_device *dev ); +int wl_open(struct net_device *dev); -int wl_close( struct net_device *dev ); +int wl_close(struct net_device *dev); -int wl_ioctl( struct net_device *dev, struct ifreq *rq, int cmd ); +int wl_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -int wl_tx( struct sk_buff *skb, struct net_device *dev, int port ); +int wl_tx(struct sk_buff *skb, struct net_device *dev, int port); -int wl_send( struct wl_private *lp ); +int wl_send(struct wl_private *lp); -int wl_rx( struct net_device *dev ); +int wl_rx(struct net_device *dev); -void wl_tx_timeout( struct net_device *dev ); +void wl_tx_timeout(struct net_device *dev); -struct net_device_stats *wl_stats( struct net_device *dev ); +struct net_device_stats *wl_stats(struct net_device *dev); #ifdef ENABLE_DMA -int wl_send_dma( struct wl_private *lp, struct sk_buff *skb, int port ); -int wl_rx_dma( struct net_device *dev ); +int wl_send_dma(struct wl_private *lp, struct sk_buff *skb, int port); +int wl_rx_dma(struct net_device *dev); #endif #ifdef NEW_MULTICAST -void wl_multicast( struct net_device *dev ); +void wl_multicast(struct net_device *dev); #else -void wl_multicast( struct net_device *dev, int num_addrs, void *addrs ); -#endif // NEW_MULTICAST +void wl_multicast(struct net_device *dev, int num_addrs, void *addrs); +#endif /* NEW_MULTICAST */ -int wl_tx_port0( struct sk_buff *skb, struct net_device *dev ); +int wl_tx_port0(struct sk_buff *skb, struct net_device *dev); #ifdef USE_WDS -int wl_tx_port1( struct sk_buff *skb, struct net_device *dev ); -int wl_tx_port2( struct sk_buff *skb, struct net_device *dev ); -int wl_tx_port3( struct sk_buff *skb, struct net_device *dev ); -int wl_tx_port4( struct sk_buff *skb, struct net_device *dev ); -int wl_tx_port5( struct sk_buff *skb, struct net_device *dev ); -int wl_tx_port6( struct sk_buff *skb, struct net_device *dev ); - -void wl_wds_device_alloc( struct wl_private *lp ); -void wl_wds_device_dealloc( struct wl_private *lp ); -void wl_wds_netif_start_queue( struct wl_private *lp ); -void wl_wds_netif_stop_queue( struct wl_private *lp ); -void wl_wds_netif_wake_queue( struct wl_private *lp ); -void wl_wds_netif_carrier_on( struct wl_private *lp ); -void wl_wds_netif_carrier_off( struct wl_private *lp ); +int wl_tx_port1(struct sk_buff *skb, struct net_device *dev); +int wl_tx_port2(struct sk_buff *skb, struct net_device *dev); +int wl_tx_port3(struct sk_buff *skb, struct net_device *dev); +int wl_tx_port4(struct sk_buff *skb, struct net_device *dev); +int wl_tx_port5(struct sk_buff *skb, struct net_device *dev); +int wl_tx_port6(struct sk_buff *skb, struct net_device *dev); + +void wl_wds_device_alloc(struct wl_private *lp); +void wl_wds_device_dealloc(struct wl_private *lp); +void wl_wds_netif_start_queue(struct wl_private *lp); +void wl_wds_netif_stop_queue(struct wl_private *lp); +void wl_wds_netif_wake_queue(struct wl_private *lp); +void wl_wds_netif_carrier_on(struct wl_private *lp); +void wl_wds_netif_carrier_off(struct wl_private *lp); #endif /* USE_WDS */ #ifdef USE_WDS -#define WL_WDS_DEVICE_ALLOC( ARG ) wl_wds_device_alloc( ARG ) -#define WL_WDS_DEVICE_DEALLOC( ARG ) wl_wds_device_dealloc( ARG ) -#define WL_WDS_NETIF_START_QUEUE( ARG ) wl_wds_netif_start_queue( ARG ) -#define WL_WDS_NETIF_STOP_QUEUE( ARG ) wl_wds_netif_stop_queue( ARG ) -#define WL_WDS_NETIF_WAKE_QUEUE( ARG ) wl_wds_netif_wake_queue( ARG ) -#define WL_WDS_NETIF_CARRIER_ON( ARG ) wl_wds_netif_carrier_on( ARG ) -#define WL_WDS_NETIF_CARRIER_OFF( ARG ) wl_wds_netif_carrier_off( ARG ) +#define WL_WDS_DEVICE_ALLOC(ARG) wl_wds_device_alloc(ARG) +#define WL_WDS_DEVICE_DEALLOC(ARG) wl_wds_device_dealloc(ARG) +#define WL_WDS_NETIF_START_QUEUE(ARG) wl_wds_netif_start_queue(ARG) +#define WL_WDS_NETIF_STOP_QUEUE(ARG) wl_wds_netif_stop_queue(ARG) +#define WL_WDS_NETIF_WAKE_QUEUE(ARG) wl_wds_netif_wake_queue(ARG) +#define WL_WDS_NETIF_CARRIER_ON(ARG) wl_wds_netif_carrier_on(ARG) +#define WL_WDS_NETIF_CARRIER_OFF(ARG) wl_wds_netif_carrier_off(ARG) #else -#define WL_WDS_DEVICE_ALLOC( ARG ) -#define WL_WDS_DEVICE_DEALLOC( ARG ) -#define WL_WDS_NETIF_START_QUEUE( ARG ) -#define WL_WDS_NETIF_STOP_QUEUE( ARG ) -#define WL_WDS_NETIF_WAKE_QUEUE( ARG ) -#define WL_WDS_NETIF_CARRIER_ON( ARG ) -#define WL_WDS_NETIF_CARRIER_OFF( ARG ) +#define WL_WDS_DEVICE_ALLOC(ARG) +#define WL_WDS_DEVICE_DEALLOC(ARG) +#define WL_WDS_NETIF_START_QUEUE(ARG) +#define WL_WDS_NETIF_STOP_QUEUE(ARG) +#define WL_WDS_NETIF_WAKE_QUEUE(ARG) +#define WL_WDS_NETIF_CARRIER_ON(ARG) +#define WL_WDS_NETIF_CARRIER_OFF(ARG) #endif /* USE_WDS */ -#endif // __WL_NETDEV_H__ +#endif /* __WL_NETDEV_H__ */ diff --git a/drivers/staging/wlags49_h2/wl_priv.c b/drivers/staging/wlags49_h2/wl_priv.c index 87e1e4123126..c97e0e154d28 100644 --- a/drivers/staging/wlags49_h2/wl_priv.c +++ b/drivers/staging/wlags49_h2/wl_priv.c @@ -67,7 +67,7 @@ #include <linux/ioport.h> #include <linux/slab.h> #include <linux/delay.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <debug.h> #include <hcf.h> @@ -81,17 +81,17 @@ #include <wl_util.h> #include <wl_netdev.h> -int wvlan_uil_connect( struct uilreq *urq, struct wl_private *lp ); -int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ); -int wvlan_uil_action( struct uilreq *urq, struct wl_private *lp ); -int wvlan_uil_block( struct uilreq *urq, struct wl_private *lp ); -int wvlan_uil_unblock( struct uilreq *urq, struct wl_private *lp ); -int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ); -int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ); -int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil_connect(struct uilreq *urq, struct wl_private *lp); +int wvlan_uil_disconnect(struct uilreq *urq, struct wl_private *lp); +int wvlan_uil_action(struct uilreq *urq, struct wl_private *lp); +int wvlan_uil_block(struct uilreq *urq, struct wl_private *lp); +int wvlan_uil_unblock(struct uilreq *urq, struct wl_private *lp); +int wvlan_uil_send_diag_msg(struct uilreq *urq, struct wl_private *lp); +int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp); +int wvlan_uil_get_info(struct uilreq *urq, struct wl_private *lp); -int cfg_driver_info( struct uilreq *urq, struct wl_private *lp ); -int cfg_driver_identity( struct uilreq *urq, struct wl_private *lp ); +int cfg_driver_info(struct uilreq *urq, struct wl_private *lp); +int cfg_driver_identity(struct uilreq *urq, struct wl_private *lp); /******************************************************************************* @@ -99,7 +99,7 @@ int cfg_driver_identity( struct uilreq *urq, struct wl_private *lp ); ******************************************************************************/ #if DBG extern dbg_info_t *DbgInfo; -#endif // DBG +#endif /* DBG */ @@ -127,47 +127,47 @@ extern dbg_info_t *DbgInfo; * errno value otherwise * ******************************************************************************/ -int wvlan_uil( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil(struct uilreq *urq, struct wl_private *lp) { int ioctl_ret = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil"); + DBG_ENTER(DbgInfo); - switch( urq->command ) { - case UIL_FUN_CONNECT: + switch (urq->command) { + case UIL_FUN_CONNECT: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_CONNECT\n"); - ioctl_ret = wvlan_uil_connect( urq, lp ); + ioctl_ret = wvlan_uil_connect(urq, lp); break; - case UIL_FUN_DISCONNECT: + case UIL_FUN_DISCONNECT: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_DISCONNECT\n"); - ioctl_ret = wvlan_uil_disconnect( urq, lp ); + ioctl_ret = wvlan_uil_disconnect(urq, lp); break; - case UIL_FUN_ACTION: - DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_ACTION\n" ); - ioctl_ret = wvlan_uil_action( urq, lp ); + case UIL_FUN_ACTION: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_ACTION\n"); + ioctl_ret = wvlan_uil_action(urq, lp); break; - case UIL_FUN_SEND_DIAG_MSG: + case UIL_FUN_SEND_DIAG_MSG: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_SEND_DIAG_MSG\n"); - ioctl_ret = wvlan_uil_send_diag_msg( urq, lp ); + ioctl_ret = wvlan_uil_send_diag_msg(urq, lp); break; - case UIL_FUN_GET_INFO: + case UIL_FUN_GET_INFO: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_GET_INFO\n"); - ioctl_ret = wvlan_uil_get_info( urq, lp ); + ioctl_ret = wvlan_uil_get_info(urq, lp); break; - case UIL_FUN_PUT_INFO: + case UIL_FUN_PUT_INFO: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_PUT_INFO\n"); - ioctl_ret = wvlan_uil_put_info( urq, lp ); + ioctl_ret = wvlan_uil_put_info(urq, lp); break; default: - DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- UNSUPPORTED UIL CODE: 0x%X", urq->command ); + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- UNSUPPORTED UIL CODE: 0x%X", urq->command); ioctl_ret = -EOPNOTSUPP; break; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return ioctl_ret; -} // wvlan_uil +} /* wvlan_uil */ /*============================================================================*/ @@ -192,28 +192,28 @@ int wvlan_uil( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int wvlan_uil_connect( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil_connect(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil_connect" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil_connect"); + DBG_ENTER(DbgInfo); - if( !( lp->flags & WVLAN2_UIL_CONNECTED )) { + if (!(lp->flags & WVLAN2_UIL_CONNECTED)) { lp->flags |= WVLAN2_UIL_CONNECTED; - urq->hcfCtx = &( lp->hcfCtx ); + urq->hcfCtx = &(lp->hcfCtx); urq->result = UIL_SUCCESS; } else { - DBG_WARNING( DbgInfo, "UIL_ERR_IN_USE\n" ); + DBG_WARNING(DbgInfo, "UIL_ERR_IN_USE\n"); urq->result = UIL_ERR_IN_USE; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // wvlan_uil_connect +} /* wvlan_uil_connect */ /*============================================================================*/ @@ -238,17 +238,17 @@ int wvlan_uil_connect( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil_disconnect(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil_disconnect" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil_disconnect"); + DBG_ENTER(DbgInfo); - if( urq->hcfCtx == &( lp->hcfCtx )) { + if (urq->hcfCtx == &(lp->hcfCtx)) { if (lp->flags & WVLAN2_UIL_CONNECTED) { lp->flags &= ~WVLAN2_UIL_CONNECTED; /* @@ -262,13 +262,13 @@ int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ) urq->hcfCtx = NULL; urq->result = UIL_SUCCESS; } else { - DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // wvlan_uil_disconnect +} /* wvlan_uil_disconnect */ /*============================================================================*/ @@ -293,60 +293,60 @@ int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int wvlan_uil_action( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil_action(struct uilreq *urq, struct wl_private *lp) { int result = 0; ltv_t *ltv; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil_action" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil_action"); + DBG_ENTER(DbgInfo); - if( urq->hcfCtx == &( lp->hcfCtx )) { + if (urq->hcfCtx == &(lp->hcfCtx)) { /* Make sure there's an LTV in the request buffer */ ltv = (ltv_t *)urq->data; - if( ltv != NULL ) { + if (ltv != NULL) { /* Switch on the Type field of the LTV contained in the request buffer */ - switch( ltv->typ ) { + switch (ltv->typ) { case UIL_ACT_BLOCK: - DBG_TRACE( DbgInfo, "UIL_ACT_BLOCK\n" ); - result = wvlan_uil_block( urq, lp ); + DBG_TRACE(DbgInfo, "UIL_ACT_BLOCK\n"); + result = wvlan_uil_block(urq, lp); break; case UIL_ACT_UNBLOCK: - DBG_TRACE( DbgInfo, "UIL_ACT_UNBLOCK\n" ); - result = wvlan_uil_unblock( urq, lp ); + DBG_TRACE(DbgInfo, "UIL_ACT_UNBLOCK\n"); + result = wvlan_uil_unblock(urq, lp); break; case UIL_ACT_SCAN: - DBG_TRACE( DbgInfo, "UIL_ACT_SCAN\n" ); - urq->result = hcf_action( &( lp->hcfCtx ), MDD_ACT_SCAN ); + DBG_TRACE(DbgInfo, "UIL_ACT_SCAN\n"); + urq->result = hcf_action(&(lp->hcfCtx), MDD_ACT_SCAN); break; case UIL_ACT_APPLY: - DBG_TRACE( DbgInfo, "UIL_ACT_APPLY\n" ); - urq->result = wl_apply( lp ); + DBG_TRACE(DbgInfo, "UIL_ACT_APPLY\n"); + urq->result = wl_apply(lp); break; case UIL_ACT_RESET: - DBG_TRACE( DbgInfo, "UIL_ACT_RESET\n" ); - urq->result = wl_go( lp ); + DBG_TRACE(DbgInfo, "UIL_ACT_RESET\n"); + urq->result = wl_go(lp); break; default: - DBG_WARNING( DbgInfo, "Unknown action code: 0x%x\n", ltv->typ ); + DBG_WARNING(DbgInfo, "Unknown action code: 0x%x\n", ltv->typ); break; } } else { - DBG_ERROR( DbgInfo, "Bad LTV for this action\n" ); + DBG_ERROR(DbgInfo, "Bad LTV for this action\n"); urq->result = UIL_ERR_LEN; } } else { - DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // wvlan_uil_action +} /* wvlan_uil_action */ /*============================================================================*/ @@ -373,34 +373,34 @@ int wvlan_uil_action( struct uilreq *urq, struct wl_private *lp ) * ******************************************************************************/ -int wvlan_uil_block( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil_block(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil_block" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil_block"); + DBG_ENTER(DbgInfo); - if( urq->hcfCtx == &( lp->hcfCtx )) { - if( capable( CAP_NET_ADMIN )) { + if (urq->hcfCtx == &(lp->hcfCtx)) { + if (capable(CAP_NET_ADMIN)) { lp->flags |= WVLAN2_UIL_BUSY; netif_stop_queue(lp->dev); - WL_WDS_NETIF_STOP_QUEUE( lp ); + WL_WDS_NETIF_STOP_QUEUE(lp); urq->result = UIL_SUCCESS; } else { - DBG_ERROR( DbgInfo, "EPERM\n" ); + DBG_ERROR(DbgInfo, "EPERM\n"); urq->result = UIL_FAILURE; result = -EPERM; } } else { - DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // wvlan_uil_block +} /* wvlan_uil_block */ /*============================================================================*/ @@ -425,35 +425,35 @@ int wvlan_uil_block( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int wvlan_uil_unblock( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil_unblock(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil_unblock" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil_unblock"); + DBG_ENTER(DbgInfo); - if( urq->hcfCtx == &( lp->hcfCtx )) { - if( capable( CAP_NET_ADMIN )) { + if (urq->hcfCtx == &(lp->hcfCtx)) { + if (capable(CAP_NET_ADMIN)) { if (lp->flags & WVLAN2_UIL_BUSY) { lp->flags &= ~WVLAN2_UIL_BUSY; netif_wake_queue(lp->dev); - WL_WDS_NETIF_WAKE_QUEUE( lp ); + WL_WDS_NETIF_WAKE_QUEUE(lp); } } else { - DBG_ERROR( DbgInfo, "EPERM\n" ); + DBG_ERROR(DbgInfo, "EPERM\n"); urq->result = UIL_FAILURE; result = -EPERM; } } else { - DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // wvlan_uil_unblock +} /* wvlan_uil_unblock */ /*============================================================================*/ @@ -478,47 +478,47 @@ int wvlan_uil_unblock( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil_send_diag_msg(struct uilreq *urq, struct wl_private *lp) { int result = 0; DESC_STRCT Descp[1]; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil_send_diag_msg" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil_send_diag_msg"); + DBG_ENTER(DbgInfo); - if( urq->hcfCtx == &( lp->hcfCtx )) { - if( capable( CAP_NET_ADMIN )) { + if (urq->hcfCtx == &(lp->hcfCtx)) { + if (capable(CAP_NET_ADMIN)) { if ((urq->data != NULL) && (urq->len != 0)) { if (lp->hcfCtx.IFB_RscInd != 0) { u_char *data; - // Verify the user buffer + /* Verify the user buffer */ result = verify_area(VERIFY_READ, urq->data, urq->len); if (result != 0) { - DBG_ERROR( DbgInfo, "verify_area failed, result: %d\n", result ); + DBG_ERROR(DbgInfo, "verify_area failed, result: %d\n", result); urq->result = UIL_FAILURE; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } data = kmalloc(urq->len, GFP_KERNEL); if (data != NULL) { - memset( Descp, 0, sizeof( DESC_STRCT )); - memcpy( data, urq->data, urq->len ); + memset(Descp, 0, sizeof(DESC_STRCT)); + memcpy(data, urq->data, urq->len); Descp[0].buf_addr = (wci_bufp)data; Descp[0].BUF_CNT = urq->len; - Descp[0].next_desc_addr = 0; // terminate list + Descp[0].next_desc_addr = 0; /* terminate list */ - hcf_send_msg( &(lp->hcfCtx), &Descp[0], HCF_PORT_0 ); - kfree( data ); + hcf_send_msg(&(lp->hcfCtx), &Descp[0], HCF_PORT_0); + kfree(data); } else { - DBG_ERROR( DbgInfo, "ENOMEM\n" ); + DBG_ERROR(DbgInfo, "ENOMEM\n"); urq->result = UIL_FAILURE; result = -ENOMEM; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } @@ -530,18 +530,18 @@ int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ) urq->result = UIL_FAILURE; } } else { - DBG_ERROR( DbgInfo, "EPERM\n" ); + DBG_ERROR(DbgInfo, "EPERM\n"); urq->result = UIL_FAILURE; result = -EPERM; } } else { - DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // wvlan_uil_send_diag_msg +} /* wvlan_uil_send_diag_msg */ /*============================================================================*/ @@ -564,7 +564,7 @@ int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) { int result = 0; ltv_t *pLtv; @@ -575,94 +575,94 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) hcf_16 hcfPort = HCF_PORT_0; #endif /* USE_WDS */ /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil_put_info" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil_put_info"); + DBG_ENTER(DbgInfo); - if( urq->hcfCtx == &( lp->hcfCtx )) { - if( capable( CAP_NET_ADMIN )) { - if(( urq->data != NULL ) && ( urq->len != 0 )) { + if (urq->hcfCtx == &(lp->hcfCtx)) { + if (capable(CAP_NET_ADMIN)) { + if ((urq->data != NULL) && (urq->len != 0)) { /* Make sure that we have at least a command and length to send. */ - if( urq->len < ( sizeof( hcf_16 ) * 2 )) { - urq->len = sizeof( lp->ltvRecord ); + if (urq->len < (sizeof(hcf_16) * 2)) { + urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; - DBG_ERROR( DbgInfo, "No Length/Type in LTV!!!\n" ); - DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" ); - DBG_LEAVE( DbgInfo ); + DBG_ERROR(DbgInfo, "No Length/Type in LTV!!!\n"); + DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n"); + DBG_LEAVE(DbgInfo); return result; } /* Verify the user buffer */ - result = verify_area( VERIFY_READ, urq->data, urq->len ); - if( result != 0 ) { + result = verify_area(VERIFY_READ, urq->data, urq->len); + if (result != 0) { urq->result = UIL_FAILURE; - DBG_ERROR( DbgInfo, "verify_area(), VERIFY_READ FAILED\n" ); - DBG_LEAVE( DbgInfo ); + DBG_ERROR(DbgInfo, "verify_area(), VERIFY_READ FAILED\n"); + DBG_LEAVE(DbgInfo); return result; } /* Get only the command and length information. */ - copy_from_user( &( lp->ltvRecord ), urq->data, sizeof( hcf_16 ) * 2 ); + copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2); /* Make sure the incoming LTV record length is within the bounds of the IOCTL length */ - if((( lp->ltvRecord.len + 1 ) * sizeof( hcf_16 )) > urq->len ) { - urq->len = sizeof( lp->ltvRecord ); + if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) { + urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; - DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" ); - DBG_LEAVE( DbgInfo ); + DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n"); + DBG_LEAVE(DbgInfo); return result; } /* If the requested length is greater than the size of our local LTV record, try to allocate it from the kernel stack. Otherwise, we just use our local LTV record. */ - if( urq->len > sizeof( lp->ltvRecord )) { + if (urq->len > sizeof(lp->ltvRecord)) { pLtv = kmalloc(urq->len, GFP_KERNEL); if (pLtv != NULL) { ltvAllocated = TRUE; } else { - DBG_ERROR( DbgInfo, "Alloc FAILED\n" ); - urq->len = sizeof( lp->ltvRecord ); + DBG_ERROR(DbgInfo, "Alloc FAILED\n"); + urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; result = -ENOMEM; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } } else { - pLtv = &( lp->ltvRecord ); + pLtv = &(lp->ltvRecord); } /* Copy the data from the user's buffer into the local LTV record data area. */ - copy_from_user( pLtv, urq->data, urq->len ); + copy_from_user(pLtv, urq->data, urq->len); /* We need to snoop the commands to see if there is anything we need to store for the purposes of a reset or start/stop sequence. Perform endian translation as needed */ - switch( pLtv->typ ) { + switch (pLtv->typ) { case CFG_CNF_PORT_TYPE: lp->PortType = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_OWN_MAC_ADDR: /* TODO: determine if we are going to store anything based on this */ break; case CFG_CNF_OWN_CHANNEL: lp->Channel = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; /* CFG_CNF_OWN_SSID currently same as CNF_DESIRED_SSID. Do we need separate storage for this? */ - //case CFG_CNF_OWN_SSID: + /* case CFG_CNF_OWN_SSID: */ case CFG_CNF_OWN_ATIM_WINDOW: lp->atimWindow = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_SYSTEM_SCALE: lp->DistanceBetweenAPs = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); case CFG_CNF_MAX_DATA_LEN: /* TODO: determine if we are going to store anything based @@ -670,163 +670,163 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) break; case CFG_CNF_PM_ENABLED: lp->PMEnabled = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_MCAST_RX: lp->MulticastReceive = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_MAX_SLEEP_DURATION: lp->MaxSleepDuration = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_HOLDOVER_DURATION: lp->holdoverDuration = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_OWN_NAME: - memset( lp->StationName, 0, sizeof( lp->StationName )); - memcpy( (void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + memset(lp->StationName, 0, sizeof(lp->StationName)); + memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: lp->loadBalancing = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_MEDIUM_DISTRIBUTION: lp->mediumDistribution = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; #ifdef WARP case CFG_CNF_TX_POW_LVL: lp->txPowLevel = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; - //case CFG_CNF_SHORT_RETRY_LIMIT: // Short Retry Limit - //case 0xFC33: // Long Retry Limit - case CFG_SUPPORTED_RATE_SET_CNTL: // Supported Rate Set Control + /* case CFG_CNF_SHORT_RETRY_LIMIT: */ /* Short Retry Limit */ + /* case 0xFC33: */ /* Long Retry Limit */ + case CFG_SUPPORTED_RATE_SET_CNTL: /* Supported Rate Set Control */ lp->srsc[0] = pLtv->u.u16[0]; lp->srsc[1] = pLtv->u.u16[1]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); - pLtv->u.u16[1] = CNV_INT_TO_LITTLE( pLtv->u.u16[1] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); + pLtv->u.u16[1] = CNV_INT_TO_LITTLE(pLtv->u.u16[1]); break; - case CFG_BASIC_RATE_SET_CNTL: // Basic Rate Set Control + case CFG_BASIC_RATE_SET_CNTL: /* Basic Rate Set Control */ lp->brsc[0] = pLtv->u.u16[0]; lp->brsc[1] = pLtv->u.u16[1]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); - pLtv->u.u16[1] = CNV_INT_TO_LITTLE( pLtv->u.u16[1] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); + pLtv->u.u16[1] = CNV_INT_TO_LITTLE(pLtv->u.u16[1]); break; case CFG_CNF_CONNECTION_CNTL: lp->connectionControl = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; - //case CFG_PROBE_DATA_RATE: -#endif // HERMES25 + /* case CFG_PROBE_DATA_RATE: */ +#endif /* HERMES25 */ -#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP - //;?should we restore this to allow smaller memory footprint +#if 1 /* ;? (HCF_TYPE) & HCF_TYPE_AP */ + /* ;?should we restore this to allow smaller memory footprint */ case CFG_CNF_OWN_DTIM_PERIOD: lp->DTIMPeriod = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; #ifdef WARP - case CFG_CNF_OWN_BEACON_INTERVAL: // Own Beacon Interval + case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */ lp->ownBeaconInterval = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; -#endif // WARP - case CFG_COEXISTENSE_BEHAVIOUR: // Coexistence behavior +#endif /* WARP */ + case CFG_COEXISTENSE_BEHAVIOUR: /* Coexistence behavior */ lp->coexistence = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; #ifdef USE_WDS case CFG_CNF_WDS_ADDR1: - memcpy( &lp->wds_port[0].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + memcpy(&lp->wds_port[0].wdsAddress, &pLtv->u.u8[0], ETH_ALEN); hcfPort = HCF_PORT_1; break; case CFG_CNF_WDS_ADDR2: - memcpy( &lp->wds_port[1].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + memcpy(&lp->wds_port[1].wdsAddress, &pLtv->u.u8[0], ETH_ALEN); hcfPort = HCF_PORT_2; break; case CFG_CNF_WDS_ADDR3: - memcpy( &lp->wds_port[2].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + memcpy(&lp->wds_port[2].wdsAddress, &pLtv->u.u8[0], ETH_ALEN); hcfPort = HCF_PORT_3; break; case CFG_CNF_WDS_ADDR4: - memcpy( &lp->wds_port[3].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + memcpy(&lp->wds_port[3].wdsAddress, &pLtv->u.u8[0], ETH_ALEN); hcfPort = HCF_PORT_4; break; case CFG_CNF_WDS_ADDR5: - memcpy( &lp->wds_port[4].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + memcpy(&lp->wds_port[4].wdsAddress, &pLtv->u.u8[0], ETH_ALEN); hcfPort = HCF_PORT_5; break; case CFG_CNF_WDS_ADDR6: - memcpy( &lp->wds_port[5].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + memcpy(&lp->wds_port[5].wdsAddress, &pLtv->u.u8[0], ETH_ALEN); hcfPort = HCF_PORT_6; break; #endif /* USE_WDS */ case CFG_CNF_MCAST_PM_BUF: lp->multicastPMBuffering = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_REJECT_ANY: lp->RejectAny = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; #endif case CFG_CNF_ENCRYPTION: lp->EnableEncryption = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_AUTHENTICATION: lp->authentication = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; -#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP - //;?should we restore this to allow smaller memory footprint +#if 1 /* ;? (HCF_TYPE) & HCF_TYPE_AP */ + /* ;?should we restore this to allow smaller memory footprint */ - //case CFG_CNF_EXCL_UNENCRYPTED: - //lp->ExcludeUnencrypted = pLtv->u.u16[0]; - //pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); - //break; + /* case CFG_CNF_EXCL_UNENCRYPTED: + lp->ExcludeUnencrypted = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); + break; */ case CFG_CNF_MCAST_RATE: /* TODO: determine if we are going to store anything based on this */ break; case CFG_CNF_INTRA_BSS_RELAY: lp->intraBSSRelay = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; #endif case CFG_CNF_MICRO_WAVE: /* TODO: determine if we are going to store anything based on this */ break; - //case CFG_CNF_LOAD_BALANCING: + /*case CFG_CNF_LOAD_BALANCING:*/ /* TODO: determine if we are going to store anything based on this */ - //break; - //case CFG_CNF_MEDIUM_DISTRIBUTION: + /* break; */ + /* case CFG_CNF_MEDIUM_DISTRIBUTION: */ /* TODO: determine if we are going to store anything based on this */ - //break; - //case CFG_CNF_RX_ALL_GROUP_ADDRESS: - // TODO: determine if we are going to store anything based on this - //break; - //case CFG_CNF_COUNTRY_INFO: + /* break; */ + /* case CFG_CNF_RX_ALL_GROUP_ADDRESS: */ + /* TODO: determine if we are going to store anything based on this */ + /* break; */ + /* case CFG_CNF_COUNTRY_INFO: */ /* TODO: determine if we are going to store anything based on this */ - //break; + /* break; */ case CFG_CNF_OWN_SSID: - //case CNF_DESIRED_SSID: + /* case CNF_DESIRED_SSID: */ case CFG_DESIRED_SSID: - memset( lp->NetworkName, 0, sizeof( lp->NetworkName )); - memcpy( (void *)lp->NetworkName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0] ); - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + memset(lp->NetworkName, 0, sizeof(lp->NetworkName)); + memcpy((void *)lp->NetworkName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); /* take care of the special network name "ANY" case */ - if(( strlen( &pLtv->u.u8[2] ) == 0 ) || - ( strcmp( &pLtv->u.u8[2], "ANY" ) == 0 ) || - ( strcmp( &pLtv->u.u8[2], "any" ) == 0 )) { + if ((strlen(&pLtv->u.u8[2]) == 0) || + (strcmp(&pLtv->u.u8[2], "ANY") == 0) || + (strcmp(&pLtv->u.u8[2], "any") == 0)) { /* set the SSID_STRCT llen field (u16[0]) to zero, and the effectually null the string u8[2] */ pLtv->u.u16[0] = 0; @@ -838,93 +838,93 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) break; case CFG_CREATE_IBSS: lp->CreateIBSS = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_RTS_THRH: lp->RTSThreshold = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_TX_RATE_CNTL: lp->TxRateControl[0] = pLtv->u.u16[0]; lp->TxRateControl[1] = pLtv->u.u16[1]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); - pLtv->u.u16[1] = CNV_INT_TO_LITTLE( pLtv->u.u16[1] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); + pLtv->u.u16[1] = CNV_INT_TO_LITTLE(pLtv->u.u16[1]); break; case CFG_PROMISCUOUS_MODE: /* TODO: determine if we are going to store anything based on this */ break; - //case CFG_WAKE_ON_LAN: + /* case CFG_WAKE_ON_LAN: */ /* TODO: determine if we are going to store anything based on this */ - //break; -#if 1 //;? #if (HCF_TYPE) & HCF_TYPE_AP - //;?should we restore this to allow smaller memory footprint + /* break; */ +#if 1 /* ;? #if (HCF_TYPE) & HCF_TYPE_AP */ + /* ;?should we restore this to allow smaller memory footprint */ case CFG_RTS_THRH0: lp->RTSThreshold = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_TX_RATE_CNTL0: -//;?no idea what this should be, get going so comment it out lp->TxRateControl = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); +/*;?no idea what this should be, get going so comment it out lp->TxRateControl = pLtv->u.u16[0];*/ + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; #ifdef USE_WDS case CFG_RTS_THRH1: lp->wds_port[0].rtsThreshold = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_1; break; case CFG_RTS_THRH2: lp->wds_port[1].rtsThreshold = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_2; break; case CFG_RTS_THRH3: lp->wds_port[2].rtsThreshold = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_3; break; case CFG_RTS_THRH4: lp->wds_port[3].rtsThreshold = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_4; break; case CFG_RTS_THRH5: lp->wds_port[4].rtsThreshold = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_5; break; case CFG_RTS_THRH6: lp->wds_port[5].rtsThreshold = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_6; break; case CFG_TX_RATE_CNTL1: lp->wds_port[0].txRateCntl = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_1; break; case CFG_TX_RATE_CNTL2: lp->wds_port[1].txRateCntl = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_2; break; case CFG_TX_RATE_CNTL3: lp->wds_port[2].txRateCntl = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_3; break; case CFG_TX_RATE_CNTL4: lp->wds_port[3].txRateCntl = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_4; break; case CFG_TX_RATE_CNTL5: lp->wds_port[4].txRateCntl = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_5; break; case CFG_TX_RATE_CNTL6: lp->wds_port[5].txRateCntl = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); hcfPort = HCF_PORT_6; break; #endif /* USE_WDS */ @@ -934,18 +934,18 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) { CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)pLtv; - pKeys->key[0].len = CNV_INT_TO_LITTLE( pKeys->key[0].len ); - pKeys->key[1].len = CNV_INT_TO_LITTLE( pKeys->key[1].len ); - pKeys->key[2].len = CNV_INT_TO_LITTLE( pKeys->key[2].len ); - pKeys->key[3].len = CNV_INT_TO_LITTLE( pKeys->key[3].len ); + pKeys->key[0].len = CNV_INT_TO_LITTLE(pKeys->key[0].len); + pKeys->key[1].len = CNV_INT_TO_LITTLE(pKeys->key[1].len); + pKeys->key[2].len = CNV_INT_TO_LITTLE(pKeys->key[2].len); + pKeys->key[3].len = CNV_INT_TO_LITTLE(pKeys->key[3].len); - memcpy( (void *)&(lp->DefaultKeys), (void *)pKeys, - sizeof( CFG_DEFAULT_KEYS_STRCT )); + memcpy((void *)&(lp->DefaultKeys), (void *)pKeys, + sizeof(CFG_DEFAULT_KEYS_STRCT)); } break; case CFG_TX_KEY_ID: lp->TransmitKeyID = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_SCAN_SSID: /* TODO: determine if we are going to store anything based on this */ @@ -956,7 +956,7 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) /* these RIDS are Info RIDs, and should they be allowed for puts??? */ case CFG_MAX_LOAD_TIME: case CFG_DL_BUF: - //case CFG_HSI_SUP_RANGE: + /* case CFG_HSI_SUP_RANGE: */ case CFG_NIC_SERIAL_NUMBER: case CFG_NIC_IDENTITY: case CFG_NIC_MFI_SUP_RANGE: @@ -982,35 +982,35 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) case CFG_CF_POLLABLE: case CFG_AUTHENTICATION_ALGORITHMS: case CFG_PRIVACY_OPT_IMPLEMENTED: - //case CFG_CURRENT_REMOTE_RATES: - //case CFG_CURRENT_USED_RATES: - //case CFG_CURRENT_SYSTEM_SCALE: - //case CFG_CURRENT_TX_RATE1: - //case CFG_CURRENT_TX_RATE2: - //case CFG_CURRENT_TX_RATE3: - //case CFG_CURRENT_TX_RATE4: - //case CFG_CURRENT_TX_RATE5: - //case CFG_CURRENT_TX_RATE6: + /* case CFG_CURRENT_REMOTE_RATES: */ + /* case CFG_CURRENT_USED_RATES: */ + /* case CFG_CURRENT_SYSTEM_SCALE: */ + /* case CFG_CURRENT_TX_RATE1: */ + /* case CFG_CURRENT_TX_RATE2: */ + /* case CFG_CURRENT_TX_RATE3: */ + /* case CFG_CURRENT_TX_RATE4: */ + /* case CFG_CURRENT_TX_RATE5: */ + /* case CFG_CURRENT_TX_RATE6: */ case CFG_NIC_MAC_ADDR: case CFG_PCF_INFO: - //case CFG_CURRENT_COUNTRY_INFO: + /* case CFG_CURRENT_COUNTRY_INFO: */ case CFG_PHY_TYPE: case CFG_CUR_CHANNEL: - //case CFG_CURRENT_POWER_STATE: - //case CFG_CCAMODE: + /* case CFG_CURRENT_POWER_STATE: */ + /* case CFG_CCAMODE: */ case CFG_SUPPORTED_DATA_RATES: break; case CFG_AP_MODE: -//;? lp->DownloadFirmware = ( pLtv->u.u16[0] ) + 1; - DBG_ERROR( DbgInfo, "set CFG_AP_MODE no longer supported\n" ); +/*;? lp->DownloadFirmware = (pLtv->u.u16[0]) + 1; */ + DBG_ERROR(DbgInfo, "set CFG_AP_MODE no longer supported\n"); break; case CFG_ENCRYPT_STRING: /* TODO: ENDIAN TRANSLATION HERE??? */ - memset( lp->szEncryption, 0, sizeof( lp->szEncryption )); - memcpy( (void *)lp->szEncryption, (void *)&pLtv->u.u8[0], - ( pLtv->len * sizeof( hcf_16 )) ); - wl_wep_decode( CRYPT_CODE, &sEncryption, - lp->szEncryption ); + memset(lp->szEncryption, 0, sizeof(lp->szEncryption)); + memcpy((void *)lp->szEncryption, (void *)&pLtv->u.u8[0], + (pLtv->len * sizeof(hcf_16))); + wl_wep_decode(CRYPT_CODE, &sEncryption, + lp->szEncryption); /* the Linux driver likes to use 1-4 for the key IDs, and then convert to 0-3 when sending to the card. The Windows code @@ -1022,34 +1022,34 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) lp->TransmitKeyID = sEncryption.wTxKeyID + 1; lp->EnableEncryption = sEncryption.wEnabled; - memcpy( &lp->DefaultKeys, &sEncryption.EncStr, - sizeof( CFG_DEFAULT_KEYS_STRCT )); + memcpy(&lp->DefaultKeys, &sEncryption.EncStr, + sizeof(CFG_DEFAULT_KEYS_STRCT)); break; /*case CFG_COUNTRY_STRING: - memset( lp->countryString, 0, sizeof( lp->countryString )); - memcpy( (void *)lp->countryString, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + memset(lp->countryString, 0, sizeof(lp->countryString)); + memcpy((void *)lp->countryString, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); break; */ case CFG_DRIVER_ENABLE: lp->driverEnable = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_WOLAS_ENABLE: lp->wolasEnable = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_SET_WPA_AUTH_KEY_MGMT_SUITE: lp->AuthKeyMgmtSuite = pLtv->u.u16[0]; - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_DISASSOCIATE_ADDR: - pLtv->u.u16[ETH_ALEN / 2] = CNV_INT_TO_LITTLE( pLtv->u.u16[ETH_ALEN / 2] ); + pLtv->u.u16[ETH_ALEN / 2] = CNV_INT_TO_LITTLE(pLtv->u.u16[ETH_ALEN / 2]); break; case CFG_ADD_TKIP_DEFAULT_KEY: case CFG_REMOVE_TKIP_DEFAULT_KEY: /* Endian convert the Tx Key Information */ - pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_ADD_TKIP_MAPPED_KEY: break; @@ -1066,7 +1066,7 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) being sent to the card, as they require a call to UIL_ACT_APPLY to take effect. Dynamic Entities will be sent immediately */ - switch( pLtv->typ ) { + switch (pLtv->typ) { case CFG_CNF_PORT_TYPE: case CFG_CNF_OWN_MAC_ADDR: case CFG_CNF_OWN_CHANNEL: @@ -1084,14 +1084,14 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) #ifdef WARP case CFG_CNF_TX_POW_LVL: case CFG_CNF_CONNECTION_CNTL: - //case CFG_PROBE_DATA_RATE: -#endif // HERMES25 -#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP - //;?should we restore this to allow smaller memory footprint + /*case CFG_PROBE_DATA_RATE: */ +#endif /* HERMES25 */ +#if 1 /*;? (HCF_TYPE) & HCF_TYPE_AP */ + /*;?should we restore this to allow smaller memory footprint */ case CFG_CNF_OWN_DTIM_PERIOD: #ifdef WARP - case CFG_CNF_OWN_BEACON_INTERVAL: // Own Beacon Interval -#endif // WARP + case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */ +#endif /* WARP */ #ifdef USE_WDS case CFG_CNF_WDS_ADDR1: case CFG_CNF_WDS_ADDR2: @@ -1106,8 +1106,8 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) case CFG_CNF_ENCRYPTION: case CFG_CNF_AUTHENTICATION: -#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP - //;?should we restore this to allow smaller memory footprint +#if 1 /* ;? (HCF_TYPE) & HCF_TYPE_AP */ + /* ;?should we restore this to allow smaller memory footprint */ case CFG_CNF_EXCL_UNENCRYPTED: case CFG_CNF_MCAST_RATE: @@ -1115,68 +1115,54 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) #endif case CFG_CNF_MICRO_WAVE: - //case CFG_CNF_LOAD_BALANCING: - //case CFG_CNF_MEDIUM_DISTRIBUTION: - //case CFG_CNF_RX_ALL_GROUP_ADDRESS: - //case CFG_CNF_COUNTRY_INFO: - //case CFG_COUNTRY_STRING: + /* case CFG_CNF_LOAD_BALANCING: */ + /* case CFG_CNF_MEDIUM_DISTRIBUTION: */ + /* case CFG_CNF_RX_ALL_GROUP_ADDRESS: */ + /* case CFG_CNF_COUNTRY_INFO: */ + /* case CFG_COUNTRY_STRING: */ case CFG_AP_MODE: case CFG_ENCRYPT_STRING: - //case CFG_DRIVER_ENABLE: + /* case CFG_DRIVER_ENABLE: */ case CFG_WOLAS_ENABLE: case CFG_MB_INFO: case CFG_IFB: break; /* Deal with this dynamic MSF RID, as it's required for WPA */ case CFG_DRIVER_ENABLE: - if( lp->driverEnable ) { - //hcf_cntl_port( &( lp->hcfCtx ), - // HCF_PORT_ENABLE | HCF_PORT_0 ); - // //hcf_cntl( &( lp->hcfCtx ), - // // HCF_PORT_ENABLE | HCF_PORT_0 ); - //hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_ENABLE ); - // //hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_CONNECT ); - - hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_ENABLE | HCF_PORT_0 ); - hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_CONNECT ); + if (lp->driverEnable) { + hcf_cntl(&(lp->hcfCtx), HCF_CNTL_ENABLE | HCF_PORT_0); + hcf_cntl(&(lp->hcfCtx), HCF_CNTL_CONNECT); } else { - //hcf_cntl_port( &( lp->hcfCtx ), - // HCF_PORT_DISABLE | HCF_PORT_0 ); - // //hcf_cntl( &( lp->hcfCtx ), - // // HCF_PORT_DISABLE | HCF_PORT_0 ); - //hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISABLE ); - // //hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISCONNECT ); - - hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISABLE | HCF_PORT_0 ); - hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISCONNECT ); + hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISABLE | HCF_PORT_0); + hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISCONNECT); } break; default: - wl_act_int_off( lp ); + wl_act_int_off(lp); urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv); - wl_act_int_on( lp ); + wl_act_int_on(lp); break; } - if( ltvAllocated ) { - kfree( pLtv ); - } + if (ltvAllocated) + kfree(pLtv); } else { urq->result = UIL_FAILURE; } } else { - DBG_ERROR( DbgInfo, "EPERM\n" ); + DBG_ERROR(DbgInfo, "EPERM\n"); urq->result = UIL_FAILURE; result = -EPERM; } } else { - DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // wvlan_uil_put_info +} /* wvlan_uil_put_info */ + /*============================================================================*/ /******************************************************************************* @@ -1199,97 +1185,97 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) +int wvlan_uil_get_info(struct uilreq *urq, struct wl_private *lp) { int result = 0; int i; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_uil_get_info" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_uil_get_info"); + DBG_ENTER(DbgInfo); - if( urq->hcfCtx == &( lp->hcfCtx )) { - if(( urq->data != NULL ) && ( urq->len != 0 )) { + if (urq->hcfCtx == &(lp->hcfCtx)) { + if ((urq->data != NULL) && (urq->len != 0)) { ltv_t *pLtv; bool_t ltvAllocated = FALSE; /* Make sure that we have at least a command and length */ - if( urq->len < ( sizeof( hcf_16 ) * 2 )) { - urq->len = sizeof( lp->ltvRecord ); - DBG_ERROR( DbgInfo, "No Length/Type in LTV!!!\n" ); - DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" ); + if (urq->len < (sizeof(hcf_16) * 2)) { + urq->len = sizeof(lp->ltvRecord); + DBG_ERROR(DbgInfo, "No Length/Type in LTV!!!\n"); + DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n"); urq->result = UIL_ERR_LEN; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } /* Verify the user's LTV record header. */ - result = verify_area( VERIFY_READ, urq->data, sizeof( hcf_16 ) * 2 ); - if( result != 0 ) { - DBG_ERROR( DbgInfo, "verify_area(), VERIFY_READ FAILED\n" ); + result = verify_area(VERIFY_READ, urq->data, sizeof(hcf_16) * 2); + if (result != 0) { + DBG_ERROR(DbgInfo, "verify_area(), VERIFY_READ FAILED\n"); urq->result = UIL_FAILURE; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } /* Get only the command and length information. */ - result = copy_from_user( &( lp->ltvRecord ), urq->data, sizeof( hcf_16 ) * 2 ); + result = copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2); /* Make sure the incoming LTV record length is within the bounds of the IOCTL length. */ - if((( lp->ltvRecord.len + 1 ) * sizeof( hcf_16 )) > urq->len ) { - DBG_ERROR( DbgInfo, "Incoming LTV too big\n" ); - urq->len = sizeof( lp->ltvRecord ); + if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) { + DBG_ERROR(DbgInfo, "Incoming LTV too big\n"); + urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } /* Determine if hcf_get_info() is needed or not */ - switch ( lp->ltvRecord.typ ) { + switch (lp->ltvRecord.typ) { case CFG_NIC_IDENTITY: - memcpy( &lp->ltvRecord.u.u8[0], &lp->NICIdentity, sizeof( lp->NICIdentity )); + memcpy(&lp->ltvRecord.u.u8[0], &lp->NICIdentity, sizeof(lp->NICIdentity)); break; case CFG_PRI_IDENTITY: - memcpy( &lp->ltvRecord.u.u8[0], &lp->PrimaryIdentity, sizeof( lp->PrimaryIdentity )); + memcpy(&lp->ltvRecord.u.u8[0], &lp->PrimaryIdentity, sizeof(lp->PrimaryIdentity)); break; case CFG_AP_MODE: - DBG_ERROR( DbgInfo, "set CFG_AP_MODE no longer supported, so is get useful ????\n" ); + DBG_ERROR(DbgInfo, "set CFG_AP_MODE no longer supported, so is get useful ????\n"); lp->ltvRecord.u.u16[0] = - CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP; + CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_AP; break; - //case CFG_DRV_INFO: + /* case CFG_DRV_INFO: */ case CFG_ENCRYPT_STRING: case CFG_COUNTRY_STRING: case CFG_DRIVER_ENABLE: case CFG_WOLAS_ENABLE: - // TODO: determine if we're going to support these + /* TODO: determine if we're going to support these */ urq->result = UIL_FAILURE; break; case CFG_DRV_INFO: - DBG_TRACE( DbgInfo, "Intercept CFG_DRV_INFO\n" ); - result = cfg_driver_info( urq, lp ); + DBG_TRACE(DbgInfo, "Intercept CFG_DRV_INFO\n"); + result = cfg_driver_info(urq, lp); break; case CFG_DRV_IDENTITY: - DBG_TRACE( DbgInfo, "Intercept CFG_DRV_IDENTITY\n" ); - result = cfg_driver_identity( urq, lp ); + DBG_TRACE(DbgInfo, "Intercept CFG_DRV_IDENTITY\n"); + result = cfg_driver_identity(urq, lp); break; case CFG_IFB: /* IFB can be a security hole */ - if( !capable( CAP_NET_ADMIN )) { + if (!capable(CAP_NET_ADMIN)) { result = -EPERM; break; } /* Else fall through to the default */ - case CFG_FW_IDENTITY: // For Hermes-1, this is cached + case CFG_FW_IDENTITY: /* For Hermes-1, this is cached */ default: /* Verify the user buffer */ - result = verify_area( VERIFY_WRITE, urq->data, urq->len ); - if( result != 0 ) { - DBG_ERROR( DbgInfo, "verify_area(), VERIFY_WRITE FAILED\n" ); + result = verify_area(VERIFY_WRITE, urq->data, urq->len); + if (result != 0) { + DBG_ERROR(DbgInfo, "verify_area(), VERIFY_WRITE FAILED\n"); urq->result = UIL_FAILURE; break; } @@ -1297,43 +1283,43 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) /* If the requested length is greater than the size of our local LTV record, try to allocate it from the kernel stack. Otherwise, we just use our local LTV record. */ - if( urq->len > sizeof( lp->ltvRecord )) { + if (urq->len > sizeof(lp->ltvRecord)) { pLtv = kmalloc(urq->len, GFP_KERNEL); if (pLtv != NULL) { ltvAllocated = TRUE; /* Copy the command/length information into the new buffer. */ - memcpy( pLtv, &( lp->ltvRecord ), sizeof( hcf_16 ) * 2 ); + memcpy(pLtv, &(lp->ltvRecord), sizeof(hcf_16) * 2); } else { - urq->len = sizeof( lp->ltvRecord ); + urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; - DBG_ERROR( DbgInfo, "kmalloc FAILED\n" ); - DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" ); + DBG_ERROR(DbgInfo, "kmalloc FAILED\n"); + DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n"); result = -ENOMEM; break; } } else { - pLtv = &( lp->ltvRecord ); + pLtv = &(lp->ltvRecord); } - wl_act_int_off( lp ); - urq->result = hcf_get_info( &( lp->hcfCtx ), (LTVP) pLtv ); - wl_act_int_on( lp ); + wl_act_int_off(lp); + urq->result = hcf_get_info(&(lp->hcfCtx), (LTVP) pLtv); + wl_act_int_on(lp); - // Copy the LTV into the user's buffer. - //copy_to_user( urq->data, pLtv, urq->len ); + /* Copy the LTV into the user's buffer. */ + /*copy_to_user(urq->data, pLtv, urq->len); */ - //if( ltvAllocated ) - //{ - // kfree( pLtv ); - //} + /*if(ltvAllocated) + { + kfree(pLtv); + }*/ - //urq->result = UIL_SUCCESS; + /* urq->result = UIL_SUCCESS; */ break; } /* Handle endian conversion of special fields */ - switch( lp->ltvRecord.typ ) { + switch (lp->ltvRecord.typ) { /* simple int gets just need the first hcf_16 byte flipped */ case CFG_CNF_PORT_TYPE: case CFG_CNF_OWN_CHANNEL: @@ -1357,14 +1343,14 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) #ifdef WARP case CFG_CNF_TX_POW_LVL: case CFG_CNF_CONNECTION_CNTL: - case CFG_CNF_OWN_BEACON_INTERVAL: // Own Beacon Interval - case CFG_COEXISTENSE_BEHAVIOUR: // Coexistence Behavior - //case CFG_CNF_RX_ALL_GROUP_ADDRESS: -#endif // HERMES25 + case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */ + case CFG_COEXISTENSE_BEHAVIOUR: /* Coexistence Behavior */ + /*case CFG_CNF_RX_ALL_GROUP_ADDRESS: */ +#endif /* HERMES25 */ case CFG_CREATE_IBSS: case CFG_RTS_THRH: case CFG_PROMISCUOUS_MODE: - //case CFG_WAKE_ON_LAN: + /*case CFG_WAKE_ON_LAN: */ case CFG_RTS_THRH0: case CFG_RTS_THRH1: case CFG_RTS_THRH2: @@ -1393,29 +1379,29 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) case CFG_MAX_RX_LIFETIME: case CFG_CF_POLLABLE: case CFG_PRIVACY_OPT_IMPLEMENTED: - //case CFG_CURRENT_REMOTE_RATES: - //case CFG_CURRENT_USED_RATES: - //case CFG_CURRENT_SYSTEM_SCALE: - //case CFG_CURRENT_TX_RATE1: - //case CFG_CURRENT_TX_RATE2: - //case CFG_CURRENT_TX_RATE3: - //case CFG_CURRENT_TX_RATE4: - //case CFG_CURRENT_TX_RATE5: - //case CFG_CURRENT_TX_RATE6: + /* case CFG_CURRENT_REMOTE_RATES: */ + /* case CFG_CURRENT_USED_RATES: */ + /* case CFG_CURRENT_SYSTEM_SCALE: */ + /* case CFG_CURRENT_TX_RATE1: */ + /* case CFG_CURRENT_TX_RATE2: */ + /* case CFG_CURRENT_TX_RATE3: */ + /* case CFG_CURRENT_TX_RATE4: */ + /* case CFG_CURRENT_TX_RATE5: */ + /* case CFG_CURRENT_TX_RATE6: */ case CFG_PHY_TYPE: case CFG_CUR_CHANNEL: - //case CFG_CURRENT_POWER_STATE: - //case CFG_CCAMODE: - // lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); - // break; + /* case CFG_CURRENT_POWER_STATE: */ + /* case CFG_CCAMODE: */ + /* lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); */ + /* break; */ /* name string gets just need the first hcf_16 byte flipped (length of string) */ case CFG_CNF_OWN_SSID: case CFG_CNF_OWN_NAME: - //case CNF_DESIRED_SSID: + /* case CNF_DESIRED_SSID: */ case CFG_DESIRED_SSID: case CFG_SCAN_SSID: case CFG_CUR_SSID: - lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); break; /* non-length counted strings need no byte flipping */ case CFG_CNF_OWN_MAC_ADDR: @@ -1432,14 +1418,14 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) case CFG_NIC_MAC_ADDR: case CFG_SUPPORTED_DATA_RATES: /* need to ensure we can treat this as a string */ break; - //case CFG_CNF_COUNTRY_INFO: /* special case, see page 75 of 022486, Rev C. */ - //case CFG_CURRENT_COUNTRY_INFO: /* special case, see page 101 of 022486, Rev C. */ + /* case CFG_CNF_COUNTRY_INFO: */ /* special case, see page 75 of 022486, Rev C. */ + /* case CFG_CURRENT_COUNTRY_INFO: */ /* special case, see page 101 of 022486, Rev C. */ /* - lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); - lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[3] ); + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); + lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); - for( i = 4; i < lp->ltvRecord.len; i++ ) { - lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[i] ); + for(i = 4; i < lp->ltvRecord.len; i++) { + lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]); } break; */ @@ -1448,57 +1434,56 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) { CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)&lp->ltvRecord.u.u8[0]; - pKeys[0].len = CNV_INT_TO_LITTLE( pKeys[0].len ); - pKeys[1].len = CNV_INT_TO_LITTLE( pKeys[1].len ); - pKeys[2].len = CNV_INT_TO_LITTLE( pKeys[2].len ); - pKeys[3].len = CNV_INT_TO_LITTLE( pKeys[3].len ); + pKeys[0].len = CNV_INT_TO_LITTLE(pKeys[0].len); + pKeys[1].len = CNV_INT_TO_LITTLE(pKeys[1].len); + pKeys[2].len = CNV_INT_TO_LITTLE(pKeys[2].len); + pKeys[3].len = CNV_INT_TO_LITTLE(pKeys[3].len); } break; case CFG_CNF_MCAST_RATE: case CFG_TX_RATE_CNTL: - case CFG_SUPPORTED_RATE_SET_CNTL: // Supported Rate Set Control - case CFG_BASIC_RATE_SET_CNTL: // Basic Rate Set Control - lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); - lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[1] ); + case CFG_SUPPORTED_RATE_SET_CNTL: /* Supported Rate Set Control */ + case CFG_BASIC_RATE_SET_CNTL: /* Basic Rate Set Control */ + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); break; case CFG_DL_BUF: case CFG_NIC_IDENTITY: case CFG_COMMS_QUALITY: case CFG_PCF_INFO: - lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); - lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[1] ); - lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[2] ); + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); + lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); break; case CFG_FW_IDENTITY: - lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); - lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[1] ); - lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[2] ); - lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[3] ); + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); + lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); + lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); break; - //case CFG_HSI_SUP_RANGE: + /* case CFG_HSI_SUP_RANGE: */ case CFG_NIC_MFI_SUP_RANGE: case CFG_NIC_CFI_SUP_RANGE: case CFG_NIC_PROFILE: case CFG_FW_SUP_RANGE: - lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); - lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[1] ); - lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[2] ); - lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[3] ); - lp->ltvRecord.u.u16[4] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[4] ); + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); + lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); + lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); + lp->ltvRecord.u.u16[4] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[4]); break; case CFG_MFI_ACT_RANGES_STA: case CFG_CFI_ACT_RANGES_STA: case CFG_CUR_SCALE_THRH: case CFG_AUTHENTICATION_ALGORITHMS: - for( i = 0; i < ( lp->ltvRecord.len - 1 ); i++ ) { - lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[i] ); - } + for (i = 0; i < (lp->ltvRecord.len - 1); i++) + lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]); break; /* done at init time, and endian handled then */ case CFG_PRI_IDENTITY: break; case CFG_MB_INFO: - //wvlanEndianTranslateMailbox( pLtv ); + /* wvlanEndianTranslateMailbox(pLtv); */ break; /* MSF and HCF RIDS */ case CFG_IFB: @@ -1512,25 +1497,23 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) break; } - // Copy the LTV into the user's buffer. - copy_to_user( urq->data, &( lp->ltvRecord ), urq->len ); - - if( ltvAllocated ) { - kfree( &( lp->ltvRecord )); - } + /* Copy the LTV into the user's buffer. */ + copy_to_user(urq->data, &(lp->ltvRecord), urq->len); + if (ltvAllocated) + kfree(&(lp->ltvRecord)); urq->result = UIL_SUCCESS; } else { urq->result = UIL_FAILURE; } } else { - DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // wvlan_uil_get_info +} /* wvlan_uil_get_info */ /*============================================================================*/ @@ -1556,41 +1539,41 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int cfg_driver_info( struct uilreq *urq, struct wl_private *lp ) +int cfg_driver_info(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "cfg_driver_info" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("cfg_driver_info"); + DBG_ENTER(DbgInfo); /* Make sure that user buffer can handle the driver information buffer */ - if( urq->len < sizeof( lp->driverInfo )) { - urq->len = sizeof( lp->driverInfo ); + if (urq->len < sizeof(lp->driverInfo)) { + urq->len = sizeof(lp->driverInfo); urq->result = UIL_ERR_LEN; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } /* Verify the user buffer. */ - result = verify_area( VERIFY_WRITE, urq->data, sizeof( lp->driverInfo )); - if( result != 0 ) { + result = verify_area(VERIFY_WRITE, urq->data, sizeof(lp->driverInfo)); + if (result != 0) { urq->result = UIL_FAILURE; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } lp->driverInfo.card_stat = lp->hcfCtx.IFB_CardStat; - // Copy the driver information into the user's buffer. + /* Copy the driver information into the user's buffer. */ urq->result = UIL_SUCCESS; - copy_to_user( urq->data, &( lp->driverInfo ), sizeof( lp->driverInfo )); + copy_to_user(urq->data, &(lp->driverInfo), sizeof(lp->driverInfo)); - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // cfg_driver_info +} /* cfg_driver_info */ /*============================================================================*/ @@ -1615,39 +1598,39 @@ int cfg_driver_info( struct uilreq *urq, struct wl_private *lp ) * UIL_ERR_xxx value otherwise * ******************************************************************************/ -int cfg_driver_identity( struct uilreq *urq, struct wl_private *lp ) +int cfg_driver_identity(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_driver_identity" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_driver_identity"); + DBG_ENTER(DbgInfo); /* Make sure that user buffer can handle the driver identity structure. */ - if( urq->len < sizeof( lp->driverIdentity )) { - urq->len = sizeof( lp->driverIdentity ); + if (urq->len < sizeof(lp->driverIdentity)) { + urq->len = sizeof(lp->driverIdentity); urq->result = UIL_ERR_LEN; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } /* Verify the user buffer. */ - result = verify_area( VERIFY_WRITE, urq->data, sizeof( lp->driverIdentity )); - if( result != 0 ) { + result = verify_area(VERIFY_WRITE, urq->data, sizeof(lp->driverIdentity)); + if (result != 0) { urq->result = UIL_FAILURE; - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; } /* Copy the driver identity into the user's buffer. */ urq->result = UIL_SUCCESS; - copy_to_user( urq->data, &( lp->driverIdentity ), sizeof( lp->driverIdentity )); + copy_to_user(urq->data, &(lp->driverIdentity), sizeof(lp->driverIdentity)); - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return result; -} // cfg_driver_identity +} /* cfg_driver_identity */ /*============================================================================*/ @@ -1684,27 +1667,27 @@ int wvlan_set_netname(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - struct wl_private *lp = wl_priv(dev); - unsigned long flags; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; int ret = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_set_netname" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_set_netname"); + DBG_ENTER(DbgInfo); - wl_lock(lp, &flags); + wl_lock(lp, &flags); - memset( lp->NetworkName, 0, sizeof( lp->NetworkName )); - memcpy( lp->NetworkName, extra, wrqu->data.length); + memset(lp->NetworkName, 0, sizeof(lp->NetworkName)); + memcpy(lp->NetworkName, extra, wrqu->data.length); /* Commit the adapter parameters */ wl_apply(lp); - wl_unlock(lp, &flags); + wl_unlock(lp, &flags); - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return ret; -} // wvlan_set_netname +} /* wvlan_set_netname */ /*============================================================================*/ @@ -1734,41 +1717,41 @@ int wvlan_get_netname(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - struct wl_private *lp = wl_priv(dev); - unsigned long flags; - int ret = 0; - int status = -1; - wvName_t *pName; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + wvName_t *pName; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_get_netname" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_get_netname"); + DBG_ENTER(DbgInfo); - wl_lock(lp, &flags); + wl_lock(lp, &flags); - /* Get the current network name */ - lp->ltvRecord.len = 1 + ( sizeof( *pName ) / sizeof( hcf_16 )); - lp->ltvRecord.typ = CFG_CUR_SSID; + /* Get the current network name */ + lp->ltvRecord.len = 1 + (sizeof(*pName) / sizeof(hcf_16)); + lp->ltvRecord.typ = CFG_CUR_SSID; - status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); - if( status == HCF_SUCCESS ) { - pName = (wvName_t *)&( lp->ltvRecord.u.u32 ); + if (status == HCF_SUCCESS) { + pName = (wvName_t *)&(lp->ltvRecord.u.u32); memset(extra, '\0', HCF_MAX_NAME_LEN); wrqu->data.length = pName->length; - memcpy(extra, pName->name, pName->length); - } else { - ret = -EFAULT; + memcpy(extra, pName->name, pName->length); + } else { + ret = -EFAULT; } - wl_unlock(lp, &flags); + wl_unlock(lp, &flags); - DBG_LEAVE( DbgInfo ); - return ret; -} // wvlan_get_netname + DBG_LEAVE(DbgInfo); + return ret; +} /* wvlan_get_netname */ /*============================================================================*/ @@ -1798,28 +1781,28 @@ int wvlan_set_station_nickname(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - struct wl_private *lp = wl_priv(dev); - unsigned long flags; - int ret = 0; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_set_station_nickname" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_set_station_nickname"); + DBG_ENTER(DbgInfo); - wl_lock(lp, &flags); + wl_lock(lp, &flags); - memset( lp->StationName, 0, sizeof( lp->StationName )); + memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy( lp->StationName, extra, wrqu->data.length); + memcpy(lp->StationName, extra, wrqu->data.length); - /* Commit the adapter parameters */ - wl_apply( lp ); - wl_unlock(lp, &flags); + /* Commit the adapter parameters */ + wl_apply(lp); + wl_unlock(lp, &flags); - DBG_LEAVE( DbgInfo ); - return ret; -} // wvlan_set_station_nickname + DBG_LEAVE(DbgInfo); + return ret; +} /* wvlan_set_station_nickname */ /*============================================================================*/ @@ -1849,41 +1832,41 @@ int wvlan_get_station_nickname(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - struct wl_private *lp = wl_priv(dev); - unsigned long flags; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; int ret = 0; int status = -1; wvName_t *pName; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_get_station_nickname" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_get_station_nickname"); + DBG_ENTER(DbgInfo); - wl_lock( lp, &flags ); + wl_lock(lp, &flags); - /* Get the current station name */ - lp->ltvRecord.len = 1 + ( sizeof( *pName ) / sizeof( hcf_16 )); - lp->ltvRecord.typ = CFG_CNF_OWN_NAME; + /* Get the current station name */ + lp->ltvRecord.len = 1 + (sizeof(*pName) / sizeof(hcf_16)); + lp->ltvRecord.typ = CFG_CNF_OWN_NAME; - status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); - if( status == HCF_SUCCESS ) { - pName = (wvName_t *)&( lp->ltvRecord.u.u32 ); + if (status == HCF_SUCCESS) { + pName = (wvName_t *)&(lp->ltvRecord.u.u32); memset(extra, '\0', HCF_MAX_NAME_LEN); wrqu->data.length = pName->length; memcpy(extra, pName->name, pName->length); - } else { - ret = -EFAULT; - } + } else { + ret = -EFAULT; + } - wl_unlock(lp, &flags); + wl_unlock(lp, &flags); -//out: - DBG_LEAVE( DbgInfo ); +/* out: */ + DBG_LEAVE(DbgInfo); return ret; -} // wvlan_get_station_nickname +} /* wvlan_get_station_nickname */ /*============================================================================*/ @@ -1913,37 +1896,37 @@ int wvlan_set_porttype(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - struct wl_private *lp = wl_priv(dev); - unsigned long flags; - int ret = 0; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; hcf_16 portType; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_set_porttype" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_set_porttype"); + DBG_ENTER(DbgInfo); - wl_lock(lp, &flags); + wl_lock(lp, &flags); - /* Validate the new value */ - portType = *((__u32 *)extra); + /* Validate the new value */ + portType = *((__u32 *)extra); - if( !(( portType == 1 ) || ( portType == 3 ))) { - ret = -EINVAL; + if (!((portType == 1) || (portType == 3))) { + ret = -EINVAL; goto out_unlock; - } + } - lp->PortType = portType; + lp->PortType = portType; - /* Commit the adapter parameters */ - wl_apply( lp ); + /* Commit the adapter parameters */ + wl_apply(lp); out_unlock: - wl_unlock(lp, &flags); + wl_unlock(lp, &flags); -//out: - DBG_LEAVE( DbgInfo ); - return ret; +/* out: */ + DBG_LEAVE(DbgInfo); + return ret; } /*============================================================================*/ @@ -1973,43 +1956,43 @@ int wvlan_get_porttype(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - struct wl_private *lp = wl_priv(dev); - unsigned long flags; - int ret = 0; - int status = -1; - hcf_16 *pPortType; - __u32 *pData = (__u32 *)extra; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + hcf_16 *pPortType; + __u32 *pData = (__u32 *)extra; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_get_porttype" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_get_porttype"); + DBG_ENTER(DbgInfo); - wl_lock( lp, &flags ); + wl_lock(lp, &flags); - /* Get the current port type */ - lp->ltvRecord.len = 1 + ( sizeof( *pPortType ) / sizeof( hcf_16 )); - lp->ltvRecord.typ = CFG_CNF_PORT_TYPE; + /* Get the current port type */ + lp->ltvRecord.len = 1 + (sizeof(*pPortType) / sizeof(hcf_16)); + lp->ltvRecord.typ = CFG_CNF_PORT_TYPE; - status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); - if( status == HCF_SUCCESS ) { - pPortType = (hcf_16 *)&( lp->ltvRecord.u.u32 ); + if (status == HCF_SUCCESS) { + pPortType = (hcf_16 *)&(lp->ltvRecord.u.u32); - *pData = CNV_LITTLE_TO_INT( *pPortType ); - } else { - ret = -EFAULT; + *pData = CNV_LITTLE_TO_INT(*pPortType); + } else { + ret = -EFAULT; } - wl_unlock(lp, &flags); + wl_unlock(lp, &flags); -//out: - DBG_LEAVE( DbgInfo ); - return ret; -} // wvlan_get_porttype +/* out: */ + DBG_LEAVE(DbgInfo); + return ret; +} /* wvlan_get_porttype */ /*============================================================================*/ -#endif // WIRELESS_EXT +#endif /* WIRELESS_EXT */ @@ -2034,49 +2017,49 @@ int wvlan_get_porttype(struct net_device *dev, * errno value otherwise * ******************************************************************************/ -int wvlan_rts( struct rtsreq *rrq, __u32 io_base ) +int wvlan_rts(struct rtsreq *rrq, __u32 io_base) { int ioctl_ret = 0; /*------------------------------------------------------------------------*/ - DBG_FUNC( "wvlan_rts" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("wvlan_rts"); + DBG_ENTER(DbgInfo); - DBG_PRINT( "io_base: 0x%08x\n", io_base ); + DBG_PRINT("io_base: 0x%08x\n", io_base); - switch( rrq->typ ) { - case WL_IOCTL_RTS_READ: + switch (rrq->typ) { + case WL_IOCTL_RTS_READ: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_READ\n"); - rrq->data[0] = IN_PORT_WORD( io_base + rrq->reg ); - DBG_TRACE( DbgInfo, " reg 0x%04x ==> 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT( rrq->data[0] ) ); + rrq->data[0] = IN_PORT_WORD(io_base + rrq->reg); + DBG_TRACE(DbgInfo, " reg 0x%04x ==> 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT(rrq->data[0])); break; - case WL_IOCTL_RTS_WRITE: + case WL_IOCTL_RTS_WRITE: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_WRITE\n"); - OUT_PORT_WORD( io_base + rrq->reg, rrq->data[0] ); - DBG_TRACE( DbgInfo, " reg 0x%04x <== 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT( rrq->data[0] ) ); + OUT_PORT_WORD(io_base + rrq->reg, rrq->data[0]); + DBG_TRACE(DbgInfo, " reg 0x%04x <== 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT(rrq->data[0])); break; - case WL_IOCTL_RTS_BATCH_READ: + case WL_IOCTL_RTS_BATCH_READ: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_READ\n"); - IN_PORT_STRING_16( io_base + rrq->reg, rrq->data, rrq->len ); - DBG_TRACE( DbgInfo, " reg 0x%04x ==> %d bytes\n", rrq->reg, rrq->len * sizeof (__u16 ) ); + IN_PORT_STRING_16(io_base + rrq->reg, rrq->data, rrq->len); + DBG_TRACE(DbgInfo, " reg 0x%04x ==> %d bytes\n", rrq->reg, rrq->len * sizeof(__u16)); break; - case WL_IOCTL_RTS_BATCH_WRITE: + case WL_IOCTL_RTS_BATCH_WRITE: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_WRITE\n"); - OUT_PORT_STRING_16( io_base + rrq->reg, rrq->data, rrq->len ); - DBG_TRACE( DbgInfo, " reg 0x%04x <== %d bytes\n", rrq->reg, rrq->len * sizeof (__u16) ); + OUT_PORT_STRING_16(io_base + rrq->reg, rrq->data, rrq->len); + DBG_TRACE(DbgInfo, " reg 0x%04x <== %d bytes\n", rrq->reg, rrq->len * sizeof(__u16)); break; default: - DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- UNSUPPORTED RTS CODE: 0x%X", rrq->typ ); + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- UNSUPPORTED RTS CODE: 0x%X", rrq->typ); ioctl_ret = -EOPNOTSUPP; break; } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return ioctl_ret; -} // wvlan_rts +} /* wvlan_rts */ /*============================================================================*/ #endif /* USE_RTS */ diff --git a/drivers/staging/wlags49_h2/wl_priv.h b/drivers/staging/wlags49_h2/wl_priv.h index b647bfd90098..f35e79486428 100644 --- a/drivers/staging/wlags49_h2/wl_priv.h +++ b/drivers/staging/wlags49_h2/wl_priv.h @@ -70,52 +70,58 @@ #ifdef WIRELESS_EXT -int wvlan_set_netname( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); +int wvlan_set_netname(struct net_device *, struct iw_request_info *, + union iwreq_data *, char *extra); -int wvlan_get_netname( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); +int wvlan_get_netname(struct net_device *, struct iw_request_info *, + union iwreq_data *, char *extra); -int wvlan_set_station_nickname( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); +int wvlan_set_station_nickname(struct net_device *, struct iw_request_info *, + union iwreq_data *, char *extra); -int wvlan_get_station_nickname( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); +int wvlan_get_station_nickname(struct net_device *, struct iw_request_info *, + union iwreq_data *, char *extra); -int wvlan_set_porttype( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); +int wvlan_set_porttype(struct net_device *, struct iw_request_info *, + union iwreq_data *, char *extra); -int wvlan_get_porttype( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); +int wvlan_get_porttype(struct net_device *, struct iw_request_info *, + union iwreq_data *, char *extra); -#endif // WIRELESS_EXT +#endif /* WIRELESS_EXT */ #ifdef USE_UIL -int wvlan_uil( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil(struct uilreq *urq, struct wl_private *lp); -// int wvlan_uil_connect( struct uilreq *urq, struct wl_private *lp ); -// int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ); -// int wvlan_uil_action( struct uilreq *urq, struct wl_private *lp ); -// int wvlan_uil_block( struct uilreq *urq, struct wl_private *lp ); -// int wvlan_uil_unblock( struct uilreq *urq, struct wl_private *lp ); -// int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ); -// int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ); -// int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ); +/* int wvlan_uil_connect( struct uilreq *urq, struct wl_private *lp ); */ +/* int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ); */ +/* int wvlan_uil_action( struct uilreq *urq, struct wl_private *lp ); */ +/* int wvlan_uil_block( struct uilreq *urq, struct wl_private *lp ); */ +/* int wvlan_uil_unblock( struct uilreq *urq, struct wl_private *lp ); */ +/* int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ); */ +/* int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ); */ +/* int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ); */ -//int cfg_driver_info( struct uilreq *urq, struct wl_private *lp ); -//int cfg_driver_identity( struct uilreq *urq, struct wl_private *lp ); +/* int cfg_driver_info( struct uilreq *urq, struct wl_private *lp ); */ +/* int cfg_driver_identity( struct uilreq *urq, struct wl_private *lp ); */ -#endif // USE_UIL +#endif /* USE_UIL */ #ifdef USE_RTS -int wvlan_rts( struct rtsreq *rrq, __u32 io_base ); -int wvlan_rts_read( __u16 reg, __u16 *val, __u32 io_base ); -int wvlan_rts_write( __u16 reg, __u16 val, __u32 io_base ); -int wvlan_rts_batch_read( struct rtsreq *rrq, __u32 io_base ); -int wvlan_rts_batch_write( struct rtsreq *rrq, __u32 io_base ); +int wvlan_rts(struct rtsreq *rrq, __u32 io_base); +int wvlan_rts_read(__u16 reg, __u16 *val, __u32 io_base); +int wvlan_rts_write(__u16 reg, __u16 val, __u32 io_base); +int wvlan_rts_batch_read(struct rtsreq *rrq, __u32 io_base); +int wvlan_rts_batch_write(struct rtsreq *rrq, __u32 io_base); -#endif // USE_RTS +#endif /* USE_RTS */ -#endif // __WL_PRIV_H__ +#endif /* __WL_PRIV_H__ */ diff --git a/drivers/staging/wlags49_h2/wl_profile.h b/drivers/staging/wlags49_h2/wl_profile.h index f81df51d2216..d615c836f950 100644 --- a/drivers/staging/wlags49_h2/wl_profile.h +++ b/drivers/staging/wlags49_h2/wl_profile.h @@ -73,15 +73,15 @@ /******************************************************************************* * function prototypes ******************************************************************************/ -void parse_config( struct net_device *dev ); +void parse_config(struct net_device *dev); -int readline( int filedesc, char *buffer ); +int readline(int filedesc, char *buffer); -void translate_option( char *buffer, struct wl_private *lp ); +void translate_option(char *buffer, struct wl_private *lp); -int parse_mac_address( char *value, u_char *byte_array ); +int parse_mac_address(char *value, u_char *byte_array); -void ParseConfigLine( char *pszLine, char **ppszLVal, char **ppszRVal ); +void ParseConfigLine(char *pszLine, char **ppszLVal, char **ppszRVal); -#endif // __WL_PROFILE_H__ +#endif /* __WL_PROFILE_H__ */ diff --git a/drivers/staging/wlags49_h2/wl_util.h b/drivers/staging/wlags49_h2/wl_util.h index 946b1b64c46f..57bfd7fac6fa 100644 --- a/drivers/staging/wlags49_h2/wl_util.h +++ b/drivers/staging/wlags49_h2/wl_util.h @@ -65,32 +65,32 @@ /******************************************************************************* * function prototypes ******************************************************************************/ -int dbm( int value ); +int dbm(int value); -int is_valid_key_string( char *s ); +int is_valid_key_string(char *s); -void key_string2key( char *ks, KEY_STRCT *key ); +void key_string2key(char *ks, KEY_STRCT *key); -void wl_hcf_error( struct net_device *dev, int hcfStatus ); +void wl_hcf_error(struct net_device *dev, int hcfStatus); -void wl_endian_translate_event( ltv_t *pLtv ); +void wl_endian_translate_event(ltv_t *pLtv); -int wl_has_wep( IFBP ifbp ); +int wl_has_wep(IFBP ifbp); -hcf_8 wl_parse_ds_ie( PROBE_RESP *probe_rsp ); -hcf_8 * wl_parse_wpa_ie( PROBE_RESP *probe_rsp, hcf_16 *length ); -hcf_8 * wl_print_wpa_ie( hcf_8 *buffer, int length ); +hcf_8 wl_parse_ds_ie(PROBE_RESP *probe_rsp); +hcf_8 *wl_parse_wpa_ie(PROBE_RESP *probe_rsp, hcf_16 *length); +hcf_8 *wl_print_wpa_ie(hcf_8 *buffer, int length); int wl_get_tallies(struct wl_private *, CFG_HERMES_TALLIES_STRCT *); -int wl_is_a_valid_chan( int channel ); -int wl_is_a_valid_freq( long frequency ); -long wl_get_freq_from_chan( int channel ); -int wl_get_chan_from_freq( long frequency ); +int wl_is_a_valid_chan(int channel); +int wl_is_a_valid_freq(long frequency); +long wl_get_freq_from_chan(int channel); +int wl_get_chan_from_freq(long frequency); -void wl_process_link_status( struct wl_private *lp ); -void wl_process_probe_response( struct wl_private *lp ); -void wl_process_updated_record( struct wl_private *lp ); -void wl_process_assoc_status( struct wl_private *lp ); -void wl_process_security_status( struct wl_private *lp ); +void wl_process_link_status(struct wl_private *lp); +void wl_process_probe_response(struct wl_private *lp); +void wl_process_updated_record(struct wl_private *lp); +void wl_process_assoc_status(struct wl_private *lp); +void wl_process_security_status(struct wl_private *lp); -#endif // __WL_UTIL_H__ +#endif /* __WL_UTIL_H__ */ diff --git a/drivers/staging/wlags49_h2/wl_wext.c b/drivers/staging/wlags49_h2/wl_wext.c index f553366cccc5..c731ff2a6aa1 100644 --- a/drivers/staging/wlags49_h2/wl_wext.c +++ b/drivers/staging/wlags49_h2/wl_wext.c @@ -796,8 +796,6 @@ static int wireless_get_bssid(struct net_device *dev, struct iw_request_info *in wl_act_int_off( lp ); - memset( &ap_addr->sa_data, 0, ETH_ALEN ); - ap_addr->sa_family = ARPHRD_ETHER; /* Assume AP mode here, which means the BSSID is our own MAC address. In diff --git a/drivers/staging/zram/Kconfig b/drivers/staging/zram/Kconfig index be5abe8e7943..983314c41349 100644 --- a/drivers/staging/zram/Kconfig +++ b/drivers/staging/zram/Kconfig @@ -14,7 +14,7 @@ config ZRAM disks and maybe many more. See zram.txt for more information. - Project home: http://compcache.googlecode.com/ + Project home: <https://compcache.googlecode.com/> config ZRAM_DEBUG bool "Compressed RAM block device debug support" diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index 0aa5f4c42ae6..ecefb7311dd6 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h @@ -157,4 +157,42 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, */ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, u32 field_index, s32 *value); + +/* hid-sensor-attributes */ + +/* Common hid sensor iio structure */ +struct hid_sensor_common { + struct hid_sensor_hub_device *hsdev; + struct platform_device *pdev; + unsigned usage_id; + bool data_ready; + struct hid_sensor_hub_attribute_info poll; + struct hid_sensor_hub_attribute_info report_state; + struct hid_sensor_hub_attribute_info power_state; + struct hid_sensor_hub_attribute_info sensitivity; +}; + +/*Convert from hid unit expo to regular exponent*/ +static inline int hid_sensor_convert_exponent(int unit_expo) +{ + if (unit_expo < 0x08) + return unit_expo; + else if (unit_expo <= 0x0f) + return -(0x0f-unit_expo+1); + else + return 0; +} + +int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev, + u32 usage_id, + struct hid_sensor_common *st); +int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st, + int val1, int val2); +int hid_sensor_read_raw_hyst_value(struct hid_sensor_common *st, + int *val1, int *val2); +int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st, + int val1, int val2); +int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, + int *val1, int *val2); + #endif diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h index 55f277372fed..6f24446e7669 100644 --- a/include/linux/hid-sensor-ids.h +++ b/include/linux/hid-sensor-ids.h @@ -66,6 +66,15 @@ #define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Y_AXIS 0x200486 #define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Z_AXIS 0x200487 +/* Time (2000a0) */ +#define HID_USAGE_SENSOR_TIME 0x2000a0 +#define HID_USAGE_SENSOR_TIME_YEAR 0x200521 +#define HID_USAGE_SENSOR_TIME_MONTH 0x200522 +#define HID_USAGE_SENSOR_TIME_DAY 0x200523 +#define HID_USAGE_SENSOR_TIME_HOUR 0x200525 +#define HID_USAGE_SENSOR_TIME_MINUTE 0x200526 +#define HID_USAGE_SENSOR_TIME_SECOND 0x200527 + /* Units */ #define HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED 0x00 #define HID_USAGE_SENSOR_UNITS_LUX 0x01 |