From 7663a4aac625268674060d78ee00f97a36a03af7 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 10 Jun 2015 21:51:20 +0200 Subject: [PATCH 001/912] tools:iio: adjust coding style Fix various coding style issues, including: * have spaces around operators * indentation * consolidate parameters in same line * required braces * adjust/drop comments * multiline comment style * delete unnecessary empty lines * add empty lines to visualize logial code blocks * typos Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/generic_buffer.c | 46 ++++++++------ tools/iio/iio_event_monitor.c | 13 ++-- tools/iio/iio_utils.c | 111 ++++++++++++++++++++-------------- tools/iio/iio_utils.h | 15 +++-- tools/iio/lsiio.c | 15 +++-- 5 files changed, 118 insertions(+), 82 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 4eebb6616e5c..fc362d2ff983 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -51,11 +51,13 @@ int size_from_channelarray(struct iio_channel_info *channels, int num_channels) if (bytes % channels[i].bytes == 0) channels[i].location = bytes; else - channels[i].location = bytes - bytes%channels[i].bytes - + channels[i].bytes; + channels[i].location = bytes - bytes % channels[i].bytes + + channels[i].bytes; + bytes = channels[i].location + channels[i].bytes; i++; } + return bytes; } @@ -136,9 +138,9 @@ void print8byte(uint64_t input, struct iio_channel_info *info) /** * process_scan() - print out the values in SI units * @data: pointer to the start of the scan - * @channels: information about the channels. Note - * size_from_channelarray must have been called first to fill the - * location offsets. + * @channels: information about the channels. + * Note: size_from_channelarray must have been called first + * to fill the location offsets. * @num_channels: number of channels **/ void process_scan(char *data, @@ -213,6 +215,7 @@ int main(int argc, char **argv) num_loops = strtoul(optarg, &dummy, 10); if (errno) return -errno; + break; case 'e': noevents = 1; @@ -225,6 +228,7 @@ int main(int argc, char **argv) buf_len = strtoul(optarg, &dummy, 10); if (errno) return -errno; + break; case 'n': device_name = optarg; @@ -257,6 +261,7 @@ int main(int argc, char **argv) printf("Failed to find the %s\n", device_name); return dev_num; } + printf("iio device number being used is %d\n", dev_num); ret = asprintf(&dev_dir_name, "%siio:device%d", iio_dir, dev_num); @@ -285,9 +290,11 @@ int main(int argc, char **argv) ret = trig_num; goto error_free_triggername; } + printf("iio trigger number being used is %d\n", trig_num); - } else + } else { printf("trigger-less mode selected\n"); + } /* * Parse the files in scan_elements to identify what channels are @@ -314,8 +321,10 @@ int main(int argc, char **argv) if (!notrigger) { printf("%s %s\n", dev_dir_name, trigger_name); - /* Set the device trigger to be the data ready trigger found - * above */ + /* + * Set the device trigger to be the data ready trigger found + * above + */ ret = write_sysfs_string_and_verify("trigger/current_trigger", dev_dir_name, trigger_name); @@ -334,8 +343,9 @@ int main(int argc, char **argv) ret = write_sysfs_int("enable", buf_dir_name, 1); if (ret < 0) goto error_free_buf_dir_name; + scan_size = size_from_channelarray(channels, num_channels); - data = malloc(scan_size*buf_len); + data = malloc(scan_size * buf_len); if (!data) { ret = -ENOMEM; goto error_free_buf_dir_name; @@ -349,13 +359,12 @@ int main(int argc, char **argv) /* Attempt to open non blocking the access dev */ fp = open(buffer_access, O_RDONLY | O_NONBLOCK); - if (fp == -1) { /* If it isn't there make the node */ + if (fp == -1) { /* TODO: If it isn't there make the node */ ret = -errno; printf("Failed to open %s\n", buffer_access); goto error_free_buffer_access; } - /* Wait for events 10 times */ for (j = 0; j < num_loops; j++) { if (!noevents) { struct pollfd pfd = { @@ -372,25 +381,22 @@ int main(int argc, char **argv) } toread = buf_len; - } else { usleep(timedelay); toread = 64; } - read_size = read(fp, - data, - toread*scan_size); + read_size = read(fp, data, toread * scan_size); if (read_size < 0) { if (errno == EAGAIN) { printf("nothing available\n"); continue; - } else + } else { break; + } } - for (i = 0; i < read_size/scan_size; i++) - process_scan(data + scan_size*i, - channels, + for (i = 0; i < read_size / scan_size; i++) + process_scan(data + scan_size * i, channels, num_channels); } @@ -409,6 +415,7 @@ int main(int argc, char **argv) error_close_buffer_access: if (close(fp) == -1) perror("Failed to close buffer"); + error_free_buffer_access: free(buffer_access); error_free_data: @@ -424,6 +431,7 @@ error_free_channels: error_free_triggername: if (datardytrigger) free(trigger_name); + error_free_dev_dir_name: free(dev_dir_name); diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 016760e769c0..a4ab6bb8f872 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -13,7 +13,6 @@ * * Usage: * iio_event_monitor - * */ #include @@ -209,7 +208,8 @@ static void print_event(struct iio_event_data *event) if (!event_is_known(event)) { printf("Unknown event: time: %lld, id: %llx\n", - event->timestamp, event->id); + event->timestamp, event->id); + return; } @@ -229,6 +229,7 @@ static void print_event(struct iio_event_data *event) if (dir != IIO_EV_DIR_NONE) printf(", direction: %s", iio_ev_dir_text[dir]); + printf("\n"); } @@ -251,14 +252,16 @@ int main(int argc, char **argv) dev_num = find_type_by_name(device_name, "iio:device"); if (dev_num >= 0) { printf("Found IIO device with name %s with device number %d\n", - device_name, dev_num); + device_name, dev_num); ret = asprintf(&chrdev_name, "/dev/iio:device%d", dev_num); if (ret < 0) { return -ENOMEM; } } else { - /* If we can't find a IIO device by name assume device_name is a - IIO chrdev */ + /* + * If we can't find an IIO device by name assume device_name is + * an IIO chrdev + */ chrdev_name = strdup(device_name); if (!chrdev_name) return -ENOMEM; diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index ec9ab7f9ae4c..4eac11ad38c4 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -32,8 +32,7 @@ static char * const iio_direction[] = { * * Returns 0 on success, or a negative error code if string extraction failed. **/ -int iioutils_break_up_name(const char *full_name, - char **generic_name) +int iioutils_break_up_name(const char *full_name, char **generic_name) { char *current; char *w, *r; @@ -65,6 +64,7 @@ int iioutils_break_up_name(const char *full_name, *w = *r; w++; } + r++; } *w = '\0'; @@ -88,15 +88,10 @@ int iioutils_break_up_name(const char *full_name, * * Returns a value >= 0 on success, otherwise a negative error code. **/ -int iioutils_get_type(unsigned *is_signed, - unsigned *bytes, - unsigned *bits_used, - unsigned *shift, - uint64_t *mask, - unsigned *be, - const char *device_dir, - const char *name, - const char *generic_name) +int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, + unsigned *shift, uint64_t *mask, unsigned *be, + const char *device_dir, const char *name, + const char *generic_name) { FILE *sysfsfp; int ret; @@ -126,6 +121,7 @@ int iioutils_get_type(unsigned *is_signed, ret = -errno; goto error_free_builtname_generic; } + ret = -ENOENT; while (ent = readdir(dp), ent != NULL) /* @@ -140,6 +136,7 @@ int iioutils_get_type(unsigned *is_signed, ret = -ENOMEM; goto error_closedir; } + sysfsfp = fopen(filename, "r"); if (sysfsfp == NULL) { ret = -errno; @@ -162,12 +159,14 @@ int iioutils_get_type(unsigned *is_signed, printf("scan type description didn't match\n"); goto error_close_sysfsfp; } + *be = (endianchar == 'b'); *bytes = padint / 8; if (*bits_used == 64) *mask = ~0; else *mask = (1 << *bits_used) - 1; + *is_signed = (signchar == 's'); if (fclose(sysfsfp)) { ret = -errno; @@ -177,9 +176,9 @@ int iioutils_get_type(unsigned *is_signed, sysfsfp = 0; free(filename); - filename = 0; } + error_close_sysfsfp: if (sysfsfp) if (fclose(sysfsfp)) @@ -188,6 +187,7 @@ error_close_sysfsfp: error_free_filename: if (filename) free(filename); + error_closedir: if (closedir(dp) == -1) perror("iioutils_get_type(): Failed to close directory"); @@ -212,11 +212,9 @@ error_free_scan_el_dir: * * Returns a value >= 0 on success, otherwise a negative error code. **/ -int iioutils_get_param_float(float *output, - const char *param_name, - const char *device_dir, - const char *name, - const char *generic_name) +int iioutils_get_param_float(float *output, const char *param_name, + const char *device_dir, const char *name, + const char *generic_name) { FILE *sysfsfp; int ret; @@ -235,11 +233,13 @@ int iioutils_get_param_float(float *output, ret = -ENOMEM; goto error_free_builtname; } + dp = opendir(device_dir); if (dp == NULL) { ret = -errno; goto error_free_builtname_generic; } + ret = -ENOENT; while (ent = readdir(dp), ent != NULL) if ((strcmp(builtname, ent->d_name) == 0) || @@ -250,11 +250,13 @@ int iioutils_get_param_float(float *output, ret = -ENOMEM; goto error_closedir; } + sysfsfp = fopen(filename, "r"); if (!sysfsfp) { ret = -errno; goto error_free_filename; } + errno = 0; if (fscanf(sysfsfp, "%f", output) != 1) ret = errno ? -errno : -ENODATA; @@ -264,6 +266,7 @@ int iioutils_get_param_float(float *output, error_free_filename: if (filename) free(filename); + error_closedir: if (closedir(dp) == -1) perror("iioutils_get_param_float(): Failed to close directory"); @@ -282,16 +285,14 @@ error_free_builtname: * @cnt: the amount of array elements **/ -void bsort_channel_array_by_index(struct iio_channel_info **ci_array, - int cnt) +void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt) { - struct iio_channel_info temp; int x, y; for (x = 0; x < cnt; x++) for (y = 0; y < (cnt - 1); y++) - if ((*ci_array)[y].index > (*ci_array)[y+1].index) { + if ((*ci_array)[y].index > (*ci_array)[y + 1].index) { temp = (*ci_array)[y + 1]; (*ci_array)[y + 1] = (*ci_array)[y]; (*ci_array)[y] = temp; @@ -307,8 +308,7 @@ void bsort_channel_array_by_index(struct iio_channel_info **ci_array, * Returns 0 on success, otherwise a negative error code. **/ int build_channel_array(const char *device_dir, - struct iio_channel_info **ci_array, - int *counter) + struct iio_channel_info **ci_array, int *counter) { DIR *dp; FILE *sysfsfp; @@ -329,6 +329,7 @@ int build_channel_array(const char *device_dir, ret = -errno; goto error_free_name; } + while (ent = readdir(dp), ent != NULL) if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) { @@ -338,12 +339,14 @@ int build_channel_array(const char *device_dir, ret = -ENOMEM; goto error_close_dir; } + sysfsfp = fopen(filename, "r"); if (sysfsfp == NULL) { ret = -errno; free(filename); goto error_close_dir; } + errno = 0; if (fscanf(sysfsfp, "%i", &ret) != 1) { ret = errno ? -errno : -ENODATA; @@ -353,9 +356,9 @@ int build_channel_array(const char *device_dir, free(filename); goto error_close_dir; } - if (ret == 1) (*counter)++; + if (fclose(sysfsfp)) { ret = -errno; free(filename); @@ -364,11 +367,13 @@ int build_channel_array(const char *device_dir, free(filename); } + *ci_array = malloc(sizeof(**ci_array) * (*counter)); if (*ci_array == NULL) { ret = -ENOMEM; goto error_close_dir; } + seekdir(dp, 0); while (ent = readdir(dp), ent != NULL) { if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), @@ -384,6 +389,7 @@ int build_channel_array(const char *device_dir, count--; goto error_cleanup_array; } + sysfsfp = fopen(filename, "r"); if (sysfsfp == NULL) { ret = -errno; @@ -391,6 +397,7 @@ int build_channel_array(const char *device_dir, count--; goto error_cleanup_array; } + errno = 0; if (fscanf(sysfsfp, "%i", ¤t_enabled) != 1) { ret = errno ? -errno : -ENODATA; @@ -423,6 +430,7 @@ int build_channel_array(const char *device_dir, count--; goto error_cleanup_array; } + /* Get the generic and specific name elements */ ret = iioutils_break_up_name(current->name, ¤t->generic_name); @@ -432,6 +440,7 @@ int build_channel_array(const char *device_dir, count--; goto error_cleanup_array; } + ret = asprintf(&filename, "%s/%s_index", scan_el_dir, @@ -441,6 +450,7 @@ int build_channel_array(const char *device_dir, ret = -ENOMEM; goto error_cleanup_array; } + sysfsfp = fopen(filename, "r"); if (sysfsfp == NULL) { ret = -errno; @@ -474,6 +484,7 @@ int build_channel_array(const char *device_dir, current->generic_name); if (ret < 0) goto error_cleanup_array; + ret = iioutils_get_param_float(¤t->offset, "offset", device_dir, @@ -481,6 +492,7 @@ int build_channel_array(const char *device_dir, current->generic_name); if (ret < 0) goto error_cleanup_array; + ret = iioutils_get_type(¤t->is_signed, ¤t->bytes, ¤t->bits_used, @@ -562,9 +574,9 @@ int find_type_by_name(const char *name, const char *type) while (ent = readdir(dp), ent != NULL) { if (strcmp(ent->d_name, ".") != 0 && - strcmp(ent->d_name, "..") != 0 && - strlen(ent->d_name) > strlen(type) && - strncmp(ent->d_name, type, strlen(type)) == 0) { + strcmp(ent->d_name, "..") != 0 && + strlen(ent->d_name) > strlen(type) && + strncmp(ent->d_name, type, strlen(type)) == 0) { errno = 0; ret = sscanf(ent->d_name + strlen(type), "%d", &number); if (ret < 0) { @@ -580,12 +592,9 @@ int find_type_by_name(const char *name, const char *type) numstrlen = calc_digits(number); /* verify the next character is not a colon */ if (strncmp(ent->d_name + strlen(type) + numstrlen, - ":", - 1) != 0) { - filename = malloc(strlen(iio_dir) - + strlen(type) - + numstrlen - + 6); + ":", 1) != 0) { + filename = malloc(strlen(iio_dir) + strlen(type) + + numstrlen + 6); if (filename == NULL) { ret = -ENOMEM; goto error_close_dir; @@ -603,6 +612,7 @@ int find_type_by_name(const char *name, const char *type) free(filename); continue; } + free(filename); errno = 0; if (fscanf(nameFile, "%s", thisname) != 1) { @@ -618,6 +628,7 @@ int find_type_by_name(const char *name, const char *type) if (strcmp(name, thisname) == 0) { if (closedir(dp) == -1) return -errno; + return number; } } @@ -631,6 +642,7 @@ int find_type_by_name(const char *name, const char *type) error_close_dir: if (closedir(dp) == -1) perror("find_type_by_name(): Failed to close directory"); + return ret; } @@ -644,6 +656,7 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, if (temp == NULL) return -ENOMEM; + ret = sprintf(temp, "%s/%s", basedir, filename); if (ret < 0) goto error_free; @@ -654,6 +667,7 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, printf("failed to open %s\n", temp); goto error_free; } + ret = fprintf(sysfsfp, "%d", val); if (ret < 0) { if (fclose(sysfsfp)) @@ -674,6 +688,7 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, printf("failed to open %s\n", temp); goto error_free; } + if (fscanf(sysfsfp, "%d", &test) != 1) { ret = errno ? -errno : -ENODATA; if (fclose(sysfsfp)) @@ -688,13 +703,12 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, } if (test != val) { - printf("Possible failure in int write %d to %s%s\n", - val, - basedir, - filename); + printf("Possible failure in int write %d to %s/%s\n", + val, basedir, filename); ret = -1; } } + error_free: free(temp); return ret; @@ -739,6 +753,7 @@ static int _write_sysfs_string(const char *filename, const char *basedir, printf("Memory allocation failed\n"); return -ENOMEM; } + ret = sprintf(temp, "%s/%s", basedir, filename); if (ret < 0) goto error_free; @@ -749,6 +764,7 @@ static int _write_sysfs_string(const char *filename, const char *basedir, printf("Could not open %s\n", temp); goto error_free; } + ret = fprintf(sysfsfp, "%s", val); if (ret < 0) { if (fclose(sysfsfp)) @@ -766,9 +782,10 @@ static int _write_sysfs_string(const char *filename, const char *basedir, sysfsfp = fopen(temp, "r"); if (sysfsfp == NULL) { ret = -errno; - printf("could not open file to verify\n"); + printf("Could not open file to verify\n"); goto error_free; } + if (fscanf(sysfsfp, "%s", temp) != 1) { ret = errno ? -errno : -ENODATA; if (fclose(sysfsfp)) @@ -784,15 +801,12 @@ static int _write_sysfs_string(const char *filename, const char *basedir, if (strcmp(temp, val) != 0) { printf("Possible failure in string write of %s " - "Should be %s " - "written to %s\%s\n", - temp, - val, - basedir, - filename); + "Should be %s written to %s/%s\n", temp, val, + basedir, filename); ret = -1; } } + error_free: free(temp); @@ -845,6 +859,7 @@ int read_sysfs_posint(const char *filename, const char *basedir) printf("Memory allocation failed"); return -ENOMEM; } + ret = sprintf(temp, "%s/%s", basedir, filename); if (ret < 0) goto error_free; @@ -854,6 +869,7 @@ int read_sysfs_posint(const char *filename, const char *basedir) ret = -errno; goto error_free; } + errno = 0; if (fscanf(sysfsfp, "%d\n", &ret) != 1) { ret = errno ? -errno : -ENODATA; @@ -868,6 +884,7 @@ int read_sysfs_posint(const char *filename, const char *basedir) error_free: free(temp); + return ret; } @@ -889,6 +906,7 @@ int read_sysfs_float(const char *filename, const char *basedir, float *val) printf("Memory allocation failed"); return -ENOMEM; } + ret = sprintf(temp, "%s/%s", basedir, filename); if (ret < 0) goto error_free; @@ -898,6 +916,7 @@ int read_sysfs_float(const char *filename, const char *basedir, float *val) ret = -errno; goto error_free; } + errno = 0; if (fscanf(sysfsfp, "%f\n", val) != 1) { ret = errno ? -errno : -ENODATA; @@ -912,6 +931,7 @@ int read_sysfs_float(const char *filename, const char *basedir, float *val) error_free: free(temp); + return ret; } @@ -933,6 +953,7 @@ int read_sysfs_string(const char *filename, const char *basedir, char *str) printf("Memory allocation failed"); return -ENOMEM; } + ret = sprintf(temp, "%s/%s", basedir, filename); if (ret < 0) goto error_free; @@ -942,6 +963,7 @@ int read_sysfs_string(const char *filename, const char *basedir, char *str) ret = -errno; goto error_free; } + errno = 0; if (fscanf(sysfsfp, "%s\n", str) != 1) { ret = errno ? -errno : -ENODATA; @@ -956,6 +978,7 @@ int read_sysfs_string(const char *filename, const char *basedir, char *str) error_free: free(temp); + return ret; } diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h index 379eed9deaea..086610139ade 100644 --- a/tools/iio/iio_utils.h +++ b/tools/iio/iio_utils.h @@ -51,17 +51,16 @@ struct iio_channel_info { }; int iioutils_break_up_name(const char *full_name, char **generic_name); -int iioutils_get_type(unsigned *is_signed, unsigned *bytes, - unsigned *bits_used, unsigned *shift, - uint64_t *mask, unsigned *be, - const char *device_dir, const char *name, - const char *generic_name); +int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, + unsigned *shift, uint64_t *mask, unsigned *be, + const char *device_dir, const char *name, + const char *generic_name); int iioutils_get_param_float(float *output, const char *param_name, - const char *device_dir, const char *name, - const char *generic_name); + const char *device_dir, const char *name, + const char *generic_name); void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt); int build_channel_array(const char *device_dir, - struct iio_channel_info **ci_array, int *counter); + struct iio_channel_info **ci_array, int *counter); int find_type_by_name(const char *name, const char *type); int write_sysfs_int(const char *filename, const char *basedir, int val); int write_sysfs_int_and_verify(const char *filename, const char *basedir, diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c index b59ee1733924..f5b3bd0267d5 100644 --- a/tools/iio/lsiio.c +++ b/tools/iio/lsiio.c @@ -20,7 +20,6 @@ #include #include "iio_utils.h" - static enum verbosity { VERBLEVEL_DEFAULT, /* 0 gives lspci behaviour */ VERBLEVEL_SENSORS, /* 1 lists sensors */ @@ -29,17 +28,16 @@ static enum verbosity { const char *type_device = "iio:device"; const char *type_trigger = "trigger"; - static inline int check_prefix(const char *str, const char *prefix) { return strlen(str) > strlen(prefix) && - strncmp(str, prefix, strlen(prefix)) == 0; + strncmp(str, prefix, strlen(prefix)) == 0; } static inline int check_postfix(const char *str, const char *postfix) { return strlen(str) > strlen(postfix) && - strcmp(str + strlen(str) - strlen(postfix), postfix) == 0; + strcmp(str + strlen(str) - strlen(postfix), postfix) == 0; } static int dump_channels(const char *dev_dir_name) @@ -50,11 +48,11 @@ static int dump_channels(const char *dev_dir_name) dp = opendir(dev_dir_name); if (dp == NULL) return -errno; + while (ent = readdir(dp), ent != NULL) if (check_prefix(ent->d_name, "in_") && - check_postfix(ent->d_name, "_raw")) { + check_postfix(ent->d_name, "_raw")) printf(" %-10s\n", ent->d_name); - } return (closedir(dp) == -1) ? -errno : 0; } @@ -69,6 +67,7 @@ static int dump_one_device(const char *dev_dir_name) "%i", &dev_idx); if (retval != 1) return -EINVAL; + retval = read_sysfs_string("name", dev_dir_name, name); if (retval) return retval; @@ -77,6 +76,7 @@ static int dump_one_device(const char *dev_dir_name) if (verblevel >= VERBLEVEL_SENSORS) return dump_channels(dev_dir_name); + return 0; } @@ -90,11 +90,13 @@ static int dump_one_trigger(const char *dev_dir_name) "%i", &dev_idx); if (retval != 1) return -EINVAL; + retval = read_sysfs_string("name", dev_dir_name, name); if (retval) return retval; printf("Trigger %03d: %s\n", dev_idx, name); + return 0; } @@ -151,6 +153,7 @@ static int dump_devices(void) free(dev_dir_name); } } + return (closedir(dp) == -1) ? -errno : 0; error_close_dir: From a9d7acc8b0d52ae2f15f6280f63ac9d1e73cfb78 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 10 Jun 2015 21:51:21 +0200 Subject: [PATCH 002/912] tools:iio: rename variables Use more appropriate/common variable names: * namepf instead of nameFile in iio_utils.c * ret instead of retval in lsiio.c Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 10 +++++----- tools/iio/lsiio.c | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 4eac11ad38c4..8fb3214c70f2 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -561,7 +561,7 @@ int find_type_by_name(const char *name, const char *type) const struct dirent *ent; int number, numstrlen, ret; - FILE *nameFile; + FILE *namefp; DIR *dp; char thisname[IIO_MAX_NAME_LENGTH]; char *filename; @@ -607,20 +607,20 @@ int find_type_by_name(const char *name, const char *type) goto error_close_dir; } - nameFile = fopen(filename, "r"); - if (!nameFile) { + namefp = fopen(filename, "r"); + if (!namefp) { free(filename); continue; } free(filename); errno = 0; - if (fscanf(nameFile, "%s", thisname) != 1) { + if (fscanf(namefp, "%s", thisname) != 1) { ret = errno ? -errno : -ENODATA; goto error_close_dir; } - if (fclose(nameFile)) { + if (fclose(namefp)) { ret = -errno; goto error_close_dir; } diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c index f5b3bd0267d5..7f432a55a6c4 100644 --- a/tools/iio/lsiio.c +++ b/tools/iio/lsiio.c @@ -61,16 +61,16 @@ static int dump_one_device(const char *dev_dir_name) { char name[IIO_MAX_NAME_LENGTH]; int dev_idx; - int retval; + int ret; - retval = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_device), - "%i", &dev_idx); - if (retval != 1) + ret = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_device), "%i", + &dev_idx); + if (ret != 1) return -EINVAL; - retval = read_sysfs_string("name", dev_dir_name, name); - if (retval) - return retval; + ret = read_sysfs_string("name", dev_dir_name, name); + if (ret) + return ret; printf("Device %03d: %s\n", dev_idx, name); @@ -84,16 +84,16 @@ static int dump_one_trigger(const char *dev_dir_name) { char name[IIO_MAX_NAME_LENGTH]; int dev_idx; - int retval; + int ret; - retval = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_trigger), - "%i", &dev_idx); - if (retval != 1) + ret = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_trigger), + "%i", &dev_idx); + if (ret != 1) return -EINVAL; - retval = read_sysfs_string("name", dev_dir_name, name); - if (retval) - return retval; + ret = read_sysfs_string("name", dev_dir_name, name); + if (ret) + return ret; printf("Trigger %03d: %s\n", dev_idx, name); From ad37616e9048123ab664bf2064604888e25c539f Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Fri, 12 Jun 2015 19:01:07 +0300 Subject: [PATCH 003/912] iio: Documentation: Add additional *scale_available attributes Added some more *scale_available attributes to the list that are used in various drivers but were missiong from Documentation. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- Documentation/ABI/testing/sysfs-bus-iio | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index bbed111c31b4..666a341b01b8 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -413,6 +413,11 @@ Description: to compute the calories burnt by the user. What: /sys/bus/iio/devices/iio:deviceX/in_accel_scale_available +What: /sys/.../iio:deviceX/in_anglvel_scale_available +What: /sys/.../iio:deviceX/in_magn_scale_available +What: /sys/.../iio:deviceX/in_illuminance_scale_available +What: /sys/.../iio:deviceX/in_intensity_scale_available +What: /sys/.../iio:deviceX/in_proximity_scale_available What: /sys/.../iio:deviceX/in_voltageX_scale_available What: /sys/.../iio:deviceX/in_voltage-voltage_scale_available What: /sys/.../iio:deviceX/out_voltageX_scale_available From a858c7dab4b9b6a0b5742c39b10408780ca315c8 Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Fri, 12 Jun 2015 18:10:22 +0300 Subject: [PATCH 004/912] iio: inv-mpu: Export scale_available attributes Export the available scales for accel and gyro in order to hint the user-space as to what are the available valid values. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 17d4bb15be4d..096e545538b8 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -673,6 +673,10 @@ static const struct iio_chan_spec inv_mpu_channels[] = { /* constant IIO attribute */ static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("10 20 50 100 200 500"); +static IIO_CONST_ATTR(in_anglvel_scale_available, + "0.000133090 0.000266181 0.000532362 0.001064724"); +static IIO_CONST_ATTR(in_accel_scale_available, + "0.000598 0.001196 0.002392 0.004785"); static IIO_DEV_ATTR_SAMP_FREQ(S_IRUGO | S_IWUSR, inv_fifo_rate_show, inv_mpu6050_fifo_rate_store); static IIO_DEVICE_ATTR(in_gyro_matrix, S_IRUGO, inv_attr_show, NULL, @@ -685,6 +689,8 @@ static struct attribute *inv_attributes[] = { &iio_dev_attr_in_accel_matrix.dev_attr.attr, &iio_dev_attr_sampling_frequency.dev_attr.attr, &iio_const_attr_sampling_frequency_available.dev_attr.attr, + &iio_const_attr_in_accel_scale_available.dev_attr.attr, + &iio_const_attr_in_anglvel_scale_available.dev_attr.attr, NULL, }; From 003f4880bd2eba68c6f9191607ce73787f3402bd Mon Sep 17 00:00:00 2001 From: Tiberiu Breana Date: Wed, 10 Jun 2015 18:07:29 +0300 Subject: [PATCH 005/912] iio: accel: STK8BA50: replace scale table with a struct Replaced the stk8ba50_scale_table with an identically named struct in order to make the code a bit more readable. Signed-off-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8ba50.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c index 30950c6b36de..3302a3d1b4bf 100644 --- a/drivers/iio/accel/stk8ba50.c +++ b/drivers/iio/accel/stk8ba50.c @@ -50,7 +50,10 @@ * * Locally, the range is stored as a table index. */ -static const int stk8ba50_scale_table[][2] = { +static const struct { + u8 reg_val; + u32 scale_val; +} stk8ba50_scale_table[] = { {3, 38400}, {5, 76700}, {8, 153400}, {12, 306900} }; @@ -114,7 +117,7 @@ static int stk8ba50_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: *val = 0; - *val2 = stk8ba50_scale_table[data->range][1]; + *val2 = stk8ba50_scale_table[data->range].scale_val; return IIO_VAL_INT_PLUS_MICRO; } @@ -136,7 +139,7 @@ static int stk8ba50_write_raw(struct iio_dev *indio_dev, return -EINVAL; for (i = 0; i < ARRAY_SIZE(stk8ba50_scale_table); i++) - if (val2 == stk8ba50_scale_table[i][1]) { + if (val2 == stk8ba50_scale_table[i].scale_val) { index = i; break; } @@ -145,7 +148,7 @@ static int stk8ba50_write_raw(struct iio_dev *indio_dev, ret = i2c_smbus_write_byte_data(data->client, STK8BA50_REG_RANGE, - stk8ba50_scale_table[index][0]); + stk8ba50_scale_table[index].reg_val); if (ret < 0) dev_err(&data->client->dev, "failed to set measurement range\n"); From eb2c9ce2cc938d7d39fc06430519bf0fc5004566 Mon Sep 17 00:00:00 2001 From: Tiberiu Breana Date: Wed, 10 Jun 2015 18:07:30 +0300 Subject: [PATCH 006/912] iio: accel: Add sampling rate support for STK8BA50 Added support for setting the STK8BA50 accelerometer's sampling rate. Signed-off-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8ba50.c | 57 +++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c index 3302a3d1b4bf..92229bd8c82d 100644 --- a/drivers/iio/accel/stk8ba50.c +++ b/drivers/iio/accel/stk8ba50.c @@ -21,6 +21,7 @@ #define STK8BA50_REG_YOUT 0x04 #define STK8BA50_REG_ZOUT 0x06 #define STK8BA50_REG_RANGE 0x0F +#define STK8BA50_REG_BWSEL 0x10 #define STK8BA50_REG_POWMODE 0x11 #define STK8BA50_REG_SWRST 0x14 @@ -29,6 +30,7 @@ #define STK8BA50_MODE_POWERBIT BIT(7) #define STK8BA50_DATA_SHIFT 6 #define STK8BA50_RESET_CMD 0xB6 +#define STK8BA50_SR_1792HZ_IDX 7 #define STK8BA50_DRIVER_NAME "stk8ba50" @@ -57,19 +59,30 @@ static const struct { {3, 38400}, {5, 76700}, {8, 153400}, {12, 306900} }; +/* Sample rates are stored as { , } */ +static const struct { + u8 reg_val; + u16 samp_freq; +} stk8ba50_samp_freq_table[] = { + {0x08, 14}, {0x09, 25}, {0x0A, 56}, {0x0B, 112}, + {0x0C, 224}, {0x0D, 448}, {0x0E, 896}, {0x0F, 1792} +}; + struct stk8ba50_data { struct i2c_client *client; struct mutex lock; int range; + u8 sample_rate_idx; }; -#define STK8BA50_ACCEL_CHANNEL(reg, axis) { \ - .type = IIO_ACCEL, \ - .address = reg, \ - .modified = 1, \ - .channel2 = IIO_MOD_##axis, \ - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ +#define STK8BA50_ACCEL_CHANNEL(reg, axis) { \ + .type = IIO_ACCEL, \ + .address = reg, \ + .modified = 1, \ + .channel2 = IIO_MOD_##axis, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ + BIT(IIO_CHAN_INFO_SAMP_FREQ), \ } static const struct iio_chan_spec stk8ba50_channels[] = { @@ -80,8 +93,11 @@ static const struct iio_chan_spec stk8ba50_channels[] = { static IIO_CONST_ATTR(in_accel_scale_available, STK8BA50_SCALE_AVAIL); +static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("14 25 56 112 224 448 896 1792"); + static struct attribute *stk8ba50_attributes[] = { &iio_const_attr_in_accel_scale_available.dev_attr.attr, + &iio_const_attr_sampling_frequency_available.dev_attr.attr, NULL, }; @@ -119,6 +135,11 @@ static int stk8ba50_read_raw(struct iio_dev *indio_dev, *val = 0; *val2 = stk8ba50_scale_table[data->range].scale_val; return IIO_VAL_INT_PLUS_MICRO; + case IIO_CHAN_INFO_SAMP_FREQ: + *val = stk8ba50_samp_freq_table + [data->sample_rate_idx].samp_freq; + *val2 = 0; + return IIO_VAL_INT; } return -EINVAL; @@ -155,6 +176,25 @@ static int stk8ba50_write_raw(struct iio_dev *indio_dev, else data->range = index; + return ret; + case IIO_CHAN_INFO_SAMP_FREQ: + for (i = 0; i < ARRAY_SIZE(stk8ba50_samp_freq_table); i++) + if (val == stk8ba50_samp_freq_table[i].samp_freq) { + index = i; + break; + } + if (index < 0) + return -EINVAL; + + ret = i2c_smbus_write_byte_data(data->client, + STK8BA50_REG_BWSEL, + stk8ba50_samp_freq_table[index].reg_val); + if (ret < 0) + dev_err(&data->client->dev, + "failed to set sampling rate\n"); + else + data->sample_rate_idx = index; + return ret; } @@ -231,6 +271,9 @@ static int stk8ba50_probe(struct i2c_client *client, /* The default range is +/-2g */ data->range = 0; + /* The default sampling rate is 1792 Hz (maximum) */ + data->sample_rate_idx = STK8BA50_SR_1792HZ_IDX; + ret = iio_device_register(indio_dev); if (ret < 0) { dev_err(&client->dev, "device_register failed\n"); From ae35496230bc792fa76505ab7fcee694c7f7d523 Mon Sep 17 00:00:00 2001 From: Naidu Tellapati Date: Thu, 7 May 2015 18:24:02 -0300 Subject: [PATCH 007/912] iio: adc: cc10001: Power-up the ADC at probe time when used remotely The ADC is typically shared with remote CPUs not running Linux. However, there is only one register to power-up/power-down. Remote CPUs aren't able to power-up the ADC, and rely in Linux doing it instead. This commit uses the adc-reserved-channels devicetree property to distinguish shared usage. In this case, the ADC is powered up at probe time. If the ADC is used only by the CPU running Linux, power-up/down at runtime, only when neeeded. Signed-off-by: Naidu Tellapati Signed-off-by: Ezequiel Garcia Signed-off-by: Jonathan Cameron --- drivers/iio/adc/cc10001_adc.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c index 115f6e99a7fa..8254f529b2a9 100644 --- a/drivers/iio/adc/cc10001_adc.c +++ b/drivers/iio/adc/cc10001_adc.c @@ -62,6 +62,7 @@ struct cc10001_adc_device { struct regulator *reg; u16 *buf; + bool shared; struct mutex lock; unsigned int start_delay_ns; unsigned int eoc_delay_ns; @@ -153,7 +154,8 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) mutex_lock(&adc_dev->lock); - cc10001_adc_power_up(adc_dev); + if (!adc_dev->shared) + cc10001_adc_power_up(adc_dev); /* Calculate delay step for eoc and sampled data */ delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; @@ -177,7 +179,8 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) } done: - cc10001_adc_power_down(adc_dev); + if (!adc_dev->shared) + cc10001_adc_power_down(adc_dev); mutex_unlock(&adc_dev->lock); @@ -196,7 +199,8 @@ static u16 cc10001_adc_read_raw_voltage(struct iio_dev *indio_dev, unsigned int delay_ns; u16 val; - cc10001_adc_power_up(adc_dev); + if (!adc_dev->shared) + cc10001_adc_power_up(adc_dev); /* Calculate delay step for eoc and sampled data */ delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; @@ -205,7 +209,8 @@ static u16 cc10001_adc_read_raw_voltage(struct iio_dev *indio_dev, val = cc10001_adc_poll_done(indio_dev, chan->channel, delay_ns); - cc10001_adc_power_down(adc_dev); + if (!adc_dev->shared) + cc10001_adc_power_down(adc_dev); return val; } @@ -322,8 +327,10 @@ static int cc10001_adc_probe(struct platform_device *pdev) adc_dev = iio_priv(indio_dev); channel_map = GENMASK(CC10001_ADC_NUM_CHANNELS - 1, 0); - if (!of_property_read_u32(node, "adc-reserved-channels", &ret)) + if (!of_property_read_u32(node, "adc-reserved-channels", &ret)) { + adc_dev->shared = true; channel_map &= ~ret; + } adc_dev->reg = devm_regulator_get(&pdev->dev, "vref"); if (IS_ERR(adc_dev->reg)) @@ -368,6 +375,14 @@ static int cc10001_adc_probe(struct platform_device *pdev) adc_dev->eoc_delay_ns = NSEC_PER_SEC / adc_clk_rate; adc_dev->start_delay_ns = adc_dev->eoc_delay_ns * CC10001_WAIT_CYCLES; + /* + * There is only one register to power-up/power-down the AUX ADC. + * If the ADC is shared among multiple CPUs, always power it up here. + * If the ADC is used only by the MIPS, power-up/power-down at runtime. + */ + if (adc_dev->shared) + cc10001_adc_power_up(adc_dev); + /* Setup the ADC channels available on the device */ ret = cc10001_adc_channel_init(indio_dev, channel_map); if (ret < 0) @@ -402,6 +417,7 @@ static int cc10001_adc_remove(struct platform_device *pdev) struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); + cc10001_adc_power_down(adc_dev); iio_device_unregister(indio_dev); iio_triggered_buffer_cleanup(indio_dev); clk_disable_unprepare(adc_dev->adc_clk); From 1ca0259b18478b2bab6d5c81ca1de52dd519ae5e Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Fri, 8 May 2015 15:54:00 -0300 Subject: [PATCH 008/912] iio: light: hid-sensor-prox: Fit assignment in one line There is no need to do the assignment to indio_dev->num_channels in two lines code. Put it in one line. Signed-off-by: Fabio Estevam Signed-off-by: Jonathan Cameron --- drivers/iio/light/hid-sensor-prox.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c index 0d248476f4c9..45ca056f019e 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c @@ -284,8 +284,7 @@ static int hid_prox_probe(struct platform_device *pdev) goto error_free_dev_mem; } - indio_dev->num_channels = - ARRAY_SIZE(prox_channels); + indio_dev->num_channels = ARRAY_SIZE(prox_channels); indio_dev->dev.parent = &pdev->dev; indio_dev->info = &prox_info; indio_dev->name = name; From c0d901cce736cb628d2e15f07ae00ea1029f64df Mon Sep 17 00:00:00 2001 From: Irina Tirdea Date: Mon, 13 Apr 2015 18:41:01 +0300 Subject: [PATCH 009/912] iio: accel: mma9551_core: use size in words for word buffers Change the prototype for the mma9551_read/write_*_words functions to receive the length of the buffer in words (instead of bytes) since we are using a word buffer. This will prevent users from sending an odd number of bytes for a word array. Signed-off-by: Irina Tirdea Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma9551_core.c | 27 ++++++++++++--------------- drivers/iio/accel/mma9553.c | 9 ++++++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/iio/accel/mma9551_core.c b/drivers/iio/accel/mma9551_core.c index 2fd2a995686b..583660b74f42 100644 --- a/drivers/iio/accel/mma9551_core.c +++ b/drivers/iio/accel/mma9551_core.c @@ -373,7 +373,7 @@ EXPORT_SYMBOL(mma9551_read_status_word); * @client: I2C client * @app_id: Application ID * @reg: Application register - * @len: Length of array to read in bytes + * @len: Length of array to read (in words) * @buf: Array of words to read * * Read multiple configuration registers (word-sized registers). @@ -388,20 +388,19 @@ int mma9551_read_config_words(struct i2c_client *client, u8 app_id, u16 reg, u8 len, u16 *buf) { int ret, i; - int len_words = len / sizeof(u16); __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS / 2]; - if (len_words > ARRAY_SIZE(be_buf)) { + if (len > ARRAY_SIZE(be_buf)) { dev_err(&client->dev, "Invalid buffer size %d\n", len); return -EINVAL; } ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_CONFIG, - reg, NULL, 0, (u8 *) be_buf, len); + reg, NULL, 0, (u8 *)be_buf, len * sizeof(u16)); if (ret < 0) return ret; - for (i = 0; i < len_words; i++) + for (i = 0; i < len; i++) buf[i] = be16_to_cpu(be_buf[i]); return 0; @@ -413,7 +412,7 @@ EXPORT_SYMBOL(mma9551_read_config_words); * @client: I2C client * @app_id: Application ID * @reg: Application register - * @len: Length of array to read in bytes + * @len: Length of array to read (in words) * @buf: Array of words to read * * Read multiple status registers (word-sized registers). @@ -428,20 +427,19 @@ int mma9551_read_status_words(struct i2c_client *client, u8 app_id, u16 reg, u8 len, u16 *buf) { int ret, i; - int len_words = len / sizeof(u16); __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS / 2]; - if (len_words > ARRAY_SIZE(be_buf)) { + if (len > ARRAY_SIZE(be_buf)) { dev_err(&client->dev, "Invalid buffer size %d\n", len); return -EINVAL; } ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_STATUS, - reg, NULL, 0, (u8 *) be_buf, len); + reg, NULL, 0, (u8 *)be_buf, len * sizeof(u16)); if (ret < 0) return ret; - for (i = 0; i < len_words; i++) + for (i = 0; i < len; i++) buf[i] = be16_to_cpu(be_buf[i]); return 0; @@ -453,7 +451,7 @@ EXPORT_SYMBOL(mma9551_read_status_words); * @client: I2C client * @app_id: Application ID * @reg: Application register - * @len: Length of array to write in bytes + * @len: Length of array to write (in words) * @buf: Array of words to write * * Write multiple configuration registers (word-sized registers). @@ -468,19 +466,18 @@ int mma9551_write_config_words(struct i2c_client *client, u8 app_id, u16 reg, u8 len, u16 *buf) { int i; - int len_words = len / sizeof(u16); __be16 be_buf[(MMA9551_MAX_MAILBOX_DATA_REGS - 1) / 2]; - if (len_words > ARRAY_SIZE(be_buf)) { + if (len > ARRAY_SIZE(be_buf)) { dev_err(&client->dev, "Invalid buffer size %d\n", len); return -EINVAL; } - for (i = 0; i < len_words; i++) + for (i = 0; i < len; i++) be_buf[i] = cpu_to_be16(buf[i]); return mma9551_transfer(client, app_id, MMA9551_CMD_WRITE_CONFIG, - reg, (u8 *) be_buf, len, NULL, 0); + reg, (u8 *)be_buf, len * sizeof(u16), NULL, 0); } EXPORT_SYMBOL(mma9551_write_config_words); diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 8bfc61824fb2..06c870789383 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -322,7 +322,8 @@ static int mma9553_read_activity_stepcnt(struct mma9553_data *data, int ret; ret = mma9551_read_status_words(data->client, MMA9551_APPID_PEDOMETER, - MMA9553_REG_STATUS, sizeof(u32), buf); + MMA9553_REG_STATUS, ARRAY_SIZE(buf), + buf); if (ret < 0) { dev_err(&data->client->dev, "error reading status and stepcnt\n"); @@ -397,7 +398,8 @@ static int mma9553_init(struct mma9553_data *data) ret = mma9551_read_config_words(data->client, MMA9551_APPID_PEDOMETER, MMA9553_REG_CONF_SLEEPMIN, - sizeof(data->conf), (u16 *) &data->conf); + sizeof(data->conf) / sizeof(u16), + (u16 *)&data->conf); if (ret < 0) { dev_err(&data->client->dev, "failed to read configuration registers\n"); @@ -430,7 +432,8 @@ static int mma9553_init(struct mma9553_data *data) ret = mma9551_write_config_words(data->client, MMA9551_APPID_PEDOMETER, MMA9553_REG_CONF_SLEEPMIN, - sizeof(data->conf), (u16 *) &data->conf); + sizeof(data->conf) / sizeof(u16), + (u16 *)&data->conf); if (ret < 0) { dev_err(&data->client->dev, "failed to write configuration registers\n"); From b37c19903a64951f12ae213ce0be7ca3bd26cc12 Mon Sep 17 00:00:00 2001 From: Irina Tirdea Date: Mon, 13 Apr 2015 18:41:02 +0300 Subject: [PATCH 010/912] iio: accel: mma9553: fix alignment issues Fix code alignment and wrap parameters. Fix issues reported by checkpatch.pl --strict. Signed-off-by: Irina Tirdea Suggested-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma9551_core.c | 8 ++-- drivers/iio/accel/mma9551_core.h | 6 +-- drivers/iio/accel/mma9553.c | 76 +++++++++++++++----------------- 3 files changed, 43 insertions(+), 47 deletions(-) diff --git a/drivers/iio/accel/mma9551_core.c b/drivers/iio/accel/mma9551_core.c index 583660b74f42..c34c5ce8123b 100644 --- a/drivers/iio/accel/mma9551_core.c +++ b/drivers/iio/accel/mma9551_core.c @@ -297,7 +297,7 @@ EXPORT_SYMBOL(mma9551_read_status_byte); * Returns: 0 on success, negative value on failure. */ int mma9551_read_config_word(struct i2c_client *client, u8 app_id, - u16 reg, u16 *val) + u16 reg, u16 *val) { int ret; __be16 v; @@ -328,12 +328,12 @@ EXPORT_SYMBOL(mma9551_read_config_word); * Returns: 0 on success, negative value on failure. */ int mma9551_write_config_word(struct i2c_client *client, u8 app_id, - u16 reg, u16 val) + u16 reg, u16 val) { __be16 v = cpu_to_be16(val); return mma9551_transfer(client, app_id, MMA9551_CMD_WRITE_CONFIG, reg, - (u8 *) &v, 2, NULL, 0); + (u8 *)&v, 2, NULL, 0); } EXPORT_SYMBOL(mma9551_write_config_word); @@ -385,7 +385,7 @@ EXPORT_SYMBOL(mma9551_read_status_word); * Returns: 0 on success, negative value on failure. */ int mma9551_read_config_words(struct i2c_client *client, u8 app_id, - u16 reg, u8 len, u16 *buf) + u16 reg, u8 len, u16 *buf) { int ret, i; __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS / 2]; diff --git a/drivers/iio/accel/mma9551_core.h b/drivers/iio/accel/mma9551_core.h index 79939e40805a..5e88e6454dfd 100644 --- a/drivers/iio/accel/mma9551_core.h +++ b/drivers/iio/accel/mma9551_core.h @@ -53,13 +53,13 @@ int mma9551_write_config_byte(struct i2c_client *client, u8 app_id, int mma9551_read_status_byte(struct i2c_client *client, u8 app_id, u16 reg, u8 *val); int mma9551_read_config_word(struct i2c_client *client, u8 app_id, - u16 reg, u16 *val); + u16 reg, u16 *val); int mma9551_write_config_word(struct i2c_client *client, u8 app_id, - u16 reg, u16 val); + u16 reg, u16 val); int mma9551_read_status_word(struct i2c_client *client, u8 app_id, u16 reg, u16 *val); int mma9551_read_config_words(struct i2c_client *client, u8 app_id, - u16 reg, u8 len, u16 *buf); + u16 reg, u8 len, u16 *buf); int mma9551_read_status_words(struct i2c_client *client, u8 app_id, u16 reg, u8 len, u16 *buf); int mma9551_write_config_words(struct i2c_client *client, u8 app_id, diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 06c870789383..08f28c3eb6cc 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -343,10 +343,10 @@ static int mma9553_conf_gpio(struct mma9553_data *data) struct mma9553_event *ev_step_detect; bool activity_enabled; - activity_enabled = - mma9553_is_any_event_enabled(data, true, IIO_ACTIVITY); - ev_step_detect = - mma9553_get_event(data, IIO_STEPS, IIO_NO_MOD, IIO_EV_DIR_NONE); + activity_enabled = mma9553_is_any_event_enabled(data, true, + IIO_ACTIVITY); + ev_step_detect = mma9553_get_event(data, IIO_STEPS, IIO_NO_MOD, + IIO_EV_DIR_NONE); /* * If both step detector and activity are enabled, use the MRGFL bit. @@ -372,9 +372,8 @@ static int mma9553_conf_gpio(struct mma9553_data *data) return ret; } - ret = mma9551_gpio_config(data->client, - MMA9553_DEFAULT_GPIO_PIN, - appid, bitnum, MMA9553_DEFAULT_GPIO_POLARITY); + ret = mma9551_gpio_config(data->client, MMA9553_DEFAULT_GPIO_PIN, appid, + bitnum, MMA9553_DEFAULT_GPIO_POLARITY); if (ret < 0) return ret; data->gpio_bitnum = bitnum; @@ -395,18 +394,16 @@ static int mma9553_init(struct mma9553_data *data) * a device identification command to differentiate the MMA9553L * from the MMA9550L. */ - ret = - mma9551_read_config_words(data->client, MMA9551_APPID_PEDOMETER, - MMA9553_REG_CONF_SLEEPMIN, - sizeof(data->conf) / sizeof(u16), - (u16 *)&data->conf); + ret = mma9551_read_config_words(data->client, MMA9551_APPID_PEDOMETER, + MMA9553_REG_CONF_SLEEPMIN, + sizeof(data->conf) / sizeof(u16), + (u16 *)&data->conf); if (ret < 0) { dev_err(&data->client->dev, "failed to read configuration registers\n"); return ret; } - /* Reset GPIO */ data->gpio_bitnum = MMA9553_MAX_BITNUM; ret = mma9553_conf_gpio(data); @@ -421,19 +418,18 @@ static int mma9553_init(struct mma9553_data *data) data->conf.sleepmin = MMA9553_DEFAULT_SLEEPMIN; data->conf.sleepmax = MMA9553_DEFAULT_SLEEPMAX; data->conf.sleepthd = MMA9553_DEFAULT_SLEEPTHD; - data->conf.config = - mma9553_set_bits(data->conf.config, 1, MMA9553_MASK_CONF_CONFIG); + data->conf.config = mma9553_set_bits(data->conf.config, 1, + MMA9553_MASK_CONF_CONFIG); /* * Clear the activity debounce counter when the activity level changes, * so that the confidence level applies for any activity level. */ data->conf.config = mma9553_set_bits(data->conf.config, 1, MMA9553_MASK_CONF_ACT_DBCNTM); - ret = - mma9551_write_config_words(data->client, MMA9551_APPID_PEDOMETER, - MMA9553_REG_CONF_SLEEPMIN, - sizeof(data->conf) / sizeof(u16), - (u16 *)&data->conf); + ret = mma9551_write_config_words(data->client, MMA9551_APPID_PEDOMETER, + MMA9553_REG_CONF_SLEEPMIN, + sizeof(data->conf) / sizeof(u16), + (u16 *)&data->conf); if (ret < 0) { dev_err(&data->client->dev, "failed to write configuration registers\n"); @@ -570,7 +566,7 @@ static int mma9553_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; case IIO_CHAN_INFO_CALIBHEIGHT: tmp = mma9553_get_bits(data->conf.height_weight, - MMA9553_MASK_CONF_HEIGHT); + MMA9553_MASK_CONF_HEIGHT); *val = tmp / 100; /* cm to m */ *val2 = (tmp % 100) * 10000; return IIO_VAL_INT_PLUS_MICRO; @@ -722,7 +718,6 @@ static int mma9553_read_event_config(struct iio_dev *indio_dev, enum iio_event_type type, enum iio_event_direction dir) { - struct mma9553_data *data = iio_priv(indio_dev); struct mma9553_event *event; @@ -1029,22 +1024,22 @@ static irqreturn_t mma9553_event_handler(int irq, void *private) return IRQ_HANDLED; } - ev_prev_activity = - mma9553_get_event(data, IIO_ACTIVITY, - mma9553_activity_to_mod(data->activity), - IIO_EV_DIR_FALLING); - ev_activity = - mma9553_get_event(data, IIO_ACTIVITY, - mma9553_activity_to_mod(activity), - IIO_EV_DIR_RISING); - ev_step_detect = - mma9553_get_event(data, IIO_STEPS, IIO_NO_MOD, IIO_EV_DIR_NONE); + ev_prev_activity = mma9553_get_event(data, IIO_ACTIVITY, + mma9553_activity_to_mod( + data->activity), + IIO_EV_DIR_FALLING); + ev_activity = mma9553_get_event(data, IIO_ACTIVITY, + mma9553_activity_to_mod(activity), + IIO_EV_DIR_RISING); + ev_step_detect = mma9553_get_event(data, IIO_STEPS, IIO_NO_MOD, + IIO_EV_DIR_NONE); if (ev_step_detect->enabled && (stepcnt != data->stepcnt)) { data->stepcnt = stepcnt; iio_push_event(indio_dev, IIO_EVENT_CODE(IIO_STEPS, 0, IIO_NO_MOD, - IIO_EV_DIR_NONE, IIO_EV_TYPE_CHANGE, 0, 0, 0), + IIO_EV_DIR_NONE, + IIO_EV_TYPE_CHANGE, 0, 0, 0), data->timestamp); } @@ -1054,17 +1049,19 @@ static irqreturn_t mma9553_event_handler(int irq, void *private) if (ev_prev_activity && ev_prev_activity->enabled) iio_push_event(indio_dev, IIO_EVENT_CODE(IIO_ACTIVITY, 0, - ev_prev_activity->info->mod, - IIO_EV_DIR_FALLING, - IIO_EV_TYPE_THRESH, 0, 0, 0), + ev_prev_activity->info->mod, + IIO_EV_DIR_FALLING, + IIO_EV_TYPE_THRESH, 0, 0, + 0), data->timestamp); if (ev_activity && ev_activity->enabled) iio_push_event(indio_dev, IIO_EVENT_CODE(IIO_ACTIVITY, 0, - ev_activity->info->mod, - IIO_EV_DIR_RISING, - IIO_EV_TYPE_THRESH, 0, 0, 0), + ev_activity->info->mod, + IIO_EV_DIR_RISING, + IIO_EV_TYPE_THRESH, 0, 0, + 0), data->timestamp); } mutex_unlock(&data->mutex); @@ -1159,7 +1156,6 @@ static int mma9553_probe(struct i2c_client *client, client->irq); goto out_poweroff; } - } ret = iio_device_register(indio_dev); From 23f93cde93efed59ca82d2687a2fab6a93eaafcc Mon Sep 17 00:00:00 2001 From: Irina Tirdea Date: Mon, 13 Apr 2015 18:41:03 +0300 Subject: [PATCH 011/912] iio: accel: mma9553: document use of mutex Fix checkpatch.pl --strict check: CHECK: struct mutex definition without comment + struct mutex mutex; Signed-off-by: Irina Tirdea Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma9553.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 08f28c3eb6cc..a605280637e9 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -182,6 +182,10 @@ struct mma9553_conf_regs { struct mma9553_data { struct i2c_client *client; + /* + * 1. Serialize access to HW (requested by mma9551_core API). + * 2. Serialize sequences that power on/off the device and access HW. + */ struct mutex mutex; struct mma9553_conf_regs conf; struct mma9553_event events[MMA9553_EVENTS_INFO_SIZE]; From 4b8d80157e5d9074c5eac12aff8dad1742b52f1c Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sat, 20 Jun 2015 23:52:30 +0200 Subject: [PATCH 012/912] iio: Add missing modifier names to core some are documented, others are in iio_event_monitor.c which was recently moved from staging Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 3524b0de8721..d8051cdcbdc2 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -81,6 +81,14 @@ static const char * const iio_modifier_names[] = { [IIO_MOD_X] = "x", [IIO_MOD_Y] = "y", [IIO_MOD_Z] = "z", + [IIO_MOD_X_AND_Y] = "x&y", + [IIO_MOD_X_AND_Z] = "x&z", + [IIO_MOD_Y_AND_Z] = "y&z", + [IIO_MOD_X_AND_Y_AND_Z] = "x&y&z", + [IIO_MOD_X_OR_Y] = "x|y", + [IIO_MOD_X_OR_Z] = "x|z", + [IIO_MOD_Y_OR_Z] = "y|z", + [IIO_MOD_X_OR_Y_OR_Z] = "x|y|z", [IIO_MOD_ROOT_SUM_SQUARED_X_Y] = "sqrt(x^2+y^2)", [IIO_MOD_SUM_SQUARED_X_Y_Z] = "x^2+y^2+z^2", [IIO_MOD_LIGHT_BOTH] = "both", From 30e8326728fff4c66377bd3ba99266cf8489c915 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sat, 20 Jun 2015 23:52:31 +0200 Subject: [PATCH 013/912] tools: iio: Add missing names to iio_event_monitor Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron --- tools/iio/iio_event_monitor.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index a4ab6bb8f872..1dba09062a64 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -50,6 +50,9 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_HUMIDITYRELATIVE] = "humidityrelative", [IIO_ACTIVITY] = "activity", [IIO_STEPS] = "steps", + [IIO_ENERGY] = "energy", + [IIO_DISTANCE] = "distance", + [IIO_VELOCITY] = "velocity", }; static const char * const iio_ev_type_text[] = { @@ -98,6 +101,7 @@ static const char * const iio_modifier_names[] = { [IIO_MOD_JOGGING] = "jogging", [IIO_MOD_WALKING] = "walking", [IIO_MOD_STILL] = "still", + [IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z] = "sqrt(x^2+y^2+z^2)", }; static bool event_is_known(struct iio_event_data *event) @@ -129,6 +133,9 @@ static bool event_is_known(struct iio_event_data *event) case IIO_HUMIDITYRELATIVE: case IIO_ACTIVITY: case IIO_STEPS: + case IIO_ENERGY: + case IIO_DISTANCE: + case IIO_VELOCITY: break; default: return false; @@ -166,6 +173,7 @@ static bool event_is_known(struct iio_event_data *event) case IIO_MOD_JOGGING: case IIO_MOD_WALKING: case IIO_MOD_STILL: + case IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z: break; default: return false; From 208335138001015fd7c5c986b39e05fffad1c528 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sat, 20 Jun 2015 23:51:38 +0200 Subject: [PATCH 014/912] iio: light: isl29125: Add scale_available information Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron --- drivers/iio/light/isl29125.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c index c82f4a6f8464..b3cbbe830141 100644 --- a/drivers/iio/light/isl29125.c +++ b/drivers/iio/light/isl29125.c @@ -197,9 +197,21 @@ done: return IRQ_HANDLED; } +static IIO_CONST_ATTR(scale_available, "0.005722 0.152590"); + +static struct attribute *isl29125_attributes[] = { + &iio_const_attr_scale_available.dev_attr.attr, + NULL +}; + +static const struct attribute_group isl29125_attribute_group = { + .attrs = isl29125_attributes, +}; + static const struct iio_info isl29125_info = { .read_raw = isl29125_read_raw, .write_raw = isl29125_write_raw, + .attrs = &isl29125_attribute_group, .driver_module = THIS_MODULE, }; From db42a9be9f05516255e749a5ee4c1e5d07e0a73b Mon Sep 17 00:00:00 2001 From: Tiberiu Breana Date: Fri, 19 Jun 2015 17:56:37 +0300 Subject: [PATCH 015/912] iio: accel: STK8BA50: suspend sensor on init errors Put chip in 'suspend' mode in case something goes wrong during probe. Signed-off-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8ba50.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c index 92229bd8c82d..9836880cc2d1 100644 --- a/drivers/iio/accel/stk8ba50.c +++ b/drivers/iio/accel/stk8ba50.c @@ -265,7 +265,7 @@ static int stk8ba50_probe(struct i2c_client *client, STK8BA50_REG_SWRST, STK8BA50_RESET_CMD); if (ret < 0) { dev_err(&client->dev, "failed to reset sensor\n"); - return ret; + goto err_power_off; } /* The default range is +/-2g */ @@ -277,10 +277,14 @@ static int stk8ba50_probe(struct i2c_client *client, ret = iio_device_register(indio_dev); if (ret < 0) { dev_err(&client->dev, "device_register failed\n"); - stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); + goto err_power_off; } return ret; + +err_power_off: + stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); + return ret; } static int stk8ba50_remove(struct i2c_client *client) From 39b441bd30a9eff4b3d2cc039027037403ca5242 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Thu, 18 Jun 2015 00:32:00 +0200 Subject: [PATCH 016/912] iio:light:Kconfig: fix typo in description Fix the typo in the module description for the CM3323. Signed-off-by: Hartmut Knaack Reviewed-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/light/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index e6198b7c9cbf..554f8ee6d64a 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig @@ -86,7 +86,7 @@ config CM3323 depends on I2C tristate "Capella CM3323 color light sensor" help - Say Y here if you want to build a driver for Capela CM3323 + Say Y here if you want to build a driver for Capella CM3323 color sensor. To compile this driver as a module, choose M here: the module will From e5c97027449f235415990310e47071ec371fd46c Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Thu, 18 Jun 2015 00:32:01 +0200 Subject: [PATCH 017/912] iio:light:cm3323: pass up error value cm3323_get_it_bits() returns a valid error code, so pass it up in cm3323_read_raw(). Signed-off-by: Hartmut Knaack Reviewed-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/light/cm3323.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c index 869033e48a1f..9c9136309ffe 100644 --- a/drivers/iio/light/cm3323.c +++ b/drivers/iio/light/cm3323.c @@ -175,7 +175,7 @@ static int cm3323_read_raw(struct iio_dev *indio_dev, i = cm3323_get_it_bits(data); if (i < 0) { mutex_unlock(&data->mutex); - return -EINVAL; + return i; } *val = cm3323_int_time[i].val; From 0ff8c78df8d7c32394b887de4d935962a7f373ce Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Thu, 18 Jun 2015 00:32:03 +0200 Subject: [PATCH 018/912] iio:light:cm3323: replace unneeded variable In cm3323_read_raw() i is used as return variable for the integration time index. The also existing return variable ret however is unused in this case, although appropriate. Replace i with ret and drop it. Signed-off-by: Hartmut Knaack Reviewed-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/light/cm3323.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c index 9c9136309ffe..af1b1b025258 100644 --- a/drivers/iio/light/cm3323.c +++ b/drivers/iio/light/cm3323.c @@ -155,7 +155,7 @@ static int cm3323_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) { - int i, ret; + int ret; struct cm3323_data *data = iio_priv(indio_dev); switch (mask) { @@ -172,14 +172,14 @@ static int cm3323_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; case IIO_CHAN_INFO_INT_TIME: mutex_lock(&data->mutex); - i = cm3323_get_it_bits(data); - if (i < 0) { + ret = cm3323_get_it_bits(data); + if (ret < 0) { mutex_unlock(&data->mutex); - return i; + return ret; } - *val = cm3323_int_time[i].val; - *val2 = cm3323_int_time[i].val2; + *val = cm3323_int_time[ret].val; + *val2 = cm3323_int_time[ret].val2; mutex_unlock(&data->mutex); return IIO_VAL_INT_PLUS_MICRO; From 054101c186b9e41d2b57543070c4a520d38402da Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Thu, 18 Jun 2015 00:32:04 +0200 Subject: [PATCH 019/912] iio:light:cm3323: make use of GENMASK Use GENMASK to define the integration time bitmask. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/light/cm3323.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c index af1b1b025258..57ff0a10890e 100644 --- a/drivers/iio/light/cm3323.c +++ b/drivers/iio/light/cm3323.c @@ -29,7 +29,7 @@ #define CM3323_CONF_SD_BIT BIT(0) /* sensor disable */ #define CM3323_CONF_AF_BIT BIT(1) /* auto/manual force mode */ -#define CM3323_CONF_IT_MASK (BIT(4) | BIT(5) | BIT(6)) +#define CM3323_CONF_IT_MASK GENMASK(6, 4) #define CM3323_CONF_IT_SHIFT 4 #define CM3323_INT_TIME_AVAILABLE "0.04 0.08 0.16 0.32 0.64 1.28" From 8bf62ec83c89eda4114aae90c593f49649af76bd Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Thu, 18 Jun 2015 00:32:05 +0200 Subject: [PATCH 020/912] iio:light:cm3323: add empty lines for code structure Add some empty lines to visually separate logical structure blocks, as after if-blocks or before regular returns. Signed-off-by: Hartmut Knaack Reviewed-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/light/cm3323.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c index 57ff0a10890e..54c9e2df43f2 100644 --- a/drivers/iio/light/cm3323.c +++ b/drivers/iio/light/cm3323.c @@ -133,9 +133,11 @@ static int cm3323_set_it_bits(struct cm3323_data *data, int val, int val2) return ret; data->reg_conf = reg_conf; + return 0; } } + return -EINVAL; } @@ -148,6 +150,7 @@ static int cm3323_get_it_bits(struct cm3323_data *data) if (bits >= ARRAY_SIZE(cm3323_int_time)) return -EINVAL; + return bits; } @@ -243,11 +246,13 @@ static int cm3323_probe(struct i2c_client *client, dev_err(&client->dev, "cm3323 chip init failed\n"); return ret; } + ret = iio_device_register(indio_dev); if (ret < 0) { dev_err(&client->dev, "failed to register iio dev\n"); goto err_init; } + return 0; err_init: cm3323_disable(indio_dev); From 825c50dba0139b0322436ddda7d11f043955875e Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Tue, 16 Jun 2015 21:27:03 +0200 Subject: [PATCH 021/912] iio: pressure: Fix Measurement Specialties vendor name Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron --- drivers/iio/pressure/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/pressure/Kconfig b/drivers/iio/pressure/Kconfig index fa6295041947..b13ea6fd939d 100644 --- a/drivers/iio/pressure/Kconfig +++ b/drivers/iio/pressure/Kconfig @@ -53,9 +53,9 @@ config MPL3115 will be called mpl3115. config MS5611 - tristate "Measurement Specialities MS5611 pressure sensor driver" + tristate "Measurement Specialties MS5611 pressure sensor driver" help - Say Y here to build support for the Measurement Specialities + Say Y here to build support for the Measurement Specialties MS5611 pressure and temperature sensor. To compile this driver as a module, choose M here: the module will From fdd15f6594f6bc466a01da28ddd2f11bb0e47a9f Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Mon, 15 Jun 2015 23:48:25 +0200 Subject: [PATCH 022/912] iio:accel:bmc150-accel: make use of mask definition BMC150_ACCEL_SLOPE_THRES_MASK was defined some time ago, but its 'magic' value got used instead in bmc150_accel_write_event(). Make use of it for improved readability. Signed-off-by: Hartmut Knaack Reviewed-by: Octavian Purdila Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bmc150-accel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index 4e70f51c2370..b812728b438e 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c @@ -776,7 +776,7 @@ static int bmc150_accel_write_event(struct iio_dev *indio_dev, switch (info) { case IIO_EV_INFO_VALUE: - data->slope_thres = val & 0xFF; + data->slope_thres = val & BMC150_ACCEL_SLOPE_THRES_MASK; break; case IIO_EV_INFO_PERIOD: data->slope_dur = val & BMC150_ACCEL_SLOPE_DUR_MASK; From e20008ed931b9bdd90d1a3fd8c9ef9307547f4ed Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Mon, 15 Jun 2015 23:48:26 +0200 Subject: [PATCH 023/912] iio:accel:bmc150-accel: code style cleanup Apply the following coding style changes as indicated by checkpatch.pl in strict mode: - Please don't use multiple blank lines - braces {} should be used on all arms of this statement (if/else) - Alignment should match open parenthesis - Please don't use multiple blank lines - Blank lines aren't necessary after an open brace '{' - Missing a blank line after declarations - No space is necessary after a cast Also wrap/consolidate error messages to fit 80 characters per line and rework a comment. Signed-off-by: Hartmut Knaack Reviewed-by: Octavian Purdila Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bmc150-accel.c | 91 +++++++++++++++++--------------- 1 file changed, 49 insertions(+), 42 deletions(-) diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index b812728b438e..47c6013ab376 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c @@ -241,7 +241,6 @@ static const struct { {500000, BMC150_ACCEL_SLEEP_500_MS}, {1000000, BMC150_ACCEL_SLEEP_1_SEC} }; - static int bmc150_accel_set_mode(struct bmc150_accel_data *data, enum bmc150_power_modes mode, int dur_us) @@ -259,8 +258,9 @@ static int bmc150_accel_set_mode(struct bmc150_accel_data *data, dur_val = bmc150_accel_sleep_value_table[i].reg_value; } - } else + } else { dur_val = 0; + } if (dur_val < 0) return -EINVAL; @@ -288,7 +288,7 @@ static int bmc150_accel_set_bw(struct bmc150_accel_data *data, int val, for (i = 0; i < ARRAY_SIZE(bmc150_accel_samp_freq_table); ++i) { if (bmc150_accel_samp_freq_table[i].val == val && - bmc150_accel_samp_freq_table[i].val2 == val2) { + bmc150_accel_samp_freq_table[i].val2 == val2) { ret = i2c_smbus_write_byte_data( data->client, BMC150_ACCEL_REG_PMU_BW, @@ -351,8 +351,7 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data) ret = i2c_smbus_read_byte_data(data->client, BMC150_ACCEL_REG_CHIP_ID); if (ret < 0) { - dev_err(&data->client->dev, - "Error: Reading chip id\n"); + dev_err(&data->client->dev, "Error: Reading chip id\n"); return ret; } @@ -376,8 +375,7 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data) BMC150_ACCEL_REG_PMU_RANGE, BMC150_ACCEL_DEF_RANGE_4G); if (ret < 0) { - dev_err(&data->client->dev, - "Error writing reg_pmu_range\n"); + dev_err(&data->client->dev, "Error writing reg_pmu_range\n"); return ret; } @@ -437,12 +435,13 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on) { int ret; - if (on) + if (on) { ret = pm_runtime_get_sync(&data->client->dev); - else { + } else { pm_runtime_mark_last_busy(&data->client->dev); ret = pm_runtime_put_autosuspend(&data->client->dev); } + if (ret < 0) { dev_err(&data->client->dev, "Failed: bmc150_accel_set_power_state for %d\n", on); @@ -514,13 +513,13 @@ static int bmc150_accel_set_interrupt(struct bmc150_accel_data *data, int i, } /* - * We will expect the enable and disable to do operation in - * in reverse order. This will happen here anyway as our - * resume operation uses sync mode runtime pm calls, the - * suspend operation will be delayed by autosuspend delay - * So the disable operation will still happen in reverse of - * enable operation. When runtime pm is disabled the mode - * is always on so sequence doesn't matter + * We will expect the enable and disable to do operation in reverse + * order. This will happen here anyway, as our resume operation uses + * sync mode runtime pm calls. The suspend operation will be delayed + * by autosuspend delay. + * So the disable operation will still happen in reverse order of + * enable operation. When runtime pm is disabled the mode is always on, + * so sequence doesn't matter. */ ret = bmc150_accel_set_power_state(data, state); if (ret < 0) @@ -574,7 +573,6 @@ out_fix_power_state: return ret; } - static int bmc150_accel_set_scale(struct bmc150_accel_data *data, int val) { int ret, i; @@ -674,8 +672,9 @@ static int bmc150_accel_read_raw(struct iio_dev *indio_dev, if (chan->type == IIO_TEMP) { *val = BMC150_ACCEL_TEMP_CENTER_VAL; return IIO_VAL_INT; - } else + } else { return -EINVAL; + } case IIO_CHAN_INFO_SCALE: *val = 0; switch (chan->type) { @@ -793,7 +792,6 @@ static int bmc150_accel_read_event_config(struct iio_dev *indio_dev, enum iio_event_type type, enum iio_event_direction dir) { - struct bmc150_accel_data *data = iio_priv(indio_dev); return data->ev_enable_state; @@ -827,7 +825,7 @@ static int bmc150_accel_write_event_config(struct iio_dev *indio_dev, } static int bmc150_accel_validate_trigger(struct iio_dev *indio_dev, - struct iio_trigger *trig) + struct iio_trigger *trig) { struct bmc150_accel_data *data = iio_priv(indio_dev); int i; @@ -963,6 +961,7 @@ static int __bmc150_accel_fifo_flush(struct iio_dev *indio_dev, u16 buffer[BMC150_ACCEL_FIFO_LENGTH * 3]; int64_t tstamp; uint64_t sample_period; + ret = i2c_smbus_read_byte_data(data->client, BMC150_ACCEL_REG_FIFO_STATUS); if (ret < 0) { @@ -1255,7 +1254,7 @@ static int bmc150_accel_trig_try_reen(struct iio_trigger *trig) } static int bmc150_accel_trigger_set_state(struct iio_trigger *trig, - bool state) + bool state) { struct bmc150_accel_trigger *t = iio_trigger_get_drvdata(trig); struct bmc150_accel_data *data = t->data; @@ -1314,26 +1313,32 @@ static int bmc150_accel_handle_roc_event(struct iio_dev *indio_dev) dir = IIO_EV_DIR_RISING; if (ret & BMC150_ACCEL_ANY_MOTION_BIT_X) - iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, - 0, - IIO_MOD_X, - IIO_EV_TYPE_ROC, - dir), - data->timestamp); + iio_push_event(indio_dev, + IIO_MOD_EVENT_CODE(IIO_ACCEL, + 0, + IIO_MOD_X, + IIO_EV_TYPE_ROC, + dir), + data->timestamp); + if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Y) - iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, - 0, - IIO_MOD_Y, - IIO_EV_TYPE_ROC, - dir), - data->timestamp); + iio_push_event(indio_dev, + IIO_MOD_EVENT_CODE(IIO_ACCEL, + 0, + IIO_MOD_Y, + IIO_EV_TYPE_ROC, + dir), + data->timestamp); + if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Z) - iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, - 0, - IIO_MOD_Z, - IIO_EV_TYPE_ROC, - dir), - data->timestamp); + iio_push_event(indio_dev, + IIO_MOD_EVENT_CODE(IIO_ACCEL, + 0, + IIO_MOD_Z, + IIO_EV_TYPE_ROC, + dir), + data->timestamp); + return ret; } @@ -1365,7 +1370,9 @@ static irqreturn_t bmc150_accel_irq_thread_handler(int irq, void *private) BMC150_ACCEL_INT_MODE_LATCH_INT | BMC150_ACCEL_INT_MODE_LATCH_RESET); if (ret) - dev_err(&data->client->dev, "Error writing reg_int_rst_latch\n"); + dev_err(&data->client->dev, + "Error writing reg_int_rst_latch\n"); + ret = IRQ_HANDLED; } else { ret = IRQ_NONE; @@ -1412,13 +1419,13 @@ static const char *bmc150_accel_match_acpi_device(struct device *dev, int *data) if (!id) return NULL; - *data = (int) id->driver_data; + *data = (int)id->driver_data; return dev_name(dev); } static int bmc150_accel_gpio_probe(struct i2c_client *client, - struct bmc150_accel_data *data) + struct bmc150_accel_data *data) { struct device *dev; struct gpio_desc *gpio; From c6f67a1f55a7f8a8373068ca07553bd2b2731949 Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Fri, 5 Jun 2015 15:56:47 +0300 Subject: [PATCH 024/912] iio: allow userspace to flush the hwfifo with non-blocking reads This patch changes the semantics of non-blocking reads so that a hardware fifo flush is triggered if the available data in the device buffer is less then the requested size. This allows userspace to accurately generate hardware fifo flushes, by doing a non-blocking read with a size greater then the sum of the device buffer and hardware fifo size. Signed-off-by: Octavian Purdila Reviewed-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-buffer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 6eee1b044c60..f72be48e650c 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -71,8 +71,9 @@ static bool iio_buffer_ready(struct iio_dev *indio_dev, struct iio_buffer *buf, if (avail >= to_wait) { /* force a flush for non-blocking reads */ - if (!to_wait && !avail && to_flush) - iio_buffer_flush_hwfifo(indio_dev, buf, to_flush); + if (!to_wait && avail < to_flush) + iio_buffer_flush_hwfifo(indio_dev, buf, + to_flush - avail); return true; } @@ -100,8 +101,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, struct iio_dev *indio_dev = filp->private_data; struct iio_buffer *rb = indio_dev->buffer; size_t datum_size; - size_t to_wait = 0; - size_t to_read; + size_t to_wait; int ret; if (!indio_dev->info) @@ -119,14 +119,14 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, if (!datum_size) return 0; - to_read = min_t(size_t, n / datum_size, rb->watermark); - - if (!(filp->f_flags & O_NONBLOCK)) - to_wait = to_read; + if (filp->f_flags & O_NONBLOCK) + to_wait = 0; + else + to_wait = min_t(size_t, n / datum_size, rb->watermark); do { ret = wait_event_interruptible(rb->pollq, - iio_buffer_ready(indio_dev, rb, to_wait, to_read)); + iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size)); if (ret) return ret; From 9d174b49ce05b63763e76f9f4373bc1b213ff584 Mon Sep 17 00:00:00 2001 From: Vlad Dogaru Date: Fri, 12 Jun 2015 11:31:38 +0300 Subject: [PATCH 025/912] iio: magn: bmc150: decouple buffer and trigger Signed-off-by: Vlad Dogaru Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/bmc150_magn.c | 69 ++++++++++++++------------ 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index d4c178869991..a0e64f19f4c4 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -588,17 +588,6 @@ static int bmc150_magn_write_raw(struct iio_dev *indio_dev, } } -static int bmc150_magn_validate_trigger(struct iio_dev *indio_dev, - struct iio_trigger *trig) -{ - struct bmc150_magn_data *data = iio_priv(indio_dev); - - if (data->dready_trig != trig) - return -EINVAL; - - return 0; -} - static ssize_t bmc150_magn_show_samp_freq_avail(struct device *dev, struct device_attribute *attr, char *buf) @@ -659,7 +648,6 @@ static const struct iio_info bmc150_magn_info = { .attrs = &bmc150_magn_attrs_group, .read_raw = bmc150_magn_read_raw, .write_raw = bmc150_magn_write_raw, - .validate_trigger = bmc150_magn_validate_trigger, .driver_module = THIS_MODULE, }; @@ -682,7 +670,7 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p) pf->timestamp); err: - iio_trigger_notify_done(data->dready_trig); + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } @@ -827,6 +815,27 @@ static const struct iio_trigger_ops bmc150_magn_trigger_ops = { .owner = THIS_MODULE, }; +static int bmc150_magn_buffer_preenable(struct iio_dev *indio_dev) +{ + struct bmc150_magn_data *data = iio_priv(indio_dev); + + return bmc150_magn_set_power_state(data, true); +} + +static int bmc150_magn_buffer_postdisable(struct iio_dev *indio_dev) +{ + struct bmc150_magn_data *data = iio_priv(indio_dev); + + return bmc150_magn_set_power_state(data, false); +} + +static const struct iio_buffer_setup_ops bmc150_magn_buffer_setup_ops = { + .preenable = bmc150_magn_buffer_preenable, + .postenable = iio_triggered_buffer_postenable, + .predisable = iio_triggered_buffer_predisable, + .postdisable = bmc150_magn_buffer_postdisable, +}; + static int bmc150_magn_gpio_probe(struct i2c_client *client) { struct device *dev; @@ -932,16 +941,6 @@ static int bmc150_magn_probe(struct i2c_client *client, goto err_poweroff; } - ret = iio_triggered_buffer_setup(indio_dev, - &iio_pollfunc_store_time, - bmc150_magn_trigger_handler, - NULL); - if (ret < 0) { - dev_err(&client->dev, - "iio triggered buffer setup failed\n"); - goto err_trigger_unregister; - } - ret = request_threaded_irq(client->irq, iio_trigger_generic_data_rdy_poll, NULL, @@ -951,14 +950,24 @@ static int bmc150_magn_probe(struct i2c_client *client, if (ret < 0) { dev_err(&client->dev, "request irq %d failed\n", client->irq); - goto err_buffer_cleanup; + goto err_trigger_unregister; } } + ret = iio_triggered_buffer_setup(indio_dev, + iio_pollfunc_store_time, + bmc150_magn_trigger_handler, + &bmc150_magn_buffer_setup_ops); + if (ret < 0) { + dev_err(&client->dev, + "iio triggered buffer setup failed\n"); + goto err_free_irq; + } + ret = iio_device_register(indio_dev); if (ret < 0) { dev_err(&client->dev, "unable to register iio device\n"); - goto err_free_irq; + goto err_buffer_cleanup; } ret = pm_runtime_set_active(&client->dev); @@ -976,12 +985,11 @@ static int bmc150_magn_probe(struct i2c_client *client, err_iio_unregister: iio_device_unregister(indio_dev); +err_buffer_cleanup: + iio_triggered_buffer_cleanup(indio_dev); err_free_irq: if (client->irq > 0) free_irq(client->irq, data->dready_trig); -err_buffer_cleanup: - if (data->dready_trig) - iio_triggered_buffer_cleanup(indio_dev); err_trigger_unregister: if (data->dready_trig) iio_trigger_unregister(data->dready_trig); @@ -1000,14 +1008,13 @@ static int bmc150_magn_remove(struct i2c_client *client) pm_runtime_put_noidle(&client->dev); iio_device_unregister(indio_dev); + iio_triggered_buffer_cleanup(indio_dev); if (client->irq > 0) free_irq(data->client->irq, data->dready_trig); - if (data->dready_trig) { - iio_triggered_buffer_cleanup(indio_dev); + if (data->dready_trig) iio_trigger_unregister(data->dready_trig); - } mutex_lock(&data->mutex); bmc150_magn_set_power_mode(data, BMC150_MAGN_POWER_MODE_SUSPEND, true); From da8ef4e77d9dfe91d69033cfa05d9f3036fb8dfd Mon Sep 17 00:00:00 2001 From: Vlad Dogaru Date: Fri, 12 Jun 2015 11:31:39 +0300 Subject: [PATCH 026/912] iio: magn: bmc150: add support for bmc156 The BMC156 is a slightly less capable version of BMC150 which lacks support for magnetometer thresholds. Since this driver does not support those anyway, adding support is trivial. Datasheet is available at https://ae-bst.resource.bosch.com/media/products/dokumente/bmc156_1/BST-BMC156-DS000-01.pdf Signed-off-by: Vlad Dogaru Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/bmc150_magn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index a0e64f19f4c4..cd002710dd02 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -1089,12 +1089,14 @@ static const struct dev_pm_ops bmc150_magn_pm_ops = { static const struct acpi_device_id bmc150_magn_acpi_match[] = { {"BMC150B", 0}, + {"BMC156B", 0}, {}, }; MODULE_DEVICE_TABLE(acpi, bmc150_magn_acpi_match); static const struct i2c_device_id bmc150_magn_id[] = { {"bmc150_magn", 0}, + {"bmc156_magn", 0}, {}, }; MODULE_DEVICE_TABLE(i2c, bmc150_magn_id); From efa86e9fa82eaeee76903f131bc326af48a7cbcf Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Wed, 17 Jun 2015 12:42:51 +0300 Subject: [PATCH 027/912] iio: light: Add support for ROHM RPR0521 sensor This patch adds support for ROHM RPR0521 ambient light and proximity sensor. It offers raw readings for intensity and proximity. Signed-off-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/light/Kconfig | 11 + drivers/iio/light/Makefile | 1 + drivers/iio/light/rpr0521.c | 615 ++++++++++++++++++++++++++++++++++++ 3 files changed, 627 insertions(+) create mode 100644 drivers/iio/light/rpr0521.c diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index 554f8ee6d64a..730fa80c83ea 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig @@ -168,6 +168,17 @@ config JSA1212 To compile this driver as a module, choose M here: the module will be called jsa1212. +config RPR0521 + tristate "ROHM RPR0521 ALS and proximity sensor driver" + depends on I2C + select REGMAP_I2C + help + Say Y here if you want to build support for ROHM's RPR0521 + ambient light and proximity sensor device. + + To compile this driver as a module, choose M here: + the module will be called rpr0521. + config SENSORS_LM3533 tristate "LM3533 ambient light sensor" depends on MFD_LM3533 diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile index e2d50fd59c66..adf97237db72 100644 --- a/drivers/iio/light/Makefile +++ b/drivers/iio/light/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_ISL29125) += isl29125.o obj-$(CONFIG_JSA1212) += jsa1212.o obj-$(CONFIG_SENSORS_LM3533) += lm3533-als.o obj-$(CONFIG_LTR501) += ltr501.o +obj-$(CONFIG_RPR0521) += rpr0521.o obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o obj-$(CONFIG_STK3310) += stk3310.o obj-$(CONFIG_TCS3414) += tcs3414.o diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c new file mode 100644 index 000000000000..4b75bb0998b3 --- /dev/null +++ b/drivers/iio/light/rpr0521.c @@ -0,0 +1,615 @@ +/* + * RPR-0521 ROHM Ambient Light and Proximity Sensor + * + * Copyright (c) 2015, Intel Corporation. + * + * This file is subject to the terms and conditions of version 2 of + * the GNU General Public License. See the file COPYING in the main + * directory of this archive for more details. + * + * IIO driver for RPR-0521RS (7-bit I2C slave address 0x38). + * + * TODO: illuminance channel, PM support, buffer + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define RPR0521_REG_SYSTEM_CTRL 0x40 +#define RPR0521_REG_MODE_CTRL 0x41 +#define RPR0521_REG_ALS_CTRL 0x42 +#define RPR0521_REG_PXS_CTRL 0x43 +#define RPR0521_REG_PXS_DATA 0x44 /* 16-bit, little endian */ +#define RPR0521_REG_ALS_DATA0 0x46 /* 16-bit, little endian */ +#define RPR0521_REG_ALS_DATA1 0x48 /* 16-bit, little endian */ +#define RPR0521_REG_ID 0x92 + +#define RPR0521_MODE_ALS_MASK BIT(7) +#define RPR0521_MODE_PXS_MASK BIT(6) +#define RPR0521_MODE_MEAS_TIME_MASK GENMASK(3, 0) +#define RPR0521_ALS_DATA0_GAIN_MASK GENMASK(5, 4) +#define RPR0521_ALS_DATA0_GAIN_SHIFT 4 +#define RPR0521_ALS_DATA1_GAIN_MASK GENMASK(3, 2) +#define RPR0521_ALS_DATA1_GAIN_SHIFT 2 +#define RPR0521_PXS_GAIN_MASK GENMASK(5, 4) +#define RPR0521_PXS_GAIN_SHIFT 4 + +#define RPR0521_MODE_ALS_ENABLE BIT(7) +#define RPR0521_MODE_ALS_DISABLE 0x00 +#define RPR0521_MODE_PXS_ENABLE BIT(6) +#define RPR0521_MODE_PXS_DISABLE 0x00 + +#define RPR0521_MANUFACT_ID 0xE0 +#define RPR0521_DEFAULT_MEAS_TIME 0x06 /* ALS - 100ms, PXS - 100ms */ + +#define RPR0521_DRV_NAME "RPR0521" +#define RPR0521_REGMAP_NAME "rpr0521_regmap" + +#define RPR0521_SLEEP_DELAY_MS 2000 + +#define RPR0521_ALS_SCALE_AVAIL "0.007812 0.015625 0.5 1" +#define RPR0521_PXS_SCALE_AVAIL "0.125 0.5 1" + +struct rpr0521_gain { + int scale; + int uscale; +}; + +static const struct rpr0521_gain rpr0521_als_gain[4] = { + {1, 0}, /* x1 */ + {0, 500000}, /* x2 */ + {0, 15625}, /* x64 */ + {0, 7812}, /* x128 */ +}; + +static const struct rpr0521_gain rpr0521_pxs_gain[3] = { + {1, 0}, /* x1 */ + {0, 500000}, /* x2 */ + {0, 125000}, /* x4 */ +}; + +enum rpr0521_channel { + RPR0521_CHAN_ALS_DATA0, + RPR0521_CHAN_ALS_DATA1, + RPR0521_CHAN_PXS, +}; + +struct rpr0521_reg_desc { + u8 address; + u8 device_mask; +}; + +static const struct rpr0521_reg_desc rpr0521_data_reg[] = { + [RPR0521_CHAN_ALS_DATA0] = { + .address = RPR0521_REG_ALS_DATA0, + .device_mask = RPR0521_MODE_ALS_MASK, + }, + [RPR0521_CHAN_ALS_DATA1] = { + .address = RPR0521_REG_ALS_DATA1, + .device_mask = RPR0521_MODE_ALS_MASK, + }, + [RPR0521_CHAN_PXS] = { + .address = RPR0521_REG_PXS_DATA, + .device_mask = RPR0521_MODE_PXS_MASK, + }, +}; + +static const struct rpr0521_gain_info { + u8 reg; + u8 mask; + u8 shift; + const struct rpr0521_gain *gain; + int size; +} rpr0521_gain[] = { + [RPR0521_CHAN_ALS_DATA0] = { + .reg = RPR0521_REG_ALS_CTRL, + .mask = RPR0521_ALS_DATA0_GAIN_MASK, + .shift = RPR0521_ALS_DATA0_GAIN_SHIFT, + .gain = rpr0521_als_gain, + .size = ARRAY_SIZE(rpr0521_als_gain), + }, + [RPR0521_CHAN_ALS_DATA1] = { + .reg = RPR0521_REG_ALS_CTRL, + .mask = RPR0521_ALS_DATA1_GAIN_MASK, + .shift = RPR0521_ALS_DATA1_GAIN_SHIFT, + .gain = rpr0521_als_gain, + .size = ARRAY_SIZE(rpr0521_als_gain), + }, + [RPR0521_CHAN_PXS] = { + .reg = RPR0521_REG_PXS_CTRL, + .mask = RPR0521_PXS_GAIN_MASK, + .shift = RPR0521_PXS_GAIN_SHIFT, + .gain = rpr0521_pxs_gain, + .size = ARRAY_SIZE(rpr0521_pxs_gain), + }, +}; + +struct rpr0521_data { + struct i2c_client *client; + + /* protect device params updates (e.g state, gain) */ + struct mutex lock; + + /* device active status */ + bool als_dev_en; + bool pxs_dev_en; + + /* optimize runtime pm ops - enable device only if needed */ + bool als_ps_need_en; + bool pxs_ps_need_en; + + struct regmap *regmap; +}; + +static IIO_CONST_ATTR(in_intensity_scale_available, RPR0521_ALS_SCALE_AVAIL); +static IIO_CONST_ATTR(in_proximity_scale_available, RPR0521_PXS_SCALE_AVAIL); + +static struct attribute *rpr0521_attributes[] = { + &iio_const_attr_in_intensity_scale_available.dev_attr.attr, + &iio_const_attr_in_proximity_scale_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group rpr0521_attribute_group = { + .attrs = rpr0521_attributes, +}; + +static const struct iio_chan_spec rpr0521_channels[] = { + { + .type = IIO_INTENSITY, + .modified = 1, + .address = RPR0521_CHAN_ALS_DATA0, + .channel2 = IIO_MOD_LIGHT_BOTH, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE), + }, + { + .type = IIO_INTENSITY, + .modified = 1, + .address = RPR0521_CHAN_ALS_DATA1, + .channel2 = IIO_MOD_LIGHT_IR, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE), + }, + { + .type = IIO_PROXIMITY, + .address = RPR0521_CHAN_PXS, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE), + } +}; + +static int rpr0521_als_enable(struct rpr0521_data *data, u8 status) +{ + int ret; + + ret = regmap_update_bits(data->regmap, RPR0521_REG_MODE_CTRL, + RPR0521_MODE_ALS_MASK, + status); + if (ret < 0) + return ret; + + data->als_dev_en = true; + + return 0; +} + +static int rpr0521_pxs_enable(struct rpr0521_data *data, u8 status) +{ + int ret; + + ret = regmap_update_bits(data->regmap, RPR0521_REG_MODE_CTRL, + RPR0521_MODE_PXS_MASK, + status); + if (ret < 0) + return ret; + + data->pxs_dev_en = true; + + return 0; +} + +/** + * rpr0521_set_power_state - handles runtime PM state and sensors enabled status + * + * @data: rpr0521 device private data + * @on: state to be set for devices in @device_mask + * @device_mask: bitmask specifying for which device we need to update @on state + * + * We rely on rpr0521_runtime_resume to enable our @device_mask devices, but + * if (for example) PXS was enabled (pxs_dev_en = true) by a previous call to + * rpr0521_runtime_resume and we want to enable ALS we MUST set ALS enable + * bit of RPR0521_REG_MODE_CTRL here because rpr0521_runtime_resume will not + * be called twice. + */ +static int rpr0521_set_power_state(struct rpr0521_data *data, bool on, + u8 device_mask) +{ +#ifdef CONFIG_PM + int ret; + u8 update_mask = 0; + + if (device_mask & RPR0521_MODE_ALS_MASK) { + if (on && !data->als_ps_need_en && data->pxs_dev_en) + update_mask |= RPR0521_MODE_ALS_MASK; + else + data->als_ps_need_en = on; + } + + if (device_mask & RPR0521_MODE_PXS_MASK) { + if (on && !data->pxs_ps_need_en && data->als_dev_en) + update_mask |= RPR0521_MODE_PXS_MASK; + else + data->pxs_ps_need_en = on; + } + + if (update_mask) { + ret = regmap_update_bits(data->regmap, RPR0521_REG_MODE_CTRL, + update_mask, update_mask); + if (ret < 0) + return ret; + } + + if (on) { + ret = pm_runtime_get_sync(&data->client->dev); + } else { + pm_runtime_mark_last_busy(&data->client->dev); + ret = pm_runtime_put_autosuspend(&data->client->dev); + } + if (ret < 0) { + dev_err(&data->client->dev, + "Failed: rpr0521_set_power_state for %d, ret %d\n", + on, ret); + if (on) + pm_runtime_put_noidle(&data->client->dev); + + return ret; + } +#endif + return 0; +} + +static int rpr0521_get_gain(struct rpr0521_data *data, int chan, + int *val, int *val2) +{ + int ret, reg, idx; + + ret = regmap_read(data->regmap, rpr0521_gain[chan].reg, ®); + if (ret < 0) + return ret; + + idx = (rpr0521_gain[chan].mask & reg) >> rpr0521_gain[chan].shift; + *val = rpr0521_gain[chan].gain[idx].scale; + *val2 = rpr0521_gain[chan].gain[idx].uscale; + + return 0; +} + +static int rpr0521_set_gain(struct rpr0521_data *data, int chan, + int val, int val2) +{ + int i, idx = -EINVAL; + + /* get gain index */ + for (i = 0; i < rpr0521_gain[chan].size; i++) + if (val == rpr0521_gain[chan].gain[i].scale && + val2 == rpr0521_gain[chan].gain[i].uscale) { + idx = i; + break; + } + + if (idx < 0) + return idx; + + return regmap_update_bits(data->regmap, rpr0521_gain[chan].reg, + rpr0521_gain[chan].mask, + idx << rpr0521_gain[chan].shift); +} + +static int rpr0521_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + struct rpr0521_data *data = iio_priv(indio_dev); + int ret; + u8 device_mask; + __le16 raw_data; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (chan->type != IIO_INTENSITY && chan->type != IIO_PROXIMITY) + return -EINVAL; + + device_mask = rpr0521_data_reg[chan->address].device_mask; + + mutex_lock(&data->lock); + ret = rpr0521_set_power_state(data, true, device_mask); + if (ret < 0) { + mutex_unlock(&data->lock); + return ret; + } + + ret = regmap_bulk_read(data->regmap, + rpr0521_data_reg[chan->address].address, + &raw_data, 2); + if (ret < 0) { + rpr0521_set_power_state(data, false, device_mask); + mutex_unlock(&data->lock); + return ret; + } + + ret = rpr0521_set_power_state(data, false, device_mask); + mutex_unlock(&data->lock); + if (ret < 0) + return ret; + + *val = le16_to_cpu(raw_data); + + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + mutex_lock(&data->lock); + ret = rpr0521_get_gain(data, chan->address, val, val2); + mutex_unlock(&data->lock); + if (ret < 0) + return ret; + + return IIO_VAL_INT_PLUS_MICRO; + default: + return -EINVAL; + } +} + +static int rpr0521_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, + int val2, long mask) +{ + struct rpr0521_data *data = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_SCALE: + mutex_lock(&data->lock); + ret = rpr0521_set_gain(data, chan->address, val, val2); + mutex_unlock(&data->lock); + + return ret; + default: + return -EINVAL; + } +} + +static const struct iio_info rpr0521_info = { + .driver_module = THIS_MODULE, + .read_raw = rpr0521_read_raw, + .write_raw = rpr0521_write_raw, + .attrs = &rpr0521_attribute_group, +}; + +static int rpr0521_init(struct rpr0521_data *data) +{ + int ret; + int id; + + ret = regmap_read(data->regmap, RPR0521_REG_ID, &id); + if (ret < 0) { + dev_err(&data->client->dev, "Failed to read REG_ID register\n"); + return ret; + } + + if (id != RPR0521_MANUFACT_ID) { + dev_err(&data->client->dev, "Wrong id, got %x, expected %x\n", + id, RPR0521_MANUFACT_ID); + return -ENODEV; + } + + /* set default measurement time - 100 ms for both ALS and PS */ + ret = regmap_update_bits(data->regmap, RPR0521_REG_MODE_CTRL, + RPR0521_MODE_MEAS_TIME_MASK, + RPR0521_DEFAULT_MEAS_TIME); + if (ret) { + pr_err("regmap_update_bits returned %d\n", ret); + return ret; + } + + ret = rpr0521_als_enable(data, RPR0521_MODE_ALS_ENABLE); + if (ret < 0) + return ret; + ret = rpr0521_pxs_enable(data, RPR0521_MODE_PXS_ENABLE); + if (ret < 0) + return ret; + + return 0; +} + +static int rpr0521_poweroff(struct rpr0521_data *data) +{ + int ret; + + ret = regmap_update_bits(data->regmap, RPR0521_REG_MODE_CTRL, + RPR0521_MODE_ALS_MASK | + RPR0521_MODE_PXS_MASK, + RPR0521_MODE_ALS_DISABLE | + RPR0521_MODE_PXS_DISABLE); + if (ret < 0) + return ret; + + data->als_dev_en = false; + data->pxs_dev_en = false; + + return 0; +} + +static bool rpr0521_is_volatile_reg(struct device *dev, unsigned int reg) +{ + switch (reg) { + case RPR0521_REG_MODE_CTRL: + case RPR0521_REG_ALS_CTRL: + case RPR0521_REG_PXS_CTRL: + return false; + default: + return true; + } +} + +static const struct regmap_config rpr0521_regmap_config = { + .name = RPR0521_REGMAP_NAME, + + .reg_bits = 8, + .val_bits = 8, + + .max_register = RPR0521_REG_ID, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = rpr0521_is_volatile_reg, +}; + +static int rpr0521_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct rpr0521_data *data; + struct iio_dev *indio_dev; + struct regmap *regmap; + int ret; + + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); + if (!indio_dev) + return -ENOMEM; + + regmap = devm_regmap_init_i2c(client, &rpr0521_regmap_config); + if (IS_ERR(regmap)) { + dev_err(&client->dev, "regmap_init failed!\n"); + return PTR_ERR(regmap); + } + + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + data->regmap = regmap; + + mutex_init(&data->lock); + + indio_dev->dev.parent = &client->dev; + indio_dev->info = &rpr0521_info; + indio_dev->name = RPR0521_DRV_NAME; + indio_dev->channels = rpr0521_channels; + indio_dev->num_channels = ARRAY_SIZE(rpr0521_channels); + indio_dev->modes = INDIO_DIRECT_MODE; + + ret = rpr0521_init(data); + if (ret < 0) { + dev_err(&client->dev, "rpr0521 chip init failed\n"); + return ret; + } + ret = iio_device_register(indio_dev); + if (ret < 0) + return ret; + + ret = pm_runtime_set_active(&client->dev); + if (ret < 0) + goto err_iio_unregister; + + pm_runtime_enable(&client->dev); + pm_runtime_set_autosuspend_delay(&client->dev, RPR0521_SLEEP_DELAY_MS); + pm_runtime_use_autosuspend(&client->dev); + + return 0; + +err_iio_unregister: + iio_device_unregister(indio_dev); + return ret; +} + +static int rpr0521_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + + pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); + pm_runtime_put_noidle(&client->dev); + + iio_device_unregister(indio_dev); + rpr0521_poweroff(iio_priv(indio_dev)); + + return 0; +} + +#ifdef CONFIG_PM +static int rpr0521_runtime_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + struct rpr0521_data *data = iio_priv(indio_dev); + int ret; + + /* disable channels and sets {als,pxs}_dev_en to false */ + mutex_lock(&data->lock); + ret = rpr0521_poweroff(data); + mutex_unlock(&data->lock); + + return ret; +} + +static int rpr0521_runtime_resume(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + struct rpr0521_data *data = iio_priv(indio_dev); + int ret; + + if (data->als_ps_need_en) { + ret = rpr0521_als_enable(data, RPR0521_MODE_ALS_ENABLE); + if (ret < 0) + return ret; + data->als_ps_need_en = false; + } + + if (data->pxs_ps_need_en) { + ret = rpr0521_pxs_enable(data, RPR0521_MODE_PXS_ENABLE); + if (ret < 0) + return ret; + data->pxs_ps_need_en = false; + } + + return 0; +} +#endif + +static const struct dev_pm_ops rpr0521_pm_ops = { + SET_RUNTIME_PM_OPS(rpr0521_runtime_suspend, + rpr0521_runtime_resume, NULL) +}; + +static const struct acpi_device_id rpr0521_acpi_match[] = { + {"RPR0521", 0}, + { } +}; +MODULE_DEVICE_TABLE(acpi, rpr0521_acpi_match); + +static const struct i2c_device_id rpr0521_id[] = { + {"rpr0521", 0}, + { } +}; + +MODULE_DEVICE_TABLE(i2c, rpr0521_id); + +static struct i2c_driver rpr0521_driver = { + .driver = { + .name = RPR0521_DRV_NAME, + .pm = &rpr0521_pm_ops, + .acpi_match_table = ACPI_PTR(rpr0521_acpi_match), + }, + .probe = rpr0521_probe, + .remove = rpr0521_remove, + .id_table = rpr0521_id, +}; + +module_i2c_driver(rpr0521_driver); + +MODULE_AUTHOR("Daniel Baluta "); +MODULE_DESCRIPTION("RPR0521 ROHM Ambient Light and Proximity Sensor driver"); +MODULE_LICENSE("GPL v2"); From 09a33f052190ef4d997c54e012c9466844bdae0e Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 10 Jun 2015 21:51:19 +0200 Subject: [PATCH 028/912] tools:iio:iio_event_monitor: check if event is fully read Check that the read event is of the expected size. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/iio_event_monitor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 1dba09062a64..703f4cb0e8e9 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -310,6 +310,12 @@ int main(int argc, char **argv) } } + if (ret != sizeof(event)) { + printf("Reading event failed!\n"); + ret = -EIO; + break; + } + print_event(&event); } From 12ebb05246338aa9cdee51da50f57237352b3f64 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sun, 21 Jun 2015 12:18:09 +0200 Subject: [PATCH 029/912] iio:adc:Kconfig: rework help descriptions Rework the help text of several ADCs to make sure that: - the module name is mentioned, if the driver can be built as a module - "If unsure, say N" messages are dropped - right indentation is maintained Signed-off-by: Hartmut Knaack Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/adc/Kconfig | 48 ++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7c5565891cb8..dace593b158b 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -20,6 +20,9 @@ config AD7266 Say yes here to build support for Analog Devices AD7265 and AD7266 ADCs. + To compile this driver as a module, choose M here: the module will be + called ad7266. + config AD7291 tristate "Analog Devices AD7291 ADC driver" depends on I2C @@ -52,8 +55,6 @@ config AD7476 AD7277, AD7278, AD7475, AD7476, AD7477, AD7478, AD7466, AD7467, AD7468, AD7495, AD7910, AD7920, AD7920 SPI analog to digital converters (ADC). - If unsure, say N (but it's safe to say "Y"). - To compile this driver as a module, choose M here: the module will be called ad7476. @@ -63,8 +64,7 @@ config AD7791 select AD_SIGMA_DELTA help Say yes here to build support for Analog Devices AD7787, AD7788, AD7789, - AD7790 and AD7791 SPI analog to digital converters (ADC). If unsure, say - N (but it is safe to say "Y"). + AD7790 and AD7791 SPI analog to digital converters (ADC). To compile this driver as a module, choose M here: the module will be called ad7791. @@ -76,7 +76,6 @@ config AD7793 help Say yes here to build support for Analog Devices AD7785, AD7792, AD7793, AD7794 and AD7795 SPI analog to digital converters (ADC). - If unsure, say N (but it's safe to say "Y"). To compile this driver as a module, choose M here: the module will be called AD7793. @@ -89,7 +88,6 @@ config AD7887 help Say yes here to build support for Analog Devices AD7887 SPI analog to digital converter (ADC). - If unsure, say N (but it's safe to say "Y"). To compile this driver as a module, choose M here: the module will be called ad7887. @@ -117,6 +115,9 @@ config AD799X i2c analog to digital converters (ADC). Provides direct access via sysfs. + To compile this driver as a module, choose M here: the module will be + called ad799x. + config AT91_ADC tristate "Atmel AT91 ADC" depends on ARCH_AT91 @@ -127,6 +128,9 @@ config AT91_ADC help Say yes here to build support for Atmel AT91 ADC. + To compile this driver as a module, choose M here: the module will be + called at91_adc. + config AXP288_ADC tristate "X-Powers AXP288 ADC driver" depends on MFD_AXP20X @@ -135,6 +139,9 @@ config AXP288_ADC device. Depending on platform configuration, this general purpose ADC can be used for sampling sensors such as thermal resistors. + To compile this driver as a module, choose M here: the module will be + called axp288_adc. + config BERLIN2_ADC tristate "Marvell Berlin2 ADC driver" depends on ARCH_BERLIN @@ -151,6 +158,9 @@ config DA9150_GPADC This driver can also be built as a module. If chosen, the module name will be da9150-gpadc. + To compile this driver as a module, choose M here: the module will be + called berlin2-adc. + config CC10001_ADC tristate "Cosmic Circuits 10001 ADC driver" depends on HAVE_CLK || REGULATOR @@ -171,12 +181,18 @@ config EXYNOS_ADC of SoCs for drivers such as the touchscreen and hwmon to use to share this resource. + To compile this driver as a module, choose M here: the module will be + called exynos_adc. + config LP8788_ADC tristate "LP8788 ADC driver" depends on MFD_LP8788 help Say yes here to build support for TI LP8788 ADC. + To compile this driver as a module, choose M here: the module will be + called lp8788_adc. + config MAX1027 tristate "Maxim max1027 ADC driver" depends on SPI @@ -186,6 +202,9 @@ config MAX1027 Say yes here to build support for Maxim SPI ADC models max1027, max1029 and max1031. + To compile this driver as a module, choose M here: the module will be + called max1027. + config MAX1363 tristate "Maxim max1363 ADC driver" depends on I2C @@ -202,6 +221,9 @@ config MAX1363 max11646, max11647) Provides direct access via sysfs and buffered data via the iio dev interface. + To compile this driver as a module, choose M here: the module will be + called max1363. + config MCP320X tristate "Microchip Technology MCP3x01/02/04/08" depends on SPI @@ -310,15 +332,18 @@ config TI_AM335X_ADC Say yes here to build support for Texas Instruments ADC driver which is also a MFD client. + To compile this driver as a module, choose M here: the module will be + called ti_am335x_adc. + config TWL4030_MADC tristate "TWL4030 MADC (Monitoring A/D Converter)" depends on TWL4030_CORE help - This driver provides support for Triton TWL4030-MADC. The - driver supports both RT and SW conversion methods. + This driver provides support for Triton TWL4030-MADC. The + driver supports both RT and SW conversion methods. - This driver can also be built as a module. If so, the module will be - called twl4030-madc. + This driver can also be built as a module. If so, the module will be + called twl4030-madc. config TWL6030_GPADC tristate "TWL6030 GPADC (General Purpose A/D Converter) Support" @@ -351,6 +376,9 @@ config VIPERBOARD_ADC Say yes here to access the ADC part of the Nano River Technologies Viperboard. + To compile this driver as a module, choose M here: the module will be + called viperboard_adc. + config XILINX_XADC tristate "Xilinx XADC driver" depends on ARCH_ZYNQ || MICROBLAZE || COMPILE_TEST From e8d0927a19f11cebc4381f5f0cac8fa37154b08a Mon Sep 17 00:00:00 2001 From: Tiberiu Breana Date: Fri, 3 Jul 2015 12:57:36 +0300 Subject: [PATCH 030/912] tools: iio: Add single-byte case for generic_buffer Some sensors export data in an 8-bit format. Add a single-byte case for the generic_buffer tool so that these sensors' buffer data can be visualized. Signed-off-by: Tiberiu Breana Reviewed-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/generic_buffer.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index fc362d2ff983..0e737238ca74 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -61,6 +61,23 @@ int size_from_channelarray(struct iio_channel_info *channels, int num_channels) return bytes; } +void print1byte(uint8_t input, struct iio_channel_info *info) +{ + /* + * Shift before conversion to avoid sign extension + * of left aligned data + */ + input >>= info->shift; + input &= info->mask; + if (info->is_signed) { + int8_t val = (int8_t)(input << (8 - info->bits_used)) >> + (8 - info->bits_used); + printf("%05f ", ((float)val + info->offset) * info->scale); + } else { + printf("%05f ", ((float)input + info->offset) * info->scale); + } +} + void print2byte(uint16_t input, struct iio_channel_info *info) { /* First swap if incorrect endian */ @@ -152,6 +169,10 @@ void process_scan(char *data, for (k = 0; k < num_channels; k++) switch (channels[k].bytes) { /* only a few cases implemented so far */ + case 1: + print1byte(*(uint8_t *)(data + channels[k].location), + &channels[k]); + break; case 2: print2byte(*(uint16_t *)(data + channels[k].location), &channels[k]); From 4acaf96f747d0cfd6030bde362c1189d248dacff Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Tue, 23 Jun 2015 22:52:28 +0800 Subject: [PATCH 031/912] iio: ssp_sensors: Remove redundant spi driver bus initialization In ancient times it was necessary to manually initialize the bus field of an spi_driver to spi_bus_type. These days this is done in spi_register_driver(), so we can drop the manual assignment. Signed-off-by: Antonio Borneo To: Jonathan Cameron To: Lars-Peter Clausen To: Karol Wrona To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Acked-by: Karol Wrona Signed-off-by: Jonathan Cameron --- drivers/iio/common/ssp_sensors/ssp_dev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c index 9a40097e7cf8..d338bb595db3 100644 --- a/drivers/iio/common/ssp_sensors/ssp_dev.c +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c @@ -700,7 +700,6 @@ static struct spi_driver ssp_driver = { .remove = ssp_remove, .driver = { .pm = &ssp_pm_ops, - .bus = &spi_bus_type, .owner = THIS_MODULE, .of_match_table = of_match_ptr(ssp_of_match), .name = "sensorhub" From 57f7d509c8f60e66d69ac216a03ef39c5ea1ddb8 Mon Sep 17 00:00:00 2001 From: Peter Meerwald Date: Sun, 21 Jun 2015 23:50:22 +0200 Subject: [PATCH 032/912] iio: tmp006: Use GENMASK Signed-off-by: Peter Meerwald Signed-off-by: Jonathan Cameron --- drivers/iio/temperature/tmp006.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c index fcc49f89b946..ecdb6191951e 100644 --- a/drivers/iio/temperature/tmp006.c +++ b/drivers/iio/temperature/tmp006.c @@ -36,9 +36,9 @@ #define TMP006_CONFIG_DRDY_EN BIT(8) #define TMP006_CONFIG_DRDY BIT(7) -#define TMP006_CONFIG_MOD_MASK 0x7000 +#define TMP006_CONFIG_MOD_MASK GENMASK(14, 12) -#define TMP006_CONFIG_CR_MASK 0x0e00 +#define TMP006_CONFIG_CR_MASK GENMASK(11, 9) #define TMP006_CONFIG_CR_SHIFT 9 #define TMP006_MANUFACTURER_MAGIC 0x5449 From 7cb46c2a0666547493132327ccfc0698d90e52f7 Mon Sep 17 00:00:00 2001 From: Tomasz Duszynski Date: Tue, 23 Jun 2015 20:45:47 +0200 Subject: [PATCH 033/912] iio: pressure: ms5611: remove IIO_CHAN_INFO_SCALE from mask IIO_CHAN_INFO_SCALE is useful whenever conversion to standard units is done in userspace. In this case conversion is handled by driver so this bit is unnecessary. Signed-off-by: Tomasz Duszynski Signed-off-by: Jonathan Cameron --- drivers/iio/pressure/ms5611_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c index e42c8531d9b3..1109513cdda9 100644 --- a/drivers/iio/pressure/ms5611_core.c +++ b/drivers/iio/pressure/ms5611_core.c @@ -163,13 +163,11 @@ static int ms5611_read_raw(struct iio_dev *indio_dev, static const struct iio_chan_spec ms5611_channels[] = { { .type = IIO_PRESSURE, - .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) | - BIT(IIO_CHAN_INFO_SCALE) + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), }, { .type = IIO_TEMP, - .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) | - BIT(IIO_CHAN_INFO_SCALE) + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), } }; From 9690d81a02dc4eea78de1686c3bf23a8dd4c0f28 Mon Sep 17 00:00:00 2001 From: Tomasz Duszynski Date: Tue, 23 Jun 2015 20:45:48 +0200 Subject: [PATCH 034/912] iio: pressure: ms5611: add support for MS5607 temperature and pressure sensor MS5607 is temperature and pressure sensor which hardware is similar to MS5611. Both sensors share command protocol and support both I2C and SPI serial protocols. They only differ in compensation algorithms. Signed-off-by: Tomasz Duszynski Signed-off-by: Jonathan Cameron --- drivers/iio/pressure/Kconfig | 2 +- drivers/iio/pressure/ms5611.h | 16 ++++++- drivers/iio/pressure/ms5611_core.c | 76 ++++++++++++++++++++++++++---- drivers/iio/pressure/ms5611_i2c.c | 5 +- drivers/iio/pressure/ms5611_spi.c | 6 ++- 5 files changed, 88 insertions(+), 17 deletions(-) diff --git a/drivers/iio/pressure/Kconfig b/drivers/iio/pressure/Kconfig index b13ea6fd939d..4745179ff64b 100644 --- a/drivers/iio/pressure/Kconfig +++ b/drivers/iio/pressure/Kconfig @@ -56,7 +56,7 @@ config MS5611 tristate "Measurement Specialties MS5611 pressure sensor driver" help Say Y here to build support for the Measurement Specialties - MS5611 pressure and temperature sensor. + MS5611, MS5607 pressure and temperature sensors. To compile this driver as a module, choose M here: the module will be called ms5611_core. diff --git a/drivers/iio/pressure/ms5611.h b/drivers/iio/pressure/ms5611.h index 099c6cdea43f..23b93c797dba 100644 --- a/drivers/iio/pressure/ms5611.h +++ b/drivers/iio/pressure/ms5611.h @@ -27,6 +27,18 @@ #define MS5611_PROM_WORDS_NB 8 +enum { + MS5611, + MS5607, +}; + +struct ms5611_chip_info { + u16 prom[MS5611_PROM_WORDS_NB]; + + int (*temp_and_pressure_compensate)(struct ms5611_chip_info *chip_info, + s32 *temp, s32 *pressure); +}; + struct ms5611_state { void *client; struct mutex lock; @@ -36,9 +48,9 @@ struct ms5611_state { int (*read_adc_temp_and_pressure)(struct device *dev, s32 *temp, s32 *pressure); - u16 prom[MS5611_PROM_WORDS_NB]; + struct ms5611_chip_info *chip_info; }; -int ms5611_probe(struct iio_dev *indio_dev, struct device *dev); +int ms5611_probe(struct iio_dev *indio_dev, struct device *dev, int type); #endif /* _MS5611_H */ diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c index 1109513cdda9..2f3d9b4aca4e 100644 --- a/drivers/iio/pressure/ms5611_core.c +++ b/drivers/iio/pressure/ms5611_core.c @@ -9,6 +9,7 @@ * * Data sheet: * http://www.meas-spec.com/downloads/MS5611-01BA03.pdf + * http://www.meas-spec.com/downloads/MS5607-02BA03.pdf * */ @@ -50,7 +51,8 @@ static int ms5611_read_prom(struct iio_dev *indio_dev) struct ms5611_state *st = iio_priv(indio_dev); for (i = 0; i < MS5611_PROM_WORDS_NB; i++) { - ret = st->read_prom_word(&indio_dev->dev, i, &st->prom[i]); + ret = st->read_prom_word(&indio_dev->dev, + i, &st->chip_info->prom[i]); if (ret < 0) { dev_err(&indio_dev->dev, "failed to read prom at %d\n", i); @@ -58,7 +60,7 @@ static int ms5611_read_prom(struct iio_dev *indio_dev) } } - if (!ms5611_prom_is_valid(st->prom, MS5611_PROM_WORDS_NB)) { + if (!ms5611_prom_is_valid(st->chip_info->prom, MS5611_PROM_WORDS_NB)) { dev_err(&indio_dev->dev, "PROM integrity check failed\n"); return -ENODEV; } @@ -70,22 +72,30 @@ static int ms5611_read_temp_and_pressure(struct iio_dev *indio_dev, s32 *temp, s32 *pressure) { int ret; - s32 t, p; - s64 off, sens, dt; struct ms5611_state *st = iio_priv(indio_dev); - ret = st->read_adc_temp_and_pressure(&indio_dev->dev, &t, &p); + ret = st->read_adc_temp_and_pressure(&indio_dev->dev, temp, pressure); if (ret < 0) { dev_err(&indio_dev->dev, "failed to read temperature and pressure\n"); return ret; } - dt = t - (st->prom[5] << 8); - off = ((s64)st->prom[2] << 16) + ((st->prom[4] * dt) >> 7); - sens = ((s64)st->prom[1] << 15) + ((st->prom[3] * dt) >> 8); + return st->chip_info->temp_and_pressure_compensate(st->chip_info, + temp, pressure); +} - t = 2000 + ((st->prom[6] * dt) >> 23); +static int ms5611_temp_and_pressure_compensate(struct ms5611_chip_info *chip_info, + s32 *temp, s32 *pressure) +{ + s32 t = *temp, p = *pressure; + s64 off, sens, dt; + + dt = t - (chip_info->prom[5] << 8); + off = ((s64)chip_info->prom[2] << 16) + ((chip_info->prom[4] * dt) >> 7); + sens = ((s64)chip_info->prom[1] << 15) + ((chip_info->prom[3] * dt) >> 8); + + t = 2000 + ((chip_info->prom[6] * dt) >> 23); if (t < 2000) { s64 off2, sens2, t2; @@ -111,6 +121,42 @@ static int ms5611_read_temp_and_pressure(struct iio_dev *indio_dev, return 0; } +static int ms5607_temp_and_pressure_compensate(struct ms5611_chip_info *chip_info, + s32 *temp, s32 *pressure) +{ + s32 t = *temp, p = *pressure; + s64 off, sens, dt; + + dt = t - (chip_info->prom[5] << 8); + off = ((s64)chip_info->prom[2] << 17) + ((chip_info->prom[4] * dt) >> 6); + sens = ((s64)chip_info->prom[1] << 16) + ((chip_info->prom[3] * dt) >> 7); + + t = 2000 + ((chip_info->prom[6] * dt) >> 23); + if (t < 2000) { + s64 off2, sens2, t2; + + t2 = (dt * dt) >> 31; + off2 = (61 * (t - 2000) * (t - 2000)) >> 4; + sens2 = off2 << 1; + + if (t < -1500) { + s64 tmp = (t + 1500) * (t + 1500); + + off2 += 15 * tmp; + sens2 += (8 * tmp); + } + + t -= t2; + off -= off2; + sens -= sens2; + } + + *temp = t; + *pressure = (((p * sens) >> 21) - off) >> 15; + + return 0; +} + static int ms5611_reset(struct iio_dev *indio_dev) { int ret; @@ -160,6 +206,15 @@ static int ms5611_read_raw(struct iio_dev *indio_dev, return -EINVAL; } +static struct ms5611_chip_info chip_info_tbl[] = { + [MS5611] = { + .temp_and_pressure_compensate = ms5611_temp_and_pressure_compensate, + }, + [MS5607] = { + .temp_and_pressure_compensate = ms5607_temp_and_pressure_compensate, + } +}; + static const struct iio_chan_spec ms5611_channels[] = { { .type = IIO_PRESSURE, @@ -187,12 +242,13 @@ static int ms5611_init(struct iio_dev *indio_dev) return ms5611_read_prom(indio_dev); } -int ms5611_probe(struct iio_dev *indio_dev, struct device *dev) +int ms5611_probe(struct iio_dev *indio_dev, struct device *dev, int type) { int ret; struct ms5611_state *st = iio_priv(indio_dev); mutex_init(&st->lock); + st->chip_info = &chip_info_tbl[type]; indio_dev->dev.parent = dev; indio_dev->name = dev->driver->name; indio_dev->info = &ms5611_info; diff --git a/drivers/iio/pressure/ms5611_i2c.c b/drivers/iio/pressure/ms5611_i2c.c index 748fd9acaad8..9d504f17669b 100644 --- a/drivers/iio/pressure/ms5611_i2c.c +++ b/drivers/iio/pressure/ms5611_i2c.c @@ -104,11 +104,12 @@ static int ms5611_i2c_probe(struct i2c_client *client, st->read_adc_temp_and_pressure = ms5611_i2c_read_adc_temp_and_pressure; st->client = client; - return ms5611_probe(indio_dev, &client->dev); + return ms5611_probe(indio_dev, &client->dev, id->driver_data); } static const struct i2c_device_id ms5611_id[] = { - { "ms5611", 0 }, + { "ms5611", MS5611 }, + { "ms5607", MS5607 }, { } }; MODULE_DEVICE_TABLE(i2c, ms5611_id); diff --git a/drivers/iio/pressure/ms5611_spi.c b/drivers/iio/pressure/ms5611_spi.c index 976726fd4e6c..08ee6e88c79f 100644 --- a/drivers/iio/pressure/ms5611_spi.c +++ b/drivers/iio/pressure/ms5611_spi.c @@ -103,11 +103,13 @@ static int ms5611_spi_probe(struct spi_device *spi) st->read_adc_temp_and_pressure = ms5611_spi_read_adc_temp_and_pressure; st->client = spi; - return ms5611_probe(indio_dev, &spi->dev); + return ms5611_probe(indio_dev, &spi->dev, + spi_get_device_id(spi)->driver_data); } static const struct spi_device_id ms5611_id[] = { - { "ms5611", 0 }, + { "ms5611", MS5611 }, + { "ms5607", MS5607 }, { } }; MODULE_DEVICE_TABLE(spi, ms5611_id); From db6a19b8251f089afcd40ed116ffdc2326f704a8 Mon Sep 17 00:00:00 2001 From: Tiberiu Breana Date: Wed, 24 Jun 2015 16:54:46 +0300 Subject: [PATCH 035/912] iio: accel: Add trigger support for STK8BA50 Add data-ready interrupts and trigger support for STK8BA50. Additional changes: - read_accel now returns raw acceleration data instead of the sign_extend32 value - read_raw will now enable/disable the sensor with each reading Change-Id: I9c2d7be4256b2dcc5546e4432308ea54f8004333 Signed-off-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8ba50.c | 296 ++++++++++++++++++++++++++++++++--- 1 file changed, 271 insertions(+), 25 deletions(-) diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c index 9836880cc2d1..16cee637109b 100644 --- a/drivers/iio/accel/stk8ba50.c +++ b/drivers/iio/accel/stk8ba50.c @@ -11,11 +11,17 @@ */ #include +#include #include +#include #include #include +#include #include #include +#include +#include +#include #define STK8BA50_REG_XOUT 0x02 #define STK8BA50_REG_YOUT 0x04 @@ -24,6 +30,8 @@ #define STK8BA50_REG_BWSEL 0x10 #define STK8BA50_REG_POWMODE 0x11 #define STK8BA50_REG_SWRST 0x14 +#define STK8BA50_REG_INTEN2 0x17 +#define STK8BA50_REG_INTMAP2 0x1A #define STK8BA50_MODE_NORMAL 0 #define STK8BA50_MODE_SUSPEND 1 @@ -31,8 +39,14 @@ #define STK8BA50_DATA_SHIFT 6 #define STK8BA50_RESET_CMD 0xB6 #define STK8BA50_SR_1792HZ_IDX 7 +#define STK8BA50_DREADY_INT_MASK 0x10 +#define STK8BA50_DREADY_INT_MAP 0x81 +#define STK8BA50_ALL_CHANNEL_MASK 7 +#define STK8BA50_ALL_CHANNEL_SIZE 6 #define STK8BA50_DRIVER_NAME "stk8ba50" +#define STK8BA50_GPIO "stk8ba50_gpio" +#define STK8BA50_IRQ_NAME "stk8ba50_event" #define STK8BA50_SCALE_AVAIL "0.0384 0.0767 0.1534 0.3069" @@ -68,14 +82,29 @@ static const struct { {0x0C, 224}, {0x0D, 448}, {0x0E, 896}, {0x0F, 1792} }; +/* Used to map scan mask bits to their corresponding channel register. */ +static const int stk8ba50_channel_table[] = { + STK8BA50_REG_XOUT, + STK8BA50_REG_YOUT, + STK8BA50_REG_ZOUT +}; + struct stk8ba50_data { struct i2c_client *client; struct mutex lock; int range; u8 sample_rate_idx; + struct iio_trigger *dready_trig; + bool dready_trigger_on; + /* + * 3 x 16-bit channels (10-bit data, 6-bit padding) + + * 1 x 16 padding + + * 4 x 16 64-bit timestamp + */ + s16 buffer[8]; }; -#define STK8BA50_ACCEL_CHANNEL(reg, axis) { \ +#define STK8BA50_ACCEL_CHANNEL(index, reg, axis) { \ .type = IIO_ACCEL, \ .address = reg, \ .modified = 1, \ @@ -83,12 +112,21 @@ struct stk8ba50_data { .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .scan_index = index, \ + .scan_type = { \ + .sign = 's', \ + .realbits = 10, \ + .storagebits = 16, \ + .shift = STK8BA50_DATA_SHIFT, \ + .endianness = IIO_CPU, \ + }, \ } static const struct iio_chan_spec stk8ba50_channels[] = { - STK8BA50_ACCEL_CHANNEL(STK8BA50_REG_XOUT, X), - STK8BA50_ACCEL_CHANNEL(STK8BA50_REG_YOUT, Y), - STK8BA50_ACCEL_CHANNEL(STK8BA50_REG_ZOUT, Z), + STK8BA50_ACCEL_CHANNEL(0, STK8BA50_REG_XOUT, X), + STK8BA50_ACCEL_CHANNEL(1, STK8BA50_REG_YOUT, Y), + STK8BA50_ACCEL_CHANNEL(2, STK8BA50_REG_ZOUT, Z), + IIO_CHAN_SOFT_TIMESTAMP(3), }; static IIO_CONST_ATTR(in_accel_scale_available, STK8BA50_SCALE_AVAIL); @@ -116,7 +154,61 @@ static int stk8ba50_read_accel(struct stk8ba50_data *data, u8 reg) return ret; } - return sign_extend32(ret >> STK8BA50_DATA_SHIFT, 9); + return ret; +} + +static int stk8ba50_data_rdy_trigger_set_state(struct iio_trigger *trig, + bool state) +{ + struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); + struct stk8ba50_data *data = iio_priv(indio_dev); + int ret; + + if (state) + ret = i2c_smbus_write_byte_data(data->client, + STK8BA50_REG_INTEN2, STK8BA50_DREADY_INT_MASK); + else + ret = i2c_smbus_write_byte_data(data->client, + STK8BA50_REG_INTEN2, 0x00); + + if (ret < 0) + dev_err(&data->client->dev, "failed to set trigger state\n"); + else + data->dready_trigger_on = state; + + return ret; +} + +static const struct iio_trigger_ops stk8ba50_trigger_ops = { + .set_trigger_state = stk8ba50_data_rdy_trigger_set_state, + .owner = THIS_MODULE, +}; + +static int stk8ba50_set_power(struct stk8ba50_data *data, bool mode) +{ + int ret; + u8 masked_reg; + struct i2c_client *client = data->client; + + ret = i2c_smbus_read_byte_data(client, STK8BA50_REG_POWMODE); + if (ret < 0) + goto exit_err; + + if (mode) + masked_reg = ret | STK8BA50_MODE_POWERBIT; + else + masked_reg = ret & (~STK8BA50_MODE_POWERBIT); + + ret = i2c_smbus_write_byte_data(client, STK8BA50_REG_POWMODE, + masked_reg); + if (ret < 0) + goto exit_err; + + return ret; + +exit_err: + dev_err(&client->dev, "failed to change sensor mode\n"); + return ret; } static int stk8ba50_read_raw(struct iio_dev *indio_dev, @@ -124,11 +216,26 @@ static int stk8ba50_read_raw(struct iio_dev *indio_dev, int *val, int *val2, long mask) { struct stk8ba50_data *data = iio_priv(indio_dev); + int ret; switch (mask) { case IIO_CHAN_INFO_RAW: + if (iio_buffer_enabled(indio_dev)) + return -EBUSY; mutex_lock(&data->lock); - *val = stk8ba50_read_accel(data, chan->address); + ret = stk8ba50_set_power(data, STK8BA50_MODE_NORMAL); + if (ret < 0) { + mutex_unlock(&data->lock); + return -EINVAL; + } + ret = stk8ba50_read_accel(data, chan->address); + if (ret < 0) { + stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); + mutex_unlock(&data->lock); + return -EINVAL; + } + *val = sign_extend32(ret >> STK8BA50_DATA_SHIFT, 9); + stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); mutex_unlock(&data->lock); return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: @@ -208,30 +315,100 @@ static const struct iio_info stk8ba50_info = { .attrs = &stk8ba50_attribute_group, }; -static int stk8ba50_set_power(struct stk8ba50_data *data, bool mode) +static irqreturn_t stk8ba50_trigger_handler(int irq, void *p) { + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct stk8ba50_data *data = iio_priv(indio_dev); + int bit, ret, i = 0; + + mutex_lock(&data->lock); + /* + * Do a bulk read if all channels are requested, + * from 0x02 (XOUT1) to 0x07 (ZOUT2) + */ + if (*(indio_dev->active_scan_mask) == STK8BA50_ALL_CHANNEL_MASK) { + ret = i2c_smbus_read_i2c_block_data(data->client, + STK8BA50_REG_XOUT, + STK8BA50_ALL_CHANNEL_SIZE, + (u8 *)data->buffer); + if (ret < STK8BA50_ALL_CHANNEL_SIZE) { + dev_err(&data->client->dev, "register read failed\n"); + goto err; + } + } else { + for_each_set_bit(bit, indio_dev->active_scan_mask, + indio_dev->masklength) { + ret = stk8ba50_read_accel(data, + stk8ba50_channel_table[bit]); + if (ret < 0) + goto err; + + data->buffer[i++] = ret; + } + } + iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, + pf->timestamp); +err: + mutex_unlock(&data->lock); + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + +static irqreturn_t stk8ba50_data_rdy_trig_poll(int irq, void *private) +{ + struct iio_dev *indio_dev = private; + struct stk8ba50_data *data = iio_priv(indio_dev); + + if (data->dready_trigger_on) + iio_trigger_poll(data->dready_trig); + + return IRQ_HANDLED; +} + +static int stk8ba50_buffer_preenable(struct iio_dev *indio_dev) +{ + struct stk8ba50_data *data = iio_priv(indio_dev); + + return stk8ba50_set_power(data, STK8BA50_MODE_NORMAL); +} + +static int stk8ba50_buffer_postdisable(struct iio_dev *indio_dev) +{ + struct stk8ba50_data *data = iio_priv(indio_dev); + + return stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); +} + +static const struct iio_buffer_setup_ops stk8ba50_buffer_setup_ops = { + .preenable = stk8ba50_buffer_preenable, + .postenable = iio_triggered_buffer_postenable, + .predisable = iio_triggered_buffer_predisable, + .postdisable = stk8ba50_buffer_postdisable, +}; + +static int stk8ba50_gpio_probe(struct i2c_client *client) +{ + struct device *dev; + struct gpio_desc *gpio; int ret; - u8 masked_reg; - struct i2c_client *client = data->client; - ret = i2c_smbus_read_byte_data(client, STK8BA50_REG_POWMODE); - if (ret < 0) - goto exit_err; + if (!client) + return -EINVAL; - if (mode) - masked_reg = ret | STK8BA50_MODE_POWERBIT; - else - masked_reg = ret & (~STK8BA50_MODE_POWERBIT); + dev = &client->dev; - ret = i2c_smbus_write_byte_data(client, STK8BA50_REG_POWMODE, - masked_reg); - if (ret < 0) - goto exit_err; + /* data ready gpio interrupt pin */ + gpio = devm_gpiod_get_index(dev, STK8BA50_GPIO, 0, GPIOD_IN); + if (IS_ERR(gpio)) { + dev_err(dev, "acpi gpio get index failed\n"); + return PTR_ERR(gpio); + } - return ret; + ret = gpiod_to_irq(gpio); + dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret); -exit_err: - dev_err(&client->dev, "failed to change sensor mode\n"); return ret; } @@ -274,14 +451,78 @@ static int stk8ba50_probe(struct i2c_client *client, /* The default sampling rate is 1792 Hz (maximum) */ data->sample_rate_idx = STK8BA50_SR_1792HZ_IDX; + /* Set up interrupts */ + ret = i2c_smbus_write_byte_data(client, + STK8BA50_REG_INTEN2, STK8BA50_DREADY_INT_MASK); + if (ret < 0) { + dev_err(&client->dev, "failed to set up interrupts\n"); + goto err_power_off; + } + ret = i2c_smbus_write_byte_data(client, + STK8BA50_REG_INTMAP2, STK8BA50_DREADY_INT_MAP); + if (ret < 0) { + dev_err(&client->dev, "failed to set up interrupts\n"); + goto err_power_off; + } + + if (client->irq < 0) + client->irq = stk8ba50_gpio_probe(client); + + if (client->irq >= 0) { + ret = devm_request_threaded_irq(&client->dev, client->irq, + stk8ba50_data_rdy_trig_poll, + NULL, + IRQF_TRIGGER_RISING | + IRQF_ONESHOT, + STK8BA50_IRQ_NAME, + indio_dev); + if (ret < 0) { + dev_err(&client->dev, "request irq %d failed\n", + client->irq); + goto err_power_off; + } + + data->dready_trig = devm_iio_trigger_alloc(&client->dev, + "%s-dev%d", + indio_dev->name, + indio_dev->id); + if (!data->dready_trig) { + ret = -ENOMEM; + goto err_power_off; + } + + data->dready_trig->dev.parent = &client->dev; + data->dready_trig->ops = &stk8ba50_trigger_ops; + iio_trigger_set_drvdata(data->dready_trig, indio_dev); + ret = iio_trigger_register(data->dready_trig); + if (ret) { + dev_err(&client->dev, "iio trigger register failed\n"); + goto err_power_off; + } + } + + ret = iio_triggered_buffer_setup(indio_dev, + iio_pollfunc_store_time, + stk8ba50_trigger_handler, + &stk8ba50_buffer_setup_ops); + if (ret < 0) { + dev_err(&client->dev, "iio triggered buffer setup failed\n"); + goto err_trigger_unregister; + } + ret = iio_device_register(indio_dev); if (ret < 0) { dev_err(&client->dev, "device_register failed\n"); - goto err_power_off; + goto err_buffer_cleanup; } return ret; +err_buffer_cleanup: + iio_triggered_buffer_cleanup(indio_dev); +err_trigger_unregister: + if (data->dready_trig) + iio_trigger_unregister(data->dready_trig); err_power_off: stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); return ret; @@ -290,10 +531,15 @@ err_power_off: static int stk8ba50_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct stk8ba50_data *data = iio_priv(indio_dev); iio_device_unregister(indio_dev); + iio_triggered_buffer_cleanup(indio_dev); - return stk8ba50_set_power(iio_priv(indio_dev), STK8BA50_MODE_SUSPEND); + if (data->dready_trig) + iio_trigger_unregister(data->dready_trig); + + return stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); } #ifdef CONFIG_PM_SLEEP From 95c12bba51c37359073b34f1a56fe396bd33d3cf Mon Sep 17 00:00:00 2001 From: Tiberiu Breana Date: Wed, 24 Jun 2015 17:01:48 +0300 Subject: [PATCH 036/912] iio: accel: Add buffer mode for Sensortek STK8312 Added triggered buffer mode support for the STK8312 accelerometer. Additional changes: - set_mode now sets operation mode directly, no longer masking the register's previous value - read_accel now returns raw acceleration data instead of the sign_extend32 value - read_raw will now enable/disable the sensor with each reading Signed-off-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 300 +++++++++++++++++++++++++++++++----- 1 file changed, 265 insertions(+), 35 deletions(-) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index d211d9f3975b..be58d66d5d33 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -11,16 +11,23 @@ */ #include +#include #include +#include #include #include #include +#include #include #include +#include +#include +#include #define STK8312_REG_XOUT 0x00 #define STK8312_REG_YOUT 0x01 #define STK8312_REG_ZOUT 0x02 +#define STK8312_REG_INTSU 0x06 #define STK8312_REG_MODE 0x07 #define STK8312_REG_STH 0x13 #define STK8312_REG_RESET 0x20 @@ -29,14 +36,19 @@ #define STK8312_REG_OTPDATA 0x3E #define STK8312_REG_OTPCTRL 0x3F -#define STK8312_MODE_ACTIVE 1 -#define STK8312_MODE_STANDBY 0 -#define STK8312_MODE_MASK 0x01 +#define STK8312_MODE_ACTIVE 0x01 +#define STK8312_MODE_STANDBY 0x00 +#define STK8312_DREADY_BIT 0x10 +#define STK8312_INT_MODE 0xC0 #define STK8312_RNG_MASK 0xC0 #define STK8312_RNG_SHIFT 6 #define STK8312_READ_RETRIES 16 +#define STK8312_ALL_CHANNEL_MASK 7 +#define STK8312_ALL_CHANNEL_SIZE 3 #define STK8312_DRIVER_NAME "stk8312" +#define STK8312_GPIO "stk8312_gpio" +#define STK8312_IRQ_NAME "stk8312_event" /* * The accelerometer has two measurement ranges: @@ -53,19 +65,27 @@ static const int stk8312_scale_table[][2] = { {0, 461600}, {1, 231100} }; -#define STK8312_ACCEL_CHANNEL(reg, axis) { \ +#define STK8312_ACCEL_CHANNEL(index, reg, axis) { \ .type = IIO_ACCEL, \ .address = reg, \ .modified = 1, \ .channel2 = IIO_MOD_##axis, \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ + .scan_index = index, \ + .scan_type = { \ + .sign = 's', \ + .realbits = 8, \ + .storagebits = 8, \ + .endianness = IIO_CPU, \ + }, \ } static const struct iio_chan_spec stk8312_channels[] = { - STK8312_ACCEL_CHANNEL(STK8312_REG_XOUT, X), - STK8312_ACCEL_CHANNEL(STK8312_REG_YOUT, Y), - STK8312_ACCEL_CHANNEL(STK8312_REG_ZOUT, Z), + STK8312_ACCEL_CHANNEL(0, STK8312_REG_XOUT, X), + STK8312_ACCEL_CHANNEL(1, STK8312_REG_YOUT, Y), + STK8312_ACCEL_CHANNEL(2, STK8312_REG_ZOUT, Z), + IIO_CHAN_SOFT_TIMESTAMP(3), }; struct stk8312_data { @@ -73,6 +93,9 @@ struct stk8312_data { struct mutex lock; int range; u8 mode; + struct iio_trigger *dready_trig; + bool dready_trigger_on; + s8 buffer[16]; /* 3x8-bit channels + 5x8 padding + 64-bit timestamp */ }; static IIO_CONST_ATTR(in_accel_scale_available, STK8312_SCALE_AVAIL); @@ -130,31 +153,19 @@ exit_err: static int stk8312_set_mode(struct stk8312_data *data, u8 mode) { int ret; - u8 masked_reg; struct i2c_client *client = data->client; - if (mode > 1) - return -EINVAL; - else if (mode == data->mode) + if (mode == data->mode) return 0; - ret = i2c_smbus_read_byte_data(client, STK8312_REG_MODE); - if (ret < 0) { - dev_err(&client->dev, "failed to change sensor mode\n"); - return ret; - } - masked_reg = ret & (~STK8312_MODE_MASK); - masked_reg |= mode; - - ret = i2c_smbus_write_byte_data(client, - STK8312_REG_MODE, masked_reg); + ret = i2c_smbus_write_byte_data(client, STK8312_REG_MODE, mode); if (ret < 0) { dev_err(&client->dev, "failed to change sensor mode\n"); return ret; } data->mode = mode; - if (mode == STK8312_MODE_ACTIVE) { + if (mode & STK8312_MODE_ACTIVE) { /* Need to run OTP sequence before entering active mode */ usleep_range(1000, 5000); ret = stk8312_otp_init(data); @@ -163,6 +174,52 @@ static int stk8312_set_mode(struct stk8312_data *data, u8 mode) return ret; } +static int stk8312_set_interrupts(struct stk8312_data *data, u8 int_mask) +{ + int ret; + u8 mode; + struct i2c_client *client = data->client; + + mode = data->mode; + /* We need to go in standby mode to modify registers */ + ret = stk8312_set_mode(data, STK8312_MODE_STANDBY); + if (ret < 0) + return ret; + + ret = i2c_smbus_write_byte_data(client, STK8312_REG_INTSU, int_mask); + if (ret < 0) + dev_err(&client->dev, "failed to set interrupts\n"); + + return stk8312_set_mode(data, mode); +} + +static int stk8312_data_rdy_trigger_set_state(struct iio_trigger *trig, + bool state) +{ + struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); + struct stk8312_data *data = iio_priv(indio_dev); + int ret; + + if (state) + ret = stk8312_set_interrupts(data, STK8312_DREADY_BIT); + else + ret = stk8312_set_interrupts(data, 0x00); + + if (ret < 0) { + dev_err(&data->client->dev, "failed to set trigger state\n"); + return ret; + } + + data->dready_trigger_on = state; + + return ret; +} + +static const struct iio_trigger_ops stk8312_trigger_ops = { + .set_trigger_state = stk8312_data_rdy_trigger_set_state, + .owner = THIS_MODULE, +}; + static int stk8312_set_range(struct stk8312_data *data, u8 range) { int ret; @@ -208,12 +265,10 @@ static int stk8312_read_accel(struct stk8312_data *data, u8 address) return -EINVAL; ret = i2c_smbus_read_byte_data(client, address); - if (ret < 0) { + if (ret < 0) dev_err(&client->dev, "register read failed\n"); - return ret; - } - return sign_extend32(ret, 7); + return ret; } static int stk8312_read_raw(struct iio_dev *indio_dev, @@ -221,14 +276,27 @@ static int stk8312_read_raw(struct iio_dev *indio_dev, int *val, int *val2, long mask) { struct stk8312_data *data = iio_priv(indio_dev); - - if (chan->type != IIO_ACCEL) - return -EINVAL; + int ret; switch (mask) { case IIO_CHAN_INFO_RAW: + if (iio_buffer_enabled(indio_dev)) + return -EBUSY; mutex_lock(&data->lock); - *val = stk8312_read_accel(data, chan->address); + ret = stk8312_set_mode(data, data->mode | STK8312_MODE_ACTIVE); + if (ret < 0) { + mutex_unlock(&data->lock); + return -EINVAL; + } + ret = stk8312_read_accel(data, chan->address); + if (ret < 0) { + stk8312_set_mode(data, + data->mode & (~STK8312_MODE_ACTIVE)); + mutex_unlock(&data->lock); + return -EINVAL; + } + *val = sign_extend32(ret, 7); + stk8312_set_mode(data, data->mode & (~STK8312_MODE_ACTIVE)); mutex_unlock(&data->lock); return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: @@ -277,6 +345,109 @@ static const struct iio_info stk8312_info = { .attrs = &stk8312_attribute_group, }; +static irqreturn_t stk8312_trigger_handler(int irq, void *p) +{ + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct stk8312_data *data = iio_priv(indio_dev); + int bit, ret, i = 0; + u8 buffer[STK8312_ALL_CHANNEL_SIZE]; + + mutex_lock(&data->lock); + /* + * Do a bulk read if all channels are requested, + * from 0x00 (XOUT) to 0x02 (ZOUT) + */ + if (*(indio_dev->active_scan_mask) == STK8312_ALL_CHANNEL_MASK) { + ret = i2c_smbus_read_i2c_block_data(data->client, + STK8312_REG_XOUT, + STK8312_ALL_CHANNEL_SIZE, + buffer); + if (ret < STK8312_ALL_CHANNEL_SIZE) { + dev_err(&data->client->dev, "register read failed\n"); + mutex_unlock(&data->lock); + goto err; + } + data->buffer[0] = buffer[0]; + data->buffer[1] = buffer[1]; + data->buffer[2] = buffer[2]; + } else { + for_each_set_bit(bit, indio_dev->active_scan_mask, + indio_dev->masklength) { + ret = stk8312_read_accel(data, bit); + if (ret < 0) { + mutex_unlock(&data->lock); + goto err; + } + data->buffer[i++] = ret; + } + } + mutex_unlock(&data->lock); + + iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, + pf->timestamp); +err: + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + +static irqreturn_t stk8312_data_rdy_trig_poll(int irq, void *private) +{ + struct iio_dev *indio_dev = private; + struct stk8312_data *data = iio_priv(indio_dev); + + if (data->dready_trigger_on) + iio_trigger_poll(data->dready_trig); + + return IRQ_HANDLED; +} + +static int stk8312_buffer_preenable(struct iio_dev *indio_dev) +{ + struct stk8312_data *data = iio_priv(indio_dev); + + return stk8312_set_mode(data, data->mode | STK8312_MODE_ACTIVE); +} + +static int stk8312_buffer_postdisable(struct iio_dev *indio_dev) +{ + struct stk8312_data *data = iio_priv(indio_dev); + + return stk8312_set_mode(data, data->mode & (~STK8312_MODE_ACTIVE)); +} + +static const struct iio_buffer_setup_ops stk8312_buffer_setup_ops = { + .preenable = stk8312_buffer_preenable, + .postenable = iio_triggered_buffer_postenable, + .predisable = iio_triggered_buffer_predisable, + .postdisable = stk8312_buffer_postdisable, +}; + +static int stk8312_gpio_probe(struct i2c_client *client) +{ + struct device *dev; + struct gpio_desc *gpio; + int ret; + + if (!client) + return -EINVAL; + + dev = &client->dev; + + /* data ready gpio interrupt pin */ + gpio = devm_gpiod_get_index(dev, STK8312_GPIO, 0, GPIOD_IN); + if (IS_ERR(gpio)) { + dev_err(dev, "acpi gpio get index failed\n"); + return PTR_ERR(gpio); + } + + ret = gpiod_to_irq(gpio); + dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret); + + return ret; +} + static int stk8312_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -312,26 +483,85 @@ static int stk8312_probe(struct i2c_client *client, if (ret < 0) return ret; - ret = stk8312_set_mode(data, STK8312_MODE_ACTIVE); + ret = stk8312_set_mode(data, STK8312_INT_MODE | STK8312_MODE_ACTIVE); if (ret < 0) return ret; + if (client->irq < 0) + client->irq = stk8312_gpio_probe(client); + + if (client->irq >= 0) { + ret = devm_request_threaded_irq(&client->dev, client->irq, + stk8312_data_rdy_trig_poll, + NULL, + IRQF_TRIGGER_RISING | + IRQF_ONESHOT, + STK8312_IRQ_NAME, + indio_dev); + if (ret < 0) { + dev_err(&client->dev, "request irq %d failed\n", + client->irq); + goto err_power_off; + } + + data->dready_trig = devm_iio_trigger_alloc(&client->dev, + "%s-dev%d", + indio_dev->name, + indio_dev->id); + if (!data->dready_trig) { + ret = -ENOMEM; + goto err_power_off; + } + + data->dready_trig->dev.parent = &client->dev; + data->dready_trig->ops = &stk8312_trigger_ops; + iio_trigger_set_drvdata(data->dready_trig, indio_dev); + ret = iio_trigger_register(data->dready_trig); + if (ret) { + dev_err(&client->dev, "iio trigger register failed\n"); + goto err_power_off; + } + } + + ret = iio_triggered_buffer_setup(indio_dev, + iio_pollfunc_store_time, + stk8312_trigger_handler, + &stk8312_buffer_setup_ops); + if (ret < 0) { + dev_err(&client->dev, "iio triggered buffer setup failed\n"); + goto err_trigger_unregister; + } + ret = iio_device_register(indio_dev); if (ret < 0) { dev_err(&client->dev, "device_register failed\n"); - stk8312_set_mode(data, STK8312_MODE_STANDBY); + goto err_buffer_cleanup; } return ret; + +err_buffer_cleanup: + iio_triggered_buffer_cleanup(indio_dev); +err_trigger_unregister: + if (data->dready_trig) + iio_trigger_unregister(data->dready_trig); +err_power_off: + stk8312_set_mode(data, STK8312_MODE_STANDBY); + return ret; } static int stk8312_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct stk8312_data *data = iio_priv(indio_dev); iio_device_unregister(indio_dev); + iio_triggered_buffer_cleanup(indio_dev); - return stk8312_set_mode(iio_priv(indio_dev), STK8312_MODE_STANDBY); + if (data->dready_trig) + iio_trigger_unregister(data->dready_trig); + + return stk8312_set_mode(data, STK8312_MODE_STANDBY); } #ifdef CONFIG_PM_SLEEP @@ -341,7 +571,7 @@ static int stk8312_suspend(struct device *dev) data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); - return stk8312_set_mode(data, STK8312_MODE_STANDBY); + return stk8312_set_mode(data, data->mode & (~STK8312_MODE_ACTIVE)); } static int stk8312_resume(struct device *dev) @@ -350,7 +580,7 @@ static int stk8312_resume(struct device *dev) data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); - return stk8312_set_mode(data, STK8312_MODE_ACTIVE); + return stk8312_set_mode(data, data->mode | STK8312_MODE_ACTIVE); } static SIMPLE_DEV_PM_OPS(stk8312_pm_ops, stk8312_suspend, stk8312_resume); From 5e913d27f91aa15e1311399385579bef5238e2cd Mon Sep 17 00:00:00 2001 From: Tiberiu Breana Date: Wed, 24 Jun 2015 17:01:49 +0300 Subject: [PATCH 037/912] iio: accel: Add sampling rate support for STK8312 Added support for setting the STK8312 accelerometer's sampling rate. Signed-off-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 96 +++++++++++++++++++++++++++++++------ 1 file changed, 82 insertions(+), 14 deletions(-) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index be58d66d5d33..c2bd1444d6da 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -29,6 +29,7 @@ #define STK8312_REG_ZOUT 0x02 #define STK8312_REG_INTSU 0x06 #define STK8312_REG_MODE 0x07 +#define STK8312_REG_SR 0x08 #define STK8312_REG_STH 0x13 #define STK8312_REG_RESET 0x20 #define STK8312_REG_AFECTRL 0x24 @@ -41,6 +42,8 @@ #define STK8312_DREADY_BIT 0x10 #define STK8312_INT_MODE 0xC0 #define STK8312_RNG_MASK 0xC0 +#define STK8312_SR_MASK 0x07 +#define STK8312_SR_400HZ_IDX 0 #define STK8312_RNG_SHIFT 6 #define STK8312_READ_RETRIES 16 #define STK8312_ALL_CHANNEL_MASK 7 @@ -65,20 +68,29 @@ static const int stk8312_scale_table[][2] = { {0, 461600}, {1, 231100} }; -#define STK8312_ACCEL_CHANNEL(index, reg, axis) { \ - .type = IIO_ACCEL, \ - .address = reg, \ - .modified = 1, \ - .channel2 = IIO_MOD_##axis, \ - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ - .scan_index = index, \ - .scan_type = { \ - .sign = 's', \ - .realbits = 8, \ - .storagebits = 8, \ - .endianness = IIO_CPU, \ - }, \ +static const struct { + u16 val; + u32 val2; +} stk8312_samp_freq_table[] = { + {400, 0}, {200, 0}, {100, 0}, {50, 0}, {25, 0}, + {12, 500000}, {6, 250000}, {3, 125000} +}; + +#define STK8312_ACCEL_CHANNEL(index, reg, axis) { \ + .type = IIO_ACCEL, \ + .address = reg, \ + .modified = 1, \ + .channel2 = IIO_MOD_##axis, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .scan_index = index, \ + .scan_type = { \ + .sign = 's', \ + .realbits = 8, \ + .storagebits = 8, \ + .endianness = IIO_CPU, \ + }, \ } static const struct iio_chan_spec stk8312_channels[] = { @@ -92,6 +104,7 @@ struct stk8312_data { struct i2c_client *client; struct mutex lock; int range; + u8 sample_rate_idx; u8 mode; struct iio_trigger *dready_trig; bool dready_trigger_on; @@ -100,8 +113,11 @@ struct stk8312_data { static IIO_CONST_ATTR(in_accel_scale_available, STK8312_SCALE_AVAIL); +static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("3.125 6.25 12.5 25 50 100 200 400"); + static struct attribute *stk8312_attributes[] = { &iio_const_attr_in_accel_scale_available.dev_attr.attr, + &iio_const_attr_sampling_frequency_available.dev_attr.attr, NULL, }; @@ -220,6 +236,39 @@ static const struct iio_trigger_ops stk8312_trigger_ops = { .owner = THIS_MODULE, }; +static int stk8312_set_sample_rate(struct stk8312_data *data, int rate) +{ + int ret; + u8 masked_reg; + u8 mode; + struct i2c_client *client = data->client; + + if (rate == data->sample_rate_idx) + return 0; + + mode = data->mode; + /* We need to go in standby mode to modify registers */ + ret = stk8312_set_mode(data, STK8312_MODE_STANDBY); + if (ret < 0) + return ret; + + ret = i2c_smbus_read_byte_data(client, STK8312_REG_SR); + if (ret < 0) { + dev_err(&client->dev, "failed to set sampling rate\n"); + return ret; + } + + masked_reg = (ret & (~STK8312_SR_MASK)) | rate; + + ret = i2c_smbus_write_byte_data(client, STK8312_REG_SR, masked_reg); + if (ret < 0) + dev_err(&client->dev, "failed to set sampling rate\n"); + else + data->sample_rate_idx = rate; + + return stk8312_set_mode(data, mode); +} + static int stk8312_set_range(struct stk8312_data *data, u8 range) { int ret; @@ -303,6 +352,10 @@ static int stk8312_read_raw(struct iio_dev *indio_dev, *val = stk8312_scale_table[data->range - 1][0]; *val2 = stk8312_scale_table[data->range - 1][1]; return IIO_VAL_INT_PLUS_MICRO; + case IIO_CHAN_INFO_SAMP_FREQ: + *val = stk8312_samp_freq_table[data->sample_rate_idx].val; + *val2 = stk8312_samp_freq_table[data->sample_rate_idx].val2; + return IIO_VAL_INT_PLUS_MICRO; } return -EINVAL; @@ -332,6 +385,20 @@ static int stk8312_write_raw(struct iio_dev *indio_dev, ret = stk8312_set_range(data, index); mutex_unlock(&data->lock); + return ret; + case IIO_CHAN_INFO_SAMP_FREQ: + for (i = 0; i < ARRAY_SIZE(stk8312_samp_freq_table); i++) + if (val == stk8312_samp_freq_table[i].val && + val2 == stk8312_samp_freq_table[i].val2) { + index = i; + break; + } + if (index < 0) + return -EINVAL; + mutex_lock(&data->lock); + ret = stk8312_set_sample_rate(data, index); + mutex_unlock(&data->lock); + return ret; } @@ -479,6 +546,7 @@ static int stk8312_probe(struct i2c_client *client, dev_err(&client->dev, "failed to reset sensor\n"); return ret; } + data->sample_rate_idx = STK8312_SR_400HZ_IDX; ret = stk8312_set_range(data, 1); if (ret < 0) return ret; From fcc577dd55db193926537e0e4de98492d665446b Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 23 Jun 2015 16:34:19 +0300 Subject: [PATCH 038/912] iio: Fix parameters in iio_triggered_buffer_setup This patch renames the top half handler and the bottom half handler of iio_triggered_buffer_setup() in accordance with their usage. The bottom half has been renamed to reflect the fact that it is a thread based call, compliant with iio_alloc_pollfunc(). The names of the parameters were swapped, thus creating confusion. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-triggered-buffer.c | 12 ++++++------ include/linux/iio/triggered_buffer.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/industrialio-triggered-buffer.c b/drivers/iio/industrialio-triggered-buffer.c index 15a5341b5e7b..4b2858ba1fd6 100644 --- a/drivers/iio/industrialio-triggered-buffer.c +++ b/drivers/iio/industrialio-triggered-buffer.c @@ -24,8 +24,8 @@ static const struct iio_buffer_setup_ops iio_triggered_buffer_setup_ops = { /** * iio_triggered_buffer_setup() - Setup triggered buffer and pollfunc * @indio_dev: IIO device structure - * @pollfunc_bh: Function which will be used as pollfunc bottom half - * @pollfunc_th: Function which will be used as pollfunc top half + * @h: Function which will be used as pollfunc top half + * @thread: Function which will be used as pollfunc bottom half * @setup_ops: Buffer setup functions to use for this device. * If NULL the default setup functions for triggered * buffers will be used. @@ -42,8 +42,8 @@ static const struct iio_buffer_setup_ops iio_triggered_buffer_setup_ops = { * iio_triggered_buffer_cleanup(). */ int iio_triggered_buffer_setup(struct iio_dev *indio_dev, - irqreturn_t (*pollfunc_bh)(int irq, void *p), - irqreturn_t (*pollfunc_th)(int irq, void *p), + irqreturn_t (*h)(int irq, void *p), + irqreturn_t (*thread)(int irq, void *p), const struct iio_buffer_setup_ops *setup_ops) { struct iio_buffer *buffer; @@ -57,8 +57,8 @@ int iio_triggered_buffer_setup(struct iio_dev *indio_dev, iio_device_attach_buffer(indio_dev, buffer); - indio_dev->pollfunc = iio_alloc_pollfunc(pollfunc_bh, - pollfunc_th, + indio_dev->pollfunc = iio_alloc_pollfunc(h, + thread, IRQF_ONESHOT, indio_dev, "%s_consumer%d", diff --git a/include/linux/iio/triggered_buffer.h b/include/linux/iio/triggered_buffer.h index c378ebec605e..f72f70d5a97b 100644 --- a/include/linux/iio/triggered_buffer.h +++ b/include/linux/iio/triggered_buffer.h @@ -7,8 +7,8 @@ struct iio_dev; struct iio_buffer_setup_ops; int iio_triggered_buffer_setup(struct iio_dev *indio_dev, - irqreturn_t (*pollfunc_bh)(int irq, void *p), - irqreturn_t (*pollfunc_th)(int irq, void *p), + irqreturn_t (*h)(int irq, void *p), + irqreturn_t (*thread)(int irq, void *p), const struct iio_buffer_setup_ops *setup_ops); void iio_triggered_buffer_cleanup(struct iio_dev *indio_dev); From e26bb71da9cf3c54cd8b1c1341a9c9b89e704ca6 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 30 Jun 2015 13:51:51 +0530 Subject: [PATCH 039/912] staging: wilc1000: fix build failure commit 80279fb7ba5b ("cfg80211: properly send NL80211_ATTR_DISCONNECTED_BY_AP in disconnect") has changed the api of cfg80211_disconnected() and caused a build failure. Add the extra argument as false since it appears from the code that the disconnection is not locally generated. And incase of doubt we can use false as that is the default behaviour. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 92064db9eb05..f7f5fafe49fe 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -675,7 +675,8 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, pstrDisconnectNotifInfo->u16reason = 1; } cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie, - pstrDisconnectNotifInfo->ie_len, GFP_KERNEL); + pstrDisconnectNotifInfo->ie_len, false, + GFP_KERNEL); } From 8ca1b55a49f3b8e139fb4567b966f03a734e744f Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Sun, 21 Jun 2015 10:56:21 +0530 Subject: [PATCH 040/912] Staging: wilc1000: Replace memset with eth_zero_addr Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero. The Coccinelle semantic patch that makes this change is as follows: // @eth_zero_addr@ expression e; @@ -memset(e,0x00,ETH_ALEN); +eth_zero_addr(e); // Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_mon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index f5296f53a3d2..2a3d875d14f8 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -495,7 +495,7 @@ static void WILC_WFI_mon_setup(struct net_device *dev) ether_setup(dev); dev->tx_queue_len = 0; dev->type = ARPHRD_IEEE80211_RADIOTAP; - memset(dev->dev_addr, 0, ETH_ALEN); + eth_zero_addr(dev->dev_addr); #ifdef USE_WIRELESS { From a241a78952af31fcf4d33db2308fefb27c91703f Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 22 Jun 2015 13:08:11 +0900 Subject: [PATCH 041/912] staging: wilc1000: wilc_wfi_netdevice.c: remove prohibited space before semicolon Fix checkpatch warning found by checkpatch.pl WARNING: space prohibited before semicolon Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index ab66ce4bd790..01542f439376 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -31,7 +31,7 @@ module_param(timeout, int, 0); /* * Do we run in NAPI mode? */ -static int use_napi ; +static int use_napi; module_param(use_napi, int, 0); From e8b369ea2bf80b5813ee760de4454deb2c10ee87 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 22 Jun 2015 13:08:12 +0900 Subject: [PATCH 042/912] staging: wilc1000: wilc_wfi_netdevice.c: remove prohibited space Fix checkpatch warning found by checkpatch.pl WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index 01542f439376..9da7674602e1 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -71,7 +71,7 @@ void WILC_WFI_SetupPool(struct net_device *dev) priv->ppool = NULL; for (i = 0; i < pool_size; i++) { - pkt = kmalloc (sizeof (struct WILC_WFI_packet), GFP_KERNEL); + pkt = kmalloc(sizeof(struct WILC_WFI_packet), GFP_KERNEL); if (pkt == NULL) { PRINT_D(RX_DBG, "Ran out of memory allocating packet pool\n"); return; @@ -99,7 +99,7 @@ void WILC_WFI_TearDownPool(struct net_device *dev) while ((pkt = priv->ppool)) { priv->ppool = pkt->next; - kfree (pkt); + kfree(pkt); /* FIXME - in-flight packets ? */ } } From 55229a56bb9e6f7f9dce36099b1045deb73409f1 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 22 Jun 2015 13:08:13 +0900 Subject: [PATCH 043/912] staging: wilc1000: wilc_wfi_netdevice.c: remove braces for single statement block Fix checkpatch warning found by checkpatch.pl WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index 9da7674602e1..039e21f6caf6 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -931,10 +931,8 @@ int WILC_WFI_InitModule(void) /* ret = host_int_init(&priv[0]->hWILCWFIDrv); */ /*copy handle to the other driver*/ /* priv[1]->hWILCWFIDrv = priv[0]->hWILCWFIDrv; */ - if (ret) { + if (ret) PRINT_ER("Error Init Driver\n"); - } - out: if (ret) From df493fe8fa7ed73d73e08c768ed057b0e61b813d Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 22 Jun 2015 13:08:14 +0900 Subject: [PATCH 044/912] staging: wilc1000: wilc_wfi_netdevice.c: Insert blank line after declarations Fix checkpatch warning found by checkpatch.pl WARNING: Missing a blank line after declarations Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index 039e21f6caf6..31a796b5ff29 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -207,6 +207,7 @@ struct WILC_WFI_packet *WILC_WFI_DequeueBuf(struct net_device *dev) static void WILC_WFI_RxInts(struct net_device *dev, int enable) { struct WILC_WFI_priv *priv = netdev_priv(dev); + priv->rx_int_enabled = enable; } @@ -522,6 +523,7 @@ void WILC_WFI_HwTx(char *buf, int len, struct net_device *dev) if (0) { /* enable this conditional to look at the data */ int i; + PRINT_D(RX_DBG, "len is %i", len); for (i = 14; i < len; i++) PRINT_D(RX_DBG, "TXdata[%d] %02x\n", i, buf[i] & 0xff); @@ -677,6 +679,7 @@ int WILC_WFI_Ioctl(struct net_device *dev, struct ifreq *rq, int cmd) struct net_device_stats *WILC_WFI_Stats(struct net_device *dev) { struct WILC_WFI_priv *priv = netdev_priv(dev); + return &priv->stats; } From decc286c7dac701fc545d4a23cb2f9cf19a09a2c Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 22 Jun 2015 13:08:15 +0900 Subject: [PATCH 045/912] staging: wilc1000: wilc_wfi_netdevice.c: move statement after declarations Fix checkpatch warning found by checkpatch.pl WARNING: Missing a blank line after declarations Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index 31a796b5ff29..170ca65cd135 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -886,9 +886,10 @@ int WILC_WFI_InitModule(void) int result, i, ret = -ENOMEM; struct WILC_WFI_priv *priv[2], *netpriv; struct wireless_dev *wdev; - WILC_WFI_Interrupt = use_napi ? WILC_WFI_NapiInterrupt : WILC_WFI_RegularInterrupt; char buf[IFNAMSIZ]; + WILC_WFI_Interrupt = use_napi ? WILC_WFI_NapiInterrupt : WILC_WFI_RegularInterrupt; + for (i = 0; i < 2; i++) { /* Allocate the net devices */ From 6608a38c66dfc0b14e77b92cbbf2457d18c42cd7 Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:02:46 +0000 Subject: [PATCH 046/912] staging: wilc1000: remove ununsed variable and associated line This patch removes a unused variable 'u16RespLen' that is assigned a value that is never used. The line that does the assignment is also removed. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index ed6ac45c0385..67cffc3c9b94 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1739,7 +1739,6 @@ s32 ParseResponse(u8 *resp, tstrWID *pstrWIDcfgResult) s32 ParseWriteResponse(u8 *pu8RespBuffer) { s32 s32Error = WILC_FAIL; - u16 u16RespLen = 0; u16 u16WIDtype = (u16)WID_NIL; /* Check whether the received frame is a valid response */ @@ -1748,9 +1747,6 @@ s32 ParseWriteResponse(u8 *pu8RespBuffer) return WILC_FAIL; } - /* Extract Response Length */ - u16RespLen = MAKE_WORD16(pu8RespBuffer[2], pu8RespBuffer[3]); - u16WIDtype = MAKE_WORD16(pu8RespBuffer[4], pu8RespBuffer[5]); /* Check for WID_STATUS ID and then check the length and status value */ From ab6ebe3a4b1ff9e37c2b7d12da7f985125dfab55 Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:03:06 +0000 Subject: [PATCH 047/912] staging: wilc1000: remove redundant initialization of variable This patch removes the redundant initialization of the variable 'st' as it is reassigned a new value before its being used anywhere else. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 67cffc3c9b94..eb685fea2cd2 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -605,7 +605,7 @@ INLINE u16 get_cap_info(u8 *data) { u16 cap_info = 0; u16 index = MAC_HDR_LEN; - tenuFrmSubtype st = BEACON; + tenuFrmSubtype st; st = get_sub_type(data); From 04f2a50d41950ba60a56d2f884be05893ac61b6b Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:03:27 +0000 Subject: [PATCH 048/912] staging: wilc1000: remove ununsed if..else.. code blocks This patch removes ununsed if..else... code blocks. Its actually some dead code. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 22 --------------------- 1 file changed, 22 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index eb685fea2cd2..b0696141e10f 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1568,14 +1568,6 @@ s32 further_process_response(u8 *resp, case WID_STR: WILC_memcpy(cfg_str, resp + idx, cfg_len); /* cfg_str[cfg_len] = '\0'; //mostafa: no need currently for NULL termination */ - if (process_wid_num) { - /*fprintf(out_file,"0x%4.4x = %s\n",g_wid_num, - * cfg_str);*/ - } else { - /*fprintf(out_file,"%s = %s\n",gastrWIDs[cnt].cfg_switch, - * cfg_str);*/ - } - if (pstrWIDresult->s32ValueSize >= cfg_len) { WILC_memcpy(pstrWIDresult->ps8WidVal, cfg_str, cfg_len); /* mostafa: no need currently for the extra NULL byte */ pstrWIDresult->s32ValueSize = cfg_len; @@ -1591,13 +1583,6 @@ s32 further_process_response(u8 *resp, WILC_strncpy(pstrWIDresult->ps8WidVal, cfg_str, WILC_strlen(cfg_str)); pstrWIDresult->ps8WidVal[WILC_strlen(cfg_str)] = '\0'; - if (process_wid_num) { - /*fprintf(out_file,"0x%4.4x = %s\n",g_wid_num, - * cfg_str);*/ - } else { - /*fprintf(out_file,"%s = %s\n",gastrWIDs[cnt].cfg_switch, - * cfg_str);*/ - } break; case WID_IP: @@ -1606,13 +1591,6 @@ s32 further_process_response(u8 *resp, MAKE_WORD16(resp[idx + 2], resp[idx + 3]) ); conv_int_to_ip(cfg_str, cfg_int); - if (process_wid_num) { - /*fprintf(out_file,"0x%4.4x = %s\n",g_wid_num, - * cfg_str);*/ - } else { - /*fprintf(out_file,"%s = %s\n",gastrWIDs[cnt].cfg_switch, - * cfg_str);*/ - } break; case WID_BIN_DATA: From 53e1096fea95f196377baac5e005b2de8c730631 Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:03:53 +0000 Subject: [PATCH 049/912] staging: wilc1000: remove ununsed variable & corresponding lines This patch removes a couple of ununsed variable.The lines in which these variables are assigned are also removed as they are not necessary. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_mon.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index 2a3d875d14f8..d812a3b194f3 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -237,14 +237,12 @@ static void mgmt_tx_complete(void *priv, int status) } static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) { - linux_wlan_t *nic; struct tx_complete_mon_data *mgmt_tx = NULL; if (dev == NULL) { PRINT_D(HOSTAPD_DBG, "ERROR: dev == NULL\n"); return WILC_FAIL; } - nic = netdev_priv(dev); netif_stop_queue(dev); mgmt_tx = kmalloc(sizeof(struct tx_complete_mon_data), GFP_ATOMIC); @@ -298,7 +296,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, struct net_device *dev) { - struct ieee80211_radiotap_header *rtap_hdr; u32 rtap_len, i, ret = 0; struct WILC_WFI_mon_priv *mon_priv; @@ -318,7 +315,6 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, return WILC_FAIL; } - rtap_hdr = (struct ieee80211_radiotap_header *)skb->data; rtap_len = ieee80211_get_radiotap_len(skb->data); if (skb->len < rtap_len) { From 773116ea0b78c0aa8315bb64690d6a82c3f44b64 Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:04:20 +0000 Subject: [PATCH 050/912] staging: wilc1000: remove unused variable This patch removes a unused variable timeout and the associated code. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b352c504a77d..5a794df0da4d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -868,7 +868,6 @@ static int linux_wlan_txq_task(void *vp) #define TX_BACKOFF_WEIGHT_MIN (0) #define TX_BACKOFF_WEIGHT_UNIT_MS (10) int backoff_weight = TX_BACKOFF_WEIGHT_MIN; - signed long timeout; #endif /* inform wilc1000_wlan_init that TXQ task is started. */ @@ -906,7 +905,6 @@ static int linux_wlan_txq_task(void *vp) } if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */ - timeout = msecs_to_jiffies(TX_BACKOFF_WEIGHT_UNIT_MS << backoff_weight); do { /* Back off from sending packets for some time. */ /* schedule_timeout will allow RX task to run and free buffers.*/ From 369f190a70d1972eed3888bd255dca711c8f58f3 Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:04:39 +0000 Subject: [PATCH 051/912] staging: wilc1000: remove redundant assignment of variable This patch the removes the redundant assignement of the variable ret as its being overwritren before being used anywhere. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 3af91f770485..d28c410ba249 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1782,7 +1782,7 @@ static int wilc_wlan_stop(void) /******************************************************************************/ reg = ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 8) | (1 << 9) | (1 << 26) | (1 << 29) | (1 << 30) | (1 << 31)); /**/ /**/ - ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); /**/ + p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); /**/ reg = ~(1 << 10); /**/ /**/ ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); /**/ From 810532227a431d5f13e732a37119a94d73819949 Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 13:13:58 +0000 Subject: [PATCH 052/912] staging: wilc1000: remove ununsed variable This patch removes ununsed variable 'len' Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index d28c410ba249..def72fd1236d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -118,11 +118,10 @@ static void wilc_debug(uint32_t flag, char *fmt, ...) { char buf[256]; va_list args; - int len; if (flag & dbgflag) { va_start(args, fmt); - len = vsprintf(buf, fmt, args); + vsprintf(buf, fmt, args); va_end(args); if (g_wlan.os_func.os_debug) From 690910c0cf350a96590c6795f2d0f26e5f8ec59f Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:05:22 +0000 Subject: [PATCH 053/912] staging: wilc1000: remove ununsed variable & associated code This patch removes the ununsed variable 'priv' at multiple instances and all its associated code where its assigned a value. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index f7f5fafe49fe..1d0b7f87b100 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -144,9 +144,7 @@ bool g_wep_keys_saved = false; void clear_shadow_scan(void *pUserVoid) { - struct WILC_WFI_priv *priv; int i; - priv = (struct WILC_WFI_priv *)pUserVoid; if (op_ifcs == 0) { WILC_TimerDestroy(&hAgingTimer, NULL); PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n"); @@ -219,9 +217,7 @@ void refresh_scan(void *pUserVoid, uint8_t all, bool bDirectScan) void reset_shadow_found(void *pUserVoid) { - struct WILC_WFI_priv *priv; int i; - priv = (struct WILC_WFI_priv *)pUserVoid; for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { astrLastScannedNtwrksShadow[i].u8Found = 0; @@ -230,9 +226,7 @@ void reset_shadow_found(void *pUserVoid) void update_scan_time(void *pUserVoid) { - struct WILC_WFI_priv *priv; int i; - priv = (struct WILC_WFI_priv *)pUserVoid; for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies; } @@ -240,11 +234,9 @@ void update_scan_time(void *pUserVoid) void remove_network_from_shadow(void *pUserVoid) { - struct WILC_WFI_priv *priv; unsigned long now = jiffies; int i, j; - priv = (struct WILC_WFI_priv *)pUserVoid; for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { if (time_after(now, astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan + (unsigned long)(SCAN_RESULT_EXPIRE))) { @@ -281,11 +273,9 @@ void clear_duringIP(void *pUserVoid) int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) { - struct WILC_WFI_priv *priv; int8_t state = -1; int i; - priv = (struct WILC_WFI_priv *)pUserVoid; if (u32LastScannedNtwrksCountShadow == 0) { PRINT_D(CFG80211_DBG, "Starting Aging timer\n"); WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid, NULL); @@ -305,11 +295,9 @@ int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams) { - struct WILC_WFI_priv *priv; int8_t ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid); uint32_t ap_index = 0; uint8_t rssi_index = 0; - priv = (struct WILC_WFI_priv *)pUserVoid; if (u32LastScannedNtwrksCountShadow >= MAX_NUM_SCANNED_NETWORKS_SHADOW) { PRINT_D(CFG80211_DBG, "Shadow network reached its maximum limit\n"); From ba8f5e6642958c73cd558a2d9503720e35951b06 Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:05:42 +0000 Subject: [PATCH 054/912] staging: wilc1000: remove unused variable msg_len This patch removes a ununsed variable msg_len and its associated code. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 3cffe55b3a93..04d032783dae 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -513,7 +513,6 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r int ret = 1; uint8_t msg_type; uint8_t msg_id; - uint16_t msg_len; #ifdef WILC_FULLY_HOSTING_AP u32 *ptru32Frame; bool bStatus = frame[2]; @@ -528,11 +527,6 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r msg_type = frame[0]; msg_id = frame[1]; /* seq no */ -#ifdef BIG_ENDIAN - msg_len = (frame[2] << 8) | frame[3]; -#else - msg_len = (frame[3] << 8) | frame[2]; -#endif frame += 4; size -= 4; From 2d33ff126bd6f4597189af7348aff9721d4b8080 Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 22 Jun 2015 07:06:01 +0000 Subject: [PATCH 055/912] staging: wilc1000: use BIT macro This patch addresses the checkpatch warning advising the usage of the BIT macro for Bit shift operation. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan_if.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 8ed51e385118..8735a6a64d89 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -43,8 +43,8 @@ ********************************************/ #define HIF_SDIO (0) -#define HIF_SPI (1 << 0) -#define HIF_SDIO_GPIO_IRQ (1 << 2) +#define HIF_SPI BIT(0) +#define HIF_SDIO_GPIO_IRQ BIT(2) /******************************************** From bf903c1e0784f668bcb325494a38cc359c1b5de6 Mon Sep 17 00:00:00 2001 From: Sunil Shahu Date: Mon, 22 Jun 2015 19:23:01 +0530 Subject: [PATCH 056/912] staging: wilc1000: host_interface: add spaces around '=' Fix coding style error by placing spaces around '=' as suggested by checkpatch.pl script. Signed-off-by: Sunil Shahu Reviewed-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6b10bbbe6ab2..d1fe73df807d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -7945,8 +7945,8 @@ s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_IPADDRESS; strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd; - strHostIFmsg.drvHandler=hWFIDrv; - strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx= idx; + strHostIFmsg.drvHandler = hWFIDrv; + strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); if (s32Error) { From 66f1a77ec182847b3334edeb37eb4d10b2e8043e Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Tue, 23 Jun 2015 09:17:44 +0900 Subject: [PATCH 057/912] staging: wilc1000: wilc_wfi_netdevice.c: remove commented codes Remove commented codes. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index 170ca65cd135..478cd2bcfea0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -325,7 +325,6 @@ void WILC_WFI_Rx(struct net_device *dev, struct WILC_WFI_packet *pkt) PRINT_INFO(RX_DBG, "In monitor device name %s\n", dev->name); priv = wiphy_priv(priv->dev->ieee80211_ptr->wiphy); PRINT_D(RX_DBG, "VALUE PASSED IN OF HRWD %p\n", priv->hWILCWFIDrv); - /* host_int_get_rssi(priv->hWILCWFIDrv, &(rssi)); */ if (INFO) { for (i = 14; i < skb->len; i++) PRINT_INFO(RX_DBG, "RXdata[%d] %02x\n", i, skb->data[i]); @@ -600,12 +599,6 @@ int WILC_WFI_Tx(struct sk_buff *skb, struct net_device *dev) char *data, shortpkt[ETH_ZLEN]; struct WILC_WFI_priv *priv = netdev_priv(dev); - /* priv = wiphy_priv(priv->dev->ieee80211_ptr->wiphy); */ - - /* if(priv->monitor_flag) */ - /* mac80211_hwsim_monitor_rx(skb); */ - - data = skb->data; len = skb->len; @@ -836,12 +829,6 @@ void WILC_WFI_Cleanup(void) int i; struct WILC_WFI_priv *priv[2]; - /*if(hwsim_mon!=NULL) - * { - * PRINT_D(RX_DBG, "Freeing monitor interface\n"); - * unregister_netdev(hwsim_mon); - * free_netdev(hwsim_mon); - * }*/ for (i = 0; i < 2; i++) { priv[i] = netdev_priv(WILC_WFI_devs[i]); @@ -897,7 +884,6 @@ int WILC_WFI_InitModule(void) WILC_WFI_Init); if (WILC_WFI_devs[i] == NULL) goto out; - /* priv[i] = netdev_priv(WILC_WFI_devs[i]); */ wdev = WILC_WFI_WiphyRegister(WILC_WFI_devs[i]); WILC_WFI_devs[i]->ieee80211_ptr = wdev; @@ -921,9 +907,6 @@ int WILC_WFI_InitModule(void) priv[1] = netdev_priv(WILC_WFI_devs[1]); if (priv[1]->dev->ieee80211_ptr->wiphy->interface_modes && BIT(NL80211_IFTYPE_MONITOR)) { - /* snprintf(buf, IFNAMSIZ, "mon.%s", priv[1]->dev->name); */ - /* WILC_WFI_init_mon_interface(); */ - /* priv[1]->monitor_flag = 1; */ } priv[0]->bCfgScanning = false; @@ -931,10 +914,6 @@ int WILC_WFI_InitModule(void) WILC_memset(priv[0]->au8AssociatedBss, 0xFF, ETH_ALEN); - - /* ret = host_int_init(&priv[0]->hWILCWFIDrv); */ - /*copy handle to the other driver*/ - /* priv[1]->hWILCWFIDrv = priv[0]->hWILCWFIDrv; */ if (ret) PRINT_ER("Error Init Driver\n"); From 5927139ab52ef90232bd2578836ce36e5798920d Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Tue, 23 Jun 2015 09:17:45 +0900 Subject: [PATCH 058/912] staging: wilc1000: wilc_wfi_netdevice.c: remove unused codes Remove if statement that has no any codes. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index 478cd2bcfea0..d5facb4e55d9 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -906,9 +906,6 @@ int WILC_WFI_InitModule(void) priv[0] = netdev_priv(WILC_WFI_devs[0]); priv[1] = netdev_priv(WILC_WFI_devs[1]); - if (priv[1]->dev->ieee80211_ptr->wiphy->interface_modes && BIT(NL80211_IFTYPE_MONITOR)) { - - } priv[0]->bCfgScanning = false; priv[0]->u32RcvdChCount = 0; From 70fb5aa8a5f67275b5c2ebe23190777213d010df Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Tue, 23 Jun 2015 09:17:46 +0900 Subject: [PATCH 059/912] staging: wilc1000: wilc_wfi_netdevice.c: remove unused variable Remove variable that is defined but never used. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index d5facb4e55d9..c2e92c0dd4bd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -873,7 +873,6 @@ int WILC_WFI_InitModule(void) int result, i, ret = -ENOMEM; struct WILC_WFI_priv *priv[2], *netpriv; struct wireless_dev *wdev; - char buf[IFNAMSIZ]; WILC_WFI_Interrupt = use_napi ? WILC_WFI_NapiInterrupt : WILC_WFI_RegularInterrupt; From 9295e2d7341cb66ab8bbca029eabbe85b38bc376 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Tue, 23 Jun 2015 09:17:47 +0900 Subject: [PATCH 060/912] staging: wilc1000: wilc_wfi_netdevice.c: remove blank lines Remove multiple blank lines. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c index c2e92c0dd4bd..af9b85822ced 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c @@ -12,11 +12,9 @@ #include "wilc_wfi_cfgoperations.h" #include "host_interface.h" - MODULE_AUTHOR("Mai Daftedar"); MODULE_LICENSE("Dual BSD/GPL"); - struct net_device *WILC_WFI_devs[2]; /* @@ -34,7 +32,6 @@ module_param(timeout, int, 0); static int use_napi; module_param(use_napi, int, 0); - /* * A structure representing an in-flight packet. */ @@ -45,12 +42,9 @@ struct WILC_WFI_packet { u8 data[ETH_DATA_LEN]; }; - - int pool_size = 8; module_param(pool_size, int, 0); - static void WILC_WFI_TxTimeout(struct net_device *dev); static void (*WILC_WFI_Interrupt)(int, void *, struct pt_regs *); @@ -252,7 +246,6 @@ int WILC_WFI_Open(struct net_device *dev) int WILC_WFI_Release(struct net_device *dev) { /* release ports, irq and such -- like fops->close */ - netif_stop_queue(dev); /* can't transmit any more */ return 0; @@ -512,7 +505,6 @@ void WILC_WFI_HwTx(char *buf, int len, struct net_device *dev) u32 *saddr, *daddr; struct WILC_WFI_packet *tx_buffer; - /* I am paranoid. Ain't I? */ if (len < sizeof(struct ethhdr) + sizeof(struct iphdr)) { PRINT_D(RX_DBG, "WILC_WFI: Hmm... packet too short (%i octets)\n", @@ -580,7 +572,6 @@ void WILC_WFI_HwTx(char *buf, int len, struct net_device *dev) (unsigned long) priv->stats.tx_packets); } else WILC_WFI_Interrupt(0, dev, NULL); - } /** @@ -785,7 +776,6 @@ void WILC_WFI_Init(struct net_device *dev) { struct WILC_WFI_priv *priv; - /* * Then, assign other fields in dev, using ether_setup() and some * hand assignments @@ -851,12 +841,6 @@ void WILC_WFI_Cleanup(void) void StartConfigSim(void); - - - - - - /** * @brief WILC_WFI_Stat * @details Return statistics to the caller @@ -877,7 +861,6 @@ int WILC_WFI_InitModule(void) WILC_WFI_Interrupt = use_napi ? WILC_WFI_NapiInterrupt : WILC_WFI_RegularInterrupt; for (i = 0; i < 2; i++) { - /* Allocate the net devices */ WILC_WFI_devs[i] = alloc_netdev(sizeof(struct WILC_WFI_priv), "wlan%d", WILC_WFI_Init); @@ -900,7 +883,6 @@ int WILC_WFI_InitModule(void) ret = 0; } - /*init atmel driver */ priv[0] = netdev_priv(WILC_WFI_devs[0]); priv[1] = netdev_priv(WILC_WFI_devs[1]); @@ -921,7 +903,6 @@ out: } - module_init(WILC_WFI_InitModule); module_exit(WILC_WFI_Cleanup); From 69176e1cbd62d1660c082fc2dfc3ae7aece525ff Mon Sep 17 00:00:00 2001 From: Sunghoon Cho Date: Fri, 26 Jun 2015 15:48:14 +0900 Subject: [PATCH 061/912] staging: wilc1000: remove the warnings on the prohibited spaces This patch removes the warnings reported by checkpatch.pl regarding prohibited spaces between function name and open parenthesis. Signed-off-by: Sunghoon Cho Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index d413fa3861c0..22d7b85f43c3 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -80,9 +80,9 @@ struct WILC_WFI_stats { * LPC3131 which is important to get the MAC start status when you are blocked inside * linux_wlan_firmware_download() which blocks mac_open(). */ -#if defined (NM73131_0_BOARD) +#if defined(NM73131_0_BOARD) #define RX_BH_TYPE RX_BH_KTHREAD -#elif defined (PANDA_BOARD) +#elif defined(PANDA_BOARD) #define RX_BH_TYPE RX_BH_THREADED_IRQ #else #define RX_BH_TYPE RX_BH_KTHREAD From 36901b690d5d83e0330a33bd6c1771c21c46c450 Mon Sep 17 00:00:00 2001 From: Sunghoon Cho Date: Fri, 26 Jun 2015 15:48:15 +0900 Subject: [PATCH 062/912] staging: wilc1000: add a blank line after struct declaration This patch adds a blank line right after a struct declaration. Signed-off-by: Sunghoon Cho Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 22d7b85f43c3..8102ef0bb70e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -95,6 +95,7 @@ struct wilc_wfi_key { int seq_len; u32 cipher; }; + struct wilc_wfi_wep_key { u8 *key; u8 key_len; From 70e59d92256221640b8122ef258e886b1b1aa33d Mon Sep 17 00:00:00 2001 From: Sunghoon Cho Date: Fri, 26 Jun 2015 15:48:16 +0900 Subject: [PATCH 063/912] staging: wilc1000: remove the warnings on the line over 80 characters This patch removes the warnings reported by checkpatch.pl on the line over 80 characters. Signed-off-by: Sunghoon Cho Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 8102ef0bb70e..0dfe108e7cf8 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -77,8 +77,8 @@ struct WILC_WFI_stats { #define num_reg_frame 2 /* * If you use RX_BH_WORK_QUEUE on LPC3131: You may lose the first interrupt on - * LPC3131 which is important to get the MAC start status when you are blocked inside - * linux_wlan_firmware_download() which blocks mac_open(). + * LPC3131 which is important to get the MAC start status when you are blocked + * inside linux_wlan_firmware_download() which blocks mac_open(). */ #if defined(NM73131_0_BOARD) #define RX_BH_TYPE RX_BH_KTHREAD @@ -151,7 +151,8 @@ struct WILC_WFI_priv { u8 WILC_WFI_wep_default; u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104]; u8 WILC_WFI_wep_key_len[4]; - struct net_device *real_ndev; /* The real interface that the monitor is on */ + /* The real interface that the monitor is on */ + struct net_device *real_ndev; struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA]; struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA]; u8 wilc_groupkey; From 2b9d5b483784c588b1ecb658cac83cd8100a74aa Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 26 Jun 2015 16:44:24 +0200 Subject: [PATCH 064/912] staging: wilc1000: remove unnecessary braces Removing all checkpatch.pl warnings: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 276 ++++++++-------------- 1 file changed, 92 insertions(+), 184 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d1fe73df807d..bf183b2f39f4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -659,9 +659,8 @@ static s32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSetDrvHand s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - if ((pstrHostIfSetDrvHandler->u32Address) == (u32)NULL) { + if ((pstrHostIfSetDrvHandler->u32Address) == (u32)NULL) up(&hSemDeinitDrvHandle); - } if (s32Error) { @@ -705,9 +704,8 @@ static s32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperationMode s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - if ((pstrHostIfSetOperationMode->u32Mode) == (u32)NULL) { + if ((pstrHostIfSetOperationMode->u32Mode) == (u32)NULL) up(&hSemDeinitDrvHandle); - } if (s32Error) { @@ -1204,10 +1202,9 @@ static s32 Handle_CfgParam(void *drvHandler, tstrHostIFCfgParamAttr *strHostIFCf } s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, (u32)pstrWFIDrv); - if (s32Error) { + if (s32Error) PRINT_ER("Error in setting CFG params\n"); - } WILC_CATCH(s32Error) { } @@ -1284,9 +1281,8 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; strWIDList[u32WidsCount].enuWIDtype = WID_STR; - for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { + for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); - } pu8HdnNtwrksWidVal = WILC_MALLOC(valuesize + 1); strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; if (strWIDList[u32WidsCount].ps8WidVal != NULL) { @@ -1336,9 +1332,8 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) int i; for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { - if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) { + if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; - } } } @@ -1400,9 +1395,8 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) pstrHostIFscanAttr->pu8ChnlFreqList = NULL; } - if (pu8HdnNtwrksWidVal != NULL) { + if (pu8HdnNtwrksWidVal != NULL) WILC_FREE(pu8HdnNtwrksWidVal); - } return s32Error; } @@ -1778,9 +1772,8 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7; strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize); - if (strWIDList[u32WidsCount].ps8WidVal == NULL) { + if (strWIDList[u32WidsCount].ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; @@ -1795,9 +1788,8 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_ER("Channel out of range\n"); *(pu8CurrByte++) = 0xFF; } - if (pstrHostIFconnectAttr->pu8bssid != NULL) { + if (pstrHostIFconnectAttr->pu8bssid != NULL) WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); - } pu8CurrByte += 6; /* keep the buffer at the start of the allocated pointer to use it with the free*/ @@ -1817,9 +1809,8 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; gu8FlushedJoinReq = WILC_MALLOC(gu32FlushedJoinReqSize); } - if (strWIDList[u32WidsCount].ps8WidVal == NULL) { + if (strWIDList[u32WidsCount].ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; @@ -1845,15 +1836,13 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); /* sa*/ - if (pstrHostIFconnectAttr->pu8bssid != NULL) { + if (pstrHostIFconnectAttr->pu8bssid != NULL) WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); - } pu8CurrByte += 6; /* bssid*/ - if (pstrHostIFconnectAttr->pu8bssid != NULL) { + if (pstrHostIFconnectAttr->pu8bssid != NULL) WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); - } pu8CurrByte += 6; /* Beacon Period*/ @@ -1990,9 +1979,8 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon WILC_memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); if (pstrHostIFconnectAttr->pfConnectResult != NULL) { - if (pstrHostIFconnectAttr->pu8bssid != NULL) { + if (pstrHostIFconnectAttr->pu8bssid != NULL) WILC_memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); - } if (pstrHostIFconnectAttr->pu8IEs != NULL) { strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; @@ -2039,9 +2027,8 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon pstrHostIFconnectAttr->pu8IEs = NULL; } - if (pu8CurrByte != NULL) { + if (pu8CurrByte != NULL) WILC_FREE(pu8CurrByte); - } return s32Error; } @@ -2186,9 +2173,8 @@ static s32 Handle_ConnectTimeout(void *drvHandler) PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv); - if (s32Error) { + if (s32Error) PRINT_ER("Failed to send dissconect config packet\n"); - } /* Deallocation of the Saved Connect Request in the global Handle */ pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; @@ -2371,9 +2357,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst tstrDisconnectNotifInfo strDisconnectNotifInfo; s32 s32Err = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) PRINT_ER("Driver handler is NULL\n"); - } PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); @@ -2654,10 +2639,9 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >> \n\n"); /*Abort the running scan*/ WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); - if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { + if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); - } } } @@ -3463,9 +3447,8 @@ static void Handle_AddBeacon(void *drvHandler, tstrHostIFSetBeacon *pstrSetBeaco strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); @@ -3534,9 +3517,8 @@ static void Handle_DelBeacon(void *drvHandler, tstrHostIFDelBeacon *pstrDelBeaco strWID.s32ValueSize = sizeof(char); strWID.ps8WidVal = &gu8DelBcn; - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; @@ -3580,9 +3562,8 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->u8NumRates; - if (pstrStationParam->u8NumRates > 0) { + if (pstrStationParam->u8NumRates > 0) WILC_memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); - } pu8CurrByte += pstrStationParam->u8NumRates; *pu8CurrByte++ = pstrStationParam->bIsHTSupported; @@ -3633,9 +3614,8 @@ static void Handle_AddStation(void *drvHandler, tstrWILC_AddStaParam *pstrStatio strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); @@ -3679,9 +3659,8 @@ static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllSt PRINT_D(HOSTINF_DBG, "Handling delete station \n"); strWID.ps8WidVal = WILC_MALLOC((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; @@ -3736,9 +3715,8 @@ static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaPara PRINT_D(HOSTINF_DBG, "Handling delete station \n"); strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; @@ -3781,9 +3759,8 @@ static void Handle_EditStation(void *drvHandler, tstrWILC_AddStaParam *pstrStati PRINT_D(HOSTINF_DBG, "Handling edit station\n"); strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); @@ -3858,18 +3835,16 @@ static int Handle_RemainOnChan(void *drvHandler, tstrHostIfRemainOnChan *pstrHos strWID.s32ValueSize = 2; strWID.ps8WidVal = (s8 *)WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } strWID.ps8WidVal[0] = u8remain_on_chan_flag; strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; /*Sending Cfg*/ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - if (s32Error != WILC_SUCCESS) { + if (s32Error != WILC_SUCCESS) PRINT_ER("Failed to set remain on channel\n"); - } WILC_CATCH(-1) { @@ -3877,9 +3852,8 @@ static int Handle_RemainOnChan(void *drvHandler, tstrHostIfRemainOnChan *pstrHos WILC_TimerStart(&(pstrWFIDrv->hRemainOnChannel), pstrHostIfRemainOnChan->u32duration, (void *)pstrWFIDrv, NULL); /*Calling CFG ready_on_channel*/ - if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) { + if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); - } if (pstrWFIDrv->u8RemainOnChan_pendingreq) pstrWFIDrv->u8RemainOnChan_pendingreq = 0; @@ -3909,9 +3883,8 @@ static int Handle_RegisterFrame(void *drvHandler, tstrHostIfRegisterFrame *pstrH strWID.u16WIDid = (u16)WID_REGISTER_FRAME; strWID.enuWIDtype = WID_STR; strWID.ps8WidVal = WILC_MALLOC(sizeof(u16) + 2); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; @@ -3968,9 +3941,8 @@ static u32 Handle_ListenStateExpired(void *drvHandler, tstrHostIfRemainOnChan *p strWID.s32ValueSize = 2; strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) PRINT_ER("Failed to allocate memory\n"); - } strWID.ps8WidVal[0] = u8remain_on_chan_flag; strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; @@ -4022,9 +3994,8 @@ static void ListenTimerCB(void *pvArg) /* send the message */ s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -4095,9 +4066,8 @@ static void Handle_SetMulticastFilter(void *drvHandler, tstrHostIFSetMulti *strH strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = sizeof(tstrHostIFSetMulti) + ((strHostIfSetMulti->u32count) * ETH_ALEN); strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); @@ -4430,9 +4400,8 @@ static int hostIFthread(void *pvArg) /*BugID_5213*/ /*Allow chip sleep, only if both interfaces are not connected*/ - if (!linux_wlan_get_num_conn_ifcs()) { + if (!linux_wlan_get_num_conn_ifcs()) chip_sleep_manually(INFINITE_SLEEP_TIME); - } Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_DONE); @@ -4649,9 +4618,8 @@ s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8keyIdx) tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Remove Wep Key Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -4699,9 +4667,8 @@ s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index) tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -4756,10 +4723,9 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -4823,10 +4789,9 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, tstrHostIFmsg strHostIFmsg; u8 i; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -4899,15 +4864,12 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen tstrHostIFmsg strHostIFmsg; u8 u8KeyLen = u8PtkKeylen; u32 i; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - if (pu8RxMic != NULL) { + if (pu8RxMic != NULL) u8KeyLen += RX_MIC_KEY_LEN; - } - if (pu8TxMic != NULL) { + if (pu8TxMic != NULL) u8KeyLen += TX_MIC_KEY_LEN; - } /* prepare the Key Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -5002,19 +4964,16 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK tstrHostIFmsg strHostIFmsg; u8 u8KeyLen = u8GtkKeylen; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); - if (pu8RxMic != NULL) { + if (pu8RxMic != NULL) u8KeyLen += RX_MIC_KEY_LEN; - } - if (pu8TxMic != NULL) { + if (pu8TxMic != NULL) u8KeyLen += TX_MIC_KEY_LEN; - } if (KeyRSC != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = (u8 *)WILC_MALLOC(u32KeyRSClen); @@ -5111,9 +5070,8 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P u32 i; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -5464,9 +5422,8 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, tstrHostIFmsg strHostIFmsg; tenuScanConnTimer enuScanConnTimer; - if (pstrWFIDrv == NULL || pfConnectResult == NULL) { + if (pstrWFIDrv == NULL || pfConnectResult == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } if (hWFIDrv == NULL) { PRINT_ER("Driver not initialized: gWFiDrvHandle = NULL\n"); @@ -5564,9 +5521,8 @@ s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv) } - if (hWFIDrv == NULL) { + if (hWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } strHostIFmsg.u16MsgId = HOST_IF_MSG_FLUSH_CONNECT; @@ -5800,9 +5756,8 @@ s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum) tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the set channel message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -5811,9 +5766,8 @@ s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum) strHostIFmsg.drvHandler = hWFIDrv; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -5834,9 +5788,8 @@ s32 host_int_wait_msg_queue_idle(void) WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_Q_IDLE; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -5864,9 +5817,8 @@ s32 host_int_set_wfi_drv_handler(u32 u32address) /* strHostIFmsg.drvHandler=hWFIDrv; */ s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -5892,9 +5844,8 @@ s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode) strHostIFmsg.drvHandler = hWFIDrv; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -6229,9 +6180,8 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, tstrHostIFmsg strHostIFmsg; tenuScanConnTimer enuScanConnTimer; - if (pstrWFIDrv == NULL || ScanResult == NULL) { + if (pstrWFIDrv == NULL || ScanResult == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Scan Message */ @@ -6301,9 +6251,8 @@ s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the WiphyParams Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_CFG_PARAMS; @@ -6794,9 +6743,8 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error != WILC_SUCCESS) { + if (s32Error != WILC_SUCCESS) PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error); - } down(&hSemHostIFthrdEnd); @@ -6866,9 +6814,8 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) /* send the message */ s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error); - } return; @@ -6930,9 +6877,8 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) /* send the message */ s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error); - } /*BugID_5348*/ up(&hSemHostIntDeinit); @@ -6960,9 +6906,8 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); - if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { + if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) return; - } /*if there is an ongoing scan request*/ if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { @@ -6983,9 +6928,8 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) /* send the message */ s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error); - } } @@ -7014,9 +6958,8 @@ s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the remainonchan Message */ WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7032,9 +6975,8 @@ s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 strHostIFmsg.drvHandler = hWFIDrv; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7063,9 +7005,8 @@ s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID) tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /*Stopping remain-on-channel timer*/ WILC_TimerStop(&(pstrWFIDrv->hRemainOnChannel), NULL); @@ -7077,9 +7018,8 @@ s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID) strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7101,9 +7041,8 @@ s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bR tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7129,9 +7068,8 @@ s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bR strHostIFmsg.drvHandler = hWFIDrv; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7165,9 +7103,8 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, tstrHostIFmsg strHostIFmsg; tstrHostIFSetBeacon *pstrSetBeaconParam = &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7181,37 +7118,32 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; pstrSetBeaconParam->u32HeadLen = u32HeadLen; pstrSetBeaconParam->pu8Head = (u8 *)WILC_MALLOC(u32HeadLen); - if (pstrSetBeaconParam->pu8Head == NULL) { + if (pstrSetBeaconParam->pu8Head == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } WILC_memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); pstrSetBeaconParam->u32TailLen = u32TailLen; /* Bug 4599 : if tail length = 0 skip allocating & copying */ if (u32TailLen > 0) { pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); - if (pstrSetBeaconParam->pu8Tail == NULL) { + if (pstrSetBeaconParam->pu8Tail == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } WILC_memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); } else { pstrSetBeaconParam->pu8Tail = NULL; } s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { - if (pstrSetBeaconParam->pu8Head != NULL) { + if (pstrSetBeaconParam->pu8Head != NULL) WILC_FREE(pstrSetBeaconParam->pu8Head); - } - if (pstrSetBeaconParam->pu8Tail != NULL) { + if (pstrSetBeaconParam->pu8Tail != NULL) WILC_FREE(pstrSetBeaconParam->pu8Tail); - } } return s32Error; @@ -7234,9 +7166,8 @@ s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv) tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BEACON; @@ -7270,9 +7201,8 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7294,9 +7224,8 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7320,9 +7249,8 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) tstrHostIFmsg strHostIFmsg; tstrHostIFDelSta *pstrDelStationMsg = &strHostIFmsg.uniHostIFmsgBody.strDelStaParam; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7341,9 +7269,8 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) WILC_memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7370,9 +7297,8 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] u8 u8AssocNumb = 0; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7400,10 +7326,9 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7430,9 +7355,8 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS tstrHostIFmsg strHostIFmsg; tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); @@ -7452,9 +7376,8 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS } s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { } @@ -7472,9 +7395,8 @@ s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32T PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d << \n\n", bIsEnabled); - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); @@ -7490,9 +7412,8 @@ s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32T s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { } @@ -7508,9 +7429,8 @@ s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, tstrHostIFSetMulti *pstrMulticastFilterParam = &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); @@ -7525,9 +7445,8 @@ s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, pstrMulticastFilterParam->u32count = u32count; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { } @@ -7633,9 +7552,8 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pNewJoinBssParam->wmm_cap = true; /* Check if Bit 7 is set indicating U-APSD capability */ - if (pu8IEs[index + 8] & (1 << 7)) { + if (pu8IEs[index + 8] & (1 << 7)) pNewJoinBssParam->uapsd_cap = true; - } index += pu8IEs[index + 1] + 2; continue; } @@ -7779,9 +7697,8 @@ static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char T tstrHostIFmsg strHostIFmsg; tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7795,9 +7712,8 @@ static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char T strHostIFmsg.drvHandler = hWFIDrv; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7814,9 +7730,8 @@ s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) tstrHostIFmsg strHostIFmsg; tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7828,9 +7743,8 @@ s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) strHostIFmsg.drvHandler = hWFIDrv; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7849,9 +7763,8 @@ s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char tstrHostIFmsg strHostIFmsg; tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7863,9 +7776,8 @@ s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char strHostIFmsg.drvHandler = hWFIDrv; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7894,9 +7806,8 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) /* TODO: Enable This feature on softap firmware */ return 0; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7908,9 +7819,8 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7935,9 +7845,8 @@ s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -7949,9 +7858,8 @@ s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { From 78c87591d4d50e0cb3e670a909e63db92409c4c5 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 26 Jun 2015 16:45:14 +0200 Subject: [PATCH 065/912] staging: wilc1000: add blank lines after declarations Fix all checkpatch.pl warnings: WARNING: Missing a blank line after declarations Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index bf183b2f39f4..e13074fb5c22 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -841,6 +841,7 @@ static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrH tstrWID strWID; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; u8 *mac_buf = (u8 *)WILC_MALLOC(ETH_ALEN); + if (mac_buf == NULL) { PRINT_ER("No buffer to send mac address\n"); return WILC_FAIL; @@ -1225,6 +1226,7 @@ static s32 Handle_CfgParam(void *drvHandler, tstrHostIFCfgParamAttr *strHostIFCf static s32 Handle_wait_msg_q_empty(void) { s32 s32Error = WILC_SUCCESS; + g_wilc_initialized = 0; up(&hWaitResponse); return s32Error; @@ -2357,6 +2359,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst tstrDisconnectNotifInfo strDisconnectNotifInfo; s32 s32Err = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; + if (pstrWFIDrv == NULL) PRINT_ER("Driver handler is NULL\n"); PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, @@ -3208,6 +3211,7 @@ static s32 Handle_GetChnl(void *drvHandler) tstrWID strWID; /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; strWID.enuWIDtype = WID_CHAR; strWID.ps8WidVal = (s8 *)&gu8Chnl; @@ -3441,6 +3445,7 @@ static void Handle_AddBeacon(void *drvHandler, tstrHostIFSetBeacon *pstrSetBeaco tstrWID strWID; u8 *pu8CurrByte; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); strWID.u16WIDid = (u16)WID_ADD_BEACON; @@ -3512,6 +3517,7 @@ static void Handle_DelBeacon(void *drvHandler, tstrHostIFDelBeacon *pstrDelBeaco tstrWID strWID; u8 *pu8CurrByte; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + strWID.u16WIDid = (u16)WID_DEL_BEACON; strWID.enuWIDtype = WID_CHAR; strWID.s32ValueSize = sizeof(char); @@ -3608,6 +3614,7 @@ static void Handle_AddStation(void *drvHandler, tstrWILC_AddStaParam *pstrStatio tstrWID strWID; u8 *pu8CurrByte; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + PRINT_D(HOSTINF_DBG, "Handling add station\n"); strWID.u16WIDid = (u16)WID_ADD_STA; strWID.enuWIDtype = WID_BIN; @@ -3647,11 +3654,13 @@ static void Handle_AddStation(void *drvHandler, tstrWILC_AddStaParam *pstrStatio static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) { s32 s32Error = WILC_SUCCESS; + tstrWID strWID; u8 *pu8CurrByte; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; u8 i; u8 au8Zero_Buff[6] = {0}; + strWID.u16WIDid = (u16)WID_DEL_ALL_STA; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; @@ -4019,6 +4028,7 @@ static void Handle_PowerManagement(void *drvHandler, tstrHostIfPowerMgmtParam *s tstrWID strWID; s8 s8PowerMode; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; if (strPowerMgmtParam->bIsEnabled == true) { @@ -4864,6 +4874,7 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen tstrHostIFmsg strHostIFmsg; u8 u8KeyLen = u8PtkKeylen; u32 i; + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); if (pu8RxMic != NULL) @@ -6421,6 +6432,7 @@ void host_int_send_join_leave_info_to_host void GetPeriodicRSSI(void *pvArg) { tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)pvArg; + if (pstrWFIDrv == NULL) { PRINT_ER("Driver handler is NULL\n"); return; @@ -6900,6 +6912,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) tstrHostIFmsg strHostIFmsg; u32 drvHandler; tstrWILC_WFIDrv *pstrWFIDrv = NULL; + drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; @@ -7216,6 +7229,7 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); + WILC_NULLCHECK(s32Error, rates); WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); @@ -7370,6 +7384,7 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); + WILC_NULLCHECK(s32Error, rates); WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); pstrAddStationMsg->pu8Rates = rates; @@ -7563,6 +7578,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) (pu8IEs[index + 4] == 0x9a) && /* OUI */ (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ u16 u16P2P_count; + pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; pNewJoinBssParam->u8NoaEnbaled = 1; pNewJoinBssParam->u8Index = pu8IEs[index + 9]; From 03b2d5e75088564c35297bd6192d1a5b504e7298 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 26 Jun 2015 16:45:58 +0200 Subject: [PATCH 066/912] staging: wilc1000: remove whitespaces before quoted newlines Fix all checkpatch.pl warnings: WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 84 +++++++++++------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index e13074fb5c22..79b7c2ab03b2 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -699,7 +699,7 @@ static s32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperationMode strWID.s32ValueSize = sizeof(u32); /*Sending Cfg*/ - PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p \n", pstrWFIDrv); + PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv); s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); @@ -740,7 +740,7 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) if (pu8IPAddr[0] < 192) pu8IPAddr[0] = 0; - PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %d.%d.%d.%d \n", idx, pu8IPAddr[0], pu8IPAddr[1], pu8IPAddr[2], pu8IPAddr[3]); + PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %d.%d.%d.%d\n", idx, pu8IPAddr[0], pu8IPAddr[1], pu8IPAddr[2], pu8IPAddr[3]); WILC_memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); @@ -810,7 +810,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) PRINT_ER("Failed to get IP address\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); } else { - PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d \n", idx); + PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); PRINT_INFO(HOSTINF_DBG, "%d.%d.%d.%d\n", gs8GetIP[idx][0], gs8GetIP[idx][1], gs8GetIP[idx][2], gs8GetIP[idx][3]); PRINT_INFO(HOSTINF_DBG, "\n"); } @@ -1253,7 +1253,7 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); - PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state \n", pstrWFIDrv->enuHostIFstate); + PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; @@ -1524,7 +1524,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon DeallocateSurveyResults(pstrSurveyResults); } else { WILC_ERRORREPORT(s32Error, WILC_FAIL); - PRINT_ER("ParseSurveyResults() Error(%d) \n", s32Err); + PRINT_ER("ParseSurveyResults() Error(%d)\n", s32Err); } @@ -1555,7 +1555,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon if (i < pstrWFIDrv->u32SurveyResultsCount) { u8bssDscListIndex = i; - PRINT_INFO(HOSTINF_DBG, "Connecting to network of Bss Idx %d and SSID %s and channel %d \n", + PRINT_INFO(HOSTINF_DBG, "Connecting to network of Bss Idx%d and SSID %s and channel%d\n", u8bssDscListIndex, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].SSID, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].Channel); @@ -2006,7 +2006,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon } } else { - PRINT_ER("Connect callback function pointer is NULL \n"); + PRINT_ER("Connect callback function pointer is NULL\n"); } } @@ -2162,7 +2162,7 @@ static s32 Handle_ConnectTimeout(void *drvHandler) strConnectInfo.pu8ReqIEs = NULL; } } else { - PRINT_ER("Connect callback function pointer is NULL \n"); + PRINT_ER("Connect callback function pointer is NULL\n"); } /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying @@ -2301,7 +2301,7 @@ static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdN } } else { - PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit \n"); + PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); } } else { pstrNetworkInfo->bNewNetwork = false; @@ -2423,7 +2423,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, &pstrConnectRespInfo); if (s32Err) { - PRINT_ER("ParseAssocRespInfo() returned error %d \n", s32Err); + PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); } else { /* use the necessary parsed Info from the Received Association Response */ strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; @@ -2454,7 +2454,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst * So check first the matching between the received mac status and the received status code in Asoc Resp */ if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { - PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE \n"); + PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); } else if (u8MacStatus == MAC_DISCONNECTED) { @@ -2563,7 +2563,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst WILC_memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { - PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >> \n\n"); + PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); } @@ -2586,7 +2586,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); } else { - PRINT_ER("Connect result callback function is NULL \n"); + PRINT_ER("Connect result callback function is NULL\n"); } WILC_memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); @@ -2639,7 +2639,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst } else if ((u8MacStatus == MAC_DISCONNECTED) && (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n"); - PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >> \n\n"); + PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); /*Abort the running scan*/ WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) @@ -2859,7 +2859,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { WILC_memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); } else { - PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED \n"); + PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n"); } WILC_memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); @@ -3095,7 +3095,7 @@ static void Handle_Disconnect(void *drvHandler) pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); } else { - PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL \n"); + PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); } gbScanWhileConnected = false; @@ -3181,7 +3181,7 @@ static s32 Switch_Log_Terminal(void *drvHandler) PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); } else { - PRINT_INFO(HOSTINF_DBG, "MAC address set :: \n"); + PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n"); } @@ -3665,7 +3665,7 @@ static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllSt strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; - PRINT_D(HOSTINF_DBG, "Handling delete station \n"); + PRINT_D(HOSTINF_DBG, "Handling delete station\n"); strWID.ps8WidVal = WILC_MALLOC((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1); if (strWID.ps8WidVal == NULL) @@ -3721,7 +3721,7 @@ static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaPara strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = ETH_ALEN; - PRINT_D(HOSTINF_DBG, "Handling delete station \n"); + PRINT_D(HOSTINF_DBG, "Handling delete station\n"); strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); if (strWID.ps8WidVal == NULL) @@ -4126,7 +4126,7 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos char *ptr = NULL; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d \nBufferSize == %d \nSessionTimeOut = %d\n", + PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", strHostIfBASessionInfo->au8Bssid[0], strHostIfBASessionInfo->au8Bssid[1], strHostIfBASessionInfo->au8Bssid[2], @@ -4213,7 +4213,7 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos char *ptr = NULL; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d\n", + PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", strHostIfBASessionInfo->au8Bssid[0], strHostIfBASessionInfo->au8Bssid[1], strHostIfBASessionInfo->au8Bssid[2], @@ -4283,7 +4283,7 @@ static s32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessionInfo * char *ptr = NULL; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d\n", + PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", strHostIfBASessionInfo->au8Bssid[0], strHostIfBASessionInfo->au8Bssid[1], strHostIfBASessionInfo->au8Bssid[2], @@ -4471,7 +4471,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_CONNECT_TIMER_FIRED: - PRINT_D(HOSTINF_DBG, "Connect Timeout \n"); + PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); Handle_ConnectTimeout(strHostIFmsg.drvHandler); break; @@ -4542,7 +4542,7 @@ static int hostIFthread(void *pvArg) break; default: - PRINT_ER("[Host Interface] undefined Received Msg ID \n"); + PRINT_ER("[Host Interface] undefined Received Msg ID\n"); break; } } @@ -4648,7 +4648,7 @@ s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8keyIdx) /* send the message */ s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); if (s32Error) - PRINT_ER("Error in sending message queue : Request to remove WEP key \n"); + PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); down(&(pstrWFIDrv->hSemTestKeyBlock)); WILC_CATCH(s32Error) @@ -5571,7 +5571,7 @@ s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode) tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -5688,7 +5688,7 @@ s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -5887,7 +5887,7 @@ s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo) tstrHostIFmsg strHostIFmsg; if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -5934,7 +5934,7 @@ s32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr) if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -5980,7 +5980,7 @@ s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu tstrHostIFmsg strHostIFmsg; if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -6028,7 +6028,7 @@ s32 host_int_test_get_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 *pu32TestMemAddr) if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -6302,7 +6302,7 @@ s32 hif_get_cfg(WILC_WFIDrvHandle hWFIDrv, u16 u16WID, u16 *pu16WID_Value) down(&(pstrWFIDrv->gtOsCfgValuesSem)); if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); @@ -6699,18 +6699,18 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ /*to guarantee handling all messages befor proceeding*/ if (WILC_TimerDestroy(&(pstrWFIDrv->hScanTimer), NULL)) { - PRINT_D(HOSTINF_DBG, ">> Scan timer is active \n"); + PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ } if (WILC_TimerDestroy(&(pstrWFIDrv->hConnectTimer), NULL)) { - PRINT_D(HOSTINF_DBG, ">> Connect timer is active \n"); + PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } if (WILC_TimerDestroy(&(g_hPeriodicRSSI), NULL)) { - PRINT_D(HOSTINF_DBG, ">> Connect timer is active \n"); + PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } @@ -6747,7 +6747,7 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) if (clients_count == 1) { if (WILC_TimerDestroy(&g_hPeriodicRSSI, NULL)) { - PRINT_D(HOSTINF_DBG, ">> Connect timer is active \n"); + PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } strHostIFmsg.u16MsgId = HOST_IF_MSG_EXIT; @@ -6856,7 +6856,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(HOSTINF_DBG, "General asynchronous info packet received \n"); + PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { @@ -7408,7 +7408,7 @@ s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32T tstrHostIFmsg strHostIFmsg; tstrHostIfPowerMgmtParam *pstrPowerMgmtParam = &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam; - PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d << \n\n", bIsEnabled); + PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled); if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); @@ -7590,9 +7590,9 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) } else pNewJoinBssParam->u8OppEnable = 0; /* HOSTINF_DBG */ - PRINT_D(GENERIC_DBG, "P2P Dump \n"); + PRINT_D(GENERIC_DBG, "P2P Dump\n"); for (i = 0; i < pu8IEs[index + 7]; i++) - PRINT_D(GENERIC_DBG, " %x \n", pu8IEs[index + 9 + i]); + PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); pNewJoinBssParam->u8Count = pu8IEs[index + 11]; u16P2P_count = index + 12; @@ -7632,7 +7632,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; rsnIndex++; - /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x \n",pNewJoinBssParam->rsn_grp_policy); */ + /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ /* initialize policies with invalid values */ jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ @@ -7643,7 +7643,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; rsnIndex += 2; /* jump 2 bytes of pcipher count */ - /* PRINT_D(HOSTINF_DBG,"\npcipher:%d \n",pcipherCount); */ + /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { /* each count corresponds to 4 bytes, only last byte is saved */ pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; From 83cc9be5ebef180efb7df74c0518149a749e7c42 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 26 Jun 2015 16:47:28 +0200 Subject: [PATCH 067/912] staging: wilc1000: fix typos in PRINT_ERR() Fix typo "packe" to "packet". Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 79b7c2ab03b2..1915fc6b5176 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3688,7 +3688,7 @@ static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllSt s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); if (s32Error) { - PRINT_ER("Failed to send add station config packe\n"); + PRINT_ER("Failed to send add station config packet\n"); WILC_ERRORREPORT(s32Error, WILC_FAIL); } @@ -3735,7 +3735,7 @@ static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaPara s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv); if (s32Error) { - PRINT_ER("Failed to send add station config packe\n"); + PRINT_ER("Failed to send add station config packet\n"); WILC_ERRORREPORT(s32Error, WILC_FAIL); } From b3a02832e47629c08b27589688c788d6af87e738 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 26 Jun 2015 17:40:25 +0200 Subject: [PATCH 068/912] staging: wilc1000: switch printks to vsprintf IPv4 extension Switch printks with IP addresses to use vsprintf extension %pI4. Suggested-by: Joe Perches Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 1915fc6b5176..483926f28436 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -740,7 +740,7 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) if (pu8IPAddr[0] < 192) pu8IPAddr[0] = 0; - PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %d.%d.%d.%d\n", idx, pu8IPAddr[0], pu8IPAddr[1], pu8IPAddr[2], pu8IPAddr[3]); + PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr); WILC_memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); @@ -796,7 +796,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - PRINT_INFO(HOSTINF_DBG, "%d.%d.%d.%d\n", (u8)(strWID.ps8WidVal[0]), (u8)(strWID.ps8WidVal[1]), (u8)(strWID.ps8WidVal[2]), (u8)(strWID.ps8WidVal[3])); + PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); WILC_memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); @@ -811,7 +811,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); } else { PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); - PRINT_INFO(HOSTINF_DBG, "%d.%d.%d.%d\n", gs8GetIP[idx][0], gs8GetIP[idx][1], gs8GetIP[idx][2], gs8GetIP[idx][3]); + PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); PRINT_INFO(HOSTINF_DBG, "\n"); } From 137b9938849901f8e402da15736125b0a0bd2477 Mon Sep 17 00:00:00 2001 From: Prasanna Karthik Date: Mon, 29 Jun 2015 12:43:32 +0000 Subject: [PATCH 069/912] staging:wilc1000: code cleanup Fix reported by coccinelle Removed {} for single statement if block Signed-off-by: Prasanna Karthik Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/fifo_buffer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/fifo_buffer.c b/drivers/staging/wilc1000/fifo_buffer.c index b6c07cfc43d2..86eb82e36be0 100644 --- a/drivers/staging/wilc1000/fifo_buffer.c +++ b/drivers/staging/wilc1000/fifo_buffer.c @@ -31,11 +31,10 @@ u32 FIFO_DeInit(tHANDLE hFifo) u32 u32Error = 0; tstrFifoHandler *pstrFifoHandler = (tstrFifoHandler *) hFifo; if (pstrFifoHandler) { - if (pstrFifoHandler->pu8Buffer) { + if (pstrFifoHandler->pu8Buffer) WILC_FREE (pstrFifoHandler->pu8Buffer); - } else { + else u32Error = 1; - } WILC_FREE (pstrFifoHandler); } else { @@ -52,11 +51,11 @@ u32 FIFO_ReadBytes(tHANDLE hFifo, u8 *pu8Buffer, u32 u32BytesToRead, u32 *pu32By if (pstrFifoHandler->u32TotalBytes) { down(&pstrFifoHandler->SemBuffer); - if (u32BytesToRead > pstrFifoHandler->u32TotalBytes) { + if (u32BytesToRead > pstrFifoHandler->u32TotalBytes) *pu32BytesRead = pstrFifoHandler->u32TotalBytes; - } else { + else *pu32BytesRead = u32BytesToRead; - } + if ((pstrFifoHandler->u32ReadOffset + u32BytesToRead) <= pstrFifoHandler->u32BufferLength) { WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset, *pu32BytesRead); From 6fdb302c1d996d2e0c1c527aa6f54a04ee80a0d8 Mon Sep 17 00:00:00 2001 From: Daniel Machon Date: Mon, 6 Jul 2015 19:48:04 +0200 Subject: [PATCH 070/912] wilc1000: host_interface.c: global variables do not need to be explicitly initialized to 0 or NULL. Fixed explicit initialization of global pointer variable. GCC takes care of this implicitly. Signed-off-by: Daniel Machon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 483926f28436..c089e739465a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -534,8 +534,8 @@ typedef enum { /*****************************************************************************/ -tstrWILC_WFIDrv *terminated_handle = NULL; -tstrWILC_WFIDrv *gWFiDrvHandle = NULL; +tstrWILC_WFIDrv *terminated_handle; +tstrWILC_WFIDrv *gWFiDrvHandle; #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP bool g_obtainingIP = false; #endif From e23fd9812fe729612e778ba9bd9530ce5c234f23 Mon Sep 17 00:00:00 2001 From: Ana Calinov Date: Wed, 8 Jul 2015 05:44:42 -0700 Subject: [PATCH 071/912] iio: accel: kxcjk-1013: Remove blank lines This patch fixes the the following errors given by checkpatch.pl with --strict: Please don't use multiple blank lines. Blank lines aren't necessary after an open brace '{'. Signed-off-by: Ana Calinov Reviewed-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/accel/kxcjk-1013.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 0d9bd35ff258..8128579bff79 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -658,10 +658,8 @@ static int kxcjk1013_set_scale(struct kxcjk1013_data *data, int val) int ret, i; enum kxcjk1013_mode store_mode; - for (i = 0; i < ARRAY_SIZE(KXCJK1013_scale_table); ++i) { if (KXCJK1013_scale_table[i].scale == val) { - ret = kxcjk1013_get_mode(data, &store_mode); if (ret < 0) return ret; @@ -820,7 +818,6 @@ static int kxcjk1013_read_event_config(struct iio_dev *indio_dev, enum iio_event_type type, enum iio_event_direction dir) { - struct kxcjk1013_data *data = iio_priv(indio_dev); return data->ev_enable_state; From 1ce96bd366b87d3896a450b3ac26a8a0916573b4 Mon Sep 17 00:00:00 2001 From: Ana Calinov Date: Wed, 8 Jul 2015 07:04:31 -0700 Subject: [PATCH 072/912] iio: frequency: adf4350: Delete blank line This patch removes an unnecessary blank line found by checkpatch.pl --strict: Blank lines aren't necessary after an open brace '{'. Signed-off-by: Ana Calinov Signed-off-by: Jonathan Cameron --- drivers/iio/frequency/adf4350.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c index 10a0dfc3b01f..9890c81c027d 100644 --- a/drivers/iio/frequency/adf4350.c +++ b/drivers/iio/frequency/adf4350.c @@ -72,7 +72,6 @@ static int adf4350_sync_config(struct adf4350_state *st) for (i = ADF4350_REG5; i >= ADF4350_REG0; i--) { if ((st->regs_hw[i] != st->regs[i]) || ((i == ADF4350_REG0) && doublebuf)) { - switch (i) { case ADF4350_REG1: case ADF4350_REG4: From 862cb6ce58029c478aca573ee7bff0081249a6d3 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 10 Jul 2015 17:10:21 +0300 Subject: [PATCH 073/912] Staging: iio: dummy: Fix blank line warnings Multiple blank lines should not be used as indicated by checkpatch.pl. Also, a line should be used after a function/structure declaration. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- drivers/staging/iio/iio_dummy_evgen.c | 1 + drivers/staging/iio/iio_simple_dummy.c | 2 -- drivers/staging/iio/iio_simple_dummy.h | 1 + drivers/staging/iio/iio_simple_dummy_buffer.c | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/iio_dummy_evgen.c b/drivers/staging/iio/iio_dummy_evgen.c index c54d5b5443a6..6d38854c38c8 100644 --- a/drivers/staging/iio/iio_dummy_evgen.c +++ b/drivers/staging/iio/iio_dummy_evgen.c @@ -214,6 +214,7 @@ static struct device iio_evgen_dev = { .groups = iio_evgen_groups, .release = &iio_evgen_release, }; + static __init int iio_dummy_evgen_init(void) { int ret = iio_dummy_evgen_create(); diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index 1629a8a6bf26..381f90ff468a 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -611,7 +611,6 @@ static int iio_dummy_probe(int index) */ iio_dummy_devs[index] = indio_dev; - /* * Set the device name. * @@ -675,7 +674,6 @@ static void iio_dummy_remove(int index) */ struct iio_dev *indio_dev = iio_dummy_devs[index]; - /* Unregister the device */ iio_device_unregister(indio_dev); diff --git a/drivers/staging/iio/iio_simple_dummy.h b/drivers/staging/iio/iio_simple_dummy.h index e877a99540ab..8d00224e6fad 100644 --- a/drivers/staging/iio/iio_simple_dummy.h +++ b/drivers/staging/iio/iio_simple_dummy.h @@ -119,6 +119,7 @@ static inline int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev) { return 0; }; + static inline void iio_simple_dummy_unconfigure_buffer(struct iio_dev *indio_dev) {}; diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index a651b8922d0a..00ed7745f3c5 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -32,6 +32,7 @@ static const s16 fakedata[] = { [diffvoltage3m4] = -2, [accelx] = 344, }; + /** * iio_simple_dummy_trigger_h() - the trigger handler function * @irq: the interrupt number @@ -178,7 +179,6 @@ error_free_buffer: iio_kfifo_free(indio_dev->buffer); error_ret: return ret; - } /** From 071667a0fae08ed8c9dcdb9ff526dc66888cac4b Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Fri, 10 Jul 2015 15:34:26 +0900 Subject: [PATCH 074/912] staging: iio: Drop owner assignment from i2c_driver i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Jonathan Cameron --- drivers/staging/iio/addac/adt7316-i2c.c | 1 - drivers/staging/iio/light/isl29018.c | 1 - drivers/staging/iio/light/isl29028.c | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c index 75ddd4f801a3..78fe0b557280 100644 --- a/drivers/staging/iio/addac/adt7316-i2c.c +++ b/drivers/staging/iio/addac/adt7316-i2c.c @@ -124,7 +124,6 @@ static struct i2c_driver adt7316_driver = { .driver = { .name = "adt7316", .pm = ADT7316_PM_OPS, - .owner = THIS_MODULE, }, .probe = adt7316_i2c_probe, .id_table = adt7316_i2c_id, diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index e646c5d24004..019ba5245c23 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c @@ -838,7 +838,6 @@ static struct i2c_driver isl29018_driver = { .name = "isl29018", .acpi_match_table = ACPI_PTR(isl29018_acpi_match), .pm = ISL29018_PM_OPS, - .owner = THIS_MODULE, .of_match_table = isl29018_of_match, }, .probe = isl29018_probe, diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c index e5b2fdc2334b..cd6f2727aa58 100644 --- a/drivers/staging/iio/light/isl29028.c +++ b/drivers/staging/iio/light/isl29028.c @@ -547,7 +547,6 @@ static struct i2c_driver isl29028_driver = { .class = I2C_CLASS_HWMON, .driver = { .name = "isl29028", - .owner = THIS_MODULE, .of_match_table = isl29028_of_match, }, .probe = isl29028_probe, From 2155971a66f89924edb37c213251c4fe9f7776c0 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Fri, 10 Jul 2015 14:54:14 +0900 Subject: [PATCH 075/912] iio: Drop owner assignment from i2c_driver i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bma180.c | 1 - drivers/iio/accel/st_accel_i2c.c | 1 - drivers/iio/adc/mcp3422.c | 1 - drivers/iio/adc/ti-adc081c.c | 1 - drivers/iio/dac/ad5064.c | 1 - drivers/iio/dac/ad5380.c | 1 - drivers/iio/dac/ad5446.c | 1 - drivers/iio/dac/max5821.c | 1 - drivers/iio/gyro/itg3200_core.c | 1 - drivers/iio/gyro/st_gyro_i2c.c | 1 - drivers/iio/humidity/si7005.c | 1 - drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 1 - drivers/iio/light/apds9300.c | 1 - drivers/iio/light/bh1750.c | 1 - drivers/iio/light/cm32181.c | 1 - drivers/iio/light/cm3232.c | 1 - drivers/iio/light/cm36651.c | 1 - drivers/iio/light/gp2ap020a00f.c | 1 - drivers/iio/light/isl29125.c | 1 - drivers/iio/light/jsa1212.c | 1 - drivers/iio/light/ltr501.c | 1 - drivers/iio/light/tcs3414.c | 1 - drivers/iio/light/tcs3472.c | 1 - drivers/iio/light/tsl4531.c | 1 - drivers/iio/light/vcnl4000.c | 1 - drivers/iio/magnetometer/st_magn_i2c.c | 1 - drivers/iio/pressure/ms5611_i2c.c | 1 - drivers/iio/pressure/st_pressure_i2c.c | 1 - drivers/iio/temperature/mlx90614.c | 1 - drivers/iio/temperature/tmp006.c | 1 - 30 files changed, 30 deletions(-) diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 75c6d2103e07..f04b88406995 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -846,7 +846,6 @@ MODULE_DEVICE_TABLE(i2c, bma180_ids); static struct i2c_driver bma180_driver = { .driver = { .name = "bma180", - .owner = THIS_MODULE, .pm = BMA180_PM_OPS, }, .probe = bma180_probe, diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c index d4ad72ca4a3d..a2f1c20319eb 100644 --- a/drivers/iio/accel/st_accel_i2c.c +++ b/drivers/iio/accel/st_accel_i2c.c @@ -122,7 +122,6 @@ MODULE_DEVICE_TABLE(i2c, st_accel_id_table); static struct i2c_driver st_accel_driver = { .driver = { - .owner = THIS_MODULE, .name = "st-accel-i2c", .of_match_table = of_match_ptr(st_accel_of_match), }, diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c index b96c636470ef..3555122008b4 100644 --- a/drivers/iio/adc/mcp3422.c +++ b/drivers/iio/adc/mcp3422.c @@ -404,7 +404,6 @@ MODULE_DEVICE_TABLE(of, mcp3422_of_match); static struct i2c_driver mcp3422_driver = { .driver = { .name = "mcp3422", - .owner = THIS_MODULE, .of_match_table = of_match_ptr(mcp3422_of_match), }, .probe = mcp3422_probe, diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c index b3a82b4d1a75..2c8374f86252 100644 --- a/drivers/iio/adc/ti-adc081c.c +++ b/drivers/iio/adc/ti-adc081c.c @@ -140,7 +140,6 @@ MODULE_DEVICE_TABLE(of, adc081c_of_match); static struct i2c_driver adc081c_driver = { .driver = { .name = "adc081c", - .owner = THIS_MODULE, .of_match_table = of_match_ptr(adc081c_of_match), }, .probe = adc081c_probe, diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index f03b92fd3803..c067e6821496 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c @@ -630,7 +630,6 @@ MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids); static struct i2c_driver ad5064_i2c_driver = { .driver = { .name = "ad5064", - .owner = THIS_MODULE, }, .probe = ad5064_i2c_probe, .remove = ad5064_i2c_remove, diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c index 9de4c4d38280..130de9b3e0bf 100644 --- a/drivers/iio/dac/ad5380.c +++ b/drivers/iio/dac/ad5380.c @@ -593,7 +593,6 @@ MODULE_DEVICE_TABLE(i2c, ad5380_i2c_ids); static struct i2c_driver ad5380_i2c_driver = { .driver = { .name = "ad5380", - .owner = THIS_MODULE, }, .probe = ad5380_i2c_probe, .remove = ad5380_i2c_remove, diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c index 46bb62a5c1d4..07e17d72a3f3 100644 --- a/drivers/iio/dac/ad5446.c +++ b/drivers/iio/dac/ad5446.c @@ -569,7 +569,6 @@ MODULE_DEVICE_TABLE(i2c, ad5446_i2c_ids); static struct i2c_driver ad5446_i2c_driver = { .driver = { .name = "ad5446", - .owner = THIS_MODULE, }, .probe = ad5446_i2c_probe, .remove = ad5446_i2c_remove, diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c index 6e914495b346..28b8748ea824 100644 --- a/drivers/iio/dac/max5821.c +++ b/drivers/iio/dac/max5821.c @@ -392,7 +392,6 @@ static struct i2c_driver max5821_driver = { .driver = { .name = "max5821", .pm = MAX5821_PM_OPS, - .owner = THIS_MODULE, }, .probe = max5821_probe, .remove = max5821_remove, diff --git a/drivers/iio/gyro/itg3200_core.c b/drivers/iio/gyro/itg3200_core.c index f0fd94055d88..c102a6325bb0 100644 --- a/drivers/iio/gyro/itg3200_core.c +++ b/drivers/iio/gyro/itg3200_core.c @@ -379,7 +379,6 @@ MODULE_DEVICE_TABLE(i2c, itg3200_id); static struct i2c_driver itg3200_driver = { .driver = { - .owner = THIS_MODULE, .name = "itg3200", .pm = &itg3200_pm_ops, }, diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index 64480b16c689..6848451f817a 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c @@ -99,7 +99,6 @@ MODULE_DEVICE_TABLE(i2c, st_gyro_id_table); static struct i2c_driver st_gyro_driver = { .driver = { - .owner = THIS_MODULE, .name = "st-gyro-i2c", .of_match_table = of_match_ptr(st_gyro_of_match), }, diff --git a/drivers/iio/humidity/si7005.c b/drivers/iio/humidity/si7005.c index bdd586e6d955..91972ccd8aaf 100644 --- a/drivers/iio/humidity/si7005.c +++ b/drivers/iio/humidity/si7005.c @@ -177,7 +177,6 @@ MODULE_DEVICE_TABLE(i2c, si7005_id); static struct i2c_driver si7005_driver = { .driver = { .name = "si7005", - .owner = THIS_MODULE, }, .probe = si7005_probe, .id_table = si7005_id, diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 096e545538b8..ca6de8e2d0f9 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -909,7 +909,6 @@ static struct i2c_driver inv_mpu_driver = { .remove = inv_mpu_remove, .id_table = inv_mpu_id, .driver = { - .owner = THIS_MODULE, .name = "inv-mpu6050", .pm = INV_MPU6050_PMOPS, .acpi_match_table = ACPI_PTR(inv_acpi_match), diff --git a/drivers/iio/light/apds9300.c b/drivers/iio/light/apds9300.c index 9ddde0ca9c34..e1b9fa5a7e91 100644 --- a/drivers/iio/light/apds9300.c +++ b/drivers/iio/light/apds9300.c @@ -515,7 +515,6 @@ MODULE_DEVICE_TABLE(i2c, apds9300_id); static struct i2c_driver apds9300_driver = { .driver = { .name = APDS9300_DRV_NAME, - .owner = THIS_MODULE, .pm = APDS9300_PM_OPS, }, .probe = apds9300_probe, diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c index 564c2b3c1a83..8b4164343f20 100644 --- a/drivers/iio/light/bh1750.c +++ b/drivers/iio/light/bh1750.c @@ -319,7 +319,6 @@ MODULE_DEVICE_TABLE(i2c, bh1750_id); static struct i2c_driver bh1750_driver = { .driver = { .name = "bh1750", - .owner = THIS_MODULE, .pm = BH1750_PM_OPS, }, .probe = bh1750_probe, diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c index 5d12ae54d088..1c0de2f8885d 100644 --- a/drivers/iio/light/cm32181.c +++ b/drivers/iio/light/cm32181.c @@ -358,7 +358,6 @@ static struct i2c_driver cm32181_driver = { .driver = { .name = "cm32181", .of_match_table = of_match_ptr(cm32181_of_match), - .owner = THIS_MODULE, }, .id_table = cm32181_id, .probe = cm32181_probe, diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c index 39c8d99cc48e..1b508c65877c 100644 --- a/drivers/iio/light/cm3232.c +++ b/drivers/iio/light/cm3232.c @@ -421,7 +421,6 @@ static const struct of_device_id cm3232_of_match[] = { static struct i2c_driver cm3232_driver = { .driver = { .name = "cm3232", - .owner = THIS_MODULE, .of_match_table = of_match_ptr(cm3232_of_match), #ifdef CONFIG_PM_SLEEP .pm = &cm3232_pm_ops, diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index 39fc67e82138..2a39e141e90c 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c @@ -736,7 +736,6 @@ static struct i2c_driver cm36651_driver = { .driver = { .name = "cm36651", .of_match_table = cm36651_of_match, - .owner = THIS_MODULE, }, .probe = cm36651_probe, .remove = cm36651_remove, diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c index 32b6449833fa..0334a814b5eb 100644 --- a/drivers/iio/light/gp2ap020a00f.c +++ b/drivers/iio/light/gp2ap020a00f.c @@ -1640,7 +1640,6 @@ static struct i2c_driver gp2ap020a00f_driver = { .driver = { .name = GP2A_I2C_NAME, .of_match_table = of_match_ptr(gp2ap020a00f_of_match), - .owner = THIS_MODULE, }, .probe = gp2ap020a00f_probe, .remove = gp2ap020a00f_remove, diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c index b3cbbe830141..e2945a20e5f6 100644 --- a/drivers/iio/light/isl29125.c +++ b/drivers/iio/light/isl29125.c @@ -346,7 +346,6 @@ static struct i2c_driver isl29125_driver = { .driver = { .name = ISL29125_DRV_NAME, .pm = &isl29125_pm_ops, - .owner = THIS_MODULE, }, .probe = isl29125_probe, .remove = isl29125_remove, diff --git a/drivers/iio/light/jsa1212.c b/drivers/iio/light/jsa1212.c index 3a3af89beaf9..c4e8c6b6c3c3 100644 --- a/drivers/iio/light/jsa1212.c +++ b/drivers/iio/light/jsa1212.c @@ -457,7 +457,6 @@ static struct i2c_driver jsa1212_driver = { .driver = { .name = JSA1212_DRIVER_NAME, .pm = JSA1212_PM_OPS, - .owner = THIS_MODULE, .acpi_match_table = ACPI_PTR(jsa1212_acpi_match), }, .probe = jsa1212_probe, diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index 1ef7d3773ab9..f4c9a5cdfed6 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -1551,7 +1551,6 @@ static struct i2c_driver ltr501_driver = { .name = LTR501_DRV_NAME, .pm = <r501_pm_ops, .acpi_match_table = ACPI_PTR(ltr_acpi_match), - .owner = THIS_MODULE, }, .probe = ltr501_probe, .remove = ltr501_remove, diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c index 71c2bde275aa..8075388aa672 100644 --- a/drivers/iio/light/tcs3414.c +++ b/drivers/iio/light/tcs3414.c @@ -392,7 +392,6 @@ static struct i2c_driver tcs3414_driver = { .driver = { .name = TCS3414_DRV_NAME, .pm = &tcs3414_pm_ops, - .owner = THIS_MODULE, }, .probe = tcs3414_probe, .remove = tcs3414_remove, diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c index 752569985d1d..1b530bf04c89 100644 --- a/drivers/iio/light/tcs3472.c +++ b/drivers/iio/light/tcs3472.c @@ -366,7 +366,6 @@ static struct i2c_driver tcs3472_driver = { .driver = { .name = TCS3472_DRV_NAME, .pm = &tcs3472_pm_ops, - .owner = THIS_MODULE, }, .probe = tcs3472_probe, .remove = tcs3472_remove, diff --git a/drivers/iio/light/tsl4531.c b/drivers/iio/light/tsl4531.c index 63c26e2d5d97..26979183d27c 100644 --- a/drivers/iio/light/tsl4531.c +++ b/drivers/iio/light/tsl4531.c @@ -247,7 +247,6 @@ static struct i2c_driver tsl4531_driver = { .driver = { .name = TSL4531_DRV_NAME, .pm = TSL4531_PM_OPS, - .owner = THIS_MODULE, }, .probe = tsl4531_probe, .remove = tsl4531_remove, diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index d948c4778ba6..c9d85bbc9230 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -185,7 +185,6 @@ static int vcnl4000_probe(struct i2c_client *client, static struct i2c_driver vcnl4000_driver = { .driver = { .name = VCNL4000_DRV_NAME, - .owner = THIS_MODULE, }, .probe = vcnl4000_probe, .id_table = vcnl4000_id, diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c index 5311d8aea8cc..28aa80731cea 100644 --- a/drivers/iio/magnetometer/st_magn_i2c.c +++ b/drivers/iio/magnetometer/st_magn_i2c.c @@ -85,7 +85,6 @@ MODULE_DEVICE_TABLE(i2c, st_magn_id_table); static struct i2c_driver st_magn_driver = { .driver = { - .owner = THIS_MODULE, .name = "st-magn-i2c", .of_match_table = of_match_ptr(st_magn_of_match), }, diff --git a/drivers/iio/pressure/ms5611_i2c.c b/drivers/iio/pressure/ms5611_i2c.c index 9d504f17669b..245797d1ecf0 100644 --- a/drivers/iio/pressure/ms5611_i2c.c +++ b/drivers/iio/pressure/ms5611_i2c.c @@ -117,7 +117,6 @@ MODULE_DEVICE_TABLE(i2c, ms5611_id); static struct i2c_driver ms5611_driver = { .driver = { .name = "ms5611", - .owner = THIS_MODULE, }, .id_table = ms5611_id, .probe = ms5611_i2c_probe, diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c index 137788bba4a3..8fcf9766eaec 100644 --- a/drivers/iio/pressure/st_pressure_i2c.c +++ b/drivers/iio/pressure/st_pressure_i2c.c @@ -79,7 +79,6 @@ MODULE_DEVICE_TABLE(i2c, st_press_id_table); static struct i2c_driver st_press_driver = { .driver = { - .owner = THIS_MODULE, .name = "st-press-i2c", .of_match_table = of_match_ptr(st_press_of_match), }, diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c index cb2e8ad8bfdc..90f70b461567 100644 --- a/drivers/iio/temperature/mlx90614.c +++ b/drivers/iio/temperature/mlx90614.c @@ -551,7 +551,6 @@ static const struct dev_pm_ops mlx90614_pm_ops = { static struct i2c_driver mlx90614_driver = { .driver = { .name = "mlx90614", - .owner = THIS_MODULE, .pm = &mlx90614_pm_ops, }, .probe = mlx90614_probe, diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c index ecdb6191951e..395df23d7c8c 100644 --- a/drivers/iio/temperature/tmp006.c +++ b/drivers/iio/temperature/tmp006.c @@ -277,7 +277,6 @@ static struct i2c_driver tmp006_driver = { .driver = { .name = "tmp006", .pm = &tmp006_pm_ops, - .owner = THIS_MODULE, }, .probe = tmp006_probe, .remove = tmp006_remove, From 6c7c65538632f0961df8f02e3be446eb03f687e4 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:58:59 +0200 Subject: [PATCH 076/912] staging: lustre: fid: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fid/fid_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 1362783b7eab..a16d577c6cb1 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *obd, int rc; cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS); - if (cli->cl_seq == NULL) + if (!cli->cl_seq) return -ENOMEM; prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS); - if (prefix == NULL) { + if (!prefix) { rc = -ENOMEM; goto out_free_seq; } From 812f205962e20f4e4052e42d0009b05988760ef2 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:00 +0200 Subject: [PATCH 077/912] staging: lustre: fld: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +- drivers/staging/lustre/lustre/fld/fld_request.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index ec2fc4339a2e..1b1066b2461c 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -70,7 +70,7 @@ struct fld_cache *fld_cache_init(const char *name, LASSERT(cache_threshold < cache_size); cache = kzalloc(sizeof(*cache), GFP_NOFS); - if (cache == NULL) + if (!cache) return ERR_PTR(-ENOMEM); INIT_LIST_HEAD(&cache->fci_entries_head); diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index c3b47f2346df..1e450bf95383 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -222,7 +222,7 @@ int fld_client_add_target(struct lu_client_fld *fld, fld->lcf_name, name, tar->ft_idx); target = kzalloc(sizeof(*target), GFP_NOFS); - if (target == NULL) + if (!target) return -ENOMEM; spin_lock(&fld->lcf_lock); From c38ce3548e0c5df27b63f9b591f11a9c34416576 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:01 +0200 Subject: [PATCH 078/912] staging: lustre: lclient: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index e0c1ccafbd63..9053f8116298 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -203,7 +203,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env, int rc; vdv = kzalloc(sizeof(*vdv), GFP_NOFS); - if (vdv == NULL) + if (!vdv) return ERR_PTR(-ENOMEM); lud = &vdv->cdv_cl.cd_lu_dev; From 94e67761bd05150976342516180508d93a0a7c07 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:02 +0200 Subject: [PATCH 079/912] staging: lustre: ldlm: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 4 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 8 ++++---- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index bb2246d3b22b..cd340fc8ceab 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1528,7 +1528,7 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, if (lvb_len) { lock->l_lvb_len = lvb_len; lock->l_lvb_data = kzalloc(lvb_len, GFP_NOFS); - if (lock->l_lvb_data == NULL) + if (!lock->l_lvb_data) goto out; } @@ -1813,7 +1813,7 @@ int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list, return 0; arg = kzalloc(sizeof(*arg), GFP_NOFS); - if (arg == NULL) + if (!arg) return -ENOMEM; atomic_set(&arg->restart, 0); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index b7b6ca1196b7..941eb4e72039 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -225,7 +225,7 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req, void *lvb_data; lvb_data = kzalloc(lvb_len, GFP_NOFS); - if (lvb_data == NULL) { + if (!lvb_data) { LDLM_ERROR(lock, "No memory: %d.\n", lvb_len); rc = -ENOMEM; goto out; @@ -453,7 +453,7 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns, struct ldlm_bl_work_item *blwi; blwi = kzalloc(sizeof(*blwi), GFP_NOFS); - if (blwi == NULL) + if (!blwi) return -ENOMEM; init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags); @@ -1053,7 +1053,7 @@ static int ldlm_setup(void) return -EALREADY; ldlm_state = kzalloc(sizeof(*ldlm_state), GFP_NOFS); - if (ldlm_state == NULL) + if (!ldlm_state) return -ENOMEM; ldlm_kobj = kobject_create_and_add("ldlm", lustre_kobj); @@ -1123,7 +1123,7 @@ static int ldlm_setup(void) blp = kzalloc(sizeof(*blp), GFP_NOFS); - if (blp == NULL) { + if (!blp) { rc = -ENOMEM; goto out; } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 1605b9c69271..4519d779a0ef 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1422,7 +1422,7 @@ static int ldlm_pools_thread_start(void) return -EALREADY; ldlm_pools_thread = kzalloc(sizeof(*ldlm_pools_thread), GFP_NOFS); - if (ldlm_pools_thread == NULL) + if (!ldlm_pools_thread) return -ENOMEM; init_completion(&ldlm_pools_comp); From 76e4290ccc428fddd9052d12ceb5b806ae982a26 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:03 +0200 Subject: [PATCH 080/912] staging: lustre: lmv: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 2 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index cb35f6341fb2..eebe45bdceb6 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -100,7 +100,7 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm, } op_data = kzalloc(sizeof(*op_data), GFP_NOFS); - if (op_data == NULL) { + if (!op_data) { rc = -ENOMEM; goto out; } diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index ac5053cd5da5..5c058d0802dc 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -716,7 +716,7 @@ repeat_fid2path: if (remote_gf == NULL) { remote_gf_size = sizeof(*remote_gf) + PATH_MAX; remote_gf = kzalloc(remote_gf_size, GFP_NOFS); - if (remote_gf == NULL) { + if (!remote_gf) { rc = -ENOMEM; goto out_fid2path; } @@ -1398,7 +1398,7 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp, return rc; temp = kzalloc(sizeof(*temp), GFP_NOFS); - if (temp == NULL) + if (!temp) return -ENOMEM; for (i = 0; i < lmv->desc.ld_tgt_count; i++) { @@ -1730,7 +1730,7 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo, } rdata = kzalloc(sizeof(*rdata), GFP_NOFS); - if (rdata == NULL) { + if (!rdata) { rc = -ENOMEM; goto out; } From 36a86fe68f875d2b3fc8a61d4a80494e57333f1f Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:04 +0200 Subject: [PATCH 081/912] staging: lustre: lov: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_dev.c | 2 +- drivers/staging/lustre/lustre/lov/lov_io.c | 2 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 2 +- .../staging/lustre/lustre/lov/lov_request.c | 18 +++++++++--------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c b/drivers/staging/lustre/lustre/lov/lov_dev.c index 504b24a468fc..8c3bbe574723 100644 --- a/drivers/staging/lustre/lustre/lov/lov_dev.c +++ b/drivers/staging/lustre/lustre/lov/lov_dev.c @@ -478,7 +478,7 @@ static struct lu_device *lov_device_alloc(const struct lu_env *env, int rc; ld = kzalloc(sizeof(*ld), GFP_NOFS); - if (ld == NULL) + if (!ld) return ERR_PTR(-ENOMEM); cl_device_init(&ld->ld_cl, t); diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 11c1081b1d3d..bf3629151d68 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -181,7 +181,7 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, } else { sub->sub_io = kzalloc(sizeof(*sub->sub_io), GFP_NOFS); - if (sub->sub_io == NULL) + if (!sub->sub_io) result = -ENOMEM; } } diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 96c55acd52ae..cd6ed580c48b 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -976,7 +976,7 @@ static int lov_recreate(struct obd_export *exp, struct obdo *src_oa, src_oa->o_flags & OBD_FL_RECREATE_OBJS); obj_mdp = kzalloc(sizeof(*obj_mdp), GFP_NOFS); - if (obj_mdp == NULL) + if (!obj_mdp) return -ENOMEM; ost_idx = src_oa->o_nlink; diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index 1e4d3fbee323..c59b1402616e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -431,7 +431,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname) return -ENAMETOOLONG; new_pool = kzalloc(sizeof(*new_pool), GFP_NOFS); - if (new_pool == NULL) + if (!new_pool) return -ENOMEM; strncpy(new_pool->pool_name, poolname, LOV_MAXPOOLNAME); diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index f4de8b84c5c2..416e42ed7792 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -275,7 +275,7 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo, int rc = 0, i; set = kzalloc(sizeof(*set), GFP_NOFS); - if (set == NULL) + if (!set) return -ENOMEM; lov_init_set(set); @@ -301,7 +301,7 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo, } req = kzalloc(sizeof(*req), GFP_NOFS); - if (req == NULL) { + if (!req) { rc = -ENOMEM; goto out_set; } @@ -358,7 +358,7 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, int rc = 0, i; set = kzalloc(sizeof(*set), GFP_NOFS); - if (set == NULL) + if (!set) return -ENOMEM; lov_init_set(set); @@ -384,7 +384,7 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, } req = kzalloc(sizeof(*req), GFP_NOFS); - if (req == NULL) { + if (!req) { rc = -ENOMEM; goto out_set; } @@ -477,7 +477,7 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo, int rc = 0, i; set = kzalloc(sizeof(*set), GFP_NOFS); - if (set == NULL) + if (!set) return -ENOMEM; lov_init_set(set); @@ -500,7 +500,7 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo, } req = kzalloc(sizeof(*req), GFP_NOFS); - if (req == NULL) { + if (!req) { rc = -ENOMEM; goto out_set; } @@ -704,7 +704,7 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, int rc = 0, i; set = kzalloc(sizeof(*set), GFP_NOFS); - if (set == NULL) + if (!set) return -ENOMEM; lov_init_set(set); @@ -730,14 +730,14 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, } req = kzalloc(sizeof(*req), GFP_NOFS); - if (req == NULL) { + if (!req) { rc = -ENOMEM; goto out_set; } req->rq_oi.oi_osfs = kzalloc(sizeof(*req->rq_oi.oi_osfs), GFP_NOFS); - if (req->rq_oi.oi_osfs == NULL) { + if (!req->rq_oi.oi_osfs) { kfree(req); rc = -ENOMEM; goto out_set; From bb144d09a95c6016528ec869b4398ae679cc4df7 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:05 +0200 Subject: [PATCH 082/912] staging: lustre: mdc: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 7f208a6621e6..204d51262560 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -1202,7 +1202,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf) /* Key is KEY_FID2PATH + getinfo_fid2path description */ keylen = cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf); key = kzalloc(keylen, GFP_NOFS); - if (key == NULL) + if (!key) return -ENOMEM; memcpy(key, KEY_FID2PATH, sizeof(KEY_FID2PATH)); memcpy(key + cfs_size_round(sizeof(KEY_FID2PATH)), gf, sizeof(*gf)); @@ -1605,7 +1605,7 @@ static int mdc_changelog_send_thread(void *csdata) cs->cs_fp, cs->cs_startrec); cs->cs_buf = kzalloc(KUC_CHANGELOG_MSG_MAXSIZE, GFP_NOFS); - if (cs->cs_buf == NULL) { + if (!cs->cs_buf) { rc = -ENOMEM; goto out; } @@ -1934,7 +1934,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, struct obd_quotactl *oqctl; oqctl = kzalloc(sizeof(*oqctl), GFP_NOFS); - if (oqctl == NULL) { + if (!oqctl) { rc = -ENOMEM; goto out; } From c829be817600694bb99bb978943a6ef966874160 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:06 +0200 Subject: [PATCH 083/912] staging: lustre: mgc: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 174dfc32876b..562bd95bdcb9 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1128,7 +1128,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, LASSERT(cfg->cfg_sb == cfg->cfg_instance); inst = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS); - if (inst == NULL) + if (!inst) return -ENOMEM; if (!IS_SERVER(lsi)) { @@ -1493,7 +1493,7 @@ static int mgc_process_cfg_log(struct obd_device *mgc, lsi = s2lsi(cld->cld_cfg.cfg_sb); env = kzalloc(sizeof(*env), GFP_NOFS); - if (env == NULL) + if (!env) return -ENOMEM; rc = lu_env_init(env, LCT_MG_THREAD); From 485640b536adc451330815a75f433be15c655243 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:07 +0200 Subject: [PATCH 084/912] staging: lustre: obdclass: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 +- drivers/staging/lustre/lustre/obdclass/genops.c | 6 +++--- drivers/staging/lustre/lustre/obdclass/llog.c | 6 +++--- .../staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +- drivers/staging/lustre/lustre/obdclass/lustre_peer.c | 2 +- drivers/staging/lustre/lustre/obdclass/obd_config.c | 10 +++++----- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 12 ++++++------ 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 1bc37566b3a5..8ebe2e6c1696 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -232,7 +232,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) goto out; } lcfg = kzalloc(data->ioc_plen1, GFP_NOFS); - if (lcfg == NULL) { + if (!lcfg) { err = -ENOMEM; goto out; } diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 978c3c5c460a..a42c9f9209c5 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -172,7 +172,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, rc = -ENOMEM; type = kzalloc(sizeof(*type), GFP_NOFS); - if (type == NULL) + if (!type) return rc; type->typ_dt_ops = kzalloc(sizeof(*type->typ_dt_ops), GFP_NOFS); @@ -1016,7 +1016,7 @@ struct obd_import *class_new_import(struct obd_device *obd) struct obd_import *imp; imp = kzalloc(sizeof(*imp), GFP_NOFS); - if (imp == NULL) + if (!imp) return NULL; INIT_LIST_HEAD(&imp->imp_pinger_chain); @@ -1819,7 +1819,7 @@ void *kuc_alloc(int payload_len, int transport, int type) int len = kuc_len(payload_len); lh = kzalloc(len, GFP_NOFS); - if (lh == NULL) + if (!lh) return ERR_PTR(-ENOMEM); lh->kuc_magic = KUC_MAGIC; diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c index 4fa52d1b79d1..9af2da618a4d 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -61,7 +61,7 @@ static struct llog_handle *llog_alloc_handle(void) struct llog_handle *loghandle; loghandle = kzalloc(sizeof(*loghandle), GFP_NOFS); - if (loghandle == NULL) + if (!loghandle) return NULL; init_rwsem(&loghandle->lgh_lock); @@ -208,7 +208,7 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle, LASSERT(handle->lgh_hdr == NULL); llh = kzalloc(sizeof(*llh), GFP_NOFS); - if (llh == NULL) + if (!llh) return -ENOMEM; handle->lgh_hdr = llh; /* first assign flags to use llog_client_ops */ @@ -435,7 +435,7 @@ int llog_process_or_fork(const struct lu_env *env, int rc; lpi = kzalloc(sizeof(*lpi), GFP_NOFS); - if (lpi == NULL) { + if (!lpi) { CERROR("cannot alloc pointer\n"); return -ENOMEM; } diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 17e7c1807863..c761dbf88278 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -275,7 +275,7 @@ struct dentry *ldebugfs_add_symlink(const char *name, struct dentry *parent, return NULL; dest = kzalloc(MAX_STRING_SIZE + 1, GFP_KERNEL); - if (dest == NULL) + if (!dest) return NULL; va_start(ap, format); diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c index 5cc6435cc47a..d6184f821cd0 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c @@ -105,7 +105,7 @@ int class_add_uuid(const char *uuid, __u64 nid) return -EOVERFLOW; data = kzalloc(sizeof(*data), GFP_NOFS); - if (data == NULL) + if (!data) return -ENOMEM; obd_str2uuid(&data->un_uuid, uuid); diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index fbdb748a36b9..3435720c96bb 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -835,7 +835,7 @@ int class_add_profile(int proflen, char *prof, int osclen, char *osc, CDEBUG(D_CONFIG, "Add profile %s\n", prof); lprof = kzalloc(sizeof(*lprof), GFP_NOFS); - if (lprof == NULL) + if (!lprof) return -ENOMEM; INIT_LIST_HEAD(&lprof->lp_list); @@ -979,7 +979,7 @@ struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg, new_len = LUSTRE_CFG_BUFLEN(cfg, 1) + strlen(new_name) - name_len; new_param = kzalloc(new_len, GFP_NOFS); - if (new_param == NULL) + if (!new_param) return ERR_PTR(-ENOMEM); strcpy(new_param, new_name); @@ -987,7 +987,7 @@ struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg, strcat(new_param, value); bufs = kzalloc(sizeof(*bufs), GFP_NOFS); - if (bufs == NULL) { + if (!bufs) { kfree(new_param); return ERR_PTR(-ENOMEM); } @@ -1461,7 +1461,7 @@ int class_config_llog_handler(const struct lu_env *env, inst_len = LUSTRE_CFG_BUFLEN(lcfg, 0) + sizeof(clli->cfg_instance) * 2 + 4; inst_name = kzalloc(inst_len, GFP_NOFS); - if (inst_name == NULL) { + if (!inst_name) { rc = -ENOMEM; goto out; } @@ -1639,7 +1639,7 @@ int class_config_dump_handler(const struct lu_env *env, int rc = 0; outstr = kzalloc(256, GFP_NOFS); - if (outstr == NULL) + if (!outstr) return -ENOMEM; if (rec->lrh_type == OBD_CFG_REC) { diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index ce4a71f7171a..3e0b8a4b6486 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -85,7 +85,7 @@ int lustre_process_log(struct super_block *sb, char *logname, LASSERT(cfg); bufs = kzalloc(sizeof(*bufs), GFP_NOFS); - if (bufs == NULL) + if (!bufs) return -ENOMEM; /* mgc_process_config */ @@ -258,7 +258,7 @@ int lustre_start_mgc(struct super_block *sb) mgssec = lsi->lsi_lmd->lmd_mgssec ? lsi->lsi_lmd->lmd_mgssec : ""; data = kzalloc(sizeof(*data), GFP_NOFS); - if (data == NULL) { + if (!data) { rc = -ENOMEM; goto out_free; } @@ -885,7 +885,7 @@ static int lmd_parse_mgssec(struct lustre_mount_data *lmd, char *ptr) length = tail - ptr; lmd->lmd_mgssec = kzalloc(length + 1, GFP_NOFS); - if (lmd->lmd_mgssec == NULL) + if (!lmd->lmd_mgssec) return -ENOMEM; memcpy(lmd->lmd_mgssec, ptr, length); @@ -911,7 +911,7 @@ static int lmd_parse_string(char **handle, char *ptr) length = tail - ptr; *handle = kzalloc(length + 1, GFP_NOFS); - if (*handle == NULL) + if (!*handle) return -ENOMEM; memcpy(*handle, ptr, length); @@ -941,7 +941,7 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr) oldlen = strlen(lmd->lmd_mgs) + 1; mgsnid = kzalloc(oldlen + length + 1, GFP_NOFS); - if (mgsnid == NULL) + if (!mgsnid) return -ENOMEM; if (lmd->lmd_mgs != NULL) { @@ -983,7 +983,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) lmd->lmd_magic = LMD_MAGIC; lmd->lmd_params = kzalloc(4096, GFP_NOFS); - if (lmd->lmd_params == NULL) + if (!lmd->lmd_params) return -ENOMEM; lmd->lmd_params[0] = '\0'; From efeb257dcf1c84fa05eff06cb829906576ae21b8 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:08 +0200 Subject: [PATCH 085/912] staging: lustre: obdecho: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdecho/echo_client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 0222fd2e4757..de6f795e05d1 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -480,11 +480,11 @@ static int echo_alloc_memmd(struct echo_device *ed, LASSERT(*lsmp == NULL); *lsmp = kzalloc(lsm_size, GFP_NOFS); - if (*lsmp == NULL) + if (!*lsmp) return -ENOMEM; (*lsmp)->lsm_oinfo[0] = kzalloc(sizeof(struct lov_oinfo), GFP_NOFS); - if ((*lsmp)->lsm_oinfo[0] == NULL) { + if (!(*lsmp)->lsm_oinfo[0]) { kfree(*lsmp); return -ENOMEM; } @@ -701,7 +701,7 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, int cleanup = 0; ed = kzalloc(sizeof(*ed), GFP_NOFS); - if (ed == NULL) { + if (!ed) { rc = -ENOMEM; goto out; } @@ -1878,7 +1878,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len, return rc; env = kzalloc(sizeof(*env), GFP_NOFS); - if (env == NULL) + if (!env) return -ENOMEM; rc = lu_env_init(env, LCT_DT_THREAD); @@ -2049,7 +2049,7 @@ static int echo_client_setup(const struct lu_env *env, ec->ec_nstripes = 0; ocd = kzalloc(sizeof(*ocd), GFP_NOFS); - if (ocd == NULL) { + if (!ocd) { CERROR("Can't alloc ocd connecting to %s\n", lustre_cfg_string(lcfg, 1)); return -ENOMEM; From 3408e9aeee5fedd0eab223502074cad3120324b0 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:09 +0200 Subject: [PATCH 086/912] staging: lustre: osc: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_dev.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c b/drivers/staging/lustre/lustre/osc/osc_dev.c index 9222c9f4faae..91fdec44792b 100644 --- a/drivers/staging/lustre/lustre/osc/osc_dev.c +++ b/drivers/staging/lustre/lustre/osc/osc_dev.c @@ -218,7 +218,7 @@ static struct lu_device *osc_device_alloc(const struct lu_env *env, int rc; od = kzalloc(sizeof(*od), GFP_NOFS); - if (od == NULL) + if (!od) return ERR_PTR(-ENOMEM); cl_device_init(&od->od_cl, t); diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index f84b4c78a8a0..96c80e9bf92d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -119,7 +119,7 @@ static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, if (*lmmp == NULL) { *lmmp = kzalloc(lmm_size, GFP_NOFS); - if (*lmmp == NULL) + if (!*lmmp) return -ENOMEM; } @@ -1909,7 +1909,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, mpflag = cfs_memory_pressure_get_and_set(); crattr = kzalloc(sizeof(*crattr), GFP_NOFS); - if (crattr == NULL) { + if (!crattr) { rc = -ENOMEM; goto out; } From 597851ac2ae4e3857f2ab410adb0775951a09fa0 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:10 +0200 Subject: [PATCH 087/912] staging: lustre: ptlrpc: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 8 ++++---- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index a12cd66b2365..c83a34a01e65 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -971,7 +971,7 @@ int ptlrpc_set_add_cb(struct ptlrpc_request_set *set, struct ptlrpc_set_cbdata *cbdata; cbdata = kzalloc(sizeof(*cbdata), GFP_NOFS); - if (cbdata == NULL) + if (!cbdata) return -ENOMEM; cbdata->psc_interpret = fn; diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index aaaabbf5f1b9..53f9af1f2f3e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -652,7 +652,7 @@ static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file, return -EINVAL; cmd = kzalloc(LPROCFS_NRS_WR_MAX_CMD, GFP_NOFS); - if (cmd == NULL) + if (!cmd) return -ENOMEM; /** * strsep() modifies its argument, so keep a copy @@ -819,7 +819,7 @@ ptlrpc_lprocfs_svc_req_history_start(struct seq_file *s, loff_t *pos) } srhi = kzalloc(sizeof(*srhi), GFP_NOFS); - if (srhi == NULL) + if (!srhi) return NULL; srhi->srhi_seq = 0; @@ -1219,7 +1219,7 @@ int lprocfs_wr_evict_client(struct file *file, const char __user *buffer, char *tmpbuf; kbuf = kzalloc(BUFLEN, GFP_NOFS); - if (kbuf == NULL) + if (!kbuf) return -ENOMEM; /* @@ -1303,7 +1303,7 @@ int lprocfs_wr_import(struct file *file, const char __user *buffer, return -EINVAL; kbuf = kzalloc(count + 1, GFP_NOFS); - if (kbuf == NULL) + if (!kbuf) return -ENOMEM; if (copy_from_user(kbuf, buffer, count)) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 9516acadb7a1..d37cdd5ac580 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -1156,7 +1156,7 @@ int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf) } desc = kzalloc(sizeof(*desc), GFP_NOFS); - if (desc == NULL) { + if (!desc) { rc = -ENOMEM; goto fail; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index e591cff323ec..17cc81d5074f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -739,7 +739,7 @@ static int ptlrpcd_init(void) size = offsetof(struct ptlrpcd, pd_threads[nthreads]); ptlrpcds = kzalloc(size, GFP_NOFS); - if (ptlrpcds == NULL) { + if (!ptlrpcds) { rc = -ENOMEM; goto out; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index 69d73c430696..2ee3e8b2e879 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -415,7 +415,7 @@ static int enc_pools_add_pages(int npages) for (i = 0; i < npools; i++) { pools[i] = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS); - if (pools[i] == NULL) + if (!pools[i]) goto out_pools; for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c index 31da43e8b3c6..e7f2f333257d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c @@ -564,7 +564,7 @@ struct sptlrpc_conf *sptlrpc_conf_get(const char *fsname, return NULL; conf = kzalloc(sizeof(*conf), GFP_NOFS); - if (conf == NULL) + if (!conf) return NULL; strcpy(conf->sc_fsname, fsname); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c index 53ce0d14bd46..a243db60f697 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c @@ -444,7 +444,7 @@ struct ptlrpc_sec *plain_create_sec(struct obd_import *imp, LASSERT(SPTLRPC_FLVR_POLICY(sf->sf_rpc) == SPTLRPC_POLICY_PLAIN); plsec = kzalloc(sizeof(*plsec), GFP_NOFS); - if (plsec == NULL) + if (!plsec) return NULL; /* diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 9117f1c15a8e..56a86317ded7 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -732,7 +732,7 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, service = kzalloc(offsetof(struct ptlrpc_service, srv_parts[ncpts]), GFP_NOFS); - if (service == NULL) { + if (!service) { kfree(cpts); return ERR_PTR(-ENOMEM); } @@ -2298,7 +2298,7 @@ static int ptlrpc_main(void *arg) } env = kzalloc(sizeof(*env), GFP_NOFS); - if (env == NULL) { + if (!env) { rc = -ENOMEM; goto out_srv_fini; } From f82ced5d6bce6cd0719e95f744bfeb8f81677790 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 21:07:50 +0200 Subject: [PATCH 088/912] staging: lustre: llite: drop trivially useless initialization Remove initialization of a variable that is immediately reassigned. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; identifier x; constant C; expression e; @@ T x - = C ; x = e; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 3075db211106..e01a47c0b80a 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3005,7 +3005,7 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat) struct inode *inode = d_inode(de); struct ll_sb_info *sbi = ll_i2sbi(inode); struct ll_inode_info *lli = ll_i2info(inode); - int res = 0; + int res; res = ll_inode_revalidate(de, MDS_INODELOCK_UPDATE | MDS_INODELOCK_LOOKUP); diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index 6956dec53fcc..9e763ce244e3 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -357,7 +357,7 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit) struct ll_inode_info *lli = ll_i2info(inode); struct mdt_body *body; __u32 *xsizes; - int rc = 0, i; + int rc, i; From 53a0d4868703c5d5d5dc0d0eaf9166d6bba9a697 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 21:07:53 +0200 Subject: [PATCH 089/912] staging: lustre: osc: drop trivially useless initialization Remove initialization of a variable that is immediately reassigned. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; identifier x; constant C; expression e; @@ T x - = C ; x = e; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 43dfa73dd3a6..f9cf5cea643d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -471,7 +471,7 @@ static int osc_page_flush(const struct lu_env *env, struct cl_io *io) { struct osc_page *opg = cl2osc_page(slice); - int rc = 0; + int rc; rc = osc_flush_async_page(env, io, opg); return rc; From a84b7fd5f7539a1eca943a17ba9d7cafc10f3f90 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 21:07:51 +0200 Subject: [PATCH 090/912] staging: lustre: lmv: drop trivially useless initialization Remove initialization of a variable that is immediately reassigned. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; identifier x; constant C; expression e; @@ T x - = C ; x = e; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 5c058d0802dc..c9e0536e9f2a 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -1993,7 +1993,7 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data, struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; struct lmv_tgt_desc *tgt; - int rc = 0; + int rc; rc = lmv_check_connect(obd); if (rc) From 0d0c8b75713491cdb3f6e7792b68ccaae9e7518e Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 21:07:52 +0200 Subject: [PATCH 091/912] staging: lustre: obdclass: llog: drop trivially useless initialization Remove initialization of a variable that is immediately reassigned. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; identifier x; constant C; expression e; @@ T x - = C ; x = e; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/llog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c index 9af2da618a4d..facc8351fcea 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -907,7 +907,7 @@ int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt, char *name) { struct llog_handle *llh; - int rc = 0; + int rc; rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS); if (rc < 0) { From fad22d71bbba464bfb30ea5e5c18c52cc8e35168 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 21:07:49 +0200 Subject: [PATCH 092/912] staging: lustre: libcfs: drop trivially useless initialization Remove initialization of a variable that is immediately reassigned. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; identifier x; constant C; expression e; @@ T x - = C ; x = e; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/fail.c | 2 +- drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/fail.c b/drivers/staging/lustre/lustre/libcfs/fail.c index 7b7fc215e633..42d615fbd664 100644 --- a/drivers/staging/lustre/lustre/libcfs/fail.c +++ b/drivers/staging/lustre/lustre/libcfs/fail.c @@ -123,7 +123,7 @@ EXPORT_SYMBOL(__cfs_fail_check_set); int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set) { - int ret = 0; + int ret; ret = __cfs_fail_check_set(id, value, set); if (ret) { diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c index 31a558115a96..933525c73da1 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c @@ -78,7 +78,7 @@ EXPORT_SYMBOL(cfs_cpt_table_free); int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) { - int rc = 0; + int rc; rc = snprintf(buf, len, "%d\t: %d\n", 0, 0); len -= rc; From a82de7ea52e74b39b9e13ec0d6372378181dcfd0 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Wed, 24 Jun 2015 10:07:45 -0400 Subject: [PATCH 093/912] staging/lustre/lnet: Move asm/irq.h include after linux includes Apparently m86k cannot build if you include asm/irq.h before linux/* includes and fixing it there is hard. So just move asm/irq.h include to where it does not cause any problems. Thanks to Geert Uytterhoeven for getting to the root of it. Signed-off-by: Oleg Drokin Compile-Tested-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 7125eb955ae5..cb91e68919d0 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -31,7 +31,6 @@ #define DEBUG_PORTAL_ALLOC #define DEBUG_SUBSYSTEM S_LND -#include #include #include #include @@ -47,6 +46,7 @@ #include #include #include +#include #include #include From 3c150f0081647c0b96ce0d61d541b9b470433676 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Wed, 24 Jun 2015 10:09:24 -0400 Subject: [PATCH 094/912] staging/lustre/lov: Move target sysfs symlink removal to LOV freeing This helps to avoid use after free on unmount. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_obd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index cd6ed580c48b..5f4c115f4ff4 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -107,6 +107,10 @@ static void lov_putref(struct obd_device *obd) /* Disconnect */ __lov_del_obd(obd, tgt); } + + if (lov->lov_tgts_kobj) + kobject_put(lov->lov_tgts_kobj); + } else { mutex_unlock(&lov->lov_lock); } @@ -322,9 +326,6 @@ static int lov_disconnect(struct obd_export *exp) } } - if (lov->lov_tgts_kobj) - kobject_put(lov->lov_tgts_kobj); - obd_putref(obd); out: From 6a491f2b80f2806221ba3a5a3e26fbe945f82d83 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:40 -0400 Subject: [PATCH 095/912] staging/lustre: make ldebugfs_remove recursive ldebugfs_remove is usually called on directories with files passed in as attributes, so simple debugfs_remove failes on them as not empty Switch to debugfs_remove_recursive. This fixes a number of problems where a new filesystem is mounted after being unmounted first. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index c761dbf88278..08d1f0edf98d 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -329,7 +329,7 @@ EXPORT_SYMBOL(ldebugfs_add_vars); void ldebugfs_remove(struct dentry **entryp) { - debugfs_remove(*entryp); + debugfs_remove_recursive(*entryp); *entryp = NULL; } EXPORT_SYMBOL(ldebugfs_remove); From faa7a4e3e03889267f66a98d85434b4ff7dd0087 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:41 -0400 Subject: [PATCH 096/912] staging/lustre/ldlm: In ldlm_pools_fini make sure there was init first. It turns out if you call ldlm_pools_fini without completing the ldlm_pools_init, then attempt to unregister not yet registered shrinkers makes the kernel very unhappy. So make sure we have them registered first. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 4519d779a0ef..c234acb85f10 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1486,8 +1486,10 @@ EXPORT_SYMBOL(ldlm_pools_init); void ldlm_pools_fini(void) { - unregister_shrinker(&ldlm_pools_srv_shrinker); - unregister_shrinker(&ldlm_pools_cli_shrinker); + if (ldlm_pools_thread) { + unregister_shrinker(&ldlm_pools_srv_shrinker); + unregister_shrinker(&ldlm_pools_cli_shrinker); + } ldlm_pools_thread_stop(); } EXPORT_SYMBOL(ldlm_pools_fini); From 3c4872f94359ed38a1392c0a9238c48a9aee6f8f Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:42 -0400 Subject: [PATCH 097/912] staging/lustre/obdclass: fix class_procfs_init error return value Dan Carpenter noticed that procfs conversion patches introduced a bug where should kobject_create_and_add, an error is not returned from class_procfs_init. Reported-by: Dan Carpenter Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c index 84f75dce0d4c..b618c0bd7e09 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c @@ -423,7 +423,7 @@ static struct attribute_group lustre_attr_group = { int class_procfs_init(void) { - int rc = 0; + int rc = -ENOMEM; struct dentry *file; lustre_kobj = kobject_create_and_add("lustre", fs_kobj); From 80595b7498a1c4c7bb4f3db3bd8b7998196c8719 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:43 -0400 Subject: [PATCH 098/912] staging/lustre: remove alloc_fail_rate sysctl It was used to control allocation failure rate, but there is in-kernel way of doing that that's more versatile too. This is going to remove just the sysctl, the underlying variable will be removed once all OBD_ALLOC* macros removal patchseries land. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/obdclass/linux/linux-sysctl.c | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index 54f0a81f7b51..b9a7d2faf049 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -203,37 +203,6 @@ static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, return rc; } -static int proc_alloc_fail_rate(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int rc = 0; - - if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { - *lenp = 0; - return 0; - } - if (write) { - rc = lprocfs_write_frac_helper(buffer, *lenp, - (unsigned int *)table->data, - OBD_ALLOC_FAIL_MULT); - } else { - char buf[21]; - int len; - - len = lprocfs_read_frac_helper(buf, 21, - *(unsigned int *)table->data, - OBD_ALLOC_FAIL_MULT); - if (len > *lenp) - len = *lenp; - buf[len] = '\0'; - if (copy_to_user(buffer, buf, len)) - return -EFAULT; - *lenp = len; - } - *ppos += *lenp; - return rc; -} - static struct ctl_table obd_table[] = { { .procname = "timeout", @@ -298,13 +267,6 @@ static struct ctl_table obd_table[] = { .mode = 0644, .proc_handler = &proc_set_timeout }, - { - .procname = "alloc_fail_rate", - .data = &obd_alloc_fail_rate, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_alloc_fail_rate - }, { .procname = "max_dirty_mb", .data = &obd_max_dirty_pages, From 2836cd81a9ca8d3fc7c86fe4167b8053d784e725 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:44 -0400 Subject: [PATCH 099/912] staging/lustre: Remove now obsolete memory tracking sysctls In the past when Lustre did its own allocation amounts tracking the results were shown in sysctl as current and overall max number of bytes and pages allocated. Now that we don't track these, remove the sysctls. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/obdclass/linux/linux-sysctl.c | 124 ------------------ 1 file changed, 124 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index b9a7d2faf049..e800bd6c5491 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -66,102 +66,6 @@ static int proc_set_timeout(struct ctl_table *table, int write, return rc; } -static int proc_memory_alloc(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - char buf[22]; - int len; - - if (!*lenp || (*ppos && !write)) { - *lenp = 0; - return 0; - } - if (write) - return -EINVAL; - - len = snprintf(buf, sizeof(buf), "%llu\n", obd_memory_sum()); - if (len > *lenp) - len = *lenp; - buf[len] = '\0'; - if (copy_to_user(buffer, buf, len)) - return -EFAULT; - *lenp = len; - *ppos += *lenp; - return 0; -} - -static int proc_pages_alloc(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - char buf[22]; - int len; - - if (!*lenp || (*ppos && !write)) { - *lenp = 0; - return 0; - } - if (write) - return -EINVAL; - - len = snprintf(buf, sizeof(buf), "%llu\n", obd_pages_sum()); - if (len > *lenp) - len = *lenp; - buf[len] = '\0'; - if (copy_to_user(buffer, buf, len)) - return -EFAULT; - *lenp = len; - *ppos += *lenp; - return 0; -} - -static int proc_mem_max(struct ctl_table *table, int write, void __user *buffer, - size_t *lenp, loff_t *ppos) -{ - char buf[22]; - int len; - - if (!*lenp || (*ppos && !write)) { - *lenp = 0; - return 0; - } - if (write) - return -EINVAL; - - len = snprintf(buf, sizeof(buf), "%llu\n", obd_memory_max()); - if (len > *lenp) - len = *lenp; - buf[len] = '\0'; - if (copy_to_user(buffer, buf, len)) - return -EFAULT; - *lenp = len; - *ppos += *lenp; - return 0; -} - -static int proc_pages_max(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - char buf[22]; - int len; - - if (!*lenp || (*ppos && !write)) { - *lenp = 0; - return 0; - } - if (write) - return -EINVAL; - - len = snprintf(buf, sizeof(buf), "%llu\n", obd_pages_max()); - if (len > *lenp) - len = *lenp; - buf[len] = '\0'; - if (copy_to_user(buffer, buf, len)) - return -EFAULT; - *lenp = len; - *ppos += *lenp; - return 0; -} - static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { @@ -232,34 +136,6 @@ static struct ctl_table obd_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { - .procname = "memused", - .data = NULL, - .maxlen = 0, - .mode = 0444, - .proc_handler = &proc_memory_alloc - }, - { - .procname = "pagesused", - .data = NULL, - .maxlen = 0, - .mode = 0444, - .proc_handler = &proc_pages_alloc - }, - { - .procname = "memused_max", - .data = NULL, - .maxlen = 0, - .mode = 0444, - .proc_handler = &proc_mem_max - }, - { - .procname = "pagesused_max", - .data = NULL, - .maxlen = 0, - .mode = 0444, - .proc_handler = &proc_pages_max - }, { .procname = "ldlm_timeout", .data = &ldlm_timeout, From 082a33441f5e0f8b59b6a7297fdfca064d55fb26 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:45 -0400 Subject: [PATCH 100/912] staging/lustre: Remove unneeded ldlm_timeout control ldlm_timeout is used server-side to determine AST timeouts, so it makes no sense on the client, esp. since it's not really used anywhere. Remove all traces of it except from the config where make it a noop. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd_support.h | 4 ---- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 9 --------- drivers/staging/lustre/lustre/obdclass/class_obd.c | 4 ---- .../staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 9 --------- drivers/staging/lustre/lustre/obdclass/obd_config.c | 7 +------ 5 files changed, 1 insertion(+), 32 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index 73e2d4880b9b..f6b369206ace 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -56,9 +56,7 @@ extern unsigned int obd_dump_on_eviction; /* obd_timeout should only be used for recovery, not for networking / disk / timings affected by load (use Adaptive Timeouts) */ extern unsigned int obd_timeout; /* seconds */ -extern unsigned int ldlm_timeout; /* seconds */ extern unsigned int obd_timeout_set; -extern unsigned int ldlm_timeout_set; extern unsigned int at_min; extern unsigned int at_max; extern unsigned int at_history; @@ -105,8 +103,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, /* Timeout definitions */ #define OBD_TIMEOUT_DEFAULT 100 -#define LDLM_TIMEOUT_DEFAULT 20 -#define MDS_LDLM_TIMEOUT_DEFAULT 6 /* Time to wait for all clients to reconnect during recovery (hard limit) */ #define OBD_RECOVERY_TIME_HARD (obd_timeout * 9) /* Time to wait for all clients to reconnect during recovery (soft limit) */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index 941eb4e72039..ac79db952da7 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -76,15 +76,6 @@ inline unsigned long round_timeout(unsigned long timeout) return cfs_time_seconds((int)cfs_duration_sec(cfs_time_sub(timeout, 0)) + 1); } -/* timeout for initial callback (AST) reply (bz10399) */ -static inline unsigned int ldlm_get_rq_timeout(void) -{ - /* Non-AT value */ - unsigned int timeout = min(ldlm_timeout, obd_timeout / 3); - - return timeout < 1 ? 1 : timeout; -} - #define ELT_STOPPED 0 #define ELT_READY 1 #define ELT_TERMINATE 2 diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 8ebe2e6c1696..34b16c044df8 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -78,12 +78,8 @@ atomic_t obd_dirty_pages; EXPORT_SYMBOL(obd_dirty_pages); unsigned int obd_timeout = OBD_TIMEOUT_DEFAULT; /* seconds */ EXPORT_SYMBOL(obd_timeout); -unsigned int ldlm_timeout = LDLM_TIMEOUT_DEFAULT; /* seconds */ -EXPORT_SYMBOL(ldlm_timeout); unsigned int obd_timeout_set; EXPORT_SYMBOL(obd_timeout_set); -unsigned int ldlm_timeout_set; -EXPORT_SYMBOL(ldlm_timeout_set); /* Adaptive timeout defs here instead of ptlrpc module for /proc/sys/ access */ unsigned int at_min = 0; EXPORT_SYMBOL(at_min); diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index e800bd6c5491..eda5f30e8f30 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -61,8 +61,6 @@ static int proc_set_timeout(struct ctl_table *table, int write, int rc; rc = proc_dointvec(table, write, buffer, lenp, ppos); - if (ldlm_timeout >= obd_timeout) - ldlm_timeout = max(obd_timeout / 3, 1U); return rc; } @@ -136,13 +134,6 @@ static struct ctl_table obd_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { - .procname = "ldlm_timeout", - .data = &ldlm_timeout, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_set_timeout - }, { .procname = "max_dirty_mb", .data = &obd_max_dirty_pages, diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 3435720c96bb..93805ac93c5a 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1123,12 +1123,7 @@ int class_process_config(struct lustre_cfg *lcfg) goto out; } case LCFG_SET_LDLM_TIMEOUT: { - CDEBUG(D_IOCTL, "changing lustre ldlm_timeout from %d to %d\n", - ldlm_timeout, lcfg->lcfg_num); - ldlm_timeout = max(lcfg->lcfg_num, 1U); - if (ldlm_timeout >= obd_timeout) - ldlm_timeout = max(obd_timeout / 3, 1U); - ldlm_timeout_set = 1; + /* ldlm_timeout is not used on the client */ err = 0; goto out; } From e2424a1265f2772b66f068c205256e2aef5f74a0 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:46 -0400 Subject: [PATCH 101/912] staging/lustre/obdclass: move sysctl timeout to sysfs This is the first step of moving lustre sysctls from /proc/sys/lustre to /sys/fs/lustre Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/obd_class.h | 4 +- .../lustre/lustre/obdclass/class_obd.c | 6 +- .../lustre/obdclass/linux/linux-sysctl.c | 70 +++++++++++++++---- drivers/staging/lustre/sysfs-fs-lustre | 12 ++++ 4 files changed, 73 insertions(+), 19 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 36ed78127830..7dce4eea8575 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -1869,8 +1869,8 @@ extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c); /* obd_mount.c */ /* sysctl.c */ -extern void obd_sysctl_init (void); -extern void obd_sysctl_clean (void); +extern int obd_sysctl_init(void); +extern void obd_sysctl_clean(void); /* uuid.c */ typedef __u8 class_uuid_t[16]; diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 34b16c044df8..2e42d1a637f1 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -567,12 +567,14 @@ static int __init init_obdclass(void) if (err) return err; - obd_sysctl_init(); - err = class_procfs_init(); if (err) return err; + err = obd_sysctl_init(); + if (err) + return err; + err = lu_global_init(); if (err) return err; diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index eda5f30e8f30..3c8087b5cf4b 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -54,16 +54,53 @@ static struct ctl_table_header *obd_table_header; #endif -#ifdef CONFIG_SYSCTL -static int proc_set_timeout(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int rc; +struct static_lustre_uintvalue_attr { + struct { + struct attribute attr; + ssize_t (*show)(struct kobject *kobj, struct attribute *attr, + char *buf); + ssize_t (*store)(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t len); + } u; + int *value; +}; - rc = proc_dointvec(table, write, buffer, lenp, ppos); - return rc; +static ssize_t static_uintvalue_show(struct kobject *kobj, + struct attribute *attr, + char *buf) +{ + struct static_lustre_uintvalue_attr *lattr = (void *)attr; + + return sprintf(buf, "%d\n", *lattr->value); } +static ssize_t static_uintvalue_store(struct kobject *kobj, + struct attribute *attr, + const char *buffer, size_t count) +{ + struct static_lustre_uintvalue_attr *lattr = (void *)attr; + int rc; + unsigned int val; + + rc = kstrtouint(buffer, 10, &val); + if (rc) + return rc; + + *lattr->value = val; + + return count; +} + +#define LUSTRE_STATIC_UINT_ATTR(name, value) \ +static struct static_lustre_uintvalue_attr lustre_sattr_##name = \ + {__ATTR(name, 0644, \ + static_uintvalue_show, \ + static_uintvalue_store),\ + value } + +LUSTRE_STATIC_UINT_ATTR(timeout, &obd_timeout); + +#ifdef CONFIG_SYSCTL static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { @@ -106,13 +143,6 @@ static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, } static struct ctl_table obd_table[] = { - { - .procname = "timeout", - .data = &obd_timeout, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_set_timeout - }, { .procname = "debug_peer_on_timeout", .data = &obd_debug_peer_on_timeout, @@ -191,12 +221,22 @@ static struct ctl_table parent_table[] = { }; #endif -void obd_sysctl_init(void) +static struct attribute *lustre_attrs[] = { + &lustre_sattr_timeout.u.attr, + NULL, +}; + +static struct attribute_group lustre_attr_group = { + .attrs = lustre_attrs, +}; + +int obd_sysctl_init(void) { #ifdef CONFIG_SYSCTL if (!obd_table_header) obd_table_header = register_sysctl_table(parent_table); #endif + return sysfs_create_group(lustre_kobj, &lustre_attr_group); } void obd_sysctl_clean(void) diff --git a/drivers/staging/lustre/sysfs-fs-lustre b/drivers/staging/lustre/sysfs-fs-lustre index 1e302e8516ce..6dbad260fa7d 100644 --- a/drivers/staging/lustre/sysfs-fs-lustre +++ b/drivers/staging/lustre/sysfs-fs-lustre @@ -40,6 +40,18 @@ Description: e.g. dd.1253 nodelocal - use jobid_name value from above. +What: /sys/fs/lustre/timeout +Date: June 2015 +Contact: "Oleg Drokin" +Description: + Controls "lustre timeout" variable, also known as obd_timeout + in some old manual. In the past obd_timeout was of paramount + importance as the timeout value used everywhere and where + other timeouts were derived from. These days it's much less + important as network timeouts are mostly determined by + AT (adaptive timeouts). + Unit: seconds, default: 100 + What: /sys/fs/lustre/llite/-/blocksize Date: May 2015 Contact: "Oleg Drokin" From df476a4d5de09d9324b108fc9c5ff2c00a0850d0 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:47 -0400 Subject: [PATCH 102/912] staging/lustre/obdclass: move max_dirty_mb from sysctl to sysfs max_dirty_mb is now a parameter in /sys/fs/lustre/ Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/obdclass/linux/linux-sysctl.c | 80 ++++++++----------- drivers/staging/lustre/sysfs-fs-lustre | 12 +++ 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index 3c8087b5cf4b..bb55a07b6c51 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -100,48 +100,42 @@ static struct static_lustre_uintvalue_attr lustre_sattr_##name = \ LUSTRE_STATIC_UINT_ATTR(timeout, &obd_timeout); -#ifdef CONFIG_SYSCTL -static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) +static ssize_t max_dirty_mb_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - int rc = 0; - - if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { - *lenp = 0; - return 0; - } - if (write) { - rc = lprocfs_write_frac_helper(buffer, *lenp, - (unsigned int *)table->data, - 1 << (20 - PAGE_CACHE_SHIFT)); - /* Don't allow them to let dirty pages exceed 90% of system - * memory and set a hard minimum of 4MB. */ - if (obd_max_dirty_pages > ((totalram_pages / 10) * 9)) { - CERROR("Refusing to set max dirty pages to %u, which is more than 90%% of available RAM; setting to %lu\n", - obd_max_dirty_pages, - ((totalram_pages / 10) * 9)); - obd_max_dirty_pages = (totalram_pages / 10) * 9; - } else if (obd_max_dirty_pages < 4 << (20 - PAGE_CACHE_SHIFT)) { - obd_max_dirty_pages = 4 << (20 - PAGE_CACHE_SHIFT); - } - } else { - char buf[21]; - int len; - - len = lprocfs_read_frac_helper(buf, sizeof(buf), - *(unsigned int *)table->data, - 1 << (20 - PAGE_CACHE_SHIFT)); - if (len > *lenp) - len = *lenp; - buf[len] = '\0'; - if (copy_to_user(buffer, buf, len)) - return -EFAULT; - *lenp = len; - } - *ppos += *lenp; - return rc; + return sprintf(buf, "%ul\n", + obd_max_dirty_pages / (1 << (20 - PAGE_CACHE_SHIFT))); } +static ssize_t max_dirty_mb_store(struct kobject *kobj, struct attribute *attr, + const char *buffer, size_t count) +{ + int rc; + unsigned long val; + + rc = kstrtoul(buffer, 10, &val); + if (rc) + return rc; + + val *= 1 << (20 - PAGE_CACHE_SHIFT); /* convert to pages */ + + if (val > ((totalram_pages / 10) * 9)) { + /* Somebody wants to assign too much memory to dirty pages */ + return -EINVAL; + } + + if (val < 4 << (20 - PAGE_CACHE_SHIFT)) { + /* Less than 4 Mb for dirty cache is also bad */ + return -EINVAL; + } + + obd_max_dirty_pages = val; + + return count; +} +LUSTRE_RW_ATTR(max_dirty_mb); + +#ifdef CONFIG_SYSCTL static struct ctl_table obd_table[] = { { .procname = "debug_peer_on_timeout", @@ -164,13 +158,6 @@ static struct ctl_table obd_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { - .procname = "max_dirty_mb", - .data = &obd_max_dirty_pages, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_max_dirty_pages_in_mb - }, { .procname = "at_min", .data = &at_min, @@ -223,6 +210,7 @@ static struct ctl_table parent_table[] = { static struct attribute *lustre_attrs[] = { &lustre_sattr_timeout.u.attr, + &lustre_attr_max_dirty_mb.attr, NULL, }; diff --git a/drivers/staging/lustre/sysfs-fs-lustre b/drivers/staging/lustre/sysfs-fs-lustre index 6dbad260fa7d..38d1adcd2335 100644 --- a/drivers/staging/lustre/sysfs-fs-lustre +++ b/drivers/staging/lustre/sysfs-fs-lustre @@ -52,6 +52,18 @@ Description: AT (adaptive timeouts). Unit: seconds, default: 100 +What: /sys/fs/lustre/max_dirty_mb +Date: June 2015 +Contact: "Oleg Drokin" +Description: + Controls total number of dirty cache (in megabytes) allowed + across all mounted lustre filesystems. + Since writeout of dirty pages in Lustre is somewhat expensive, + when you allow to many dirty pages, this might lead to + performance degradations as kernel tries to desperately + find some pages to free/writeout. + Default 1/2 RAM. Min value 4, max value 9/10 of RAM. + What: /sys/fs/lustre/llite/-/blocksize Date: May 2015 Contact: "Oleg Drokin" From 9e7fa14935901bcd09576b2866d5dd15f69caf83 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:48 -0400 Subject: [PATCH 103/912] staging/lustre/obdclass: move debug controls to sysfs debug_peer_on_timeout, dump_on_timeout and dump_on_eviction controls from /proc/sys/lustre to /sys/fs/lustre Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/obdclass/linux/linux-sysctl.c | 28 +++++-------------- drivers/staging/lustre/sysfs-fs-lustre | 26 +++++++++++++++++ 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index bb55a07b6c51..6af1cb2cb386 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -135,29 +135,12 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj, struct attribute *attr, } LUSTRE_RW_ATTR(max_dirty_mb); +LUSTRE_STATIC_UINT_ATTR(debug_peer_on_timeout, &obd_debug_peer_on_timeout); +LUSTRE_STATIC_UINT_ATTR(dump_on_timeout, &obd_dump_on_timeout); +LUSTRE_STATIC_UINT_ATTR(dump_on_eviction, &obd_dump_on_eviction); + #ifdef CONFIG_SYSCTL static struct ctl_table obd_table[] = { - { - .procname = "debug_peer_on_timeout", - .data = &obd_debug_peer_on_timeout, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .procname = "dump_on_timeout", - .data = &obd_dump_on_timeout, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .procname = "dump_on_eviction", - .data = &obd_dump_on_eviction, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, { .procname = "at_min", .data = &at_min, @@ -211,6 +194,9 @@ static struct ctl_table parent_table[] = { static struct attribute *lustre_attrs[] = { &lustre_sattr_timeout.u.attr, &lustre_attr_max_dirty_mb.attr, + &lustre_sattr_debug_peer_on_timeout.u.attr, + &lustre_sattr_dump_on_timeout.u.attr, + &lustre_sattr_dump_on_eviction.u.attr, NULL, }; diff --git a/drivers/staging/lustre/sysfs-fs-lustre b/drivers/staging/lustre/sysfs-fs-lustre index 38d1adcd2335..ea9982bae85d 100644 --- a/drivers/staging/lustre/sysfs-fs-lustre +++ b/drivers/staging/lustre/sysfs-fs-lustre @@ -64,6 +64,32 @@ Description: find some pages to free/writeout. Default 1/2 RAM. Min value 4, max value 9/10 of RAM. +What: /sys/fs/lustre/debug_peer_on_timeout +Date: June 2015 +Contact: "Oleg Drokin" +Description: + Control if lnet debug information should be printed when + an RPC timeout occurs. + 0 disabled (default) + 1 enabled + +What: /sys/fs/lustre/dump_on_timeout +Date: June 2015 +Contact: "Oleg Drokin" +Description: + Controls if Lustre debug log should be dumped when an RPC + timeout occurs. This is useful if yout debug buffer typically + rolls over by the time you notice RPC timeouts. + +What: /sys/fs/lustre/dump_on_eviction +Date: June 2015 +Contact: "Oleg Drokin" +Description: + Controls if Lustre debug log should be dumped when an this + client is evicted from one of the servers. + This is useful if yout debug buffer typically rolls over + by the time you notice the eviction event. + What: /sys/fs/lustre/llite/-/blocksize Date: May 2015 Contact: "Oleg Drokin" From bcef118e7ed67e28edcaab9be9ca11412176c540 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:49 -0400 Subject: [PATCH 104/912] staging/lustre/obdclass: Move AT controls from sysctl to sysfs Adaptive Timeouts controls are being moved from /proc/sys/lustre to /sys/fs/lustre Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/obdclass/linux/linux-sysctl.c | 45 ++++------------ drivers/staging/lustre/sysfs-fs-lustre | 53 +++++++++++++++++++ 2 files changed, 63 insertions(+), 35 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index 6af1cb2cb386..82b3c39214b0 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -138,44 +138,14 @@ LUSTRE_RW_ATTR(max_dirty_mb); LUSTRE_STATIC_UINT_ATTR(debug_peer_on_timeout, &obd_debug_peer_on_timeout); LUSTRE_STATIC_UINT_ATTR(dump_on_timeout, &obd_dump_on_timeout); LUSTRE_STATIC_UINT_ATTR(dump_on_eviction, &obd_dump_on_eviction); +LUSTRE_STATIC_UINT_ATTR(at_min, &at_min); +LUSTRE_STATIC_UINT_ATTR(at_max, &at_max); +LUSTRE_STATIC_UINT_ATTR(at_extra, &at_extra); +LUSTRE_STATIC_UINT_ATTR(at_early_margin, &at_early_margin); +LUSTRE_STATIC_UINT_ATTR(at_history, &at_history); #ifdef CONFIG_SYSCTL static struct ctl_table obd_table[] = { - { - .procname = "at_min", - .data = &at_min, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - .procname = "at_max", - .data = &at_max, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - .procname = "at_extra", - .data = &at_extra, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - .procname = "at_early_margin", - .data = &at_early_margin, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - .procname = "at_history", - .data = &at_history, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, {} }; @@ -197,6 +167,11 @@ static struct attribute *lustre_attrs[] = { &lustre_sattr_debug_peer_on_timeout.u.attr, &lustre_sattr_dump_on_timeout.u.attr, &lustre_sattr_dump_on_eviction.u.attr, + &lustre_sattr_at_min.u.attr, + &lustre_sattr_at_max.u.attr, + &lustre_sattr_at_extra.u.attr, + &lustre_sattr_at_early_margin.u.attr, + &lustre_sattr_at_history.u.attr, NULL, }; diff --git a/drivers/staging/lustre/sysfs-fs-lustre b/drivers/staging/lustre/sysfs-fs-lustre index ea9982bae85d..873e2cf31217 100644 --- a/drivers/staging/lustre/sysfs-fs-lustre +++ b/drivers/staging/lustre/sysfs-fs-lustre @@ -90,6 +90,59 @@ Description: This is useful if yout debug buffer typically rolls over by the time you notice the eviction event. +What: /sys/fs/lustre/at_min +Date: July 2015 +Contact: "Oleg Drokin" +Description: + Controls minimum adaptive timeout in seconds. If you encounter + a case where clients timeout due to server-reported processing + time being too short, you might consider increasing this value. + One common case of this if the underlying network has + unpredictable long delays. + Default: 0 + +What: /sys/fs/lustre/at_max +Date: July 2015 +Contact: "Oleg Drokin" +Description: + Controls maximum adaptive timeout in seconds. If at_max timeout + is reached for an RPC, the RPC will time out. + Some genuinuely slow network hardware might warrant increasing + this value. + Setting this value to 0 disables Adaptive Timeouts + functionality and old-style obd_timeout value is then used. + Default: 600 + +What: /sys/fs/lustre/at_extra +Date: July 2015 +Contact: "Oleg Drokin" +Description: + Controls how much extra time to request for unfinished requests + in processing in seconds. Normally a server-side parameter, it + is also used on the client for responses to various LDLM ASTs + that are handled with a special server thread on the client. + This is a way for the servers to ask the clients not to time + out the request that reached current servicing time estimate + yet and give it some more time. + Default: 30 + +What: /sys/fs/lustre/at_early_margin +Date: July 2015 +Contact: "Oleg Drokin" +Description: + Controls when to send the early reply for requests that are + about to timeout as an offset to the estimated service time in + seconds.. + Default: 5 + +What: /sys/fs/lustre/at_history +Date: July 2015 +Contact: "Oleg Drokin" +Description: + Controls for how many seconds to remember slowest events + encountered by adaptive timeouts code. + Default: 600 + What: /sys/fs/lustre/llite/-/blocksize Date: May 2015 Contact: "Oleg Drokin" From 8952aad1cfc178cae5205546be62f0e22a056f0b Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:50 -0400 Subject: [PATCH 105/912] staging/lustre: Get rid of remaining /proc/sys/lustre plumbing Since all of the variables from /proc/sys/lustre were moved to /sys/fs/lustre, get rid of the remaining infrastructure. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/obd_class.h | 1 - .../lustre/lustre/obdclass/class_obd.c | 1 - .../lustre/obdclass/linux/linux-sysctl.c | 30 ------------------- 3 files changed, 32 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 7dce4eea8575..e1f8b15753f9 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -1870,7 +1870,6 @@ extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c); /* sysctl.c */ extern int obd_sysctl_init(void); -extern void obd_sysctl_clean(void); /* uuid.c */ typedef __u8 class_uuid_t[16]; diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 2e42d1a637f1..edb2c7d525db 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -659,7 +659,6 @@ static void cleanup_obdclass(void) lu_global_fini(); obd_cleanup_caches(); - obd_sysctl_clean(); class_procfs_clean(); diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index 82b3c39214b0..1515163a81a5 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -50,10 +50,6 @@ #include "../../include/obd_support.h" #include "../../include/lprocfs_status.h" -#ifdef CONFIG_SYSCTL -static struct ctl_table_header *obd_table_header; -#endif - struct static_lustre_uintvalue_attr { struct { struct attribute attr; @@ -144,23 +140,6 @@ LUSTRE_STATIC_UINT_ATTR(at_extra, &at_extra); LUSTRE_STATIC_UINT_ATTR(at_early_margin, &at_early_margin); LUSTRE_STATIC_UINT_ATTR(at_history, &at_history); -#ifdef CONFIG_SYSCTL -static struct ctl_table obd_table[] = { - {} -}; - -static struct ctl_table parent_table[] = { - { - .procname = "lustre", - .data = NULL, - .maxlen = 0, - .mode = 0555, - .child = obd_table - }, - {} -}; -#endif - static struct attribute *lustre_attrs[] = { &lustre_sattr_timeout.u.attr, &lustre_attr_max_dirty_mb.attr, @@ -181,18 +160,9 @@ static struct attribute_group lustre_attr_group = { int obd_sysctl_init(void) { -#ifdef CONFIG_SYSCTL - if (!obd_table_header) - obd_table_header = register_sysctl_table(parent_table); -#endif return sysfs_create_group(lustre_kobj, &lustre_attr_group); } void obd_sysctl_clean(void) { -#ifdef CONFIG_SYSCTL - if (obd_table_header) - unregister_sysctl_table(obd_table_header); - obd_table_header = NULL; -#endif } From 0871d551af37c72c308397c16c31bae945e6a79d Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:51 -0400 Subject: [PATCH 106/912] staging/lustre/libcfs: move /proc/sys/lnet to debugfs Parameters in lnet sysctl are of debug quantity, so let's move them to debugfs instead. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/module.c | 90 ++++++++++++------- 1 file changed, 58 insertions(+), 32 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index e60b2e9b9194..bffde77d089d 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -50,6 +50,7 @@ #include #include +#include # define DEBUG_SUBSYSTEM S_LNET @@ -69,10 +70,10 @@ extern struct miscdevice libcfs_dev; extern struct cfs_wi_sched *cfs_sched_rehash; extern void libcfs_init_nidstrings(void); -static int insert_proc(void); -static void remove_proc(void); +static void insert_debugfs(void); +static void remove_debugfs(void); -static struct ctl_table_header *lnet_table_header; +static struct dentry *lnet_debugfs_root; extern char lnet_upcall[1024]; /** * The path of debug log dump upcall script. @@ -428,17 +429,10 @@ static int init_libcfs_module(void) goto cleanup_wi; } - - rc = insert_proc(); - if (rc) { - CERROR("insert_proc: error %d\n", rc); - goto cleanup_crypto; - } + insert_debugfs(); CDEBUG (D_OTHER, "portals setup OK\n"); return 0; - cleanup_crypto: - cfs_crypto_unregister(); cleanup_wi: cfs_wi_shutdown(); cleanup_deregister: @@ -454,7 +448,7 @@ static void exit_libcfs_module(void) { int rc; - remove_proc(); + remove_debugfs(); CDEBUG(D_MALLOC, "before Portals cleanup: kmem %d\n", atomic_read(&libcfs_kmemory)); @@ -935,31 +929,63 @@ static struct ctl_table lnet_table[] = { } }; -static struct ctl_table top_table[] = { - { - .procname = "lnet", - .mode = 0555, - .data = NULL, - .maxlen = 0, - .child = lnet_table, - }, - { - } -}; - -static int insert_proc(void) +static ssize_t lnet_debugfs_read(struct file *filp, char __user *buf, + size_t count, loff_t *ppos) { - if (lnet_table_header == NULL) - lnet_table_header = register_sysctl_table(top_table); - return 0; + struct ctl_table *table = filp->private_data; + int error; + + error = table->proc_handler(table, 0, (void __user *)buf, &count, ppos); + if (!error) + error = count; + + return error; } -static void remove_proc(void) +static ssize_t lnet_debugfs_write(struct file *filp, const char __user *buf, + size_t count, loff_t *ppos) { - if (lnet_table_header != NULL) - unregister_sysctl_table(lnet_table_header); + struct ctl_table *table = filp->private_data; + int error; - lnet_table_header = NULL; + error = table->proc_handler(table, 1, (void __user *)buf, &count, ppos); + if (!error) + error = count; + + return error; +} + +static const struct file_operations lnet_debugfs_file_operations = { + .open = simple_open, + .read = lnet_debugfs_read, + .write = lnet_debugfs_write, + .llseek = default_llseek, +}; + +static void insert_debugfs(void) +{ + struct ctl_table *table; + struct dentry *entry; + + if (lnet_debugfs_root == NULL) + lnet_debugfs_root = debugfs_create_dir("lnet", NULL); + + /* Even if we cannot create, just ignore it altogether) */ + if (IS_ERR_OR_NULL(lnet_debugfs_root)) + return; + + for (table = lnet_table; table->procname; table++) + entry = debugfs_create_file(table->procname, table->mode, + lnet_debugfs_root, table, + &lnet_debugfs_file_operations); +} + +static void remove_debugfs(void) +{ + if (lnet_debugfs_root != NULL) + debugfs_remove_recursive(lnet_debugfs_root); + + lnet_debugfs_root = NULL; } MODULE_VERSION("1.0.0"); From 1b4d97b6c6ca05446ff33843a7b174cdd765df5a Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:52 -0400 Subject: [PATCH 107/912] staging/lustre/libcfs: Remove redundant lnet debugfs variables /proc/sys/lnet/console_ratelimit, debug_path and panic_on_lbug are module parameters with no special magic accessible via /sys/module/libcfs/parameters/libcfs_console_ratelimit, /sys/module/libcfs/parameters/libcfs_debug_file_path and /sys/module/libcfs/parameters/libcfs_panic_on_lbug respectively. As such just replace them with corresponding symlinks Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/module.c | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index bffde77d089d..8a2644600d3e 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -802,13 +802,6 @@ static struct ctl_table lnet_table[] = { .mode = 0644, .proc_handler = &proc_dobitmasks, }, - { - .procname = "console_ratelimit", - .data = &libcfs_console_ratelimit, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, { .procname = "console_max_delay_centisecs", .maxlen = sizeof(int), @@ -828,14 +821,6 @@ static struct ctl_table lnet_table[] = { .proc_handler = &proc_console_backoff }, - { - .procname = "debug_path", - .data = libcfs_debug_file_path_arr, - .maxlen = sizeof(libcfs_debug_file_path_arr), - .mode = 0644, - .proc_handler = &proc_dostring, - }, - { .procname = "cpu_partition_table", .maxlen = 128, @@ -871,13 +856,6 @@ static struct ctl_table lnet_table[] = { .mode = 0444, .proc_handler = &proc_dointvec, }, - { - .procname = "panic_on_lbug", - .data = &libcfs_panic_on_lbug, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, { .procname = "dump_kernel", .maxlen = 256, From 8710427dd68f4dff8976d221e220317cea20ecec Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 6 Jul 2015 12:48:53 -0400 Subject: [PATCH 108/912] staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff module parameter libcfs_console_backoff accessible through /sys/module/libcfs/parameters/libcfs_console_backoff would do the same thing, just add a special "uintpos" parameter type to disallow 0 values too. Also add a symlink to the module parameter variable for backwards compatibility Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/debug.c | 31 +++++++++- drivers/staging/lustre/lustre/libcfs/module.c | 59 ++++++++----------- 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 021c92fa0333..147004cef391 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -82,8 +82,37 @@ module_param(libcfs_console_min_delay, uint, 0644); MODULE_PARM_DESC(libcfs_console_min_delay, "Lustre kernel debug console min delay (jiffies)"); EXPORT_SYMBOL(libcfs_console_min_delay); +static int param_set_uint_minmax(const char *val, + const struct kernel_param *kp, + unsigned int min, unsigned int max) +{ + unsigned int num; + int ret; + + if (!val) + return -EINVAL; + ret = kstrtouint(val, 0, &num); + if (ret == -EINVAL || num < min || num > max) + return -EINVAL; + *((unsigned int *)kp->arg) = num; + return 0; +} + +static int param_set_uintpos(const char *val, const struct kernel_param *kp) +{ + return param_set_uint_minmax(val, kp, 1, -1); +} + +static struct kernel_param_ops param_ops_uintpos = { + .set = param_set_uintpos, + .get = param_get_uint, +}; + +#define param_check_uintpos(name, p) \ + __param_check(name, p, unsigned int) + unsigned int libcfs_console_backoff = CDEBUG_DEFAULT_BACKOFF; -module_param(libcfs_console_backoff, uint, 0644); +module_param(libcfs_console_backoff, uintpos, 0644); MODULE_PARM_DESC(libcfs_console_backoff, "Lustre kernel debug console backoff factor"); EXPORT_SYMBOL(libcfs_console_backoff); diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 8a2644600d3e..8b9ce223fc6f 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -678,34 +678,6 @@ static int proc_console_min_delay_cs(struct ctl_table *table, int write, return rc; } -static int proc_console_backoff(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int rc, backoff; - struct ctl_table dummy = *table; - - dummy.data = &backoff; - dummy.proc_handler = &proc_dointvec; - - if (!write) { /* read */ - backoff = libcfs_console_backoff; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - return rc; - } - - /* write */ - backoff = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - return rc; - if (backoff <= 0) - return -EINVAL; - - libcfs_console_backoff = backoff; - - return rc; -} - static int libcfs_force_lbug(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -814,13 +786,6 @@ static struct ctl_table lnet_table[] = { .mode = 0644, .proc_handler = &proc_console_min_delay_cs }, - { - .procname = "console_backoff", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_backoff - }, - { .procname = "cpu_partition_table", .maxlen = 128, @@ -907,6 +872,23 @@ static struct ctl_table lnet_table[] = { } }; +struct lnet_debugfs_symlink_def { + char *name; + char *target; +}; + +struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { + { "console_ratelimit", + "/sys/module/libcfs/parameters/libcfs_console_ratelimit"}, + { "debug_path", + "/sys/module/libcfs/parameters/libcfs_debug_file_path"}, + { "panic_on_lbug", + "/sys/module/libcfs/parameters/libcfs_panic_on_lbug"}, + { "libcfs_console_backoff", + "/sys/module/libcfs/parameters/libcfs_console_backoff"}, + {}, +}; + static ssize_t lnet_debugfs_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { @@ -944,6 +926,7 @@ static void insert_debugfs(void) { struct ctl_table *table; struct dentry *entry; + struct lnet_debugfs_symlink_def *symlinks; if (lnet_debugfs_root == NULL) lnet_debugfs_root = debugfs_create_dir("lnet", NULL); @@ -956,6 +939,12 @@ static void insert_debugfs(void) entry = debugfs_create_file(table->procname, table->mode, lnet_debugfs_root, table, &lnet_debugfs_file_operations); + + for (symlinks = lnet_debugfs_symlinks; symlinks->name; symlinks++) + entry = debugfs_create_symlink(symlinks->name, + lnet_debugfs_root, + symlinks->target); + } static void remove_debugfs(void) From 323b0b2c1e57d3c089473d755ff9a001d1a6bc8f Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Mon, 6 Jul 2015 12:48:54 -0400 Subject: [PATCH 109/912] staging/lustre/libcfs: Remove redundant enums and sysctl moduleparams /proc/sys/lnet/lnet_memused Remove memory tracking for LNet. Remove redundant enums definition. Signed-off-by: Dmitry Eremin Signed-off-by: Greg Kroah-Hartman --- .../include/linux/libcfs/libcfs_private.h | 28 +------------ .../lustre/lnet/klnds/o2iblnd/o2iblnd.c | 12 ------ .../lustre/lnet/klnds/socklnd/socklnd.c | 5 --- .../lustre/lnet/klnds/socklnd/socklnd_cb.c | 3 +- .../staging/lustre/lnet/lnet/router_proc.c | 11 ----- .../lustre/lustre/include/obd_support.h | 12 ++---- drivers/staging/lustre/lustre/libcfs/debug.c | 3 -- drivers/staging/lustre/lustre/libcfs/module.c | 41 ------------------- .../lustre/lustre/obdclass/class_obd.c | 6 +-- 9 files changed, 9 insertions(+), 112 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index ed37d26eb20d..9544860e3292 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -87,24 +87,6 @@ do { \ lbug_with_loc(&msgdata); \ } while (0) -extern atomic_t libcfs_kmemory; -/* - * Memory - */ - -# define libcfs_kmem_inc(ptr, size) \ -do { \ - atomic_add(size, &libcfs_kmemory); \ -} while (0) - -# define libcfs_kmem_dec(ptr, size) \ -do { \ - atomic_sub(size, &libcfs_kmemory); \ -} while (0) - -# define libcfs_kmem_read() \ - atomic_read(&libcfs_kmemory) - #ifndef LIBCFS_VMALLOC_SIZE #define LIBCFS_VMALLOC_SIZE (2 << PAGE_CACHE_SHIFT) /* 2 pages */ #endif @@ -121,14 +103,9 @@ do { \ if (unlikely((ptr) == NULL)) { \ CERROR("LNET: out of memory at %s:%d (tried to alloc '" \ #ptr "' = %d)\n", __FILE__, __LINE__, (int)(size)); \ - CERROR("LNET: %d total bytes allocated by lnet\n", \ - libcfs_kmem_read()); \ } else { \ memset((ptr), 0, (size)); \ - libcfs_kmem_inc((ptr), (size)); \ - CDEBUG(D_MALLOC, "alloc '" #ptr "': %d at %p (tot %d).\n", \ - (int)(size), (ptr), libcfs_kmem_read()); \ - } \ + } \ } while (0) /** @@ -180,9 +157,6 @@ do { \ "%s:%d\n", s, __FILE__, __LINE__); \ break; \ } \ - libcfs_kmem_dec((ptr), s); \ - CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %d).\n", \ - s, (ptr), libcfs_kmem_read()); \ if (unlikely(s > LIBCFS_VMALLOC_SIZE)) \ vfree(ptr); \ else \ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 4eb24a11b02a..f429d25306c1 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2667,9 +2667,6 @@ static void kiblnd_base_shutdown(void) LASSERT(list_empty(&kiblnd_data.kib_devs)); - CDEBUG(D_MALLOC, "before LND base cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - switch (kiblnd_data.kib_init) { default: LBUG(); @@ -2720,9 +2717,6 @@ static void kiblnd_base_shutdown(void) if (kiblnd_data.kib_scheds != NULL) cfs_percpt_free(kiblnd_data.kib_scheds); - CDEBUG(D_MALLOC, "after LND base cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - kiblnd_data.kib_init = IBLND_INIT_NOTHING; module_put(THIS_MODULE); } @@ -2739,9 +2733,6 @@ void kiblnd_shutdown(lnet_ni_t *ni) if (net == NULL) goto out; - CDEBUG(D_MALLOC, "before LND net cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - write_lock_irqsave(g_lock, flags); net->ibn_shutdown = 1; write_unlock_irqrestore(g_lock, flags); @@ -2786,9 +2777,6 @@ void kiblnd_shutdown(lnet_ni_t *ni) break; } - CDEBUG(D_MALLOC, "after LND net cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - net->ibn_init = IBLND_INIT_NOTHING; ni->ni_data = NULL; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 4128a92218a9..d8bfcadd184a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -2252,8 +2252,6 @@ ksocknal_base_shutdown(void) int i; int j; - CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); LASSERT(ksocknal_data.ksnd_nnets == 0); switch (ksocknal_data.ksnd_init) { @@ -2331,9 +2329,6 @@ ksocknal_base_shutdown(void) break; } - CDEBUG(D_MALLOC, "after NAL cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - module_put(THIS_MODULE); } diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index fe2a83a540cd..0d5aac6a2bb3 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -526,8 +526,7 @@ ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t *tx) counter++; /* exponential backoff warnings */ if ((counter & (-counter)) == counter) - CWARN("%u ENOMEM tx %p (%u allocated)\n", - counter, conn, atomic_read(&libcfs_kmemory)); + CWARN("%u ENOMEM tx %p\n", counter, conn); /* Queue on ksnd_enomem_conns for retry after a timeout */ spin_lock_bh(&ksocknal_data.ksnd_reaper_lock); diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c index ee902dc43823..40f418b82960 100644 --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -32,17 +32,6 @@ static struct ctl_table_header *lnet_table_header; -#define CTL_LNET (0x100) -enum { - PSDEV_LNET_STATS = 100, - PSDEV_LNET_ROUTES, - PSDEV_LNET_ROUTERS, - PSDEV_LNET_PEERS, - PSDEV_LNET_BUFFERS, - PSDEV_LNET_NIS, - PSDEV_LNET_PTL_ROTOR, -}; - #define LNET_LOFFT_BITS (sizeof(loff_t) * 8) /* * NB: max allowed LNET_CPT_BITS is 8 on 64-bit system and 2 on 32-bit system diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index f6b369206ace..88e16717e854 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -501,8 +501,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, #define OBD_FAIL_ONCE CFS_FAIL_ONCE #define OBD_FAILED CFS_FAILED -extern atomic_t libcfs_kmemory; - extern void obd_update_maxusage(void); #define obd_memory_add(size) \ @@ -618,8 +616,8 @@ do { \ if (unlikely((ptr) == NULL)) { \ CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \ (int)(size)); \ - CERROR("%llu total bytes allocated by Lustre, %d by LNET\n", \ - obd_memory_sum(), atomic_read(&libcfs_kmemory)); \ + CERROR("%llu total bytes allocated by Lustre\n", \ + obd_memory_sum()); \ } else { \ OBD_ALLOC_POST(ptr, size, "vmalloced"); \ } \ @@ -765,12 +763,10 @@ do { \ "failed\n", (int)1, \ (__u64)(1 << PAGE_CACHE_SHIFT)); \ CERROR("%llu total bytes and %llu total pages " \ - "(%llu bytes) allocated by Lustre, " \ - "%d total bytes by LNET\n", \ + "(%llu bytes) allocated by Lustre\n", \ obd_memory_sum(), \ obd_pages_sum() << PAGE_CACHE_SHIFT, \ - obd_pages_sum(), \ - atomic_read(&libcfs_kmemory)); \ + obd_pages_sum()); \ } else { \ obd_pages_add(0); \ CDEBUG(D_MALLOC, "alloc_pages '" #ptr "': %d page(s) / " \ diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 147004cef391..98075529cc53 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -136,9 +136,6 @@ module_param(libcfs_panic_on_lbug, uint, 0644); MODULE_PARM_DESC(libcfs_panic_on_lbug, "Lustre kernel panic on LBUG"); EXPORT_SYMBOL(libcfs_panic_on_lbug); -atomic_t libcfs_kmemory = ATOMIC_INIT(0); -EXPORT_SYMBOL(libcfs_kmemory); - static wait_queue_head_t debug_ctlwq; char libcfs_debug_file_path_arr[PATH_MAX] = LIBCFS_DEBUG_FILE_PATH_DEFAULT; diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 8b9ce223fc6f..95fa846095ee 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -80,33 +80,6 @@ extern char lnet_upcall[1024]; */ extern char lnet_debug_log_upcall[1024]; -#define CTL_LNET (0x100) - -enum { - PSDEV_DEBUG = 1, /* control debugging */ - PSDEV_SUBSYSTEM_DEBUG, /* control debugging */ - PSDEV_PRINTK, /* force all messages to console */ - PSDEV_CONSOLE_RATELIMIT, /* ratelimit console messages */ - PSDEV_CONSOLE_MAX_DELAY_CS, /* maximum delay over which we skip messages */ - PSDEV_CONSOLE_MIN_DELAY_CS, /* initial delay over which we skip messages */ - PSDEV_CONSOLE_BACKOFF, /* delay increase factor */ - PSDEV_DEBUG_PATH, /* crashdump log location */ - PSDEV_DEBUG_DUMP_PATH, /* crashdump tracelog location */ - PSDEV_CPT_TABLE, /* information about cpu partitions */ - PSDEV_LNET_UPCALL, /* User mode upcall script */ - PSDEV_LNET_MEMUSED, /* bytes currently PORTAL_ALLOCated */ - PSDEV_LNET_CATASTROPHE, /* if we have LBUGged or panic'd */ - PSDEV_LNET_PANIC_ON_LBUG, /* flag to panic on LBUG */ - PSDEV_LNET_DUMP_KERNEL, /* snapshot kernel debug buffer to file */ - PSDEV_LNET_DAEMON_FILE, /* spool kernel debug buffer to file */ - PSDEV_LNET_DEBUG_MB, /* size of debug buffer */ - PSDEV_LNET_DEBUG_LOG_UPCALL, /* debug log upcall script */ - PSDEV_LNET_WATCHDOG_RATELIMIT, /* ratelimit watchdog messages */ - PSDEV_LNET_FORCE_LBUG, /* hook to force an LBUG */ - PSDEV_LNET_FAIL_LOC, /* control test failures instrumentation */ - PSDEV_LNET_FAIL_VAL, /* userdata for fail loc */ -}; - static void kportal_memhog_free (struct libcfs_device_userstate *ldu) { struct page **level0p = &ldu->ldu_memhog_root_page; @@ -450,9 +423,6 @@ static void exit_libcfs_module(void) remove_debugfs(); - CDEBUG(D_MALLOC, "before Portals cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - if (cfs_sched_rehash != NULL) { cfs_wi_sched_destroy(cfs_sched_rehash); cfs_sched_rehash = NULL; @@ -467,10 +437,6 @@ static void exit_libcfs_module(void) cfs_cpu_fini(); - if (atomic_read(&libcfs_kmemory) != 0) - CERROR("Portals memory leaked: %d bytes\n", - atomic_read(&libcfs_kmemory)); - rc = libcfs_debug_cleanup(); if (rc) pr_err("LustreError: libcfs_debug_cleanup: %d\n", rc); @@ -807,13 +773,6 @@ static struct ctl_table lnet_table[] = { .mode = 0644, .proc_handler = &proc_dostring, }, - { - .procname = "lnet_memused", - .data = (int *)&libcfs_kmemory.counter, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec, - }, { .procname = "catastrophe", .data = &libcfs_catastrophe, diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index edb2c7d525db..2c705d76211f 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -140,11 +140,11 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, CERROR("%s%salloc of %s (%llu bytes) failed at %s:%d\n", ptr ? "force " :"", type, name, (__u64)size, file, line); - CERROR("%llu total bytes and %llu total pages (%llu bytes) allocated by Lustre, %d total bytes by LNET\n", + CERROR("%llu total bytes and %llu total pages" + " (%llu bytes) allocated by Lustre\n", obd_memory_sum(), obd_pages_sum() << PAGE_CACHE_SHIFT, - obd_pages_sum(), - atomic_read(&libcfs_kmemory)); + obd_pages_sum()); return 1; } return 0; From 90c94b564265474cffe55888ce25f45ce0ce4bb5 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Mon, 6 Jul 2015 12:48:55 -0400 Subject: [PATCH 110/912] staging/lustre/libcfs: Remove unneeded lnet watchdog_ratelimit sysctl It is no longer used anywhere. Signed-off-by: Dmitry Eremin Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/libcfs/libcfs_debug.h | 1 - drivers/staging/lustre/lustre/libcfs/debug.c | 3 --- drivers/staging/lustre/lustre/libcfs/module.c | 12 ------------ 3 files changed, 16 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 8251ac932e37..a3aa644154e2 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -50,7 +50,6 @@ extern unsigned int libcfs_stack; extern unsigned int libcfs_debug; extern unsigned int libcfs_printk; extern unsigned int libcfs_console_ratelimit; -extern unsigned int libcfs_watchdog_ratelimit; extern unsigned int libcfs_console_max_delay; extern unsigned int libcfs_console_min_delay; extern unsigned int libcfs_console_backoff; diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 98075529cc53..5ae7b6515189 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -128,9 +128,6 @@ EXPORT_SYMBOL(portal_enter_debugger); unsigned int libcfs_catastrophe; EXPORT_SYMBOL(libcfs_catastrophe); -unsigned int libcfs_watchdog_ratelimit = 300; -EXPORT_SYMBOL(libcfs_watchdog_ratelimit); - unsigned int libcfs_panic_on_lbug = 1; module_param(libcfs_panic_on_lbug, uint, 0644); MODULE_PARM_DESC(libcfs_panic_on_lbug, "Lustre kernel panic on LBUG"); diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 95fa846095ee..8e228ae2c745 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -511,9 +511,6 @@ static int proc_dobitmasks(struct ctl_table *table, int write, __proc_dobitmasks); } -static int min_watchdog_ratelimit; /* disable ratelimiting */ -static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */ - static int __proc_dump_kernel(void *data, int write, loff_t pos, void __user *buffer, int nob) { @@ -797,15 +794,6 @@ static struct ctl_table lnet_table[] = { .mode = 0644, .proc_handler = &proc_debug_mb, }, - { - .procname = "watchdog_ratelimit", - .data = &libcfs_watchdog_ratelimit, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec_minmax, - .extra1 = &min_watchdog_ratelimit, - .extra2 = &max_watchdog_ratelimit, - }, { .procname = "force_lbug", .data = NULL, From db07a4c968fb5045c382be493bd2bd3ba8412b3e Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Wed, 8 Jul 2015 13:34:36 +0000 Subject: [PATCH 111/912] staging: lustre: remove dead code This patch removes commented code. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 5592d32a1a95..c72035e048aa 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1837,12 +1837,6 @@ static int try_to_add_extent_for_io(struct client_obd *cli, oap2 = list_first_entry(&tmp->oe_pages, struct osc_async_page, oap_pending_item); EASSERT(tmp->oe_owner == current, tmp); -#if 0 - if (overlapped(tmp, ext)) { - OSC_EXTENT_DUMP(D_ERROR, tmp, "overlapped %p.\n", ext); - EASSERT(0, ext); - } -#endif if (oap2cl_page(oap)->cp_type != oap2cl_page(oap2)->cp_type) { CDEBUG(D_CACHE, "Do not permit different type of IO" " for a same RPC\n"); From 9e0e332a7a4ac8a00ba06b536ecda8582b5a0814 Mon Sep 17 00:00:00 2001 From: Matt Mooney Date: Wed, 8 Jul 2015 09:21:11 -0700 Subject: [PATCH 112/912] staging: lustre: make ptlrpc_init static fix sparse warning in lustre/ptlrpc/ptlrpc_module.c:54:12: warning: symbol 'ptlrpc_init' was not declared. Should it be static? The __init macro is moved before the function name to match standard usage. Signed-off-by: Matt Mooney Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c index 5268887ca6b3..ae99180d6036 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c @@ -51,7 +51,7 @@ extern spinlock_t ptlrpc_rs_debug_lock; extern struct mutex pinger_mutex; extern struct mutex ptlrpcd_mutex; -__init int ptlrpc_init(void) +static int __init ptlrpc_init(void) { int rc, cleanup_phase = 0; From 574150f0d275c4caf04156ecda6f9f988d6f5ffd Mon Sep 17 00:00:00 2001 From: Anders Fridlund Date: Thu, 9 Jul 2015 11:02:09 +0200 Subject: [PATCH 113/912] staging:lustre: fix "space required after that ', '" error in cl_page.c This is a patch to the cl_page.c file that fixes a "space required after that ','" error found by the checkpatch.pl tool. Signed-off-by: Anders Fridlund Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index a7f3032f34dd..282ae734fba2 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -1425,7 +1425,7 @@ void cl_page_clip(const struct lu_env *env, struct cl_page *pg, CL_PAGE_HEADER(D_TRACE, env, pg, "%d %d\n", from, to); CL_PAGE_INVOID(env, pg, CL_PAGE_OP(cpo_clip), (const struct lu_env *, - const struct cl_page_slice *,int, int), + const struct cl_page_slice *, int, int), from, to); } EXPORT_SYMBOL(cl_page_clip); From 5d3d44729775998ad9efb47f2946378c764854a4 Mon Sep 17 00:00:00 2001 From: Kris Baumann Date: Thu, 9 Jul 2015 22:12:48 +0200 Subject: [PATCH 114/912] Staging: lustre: lustre: obdclass: genops: fixed brace coding style issues Fixed several brace coding style issues. Signed-off-by: Kris Baumann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/genops.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index a42c9f9209c5..d36697d2c47f 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -71,9 +71,8 @@ static struct obd_device *obd_device_alloc(void) struct obd_device *obd; OBD_SLAB_ALLOC_PTR_GFP(obd, obd_device_cachep, GFP_NOFS); - if (obd != NULL) { + if (obd != NULL) obd->obd_magic = OBD_DEVICE_MAGIC; - } return obd; } @@ -294,7 +293,7 @@ struct obd_device *class_newdev(const char *type_name, const char *name) } type = class_get_type(type_name); - if (type == NULL){ + if (type == NULL) { CERROR("OBD: unknown type: %s\n", type_name); return ERR_PTR(-ENODEV); } @@ -999,7 +998,8 @@ void class_import_put(struct obd_import *imp) } EXPORT_SYMBOL(class_import_put); -static void init_imp_at(struct imp_at *at) { +static void init_imp_at(struct imp_at *at) +{ int i; at_init(&at->iat_net_latency, 0, 0); for (i = 0; i < IMP_AT_MAX_PORTALS; i++) { @@ -1642,7 +1642,8 @@ static int obd_zombie_impexp_check(void *arg) /** * Add export to the obd_zombie thread and notify it. */ -static void obd_zombie_export_add(struct obd_export *exp) { +static void obd_zombie_export_add(struct obd_export *exp) +{ spin_lock(&exp->exp_obd->obd_dev_lock); LASSERT(!list_empty(&exp->exp_obd_chain)); list_del_init(&exp->exp_obd_chain); @@ -1658,7 +1659,8 @@ static void obd_zombie_export_add(struct obd_export *exp) { /** * Add import to the obd_zombie thread and notify it. */ -static void obd_zombie_import_add(struct obd_import *imp) { +static void obd_zombie_import_add(struct obd_import *imp) +{ LASSERT(imp->imp_sec == NULL); LASSERT(imp->imp_rq_pool == NULL); spin_lock(&obd_zombie_impexp_lock); From 1b2d5577c507d35cc2ea205eba0b101003cc2fe9 Mon Sep 17 00:00:00 2001 From: Ronit Halder Date: Fri, 10 Jul 2015 23:05:39 +0530 Subject: [PATCH 115/912] Staging: lustre: fixed a blank line after declarations coding style issue Fixed a blank line after declarations coding style issue Signed-off-by: Ronit Halder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_merge.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index b7e7bfabe382..dd1cf3d2d039 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -123,6 +123,7 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, if (shrink) { for (; stripe < lsm->lsm_stripe_count; stripe++) { struct lov_oinfo *loi = lsm->lsm_oinfo[stripe]; + kms = lov_size_to_stripe(lsm, size, stripe); CDEBUG(D_INODE, "stripe %d KMS %sing %llu->%llu\n", From 3e9f88e68801fe7f862d7ab57041a68f91ce9b5a Mon Sep 17 00:00:00 2001 From: Perry Hooker Date: Mon, 13 Jul 2015 17:33:47 -0600 Subject: [PATCH 116/912] staging: lustre: libcfs: move assignment out of conditional Found by checkpatch.pl Signed-off-by: Perry Hooker Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/libcfs/libcfs_fail.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h index eea55d94e6be..aa69c6a33d19 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h @@ -79,14 +79,16 @@ static inline int cfs_fail_check_set(__u32 id, __u32 value, { int ret = 0; - if (unlikely(CFS_FAIL_PRECHECK(id) && - (ret = __cfs_fail_check_set(id, value, set)))) { - if (quiet) { - CDEBUG(D_INFO, "*** cfs_fail_loc=%x, val=%u***\n", - id, value); - } else { - LCONSOLE_INFO("*** cfs_fail_loc=%x, val=%u***\n", - id, value); + if (unlikely(CFS_FAIL_PRECHECK(id))) { + ret = __cfs_fail_check_set(id, value, set); + if (ret) { + if (quiet) { + CDEBUG(D_INFO, "*** cfs_fail_loc=%x, val=%u***\n", + id, value); + } else { + LCONSOLE_INFO("*** cfs_fail_loc=%x, val=%u***\n", + id, value); + } } } From 8dc08446d0671709bdec9e037845b014e33663b1 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 13 Jul 2015 23:17:54 -0400 Subject: [PATCH 117/912] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb It's just a fancy libcfs_debug_mb module parameter wrapper, so just add debug buffer size check and resizing and the same functionality now would be accessible via /sys/module/libcfs/parameters/libcfs_debug_mb Also add a symlink for backwards compatibility. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/debug.c | 40 ++++++++++++++++++- drivers/staging/lustre/lustre/libcfs/module.c | 32 +-------------- .../staging/lustre/lustre/libcfs/tracefile.c | 12 ------ .../staging/lustre/lustre/libcfs/tracefile.h | 1 - 4 files changed, 40 insertions(+), 45 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 5ae7b6515189..995a1e3353ad 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -57,8 +57,42 @@ module_param(libcfs_debug, int, 0644); MODULE_PARM_DESC(libcfs_debug, "Lustre kernel debug mask"); EXPORT_SYMBOL(libcfs_debug); +static int libcfs_param_debug_mb_set(const char *val, + const struct kernel_param *kp) +{ + int rc; + unsigned num; + + rc = kstrtouint(val, 0, &num); + if (rc < 0) + return rc; + + if (!*((unsigned int *)kp->arg)) { + *((unsigned int *)kp->arg) = num; + return 0; + } + + rc = cfs_trace_set_debug_mb(num); + + if (!rc) + *((unsigned int *)kp->arg) = cfs_trace_get_debug_mb(); + + return rc; +} + +/* While debug_mb setting look like unsigned int, in fact + * it needs quite a bunch of extra processing, so we define special + * debugmb parameter type with corresponding methods to handle this case */ +static struct kernel_param_ops param_ops_debugmb = { + .set = libcfs_param_debug_mb_set, + .get = param_get_uint, +}; + +#define param_check_debugmb(name, p) \ + __param_check(name, p, unsigned int) + static unsigned int libcfs_debug_mb; -module_param(libcfs_debug_mb, uint, 0644); +module_param(libcfs_debug_mb, debugmb, 0644); MODULE_PARM_DESC(libcfs_debug_mb, "Total debug buffer size."); EXPORT_SYMBOL(libcfs_debug_mb); @@ -437,8 +471,10 @@ int libcfs_debug_init(unsigned long bufsize) } rc = cfs_tracefile_init(max); - if (rc == 0) + if (rc == 0) { libcfs_register_panic_notifier(); + libcfs_debug_mb = cfs_trace_get_debug_mb(); + } return rc; } diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 8e228ae2c745..acfe7780ede8 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -550,31 +550,6 @@ static int proc_daemon_file(struct ctl_table *table, int write, __proc_daemon_file); } -static int __proc_debug_mb(void *data, int write, - loff_t pos, void __user *buffer, int nob) -{ - if (!write) { - char tmpstr[32]; - int len = snprintf(tmpstr, sizeof(tmpstr), "%d", - cfs_trace_get_debug_mb()); - - if (pos >= len) - return 0; - - return cfs_trace_copyout_string(buffer, nob, tmpstr + pos, - "\n"); - } - - return cfs_trace_set_debug_mb_usrstr(buffer, nob); -} - -static int proc_debug_mb(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - return proc_call_handler(table->data, write, ppos, buffer, lenp, - __proc_debug_mb); -} - static int proc_console_max_delay_cs(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -789,11 +764,6 @@ static struct ctl_table lnet_table[] = { .maxlen = 256, .proc_handler = &proc_daemon_file, }, - { - .procname = "debug_mb", - .mode = 0644, - .proc_handler = &proc_debug_mb, - }, { .procname = "force_lbug", .data = NULL, @@ -833,6 +803,8 @@ struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { "/sys/module/libcfs/parameters/libcfs_panic_on_lbug"}, { "libcfs_console_backoff", "/sys/module/libcfs/parameters/libcfs_console_backoff"}, + { "debug_mb", + "/sys/module/libcfs/parameters/libcfs_debug_mb"}, {}, }; diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index 6ee2adcf8890..effa2af58c13 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -937,18 +937,6 @@ int cfs_trace_set_debug_mb(int mb) return 0; } -int cfs_trace_set_debug_mb_usrstr(void __user *usr_str, int usr_str_nob) -{ - char str[32]; - int rc; - - rc = cfs_trace_copyin_string(str, sizeof(str), usr_str, usr_str_nob); - if (rc < 0) - return rc; - - return cfs_trace_set_debug_mb(simple_strtoul(str, NULL, 0)); -} - int cfs_trace_get_debug_mb(void) { int i; diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h b/drivers/staging/lustre/lustre/libcfs/tracefile.h index 0601476e1dc3..8d993f4d24c8 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.h +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h @@ -77,7 +77,6 @@ int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob); int cfs_trace_daemon_command(char *str); int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob); int cfs_trace_set_debug_mb(int mb); -int cfs_trace_set_debug_mb_usrstr(void __user *usr_str, int usr_str_nob); int cfs_trace_get_debug_mb(void); extern void libcfs_debug_dumplog_internal(void *arg); From 35ca907d245e8c218f39b6ed8bd6a1c656d056cc Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Mon, 13 Jul 2015 23:17:55 -0400 Subject: [PATCH 118/912] staging/lustre/libcfs: get rid of debugfs/lnet/console_{min, max}_delay_centisecs They are just fancy module parameters wrappers, so just the same functionality now would be accessible via /sys/module/libcfs/parameters/libcfs_console_{min,max}_delay Also install compatibility symlinks Signed-off-by: Dmitry Eremin Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/debug.c | 71 ++++++++++++++-- drivers/staging/lustre/lustre/libcfs/module.c | 82 +------------------ 2 files changed, 69 insertions(+), 84 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 995a1e3353ad..1cc714caaba1 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -106,16 +106,75 @@ module_param(libcfs_console_ratelimit, uint, 0644); MODULE_PARM_DESC(libcfs_console_ratelimit, "Lustre kernel debug console ratelimit (0 to disable)"); EXPORT_SYMBOL(libcfs_console_ratelimit); -unsigned int libcfs_console_max_delay; -module_param(libcfs_console_max_delay, uint, 0644); -MODULE_PARM_DESC(libcfs_console_max_delay, "Lustre kernel debug console max delay (jiffies)"); -EXPORT_SYMBOL(libcfs_console_max_delay); +static int param_set_delay_minmax(const char *val, + const struct kernel_param *kp, + long min, long max) +{ + long d; + int sec; + int rc; + rc = kstrtoint(val, 0, &sec); + if (rc) + return -EINVAL; + + d = cfs_time_seconds(sec) / 100; + if (d < min || d > max) + return -EINVAL; + + *((unsigned int *)kp->arg) = d; + + return 0; +} + +static int param_get_delay(char *buffer, const struct kernel_param *kp) +{ + unsigned int d = *(unsigned int *)kp->arg; + + return sprintf(buffer, "%u", (unsigned int)cfs_duration_sec(d * 100)); +} + +unsigned int libcfs_console_max_delay; +EXPORT_SYMBOL(libcfs_console_max_delay); unsigned int libcfs_console_min_delay; -module_param(libcfs_console_min_delay, uint, 0644); -MODULE_PARM_DESC(libcfs_console_min_delay, "Lustre kernel debug console min delay (jiffies)"); EXPORT_SYMBOL(libcfs_console_min_delay); +static int param_set_console_max_delay(const char *val, + const struct kernel_param *kp) +{ + return param_set_delay_minmax(val, kp, + libcfs_console_min_delay, INT_MAX); +} + +static struct kernel_param_ops param_ops_console_max_delay = { + .set = param_set_console_max_delay, + .get = param_get_delay, +}; + +#define param_check_console_max_delay(name, p) \ + __param_check(name, p, unsigned int) + +module_param(libcfs_console_max_delay, console_max_delay, 0644); +MODULE_PARM_DESC(libcfs_console_max_delay, "Lustre kernel debug console max delay (jiffies)"); + +static int param_set_console_min_delay(const char *val, + const struct kernel_param *kp) +{ + return param_set_delay_minmax(val, kp, + 1, libcfs_console_max_delay); +} + +static struct kernel_param_ops param_ops_console_min_delay = { + .set = param_set_console_min_delay, + .get = param_get_delay, +}; + +#define param_check_console_min_delay(name, p) \ + __param_check(name, p, unsigned int) + +module_param(libcfs_console_min_delay, console_min_delay, 0644); +MODULE_PARM_DESC(libcfs_console_min_delay, "Lustre kernel debug console min delay (jiffies)"); + static int param_set_uint_minmax(const char *val, const struct kernel_param *kp, unsigned int min, unsigned int max) diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index acfe7780ede8..0ed26580f5ea 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -550,72 +550,6 @@ static int proc_daemon_file(struct ctl_table *table, int write, __proc_daemon_file); } -static int proc_console_max_delay_cs(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, - loff_t *ppos) -{ - int rc, max_delay_cs; - struct ctl_table dummy = *table; - long d; - - dummy.data = &max_delay_cs; - dummy.proc_handler = &proc_dointvec; - - if (!write) { /* read */ - max_delay_cs = cfs_duration_sec(libcfs_console_max_delay * 100); - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - return rc; - } - - /* write */ - max_delay_cs = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - return rc; - if (max_delay_cs <= 0) - return -EINVAL; - - d = cfs_time_seconds(max_delay_cs) / 100; - if (d == 0 || d < libcfs_console_min_delay) - return -EINVAL; - libcfs_console_max_delay = d; - - return rc; -} - -static int proc_console_min_delay_cs(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, - loff_t *ppos) -{ - int rc, min_delay_cs; - struct ctl_table dummy = *table; - long d; - - dummy.data = &min_delay_cs; - dummy.proc_handler = &proc_dointvec; - - if (!write) { /* read */ - min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100); - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - return rc; - } - - /* write */ - min_delay_cs = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - return rc; - if (min_delay_cs <= 0) - return -EINVAL; - - d = cfs_time_seconds(min_delay_cs) / 100; - if (d == 0 || d > libcfs_console_max_delay) - return -EINVAL; - libcfs_console_min_delay = d; - - return rc; -} - static int libcfs_force_lbug(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -712,18 +646,6 @@ static struct ctl_table lnet_table[] = { .mode = 0644, .proc_handler = &proc_dobitmasks, }, - { - .procname = "console_max_delay_centisecs", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_max_delay_cs - }, - { - .procname = "console_min_delay_centisecs", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_min_delay_cs - }, { .procname = "cpu_partition_table", .maxlen = 128, @@ -805,6 +727,10 @@ struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { "/sys/module/libcfs/parameters/libcfs_console_backoff"}, { "debug_mb", "/sys/module/libcfs/parameters/libcfs_debug_mb"}, + { "console_min_delay_centisecs", + "/sys/module/libcfs/parameters/libcfs_console_min_delay"}, + { "console_max_delay_centisecs", + "/sys/module/libcfs/parameters/libcfs_console_max_delay"}, {}, }; From 96d1865d344a966ab534fb16c55e8dd4601efb71 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Mon, 13 Jul 2015 23:17:56 -0400 Subject: [PATCH 119/912] staging/lustre/libcfs: remove unused portal_enter_debugger variable Remove portal_enter_debugger because it's not used any more. Signed-off-by: Dmitry Eremin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/debug.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 1cc714caaba1..63468870f230 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -215,9 +215,6 @@ EXPORT_SYMBOL(libcfs_debug_binary); unsigned int libcfs_stack = 3 * THREAD_SIZE / 4; EXPORT_SYMBOL(libcfs_stack); -static unsigned int portal_enter_debugger; -EXPORT_SYMBOL(portal_enter_debugger); - unsigned int libcfs_catastrophe; EXPORT_SYMBOL(libcfs_catastrophe); From aa66d6f87f300b15ac2efdcde9e198bf5a9020ce Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 13 Jul 2015 23:17:57 -0400 Subject: [PATCH 120/912] staging/lustre/libcfs: Fix kstrtouint return value check fix Apparently kstrtouint could return not just -EINVAL, but also -ERANGE, so make sure we just check the return value for something negative. Noticed by Dan Carpenter Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 63468870f230..e93f556fac0d 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -185,7 +185,7 @@ static int param_set_uint_minmax(const char *val, if (!val) return -EINVAL; ret = kstrtouint(val, 0, &num); - if (ret == -EINVAL || num < min || num > max) + if (ret < 0 || num < min || num > max) return -EINVAL; *((unsigned int *)kp->arg) = num; return 0; From 5f37ac9343db1d0d3a9028d963eafe834053a0fb Mon Sep 17 00:00:00 2001 From: Lukasz Janyst Date: Tue, 14 Jul 2015 17:22:21 +0200 Subject: [PATCH 121/912] staging: lustre: fix whitespace coding style issues in libcfs/module.c This is a patch to the libcfs/module.c file fixing whitespace warnings found by checkpatch.pl. Signed-off-by: Lukasz Janyst Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/module.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 0ed26580f5ea..1ab4232e0705 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -80,7 +80,7 @@ extern char lnet_upcall[1024]; */ extern char lnet_debug_log_upcall[1024]; -static void kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free(struct libcfs_device_userstate *ldu) { struct page **level0p = &ldu->ldu_memhog_root_page; struct page **level1p; @@ -120,7 +120,7 @@ static void kportal_memhog_free (struct libcfs_device_userstate *ldu) *level0p = NULL; } - LASSERT (ldu->ldu_memhog_pages == 0); + LASSERT(ldu->ldu_memhog_pages == 0); } static int kportal_memhog_alloc(struct libcfs_device_userstate *ldu, int npages, @@ -132,8 +132,8 @@ static int kportal_memhog_alloc(struct libcfs_device_userstate *ldu, int npages, int count1; int count2; - LASSERT (ldu->ldu_memhog_pages == 0); - LASSERT (ldu->ldu_memhog_root_page == NULL); + LASSERT(ldu->ldu_memhog_pages == 0); + LASSERT(ldu->ldu_memhog_root_page == NULL); if (npages < 0) return -EINVAL; @@ -312,7 +312,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd, if (err != -EINVAL) { if (err == 0) err = libcfs_ioctl_popdata(arg, - data, sizeof (*data)); + data, sizeof(*data)); break; } } @@ -404,7 +404,7 @@ static int init_libcfs_module(void) insert_debugfs(); - CDEBUG (D_OTHER, "portals setup OK\n"); + CDEBUG(D_OTHER, "portals setup OK\n"); return 0; cleanup_wi: cfs_wi_shutdown(); From a5cb88804d51b9d272d1d15ea348a244ba4d26c3 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Tue, 14 Jul 2015 09:35:42 +0200 Subject: [PATCH 122/912] staging: lustre: Deletion of unnecessary checks before three function calls The following functions test whether their argument is NULL and then return immediately. * kfree * ll_file_data_put * ptlrpc_connection_put Thus the test around such calls is not needed. This issue was detected by using the Coccinelle software. See also a previous update suggestion: "remove unneeded null test before free" by Julia Lawall https://lkml.org/lkml/2015/5/1/498 https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg878600.html Signed-off-by: Markus Elfring Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 3 +-- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 6 ++---- drivers/staging/lustre/lustre/ptlrpc/service.c | 4 +--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index e01a47c0b80a..dcd0c6d65efb 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -702,8 +702,7 @@ out_och_free: out_openerr: if (opendir_set != 0) ll_stop_statahead(inode, lli->lli_opendir_key); - if (fd != NULL) - ll_file_data_put(fd); + ll_file_data_put(fd); } else { ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_OPEN, 1); } diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 25139885b5a7..ab4839cad939 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1114,7 +1114,7 @@ void ll_clear_inode(struct inode *inode) if (lli->lli_mds_read_och) ll_md_real_close(inode, FMODE_READ); - if (S_ISLNK(inode->i_mode) && lli->lli_symlink_name) { + if (S_ISLNK(inode->i_mode)) { kfree(lli->lli_symlink_name); lli->lli_symlink_name = NULL; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index c9b8481dd384..1eae3896c037 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -555,14 +555,12 @@ static int import_select_connection(struct obd_import *imp) imp_conn->oic_last_attempt = cfs_time_current_64(); /* switch connection, don't mind if it's same as the current one */ - if (imp->imp_connection) - ptlrpc_connection_put(imp->imp_connection); + ptlrpc_connection_put(imp->imp_connection); imp->imp_connection = ptlrpc_connection_addref(imp_conn->oic_conn); dlmexp = class_conn2export(&imp->imp_dlm_handle); LASSERT(dlmexp != NULL); - if (dlmexp->exp_connection) - ptlrpc_connection_put(dlmexp->exp_connection); + ptlrpc_connection_put(dlmexp->exp_connection); dlmexp->exp_connection = ptlrpc_connection_addref(imp_conn->oic_conn); class_export_put(dlmexp); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 56a86317ded7..cf9477d4749b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -2826,9 +2826,7 @@ void ptlrpc_hr_fini(void) ptlrpc_stop_hr_threads(); cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) { - if (hrp->hrp_thrs != NULL) { - kfree(hrp->hrp_thrs); - } + kfree(hrp->hrp_thrs); } cfs_percpt_free(ptlrpc_hr.hr_partitions); From 5605b188833fc60c297e0a3927e274349a172f59 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 13 Jul 2015 15:50:30 +0300 Subject: [PATCH 123/912] staging: android: ion: reorder variable definitions Prevents false positive "missing empty line after a definition" checkpatch warning. Signed-off-by: Dmitry Kalinkin Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 6f4811263557..6c922c7817f9 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1103,10 +1103,10 @@ static struct dma_buf_ops dma_buf_ops = { struct dma_buf *ion_share_dma_buf(struct ion_client *client, struct ion_handle *handle) { + DEFINE_DMA_BUF_EXPORT_INFO(exp_info); struct ion_buffer *buffer; struct dma_buf *dmabuf; bool valid_handle; - DEFINE_DMA_BUF_EXPORT_INFO(exp_info); mutex_lock(&client->lock); valid_handle = ion_handle_validate(client, handle); From cef853810edcfffb9203b59637eebb916cfaa759 Mon Sep 17 00:00:00 2001 From: "Guillermo O. Freschi" Date: Sun, 21 Jun 2015 05:28:55 -0300 Subject: [PATCH 124/912] staging: android: ion_chunk_heap.c: Fixed line over 80 characters Simple style fix. Signed-off-by: Guillermo O. Freschi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_chunk_heap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c index 54746157d799..0813163f962f 100644 --- a/drivers/staging/android/ion/ion_chunk_heap.c +++ b/drivers/staging/android/ion/ion_chunk_heap.c @@ -173,8 +173,8 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data) chunk_heap->heap.ops = &chunk_heap_ops; chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK; chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE; - pr_debug("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base, - heap_data->size, heap_data->align); + pr_debug("%s: base %lu size %zu align %ld\n", __func__, + chunk_heap->base, heap_data->size, heap_data->align); return &chunk_heap->heap; From 55ff2c6972e96acc3fd12be33ac7ac2fa17f1b0d Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Mon, 22 Jun 2015 14:14:35 +0200 Subject: [PATCH 125/912] staging: comedi: das08_cs: don't split Author string fixes checkpatch.pl WARNING: quoted string split across lines +MODULE_AUTHOR("David A. Schleef , " + "Frank Mori Hess "); Modules with multiple authors have a MODULE_AUTHOR line for each one. Signed-off-by: Luis de Bethencourt Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das08_cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 93fab6890161..9c02b17a2834 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -108,7 +108,7 @@ static struct pcmcia_driver das08_cs_driver = { }; module_comedi_pcmcia_driver(driver_das08_cs, das08_cs_driver); -MODULE_AUTHOR("David A. Schleef , " - "Frank Mori Hess "); +MODULE_AUTHOR("David A. Schleef "); +MODULE_AUTHOR("Frank Mori Hess "); MODULE_DESCRIPTION("Comedi driver for ComputerBoards DAS-08 PCMCIA boards"); MODULE_LICENSE("GPL"); From fa4c586e17dc1f5402235e4a78399ebc2026c435 Mon Sep 17 00:00:00 2001 From: Abdul Hussain Date: Mon, 22 Jun 2015 06:10:56 +0000 Subject: [PATCH 126/912] Staging: comedi: dmm32at: Simplify a trivial if-return sequence This patch simplify a trivial if-return sequence. Possibly combine with a preceding function call. Signed-off-by: Abdul Hussain Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dmm32at.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index bb2883c83afa..958c0d4aae5c 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -607,11 +607,7 @@ static int dmm32at_attach(struct comedi_device *dev, /* Digital I/O subdevice */ s = &dev->subdevices[2]; - ret = subdev_8255_init(dev, s, dmm32at_8255_io, DMM32AT_8255_IOBASE); - if (ret) - return ret; - - return 0; + return subdev_8255_init(dev, s, dmm32at_8255_io, DMM32AT_8255_IOBASE); } static struct comedi_driver dmm32at_driver = { From 11b22e1465e25dbbf29c7df30ba20497d91c63f2 Mon Sep 17 00:00:00 2001 From: Abdul Hussain Date: Mon, 22 Jun 2015 06:10:59 +0000 Subject: [PATCH 127/912] Staging: comedi: fl512: Simplify a trivial if-return sequence This patch simplify a trivial if-return sequence. Possibly combine with a preceding function call. Signed-off-by: Abdul Hussain Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/fl512.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/fl512.c b/drivers/staging/comedi/drivers/fl512.c index e1f493241cd6..55cae61458cb 100644 --- a/drivers/staging/comedi/drivers/fl512.c +++ b/drivers/staging/comedi/drivers/fl512.c @@ -136,11 +136,7 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->range_table = &range_fl512; s->insn_write = fl512_ao_insn_write; - ret = comedi_alloc_subdev_readback(s); - if (ret) - return ret; - - return 0; + return comedi_alloc_subdev_readback(s); } static struct comedi_driver fl512_driver = { From 2b2dae3da36dd2bcbf6c2171dba8a51a7b42673a Mon Sep 17 00:00:00 2001 From: Abdul Hussain Date: Mon, 22 Jun 2015 06:11:06 +0000 Subject: [PATCH 128/912] Staging: comedi: dac02: Simplify a trivial if-return sequence This patch simplify a trivial if-return sequence. Possibly combine with a preceding function call. Signed-off-by: Abdul Hussain Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dac02.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/dac02.c b/drivers/staging/comedi/drivers/dac02.c index a6798ad8fa7f..a562df498b01 100644 --- a/drivers/staging/comedi/drivers/dac02.c +++ b/drivers/staging/comedi/drivers/dac02.c @@ -130,11 +130,7 @@ static int dac02_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->range_table = &das02_ao_ranges; s->insn_write = dac02_ao_insn_write; - ret = comedi_alloc_subdev_readback(s); - if (ret) - return ret; - - return 0; + return comedi_alloc_subdev_readback(s); } static struct comedi_driver dac02_driver = { From ac7e62914cf5d31d31948d3f2b085e80e515a7cc Mon Sep 17 00:00:00 2001 From: Abdul Hussain Date: Mon, 22 Jun 2015 06:11:09 +0000 Subject: [PATCH 129/912] Staging: comedi: ni_daq_dio24: Simplify a trivial if-return sequence This patch simplify a trivial if-return sequence. Possibly combine with a preceding function call. Signed-off-by: Abdul Hussain Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_daq_dio24.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index a208cb348437..d9de83ab0267 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -55,11 +55,7 @@ static int dio24_auto_attach(struct comedi_device *dev, /* 8255 dio */ s = &dev->subdevices[0]; - ret = subdev_8255_init(dev, s, NULL, 0x00); - if (ret) - return ret; - - return 0; + return subdev_8255_init(dev, s, NULL, 0x00); } static struct comedi_driver driver_dio24 = { From 71b9f42eac9722d8dc39a5b2771255e2a6214eee Mon Sep 17 00:00:00 2001 From: Abdul Hussain Date: Mon, 22 Jun 2015 06:11:13 +0000 Subject: [PATCH 130/912] Staging: comedi: s626: Simplify a trivial if-return sequence This patch simplify a trivial if-return sequence. Possibly combine with a preceding function call. Signed-off-by: Abdul Hussain Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s626.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 781918d8d85f..35f0f676eb28 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -2852,11 +2852,7 @@ static int s626_auto_attach(struct comedi_device *dev, s->insn_read = s626_enc_insn_read; s->insn_write = s626_enc_insn_write; - ret = s626_initialize(dev); - if (ret) - return ret; - - return 0; + return s626_initialize(dev); } static void s626_detach(struct comedi_device *dev) From 21eaa3c23ac49c6a2b8f842412177a956711169a Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Mon, 22 Jun 2015 15:02:36 +0200 Subject: [PATCH 131/912] staging: comedi: das16m1: no space before tabs Warning found by checkpatch.pl WARNING: please, no space before tabs /drivers/staging/comedi/drivers/das16m1.c:83 + 404-407 ^I8254$ Signed-off-by: Luis de Bethencourt Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das16m1.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index a18a8878bdb8..25f4da5d3f14 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -69,18 +69,18 @@ irq can be omitted, although the cmd interface will not work without it. "cio-das16/m1" - 0 a/d bits 0-3, mux start 12 bit - 1 a/d bits 4-11 unused - 2 status control - 3 di 4 bit do 4 bit - 4 unused clear interrupt - 5 interrupt, pacer - 6 channel/gain queue address - 7 channel/gain queue data - 89ab 8254 - cdef 8254 - 400 8255 - 404-407 8254 + 0 a/d bits 0-3, mux start 12 bit + 1 a/d bits 4-11 unused + 2 status control + 3 di 4 bit do 4 bit + 4 unused clear interrupt + 5 interrupt, pacer + 6 channel/gain queue address + 7 channel/gain queue data + 89ab 8254 + cdef 8254 + 400 8255 + 404-407 8254 */ From 58a06a2a64930ad11cc398b0b00ae9817b9a821a Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Mon, 22 Jun 2015 15:03:15 +0200 Subject: [PATCH 132/912] staging: comedi: das16m1: fix lines over 80 characters Warnings found by checkpatch.pl WARNING: line over 80 characters /drivers/staging/comedi/drivers/das16m1.c:414 + if (devpriv->adc_count == 0 && hw_counter == devpriv->initial_hw_count) { /drivers/staging/comedi/drivers/das16m1.c:417 /drivers/staging/comedi/drivers/das16m1.c:418 /drivers/staging/comedi/drivers/das16m1.c:419 /drivers/staging/comedi/drivers/das16m1.c:420 /drivers/staging/comedi/drivers/das16m1.c:421 Signed-off-by: Luis de Bethencourt Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das16m1.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index 25f4da5d3f14..3a37373fbb6f 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -411,15 +411,18 @@ static void das16m1_handler(struct comedi_device *dev, unsigned int status) hw_counter = comedi_8254_read(devpriv->counter, 1); /* make sure hardware counter reading is not bogus due to initial value * not having been loaded yet */ - if (devpriv->adc_count == 0 && hw_counter == devpriv->initial_hw_count) { + if (devpriv->adc_count == 0 && + hw_counter == devpriv->initial_hw_count) { num_samples = 0; } else { - /* The calculation of num_samples looks odd, but it uses the following facts. - * 16 bit hardware counter is initialized with value of zero (which really - * means 0x1000). The counter decrements by one on each conversion - * (when the counter decrements from zero it goes to 0xffff). num_samples - * is a 16 bit variable, so it will roll over in a similar fashion to the - * hardware counter. Work it out, and this is what you get. */ + /* The calculation of num_samples looks odd, but it uses the + * following facts. 16 bit hardware counter is initialized with + * value of zero (which really means 0x1000). The counter + * decrements by one on each conversion (when the counter + * decrements from zero it goes to 0xffff). num_samples is a + * 16 bit variable, so it will roll over in a similar fashion + * to the hardware counter. Work it out, and this is what you + * get. */ num_samples = -hw_counter - devpriv->adc_count; } /* check if we only need some of the points */ From 0f73490e20261dbf543744bb3dc1ae6d6af0d80f Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Mon, 22 Jun 2015 23:33:42 +0800 Subject: [PATCH 133/912] staging: comedi: fix cast warning in comedi_compat32.c This patch fixes the following sparse warning: drivers/staging/comedi/comedi_compat32.c:205:16: warning: cast removes address space of expression Signed-off-by: Geliang Tang Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_compat32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 25848244c4b1..f356386d833a 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -202,7 +202,8 @@ static int get_compat_cmd(struct comedi_cmd __user *cmd, err |= __get_user(temp.uint, &cmd32->stop_arg); err |= __put_user(temp.uint, &cmd->stop_arg); err |= __get_user(temp.uptr, &cmd32->chanlist); - err |= __put_user(compat_ptr(temp.uptr), &cmd->chanlist); + err |= __put_user((unsigned int __force *)compat_ptr(temp.uptr), + &cmd->chanlist); err |= __get_user(temp.uint, &cmd32->chanlist_len); err |= __put_user(temp.uint, &cmd->chanlist_len); err |= __get_user(temp.uptr, &cmd32->data); From 50f058a1900aa02fea93c6d47584eefc74fdd4ac Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Mon, 6 Jul 2015 15:41:18 +0200 Subject: [PATCH 134/912] staging: comedi: Grammar s/Enable support a/Enable support for a/ Signed-off-by: Geert Uytterhoeven Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 7dee73dfbf88..57e71f9f14a2 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -2,7 +2,7 @@ config COMEDI tristate "Data acquisition support (comedi)" depends on m ---help--- - Enable support a wide range of data acquisition devices + Enable support for a wide range of data acquisition devices for Linux. if COMEDI From 4fff0fea6d8821b1e521b7d38ea6d69c47e21efc Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 7 Jul 2015 18:06:07 +0100 Subject: [PATCH 135/912] staging: comedi: cb_pcimdas: add external analog output ranges The analog output range is not programmable, but the ranges for each of the two analog output channels are settable via jumpers. These jumper settings are not readable by the driver. The driver provides a range table containing all the possible internal ranges (+/-10V, +/-5V, 0-10V, 0-5V) to provide information to the user application (although any range selected by the application that differs from the jumper settings will not produce the expected voltage output). The range table does not cover all possible ranges of the analog output channels. The jumpers also allow an external reference voltage between 0 and 10V to be used as bipolar or unipolar output range. Add a couple more ranges to the end of the range table to define these two external ranges. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 4ebf5aae5019..47e38398921e 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -141,11 +141,13 @@ static const struct comedi_lrange cb_pcimdas_ai_uni_range = { * jumper-settable on the board. The settings are not software-readable. */ static const struct comedi_lrange cb_pcimdas_ao_range = { - 4, { + 6, { BIP_RANGE(10), BIP_RANGE(5), UNI_RANGE(10), - UNI_RANGE(5) + UNI_RANGE(5), + RANGE_ext(-1, 1), + RANGE_ext(0, 1) } }; From 0e0d311ebd589e65b8e5559e067d0dd109ac3434 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 7 Jul 2015 17:06:52 +0100 Subject: [PATCH 136/912] staging: comedi: use CAP_SYS_ADMIN instead of CAP_NET_ADMIN If the "comedi" module has been loaded with the "comedi_num_legacy_minors" module parameter set to a non-zero value, some reserved comedi devices get created. These can be attached to a low-level comedi driver using the `COMEDI_DEVCONFIG` ioctl command, which checks for the `CAP_SYS_ADMIN` capability. Of course, the comedi device needs to be opened before the ioctl command can be sent. If the comedi device is unattached, `comedi_open()` currently requires the `CAP_NET_ADMIN` capability. It makes more sense to just require the `CAP_SYS_ADMIN` capability here, so change it. For the curious, commit a8f80e8ff94e ("Networking: use CAP_NET_ADMIN when deciding to call request_module") changed this capability from `CAP_SYS_MODULE` to `CAP_NET_ADMIN`, even though it doesn't seem relevant here. The original `CAP_SYS_MODULE` capability was due to the function having some code to request a module using a "char-major-%i-%i" alias, but that was never compiled in and was removed by commit f30f2c2d417b ("staging: comedi: remove check for CONFIG_KMOD"). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 985d94b6cbfd..1679bfba25a9 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2599,8 +2599,8 @@ static int comedi_open(struct inode *inode, struct file *file) cfp->dev = dev; mutex_lock(&dev->mutex); - if (!dev->attached && !capable(CAP_NET_ADMIN)) { - dev_dbg(dev->class_dev, "not attached and not CAP_NET_ADMIN\n"); + if (!dev->attached && !capable(CAP_SYS_ADMIN)) { + dev_dbg(dev->class_dev, "not attached and not CAP_SYS_ADMIN\n"); rc = -ENODEV; goto out; } From 90e6f51da718fc982eafd3dd7d6c78b378f67136 Mon Sep 17 00:00:00 2001 From: Santhosh Pai Date: Mon, 29 Jun 2015 10:44:03 +0100 Subject: [PATCH 137/912] staging: Comedi: comedi_fops: Fixed the return error code This patch fixes the checkpatch.pl warning: WARNING: ENOSYS means 'invalid syscall nr' and nothing else try_module_get fails when the reference count of the module is not allowed to be incremented ,and hence -ENXIO is returned indicating no device or address. [IA - combined two of santhosh's changes to the error return value!] Signed-off-by: santhosh pai Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 1679bfba25a9..4820ab6d0aa8 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2606,7 +2606,7 @@ static int comedi_open(struct inode *inode, struct file *file) } if (dev->attached && dev->use_count == 0) { if (!try_module_get(dev->driver->module)) { - rc = -ENOSYS; + rc = -ENXIO; goto out; } if (dev->open) { From 7211f6f72f6a7d0c0aaefe03f8c404f5e4704bec Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Wed, 24 Jun 2015 16:51:21 +0000 Subject: [PATCH 138/912] staging: sm750fb: remove redundant __func__ in debug statement This patch removes the redundant __func__ from dynamic debug prints as the pr_xxx set of functions can be dynamically controlled to include function name.Also fix a typo in debug statement. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_accel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 6eee4cd582d1..8ea3a61ba37c 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -100,7 +100,7 @@ int hw_fillrect(struct lynx_accel *accel, { /* int time wait and always busy,seems hardware * got something error */ - pr_debug("%s:De engine always bussy\n", __func__); + pr_debug("De engine always busy\n"); return -1; } From 202add2a04f6371ee493ff325ae466578c3bb2c5 Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:43:54 +0300 Subject: [PATCH 139/912] staging: sm750fb: replace spaces with tabs Replace spaces with tabs according to checkpatch.pl error message: "ERROR: code indent should use tabs where possible" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 68 +++++++++++++++--------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 84381bc414e7..3b3089ce3189 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -171,23 +171,23 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) /* Set up GPIO for software I2C to program DVI chip in the Xilinx SP605 board, in order to have video signal. */ - swI2CInit(0, 1); + swI2CInit(0, 1); - /* Customer may NOT use CH7301 DVI chip, which has to be - initialized differently. - */ - if (swI2CReadReg(0xec, 0x4a) == 0x95) - { - /* The following register values for CH7301 are from - Chrontel app note and our experiment. - */ + /* Customer may NOT use CH7301 DVI chip, which has to be + initialized differently. + */ + if (swI2CReadReg(0xec, 0x4a) == 0x95) + { + /* The following register values for CH7301 are from + Chrontel app note and our experiment. + */ pr_info("yes,CH7301 DVI chip found\n"); - swI2CWriteReg(0xec, 0x1d, 0x16); - swI2CWriteReg(0xec, 0x21, 0x9); - swI2CWriteReg(0xec, 0x49, 0xC0); + swI2CWriteReg(0xec, 0x1d, 0x16); + swI2CWriteReg(0xec, 0x21, 0x9); + swI2CWriteReg(0xec, 0x49, 0xC0); pr_info("okay,CH7301 DVI chip setup done\n"); - } + } } /* init 2d engine */ @@ -612,28 +612,28 @@ int hw_sm750_deWait(void) } int hw_sm750_pan_display(struct lynxfb_crtc *crtc, - const struct fb_var_screeninfo *var, - const struct fb_info *info) + const struct fb_var_screeninfo *var, + const struct fb_info *info) { - uint32_t total; - /* check params */ - if ((var->xoffset + var->xres > var->xres_virtual) || - (var->yoffset + var->yres > var->yres_virtual)) { - return -EINVAL; - } + uint32_t total; + /* check params */ + if ((var->xoffset + var->xres > var->xres_virtual) || + (var->yoffset + var->yres > var->yres_virtual)) { + return -EINVAL; + } - total = var->yoffset * info->fix.line_length + - ((var->xoffset * var->bits_per_pixel) >> 3); - total += crtc->oScreen; - if (crtc->channel == sm750_primary) { - POKE32(PANEL_FB_ADDRESS, - FIELD_VALUE(PEEK32(PANEL_FB_ADDRESS), - PANEL_FB_ADDRESS, ADDRESS, total)); - } else { - POKE32(CRT_FB_ADDRESS, - FIELD_VALUE(PEEK32(CRT_FB_ADDRESS), - CRT_FB_ADDRESS, ADDRESS, total)); - } - return 0; + total = var->yoffset * info->fix.line_length + + ((var->xoffset * var->bits_per_pixel) >> 3); + total += crtc->oScreen; + if (crtc->channel == sm750_primary) { + POKE32(PANEL_FB_ADDRESS, + FIELD_VALUE(PEEK32(PANEL_FB_ADDRESS), + PANEL_FB_ADDRESS, ADDRESS, total)); + } else { + POKE32(CRT_FB_ADDRESS, + FIELD_VALUE(PEEK32(CRT_FB_ADDRESS), + CRT_FB_ADDRESS, ADDRESS, total)); + } + return 0; } From 29d87336d4fea45d53a14d33f2fc5d174a4bfd59 Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:43:55 +0300 Subject: [PATCH 140/912] staging: sm750fb: remove trailing whitespaces Remove trailing whitespaces according to checkpatch.pl error message: "ERROR: trailing whitespace" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 3b3089ce3189..1dd20beea831 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -28,7 +28,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) { int ret; struct sm750_share *spec_share; - + spec_share = container_of(share, struct sm750_share, share); ret = 0; @@ -60,7 +60,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) pr_info("mmio virtual addr = %p\n", share->pvReg); } - + share->accel.dprBase = share->pvReg + DE_BASE_ADDR_TYPE1; share->accel.dpPortBase = share->pvReg + DE_PORT_ADDR_TYPE1; @@ -104,7 +104,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) { struct sm750_share *spec_share; struct init_status *parm; - + spec_share = container_of(share, struct sm750_share, share); parm = &spec_share->state.initParm; if(parm->chip_clk == 0) @@ -202,7 +202,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) resource_size_t hw_sm750_getVMSize(struct lynx_share *share) { resource_size_t ret; - + ret = ddk750_getVMSize(); return ret; } @@ -211,7 +211,7 @@ resource_size_t hw_sm750_getVMSize(struct lynx_share *share) int hw_sm750_output_checkMode(struct lynxfb_output* output, struct fb_var_screeninfo* var) { - + return 0; } @@ -222,7 +222,7 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, int ret; disp_output_t dispSet; int channel; - + ret = 0; dispSet = 0; channel = *output->channel; @@ -259,14 +259,14 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, void hw_sm750_output_clear(struct lynxfb_output* output) { - + return; } int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc, struct fb_var_screeninfo* var) { struct lynx_share *share; - + share = container_of(crtc, struct lynxfb_par, crtc)->share; @@ -303,7 +303,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, struct lynx_share *share; struct lynxfb_par *par; - + ret = 0; par = container_of(crtc, struct lynxfb_par, crtc); share = par->share; @@ -414,7 +414,7 @@ exit: void hw_sm750_crtc_clear(struct lynxfb_crtc* crtc) { - + return; } @@ -428,7 +428,7 @@ int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ int dpms, crtdb; - + switch(blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) @@ -483,7 +483,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) { unsigned int dpms, pps, crtdb; - + dpms = pps = crtdb = 0; switch (blank) @@ -636,4 +636,3 @@ int hw_sm750_pan_display(struct lynxfb_crtc *crtc, } return 0; } - From e0ded448d0b70e76a8d1111ae33ffeb68524fd91 Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:43:56 +0300 Subject: [PATCH 141/912] staging: sm750fb: insert space between ')' and '{' Insert spaces according to checkpatch.pl message: "ERROR: space required before the open brace '{'" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 1dd20beea831..dcb5927581d8 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -52,7 +52,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* now map mmio and vidmem*/ share->pvReg = ioremap_nocache(share->vidreg_start, share->vidreg_size); - if(!share->pvReg){ + if(!share->pvReg) { pr_err("mmio failed\n"); ret = -EFAULT; goto exit; @@ -87,7 +87,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) share->pvMem = ioremap_wc(share->vidmem_start, share->vidmem_size); - if(!share->pvMem){ + if(!share->pvMem) { pr_err("Map video memory failed\n"); ret = -EFAULT; goto exit; @@ -119,7 +119,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) ddk750_initHw((initchip_param_t *)&spec_share->state.initParm); /* for sm718,open pci burst */ - if(share->devid == 0x718){ + if(share->devid == 0x718) { POKE32(SYSTEM_CTRL, FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PCI_BURST, ON)); } @@ -133,7 +133,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) if(getChipType() != SM750LE) { /* does user need CRT ?*/ - if(spec_share->state.nocrt){ + if(spec_share->state.nocrt) { POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, @@ -155,7 +155,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) DPMS, VPHP)); } - switch (spec_share->state.pnltype){ + switch (spec_share->state.pnltype) { case sm750_doubleTFT: case sm750_24TFT: case sm750_dualTFT: @@ -191,7 +191,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) } /* init 2d engine */ - if(!share->accel_off){ + if(!share->accel_off) { hw_sm750_initAccel(share); } @@ -228,8 +228,8 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, channel = *output->channel; - if(getChipType() != SM750LE){ - if(channel == sm750_primary){ + if(getChipType() != SM750LE) { + if(channel == sm750_primary) { pr_info("primary channel\n"); if(output->paths & sm750_panel) dispSet |= do_LCD1_PRI; @@ -270,7 +270,7 @@ int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc, struct fb_var_screeninfo* share = container_of(crtc, struct lynxfb_par, crtc)->share; - switch (var->bits_per_pixel){ + switch (var->bits_per_pixel) { case 8: case 16: break; @@ -308,9 +308,9 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, par = container_of(crtc, struct lynxfb_par, crtc); share = par->share; #if 1 - if(!share->accel_off){ + if(!share->accel_off) { /* set 2d engine pixel format according to mode bpp */ - switch(var->bits_per_pixel){ + switch(var->bits_per_pixel) { case 8: fmt = 0; break; @@ -348,12 +348,12 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, pr_debug("Request pixel clock = %lu\n", modparm.pixel_clock); ret = ddk750_setModeTiming(&modparm, clock); - if(ret){ + if(ret) { pr_err("Set mode timing failed\n"); goto exit; } - if(crtc->channel != sm750_secondary){ + if(crtc->channel != sm750_secondary) { /* set pitch, offset ,width,start address ,etc... */ POKE32(PANEL_FB_ADDRESS, FIELD_SET(0, PANEL_FB_ADDRESS, STATUS, CURRENT)| @@ -426,7 +426,7 @@ int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, return 0; } -int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ +int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { int dpms, crtdb; switch(blank) @@ -473,7 +473,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ return -EINVAL; } - if(output->paths & sm750_crt){ + if(output->paths & sm750_crt) { POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, DPMS, dpms)); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } @@ -535,13 +535,13 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) break; } - if(output->paths & sm750_crt){ + if(output->paths & sm750_crt) { POKE32(SYSTEM_CTRL, FIELD_VALUE(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, DPMS, dpms)); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } - if(output->paths & sm750_panel){ + if(output->paths & sm750_panel) { POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps)); } @@ -554,7 +554,7 @@ void hw_sm750_initAccel(struct lynx_share *share) u32 reg; enable2DEngine(1); - if(getChipType() == SM750LE){ + if(getChipType() == SM750LE) { reg = PEEK32(DE_STATE1); reg = FIELD_SET(reg, DE_STATE1, DE_ABORT, ON); POKE32(DE_STATE1, reg); @@ -581,7 +581,7 @@ void hw_sm750_initAccel(struct lynx_share *share) int hw_sm750le_deWait(void) { int i=0x10000000; - while(i--){ + while(i--) { unsigned int dwVal = PEEK32(DE_STATE2); if((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && @@ -598,7 +598,7 @@ int hw_sm750le_deWait(void) int hw_sm750_deWait(void) { int i=0x10000000; - while(i--){ + while(i--) { unsigned int dwVal = PEEK32(SYSTEM_CTRL); if((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_FIFO) == SYSTEM_CTRL_DE_FIFO_EMPTY) && From 6d1b3d64cdc5f22452784ade42ebbc2382a7010e Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:43:57 +0300 Subject: [PATCH 142/912] staging: sm750fb: insert space before open parenthesis Insert spaces before '(' according to checkpatch.pl message: "ERROR: space required before the open parenthesis" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 62 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index dcb5927581d8..0e98cd374616 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -44,7 +44,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) * successfully * */ - if((ret = pci_request_region(pdev, 1, "sm750fb"))) + if ((ret = pci_request_region(pdev, 1, "sm750fb"))) { pr_err("Can not request PCI regions.\n"); goto exit; @@ -52,7 +52,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* now map mmio and vidmem*/ share->pvReg = ioremap_nocache(share->vidreg_start, share->vidreg_size); - if(!share->pvReg) { + if (!share->pvReg) { pr_err("mmio failed\n"); ret = -EFAULT; goto exit; @@ -78,7 +78,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* reserve the vidmem space of smi adaptor */ #if 0 - if((ret = pci_request_region(pdev, 0, _moduleName_))) + if ((ret = pci_request_region(pdev, 0, _moduleName_))) { pr_err("Can not request PCI regions.\n"); goto exit; @@ -87,7 +87,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) share->pvMem = ioremap_wc(share->vidmem_start, share->vidmem_size); - if(!share->pvMem) { + if (!share->pvMem) { pr_err("Map video memory failed\n"); ret = -EFAULT; goto exit; @@ -107,19 +107,19 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) spec_share = container_of(share, struct sm750_share, share); parm = &spec_share->state.initParm; - if(parm->chip_clk == 0) + if (parm->chip_clk == 0) parm->chip_clk = (getChipType() == SM750LE)? DEFAULT_SM750LE_CHIP_CLOCK : DEFAULT_SM750_CHIP_CLOCK; - if(parm->mem_clk == 0) + if (parm->mem_clk == 0) parm->mem_clk = parm->chip_clk; - if(parm->master_clk == 0) + if (parm->master_clk == 0) parm->master_clk = parm->chip_clk/3; ddk750_initHw((initchip_param_t *)&spec_share->state.initParm); /* for sm718,open pci burst */ - if(share->devid == 0x718) { + if (share->devid == 0x718) { POKE32(SYSTEM_CTRL, FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PCI_BURST, ON)); } @@ -130,10 +130,10 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) ddk750_initDVIDisp(); #endif - if(getChipType() != SM750LE) + if (getChipType() != SM750LE) { /* does user need CRT ?*/ - if(spec_share->state.nocrt) { + if (spec_share->state.nocrt) { POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, @@ -191,7 +191,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) } /* init 2d engine */ - if(!share->accel_off) { + if (!share->accel_off) { hw_sm750_initAccel(share); } @@ -228,19 +228,19 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, channel = *output->channel; - if(getChipType() != SM750LE) { - if(channel == sm750_primary) { + if (getChipType() != SM750LE) { + if (channel == sm750_primary) { pr_info("primary channel\n"); - if(output->paths & sm750_panel) + if (output->paths & sm750_panel) dispSet |= do_LCD1_PRI; - if(output->paths & sm750_crt) + if (output->paths & sm750_crt) dispSet |= do_CRT_PRI; }else{ pr_info("secondary channel\n"); - if(output->paths & sm750_panel) + if (output->paths & sm750_panel) dispSet |= do_LCD1_SEC; - if(output->paths & sm750_crt) + if (output->paths & sm750_crt) dispSet |= do_CRT_SEC; } @@ -308,9 +308,9 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, par = container_of(crtc, struct lynxfb_par, crtc); share = par->share; #if 1 - if(!share->accel_off) { + if (!share->accel_off) { /* set 2d engine pixel format according to mode bpp */ - switch(var->bits_per_pixel) { + switch (var->bits_per_pixel) { case 8: fmt = 0; break; @@ -341,19 +341,19 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, modparm.vertical_total = var->yres + var->upper_margin + var->lower_margin + var->vsync_len; /* choose pll */ - if(crtc->channel != sm750_secondary) + if (crtc->channel != sm750_secondary) clock = PRIMARY_PLL; else clock = SECONDARY_PLL; pr_debug("Request pixel clock = %lu\n", modparm.pixel_clock); ret = ddk750_setModeTiming(&modparm, clock); - if(ret) { + if (ret) { pr_err("Set mode timing failed\n"); goto exit; } - if(crtc->channel != sm750_secondary) { + if (crtc->channel != sm750_secondary) { /* set pitch, offset ,width,start address ,etc... */ POKE32(PANEL_FB_ADDRESS, FIELD_SET(0, PANEL_FB_ADDRESS, STATUS, CURRENT)| @@ -429,7 +429,7 @@ int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { int dpms, crtdb; - switch(blank) + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: @@ -473,7 +473,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { return -EINVAL; } - if(output->paths & sm750_crt) { + if (output->paths & sm750_crt) { POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, DPMS, dpms)); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } @@ -535,13 +535,13 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) break; } - if(output->paths & sm750_crt) { + if (output->paths & sm750_crt) { POKE32(SYSTEM_CTRL, FIELD_VALUE(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, DPMS, dpms)); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } - if(output->paths & sm750_panel) { + if (output->paths & sm750_panel) { POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps)); } @@ -554,7 +554,7 @@ void hw_sm750_initAccel(struct lynx_share *share) u32 reg; enable2DEngine(1); - if(getChipType() == SM750LE) { + if (getChipType() == SM750LE) { reg = PEEK32(DE_STATE1); reg = FIELD_SET(reg, DE_STATE1, DE_ABORT, ON); POKE32(DE_STATE1, reg); @@ -581,9 +581,9 @@ void hw_sm750_initAccel(struct lynx_share *share) int hw_sm750le_deWait(void) { int i=0x10000000; - while(i--) { + while (i--) { unsigned int dwVal = PEEK32(DE_STATE2); - if((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && + if ((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) { @@ -598,9 +598,9 @@ int hw_sm750le_deWait(void) int hw_sm750_deWait(void) { int i=0x10000000; - while(i--) { + while (i--) { unsigned int dwVal = PEEK32(SYSTEM_CTRL); - if((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && + if ((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_FIFO) == SYSTEM_CTRL_DE_FIFO_EMPTY) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) == SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) { From e188ea325d2419164691d6347b4ff7a4128f64b6 Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:43:58 +0300 Subject: [PATCH 143/912] staging: sm750fb: fix indentation of pointer operator Fix indentation of pointer operator '*' according to checkpatch.pl message: "ERROR: 'foo* bar' should be 'foo *bar' " Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 0e98cd374616..4f4ec93f098c 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -24,7 +24,7 @@ #include "ddk750.h" #include "sm750_accel.h" -int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) +int hw_sm750_map(struct lynx_share *share, struct pci_dev *pdev) { int ret; struct sm750_share *spec_share; @@ -209,15 +209,15 @@ resource_size_t hw_sm750_getVMSize(struct lynx_share *share) -int hw_sm750_output_checkMode(struct lynxfb_output* output, struct fb_var_screeninfo* var) +int hw_sm750_output_checkMode(struct lynxfb_output *output, struct fb_var_screeninfo *var) { return 0; } -int hw_sm750_output_setMode(struct lynxfb_output* output, - struct fb_var_screeninfo* var, struct fb_fix_screeninfo* fix) +int hw_sm750_output_setMode(struct lynxfb_output *output, + struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix) { int ret; disp_output_t dispSet; @@ -257,13 +257,13 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, return ret; } -void hw_sm750_output_clear(struct lynxfb_output* output) +void hw_sm750_output_clear(struct lynxfb_output *output) { return; } -int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc, struct fb_var_screeninfo* var) +int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc, struct fb_var_screeninfo *var) { struct lynx_share *share; @@ -292,9 +292,9 @@ int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc, struct fb_var_screeninfo* /* set the controller's mode for @crtc charged with @var and @fix parameters */ -int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, - struct fb_var_screeninfo* var, - struct fb_fix_screeninfo* fix) +int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, + struct fb_var_screeninfo *var, + struct fb_fix_screeninfo *fix) { int ret, fmt; u32 reg; @@ -412,13 +412,13 @@ exit: return ret; } -void hw_sm750_crtc_clear(struct lynxfb_crtc* crtc) +void hw_sm750_crtc_clear(struct lynxfb_crtc *crtc) { return; } -int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, +int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, ushort red, ushort green, ushort blue) { static unsigned int add[]={PANEL_PALETTE_RAM, CRT_PALETTE_RAM}; @@ -426,7 +426,7 @@ int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, return 0; } -int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { +int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank) { int dpms, crtdb; switch (blank) @@ -480,7 +480,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { return 0; } -int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) +int hw_sm750_setBLANK(struct lynxfb_output *output, int blank) { unsigned int dpms, pps, crtdb; From 4bcdffee2d9b9fddb617431bbd9231576eb4054b Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:43:59 +0300 Subject: [PATCH 144/912] staging: sm750fb: put open brace on the previous line Fix open braces according to checkpatch.pl message: "ERROR: that open brace { should be on the previous line" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 4f4ec93f098c..4dded626023d 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -44,8 +44,7 @@ int hw_sm750_map(struct lynx_share *share, struct pci_dev *pdev) * successfully * */ - if ((ret = pci_request_region(pdev, 1, "sm750fb"))) - { + if ((ret = pci_request_region(pdev, 1, "sm750fb"))) { pr_err("Can not request PCI regions.\n"); goto exit; } @@ -78,8 +77,7 @@ int hw_sm750_map(struct lynx_share *share, struct pci_dev *pdev) /* reserve the vidmem space of smi adaptor */ #if 0 - if ((ret = pci_request_region(pdev, 0, _moduleName_))) - { + if ((ret = pci_request_region(pdev, 0, _moduleName_))) { pr_err("Can not request PCI regions.\n"); goto exit; } @@ -130,8 +128,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) ddk750_initDVIDisp(); #endif - if (getChipType() != SM750LE) - { + if (getChipType() != SM750LE) { /* does user need CRT ?*/ if (spec_share->state.nocrt) { POKE32(MISC_CTRL, @@ -177,8 +174,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) /* Customer may NOT use CH7301 DVI chip, which has to be initialized differently. */ - if (swI2CReadReg(0xec, 0x4a) == 0x95) - { + if (swI2CReadReg(0xec, 0x4a) == 0x95) { /* The following register values for CH7301 are from Chrontel app note and our experiment. */ @@ -429,8 +425,7 @@ int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank) { int dpms, crtdb; - switch (blank) - { + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: #else @@ -486,8 +481,7 @@ int hw_sm750_setBLANK(struct lynxfb_output *output, int blank) dpms = pps = crtdb = 0; - switch (blank) - { + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: #else @@ -585,8 +579,7 @@ int hw_sm750le_deWait(void) unsigned int dwVal = PEEK32(DE_STATE2); if ((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && - (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) - { + (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) { return 0; } } @@ -602,8 +595,7 @@ int hw_sm750_deWait(void) unsigned int dwVal = PEEK32(SYSTEM_CTRL); if ((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_FIFO) == SYSTEM_CTRL_DE_FIFO_EMPTY) && - (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) == SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) - { + (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) == SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) { return 0; } } From 5e83e2832b86e76a273e197aae580b81541af352 Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:44:00 +0300 Subject: [PATCH 145/912] staging: sm750fb: fix indentation in 'else' statements Fix indentation according to checkpatch.pl message: "ERROR: space required after that close brace '}'" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 4dded626023d..9de253209536 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -55,7 +55,7 @@ int hw_sm750_map(struct lynx_share *share, struct pci_dev *pdev) pr_err("mmio failed\n"); ret = -EFAULT; goto exit; - }else{ + } else { pr_info("mmio virtual addr = %p\n", share->pvReg); } @@ -89,7 +89,7 @@ int hw_sm750_map(struct lynx_share *share, struct pci_dev *pdev) pr_err("Map video memory failed\n"); ret = -EFAULT; goto exit; - }else{ + } else { pr_info("video memory vaddr = %p\n", share->pvMem); } exit: @@ -140,7 +140,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, DPMS, VNHN)); - }else{ + } else { POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, @@ -163,7 +163,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) spec_share->state.pnltype)); break; } - }else{ + } else { /* for 750LE ,no DVI chip initilization makes Monitor no signal */ /* Set up GPIO for software I2C to program DVI chip in the Xilinx SP605 board, in order to have video signal. @@ -232,7 +232,7 @@ int hw_sm750_output_setMode(struct lynxfb_output *output, if (output->paths & sm750_crt) dispSet |= do_CRT_PRI; - }else{ + } else { pr_info("secondary channel\n"); if (output->paths & sm750_panel) dispSet |= do_LCD1_SEC; @@ -241,7 +241,7 @@ int hw_sm750_output_setMode(struct lynxfb_output *output, } ddk750_setLogicalDispOut(dispSet); - }else{ + } else { /* just open DISPLAY_CONTROL_750LE register bit 3:0*/ u32 reg; reg = PEEK32(DISPLAY_CONTROL_750LE); @@ -385,7 +385,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, PANEL_DISPLAY_CTRL, FORMAT, (var->bits_per_pixel >> 4) )); - }else{ + } else { /* not implemented now */ POKE32(CRT_FB_ADDRESS, crtc->oScreen); reg = var->xres * (var->bits_per_pixel >> 3); @@ -557,7 +557,7 @@ void hw_sm750_initAccel(struct lynx_share *share) reg = FIELD_SET(reg, DE_STATE1, DE_ABORT, OFF); POKE32(DE_STATE1, reg); - }else{ + } else { /* engine reset */ reg = PEEK32(SYSTEM_CTRL); reg = FIELD_SET(reg, SYSTEM_CTRL, DE_ABORT, ON); From 990e56663bc6012512fd32fc5e92c54bd58ed688 Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:44:01 +0300 Subject: [PATCH 146/912] staging: sm750fb: fix 'switch and case' indentation Fix according to checkpatch.pl message: "ERROR: switch and case should be at the same indent" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 172 ++++++++++++++--------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 9de253209536..3093c2540bda 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -153,15 +153,15 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) } switch (spec_share->state.pnltype) { - case sm750_doubleTFT: - case sm750_24TFT: - case sm750_dualTFT: - POKE32(PANEL_DISPLAY_CTRL, - FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), - PANEL_DISPLAY_CTRL, - TFT_DISP, - spec_share->state.pnltype)); - break; + case sm750_doubleTFT: + case sm750_24TFT: + case sm750_dualTFT: + POKE32(PANEL_DISPLAY_CTRL, + FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), + PANEL_DISPLAY_CTRL, + TFT_DISP, + spec_share->state.pnltype)); + break; } } else { /* for 750LE ,no DVI chip initilization makes Monitor no signal */ @@ -267,17 +267,17 @@ int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc, struct fb_var_screeninfo * share = container_of(crtc, struct lynxfb_par, crtc)->share; switch (var->bits_per_pixel) { - case 8: - case 16: - break; - case 32: - if (share->revid == SM750LE_REVISION_ID) { - pr_debug("750le do not support 32bpp\n"); - return -EINVAL; - } - break; - default: + case 8: + case 16: + break; + case 32: + if (share->revid == SM750LE_REVISION_ID) { + pr_debug("750le do not support 32bpp\n"); return -EINVAL; + } + break; + default: + return -EINVAL; } @@ -307,16 +307,16 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, if (!share->accel_off) { /* set 2d engine pixel format according to mode bpp */ switch (var->bits_per_pixel) { - case 8: - fmt = 0; - break; - case 16: - fmt = 1; - break; - case 32: - default: - fmt = 2; - break; + case 8: + fmt = 0; + break; + case 16: + fmt = 1; + break; + case 32: + default: + fmt = 2; + break; } hw_set2dformat(&share->accel, fmt); } @@ -427,45 +427,45 @@ int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank) { switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_UNBLANK: + case FB_BLANK_UNBLANK: #else - case VESA_NO_BLANKING: + case VESA_NO_BLANKING: #endif - dpms = CRT_DISPLAY_CTRL_DPMS_0; - crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; - break; + dpms = CRT_DISPLAY_CTRL_DPMS_0; + crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; + break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_NORMAL: - dpms = CRT_DISPLAY_CTRL_DPMS_0; - crtdb = CRT_DISPLAY_CTRL_BLANK_ON; - break; + case FB_BLANK_NORMAL: + dpms = CRT_DISPLAY_CTRL_DPMS_0; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_VSYNC_SUSPEND: + case FB_BLANK_VSYNC_SUSPEND: #else - case VESA_VSYNC_SUSPEND: + case VESA_VSYNC_SUSPEND: #endif - dpms = CRT_DISPLAY_CTRL_DPMS_2; - crtdb = CRT_DISPLAY_CTRL_BLANK_ON; - break; + dpms = CRT_DISPLAY_CTRL_DPMS_2; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_HSYNC_SUSPEND: + case FB_BLANK_HSYNC_SUSPEND: #else - case VESA_HSYNC_SUSPEND: + case VESA_HSYNC_SUSPEND: #endif - dpms = CRT_DISPLAY_CTRL_DPMS_1; - crtdb = CRT_DISPLAY_CTRL_BLANK_ON; - break; + dpms = CRT_DISPLAY_CTRL_DPMS_1; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_POWERDOWN: + case FB_BLANK_POWERDOWN: #else - case VESA_POWERDOWN: + case VESA_POWERDOWN: #endif - dpms = CRT_DISPLAY_CTRL_DPMS_3; - crtdb = CRT_DISPLAY_CTRL_BLANK_ON; - break; - default: - return -EINVAL; + dpms = CRT_DISPLAY_CTRL_DPMS_3; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; + default: + return -EINVAL; } if (output->paths & sm750_crt) { @@ -483,50 +483,50 @@ int hw_sm750_setBLANK(struct lynxfb_output *output, int blank) switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_UNBLANK: + case FB_BLANK_UNBLANK: #else - case VESA_NO_BLANKING: + case VESA_NO_BLANKING: #endif - pr_info("flag = FB_BLANK_UNBLANK \n"); - dpms = SYSTEM_CTRL_DPMS_VPHP; - pps = PANEL_DISPLAY_CTRL_DATA_ENABLE; - crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; - break; + pr_info("flag = FB_BLANK_UNBLANK \n"); + dpms = SYSTEM_CTRL_DPMS_VPHP; + pps = PANEL_DISPLAY_CTRL_DATA_ENABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; + break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_NORMAL: - pr_info("flag = FB_BLANK_NORMAL \n"); - dpms = SYSTEM_CTRL_DPMS_VPHP; - pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; - crtdb = CRT_DISPLAY_CTRL_BLANK_ON; - break; + case FB_BLANK_NORMAL: + pr_info("flag = FB_BLANK_NORMAL \n"); + dpms = SYSTEM_CTRL_DPMS_VPHP; + pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_VSYNC_SUSPEND: + case FB_BLANK_VSYNC_SUSPEND: #else - case VESA_VSYNC_SUSPEND: + case VESA_VSYNC_SUSPEND: #endif - dpms = SYSTEM_CTRL_DPMS_VNHP; - pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; - crtdb = CRT_DISPLAY_CTRL_BLANK_ON; - break; + dpms = SYSTEM_CTRL_DPMS_VNHP; + pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_HSYNC_SUSPEND: + case FB_BLANK_HSYNC_SUSPEND: #else - case VESA_HSYNC_SUSPEND: + case VESA_HSYNC_SUSPEND: #endif - dpms = SYSTEM_CTRL_DPMS_VPHN; - pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; - crtdb = CRT_DISPLAY_CTRL_BLANK_ON; - break; + dpms = SYSTEM_CTRL_DPMS_VPHN; + pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) - case FB_BLANK_POWERDOWN: + case FB_BLANK_POWERDOWN: #else - case VESA_POWERDOWN: + case VESA_POWERDOWN: #endif - dpms = SYSTEM_CTRL_DPMS_VNHN; - pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; - crtdb = CRT_DISPLAY_CTRL_BLANK_ON; - break; + dpms = SYSTEM_CTRL_DPMS_VNHN; + pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; } if (output->paths & sm750_crt) { From 9a52ae2dd8c24a3ab53bb68ea2b5f94c11e3f5a8 Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:44:02 +0300 Subject: [PATCH 147/912] staging: sm750fb: remove assignment from if condition Remove assignment from if condition according to checkpatch.pl message: "ERROR: do not use assignment in if condition" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 3093c2540bda..987da9e2aa2f 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -43,8 +43,8 @@ int hw_sm750_map(struct lynx_share *share, struct pci_dev *pdev) * in lynxfb_remove, or memory will not be mapped again * successfully * */ - - if ((ret = pci_request_region(pdev, 1, "sm750fb"))) { + ret = pci_request_region(pdev, 1, "sm750fb"); + if (ret) { pr_err("Can not request PCI regions.\n"); goto exit; } @@ -77,7 +77,8 @@ int hw_sm750_map(struct lynx_share *share, struct pci_dev *pdev) /* reserve the vidmem space of smi adaptor */ #if 0 - if ((ret = pci_request_region(pdev, 0, _moduleName_))) { + ret = pci_request_region(pdev, 0, _moduleName_); + if (ret) { pr_err("Can not request PCI regions.\n"); goto exit; } From 14a974c567aa30070f87ec6652c1727a0e03f11a Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:44:03 +0300 Subject: [PATCH 148/912] staging: sm750fb: fix open brace in function declaration Fix according to checkpatch.pl message: "ERROR: open brace '{' following function declarations go on the next line" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 987da9e2aa2f..a4f0cd06e74c 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -423,7 +423,8 @@ int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, return 0; } -int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank) { +int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank) +{ int dpms, crtdb; switch (blank) { From d5fca4035a59eb4b120b2ffd645f12508dfb2ed6 Mon Sep 17 00:00:00 2001 From: Anatoly Stepanov Date: Mon, 29 Jun 2015 02:44:04 +0300 Subject: [PATCH 149/912] staging: sm750fb: add required spaces around C operators Add spaces according to checkpatch.pl messages: "ERROR: spaces required around that '=' (ctx:VxV)" "ERROR: need consistent spacing around '-' (ctx:WxV)" "ERROR: spaces required around that '?' (ctx:VxE)" "ERROR: need consistent spacing around '&' (ctx:VxW)" Signed-off-by: Anatoly Stepanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index a4f0cd06e74c..359165d523d0 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -107,7 +107,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) spec_share = container_of(share, struct sm750_share, share); parm = &spec_share->state.initParm; if (parm->chip_clk == 0) - parm->chip_clk = (getChipType() == SM750LE)? + parm->chip_clk = (getChipType() == SM750LE) ? DEFAULT_SM750LE_CHIP_CLOCK : DEFAULT_SM750_CHIP_CLOCK; @@ -327,7 +327,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, modparm.pixel_clock = ps_to_hz(var->pixclock); modparm.vertical_sync_polarity = (var->sync & FB_SYNC_HOR_HIGH_ACT) ? POS:NEG; modparm.horizontal_sync_polarity = (var->sync & FB_SYNC_VERT_HIGH_ACT) ? POS:NEG; - modparm.clock_phase_polarity = (var->sync& FB_SYNC_COMP_HIGH_ACT) ? POS:NEG; + modparm.clock_phase_polarity = (var->sync & FB_SYNC_COMP_HIGH_ACT) ? POS:NEG; modparm.horizontal_display_end = var->xres; modparm.horizontal_sync_width = var->hsync_len; modparm.horizontal_sync_start = var->xres + var->right_margin; @@ -366,7 +366,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, FIELD_VALUE(0, PANEL_FB_WIDTH, OFFSET, fix->line_length)); POKE32(PANEL_WINDOW_WIDTH, - FIELD_VALUE(0, PANEL_WINDOW_WIDTH, WIDTH, var->xres -1)| + FIELD_VALUE(0, PANEL_WINDOW_WIDTH, WIDTH, var->xres - 1)| FIELD_VALUE(0, PANEL_WINDOW_WIDTH, X, var->xoffset)); POKE32(PANEL_WINDOW_HEIGHT, @@ -418,7 +418,7 @@ void hw_sm750_crtc_clear(struct lynxfb_crtc *crtc) int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, ushort red, ushort green, ushort blue) { - static unsigned int add[]={PANEL_PALETTE_RAM, CRT_PALETTE_RAM}; + static unsigned int add[] = {PANEL_PALETTE_RAM, CRT_PALETTE_RAM}; POKE32(add[crtc->channel] + index*4, (red<<16)|(green<<8)|blue); return 0; } @@ -576,7 +576,7 @@ void hw_sm750_initAccel(struct lynx_share *share) int hw_sm750le_deWait(void) { - int i=0x10000000; + int i = 0x10000000; while (i--) { unsigned int dwVal = PEEK32(DE_STATE2); if ((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && @@ -592,7 +592,7 @@ int hw_sm750le_deWait(void) int hw_sm750_deWait(void) { - int i=0x10000000; + int i = 0x10000000; while (i--) { unsigned int dwVal = PEEK32(SYSTEM_CTRL); if ((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && From df525686865a79a44b39f7032cf94e625e894865 Mon Sep 17 00:00:00 2001 From: Vinay Simha BN Date: Tue, 14 Jul 2015 19:15:28 +0530 Subject: [PATCH 150/912] staging: sm750fb: coding style global ERROR fixes kernel coding style fixes for below messages from scripts/checkpatch.pl ERROR: do not initialise globals to 0 or NULL Signed-off-by: Vinay Simha BN Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_help.c | 6 +++--- drivers/staging/sm750fb/sm750.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_help.c b/drivers/staging/sm750fb/ddk750_help.c index 1adcafcc5133..f027df58fc11 100644 --- a/drivers/staging/sm750fb/ddk750_help.c +++ b/drivers/staging/sm750fb/ddk750_help.c @@ -1,8 +1,8 @@ #include "ddk750_help.h" -void __iomem *mmio750 = NULL; -char revId750 = 0; -unsigned short devId750 = 0; +void __iomem *mmio750; +char revId750; +unsigned short devId750; /* after driver mapped io registers, use this function first */ void ddk750_set_mmio(void __iomem *addr, unsigned short devId, char revId) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 8e201f19cc0d..4d165ca3baad 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -24,7 +24,7 @@ #include "modedb.h" -int smi_indent = 0; +int smi_indent; /* @@ -47,9 +47,9 @@ static int g_noaccel; static int g_nomtrr; static const char *g_fbmode[] = {NULL, NULL}; static const char *g_def_fbmode = "800x600-16@60"; -static char *g_settings = NULL; +static char *g_settings; static int g_dualview; -static char *g_option = NULL; +static char *g_option; static const struct fb_videomode lynx750_ext[] = { From a43abee7de3967b7a211ae17563e2e2db40c4f5d Mon Sep 17 00:00:00 2001 From: Anders Fridlund Date: Thu, 9 Jul 2015 14:45:22 +0200 Subject: [PATCH 151/912] Staging: sm750fb: ddk750_dvi.h: Fix brace coding style issue This is a patch to the ddk750_dvi.h file that fixes up a brace error found by the checkpatch.pl tool Signed-off-by: Anders Fridlund Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_dvi.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_dvi.h b/drivers/staging/sm750fb/ddk750_dvi.h index 83bbd6d62061..e1d4c9a2d50a 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.h +++ b/drivers/staging/sm750fb/ddk750_dvi.h @@ -26,8 +26,7 @@ typedef unsigned char (*PFN_DVICTRL_CHECKINTERRUPT)(void); typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void); /* Structure to hold all the function pointer to the DVI Controller. */ -typedef struct _dvi_ctrl_device_t -{ +typedef struct _dvi_ctrl_device_t { PFN_DVICTRL_INIT pfnInit; PFN_DVICTRL_RESETCHIP pfnResetChip; PFN_DVICTRL_GETCHIPSTRING pfnGetChipString; From addce19f58c52a03314e2d8a1e30708dabf9bf30 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:41 -0400 Subject: [PATCH 152/912] staging: unisys: respond to msgs post device_create Fix problem that prevents us from responding to any device message after device_create. By neglecting to NULL out pending_msg_hdr after the device_create response, we were effectively preventing any subsequent messages to the device from working, because device_epilog() will correctly bail out early if it sees that pending_msg_hdr is still set non-NULL, as that is an indicator to mean that an unanswered message is still outstanding. This problem was discovered as part of testing IOVM service partition recovery, because device_epilog() was in fact bailing out when it was called from my_device_changestate(), which of course prevented us from transitioning the device to the paused state. However, the incorrect behavior would occur for ANY subsequent command directed at the device, not just for changestate. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index bb8087e70127..d47ec24e2dc5 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -2047,6 +2047,7 @@ device_create_response(struct visor_device *dev_info, int response) response); kfree(dev_info->pending_msg_hdr); + dev_info->pending_msg_hdr = NULL; } static void From d15a65be5542ab0c4792a54cf90419fbaf741791 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:42 -0400 Subject: [PATCH 153/912] staging: unisys: prevent faults processing messages Prevent faults processing messages for devices that no driver has yet registered to handle. Previously, code of the form: drv = to_visor_driver(dev->device.driver); if (!drv) goto away; was not having the desired intent, because to_visor_driver() was essentially returning garbage if its argument was NULL. The only existing case of this is in initiate_chipset_device_pause_resume(), which is called during IOVM service partition recovery. We were thus faulting when IOVM service partition recovery was initiated on a bus that had at least one device for which no function driver had registered (visorbus_register_visor_driver). Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/visorbus.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index e4a21e42e868..a0144c6a8ad1 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -113,7 +113,8 @@ struct visor_driver { struct driver_attribute version_attr; }; -#define to_visor_driver(x) container_of(x, struct visor_driver, driver) +#define to_visor_driver(x) ((x) ? \ + (container_of(x, struct visor_driver, driver)) : (NULL)) /** A device type for things "plugged" into the visorbus bus */ From d01da5eac098c4676dd5d296b5be5b0f988fc3c8 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:43 -0400 Subject: [PATCH 154/912] staging: unisys: visornic: correct visornic_pause Correct visornic_pause() to indicate completion asynchronously rather than in-line Previously, visornic_pause() (called to stop the device due to IOVM service partition recovery) was calling the passed complete_func() in-line, rather than delaying the calling until after the device had actually been stopped. The behavior has been corrected so that the calling of the complete_func() is now delayed until after the stopping of the device has been completed in visornic_serverdown_complete(), which runs asynchronously via the workqueue visornic_serverdown_workqueue. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 710074437737..fa52e0fa5cbc 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -151,6 +151,7 @@ struct visornic_devdata { * sent to the IOPART end */ struct work_struct serverdown_completion; + visorbus_state_complete_func server_down_complete_func; struct work_struct timeout_reset; struct uiscmdrsp *cmdrsp_rcv; /* cmdrsp_rcv is used for * posting/unposting rcv buffers @@ -545,8 +546,12 @@ visornic_serverdown_complete(struct work_struct *work) atomic_set(&devdata->num_rcvbuf_in_iovm, 0); spin_unlock_irqrestore(&devdata->priv_lock, flags); + if (devdata->server_down_complete_func) + (*devdata->server_down_complete_func)(devdata->dev, 0); + devdata->server_down = true; devdata->server_change_state = false; + devdata->server_down_complete_func = NULL; } /** @@ -558,10 +563,12 @@ visornic_serverdown_complete(struct work_struct *work) * Returns 0 if we scheduled the work, -EINVAL on error. */ static int -visornic_serverdown(struct visornic_devdata *devdata) +visornic_serverdown(struct visornic_devdata *devdata, + visorbus_state_complete_func complete_func) { if (!devdata->server_down && !devdata->server_change_state) { devdata->server_change_state = true; + devdata->server_down_complete_func = complete_func; queue_work(visornic_serverdown_workqueue, &devdata->serverdown_completion); } else if (devdata->server_change_state) { @@ -895,7 +902,7 @@ visornic_timeout_reset(struct work_struct *work) return; call_serverdown: - visornic_serverdown(devdata); + visornic_serverdown(devdata, NULL); } /** @@ -1980,8 +1987,7 @@ static int visornic_pause(struct visor_device *dev, { struct visornic_devdata *devdata = dev_get_drvdata(&dev->device); - visornic_serverdown(devdata); - complete_func(dev, 0); + visornic_serverdown(devdata, complete_func); return 0; } From 5deeea3379b2fc34d07cfb909b2905e9e1116615 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:44 -0400 Subject: [PATCH 155/912] staging: unisys: prevent faults in visornic_pause Prevent faults in visornic_pause, visornic_resume(), and visornic_remove() Prior to this patch, any call to visornic_pause(), visornic_resume(), or visornic_remove() would fault, due to dev_set_drvdata() never having been called to stash our struct visornic_devdata * into the device's drvdata. I.e., all calls to dev_get_drvdata() were returning NULL, meaning a fault was soon to follow. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index fa52e0fa5cbc..72253a07c255 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1831,6 +1831,7 @@ static int visornic_probe(struct visor_device *dev) } devdata->netdev = netdev; + dev_set_drvdata(&dev->device, devdata); init_waitqueue_head(&devdata->rsp_queue); spin_lock_init(&devdata->priv_lock); devdata->enabled = 0; /* not yet */ From 46dfa3d83464c7ee694ff32761645c3e27fcfc48 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:45 -0400 Subject: [PATCH 156/912] staging: unisys: neglect to NULL rcvbuf pointer Neglect to NULL rcvbuf pointer array could result in faults later This problem would exhibit itself as a fault when when attempting to stop any visornic device (i.e., in visornic_disable_with_timeout() or visornic_serverdown_complete()) that had never been started (i.e., for which init_rcv_bufs() had never been called). Because the array of rcvbuf was never cleared to NULLs, we would mistakenly attempt to call kfree_skb() on garbage memory. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 72253a07c255..915c9132a5c4 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1845,7 +1845,7 @@ static int visornic_probe(struct visor_device *dev) if (err) goto cleanup_netdev; - devdata->rcvbuf = kmalloc(sizeof(struct sk_buff *) * + devdata->rcvbuf = kzalloc(sizeof(struct sk_buff *) * devdata->num_rcv_bufs, GFP_KERNEL); if (!devdata->rcvbuf) { err = -ENOMEM; From 00748b0c69becb3fc4e520a3f9047b46d3bffe2c Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:46 -0400 Subject: [PATCH 157/912] staging: unisys: add error messages to visornic Add error message to genuine rare error paths, and debug messages to enable relatively non-verbose tracing of code paths You can enable debug messages by including this on the kernel command line: visornic.dyndbg=+p or by this from the command line: echo "module visornic +p" > /dynamic_debug/control Refer to Documentation/dynamic-debug-howto.txt for more details. In addition to the new debug and error messages, a message like the following will be logged every time a visornic device is probed, which will enable you to map back-and-forth between visorbus device names (e.g., "vbus2:dev0") and netdev names (e.g., "eth0"): visornic vbus2:dev0: visornic_probe success netdev=eth0 With this patch and visornic debugging enabled, you should expect to see messages like the following in the most-common scenarios: * driver loaded: visornic_init * device probed: visornic vbus2:dev0: visornic_probe visor_thread_start visor_thread_start success * network interface configured (ifconfig): net eth0: visornic_open net eth0: visornic_enable_with_timeout net eth0: visornic_enable_with_timeout success net eth0: visornic_open success Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 91 ++++++++++++++++--- 1 file changed, 80 insertions(+), 11 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 915c9132a5c4..de05ac79662a 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -299,6 +299,8 @@ static int visor_thread_start(struct visor_thread_info *thrinfo, init_completion(&thrinfo->has_stopped); thrinfo->task = kthread_run(threadfn, thrcontext, name); if (IS_ERR(thrinfo->task)) { + pr_debug("%s failed (%ld)\n", + __func__, PTR_ERR(thrinfo->task)); thrinfo->id = 0; return -EINVAL; } @@ -572,6 +574,8 @@ visornic_serverdown(struct visornic_devdata *devdata, queue_work(visornic_serverdown_workqueue, &devdata->serverdown_completion); } else if (devdata->server_change_state) { + dev_dbg(&devdata->dev->device, "%s changing state\n", + __func__); return -EINVAL; } return 0; @@ -708,6 +712,8 @@ visornic_disable_with_timeout(struct net_device *netdev, const int timeout) break; if (devdata->server_down || devdata->server_change_state) { spin_unlock_irqrestore(&devdata->priv_lock, flags); + dev_dbg(&netdev->dev, "%s server went away\n", + __func__); return -EIO; } set_current_state(TASK_INTERRUPTIBLE); @@ -821,8 +827,11 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) * gets a disable. */ i = init_rcv_bufs(netdev, devdata); - if (i < 0) + if (i < 0) { + dev_err(&netdev->dev, + "%s failed to init rcv bufs (%d)\n", __func__, i); return i; + } spin_lock_irqsave(&devdata->priv_lock, flags); devdata->enabled = 1; @@ -845,6 +854,8 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) break; if (devdata->server_down || devdata->server_change_state) { spin_unlock_irqrestore(&devdata->priv_lock, flags); + dev_dbg(&netdev->dev, "%s server went away\n", + __func__); return -EIO; } set_current_state(TASK_INTERRUPTIBLE); @@ -855,8 +866,10 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) spin_unlock_irqrestore(&devdata->priv_lock, flags); - if (!devdata->enab_dis_acked) + if (!devdata->enab_dis_acked) { + dev_err(&netdev->dev, "%s missing ACK\n", __func__); return -EIO; + } /* find an open slot in the array to save off VisorNic references * for debug @@ -968,6 +981,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) devdata->server_change_state) { spin_unlock_irqrestore(&devdata->priv_lock, flags); devdata->busy_cnt++; + dev_dbg(&netdev->dev, + "%s busy - queue stopped\n", __func__); return NETDEV_TX_BUSY; } @@ -986,6 +1001,9 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) if (firstfraglen < ETH_HEADER_SIZE) { spin_unlock_irqrestore(&devdata->priv_lock, flags); devdata->busy_cnt++; + dev_err(&netdev->dev, + "%s busy - first frag too small (%d)\n", + __func__, firstfraglen); return NETDEV_TX_BUSY; } @@ -1025,6 +1043,9 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) netif_stop_queue(netdev); spin_unlock_irqrestore(&devdata->priv_lock, flags); devdata->busy_cnt++; + dev_dbg(&netdev->dev, + "%s busy - waiting for iovm to catch up\n", + __func__); return NETDEV_TX_BUSY; } if (devdata->queuefullmsg_logged) @@ -1065,6 +1086,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) if (cmdrsp->net.xmt.num_frags == -1) { spin_unlock_irqrestore(&devdata->priv_lock, flags); devdata->busy_cnt++; + dev_err(&netdev->dev, + "%s busy - copy frags failed\n", __func__); return NETDEV_TX_BUSY; } @@ -1073,6 +1096,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) netif_stop_queue(netdev); spin_unlock_irqrestore(&devdata->priv_lock, flags); devdata->busy_cnt++; + dev_dbg(&netdev->dev, + "%s busy - signalinsert failed\n", __func__); return NETDEV_TX_BUSY; } @@ -1105,6 +1130,9 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) * netif_wake_queue() after lower * threshold */ + dev_dbg(&netdev->dev, + "%s busy - invoking iovm flow control\n", + __func__); devdata->flow_control_upper_hits++; } spin_unlock_irqrestore(&devdata->priv_lock, flags); @@ -1211,6 +1239,8 @@ visornic_xmit_timeout(struct net_device *netdev) /* Ensure that a ServerDown message hasn't been received */ if (!devdata->enabled || (devdata->server_down && !devdata->server_change_state)) { + dev_dbg(&netdev->dev, "%s no processing\n", + __func__); spin_unlock_irqrestore(&devdata->priv_lock, flags); return; } @@ -1808,8 +1838,11 @@ static int visornic_probe(struct visor_device *dev) u64 features; netdev = alloc_etherdev(sizeof(struct visornic_devdata)); - if (!netdev) + if (!netdev) { + dev_err(&dev->device, + "%s alloc_etherdev failed\n", __func__); return -ENOMEM; + } netdev->netdev_ops = &visornic_dev_ops; netdev->watchdog_timeo = (5 * HZ); @@ -1821,11 +1854,17 @@ static int visornic_probe(struct visor_device *dev) vnic.macaddr); err = visorbus_read_channel(dev, channel_offset, netdev->dev_addr, ETH_ALEN); - if (err < 0) + if (err < 0) { + dev_err(&dev->device, + "%s failed to get mac addr from chan (%d)\n", + __func__, err); goto cleanup_netdev; + } devdata = devdata_initialize(netdev_priv(netdev), dev); if (!devdata) { + dev_err(&dev->device, + "%s devdata_initialize failed\n", __func__); err = -ENOMEM; goto cleanup_netdev; } @@ -1842,8 +1881,12 @@ static int visornic_probe(struct visor_device *dev) vnic.num_rcv_bufs); err = visorbus_read_channel(dev, channel_offset, &devdata->num_rcv_bufs, 4); - if (err) + if (err) { + dev_err(&dev->device, + "%s failed to get #rcv bufs from chan (%d)\n", + __func__, err); goto cleanup_netdev; + } devdata->rcvbuf = kzalloc(sizeof(struct sk_buff *) * devdata->num_rcv_bufs, GFP_KERNEL); @@ -1884,38 +1927,58 @@ static int visornic_probe(struct visor_device *dev) channel_offset = offsetof(struct spar_io_channel_protocol, vnic.mtu); err = visorbus_read_channel(dev, channel_offset, &netdev->mtu, 4); - if (err) + if (err) { + dev_err(&dev->device, + "%s failed to get mtu from chan (%d)\n", + __func__, err); goto cleanup_xmit_cmdrsp; + } /* TODO: Setup Interrupt information */ /* Let's start our threads to get responses */ channel_offset = offsetof(struct spar_io_channel_protocol, channel_header.features); err = visorbus_read_channel(dev, channel_offset, &features, 8); - if (err) + if (err) { + dev_err(&dev->device, + "%s failed to get features from chan (%d)\n", + __func__, err); goto cleanup_xmit_cmdrsp; + } features |= ULTRA_IO_CHANNEL_IS_POLLING; err = visorbus_write_channel(dev, channel_offset, &features, 8); - if (err) + if (err) { + dev_err(&dev->device, + "%s failed to set features in chan (%d)\n", + __func__, err); goto cleanup_xmit_cmdrsp; + } devdata->thread_wait_ms = 2; visor_thread_start(&devdata->threadinfo, process_incoming_rsps, devdata, "vnic_incoming"); err = register_netdev(netdev); - if (err) + if (err) { + dev_err(&dev->device, + "%s register_netdev failed (%d)\n", __func__, err); goto cleanup_thread_stop; + } /* create debgug/sysfs directories */ devdata->eth_debugfs_dir = debugfs_create_dir(netdev->name, visornic_debugfs_dir); if (!devdata->eth_debugfs_dir) { + dev_err(&dev->device, + "%s debugfs_create_dir %s failed\n", + __func__, netdev->name); err = -ENOMEM; goto cleanup_thread_stop; } + dev_info(&dev->device, "%s success netdev=%s\n", + __func__, netdev->name); return 0; cleanup_thread_stop: @@ -1963,8 +2026,10 @@ static void visornic_remove(struct visor_device *dev) { struct visornic_devdata *devdata = dev_get_drvdata(&dev->device); - if (!devdata) + if (!devdata) { + dev_err(&dev->device, "%s no devdata\n", __func__); return; + } dev_set_drvdata(&dev->device, NULL); host_side_disappeared(devdata); kref_put(&devdata->kref, devdata_release); @@ -2010,8 +2075,10 @@ static int visornic_resume(struct visor_device *dev, unsigned long flags; devdata = dev_get_drvdata(&dev->device); - if (!devdata) + if (!devdata) { + dev_err(&dev->device, "%s no devdata\n", __func__); return -EINVAL; + } netdev = devdata->netdev; @@ -2039,6 +2106,8 @@ static int visornic_resume(struct visor_device *dev, */ send_enbdis(netdev, 1, devdata); } else if (devdata->server_change_state) { + dev_err(&dev->device, "%s server_change_state\n", + __func__); return -EIO; } From fa15d6d3466390faae884dca45c7c21255c30f3c Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:47 -0400 Subject: [PATCH 158/912] staging: unisys: visornic: correct obvious double-allocation of workqueues Looks like an errant patch fitting caused us to redundantly allocate the workqueues at both the beginning and end of visornic_init(). This was corrected by removing the allocations at the beginning. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Fixes: 68905a14e49c ('staging: unisys: Add s-Par visornic ethernet driver') Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index de05ac79662a..2ff7f2f30660 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -2127,18 +2127,6 @@ static int visornic_init(void) struct dentry *ret; int err = -ENOMEM; - /* create workqueue for serverdown completion */ - visornic_serverdown_workqueue = - create_singlethread_workqueue("visornic_serverdown"); - if (!visornic_serverdown_workqueue) - return -ENOMEM; - - /* create workqueue for tx timeout reset */ - visornic_timeout_reset_workqueue = - create_singlethread_workqueue("visornic_timeout_reset"); - if (!visornic_timeout_reset_workqueue) - return -ENOMEM; - visornic_debugfs_dir = debugfs_create_dir("visornic", NULL); if (!visornic_debugfs_dir) return err; From 46df82267eb26f4f6859e1564dbc9580f57dc542 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:48 -0400 Subject: [PATCH 159/912] staging: unisys: visornic: correctly clean up device on removal visornic_remove() is called to logically detach the visornic driver from a visorbus-supplied device, which can happen either just prior to a visorbus-supplied device disappearing, or as a result of an rmmod of visornic. Prior to this patch, logic was missing to properly clean up for this removal, which was fixed via the following changes: * A going_away flag is now used to interlock between device destruction and workqueue operations, protected by priv_lock. I.e., setting going_away=true under lock guarantees that no new work items can get queued to the work queues. going_away=true also short-circuits other operations to enable device destruction to proceed. * Missing clean-up operations for the workqueues, netdev, debugfs entries, and the worker thread were added. * Memory referenced from the visornic private devdata struct is now freed as part of devdata destruction. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 65 ++++++++++++++++++- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 2ff7f2f30660..ba460539adb6 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -162,6 +162,7 @@ struct visornic_devdata { */ bool server_down; /* IOPART is down */ bool server_change_state; /* Processing SERVER_CHANGESTATE msg */ + bool going_away; /* device is being torn down */ struct dentry *eth_debugfs_dir; struct visor_thread_info threadinfo; u64 interrupts_rcvd; @@ -568,7 +569,17 @@ static int visornic_serverdown(struct visornic_devdata *devdata, visorbus_state_complete_func complete_func) { + unsigned long flags; + + spin_lock_irqsave(&devdata->priv_lock, flags); if (!devdata->server_down && !devdata->server_change_state) { + if (devdata->going_away) { + spin_unlock_irqrestore(&devdata->priv_lock, flags); + dev_dbg(&devdata->dev->device, + "%s aborting because device removal pending\n", + __func__); + return -ENODEV; + } devdata->server_change_state = true; devdata->server_down_complete_func = complete_func; queue_work(visornic_serverdown_workqueue, @@ -576,8 +587,10 @@ visornic_serverdown(struct visornic_devdata *devdata, } else if (devdata->server_change_state) { dev_dbg(&devdata->dev->device, "%s changing state\n", __func__); + spin_unlock_irqrestore(&devdata->priv_lock, flags); return -EINVAL; } + spin_unlock_irqrestore(&devdata->priv_lock, flags); return 0; } @@ -1236,6 +1249,14 @@ visornic_xmit_timeout(struct net_device *netdev) unsigned long flags; spin_lock_irqsave(&devdata->priv_lock, flags); + if (devdata->going_away) { + spin_unlock_irqrestore(&devdata->priv_lock, flags); + dev_dbg(&devdata->dev->device, + "%s aborting because device removal pending\n", + __func__); + return; + } + /* Ensure that a ServerDown message hasn't been received */ if (!devdata->enabled || (devdata->server_down && !devdata->server_change_state)) { @@ -1244,9 +1265,8 @@ visornic_xmit_timeout(struct net_device *netdev) spin_unlock_irqrestore(&devdata->priv_lock, flags); return; } - spin_unlock_irqrestore(&devdata->priv_lock, flags); - queue_work(visornic_timeout_reset_workqueue, &devdata->timeout_reset); + spin_unlock_irqrestore(&devdata->priv_lock, flags); } /** @@ -1614,6 +1634,9 @@ static void devdata_release(struct kref *mykref) spin_lock(&lock_all_devices); list_del(&devdata->list_all); spin_unlock(&lock_all_devices); + kfree(devdata->rcvbuf); + kfree(devdata->cmdrsp_rcv); + kfree(devdata->xmit_cmdrsp); kfree(devdata); } @@ -2025,13 +2048,51 @@ static void host_side_disappeared(struct visornic_devdata *devdata) static void visornic_remove(struct visor_device *dev) { struct visornic_devdata *devdata = dev_get_drvdata(&dev->device); + struct net_device *netdev; + unsigned long flags; if (!devdata) { dev_err(&dev->device, "%s no devdata\n", __func__); return; } + spin_lock_irqsave(&devdata->priv_lock, flags); + if (devdata->going_away) { + spin_unlock_irqrestore(&devdata->priv_lock, flags); + dev_err(&dev->device, "%s already being removed\n", __func__); + return; + } + devdata->going_away = true; + spin_unlock_irqrestore(&devdata->priv_lock, flags); + netdev = devdata->netdev; + if (!netdev) { + dev_err(&dev->device, "%s not net device\n", __func__); + return; + } + + /* going_away prevents new items being added to the workqueues */ + flush_workqueue(visornic_serverdown_workqueue); + flush_workqueue(visornic_timeout_reset_workqueue); + + debugfs_remove_recursive(devdata->eth_debugfs_dir); + + unregister_netdev(netdev); /* this will call visornic_close() */ + + /* this had to wait until last because visornic_close() / + * visornic_disable_with_timeout() polls waiting for state that is + * only updated by the thread + */ + if (devdata->threadinfo.id) { + visor_thread_stop(&devdata->threadinfo); + if (devdata->threadinfo.id) { + dev_err(&dev->device, "%s cannot stop worker thread\n", + __func__); + return; + } + } + dev_set_drvdata(&dev->device, NULL); host_side_disappeared(devdata); + free_netdev(netdev); kref_put(&devdata->kref, devdata_release); } From 3798ff31d1fb1ee33de619ffc81a6a56c3ccb973 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:49 -0400 Subject: [PATCH 160/912] staging: unisys: visornic: don't destroy global workqueues until devs destroyed visornic_cleanup() was previously incorrectly destroying its global workqueues prior to cleaning up the devices which used them. This patch corrects the order of these operations. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index ba460539adb6..14977ad356cf 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -2241,6 +2241,8 @@ cleanup_debugfs: */ static void visornic_cleanup(void) { + visorbus_unregister_visor_driver(&visornic_driver); + if (visornic_serverdown_workqueue) { flush_workqueue(visornic_serverdown_workqueue); destroy_workqueue(visornic_serverdown_workqueue); @@ -2251,7 +2253,6 @@ static void visornic_cleanup(void) } debugfs_remove_recursive(visornic_debugfs_dir); - visorbus_unregister_visor_driver(&visornic_driver); kfree(dev_num_pool); dev_num_pool = NULL; } From 1a2e3e3d0992ced8eeb4cfbf228f617ad08afbf1 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:50 -0400 Subject: [PATCH 161/912] staging: unisys: visornic: delay start of worker thread until netdev created This only makes sense, since the worker thread depends upon the netdev existing. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 14977ad356cf..07e89ad92a66 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1978,15 +1978,11 @@ static int visornic_probe(struct visor_device *dev) goto cleanup_xmit_cmdrsp; } - devdata->thread_wait_ms = 2; - visor_thread_start(&devdata->threadinfo, process_incoming_rsps, - devdata, "vnic_incoming"); - err = register_netdev(netdev); if (err) { dev_err(&dev->device, "%s register_netdev failed (%d)\n", __func__, err); - goto cleanup_thread_stop; + goto cleanup_xmit_cmdrsp; } /* create debgug/sysfs directories */ @@ -1997,16 +1993,17 @@ static int visornic_probe(struct visor_device *dev) "%s debugfs_create_dir %s failed\n", __func__, netdev->name); err = -ENOMEM; - goto cleanup_thread_stop; + goto cleanup_xmit_cmdrsp; } + devdata->thread_wait_ms = 2; + visor_thread_start(&devdata->threadinfo, process_incoming_rsps, + devdata, "vnic_incoming"); + dev_info(&dev->device, "%s success netdev=%s\n", __func__, netdev->name); return 0; -cleanup_thread_stop: - visor_thread_stop(&devdata->threadinfo); - cleanup_xmit_cmdrsp: kfree(devdata->xmit_cmdrsp); From 051e9fbbba1594331a9b3b2b157b5a0ce54b9a43 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:51 -0400 Subject: [PATCH 162/912] staging: unisys: visornic: use preferred interface for setting netdev's parent Just switch this line so it uses the correct function call. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 07e89ad92a66..9b3c5d876b86 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1869,7 +1869,7 @@ static int visornic_probe(struct visor_device *dev) netdev->netdev_ops = &visornic_dev_ops; netdev->watchdog_timeo = (5 * HZ); - netdev->dev.parent = &dev->device; + SET_NETDEV_DEV(netdev, &dev->device); /* Get MAC adddress from channel and read it into the device. */ netdev->addr_len = ETH_ALEN; From 8d0119d8e81f93cf3c1bc2b6e7a39e28620cda1a Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Thu, 9 Jul 2015 13:27:52 -0400 Subject: [PATCH 163/912] staging: unisys: visornic: prevent erroneous kfree of devdata pointer A struct visornic_devdata for each visornic device is actually allocated as part of alloc_etherdev(), here in visornic_probe(): netdev = alloc_etherdev(sizeof(struct visornic_devdata)); But code in devdata_release() was treating devdata as a pointer that needed to be kfree()d! This was causing all sorts of weird behavior after doing an rmmod of visornic, both because free_netdev() was actually freeing the memory used for devdata, and because devdata wasn't pointing to dynamically-allocated memory in the first place. The kfree(devdata) and the kref that tracked devdata's usage have been appropriately deleted. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 9b3c5d876b86..9350473a732b 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -119,7 +119,6 @@ struct visornic_devdata { struct visor_device *dev; char name[99]; struct list_head list_all; /* < link within list_all_devices list */ - struct kref kref; struct net_device *netdev; struct net_device_stats net_stats; atomic_t interrupt_rcvd; @@ -1602,14 +1601,11 @@ devdata_initialize(struct visornic_devdata *devdata, struct visor_device *dev) spin_unlock(&dev_num_pool_lock); if (devnum == MAXDEVICES) devnum = -1; - if (devnum < 0) { - kfree(devdata); + if (devnum < 0) return NULL; - } devdata->devnum = devnum; devdata->dev = dev; strncpy(devdata->name, dev_name(&dev->device), sizeof(devdata->name)); - kref_init(&devdata->kref); spin_lock(&lock_all_devices); list_add_tail(&devdata->list_all, &list_all_devices); spin_unlock(&lock_all_devices); @@ -1617,17 +1613,14 @@ devdata_initialize(struct visornic_devdata *devdata, struct visor_device *dev) } /** - * devdata_release - Frees up a devdata - * @mykref: kref to the devdata + * devdata_release - Frees up references in devdata + * @devdata: struct to clean up * - * Frees up a devdata. + * Frees up references in devdata. * Returns void */ -static void devdata_release(struct kref *mykref) +static void devdata_release(struct visornic_devdata *devdata) { - struct visornic_devdata *devdata = - container_of(mykref, struct visornic_devdata, kref); - spin_lock(&dev_num_pool_lock); clear_bit(devdata->devnum, dev_num_pool); spin_unlock(&dev_num_pool_lock); @@ -1637,7 +1630,6 @@ static void devdata_release(struct kref *mykref) kfree(devdata->rcvbuf); kfree(devdata->cmdrsp_rcv); kfree(devdata->xmit_cmdrsp); - kfree(devdata); } static const struct net_device_ops visornic_dev_ops = { @@ -2089,8 +2081,8 @@ static void visornic_remove(struct visor_device *dev) dev_set_drvdata(&dev->device, NULL); host_side_disappeared(devdata); + devdata_release(devdata); free_netdev(netdev); - kref_put(&devdata->kref, devdata_release); } /** From 1fc07f99134ba0b8d4099322ea0753137ea7ed3b Mon Sep 17 00:00:00 2001 From: David Kershner Date: Thu, 9 Jul 2015 13:27:53 -0400 Subject: [PATCH 164/912] staging: unisys: Allow visorbus to autoload We inadvertently remove the MODULE_DEVICE_TABLE line for visorbus, this patch adds it back in. Signed-off-by: David Kershner Signed-off-by: Benjamin Romer Fixes: d5b3f1dccee4 ('staging: unisys: move timskmod.h functionality') Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index d47ec24e2dc5..4be931844052 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -2382,6 +2382,9 @@ static struct acpi_driver unisys_acpi_driver = { .remove = visorchipset_exit, }, }; + +MODULE_DEVICE_TABLE(acpi, unisys_device_ids); + static __init uint32_t visorutil_spar_detect(void) { unsigned int eax, ebx, ecx, edx; From 2164be191e3d627dd7744b7224daf9ad9495c9af Mon Sep 17 00:00:00 2001 From: Ken Cox Date: Thu, 9 Jul 2015 13:28:56 -0400 Subject: [PATCH 165/912] staging: unisys: Fix broken build when ARCH=um When building with ARCH=um you get the following error: arch/x86/include/asm/cpufeature.h:252:42: error: 'REQUIRED_MASK0' undeclared The Unisys drivers should not be compiled for UML, so this patch addresses that by adding a dependency to kconfig for !UML. Reported-by: kbuild test robot Tested-by: Ken Cox Signed-off-by: Ken Cox Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig index 778f9d05f98a..624abe66c20c 100644 --- a/drivers/staging/unisys/Kconfig +++ b/drivers/staging/unisys/Kconfig @@ -3,7 +3,7 @@ # menuconfig UNISYSSPAR bool "Unisys SPAR driver support" - depends on X86_64 + depends on X86_64 && !UML select PCI select ACPI ---help--- From fd012d0def470d6c2e1a441421d00404240e7fec Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Mon, 13 Jul 2015 14:51:23 -0400 Subject: [PATCH 166/912] staging: unisys: correctly NULL-terminate visorbus sysfs attribute array I'm not sure what adverse runtime effects the previously-omitted NULL-termination would cause, but the code was definitely wrong. Fixes: 795731627c ('staging: unisys: Clean up device sysfs attributes') Signed-off-by: Tim Sell Acked-by: Don Zickus Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 6db47196c189..0f66f239dff0 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -471,6 +471,7 @@ static struct attribute *channel_attrs[] = { &dev_attr_typeguid.attr, &dev_attr_zoneguid.attr, &dev_attr_typename.attr, + NULL }; static struct attribute_group channel_attr_grp = { From d253058f490febdfdbe0a0f09a25166c71afd2b3 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Mon, 13 Jul 2015 14:51:24 -0400 Subject: [PATCH 167/912] staging: unisys: fix random memory corruption in visorchannel_write() visorchannel_write() and it's user visorbus_write_channel() are exported, so all visorbus function drivers (i.e., drivers that call visorbus_register_visor_driver()) are potentially affected by the bug. Because of pointer-arithmetic rules, the address being written to in the affected code was actually at byte offset: sizeof(struct channel_header) * offset instead of just bytes as intended. The bug could cause some very difficult-to-diagnose symptoms. The particular problem that led me on this chase was a kernel fault that would occur during 'insmod visornic' after a previous 'rmmod visornic', where we would fault during netdev_register_kobject() within pm_runtime_set_memalloc_noio() while traversing a device list, which occurred because dev->parent for the visorbus device had become corrupted. Fixes: 0abb60c1c ('staging: unisys: visorchannel_write(): Handle...') Signed-off-by: Tim Sell Acked-by: Don Zickus Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchannel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 20b63496e9f2..af349c8a3693 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -259,7 +259,8 @@ visorchannel_write(struct visorchannel *channel, ulong offset, if (offset < chdr_size) { copy_size = min(chdr_size - offset, nbytes); - memcpy(&channel->chan_hdr + offset, local, copy_size); + memcpy(((char *)(&channel->chan_hdr)) + offset, + local, copy_size); } memcpy_toio(channel->mapped + offset, local, nbytes); From 0aa5ae1e2eed3f57ff1dfd7cd057aaff5d9c1d9f Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Mon, 13 Jul 2015 20:51:32 +0200 Subject: [PATCH 168/912] staging: unisys: Use kzalloc instead of kmalloc/memset This patch turns a kmalloc/memset into an equivalent kzalloc. Signed-off-by: Christophe JAILLET Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 0f66f239dff0..2c46745f156a 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -281,12 +281,11 @@ devmajorminor_create_file(struct visor_device *dev, const char *name, rc = -ENOMEM; goto away; } - myattr = kmalloc(sizeof(*myattr), GFP_KERNEL); + myattr = kzalloc(sizeof(*myattr), GFP_KERNEL); if (!myattr) { rc = -ENOMEM; goto away; } - memset(myattr, 0, sizeof(struct devmajorminor_attribute)); myattr->show = DEVMAJORMINOR_ATTR; myattr->store = NULL; myattr->slot = slot; From 216c3e2c135e69dc8cc93ca9bd2c03300910f44f Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Mon, 13 Jul 2015 20:52:26 +0200 Subject: [PATCH 169/912] staging: unisys: Reduce indent Remove some extra tabs in order to improve readalibility. Signed-off-by: Christophe JAILLET Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorbus/visorbus_main.c | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 2c46745f156a..3e33e3629682 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -218,9 +218,9 @@ visorbus_release_device(struct device *xdev) struct devmajorminor_attribute { struct attribute attr; int slot; - ssize_t (*show)(struct visor_device *, int slot, char *buf); - ssize_t (*store)(struct visor_device *, int slot, const char *buf, - size_t count); + ssize_t (*show)(struct visor_device *, int slot, char *buf); + ssize_t (*store)(struct visor_device *, int slot, const char *buf, + size_t count); }; static ssize_t DEVMAJORMINOR_ATTR(struct visor_device *dev, int slot, char *buf) @@ -1043,10 +1043,10 @@ write_vbus_chp_info(struct visorchannel *chan, int off = sizeof(struct channel_header) + hdr_info->chp_info_offset; if (hdr_info->chp_info_offset == 0) - return -1; + return -1; if (visorchannel_write(chan, off, info, sizeof(*info)) < 0) - return -1; + return -1; return 0; } @@ -1061,10 +1061,10 @@ write_vbus_bus_info(struct visorchannel *chan, int off = sizeof(struct channel_header) + hdr_info->bus_info_offset; if (hdr_info->bus_info_offset == 0) - return -1; + return -1; if (visorchannel_write(chan, off, info, sizeof(*info)) < 0) - return -1; + return -1; return 0; } @@ -1081,10 +1081,10 @@ write_vbus_dev_info(struct visorchannel *chan, (hdr_info->device_info_struct_bytes * devix); if (hdr_info->dev_info_offset == 0) - return -1; + return -1; if (visorchannel_write(chan, off, info, sizeof(*info)) < 0) - return -1; + return -1; return 0; } @@ -1106,7 +1106,7 @@ fix_vbus_dev_info(struct visor_device *visordev) struct spar_vbus_headerinfo *hdr_info; if (!visordev->device.driver) - return; + return; hdr_info = (struct spar_vbus_headerinfo *)visordev->vbus_hdr_info; if (!hdr_info) @@ -1319,11 +1319,11 @@ static void pause_state_change_complete(struct visor_device *dev, int status) { if (!dev->pausing) - return; + return; dev->pausing = false; if (!chipset_responders.device_pause) /* this can never happen! */ - return; + return; /* Notify the chipset driver that the pause is complete, which * will presumably want to send some sort of response to the @@ -1339,11 +1339,11 @@ static void resume_state_change_complete(struct visor_device *dev, int status) { if (!dev->resuming) - return; + return; dev->resuming = false; if (!chipset_responders.device_resume) /* this can never happen! */ - return; + return; /* Notify the chipset driver that the resume is complete, * which will presumably want to send some sort of response to @@ -1367,14 +1367,14 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) else notify_func = chipset_responders.device_resume; if (!notify_func) - goto away; + goto away; drv = to_visor_driver(dev->device.driver); if (!drv) - goto away; + goto away; if (dev->pausing || dev->resuming) - goto away; + goto away; /* Note that even though both drv->pause() and drv->resume * specify a callback function, it is NOT necessary for us to @@ -1385,7 +1385,7 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) */ if (is_pause) { if (!drv->pause) - goto away; + goto away; dev->pausing = true; x = drv->pause(dev, pause_state_change_complete); @@ -1397,7 +1397,7 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) * would never even get here in that case. */ fix_vbus_dev_info(dev); if (!drv->resume) - goto away; + goto away; dev->resuming = true; x = drv->resume(dev, resume_state_change_complete); @@ -1413,7 +1413,7 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) away: if (rc < 0) { if (notify_func) - (*notify_func)(dev, rc); + (*notify_func)(dev, rc); } } @@ -1469,8 +1469,8 @@ visorbus_init(void) away: if (rc) - POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, rc, - POSTCODE_SEVERITY_ERR); + POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, rc, + POSTCODE_SEVERITY_ERR); return rc; } @@ -1495,9 +1495,8 @@ visorbus_exit(void) list_for_each_safe(listentry, listtmp, &list_all_bus_instances) { struct visor_device *dev = list_entry(listentry, - struct - visor_device, - list_all); + struct visor_device, + list_all); remove_bus_instance(dev); } remove_bus_type(); From a3ef1a8e93912396f3bd46d579c9241c399de530 Mon Sep 17 00:00:00 2001 From: David Kershner Date: Tue, 14 Jul 2015 14:43:29 -0400 Subject: [PATCH 170/912] staging: unisys: Lock visorchannels associated with devices A visorchannel associated with a device should have its writing to the channel protected by a lock. Fixes: b32c4997c ('staging: unisys: Move channel creation up the stack') Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 4be931844052..fb08f9523ab3 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1247,10 +1247,11 @@ my_device_create(struct controlvm_message *inmsg) POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no, POSTCODE_SEVERITY_INFO); - visorchannel = visorchannel_create(cmd->create_device.channel_addr, - cmd->create_device.channel_bytes, - GFP_KERNEL, - cmd->create_device.data_type_uuid); + visorchannel = + visorchannel_create_with_lock(cmd->create_device.channel_addr, + cmd->create_device.channel_bytes, + GFP_KERNEL, + cmd->create_device.data_type_uuid); if (!visorchannel) { POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, From 24ac1074c1dad1bdc455f8f6df5c5316fae53eb7 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Tue, 14 Jul 2015 14:43:30 -0400 Subject: [PATCH 171/912] staging: unisys: fix random hangs with network stress in visornic We learned that it was possible for the core networking code to call visornic_xmit() within ISR context, resulting in the need for us to use spin_lock_irqsave() / spin_lock_irqrestore() to lock accesses to our virtual device channels. Without the correct locking added in this patch, random hangs would occur on typical kernels while stressing the netork. When using a kernel with CONFIG_DEBUG_SPINLOCK=y, a stackdump would occur at the time of the hang reporting: BUG: spinlock recursion on CPU#0, vnic_incoming/ (see below for more details) We considered the possibility of adding a protocol between a visordriver and visorbus where the visordriver could specify which type of locking it required for its virtual device channels (essentially indicating whether or not it was possible for the channel to be accessed in ISR context), but decided this extra complexity was NOT needed, and that channel queues should always be accessed with the most-stringent locking. So that is what is implemented in this commit. Below is an example stackdump illustrating the spinlock recursion that is fixed by this commit. Note that we are first in virtnic_rx() writing to the device channel when an APIC timer interrupt occurs. Within the core networking code, net_rx_action() calls process_backlog(), which eventually lands up back up in virtnic_xmit() in the code attempting to also write to the device channel. BUG: spinlock recursion on CPU#0, vnic_incoming/262 lock: 0xffff88002db810c0, .magic: dead4ead, .owner: vnic_incoming/262, .owner_cpu: 0 CPU: 0 PID: 262 Comm: vnic_incoming Tainted: G C 4.2.0-rc1-ARCH+ #56 Hardware name: Dell Inc. PowerEdge T110/ , BIOS 1.23 12/15/2009 ffff8800216ac200 ffff88002c803388 ffffffff81476364 0000000000000106 ffff88002db810c0 ffff88002c8033a8 ffffffff8109e2bc ffff88002db810c0 ffffffff817631d4 ffff88002c8033c8 ffffffff8109e330 ffff88002db810c0 Call Trace: [] dump_stack+0x4f/0x73 [] spin_dump+0x7c/0xc0 [] spin_bug+0x30/0x40 [] do_raw_spin_lock+0x127/0x140 [] _raw_spin_lock+0x40/0x50 [] ? visorchannel_signalinsert+0x46/0x70 [visorbus] [] visorchannel_signalinsert+0x46/0x70 [visorbus] [] visornic_xmit+0x302/0x5d0 [visornic] [] dev_hard_start_xmit+0x2e0/0x510 [] ? validate_xmit_skb+0x235/0x310 [] sch_direct_xmit+0xf7/0x1d0 [] __dev_queue_xmit+0x203/0x640 [] ? __dev_queue_xmit+0x50/0x640 [] ? ip_finish_output+0x1df/0x310 [] dev_queue_xmit_sk+0x13/0x20 [] ip_finish_output2+0x22c/0x470 [] ? ip_finish_output+0x1df/0x310 [] ? __lock_is_held+0x50/0x70 [] ip_finish_output+0x1df/0x310 [] ip_output+0xb1/0x100 [] ip_local_out_sk+0x3e/0x80 [] ip_queue_xmit+0x188/0x4a0 [] ? ip_local_out_sk+0x80/0x80 [] ? __alloc_skb+0x86/0x1e0 [] tcp_transmit_skb+0x4cb/0x9c0 [] ? __kmalloc_reserve+0x3c/0x90 [] ? __alloc_skb+0x9a/0x1e0 [] tcp_send_ack+0x10d/0x150 [] __tcp_ack_snd_check+0x5e/0x90 [] tcp_rcv_established+0x354/0x710 [] tcp_v4_do_rcv+0x162/0x3f0 [] tcp_v4_rcv+0xb22/0xb50 [] ? ip_local_deliver_finish+0x4c/0x2d0 [] ip_local_deliver_finish+0xe0/0x2d0 [] ? ip_local_deliver_finish+0x4c/0x2d0 [] ip_local_deliver+0xae/0xc0 [] ip_rcv_finish+0x14f/0x510 [] ? __netif_receive_skb_core+0x9d/0xb70 [] ip_rcv+0x2d3/0x3b0 [] ? cpuacct_css_alloc+0xb0/0xb0 [] __netif_receive_skb_core+0x663/0xb70 [] ? __netif_receive_skb_core+0x9d/0xb70 [] ? cpuacct_charge+0x99/0xb0 [] ? cpuacct_css_alloc+0xb0/0xb0 [] ? __lock_is_held+0x50/0x70 [] ? process_backlog+0xbc/0x150 [] ? process_backlog+0x11b/0x150 [] __netif_receive_skb+0x27/0x70 [] process_backlog+0x92/0x150 [] net_rx_action+0x13d/0x350 [] ? lapic_next_event+0x1d/0x30 [] __do_softirq+0x104/0x320 [] ? hrtimer_interrupt+0xc8/0x1a0 [] ? blocking_notifier_chain_cond_register+0x70/0x70 [] irq_exit+0x79/0xa0 [] smp_apic_timer_interrupt+0x4a/0x60 [] apic_timer_interrupt+0x68/0x70 [] ? __memcpy+0x12/0x20 [] ? visorchannel_write+0x4a/0x80 [visorbus] [] signalinsert_inner+0x88/0x130 [visorbus] [] visorchannel_signalinsert+0x55/0x70 [visorbus] [] visornic_rx+0x12e7/0x19d0 [visornic] [] process_incoming_rsps+0x289/0x690 [visornic] [] ? preempt_schedule+0x25/0x30 [] ? ___preempt_schedule+0x12/0x14 [] ? wait_woken+0x90/0x90 [] ? visornic_rx+0x19d0/0x19d0 [visornic] [] ? visornic_rx+0x19d0/0x19d0 [visornic] [] kthread+0xe9/0x110 [] ? __init_kthread_worker+0x70/0x70 [] ret_from_fork+0x3f/0x70 [] ? __init_kthread_worker+0x70/0x70 Fixes: b12fdf7da ('staging: unisys: rework signal remove/insert to avoid sparse lock warnings') Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchannel.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index af349c8a3693..c6452c3908e6 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -417,11 +417,12 @@ bool visorchannel_signalremove(struct visorchannel *channel, u32 queue, void *msg) { bool rc; + unsigned long flags; if (channel->needs_lock) { - spin_lock(&channel->remove_lock); + spin_lock_irqsave(&channel->remove_lock, flags); rc = signalremove_inner(channel, queue, msg); - spin_unlock(&channel->remove_lock); + spin_unlock_irqrestore(&channel->remove_lock, flags); } else { rc = signalremove_inner(channel, queue, msg); } @@ -471,11 +472,12 @@ bool visorchannel_signalinsert(struct visorchannel *channel, u32 queue, void *msg) { bool rc; + unsigned long flags; if (channel->needs_lock) { - spin_lock(&channel->insert_lock); + spin_lock_irqsave(&channel->insert_lock, flags); rc = signalinsert_inner(channel, queue, msg); - spin_unlock(&channel->insert_lock); + spin_unlock_irqrestore(&channel->insert_lock, flags); } else { rc = signalinsert_inner(channel, queue, msg); } From f0a2db08e31071946c421a0ba0bb99e8273d2808 Mon Sep 17 00:00:00 2001 From: Fabio Falzoi Date: Tue, 30 Jun 2015 08:43:08 +0200 Subject: [PATCH 172/912] Staging: fbtft: Remove paragraph about writing to FSF Remove paragraph about writing to the Free Software Foundation's mailing address from GPL notice. This patch fixes the following checkpatch error: CHECK:FSF_MAILING_ADDRESS at line 17. Signed-off-by: Fabio Falzoi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/flexfb.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 2c4ce07f5106..80b66204f705 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -12,10 +12,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include From df127f13c2342eef93298874713947adce8168ad Mon Sep 17 00:00:00 2001 From: Fabio Falzoi Date: Tue, 30 Jun 2015 08:43:09 +0200 Subject: [PATCH 173/912] Staging: fbtft: Remove unnecessary multiple blank lines This patch removes some unnecessary multiple blank lines to fix the following checkpatch errors: CHECK:LINE_SPACING at lines 29, 67, 131, 287, 299, 312, 326, 351 and 364. Signed-off-by: Fabio Falzoi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/flexfb.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 80b66204f705..ed867e7055d6 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -26,7 +26,6 @@ #define DRVNAME "flexfb" - static char *chip; module_param(chip, charp, 0); MODULE_PARM_DESC(chip, "LCD controller"); @@ -64,7 +63,6 @@ static bool latched; module_param(latched, bool, 0); MODULE_PARM_DESC(latched, "Use with latched 16-bit databus"); - static int *initp; static int initp_num; @@ -128,7 +126,6 @@ static int ssd1351_init[] = { -1, 0xfd, 0x12, -1, 0xfd, 0xb1, -1, 0xae, -1, 0xb3 -1, 0xab, 0x01, -1, 0xb1, 0x32, -1, 0xb4, 0xa0, 0xb5, 0x55, -1, 0xbb, 0x17, -1, 0xbe, 0x05, -1, 0xc1, 0xc8, 0x80, 0xc8, -1, 0xc7, 0x0f, -1, 0xb6, 0x01, -1, 0xa6, -1, 0xaf, -3 }; - /* ili9320, ili9325 */ static void flexfb_set_addr_win_1(struct fbtft_par *par, int xs, int ys, int xe, int ye) @@ -284,7 +281,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(st7735r_init); } - } else if (!strcmp(chip, "hx8340bn")) { if (!width) width = 176; @@ -296,7 +292,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(hx8340bn_init); } - } else if (!strcmp(chip, "ili9225")) { if (!width) width = 176; @@ -309,8 +304,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(ili9225_init); } - - } else if (!strcmp(chip, "ili9320")) { if (!width) width = 240; @@ -323,7 +316,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(ili9320_init); } - } else if (!strcmp(chip, "ili9325")) { if (!width) width = 240; @@ -348,7 +340,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(ili9341_init); } - } else if (!strcmp(chip, "ssd1289")) { if (!width) width = 240; @@ -361,8 +352,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(ssd1289_init); } - - } else if (!strcmp(chip, "ssd1351")) { if (!width) width = 128; From 4906c43a342f864ca93f85aecab0d2f5d6689668 Mon Sep 17 00:00:00 2001 From: Fabio Falzoi Date: Tue, 30 Jun 2015 08:43:16 +0200 Subject: [PATCH 174/912] Staging: fbtft: Fix parenthesis alignment coding style issue This patch fixes the following checkpatch.pl error: CHECK:PARENTHESIS_ALIGNMENT at line 217. Signed-off-by: Fabio Falzoi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/flexfb.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index ed867e7055d6..13d173e1822a 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -130,9 +130,8 @@ static int ssd1351_init[] = { -1, 0xfd, 0x12, -1, 0xfd, 0xb1, -1, 0xae, -1, 0xb3 static void flexfb_set_addr_win_1(struct fbtft_par *par, int xs, int ys, int xe, int ye) { - fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, - "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", - __func__, xs, ys, xe, ye); + fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", + __func__, xs, ys, xe, ye); switch (par->info->var.rotate) { /* R20h = Horizontal GRAM Start Address */ /* R21h = Vertical GRAM Start Address */ @@ -512,8 +511,8 @@ static int flexfb_remove_common(struct device *dev, struct fb_info *info) return -EINVAL; par = info->par; if (par) - fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, - "%s()\n", __func__); + fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, "%s()\n", + __func__); fbtft_unregister_framebuffer(info); fbtft_framebuffer_release(info); From a1bf5205b2f013134ac55b02b3384502f21daa5e Mon Sep 17 00:00:00 2001 From: Fabio Falzoi Date: Tue, 30 Jun 2015 08:43:17 +0200 Subject: [PATCH 175/912] Staging: fbtft: Fix spacing coding style issue This patch fixes the following checkpatch.pl error: CHECK:SPACING at line 318. Signed-off-by: Fabio Falzoi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/flexfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 13d173e1822a..ce6e3ae30a2e 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -234,7 +234,7 @@ static int flexfb_verify_gpios_db(struct fbtft_par *par) return -EINVAL; } if (latched) - num_db = buswidth/2; + num_db = buswidth / 2; for (i = 0; i < num_db; i++) { if (par->gpio.db[i] < 0) { dev_err(par->info->device, From dc4b2068934d6562048393d4531b9983df41b14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 11 Jul 2015 18:57:04 +0200 Subject: [PATCH 176/912] staging: fbtft: Add reset to fbtft_init_display_dt() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an init sequence is present in the Device Tree, fbtft_init_display_dt() is used to initialize the display. Add missing reset function call and activation of chip select for parallel bus. Signed-off-by: Noralf Trønnes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 9cc81412be69..f04128fb0693 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -1076,6 +1076,11 @@ static int fbtft_init_display_dt(struct fbtft_par *par) p = of_prop_next_u32(prop, NULL, &val); if (!p) return -EINVAL; + + par->fbtftops.reset(par); + if (par->gpio.cs != -1) + gpio_set_value(par->gpio.cs, 0); /* Activate chip */ + while (p) { if (val & FBTFT_OF_INIT_CMD) { val &= 0xFFFF; From a1560f9bec8b9275a751bd39a1db791d2c73d6e5 Mon Sep 17 00:00:00 2001 From: Henri Chain Date: Tue, 14 Jul 2015 14:59:39 +0200 Subject: [PATCH 177/912] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller This is a driver chip for 240x160 4-bit greyscale LCDs. It is capable of 4-wire (8 bit) or 3-wire (9 bit) SPI that have both been tested. (It also has a 6800 or 8080-style parallel interface, but I have not included support for it.) Signed-off-by: Henri Chain Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/Kconfig | 6 + drivers/staging/fbtft/Makefile | 1 + drivers/staging/fbtft/fb_uc1611.c | 350 +++++++++++++++++++++++++++ drivers/staging/fbtft/fbtft_device.c | 31 +++ 4 files changed, 388 insertions(+) create mode 100644 drivers/staging/fbtft/fb_uc1611.c diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig index d4018780ce58..f7e68fdd9904 100644 --- a/drivers/staging/fbtft/Kconfig +++ b/drivers/staging/fbtft/Kconfig @@ -152,6 +152,12 @@ config FB_TFT_TLS8204 help Generic Framebuffer support for TLS8204 +config FB_TFT_UC1611 + tristate "FB driver for the UC1611 LCD controller" + depends on FB_TFT + help + Generic Framebuffer support for UC1611 + config FB_TFT_UC1701 tristate "FB driver for the UC1701 LCD Controller" depends on FB_TFT diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile index 554b5260b0ee..b26efdc87775 100644 --- a/drivers/staging/fbtft/Makefile +++ b/drivers/staging/fbtft/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o obj-$(CONFIG_FB_TFT_ST7735R) += fb_st7735r.o obj-$(CONFIG_FB_TFT_TINYLCD) += fb_tinylcd.o obj-$(CONFIG_FB_TFT_TLS8204) += fb_tls8204.o +obj-$(CONFIG_FB_TFT_UC1611) += fb_uc1611.o obj-$(CONFIG_FB_TFT_UC1701) += fb_uc1701.o obj-$(CONFIG_FB_TFT_UPD161704) += fb_upd161704.o obj-$(CONFIG_FB_TFT_WATTEROTT) += fb_watterott.o diff --git a/drivers/staging/fbtft/fb_uc1611.c b/drivers/staging/fbtft/fb_uc1611.c new file mode 100644 index 000000000000..32f3a9d921d6 --- /dev/null +++ b/drivers/staging/fbtft/fb_uc1611.c @@ -0,0 +1,350 @@ +/* + * FB driver for the UltraChip UC1611 LCD controller + * + * The display is 4-bit grayscale (16 shades) 240x160. + * + * Copyright (C) 2015 Henri Chain + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include + +#include "fbtft.h" + +#define DRVNAME "fb_uc1611" +#define WIDTH 240 +#define HEIGHT 160 +#define BPP 8 +#define FPS 40 + +/* + * LCD voltage is a combination of ratio, gain, pot and temp + * + * V_LCD = V_BIAS * ratio + * V_LCD = (C_V0 + C_PM × pot) * (1 + (T - 25) * temp) + * C_V0 and C_PM depend on ratio and gain + * T is ambient temperature + */ + +/* BR -> actual ratio: 0-3 -> 5, 10, 11, 13 */ +static unsigned ratio = 2; +module_param(ratio, uint, 0); +MODULE_PARM_DESC(ratio, "BR[1:0] Bias voltage ratio: 0-3 (default: 2)"); + +static unsigned gain = 3; +module_param(gain, uint, 0); +MODULE_PARM_DESC(gain, "GN[1:0] Bias voltage gain: 0-3 (default: 3)"); + +static unsigned pot = 16; +module_param(pot, uint, 0); +MODULE_PARM_DESC(pot, "PM[6:0] Bias voltage pot.: 0-63 (default: 16)"); + +/* TC -> % compensation per deg C: 0-3 -> -.05, -.10, -.015, -.20 */ +static unsigned temp; +module_param(temp, uint, 0); +MODULE_PARM_DESC(temp, "TC[1:0] Temperature compensation: 0-3 (default: 0)"); + +/* PC[1:0] -> LCD capacitance: 0-3 -> <20nF, 20-28 nF, 29-40 nF, 40-56 nF */ +static unsigned load = 1; +module_param(load, uint, 0); +MODULE_PARM_DESC(load, "PC[1:0] Panel Loading: 0-3 (default: 1)"); + +/* PC[3:2] -> V_LCD: 0, 1, 3 -> ext., int. with ratio = 5, int. standard */ +static unsigned pump = 3; +module_param(pump, uint, 0); +MODULE_PARM_DESC(pump, "PC[3:2] Pump control: 0,1,3 (default: 3)"); + +static int init_display(struct fbtft_par *par) +{ + int ret; + + fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); + + /* Set CS active high */ + par->spi->mode |= SPI_CS_HIGH; + ret = par->spi->master->setup(par->spi); + if (ret) { + dev_err(par->info->device, "Could not set SPI_CS_HIGH\n"); + return ret; + } + + /* Reset controller */ + write_reg(par, 0xE2); + + /* Set bias ratio */ + write_reg(par, 0xE8 | (ratio & 0x03)); + + /* Set bias gain and potentiometer */ + write_reg(par, 0x81); + write_reg(par, (gain & 0x03) << 6 | (pot & 0x3F)); + + /* Set temperature compensation */ + write_reg(par, 0x24 | (temp & 0x03)); + + /* Set panel loading */ + write_reg(par, 0x28 | (load & 0x03)); + + /* Set pump control */ + write_reg(par, 0x2C | (pump & 0x03)); + + /* Set inverse display */ + write_reg(par, 0xA6 | (0x01 & 0x01)); + + /* Set 4-bit grayscale mode */ + write_reg(par, 0xD0 | (0x02 & 0x03)); + + /* Set Display enable */ + write_reg(par, 0xA8 | 0x07); + + return 0; +} + +static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) +{ + fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, + "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", + __func__, xs, ys, xe, ye); + + switch (par->info->var.rotate) { + case 90: + case 270: + /* Set column address */ + write_reg(par, ys & 0x0F); + write_reg(par, 0x10 | (ys >> 4)); + + /* Set page address (divide xs by 2) (not used by driver) */ + write_reg(par, 0x60 | ((xs >> 1) & 0x0F)); + write_reg(par, 0x70 | (xs >> 5)); + break; + default: + /* Set column address (not used by driver) */ + write_reg(par, xs & 0x0F); + write_reg(par, 0x10 | (xs >> 4)); + + /* Set page address (divide ys by 2) */ + write_reg(par, 0x60 | ((ys >> 1) & 0x0F)); + write_reg(par, 0x70 | (ys >> 5)); + break; + } +} + +static int blank(struct fbtft_par *par, bool on) +{ + fbtft_par_dbg(DEBUG_BLANK, par, "%s(blank=%s)\n", + __func__, on ? "true" : "false"); + + if (on) + write_reg(par, 0xA8 | 0x00); + else + write_reg(par, 0xA8 | 0x07); + return 0; +} + +static int set_var(struct fbtft_par *par) +{ + fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); + + /* par->info->fix.visual = FB_VISUAL_PSEUDOCOLOR; */ + par->info->var.grayscale = 1; + par->info->var.red.offset = 0; + par->info->var.red.length = 8; + par->info->var.green.offset = 0; + par->info->var.green.length = 8; + par->info->var.blue.offset = 0; + par->info->var.blue.length = 8; + par->info->var.transp.offset = 0; + par->info->var.transp.length = 0; + + switch (par->info->var.rotate) { + case 90: + /* Set RAM address control */ + write_reg(par, 0x88 + | (0x0 & 0x1) << 2 /* Increment positively */ + | (0x1 & 0x1) << 1 /* Increment page first */ + | (0x1 & 0x1)); /* Wrap around (default) */ + + /* Set LCD mapping */ + write_reg(par, 0xC0 + | (0x0 & 0x1) << 2 /* Mirror Y OFF */ + | (0x0 & 0x1) << 1 /* Mirror X OFF */ + | (0x0 & 0x1)); /* MS nibble last (default) */ + break; + case 180: + /* Set RAM address control */ + write_reg(par, 0x88 + | (0x0 & 0x1) << 2 /* Increment positively */ + | (0x0 & 0x1) << 1 /* Increment column first */ + | (0x1 & 0x1)); /* Wrap around (default) */ + + /* Set LCD mapping */ + write_reg(par, 0xC0 + | (0x1 & 0x1) << 2 /* Mirror Y ON */ + | (0x0 & 0x1) << 1 /* Mirror X OFF */ + | (0x0 & 0x1)); /* MS nibble last (default) */ + break; + case 270: + /* Set RAM address control */ + write_reg(par, 0x88 + | (0x0 & 0x1) << 2 /* Increment positively */ + | (0x1 & 0x1) << 1 /* Increment page first */ + | (0x1 & 0x1)); /* Wrap around (default) */ + + /* Set LCD mapping */ + write_reg(par, 0xC0 + | (0x1 & 0x1) << 2 /* Mirror Y ON */ + | (0x1 & 0x1) << 1 /* Mirror X ON */ + | (0x0 & 0x1)); /* MS nibble last (default) */ + break; + default: + /* Set RAM address control */ + write_reg(par, 0x88 + | (0x0 & 0x1) << 2 /* Increment positively */ + | (0x0 & 0x1) << 1 /* Increment column first */ + | (0x1 & 0x1)); /* Wrap around (default) */ + + /* Set LCD mapping */ + write_reg(par, 0xC0 + | (0x0 & 0x1) << 2 /* Mirror Y OFF */ + | (0x1 & 0x1) << 1 /* Mirror X ON */ + | (0x0 & 0x1)); /* MS nibble last (default) */ + break; + } + + return 0; +} + +static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) +{ + u8 *vmem8 = (u8 *)(par->info->screen_base); + u8 *buf8 = (u8 *)(par->txbuf.buf); + u16 *buf16 = (u16 *)(par->txbuf.buf); + int line_length = par->info->fix.line_length; + int y_start = (offset / line_length); + int y_end = (offset + len - 1) / line_length; + int x, y, i; + int ret = 0; + + fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); + + switch (par->pdata->display.buswidth) { + case 8: + switch (par->info->var.rotate) { + case 90: + case 270: + i = y_start * line_length; + for (y = y_start; y <= y_end; y++) { + for (x = 0; x < line_length; x += 2) { + *buf8 = vmem8[i] >> 4; + *buf8 |= vmem8[i + 1] & 0xF0; + buf8++; + i += 2; + } + } + break; + default: + /* Must be even because pages are two lines */ + y_start &= 0xFE; + i = y_start * line_length; + for (y = y_start; y <= y_end; y += 2) { + for (x = 0; x < line_length; x++) { + *buf8 = vmem8[i] >> 4; + *buf8 |= vmem8[i + line_length] & 0xF0; + buf8++; + i++; + } + i += line_length; + } + break; + } + gpio_set_value(par->gpio.dc, 1); + + /* Write data */ + ret = par->fbtftops.write(par, par->txbuf.buf, len / 2); + break; + case 9: + switch (par->info->var.rotate) { + case 90: + case 270: + i = y_start * line_length; + for (y = y_start; y <= y_end; y++) { + for (x = 0; x < line_length; x += 2) { + *buf16 = 0x100; + *buf16 |= vmem8[i] >> 4; + *buf16 |= vmem8[i + 1] & 0xF0; + buf16++; + i += 2; + } + } + break; + default: + /* Must be even because pages are two lines */ + y_start &= 0xFE; + i = y_start * line_length; + for (y = y_start; y <= y_end; y += 2) { + for (x = 0; x < line_length; x++) { + *buf16 = 0x100; + *buf16 |= vmem8[i] >> 4; + *buf16 |= vmem8[i + line_length] & 0xF0; + buf16++; + i++; + } + i += line_length; + } + break; + } + + /* Write data */ + ret = par->fbtftops.write(par, par->txbuf.buf, len); + break; + default: + dev_err(par->info->device, "unsupported buswidth %d\n", + par->pdata->display.buswidth); + } + + if (ret < 0) + dev_err(par->info->device, "write failed and returned: %d\n", + ret); + + return ret; +} + +static struct fbtft_display display = { + .txbuflen = -1, + .regwidth = 8, + .width = WIDTH, + .height = HEIGHT, + .bpp = BPP, + .fps = FPS, + .fbtftops = { + .write_vmem = write_vmem, + .init_display = init_display, + .set_addr_win = set_addr_win, + .set_var = set_var, + .blank = blank, + }, +}; + +FBTFT_REGISTER_DRIVER(DRVNAME, "ultrachip,uc1611", &display); + +MODULE_ALIAS("spi:" DRVNAME); +MODULE_ALIAS("platform:" DRVNAME); +MODULE_ALIAS("spi:uc1611"); +MODULE_ALIAS("platform:uc1611"); + +MODULE_DESCRIPTION("FB driver for the UC1611 LCD controller"); +MODULE_AUTHOR("Henri Chain"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 211d504901f2..fa916e88d549 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -396,6 +396,37 @@ static struct fbtft_device_display displays[] = { }, } } + }, { + .name = "ew24ha0", + .spi = &(struct spi_board_info) { + .modalias = "fb_uc1611", + .max_speed_hz = 32000000, + .mode = SPI_MODE_3, + .platform_data = &(struct fbtft_platform_data) { + .display = { + .buswidth = 8, + }, + .gpios = (const struct fbtft_gpio []) { + { "dc", 24 }, + {}, + }, + } + } + }, { + .name = "ew24ha0_9bit", + .spi = &(struct spi_board_info) { + .modalias = "fb_uc1611", + .max_speed_hz = 32000000, + .mode = SPI_MODE_3, + .platform_data = &(struct fbtft_platform_data) { + .display = { + .buswidth = 9, + }, + .gpios = (const struct fbtft_gpio []) { + {}, + }, + } + } }, { .name = "flexfb", .spi = &(struct spi_board_info) { From 943304b3fb54adc5f2ec85d1679c7b2b8d908346 Mon Sep 17 00:00:00 2001 From: Arjun Krishna Babu Date: Sat, 20 Jun 2015 12:46:50 +0800 Subject: [PATCH 178/912] staging: vt6656: Fixed two lines over 80 characters long The presence of comments originally caused the two lines to be over 80 characters long. The issue is fixed by moving the comments into a separate line. Signed-off-by: Arjun Krishna Babu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 8116791f4f06..da075f485298 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -45,8 +45,11 @@ #include "usbpipe.h" static const u16 vnt_time_stampoff[2][MAX_RATE] = { - {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23},/* Long Preamble */ - {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23},/* Short Preamble */ + /* Long Preamble */ + {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, + + /* Short Preamble */ + {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, }; static const u16 vnt_fb_opt0[2][5] = { From 4fdae0d9fee32c1cbffffb1a246fcc10ed5b1085 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sun, 21 Jun 2015 11:05:54 +0100 Subject: [PATCH 179/912] staging: vt6655: vnt_tx_packet don't wakeup from power saving. mac80211 changes the wake state before attempting to tx data Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index ed040fbb7df8..0176456d15e2 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1211,9 +1211,6 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) vnt_generate_fifo_header(priv, dma_idx, head_td, skb); - if (MACbIsRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) - MACbPSWakeup(priv->PortOffset); - spin_lock_irqsave(&priv->lock, flags); priv->bPWBitOn = false; From 3e7921a09407743c52498c188adfa56156d60fc3 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sun, 21 Jun 2015 11:05:55 +0100 Subject: [PATCH 180/912] staging: vt6655: Correct listen interval TBTT wake up PSbIsNextTBTTWakeUp is called at beacon intervals. The should listen to next beacon on count down of wake_up_count == 1. This restores this back to vendors code but modified for mac80211. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device.h | 1 + drivers/staging/vt6655/power.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index 5cf1b337cba7..6aebb495fa8d 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -403,6 +403,7 @@ struct vnt_private { unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */ unsigned short wBeaconInterval; + u16 wake_up_count; struct work_struct interrupt_work; diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index be3c4e949b6a..06e6b9d871c4 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -157,10 +157,18 @@ PSbIsNextTBTTWakeUp( struct ieee80211_conf *conf = &hw->conf; bool bWakeUp = false; - if (conf->listen_interval == 1) { - /* Turn on wake up to listen next beacon */ - MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN); - bWakeUp = true; + if (conf->listen_interval > 1) { + if (!pDevice->wake_up_count) + pDevice->wake_up_count = conf->listen_interval; + + --pDevice->wake_up_count; + + if (pDevice->wake_up_count == 1) { + /* Turn on wake up to listen next beacon */ + MACvRegBitsOn(pDevice->PortOffset, + MAC_REG_PSCTL, PSCTL_LNBCN); + bWakeUp = true; + } } return bWakeUp; From eda01f6161e0f0d156f7fd24080d3a788ebbb911 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Thu, 9 Jul 2015 17:01:25 +0100 Subject: [PATCH 181/912] staging: vt6655: Fix missing power saving support Add IEEE80211_HW_SUPPORTS_PS to ieee80211_hw flags enabling this feature. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 0176456d15e2..4f55d5e9a9c5 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1808,6 +1808,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) ieee80211_hw_set(priv->hw, SIGNAL_DBM); ieee80211_hw_set(priv->hw, RX_INCLUDES_FCS); ieee80211_hw_set(priv->hw, REPORTS_TX_ACK_STATUS); + ieee80211_hw_set(priv->hw, SUPPORTS_PS); priv->hw->max_signal = 100; From 353710ce90b74d711d6d30f1219e0c9634c6fc82 Mon Sep 17 00:00:00 2001 From: Nicholas Parkanyi Date: Sun, 12 Jul 2015 09:20:31 -0400 Subject: [PATCH 182/912] Staging: vt6655: Replace C99 comments in rf.h and rf.c. This patch replaces C99 comments in rf.h and rf.c, with C89 comments, fixing the checkpatch.pl errors. Signed-off-by: Nicholas Parkanyi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rf.c | 516 ++++++++++++++++++------------------ drivers/staging/vt6655/rf.h | 24 +- 2 files changed, 270 insertions(+), 270 deletions(-) diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index 7626f635f160..c537321444be 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -39,66 +39,66 @@ #include "rf.h" #include "baseband.h" -#define BY_AL2230_REG_LEN 23 //24bit +#define BY_AL2230_REG_LEN 23 /* 24bit */ #define CB_AL2230_INIT_SEQ 15 -#define SWITCH_CHANNEL_DELAY_AL2230 200 //us +#define SWITCH_CHANNEL_DELAY_AL2230 200 /* us */ #define AL2230_PWR_IDX_LEN 64 -#define BY_AL7230_REG_LEN 23 //24bit +#define BY_AL7230_REG_LEN 23 /* 24bit */ #define CB_AL7230_INIT_SEQ 16 -#define SWITCH_CHANNEL_DELAY_AL7230 200 //us +#define SWITCH_CHANNEL_DELAY_AL7230 200 /* us */ #define AL7230_PWR_IDX_LEN 64 static const unsigned long dwAL2230InitTable[CB_AL2230_INIT_SEQ] = { - 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x01A00200+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x00FFF300+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x0F4DC500+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x0805B600+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x0146C700+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x00068800+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x0403B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x00DBBA00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // - 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // + 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x01A00200+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x00FFF300+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0F4DC500+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0805B600+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0146C700+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x00068800+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x0403B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x00DBBA00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, + 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x0BDFFC00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x00000D00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x00580F00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW }; static const unsigned long dwAL2230ChannelTable0[CB_MAX_CHANNEL] = { - 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz - 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz - 0x03E79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz - 0x03E79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz - 0x03F7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz - 0x03F7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz - 0x03E7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz - 0x03E7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz - 0x03F7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz - 0x03F7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz - 0x03E7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz - 0x03E7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz - 0x03F7C000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz - 0x03E7C000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW // channel = 14, Tf = 2412M + 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */ + 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */ + 0x03E79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */ + 0x03E79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */ + 0x03F7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */ + 0x03F7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */ + 0x03E7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */ + 0x03E7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */ + 0x03F7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */ + 0x03F7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */ + 0x03E7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */ + 0x03E7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */ + 0x03F7C000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */ + 0x03E7C000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW /* channel = 14, Tf = 2412M */ }; static const unsigned long dwAL2230ChannelTable1[CB_MAX_CHANNEL] = { - 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz - 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz - 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz - 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz - 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz - 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz - 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz - 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz - 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz - 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz - 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz - 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz - 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz - 0x06666100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW // channel = 14, Tf = 2412M + 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */ + 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */ + 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */ + 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */ + 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */ + 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */ + 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */ + 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */ + 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */ + 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */ + 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */ + 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */ + 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */ + 0x06666100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW /* channel = 14, Tf = 2412M */ }; static unsigned long dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { @@ -168,240 +168,240 @@ static unsigned long dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { 0x0407F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW }; -// 40MHz reference frequency -// Need to Pull PLLON(PE3) low when writing channel registers through 3-wire. +/* 40MHz reference frequency + * Need to Pull PLLON(PE3) low when writing channel registers through 3-wire.*/ static const unsigned long dwAL7230InitTable[CB_AL7230_INIT_SEQ] = { - 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel1 // Need modify for 11a - 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel1 // Need modify for 11a - 0x841FF200+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 451FE2 - 0x3FDFA300+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 5FDFA3 - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 11b/g // Need modify for 11a - // RoberYu:20050113, Rev0.47 Regsiter Setting Guide - 0x802B5500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 8D1B55 + 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Channel1 // Need modify for 11a */ + 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Channel1 // Need modify for 11a */ + 0x841FF200+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11a: 451FE2 */ + 0x3FDFA300+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11a: 5FDFA3 */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* 11b/g // Need modify for 11a */ + /* RoberYu:20050113, Rev0.47 Regsiter Setting Guide */ + 0x802B5500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11a: 8D1B55 */ 0x56AF3600+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, - 0xCE020700+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 860207 + 0xCE020700+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11a: 860207 */ 0x6EBC0800+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, - 0xE0000A00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: E0600A - 0x08031B00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) - // RoberYu:20050113, Rev0.47 Regsiter Setting Guide - 0x000A3C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 00143C + 0xE0000A00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11a: E0600A */ + 0x08031B00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) */ + /* RoberYu:20050113, Rev0.47 Regsiter Setting Guide */ + 0x000A3C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11a: 00143C */ 0xFFFFFD00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, 0x00000E00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, - 0x1ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // Need modify for 11a: 12BACF + 0x1ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW /* Need modify for 11a: 12BACF */ }; static const unsigned long dwAL7230InitTableAMode[CB_AL7230_INIT_SEQ] = { - 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel184 // Need modify for 11b/g - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel184 // Need modify for 11b/g - 0x451FE200+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g - 0x5FDFA300+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g - 0x67F78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 11a // Need modify for 11b/g - 0x853F5500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g, RoberYu:20050113 + 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Channel184 // Need modify for 11b/g */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Channel184 // Need modify for 11b/g */ + 0x451FE200+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11b/g */ + 0x5FDFA300+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11b/g */ + 0x67F78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* 11a // Need modify for 11b/g */ + 0x853F5500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11b/g, RoberYu:20050113 */ 0x56AF3600+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, - 0xCE020700+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g + 0xCE020700+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11b/g */ 0x6EBC0800+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, - 0xE0600A00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g - 0x08031B00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) - 0x00147C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g + 0xE0600A00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11b/g */ + 0x08031B00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) */ + 0x00147C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* Need modify for 11b/g */ 0xFFFFFD00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, 0x00000E00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, - 0x12BACF00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // Need modify for 11b/g + 0x12BACF00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW /* Need modify for 11b/g */ }; static const unsigned long dwAL7230ChannelTable0[CB_MAX_CHANNEL] = { - 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz - 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz - 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz - 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz - 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz - 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz - 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz - 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz //RobertYu: 20050218, update for APNode 0.49 - 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz //RobertYu: 20050218, update for APNode 0.49 - 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz //RobertYu: 20050218, update for APNode 0.49 - 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz //RobertYu: 20050218, update for APNode 0.49 - 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz //RobertYu: 20050218, update for APNode 0.49 - 0x0037C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz //RobertYu: 20050218, update for APNode 0.49 - 0x0037C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz + 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */ + 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */ + 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */ + 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */ + 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */ + 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */ + 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */ + 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz //RobertYu: 20050218, update for APNode 0.49 */ + 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz //RobertYu: 20050218, update for APNode 0.49 */ + 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz //RobertYu: 20050218, update for APNode 0.49 */ + 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz //RobertYu: 20050218, update for APNode 0.49 */ + 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz //RobertYu: 20050218, update for APNode 0.49 */ + 0x0037C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz //RobertYu: 20050218, update for APNode 0.49 */ + 0x0037C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */ - // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) - 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15) - 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16) - 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17) - 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18) - 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19) - 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20) - 0x0FF53000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21) - 0x0FF53000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 196, Tf = 4980MHz (22) + /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */ + 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */ + 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */ + 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */ + 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */ + 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */ + 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */ + 0x0FF53000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */ + 0x0FF53000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */ - // 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) + /* 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) */ - 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23) - 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24) - 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25) - 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26) - 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27) - 0x0FF55000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28) - 0x0FF56000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29) - 0x0FF56000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30) - 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31) //RobertYu: 20050218, update for APNode 0.49 - 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32) - 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33) - 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34) - 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35) - 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36) - 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37) - 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38) - 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39) - 0x0FF59000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40) + 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */ + 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */ + 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */ + 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */ + 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */ + 0x0FF55000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */ + 0x0FF56000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */ + 0x0FF56000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */ + 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) //RobertYu: 20050218, update for APNode 0.49 */ + 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */ + 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */ + 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */ + 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */ + 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */ + 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */ + 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */ + 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */ + 0x0FF59000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */ - 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41) - 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42) - 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43) - 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44) - 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45) - 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46) - 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47) - 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48) - 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49) - 0x0FF5F000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50) - 0x0FF5F000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51) - 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52) - 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53) - 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54) - 0x0FF61000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55) - 0x0FF61000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56) + 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */ + 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */ + 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */ + 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */ + 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */ + 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */ + 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */ + 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */ + 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */ + 0x0FF5F000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */ + 0x0FF5F000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */ + 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */ + 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */ + 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */ + 0x0FF61000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */ + 0x0FF61000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */ }; static const unsigned long dwAL7230ChannelTable1[CB_MAX_CHANNEL] = { - 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz - 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz - 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz - 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz - 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz - 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz - 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz - 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz - 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz - 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz - 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz - 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz - 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz - 0x06666100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz + 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */ + 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */ + 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */ + 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */ + 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */ + 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */ + 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */ + 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */ + 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */ + 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */ + 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */ + 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */ + 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */ + 0x06666100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */ - // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) - 0x1D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16) - 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17) - 0x08000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18) - 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19) - 0x0D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 196, Tf = 4980MHz (22) + /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */ + 0x1D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */ + 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */ + 0x08000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */ + 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */ + 0x0D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */ - // 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) - 0x1D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24) - 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25) - 0x08000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26) - 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28) - 0x05555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29) - 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30) - 0x10000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32) - 0x1AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34) - 0x05555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35) - 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38) - 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42) - 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45) - 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48) - 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49) - 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50) - 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51) - 0x18000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52) - 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53) - 0x0D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54) - 0x18000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55) - 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56) + /* 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) */ + 0x1D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */ + 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */ + 0x08000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */ + 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */ + 0x05555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */ + 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */ + 0x10000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */ + 0x1AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */ + 0x05555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */ + 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */ + 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */ + 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */ + 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */ + 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */ + 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */ + 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */ + 0x18000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */ + 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */ + 0x0D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */ + 0x18000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */ + 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */ }; static const unsigned long dwAL7230ChannelTable2[CB_MAX_CHANNEL] = { - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz - 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */ + 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */ - // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 196, Tf = 4980MHz (22) + /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */ - // 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) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50) - 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55) - 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56) + /* 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) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */ + 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */ + 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */ }; /* @@ -438,13 +438,13 @@ static bool s_bAL7230Init(struct vnt_private *priv) MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3); /* Calibration */ - MACvTimer0MicroSDelay(dwIoBase, 150);//150us + MACvTimer0MicroSDelay(dwIoBase, 150);/* 150us */ /* TXDCOC:active, RCK:disable */ bResult &= IFRFbWriteEmbedded(priv, (0x9ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW)); - MACvTimer0MicroSDelay(dwIoBase, 30);//30us + MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */ /* TXDCOC:disable, RCK:active */ bResult &= IFRFbWriteEmbedded(priv, (0x3ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW)); - MACvTimer0MicroSDelay(dwIoBase, 30);//30us + MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */ /* TXDCOC:disable, RCK:disable */ bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[CB_AL7230_INIT_SEQ-1]); @@ -457,7 +457,7 @@ static bool s_bAL7230Init(struct vnt_private *priv) /* PE1: TX_ON, PE2: RX_ON, PE3: PLLON */ /* 3-wire control for power saving mode */ - VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); //1100 0000 + VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); /* 1100 0000 */ return bResult; } @@ -557,16 +557,16 @@ static bool RFbAL2230Init(struct vnt_private *priv) for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++) bResult &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[ii]); - MACvTimer0MicroSDelay(dwIoBase, 30); //delay 30 us + MACvTimer0MicroSDelay(dwIoBase, 30); /* delay 30 us */ /* PLL On */ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3); - MACvTimer0MicroSDelay(dwIoBase, 150);//150us + MACvTimer0MicroSDelay(dwIoBase, 150);/* 150us */ bResult &= IFRFbWriteEmbedded(priv, (0x00d80f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW)); - MACvTimer0MicroSDelay(dwIoBase, 30);//30us + MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */ bResult &= IFRFbWriteEmbedded(priv, (0x00780f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW)); - MACvTimer0MicroSDelay(dwIoBase, 30);//30us + MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */ bResult &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[CB_AL2230_INIT_SEQ-1]); MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 | @@ -575,7 +575,7 @@ static bool RFbAL2230Init(struct vnt_private *priv) SOFTPWRCTL_TXPEINV)); /* 3-wire control for power saving mode */ - VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); //1100 0000 + VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); /* 1100 0000 */ return bResult; } @@ -661,11 +661,11 @@ bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType, case RF_AL2230S: bResult = RFbAL2230SelectChannel(priv, byChannel); break; - //{{ RobertYu: 20050104 + /*{{ RobertYu: 20050104 */ case RF_AIROHA7230: bResult = s_bAL7230SelectChannel(priv, byChannel); break; - //}} RobertYu + /*}} RobertYu */ case RF_NOTHING: bResult = true; break; diff --git a/drivers/staging/vt6655/rf.h b/drivers/staging/vt6655/rf.h index 2ea21e2b00f2..b5fc3eed06fb 100644 --- a/drivers/staging/vt6655/rf.h +++ b/drivers/staging/vt6655/rf.h @@ -33,18 +33,18 @@ #include "device.h" /*--------------------- Export Definitions -------------------------*/ -// -// Baseband RF pair definition in eeprom (Bits 6..0) -// +/* + * Baseband RF pair definition in eeprom (Bits 6..0) +*/ #define RF_RFMD2959 0x01 #define RF_MAXIMAG 0x02 #define RF_AIROHA 0x03 #define RF_UW2451 0x05 #define RF_MAXIMG 0x06 -#define RF_MAXIM2829 0x07 // RobertYu: 20041118 -#define RF_UW2452 0x08 // RobertYu: 20041210 -#define RF_AIROHA7230 0x0a // RobertYu: 20050104 +#define RF_MAXIM2829 0x07 /* RobertYu: 20041118 */ +#define RF_UW2452 0x08 /* RobertYu: 20041210 */ +#define RF_AIROHA7230 0x0a /* RobertYu: 20050104 */ #define RF_UW2453 0x0b #define RF_VT3226 0x09 @@ -63,9 +63,9 @@ #define ZONE_MKK 6 #define ZONE_ISRAEL 7 -//[20050104] CB_MAXIM2829_CHANNEL_5G_HIGH, CB_UW2452_CHANNEL_5G_HIGH: 40==>41 -#define CB_MAXIM2829_CHANNEL_5G_HIGH 41 //Index41: channel = 100, Tf = 5500MHz, set the (A3:A0=0101) D6=1 -#define CB_UW2452_CHANNEL_5G_HIGH 41 //[20041210] Index41: channel = 100, Tf = 5500MHz, change VCO2->VCO3 +/* [20050104] CB_MAXIM2829_CHANNEL_5G_HIGH, CB_UW2452_CHANNEL_5G_HIGH: 40==>41 */ +#define CB_MAXIM2829_CHANNEL_5G_HIGH 41 /* Index41: channel = 100, Tf = 5500MHz, set the (A3:A0=0101) D6=1 */ +#define CB_UW2452_CHANNEL_5G_HIGH 41 /* [20041210] Index41: channel = 100, Tf = 5500MHz, change VCO2->VCO3 */ /*--------------------- Export Classes ----------------------------*/ @@ -93,8 +93,8 @@ RFvRSSITodBm( long *pldBm ); -//{{ RobertYu: 20050104 +/* {{ RobertYu: 20050104 */ bool RFbAL7230SelectChannelPostProcess(struct vnt_private *, u16, u16); -//}} RobertYu +/* }} RobertYu */ -#endif // __RF_H__ +#endif /* __RF_H__ */ From 11208b0b3a9ddc462795bdb3aadfc0eda8ef2e4b Mon Sep 17 00:00:00 2001 From: Nicholas Parkanyi Date: Sun, 12 Jul 2015 08:17:52 -0400 Subject: [PATCH 183/912] Staging: vt6655: Remove do { } while (0) from single-statement macros in upc.h. This patch fixes checkpatch.pl warnings in upc.h regarding single-statement macros embedded within do { } while (0) blocks. Signed-off-by: Nicholas Parkanyi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/upc.h | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h index cc63dc8d47f7..85fe0464cfb3 100644 --- a/drivers/staging/vt6655/upc.h +++ b/drivers/staging/vt6655/upc.h @@ -37,35 +37,23 @@ /* For memory mapped IO */ -#define VNSvInPortB(dwIOAddress, pbyData) \ -do { \ - *(pbyData) = ioread8(dwIOAddress); \ -} while (0) +#define VNSvInPortB(dwIOAddress, pbyData) \ + (*(pbyData) = ioread8(dwIOAddress)) -#define VNSvInPortW(dwIOAddress, pwData) \ -do { \ - *(pwData) = ioread16(dwIOAddress); \ -} while (0) +#define VNSvInPortW(dwIOAddress, pwData) \ + (*(pwData) = ioread16(dwIOAddress)) -#define VNSvInPortD(dwIOAddress, pdwData) \ -do { \ - *(pdwData) = ioread32(dwIOAddress); \ -} while (0) +#define VNSvInPortD(dwIOAddress, pdwData) \ + (*(pdwData) = ioread32(dwIOAddress)) -#define VNSvOutPortB(dwIOAddress, byData) \ -do { \ - iowrite8((u8)byData, dwIOAddress); \ -} while (0) +#define VNSvOutPortB(dwIOAddress, byData) \ + iowrite8((u8)(byData), dwIOAddress) -#define VNSvOutPortW(dwIOAddress, wData) \ -do { \ - iowrite16((u16)wData, dwIOAddress); \ -} while (0) +#define VNSvOutPortW(dwIOAddress, wData) \ + iowrite16((u16)(wData), dwIOAddress) -#define VNSvOutPortD(dwIOAddress, dwData) \ -do { \ - iowrite32((u32)dwData, dwIOAddress); \ -} while (0) +#define VNSvOutPortD(dwIOAddress, dwData) \ + iowrite32((u32)(dwData), dwIOAddress) #define PCAvDelayByIO(uDelayUnit) \ do { \ From edeafb979666e28cbd4699716a1e5533791ea916 Mon Sep 17 00:00:00 2001 From: Joglekar Tejas Date: Sat, 20 Jun 2015 12:46:16 +0000 Subject: [PATCH 184/912] staging:rtl8723au:odm.c:Removing trailing whitespaces This patch removes the trailing whitespace error given by checkpatch.pl Signed-off-by: Joglekar Tejas Acked-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index f354f5e11a30..6b9dbeffafcb 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -985,7 +985,7 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) val32 = rtl8723au_read32(adapter, 0x874); val32 |= pDM_PSTable->Reg874; rtl8723au_write32(adapter, 0x874, val32); - + val32 = rtl8723au_read32(adapter, 0xc70); val32 |= pDM_PSTable->RegC70; rtl8723au_write32(adapter, 0xc70, val32); From e60b6538342ec047ae2e49335f65b7f92585fab9 Mon Sep 17 00:00:00 2001 From: Greg Donald Date: Sat, 20 Jun 2015 11:06:48 -0500 Subject: [PATCH 185/912] drivers: staging: rtl8192u: Fix "space required after that ','" errors Fix checkpatch.pl "space required after that ','" errors Signed-off-by: Greg Donald Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++-- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 2 +- drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +- drivers/staging/rtl8192u/r819xU_firmware.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 1b11acb96233..a1f9d42833e0 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1177,7 +1177,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag = skb_put(skb, ht_cap_len); *tag++ = MFIE_TYPE_HT_CAP; *tag++ = ht_cap_len - 2; - memcpy(tag, ht_cap_buf,ht_cap_len -2); + memcpy(tag, ht_cap_buf, ht_cap_len - 2); tag += ht_cap_len -2; } } @@ -1214,7 +1214,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag = skb_put(skb, realtek_ie_len); *tag++ = MFIE_TYPE_GENERIC; *tag++ = realtek_ie_len - 2; - memcpy(tag, realtek_ie_buf,realtek_ie_len -2 ); + memcpy(tag, realtek_ie_buf, realtek_ie_len - 2); } } // printk("<=====%s(), %p, %p\n", __func__, ieee->dev, ieee->dev->dev_addr); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index 714fbcace72b..3e502520648e 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -391,7 +391,7 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { - int ret=0,len; + int ret = 0, len; short proto_started; unsigned long flags; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index c2588f80625b..80411c93d8fa 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -956,7 +956,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) // HTDebugHTCapability(pHTInfo->PeerHTCapBuf,"HTOnAssocRsp_wq"); // HTDebugHTInfo(pHTInfo->PeerHTInfoBuf,"HTOnAssocRsp_wq"); // - if(!memcmp(pHTInfo->PeerHTCapBuf,EWC11NHTCap, sizeof(EWC11NHTCap))) + if (!memcmp(pHTInfo->PeerHTCapBuf, EWC11NHTCap, sizeof(EWC11NHTCap))) pPeerHTCap = (PHT_CAPABILITY_ELE)(&pHTInfo->PeerHTCapBuf[4]); else pPeerHTCap = (PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf); diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index d27b1e24ca4a..742725e9bfc1 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -66,7 +66,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); if (!skb) return false; - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT; From 7ee8095bfe1d61ab4a59f5eff14d833ff90c0b38 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 26 Jun 2015 09:54:00 +0530 Subject: [PATCH 186/912] Staging: rtl8192u: Replace memset with eth_zero_addr Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero. Note that the 6 in the third argument of memset appears to represent an ethernet address size (ETH_ALEN). The Coccinelle semantic patch that makes this change is as follows: // @eth_zero_addr@ expression e; @@ -memset(e,0x00,6); +eth_zero_addr(e); // Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index ea92fdebe5a7..b89105dbcbba 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -112,7 +112,7 @@ static void TsAddBaProcess(unsigned long data) static void ResetTsCommonInfo(PTS_COMMON_INFO pTsCommonInfo) { - memset(pTsCommonInfo->Addr, 0, 6); + eth_zero_addr(pTsCommonInfo->Addr); memset(&pTsCommonInfo->TSpec, 0, sizeof(TSPEC_BODY)); memset(&pTsCommonInfo->TClass, 0, sizeof(QOS_TCLAS)*TCLAS_NUM); pTsCommonInfo->TClasProc = 0; From 0ccd8ebb0e17ddeb2d56cf644da089adc4aa3bc0 Mon Sep 17 00:00:00 2001 From: Peter Karlsson Date: Sun, 21 Jun 2015 13:29:50 +0200 Subject: [PATCH 187/912] staging: ft1000-usb: fixed table alignment Fixed alignment to 8 bytes per line. Signed-off-by: Peter Karlsson Signed-off-by: Greg Kroah-Hartman --- .../staging/ft1000/ft1000-usb/ft1000_debug.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index 409266b1a886..90942e02a583 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -415,12 +415,19 @@ static long ft1000_ioctl(struct file *file, unsigned int command, struct timeval tv; struct IOCTL_GET_VER get_ver_data; struct IOCTL_GET_DSP_STAT get_stat_data; - u8 ConnectionMsg[] = {0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x93, 0x64, - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f, 0x00, - 0x00, 0x01, 0x00, 0x00}; + u8 ConnectionMsg[] = { + 0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x93, 0x64, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f, 0x00, + 0x00, 0x01, 0x00, 0x00 + }; unsigned short ledStat = 0; unsigned short conStat = 0; From d4216b30bdd56fb823c1d32b5e46687ae87601f6 Mon Sep 17 00:00:00 2001 From: Peter Karlsson Date: Sun, 21 Jun 2015 13:29:51 +0200 Subject: [PATCH 188/912] staging: ft1000-usb: shorten lines to under 80 characters Wrap function arguments to shorten lines to under 80 characters. Signed-off-by: Peter Karlsson Signed-off-by: Greg Kroah-Hartman --- .../staging/ft1000/ft1000-usb/ft1000_debug.c | 12 +++++++---- .../ft1000/ft1000-usb/ft1000_download.c | 21 ++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index 90942e02a583..f241a3a5a684 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -260,7 +260,8 @@ void ft1000_destroy_dev(struct net_device *netdev) /* Make sure we free any memory reserve for slow Queue */ for (i = 0; i < MAX_NUM_APP; i++) { 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); + 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); @@ -502,10 +503,12 @@ static long ft1000_ioctl(struct file *file, unsigned int command, memcpy(get_stat_data.eui64, info->eui64, EUISZ); if (info->ProgConStat != 0xFF) { - ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); + ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED, + (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); get_stat_data.LedStat = ntohs(ledStat); pr_debug("LedStat = 0x%x\n", get_stat_data.LedStat); - ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); + ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, + (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); get_stat_data.ConStat = ntohs(conStat); pr_debug("ConStat = 0x%x\n", get_stat_data.ConStat); } else { @@ -696,7 +699,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command, if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) { /* pr_debug("Message detected in slow queue\n"); */ spin_lock_irqsave(&free_buff_lock, flags); - pdpram_blk = list_entry(ft1000dev->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); ft1000dev->app_info[i].NumOfMsg--; /* pr_debug("NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */ diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index 5def347beb08..a72511c21200 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -180,7 +180,8 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value) } status = ft1000_read_dpram16(ft1000dev, - DWNLD_MAG1_HANDSHAKE_LOC, (u8 *)&handshake, 1); + DWNLD_MAG1_HANDSHAKE_LOC, + (u8 *)&handshake, 1); handshake = ntohs(handshake); if (status) @@ -281,12 +282,14 @@ static u16 get_request_type(struct ft1000_usb *ft1000dev) if (ft1000dev->bootmode == 1) { status = fix_ft1000_read_dpram32(ft1000dev, - DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx); + DWNLD_MAG1_TYPE_LOC, + (u8 *)&tempx); tempx = ntohl(tempx); } else { tempx = 0; status = ft1000_read_dpram16(ft1000dev, - DWNLD_MAG1_TYPE_LOC, (u8 *)&tempword, 1); + DWNLD_MAG1_TYPE_LOC, + (u8 *)&tempword, 1); tempx |= (tempword << 16); tempx = ntohl(tempx); } @@ -304,7 +307,8 @@ static u16 get_request_type_usb(struct ft1000_usb *ft1000dev) if (ft1000dev->bootmode == 1) { status = fix_ft1000_read_dpram32(ft1000dev, - DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx); + DWNLD_MAG1_TYPE_LOC, + (u8 *)&tempx); tempx = ntohl(tempx); } else { if (ft1000dev->usbboot == 2) { @@ -332,14 +336,17 @@ static long get_request_value(struct ft1000_usb *ft1000dev) if (ft1000dev->bootmode == 1) { status = fix_ft1000_read_dpram32(ft1000dev, - DWNLD_MAG1_SIZE_LOC, (u8 *)&value); + DWNLD_MAG1_SIZE_LOC, + (u8 *)&value); value = ntohl(value); } else { status = ft1000_read_dpram16(ft1000dev, - DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 0); + DWNLD_MAG1_SIZE_LOC, + (u8 *)&tempword, 0); value = tempword; status = ft1000_read_dpram16(ft1000dev, - DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 1); + DWNLD_MAG1_SIZE_LOC, + (u8 *)&tempword, 1); value |= (tempword << 16); value = ntohl(value); } From f4bf6b343073e32d5cf8fdb0f38192493fcad5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Thu, 25 Jun 2015 20:34:43 +0300 Subject: [PATCH 189/912] staging: ft1000: convert pack pragma to __packed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert a Microsoft compiler specific directive "#pragma pack(1)" to a GCC equivalent __packed. Also, by doing this we save ourselves from trouble if any other struct definitions are added after the #pragma because it will be applied to all of the definitions following it. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_download.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index a72511c21200..297b7aece506 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -95,7 +95,6 @@ struct dsp_file_hdr { long nDspImages; /* Number of DSP images in file. */ }; -#pragma pack(1) struct dsp_image_info { long coff_date; /* Date/time when DSP Coff image was built. */ long begin_offset; /* Offset in file where image begins. */ @@ -105,7 +104,7 @@ struct dsp_image_info { long version; /* Embedded version # of DSP code. */ unsigned short checksum; /* DSP File checksum */ unsigned short pad1; -}; +} __packed; /* checks if the doorbell register is cleared */ From 8027b3332142268a1cf988fd62946a4afe49b986 Mon Sep 17 00:00:00 2001 From: Sunil Shahu Date: Mon, 22 Jun 2015 16:58:41 +0530 Subject: [PATCH 190/912] drivers: staging: rtl8712: remove unnecessary else statement "else" statement after "if" is unnecessary, hence removed. Signed-off-by: Sunil Shahu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_security.c | 33 ++++++++++------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index bcd1a5128868..21465c9c898f 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -124,28 +124,25 @@ static u8 crc32_reverseBit(u8 data) static void crc32_init(void) { + sint i, j; + u32 c = 0x12340000; + u8 *p = (u8 *)&c, *p1; + u8 k; + if (bcrc32initialized == 1) return; - else { - sint i, j; - u32 c; - u8 *p = (u8 *)&c, *p1; - u8 k; - c = 0x12340000; - for (i = 0; i < 256; ++i) { - k = crc32_reverseBit((u8)i); - for (c = ((u32)k) << 24, j = 8; j > 0; --j) - c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : - (c << 1); - p1 = (u8 *)&crc32_table[i]; - p1[0] = crc32_reverseBit(p[3]); - p1[1] = crc32_reverseBit(p[2]); - p1[2] = crc32_reverseBit(p[1]); - p1[3] = crc32_reverseBit(p[0]); - } - bcrc32initialized = 1; + for (i = 0; i < 256; ++i) { + k = crc32_reverseBit((u8)i); + for (c = ((u32)k) << 24, j = 8; j > 0; --j) + c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c << 1); + p1 = (u8 *)&crc32_table[i]; + p1[0] = crc32_reverseBit(p[3]); + p1[1] = crc32_reverseBit(p[2]); + p1[2] = crc32_reverseBit(p[1]); + p1[3] = crc32_reverseBit(p[0]); } + bcrc32initialized = 1; } static u32 getcrc32(u8 *buf, u32 len) From a732152c76ee194274299905c700125bef1fc0c8 Mon Sep 17 00:00:00 2001 From: Sunil Shahu Date: Fri, 26 Jun 2015 19:42:24 +0530 Subject: [PATCH 191/912] staging: rtl8712: rtl871x_security.c: remove unnecessary variable initialization Variable "u32 c" always re-initialize in for loop. Initialized value of "u32 c" is not used in function and is redundant, hence removed. Suggested-by: Dan Carpenter Signed-off-by: Sunil Shahu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index 21465c9c898f..862792826dc5 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -125,7 +125,7 @@ static u8 crc32_reverseBit(u8 data) static void crc32_init(void) { sint i, j; - u32 c = 0x12340000; + u32 c; u8 *p = (u8 *)&c, *p1; u8 k; From 5eafbb0c529c5765fcfd57cb073982ad1cd06cc7 Mon Sep 17 00:00:00 2001 From: Ravi Teja Darbha Date: Tue, 30 Jun 2015 02:18:56 +0530 Subject: [PATCH 192/912] rtl8712:Fix checkpatch warning Fix line over 80 characters warning. Signed-off-by: Ravi Teja Darbha Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl8712_recv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index fcb8c61b2884..4fa2540a6c34 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -58,8 +58,8 @@ int r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter *padapter) /*init recv_buf*/ _init_queue(&precvpriv->free_recv_buf_queue); - precvpriv->pallocated_recv_buf = kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, - GFP_ATOMIC); + precvpriv->pallocated_recv_buf = + kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, GFP_ATOMIC); if (precvpriv->pallocated_recv_buf == NULL) return _FAIL; precvpriv->precv_buf = precvpriv->pallocated_recv_buf + 4 - From d5a3a945fdf2584f3191e8cc958234057ef691da Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Thu, 9 Jul 2015 06:05:09 +0000 Subject: [PATCH 193/912] staging: xgifb: prefer using the BIT macro This patch uses the BIT macro for bit shift operation. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xgifb/XGI_main_26.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 943d463cf193..5bfe151ea328 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -18,8 +18,8 @@ #define Index_CR_GPIO_Reg1 0x48 #define Index_CR_GPIO_Reg3 0x4a -#define GPIOG_EN (1<<6) -#define GPIOG_READ (1<<1) +#define GPIOG_EN BIT(6) +#define GPIOG_READ BIT(1) static char *forcecrt2type; static char *mode; From fb44d9a507305ab05945d8a781a0a1255a3d9868 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Tue, 14 Jul 2015 00:44:09 +0200 Subject: [PATCH 194/912] staging/xgifb: Move register helper functions to header and mark them as static inline. This shrinks the compiled module from 137442 to 117732 bytes and we also get rid of vb_util.c Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xgifb/Makefile | 2 +- drivers/staging/xgifb/vb_util.c | 42 ------------------------------- drivers/staging/xgifb/vb_util.h | 44 +++++++++++++++++++++++++++++---- 3 files changed, 40 insertions(+), 48 deletions(-) delete mode 100644 drivers/staging/xgifb/vb_util.c diff --git a/drivers/staging/xgifb/Makefile b/drivers/staging/xgifb/Makefile index 55e519905346..964a843c4521 100644 --- a/drivers/staging/xgifb/Makefile +++ b/drivers/staging/xgifb/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_FB_XGI) += xgifb.o -xgifb-y := XGI_main_26.o vb_init.o vb_setmode.o vb_util.o +xgifb-y := XGI_main_26.o vb_init.o vb_setmode.o diff --git a/drivers/staging/xgifb/vb_util.c b/drivers/staging/xgifb/vb_util.c deleted file mode 100644 index be3437ca339e..000000000000 --- a/drivers/staging/xgifb/vb_util.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "vgatypes.h" -#include "vb_util.h" - -void xgifb_reg_set(unsigned long port, u8 index, u8 data) -{ - outb(index, port); - outb(data, port + 1); -} - -u8 xgifb_reg_get(unsigned long port, u8 index) -{ - outb(index, port); - return inb(port + 1); -} - -void xgifb_reg_and_or(unsigned long port, u8 index, - unsigned data_and, unsigned data_or) -{ - u8 temp; - - temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ - temp = (temp & data_and) | data_or; - xgifb_reg_set(port, index, temp); -} - -void xgifb_reg_and(unsigned long port, u8 index, unsigned data_and) -{ - u8 temp; - - temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ - temp &= data_and; - xgifb_reg_set(port, index, temp); -} - -void xgifb_reg_or(unsigned long port, u8 index, unsigned data_or) -{ - u8 temp; - - temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ - temp |= data_or; - xgifb_reg_set(port, index, temp); -} diff --git a/drivers/staging/xgifb/vb_util.h b/drivers/staging/xgifb/vb_util.h index 9161de1d37dd..7bd395fb31b2 100644 --- a/drivers/staging/xgifb/vb_util.h +++ b/drivers/staging/xgifb/vb_util.h @@ -1,9 +1,43 @@ #ifndef _VBUTIL_ #define _VBUTIL_ -extern void xgifb_reg_set(unsigned long, u8, u8); -extern u8 xgifb_reg_get(unsigned long, u8); -extern void xgifb_reg_or(unsigned long, u8, unsigned); -extern void xgifb_reg_and(unsigned long, u8, unsigned); -extern void xgifb_reg_and_or(unsigned long, u8, unsigned, unsigned); +static inline void xgifb_reg_set(unsigned long port, u8 index, u8 data) +{ + outb(index, port); + outb(data, port + 1); +} + +static inline u8 xgifb_reg_get(unsigned long port, u8 index) +{ + outb(index, port); + return inb(port + 1); +} + +static inline void xgifb_reg_and_or(unsigned long port, u8 index, + unsigned data_and, unsigned data_or) +{ + u8 temp; + + temp = xgifb_reg_get(port, index); + temp = (temp & data_and) | data_or; + xgifb_reg_set(port, index, temp); +} + +static inline void xgifb_reg_and(unsigned long port, u8 index, unsigned data_and) +{ + u8 temp; + + temp = xgifb_reg_get(port, index); + temp &= data_and; + xgifb_reg_set(port, index, temp); +} + +static inline void xgifb_reg_or(unsigned long port, u8 index, unsigned data_or) +{ + u8 temp; + + temp = xgifb_reg_get(port, index); + temp |= data_or; + xgifb_reg_set(port, index, temp); +} #endif From 4f920c1f1778193338925ee3665844e08b4a6997 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Tue, 23 Jun 2015 22:52:39 +0800 Subject: [PATCH 195/912] staging: mt29f_spinand: Remove redundant spi driver bus initialization In ancient times it was necessary to manually initialize the bus field of an spi_driver to spi_bus_type. These days this is done in spi_register_driver(), so we can drop the manual assignment. Signed-off-by: Antonio Borneo To: Greg Kroah-Hartman To: devel@driverdev.osuosl.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt29f_spinand/mt29f_spinand.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c index 7285c64bac24..ad30ce4206ef 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c @@ -948,7 +948,6 @@ static const struct of_device_id spinand_dt[] = { static struct spi_driver spinand_driver = { .driver = { .name = "mt29f", - .bus = &spi_bus_type, .owner = THIS_MODULE, .of_match_table = spinand_dt, }, From 304e08845126d949eacb2d95a5d15d4d022d555b Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Thu, 25 Jun 2015 14:56:13 +0200 Subject: [PATCH 196/912] staging: speakup: fix indentation Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/keyhelp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/speakup/keyhelp.c b/drivers/staging/speakup/keyhelp.c index 94756742136f..02d5c706aee7 100644 --- a/drivers/staging/speakup/keyhelp.c +++ b/drivers/staging/speakup/keyhelp.c @@ -165,7 +165,7 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key) synth_printf("\n"); return 1; } - cur_item = letter_offsets[ch-'a']; + cur_item = letter_offsets[ch-'a']; } else if (type == KT_CUR) { if (ch == 0 && (MSG_FUNCNAMES_START + cur_item + 1) <= From d6cb68d51e7123a66c78ec4c48b2686509f290b6 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 7 Jul 2015 13:44:33 +0530 Subject: [PATCH 197/912] staging: sm7xxfb: remove unused macros These macros were only defined but not used anywhere. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xx.h | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h index 4bed0946c1b1..31a21bd85dae 100644 --- a/drivers/staging/sm7xxfb/sm7xx.h +++ b/drivers/staging/sm7xxfb/sm7xx.h @@ -13,8 +13,6 @@ * more details. */ -#define NR_PALETTE 256 - #define FB_ACCEL_SMI_LYNX 88 #define SCREEN_X_RES 1024 @@ -31,12 +29,8 @@ extern void __iomem *smtc_regbaseaddress; #define smtc_mmiowb(dat, reg) writeb(dat, smtc_regbaseaddress + reg) -#define smtc_mmioww(dat, reg) writew(dat, smtc_regbaseaddress + reg) -#define smtc_mmiowl(dat, reg) writel(dat, smtc_regbaseaddress + reg) #define smtc_mmiorb(reg) readb(smtc_regbaseaddress + reg) -#define smtc_mmiorw(reg) readw(smtc_regbaseaddress + reg) -#define smtc_mmiorl(reg) readl(smtc_regbaseaddress + reg) #define SIZE_SR00_SR04 (0x04 - 0x00 + 1) #define SIZE_SR10_SR24 (0x24 - 0x10 + 1) @@ -48,8 +42,6 @@ extern void __iomem *smtc_regbaseaddress; #define SIZE_CR00_CR18 (0x18 - 0x00 + 1) #define SIZE_CR30_CR4D (0x4D - 0x30 + 1) #define SIZE_CR90_CRA7 (0xA7 - 0x90 + 1) -#define SIZE_VPR (0x6C + 1) -#define SIZE_DPR (0x44 + 1) static inline void smtc_crtcw(int reg, int val) { @@ -57,24 +49,12 @@ static inline void smtc_crtcw(int reg, int val) smtc_mmiowb(val, 0x3d5); } -static inline unsigned int smtc_crtcr(int reg) -{ - smtc_mmiowb(reg, 0x3d4); - return smtc_mmiorb(0x3d5); -} - static inline void smtc_grphw(int reg, int val) { smtc_mmiowb(reg, 0x3ce); smtc_mmiowb(val, 0x3cf); } -static inline unsigned int smtc_grphr(int reg) -{ - smtc_mmiowb(reg, 0x3ce); - return smtc_mmiorb(0x3cf); -} - static inline void smtc_attrw(int reg, int val) { smtc_mmiorb(0x3da); From 4a012d30508ed09063e35eeee95e34ecc8534716 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 7 Jul 2015 13:44:34 +0530 Subject: [PATCH 198/912] staging: sm7xxfb: fix error handling We were checking smtc_regbaseaddress and that too at a place where it can never be NULL. Real check should be on sfb->lfb immediately after we do ioremap. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 2ff4fe73d148..8fb62af8f97d 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -1456,6 +1456,14 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, #else sfb->lfb = ioremap(mmio_base, 0x00800000); #endif + if (!sfb->lfb) { + dev_err(&pdev->dev, + "%s: unable to map memory mapped IO!\n", + sfb->fb->fix.id); + err = -ENOMEM; + goto failed_fb; + } + sfb->mmio = (smtc_regbaseaddress = sfb->lfb + 0x00700000); sfb->dp_regs = sfb->lfb + 0x00408000; @@ -1466,13 +1474,6 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "sfb->lfb=%p\n", sfb->lfb); } #endif - if (!smtc_regbaseaddress) { - dev_err(&pdev->dev, - "%s: unable to map memory mapped IO!\n", - sfb->fb->fix.id); - err = -ENOMEM; - goto failed_fb; - } /* set MCLK = 14.31818 * (0x16 / 0x2) */ smtc_seqw(0x6a, 0x16); From eb90d44de7e6c7498a21e8de2935123395bbc31b Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 7 Jul 2015 13:44:35 +0530 Subject: [PATCH 199/912] staging: sm7xxfb: use kernel commandline We were only using the kernel commandline to set the mode if this driver is builtin, but when it is built as a module we were not having any way to set the mode. Start using commandline even if it is built as a module. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 8fb62af8f97d..4dc9d5f32517 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -1660,14 +1660,12 @@ static struct pci_driver smtcfb_driver = { static int __init sm712fb_init(void) { -#ifndef MODULE char *option = NULL; if (fb_get_options("sm712fb", &option)) return -ENODEV; if (option && *option) mode_option = option; -#endif sm7xx_vga_setup(mode_option); return pci_register_driver(&smtcfb_driver); From 027d3efd933d87ca3d9a28365cae795c14e7a563 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Fri, 26 Jun 2015 07:50:34 +0200 Subject: [PATCH 200/912] staging: rtl8188eu: don't duplicate ieee80211 WLAN_CAPABILITY_* constants linux/ieee80211.h already defines constants for capability bits. Include it where needed, resolve discrepancies in naming, and remove the duplicated definitions. Also, make use of WLAN_CAPABILITY_IS_STA_BSS() macro to check if neither ESS nor IBSS capability bits are set. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ap.c | 2 +- drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 2 ++ drivers/staging/rtl8188eu/core/rtw_mlme.c | 5 +++-- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 ++ drivers/staging/rtl8188eu/include/ieee80211.h | 10 ---------- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 4 ++-- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 581af88e3024..9d484cf81184 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -1584,7 +1584,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) } } - if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT)) { + if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)) { if (!psta->no_short_slot_time_set) { psta->no_short_slot_time_set = 1; diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index 11b780d6c4ab..d43e8672d86e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -19,6 +19,8 @@ ******************************************************************************/ #define _IEEE80211_C +#include + #include #include #include diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index 05584515c5b4..a1ed741fc804 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -19,6 +19,7 @@ ******************************************************************************/ #define _RTW_MLME_C_ +#include #include #include @@ -352,8 +353,8 @@ int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst) ((!memcmp(src->Ssid.Ssid, dst->Ssid.Ssid, src->Ssid.SsidLength)) == true) && ((s_cap & WLAN_CAPABILITY_IBSS) == (d_cap & WLAN_CAPABILITY_IBSS)) && - ((s_cap & WLAN_CAPABILITY_BSS) == - (d_cap & WLAN_CAPABILITY_BSS))); + ((s_cap & WLAN_CAPABILITY_ESS) == + (d_cap & WLAN_CAPABILITY_ESS))); } struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue) diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 32300df7b996..077b39a41c60 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -19,6 +19,8 @@ ******************************************************************************/ #define _RTW_WLAN_UTIL_C_ +#include + #include #include #include diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index b129ad148b47..fabb95917e8b 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -483,16 +483,6 @@ struct ieee80211_snap_hdr { #define WLAN_AUTH_CHALLENGE_LEN 128 -#define WLAN_CAPABILITY_BSS (1<<0) -#define WLAN_CAPABILITY_IBSS (1<<1) -#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) -#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) -#define WLAN_CAPABILITY_PRIVACY (1<<4) -#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) -#define WLAN_CAPABILITY_PBCC (1<<6) -#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) -#define WLAN_CAPABILITY_SHORT_SLOT (1<<10) - /* Non standard? Not in */ #define WLAN_REASON_EXPIRATION_CHK 65535 diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index 38dba1435c1e..ce756cdb817b 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -179,8 +179,8 @@ static char *translate_scan(struct adapter *padapter, cap = le16_to_cpu(le_tmp); - if (cap & (WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_BSS)) { - if (cap & WLAN_CAPABILITY_BSS) + if (!WLAN_CAPABILITY_IS_STA_BSS(cap)) { + if (cap & WLAN_CAPABILITY_ESS) iwe.u.mode = IW_MODE_MASTER; else iwe.u.mode = IW_MODE_ADHOC; From 9e7e78d8298bd487f7a0d2b0c62033b3841d03ca Mon Sep 17 00:00:00 2001 From: Prasanna Karthik Date: Mon, 29 Jun 2015 12:57:35 +0000 Subject: [PATCH 201/912] staging:rtl8188eu: Code cleanup fix reported by coccinelle bool check modified Signed-off-by: Prasanna Karthik Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/rf_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/rf_cfg.c b/drivers/staging/rtl8188eu/hal/rf_cfg.c index 455ecdc8d9fa..954cade478db 100644 --- a/drivers/staging/rtl8188eu/hal/rf_cfg.c +++ b/drivers/staging/rtl8188eu/hal/rf_cfg.c @@ -295,7 +295,7 @@ static bool rf6052_conf_para(struct adapter *adapt) break; } - if (rtstatus != true) + if (!rtstatus) return false; } From e1d0bcedfb6da518422472fcbab03999fc312ab1 Mon Sep 17 00:00:00 2001 From: Sunil Shahu Date: Tue, 7 Jul 2015 14:55:44 +0530 Subject: [PATCH 202/912] staging: rtl8188eu: core: rtw_mlme: remove space before ',' Fix coding style error by removing spaces before ',' as suggested by checkpatch.pl script. Signed-off-by: Sunil Shahu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index a1ed741fc804..2b599e3c0785 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -161,7 +161,7 @@ exit: return pnetwork; } -static void _rtw_free_network(struct mlme_priv *pmlmepriv , struct wlan_network *pnetwork, u8 isfreeall) +static void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 isfreeall) { u32 curr_time, delta_time; u32 lifetime = SCANQUEUE_LIFETIME; @@ -582,7 +582,7 @@ static int rtw_is_desired_network(struct adapter *adapter, struct wlan_network * } /* TODO: Perry: For Power Management */ -void rtw_atimdone_event_callback(struct adapter *adapter , u8 *pbuf) +void rtw_atimdone_event_callback(struct adapter *adapter, u8 *pbuf) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("receive atimdone_evet\n")); return; @@ -615,7 +615,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf) spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); ibss_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->MacAddress); if (ibss_wlan) { - memcpy(ibss_wlan->network.IEs , pnetwork->IEs, 8); + memcpy(ibss_wlan->network.IEs, pnetwork->IEs, 8); spin_unlock_bh(&pmlmepriv->scanned_queue.lock); goto exit; } @@ -1383,7 +1383,7 @@ void _rtw_join_timeout_handler (unsigned long data) DBG_88E("%s try another roaming\n", __func__); do_join_r = rtw_do_join(adapter); if (_SUCCESS != do_join_r) { - DBG_88E("%s roaming do_join return %d\n", __func__ , do_join_r); + DBG_88E("%s roaming do_join return %d\n", __func__, do_join_r); continue; } break; @@ -1998,7 +1998,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ p = rtw_get_ie(in_ie+12, _HT_ADD_INFO_IE_, &ielen, in_len-12); if (p && (ielen == sizeof(struct ieee80211_ht_addt_info))) { out_len = *pout_len; - rtw_set_ie(out_ie+out_len, _HT_ADD_INFO_IE_, ielen, p+2 , pout_len); + rtw_set_ie(out_ie+out_len, _HT_ADD_INFO_IE_, ielen, p+2, pout_len); } } return phtpriv->ht_option; From 249472588cf0b5fa18063783dd1d4f4a62c8ddb3 Mon Sep 17 00:00:00 2001 From: Sreenath Madasu Date: Wed, 8 Jul 2015 18:43:00 -0400 Subject: [PATCH 203/912] staging: rtl8188eu: core: Fixed 80 character length warning When the checkpatch.pl script was run, it showed lines with length more than 80 characters in rtw_ap.c file. Fixed line number 382 by breaking it up into two lines within 80 characters. Signed-off-by: Sreenath Madasu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 9d484cf81184..5c45f8a8c2cf 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -379,7 +379,8 @@ void expire_timeout_chk(struct adapter *padapter) if (pmlmeext->active_keep_alive_check) { int stainfo_offset; - stainfo_offset = rtw_stainfo_offset(pstapriv, psta); + stainfo_offset = + rtw_stainfo_offset(pstapriv, psta); if (stainfo_offset_valid(stainfo_offset)) chk_alive_list[chk_alive_num++] = stainfo_offset; continue; From 3738408cc802025a1ecf4a059a0c8ab048cb7e72 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Fri, 10 Jul 2015 18:52:17 +0200 Subject: [PATCH 204/912] staging: rtl8188eu: remove RegulatorMode from struct hal_data_8188e This field is not used anywhere. Also, kill the rt_regulator_mode enum which exists just for this field. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 3 --- drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 7 ------- 2 files changed, 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index 7904d2260f2c..f6c1591e66c3 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -144,9 +144,6 @@ static struct HAL_VERSION ReadChipVersion8188E(struct adapter *padapter) ChipVersion.VendorType = ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHIP_VENDOR_TSMC); ChipVersion.CUTVersion = (value32 & CHIP_VER_RTL_MASK)>>CHIP_VER_RTL_SHIFT; /* IC version (CUT) */ - /* For regulator mode. by tynli. 2011.01.14 */ - pHalData->RegulatorMode = ((value32 & TRP_BT_EN) ? RT_LDO_REGULATOR : RT_SWITCHING_REGULATOR); - ChipVersion.ROMVer = 0; /* ROM code version. */ dump_chip_info(ChipVersion); diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h index 7d8e022925e0..5aa2adc1f013 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h @@ -188,15 +188,8 @@ struct txpowerinfo24g { #define EFUSE_PROTECT_BYTES_BANK 16 -/* For RTL8723 regulator mode. */ -enum rt_regulator_mode { - RT_SWITCHING_REGULATOR = 0, - RT_LDO_REGULATOR = 1, -}; - struct hal_data_8188e { struct HAL_VERSION VersionID; - enum rt_regulator_mode RegulatorMode; /* switching regulator or LDO */ u16 CustomerID; u8 *pfirmware; u32 fwsize; From e827aeedd0e14dcb67eb29afbaa875ab1a0f7b26 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Fri, 10 Jul 2015 18:52:18 +0200 Subject: [PATCH 205/912] staging: rtl8188eu: remove ICtype from struct HAL_VERSION IC type on RTL8188EU is always 8188E. Remove it and all the macros that check it. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/hal_com.c | 13 +--- .../staging/rtl8188eu/hal/rtl8188e_hal_init.c | 1 - drivers/staging/rtl8188eu/hal/usb_halinit.c | 2 +- drivers/staging/rtl8188eu/include/HalVerDef.h | 61 ------------------- 4 files changed, 2 insertions(+), 75 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c b/drivers/staging/rtl8188eu/hal/hal_com.c index 170e3de5eab4..62ffa7c73c89 100644 --- a/drivers/staging/rtl8188eu/hal/hal_com.c +++ b/drivers/staging/rtl8188eu/hal/hal_com.c @@ -31,18 +31,7 @@ void dump_chip_info(struct HAL_VERSION chip_vers) uint cnt = 0; char buf[128]; - if (IS_81XXC(chip_vers)) { - cnt += sprintf((buf+cnt), "Chip Version Info: %s_", - IS_92C_SERIAL(chip_vers) ? - "CHIP_8192C" : "CHIP_8188C"); - } else if (IS_92D(chip_vers)) { - cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8192D_"); - } else if (IS_8723_SERIES(chip_vers)) { - cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8723A_"); - } else if (IS_8188E(chip_vers)) { - cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8188E_"); - } - + cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8188E_"); cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(chip_vers) ? "Normal_Chip" : "Test_Chip"); cnt += sprintf((buf+cnt), "%s_", IS_CHIP_VENDOR_TSMC(chip_vers) ? diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index f6c1591e66c3..af757ffd535f 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -137,7 +137,6 @@ static struct HAL_VERSION ReadChipVersion8188E(struct adapter *padapter) pHalData = GET_HAL_DATA(padapter); value32 = usb_read32(padapter, REG_SYS_CFG); - ChipVersion.ICType = CHIP_8188E; ChipVersion.ChipType = ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP); ChipVersion.RFType = RF_TYPE_1T1R; diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 872622214264..ffcca6b03fe2 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -1703,7 +1703,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) /* Forece leave RF low power mode for 1T1R to prevent conficting setting in Fw power */ /* saving sequence. 2010.06.07. Added by tynli. Suggested by SD3 yschang. */ - if ((psmode != PS_MODE_ACTIVE) && (!IS_92C_SERIAL(haldata->VersionID))) + if (psmode != PS_MODE_ACTIVE) ODM_RF_Saving(podmpriv, true); rtl8188e_set_FwPwrMode_cmd(Adapter, psmode); } diff --git a/drivers/staging/rtl8188eu/include/HalVerDef.h b/drivers/staging/rtl8188eu/include/HalVerDef.h index 97047cf06780..c542f7e04f5b 100644 --- a/drivers/staging/rtl8188eu/include/HalVerDef.h +++ b/drivers/staging/rtl8188eu/include/HalVerDef.h @@ -20,20 +20,6 @@ #ifndef __HAL_VERSION_DEF_H__ #define __HAL_VERSION_DEF_H__ -enum HAL_IC_TYPE { - CHIP_8192S = 0, - CHIP_8188C = 1, - CHIP_8192C = 2, - CHIP_8192D = 3, - CHIP_8723A = 4, - CHIP_8188E = 5, - CHIP_8881A = 6, - CHIP_8812A = 7, - CHIP_8821A = 8, - CHIP_8723B = 9, - CHIP_8192E = 10, -}; - enum HAL_CHIP_TYPE { TEST_CHIP = 0, NORMAL_CHIP = 1, @@ -67,7 +53,6 @@ enum HAL_RF_TYPE { }; struct HAL_VERSION { - enum HAL_IC_TYPE ICType; enum HAL_CHIP_TYPE ChipType; enum HAL_CUT_VERSION CUTVersion; enum HAL_VENDOR VendorType; @@ -76,7 +61,6 @@ struct HAL_VERSION { }; /* Get element */ -#define GET_CVID_IC_TYPE(version) (((version).ICType)) #define GET_CVID_CHIP_TYPE(version) (((version).ChipType)) #define GET_CVID_RF_TYPE(version) (((version).RFType)) #define GET_CVID_MANUFACTUER(version) (((version).VendorType)) @@ -86,17 +70,6 @@ struct HAL_VERSION { /* Common Macro. -- */ /* HAL_VERSION VersionID */ -/* HAL_IC_TYPE_E */ -#define IS_81XXC(version) \ - (((GET_CVID_IC_TYPE(version) == CHIP_8192C) || \ - (GET_CVID_IC_TYPE(version) == CHIP_8188C)) ? true : false) -#define IS_8723_SERIES(version) \ - ((GET_CVID_IC_TYPE(version) == CHIP_8723A) ? true : false) -#define IS_92D(version) \ - ((GET_CVID_IC_TYPE(version) == CHIP_8192D) ? true : false) -#define IS_8188E(version) \ - ((GET_CVID_IC_TYPE(version) == CHIP_8188E) ? true : false) - /* HAL_CHIP_TYPE_E */ #define IS_TEST_CHIP(version) \ ((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false) @@ -130,38 +103,4 @@ struct HAL_VERSION { #define IS_2T2R(version) \ ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false) -/* Chip version Macro. -- */ -#define IS_81XXC_TEST_CHIP(version) \ - ((IS_81XXC(version) && (!IS_NORMAL_CHIP(version))) ? true : false) - -#define IS_92C_SERIAL(version) \ - ((IS_81XXC(version) && IS_2T2R(version)) ? true : false) -#define IS_81xxC_VENDOR_UMC_A_CUT(version) \ - (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \ - (IS_A_CUT(version) ? true : false) : false) : false) -#define IS_81xxC_VENDOR_UMC_B_CUT(version) \ - (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \ - (IS_B_CUT(version) ? true : false) : false) : false) -#define IS_81xxC_VENDOR_UMC_C_CUT(version) \ - (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \ - (IS_C_CUT(version) ? true : false) : false) : false) - -#define IS_NORMAL_CHIP92D(version) \ - ((IS_92D(version)) ? \ - ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false) : false) - -#define IS_92D_SINGLEPHY(version) \ - ((IS_92D(version)) ? (IS_2T2R(version) ? true : false) : false) -#define IS_92D_C_CUT(version) \ - ((IS_92D(version)) ? (IS_C_CUT(version) ? true : false) : false) -#define IS_92D_D_CUT(version) \ - ((IS_92D(version)) ? (IS_D_CUT(version) ? true : false) : false) -#define IS_92D_E_CUT(version) \ - ((IS_92D(version)) ? (IS_E_CUT(version) ? true : false) : false) - -#define IS_8723A_A_CUT(version) \ - ((IS_8723_SERIES(version)) ? (IS_A_CUT(version) ? true : false) : false) -#define IS_8723A_B_CUT(version) \ - ((IS_8723_SERIES(version)) ? (IS_B_CUT(version) ? true : false) : false) - #endif From 3c71dd6c5609285b122a50ebc2d59ebafdac595f Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Fri, 10 Jul 2015 18:52:19 +0200 Subject: [PATCH 206/912] staging: rtl8188eu: remove RFtype from struct HAL_VERSION RFtype in struct HAL_VERSION duplicates rf_type in struct hal_data_8188e, and does not change. Remove it and the macros that test it. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/hal_com.c | 12 +---------- .../staging/rtl8188eu/hal/rtl8188e_hal_init.c | 15 ++----------- drivers/staging/rtl8188eu/include/HalVerDef.h | 21 ------------------- 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c b/drivers/staging/rtl8188eu/hal/hal_com.c index 62ffa7c73c89..a296648a4dd1 100644 --- a/drivers/staging/rtl8188eu/hal/hal_com.c +++ b/drivers/staging/rtl8188eu/hal/hal_com.c @@ -49,17 +49,7 @@ void dump_chip_info(struct HAL_VERSION chip_vers) else cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", chip_vers.CUTVersion); - - if (IS_1T1R(chip_vers)) - cnt += sprintf((buf+cnt), "1T1R_"); - else if (IS_1T2R(chip_vers)) - cnt += sprintf((buf+cnt), "1T2R_"); - else if (IS_2T2R(chip_vers)) - cnt += sprintf((buf+cnt), "2T2R_"); - else - cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", - chip_vers.RFType); - + cnt += sprintf((buf+cnt), "1T1R_"); cnt += sprintf((buf+cnt), "RomVer(%d)\n", chip_vers.ROMVer); pr_info("%s", buf); diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index af757ffd535f..ea9703095196 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -138,8 +138,6 @@ static struct HAL_VERSION ReadChipVersion8188E(struct adapter *padapter) value32 = usb_read32(padapter, REG_SYS_CFG); ChipVersion.ChipType = ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP); - - ChipVersion.RFType = RF_TYPE_1T1R; ChipVersion.VendorType = ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHIP_VENDOR_TSMC); ChipVersion.CUTVersion = (value32 & CHIP_VER_RTL_MASK)>>CHIP_VER_RTL_SHIFT; /* IC version (CUT) */ @@ -148,17 +146,8 @@ static struct HAL_VERSION ReadChipVersion8188E(struct adapter *padapter) dump_chip_info(ChipVersion); pHalData->VersionID = ChipVersion; - - if (IS_1T2R(ChipVersion)) { - pHalData->rf_type = RF_1T2R; - pHalData->NumTotalRFPath = 2; - } else if (IS_2T2R(ChipVersion)) { - pHalData->rf_type = RF_2T2R; - pHalData->NumTotalRFPath = 2; - } else{ - pHalData->rf_type = RF_1T1R; - pHalData->NumTotalRFPath = 1; - } + pHalData->rf_type = RF_1T1R; + pHalData->NumTotalRFPath = 1; MSG_88E("RF_Type is %x!!\n", pHalData->rf_type); diff --git a/drivers/staging/rtl8188eu/include/HalVerDef.h b/drivers/staging/rtl8188eu/include/HalVerDef.h index c542f7e04f5b..2c24814d9793 100644 --- a/drivers/staging/rtl8188eu/include/HalVerDef.h +++ b/drivers/staging/rtl8188eu/include/HalVerDef.h @@ -41,28 +41,15 @@ enum HAL_VENDOR { CHIP_VENDOR_UMC = 1, }; -enum HAL_RF_TYPE { - RF_TYPE_1T1R = 0, - RF_TYPE_1T2R = 1, - RF_TYPE_2T2R = 2, - RF_TYPE_2T3R = 3, - RF_TYPE_2T4R = 4, - RF_TYPE_3T3R = 5, - RF_TYPE_3T4R = 6, - RF_TYPE_4T4R = 7, -}; - struct HAL_VERSION { enum HAL_CHIP_TYPE ChipType; enum HAL_CUT_VERSION CUTVersion; enum HAL_VENDOR VendorType; - enum HAL_RF_TYPE RFType; u8 ROMVer; }; /* Get element */ #define GET_CVID_CHIP_TYPE(version) (((version).ChipType)) -#define GET_CVID_RF_TYPE(version) (((version).RFType)) #define GET_CVID_MANUFACTUER(version) (((version).VendorType)) #define GET_CVID_CUT_VERSION(version) (((version).CUTVersion)) #define GET_CVID_ROM_VERSION(version) (((version).ROMVer) & ROM_VERSION_MASK) @@ -95,12 +82,4 @@ struct HAL_VERSION { #define IS_CHIP_VENDOR_UMC(version) \ ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false) -/* HAL_RF_TYPE_E */ -#define IS_1T1R(version) \ - ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T1R) ? true : false) -#define IS_1T2R(version) \ - ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false) -#define IS_2T2R(version) \ - ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false) - #endif From a51d13037b1e5149bcbe65cc5a47af1d35affdaa Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Fri, 10 Jul 2015 18:52:20 +0200 Subject: [PATCH 207/912] staging: rtl8188eu: remove ROMVer from struct HAL_VERSION ROM version on RTL8188EU is always 0. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/hal_com.c | 2 +- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 2 -- drivers/staging/rtl8188eu/include/HalVerDef.h | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c b/drivers/staging/rtl8188eu/hal/hal_com.c index a296648a4dd1..38e9fdc312d3 100644 --- a/drivers/staging/rtl8188eu/hal/hal_com.c +++ b/drivers/staging/rtl8188eu/hal/hal_com.c @@ -50,7 +50,7 @@ void dump_chip_info(struct HAL_VERSION chip_vers) cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", chip_vers.CUTVersion); cnt += sprintf((buf+cnt), "1T1R_"); - cnt += sprintf((buf+cnt), "RomVer(%d)\n", chip_vers.ROMVer); + cnt += sprintf((buf+cnt), "RomVer(0)\n"); pr_info("%s", buf); } diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index ea9703095196..49b6b9cdf778 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -141,8 +141,6 @@ static struct HAL_VERSION ReadChipVersion8188E(struct adapter *padapter) ChipVersion.VendorType = ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHIP_VENDOR_TSMC); ChipVersion.CUTVersion = (value32 & CHIP_VER_RTL_MASK)>>CHIP_VER_RTL_SHIFT; /* IC version (CUT) */ - ChipVersion.ROMVer = 0; /* ROM code version. */ - dump_chip_info(ChipVersion); pHalData->VersionID = ChipVersion; diff --git a/drivers/staging/rtl8188eu/include/HalVerDef.h b/drivers/staging/rtl8188eu/include/HalVerDef.h index 2c24814d9793..56b4ff08e509 100644 --- a/drivers/staging/rtl8188eu/include/HalVerDef.h +++ b/drivers/staging/rtl8188eu/include/HalVerDef.h @@ -45,14 +45,12 @@ struct HAL_VERSION { enum HAL_CHIP_TYPE ChipType; enum HAL_CUT_VERSION CUTVersion; enum HAL_VENDOR VendorType; - u8 ROMVer; }; /* Get element */ #define GET_CVID_CHIP_TYPE(version) (((version).ChipType)) #define GET_CVID_MANUFACTUER(version) (((version).VendorType)) #define GET_CVID_CUT_VERSION(version) (((version).CUTVersion)) -#define GET_CVID_ROM_VERSION(version) (((version).ROMVer) & ROM_VERSION_MASK) /* Common Macro. -- */ /* HAL_VERSION VersionID */ From 4221844a627aaebf28732d6e891de2aa4db38aa0 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Fri, 10 Jul 2015 18:52:21 +0200 Subject: [PATCH 208/912] staging: rtl8188eu: fold rtl8188e_read_chip_version() into rtl8188e_SetHalODMVar() Both rtl8188e_read_chip_version() and ReadChipVersion8188E() are used only in one place. Make ReadChipVersion8188E() a void function and eliminate its wrapper - rtl8188e_read_chip_version(). Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index 49b6b9cdf778..b05da9d6b693 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -128,7 +128,7 @@ static void rtl8188e_free_hal_data(struct adapter *padapter) padapter->HalData = NULL; } -static struct HAL_VERSION ReadChipVersion8188E(struct adapter *padapter) +static void ReadChipVersion8188E(struct adapter *padapter) { u32 value32; struct HAL_VERSION ChipVersion; @@ -148,13 +148,6 @@ static struct HAL_VERSION ReadChipVersion8188E(struct adapter *padapter) pHalData->NumTotalRFPath = 1; MSG_88E("RF_Type is %x!!\n", pHalData->rf_type); - - return ChipVersion; -} - -static void rtl8188e_read_chip_version(struct adapter *padapter) -{ - ReadChipVersion8188E(padapter); } static void rtl8188e_SetHalODMVar(struct adapter *Adapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet) @@ -203,7 +196,7 @@ void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc) pHalFunc->dm_init = &rtl8188e_init_dm_priv; - pHalFunc->read_chip_version = &rtl8188e_read_chip_version; + pHalFunc->read_chip_version = &ReadChipVersion8188E; pHalFunc->set_bwmode_handler = &phy_set_bw_mode; pHalFunc->set_channel_handler = &phy_sw_chnl; From 9fccffbfd9505116c0ab847742aafaa7da55d413 Mon Sep 17 00:00:00 2001 From: Johannes Postma Date: Wed, 8 Jul 2015 13:41:46 +0100 Subject: [PATCH 209/912] Staging: ozwpan: ozusbsvc1.c: Fix missing blank line after declarations This patch fixes a missing line after declarations issue. Signed-off-by: Johannes Postma Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ozwpan/ozusbsvc1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c index 301fee8625ed..b6cfecbeabf7 100644 --- a/drivers/staging/ozwpan/ozusbsvc1.c +++ b/drivers/staging/ozwpan/ozusbsvc1.c @@ -327,6 +327,7 @@ static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx, (struct oz_multiple_fixed *)data_hdr; u8 *data = body->data; unsigned int n; + if (!body->unit_size || len < sizeof(struct oz_multiple_fixed) - 1) break; From 364b91be262aaf0afc1726be391fbeb7f2b59c52 Mon Sep 17 00:00:00 2001 From: Leung Timothy Chi King Date: Wed, 1 Jul 2015 09:44:13 -0700 Subject: [PATCH 210/912] Staging: rts5208: Fix checkpatch warning: else is not generally useful The following checkpatch warning was fixed: WARNING: else is not generally useful after a break or return Signed-off-by: Leung Timothy Chi King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/sd.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index a8d657bb5c1b..cb4157960fad 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -3520,12 +3520,11 @@ int reset_sd_card(struct rtsx_chip *chip) if (chip->sd_io) { rtsx_trace(chip); return STATUS_FAIL; - } else { - retval = reset_mmc(chip); - if (retval != STATUS_SUCCESS) { - rtsx_trace(chip); - return STATUS_FAIL; - } + } + retval = reset_mmc(chip); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; } } } From 861e82d5b5a42d2eda34f3123b46162eaae9af80 Mon Sep 17 00:00:00 2001 From: Jacob Kiefer Date: Fri, 10 Jul 2015 01:26:30 -0400 Subject: [PATCH 211/912] staging: style fix for octeon/ethernet-tx.c Broke line with greater than 80 characters into two lines and improved logical operator readability in hardware checksum if statement. Signed-off-by: Jacob Kiefer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-tx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 7c1c1b052b7d..e2df041ca82d 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c @@ -396,10 +396,12 @@ dont_put_skbuff_in_hw: /* Check if we can use the hardware checksumming */ if ((skb->protocol == htons(ETH_P_IP)) && - (ip_hdr(skb)->version == 4) && (ip_hdr(skb)->ihl == 5) && - ((ip_hdr(skb)->frag_off == 0) || (ip_hdr(skb)->frag_off == htons(1 << 14))) - && ((ip_hdr(skb)->protocol == IPPROTO_TCP) - || (ip_hdr(skb)->protocol == IPPROTO_UDP))) { + (ip_hdr(skb)->version == 4) && + (ip_hdr(skb)->ihl == 5) && + ((ip_hdr(skb)->frag_off == 0) || + (ip_hdr(skb)->frag_off == htons(1 << 14))) && + ((ip_hdr(skb)->protocol == IPPROTO_TCP) || + (ip_hdr(skb)->protocol == IPPROTO_UDP))) { /* Use hardware checksum calc */ pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1; } From bd1fb5388da0a37c053649ec4aa8e588ef39f958 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Fri, 10 Jul 2015 15:34:28 +0900 Subject: [PATCH 212/912] staging: Drop owner assignment from i2c_driver i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index 0f524bb7b41d..1f9ba8beb061 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c @@ -1126,7 +1126,6 @@ MODULE_DEVICE_TABLE(i2c, synaptics_rmi4_id_table); static struct i2c_driver synaptics_rmi4_driver = { .driver = { .name = DRIVER_NAME, - .owner = THIS_MODULE, .pm = &synaptics_rmi4_dev_pm_ops, }, .probe = synaptics_rmi4_probe, From 04ed5f3d4ea9981e31219fc2514b5505445dd92c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:04 +0200 Subject: [PATCH 213/912] staging: rtl8192e: Remove ToLegalChannel() Function is not used. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.c | 24 ------------------------ drivers/staging/rtl8192e/dot11d.h | 1 - 2 files changed, 25 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index ef9da863c335..7f48845e7125 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -190,27 +190,3 @@ void DOT11D_ScanComplete(struct rtllib_device *dev) break; } } - -int ToLegalChannel(struct rtllib_device *dev, u8 channel) -{ - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev); - u8 default_chn = 0; - u32 i; - - for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) { - if (pDot11dInfo->channel_map[i] > 0) { - default_chn = i; - break; - } - } - - if (MAX_CHANNEL_NUMBER < channel) { - netdev_err(dev->dev, "%s(): Invalid Channel\n", __func__); - return default_chn; - } - - if (pDot11dInfo->channel_map[channel] > 0) - return channel; - - return default_chn; -} diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index 69e0f8f7e3f8..e1c1888e282b 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -98,6 +98,5 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8 *pCoutryIe); u8 DOT11D_GetMaxTxPwrInDbm(struct rtllib_device *dev, u8 Channel); void DOT11D_ScanComplete(struct rtllib_device *dev); -int ToLegalChannel(struct rtllib_device *dev, u8 channel); #endif From 9efe891d01c3734ab05fdbd53dead3451fa03e29 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:05 +0200 Subject: [PATCH 214/912] staging: rtl8192e: Remove unused defines Remove most of unused defines (excluding phyreg/hw registers). Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.h | 4 -- .../staging/rtl8192e/rtl8192e/r8190P_def.h | 46 ------------------- .../rtl8192e/rtl8192e/r8192E_firmware.h | 2 - drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 3 -- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 19 -------- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 3 -- drivers/staging/rtl8192e/rtl819x_BA.h | 5 -- drivers/staging/rtl8192e/rtl819x_HT.h | 2 - drivers/staging/rtl8192e/rtl819x_TS.h | 2 - drivers/staging/rtl8192e/rtllib.h | 40 ---------------- drivers/staging/rtl8192e/rtllib_softmac.c | 1 - 12 files changed, 128 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index e1c1888e282b..127af823ae96 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -79,7 +79,6 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src) #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \ cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) -#define CIE_WATCHDOG_TH 1 #define GET_CIE_WATCHDOG(__pIeeeDev) \ (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) @@ -88,9 +87,6 @@ static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) } #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) -#define IS_DOT11D_STATE_DONE(__pIeeeDev) \ - (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) - void dot11d_init(struct rtllib_device *dev); void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee); void Dot11d_Reset(struct rtllib_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h index d0b08301b88f..dba4584c7006 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h @@ -26,8 +26,6 @@ #define MAX_SILENT_RESET_RX_SLOT_NUM 10 #define RX_MPDU_QUEUE 0 -#define RX_CMD_QUEUE 1 - enum rtl819x_loopback { RTL819X_NO_LOOPBACK = 0, @@ -36,11 +34,6 @@ enum rtl819x_loopback { RTL819X_CCK_LOOPBACK = 3, }; - -#define RESET_DELAY_8185 20 - -#define RT_IBSS_INT_MASKS (IMR_BcnInt | IMR_BcnInt | IMR_TBDOK | IMR_TBDER) - #define DESC90_RATE1M 0x00 #define DESC90_RATE2M 0x01 #define DESC90_RATE5_5M 0x02 @@ -74,17 +67,6 @@ enum rtl819x_loopback { #define SHORT_SLOT_TIME 9 #define NON_SHORT_SLOT_TIME 20 - -#define MAX_LINES_HWCONFIG_TXT 1000 -#define MAX_BYTES_LINE_HWCONFIG_TXT 128 - -#define SW_THREE_WIRE 0 -#define HW_THREE_WIRE 2 - -#define BT_DEMO_BOARD 0 -#define BT_QA_BOARD 1 -#define BT_FPGA 2 - #define RX_SMOOTH 20 #define QSLT_BK 0x1 @@ -96,25 +78,14 @@ enum rtl819x_loopback { #define QSLT_MGNT 0x12 #define QSLT_CMD 0x13 -#define NUM_OF_FIRMWARE_QUEUE 10 -#define NUM_OF_PAGES_IN_FW 0x100 #define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x007 #define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x0aa #define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x024 #define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x007 -#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0 -#define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x2 #define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x10 -#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0 #define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x4 #define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0xd -#define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB_DTM 0x00 - #define APPLIED_RESERVED_QUEUE_IN_FW 0x80000000 #define RSVD_FW_QUEUE_PAGE_BK_SHIFT 0x00 #define RSVD_FW_QUEUE_PAGE_BE_SHIFT 0x08 @@ -197,23 +168,6 @@ struct tx_fwinfo_8190pci { }; - -#define TX_DESC_SIZE 32 - -#define TX_DESC_CMD_SIZE 32 - - -#define TX_STATUS_DESC_SIZE 32 - -#define TX_FWINFO_SIZE 8 - - -#define RX_DESC_SIZE 16 - -#define RX_STATUS_DESC_SIZE 16 - -#define RX_DRIVER_INFO_SIZE 8 - struct log_int_8190 { u32 nIMR_COMDOK; u32 nIMR_MGNTDOK; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h index d79e54203199..ef232d2c34e6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h @@ -19,8 +19,6 @@ #ifndef __INC_FIRMWARE_H #define __INC_FIRMWARE_H -#define RTL8190_CPU_START_OFFSET 0x80 - #define GET_COMMAND_PACKET_FRAG_THRESHOLD(v) (4*(v/4) - 8) #define RTL8192E_BOOT_IMG_FW "RTL8192E/boot.img" diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 3de7cc549794..bce960d884e2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -58,9 +58,6 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] = { 0x5e4332 }; -#define RTK_UL_EDCA 0xa44f -#define RTK_DL_EDCA 0x5e4322 - const u32 dm_tx_bb_gain[TxBBGainTableLength] = { 0x7f8001fe, /* 12 dB */ 0x788001e2, /* 11 dB */ diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index b037451c3ada..ac95d8f80995 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -27,26 +27,17 @@ #define DM_DIG_THRESH_HIGH 40 #define DM_DIG_THRESH_LOW 35 -#define DM_FALSEALARM_THRESH_LOW 40 -#define DM_FALSEALARM_THRESH_HIGH 1000 - #define DM_DIG_HIGH_PWR_THRESH_HIGH 75 #define DM_DIG_HIGH_PWR_THRESH_LOW 70 #define BW_AUTO_SWITCH_HIGH_LOW 25 #define BW_AUTO_SWITCH_LOW_HIGH 30 -#define DM_check_fsync_time_interval 500 - - #define DM_DIG_BACKOFF 12 #define DM_DIG_MAX 0x36 #define DM_DIG_MIN 0x1c #define DM_DIG_MIN_Netcore 0x12 -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 - #define RxPathSelection_SS_TH_low 30 #define RxPathSelection_diff_TH 18 @@ -55,8 +46,6 @@ #define RateAdaptiveTH_Low_40M 10 #define VeryLowRSSI 15 -#define CTSToSelfTHVal 35 - #define WAIotTHVal 25 #define E_FOR_TX_POWER_TRACK 300 @@ -70,14 +59,6 @@ #define Tx_Retry_Count_Reg 0x1ac #define RegC38_TH 20 -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 - -#define TxHighPwrLevel_Normal 0 -#define TxHighPwrLevel_Level1 1 -#define TxHighPwrLevel_Level2 2 - -#define DM_Type_ByFW 0 #define DM_Type_ByDriver 1 /*--------------------------Define Parameters-------------------------------*/ diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index 962f2e5b8bf8..d23c0f1d76f5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -30,7 +30,6 @@ struct net_device; #define RT_CHECK_FOR_HANG_PERIOD 2 -#define INIT_DEFAULT_CHAN 1 void rtl8192_hw_wakeup(struct net_device *dev); void rtl8192_hw_to_sleep(struct net_device *dev, u64 time); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index f5e4961677d2..3d7758592490 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -729,9 +729,6 @@ static int r8192_wx_set_enc(struct net_device *dev, hwkey[i] |= (key[4 * i + 3] & mask) << 24; } - #define CONF_WEP40 0x4 - #define CONF_WEP104 0x14 - switch (wrqu->encoding.flags & IW_ENCODE_INDEX) { case 0: key_idx = ieee->crypt_info.tx_keyidx; diff --git a/drivers/staging/rtl8192e/rtl819x_BA.h b/drivers/staging/rtl8192e/rtl819x_BA.h index 613e14c12df3..894666465152 100644 --- a/drivers/staging/rtl8192e/rtl819x_BA.h +++ b/drivers/staging/rtl8192e/rtl819x_BA.h @@ -19,11 +19,7 @@ #ifndef _BATYPE_H_ #define _BATYPE_H_ -#define TOTAL_TXBA_NUM 16 -#define TOTAL_RXBA_NUM 16 - #define BA_SETUP_TIMEOUT 200 -#define BA_INACT_TIMEOUT 60000 #define BA_POLICY_DELAYED 0 #define BA_POLICY_IMMEDIATE 1 @@ -32,7 +28,6 @@ #define ADDBA_STATUS_REFUSED 37 #define ADDBA_STATUS_INVALID_PARAM 38 -#define DELBA_REASON_QSTA_LEAVING 36 #define DELBA_REASON_END_BA 37 #define DELBA_REASON_UNKNOWN_BA 38 #define DELBA_REASON_TIMEOUT 39 diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h index 0c263d9f7246..51711dcdc8ef 100644 --- a/drivers/staging/rtl8192e/rtl819x_HT.h +++ b/drivers/staging/rtl8192e/rtl819x_HT.h @@ -20,8 +20,6 @@ #define _RTL819XU_HTTYPE_H_ #define MIMO_PS_STATIC 0 -#define MIMO_PS_DYNAMIC 1 -#define MIMO_PS_NOLIMIT 3 #define sHTCLng 4 diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index b8fed556928c..a93348c37f17 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -19,8 +19,6 @@ #ifndef _TSTYPE_H_ #define _TSTYPE_H_ #include "rtl819x_Qos.h" -#define TS_SETUP_TIMEOUT 60 -#define TS_INACT_TIMEOUT 60 #define TS_ADDBA_DELAY 60 #define TOTAL_TS_NUM 16 diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index fd38c6dd146b..8ba92ed5cd09 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -84,9 +84,6 @@ #define iwe_stream_add_point_rsl(info, start, stop, iwe, p) \ iwe_stream_add_point(info, start, stop, iwe, p) -#define usb_alloc_urb_rsl(x, y) usb_alloc_urb(x, y) -#define usb_submit_urb_rsl(x, y) usb_submit_urb(x, y) - static inline void *netdev_priv_rsl(struct net_device *dev) { return netdev_priv(dev); @@ -110,27 +107,14 @@ static inline void *netdev_priv_rsl(struct net_device *dev) #define HIGH_QUEUE 7 #define BEACON_QUEUE 8 -#define LOW_QUEUE BE_QUEUE -#define NORMAL_QUEUE MGNT_QUEUE - #ifndef IW_MODE_MESH #define IW_MODE_MESH 7 #endif -#define AMSDU_SUBHEADER_LEN 14 -#define SWRF_TIMEOUT 50 #define IE_CISCO_FLAG_POSITION 0x08 #define SUPPORT_CKIP_MIC 0x08 #define SUPPORT_CKIP_PK 0x10 -#define RT_RF_OFF_LEVL_ASPM BIT0 -#define RT_RF_OFF_LEVL_CLK_REQ BIT1 -#define RT_RF_OFF_LEVL_PCI_D3 BIT2 #define RT_RF_OFF_LEVL_HALT_NIC BIT3 -#define RT_RF_OFF_LEVL_FREE_FW BIT4 -#define RT_RF_OFF_LEVL_FW_32K BIT5 -#define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT6 -#define RT_RF_LPS_DISALBE_2R BIT30 -#define RT_RF_LPS_LEVEL_ASPM BIT31 #define RT_IN_PS_LEVEL(pPSC, _PS_FLAG) \ ((pPSC->CurPsLevel & _PS_FLAG) ? true : false) #define RT_CLEAR_PS_LEVEL(pPSC, _PS_FLAG) \ @@ -244,22 +228,6 @@ struct sw_chnl_cmd { #define MGN_MCS13 0x8d #define MGN_MCS14 0x8e #define MGN_MCS15 0x8f -#define MGN_MCS0_SG 0x90 -#define MGN_MCS1_SG 0x91 -#define MGN_MCS2_SG 0x92 -#define MGN_MCS3_SG 0x93 -#define MGN_MCS4_SG 0x94 -#define MGN_MCS5_SG 0x95 -#define MGN_MCS6_SG 0x96 -#define MGN_MCS7_SG 0x97 -#define MGN_MCS8_SG 0x98 -#define MGN_MCS9_SG 0x99 -#define MGN_MCS10_SG 0x9a -#define MGN_MCS11_SG 0x9b -#define MGN_MCS12_SG 0x9c -#define MGN_MCS13_SG 0x9d -#define MGN_MCS14_SG 0x9e -#define MGN_MCS15_SG 0x9f enum hw_variables { HW_VAR_ETHER_ADDR, @@ -748,16 +716,11 @@ struct rtllib_stats { struct rtllib_device; -#define SEC_KEY_1 (1<<0) -#define SEC_KEY_2 (1<<1) -#define SEC_KEY_3 (1<<2) -#define SEC_KEY_4 (1<<3) #define SEC_ACTIVE_KEY (1<<4) #define SEC_AUTH_MODE (1<<5) #define SEC_UNICAST_GROUP (1<<6) #define SEC_LEVEL (1<<7) #define SEC_ENABLED (1<<8) -#define SEC_ENCRYPT (1<<9) #define SEC_LEVEL_0 0 /* None */ #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ @@ -772,7 +735,6 @@ struct rtllib_device; #define WEP_KEY_LEN 13 #define SCM_KEY_LEN 32 -#define SCM_TEMPORAL_KEY_LENGTH 16 struct rtllib_security { u16 active_key:2, @@ -1187,8 +1149,6 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; #define WME_AC_BE 0x01 #define WME_AC_VI 0x02 #define WME_AC_VO 0x03 -#define WME_ACI_MASK 0x03 -#define WME_AIFSN_MASK 0x03 #define WME_AC_PRAM_LEN 16 #define MAX_RECEIVE_BUFFER_SIZE 9100 diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index d320c31732f2..eac7f289d354 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1511,7 +1511,6 @@ static void rtllib_associate_step2(struct rtllib_device *ieee) } } -#define CANCELLED 2 static void rtllib_associate_complete_wq(void *data) { struct rtllib_device *ieee = (struct rtllib_device *) From 5e6f1c7145342ad0320b06ebd05d260c48275ae7 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:06 +0200 Subject: [PATCH 215/912] staging: rtl8192e: Remove undefs They relate to macros that are not used in the driver. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index c6cdb43b864c..32bf4754f612 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -22,25 +22,6 @@ * Contact Information: * wlanfae ******************************************************************************/ -#undef RX_DONT_PASS_UL -#undef DEBUG_EPROM -#undef DEBUG_RX_VERBOSE -#undef DUMMY_RX -#undef DEBUG_ZERO_RX -#undef DEBUG_RX_SKB -#undef DEBUG_TX_FRAG -#undef DEBUG_RX_FRAG -#undef DEBUG_TX_FILLDESC -#undef DEBUG_TX -#undef DEBUG_IRQ -#undef DEBUG_RX -#undef DEBUG_RXALLOC -#undef DEBUG_REGISTERS -#undef DEBUG_RING -#undef DEBUG_IRQ_TASKLET -#undef DEBUG_TX_ALLOC -#undef DEBUG_TX_DESC - #include #include #include From adc7623c86064d1578b406f9625ac25088ce05c1 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:07 +0200 Subject: [PATCH 216/912] staging: rtl8192e: Remove unused enums Remove ack_policy enum and some unused RTL_DEBUG enums. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_Qos.h | 5 ----- drivers/staging/rtl8192e/rtllib_debug.h | 6 ------ 2 files changed, 11 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_Qos.h b/drivers/staging/rtl8192e/rtl819x_Qos.h index 3aa35ced2b8b..fcc8fabbebb7 100644 --- a/drivers/staging/rtl8192e/rtl819x_Qos.h +++ b/drivers/staging/rtl8192e/rtl819x_Qos.h @@ -96,11 +96,6 @@ struct octet_string { u16 Length; }; -enum ack_policy { - eAckPlc0_ACK = 0x00, - eAckPlc1_NoACK = 0x01, -}; - #define AC0_BE 0 #define AC1_BK 1 #define AC2_VI 2 diff --git a/drivers/staging/rtl8192e/rtllib_debug.h b/drivers/staging/rtl8192e/rtllib_debug.h index 42e88d69ae63..2f47a7cd23ab 100644 --- a/drivers/staging/rtl8192e/rtllib_debug.h +++ b/drivers/staging/rtl8192e/rtllib_debug.h @@ -40,10 +40,7 @@ enum RTL_DEBUG { COMP_DBG = (1 << 1), COMP_INIT = (1 << 2), COMP_RECV = (1 << 3), - COMP_SEND = (1 << 4), - COMP_CMD = (1 << 5), COMP_POWER = (1 << 6), - COMP_EPROM = (1 << 7), COMP_SWBW = (1 << 8), COMP_SEC = (1 << 9), COMP_LPS = (1 << 10), @@ -58,15 +55,12 @@ enum RTL_DEBUG { COMP_CH = (1 << 19), COMP_RF = (1 << 20), COMP_FIRMWARE = (1 << 21), - COMP_HT = (1 << 22), COMP_RESET = (1 << 23), COMP_CMDPKT = (1 << 24), COMP_SCAN = (1 << 25), COMP_PS = (1 << 26), COMP_DOWN = (1 << 27), COMP_INTR = (1 << 28), - COMP_LED = (1 << 29), - COMP_MLME = (1 << 30), COMP_ERR = (1 << 31) }; From 1184b4ade8182945ae063e584081368387a3b725 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:08 +0200 Subject: [PATCH 217/912] staging: rtl8192e: Remove unused fields from rtllib_stats None of them are used in the driver. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 8ba92ed5cd09..dc0653a3ad45 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -691,27 +691,8 @@ struct rtllib_frag_entry { }; struct rtllib_stats { - unsigned int tx_unicast_frames; - unsigned int tx_multicast_frames; - unsigned int tx_fragments; - unsigned int tx_unicast_octets; - unsigned int tx_multicast_octets; - unsigned int tx_deferred_transmissions; - unsigned int tx_single_retry_frames; - unsigned int tx_multiple_retry_frames; - unsigned int tx_retry_limit_exceeded; unsigned int tx_discards; - unsigned int rx_unicast_frames; - unsigned int rx_multicast_frames; - unsigned int rx_fragments; - unsigned int rx_unicast_octets; - unsigned int rx_multicast_octets; - unsigned int rx_fcs_errors; - unsigned int rx_discards_no_buffer; - unsigned int tx_discards_wrong_sa; unsigned int rx_discards_undecryptable; - unsigned int rx_message_in_msg_fragments; - unsigned int rx_message_in_bad_msg_fragments; }; struct rtllib_device; From e93c18c7236f3fb90e87c6239ed78ad2c2552dfd Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:09 +0200 Subject: [PATCH 218/912] staging: rtl8192e: Remove rtllib_stats structure Two remaining fields of rtllib_stats are only incremented, but never read. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 6 ------ drivers/staging/rtl8192e/rtllib_rx.c | 2 -- drivers/staging/rtl8192e/rtllib_tx.c | 1 - 3 files changed, 9 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index dc0653a3ad45..c44c8686e6bc 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -690,11 +690,6 @@ struct rtllib_frag_entry { u8 dst_addr[ETH_ALEN]; }; -struct rtllib_stats { - unsigned int tx_discards; - unsigned int rx_discards_undecryptable; -}; - struct rtllib_device; #define SEC_ACTIVE_KEY (1<<4) @@ -1532,7 +1527,6 @@ struct rtllib_device { /* Bookkeeping structures */ struct net_device_stats stats; - struct rtllib_stats ieee_stats; struct rtllib_softmac_stats softmac_stats; /* Probe / Beacon management */ diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index da862c3da4ce..0698a0d1f466 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -317,7 +317,6 @@ rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, netdev_dbg(ieee->dev, "Decryption failed ICV mismatch (key %d)\n", skb->data[hdrlen + 3] >> 6); - ieee->ieee_stats.rx_discards_undecryptable++; return -1; } @@ -1077,7 +1076,6 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, netdev_dbg(ieee->dev, "Decryption failed (not set) (SA= %pM)\n", hdr->addr2); - ieee->ieee_stats.rx_discards_undecryptable++; return -1; } } diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index e99ea5e67ef9..517500c83d3e 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -205,7 +205,6 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, if (res < 0) { netdev_info(ieee->dev, "%s: Encryption failed: len=%d.\n", ieee->dev->name, frag->len); - ieee->ieee_stats.tx_discards++; return -1; } From 9b3fcf2bbf9374ade7f9dcac1c58c4af6fcc0694 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:10 +0200 Subject: [PATCH 219/912] staging: rtl8192e: Remove unused ether_header structure Structure is not used in the driver. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index c44c8686e6bc..81a3b9348379 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1140,12 +1140,6 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address * plus ether type*/ -struct ether_header { - u8 ether_dhost[ETHER_ADDR_LEN]; - u8 ether_shost[ETHER_ADDR_LEN]; - u16 ether_type; -} __packed; - enum erp_t { ERP_NonERPpresent = 0x01, ERP_UseProtection = 0x02, From 18e2daa85847a555c3fc9b8e2b2b90a60cab0830 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:11 +0200 Subject: [PATCH 220/912] staging: rtl8192e: Remove unused rtllib_device::freq_band Member is never referenced. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 81a3b9348379..65c22dba5017 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1602,7 +1602,6 @@ struct rtllib_device { int short_slot; int mode; /* A, B, G */ int modulation; /* CCK, OFDM */ - int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ /* used for forcing the ibss workqueue to terminate * without wait for the syncro scan to terminate From 632751b5290a70c094bdcabf5f9266f7f0a8fadd Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:12 +0200 Subject: [PATCH 221/912] staging: rtl8192e: Remove DOT11D_GetMaxTxPwrInDbm() Function is not used. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.c | 15 --------------- drivers/staging/rtl8192e/dot11d.h | 1 - 2 files changed, 16 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 7f48845e7125..fcf9b3bcf76a 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -160,21 +160,6 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, pDot11dInfo->State = DOT11D_STATE_LEARNED; } -u8 DOT11D_GetMaxTxPwrInDbm(struct rtllib_device *dev, u8 Channel) -{ - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev); - u8 MaxTxPwrInDbm = 255; - - if (MAX_CHANNEL_NUMBER < Channel) { - netdev_info(dev->dev, "DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); - return MaxTxPwrInDbm; - } - if (pDot11dInfo->channel_map[Channel]) - MaxTxPwrInDbm = pDot11dInfo->MaxTxPwrDbmList[Channel]; - - return MaxTxPwrInDbm; -} - void DOT11D_ScanComplete(struct rtllib_device *dev) { struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev); diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index 127af823ae96..129ebed2e3cc 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -92,7 +92,6 @@ void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee); void Dot11d_Reset(struct rtllib_device *dev); void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8 *pCoutryIe); -u8 DOT11D_GetMaxTxPwrInDbm(struct rtllib_device *dev, u8 Channel); void DOT11D_ScanComplete(struct rtllib_device *dev); #endif From 1e16cb17d59c9aafe8cc3dfc912050b1c4dddca7 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:13 +0200 Subject: [PATCH 222/912] staging: rtl8192e: Remove read|write_nic_io_(d)word|byte() None of this functions was used. Also remove PlatformIOCheckPageLegalAndGetRegMask() used by them. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 158 ------------------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 7 - 2 files changed, 165 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 32bf4754f612..813435988db5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -90,164 +90,6 @@ static struct pci_driver rtl8192_pci_driver = { /**************************************************************************** -----------------------------IO STUFF------------------------- *****************************************************************************/ -static bool PlatformIOCheckPageLegalAndGetRegMask(u32 u4bPage, u8 *pu1bPageMask) -{ - bool bReturn = false; - - *pu1bPageMask = 0xfe; - - switch (u4bPage) { - case 1: case 2: case 3: case 4: - case 8: case 9: case 10: case 12: case 13: - bReturn = true; - *pu1bPageMask = 0xf0; - break; - - default: - bReturn = false; - break; - } - - return bReturn; -} - -void write_nic_io_byte(struct net_device *dev, int x, u8 y) -{ - u32 u4bPage = x >> 8; - u8 u1PageMask = 0; - bool bIsLegalPage = false; - - if (u4bPage == 0) { - outb(y&0xff, dev->base_addr + x); - - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - write_nic_io_byte(dev, (x & 0xff), y); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - } - } -} - -void write_nic_io_word(struct net_device *dev, int x, u16 y) -{ - u32 u4bPage = x >> 8; - u8 u1PageMask = 0; - bool bIsLegalPage = false; - - if (u4bPage == 0) { - outw(y, dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - write_nic_io_word(dev, (x & 0xff), y); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - - } - } -} - -void write_nic_io_dword(struct net_device *dev, int x, u32 y) -{ - u32 u4bPage = x >> 8; - u8 u1PageMask = 0; - bool bIsLegalPage = false; - - if (u4bPage == 0) { - outl(y, dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - write_nic_io_dword(dev, (x & 0xff), y); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - } - } -} - -u8 read_nic_io_byte(struct net_device *dev, int x) -{ - u32 u4bPage = x >> 8; - u8 u1PageMask = 0; - bool bIsLegalPage = false; - u8 Data = 0; - - if (u4bPage == 0) - return 0xff&inb(dev->base_addr + x); - - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_byte(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - } - - return Data; -} - -u16 read_nic_io_word(struct net_device *dev, int x) -{ - u32 u4bPage = x >> 8; - u8 u1PageMask = 0; - bool bIsLegalPage = false; - u16 Data = 0; - - if (u4bPage == 0) - return inw(dev->base_addr + x); - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_word(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - } - - return Data; -} - -u32 read_nic_io_dword(struct net_device *dev, int x) -{ - u32 u4bPage = x >> 8; - u8 u1PageMask = 0; - bool bIsLegalPage = false; - u32 Data = 0; - - if (u4bPage == 0) - return inl(dev->base_addr + x); - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_dword(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - } - - return Data; -} u8 read_nic_byte(struct net_device *dev, int x) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 776d950655cb..cb7af04f4db1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -581,13 +581,6 @@ extern const struct ethtool_ops rtl819x_ethtool_ops; void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb); short rtl8192_tx(struct net_device *dev, struct sk_buff *skb); -u8 read_nic_io_byte(struct net_device *dev, int x); -u32 read_nic_io_dword(struct net_device *dev, int x); -u16 read_nic_io_word(struct net_device *dev, int x); -void write_nic_io_byte(struct net_device *dev, int x, u8 y); -void write_nic_io_word(struct net_device *dev, int x, u16 y); -void write_nic_io_dword(struct net_device *dev, int x, u32 y); - u8 read_nic_byte(struct net_device *dev, int x); u32 read_nic_dword(struct net_device *dev, int x); u16 read_nic_word(struct net_device *dev, int x); From 9d9d0e369859fe16fe2b7154c64fb65c32136b95 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:14 +0200 Subject: [PATCH 223/912] staging: rtl8192e: Remove DMESG macro It is used in several places, but expands to nothing. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 --- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 4 ---- drivers/staging/rtl8192e/rtllib_debug.h | 2 -- 4 files changed, 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f6661bbae7a8..459ce659d090 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -41,7 +41,6 @@ void rtl8192e_start_beacon(struct net_device *dev) u16 BcnCW = 6; u16 BcnIFS = 0xf; - DMESG("Enabling beacon TX"); rtl8192_irq_disable(dev); write_nic_word(dev, ATIMWND, 2); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 813435988db5..1652da66338d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2723,8 +2723,6 @@ err_rel_mem: release_mem_region(pmem_start, pmem_len); err_rel_rtllib: free_rtllib(dev); - - DMESG("wlan driver load failed\n"); err_pci_disable: pci_disable_device(pdev); return err; @@ -2830,7 +2828,6 @@ static int __init rtl8192_pci_module_init(void) pr_info("Copyright (c) 2007-2008, Realsil Wlan Driver\n"); if (0 != pci_register_driver(&rtl8192_pci_driver)) { - DMESG("No device found"); /*pci_unregister_driver (&rtl8192_pci_driver);*/ return -ENODEV; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 3d7758592490..15fc48440cdc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -818,13 +818,9 @@ static int r8192_wx_set_retry(struct net_device *dev, } if (wrqu->retry.flags & IW_RETRY_MAX) { priv->retry_rts = wrqu->retry.value; - DMESG("Setting retry for RTS/CTS data to %d", - wrqu->retry.value); } else { priv->retry_data = wrqu->retry.value; - DMESG("Setting retry for non RTS/CTS data to %d", - wrqu->retry.value); } diff --git a/drivers/staging/rtl8192e/rtllib_debug.h b/drivers/staging/rtl8192e/rtllib_debug.h index 2f47a7cd23ab..17c276d71058 100644 --- a/drivers/staging/rtl8192e/rtllib_debug.h +++ b/drivers/staging/rtl8192e/rtllib_debug.h @@ -30,8 +30,6 @@ #define DRV_NAME "rtllib_92e" #endif -#define DMESG(x, a...) - extern u32 rt_global_debug_component; /* These are the defines for rt_global_debug_component */ From 59eda5eecda9dc8566d9bc70a7e4dde0a5256aa0 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:15 +0200 Subject: [PATCH 224/912] staging: rtl8192e: Remove rtl819x_process_cck_rxpathsel() Function is empty. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 -- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 ------ drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- 3 files changed, 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 459ce659d090..f28676bc8a8d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1731,8 +1731,6 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (!bcheck) return; - rtl819x_process_cck_rxpathsel(priv, prev_st); - priv->stats.num_process_phyinfo++; if (!prev_st->bIsCCK && prev_st->bPacketToSelf) { for (rfpath = RF90_PATH_A; rfpath < RF90_PATH_C; rfpath++) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 1652da66338d..57eb43e2f5bb 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2012,12 +2012,6 @@ rtl819x_update_rxsignalstatistics8190pci( weighting) / 6; } -void rtl819x_process_cck_rxpathsel(struct r8192_priv *priv, - struct rtllib_rx_stats *pprevious_stats) -{ -} - - u8 rtl819x_query_rxpwrpercentage(char antpower) { if ((antpower <= -100) || (antpower >= 20)) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index cb7af04f4db1..6497918cd35d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -635,8 +635,6 @@ long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index); void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv, struct rtllib_rx_stats *pprevious_stats); u8 rtl819x_evm_dbtopercentage(char value); -void rtl819x_process_cck_rxpathsel(struct r8192_priv *priv, - struct rtllib_rx_stats *pprevious_stats); u8 rtl819x_query_rxpwrpercentage(char antpower); void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats *psrc_stats, struct rtllib_rx_stats *ptarget_stats); From 84b2ce69f952ce84b0b7ce926d497327e38767b6 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:16 +0200 Subject: [PATCH 225/912] staging: rtl8192e: probe: Remove bdma64 check It is always false. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 57eb43e2f5bb..1dc119eab5f1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2599,7 +2599,6 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, struct rtl819x_ops *ops = (struct rtl819x_ops *)(id->driver_data); unsigned long pmem_start, pmem_len, pmem_flags; int err = -ENOMEM; - bool bdma64 = false; u8 revision_id; RT_TRACE(COMP_INIT, "Configuring chip resources"); @@ -2623,8 +2622,6 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, goto err_pci_disable; err = -ENODEV; - if (bdma64) - dev->features |= NETIF_F_HIGHDMA; pci_set_drvdata(pdev, dev); SET_NETDEV_DEV(dev, &pdev->dev); From 3a82a2fe2c165a3d1deb251b19550e5e863e95be Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:17 +0200 Subject: [PATCH 226/912] staging: rtl8192e: Remove rtl8192_rx_cmd() Function is empty. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 1dc119eab5f1..a550634d857e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2161,11 +2161,6 @@ done: } -static void rtl8192_rx_cmd(struct net_device *dev) -{ -} - - static void rtl8192_tx_resume(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); @@ -2192,9 +2187,6 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) { rtl8192_rx_normal(priv->rtllib->dev); - if (MAX_RX_QUEUE > 1) - rtl8192_rx_cmd(priv->rtllib->dev); - write_nic_dword(priv->rtllib->dev, INTA_MASK, read_nic_dword(priv->rtllib->dev, INTA_MASK) | IMR_RDU); } From 735b78615ace8f2c3527baccce0ee2d3ed0fb145 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:18 +0200 Subject: [PATCH 227/912] staging: rtl8192e: rtl_dm: Make functions static Make as many functions as possible static in rtllib_dm.c. The following functions were affected: - dm_check_fsync - dm_CheckRfCtrlGPIO - dm_fsync_timer_callback Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 9 ++++++--- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 3 --- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index bce960d884e2..c2367128c594 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -210,6 +210,9 @@ static void dm_deInit_fsync(struct net_device *dev); static void dm_check_txrateandretrycount(struct net_device *dev); static void dm_check_ac_dc_power(struct net_device *dev); +static void dm_check_fsync(struct net_device *dev); +static void dm_CheckRfCtrlGPIO(void *data); +static void dm_fsync_timer_callback(unsigned long data); /*---------------------Define local function prototype-----------------------*/ @@ -1851,7 +1854,7 @@ static void dm_check_pbc_gpio(struct net_device *dev) { } -void dm_CheckRfCtrlGPIO(void *data) +static void dm_CheckRfCtrlGPIO(void *data) { struct r8192_priv *priv = container_of_dwork_rsl(data, struct r8192_priv, gpio_change_rf_wq); @@ -2188,7 +2191,7 @@ static void dm_deInit_fsync(struct net_device *dev) del_timer_sync(&priv->fsync_timer); } -void dm_fsync_timer_callback(unsigned long data) +static void dm_fsync_timer_callback(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct r8192_priv *priv = rtllib_priv((struct net_device *)data); @@ -2372,7 +2375,7 @@ static void dm_StartSWFsync(struct net_device *dev) } -void dm_check_fsync(struct net_device *dev) +static void dm_check_fsync(struct net_device *dev) { #define RegC38_Default 0 #define RegC38_NonFsync_Other_AP 1 diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index ac95d8f80995..95b8a8fd0556 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -203,8 +203,5 @@ extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); extern void dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_pathcheck_workitemcallback(void *data); -extern void dm_fsync_timer_callback(unsigned long data); -extern void dm_check_fsync(struct net_device *dev); extern void dm_initialize_txpower_tracking(struct net_device *dev); -extern void dm_CheckRfCtrlGPIO(void *data); #endif /*__R8192UDM_H__ */ From e0c84c1c1f0b6335184ab6ea0cdecfbf4abe173a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:19 +0200 Subject: [PATCH 228/912] staging: rtl8192e: rtllib_HTProc: Make functions static Make as many functions as possible static in rtllib_HTProc.c. The following functions were affected: - HTMcsToDataRate - HTFilterMCSRate Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_HTProc.c | 5 +++-- drivers/staging/rtl8192e/rtllib.h | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index b5c3647b0f80..555745b2a75e 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -117,7 +117,7 @@ void HTUpdateDefaultSetting(struct rtllib_device *ieee) pHTInfo->RxReorderPendingTime = 30; } -u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate) +static u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate) { struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; @@ -502,7 +502,8 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, return mcsRate | 0x80; } -u8 HTFilterMCSRate(struct rtllib_device *ieee, u8 *pSupportMCS, u8 *pOperateMCS) +static u8 HTFilterMCSRate(struct rtllib_device *ieee, u8 *pSupportMCS, + u8 *pOperateMCS) { u8 i; diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 65c22dba5017..98f7db00cbca 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -2194,7 +2194,6 @@ extern u16 MCS_DATA_RATE[2][2][77]; extern u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame); extern void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo); extern bool IsHTHalfNmodeAPs(struct rtllib_device *ieee); -extern u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate); extern u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate); extern int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb); extern int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb); @@ -2256,8 +2255,6 @@ extern int rtllib_parse_info_param(struct rtllib_device *ieee, void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prxbIndicateArray, u8 index); -extern u8 HTFilterMCSRate(struct rtllib_device *ieee, u8 *pSupportMCS, - u8 *pOperateMCS); extern void HTUseDefaultSetting(struct rtllib_device *ieee); #define RT_ASOC_RETRY_LIMIT 5 u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee); From 3ebfc4180586ee138af643513e6f75ad61f4db74 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:20 +0200 Subject: [PATCH 229/912] staging: rtl8192e: Make phy_RF8256_Config_ParaFile() static Relocate function in driver to avoid adding unnecessary fw decl. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 18 +++++++++--------- .../staging/rtl8192e/rtl8192e/r8190P_rtl8256.h | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index facc6f1f302b..f3eb1dc3da73 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -81,15 +81,7 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, } } -bool PHY_RF8256_Config(struct net_device *dev) -{ - struct r8192_priv *priv = rtllib_priv(dev); - - priv->NumTotalRFPath = RTL819X_TOTAL_RF_PATH; - return phy_RF8256_Config_ParaFile(dev); -} - -bool phy_RF8256_Config_ParaFile(struct net_device *dev) +static bool phy_RF8256_Config_ParaFile(struct net_device *dev) { u32 u4RegValue = 0; u8 eRFPath; @@ -240,6 +232,14 @@ phy_RF8256_Config_ParaFile_Fail: return false; } +bool PHY_RF8256_Config(struct net_device *dev) +{ + struct r8192_priv *priv = rtllib_priv(dev); + + priv->NumTotalRFPath = RTL819X_TOTAL_RF_PATH; + return phy_RF8256_Config_ParaFile(dev); +} + void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel) { u32 TxAGC = 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h index 64e831d2f4e5..d9348d92af26 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h @@ -24,7 +24,6 @@ extern void PHY_SetRF8256Bandwidth(struct net_device *dev, enum ht_channel_width Bandwidth); extern bool PHY_RF8256_Config(struct net_device *dev); -extern bool phy_RF8256_Config_ParaFile(struct net_device *dev); extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); extern void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel); From 235a86c3ec8e5343dd153889ecc42a6fc66c09ce Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:21 +0200 Subject: [PATCH 230/912] staging: rtl8192e: rtl_core: Make functions static Make as many functions as possible static in rtl_core.c. If needed - move fw declaration from header. The following functions were affected: - rtl8192_is_tx_queue_empty - rtl819x_watchdog_wqcallback - watch_dog_timer_callback - rtl8192_data_hard_stop - rtl8192_data_hard_resume - rtl8192_hard_data_xmit - rtl8192_hard_start_xmit - rtl8192_tx_cmd - rtl8192_tx - rtl8192_pci_initdescring - rtl8192_irq_tx_tasklet - rtl8192_irq_rx_tasklet - rtl8192_cancel_deferred_work - _rtl8192_up - rtl8192_up - rtl8192_down - rtl8192_restart - rtl8192_update_cap Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 64 ++++++++++++-------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 24 -------- 2 files changed, 39 insertions(+), 49 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index a550634d857e..ca8406bba26d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -87,6 +87,25 @@ static struct pci_driver rtl8192_pci_driver = { .resume = rtl8192E_resume, /* PM resume fn */ }; +static short rtl8192_is_tx_queue_empty(struct net_device *dev); +static void rtl819x_watchdog_wqcallback(void *data); +static void watch_dog_timer_callback(unsigned long data); +static void rtl8192_data_hard_stop(struct net_device *dev); +static void rtl8192_data_hard_resume(struct net_device *dev); +static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, + int rate); +static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); +static void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb); +static short rtl8192_tx(struct net_device *dev, struct sk_buff *skb); +static short rtl8192_pci_initdescring(struct net_device *dev); +static void rtl8192_irq_tx_tasklet(struct r8192_priv *priv); +static void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); +static void rtl8192_cancel_deferred_work(struct r8192_priv *priv); +static int _rtl8192_up(struct net_device *dev, bool is_silent_reset); +static int rtl8192_up(struct net_device *dev); +static int rtl8192_down(struct net_device *dev, bool shutdownrf); +static void rtl8192_restart(void *data); + /**************************************************************************** -----------------------------IO STUFF------------------------- *****************************************************************************/ @@ -273,7 +292,7 @@ static short rtl8192_check_nic_enough_desc(struct net_device *dev, int prio) return 0; } -void rtl8192_tx_timeout(struct net_device *dev) +static void rtl8192_tx_timeout(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); @@ -299,7 +318,7 @@ void rtl8192_irq_disable(struct net_device *dev) priv->irq_enabled = 0; } -void rtl8192_set_chan(struct net_device *dev, short ch) +static void rtl8192_set_chan(struct net_device *dev, short ch) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); @@ -313,7 +332,7 @@ void rtl8192_set_chan(struct net_device *dev, short ch) priv->rf_set_chan(dev, priv->chan); } -void rtl8192_update_cap(struct net_device *dev, u16 cap) +static void rtl8192_update_cap(struct net_device *dev, u16 cap) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_network *net = &priv->rtllib->current_network; @@ -1105,7 +1124,7 @@ static short rtl8192_init(struct net_device *dev) /*************************************************************************** -------------------------------WATCHDOG STUFF--------------------------- ***************************************************************************/ -short rtl8192_is_tx_queue_empty(struct net_device *dev) +static short rtl8192_is_tx_queue_empty(struct net_device *dev) { int i = 0; struct r8192_priv *priv = rtllib_priv(dev); @@ -1393,8 +1412,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, } } - -void rtl819x_watchdog_wqcallback(void *data) +static void rtl819x_watchdog_wqcallback(void *data) { struct r8192_priv *priv = container_of_dwork_rsl(data, struct r8192_priv, watch_dog_wq); @@ -1548,7 +1566,7 @@ void rtl819x_watchdog_wqcallback(void *data) RT_TRACE(COMP_TRACE, " <==RtUsbCheckForHangWorkItemCallback()\n"); } -void watch_dog_timer_callback(unsigned long data) +static void watch_dog_timer_callback(unsigned long data) { struct r8192_priv *priv = rtllib_priv((struct net_device *)data); @@ -1625,16 +1643,15 @@ static void rtl8192_free_tx_ring(struct net_device *dev, unsigned int prio) ring->desc = NULL; } -void rtl8192_data_hard_stop(struct net_device *dev) +static void rtl8192_data_hard_stop(struct net_device *dev) { } - -void rtl8192_data_hard_resume(struct net_device *dev) +static void rtl8192_data_hard_resume(struct net_device *dev) { } -void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, +static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); @@ -1666,7 +1683,7 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, } } -int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) +static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); int ret; @@ -1725,7 +1742,7 @@ static void rtl8192_tx_isr(struct net_device *dev, int prio) tasklet_schedule(&priv->irq_tx_tasklet); } -void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb) +static void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); struct rtl8192_tx_ring *ring; @@ -1748,7 +1765,7 @@ void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb) spin_unlock_irqrestore(&priv->irq_th_lock, flags); } -short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) +static short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); struct rtl8192_tx_ring *ring; @@ -1900,8 +1917,7 @@ static int rtl8192_alloc_tx_desc_ring(struct net_device *dev, return 0; } - -short rtl8192_pci_initdescring(struct net_device *dev) +static short rtl8192_pci_initdescring(struct net_device *dev) { u32 ret; int i; @@ -2178,12 +2194,12 @@ static void rtl8192_tx_resume(struct net_device *dev) } } -void rtl8192_irq_tx_tasklet(struct r8192_priv *priv) +static void rtl8192_irq_tx_tasklet(struct r8192_priv *priv) { rtl8192_tx_resume(priv->rtllib->dev); } -void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) +static void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) { rtl8192_rx_normal(priv->rtllib->dev); @@ -2194,7 +2210,7 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) /**************************************************************************** ---------------------------- NIC START/CLOSE STUFF--------------------------- *****************************************************************************/ -void rtl8192_cancel_deferred_work(struct r8192_priv *priv) +static void rtl8192_cancel_deferred_work(struct r8192_priv *priv) { cancel_delayed_work(&priv->watch_dog_wq); cancel_delayed_work(&priv->update_beacon_wq); @@ -2203,14 +2219,13 @@ void rtl8192_cancel_deferred_work(struct r8192_priv *priv) cancel_work_sync(&priv->qos_activate); } -int _rtl8192_up(struct net_device *dev, bool is_silent_reset) +static int _rtl8192_up(struct net_device *dev, bool is_silent_reset) { if (_rtl8192_sta_up(dev, is_silent_reset) == -1) return -1; return 0; } - static int rtl8192_open(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); @@ -2223,8 +2238,7 @@ static int rtl8192_open(struct net_device *dev) } - -int rtl8192_up(struct net_device *dev) +static int rtl8192_up(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); @@ -2254,7 +2268,7 @@ static int rtl8192_close(struct net_device *dev) } -int rtl8192_down(struct net_device *dev, bool shutdownrf) +static int rtl8192_down(struct net_device *dev, bool shutdownrf) { if (rtl8192_sta_down(dev, shutdownrf) == -1) return -1; @@ -2274,7 +2288,7 @@ void rtl8192_commit(struct net_device *dev) _rtl8192_up(dev, false); } -void rtl8192_restart(void *data) +static void rtl8192_restart(void *data) { struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, reset_wq); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 6497918cd35d..26e54e41ced6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -578,9 +578,6 @@ struct r8192_priv { extern const struct ethtool_ops rtl819x_ethtool_ops; -void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb); -short rtl8192_tx(struct net_device *dev, struct sk_buff *skb); - u8 read_nic_byte(struct net_device *dev, int x); u32 read_nic_dword(struct net_device *dev, int x); u16 read_nic_word(struct net_device *dev, int x); @@ -593,40 +590,19 @@ void force_pci_posting(struct net_device *dev); void rtl8192_rx_enable(struct net_device *); void rtl8192_tx_enable(struct net_device *); -int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); -void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, - int rate); -void rtl8192_data_hard_stop(struct net_device *dev); -void rtl8192_data_hard_resume(struct net_device *dev); -void rtl8192_restart(void *data); -void rtl819x_watchdog_wqcallback(void *data); void rtl8192_hw_sleep_wq(void *data); -void watch_dog_timer_callback(unsigned long data); -void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); -void rtl8192_irq_tx_tasklet(struct r8192_priv *priv); -int rtl8192_down(struct net_device *dev, bool shutdownrf); -int rtl8192_up(struct net_device *dev); void rtl8192_commit(struct net_device *dev); -void rtl8192_set_chan(struct net_device *dev, short ch); void check_rfctrl_gpio_timer(unsigned long data); void rtl8192_hw_wakeup_wq(void *data); -short rtl8192_pci_initdescring(struct net_device *dev); -void rtl8192_cancel_deferred_work(struct r8192_priv *priv); - -int _rtl8192_up(struct net_device *dev, bool is_silent_reset); - -short rtl8192_is_tx_queue_empty(struct net_device *dev); void rtl8192_irq_disable(struct net_device *dev); -void rtl8192_tx_timeout(struct net_device *dev); void rtl8192_pci_resetdescring(struct net_device *dev); void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode); void rtl8192_irq_enable(struct net_device *dev); void rtl8192_config_rate(struct net_device *dev, u16 *rate_config); -void rtl8192_update_cap(struct net_device *dev, u16 cap); void rtl8192_irq_disable(struct net_device *dev); void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, From cc5a1591dadc01597e0fb48d0f5c16203ec33a00 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:22 +0200 Subject: [PATCH 231/912] staging: rtl8192e: r8192e_phy: Make functions static Make as many functions as possible static in r8192E_phy.c. The following functions were affected: - rtl8192_phyConfigBB - rtl8192_SwChnl_WorkItem - rtl8192_SetBWModeWorkItem Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index fba7654160e8..32135235f3e2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -357,7 +357,7 @@ void rtl8192_phy_configmac(struct net_device *dev) } -void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) +static void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) { int i; u32 *Rtl819XPHY_REGArray_Table = NULL; @@ -986,7 +986,7 @@ static void rtl8192_phy_FinishSwChnlNow(struct net_device *dev, u8 channel) break; } } -void rtl8192_SwChnl_WorkItem(struct net_device *dev) +static void rtl8192_SwChnl_WorkItem(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); @@ -1163,7 +1163,7 @@ static void CCK_Tx_Power_Track_BW_Switch(struct net_device *dev) CCK_Tx_Power_Track_BW_Switch_ThermalMeter(dev); } -void rtl8192_SetBWModeWorkItem(struct net_device *dev) +static void rtl8192_SetBWModeWorkItem(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 18bc58240fbe..ef85587c6a12 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -80,7 +80,6 @@ extern u32 rtl8192_phy_QueryRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, u32 RegAddr, u32 BitMask); extern void rtl8192_phy_configmac(struct net_device *dev); -extern void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType); extern bool rtl8192_phy_checkBBAndRF(struct net_device *dev, enum hw90_block CheckBlock, enum rf90_radio_path eRFPath); @@ -96,8 +95,6 @@ extern u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel); extern void rtl8192_SetBWMode(struct net_device *dev, enum ht_channel_width Bandwidth, enum ht_extchnl_offset Offset); -extern void rtl8192_SwChnl_WorkItem(struct net_device *dev); -extern void rtl8192_SetBWModeWorkItem(struct net_device *dev); extern void InitialGain819xPci(struct net_device *dev, u8 Operation); extern void PHY_SetRtl8192eRfOff(struct net_device *dev); From 01b67faf5c5449f7dc628d48b71faab73ac67343 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:23 +0200 Subject: [PATCH 232/912] staging: rtl8192e: Make rtl8192_QueryIsShort() static Relocate function within file to avoid unnecessary fw decl. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 24 +++++++++---------- .../staging/rtl8192e/rtl8192e/r8192E_dev.h | 1 - 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f28676bc8a8d..eb919b634e3c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1176,6 +1176,18 @@ static u8 rtl8192_MapHwQueueToFirmwareQueue(struct net_device *dev, u8 QueueID, return QueueSelect; } +static u8 rtl8192_QueryIsShort(u8 TxHT, u8 TxRate, struct cb_desc *tcb_desc) +{ + u8 tmp_Short; + + tmp_Short = (TxHT == 1) ? ((tcb_desc->bUseShortGI) ? 1 : 0) : + ((tcb_desc->bUseShortPreamble) ? 1 : 0); + if (TxHT == 1 && TxRate != DESC90_RATEMCS15) + tmp_Short = 0; + + return tmp_Short; +} + void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, struct cb_desc *cb_desc, struct sk_buff *skb) { @@ -2380,18 +2392,6 @@ bool rtl8192_GetHalfNmodeSupportByAPs(struct net_device *dev) return Reval; } -u8 rtl8192_QueryIsShort(u8 TxHT, u8 TxRate, struct cb_desc *tcb_desc) -{ - u8 tmp_Short; - - tmp_Short = (TxHT == 1) ? ((tcb_desc->bUseShortGI) ? 1 : 0) : - ((tcb_desc->bUseShortPreamble) ? 1 : 0); - if (TxHT == 1 && TxRate != DESC90_RATEMCS15) - tmp_Short = 0; - - return tmp_Short; -} - void ActUpdateChannelAccessSetting(struct net_device *dev, enum wireless_mode WirelessMode, struct channel_access_setting *ChnlAccessSetting) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index dbe0e1c87056..4f1b312e90f4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -27,7 +27,6 @@ #include "r8190P_def.h" -u8 rtl8192_QueryIsShort(u8 TxHT, u8 TxRate, struct cb_desc *tcb_desc); bool rtl8192_GetHalfNmodeSupportByAPs(struct net_device *dev); bool rtl8192_GetNmodeSupportBySecCfg(struct net_device *dev); bool rtl8192_HalTxCheckStuck(struct net_device *dev); From 511998ea5be18a0219151e30c92a5d47533d2c49 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:24 +0200 Subject: [PATCH 233/912] staging: rtl8192e: rtllib_tx: Make functions static Make as many functions as possible static in rtllib_tx.c. The following functions were affected: - rtllib_xmit_inter - rtllib_query_seqnum - rtllib_put_snap Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 3 --- drivers/staging/rtl8192e/rtllib_tx.c | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 98f7db00cbca..965ae16b3d05 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1995,7 +1995,6 @@ extern int rtllib_encrypt_fragment( int hdr_len); extern int rtllib_xmit(struct sk_buff *skb, struct net_device *dev); -extern int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev); extern void rtllib_txb_free(struct rtllib_txb *); /* rtllib_rx.c */ @@ -2092,8 +2091,6 @@ extern void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success); extern void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee); -extern u16 rtllib_query_seqnum(struct rtllib_device *ieee, - struct sk_buff *skb, u8 *dst); extern u8 rtllib_ap_sec_type(struct rtllib_device *ieee); /* rtllib_softmac_wx.c */ diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 517500c83d3e..b992e4612fd8 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -151,7 +151,7 @@ static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; -inline int rtllib_put_snap(u8 *data, u16 h_proto) +static int rtllib_put_snap(u8 *data, u16 h_proto) { struct rtllib_snap_hdr *snap; u8 *oui; @@ -514,8 +514,8 @@ static void rtllib_txrate_selectmode(struct rtllib_device *ieee, } } -u16 rtllib_query_seqnum(struct rtllib_device *ieee, struct sk_buff *skb, - u8 *dst) +static u16 rtllib_query_seqnum(struct rtllib_device *ieee, struct sk_buff *skb, + u8 *dst) { u16 seqnum = 0; @@ -565,7 +565,7 @@ static u8 rtllib_current_rate(struct rtllib_device *ieee) return ieee->rate & 0x7F; } -int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) +static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) { struct rtllib_device *ieee = (struct rtllib_device *) netdev_priv_rsl(dev); From ed4360336931ea99d029f1208d3e55b60c2bc621 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:25 +0200 Subject: [PATCH 234/912] staging: rtl8192e: Make rtllib_rx_mgt() static Function is not referenced outside of rtllib_rx.c Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 3 --- drivers/staging/rtl8192e/rtllib_rx.c | 9 ++++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 965ae16b3d05..57341a1a6e61 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -2000,9 +2000,6 @@ extern void rtllib_txb_free(struct rtllib_txb *); /* rtllib_rx.c */ extern int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats); -extern void rtllib_rx_mgt(struct rtllib_device *ieee, - struct sk_buff *skb, - struct rtllib_rx_stats *stats); extern void rtllib_rx_probe_rq(struct rtllib_device *ieee, struct sk_buff *skb); extern int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel); diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 0698a0d1f466..54dfff61f485 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -44,6 +44,9 @@ #include "rtllib.h" #include "dot11d.h" +static void rtllib_rx_mgt(struct rtllib_device *ieee, struct sk_buff *skb, + struct rtllib_rx_stats *stats); + static inline void rtllib_monitor_rx(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_status, @@ -2715,9 +2718,9 @@ free_network: kfree(network); } -void rtllib_rx_mgt(struct rtllib_device *ieee, - struct sk_buff *skb, - struct rtllib_rx_stats *stats) +static void rtllib_rx_mgt(struct rtllib_device *ieee, + struct sk_buff *skb, + struct rtllib_rx_stats *stats) { struct rtllib_hdr_4addr *header = (struct rtllib_hdr_4addr *)skb->data; From 6957248f487e0eeecf7a23a34b08ee26c0c3a151 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 14 Jul 2015 22:04:26 +0200 Subject: [PATCH 235/912] staging: rtl8192e: rtllib_softmac: Make functions static Make as many functions as possible static in rtllib_softmac.c. The following functions were affected: - rtllib_sta_wakeup - rtllib_TURBO_Info - rtllib_get_beacon_ - rtllib_send_probe_requests - rtllib_update_active_chan_map - rtllib_softmac_scan_syncro Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 11 --------- drivers/staging/rtl8192e/rtllib_softmac.c | 27 +++++++++++++---------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 57341a1a6e61..617f79efe4ca 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -2026,7 +2026,6 @@ extern int rtllib_wx_set_mlme(struct rtllib_device *ieee, extern int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len); /* rtllib_softmac.c */ -extern short rtllib_is_54g(struct rtllib_network *net); extern int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats, u16 type, @@ -2040,13 +2039,9 @@ extern void rtllib_softmac_xmit(struct rtllib_txb *txb, extern void rtllib_stop_send_beacons(struct rtllib_device *ieee); extern void notify_wx_assoc_event(struct rtllib_device *ieee); -extern void rtllib_softmac_check_all_nets(struct rtllib_device *ieee); -extern void rtllib_start_bss(struct rtllib_device *ieee); -extern void rtllib_start_master_bss(struct rtllib_device *ieee); extern void rtllib_start_ibss(struct rtllib_device *ieee); extern void rtllib_softmac_init(struct rtllib_device *ieee); extern void rtllib_softmac_free(struct rtllib_device *ieee); -extern void rtllib_associate_abort(struct rtllib_device *ieee); extern void rtllib_disassociate(struct rtllib_device *ieee); extern void rtllib_stop_scan(struct rtllib_device *ieee); extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan); @@ -2054,7 +2049,6 @@ extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee); extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr); -extern void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl); extern void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee); extern void rtllib_start_protocol(struct rtllib_device *ieee); extern void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown); @@ -2067,8 +2061,6 @@ extern void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, bool bInitState); extern void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, bool bInitState); -extern void rtllib_send_probe_requests(struct rtllib_device *ieee, u8 is_mesh); - extern void rtllib_softmac_stop_protocol(struct rtllib_device *ieee, u8 mesh_flag, u8 shutdown); extern void rtllib_softmac_start_protocol(struct rtllib_device *ieee, @@ -2214,7 +2206,6 @@ extern void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS); extern void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr); extern void RemoveAllTS(struct rtllib_device *ieee); -void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); extern const long rtllib_wlan_frequencies[]; @@ -2238,7 +2229,6 @@ bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn); /* For the function is more related to hardware setting, it's better to use the * ieee handler to refer to it. */ -extern void rtllib_update_active_chan_map(struct rtllib_device *ieee); extern void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, struct rx_ts_record *pTS); extern int rtllib_parse_info_param(struct rtllib_device *ieee, @@ -2252,7 +2242,6 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, extern void HTUseDefaultSetting(struct rtllib_device *ieee); #define RT_ASOC_RETRY_LIMIT 5 u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee); -extern void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p); #define SEM_DOWN_IEEE_WX(psem) down(psem) #define SEM_UP_IEEE_WX(psem) up(psem) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index eac7f289d354..635a1c40c309 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -23,7 +23,10 @@ #include #include "dot11d.h" -short rtllib_is_54g(struct rtllib_network *net) +static void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl); + + +static short rtllib_is_54g(struct rtllib_network *net) { return (net->rates_ex_len > 0) || (net->rates_len > 4); } @@ -107,7 +110,7 @@ static void rtllib_WMM_Info(struct rtllib_device *ieee, u8 **tag_p) *tag_p = tag; } -void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p) +static void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; @@ -369,7 +372,7 @@ static inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee) return skb; } -struct sk_buff *rtllib_get_beacon_(struct rtllib_device *ieee); +static struct sk_buff *rtllib_get_beacon_(struct rtllib_device *ieee); static void rtllib_send_beacon(struct rtllib_device *ieee) { @@ -483,7 +486,7 @@ static void rtllib_send_probe(struct rtllib_device *ieee, u8 is_mesh) } -void rtllib_send_probe_requests(struct rtllib_device *ieee, u8 is_mesh) +static void rtllib_send_probe_requests(struct rtllib_device *ieee, u8 is_mesh) { if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)) { @@ -492,7 +495,7 @@ void rtllib_send_probe_requests(struct rtllib_device *ieee, u8 is_mesh) } } -void rtllib_update_active_chan_map(struct rtllib_device *ieee) +static void rtllib_update_active_chan_map(struct rtllib_device *ieee) { memcpy(ieee->active_channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); @@ -501,7 +504,7 @@ void rtllib_update_active_chan_map(struct rtllib_device *ieee) /* this performs syncro scan blocking the caller until all channels * in the allowed channel map has been checked. */ -void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh) +static void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh) { union iwreq_data wrqu; short ch = 0; @@ -1401,7 +1404,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, return skb; } -void rtllib_associate_abort(struct rtllib_device *ieee) +static void rtllib_associate_abort(struct rtllib_device *ieee) { unsigned long flags; @@ -1752,7 +1755,7 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, } } -void rtllib_softmac_check_all_nets(struct rtllib_device *ieee) +static void rtllib_softmac_check_all_nets(struct rtllib_device *ieee) { unsigned long flags; struct rtllib_network *target; @@ -2108,7 +2111,7 @@ out: } -void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl) +static void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl) { if (ieee->sta_sleep == LPS_IS_WAKE) { if (nl) { @@ -2544,7 +2547,7 @@ inline void rtllib_randomize_cell(struct rtllib_device *ieee) } /* called in user context only */ -void rtllib_start_master_bss(struct rtllib_device *ieee) +static void rtllib_start_master_bss(struct rtllib_device *ieee) { ieee->assoc_id = 1; @@ -2719,7 +2722,7 @@ inline void rtllib_start_ibss(struct rtllib_device *ieee) } /* this is called only in user context, with wx_sem held */ -void rtllib_start_bss(struct rtllib_device *ieee) +static void rtllib_start_bss(struct rtllib_device *ieee) { unsigned long flags; @@ -2816,7 +2819,7 @@ exit: up(&ieee->wx_sem); } -struct sk_buff *rtllib_get_beacon_(struct rtllib_device *ieee) +static struct sk_buff *rtllib_get_beacon_(struct rtllib_device *ieee) { const u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; From 3e3148c51190d680b7cc2ebdc556e6ea27a93989 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 26 Jun 2015 09:37:25 +0530 Subject: [PATCH 236/912] Staging: rtl8192e: Replace memset with eth_zero_addr Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero. Note that the 6 in the third argument of memset appears to represent an ethernet address size (ETH_ALEN). The Coccinelle semantic patch that makes this change is as follows: // @eth_zero_addr@ expression e; @@ -memset(e,0x00,6); +eth_zero_addr(e); // Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_TSProc.c | 2 +- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 05aea4321b9d..7087959443cb 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -113,7 +113,7 @@ static void TsAddBaProcess(unsigned long data) static void ResetTsCommonInfo(struct ts_common_info *pTsCommonInfo) { - memset(pTsCommonInfo->Addr, 0, 6); + eth_zero_addr(pTsCommonInfo->Addr); memset(&pTsCommonInfo->TSpec, 0, sizeof(union tspec_body)); memset(&pTsCommonInfo->TClass, 0, sizeof(union qos_tclas)*TCLAS_NUM); pTsCommonInfo->TClasProc = 0; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 635a1c40c309..1503cbb3574e 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -3086,7 +3086,7 @@ static int rtllib_wpa_enable(struct rtllib_device *ieee, int value) */ netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling"); ieee->wpa_enabled = value; - memset(ieee->ap_mac_addr, 0, 6); + eth_zero_addr(ieee->ap_mac_addr); return 0; } From b44d9ce3b81715311198f0c5fa329e518b4f9f18 Mon Sep 17 00:00:00 2001 From: Gioh Kim Date: Mon, 6 Jul 2015 15:14:40 +0900 Subject: [PATCH 237/912] staging: ion: shrink page-pool by page unit This patch shrink page-pool by page unit. The system shrinker calls ion_heap_shrink_count() to get nr_to_scan, and pass it to ion_heap_shrink_scan(). The problem is the return value of ion_heap_shrink_count() is the number of pages but ion_system_heap_shrink(), which is called by ion_heap_shrink_scan(), gets the number of chunk. The main root of this is that ion_page_pool_shrink() returns page count via ion_page_pool_total() if it have to check pool size. But it frees chunks of pages if it have to free pools. This patch first fix ion_page_pool_shrink() to count only pages, not chunks. And then ion_system_heap_shrink() to work on pages. Signed-off-by: Gioh Kim Reviewed-by: Laura Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_page_pool.c | 5 +++-- drivers/staging/android/ion/ion_system_heap.c | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index 4b88f11e52d3..19ad3aba499a 100644 --- a/drivers/staging/android/ion/ion_page_pool.c +++ b/drivers/staging/android/ion/ion_page_pool.c @@ -116,7 +116,7 @@ static int ion_page_pool_total(struct ion_page_pool *pool, bool high) int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask, int nr_to_scan) { - int freed; + int freed = 0; bool high; if (current_is_kswapd()) @@ -127,7 +127,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask, if (nr_to_scan == 0) return ion_page_pool_total(pool, high); - for (freed = 0; freed < nr_to_scan; freed++) { + while (freed < nr_to_scan) { struct page *page; mutex_lock(&pool->mutex); @@ -141,6 +141,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask, } mutex_unlock(&pool->mutex); ion_page_pool_free_pages(pool, page); + freed += (1 << pool->order); } return freed; diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index da2a63c0a9ba..7a7a9a047230 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -212,14 +212,26 @@ static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask, { struct ion_system_heap *sys_heap; int nr_total = 0; - int i; + int i, nr_freed; + int only_scan = 0; sys_heap = container_of(heap, struct ion_system_heap, heap); + if (!nr_to_scan) + only_scan = 1; + for (i = 0; i < num_orders; i++) { struct ion_page_pool *pool = sys_heap->pools[i]; - nr_total += ion_page_pool_shrink(pool, gfp_mask, nr_to_scan); + nr_freed = ion_page_pool_shrink(pool, gfp_mask, nr_to_scan); + nr_total += nr_freed; + + if (!only_scan) { + nr_to_scan -= nr_freed; + /* shrink completed */ + if (nr_to_scan <= 0) + break; + } } return nr_total; From aeb7fa7b4f29ce4d7d16c4c3565c4714f2f62b82 Mon Sep 17 00:00:00 2001 From: Gioh Kim Date: Mon, 6 Jul 2015 15:14:41 +0900 Subject: [PATCH 238/912] staging: ion: debugfs to shrink pool This patch enables debugfs file /sys/kernel/debug/ion/heaps/system_shrink to shrink pool and get pool size. This technically enables debugfs shrinking for all heaps, not just the system heap although the system heap is the only one with a shrinker right now. It is already implemented but not complete. This patch completes and enables it. Reading the file returns pool size in page unit and writing the number of pages shrinks pool. It flushes all pages to write zero at the file. Signed-off-by: Gioh Kim Reviewed-by: Laura Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 6c922c7817f9..eec878e183f5 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1466,7 +1466,6 @@ static const struct file_operations debug_heap_fops = { .release = single_release, }; -#ifdef DEBUG_HEAP_SHRINKER static int debug_shrink_set(void *data, u64 val) { struct ion_heap *heap = data; @@ -1474,15 +1473,14 @@ static int debug_shrink_set(void *data, u64 val) int objs; sc.gfp_mask = -1; - sc.nr_to_scan = 0; + sc.nr_to_scan = val; - if (!val) - return 0; + if (!val) { + objs = heap->shrinker.count_objects(&heap->shrinker, &sc); + sc.nr_to_scan = objs; + } - objs = heap->shrinker.shrink(&heap->shrinker, &sc); - sc.nr_to_scan = objs; - - heap->shrinker.shrink(&heap->shrinker, &sc); + heap->shrinker.scan_objects(&heap->shrinker, &sc); return 0; } @@ -1495,14 +1493,13 @@ static int debug_shrink_get(void *data, u64 *val) sc.gfp_mask = -1; sc.nr_to_scan = 0; - objs = heap->shrinker.shrink(&heap->shrinker, &sc); + objs = heap->shrinker.count_objects(&heap->shrinker, &sc); *val = objs; return 0; } DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get, debug_shrink_set, "%llu\n"); -#endif void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap) { @@ -1540,8 +1537,7 @@ void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap) path, heap->name); } -#ifdef DEBUG_HEAP_SHRINKER - if (heap->shrinker.shrink) { + if (heap->shrinker.count_objects && heap->shrinker.scan_objects) { char debug_name[64]; snprintf(debug_name, 64, "%s_shrink", heap->name); @@ -1556,7 +1552,7 @@ void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap) path, debug_name); } } -#endif + up_write(&dev->lock); } From 4d4d138a3e2c2a85df9fa048b341612c235c1027 Mon Sep 17 00:00:00 2001 From: Maninder Singh Date: Wed, 15 Jul 2015 08:52:51 +0530 Subject: [PATCH 239/912] staging:vt6655: remove checks around dev_kfree_skb dev_kfree_skb checks for NULL pointer itself, Thus no need of explicit NULL check. Signed-off-by: Maninder Singh Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 4f55d5e9a9c5..f7d70427d050 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -758,9 +758,7 @@ static void device_free_td0_ring(struct vnt_private *pDevice) dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, pTDInfo->skb->len, DMA_TO_DEVICE); - if (pTDInfo->skb) - dev_kfree_skb(pTDInfo->skb); - + dev_kfree_skb(pTDInfo->skb); kfree(pDesc->pTDInfo); } } @@ -777,9 +775,7 @@ static void device_free_td1_ring(struct vnt_private *pDevice) dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, pTDInfo->skb->len, DMA_TO_DEVICE); - if (pTDInfo->skb) - dev_kfree_skb(pTDInfo->skb); - + dev_kfree_skb(pTDInfo->skb); kfree(pDesc->pTDInfo); } } From 86eadace5d021f50558936ea75234f3262d16bc2 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:36 +0300 Subject: [PATCH 240/912] staging: vme_user: fix code alignment Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 33 +++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 9cca97af3044..ccf96029ca22 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -128,7 +128,7 @@ struct vme_user_vma_priv { * transfer the data directly into the user space buffers. */ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, - loff_t *ppos) + loff_t *ppos) { ssize_t retval; ssize_t copied = 0; @@ -167,7 +167,7 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, * transfer the data directly from the user space buffers out to VME. */ static ssize_t resource_from_user(unsigned int minor, const char __user *buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { ssize_t retval; ssize_t copied = 0; @@ -195,7 +195,7 @@ static ssize_t resource_from_user(unsigned int minor, const char __user *buf, } static ssize_t buffer_to_user(unsigned int minor, char __user *buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { void *image_ptr; ssize_t retval; @@ -214,7 +214,7 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf, } static ssize_t buffer_from_user(unsigned int minor, const char __user *buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { void *image_ptr; size_t retval; @@ -233,7 +233,7 @@ static ssize_t buffer_from_user(unsigned int minor, const char __user *buf, } static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, - loff_t *ppos) + loff_t *ppos) { unsigned int minor = MINOR(file_inode(file)->i_rdev); ssize_t retval; @@ -279,7 +279,7 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, } static ssize_t vme_user_write(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { unsigned int minor = MINOR(file_inode(file)->i_rdev); ssize_t retval; @@ -354,7 +354,7 @@ static loff_t vme_user_llseek(struct file *file, loff_t off, int whence) * already been defined. */ static int vme_user_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { struct vme_master master; struct vme_slave slave; @@ -390,12 +390,13 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, * to userspace as they are */ retval = vme_master_get(image[minor].resource, - &master.enable, &master.vme_addr, - &master.size, &master.aspace, - &master.cycle, &master.dwidth); + &master.enable, + &master.vme_addr, + &master.size, &master.aspace, + &master.cycle, &master.dwidth); copied = copy_to_user(argp, &master, - sizeof(struct vme_master)); + sizeof(struct vme_master)); if (copied != 0) { pr_warn("Partial copy to userspace\n"); return -EFAULT; @@ -435,12 +436,12 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, * to userspace as they are */ retval = vme_slave_get(image[minor].resource, - &slave.enable, &slave.vme_addr, - &slave.size, &pci_addr, &slave.aspace, - &slave.cycle); + &slave.enable, &slave.vme_addr, + &slave.size, &pci_addr, + &slave.aspace, &slave.cycle); copied = copy_to_user(argp, &slave, - sizeof(struct vme_slave)); + sizeof(struct vme_slave)); if (copied != 0) { pr_warn("Partial copy to userspace\n"); return -EFAULT; @@ -606,7 +607,7 @@ static int vme_user_probe(struct vme_dev *vdev) /* Assign major and minor numbers for the driver */ err = register_chrdev_region(MKDEV(VME_MAJOR, 0), VME_DEVS, - driver_name); + driver_name); if (err) { dev_warn(&vdev->dev, "Error getting Major Number %d for driver.\n", VME_MAJOR); From cd974d35ab784d98085ed1b317a9978c026d86f7 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:37 +0300 Subject: [PATCH 241/912] staging: vme_user: fix blank lines Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index ccf96029ca22..494655ad1264 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -101,13 +101,13 @@ struct image_desc { struct vme_resource *resource; /* VME resource */ int mmap_count; /* Number of current mmap's */ }; + static struct image_desc image[VME_DEVS]; static struct cdev *vme_user_cdev; /* Character device */ static struct class *vme_user_sysfs_class; /* Sysfs class */ static struct vme_dev *vme_user_bridge; /* Pointer to user device */ - static const int type[VME_DEVS] = { MASTER_MINOR, MASTER_MINOR, MASTER_MINOR, MASTER_MINOR, SLAVE_MINOR, SLAVE_MINOR, @@ -120,7 +120,6 @@ struct vme_user_vma_priv { atomic_t refcnt; }; - /* * We are going ot alloc a page during init per window for small transfers. * Small transfers will go VME -> buffer -> user space. Larger (more than a @@ -836,7 +835,6 @@ static void __exit vme_user_exit(void) vme_unregister_driver(&vme_user_driver); } - MODULE_PARM_DESC(bus, "Enumeration of VMEbus to which the driver is connected"); module_param_array(bus, int, &bus_num, 0); From f99b71be37dd88e7b2f4a7c227da6c4f71cd8fa4 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:38 +0300 Subject: [PATCH 242/912] staging: vme_user: fix NULL comparison style Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 494655ad1264..2ff15f081776 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -527,7 +527,7 @@ static int vme_user_master_mmap(unsigned int minor, struct vm_area_struct *vma) } vma_priv = kmalloc(sizeof(struct vme_user_vma_priv), GFP_KERNEL); - if (vma_priv == NULL) { + if (!vma_priv) { mutex_unlock(&image[minor].mutex); return -ENOMEM; } @@ -588,7 +588,7 @@ static int vme_user_probe(struct vme_dev *vdev) char *name; /* Save pointer to the bridge device */ - if (vme_user_bridge != NULL) { + if (vme_user_bridge) { dev_err(&vdev->dev, "Driver can only be loaded for 1 device\n"); err = -EINVAL; goto err_dev; @@ -636,7 +636,7 @@ static int vme_user_probe(struct vme_dev *vdev) */ image[i].resource = vme_slave_request(vme_user_bridge, VME_A24, VME_SCT); - if (image[i].resource == NULL) { + if (!image[i].resource) { dev_warn(&vdev->dev, "Unable to allocate slave resource\n"); err = -ENOMEM; @@ -645,7 +645,7 @@ static int vme_user_probe(struct vme_dev *vdev) image[i].size_buf = PCI_BUF_SIZE; image[i].kern_buf = vme_alloc_consistent(image[i].resource, image[i].size_buf, &image[i].pci_buf); - if (image[i].kern_buf == NULL) { + if (!image[i].kern_buf) { dev_warn(&vdev->dev, "Unable to allocate memory for buffer\n"); image[i].pci_buf = 0; @@ -663,7 +663,7 @@ static int vme_user_probe(struct vme_dev *vdev) /* XXX Need to properly request attributes */ image[i].resource = vme_master_request(vme_user_bridge, VME_A32, VME_SCT, VME_D32); - if (image[i].resource == NULL) { + if (!image[i].resource) { dev_warn(&vdev->dev, "Unable to allocate master resource\n"); err = -ENOMEM; @@ -671,7 +671,7 @@ static int vme_user_probe(struct vme_dev *vdev) } image[i].size_buf = PCI_BUF_SIZE; image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL); - if (image[i].kern_buf == NULL) { + if (!image[i].kern_buf) { err = -ENOMEM; vme_master_free(image[i].resource); goto err_master; From 1f0622de0d1fb7de187c7cf729971d56def7814e Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:39 +0300 Subject: [PATCH 243/912] staging: vme_user: fix kmalloc style Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 2ff15f081776..3467cde5ac6c 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -526,7 +526,7 @@ static int vme_user_master_mmap(unsigned int minor, struct vm_area_struct *vma) return err; } - vma_priv = kmalloc(sizeof(struct vme_user_vma_priv), GFP_KERNEL); + vma_priv = kmalloc(sizeof(*vma_priv), GFP_KERNEL); if (!vma_priv) { mutex_unlock(&image[minor].mutex); return -ENOMEM; From 8e4d138cc083bb960271e79832982e982c35d219 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:40 +0300 Subject: [PATCH 244/912] staging: vme_user: allow large read()/write() This changes large master transfers to do shorter read/write rather than return -EINVAL. User space will now be able to optimistically request a large transfer and get at least some data. This also removes comments suggesting on how to implement large transfers. Current vme_master_* read and write implementations use CPU copies that don't produce burst PCI accesses and subsequently no block transfer on VME bus. In the end overall performance is quiet low and it can't be fixed by doing direct copy to user space. Much easier solution would be to just reuse kernel buffer. Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 69 ++++++++------------------ 1 file changed, 22 insertions(+), 47 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 3467cde5ac6c..a2345db91e85 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -120,75 +120,50 @@ struct vme_user_vma_priv { atomic_t refcnt; }; -/* - * We are going ot alloc a page during init per window for small transfers. - * Small transfers will go VME -> buffer -> user space. Larger (more than a - * page) transfers will lock the user space buffer into memory and then - * transfer the data directly into the user space buffers. - */ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, loff_t *ppos) { ssize_t retval; ssize_t copied = 0; - if (count <= image[minor].size_buf) { - /* We copy to kernel buffer */ - copied = vme_master_read(image[minor].resource, - image[minor].kern_buf, count, *ppos); - if (copied < 0) - return (int)copied; + if (count > image[minor].size_buf) + count = image[minor].size_buf; - retval = __copy_to_user(buf, image[minor].kern_buf, - (unsigned long)copied); - if (retval != 0) { - copied = (copied - retval); - pr_info("User copy failed\n"); - return -EINVAL; - } + /* We copy to kernel buffer */ + copied = vme_master_read(image[minor].resource, image[minor].kern_buf, + count, *ppos); + if (copied < 0) + return (int)copied; - } else { - /* XXX Need to write this */ - pr_info("Currently don't support large transfers\n"); - /* Map in pages from userspace */ - - /* Call vme_master_read to do the transfer */ + retval = __copy_to_user(buf, image[minor].kern_buf, + (unsigned long)copied); + if (retval != 0) { + copied = (copied - retval); + pr_info("User copy failed\n"); return -EINVAL; } return copied; } -/* - * We are going to alloc a page during init per window for small transfers. - * Small transfers will go user space -> buffer -> VME. Larger (more than a - * page) transfers will lock the user space buffer into memory and then - * transfer the data directly from the user space buffers out to VME. - */ static ssize_t resource_from_user(unsigned int minor, const char __user *buf, size_t count, loff_t *ppos) { ssize_t retval; ssize_t copied = 0; - if (count <= image[minor].size_buf) { - retval = __copy_from_user(image[minor].kern_buf, buf, - (unsigned long)count); - if (retval != 0) - copied = (copied - retval); - else - copied = count; + if (count > image[minor].size_buf) + count = image[minor].size_buf; - copied = vme_master_write(image[minor].resource, - image[minor].kern_buf, copied, *ppos); - } else { - /* XXX Need to write this */ - pr_info("Currently don't support large transfers\n"); - /* Map in pages from userspace */ + retval = __copy_from_user(image[minor].kern_buf, buf, + (unsigned long)count); + if (retval != 0) + copied = (copied - retval); + else + copied = count; - /* Call vme_master_write to do the transfer */ - return -EINVAL; - } + copied = vme_master_write(image[minor].resource, image[minor].kern_buf, + copied, *ppos); return copied; } From 7c78e0cdd0baaea087f342330ec1cc44cf4312e8 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:41 +0300 Subject: [PATCH 245/912] staging: vme_user: switch to returning -EFAULT on __copy_*_user errors Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 47 ++++++-------------------- 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index a2345db91e85..ef876a44e0cf 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -123,7 +123,6 @@ struct vme_user_vma_priv { static ssize_t resource_to_user(int minor, char __user *buf, size_t count, loff_t *ppos) { - ssize_t retval; ssize_t copied = 0; if (count > image[minor].size_buf) @@ -135,13 +134,8 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, if (copied < 0) return (int)copied; - retval = __copy_to_user(buf, image[minor].kern_buf, - (unsigned long)copied); - if (retval != 0) { - copied = (copied - retval); - pr_info("User copy failed\n"); - return -EINVAL; - } + if (__copy_to_user(buf, image[minor].kern_buf, (unsigned long)copied)) + return -EFAULT; return copied; } @@ -149,21 +143,16 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, static ssize_t resource_from_user(unsigned int minor, const char __user *buf, size_t count, loff_t *ppos) { - ssize_t retval; ssize_t copied = 0; if (count > image[minor].size_buf) count = image[minor].size_buf; - retval = __copy_from_user(image[minor].kern_buf, buf, - (unsigned long)count); - if (retval != 0) - copied = (copied - retval); - else - copied = count; + if (__copy_from_user(image[minor].kern_buf, buf, (unsigned long)count)) + return -EFAULT; copied = vme_master_write(image[minor].resource, image[minor].kern_buf, - copied, *ppos); + count, *ppos); return copied; } @@ -172,38 +161,24 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf, size_t count, loff_t *ppos) { void *image_ptr; - ssize_t retval; image_ptr = image[minor].kern_buf + *ppos; + if (__copy_to_user(buf, image_ptr, (unsigned long)count)) + return -EFAULT; - retval = __copy_to_user(buf, image_ptr, (unsigned long)count); - if (retval != 0) { - retval = (count - retval); - pr_warn("Partial copy to userspace\n"); - } else - retval = count; - - /* Return number of bytes successfully read */ - return retval; + return count; } static ssize_t buffer_from_user(unsigned int minor, const char __user *buf, size_t count, loff_t *ppos) { void *image_ptr; - size_t retval; image_ptr = image[minor].kern_buf + *ppos; + if (__copy_from_user(image_ptr, buf, (unsigned long)count)) + return -EFAULT; - retval = __copy_from_user(image_ptr, buf, (unsigned long)count); - if (retval != 0) { - retval = (count - retval); - pr_warn("Partial copy to userspace\n"); - } else - retval = count; - - /* Return number of bytes successfully read */ - return retval; + return count; } static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, From 457ab28619abd1a87eefbb2615bb54ede51e339f Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:42 +0300 Subject: [PATCH 246/912] staging: vme_user: remove unused variable Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index ef876a44e0cf..947a38eb9160 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -143,18 +143,14 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, static ssize_t resource_from_user(unsigned int minor, const char __user *buf, size_t count, loff_t *ppos) { - ssize_t copied = 0; - if (count > image[minor].size_buf) count = image[minor].size_buf; if (__copy_from_user(image[minor].kern_buf, buf, (unsigned long)count)) return -EFAULT; - copied = vme_master_write(image[minor].resource, image[minor].kern_buf, - count, *ppos); - - return copied; + return vme_master_write(image[minor].resource, image[minor].kern_buf, + count, *ppos); } static ssize_t buffer_to_user(unsigned int minor, char __user *buf, From 18f8bee2066a55b7fee478cac0a91d073d3d24a9 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:43 +0300 Subject: [PATCH 247/912] staging: vme_user: remove distracting comment Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 947a38eb9160..7ca943cf1b92 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -128,7 +128,6 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, if (count > image[minor].size_buf) count = image[minor].size_buf; - /* We copy to kernel buffer */ copied = vme_master_read(image[minor].resource, image[minor].kern_buf, count, *ppos); if (copied < 0) From 32491f561bffddfc5c3dee87e439f2ec64a6cf80 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 26 Jun 2015 23:39:44 +0300 Subject: [PATCH 248/912] staging: vme_user: remove okcount variable Signed-off-by: Dmitry Kalinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 7ca943cf1b92..b3e3c2d546a1 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -182,7 +182,6 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, unsigned int minor = MINOR(file_inode(file)->i_rdev); ssize_t retval; size_t image_size; - size_t okcount; if (minor == CONTROL_MINOR) return 0; @@ -200,16 +199,14 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, /* Ensure not reading past end of the image */ if (*ppos + count > image_size) - okcount = image_size - *ppos; - else - okcount = count; + count = image_size - *ppos; switch (type[minor]) { case MASTER_MINOR: - retval = resource_to_user(minor, buf, okcount, ppos); + retval = resource_to_user(minor, buf, count, ppos); break; case SLAVE_MINOR: - retval = buffer_to_user(minor, buf, okcount, ppos); + retval = buffer_to_user(minor, buf, count, ppos); break; default: retval = -EINVAL; @@ -228,7 +225,6 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf, unsigned int minor = MINOR(file_inode(file)->i_rdev); ssize_t retval; size_t image_size; - size_t okcount; if (minor == CONTROL_MINOR) return 0; @@ -245,16 +241,14 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf, /* Ensure not reading past end of the image */ if (*ppos + count > image_size) - okcount = image_size - *ppos; - else - okcount = count; + count = image_size - *ppos; switch (type[minor]) { case MASTER_MINOR: - retval = resource_from_user(minor, buf, okcount, ppos); + retval = resource_from_user(minor, buf, count, ppos); break; case SLAVE_MINOR: - retval = buffer_from_user(minor, buf, okcount, ppos); + retval = buffer_from_user(minor, buf, count, ppos); break; default: retval = -EINVAL; From 78376535c2b9c2d463a801db81fb38dc26c29532 Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:30 -0700 Subject: [PATCH 249/912] staging: sm750fb: use tabs for indentation Replace spaces with tabs for indentation to fix the checkpatch.pl error ERROR: code indent should use tabs where possible WARNING: please, no spaces at the start of a line Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_display.c | 92 +++--- drivers/staging/sm750fb/ddk750_display.h | 2 +- drivers/staging/sm750fb/ddk750_dvi.c | 66 ++--- drivers/staging/sm750fb/ddk750_help.h | 4 +- drivers/staging/sm750fb/ddk750_hwi2c.c | 242 +++++++-------- drivers/staging/sm750fb/ddk750_mode.c | 134 ++++----- drivers/staging/sm750fb/ddk750_mode.h | 40 +-- drivers/staging/sm750fb/ddk750_power.c | 240 +++++++-------- drivers/staging/sm750fb/ddk750_power.h | 8 +- drivers/staging/sm750fb/ddk750_reg.h | 18 +- drivers/staging/sm750fb/ddk750_sii164.c | 356 +++++++++++------------ drivers/staging/sm750fb/ddk750_sii164.h | 28 +- drivers/staging/sm750fb/sm750.h | 26 +- drivers/staging/sm750fb/sm750_accel.c | 338 ++++++++++----------- drivers/staging/sm750fb/sm750_accel.h | 4 +- drivers/staging/sm750fb/sm750_help.h | 26 +- drivers/staging/sm750fb/sm750_hw.h | 28 +- 17 files changed, 826 insertions(+), 826 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index a3e672056ef8..1c4049f5c575 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -24,7 +24,7 @@ static void setDisplayControl(int ctrl, int dispState) /* Timing should be enabled first before enabling the plane * because changing at the same time does not guarantee that * the plane will also enabled or disabled. - */ + */ ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, PANEL_DISPLAY_CTRL, TIMING, ENABLE); POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); @@ -135,8 +135,8 @@ static void waitNextVerticalSync(int ctrl, int delay) if(!ctrl){ /* primary controller */ - /* Do not wait when the Primary PLL is off or display control is already off. - This will prevent the software to wait forever. */ + /* Do not wait when the Primary PLL is off or display control is already off. + This will prevent the software to wait forever. */ if ((FIELD_GET(PEEK32(PANEL_PLL_CTRL), PANEL_PLL_CTRL, POWER) == PANEL_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, TIMING) == @@ -145,26 +145,26 @@ static void waitNextVerticalSync(int ctrl, int delay) return; } - while (delay-- > 0) - { - /* Wait for end of vsync. */ - do - { - status = FIELD_GET(PEEK32(SYSTEM_CTRL), - SYSTEM_CTRL, - PANEL_VSYNC); - } - while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); + while (delay-- > 0) + { + /* Wait for end of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + PANEL_VSYNC); + } + while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); - /* Wait for start of vsync. */ - do - { - status = FIELD_GET(PEEK32(SYSTEM_CTRL), - SYSTEM_CTRL, - PANEL_VSYNC); - } - while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); - } + /* Wait for start of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + PANEL_VSYNC); + } + while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); + } }else{ @@ -275,33 +275,33 @@ void ddk750_setLogicalDispOut(disp_output_t output) int ddk750_initDVIDisp(void) { - /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are - not zeroed, then set the failure flag. If it is zeroe, it might mean - that the system is in Dual CRT Monitor configuration. */ + /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are + not zeroed, then set the failure flag. If it is zeroe, it might mean + that the system is in Dual CRT Monitor configuration. */ - /* De-skew enabled with default 111b value. - This will fix some artifacts problem in some mode on board 2.2. - Somehow this fix does not affect board 2.1. - */ - if ((dviInit(1, /* Select Rising Edge */ - 1, /* Select 24-bit bus */ - 0, /* Select Single Edge clock */ - 1, /* Enable HSync as is */ - 1, /* Enable VSync as is */ - 1, /* Enable De-skew */ - 7, /* Set the de-skew setting to maximum setup */ - 1, /* Enable continuous Sync */ - 1, /* Enable PLL Filter */ - 4 /* Use the recommended value for PLL Filter value */ - ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) - { - return (-1); - } + /* De-skew enabled with default 111b value. + This will fix some artifacts problem in some mode on board 2.2. + Somehow this fix does not affect board 2.1. + */ + if ((dviInit(1, /* Select Rising Edge */ + 1, /* Select 24-bit bus */ + 0, /* Select Single Edge clock */ + 1, /* Enable HSync as is */ + 1, /* Enable VSync as is */ + 1, /* Enable De-skew */ + 7, /* Set the de-skew setting to maximum setup */ + 1, /* Enable continuous Sync */ + 1, /* Enable PLL Filter */ + 4 /* Use the recommended value for PLL Filter value */ + ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) + { + return (-1); + } - /* TODO: Initialize other display component */ + /* TODO: Initialize other display component */ - /* Success */ - return 0; + /* Success */ + return 0; } diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index ae0f84c68de5..018a66184352 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -8,7 +8,7 @@ #define PNL_2_OFFSET 0 #define PNL_2_MASK (3 << PNL_2_OFFSET) #define PNL_2_USAGE (PNL_2_MASK << 16) -#define PNL_2_PRI ((0 << PNL_2_OFFSET)|PNL_2_USAGE) +#define PNL_2_PRI ((0 << PNL_2_OFFSET)|PNL_2_USAGE) #define PNL_2_SEC ((2 << PNL_2_OFFSET)|PNL_2_USAGE) diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index b2bf7e66d5cb..35866fa7a8af 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -12,35 +12,35 @@ static dvi_ctrl_device_t g_dcftSupportedDviController[] = { #ifdef DVI_CTRL_SII164 - { - .pfnInit = sii164InitChip, - .pfnGetVendorId = sii164GetVendorID, - .pfnGetDeviceId = sii164GetDeviceID, + { + .pfnInit = sii164InitChip, + .pfnGetVendorId = sii164GetVendorID, + .pfnGetDeviceId = sii164GetDeviceID, #ifdef SII164_FULL_FUNCTIONS - .pfnResetChip = sii164ResetChip, - .pfnGetChipString = sii164GetChipString, - .pfnSetPower = sii164SetPower, - .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, - .pfnIsConnected = sii164IsConnected, - .pfnCheckInterrupt = sii164CheckInterrupt, - .pfnClearInterrupt = sii164ClearInterrupt, + .pfnResetChip = sii164ResetChip, + .pfnGetChipString = sii164GetChipString, + .pfnSetPower = sii164SetPower, + .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, + .pfnIsConnected = sii164IsConnected, + .pfnCheckInterrupt = sii164CheckInterrupt, + .pfnClearInterrupt = sii164ClearInterrupt, #endif - }, + }, #endif }; int dviInit( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ) { dvi_ctrl_device_t *pCurrentDviCtrl; @@ -48,8 +48,8 @@ int dviInit( if(pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, - vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, - pllFilterEnable, pllFilterValue); + vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, + pllFilterEnable, pllFilterValue); } return -1; /* error */ } @@ -64,13 +64,13 @@ int dviInit( */ unsigned short dviGetVendorID(void) { - dvi_ctrl_device_t *pCurrentDviCtrl; + dvi_ctrl_device_t *pCurrentDviCtrl; - pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) - return pCurrentDviCtrl->pfnGetVendorId(); + pCurrentDviCtrl = g_dcftSupportedDviController; + if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) + return pCurrentDviCtrl->pfnGetVendorId(); - return 0x0000; + return 0x0000; } @@ -83,13 +83,13 @@ unsigned short dviGetVendorID(void) */ unsigned short dviGetDeviceID(void) { - dvi_ctrl_device_t *pCurrentDviCtrl; + dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) - return pCurrentDviCtrl->pfnGetDeviceId(); + if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) + return pCurrentDviCtrl->pfnGetDeviceId(); - return 0x0000; + return 0x0000; } #endif diff --git a/drivers/staging/sm750fb/ddk750_help.h b/drivers/staging/sm750fb/ddk750_help.h index 4285b056585a..3b06aed431bd 100644 --- a/drivers/staging/sm750fb/ddk750_help.h +++ b/drivers/staging/sm750fb/ddk750_help.h @@ -12,8 +12,8 @@ #if 0 /* if 718 big endian turned on,be aware that don't use this driver for general use,only for ppc big-endian */ #warning "big endian on target cpu and enable nature big endian support of 718 capability !" -#define PEEK32(addr) __raw_readl(mmio750 + addr) -#define POKE32(addr, data) __raw_writel(data, mmio750 + addr) +#define PEEK32(addr) __raw_readl(mmio750 + addr) +#define POKE32(addr, data) __raw_writel(data, mmio750 + addr) #else /* software control endianness */ #define PEEK32(addr) readl(addr + mmio750) #define POKE32(addr, data) writel(data, addr + mmio750) diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c index 7826376ed705..7f3b1f931043 100644 --- a/drivers/staging/sm750fb/ddk750_hwi2c.c +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -10,70 +10,70 @@ int hwI2CInit( - unsigned char busSpeedMode +unsigned char busSpeedMode ) { - unsigned int value; + unsigned int value; - /* Enable GPIO 30 & 31 as IIC clock & data */ + /* Enable GPIO 30 & 31 as IIC clock & data */ value = PEEK32(GPIO_MUX); - value = FIELD_SET(value, GPIO_MUX, 30, I2C) | - FIELD_SET(0, GPIO_MUX, 31, I2C); + value = FIELD_SET(value, GPIO_MUX, 30, I2C) | + FIELD_SET(0, GPIO_MUX, 31, I2C); POKE32(GPIO_MUX, value); - /* Enable Hardware I2C power. - TODO: Check if we need to enable GPIO power? - */ - enableI2C(1); + /* Enable Hardware I2C power. + TODO: Check if we need to enable GPIO power? + */ + enableI2C(1); - /* Enable the I2C Controller and set the bus speed mode */ - value = PEEK32(I2C_CTRL); - if (busSpeedMode == 0) - value = FIELD_SET(value, I2C_CTRL, MODE, STANDARD); - else - value = FIELD_SET(value, I2C_CTRL, MODE, FAST); - value = FIELD_SET(value, I2C_CTRL, EN, ENABLE); - POKE32(I2C_CTRL, value); + /* Enable the I2C Controller and set the bus speed mode */ + value = PEEK32(I2C_CTRL); + if (busSpeedMode == 0) + value = FIELD_SET(value, I2C_CTRL, MODE, STANDARD); + else + value = FIELD_SET(value, I2C_CTRL, MODE, FAST); + value = FIELD_SET(value, I2C_CTRL, EN, ENABLE); + POKE32(I2C_CTRL, value); - return 0; + return 0; } void hwI2CClose(void) { - unsigned int value; + unsigned int value; - /* Disable I2C controller */ - value = PEEK32(I2C_CTRL); - value = FIELD_SET(value, I2C_CTRL, EN, DISABLE); - POKE32(I2C_CTRL, value); + /* Disable I2C controller */ + value = PEEK32(I2C_CTRL); + value = FIELD_SET(value, I2C_CTRL, EN, DISABLE); + POKE32(I2C_CTRL, value); - /* Disable I2C Power */ - enableI2C(0); + /* Disable I2C Power */ + enableI2C(0); - /* Set GPIO 30 & 31 back as GPIO pins */ - value = PEEK32(GPIO_MUX); - value = FIELD_SET(value, GPIO_MUX, 30, GPIO); - value = FIELD_SET(value, GPIO_MUX, 31, GPIO); - POKE32(GPIO_MUX, value); + /* Set GPIO 30 & 31 back as GPIO pins */ + value = PEEK32(GPIO_MUX); + value = FIELD_SET(value, GPIO_MUX, 30, GPIO); + value = FIELD_SET(value, GPIO_MUX, 31, GPIO); + POKE32(GPIO_MUX, value); } static long hwI2CWaitTXDone(void) { - unsigned int timeout; + unsigned int timeout; - /* Wait until the transfer is completed. */ - timeout = HWI2C_WAIT_TIMEOUT; + /* Wait until the transfer is completed. */ + timeout = HWI2C_WAIT_TIMEOUT; while ((FIELD_GET(PEEK32(I2C_STATUS), I2C_STATUS, TX) != I2C_STATUS_TX_COMPLETED) && - (timeout != 0)) + (timeout != 0)) timeout--; if (timeout == 0) - return (-1); + return (-1); - return 0; + return 0; } @@ -91,53 +91,53 @@ static long hwI2CWaitTXDone(void) * Total number of bytes those are actually written. */ static unsigned int hwI2CWriteData( - unsigned char deviceAddress, - unsigned int length, - unsigned char *pBuffer + unsigned char deviceAddress, + unsigned int length, + unsigned char *pBuffer ) { - unsigned char count, i; - unsigned int totalBytes = 0; + unsigned char count, i; + unsigned int totalBytes = 0; - /* Set the Device Address */ - POKE32(I2C_SLAVE_ADDRESS, deviceAddress & ~0x01); + /* Set the Device Address */ + POKE32(I2C_SLAVE_ADDRESS, deviceAddress & ~0x01); - /* Write data. - * Note: - * Only 16 byte can be accessed per i2c start instruction. - */ - do - { - /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ - POKE32(I2C_RESET, 0); + /* Write data. + * Note: + * Only 16 byte can be accessed per i2c start instruction. + */ + do + { + /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ + POKE32(I2C_RESET, 0); - /* Set the number of bytes to be written */ - if (length < MAX_HWI2C_FIFO) - count = length - 1; - else - count = MAX_HWI2C_FIFO - 1; - POKE32(I2C_BYTE_COUNT, count); + /* Set the number of bytes to be written */ + if (length < MAX_HWI2C_FIFO) + count = length - 1; + else + count = MAX_HWI2C_FIFO - 1; + POKE32(I2C_BYTE_COUNT, count); - /* Move the data to the I2C data register */ - for (i = 0; i <= count; i++) - POKE32(I2C_DATA0 + i, *pBuffer++); + /* Move the data to the I2C data register */ + for (i = 0; i <= count; i++) + POKE32(I2C_DATA0 + i, *pBuffer++); - /* Start the I2C */ - POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); + /* Start the I2C */ + POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); - /* Wait until the transfer is completed. */ - if (hwI2CWaitTXDone() != 0) - break; + /* Wait until the transfer is completed. */ + if (hwI2CWaitTXDone() != 0) + break; - /* Substract length */ - length -= (count + 1); + /* Substract length */ + length -= (count + 1); - /* Total byte written */ - totalBytes += (count + 1); + /* Total byte written */ + totalBytes += (count + 1); - } while (length > 0); + } while (length > 0); - return totalBytes; + return totalBytes; } @@ -158,53 +158,53 @@ static unsigned int hwI2CWriteData( * Total number of actual bytes read from the slave device */ static unsigned int hwI2CReadData( - unsigned char deviceAddress, - unsigned int length, - unsigned char *pBuffer + unsigned char deviceAddress, + unsigned int length, + unsigned char *pBuffer ) { - unsigned char count, i; - unsigned int totalBytes = 0; + unsigned char count, i; + unsigned int totalBytes = 0; - /* Set the Device Address */ - POKE32(I2C_SLAVE_ADDRESS, deviceAddress | 0x01); + /* Set the Device Address */ + POKE32(I2C_SLAVE_ADDRESS, deviceAddress | 0x01); - /* Read data and save them to the buffer. - * Note: - * Only 16 byte can be accessed per i2c start instruction. - */ - do - { - /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ - POKE32(I2C_RESET, 0); + /* Read data and save them to the buffer. + * Note: + * Only 16 byte can be accessed per i2c start instruction. + */ + do + { + /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ + POKE32(I2C_RESET, 0); - /* Set the number of bytes to be read */ - if (length <= MAX_HWI2C_FIFO) - count = length - 1; - else - count = MAX_HWI2C_FIFO - 1; - POKE32(I2C_BYTE_COUNT, count); + /* Set the number of bytes to be read */ + if (length <= MAX_HWI2C_FIFO) + count = length - 1; + else + count = MAX_HWI2C_FIFO - 1; + POKE32(I2C_BYTE_COUNT, count); - /* Start the I2C */ - POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); + /* Start the I2C */ + POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); - /* Wait until transaction done. */ - if (hwI2CWaitTXDone() != 0) - break; + /* Wait until transaction done. */ + if (hwI2CWaitTXDone() != 0) + break; - /* Save the data to the given buffer */ - for (i = 0; i <= count; i++) - *pBuffer++ = PEEK32(I2C_DATA0 + i); + /* Save the data to the given buffer */ + for (i = 0; i <= count; i++) + *pBuffer++ = PEEK32(I2C_DATA0 + i); - /* Substract length by 16 */ - length -= (count + 1); + /* Substract length by 16 */ + length -= (count + 1); - /* Number of bytes read. */ - totalBytes += (count + 1); + /* Number of bytes read. */ + totalBytes += (count + 1); - } while (length > 0); + } while (length > 0); - return totalBytes; + return totalBytes; } @@ -222,16 +222,16 @@ static unsigned int hwI2CReadData( * Register value */ unsigned char hwI2CReadReg( - unsigned char deviceAddress, - unsigned char registerIndex + unsigned char deviceAddress, + unsigned char registerIndex ) { - unsigned char value = (0xFF); + unsigned char value = (0xFF); - if (hwI2CWriteData(deviceAddress, 1, ®isterIndex) == 1) - hwI2CReadData(deviceAddress, 1, &value); + if (hwI2CWriteData(deviceAddress, 1, ®isterIndex) == 1) + hwI2CReadData(deviceAddress, 1, &value); - return value; + return value; } @@ -252,19 +252,19 @@ unsigned char hwI2CReadReg( * -1 - Fail */ int hwI2CWriteReg( - unsigned char deviceAddress, - unsigned char registerIndex, - unsigned char data + unsigned char deviceAddress, + unsigned char registerIndex, + unsigned char data ) { - unsigned char value[2]; + unsigned char value[2]; - value[0] = registerIndex; - value[1] = data; - if (hwI2CWriteData(deviceAddress, 2, value) == 2) - return 0; + value[0] = registerIndex; + value[1] = data; + if (hwI2CWriteData(deviceAddress, 2, value) == 2) + return 0; - return (-1); + return (-1); } diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 74313ff84e45..1f93d07377fc 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -20,54 +20,54 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, x = pModeParam->horizontal_display_end; y = pModeParam->vertical_display_end; - /* SM750LE has to set up the top-left and bottom-right - registers as well. - Note that normal SM750/SM718 only use those two register for - auto-centering mode. - */ - POKE32(CRT_AUTO_CENTERING_TL, - FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, TOP, 0) - | FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, LEFT, 0)); + /* SM750LE has to set up the top-left and bottom-right + registers as well. + Note that normal SM750/SM718 only use those two register for + auto-centering mode. + */ + POKE32(CRT_AUTO_CENTERING_TL, + FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, TOP, 0) + | FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, LEFT, 0)); - POKE32(CRT_AUTO_CENTERING_BR, - FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, BOTTOM, y-1) - | FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, RIGHT, x-1)); + POKE32(CRT_AUTO_CENTERING_BR, + FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, BOTTOM, y-1) + | FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, RIGHT, x-1)); - /* Assume common fields in dispControl have been properly set before - calling this function. - This function only sets the extra fields in dispControl. - */ + /* Assume common fields in dispControl have been properly set before + calling this function. + This function only sets the extra fields in dispControl. + */ /* Clear bit 29:27 of display control register */ - dispControl &= FIELD_CLEAR(CRT_DISPLAY_CTRL, CLK); + dispControl &= FIELD_CLEAR(CRT_DISPLAY_CTRL, CLK); /* Set bit 29:27 of display control register for the right clock */ /* Note that SM750LE only need to supported 7 resoluitons. */ if ( x == 800 && y == 600 ) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); else if (x == 1024 && y == 768) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); else if (x == 1152 && y == 864) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); else if (x == 1280 && y == 768) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); else if (x == 1280 && y == 720) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL74); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL74); else if (x == 1280 && y == 960) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); else if (x == 1280 && y == 1024) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); else /* default to VGA clock */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL25); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL25); /* Set bit 25:24 of display controller */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CRTSELECT, CRT); - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, RGBBIT, 24BIT); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CRTSELECT, CRT); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, RGBBIT, 24BIT); - /* Set bit 14 of display controller */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLOCK_PHASE, ACTIVE_LOW); + /* Set bit 14 of display controller */ + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLOCK_PHASE, ACTIVE_LOW); - POKE32(CRT_DISPLAY_CTRL, dispControl); + POKE32(CRT_DISPLAY_CTRL, dispControl); return dispControl; } @@ -84,21 +84,21 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); - POKE32(CRT_HORIZONTAL_TOTAL, - FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) - | FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); + POKE32(CRT_HORIZONTAL_TOTAL, + FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) + | FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); - POKE32(CRT_HORIZONTAL_SYNC, - FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) - | FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); + POKE32(CRT_HORIZONTAL_SYNC, + FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) + | FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); - POKE32(CRT_VERTICAL_TOTAL, - FIELD_VALUE(0, CRT_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) - | FIELD_VALUE(0, CRT_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); + POKE32(CRT_VERTICAL_TOTAL, + FIELD_VALUE(0, CRT_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) + | FIELD_VALUE(0, CRT_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); - POKE32(CRT_VERTICAL_SYNC, - FIELD_VALUE(0, CRT_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) - | FIELD_VALUE(0, CRT_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); + POKE32(CRT_VERTICAL_SYNC, + FIELD_VALUE(0, CRT_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) + | FIELD_VALUE(0, CRT_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); ulTmpValue = FIELD_VALUE(0, CRT_DISPLAY_CTRL, VSYNC_PHASE, pModeParam->vertical_sync_polarity)| @@ -125,39 +125,39 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); - POKE32(PANEL_HORIZONTAL_TOTAL, - FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) - | FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); + POKE32(PANEL_HORIZONTAL_TOTAL, + FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) + | FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); - POKE32(PANEL_HORIZONTAL_SYNC, - FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) - | FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); + POKE32(PANEL_HORIZONTAL_SYNC, + FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) + | FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); - POKE32(PANEL_VERTICAL_TOTAL, - FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) - | FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); + POKE32(PANEL_VERTICAL_TOTAL, + FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) + | FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); - POKE32(PANEL_VERTICAL_SYNC, - FIELD_VALUE(0, PANEL_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) - | FIELD_VALUE(0, PANEL_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); + POKE32(PANEL_VERTICAL_SYNC, + FIELD_VALUE(0, PANEL_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) + | FIELD_VALUE(0, PANEL_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); ulTmpValue = FIELD_VALUE(0, PANEL_DISPLAY_CTRL, VSYNC_PHASE, pModeParam->vertical_sync_polarity)| - FIELD_VALUE(0, PANEL_DISPLAY_CTRL, HSYNC_PHASE, pModeParam->horizontal_sync_polarity)| - FIELD_VALUE(0, PANEL_DISPLAY_CTRL, CLOCK_PHASE, pModeParam->clock_phase_polarity)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, TIMING, ENABLE)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, PLANE, ENABLE); + FIELD_VALUE(0, PANEL_DISPLAY_CTRL, HSYNC_PHASE, pModeParam->horizontal_sync_polarity)| + FIELD_VALUE(0, PANEL_DISPLAY_CTRL, CLOCK_PHASE, pModeParam->clock_phase_polarity)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, TIMING, ENABLE)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, PLANE, ENABLE); - ulReservedBits = FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | - FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | - FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, VSYNC, ACTIVE_LOW); + ulReservedBits = FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, VSYNC, ACTIVE_LOW); - ulReg = (PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, CLOCK_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, VSYNC_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, HSYNC_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, TIMING) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, PLANE); + ulReg = (PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, CLOCK_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, VSYNC_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, HSYNC_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, TIMING) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, PLANE); /* May a hardware bug or just my test chip (not confirmed). diff --git a/drivers/staging/sm750fb/ddk750_mode.h b/drivers/staging/sm750fb/ddk750_mode.h index 4e8fab3f17e4..3548d671bf97 100644 --- a/drivers/staging/sm750fb/ddk750_mode.h +++ b/drivers/staging/sm750fb/ddk750_mode.h @@ -5,35 +5,35 @@ typedef enum _spolarity_t { - POS = 0, /* positive */ - NEG, /* negative */ + POS = 0, /* positive */ + NEG, /* negative */ } spolarity_t; typedef struct _mode_parameter_t { - /* Horizontal timing. */ - unsigned long horizontal_total; - unsigned long horizontal_display_end; - unsigned long horizontal_sync_start; - unsigned long horizontal_sync_width; - spolarity_t horizontal_sync_polarity; + /* Horizontal timing. */ + unsigned long horizontal_total; + unsigned long horizontal_display_end; + unsigned long horizontal_sync_start; + unsigned long horizontal_sync_width; + spolarity_t horizontal_sync_polarity; - /* Vertical timing. */ - unsigned long vertical_total; - unsigned long vertical_display_end; - unsigned long vertical_sync_start; - unsigned long vertical_sync_height; - spolarity_t vertical_sync_polarity; + /* Vertical timing. */ + unsigned long vertical_total; + unsigned long vertical_display_end; + unsigned long vertical_sync_start; + unsigned long vertical_sync_height; + spolarity_t vertical_sync_polarity; - /* Refresh timing. */ - unsigned long pixel_clock; - unsigned long horizontal_frequency; - unsigned long vertical_frequency; + /* Refresh timing. */ + unsigned long pixel_clock; + unsigned long horizontal_frequency; + unsigned long vertical_frequency; - /* Clock Phase. This clock phase only applies to Panel. */ - spolarity_t clock_phase_polarity; + /* Clock Phase. This clock phase only applies to Panel. */ + spolarity_t clock_phase_polarity; } mode_parameter_t; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 1e5f398aed10..b7a108b46e5c 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -19,7 +19,7 @@ unsigned int getPowerMode(void) { if(getChipType() == SM750LE) return 0; - return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); + return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); } @@ -29,76 +29,76 @@ unsigned int getPowerMode(void) */ void setPowerMode(unsigned int powerMode) { - unsigned int control_value = 0; + unsigned int control_value = 0; - control_value = PEEK32(POWER_MODE_CTRL); + control_value = PEEK32(POWER_MODE_CTRL); if(getChipType() == SM750LE) return; - switch (powerMode) - { - case POWER_MODE_CTRL_MODE_MODE0: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); - break; + switch (powerMode) + { + case POWER_MODE_CTRL_MODE_MODE0: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); + break; - case POWER_MODE_CTRL_MODE_MODE1: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE1); - break; + case POWER_MODE_CTRL_MODE_MODE1: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE1); + break; - case POWER_MODE_CTRL_MODE_SLEEP: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, SLEEP); - break; + case POWER_MODE_CTRL_MODE_SLEEP: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, SLEEP); + break; - default: - break; - } + default: + break; + } - /* Set up other fields in Power Control Register */ - if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) - { - control_value = + /* Set up other fields in Power Control Register */ + if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) + { + control_value = #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | + FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); - } - else - { - control_value = + FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); + } + else + { + control_value = #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | + FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); - } + FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); + } - /* Program new power mode. */ - POKE32(POWER_MODE_CTRL, control_value); + /* Program new power mode. */ + POKE32(POWER_MODE_CTRL, control_value); } void setCurrentGate(unsigned int gate) { - unsigned int gate_reg; - unsigned int mode; + unsigned int gate_reg; + unsigned int mode; - /* Get current power mode. */ - mode = getPowerMode(); + /* Get current power mode. */ + mode = getPowerMode(); - switch (mode) - { - case POWER_MODE_CTRL_MODE_MODE0: - gate_reg = MODE0_GATE; - break; + switch (mode) + { + case POWER_MODE_CTRL_MODE_MODE0: + gate_reg = MODE0_GATE; + break; - case POWER_MODE_CTRL_MODE_MODE1: - gate_reg = MODE1_GATE; - break; + case POWER_MODE_CTRL_MODE_MODE1: + gate_reg = MODE1_GATE; + break; - default: - gate_reg = MODE0_GATE; - break; - } - POKE32(gate_reg, gate); + default: + gate_reg = MODE0_GATE; + break; + } + POKE32(gate_reg, gate); } @@ -108,21 +108,21 @@ void setCurrentGate(unsigned int gate) */ void enable2DEngine(unsigned int enable) { - uint32_t gate; + uint32_t gate; - gate = PEEK32(CURRENT_GATE); - if (enable) - { - gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); - gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); - } - else - { - gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); - gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); - } + gate = PEEK32(CURRENT_GATE); + if (enable) + { + gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); + gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); + } + else + { + gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); + gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); + } - setCurrentGate(gate); + setCurrentGate(gate); } @@ -131,58 +131,58 @@ void enable2DEngine(unsigned int enable) */ void enableZVPort(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable ZV Port Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - { - gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); + /* Enable ZV Port Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + { + gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); #if 1 - /* Using Software I2C */ - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); + /* Using Software I2C */ + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); #else - /* Using Hardware I2C */ - gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); + /* Using Hardware I2C */ + gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); #endif - } - else - { - /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used - or not. Therefore, do not disable the GPIO gate. */ - gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); - } + } + else + { + /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used + or not. Therefore, do not disable the GPIO gate. */ + gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); + } - setCurrentGate(gate); + setCurrentGate(gate); } void enableSSP(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable SSP Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, SSP, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, SSP, OFF); + /* Enable SSP Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, SSP, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, SSP, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } void enableDMA(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable DMA Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, DMA, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, DMA, OFF); + /* Enable DMA Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, DMA, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, DMA, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -190,16 +190,16 @@ void enableDMA(unsigned int enable) */ void enableGPIO(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable GPIO Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, OFF); + /* Enable GPIO Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -207,16 +207,16 @@ void enableGPIO(unsigned int enable) */ void enablePWM(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable PWM Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, PWM, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, PWM, OFF); + /* Enable PWM Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, PWM, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, PWM, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -224,16 +224,16 @@ void enablePWM(unsigned int enable) */ void enableI2C(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable I2C Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, I2C, OFF); + /* Enable I2C Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, I2C, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h index 4e00955a07dd..a20d43863c33 100644 --- a/drivers/staging/sm750fb/ddk750_power.h +++ b/drivers/staging/sm750fb/ddk750_power.h @@ -3,10 +3,10 @@ typedef enum _DPMS_t { - crtDPMS_ON = 0x0, - crtDPMS_STANDBY = 0x1, - crtDPMS_SUSPEND = 0x2, - crtDPMS_OFF = 0x3, + crtDPMS_ON = 0x0, + crtDPMS_STANDBY = 0x1, + crtDPMS_SUSPEND = 0x2, + crtDPMS_OFF = 0x3, } DPMS_t; diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h index 1a40dc2a2f75..2995625c3d62 100644 --- a/drivers/staging/sm750fb/ddk750_reg.h +++ b/drivers/staging/sm750fb/ddk750_reg.h @@ -1640,9 +1640,9 @@ /* CRT Graphics Control */ #define CRT_DISPLAY_CTRL 0x080200 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK 31:27 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_DISABLE 0 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_ENABLE 0x1F +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK 31:27 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_ENABLE 0x1F /* SM750LE definition */ #define CRT_DISPLAY_CTRL_DPMS 31:30 @@ -1664,9 +1664,9 @@ #define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC_ENABLE 0 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK 25:24 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_ENABLE 3 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK 25:24 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_ENABLE 3 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_DISABLE 0 /* SM750LE definition */ #define CRT_DISPLAY_CTRL_CRTSELECT 25:25 @@ -1677,11 +1677,11 @@ #define CRT_DISPLAY_CTRL_RGBBIT_12BIT 1 -#define CRT_DISPLAY_CTRL_RESERVED_3_MASK 15:15 +#define CRT_DISPLAY_CTRL_RESERVED_3_MASK 15:15 #define CRT_DISPLAY_CTRL_RESERVED_3_MASK_DISABLE 0 #define CRT_DISPLAY_CTRL_RESERVED_3_MASK_ENABLE 1 -#define CRT_DISPLAY_CTRL_RESERVED_4_MASK 9:9 +#define CRT_DISPLAY_CTRL_RESERVED_4_MASK 9:9 #define CRT_DISPLAY_CTRL_RESERVED_4_MASK_DISABLE 0 #define CRT_DISPLAY_CTRL_RESERVED_4_MASK_ENABLE 1 @@ -1882,7 +1882,7 @@ #endif /* sm750le new register to control panel output */ -#define DISPLAY_CONTROL_750LE 0x80288 +#define DISPLAY_CONTROL_750LE 0x80288 /* Palette RAM */ /* Panel Palette register starts at 0x080400 ~ 0x0807FC */ diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index b6395b87fc21..7f58fbecd35f 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -36,12 +36,12 @@ static char *gDviCtrlChipName = "Silicon Image SiI 164"; */ unsigned short sii164GetVendorID(void) { - unsigned short vendorID; + unsigned short vendorID; - vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) | - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW); + vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) | + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW); - return vendorID; + return vendorID; } /* @@ -53,12 +53,12 @@ unsigned short sii164GetVendorID(void) */ unsigned short sii164GetDeviceID(void) { - unsigned short deviceID; + unsigned short deviceID; - deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) | - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW); + deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) | + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW); - return deviceID; + return deviceID; } @@ -113,132 +113,132 @@ unsigned short sii164GetDeviceID(void) * -1 - Fail. */ long sii164InitChip( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ) { unsigned char config; - /* Initialize the i2c bus */ + /* Initialize the i2c bus */ #ifdef USE_HW_I2C - /* Use fast mode. */ - hwI2CInit(1); + /* Use fast mode. */ + hwI2CInit(1); #else - swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA); + swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA); #endif - /* Check if SII164 Chip exists */ - if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) - { - /* - * Initialize SII164 controller chip. - */ + /* Check if SII164 Chip exists */ + if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) + { + /* + * Initialize SII164 controller chip. + */ - /* Select the edge */ - if (edgeSelect == 0) - config = SII164_CONFIGURATION_LATCH_FALLING; - else - config = SII164_CONFIGURATION_LATCH_RISING; + /* Select the edge */ + if (edgeSelect == 0) + config = SII164_CONFIGURATION_LATCH_FALLING; + else + config = SII164_CONFIGURATION_LATCH_RISING; - /* Select bus wide */ - if (busSelect == 0) - config |= SII164_CONFIGURATION_BUS_12BITS; - else - config |= SII164_CONFIGURATION_BUS_24BITS; + /* Select bus wide */ + if (busSelect == 0) + config |= SII164_CONFIGURATION_BUS_12BITS; + else + config |= SII164_CONFIGURATION_BUS_24BITS; - /* Select Dual/Single Edge Clock */ - if (dualEdgeClkSelect == 0) - config |= SII164_CONFIGURATION_CLOCK_SINGLE; - else - config |= SII164_CONFIGURATION_CLOCK_DUAL; + /* Select Dual/Single Edge Clock */ + if (dualEdgeClkSelect == 0) + config |= SII164_CONFIGURATION_CLOCK_SINGLE; + else + config |= SII164_CONFIGURATION_CLOCK_DUAL; - /* Select HSync Enable */ - if (hsyncEnable == 0) - config |= SII164_CONFIGURATION_HSYNC_FORCE_LOW; - else - config |= SII164_CONFIGURATION_HSYNC_AS_IS; + /* Select HSync Enable */ + if (hsyncEnable == 0) + config |= SII164_CONFIGURATION_HSYNC_FORCE_LOW; + else + config |= SII164_CONFIGURATION_HSYNC_AS_IS; - /* Select VSync Enable */ - if (vsyncEnable == 0) - config |= SII164_CONFIGURATION_VSYNC_FORCE_LOW; - else - config |= SII164_CONFIGURATION_VSYNC_AS_IS; + /* Select VSync Enable */ + if (vsyncEnable == 0) + config |= SII164_CONFIGURATION_VSYNC_FORCE_LOW; + else + config |= SII164_CONFIGURATION_VSYNC_AS_IS; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - /* De-skew enabled with default 111b value. - This will fix some artifacts problem in some mode on board 2.2. - Somehow this fix does not affect board 2.1. - */ - if (deskewEnable == 0) - config = SII164_DESKEW_DISABLE; - else - config = SII164_DESKEW_ENABLE; + /* De-skew enabled with default 111b value. + This will fix some artifacts problem in some mode on board 2.2. + Somehow this fix does not affect board 2.1. + */ + if (deskewEnable == 0) + config = SII164_DESKEW_DISABLE; + else + config = SII164_DESKEW_ENABLE; - switch (deskewSetting) - { - case 0: - config |= SII164_DESKEW_1_STEP; - break; - case 1: - config |= SII164_DESKEW_2_STEP; - break; - case 2: - config |= SII164_DESKEW_3_STEP; - break; - case 3: - config |= SII164_DESKEW_4_STEP; - break; - case 4: - config |= SII164_DESKEW_5_STEP; - break; - case 5: - config |= SII164_DESKEW_6_STEP; - break; - case 6: - config |= SII164_DESKEW_7_STEP; - break; - case 7: - config |= SII164_DESKEW_8_STEP; - break; - } - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); + switch (deskewSetting) + { + case 0: + config |= SII164_DESKEW_1_STEP; + break; + case 1: + config |= SII164_DESKEW_2_STEP; + break; + case 2: + config |= SII164_DESKEW_3_STEP; + break; + case 3: + config |= SII164_DESKEW_4_STEP; + break; + case 4: + config |= SII164_DESKEW_5_STEP; + break; + case 5: + config |= SII164_DESKEW_6_STEP; + break; + case 6: + config |= SII164_DESKEW_7_STEP; + break; + case 7: + config |= SII164_DESKEW_8_STEP; + break; + } + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); - /* Enable/Disable Continuous Sync. */ - if (continuousSyncEnable == 0) - config = SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE; - else - config = SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE; + /* Enable/Disable Continuous Sync. */ + if (continuousSyncEnable == 0) + config = SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE; + else + config = SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE; - /* Enable/Disable PLL Filter */ - if (pllFilterEnable == 0) - config |= SII164_PLL_FILTER_DISABLE; - else - config |= SII164_PLL_FILTER_ENABLE; + /* Enable/Disable PLL Filter */ + if (pllFilterEnable == 0) + config |= SII164_PLL_FILTER_DISABLE; + else + config |= SII164_PLL_FILTER_ENABLE; - /* Set the PLL Filter value */ - config |= ((pllFilterValue & 0x07) << 1); + /* Set the PLL Filter value */ + config |= ((pllFilterValue & 0x07) << 1); - i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); + i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); - /* Recover from Power Down and enable output. */ - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - config |= SII164_CONFIGURATION_POWER_NORMAL; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + /* Recover from Power Down and enable output. */ + config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + config |= SII164_CONFIGURATION_POWER_NORMAL; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - return 0; - } + return 0; + } - /* Return -1 if initialization fails. */ - return (-1); + /* Return -1 if initialization fails. */ + return (-1); } @@ -255,9 +255,9 @@ long sii164InitChip( */ void sii164ResetChip(void) { - /* Power down */ - sii164SetPower(0); - sii164SetPower(1); + /* Power down */ + sii164SetPower(0); + sii164SetPower(1); } @@ -268,7 +268,7 @@ void sii164ResetChip(void) */ char *sii164GetChipString(void) { - return gDviCtrlChipName; + return gDviCtrlChipName; } @@ -280,26 +280,26 @@ char *sii164GetChipString(void) * powerUp - Flag to set the power down or up */ void sii164SetPower( - unsigned char powerUp + unsigned char powerUp ) { - unsigned char config; + unsigned char config; - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - if (powerUp == 1) - { - /* Power up the chip */ - config &= ~SII164_CONFIGURATION_POWER_MASK; - config |= SII164_CONFIGURATION_POWER_NORMAL; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } - else - { - /* Power down the chip */ - config &= ~SII164_CONFIGURATION_POWER_MASK; - config |= SII164_CONFIGURATION_POWER_DOWN; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } + config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + if (powerUp == 1) + { + /* Power up the chip */ + config &= ~SII164_CONFIGURATION_POWER_MASK; + config |= SII164_CONFIGURATION_POWER_NORMAL; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + } + else + { + /* Power down the chip */ + config &= ~SII164_CONFIGURATION_POWER_MASK; + config |= SII164_CONFIGURATION_POWER_DOWN; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + } } @@ -308,31 +308,31 @@ void sii164SetPower( * This function selects the mode of the hot plug detection. */ static void sii164SelectHotPlugDetectionMode( - sii164_hot_plug_mode_t hotPlugMode + sii164_hot_plug_mode_t hotPlugMode ) { - unsigned char detectReg; + unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; - switch (hotPlugMode) - { - case SII164_HOTPLUG_DISABLE: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; - break; - case SII164_HOTPLUG_USE_MDI: - detectReg &= ~SII164_DETECT_INTERRUPT_MASK; - detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; - break; - case SII164_HOTPLUG_USE_RSEN: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; - break; - case SII164_HOTPLUG_USE_HTPLG: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; - break; - } + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; + switch (hotPlugMode) + { + case SII164_HOTPLUG_DISABLE: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; + break; + case SII164_HOTPLUG_USE_MDI: + detectReg &= ~SII164_DETECT_INTERRUPT_MASK; + detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; + break; + case SII164_HOTPLUG_USE_RSEN: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; + break; + case SII164_HOTPLUG_USE_HTPLG: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; + break; + } - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); } /* @@ -342,18 +342,18 @@ static void sii164SelectHotPlugDetectionMode( * enableHotPlug - Enable (=1) / disable (=0) Hot Plug detection */ void sii164EnableHotPlugDetection( - unsigned char enableHotPlug + unsigned char enableHotPlug ) { - unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); + unsigned char detectReg; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); - /* Depending on each DVI controller, need to enable the hot plug based on each - individual chip design. */ - if (enableHotPlug != 0) - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); - else - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); + /* Depending on each DVI controller, need to enable the hot plug based on each + individual chip design. */ + if (enableHotPlug != 0) + sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); + else + sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); } /* @@ -366,13 +366,13 @@ void sii164EnableHotPlugDetection( */ unsigned char sii164IsConnected(void) { - unsigned char hotPlugValue; + unsigned char hotPlugValue; - hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; - if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON) - return 1; - else - return 0; + hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; + if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON) + return 1; + else + return 0; } /* @@ -385,13 +385,13 @@ unsigned char sii164IsConnected(void) */ unsigned char sii164CheckInterrupt(void) { - unsigned char detectReg; + unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; - if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE) - return 1; - else - return 0; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; + if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE) + return 1; + else + return 0; } /* @@ -400,11 +400,11 @@ unsigned char sii164CheckInterrupt(void) */ void sii164ClearInterrupt(void) { - unsigned char detectReg; + unsigned char detectReg; - /* Clear the MDI interrupt */ - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); + /* Clear the MDI interrupt */ + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); } #endif diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h index 2b4c7d3381df..0996a32e8dae 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.h +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -6,25 +6,25 @@ /* Hot Plug detection mode structure */ typedef enum _sii164_hot_plug_mode_t { - SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ - SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ - SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ - SII164_HOTPLUG_USE_HTPLG /* Use Hot Plug detect bit. */ + SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ + SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ + SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ + SII164_HOTPLUG_USE_HTPLG /* Use Hot Plug detect bit. */ } sii164_hot_plug_mode_t; /* Silicon Image SiI164 chip prototype */ long sii164InitChip( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ); unsigned short sii164GetVendorID(void); diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index cc80580bc823..71e9a7a3aabb 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -5,7 +5,7 @@ #define FB_ACCEL_SMI 0xab /* please use revision id to distinguish sm750le and sm750*/ -#define SPC_SM750 0 +#define SPC_SM750 0 #define MB(x) ((x)<<20) #define MHZ(x) ((x) * 1000000) @@ -38,8 +38,8 @@ struct lynx_accel{ }; -/* lynx_share stands for a presentation of two frame buffer - that use one smi adaptor , it is similar to a basic class of C++ +/* lynx_share stands for a presentation of two frame buffer + that use one smi adaptor , it is similar to a basic class of C++ */ struct lynx_share{ /* common members */ @@ -115,7 +115,7 @@ struct lynxfb_crtc{ int(*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); int(*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); void (*clear)(struct lynxfb_crtc*); - /* pan display */ + /* pan display */ int (*proc_panDisplay)(struct lynxfb_crtc *, const struct fb_var_screeninfo *, const struct fb_info *); @@ -126,17 +126,17 @@ struct lynxfb_crtc{ struct lynxfb_output{ int dpms; int paths; - /* which paths(s) this output stands for,for sm750: - paths=1:means output for panel paths - paths=2:means output for crt paths - paths=3:means output for both panel and crt paths + /* which paths(s) this output stands for,for sm750: + paths=1:means output for panel paths + paths=2:means output for crt paths + paths=3:means output for both panel and crt paths */ int *channel; - /* which channel these outputs linked with,for sm750: - *channel=0 means primary channel - *channel=1 means secondary channel - output->channel ==> &crtc->channel + /* which channel these outputs linked with,for sm750: + *channel=0 means primary channel + *channel=1 means secondary channel + output->channel ==> &crtc->channel */ void *priv; @@ -165,7 +165,7 @@ struct lynxfb_par{ #define PS_TO_HZ(ps) \ - ({ \ + ({ \ unsigned long long hz = 1000*1000*1000*1000ULL; \ do_div(hz, ps); \ (unsigned long)hz;}) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 8ea3a61ba37c..64d0458190c8 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -151,97 +151,97 @@ unsigned int width, unsigned int height, /* width and height of rectangle in pixel value */ unsigned int rop2) /* ROP value */ { - unsigned int nDirection, de_ctrl; - int opSign; - nDirection = LEFT_TO_RIGHT; + unsigned int nDirection, de_ctrl; + int opSign; + nDirection = LEFT_TO_RIGHT; /* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ - opSign = 1; - de_ctrl = 0; + opSign = 1; + de_ctrl = 0; - /* If source and destination are the same surface, need to check for overlay cases */ - if (sBase == dBase && sPitch == dPitch) - { - /* Determine direction of operation */ - if (sy < dy) - { - /* +----------+ - |S | - | +----------+ - | | | | - | | | | - +---|------+ | - | D| - +----------+ */ + /* If source and destination are the same surface, need to check for overlay cases */ + if (sBase == dBase && sPitch == dPitch) + { + /* Determine direction of operation */ + if (sy < dy) + { + /* +----------+ + |S | + | +----------+ + | | | | + | | | | + +---|------+ | + | D| + +----------+ */ - nDirection = BOTTOM_TO_TOP; - } - else if (sy > dy) - { - /* +----------+ - |D | - | +----------+ - | | | | - | | | | - +---|------+ | - | S| - +----------+ */ + nDirection = BOTTOM_TO_TOP; + } + else if (sy > dy) + { + /* +----------+ + |D | + | +----------+ + | | | | + | | | | + +---|------+ | + | S| + +----------+ */ - nDirection = TOP_TO_BOTTOM; - } - else - { - /* sy == dy */ + nDirection = TOP_TO_BOTTOM; + } + else + { + /* sy == dy */ - if (sx <= dx) - { - /* +------+---+------+ - |S | | D| - | | | | - | | | | - | | | | - +------+---+------+ */ + if (sx <= dx) + { + /* +------+---+------+ + |S | | D| + | | | | + | | | | + | | | | + +------+---+------+ */ - nDirection = RIGHT_TO_LEFT; - } - else - { - /* sx > dx */ + nDirection = RIGHT_TO_LEFT; + } + else + { + /* sx > dx */ - /* +------+---+------+ - |D | | S| - | | | | - | | | | - | | | | - +------+---+------+ */ + /* +------+---+------+ + |D | | S| + | | | | + | | | | + | | | | + +------+---+------+ */ - nDirection = LEFT_TO_RIGHT; - } - } - } + nDirection = LEFT_TO_RIGHT; + } + } + } - if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) - { - sx += width - 1; - sy += height - 1; - dx += width - 1; - dy += height - 1; - opSign = (-1); - } + if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) + { + sx += width - 1; + sy += height - 1; + dx += width - 1; + dy += height - 1; + opSign = (-1); + } - /* Note: - DE_FOREGROUND are DE_BACKGROUND are don't care. - DE_COLOR_COMPARE and DE_COLOR_COMPARE_MAKS are set by set deSetTransparency(). - */ + /* Note: + DE_FOREGROUND are DE_BACKGROUND are don't care. + DE_COLOR_COMPARE and DE_COLOR_COMPARE_MAKS are set by set deSetTransparency(). + */ - /* 2D Source Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */ + /* 2D Source Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */ - /* 2D Destination Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */ + /* 2D Destination Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */ #if 0 /* Program pitch (distance between the 1st points of two adjacent lines). @@ -267,54 +267,54 @@ unsigned int rop2) /* ROP value */ /* Screen Window width in Pixels. 2D engine uses this value to calculate the linear address in frame buffer for a given point. */ - write_dpr(accel, DE_WINDOW_WIDTH, - FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | - FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ + write_dpr(accel, DE_WINDOW_WIDTH, + FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | + FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ if (accel->de_wait() != 0){ return -1; } - { + { - write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | - FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | - FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ - write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | - FIELD_VALUE(0, DE_DESTINATION, X, dx) | - FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ - write_dpr(accel, DE_DIMENSION, - FIELD_VALUE(0, DE_DIMENSION, X, width) | - FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ + write_dpr(accel, DE_SOURCE, + FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | + FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ + write_dpr(accel, DE_DESTINATION, + FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_VALUE(0, DE_DESTINATION, X, dx) | + FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ + write_dpr(accel, DE_DIMENSION, + FIELD_VALUE(0, DE_DIMENSION, X, width) | + FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ - de_ctrl = - FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | - FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | - FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) | - ((nDirection == RIGHT_TO_LEFT) ? - FIELD_SET(0, DE_CONTROL, DIRECTION, RIGHT_TO_LEFT) - : FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT)) | - FIELD_SET(0, DE_CONTROL, STATUS, START); - write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */ - } + de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | + FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | + FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) | + ((nDirection == RIGHT_TO_LEFT) ? + FIELD_SET(0, DE_CONTROL, DIRECTION, RIGHT_TO_LEFT) + : FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT)) | + FIELD_SET(0, DE_CONTROL, STATUS, START); + write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */ - return 0; + } + + return 0; } static unsigned int deGetTransparency(struct lynx_accel *accel) { - unsigned int de_ctrl; + unsigned int de_ctrl; - de_ctrl = read_dpr(accel, DE_CONTROL); + de_ctrl = read_dpr(accel, DE_CONTROL); - de_ctrl &= - FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) | - FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT)| - FIELD_MASK(DE_CONTROL_TRANSPARENCY); + de_ctrl &= + FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) | + FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT)| + FIELD_MASK(DE_CONTROL_TRANSPARENCY); - return de_ctrl; + return de_ctrl; } int hw_imageblit(struct lynx_accel *accel, @@ -332,32 +332,32 @@ int hw_imageblit(struct lynx_accel *accel, u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */ u32 rop2) /* ROP value */ { - unsigned int ulBytesPerScan; - unsigned int ul4BytesPerScan; - unsigned int ulBytesRemain; - unsigned int de_ctrl = 0; - unsigned char ajRemain[4]; - int i, j; + unsigned int ulBytesPerScan; + unsigned int ul4BytesPerScan; + unsigned int ulBytesRemain; + unsigned int de_ctrl = 0; + unsigned char ajRemain[4]; + int i, j; - startBit &= 7; /* Just make sure the start bit is within legal range */ - ulBytesPerScan = (width + startBit + 7) / 8; - ul4BytesPerScan = ulBytesPerScan & ~3; - ulBytesRemain = ulBytesPerScan & 3; + startBit &= 7; /* Just make sure the start bit is within legal range */ + ulBytesPerScan = (width + startBit + 7) / 8; + ul4BytesPerScan = ulBytesPerScan & ~3; + ulBytesRemain = ulBytesPerScan & 3; if(accel->de_wait() != 0) - { - return -1; - } + { + return -1; + } - /* 2D Source Base. - Use 0 for HOST Blt. - */ - write_dpr(accel, DE_WINDOW_SOURCE_BASE, 0); + /* 2D Source Base. + Use 0 for HOST Blt. + */ + write_dpr(accel, DE_WINDOW_SOURCE_BASE, 0); - /* 2D Destination Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); + /* 2D Destination Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); #if 0 /* Program pitch (distance between the 1st points of two adjacent lines). Note that input pitch is BYTE value, but the 2D Pitch register uses @@ -380,30 +380,30 @@ int hw_imageblit(struct lynx_accel *accel, FIELD_VALUE(0, DE_PITCH, SOURCE, dPitch/bytePerPixel)); /* dpr10 */ } - /* Screen Window width in Pixels. - 2D engine uses this value to calculate the linear address in frame buffer for a given point. - */ - write_dpr(accel, DE_WINDOW_WIDTH, - FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/bytePerPixel)) | - FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (dPitch/bytePerPixel))); + /* Screen Window width in Pixels. + 2D engine uses this value to calculate the linear address in frame buffer for a given point. + */ + write_dpr(accel, DE_WINDOW_WIDTH, + FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/bytePerPixel)) | + FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (dPitch/bytePerPixel))); - /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. - For mono bitmap, use startBit for X_K1. */ - write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | - FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ + /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. + For mono bitmap, use startBit for X_K1. */ + write_dpr(accel, DE_SOURCE, + FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ - write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | - FIELD_VALUE(0, DE_DESTINATION, X, dx) | - FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ + write_dpr(accel, DE_DESTINATION, + FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_VALUE(0, DE_DESTINATION, X, dx) | + FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ - write_dpr(accel, DE_DIMENSION, - FIELD_VALUE(0, DE_DIMENSION, X, width) | - FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ + write_dpr(accel, DE_DIMENSION, + FIELD_VALUE(0, DE_DIMENSION, X, width) | + FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ - write_dpr(accel, DE_FOREGROUND, fColor); - write_dpr(accel, DE_BACKGROUND, bColor); + write_dpr(accel, DE_FOREGROUND, fColor); + write_dpr(accel, DE_BACKGROUND, bColor); de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | @@ -413,24 +413,24 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); - /* Write MONO data (line by line) to 2D Engine data port */ - for (i=0; i> _LSB(f)) & RAW_MASK(f)) #define TEST_FIELD(d, f, v) (GET_FIELD(d, f) == f ## _ ## v) #define SET_FIELD(d, f, v) (((d) & ~GET_MASK(f)) | \ - (((f ## _ ## v) & RAW_MASK(f)) << _LSB(f))) + (((f ## _ ## v) & RAW_MASK(f)) << _LSB(f))) #define SET_FIELDV(d, f, v) (((d) & ~GET_MASK(f)) | \ - (((v) & RAW_MASK(f)) << _LSB(f))) + (((v) & RAW_MASK(f)) << _LSB(f))) /* Internal macros */ #define _F_START(f) (0 ? f) @@ -26,24 +26,24 @@ /* Global macros */ #define FIELD_GET(x, reg, field) \ ( \ - _F_NORMALIZE((x), reg ## _ ## field) \ + _F_NORMALIZE((x), reg ## _ ## field) \ ) #define FIELD_SET(x, reg, field, value) \ ( \ - (x & ~_F_MASK(reg ## _ ## field)) \ - | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \ + (x & ~_F_MASK(reg ## _ ## field)) \ + | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \ ) #define FIELD_VALUE(x, reg, field, value) \ ( \ - (x & ~_F_MASK(reg ## _ ## field)) \ - | _F_DENORMALIZE(value, reg ## _ ## field) \ + (x & ~_F_MASK(reg ## _ ## field)) \ + | _F_DENORMALIZE(value, reg ## _ ## field) \ ) #define FIELD_CLEAR(reg, field) \ ( \ - ~ _F_MASK(reg ## _ ## field) \ + ~ _F_MASK(reg ## _ ## field) \ ) /* Field Macros */ @@ -55,20 +55,20 @@ #define FIELD_DENORMALIZE(field, value) (((value) << FIELD_START(field)) & FIELD_MASK(field)) #define FIELD_INIT(reg, field, value) FIELD_DENORMALIZE(reg ## _ ## field, \ - reg ## _ ## field ## _ ## value) + reg ## _ ## field ## _ ## value) #define FIELD_INIT_VAL(reg, field, value) \ - (FIELD_DENORMALIZE(reg ## _ ## field, value)) + (FIELD_DENORMALIZE(reg ## _ ## field, value)) #define FIELD_VAL_SET(x, r, f, v) x = x & ~FIELD_MASK(r ## _ ## f) \ - | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) + | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) #define RGB(r, g, b) \ ( \ - (unsigned long) (((r) << 16) | ((g) << 8) | (b)) \ + (unsigned long) (((r) << 16) | ((g) << 8) | (b)) \ ) #define RGB16(r, g, b) \ ( \ - (unsigned short) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3)) \ + (unsigned short) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3)) \ ) static inline unsigned int absDiff(unsigned int a, unsigned int b) diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h index 93288b3a99d8..adc61edf2bac 100644 --- a/drivers/staging/sm750fb/sm750_hw.h +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -2,8 +2,8 @@ #define LYNX_HW750_H__ -#define DEFAULT_SM750_CHIP_CLOCK 290 -#define DEFAULT_SM750LE_CHIP_CLOCK 333 +#define DEFAULT_SM750_CHIP_CLOCK 290 +#define DEFAULT_SM750LE_CHIP_CLOCK 333 #ifndef SM750LE_REVISION_ID #define SM750LE_REVISION_ID (unsigned char)0xfe #endif @@ -24,9 +24,9 @@ enum sm750_dataflow{ sm750_simul_sec,/* secondary => all head */ - sm750_dual_normal,/* primary => panel head and secondary => crt */ + sm750_dual_normal,/* primary => panel head and secondary => crt */ - sm750_dual_swap,/* primary => crt head and secondary => panel */ + sm750_dual_swap,/* primary => crt head and secondary => panel */ }; @@ -61,20 +61,20 @@ struct sm750_state{ int yLCD; }; -/* sm750_share stands for a presentation of two frame buffer - that use one sm750 adaptor, it is similar to the super class of lynx_share - in C++ -*/ +/* sm750_share stands for a presentation of two frame buffer + that use one sm750 adaptor, it is similar to the super class of lynx_share + in C++ + */ struct sm750_share{ /* it's better to put lynx_share struct to the first place of sm750_share */ struct lynx_share share; struct sm750_state state; int hwCursor; - /* 0: no hardware cursor - 1: primary crtc hw cursor enabled, - 2: secondary crtc hw cursor enabled - 3: both ctrc hw cursor enabled + /* 0: no hardware cursor + 1: primary crtc hw cursor enabled, + 2: secondary crtc hw cursor enabled + 3: both ctrc hw cursor enabled */ }; @@ -95,7 +95,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output*, int); void hw_sm750_crtc_clear(struct lynxfb_crtc*); void hw_sm750_output_clear(struct lynxfb_output*); int hw_sm750_pan_display(struct lynxfb_crtc *crtc, - const struct fb_var_screeninfo *var, - const struct fb_info *info); + const struct fb_var_screeninfo *var, + const struct fb_info *info); #endif From 7f0ebcc29082a45bcd3e108b6f65d1190059b36b Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:31 -0700 Subject: [PATCH 250/912] staging: sm750fb: remove spacing after open parenthesis Fixes checkpatch.pl warning: ERROR: space prohibited after that open parenthesis '(' Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 6 +++--- drivers/staging/sm750fb/ddk750_mode.c | 2 +- drivers/staging/sm750fb/ddk750_power.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index f4975d2d97ad..1069a2d3186f 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -599,9 +599,9 @@ unsigned int formatPllReg(pll_value_t *pPLL) On returning a 32 bit number, the value can be applied to any PLL in the calling function. */ ulPllReg = - FIELD_SET( 0, PANEL_PLL_CTRL, BYPASS, OFF) - | FIELD_SET( 0, PANEL_PLL_CTRL, POWER, ON) - | FIELD_SET( 0, PANEL_PLL_CTRL, INPUT, OSC) + FIELD_SET(0, PANEL_PLL_CTRL, BYPASS, OFF) + | FIELD_SET(0, PANEL_PLL_CTRL, POWER, ON) + | FIELD_SET(0, PANEL_PLL_CTRL, INPUT, OSC) #ifndef VALIDATION_CHIP | FIELD_VALUE(0, PANEL_PLL_CTRL, POD, pPLL->POD) #endif diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 1f93d07377fc..31424b2b7635 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -43,7 +43,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, /* Set bit 29:27 of display control register for the right clock */ /* Note that SM750LE only need to supported 7 resoluitons. */ - if ( x == 800 && y == 600 ) + if (x == 800 && y == 600 ) dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); else if (x == 1024 && y == 768) dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index b7a108b46e5c..44b8eb109d27 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -59,17 +59,17 @@ void setPowerMode(unsigned int powerMode) { control_value = #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | + FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); + FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); } else { control_value = #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | + FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, ON) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); + FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, ON); } /* Program new power mode. */ From 8332d94c979bc348398d3f1b2581a59c7d60978a Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:32 -0700 Subject: [PATCH 251/912] staging: sm750fb: remove space before close parenthesis Fixes checkpatch.pl error: ERROR: space prohibited before that close parenthesis ')' Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 2 +- drivers/staging/sm750fb/ddk750_mode.c | 2 +- drivers/staging/sm750fb/sm750_accel.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 1069a2d3186f..fb1c533c0180 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -268,7 +268,7 @@ int ddk750_initHw(initchip_param_t *pInitParam) #endif - if (pInitParam->powerMode != 0 ) + if (pInitParam->powerMode != 0) pInitParam->powerMode = 0; setPowerMode(pInitParam->powerMode); diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 31424b2b7635..4ee9ceb475cb 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -43,7 +43,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, /* Set bit 29:27 of display control register for the right clock */ /* Note that SM750LE only need to supported 7 resoluitons. */ - if (x == 800 && y == 600 ) + if (x == 800 && y == 600) dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); else if (x == 1024 && y == 768) dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 64d0458190c8..10cc0223eae3 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -363,7 +363,7 @@ int hw_imageblit(struct lynx_accel *accel, Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if(bytePerPixel == 3 ){ + if(bytePerPixel == 3){ dx *= 3; width *= 3; startBit *= 3; From 9ccc5f4427c2a69553935c33ca4c4b3f9e80214d Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:33 -0700 Subject: [PATCH 252/912] staging: sm750fb: add space before open parenthesis Fixes checkpatch.pl error: ERROR: space required before the open parenthesis '(' Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_display.c | 20 +++++++-------- drivers/staging/sm750fb/ddk750_dvi.c | 2 +- drivers/staging/sm750fb/ddk750_help.c | 2 +- drivers/staging/sm750fb/ddk750_mode.c | 12 ++++----- drivers/staging/sm750fb/ddk750_power.c | 6 ++--- drivers/staging/sm750fb/sm750_accel.c | 8 +++--- drivers/staging/sm750fb/sm750_cursor.c | 32 ++++++++++++------------ drivers/staging/sm750fb/sm750_help.h | 2 +- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 1c4049f5c575..973dec30c3a0 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -49,7 +49,7 @@ static void setDisplayControl(int ctrl, int dispState) { cnt++; POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); - } while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != + } while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Panel Plane enbit:after tried %d times\n", cnt); } @@ -104,7 +104,7 @@ static void setDisplayControl(int ctrl, int dispState) { cnt++; POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); - } while((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) != + } while ((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) != (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Crt Plane enbit:after tried %d times\n", cnt); } @@ -132,7 +132,7 @@ static void setDisplayControl(int ctrl, int dispState) static void waitNextVerticalSync(int ctrl, int delay) { unsigned int status; - if(!ctrl){ + if (!ctrl){ /* primary controller */ /* Do not wait when the Primary PLL is off or display control is already off. @@ -233,14 +233,14 @@ static void swPanelPowerSequence(int disp, int delay) void ddk750_setLogicalDispOut(disp_output_t output) { unsigned int reg; - if(output & PNL_2_USAGE){ + if (output & PNL_2_USAGE){ /* set panel path controller select */ reg = PEEK32(PANEL_DISPLAY_CTRL); reg = FIELD_VALUE(reg, PANEL_DISPLAY_CTRL, SELECT, (output & PNL_2_MASK)>>PNL_2_OFFSET); POKE32(PANEL_DISPLAY_CTRL, reg); } - if(output & CRT_2_USAGE){ + if (output & CRT_2_USAGE){ /* set crt path controller select */ reg = PEEK32(CRT_DISPLAY_CTRL); reg = FIELD_VALUE(reg, CRT_DISPLAY_CTRL, SELECT, (output & CRT_2_MASK)>>CRT_2_OFFSET); @@ -250,25 +250,25 @@ void ddk750_setLogicalDispOut(disp_output_t output) } - if(output & PRI_TP_USAGE){ + if (output & PRI_TP_USAGE){ /* set primary timing and plane en_bit */ setDisplayControl(0, (output&PRI_TP_MASK)>>PRI_TP_OFFSET); } - if(output & SEC_TP_USAGE){ + if (output & SEC_TP_USAGE){ /* set secondary timing and plane en_bit*/ setDisplayControl(1, (output&SEC_TP_MASK)>>SEC_TP_OFFSET); } - if(output & PNL_SEQ_USAGE){ + if (output & PNL_SEQ_USAGE){ /* set panel sequence */ swPanelPowerSequence((output&PNL_SEQ_MASK)>>PNL_SEQ_OFFSET, 4); } - if(output & DAC_USAGE) + if (output & DAC_USAGE) setDAC((output & DAC_MASK)>>DAC_OFFSET); - if(output & DPMS_USAGE) + if (output & DPMS_USAGE) ddk750_setDPMS((output & DPMS_MASK) >> DPMS_OFFSET); } diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index 35866fa7a8af..4c64436d8255 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -45,7 +45,7 @@ int dviInit( { dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if(pCurrentDviCtrl->pfnInit != NULL) + if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, diff --git a/drivers/staging/sm750fb/ddk750_help.c b/drivers/staging/sm750fb/ddk750_help.c index f027df58fc11..9637dd30d037 100644 --- a/drivers/staging/sm750fb/ddk750_help.c +++ b/drivers/staging/sm750fb/ddk750_help.c @@ -10,7 +10,7 @@ void ddk750_set_mmio(void __iomem *addr, unsigned short devId, char revId) mmio750 = addr; devId750 = devId; revId750 = revId; - if(revId == 0xfe) + if (revId == 0xfe) printk("found sm750le\n"); } diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 4ee9ceb475cb..cfe528c487f1 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -80,7 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; - if(pll->clockType == SECONDARY_PLL) + if (pll->clockType == SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); @@ -107,7 +107,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) FIELD_SET(0, CRT_DISPLAY_CTRL, PLANE, ENABLE); - if(getChipType() == SM750LE){ + if (getChipType() == SM750LE){ displayControlAdjust_SM750LE(pModeParam, ulTmpValue); }else{ ulReg = PEEK32(CRT_DISPLAY_CTRL) @@ -120,7 +120,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) } } - else if(pll->clockType == PRIMARY_PLL) + else if (pll->clockType == PRIMARY_PLL) { unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); @@ -170,10 +170,10 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); #if 1 - while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) + while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) { cnt++; - if(cnt > 1000) + if (cnt > 1000) break; POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); } @@ -193,7 +193,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock) pll.clockType = clock; uiActualPixelClk = calcPllValue(parm->pixel_clock, &pll); - if(getChipType() == SM750LE){ + if (getChipType() == SM750LE){ /* set graphic mode via IO method */ outb_p(0x88, 0x3d4); outb_p(0x06, 0x3d5); diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 44b8eb109d27..a2d9ee611c90 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -5,7 +5,7 @@ void ddk750_setDPMS(DPMS_t state) { unsigned int value; - if(getChipType() == SM750LE){ + if (getChipType() == SM750LE){ value = PEEK32(CRT_DISPLAY_CTRL); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); }else{ @@ -17,7 +17,7 @@ void ddk750_setDPMS(DPMS_t state) unsigned int getPowerMode(void) { - if(getChipType() == SM750LE) + if (getChipType() == SM750LE) return 0; return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); } @@ -33,7 +33,7 @@ void setPowerMode(unsigned int powerMode) control_value = PEEK32(POWER_MODE_CTRL); - if(getChipType() == SM750LE) + if (getChipType() == SM750LE) return; switch (powerMode) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 10cc0223eae3..73d84dea4405 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -96,7 +96,7 @@ int hw_fillrect(struct lynx_accel *accel, { u32 deCtrl; - if(accel->de_wait() != 0) + if (accel->de_wait() != 0) { /* int time wait and always busy,seems hardware * got something error */ @@ -248,7 +248,7 @@ unsigned int rop2) /* ROP value */ Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if(Bpp == 3){ + if (Bpp == 3){ sx *= 3; dx *= 3; width *= 3; @@ -344,7 +344,7 @@ int hw_imageblit(struct lynx_accel *accel, ul4BytesPerScan = ulBytesPerScan & ~3; ulBytesRemain = ulBytesPerScan & 3; - if(accel->de_wait() != 0) + if (accel->de_wait() != 0) { return -1; } @@ -363,7 +363,7 @@ int hw_imageblit(struct lynx_accel *accel, Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if(bytePerPixel == 3){ + if (bytePerPixel == 3){ dx *= 3; width *= 3; startBit *= 3; diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 405e24b6768f..95cfb8fe9a07 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -122,7 +122,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, odd=0; */ - for(i=0;i> j)) + if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); }else{ @@ -149,9 +149,9 @@ void hw_cursor_setData(struct lynx_cursor *cursor, } } #else - for(j=0;j<8;j++){ - if(mask & (0x80>>j)){ - if(rop == ROP_XOR) + for (j=0;j<8;j++){ + if (mask & (0x80>>j)){ + if (rop == ROP_XOR) opr = mask ^ color; else opr = mask & color; @@ -165,9 +165,9 @@ void hw_cursor_setData(struct lynx_cursor *cursor, /* assume pitch is 1,2,4,8,...*/ #if 0 - if(!((i+1)&(pitch-1))) /* below line equal to is line */ + if (!((i+1)&(pitch-1))) /* below line equal to is line */ #else - if((i+1) % pitch == 0) + if ((i+1) % pitch == 0) #endif { /* need a return */ @@ -204,7 +204,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, pstart = cursor->vstart; pbuffer = pstart; - for(i=0;i> j)) + if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); }else{ @@ -229,15 +229,15 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, } } #else - for(j=0;j<8;j++){ - if(mask & (1< Date: Tue, 14 Jul 2015 21:14:34 -0700 Subject: [PATCH 253/912] staging: sm750fb: remove space between function name and parenthesis Fixes checkpatch.pl warning: WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_accel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 73d84dea4405..982cf1e01dae 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -278,11 +278,11 @@ unsigned int rop2) /* ROP value */ { write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) | FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) | FIELD_VALUE(0, DE_DESTINATION, X, dx) | FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ write_dpr(accel, DE_DIMENSION, @@ -390,11 +390,11 @@ int hw_imageblit(struct lynx_accel *accel, /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. For mono bitmap, use startBit for X_K1. */ write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) | FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) | FIELD_VALUE(0, DE_DESTINATION, X, dx) | FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ From 8c11f5a2805bd2c257b706d7499ed531b6c5aa5f Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:35 -0700 Subject: [PATCH 254/912] staging: sm750fb: add space before open brace Fixes checkpatch.pl error: ERROR: space required before the open brace '{' Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_display.c | 14 +++++++------- drivers/staging/sm750fb/ddk750_mode.c | 8 ++++---- drivers/staging/sm750fb/ddk750_power.c | 4 ++-- drivers/staging/sm750fb/sm750_accel.c | 6 +++--- drivers/staging/sm750fb/sm750_cursor.c | 14 +++++++------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 973dec30c3a0..c7171a4299a0 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -132,7 +132,7 @@ static void setDisplayControl(int ctrl, int dispState) static void waitNextVerticalSync(int ctrl, int delay) { unsigned int status; - if (!ctrl){ + if (!ctrl) { /* primary controller */ /* Do not wait when the Primary PLL is off or display control is already off. @@ -166,7 +166,7 @@ static void waitNextVerticalSync(int ctrl, int delay) while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); } - }else{ + }else { /* Do not wait when the Primary PLL is off or display control is already off. This will prevent the software to wait forever. */ @@ -233,14 +233,14 @@ static void swPanelPowerSequence(int disp, int delay) void ddk750_setLogicalDispOut(disp_output_t output) { unsigned int reg; - if (output & PNL_2_USAGE){ + if (output & PNL_2_USAGE) { /* set panel path controller select */ reg = PEEK32(PANEL_DISPLAY_CTRL); reg = FIELD_VALUE(reg, PANEL_DISPLAY_CTRL, SELECT, (output & PNL_2_MASK)>>PNL_2_OFFSET); POKE32(PANEL_DISPLAY_CTRL, reg); } - if (output & CRT_2_USAGE){ + if (output & CRT_2_USAGE) { /* set crt path controller select */ reg = PEEK32(CRT_DISPLAY_CTRL); reg = FIELD_VALUE(reg, CRT_DISPLAY_CTRL, SELECT, (output & CRT_2_MASK)>>CRT_2_OFFSET); @@ -250,17 +250,17 @@ void ddk750_setLogicalDispOut(disp_output_t output) } - if (output & PRI_TP_USAGE){ + if (output & PRI_TP_USAGE) { /* set primary timing and plane en_bit */ setDisplayControl(0, (output&PRI_TP_MASK)>>PRI_TP_OFFSET); } - if (output & SEC_TP_USAGE){ + if (output & SEC_TP_USAGE) { /* set secondary timing and plane en_bit*/ setDisplayControl(1, (output&SEC_TP_MASK)>>SEC_TP_OFFSET); } - if (output & PNL_SEQ_USAGE){ + if (output & PNL_SEQ_USAGE) { /* set panel sequence */ swPanelPowerSequence((output&PNL_SEQ_MASK)>>PNL_SEQ_OFFSET, 4); } diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index cfe528c487f1..efc1fabf60ed 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -107,9 +107,9 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) FIELD_SET(0, CRT_DISPLAY_CTRL, PLANE, ENABLE); - if (getChipType() == SM750LE){ + if (getChipType() == SM750LE) { displayControlAdjust_SM750LE(pModeParam, ulTmpValue); - }else{ + }else { ulReg = PEEK32(CRT_DISPLAY_CTRL) & FIELD_CLEAR(CRT_DISPLAY_CTRL, VSYNC_PHASE) & FIELD_CLEAR(CRT_DISPLAY_CTRL, HSYNC_PHASE) @@ -179,7 +179,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) } #endif } - else{ + else { ret = -1; } return ret; @@ -193,7 +193,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock) pll.clockType = clock; uiActualPixelClk = calcPllValue(parm->pixel_clock, &pll); - if (getChipType() == SM750LE){ + if (getChipType() == SM750LE) { /* set graphic mode via IO method */ outb_p(0x88, 0x3d4); outb_p(0x06, 0x3d5); diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index a2d9ee611c90..e2c0bb328106 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -5,10 +5,10 @@ void ddk750_setDPMS(DPMS_t state) { unsigned int value; - if (getChipType() == SM750LE){ + if (getChipType() == SM750LE) { value = PEEK32(CRT_DISPLAY_CTRL); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); - }else{ + }else { value = PEEK32(SYSTEM_CTRL); value= FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); POKE32(SYSTEM_CTRL, value); diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 982cf1e01dae..afe73e8265d1 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -248,7 +248,7 @@ unsigned int rop2) /* ROP value */ Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if (Bpp == 3){ + if (Bpp == 3) { sx *= 3; dx *= 3; width *= 3; @@ -271,7 +271,7 @@ unsigned int rop2) /* ROP value */ FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ - if (accel->de_wait() != 0){ + if (accel->de_wait() != 0) { return -1; } @@ -363,7 +363,7 @@ int hw_imageblit(struct lynx_accel *accel, Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if (bytePerPixel == 3){ + if (bytePerPixel == 3) { dx *= 3; width *= 3; startBit *= 3; diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 95cfb8fe9a07..3a21af94dc47 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -143,14 +143,14 @@ void hw_cursor_setData(struct lynx_cursor *cursor, if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); - }else{ + }else { /* use bg color,id = 1 */ data |= 1 << (j*2); } } #else - for (j=0;j<8;j++){ - if (mask & (0x80>>j)){ + for (j=0;j<8;j++) { + if (mask & (0x80>>j)) { if (rop == ROP_XOR) opr = mask ^ color; else @@ -173,7 +173,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, /* need a return */ pstart += offset; pbuffer = pstart; - }else{ + }else { pbuffer += sizeof(u16); } @@ -223,13 +223,13 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); - }else{ + }else { /* use bg color,id = 1 */ data |= 1 << (j*2); } } #else - for (j=0;j<8;j++){ + for (j=0;j<8;j++) { if (mask & (1< Date: Tue, 14 Jul 2015 21:14:36 -0700 Subject: [PATCH 255/912] staging: sm750fb: add space after close brace Fixes checkpatch.pl error: ERROR: space required after that close brace '}' Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_display.c | 2 +- drivers/staging/sm750fb/ddk750_mode.c | 2 +- drivers/staging/sm750fb/ddk750_power.c | 2 +- drivers/staging/sm750fb/sm750.h | 2 +- drivers/staging/sm750fb/sm750_cursor.c | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index c7171a4299a0..4a3cb8654888 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -166,7 +166,7 @@ static void waitNextVerticalSync(int ctrl, int delay) while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); } - }else { + } else { /* Do not wait when the Primary PLL is off or display control is already off. This will prevent the software to wait forever. */ diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index efc1fabf60ed..3d8b06d2ea63 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -109,7 +109,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) if (getChipType() == SM750LE) { displayControlAdjust_SM750LE(pModeParam, ulTmpValue); - }else { + } else { ulReg = PEEK32(CRT_DISPLAY_CTRL) & FIELD_CLEAR(CRT_DISPLAY_CTRL, VSYNC_PHASE) & FIELD_CLEAR(CRT_DISPLAY_CTRL, HSYNC_PHASE) diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index e2c0bb328106..5f697b838651 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -8,7 +8,7 @@ void ddk750_setDPMS(DPMS_t state) if (getChipType() == SM750LE) { value = PEEK32(CRT_DISPLAY_CTRL); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); - }else { + } else { value = PEEK32(SYSTEM_CTRL); value= FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); POKE32(SYSTEM_CTRL, value); diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 71e9a7a3aabb..8ac541015d1a 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -53,7 +53,7 @@ struct lynx_share{ int mtrr_off; struct{ int vram; - }mtrr; + } mtrr; /* all smi graphic adaptor got below attributes */ unsigned long vidmem_start; unsigned long vidreg_start; diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 3a21af94dc47..2fcec326fcf3 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -143,7 +143,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); - }else { + } else { /* use bg color,id = 1 */ data |= 1 << (j*2); } @@ -173,7 +173,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, /* need a return */ pstart += offset; pbuffer = pstart; - }else { + } else { pbuffer += sizeof(u16); } @@ -223,7 +223,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); - }else { + } else { /* use bg color,id = 1 */ data |= 1 << (j*2); } @@ -242,7 +242,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, /* need a return */ pstart += offset; pbuffer = pstart; - }else { + } else { pbuffer += sizeof(u16); } From b63f3dcab161c18f5ce3741dde07c29364a4af6b Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:37 -0700 Subject: [PATCH 256/912] staging: sm750fb: add space after enum definition Fixes checkpatch.pl warning: WARNING: missing space after enum definition Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_display.h | 2 +- drivers/staging/sm750fb/sm750_hw.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index 018a66184352..a7f50cc0db9d 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -129,7 +129,7 @@ typedef enum _disp_output_t } disp_output_t; #else -typedef enum _disp_output_t{ +typedef enum _disp_output_t { do_LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DAC_ON, do_LCD1_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|DAC_ON, #if 0 diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h index adc61edf2bac..af2db7ca0e56 100644 --- a/drivers/staging/sm750fb/sm750_hw.h +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -9,7 +9,7 @@ #endif -enum sm750_pnltype{ +enum sm750_pnltype { sm750_24TFT = 0,/* 24bit tft */ @@ -19,7 +19,7 @@ enum sm750_pnltype{ }; /* vga channel is not concerned */ -enum sm750_dataflow{ +enum sm750_dataflow { sm750_simul_pri,/* primary => all head */ sm750_simul_sec,/* secondary => all head */ @@ -30,13 +30,13 @@ enum sm750_dataflow{ }; -enum sm750_channel{ +enum sm750_channel { sm750_primary = 0, /* enum value equal to the register filed data */ sm750_secondary = 1, }; -enum sm750_path{ +enum sm750_path { sm750_panel = 1, sm750_crt = 2, sm750_pnc = 3,/* panel and crt */ From 5d14c13ae03ed4a8d79f14507eabb1d59cc85b3b Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:38 -0700 Subject: [PATCH 257/912] staging: sm750fb: add space after struct definition Fixes checkpatch.pl warning: WARNING: missing space after struct definition Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.h | 12 ++++++------ drivers/staging/sm750fb/sm750_hw.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 8ac541015d1a..9989ff6d850a 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -14,7 +14,7 @@ extern int smi_indent; -struct lynx_accel{ +struct lynx_accel { /* base virtual address of DPR registers */ volatile unsigned char __iomem * dprBase; /* base virtual address of de data port */ @@ -41,7 +41,7 @@ struct lynx_accel{ /* lynx_share stands for a presentation of two frame buffer that use one smi adaptor , it is similar to a basic class of C++ */ -struct lynx_share{ +struct lynx_share { /* common members */ u16 devid; u8 revid; @@ -68,7 +68,7 @@ struct lynx_share{ void (*resume)(struct lynx_share*); }; -struct lynx_cursor{ +struct lynx_cursor { /* cursor width ,height and size */ int w; int h; @@ -92,7 +92,7 @@ struct lynx_cursor{ void (*setData)(struct lynx_cursor *, u16, const u8*, const u8*); }; -struct lynxfb_crtc{ +struct lynxfb_crtc { unsigned char __iomem *vCursor; /* virtual address of cursor */ unsigned char __iomem *vScreen; /* virtual address of on_screen */ int oCursor; /* cursor address offset in vidmem */ @@ -123,7 +123,7 @@ struct lynxfb_crtc{ struct lynx_cursor cursor; }; -struct lynxfb_output{ +struct lynxfb_output { int dpms; int paths; /* which paths(s) this output stands for,for sm750: @@ -149,7 +149,7 @@ struct lynxfb_output{ void (*clear)(struct lynxfb_output*); }; -struct lynxfb_par{ +struct lynxfb_par { /* either 0 or 1 for dual head adaptor,0 is the older one registered */ int index; unsigned int pseudo_palette[256]; diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h index af2db7ca0e56..ef0a16f27936 100644 --- a/drivers/staging/sm750fb/sm750_hw.h +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -42,7 +42,7 @@ enum sm750_path { sm750_pnc = 3,/* panel and crt */ }; -struct init_status{ +struct init_status { ushort powerMode; /* below three clocks are in unit of MHZ*/ ushort chip_clk; @@ -52,7 +52,7 @@ struct init_status{ ushort resetMemory; }; -struct sm750_state{ +struct sm750_state { struct init_status initParm; enum sm750_pnltype pnltype; enum sm750_dataflow dataflow; @@ -66,7 +66,7 @@ struct sm750_state{ in C++ */ -struct sm750_share{ +struct sm750_share { /* it's better to put lynx_share struct to the first place of sm750_share */ struct lynx_share share; struct sm750_state state; From f7d8b69a1d6dac9d650714e82390f3b63e2e582f Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:39 -0700 Subject: [PATCH 258/912] staging: sm750fb: add space after return type Fixes checkpatch.pl warning: WARNING: missing space after return type Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 9989ff6d850a..2d04c0ff2941 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -108,12 +108,12 @@ struct lynxfb_crtc { void *priv; - int(*proc_setMode)(struct lynxfb_crtc*, + int (*proc_setMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*, struct fb_fix_screeninfo*); - int(*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); - int(*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); + int (*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); + int (*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); void (*clear)(struct lynxfb_crtc*); /* pan display */ int (*proc_panDisplay)(struct lynxfb_crtc *, @@ -140,12 +140,12 @@ struct lynxfb_output { */ void *priv; - int(*proc_setMode)(struct lynxfb_output*, + int (*proc_setMode)(struct lynxfb_output*, struct fb_var_screeninfo*, struct fb_fix_screeninfo*); - int(*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*); - int(*proc_setBLANK)(struct lynxfb_output*, int); + int (*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*); + int (*proc_setBLANK)(struct lynxfb_output*, int); void (*clear)(struct lynxfb_output*); }; From 6ab5b6d16bba08e9665d4ae1b122b55642d990b3 Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:40 -0700 Subject: [PATCH 259/912] staging: sm750fb: consistent spacing around operators Fixes checkpatch.pl error: ERROR: need consistent spacing around operator Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 4 ++-- drivers/staging/sm750fb/ddk750_display.h | 4 ++-- drivers/staging/sm750fb/sm750.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index fb1c533c0180..633201e134f2 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -464,7 +464,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) RN = N * request; quo = RN / input; rem = RN % input;/* rem always small than 14318181 */ - fl_quo = (rem * 10000 /input); + fl_quo = (rem * 10000 / input); for (d = xcnt - 1; d >= 0; d--) { X = xparm[d].value; @@ -474,7 +474,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) M += (fl_quo*X % 10000)>5000?1:0; if (M < 256 && M > 0) { unsigned int diff; - tmpClock = pll->inputFreq *M / N / X; + tmpClock = pll->inputFreq * M / N / X; diff = absDiff(tmpClock, request_orig); if (diff < miniDiff) { pll->M = M; diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index a7f50cc0db9d..afdf201b4975 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -46,7 +46,7 @@ 0: both off */ #define SEC_TP_OFFSET 5 -#define SEC_TP_MASK (1<< SEC_TP_OFFSET) +#define SEC_TP_MASK (1 << SEC_TP_OFFSET) #define SEC_TP_USAGE (SEC_TP_MASK << 16) #define SEC_TP_ON ((0x1 << SEC_TP_OFFSET)|SEC_TP_USAGE) #define SEC_TP_OFF ((0x0 << SEC_TP_OFFSET)|SEC_TP_USAGE) @@ -67,7 +67,7 @@ #define DAC_OFFSET 7 #define DAC_MASK (1 << DAC_OFFSET) #define DAC_USAGE (DAC_MASK << 16) -#define DAC_ON ((0x0<< DAC_OFFSET)|DAC_USAGE) +#define DAC_ON ((0x0 << DAC_OFFSET)|DAC_USAGE) #define DAC_OFF ((0x1 << DAC_OFFSET)|DAC_USAGE) /* DPMS only affect D-SUB head diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 2d04c0ff2941..ae872bd0819e 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -10,7 +10,7 @@ #define MB(x) ((x)<<20) #define MHZ(x) ((x) * 1000000) /* align should be 2,4,8,16 */ -#define PADDING(align, data) (((data)+(align)-1)&(~((align) -1))) +#define PADDING(align, data) (((data)+(align)-1)&(~((align) - 1))) extern int smi_indent; From 0d5e63c4626c0f8b3c8a12e8ce9a557273ce72ee Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:41 -0700 Subject: [PATCH 260/912] staging: sm750fb: add spaces around operators Fixes checkpath.pl error: ERROR: spaces required around that operator Note running checkpatch.pl with '--strict' catches more of these errors along with cases where spacing is optional but preferred. Take care of these in a future patch. Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 2 +- drivers/staging/sm750fb/ddk750_power.c | 2 +- drivers/staging/sm750fb/sm750.h | 2 +- drivers/staging/sm750fb/sm750_accel.c | 4 ++-- drivers/staging/sm750fb/sm750_cursor.c | 12 ++++++------ drivers/staging/sm750fb/sm750_help.h | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 633201e134f2..d7435d7302b4 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -471,7 +471,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) M = quo*X; M += fl_quo * X / 10000; /* round step */ - M += (fl_quo*X % 10000)>5000?1:0; + M += (fl_quo*X % 10000) > 5000?1:0; if (M < 256 && M > 0) { unsigned int diff; tmpClock = pll->inputFreq * M / N / X; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 5f697b838651..28d4402928d8 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -10,7 +10,7 @@ void ddk750_setDPMS(DPMS_t state) POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); } else { value = PEEK32(SYSTEM_CTRL); - value= FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); + value = FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); POKE32(SYSTEM_CTRL, value); } } diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index ae872bd0819e..d6916fd697dd 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -172,7 +172,7 @@ struct lynxfb_par { static inline unsigned long ps_to_hz(unsigned int psvalue) { - unsigned long long numerator=1000*1000*1000*1000ULL; + unsigned long long numerator = 1000*1000*1000*1000ULL; /* 10^12 / picosecond period gives frequency in Hz */ do_div(numerator, psvalue); return (unsigned long)numerator; diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index afe73e8265d1..0cfe96c2b5dc 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -414,10 +414,10 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); /* Write MONO data (line by line) to 2D Engine data port */ - for (i=0; i> j)) @@ -149,7 +149,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, } } #else - for (j=0;j<8;j++) { + for (j = 0;j < 8;j++) { if (mask & (0x80>>j)) { if (rop == ROP_XOR) opr = mask ^ color; @@ -204,7 +204,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, pstart = cursor->vstart; pbuffer = pstart; - for (i=0;i> j)) @@ -229,7 +229,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, } } #else - for (j=0;j<8;j++) { + for (j = 0;j < 8;j++) { if (mask & (1< Date: Tue, 14 Jul 2015 21:14:42 -0700 Subject: [PATCH 261/912] staging: sm750fb: add space after semicolon Fixes checkpatch.pl error: ERROR: space required after that ';' Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.h | 2 +- drivers/staging/sm750fb/sm750_cursor.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index d6916fd697dd..9b101a937964 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -168,7 +168,7 @@ struct lynxfb_par { ({ \ unsigned long long hz = 1000*1000*1000*1000ULL; \ do_div(hz, ps); \ - (unsigned long)hz;}) + (unsigned long)hz; }) static inline unsigned long ps_to_hz(unsigned int psvalue) { diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 9dabac1c6433..4ed7ca2c1997 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -122,7 +122,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, odd=0; */ - for (i = 0;i < count;i++) + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; @@ -137,7 +137,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, else opr = mask & color; - for (j = 0;j < 8;j++) + for (j = 0; j < 8; j++) { if (opr & (0x80 >> j)) @@ -149,7 +149,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, } } #else - for (j = 0;j < 8;j++) { + for (j = 0; j < 8; j++) { if (mask & (0x80>>j)) { if (rop == ROP_XOR) opr = mask ^ color; @@ -204,7 +204,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, pstart = cursor->vstart; pbuffer = pstart; - for (i = 0;i < count;i++) + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; @@ -217,7 +217,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, else opr = mask & color; - for (j = 0;j < 8;j++) + for (j = 0; j < 8; j++) { if (opr & (0x80 >> j)) @@ -229,7 +229,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, } } #else - for (j = 0;j < 8;j++) { + for (j = 0; j < 8; j++) { if (mask & (1< Date: Tue, 14 Jul 2015 21:14:43 -0700 Subject: [PATCH 262/912] staging: sm750fb: remove trailing whitespace Fixes checkpatch.pl error: ERROR: trailing whitespace Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_dvi.c | 2 +- drivers/staging/sm750fb/sm750_accel.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index 4c64436d8255..c42db85b162f 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -1,4 +1,4 @@ -#define USE_DVICHIP +#define USE_DVICHIP #ifdef USE_DVICHIP #include "ddk750_help.h" #include "ddk750_reg.h" diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 0cfe96c2b5dc..db950d4062d1 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -37,7 +37,7 @@ void hw_de_init(struct lynx_accel *accel) { /* setup 2d engine registers */ u32 reg, clr; - + write_dpr(accel, DE_MASKS, 0xFFFFFFFF); /* dpr1c */ @@ -82,7 +82,7 @@ void hw_de_init(struct lynx_accel *accel) void hw_set2dformat(struct lynx_accel *accel, int fmt) { u32 reg; - + /* fmt=0,1,2 for 8,16,32,bpp on sm718/750/502 */ reg = read_dpr(accel, DE_STRETCH_FORMAT); reg = FIELD_VALUE(reg, DE_STRETCH_FORMAT, PIXEL_FORMAT, fmt); From a1fe154f0f3dea1ba48aa4e96dbb0deec5c17125 Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:44 -0700 Subject: [PATCH 263/912] staging: sm750fb: remove unnecessary whitespace Fixes checkpatch.pl warning: WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 2 +- drivers/staging/sm750fb/sm750_hw.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 4d165ca3baad..c7ab8189671f 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -967,7 +967,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) var->accel_flags = 0; var->vmode = FB_VMODE_NONINTERLACED; - pr_debug("#1 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", + pr_debug("#1 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", info->cmap.start, info->cmap.len, info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 359165d523d0..fb9c631ff818 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -250,7 +250,7 @@ int hw_sm750_output_setMode(struct lynxfb_output *output, POKE32(DISPLAY_CONTROL_750LE, reg); } - pr_info("ddk setlogicdispout done \n"); + pr_info("ddk setlogicdispout done\n"); return ret; } @@ -489,14 +489,14 @@ int hw_sm750_setBLANK(struct lynxfb_output *output, int blank) #else case VESA_NO_BLANKING: #endif - pr_info("flag = FB_BLANK_UNBLANK \n"); + pr_info("flag = FB_BLANK_UNBLANK\n"); dpms = SYSTEM_CTRL_DPMS_VPHP; pps = PANEL_DISPLAY_CTRL_DATA_ENABLE; crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_NORMAL: - pr_info("flag = FB_BLANK_NORMAL \n"); + pr_info("flag = FB_BLANK_NORMAL\n"); dpms = SYSTEM_CTRL_DPMS_VPHP; pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; crtdb = CRT_DISPLAY_CTRL_BLANK_ON; From 259fef35c7688c105137f286c2dc5780979686c9 Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:45 -0700 Subject: [PATCH 264/912] staging: sm750fb: fix brace placement Fix brace placement errors caught by checkpatch.pl ERROR: that open brace { should be on the previous line Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.h | 12 ++--- drivers/staging/sm750fb/ddk750_display.c | 56 ++++++++---------------- drivers/staging/sm750fb/ddk750_display.h | 3 +- drivers/staging/sm750fb/ddk750_dvi.c | 6 +-- drivers/staging/sm750fb/ddk750_hwi2c.c | 6 +-- drivers/staging/sm750fb/ddk750_mode.c | 13 ++---- drivers/staging/sm750fb/ddk750_mode.h | 6 +-- drivers/staging/sm750fb/ddk750_power.c | 27 ++++-------- drivers/staging/sm750fb/ddk750_power.h | 3 +- drivers/staging/sm750fb/ddk750_sii164.c | 16 +++---- drivers/staging/sm750fb/ddk750_sii164.h | 3 +- drivers/staging/sm750fb/sm750_accel.c | 45 ++++++------------- drivers/staging/sm750fb/sm750_cursor.c | 23 ++++------ 13 files changed, 71 insertions(+), 148 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.h b/drivers/staging/sm750fb/ddk750_chip.h index 4e030e820cf3..6ff043608fe9 100644 --- a/drivers/staging/sm750fb/ddk750_chip.h +++ b/drivers/staging/sm750fb/ddk750_chip.h @@ -8,8 +8,7 @@ #include /* This is all the chips recognized by this library */ -typedef enum _logical_chip_type_t -{ +typedef enum _logical_chip_type_t { SM_UNKNOWN, SM718, SM750, @@ -18,8 +17,7 @@ typedef enum _logical_chip_type_t logical_chip_type_t; -typedef enum _clock_type_t -{ +typedef enum _clock_type_t { MXCLK_PLL, PRIMARY_PLL, SECONDARY_PLL, @@ -28,8 +26,7 @@ typedef enum _clock_type_t } clock_type_t; -typedef struct _pll_value_t -{ +typedef struct _pll_value_t { clock_type_t clockType; unsigned long inputFreq; /* Input clock frequency to the PLL */ @@ -42,8 +39,7 @@ typedef struct _pll_value_t pll_value_t; /* input struct to initChipParam() function */ -typedef struct _initchip_param_t -{ +typedef struct _initchip_param_t { unsigned short powerMode; /* Use power mode 0 or 1 */ unsigned short chipClock; /** * Speed of main chip clock in MHz unit diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 4a3cb8654888..a64ea32b91ae 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -15,12 +15,10 @@ static void setDisplayControl(int ctrl, int dispState) cnt = 0; /* Set the primary display control */ - if (!ctrl) - { + if (!ctrl) { ulDisplayCtrlReg = PEEK32(PANEL_DISPLAY_CTRL); /* Turn on/off the Panel display control */ - if (dispState) - { + if (dispState) { /* Timing should be enabled first before enabling the plane * because changing at the same time does not guarantee that * the plane will also enabled or disabled. @@ -45,16 +43,13 @@ static void setDisplayControl(int ctrl, int dispState) * until a few delay. Need to write * and read it a couple times */ - do - { + do { cnt++; POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); } while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Panel Plane enbit:after tried %d times\n", cnt); - } - else - { + } else { /* When turning off, there is no rule on the programming * sequence since whenever the clock is off, then it does not * matter whether the plane is enabled or disabled. @@ -71,14 +66,11 @@ static void setDisplayControl(int ctrl, int dispState) POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); } - } - /* Set the secondary display control */ - else - { + } else { + /* Set the secondary display control */ ulDisplayCtrlReg = PEEK32(CRT_DISPLAY_CTRL); - if (dispState) - { + if (dispState) { /* Timing should be enabled first before enabling the plane because changing at the same time does not guarantee that the plane will also enabled or disabled. */ @@ -100,16 +92,13 @@ static void setDisplayControl(int ctrl, int dispState) FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE) | FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_4_MASK, ENABLE); - do - { + do { cnt++; POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); } while ((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) != (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Crt Plane enbit:after tried %d times\n", cnt); - } - else - { + } else { /* When turning off, there is no rule on the programming * sequence since whenever the clock is off, then it does not * matter whether the plane is enabled or disabled. @@ -140,16 +129,13 @@ static void waitNextVerticalSync(int ctrl, int delay) if ((FIELD_GET(PEEK32(PANEL_PLL_CTRL), PANEL_PLL_CTRL, POWER) == PANEL_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, TIMING) == - PANEL_DISPLAY_CTRL_TIMING_DISABLE)) - { + PANEL_DISPLAY_CTRL_TIMING_DISABLE)) { return; } - while (delay-- > 0) - { + while (delay-- > 0) { /* Wait for end of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PANEL_VSYNC); @@ -157,8 +143,7 @@ static void waitNextVerticalSync(int ctrl, int delay) while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); /* Wait for start of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PANEL_VSYNC); @@ -173,16 +158,13 @@ static void waitNextVerticalSync(int ctrl, int delay) if ((FIELD_GET(PEEK32(CRT_PLL_CTRL), CRT_PLL_CTRL, POWER) == CRT_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, TIMING) == - CRT_DISPLAY_CTRL_TIMING_DISABLE)) - { + CRT_DISPLAY_CTRL_TIMING_DISABLE)) { return; } - while (delay-- > 0) - { + while (delay-- > 0) { /* Wait for end of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, CRT_VSYNC); @@ -190,8 +172,7 @@ static void waitNextVerticalSync(int ctrl, int delay) while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE); /* Wait for start of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, CRT_VSYNC); @@ -293,8 +274,7 @@ int ddk750_initDVIDisp(void) 1, /* Enable continuous Sync */ 1, /* Enable PLL Filter */ 4 /* Use the recommended value for PLL Filter value */ - ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) - { + ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) { return (-1); } diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index afdf201b4975..abccf84a8c9a 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -86,8 +86,7 @@ CRT means crt path DSUB */ #if 0 -typedef enum _disp_output_t -{ +typedef enum _disp_output_t { NO_DISPLAY = DPMS_OFF, LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DPMS_OFF|DAC_ON, diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index c42db85b162f..a18bb4cd08b9 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -9,8 +9,7 @@ /* This global variable contains all the supported driver and its corresponding function API. Please set the function pointer to NULL whenever the function is not supported. */ -static dvi_ctrl_device_t g_dcftSupportedDviController[] = -{ +static dvi_ctrl_device_t g_dcftSupportedDviController[] = { #ifdef DVI_CTRL_SII164 { .pfnInit = sii164InitChip, @@ -45,8 +44,7 @@ int dviInit( { dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl->pfnInit != NULL) - { + if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, pllFilterEnable, pllFilterValue); diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c index 7f3b1f931043..5ddac430aea2 100644 --- a/drivers/staging/sm750fb/ddk750_hwi2c.c +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -106,8 +106,7 @@ static unsigned int hwI2CWriteData( * Note: * Only 16 byte can be accessed per i2c start instruction. */ - do - { + do { /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ POKE32(I2C_RESET, 0); @@ -173,8 +172,7 @@ static unsigned int hwI2CReadData( * Note: * Only 16 byte can be accessed per i2c start instruction. */ - do - { + do { /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ POKE32(I2C_RESET, 0); diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 3d8b06d2ea63..9d104469ca16 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -80,8 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; - if (pll->clockType == SECONDARY_PLL) - { + if (pll->clockType == SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); POKE32(CRT_HORIZONTAL_TOTAL, @@ -119,9 +118,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(CRT_DISPLAY_CTRL, ulTmpValue|ulReg); } - } - else if (pll->clockType == PRIMARY_PLL) - { + } else if (pll->clockType == PRIMARY_PLL) { unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); @@ -170,16 +167,14 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); #if 1 - while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) - { + while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) { cnt++; if (cnt > 1000) break; POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); } #endif - } - else { + } else { ret = -1; } return ret; diff --git a/drivers/staging/sm750fb/ddk750_mode.h b/drivers/staging/sm750fb/ddk750_mode.h index 3548d671bf97..e846dc2c3d5c 100644 --- a/drivers/staging/sm750fb/ddk750_mode.h +++ b/drivers/staging/sm750fb/ddk750_mode.h @@ -3,16 +3,14 @@ #include "ddk750_chip.h" -typedef enum _spolarity_t -{ +typedef enum _spolarity_t { POS = 0, /* positive */ NEG, /* negative */ } spolarity_t; -typedef struct _mode_parameter_t -{ +typedef struct _mode_parameter_t { /* Horizontal timing. */ unsigned long horizontal_total; unsigned long horizontal_display_end; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 28d4402928d8..c545c2d8139e 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -36,8 +36,7 @@ void setPowerMode(unsigned int powerMode) if (getChipType() == SM750LE) return; - switch (powerMode) - { + switch (powerMode) { case POWER_MODE_CTRL_MODE_MODE0: control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); break; @@ -55,16 +54,13 @@ void setPowerMode(unsigned int powerMode) } /* Set up other fields in Power Control Register */ - if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) - { + if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) { control_value = #ifdef VALIDATION_CHIP FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); - } - else - { + } else { control_value = #ifdef VALIDATION_CHIP FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, ON) | @@ -84,8 +80,7 @@ void setCurrentGate(unsigned int gate) /* Get current power mode. */ mode = getPowerMode(); - switch (mode) - { + switch (mode) { case POWER_MODE_CTRL_MODE_MODE0: gate_reg = MODE0_GATE; break; @@ -111,13 +106,10 @@ void enable2DEngine(unsigned int enable) uint32_t gate; gate = PEEK32(CURRENT_GATE); - if (enable) - { + if (enable) { gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); - } - else - { + } else { gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); } @@ -135,8 +127,7 @@ void enableZVPort(unsigned int enable) /* Enable ZV Port Gate */ gate = PEEK32(CURRENT_GATE); - if (enable) - { + if (enable) { gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); #if 1 /* Using Software I2C */ @@ -145,9 +136,7 @@ void enableZVPort(unsigned int enable) /* Using Hardware I2C */ gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); #endif - } - else - { + } else { /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used or not. Therefore, do not disable the GPIO gate. */ gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h index a20d43863c33..b7cf6b281fb6 100644 --- a/drivers/staging/sm750fb/ddk750_power.h +++ b/drivers/staging/sm750fb/ddk750_power.h @@ -1,8 +1,7 @@ #ifndef DDK750_POWER_H__ #define DDK750_POWER_H__ -typedef enum _DPMS_t -{ +typedef enum _DPMS_t { crtDPMS_ON = 0x0, crtDPMS_STANDBY = 0x1, crtDPMS_SUSPEND = 0x2, diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index 7f58fbecd35f..a5153bec37b6 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -136,8 +136,7 @@ long sii164InitChip( #endif /* Check if SII164 Chip exists */ - if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) - { + if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) { /* * Initialize SII164 controller chip. */ @@ -183,8 +182,7 @@ long sii164InitChip( else config = SII164_DESKEW_ENABLE; - switch (deskewSetting) - { + switch (deskewSetting) { case 0: config |= SII164_DESKEW_1_STEP; break; @@ -286,15 +284,12 @@ void sii164SetPower( unsigned char config; config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - if (powerUp == 1) - { + if (powerUp == 1) { /* Power up the chip */ config &= ~SII164_CONFIGURATION_POWER_MASK; config |= SII164_CONFIGURATION_POWER_NORMAL; i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } - else - { + } else { /* Power down the chip */ config &= ~SII164_CONFIGURATION_POWER_MASK; config |= SII164_CONFIGURATION_POWER_DOWN; @@ -314,8 +309,7 @@ static void sii164SelectHotPlugDetectionMode( unsigned char detectReg; detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; - switch (hotPlugMode) - { + switch (hotPlugMode) { case SII164_HOTPLUG_DISABLE: detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; break; diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h index 0996a32e8dae..f2610c90eeb4 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.h +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -4,8 +4,7 @@ #define USE_DVICHIP /* Hot Plug detection mode structure */ -typedef enum _sii164_hot_plug_mode_t -{ +typedef enum _sii164_hot_plug_mode_t { SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index db950d4062d1..23be0f774dad 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -96,8 +96,7 @@ int hw_fillrect(struct lynx_accel *accel, { u32 deCtrl; - if (accel->de_wait() != 0) - { + if (accel->de_wait() != 0) { /* int time wait and always busy,seems hardware * got something error */ pr_debug("De engine always busy\n"); @@ -159,11 +158,9 @@ unsigned int rop2) /* ROP value */ de_ctrl = 0; /* If source and destination are the same surface, need to check for overlay cases */ - if (sBase == dBase && sPitch == dPitch) - { + if (sBase == dBase && sPitch == dPitch) { /* Determine direction of operation */ - if (sy < dy) - { + if (sy < dy) { /* +----------+ |S | | +----------+ @@ -174,9 +171,7 @@ unsigned int rop2) /* ROP value */ +----------+ */ nDirection = BOTTOM_TO_TOP; - } - else if (sy > dy) - { + } else if (sy > dy) { /* +----------+ |D | | +----------+ @@ -187,13 +182,10 @@ unsigned int rop2) /* ROP value */ +----------+ */ nDirection = TOP_TO_BOTTOM; - } - else - { + } else { /* sy == dy */ - if (sx <= dx) - { + if (sx <= dx) { /* +------+---+------+ |S | | D| | | | | @@ -202,9 +194,7 @@ unsigned int rop2) /* ROP value */ +------+---+------+ */ nDirection = RIGHT_TO_LEFT; - } - else - { + } else { /* sx > dx */ /* +------+---+------+ @@ -219,8 +209,7 @@ unsigned int rop2) /* ROP value */ } } - if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) - { + if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) { sx += width - 1; sy += height - 1; dx += width - 1; @@ -255,8 +244,7 @@ unsigned int rop2) /* ROP value */ write_dpr(accel, DE_PITCH, FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch) | FIELD_VALUE(0, DE_PITCH, SOURCE, sPitch)); /* dpr10 */ - } - else + } else #endif { write_dpr(accel, DE_PITCH, @@ -344,8 +332,7 @@ int hw_imageblit(struct lynx_accel *accel, ul4BytesPerScan = ulBytesPerScan & ~3; ulBytesRemain = ulBytesPerScan & 3; - if (accel->de_wait() != 0) - { + if (accel->de_wait() != 0) { return -1; } @@ -371,8 +358,7 @@ int hw_imageblit(struct lynx_accel *accel, FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch) | FIELD_VALUE(0, DE_PITCH, SOURCE, dPitch)); /* dpr10 */ - } - else + } else #endif { write_dpr(accel, DE_PITCH, @@ -414,16 +400,13 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); /* Write MONO data (line by line) to 2D Engine data port */ - for (i = 0; i < height; i++) - { + for (i = 0; i < height; i++) { /* For each line, send the data in chunks of 4 bytes */ - for (j = 0; j < (ul4BytesPerScan/4); j++) - { + for (j = 0; j < (ul4BytesPerScan/4); j++) { write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); } - if (ulBytesRemain) - { + if (ulBytesRemain) { memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain); write_dpPort(accel, *(unsigned int *)ajRemain); } diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 4ed7ca2c1997..ab61fe69635c 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -122,8 +122,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, odd=0; */ - for (i = 0; i < count; i++) - { + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; data = 0; @@ -137,11 +136,10 @@ void hw_cursor_setData(struct lynx_cursor *cursor, else opr = mask & color; - for (j = 0; j < 8; j++) - { + for (j = 0; j < 8; j++) { - if (opr & (0x80 >> j)) - { /* use fg color,id = 2 */ + if (opr & (0x80 >> j)) { + /* use fg color,id = 2 */ data |= 2 << (j*2); } else { /* use bg color,id = 1 */ @@ -204,8 +202,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, pstart = cursor->vstart; pbuffer = pstart; - for (i = 0; i < count; i++) - { + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; data = 0; @@ -217,11 +214,10 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, else opr = mask & color; - for (j = 0; j < 8; j++) - { + for (j = 0; j < 8; j++) { - if (opr & (0x80 >> j)) - { /* use fg color,id = 2 */ + if (opr & (0x80 >> j)) { + /* use fg color,id = 2 */ data |= 2 << (j*2); } else { /* use bg color,id = 1 */ @@ -237,8 +233,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, iowrite16(data, pbuffer); /* assume pitch is 1,2,4,8,...*/ - if (!(i&(pitch-1))) - { + if (!(i&(pitch-1))) { /* need a return */ pstart += offset; pbuffer = pstart; From cebafd8d6fd3a55671c2c5ee88ff27ad1bf9f1d3 Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:46 -0700 Subject: [PATCH 265/912] staging: sm750fb: move while to follow do close brace Fixes checkpatch.pl error: ERROR: while should follow close brace '}' Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_display.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index a64ea32b91ae..abd628343fed 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -139,16 +139,14 @@ static void waitNextVerticalSync(int ctrl, int delay) status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PANEL_VSYNC); - } - while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); + } while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); /* Wait for start of vsync. */ do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PANEL_VSYNC); - } - while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); + } while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); } } else { @@ -168,16 +166,14 @@ static void waitNextVerticalSync(int ctrl, int delay) status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, CRT_VSYNC); - } - while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE); + } while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE); /* Wait for start of vsync. */ do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, CRT_VSYNC); - } - while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE); + } while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE); } } } From 7b05cbe8b60beb31919baa2b010cd7776904b17b Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:47 -0700 Subject: [PATCH 266/912] staging: sm750fb: remove unnecessary braces Fixes checkpatch.pl warning: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_accel.c | 9 +++------ drivers/staging/sm750fb/sm750_hw.c | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 23be0f774dad..0f563a9f3d20 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -259,9 +259,8 @@ unsigned int rop2) /* ROP value */ FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ - if (accel->de_wait() != 0) { + if (accel->de_wait() != 0) return -1; - } { @@ -332,9 +331,8 @@ int hw_imageblit(struct lynx_accel *accel, ul4BytesPerScan = ulBytesPerScan & ~3; ulBytesRemain = ulBytesPerScan & 3; - if (accel->de_wait() != 0) { + if (accel->de_wait() != 0) return -1; - } /* 2D Source Base. Use 0 for HOST Blt. @@ -402,9 +400,8 @@ int hw_imageblit(struct lynx_accel *accel, /* Write MONO data (line by line) to 2D Engine data port */ for (i = 0; i < height; i++) { /* For each line, send the data in chunks of 4 bytes */ - for (j = 0; j < (ul4BytesPerScan/4); j++) { + for (j = 0; j < (ul4BytesPerScan/4); j++) write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); - } if (ulBytesRemain) { memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain); diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index fb9c631ff818..d1d6ae745feb 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -188,9 +188,8 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) } /* init 2d engine */ - if (!share->accel_off) { + if (!share->accel_off) hw_sm750_initAccel(share); - } return 0; } @@ -537,9 +536,8 @@ int hw_sm750_setBLANK(struct lynxfb_output *output, int blank) POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } - if (output->paths & sm750_panel) { + if (output->paths & sm750_panel) POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps)); - } return 0; } From 40403c1b13cb01d9125df80789b574c2d4172cc0 Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 14 Jul 2015 21:14:48 -0700 Subject: [PATCH 267/912] staging: sm750fb: add missing blank line after declarations Fixes checkpatch.pl WARNING: Missing a blank line after declarations Signed-off-by: Juston Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 1 + drivers/staging/sm750fb/ddk750_display.c | 2 ++ drivers/staging/sm750fb/ddk750_dvi.c | 1 + drivers/staging/sm750fb/ddk750_mode.c | 3 +++ drivers/staging/sm750fb/ddk750_power.c | 1 + drivers/staging/sm750fb/ddk750_sii164.c | 1 + drivers/staging/sm750fb/sm750_accel.c | 1 + drivers/staging/sm750fb/sm750_cursor.c | 2 ++ drivers/staging/sm750fb/sm750_hw.c | 7 +++++++ 9 files changed, 19 insertions(+) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index d7435d7302b4..5e6798ea9468 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -474,6 +474,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) M += (fl_quo*X % 10000) > 5000?1:0; if (M < 256 && M > 0) { unsigned int diff; + tmpClock = pll->inputFreq * M / N / X; diff = absDiff(tmpClock, request_orig); if (diff < miniDiff) { diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index abd628343fed..8348113482d9 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -121,6 +121,7 @@ static void setDisplayControl(int ctrl, int dispState) static void waitNextVerticalSync(int ctrl, int delay) { unsigned int status; + if (!ctrl) { /* primary controller */ @@ -210,6 +211,7 @@ static void swPanelPowerSequence(int disp, int delay) void ddk750_setLogicalDispOut(disp_output_t output) { unsigned int reg; + if (output & PNL_2_USAGE) { /* set panel path controller select */ reg = PEEK32(PANEL_DISPLAY_CTRL); diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index a18bb4cd08b9..a7a23514ac39 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -43,6 +43,7 @@ int dviInit( ) { dvi_ctrl_device_t *pCurrentDviCtrl; + pCurrentDviCtrl = g_dcftSupportedDviController; if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 9d104469ca16..2399b175ade0 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -80,6 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; + if (pll->clockType == SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); @@ -120,6 +121,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) } else if (pll->clockType == PRIMARY_PLL) { unsigned int ulReservedBits; + POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); POKE32(PANEL_HORIZONTAL_TOTAL, @@ -184,6 +186,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock) { pll_value_t pll; unsigned int uiActualPixelClk; + pll.inputFreq = DEFAULT_INPUT_CLOCK; pll.clockType = clock; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index c545c2d8139e..c8c51be53d68 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -5,6 +5,7 @@ void ddk750_setDPMS(DPMS_t state) { unsigned int value; + if (getChipType() == SM750LE) { value = PEEK32(CRT_DISPLAY_CTRL); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index a5153bec37b6..0bdf3db11df0 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -340,6 +340,7 @@ void sii164EnableHotPlugDetection( ) { unsigned char detectReg; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); /* Depending on each DVI controller, need to enable the hot plug based on each diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 0f563a9f3d20..1dd06a2e4ede 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -152,6 +152,7 @@ unsigned int rop2) /* ROP value */ { unsigned int nDirection, de_ctrl; int opSign; + nDirection = LEFT_TO_RIGHT; /* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ opSign = 1; diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index ab61fe69635c..2400c6c75863 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -61,6 +61,7 @@ writel((data), cursor->mmio + (addr)) void hw_cursor_enable(struct lynx_cursor *cursor) { u32 reg; + reg = FIELD_VALUE(0, HWC_ADDRESS, ADDRESS, cursor->offset)| FIELD_SET(0, HWC_ADDRESS, EXT, LOCAL)| FIELD_SET(0, HWC_ADDRESS, ENABLE, ENABLE); @@ -81,6 +82,7 @@ void hw_cursor_setPos(struct lynx_cursor *cursor, int x, int y) { u32 reg; + reg = FIELD_VALUE(0, HWC_LOCATION, Y, y)| FIELD_VALUE(0, HWC_LOCATION, X, x); POKE32(HWC_LOCATION, reg); diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index d1d6ae745feb..7317ba9b7fe5 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -244,6 +244,7 @@ int hw_sm750_output_setMode(struct lynxfb_output *output, } else { /* just open DISPLAY_CONTROL_750LE register bit 3:0*/ u32 reg; + reg = PEEK32(DISPLAY_CONTROL_750LE); reg |= 0xf; POKE32(DISPLAY_CONTROL_750LE, reg); @@ -418,6 +419,7 @@ int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, ushort red, ushort green, ushort blue) { static unsigned int add[] = {PANEL_PALETTE_RAM, CRT_PALETTE_RAM}; + POKE32(add[crtc->channel] + index*4, (red<<16)|(green<<8)|blue); return 0; } @@ -546,6 +548,7 @@ int hw_sm750_setBLANK(struct lynxfb_output *output, int blank) void hw_sm750_initAccel(struct lynx_share *share) { u32 reg; + enable2DEngine(1); if (getChipType() == SM750LE) { @@ -575,8 +578,10 @@ void hw_sm750_initAccel(struct lynx_share *share) int hw_sm750le_deWait(void) { int i = 0x10000000; + while (i--) { unsigned int dwVal = PEEK32(DE_STATE2); + if ((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) { @@ -591,8 +596,10 @@ int hw_sm750le_deWait(void) int hw_sm750_deWait(void) { int i = 0x10000000; + while (i--) { unsigned int dwVal = PEEK32(SYSTEM_CTRL); + if ((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_FIFO) == SYSTEM_CTRL_DE_FIFO_EMPTY) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) == SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) { From 6f14cc18f8dd5d1b05ae6583361e08222381ca84 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Thu, 16 Jul 2015 12:40:48 -0400 Subject: [PATCH 268/912] staging: unisys: fix copyright statements The copyright statements in the drivers need to be correct and consistent; this patch fixes the year for all of them, and makes the statement text cover just the GPL V2. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/controlvmchannel.h | 9 ++++----- .../staging/unisys/visorbus/controlvmcompletionstatus.h | 9 ++++----- drivers/staging/unisys/visorbus/iovmcall_gnuc.h | 9 ++++----- drivers/staging/unisys/visorbus/periodic_work.c | 9 ++++----- drivers/staging/unisys/visorbus/vbuschannel.h | 9 ++++----- drivers/staging/unisys/visorbus/vbusdeviceinfo.h | 9 ++++----- drivers/staging/unisys/visorbus/visorbus_main.c | 9 ++++----- drivers/staging/unisys/visorbus/visorbus_private.h | 9 ++++----- drivers/staging/unisys/visorbus/visorchannel.c | 9 ++++----- drivers/staging/unisys/visorbus/visorchipset.c | 9 ++++----- drivers/staging/unisys/visorbus/vmcallinterface.h | 9 ++++----- drivers/staging/unisys/visornic/visornic_main.c | 7 +++---- 12 files changed, 47 insertions(+), 59 deletions(-) diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h index a50d9cf4bed7..ec25366b127c 100644 --- a/drivers/staging/unisys/visorbus/controlvmchannel.h +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h @@ -1,10 +1,9 @@ -/* Copyright (C) 2010 - 2013 UNISYS CORPORATION +/* Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h b/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h index f74f5d8c2820..3c97ebac4f32 100644 --- a/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h +++ b/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h @@ -1,12 +1,11 @@ /* controlvmcompletionstatus.c * - * Copyright (C) 2010 - 2013 UNISYS CORPORATION + * Copyright (C) 2010 - 2015 UNISYS CORPORATION * All Rights Reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/iovmcall_gnuc.h b/drivers/staging/unisys/visorbus/iovmcall_gnuc.h index 57dd93e0cc83..b08b6ecc8d31 100644 --- a/drivers/staging/unisys/visorbus/iovmcall_gnuc.h +++ b/drivers/staging/unisys/visorbus/iovmcall_gnuc.h @@ -1,10 +1,9 @@ -/* Copyright (C) 2010 - 2013 UNISYS CORPORATION +/* Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/periodic_work.c b/drivers/staging/unisys/visorbus/periodic_work.c index 5e56088cf855..a3631c3591f6 100644 --- a/drivers/staging/unisys/visorbus/periodic_work.c +++ b/drivers/staging/unisys/visorbus/periodic_work.c @@ -1,12 +1,11 @@ /* periodic_work.c * - * Copyright (C) 2010 - 2013 UNISYS CORPORATION + * Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h index 5ed83a3f1428..80e64477e547 100644 --- a/drivers/staging/unisys/visorbus/vbuschannel.h +++ b/drivers/staging/unisys/visorbus/vbuschannel.h @@ -1,10 +1,9 @@ -/* Copyright (C) 2010 - 2013 UNISYS CORPORATION +/* Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h index 9b6d3e69355c..f59fd8a523c4 100644 --- a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h +++ b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h @@ -1,10 +1,9 @@ -/* Copyright (C) 2010 - 2013 UNISYS CORPORATION +/* Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 3e33e3629682..403c13b7864b 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1,12 +1,11 @@ /* visorbus_main.c * - * Copyright � 2010 - 2013 UNISYS CORPORATION + * Copyright � 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 2f12483e38ab..39edd2018453 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -1,12 +1,11 @@ /* visorchipset.h * - * Copyright (C) 2010 - 2013 UNISYS CORPORATION + * Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index c6452c3908e6..242246492b7a 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -1,12 +1,11 @@ /* visorchannel_funcs.c * - * Copyright (C) 2010 - 2013 UNISYS CORPORATION + * Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index fb08f9523ab3..4b76cb441ed4 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1,12 +1,11 @@ /* visorchipset_main.c * - * Copyright (C) 2010 - 2013 UNISYS CORPORATION + * Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visorbus/vmcallinterface.h b/drivers/staging/unisys/visorbus/vmcallinterface.h index 7a53df00726a..7abd27a618f8 100644 --- a/drivers/staging/unisys/visorbus/vmcallinterface.h +++ b/drivers/staging/unisys/visorbus/vmcallinterface.h @@ -1,10 +1,9 @@ -/* Copyright (C) 2010 - 2013 UNISYS CORPORATION +/* Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 9350473a732b..c28a34767552 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1,10 +1,9 @@ /* Copyright (c) 2012 - 2015 UNISYS CORPORATION * All rights reserved. * - * 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 and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of From 4bdc190a929c6f99732a9a0ff03dba7b0137d4bd Mon Sep 17 00:00:00 2001 From: Vasiliy Korchagin Date: Wed, 15 Jul 2015 00:40:40 +0000 Subject: [PATCH 269/912] staging: lustre: obdclass: simplify class_uuid_unparse This patch simplifies uuid unparse logic by using sprintf "%pU" extension. And eliminates the code with a coding style error: ERROR: Macros with complex values should be enclosed in parentheses +#define CONSUME(val, ptr) (val) = consume(sizeof(val), (ptr)) Signed-off-by: Vasiliy Korchagin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/uuid.c | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/uuid.c b/drivers/staging/lustre/lustre/obdclass/uuid.c index ff0a01bcf8da..b0b0157a6334 100644 --- a/drivers/staging/lustre/lustre/obdclass/uuid.c +++ b/drivers/staging/lustre/lustre/obdclass/uuid.c @@ -43,40 +43,8 @@ #include "../include/obd_support.h" #include "../include/obd_class.h" - -static inline __u32 consume(int nob, __u8 **ptr) -{ - __u32 value; - - LASSERT(nob <= sizeof(value)); - - for (value = 0; nob > 0; --nob) - value = (value << 8) | *((*ptr)++); - return value; -} - -#define CONSUME(val, ptr) (val) = consume(sizeof(val), (ptr)) - -static void uuid_unpack(class_uuid_t in, __u16 *uu, int nr) -{ - __u8 *ptr = in; - - LASSERT(nr * sizeof(*uu) == sizeof(class_uuid_t)); - - while (nr-- > 0) - CONSUME(uu[nr], &ptr); -} - void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out) { - /* uu as an array of __u16's */ - __u16 uuid[sizeof(class_uuid_t) / sizeof(__u16)]; - - CLASSERT(ARRAY_SIZE(uuid) == 8); - - uuid_unpack(uu, uuid, ARRAY_SIZE(uuid)); - sprintf(out->uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", - uuid[0], uuid[1], uuid[2], uuid[3], - uuid[4], uuid[5], uuid[6], uuid[7]); + sprintf(out->uuid, "%pU", uu); } EXPORT_SYMBOL(class_uuid_unparse); From 9c7e397c98d646a3a23ffd304def1750be916803 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Wed, 15 Jul 2015 12:21:16 -0400 Subject: [PATCH 270/912] staging/lustre/ldlm: Unregister ldlm namespace from sysfs on free ldlm_namespace_sysfs_unregister needs to be called ldlm_namespace_free_post so that we don't have this dangling object there after the namespace has disappeared. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index cdb63665a113..4bb3173bcd5f 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -939,6 +939,7 @@ void ldlm_namespace_free_post(struct ldlm_namespace *ns) ldlm_pool_fini(&ns->ns_pool); ldlm_namespace_debugfs_unregister(ns); + ldlm_namespace_sysfs_unregister(ns); cfs_hash_putref(ns->ns_rs_hash); /* Namespace \a ns should be not on list at this time, otherwise * this will cause issues related to using freed \a ns in poold From 315c928ba99af23dd25ac664b7c02828cf047f19 Mon Sep 17 00:00:00 2001 From: Pedro Marzo Perez Date: Thu, 16 Jul 2015 20:50:00 +0200 Subject: [PATCH 271/912] Staging: lustre: make obd_device_cachep static Variable obd_device_cachep is only used inside the file it is declared, so it is better set as static Signed-off-by: Pedro Marzo Perez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index d36697d2c47f..0ca730948f7a 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -45,7 +45,7 @@ spinlock_t obd_types_lock; -struct kmem_cache *obd_device_cachep; +static struct kmem_cache *obd_device_cachep; struct kmem_cache *obdo_cachep; EXPORT_SYMBOL(obdo_cachep); static struct kmem_cache *import_cachep; From c8011d90c68d10d67b797e0704c16697bba683a1 Mon Sep 17 00:00:00 2001 From: CHANG FU CHIAO Date: Wed, 15 Jul 2015 15:32:21 +0800 Subject: [PATCH 272/912] staging: ft1000: ft1000-usb: remove unnecessary out of memory warning fixes "Possible unnecessary 'out of memory' message" Signed-off-by: CHANG FU CHIAO Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index e6b5976a09e3..96209703ba25 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -842,7 +842,6 @@ static int ft1000_copy_up_pkt(struct urb *urb) skb = dev_alloc_skb(len + 12 + 2); if (skb == NULL) { - pr_debug("No Network buffers available\n"); info->stats.rx_errors++; ft1000_submit_rx_urb(info); return -1; From 42748bc905d57aa96a3b8ef50261bcf95890bef7 Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Wed, 15 Jul 2015 00:44:53 +0200 Subject: [PATCH 273/912] staging: rtl8188eu: remove unused {en,dis}able_interrupt rtw_hal_enable_interrupt() and rtw_hal_disable_interrupt() are never referenced, so remove them. They used to be the only place where the enable_interrupt() and disable_interrupt() callbacks were called, and the function pointer is never set, so get rid of the function pointer as well. Signed-off-by: Luca Ceresoli Cc: Greg Kroah-Hartman Cc: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/hal_intf.c | 16 ---------------- drivers/staging/rtl8188eu/include/hal_intf.h | 5 ----- 2 files changed, 21 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/hal_intf.c b/drivers/staging/rtl8188eu/hal/hal_intf.c index 5edb5c41c8e7..fecd2ef11b85 100644 --- a/drivers/staging/rtl8188eu/hal/hal_intf.c +++ b/drivers/staging/rtl8188eu/hal/hal_intf.c @@ -156,22 +156,6 @@ void rtw_hal_set_odm_var(struct adapter *adapt, val1, set); } -void rtw_hal_enable_interrupt(struct adapter *adapt) -{ - if (adapt->HalFunc.enable_interrupt) - adapt->HalFunc.enable_interrupt(adapt); - else - DBG_88E("%s: HalFunc.enable_interrupt is NULL!\n", __func__); -} - -void rtw_hal_disable_interrupt(struct adapter *adapt) -{ - if (adapt->HalFunc.disable_interrupt) - adapt->HalFunc.disable_interrupt(adapt); - else - DBG_88E("%s: HalFunc.disable_interrupt is NULL!\n", __func__); -} - u32 rtw_hal_inirp_init(struct adapter *adapt) { u32 rst = _FAIL; diff --git a/drivers/staging/rtl8188eu/include/hal_intf.h b/drivers/staging/rtl8188eu/include/hal_intf.h index 3b476d80f64d..d85bc441d98e 100644 --- a/drivers/staging/rtl8188eu/include/hal_intf.h +++ b/drivers/staging/rtl8188eu/include/hal_intf.h @@ -171,8 +171,6 @@ struct hal_ops { void (*read_adapter_info)(struct adapter *padapter); - void (*enable_interrupt)(struct adapter *padapter); - void (*disable_interrupt)(struct adapter *padapter); s32 (*interrupt_handler)(struct adapter *padapter); void (*set_bwmode_handler)(struct adapter *padapter, @@ -276,9 +274,6 @@ void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet); -void rtw_hal_enable_interrupt(struct adapter *padapter); -void rtw_hal_disable_interrupt(struct adapter *padapter); - u32 rtw_hal_inirp_init(struct adapter *padapter); u32 rtw_hal_inirp_deinit(struct adapter *padapter); From f83113d3e6f2cef66890a90d01c5347ece4ecd97 Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Wed, 15 Jul 2015 00:44:54 +0200 Subject: [PATCH 274/912] staging: rtl8188eu: remove unused rtw_hal_set_def_var rtw_hal_set_def_var() is never referenced, so remove it. It used to be the only place where the SetHalDefVarHandler callback was called, so get rid of the function pointer as well. Also remove the callback itself, SetHalDefVar8188EUsb(), which was not called anywhere else. Signed-off-by: Luca Ceresoli Cc: Greg Kroah-Hartman Cc: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/hal_intf.c | 8 --- drivers/staging/rtl8188eu/hal/usb_halinit.c | 70 -------------------- drivers/staging/rtl8188eu/include/hal_intf.h | 5 -- 3 files changed, 83 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/hal_intf.c b/drivers/staging/rtl8188eu/hal/hal_intf.c index fecd2ef11b85..5af574005035 100644 --- a/drivers/staging/rtl8188eu/hal/hal_intf.c +++ b/drivers/staging/rtl8188eu/hal/hal_intf.c @@ -131,14 +131,6 @@ void rtw_hal_get_hwreg(struct adapter *adapt, u8 variable, u8 *val) adapt->HalFunc.GetHwRegHandler(adapt, variable, val); } -u8 rtw_hal_set_def_var(struct adapter *adapt, enum hal_def_variable var, - void *val) -{ - if (adapt->HalFunc.SetHalDefVarHandler) - return adapt->HalFunc.SetHalDefVarHandler(adapt, var, val); - return _FAIL; -} - u8 rtw_hal_get_def_var(struct adapter *adapt, enum hal_def_variable var, void *val) { diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index ffcca6b03fe2..6dc0869924ec 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -1961,75 +1961,6 @@ GetHalDefVar8188EUsb( return bResult; } -/* */ -/* Description: */ -/* Change default setting of specified variable. */ -/* */ -static u8 SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue) -{ - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); - u8 bResult = _SUCCESS; - - switch (eVariable) { - case HAL_DEF_DBG_DM_FUNC: - { - u8 dm_func = *((u8 *)pValue); - struct odm_dm_struct *podmpriv = &haldata->odmpriv; - - if (dm_func == 0) { /* disable all dynamic func */ - podmpriv->SupportAbility = DYNAMIC_FUNC_DISABLE; - DBG_88E("==> Disable all dynamic function...\n"); - } else if (dm_func == 1) {/* disable DIG */ - podmpriv->SupportAbility &= (~DYNAMIC_BB_DIG); - DBG_88E("==> Disable DIG...\n"); - } else if (dm_func == 2) {/* disable High power */ - podmpriv->SupportAbility &= (~DYNAMIC_BB_DYNAMIC_TXPWR); - } else if (dm_func == 3) {/* disable tx power tracking */ - podmpriv->SupportAbility &= (~DYNAMIC_RF_CALIBRATION); - DBG_88E("==> Disable tx power tracking...\n"); - } else if (dm_func == 5) {/* disable antenna diversity */ - podmpriv->SupportAbility &= (~DYNAMIC_BB_ANT_DIV); - } else if (dm_func == 6) {/* turn on all dynamic func */ - if (!(podmpriv->SupportAbility & DYNAMIC_BB_DIG)) { - struct rtw_dig *pDigTable = &podmpriv->DM_DigTable; - pDigTable->CurIGValue = usb_read8(Adapter, 0xc50); - } - podmpriv->SupportAbility = DYNAMIC_ALL_FUNC_ENABLE; - DBG_88E("==> Turn on all dynamic function...\n"); - } - } - break; - case HAL_DEF_DBG_DUMP_RXPKT: - haldata->bDumpRxPkt = *((u8 *)pValue); - break; - case HAL_DEF_DBG_DUMP_TXPKT: - haldata->bDumpTxPkt = *((u8 *)pValue); - break; - case HW_DEF_FA_CNT_DUMP: - { - u8 bRSSIDump = *((u8 *)pValue); - struct odm_dm_struct *dm_ocm = &(haldata->odmpriv); - if (bRSSIDump) - dm_ocm->DebugComponents = ODM_COMP_DIG|ODM_COMP_FA_CNT; - else - dm_ocm->DebugComponents = 0; - } - break; - case HW_DEF_ODM_DBG_FLAG: - { - u64 DebugComponents = *((u64 *)pValue); - struct odm_dm_struct *dm_ocm = &(haldata->odmpriv); - dm_ocm->DebugComponents = DebugComponents; - } - break; - default: - bResult = _FAIL; - break; - } - - return bResult; -} - static void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level) { u8 init_rate = 0; @@ -2200,7 +2131,6 @@ void rtl8188eu_set_hal_ops(struct adapter *adapt) halfunc->SetHwRegHandler = &SetHwReg8188EU; halfunc->GetHwRegHandler = &GetHwReg8188EU; halfunc->GetHalDefVarHandler = &GetHalDefVar8188EUsb; - halfunc->SetHalDefVarHandler = &SetHalDefVar8188EUsb; halfunc->UpdateRAMaskHandler = &UpdateHalRAMask8188EUsb; halfunc->SetBeaconRelatedRegistersHandler = &SetBeaconRelatedRegisters8188EUsb; diff --git a/drivers/staging/rtl8188eu/include/hal_intf.h b/drivers/staging/rtl8188eu/include/hal_intf.h index d85bc441d98e..bf894ce8eab1 100644 --- a/drivers/staging/rtl8188eu/include/hal_intf.h +++ b/drivers/staging/rtl8188eu/include/hal_intf.h @@ -188,9 +188,6 @@ struct hal_ops { u8 (*GetHalDefVarHandler)(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue); - u8 (*SetHalDefVarHandler)(struct adapter *padapter, - enum hal_def_variable eVariable, - void *pValue); void (*SetHalODMVarHandler)(struct adapter *padapter, enum hal_odm_variable eVariable, @@ -265,8 +262,6 @@ void rtw_hal_chip_configure(struct adapter *padapter); void rtw_hal_read_chip_info(struct adapter *padapter); void rtw_hal_read_chip_version(struct adapter *padapter); -u8 rtw_hal_set_def_var(struct adapter *padapter, - enum hal_def_variable eVariable, void *pValue); u8 rtw_hal_get_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue); From 9431fda3ff9193249ee7bc7731bb74e9f51f6f36 Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Wed, 15 Jul 2015 00:44:55 +0200 Subject: [PATCH 275/912] staging: rtl8188eu: remove unused rtw_hal_write_rfreg rtw_hal_write_rfreg() is never referenced, so remove it. It used to be the only place where the write_rfreg callback was called, so get rid of the function pointer as well. Signed-off-by: Luca Ceresoli Cc: Greg Kroah-Hartman Cc: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/hal_intf.c | 8 -------- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 1 - drivers/staging/rtl8188eu/include/hal_intf.h | 6 ------ 3 files changed, 15 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/hal_intf.c b/drivers/staging/rtl8188eu/hal/hal_intf.c index 5af574005035..85c17ef942f3 100644 --- a/drivers/staging/rtl8188eu/hal/hal_intf.c +++ b/drivers/staging/rtl8188eu/hal/hal_intf.c @@ -245,14 +245,6 @@ u32 rtw_hal_read_rfreg(struct adapter *adapt, enum rf_radio_path rfpath, return data; } -void rtw_hal_write_rfreg(struct adapter *adapt, enum rf_radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data) -{ - if (adapt->HalFunc.write_rfreg) - adapt->HalFunc.write_rfreg(adapt, rfpath, regaddr, - bitmask, data); -} - void rtw_hal_set_bwmode(struct adapter *adapt, enum ht_channel_width bandwidth, u8 offset) { diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index b05da9d6b693..a6295ca6a73e 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -208,7 +208,6 @@ void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc) pHalFunc->AntDivBeforeLinkHandler = &AntDivBeforeLink8188E; pHalFunc->AntDivCompareHandler = &AntDivCompare8188E; pHalFunc->read_rfreg = &phy_query_rf_reg; - pHalFunc->write_rfreg = &phy_set_rf_reg; pHalFunc->sreset_init_value = &sreset_init_value; pHalFunc->sreset_get_wifi_status = &sreset_get_wifi_status; diff --git a/drivers/staging/rtl8188eu/include/hal_intf.h b/drivers/staging/rtl8188eu/include/hal_intf.h index bf894ce8eab1..e73c6341248e 100644 --- a/drivers/staging/rtl8188eu/include/hal_intf.h +++ b/drivers/staging/rtl8188eu/include/hal_intf.h @@ -211,9 +211,6 @@ struct hal_ops { u32 (*read_rfreg)(struct adapter *padapter, enum rf_radio_path eRFPath, u32 RegAddr, u32 BitMask); - void (*write_rfreg)(struct adapter *padapter, - enum rf_radio_path eRFPath, u32 RegAddr, - u32 BitMask, u32 Data); void (*sreset_init_value)(struct adapter *padapter); u8 (*sreset_get_wifi_status)(struct adapter *padapter); @@ -290,9 +287,6 @@ void rtw_hal_bcn_related_reg_setting(struct adapter *padapter); u32 rtw_hal_read_rfreg(struct adapter *padapter, enum rf_radio_path eRFPath, u32 RegAddr, u32 BitMask); -void rtw_hal_write_rfreg(struct adapter *padapter, - enum rf_radio_path eRFPath, u32 RegAddr, - u32 BitMask, u32 Data); void rtw_hal_set_bwmode(struct adapter *padapter, enum ht_channel_width Bandwidth, u8 Offset); From 87bf79298036a47ab158ae7e335cc7f8b0df4e9c Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Wed, 15 Jul 2015 13:59:45 +0530 Subject: [PATCH 276/912] staging: sm7xxfb: define new macros Define and use some new macros to work with different situations based on little-endian and big-endian. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xx.h | 19 ++++++++++++ drivers/staging/sm7xxfb/sm7xxfb.c | 48 +++++++------------------------ 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h index 31a21bd85dae..aad1cc4be34a 100644 --- a/drivers/staging/sm7xxfb/sm7xx.h +++ b/drivers/staging/sm7xxfb/sm7xx.h @@ -95,3 +95,22 @@ struct modeinit { unsigned char init_cr30_cr4d[SIZE_CR30_CR4D]; unsigned char init_cr90_cra7[SIZE_CR90_CRA7]; }; + +#ifdef __BIG_ENDIAN +#define pal_rgb(r, g, b, val) (((r & 0xf800) >> 8) | \ + ((g & 0xe000) >> 13) | \ + ((g & 0x1c00) << 3) | \ + ((b & 0xf800) >> 3)) +#define big_addr 0x800000 +#define mmio_addr 0x00800000 +#define seqw17() smtc_seqw(0x17, 0x30) +#define big_pixel_depth(p, d) {if (p == 24) {p = 32; d = 32; } } +#define big_swap(p) ((p & 0xff00ff00 >> 8) | (p & 0x00ff00ff << 8)) +#else +#define pal_rgb(r, g, b, val) val +#define big_addr 0 +#define mmio_addr 0x00c00000 +#define seqw17() do { } while (0) +#define big_pixel_depth(p, d) do { } while (0) +#define big_swap(p) p +#endif diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 4dc9d5f32517..106465c91997 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -923,25 +923,14 @@ static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green, val = chan_to_field(red, &sfb->fb->var.red); val |= chan_to_field(green, &sfb->fb->var.green); val |= chan_to_field(blue, &sfb->fb->var.blue); -#ifdef __BIG_ENDIAN - pal[regno] = ((red & 0xf800) >> 8) | - ((green & 0xe000) >> 13) | - ((green & 0x1c00) << 3) | - ((blue & 0xf800) >> 3); -#else - pal[regno] = val; -#endif + pal[regno] = pal_rgb(red, green, blue, val); } else { u32 *pal = sfb->fb->pseudo_palette; val = chan_to_field(red, &sfb->fb->var.red); val |= chan_to_field(green, &sfb->fb->var.green); val |= chan_to_field(blue, &sfb->fb->var.blue); -#ifdef __BIG_ENDIAN - val = (val & 0xff00ff00 >> 8) | - (val & 0x00ff00ff << 8); -#endif - pal[regno] = val; + pal[regno] = big_swap(val); } break; @@ -1002,8 +991,7 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, dst = buffer; for (i = c >> 2; i--;) { *dst = fb_readl(src++); - *dst = (*dst & 0xff00ff00 >> 8) | - (*dst & 0x00ff00ff << 8); + *dst = big_swap(*dst); dst++; } if (c & 3) { @@ -1091,8 +1079,7 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, } for (i = c >> 2; i--;) { - fb_writel((*src & 0xff00ff00 >> 8) | - (*src & 0x00ff00ff << 8), dst++); + fb_writel(big_swap(*src), dst++); src++; } if (c & 3) { @@ -1341,10 +1328,8 @@ static int smtc_map_smem(struct smtcfb_info *sfb, { sfb->fb->fix.smem_start = pci_resource_start(pdev, 0); -#ifdef __BIG_ENDIAN if (sfb->fb->var.bits_per_pixel == 32) - sfb->fb->fix.smem_start += 0x800000; -#endif + sfb->fb->fix.smem_start += big_addr; sfb->fb->fix.smem_len = smem_len; @@ -1437,10 +1422,7 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, sfb->fb->var.bits_per_pixel = SCREEN_BPP; } -#ifdef __BIG_ENDIAN - if (sfb->fb->var.bits_per_pixel == 24) - sfb->fb->var.bits_per_pixel = (smtc_scr_info.lfb_depth = 32); -#endif + big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth); /* Map address and memory detection */ mmio_base = pci_resource_start(pdev, 0); pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id); @@ -1451,11 +1433,7 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, sfb->fb->fix.mmio_start = mmio_base + 0x00400000; sfb->fb->fix.mmio_len = 0x00400000; smem_size = SM712_VIDEOMEMORYSIZE; -#ifdef __BIG_ENDIAN - sfb->lfb = ioremap(mmio_base, 0x00c00000); -#else - sfb->lfb = ioremap(mmio_base, 0x00800000); -#endif + sfb->lfb = ioremap(mmio_base, mmio_addr); if (!sfb->lfb) { dev_err(&pdev->dev, "%s: unable to map memory mapped IO!\n", @@ -1468,12 +1446,10 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, sfb->lfb + 0x00700000); sfb->dp_regs = sfb->lfb + 0x00408000; sfb->vp_regs = sfb->lfb + 0x0040c000; -#ifdef __BIG_ENDIAN if (sfb->fb->var.bits_per_pixel == 32) { - sfb->lfb += 0x800000; + sfb->lfb += big_addr; dev_info(&pdev->dev, "sfb->lfb=%p\n", sfb->lfb); } -#endif /* set MCLK = 14.31818 * (0x16 / 0x2) */ smtc_seqw(0x6a, 0x16); @@ -1482,10 +1458,8 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, /* enable PCI burst */ smtc_seqw(0x17, 0x20); /* enable word swap */ -#ifdef __BIG_ENDIAN if (sfb->fb->var.bits_per_pixel == 32) - smtc_seqw(0x17, 0x30); -#endif + seqw17(); break; case 0x720: sfb->fb->fix.mmio_start = mmio_base; @@ -1617,10 +1591,8 @@ static int smtcfb_pci_resume(struct device *device) smtc_seqw(0x62, 0x3e); /* enable PCI burst */ smtc_seqw(0x17, 0x20); -#ifdef __BIG_ENDIAN if (sfb->fb->var.bits_per_pixel == 32) - smtc_seqw(0x17, 0x30); -#endif + seqw17(); break; case 0x720: smtc_seqw(0x62, 0xff); From 613a7c5e0f2b216e62b7dfaa92c54959319bed42 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Wed, 15 Jul 2015 13:59:46 +0530 Subject: [PATCH 277/912] staging: sm7xxfb: usr fb_read and fb_write Now since the Big-Endian and Little-Endian based calculations are moved into a macro we can make fb_read() and fb_write() common for both Little-Endian and Big-Endian. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 106465c91997..07c2199c9ac7 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -946,7 +946,6 @@ static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green, return 0; } -#ifdef __BIG_ENDIAN static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, size_t count, loff_t *ppos) { @@ -1107,7 +1106,6 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, return (cnt) ? cnt : err; } -#endif /* ! __BIG_ENDIAN */ static void sm7xx_set_timing(struct smtcfb_info *sfb) { @@ -1303,10 +1301,8 @@ static struct fb_ops smtcfb_ops = { .fb_fillrect = cfb_fillrect, .fb_imageblit = cfb_imageblit, .fb_copyarea = cfb_copyarea, -#ifdef __BIG_ENDIAN .fb_read = smtcfb_read, .fb_write = smtcfb_write, -#endif }; /* From 48028c61e45acf644aaaa47db475974829fc64dd Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 16:58:07 +0530 Subject: [PATCH 278/912] staging: rtl8188eu: remove unused function The inline function rtw_set_ips_deny() was only defined but was never used. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 6 ------ drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 1 - 2 files changed, 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index ec0a8a4cdc6e..a2b54de21ed7 100644 --- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c @@ -549,12 +549,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) (unsigned long)padapter); } -inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms) -{ - struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ms); -} - /* * rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend * @adapter: pointer to struct adapter structure diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index aa1fd87c47fb..a493d4c37ef1 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -257,7 +257,6 @@ s32 LPS_RF_ON_check(struct adapter *adapter, u32 delay_ms); void LPS_Enter(struct adapter *adapter); void LPS_Leave(struct adapter *adapter); -void rtw_set_ips_deny(struct adapter *adapter, u32 ms); int _rtw_pwr_wakeup(struct adapter *adapter, u32 ips_defer_ms, const char *caller); #define rtw_pwr_wakeup(adapter) \ From 277394198413fc46e81767827533e5ab8ef167af Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 16:58:08 +0530 Subject: [PATCH 279/912] staging: rtl8188eu: remove redundant NULL check The check for pstat and pdvobjpriv is not required here as we have already checked for them before. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index a0b8f665fa2f..ba8f9aa5d259 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -3367,7 +3367,7 @@ static unsigned int OnAssocReq(struct adapter *padapter, spin_unlock_bh(&pstapriv->asoc_list_lock); /* now the station is qualified to join our BSS... */ - if (pstat && (pstat->state & WIFI_FW_ASSOC_SUCCESS) && (_STATS_SUCCESSFUL_ == status)) { + if ((pstat->state & WIFI_FW_ASSOC_SUCCESS) && (_STATS_SUCCESSFUL_ == status)) { /* 1 bss_cap_update & sta_info_update */ bss_cap_update_on_sta_join(padapter, pstat); sta_info_update(padapter, pstat); diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index d0d4335b444c..21744a548bb8 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -123,7 +123,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) status = _SUCCESS; free_dvobj: - if (status != _SUCCESS && pdvobjpriv) { + if (status != _SUCCESS) { usb_set_intfdata(usb_intf, NULL); kfree(pdvobjpriv); pdvobjpriv = NULL; From 47ccb34ac72c0dbbb68f6a07ce63e9f0d21510ea Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 16:58:09 +0530 Subject: [PATCH 280/912] staging: rtl8188eu: remove goto label By checking for the success of kzalloc we were able to remove the goto label thus making the code more readable. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 21744a548bb8..f68875bd9511 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -115,14 +115,11 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) mutex_init(&pdvobjpriv->usb_vendor_req_mutex); pdvobjpriv->usb_vendor_req_buf = kzalloc(MAX_USB_IO_CTL_SIZE, GFP_KERNEL); - if (!pdvobjpriv->usb_vendor_req_buf) - goto free_dvobj; + if (pdvobjpriv->usb_vendor_req_buf) { + usb_get_dev(pusbd); + status = _SUCCESS; + } - usb_get_dev(pusbd); - - status = _SUCCESS; - -free_dvobj: if (status != _SUCCESS) { usb_set_intfdata(usb_intf, NULL); kfree(pdvobjpriv); From ce806322730a2b29fd15c7873c09335a49b7a941 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 16:58:10 +0530 Subject: [PATCH 281/912] staging: rtl8188eu: remove unneeded variable The default value of status was _FAIL, it was only changed if kzalloc succeeds and the check for status is immediately following kzalloc. We can have the failure code in the else part as the failure code will be executed only if kzalloc fails. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index f68875bd9511..2d75c77c8cdb 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -55,7 +55,6 @@ MODULE_DEVICE_TABLE(usb, rtw_usb_id_tbl); static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) { int i; - int status = _FAIL; struct dvobj_priv *pdvobjpriv; struct usb_host_config *phost_conf; struct usb_config_descriptor *pconf_desc; @@ -117,10 +116,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) if (pdvobjpriv->usb_vendor_req_buf) { usb_get_dev(pusbd); - status = _SUCCESS; - } - - if (status != _SUCCESS) { + } else { usb_set_intfdata(usb_intf, NULL); kfree(pdvobjpriv); pdvobjpriv = NULL; From 9aa39bc4d35ca33b406c15da563d6719aae3931e Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 16:58:11 +0530 Subject: [PATCH 282/912] staging: rtl8188eu: stop using DBG_88E Stop using DBG_88E which is a custom macro for printing debugging messages. Instead start using pr_debug and in the process define pr_fmt. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 39 +++++++++++---------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 2d75c77c8cdb..b245e9cd780e 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -19,6 +19,7 @@ ******************************************************************************/ #define _HCI_INTF_C_ +#define pr_fmt(fmt) "R8188EU: " fmt #include #include #include @@ -143,7 +144,7 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf) * on sitesurvey for the first time when * device is up . Reset usb port for sitesurvey * fail issue. */ - DBG_88E("usb attached..., try to reset usb device\n"); + pr_debug("usb attached..., try to reset usb device\n"); usb_reset_device(interface_to_usbdev(usb_intf)); } } @@ -194,7 +195,7 @@ static void rtw_dev_unload(struct adapter *padapter) RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_dev_unload\n")); if (padapter->bup) { - DBG_88E("===> rtw_dev_unload\n"); + pr_debug("===> rtw_dev_unload\n"); padapter->bDriverStopped = true; if (padapter->xmitpriv.ack_tx) rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP); @@ -217,7 +218,7 @@ static void rtw_dev_unload(struct adapter *padapter) ("r871x_dev_unload():padapter->bup == false\n")); } - DBG_88E("<=== rtw_dev_unload\n"); + pr_debug("<=== rtw_dev_unload\n"); RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-rtw_dev_unload\n")); } @@ -234,11 +235,11 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) u32 start_time = jiffies; - DBG_88E("==> %s (%s:%d)\n", __func__, current->comm, current->pid); + pr_debug("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) { - DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", + pr_debug("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", padapter->bup, padapter->bDriverStopped, padapter->bSurpriseRemoved); goto exit; @@ -260,7 +261,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { - DBG_88E("%s:%d %s(%pM), length:%d assoc_ssid.length:%d\n", + pr_debug("%s:%d %s(%pM), length:%d assoc_ssid.length:%d\n", __func__, __LINE__, pmlmepriv->cur_network.network.Ssid.Ssid, pmlmepriv->cur_network.network.MacAddress, @@ -286,7 +287,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) rtw_indicate_disconnect(padapter); exit: - DBG_88E("<=== %s return %d.............. in %dms\n", __func__ + pr_debug("<=== %s return %d.............. in %dms\n", __func__ , ret, rtw_get_passing_time_ms(start_time)); return ret; @@ -299,7 +300,7 @@ static int rtw_resume_process(struct adapter *padapter) int ret = -1; u32 start_time = jiffies; - DBG_88E("==> %s (%s:%d)\n", __func__, current->comm, current->pid); + pr_debug("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if (padapter) { pnetdev = padapter->pnetdev; @@ -312,7 +313,7 @@ static int rtw_resume_process(struct adapter *padapter) rtw_reset_drv_sw(padapter); pwrpriv->bkeepfwalive = false; - DBG_88E("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive); + pr_debug("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive); if (pm_netdev_open(pnetdev, true) != 0) goto exit; @@ -327,7 +328,7 @@ static int rtw_resume_process(struct adapter *padapter) exit: if (pwrpriv) pwrpriv->bInSuspend = false; - DBG_88E("<=== %s return %d.............. in %dms\n", __func__, + pr_debug("<=== %s return %d.............. in %dms\n", __func__, ret, rtw_get_passing_time_ms(start_time)); @@ -400,8 +401,8 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, dvobj->pusbdev->do_remote_wakeup = 1; pusb_intf->needs_remote_wakeup = 1; device_init_wakeup(&pusb_intf->dev, 1); - DBG_88E("\n padapter->pwrctrlpriv.bSupportRemoteWakeup~~~~~~\n"); - DBG_88E("\n padapter->pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n", + pr_debug("\n padapter->pwrctrlpriv.bSupportRemoteWakeup~~~~~~\n"); + pr_debug("\n padapter->pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n", device_may_wakeup(&pusb_intf->dev)); } #endif @@ -409,13 +410,13 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, /* 2012-07-11 Move here to prevent the 8723AS-VAU BT auto * suspend influence */ if (usb_autopm_get_interface(pusb_intf) < 0) - DBG_88E("can't get autopm:\n"); + pr_debug("can't get autopm:\n"); /* alloc dev name after read efuse. */ rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname); rtw_macaddr_cfg(padapter->eeprompriv.mac_addr); memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); - DBG_88E("MAC Address from pnetdev->dev_addr = %pM\n", + pr_debug("MAC Address from pnetdev->dev_addr = %pM\n", pnetdev->dev_addr); /* step 6. Tell the network stack we exist */ @@ -424,7 +425,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, goto free_hal_data; } - DBG_88E("bDriverStopped:%d, bSurpriseRemoved:%d, bup:%d, hw_init_completed:%d\n" + pr_debug("bDriverStopped:%d, bSurpriseRemoved:%d, bup:%d, hw_init_completed:%d\n" , padapter->bDriverStopped , padapter->bSurpriseRemoved , padapter->bup @@ -468,7 +469,7 @@ static void rtw_usb_if1_deinit(struct adapter *if1) rtw_cancel_all_timer(if1); rtw_dev_unload(if1); - DBG_88E("+r871xu_dev_remove, hw_init_completed=%d\n", + pr_debug("+r871xu_dev_remove, hw_init_completed=%d\n", if1->hw_init_completed); rtw_free_drv_sw(if1); if (pnetdev) @@ -493,7 +494,7 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid); if (if1 == NULL) { - DBG_88E("rtw_init_primarystruct adapter Failed!\n"); + pr_debug("rtw_init_primarystruct adapter Failed!\n"); goto free_dvobj; } @@ -518,7 +519,7 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) struct adapter *padapter = dvobj->if1; - DBG_88E("+rtw_dev_remove\n"); + pr_debug("+rtw_dev_remove\n"); RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+dev_remove()\n")); if (!pusb_intf->unregistering) @@ -534,7 +535,7 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) usb_dvobj_deinit(pusb_intf); RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-dev_remove()\n")); - DBG_88E("-r871xu_dev_remove, done\n"); + pr_debug("-r871xu_dev_remove, done\n"); } static struct usb_driver rtl8188e_usb_drv = { From 7d708e52c2295d4d74c58881668a05ff7af8dc16 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 16:58:12 +0530 Subject: [PATCH 283/912] staging: rtl8188eu: remove unneeded ret The variable ret was always 0. So remove the variable and always return 0 from the function. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index b245e9cd780e..5490b2905075 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -230,11 +230,8 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) struct net_device *pnetdev = padapter->pnetdev; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - - int ret = 0; u32 start_time = jiffies; - pr_debug("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if ((!padapter->bup) || (padapter->bDriverStopped) || @@ -287,10 +284,10 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) rtw_indicate_disconnect(padapter); exit: - pr_debug("<=== %s return %d.............. in %dms\n", __func__ - , ret, rtw_get_passing_time_ms(start_time)); + pr_debug("<=== %s .............. in %dms\n", __func__, + rtw_get_passing_time_ms(start_time)); - return ret; + return 0; } static int rtw_resume_process(struct adapter *padapter) From ac4e504a597903f65e6b365eee3e2675a7d8fe4e Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 18:28:17 +0530 Subject: [PATCH 284/912] staging: dgap: fix error path The code in dgap_stop() is almost a duplicate of the code that will be executed on pci_unregister_driver(). So the error code was stopping and unregistering everything twice. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 26b0446d943a..3a783bff112d 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -7133,8 +7133,10 @@ static int dgap_init_module(void) return rc; rc = pci_register_driver(&dgap_driver); - if (rc) - goto err_stop; + if (rc) { + dgap_stop(); + return rc; + } rc = dgap_create_driver_sysfiles(&dgap_driver); if (rc) @@ -7146,9 +7148,6 @@ static int dgap_init_module(void) err_unregister: pci_unregister_driver(&dgap_driver); -err_stop: - dgap_stop(); - return rc; } From eda03951c3edc1f95e974096770ee3b02df2a8f5 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 18:28:18 +0530 Subject: [PATCH 285/912] staging: dgap: rearrange function Relocate the function dgap_stop() so that in a later patch we can remove the duplicate codes between dgap_stop() and dgap_remove_one(). Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 3a783bff112d..8956228a0e52 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -7004,6 +7004,21 @@ static void dgap_cleanup_board(struct board_t *brd) kfree(brd); } +static void dgap_stop(void) +{ + unsigned long lock_flags; + + spin_lock_irqsave(&dgap_poll_lock, lock_flags); + dgap_poll_stop = 1; + spin_unlock_irqrestore(&dgap_poll_lock, lock_flags); + + del_timer_sync(&dgap_poll_timer); + + device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0)); + class_destroy(dgap_class); + unregister_chrdev(DIGI_DGAP_MAJOR, "dgap"); +} + static void dgap_remove_one(struct pci_dev *dev) { unsigned int i; @@ -7096,21 +7111,6 @@ failed_class: return rc; } -static void dgap_stop(void) -{ - unsigned long lock_flags; - - spin_lock_irqsave(&dgap_poll_lock, lock_flags); - dgap_poll_stop = 1; - spin_unlock_irqrestore(&dgap_poll_lock, lock_flags); - - del_timer_sync(&dgap_poll_timer); - - device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0)); - class_destroy(dgap_class); - unregister_chrdev(DIGI_DGAP_MAJOR, "dgap"); -} - /************************************************************************ * * Driver load/unload functions From 174b83c0eb577d7db8f1867f1d76dc14f0b8eb40 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 18:28:19 +0530 Subject: [PATCH 286/912] staging: dgap: new arguments to dgap_stop In a later patch we will remove the duplicate codes. But the code also needs to execute dgap_remove_driver_sysfiles() if it is being called from dgap_remove_one() but if being called fron the error path of the dgap_init_module() then the sysfiles should not be removed. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 8956228a0e52..4f07a0cae987 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -7004,7 +7004,7 @@ static void dgap_cleanup_board(struct board_t *brd) kfree(brd); } -static void dgap_stop(void) +static void dgap_stop(bool removesys, struct pci_driver *drv) { unsigned long lock_flags; @@ -7013,6 +7013,8 @@ static void dgap_stop(void) spin_unlock_irqrestore(&dgap_poll_lock, lock_flags); del_timer_sync(&dgap_poll_timer); + if (removesys) + dgap_remove_driver_sysfiles(drv); device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0)); class_destroy(dgap_class); @@ -7134,7 +7136,7 @@ static int dgap_init_module(void) rc = pci_register_driver(&dgap_driver); if (rc) { - dgap_stop(); + dgap_stop(false, NULL); return rc; } From b8d1f261fe7e4967593a5637d62991b6197a03f8 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 16 Jul 2015 18:28:20 +0530 Subject: [PATCH 287/912] staging: dgap: remove duplicate code Remove the duplicate code of dgap_remove_one() and dgap_stop(). Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 4f07a0cae987..b344e035b0ef 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -7024,22 +7024,9 @@ static void dgap_stop(bool removesys, struct pci_driver *drv) static void dgap_remove_one(struct pci_dev *dev) { unsigned int i; - ulong lock_flags; struct pci_driver *drv = to_pci_driver(dev->dev.driver); - spin_lock_irqsave(&dgap_poll_lock, lock_flags); - dgap_poll_stop = 1; - spin_unlock_irqrestore(&dgap_poll_lock, lock_flags); - - /* Turn off poller right away. */ - del_timer_sync(&dgap_poll_timer); - - dgap_remove_driver_sysfiles(drv); - - device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0)); - class_destroy(dgap_class); - unregister_chrdev(DIGI_DGAP_MAJOR, "dgap"); - + dgap_stop(true, drv); for (i = 0; i < dgap_numboards; ++i) { dgap_remove_ports_sysfiles(dgap_board[i]); dgap_cleanup_tty(dgap_board[i]); From 1dcafd3aeb0a70dbdd11b10269da2afc454e2395 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sun, 19 Jul 2015 01:33:55 +0300 Subject: [PATCH 288/912] iio: Documentation: Remove bytes_per_datum attribute Remove sysfs bytes_per_datum device attribute ABI documentation since the attribute is not present anymore. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- Documentation/ABI/testing/sysfs-bus-iio | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 666a341b01b8..400d23441a61 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -1040,13 +1040,6 @@ Contact: linux-iio@vger.kernel.org Description: Number of scans contained by the buffer. -What: /sys/bus/iio/devices/iio:deviceX/buffer/bytes_per_datum -KernelVersion: 2.6.37 -Contact: linux-iio@vger.kernel.org -Description: - Bytes per scan. Due to alignment fun, the scan may be larger - than implied directly by the scan_element parameters. - What: /sys/bus/iio/devices/iio:deviceX/buffer/enable KernelVersion: 2.6.35 Contact: linux-iio@vger.kernel.org From 07a4257e3d758af96cf98b1e9baadeb627475b03 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sat, 18 Jul 2015 12:30:41 +0000 Subject: [PATCH 289/912] iio: mxs-lradc: clarify supported devices At the beginning the driver supported only i.MX28 SoC, but now the whole MXS platform. So remove any confusing comments which apply only to i.MX28. Signed-off-by: Stefan Wahren Reviewed-by: Marek Vasut Signed-off-by: Jonathan Cameron --- .../bindings/staging/iio/adc/mxs-lradc.txt | 2 +- drivers/staging/iio/adc/mxs-lradc.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt index 307537787574..555fb117d4fa 100644 --- a/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt +++ b/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt @@ -1,4 +1,4 @@ -* Freescale i.MX28 LRADC device driver +* Freescale MXS LRADC device driver Required properties: - compatible: Should be "fsl,imx23-lradc" for i.MX23 SoC and "fsl,imx28-lradc" diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index d7c5223f1c3e..1ccb3676f2e5 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -1,5 +1,5 @@ /* - * Freescale i.MX28 LRADC driver + * Freescale MXS LRADC driver * * Copyright (c) 2012 DENX Software Engineering, GmbH. * Marek Vasut @@ -1392,7 +1392,7 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { MXS_ADC_CHAN(4, IIO_VOLTAGE), MXS_ADC_CHAN(5, IIO_VOLTAGE), MXS_ADC_CHAN(6, IIO_VOLTAGE), - MXS_ADC_CHAN(7, IIO_VOLTAGE), /* VBATT */ + MXS_ADC_CHAN(7, IIO_VOLTAGE), /* Combined Temperature sensors */ { .type = IIO_TEMP, @@ -1411,12 +1411,12 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { .scan_index = -1, .channel = 9, }, - MXS_ADC_CHAN(10, IIO_VOLTAGE), /* VDDIO */ - MXS_ADC_CHAN(11, IIO_VOLTAGE), /* VTH */ - MXS_ADC_CHAN(12, IIO_VOLTAGE), /* VDDA */ - MXS_ADC_CHAN(13, IIO_VOLTAGE), /* VDDD */ - MXS_ADC_CHAN(14, IIO_VOLTAGE), /* VBG */ - MXS_ADC_CHAN(15, IIO_VOLTAGE), /* VDD5V */ + MXS_ADC_CHAN(10, IIO_VOLTAGE), + MXS_ADC_CHAN(11, IIO_VOLTAGE), + MXS_ADC_CHAN(12, IIO_VOLTAGE), + MXS_ADC_CHAN(13, IIO_VOLTAGE), + MXS_ADC_CHAN(14, IIO_VOLTAGE), + MXS_ADC_CHAN(15, IIO_VOLTAGE), }; static int mxs_lradc_hw_init(struct mxs_lradc *lradc) @@ -1707,6 +1707,6 @@ static struct platform_driver mxs_lradc_driver = { module_platform_driver(mxs_lradc_driver); MODULE_AUTHOR("Marek Vasut "); -MODULE_DESCRIPTION("Freescale i.MX28 LRADC driver"); +MODULE_DESCRIPTION("Freescale MXS LRADC driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:" DRIVER_NAME); From 66926d11f326355abbd4e290047a67f17731b404 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sat, 18 Jul 2015 12:30:42 +0000 Subject: [PATCH 290/912] iio: mxs-lradc: fix some spelling errors This patch fix some spelling errors in the comments. Signed-off-by: Stefan Wahren Reviewed-by: Marek Vasut Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 1ccb3676f2e5..386a44da7248 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -65,14 +65,14 @@ * Once the pen touches the touchscreen, the touchscreen switches from * IRQ-driven mode to polling mode to prevent interrupt storm. The polling * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluence and does not strain the system + * This gives the touchscreen enough fluency and does not strain the system * too much. */ #define LRADC_TS_SAMPLE_DELAY_MS 5 /* * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes avarage of these. + * channel and the driver then computes average of these. */ #define LRADC_TS_SAMPLE_AMOUNT 4 @@ -238,7 +238,7 @@ struct mxs_lradc { * CH5 -- Touch screen YNLR * CH6 -- Touch screen WIPER (5-wire only) * - * The bitfields below represents which parts of the LRADC block are + * The bit fields below represents which parts of the LRADC block are * switched into special mode of operation. These channels can not * be sampled as regular LRADC channels. The driver will refuse any * attempt to sample these channels. @@ -252,7 +252,7 @@ struct mxs_lradc { struct input_dev *ts_input; enum mxs_lradc_id soc; - enum lradc_ts_plate cur_plate; /* statemachine */ + enum lradc_ts_plate cur_plate; /* state machine */ bool ts_valid; unsigned ts_x_pos; unsigned ts_y_pos; @@ -812,7 +812,7 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) int ret; /* - * See if there is no buffered operation in progess. If there is, simply + * See if there is no buffered operation in progress. If there is, simply * bail out. This can be improved to support both buffered and raw IO at * the same time, yet the code becomes horribly complicated. Therefore I * applied KISS principle here. From 5723dde958582483501fc2307cf2258060151339 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sat, 18 Jul 2015 12:30:43 +0000 Subject: [PATCH 291/912] iio: mxs-lradc: add missing include This patch adds the missing include for mutex handling. Signed-off-by: Stefan Wahren Reviewed-by: Marek Vasut Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 386a44da7248..763075ba3423 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include From 3eaf20288c9e0e5a2620c4908ac215655ebf0a00 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sat, 18 Jul 2015 12:30:44 +0000 Subject: [PATCH 292/912] iio: mxs-lradc: remove unnecessary header includes This patch removes the unnecessary header includes. Signed-off-by: Stefan Wahren Reviewed-by: Marek Vasut Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 763075ba3423..21b0ccfe5603 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -23,18 +23,13 @@ #include #include #include -#include #include #include #include #include -#include -#include -#include #include #include #include -#include #include #include From ae5896d48180520629655a9356737fe6dbc5e9e5 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sat, 18 Jul 2015 12:30:45 +0000 Subject: [PATCH 293/912] iio: mxs-lradc: reorder header includes This patch reorder the header includes alphabetically. Signed-off-by: Stefan Wahren Reviewed-by: Marek Vasut Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 21b0ccfe5603..3a549eff7e71 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -15,30 +15,30 @@ * GNU General Public License for more details. */ -#include -#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include #include +#include #include #include +#include +#include #include +#include #include -#include -#include -#include -#include +#include -#include -#include #include +#include #include #include #include +#include #define DRIVER_NAME "mxs-lradc" From 829aed1a6e2cbceb2d2fe0f7557dea71fb38cec6 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sat, 18 Jul 2015 12:30:46 +0000 Subject: [PATCH 294/912] iio: mxs-lradc: add datasheet name for every usable channel In order to provide a channel name to in kernel consumers add the datasheet names for every usable AD channel. Since the channel names differ between i.MX23 and i.MX28, we need to separate the channel specs. Signed-off-by: Stefan Wahren Reviewed-by: Marek Vasut Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 80 ++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 3a549eff7e71..3f7715c9968b 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -1365,7 +1365,7 @@ static const struct iio_buffer_setup_ops mxs_lradc_buffer_ops = { * Driver initialization */ -#define MXS_ADC_CHAN(idx, chan_type) { \ +#define MXS_ADC_CHAN(idx, chan_type, name) { \ .type = (chan_type), \ .indexed = 1, \ .scan_index = (idx), \ @@ -1378,17 +1378,18 @@ static const struct iio_buffer_setup_ops mxs_lradc_buffer_ops = { .realbits = LRADC_RESOLUTION, \ .storagebits = 32, \ }, \ + .datasheet_name = (name), \ } -static const struct iio_chan_spec mxs_lradc_chan_spec[] = { - MXS_ADC_CHAN(0, IIO_VOLTAGE), - MXS_ADC_CHAN(1, IIO_VOLTAGE), - MXS_ADC_CHAN(2, IIO_VOLTAGE), - MXS_ADC_CHAN(3, IIO_VOLTAGE), - MXS_ADC_CHAN(4, IIO_VOLTAGE), - MXS_ADC_CHAN(5, IIO_VOLTAGE), - MXS_ADC_CHAN(6, IIO_VOLTAGE), - MXS_ADC_CHAN(7, IIO_VOLTAGE), +static const struct iio_chan_spec mx23_lradc_chan_spec[] = { + MXS_ADC_CHAN(0, IIO_VOLTAGE, "LRADC0"), + MXS_ADC_CHAN(1, IIO_VOLTAGE, "LRADC1"), + MXS_ADC_CHAN(2, IIO_VOLTAGE, "LRADC2"), + MXS_ADC_CHAN(3, IIO_VOLTAGE, "LRADC3"), + MXS_ADC_CHAN(4, IIO_VOLTAGE, "LRADC4"), + MXS_ADC_CHAN(5, IIO_VOLTAGE, "LRADC5"), + MXS_ADC_CHAN(6, IIO_VOLTAGE, "VDDIO"), + MXS_ADC_CHAN(7, IIO_VOLTAGE, "VBATT"), /* Combined Temperature sensors */ { .type = IIO_TEMP, @@ -1399,6 +1400,7 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { BIT(IIO_CHAN_INFO_SCALE), .channel = 8, .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,}, + .datasheet_name = "TEMP_DIE", }, /* Hidden channel to keep indexes */ { @@ -1407,12 +1409,48 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { .scan_index = -1, .channel = 9, }, - MXS_ADC_CHAN(10, IIO_VOLTAGE), - MXS_ADC_CHAN(11, IIO_VOLTAGE), - MXS_ADC_CHAN(12, IIO_VOLTAGE), - MXS_ADC_CHAN(13, IIO_VOLTAGE), - MXS_ADC_CHAN(14, IIO_VOLTAGE), - MXS_ADC_CHAN(15, IIO_VOLTAGE), + MXS_ADC_CHAN(10, IIO_VOLTAGE, NULL), + MXS_ADC_CHAN(11, IIO_VOLTAGE, NULL), + MXS_ADC_CHAN(12, IIO_VOLTAGE, "USB_DP"), + MXS_ADC_CHAN(13, IIO_VOLTAGE, "USB_DN"), + MXS_ADC_CHAN(14, IIO_VOLTAGE, "VBG"), + MXS_ADC_CHAN(15, IIO_VOLTAGE, "VDD5V"), +}; + +static const struct iio_chan_spec mx28_lradc_chan_spec[] = { + MXS_ADC_CHAN(0, IIO_VOLTAGE, "LRADC0"), + MXS_ADC_CHAN(1, IIO_VOLTAGE, "LRADC1"), + MXS_ADC_CHAN(2, IIO_VOLTAGE, "LRADC2"), + MXS_ADC_CHAN(3, IIO_VOLTAGE, "LRADC3"), + MXS_ADC_CHAN(4, IIO_VOLTAGE, "LRADC4"), + MXS_ADC_CHAN(5, IIO_VOLTAGE, "LRADC5"), + MXS_ADC_CHAN(6, IIO_VOLTAGE, "LRADC6"), + MXS_ADC_CHAN(7, IIO_VOLTAGE, "VBATT"), + /* Combined Temperature sensors */ + { + .type = IIO_TEMP, + .indexed = 1, + .scan_index = 8, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_OFFSET) | + BIT(IIO_CHAN_INFO_SCALE), + .channel = 8, + .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,}, + .datasheet_name = "TEMP_DIE", + }, + /* Hidden channel to keep indexes */ + { + .type = IIO_TEMP, + .indexed = 1, + .scan_index = -1, + .channel = 9, + }, + MXS_ADC_CHAN(10, IIO_VOLTAGE, "VDDIO"), + MXS_ADC_CHAN(11, IIO_VOLTAGE, "VTH"), + MXS_ADC_CHAN(12, IIO_VOLTAGE, "VDDA"), + MXS_ADC_CHAN(13, IIO_VOLTAGE, "VDDD"), + MXS_ADC_CHAN(14, IIO_VOLTAGE, "VBG"), + MXS_ADC_CHAN(15, IIO_VOLTAGE, "VDD5V"), }; static int mxs_lradc_hw_init(struct mxs_lradc *lradc) @@ -1608,10 +1646,16 @@ static int mxs_lradc_probe(struct platform_device *pdev) iio->dev.parent = &pdev->dev; iio->info = &mxs_lradc_iio_info; iio->modes = INDIO_DIRECT_MODE; - iio->channels = mxs_lradc_chan_spec; - iio->num_channels = ARRAY_SIZE(mxs_lradc_chan_spec); iio->masklength = LRADC_MAX_TOTAL_CHANS; + if (lradc->soc == IMX23_LRADC) { + iio->channels = mx23_lradc_chan_spec; + iio->num_channels = ARRAY_SIZE(mx23_lradc_chan_spec); + } else { + iio->channels = mx28_lradc_chan_spec; + iio->num_channels = ARRAY_SIZE(mx28_lradc_chan_spec); + } + ret = iio_triggered_buffer_setup(iio, &iio_pollfunc_store_time, &mxs_lradc_trigger_handler, &mxs_lradc_buffer_ops); From 23633314e60796f860d5a0484b722557061cde7c Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sat, 18 Jul 2015 00:56:57 +0200 Subject: [PATCH 295/912] iio:light:acpi-als: add missing prefixes Some macros and a function were missing the acpi_als_ prefix, so add it. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/light/acpi-als.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c index 1dafa0756bfa..60537ec0c923 100644 --- a/drivers/iio/light/acpi-als.c +++ b/drivers/iio/light/acpi-als.c @@ -65,20 +65,20 @@ static const struct iio_chan_spec acpi_als_channels[] = { * to acpi_als_channels[], the evt_buffer below will grow * automatically. */ -#define EVT_NR_SOURCES ARRAY_SIZE(acpi_als_channels) -#define EVT_BUFFER_SIZE \ - (sizeof(s64) + (EVT_NR_SOURCES * sizeof(s32))) +#define ACPI_ALS_EVT_NR_SOURCES ARRAY_SIZE(acpi_als_channels) +#define ACPI_ALS_EVT_BUFFER_SIZE \ + (sizeof(s64) + (ACPI_ALS_EVT_NR_SOURCES * sizeof(s32))) struct acpi_als { struct acpi_device *device; struct mutex lock; - s32 evt_buffer[EVT_BUFFER_SIZE]; + s32 evt_buffer[ACPI_ALS_EVT_BUFFER_SIZE]; }; /* * All types of properties the ACPI0008 block can report. The ALI, ALC, ALT - * and ALP can all be handled by als_read_value() below, while the ALR is + * and ALP can all be handled by acpi_als_read_value() below, while the ALR is * special. * * The _ALR property returns tables that can be used to fine-tune the values @@ -93,7 +93,7 @@ struct acpi_als { #define ACPI_ALS_POLLING "_ALP" #define ACPI_ALS_TABLES "_ALR" -static int als_read_value(struct acpi_als *als, char *prop, s32 *val) +static int acpi_als_read_value(struct acpi_als *als, char *prop, s32 *val) { unsigned long long temp_val; acpi_status status; @@ -122,11 +122,11 @@ static void acpi_als_notify(struct acpi_device *device, u32 event) mutex_lock(&als->lock); - memset(buffer, 0, EVT_BUFFER_SIZE); + memset(buffer, 0, ACPI_ALS_EVT_BUFFER_SIZE); switch (event) { case ACPI_ALS_NOTIFY_ILLUMINANCE: - ret = als_read_value(als, ACPI_ALS_ILLUMINANCE, &val); + ret = acpi_als_read_value(als, ACPI_ALS_ILLUMINANCE, &val); if (ret < 0) goto out; *buffer++ = val; @@ -159,7 +159,7 @@ static int acpi_als_read_raw(struct iio_dev *indio_dev, if (chan->type != IIO_LIGHT) return -EINVAL; - ret = als_read_value(als, ACPI_ALS_ILLUMINANCE, &temp_val); + ret = acpi_als_read_value(als, ACPI_ALS_ILLUMINANCE, &temp_val); if (ret < 0) return ret; From 7dbf1ea8aade8c3b2759acc96e5e709016e6ae28 Mon Sep 17 00:00:00 2001 From: Jandy Gou Date: Fri, 17 Jul 2015 16:34:35 +0800 Subject: [PATCH 296/912] iio: magnetometer: mmc35240: Add DT binding Signed-off-by: Jandy Gou Acked-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/mmc35240.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index 7a2ea71c659a..9bc542daa732 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c @@ -550,6 +550,12 @@ static const struct dev_pm_ops mmc35240_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(mmc35240_suspend, mmc35240_resume) }; +static const struct of_device_id mmc35240_of_match[] = { + { .compatible = "memsic,mmc35240", }, + { } +}; +MODULE_DEVICE_TABLE(of, mmc35240_of_match); + static const struct acpi_device_id mmc35240_acpi_match[] = { {"MMC35240", 0}, { }, @@ -565,6 +571,7 @@ MODULE_DEVICE_TABLE(i2c, mmc35240_id); static struct i2c_driver mmc35240_driver = { .driver = { .name = MMC35240_DRV_NAME, + .of_match_table = mmc35240_of_match, .pm = &mmc35240_pm_ops, .acpi_match_table = ACPI_PTR(mmc35240_acpi_match), }, From 2563f7fc83d655792ec9999e2dda7a37172ae6aa Mon Sep 17 00:00:00 2001 From: Jandy Gou Date: Fri, 17 Jul 2015 16:34:36 +0800 Subject: [PATCH 297/912] iio: magnetometer: mmc35240: Add DT binding doc Signed-off-by: Jandy Gou Signed-off-by: Jonathan Cameron --- .../bindings/iio/magnetometer/mmc35240.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/mmc35240.txt diff --git a/Documentation/devicetree/bindings/iio/magnetometer/mmc35240.txt b/Documentation/devicetree/bindings/iio/magnetometer/mmc35240.txt new file mode 100644 index 000000000000..a01235c7fa15 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/magnetometer/mmc35240.txt @@ -0,0 +1,13 @@ +* MEMSIC MMC35240 magnetometer sensor + +Required properties: + + - compatible : should be "memsic,mmc35240" + - reg : the I2C address of the magnetometer + +Example: + +mmc35240@30 { + compatible = "memsic,mmc35240"; + reg = <0x30>; +}; From 47764c7918f5dd648ae8f6f61db1aaab1b9c09dd Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Fri, 17 Jul 2015 10:52:27 +0200 Subject: [PATCH 298/912] iio:magnetometer:bmc150_magn: replace magic value Construct the scanmask using its descriptive axis names (as used in iio_chan_spec) instead of a 'magic' value. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/bmc150_magn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index cd002710dd02..074a99da7367 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -651,7 +651,9 @@ static const struct iio_info bmc150_magn_info = { .driver_module = THIS_MODULE, }; -static const unsigned long bmc150_magn_scan_masks[] = {0x07, 0}; +static const unsigned long bmc150_magn_scan_masks[] = { + BIT(AXIS_X) | BIT(AXIS_Y) | BIT(AXIS_Z), + 0}; static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p) { From f686a36b4b79782a94f07769fb1c0187d24ea8a8 Mon Sep 17 00:00:00 2001 From: Andrea Galbusera Date: Tue, 14 Jul 2015 15:36:21 +0200 Subject: [PATCH 299/912] iio: adc: mcp320x: Add support for mcp3301 This adds support for Microchip's 13 bit 1 channel AD converter MCP3301 Signed-off-by: Andrea Galbusera Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/adc/mcp320x.txt | 1 + drivers/iio/adc/Kconfig | 4 ++-- drivers/iio/adc/mcp320x.c | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/mcp320x.txt b/Documentation/devicetree/bindings/iio/adc/mcp320x.txt index b85184391b78..2a1f3af30155 100644 --- a/Documentation/devicetree/bindings/iio/adc/mcp320x.txt +++ b/Documentation/devicetree/bindings/iio/adc/mcp320x.txt @@ -18,6 +18,7 @@ Required properties: "mcp3202" "mcp3204" "mcp3208" + "mcp3301" Examples: diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index dace593b158b..2714f043fa6c 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -229,8 +229,8 @@ config MCP320X depends on SPI help Say yes here to build support for Microchip Technology's - MCP3001, MCP3002, MCP3004, MCP3008, MCP3201, MCP3202, MCP3204 or - MCP3208 analog to digital converter. + MCP3001, MCP3002, MCP3004, MCP3008, MCP3201, MCP3202, MCP3204, + MCP3208 or MCP3301 analog to digital converter. This driver can also be built as a module. If so, the module will be called mcp320x. diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c index 8d9c9b9215dd..72969c8a0a51 100644 --- a/drivers/iio/adc/mcp320x.c +++ b/drivers/iio/adc/mcp320x.c @@ -25,6 +25,7 @@ * http://ww1.microchip.com/downloads/en/DeviceDoc/21290D.pdf mcp3201 * http://ww1.microchip.com/downloads/en/DeviceDoc/21034D.pdf mcp3202 * http://ww1.microchip.com/downloads/en/DeviceDoc/21298c.pdf mcp3204/08 + * http://ww1.microchip.com/downloads/en/DeviceDoc/21700E.pdf mcp3301 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -47,6 +48,7 @@ enum { mcp3202, mcp3204, mcp3208, + mcp3301, }; struct mcp320x_chip_info { @@ -76,6 +78,7 @@ static int mcp320x_channel_to_tx_data(int device_index, switch (device_index) { case mcp3001: case mcp3201: + case mcp3301: return 0; case mcp3002: case mcp3202: @@ -102,7 +105,7 @@ static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel, adc->tx_buf = mcp320x_channel_to_tx_data(device_index, channel, differential); - if (device_index != mcp3001 && device_index != mcp3201) { + if (device_index != mcp3001 && device_index != mcp3201 && device_index != mcp3301) { ret = spi_sync(adc->spi, &adc->msg); if (ret < 0) return ret; @@ -125,6 +128,8 @@ static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel, case mcp3204: case mcp3208: return (adc->rx_buf[0] << 4 | adc->rx_buf[1] >> 4); + case mcp3301: + return sign_extend32((adc->rx_buf[0] & 0x1f) << 8 | adc->rx_buf[1], 12); default: return -EINVAL; } @@ -274,6 +279,11 @@ static const struct mcp320x_chip_info mcp320x_chip_infos[] = { .num_channels = ARRAY_SIZE(mcp3208_channels), .resolution = 12 }, + [mcp3301] = { + .channels = mcp3201_channels, + .num_channels = ARRAY_SIZE(mcp3201_channels), + .resolution = 13 + }, }; static int mcp320x_probe(struct spi_device *spi) @@ -366,6 +376,9 @@ static const struct of_device_id mcp320x_dt_ids[] = { }, { .compatible = "mcp3208", .data = &mcp320x_chip_infos[mcp3208], + }, { + .compatible = "mcp3301", + .data = &mcp320x_chip_infos[mcp3301], }, { } }; @@ -381,6 +394,7 @@ static const struct spi_device_id mcp320x_id[] = { { "mcp3202", mcp3202 }, { "mcp3204", mcp3204 }, { "mcp3208", mcp3208 }, + { "mcp3301", mcp3301 }, { } }; MODULE_DEVICE_TABLE(spi, mcp320x_id); From 5e9972cd6f1a69ee8a8ee8664d3e4c4ea59c0901 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 14 Jul 2015 19:23:22 +0530 Subject: [PATCH 300/912] iio: adc: vf610: Determine sampling frequencies by using minimum sample time The driver currently does not take into account the minimum sample time as per the Figure 6-8 Chapter 9.1.1 12-bit ADC electrical characteristics. We set a static amount of cycles instead of considering the sample time as a given value, which depends on hardware characteristics. Determine sampling frequencies by first reading the device tree property node and then calculating the required Long Sample Time Adder (LSTAdder) value, based on the ADC clock frequency and sample time value obtained from the device tree. This LSTAdder value is then used for calculating the sampling frequencies possible. In case the sample time property is not specified through the device tree, a safe default value of 1000ns is assumed. Signed-off-by: Sanchayan Maity Acked-by: Stefan Agner Acked-by: Fugang Duan Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/adc/vf610-adc.txt | 5 ++ drivers/iio/adc/vf610_adc.c | 79 ++++++++++++++++++- 2 files changed, 80 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/vf610-adc.txt b/Documentation/devicetree/bindings/iio/adc/vf610-adc.txt index 3eb40e20c143..1aad0514e647 100644 --- a/Documentation/devicetree/bindings/iio/adc/vf610-adc.txt +++ b/Documentation/devicetree/bindings/iio/adc/vf610-adc.txt @@ -17,6 +17,11 @@ Recommended properties: - Frequency in normal mode (ADLPC=0, ADHSC=0) - Frequency in high-speed mode (ADLPC=0, ADHSC=1) - Frequency in low-power mode (ADLPC=1, ADHSC=0) +- min-sample-time: Minimum sampling time in nanoseconds. This value has + to be chosen according to the conversion mode and the connected analog + source resistance (R_as) and capacitance (C_as). Refer the datasheet's + operating requirements. A safe default across a wide range of R_as and + C_as as well as conversion modes is 1000ns. Example: adc0: adc@4003b000 { diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index 480f335a0f9f..23b8fb94ec09 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c @@ -68,6 +68,9 @@ #define VF610_ADC_CLK_DIV8 0x60 #define VF610_ADC_CLK_MASK 0x60 #define VF610_ADC_ADLSMP_LONG 0x10 +#define VF610_ADC_ADSTS_SHORT 0x100 +#define VF610_ADC_ADSTS_NORMAL 0x200 +#define VF610_ADC_ADSTS_LONG 0x300 #define VF610_ADC_ADSTS_MASK 0x300 #define VF610_ADC_ADLPC_EN 0x80 #define VF610_ADC_ADHSC_EN 0x400 @@ -98,6 +101,8 @@ #define VF610_ADC_CALF 0x2 #define VF610_ADC_TIMEOUT msecs_to_jiffies(100) +#define DEFAULT_SAMPLE_TIME 1000 + enum clk_sel { VF610_ADCIOC_BUSCLK_SET, VF610_ADCIOC_ALTCLK_SET, @@ -124,6 +129,17 @@ enum conversion_mode_sel { VF610_ADC_CONV_LOW_POWER, }; +enum lst_adder_sel { + VF610_ADCK_CYCLES_3, + VF610_ADCK_CYCLES_5, + VF610_ADCK_CYCLES_7, + VF610_ADCK_CYCLES_9, + VF610_ADCK_CYCLES_13, + VF610_ADCK_CYCLES_17, + VF610_ADCK_CYCLES_21, + VF610_ADCK_CYCLES_25, +}; + struct vf610_adc_feature { enum clk_sel clk_sel; enum vol_ref vol_ref; @@ -132,6 +148,8 @@ struct vf610_adc_feature { int clk_div; int sample_rate; int res_mode; + u32 lst_adder_index; + u32 default_sample_time; bool calibration; bool ovwren; @@ -155,11 +173,13 @@ struct vf610_adc { }; static const u32 vf610_hw_avgs[] = { 1, 4, 8, 16, 32 }; +static const u32 vf610_lst_adder[] = { 3, 5, 7, 9, 13, 17, 21, 25 }; static inline void vf610_adc_calculate_rates(struct vf610_adc *info) { struct vf610_adc_feature *adc_feature = &info->adc_feature; unsigned long adck_rate, ipg_rate = clk_get_rate(info->clk); + u32 adck_period, lst_addr_min; int divisor, i; adck_rate = info->max_adck_rate[adc_feature->conv_mode]; @@ -173,6 +193,19 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info) adc_feature->clk_div = 8; } + /* + * Determine the long sample time adder value to be used based + * on the default minimum sample time provided. + */ + adck_period = NSEC_PER_SEC / adck_rate; + lst_addr_min = adc_feature->default_sample_time / adck_period; + for (i = 0; i < ARRAY_SIZE(vf610_lst_adder); i++) { + if (vf610_lst_adder[i] > lst_addr_min) { + adc_feature->lst_adder_index = i; + break; + } + } + /* * Calculate ADC sample frequencies * Sample time unit is ADCK cycles. ADCK clk source is ipg clock, @@ -182,12 +215,13 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info) * SFCAdder: fixed to 6 ADCK cycles * AverageNum: 1, 4, 8, 16, 32 samples for hardware average. * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode - * LSTAdder(Long Sample Time): fixed to 3 ADCK cycles + * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles */ adck_rate = ipg_rate / info->adc_feature.clk_div; for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++) info->sample_freq_avail[i] = - adck_rate / (6 + vf610_hw_avgs[i] * (25 + 3)); + adck_rate / (6 + vf610_hw_avgs[i] * + (25 + vf610_lst_adder[adc_feature->lst_adder_index])); } static inline void vf610_adc_cfg_init(struct vf610_adc *info) @@ -347,8 +381,40 @@ static void vf610_adc_sample_set(struct vf610_adc *info) break; } - /* Use the short sample mode */ - cfg_data &= ~(VF610_ADC_ADLSMP_LONG | VF610_ADC_ADSTS_MASK); + /* + * Set ADLSMP and ADSTS based on the Long Sample Time Adder value + * determined. + */ + switch (adc_feature->lst_adder_index) { + case VF610_ADCK_CYCLES_3: + break; + case VF610_ADCK_CYCLES_5: + cfg_data |= VF610_ADC_ADSTS_SHORT; + break; + case VF610_ADCK_CYCLES_7: + cfg_data |= VF610_ADC_ADSTS_NORMAL; + break; + case VF610_ADCK_CYCLES_9: + cfg_data |= VF610_ADC_ADSTS_LONG; + break; + case VF610_ADCK_CYCLES_13: + cfg_data |= VF610_ADC_ADLSMP_LONG; + break; + case VF610_ADCK_CYCLES_17: + cfg_data |= VF610_ADC_ADLSMP_LONG; + cfg_data |= VF610_ADC_ADSTS_SHORT; + break; + case VF610_ADCK_CYCLES_21: + cfg_data |= VF610_ADC_ADLSMP_LONG; + cfg_data |= VF610_ADC_ADSTS_NORMAL; + break; + case VF610_ADCK_CYCLES_25: + cfg_data |= VF610_ADC_ADLSMP_LONG; + cfg_data |= VF610_ADC_ADSTS_NORMAL; + break; + default: + dev_err(info->dev, "error in sample time select\n"); + } /* update hardware average selection */ cfg_data &= ~VF610_ADC_AVGS_MASK; @@ -713,6 +779,11 @@ static int vf610_adc_probe(struct platform_device *pdev) of_property_read_u32_array(pdev->dev.of_node, "fsl,adck-max-frequency", info->max_adck_rate, 3); + ret = of_property_read_u32(pdev->dev.of_node, "min-sample-time", + &info->adc_feature.default_sample_time); + if (ret) + info->adc_feature.default_sample_time = DEFAULT_SAMPLE_TIME; + platform_set_drvdata(pdev, indio_dev); init_completion(&info->completion); From 889c5e9b668670c91dcd3a8f2b15a0b2086f4827 Mon Sep 17 00:00:00 2001 From: Harald Geyer Date: Tue, 7 Jul 2015 13:39:28 +0000 Subject: [PATCH 301/912] iio: dht11: whitespace changes to make checkpatch.pl --strict happy * add spaces around binary operators in cases where it reduces readability * align multiline statements around opening parenthesis Reported-by: Hartmut Knaack in Message-ID: <55919E72.3010807@gmx.de> Signed-off-by: Harald Geyer Signed-off-by: Jonathan Cameron --- drivers/iio/humidity/dht11.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c index 7d79a1ac5f5f..343d26af1dd8 100644 --- a/drivers/iio/humidity/dht11.c +++ b/drivers/iio/humidity/dht11.c @@ -46,7 +46,8 @@ * Note that when reading the sensor actually 84 edges are detected, but * since the last edge is not significant, we only store 83: */ -#define DHT11_EDGES_PER_READ (2*DHT11_BITS_PER_READ + DHT11_EDGES_PREAMBLE + 1) +#define DHT11_EDGES_PER_READ (2 * DHT11_BITS_PER_READ + \ + DHT11_EDGES_PREAMBLE + 1) /* Data transmission timing (nano seconds) */ #define DHT11_START_TRANSMISSION 18 /* ms */ @@ -95,24 +96,24 @@ static int dht11_decode(struct dht11 *dht11, int offset) /* Calculate timestamp resolution */ for (i = 1; i < dht11->num_edges; ++i) { - t = dht11->edges[i].ts - dht11->edges[i-1].ts; + t = dht11->edges[i].ts - dht11->edges[i - 1].ts; if (t > 0 && t < timeres) timeres = t; } - if (2*timeres > DHT11_DATA_BIT_HIGH) { + if (2 * timeres > DHT11_DATA_BIT_HIGH) { pr_err("dht11: timeresolution %d too bad for decoding\n", - timeres); + timeres); return -EIO; } threshold = DHT11_DATA_BIT_HIGH / timeres; - if (DHT11_DATA_BIT_LOW/timeres + 1 >= threshold) + if (DHT11_DATA_BIT_LOW / timeres + 1 >= threshold) pr_err("dht11: WARNING: decoding ambiguous\n"); /* scale down with timeres and check validity */ for (i = 0; i < DHT11_BITS_PER_READ; ++i) { - t = dht11->edges[offset + 2*i + 2].ts - - dht11->edges[offset + 2*i + 1].ts; - if (!dht11->edges[offset + 2*i + 1].value) + t = dht11->edges[offset + 2 * i + 2].ts - + dht11->edges[offset + 2 * i + 1].ts; + if (!dht11->edges[offset + 2 * i + 1].value) return -EIO; /* lost synchronisation */ timing[i] = t / timeres; } @@ -166,7 +167,7 @@ static irqreturn_t dht11_handle_irq(int irq, void *data) } static int dht11_read_raw(struct iio_dev *iio_dev, - const struct iio_chan_spec *chan, + const struct iio_chan_spec *chan, int *val, int *val2, long m) { struct dht11 *dht11 = iio_priv(iio_dev); @@ -192,13 +193,13 @@ static int dht11_read_raw(struct iio_dev *iio_dev, goto err; ret = wait_for_completion_killable_timeout(&dht11->completion, - HZ); + HZ); free_irq(dht11->irq, iio_dev); if (ret == 0 && dht11->num_edges < DHT11_EDGES_PER_READ - 1) { dev_err(&iio_dev->dev, - "Only %d signal edges detected\n", + "Only %d signal edges detected\n", dht11->num_edges); ret = -ETIMEDOUT; } @@ -206,7 +207,7 @@ static int dht11_read_raw(struct iio_dev *iio_dev, goto err; ret = dht11_decode(dht11, - dht11->num_edges == DHT11_EDGES_PER_READ ? + dht11->num_edges == DHT11_EDGES_PER_READ ? DHT11_EDGES_PREAMBLE : DHT11_EDGES_PREAMBLE - 2); if (ret) From a7126003b6dd47c0088d952734379ef471156c5f Mon Sep 17 00:00:00 2001 From: Harald Geyer Date: Tue, 7 Jul 2015 13:39:29 +0000 Subject: [PATCH 302/912] iio: dht11: add comment to make checkpatch.pl --strict happy Explain why the driver needs a mutex. Signed-off-by: Harald Geyer Signed-off-by: Jonathan Cameron --- drivers/iio/humidity/dht11.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c index 343d26af1dd8..bb5ad57ed2a2 100644 --- a/drivers/iio/humidity/dht11.c +++ b/drivers/iio/humidity/dht11.c @@ -63,6 +63,7 @@ struct dht11 { int irq; struct completion completion; + /* The iio sysfs interface doesn't prevent concurrent reads: */ struct mutex lock; s64 timestamp; From 5fbb0bc466b7b43036b1dd8c9e9166ca9e69e07a Mon Sep 17 00:00:00 2001 From: Harald Geyer Date: Tue, 7 Jul 2015 13:39:30 +0000 Subject: [PATCH 303/912] iio: dht11: avoid multiple assignments to make checkpatch.pl --strict happy We just do the assignments in two steps. Signed-off-by: Harald Geyer Signed-off-by: Jonathan Cameron --- drivers/iio/humidity/dht11.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c index bb5ad57ed2a2..91976e06f1c6 100644 --- a/drivers/iio/humidity/dht11.c +++ b/drivers/iio/humidity/dht11.c @@ -263,9 +263,10 @@ static int dht11_probe(struct platform_device *pdev) dht11 = iio_priv(iio); dht11->dev = dev; - dht11->gpio = ret = of_get_gpio(node, 0); + ret = of_get_gpio(node, 0); if (ret < 0) return ret; + dht11->gpio = ret; ret = devm_gpio_request_one(dev, dht11->gpio, GPIOF_IN, pdev->name); if (ret) return ret; From 081d974031bafb204d64de3e82f398daf1d0b899 Mon Sep 17 00:00:00 2001 From: Harald Geyer Date: Tue, 7 Jul 2015 13:39:31 +0000 Subject: [PATCH 304/912] iio: dht11: Use new function ktime_get_resolution_ns() This cleans up the most ugly workaround in this driver. There are no functional changes yet in the decoding algorithm, but we improve the following things: * Get rid of spurious warning messages on systems with fast HRTIMER. * If the clock is not fast enough for decoding to work, we give up immediately. * In that case we return EAGAIN instead of EIO, so it's easier to discriminate causes of failure. Returning EAGAIN is somewhat controversial: It's technically correct as a faster clock might become available. OTOH once all clocks are enabled this is a permanent error. There is no ECLOCKTOOSLOW error code. Signed-off-by: Harald Geyer Signed-off-by: Jonathan Cameron --- drivers/iio/humidity/dht11.c | 42 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c index 91976e06f1c6..1165b1c4f9d6 100644 --- a/drivers/iio/humidity/dht11.c +++ b/drivers/iio/humidity/dht11.c @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -89,23 +90,11 @@ static unsigned char dht11_decode_byte(int *timing, int threshold) return ret; } -static int dht11_decode(struct dht11 *dht11, int offset) +static int dht11_decode(struct dht11 *dht11, int offset, int timeres) { - int i, t, timing[DHT11_BITS_PER_READ], threshold, - timeres = DHT11_SENSOR_RESPONSE; + int i, t, timing[DHT11_BITS_PER_READ], threshold; unsigned char temp_int, temp_dec, hum_int, hum_dec, checksum; - /* Calculate timestamp resolution */ - for (i = 1; i < dht11->num_edges; ++i) { - t = dht11->edges[i].ts - dht11->edges[i - 1].ts; - if (t > 0 && t < timeres) - timeres = t; - } - if (2 * timeres > DHT11_DATA_BIT_HIGH) { - pr_err("dht11: timeresolution %d too bad for decoding\n", - timeres); - return -EIO; - } threshold = DHT11_DATA_BIT_HIGH / timeres; if (DHT11_DATA_BIT_LOW / timeres + 1 >= threshold) pr_err("dht11: WARNING: decoding ambiguous\n"); @@ -128,7 +117,7 @@ static int dht11_decode(struct dht11 *dht11, int offset) if (((hum_int + hum_dec + temp_int + temp_dec) & 0xff) != checksum) return -EIO; - dht11->timestamp = iio_get_time_ns(); + dht11->timestamp = ktime_get_real_ns(); if (hum_int < 20) { /* DHT22 */ dht11->temperature = (((temp_int & 0x7f) << 8) + temp_dec) * ((temp_int & 0x80) ? -100 : 100); @@ -156,7 +145,7 @@ static irqreturn_t dht11_handle_irq(int irq, void *data) /* TODO: Consider making the handler safe for IRQ sharing */ if (dht11->num_edges < DHT11_EDGES_PER_READ && dht11->num_edges >= 0) { - dht11->edges[dht11->num_edges].ts = iio_get_time_ns(); + dht11->edges[dht11->num_edges].ts = ktime_get_real_ns(); dht11->edges[dht11->num_edges++].value = gpio_get_value(dht11->gpio); @@ -172,10 +161,22 @@ static int dht11_read_raw(struct iio_dev *iio_dev, int *val, int *val2, long m) { struct dht11 *dht11 = iio_priv(iio_dev); - int ret; + int ret, timeres; mutex_lock(&dht11->lock); - if (dht11->timestamp + DHT11_DATA_VALID_TIME < iio_get_time_ns()) { + if (dht11->timestamp + DHT11_DATA_VALID_TIME < ktime_get_real_ns()) { + timeres = ktime_get_resolution_ns(); + if (DHT11_DATA_BIT_HIGH < 2 * timeres) { + dev_err(dht11->dev, "timeresolution %dns too low\n", + timeres); + /* In theory a better clock could become available + * at some point ... and there is no error code + * that really fits better. + */ + ret = -EAGAIN; + goto err; + } + reinit_completion(&dht11->completion); dht11->num_edges = 0; @@ -210,7 +211,8 @@ static int dht11_read_raw(struct iio_dev *iio_dev, ret = dht11_decode(dht11, dht11->num_edges == DHT11_EDGES_PER_READ ? DHT11_EDGES_PREAMBLE : - DHT11_EDGES_PREAMBLE - 2); + DHT11_EDGES_PREAMBLE - 2, + timeres); if (ret) goto err; } @@ -277,7 +279,7 @@ static int dht11_probe(struct platform_device *pdev) return -EINVAL; } - dht11->timestamp = iio_get_time_ns() - DHT11_DATA_VALID_TIME - 1; + dht11->timestamp = ktime_get_real_ns() - DHT11_DATA_VALID_TIME - 1; dht11->num_edges = -1; platform_set_drvdata(pdev, iio); From 94a9b7b1809f56cfaa080e70ec49b6979563a237 Mon Sep 17 00:00:00 2001 From: Andreas Dannenberg Date: Thu, 2 Jul 2015 17:27:58 -0500 Subject: [PATCH 305/912] iio: light: add support for TI's opt3001 light sensor TI's opt3001 light sensor is a simple and yet powerful little device. The device provides 99% IR rejection, automatic full-scale, very low power consumption and measurements from 0.01 to 83k lux. This patch adds support for that device using the IIO framework. See http://www.ti.com/product/opt3001 for more information. Signed-off-by: Felipe Balbi Signed-off-by: Andreas Dannenberg Signed-off-by: Jonathan Cameron --- drivers/iio/light/Kconfig | 10 + drivers/iio/light/Makefile | 1 + drivers/iio/light/opt3001.c | 804 ++++++++++++++++++++++++++++++++++++ 3 files changed, 815 insertions(+) create mode 100644 drivers/iio/light/opt3001.c diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index 730fa80c83ea..5c0854a7e3e0 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig @@ -209,6 +209,16 @@ config LTR501 This driver can also be built as a module. If so, the module will be called ltr501. +config OPT3001 + tristate "Texas Instruments OPT3001 Light Sensor" + depends on I2C + help + If you say Y or M here, you get support for Texas Instruments + OPT3001 Ambient Light Sensor. + + If built as a dynamically linked module, it will be called + opt3001. + config STK3310 tristate "STK3310 ALS and proximity sensor" depends on I2C diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile index adf97237db72..5345969f7000 100644 --- a/drivers/iio/light/Makefile +++ b/drivers/iio/light/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_ISL29125) += isl29125.o obj-$(CONFIG_JSA1212) += jsa1212.o obj-$(CONFIG_SENSORS_LM3533) += lm3533-als.o obj-$(CONFIG_LTR501) += ltr501.o +obj-$(CONFIG_OPT3001) += opt3001.o obj-$(CONFIG_RPR0521) += rpr0521.o obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o obj-$(CONFIG_STK3310) += stk3310.o diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c new file mode 100644 index 000000000000..923aa6aef0ed --- /dev/null +++ b/drivers/iio/light/opt3001.c @@ -0,0 +1,804 @@ +/** + * opt3001.c - Texas Instruments OPT3001 Light Sensor + * + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com + * + * Author: Andreas Dannenberg + * Based on previous work from: Felipe Balbi + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 of the License + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define OPT3001_RESULT 0x00 +#define OPT3001_CONFIGURATION 0x01 +#define OPT3001_LOW_LIMIT 0x02 +#define OPT3001_HIGH_LIMIT 0x03 +#define OPT3001_MANUFACTURER_ID 0x7e +#define OPT3001_DEVICE_ID 0x7f + +#define OPT3001_CONFIGURATION_RN_MASK (0xf << 12) +#define OPT3001_CONFIGURATION_RN_AUTO (0xc << 12) + +#define OPT3001_CONFIGURATION_CT BIT(11) + +#define OPT3001_CONFIGURATION_M_MASK (3 << 9) +#define OPT3001_CONFIGURATION_M_SHUTDOWN (0 << 9) +#define OPT3001_CONFIGURATION_M_SINGLE (1 << 9) +#define OPT3001_CONFIGURATION_M_CONTINUOUS (2 << 9) /* also 3 << 9 */ + +#define OPT3001_CONFIGURATION_OVF BIT(8) +#define OPT3001_CONFIGURATION_CRF BIT(7) +#define OPT3001_CONFIGURATION_FH BIT(6) +#define OPT3001_CONFIGURATION_FL BIT(5) +#define OPT3001_CONFIGURATION_L BIT(4) +#define OPT3001_CONFIGURATION_POL BIT(3) +#define OPT3001_CONFIGURATION_ME BIT(2) + +#define OPT3001_CONFIGURATION_FC_MASK (3 << 0) + +/* The end-of-conversion enable is located in the low-limit register */ +#define OPT3001_LOW_LIMIT_EOC_ENABLE 0xc000 + +#define OPT3001_REG_EXPONENT(n) ((n) >> 12) +#define OPT3001_REG_MANTISSA(n) ((n) & 0xfff) + +/* + * Time to wait for conversion result to be ready. The device datasheet + * worst-case max value is 880ms. Add some slack to be on the safe side. + */ +#define OPT3001_RESULT_READY_TIMEOUT msecs_to_jiffies(1000) + +struct opt3001 { + struct i2c_client *client; + struct device *dev; + + struct mutex lock; + u16 ok_to_ignore_lock:1; + u16 result_ready:1; + wait_queue_head_t result_ready_queue; + u16 result; + + u32 int_time; + u32 mode; + + u16 high_thresh_mantissa; + u16 low_thresh_mantissa; + + u8 high_thresh_exp; + u8 low_thresh_exp; +}; + +struct opt3001_scale { + int val; + int val2; +}; + +static const struct opt3001_scale opt3001_scales[] = { + { + .val = 40, + .val2 = 950000, + }, + { + .val = 81, + .val2 = 900000, + }, + { + .val = 163, + .val2 = 800000, + }, + { + .val = 327, + .val2 = 600000, + }, + { + .val = 655, + .val2 = 200000, + }, + { + .val = 1310, + .val2 = 400000, + }, + { + .val = 2620, + .val2 = 800000, + }, + { + .val = 5241, + .val2 = 600000, + }, + { + .val = 10483, + .val2 = 200000, + }, + { + .val = 20966, + .val2 = 400000, + }, + { + .val = 83865, + .val2 = 600000, + }, +}; + +static int opt3001_find_scale(const struct opt3001 *opt, int val, + int val2, u8 *exponent) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(opt3001_scales); i++) { + const struct opt3001_scale *scale = &opt3001_scales[i]; + + /* + * Combine the integer and micro parts for comparison + * purposes. Use milli lux precision to avoid 32-bit integer + * overflows. + */ + if ((val * 1000 + val2 / 1000) <= + (scale->val * 1000 + scale->val2 / 1000)) { + *exponent = i; + return 0; + } + } + + return -EINVAL; +} + +static void opt3001_to_iio_ret(struct opt3001 *opt, u8 exponent, + u16 mantissa, int *val, int *val2) +{ + int lux; + + lux = 10 * (mantissa << exponent); + *val = lux / 1000; + *val2 = (lux - (*val * 1000)) * 1000; +} + +static void opt3001_set_mode(struct opt3001 *opt, u16 *reg, u16 mode) +{ + *reg &= ~OPT3001_CONFIGURATION_M_MASK; + *reg |= mode; + opt->mode = mode; +} + +static IIO_CONST_ATTR_INT_TIME_AVAIL("0.1 0.8"); + +static struct attribute *opt3001_attributes[] = { + &iio_const_attr_integration_time_available.dev_attr.attr, + NULL +}; + +static const struct attribute_group opt3001_attribute_group = { + .attrs = opt3001_attributes, +}; + +static const struct iio_event_spec opt3001_event_spec[] = { + { + .type = IIO_EV_TYPE_THRESH, + .dir = IIO_EV_DIR_RISING, + .mask_separate = BIT(IIO_EV_INFO_VALUE) | + BIT(IIO_EV_INFO_ENABLE), + }, + { + .type = IIO_EV_TYPE_THRESH, + .dir = IIO_EV_DIR_FALLING, + .mask_separate = BIT(IIO_EV_INFO_VALUE) | + BIT(IIO_EV_INFO_ENABLE), + }, +}; + +static const struct iio_chan_spec opt3001_channels[] = { + { + .type = IIO_LIGHT, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) | + BIT(IIO_CHAN_INFO_INT_TIME), + .event_spec = opt3001_event_spec, + .num_event_specs = ARRAY_SIZE(opt3001_event_spec), + }, + IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2) +{ + int ret; + u16 mantissa; + u16 reg; + u8 exponent; + u16 value; + + /* + * Enable the end-of-conversion interrupt mechanism. Note that doing + * so will overwrite the low-level limit value however we will restore + * this value later on. + */ + ret = i2c_smbus_write_word_swapped(opt->client, OPT3001_LOW_LIMIT, + OPT3001_LOW_LIMIT_EOC_ENABLE); + if (ret < 0) { + dev_err(opt->dev, "failed to write register %02x\n", + OPT3001_LOW_LIMIT); + return ret; + } + + /* Reset data-ready indicator flag (will be set in the IRQ routine) */ + opt->result_ready = false; + + /* Allow IRQ to access the device despite lock being set */ + opt->ok_to_ignore_lock = true; + + /* Configure for single-conversion mode and start a new conversion */ + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); + goto err; + } + + reg = ret; + opt3001_set_mode(opt, ®, OPT3001_CONFIGURATION_M_SINGLE); + + ret = i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, + reg); + if (ret < 0) { + dev_err(opt->dev, "failed to write register %02x\n", + OPT3001_CONFIGURATION); + goto err; + } + + /* Wait for the IRQ to indicate the conversion is complete */ + ret = wait_event_timeout(opt->result_ready_queue, opt->result_ready, + OPT3001_RESULT_READY_TIMEOUT); + +err: + /* Disallow IRQ to access the device while lock is active */ + opt->ok_to_ignore_lock = false; + + if (ret == 0) + return -ETIMEDOUT; + else if (ret < 0) + return ret; + + /* + * Disable the end-of-conversion interrupt mechanism by restoring the + * low-level limit value (clearing OPT3001_LOW_LIMIT_EOC_ENABLE). Note + * that selectively clearing those enable bits would affect the actual + * limit value due to bit-overlap and therefore can't be done. + */ + value = (opt->low_thresh_exp << 12) | opt->low_thresh_mantissa; + ret = i2c_smbus_write_word_swapped(opt->client, OPT3001_LOW_LIMIT, + value); + if (ret < 0) { + dev_err(opt->dev, "failed to write register %02x\n", + OPT3001_LOW_LIMIT); + return ret; + } + + exponent = OPT3001_REG_EXPONENT(opt->result); + mantissa = OPT3001_REG_MANTISSA(opt->result); + + opt3001_to_iio_ret(opt, exponent, mantissa, val, val2); + + return IIO_VAL_INT_PLUS_MICRO; +} + +static int opt3001_get_int_time(struct opt3001 *opt, int *val, int *val2) +{ + *val = 0; + *val2 = opt->int_time; + + return IIO_VAL_INT_PLUS_MICRO; +} + +static int opt3001_set_int_time(struct opt3001 *opt, int time) +{ + int ret; + u16 reg; + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); + return ret; + } + + reg = ret; + + switch (time) { + case 100000: + reg &= ~OPT3001_CONFIGURATION_CT; + opt->int_time = 100000; + break; + case 800000: + reg |= OPT3001_CONFIGURATION_CT; + opt->int_time = 800000; + break; + default: + return -EINVAL; + } + + return i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, + reg); +} + +static int opt3001_read_raw(struct iio_dev *iio, + struct iio_chan_spec const *chan, int *val, int *val2, + long mask) +{ + struct opt3001 *opt = iio_priv(iio); + int ret; + + if (opt->mode == OPT3001_CONFIGURATION_M_CONTINUOUS) + return -EBUSY; + + if (chan->type != IIO_LIGHT) + return -EINVAL; + + mutex_lock(&opt->lock); + + switch (mask) { + case IIO_CHAN_INFO_PROCESSED: + ret = opt3001_get_lux(opt, val, val2); + break; + case IIO_CHAN_INFO_INT_TIME: + ret = opt3001_get_int_time(opt, val, val2); + break; + default: + ret = -EINVAL; + } + + mutex_unlock(&opt->lock); + + return ret; +} + +static int opt3001_write_raw(struct iio_dev *iio, + struct iio_chan_spec const *chan, int val, int val2, + long mask) +{ + struct opt3001 *opt = iio_priv(iio); + int ret; + + if (opt->mode == OPT3001_CONFIGURATION_M_CONTINUOUS) + return -EBUSY; + + if (chan->type != IIO_LIGHT) + return -EINVAL; + + if (mask != IIO_CHAN_INFO_INT_TIME) + return -EINVAL; + + if (val != 0) + return -EINVAL; + + mutex_lock(&opt->lock); + ret = opt3001_set_int_time(opt, val2); + mutex_unlock(&opt->lock); + + return ret; +} + +static int opt3001_read_event_value(struct iio_dev *iio, + const struct iio_chan_spec *chan, enum iio_event_type type, + enum iio_event_direction dir, enum iio_event_info info, + int *val, int *val2) +{ + struct opt3001 *opt = iio_priv(iio); + int ret = IIO_VAL_INT_PLUS_MICRO; + + mutex_lock(&opt->lock); + + switch (dir) { + case IIO_EV_DIR_RISING: + opt3001_to_iio_ret(opt, opt->high_thresh_exp, + opt->high_thresh_mantissa, val, val2); + break; + case IIO_EV_DIR_FALLING: + opt3001_to_iio_ret(opt, opt->low_thresh_exp, + opt->low_thresh_mantissa, val, val2); + break; + default: + ret = -EINVAL; + } + + mutex_unlock(&opt->lock); + + return ret; +} + +static int opt3001_write_event_value(struct iio_dev *iio, + const struct iio_chan_spec *chan, enum iio_event_type type, + enum iio_event_direction dir, enum iio_event_info info, + int val, int val2) +{ + struct opt3001 *opt = iio_priv(iio); + int ret; + + u16 mantissa; + u16 value; + u16 reg; + + u8 exponent; + + if (val < 0) + return -EINVAL; + + mutex_lock(&opt->lock); + + ret = opt3001_find_scale(opt, val, val2, &exponent); + if (ret < 0) { + dev_err(opt->dev, "can't find scale for %d.%06u\n", val, val2); + goto err; + } + + mantissa = (((val * 1000) + (val2 / 1000)) / 10) >> exponent; + value = (exponent << 12) | mantissa; + + switch (dir) { + case IIO_EV_DIR_RISING: + reg = OPT3001_HIGH_LIMIT; + opt->high_thresh_mantissa = mantissa; + opt->high_thresh_exp = exponent; + break; + case IIO_EV_DIR_FALLING: + reg = OPT3001_LOW_LIMIT; + opt->low_thresh_mantissa = mantissa; + opt->low_thresh_exp = exponent; + break; + default: + ret = -EINVAL; + goto err; + } + + ret = i2c_smbus_write_word_swapped(opt->client, reg, value); + if (ret < 0) { + dev_err(opt->dev, "failed to write register %02x\n", reg); + goto err; + } + +err: + mutex_unlock(&opt->lock); + + return ret; +} + +static int opt3001_read_event_config(struct iio_dev *iio, + const struct iio_chan_spec *chan, enum iio_event_type type, + enum iio_event_direction dir) +{ + struct opt3001 *opt = iio_priv(iio); + + return opt->mode == OPT3001_CONFIGURATION_M_CONTINUOUS; +} + +static int opt3001_write_event_config(struct iio_dev *iio, + const struct iio_chan_spec *chan, enum iio_event_type type, + enum iio_event_direction dir, int state) +{ + struct opt3001 *opt = iio_priv(iio); + int ret; + u16 mode; + u16 reg; + + if (state && opt->mode == OPT3001_CONFIGURATION_M_CONTINUOUS) + return 0; + + if (!state && opt->mode == OPT3001_CONFIGURATION_M_SHUTDOWN) + return 0; + + mutex_lock(&opt->lock); + + mode = state ? OPT3001_CONFIGURATION_M_CONTINUOUS + : OPT3001_CONFIGURATION_M_SHUTDOWN; + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); + goto err; + } + + reg = ret; + opt3001_set_mode(opt, ®, mode); + + ret = i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, + reg); + if (ret < 0) { + dev_err(opt->dev, "failed to write register %02x\n", + OPT3001_CONFIGURATION); + goto err; + } + +err: + mutex_unlock(&opt->lock); + + return ret; +} + +static const struct iio_info opt3001_info = { + .driver_module = THIS_MODULE, + .attrs = &opt3001_attribute_group, + .read_raw = opt3001_read_raw, + .write_raw = opt3001_write_raw, + .read_event_value = opt3001_read_event_value, + .write_event_value = opt3001_write_event_value, + .read_event_config = opt3001_read_event_config, + .write_event_config = opt3001_write_event_config, +}; + +static int opt3001_read_id(struct opt3001 *opt) +{ + char manufacturer[2]; + u16 device_id; + int ret; + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_MANUFACTURER_ID); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_MANUFACTURER_ID); + return ret; + } + + manufacturer[0] = ret >> 8; + manufacturer[1] = ret & 0xff; + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_DEVICE_ID); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_DEVICE_ID); + return ret; + } + + device_id = ret; + + dev_info(opt->dev, "Found %c%c OPT%04x\n", manufacturer[0], + manufacturer[1], device_id); + + return 0; +} + +static int opt3001_configure(struct opt3001 *opt) +{ + int ret; + u16 reg; + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); + return ret; + } + + reg = ret; + + /* Enable automatic full-scale setting mode */ + reg &= ~OPT3001_CONFIGURATION_RN_MASK; + reg |= OPT3001_CONFIGURATION_RN_AUTO; + + /* Reflect status of the device's integration time setting */ + if (reg & OPT3001_CONFIGURATION_CT) + opt->int_time = 800000; + else + opt->int_time = 100000; + + /* Ensure device is in shutdown initially */ + opt3001_set_mode(opt, ®, OPT3001_CONFIGURATION_M_SHUTDOWN); + + /* Configure for latched window-style comparison operation */ + reg |= OPT3001_CONFIGURATION_L; + reg &= ~OPT3001_CONFIGURATION_POL; + reg &= ~OPT3001_CONFIGURATION_ME; + reg &= ~OPT3001_CONFIGURATION_FC_MASK; + + ret = i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, + reg); + if (ret < 0) { + dev_err(opt->dev, "failed to write register %02x\n", + OPT3001_CONFIGURATION); + return ret; + } + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_LOW_LIMIT); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_LOW_LIMIT); + return ret; + } + + opt->low_thresh_mantissa = OPT3001_REG_MANTISSA(ret); + opt->low_thresh_exp = OPT3001_REG_EXPONENT(ret); + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_HIGH_LIMIT); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_HIGH_LIMIT); + return ret; + } + + opt->high_thresh_mantissa = OPT3001_REG_MANTISSA(ret); + opt->high_thresh_exp = OPT3001_REG_EXPONENT(ret); + + return 0; +} + +static irqreturn_t opt3001_irq(int irq, void *_iio) +{ + struct iio_dev *iio = _iio; + struct opt3001 *opt = iio_priv(iio); + int ret; + + if (!opt->ok_to_ignore_lock) + mutex_lock(&opt->lock); + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); + goto out; + } + + if ((ret & OPT3001_CONFIGURATION_M_MASK) == + OPT3001_CONFIGURATION_M_CONTINUOUS) { + if (ret & OPT3001_CONFIGURATION_FH) + iio_push_event(iio, + IIO_UNMOD_EVENT_CODE(IIO_LIGHT, 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_RISING), + iio_get_time_ns()); + if (ret & OPT3001_CONFIGURATION_FL) + iio_push_event(iio, + IIO_UNMOD_EVENT_CODE(IIO_LIGHT, 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_FALLING), + iio_get_time_ns()); + } else if (ret & OPT3001_CONFIGURATION_CRF) { + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_RESULT); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_RESULT); + goto out; + } + opt->result = ret; + opt->result_ready = true; + wake_up(&opt->result_ready_queue); + } + +out: + if (!opt->ok_to_ignore_lock) + mutex_unlock(&opt->lock); + + return IRQ_HANDLED; +} + +static int opt3001_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + + struct iio_dev *iio; + struct opt3001 *opt; + int irq = client->irq; + int ret; + + iio = devm_iio_device_alloc(dev, sizeof(*opt)); + if (!iio) + return -ENOMEM; + + opt = iio_priv(iio); + opt->client = client; + opt->dev = dev; + + mutex_init(&opt->lock); + init_waitqueue_head(&opt->result_ready_queue); + i2c_set_clientdata(client, iio); + + ret = opt3001_read_id(opt); + if (ret) + return ret; + + ret = opt3001_configure(opt); + if (ret) + return ret; + + iio->name = client->name; + iio->channels = opt3001_channels; + iio->num_channels = ARRAY_SIZE(opt3001_channels); + iio->dev.parent = dev; + iio->modes = INDIO_DIRECT_MODE; + iio->info = &opt3001_info; + + ret = devm_iio_device_register(dev, iio); + if (ret) { + dev_err(dev, "failed to register IIO device\n"); + return ret; + } + + ret = request_threaded_irq(irq, NULL, opt3001_irq, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "opt3001", iio); + if (ret) { + dev_err(dev, "failed to request IRQ #%d\n", irq); + return ret; + } + + return 0; +} + +static int opt3001_remove(struct i2c_client *client) +{ + struct iio_dev *iio = i2c_get_clientdata(client); + struct opt3001 *opt = iio_priv(iio); + int ret; + u16 reg; + + free_irq(client->irq, iio); + + ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + if (ret < 0) { + dev_err(opt->dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); + return ret; + } + + reg = ret; + opt3001_set_mode(opt, ®, OPT3001_CONFIGURATION_M_SHUTDOWN); + + ret = i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, + reg); + if (ret < 0) { + dev_err(opt->dev, "failed to write register %02x\n", + OPT3001_CONFIGURATION); + return ret; + } + + return 0; +} + +static const struct i2c_device_id opt3001_id[] = { + { "opt3001", 0 }, + { } /* Terminating Entry */ +}; +MODULE_DEVICE_TABLE(i2c, opt3001_id); + +static const struct of_device_id opt3001_of_match[] = { + { .compatible = "ti,opt3001" }, + { } +}; + +static struct i2c_driver opt3001_driver = { + .probe = opt3001_probe, + .remove = opt3001_remove, + .id_table = opt3001_id, + + .driver = { + .name = "opt3001", + .of_match_table = of_match_ptr(opt3001_of_match), + .owner = THIS_MODULE, + }, +}; + +module_i2c_driver(opt3001_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Andreas Dannenberg "); +MODULE_DESCRIPTION("Texas Instruments OPT3001 Light Sensor Driver"); From 8ab6abfca09c1800dccb753775f6ce8ee82f50dd Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Tue, 7 Jul 2015 14:07:13 +0300 Subject: [PATCH 306/912] iio: light: Add support for TXC PA12 als and proximity sensor Add support for TXC PA12203001 als and proximity sensor. Support for raw illuminance and proximity readings. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/light/Kconfig | 11 + drivers/iio/light/Makefile | 1 + drivers/iio/light/pa12203001.c | 483 +++++++++++++++++++++++++++++++++ 3 files changed, 495 insertions(+) create mode 100644 drivers/iio/light/pa12203001.c diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index 5c0854a7e3e0..a459341a79f9 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig @@ -219,6 +219,17 @@ config OPT3001 If built as a dynamically linked module, it will be called opt3001. +config PA12203001 + tristate "TXC PA12203001 light and proximity sensor" + depends on I2C + select REGMAP_I2C + help + If you say yes here you get support for the TXC PA12203001 + ambient light and proximity sensor. + + This driver can also be built as a module. If so, the module + will be called pa12203001. + config STK3310 tristate "STK3310 ALS and proximity sensor" depends on I2C diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile index 5345969f7000..91c74c014b6f 100644 --- a/drivers/iio/light/Makefile +++ b/drivers/iio/light/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_JSA1212) += jsa1212.o obj-$(CONFIG_SENSORS_LM3533) += lm3533-als.o obj-$(CONFIG_LTR501) += ltr501.o obj-$(CONFIG_OPT3001) += opt3001.o +obj-$(CONFIG_PA12203001) += pa12203001.o obj-$(CONFIG_RPR0521) += rpr0521.o obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o obj-$(CONFIG_STK3310) += stk3310.o diff --git a/drivers/iio/light/pa12203001.c b/drivers/iio/light/pa12203001.c new file mode 100644 index 000000000000..45f7bde02bbf --- /dev/null +++ b/drivers/iio/light/pa12203001.c @@ -0,0 +1,483 @@ +/* + * Copyright (c) 2015 Intel Corporation + * + * Driver for TXC PA12203001 Proximity and Ambient Light Sensor. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * To do: Interrupt support. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PA12203001_DRIVER_NAME "pa12203001" + +#define PA12203001_REG_CFG0 0x00 +#define PA12203001_REG_CFG1 0x01 +#define PA12203001_REG_CFG2 0x02 +#define PA12203001_REG_CFG3 0x03 + +#define PA12203001_REG_ADL 0x0b +#define PA12203001_REG_PDH 0x0e + +#define PA12203001_REG_POFS 0x10 +#define PA12203001_REG_PSET 0x11 + +#define PA12203001_ALS_EN_MASK BIT(0) +#define PA12203001_PX_EN_MASK BIT(1) +#define PA12203001_PX_NORMAL_MODE_MASK GENMASK(7, 6) +#define PA12203001_AFSR_MASK GENMASK(5, 4) +#define PA12203001_AFSR_SHIFT 4 + +#define PA12203001_PSCAN 0x03 + +/* als range 31000, ps, als disabled */ +#define PA12203001_REG_CFG0_DEFAULT 0x30 + +/* led current: 100 mA */ +#define PA12203001_REG_CFG1_DEFAULT 0x20 + +/* ps mode: normal, interrupts not active */ +#define PA12203001_REG_CFG2_DEFAULT 0xcc + +#define PA12203001_REG_CFG3_DEFAULT 0x00 + +#define PA12203001_SLEEP_DELAY_MS 3000 + +#define PA12203001_CHIP_ENABLE 0xff +#define PA12203001_CHIP_DISABLE 0x00 + +/* available scales: corresponding to [500, 4000, 7000, 31000] lux */ +static const int pa12203001_scales[] = { 7629, 61036, 106813, 473029}; + +struct pa12203001_data { + struct i2c_client *client; + + /* protect device states */ + struct mutex lock; + + bool als_enabled; + bool px_enabled; + bool als_needs_enable; + bool px_needs_enable; + + struct regmap *map; +}; + +static const struct { + u8 reg; + u8 val; +} regvals[] = { + {PA12203001_REG_CFG0, PA12203001_REG_CFG0_DEFAULT}, + {PA12203001_REG_CFG1, PA12203001_REG_CFG1_DEFAULT}, + {PA12203001_REG_CFG2, PA12203001_REG_CFG2_DEFAULT}, + {PA12203001_REG_CFG3, PA12203001_REG_CFG3_DEFAULT}, + {PA12203001_REG_PSET, PA12203001_PSCAN}, +}; + +static IIO_CONST_ATTR(in_illuminance_scale_available, + "0.007629 0.061036 0.106813 0.473029"); + +static struct attribute *pa12203001_attrs[] = { + &iio_const_attr_in_illuminance_scale_available.dev_attr.attr, + NULL +}; + +static const struct attribute_group pa12203001_attr_group = { + .attrs = pa12203001_attrs, +}; + +static const struct iio_chan_spec pa12203001_channels[] = { + { + .type = IIO_LIGHT, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE), + }, + { + .type = IIO_PROXIMITY, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + } +}; + +static const struct regmap_range pa12203001_volatile_regs_ranges[] = { + regmap_reg_range(PA12203001_REG_ADL, PA12203001_REG_ADL + 1), + regmap_reg_range(PA12203001_REG_PDH, PA12203001_REG_PDH), +}; + +static const struct regmap_access_table pa12203001_volatile_regs = { + .yes_ranges = pa12203001_volatile_regs_ranges, + .n_yes_ranges = ARRAY_SIZE(pa12203001_volatile_regs_ranges), +}; + +static const struct regmap_config pa12203001_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = PA12203001_REG_PSET, + .cache_type = REGCACHE_RBTREE, + .volatile_table = &pa12203001_volatile_regs, +}; + +static inline int pa12203001_als_enable(struct pa12203001_data *data, u8 enable) +{ + int ret; + + ret = regmap_update_bits(data->map, PA12203001_REG_CFG0, + PA12203001_ALS_EN_MASK, enable); + if (ret < 0) + return ret; + + data->als_enabled = !!enable; + + return 0; +} + +static inline int pa12203001_px_enable(struct pa12203001_data *data, u8 enable) +{ + int ret; + + ret = regmap_update_bits(data->map, PA12203001_REG_CFG0, + PA12203001_PX_EN_MASK, enable); + if (ret < 0) + return ret; + + data->px_enabled = !!enable; + + return 0; +} + +static int pa12203001_set_power_state(struct pa12203001_data *data, bool on, + u8 mask) +{ +#ifdef CONFIG_PM + int ret; + + if (on && (mask & PA12203001_ALS_EN_MASK)) { + mutex_lock(&data->lock); + if (data->px_enabled) { + ret = pa12203001_als_enable(data, + PA12203001_ALS_EN_MASK); + if (ret < 0) + goto err; + } else { + data->als_needs_enable = true; + } + mutex_unlock(&data->lock); + } + + if (on && (mask & PA12203001_PX_EN_MASK)) { + mutex_lock(&data->lock); + if (data->als_enabled) { + ret = pa12203001_px_enable(data, PA12203001_PX_EN_MASK); + if (ret < 0) + goto err; + } else { + data->px_needs_enable = true; + } + mutex_unlock(&data->lock); + } + + if (on) { + ret = pm_runtime_get_sync(&data->client->dev); + if (ret < 0) + pm_runtime_put_noidle(&data->client->dev); + + } else { + pm_runtime_mark_last_busy(&data->client->dev); + ret = pm_runtime_put_autosuspend(&data->client->dev); + } + + return ret; + +err: + mutex_unlock(&data->lock); + return ret; + +#endif + return 0; +} + +static int pa12203001_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + struct pa12203001_data *data = iio_priv(indio_dev); + int ret; + u8 dev_mask; + unsigned int reg_byte; + __le16 reg_word; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + switch (chan->type) { + case IIO_LIGHT: + dev_mask = PA12203001_ALS_EN_MASK; + ret = pa12203001_set_power_state(data, true, dev_mask); + if (ret < 0) + return ret; + /* + * ALS ADC value is stored in registers + * PA12203001_REG_ADL and in PA12203001_REG_ADL + 1. + */ + ret = regmap_bulk_read(data->map, PA12203001_REG_ADL, + ®_word, 2); + if (ret < 0) + goto reg_err; + + *val = le16_to_cpu(reg_word); + ret = pa12203001_set_power_state(data, false, dev_mask); + if (ret < 0) + return ret; + break; + case IIO_PROXIMITY: + dev_mask = PA12203001_PX_EN_MASK; + ret = pa12203001_set_power_state(data, true, dev_mask); + if (ret < 0) + return ret; + ret = regmap_read(data->map, PA12203001_REG_PDH, + ®_byte); + if (ret < 0) + goto reg_err; + + *val = reg_byte; + ret = pa12203001_set_power_state(data, false, dev_mask); + if (ret < 0) + return ret; + break; + default: + return -EINVAL; + } + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + ret = regmap_read(data->map, PA12203001_REG_CFG0, ®_byte); + if (ret < 0) + return ret; + *val = 0; + reg_byte = (reg_byte & PA12203001_AFSR_MASK); + *val2 = pa12203001_scales[reg_byte >> 4]; + return IIO_VAL_INT_PLUS_MICRO; + default: + return -EINVAL; + } + +reg_err: + pa12203001_set_power_state(data, false, dev_mask); + return ret; +} + +static int pa12203001_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, + int val2, long mask) +{ + struct pa12203001_data *data = iio_priv(indio_dev); + int i, ret, new_val; + unsigned int reg_byte; + + switch (mask) { + case IIO_CHAN_INFO_SCALE: + ret = regmap_read(data->map, PA12203001_REG_CFG0, ®_byte); + if (val != 0 || ret < 0) + return -EINVAL; + for (i = 0; i < ARRAY_SIZE(pa12203001_scales); i++) { + if (val2 == pa12203001_scales[i]) { + new_val = i << PA12203001_AFSR_SHIFT; + return regmap_update_bits(data->map, + PA12203001_REG_CFG0, + PA12203001_AFSR_MASK, + new_val); + } + } + break; + default: + break; + } + + return -EINVAL; +} + +static const struct iio_info pa12203001_info = { + .driver_module = THIS_MODULE, + .read_raw = pa12203001_read_raw, + .write_raw = pa12203001_write_raw, + .attrs = &pa12203001_attr_group, +}; + +static int pa12203001_init(struct iio_dev *indio_dev) +{ + struct pa12203001_data *data = iio_priv(indio_dev); + int i, ret; + + for (i = 0; i < ARRAY_SIZE(regvals); i++) { + ret = regmap_write(data->map, regvals[i].reg, regvals[i].val); + if (ret < 0) + return ret; + } + + return 0; +} + +static int pa12203001_power_chip(struct iio_dev *indio_dev, u8 state) +{ + struct pa12203001_data *data = iio_priv(indio_dev); + int ret; + + mutex_lock(&data->lock); + ret = pa12203001_als_enable(data, state); + if (ret < 0) + goto out; + + ret = pa12203001_px_enable(data, state); + +out: + mutex_unlock(&data->lock); + return ret; +} + +static int pa12203001_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct pa12203001_data *data; + struct iio_dev *indio_dev; + int ret; + + indio_dev = devm_iio_device_alloc(&client->dev, + sizeof(struct pa12203001_data)); + if (!indio_dev) + return -ENOMEM; + + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + + data->map = devm_regmap_init_i2c(client, &pa12203001_regmap_config); + if (IS_ERR(data->map)) + return PTR_ERR(data->map); + + mutex_init(&data->lock); + + indio_dev->dev.parent = &client->dev; + indio_dev->info = &pa12203001_info; + indio_dev->name = PA12203001_DRIVER_NAME; + indio_dev->channels = pa12203001_channels; + indio_dev->num_channels = ARRAY_SIZE(pa12203001_channels); + indio_dev->modes = INDIO_DIRECT_MODE; + + ret = pa12203001_init(indio_dev); + if (ret < 0) + return ret; + + ret = pa12203001_power_chip(indio_dev, PA12203001_CHIP_ENABLE); + if (ret < 0) + return ret; + + ret = pm_runtime_set_active(&client->dev); + if (ret < 0) { + pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); + return ret; + } + + pm_runtime_enable(&client->dev); + pm_runtime_set_autosuspend_delay(&client->dev, + PA12203001_SLEEP_DELAY_MS); + pm_runtime_use_autosuspend(&client->dev); + + return iio_device_register(indio_dev); +} + +static int pa12203001_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + + iio_device_unregister(indio_dev); + + pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); + + return pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); +} + +#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM) +static int pa12203001_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + + return pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); +} +#endif + +#ifdef CONFIG_PM_SLEEP +static int pa12203001_resume(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + + return pa12203001_power_chip(indio_dev, PA12203001_CHIP_ENABLE); +} +#endif + +#ifdef CONFIG_PM +static int pa12203001_runtime_resume(struct device *dev) +{ + struct pa12203001_data *data; + + data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); + + mutex_lock(&data->lock); + if (data->als_needs_enable) { + pa12203001_als_enable(data, PA12203001_ALS_EN_MASK); + data->als_needs_enable = false; + } + if (data->px_needs_enable) { + pa12203001_px_enable(data, PA12203001_PX_EN_MASK); + data->px_needs_enable = false; + } + mutex_unlock(&data->lock); + + return 0; +} +#endif + +static const struct dev_pm_ops pa12203001_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pa12203001_suspend, pa12203001_resume) + SET_RUNTIME_PM_OPS(pa12203001_suspend, pa12203001_runtime_resume, NULL) +}; + +static const struct acpi_device_id pa12203001_acpi_match[] = { + { "TXCPA122", 0}, + {} +}; + +MODULE_DEVICE_TABLE(acpi, pa12203001_acpi_match); + +static const struct i2c_device_id pa12203001_id[] = { + {"txcpa122", 0}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, pa12203001_id); + +static struct i2c_driver pa12203001_driver = { + .driver = { + .name = PA12203001_DRIVER_NAME, + .pm = &pa12203001_pm_ops, + .acpi_match_table = ACPI_PTR(pa12203001_acpi_match), + }, + .probe = pa12203001_probe, + .remove = pa12203001_remove, + .id_table = pa12203001_id, + +}; +module_i2c_driver(pa12203001_driver); + +MODULE_AUTHOR("Adriana Reus "); +MODULE_DESCRIPTION("Driver for TXC PA12203001 Proximity and Light Sensor"); +MODULE_LICENSE("GPL v2"); From ff1ac639b395d58bbd99ff4a36b10eebb81544a3 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 13 Jul 2015 16:15:56 +0300 Subject: [PATCH 307/912] tools: iio: Remove explicit NULL comparison Remove explicit NULL comparison and write it in its simpler form as recommended by checkpatch.pl. Signed-off-by: Cristina Opriceana Reviewed-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/generic_buffer.c | 4 +-- tools/iio/iio_utils.c | 56 +++++++++++++++++++------------------- tools/iio/lsiio.c | 10 +++---- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 0e737238ca74..9535c2dc25af 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -270,7 +270,7 @@ int main(int argc, char **argv) } } - if (device_name == NULL) { + if (!device_name) { printf("Device name not set\n"); print_usage(); return -1; @@ -290,7 +290,7 @@ int main(int argc, char **argv) return -ENOMEM; if (!notrigger) { - if (trigger_name == NULL) { + if (!trigger_name) { /* * Build the trigger name. If it is device associated * its name is _dev[n] where n matches diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 8fb3214c70f2..4a7e4801cebf 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -117,13 +117,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } dp = opendir(scan_el_dir); - if (dp == NULL) { + if (!dp) { ret = -errno; goto error_free_builtname_generic; } ret = -ENOENT; - while (ent = readdir(dp), ent != NULL) + while (ent = readdir(dp), ent) /* * Do we allow devices to override a generic name with * a specific one? @@ -138,7 +138,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf("failed to open %s\n", filename); goto error_free_filename; @@ -235,13 +235,13 @@ int iioutils_get_param_float(float *output, const char *param_name, } dp = opendir(device_dir); - if (dp == NULL) { + if (!dp) { ret = -errno; goto error_free_builtname_generic; } ret = -ENOENT; - while (ent = readdir(dp), ent != NULL) + while (ent = readdir(dp), ent) if ((strcmp(builtname, ent->d_name) == 0) || (strcmp(builtname_generic, ent->d_name) == 0)) { ret = asprintf(&filename, @@ -325,12 +325,12 @@ int build_channel_array(const char *device_dir, return -ENOMEM; dp = opendir(scan_el_dir); - if (dp == NULL) { + if (!dp) { ret = -errno; goto error_free_name; } - while (ent = readdir(dp), ent != NULL) + while (ent = readdir(dp), ent) if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) { ret = asprintf(&filename, @@ -341,7 +341,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; free(filename); goto error_close_dir; @@ -369,13 +369,13 @@ int build_channel_array(const char *device_dir, } *ci_array = malloc(sizeof(**ci_array) * (*counter)); - if (*ci_array == NULL) { + if (!*ci_array) { ret = -ENOMEM; goto error_close_dir; } seekdir(dp, 0); - while (ent = readdir(dp), ent != NULL) { + while (ent = readdir(dp), ent) { if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) { int current_enabled = 0; @@ -391,7 +391,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; free(filename); count--; @@ -424,7 +424,7 @@ int build_channel_array(const char *device_dir, current->name = strndup(ent->d_name, strlen(ent->d_name) - strlen("_en")); - if (current->name == NULL) { + if (!current->name) { free(filename); ret = -ENOMEM; count--; @@ -452,7 +452,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf("failed to open %s\n", filename); free(filename); @@ -567,12 +567,12 @@ int find_type_by_name(const char *name, const char *type) char *filename; dp = opendir(iio_dir); - if (dp == NULL) { + if (!dp) { printf("No industrialio devices available\n"); return -ENODEV; } - while (ent = readdir(dp), ent != NULL) { + while (ent = readdir(dp), ent) { if (strcmp(ent->d_name, ".") != 0 && strcmp(ent->d_name, "..") != 0 && strlen(ent->d_name) > strlen(type) && @@ -595,7 +595,7 @@ int find_type_by_name(const char *name, const char *type) ":", 1) != 0) { filename = malloc(strlen(iio_dir) + strlen(type) + numstrlen + 6); - if (filename == NULL) { + if (!filename) { ret = -ENOMEM; goto error_close_dir; } @@ -654,7 +654,7 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, int test; char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - if (temp == NULL) + if (!temp) return -ENOMEM; ret = sprintf(temp, "%s/%s", basedir, filename); @@ -662,7 +662,7 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, goto error_free; sysfsfp = fopen(temp, "w"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf("failed to open %s\n", temp); goto error_free; @@ -683,7 +683,7 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, if (verify) { sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf("failed to open %s\n", temp); goto error_free; @@ -749,7 +749,7 @@ static int _write_sysfs_string(const char *filename, const char *basedir, FILE *sysfsfp; char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - if (temp == NULL) { + if (!temp) { printf("Memory allocation failed\n"); return -ENOMEM; } @@ -759,7 +759,7 @@ static int _write_sysfs_string(const char *filename, const char *basedir, goto error_free; sysfsfp = fopen(temp, "w"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf("Could not open %s\n", temp); goto error_free; @@ -780,7 +780,7 @@ static int _write_sysfs_string(const char *filename, const char *basedir, if (verify) { sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf("Could not open file to verify\n"); goto error_free; @@ -855,7 +855,7 @@ int read_sysfs_posint(const char *filename, const char *basedir) FILE *sysfsfp; char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - if (temp == NULL) { + if (!temp) { printf("Memory allocation failed"); return -ENOMEM; } @@ -865,7 +865,7 @@ int read_sysfs_posint(const char *filename, const char *basedir) goto error_free; sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; goto error_free; } @@ -902,7 +902,7 @@ int read_sysfs_float(const char *filename, const char *basedir, float *val) FILE *sysfsfp; char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - if (temp == NULL) { + if (!temp) { printf("Memory allocation failed"); return -ENOMEM; } @@ -912,7 +912,7 @@ int read_sysfs_float(const char *filename, const char *basedir, float *val) goto error_free; sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; goto error_free; } @@ -949,7 +949,7 @@ int read_sysfs_string(const char *filename, const char *basedir, char *str) FILE *sysfsfp; char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - if (temp == NULL) { + if (!temp) { printf("Memory allocation failed"); return -ENOMEM; } @@ -959,7 +959,7 @@ int read_sysfs_string(const char *filename, const char *basedir, char *str) goto error_free; sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; goto error_free; } diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c index 7f432a55a6c4..4f8172fe7881 100644 --- a/tools/iio/lsiio.c +++ b/tools/iio/lsiio.c @@ -46,10 +46,10 @@ static int dump_channels(const char *dev_dir_name) const struct dirent *ent; dp = opendir(dev_dir_name); - if (dp == NULL) + if (!dp) return -errno; - while (ent = readdir(dp), ent != NULL) + while (ent = readdir(dp), ent) if (check_prefix(ent->d_name, "in_") && check_postfix(ent->d_name, "_raw")) printf(" %-10s\n", ent->d_name); @@ -107,12 +107,12 @@ static int dump_devices(void) DIR *dp; dp = opendir(iio_dir); - if (dp == NULL) { + if (!dp) { printf("No industrial I/O devices available\n"); return -ENODEV; } - while (ent = readdir(dp), ent != NULL) { + while (ent = readdir(dp), ent) { if (check_prefix(ent->d_name, type_device)) { char *dev_dir_name; @@ -134,7 +134,7 @@ static int dump_devices(void) } } rewinddir(dp); - while (ent = readdir(dp), ent != NULL) { + while (ent = readdir(dp), ent) { if (check_prefix(ent->d_name, type_trigger)) { char *dev_dir_name; From 37d38e2bcce055c3988977429dc4336c866df73d Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 13 Jul 2015 16:17:47 +0300 Subject: [PATCH 308/912] tools: iio: Remove unnecessary braces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Single statement blocks don’t need braces. Found with checkpatch.pl. Signed-off-by: Cristina Opriceana Acked-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/iio_event_monitor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 703f4cb0e8e9..9ee195949a4a 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -262,9 +262,8 @@ int main(int argc, char **argv) printf("Found IIO device with name %s with device number %d\n", device_name, dev_num); ret = asprintf(&chrdev_name, "/dev/iio:device%d", dev_num); - if (ret < 0) { + if (ret < 0) return -ENOMEM; - } } else { /* * If we can't find an IIO device by name assume device_name is From 34cbea1908fb686b037e01e5b1ab8e0e67b09ed3 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 13 Jul 2015 16:20:11 +0300 Subject: [PATCH 309/912] tools: iio: Add ARRAY_SIZE macro Calculation of the length of an array can be done with the ARRAY_SIZE macro to make code more abstract and remove the associated checkpatch.pl warning. Signed-off-by: Cristina Opriceana Acked-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 2 +- tools/iio/iio_utils.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 4a7e4801cebf..e177f4022d40 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -39,7 +39,7 @@ int iioutils_break_up_name(const char *full_name, char **generic_name) char *working, *prefix = ""; int i, ret; - for (i = 0; i < sizeof(iio_direction) / sizeof(iio_direction[0]); i++) + for (i = 0; i < ARRAY_SIZE(iio_direction); i++) if (!strncmp(full_name, iio_direction[i], strlen(iio_direction[i]))) { prefix = iio_direction[i]; diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h index 086610139ade..f30a1091b53e 100644 --- a/tools/iio/iio_utils.h +++ b/tools/iio/iio_utils.h @@ -18,6 +18,8 @@ #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" #define FORMAT_TYPE_FILE "%s_type" +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) + extern const char *iio_dir; /** From d9abc615ea1659b6967a00e95b1b3a7fd4079b80 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 17 Jul 2015 18:43:42 +0300 Subject: [PATCH 310/912] tools: iio: Send error messages to stderr This patch indends to make some cleanup and send printf error messages to stderr. The changes were performed with coccinelle for failure messages and manual for other cases, such as wrong usage messages. Signed-off-by: Cristina Opriceana Reviewed-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/generic_buffer.c | 39 ++++++++++++++------------- tools/iio/iio_event_monitor.c | 14 +++++----- tools/iio/iio_utils.c | 51 ++++++++++++++++++++--------------- tools/iio/lsiio.c | 2 +- 4 files changed, 59 insertions(+), 47 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 9535c2dc25af..32f389ebb94d 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -193,15 +193,15 @@ void process_scan(char *data, void print_usage(void) { - printf("Usage: generic_buffer [options]...\n" - "Capture, convert and output data from IIO device buffer\n" - " -c Do n conversions\n" - " -e Disable wait for event (new data)\n" - " -g Use trigger-less mode\n" - " -l Set buffer length to n samples\n" - " -n Set device name (mandatory)\n" - " -t Set trigger name\n" - " -w Set delay between reads in us (event-less mode)\n"); + fprintf(stderr, "Usage: generic_buffer [options]...\n" + "Capture, convert and output data from IIO device buffer\n" + " -c Do n conversions\n" + " -e Disable wait for event (new data)\n" + " -g Use trigger-less mode\n" + " -l Set buffer length to n samples\n" + " -n Set device name (mandatory)\n" + " -t Set trigger name\n" + " -w Set delay between reads in us (event-less mode)\n"); } int main(int argc, char **argv) @@ -271,7 +271,7 @@ int main(int argc, char **argv) } if (!device_name) { - printf("Device name not set\n"); + fprintf(stderr, "Device name not set\n"); print_usage(); return -1; } @@ -279,7 +279,7 @@ int main(int argc, char **argv) /* Find the device requested */ dev_num = find_type_by_name(device_name, "iio:device"); if (dev_num < 0) { - printf("Failed to find the %s\n", device_name); + fprintf(stderr, "Failed to find the %s\n", device_name); return dev_num; } @@ -307,7 +307,8 @@ int main(int argc, char **argv) /* Verify the trigger exists */ trig_num = find_type_by_name(trigger_name, "trigger"); if (trig_num < 0) { - printf("Failed to find the trigger %s\n", trigger_name); + fprintf(stderr, "Failed to find the trigger %s\n", + trigger_name); ret = trig_num; goto error_free_triggername; } @@ -323,8 +324,8 @@ int main(int argc, char **argv) */ ret = build_channel_array(dev_dir_name, &channels, &num_channels); if (ret) { - printf("Problem reading scan element information\n"); - printf("diag %s\n", dev_dir_name); + fprintf(stderr, "Problem reading scan element information\n" + "diag %s\n", dev_dir_name); goto error_free_triggername; } @@ -350,7 +351,8 @@ int main(int argc, char **argv) dev_dir_name, trigger_name); if (ret < 0) { - printf("Failed to write current_trigger file\n"); + fprintf(stderr, + "Failed to write current_trigger file\n"); goto error_free_buf_dir_name; } } @@ -382,7 +384,7 @@ int main(int argc, char **argv) fp = open(buffer_access, O_RDONLY | O_NONBLOCK); if (fp == -1) { /* TODO: If it isn't there make the node */ ret = -errno; - printf("Failed to open %s\n", buffer_access); + fprintf(stderr, "Failed to open %s\n", buffer_access); goto error_free_buffer_access; } @@ -410,7 +412,7 @@ int main(int argc, char **argv) read_size = read(fp, data, toread * scan_size); if (read_size < 0) { if (errno == EAGAIN) { - printf("nothing available\n"); + fprintf(stderr, "nothing available\n"); continue; } else { break; @@ -431,7 +433,8 @@ int main(int argc, char **argv) ret = write_sysfs_string("trigger/current_trigger", dev_dir_name, "NULL"); if (ret < 0) - printf("Failed to write to %s\n", dev_dir_name); + fprintf(stderr, "Failed to write to %s\n", + dev_dir_name); error_close_buffer_access: if (close(fp) == -1) diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 9ee195949a4a..cd3fd41b481d 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -215,8 +215,8 @@ static void print_event(struct iio_event_data *event) bool diff = IIO_EVENT_CODE_EXTRACT_DIFF(event->id); if (!event_is_known(event)) { - printf("Unknown event: time: %lld, id: %llx\n", - event->timestamp, event->id); + fprintf(stderr, "Unknown event: time: %lld, id: %llx\n", + event->timestamp, event->id); return; } @@ -251,7 +251,7 @@ int main(int argc, char **argv) int fd, event_fd; if (argc <= 1) { - printf("Usage: %s \n", argv[0]); + fprintf(stderr, "Usage: %s \n", argv[0]); return -1; } @@ -277,14 +277,14 @@ int main(int argc, char **argv) fd = open(chrdev_name, 0); if (fd == -1) { ret = -errno; - fprintf(stdout, "Failed to open %s\n", chrdev_name); + fprintf(stderr, "Failed to open %s\n", chrdev_name); goto error_free_chrdev_name; } ret = ioctl(fd, IIO_GET_EVENT_FD_IOCTL, &event_fd); if (ret == -1 || event_fd == -1) { ret = -errno; - fprintf(stdout, "Failed to retrieve event fd\n"); + fprintf(stderr, "Failed to retrieve event fd\n"); if (close(fd) == -1) perror("Failed to close character device file"); @@ -300,7 +300,7 @@ int main(int argc, char **argv) ret = read(event_fd, &event, sizeof(event)); if (ret == -1) { if (errno == EAGAIN) { - printf("nothing available\n"); + fprintf(stderr, "nothing available\n"); continue; } else { ret = -errno; @@ -310,7 +310,7 @@ int main(int argc, char **argv) } if (ret != sizeof(event)) { - printf("Reading event failed!\n"); + fprintf(stderr, "Reading event failed!\n"); ret = -EIO; break; } diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index e177f4022d40..c3f9e37333e7 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -140,7 +140,8 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, sysfsfp = fopen(filename, "r"); if (!sysfsfp) { ret = -errno; - printf("failed to open %s\n", filename); + fprintf(stderr, "failed to open %s\n", + filename); goto error_free_filename; } @@ -152,11 +153,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, &padint, shift); if (ret < 0) { ret = -errno; - printf("failed to pass scan type description\n"); + fprintf(stderr, + "failed to pass scan type description\n"); goto error_close_sysfsfp; } else if (ret != 5) { ret = -EIO; - printf("scan type description didn't match\n"); + fprintf(stderr, + "scan type description didn't match\n"); goto error_close_sysfsfp; } @@ -170,7 +173,8 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, *is_signed = (signchar == 's'); if (fclose(sysfsfp)) { ret = -errno; - printf("Failed to close %s\n", filename); + fprintf(stderr, "Failed to close %s\n", + filename); goto error_free_filename; } @@ -454,7 +458,8 @@ int build_channel_array(const char *device_dir, sysfsfp = fopen(filename, "r"); if (!sysfsfp) { ret = -errno; - printf("failed to open %s\n", filename); + fprintf(stderr, "failed to open %s\n", + filename); free(filename); goto error_cleanup_array; } @@ -568,7 +573,7 @@ int find_type_by_name(const char *name, const char *type) dp = opendir(iio_dir); if (!dp) { - printf("No industrialio devices available\n"); + fprintf(stderr, "No industrialio devices available\n"); return -ENODEV; } @@ -581,11 +586,13 @@ int find_type_by_name(const char *name, const char *type) ret = sscanf(ent->d_name + strlen(type), "%d", &number); if (ret < 0) { ret = -errno; - printf("failed to read element number\n"); + fprintf(stderr, + "failed to read element number\n"); goto error_close_dir; } else if (ret != 1) { ret = -EIO; - printf("failed to match element number\n"); + fprintf(stderr, + "failed to match element number\n"); goto error_close_dir; } @@ -664,7 +671,7 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, sysfsfp = fopen(temp, "w"); if (!sysfsfp) { ret = -errno; - printf("failed to open %s\n", temp); + fprintf(stderr, "failed to open %s\n", temp); goto error_free; } @@ -685,7 +692,7 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, sysfsfp = fopen(temp, "r"); if (!sysfsfp) { ret = -errno; - printf("failed to open %s\n", temp); + fprintf(stderr, "failed to open %s\n", temp); goto error_free; } @@ -703,8 +710,9 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val, } if (test != val) { - printf("Possible failure in int write %d to %s/%s\n", - val, basedir, filename); + fprintf(stderr, + "Possible failure in int write %d to %s/%s\n", + val, basedir, filename); ret = -1; } } @@ -750,7 +758,7 @@ static int _write_sysfs_string(const char *filename, const char *basedir, char *temp = malloc(strlen(basedir) + strlen(filename) + 2); if (!temp) { - printf("Memory allocation failed\n"); + fprintf(stderr, "Memory allocation failed\n"); return -ENOMEM; } @@ -761,7 +769,7 @@ static int _write_sysfs_string(const char *filename, const char *basedir, sysfsfp = fopen(temp, "w"); if (!sysfsfp) { ret = -errno; - printf("Could not open %s\n", temp); + fprintf(stderr, "Could not open %s\n", temp); goto error_free; } @@ -782,7 +790,7 @@ static int _write_sysfs_string(const char *filename, const char *basedir, sysfsfp = fopen(temp, "r"); if (!sysfsfp) { ret = -errno; - printf("Could not open file to verify\n"); + fprintf(stderr, "Could not open file to verify\n"); goto error_free; } @@ -800,9 +808,10 @@ static int _write_sysfs_string(const char *filename, const char *basedir, } if (strcmp(temp, val) != 0) { - printf("Possible failure in string write of %s " - "Should be %s written to %s/%s\n", temp, val, - basedir, filename); + fprintf(stderr, + "Possible failure in string write of %s " + "Should be %s written to %s/%s\n", temp, val, + basedir, filename); ret = -1; } } @@ -856,7 +865,7 @@ int read_sysfs_posint(const char *filename, const char *basedir) char *temp = malloc(strlen(basedir) + strlen(filename) + 2); if (!temp) { - printf("Memory allocation failed"); + fprintf(stderr, "Memory allocation failed"); return -ENOMEM; } @@ -903,7 +912,7 @@ int read_sysfs_float(const char *filename, const char *basedir, float *val) char *temp = malloc(strlen(basedir) + strlen(filename) + 2); if (!temp) { - printf("Memory allocation failed"); + fprintf(stderr, "Memory allocation failed"); return -ENOMEM; } @@ -950,7 +959,7 @@ int read_sysfs_string(const char *filename, const char *basedir, char *str) char *temp = malloc(strlen(basedir) + strlen(filename) + 2); if (!temp) { - printf("Memory allocation failed"); + fprintf(stderr, "Memory allocation failed"); return -ENOMEM; } diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c index 4f8172fe7881..b271a9a796d2 100644 --- a/tools/iio/lsiio.c +++ b/tools/iio/lsiio.c @@ -108,7 +108,7 @@ static int dump_devices(void) dp = opendir(iio_dir); if (!dp) { - printf("No industrial I/O devices available\n"); + fprintf(stderr, "No industrial I/O devices available\n"); return -ENODEV; } From e5c2f7b56e9e37e3b54910164ce73b11f207f19d Mon Sep 17 00:00:00 2001 From: Miguel Bernabeu Diaz Date: Fri, 17 Jul 2015 01:39:21 +0200 Subject: [PATCH 311/912] staging: lustre: Fix style error with decorator Fixed checkpatch.pl error: ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Miguel Bernabeu Diaz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index f5d1d9f8f1ed..0d8fa3a62c83 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -120,7 +120,7 @@ extern kib_tunables_t kiblnd_tunables; #define IBLND_CREDIT_HIGHWATER_V1 7 /* V1 only : when eagerly to return credits */ #define IBLND_CREDITS_DEFAULT 8 /* default # of peer credits */ -#define IBLND_CREDITS_MAX ((typeof(((kib_msg_t*) 0)->ibm_credits)) - 1) /* Max # of peer credits */ +#define IBLND_CREDITS_MAX ((typeof(((kib_msg_t *) 0)->ibm_credits)) - 1) /* Max # of peer credits */ #define IBLND_MSG_QUEUE_SIZE(v) ((v) == IBLND_MSG_VERSION_1 ? \ IBLND_MSG_QUEUE_SIZE_V1 : \ From 9a2477c2cabddf6fa52eda49502017191b34acb6 Mon Sep 17 00:00:00 2001 From: Kolbeinn Karlsson Date: Sun, 19 Jul 2015 16:23:19 -0400 Subject: [PATCH 312/912] staging: lustre: make functions only used locally static Add a static modifier to two functions that have no separate declaration and are only used within the file they are defined in. This problem was reported by sparse. Signed-off-by: Kolbeinn Karlsson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 8cb1929fd31d..c8ef9e578263 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -485,7 +485,7 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, return rc; } -void ptlrpc_ni_fini(void) +static void ptlrpc_ni_fini(void) { wait_queue_head_t waitq; struct l_wait_info lwi; @@ -529,7 +529,7 @@ lnet_pid_t ptl_get_pid(void) return pid; } -int ptlrpc_ni_init(void) +static int ptlrpc_ni_init(void) { int rc; lnet_pid_t pid; From 3377bad9c7ea427c002173ffcee6fc6a14833739 Mon Sep 17 00:00:00 2001 From: Cihangir Akturk Date: Tue, 21 Jul 2015 10:22:52 +0300 Subject: [PATCH 313/912] staging: lustre: ldlm: Make function static. target_send_reply_msg function is not referenced outside of ldlm_lib.c file, so make it static. Signed-off-by: Cihangir Akturk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 764f98684d74..badd227e4f67 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -656,7 +656,8 @@ int target_pack_pool_reply(struct ptlrpc_request *req) } EXPORT_SYMBOL(target_pack_pool_reply); -int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id) +static int +target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id) { if (OBD_FAIL_CHECK_ORSET(fail_id & ~OBD_FAIL_ONCE, OBD_FAIL_ONCE)) { DEBUG_REQ(D_ERROR, req, "dropping reply"); From 83aa2ac65a36e77f5651ef8946003b856cab49bc Mon Sep 17 00:00:00 2001 From: Cihangir Akturk Date: Wed, 22 Jul 2015 15:59:32 +0300 Subject: [PATCH 314/912] staging: lustre: obdclass: Make structure declerations static const obd_device_list_sops and obd_device_list_fops are not referenced outside of linux-module.c, and in the general use case struct file_operations and struct seq_operations should be a const object, so make them static and const. This patch fixes the following sparse warnings: WARNING: struct seq_operations should normally be const WARNING: struct file_operations should normally be const Signed-off-by: Cihangir Akturk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c index b618c0bd7e09..6218ef34ee80 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c @@ -385,7 +385,7 @@ static int obd_device_list_seq_show(struct seq_file *p, void *v) return 0; } -struct seq_operations obd_device_list_sops = { +static const struct seq_operations obd_device_list_sops = { .start = obd_device_list_seq_start, .stop = obd_device_list_seq_stop, .next = obd_device_list_seq_next, @@ -406,7 +406,7 @@ static int obd_device_list_open(struct inode *inode, struct file *file) return 0; } -struct file_operations obd_device_list_fops = { +static const struct file_operations obd_device_list_fops = { .owner = THIS_MODULE, .open = obd_device_list_open, .read = seq_read, From 217ed3abf1510747590aaa5da93217e559fd8e19 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:33 +0100 Subject: [PATCH 315/912] staging: vt6655: Remove ununsed macro ASSERT VIAWET_DEBUG is not defined so macro is empty. Remove the macro. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/baseband.c | 4 +--- drivers/staging/vt6655/card.c | 1 - drivers/staging/vt6655/device_cfg.h | 9 --------- drivers/staging/vt6655/device_main.c | 9 ++++----- drivers/staging/vt6655/mac.c | 1 - drivers/staging/vt6655/rxtx.c | 1 - 6 files changed, 5 insertions(+), 20 deletions(-) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index b0ea38f1911c..befaa4259fbf 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -1728,10 +1728,8 @@ BBuGetFrameTime( unsigned int uRateIdx = (unsigned int) wRate; unsigned int uRate = 0; - if (uRateIdx > RATE_54M) { - ASSERT(0); + if (uRateIdx > RATE_54M) return 0; - } uRate = (unsigned int)awcFrameTime[uRateIdx]; diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index e00c0605d154..df62bdc44108 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -847,7 +847,6 @@ void CARDvSetLoopbackMode(struct vnt_private *priv, unsigned short wLoopbackMode case CARD_LB_PHY: break; default: - ASSERT(false); break; } /* set MAC loopback */ diff --git a/drivers/staging/vt6655/device_cfg.h b/drivers/staging/vt6655/device_cfg.h index a4a8a8489e0b..c7f21716b4f0 100644 --- a/drivers/staging/vt6655/device_cfg.h +++ b/drivers/staging/vt6655/device_cfg.h @@ -70,17 +70,8 @@ typedef enum _chip_type { } CHIP_TYPE, *PCHIP_TYPE; #ifdef VIAWET_DEBUG -#define ASSERT(x) \ -do { \ - if (!(x)) { \ - pr_err("assertion %s failed: file %s line %d\n", \ - #x, __func__, __LINE__); \ - *(int *)0 = 0; \ - } \ -} while (0) #define DBG_PORT80(value) outb(value, 0x80) #else -#define ASSERT(x) #define DBG_PORT80(value) #endif diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 23ad16eb1d2a..053291a8e844 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -623,7 +623,7 @@ static void device_init_rd0_ring(struct vnt_private *pDevice) for (i = 0; i < pDevice->sOpts.nRxDescs0; i ++, curr += sizeof(SRxDesc)) { pDesc = &(pDevice->aRD0Ring[i]); pDesc->pRDInfo = alloc_rd_info(); - ASSERT(pDesc->pRDInfo); + if (!device_alloc_rx_buf(pDevice, pDesc)) dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n"); @@ -647,7 +647,7 @@ static void device_init_rd1_ring(struct vnt_private *pDevice) for (i = 0; i < pDevice->sOpts.nRxDescs1; i ++, curr += sizeof(SRxDesc)) { pDesc = &(pDevice->aRD1Ring[i]); pDesc->pRDInfo = alloc_rd_info(); - ASSERT(pDesc->pRDInfo); + if (!device_alloc_rx_buf(pDevice, pDesc)) dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n"); @@ -705,7 +705,7 @@ static void device_init_td0_ring(struct vnt_private *pDevice) for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++, curr += sizeof(STxDesc)) { pDesc = &(pDevice->apTD0Rings[i]); pDesc->pTDInfo = alloc_td_info(); - ASSERT(pDesc->pTDInfo); + if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) { pDesc->pTDInfo->buf = pDevice->tx0_bufs + (i)*PKT_BUF_SZ; pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma0 + (i)*PKT_BUF_SZ; @@ -731,7 +731,7 @@ static void device_init_td1_ring(struct vnt_private *pDevice) for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++, curr += sizeof(STxDesc)) { pDesc = &(pDevice->apTD1Rings[i]); pDesc->pTDInfo = alloc_td_info(); - ASSERT(pDesc->pTDInfo); + if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) { pDesc->pTDInfo->buf = pDevice->tx1_bufs + (i) * PKT_BUF_SZ; pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma1 + (i) * PKT_BUF_SZ; @@ -818,7 +818,6 @@ static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pRD) pRDInfo->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); if (pRDInfo->skb == NULL) return false; - ASSERT(pRDInfo->skb); pRDInfo->skb_dma = dma_map_single(&pDevice->pcid->dev, diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index aed530f022b8..65dd49cda333 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -186,7 +186,6 @@ void MACvSetLoopbackMode(void __iomem *dwIoBase, unsigned char byLoopbackMode) { unsigned char byOrgValue; - ASSERT(byLoopbackMode < 3); byLoopbackMode <<= 6; /* set TCR */ VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue); diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 534338c46619..0ffa9bf712be 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -387,7 +387,6 @@ s_uGetDataDuration( break; } - ASSERT(false); return 0; } From fd43585b6405a0b7c6e5ad3c1bcbb32cf186a5a9 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:34 +0100 Subject: [PATCH 316/912] staging: vt6655: remove unused DBG_PORT80 and VIAWET_DEBUG VIAWET_DEBUG is never defined so DBG_PORT80 is empty and never used. Remove both macros. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/baseband.c | 2 -- drivers/staging/vt6655/device_cfg.h | 6 ------ drivers/staging/vt6655/mac.c | 17 ----------------- 3 files changed, 25 deletions(-) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index befaa4259fbf..9e61f2df3a00 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -1943,7 +1943,6 @@ bool BBbReadEmbedded(struct vnt_private *priv, VNSvInPortB(dwIoBase + MAC_REG_BBREGDATA, pbyData); if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x30); pr_debug(" DBG_PORT80(0x30)\n"); return false; } @@ -1986,7 +1985,6 @@ bool BBbWriteEmbedded(struct vnt_private *priv, } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x31); pr_debug(" DBG_PORT80(0x31)\n"); return false; } diff --git a/drivers/staging/vt6655/device_cfg.h b/drivers/staging/vt6655/device_cfg.h index c7f21716b4f0..b4c9547d3138 100644 --- a/drivers/staging/vt6655/device_cfg.h +++ b/drivers/staging/vt6655/device_cfg.h @@ -69,10 +69,4 @@ typedef enum _chip_type { VT3253 = 1 } CHIP_TYPE, *PCHIP_TYPE; -#ifdef VIAWET_DEBUG -#define DBG_PORT80(value) outb(value, 0x80) -#else -#define DBG_PORT80(value) -#endif - #endif diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index 65dd49cda333..3dfd333475c0 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -373,7 +373,6 @@ bool MACbSafeRxOff(void __iomem *dwIoBase) break; } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x10); pr_debug(" DBG_PORT80(0x10)\n"); return false; } @@ -383,7 +382,6 @@ bool MACbSafeRxOff(void __iomem *dwIoBase) break; } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x11); pr_debug(" DBG_PORT80(0x11)\n"); return false; } @@ -397,7 +395,6 @@ bool MACbSafeRxOff(void __iomem *dwIoBase) break; } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x12); pr_debug(" DBG_PORT80(0x12)\n"); return false; } @@ -435,7 +432,6 @@ bool MACbSafeTxOff(void __iomem *dwIoBase) break; } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x20); pr_debug(" DBG_PORT80(0x20)\n"); return false; } @@ -445,7 +441,6 @@ bool MACbSafeTxOff(void __iomem *dwIoBase) break; } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x21); pr_debug(" DBG_PORT80(0x21)\n"); return false; } @@ -460,7 +455,6 @@ bool MACbSafeTxOff(void __iomem *dwIoBase) break; } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x24); pr_debug(" DBG_PORT80(0x24)\n"); return false; } @@ -485,13 +479,11 @@ bool MACbSafeStop(void __iomem *dwIoBase) MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX); if (!MACbSafeRxOff(dwIoBase)) { - DBG_PORT80(0xA1); pr_debug(" MACbSafeRxOff == false)\n"); MACbSafeSoftwareReset(dwIoBase); return false; } if (!MACbSafeTxOff(dwIoBase)) { - DBG_PORT80(0xA2); pr_debug(" MACbSafeTxOff == false)\n"); MACbSafeSoftwareReset(dwIoBase); return false; @@ -589,9 +581,6 @@ void MACvSetCurrRx0DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr break; } - if (ww == W_MAX_TIMEOUT) - DBG_PORT80(0x13); - VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, dwCurrDescAddr); if (byOrgDMACtl & DMACTL_RUN) VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN); @@ -626,8 +615,6 @@ void MACvSetCurrRx1DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr if (!(byData & DMACTL_RUN)) break; } - if (ww == W_MAX_TIMEOUT) - DBG_PORT80(0x14); VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, dwCurrDescAddr); if (byOrgDMACtl & DMACTL_RUN) @@ -665,8 +652,6 @@ void MACvSetCurrTx0DescAddrEx(void __iomem *dwIoBase, if (!(byData & DMACTL_RUN)) break; } - if (ww == W_MAX_TIMEOUT) - DBG_PORT80(0x25); VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, dwCurrDescAddr); if (byOrgDMACtl & DMACTL_RUN) @@ -705,7 +690,6 @@ void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase, break; } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x26); pr_debug(" DBG_PORT80(0x26)\n"); } VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, dwCurrDescAddr); @@ -806,7 +790,6 @@ bool MACbPSWakeup(void __iomem *dwIoBase) break; } if (ww == W_MAX_TIMEOUT) { - DBG_PORT80(0x36); pr_debug(" DBG_PORT80(0x33)\n"); return false; } From 3a00033ee8697e2e0acf07d03dbea55c4b7236ca Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:35 +0100 Subject: [PATCH 317/912] staging: vt6655: dead code tx path remove dma_unmap_single When pTDInfo->skb_dma not equal to pTDInfo->buf_dma, pTDInfo->skb_dma equals zero. as mentioned in comment pre-allocated buf_dma can't be unmapped so remove dead code. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 053291a8e844..695aa25e819d 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -754,10 +754,6 @@ static void device_free_td0_ring(struct vnt_private *pDevice) PSTxDesc pDesc = &(pDevice->apTD0Rings[i]); PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; - if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) - dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, - pTDInfo->skb->len, DMA_TO_DEVICE); - dev_kfree_skb(pTDInfo->skb); kfree(pDesc->pTDInfo); } @@ -771,10 +767,6 @@ static void device_free_td1_ring(struct vnt_private *pDevice) PSTxDesc pDesc = &(pDevice->apTD1Rings[i]); PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; - if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) - dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, - pTDInfo->skb->len, DMA_TO_DEVICE); - dev_kfree_skb(pTDInfo->skb); kfree(pDesc->pTDInfo); } @@ -975,12 +967,6 @@ static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; struct sk_buff *skb = pTDInfo->skb; - /* pre-allocated buf_dma can't be unmapped. */ - if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) { - dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, - skb->len, DMA_TO_DEVICE); - } - if (skb) ieee80211_tx_status_irqsafe(pDevice->hw, skb); From 06f716a57e6d7dc8f7638ea8c19a9a4cdf46ed23 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:36 +0100 Subject: [PATCH 318/912] staging: vt6655: remove unnecessary variable skb_dma skb_dma flips from 0 to the contents buf_dma. This is nolonger necessary so use buf_dma directly and remove skb_dma altogether. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 1 - drivers/staging/vt6655/device_main.c | 3 +-- drivers/staging/vt6655/rxtx.c | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 758eeb2afd51..d56810133da4 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -256,7 +256,6 @@ typedef struct tagDEVICE_TD_INFO { void *mic_hdr; struct sk_buff *skb; unsigned char *buf; - dma_addr_t skb_dma; dma_addr_t buf_dma; dma_addr_t curr_desc; unsigned long dwReqCount; diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 695aa25e819d..89611a70d785 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -970,7 +970,6 @@ static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) if (skb) ieee80211_tx_status_irqsafe(pDevice->hw, skb); - pTDInfo->skb_dma = 0; pTDInfo->skb = NULL; pTDInfo->byFlags = 0; } @@ -1201,7 +1200,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) head_td->m_td1TD1.wReqCount = cpu_to_le16((u16)head_td->pTDInfo->dwReqCount); - head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); + head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->buf_dma); /* Poll Transmit the adapter */ wmb(); diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 0ffa9bf712be..82380f3ed05b 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1202,7 +1202,6 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, ptdCurr->pTDInfo->dwReqCount = cbReqCount; ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; - ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; return cbHeaderLength; } From eae6377eb01d6b8a6cb3f1047ae35829e22e4e04 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:37 +0100 Subject: [PATCH 319/912] staging: vt6655: Remove unused tagDEVICE_TD_INFO curr_desc The variable is assigned a value that is never used. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 1 - drivers/staging/vt6655/device_main.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index d56810133da4..485c6fd05713 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -257,7 +257,6 @@ typedef struct tagDEVICE_TD_INFO { struct sk_buff *skb; unsigned char *buf; dma_addr_t buf_dma; - dma_addr_t curr_desc; unsigned long dwReqCount; unsigned long dwHeaderLength; unsigned char byFlags; diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 89611a70d785..7409ed2f3a95 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -711,7 +711,6 @@ static void device_init_td0_ring(struct vnt_private *pDevice) pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma0 + (i)*PKT_BUF_SZ; } pDesc->next = &(pDevice->apTD0Rings[(i+1) % pDevice->sOpts.nTxDescs[0]]); - pDesc->pTDInfo->curr_desc = cpu_to_le32(curr); pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc)); } @@ -737,7 +736,6 @@ static void device_init_td1_ring(struct vnt_private *pDevice) pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma1 + (i) * PKT_BUF_SZ; } pDesc->next = &(pDevice->apTD1Rings[(i + 1) % pDevice->sOpts.nTxDescs[1]]); - pDesc->pTDInfo->curr_desc = cpu_to_le32(curr); pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc)); } From 75a8eee2d71e6abe9e25a20c8e3c16c53489c90e Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:38 +0100 Subject: [PATCH 320/912] staging: vt6655: fix tagDEVICE_TD_INFO -> buff_addr type Should always be __le32 type Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 485c6fd05713..8dc53bd72983 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -266,7 +266,7 @@ typedef struct tagDEVICE_TD_INFO { typedef struct tagSTxDesc { volatile STDES0 m_td0TD0; volatile STDES1 m_td1TD1; - volatile u32 buff_addr; + volatile __le32 buff_addr; volatile u32 next_desc; struct tagSTxDesc *next __aligned(8); volatile PDEVICE_TD_INFO pTDInfo __aligned(8); From 5fa9d9898d370789f12af420c118159a23f166e8 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:39 +0100 Subject: [PATCH 321/912] staging: vt6655: fix tagSTxDesc -> next_desc type Should always be __le32 type Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 8dc53bd72983..26cd3e1af430 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -267,7 +267,7 @@ typedef struct tagSTxDesc { volatile STDES0 m_td0TD0; volatile STDES1 m_td1TD1; volatile __le32 buff_addr; - volatile u32 next_desc; + volatile __le32 next_desc; struct tagSTxDesc *next __aligned(8); volatile PDEVICE_TD_INFO pTDInfo __aligned(8); } __attribute__ ((__packed__)) From db1ade7cee35a2d22653811c67cd4d9c60c8a4ad Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:40 +0100 Subject: [PATCH 322/912] staging: vt6655: remove unused tagDEVICE_RD_INFO -> curr_desc variable is assigned a value that is never used. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 1 - drivers/staging/vt6655/device_main.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 26cd3e1af430..3302d01821a8 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -170,7 +170,6 @@ typedef struct tagDEVICE_RD_INFO { struct sk_buff *skb; dma_addr_t skb_dma; - dma_addr_t curr_desc; } DEVICE_RD_INFO, *PDEVICE_RD_INFO; #ifdef __BIG_ENDIAN diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 7409ed2f3a95..c82bf48499f0 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -628,7 +628,6 @@ static void device_init_rd0_ring(struct vnt_private *pDevice) dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n"); pDesc->next = &(pDevice->aRD0Ring[(i+1) % pDevice->sOpts.nRxDescs0]); - pDesc->pRDInfo->curr_desc = cpu_to_le32(curr); pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc)); } @@ -652,7 +651,6 @@ static void device_init_rd1_ring(struct vnt_private *pDevice) dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n"); pDesc->next = &(pDevice->aRD1Ring[(i+1) % pDevice->sOpts.nRxDescs1]); - pDesc->pRDInfo->curr_desc = cpu_to_le32(curr); pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc)); } From f0fb87fba09473e6b39e351c7da59b4faa9a4fcf Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:41 +0100 Subject: [PATCH 323/912] staging: vt6655: Fix tagSRxDesc -> buff_addr type Should always be __le32. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 3302d01821a8..42e005a5de9b 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -208,7 +208,7 @@ SRDES1; typedef struct tagSRxDesc { volatile SRDES0 m_rd0RD0; volatile SRDES1 m_rd1RD1; - volatile u32 buff_addr; + volatile __le32 buff_addr; volatile u32 next_desc; struct tagSRxDesc *next __aligned(8); volatile PDEVICE_RD_INFO pRDInfo __aligned(8); From f1e3e92135202ff3d95195393ee62808c109208c Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:42 +0100 Subject: [PATCH 324/912] staging: vt6655: fix tagSRxDesc -> next_desc type Should always be __le32 Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 42e005a5de9b..251f7bcb9bad 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -209,7 +209,7 @@ typedef struct tagSRxDesc { volatile SRDES0 m_rd0RD0; volatile SRDES1 m_rd1RD1; volatile __le32 buff_addr; - volatile u32 next_desc; + volatile __le32 next_desc; struct tagSRxDesc *next __aligned(8); volatile PDEVICE_RD_INFO pRDInfo __aligned(8); } __attribute__ ((__packed__)) From 7135d9a76f787f089faad0e08bdef259cb019d64 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:43 +0100 Subject: [PATCH 325/912] staging: vt6655: Fix wReqCount to __le16 Should be __le16 and do and correct endian conversion. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/card.c | 8 ++++---- drivers/staging/vt6655/desc.h | 6 +++--- drivers/staging/vt6655/dpc.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index df62bdc44108..ae8fd7f491a3 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -573,17 +573,17 @@ CARDvSafeResetRx( /* init state, all RD is chip's */ for (uu = 0; uu < pDevice->sOpts.nRxDescs0; uu++) { pDesc = &(pDevice->aRD0Ring[uu]); - pDesc->m_rd0RD0.wResCount = (unsigned short)(pDevice->rx_buf_sz); + pDesc->m_rd0RD0.wResCount = cpu_to_le16(pDevice->rx_buf_sz); pDesc->m_rd0RD0.f1Owner = OWNED_BY_NIC; - pDesc->m_rd1RD1.wReqCount = (unsigned short)(pDevice->rx_buf_sz); + pDesc->m_rd1RD1.wReqCount = cpu_to_le16(pDevice->rx_buf_sz); } /* init state, all RD is chip's */ for (uu = 0; uu < pDevice->sOpts.nRxDescs1; uu++) { pDesc = &(pDevice->aRD1Ring[uu]); - pDesc->m_rd0RD0.wResCount = (unsigned short)(pDevice->rx_buf_sz); + pDesc->m_rd0RD0.wResCount = cpu_to_le16(pDevice->rx_buf_sz); pDesc->m_rd0RD0.f1Owner = OWNED_BY_NIC; - pDesc->m_rd1RD1.wReqCount = (unsigned short)(pDevice->rx_buf_sz); + pDesc->m_rd1RD1.wReqCount = cpu_to_le16(pDevice->rx_buf_sz); } /* set perPkt mode */ diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 251f7bcb9bad..f6563d3684cd 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -175,7 +175,7 @@ typedef struct tagDEVICE_RD_INFO { #ifdef __BIG_ENDIAN typedef struct tagRDES0 { - volatile unsigned short wResCount; + volatile __le16 wResCount; union { volatile u16 f15Reserved; struct { @@ -190,7 +190,7 @@ SRDES0, *PSRDES0; #else typedef struct tagRDES0 { - unsigned short wResCount; + __le16 wResCount; unsigned short f15Reserved:15; unsigned short f1Owner:1; } __attribute__ ((__packed__)) @@ -199,7 +199,7 @@ SRDES0; #endif typedef struct tagRDES1 { - unsigned short wReqCount; + __le16 wReqCount; unsigned short wReserved; } __attribute__ ((__packed__)) SRDES1; diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index b25ee962558d..e14eed160a19 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -144,7 +144,7 @@ bool vnt_receive_frame(struct vnt_private *priv, PSRxDesc curr_rd) priv->rx_buf_sz, DMA_FROM_DEVICE); frame_size = le16_to_cpu(curr_rd->m_rd1RD1.wReqCount) - - cpu_to_le16(curr_rd->m_rd0RD0.wResCount); + - le16_to_cpu(curr_rd->m_rd0RD0.wResCount); if ((frame_size > 2364) || (frame_size < 33)) { /* Frame Size error drop this packet.*/ From 1cf0a47c8c4986b8fa946156a19f7b02dc303a43 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:44 +0100 Subject: [PATCH 326/912] staging: vt6655: fix tagTDES1 -> wReqCount type should be __le16 Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index f6563d3684cd..2374fa5d381f 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -245,7 +245,7 @@ STDES0; #endif typedef struct tagTDES1 { - volatile unsigned short wReqCount; + volatile __le16 wReqCount; volatile unsigned char byTCR; volatile unsigned char byReserved; } __attribute__ ((__packed__)) From d5806c53fe7805ebf4934debbe21fc42f78840f4 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:45 +0100 Subject: [PATCH 327/912] staging: vt6655: always set 32 bit dma mask The device is limited to 32 bit address space. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index c82bf48499f0..c97353bfab72 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1747,6 +1747,12 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) return -ENODEV; } + if (dma_set_mask(&pcid->dev, DMA_BIT_MASK(32))) { + dev_err(&pcid->dev, ": Failed to set dma 32 bit mask\n"); + device_free_info(priv); + return -ENODEV; + } + INIT_WORK(&priv->interrupt_work, vnt_interrupt_work); /* do reset */ From c5c7bd269d52d1d6708053d1a8521779e98b4989 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:46 +0100 Subject: [PATCH 328/912] staging: vt6655: s_cbFillTxBufHead replace STxBufHead vnt_tx_fifo_head has now replaced STxBufHead Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 82380f3ed05b..380b879c05db 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1088,7 +1088,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, /* Set RrvTime/RTS/CTS Buffer */ - wTxBufSize = sizeof(STxBufHead); + wTxBufSize = sizeof(struct vnt_tx_fifo_head); if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {/* 802.11g packet */ if (byFBOption == AUTO_FB_NONE) { From 03c44dd62e4f947516929c3ba0734027c3a26708 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 22 Jul 2015 19:16:47 +0100 Subject: [PATCH 329/912] staging: vt6655: desc.h remove dead strctures Remove these unsed structures. typedef struct tagSTxSyncDesc typedef struct tagSRrvTime_atim typedef struct tagSTxBufHead typedef struct tagSBEACONCtl typedef struct tagSSecretKey typedef struct tagSKeyEntry Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 59 ----------------------------------- 1 file changed, 59 deletions(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 2374fa5d381f..c9162149eb61 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -273,27 +273,6 @@ typedef struct tagSTxDesc { STxDesc, *PSTxDesc; typedef const STxDesc *PCSTxDesc; -typedef struct tagSTxSyncDesc { - volatile STDES0 m_td0TD0; - volatile STDES1 m_td1TD1; - volatile u32 buff_addr; /* pointer to logical buffer */ - volatile u32 next_desc; /* pointer to next logical descriptor */ - volatile unsigned short m_wFIFOCtl; - volatile unsigned short m_wTimeStamp; - struct tagSTxSyncDesc *next __aligned(8); - volatile PDEVICE_TD_INFO pTDInfo __aligned(8); -} __attribute__ ((__packed__)) -STxSyncDesc, *PSTxSyncDesc; -typedef const STxSyncDesc *PCSTxSyncDesc; - -/* RsvTime buffer header */ -typedef struct tagSRrvTime_atim { - unsigned short wCTSTxRrvTime_ba; - unsigned short wTxRrvTime_a; -} __attribute__ ((__packed__)) -SRrvTime_atim, *PSRrvTime_atim; -typedef const SRrvTime_atim *PCSRrvTime_atim; - /* Length, Service, and Signal fields of Phy for Tx */ struct vnt_phy_field { u8 signal; @@ -307,42 +286,4 @@ union vnt_phy_field_swap { u32 field_write; }; -/* Tx FIFO header */ -typedef struct tagSTxBufHead { - u32 adwTxKey[4]; - unsigned short wFIFOCtl; - unsigned short wTimeStamp; - unsigned short wFragCtl; - unsigned char byTxPower; - unsigned char wReserved; -} __attribute__ ((__packed__)) -STxBufHead, *PSTxBufHead; -typedef const STxBufHead *PCSTxBufHead; - -typedef struct tagSBEACONCtl { - u32 BufReady:1; - u32 TSF:15; - u32 BufLen:11; - u32 Reserved:5; -} __attribute__ ((__packed__)) -SBEACONCtl; - -typedef struct tagSSecretKey { - u32 dwLowDword; - unsigned char byHighByte; -} __attribute__ ((__packed__)) -SSecretKey; - -typedef struct tagSKeyEntry { - unsigned char abyAddrHi[2]; - unsigned short wKCTL; - unsigned char abyAddrLo[4]; - u32 dwKey0[4]; - u32 dwKey1[4]; - u32 dwKey2[4]; - u32 dwKey3[4]; - u32 dwKey4[4]; -} __attribute__ ((__packed__)) -SKeyEntry; - #endif /* __DESC_H__ */ From d258bf054a446c77a9cb7fa31dc4518ba2f1861d Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Mon, 20 Jul 2015 16:53:15 +0530 Subject: [PATCH 330/912] staging: comedi: drivers: pcl816.c remove leading space Checkpatch.pl warning - suspect code indent for conditional statements - is corrected Signed-off-by: Chandra S Gorentla Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl816.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 781b321587dc..a353d1b155bb 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -305,7 +305,7 @@ static int check_channel_list(struct comedi_device *dev, chansegment[0] = chanlist[0]; for (i = 1, seglen = 1; i < chanlen; i++, seglen++) { /* we detect loop, this must by finish */ - if (chanlist[0] == chanlist[i]) + if (chanlist[0] == chanlist[i]) break; nowmustbechan = (CR_CHAN(chansegment[i - 1]) + 1) % chanlen; From e73063c5407b6ffe09dc0f7c11970113bf55e6fc Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Wed, 22 Jul 2015 18:45:55 +0100 Subject: [PATCH 331/912] staging/comedi/drivers/usbduxsigma.c: updated address details Changed my e-mail address to mail@berndporr.me.uk. The old one is no longer used. Signed-off-by: Bernd Porr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index eaa9add491df..2c27eb2bc2f5 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1653,7 +1653,7 @@ static struct usb_driver usbduxsigma_usb_driver = { }; module_comedi_usb_driver(usbduxsigma_driver, usbduxsigma_usb_driver); -MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com"); -MODULE_DESCRIPTION("Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com"); +MODULE_AUTHOR("Bernd Porr, mail@berndporr.me.uk"); +MODULE_DESCRIPTION("Stirling/ITL USB-DUX SIGMA -- mail@berndporr.me.uk"); MODULE_LICENSE("GPL"); MODULE_FIRMWARE(FIRMWARE); From d5a372df8661113b8aa36f4eb29d4b969d1d3db4 Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Wed, 22 Jul 2015 18:46:39 +0100 Subject: [PATCH 332/912] staging/comedi/drivers/usbduxsigma.c: added support for ehci drivers urb->interval is deprecated and thus I've changed the driver that it now always assumes interval=1 which means every frame in USB 1.1 and every uframe in USB 2.0. However we still need to have different sampling rates which are still multiples of the interval which is now transmitted to the firmware. The firmware transmits either zero length packets or none every (u)frame. This is checked in the completion handler and any packet at zero length is discarded so that comedi again sees the data coming in at the interval specified. This also then gives the ADC the necessary time to convert. For example 16 channels require about 700us and in this period no packet could be transmitted. In this case this is padded up to 1ms so that we have then 7 zero length packets and one packet with the ADC data. Signed-off-by: Bernd Porr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 69 ++++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 2c27eb2bc2f5..51846adf8340 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1,6 +1,6 @@ /* * usbduxsigma.c - * Copyright (C) 2011-2014 Bernd Porr, mail@berndporr.me.uk + * Copyright (C) 2011-2015 Bernd Porr, mail@berndporr.me.uk * * 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 @@ -18,7 +18,7 @@ * Description: University of Stirling USB DAQ & INCITE Technology Limited * Devices: [ITL] USB-DUX-SIGMA (usbduxsigma) * Author: Bernd Porr - * Updated: 10 Oct 2014 + * Updated: 20 July 2015 * Status: stable */ @@ -39,6 +39,7 @@ * 0.4: fixed D/A voltage range * 0.5: various bug fixes, health check at startup * 0.6: corrected wrong input range + * 0.7: rewrite code that urb->interval is always 1 */ #include @@ -122,7 +123,7 @@ #define RETRIES 10 /* bulk transfer commands to usbduxsigma */ -#define USBBUXSIGMA_AD_CMD 0 +#define USBBUXSIGMA_AD_CMD 9 #define USBDUXSIGMA_DA_CMD 1 #define USBDUXSIGMA_DIO_CFG_CMD 2 #define USBDUXSIGMA_DIO_BITS_CMD 3 @@ -217,24 +218,28 @@ static void usbduxsigma_ai_handle_urb(struct comedi_device *dev, int ret; int i; - devpriv->ai_counter--; - if (devpriv->ai_counter == 0) { - devpriv->ai_counter = devpriv->ai_timer; + if ((urb->actual_length > 0) && (urb->status != -EXDEV)) { + devpriv->ai_counter--; + if (devpriv->ai_counter == 0) { + devpriv->ai_counter = devpriv->ai_timer; - /* get the data from the USB bus and hand it over to comedi */ - for (i = 0; i < cmd->chanlist_len; i++) { - /* transfer data, note first byte is the DIO state */ - val = be32_to_cpu(devpriv->in_buf[i+1]); - val &= 0x00ffffff; /* strip status byte */ - val ^= 0x00800000; /* convert to unsigned */ + /* get the data from the USB bus + and hand it over to comedi */ + for (i = 0; i < cmd->chanlist_len; i++) { + /* transfer data, + note first byte is the DIO state */ + val = be32_to_cpu(devpriv->in_buf[i+1]); + val &= 0x00ffffff; /* strip status byte */ + val ^= 0x00800000; /* convert to unsigned */ - if (!comedi_buf_write_samples(s, &val, 1)) - return; + if (!comedi_buf_write_samples(s, &val, 1)) + return; + } + + if (cmd->stop_src == TRIG_COUNT && + async->scans_done >= cmd->stop_arg) + async->events |= COMEDI_CB_EOA; } - - if (cmd->stop_src == TRIG_COUNT && - async->scans_done >= cmd->stop_arg) - async->events |= COMEDI_CB_EOA; } /* if command is still running, resubmit urb */ @@ -374,10 +379,7 @@ static void usbduxsigma_ao_handle_urb(struct comedi_device *dev, urb->transfer_buffer_length = SIZEOUTBUF; urb->dev = comedi_to_usb_dev(dev); urb->status = 0; - if (devpriv->high_speed) - urb->interval = 8; /* uframes */ - else - urb->interval = 1; /* frames */ + urb->interval = 1; /* (u)frames */ urb->number_of_packets = 1; urb->iso_frame_desc[0].offset = 0; urb->iso_frame_desc[0].length = SIZEOUTBUF; @@ -441,7 +443,6 @@ static int usbduxsigma_submit_urbs(struct comedi_device *dev, int input_urb) { struct usb_device *usb = comedi_to_usb_dev(dev); - struct usbduxsigma_private *devpriv = dev->private; struct urb *urb; int ret; int i; @@ -452,7 +453,7 @@ static int usbduxsigma_submit_urbs(struct comedi_device *dev, /* in case of a resubmission after an unlink... */ if (input_urb) - urb->interval = devpriv->ai_interval; + urb->interval = 1; urb->context = dev; urb->dev = usb; urb->status = 0; @@ -674,13 +675,14 @@ static int usbduxsigma_ai_cmd(struct comedi_device *dev, create_adc_command(chan, &muxsg0, &muxsg1); } - devpriv->dux_commands[1] = len; /* num channels per time step */ - devpriv->dux_commands[2] = 0x12; /* CONFIG0 */ - devpriv->dux_commands[3] = 0x03; /* CONFIG1: 23kHz sample, delay 0us */ - devpriv->dux_commands[4] = 0x00; /* CONFIG3: diff. channels off */ - devpriv->dux_commands[5] = muxsg0; - devpriv->dux_commands[6] = muxsg1; - devpriv->dux_commands[7] = sysred; + devpriv->dux_commands[1] = devpriv->ai_interval; + devpriv->dux_commands[2] = len; /* num channels per time step */ + devpriv->dux_commands[3] = 0x12; /* CONFIG0 */ + devpriv->dux_commands[4] = 0x03; /* CONFIG1: 23kHz sample, delay 0us */ + devpriv->dux_commands[5] = 0x00; /* CONFIG3: diff. channels off */ + devpriv->dux_commands[6] = muxsg0; + devpriv->dux_commands[7] = muxsg1; + devpriv->dux_commands[8] = sysred; ret = usbbuxsigma_send_cmd(dev, USBBUXSIGMA_AD_CMD); if (ret < 0) { @@ -1427,10 +1429,7 @@ static int usbduxsigma_alloc_usb_buffers(struct comedi_device *dev) urb->transfer_buffer_length = SIZEOUTBUF; urb->iso_frame_desc[0].offset = 0; urb->iso_frame_desc[0].length = SIZEOUTBUF; - if (devpriv->high_speed) - urb->interval = 8; /* uframes */ - else - urb->interval = 1; /* frames */ + urb->interval = 1; /* (u)frames */ } if (devpriv->pwm_buf_sz) { From 9d7a0ffe6d83fcafac7825fe589f856a772f7389 Mon Sep 17 00:00:00 2001 From: Aaron Ouellette Date: Thu, 16 Jul 2015 21:21:16 -0400 Subject: [PATCH 333/912] staging: sm750fb: removed extra parentheses fixed checkpatch.pl error: ERROR: return is not a function, parentheses are not needed Signed-off-by: Aaron Ouellette Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index c8c51be53d68..3c04447f0283 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -20,7 +20,7 @@ unsigned int getPowerMode(void) { if (getChipType() == SM750LE) return 0; - return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); + return FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE); } From 9a2c874c51df5ed29d482b5294541f06a6f24328 Mon Sep 17 00:00:00 2001 From: Antoine BLIN Date: Fri, 17 Jul 2015 15:04:34 +0200 Subject: [PATCH 334/912] staging: sm750fb: ddk750_power.c: Split lines over 80 characters. Fix up "line over 80 characters" warning found by the checkpatch.pl script. Signed-off-by: Antoine BLIN Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_power.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 3c04447f0283..e580dab2b625 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -8,7 +8,8 @@ void ddk750_setDPMS(DPMS_t state) if (getChipType() == SM750LE) { value = PEEK32(CRT_DISPLAY_CTRL); - POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); + POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, + DPMS, state)); } else { value = PEEK32(SYSTEM_CTRL); value = FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); @@ -39,15 +40,18 @@ void setPowerMode(unsigned int powerMode) switch (powerMode) { case POWER_MODE_CTRL_MODE_MODE0: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, + MODE0); break; case POWER_MODE_CTRL_MODE_MODE1: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE1); + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, + MODE1); break; case POWER_MODE_CTRL_MODE_SLEEP: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, SLEEP); + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, + SLEEP); break; default: @@ -138,8 +142,9 @@ void enableZVPort(unsigned int enable) gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); #endif } else { - /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used - or not. Therefore, do not disable the GPIO gate. */ + /* Disable ZV Port Gate. There is no way to know whether the + GPIO pins are being used or not. Therefore, do not disable the + GPIO gate. */ gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); } From 8da24c93327037a6fb1f760f5fc70e33c9abaefb Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 21 Jul 2015 18:57:24 +0530 Subject: [PATCH 335/912] staging: rtl8188eu: remove unused define _HCI_INTF_C_ was only defined here but not being used anywhere. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 5490b2905075..f6c6f4a9982c 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -17,7 +17,6 @@ * * ******************************************************************************/ -#define _HCI_INTF_C_ #define pr_fmt(fmt) "R8188EU: " fmt #include From 586b06328c16c04a7040c92b7a13aea0447e35ec Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 21 Jul 2015 18:57:25 +0530 Subject: [PATCH 336/912] staging: rtl8188eu: remove label Directly return NULL instead of using another label and goto. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index f6c6f4a9982c..09a918ec6e10 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -66,7 +66,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL); if (pdvobjpriv == NULL) - goto exit; + return NULL; pdvobjpriv->pusbintf = usb_intf; pusbd = interface_to_usbdev(usb_intf); @@ -121,7 +121,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) kfree(pdvobjpriv); pdvobjpriv = NULL; } -exit: + return pdvobjpriv; } From 705a31369845d7ad522dc9bce6ca430831ff0454 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 21 Jul 2015 18:57:26 +0530 Subject: [PATCH 337/912] staging: rtl8188eu: check for kzalloc failure Check for kzalloc failure and directly return from the error patch thus simplifying the success path. Suggested-by: Dan Carpenter Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 09a918ec6e10..1c9558ff1c19 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -114,13 +114,12 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) mutex_init(&pdvobjpriv->usb_vendor_req_mutex); pdvobjpriv->usb_vendor_req_buf = kzalloc(MAX_USB_IO_CTL_SIZE, GFP_KERNEL); - if (pdvobjpriv->usb_vendor_req_buf) { - usb_get_dev(pusbd); - } else { + if (!pdvobjpriv->usb_vendor_req_buf) { usb_set_intfdata(usb_intf, NULL); kfree(pdvobjpriv); - pdvobjpriv = NULL; + return NULL; } + usb_get_dev(pusbd); return pdvobjpriv; } From e0732f84b40bc7219d077ddd69b5cc03ec6e7838 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 21 Jul 2015 18:57:27 +0530 Subject: [PATCH 338/912] staging: rtl8188eu: dont mix success and error path Success and error path was mixed. Separate them by directly returning 0 from the success path. In the process remove the variable which became unused. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 1c9558ff1c19..29b7ea6dc16d 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -474,7 +474,6 @@ static void rtw_usb_if1_deinit(struct adapter *if1) static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid) { struct adapter *if1 = NULL; - int status = _FAIL; struct dvobj_priv *dvobj; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n")); @@ -495,13 +494,12 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-871x_drv - drv_init, success!\n")); - status = _SUCCESS; + return 0; free_dvobj: - if (status != _SUCCESS) - usb_dvobj_deinit(pusb_intf); + usb_dvobj_deinit(pusb_intf); exit: - return status == _SUCCESS ? 0 : -ENODEV; + return -ENODEV; } /* From 0a32bd33ed3e03258e255a5b580ce7b3f514763e Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 21 Jul 2015 18:57:28 +0530 Subject: [PATCH 339/912] staging: rtl8188eu: remove multiple blank line Multiple blank lines should be avoided. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 29b7ea6dc16d..5f44c6a5b777 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -63,7 +63,6 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) struct usb_endpoint_descriptor *pendp_desc; struct usb_device *pusbd; - pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL); if (pdvobjpriv == NULL) return NULL; @@ -128,7 +127,6 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf) { struct dvobj_priv *dvobj = usb_get_intfdata(usb_intf); - usb_set_intfdata(usb_intf, NULL); if (dvobj) { /* Modify condition for 92DU DMDP 2010.11.18, by Thomas */ @@ -326,7 +324,6 @@ exit: pr_debug("<=== %s return %d.............. in %dms\n", __func__, ret, rtw_get_passing_time_ms(start_time)); - return ret; } @@ -511,7 +508,6 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); struct adapter *padapter = dvobj->if1; - pr_debug("+rtw_dev_remove\n"); RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+dev_remove()\n")); From 047db9915ed576e817eb02c1d1cf037c49856b59 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sun, 19 Jul 2015 13:52:17 +0300 Subject: [PATCH 340/912] Staging: rtl8192u: pointer math bug in ieee80211_rx_DELBA() Smatch complains because "delba" is a pointer to struct rtl_80211_hdr_3addr so the "delba += sizeof(struct rtl_80211_hdr_3addr);" is clearly wrong. We are reading nonsense data from beyond the end of the buffer and could oops if that memory isn't mapped. It turns out the next two statements are also wrong. We should delete the += sizeof() statement and "delba+2" should be "&delba->payload[2]". "pReasonCode" isn't used so I deleted that. With-Fix-From: Mateusz Kulikowski Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 9ff8e056ab7f..d4215fd5a856 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -571,7 +571,6 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) { struct rtl_80211_hdr_3addr *delba = NULL; PDELBA_PARAM_SET pDelBaParamSet = NULL; - u16 *pReasonCode = NULL; u8 *dst = NULL; if (skb->len < sizeof(struct rtl_80211_hdr_3addr) + 6) { @@ -592,9 +591,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); delba = (struct rtl_80211_hdr_3addr *)skb->data; dst = (u8 *)(&delba->addr2[0]); - delba += sizeof(struct rtl_80211_hdr_3addr); - pDelBaParamSet = (PDELBA_PARAM_SET)(delba+2); - pReasonCode = (u16 *)(delba+4); + pDelBaParamSet = (PDELBA_PARAM_SET)&delba->payload[2]; if(pDelBaParamSet->field.Initiator == 1) { From f9bd549aa99a12e42b8811efa3cb7d8c3d084a20 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Mon, 20 Jul 2015 18:35:42 +0200 Subject: [PATCH 341/912] staging: rtl8192u: remove bool comparisons Remove explicit true/false comparisons to bool variables. Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 ++-- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 4 ++-- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 12 ++++++------ .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 14 +++++++------- .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 7 ++++--- drivers/staging/rtl8192u/r8192U_dm.c | 8 ++++---- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index b374088c5ff8..0aa9021cb95e 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -1014,7 +1014,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, goto rx_dropped; // if QoS enabled, should check the sequence for each of the AC - if( (ieee->pHTInfo->bCurRxReorderEnable == false) || !ieee->current_network.qos_data.active|| !IsDataFrame(skb->data) || IsLegacyDataFrame(skb->data)){ + if ((!ieee->pHTInfo->bCurRxReorderEnable) || !ieee->current_network.qos_data.active|| !IsDataFrame(skb->data) || IsLegacyDataFrame(skb->data)) { if (is_duplicate_packet(ieee, hdr)) goto rx_dropped; @@ -1307,7 +1307,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, } //added by amy for reorder - if(ieee->pHTInfo->bCurRxReorderEnable == false ||pTS == NULL){ + if (!ieee->pHTInfo->bCurRxReorderEnable || pTS == NULL){ //added by amy for reorder for(i = 0; inr_subframes; i++) { struct sk_buff *sub_skb = rxb->subframes[i]; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index a1f9d42833e0..39e9892c3fa6 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1964,7 +1964,7 @@ static void ieee80211_check_auth_response(struct ieee80211_device *ieee, } if (ieee->current_network.mode == IEEE_N_24G && - bHalfSupportNmode == true) { + bHalfSupportNmode) { netdev_dbg(ieee->dev, "enter half N mode\n"); ieee->bHalfWirelessN24GMode = true; } else diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 5353a45ffdff..fff8d583c62f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -336,12 +336,12 @@ static void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, printk("===>can't get TS\n"); return; } - if (pTxTs->TxAdmittedBARecord.bValid == false) + if (!pTxTs->TxAdmittedBARecord.bValid) { TsStartAddBaProcess(ieee, pTxTs); goto FORCED_AGG_SETTING; } - else if (pTxTs->bUsingBa == false) + else if (!pTxTs->bUsingBa) { if (SN_LESS(pTxTs->TxAdmittedBARecord.BaStartSeqCtrl.field.SeqNum, (pTxTs->TxCurSeq+1)%4096)) pTxTs->bUsingBa = true; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index d4215fd5a856..3bde744604c2 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -364,8 +364,8 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) printk("====================>rx ADDBAREQ from :%pM\n", dst); //some other capability is not ready now. if ((ieee->current_network.qos_data.active == 0) || - (ieee->pHTInfo->bCurrentHTSupport == false)) //|| - // (ieee->pStaQos->bEnableRxImmBA == false) ) + (!ieee->pHTInfo->bCurrentHTSupport)) //|| + // (!ieee->pStaQos->bEnableRxImmBA) ) { rc = ADDBA_STATUS_REFUSED; IEEE80211_DEBUG(IEEE80211_DL_ERR, "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); @@ -462,8 +462,8 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) // Check the capability // Since we can always receive A-MPDU, we just check if it is under HT mode. if (ieee->current_network.qos_data.active == 0 || - ieee->pHTInfo->bCurrentHTSupport == false || - ieee->pHTInfo->bCurrentAMPDUEnable == false) { + !ieee->pHTInfo->bCurrentHTSupport || + !ieee->pHTInfo->bCurrentAMPDUEnable) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bCurrentAMPDUEnable); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; @@ -502,7 +502,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) IEEE80211_DEBUG(IEEE80211_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it! \n"); return -1; } - else if((pPendingBA->bValid == false) ||(*pDialogToken != pPendingBA->DialogToken)) + else if((!pPendingBA->bValid) ||(*pDialogToken != pPendingBA->DialogToken)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA! \n"); ReasonCode = DELBA_REASON_UNKNOWN_BA; @@ -582,7 +582,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) } if (ieee->current_network.qos_data.active == 0 || - ieee->pHTInfo->bCurrentHTSupport == false ) + !ieee->pHTInfo->bCurrentHTSupport) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "received DELBA while QOS or HT is not supported(%d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); return -1; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index 80411c93d8fa..c27397b14adb 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -224,9 +224,9 @@ static bool IsHTHalfNmode40Bandwidth(struct ieee80211_device *ieee) bool retValue = false; PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; - if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode + if(!pHTInfo->bCurrentHTSupport) // wireless is n mode retValue = false; - else if(pHTInfo->bRegBW40MHz == false) // station supports 40 bw + else if(!pHTInfo->bRegBW40MHz) // station supports 40 bw retValue = false; else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode retValue = false; @@ -243,7 +243,7 @@ static bool IsHTHalfNmodeSGI(struct ieee80211_device *ieee, bool is40MHz) bool retValue = false; PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; - if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode + if(!pHTInfo->bCurrentHTSupport) // wireless is n mode retValue = false; else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode retValue = false; @@ -675,7 +675,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *le 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->ExtChlOffset = ((!pHT->bRegBW40MHz)?HT_EXTCHNL_OFFSET_NO_EXT: (ieee->current_network.channel<=6)? HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER); pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz; @@ -945,7 +945,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily - if (pHTInfo->bCurrentHTSupport == false) { + if (!pHTInfo->bCurrentHTSupport) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== HTOnAssocRsp(): HT_DISABLE\n"); return; } @@ -976,7 +976,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) // HTSetConnectBwMode(ieee, (HT_CHANNEL_WIDTH)(pPeerHTCap->ChlWidth), (HT_EXTCHNL_OFFSET)(pPeerHTInfo->ExtChlOffset)); -// if(pHTInfo->bCurBW40MHz == true) +// if (pHTInfo->bCurBW40MHz) pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1)?true:false); // @@ -1341,7 +1341,7 @@ void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidt PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; // u32 flags = 0; - if(pHTInfo->bRegBW40MHz == false) + if(!pHTInfo->bRegBW40MHz) return; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index b89105dbcbba..f33c74342cf3 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -584,7 +584,7 @@ void RemoveAllTS(struct ieee80211_device *ieee) void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS) { - if(pTxTS->bAddBaReqInProgress == false) + if(!pTxTS->bAddBaReqInProgress) { pTxTS->bAddBaReqInProgress = true; if(pTxTS->bAddBaReqDelayed) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index b852396d21e6..dd74813d48f3 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2047,7 +2047,7 @@ static bool GetHalfNmodeSupportByAPs819xUsb(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee80211; - if (ieee->bHalfWirelessN24GMode == true) + if (ieee->bHalfWirelessN24GMode) Reval = true; else Reval = false; @@ -2762,7 +2762,7 @@ static bool rtl8192_adapter_start(struct net_device *dev) // #ifdef TO_DO_LIST if (Adapter->ResetProgress == RESET_TYPE_NORESET) { - if (pMgntInfo->RegRfOff == true) { /* User disable RF via registry. */ + if (pMgntInfo->RegRfOff) { /* User disable RF via registry. */ RT_TRACE((COMP_INIT|COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): Turn off RF for RegRfOff ----------\n")); MgntActSet_RF_State(Adapter, eRfOff, RF_CHANGE_BY_SW); // Those actions will be discard in MgntActSet_RF_State because of the same state @@ -4406,7 +4406,8 @@ static void query_rxdesc_status(struct sk_buff *skb, /* RTL8190 set this bit to indicate that Hw does not decrypt packet */ stats->Decrypted = !desc->SWDec; - if ((priv->ieee80211->pHTInfo->bCurrentHTSupport == true) && (priv->ieee80211->pairwise_key_type == KEY_TYPE_CCMP)) + if ((priv->ieee80211->pHTInfo->bCurrentHTSupport) && + (priv->ieee80211->pairwise_key_type == KEY_TYPE_CCMP)) stats->bHwError = false; else stats->bHwError = stats->bCRC|stats->bICV; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 7ca5d8fbc57f..5277f2eec033 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -438,7 +438,7 @@ static void dm_bandwidth_autoswitch(struct net_device *dev) if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 || !priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable) return; - if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false) { /* If send packets in 40 Mhz in 20/40 */ + if (!priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz) { /* If send packets in 40 Mhz in 20/40 */ if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; } else { /* in force send packets in 20 Mhz in 20/40 */ @@ -1731,7 +1731,7 @@ static void dm_dig_init(struct net_device *dev) *---------------------------------------------------------------------------*/ static void dm_ctrl_initgain_byrssi(struct net_device *dev) { - if (dm_digtable.dig_enable_flag == false) + if (!dm_digtable.dig_enable_flag) return; if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) @@ -1750,7 +1750,7 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi( u8 i; static u8 fw_dig; - if (dm_digtable.dig_enable_flag == false) + if (!dm_digtable.dig_enable_flag) return; /*DbgPrint("Dig by Sw Rssi\n");*/ @@ -1792,7 +1792,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( static u32 reset_cnt; u8 i; - if (dm_digtable.dig_enable_flag == false) + if (!dm_digtable.dig_enable_flag) return; if (dm_digtable.dig_algorithm_switch) { From 2ee4c3dc55f6b83934cdf53c8563f5667d91ff91 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Mon, 20 Jul 2015 18:36:18 +0200 Subject: [PATCH 342/912] staging: rtl8192u: remove unneeded bool bool Reval is set to match the value of bHalfWirelessN24GMode just to this. The value can be returned directly. Removing uneeded bool. Signed-off-by: Luis de Bethencourt Suggested-by: Joe Perches Suggested-by: Franks Klaver Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index dd74813d48f3..6f6fe38081bc 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2043,16 +2043,9 @@ static bool GetNmodeSupportBySecCfg8192(struct net_device *dev) static bool GetHalfNmodeSupportByAPs819xUsb(struct net_device *dev) { - bool Reval; struct r8192_priv *priv = ieee80211_priv(dev); - struct ieee80211_device *ieee = priv->ieee80211; - if (ieee->bHalfWirelessN24GMode) - Reval = true; - else - Reval = false; - - return Reval; + return priv->ieee80211->bHalfWirelessN24GMode; } static void rtl8192_refresh_supportrate(struct r8192_priv *priv) From d0dcaa8d4eff40b2999d5265f2218c29e82e24cc Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sun, 19 Jul 2015 13:52:33 +0300 Subject: [PATCH 343/912] Staging: rtl8192e: pointer math bug in rtllib_rx_DELBA() The pointer math here was totally wrong so we were reading nonsense information from beyond the end of the buffer. It could lead to an oops if that memory wasn't mapped. The "pReasonCode" pointer is assigned but never used so I deleted it. With-Fix-From: Mateusz Kulikowski Signed-off-by: Dan Carpenter Acked-by: Mateusz Kulikowski Tested-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_BAProc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 60f536c295ab..78ede4a817fc 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -428,7 +428,6 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) { struct rtllib_hdr_3addr *delba = NULL; union delba_param_set *pDelBaParamSet = NULL; - u16 *pReasonCode = NULL; u8 *dst = NULL; if (skb->len < sizeof(struct rtllib_hdr_3addr) + 6) { @@ -453,9 +452,7 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) #endif delba = (struct rtllib_hdr_3addr *)skb->data; dst = (u8 *)(&delba->addr2[0]); - delba += sizeof(struct rtllib_hdr_3addr); - pDelBaParamSet = (union delba_param_set *)(delba+2); - pReasonCode = (u16 *)(delba+4); + pDelBaParamSet = (union delba_param_set *)&delba->payload[2]; if (pDelBaParamSet->field.Initiator == 1) { struct rx_ts_record *pRxTs; From b20691652b8c09992096490d9dd11319c1e7ce5e Mon Sep 17 00:00:00 2001 From: Stuart Yoder Date: Thu, 16 Jul 2015 12:50:50 -0500 Subject: [PATCH 344/912] staging: fsl-mc: update TODO list update TODO list to provide more detail on remaining work Signed-off-by: Stuart Yoder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/TODO | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fsl-mc/TODO b/drivers/staging/fsl-mc/TODO index d78288b4e721..c29516b4b9b6 100644 --- a/drivers/staging/fsl-mc/TODO +++ b/drivers/staging/fsl-mc/TODO @@ -6,8 +6,30 @@ and if so add support for this. * Add at least one device driver for a DPAA2 object (child device of the - fsl-mc bus). + fsl-mc bus). Most likely candidate for this is adding DPAA2 Ethernet + driver support, which depends on drivers for several objects: DPNI, + DPIO, DPMAC. Other pre-requisites include: + + * interrupt support. for meaningful driver support we need + interrupts, and thus need message interrupt support by the bus + driver. + -Note: this has dependencies on generic MSI support work + in process upstream, see [1] and [2]. + + * Management Complex (MC) command serialization. locking mechanisms + are needed by drivers to serialize commands sent to the MC, including + from atomic context. + + * MC firmware uprev. The MC firmware upon which the fsl-mc + bus driver and DPAA2 object drivers are based is continuing + to evolve, so minor updates are needed to keep in sync with binary + interface changes to the MC. + +* Cleanup Please send any patches to Greg Kroah-Hartman , german.rivera@freescale.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org + +[1] https://lkml.org/lkml/2015/7/9/93 +[2] https://lkml.org/lkml/2015/7/7/712 From 56fa2ece881348d314800b858581f2ae950f8e20 Mon Sep 17 00:00:00 2001 From: "Jon Medhurst (Tixy)" Date: Fri, 17 Jul 2015 12:01:29 +0100 Subject: [PATCH 345/912] staging: ion: ion_cma_heap: Don't directly use dma_common_get_sgtable Use dma_get_sgtable rather than dma_common_get_sgtable so a device's dma_ops aren't bypassed. This is essential in situations where a device uses an IOMMU and the physical memory is not contiguous (as the common function assumes). Signed-off-by: Jon Medhurst Reviewed-by: Robin Murphy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_cma_heap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c index f4211f1be488..86b91fd53852 100644 --- a/drivers/staging/android/ion/ion_cma_heap.c +++ b/drivers/staging/android/ion/ion_cma_heap.c @@ -73,8 +73,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, if (!info->table) goto free_mem; - if (dma_common_get_sgtable - (dev, info->table, info->cpu_addr, info->handle, len)) + if (dma_get_sgtable(dev, info->table, info->cpu_addr, info->handle, len)) goto free_table; /* keep this for memory release */ buffer->priv_virt = info; From 80a60777d7e60e59e4deb756dc0e3989fe520f84 Mon Sep 17 00:00:00 2001 From: Steve Pennington Date: Wed, 22 Jul 2015 12:50:11 -0500 Subject: [PATCH 346/912] staging: rtl8723au: fix incorrect type in assignment warning Repaced calls to htons and memcpy with a single call to put_unaligned_be16 to fix the following sparse warning: drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: warning: incorrect type in assignment (different base types) drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: expected unsigned short [unsigned] [assigned] [usertype] len drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: got restricted __be16 [usertype] Signed-off-by: Steve Pennington Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_recv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 274a4b65c022..ad0549c66529 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -1554,8 +1554,7 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe) ether_addr_copy(ptr + ETH_ALEN, pattrib->src); if (!bsnaphdr) { - len = htons(len); - memcpy(ptr + 12, &len, 2); + put_unaligned_be16(len, ptr + 12); } From 52b1660d3b3a7fc967ba9d9b641b594fa1ac33d7 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:35 -0400 Subject: [PATCH 347/912] staging: unisys: Remove num_visornic_open array As pointed out in a recent review, the num_visornic_open array didn't do anything useful, and it exposed a potential race in the visornic code that could arise while taking down a net interface while reading from the debugfs files. Fix that by removing the array entirely, and just iterating over all the registered netdevs in a given namespace, filtering on them having visornic ops (to identify which are ours), and having their queues not be stopped (identifying that they are up). This should prevent any oops conditions happening due to changing state in that array, and save us a bunch of code too. Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Acked-by: Neil Horman Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 341 ++++++++---------- 1 file changed, 154 insertions(+), 187 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index c28a34767552..5bb6cf461b25 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -196,8 +196,6 @@ struct visornic_devdata { struct chanstat chstat; }; -/* array of open devices maintained by open() and close() */ -static struct net_device *num_visornic_open[VISORNICSOPENMAX]; /* List of all visornic_devdata structs, * linked via the list_all member @@ -325,178 +323,15 @@ static void visor_thread_stop(struct visor_thread_info *thrinfo) thrinfo->id = 0; } -/* DebugFS code */ -static ssize_t info_debugfs_read(struct file *file, char __user *buf, - size_t len, loff_t *offset) -{ - int i; - ssize_t bytes_read = 0; - int str_pos = 0; - struct visornic_devdata *devdata; - char *vbuf; - - if (len > MAX_BUF) - len = MAX_BUF; - vbuf = kzalloc(len, GFP_KERNEL); - if (!vbuf) - return -ENOMEM; - - /* for each vnic channel - * dump out channel specific data - */ - for (i = 0; i < VISORNICSOPENMAX; i++) { - if (!num_visornic_open[i]) - continue; - - devdata = netdev_priv(num_visornic_open[i]); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - "Vnic i = %d\n", i); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - "netdev = %s (0x%p), MAC Addr %pM\n", - num_visornic_open[i]->name, - num_visornic_open[i], - num_visornic_open[i]->dev_addr); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - "VisorNic Dev Info = 0x%p\n", devdata); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " num_rcv_bufs = %d\n", - devdata->num_rcv_bufs); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " max_oustanding_next_xmits = %d\n", - devdata->max_outstanding_net_xmits); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " upper_threshold_net_xmits = %d\n", - devdata->upper_threshold_net_xmits); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " lower_threshold_net_xmits = %d\n", - devdata->lower_threshold_net_xmits); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " queuefullmsg_logged = %d\n", - devdata->queuefullmsg_logged); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.got_rcv = %lu\n", - devdata->chstat.got_rcv); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.got_enbdisack = %lu\n", - devdata->chstat.got_enbdisack); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.got_xmit_done = %lu\n", - devdata->chstat.got_xmit_done); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.xmit_fail = %lu\n", - devdata->chstat.xmit_fail); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.sent_enbdis = %lu\n", - devdata->chstat.sent_enbdis); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.sent_promisc = %lu\n", - devdata->chstat.sent_promisc); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.sent_post = %lu\n", - devdata->chstat.sent_post); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.sent_xmit = %lu\n", - devdata->chstat.sent_xmit); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.reject_count = %lu\n", - devdata->chstat.reject_count); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " chstat.extra_rcvbufs_sent = %lu\n", - devdata->chstat.extra_rcvbufs_sent); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " n_rcv0 = %lu\n", devdata->n_rcv0); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " n_rcv1 = %lu\n", devdata->n_rcv1); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " n_rcv2 = %lu\n", devdata->n_rcv2); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " n_rcvx = %lu\n", devdata->n_rcvx); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " num_rcvbuf_in_iovm = %d\n", - atomic_read(&devdata->num_rcvbuf_in_iovm)); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " alloc_failed_in_if_needed_cnt = %lu\n", - devdata->alloc_failed_in_if_needed_cnt); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " alloc_failed_in_repost_rtn_cnt = %lu\n", - devdata->alloc_failed_in_repost_rtn_cnt); - /* str_pos += scnprintf(vbuf + str_pos, len - str_pos, - * " inner_loop_limit_reached_cnt = %lu\n", - * devdata->inner_loop_limit_reached_cnt); - */ - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " found_repost_rcvbuf_cnt = %lu\n", - devdata->found_repost_rcvbuf_cnt); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " repost_found_skb_cnt = %lu\n", - devdata->repost_found_skb_cnt); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " n_repost_deficit = %lu\n", - devdata->n_repost_deficit); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " bad_rcv_buf = %lu\n", - devdata->bad_rcv_buf); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " n_rcv_packets_not_accepted = %lu\n", - devdata->n_rcv_packets_not_accepted); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " interrupts_rcvd = %llu\n", - devdata->interrupts_rcvd); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " interrupts_notme = %llu\n", - devdata->interrupts_notme); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " interrupts_disabled = %llu\n", - devdata->interrupts_disabled); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " busy_cnt = %llu\n", - devdata->busy_cnt); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " flow_control_upper_hits = %llu\n", - devdata->flow_control_upper_hits); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " flow_control_lower_hits = %llu\n", - devdata->flow_control_lower_hits); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " thread_wait_ms = %d\n", - devdata->thread_wait_ms); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " netif_queue = %s\n", - netif_queue_stopped(devdata->netdev) ? - "stopped" : "running"); - } - bytes_read = simple_read_from_buffer(buf, len, offset, vbuf, str_pos); - kfree(vbuf); - return bytes_read; -} - static ssize_t enable_ints_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { - char buf[4]; - int i, new_value; - struct visornic_devdata *devdata; - - if (count >= ARRAY_SIZE(buf)) - return -EINVAL; - - buf[count] = '\0'; - if (copy_from_user(buf, buffer, count)) - return -EFAULT; - - i = kstrtoint(buf, 10, &new_value); - if (i != 0) - return -EFAULT; - - /* set all counts to new_value usually 0 */ - for (i = 0; i < VISORNICSOPENMAX; i++) { - if (num_visornic_open[i]) { - devdata = netdev_priv(num_visornic_open[i]); - /* TODO update features bit in channel */ - } - } - + /* + * Don't want to break ABI here by having a debugfs + * file that no longer exists or is writable, so + * lets just make this a vestigual function + */ return count; } @@ -760,13 +595,6 @@ visornic_disable_with_timeout(struct net_device *netdev, const int timeout) } } - /* remove references from array */ - for (i = 0; i < VISORNICSOPENMAX; i++) - if (num_visornic_open[i] == netdev) { - num_visornic_open[i] = NULL; - break; - } - return 0; } @@ -882,16 +710,6 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) return -EIO; } - /* find an open slot in the array to save off VisorNic references - * for debug - */ - for (i = 0; i < VISORNICSOPENMAX; i++) { - if (!num_visornic_open[i]) { - num_visornic_open[i] = netdev; - break; - } - } - return 0; } @@ -1642,6 +1460,155 @@ static const struct net_device_ops visornic_dev_ops = { .ndo_set_rx_mode = visornic_set_multi, }; +/* DebugFS code */ +static ssize_t info_debugfs_read(struct file *file, char __user *buf, + size_t len, loff_t *offset) +{ + ssize_t bytes_read = 0; + int str_pos = 0; + struct visornic_devdata *devdata; + struct net_device *dev; + char *vbuf; + + if (len > MAX_BUF) + len = MAX_BUF; + vbuf = kzalloc(len, GFP_KERNEL); + if (!vbuf) + return -ENOMEM; + + /* for each vnic channel + * dump out channel specific data + */ + rcu_read_lock(); + for_each_netdev_rcu(current->nsproxy->net_ns, dev) { + /* + * Only consider netdevs that are visornic, and are open + */ + if ((dev->netdev_ops != &visornic_dev_ops) || + (!netif_queue_stopped(dev))) + continue; + + devdata = netdev_priv(dev); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + "netdev = %s (0x%p), MAC Addr %pM\n", + dev->name, + dev, + dev->dev_addr); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + "VisorNic Dev Info = 0x%p\n", devdata); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " num_rcv_bufs = %d\n", + devdata->num_rcv_bufs); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " max_oustanding_next_xmits = %d\n", + devdata->max_outstanding_net_xmits); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " upper_threshold_net_xmits = %d\n", + devdata->upper_threshold_net_xmits); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " lower_threshold_net_xmits = %d\n", + devdata->lower_threshold_net_xmits); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " queuefullmsg_logged = %d\n", + devdata->queuefullmsg_logged); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.got_rcv = %lu\n", + devdata->chstat.got_rcv); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.got_enbdisack = %lu\n", + devdata->chstat.got_enbdisack); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.got_xmit_done = %lu\n", + devdata->chstat.got_xmit_done); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.xmit_fail = %lu\n", + devdata->chstat.xmit_fail); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.sent_enbdis = %lu\n", + devdata->chstat.sent_enbdis); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.sent_promisc = %lu\n", + devdata->chstat.sent_promisc); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.sent_post = %lu\n", + devdata->chstat.sent_post); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.sent_xmit = %lu\n", + devdata->chstat.sent_xmit); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.reject_count = %lu\n", + devdata->chstat.reject_count); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.extra_rcvbufs_sent = %lu\n", + devdata->chstat.extra_rcvbufs_sent); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " n_rcv0 = %lu\n", devdata->n_rcv0); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " n_rcv1 = %lu\n", devdata->n_rcv1); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " n_rcv2 = %lu\n", devdata->n_rcv2); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " n_rcvx = %lu\n", devdata->n_rcvx); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " num_rcvbuf_in_iovm = %d\n", + atomic_read(&devdata->num_rcvbuf_in_iovm)); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " alloc_failed_in_if_needed_cnt = %lu\n", + devdata->alloc_failed_in_if_needed_cnt); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " alloc_failed_in_repost_rtn_cnt = %lu\n", + devdata->alloc_failed_in_repost_rtn_cnt); + /* str_pos += scnprintf(vbuf + str_pos, len - str_pos, + * " inner_loop_limit_reached_cnt = %lu\n", + * devdata->inner_loop_limit_reached_cnt); + */ + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " found_repost_rcvbuf_cnt = %lu\n", + devdata->found_repost_rcvbuf_cnt); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " repost_found_skb_cnt = %lu\n", + devdata->repost_found_skb_cnt); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " n_repost_deficit = %lu\n", + devdata->n_repost_deficit); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " bad_rcv_buf = %lu\n", + devdata->bad_rcv_buf); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " n_rcv_packets_not_accepted = %lu\n", + devdata->n_rcv_packets_not_accepted); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " interrupts_rcvd = %llu\n", + devdata->interrupts_rcvd); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " interrupts_notme = %llu\n", + devdata->interrupts_notme); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " interrupts_disabled = %llu\n", + devdata->interrupts_disabled); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " busy_cnt = %llu\n", + devdata->busy_cnt); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " flow_control_upper_hits = %llu\n", + devdata->flow_control_upper_hits); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " flow_control_lower_hits = %llu\n", + devdata->flow_control_lower_hits); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " thread_wait_ms = %d\n", + devdata->thread_wait_ms); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " netif_queue = %s\n", + netif_queue_stopped(devdata->netdev) ? + "stopped" : "running"); + } + rcu_read_unlock(); + bytes_read = simple_read_from_buffer(buf, len, offset, vbuf, str_pos); + kfree(vbuf); + return bytes_read; +} + /** * send_rcv_posts_if_needed * @devdata: visornic device From ce657aa81005ddfbdd9c89ec9de31ff713c05ea6 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:36 -0400 Subject: [PATCH 348/912] staging: unisys: Check return code properly on visor_copy_fragsinfo_from_skb One call site for visor_copy_fragsinfo_from_skb was checking for an rc of -1, but thhe function doesn't return that, it returns -errno. Correct it Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 5bb6cf461b25..1a0efe25f929 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -912,7 +912,7 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) visor_copy_fragsinfo_from_skb(skb, firstfraglen, MAX_PHYS_INFO, cmdrsp->net.xmt.frags); - if (cmdrsp->net.xmt.num_frags == -1) { + if (cmdrsp->net.xmt.num_frags < 0) { spin_unlock_irqrestore(&devdata->priv_lock, flags); devdata->busy_cnt++; dev_err(&netdev->dev, From 998ff7f85d2a4923cf8e49319957bb2a70f8b881 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:37 -0400 Subject: [PATCH 349/912] staging: unisys: BUG halt on error in I/O channel We precheck that we have enough space in an iochannel prior to writing to it when we send in a fragmented skb. Given that there is no recovery from this condition that I can see, turn it into a BUG halt Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 1a0efe25f929..f7363925f4a1 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -254,8 +254,16 @@ visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen, page_offset, skb_shinfo(skb)->frags[ii]. size, count, frags_max, frags); - if (!count) - return -EIO; + /* + * add_physinfo_entries only returns + * zero if the frags array is out of room + * That should never happen because we + * fail above, if count+numfrags > frags_max. + * Given that theres no recovery mechanism from putting + * half a packet in the I/O channel, panic here as this + * should never happen + */ + BUG_ON(!count); } } if (skb_shinfo(skb)->frag_list) { From 513e1cbda230c626bc01492f440805c4a88632d7 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:38 -0400 Subject: [PATCH 350/912] staging: unisys: Linarize skbs If we can't fit an skb into a frag array, linaraize it so we don't have to Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index f7363925f4a1..a421a5bea343 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -221,9 +221,25 @@ visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen, struct phys_info frags[]) { unsigned int count = 0, ii, size, offset = 0, numfrags; + unsigned int total_count; numfrags = skb_shinfo(skb)->nr_frags; + /* + * Compute the number of fragments this skb has, and if its more than + * frag array can hold, linearize the skb + */ + total_count = numfrags + (firstfraglen / PI_PAGE_SIZE); + if (firstfraglen % PI_PAGE_SIZE) + total_count++; + + if (total_count > frags_max) { + if (skb_linearize(skb)) + return -EINVAL; + numfrags = skb_shinfo(skb)->nr_frags; + firstfraglen = 0; + } + while (firstfraglen) { if (count == frags_max) return -EINVAL; From 87a9404ef0be2aac949fdb8854e71d100859f6f5 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:39 -0400 Subject: [PATCH 351/912] staging: unisys: Clean up kthread usage Remove the has_stopped completion as theres already one available internally. Correct the while loops Remove the while loop in drain_queue as it already exists in the top level loop Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 180 +++++++++--------- 1 file changed, 85 insertions(+), 95 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index a421a5bea343..923c580b9a5d 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -91,7 +91,6 @@ static struct visor_driver visornic_driver = { struct visor_thread_info { struct task_struct *task; - struct completion has_stopped; int id; }; @@ -317,7 +316,6 @@ static int visor_thread_start(struct visor_thread_info *thrinfo, void *thrcontext, char *name) { /* used to stop the thread */ - init_completion(&thrinfo->has_stopped); thrinfo->task = kthread_run(threadfn, thrcontext, name); if (IS_ERR(thrinfo->task)) { pr_debug("%s failed (%ld)\n", @@ -341,10 +339,8 @@ static void visor_thread_stop(struct visor_thread_info *thrinfo) if (!thrinfo->id) return; /* thread not running */ - kthread_stop(thrinfo->task); - /* give up if the thread has NOT died in 1 minute */ - if (wait_for_completion_timeout(&thrinfo->has_stopped, 60 * HZ)) - thrinfo->id = 0; + BUG_ON(kthread_stop(thrinfo->task)); + thrinfo->id = 0; } static ssize_t enable_ints_write(struct file *file, @@ -1691,99 +1687,95 @@ drain_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata) unsigned long flags; struct net_device *netdev; - /* drain queue */ - while (1) { - /* TODO: CLIENT ACQUIRE -- Don't really need this at the - * moment */ - if (!visorchannel_signalremove(devdata->dev->visorchannel, - IOCHAN_FROM_IOPART, - cmdrsp)) - break; /* queue empty */ + /* TODO: CLIENT ACQUIRE -- Don't really need this at the + * moment */ + if (!visorchannel_signalremove(devdata->dev->visorchannel, + IOCHAN_FROM_IOPART, + cmdrsp)) + return; /* queue empty */ - switch (cmdrsp->net.type) { - case NET_RCV: - devdata->chstat.got_rcv++; - /* process incoming packet */ - visornic_rx(cmdrsp); - break; - case NET_XMIT_DONE: - spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->chstat.got_xmit_done++; - if (cmdrsp->net.xmtdone.xmt_done_result) - devdata->chstat.xmit_fail++; - /* only call queue wake if we stopped it */ - netdev = ((struct sk_buff *)cmdrsp->net.buf)->dev; - /* ASSERT netdev == vnicinfo->netdev; */ - if ((netdev == devdata->netdev) && - netif_queue_stopped(netdev)) { - /* check to see if we have crossed - * the lower watermark for - * netif_wake_queue() + switch (cmdrsp->net.type) { + case NET_RCV: + devdata->chstat.got_rcv++; + /* process incoming packet */ + visornic_rx(cmdrsp); + break; + case NET_XMIT_DONE: + spin_lock_irqsave(&devdata->priv_lock, flags); + devdata->chstat.got_xmit_done++; + if (cmdrsp->net.xmtdone.xmt_done_result) + devdata->chstat.xmit_fail++; + /* only call queue wake if we stopped it */ + netdev = ((struct sk_buff *)cmdrsp->net.buf)->dev; + /* ASSERT netdev == vnicinfo->netdev; */ + if ((netdev == devdata->netdev) && + netif_queue_stopped(netdev)) { + /* check to see if we have crossed + * the lower watermark for + * netif_wake_queue() + */ + if (((devdata->chstat.sent_xmit >= + devdata->chstat.got_xmit_done) && + (devdata->chstat.sent_xmit - + devdata->chstat.got_xmit_done <= + devdata->lower_threshold_net_xmits)) || + ((devdata->chstat.sent_xmit < + devdata->chstat.got_xmit_done) && + (ULONG_MAX - devdata->chstat.got_xmit_done + + devdata->chstat.sent_xmit <= + devdata->lower_threshold_net_xmits))) { + /* enough NET_XMITs completed + * so can restart netif queue */ - if (((devdata->chstat.sent_xmit >= - devdata->chstat.got_xmit_done) && - (devdata->chstat.sent_xmit - - devdata->chstat.got_xmit_done <= - devdata->lower_threshold_net_xmits)) || - ((devdata->chstat.sent_xmit < - devdata->chstat.got_xmit_done) && - (ULONG_MAX - devdata->chstat.got_xmit_done - + devdata->chstat.sent_xmit <= - devdata->lower_threshold_net_xmits))) { - /* enough NET_XMITs completed - * so can restart netif queue - */ - netif_wake_queue(netdev); - devdata->flow_control_lower_hits++; - } - } - skb_unlink(cmdrsp->net.buf, &devdata->xmitbufhead); - spin_unlock_irqrestore(&devdata->priv_lock, flags); - kfree_skb(cmdrsp->net.buf); - break; - case NET_RCV_ENBDIS_ACK: - devdata->chstat.got_enbdisack++; - netdev = (struct net_device *) - cmdrsp->net.enbdis.context; - spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->enab_dis_acked = 1; - spin_unlock_irqrestore(&devdata->priv_lock, flags); - - if (devdata->server_down && - devdata->server_change_state) { - /* Inform Linux that the link is up */ - devdata->server_down = false; - devdata->server_change_state = false; netif_wake_queue(netdev); - netif_carrier_on(netdev); + devdata->flow_control_lower_hits++; } - break; - case NET_CONNECT_STATUS: - netdev = devdata->netdev; - if (cmdrsp->net.enbdis.enable == 1) { - spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->enabled = cmdrsp->net.enbdis.enable; - spin_unlock_irqrestore(&devdata->priv_lock, - flags); - netif_wake_queue(netdev); - netif_carrier_on(netdev); - } else { - netif_stop_queue(netdev); - netif_carrier_off(netdev); - spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->enabled = cmdrsp->net.enbdis.enable; - spin_unlock_irqrestore(&devdata->priv_lock, - flags); - } - break; - default: - break; } - /* cmdrsp is now available for reuse */ + skb_unlink(cmdrsp->net.buf, &devdata->xmitbufhead); + spin_unlock_irqrestore(&devdata->priv_lock, flags); + kfree_skb(cmdrsp->net.buf); + break; + case NET_RCV_ENBDIS_ACK: + devdata->chstat.got_enbdisack++; + netdev = (struct net_device *) + cmdrsp->net.enbdis.context; + spin_lock_irqsave(&devdata->priv_lock, flags); + devdata->enab_dis_acked = 1; + spin_unlock_irqrestore(&devdata->priv_lock, flags); if (kthread_should_stop()) break; + if (devdata->server_down && + devdata->server_change_state) { + /* Inform Linux that the link is up */ + devdata->server_down = false; + devdata->server_change_state = false; + netif_wake_queue(netdev); + netif_carrier_on(netdev); + } + break; + case NET_CONNECT_STATUS: + netdev = devdata->netdev; + if (cmdrsp->net.enbdis.enable == 1) { + spin_lock_irqsave(&devdata->priv_lock, flags); + devdata->enabled = cmdrsp->net.enbdis.enable; + spin_unlock_irqrestore(&devdata->priv_lock, + flags); + netif_wake_queue(netdev); + netif_carrier_on(netdev); + } else { + netif_stop_queue(netdev); + netif_carrier_off(netdev); + spin_lock_irqsave(&devdata->priv_lock, flags); + devdata->enabled = cmdrsp->net.enbdis.enable; + spin_unlock_irqrestore(&devdata->priv_lock, + flags); + } + break; + default: + break; } + /* cmdrsp is now available for reuse */ } /** @@ -1803,9 +1795,9 @@ process_incoming_rsps(void *v) cmdrsp = kmalloc(SZ, GFP_ATOMIC); if (!cmdrsp) - complete_and_exit(&devdata->threadinfo.has_stopped, 0); + return 0; - while (1) { + while (!kthread_should_stop()) { wait_event_interruptible_timeout( devdata->rsp_queue, (atomic_read( &devdata->interrupt_rcvd) == 1), @@ -1818,12 +1810,10 @@ process_incoming_rsps(void *v) atomic_set(&devdata->interrupt_rcvd, 0); send_rcv_posts_if_needed(devdata); drain_queue(cmdrsp, devdata); - if (kthread_should_stop()) - break; } kfree(cmdrsp); - complete_and_exit(&devdata->threadinfo.has_stopped, 0); + return 0; } /** From 8cf12de41bb772fccd2807780ad23639e4fcce89 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:40 -0400 Subject: [PATCH 352/912] staging: unisys: Guard against task leakage Its possible to overwrite the old task pointer in visornic_resume. Add a check to guard against that and a warning if we find that its already running Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 923c580b9a5d..6c60e18b3be4 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -2118,8 +2118,13 @@ static int visornic_resume(struct visor_device *dev, * we can start using the device again. * TODO: State transitions */ - visor_thread_start(&devdata->threadinfo, process_incoming_rsps, - devdata, "vnic_incoming"); + if (!devdata->threadinfo.id) + visor_thread_start(&devdata->threadinfo, + process_incoming_rsps, + devdata, "vnic_incoming"); + else + pr_warn("vnic_incoming already running!\n"); + init_rcv_bufs(netdev, devdata); spin_lock_irqsave(&devdata->priv_lock, flags); devdata->enabled = 1; From 0d5073935a662564d46dff071874fe2cab11c651 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:41 -0400 Subject: [PATCH 353/912] staging: unisys: simplify visornic_serverdown_complete Theres a lot of code duplication going on in visornic_serverdown_complete. We should just be able to send it through the dev_close path and have it do the right things. Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 36 +++++-------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 6c60e18b3be4..aeb379e169da 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -19,10 +19,11 @@ */ #include -#include #include -#include +#include #include +#include +#include #include "visorbus.h" #include "iochannel.h" @@ -370,8 +371,6 @@ visornic_serverdown_complete(struct work_struct *work) { struct visornic_devdata *devdata; struct net_device *netdev; - unsigned long flags; - int i = 0, count = 0; devdata = container_of(work, struct visornic_devdata, serverdown_completion); @@ -380,27 +379,11 @@ visornic_serverdown_complete(struct work_struct *work) /* Stop using datachan */ visor_thread_stop(&devdata->threadinfo); - /* Inform Linux that the link is down */ - netif_carrier_off(netdev); - netif_stop_queue(netdev); + rtnl_lock(); + dev_close(netdev); + rtnl_unlock(); - /* Free the skb for XMITs that haven't been serviced by the server - * We shouldn't have to inform Linux about these IOs because they - * are "lost in the ethernet" - */ - skb_queue_purge(&devdata->xmitbufhead); - - spin_lock_irqsave(&devdata->priv_lock, flags); - /* free rcv buffers */ - for (i = 0; i < devdata->num_rcv_bufs; i++) { - if (devdata->rcvbuf[i]) { - kfree_skb(devdata->rcvbuf[i]); - devdata->rcvbuf[i] = NULL; - count++; - } - } atomic_set(&devdata->num_rcvbuf_in_iovm, 0); - spin_unlock_irqrestore(&devdata->priv_lock, flags); if (devdata->server_down_complete_func) (*devdata->server_down_complete_func)(devdata->dev, 0); @@ -605,6 +588,8 @@ visornic_disable_with_timeout(struct net_device *netdev, const int timeout) /* we've set enabled to 0, so we can give up the lock. */ spin_unlock_irqrestore(&devdata->priv_lock, flags); + skb_queue_purge(&devdata->xmitbufhead); + /* Free rcv buffers - other end has automatically unposed them on * disable */ @@ -1174,7 +1159,6 @@ repost_return(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata, devdata->bad_rcv_buf++; } } - atomic_dec(&devdata->usage); return status; } @@ -1228,10 +1212,6 @@ visornic_rx(struct uiscmdrsp *cmdrsp) devdata->net_stats.rx_packets++; devdata->net_stats.rx_bytes = skb->len; - atomic_inc(&devdata->usage); /* don't want a close to happen before - * we're done here - */ - /* set length to how much was ACTUALLY received - * NOTE: rcv_done_len includes actual length of data rcvd * including ethhdr From ace72eef40e8b5f0e3b3916e2dee2d146711ca2e Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:42 -0400 Subject: [PATCH 354/912] staging: unisys: Make serverdown synchronous I don't see why serverdown should be async on a workqueue. Just make it synchronous, and remove some code in the process Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index aeb379e169da..316f9ac71600 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -61,7 +61,6 @@ static const struct file_operations debugfs_enable_ints_fops = { .write = enable_ints_write, }; -static struct workqueue_struct *visornic_serverdown_workqueue; static struct workqueue_struct *visornic_timeout_reset_workqueue; /* GUIDS for director channel type supported by this driver. */ @@ -148,7 +147,6 @@ struct visornic_devdata { * xmit buffer list that have been * sent to the IOPART end */ - struct work_struct serverdown_completion; visorbus_state_complete_func server_down_complete_func; struct work_struct timeout_reset; struct uiscmdrsp *cmdrsp_rcv; /* cmdrsp_rcv is used for @@ -367,13 +365,10 @@ static ssize_t enable_ints_write(struct file *file, * Returns void. */ static void -visornic_serverdown_complete(struct work_struct *work) +visornic_serverdown_complete(struct visornic_devdata *devdata) { - struct visornic_devdata *devdata; struct net_device *netdev; - devdata = container_of(work, struct visornic_devdata, - serverdown_completion); netdev = devdata->netdev; /* Stop using datachan */ @@ -418,8 +413,7 @@ visornic_serverdown(struct visornic_devdata *devdata, } devdata->server_change_state = true; devdata->server_down_complete_func = complete_func; - queue_work(visornic_serverdown_workqueue, - &devdata->serverdown_completion); + visornic_serverdown_complete(devdata); } else if (devdata->server_change_state) { dev_dbg(&devdata->dev->device, "%s changing state\n", __func__); @@ -1892,8 +1886,6 @@ static int visornic_probe(struct visor_device *dev) err = -ENOMEM; goto cleanup_xmit_cmdrsp; } - INIT_WORK(&devdata->serverdown_completion, - visornic_serverdown_complete); INIT_WORK(&devdata->timeout_reset, visornic_timeout_reset); devdata->server_down = false; devdata->server_change_state = false; @@ -2019,7 +2011,6 @@ static void visornic_remove(struct visor_device *dev) } /* going_away prevents new items being added to the workqueues */ - flush_workqueue(visornic_serverdown_workqueue); flush_workqueue(visornic_timeout_reset_workqueue); debugfs_remove_recursive(devdata->eth_debugfs_dir); @@ -2155,12 +2146,6 @@ static int visornic_init(void) if (!ret) goto cleanup_debugfs; - /* create workqueue for serverdown completion */ - visornic_serverdown_workqueue = - create_singlethread_workqueue("visornic_serverdown"); - if (!visornic_serverdown_workqueue) - goto cleanup_debugfs; - /* create workqueue for tx timeout reset */ visornic_timeout_reset_workqueue = create_singlethread_workqueue("visornic_timeout_reset"); @@ -2176,8 +2161,6 @@ static int visornic_init(void) return 0; cleanup_workqueue: - flush_workqueue(visornic_serverdown_workqueue); - destroy_workqueue(visornic_serverdown_workqueue); if (visornic_timeout_reset_workqueue) { flush_workqueue(visornic_timeout_reset_workqueue); destroy_workqueue(visornic_timeout_reset_workqueue); @@ -2197,10 +2180,6 @@ static void visornic_cleanup(void) { visorbus_unregister_visor_driver(&visornic_driver); - if (visornic_serverdown_workqueue) { - flush_workqueue(visornic_serverdown_workqueue); - destroy_workqueue(visornic_serverdown_workqueue); - } if (visornic_timeout_reset_workqueue) { flush_workqueue(visornic_timeout_reset_workqueue); destroy_workqueue(visornic_timeout_reset_workqueue); From 0c677e9c24935bdca8ed72b96f7e762c95fc8bd3 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:43 -0400 Subject: [PATCH 355/912] staging: unisys: Change enable/disable to wait forever I don't see why the server should stop responding, or that we should just give up if it does. Wait forever when enabling/disabling the visornic Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 316f9ac71600..12318365ec7f 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -28,7 +28,7 @@ #include "visorbus.h" #include "iochannel.h" -#define VISORNIC_INFINITE_RESPONSE_WAIT 0 +#define VISORNIC_INFINITE_RSP_WAIT 0 #define VISORNICSOPENMAX 32 #define MAXDEVICES 16384 @@ -549,7 +549,7 @@ visornic_disable_with_timeout(struct net_device *netdev, const int timeout) * when it gets a disable. */ spin_lock_irqsave(&devdata->priv_lock, flags); - while ((timeout == VISORNIC_INFINITE_RESPONSE_WAIT) || + while ((timeout == VISORNIC_INFINITE_RSP_WAIT) || (wait < timeout)) { if (devdata->enab_dis_acked) break; @@ -686,7 +686,7 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) send_enbdis(netdev, 1, devdata); spin_lock_irqsave(&devdata->priv_lock, flags); - while ((timeout == VISORNIC_INFINITE_RESPONSE_WAIT) || + while ((timeout == VISORNIC_INFINITE_RSP_WAIT) || (wait < timeout)) { if (devdata->enab_dis_acked) break; @@ -731,11 +731,13 @@ visornic_timeout_reset(struct work_struct *work) netdev = devdata->netdev; netif_stop_queue(netdev); - response = visornic_disable_with_timeout(netdev, 100); + response = visornic_disable_with_timeout(netdev, + VISORNIC_INFINITE_RSP_WAIT); if (response) goto call_serverdown; - response = visornic_enable_with_timeout(netdev, 100); + response = visornic_enable_with_timeout(netdev, + VISORNIC_INFINITE_RSP_WAIT); if (response) goto call_serverdown; netif_wake_queue(netdev); @@ -756,7 +758,7 @@ call_serverdown: static int visornic_open(struct net_device *netdev) { - visornic_enable_with_timeout(netdev, VISORNIC_INFINITE_RESPONSE_WAIT); + visornic_enable_with_timeout(netdev, VISORNIC_INFINITE_RSP_WAIT); /* start the interface's transmit queue, allowing it to accept * packets for transmission @@ -777,7 +779,7 @@ static int visornic_close(struct net_device *netdev) { netif_stop_queue(netdev); - visornic_disable_with_timeout(netdev, VISORNIC_INFINITE_RESPONSE_WAIT); + visornic_disable_with_timeout(netdev, VISORNIC_INFINITE_RSP_WAIT); return 0; } From 35a8dd310efbbcec37de2da6301f9bdaf83b2632 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:44 -0400 Subject: [PATCH 356/912] staging: unisys: Remove some extraneous start/stop queue operations If we put them in the enable and disable paths, we don't need them in several other places Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 12318365ec7f..338ca8c29915 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -709,6 +709,7 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) return -EIO; } + netif_start_queue(netdev); return 0; } @@ -730,7 +731,6 @@ visornic_timeout_reset(struct work_struct *work) devdata = container_of(work, struct visornic_devdata, timeout_reset); netdev = devdata->netdev; - netif_stop_queue(netdev); response = visornic_disable_with_timeout(netdev, VISORNIC_INFINITE_RSP_WAIT); if (response) @@ -740,7 +740,6 @@ visornic_timeout_reset(struct work_struct *work) VISORNIC_INFINITE_RSP_WAIT); if (response) goto call_serverdown; - netif_wake_queue(netdev); return; @@ -760,11 +759,6 @@ visornic_open(struct net_device *netdev) { visornic_enable_with_timeout(netdev, VISORNIC_INFINITE_RSP_WAIT); - /* start the interface's transmit queue, allowing it to accept - * packets for transmission - */ - netif_start_queue(netdev); - return 0; } @@ -778,7 +772,6 @@ visornic_open(struct net_device *netdev) static int visornic_close(struct net_device *netdev) { - netif_stop_queue(netdev); visornic_disable_with_timeout(netdev, VISORNIC_INFINITE_RSP_WAIT); return 0; From f6346ad662e44d7086bc3c18fc19a33f0b95b576 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:45 -0400 Subject: [PATCH 357/912] staging: unisys: Fix improper use of NETDEV_TX_BUSY Using NETDEV_TX_BUSY is tricky. Its meant for situations where the error in question is transient and quickly resolved. But the driver rarely is able to know that to a certainty. And in the case of visornic, it just uses it without any care for that, in the hopes that it won't loose frames, even if the problem is that the skb is somehow malformed for the hardware. If we get one of those kinds of skbs, NETDEV_TX_BUSY will just cause us to spin, processing the same error over and over. Fix it by dropping the frame, stopping the queue where appropriate, and returning NETDEV_TX_OK Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 338ca8c29915..8cc9017a67a1 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -787,7 +787,7 @@ visornic_close(struct net_device *netdev) * function is protected from concurrent calls by a spinlock xmit_lock * in the net_device struct, but as soon as the function returns it * can be called again. - * Returns NETDEV_TX_OK for success, NETDEV_TX_BUSY for error. + * Returns NETDEV_TX_OK. */ static int visornic_xmit(struct sk_buff *skb, struct net_device *netdev) @@ -806,7 +806,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) devdata->busy_cnt++; dev_dbg(&netdev->dev, "%s busy - queue stopped\n", __func__); - return NETDEV_TX_BUSY; + kfree_skb(skb); + return NETDEV_TX_OK; } /* sk_buff struct is used to host network data throughout all the @@ -827,7 +828,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) dev_err(&netdev->dev, "%s busy - first frag too small (%d)\n", __func__, firstfraglen); - return NETDEV_TX_BUSY; + kfree_skb(skb); + return NETDEV_TX_OK; } if ((len < ETH_MIN_PACKET_SIZE) && @@ -869,7 +871,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) dev_dbg(&netdev->dev, "%s busy - waiting for iovm to catch up\n", __func__); - return NETDEV_TX_BUSY; + kfree_skb(skb); + return NETDEV_TX_OK; } if (devdata->queuefullmsg_logged) devdata->queuefullmsg_logged = 0; @@ -911,7 +914,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) devdata->busy_cnt++; dev_err(&netdev->dev, "%s busy - copy frags failed\n", __func__); - return NETDEV_TX_BUSY; + kfree_skb(skb); + return NETDEV_TX_OK; } if (!visorchannel_signalinsert(devdata->dev->visorchannel, @@ -921,7 +925,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) devdata->busy_cnt++; dev_dbg(&netdev->dev, "%s busy - signalinsert failed\n", __func__); - return NETDEV_TX_BUSY; + kfree_skb(skb); + return NETDEV_TX_OK; } /* Track the skbs that have been sent to the IOVM for XMIT */ From a42ba26cca4ed183362d5adb5dad227f908b4ddb Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:46 -0400 Subject: [PATCH 358/912] staging: unisys: Remove trans_start dev_trans_start does this for us now Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 8cc9017a67a1..37f3e277285b 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -932,12 +932,6 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) /* Track the skbs that have been sent to the IOVM for XMIT */ skb_queue_head(&devdata->xmitbufhead, skb); - /* set the last transmission start time - * linux doc says: Do not forget to update netdev->trans_start to - * jiffies after each new tx packet is given to the hardware. - */ - netdev->trans_start = jiffies; - /* update xmt stats */ devdata->net_stats.tx_packets++; devdata->net_stats.tx_bytes += skb->len; From 15a4d2137077296e22fce2127f8056d6d7f9e785 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:47 -0400 Subject: [PATCH 359/912] staging: unisys: remove visornic_ioctl All it does is return no supported. Removing the function entirely accomplishes the same thing Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 37f3e277285b..a5da40066bc7 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -977,21 +977,6 @@ visornic_get_stats(struct net_device *netdev) return &devdata->net_stats; } -/** - * visornic_ioctl - ioctl function for netdevice. - * @netdev: netdevice - * @ifr: ignored - * @cmd: ignored - * - * Currently not supported. - * Returns EOPNOTSUPP - */ -static int -visornic_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) -{ - return -EOPNOTSUPP; -} - /** * visornic_change_mtu - changes mtu of device. * @netdev: netdevice @@ -1442,7 +1427,6 @@ static const struct net_device_ops visornic_dev_ops = { .ndo_stop = visornic_close, .ndo_start_xmit = visornic_xmit, .ndo_get_stats = visornic_get_stats, - .ndo_do_ioctl = visornic_ioctl, .ndo_change_mtu = visornic_change_mtu, .ndo_tx_timeout = visornic_xmit_timeout, .ndo_set_rx_mode = visornic_set_multi, From 547e4c90aee5f4ecfed23a16b621629071e41f05 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Jul 2015 09:55:48 -0400 Subject: [PATCH 360/912] staging: unisys: remove bogus error checking The netdev we're testing for can't be removed, because its never unregistered, so don't bother checking for it Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index a5da40066bc7..4d49937d3856 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1164,18 +1164,6 @@ visornic_rx(struct uiscmdrsp *cmdrsp) skb = cmdrsp->net.buf; netdev = skb->dev; - if (!netdev) { - /* We must have previously downed this network device and - * this skb and device is no longer valid. This also means - * the skb reference was removed from devdata->rcvbuf so no - * need to search for it. - * All we can do is free the skb and return. - * Note: We crash if we try to log this here. - */ - kfree_skb(skb); - return; - } - devdata = netdev_priv(netdev); spin_lock_irqsave(&devdata->priv_lock, flags); From e4a143392686432d147e055e45f09049c09f6755 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:14 +0200 Subject: [PATCH 361/912] staging: rtl8192e: Rename PHY_RF8256_Config Use naming schema found in other rtlwifi devices. Rename PHY_RF8256_Config to rtl92e_config_rf. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index f3eb1dc3da73..3b8240becd10 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -232,7 +232,7 @@ phy_RF8256_Config_ParaFile_Fail: return false; } -bool PHY_RF8256_Config(struct net_device *dev) +bool rtl92e_config_rf(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h index d9348d92af26..6cd0c2ef63de 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h @@ -23,7 +23,7 @@ #define RTL819X_TOTAL_RF_PATH 2 extern void PHY_SetRF8256Bandwidth(struct net_device *dev, enum ht_channel_width Bandwidth); -extern bool PHY_RF8256_Config(struct net_device *dev); +extern bool rtl92e_config_rf(struct net_device *dev); extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); extern void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 32135235f3e2..032b7dd2ef54 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -568,7 +568,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) (enum rf90_radio_path)0); if (!rtStatus) { RT_TRACE((COMP_ERR | COMP_PHY), - "PHY_RF8256_Config():Check PHY%d Fail!!\n", + "rtl92e_config_rf():Check PHY%d Fail!!\n", eCheckItem-1); return rtStatus; } @@ -699,7 +699,7 @@ bool rtl8192_phy_RFConfig(struct net_device *dev) case RF_8225: break; case RF_8256: - rtStatus = PHY_RF8256_Config(dev); + rtStatus = rtl92e_config_rf(dev); break; case RF_8258: From 766b0128266a264395f07830dfad078e1e83d57c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:15 +0200 Subject: [PATCH 362/912] staging: rtl8192e: Rename PHY_SetRF8256Bandwidth Use naming schema found in other rtlwifi devices. Rename PHY_SetRF8256Bandwidth to rtl92e_set_bandwidth. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 3b8240becd10..53d845f25028 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -22,8 +22,8 @@ #include "r8192E_phy.h" #include "r8190P_rtl8256.h" -void PHY_SetRF8256Bandwidth(struct net_device *dev, - enum ht_channel_width Bandwidth) +void rtl92e_set_bandwidth(struct net_device *dev, + enum ht_channel_width Bandwidth) { u8 eRFPath; struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h index 6cd0c2ef63de..37b336310543 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h @@ -21,8 +21,8 @@ #define RTL8225H #define RTL819X_TOTAL_RF_PATH 2 -extern void PHY_SetRF8256Bandwidth(struct net_device *dev, - enum ht_channel_width Bandwidth); +extern void rtl92e_set_bandwidth(struct net_device *dev, + enum ht_channel_width Bandwidth); extern bool rtl92e_config_rf(struct net_device *dev); extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); extern void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 032b7dd2ef54..f48f2e2d2566 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1249,7 +1249,7 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) break; case RF_8256: - PHY_SetRF8256Bandwidth(dev, priv->CurrentChannelBW); + rtl92e_set_bandwidth(dev, priv->CurrentChannelBW); break; case RF_8258: From abfda5886b8bd3569330fae5b1224488375a5c48 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:16 +0200 Subject: [PATCH 363/912] staging: rtl8192e: Rename PHY_SetRF8256CCKTxPower Use naming schema found in other rtlwifi devices. Rename PHY_SetRF8256CCKTxPower to rtl92e_set_cck_tx_power. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 53d845f25028..daa0619cd7dc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -240,7 +240,7 @@ bool rtl92e_config_rf(struct net_device *dev) return phy_RF8256_Config_ParaFile(dev); } -void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel) +void rtl92e_set_cck_tx_power(struct net_device *dev, u8 powerlevel) { u32 TxAGC = 0; struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h index 37b336310543..1f39799683d9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h @@ -24,7 +24,7 @@ extern void rtl92e_set_bandwidth(struct net_device *dev, enum ht_channel_width Bandwidth); extern bool rtl92e_config_rf(struct net_device *dev); -extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); +extern void rtl92e_set_cck_tx_power(struct net_device *dev, u8 powerlevel); extern void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index f48f2e2d2566..f05a88402855 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -679,7 +679,7 @@ void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel) case RF_8225: break; case RF_8256: - PHY_SetRF8256CCKTxPower(dev, powerlevel); + rtl92e_set_cck_tx_power(dev, powerlevel); PHY_SetRF8256OFDMTxPower(dev, powerlevelOFDM24G); break; case RF_8258: @@ -794,7 +794,7 @@ static void rtl8192_SetTxPowerLevel(struct net_device *dev, u8 channel) break; case RF_8256: - PHY_SetRF8256CCKTxPower(dev, powerlevel); + rtl92e_set_cck_tx_power(dev, powerlevel); PHY_SetRF8256OFDMTxPower(dev, powerlevelOFDM24G); break; From 2497ef5b54914d0e90a7a308e442b81d42b0e373 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:17 +0200 Subject: [PATCH 364/912] staging: rtl8192e: Rename PHY_SetRF8256OFDMTxPower Use naming schema found in other rtlwifi devices. Rename PHY_SetRF8256OFDMTxPower to rtl92e_set_ofdm_tx_power. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index daa0619cd7dc..b3b72e59d366 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -258,7 +258,7 @@ void rtl92e_set_cck_tx_power(struct net_device *dev, u8 powerlevel) } -void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel) +void rtl92e_set_ofdm_tx_power(struct net_device *dev, u8 powerlevel) { struct r8192_priv *priv = rtllib_priv(dev); u32 writeVal, powerBase0, powerBase1, writeVal_tmp; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h index 1f39799683d9..5af837f969b8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h @@ -25,6 +25,6 @@ extern void rtl92e_set_bandwidth(struct net_device *dev, enum ht_channel_width Bandwidth); extern bool rtl92e_config_rf(struct net_device *dev); extern void rtl92e_set_cck_tx_power(struct net_device *dev, u8 powerlevel); -extern void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel); +extern void rtl92e_set_ofdm_tx_power(struct net_device *dev, u8 powerlevel); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index f05a88402855..5d493c6b56ea 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -680,7 +680,7 @@ void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel) break; case RF_8256: rtl92e_set_cck_tx_power(dev, powerlevel); - PHY_SetRF8256OFDMTxPower(dev, powerlevelOFDM24G); + rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G); break; case RF_8258: break; @@ -795,7 +795,7 @@ static void rtl8192_SetTxPowerLevel(struct net_device *dev, u8 channel) case RF_8256: rtl92e_set_cck_tx_power(dev, powerlevel); - PHY_SetRF8256OFDMTxPower(dev, powerlevelOFDM24G); + rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G); break; case RF_8258: From 12656e2b8c308d86dbb3b9167db0309f27f90d4f Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:18 +0200 Subject: [PATCH 365/912] staging: rtl8192e: Rename cmpk_message_handle_tx Use naming schema found in other rtlwifi devices. Rename cmpk_message_handle_tx to rtl92e_send_cmd_pkt. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 7 ++----- drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h | 5 ++--- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 5 ++--- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index ebd08a16685e..0d9c74d86b15 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c @@ -21,11 +21,8 @@ #include "r8192E_hw.h" #include "r8192E_cmdpkt.h" -bool cmpk_message_handle_tx( - struct net_device *dev, - u8 *code_virtual_address, - u32 packettype, - u32 buffer_len) +bool rtl92e_send_cmd_pkt(struct net_device *dev, u8 *code_virtual_address, + u32 packettype, u32 buffer_len) { bool rt_status = true; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h index f714d5100059..5718fd8fd118 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h @@ -19,7 +19,6 @@ #ifndef R819XUSB_CMDPKT_H #define R819XUSB_CMDPKT_H -extern bool cmpk_message_handle_tx(struct net_device *dev, - u8 *codevirtualaddress, u32 packettype, - u32 buffer_len); +extern bool rtl92e_send_cmd_pkt(struct net_device *dev, u8 *codevirtualaddress, + u32 packettype, u32 buffer_len); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index c2367128c594..47ead3732a2b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -674,9 +674,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) tx_cmd.Op = TXCMD_SET_TX_PWR_TRACKING; tx_cmd.Length = 4; tx_cmd.Value = Value; - cmpk_message_handle_tx(dev, (u8 *)&tx_cmd, - DESC_PACKET_TYPE_INIT, - sizeof(struct dcmd_txcmd)); + rtl92e_send_cmd_pkt(dev, (u8 *)&tx_cmd, DESC_PACKET_TYPE_INIT, + sizeof(struct dcmd_txcmd)); mdelay(1); for (i = 0; i <= 30; i++) { Pwr_Flag = read_nic_byte(dev, Pw_Track_Flag); From 460266292de1c3770bad54f48e5b33a5fed342e1 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:19 +0200 Subject: [PATCH 366/912] staging: rtl8192e: Rename rtl8192_adapter_start Use naming schema found in other rtlwifi devices. Rename rtl8192_adapter_start to rtl92e_start_adapter. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index eb919b634e3c..2bc53ad2b4c7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -702,7 +702,7 @@ static void rtl8192_hwconfig(struct net_device *dev) priv->LongRetryLimit << RETRY_LIMIT_LONG_SHIFT); } -bool rtl8192_adapter_start(struct net_device *dev) +bool rtl92e_start_adapter(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); u32 ulRegRead; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 4f1b312e90f4..48fbd4e516f6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -42,7 +42,7 @@ void rtl8192_InitializeVariables(struct net_device *dev); void rtl8192e_start_beacon(struct net_device *dev); void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val); void rtl8192_get_eeprom_size(struct net_device *dev); -bool rtl8192_adapter_start(struct net_device *dev); +bool rtl92e_start_adapter(struct net_device *dev); void rtl8192_link_change(struct net_device *dev); void rtl8192_AllowAllDestAddr(struct net_device *dev, bool bAllowAllDA, bool WriteIntoReg); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index ca8406bba26d..c5028cc01f34 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -46,7 +46,7 @@ static struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .get_eeprom_size = rtl8192_get_eeprom_size, .init_adapter_variable = rtl8192_InitializeVariables, - .initialize_adapter = rtl8192_adapter_start, + .initialize_adapter = rtl92e_start_adapter, .link_change = rtl8192_link_change, .tx_fill_descriptor = rtl8192_tx_fill_desc, .tx_fill_cmd_descriptor = rtl8192_tx_fill_cmd_desc, From 33e1748d8f10b2b4d84a18431999cdf2830ccc71 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:20 +0200 Subject: [PATCH 367/912] staging: rtl8192e: Rename rtl8192_AllowAllDestAddr Use naming schema found in other rtlwifi devices. Rename rtl8192_AllowAllDestAddr to rtl92e_set_monitor_mode. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 2bc53ad2b4c7..008782ec5447 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1023,8 +1023,8 @@ void rtl8192_link_change(struct net_device *dev) } } -void rtl8192_AllowAllDestAddr(struct net_device *dev, - bool bAllowAllDA, bool WriteIntoReg) +void rtl92e_set_monitor_mode(struct net_device *dev, bool bAllowAllDA, + bool WriteIntoReg) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 48fbd4e516f6..262f3b233a48 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -44,8 +44,8 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val); void rtl8192_get_eeprom_size(struct net_device *dev); bool rtl92e_start_adapter(struct net_device *dev); void rtl8192_link_change(struct net_device *dev); -void rtl8192_AllowAllDestAddr(struct net_device *dev, bool bAllowAllDA, - bool WriteIntoReg); +void rtl92e_set_monitor_mode(struct net_device *dev, bool bAllowAllDA, + bool WriteIntoReg); void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, struct cb_desc *cb_desc, struct sk_buff *skb); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index c5028cc01f34..2ec43b503124 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -891,7 +891,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) rtl8192_GetHalfNmodeSupportByAPs; priv->rtllib->SetHwRegHandler = rtl8192e_SetHwReg; - priv->rtllib->AllowAllDestAddrHandler = rtl8192_AllowAllDestAddr; + priv->rtllib->AllowAllDestAddrHandler = rtl92e_set_monitor_mode; priv->rtllib->SetFwCmdHandler = NULL; priv->rtllib->InitialGainHandler = InitialGain819xPci; priv->rtllib->rtllib_ips_leave_wq = rtllib_ips_leave_wq; From dc578b417facaef65f3e73ba7f97394979cc64a2 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:21 +0200 Subject: [PATCH 368/912] staging: rtl8192e: Rename rtl8192_ClearInterrupt Use naming schema found in other rtlwifi devices. Rename rtl8192_ClearInterrupt to rtl92e_clear_irq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 008782ec5447..0a60b0718ec2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2246,7 +2246,7 @@ void rtl8192_DisableInterrupt(struct net_device *dev) priv->irq_enabled = 0; } -void rtl8192_ClearInterrupt(struct net_device *dev) +void rtl92e_clear_irq(struct net_device *dev) { u32 tmp = 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 262f3b233a48..ed38b5711656 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -37,7 +37,7 @@ void rtl8192_enable_rx(struct net_device *dev); void rtl8192_enable_tx(struct net_device *dev); void rtl8192_EnableInterrupt(struct net_device *dev); void rtl8192_DisableInterrupt(struct net_device *dev); -void rtl8192_ClearInterrupt(struct net_device *dev); +void rtl92e_clear_irq(struct net_device *dev); void rtl8192_InitializeVariables(struct net_device *dev); void rtl8192e_start_beacon(struct net_device *dev); void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 2ec43b503124..708f7331de34 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -56,7 +56,7 @@ static struct rtl819x_ops rtl819xp_ops = { .update_ratr_table = rtl8192_update_ratr_table, .irq_enable = rtl8192_EnableInterrupt, .irq_disable = rtl8192_DisableInterrupt, - .irq_clear = rtl8192_ClearInterrupt, + .irq_clear = rtl92e_clear_irq, .rx_enable = rtl8192_enable_rx, .tx_enable = rtl8192_enable_tx, .interrupt_recognized = rtl8192_interrupt_recognized, From baadea565daae4cfaa46e0764bef3541c949616c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:22 +0200 Subject: [PATCH 369/912] staging: rtl8192e: Rename rtl8192_DisableInterrupt Use naming schema found in other rtlwifi devices. Rename rtl8192_DisableInterrupt to rtl92e_disable_irq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 0a60b0718ec2..d4f6e1048dcc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2237,7 +2237,7 @@ void rtl8192_EnableInterrupt(struct net_device *dev) } -void rtl8192_DisableInterrupt(struct net_device *dev) +void rtl92e_disable_irq(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index ed38b5711656..cb900f68a259 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -36,7 +36,7 @@ void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, void rtl8192_enable_rx(struct net_device *dev); void rtl8192_enable_tx(struct net_device *dev); void rtl8192_EnableInterrupt(struct net_device *dev); -void rtl8192_DisableInterrupt(struct net_device *dev); +void rtl92e_disable_irq(struct net_device *dev); void rtl92e_clear_irq(struct net_device *dev); void rtl8192_InitializeVariables(struct net_device *dev); void rtl8192e_start_beacon(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 708f7331de34..998ebf9fc150 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -55,7 +55,7 @@ static struct rtl819x_ops rtl819xp_ops = { .stop_adapter = rtl8192_halt_adapter, .update_ratr_table = rtl8192_update_ratr_table, .irq_enable = rtl8192_EnableInterrupt, - .irq_disable = rtl8192_DisableInterrupt, + .irq_disable = rtl92e_disable_irq, .irq_clear = rtl92e_clear_irq, .rx_enable = rtl8192_enable_rx, .tx_enable = rtl8192_enable_tx, From 6d99c68e6f50241fe400b744b515dcfac6341239 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:23 +0200 Subject: [PATCH 370/912] staging: rtl8192e: Rename rtl8192_EnableInterrupt Use naming schema found in other rtlwifi devices. Rename rtl8192_EnableInterrupt to rtl92e_enable_irq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index d4f6e1048dcc..b2bf58e73434 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2227,7 +2227,7 @@ rtl8192_InitializeVariables(struct net_device *dev) priv->bfirst_after_down = false; } -void rtl8192_EnableInterrupt(struct net_device *dev) +void rtl92e_enable_irq(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index cb900f68a259..3d717a40bf8b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -35,7 +35,7 @@ void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, u32 *p_intb); void rtl8192_enable_rx(struct net_device *dev); void rtl8192_enable_tx(struct net_device *dev); -void rtl8192_EnableInterrupt(struct net_device *dev); +void rtl92e_enable_irq(struct net_device *dev); void rtl92e_disable_irq(struct net_device *dev); void rtl92e_clear_irq(struct net_device *dev); void rtl8192_InitializeVariables(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 998ebf9fc150..dd7b0dc258b1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -54,7 +54,7 @@ static struct rtl819x_ops rtl819xp_ops = { .rx_command_packet_handler = NULL, .stop_adapter = rtl8192_halt_adapter, .update_ratr_table = rtl8192_update_ratr_table, - .irq_enable = rtl8192_EnableInterrupt, + .irq_enable = rtl92e_enable_irq, .irq_disable = rtl92e_disable_irq, .irq_clear = rtl92e_clear_irq, .rx_enable = rtl8192_enable_rx, From 78c352b2b22348f28edda51fae2d61928fae4450 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:24 +0200 Subject: [PATCH 371/912] staging: rtl8192e: Rename rtl8192_enable_rx Use naming schema found in other rtlwifi devices. Rename rtl8192_enable_rx to rtl92e_enable_rx. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index b2bf58e73434..7aa566705308 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2255,7 +2255,7 @@ void rtl92e_clear_irq(struct net_device *dev) } -void rtl8192_enable_rx(struct net_device *dev) +void rtl92e_enable_rx(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 3d717a40bf8b..94755c425357 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -33,7 +33,7 @@ bool rtl8192_HalTxCheckStuck(struct net_device *dev); bool rtl8192_HalRxCheckStuck(struct net_device *dev); void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, u32 *p_intb); -void rtl8192_enable_rx(struct net_device *dev); +void rtl92e_enable_rx(struct net_device *dev); void rtl8192_enable_tx(struct net_device *dev); void rtl92e_enable_irq(struct net_device *dev); void rtl92e_disable_irq(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index dd7b0dc258b1..1352c98ed454 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -57,7 +57,7 @@ static struct rtl819x_ops rtl819xp_ops = { .irq_enable = rtl92e_enable_irq, .irq_disable = rtl92e_disable_irq, .irq_clear = rtl92e_clear_irq, - .rx_enable = rtl8192_enable_rx, + .rx_enable = rtl92e_enable_rx, .tx_enable = rtl8192_enable_tx, .interrupt_recognized = rtl8192_interrupt_recognized, .TxCheckStuckHandler = rtl8192_HalTxCheckStuck, From 6af7a8b662f6bb5498d6a59b9dbb2b26855add8b Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:25 +0200 Subject: [PATCH 372/912] staging: rtl8192e: Rename rtl8192_enable_tx Use naming schema found in other rtlwifi devices. Rename rtl8192_enable_tx to rtl92e_enable_tx. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 7aa566705308..c779ee781a27 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2266,7 +2266,7 @@ static const u32 TX_DESC_BASE[] = { BKQDA, BEQDA, VIQDA, VOQDA, HCCAQDA, CQDA, MQDA, HQDA, BQDA }; -void rtl8192_enable_tx(struct net_device *dev) +void rtl92e_enable_tx(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); u32 i; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 94755c425357..75f500a8633e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -34,7 +34,7 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev); void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, u32 *p_intb); void rtl92e_enable_rx(struct net_device *dev); -void rtl8192_enable_tx(struct net_device *dev); +void rtl92e_enable_tx(struct net_device *dev); void rtl92e_enable_irq(struct net_device *dev); void rtl92e_disable_irq(struct net_device *dev); void rtl92e_clear_irq(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 1352c98ed454..eb0be6d64ca3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -58,7 +58,7 @@ static struct rtl819x_ops rtl819xp_ops = { .irq_disable = rtl92e_disable_irq, .irq_clear = rtl92e_clear_irq, .rx_enable = rtl92e_enable_rx, - .tx_enable = rtl8192_enable_tx, + .tx_enable = rtl92e_enable_tx, .interrupt_recognized = rtl8192_interrupt_recognized, .TxCheckStuckHandler = rtl8192_HalTxCheckStuck, .RxCheckStuckHandler = rtl8192_HalRxCheckStuck, From 61fea239c818631d6f8252c00ffdde60e92c3ad0 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:26 +0200 Subject: [PATCH 373/912] staging: rtl8192e: Rename rtl8192e_SetHwReg Use naming schema found in other rtlwifi devices. Rename rtl8192e_SetHwReg to rtl92e_set_reg. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index c779ee781a27..95e7b28e8929 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -95,7 +95,7 @@ static void rtl8192e_update_msr(struct net_device *dev) priv->rtllib->LedControlHandler(dev, LedAction); } -void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val) +void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 75f500a8633e..436d9d7d50ff 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -40,7 +40,7 @@ void rtl92e_disable_irq(struct net_device *dev); void rtl92e_clear_irq(struct net_device *dev); void rtl8192_InitializeVariables(struct net_device *dev); void rtl8192e_start_beacon(struct net_device *dev); -void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val); +void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val); void rtl8192_get_eeprom_size(struct net_device *dev); bool rtl92e_start_adapter(struct net_device *dev); void rtl8192_link_change(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index eb0be6d64ca3..83b0cea26f25 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -890,7 +890,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->GetHalfNmodeSupportByAPsHandler = rtl8192_GetHalfNmodeSupportByAPs; - priv->rtllib->SetHwRegHandler = rtl8192e_SetHwReg; + priv->rtllib->SetHwRegHandler = rtl92e_set_reg; priv->rtllib->AllowAllDestAddrHandler = rtl92e_set_monitor_mode; priv->rtllib->SetFwCmdHandler = NULL; priv->rtllib->InitialGainHandler = InitialGain819xPci; From 89d4a8be6294b8ab7ef218034f5b52f045b31876 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:27 +0200 Subject: [PATCH 374/912] staging: rtl8192e: Rename rtl8192e_start_beacon Use naming schema found in other rtlwifi devices. Rename rtl8192e_start_beacon to rtl92e_start_beacon. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 95e7b28e8929..f96923ca278b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -33,7 +33,7 @@ static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO}; -void rtl8192e_start_beacon(struct net_device *dev) +void rtl92e_start_beacon(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); struct rtllib_network *net = &priv->rtllib->current_network; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 436d9d7d50ff..5b9b4dfa55ce 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -39,7 +39,7 @@ void rtl92e_enable_irq(struct net_device *dev); void rtl92e_disable_irq(struct net_device *dev); void rtl92e_clear_irq(struct net_device *dev); void rtl8192_InitializeVariables(struct net_device *dev); -void rtl8192e_start_beacon(struct net_device *dev); +void rtl92e_start_beacon(struct net_device *dev); void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val); void rtl8192_get_eeprom_size(struct net_device *dev); bool rtl92e_start_adapter(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 83b0cea26f25..3a824b4d23e8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -879,7 +879,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->SetBWModeHandler = rtl8192_SetBWMode; priv->rf_set_chan = rtl8192_phy_SwChnl; - priv->rtllib->start_send_beacons = rtl8192e_start_beacon; + priv->rtllib->start_send_beacons = rtl92e_start_beacon; priv->rtllib->stop_send_beacons = rtl8192_stop_beacon; priv->rtllib->sta_wake_up = rtl8192_hw_wakeup; From b095be37004f91f6eecb70cd62da6cc2c2483b87 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:28 +0200 Subject: [PATCH 375/912] staging: rtl8192e: Rename rtl8192_get_eeprom_size Use naming schema found in other rtlwifi devices. Rename rtl8192_get_eeprom_size to rtl92e_get_eeprom_size. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f96923ca278b..5fd414e8a984 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -625,7 +625,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) RT_TRACE(COMP_TRACE, "<==== ReadAdapterInfo\n"); } -void rtl8192_get_eeprom_size(struct net_device *dev) +void rtl92e_get_eeprom_size(struct net_device *dev) { u16 curCR; struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 5b9b4dfa55ce..8551f1938114 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -41,7 +41,7 @@ void rtl92e_clear_irq(struct net_device *dev); void rtl8192_InitializeVariables(struct net_device *dev); void rtl92e_start_beacon(struct net_device *dev); void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val); -void rtl8192_get_eeprom_size(struct net_device *dev); +void rtl92e_get_eeprom_size(struct net_device *dev); bool rtl92e_start_adapter(struct net_device *dev); void rtl8192_link_change(struct net_device *dev); void rtl92e_set_monitor_mode(struct net_device *dev, bool bAllowAllDA, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 3a824b4d23e8..04c2f38312b2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -44,7 +44,7 @@ static char *ifname = "wlan%d"; static struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, - .get_eeprom_size = rtl8192_get_eeprom_size, + .get_eeprom_size = rtl92e_get_eeprom_size, .init_adapter_variable = rtl8192_InitializeVariables, .initialize_adapter = rtl92e_start_adapter, .link_change = rtl8192_link_change, From 86534a29bb68273a98b1e1c739ea58bf9a93e64a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:29 +0200 Subject: [PATCH 376/912] staging: rtl8192e: Rename rtl8192_GetHalfNmodeSupportByAPs Use naming schema found in other rtlwifi devices. Rename rtl8192_GetHalfNmodeSupportByAPs to rtl92e_is_halfn_supported_by_ap. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 5fd414e8a984..301e7504e3fc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2378,7 +2378,7 @@ bool rtl8192_GetNmodeSupportBySecCfg(struct net_device *dev) } } -bool rtl8192_GetHalfNmodeSupportByAPs(struct net_device *dev) +bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev) { bool Reval; struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 8551f1938114..5ad14afdc2a7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -27,7 +27,7 @@ #include "r8190P_def.h" -bool rtl8192_GetHalfNmodeSupportByAPs(struct net_device *dev); +bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev); bool rtl8192_GetNmodeSupportBySecCfg(struct net_device *dev); bool rtl8192_HalTxCheckStuck(struct net_device *dev); bool rtl8192_HalRxCheckStuck(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 04c2f38312b2..df9e4cf9cc30 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -888,7 +888,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->GetNmodeSupportBySecCfg = rtl8192_GetNmodeSupportBySecCfg; priv->rtllib->GetHalfNmodeSupportByAPsHandler = - rtl8192_GetHalfNmodeSupportByAPs; + rtl92e_is_halfn_supported_by_ap; priv->rtllib->SetHwRegHandler = rtl92e_set_reg; priv->rtllib->AllowAllDestAddrHandler = rtl92e_set_monitor_mode; From 56a5b5af61ac1d55cc3e0b19557e0c774338cf44 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:30 +0200 Subject: [PATCH 377/912] staging: rtl8192e: Rename rtl8192_GetNmodeSupportBySecCfg Use naming schema found in other rtlwifi devices. Rename rtl8192_GetNmodeSupportBySecCfg to rtl92e_get_nmode_support_by_sec. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 301e7504e3fc..7129110eb7a4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2364,7 +2364,7 @@ bool rtl8192_HalTxCheckStuck(struct net_device *dev) return bStuck; } -bool rtl8192_GetNmodeSupportBySecCfg(struct net_device *dev) +bool rtl92e_get_nmode_support_by_sec(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 5ad14afdc2a7..a77da0a08e8e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -28,7 +28,7 @@ #include "r8190P_def.h" bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev); -bool rtl8192_GetNmodeSupportBySecCfg(struct net_device *dev); +bool rtl92e_get_nmode_support_by_sec(struct net_device *dev); bool rtl8192_HalTxCheckStuck(struct net_device *dev); bool rtl8192_HalRxCheckStuck(struct net_device *dev); void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index df9e4cf9cc30..87d4e46f5a1e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -886,7 +886,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->enter_sleep_state = rtl8192_hw_to_sleep; priv->rtllib->ps_is_queue_empty = rtl8192_is_tx_queue_empty; - priv->rtllib->GetNmodeSupportBySecCfg = rtl8192_GetNmodeSupportBySecCfg; + priv->rtllib->GetNmodeSupportBySecCfg = rtl92e_get_nmode_support_by_sec; priv->rtllib->GetHalfNmodeSupportByAPsHandler = rtl92e_is_halfn_supported_by_ap; From 4d73bd2636f51aee9c541b2294518af11d5396e4 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:31 +0200 Subject: [PATCH 378/912] staging: rtl8192e: Rename rtl8192_HalRxCheckStuck Use naming schema found in other rtlwifi devices. Rename rtl8192_HalRxCheckStuck to rtl92e_is_rx_stuck. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 7129110eb7a4..c015bea2db5c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2283,7 +2283,7 @@ void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, write_nic_dword(dev, ISR, *p_inta); } -bool rtl8192_HalRxCheckStuck(struct net_device *dev) +bool rtl92e_is_rx_stuck(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); u16 RegRxCounter = read_nic_word(dev, 0x130); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index a77da0a08e8e..1182c9c08f18 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -30,7 +30,7 @@ bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev); bool rtl92e_get_nmode_support_by_sec(struct net_device *dev); bool rtl8192_HalTxCheckStuck(struct net_device *dev); -bool rtl8192_HalRxCheckStuck(struct net_device *dev); +bool rtl92e_is_rx_stuck(struct net_device *dev); void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, u32 *p_intb); void rtl92e_enable_rx(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 87d4e46f5a1e..5cf8de937d45 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -61,7 +61,7 @@ static struct rtl819x_ops rtl819xp_ops = { .tx_enable = rtl92e_enable_tx, .interrupt_recognized = rtl8192_interrupt_recognized, .TxCheckStuckHandler = rtl8192_HalTxCheckStuck, - .RxCheckStuckHandler = rtl8192_HalRxCheckStuck, + .RxCheckStuckHandler = rtl92e_is_rx_stuck, }; static struct pci_device_id rtl8192_pci_id_tbl[] = { From fe99c77b44e41c64c65ca2d558b26311ae4e6bf3 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:32 +0200 Subject: [PATCH 379/912] staging: rtl8192e: Rename rtl8192_halt_adapter Use naming schema found in other rtlwifi devices. Rename rtl8192_halt_adapter to rtl92e_stop_adapter. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index c015bea2db5c..01059ef5eeaa 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2098,7 +2098,7 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, return true; } -void rtl8192_halt_adapter(struct net_device *dev, bool reset) +void rtl92e_stop_adapter(struct net_device *dev, bool reset) { struct r8192_priv *priv = rtllib_priv(dev); int i; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 1182c9c08f18..455eed397e82 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -56,6 +56,6 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, struct rtllib_rx_stats *stats, struct rx_desc *pdesc, struct sk_buff *skb); -void rtl8192_halt_adapter(struct net_device *dev, bool reset); +void rtl92e_stop_adapter(struct net_device *dev, bool reset); void rtl8192_update_ratr_table(struct net_device *dev); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 5cf8de937d45..181c2840223e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -52,7 +52,7 @@ static struct rtl819x_ops rtl819xp_ops = { .tx_fill_cmd_descriptor = rtl8192_tx_fill_cmd_desc, .rx_query_status_descriptor = rtl8192_rx_query_status_desc, .rx_command_packet_handler = NULL, - .stop_adapter = rtl8192_halt_adapter, + .stop_adapter = rtl92e_stop_adapter, .update_ratr_table = rtl8192_update_ratr_table, .irq_enable = rtl92e_enable_irq, .irq_disable = rtl92e_disable_irq, From c9cf5e78f3b28e9a1358951a37f2bd844d46641f Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:33 +0200 Subject: [PATCH 380/912] staging: rtl8192e: Rename rtl8192_HalTxCheckStuck Use naming schema found in other rtlwifi devices. Rename rtl8192_HalTxCheckStuck to rtl92e_is_tx_stuck. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 01059ef5eeaa..8e50128bb1d9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2347,7 +2347,7 @@ bool rtl92e_is_rx_stuck(struct net_device *dev) return bStuck; } -bool rtl8192_HalTxCheckStuck(struct net_device *dev) +bool rtl92e_is_tx_stuck(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); bool bStuck = false; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 455eed397e82..6c37c4051157 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -29,7 +29,7 @@ bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev); bool rtl92e_get_nmode_support_by_sec(struct net_device *dev); -bool rtl8192_HalTxCheckStuck(struct net_device *dev); +bool rtl92e_is_tx_stuck(struct net_device *dev); bool rtl92e_is_rx_stuck(struct net_device *dev); void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, u32 *p_intb); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 181c2840223e..960131306925 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -60,7 +60,7 @@ static struct rtl819x_ops rtl819xp_ops = { .rx_enable = rtl92e_enable_rx, .tx_enable = rtl92e_enable_tx, .interrupt_recognized = rtl8192_interrupt_recognized, - .TxCheckStuckHandler = rtl8192_HalTxCheckStuck, + .TxCheckStuckHandler = rtl92e_is_tx_stuck, .RxCheckStuckHandler = rtl92e_is_rx_stuck, }; From df85a1313fee7d15db8100cd9a681d484c0c0b7b Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:34 +0200 Subject: [PATCH 381/912] staging: rtl8192e: Rename rtl8192_InitializeVariables Use naming schema found in other rtlwifi devices. Rename rtl8192_InitializeVariables to rtl92e_init_variables. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 8e50128bb1d9..9424909bebcb 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2193,7 +2193,7 @@ void rtl8192_update_ratr_table(struct net_device *dev) } void -rtl8192_InitializeVariables(struct net_device *dev) +rtl92e_init_variables(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 6c37c4051157..a943ae260291 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -38,7 +38,7 @@ void rtl92e_enable_tx(struct net_device *dev); void rtl92e_enable_irq(struct net_device *dev); void rtl92e_disable_irq(struct net_device *dev); void rtl92e_clear_irq(struct net_device *dev); -void rtl8192_InitializeVariables(struct net_device *dev); +void rtl92e_init_variables(struct net_device *dev); void rtl92e_start_beacon(struct net_device *dev); void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val); void rtl92e_get_eeprom_size(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 960131306925..4bcb88b0e798 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -45,7 +45,7 @@ static char *ifname = "wlan%d"; static struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .get_eeprom_size = rtl92e_get_eeprom_size, - .init_adapter_variable = rtl8192_InitializeVariables, + .init_adapter_variable = rtl92e_init_variables, .initialize_adapter = rtl92e_start_adapter, .link_change = rtl8192_link_change, .tx_fill_descriptor = rtl8192_tx_fill_desc, From a57165d15dae6fc6a3fb6b8d9d15075816bfbbd3 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:35 +0200 Subject: [PATCH 382/912] staging: rtl8192e: Rename rtl8192_interrupt_recognized Use naming schema found in other rtlwifi devices. Rename rtl8192_interrupt_recognized to rtl92e_ack_irq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 9424909bebcb..a8f1521f1293 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2276,8 +2276,7 @@ void rtl92e_enable_tx(struct net_device *dev) } -void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, - u32 *p_intb) +void rtl92e_ack_irq(struct net_device *dev, u32 *p_inta, u32 *p_intb) { *p_inta = read_nic_dword(dev, ISR); write_nic_dword(dev, ISR, *p_inta); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index a943ae260291..35a9d3a8dfae 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -31,8 +31,7 @@ bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev); bool rtl92e_get_nmode_support_by_sec(struct net_device *dev); bool rtl92e_is_tx_stuck(struct net_device *dev); bool rtl92e_is_rx_stuck(struct net_device *dev); -void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, - u32 *p_intb); +void rtl92e_ack_irq(struct net_device *dev, u32 *p_inta, u32 *p_intb); void rtl92e_enable_rx(struct net_device *dev); void rtl92e_enable_tx(struct net_device *dev); void rtl92e_enable_irq(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 4bcb88b0e798..5256595d4614 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -59,7 +59,7 @@ static struct rtl819x_ops rtl819xp_ops = { .irq_clear = rtl92e_clear_irq, .rx_enable = rtl92e_enable_rx, .tx_enable = rtl92e_enable_tx, - .interrupt_recognized = rtl8192_interrupt_recognized, + .interrupt_recognized = rtl92e_ack_irq, .TxCheckStuckHandler = rtl92e_is_tx_stuck, .RxCheckStuckHandler = rtl92e_is_rx_stuck, }; From b974b289c4cb8a63b92749ec0c32094609ea571c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:36 +0200 Subject: [PATCH 383/912] staging: rtl8192e: Rename rtl8192_link_change Use naming schema found in other rtlwifi devices. Rename rtl8192_link_change to rtl92e_link_change. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index a8f1521f1293..7ae21d18e96d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -988,7 +988,7 @@ static void rtl8192_net_update(struct net_device *dev) } } -void rtl8192_link_change(struct net_device *dev) +void rtl92e_link_change(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 35a9d3a8dfae..4957824131bc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -42,7 +42,7 @@ void rtl92e_start_beacon(struct net_device *dev); void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val); void rtl92e_get_eeprom_size(struct net_device *dev); bool rtl92e_start_adapter(struct net_device *dev); -void rtl8192_link_change(struct net_device *dev); +void rtl92e_link_change(struct net_device *dev); void rtl92e_set_monitor_mode(struct net_device *dev, bool bAllowAllDA, bool WriteIntoReg); void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 5256595d4614..2149e4de8396 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -47,7 +47,7 @@ static struct rtl819x_ops rtl819xp_ops = { .get_eeprom_size = rtl92e_get_eeprom_size, .init_adapter_variable = rtl92e_init_variables, .initialize_adapter = rtl92e_start_adapter, - .link_change = rtl8192_link_change, + .link_change = rtl92e_link_change, .tx_fill_descriptor = rtl8192_tx_fill_desc, .tx_fill_cmd_descriptor = rtl8192_tx_fill_cmd_desc, .rx_query_status_descriptor = rtl8192_rx_query_status_desc, From 7897285ceb2864b2073fa3c0526d54187b38a2ec Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:37 +0200 Subject: [PATCH 384/912] staging: rtl8192e: Rename rtl8192_rx_query_status_desc Use naming schema found in other rtlwifi devices. Rename rtl8192_rx_query_status_desc to rtl92e_get_rx_stats. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 6 ++---- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 6 ++---- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 7ae21d18e96d..62fff60754a5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2025,10 +2025,8 @@ static void rtl8192_UpdateReceivedRateHistogramStatistics( priv->stats.received_rate_histogram[rcvType][rateIndex]++; } -bool rtl8192_rx_query_status_desc(struct net_device *dev, - struct rtllib_rx_stats *stats, - struct rx_desc *pdesc, - struct sk_buff *skb) +bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, + struct rx_desc *pdesc, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); struct rx_fwinfo *pDrvInfo = NULL; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 4957824131bc..404125eac358 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -51,10 +51,8 @@ void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, void rtl8192_tx_fill_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry, struct cb_desc *cb_desc, struct sk_buff *skb); -bool rtl8192_rx_query_status_desc(struct net_device *dev, - struct rtllib_rx_stats *stats, - struct rx_desc *pdesc, - struct sk_buff *skb); +bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, + struct rx_desc *pdesc, struct sk_buff *skb); void rtl92e_stop_adapter(struct net_device *dev, bool reset); void rtl8192_update_ratr_table(struct net_device *dev); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 2149e4de8396..e364f2a927d3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -50,7 +50,7 @@ static struct rtl819x_ops rtl819xp_ops = { .link_change = rtl92e_link_change, .tx_fill_descriptor = rtl8192_tx_fill_desc, .tx_fill_cmd_descriptor = rtl8192_tx_fill_cmd_desc, - .rx_query_status_descriptor = rtl8192_rx_query_status_desc, + .rx_query_status_descriptor = rtl92e_get_rx_stats, .rx_command_packet_handler = NULL, .stop_adapter = rtl92e_stop_adapter, .update_ratr_table = rtl8192_update_ratr_table, From 63b544a17c63c0d79cd1e5f1bde1e1df06c1d761 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:38 +0200 Subject: [PATCH 385/912] staging: rtl8192e: Rename rtl8192_tx_fill_cmd_desc Use naming schema found in other rtlwifi devices. Rename rtl8192_tx_fill_cmd_desc to rtl92e_fill_tx_cmd_desc. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 5 ++--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 5 ++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 62fff60754a5..bb4a8e62cc95 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1297,9 +1297,8 @@ void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, pdesc->TxBuffAddr = mapping; } -void rtl8192_tx_fill_cmd_desc(struct net_device *dev, - struct tx_desc_cmd *entry, - struct cb_desc *cb_desc, struct sk_buff *skb) +void rtl92e_fill_tx_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry, + struct cb_desc *cb_desc, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 404125eac358..a848fcda1324 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -48,9 +48,8 @@ void rtl92e_set_monitor_mode(struct net_device *dev, bool bAllowAllDA, void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, struct cb_desc *cb_desc, struct sk_buff *skb); -void rtl8192_tx_fill_cmd_desc(struct net_device *dev, - struct tx_desc_cmd *entry, - struct cb_desc *cb_desc, struct sk_buff *skb); +void rtl92e_fill_tx_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry, + struct cb_desc *cb_desc, struct sk_buff *skb); bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, struct rx_desc *pdesc, struct sk_buff *skb); void rtl92e_stop_adapter(struct net_device *dev, bool reset); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index e364f2a927d3..298d7bd17513 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -49,7 +49,7 @@ static struct rtl819x_ops rtl819xp_ops = { .initialize_adapter = rtl92e_start_adapter, .link_change = rtl92e_link_change, .tx_fill_descriptor = rtl8192_tx_fill_desc, - .tx_fill_cmd_descriptor = rtl8192_tx_fill_cmd_desc, + .tx_fill_cmd_descriptor = rtl92e_fill_tx_cmd_desc, .rx_query_status_descriptor = rtl92e_get_rx_stats, .rx_command_packet_handler = NULL, .stop_adapter = rtl92e_stop_adapter, From 072b3948d473f8c4602b8aa51cec54bcbd0ecddb Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:39 +0200 Subject: [PATCH 386/912] staging: rtl8192e: Rename rtl8192_tx_fill_desc Use naming schema found in other rtlwifi devices. Rename rtl8192_tx_fill_desc to rtl92e_fill_tx_desc. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 5 ++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index bb4a8e62cc95..f511fde62202 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1188,8 +1188,8 @@ static u8 rtl8192_QueryIsShort(u8 TxHT, u8 TxRate, struct cb_desc *tcb_desc) return tmp_Short; } -void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, - struct cb_desc *cb_desc, struct sk_buff *skb) +void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, + struct cb_desc *cb_desc, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index a848fcda1324..10a16b6935d1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -45,9 +45,8 @@ bool rtl92e_start_adapter(struct net_device *dev); void rtl92e_link_change(struct net_device *dev); void rtl92e_set_monitor_mode(struct net_device *dev, bool bAllowAllDA, bool WriteIntoReg); -void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, - struct cb_desc *cb_desc, - struct sk_buff *skb); +void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, + struct cb_desc *cb_desc, struct sk_buff *skb); void rtl92e_fill_tx_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry, struct cb_desc *cb_desc, struct sk_buff *skb); bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 298d7bd17513..d7625bac16be 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -48,7 +48,7 @@ static struct rtl819x_ops rtl819xp_ops = { .init_adapter_variable = rtl92e_init_variables, .initialize_adapter = rtl92e_start_adapter, .link_change = rtl92e_link_change, - .tx_fill_descriptor = rtl8192_tx_fill_desc, + .tx_fill_descriptor = rtl92e_fill_tx_desc, .tx_fill_cmd_descriptor = rtl92e_fill_tx_cmd_desc, .rx_query_status_descriptor = rtl92e_get_rx_stats, .rx_command_packet_handler = NULL, From 575d48c57532465cc0a2c34ebb6ebccdaf1be783 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:40 +0200 Subject: [PATCH 387/912] staging: rtl8192e: Rename rtl8192_update_ratr_table Use naming schema found in other rtlwifi devices. Rename rtl8192_update_ratr_table to rtl92e_update_ratr_table. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f511fde62202..2b2660ad88d7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2142,7 +2142,7 @@ void rtl92e_stop_adapter(struct net_device *dev, bool reset) skb_queue_purge(&priv->skb_queue); } -void rtl8192_update_ratr_table(struct net_device *dev) +void rtl92e_update_ratr_table(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index 10a16b6935d1..6bd6b3a4fcea 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -52,5 +52,5 @@ void rtl92e_fill_tx_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry, bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, struct rx_desc *pdesc, struct sk_buff *skb); void rtl92e_stop_adapter(struct net_device *dev, bool reset); -void rtl8192_update_ratr_table(struct net_device *dev); +void rtl92e_update_ratr_table(struct net_device *dev); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index d7625bac16be..08f2d727dc0f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -53,7 +53,7 @@ static struct rtl819x_ops rtl819xp_ops = { .rx_query_status_descriptor = rtl92e_get_rx_stats, .rx_command_packet_handler = NULL, .stop_adapter = rtl92e_stop_adapter, - .update_ratr_table = rtl8192_update_ratr_table, + .update_ratr_table = rtl92e_update_ratr_table, .irq_enable = rtl92e_enable_irq, .irq_disable = rtl92e_disable_irq, .irq_clear = rtl92e_clear_irq, From 16362f45166d027d2b488314aa2e99acf6073f30 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:41 +0200 Subject: [PATCH 388/912] staging: rtl8192e: Rename firmware_init_param Use naming schema found in other rtlwifi devices. Rename firmware_init_param to rtl92e_init_fw_param. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index 0d9c74d86b15..28cb9dd7b73c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c @@ -38,7 +38,7 @@ bool rtl92e_send_cmd_pkt(struct net_device *dev, u8 *code_virtual_address, struct tx_fwinfo_8190pci *pTxFwInfo = NULL; RT_TRACE(COMP_CMDPKT, "%s(),buffer_len is %d\n", __func__, buffer_len); - firmware_init_param(dev); + rtl92e_init_fw_param(dev); frag_threshold = pfirmware->cmdpacket_frag_thresold; do { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 17d2a1540cc8..6c11d19c4668 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -23,7 +23,7 @@ #include "r8192E_firmware.h" #include -void firmware_init_param(struct net_device *dev) +void rtl92e_init_fw_param(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); struct rt_firmware *pfirmware = priv->pFirmware; @@ -46,7 +46,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, struct cb_desc *tcb_desc; u8 bLastIniPkt; - firmware_init_param(dev); + rtl92e_init_fw_param(dev); frag_threshold = pfirmware->cmdpacket_frag_thresold; do { if ((buffer_len - frag_offset) > frag_threshold) { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h index ef232d2c34e6..131ea005edff 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h @@ -60,6 +60,6 @@ struct rt_firmware { }; bool init_firmware(struct net_device *dev); -extern void firmware_init_param(struct net_device *dev); +extern void rtl92e_init_fw_param(struct net_device *dev); #endif From dfb7a12773fb81ef0b15bc8f33297fbd6586fd0c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:42 +0200 Subject: [PATCH 389/912] staging: rtl8192e: Rename InitialGain819xPci Use naming schema found in other rtlwifi devices. Rename InitialGain819xPci to rtl92e_init_gain. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 5d493c6b56ea..7a3e34f1c857 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1295,7 +1295,7 @@ void rtl8192_SetBWMode(struct net_device *dev, enum ht_channel_width Bandwidth, } -void InitialGain819xPci(struct net_device *dev, u8 Operation) +void rtl92e_init_gain(struct net_device *dev, u8 Operation) { #define SCAN_RX_INITIAL_GAIN 0x17 #define POWER_DETECTION_TH 0x08 diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index ef85587c6a12..f4bf9748a28c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -95,7 +95,7 @@ extern u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel); extern void rtl8192_SetBWMode(struct net_device *dev, enum ht_channel_width Bandwidth, enum ht_extchnl_offset Offset); -extern void InitialGain819xPci(struct net_device *dev, u8 Operation); +extern void rtl92e_init_gain(struct net_device *dev, u8 Operation); extern void PHY_SetRtl8192eRfOff(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 08f2d727dc0f..c3c578dfe6a6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -893,7 +893,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->SetHwRegHandler = rtl92e_set_reg; priv->rtllib->AllowAllDestAddrHandler = rtl92e_set_monitor_mode; priv->rtllib->SetFwCmdHandler = NULL; - priv->rtllib->InitialGainHandler = InitialGain819xPci; + priv->rtllib->InitialGainHandler = rtl92e_init_gain; priv->rtllib->rtllib_ips_leave_wq = rtllib_ips_leave_wq; priv->rtllib->rtllib_ips_leave = rtllib_ips_leave; From 9a44c6e6731d32e0a6efd3f2ddfbc81e4936d8b6 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:43 +0200 Subject: [PATCH 390/912] staging: rtl8192e: Rename PHY_ScanOperationBackup8192 Use naming schema found in other rtlwifi devices. Rename PHY_ScanOperationBackup8192 to rtl92e_scan_op_backup. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 7a3e34f1c857..593b5b5b655d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1611,7 +1611,7 @@ bool SetRFPowerState(struct net_device *dev, return bResult; } -void PHY_ScanOperationBackup8192(struct net_device *dev, u8 Operation) +void rtl92e_scan_op_backup(struct net_device *dev, u8 Operation) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index f4bf9748a28c..58d8463057df 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -106,6 +106,6 @@ SetRFPowerState( ); #define PHY_SetRFPowerState SetRFPowerState -extern void PHY_ScanOperationBackup8192(struct net_device *dev, u8 Operation); +extern void rtl92e_scan_op_backup(struct net_device *dev, u8 Operation); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index c3c578dfe6a6..87a53d136bbe 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -900,7 +900,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->LedControlHandler = NULL; priv->rtllib->UpdateBeaconInterruptHandler = NULL; - priv->rtllib->ScanOperationBackupHandler = PHY_ScanOperationBackup8192; + priv->rtllib->ScanOperationBackupHandler = rtl92e_scan_op_backup; } static void rtl8192_init_priv_constant(struct net_device *dev) From 3803cb215ba6933ca461598ff5ba9a2d629e1d84 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:44 +0200 Subject: [PATCH 391/912] staging: rtl8192e: Rename PHY_SetRtl8192eRfOff Use naming schema found in other rtlwifi devices. Rename PHY_SetRtl8192eRfOff to rtl92e_set_rf_off. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 2b2660ad88d7..9a8bd1955f74 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2119,7 +2119,7 @@ void rtl92e_stop_adapter(struct net_device *dev, bool reset) priv->bHwRfOffAction = 2; if (!priv->rtllib->bSupportRemoteWakeUp) { - PHY_SetRtl8192eRfOff(dev); + rtl92e_set_rf_off(dev); ulRegRead = read_nic_dword(dev, CPU_GEN); ulRegRead |= CPU_GEN_SYSTEM_RESET; write_nic_dword(dev, CPU_GEN, ulRegRead); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 593b5b5b655d..c674932e2fe8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1405,7 +1405,7 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation) } } -void PHY_SetRtl8192eRfOff(struct net_device *dev) +void rtl92e_set_rf_off(struct net_device *dev) { rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); @@ -1511,7 +1511,7 @@ static bool SetRFPowerState8190(struct net_device *dev, break; } } - PHY_SetRtl8192eRfOff(dev); + rtl92e_set_rf_off(dev); break; case eRfOff: @@ -1547,7 +1547,7 @@ static bool SetRFPowerState8190(struct net_device *dev, RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC); } else if (!(pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC)) { - PHY_SetRtl8192eRfOff(dev); + rtl92e_set_rf_off(dev); } break; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 58d8463057df..2f1db77e6aa9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -97,7 +97,7 @@ extern void rtl8192_SetBWMode(struct net_device *dev, enum ht_extchnl_offset Offset); extern void rtl92e_init_gain(struct net_device *dev, u8 Operation); -extern void PHY_SetRtl8192eRfOff(struct net_device *dev); +extern void rtl92e_set_rf_off(struct net_device *dev); bool SetRFPowerState( From 2949353dde018594063d20b6dc38cc86b1846729 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:45 +0200 Subject: [PATCH 392/912] staging: rtl8192e: Rename rtl8192_BBConfig Use naming schema found in other rtlwifi devices. Rename rtl8192_BBConfig to rtl92e_config_bb. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 9a8bd1955f74..22625950706b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -750,7 +750,7 @@ start: } } RT_TRACE(COMP_INIT, "BB Config Start!\n"); - rtStatus = rtl8192_BBConfig(dev); + rtStatus = rtl92e_config_bb(dev); if (!rtStatus) { netdev_warn(dev, "%s(): Failed to configure BB\n", __func__); return rtStatus; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index c674932e2fe8..3c6916bcea59 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -599,7 +599,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) return rtStatus; } -bool rtl8192_BBConfig(struct net_device *dev) +bool rtl92e_config_bb(struct net_device *dev) { rtl8192_InitBBRFRegDef(dev); return rtl8192_BB_Config_ParaFile(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 2f1db77e6aa9..cd4b242e18e4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -83,7 +83,7 @@ extern void rtl8192_phy_configmac(struct net_device *dev); extern bool rtl8192_phy_checkBBAndRF(struct net_device *dev, enum hw90_block CheckBlock, enum rf90_radio_path eRFPath); -extern bool rtl8192_BBConfig(struct net_device *dev); +extern bool rtl92e_config_bb(struct net_device *dev); extern void rtl8192_phy_getTxPower(struct net_device *dev); extern void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel); extern bool rtl8192_phy_RFConfig(struct net_device *dev); From e21d14d805bb77b83c100c2df3209909febd379d Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:46 +0200 Subject: [PATCH 393/912] staging: rtl8192e: Rename rtl8192_phy_checkBBAndRF Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_checkBBAndRF to rtl92e_check_bb_and_rf. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 11 +++++------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 6 +++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index b3b72e59d366..0f8bb4833ba1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -127,8 +127,8 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path) eRFPath, 0x0, bMask12Bits, 0xbf); - rtStatus = rtl8192_phy_checkBBAndRF(dev, HW90_BLOCK_RF, - (enum rf90_radio_path)eRFPath); + rtStatus = rtl92e_check_bb_and_rf(dev, HW90_BLOCK_RF, + (enum rf90_radio_path)eRFPath); if (!rtStatus) { netdev_err(dev, "%s(): Failed to check RF Path %d.\n", __func__, eRFPath); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 3c6916bcea59..57bba6121b37 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -489,9 +489,8 @@ static void rtl8192_InitBBRFRegDef(struct net_device *dev) } -bool rtl8192_phy_checkBBAndRF(struct net_device *dev, - enum hw90_block CheckBlock, - enum rf90_radio_path eRFPath) +bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, + enum rf90_radio_path eRFPath) { bool ret = true; u32 i, CheckTimes = 4, dwRegRead = 0; @@ -563,9 +562,9 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) for (eCheckItem = (enum hw90_block)HW90_BLOCK_PHY0; eCheckItem <= HW90_BLOCK_PHY1; eCheckItem++) { - rtStatus = rtl8192_phy_checkBBAndRF(dev, - (enum hw90_block)eCheckItem, - (enum rf90_radio_path)0); + rtStatus = rtl92e_check_bb_and_rf(dev, + (enum hw90_block)eCheckItem, + (enum rf90_radio_path)0); if (!rtStatus) { RT_TRACE((COMP_ERR | COMP_PHY), "rtl92e_config_rf():Check PHY%d Fail!!\n", diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index cd4b242e18e4..8d4ea09c048f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -80,9 +80,9 @@ extern u32 rtl8192_phy_QueryRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, u32 RegAddr, u32 BitMask); extern void rtl8192_phy_configmac(struct net_device *dev); -extern bool rtl8192_phy_checkBBAndRF(struct net_device *dev, - enum hw90_block CheckBlock, - enum rf90_radio_path eRFPath); +extern bool rtl92e_check_bb_and_rf(struct net_device *dev, + enum hw90_block CheckBlock, + enum rf90_radio_path eRFPath); extern bool rtl92e_config_bb(struct net_device *dev); extern void rtl8192_phy_getTxPower(struct net_device *dev); extern void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel); From 5948d1feb7b98d557967760e4dc0b4a253b6e5e3 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:47 +0200 Subject: [PATCH 394/912] staging: rtl8192e: Rename rtl8192_phy_CheckIsLegalRFPath Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_CheckIsLegalRFPath to rtl92e_is_legal_rf_path. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 3 +-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 0f8bb4833ba1..1482a286a2d6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -29,7 +29,7 @@ void rtl92e_set_bandwidth(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); for (eRFPath = 0; eRFPath < priv->NumTotalRFPath; eRFPath++) { - if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) + if (!rtl92e_is_legal_rf_path(dev, eRFPath)) continue; switch (Bandwidth) { @@ -96,7 +96,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) for (eRFPath = (enum rf90_radio_path)RF90_PATH_A; eRFPath < priv->NumTotalRFPath; eRFPath++) { - if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) + if (!rtl92e_is_legal_rf_path(dev, eRFPath)) continue; pPhyReg = &priv->PHYRegDef[eRFPath]; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 22625950706b..d81fa9463bf5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1745,8 +1745,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, priv->stats.num_process_phyinfo++; if (!prev_st->bIsCCK && prev_st->bPacketToSelf) { for (rfpath = RF90_PATH_A; rfpath < RF90_PATH_C; rfpath++) { - if (!rtl8192_phy_CheckIsLegalRFPath(priv->rtllib->dev, - rfpath)) + if (!rtl92e_is_legal_rf_path(priv->rtllib->dev, rfpath)) continue; RT_TRACE(COMP_DBG, "Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d\n", diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 57bba6121b37..1d9ea05c6b56 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -64,7 +64,7 @@ static u32 rtl8192_CalculateBitShift(u32 dwBitMask) return i; } -u8 rtl8192_phy_CheckIsLegalRFPath(struct net_device *dev, u32 eRFPath) +u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath) { u8 ret = 1; struct r8192_priv *priv = rtllib_priv(dev); @@ -222,7 +222,7 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, struct r8192_priv *priv = rtllib_priv(dev); u32 Original_Value, BitShift, New_Value; - if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) + if (!rtl92e_is_legal_rf_path(dev, eRFPath)) return; if (priv->rtllib->eRFPowerState != eRfOn && !priv->being_init_adapter) return; @@ -262,7 +262,7 @@ u32 rtl8192_phy_QueryRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, u32 Original_Value, Readback_Value, BitShift; struct r8192_priv *priv = rtllib_priv(dev); - if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) + if (!rtl92e_is_legal_rf_path(dev, eRFPath)) return 0; if (priv->rtllib->eRFPowerState != eRfOn && !priv->being_init_adapter) return 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 8d4ea09c048f..536a3a2ce05c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -67,8 +67,7 @@ enum rf90_radio_path { #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff -extern u8 rtl8192_phy_CheckIsLegalRFPath(struct net_device *dev, - u32 eRFPath); +extern u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath); extern void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, u32 dwData); extern u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr, From 0efe7104ea2a1e50947fd6272d6efb2c8911fc31 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:48 +0200 Subject: [PATCH 395/912] staging: rtl8192e: Rename rtl8192_phy_configmac Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_configmac to rtl92e_config_mac. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index d81fa9463bf5..bdb37c7a4685 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -828,7 +828,7 @@ start: } write_nic_byte(dev, 0xbe, 0xc0); - rtl8192_phy_configmac(dev); + rtl92e_config_mac(dev); if (priv->card_8192_version > (u8) VERSION_8190_BD) { rtl8192_phy_getTxPower(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 1d9ea05c6b56..36090f7879fb 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -328,7 +328,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev, } -void rtl8192_phy_configmac(struct net_device *dev) +void rtl92e_config_mac(struct net_device *dev) { u32 dwArrayLen = 0, i = 0; u32 *pdwArray = NULL; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 536a3a2ce05c..4cfd4cb3d5b2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -78,7 +78,7 @@ extern void rtl8192_phy_SetRFReg(struct net_device *dev, extern u32 rtl8192_phy_QueryRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, u32 RegAddr, u32 BitMask); -extern void rtl8192_phy_configmac(struct net_device *dev); +extern void rtl92e_config_mac(struct net_device *dev); extern bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, enum rf90_radio_path eRFPath); From 2504c113d85d2679993ffa00bdf5e1a087409b0c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:49 +0200 Subject: [PATCH 396/912] staging: rtl8192e: Rename rtl8192_phy_ConfigRFWithHeaderFile Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_ConfigRFWithHeaderFile to rtl92e_config_rf_path. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 8 ++++---- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 1482a286a2d6..9ed8637c7249 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -141,7 +141,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) case RF90_PATH_A: while (RF3_Final_Value != RegValueToBeCheck && RetryTimes != 0) { - ret = rtl8192_phy_ConfigRFWithHeaderFile(dev, + ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, @@ -157,7 +157,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) case RF90_PATH_B: while (RF3_Final_Value != RegValueToBeCheck && RetryTimes != 0) { - ret = rtl8192_phy_ConfigRFWithHeaderFile(dev, + ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, @@ -173,7 +173,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) case RF90_PATH_C: while (RF3_Final_Value != RegValueToBeCheck && RetryTimes != 0) { - ret = rtl8192_phy_ConfigRFWithHeaderFile(dev, + ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, @@ -189,7 +189,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) case RF90_PATH_D: while (RF3_Final_Value != RegValueToBeCheck && RetryTimes != 0) { - ret = rtl8192_phy_ConfigRFWithHeaderFile(dev, + ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 36090f7879fb..cc39cb5cbfc7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -717,8 +717,7 @@ void rtl8192_phy_updateInitGain(struct net_device *dev) { } -u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev, - enum rf90_radio_path eRFPath) +u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) { int i; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 4cfd4cb3d5b2..94218038a316 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -87,8 +87,8 @@ extern void rtl8192_phy_getTxPower(struct net_device *dev); extern void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel); extern bool rtl8192_phy_RFConfig(struct net_device *dev); extern void rtl8192_phy_updateInitGain(struct net_device *dev); -extern u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev, - enum rf90_radio_path eRFPath); +extern u8 rtl92e_config_rf_path(struct net_device *dev, + enum rf90_radio_path eRFPath); extern u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel); extern void rtl8192_SetBWMode(struct net_device *dev, From 78cc16fa40f731ff1eef2ea9806d70afdf8220c7 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:50 +0200 Subject: [PATCH 397/912] staging: rtl8192e: Rename rtl8192_phy_getTxPower Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_getTxPower to rtl92e_get_tx_power. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index bdb37c7a4685..6479d619ae2a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -831,7 +831,7 @@ start: rtl92e_config_mac(dev); if (priv->card_8192_version > (u8) VERSION_8190_BD) { - rtl8192_phy_getTxPower(dev); + rtl92e_get_tx_power(dev); rtl8192_phy_setTxPower(dev, priv->chan); } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index cc39cb5cbfc7..8800c82e7ceb 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -604,7 +604,7 @@ bool rtl92e_config_bb(struct net_device *dev) return rtl8192_BB_Config_ParaFile(dev); } -void rtl8192_phy_getTxPower(struct net_device *dev) +void rtl92e_get_tx_power(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 94218038a316..67a7be9c8d30 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -83,7 +83,7 @@ extern bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, enum rf90_radio_path eRFPath); extern bool rtl92e_config_bb(struct net_device *dev); -extern void rtl8192_phy_getTxPower(struct net_device *dev); +extern void rtl92e_get_tx_power(struct net_device *dev); extern void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel); extern bool rtl8192_phy_RFConfig(struct net_device *dev); extern void rtl8192_phy_updateInitGain(struct net_device *dev); From 4d415decee9229b09fa6c800f5e2b00bf6c8988e Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:51 +0200 Subject: [PATCH 398/912] staging: rtl8192e: Rename rtl8192_phy_QueryRFReg Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_QueryRFReg to rtl92e_get_rf_reg. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 8 ++++---- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 +++++----- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 9ed8637c7249..510dfb22949e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -143,7 +143,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) RetryTimes != 0) { ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, + RF3_Final_Value = rtl92e_get_rf_reg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); @@ -159,7 +159,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) RetryTimes != 0) { ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, + RF3_Final_Value = rtl92e_get_rf_reg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); @@ -175,7 +175,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) RetryTimes != 0) { ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, + RF3_Final_Value = rtl92e_get_rf_reg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); @@ -191,7 +191,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) RetryTimes != 0) { ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, + RF3_Final_Value = rtl92e_get_rf_reg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); RT_TRACE(COMP_RF, diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 8800c82e7ceb..c245f9537138 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -256,8 +256,8 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, } } -u32 rtl8192_phy_QueryRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, - u32 RegAddr, u32 BitMask) +u32 rtl92e_get_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, + u32 RegAddr, u32 BitMask) { u32 Original_Value, Readback_Value, BitShift; struct r8192_priv *priv = rtllib_priv(dev); @@ -525,9 +525,9 @@ bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, WriteAddr[HW90_BLOCK_RF], bMask12Bits, WriteData[i]); mdelay(10); - dwRegRead = rtl8192_phy_QueryRFReg(dev, eRFPath, - WriteAddr[HW90_BLOCK_RF], - bMaskDWord); + dwRegRead = rtl92e_get_rf_reg(dev, eRFPath, + WriteAddr[HW90_BLOCK_RF], + bMaskDWord); mdelay(10); break; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 67a7be9c8d30..2dd947466756 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -75,9 +75,9 @@ extern u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr, extern void rtl8192_phy_SetRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, u32 RegAddr, u32 BitMask, u32 Data); -extern u32 rtl8192_phy_QueryRFReg(struct net_device *dev, - enum rf90_radio_path eRFPath, - u32 RegAddr, u32 BitMask); +extern u32 rtl92e_get_rf_reg(struct net_device *dev, + enum rf90_radio_path eRFPath, u32 RegAddr, + u32 BitMask); extern void rtl92e_config_mac(struct net_device *dev); extern bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 47ead3732a2b..54ec25f5d16d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -883,7 +883,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) return; } - tmpRegA = rtl8192_phy_QueryRFReg(dev, RF90_PATH_A, 0x12, 0x078); + tmpRegA = rtl92e_get_rf_reg(dev, RF90_PATH_A, 0x12, 0x078); RT_TRACE(COMP_POWER_TRACKING, "Readback ThermalMeterA = %d\n", tmpRegA); if (tmpRegA < 3 || tmpRegA > 13) return; From 31aebbe2226cdcb17ee9cd9ed6f66c072604f8d9 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:52 +0200 Subject: [PATCH 399/912] staging: rtl8192e: Rename rtl8192_phy_RFConfig Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_RFConfig to rtl92e_config_phy. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 6479d619ae2a..b389041db5bb 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -863,7 +863,7 @@ start: RT_TRACE(COMP_INIT, "Load Firmware finished!\n"); if (priv->ResetProgress == RESET_TYPE_NORESET) { RT_TRACE(COMP_INIT, "RF Config Started!\n"); - rtStatus = rtl8192_phy_RFConfig(dev); + rtStatus = rtl92e_config_phy(dev); if (!rtStatus) { netdev_info(dev, "RF Config failed\n"); return rtStatus; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index c245f9537138..19d954781385 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -689,7 +689,7 @@ void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel) } } -bool rtl8192_phy_RFConfig(struct net_device *dev) +bool rtl92e_config_phy(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); bool rtStatus = true; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 2dd947466756..66a2f2f45671 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -85,7 +85,7 @@ extern bool rtl92e_check_bb_and_rf(struct net_device *dev, extern bool rtl92e_config_bb(struct net_device *dev); extern void rtl92e_get_tx_power(struct net_device *dev); extern void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel); -extern bool rtl8192_phy_RFConfig(struct net_device *dev); +extern bool rtl92e_config_phy(struct net_device *dev); extern void rtl8192_phy_updateInitGain(struct net_device *dev); extern u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath); From b0e044feec65d1f71956672ea2b7a1ea5e6d2ec6 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:53 +0200 Subject: [PATCH 400/912] staging: rtl8192e: Rename rtl8192_phy_SetRFReg Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_SetRFReg to rtl92e_set_rf_reg. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../rtl8192e/rtl8192e/r8190P_rtl8256.c | 40 +++++++++---------- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 39 +++++++++--------- .../staging/rtl8192e/rtl8192e/r8192E_phy.h | 6 +-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 8 ++-- 4 files changed, 45 insertions(+), 48 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 510dfb22949e..92bac867f832 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -36,15 +36,15 @@ void rtl92e_set_bandwidth(struct net_device *dev, case HT_CHANNEL_WIDTH_20: if (priv->card_8192_version == VERSION_8190_BD || priv->card_8192_version == VERSION_8190_BE) { - rtl8192_phy_SetRFReg(dev, - (enum rf90_radio_path)eRFPath, - 0x0b, bMask12Bits, 0x100); - rtl8192_phy_SetRFReg(dev, - (enum rf90_radio_path)eRFPath, - 0x2c, bMask12Bits, 0x3d7); - rtl8192_phy_SetRFReg(dev, - (enum rf90_radio_path)eRFPath, - 0x0e, bMask12Bits, 0x021); + rtl92e_set_rf_reg(dev, + (enum rf90_radio_path)eRFPath, + 0x0b, bMask12Bits, 0x100); + rtl92e_set_rf_reg(dev, + (enum rf90_radio_path)eRFPath, + 0x2c, bMask12Bits, 0x3d7); + rtl92e_set_rf_reg(dev, + (enum rf90_radio_path)eRFPath, + 0x0e, bMask12Bits, 0x021); } else { netdev_warn(dev, "%s(): Unknown HW version.\n", @@ -55,15 +55,15 @@ void rtl92e_set_bandwidth(struct net_device *dev, case HT_CHANNEL_WIDTH_20_40: if (priv->card_8192_version == VERSION_8190_BD || priv->card_8192_version == VERSION_8190_BE) { - rtl8192_phy_SetRFReg(dev, - (enum rf90_radio_path)eRFPath, - 0x0b, bMask12Bits, 0x300); - rtl8192_phy_SetRFReg(dev, - (enum rf90_radio_path)eRFPath, - 0x2c, bMask12Bits, 0x3ff); - rtl8192_phy_SetRFReg(dev, - (enum rf90_radio_path)eRFPath, - 0x0e, bMask12Bits, 0x0e1); + rtl92e_set_rf_reg(dev, + (enum rf90_radio_path)eRFPath, + 0x0b, bMask12Bits, 0x300); + rtl92e_set_rf_reg(dev, + (enum rf90_radio_path)eRFPath, + 0x2c, bMask12Bits, 0x3ff); + rtl92e_set_rf_reg(dev, + (enum rf90_radio_path)eRFPath, + 0x0e, bMask12Bits, 0x0e1); } else { netdev_warn(dev, "%s(): Unknown HW version.\n", @@ -124,8 +124,8 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); - rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path) eRFPath, 0x0, - bMask12Bits, 0xbf); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, 0x0, + bMask12Bits, 0xbf); rtStatus = rtl92e_check_bb_and_rf(dev, HW90_BLOCK_RF, (enum rf90_radio_path)eRFPath); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 19d954781385..6ddbbfc29f4f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -216,8 +216,8 @@ static void rtl8192_phy_RFSerialWrite(struct net_device *dev, } } -void rtl8192_phy_SetRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, - u32 RegAddr, u32 BitMask, u32 Data) +void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, + u32 RegAddr, u32 BitMask, u32 Data) { struct r8192_priv *priv = rtllib_priv(dev); u32 Original_Value, BitShift, New_Value; @@ -521,9 +521,9 @@ bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, case HW90_BLOCK_RF: WriteData[i] &= 0xfff; - rtl8192_phy_SetRFReg(dev, eRFPath, - WriteAddr[HW90_BLOCK_RF], - bMask12Bits, WriteData[i]); + rtl92e_set_rf_reg(dev, eRFPath, + WriteAddr[HW90_BLOCK_RF], + bMask12Bits, WriteData[i]); mdelay(10); dwRegRead = rtl92e_get_rf_reg(dev, eRFPath, WriteAddr[HW90_BLOCK_RF], @@ -729,10 +729,9 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) msleep(100); continue; } - rtl8192_phy_SetRFReg(dev, eRFPath, - Rtl819XRadioA_Array[i], - bMask12Bits, - Rtl819XRadioA_Array[i+1]); + rtl92e_set_rf_reg(dev, eRFPath, Rtl819XRadioA_Array[i], + bMask12Bits, + Rtl819XRadioA_Array[i+1]); } break; @@ -742,10 +741,9 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) msleep(100); continue; } - rtl8192_phy_SetRFReg(dev, eRFPath, - Rtl819XRadioB_Array[i], - bMask12Bits, - Rtl819XRadioB_Array[i+1]); + rtl92e_set_rf_reg(dev, eRFPath, Rtl819XRadioB_Array[i], + bMask12Bits, + Rtl819XRadioB_Array[i+1]); } break; @@ -755,10 +753,9 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) msleep(100); continue; } - rtl8192_phy_SetRFReg(dev, eRFPath, - Rtl819XRadioC_Array[i], - bMask12Bits, - Rtl819XRadioC_Array[i+1]); + rtl92e_set_rf_reg(dev, eRFPath, Rtl819XRadioC_Array[i], + bMask12Bits, + Rtl819XRadioC_Array[i+1]); } break; @@ -768,9 +765,9 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) msleep(100); continue; } - rtl8192_phy_SetRFReg(dev, eRFPath, - Rtl819XRadioD_Array[i], bMask12Bits, - Rtl819XRadioD_Array[i+1]); + rtl92e_set_rf_reg(dev, eRFPath, Rtl819XRadioD_Array[i], + bMask12Bits, + Rtl819XRadioD_Array[i+1]); } break; @@ -953,7 +950,7 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, case CmdID_RF_WriteReg: for (eRFPath = 0; eRFPath < priv->NumTotalRFPath; eRFPath++) - rtl8192_phy_SetRFReg(dev, + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, CurrentCmd->Para1, bMask12Bits, CurrentCmd->Para2<<7); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 66a2f2f45671..33aa78a375d9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -72,9 +72,9 @@ extern void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, u32 dwData); extern u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask); -extern void rtl8192_phy_SetRFReg(struct net_device *dev, - enum rf90_radio_path eRFPath, - u32 RegAddr, u32 BitMask, u32 Data); +extern void rtl92e_set_rf_reg(struct net_device *dev, + enum rf90_radio_path eRFPath, u32 RegAddr, + u32 BitMask, u32 Data); extern u32 rtl92e_get_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, u32 RegAddr, u32 BitMask); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 54ec25f5d16d..de085477f2f6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1038,10 +1038,10 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) if (!TM_Trigger) { { - rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); - rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); - rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); - rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); + rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); + rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); + rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); + rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); } TM_Trigger = 1; return; From 5aa1b9cad7a352e2e4a72f553689fe03c629f65c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:54 +0200 Subject: [PATCH 401/912] staging: rtl8192e: Rename rtl8192_phy_setTxPower Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_setTxPower to rtl92e_set_tx_power. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index b389041db5bb..8f3172e908d4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -832,7 +832,7 @@ start: if (priv->card_8192_version > (u8) VERSION_8190_BD) { rtl92e_get_tx_power(dev); - rtl8192_phy_setTxPower(dev, priv->chan); + rtl92e_set_tx_power(dev, priv->chan); } tmpvalue = read_nic_byte(dev, IC_VERRSION); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 6ddbbfc29f4f..fbbf5346d76a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -637,7 +637,7 @@ void rtl92e_get_tx_power(struct net_device *dev) priv->SifsTime = read_nic_word(dev, SIFS); } -void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel) +void rtl92e_set_tx_power(struct net_device *dev, u8 channel) { struct r8192_priv *priv = rtllib_priv(dev); u8 powerlevel = 0, powerlevelOFDM24G = 0; @@ -1386,7 +1386,7 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation) "Scan BBInitialGainRestore 0xa0a is %x\n", priv->initgain_backup.cca); - rtl8192_phy_setTxPower(dev, + rtl92e_set_tx_power(dev, priv->rtllib->current_network.channel); if (dm_digtable.dig_algorithm == diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 33aa78a375d9..b474a2b1e01a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -84,7 +84,7 @@ extern bool rtl92e_check_bb_and_rf(struct net_device *dev, enum rf90_radio_path eRFPath); extern bool rtl92e_config_bb(struct net_device *dev); extern void rtl92e_get_tx_power(struct net_device *dev); -extern void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel); +extern void rtl92e_set_tx_power(struct net_device *dev, u8 channel); extern bool rtl92e_config_phy(struct net_device *dev); extern void rtl8192_phy_updateInitGain(struct net_device *dev); extern u8 rtl92e_config_rf_path(struct net_device *dev, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index de085477f2f6..fe8f29153ef5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -2555,8 +2555,7 @@ static void dm_dynamic_txpower(struct net_device *dev) RT_TRACE(COMP_TXAGC, "SetTxPowerLevel8190() channel = %d\n", priv->rtllib->current_network.channel); - rtl8192_phy_setTxPower(dev, - priv->rtllib->current_network.channel); + rtl92e_set_tx_power(dev, priv->rtllib->current_network.channel); } priv->bLastDTPFlag_High = priv->bDynamicTxHighPower; priv->bLastDTPFlag_Low = priv->bDynamicTxLowPower; From 68a5143c812d13d6a30c5863511cb2ee92635123 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:55 +0200 Subject: [PATCH 402/912] staging: rtl8192e: Rename rtl8192_phy_SwChnl Use naming schema found in other rtlwifi devices. Rename rtl8192_phy_SwChnl to rtl92e_set_channel. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index fbbf5346d76a..f575ee1511fa 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -996,7 +996,7 @@ static void rtl8192_SwChnl_WorkItem(struct net_device *dev) RT_TRACE(COMP_TRACE, "<== SwChnlCallback819xUsbWorkItem()\n"); } -u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel) +u8 rtl92e_set_channel(struct net_device *dev, u8 channel) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index b474a2b1e01a..3bfde0d60434 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -90,7 +90,7 @@ extern void rtl8192_phy_updateInitGain(struct net_device *dev); extern u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath); -extern u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel); +extern u8 rtl92e_set_channel(struct net_device *dev, u8 channel); extern void rtl8192_SetBWMode(struct net_device *dev, enum ht_channel_width Bandwidth, enum ht_extchnl_offset Offset); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 87a53d136bbe..99b36f8b5c79 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -877,7 +877,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->SetWirelessMode = rtl8192_SetWirelessMode; priv->rtllib->LeisurePSLeave = LeisurePSLeave; priv->rtllib->SetBWModeHandler = rtl8192_SetBWMode; - priv->rf_set_chan = rtl8192_phy_SwChnl; + priv->rf_set_chan = rtl92e_set_channel; priv->rtllib->start_send_beacons = rtl92e_start_beacon; priv->rtllib->stop_send_beacons = rtl8192_stop_beacon; From 3c351feca929e142574b1f904a42475e4056de45 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:56 +0200 Subject: [PATCH 403/912] staging: rtl8192e: Rename rtl8192_QueryBBReg Use naming schema found in other rtlwifi devices. Rename rtl8192_QueryBBReg to rtl92e_get_bb_reg. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../rtl8192e/rtl8192e/r8190P_rtl8256.c | 8 +++---- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 17 ++++++------- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 24 +++++++++---------- .../staging/rtl8192e/rtl8192e/r8192E_phy.h | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ++++++------- 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 92bac867f832..c3abd296e847 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -105,13 +105,13 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) switch (eRFPath) { case RF90_PATH_A: case RF90_PATH_C: - u4RegValue = rtl8192_QueryBBReg(dev, pPhyReg->rfintfs, - bRFSI_RFENV); + u4RegValue = rtl92e_get_bb_reg(dev, pPhyReg->rfintfs, + bRFSI_RFENV); break; case RF90_PATH_B: case RF90_PATH_D: - u4RegValue = rtl8192_QueryBBReg(dev, pPhyReg->rfintfs, - bRFSI_RFENV<<16); + u4RegValue = rtl92e_get_bb_reg(dev, pPhyReg->rfintfs, + bRFSI_RFENV<<16); break; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 8f3172e908d4..4e0ce871bc61 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -910,10 +910,10 @@ start: dm_initialize_txpower_tracking(dev); if (priv->IC_Cut >= IC_VersionCut_D) { - tmpRegA = rtl8192_QueryBBReg(dev, - rOFDM0_XATxIQImbalance, bMaskDWord); - tmpRegC = rtl8192_QueryBBReg(dev, - rOFDM0_XCTxIQImbalance, bMaskDWord); + tmpRegA = rtl92e_get_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord); + tmpRegC = rtl92e_get_bb_reg(dev, rOFDM0_XCTxIQImbalance, + bMaskDWord); for (i = 0; i < TxBBGainTableLength; i++) { if (tmpRegA == dm_tx_bb_gain[i]) { priv->rfa_txpowertrackingindex = (u8)i; @@ -925,8 +925,8 @@ start: } } - TempCCk = rtl8192_QueryBBReg(dev, - rCCK0_TxFilter1, bMaskByte2); + TempCCk = rtl92e_get_bb_reg(dev, rCCK0_TxFilter1, + bMaskByte2); for (i = 0; i < CCKTxBBGainTableLength; i++) { if (TempCCk == dm_cck_tx_bb_gain[i][0]) { @@ -1516,8 +1516,9 @@ static void rtl8192_query_rxphystatus( pstats->bPacketBeacon = precord_stats->bPacketBeacon = bPacketBeacon; pstats->bToSelfBA = precord_stats->bToSelfBA = bToSelfBA; if (check_reg824 == 0) { - reg824_bit9 = rtl8192_QueryBBReg(priv->rtllib->dev, - rFPGA0_XA_HSSIParameter2, 0x200); + reg824_bit9 = rtl92e_get_bb_reg(priv->rtllib->dev, + rFPGA0_XA_HSSIParameter2, + 0x200); check_reg824 = 1; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index f575ee1511fa..a993cc746e47 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -96,7 +96,7 @@ void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, write_nic_dword(dev, dwRegAddr, dwData); } -u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask) +u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask) { u32 Ret = 0, OriginalValue, BitShift; @@ -146,8 +146,8 @@ static u32 rtl8192_phy_RFSerialRead(struct net_device *dev, mdelay(1); - ret = rtl8192_QueryBBReg(dev, pPhyReg->rfLSSIReadBack, - bLSSIReadBackData); + ret = rtl92e_get_bb_reg(dev, pPhyReg->rfLSSIReadBack, + bLSSIReadBackData); if (priv->rf_chip == RF_8256) { priv->RfReg0Value[eRFPath] &= 0xebf; @@ -1309,19 +1309,19 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation) DIG_ALGO_BY_FALSE_ALARM) rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); priv->initgain_backup.xaagccore1 = - (u8)rtl8192_QueryBBReg(dev, rOFDM0_XAAGCCore1, - BitMask); + (u8)rtl92e_get_bb_reg(dev, rOFDM0_XAAGCCore1, + BitMask); priv->initgain_backup.xbagccore1 = - (u8)rtl8192_QueryBBReg(dev, rOFDM0_XBAGCCore1, - BitMask); + (u8)rtl92e_get_bb_reg(dev, rOFDM0_XBAGCCore1, + BitMask); priv->initgain_backup.xcagccore1 = - (u8)rtl8192_QueryBBReg(dev, rOFDM0_XCAGCCore1, - BitMask); + (u8)rtl92e_get_bb_reg(dev, rOFDM0_XCAGCCore1, + BitMask); priv->initgain_backup.xdagccore1 = - (u8)rtl8192_QueryBBReg(dev, rOFDM0_XDAGCCore1, - BitMask); + (u8)rtl92e_get_bb_reg(dev, rOFDM0_XDAGCCore1, + BitMask); BitMask = bMaskByte2; - priv->initgain_backup.cca = (u8)rtl8192_QueryBBReg(dev, + priv->initgain_backup.cca = (u8)rtl92e_get_bb_reg(dev, rCCK0_CCA, BitMask); RT_TRACE(COMP_SCAN, diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 3bfde0d60434..7a147ecfb2d5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -70,8 +70,8 @@ enum rf90_radio_path { extern u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath); extern void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, u32 dwData); -extern u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr, - u32 dwBitMask); +extern u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, + u32 dwBitMask); extern void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, u32 RegAddr, u32 BitMask, u32 Data); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index fe8f29153ef5..2137252a5267 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -856,8 +856,8 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) int i = 0, CCKSwingNeedUpdate = 0; if (!priv->btxpower_trackingInit) { - tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord); + tmpRegA = rtl92e_get_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord); for (i = 0; i < OFDM_Table_Length; i++) { if (tmpRegA == OFDMSwingTable[i]) { priv->OFDM_index[0] = (u8)i; @@ -868,7 +868,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) } } - TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2); + TempCCk = rtl92e_get_bb_reg(dev, rCCK0_TxFilter1, bMaskByte2); for (i = 0; i < CCK_Table_length; i++) { if (TempCCk == (u32)CCKSwingTable_Ch1_Ch13[i][0]) { priv->CCK_index = (u8) i; @@ -1279,12 +1279,12 @@ static void dm_bb_initialgain_backup(struct net_device *dev) return; rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); - priv->initgain_backup.xaagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XAAGCCore1, bit_mask); - priv->initgain_backup.xbagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XBAGCCore1, bit_mask); - priv->initgain_backup.xcagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XCAGCCore1, bit_mask); - priv->initgain_backup.xdagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XDAGCCore1, bit_mask); + priv->initgain_backup.xaagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XAAGCCore1, bit_mask); + priv->initgain_backup.xbagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XBAGCCore1, bit_mask); + priv->initgain_backup.xcagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XCAGCCore1, bit_mask); + priv->initgain_backup.xdagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XDAGCCore1, bit_mask); bit_mask = bMaskByte2; - priv->initgain_backup.cca = (u8)rtl8192_QueryBBReg(dev, rCCK0_CCA, bit_mask); + priv->initgain_backup.cca = (u8)rtl92e_get_bb_reg(dev, rCCK0_CCA, bit_mask); RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc50 is %x\n", priv->initgain_backup.xaagccore1); From 153f9ddbe97828e9cb3428bc6698da49deb3c574 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:57 +0200 Subject: [PATCH 404/912] staging: rtl8192e: Rename rtl8192_setBBreg Use naming schema found in other rtlwifi devices. Rename rtl8192_setBBreg to rtl92e_set_bb_reg. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../rtl8192e/rtl8192e/r8190P_rtl8256.c | 24 +-- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 +- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 165 +++++++++-------- .../staging/rtl8192e/rtl8192e/r8192E_phy.h | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 171 +++++++++--------- 5 files changed, 182 insertions(+), 186 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index c3abd296e847..e5f4c2df69fd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -115,14 +115,14 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) break; } - rtl8192_setBBreg(dev, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1); + rtl92e_set_bb_reg(dev, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1); - rtl8192_setBBreg(dev, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); + rtl92e_set_bb_reg(dev, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); - rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, - b3WireAddressLength, 0x0); - rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, - b3WireDataLength, 0x0); + rtl92e_set_bb_reg(dev, pPhyReg->rfHSSIPara2, + b3WireAddressLength, 0x0); + rtl92e_set_bb_reg(dev, pPhyReg->rfHSSIPara2, + b3WireDataLength, 0x0); rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, 0x0, bMask12Bits, 0xbf); @@ -206,13 +206,13 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) switch (eRFPath) { case RF90_PATH_A: case RF90_PATH_C: - rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV, - u4RegValue); + rtl92e_set_bb_reg(dev, pPhyReg->rfintfs, bRFSI_RFENV, + u4RegValue); break; case RF90_PATH_B: case RF90_PATH_D: - rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16, - u4RegValue); + rtl92e_set_bb_reg(dev, pPhyReg->rfintfs, + bRFSI_RFENV<<16, u4RegValue); break; } @@ -254,7 +254,7 @@ void rtl92e_set_cck_tx_power(struct net_device *dev, u8 powerlevel) } if (TxAGC > 0x24) TxAGC = 0x24; - rtl8192_setBBreg(dev, rTxAGC_CCK_Mcs32, bTxAGCRateCCK, TxAGC); + rtl92e_set_bb_reg(dev, rTxAGC_CCK_Mcs32, bTxAGCRateCCK, TxAGC); } @@ -300,7 +300,7 @@ void rtl92e_set_ofdm_tx_power(struct net_device *dev, u8 powerlevel) else writeVal = (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0; - rtl8192_setBBreg(dev, RegOffset[index], 0x7f7f7f7f, writeVal); + rtl92e_set_bb_reg(dev, RegOffset[index], 0x7f7f7f7f, writeVal); } } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 4e0ce871bc61..b6d26fa4e2ee 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -872,8 +872,8 @@ start: } rtl8192_phy_updateInitGain(dev); - rtl8192_setBBreg(dev, rFPGA0_RFMOD, bCCKEn, 0x1); - rtl8192_setBBreg(dev, rFPGA0_RFMOD, bOFDMEn, 0x1); + rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bCCKEn, 0x1); + rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bOFDMEn, 0x1); write_nic_byte(dev, 0x87, 0x0); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index a993cc746e47..7bbbe7be6f60 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -80,8 +80,8 @@ u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath) return ret; } -void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, - u32 dwData) +void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, + u32 dwData) { u32 OriginalValue, BitShift, NewValue; @@ -117,19 +117,19 @@ static u32 rtl8192_phy_RFSerialRead(struct net_device *dev, Offset &= 0x3f; if (priv->rf_chip == RF_8256) { - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0); if (Offset >= 31) { priv->RfReg0Value[eRFPath] |= 0x140; - rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->RfReg0Value[eRFPath]<<16)); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->RfReg0Value[eRFPath]<<16)); NewOffset = Offset - 30; } else if (Offset >= 16) { priv->RfReg0Value[eRFPath] |= 0x100; priv->RfReg0Value[eRFPath] &= (~0x40); - rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->RfReg0Value[eRFPath]<<16)); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->RfReg0Value[eRFPath]<<16)); NewOffset = Offset - 15; } else @@ -139,10 +139,10 @@ static u32 rtl8192_phy_RFSerialRead(struct net_device *dev, "check RF type here, need to be 8256\n"); NewOffset = Offset; } - rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadAddress, - NewOffset); - rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadEdge, 0x0); - rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadEdge, 0x1); + rtl92e_set_bb_reg(dev, pPhyReg->rfHSSIPara2, bLSSIReadAddress, + NewOffset); + rtl92e_set_bb_reg(dev, pPhyReg->rfHSSIPara2, bLSSIReadEdge, 0x0); + rtl92e_set_bb_reg(dev, pPhyReg->rfHSSIPara2, bLSSIReadEdge, 0x1); mdelay(1); @@ -152,10 +152,10 @@ static u32 rtl8192_phy_RFSerialRead(struct net_device *dev, if (priv->rf_chip == RF_8256) { priv->RfReg0Value[eRFPath] &= 0xebf; - rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, - (priv->RfReg0Value[eRFPath] << 16)); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, bMaskDWord, + (priv->RfReg0Value[eRFPath] << 16)); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); } @@ -173,20 +173,20 @@ static void rtl8192_phy_RFSerialWrite(struct net_device *dev, Offset &= 0x3f; if (priv->rf_chip == RF_8256) { - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0); if (Offset >= 31) { priv->RfReg0Value[eRFPath] |= 0x140; - rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->RfReg0Value[eRFPath] << 16)); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->RfReg0Value[eRFPath] << 16)); NewOffset = Offset - 30; } else if (Offset >= 16) { priv->RfReg0Value[eRFPath] |= 0x100; priv->RfReg0Value[eRFPath] &= (~0x40); - rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->RfReg0Value[eRFPath] << 16)); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->RfReg0Value[eRFPath] << 16)); NewOffset = Offset - 15; } else NewOffset = Offset; @@ -198,7 +198,7 @@ static void rtl8192_phy_RFSerialWrite(struct net_device *dev, DataAndAddr = (Data<<16) | (NewOffset&0x3f); - rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr); if (Offset == 0x0) priv->RfReg0Value[eRFPath] = Data; @@ -206,13 +206,11 @@ static void rtl8192_phy_RFSerialWrite(struct net_device *dev, if (priv->rf_chip == RF_8256) { if (Offset != 0) { priv->RfReg0Value[eRFPath] &= 0xebf; - rtl8192_setBBreg( - dev, - pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->RfReg0Value[eRFPath] << 16)); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->RfReg0Value[eRFPath] << 16)); } - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); } } @@ -350,8 +348,8 @@ void rtl92e_config_mac(struct net_device *dev) pdwArray[i], pdwArray[i+1], pdwArray[i+2]); if (pdwArray[i] == 0x318) pdwArray[i+2] = 0x00000800; - rtl8192_setBBreg(dev, pdwArray[i], pdwArray[i+1], - pdwArray[i+2]); + rtl92e_set_bb_reg(dev, pdwArray[i], pdwArray[i+1], + pdwArray[i+2]); } return; @@ -377,9 +375,9 @@ static void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) if (ConfigType == BaseBand_Config_PHY_REG) { for (i = 0; i < PHY_REGArrayLen; i += 2) { - rtl8192_setBBreg(dev, Rtl819XPHY_REGArray_Table[i], - bMaskDWord, - Rtl819XPHY_REGArray_Table[i+1]); + rtl92e_set_bb_reg(dev, Rtl819XPHY_REGArray_Table[i], + bMaskDWord, + Rtl819XPHY_REGArray_Table[i+1]); RT_TRACE(COMP_DBG, "i: %x, The Rtl819xUsbPHY_REGArray[0] is %x Rtl819xUsbPHY_REGArray[1] is %x\n", i, Rtl819XPHY_REGArray_Table[i], @@ -387,9 +385,9 @@ static void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) } } else if (ConfigType == BaseBand_Config_AGC_TAB) { for (i = 0; i < AGCTAB_ArrayLen; i += 2) { - rtl8192_setBBreg(dev, Rtl819XAGCTAB_Array_Table[i], - bMaskDWord, - Rtl819XAGCTAB_Array_Table[i+1]); + rtl92e_set_bb_reg(dev, Rtl819XAGCTAB_Array_Table[i], + bMaskDWord, + Rtl819XAGCTAB_Array_Table[i+1]); RT_TRACE(COMP_DBG, "i:%x, The rtl819XAGCTAB_Array[0] is %x rtl819XAGCTAB_Array[1] is %x\n", i, Rtl819XAGCTAB_Array_Table[i], @@ -572,7 +570,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) return rtStatus; } } - rtl8192_setBBreg(dev, rFPGA0_RFMOD, bCCKEn|bOFDMEn, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bCCKEn|bOFDMEn, 0x0); rtl8192_phyConfigBB(dev, BaseBand_Config_PHY_REG); dwRegValue = read_nic_dword(dev, CPU_GEN); @@ -587,13 +585,13 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) priv->AntennaTxPwDiff[0]); else dwRegValue = 0x0; - rtl8192_setBBreg(dev, rFPGA0_TxGainStage, - (bXBTxAGC|bXCTxAGC|bXDTxAGC), dwRegValue); + rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage, + (bXBTxAGC|bXCTxAGC|bXDTxAGC), dwRegValue); dwRegValue = priv->CrystalCap; - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, bXtalCap92x, - dwRegValue); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, bXtalCap92x, + dwRegValue); } return rtStatus; @@ -670,8 +668,9 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel) priv->AntennaTxPwDiff[1]<<4 | priv->AntennaTxPwDiff[0]); - rtl8192_setBBreg(dev, rFPGA0_TxGainStage, - (bXBTxAGC|bXCTxAGC|bXDTxAGC), u4RegValue); + rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage, + (bXBTxAGC|bXCTxAGC|bXDTxAGC), + u4RegValue); } } switch (priv->rf_chip) { @@ -1199,8 +1198,8 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) switch (priv->CurrentChannelBW) { case HT_CHANNEL_WIDTH_20: - rtl8192_setBBreg(dev, rFPGA0_RFMOD, bRFMOD, 0x0); - rtl8192_setBBreg(dev, rFPGA1_RFMOD, bRFMOD, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bRFMOD, 0x0); + rtl92e_set_bb_reg(dev, rFPGA1_RFMOD, bRFMOD, 0x0); if (!priv->btxpower_tracking) { write_nic_dword(dev, rCCK0_TxFilter1, 0x1a1b0000); @@ -1210,12 +1209,12 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) CCK_Tx_Power_Track_BW_Switch(dev); } - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 1); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x00100000, 1); break; case HT_CHANNEL_WIDTH_20_40: - rtl8192_setBBreg(dev, rFPGA0_RFMOD, bRFMOD, 0x1); - rtl8192_setBBreg(dev, rFPGA1_RFMOD, bRFMOD, 0x1); + rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bRFMOD, 0x1); + rtl92e_set_bb_reg(dev, rFPGA1_RFMOD, bRFMOD, 0x1); if (!priv->btxpower_tracking) { write_nic_dword(dev, rCCK0_TxFilter1, 0x35360000); @@ -1225,12 +1224,12 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) CCK_Tx_Power_Track_BW_Switch(dev); } - rtl8192_setBBreg(dev, rCCK0_System, bCCKSideBand, - (priv->nCur40MhzPrimeSC>>1)); - rtl8192_setBBreg(dev, rOFDM1_LSTF, 0xC00, - priv->nCur40MhzPrimeSC); + rtl92e_set_bb_reg(dev, rCCK0_System, bCCKSideBand, + (priv->nCur40MhzPrimeSC>>1)); + rtl92e_set_bb_reg(dev, rOFDM1_LSTF, 0xC00, + priv->nCur40MhzPrimeSC); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); break; default: netdev_err(dev, "%s(): unknown Bandwidth: %#X\n", __func__, @@ -1307,7 +1306,7 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation) BitMask = bMaskByte0; if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8); priv->initgain_backup.xaagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XAAGCCore1, BitMask); @@ -1356,18 +1355,18 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation) BitMask = 0x7f; if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8); - rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, BitMask, + rtl92e_set_bb_reg(dev, rOFDM0_XAAGCCore1, BitMask, (u32)priv->initgain_backup.xaagccore1); - rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, BitMask, + rtl92e_set_bb_reg(dev, rOFDM0_XBAGCCore1, BitMask, (u32)priv->initgain_backup.xbagccore1); - rtl8192_setBBreg(dev, rOFDM0_XCAGCCore1, BitMask, + rtl92e_set_bb_reg(dev, rOFDM0_XCAGCCore1, BitMask, (u32)priv->initgain_backup.xcagccore1); - rtl8192_setBBreg(dev, rOFDM0_XDAGCCore1, BitMask, + rtl92e_set_bb_reg(dev, rOFDM0_XDAGCCore1, BitMask, (u32)priv->initgain_backup.xdagccore1); BitMask = bMaskByte2; - rtl8192_setBBreg(dev, rCCK0_CCA, BitMask, + rtl92e_set_bb_reg(dev, rCCK0_CCA, BitMask, (u32)priv->initgain_backup.cca); RT_TRACE(COMP_SCAN, @@ -1391,7 +1390,7 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation) if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x1); break; default: RT_TRACE(COMP_SCAN, "Unknown IG Operation.\n"); @@ -1403,13 +1402,13 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation) void rtl92e_set_rf_off(struct net_device *dev) { - rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x0); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x18, 0x0); - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0x0); - rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0x0); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x0); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x4, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x18, 0x0); + rtl92e_set_bb_reg(dev, rOFDM0_TRxPathEnable, 0xf, 0x0); + rtl92e_set_bb_reg(dev, rOFDM1_TRxPathEnable, 0xf, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x60, 0x0); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x4, 0x0); write_nic_byte(dev, ANAPAR_FOR_8192PciE, 0x07); } @@ -1458,22 +1457,22 @@ static bool SetRFPowerState8190(struct net_device *dev, } else { write_nic_byte(dev, ANAPAR, 0x37); mdelay(1); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x4, 0x1); priv->bHwRfOffAction = 0; - rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, - BIT4, 0x1); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, - 0x300, 0x3); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, - 0x18, 0x3); - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x3, - 0x3); - rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x3, - 0x3); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, - 0x60, 0x3); + rtl92e_set_bb_reg(dev, rFPGA0_XA_RFInterfaceOE, + BIT4, 0x1); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, + 0x300, 0x3); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, + 0x18, 0x3); + rtl92e_set_bb_reg(dev, rOFDM0_TRxPathEnable, + 0x3, 0x3); + rtl92e_set_bb_reg(dev, rOFDM1_TRxPathEnable, + 0x3, 0x3); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, + 0x60, 0x3); } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 7a147ecfb2d5..1d961cfa51c0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -68,8 +68,8 @@ enum rf90_radio_path { #define bMaskDWord 0xffffffff extern u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath); -extern void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, - u32 dwBitMask, u32 dwData); +extern void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, + u32 dwBitMask, u32 dwData); extern u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask); extern void rtl92e_set_rf_reg(struct net_device *dev, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 2137252a5267..e967ba0a88ef 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -561,40 +561,40 @@ static void dm_tx_update_tssi_weak_signal(struct net_device *dev, u8 RF_Type) p->rfa_txpowertrackingindex--; if (p->rfa_txpowertrackingindex_real > 4) { p->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); } p->rfc_txpowertrackingindex--; if (p->rfc_txpowertrackingindex_real > 4) { p->rfc_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]); + rtl92e_set_bb_reg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]); } } else { - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[4]); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, dm_tx_bb_gain[4]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[4]); + rtl92e_set_bb_reg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, dm_tx_bb_gain[4]); } } else { if (p->rfa_txpowertrackingindex > 0) { p->rfa_txpowertrackingindex--; if (p->rfa_txpowertrackingindex_real > 4) { p->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); + rtl92e_set_bb_reg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); } } else { - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, dm_tx_bb_gain[4]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, dm_tx_bb_gain[4]); } } } @@ -608,36 +608,33 @@ static void dm_tx_update_tssi_strong_signal(struct net_device *dev, u8 RF_Type) (p->rfc_txpowertrackingindex < TxBBGainTableLength - 1)) { p->rfa_txpowertrackingindex++; p->rfa_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); p->rfc_txpowertrackingindex++; p->rfc_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]); + rtl92e_set_bb_reg(dev, rOFDM0_XCTxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]); } else { - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[TxBBGainTableLength - 1]); - rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[TxBBGainTableLength - 1]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[TxBBGainTableLength - 1]); + rtl92e_set_bb_reg(dev, rOFDM0_XCTxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[TxBBGainTableLength - 1]); } } else { if (p->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { p->rfa_txpowertrackingindex++; p->rfa_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); } else { - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[TxBBGainTableLength - 1]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[TxBBGainTableLength - 1]); } } } @@ -941,8 +938,8 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); if (priv->OFDM_index[0] != tmpOFDMindex) { priv->OFDM_index[0] = tmpOFDMindex; - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, - OFDMSwingTable[priv->OFDM_index[0]]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, + OFDMSwingTable[priv->OFDM_index[0]]); RT_TRACE(COMP_POWER_TRACKING, "Update OFDMSwing[%d] = 0x%x\n", priv->OFDM_index[0], OFDMSwingTable[priv->OFDM_index[0]]); @@ -1073,30 +1070,30 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) TempVal = (u32)(dm_cck_tx_bb_gain[attenuation][0] + (dm_cck_tx_bb_gain[attenuation][1] << 8)); - rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); TempVal = (u32)((dm_cck_tx_bb_gain[attenuation][2]) + (dm_cck_tx_bb_gain[attenuation][3] << 8) + (dm_cck_tx_bb_gain[attenuation][4] << 16)+ (dm_cck_tx_bb_gain[attenuation][5] << 24)); - rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); TempVal = (u32)(dm_cck_tx_bb_gain[attenuation][6] + (dm_cck_tx_bb_gain[attenuation][7] << 8)); - rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); } else { TempVal = (u32)((dm_cck_tx_bb_gain_ch14[attenuation][0]) + (dm_cck_tx_bb_gain_ch14[attenuation][1] << 8)); - rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); TempVal = (u32)((dm_cck_tx_bb_gain_ch14[attenuation][2]) + (dm_cck_tx_bb_gain_ch14[attenuation][3] << 8) + (dm_cck_tx_bb_gain_ch14[attenuation][4] << 16)+ (dm_cck_tx_bb_gain_ch14[attenuation][5] << 24)); - rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); TempVal = (u32)((dm_cck_tx_bb_gain_ch14[attenuation][6]) + (dm_cck_tx_bb_gain_ch14[attenuation][7] << 8)); - rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); } } @@ -1110,7 +1107,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, if (!bInCH14) { TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1] << 8); - rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter1, TempVal); @@ -1118,14 +1115,14 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, (CCKSwingTable_Ch1_Ch13[priv->CCK_index][3] << 8) + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][4] << 16)+ (CCKSwingTable_Ch1_Ch13[priv->CCK_index][5] << 24); - rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter2, TempVal); TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7] << 8); - rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_DebugPort, TempVal); @@ -1133,20 +1130,20 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] + (CCKSwingTable_Ch14[priv->CCK_index][1] << 8); - rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter1, TempVal); 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); - rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter2, TempVal); TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] + (CCKSwingTable_Ch14[priv->CCK_index][7]<<8); - rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); + rtl92e_set_bb_reg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", rCCK0_DebugPort, TempVal); } @@ -1167,8 +1164,8 @@ static void dm_txpower_reset_recovery(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); RT_TRACE(COMP_POWER_TRACKING, "Start Reset Recovery ==>\n"); - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, - dm_tx_bb_gain[priv->rfa_txpowertrackingindex]); + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, + dm_tx_bb_gain[priv->rfa_txpowertrackingindex]); RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in 0xc80 is %08x\n", dm_tx_bb_gain[priv->rfa_txpowertrackingindex]); RT_TRACE(COMP_POWER_TRACKING, @@ -1182,8 +1179,8 @@ static void dm_txpower_reset_recovery(struct net_device *dev) priv->CCKPresentAttentuation); dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); - rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, - dm_tx_bb_gain[priv->rfc_txpowertrackingindex]); + rtl92e_set_bb_reg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, + dm_tx_bb_gain[priv->rfc_txpowertrackingindex]); RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in 0xc90 is %08x\n", dm_tx_bb_gain[priv->rfc_txpowertrackingindex]); RT_TRACE(COMP_POWER_TRACKING, @@ -1231,18 +1228,18 @@ static void dm_bb_initialgain_restore(struct net_device *dev) if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI) return; - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); - rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, bit_mask, - (u32)priv->initgain_backup.xaagccore1); - rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, bit_mask, - (u32)priv->initgain_backup.xbagccore1); - rtl8192_setBBreg(dev, rOFDM0_XCAGCCore1, bit_mask, - (u32)priv->initgain_backup.xcagccore1); - rtl8192_setBBreg(dev, rOFDM0_XDAGCCore1, bit_mask, - (u32)priv->initgain_backup.xdagccore1); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8); + rtl92e_set_bb_reg(dev, rOFDM0_XAAGCCore1, bit_mask, + (u32)priv->initgain_backup.xaagccore1); + rtl92e_set_bb_reg(dev, rOFDM0_XBAGCCore1, bit_mask, + (u32)priv->initgain_backup.xbagccore1); + rtl92e_set_bb_reg(dev, rOFDM0_XCAGCCore1, bit_mask, + (u32)priv->initgain_backup.xcagccore1); + rtl92e_set_bb_reg(dev, rOFDM0_XDAGCCore1, bit_mask, + (u32)priv->initgain_backup.xdagccore1); bit_mask = bMaskByte2; - rtl8192_setBBreg(dev, rCCK0_CCA, bit_mask, - (u32)priv->initgain_backup.cca); + rtl92e_set_bb_reg(dev, rCCK0_CCA, bit_mask, + (u32)priv->initgain_backup.cca); RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc50 is %x\n", priv->initgain_backup.xaagccore1); @@ -1254,7 +1251,7 @@ static void dm_bb_initialgain_restore(struct net_device *dev) priv->initgain_backup.xdagccore1); RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n", priv->initgain_backup.cca); - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x1); } @@ -1278,7 +1275,7 @@ static void dm_bb_initialgain_backup(struct net_device *dev) if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI) return; - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8); priv->initgain_backup.xaagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XAAGCCore1, bit_mask); priv->initgain_backup.xbagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XBAGCCore1, bit_mask); priv->initgain_backup.xcagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XCAGCCore1, bit_mask); @@ -1375,7 +1372,7 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi( fw_dig = 0; if (fw_dig <= 3) { for (i = 0; i < 3; i++) - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8); fw_dig++; dm_digtable.dig_state = DM_STA_DIG_OFF; } @@ -1409,7 +1406,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( if (dm_digtable.dig_algorithm_switch) { dm_digtable.dig_state = DM_STA_DIG_MAX; for (i = 0; i < 3; i++) - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x1); dm_digtable.dig_algorithm_switch = 0; } @@ -1428,7 +1425,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX; dm_digtable.dig_state = DM_STA_DIG_OFF; - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8); write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x17); write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x17); @@ -1479,7 +1476,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( write_nic_byte(dev, 0xa0a, 0xcd); - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); + rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x1); } dm_ctrl_initgain_byrssi_highpwr(dev); } @@ -2115,10 +2112,10 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev) DM_RxPathSelTable.diff_TH) { DM_RxPathSelTable.rf_enable_rssi_th[min_rssi_index] = tmp_max_rssi+5; - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, - 0x1<>i) & 0x1) { if (tmp_max_rssi >= DM_RxPathSelTable.rf_enable_rssi_th[i]) { - rtl8192_setBBreg(dev, - rOFDM0_TRxPathEnable, 0x1 << i, - 0x1); - rtl8192_setBBreg(dev, - rOFDM1_TRxPathEnable, - 0x1 << i, 0x1); + rtl92e_set_bb_reg(dev, + rOFDM0_TRxPathEnable, + 0x1 << i, 0x1); + rtl92e_set_bb_reg(dev, + rOFDM1_TRxPathEnable, + 0x1 << i, 0x1); DM_RxPathSelTable.rf_enable_rssi_th[i] = 100; disabled_rf_cnt--; From ae924acdaedd0b17b9dc29a3e61814d9cc98fdb0 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:58 +0200 Subject: [PATCH 405/912] staging: rtl8192e: Rename rtl8192_SetBWMode Use naming schema found in other rtlwifi devices. Rename rtl8192_SetBWMode to rtl92e_set_bw_mode. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 7bbbe7be6f60..08eaa951c70b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1264,8 +1264,8 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) RT_TRACE(COMP_SWBW, "<==SetBWMode819xUsb()"); } -void rtl8192_SetBWMode(struct net_device *dev, enum ht_channel_width Bandwidth, - enum ht_extchnl_offset Offset) +void rtl92e_set_bw_mode(struct net_device *dev, enum ht_channel_width Bandwidth, + enum ht_extchnl_offset Offset) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 1d961cfa51c0..ac4d2c94e2c6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -91,9 +91,9 @@ extern u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath); extern u8 rtl92e_set_channel(struct net_device *dev, u8 channel); -extern void rtl8192_SetBWMode(struct net_device *dev, - enum ht_channel_width Bandwidth, - enum ht_extchnl_offset Offset); +extern void rtl92e_set_bw_mode(struct net_device *dev, + enum ht_channel_width Bandwidth, + enum ht_extchnl_offset Offset); extern void rtl92e_init_gain(struct net_device *dev, u8 Operation); extern void rtl92e_set_rf_off(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 99b36f8b5c79..c206e1dc1014 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -876,7 +876,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->handle_beacon = rtl8192_handle_beacon; priv->rtllib->SetWirelessMode = rtl8192_SetWirelessMode; priv->rtllib->LeisurePSLeave = LeisurePSLeave; - priv->rtllib->SetBWModeHandler = rtl8192_SetBWMode; + priv->rtllib->SetBWModeHandler = rtl92e_set_bw_mode; priv->rf_set_chan = rtl92e_set_channel; priv->rtllib->start_send_beacons = rtl92e_start_beacon; From ad8d51615c61cbb257cedfe86b11d13b8c9a08a4 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:27:59 +0200 Subject: [PATCH 406/912] staging: rtl8192e: Rename SetRFPowerState Use naming schema found in other rtlwifi devices. Rename SetRFPowerState to rtl92e_set_rf_power_state. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 +++++++----- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 9 +++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 08eaa951c70b..817cd62f28b8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1580,26 +1580,28 @@ static bool SetRFPowerState8190(struct net_device *dev, return bResult; } -bool SetRFPowerState(struct net_device *dev, - enum rt_rf_power_state eRFPowerState) +bool rtl92e_set_rf_power_state(struct net_device *dev, + enum rt_rf_power_state eRFPowerState) { struct r8192_priv *priv = rtllib_priv(dev); bool bResult = false; - RT_TRACE(COMP_PS, "---------> SetRFPowerState(): eRFPowerState(%d)\n", + RT_TRACE(COMP_PS, + "---------> rtl92e_set_rf_power_state(): eRFPowerState(%d)\n", eRFPowerState); if (eRFPowerState == priv->rtllib->eRFPowerState && priv->bHwRfOffAction == 0) { RT_TRACE(COMP_PS, - "<--------- SetRFPowerState(): discard the request for eRFPowerState(%d) is the same.\n", + "<--------- rtl92e_set_rf_power_state(): discard the request for eRFPowerState(%d) is the same.\n", eRFPowerState); return bResult; } bResult = SetRFPowerState8190(dev, eRFPowerState); - RT_TRACE(COMP_PS, "<--------- SetRFPowerState(): bResult(%d)\n", + RT_TRACE(COMP_PS, + "<--------- rtl92e_set_rf_power_state(): bResult(%d)\n", bResult); return bResult; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index ac4d2c94e2c6..da25cba6aeb6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -98,12 +98,9 @@ extern void rtl92e_init_gain(struct net_device *dev, u8 Operation); extern void rtl92e_set_rf_off(struct net_device *dev); -bool -SetRFPowerState( - struct net_device *dev, - enum rt_rf_power_state eRFPowerState - ); -#define PHY_SetRFPowerState SetRFPowerState +bool rtl92e_set_rf_power_state(struct net_device *dev, + enum rt_rf_power_state eRFPowerState); +#define PHY_SetRFPowerState rtl92e_set_rf_power_state extern void rtl92e_scan_op_backup(struct net_device *dev, u8 Operation); From 358e4ee166b7c7d7550c46b57000cd628c9001de Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:00 +0200 Subject: [PATCH 407/912] staging: rtl8192e: Rename CamResetAllEntry Use naming schema found in other rtlwifi devices. Rename CamResetAllEntry to rtl92e_cam_reset. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_cam.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index b6d26fa4e2ee..c7260ef80b76 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -809,7 +809,7 @@ start: if (priv->ResetProgress == RESET_TYPE_NORESET) rtl8192_SetWirelessMode(dev, priv->rtllib->mode); - CamResetAllEntry(dev); + rtl92e_cam_reset(dev); { u8 SECR_value = 0x0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index f246222e5fc9..4c47dd969254 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -28,7 +28,7 @@ #include "r8190P_rtl8256.h" /* RTL8225 Radio frontend */ #include "r8192E_cmdpkt.h" -void CamResetAllEntry(struct net_device *dev) +void rtl92e_cam_reset(struct net_device *dev) { u32 ulcommand = 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h index f23ab46c77e7..9ef80ec3a672 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h @@ -28,7 +28,7 @@ #include struct net_device; -void CamResetAllEntry(struct net_device *dev); +void rtl92e_cam_reset(struct net_device *dev); void EnableHWSecurityConfig8192(struct net_device *dev); void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index c206e1dc1014..65d6043ffdf2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -824,7 +824,7 @@ static int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) priv->rtllib->wpa_ie_len = 0; kfree(priv->rtllib->wpa_ie); priv->rtllib->wpa_ie = NULL; - CamResetAllEntry(dev); + rtl92e_cam_reset(dev); memset(priv->rtllib->swcamtable, 0, sizeof(struct sw_cam_table) * 32); rtl8192_irq_disable(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 15fc48440cdc..df7cf084a76b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -711,7 +711,7 @@ static int r8192_wx_set_enc(struct net_device *dev, if (wrqu->encoding.flags & IW_ENCODE_DISABLED) { ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA; - CamResetAllEntry(dev); + rtl92e_cam_reset(dev); memset(priv->rtllib->swcamtable, 0, sizeof(struct sw_cam_table) * 32); goto end_hw_sec; @@ -926,7 +926,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, ext->alg == IW_ENCODE_ALG_NONE) { ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA; - CamResetAllEntry(dev); + rtl92e_cam_reset(dev); memset(priv->rtllib->swcamtable, 0, sizeof(struct sw_cam_table) * 32); goto end_hw_sec; From 66497f0223cb23b572e360d32ad5473f618c5e57 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:01 +0200 Subject: [PATCH 408/912] staging: rtl8192e: Rename CamRestoreAllEntry Use naming schema found in other rtlwifi devices. Rename CamRestoreAllEntry to rtl92e_cam_restore. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_cam.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 4c47dd969254..66e06bea21d3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -154,7 +154,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, RT_TRACE(COMP_SEC, "=========>after set key, usconfig:%x\n", usConfig); } -void CamRestoreAllEntry(struct net_device *dev) +void rtl92e_cam_restore(struct net_device *dev) { u8 EntryId = 0; struct r8192_priv *priv = rtllib_priv(dev); @@ -170,7 +170,7 @@ void CamRestoreAllEntry(struct net_device *dev) 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - RT_TRACE(COMP_SEC, "CamRestoreAllEntry:\n"); + RT_TRACE(COMP_SEC, "rtl92e_cam_restore:\n"); if ((priv->rtllib->pairwise_key_type == KEY_TYPE_WEP40) || diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h index 9ef80ec3a672..001ff4021a60 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h @@ -34,6 +34,6 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh); -void CamRestoreAllEntry(struct net_device *dev); +void rtl92e_cam_restore(struct net_device *dev); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 65d6043ffdf2..b12256ce44b4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1376,7 +1376,7 @@ RESET_START: rtl819x_silentreset_mesh_bk(dev, IsPortal); } - CamRestoreAllEntry(dev); + rtl92e_cam_restore(dev); dm_restore_dynamic_mechanism_state(dev); END: priv->ResetProgress = RESET_TYPE_NORESET; From 3742093268faec364254966286b69fa4801bbc01 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:02 +0200 Subject: [PATCH 409/912] staging: rtl8192e: Rename EnableHWSecurityConfig8192 Use naming schema found in other rtlwifi devices. Rename EnableHWSecurityConfig8192 to rtl92e_enable_hw_security_config. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_cam.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index c7260ef80b76..ead3e2208fb7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1001,7 +1001,7 @@ void rtl92e_link_change(struct net_device *dev) priv->ops->update_ratr_table(dev); if ((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) - EnableHWSecurityConfig8192(dev); + rtl92e_enable_hw_security_config(dev); } else { write_nic_byte(dev, 0x173, 0); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 66e06bea21d3..39640dda4acf 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -36,7 +36,7 @@ void rtl92e_cam_reset(struct net_device *dev) write_nic_dword(dev, RWCAM, ulcommand); } -void EnableHWSecurityConfig8192(struct net_device *dev) +void rtl92e_enable_hw_security_config(struct net_device *dev) { u8 SECR_value = 0x0; struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h index 001ff4021a60..b0619b77b1f0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h @@ -29,7 +29,7 @@ struct net_device; void rtl92e_cam_reset(struct net_device *dev); -void EnableHWSecurityConfig8192(struct net_device *dev); +void rtl92e_enable_hw_security_config(struct net_device *dev); void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index b12256ce44b4..df3b846aefa3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1350,7 +1350,7 @@ RESET_START: priv->RFChangeInProgress = false; spin_unlock_irqrestore(&priv->rf_ps_lock, flag); - EnableHWSecurityConfig8192(dev); + rtl92e_enable_hw_security_config(dev); if (ieee->state == RTLLIB_LINKED && ieee->iw_mode == IW_MODE_INFRA) { @@ -2375,7 +2375,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) if (is_zero_ether_addr(ieee->ap_mac_addr)) ieee->iw_mode = IW_MODE_ADHOC; memcpy((u8 *)key, ipw->u.crypt.key, 16); - EnableHWSecurityConfig8192(dev); + rtl92e_enable_hw_security_config(dev); set_swcam(dev, 4, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8 *)ieee->ap_mac_addr, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index df7cf084a76b..4795c727bb5b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -750,12 +750,12 @@ static int r8192_wx_set_enc(struct net_device *dev, } if (wrqu->encoding.length == 0x5) { ieee->pairwise_key_type = KEY_TYPE_WEP40; - EnableHWSecurityConfig8192(dev); + rtl92e_enable_hw_security_config(dev); } else if (wrqu->encoding.length == 0xd) { ieee->pairwise_key_type = KEY_TYPE_WEP104; - EnableHWSecurityConfig8192(dev); + rtl92e_enable_hw_security_config(dev); setKey(dev, key_idx, key_idx, KEY_TYPE_WEP104, zero_addr[key_idx], 0, hwkey); set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104, @@ -943,7 +943,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40)) alg = KEY_TYPE_WEP104; ieee->pairwise_key_type = alg; - EnableHWSecurityConfig8192(dev); + rtl92e_enable_hw_security_config(dev); } memcpy((u8 *)key, ext->key, 16); From 408bd7b7b244c23a78deb41cadbeb070c794da94 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:03 +0200 Subject: [PATCH 410/912] staging: rtl8192e: Rename setKey Use naming schema found in other rtlwifi devices. Rename setKey to rtl92e_set_key. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 84 ++++++++++---------- drivers/staging/rtl8192e/rtl8192e/rtl_cam.h | 5 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 26 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 13 +-- 4 files changed, 68 insertions(+), 60 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 39640dda4acf..8e4da40793bd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -87,8 +87,9 @@ void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, } } -void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, - const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent) +void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex, + u16 KeyType, const u8 *MacAddr, u8 DefaultKey, + u32 *KeyContent) { u32 TargetCommand = 0; u32 TargetContent = 0; @@ -115,7 +116,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, netdev_info(dev, "%s(): Invalid CAM entry\n", __func__); RT_TRACE(COMP_SEC, - "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n", + "====>to rtl92e_set_key(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n", dev, EntryNo, KeyIndex, KeyType, MacAddr); if (DefaultKey) @@ -179,36 +180,41 @@ void rtl92e_cam_restore(struct net_device *dev) for (EntryId = 0; EntryId < 4; EntryId++) { MacAddr = CAM_CONST_ADDR[EntryId]; if (priv->rtllib->swcamtable[EntryId].bused) { - setKey(dev, EntryId, EntryId, - priv->rtllib->pairwise_key_type, MacAddr, - 0, (u32 *)(&priv->rtllib->swcamtable - [EntryId].key_buf[0])); + rtl92e_set_key(dev, EntryId, EntryId, + priv->rtllib->pairwise_key_type, + MacAddr, 0, + (u32 *)(&priv->rtllib->swcamtable + [EntryId].key_buf[0])); } } } else if (priv->rtllib->pairwise_key_type == KEY_TYPE_TKIP) { if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { - setKey(dev, 4, 0, priv->rtllib->pairwise_key_type, - (u8 *)dev->dev_addr, 0, - (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0])); + rtl92e_set_key(dev, 4, 0, + priv->rtllib->pairwise_key_type, + (u8 *)dev->dev_addr, 0, + (u32 *)(&priv->rtllib->swcamtable[4]. + key_buf[0])); } else { - setKey(dev, 4, 0, priv->rtllib->pairwise_key_type, - MacAddr, 0, - (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0])); + rtl92e_set_key(dev, 4, 0, + priv->rtllib->pairwise_key_type, + MacAddr, 0, + (u32 *)(&priv->rtllib->swcamtable[4]. + key_buf[0])); } } else if (priv->rtllib->pairwise_key_type == KEY_TYPE_CCMP) { if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { - setKey(dev, 4, 0, - priv->rtllib->pairwise_key_type, - (u8 *)dev->dev_addr, 0, - (u32 *)(&priv->rtllib->swcamtable[4]. - key_buf[0])); + rtl92e_set_key(dev, 4, 0, + priv->rtllib->pairwise_key_type, + (u8 *)dev->dev_addr, 0, + (u32 *)(&priv->rtllib->swcamtable[4]. + key_buf[0])); } else { - setKey(dev, 4, 0, - priv->rtllib->pairwise_key_type, MacAddr, - 0, (u32 *)(&priv->rtllib->swcamtable[4]. - key_buf[0])); + rtl92e_set_key(dev, 4, 0, + priv->rtllib->pairwise_key_type, MacAddr, + 0, (u32 *)(&priv->rtllib->swcamtable[4]. + key_buf[0])); } } @@ -216,20 +222,18 @@ void rtl92e_cam_restore(struct net_device *dev) MacAddr = CAM_CONST_BROAD; for (EntryId = 1; EntryId < 4; EntryId++) { if (priv->rtllib->swcamtable[EntryId].bused) { - setKey(dev, EntryId, EntryId, - priv->rtllib->group_key_type, - MacAddr, 0, - (u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0]) - ); + rtl92e_set_key(dev, EntryId, EntryId, + priv->rtllib->group_key_type, + MacAddr, 0, + (u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0])); } } if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { if (priv->rtllib->swcamtable[0].bused) { - setKey(dev, 0, 0, - priv->rtllib->group_key_type, - CAM_CONST_ADDR[0], 0, - (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]) - ); + rtl92e_set_key(dev, 0, 0, + priv->rtllib->group_key_type, + CAM_CONST_ADDR[0], 0, + (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])); } else { netdev_warn(dev, "%s(): ADHOC TKIP: missing key entry.\n", @@ -241,19 +245,19 @@ void rtl92e_cam_restore(struct net_device *dev) MacAddr = CAM_CONST_BROAD; for (EntryId = 1; EntryId < 4; EntryId++) { if (priv->rtllib->swcamtable[EntryId].bused) { - setKey(dev, EntryId, EntryId, - priv->rtllib->group_key_type, - MacAddr, 0, - (u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0])); + rtl92e_set_key(dev, EntryId, EntryId, + priv->rtllib->group_key_type, + MacAddr, 0, + (u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0])); } } if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { if (priv->rtllib->swcamtable[0].bused) { - setKey(dev, 0, 0, - priv->rtllib->group_key_type, - CAM_CONST_ADDR[0], 0, - (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])); + rtl92e_set_key(dev, 0, 0, + priv->rtllib->group_key_type, + CAM_CONST_ADDR[0], 0, + (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])); } else { netdev_warn(dev, "%s(): ADHOC CCMP: missing key entry.\n", diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h index b0619b77b1f0..a26f3f5254b5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h @@ -30,8 +30,9 @@ struct net_device; void rtl92e_cam_reset(struct net_device *dev); void rtl92e_enable_hw_security_config(struct net_device *dev); -void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, - const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); +void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex, + u16 KeyType, const u8 *MacAddr, u8 DefaultKey, + u32 *KeyContent); void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh); void rtl92e_cam_restore(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index df3b846aefa3..00f38ebac190 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2380,20 +2380,22 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ieee->pairwise_key_type, (u8 *)ieee->ap_mac_addr, 0, key, 0); - setKey(dev, 4, ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, 0, key); + rtl92e_set_key(dev, 4, ipw->u.crypt.idx, + ieee->pairwise_key_type, + (u8 *)ieee->ap_mac_addr, + 0, key); if (ieee->iw_mode == IW_MODE_ADHOC) { set_swcam(dev, ipw->u.crypt.idx, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8 *)ieee->ap_mac_addr, 0, key, 0); - setKey(dev, ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key); + rtl92e_set_key(dev, + ipw->u.crypt.idx, + ipw->u.crypt.idx, + ieee->pairwise_key_type, + (u8 *)ieee->ap_mac_addr, + 0, key); } } if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) @@ -2422,10 +2424,10 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ipw->u.crypt.idx, ieee->group_key_type, broadcast_addr, 0, key, 0); - setKey(dev, ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->group_key_type, - broadcast_addr, 0, key); + rtl92e_set_key(dev, ipw->u.crypt.idx, + ipw->u.crypt.idx, + ieee->group_key_type, + broadcast_addr, 0, key); } } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 4795c727bb5b..b2a4bf16d8bc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -756,8 +756,8 @@ static int r8192_wx_set_enc(struct net_device *dev, else if (wrqu->encoding.length == 0xd) { ieee->pairwise_key_type = KEY_TYPE_WEP104; rtl92e_enable_hw_security_config(dev); - setKey(dev, key_idx, key_idx, KEY_TYPE_WEP104, - zero_addr[key_idx], 0, hwkey); + rtl92e_set_key(dev, key_idx, key_idx, KEY_TYPE_WEP104, + zero_addr[key_idx], 0, hwkey); set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104, zero_addr[key_idx], 0, hwkey, 0); } else { @@ -950,19 +950,20 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) { if (ext->key_len == 13) ieee->pairwise_key_type = alg = KEY_TYPE_WEP104; - setKey(dev, idx, idx, alg, zero, 0, key); + rtl92e_set_key(dev, idx, idx, alg, zero, 0, key); set_swcam(dev, idx, idx, alg, zero, 0, key, 0); } else if (group) { ieee->group_key_type = alg; - setKey(dev, idx, idx, alg, broadcast_addr, 0, key); + rtl92e_set_key(dev, idx, idx, alg, broadcast_addr, 0, + key); set_swcam(dev, idx, idx, alg, broadcast_addr, 0, key, 0); } else { if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport) write_nic_byte(dev, 0x173, 1); - setKey(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, - 0, key); + rtl92e_set_key(dev, 4, idx, alg, + (u8 *)ieee->ap_mac_addr, 0, key); set_swcam(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, 0, key, 0); } From aae7e72e1d4dce958f5ba26c7037546bd846a89d Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:04 +0200 Subject: [PATCH 411/912] staging: rtl8192e: Rename set_swcam Use naming schema found in other rtlwifi devices. Rename set_swcam to rtl92e_set_swcam. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 5 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_cam.h | 5 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 29 +++++++++++--------- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 14 +++++----- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 8e4da40793bd..9c14286146a2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -68,8 +68,9 @@ void rtl92e_enable_hw_security_config(struct net_device *dev) write_nic_byte(dev, SECR, SECR_value); } -void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, - const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh) +void rtl92e_set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, + u16 KeyType, const u8 *MacAddr, u8 DefaultKey, + u32 *KeyContent, u8 is_mesh) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h index a26f3f5254b5..9ef8b36fc6b5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h @@ -33,8 +33,9 @@ void rtl92e_enable_hw_security_config(struct net_device *dev); void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); -void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, - const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh); +void rtl92e_set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, + u16 KeyType, const u8 *MacAddr, u8 DefaultKey, + u32 *KeyContent, u8 is_mesh); void rtl92e_cam_restore(struct net_device *dev); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 00f38ebac190..2a34e4d2e3ff 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2376,20 +2376,22 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ieee->iw_mode = IW_MODE_ADHOC; memcpy((u8 *)key, ipw->u.crypt.key, 16); rtl92e_enable_hw_security_config(dev); - set_swcam(dev, 4, ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key, 0); + rtl92e_set_swcam(dev, 4, + ipw->u.crypt.idx, + ieee->pairwise_key_type, + (u8 *)ieee->ap_mac_addr, + 0, key, 0); rtl92e_set_key(dev, 4, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8 *)ieee->ap_mac_addr, 0, key); if (ieee->iw_mode == IW_MODE_ADHOC) { - set_swcam(dev, ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key, 0); + rtl92e_set_swcam(dev, + ipw->u.crypt.idx, + ipw->u.crypt.idx, + ieee->pairwise_key_type, + (u8 *)ieee->ap_mac_addr, + 0, key, 0); rtl92e_set_key(dev, ipw->u.crypt.idx, ipw->u.crypt.idx, @@ -2420,10 +2422,11 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ieee->group_key_type = KEY_TYPE_NA; if (ieee->group_key_type) { - set_swcam(dev, ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->group_key_type, - broadcast_addr, 0, key, 0); + rtl92e_set_swcam(dev, ipw->u.crypt.idx, + ipw->u.crypt.idx, + ieee->group_key_type, + broadcast_addr, 0, key, + 0); rtl92e_set_key(dev, ipw->u.crypt.idx, ipw->u.crypt.idx, ieee->group_key_type, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index b2a4bf16d8bc..1b29f14dd2b2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -758,8 +758,8 @@ static int r8192_wx_set_enc(struct net_device *dev, rtl92e_enable_hw_security_config(dev); rtl92e_set_key(dev, key_idx, key_idx, KEY_TYPE_WEP104, zero_addr[key_idx], 0, hwkey); - set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104, - zero_addr[key_idx], 0, hwkey, 0); + rtl92e_set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104, + zero_addr[key_idx], 0, hwkey, 0); } else { netdev_info(dev, "wrong type in WEP, not WEP40 and WEP104\n"); @@ -951,21 +951,21 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, if (ext->key_len == 13) ieee->pairwise_key_type = alg = KEY_TYPE_WEP104; rtl92e_set_key(dev, idx, idx, alg, zero, 0, key); - set_swcam(dev, idx, idx, alg, zero, 0, key, 0); + rtl92e_set_swcam(dev, idx, idx, alg, zero, 0, key, 0); } else if (group) { ieee->group_key_type = alg; rtl92e_set_key(dev, idx, idx, alg, broadcast_addr, 0, key); - set_swcam(dev, idx, idx, alg, broadcast_addr, 0, - key, 0); + rtl92e_set_swcam(dev, idx, idx, alg, broadcast_addr, 0, + key, 0); } else { if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport) write_nic_byte(dev, 0x173, 1); rtl92e_set_key(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, 0, key); - set_swcam(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, - 0, key, 0); + rtl92e_set_swcam(dev, 4, idx, alg, + (u8 *)ieee->ap_mac_addr, 0, key, 0); } From a643d927c2ec9210d07b8e9aa20d598675dc2aef Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:05 +0200 Subject: [PATCH 412/912] staging: rtl8192e: Rename check_rfctrl_gpio_timer Use naming schema found in other rtlwifi devices. Rename check_rfctrl_gpio_timer to rtl92e_check_rfctrl_gpio_timer. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 8 ++++---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 2a34e4d2e3ff..035946dd09b0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -783,7 +783,7 @@ static int _rtl8192_sta_up(struct net_device *dev, bool is_silent_reset) priv->bfirst_init = false; if (priv->polling_timer_on == 0) - check_rfctrl_gpio_timer((unsigned long)dev); + rtl92e_check_rfctrl_gpio_timer((unsigned long)dev); if (priv->rtllib->state != RTLLIB_LINKED) rtllib_softmac_start_protocol(priv->rtllib, 0); @@ -1099,7 +1099,7 @@ static short rtl8192_init(struct net_device *dev) (unsigned long) dev); setup_timer(&priv->gpio_polling_timer, - check_rfctrl_gpio_timer, + rtl92e_check_rfctrl_gpio_timer, (unsigned long)dev); rtl8192_irq_disable(dev); @@ -2713,7 +2713,7 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, RT_TRACE(COMP_INIT, "dev name: %s\n", dev->name); if (priv->polling_timer_on == 0) - check_rfctrl_gpio_timer((unsigned long)dev); + rtl92e_check_rfctrl_gpio_timer((unsigned long)dev); RT_TRACE(COMP_INIT, "Driver probe completed\n"); return 0; @@ -2843,7 +2843,7 @@ static void __exit rtl8192_pci_module_exit(void) RT_TRACE(COMP_DOWN, "Exiting"); } -void check_rfctrl_gpio_timer(unsigned long data) +void rtl92e_check_rfctrl_gpio_timer(unsigned long data) { struct r8192_priv *priv = rtllib_priv((struct net_device *)data); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 26e54e41ced6..95dad7d6dbe1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -593,7 +593,7 @@ void rtl8192_tx_enable(struct net_device *); void rtl8192_hw_sleep_wq(void *data); void rtl8192_commit(struct net_device *dev); -void check_rfctrl_gpio_timer(unsigned long data); +void rtl92e_check_rfctrl_gpio_timer(unsigned long data); void rtl8192_hw_wakeup_wq(void *data); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index e4908672421c..297a28b6057a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -95,7 +95,7 @@ int rtl8192E_resume(struct pci_dev *pdev) pci_enable_wake(pdev, PCI_D0, 0); if (priv->polling_timer_on == 0) - check_rfctrl_gpio_timer((unsigned long)dev); + rtl92e_check_rfctrl_gpio_timer((unsigned long)dev); if (!netif_running(dev)) { netdev_info(dev, From f434f9d5c60825f3a426a9ac5c5222b0eab8c82d Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:06 +0200 Subject: [PATCH 413/912] staging: rtl8192e: Rename MgntActSet_RF_State Use naming schema found in other rtlwifi devices. Rename MgntActSet_RF_State to rtl92e_set_rf_state. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 16 ++++++++-------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index ead3e2208fb7..38c3ed6165de 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -881,18 +881,18 @@ start: RT_TRACE((COMP_INIT | COMP_RF | COMP_POWER), "%s(): Turn off RF for RegRfOff ----------\n", __func__); - MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_SW, true); + rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_SW, true); } else if (priv->rtllib->RfOffReason > RF_CHANGE_BY_PS) { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for RfOffReason(%d) ----------\n", __func__, priv->rtllib->RfOffReason); - MgntActSet_RF_State(dev, eRfOff, priv->rtllib->RfOffReason, + rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason, true); } else if (priv->rtllib->RfOffReason >= RF_CHANGE_BY_IPS) { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for RfOffReason(%d) ----------\n", __func__, priv->rtllib->RfOffReason); - MgntActSet_RF_State(dev, eRfOff, priv->rtllib->RfOffReason, + rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason, true); } else { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): RF-ON\n", diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 035946dd09b0..5a0217128e8d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -149,7 +149,7 @@ void write_nic_word(struct net_device *dev, int x, u16 y) /**************************************************************************** -----------------------------GENERAL FUNCTION------------------------- *****************************************************************************/ -bool MgntActSet_RF_State(struct net_device *dev, +bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state StateToSet, RT_RF_CHANGE_SOURCE ChangeSource, bool ProtectOrNot) @@ -163,7 +163,7 @@ bool MgntActSet_RF_State(struct net_device *dev, unsigned long flag; RT_TRACE((COMP_PS | COMP_RF), - "===>MgntActSet_RF_State(): StateToSet(%d)\n", StateToSet); + "===>rtl92e_set_rf_state(): StateToSet(%d)\n", StateToSet); ProtectOrNot = false; @@ -174,13 +174,13 @@ bool MgntActSet_RF_State(struct net_device *dev, if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock, flag); RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State(): RF Change in progress! Wait to set..StateToSet(%d).\n", + "rtl92e_set_rf_state(): RF Change in progress! Wait to set..StateToSet(%d).\n", StateToSet); while (priv->RFChangeInProgress) { RFWaitCounter++; RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State(): Wait 1 ms (%d times)...\n", + "rtl92e_set_rf_state(): Wait 1 ms (%d times)...\n", RFWaitCounter); mdelay(1); @@ -218,7 +218,7 @@ bool MgntActSet_RF_State(struct net_device *dev, bConnectBySSID = true; } else { RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State - eRfon reject pMgntInfo->RfOffReason= 0x%x, ChangeSource=0x%X\n", + "rtl92e_set_rf_state - eRfon reject pMgntInfo->RfOffReason= 0x%x, ChangeSource=0x%X\n", priv->rtllib->RfOffReason, ChangeSource); } @@ -255,7 +255,7 @@ bool MgntActSet_RF_State(struct net_device *dev, if (bActionAllowed) { RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State(): Action is allowed.... StateToSet(%d), RfOffReason(%#X)\n", + "rtl92e_set_rf_state(): Action is allowed.... StateToSet(%d), RfOffReason(%#X)\n", StateToSet, priv->rtllib->RfOffReason); PHY_SetRFPowerState(dev, StateToSet); if (StateToSet == eRfOn) { @@ -268,7 +268,7 @@ bool MgntActSet_RF_State(struct net_device *dev, } } else { RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State(): Action is rejected.... StateToSet(%d), ChangeSource(%#X), RfOffReason(%#X)\n", + "rtl92e_set_rf_state(): Action is rejected.... StateToSet(%d), ChangeSource(%#X), RfOffReason(%#X)\n", StateToSet, ChangeSource, priv->rtllib->RfOffReason); } @@ -278,7 +278,7 @@ bool MgntActSet_RF_State(struct net_device *dev, spin_unlock_irqrestore(&priv->rf_ps_lock, flag); } - RT_TRACE((COMP_PS | COMP_RF), "<===MgntActSet_RF_State()\n"); + RT_TRACE((COMP_PS | COMP_RF), "<===rtl92e_set_rf_state()\n"); return bActionAllowed; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 95dad7d6dbe1..622ce202842a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -617,7 +617,7 @@ void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats *psrc_stats, bool NicIFEnableNIC(struct net_device *dev); bool NicIFDisableNIC(struct net_device *dev); -bool MgntActSet_RF_State(struct net_device *dev, +bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state StateToSet, RT_RF_CHANGE_SOURCE ChangeSource, bool ProtectOrNot); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index e967ba0a88ef..d993ec7a51de 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1892,7 +1892,7 @@ static void dm_CheckRfCtrlGPIO(void *data) if (bActuallySet) { mdelay(1000); priv->bHwRfOffAction = 1; - MgntActSet_RF_State(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW, + rtl92e_set_rf_state(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW, true); if (priv->bHwRadioOff) argv[1] = "RFOFF"; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index 297a28b6057a..c92d6df135fc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -45,7 +45,7 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) netif_device_detach(dev); if (!priv->rtllib->bSupportRemoteWakeUp) { - MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT, true); + rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_INIT, true); ulRegRead = read_nic_dword(dev, CPU_GEN); ulRegRead |= CPU_GEN_SYSTEM_RESET; write_nic_dword(dev, CPU_GEN, ulRegRead); @@ -108,7 +108,7 @@ int rtl8192E_resume(struct pci_dev *pdev) dev->netdev_ops->ndo_open(dev); if (!priv->rtllib->bSupportRemoteWakeUp) - MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT, true); + rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_INIT, true); out: RT_TRACE(COMP_POWER, "<================r8192E resume call.\n"); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 404cb83153d9..fc4503f2a82e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -45,7 +45,7 @@ static void rtl8192_hw_sleep_down(struct net_device *dev) spin_unlock_irqrestore(&priv->rf_ps_lock, flags); RT_TRACE(COMP_DBG, "%s()============>come to sleep down\n", __func__); - MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS, false); + rtl92e_set_rf_state(dev, eRfSleep, RF_CHANGE_BY_PS, false); } void rtl8192_hw_sleep_wq(void *data) @@ -74,7 +74,7 @@ void rtl8192_hw_wakeup(struct net_device *dev) } spin_unlock_irqrestore(&priv->rf_ps_lock, flags); RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __func__); - MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS, false); + rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_PS, false); } void rtl8192_hw_wakeup_wq(void *data) @@ -133,7 +133,7 @@ static void InactivePsWorkItemCallback(struct net_device *dev) RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n", pPSC->eInactivePowerState == eRfOff ? "OFF" : "ON"); - MgntActSet_RF_State(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS, + rtl92e_set_rf_state(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS, false); pPSC->bSwRfProcessing = false; From af002dc63731fb8f31bdac5b53af80bec4a3f776 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:07 +0200 Subject: [PATCH 414/912] staging: rtl8192e: Rename NicIFDisableNIC Use naming schema found in other rtlwifi devices. Rename NicIFDisableNIC to rtl92e_disable_nic. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 817cd62f28b8..a8c62b040d9d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1537,7 +1537,7 @@ static bool SetRFPowerState8190(struct net_device *dev, if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC && !RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC)) { - NicIFDisableNIC(dev); + rtl92e_disable_nic(dev); RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC); } else if (!(pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC)) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 5a0217128e8d..9a10a48d1757 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2805,7 +2805,7 @@ bool NicIFEnableNIC(struct net_device *dev) RT_TRACE(COMP_PS, "<===========%s()\n", __func__); return init_status; } -bool NicIFDisableNIC(struct net_device *dev) +bool rtl92e_disable_nic(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); u8 tmp_state = 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 622ce202842a..788170f8913f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -615,7 +615,7 @@ u8 rtl819x_query_rxpwrpercentage(char antpower); void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats *psrc_stats, struct rtllib_rx_stats *ptarget_stats); bool NicIFEnableNIC(struct net_device *dev); -bool NicIFDisableNIC(struct net_device *dev); +bool rtl92e_disable_nic(struct net_device *dev); bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state StateToSet, From 502bd1d7c35fad9ab3806f2b6597fa92a2f6c132 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:08 +0200 Subject: [PATCH 415/912] staging: rtl8192e: Rename NicIFEnableNIC Use naming schema found in other rtlwifi devices. Rename NicIFEnableNIC to rtl92e_enable_nic. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index a8c62b040d9d..3efa84d89955 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1441,7 +1441,7 @@ static bool SetRFPowerState8190(struct net_device *dev, do { InitilizeCount--; priv->RegRfOff = false; - rtstatus = NicIFEnableNIC(dev); + rtstatus = rtl92e_enable_nic(dev); } while (!rtstatus && (InitilizeCount > 0)); if (!rtstatus) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 9a10a48d1757..a1b6e1db4dd7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2775,7 +2775,7 @@ static void rtl8192_pci_disconnect(struct pci_dev *pdev) RT_TRACE(COMP_DOWN, "wlan driver removed\n"); } -bool NicIFEnableNIC(struct net_device *dev) +bool rtl92e_enable_nic(struct net_device *dev) { bool init_status = true; struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 788170f8913f..ce71270a62d4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -614,7 +614,7 @@ u8 rtl819x_evm_dbtopercentage(char value); u8 rtl819x_query_rxpwrpercentage(char antpower); void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats *psrc_stats, struct rtllib_rx_stats *ptarget_stats); -bool NicIFEnableNIC(struct net_device *dev); +bool rtl92e_enable_nic(struct net_device *dev); bool rtl92e_disable_nic(struct net_device *dev); bool rtl92e_set_rf_state(struct net_device *dev, From b59a4ca3d4421866cc7f49135ab6f7b7c84fdb48 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:09 +0200 Subject: [PATCH 416/912] staging: rtl8192e: Rename read_nic_byte Use naming schema found in other rtlwifi devices. Rename read_nic_byte to rtl92e_readb. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 14 ++++++------ .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 14 ++++++------ drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 22 +++++++++---------- .../staging/rtl8192e/rtl8192e/rtl_eeprom.c | 14 ++++++------ 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 38c3ed6165de..93c44b160b3e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -63,7 +63,7 @@ static void rtl8192e_update_msr(struct net_device *dev) u8 msr; enum led_ctl_mode LedAction = LED_CTL_NO_LINK; - msr = read_nic_byte(dev, MSR); + msr = rtl92e_readb(dev, MSR); msr &= ~MSR_LINK_MASK; switch (priv->rtllib->iw_mode) { @@ -109,7 +109,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) { enum rt_op_mode OpMode = *((enum rt_op_mode *)(val)); enum led_ctl_mode LedAction = LED_CTL_NO_LINK; - u8 btMsr = read_nic_byte(dev, MSR); + u8 btMsr = rtl92e_readb(dev, MSR); btMsr &= 0xfc; @@ -241,7 +241,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) union aci_aifsn *pAciAifsn = (union aci_aifsn *) & (qos_parameters->aifs[0]); u8 acm = pAciAifsn->f.acm; - u8 AcmCtrl = read_nic_byte(dev, AcmHwCtrl); + u8 AcmCtrl = rtl92e_readb(dev, AcmHwCtrl); RT_TRACE(COMP_DBG, "===========>%s():HW_VAR_ACM_CTRL:%x\n", __func__, eACI); @@ -693,7 +693,7 @@ static void rtl8192_hwconfig(struct net_device *dev) write_nic_dword(dev, RATR0, ratr_value); write_nic_byte(dev, UFWP, 1); } - regTmp = read_nic_byte(dev, 0x313); + regTmp = rtl92e_readb(dev, 0x313); regRRSR = ((regTmp) << 24) | (regRRSR & 0x00ffffff); write_nic_dword(dev, RRSR, regRRSR); @@ -740,9 +740,9 @@ start: write_nic_dword(dev, CPU_GEN, ulRegRead); - ICVersion = read_nic_byte(dev, IC_VERRSION); + ICVersion = rtl92e_readb(dev, IC_VERRSION); if (ICVersion >= 0x4) { - SwitchingRegulatorOutput = read_nic_byte(dev, SWREGULATOR); + SwitchingRegulatorOutput = rtl92e_readb(dev, SWREGULATOR); if (SwitchingRegulatorOutput != 0xb8) { write_nic_byte(dev, SWREGULATOR, 0xa8); mdelay(1); @@ -835,7 +835,7 @@ start: rtl92e_set_tx_power(dev, priv->chan); } - tmpvalue = read_nic_byte(dev, IC_VERRSION); + tmpvalue = rtl92e_readb(dev, IC_VERRSION); priv->IC_Cut = tmpvalue; RT_TRACE(COMP_INIT, "priv->IC_Cut= 0x%x\n", priv->IC_Cut); if (priv->IC_Cut >= IC_VersionCut_D) { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 3efa84d89955..74c06929118e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -552,7 +552,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) u8 bRegValue = 0, eCheckItem = 0; u32 dwRegValue = 0; - bRegValue = read_nic_byte(dev, BB_GLOBAL_RESET); + bRegValue = rtl92e_readb(dev, BB_GLOBAL_RESET); write_nic_byte(dev, BB_GLOBAL_RESET, (bRegValue|BB_GLOBAL_RESET_BIT)); dwRegValue = read_nic_dword(dev, CPU_GEN); @@ -619,16 +619,16 @@ void rtl92e_get_tx_power(struct net_device *dev) priv->MCSTxPowerLevelOriginalOffset[5] = read_nic_dword(dev, rTxAGC_Mcs15_Mcs12); - priv->DefaultInitialGain[0] = read_nic_byte(dev, rOFDM0_XAAGCCore1); - priv->DefaultInitialGain[1] = read_nic_byte(dev, rOFDM0_XBAGCCore1); - priv->DefaultInitialGain[2] = read_nic_byte(dev, rOFDM0_XCAGCCore1); - priv->DefaultInitialGain[3] = read_nic_byte(dev, rOFDM0_XDAGCCore1); + priv->DefaultInitialGain[0] = rtl92e_readb(dev, rOFDM0_XAAGCCore1); + priv->DefaultInitialGain[1] = rtl92e_readb(dev, rOFDM0_XBAGCCore1); + priv->DefaultInitialGain[2] = rtl92e_readb(dev, rOFDM0_XCAGCCore1); + priv->DefaultInitialGain[3] = rtl92e_readb(dev, rOFDM0_XDAGCCore1); RT_TRACE(COMP_INIT, "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n", priv->DefaultInitialGain[0], priv->DefaultInitialGain[1], priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]); - priv->framesync = read_nic_byte(dev, rOFDM0_RxDetector3); + priv->framesync = rtl92e_readb(dev, rOFDM0_RxDetector3); priv->framesyncC34 = read_nic_dword(dev, rOFDM0_RxDetector2); RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x\n", rOFDM0_RxDetector3, priv->framesync); @@ -1177,7 +1177,7 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) netdev_err(dev, "%s(): Driver is not initialized\n", __func__); return; } - regBwOpMode = read_nic_byte(dev, BW_OPMODE); + regBwOpMode = rtl92e_readb(dev, BW_OPMODE); switch (priv->CurrentChannelBW) { case HT_CHANNEL_WIDTH_20: diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index a1b6e1db4dd7..6460402fa98a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -110,7 +110,7 @@ static void rtl8192_restart(void *data); -----------------------------IO STUFF------------------------- *****************************************************************************/ -u8 read_nic_byte(struct net_device *dev, int x) +u8 rtl92e_readb(struct net_device *dev, int x) { return 0xff & readb((u8 __iomem *)dev->mem_start + x); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index ce71270a62d4..3e6d0a5e9155 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -578,7 +578,7 @@ struct r8192_priv { extern const struct ethtool_ops rtl819x_ethtool_ops; -u8 read_nic_byte(struct net_device *dev, int x); +u8 rtl92e_readb(struct net_device *dev, int x); u32 read_nic_dword(struct net_device *dev, int x); u16 read_nic_word(struct net_device *dev, int x); void write_nic_byte(struct net_device *dev, int x, u8 y); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index d993ec7a51de..08af7f621930 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -675,7 +675,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) sizeof(struct dcmd_txcmd)); mdelay(1); for (i = 0; i <= 30; i++) { - Pwr_Flag = read_nic_byte(dev, Pw_Track_Flag); + Pwr_Flag = rtl92e_readb(dev, Pw_Track_Flag); if (Pwr_Flag == 0) { mdelay(1); @@ -708,10 +708,10 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) for (k = 0; k < 5; k++) { if (k != 4) - tmp_report[k] = read_nic_byte(dev, + tmp_report[k] = rtl92e_readb(dev, Tssi_Report_Value1+k); else - tmp_report[k] = read_nic_byte(dev, + tmp_report[k] = rtl92e_readb(dev, Tssi_Report_Value2); RT_TRACE(COMP_POWER_TRACKING, @@ -1001,7 +1001,7 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev) static u32 tx_power_track_counter; RT_TRACE(COMP_POWER_TRACKING, "%s()\n", __func__); - if (read_nic_byte(dev, 0x11e) == 1) + if (rtl92e_readb(dev, 0x11e) == 1) return; if (!priv->btxpower_tracking) return; @@ -1564,7 +1564,7 @@ static void dm_initial_gain(struct net_device *dev) reset_cnt = priv->reset_count; } - if (dm_digtable.pre_ig_value != read_nic_byte(dev, rOFDM0_XAAGCCore1)) + if (dm_digtable.pre_ig_value != rtl92e_readb(dev, rOFDM0_XAAGCCore1)) force_write = 1; if ((dm_digtable.pre_ig_value != dm_digtable.cur_ig_value) @@ -1873,7 +1873,7 @@ static void dm_CheckRfCtrlGPIO(void *data) return; } - tmp1byte = read_nic_byte(dev, GPI); + tmp1byte = rtl92e_readb(dev, GPI); eRfPowerStateToSet = (tmp1byte&BIT1) ? eRfOn : eRfOff; @@ -1913,7 +1913,7 @@ void dm_rf_pathcheck_workitemcallback(void *data) struct net_device *dev = priv->rtllib->dev; u8 rfpath = 0, i; - rfpath = read_nic_byte(dev, 0xc04); + rfpath = rtl92e_readb(dev, 0xc04); for (i = 0; i < RF90_PATH_MAX; i++) { if (rfpath & (0x01<rtllib->mode == WIRELESS_MODE_B) DM_RxPathSelTable.cck_method = CCK_Rx_Version_2; @@ -2564,10 +2564,10 @@ static void dm_check_txrateandretrycount(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; - ieee->softmac_stats.CurrentShowTxate = read_nic_byte(dev, + ieee->softmac_stats.CurrentShowTxate = rtl92e_readb(dev, Current_Tx_Rate_Reg); - ieee->softmac_stats.last_packet_rate = read_nic_byte(dev, + ieee->softmac_stats.last_packet_rate = rtl92e_readb(dev, Initial_Tx_Rate_Reg); ieee->softmac_stats.txretrycount = read_nic_dword(dev, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c index a6778e0853c7..61d462063fa7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c @@ -30,9 +30,9 @@ static void eprom_cs(struct net_device *dev, short bit) if (bit) write_nic_byte(dev, EPROM_CMD, (1 << EPROM_CS_SHIFT) | - read_nic_byte(dev, EPROM_CMD)); + rtl92e_readb(dev, EPROM_CMD)); else - write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev, EPROM_CMD) + write_nic_byte(dev, EPROM_CMD, rtl92e_readb(dev, EPROM_CMD) & ~(1< Date: Sun, 19 Jul 2015 19:28:10 +0200 Subject: [PATCH 417/912] staging: rtl8192e: Rename read_nic_dword Use naming schema found in other rtlwifi devices. Rename read_nic_dword to rtl92e_readl. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 20 ++++++------ .../rtl8192e/rtl8192e/r8192E_firmware.c | 8 ++--- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 32 +++++++++---------- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 +-- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 2 +- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 93c44b160b3e..4fa5f303ae36 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -143,7 +143,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) u32 RegRCR, Type; Type = ((u8 *)(val))[0]; - RegRCR = read_nic_dword(dev, RCR); + RegRCR = rtl92e_readl(dev, RCR); priv->ReceiveConfig = RegRCR; if (Type == true) @@ -631,7 +631,7 @@ void rtl92e_get_eeprom_size(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); RT_TRACE(COMP_INIT, "===========>%s()\n", __func__); - curCR = read_nic_dword(dev, EPROM_CMD); + curCR = rtl92e_readl(dev, EPROM_CMD); RT_TRACE(COMP_INIT, "read from Reg Cmd9346CR(%x):%x\n", EPROM_CMD, curCR); priv->epromtype = (curCR & EPROM_CMD_9356SEL) ? EEPROM_93C56 : @@ -729,7 +729,7 @@ start: if (priv->RegRfOff) priv->rtllib->eRFPowerState = eRfOff; - ulRegRead = read_nic_dword(dev, CPU_GEN); + ulRegRead = rtl92e_readl(dev, CPU_GEN); if (priv->pFirmware->firmware_status == FW_STATUS_0_INIT) ulRegRead |= CPU_GEN_SYSTEM_RESET; else if (priv->pFirmware->firmware_status == FW_STATUS_5_READY) @@ -759,7 +759,7 @@ start: priv->LoopbackMode = RTL819X_NO_LOOPBACK; if (priv->ResetProgress == RESET_TYPE_NORESET) { - ulRegRead = read_nic_dword(dev, CPU_GEN); + ulRegRead = rtl92e_readl(dev, CPU_GEN); if (priv->LoopbackMode == RTL819X_NO_LOOPBACK) ulRegRead = ((ulRegRead & CPU_GEN_NO_LOOPBACK_MSK) | CPU_GEN_NO_LOOPBACK_SET); @@ -800,7 +800,7 @@ start: rtl8192_tx_enable(dev); rtl8192_rx_enable(dev); - ulRegRead = (0xFFF00000 & read_nic_dword(dev, RRSR)) | + ulRegRead = (0xFFF00000 & rtl92e_readl(dev, RRSR)) | RATE_ALL_OFDM_AG | RATE_ALL_CCK; write_nic_dword(dev, RRSR, ulRegRead); write_nic_dword(dev, RATR0+4*7, (RATE_ALL_OFDM_AG | RATE_ALL_CCK)); @@ -1010,7 +1010,7 @@ void rtl92e_link_change(struct net_device *dev) if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC) { u32 reg = 0; - reg = read_nic_dword(dev, RCR); + reg = rtl92e_readl(dev, RCR); if (priv->rtllib->state == RTLLIB_LINKED) { if (ieee->IntelPromiscuousModeInfo.bPromiscuousOn) ; @@ -2069,7 +2069,7 @@ bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, (pDrvInfo->FirstAGGR == 1); stats->TimeStampLow = pDrvInfo->TSFL; - stats->TimeStampHigh = read_nic_dword(dev, TSFR+4); + stats->TimeStampHigh = rtl92e_readl(dev, TSFR+4); rtl819x_UpdateRxPktTimeStamp(dev, stats); @@ -2120,7 +2120,7 @@ void rtl92e_stop_adapter(struct net_device *dev, bool reset) if (!priv->rtllib->bSupportRemoteWakeUp) { rtl92e_set_rf_off(dev); - ulRegRead = read_nic_dword(dev, CPU_GEN); + ulRegRead = rtl92e_readl(dev, CPU_GEN); ulRegRead |= CPU_GEN_SYSTEM_RESET; write_nic_dword(dev, CPU_GEN, ulRegRead); } else { @@ -2247,7 +2247,7 @@ void rtl92e_clear_irq(struct net_device *dev) { u32 tmp = 0; - tmp = read_nic_dword(dev, ISR); + tmp = rtl92e_readl(dev, ISR); write_nic_dword(dev, ISR, tmp); } @@ -2275,7 +2275,7 @@ void rtl92e_enable_tx(struct net_device *dev) void rtl92e_ack_irq(struct net_device *dev, u32 *p_inta, u32 *p_intb) { - *p_inta = read_nic_dword(dev, ISR); + *p_inta = rtl92e_readl(dev, ISR); write_nic_dword(dev, ISR, *p_inta); } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 6c11d19c4668..7e59f5c6b951 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -109,7 +109,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) timeout = jiffies + msecs_to_jiffies(200); while (time_before(jiffies, timeout)) { - CPU_status = read_nic_dword(dev, CPU_GEN); + CPU_status = rtl92e_readl(dev, CPU_GEN); if (CPU_status & CPU_GEN_PUT_CODE_OK) break; mdelay(2); @@ -122,14 +122,14 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) RT_TRACE(COMP_FIRMWARE, "Download Firmware: Put code ok!\n"); } - CPU_status = read_nic_dword(dev, CPU_GEN); + CPU_status = rtl92e_readl(dev, CPU_GEN); write_nic_byte(dev, CPU_GEN, (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff)); mdelay(1); timeout = jiffies + msecs_to_jiffies(200); while (time_before(jiffies, timeout)) { - CPU_status = read_nic_dword(dev, CPU_GEN); + CPU_status = rtl92e_readl(dev, CPU_GEN); if (CPU_status&CPU_GEN_BOOT_RDY) break; mdelay(2); @@ -158,7 +158,7 @@ static bool CPUcheck_firmware_ready(struct net_device *dev) timeout = jiffies + msecs_to_jiffies(20); while (time_before(jiffies, timeout)) { - CPU_status = read_nic_dword(dev, CPU_GEN); + CPU_status = rtl92e_readl(dev, CPU_GEN); if (CPU_status&CPU_GEN_FIRM_RDY) break; mdelay(2); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 74c06929118e..42dd7ae70a46 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -87,7 +87,7 @@ void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, u32 OriginalValue, BitShift, NewValue; if (dwBitMask != bMaskDWord) { - OriginalValue = read_nic_dword(dev, dwRegAddr); + OriginalValue = rtl92e_readl(dev, dwRegAddr); BitShift = rtl8192_CalculateBitShift(dwBitMask); NewValue = (((OriginalValue) & (~dwBitMask)) | (dwData << BitShift)); @@ -100,7 +100,7 @@ u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask) { u32 Ret = 0, OriginalValue, BitShift; - OriginalValue = read_nic_dword(dev, dwRegAddr); + OriginalValue = rtl92e_readl(dev, dwRegAddr); BitShift = rtl8192_CalculateBitShift(dwBitMask); Ret = (OriginalValue & dwBitMask) >> BitShift; @@ -287,20 +287,20 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, Data |= ((Offset & 0xFF) << 12); Data |= ((eRFPath & 0x3) << 20); Data |= 0x80000000; - while (read_nic_dword(dev, QPNR)&0x80000000) { + while (rtl92e_readl(dev, QPNR) & 0x80000000) { if (time++ < 100) udelay(10); else break; } write_nic_dword(dev, QPNR, Data); - while (read_nic_dword(dev, QPNR) & 0x80000000) { + while (rtl92e_readl(dev, QPNR) & 0x80000000) { if (time++ < 100) udelay(10); else return 0; } - return read_nic_dword(dev, RF_DATA); + return rtl92e_readl(dev, RF_DATA); } @@ -315,7 +315,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev, Data |= 0x400000; Data |= 0x80000000; - while (read_nic_dword(dev, QPNR) & 0x80000000) { + while (rtl92e_readl(dev, QPNR) & 0x80000000) { if (time++ < 100) udelay(10); else @@ -514,7 +514,7 @@ bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, case HW90_BLOCK_PHY1: write_nic_dword(dev, WriteAddr[CheckBlock], WriteData[i]); - dwRegRead = read_nic_dword(dev, WriteAddr[CheckBlock]); + dwRegRead = rtl92e_readl(dev, WriteAddr[CheckBlock]); break; case HW90_BLOCK_RF: @@ -555,7 +555,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) bRegValue = rtl92e_readb(dev, BB_GLOBAL_RESET); write_nic_byte(dev, BB_GLOBAL_RESET, (bRegValue|BB_GLOBAL_RESET_BIT)); - dwRegValue = read_nic_dword(dev, CPU_GEN); + dwRegValue = rtl92e_readl(dev, CPU_GEN); write_nic_dword(dev, CPU_GEN, (dwRegValue&(~CPU_GEN_BB_RST))); for (eCheckItem = (enum hw90_block)HW90_BLOCK_PHY0; @@ -573,7 +573,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bCCKEn|bOFDMEn, 0x0); rtl8192_phyConfigBB(dev, BaseBand_Config_PHY_REG); - dwRegValue = read_nic_dword(dev, CPU_GEN); + dwRegValue = rtl92e_readl(dev, CPU_GEN); write_nic_dword(dev, CPU_GEN, (dwRegValue|CPU_GEN_BB_RST)); rtl8192_phyConfigBB(dev, BaseBand_Config_AGC_TAB); @@ -607,17 +607,17 @@ void rtl92e_get_tx_power(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); priv->MCSTxPowerLevelOriginalOffset[0] = - read_nic_dword(dev, rTxAGC_Rate18_06); + rtl92e_readl(dev, rTxAGC_Rate18_06); priv->MCSTxPowerLevelOriginalOffset[1] = - read_nic_dword(dev, rTxAGC_Rate54_24); + rtl92e_readl(dev, rTxAGC_Rate54_24); priv->MCSTxPowerLevelOriginalOffset[2] = - read_nic_dword(dev, rTxAGC_Mcs03_Mcs00); + rtl92e_readl(dev, rTxAGC_Mcs03_Mcs00); priv->MCSTxPowerLevelOriginalOffset[3] = - read_nic_dword(dev, rTxAGC_Mcs07_Mcs04); + rtl92e_readl(dev, rTxAGC_Mcs07_Mcs04); priv->MCSTxPowerLevelOriginalOffset[4] = - read_nic_dword(dev, rTxAGC_Mcs11_Mcs08); + rtl92e_readl(dev, rTxAGC_Mcs11_Mcs08); priv->MCSTxPowerLevelOriginalOffset[5] = - read_nic_dword(dev, rTxAGC_Mcs15_Mcs12); + rtl92e_readl(dev, rTxAGC_Mcs15_Mcs12); priv->DefaultInitialGain[0] = rtl92e_readb(dev, rOFDM0_XAAGCCore1); priv->DefaultInitialGain[1] = rtl92e_readb(dev, rOFDM0_XBAGCCore1); @@ -629,7 +629,7 @@ void rtl92e_get_tx_power(struct net_device *dev) priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]); priv->framesync = rtl92e_readb(dev, rOFDM0_RxDetector3); - priv->framesyncC34 = read_nic_dword(dev, rOFDM0_RxDetector2); + priv->framesyncC34 = rtl92e_readl(dev, rOFDM0_RxDetector2); RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x\n", rOFDM0_RxDetector3, priv->framesync); priv->SifsTime = read_nic_word(dev, SIFS); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 6460402fa98a..f75597f3f01a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -115,7 +115,7 @@ u8 rtl92e_readb(struct net_device *dev, int x) return 0xff & readb((u8 __iomem *)dev->mem_start + x); } -u32 read_nic_dword(struct net_device *dev, int x) +u32 rtl92e_readl(struct net_device *dev, int x) { return readl((u8 __iomem *)dev->mem_start + x); } @@ -2204,7 +2204,7 @@ static void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) rtl8192_rx_normal(priv->rtllib->dev); write_nic_dword(priv->rtllib->dev, INTA_MASK, - read_nic_dword(priv->rtllib->dev, INTA_MASK) | IMR_RDU); + rtl92e_readl(priv->rtllib->dev, INTA_MASK) | IMR_RDU); } /**************************************************************************** @@ -2536,7 +2536,7 @@ static irqreturn_t rtl8192_interrupt(int irq, void *netdev) RT_TRACE(COMP_INTR, "rx descriptor unavailable!\n"); priv->stats.rxrdu++; write_nic_dword(dev, INTA_MASK, - read_nic_dword(dev, INTA_MASK) & ~IMR_RDU); + rtl92e_readl(dev, INTA_MASK) & ~IMR_RDU); tasklet_schedule(&priv->irq_rx_tasklet); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 3e6d0a5e9155..895a66fde689 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -579,7 +579,7 @@ struct r8192_priv { extern const struct ethtool_ops rtl819x_ethtool_ops; u8 rtl92e_readb(struct net_device *dev, int x); -u32 read_nic_dword(struct net_device *dev, int x); +u32 rtl92e_readl(struct net_device *dev, int x); u16 read_nic_word(struct net_device *dev, int x); void write_nic_byte(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 08af7f621930..614bf1387e40 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -444,7 +444,7 @@ static void dm_check_rate_adaptive(struct net_device *dev) if (priv->rtllib->GetHalfNmodeSupportByAPsHandler(dev)) targetRATR &= 0xf00fffff; - currentRATR = read_nic_dword(dev, RATR0); + currentRATR = rtl92e_readl(dev, RATR0); if (targetRATR != currentRATR) { u32 ratr_value; @@ -2570,7 +2570,7 @@ static void dm_check_txrateandretrycount(struct net_device *dev) ieee->softmac_stats.last_packet_rate = rtl92e_readb(dev, Initial_Tx_Rate_Reg); - ieee->softmac_stats.txretrycount = read_nic_dword(dev, + ieee->softmac_stats.txretrycount = rtl92e_readl(dev, Tx_Retry_Count_Reg); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index c92d6df135fc..c915e19e8870 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -46,7 +46,7 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) if (!priv->rtllib->bSupportRemoteWakeUp) { rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_INIT, true); - ulRegRead = read_nic_dword(dev, CPU_GEN); + ulRegRead = rtl92e_readl(dev, CPU_GEN); ulRegRead |= CPU_GEN_SYSTEM_RESET; write_nic_dword(dev, CPU_GEN, ulRegRead); } else { From 1c0a7c0e622a94eeb2da1d249757753f903eb79b Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:11 +0200 Subject: [PATCH 418/912] staging: rtl8192e: Rename read_nic_word Use naming schema found in other rtlwifi devices. Rename read_nic_word to rtl92e_readw. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 4fa5f303ae36..61b10694f4c7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2282,7 +2282,7 @@ void rtl92e_ack_irq(struct net_device *dev, u32 *p_inta, u32 *p_intb) bool rtl92e_is_rx_stuck(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - u16 RegRxCounter = read_nic_word(dev, 0x130); + u16 RegRxCounter = rtl92e_readw(dev, 0x130); bool bStuck = false; static u8 rx_chk_cnt; u32 SlotIndex = 0, TotalRxStuckCount = 0; @@ -2347,7 +2347,7 @@ bool rtl92e_is_tx_stuck(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); bool bStuck = false; - u16 RegTxCounter = read_nic_word(dev, 0x128); + u16 RegTxCounter = rtl92e_readw(dev, 0x128); RT_TRACE(COMP_RESET, "%s():RegTxCounter is %d,TxCounter is %d\n", __func__, RegTxCounter, priv->TxCounter); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 42dd7ae70a46..667f44f01c53 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -632,7 +632,7 @@ void rtl92e_get_tx_power(struct net_device *dev) priv->framesyncC34 = rtl92e_readl(dev, rOFDM0_RxDetector2); RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x\n", rOFDM0_RxDetector3, priv->framesync); - priv->SifsTime = read_nic_word(dev, SIFS); + priv->SifsTime = rtl92e_readw(dev, SIFS); } void rtl92e_set_tx_power(struct net_device *dev, u8 channel) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index f75597f3f01a..64a03f314b43 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -120,7 +120,7 @@ u32 rtl92e_readl(struct net_device *dev, int x) return readl((u8 __iomem *)dev->mem_start + x); } -u16 read_nic_word(struct net_device *dev, int x) +u16 rtl92e_readw(struct net_device *dev, int x) { return readw((u8 __iomem *)dev->mem_start + x); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 895a66fde689..5a7a54f9dc9b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -580,7 +580,7 @@ extern const struct ethtool_ops rtl819x_ethtool_ops; u8 rtl92e_readb(struct net_device *dev, int x); u32 rtl92e_readl(struct net_device *dev, int x); -u16 read_nic_word(struct net_device *dev, int x); +u16 rtl92e_readw(struct net_device *dev, int x); void write_nic_byte(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 614bf1387e40..5bbb390334aa 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -698,7 +698,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) continue; } - Avg_TSSI_Meas = read_nic_word(dev, Tssi_Mea_Value); + Avg_TSSI_Meas = rtl92e_readw(dev, Tssi_Mea_Value); if (Avg_TSSI_Meas == 0) { write_nic_byte(dev, Pw_Track_Flag, 0); From bc4f2cc90d214e81bb75c5b63a8c919779f32a6a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:12 +0200 Subject: [PATCH 419/912] staging: rtl8192e: Rename rtl8192_commit Use naming schema found in other rtlwifi devices. Rename rtl8192_commit to rtl92e_commit. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 64a03f314b43..a6937aa84cf0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2276,7 +2276,7 @@ static int rtl8192_down(struct net_device *dev, bool shutdownrf) return 0; } -void rtl8192_commit(struct net_device *dev) +void rtl92e_commit(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); @@ -2296,7 +2296,7 @@ static void rtl8192_restart(void *data) down(&priv->wx_sem); - rtl8192_commit(dev); + rtl92e_commit(dev); up(&priv->wx_sem); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 5a7a54f9dc9b..65679846484c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -591,7 +591,7 @@ void rtl8192_rx_enable(struct net_device *); void rtl8192_tx_enable(struct net_device *); void rtl8192_hw_sleep_wq(void *data); -void rtl8192_commit(struct net_device *dev); +void rtl92e_commit(struct net_device *dev); void rtl92e_check_rfctrl_gpio_timer(unsigned long data); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 1b29f14dd2b2..29400eeda968 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -824,7 +824,7 @@ static int r8192_wx_set_retry(struct net_device *dev, } - rtl8192_commit(dev); + rtl92e_commit(dev); exit: up(&priv->wx_sem); From 122fe9f1dfa2aeacceda2d32a8e496168744c3de Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:13 +0200 Subject: [PATCH 420/912] staging: rtl8192e: Rename rtl8192_config_rate Use naming schema found in other rtlwifi devices. Rename rtl8192_config_rate to rtl92e_config_rate. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 61b10694f4c7..a21da2f17774 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -968,7 +968,7 @@ static void rtl8192_net_update(struct net_device *dev) u16 rate_config = 0; net = &priv->rtllib->current_network; - rtl8192_config_rate(dev, &rate_config); + rtl92e_config_rate(dev, &rate_config); priv->dot11CurrentPreambleMode = PREAMBLE_AUTO; priv->basic_rate = rate_config &= 0x15f; write_nic_dword(dev, BSSIDR, ((u32 *)net->bssid)[0]); @@ -2151,7 +2151,7 @@ void rtl92e_update_ratr_table(struct net_device *dev) u16 rate_config = 0; u8 rate_index = 0; - rtl8192_config_rate(dev, &rate_config); + rtl92e_config_rate(dev, &rate_config); ratr_value = rate_config | *pMcsRate << 12; switch (ieee->mode) { case IEEE_A: diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index a6937aa84cf0..b13014a91f76 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -575,7 +575,7 @@ static void rtl8192_stop_beacon(struct net_device *dev) { } -void rtl8192_config_rate(struct net_device *dev, u16 *rate_config) +void rtl92e_config_rate(struct net_device *dev, u16 *rate_config) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_network *net; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 65679846484c..fe70e39a6b4d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -602,7 +602,7 @@ void rtl8192_irq_disable(struct net_device *dev); void rtl8192_pci_resetdescring(struct net_device *dev); void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode); void rtl8192_irq_enable(struct net_device *dev); -void rtl8192_config_rate(struct net_device *dev, u16 *rate_config); +void rtl92e_config_rate(struct net_device *dev, u16 *rate_config); void rtl8192_irq_disable(struct net_device *dev); void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, From b7b50d654c47eaf86711465aed3cd6888efbe204 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:14 +0200 Subject: [PATCH 421/912] staging: rtl8192e: Rename rtl8192_irq_disable Use naming schema found in other rtlwifi devices. Rename rtl8192_irq_disable to rtl92e_irq_disable. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 12 ++++++------ drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 +--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index a21da2f17774..65769013f677 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -41,7 +41,7 @@ void rtl92e_start_beacon(struct net_device *dev) u16 BcnCW = 6; u16 BcnIFS = 0xf; - rtl8192_irq_disable(dev); + rtl92e_irq_disable(dev); write_nic_word(dev, ATIMWND, 2); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index b13014a91f76..d131c02566b9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -309,7 +309,7 @@ void rtl8192_irq_enable(struct net_device *dev) priv->ops->irq_enable(dev); } -void rtl8192_irq_disable(struct net_device *dev) +void rtl92e_irq_disable(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); @@ -826,7 +826,7 @@ static int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) priv->rtllib->wpa_ie = NULL; rtl92e_cam_reset(dev); memset(priv->rtllib->swcamtable, 0, sizeof(struct sw_cam_table) * 32); - rtl8192_irq_disable(dev); + rtl92e_irq_disable(dev); del_timer_sync(&priv->watch_dog_timer); rtl8192_cancel_deferred_work(priv); @@ -1102,7 +1102,7 @@ static short rtl8192_init(struct net_device *dev) rtl92e_check_rfctrl_gpio_timer, (unsigned long)dev); - rtl8192_irq_disable(dev); + rtl92e_irq_disable(dev); if (request_irq(dev->irq, rtl8192_interrupt, IRQF_SHARED, dev->name, dev)) { netdev_err(dev, "Error allocating IRQ %d", dev->irq); @@ -1301,7 +1301,7 @@ RESET_START: if (!netif_queue_stopped(dev)) netif_stop_queue(dev); - rtl8192_irq_disable(dev); + rtl92e_irq_disable(dev); del_timer_sync(&priv->watch_dog_timer); rtl8192_cancel_deferred_work(priv); deinit_hal_dm(dev); @@ -2283,7 +2283,7 @@ void rtl92e_commit(struct net_device *dev) if (priv->up == 0) return; rtllib_softmac_stop_protocol(priv->rtllib, 0, true); - rtl8192_irq_disable(dev); + rtl92e_irq_disable(dev); priv->ops->stop_adapter(dev, true); _rtl8192_up(dev, false); } @@ -2816,7 +2816,7 @@ bool rtl92e_disable_nic(struct net_device *dev) rtllib_softmac_stop_protocol(priv->rtllib, 0, false); priv->rtllib->state = tmp_state; rtl8192_cancel_deferred_work(priv); - rtl8192_irq_disable(dev); + rtl92e_irq_disable(dev); priv->ops->stop_adapter(dev, false); RT_TRACE(COMP_PS, "<=========%s()\n", __func__); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index fe70e39a6b4d..1017a063cdd1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -597,13 +597,11 @@ void rtl92e_check_rfctrl_gpio_timer(unsigned long data); void rtl8192_hw_wakeup_wq(void *data); -void rtl8192_irq_disable(struct net_device *dev); - void rtl8192_pci_resetdescring(struct net_device *dev); void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode); void rtl8192_irq_enable(struct net_device *dev); void rtl92e_config_rate(struct net_device *dev, u16 *rate_config); -void rtl8192_irq_disable(struct net_device *dev); +void rtl92e_irq_disable(struct net_device *dev); void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, struct rtllib_rx_stats *stats); From b74299cde425f0b20c37fa6dfed2ecdf0c8853b2 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:15 +0200 Subject: [PATCH 422/912] staging: rtl8192e: Rename rtl8192_irq_enable Use naming schema found in other rtlwifi devices. Rename rtl8192_irq_enable to rtl92e_irq_enable. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 65769013f677..50067bb4e04e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -54,7 +54,7 @@ void rtl92e_start_beacon(struct net_device *dev) BcnTimeCfg |= BcnCW<btxpower_tracking = false; } } - rtl8192_irq_enable(dev); + rtl92e_irq_enable(dev); end: priv->being_init_adapter = false; return rtStatus; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index d131c02566b9..aeb6b90aef91 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -300,7 +300,7 @@ static void rtl8192_tx_timeout(struct net_device *dev) netdev_info(dev, "TXTIMEOUT"); } -void rtl8192_irq_enable(struct net_device *dev) +void rtl92e_irq_enable(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); @@ -2800,7 +2800,7 @@ bool rtl92e_enable_nic(struct net_device *dev) RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC); priv->bfirst_init = false; - rtl8192_irq_enable(dev); + rtl92e_irq_enable(dev); priv->bdisable_nic = false; RT_TRACE(COMP_PS, "<===========%s()\n", __func__); return init_status; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 1017a063cdd1..f11fe8c7044d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -599,7 +599,7 @@ void rtl8192_hw_wakeup_wq(void *data); void rtl8192_pci_resetdescring(struct net_device *dev); void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode); -void rtl8192_irq_enable(struct net_device *dev); +void rtl92e_irq_enable(struct net_device *dev); void rtl92e_config_rate(struct net_device *dev, u16 *rate_config); void rtl92e_irq_disable(struct net_device *dev); From 36154dc3deea461eec4c8428336387192fe6e2ce Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:16 +0200 Subject: [PATCH 423/912] staging: rtl8192e: Rename rtl8192_pci_resetdescring Use naming schema found in other rtlwifi devices. Rename rtl8192_pci_resetdescring to rtl92e_reset_desc_ring. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 50067bb4e04e..21aa7c876f67 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -718,7 +718,7 @@ bool rtl92e_start_adapter(struct net_device *dev) priv->being_init_adapter = true; start: - rtl8192_pci_resetdescring(dev); + rtl92e_reset_desc_ring(dev); priv->Rf_Mode = RF_OP_By_SW_3wire; if (priv->ResetProgress == RESET_TYPE_NORESET) { write_nic_byte(dev, ANAPAR, 0x37); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index aeb6b90aef91..9e5b3525ca01 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1943,7 +1943,7 @@ err_free_rings: return 1; } -void rtl8192_pci_resetdescring(struct net_device *dev) +void rtl92e_reset_desc_ring(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); int i, rx_queue_idx; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index f11fe8c7044d..577185e7e8ac 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -597,7 +597,7 @@ void rtl92e_check_rfctrl_gpio_timer(unsigned long data); void rtl8192_hw_wakeup_wq(void *data); -void rtl8192_pci_resetdescring(struct net_device *dev); +void rtl92e_reset_desc_ring(struct net_device *dev); void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode); void rtl92e_irq_enable(struct net_device *dev); void rtl92e_config_rate(struct net_device *dev, u16 *rate_config); From e58701dae05c041d443178a3a78bed9438cc21e7 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:17 +0200 Subject: [PATCH 424/912] staging: rtl8192e: Rename rtl8192_record_rxdesc_forlateruse Use naming schema found in other rtlwifi devices. Rename rtl8192_record_rxdesc_forlateruse to rtl92e_copy_mpdu_stats. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 ++----- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 21aa7c876f67..8e00ee77184b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1908,7 +1908,7 @@ static void rtl8192_TranslateRxSignalStuff(struct net_device *dev, rtl8192_query_rxphystatus(priv, pstats, pdesc, pdrvinfo, &previous_stats, bpacket_match_bssid, bpacket_toself, bPacketBeacon, bToSelfBA); - rtl8192_record_rxdesc_forlateruse(pstats, &previous_stats); + rtl92e_copy_mpdu_stats(pstats, &previous_stats); } static void rtl8192_UpdateReceivedRateHistogramStatistics( diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 9e5b3525ca01..1faf9508416e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2059,11 +2059,8 @@ rtl819x_evm_dbtopercentage( return ret_val; } -void -rtl8192_record_rxdesc_forlateruse( - struct rtllib_rx_stats *psrc_stats, - struct rtllib_rx_stats *ptarget_stats -) +void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats, + struct rtllib_rx_stats *ptarget_stats) { ptarget_stats->bIsAMPDU = psrc_stats->bIsAMPDU; ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 577185e7e8ac..df0f2bb3ba1a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -610,8 +610,8 @@ void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv, struct rtllib_rx_stats *pprevious_stats); u8 rtl819x_evm_dbtopercentage(char value); u8 rtl819x_query_rxpwrpercentage(char antpower); -void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats *psrc_stats, - struct rtllib_rx_stats *ptarget_stats); +void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats, + struct rtllib_rx_stats *ptarget_stats); bool rtl92e_enable_nic(struct net_device *dev); bool rtl92e_disable_nic(struct net_device *dev); From 630268b75726785b9709b47afb10bcaed4fa0e35 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:18 +0200 Subject: [PATCH 425/912] staging: rtl8192e: Rename rtl8192_rx_enable Use naming schema found in other rtlwifi devices. Rename rtl8192_rx_enable to rtl92e_rx_enable. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 8e00ee77184b..f0828f813fa3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -799,7 +799,7 @@ start: RSVD_FW_QUEUE_PAGE_PUB_SHIFT); rtl8192_tx_enable(dev); - rtl8192_rx_enable(dev); + rtl92e_rx_enable(dev); ulRegRead = (0xFFF00000 & rtl92e_readl(dev, RRSR)) | RATE_ALL_OFDM_AG | RATE_ALL_CCK; write_nic_dword(dev, RRSR, ulRegRead); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 1faf9508416e..025afdfb5cd2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1578,7 +1578,7 @@ static void watch_dog_timer_callback(unsigned long data) /**************************************************************************** ---------------------------- NIC TX/RX STUFF--------------------------- *****************************************************************************/ -void rtl8192_rx_enable(struct net_device *dev) +void rtl92e_rx_enable(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index df0f2bb3ba1a..10fb43117336 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -587,7 +587,7 @@ void write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); -void rtl8192_rx_enable(struct net_device *); +void rtl92e_rx_enable(struct net_device *); void rtl8192_tx_enable(struct net_device *); void rtl8192_hw_sleep_wq(void *data); From 35bf848f0662a923416d1e92120067d555f5706a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:19 +0200 Subject: [PATCH 426/912] staging: rtl8192e: Rename rtl8192_SetWirelessMode Use naming schema found in other rtlwifi devices. Rename rtl8192_SetWirelessMode to rtl92e_set_wireless_mode. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f0828f813fa3..2fc591f47b06 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -808,7 +808,7 @@ start: write_nic_byte(dev, ACK_TIMEOUT, 0x30); if (priv->ResetProgress == RESET_TYPE_NORESET) - rtl8192_SetWirelessMode(dev, priv->rtllib->mode); + rtl92e_set_wireless_mode(dev, priv->rtllib->mode); rtl92e_cam_reset(dev); { u8 SECR_value = 0x0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 025afdfb5cd2..b644ef0150e4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -706,7 +706,7 @@ static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) return ret; } -void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode) +void rtl92e_set_wireless_mode(struct net_device *dev, u8 wireless_mode) { struct r8192_priv *priv = rtllib_priv(dev); u8 bSupportMode = rtl8192_getSupportedWireleeMode(dev); @@ -874,7 +874,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->check_nic_enough_desc = rtl8192_check_nic_enough_desc; priv->rtllib->handle_assoc_response = rtl8192_handle_assoc_response; priv->rtllib->handle_beacon = rtl8192_handle_beacon; - priv->rtllib->SetWirelessMode = rtl8192_SetWirelessMode; + priv->rtllib->SetWirelessMode = rtl92e_set_wireless_mode; priv->rtllib->LeisurePSLeave = LeisurePSLeave; priv->rtllib->SetBWModeHandler = rtl92e_set_bw_mode; priv->rf_set_chan = rtl92e_set_channel; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 10fb43117336..ea8c6281c211 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -598,7 +598,7 @@ void rtl92e_check_rfctrl_gpio_timer(unsigned long data); void rtl8192_hw_wakeup_wq(void *data); void rtl92e_reset_desc_ring(struct net_device *dev); -void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode); +void rtl92e_set_wireless_mode(struct net_device *dev, u8 wireless_mode); void rtl92e_irq_enable(struct net_device *dev); void rtl92e_config_rate(struct net_device *dev, u16 *rate_config); void rtl92e_irq_disable(struct net_device *dev); From 94199b35ff28093bb94f26a7a668e33becec092d Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:20 +0200 Subject: [PATCH 427/912] staging: rtl8192e: Rename rtl8192_tx_enable Use naming schema found in other rtlwifi devices. Rename rtl8192_tx_enable to rtl92e_tx_enable. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 2fc591f47b06..0e1b25ddc7d4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -798,7 +798,7 @@ start: NUM_OF_PAGE_IN_FW_QUEUE_PUB << RSVD_FW_QUEUE_PAGE_PUB_SHIFT); - rtl8192_tx_enable(dev); + rtl92e_tx_enable(dev); rtl92e_rx_enable(dev); ulRegRead = (0xFFF00000 & rtl92e_readl(dev, RRSR)) | RATE_ALL_OFDM_AG | RATE_ALL_CCK; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index b644ef0150e4..edb5943442e8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1585,7 +1585,7 @@ void rtl92e_rx_enable(struct net_device *dev) priv->ops->rx_enable(dev); } -void rtl8192_tx_enable(struct net_device *dev) +void rtl92e_tx_enable(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index ea8c6281c211..0decf6b9213f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -588,7 +588,7 @@ void write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); void rtl92e_rx_enable(struct net_device *); -void rtl8192_tx_enable(struct net_device *); +void rtl92e_tx_enable(struct net_device *); void rtl8192_hw_sleep_wq(void *data); void rtl92e_commit(struct net_device *dev); From 6b89d0e7ceb733501e7203ca52ed9e294bd46a0d Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:21 +0200 Subject: [PATCH 428/912] staging: rtl8192e: Rename rtl819x_evm_dbtopercentage Use naming schema found in other rtlwifi devices. Rename rtl819x_evm_dbtopercentage to rtl92e_evm_db_to_percent. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 +---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 0e1b25ddc7d4..e763b3689069 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1656,7 +1656,7 @@ static void rtl8192_query_rxphystatus( rx_evmX /= 2; - evm = rtl819x_evm_dbtopercentage(rx_evmX); + evm = rtl92e_evm_db_to_percent(rx_evmX); if (bpacket_match_bssid) { if (i == 0) { pstats->SignalQuality = (u8)(evm & diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index edb5943442e8..e136fabc8a80 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2039,10 +2039,7 @@ u8 rtl819x_query_rxpwrpercentage(char antpower) } /* QueryRxPwrPercentage */ -u8 -rtl819x_evm_dbtopercentage( - char value - ) +u8 rtl92e_evm_db_to_percent(char value) { char ret_val; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 0decf6b9213f..d99513b5b62b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -608,7 +608,7 @@ void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index); void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv, struct rtllib_rx_stats *pprevious_stats); -u8 rtl819x_evm_dbtopercentage(char value); +u8 rtl92e_evm_db_to_percent(char value); u8 rtl819x_query_rxpwrpercentage(char antpower); void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats, struct rtllib_rx_stats *ptarget_stats); From aa804031831cfcff16811717bd46c1c6deee168a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:22 +0200 Subject: [PATCH 429/912] staging: rtl8192e: Rename rtl819x_query_rxpwrpercentage Use naming schema found in other rtlwifi devices. Rename rtl819x_query_rxpwrpercentage to rtl92e_rx_db_to_percent. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index e763b3689069..bddfc6ccd9f3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1586,7 +1586,7 @@ static void rtl8192_query_rxphystatus( } } - pwdb_all = rtl819x_query_rxpwrpercentage(rx_pwr_all); + pwdb_all = rtl92e_rx_db_to_percent(rx_pwr_all); pstats->RxPWDBAll = precord_stats->RxPWDBAll = pwdb_all; pstats->RecvSignalPower = rx_pwr_all; @@ -1626,7 +1626,7 @@ static void rtl8192_query_rxphystatus( rx_snrX /= 2; priv->stats.rxSNRdB[i] = (long)rx_snrX; - RSSI = rtl819x_query_rxpwrpercentage(rx_pwr[i]); + RSSI = rtl92e_rx_db_to_percent(rx_pwr[i]); if (priv->brfpath_rxenable[i]) total_rssi += RSSI; @@ -1639,7 +1639,7 @@ static void rtl8192_query_rxphystatus( rx_pwr_all = (((pofdm_buf->pwdb_all) >> 1) & 0x7f) - 106; - pwdb_all = rtl819x_query_rxpwrpercentage(rx_pwr_all); + pwdb_all = rtl92e_rx_db_to_percent(rx_pwr_all); pstats->RxPWDBAll = precord_stats->RxPWDBAll = pwdb_all; pstats->RxPower = precord_stats->RxPower = rx_pwr_all; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index e136fabc8a80..e6ca7baf783c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2028,7 +2028,7 @@ rtl819x_update_rxsignalstatistics8190pci( weighting) / 6; } -u8 rtl819x_query_rxpwrpercentage(char antpower) +u8 rtl92e_rx_db_to_percent(char antpower) { if ((antpower <= -100) || (antpower >= 20)) return 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index d99513b5b62b..d31bb3409136 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -609,7 +609,7 @@ long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index); void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv, struct rtllib_rx_stats *pprevious_stats); u8 rtl92e_evm_db_to_percent(char value); -u8 rtl819x_query_rxpwrpercentage(char antpower); +u8 rtl92e_rx_db_to_percent(char antpower); void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats, struct rtllib_rx_stats *ptarget_stats); bool rtl92e_enable_nic(struct net_device *dev); From f54f10bfa1617feb7aaaad61ddc8e9afb50a87e4 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:23 +0200 Subject: [PATCH 430/912] staging: rtl8192e: Rename rtl819x_translate_todbm Use naming schema found in other rtlwifi devices. Rename rtl819x_translate_todbm to rtl92e_translate_to_dbm. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index bddfc6ccd9f3..2f64a0fa512c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1732,8 +1732,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, slide_rssi_index = 0; tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; - priv->stats.signal_strength = rtl819x_translate_todbm(priv, - (u8)tmp_val); + priv->stats.signal_strength = rtl92e_translate_to_dbm(priv, + (u8)tmp_val); curr_st->rssi = priv->stats.signal_strength; if (!prev_st->bPacketMatchBSSID) { if (!prev_st->bToSelfBA) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index e6ca7baf783c..f9bf923cf8c7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1994,7 +1994,7 @@ void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, priv->LastRxDescTSF = stats->mac_time; } -long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index) +long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index) { long signal_power; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index d31bb3409136..c9599a9852ee 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -605,7 +605,7 @@ void rtl92e_irq_disable(struct net_device *dev); void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, struct rtllib_rx_stats *stats); -long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index); +long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index); void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv, struct rtllib_rx_stats *pprevious_stats); u8 rtl92e_evm_db_to_percent(char value); From 7879efc5a6a072eb27c14a74b45676a5cdfd26a1 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:24 +0200 Subject: [PATCH 431/912] staging: rtl8192e: Rename rtl819x_UpdateRxPktTimeStamp Use naming schema found in other rtlwifi devices. Rename rtl819x_UpdateRxPktTimeStamp to rtl92e_update_rx_pkt_timestamp. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 2f64a0fa512c..84f02befc8e8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2071,7 +2071,7 @@ bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, stats->TimeStampLow = pDrvInfo->TSFL; stats->TimeStampHigh = rtl92e_readl(dev, TSFR+4); - rtl819x_UpdateRxPktTimeStamp(dev, stats); + rtl92e_update_rx_pkt_timestamp(dev, stats); if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) stats->bShift = 1; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index f9bf923cf8c7..0ca62edca3d1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1983,8 +1983,8 @@ void rtl92e_reset_desc_ring(struct net_device *dev) spin_unlock_irqrestore(&priv->irq_th_lock, flags); } -void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, - struct rtllib_rx_stats *stats) +void rtl92e_update_rx_pkt_timestamp(struct net_device *dev, + struct rtllib_rx_stats *stats) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index c9599a9852ee..793013df8478 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -603,8 +603,8 @@ void rtl92e_irq_enable(struct net_device *dev); void rtl92e_config_rate(struct net_device *dev, u16 *rate_config); void rtl92e_irq_disable(struct net_device *dev); -void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, - struct rtllib_rx_stats *stats); +void rtl92e_update_rx_pkt_timestamp(struct net_device *dev, + struct rtllib_rx_stats *stats); long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index); void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv, struct rtllib_rx_stats *pprevious_stats); From 97ef450b860065fe3b7c657382af889c6ed00c79 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:25 +0200 Subject: [PATCH 432/912] staging: rtl8192e: Rename rtl819x_update_rxsignalstatistics8190pci Use naming schema found in other rtlwifi devices. Rename rtl819x_update_rxsignalstatistics8190pci to rtl92e_update_rx_statistics. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 ++----- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 84f02befc8e8..22b30536beb2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1821,7 +1821,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, (RX_SMOOTH-1)) + (prev_st->RxPWDBAll)) / (RX_SMOOTH); } - rtl819x_update_rxsignalstatistics8190pci(priv, prev_st); + rtl92e_update_rx_statistics(priv, prev_st); } if (prev_st->SignalQuality != 0) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 0ca62edca3d1..9c8c63d6a81c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2005,11 +2005,8 @@ long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index) } -void -rtl819x_update_rxsignalstatistics8190pci( - struct r8192_priv *priv, - struct rtllib_rx_stats *pprevious_stats - ) +void rtl92e_update_rx_statistics(struct r8192_priv *priv, + struct rtllib_rx_stats *pprevious_stats) { int weighting = 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 793013df8478..b5f582735cad 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -606,8 +606,8 @@ void rtl92e_irq_disable(struct net_device *dev); void rtl92e_update_rx_pkt_timestamp(struct net_device *dev, struct rtllib_rx_stats *stats); long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index); -void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv, - struct rtllib_rx_stats *pprevious_stats); +void rtl92e_update_rx_statistics(struct r8192_priv *priv, + struct rtllib_rx_stats *pprevious_stats); u8 rtl92e_evm_db_to_percent(char value); u8 rtl92e_rx_db_to_percent(char antpower); void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats, From d8ae1967694aca45edf9a9d559aa904c433b4bbe Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:26 +0200 Subject: [PATCH 433/912] staging: rtl8192e: Rename write_nic_byte Use naming schema found in other rtlwifi devices. Rename write_nic_byte to rtl92e_writeb. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 2 +- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 52 +++---- .../rtl8192e/rtl8192e/r8192E_firmware.c | 6 +- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 24 +-- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 144 +++++++++--------- .../staging/rtl8192e/rtl8192e/rtl_eeprom.c | 36 ++--- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 2 +- 11 files changed, 141 insertions(+), 139 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index 28cb9dd7b73c..9ddabf59784c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c @@ -81,7 +81,7 @@ bool rtl92e_send_cmd_pkt(struct net_device *dev, u8 *code_virtual_address, } while (frag_offset < buffer_len); - write_nic_byte(dev, TPPoll, TPPoll_CQ); + rtl92e_writeb(dev, TPPoll, TPPoll_CQ); Failed: return rt_status; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 22b30536beb2..371ee63d521f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -49,7 +49,7 @@ void rtl92e_start_beacon(struct net_device *dev) write_nic_word(dev, BCN_DRV_EARLY_INT, 10); write_nic_word(dev, BCN_DMATIME, 256); - write_nic_byte(dev, BCN_ERR_THRESH, 100); + rtl92e_writeb(dev, BCN_ERR_THRESH, 100); BcnTimeCfg |= BcnCW<rtllib->LedControlHandler) priv->rtllib->LedControlHandler(dev, LedAction); } @@ -133,7 +133,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) break; } - write_nic_byte(dev, MSR, btMsr); + rtl92e_writeb(dev, MSR, btMsr); } break; @@ -160,7 +160,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) case HW_VAR_SLOT_TIME: priv->slot_time = val[0]; - write_nic_byte(dev, SLOT_TIME, val[0]); + rtl92e_writeb(dev, SLOT_TIME, val[0]); break; @@ -289,20 +289,20 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl); - write_nic_byte(dev, AcmHwCtrl, AcmCtrl); + rtl92e_writeb(dev, AcmHwCtrl, AcmCtrl); break; } case HW_VAR_SIFS: - write_nic_byte(dev, SIFS, val[0]); - write_nic_byte(dev, SIFS+1, val[0]); + rtl92e_writeb(dev, SIFS, val[0]); + rtl92e_writeb(dev, SIFS+1, val[0]); break; case HW_VAR_RF_TIMING: { u8 Rf_Timing = *((u8 *)val); - write_nic_byte(dev, rFPGA0_RFTiming1, Rf_Timing); + rtl92e_writeb(dev, rFPGA0_RFTiming1, Rf_Timing); break; } @@ -683,7 +683,7 @@ static void rtl8192_hwconfig(struct net_device *dev) break; } - write_nic_byte(dev, BW_OPMODE, regBwOpMode); + rtl92e_writeb(dev, BW_OPMODE, regBwOpMode); { u32 ratr_value = 0; @@ -691,7 +691,7 @@ static void rtl8192_hwconfig(struct net_device *dev) if (priv->rf_type == RF_1T2R) ratr_value &= ~(RATE_ALL_OFDM_2SS); write_nic_dword(dev, RATR0, ratr_value); - write_nic_byte(dev, UFWP, 1); + rtl92e_writeb(dev, UFWP, 1); } regTmp = rtl92e_readb(dev, 0x313); regRRSR = ((regTmp) << 24) | (regRRSR & 0x00ffffff); @@ -721,7 +721,7 @@ start: rtl92e_reset_desc_ring(dev); priv->Rf_Mode = RF_OP_By_SW_3wire; if (priv->ResetProgress == RESET_TYPE_NORESET) { - write_nic_byte(dev, ANAPAR, 0x37); + rtl92e_writeb(dev, ANAPAR, 0x37); mdelay(500); } priv->pFirmware->firmware_status = FW_STATUS_0_INIT; @@ -744,9 +744,9 @@ start: if (ICVersion >= 0x4) { SwitchingRegulatorOutput = rtl92e_readb(dev, SWREGULATOR); if (SwitchingRegulatorOutput != 0xb8) { - write_nic_byte(dev, SWREGULATOR, 0xa8); + rtl92e_writeb(dev, SWREGULATOR, 0xa8); mdelay(1); - write_nic_byte(dev, SWREGULATOR, 0xb8); + rtl92e_writeb(dev, SWREGULATOR, 0xb8); } } RT_TRACE(COMP_INIT, "BB Config Start!\n"); @@ -774,10 +774,10 @@ start: udelay(500); } rtl8192_hwconfig(dev); - write_nic_byte(dev, CMDR, CR_RE | CR_TE); + rtl92e_writeb(dev, CMDR, CR_RE | CR_TE); - write_nic_byte(dev, PCIF, ((MXDMA2_NoLimit<dev_addr)[0]); write_nic_word(dev, MAC4, ((u16 *)(dev->dev_addr + 4))[0]); write_nic_dword(dev, RCR, priv->ReceiveConfig); @@ -805,7 +805,7 @@ start: write_nic_dword(dev, RRSR, ulRegRead); write_nic_dword(dev, RATR0+4*7, (RATE_ALL_OFDM_AG | RATE_ALL_CCK)); - write_nic_byte(dev, ACK_TIMEOUT, 0x30); + rtl92e_writeb(dev, ACK_TIMEOUT, 0x30); if (priv->ResetProgress == RESET_TYPE_NORESET) rtl92e_set_wireless_mode(dev, priv->rtllib->mode); @@ -816,7 +816,7 @@ start: SECR_value |= SCR_TxEncEnable; SECR_value |= SCR_RxDecEnable; SECR_value |= SCR_NoSKMC; - write_nic_byte(dev, SECR, SECR_value); + rtl92e_writeb(dev, SECR, SECR_value); } write_nic_word(dev, ATIMWND, 2); write_nic_word(dev, BCN_INTERVAL, 100); @@ -826,7 +826,7 @@ start: for (i = 0; i < QOS_QUEUE_NUM; i++) write_nic_dword(dev, WDCAPARA_ADD[i], 0x005e4332); } - write_nic_byte(dev, 0xbe, 0xc0); + rtl92e_writeb(dev, 0xbe, 0xc0); rtl92e_config_mac(dev); @@ -875,7 +875,7 @@ start: rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bCCKEn, 0x1); rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bOFDMEn, 0x1); - write_nic_byte(dev, 0x87, 0x0); + rtl92e_writeb(dev, 0x87, 0x0); if (priv->RegRfOff) { RT_TRACE((COMP_INIT | COMP_RF | COMP_POWER), @@ -979,7 +979,7 @@ static void rtl8192_net_update(struct net_device *dev) write_nic_word(dev, BCN_DMATIME, 256); write_nic_word(dev, BCN_INTERVAL, net->beacon_interval); write_nic_word(dev, BCN_DRV_EARLY_INT, 10); - write_nic_byte(dev, BCN_ERR_THRESH, 100); + rtl92e_writeb(dev, BCN_ERR_THRESH, 100); BcnTimeCfg |= (BcnCW<pairwise_key_type)) rtl92e_enable_hw_security_config(dev); } else { - write_nic_byte(dev, 0x173, 0); + rtl92e_writeb(dev, 0x173, 0); } rtl8192e_update_msr(dev); @@ -2108,7 +2108,7 @@ void rtl92e_stop_adapter(struct net_device *dev, bool reset) if (!priv->rtllib->bSupportRemoteWakeUp) { u1bTmp = 0x0; - write_nic_byte(dev, CMDR, u1bTmp); + rtl92e_writeb(dev, CMDR, u1bTmp); } mdelay(20); @@ -2129,8 +2129,8 @@ void rtl92e_stop_adapter(struct net_device *dev, bool reset) write_nic_dword(dev, WFCRC2, 0xffffffff); - write_nic_byte(dev, PMR, 0x5); - write_nic_byte(dev, MacBlkCtrl, 0xa); + rtl92e_writeb(dev, PMR, 0x5); + rtl92e_writeb(dev, MacBlkCtrl, 0xa); } } @@ -2186,7 +2186,7 @@ void rtl92e_update_ratr_table(struct net_device *dev) ieee->pHTInfo->bCurShortGI20MHz) ratr_value |= 0x80000000; write_nic_dword(dev, RATR0+rate_index*4, ratr_value); - write_nic_byte(dev, UFWP, 1); + rtl92e_writeb(dev, UFWP, 1); } void diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 7e59f5c6b951..37e5c1403a7e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -96,7 +96,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, } while (frag_offset < buffer_len); - write_nic_byte(dev, TPPoll, TPPoll_CQ); + rtl92e_writeb(dev, TPPoll, TPPoll_CQ); return true; } @@ -123,8 +123,8 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) } CPU_status = rtl92e_readl(dev, CPU_GEN); - write_nic_byte(dev, CPU_GEN, - (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff)); + rtl92e_writeb(dev, CPU_GEN, + (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff)); mdelay(1); timeout = jiffies + msecs_to_jiffies(200); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 667f44f01c53..d2868d76c52a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -553,7 +553,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) u32 dwRegValue = 0; bRegValue = rtl92e_readb(dev, BB_GLOBAL_RESET); - write_nic_byte(dev, BB_GLOBAL_RESET, (bRegValue|BB_GLOBAL_RESET_BIT)); + rtl92e_writeb(dev, BB_GLOBAL_RESET, (bRegValue|BB_GLOBAL_RESET_BIT)); dwRegValue = rtl92e_readl(dev, CPU_GEN); write_nic_dword(dev, CPU_GEN, (dwRegValue&(~CPU_GEN_BB_RST))); @@ -943,8 +943,8 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, (u16)CurrentCmd->Para2); break; case CmdID_WritePortUchar: - write_nic_byte(dev, CurrentCmd->Para1, - (u8)CurrentCmd->Para2); + rtl92e_writeb(dev, CurrentCmd->Para1, + (u8)CurrentCmd->Para2); break; case CmdID_RF_WriteReg: for (eRFPath = 0; eRFPath < @@ -1182,12 +1182,12 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) switch (priv->CurrentChannelBW) { case HT_CHANNEL_WIDTH_20: regBwOpMode |= BW_OPMODE_20MHZ; - write_nic_byte(dev, BW_OPMODE, regBwOpMode); + rtl92e_writeb(dev, BW_OPMODE, regBwOpMode); break; case HT_CHANNEL_WIDTH_20_40: regBwOpMode &= ~BW_OPMODE_20MHZ; - write_nic_byte(dev, BW_OPMODE, regBwOpMode); + rtl92e_writeb(dev, BW_OPMODE, regBwOpMode); break; default: @@ -1341,13 +1341,13 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation) RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x\n", initial_gain); - write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain); - write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain); - write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain); - write_nic_byte(dev, rOFDM0_XDAGCCore1, initial_gain); + rtl92e_writeb(dev, rOFDM0_XAAGCCore1, initial_gain); + rtl92e_writeb(dev, rOFDM0_XBAGCCore1, initial_gain); + rtl92e_writeb(dev, rOFDM0_XCAGCCore1, initial_gain); + rtl92e_writeb(dev, rOFDM0_XDAGCCore1, initial_gain); RT_TRACE(COMP_SCAN, "Write scan 0xa0a = 0x%x\n", POWER_DETECTION_TH); - write_nic_byte(dev, 0xa0a, POWER_DETECTION_TH); + rtl92e_writeb(dev, 0xa0a, POWER_DETECTION_TH); break; case IG_Restore: RT_TRACE(COMP_SCAN, @@ -1409,7 +1409,7 @@ void rtl92e_set_rf_off(struct net_device *dev) rtl92e_set_bb_reg(dev, rOFDM1_TRxPathEnable, 0xf, 0x0); rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x60, 0x0); rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x4, 0x0); - write_nic_byte(dev, ANAPAR_FOR_8192PciE, 0x07); + rtl92e_writeb(dev, ANAPAR_FOR_8192PciE, 0x07); } @@ -1455,7 +1455,7 @@ static bool SetRFPowerState8190(struct net_device *dev, RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC); } else { - write_nic_byte(dev, ANAPAR, 0x37); + rtl92e_writeb(dev, ANAPAR, 0x37); mdelay(1); rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, 0x4, 0x1); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 9c14286146a2..cba71585a321 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -65,7 +65,7 @@ void rtl92e_enable_hw_security_config(struct net_device *dev) RT_TRACE(COMP_SEC, "%s:, hwsec:%d, pairwise_key:%d, SECR_value:%x\n", __func__, ieee->hwsec_active, ieee->pairwise_key_type, SECR_value); - write_nic_byte(dev, SECR, SECR_value); + rtl92e_writeb(dev, SECR, SECR_value); } void rtl92e_set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 9c8c63d6a81c..65d6418b24db 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -125,7 +125,7 @@ u16 rtl92e_readw(struct net_device *dev, int x) return readw((u8 __iomem *)dev->mem_start + x); } -void write_nic_byte(struct net_device *dev, int x, u8 y) +void rtl92e_writeb(struct net_device *dev, int x, u8 y) { writeb(y, (u8 __iomem *)dev->mem_start + x); @@ -1385,7 +1385,7 @@ END: priv->bForcedSilentReset = false; priv->bResetInProgress = false; - write_nic_byte(dev, UFWP, 1); + rtl92e_writeb(dev, UFWP, 1); RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", priv->reset_count); } @@ -2393,7 +2393,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport) { - write_nic_byte(dev, 0x173, 1); + rtl92e_writeb(dev, 0x173, 1); } } else { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index b5f582735cad..21b6d01ee6a5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -581,7 +581,7 @@ extern const struct ethtool_ops rtl819x_ethtool_ops; u8 rtl92e_readb(struct net_device *dev, int x); u32 rtl92e_readl(struct net_device *dev, int x); u16 rtl92e_readw(struct net_device *dev, int x); -void write_nic_byte(struct net_device *dev, int x, u8 y); +void rtl92e_writeb(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 5bbb390334aa..1690f6f764ed 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -455,7 +455,7 @@ static void dm_check_rate_adaptive(struct net_device *dev) if (priv->rf_type == RF_1T2R) ratr_value &= ~(RATE_ALL_OFDM_2SS); write_nic_dword(dev, RATR0, ratr_value); - write_nic_byte(dev, UFWP, 1); + rtl92e_writeb(dev, UFWP, 1); pra->last_ratr = targetRATR; } @@ -653,8 +653,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) u32 delta = 0; RT_TRACE(COMP_POWER_TRACKING, "%s()\n", __func__); - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, FW_Busy_Flag, 0); priv->rtllib->bdynamic_txpower_enable = false; bHighpowerstate = priv->bDynamicTxHighPower; @@ -683,15 +683,15 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) if (priv->bResetInProgress) { RT_TRACE(COMP_POWER_TRACKING, "we are in silent reset progress, so return\n"); - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, FW_Busy_Flag, 0); return; } if (priv->rtllib->eRFPowerState != eRfOn) { RT_TRACE(COMP_POWER_TRACKING, "we are in power save, so return\n"); - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, FW_Busy_Flag, 0); return; } @@ -701,8 +701,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) Avg_TSSI_Meas = rtl92e_readw(dev, Tssi_Mea_Value); if (Avg_TSSI_Meas == 0) { - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, FW_Busy_Flag, 0); return; } @@ -725,7 +725,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) } if (viviflag) { - write_nic_byte(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); viviflag = false; RT_TRACE(COMP_POWER_TRACKING, "we filted this data\n"); @@ -752,8 +752,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) if (delta <= E_FOR_TX_POWER_TRACK) { priv->rtllib->bdynamic_txpower_enable = true; - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, FW_Busy_Flag, 0); RT_TRACE(COMP_POWER_TRACKING, "tx power track is done\n"); RT_TRACE(COMP_POWER_TRACKING, @@ -825,23 +825,23 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) { priv->rtllib->bdynamic_txpower_enable = true; - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, FW_Busy_Flag, 0); RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); return; } - write_nic_byte(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); Avg_TSSI_Meas_from_driver = 0; for (k = 0; k < 5; k++) tmp_report[k] = 0; break; } - write_nic_byte(dev, FW_Busy_Flag, 0); + rtl92e_writeb(dev, FW_Busy_Flag, 0); } priv->rtllib->bdynamic_txpower_enable = true; - write_nic_byte(dev, Pw_Track_Flag, 0); + rtl92e_writeb(dev, Pw_Track_Flag, 0); } static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) @@ -1212,7 +1212,7 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev) if (priv->rf_type == RF_1T2R) ratr_value &= ~(RATE_ALL_OFDM_2SS); write_nic_dword(dev, RATR0, ratr_value); - write_nic_byte(dev, UFWP, 1); + rtl92e_writeb(dev, UFWP, 1); if (priv->btxpower_trackingInit && priv->btxpower_tracking) dm_txpower_reset_recovery(dev); @@ -1427,17 +1427,17 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8); - write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x17); - write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x17); - write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x17); - write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x17); + rtl92e_writeb(dev, rOFDM0_XAAGCCore1, 0x17); + rtl92e_writeb(dev, rOFDM0_XBAGCCore1, 0x17); + rtl92e_writeb(dev, rOFDM0_XCAGCCore1, 0x17); + rtl92e_writeb(dev, rOFDM0_XDAGCCore1, 0x17); if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); + rtl92e_writeb(dev, (rOFDM0_XATxAFE+3), 0x00); else - write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + rtl92e_writeb(dev, rOFDM0_RxDetector1, 0x42); - write_nic_byte(dev, 0xa0a, 0x08); + rtl92e_writeb(dev, 0xa0a, 0x08); return; } @@ -1458,23 +1458,23 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( dm_digtable.dig_state = DM_STA_DIG_ON; if (reset_flag == 1) { - write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x2c); - write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x2c); - write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x2c); - write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x2c); + rtl92e_writeb(dev, rOFDM0_XAAGCCore1, 0x2c); + rtl92e_writeb(dev, rOFDM0_XBAGCCore1, 0x2c); + rtl92e_writeb(dev, rOFDM0_XCAGCCore1, 0x2c); + rtl92e_writeb(dev, rOFDM0_XDAGCCore1, 0x2c); } else { - write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x20); - write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x20); - write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x20); - write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x20); + rtl92e_writeb(dev, rOFDM0_XAAGCCore1, 0x20); + rtl92e_writeb(dev, rOFDM0_XBAGCCore1, 0x20); + rtl92e_writeb(dev, rOFDM0_XCAGCCore1, 0x20); + rtl92e_writeb(dev, rOFDM0_XDAGCCore1, 0x20); } if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + rtl92e_writeb(dev, (rOFDM0_XATxAFE+3), 0x20); else - write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); + rtl92e_writeb(dev, rOFDM0_RxDetector1, 0x44); - write_nic_byte(dev, 0xa0a, 0xcd); + rtl92e_writeb(dev, 0xa0a, 0xcd); rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x1); } @@ -1501,9 +1501,9 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev) dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); + rtl92e_writeb(dev, (rOFDM0_XATxAFE+3), 0x10); else - write_nic_byte(dev, rOFDM0_RxDetector1, 0x43); + rtl92e_writeb(dev, rOFDM0_RxDetector1, 0x43); } else { if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF && (priv->reset_count == reset_cnt_highpwr)) @@ -1515,9 +1515,9 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev) (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh)) { if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + rtl92e_writeb(dev, (rOFDM0_XATxAFE+3), 0x20); else - write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); + rtl92e_writeb(dev, rOFDM0_RxDetector1, 0x44); } } reset_cnt_highpwr = priv->reset_count; @@ -1570,10 +1570,10 @@ static void dm_initial_gain(struct net_device *dev) if ((dm_digtable.pre_ig_value != dm_digtable.cur_ig_value) || !initialized || force_write) { initial_gain = (u8)dm_digtable.cur_ig_value; - write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain); - write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain); - write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain); - write_nic_byte(dev, rOFDM0_XDAGCCore1, initial_gain); + rtl92e_writeb(dev, rOFDM0_XAAGCCore1, initial_gain); + rtl92e_writeb(dev, rOFDM0_XBAGCCore1, initial_gain); + rtl92e_writeb(dev, rOFDM0_XCAGCCore1, initial_gain); + rtl92e_writeb(dev, rOFDM0_XDAGCCore1, initial_gain); dm_digtable.pre_ig_value = dm_digtable.cur_ig_value; initialized = 1; force_write = 0; @@ -1626,20 +1626,20 @@ static void dm_pd_th(struct net_device *dev) (initialized <= 3) || force_write) { if (dm_digtable.curpd_thstate == DIG_PD_AT_LOW_POWER) { if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); + rtl92e_writeb(dev, (rOFDM0_XATxAFE+3), 0x00); else - write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + rtl92e_writeb(dev, rOFDM0_RxDetector1, 0x42); } else if (dm_digtable.curpd_thstate == DIG_PD_AT_NORMAL_POWER) { if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + rtl92e_writeb(dev, (rOFDM0_XATxAFE+3), 0x20); else - write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); + rtl92e_writeb(dev, rOFDM0_RxDetector1, 0x44); } else if (dm_digtable.curpd_thstate == DIG_PD_AT_HIGH_POWER) { if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); + rtl92e_writeb(dev, (rOFDM0_XATxAFE+3), 0x10); else - write_nic_byte(dev, rOFDM0_RxDetector1, 0x43); + rtl92e_writeb(dev, rOFDM0_RxDetector1, 0x43); } dm_digtable.prepd_thstate = dm_digtable.curpd_thstate; if (initialized <= 3) @@ -1683,9 +1683,9 @@ static void dm_cs_ratio(struct net_device *dev) if ((dm_digtable.precs_ratio_state != dm_digtable.curcs_ratio_state) || !initialized || force_write) { if (dm_digtable.curcs_ratio_state == DIG_CS_RATIO_LOWER) - write_nic_byte(dev, 0xa0a, 0x08); + rtl92e_writeb(dev, 0xa0a, 0x08); else if (dm_digtable.curcs_ratio_state == DIG_CS_RATIO_HIGHER) - write_nic_byte(dev, 0xa0a, 0xcd); + rtl92e_writeb(dev, 0xa0a, 0xcd); dm_digtable.precs_ratio_state = dm_digtable.curcs_ratio_state; initialized = 1; force_write = 0; @@ -2248,18 +2248,18 @@ static void dm_fsync_timer_callback(unsigned long data) bDoubleTimeInterval = true; priv->bswitch_fsync = !priv->bswitch_fsync; if (priv->bswitch_fsync) { - write_nic_byte(dev, 0xC36, 0x1c); - write_nic_byte(dev, 0xC3e, 0x90); + rtl92e_writeb(dev, 0xC36, 0x1c); + rtl92e_writeb(dev, 0xC3e, 0x90); } else { - write_nic_byte(dev, 0xC36, 0x5c); - write_nic_byte(dev, 0xC3e, 0x96); + rtl92e_writeb(dev, 0xC36, 0x5c); + rtl92e_writeb(dev, 0xC3e, 0x96); } } else if (priv->undecorated_smoothed_pwdb <= priv->rtllib->fsync_rssi_threshold) { if (priv->bswitch_fsync) { priv->bswitch_fsync = false; - write_nic_byte(dev, 0xC36, 0x5c); - write_nic_byte(dev, 0xC3e, 0x96); + rtl92e_writeb(dev, 0xC36, 0x5c); + rtl92e_writeb(dev, 0xC3e, 0x96); } } if (bDoubleTimeInterval) { @@ -2279,8 +2279,8 @@ static void dm_fsync_timer_callback(unsigned long data) } else { if (priv->bswitch_fsync) { priv->bswitch_fsync = false; - write_nic_byte(dev, 0xC36, 0x5c); - write_nic_byte(dev, 0xC3e, 0x96); + rtl92e_writeb(dev, 0xC36, 0x5c); + rtl92e_writeb(dev, 0xC3e, 0x96); } priv->ContinueDiffCount = 0; write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); @@ -2301,7 +2301,7 @@ static void dm_StartHWFsync(struct net_device *dev) write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cf); priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, (u8 *)(&rf_timing)); - write_nic_byte(dev, 0xc3b, 0x41); + rtl92e_writeb(dev, 0xc3b, 0x41); } static void dm_EndHWFsync(struct net_device *dev) @@ -2313,7 +2313,7 @@ static void dm_EndHWFsync(struct net_device *dev) write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, (u8 *) (&rf_timing)); - write_nic_byte(dev, 0xc3b, 0x49); + rtl92e_writeb(dev, 0xc3b, 0x49); } static void dm_EndSWFsync(struct net_device *dev) @@ -2326,9 +2326,9 @@ static void dm_EndSWFsync(struct net_device *dev) if (priv->bswitch_fsync) { priv->bswitch_fsync = false; - write_nic_byte(dev, 0xC36, 0x5c); + rtl92e_writeb(dev, 0xC36, 0x5c); - write_nic_byte(dev, 0xC3e, 0x96); + rtl92e_writeb(dev, 0xC3e, 0x96); } priv->ContinueDiffCount = 0; @@ -2427,7 +2427,7 @@ static void dm_check_fsync(struct net_device *dev) } if (priv->framesyncMonitor) { if (reg_c38_State != RegC38_Fsync_AP_BCM) { - write_nic_byte(dev, rOFDM0_RxDetector3, 0x95); + rtl92e_writeb(dev, rOFDM0_RxDetector3, 0x95); reg_c38_State = RegC38_Fsync_AP_BCM; } @@ -2453,7 +2453,7 @@ static void dm_check_fsync(struct net_device *dev) RegC38_TH) { if (reg_c38_State != RegC38_NonFsync_Other_AP) { - write_nic_byte(dev, + rtl92e_writeb(dev, rOFDM0_RxDetector3, 0x90); @@ -2463,7 +2463,7 @@ static void dm_check_fsync(struct net_device *dev) } else if (priv->undecorated_smoothed_pwdb >= (RegC38_TH+5)) { if (reg_c38_State) { - write_nic_byte(dev, + rtl92e_writeb(dev, rOFDM0_RxDetector3, priv->framesync); reg_c38_State = RegC38_Default; @@ -2471,8 +2471,8 @@ static void dm_check_fsync(struct net_device *dev) } } else { if (reg_c38_State) { - write_nic_byte(dev, rOFDM0_RxDetector3, - priv->framesync); + rtl92e_writeb(dev, rOFDM0_RxDetector3, + priv->framesync); reg_c38_State = RegC38_Default; } } @@ -2480,14 +2480,14 @@ static void dm_check_fsync(struct net_device *dev) } if (priv->framesyncMonitor) { if (priv->reset_count != reset_cnt) { - write_nic_byte(dev, rOFDM0_RxDetector3, + rtl92e_writeb(dev, rOFDM0_RxDetector3, priv->framesync); reg_c38_State = RegC38_Default; reset_cnt = priv->reset_count; } } else { if (reg_c38_State) { - write_nic_byte(dev, rOFDM0_RxDetector3, + rtl92e_writeb(dev, rOFDM0_RxDetector3, priv->framesync); reg_c38_State = RegC38_Default; } @@ -2578,5 +2578,5 @@ static void dm_send_rssi_tofw(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - write_nic_byte(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb); + rtl92e_writeb(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c index 61d462063fa7..f58534609691 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c @@ -28,12 +28,13 @@ static void eprom_cs(struct net_device *dev, short bit) { if (bit) - write_nic_byte(dev, EPROM_CMD, - (1 << EPROM_CS_SHIFT) | - rtl92e_readb(dev, EPROM_CMD)); + rtl92e_writeb(dev, EPROM_CMD, + (1 << EPROM_CS_SHIFT) | + rtl92e_readb(dev, EPROM_CMD)); else - write_nic_byte(dev, EPROM_CMD, rtl92e_readb(dev, EPROM_CMD) - & ~(1<epromtype == EEPROM_93C56) { @@ -133,7 +135,7 @@ u32 eprom_read(struct net_device *dev, u32 addr) eprom_cs(dev, 0); eprom_ck_cycle(dev); - write_nic_byte(dev, EPROM_CMD, - (EPROM_CMD_NORMAL<rtllib->bSupportRemoteWakeUp ? diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 29400eeda968..ebed99b3d637 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -961,7 +961,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, } else { if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport) - write_nic_byte(dev, 0x173, 1); + rtl92e_writeb(dev, 0x173, 1); rtl92e_set_key(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, 0, key); rtl92e_set_swcam(dev, 4, idx, alg, From 8ea541001bf7b0a2bbffa447ccfa834354c9f1dc Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:27 +0200 Subject: [PATCH 434/912] staging: rtl8192e: Rename write_nic_dword Use naming schema found in other rtlwifi devices. Rename write_nic_dword to rtl92e_writel. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 92 +++++++++---------- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 32 +++---- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 16 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 10 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 42 ++++----- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 8 +- 7 files changed, 99 insertions(+), 103 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 371ee63d521f..896d2ab07f16 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -101,7 +101,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) switch (variable) { case HW_VAR_BSSID: - write_nic_dword(dev, BSSIDR, ((u32 *)(val))[0]); + rtl92e_writel(dev, BSSIDR, ((u32 *)(val))[0]); write_nic_word(dev, BSSIDR+2, ((u16 *)(val+2))[0]); break; @@ -151,7 +151,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) else if (Type == false) RegRCR &= (~RCR_CBSSID); - write_nic_dword(dev, RCR, RegRCR); + rtl92e_writel(dev, RCR, RegRCR); priv->ReceiveConfig = RegRCR; } @@ -172,12 +172,12 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) regTmp = priv->basic_rate; if (priv->short_preamble) regTmp |= BRSR_AckShortPmb; - write_nic_dword(dev, RRSR, regTmp); + rtl92e_writel(dev, RRSR, regTmp); break; } case HW_VAR_CPU_RST: - write_nic_dword(dev, CPU_GEN, ((u32 *)(val))[0]); + rtl92e_writel(dev, CPU_GEN, ((u32 *)(val))[0]); break; case HW_VAR_AC_PARAM: @@ -207,19 +207,19 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) __func__, eACI, u4bAcParam); switch (eACI) { case AC1_BK: - write_nic_dword(dev, EDCAPARA_BK, u4bAcParam); + rtl92e_writel(dev, EDCAPARA_BK, u4bAcParam); break; case AC0_BE: - write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); + rtl92e_writel(dev, EDCAPARA_BE, u4bAcParam); break; case AC2_VI: - write_nic_dword(dev, EDCAPARA_VI, u4bAcParam); + rtl92e_writel(dev, EDCAPARA_VI, u4bAcParam); break; case AC3_VO: - write_nic_dword(dev, EDCAPARA_VO, u4bAcParam); + rtl92e_writel(dev, EDCAPARA_VO, u4bAcParam); break; default: @@ -690,12 +690,12 @@ static void rtl8192_hwconfig(struct net_device *dev) ratr_value = regRATR; if (priv->rf_type == RF_1T2R) ratr_value &= ~(RATE_ALL_OFDM_2SS); - write_nic_dword(dev, RATR0, ratr_value); + rtl92e_writel(dev, RATR0, ratr_value); rtl92e_writeb(dev, UFWP, 1); } regTmp = rtl92e_readb(dev, 0x313); regRRSR = ((regTmp) << 24) | (regRRSR & 0x00ffffff); - write_nic_dword(dev, RRSR, regRRSR); + rtl92e_writel(dev, RRSR, regRRSR); write_nic_word(dev, RETRY_LIMIT, priv->ShortRetryLimit << RETRY_LIMIT_SHORT_SHIFT | @@ -738,7 +738,7 @@ start: netdev_err(dev, "%s(): undefined firmware state: %d.\n", __func__, priv->pFirmware->firmware_status); - write_nic_dword(dev, CPU_GEN, ulRegRead); + rtl92e_writel(dev, CPU_GEN, ulRegRead); ICVersion = rtl92e_readb(dev, IC_VERRSION); if (ICVersion >= 0x4) { @@ -769,7 +769,7 @@ start: netdev_err(dev, "%s: Invalid loopback mode setting.\n", __func__); - write_nic_dword(dev, CPU_GEN, ulRegRead); + rtl92e_writel(dev, CPU_GEN, ulRegRead); udelay(500); } @@ -778,32 +778,32 @@ start: rtl92e_writeb(dev, PCIF, ((MXDMA2_NoLimit<dev_addr)[0]); + rtl92e_writel(dev, MAC0, ((u32 *)dev->dev_addr)[0]); write_nic_word(dev, MAC4, ((u16 *)(dev->dev_addr + 4))[0]); - write_nic_dword(dev, RCR, priv->ReceiveConfig); + rtl92e_writel(dev, RCR, priv->ReceiveConfig); - write_nic_dword(dev, RQPN1, NUM_OF_PAGE_IN_FW_QUEUE_BK << - RSVD_FW_QUEUE_PAGE_BK_SHIFT | - NUM_OF_PAGE_IN_FW_QUEUE_BE << - RSVD_FW_QUEUE_PAGE_BE_SHIFT | - NUM_OF_PAGE_IN_FW_QUEUE_VI << - RSVD_FW_QUEUE_PAGE_VI_SHIFT | - NUM_OF_PAGE_IN_FW_QUEUE_VO << - RSVD_FW_QUEUE_PAGE_VO_SHIFT); - write_nic_dword(dev, RQPN2, NUM_OF_PAGE_IN_FW_QUEUE_MGNT << - RSVD_FW_QUEUE_PAGE_MGNT_SHIFT); - write_nic_dword(dev, RQPN3, APPLIED_RESERVED_QUEUE_IN_FW | - NUM_OF_PAGE_IN_FW_QUEUE_BCN << - RSVD_FW_QUEUE_PAGE_BCN_SHIFT| - NUM_OF_PAGE_IN_FW_QUEUE_PUB << - RSVD_FW_QUEUE_PAGE_PUB_SHIFT); + rtl92e_writel(dev, RQPN1, NUM_OF_PAGE_IN_FW_QUEUE_BK << + RSVD_FW_QUEUE_PAGE_BK_SHIFT | + NUM_OF_PAGE_IN_FW_QUEUE_BE << + RSVD_FW_QUEUE_PAGE_BE_SHIFT | + NUM_OF_PAGE_IN_FW_QUEUE_VI << + RSVD_FW_QUEUE_PAGE_VI_SHIFT | + NUM_OF_PAGE_IN_FW_QUEUE_VO << + RSVD_FW_QUEUE_PAGE_VO_SHIFT); + rtl92e_writel(dev, RQPN2, NUM_OF_PAGE_IN_FW_QUEUE_MGNT << + RSVD_FW_QUEUE_PAGE_MGNT_SHIFT); + rtl92e_writel(dev, RQPN3, APPLIED_RESERVED_QUEUE_IN_FW | + NUM_OF_PAGE_IN_FW_QUEUE_BCN << + RSVD_FW_QUEUE_PAGE_BCN_SHIFT| + NUM_OF_PAGE_IN_FW_QUEUE_PUB << + RSVD_FW_QUEUE_PAGE_PUB_SHIFT); rtl92e_tx_enable(dev); rtl92e_rx_enable(dev); ulRegRead = (0xFFF00000 & rtl92e_readl(dev, RRSR)) | RATE_ALL_OFDM_AG | RATE_ALL_CCK; - write_nic_dword(dev, RRSR, ulRegRead); - write_nic_dword(dev, RATR0+4*7, (RATE_ALL_OFDM_AG | RATE_ALL_CCK)); + rtl92e_writel(dev, RRSR, ulRegRead); + rtl92e_writel(dev, RATR0+4*7, (RATE_ALL_OFDM_AG | RATE_ALL_CCK)); rtl92e_writeb(dev, ACK_TIMEOUT, 0x30); @@ -824,7 +824,7 @@ start: int i; for (i = 0; i < QOS_QUEUE_NUM; i++) - write_nic_dword(dev, WDCAPARA_ADD[i], 0x005e4332); + rtl92e_writel(dev, WDCAPARA_ADD[i], 0x005e4332); } rtl92e_writeb(dev, 0xbe, 0xc0); @@ -971,7 +971,7 @@ static void rtl8192_net_update(struct net_device *dev) rtl92e_config_rate(dev, &rate_config); priv->dot11CurrentPreambleMode = PREAMBLE_AUTO; priv->basic_rate = rate_config &= 0x15f; - write_nic_dword(dev, BSSIDR, ((u32 *)net->bssid)[0]); + rtl92e_writel(dev, BSSIDR, ((u32 *)net->bssid)[0]); write_nic_word(dev, BSSIDR+4, ((u16 *)net->bssid)[2]); if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { @@ -1019,7 +1019,7 @@ void rtl92e_link_change(struct net_device *dev) } else priv->ReceiveConfig = reg &= ~RCR_CBSSID; - write_nic_dword(dev, RCR, reg); + rtl92e_writel(dev, RCR, reg); } } @@ -1034,7 +1034,7 @@ void rtl92e_set_monitor_mode(struct net_device *dev, bool bAllowAllDA, priv->ReceiveConfig &= ~RCR_AAP; if (WriteIntoReg) - write_nic_dword(dev, RCR, priv->ReceiveConfig); + rtl92e_writel(dev, RCR, priv->ReceiveConfig); } static u8 MRateToHwRate8190Pci(u8 rate) @@ -2122,11 +2122,11 @@ void rtl92e_stop_adapter(struct net_device *dev, bool reset) rtl92e_set_rf_off(dev); ulRegRead = rtl92e_readl(dev, CPU_GEN); ulRegRead |= CPU_GEN_SYSTEM_RESET; - write_nic_dword(dev, CPU_GEN, ulRegRead); + rtl92e_writel(dev, CPU_GEN, ulRegRead); } else { - write_nic_dword(dev, WFCRC0, 0xffffffff); - write_nic_dword(dev, WFCRC1, 0xffffffff); - write_nic_dword(dev, WFCRC2, 0xffffffff); + rtl92e_writel(dev, WFCRC0, 0xffffffff); + rtl92e_writel(dev, WFCRC1, 0xffffffff); + rtl92e_writel(dev, WFCRC2, 0xffffffff); rtl92e_writeb(dev, PMR, 0x5); @@ -2185,7 +2185,7 @@ void rtl92e_update_ratr_table(struct net_device *dev) else if (!ieee->pHTInfo->bCurTxBW40MHz && ieee->pHTInfo->bCurShortGI20MHz) ratr_value |= 0x80000000; - write_nic_dword(dev, RATR0+rate_index*4, ratr_value); + rtl92e_writel(dev, RATR0+rate_index*4, ratr_value); rtl92e_writeb(dev, UFWP, 1); } @@ -2230,7 +2230,7 @@ void rtl92e_enable_irq(struct net_device *dev) priv->irq_enabled = 1; - write_nic_dword(dev, INTA_MASK, priv->irq_mask[0]); + rtl92e_writel(dev, INTA_MASK, priv->irq_mask[0]); } @@ -2238,7 +2238,7 @@ void rtl92e_disable_irq(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); - write_nic_dword(dev, INTA_MASK, 0); + rtl92e_writel(dev, INTA_MASK, 0); priv->irq_enabled = 0; } @@ -2248,7 +2248,7 @@ void rtl92e_clear_irq(struct net_device *dev) u32 tmp = 0; tmp = rtl92e_readl(dev, ISR); - write_nic_dword(dev, ISR, tmp); + rtl92e_writel(dev, ISR, tmp); } @@ -2256,7 +2256,7 @@ void rtl92e_enable_rx(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); - write_nic_dword(dev, RDQDA, priv->rx_ring_dma[RX_MPDU_QUEUE]); + rtl92e_writel(dev, RDQDA, priv->rx_ring_dma[RX_MPDU_QUEUE]); } static const u32 TX_DESC_BASE[] = { @@ -2269,14 +2269,14 @@ void rtl92e_enable_tx(struct net_device *dev) u32 i; for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) - write_nic_dword(dev, TX_DESC_BASE[i], priv->tx_ring[i].dma); + rtl92e_writel(dev, TX_DESC_BASE[i], priv->tx_ring[i].dma); } void rtl92e_ack_irq(struct net_device *dev, u32 *p_inta, u32 *p_intb) { *p_inta = rtl92e_readl(dev, ISR); - write_nic_dword(dev, ISR, *p_inta); + rtl92e_writel(dev, ISR, *p_inta); } bool rtl92e_is_rx_stuck(struct net_device *dev) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index d2868d76c52a..fde03472933c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -91,9 +91,9 @@ void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, BitShift = rtl8192_CalculateBitShift(dwBitMask); NewValue = (((OriginalValue) & (~dwBitMask)) | (dwData << BitShift)); - write_nic_dword(dev, dwRegAddr, NewValue); + rtl92e_writel(dev, dwRegAddr, NewValue); } else - write_nic_dword(dev, dwRegAddr, dwData); + rtl92e_writel(dev, dwRegAddr, dwData); } u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask) @@ -293,7 +293,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, else break; } - write_nic_dword(dev, QPNR, Data); + rtl92e_writel(dev, QPNR, Data); while (rtl92e_readl(dev, QPNR) & 0x80000000) { if (time++ < 100) udelay(10); @@ -321,7 +321,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev, else break; } - write_nic_dword(dev, QPNR, Data); + rtl92e_writel(dev, QPNR, Data); } @@ -512,8 +512,8 @@ bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, switch (CheckBlock) { case HW90_BLOCK_PHY0: case HW90_BLOCK_PHY1: - write_nic_dword(dev, WriteAddr[CheckBlock], - WriteData[i]); + rtl92e_writel(dev, WriteAddr[CheckBlock], + WriteData[i]); dwRegRead = rtl92e_readl(dev, WriteAddr[CheckBlock]); break; @@ -556,7 +556,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) rtl92e_writeb(dev, BB_GLOBAL_RESET, (bRegValue|BB_GLOBAL_RESET_BIT)); dwRegValue = rtl92e_readl(dev, CPU_GEN); - write_nic_dword(dev, CPU_GEN, (dwRegValue&(~CPU_GEN_BB_RST))); + rtl92e_writel(dev, CPU_GEN, (dwRegValue&(~CPU_GEN_BB_RST))); for (eCheckItem = (enum hw90_block)HW90_BLOCK_PHY0; eCheckItem <= HW90_BLOCK_PHY1; eCheckItem++) { @@ -574,7 +574,7 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) rtl8192_phyConfigBB(dev, BaseBand_Config_PHY_REG); dwRegValue = rtl92e_readl(dev, CPU_GEN); - write_nic_dword(dev, CPU_GEN, (dwRegValue|CPU_GEN_BB_RST)); + rtl92e_writel(dev, CPU_GEN, (dwRegValue|CPU_GEN_BB_RST)); rtl8192_phyConfigBB(dev, BaseBand_Config_AGC_TAB); @@ -935,8 +935,8 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, rtl8192_SetTxPowerLevel(dev, channel); break; case CmdID_WritePortUlong: - write_nic_dword(dev, CurrentCmd->Para1, - CurrentCmd->Para2); + rtl92e_writel(dev, CurrentCmd->Para1, + CurrentCmd->Para2); break; case CmdID_WritePortUshort: write_nic_word(dev, CurrentCmd->Para1, @@ -1202,9 +1202,9 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) rtl92e_set_bb_reg(dev, rFPGA1_RFMOD, bRFMOD, 0x0); if (!priv->btxpower_tracking) { - write_nic_dword(dev, rCCK0_TxFilter1, 0x1a1b0000); - write_nic_dword(dev, rCCK0_TxFilter2, 0x090e1317); - write_nic_dword(dev, rCCK0_DebugPort, 0x00000204); + rtl92e_writel(dev, rCCK0_TxFilter1, 0x1a1b0000); + rtl92e_writel(dev, rCCK0_TxFilter2, 0x090e1317); + rtl92e_writel(dev, rCCK0_DebugPort, 0x00000204); } else { CCK_Tx_Power_Track_BW_Switch(dev); } @@ -1217,9 +1217,9 @@ static void rtl8192_SetBWModeWorkItem(struct net_device *dev) rtl92e_set_bb_reg(dev, rFPGA1_RFMOD, bRFMOD, 0x1); if (!priv->btxpower_tracking) { - write_nic_dword(dev, rCCK0_TxFilter1, 0x35360000); - write_nic_dword(dev, rCCK0_TxFilter2, 0x121c252e); - write_nic_dword(dev, rCCK0_DebugPort, 0x00000409); + rtl92e_writel(dev, rCCK0_TxFilter1, 0x35360000); + rtl92e_writel(dev, rCCK0_TxFilter2, 0x121c252e); + rtl92e_writel(dev, rCCK0_DebugPort, 0x00000409); } else { CCK_Tx_Power_Track_BW_Switch(dev); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index cba71585a321..749b5ce1b7ed 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -33,7 +33,7 @@ void rtl92e_cam_reset(struct net_device *dev) u32 ulcommand = 0; ulcommand |= BIT31|BIT30; - write_nic_dword(dev, RWCAM, ulcommand); + rtl92e_writel(dev, RWCAM, ulcommand); } void rtl92e_enable_hw_security_config(struct net_device *dev) @@ -135,20 +135,20 @@ void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex, (u32)(*(MacAddr+1)) << 24 | (u32)usConfig; - write_nic_dword(dev, WCAMI, TargetContent); - write_nic_dword(dev, RWCAM, TargetCommand); + rtl92e_writel(dev, WCAMI, TargetContent); + rtl92e_writel(dev, RWCAM, TargetCommand); } else if (i == 1) { TargetContent = (u32)(*(MacAddr+2)) | (u32)(*(MacAddr+3)) << 8 | (u32)(*(MacAddr+4)) << 16 | (u32)(*(MacAddr+5)) << 24; - write_nic_dword(dev, WCAMI, TargetContent); - write_nic_dword(dev, RWCAM, TargetCommand); + rtl92e_writel(dev, WCAMI, TargetContent); + rtl92e_writel(dev, RWCAM, TargetCommand); } else { if (KeyContent != NULL) { - write_nic_dword(dev, WCAMI, - (u32)(*(KeyContent+i-2))); - write_nic_dword(dev, RWCAM, TargetCommand); + rtl92e_writel(dev, WCAMI, + (u32)(*(KeyContent+i-2))); + rtl92e_writel(dev, RWCAM, TargetCommand); udelay(100); } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 65d6418b24db..ef1ea4acc72a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -132,7 +132,7 @@ void rtl92e_writeb(struct net_device *dev, int x, u8 y) udelay(20); } -void write_nic_dword(struct net_device *dev, int x, u32 y) +void rtl92e_writel(struct net_device *dev, int x, u32 y) { writel(y, (u8 __iomem *)dev->mem_start + x); @@ -2194,8 +2194,8 @@ static void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) { rtl8192_rx_normal(priv->rtllib->dev); - write_nic_dword(priv->rtllib->dev, INTA_MASK, - rtl92e_readl(priv->rtllib->dev, INTA_MASK) | IMR_RDU); + rtl92e_writel(priv->rtllib->dev, INTA_MASK, + rtl92e_readl(priv->rtllib->dev, INTA_MASK) | IMR_RDU); } /**************************************************************************** @@ -2526,8 +2526,8 @@ static irqreturn_t rtl8192_interrupt(int irq, void *netdev) if (inta & IMR_RDU) { RT_TRACE(COMP_INTR, "rx descriptor unavailable!\n"); priv->stats.rxrdu++; - write_nic_dword(dev, INTA_MASK, - rtl92e_readl(dev, INTA_MASK) & ~IMR_RDU); + rtl92e_writel(dev, INTA_MASK, + rtl92e_readl(dev, INTA_MASK) & ~IMR_RDU); tasklet_schedule(&priv->irq_rx_tasklet); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 21b6d01ee6a5..9792445405de 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -583,7 +583,7 @@ u32 rtl92e_readl(struct net_device *dev, int x); u16 rtl92e_readw(struct net_device *dev, int x); void rtl92e_writeb(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); -void write_nic_dword(struct net_device *dev, int x, u32 y); +void rtl92e_writel(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 1690f6f764ed..342777d6764a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -454,7 +454,7 @@ static void dm_check_rate_adaptive(struct net_device *dev) currentRATR, targetRATR); if (priv->rf_type == RF_1T2R) ratr_value &= ~(RATE_ALL_OFDM_2SS); - write_nic_dword(dev, RATR0, ratr_value); + rtl92e_writel(dev, RATR0, ratr_value); rtl92e_writeb(dev, UFWP, 1); pra->last_ratr = targetRATR; @@ -1211,7 +1211,7 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev) ratr_value = reg_ratr; if (priv->rf_type == RF_1T2R) ratr_value &= ~(RATE_ALL_OFDM_2SS); - write_nic_dword(dev, RATR0, ratr_value); + rtl92e_writel(dev, RATR0, ratr_value); rtl92e_writeb(dev, UFWP, 1); if (priv->btxpower_trackingInit && priv->btxpower_tracking) dm_txpower_reset_recovery(dev); @@ -1741,21 +1741,19 @@ static void dm_check_edca_turbo(struct net_device *dev) if (curTxOkCnt > 4*curRxOkCnt) { if (priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) { - write_nic_dword(dev, EDCAPARA_BE, - edca_setting_UL[pHTInfo->IOTPeer]); + rtl92e_writel(dev, EDCAPARA_BE, + edca_setting_UL[pHTInfo->IOTPeer]); priv->bis_cur_rdlstate = false; } } else { if (!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) { if (priv->rtllib->mode == WIRELESS_MODE_G) - write_nic_dword(dev, - EDCAPARA_BE, - edca_setting_DL_GMode[pHTInfo->IOTPeer]); + rtl92e_writel(dev, EDCAPARA_BE, + edca_setting_DL_GMode[pHTInfo->IOTPeer]); else - write_nic_dword(dev, - EDCAPARA_BE, - edca_setting_DL[pHTInfo->IOTPeer]); + rtl92e_writel(dev, EDCAPARA_BE, + edca_setting_DL[pHTInfo->IOTPeer]); priv->bis_cur_rdlstate = true; } } @@ -1765,20 +1763,18 @@ static void dm_check_edca_turbo(struct net_device *dev) if (!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) { if (priv->rtllib->mode == WIRELESS_MODE_G) - write_nic_dword(dev, - EDCAPARA_BE, - edca_setting_DL_GMode[pHTInfo->IOTPeer]); + rtl92e_writel(dev, EDCAPARA_BE, + edca_setting_DL_GMode[pHTInfo->IOTPeer]); else - write_nic_dword(dev, - EDCAPARA_BE, - edca_setting_DL[pHTInfo->IOTPeer]); + rtl92e_writel(dev, EDCAPARA_BE, + edca_setting_DL[pHTInfo->IOTPeer]); priv->bis_cur_rdlstate = true; } } else { if (priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) { - write_nic_dword(dev, EDCAPARA_BE, - edca_setting_UL[pHTInfo->IOTPeer]); + rtl92e_writel(dev, EDCAPARA_BE, + edca_setting_UL[pHTInfo->IOTPeer]); priv->bis_cur_rdlstate = false; } @@ -2283,7 +2279,7 @@ static void dm_fsync_timer_callback(unsigned long data) rtl92e_writeb(dev, 0xC3e, 0x96); } priv->ContinueDiffCount = 0; - write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); + rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c52cd); } RT_TRACE(COMP_HALDM, "ContinueDiffCount %d\n", priv->ContinueDiffCount); RT_TRACE(COMP_HALDM, @@ -2298,7 +2294,7 @@ static void dm_StartHWFsync(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); RT_TRACE(COMP_HALDM, "%s\n", __func__); - write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cf); + rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c12cf); priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, (u8 *)(&rf_timing)); rtl92e_writeb(dev, 0xc3b, 0x41); @@ -2310,7 +2306,7 @@ static void dm_EndHWFsync(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); RT_TRACE(COMP_HALDM, "%s\n", __func__); - write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); + rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c52cd); priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, (u8 *) (&rf_timing)); rtl92e_writeb(dev, 0xc3b, 0x49); @@ -2332,7 +2328,7 @@ static void dm_EndSWFsync(struct net_device *dev) } priv->ContinueDiffCount = 0; - write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); + rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c52cd); } static void dm_StartSWFsync(struct net_device *dev) @@ -2367,7 +2363,7 @@ static void dm_StartSWFsync(struct net_device *dev) msecs_to_jiffies(priv->rtllib->fsync_time_interval); add_timer(&priv->fsync_timer); - write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); + rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c12cd); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index 3c87398b5b48..d4d489c35e93 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -48,11 +48,11 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_INIT, true); ulRegRead = rtl92e_readl(dev, CPU_GEN); ulRegRead |= CPU_GEN_SYSTEM_RESET; - write_nic_dword(dev, CPU_GEN, ulRegRead); + rtl92e_writel(dev, CPU_GEN, ulRegRead); } else { - write_nic_dword(dev, WFCRC0, 0xffffffff); - write_nic_dword(dev, WFCRC1, 0xffffffff); - write_nic_dword(dev, WFCRC2, 0xffffffff); + rtl92e_writel(dev, WFCRC0, 0xffffffff); + rtl92e_writel(dev, WFCRC1, 0xffffffff); + rtl92e_writel(dev, WFCRC2, 0xffffffff); rtl92e_writeb(dev, PMR, 0x5); rtl92e_writeb(dev, MacBlkCtrl, 0xa); } From 6dee0c884a24074ad9de3150e6c527bb4a148277 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:28 +0200 Subject: [PATCH 435/912] staging: rtl8192e: Rename write_nic_word Use naming schema found in other rtlwifi devices. Rename write_nic_word to rtl92e_writew. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 36 +++++++++---------- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 896d2ab07f16..c7ffe9760c37 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -43,17 +43,17 @@ void rtl92e_start_beacon(struct net_device *dev) rtl92e_irq_disable(dev); - write_nic_word(dev, ATIMWND, 2); + rtl92e_writew(dev, ATIMWND, 2); - write_nic_word(dev, BCN_INTERVAL, net->beacon_interval); - write_nic_word(dev, BCN_DRV_EARLY_INT, 10); - write_nic_word(dev, BCN_DMATIME, 256); + rtl92e_writew(dev, BCN_INTERVAL, net->beacon_interval); + rtl92e_writew(dev, BCN_DRV_EARLY_INT, 10); + rtl92e_writew(dev, BCN_DMATIME, 256); rtl92e_writeb(dev, BCN_ERR_THRESH, 100); BcnTimeCfg |= BcnCW<ShortRetryLimit << RETRY_LIMIT_SHORT_SHIFT | - priv->LongRetryLimit << RETRY_LIMIT_LONG_SHIFT); + rtl92e_writew(dev, RETRY_LIMIT, + priv->ShortRetryLimit << RETRY_LIMIT_SHORT_SHIFT | + priv->LongRetryLimit << RETRY_LIMIT_LONG_SHIFT); } bool rtl92e_start_adapter(struct net_device *dev) @@ -779,7 +779,7 @@ start: rtl92e_writeb(dev, PCIF, ((MXDMA2_NoLimit<dev_addr)[0]); - write_nic_word(dev, MAC4, ((u16 *)(dev->dev_addr + 4))[0]); + rtl92e_writew(dev, MAC4, ((u16 *)(dev->dev_addr + 4))[0]); rtl92e_writel(dev, RCR, priv->ReceiveConfig); rtl92e_writel(dev, RQPN1, NUM_OF_PAGE_IN_FW_QUEUE_BK << @@ -818,8 +818,8 @@ start: SECR_value |= SCR_NoSKMC; rtl92e_writeb(dev, SECR, SECR_value); } - write_nic_word(dev, ATIMWND, 2); - write_nic_word(dev, BCN_INTERVAL, 100); + rtl92e_writew(dev, ATIMWND, 2); + rtl92e_writew(dev, BCN_INTERVAL, 100); { int i; @@ -972,19 +972,19 @@ static void rtl8192_net_update(struct net_device *dev) priv->dot11CurrentPreambleMode = PREAMBLE_AUTO; priv->basic_rate = rate_config &= 0x15f; rtl92e_writel(dev, BSSIDR, ((u32 *)net->bssid)[0]); - write_nic_word(dev, BSSIDR+4, ((u16 *)net->bssid)[2]); + rtl92e_writew(dev, BSSIDR+4, ((u16 *)net->bssid)[2]); if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { - write_nic_word(dev, ATIMWND, 2); - write_nic_word(dev, BCN_DMATIME, 256); - write_nic_word(dev, BCN_INTERVAL, net->beacon_interval); - write_nic_word(dev, BCN_DRV_EARLY_INT, 10); + rtl92e_writew(dev, ATIMWND, 2); + rtl92e_writew(dev, BCN_DMATIME, 256); + rtl92e_writew(dev, BCN_INTERVAL, net->beacon_interval); + rtl92e_writew(dev, BCN_DRV_EARLY_INT, 10); rtl92e_writeb(dev, BCN_ERR_THRESH, 100); BcnTimeCfg |= (BcnCW<Para2); break; case CmdID_WritePortUshort: - write_nic_word(dev, CurrentCmd->Para1, - (u16)CurrentCmd->Para2); + rtl92e_writew(dev, CurrentCmd->Para1, + (u16)CurrentCmd->Para2); break; case CmdID_WritePortUchar: rtl92e_writeb(dev, CurrentCmd->Para1, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index ef1ea4acc72a..85def08be69a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -139,7 +139,7 @@ void rtl92e_writel(struct net_device *dev, int x, u32 y) udelay(20); } -void write_nic_word(struct net_device *dev, int x, u16 y) +void rtl92e_writew(struct net_device *dev, int x, u16 y) { writew(y, (u8 __iomem *)dev->mem_start + x); @@ -1837,7 +1837,7 @@ static short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) spin_unlock_irqrestore(&priv->irq_th_lock, flags); dev->trans_start = jiffies; - write_nic_word(dev, TPPoll, 0x01 << tcb_desc->queue_index); + rtl92e_writew(dev, TPPoll, 0x01 << tcb_desc->queue_index); return 0; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 9792445405de..4938be77c7b1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -582,7 +582,7 @@ u8 rtl92e_readb(struct net_device *dev, int x); u32 rtl92e_readl(struct net_device *dev, int x); u16 rtl92e_readw(struct net_device *dev, int x); void rtl92e_writeb(struct net_device *dev, int x, u8 y); -void write_nic_word(struct net_device *dev, int x, u16 y); +void rtl92e_writew(struct net_device *dev, int x, u16 y); void rtl92e_writel(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); From fd9e3171844891b510adf125d820a91d212f359c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:29 +0200 Subject: [PATCH 436/912] staging: rtl8192e: Rename deinit_hal_dm Use naming schema found in other rtlwifi devices. Rename deinit_hal_dm to rtl92e_dm_deinit. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 85def08be69a..8091f79337da 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1304,7 +1304,7 @@ RESET_START: rtl92e_irq_disable(dev); del_timer_sync(&priv->watch_dog_timer); rtl8192_cancel_deferred_work(priv); - deinit_hal_dm(dev); + rtl92e_dm_deinit(dev); rtllib_stop_scan_syncro(ieee); if (ieee->state == RTLLIB_LINKED) { @@ -2736,7 +2736,7 @@ static void rtl8192_pci_disconnect(struct pci_dev *pdev) cancel_delayed_work(&priv->gpio_change_rf_wq); priv->polling_timer_on = 0; rtl8192_down(dev, true); - deinit_hal_dm(dev); + rtl92e_dm_deinit(dev); if (priv->pFirmware) { vfree(priv->pFirmware); priv->pFirmware = NULL; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 342777d6764a..9d0b633dd7cd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -249,7 +249,7 @@ void init_hal_dm(struct net_device *dev) (void *)dm_CheckRfCtrlGPIO, dev); } -void deinit_hal_dm(struct net_device *dev) +void rtl92e_dm_deinit(struct net_device *dev) { dm_deInit_fsync(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index 95b8a8fd0556..647a569d7787 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -189,7 +189,7 @@ extern const u8 dm_cck_tx_bb_gain_ch14[CCKTxBBGainTableLength][8]; /*--------------------------Exported Function prototype---------------------*/ extern void init_hal_dm(struct net_device *dev); -extern void deinit_hal_dm(struct net_device *dev); +extern void rtl92e_dm_deinit(struct net_device *dev); extern void hal_dm_watchdog(struct net_device *dev); From 090e8a4d99339f66971b9e2b3b13a62fa115b1d0 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:30 +0200 Subject: [PATCH 437/912] staging: rtl8192e: Rename dm_backup_dynamic_mechanism_state Use naming schema found in other rtlwifi devices. Rename dm_backup_dynamic_mechanism_state to rtl92e_dm_backup_state. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 8091f79337da..04fe6dcbf2de 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1321,7 +1321,7 @@ RESET_START: rtllib_softmac_stop_protocol(priv->rtllib, 0, true); } - dm_backup_dynamic_mechanism_state(dev); + rtl92e_dm_backup_state(dev); up(&priv->wx_sem); RT_TRACE(COMP_RESET, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 9d0b633dd7cd..848d6ee74962 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1256,7 +1256,7 @@ static void dm_bb_initialgain_restore(struct net_device *dev) } -void dm_backup_dynamic_mechanism_state(struct net_device *dev) +void rtl92e_dm_backup_state(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index 647a569d7787..f138c90ccaa5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -200,7 +200,7 @@ extern void dm_txpower_trackingcallback(void *data); extern void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); -extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); +extern void rtl92e_dm_backup_state(struct net_device *dev); extern void dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_pathcheck_workitemcallback(void *data); extern void dm_initialize_txpower_tracking(struct net_device *dev); From 59e84dc363bfaa675db8da94113d3250170ebb70 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:31 +0200 Subject: [PATCH 438/912] staging: rtl8192e: Rename dm_cck_txpower_adjust Use naming schema found in other rtlwifi devices. Rename dm_cck_txpower_adjust to rtl92e_dm_cck_txpower_adjust. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 14 +++++++------- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 12 ++++++------ drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 674c529df4a4..7acae7d49c91 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1076,13 +1076,13 @@ static void CCK_Tx_Power_Track_BW_Switch_TSSI(struct net_device *dev) if (priv->rtllib->current_network.channel == 14 && !priv->bcck_in_ch14) { priv->bcck_in_ch14 = true; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { priv->bcck_in_ch14 = false; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else { - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } break; @@ -1104,13 +1104,13 @@ static void CCK_Tx_Power_Track_BW_Switch_TSSI(struct net_device *dev) if (priv->rtllib->current_network.channel == 14 && !priv->bcck_in_ch14) { priv->bcck_in_ch14 = true; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { priv->bcck_in_ch14 = false; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else { - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } break; } @@ -1144,7 +1144,7 @@ static void CCK_Tx_Power_Track_BW_Switch_ThermalMeter(struct net_device *dev) priv->CCK_index); break; } - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } static void CCK_Tx_Power_Track_BW_Switch(struct net_device *dev) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 848d6ee74962..c947b62a1732 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -802,12 +802,12 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) if (priv->rtllib->current_network.channel == 14 && !priv->bcck_in_ch14) { priv->bcck_in_ch14 = true; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { priv->bcck_in_ch14 = false; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", @@ -935,7 +935,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) } if (CCKSwingNeedUpdate) - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); if (priv->OFDM_index[0] != tmpOFDMindex) { priv->OFDM_index[0] = tmpOFDMindex; rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, @@ -1149,7 +1149,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, } } -void dm_cck_txpower_adjust(struct net_device *dev, bool binch14) +void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14) { struct r8192_priv *priv = rtllib_priv(dev); @@ -1177,7 +1177,7 @@ static void dm_txpower_reset_recovery(struct net_device *dev) RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: CCK Attenuation is %d dB\n", priv->CCKPresentAttentuation); - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl92e_dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); rtl92e_set_bb_reg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, dm_tx_bb_gain[priv->rfc_txpowertrackingindex]); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index f138c90ccaa5..f7e74825c716 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -197,7 +197,7 @@ extern void hal_dm_watchdog(struct net_device *dev); extern void init_rate_adaptive(struct net_device *dev); extern void dm_txpower_trackingcallback(void *data); -extern void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); +extern void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14); extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); extern void rtl92e_dm_backup_state(struct net_device *dev); From 7842c2d58d4dc8b5e96d87aa61d619bd6f094ca7 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:32 +0200 Subject: [PATCH 439/912] staging: rtl8192e: Rename dm_init_edca_turbo Use naming schema found in other rtlwifi devices. Rename dm_init_edca_turbo to rtl92e_dm_init_edca_turbo. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index c7ffe9760c37..8a8a1fd06503 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -193,7 +193,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) u1bAIFS = qop->aifs[pAcParam] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; - dm_init_edca_turbo(dev); + rtl92e_dm_init_edca_turbo(dev); u4bAcParam = (le16_to_cpu(qop->tx_op_limit[pAcParam]) << AC_PARAM_TXOP_LIMIT_OFFSET) | diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 04fe6dcbf2de..ae8a82066f32 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -525,7 +525,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n", __func__, network->flags, priv->rtllib->current_network.qos_data.active); if (set_qos_param == 1) { - dm_init_edca_turbo(priv->rtllib->dev); + rtl92e_dm_init_edca_turbo(priv->rtllib->dev); queue_work_rsl(priv->priv_wq, &priv->qos_activate); } return 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index c947b62a1732..28e0d1f5fdc2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -237,7 +237,7 @@ void init_hal_dm(struct net_device *dev) init_rate_adaptive(dev); dm_dig_init(dev); - dm_init_edca_turbo(dev); + rtl92e_dm_init_edca_turbo(dev); dm_init_bandwidth_autoswitch(dev); dm_init_fsync(dev); dm_init_rxpath_selection(dev); @@ -1692,7 +1692,7 @@ static void dm_cs_ratio(struct net_device *dev) } } -void dm_init_edca_turbo(struct net_device *dev) +void rtl92e_dm_init_edca_turbo(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index f7e74825c716..132b6dd6a942 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -201,7 +201,7 @@ extern void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14); extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); extern void rtl92e_dm_backup_state(struct net_device *dev); -extern void dm_init_edca_turbo(struct net_device *dev); +extern void rtl92e_dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_pathcheck_workitemcallback(void *data); extern void dm_initialize_txpower_tracking(struct net_device *dev); #endif /*__R8192UDM_H__ */ From 5a9f18cfeda0b73d2fafdab6eb1c4457ddd34b76 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:33 +0200 Subject: [PATCH 440/912] staging: rtl8192e: Rename dm_initialize_txpower_tracking Use naming schema found in other rtlwifi devices. Rename dm_initialize_txpower_tracking to rtl92e_dm_init_txpower_tracking. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 8a8a1fd06503..f72b0654c7d7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -907,7 +907,7 @@ start: priv->Rf_Mode = RF_OP_By_SW_3wire; if (priv->ResetProgress == RESET_TYPE_NORESET) { - dm_initialize_txpower_tracking(dev); + rtl92e_dm_init_txpower_tracking(dev); if (priv->IC_Cut >= IC_VersionCut_D) { tmpRegA = rtl92e_get_bb_reg(dev, rOFDM0_XATxIQImbalance, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 28e0d1f5fdc2..c96ab6ee1a14 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -985,7 +985,7 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev) priv->btxpower_tracking); } -void dm_initialize_txpower_tracking(struct net_device *dev) +void rtl92e_dm_init_txpower_tracking(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index 132b6dd6a942..0b9f0852dce7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -203,5 +203,5 @@ extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); extern void rtl92e_dm_backup_state(struct net_device *dev); extern void rtl92e_dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_pathcheck_workitemcallback(void *data); -extern void dm_initialize_txpower_tracking(struct net_device *dev); +extern void rtl92e_dm_init_txpower_tracking(struct net_device *dev); #endif /*__R8192UDM_H__ */ From 25c01ec36eafb4096edaae0607b0dc7e4762cb38 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:34 +0200 Subject: [PATCH 441/912] staging: rtl8192e: Rename dm_restore_dynamic_mechanism_state Use naming schema found in other rtlwifi devices. Rename dm_restore_dynamic_mechanism_state to rtl92e_dm_restore_state. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index ae8a82066f32..bdbd4bef606e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1377,7 +1377,7 @@ RESET_START: } rtl92e_cam_restore(dev); - dm_restore_dynamic_mechanism_state(dev); + rtl92e_dm_restore_state(dev); END: priv->ResetProgress = RESET_TYPE_NORESET; priv->reset_count++; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index c96ab6ee1a14..fbbeca11a7d3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1191,7 +1191,7 @@ static void dm_txpower_reset_recovery(struct net_device *dev) dm_tx_bb_gain_idx_to_amplify(priv->rfc_txpowertrackingindex)); } -void dm_restore_dynamic_mechanism_state(struct net_device *dev) +void rtl92e_dm_restore_state(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); u32 reg_ratr = priv->rate_adaptive.last_ratr; @@ -1199,7 +1199,7 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev) if (!priv->up) { RT_TRACE(COMP_RATE, - "<---- dm_restore_dynamic_mechanism_state(): driver is going to unload\n"); + "<---- rtl92e_dm_restore_state(): driver is going to unload\n"); return; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index 0b9f0852dce7..7904a11acab5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -199,7 +199,7 @@ extern void dm_txpower_trackingcallback(void *data); extern void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14); -extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); +extern void rtl92e_dm_restore_state(struct net_device *dev); extern void rtl92e_dm_backup_state(struct net_device *dev); extern void rtl92e_dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_pathcheck_workitemcallback(void *data); From 3cd4db70c6f8748c868dac83bad49426d5e31486 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:35 +0200 Subject: [PATCH 442/912] staging: rtl8192e: Rename dm_rf_pathcheck_workitemcallback Use naming schema found in other rtlwifi devices. Rename dm_rf_pathcheck_workitemcallback to rtl92e_dm_rf_pathcheck_wq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index bdbd4bef606e..43b5e90fa12a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1029,7 +1029,7 @@ static void rtl8192_init_priv_task(struct net_device *dev) INIT_DELAYED_WORK_RSL(&priv->txpower_tracking_wq, (void *)dm_txpower_trackingcallback, dev); INIT_DELAYED_WORK_RSL(&priv->rfpath_check_wq, - (void *)dm_rf_pathcheck_workitemcallback, dev); + (void *)rtl92e_dm_rf_pathcheck_wq, dev); INIT_DELAYED_WORK_RSL(&priv->update_beacon_wq, (void *)rtl8192_update_beacon, dev); INIT_WORK_RSL(&priv->qos_activate, (void *)rtl8192_qos_activate, dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index fbbeca11a7d3..04887324bfa1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1901,7 +1901,7 @@ static void dm_CheckRfCtrlGPIO(void *data) } } -void dm_rf_pathcheck_workitemcallback(void *data) +void rtl92e_dm_rf_pathcheck_wq(void *data) { struct r8192_priv *priv = container_of_dwork_rsl(data, struct r8192_priv, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index 7904a11acab5..0184cdf51fe7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -202,6 +202,6 @@ extern void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14); extern void rtl92e_dm_restore_state(struct net_device *dev); extern void rtl92e_dm_backup_state(struct net_device *dev); extern void rtl92e_dm_init_edca_turbo(struct net_device *dev); -extern void dm_rf_pathcheck_workitemcallback(void *data); +extern void rtl92e_dm_rf_pathcheck_wq(void *data); extern void rtl92e_dm_init_txpower_tracking(struct net_device *dev); #endif /*__R8192UDM_H__ */ From 33059f5435ea4a172dc61c8f09c09ee06e5f14d7 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:36 +0200 Subject: [PATCH 443/912] staging: rtl8192e: Rename dm_txpower_trackingcallback Use naming schema found in other rtlwifi devices. Rename dm_txpower_trackingcallback to rtl92e_dm_txpower_tracking_wq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 43b5e90fa12a..9dc05caef4a7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1027,7 +1027,7 @@ static void rtl8192_init_priv_task(struct net_device *dev) INIT_DELAYED_WORK_RSL(&priv->watch_dog_wq, (void *)rtl819x_watchdog_wqcallback, dev); INIT_DELAYED_WORK_RSL(&priv->txpower_tracking_wq, - (void *)dm_txpower_trackingcallback, dev); + (void *)rtl92e_dm_txpower_tracking_wq, dev); INIT_DELAYED_WORK_RSL(&priv->rfpath_check_wq, (void *)rtl92e_dm_rf_pathcheck_wq, dev); INIT_DELAYED_WORK_RSL(&priv->update_beacon_wq, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 04887324bfa1..c79f8ab1f2c8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -947,7 +947,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) priv->txpower_count = 0; } -void dm_txpower_trackingcallback(void *data) +void rtl92e_dm_txpower_tracking_wq(void *data) { struct r8192_priv *priv = container_of_dwork_rsl(data, struct r8192_priv, txpower_tracking_wq); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index 0184cdf51fe7..1fa0ff88896a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -195,7 +195,7 @@ extern void hal_dm_watchdog(struct net_device *dev); extern void init_rate_adaptive(struct net_device *dev); -extern void dm_txpower_trackingcallback(void *data); +extern void rtl92e_dm_txpower_tracking_wq(void *data); extern void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14); From 8e1e64bb66c5236153255a4ec2de77f21569c537 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:37 +0200 Subject: [PATCH 444/912] staging: rtl8192e: Rename hal_dm_watchdog Use naming schema found in other rtlwifi devices. Rename hal_dm_watchdog to rtl92e_dm_watchdog. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 9dc05caef4a7..2214e6d353c1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1438,7 +1438,7 @@ static void rtl819x_watchdog_wqcallback(void *data) priv->rtllib->CntAfterLink = 0; } - hal_dm_watchdog(dev); + rtl92e_dm_watchdog(dev); if (rtllib_act_scanning(priv->rtllib, false) == false) { if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index c79f8ab1f2c8..564b17c05d91 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -256,7 +256,7 @@ void rtl92e_dm_deinit(struct net_device *dev) } -void hal_dm_watchdog(struct net_device *dev) +void rtl92e_dm_watchdog(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index 1fa0ff88896a..7147886e830f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -191,7 +191,7 @@ extern const u8 dm_cck_tx_bb_gain_ch14[CCKTxBBGainTableLength][8]; extern void init_hal_dm(struct net_device *dev); extern void rtl92e_dm_deinit(struct net_device *dev); -extern void hal_dm_watchdog(struct net_device *dev); +extern void rtl92e_dm_watchdog(struct net_device *dev); extern void init_rate_adaptive(struct net_device *dev); From 2e3ba83a4996721b44c9cb2bcebad4e12d072416 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:38 +0200 Subject: [PATCH 445/912] staging: rtl8192e: Rename init_rate_adaptive Use naming schema found in other rtlwifi devices. Rename init_rate_adaptive to rtl92e_init_adaptive_rate. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f72b0654c7d7..6f1dcd3fe054 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -560,7 +560,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) RT_TRACE(COMP_INIT, "\n2T4R config\n"); } - init_rate_adaptive(dev); + rtl92e_init_adaptive_rate(dev); priv->rf_chip = RF_8256; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 564b17c05d91..b60003518d69 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -234,7 +234,7 @@ void init_hal_dm(struct net_device *dev) dm_init_dynamic_txpower(dev); - init_rate_adaptive(dev); + rtl92e_init_adaptive_rate(dev); dm_dig_init(dev); rtl92e_dm_init_edca_turbo(dev); @@ -307,7 +307,7 @@ static void dm_check_ac_dc_power(struct net_device *dev) }; -void init_rate_adaptive(struct net_device *dev) +void rtl92e_init_adaptive_rate(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index 7147886e830f..e7a2dcf1785a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -194,7 +194,7 @@ extern void rtl92e_dm_deinit(struct net_device *dev); extern void rtl92e_dm_watchdog(struct net_device *dev); -extern void init_rate_adaptive(struct net_device *dev); +extern void rtl92e_init_adaptive_rate(struct net_device *dev); extern void rtl92e_dm_txpower_tracking_wq(void *data); extern void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14); From 68cb7b7a5918114cf9712d2bb5dc8aad7300dd58 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:39 +0200 Subject: [PATCH 446/912] staging: rtl8192e: Rename eprom_read Use naming schema found in other rtlwifi devices. Rename eprom_read to rtl92e_eeprom_read. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 26 ++++++++++--------- .../staging/rtl8192e/rtl8192e/rtl_eeprom.c | 2 +- .../staging/rtl8192e/rtl8192e/rtl_eeprom.h | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 6f1dcd3fe054..e347facda94f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -323,7 +323,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) RT_TRACE(COMP_INIT, "====> rtl8192_read_eeprom_info\n"); - EEPROMId = eprom_read(dev, 0); + EEPROMId = rtl92e_eeprom_read(dev, 0); if (EEPROMId != RTL8190_EEPROM_ID) { netdev_err(dev, "%s(): Invalid EEPROM ID: %x\n", __func__, EEPROMId); @@ -333,12 +333,14 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } if (!priv->AutoloadFailFlag) { - priv->eeprom_vid = eprom_read(dev, EEPROM_VID >> 1); - priv->eeprom_did = eprom_read(dev, EEPROM_DID >> 1); + priv->eeprom_vid = rtl92e_eeprom_read(dev, EEPROM_VID >> 1); + priv->eeprom_did = rtl92e_eeprom_read(dev, EEPROM_DID >> 1); - usValue = eprom_read(dev, (u16)(EEPROM_Customer_ID>>1)) >> 8; + usValue = rtl92e_eeprom_read(dev, + (u16)(EEPROM_Customer_ID>>1)) >> 8; priv->eeprom_CustomerID = (u8)(usValue & 0xff); - usValue = eprom_read(dev, EEPROM_ICVersion_ChannelPlan>>1); + usValue = rtl92e_eeprom_read(dev, + EEPROM_ICVersion_ChannelPlan>>1); priv->eeprom_ChannelPlan = usValue&0xff; IC_Version = (usValue & 0xff00)>>8; @@ -376,7 +378,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (!priv->AutoloadFailFlag) { for (i = 0; i < 6; i += 2) { - usValue = eprom_read(dev, + usValue = rtl92e_eeprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); *(u16 *)(&dev->dev_addr[i]) = usValue; } @@ -396,8 +398,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (priv->card_8192_version > VERSION_8190_BD) { if (!priv->AutoloadFailFlag) { - tempval = (eprom_read(dev, (EEPROM_RFInd_PowerDiff >> - 1))) & 0xff; + tempval = (rtl92e_eeprom_read(dev, + (EEPROM_RFInd_PowerDiff >> 1))) & 0xff; priv->EEPROMLegacyHTTxPowerDiff = tempval & 0xf; if (tempval&0x80) @@ -411,7 +413,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->EEPROMLegacyHTTxPowerDiff); if (!priv->AutoloadFailFlag) - priv->EEPROMThermalMeter = (u8)(((eprom_read(dev, + priv->EEPROMThermalMeter = (u8)(((rtl92e_eeprom_read(dev, (EEPROM_ThermalMeter>>1))) & 0xff00)>>8); else @@ -422,7 +424,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (priv->epromtype == EEPROM_93C46) { if (!priv->AutoloadFailFlag) { - usValue = eprom_read(dev, + usValue = rtl92e_eeprom_read(dev, EEPROM_TxPwDiff_CrystalCap >> 1); priv->EEPROMAntPwDiff = (usValue&0x0fff); priv->EEPROMCrystalCap = (u8)((usValue & 0xf000) @@ -440,7 +442,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) for (i = 0; i < 14; i += 2) { if (!priv->AutoloadFailFlag) - usValue = eprom_read(dev, + usValue = rtl92e_eeprom_read(dev, (u16)((EEPROM_TxPwIndex_CCK + i) >> 1)); else @@ -456,7 +458,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } for (i = 0; i < 14; i += 2) { if (!priv->AutoloadFailFlag) - usValue = eprom_read(dev, + usValue = rtl92e_eeprom_read(dev, (u16)((EEPROM_TxPwIndex_OFDM_24G + i) >> 1)); else diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c index f58534609691..ed54193b019a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c @@ -87,7 +87,7 @@ static void eprom_send_bits_string(struct net_device *dev, short b[], int len) } } -u32 eprom_read(struct net_device *dev, u32 addr) +u32 rtl92e_eeprom_read(struct net_device *dev, u32 addr) { struct r8192_priv *priv = rtllib_priv(dev); short read_cmd[] = {1, 1, 0}; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h index adea2b4c7a44..8d23aea5fb4f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h @@ -26,4 +26,4 @@ #define EPROM_DELAY 10 -u32 eprom_read(struct net_device *dev, u32 addr); +u32 rtl92e_eeprom_read(struct net_device *dev, u32 addr); From e250592ed93a12eecc42ed590f5a8245a20ab994 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:40 +0200 Subject: [PATCH 447/912] staging: rtl8192e: Rename rtl8192_pci_findadapter Use naming schema found in other rtlwifi devices. Rename rtl8192_pci_findadapter to rtl92e_check_adapter. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_pci.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 2214e6d353c1..06f8d84f9112 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2670,7 +2670,7 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, priv->ops = ops; - if (rtl8192_pci_findadapter(pdev, dev) == false) + if (rtl92e_check_adapter(pdev, dev) == false) goto err_rel_mem; dev->irq = pdev->irq; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c index 6bbd1c626e24..9fcb099e6edd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c @@ -45,7 +45,7 @@ static void rtl8192_parse_pci_configuration(struct pci_dev *pdev, pci_write_config_byte(pdev, 0x70f, tmp); } -bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev) +bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); u16 VenderID; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h index e8d5527a5f04..6246841bde15 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h @@ -29,6 +29,6 @@ #include struct net_device; -bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev); +bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev); #endif From 0ba6623df9e2d349586b592b809e26b12d3da416 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:41 +0200 Subject: [PATCH 448/912] staging: rtl8192e: Rename rtl8192E_resume Use naming schema found in other rtlwifi devices. Rename rtl8192E_resume to rtl92e_resume. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 06f8d84f9112..1e3d646c0f39 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -84,7 +84,7 @@ static struct pci_driver rtl8192_pci_driver = { .probe = rtl8192_pci_probe, /* probe fn */ .remove = rtl8192_pci_disconnect, /* remove fn */ .suspend = rtl8192E_suspend, /* PM suspend fn */ - .resume = rtl8192E_resume, /* PM resume fn */ + .resume = rtl92e_resume, /* PM resume fn */ }; static short rtl8192_is_tx_queue_empty(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index d4d489c35e93..52b3617a4b02 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -70,7 +70,7 @@ out_pci_suspend: return 0; } -int rtl8192E_resume(struct pci_dev *pdev) +int rtl92e_resume(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h index 7bfe44817f23..90ca080c07fd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h @@ -24,6 +24,6 @@ #include int rtl8192E_suspend(struct pci_dev *dev, pm_message_t state); -int rtl8192E_resume(struct pci_dev *dev); +int rtl92e_resume(struct pci_dev *dev); #endif From 3683dc1f08f81ce69d5f405bf78c55775996dcf4 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:42 +0200 Subject: [PATCH 449/912] staging: rtl8192e: Rename rtl8192E_suspend Use naming schema found in other rtlwifi devices. Rename rtl8192E_suspend to rtl92e_suspend. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 1e3d646c0f39..c1af8adda20c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -83,7 +83,7 @@ static struct pci_driver rtl8192_pci_driver = { .id_table = rtl8192_pci_id_tbl, /* PCI_ID table */ .probe = rtl8192_pci_probe, /* probe fn */ .remove = rtl8192_pci_disconnect, /* remove fn */ - .suspend = rtl8192E_suspend, /* PM suspend fn */ + .suspend = rtl92e_suspend, /* PM suspend fn */ .resume = rtl92e_resume, /* PM resume fn */ }; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index 52b3617a4b02..c224adedaf62 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -23,7 +23,7 @@ #include "rtl_pm.h" -int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) +int rtl92e_suspend(struct pci_dev *pdev, pm_message_t state) { struct net_device *dev = pci_get_drvdata(pdev); struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h index 90ca080c07fd..cdc45f7fb339 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h @@ -23,7 +23,7 @@ #include #include -int rtl8192E_suspend(struct pci_dev *dev, pm_message_t state); +int rtl92e_suspend(struct pci_dev *dev, pm_message_t state); int rtl92e_resume(struct pci_dev *dev); #endif From 410d6fc983a61dec4a514b3426e8368b2fd3fd17 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:28:43 +0200 Subject: [PATCH 450/912] staging: rtl8192e: Rename IPSEnter Use naming schema found in other rtlwifi devices. Rename IPSEnter to rtl92e_ips_enter. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index c1af8adda20c..34b1db2b2217 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1449,8 +1449,8 @@ static void rtl819x_watchdog_wqcallback(void *data) IPS_CALLBACK_NONE) && (!ieee->bNetPromiscuousMode)) { RT_TRACE(COMP_PS, - "====================>haha: IPSEnter()\n"); - IPSEnter(dev); + "====================>haha: rtl92e_ips_enter()\n"); + rtl92e_ips_enter(dev); } } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index fc4503f2a82e..5b0dbe76ea78 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -140,7 +140,7 @@ static void InactivePsWorkItemCallback(struct net_device *dev) RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <---------\n"); } -void IPSEnter(struct net_device *dev) +void rtl92e_ips_enter(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) @@ -152,7 +152,7 @@ void IPSEnter(struct net_device *dev) if (rtState == eRfOn && !pPSC->bSwRfProcessing && (priv->rtllib->state != RTLLIB_LINKED) && (priv->rtllib->iw_mode != IW_MODE_MASTER)) { - RT_TRACE(COMP_PS, "IPSEnter(): Turn off RF.\n"); + RT_TRACE(COMP_PS, "rtl92e_ips_enter(): Turn off RF.\n"); pPSC->eInactivePowerState = eRfOff; priv->isRFOff = true; priv->bInPowerSaveMode = true; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index d23c0f1d76f5..e29c57f53a18 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -37,7 +37,7 @@ void rtllib_ips_leave_wq(struct net_device *dev); void rtllib_ips_leave(struct net_device *dev); void IPSLeave_wq(void *data); -void IPSEnter(struct net_device *dev); +void rtl92e_ips_enter(struct net_device *dev); void IPSLeave(struct net_device *dev); void LeisurePSEnter(struct net_device *dev); From 2ab2aba29e1d28ecb1a211f3edbce6d65e92e05c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:47 +0200 Subject: [PATCH 451/912] staging: rtl8192e: Rename IPSLeave Use naming schema found in other rtlwifi devices. Rename IPSLeave to rtl92e_ips_leave. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 10 +++++----- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 14 ++++++++------ 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 749b5ce1b7ed..dc8c7a86bf93 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -108,7 +108,7 @@ void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex, return; } down(&priv->rtllib->ips_sem); - IPSLeave(dev); + rtl92e_ips_leave(dev); up(&priv->rtllib->ips_sem); } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 5b0dbe76ea78..bf93bf80977f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -161,7 +161,7 @@ void rtl92e_ips_enter(struct net_device *dev) } } -void IPSLeave(struct net_device *dev) +void rtl92e_ips_leave(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) @@ -172,7 +172,7 @@ void IPSLeave(struct net_device *dev) rtState = priv->rtllib->eRFPowerState; if (rtState != eRfOn && !pPSC->bSwRfProcessing && priv->rtllib->RfOffReason <= RF_CHANGE_BY_IPS) { - RT_TRACE(COMP_PS, "IPSLeave(): Turn on RF.\n"); + RT_TRACE(COMP_PS, "rtl92e_ips_leave(): Turn on RF.\n"); pPSC->eInactivePowerState = eRfOn; priv->bInPowerSaveMode = false; InactivePsWorkItemCallback(dev); @@ -188,7 +188,7 @@ void IPSLeave_wq(void *data) struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); down(&priv->rtllib->ips_sem); - IPSLeave(dev); + rtl92e_ips_leave(dev); up(&priv->rtllib->ips_sem); } @@ -206,7 +206,7 @@ void rtllib_ips_leave_wq(struct net_device *dev) __func__); return; } - netdev_info(dev, "=========>%s(): IPSLeave\n", + netdev_info(dev, "=========>%s(): rtl92e_ips_leave\n", __func__); queue_work_rsl(priv->rtllib->wq, &priv->rtllib->ips_leave_wq); @@ -219,7 +219,7 @@ void rtllib_ips_leave(struct net_device *dev) struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); down(&priv->rtllib->ips_sem); - IPSLeave(dev); + rtl92e_ips_leave(dev); up(&priv->rtllib->ips_sem); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index e29c57f53a18..b1b480ffa59f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -38,7 +38,7 @@ void rtllib_ips_leave(struct net_device *dev); void IPSLeave_wq(void *data); void rtl92e_ips_enter(struct net_device *dev); -void IPSLeave(struct net_device *dev); +void rtl92e_ips_leave(struct net_device *dev); void LeisurePSEnter(struct net_device *dev); void LeisurePSLeave(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index ebed99b3d637..dc2d7ecd7d6a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -282,10 +282,11 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, up(&priv->wx_sem); return -1; } - netdev_info(dev, "=========>%s(): IPSLeave\n", + netdev_info(dev, + "=========>%s(): rtl92e_ips_leave\n", __func__); down(&priv->rtllib->ips_sem); - IPSLeave(dev); + rtl92e_ips_leave(dev); up(&priv->rtllib->ips_sem); } } @@ -442,10 +443,11 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, up(&priv->wx_sem); return -1; } - RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n", + RT_TRACE(COMP_PS, + "=========>%s(): rtl92e_ips_leave\n", __func__); down(&priv->rtllib->ips_sem); - IPSLeave(dev); + rtl92e_ips_leave(dev); up(&priv->rtllib->ips_sem); } } @@ -700,7 +702,7 @@ static int r8192_wx_set_enc(struct net_device *dev, priv->rtllib->wx_set_enc = 1; down(&priv->rtllib->ips_sem); - IPSLeave(dev); + rtl92e_ips_leave(dev); up(&priv->rtllib->ips_sem); down(&priv->wx_sem); @@ -910,7 +912,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, priv->rtllib->wx_set_enc = 1; down(&priv->rtllib->ips_sem); - IPSLeave(dev); + rtl92e_ips_leave(dev); up(&priv->rtllib->ips_sem); ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra); From a514c798ee57d82d8332b0315dba00c6e4cb0c3e Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:48 +0200 Subject: [PATCH 452/912] staging: rtl8192e: Rename IPSLeave_wq Use naming schema found in other rtlwifi devices. Rename IPSLeave_wq to rtl92e_ips_leave_wq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 ++- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 34b1db2b2217..f89e7be71fa2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1023,7 +1023,8 @@ static void rtl8192_init_priv_task(struct net_device *dev) priv->priv_wq = create_workqueue(DRV_NAME); INIT_WORK_RSL(&priv->reset_wq, (void *)rtl8192_restart, dev); - INIT_WORK_RSL(&priv->rtllib->ips_leave_wq, (void *)IPSLeave_wq, dev); + INIT_WORK_RSL(&priv->rtllib->ips_leave_wq, (void *)rtl92e_ips_leave_wq, + dev); INIT_DELAYED_WORK_RSL(&priv->watch_dog_wq, (void *)rtl819x_watchdog_wqcallback, dev); INIT_DELAYED_WORK_RSL(&priv->txpower_tracking_wq, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index bf93bf80977f..bc86df356933 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -180,7 +180,7 @@ void rtl92e_ips_leave(struct net_device *dev) } } -void IPSLeave_wq(void *data) +void rtl92e_ips_leave_wq(void *data) { struct rtllib_device *ieee = container_of_work_rsl(data, struct rtllib_device, ips_leave_wq); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index b1b480ffa59f..eae0c8637bb2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -35,7 +35,7 @@ void rtl8192_hw_wakeup(struct net_device *dev); void rtl8192_hw_to_sleep(struct net_device *dev, u64 time); void rtllib_ips_leave_wq(struct net_device *dev); void rtllib_ips_leave(struct net_device *dev); -void IPSLeave_wq(void *data); +void rtl92e_ips_leave_wq(void *data); void rtl92e_ips_enter(struct net_device *dev); void rtl92e_ips_leave(struct net_device *dev); From 04197ef2bdfbb334de18a5d5f105acb71eef1db5 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:49 +0200 Subject: [PATCH 453/912] staging: rtl8192e: Rename LeisurePSEnter Use naming schema found in other rtlwifi devices. Rename LeisurePSEnter to rtl92e_leisure_ps_enter. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index f89e7be71fa2..bf41950117f1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1482,7 +1482,7 @@ static void rtl819x_watchdog_wqcallback(void *data) bEnterPS = false; if (bEnterPS) - LeisurePSEnter(dev); + rtl92e_leisure_ps_enter(dev); else LeisurePSLeave(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index bc86df356933..232e4fa488ce 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -251,13 +251,13 @@ static bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, return true; } -void LeisurePSEnter(struct net_device *dev) +void rtl92e_leisure_ps_enter(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) &(priv->rtllib->PowerSaveControl); - RT_TRACE(COMP_PS, "LeisurePSEnter()...\n"); + RT_TRACE(COMP_PS, "rtl92e_leisure_ps_enter()...\n"); RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdleCount is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n", pPSC->bLeisurePs, priv->rtllib->ps, pPSC->LpsIdleCount, @@ -275,7 +275,7 @@ void LeisurePSEnter(struct net_device *dev) if (priv->rtllib->ps == RTLLIB_PS_DISABLED) { RT_TRACE(COMP_LPS, - "LeisurePSEnter(): Enter 802.11 power save mode...\n"); + "rtl92e_leisure_ps_enter(): Enter 802.11 power save mode...\n"); if (!pPSC->bFwCtrlLPS) { if (priv->rtllib->SetFwCmdHandler) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index eae0c8637bb2..dd4ca28c84be 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -40,7 +40,7 @@ void rtl92e_ips_leave_wq(void *data); void rtl92e_ips_enter(struct net_device *dev); void rtl92e_ips_leave(struct net_device *dev); -void LeisurePSEnter(struct net_device *dev); +void rtl92e_leisure_ps_enter(struct net_device *dev); void LeisurePSLeave(struct net_device *dev); #endif From 9c4a55d1dac3cd17aad9944f1647e2ade5a6345f Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:50 +0200 Subject: [PATCH 454/912] staging: rtl8192e: Rename LeisurePSLeave Use naming schema found in other rtlwifi devices. Rename LeisurePSLeave to rtl92e_leisure_ps_leave. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 10 +++++----- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index bf41950117f1..f5dcd026c7d4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -811,7 +811,7 @@ static int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) priv->rtllib->rtllib_ips_leave(dev); if (priv->rtllib->state == RTLLIB_LINKED) - LeisurePSLeave(dev); + rtl92e_leisure_ps_leave(dev); priv->bDriverIsGoingToUnload = true; priv->up = 0; @@ -875,7 +875,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->handle_assoc_response = rtl8192_handle_assoc_response; priv->rtllib->handle_beacon = rtl8192_handle_beacon; priv->rtllib->SetWirelessMode = rtl92e_set_wireless_mode; - priv->rtllib->LeisurePSLeave = LeisurePSLeave; + priv->rtllib->LeisurePSLeave = rtl92e_leisure_ps_leave; priv->rtllib->SetBWModeHandler = rtl92e_set_bw_mode; priv->rf_set_chan = rtl92e_set_channel; @@ -1282,7 +1282,7 @@ RESET_START: down(&priv->wx_sem); if (priv->rtllib->state == RTLLIB_LINKED) - LeisurePSLeave(dev); + rtl92e_leisure_ps_leave(dev); if (priv->up) { netdev_info(dev, "%s():the driver is not up.\n", @@ -1484,11 +1484,11 @@ static void rtl819x_watchdog_wqcallback(void *data) if (bEnterPS) rtl92e_leisure_ps_enter(dev); else - LeisurePSLeave(dev); + rtl92e_leisure_ps_leave(dev); } else { RT_TRACE(COMP_LPS, "====>no link LPS leave\n"); - LeisurePSLeave(dev); + rtl92e_leisure_ps_leave(dev); } ieee->LinkDetectInfo.NumRxOkInPeriod = 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 232e4fa488ce..cd117f549387 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -291,21 +291,21 @@ void rtl92e_leisure_ps_enter(struct net_device *dev) } } -void LeisurePSLeave(struct net_device *dev) +void rtl92e_leisure_ps_leave(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) &(priv->rtllib->PowerSaveControl); - RT_TRACE(COMP_PS, "LeisurePSLeave()...\n"); + RT_TRACE(COMP_PS, "rtl92e_leisure_ps_leave()...\n"); RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d\n", pPSC->bLeisurePs, priv->rtllib->ps); if (pPSC->bLeisurePs) { if (priv->rtllib->ps != RTLLIB_PS_DISABLED) { RT_TRACE(COMP_LPS, - "LeisurePSLeave(): Busy Traffic , Leave 802.11 power save..\n"); + "rtl92e_leisure_ps_leave(): Busy Traffic , Leave 802.11 power save..\n"); MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_DISABLED); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index dd4ca28c84be..250d5245e5c5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -41,6 +41,6 @@ void rtl92e_ips_enter(struct net_device *dev); void rtl92e_ips_leave(struct net_device *dev); void rtl92e_leisure_ps_enter(struct net_device *dev); -void LeisurePSLeave(struct net_device *dev); +void rtl92e_leisure_ps_leave(struct net_device *dev); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index dc2d7ecd7d6a..183d1b2e64f1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -192,7 +192,7 @@ static int r8192_wx_adapter_power_status(struct net_device *dev, pPSC->bLeisurePs = true; } else { if (priv->rtllib->state == RTLLIB_LINKED) - LeisurePSLeave(dev); + rtl92e_leisure_ps_leave(dev); priv->ps_force = true; pPSC->bLeisurePs = false; From bcdcc1ea06be6851c5dfd885e9ac3b1388bbd36b Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:51 +0200 Subject: [PATCH 455/912] staging: rtl8192e: Rename rtl8192_hw_sleep_wq Use naming schema found in other rtlwifi devices. Rename rtl8192_hw_sleep_wq to rtl92e_hw_sleep_wq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index f5dcd026c7d4..5fc2103a0352 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1037,7 +1037,7 @@ static void rtl8192_init_priv_task(struct net_device *dev) INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq, (void *) rtl8192_hw_wakeup_wq, dev); INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq, - (void *) rtl8192_hw_sleep_wq, dev); + (void *) rtl92e_hw_sleep_wq, dev); tasklet_init(&priv->irq_rx_tasklet, (void(*)(unsigned long))rtl8192_irq_rx_tasklet, (unsigned long)priv); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 4938be77c7b1..397e93c3e224 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -590,7 +590,7 @@ void force_pci_posting(struct net_device *dev); void rtl92e_rx_enable(struct net_device *); void rtl92e_tx_enable(struct net_device *); -void rtl8192_hw_sleep_wq(void *data); +void rtl92e_hw_sleep_wq(void *data); void rtl92e_commit(struct net_device *dev); void rtl92e_check_rfctrl_gpio_timer(unsigned long data); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index cd117f549387..6bdd0f2ff741 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -48,7 +48,7 @@ static void rtl8192_hw_sleep_down(struct net_device *dev) rtl92e_set_rf_state(dev, eRfSleep, RF_CHANGE_BY_PS, false); } -void rtl8192_hw_sleep_wq(void *data) +void rtl92e_hw_sleep_wq(void *data) { struct rtllib_device *ieee = container_of_dwork_rsl(data, struct rtllib_device, hw_sleep_wq); From feb257e5f9982821dcafe7f190d810a418cd2076 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:52 +0200 Subject: [PATCH 456/912] staging: rtl8192e: Rename rtl8192_hw_to_sleep Use naming schema found in other rtlwifi devices. Rename rtl8192_hw_to_sleep to rtl92e_enter_sleep. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 5fc2103a0352..ca18640009a9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -883,7 +883,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->stop_send_beacons = rtl8192_stop_beacon; priv->rtllib->sta_wake_up = rtl8192_hw_wakeup; - priv->rtllib->enter_sleep_state = rtl8192_hw_to_sleep; + priv->rtllib->enter_sleep_state = rtl92e_enter_sleep; priv->rtllib->ps_is_queue_empty = rtl8192_is_tx_queue_empty; priv->rtllib->GetNmodeSupportBySecCfg = rtl92e_get_nmode_support_by_sec; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 6bdd0f2ff741..327b2b83ed3c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -88,7 +88,7 @@ void rtl8192_hw_wakeup_wq(void *data) #define MIN_SLEEP_TIME 50 #define MAX_SLEEP_TIME 10000 -void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) +void rtl92e_enter_sleep(struct net_device *dev, u64 time) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index 250d5245e5c5..a962e7f5833c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -32,7 +32,7 @@ struct net_device; #define RT_CHECK_FOR_HANG_PERIOD 2 void rtl8192_hw_wakeup(struct net_device *dev); -void rtl8192_hw_to_sleep(struct net_device *dev, u64 time); +void rtl92e_enter_sleep(struct net_device *dev, u64 time); void rtllib_ips_leave_wq(struct net_device *dev); void rtllib_ips_leave(struct net_device *dev); void rtl92e_ips_leave_wq(void *data); From 43bcb3b4c78585a9cd7741b49e272fae989074ba Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:53 +0200 Subject: [PATCH 457/912] staging: rtl8192e: Rename rtl8192_hw_wakeup Use naming schema found in other rtlwifi devices. Rename rtl8192_hw_wakeup to rtl92e_hw_wakeup. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 8 ++++---- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index ca18640009a9..0dc401e5e3dd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -882,7 +882,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->start_send_beacons = rtl92e_start_beacon; priv->rtllib->stop_send_beacons = rtl8192_stop_beacon; - priv->rtllib->sta_wake_up = rtl8192_hw_wakeup; + priv->rtllib->sta_wake_up = rtl92e_hw_wakeup; priv->rtllib->enter_sleep_state = rtl92e_enter_sleep; priv->rtllib->ps_is_queue_empty = rtl8192_is_tx_queue_empty; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 327b2b83ed3c..6ea7e7acd6a9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -57,7 +57,7 @@ void rtl92e_hw_sleep_wq(void *data) rtl8192_hw_sleep_down(dev); } -void rtl8192_hw_wakeup(struct net_device *dev) +void rtl92e_hw_wakeup(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); unsigned long flags = 0; @@ -66,7 +66,7 @@ void rtl8192_hw_wakeup(struct net_device *dev) if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock, flags); RT_TRACE(COMP_DBG, - "rtl8192_hw_wakeup(): RF Change in progress!\n"); + "rtl92e_hw_wakeup(): RF Change in progress!\n"); queue_delayed_work_rsl(priv->rtllib->wq, &priv->rtllib->hw_wakeup_wq, msecs_to_jiffies(10)); @@ -83,7 +83,7 @@ void rtl8192_hw_wakeup_wq(void *data) struct rtllib_device, hw_wakeup_wq); struct net_device *dev = ieee->dev; - rtl8192_hw_wakeup(dev); + rtl92e_hw_wakeup(dev); } #define MIN_SLEEP_TIME 50 @@ -238,7 +238,7 @@ static bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, rtPsMode == RTLLIB_PS_DISABLED) { unsigned long flags; - rtl8192_hw_wakeup(dev); + rtl92e_hw_wakeup(dev); priv->rtllib->sta_sleep = LPS_IS_WAKE; spin_lock_irqsave(&(priv->rtllib->mgmt_tx_lock), flags); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index a962e7f5833c..1a8d1bfa3745 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -31,7 +31,7 @@ struct net_device; #define RT_CHECK_FOR_HANG_PERIOD 2 -void rtl8192_hw_wakeup(struct net_device *dev); +void rtl92e_hw_wakeup(struct net_device *dev); void rtl92e_enter_sleep(struct net_device *dev, u64 time); void rtllib_ips_leave_wq(struct net_device *dev); void rtllib_ips_leave(struct net_device *dev); From c34b29f7c8dcaabc42eae8b4ce81a8ec82d9d1f9 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:54 +0200 Subject: [PATCH 458/912] staging: rtl8192e: Rename rtl8192_hw_wakeup_wq Use naming schema found in other rtlwifi devices. Rename rtl8192_hw_wakeup_wq to rtl92e_hw_wakeup_wq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 0dc401e5e3dd..d8729071d5de 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1035,7 +1035,7 @@ static void rtl8192_init_priv_task(struct net_device *dev) (void *)rtl8192_update_beacon, dev); INIT_WORK_RSL(&priv->qos_activate, (void *)rtl8192_qos_activate, dev); INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq, - (void *) rtl8192_hw_wakeup_wq, dev); + (void *) rtl92e_hw_wakeup_wq, dev); INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq, (void *) rtl92e_hw_sleep_wq, dev); tasklet_init(&priv->irq_rx_tasklet, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 397e93c3e224..20df4e20edf2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -595,7 +595,7 @@ void rtl92e_commit(struct net_device *dev); void rtl92e_check_rfctrl_gpio_timer(unsigned long data); -void rtl8192_hw_wakeup_wq(void *data); +void rtl92e_hw_wakeup_wq(void *data); void rtl92e_reset_desc_ring(struct net_device *dev); void rtl92e_set_wireless_mode(struct net_device *dev, u8 wireless_mode); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 6ea7e7acd6a9..be5961d7c1ab 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -77,7 +77,7 @@ void rtl92e_hw_wakeup(struct net_device *dev) rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_PS, false); } -void rtl8192_hw_wakeup_wq(void *data) +void rtl92e_hw_wakeup_wq(void *data) { struct rtllib_device *ieee = container_of_dwork_rsl(data, struct rtllib_device, hw_wakeup_wq); From bf135a16c5babbf51674431c7c7f73761c846f43 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:55 +0200 Subject: [PATCH 459/912] staging: rtl8192e: Rename rtllib_ips_leave Use naming schema found in other rtlwifi devices. Rename rtllib_ips_leave to rtl92e_rtllib_ips_leave. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index d8729071d5de..d5dbf4f5c7be 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -895,7 +895,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->SetFwCmdHandler = NULL; priv->rtllib->InitialGainHandler = rtl92e_init_gain; priv->rtllib->rtllib_ips_leave_wq = rtllib_ips_leave_wq; - priv->rtllib->rtllib_ips_leave = rtllib_ips_leave; + priv->rtllib->rtllib_ips_leave = rtl92e_rtllib_ips_leave; priv->rtllib->LedControlHandler = NULL; priv->rtllib->UpdateBeaconInterruptHandler = NULL; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index be5961d7c1ab..3dff7dbad259 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -214,7 +214,7 @@ void rtllib_ips_leave_wq(struct net_device *dev) } } -void rtllib_ips_leave(struct net_device *dev) +void rtl92e_rtllib_ips_leave(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index 1a8d1bfa3745..f789af79be21 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -34,7 +34,7 @@ struct net_device; void rtl92e_hw_wakeup(struct net_device *dev); void rtl92e_enter_sleep(struct net_device *dev, u64 time); void rtllib_ips_leave_wq(struct net_device *dev); -void rtllib_ips_leave(struct net_device *dev); +void rtl92e_rtllib_ips_leave(struct net_device *dev); void rtl92e_ips_leave_wq(void *data); void rtl92e_ips_enter(struct net_device *dev); From d66e938e1b5b40dc0d9f8f47d66f737e386b44ee Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:56 +0200 Subject: [PATCH 460/912] staging: rtl8192e: Rename rtllib_ips_leave_wq Use naming schema found in other rtlwifi devices. Rename rtllib_ips_leave_wq to rtl92e_rtllib_ips_leave_wq. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index d5dbf4f5c7be..1a7b6c7c2a0e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -894,7 +894,7 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->AllowAllDestAddrHandler = rtl92e_set_monitor_mode; priv->rtllib->SetFwCmdHandler = NULL; priv->rtllib->InitialGainHandler = rtl92e_init_gain; - priv->rtllib->rtllib_ips_leave_wq = rtllib_ips_leave_wq; + priv->rtllib->rtllib_ips_leave_wq = rtl92e_rtllib_ips_leave_wq; priv->rtllib->rtllib_ips_leave = rtl92e_rtllib_ips_leave; priv->rtllib->LedControlHandler = NULL; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 3dff7dbad259..38addad24f18 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -192,7 +192,7 @@ void rtl92e_ips_leave_wq(void *data) up(&priv->rtllib->ips_sem); } -void rtllib_ips_leave_wq(struct net_device *dev) +void rtl92e_rtllib_ips_leave_wq(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); enum rt_rf_power_state rtState; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index f789af79be21..35fc9e2a3365 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -33,7 +33,7 @@ struct net_device; void rtl92e_hw_wakeup(struct net_device *dev); void rtl92e_enter_sleep(struct net_device *dev, u64 time); -void rtllib_ips_leave_wq(struct net_device *dev); +void rtl92e_rtllib_ips_leave_wq(struct net_device *dev); void rtl92e_rtllib_ips_leave(struct net_device *dev); void rtl92e_ips_leave_wq(void *data); From b8216b690d52f3cde4ab94c05f8772d0acdab57d Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:57 +0200 Subject: [PATCH 461/912] staging: rtl8192e: Rename init_firmware Use naming schema found in other rtlwifi devices. Rename init_firmware to rtl92e_init_fw. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index e347facda94f..1013101309e8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -852,7 +852,7 @@ start: } RT_TRACE(COMP_INIT, "Load Firmware!\n"); - bfirmwareok = init_firmware(dev); + bfirmwareok = rtl92e_init_fw(dev); if (!bfirmwareok) { if (retry_times < 10) { retry_times++; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 37e5c1403a7e..5c527c419bc9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -223,7 +223,7 @@ static bool firmware_check_ready(struct net_device *dev, return rt_status; } -bool init_firmware(struct net_device *dev) +bool rtl92e_init_fw(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); bool rt_status = true; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h index 131ea005edff..4c464eaee69f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h @@ -59,7 +59,7 @@ struct rt_firmware { u16 firmware_buf_size[MAX_FW_INIT_STEP]; }; -bool init_firmware(struct net_device *dev); +bool rtl92e_init_fw(struct net_device *dev); extern void rtl92e_init_fw_param(struct net_device *dev); #endif From ab7435982254d26cbc9af225065e0a6a94566269 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 19 Jul 2015 19:33:58 +0200 Subject: [PATCH 462/912] staging: rtl8192e: Rename init_hal_dm Use naming schema found in other rtlwifi devices. Rename init_hal_dm to rtl92e_dm_init. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 1a7b6c7c2a0e..f0e175def6a4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1093,7 +1093,7 @@ static short rtl8192_init(struct net_device *dev) priv->ops->init_adapter_variable(dev); rtl8192_get_channel_map(dev); - init_hal_dm(dev); + rtl92e_dm_init(dev); setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index b60003518d69..458097ee09e7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -224,7 +224,7 @@ static void dm_send_rssi_tofw(struct net_device *dev); static void dm_ctstoself(struct net_device *dev); /*---------------------------Define function prototype------------------------*/ -void init_hal_dm(struct net_device *dev) +void rtl92e_dm_init(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index e7a2dcf1785a..e16502d12cdc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -188,7 +188,7 @@ extern const u8 dm_cck_tx_bb_gain_ch14[CCKTxBBGainTableLength][8]; /*--------------------------Exported Function prototype---------------------*/ /*--------------------------Exported Function prototype---------------------*/ -extern void init_hal_dm(struct net_device *dev); +extern void rtl92e_dm_init(struct net_device *dev); extern void rtl92e_dm_deinit(struct net_device *dev); extern void rtl92e_dm_watchdog(struct net_device *dev); From c176becd81843426eb8ab3b03aeeb19e387345fe Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Fri, 5 Jun 2015 16:59:42 +0300 Subject: [PATCH 463/912] iio: fix drivers that consider 0 as a valid IRQ in client->irq Since patch "i2c / ACPI: Use 0 to indicate that device does not have interrupt assigned" [1], 0 is not a valid i2c client irq anymore, so change all driver's checks accordingly. The same issue occurs when the device is instantiated via device tree with no IRQ, or from the i2c sysfs interface, even before the patch above. [1] http://lkml.kernel.org/g/<1430908148-201129-3-git-send-email-mika.westerberg@linux.intel.com> Signed-off-by: Octavian Purdila Reviewed-by: Mika Westerberg Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bmc150-accel.c | 2 +- drivers/iio/accel/kxcjk-1013.c | 2 +- drivers/iio/accel/mma9553.c | 2 +- drivers/iio/imu/kmx61.c | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index 47c6013ab376..21b665fc0739 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c @@ -1670,7 +1670,7 @@ static int bmc150_accel_probe(struct i2c_client *client, if (client->irq < 0) client->irq = bmc150_accel_gpio_probe(client, data); - if (client->irq >= 0) { + if (client->irq > 0) { ret = devm_request_threaded_irq( &client->dev, client->irq, bmc150_accel_irq_handler, diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 8128579bff79..3292bc0c1d0e 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1240,7 +1240,7 @@ static int kxcjk1013_probe(struct i2c_client *client, if (client->irq < 0) client->irq = kxcjk1013_gpio_probe(client, data); - if (client->irq >= 0) { + if (client->irq > 0) { ret = devm_request_threaded_irq(&client->dev, client->irq, kxcjk1013_data_rdy_trig_poll, kxcjk1013_event_handler, diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index a605280637e9..771858cb67a1 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -1149,7 +1149,7 @@ static int mma9553_probe(struct i2c_client *client, if (client->irq < 0) client->irq = mma9553_gpio_probe(client); - if (client->irq >= 0) { + if (client->irq > 0) { ret = devm_request_threaded_irq(&client->dev, client->irq, mma9553_irq_handler, mma9553_event_handler, diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c index 462a010628cd..82cdf5090fa7 100644 --- a/drivers/iio/imu/kmx61.c +++ b/drivers/iio/imu/kmx61.c @@ -1363,7 +1363,7 @@ static int kmx61_probe(struct i2c_client *client, if (client->irq < 0) client->irq = kmx61_gpio_probe(client, data); - if (client->irq >= 0) { + if (client->irq > 0) { ret = devm_request_threaded_irq(&client->dev, client->irq, kmx61_data_rdy_trig_poll, kmx61_event_handler, @@ -1445,10 +1445,10 @@ err_iio_unregister_mag: err_iio_unregister_acc: iio_device_unregister(data->acc_indio_dev); err_buffer_cleanup_mag: - if (client->irq >= 0) + if (client->irq > 0) iio_triggered_buffer_cleanup(data->mag_indio_dev); err_buffer_cleanup_acc: - if (client->irq >= 0) + if (client->irq > 0) iio_triggered_buffer_cleanup(data->acc_indio_dev); err_trigger_unregister_motion: iio_trigger_unregister(data->motion_trig); @@ -1472,7 +1472,7 @@ static int kmx61_remove(struct i2c_client *client) iio_device_unregister(data->acc_indio_dev); iio_device_unregister(data->mag_indio_dev); - if (client->irq >= 0) { + if (client->irq > 0) { iio_triggered_buffer_cleanup(data->acc_indio_dev); iio_triggered_buffer_cleanup(data->mag_indio_dev); iio_trigger_unregister(data->acc_dready_trig); From bc27381edbeb654d819b7e1464091c456a0d3e64 Mon Sep 17 00:00:00 2001 From: Giuseppe Barba Date: Tue, 21 Jul 2015 10:35:41 +0200 Subject: [PATCH 464/912] iio: st-sensors: add configuration for WhoAmI address This patch permits to configure the WhoAmI register address because some device could have not a standard address for this register. Signed-off-by: Giuseppe Barba Reviewed-by: Denis Ciocca Acked-by: Denis Ciocca Signed-off-by: Jonathan Cameron --- drivers/iio/accel/st_accel_core.c | 5 ++ .../iio/common/st_sensors/st_sensors_core.c | 49 +++++++++---------- drivers/iio/gyro/st_gyro_core.c | 3 ++ drivers/iio/magnetometer/st_magn_core.c | 3 ++ drivers/iio/pressure/st_pressure_core.c | 3 ++ include/linux/iio/common/st_sensors.h | 2 + 6 files changed, 39 insertions(+), 26 deletions(-) diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index 4002e6410444..12b42f6e70ab 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -226,6 +226,7 @@ static const struct iio_chan_spec st_accel_16bit_channels[] = { static const struct st_sensor_settings st_accel_sensors_settings[] = { { .wai = ST_ACCEL_1_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LIS3DH_ACCEL_DEV_NAME, [1] = LSM303DLHC_ACCEL_DEV_NAME, @@ -297,6 +298,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { }, { .wai = ST_ACCEL_2_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LIS331DLH_ACCEL_DEV_NAME, [1] = LSM303DL_ACCEL_DEV_NAME, @@ -359,6 +361,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { }, { .wai = ST_ACCEL_3_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LSM330_ACCEL_DEV_NAME, }, @@ -437,6 +440,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { }, { .wai = ST_ACCEL_4_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LIS3LV02DL_ACCEL_DEV_NAME, }, @@ -494,6 +498,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { }, { .wai = ST_ACCEL_5_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LIS331DL_ACCEL_DEV_NAME, }, diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 8086cbcff87d..d44bf1680859 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -479,46 +479,43 @@ int st_sensors_check_device_support(struct iio_dev *indio_dev, int num_sensors_list, const struct st_sensor_settings *sensor_settings) { - u8 wai; int i, n, err; + u8 wai; struct st_sensor_data *sdata = iio_priv(indio_dev); + for (i = 0; i < num_sensors_list; i++) { + for (n = 0; n < ST_SENSORS_MAX_4WAI; n++) { + if (strcmp(indio_dev->name, + sensor_settings[i].sensors_supported[n]) == 0) { + break; + } + } + if (n < ST_SENSORS_MAX_4WAI) + break; + } + if (i == num_sensors_list) { + dev_err(&indio_dev->dev, "device name %s not recognized.\n", + indio_dev->name); + return -ENODEV; + } + err = sdata->tf->read_byte(&sdata->tb, sdata->dev, - ST_SENSORS_DEFAULT_WAI_ADDRESS, &wai); + sensor_settings[i].wai_addr, &wai); if (err < 0) { dev_err(&indio_dev->dev, "failed to read Who-Am-I register.\n"); - goto read_wai_error; + return err; } - for (i = 0; i < num_sensors_list; i++) { - if (sensor_settings[i].wai == wai) - break; - } - if (i == num_sensors_list) - goto device_not_supported; - - for (n = 0; n < ARRAY_SIZE(sensor_settings[i].sensors_supported); n++) { - if (strcmp(indio_dev->name, - &sensor_settings[i].sensors_supported[n][0]) == 0) - break; - } - if (n == ARRAY_SIZE(sensor_settings[i].sensors_supported)) { - dev_err(&indio_dev->dev, "device name \"%s\" and WhoAmI (0x%02x) mismatch", - indio_dev->name, wai); - goto sensor_name_mismatch; + if (sensor_settings[i].wai != wai) { + dev_err(&indio_dev->dev, "%s: WhoAmI mismatch (0x%x).\n", + indio_dev->name, wai); + return -EINVAL; } sdata->sensor_settings = (struct st_sensor_settings *)&sensor_settings[i]; return i; - -device_not_supported: - dev_err(&indio_dev->dev, "device not supported: WhoAmI (0x%x).\n", wai); -sensor_name_mismatch: - err = -ENODEV; -read_wai_error: - return err; } EXPORT_SYMBOL(st_sensors_check_device_support); diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index ffe96642b6d0..4b993a5bc9a1 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c @@ -131,6 +131,7 @@ static const struct iio_chan_spec st_gyro_16bit_channels[] = { static const struct st_sensor_settings st_gyro_sensors_settings[] = { { .wai = ST_GYRO_1_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = L3G4200D_GYRO_DEV_NAME, [1] = LSM330DL_GYRO_DEV_NAME, @@ -190,6 +191,7 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { }, { .wai = ST_GYRO_2_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = L3GD20_GYRO_DEV_NAME, [1] = LSM330D_GYRO_DEV_NAME, @@ -252,6 +254,7 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { }, { .wai = ST_GYRO_3_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = L3GD20_GYRO_DEV_NAME, }, diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index b4bcfb790f49..8d7d3a172874 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c @@ -192,6 +192,7 @@ static const struct iio_chan_spec st_magn_2_16bit_channels[] = { static const struct st_sensor_settings st_magn_sensors_settings[] = { { .wai = 0, /* This sensor has no valid WhoAmI report 0 */ + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LSM303DLH_MAGN_DEV_NAME, }, @@ -268,6 +269,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { }, { .wai = ST_MAGN_1_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LSM303DLHC_MAGN_DEV_NAME, [1] = LSM303DLM_MAGN_DEV_NAME, @@ -346,6 +348,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { }, { .wai = ST_MAGN_2_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LIS3MDL_MAGN_DEV_NAME, }, diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index e881fa6291e9..eb41d2b92c24 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -178,6 +178,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { static const struct st_sensor_settings st_press_sensors_settings[] = { { .wai = ST_PRESS_LPS331AP_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LPS331AP_PRESS_DEV_NAME, }, @@ -225,6 +226,7 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { }, { .wai = ST_PRESS_LPS001WP_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LPS001WP_PRESS_DEV_NAME, }, @@ -260,6 +262,7 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { }, { .wai = ST_PRESS_LPS25H_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LPS25H_PRESS_DEV_NAME, }, diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 2c476acb87d9..3c17cd7fdf06 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h @@ -166,6 +166,7 @@ struct st_sensor_transfer_function { /** * struct st_sensor_settings - ST specific sensor settings * @wai: Contents of WhoAmI register. + * @wai_addr: The address of WhoAmI register. * @sensors_supported: List of supported sensors by struct itself. * @ch: IIO channels for the sensor. * @odr: Output data rate register and ODR list available. @@ -179,6 +180,7 @@ struct st_sensor_transfer_function { */ struct st_sensor_settings { u8 wai; + u8 wai_addr; char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME]; struct iio_chan_spec *ch; int num_ch; From bb602f8c61e289389e7c2af1b577303a841f6d34 Mon Sep 17 00:00:00 2001 From: Giuseppe Barba Date: Tue, 21 Jul 2015 10:35:42 +0200 Subject: [PATCH 465/912] iio: st-sensors: add support for single full scale device Some sensors could have only one full scale value. This means that the sensor hasn't a full scale register. This commit add a check on the configured full scale address to support such kind of sensors. Signed-off-by: Giuseppe Barba Acked-by: Denis Ciocca Signed-off-by: Jonathan Cameron --- drivers/iio/common/st_sensors/st_sensors_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index d44bf1680859..2e7fdb502645 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -126,6 +126,9 @@ static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs) int err, i = 0; struct st_sensor_data *sdata = iio_priv(indio_dev); + if (sdata->sensor_settings->fs.addr == 0) + return 0; + err = st_sensors_match_fs(sdata->sensor_settings, fs, &i); if (err < 0) goto st_accel_set_fullscale_error; From 74f5683f35fe6feae33b96815c1d40f13468d614 Mon Sep 17 00:00:00 2001 From: Giuseppe Barba Date: Tue, 21 Jul 2015 10:35:43 +0200 Subject: [PATCH 466/912] iio: st_magn: Add irq trigger handling Add irq trigger handling for magnetometer also Signed-off-by: Giuseppe Barba Acked-by: Denis Ciocca Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/st_magn.h | 2 ++ drivers/iio/magnetometer/st_magn_buffer.c | 7 +++++++ drivers/iio/magnetometer/st_magn_core.c | 13 ++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/st_magn.h b/drivers/iio/magnetometer/st_magn.h index 287691ca56c1..604410236d99 100644 --- a/drivers/iio/magnetometer/st_magn.h +++ b/drivers/iio/magnetometer/st_magn.h @@ -25,6 +25,8 @@ void st_magn_common_remove(struct iio_dev *indio_dev); #ifdef CONFIG_IIO_BUFFER int st_magn_allocate_ring(struct iio_dev *indio_dev); void st_magn_deallocate_ring(struct iio_dev *indio_dev); +int st_magn_trig_set_state(struct iio_trigger *trig, bool state); +#define ST_MAGN_TRIGGER_SET_STATE (&st_magn_trig_set_state) #else /* CONFIG_IIO_BUFFER */ static inline int st_magn_probe_trigger(struct iio_dev *indio_dev, int irq) { diff --git a/drivers/iio/magnetometer/st_magn_buffer.c b/drivers/iio/magnetometer/st_magn_buffer.c index bf427dc0d226..ecd3bd0a9769 100644 --- a/drivers/iio/magnetometer/st_magn_buffer.c +++ b/drivers/iio/magnetometer/st_magn_buffer.c @@ -23,6 +23,13 @@ #include #include "st_magn.h" +int st_magn_trig_set_state(struct iio_trigger *trig, bool state) +{ + struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); + + return st_sensors_set_dataready_irq(indio_dev, state); +} + static int st_magn_buffer_preenable(struct iio_dev *indio_dev) { return st_sensors_set_enable(indio_dev, true); diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 8d7d3a172874..4c0cef865517 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c @@ -480,6 +480,16 @@ static const struct iio_info magn_info = { .write_raw = &st_magn_write_raw, }; +#ifdef CONFIG_IIO_TRIGGER +static const struct iio_trigger_ops st_magn_trigger_ops = { + .owner = THIS_MODULE, + .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE, +}; +#define ST_MAGN_TRIGGER_OPS (&st_magn_trigger_ops) +#else +#define ST_MAGN_TRIGGER_OPS NULL +#endif + int st_magn_common_probe(struct iio_dev *indio_dev) { struct st_sensor_data *mdata = iio_priv(indio_dev); @@ -516,7 +526,8 @@ int st_magn_common_probe(struct iio_dev *indio_dev) return err; if (irq > 0) { - err = st_sensors_allocate_trigger(indio_dev, NULL); + err = st_sensors_allocate_trigger(indio_dev, + ST_MAGN_TRIGGER_OPS); if (err < 0) goto st_magn_probe_trigger_error; } From ddc05fa286068a2d0cf87a47739b155806d46670 Mon Sep 17 00:00:00 2001 From: Giuseppe Barba Date: Tue, 21 Jul 2015 10:35:44 +0200 Subject: [PATCH 467/912] iio: st-accel: add support for lsm303agr accelerometer This adds support for the lsm303agr accelerometer. Signed-off-by: Giuseppe Barba Acked-by: Denis Ciocca Signed-off-by: Jonathan Cameron --- Documentation/devicetree/bindings/iio/st-sensors.txt | 1 + drivers/iio/accel/st_accel.h | 1 + drivers/iio/accel/st_accel_core.c | 1 + drivers/iio/accel/st_accel_i2c.c | 5 +++++ drivers/iio/accel/st_accel_spi.c | 1 + 5 files changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt index 8a6be3bdf267..d80bdaa75754 100644 --- a/Documentation/devicetree/bindings/iio/st-sensors.txt +++ b/Documentation/devicetree/bindings/iio/st-sensors.txt @@ -35,6 +35,7 @@ Accelerometers: - st,lsm303dl-accel - st,lsm303dlm-accel - st,lsm330-accel +- st,lsm303agr-accel Gyroscopes: - st,l3g4200d-gyro diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h index aa1001931d0c..468f21fa2950 100644 --- a/drivers/iio/accel/st_accel.h +++ b/drivers/iio/accel/st_accel.h @@ -26,6 +26,7 @@ #define LSM303DLH_ACCEL_DEV_NAME "lsm303dlh_accel" #define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel" #define LSM330_ACCEL_DEV_NAME "lsm330_accel" +#define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel" /** * struct st_sensors_platform_data - default accel platform data diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index 12b42f6e70ab..ff30f8806880 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -233,6 +233,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { [2] = LSM330D_ACCEL_DEV_NAME, [3] = LSM330DL_ACCEL_DEV_NAME, [4] = LSM330DLC_ACCEL_DEV_NAME, + [5] = LSM303AGR_ACCEL_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = { diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c index a2f1c20319eb..8b9cc84fd44f 100644 --- a/drivers/iio/accel/st_accel_i2c.c +++ b/drivers/iio/accel/st_accel_i2c.c @@ -68,6 +68,10 @@ static const struct of_device_id st_accel_of_match[] = { .compatible = "st,lsm330-accel", .data = LSM330_ACCEL_DEV_NAME, }, + { + .compatible = "st,lsm303agr-accel", + .data = LSM303AGR_ACCEL_DEV_NAME, + }, {}, }; MODULE_DEVICE_TABLE(of, st_accel_of_match); @@ -116,6 +120,7 @@ static const struct i2c_device_id st_accel_id_table[] = { { LSM303DL_ACCEL_DEV_NAME }, { LSM303DLM_ACCEL_DEV_NAME }, { LSM330_ACCEL_DEV_NAME }, + { LSM303AGR_ACCEL_DEV_NAME }, {}, }; MODULE_DEVICE_TABLE(i2c, st_accel_id_table); diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c index 12ec29389e4b..54b61a3961c3 100644 --- a/drivers/iio/accel/st_accel_spi.c +++ b/drivers/iio/accel/st_accel_spi.c @@ -57,6 +57,7 @@ static const struct spi_device_id st_accel_id_table[] = { { LSM303DL_ACCEL_DEV_NAME }, { LSM303DLM_ACCEL_DEV_NAME }, { LSM330_ACCEL_DEV_NAME }, + { LSM303AGR_ACCEL_DEV_NAME }, {}, }; MODULE_DEVICE_TABLE(spi, st_accel_id_table); From 1e9676a8474b657b6a793f0abff2205783a1ce6f Mon Sep 17 00:00:00 2001 From: Giuseppe Barba Date: Tue, 21 Jul 2015 10:35:45 +0200 Subject: [PATCH 468/912] iio: st-magn: add support for lsm303agr magnetometer This adds support for the lsm303agr magnetometer. Signed-off-by: Giuseppe Barba Acked-by: Denis Ciocca Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/st-sensors.txt | 1 + drivers/iio/magnetometer/st_magn.h | 1 + drivers/iio/magnetometer/st_magn_core.c | 82 +++++++++++++++++++ drivers/iio/magnetometer/st_magn_i2c.c | 5 ++ drivers/iio/magnetometer/st_magn_spi.c | 1 + 5 files changed, 90 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt index d80bdaa75754..d3ccdb190c53 100644 --- a/Documentation/devicetree/bindings/iio/st-sensors.txt +++ b/Documentation/devicetree/bindings/iio/st-sensors.txt @@ -47,6 +47,7 @@ Gyroscopes: - st,lsm330-gyro Magnetometers: +- st,lsm303agr-magn - st,lsm303dlh-magn - st,lsm303dlhc-magn - st,lsm303dlm-magn diff --git a/drivers/iio/magnetometer/st_magn.h b/drivers/iio/magnetometer/st_magn.h index 604410236d99..06a4d9c35581 100644 --- a/drivers/iio/magnetometer/st_magn.h +++ b/drivers/iio/magnetometer/st_magn.h @@ -18,6 +18,7 @@ #define LSM303DLHC_MAGN_DEV_NAME "lsm303dlhc_magn" #define LSM303DLM_MAGN_DEV_NAME "lsm303dlm_magn" #define LIS3MDL_MAGN_DEV_NAME "lis3mdl" +#define LSM303AGR_MAGN_DEV_NAME "lsm303agr_magn" int st_magn_common_probe(struct iio_dev *indio_dev); void st_magn_common_remove(struct iio_dev *indio_dev); diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 4c0cef865517..f8dc4b85d70c 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c @@ -43,6 +43,7 @@ #define ST_MAGN_FS_AVL_8000MG 8000 #define ST_MAGN_FS_AVL_8100MG 8100 #define ST_MAGN_FS_AVL_12000MG 12000 +#define ST_MAGN_FS_AVL_15000MG 15000 #define ST_MAGN_FS_AVL_16000MG 16000 /* CUSTOM VALUES FOR SENSOR 0 */ @@ -157,6 +158,29 @@ #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a #define ST_MAGN_2_OUT_Z_L_ADDR 0x2c +/* CUSTOM VALUES FOR SENSOR 3 */ +#define ST_MAGN_3_WAI_ADDR 0x4f +#define ST_MAGN_3_WAI_EXP 0x40 +#define ST_MAGN_3_ODR_ADDR 0x60 +#define ST_MAGN_3_ODR_MASK 0x0c +#define ST_MAGN_3_ODR_AVL_10HZ_VAL 0x00 +#define ST_MAGN_3_ODR_AVL_20HZ_VAL 0x01 +#define ST_MAGN_3_ODR_AVL_50HZ_VAL 0x02 +#define ST_MAGN_3_ODR_AVL_100HZ_VAL 0x03 +#define ST_MAGN_3_PW_ADDR 0x60 +#define ST_MAGN_3_PW_MASK 0x03 +#define ST_MAGN_3_PW_ON 0x00 +#define ST_MAGN_3_PW_OFF 0x03 +#define ST_MAGN_3_BDU_ADDR 0x62 +#define ST_MAGN_3_BDU_MASK 0x10 +#define ST_MAGN_3_DRDY_IRQ_ADDR 0x62 +#define ST_MAGN_3_DRDY_INT_MASK 0x01 +#define ST_MAGN_3_FS_AVL_15000_GAIN 1500 +#define ST_MAGN_3_MULTIREAD_BIT false +#define ST_MAGN_3_OUT_X_L_ADDR 0x68 +#define ST_MAGN_3_OUT_Y_L_ADDR 0x6a +#define ST_MAGN_3_OUT_Z_L_ADDR 0x6c + static const struct iio_chan_spec st_magn_16bit_channels[] = { ST_SENSORS_LSM_CHANNELS(IIO_MAGN, BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), @@ -189,6 +213,22 @@ static const struct iio_chan_spec st_magn_2_16bit_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(3) }; +static const struct iio_chan_spec st_magn_3_16bit_channels[] = { + ST_SENSORS_LSM_CHANNELS(IIO_MAGN, + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), + ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16, + ST_MAGN_3_OUT_X_L_ADDR), + ST_SENSORS_LSM_CHANNELS(IIO_MAGN, + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), + ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16, + ST_MAGN_3_OUT_Y_L_ADDR), + ST_SENSORS_LSM_CHANNELS(IIO_MAGN, + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), + ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16, + ST_MAGN_3_OUT_Z_L_ADDR), + IIO_CHAN_SOFT_TIMESTAMP(3) +}; + static const struct st_sensor_settings st_magn_sensors_settings[] = { { .wai = 0, /* This sensor has no valid WhoAmI report 0 */ @@ -402,6 +442,48 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { .multi_read_bit = ST_MAGN_2_MULTIREAD_BIT, .bootime = 2, }, + { + .wai = ST_MAGN_3_WAI_EXP, + .wai_addr = ST_MAGN_3_WAI_ADDR, + .sensors_supported = { + [0] = LSM303AGR_MAGN_DEV_NAME, + }, + .ch = (struct iio_chan_spec *)st_magn_3_16bit_channels, + .odr = { + .addr = ST_MAGN_3_ODR_ADDR, + .mask = ST_MAGN_3_ODR_MASK, + .odr_avl = { + { 10, ST_MAGN_3_ODR_AVL_10HZ_VAL, }, + { 20, ST_MAGN_3_ODR_AVL_20HZ_VAL, }, + { 50, ST_MAGN_3_ODR_AVL_50HZ_VAL, }, + { 100, ST_MAGN_3_ODR_AVL_100HZ_VAL, }, + }, + }, + .pw = { + .addr = ST_MAGN_3_PW_ADDR, + .mask = ST_MAGN_3_PW_MASK, + .value_on = ST_MAGN_3_PW_ON, + .value_off = ST_MAGN_3_PW_OFF, + }, + .fs = { + .fs_avl = { + [0] = { + .num = ST_MAGN_FS_AVL_15000MG, + .gain = ST_MAGN_3_FS_AVL_15000_GAIN, + }, + }, + }, + .bdu = { + .addr = ST_MAGN_3_BDU_ADDR, + .mask = ST_MAGN_3_BDU_MASK, + }, + .drdy_irq = { + .addr = ST_MAGN_3_DRDY_IRQ_ADDR, + .mask_int1 = ST_MAGN_3_DRDY_INT_MASK, + }, + .multi_read_bit = ST_MAGN_3_MULTIREAD_BIT, + .bootime = 2, + }, }; static int st_magn_read_raw(struct iio_dev *indio_dev, diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c index 28aa80731cea..8aa37af306ed 100644 --- a/drivers/iio/magnetometer/st_magn_i2c.c +++ b/drivers/iio/magnetometer/st_magn_i2c.c @@ -36,6 +36,10 @@ static const struct of_device_id st_magn_of_match[] = { .compatible = "st,lis3mdl-magn", .data = LIS3MDL_MAGN_DEV_NAME, }, + { + .compatible = "st,lsm303agr-magn", + .data = LSM303AGR_MAGN_DEV_NAME, + }, {}, }; MODULE_DEVICE_TABLE(of, st_magn_of_match); @@ -79,6 +83,7 @@ static const struct i2c_device_id st_magn_id_table[] = { { LSM303DLHC_MAGN_DEV_NAME }, { LSM303DLM_MAGN_DEV_NAME }, { LIS3MDL_MAGN_DEV_NAME }, + { LSM303AGR_MAGN_DEV_NAME }, {}, }; MODULE_DEVICE_TABLE(i2c, st_magn_id_table); diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c index 7adacf160146..0abca2c6afa6 100644 --- a/drivers/iio/magnetometer/st_magn_spi.c +++ b/drivers/iio/magnetometer/st_magn_spi.c @@ -51,6 +51,7 @@ static const struct spi_device_id st_magn_id_table[] = { { LSM303DLHC_MAGN_DEV_NAME }, { LSM303DLM_MAGN_DEV_NAME }, { LIS3MDL_MAGN_DEV_NAME }, + { LSM303AGR_MAGN_DEV_NAME }, {}, }; MODULE_DEVICE_TABLE(spi, st_magn_id_table); From 7868dfd216074fc5f902e7befacda2a0ec76e403 Mon Sep 17 00:00:00 2001 From: Joo Aun Saw Date: Thu, 23 Jul 2015 12:53:47 +1000 Subject: [PATCH 469/912] tools: iio: make scale and offset files optional Make scale and offset optional by adding -ENOENT check as not all drivers implement them. Signed-off-by: Joo Aun Saw Acked-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index c3f9e37333e7..1dcdf03955cb 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -487,7 +487,7 @@ int build_channel_array(const char *device_dir, device_dir, current->name, current->generic_name); - if (ret < 0) + if ((ret < 0) && (ret != -ENOENT)) goto error_cleanup_array; ret = iioutils_get_param_float(¤t->offset, @@ -495,7 +495,7 @@ int build_channel_array(const char *device_dir, device_dir, current->name, current->generic_name); - if (ret < 0) + if ((ret < 0) && (ret != -ENOENT)) goto error_cleanup_array; ret = iioutils_get_type(¤t->is_signed, From 423b24c37dd5794a674c74b0ed56392003a69891 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 23 Jul 2015 16:46:57 +0100 Subject: [PATCH 470/912] staging: comedi: usbduxsigma: don't clobber ai_timer in command test `devpriv->ai_timer` is used while an asynchronous command is running on the AI subdevice. It also gets modified by the subdevice's `cmdtest` handler for checking new asynchronous commands (`usbduxsigma_ai_cmdtest()`), which is not correct as it's allowed to check new commands while an old command is still running. Fix it by moving the code which sets up `devpriv->ai_timer` and `devpriv->ai_interval` into the subdevice's `cmd` handler, `usbduxsigma_ai_cmd()`. Note that the removed code in `usbduxsigma_ai_cmdtest()` checked that `devpriv->ai_timer` did not end up less than than 1, but that could not happen because `cmd->scan_begin_arg` had already been checked to be at least the minimum required value (at least when `cmd->scan_begin_src == TRIG_TIMER`, which had also been checked to be the case). Fixes: b986be8527c7 ("staging: comedi: usbduxsigma: tidy up analog input command support) Signed-off-by: Ian Abbott Reviewed-by: Bernd Porr Reviewed-by: H Hartley Sweeten Cc: # 3.19 onwards Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 37 +++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 51846adf8340..2d684747a639 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -551,27 +551,6 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, if (err) return 3; - /* Step 4: fix up any arguments */ - - if (high_speed) { - /* - * every 2 channels get a time window of 125us. Thus, if we - * sample all 16 channels we need 1ms. If we sample only one - * channel we need only 125us - */ - devpriv->ai_interval = interval; - devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval); - } else { - /* interval always 1ms */ - devpriv->ai_interval = 1; - devpriv->ai_timer = cmd->scan_begin_arg / 1000000; - } - if (devpriv->ai_timer < 1) - err |= -EINVAL; - - if (err) - return 4; - return 0; } @@ -669,6 +648,22 @@ static int usbduxsigma_ai_cmd(struct comedi_device *dev, down(&devpriv->sem); + if (devpriv->high_speed) { + /* + * every 2 channels get a time window of 125us. Thus, if we + * sample all 16 channels we need 1ms. If we sample only one + * channel we need only 125us + */ + unsigned int interval = usbduxsigma_chans_to_interval(len); + + devpriv->ai_interval = interval; + devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval); + } else { + /* interval always 1ms */ + devpriv->ai_interval = 1; + devpriv->ai_timer = cmd->scan_begin_arg / 1000000; + } + for (i = 0; i < len; i++) { unsigned int chan = CR_CHAN(cmd->chanlist[i]); From c04a1f17803e0d3eeada586ca34a6b436959bc20 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 23 Jul 2015 16:46:58 +0100 Subject: [PATCH 471/912] staging: comedi: usbduxsigma: don't clobber ao_timer in command test `devpriv->ao_timer` is used while an asynchronous command is running on the AO subdevice. It also gets modified by the subdevice's `cmdtest` handler for checking new asynchronous commands, `usbduxsigma_ao_cmdtest()`, which is not correct as it's allowed to check new commands while an old command is still running. Fix it by moving the code which sets up `devpriv->ao_timer` into the subdevice's `cmd` handler, `usbduxsigma_ao_cmd()`. Note that the removed code in `usbduxsigma_ao_cmdtest()` checked that `devpriv->ao_timer` did not end up less that 1, but that could not happen due because `cmd->scan_begin_arg` or `cmd->convert_arg` had already been range-checked. Also note that we tested the `high_speed` variable in the old code, but that is currently always 0 and means that we always use "scan" timing (`cmd->scan_begin_src == TRIG_TIMER` and `cmd->convert_src == TRIG_NOW`) and never "convert" (individual sample) timing (`cmd->scan_begin_src == TRIG_FOLLOW` and `cmd->convert_src == TRIG_TIMER`). The moved code tests `cmd->convert_src` instead to decide whether "scan" or "convert" timing is being used, although currently only "scan" timing is supported. Fixes: fb1ef622e7a3 ("staging: comedi: usbduxsigma: tidy up analog output command support") Signed-off-by: Ian Abbott Reviewed-by: Bernd Porr Reviewed-by: H Hartley Sweeten Cc: # 3.19 onwards Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 33 +++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 2d684747a639..dcb7f3037dea 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -914,25 +914,6 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, if (err) return 3; - /* Step 4: fix up any arguments */ - - /* we count in timer steps */ - if (high_speed) { - /* timing of the conversion itself: every 125 us */ - devpriv->ao_timer = cmd->convert_arg / 125000; - } else { - /* - * timing of the scan: every 1ms - * we get all channels at once - */ - devpriv->ao_timer = cmd->scan_begin_arg / 1000000; - } - if (devpriv->ao_timer < 1) - err |= -EINVAL; - - if (err) - return 4; - return 0; } @@ -945,6 +926,20 @@ static int usbduxsigma_ao_cmd(struct comedi_device *dev, down(&devpriv->sem); + if (cmd->convert_src == TRIG_TIMER) { + /* + * timing of the conversion itself: every 125 us + * at high speed (not used yet) + */ + devpriv->ao_timer = cmd->convert_arg / 125000; + } else { + /* + * timing of the scan: every 1ms + * we get all channels at once + */ + devpriv->ao_timer = cmd->scan_begin_arg / 1000000; + } + devpriv->ao_counter = devpriv->ao_timer; if (cmd->start_src == TRIG_NOW) { From 12e1e6960130673aabbbe7f094c4690b00618881 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 23 Jul 2015 16:46:59 +0100 Subject: [PATCH 472/912] staging: comedi: usbduxsigma: remove AI scan_begin_src == TRIG_FOLLOW The AI subdevice `cmdtest` handler `usbduxsigma_ai_cmdtest()` ensures that `cmd->scan_begin_src == TRIG_TIMER` by the end of step 2 of the command checking code, so assume that this is the case for step 3 onwards and remove the redundant code. Signed-off-by: Ian Abbott Reviewed-by: Bernd Porr Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 45 ++++++++------------ 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index dcb7f3037dea..fdc880a4adaf 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -482,6 +482,7 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, struct usbduxsigma_private *devpriv = dev->private; int high_speed = devpriv->high_speed; int interval = usbduxsigma_chans_to_interval(cmd->chanlist_len); + unsigned int tmp; int err = 0; /* Step 1 : check if triggers are trivially valid */ @@ -509,36 +510,26 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ - err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + if (high_speed) { + /* + * In high speed mode microframes are possible. + * However, during one microframe we can roughly + * sample two channels. Thus, the more channels + * are in the channel list the more time we need. + */ + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + (125000 * interval)); - if (cmd->scan_begin_src == TRIG_TIMER) { - unsigned int tmp; + tmp = (cmd->scan_begin_arg / 125000) * 125000; + } else { + /* full speed */ + /* 1kHz scans every USB frame */ + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + 1000000); - if (high_speed) { - /* - * In high speed mode microframes are possible. - * However, during one microframe we can roughly - * sample two channels. Thus, the more channels - * are in the channel list the more time we need. - */ - err |= comedi_check_trigger_arg_min(&cmd-> - scan_begin_arg, - (1000000 / 8 * - interval)); - - tmp = (cmd->scan_begin_arg / 125000) * 125000; - } else { - /* full speed */ - /* 1kHz scans every USB frame */ - err |= comedi_check_trigger_arg_min(&cmd-> - scan_begin_arg, - 1000000); - - tmp = (cmd->scan_begin_arg / 1000000) * 1000000; - } - err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); + tmp = (cmd->scan_begin_arg / 1000000) * 1000000; } + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); From 333e40aee3f2d0457e2cbadc742619a6f449b2e7 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 23 Jul 2015 16:47:00 +0100 Subject: [PATCH 473/912] staging: comedi: usbduxsigma: round down AI scan_begin_arg at step 4. The return value of the `cmdtest` handler for a subdevice checks the prospective new command in various steps and returns the step number at which any problem was detected, or 0 if no problem was detected. It is allowed to modify the command in various ways at each step. Corrections for out-of-range values are generally made at step 3, and minor adjustments such as rounding are generally made at step 4. The `cmdtest` handler for the AI subdevice (`usbduxsigma_ai_cmdtest()`) currently modifies `cmd->scan_begin_arg` to bring it into range and round it down at step 3. Move the rounding down part to step 4 to follow the usual Comedi convention. Signed-off-by: Ian Abbott Reviewed-by: Bernd Porr Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index fdc880a4adaf..535cf01bca07 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -519,17 +519,12 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, */ err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, (125000 * interval)); - - tmp = (cmd->scan_begin_arg / 125000) * 125000; } else { /* full speed */ /* 1kHz scans every USB frame */ err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, 1000000); - - tmp = (cmd->scan_begin_arg / 1000000) * 1000000; } - err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); @@ -542,6 +537,14 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, if (err) return 3; + /* Step 4: fix up any arguments */ + + tmp = rounddown(cmd->scan_begin_arg, high_speed ? 125000 : 1000000); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); + + if (err) + return 4; + return 0; } From 57befc33af0243e9b3835d46ab836406256f5dd4 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 23 Jul 2015 16:47:01 +0100 Subject: [PATCH 474/912] staging: comedi: usbduxsigma: remove unused "convert" timing for AO The `cmdtest` and `cmd` handlers for the AO subdevice (`usbduxsigma_ao_cmdtest()` and `usbduxsigma_ao_cmd()`) support "scan" timing of commands with all channels updated every "scan" period. There is some disabled code to use "convert" timing in high speed mode. That would allow channels to be updated sequentially every "convert" period. Since that code is incomplete and currently disabled, remove it to simplify the existing code. Signed-off-by: Ian Abbott Reviewed-by: Bernd Porr Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 58 ++++++-------------- 1 file changed, 17 insertions(+), 41 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 535cf01bca07..9f43e01b58c5 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -840,28 +840,20 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, { struct usbduxsigma_private *devpriv = dev->private; int err = 0; - int high_speed; - unsigned int flags; - - /* high speed conversions are not used yet */ - high_speed = 0; /* (devpriv->high_speed) */ /* Step 1 : check if triggers are trivially valid */ err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); - if (high_speed) { - /* - * start immediately a new scan - * the sampling rate is set by the coversion rate - */ - flags = TRIG_FOLLOW; - } else { - /* start a new scan (output at once) with a timer */ - flags = TRIG_TIMER; - } - err |= comedi_check_trigger_src(&cmd->scan_begin_src, flags); - + /* + * For now, always use "scan" timing with all channels updated at once + * (cmd->scan_begin_src == TRIG_TIMER, cmd->convert_src == TRIG_NOW). + * + * In a future version, "convert" timing with channels updated + * indivually may be supported in high speed mode + * (cmd->scan_begin_src == TRIG_FOLLOW, cmd->convert_src == TRIG_TIMER). + */ + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); @@ -885,17 +877,7 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ - err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - - if (cmd->scan_begin_src == TRIG_TIMER) { - err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, - 1000000); - } - - /* not used now, is for later use */ - if (cmd->convert_src == TRIG_TIMER) - err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 125000); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, 1000000); err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); @@ -920,19 +902,13 @@ static int usbduxsigma_ao_cmd(struct comedi_device *dev, down(&devpriv->sem); - if (cmd->convert_src == TRIG_TIMER) { - /* - * timing of the conversion itself: every 125 us - * at high speed (not used yet) - */ - devpriv->ao_timer = cmd->convert_arg / 125000; - } else { - /* - * timing of the scan: every 1ms - * we get all channels at once - */ - devpriv->ao_timer = cmd->scan_begin_arg / 1000000; - } + /* + * For now, only "scan" timing is supported. A future version may + * support "convert" timing in high speed mode. + * + * Timing of the scan: every 1ms all channels updated at once. + */ + devpriv->ao_timer = cmd->scan_begin_arg / 1000000; devpriv->ao_counter = devpriv->ao_timer; From ed2c2e060b6c3cd5fc42993011aa41c765ff1b2f Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 23 Jul 2015 16:47:02 +0100 Subject: [PATCH 475/912] staging: comedi: usbduxsigma: round down AO scan_begin_arg at step 4. The return value of the `cmdtest` handler for a subdevice checks the prospective new command in various steps and returns the step number at which any problem was detected, or 0 if no problem was detected. It is allowed to modify the command in various ways at each step. Corrections for out-of-range values are generally made at step 3, and minor adjustments such as rounding are generally made at step 4. The `cmdtest` handler for the AO subdevice (`usbduxsigma_ao_cmdtest()`) currently range checks the timings at step 3. Since the running command will round down the timings, add code to round them down at step 4. Signed-off-by: Ian Abbott Reviewed-by: Bernd Porr Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 9f43e01b58c5..649cf47184a4 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -839,6 +839,7 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { struct usbduxsigma_private *devpriv = dev->private; + unsigned int tmp; int err = 0; /* Step 1 : check if triggers are trivially valid */ @@ -890,6 +891,14 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, if (err) return 3; + /* Step 4: fix up any arguments */ + + tmp = rounddown(cmd->scan_begin_arg, 1000000); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); + + if (err) + return 4; + return 0; } From 5143f7a3e970a1d0b6659cf41a3b46dd48a9bc6f Mon Sep 17 00:00:00 2001 From: Ioan-Adrian Ratiu Date: Thu, 23 Jul 2015 16:24:10 +0300 Subject: [PATCH 476/912] staging: rtl8192e: rtllib: fix macro style issue Remove macro and use explicit case statements. Code is a little longer but clearer. Checkpatch.pl does not complain anymore. Signed-off-by: Ioan-Adrian Ratiu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 80 ++++++++++++++++++---------- 1 file changed, 52 insertions(+), 28 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 54dfff61f485..09f0820fb340 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1744,37 +1744,61 @@ static int rtllib_parse_qos_info_param_IE(struct rtllib_device *ieee, return rc; } -#define MFIE_STRING(x) case MFIE_TYPE_ ##x: return #x - 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(RSN); - MFIE_STRING(RATES_EX); - MFIE_STRING(GENERIC); - MFIE_STRING(QOS_PARAMETER); + case MFIE_TYPE_SSID: + return "SSID"; + case MFIE_TYPE_RATES: + return "RATES"; + case MFIE_TYPE_FH_SET: + return "FH_SET"; + case MFIE_TYPE_DS_SET: + return "DS_SET"; + case MFIE_TYPE_CF_SET: + return "CF_SET"; + case MFIE_TYPE_TIM: + return "TIM"; + case MFIE_TYPE_IBSS_SET: + return "IBSS_SET"; + case MFIE_TYPE_COUNTRY: + return "COUNTRY"; + case MFIE_TYPE_HOP_PARAMS: + return "HOP_PARAMS"; + case MFIE_TYPE_HOP_TABLE: + return "HOP_TABLE"; + case MFIE_TYPE_REQUEST: + return "REQUEST"; + case MFIE_TYPE_CHALLENGE: + return "CHALLENGE"; + case MFIE_TYPE_POWER_CONSTRAINT: + return "POWER_CONSTRAINT"; + case MFIE_TYPE_POWER_CAPABILITY: + return "POWER_CAPABILITY"; + case MFIE_TYPE_TPC_REQUEST: + return "TPC_REQUEST"; + case MFIE_TYPE_TPC_REPORT: + return "TPC_REPORT"; + case MFIE_TYPE_SUPP_CHANNELS: + return "SUPP_CHANNELS"; + case MFIE_TYPE_CSA: + return "CSA"; + case MFIE_TYPE_MEASURE_REQUEST: + return "MEASURE_REQUEST"; + case MFIE_TYPE_MEASURE_REPORT: + return "MEASURE_REPORT"; + case MFIE_TYPE_QUIET: + return "QUIET"; + case MFIE_TYPE_IBSS_DFS: + return "IBSS_DFS"; + case MFIE_TYPE_RSN: + return "RSN"; + case MFIE_TYPE_RATES_EX: + return "RATES_EX"; + case MFIE_TYPE_GENERIC: + return "GENERIC"; + case MFIE_TYPE_QOS_PARAMETER: + return "QOS_PARAMETER"; default: return "UNKNOWN"; } From b4ba3b572b469684a3fc804bd2b93fbf848960ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C5=A3iu=20Alexandru=20Octavian?= Date: Fri, 24 Jul 2015 00:13:27 +0300 Subject: [PATCH 477/912] drivers: staging: rtl8188eu Refactored rtw_free_assoc_resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored rtw_free_assoc_resources to avoid sparse warnings about different contexts for basic lock Signed-off-by: Buţiu Alexandru Octavian Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8188eu/core/rtw_ioctl_set.c | 10 ++++---- drivers/staging/rtl8188eu/core/rtw_mlme.c | 24 ++++++++++++------- drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 2 +- drivers/staging/rtl8188eu/include/rtw_mlme.h | 3 ++- .../staging/rtl8188eu/os_dep/ioctl_linux.c | 2 +- drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 2 +- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c index 8c05cb021c46..22f5b45f5f7f 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c @@ -183,7 +183,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid) if (check_fwstate(pmlmepriv, _FW_LINKED) == true) rtw_indicate_disconnect(padapter); - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); @@ -271,7 +271,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) if (check_fwstate(pmlmepriv, _FW_LINKED) == true) rtw_indicate_disconnect(padapter); - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) { _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); @@ -293,7 +293,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) if (check_fwstate(pmlmepriv, _FW_LINKED) == true) rtw_indicate_disconnect(padapter); - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) { _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); @@ -366,7 +366,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, if ((check_fwstate(pmlmepriv, _FW_LINKED)) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))) - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) { if (check_fwstate(pmlmepriv, _FW_LINKED) == true) @@ -415,7 +415,7 @@ u8 rtw_set_802_11_disassociate(struct adapter *padapter) rtw_disassoc_cmd(padapter, 0, true); rtw_indicate_disconnect(padapter); - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); rtw_pwr_wakeup(padapter); } diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index 2b599e3c0785..71a7a85571aa 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -704,7 +704,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) if (--pmlmepriv->to_roaming == 0 || _SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) { pmlmepriv->to_roaming = 0; - rtw_free_assoc_resources(adapter, 1); + rtw_free_assoc_resources(adapter); rtw_indicate_disconnect(adapter); } else { pmlmepriv->to_join = true; @@ -758,7 +758,19 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv) /* *rtw_free_assoc_resources: the caller has to lock pmlmepriv->lock */ -void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) +void rtw_free_assoc_resources(struct adapter *adapter) +{ + struct mlme_priv *pmlmepriv = &adapter->mlmepriv; + + spin_lock_bh(&pmlmepriv->scanned_queue.lock); + rtw_free_assoc_resources_locked(adapter); + spin_unlock_bh(&pmlmepriv->scanned_queue.lock); +} + +/* +*rtw_free_assoc_resources_locked: the caller has to lock pmlmepriv->lock +*/ +void rtw_free_assoc_resources_locked(struct adapter *adapter) { struct wlan_network *pwlan = NULL; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -793,8 +805,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) rtw_init_bcmc_stainfo(adapter); } - if (lock_scanned_queue) - spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); if (pwlan) @@ -805,8 +815,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && (adapter->stapriv.asoc_sta_count == 1))) rtw_free_network_nolock(pmlmepriv, pwlan); - if (lock_scanned_queue) - spin_unlock_bh(&pmlmepriv->scanned_queue.lock); pmlmepriv->key_mask = 0; } @@ -1302,7 +1310,7 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) rtw_free_uc_swdec_pending_queue(adapter); - rtw_free_assoc_resources(adapter, 1); + rtw_free_assoc_resources(adapter); rtw_indicate_disconnect(adapter); spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); /* remove the network entry in scanned_queue */ @@ -1557,7 +1565,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) rtw_disassoc_cmd(adapter, 0, true); rtw_indicate_disconnect(adapter); - rtw_free_assoc_resources(adapter, 0); + rtw_free_assoc_resources_locked(adapter); } rtw_hal_get_def_var(adapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(supp_ant_div)); diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index a2b54de21ed7..9765946466ab 100644 --- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c @@ -70,7 +70,7 @@ static int rtw_hw_suspend(struct adapter *padapter) } } /* s2-3. */ - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); /* s2-4. */ rtw_free_network_queue(padapter, true); diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme.h b/drivers/staging/rtl8188eu/include/rtw_mlme.h index 8c7e8a36aa13..4c992573e3ca 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme.h @@ -535,7 +535,8 @@ void rtw_generate_random_ibss(u8 *pibss); struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr); struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue); -void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue); +void rtw_free_assoc_resources(struct adapter *adapter); +void rtw_free_assoc_resources_locked(struct adapter *adapter); void rtw_indicate_disconnect(struct adapter *adapter); void rtw_indicate_connect(struct adapter *adapter); void rtw_indicate_scan_done(struct adapter *padapter, bool aborted); diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index ce756cdb817b..2db86fbe29d2 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -1871,7 +1871,7 @@ static int rtw_wx_set_auth(struct net_device *dev, rtw_disassoc_cmd(padapter, 500, false); DBG_88E("%s...call rtw_indicate_disconnect\n ", __func__); rtw_indicate_disconnect(padapter); - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); } ret = wpa_set_auth_algs(dev, (u32)param->value); break; diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index a14e79f31abf..2361bce480c3 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -1175,7 +1175,7 @@ static int netdev_close(struct net_device *pnetdev) /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect(padapter); /* s2-3. */ - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); /* s2-4. */ rtw_free_network_queue(padapter, true); /* Close LED */ diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 5f44c6a5b777..33bfe054f867 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -266,7 +266,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect(padapter); /* s2-3. */ - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter); /* s2-4. */ rtw_free_network_queue(padapter, true); From 3abf4f984adaa4e6fadf9d135ccb915c51bda057 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Fri, 24 Jul 2015 17:11:30 +0200 Subject: [PATCH 478/912] staging: rtl8188eu: kill unused hal_data_8188e::fw_ractrl flag Flag is never set. Remove it and the code that is dead because of it. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/odm.c | 11 +++----- drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c | 21 --------------- drivers/staging/rtl8188eu/hal/usb_halinit.c | 27 ++----------------- .../staging/rtl8188eu/include/rtl8188e_cmd.h | 1 - .../staging/rtl8188eu/include/rtl8188e_hal.h | 1 - drivers/staging/rtl8188eu/include/sta_info.h | 1 - 6 files changed, 6 insertions(+), 56 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c index 28b5e7bd4fc0..710fdc3449f8 100644 --- a/drivers/staging/rtl8188eu/hal/odm.c +++ b/drivers/staging/rtl8188eu/hal/odm.c @@ -1170,13 +1170,10 @@ void odm_RSSIMonitorCheckCE(struct odm_dm_struct *pDM_Odm) } for (i = 0; i < sta_cnt; i++) { - if (PWDB_rssi[i] != (0)) { - if (pHalData->fw_ractrl) { - /* Report every sta's RSSI to FW */ - } else { - ODM_RA_SetRSSI_8188E( - &(pHalData->odmpriv), (PWDB_rssi[i]&0xFF), (u8)((PWDB_rssi[i]>>16) & 0xFF)); - } + if (PWDB_rssi[i] != 0) { + ODM_RA_SetRSSI_8188E(&pHalData->odmpriv, + PWDB_rssi[i] & 0xFF, + (PWDB_rssi[i] >> 16) & 0xFF); } } diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c b/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c index 86347f2ccdfd..0a62bfa210fe 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c @@ -127,27 +127,6 @@ exit: return ret; } -u8 rtl8188e_set_raid_cmd(struct adapter *adapt, u32 mask) -{ - u8 buf[3]; - u8 res = _SUCCESS; - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); - - if (haldata->fw_ractrl) { - - memset(buf, 0, 3); - put_unaligned_le32(mask, buf); - - FillH2CCmd_88E(adapt, H2C_DM_MACID_CFG, 3, buf); - } else { - DBG_88E("==>%s fw dont support RA\n", __func__); - res = _FAIL; - } - - - return res; -} - /* bitmap[0:27] = tx_rate_bitmap */ /* bitmap[28:31]= Rate Adaptive id */ /* arg[0:4] = macid */ diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 6dc0869924ec..1ef878fd997b 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -743,19 +743,16 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) if (Adapter->registrypriv.mp_mode == 1) { _InitRxSetting(Adapter); Adapter->bFWReady = false; - haldata->fw_ractrl = false; } else { status = rtl88eu_download_fw(Adapter); if (status) { DBG_88E("%s: Download Firmware failed!!\n", __func__); Adapter->bFWReady = false; - haldata->fw_ractrl = false; return status; } else { RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Initializeadapt8192CSdio(): Download Firmware Success!!\n")); Adapter->bFWReady = true; - haldata->fw_ractrl = false; } } rtl8188e_InitializeFirmwareVars(Adapter); @@ -2016,28 +2013,9 @@ static void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_l init_rate = get_highest_rate_idx(mask)&0x3f; - if (haldata->fw_ractrl) { - u8 arg; + ODM_RA_UpdateRateInfo_8188E(&haldata->odmpriv, mac_id, + raid, mask, shortGIrate); - arg = mac_id & 0x1f;/* MACID */ - arg |= BIT(7); - if (shortGIrate) - arg |= BIT(5); - mask |= ((raid << 28) & 0xf0000000); - DBG_88E("update raid entry, mask=0x%x, arg=0x%x\n", mask, arg); - psta->ra_mask = mask; - mask |= ((raid << 28) & 0xf0000000); - - /* to do ,for 8188E-SMIC */ - rtl8188e_set_raid_cmd(adapt, mask); - } else { - ODM_RA_UpdateRateInfo_8188E(&(haldata->odmpriv), - mac_id, - raid, - mask, - shortGIrate - ); - } /* set ra_id */ psta->raid = raid; psta->init_rate = init_rate; @@ -2087,7 +2065,6 @@ static void rtl8188eu_init_default_value(struct adapter *adapt) pwrctrlpriv = &adapt->pwrctrlpriv; /* init default value */ - haldata->fw_ractrl = false; if (!pwrctrlpriv->bkeepfwalive) haldata->LastHMEBoxNum = 0; diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_cmd.h b/drivers/staging/rtl8188eu/include/rtl8188e_cmd.h index 42b1f22424eb..f813ce0563f8 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_cmd.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_cmd.h @@ -107,7 +107,6 @@ struct P2P_PS_CTWPeriod_t { /* host message to firmware cmd */ void rtl8188e_set_FwPwrMode_cmd(struct adapter *padapter, u8 Mode); void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus); -u8 rtl8188e_set_raid_cmd(struct adapter *padapter, u32 mask); void rtl8188e_Add_RateATid(struct adapter *padapter, u32 bitmap, u8 arg, u8 rssi_level); diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h index 5aa2adc1f013..cbad364f189c 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h @@ -294,7 +294,6 @@ struct hal_data_8188e { /* for host message to fw */ u8 LastHMEBoxNum; - u8 fw_ractrl; u8 RegTxPause; /* Beacon function related global variable. */ u32 RegBcnCtrlVal; diff --git a/drivers/staging/rtl8188eu/include/sta_info.h b/drivers/staging/rtl8188eu/include/sta_info.h index 9612490539b3..7bbeedfc49aa 100644 --- a/drivers/staging/rtl8188eu/include/sta_info.h +++ b/drivers/staging/rtl8188eu/include/sta_info.h @@ -113,7 +113,6 @@ struct sta_info { u8 raid; u8 init_rate; - u32 ra_mask; u8 wireless_mode; /* NETWORK_TYPE */ struct stainfo_stats sta_stats; From 7c03621a791499fdb47551693cd785f4fa5d03f8 Mon Sep 17 00:00:00 2001 From: David Kershner Date: Fri, 24 Jul 2015 12:00:21 -0400 Subject: [PATCH 479/912] staging: unisys: Process more than one response per check When s-Par is in polling mode it checks every 2 ms to see if there is a response from the IO service partition in the queue. Currently it just reads one entry per 2 ms, this needs to be changed so it drains the queue on each check. Signed-off-by: David Kershner Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 164 +++++++++--------- 1 file changed, 83 insertions(+), 81 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 4d49937d3856..9d10b85ac7eb 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1629,93 +1629,95 @@ drain_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata) /* TODO: CLIENT ACQUIRE -- Don't really need this at the * moment */ - if (!visorchannel_signalremove(devdata->dev->visorchannel, - IOCHAN_FROM_IOPART, - cmdrsp)) - return; /* queue empty */ + for (;;) { + if (!visorchannel_signalremove(devdata->dev->visorchannel, + IOCHAN_FROM_IOPART, + cmdrsp)) + break; /* queue empty */ - switch (cmdrsp->net.type) { - case NET_RCV: - devdata->chstat.got_rcv++; - /* process incoming packet */ - visornic_rx(cmdrsp); - break; - case NET_XMIT_DONE: - spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->chstat.got_xmit_done++; - if (cmdrsp->net.xmtdone.xmt_done_result) - devdata->chstat.xmit_fail++; - /* only call queue wake if we stopped it */ - netdev = ((struct sk_buff *)cmdrsp->net.buf)->dev; - /* ASSERT netdev == vnicinfo->netdev; */ - if ((netdev == devdata->netdev) && - netif_queue_stopped(netdev)) { - /* check to see if we have crossed - * the lower watermark for - * netif_wake_queue() - */ - if (((devdata->chstat.sent_xmit >= - devdata->chstat.got_xmit_done) && - (devdata->chstat.sent_xmit - - devdata->chstat.got_xmit_done <= - devdata->lower_threshold_net_xmits)) || - ((devdata->chstat.sent_xmit < - devdata->chstat.got_xmit_done) && - (ULONG_MAX - devdata->chstat.got_xmit_done - + devdata->chstat.sent_xmit <= - devdata->lower_threshold_net_xmits))) { - /* enough NET_XMITs completed - * so can restart netif queue - */ - netif_wake_queue(netdev); - devdata->flow_control_lower_hits++; - } - } - skb_unlink(cmdrsp->net.buf, &devdata->xmitbufhead); - spin_unlock_irqrestore(&devdata->priv_lock, flags); - kfree_skb(cmdrsp->net.buf); - break; - case NET_RCV_ENBDIS_ACK: - devdata->chstat.got_enbdisack++; - netdev = (struct net_device *) - cmdrsp->net.enbdis.context; - spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->enab_dis_acked = 1; - spin_unlock_irqrestore(&devdata->priv_lock, flags); - - if (kthread_should_stop()) + switch (cmdrsp->net.type) { + case NET_RCV: + devdata->chstat.got_rcv++; + /* process incoming packet */ + visornic_rx(cmdrsp); break; - if (devdata->server_down && - devdata->server_change_state) { - /* Inform Linux that the link is up */ - devdata->server_down = false; - devdata->server_change_state = false; - netif_wake_queue(netdev); - netif_carrier_on(netdev); - } - break; - case NET_CONNECT_STATUS: - netdev = devdata->netdev; - if (cmdrsp->net.enbdis.enable == 1) { + case NET_XMIT_DONE: spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->enabled = cmdrsp->net.enbdis.enable; - spin_unlock_irqrestore(&devdata->priv_lock, - flags); - netif_wake_queue(netdev); - netif_carrier_on(netdev); - } else { - netif_stop_queue(netdev); - netif_carrier_off(netdev); + devdata->chstat.got_xmit_done++; + if (cmdrsp->net.xmtdone.xmt_done_result) + devdata->chstat.xmit_fail++; + /* only call queue wake if we stopped it */ + netdev = ((struct sk_buff *)cmdrsp->net.buf)->dev; + /* ASSERT netdev == vnicinfo->netdev; */ + if ((netdev == devdata->netdev) && + netif_queue_stopped(netdev)) { + /* check to see if we have crossed + * the lower watermark for + * netif_wake_queue() + */ + if (((devdata->chstat.sent_xmit >= + devdata->chstat.got_xmit_done) && + (devdata->chstat.sent_xmit - + devdata->chstat.got_xmit_done <= + devdata->lower_threshold_net_xmits)) || + ((devdata->chstat.sent_xmit < + devdata->chstat.got_xmit_done) && + (ULONG_MAX - devdata->chstat.got_xmit_done + + devdata->chstat.sent_xmit <= + devdata->lower_threshold_net_xmits))) { + /* enough NET_XMITs completed + * so can restart netif queue + */ + netif_wake_queue(netdev); + devdata->flow_control_lower_hits++; + } + } + skb_unlink(cmdrsp->net.buf, &devdata->xmitbufhead); + spin_unlock_irqrestore(&devdata->priv_lock, flags); + kfree_skb(cmdrsp->net.buf); + break; + case NET_RCV_ENBDIS_ACK: + devdata->chstat.got_enbdisack++; + netdev = (struct net_device *) + cmdrsp->net.enbdis.context; spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->enabled = cmdrsp->net.enbdis.enable; - spin_unlock_irqrestore(&devdata->priv_lock, - flags); + devdata->enab_dis_acked = 1; + spin_unlock_irqrestore(&devdata->priv_lock, flags); + + if (kthread_should_stop()) + break; + if (devdata->server_down && + devdata->server_change_state) { + /* Inform Linux that the link is up */ + devdata->server_down = false; + devdata->server_change_state = false; + netif_wake_queue(netdev); + netif_carrier_on(netdev); + } + break; + case NET_CONNECT_STATUS: + netdev = devdata->netdev; + if (cmdrsp->net.enbdis.enable == 1) { + spin_lock_irqsave(&devdata->priv_lock, flags); + devdata->enabled = cmdrsp->net.enbdis.enable; + spin_unlock_irqrestore(&devdata->priv_lock, + flags); + netif_wake_queue(netdev); + netif_carrier_on(netdev); + } else { + netif_stop_queue(netdev); + netif_carrier_off(netdev); + spin_lock_irqsave(&devdata->priv_lock, flags); + devdata->enabled = cmdrsp->net.enbdis.enable; + spin_unlock_irqrestore(&devdata->priv_lock, + flags); + } + break; + default: + break; } - break; - default: - break; + /* cmdrsp is now available for reuse */ } - /* cmdrsp is now available for reuse */ } /** From 4d79002e962466d455ae4933cd404cf5a1164894 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Fri, 24 Jul 2015 12:00:22 -0400 Subject: [PATCH 480/912] staging: unisys: visornic - ensure proper net locking in tx reset logic visornic tx reset handling is done asynchronously via a workqueue in visornic_timeout_reset(). As a result, it needs to use rtnl_lock() / rtnl_unlock() to lock against possible simultaneous close() of the network device. (I consulted the bnx2 driver as a model here, as that driver also does its tx reset handling asynchronously, just like visornic does. See bnx2_tx_timeout() and bnx2_reset_task().) Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 9d10b85ac7eb..ec38b51eca01 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -731,6 +731,12 @@ visornic_timeout_reset(struct work_struct *work) devdata = container_of(work, struct visornic_devdata, timeout_reset); netdev = devdata->netdev; + rtnl_lock(); + if (!netif_running(netdev)) { + rtnl_unlock(); + return; + } + response = visornic_disable_with_timeout(netdev, VISORNIC_INFINITE_RSP_WAIT); if (response) @@ -741,10 +747,13 @@ visornic_timeout_reset(struct work_struct *work) if (response) goto call_serverdown; + rtnl_unlock(); + return; call_serverdown: visornic_serverdown(devdata, NULL); + rtnl_unlock(); } /** From 81d275c6c37f075643fec3789ea3f3e4097cda41 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Fri, 24 Jul 2015 12:00:23 -0400 Subject: [PATCH 481/912] staging: unisys: visornic - check visorchannel_signalinsert/remove failures Logic to check for failures of visorchannel_signalinsert() and visorchannel_signalremove() were added, and a new sent_post_failed counter tracks the number of times we failed to post a rcv buffer to the IO partition. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index ec38b51eca01..a4aa8afd04dd 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -102,6 +102,7 @@ struct chanstat { unsigned long sent_enbdis; unsigned long sent_promisc; unsigned long sent_post; + unsigned long sent_post_failed; unsigned long sent_xmit; unsigned long reject_count; unsigned long extra_rcvbufs_sent; @@ -479,11 +480,14 @@ post_skb(struct uiscmdrsp *cmdrsp, if ((cmdrsp->net.rcvpost.frag.pi_off + skb->len) <= PI_PAGE_SIZE) { cmdrsp->net.type = NET_RCV_POST; cmdrsp->cmdtype = CMD_NET_TYPE; - visorchannel_signalinsert(devdata->dev->visorchannel, + if (visorchannel_signalinsert(devdata->dev->visorchannel, IOCHAN_TO_IOPART, - cmdrsp); - atomic_inc(&devdata->num_rcvbuf_in_iovm); - devdata->chstat.sent_post++; + cmdrsp)) { + atomic_inc(&devdata->num_rcvbuf_in_iovm); + devdata->chstat.sent_post++; + } else { + devdata->chstat.sent_post_failed++; + } } } @@ -505,10 +509,10 @@ send_enbdis(struct net_device *netdev, int state, devdata->cmdrsp_rcv->net.enbdis.context = netdev; devdata->cmdrsp_rcv->net.type = NET_RCV_ENBDIS; devdata->cmdrsp_rcv->cmdtype = CMD_NET_TYPE; - visorchannel_signalinsert(devdata->dev->visorchannel, + if (visorchannel_signalinsert(devdata->dev->visorchannel, IOCHAN_TO_IOPART, - devdata->cmdrsp_rcv); - devdata->chstat.sent_enbdis++; + devdata->cmdrsp_rcv)) + devdata->chstat.sent_enbdis++; } /** @@ -1501,6 +1505,9 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, str_pos += scnprintf(vbuf + str_pos, len - str_pos, " chstat.sent_post = %lu\n", devdata->chstat.sent_post); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " chstat.sent_post_failed = %lu\n", + devdata->chstat.sent_post_failed); str_pos += scnprintf(vbuf + str_pos, len - str_pos, " chstat.sent_xmit = %lu\n", devdata->chstat.sent_xmit); From db8499273e0110b2285f9190dcde5e8492d46076 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Fri, 24 Jul 2015 12:00:25 -0400 Subject: [PATCH 482/912] staging: unisys: visornic - prevent NETDEV WATCHDOG timeouts after IO recovery After IO partition recovery, it was possible to get into a situation where a visornic device would repeatedly report: NETDEV WATCHDOG: eth0 (): transmit queue 0 timed out The actual problem would affect any visornic device that was rapidly transmitting at the same time the IO partition was being recovered. Once you hit the problem, the only way to resume use of the nic would be to reboot the Linux client partition. The problem was caused by chstat.sent_xmit and chstat.got_xmit_done NOT getting cleared during IO partition recovery. This is necessary because outstanding xmits would essentially be "abandoned" during such recovery. These fields are now cleared in virtnic_serverdown_complete(). Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index a4aa8afd04dd..2a9b055dcc51 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -380,6 +380,8 @@ visornic_serverdown_complete(struct visornic_devdata *devdata) rtnl_unlock(); atomic_set(&devdata->num_rcvbuf_in_iovm, 0); + devdata->chstat.sent_xmit = 0; + devdata->chstat.got_xmit_done = 0; if (devdata->server_down_complete_func) (*devdata->server_down_complete_func)(devdata->dev, 0); From 57562a72414ca35b2e614cfe0a1b1a7b7e7813dd Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:48 +0200 Subject: [PATCH 483/912] Staging: most: add MOST driver's core module This patch adds the core module of the MOST driver to the kernel's driver staging area. This module is part of the MOST driver and handles the configuration interface in sysfs, the buffer management and the data routing. MOST defines the protocol, hardware and software layers necessary to allow for the efficient and low-cost transport of control, real-time and packet data using a single medium (physical layer). Media currently in use are fiber optics, unshielded twisted pair cables (UTP) and coax cables. MOST also supports various speed grades up to 150 Mbps. For more information on MOST, visit the MOST Cooperation website: www.mostcooperation.com. Cars continue to evolve into sophisticated consumer electronics platforms, increasing the demand for reliable and simple solutions to support audio, video and data communications. MOST can be used to connect multiple consumer devices via optical or electrical physical layers directly to one another or in a network configuration. As a synchronous network, MOST provides excellent Quality of Service and seamless connectivity for audio/video streaming. Therefore, the driver perfectly fits to the mission of Automotive Grade Linux to create open source software solutions for automotive applications. The driver consists basically of three layers. The hardware layer, the core layer and the application layer. The core layer consists of the core module only. This module handles the communication flow through all three layers, the configuration of the driver, the configuration interface representation in sysfs, and the buffer management. For each of the other two layers a selection of modules is provided. These modules can arbitrarily be combined to meet the needs of the desired system architecture. A module of the hardware layer is referred to as an HDM (hardware dependent module). Each module of this layer handles exactly one of the peripheral interfaces of a network interface controller (e.g. USB, MediaLB, I2C). A module of the application layer is referred to as an AIM (application interfacing module). The modules of this layer give access to MOST via one the following ways: character devices, ALSA, Networking or V4L2. To physically access MOST, an Intelligent Network Interface Controller (INIC) is needed. For more information on available controllers visit: www.microchip.com Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/most/Kconfig | 16 + drivers/staging/most/Makefile | 1 + drivers/staging/most/TODO | 8 + drivers/staging/most/mostcore/Kconfig | 13 + drivers/staging/most/mostcore/Makefile | 3 + drivers/staging/most/mostcore/core.c | 1931 ++++++++++++++++++++++ drivers/staging/most/mostcore/mostcore.h | 316 ++++ 9 files changed, 2291 insertions(+) create mode 100644 drivers/staging/most/Kconfig create mode 100644 drivers/staging/most/Makefile create mode 100644 drivers/staging/most/TODO create mode 100644 drivers/staging/most/mostcore/Kconfig create mode 100644 drivers/staging/most/mostcore/Makefile create mode 100644 drivers/staging/most/mostcore/core.c create mode 100644 drivers/staging/most/mostcore/mostcore.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 7f6cae5beb90..4f0b12d88fdc 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -112,4 +112,6 @@ source "drivers/staging/fsl-mc/Kconfig" source "drivers/staging/wilc1000/Kconfig" +source "drivers/staging/most/Kconfig" + endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 347f6477aa3e..37149ca6a331 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -48,3 +48,4 @@ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/ obj-$(CONFIG_FB_TFT) += fbtft/ obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/ obj-$(CONFIG_WILC1000) += wilc1000/ +obj-$(CONFIG_MOST) += most/ diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig new file mode 100644 index 000000000000..b7db320dbacc --- /dev/null +++ b/drivers/staging/most/Kconfig @@ -0,0 +1,16 @@ +menuconfig MOST + tristate "MOST driver" + select MOSTCORE + default n + ---help--- + This option allows you to enable support for MOST Network transceivers. + + If in doubt, say N here. + + + +if MOST + +source "drivers/staging/most/mostcore/Kconfig" + +endif diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile new file mode 100644 index 000000000000..0144be009337 --- /dev/null +++ b/drivers/staging/most/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_MOSTCORE) += mostcore/ diff --git a/drivers/staging/most/TODO b/drivers/staging/most/TODO new file mode 100644 index 000000000000..4fa11a9d2cf7 --- /dev/null +++ b/drivers/staging/most/TODO @@ -0,0 +1,8 @@ +* Get through code review with Greg Kroah-Hartman + +Contact: +To: +Christian Gromm +Cc: +Michael Fabry +Christian Gromm diff --git a/drivers/staging/most/mostcore/Kconfig b/drivers/staging/most/mostcore/Kconfig new file mode 100644 index 000000000000..38abf1b21b66 --- /dev/null +++ b/drivers/staging/most/mostcore/Kconfig @@ -0,0 +1,13 @@ +# +# MOSTCore configuration +# + +config MOSTCORE + tristate "MOST Core" + + ---help--- + Say Y here if you want to enable MOST support. + This device driver needs at least an additional AIM and HDM to work. + + To compile this driver as a module, choose M here: the + module will be called mostcore. diff --git a/drivers/staging/most/mostcore/Makefile b/drivers/staging/most/mostcore/Makefile new file mode 100644 index 000000000000..a078f01cf7c2 --- /dev/null +++ b/drivers/staging/most/mostcore/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_MOSTCORE) += mostcore.o + +mostcore-objs := core.o diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c new file mode 100644 index 000000000000..f4f903404f1b --- /dev/null +++ b/drivers/staging/most/mostcore/core.c @@ -0,0 +1,1931 @@ +/* + * core.c - Implementation of core module of MOST Linux driver stack + * + * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mostcore.h" + +#define MAX_CHANNELS 64 +#define STRING_SIZE 80 + +static struct class *most_class; +static struct device *class_glue_dir; +static struct ida mdev_id; +static int modref; + +struct most_c_obj { + struct kobject kobj; + struct completion cleanup; + atomic_t mbo_ref; + atomic_t mbo_nq_level; + uint16_t channel_id; + bool is_poisoned; + bool is_started; + int is_starving; + struct most_interface *iface; + struct most_inst_obj *inst; + struct most_channel_config cfg; + bool keep_mbo; + bool enqueue_halt; + struct list_head fifo; + spinlock_t fifo_lock; + struct list_head halt_fifo; + struct list_head list; + struct most_aim *first_aim; + struct most_aim *second_aim; + struct list_head trash_fifo; + struct task_struct *hdm_enqueue_task; + struct mutex stop_task_mutex; + wait_queue_head_t hdm_fifo_wq; +}; +#define to_c_obj(d) container_of(d, struct most_c_obj, kobj) + +struct most_inst_obj { + int dev_id; + atomic_t tainted; + struct most_interface *iface; + struct list_head channel_list; + struct most_c_obj *channel[MAX_CHANNELS]; + struct kobject kobj; + struct list_head list; +}; +#define to_inst_obj(d) container_of(d, struct most_inst_obj, kobj) + +/** + * list_pop_mbo - retrieves the first MBO of the list and removes it + * @ptr: the list head to grab the MBO from. + */ +#define list_pop_mbo(ptr) \ +({ \ + struct mbo *_mbo = list_first_entry(ptr, struct mbo, list); \ + list_del(&_mbo->list); \ + _mbo; \ +}) + +static struct mutex deregister_mutex; + +/* ___ ___ + * ___C H A N N E L___ + */ + +/** + * struct most_c_attr - to access the attributes of a channel object + * @attr: attributes of a channel + * @show: pointer to the show function + * @store: pointer to the store function + */ +struct most_c_attr { + struct attribute attr; + ssize_t (*show)(struct most_c_obj *d, + struct most_c_attr *attr, + char *buf); + ssize_t (*store)(struct most_c_obj *d, + struct most_c_attr *attr, + const char *buf, + size_t count); +}; +#define to_channel_attr(a) container_of(a, struct most_c_attr, attr) + +#define MOST_CHNL_ATTR(_name, _mode, _show, _store) \ + struct most_c_attr most_chnl_attr_##_name = \ + __ATTR(_name, _mode, _show, _store) + +/** + * channel_attr_show - show function of channel object + * @kobj: pointer to its kobject + * @attr: pointer to its attributes + * @buf: buffer + */ +static ssize_t channel_attr_show(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + struct most_c_attr *channel_attr = to_channel_attr(attr); + struct most_c_obj *c_obj = to_c_obj(kobj); + + if (!channel_attr->show) + return -EIO; + + return channel_attr->show(c_obj, channel_attr, buf); +} + +/** + * channel_attr_store - store function of channel object + * @kobj: pointer to its kobject + * @attr: pointer to its attributes + * @buf: buffer + * @len: length of buffer + */ +static ssize_t channel_attr_store(struct kobject *kobj, + struct attribute *attr, + const char *buf, + size_t len) +{ + struct most_c_attr *channel_attr = to_channel_attr(attr); + struct most_c_obj *c_obj = to_c_obj(kobj); + + if (!channel_attr->store) + return -EIO; + return channel_attr->store(c_obj, channel_attr, buf, len); +} + +static const struct sysfs_ops most_channel_sysfs_ops = { + .show = channel_attr_show, + .store = channel_attr_store, +}; + +/** + * most_free_mbo_coherent - free an MBO and its coherent buffer + * @mbo: buffer to be released + * + */ +static void most_free_mbo_coherent(struct mbo *mbo) +{ + struct most_c_obj *c = mbo->context; + u16 const coherent_buf_size = c->cfg.buffer_size + c->cfg.extra_len; + + dma_free_coherent(NULL, coherent_buf_size, mbo->virt_address, + mbo->bus_address); + kfree(mbo); + if (atomic_sub_and_test(1, &c->mbo_ref)) + complete(&c->cleanup); +} + +/** + * flush_channel_fifos - clear the channel fifos + * @c: pointer to channel object + */ +void flush_channel_fifos(struct most_c_obj *c) +{ + unsigned long flags, hf_flags; + struct mbo *mbo, *tmp; + + if (list_empty(&c->fifo) && list_empty(&c->halt_fifo)) + return; + + spin_lock_irqsave(&c->fifo_lock, flags); + list_for_each_entry_safe(mbo, tmp, &c->fifo, list) { + list_del(&mbo->list); + spin_unlock_irqrestore(&c->fifo_lock, flags); + if (likely(mbo)) + most_free_mbo_coherent(mbo); + spin_lock_irqsave(&c->fifo_lock, flags); + } + spin_unlock_irqrestore(&c->fifo_lock, flags); + + spin_lock_irqsave(&c->fifo_lock, hf_flags); + list_for_each_entry_safe(mbo, tmp, &c->halt_fifo, list) { + list_del(&mbo->list); + spin_unlock_irqrestore(&c->fifo_lock, hf_flags); + if (likely(mbo)) + most_free_mbo_coherent(mbo); + spin_lock_irqsave(&c->fifo_lock, hf_flags); + } + spin_unlock_irqrestore(&c->fifo_lock, hf_flags); + + if (unlikely((!list_empty(&c->fifo) || !list_empty(&c->halt_fifo)))) + pr_info("WARN: fifo | trash fifo not empty\n"); +} + +/** + * flush_trash_fifo - clear the trash fifo + * @c: pointer to channel object + */ +static int flush_trash_fifo(struct most_c_obj *c) +{ + struct mbo *mbo, *tmp; + unsigned long flags; + + spin_lock_irqsave(&c->fifo_lock, flags); + list_for_each_entry_safe(mbo, tmp, &c->trash_fifo, list) { + list_del(&mbo->list); + spin_unlock_irqrestore(&c->fifo_lock, flags); + most_free_mbo_coherent(mbo); + spin_lock_irqsave(&c->fifo_lock, flags); + } + spin_unlock_irqrestore(&c->fifo_lock, flags); + return 0; +} + +/** + * most_channel_release - release function of channel object + * @kobj: pointer to channel's kobject + */ +static void most_channel_release(struct kobject *kobj) +{ + struct most_c_obj *c = to_c_obj(kobj); + + kfree(c); +} + +static ssize_t show_available_directions(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + unsigned int i = c->channel_id; + + strcpy(buf, ""); + if (c->iface->channel_vector[i].direction & MOST_CH_RX) + strcat(buf, "dir_rx "); + if (c->iface->channel_vector[i].direction & MOST_CH_TX) + strcat(buf, "dir_tx "); + strcat(buf, "\n"); + return strlen(buf) + 1; +} + +static ssize_t show_available_datatypes(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + unsigned int i = c->channel_id; + + strcpy(buf, ""); + if (c->iface->channel_vector[i].data_type & MOST_CH_CONTROL) + strcat(buf, "control "); + if (c->iface->channel_vector[i].data_type & MOST_CH_ASYNC) + strcat(buf, "async "); + if (c->iface->channel_vector[i].data_type & MOST_CH_SYNC) + strcat(buf, "sync "); + if (c->iface->channel_vector[i].data_type & MOST_CH_ISOC_AVP) + strcat(buf, "isoc_avp "); + strcat(buf, "\n"); + return strlen(buf) + 1; +} + +static +ssize_t show_number_of_packet_buffers(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + unsigned int i = c->channel_id; + + return snprintf(buf, PAGE_SIZE, "%d\n", + c->iface->channel_vector[i].num_buffers_packet); +} + +static +ssize_t show_number_of_stream_buffers(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + unsigned int i = c->channel_id; + + return snprintf(buf, PAGE_SIZE, "%d\n", + c->iface->channel_vector[i].num_buffers_streaming); +} + +static +ssize_t show_size_of_packet_buffer(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + unsigned int i = c->channel_id; + + return snprintf(buf, PAGE_SIZE, "%d\n", + c->iface->channel_vector[i].buffer_size_packet); +} + +static +ssize_t show_size_of_stream_buffer(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + unsigned int i = c->channel_id; + + return snprintf(buf, PAGE_SIZE, "%d\n", + c->iface->channel_vector[i].buffer_size_streaming); +} + +static ssize_t show_channel_starving(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", c->is_starving); +} + + +#define create_show_channel_attribute(val) \ + static MOST_CHNL_ATTR(val, S_IRUGO, show_##val, NULL); + +create_show_channel_attribute(available_directions); +create_show_channel_attribute(available_datatypes); +create_show_channel_attribute(number_of_packet_buffers); +create_show_channel_attribute(number_of_stream_buffers); +create_show_channel_attribute(size_of_stream_buffer); +create_show_channel_attribute(size_of_packet_buffer); +create_show_channel_attribute(channel_starving); + +static ssize_t show_set_number_of_buffers(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers); +} + +static ssize_t store_set_number_of_buffers(struct most_c_obj *c, + struct most_c_attr *attr, + const char *buf, + size_t count) +{ + int ret = kstrtou16(buf, 0, &c->cfg.num_buffers); + + if (ret) + return ret; + return count; +} + +static ssize_t show_set_buffer_size(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size); +} + +static ssize_t store_set_buffer_size(struct most_c_obj *c, + struct most_c_attr *attr, + const char *buf, + size_t count) +{ + int ret = kstrtou16(buf, 0, &c->cfg.buffer_size); + + if (ret) + return ret; + return count; +} + +static ssize_t show_set_direction(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + if (c->cfg.direction & MOST_CH_TX) + return snprintf(buf, PAGE_SIZE, "dir_tx\n"); + else if (c->cfg.direction & MOST_CH_RX) + return snprintf(buf, PAGE_SIZE, "dir_rx\n"); + return snprintf(buf, PAGE_SIZE, "unconfigured\n"); +} + +static ssize_t store_set_direction(struct most_c_obj *c, + struct most_c_attr *attr, + const char *buf, + size_t count) +{ + if (!strcmp(buf, "dir_rx\n")) + c->cfg.direction = MOST_CH_RX; + else if (!strcmp(buf, "dir_tx\n")) + c->cfg.direction = MOST_CH_TX; + else { + pr_info("WARN: invalid attribute settings\n"); + return -EINVAL; + } + return count; +} + +static ssize_t show_set_datatype(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + if (c->cfg.data_type & MOST_CH_CONTROL) + return snprintf(buf, PAGE_SIZE, "control\n"); + else if (c->cfg.data_type & MOST_CH_ASYNC) + return snprintf(buf, PAGE_SIZE, "async\n"); + else if (c->cfg.data_type & MOST_CH_SYNC) + return snprintf(buf, PAGE_SIZE, "sync\n"); + else if (c->cfg.data_type & MOST_CH_ISOC_AVP) + return snprintf(buf, PAGE_SIZE, "isoc_avp\n"); + return snprintf(buf, PAGE_SIZE, "unconfigured\n"); +} + +static ssize_t store_set_datatype(struct most_c_obj *c, + struct most_c_attr *attr, + const char *buf, + size_t count) +{ + if (!strcmp(buf, "control\n")) + c->cfg.data_type = MOST_CH_CONTROL; + else if (!strcmp(buf, "async\n")) + c->cfg.data_type = MOST_CH_ASYNC; + else if (!strcmp(buf, "sync\n")) + c->cfg.data_type = MOST_CH_SYNC; + else if (!strcmp(buf, "isoc_avp\n")) + c->cfg.data_type = MOST_CH_ISOC_AVP; + else { + pr_info("WARN: invalid attribute settings\n"); + return -EINVAL; + } + return count; +} + +static ssize_t show_set_subbuffer_size(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size); +} + +static ssize_t store_set_subbuffer_size(struct most_c_obj *c, + struct most_c_attr *attr, + const char *buf, + size_t count) +{ + int ret = kstrtou16(buf, 0, &c->cfg.subbuffer_size); + + if (ret) + return ret; + return count; +} + +static ssize_t show_set_packets_per_xact(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.packets_per_xact); +} + +static ssize_t store_set_packets_per_xact(struct most_c_obj *c, + struct most_c_attr *attr, + const char *buf, + size_t count) +{ + int ret = kstrtou16(buf, 0, &c->cfg.packets_per_xact); + + if (ret) + return ret; + return count; +} + +#define create_channel_attribute(value) \ + static MOST_CHNL_ATTR(value, S_IRUGO | S_IWUSR, \ + show_##value, \ + store_##value) + +create_channel_attribute(set_buffer_size); +create_channel_attribute(set_number_of_buffers); +create_channel_attribute(set_direction); +create_channel_attribute(set_datatype); +create_channel_attribute(set_subbuffer_size); +create_channel_attribute(set_packets_per_xact); + + +/** + * most_channel_def_attrs - array of default attributes of channel object + */ +static struct attribute *most_channel_def_attrs[] = { + &most_chnl_attr_available_directions.attr, + &most_chnl_attr_available_datatypes.attr, + &most_chnl_attr_number_of_packet_buffers.attr, + &most_chnl_attr_number_of_stream_buffers.attr, + &most_chnl_attr_size_of_packet_buffer.attr, + &most_chnl_attr_size_of_stream_buffer.attr, + &most_chnl_attr_set_number_of_buffers.attr, + &most_chnl_attr_set_buffer_size.attr, + &most_chnl_attr_set_direction.attr, + &most_chnl_attr_set_datatype.attr, + &most_chnl_attr_set_subbuffer_size.attr, + &most_chnl_attr_set_packets_per_xact.attr, + &most_chnl_attr_channel_starving.attr, + NULL, +}; + +static struct kobj_type most_channel_ktype = { + .sysfs_ops = &most_channel_sysfs_ops, + .release = most_channel_release, + .default_attrs = most_channel_def_attrs, +}; + +static struct kset *most_channel_kset; + +/** + * create_most_c_obj - allocates a channel object + * @name: name of the channel object + * @parent: parent kobject + * + * This create a channel object and registers it with sysfs. + * Returns a pointer to the object or NULL when something went wrong. + */ +static struct most_c_obj * +create_most_c_obj(const char *name, struct kobject *parent) +{ + struct most_c_obj *c; + int retval; + + c = kzalloc(sizeof(*c), GFP_KERNEL); + if (!c) + return NULL; + c->kobj.kset = most_channel_kset; + retval = kobject_init_and_add(&c->kobj, &most_channel_ktype, parent, + "%s", name); + if (retval) { + kobject_put(&c->kobj); + return NULL; + } + kobject_uevent(&c->kobj, KOBJ_ADD); + return c; +} + +/** + * destroy_most_c_obj - channel release function + * @c: pointer to channel object + * + * This decrements the reference counter of the channel object. + * If the reference count turns zero, its release function is called. + */ +static void destroy_most_c_obj(struct most_c_obj *c) +{ + if (c->first_aim) + c->first_aim->disconnect_channel(c->iface, c->channel_id); + if (c->second_aim) + c->second_aim->disconnect_channel(c->iface, c->channel_id); + c->first_aim = NULL; + c->second_aim = NULL; + + mutex_lock(&deregister_mutex); + flush_trash_fifo(c); + flush_channel_fifos(c); + mutex_unlock(&deregister_mutex); + kobject_put(&c->kobj); +} + +/* ___ ___ + * ___I N S T A N C E___ + */ +#define MOST_INST_ATTR(_name, _mode, _show, _store) \ + struct most_inst_attribute most_inst_attr_##_name = \ + __ATTR(_name, _mode, _show, _store) + +static struct list_head instance_list; + +/** + * struct most_inst_attribute - to access the attributes of instance object + * @attr: attributes of an instance + * @show: pointer to the show function + * @store: pointer to the store function + */ +struct most_inst_attribute { + struct attribute attr; + ssize_t (*show)(struct most_inst_obj *d, + struct most_inst_attribute *attr, + char *buf); + ssize_t (*store)(struct most_inst_obj *d, + struct most_inst_attribute *attr, + const char *buf, + size_t count); +}; +#define to_instance_attr(a) \ + container_of(a, struct most_inst_attribute, attr) + +/** + * instance_attr_show - show function for an instance object + * @kobj: pointer to kobject + * @attr: pointer to attribute struct + * @buf: buffer + */ +static ssize_t instance_attr_show(struct kobject *kobj, + struct attribute *attr, + char *buf) +{ + struct most_inst_attribute *instance_attr; + struct most_inst_obj *instance_obj; + + instance_attr = to_instance_attr(attr); + instance_obj = to_inst_obj(kobj); + + if (!instance_attr->show) + return -EIO; + + return instance_attr->show(instance_obj, instance_attr, buf); +} + +/** + * instance_attr_store - store function for an instance object + * @kobj: pointer to kobject + * @attr: pointer to attribute struct + * @buf: buffer + * @len: length of buffer + */ +static ssize_t instance_attr_store(struct kobject *kobj, + struct attribute *attr, + const char *buf, + size_t len) +{ + struct most_inst_attribute *instance_attr; + struct most_inst_obj *instance_obj; + + instance_attr = to_instance_attr(attr); + instance_obj = to_inst_obj(kobj); + + if (!instance_attr->store) + return -EIO; + + return instance_attr->store(instance_obj, instance_attr, buf, len); +} + +static const struct sysfs_ops most_inst_sysfs_ops = { + .show = instance_attr_show, + .store = instance_attr_store, +}; + +/** + * most_inst_release - release function for instance object + * @kobj: pointer to instance's kobject + * + * This frees the allocated memory for the instance object + */ +static void most_inst_release(struct kobject *kobj) +{ + struct most_inst_obj *inst = to_inst_obj(kobj); + + kfree(inst); +} + +static ssize_t show_description(struct most_inst_obj *instance_obj, + struct most_inst_attribute *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%s\n", + instance_obj->iface->description); +} + +static ssize_t show_interface(struct most_inst_obj *instance_obj, + struct most_inst_attribute *attr, + char *buf) +{ + switch (instance_obj->iface->interface) { + case ITYPE_LOOPBACK: + return snprintf(buf, PAGE_SIZE, "loopback\n"); + case ITYPE_I2C: + return snprintf(buf, PAGE_SIZE, "i2c\n"); + case ITYPE_I2S: + return snprintf(buf, PAGE_SIZE, "i2s\n"); + case ITYPE_TSI: + return snprintf(buf, PAGE_SIZE, "tsi\n"); + case ITYPE_HBI: + return snprintf(buf, PAGE_SIZE, "hbi\n"); + case ITYPE_MEDIALB_DIM: + return snprintf(buf, PAGE_SIZE, "mlb_dim\n"); + case ITYPE_MEDIALB_DIM2: + return snprintf(buf, PAGE_SIZE, "mlb_dim2\n"); + case ITYPE_USB: + return snprintf(buf, PAGE_SIZE, "usb\n"); + case ITYPE_PCIE: + return snprintf(buf, PAGE_SIZE, "pcie\n"); + } + return snprintf(buf, PAGE_SIZE, "unknown\n"); +} + +#define create_inst_attribute(value) \ + static MOST_INST_ATTR(value, S_IRUGO, show_##value, NULL) + +create_inst_attribute(description); +create_inst_attribute(interface); + +static struct attribute *most_inst_def_attrs[] = { + &most_inst_attr_description.attr, + &most_inst_attr_interface.attr, + NULL, +}; + +static struct kobj_type most_inst_ktype = { + .sysfs_ops = &most_inst_sysfs_ops, + .release = most_inst_release, + .default_attrs = most_inst_def_attrs, +}; + +static struct kset *most_inst_kset; + + +/** + * create_most_inst_obj - creates an instance object + * @name: name of the object to be created + * + * This allocates memory for an instance structure, assigns the proper kset + * and registers it with sysfs. + * + * Returns a pointer to the instance object or NULL when something went wrong. + */ +static struct most_inst_obj *create_most_inst_obj(const char *name) +{ + struct most_inst_obj *inst; + int retval; + + inst = kzalloc(sizeof(*inst), GFP_KERNEL); + if (!inst) + return NULL; + inst->kobj.kset = most_inst_kset; + retval = kobject_init_and_add(&inst->kobj, &most_inst_ktype, NULL, + "%s", name); + if (retval) { + kobject_put(&inst->kobj); + return NULL; + } + kobject_uevent(&inst->kobj, KOBJ_ADD); + return inst; +} + +/** + * destroy_most_inst_obj - MOST instance release function + * @inst: pointer to the instance object + * + * This decrements the reference counter of the instance object. + * If the reference count turns zero, its release function is called + */ +static void destroy_most_inst_obj(struct most_inst_obj *inst) +{ + struct most_c_obj *c, *tmp; + + /* need to destroy channels first, since + * each channel incremented the + * reference count of the inst->kobj + */ + list_for_each_entry_safe(c, tmp, &inst->channel_list, list) { + destroy_most_c_obj(c); + } + kobject_put(&inst->kobj); +} + +/* ___ ___ + * ___A I M___ + */ +struct most_aim_obj { + struct kobject kobj; + struct list_head list; + struct most_aim *driver; + char add_link[STRING_SIZE]; + char remove_link[STRING_SIZE]; +}; +#define to_aim_obj(d) container_of(d, struct most_aim_obj, kobj) + +static struct list_head aim_list; + + +/** + * struct most_aim_attribute - to access the attributes of AIM object + * @attr: attributes of an AIM + * @show: pointer to the show function + * @store: pointer to the store function + */ +struct most_aim_attribute { + struct attribute attr; + ssize_t (*show)(struct most_aim_obj *d, + struct most_aim_attribute *attr, + char *buf); + ssize_t (*store)(struct most_aim_obj *d, + struct most_aim_attribute *attr, + const char *buf, + size_t count); +}; +#define to_aim_attr(a) container_of(a, struct most_aim_attribute, attr) + +/** + * aim_attr_show - show function of an AIM object + * @kobj: pointer to kobject + * @attr: pointer to attribute struct + * @buf: buffer + */ +static ssize_t aim_attr_show(struct kobject *kobj, + struct attribute *attr, + char *buf) +{ + struct most_aim_attribute *aim_attr; + struct most_aim_obj *aim_obj; + + aim_attr = to_aim_attr(attr); + aim_obj = to_aim_obj(kobj); + + if (!aim_attr->show) + return -EIO; + + return aim_attr->show(aim_obj, aim_attr, buf); +} + +/** + * aim_attr_store - store function of an AIM object + * @kobj: pointer to kobject + * @attr: pointer to attribute struct + * @buf: buffer + * @len: length of buffer + */ +static ssize_t aim_attr_store(struct kobject *kobj, + struct attribute *attr, + const char *buf, + size_t len) +{ + struct most_aim_attribute *aim_attr; + struct most_aim_obj *aim_obj; + + aim_attr = to_aim_attr(attr); + aim_obj = to_aim_obj(kobj); + + if (!aim_attr->store) + return -EIO; + return aim_attr->store(aim_obj, aim_attr, buf, len); +} + +static const struct sysfs_ops most_aim_sysfs_ops = { + .show = aim_attr_show, + .store = aim_attr_store, +}; + +/** + * most_aim_release - AIM release function + * @kobj: pointer to AIM's kobject + */ +static void most_aim_release(struct kobject *kobj) +{ + struct most_aim_obj *aim_obj = to_aim_obj(kobj); + + kfree(aim_obj); +} + +static ssize_t show_add_link(struct most_aim_obj *aim_obj, + struct most_aim_attribute *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%s\n", aim_obj->add_link); +} + +/** + * split_string - parses and changes string in the buffer buf and + * splits it into two mandatory and one optional substrings. + * + * @buf: complete string from attribute 'add_channel' + * @a: address of pointer to 1st substring (=instance name) + * @b: address of pointer to 2nd substring (=channel name) + * @c: optional address of pointer to 3rd substring (=user defined name) + * + * Examples: + * + * Input: "mdev0:ch0@ep_81:my_channel\n" or + * "mdev0:ch0@ep_81:my_channel" + * + * Output: *a -> "mdev0", *b -> "ch0@ep_81", *c -> "my_channel" + * + * Input: "mdev0:ch0@ep_81\n" + * Output: *a -> "mdev0", *b -> "ch0@ep_81", *c -> "" + * + * Input: "mdev0:ch0@ep_81" + * Output: *a -> "mdev0", *b -> "ch0@ep_81", *c == NULL + */ +int split_string(char *buf, char **a, char **b, char **c) +{ + *a = strsep(&buf, ":"); + if (!*a) + return -EIO; + + *b = strsep(&buf, ":\n"); + if (!*b) + return -EIO; + + if (c) + *c = strsep(&buf, ":\n"); + + return 0; +} + +/** + * get_channel_by_name - get pointer to channel object + * @mdev: name of the device instance + * @mdev_ch: name of the respective channel + * + * This retrieves the pointer to a channel object. + */ +static struct +most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch) +{ + struct most_c_obj *c, *tmp; + struct most_inst_obj *i, *i_tmp; + int found = 0; + + list_for_each_entry_safe(i, i_tmp, &instance_list, list) { + if (!strcmp(kobject_name(&i->kobj), mdev)) { + found++; + break; + } + } + if (unlikely(!found)) + return ERR_PTR(-EIO); + + list_for_each_entry_safe(c, tmp, &i->channel_list, list) { + if (!strcmp(kobject_name(&c->kobj), mdev_ch)) { + found++; + break; + } + } + if (unlikely(2 > found)) + return ERR_PTR(-EIO); + return c; +} + +/** + * store_add_link - store() function for add_link attribute + * @aim_obj: pointer to AIM object + * @attr: its attributes + * @buf: buffer + * @len: buffer length + * + * This parses the string given by buf and splits it into + * three substrings. Note: third substring is optional. In case a cdev + * AIM is loaded the optional 3rd substring will make up the name of + * device node in the /dev directory. If omitted, the device node will + * inherit the channel's name within sysfs. + * + * Searches for a pair of device and channel and probes the AIM + * + * Example: + * (1) echo -n -e "mdev0:ch0@ep_81:my_rxchannel\n" >add_link + * (2) echo -n -e "mdev0:ch0@ep_81\n" >add_link + * + * (1) would create the device node /dev/my_rxchannel + * (2) would create the device node /dev/mdev0-ch0@ep_81 + */ +static ssize_t store_add_link(struct most_aim_obj *aim_obj, + struct most_aim_attribute *attr, + const char *buf, + size_t len) +{ + struct most_c_obj *c; + struct most_aim **aim_ptr; + char buffer[STRING_SIZE]; + char *mdev; + char *mdev_ch; + char *mdev_devnod; + char devnod_buf[STRING_SIZE]; + int ret; + unsigned int max_len = min((int)len + 1, STRING_SIZE); + + strlcpy(buffer, buf, max_len); + strlcpy(aim_obj->add_link, buf, max_len); + + ret = split_string(buffer, &mdev, &mdev_ch, &mdev_devnod); + if (ret) + return ret; + + if (mdev_devnod == 0 || *mdev_devnod == 0) { + snprintf(devnod_buf, PAGE_SIZE, "%s-%s", mdev, mdev_ch); + mdev_devnod = devnod_buf; + } + + c = get_channel_by_name(mdev, mdev_ch); + if (IS_ERR(c)) + return -ENODEV; + + if (!c->first_aim) + aim_ptr = &c->first_aim; + else if (!c->second_aim) + aim_ptr = &c->second_aim; + else + return -ENOSPC; + + ret = aim_obj->driver->probe_channel(c->iface, c->channel_id, + &c->cfg, &c->kobj, mdev_devnod); + if (ret) + return ret; + *aim_ptr = aim_obj->driver; + return len; +} + +struct most_aim_attribute most_aim_attr_add_link = + __ATTR(add_link, S_IRUGO | S_IWUSR, show_add_link, store_add_link); + +static ssize_t show_remove_link(struct most_aim_obj *aim_obj, + struct most_aim_attribute *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%s\n", aim_obj->remove_link); +} + +/** + * store_remove_link - store function for remove_link attribute + * @aim_obj: pointer to AIM object + * @attr: its attributes + * @buf: buffer + * @len: buffer length + * + * Example: + * echo -n -e "mdev0:ch0@ep_81\n" >remove_link + */ +static ssize_t store_remove_link(struct most_aim_obj *aim_obj, + struct most_aim_attribute *attr, + const char *buf, + size_t len) +{ + struct most_c_obj *c; + char buffer[STRING_SIZE]; + char *mdev; + char *mdev_ch; + int ret; + unsigned int max_len = min((int)len + 1, STRING_SIZE); + + strlcpy(buffer, buf, max_len); + strlcpy(aim_obj->remove_link, buf, max_len); + ret = split_string(buffer, &mdev, &mdev_ch, NULL); + if (ret) + return ret; + + c = get_channel_by_name(mdev, mdev_ch); + if (IS_ERR(c)) + return -ENODEV; + + if (c->first_aim == aim_obj->driver) + c->first_aim = NULL; + if (c->second_aim == aim_obj->driver) + c->second_aim = NULL; + if (aim_obj->driver->disconnect_channel(c->iface, c->channel_id)) + return -EIO; + return len; +} + +struct most_aim_attribute most_aim_attr_remove_link = + __ATTR(remove_link, S_IRUGO | S_IWUSR, show_remove_link, store_remove_link); + +static struct attribute *most_aim_def_attrs[] = { + &most_aim_attr_add_link.attr, + &most_aim_attr_remove_link.attr, + NULL, +}; + +static struct kobj_type most_aim_ktype = { + .sysfs_ops = &most_aim_sysfs_ops, + .release = most_aim_release, + .default_attrs = most_aim_def_attrs, +}; + +static struct kset *most_aim_kset; + +/** + * create_most_aim_obj - creates an AIM object + * @name: name of the AIM + * + * This creates an AIM object assigns the proper kset and registers + * it with sysfs. + * Returns a pointer to the object or NULL if something went wrong. + */ +static struct most_aim_obj *create_most_aim_obj(const char *name) +{ + struct most_aim_obj *most_aim; + int retval; + + most_aim = kzalloc(sizeof(*most_aim), GFP_KERNEL); + if (!most_aim) + return NULL; + most_aim->kobj.kset = most_aim_kset; + retval = kobject_init_and_add(&most_aim->kobj, &most_aim_ktype, + NULL, "%s", name); + if (retval) { + kobject_put(&most_aim->kobj); + return NULL; + } + kobject_uevent(&most_aim->kobj, KOBJ_ADD); + return most_aim; +} + +/** + * destroy_most_aim_obj - AIM release function + * @p: pointer to AIM object + * + * This decrements the reference counter of the AIM object. If the + * reference count turns zero, its release function will be called. + */ +static void destroy_most_aim_obj(struct most_aim_obj *p) +{ + kobject_put(&p->kobj); +} + + +/* ___ ___ + * ___C O R E___ + */ + +/** + * Instantiation of the MOST bus + */ +struct bus_type most_bus = { + .name = "most", +}; + +/** + * Instantiation of the core driver + */ +struct device_driver mostcore = { + .name = "mostcore", + .bus = &most_bus, +}; + +static inline void trash_mbo(struct mbo *mbo) +{ + unsigned long flags; + struct most_c_obj *c = mbo->context; + + spin_lock_irqsave(&c->fifo_lock, flags); + list_add(&mbo->list, &c->trash_fifo); + spin_unlock_irqrestore(&c->fifo_lock, flags); +} + +static struct mbo *get_hdm_mbo(struct most_c_obj *c) +{ + unsigned long flags; + struct mbo *mbo; + + spin_lock_irqsave(&c->fifo_lock, flags); + if (c->enqueue_halt || list_empty(&c->halt_fifo)) + mbo = NULL; + else + mbo = list_pop_mbo(&c->halt_fifo); + spin_unlock_irqrestore(&c->fifo_lock, flags); + return mbo; +} + +static void nq_hdm_mbo(struct mbo *mbo) +{ + unsigned long flags; + struct most_c_obj *c = mbo->context; + + spin_lock_irqsave(&c->fifo_lock, flags); + list_add_tail(&mbo->list, &c->halt_fifo); + spin_unlock_irqrestore(&c->fifo_lock, flags); + wake_up_interruptible(&c->hdm_fifo_wq); +} + +static int hdm_enqueue_thread(void *data) +{ + struct most_c_obj *c = data; + struct mbo *mbo; + typeof(c->iface->enqueue) enqueue = c->iface->enqueue; + + while (likely(!kthread_should_stop())) { + wait_event_interruptible(c->hdm_fifo_wq, + (mbo = get_hdm_mbo(c)) + || kthread_should_stop()); + + if (unlikely(!mbo)) + continue; + + if (c->cfg.direction == MOST_CH_RX) + mbo->buffer_length = c->cfg.buffer_size; + + if (unlikely(enqueue(mbo->ifp, mbo->hdm_channel_id, mbo))) { + pr_err("hdm enqueue failed\n"); + nq_hdm_mbo(mbo); + c->hdm_enqueue_task = NULL; + return 0; + } + } + + return 0; +} + +static int run_enqueue_thread(struct most_c_obj *c, int channel_id) +{ + struct task_struct *task = + kthread_run(&hdm_enqueue_thread, c, "hdm_fifo_%d", channel_id); + + if (IS_ERR(task)) + return PTR_ERR(task); + + c->hdm_enqueue_task = task; + return 0; +} + +/** + * arm_mbo - recycle MBO for further usage + * @mbo: buffer object + * + * This puts an MBO back to the list to have it ready for up coming + * tx transactions. + * + * In case the MBO belongs to a channel that recently has been + * poisoned, the MBO is scheduled to be trashed. + * Calls the completion handler of an attached AIM. + */ +static void arm_mbo(struct mbo *mbo) +{ + unsigned long flags; + struct most_c_obj *c; + + BUG_ON((!mbo) || (!mbo->context)); + c = mbo->context; + + if (c->is_poisoned) { + trash_mbo(mbo); + return; + } + + spin_lock_irqsave(&c->fifo_lock, flags); + list_add_tail(&mbo->list, &c->fifo); + spin_unlock_irqrestore(&c->fifo_lock, flags); + + if (c->second_aim && c->second_aim->tx_completion) + c->second_aim->tx_completion(c->iface, c->channel_id); + if (c->first_aim && c->first_aim->tx_completion) + c->first_aim->tx_completion(c->iface, c->channel_id); +} + +/** + * arm_mbo_chain - helper function that arms an MBO chain for the HDM + * @c: pointer to interface channel + * @dir: direction of the channel + * @compl: pointer to completion function + * + * This allocates buffer objects including the containing DMA coherent + * buffer and puts them in the fifo. + * Buffers of Rx channels are put in the kthread fifo, hence immediately + * submitted to the HDM. + * + * Returns the number of allocated and enqueued MBOs. + */ +int arm_mbo_chain(struct most_c_obj *c, int dir, void (*compl)(struct mbo *)) +{ + unsigned int i; + int retval; + struct mbo *mbo; + u16 coherent_buf_size = c->cfg.buffer_size + c->cfg.extra_len; + + atomic_set(&c->mbo_nq_level, 0); + + for (i = 0; i < c->cfg.num_buffers; i++) { + mbo = kzalloc(sizeof(*mbo), GFP_KERNEL); + if (!mbo) { + pr_info("WARN: Allocation of MBO failed.\n"); + retval = i; + goto _exit; + } + mbo->context = c; + mbo->ifp = c->iface; + mbo->hdm_channel_id = c->channel_id; + mbo->virt_address = dma_alloc_coherent(NULL, + coherent_buf_size, + &mbo->bus_address, + GFP_KERNEL); + if (!mbo->virt_address) { + pr_info("WARN: No DMA coherent buffer.\n"); + retval = i; + goto _error1; + } + mbo->complete = compl; + if (dir == MOST_CH_RX) { + nq_hdm_mbo(mbo); + atomic_inc(&c->mbo_nq_level); + } else { + arm_mbo(mbo); + } + } + return i; + +_error1: + kfree(mbo); +_exit: + return retval; +} + +/** + * most_submit_mbo - submits an MBO to fifo + * @mbo: pointer to the MBO + * + */ +int most_submit_mbo(struct mbo *mbo) +{ + struct most_c_obj *c; + struct most_inst_obj *i; + + if (unlikely((!mbo) || (!mbo->context))) { + pr_err("Bad MBO or missing channel reference\n"); + return -EINVAL; + } + c = mbo->context; + i = c->inst; + + if (unlikely(atomic_read(&i->tainted))) + return -ENODEV; + + nq_hdm_mbo(mbo); + return 0; +} +EXPORT_SYMBOL_GPL(most_submit_mbo); + +/** + * most_write_completion - write completion handler + * @mbo: pointer to MBO + * + * This recycles the MBO for further usage. In case the channel has been + * poisoned, the MBO is scheduled to be trashed. + */ +static void most_write_completion(struct mbo *mbo) +{ + struct most_c_obj *c; + + BUG_ON((!mbo) || (!mbo->context)); + + c = mbo->context; + if (mbo->status == MBO_E_INVAL) + pr_info("WARN: Tx MBO status: invalid\n"); + if (unlikely((c->is_poisoned == true) || (mbo->status == MBO_E_CLOSE))) + trash_mbo(mbo); + else + arm_mbo(mbo); +} + +/** + * get_channel_by_iface - get pointer to channel object + * @iface: pointer to interface instance + * @id: channel ID + * + * This retrieves a pointer to a channel of the given interface and channel ID. + */ +static struct +most_c_obj *get_channel_by_iface(struct most_interface *iface, int id) +{ + struct most_inst_obj *i; + + if (unlikely(!iface)) { + pr_err("Bad interface\n"); + return NULL; + } + if (unlikely((id < 0) || (id >= iface->num_channels))) { + pr_err("Channel index (%d) out of range\n", id); + return NULL; + } + i = iface->priv; + if (unlikely(!i)) { + pr_err("interface is not registered\n"); + return NULL; + } + return i->channel[id]; +} + +/** + * most_get_mbo - get pointer to an MBO of pool + * @iface: pointer to interface instance + * @id: channel ID + * + * This attempts to get a free buffer out of the channel fifo. + * Returns a pointer to MBO on success or NULL otherwise. + */ +struct mbo *most_get_mbo(struct most_interface *iface, int id) +{ + struct mbo *mbo; + struct most_c_obj *c; + unsigned long flags; + + c = get_channel_by_iface(iface, id); + if (unlikely(!c)) + return NULL; + spin_lock_irqsave(&c->fifo_lock, flags); + if (list_empty(&c->fifo)) { + spin_unlock_irqrestore(&c->fifo_lock, flags); + return NULL; + } + mbo = list_pop_mbo(&c->fifo); + spin_unlock_irqrestore(&c->fifo_lock, flags); + mbo->buffer_length = c->cfg.buffer_size; + return mbo; +} +EXPORT_SYMBOL_GPL(most_get_mbo); + + +/** + * most_put_mbo - return buffer to pool + * @mbo: buffer object + */ +void most_put_mbo(struct mbo *mbo) +{ + struct most_c_obj *c; + struct most_inst_obj *i; + + c = mbo->context; + i = c->inst; + + if (unlikely(atomic_read(&i->tainted))) { + mbo->status = MBO_E_CLOSE; + trash_mbo(mbo); + return; + } + if (c->cfg.direction == MOST_CH_TX) { + arm_mbo(mbo); + return; + } + nq_hdm_mbo(mbo); + atomic_inc(&c->mbo_nq_level); +} +EXPORT_SYMBOL_GPL(most_put_mbo); + +/** + * most_read_completion - read completion handler + * @mbo: pointer to MBO + * + * This function is called by the HDM when data has been received from the + * hardware and copied to the buffer of the MBO. + * + * In case the channel has been poisoned it puts the buffer in the trash queue. + * Otherwise, it passes the buffer to an AIM for further processing. + */ +static void most_read_completion(struct mbo *mbo) +{ + struct most_c_obj *c; + + c = mbo->context; + if (unlikely((c->is_poisoned == true) || (mbo->status == MBO_E_CLOSE))) + goto release_mbo; + + if (mbo->status == MBO_E_INVAL) { + nq_hdm_mbo(mbo); + atomic_inc(&c->mbo_nq_level); + return; + } + + if (atomic_sub_and_test(1, &c->mbo_nq_level)) { + pr_info("WARN: rx device out of buffers\n"); + c->is_starving = 1; + } + + if (c->first_aim && c->first_aim->rx_completion && + c->first_aim->rx_completion(mbo) == 0) + return; + if (c->second_aim && c->second_aim->rx_completion && + c->second_aim->rx_completion(mbo) == 0) + return; + pr_info("WARN: no driver linked with this channel\n"); + mbo->status = MBO_E_CLOSE; +release_mbo: + trash_mbo(mbo); +} + +/** + * most_start_channel - prepares a channel for communication + * @iface: pointer to interface instance + * @id: channel ID + * + * This prepares the channel for usage. Cross-checks whether the + * channel's been properly configured. + * + * Returns 0 on success or error code otherwise. + */ +int most_start_channel(struct most_interface *iface, int id) +{ + int num_buffer; + int ret; + struct most_c_obj *c = get_channel_by_iface(iface, id); + + if (unlikely(!c)) + return -EINVAL; + + if (c->is_started) + return -EBUSY; + + if (!try_module_get(iface->mod)) { + pr_info("failed to acquire HDM lock\n"); + return -ENOLCK; + } + modref++; + + c->cfg.extra_len = 0; + if (c->iface->configure(c->iface, c->channel_id, &c->cfg)) { + pr_info("channel configuration failed. Go check settings...\n"); + ret = -EINVAL; + goto error; + } + + init_waitqueue_head(&c->hdm_fifo_wq); + + if (c->cfg.direction == MOST_CH_RX) + num_buffer = arm_mbo_chain(c, c->cfg.direction, + most_read_completion); + else + num_buffer = arm_mbo_chain(c, c->cfg.direction, + most_write_completion); + if (unlikely(0 == num_buffer)) { + pr_info("failed to allocate memory\n"); + ret = -ENOMEM; + goto error; + } + + ret = run_enqueue_thread(c, id); + if (ret) + goto error; + + c->is_started = true; + c->is_starving = 0; + atomic_set(&c->mbo_ref, num_buffer); + return 0; +error: + if (iface->mod) + module_put(iface->mod); + modref--; + return ret; +} +EXPORT_SYMBOL_GPL(most_start_channel); + +/** + * most_stop_channel - stops a running channel + * @iface: pointer to interface instance + * @id: channel ID + */ +int most_stop_channel(struct most_interface *iface, int id) +{ + struct most_c_obj *c; + + if (unlikely((!iface) || (id >= iface->num_channels) || (id < 0))) { + pr_err("Bad interface or index out of range\n"); + return -EINVAL; + } + c = get_channel_by_iface(iface, id); + if (unlikely(!c)) + return -EINVAL; + + if (!c->is_started) + return 0; + + /* FIXME: we need to know calling AIM to reset only one link */ + c->first_aim = NULL; + c->second_aim = NULL; + /* do not go into recursion calling aim->disconnect_channel */ + + mutex_lock(&c->stop_task_mutex); + if (c->hdm_enqueue_task) + kthread_stop(c->hdm_enqueue_task); + c->hdm_enqueue_task = NULL; + mutex_unlock(&c->stop_task_mutex); + + mutex_lock(&deregister_mutex); + if (atomic_read(&c->inst->tainted)) { + mutex_unlock(&deregister_mutex); + return -ENODEV; + } + mutex_unlock(&deregister_mutex); + + if (iface->mod && modref) { + module_put(iface->mod); + modref--; + } + + c->is_poisoned = true; + if (c->iface->poison_channel(c->iface, c->channel_id)) { + pr_err("Cannot stop channel %d of mdev %s\n", c->channel_id, + c->iface->description); + return -EAGAIN; + } + flush_trash_fifo(c); + flush_channel_fifos(c); + +#ifdef CMPL_INTERRUPTIBLE + if (wait_for_completion_interruptible(&c->cleanup)) { + pr_info("Interrupted while clean up ch %d\n", c->channel_id); + return -EINTR; + } +#else + wait_for_completion(&c->cleanup); +#endif + c->is_poisoned = false; + c->is_started = false; + return 0; +} +EXPORT_SYMBOL_GPL(most_stop_channel); + +/** + * most_register_aim - registers an AIM (driver) with the core + * @aim: instance of AIM to be registered + */ +int most_register_aim(struct most_aim *aim) +{ + struct most_aim_obj *aim_obj; + + if (!aim) { + pr_err("Bad driver\n"); + return -EINVAL; + } + aim_obj = create_most_aim_obj(aim->name); + if (!aim_obj) { + pr_info("failed to alloc driver object\n"); + return -ENOMEM; + } + aim_obj->driver = aim; + aim->context = aim_obj; + pr_info("registered new application interfacing module %s\n", + aim->name); + list_add_tail(&aim_obj->list, &aim_list); + return 0; +} +EXPORT_SYMBOL_GPL(most_register_aim); + +/** + * most_deregister_aim - deregisters an AIM (driver) with the core + * @aim: AIM to be removed + */ +int most_deregister_aim(struct most_aim *aim) +{ + struct most_aim_obj *aim_obj; + struct most_c_obj *c, *tmp; + struct most_inst_obj *i, *i_tmp; + + if (!aim) { + pr_err("Bad driver\n"); + return -EINVAL; + } + + aim_obj = aim->context; + if (!aim_obj) { + pr_info("driver not registered.\n"); + return -EINVAL; + } + list_for_each_entry_safe(i, i_tmp, &instance_list, list) { + list_for_each_entry_safe(c, tmp, &i->channel_list, list) { + if (c->first_aim == aim || c->second_aim == aim) + aim->disconnect_channel( + c->iface, c->channel_id); + if (c->first_aim == aim) + c->first_aim = NULL; + if (c->second_aim == aim) + c->second_aim = NULL; + } + } + list_del(&aim_obj->list); + destroy_most_aim_obj(aim_obj); + pr_info("deregistering application interfacing module %s\n", aim->name); + return 0; +} +EXPORT_SYMBOL_GPL(most_deregister_aim); + +/** + * most_register_interface - registers an interface with core + * @iface: pointer to the instance of the interface description. + * + * Allocates and initializes a new interface instance and all of its channels. + * Returns a pointer to kobject or an error pointer. + */ +struct kobject *most_register_interface(struct most_interface *iface) +{ + unsigned int i; + int id; + char name[STRING_SIZE]; + char channel_name[STRING_SIZE]; + struct most_c_obj *c; + struct most_inst_obj *inst; + + if (!iface || !iface->enqueue || !iface->configure || + !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) { + pr_err("Bad interface or channel overflow\n"); + return ERR_PTR(-EINVAL); + } + + id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL); + if (id < 0) { + pr_info("Failed to alloc mdev ID\n"); + return ERR_PTR(id); + } + snprintf(name, STRING_SIZE, "mdev%d", id); + + inst = create_most_inst_obj(name); + if (!inst) { + pr_info("Failed to allocate interface instance\n"); + return ERR_PTR(-ENOMEM); + } + + iface->priv = inst; + INIT_LIST_HEAD(&inst->channel_list); + inst->iface = iface; + inst->dev_id = id; + atomic_set(&inst->tainted, 0); + list_add_tail(&inst->list, &instance_list); + + for (i = 0; i < iface->num_channels; i++) { + const char *name_suffix = iface->channel_vector[i].name_suffix; + + if (!name_suffix) + snprintf(channel_name, STRING_SIZE, "ch%d", i); + else if (name_suffix[0] == '@') + snprintf(channel_name, STRING_SIZE, "ch%d%s", i, + name_suffix); + else + snprintf(channel_name, STRING_SIZE, "%s", name_suffix); + + /* this increments the reference count of this instance */ + c = create_most_c_obj(channel_name, &inst->kobj); + if (!c) + goto free_instance; + inst->channel[i] = c; + c->is_starving = 0; + c->iface = iface; + c->inst = inst; + c->channel_id = i; + c->keep_mbo = false; + c->enqueue_halt = false; + c->is_poisoned = false; + c->is_started = false; + c->cfg.direction = 0; + c->cfg.data_type = 0; + c->cfg.num_buffers = 0; + c->cfg.buffer_size = 0; + c->cfg.subbuffer_size = 0; + c->cfg.packets_per_xact = 0; + spin_lock_init(&c->fifo_lock); + INIT_LIST_HEAD(&c->fifo); + INIT_LIST_HEAD(&c->trash_fifo); + INIT_LIST_HEAD(&c->halt_fifo); + init_completion(&c->cleanup); + atomic_set(&c->mbo_ref, 0); + mutex_init(&c->stop_task_mutex); + list_add_tail(&c->list, &inst->channel_list); + } + pr_info("registered new MOST device mdev%d (%s)\n", + inst->dev_id, iface->description); + return &inst->kobj; + +free_instance: + pr_info("Failed allocate channel(s)\n"); + list_del(&inst->list); + destroy_most_inst_obj(inst); + return ERR_PTR(-ENOMEM); +} +EXPORT_SYMBOL_GPL(most_register_interface); + +/** + * most_deregister_interface - deregisters an interface with core + * @iface: pointer to the interface instance description. + * + * Before removing an interface instance from the list, all running + * channels are stopped and poisoned. + */ +void most_deregister_interface(struct most_interface *iface) +{ + struct most_inst_obj *i = iface->priv; + struct most_c_obj *c; + + mutex_lock(&deregister_mutex); + if (unlikely(!i)) { + pr_info("Bad Interface\n"); + mutex_unlock(&deregister_mutex); + return; + } + pr_info("deregistering MOST device %s (%s)\n", i->kobj.name, + iface->description); + + atomic_set(&i->tainted, 1); + mutex_unlock(&deregister_mutex); + + while (modref) { + if (iface->mod && modref) + module_put(iface->mod); + modref--; + } + + list_for_each_entry(c, &i->channel_list, list) { + if (!c->is_started) + continue; + + mutex_lock(&c->stop_task_mutex); + if (c->hdm_enqueue_task) + kthread_stop(c->hdm_enqueue_task); + c->hdm_enqueue_task = NULL; + mutex_unlock(&c->stop_task_mutex); + + if (iface->poison_channel(iface, c->channel_id)) + pr_err("Can't poison channel %d\n", c->channel_id); + } + ida_simple_remove(&mdev_id, i->dev_id); + list_del(&i->list); + destroy_most_inst_obj(i); +} +EXPORT_SYMBOL_GPL(most_deregister_interface); + +/** + * most_stop_enqueue - prevents core from enqueueing MBOs + * @iface: pointer to interface + * @id: channel id + * + * This is called by an HDM that _cannot_ attend to its duties and + * is imminent to get run over by the core. The core is not going to + * enqueue any further packets unless the flagging HDM calls + * most_resume enqueue(). + */ +void most_stop_enqueue(struct most_interface *iface, int id) +{ + struct most_c_obj *c = get_channel_by_iface(iface, id); + + if (likely(c)) + c->enqueue_halt = true; +} +EXPORT_SYMBOL_GPL(most_stop_enqueue); + +/** + * most_resume_enqueue - allow core to enqueue MBOs again + * @iface: pointer to interface + * @id: channel id + * + * This clears the enqueue halt flag and enqueues all MBOs currently + * sitting in the wait fifo. + */ +void most_resume_enqueue(struct most_interface *iface, int id) +{ + struct most_c_obj *c = get_channel_by_iface(iface, id); + + if (unlikely(!c)) + return; + c->enqueue_halt = false; + + wake_up_interruptible(&c->hdm_fifo_wq); +} +EXPORT_SYMBOL_GPL(most_resume_enqueue); + +static int __init most_init(void) +{ + pr_info("init()\n"); + INIT_LIST_HEAD(&instance_list); + INIT_LIST_HEAD(&aim_list); + mutex_init(&deregister_mutex); + ida_init(&mdev_id); + + if (bus_register(&most_bus)) { + pr_info("Cannot register most bus\n"); + goto exit; + } + + most_class = class_create(THIS_MODULE, "most"); + if (IS_ERR(most_class)) { + pr_info("No udev support.\n"); + goto exit_bus; + } + if (driver_register(&mostcore)) { + pr_info("Cannot register core driver\n"); + goto exit_class; + } + + class_glue_dir = + device_create(most_class, NULL, 0, NULL, "mostcore"); + if (!class_glue_dir) + goto exit_driver; + + most_aim_kset = + kset_create_and_add("aims", NULL, &class_glue_dir->kobj); + if (!most_aim_kset) + goto exit_class_container; + + most_inst_kset = + kset_create_and_add("devices", NULL, &class_glue_dir->kobj); + if (!most_inst_kset) + goto exit_driver_kset; + + return 0; + +exit_driver_kset: + kset_unregister(most_aim_kset); +exit_class_container: + device_destroy(most_class, 0); +exit_driver: + driver_unregister(&mostcore); +exit_class: + class_destroy(most_class); +exit_bus: + bus_unregister(&most_bus); +exit: + return -ENOMEM; +} + +static void __exit most_exit(void) +{ + struct most_inst_obj *i, *i_tmp; + struct most_aim_obj *d, *d_tmp; + + pr_info("exit core module\n"); + list_for_each_entry_safe(d, d_tmp, &aim_list, list) { + destroy_most_aim_obj(d); + } + + list_for_each_entry_safe(i, i_tmp, &instance_list, list) { + list_del(&i->list); + destroy_most_inst_obj(i); + } + kset_unregister(most_inst_kset); + kset_unregister(most_aim_kset); + device_destroy(most_class, 0); + driver_unregister(&mostcore); + class_destroy(most_class); + bus_unregister(&most_bus); + ida_destroy(&mdev_id); +} + +module_init(most_init); +module_exit(most_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Christian Gromm "); +MODULE_DESCRIPTION("Core module of stacked MOST Linux driver"); diff --git a/drivers/staging/most/mostcore/mostcore.h b/drivers/staging/most/mostcore/mostcore.h new file mode 100644 index 000000000000..299c7d5aa73a --- /dev/null +++ b/drivers/staging/most/mostcore/mostcore.h @@ -0,0 +1,316 @@ +/* + * mostcore.h - Interface between MostCore, + * Hardware Dependent Module (HDM) and Application Interface Module (AIM). + * + * Copyright (C) 2013-2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +/* + * Authors: + * Andrey Shvetsov + * Christian Gromm + * Sebastian Graf + */ + +#ifndef __MOST_CORE_H__ +#define __MOST_CORE_H__ + +#include + +struct kobject; +struct module; + +/** + * Interface type + */ +enum most_interface_type { + ITYPE_LOOPBACK = 1, + ITYPE_I2C, + ITYPE_I2S, + ITYPE_TSI, + ITYPE_HBI, + ITYPE_MEDIALB_DIM, + ITYPE_MEDIALB_DIM2, + ITYPE_USB, + ITYPE_PCIE +}; + +/** + * Channel direction. + */ +enum most_channel_direction { + MOST_CH_RX = 1 << 0, + MOST_CH_TX = 1 << 1, +}; + +/** + * Channel data type. + */ +enum most_channel_data_type { + MOST_CH_CONTROL = 1 << 0, + MOST_CH_ASYNC = 1 << 1, + MOST_CH_ISOC_AVP = 1 << 2, + MOST_CH_SYNC = 1 << 5, +}; + + +enum mbo_status_flags { + /* MBO was processed successfully (data was send or received )*/ + MBO_SUCCESS = 0, + /* The MBO contains wrong or missing information. */ + MBO_E_INVAL, + /* MBO was completed as HDM Channel will be closed */ + MBO_E_CLOSE, +}; + +/** + * struct most_channel_capability - Channel capability + * @direction: Supported channel directions. + * The value is bitwise OR-combination of the values from the + * enumeration most_channel_direction. Zero is allowed value and means + * "channel may not be used". + * @data_type: Supported channel data types. + * The value is bitwise OR-combination of the values from the + * enumeration most_channel_data_type. Zero is allowed value and means + * "channel may not be used". + * @num_buffer_packet: Maximum number of buffers supported by this channel + * for packet data types (Async,Control,QoS) + * @buffer_size_packet: Maximum buffer size supported by this channel + * for packet data types (Async,Control,QoS) + * @num_buffer_streaming: Maximum number of buffers supported by this channel + * for streaming data types (Sync,AV Packetized) + * @buffer_size_streaming: Maximum buffer size supported by this channel + * for streaming data types (Sync,AV Packetized) + * @name_suffix: Optional suffix providean by an HDM that is attached to the + * regular channel name. + * + * Describes the capabilities of a MostCore channel like supported Data Types + * and directions. This information is provided by an HDM for the MostCore. + * + * The Core creates read only sysfs attribute files in + * /sys/devices/virtual/most/mostcore/devices/mdev-#/mdev#-ch#/ with the + * following attributes: + * -available_directions + * -available_datatypes + * -number_of_packet_buffers + * -number_of_stream_buffers + * -size_of_packet_buffer + * -size_of_stream_buffer + * where content of each file is a string with all supported properties of this + * very channel attribute. + */ +struct most_channel_capability { + u16 direction; + u16 data_type; + u16 num_buffers_packet; + u16 buffer_size_packet; + u16 num_buffers_streaming; + u16 buffer_size_streaming; + char *name_suffix; +}; + +/** + * struct most_channel_config - stores channel configuration + * @direction: direction of the channel + * @data_type: data type travelling over this channel + * @num_buffers: number of buffers + * @buffer_size: size of a buffer for AIM. + * Buffer size may be cutted down by HDM in a configure callback + * to match to a given interface and channel type. + * @extra_len: additional buffer space for internal HDM purposes like padding. + * May be set by HDM in a configure callback if needed. + * @subbuffer_size: size of a subbuffer + * @packets_per_xact: number of MOST frames that are packet inside one USB + * packet. This is USB specific + * + * Describes the configuration for a MostCore channel. This information is + * provided from the MostCore to a HDM (like the Medusa PCIe Interface) as a + * parameter of the "configure" function call. + */ +struct most_channel_config { + enum most_channel_direction direction; + enum most_channel_data_type data_type; + u16 num_buffers; + u16 buffer_size; + u16 extra_len; + u16 subbuffer_size; + u16 packets_per_xact; +}; + +/* + * struct mbo - MOST Buffer Object. + * @context: context for core completion handler + * @priv: private data for HDM + * + * public: documented fields that are used for the communications + * between MostCore and HDMs + * + * @list: list head for use by the mbo's current owner + * @ifp: (in) associated interface instance + * @hdm_channel_id: (in) HDM channel instance + * @virt_address: (in) kernel virtual address of the buffer + * @bus_address: (in) bus address of the buffer + * @buffer_length: (in) buffer payload length + * @processed_length: (out) processed length + * @status: (out) transfer status + * @complete: (in) completion routine + * + * The MostCore allocates and initializes the MBO. + * + * The HDM receives MBO for transfer from MostCore with the call to enqueue(). + * The HDM copies the data to- or from the buffer depending on configured + * channel direction, set "processed_length" and "status" and completes + * the transfer procedure by calling the completion routine. + * + * At the end the MostCore deallocates the MBO or recycles it for further + * transfers for the same or different HDM. + * + * Directions of usage: + * The core driver should never access any MBO fields (even if marked + * as "public") while the MBO is owned by an HDM. The ownership starts with + * the call of enqueue() and ends with the call of its complete() routine. + * + * II. + * Every HDM attached to the core driver _must_ ensure that it returns any MBO + * it owns (due to a previous call to enqueue() by the core driver) before it + * de-registers an interface or gets unloaded from the kernel. If this direction + * is violated memory leaks will occur, since the core driver does _not_ track + * MBOs it is currently not in control of. + * + */ +struct mbo { + void *context; + void *priv; + struct list_head list; + struct most_interface *ifp; + u16 hdm_channel_id; + void *virt_address; + dma_addr_t bus_address; + u16 buffer_length; + u16 processed_length; + enum mbo_status_flags status; + void (*complete)(struct mbo *); +}; + +/** + * Interface instance description. + * + * Describes one instance of an interface like Medusa PCIe or Vantage USB. + * This structure is allocated and initialized in the HDM. MostCore may not + * modify this structure. + * + * @interface Interface type. \sa most_interface_type. + * @description PRELIMINARY. + * Unique description of the device instance from point of view of the + * interface in free text form (ASCII). + * It may be a hexadecimal presentation of the memory address for the MediaLB + * IP or USB device ID with USB properties for USB interface, etc. + * @num_channels Number of channels and size of the channel_vector. + * @channel_vector Properties of the channels. + * Array index represents channel ID by the driver. + * @configure Callback to change data type for the channel of the + * interface instance. May be zero if the instance of the interface is not + * configurable. Parameter channel_config describes direction and data + * type for the channel, configured by the higher level. The content of + * @enqueue Delivers MBO to the HDM for processing. + * After HDM completes Rx- or Tx- operation the processed MBO shall + * be returned back to the MostCore using completion routine. + * The reason to get the MBO delivered from the MostCore after the channel + * is poisoned is the re-opening of the channel by the application. + * In this case the HDM shall hold MBOs and service the channel as usual. + * The HDM must be able to hold at least one MBO for each channel. + * The callback returns a negative value on error, otherwise 0. + * @poison_channel Informs HDM about closing the channel. The HDM shall + * cancel all transfers and synchronously or asynchronously return + * all enqueued for this channel MBOs using the completion routine. + * The callback returns a negative value on error, otherwise 0. + * @request_netinfo: triggers retrieving of network info from the HDM by + * means of "Message exchange over MDP/MEP" + * @priv Private field used by mostcore to store context information. + */ +struct most_interface { + struct module *mod; + enum most_interface_type interface; + const char *description; + int num_channels; + struct most_channel_capability *channel_vector; + int (*configure)(struct most_interface *iface, int channel_idx, + struct most_channel_config *channel_config); + int (*enqueue)(struct most_interface *iface, int channel_idx, + struct mbo *mbo); + int (*poison_channel)(struct most_interface *iface, int channel_idx); + void (*request_netinfo)(struct most_interface *iface, int channel_idx); + void *priv; +}; + +/** + * struct most_aim - identifies MOST device driver to mostcore + * @name: Driver name + * @probe_channel: function for core to notify driver about channel connection + * @disconnect_channel: notification that a certain channel isn't available anymore + * @rx_completion: completion handler for received packets + * @tx_completion: completion handler for transmitted packets + * @context: context pointer to be used by mostcore + */ +struct most_aim { + const char *name; + int (*probe_channel)(struct most_interface *iface, int channel_idx, + struct most_channel_config *cfg, + struct kobject *parent, char *name); + int (*disconnect_channel)(struct most_interface *iface, + int channel_idx); + int (*rx_completion)(struct mbo *mbo); + int (*tx_completion)(struct most_interface *iface, int channel_idx); + void *context; +}; + +/** + * most_register_interface - Registers instance of the interface. + * @iface: Pointer to the interface instance description. + * + * Returns a pointer to the kobject of the generated instance. + * + * Note: HDM has to ensure that any reference held on the kobj is + * released before deregistering the interface. + */ +struct kobject *most_register_interface(struct most_interface *iface); + +/** + * Deregisters instance of the interface. + * @intf_instance Pointer to the interface instance description. + */ +void most_deregister_interface(struct most_interface *iface); +int most_submit_mbo(struct mbo *mbo); + +/** + * most_stop_enqueue - prevents core from enqueing MBOs + * @iface: pointer to interface + * @channel_idx: channel index + */ +void most_stop_enqueue(struct most_interface *iface, int channel_idx); + +/** + * most_resume_enqueue - allow core to enqueue MBOs again + * @iface: pointer to interface + * @channel_idx: channel index + * + * This clears the enqueue halt flag and enqueues all MBOs currently + * in wait fifo. + */ +void most_resume_enqueue(struct most_interface *iface, int channel_idx); +int most_register_aim(struct most_aim *aim); +int most_deregister_aim(struct most_aim *aim); +struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx); +void most_put_mbo(struct mbo *mbo); +int most_start_channel(struct most_interface *iface, int channel_idx); +int most_stop_channel(struct most_interface *iface, int channel_idx); + + +#endif /* MOST_CORE_H_ */ From 9bc79bbcd0c526e3ec7b98e08c5d34648bb3c158 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:49 +0200 Subject: [PATCH 484/912] Staging: most: add MOST driver's aim-cdev module This patch adds the aim-cdev module of the MOST driver to the kernel's driver staging area. This module is part of the MOST driver and handles user space interaction by means of character devices. This patch is needed in order to have access to MOST data through character devices. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/Kconfig | 2 + drivers/staging/most/Makefile | 1 + drivers/staging/most/aim-cdev/Kconfig | 12 + drivers/staging/most/aim-cdev/Makefile | 4 + drivers/staging/most/aim-cdev/cdev.c | 527 +++++++++++++++++++++++++ 5 files changed, 546 insertions(+) create mode 100644 drivers/staging/most/aim-cdev/Kconfig create mode 100644 drivers/staging/most/aim-cdev/Makefile create mode 100644 drivers/staging/most/aim-cdev/cdev.c diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig index b7db320dbacc..e29bee569c77 100644 --- a/drivers/staging/most/Kconfig +++ b/drivers/staging/most/Kconfig @@ -13,4 +13,6 @@ if MOST source "drivers/staging/most/mostcore/Kconfig" +source "drivers/staging/most/aim-cdev/Kconfig" + endif diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile index 0144be009337..b7b319bd61a1 100644 --- a/drivers/staging/most/Makefile +++ b/drivers/staging/most/Makefile @@ -1 +1,2 @@ obj-$(CONFIG_MOSTCORE) += mostcore/ +obj-$(CONFIG_AIM_CDEV) += aim-cdev/ diff --git a/drivers/staging/most/aim-cdev/Kconfig b/drivers/staging/most/aim-cdev/Kconfig new file mode 100644 index 000000000000..3c59f1bac127 --- /dev/null +++ b/drivers/staging/most/aim-cdev/Kconfig @@ -0,0 +1,12 @@ +# +# MOST Cdev configuration +# + +config AIM_CDEV + tristate "Cdev AIM" + + ---help--- + Say Y here if you want to commumicate via character devices. + + To compile this driver as a module, choose M here: the + module will be called aim_cdev. \ No newline at end of file diff --git a/drivers/staging/most/aim-cdev/Makefile b/drivers/staging/most/aim-cdev/Makefile new file mode 100644 index 000000000000..0bcc6c637b75 --- /dev/null +++ b/drivers/staging/most/aim-cdev/Makefile @@ -0,0 +1,4 @@ +obj-$(CONFIG_AIM_CDEV) += aim_cdev.o + +aim_cdev-objs := cdev.o +ccflags-y += -Idrivers/staging/most/mostcore/ \ No newline at end of file diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c new file mode 100644 index 000000000000..d5fb4a0e0818 --- /dev/null +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -0,0 +1,527 @@ +/* + * cdev.c - Application interfacing module for character devices + * + * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mostcore.h" + +static dev_t aim_devno; +static struct class *aim_class; +static struct ida minor_id; +static unsigned int major; + +struct aim_channel { + wait_queue_head_t wq; + struct cdev cdev; + struct device *dev; + struct mutex io_mutex; + struct most_interface *iface; + struct most_channel_config *cfg; + unsigned int channel_id; + dev_t devno; + bool keep_mbo; + unsigned int mbo_offs; + struct mbo *stacked_mbo; + DECLARE_KFIFO_PTR(fifo, typeof(struct mbo *)); + atomic_t access_ref; + struct list_head list; +}; +#define to_channel(d) container_of(d, struct aim_channel, cdev) +static struct list_head channel_list; +static spinlock_t ch_list_lock; + + +struct aim_channel *get_channel(struct most_interface *iface, int id) +{ + struct aim_channel *channel, *tmp; + unsigned long flags; + int found_channel = 0; + + spin_lock_irqsave(&ch_list_lock, flags); + list_for_each_entry_safe(channel, tmp, &channel_list, list) { + if ((channel->iface == iface) && (channel->channel_id == id)) { + found_channel = 1; + break; + } + } + spin_unlock_irqrestore(&ch_list_lock, flags); + if (!found_channel) + return NULL; + return channel; +} + +/** + * aim_open - implements the syscall to open the device + * @inode: inode pointer + * @filp: file pointer + * + * This stores the channel pointer in the private data field of + * the file structure and activates the channel within the core. + */ +static int aim_open(struct inode *inode, struct file *filp) +{ + struct aim_channel *channel; + int ret; + + channel = to_channel(inode->i_cdev); + filp->private_data = channel; + + if (((channel->cfg->direction == MOST_CH_RX) && + ((filp->f_flags & O_ACCMODE) != O_RDONLY)) + || ((channel->cfg->direction == MOST_CH_TX) && + ((filp->f_flags & O_ACCMODE) != O_WRONLY))) { + pr_info("WARN: Access flags mismatch\n"); + return -EACCES; + } + if (!atomic_inc_and_test(&channel->access_ref)) { + pr_info("WARN: Device is busy\n"); + atomic_dec(&channel->access_ref); + return -EBUSY; + } + + ret = most_start_channel(channel->iface, channel->channel_id); + if (ret) + atomic_dec(&channel->access_ref); + return ret; +} + +/** + * aim_close - implements the syscall to close the device + * @inode: inode pointer + * @filp: file pointer + * + * This stops the channel within the core. + */ +static int aim_close(struct inode *inode, struct file *filp) +{ + int ret; + struct mbo *mbo; + struct aim_channel *channel = to_channel(inode->i_cdev); + + mutex_lock(&channel->io_mutex); + if (!channel->dev) { + mutex_unlock(&channel->io_mutex); + atomic_dec(&channel->access_ref); + device_destroy(aim_class, channel->devno); + cdev_del(&channel->cdev); + kfifo_free(&channel->fifo); + list_del(&channel->list); + kfree(channel); + ida_simple_remove(&minor_id, MINOR(channel->devno)); + wake_up_interruptible(&channel->wq); + return 0; + } + mutex_unlock(&channel->io_mutex); + + while (0 != kfifo_out((struct kfifo *)&channel->fifo, &mbo, 1)) + most_put_mbo(mbo); + if (channel->keep_mbo == true) + most_put_mbo(channel->stacked_mbo); + ret = most_stop_channel(channel->iface, channel->channel_id); + atomic_dec(&channel->access_ref); + wake_up_interruptible(&channel->wq); + return ret; +} + +/** + * aim_write - implements the syscall to write to the device + * @filp: file pointer + * @buf: pointer to user buffer + * @count: number of bytes to write + * @offset: offset from where to start writing + */ +static ssize_t aim_write(struct file *filp, const char __user *buf, + size_t count, loff_t *offset) +{ + int ret, err; + size_t actual_len = 0; + size_t max_len = 0; + ssize_t retval; + struct mbo *mbo; + struct aim_channel *channel = filp->private_data; + + mutex_lock(&channel->io_mutex); + if (unlikely(!channel->dev)) { + mutex_unlock(&channel->io_mutex); + return -EPIPE; + } + mutex_unlock(&channel->io_mutex); + + mbo = most_get_mbo(channel->iface, channel->channel_id); + + if (!mbo && channel->dev) { + if ((filp->f_flags & O_NONBLOCK)) + return -EAGAIN; + if (wait_event_interruptible( + channel->wq, + (mbo = most_get_mbo(channel->iface, + channel->channel_id)) || + (channel->dev == NULL))) + return -ERESTARTSYS; + } + + mutex_lock(&channel->io_mutex); + if (unlikely(!channel->dev)) { + mutex_unlock(&channel->io_mutex); + err = -EPIPE; + goto error; + } + mutex_unlock(&channel->io_mutex); + + max_len = channel->cfg->buffer_size; + actual_len = min(count, max_len); + mbo->buffer_length = actual_len; + + retval = copy_from_user(mbo->virt_address, buf, mbo->buffer_length); + if (retval) { + err = -EIO; + goto error; + } + + ret = most_submit_mbo(mbo); + if (ret) { + pr_info("submitting MBO to core failed\n"); + err = ret; + goto error; + } + return actual_len - retval; +error: + most_put_mbo(mbo); + return err; +} + +/** + * aim_read - implements the syscall to read from the device + * @filp: file pointer + * @buf: pointer to user buffer + * @count: number of bytes to read + * @offset: offset from where to start reading + */ +static ssize_t +aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) +{ + ssize_t retval; + size_t not_copied, proc_len; + struct mbo *mbo; + struct aim_channel *channel = filp->private_data; + + if (channel->keep_mbo == true) { + mbo = channel->stacked_mbo; + channel->keep_mbo = false; + goto start_copy; + } + while ((0 == kfifo_out(&channel->fifo, &mbo, 1)) + && (channel->dev != NULL)) { + if (filp->f_flags & O_NONBLOCK) + return -EAGAIN; + if (wait_event_interruptible(channel->wq, + (!kfifo_is_empty(&channel->fifo) || + (channel->dev == NULL)))) + return -ERESTARTSYS; + } + +start_copy: + /* make sure we don't submit to gone devices */ + mutex_lock(&channel->io_mutex); + if (unlikely(!channel->dev)) { + mutex_unlock(&channel->io_mutex); + return -EIO; + } + + if (count < mbo->processed_length) + channel->keep_mbo = true; + + proc_len = min((int)count, + (int)(mbo->processed_length - channel->mbo_offs)); + + not_copied = copy_to_user(buf, + mbo->virt_address + channel->mbo_offs, + proc_len); + + retval = not_copied ? proc_len - not_copied : proc_len; + + if (channel->keep_mbo == true) { + channel->mbo_offs = retval; + channel->stacked_mbo = mbo; + } else { + most_put_mbo(mbo); + channel->mbo_offs = 0; + } + mutex_unlock(&channel->io_mutex); + return retval; +} + +/** + * Initialization of struct file_operations + */ +static const struct file_operations channel_fops = { + .owner = THIS_MODULE, + .read = aim_read, + .write = aim_write, + .open = aim_open, + .release = aim_close, +}; + +/** + * aim_disconnect_channel - disconnect a channel + * @iface: pointer to interface instance + * @channel_id: channel index + * + * This frees allocated memory and removes the cdev that represents this + * channel in user space. + */ +int aim_disconnect_channel(struct most_interface *iface, int channel_id) +{ + struct aim_channel *channel; + unsigned long flags; + + if (!iface) { + pr_info("Bad interface pointer\n"); + return -EINVAL; + } + + channel = get_channel(iface, channel_id); + if (channel == NULL) + return -ENXIO; + + mutex_lock(&channel->io_mutex); + channel->dev = NULL; + mutex_unlock(&channel->io_mutex); + + if (atomic_read(&channel->access_ref)) { + device_destroy(aim_class, channel->devno); + cdev_del(&channel->cdev); + kfifo_free(&channel->fifo); + ida_simple_remove(&minor_id, MINOR(channel->devno)); + spin_lock_irqsave(&ch_list_lock, flags); + list_del(&channel->list); + spin_unlock_irqrestore(&ch_list_lock, flags); + kfree(channel); + } else { + wake_up_interruptible(&channel->wq); + } + return 0; +} + +/** + * aim_rx_completion - completion handler for rx channels + * @mbo: pointer to buffer object that has completed + * + * This searches for the channel linked to this MBO and stores it in the local + * fifo buffer. + */ +int aim_rx_completion(struct mbo *mbo) +{ + struct aim_channel *channel; + + if (!mbo) + return -EINVAL; + + channel = get_channel(mbo->ifp, mbo->hdm_channel_id); + if (channel == NULL) + return -ENXIO; + + kfifo_in(&channel->fifo, &mbo, 1); +#ifdef DEBUG_MESG + if (kfifo_is_full(&channel->fifo)) + pr_info("WARN: Fifo is full\n"); +#endif + wake_up_interruptible(&channel->wq); + return 0; +} + +/** + * aim_tx_completion - completion handler for tx channels + * @iface: pointer to interface instance + * @channel_id: channel index/ID + * + * This wakes sleeping processes in the wait-queue. + */ +int aim_tx_completion(struct most_interface *iface, int channel_id) +{ + struct aim_channel *channel; + + if (!iface) { + pr_info("Bad interface pointer\n"); + return -EINVAL; + } + if ((channel_id < 0) || (channel_id >= iface->num_channels)) { + pr_info("Channel ID out of range\n"); + return -EINVAL; + } + + channel = get_channel(iface, channel_id); + if (channel == NULL) + return -ENXIO; + wake_up_interruptible(&channel->wq); + return 0; +} + +struct most_aim cdev_aim; + +/** + * aim_probe - probe function of the driver module + * @iface: pointer to interface instance + * @channel_id: channel index/ID + * @cfg: pointer to actual channel configuration + * @parent: pointer to kobject (needed for sysfs hook-up) + * @name: name of the device to be created + * + * This allocates achannel object and creates the device node in /dev + * + * Returns 0 on success or error code otherwise. + */ +int aim_probe(struct most_interface *iface, int channel_id, + struct most_channel_config *cfg, + struct kobject *parent, char *name) +{ + struct aim_channel *channel; + unsigned long cl_flags; + int retval; + int current_minor; + + if ((!iface) || (!cfg) || (!parent) || (!name)) { + pr_info("Probing AIM with bad arguments"); + return -EINVAL; + } + channel = get_channel(iface, channel_id); + if (channel) + return -EEXIST; + + current_minor = ida_simple_get(&minor_id, 0, 0, GFP_KERNEL); + if (current_minor < 0) + return current_minor; + + channel = kzalloc(sizeof(*channel), GFP_KERNEL); + if (!channel) { + pr_info("failed to alloc channel object\n"); + retval = -ENOMEM; + goto error_alloc_channel; + } + + channel->devno = MKDEV(major, current_minor); + cdev_init(&channel->cdev, &channel_fops); + channel->cdev.owner = THIS_MODULE; + cdev_add(&channel->cdev, channel->devno, 1); + channel->iface = iface; + channel->cfg = cfg; + channel->channel_id = channel_id; + channel->mbo_offs = 0; + atomic_set(&channel->access_ref, -1); + INIT_KFIFO(channel->fifo); + retval = kfifo_alloc(&channel->fifo, cfg->num_buffers, GFP_KERNEL); + if (retval) { + pr_info("failed to alloc channel kfifo"); + goto error_alloc_kfifo; + } + init_waitqueue_head(&channel->wq); + mutex_init(&channel->io_mutex); + spin_lock_irqsave(&ch_list_lock, cl_flags); + list_add_tail(&channel->list, &channel_list); + spin_unlock_irqrestore(&ch_list_lock, cl_flags); + channel->dev = device_create(aim_class, + NULL, + channel->devno, + NULL, + "%s", name); + + retval = IS_ERR(channel->dev); + if (retval) { + pr_info("failed to create new device node %s\n", name); + goto error_create_device; + } + kobject_uevent(&channel->dev->kobj, KOBJ_ADD); + return 0; + +error_create_device: + kfifo_free(&channel->fifo); + list_del(&channel->list); +error_alloc_kfifo: + cdev_del(&channel->cdev); + kfree(channel); +error_alloc_channel: + ida_simple_remove(&minor_id, current_minor); + return retval; +} + +struct most_aim cdev_aim = { + .name = "cdev", + .probe_channel = aim_probe, + .disconnect_channel = aim_disconnect_channel, + .rx_completion = aim_rx_completion, + .tx_completion = aim_tx_completion, +}; + +static int __init mod_init(void) +{ + pr_info("init()\n"); + + INIT_LIST_HEAD(&channel_list); + spin_lock_init(&ch_list_lock); + ida_init(&minor_id); + + if (alloc_chrdev_region(&aim_devno, 0, 50, "cdev") < 0) + return -EIO; + major = MAJOR(aim_devno); + + aim_class = class_create(THIS_MODULE, "most_cdev_aim"); + if (IS_ERR(aim_class)) { + pr_err("no udev support\n"); + goto free_cdev; + } + + if (most_register_aim(&cdev_aim)) + goto dest_class; + return 0; + +dest_class: + class_destroy(aim_class); +free_cdev: + unregister_chrdev_region(aim_devno, 1); + return -EIO; +} + +static void __exit mod_exit(void) +{ + struct aim_channel *channel, *tmp; + + pr_info("exit module\n"); + + most_deregister_aim(&cdev_aim); + + list_for_each_entry_safe(channel, tmp, &channel_list, list) { + device_destroy(aim_class, channel->devno); + cdev_del(&channel->cdev); + kfifo_free(&channel->fifo); + list_del(&channel->list); + ida_simple_remove(&minor_id, MINOR(channel->devno)); + kfree(channel); + } + class_destroy(aim_class); + unregister_chrdev_region(aim_devno, 1); + ida_destroy(&minor_id); +} + +module_init(mod_init); +module_exit(mod_exit); +MODULE_AUTHOR("Christian Gromm "); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("character device AIM for mostcore"); From d4a8ce7f57fc6333e4e5a23980f5265e00ed44ef Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:50 +0200 Subject: [PATCH 485/912] Staging: most: add MOST driver's aim-network module This patch adds the aim-network module of the MOST driver to the kernel's driver staging area. This module is part of the MOST driver and handles user space interaction by means of network devices. This patch is needed in order to have access to MOST Ethernet Packets (MEP) through a networking device. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/Kconfig | 2 + drivers/staging/most/Makefile | 1 + drivers/staging/most/aim-network/Kconfig | 12 + drivers/staging/most/aim-network/Makefile | 4 + drivers/staging/most/aim-network/networking.c | 567 ++++++++++++++++++ drivers/staging/most/aim-network/networking.h | 23 + 6 files changed, 609 insertions(+) create mode 100644 drivers/staging/most/aim-network/Kconfig create mode 100644 drivers/staging/most/aim-network/Makefile create mode 100644 drivers/staging/most/aim-network/networking.c create mode 100644 drivers/staging/most/aim-network/networking.h diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig index e29bee569c77..34a0b7316fe8 100644 --- a/drivers/staging/most/Kconfig +++ b/drivers/staging/most/Kconfig @@ -15,4 +15,6 @@ source "drivers/staging/most/mostcore/Kconfig" source "drivers/staging/most/aim-cdev/Kconfig" +source "drivers/staging/most/aim-network/Kconfig" + endif diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile index b7b319bd61a1..61c1c965d622 100644 --- a/drivers/staging/most/Makefile +++ b/drivers/staging/most/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_MOSTCORE) += mostcore/ obj-$(CONFIG_AIM_CDEV) += aim-cdev/ +obj-$(CONFIG_AIM_NETWORK) += aim-network/ diff --git a/drivers/staging/most/aim-network/Kconfig b/drivers/staging/most/aim-network/Kconfig new file mode 100644 index 000000000000..507232a7f7ee --- /dev/null +++ b/drivers/staging/most/aim-network/Kconfig @@ -0,0 +1,12 @@ +# +# MOST Networking configuration +# + +config AIM_NETWORK + tristate "Networking AIM" + + ---help--- + Say Y here if you want to commumicate via a networking device. + + To compile this driver as a module, choose M here: the + module will be called aim_networking. diff --git a/drivers/staging/most/aim-network/Makefile b/drivers/staging/most/aim-network/Makefile new file mode 100644 index 000000000000..840c1dd94873 --- /dev/null +++ b/drivers/staging/most/aim-network/Makefile @@ -0,0 +1,4 @@ +obj-$(CONFIG_AIM_NETWORK) += aim_network.o + +aim_network-objs := networking.o +ccflags-y += -Idrivers/staging/most/mostcore/ diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c new file mode 100644 index 000000000000..4639c49240f1 --- /dev/null +++ b/drivers/staging/most/aim-network/networking.c @@ -0,0 +1,567 @@ +/* + * Networking AIM - Networking Application Interface Module for MostCore + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include "mostcore.h" +#include "networking.h" + + +#define MEP_HDR_LEN 8 +#define MDP_HDR_LEN 16 +#define MAMAC_DATA_LEN (1024 - MDP_HDR_LEN) + +#define PMHL 5 + +#define PMS_TELID_UNSEGM_MAMAC 0x0A +#define PMS_FIFONO_MDP 0x01 +#define PMS_FIFONO_MEP 0x04 +#define PMS_MSGTYPE_DATA 0x04 +#define PMS_DEF_PRIO 0 +#define MEP_DEF_RETRY 15 + +#define PMS_FIFONO_MASK 0x07 +#define PMS_FIFONO_SHIFT 3 +#define PMS_RETRY_SHIFT 4 +#define PMS_TELID_MASK 0x0F +#define PMS_TELID_SHIFT 4 + +#define HB(value) ((u8)((u16)(value) >> 8)) +#define LB(value) ((u8)(value)) + + + +#define EXTRACT_BIT_SET(bitset_name, value) \ + (((value) >> bitset_name##_SHIFT) & bitset_name##_MASK) + +#define PMS_IS_MEP(buf, len) \ + ((len) > MEP_HDR_LEN && \ + EXTRACT_BIT_SET(PMS_FIFONO, (buf)[3]) == PMS_FIFONO_MEP) + +#define PMS_IS_MAMAC(buf, len) \ + ((len) > MDP_HDR_LEN && \ + EXTRACT_BIT_SET(PMS_FIFONO, (buf)[3]) == PMS_FIFONO_MDP && \ + EXTRACT_BIT_SET(PMS_TELID, (buf)[14]) == PMS_TELID_UNSEGM_MAMAC) + +struct net_dev_channel { + bool linked; + int ch_id; +}; + +struct net_dev_context { + struct most_interface *iface; + bool channels_opened; + bool is_mamac; + unsigned char link_stat; + struct net_device *dev; + struct net_dev_channel rx; + struct net_dev_channel tx; + struct list_head list; +}; + +static struct list_head net_devices = LIST_HEAD_INIT(net_devices); +static struct spinlock list_lock; +static struct most_aim aim; + + +static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo) +{ + u8 *buff = mbo->virt_address; + const u8 broadcast[] = { 0x03, 0xFF }; + const u8 *dest_addr = skb->data + 4; + const u8 *eth_type = skb->data + 12; + unsigned int payload_len = skb->len - ETH_HLEN; + unsigned int mdp_len = payload_len + MDP_HDR_LEN; + + if (mbo->buffer_length < mdp_len) { + pr_err("drop: too small buffer! (%d for %d)\n", + mbo->buffer_length, mdp_len); + return -EINVAL; + } + + if (skb->len < ETH_HLEN) { + pr_err("drop: too small packet! (%d)\n", skb->len); + return -EINVAL; + } + + if (dest_addr[0] == 0xFF && dest_addr[1] == 0xFF) + dest_addr = broadcast; + + *buff++ = HB(mdp_len - 2); + *buff++ = LB(mdp_len - 2); + + *buff++ = PMHL; + *buff++ = (PMS_FIFONO_MDP << PMS_FIFONO_SHIFT) | PMS_MSGTYPE_DATA; + *buff++ = PMS_DEF_PRIO; + *buff++ = dest_addr[0]; + *buff++ = dest_addr[1]; + *buff++ = 0x00; + + *buff++ = HB(payload_len + 6); + *buff++ = LB(payload_len + 6); + + /* end of FPH here */ + + *buff++ = eth_type[0]; + *buff++ = eth_type[1]; + *buff++ = 0; + *buff++ = 0; + + *buff++ = PMS_TELID_UNSEGM_MAMAC << 4 | HB(payload_len); + *buff++ = LB(payload_len); + + memcpy(buff, skb->data + ETH_HLEN, payload_len); + mbo->buffer_length = mdp_len; + return 0; +} + +static int skb_to_mep(const struct sk_buff *skb, struct mbo *mbo) +{ + u8 *buff = mbo->virt_address; + unsigned int mep_len = skb->len + MEP_HDR_LEN; + + if (mbo->buffer_length < mep_len) { + pr_err("drop: too small buffer! (%d for %d)\n", + mbo->buffer_length, mep_len); + return -EINVAL; + } + + *buff++ = HB(mep_len - 2); + *buff++ = LB(mep_len - 2); + + *buff++ = PMHL; + *buff++ = (PMS_FIFONO_MEP << PMS_FIFONO_SHIFT) | PMS_MSGTYPE_DATA; + *buff++ = (MEP_DEF_RETRY << PMS_RETRY_SHIFT) | PMS_DEF_PRIO; + *buff++ = 0; + *buff++ = 0; + *buff++ = 0; + + memcpy(buff, skb->data, skb->len); + mbo->buffer_length = mep_len; + return 0; +} + +static int most_nd_set_mac_address(struct net_device *dev, void *p) +{ + struct net_dev_context *nd = dev->ml_priv; + int err = eth_mac_addr(dev, p); + + if (err) + return err; + + BUG_ON(nd->dev != dev); + + nd->is_mamac = + (dev->dev_addr[0] == 0 && dev->dev_addr[1] == 0 && + dev->dev_addr[2] == 0 && dev->dev_addr[3] == 0); + + /* + * Set default MTU for the given packet type. + * It is still possible to change MTU using ip tools afterwards. + */ + dev->mtu = nd->is_mamac ? MAMAC_DATA_LEN : ETH_DATA_LEN; + + return 0; +} + +static int most_nd_open(struct net_device *dev) +{ + struct net_dev_context *nd = dev->ml_priv; + + pr_info("open net device %s\n", dev->name); + + BUG_ON(nd->dev != dev); + + if (nd->channels_opened) + return -EFAULT; + + BUG_ON(!nd->tx.linked || !nd->rx.linked); + + if (most_start_channel(nd->iface, nd->rx.ch_id)) { + pr_err("most_start_channel() failed\n"); + return -EBUSY; + } + + if (most_start_channel(nd->iface, nd->tx.ch_id)) { + pr_err("most_start_channel() failed\n"); + most_stop_channel(nd->iface, nd->rx.ch_id); + return -EBUSY; + } + + nd->channels_opened = true; + + if (nd->is_mamac) { + nd->link_stat = 1; + netif_wake_queue(dev); + } else { + nd->iface->request_netinfo(nd->iface, nd->tx.ch_id); + } + + return 0; +} + +static int most_nd_stop(struct net_device *dev) +{ + struct net_dev_context *nd = dev->ml_priv; + + pr_info("stop net device %s\n", dev->name); + + BUG_ON(nd->dev != dev); + netif_stop_queue(dev); + + if (nd->channels_opened) { + most_stop_channel(nd->iface, nd->rx.ch_id); + most_stop_channel(nd->iface, nd->tx.ch_id); + nd->channels_opened = false; + } + + return 0; +} + +static netdev_tx_t most_nd_start_xmit(struct sk_buff *skb, + struct net_device *dev) +{ + struct net_dev_context *nd = dev->ml_priv; + struct mbo *mbo; + int ret; + + BUG_ON(nd->dev != dev); + + mbo = most_get_mbo(nd->iface, nd->tx.ch_id); + + if (!mbo) { + netif_stop_queue(dev); + dev->stats.tx_fifo_errors++; + return NETDEV_TX_BUSY; + } + + if (nd->is_mamac) + ret = skb_to_mamac(skb, mbo); + else + ret = skb_to_mep(skb, mbo); + + if (ret) { + most_put_mbo(mbo); + dev->stats.tx_dropped++; + kfree_skb(skb); + return NETDEV_TX_OK; + } + + most_submit_mbo(mbo); + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; + kfree_skb(skb); + return NETDEV_TX_OK; +} + +static const struct net_device_ops most_nd_ops = { + .ndo_open = most_nd_open, + .ndo_stop = most_nd_stop, + .ndo_start_xmit = most_nd_start_xmit, + .ndo_set_mac_address = most_nd_set_mac_address, +}; + +static void most_nd_setup(struct net_device *dev) +{ + pr_info("setup net device %s\n", dev->name); + ether_setup(dev); + dev->netdev_ops = &most_nd_ops; +} + +static void most_net_rm_netdev_safe(struct net_dev_context *nd) +{ + if (!nd->dev) + return; + + pr_info("remove net device %p\n", nd->dev); + + unregister_netdev(nd->dev); + free_netdev(nd->dev); + nd->dev = 0; +} + +static struct net_dev_context *get_net_dev_context( + struct most_interface *iface) +{ + struct net_dev_context *nd, *tmp; + + spin_lock(&list_lock); + list_for_each_entry_safe(nd, tmp, &net_devices, list) { + if (nd->iface == iface) { + spin_unlock(&list_lock); + return nd; + } + } + spin_unlock(&list_lock); + return 0; +} + +static int aim_probe_channel(struct most_interface *iface, int channel_idx, + struct most_channel_config *ccfg, + struct kobject *parent, char *name) +{ + struct net_dev_context *nd; + struct net_dev_channel *ch; + + if (!iface) + return -EINVAL; + + if (ccfg->data_type != MOST_CH_ASYNC) + return -EINVAL; + + nd = get_net_dev_context(iface); + + if (!nd) { + nd = kzalloc(sizeof(*nd), GFP_KERNEL); + if (!nd) + return -ENOMEM; + + nd->iface = iface; + + spin_lock(&list_lock); + list_add(&nd->list, &net_devices); + spin_unlock(&list_lock); + } + + ch = ccfg->direction == MOST_CH_TX ? &nd->tx : &nd->rx; + if (ch->linked) { + pr_err("only one channel per instance & direction allowed\n"); + return -EINVAL; + } + + if (nd->tx.linked || nd->rx.linked) { + struct net_device *dev = + alloc_netdev(0, "meth%d", NET_NAME_UNKNOWN, most_nd_setup); + + if (!dev) { + pr_err("no memory for net_device\n"); + return -ENOMEM; + } + + nd->dev = dev; + + dev->ml_priv = nd; + if (register_netdev(dev)) { + pr_err("registering net device failed\n"); + free_netdev(dev); + return -EINVAL; + } + } + + ch->ch_id = channel_idx; + ch->linked = true; + + return 0; +} + +static int aim_disconnect_channel(struct most_interface *iface, + int channel_idx) +{ + struct net_dev_context *nd; + struct net_dev_channel *ch; + + nd = get_net_dev_context(iface); + if (!nd) + return -EINVAL; + + if (nd->rx.linked && channel_idx == nd->rx.ch_id) + ch = &nd->rx; + else if (nd->tx.linked && channel_idx == nd->tx.ch_id) + ch = &nd->tx; + else + return -EINVAL; + + ch->linked = false; + + /* + * do not call most_stop_channel() here, because channels are + * going to be closed in ndo_stop() after unregister_netdev() + */ + most_net_rm_netdev_safe(nd); + + if (!nd->rx.linked && !nd->tx.linked) { + spin_lock(&list_lock); + list_del(&nd->list); + spin_unlock(&list_lock); + kfree(nd); + } + + return 0; +} + +static int aim_resume_tx_channel(struct most_interface *iface, + int channel_idx) +{ + struct net_dev_context *nd; + + nd = get_net_dev_context(iface); + if (!nd || !nd->channels_opened || nd->tx.ch_id != channel_idx) + return 0; + + if (!nd->dev) + return 0; + + netif_wake_queue(nd->dev); + return 0; +} + +static int aim_rx_data(struct mbo *mbo) +{ + const u32 zero = 0; + struct net_dev_context *nd; + char *buf = mbo->virt_address; + uint32_t len = mbo->processed_length; + struct sk_buff *skb; + struct net_device *dev; + + nd = get_net_dev_context(mbo->ifp); + if (!nd || !nd->channels_opened || nd->rx.ch_id != mbo->hdm_channel_id) + return -EIO; + + dev = nd->dev; + if (!dev) { + pr_err_once("drop packet: missing net_device\n"); + return -EIO; + } + + if (nd->is_mamac) { + if (!PMS_IS_MAMAC(buf, len)) + return -EIO; + + skb = dev_alloc_skb(len - MDP_HDR_LEN + 2 * ETH_ALEN + 2); + } else { + if (!PMS_IS_MEP(buf, len)) + return -EIO; + + skb = dev_alloc_skb(len - MEP_HDR_LEN); + } + + if (!skb) { + dev->stats.rx_dropped++; + pr_err_once("drop packet: no memory for skb\n"); + goto out; + } + + skb->dev = dev; + + if (nd->is_mamac) { + /* dest */ + memcpy(skb_put(skb, ETH_ALEN), dev->dev_addr, ETH_ALEN); + + /* src */ + memcpy(skb_put(skb, 4), &zero, 4); + memcpy(skb_put(skb, 2), buf + 5, 2); + + /* eth type */ + memcpy(skb_put(skb, 2), buf + 10, 2); + + buf += MDP_HDR_LEN; + len -= MDP_HDR_LEN; + } else { + buf += MEP_HDR_LEN; + len -= MEP_HDR_LEN; + } + + memcpy(skb_put(skb, len), buf, len); + skb->protocol = eth_type_trans(skb, dev); + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len; + netif_rx(skb); + +out: + most_put_mbo(mbo); + return 0; +} + +static int __init most_net_init(void) +{ + pr_info("most_net_init()\n"); + spin_lock_init(&list_lock); + aim.name = "networking"; + aim.probe_channel = aim_probe_channel; + aim.disconnect_channel = aim_disconnect_channel; + aim.tx_completion = aim_resume_tx_channel; + aim.rx_completion = aim_rx_data; + return most_register_aim(&aim); +} + +static void __exit most_net_exit(void) +{ + struct net_dev_context *nd, *tmp; + + spin_lock(&list_lock); + list_for_each_entry_safe(nd, tmp, &net_devices, list) { + list_del(&nd->list); + spin_unlock(&list_lock); + /* + * do not call most_stop_channel() here, because channels are + * going to be closed in ndo_stop() after unregister_netdev() + */ + most_net_rm_netdev_safe(nd); + kfree(nd); + spin_lock(&list_lock); + } + spin_unlock(&list_lock); + + most_deregister_aim(&aim); + pr_info("most_net_exit()\n"); +} + +/** + * most_deliver_netinfo - callback for HDM to be informed about HW's MAC + * @param iface - most interface instance + * @param link_stat - link status + * @param mac_addr - MAC address + */ +void most_deliver_netinfo(struct most_interface *iface, + unsigned char link_stat, unsigned char *mac_addr) +{ + struct net_dev_context *nd; + struct net_device *dev; + + pr_info("Received netinfo from %s\n", iface->description); + + nd = get_net_dev_context(iface); + if (!nd) + return; + + dev = nd->dev; + if (!dev) + return; + + if (mac_addr) + memcpy(dev->dev_addr, mac_addr, ETH_ALEN); + + if (nd->link_stat != link_stat) { + nd->link_stat = link_stat; + if (nd->link_stat) + netif_wake_queue(dev); + else + netif_stop_queue(dev); + } +} +EXPORT_SYMBOL(most_deliver_netinfo); + +module_init(most_net_init); +module_exit(most_net_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Andrey Shvetsov "); +MODULE_DESCRIPTION("Networking Application Interface Module for MostCore"); diff --git a/drivers/staging/most/aim-network/networking.h b/drivers/staging/most/aim-network/networking.h new file mode 100644 index 000000000000..1b8b434fabb0 --- /dev/null +++ b/drivers/staging/most/aim-network/networking.h @@ -0,0 +1,23 @@ +/* + * Networking AIM - Networking Application Interface Module for MostCore + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ +#ifndef _NETWORKING_H_ +#define _NETWORKING_H_ + +#include "mostcore.h" + + +void most_deliver_netinfo(struct most_interface *iface, + unsigned char link_stat, unsigned char *mac_addr); + + +#endif From 54b4856fb3624609dd5d9ed013bfec7d67083622 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:51 +0200 Subject: [PATCH 486/912] Staging: most: add MOST driver's aim-sound module This patch adds the aim-sound module of the MOST driver to the kernel's driver staging area. This module is part of the MOST driver and handles user space interaction by means of ALSA devices. This patch is needed in order to have access to MOST synchronous data through ALSA devices. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/Kconfig | 2 + drivers/staging/most/Makefile | 1 + drivers/staging/most/aim-sound/Kconfig | 12 + drivers/staging/most/aim-sound/Makefile | 4 + drivers/staging/most/aim-sound/sound.c | 758 ++++++++++++++++++++++++ 5 files changed, 777 insertions(+) create mode 100644 drivers/staging/most/aim-sound/Kconfig create mode 100644 drivers/staging/most/aim-sound/Makefile create mode 100644 drivers/staging/most/aim-sound/sound.c diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig index 34a0b7316fe8..050abbeed31d 100644 --- a/drivers/staging/most/Kconfig +++ b/drivers/staging/most/Kconfig @@ -17,4 +17,6 @@ source "drivers/staging/most/aim-cdev/Kconfig" source "drivers/staging/most/aim-network/Kconfig" +source "drivers/staging/most/aim-sound/Kconfig" + endif diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile index 61c1c965d622..c639bbd3b830 100644 --- a/drivers/staging/most/Makefile +++ b/drivers/staging/most/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_MOSTCORE) += mostcore/ obj-$(CONFIG_AIM_CDEV) += aim-cdev/ obj-$(CONFIG_AIM_NETWORK) += aim-network/ +obj-$(CONFIG_AIM_SOUND) += aim-sound/ diff --git a/drivers/staging/most/aim-sound/Kconfig b/drivers/staging/most/aim-sound/Kconfig new file mode 100644 index 000000000000..b9e499c77d00 --- /dev/null +++ b/drivers/staging/most/aim-sound/Kconfig @@ -0,0 +1,12 @@ +# +# MOST ALSA configuration +# + +config AIM_SOUND + tristate "ALSA AIM" + depends on SND + ---help--- + Say Y here if you want to commumicate via ALSA/sound devices. + + To compile this driver as a module, choose M here: the + module will be called aim_sound. diff --git a/drivers/staging/most/aim-sound/Makefile b/drivers/staging/most/aim-sound/Makefile new file mode 100644 index 000000000000..beba9586fd28 --- /dev/null +++ b/drivers/staging/most/aim-sound/Makefile @@ -0,0 +1,4 @@ +obj-$(CONFIG_AIM_SOUND) += aim_sound.o + +aim_sound-objs := sound.o +ccflags-y += -Idrivers/staging/most/mostcore/ diff --git a/drivers/staging/most/aim-sound/sound.c b/drivers/staging/most/aim-sound/sound.c new file mode 100644 index 000000000000..860302eebda7 --- /dev/null +++ b/drivers/staging/most/aim-sound/sound.c @@ -0,0 +1,758 @@ +/* + * sound.c - Audio Application Interface Module for Mostcore + * + * Copyright (C) 2015 Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "sound" + +static struct list_head dev_list; + +/** + * struct channel - private structure to keep channel specific data + * @substream: stores the substream structure + * @iface: interface for which the channel belongs to + * @cfg: channel configuration + * @card: registered sound card + * @list: list for private use + * @id: channel index + * @period_pos: current period position (ring buffer) + * @buffer_pos: current buffer position (ring buffer) + * @is_stream_running: identifies whether a stream is running or not + * @opened: set when the stream is opened + * @playback_task: playback thread + * @playback_waitq: waitq used by playback thread + */ +struct channel { + struct snd_pcm_substream *substream; + struct most_interface *iface; + struct most_channel_config *cfg; + struct snd_card *card; + struct list_head list; + int id; + unsigned int period_pos; + unsigned int buffer_pos; + bool is_stream_running; + + struct task_struct *playback_task; + wait_queue_head_t playback_waitq; + + void (*copy_fn)(void *alsa, void *most, unsigned int bytes); +}; + +#define MOST_PCM_INFO (SNDRV_PCM_INFO_MMAP | \ + SNDRV_PCM_INFO_MMAP_VALID | \ + SNDRV_PCM_INFO_BATCH | \ + SNDRV_PCM_INFO_INTERLEAVED | \ + SNDRV_PCM_INFO_BLOCK_TRANSFER) + +/** + * Initialization of struct snd_pcm_hardware + */ +static struct snd_pcm_hardware pcm_hardware_template = { + .info = MOST_PCM_INFO, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .channels_min = 1, + .channels_max = 8, +}; + +#define swap16(val) ( \ + (((u16)(val) << 8) & (u16)0xFF00) | \ + (((u16)(val) >> 8) & (u16)0x00FF)) + +#define swap32(val) ( \ + (((u32)(val) << 24) & (u32)0xFF000000) | \ + (((u32)(val) << 8) & (u32)0x00FF0000) | \ + (((u32)(val) >> 8) & (u32)0x0000FF00) | \ + (((u32)(val) >> 24) & (u32)0x000000FF)) + +static void swap_copy16(u16 *dest, const u16 *source, unsigned int bytes) +{ + unsigned int i = 0; + + while (i < (bytes / 2)) { + dest[i] = swap16(source[i]); + i++; + } +} + +static void swap_copy24(u8 *dest, const u8 *source, unsigned int bytes) +{ + unsigned int i = 0; + + while (i < bytes - 2) { + dest[i] = source[i + 2]; + dest[i + 1] = source[i + 1]; + dest[i + 2] = source[i]; + i += 3; + } +} + +static void swap_copy32(u32 *dest, const u32 *source, unsigned int bytes) +{ + unsigned int i = 0; + + while (i < bytes / 4) { + dest[i] = swap32(source[i]); + i++; + } +} + +static void alsa_to_most_memcpy(void *alsa, void *most, unsigned int bytes) +{ + memcpy(most, alsa, bytes); +} + +static void alsa_to_most_copy16(void *alsa, void *most, unsigned int bytes) +{ + swap_copy16(most, alsa, bytes); +} + +static void alsa_to_most_copy24(void *alsa, void *most, unsigned int bytes) +{ + swap_copy24(most, alsa, bytes); +} + +static void alsa_to_most_copy32(void *alsa, void *most, unsigned int bytes) +{ + swap_copy32(most, alsa, bytes); +} + +static void most_to_alsa_memcpy(void *alsa, void *most, unsigned int bytes) +{ + memcpy(alsa, most, bytes); +} + +static void most_to_alsa_copy16(void *alsa, void *most, unsigned int bytes) +{ + swap_copy16(alsa, most, bytes); +} + +static void most_to_alsa_copy24(void *alsa, void *most, unsigned int bytes) +{ + swap_copy24(alsa, most, bytes); +} + +static void most_to_alsa_copy32(void *alsa, void *most, unsigned int bytes) +{ + swap_copy32(alsa, most, bytes); +} + +/** + * get_channel - get pointer to channel + * @iface: interface structure + * @channel_id: channel ID + * + * This traverses the channel list and returns the channel matching the + * ID and interface. + * + * Returns pointer to channel on success or NULL otherwise. + */ +static struct channel *get_channel(struct most_interface *iface, + int channel_id) +{ + struct channel *channel, *tmp; + + list_for_each_entry_safe(channel, tmp, &dev_list, list) { + if ((channel->iface == iface) && (channel->id == channel_id)) + return channel; + } + + return NULL; +} + +/** + * copy_data - implements data copying function + * @channel: channel + * @mbo: MBO from core + * + * Copy data from/to ring buffer to/from MBO and update the buffer position + */ +static bool copy_data(struct channel *channel, struct mbo *mbo) +{ + struct snd_pcm_runtime *const runtime = channel->substream->runtime; + unsigned int const frame_bytes = channel->cfg->subbuffer_size; + unsigned int const buffer_size = runtime->buffer_size; + unsigned int frames; + unsigned int fr0; + + if (channel->cfg->direction & MOST_CH_RX) + frames = mbo->processed_length / frame_bytes; + else + frames = mbo->buffer_length / frame_bytes; + fr0 = min(buffer_size - channel->buffer_pos, frames); + + channel->copy_fn(runtime->dma_area + channel->buffer_pos * frame_bytes, + mbo->virt_address, + fr0 * frame_bytes); + + if (frames > fr0) { + /* wrap around at end of ring buffer */ + channel->copy_fn(runtime->dma_area, + mbo->virt_address + fr0 * frame_bytes, + (frames - fr0) * frame_bytes); + } + + channel->buffer_pos += frames; + if (channel->buffer_pos >= buffer_size) + channel->buffer_pos -= buffer_size; + channel->period_pos += frames; + if (channel->period_pos >= runtime->period_size) { + channel->period_pos -= runtime->period_size; + return true; + } + + return false; +} + +/** + * playback_thread - function implements the playback thread + * @data: private data + * + * Thread which does the playback functionality in a loop. It waits for a free + * MBO from mostcore for a particular channel and copy the data from ring buffer + * to MBO. Submit the MBO back to mostcore, after copying the data. + * + * Returns 0 on success or error code otherwise. + */ +static int playback_thread(void *data) +{ + struct channel *const channel = data; + + pr_info("playback thread started\n"); + + while (!kthread_should_stop()) { + struct mbo *mbo = NULL; + bool period_elapsed = false; + int ret; + + wait_event_interruptible( + channel->playback_waitq, + kthread_should_stop() || + (mbo = most_get_mbo(channel->iface, channel->id))); + + if (!mbo) + continue; + + if (channel->is_stream_running) + period_elapsed = copy_data(channel, mbo); + else + memset(mbo->virt_address, 0, mbo->buffer_length); + + ret = most_submit_mbo(mbo); + if (ret) + channel->is_stream_running = false; + + if (period_elapsed) + snd_pcm_period_elapsed(channel->substream); + } + + return 0; +} + +/** + * pcm_open - implements open callback function for PCM middle layer + * @substream: pointer to ALSA PCM substream + * + * This is called when a PCM substream is opened. At least, the function should + * initialize the runtime->hw record. + * + * Returns 0 on success or error code otherwise. + */ +static int pcm_open(struct snd_pcm_substream *substream) +{ + struct channel *channel = substream->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct most_channel_config *cfg = channel->cfg; + + pr_info("pcm_open(), %s\n", substream->name); + + channel->substream = substream; + + if (cfg->direction == MOST_CH_TX) { + init_waitqueue_head(&channel->playback_waitq); + channel->playback_task = kthread_run(&playback_thread, channel, + "most_audio_playback"); + if (IS_ERR(channel->playback_task)) + return PTR_ERR(channel->playback_task); + } + + if (most_start_channel(channel->iface, channel->id)) { + pr_err("most_start_channel() failed!\n"); + if (cfg->direction == MOST_CH_TX) + kthread_stop(channel->playback_task); + return -EBUSY; + } + + runtime->hw = pcm_hardware_template; + runtime->hw.buffer_bytes_max = cfg->num_buffers * cfg->buffer_size; + runtime->hw.period_bytes_min = cfg->buffer_size; + runtime->hw.period_bytes_max = cfg->buffer_size; + runtime->hw.periods_min = 1; + runtime->hw.periods_max = cfg->num_buffers; + + return 0; +} + +/** + * pcm_close - implements close callback function for PCM middle layer + * @substream: sub-stream pointer + * + * Obviously, this is called when a PCM substream is closed. Any private + * instance for a PCM substream allocated in the open callback will be + * released here. + * + * Returns 0 on success or error code otherwise. + */ +static int pcm_close(struct snd_pcm_substream *substream) +{ + struct channel *channel = substream->private_data; + + pr_info("pcm_close(), %s\n", substream->name); + + if (channel->cfg->direction == MOST_CH_TX) + kthread_stop(channel->playback_task); + most_stop_channel(channel->iface, channel->id); + + return 0; +} + +/** + * pcm_hw_params - implements hw_params callback function for PCM middle layer + * @substream: sub-stream pointer + * @hw_params: contains the hardware parameters set by the application + * + * This is called when the hardware parameters is set by the application, that + * is, once when the buffer size, the period size, the format, etc. are defined + * for the PCM substream. Many hardware setups should be done is this callback, + * including the allocation of buffers. + * + * Returns 0 on success or error code otherwise. + */ +static int pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) +{ + pr_info("pcm_hw_params()\n"); + + return snd_pcm_lib_alloc_vmalloc_buffer(substream, + params_buffer_bytes(hw_params)); +} + +/** + * pcm_hw_free - implements hw_free callback function for PCM middle layer + * @substream: substream pointer + * + * This is called to release the resources allocated via hw_params. + * This function will be always called before the close callback is called. + * + * Returns 0 on success or error code otherwise. + */ +static int pcm_hw_free(struct snd_pcm_substream *substream) +{ + pr_info("pcm_hw_free()\n"); + + return snd_pcm_lib_free_vmalloc_buffer(substream); +} + +/** + * pcm_prepare - implements prepare callback function for PCM middle layer + * @substream: substream pointer + * + * This callback is called when the PCM is "prepared". Format rate, sample rate, + * etc., can be set here. This callback can be called many times at each setup. + * + * Returns 0 on success or error code otherwise. + */ +static int pcm_prepare(struct snd_pcm_substream *substream) +{ + struct channel *channel = substream->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct most_channel_config *cfg = channel->cfg; + int width = snd_pcm_format_physical_width(runtime->format); + + channel->copy_fn = NULL; + + if (cfg->direction == MOST_CH_TX) { + if (snd_pcm_format_big_endian(runtime->format) || width == 8) + channel->copy_fn = alsa_to_most_memcpy; + else if (width == 16) + channel->copy_fn = alsa_to_most_copy16; + else if (width == 24) + channel->copy_fn = alsa_to_most_copy24; + else if (width == 32) + channel->copy_fn = alsa_to_most_copy32; + } else { + if (snd_pcm_format_big_endian(runtime->format) || width == 8) + channel->copy_fn = most_to_alsa_memcpy; + else if (width == 16) + channel->copy_fn = most_to_alsa_copy16; + else if (width == 24) + channel->copy_fn = most_to_alsa_copy24; + else if (width == 32) + channel->copy_fn = most_to_alsa_copy32; + } + + if (!channel->copy_fn) { + pr_err("unsupported format\n"); + return -EINVAL; + } + + channel->period_pos = 0; + channel->buffer_pos = 0; + + return 0; +} + +/** + * pcm_trigger - implements trigger callback function for PCM middle layer + * @substream: substream pointer + * @cmd: action to perform + * + * This is called when the PCM is started, stopped or paused. The action will be + * specified in the second argument, SNDRV_PCM_TRIGGER_XXX + * + * Returns 0 on success or error code otherwise. + */ +static int pcm_trigger(struct snd_pcm_substream *substream, int cmd) +{ + struct channel *channel = substream->private_data; + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + channel->is_stream_running = true; + return 0; + + case SNDRV_PCM_TRIGGER_STOP: + channel->is_stream_running = false; + return 0; + + default: + pr_info("pcm_trigger(), invalid\n"); + return -EINVAL; + } + return 0; +} + +/** + * pcm_pointer - implements pointer callback function for PCM middle layer + * @substream: substream pointer + * + * This callback is called when the PCM middle layer inquires the current + * hardware position on the buffer. The position must be returned in frames, + * ranging from 0 to buffer_size-1. + */ +static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream) +{ + struct channel *channel = substream->private_data; + + return channel->buffer_pos; +} + +/** + * Initialization of struct snd_pcm_ops + */ +static struct snd_pcm_ops pcm_ops = { + .open = pcm_open, + .close = pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = pcm_hw_params, + .hw_free = pcm_hw_free, + .prepare = pcm_prepare, + .trigger = pcm_trigger, + .pointer = pcm_pointer, + .page = snd_pcm_lib_get_vmalloc_page, + .mmap = snd_pcm_lib_mmap_vmalloc, +}; + + +int split_arg_list(char *buf, char **card_name, char **pcm_format) +{ + *card_name = strsep(&buf, "."); + if (!*card_name) + return -EIO; + *pcm_format = strsep(&buf, ".\n"); + if (!*pcm_format) + return -EIO; + return 0; +} + +int audio_set_pcm_format(char *pcm_format, struct most_channel_config *cfg) +{ + if (!strcmp(pcm_format, "1x8")) { + if (cfg->subbuffer_size != 1) + goto error; + pr_info("PCM format is 8-bit mono\n"); + pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S8; + } else if (!strcmp(pcm_format, "2x16")) { + if (cfg->subbuffer_size != 4) + goto error; + pr_info("PCM format is 16-bit stereo\n"); + pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S16_BE; + } else if (!strcmp(pcm_format, "2x24")) { + if (cfg->subbuffer_size != 6) + goto error; + pr_info("PCM format is 24-bit stereo\n"); + pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S24_3LE | + SNDRV_PCM_FMTBIT_S24_3BE; + } else if (!strcmp(pcm_format, "2x32")) { + if (cfg->subbuffer_size != 8) + goto error; + pr_info("PCM format is 32-bit stereo\n"); + pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S32_BE; + } else { + pr_err("PCM format %s not supported\n", pcm_format); + return -EIO; + } + return 0; +error: + pr_err("Audio resolution doesn't fit subbuffer size\n"); + return -EINVAL; +} + +/** + * audio_probe_channel - probe function of the driver module + * @iface: pointer to interface instance + * @channel_id: channel index/ID + * @cfg: pointer to actual channel configuration + * @parent: pointer to kobject (needed for sysfs hook-up) + * @arg_list: string that provides the name of the device to be created in /dev + * plus the desired audio resolution + * + * Creates sound card, pcm device, sets pcm ops and registers sound card. + * + * Returns 0 on success or error code otherwise. + */ +static int audio_probe_channel(struct most_interface *iface, int channel_id, + struct most_channel_config *cfg, + struct kobject *parent, char *arg_list) +{ + struct channel *channel; + struct snd_card *card; + struct snd_pcm *pcm; + int playback_count = 0; + int capture_count = 0; + int ret; + int direction; + char *card_name; + char *pcm_format; + + pr_info("sound_probe_channel()\n"); + + if (!iface) + return -EINVAL; + + if (cfg->data_type != MOST_CH_SYNC) { + pr_err("Incompatible channel type\n"); + return -EINVAL; + } + + if (get_channel(iface, channel_id)) { + pr_err("channel (%s:%d) is already linked\n", + iface->description, channel_id); + return -EINVAL; + } + + if (cfg->direction == MOST_CH_TX) { + playback_count = 1; + direction = SNDRV_PCM_STREAM_PLAYBACK; + } else { + capture_count = 1; + direction = SNDRV_PCM_STREAM_CAPTURE; + } + + ret = split_arg_list(arg_list, &card_name, &pcm_format); + if (ret < 0) { + pr_info("PCM format missing\n"); + return ret; + } + if (audio_set_pcm_format(pcm_format, cfg)) + return ret; + + ret = snd_card_new(NULL, -1, card_name, THIS_MODULE, + sizeof(*channel), &card); + if (ret < 0) + return ret; + + channel = card->private_data; + channel->card = card; + channel->cfg = cfg; + channel->iface = iface; + channel->id = channel_id; + + snprintf(card->driver, sizeof(card->driver), "%s", DRIVER_NAME); + snprintf(card->shortname, sizeof(card->shortname), "MOST:%d", + card->number); + snprintf(card->longname, sizeof(card->longname), "%s at %s, ch %d", + card->shortname, iface->description, channel_id); + + ret = snd_pcm_new(card, card_name, 0, playback_count, + capture_count, &pcm); + if (ret < 0) + goto err_free_card; + + pcm->private_data = channel; + + snd_pcm_set_ops(pcm, direction, &pcm_ops); + + ret = snd_card_register(card); + if (ret < 0) + goto err_free_card; + + list_add_tail(&channel->list, &dev_list); + + return 0; + +err_free_card: + snd_card_free(card); + return ret; +} + +/** + * audio_disconnect_channel - function to disconnect a channel + * @iface: pointer to interface instance + * @channel_id: channel index + * + * This frees allocated memory and removes the sound card from ALSA + * + * Returns 0 on success or error code otherwise. + */ +static int audio_disconnect_channel(struct most_interface *iface, + int channel_id) +{ + struct channel *channel; + + pr_info("sound_disconnect_channel()\n"); + + channel = get_channel(iface, channel_id); + if (!channel) { + pr_err("sound_disconnect_channel(), invalid channel %d\n", + channel_id); + return -EINVAL; + } + + list_del(&channel->list); + snd_card_free(channel->card); + + return 0; +} + +/** + * audio_rx_completion - completion handler for rx channels + * @mbo: pointer to buffer object that has completed + * + * This searches for the channel this MBO belongs to and copy the data from MBO + * to ring buffer + * + * Returns 0 on success or error code otherwise. + */ +static int audio_rx_completion(struct mbo *mbo) +{ + struct channel *channel = get_channel(mbo->ifp, mbo->hdm_channel_id); + bool period_elapsed = false; + + if (!channel) { + pr_err("sound_rx_completion(), invalid channel %d\n", + mbo->hdm_channel_id); + return -EINVAL; + } + + if (channel->is_stream_running) + period_elapsed = copy_data(channel, mbo); + + most_put_mbo(mbo); + + if (period_elapsed) + snd_pcm_period_elapsed(channel->substream); + + return 0; +} + +/** + * audio_tx_completion - completion handler for tx channels + * @iface: pointer to interface instance + * @channel_id: channel index/ID + * + * This searches the channel that belongs to this combination of interface + * pointer and channel ID and wakes a process sitting in the wait queue of + * this channel. + * + * Returns 0 on success or error code otherwise. + */ +static int audio_tx_completion(struct most_interface *iface, int channel_id) +{ + struct channel *channel = get_channel(iface, channel_id); + + if (!channel) { + pr_err("sound_tx_completion(), invalid channel %d\n", + channel_id); + return -EINVAL; + } + + wake_up_interruptible(&channel->playback_waitq); + + return 0; +} + +/** + * Initialization of the struct most_aim + */ +static struct most_aim audio_aim = { + .name = DRIVER_NAME, + .probe_channel = audio_probe_channel, + .disconnect_channel = audio_disconnect_channel, + .rx_completion = audio_rx_completion, + .tx_completion = audio_tx_completion, +}; + +static int __init audio_init(void) +{ + pr_info("init()\n"); + + INIT_LIST_HEAD(&dev_list); + + return most_register_aim(&audio_aim); +} + +static void __exit audio_exit(void) +{ + struct channel *channel, *tmp; + + pr_info("exit()\n"); + + list_for_each_entry_safe(channel, tmp, &dev_list, list) { + list_del(&channel->list); + snd_card_free(channel->card); + } + + most_deregister_aim(&audio_aim); +} + +module_init(audio_init); +module_exit(audio_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Christian Gromm "); +MODULE_DESCRIPTION("Audio Application Interface Module for MostCore"); From 3d31c0cb6c127b1d943b610065a05decf821998c Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:52 +0200 Subject: [PATCH 487/912] Staging: most: add MOST driver's aim-v4l2 module This patch adds the aim-v4l2 module of the MOST driver to the kernel's driver staging area. This module is part of the MOST driver and handles user space interaction by means of V4L2. This patch is needed in order to have access to MOST isochronous AVP data through V4L2 devices. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/Kconfig | 2 + drivers/staging/most/Makefile | 1 + drivers/staging/most/aim-v4l2/Kconfig | 12 + drivers/staging/most/aim-v4l2/Makefile | 6 + drivers/staging/most/aim-v4l2/video.c | 634 +++++++++++++++++++++++++ 5 files changed, 655 insertions(+) create mode 100644 drivers/staging/most/aim-v4l2/Kconfig create mode 100644 drivers/staging/most/aim-v4l2/Makefile create mode 100644 drivers/staging/most/aim-v4l2/video.c diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig index 050abbeed31d..458291841588 100644 --- a/drivers/staging/most/Kconfig +++ b/drivers/staging/most/Kconfig @@ -19,4 +19,6 @@ source "drivers/staging/most/aim-network/Kconfig" source "drivers/staging/most/aim-sound/Kconfig" +source "drivers/staging/most/aim-v4l2/Kconfig" + endif diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile index c639bbd3b830..6e319c499d19 100644 --- a/drivers/staging/most/Makefile +++ b/drivers/staging/most/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_MOSTCORE) += mostcore/ obj-$(CONFIG_AIM_CDEV) += aim-cdev/ obj-$(CONFIG_AIM_NETWORK) += aim-network/ obj-$(CONFIG_AIM_SOUND) += aim-sound/ +obj-$(CONFIG_AIM_V4L2) += aim-v4l2/ diff --git a/drivers/staging/most/aim-v4l2/Kconfig b/drivers/staging/most/aim-v4l2/Kconfig new file mode 100644 index 000000000000..d70eaaf0936c --- /dev/null +++ b/drivers/staging/most/aim-v4l2/Kconfig @@ -0,0 +1,12 @@ +# +# MOST V4L2 configuration +# + +config AIM_V4L2 + tristate "V4L2 AIM" + depends on VIDEO_V4L2 + ---help--- + Say Y here if you want to commumicate via Video 4 Linux. + + To compile this driver as a module, choose M here: the + module will be called aim_v4l2. \ No newline at end of file diff --git a/drivers/staging/most/aim-v4l2/Makefile b/drivers/staging/most/aim-v4l2/Makefile new file mode 100644 index 000000000000..28aa948d6609 --- /dev/null +++ b/drivers/staging/most/aim-v4l2/Makefile @@ -0,0 +1,6 @@ +obj-$(CONFIG_AIM_V4L2) += aim_v4l2.o + +aim_v4l2-objs := video.o + +ccflags-y += -Idrivers/staging/most/mostcore/ +ccflags-y += -Idrivers/media/video diff --git a/drivers/staging/most/aim-v4l2/video.c b/drivers/staging/most/aim-v4l2/video.c new file mode 100644 index 000000000000..a977b883ee36 --- /dev/null +++ b/drivers/staging/most/aim-v4l2/video.c @@ -0,0 +1,634 @@ +/* + * V4L2 AIM - V4L2 Application Interface Module for MostCore + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mostcore.h" + + +#define V4L2_AIM_MAX_INPUT 1 + + +struct most_video_dev { + struct most_interface *iface; + int ch_idx; + struct list_head list; + bool mute; + + struct list_head pending_mbos; + spinlock_t list_lock; + + struct v4l2_device v4l2_dev; + atomic_t access_ref; + struct video_device *vdev; + unsigned int ctrl_input; + + struct mutex lock; + + wait_queue_head_t wait_data; +}; + +struct aim_fh { + /* must be the first field of this struct! */ + struct v4l2_fh fh; + struct most_video_dev *mdev; + u32 offs; +}; + + +static struct list_head video_devices = LIST_HEAD_INIT(video_devices); +static struct spinlock list_lock; +static struct most_aim aim_info; + + +static inline bool data_ready(struct most_video_dev *mdev) +{ + return !list_empty(&mdev->pending_mbos); +} + +static inline struct mbo *get_top_mbo(struct most_video_dev *mdev) +{ + return list_first_entry(&mdev->pending_mbos, struct mbo, list); +} + + +static int aim_vdev_open(struct file *filp) +{ + int ret; + struct video_device *vdev = video_devdata(filp); + struct most_video_dev *mdev = video_drvdata(filp); + struct aim_fh *fh; + + pr_info("aim_vdev_open()\n"); + + switch (vdev->vfl_type) { + case VFL_TYPE_GRABBER: + break; + default: + return -EINVAL; + } + + fh = kzalloc(sizeof(struct aim_fh), GFP_KERNEL); + if (!fh) + return -ENOMEM; + + if (!atomic_inc_and_test(&mdev->access_ref)) { + pr_err("too many clients\n"); + ret = -EBUSY; + goto err_dec; + } + + fh->mdev = mdev; + v4l2_fh_init(&fh->fh, vdev); + filp->private_data = fh; + + v4l2_fh_add(&fh->fh); + + ret = most_start_channel(mdev->iface, mdev->ch_idx); + if (ret) { + pr_err("most_start_channel() failed\n"); + goto err_rm; + } + + return 0; + +err_rm: + v4l2_fh_del(&fh->fh); + v4l2_fh_exit(&fh->fh); + +err_dec: + atomic_dec(&mdev->access_ref); + kfree(fh); + return ret; +} + +static int aim_vdev_close(struct file *filp) +{ + struct aim_fh *fh = filp->private_data; + struct most_video_dev *mdev = fh->mdev; + struct mbo *mbo, *tmp; + + pr_info("aim_vdev_close()\n"); + + /* + * We need to put MBOs back before we call most_stop_channel() + * to deallocate MBOs. + * From the other hand mostcore still calling rx_completion() + * to deliver MBOs until most_stop_channel() is called. + * Use mute to work around this issue. + * This must be implemented in core. + */ + + spin_lock(&mdev->list_lock); + mdev->mute = true; + list_for_each_entry_safe(mbo, tmp, &mdev->pending_mbos, list) { + list_del(&mbo->list); + spin_unlock(&mdev->list_lock); + most_put_mbo(mbo); + spin_lock(&mdev->list_lock); + } + spin_unlock(&mdev->list_lock); + most_stop_channel(mdev->iface, mdev->ch_idx); + mdev->mute = false; + + v4l2_fh_del(&fh->fh); + v4l2_fh_exit(&fh->fh); + + atomic_dec(&mdev->access_ref); + kfree(fh); + return 0; +} + +static ssize_t aim_vdev_read(struct file *filp, char __user *buf, + size_t count, loff_t *pos) +{ + struct aim_fh *fh = filp->private_data; + struct most_video_dev *mdev = fh->mdev; + int ret = 0; + + if (*pos) + return -ESPIPE; + + if (!mdev) + return -ENODEV; + + /* wait for the first buffer */ + if (!(filp->f_flags & O_NONBLOCK)) { + if (wait_event_interruptible(mdev->wait_data, data_ready(mdev))) + return -ERESTARTSYS; + } + + if (!data_ready(mdev)) + return -EAGAIN; + + while (count > 0 && data_ready(mdev)) { + struct mbo *const mbo = get_top_mbo(mdev); + int const rem = mbo->processed_length - fh->offs; + int const cnt = rem < count ? rem : count; + + if (copy_to_user(buf, mbo->virt_address + fh->offs, cnt)) { + pr_err("read: copy_to_user failed\n"); + if (!ret) + ret = -EFAULT; + return ret; + } + + fh->offs += cnt; + count -= cnt; + buf += cnt; + ret += cnt; + + if (cnt >= rem) { + fh->offs = 0; + spin_lock(&mdev->list_lock); + list_del(&mbo->list); + spin_unlock(&mdev->list_lock); + most_put_mbo(mbo); + } + } + return ret; +} + +static unsigned int aim_vdev_poll(struct file *filp, poll_table *wait) +{ + struct aim_fh *fh = filp->private_data; + struct most_video_dev *mdev = fh->mdev; + unsigned int mask = 0; + + /* only wait if no data is available */ + if (!data_ready(mdev)) + poll_wait(filp, &mdev->wait_data, wait); + if (data_ready(mdev)) + mask |= POLLIN | POLLRDNORM; + + return mask; +} + +static void aim_set_format_struct(struct v4l2_format *f) +{ + f->fmt.pix.width = 8; + f->fmt.pix.height = 8; + f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; + f->fmt.pix.bytesperline = 0; + f->fmt.pix.sizeimage = 188 * 2; + f->fmt.pix.colorspace = V4L2_COLORSPACE_REC709; + f->fmt.pix.field = V4L2_FIELD_NONE; + f->fmt.pix.priv = 0; +} + +static int aim_set_format(struct most_video_dev *mdev, unsigned int cmd, + struct v4l2_format *format) +{ +#if 0 + u32 const pixfmt = format->fmt.pix.pixelformat; + const char *fmt; + + if (pixfmt != V4L2_PIX_FMT_MPEG) { + if (cmd == VIDIOC_TRY_FMT) + fmt = KERN_ERR "try %c%c%c%c failed\n"; + else + fmt = KERN_ERR "set %c%c%c%c failed\n"; + } else { + if (cmd == VIDIOC_TRY_FMT) + fmt = KERN_ERR "try %c%c%c%c\n"; + else + fmt = KERN_ERR "set %c%c%c%c\n"; + } + printk(fmt, + (pixfmt) & 255, + (pixfmt >> 8) & 255, + (pixfmt >> 16) & 255, + (pixfmt >> 24) & 255); +#endif + + if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_MPEG) + return -EINVAL; + + if (cmd == VIDIOC_TRY_FMT) + return 0; + + aim_set_format_struct(format); + + return 0; +} + + +static int vidioc_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + struct aim_fh *fh = priv; + struct most_video_dev *mdev = fh->mdev; + + pr_info("vidioc_querycap()\n"); + + strlcpy(cap->driver, "v4l2_most_aim", sizeof(cap->driver)); + strlcpy(cap->card, "my_card", sizeof(cap->card)); + snprintf(cap->bus_info, sizeof(cap->bus_info), + "%s", mdev->iface->description); + + cap->capabilities = + V4L2_CAP_READWRITE | + V4L2_CAP_TUNER | + V4L2_CAP_VIDEO_CAPTURE; + return 0; +} + +static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_fmtdesc *f) +{ + pr_info("vidioc_enum_fmt_vid_cap() %d\n", f->index); + + if (f->index) + return -EINVAL; + + strcpy(f->description, "MPEG"); + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + f->flags = V4L2_FMT_FLAG_COMPRESSED; + f->pixelformat = V4L2_PIX_FMT_MPEG; + + return 0; +} + +static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + pr_info("vidioc_g_fmt_vid_cap()\n"); + + aim_set_format_struct(f); + return 0; +} + +static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct aim_fh *fh = priv; + struct most_video_dev *mdev = fh->mdev; + + return aim_set_format(mdev, VIDIOC_TRY_FMT, f); +} + +static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct aim_fh *fh = priv; + struct most_video_dev *mdev = fh->mdev; + + return aim_set_format(mdev, VIDIOC_S_FMT, f); +} + +static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm) +{ + pr_info("vidioc_g_std()\n"); + + *norm = V4L2_STD_UNKNOWN; + return 0; +} + +static int vidioc_enum_input(struct file *file, void *priv, + struct v4l2_input *input) +{ + struct aim_fh *fh = priv; + struct most_video_dev *mdev = fh->mdev; + + if (input->index >= V4L2_AIM_MAX_INPUT) + return -EINVAL; + + strcpy(input->name, "MOST Video"); + input->type |= V4L2_INPUT_TYPE_CAMERA; + input->audioset = 0; + + input->std = mdev->vdev->tvnorms; + + return 0; +} + +static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) +{ + struct aim_fh *fh = priv; + struct most_video_dev *mdev = fh->mdev; + *i = mdev->ctrl_input; + return 0; +} + +static int vidioc_s_input(struct file *file, void *priv, unsigned int index) +{ + struct aim_fh *fh = priv; + struct most_video_dev *mdev = fh->mdev; + + pr_info("vidioc_s_input(%d)\n", index); + + if (index >= V4L2_AIM_MAX_INPUT) + return -EINVAL; + mdev->ctrl_input = index; + return 0; +} + +static struct v4l2_file_operations aim_fops = { + .owner = THIS_MODULE, + .open = aim_vdev_open, + .release = aim_vdev_close, + .read = aim_vdev_read, + .poll = aim_vdev_poll, + .unlocked_ioctl = video_ioctl2, +}; + +static const struct v4l2_ioctl_ops video_ioctl_ops = { + .vidioc_querycap = vidioc_querycap, + .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, + .vidioc_g_std = vidioc_g_std, + .vidioc_enum_input = vidioc_enum_input, + .vidioc_g_input = vidioc_g_input, + .vidioc_s_input = vidioc_s_input, +}; + +static const struct video_device aim_videodev_template = { + .fops = &aim_fops, + .release = video_device_release, + .ioctl_ops = &video_ioctl_ops, + .tvnorms = V4L2_STD_UNKNOWN, +}; + +/**************************************************************************/ + +static struct most_video_dev *get_aim_dev( + struct most_interface *iface, int channel_idx) +{ + struct most_video_dev *mdev, *tmp; + + spin_lock(&list_lock); + list_for_each_entry_safe(mdev, tmp, &video_devices, list) { + if (mdev->iface == iface && mdev->ch_idx == channel_idx) { + spin_unlock(&list_lock); + return mdev; + } + } + spin_unlock(&list_lock); + return 0; +} + +static int aim_rx_data(struct mbo *mbo) +{ + struct most_video_dev *mdev = + get_aim_dev(mbo->ifp, mbo->hdm_channel_id); + + if (!mdev) + return -EIO; + + spin_lock(&mdev->list_lock); + if (unlikely(mdev->mute)) { + spin_unlock(&mdev->list_lock); + return -EIO; + } + + list_add_tail(&mbo->list, &mdev->pending_mbos); + spin_unlock(&mdev->list_lock); + wake_up_interruptible(&mdev->wait_data); + return 0; +} + +static int aim_register_videodev(struct most_video_dev *mdev) +{ + int retval = -ENOMEM; + int ret; + + pr_info("aim_register_videodev()\n"); + + init_waitqueue_head(&mdev->wait_data); + + /* allocate and fill v4l2 video struct */ + mdev->vdev = video_device_alloc(); + if (!mdev->vdev) + return -ENOMEM; + + /* Fill the video capture device struct */ + *mdev->vdev = aim_videodev_template; + mdev->vdev->v4l2_dev = &mdev->v4l2_dev; + mdev->vdev->lock = &mdev->lock; + strcpy(mdev->vdev->name, "most v4l2 aim video"); + + /* Register the v4l2 device */ + video_set_drvdata(mdev->vdev, mdev); + retval = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1); + if (retval != 0) { + pr_err("video_register_device failed (%d)\n", retval); + ret = -ENODEV; + goto err_vbi_dev; + } + + return 0; + +err_vbi_dev: + video_device_release(mdev->vdev); + return ret; +} + +static void aim_unregister_videodev(struct most_video_dev *mdev) +{ + pr_info("aim_unregister_videodev()\n"); + + video_unregister_device(mdev->vdev); +} + + +static void aim_v4l2_dev_release(struct v4l2_device *v4l2_dev) +{ + struct most_video_dev *mdev = + container_of(v4l2_dev, struct most_video_dev, v4l2_dev); + + v4l2_device_unregister(v4l2_dev); + kfree(mdev); +} + +static int aim_probe_channel(struct most_interface *iface, int channel_idx, + struct most_channel_config *ccfg, + struct kobject *parent, char *name) +{ + int ret; + struct most_video_dev *mdev = get_aim_dev(iface, channel_idx); + + pr_info("aim_probe_channel()\n"); + + if (mdev) { + pr_err("channel already linked\n"); + return -EEXIST; + } + + if (ccfg->direction != MOST_CH_RX) { + pr_err("wrong direction, expect rx\n"); + return -EINVAL; + } + + if (ccfg->data_type != MOST_CH_SYNC && + ccfg->data_type != MOST_CH_ISOC_AVP) { + pr_err("wrong channel type, expect sync or isoc_avp\n"); + return -EINVAL; + } + + mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + if (!mdev) + return -ENOMEM; + + mutex_init(&mdev->lock); + atomic_set(&mdev->access_ref, -1); + spin_lock_init(&mdev->list_lock); + INIT_LIST_HEAD(&mdev->pending_mbos); + mdev->iface = iface; + mdev->ch_idx = channel_idx; + mdev->v4l2_dev.release = aim_v4l2_dev_release; + + /* Create the v4l2_device */ + strlcpy(mdev->v4l2_dev.name, "most_video_device", + sizeof(mdev->v4l2_dev.name)); + ret = v4l2_device_register(NULL, &mdev->v4l2_dev); + if (ret) { + pr_err("v4l2_device_register() failed\n"); + kfree(mdev); + return ret; + } + + ret = aim_register_videodev(mdev); + if (ret) + goto err_unreg; + + spin_lock(&list_lock); + list_add(&mdev->list, &video_devices); + spin_unlock(&list_lock); + return 0; + +err_unreg: + v4l2_device_disconnect(&mdev->v4l2_dev); + v4l2_device_put(&mdev->v4l2_dev); + return ret; +} + +static int aim_disconnect_channel(struct most_interface *iface, + int channel_idx) +{ + struct most_video_dev *mdev = get_aim_dev(iface, channel_idx); + + pr_info("aim_disconnect_channel()\n"); + + if (!mdev) { + pr_err("no such channel is linked\n"); + return -ENOENT; + } + + spin_lock(&list_lock); + list_del(&mdev->list); + spin_unlock(&list_lock); + + aim_unregister_videodev(mdev); + v4l2_device_disconnect(&mdev->v4l2_dev); + v4l2_device_put(&mdev->v4l2_dev); + return 0; +} + +static int __init aim_init(void) +{ + spin_lock_init(&list_lock); + + aim_info.name = "v4l"; + aim_info.probe_channel = aim_probe_channel; + aim_info.disconnect_channel = aim_disconnect_channel; + aim_info.rx_completion = aim_rx_data; + return most_register_aim(&aim_info); +} + +static void __exit aim_exit(void) +{ + struct most_video_dev *mdev, *tmp; + + /* + * As the mostcore currently doesn't call disconnect_channel() + * for linked channels while we call most_deregister_aim() + * we simulate this call here. + * This must be fixed in core. + */ + spin_lock(&list_lock); + list_for_each_entry_safe(mdev, tmp, &video_devices, list) { + list_del(&mdev->list); + spin_unlock(&list_lock); + + aim_unregister_videodev(mdev); + v4l2_device_disconnect(&mdev->v4l2_dev); + v4l2_device_put(&mdev->v4l2_dev); + } + spin_unlock(&list_lock); + + most_deregister_aim(&aim_info); + BUG_ON(!list_empty(&video_devices)); +} + +module_init(aim_init); +module_exit(aim_exit); + +MODULE_DESCRIPTION("V4L2 Application Interface Module for MostCore"); +MODULE_AUTHOR("Andrey Shvetsov "); +MODULE_LICENSE("GPL"); From ba3d7ddfb5c6a2529155ac24d7964adba8777419 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:53 +0200 Subject: [PATCH 488/912] Staging: most: add MOST driver's hdm-dim2 module This patch adds the hdm-dim2 module of the MOST driver to the kernel's driver staging area. This module is part of the MOST driver and handles the MediaLB interface of the MOST network interface controller. This patch is needed in order to use the MediaLB peripheral interface of the network interface controller. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/Kconfig | 2 + drivers/staging/most/Makefile | 1 + drivers/staging/most/hdm-dim2/Kconfig | 15 + drivers/staging/most/hdm-dim2/Makefile | 5 + drivers/staging/most/hdm-dim2/dim2_errors.h | 67 ++ drivers/staging/most/hdm-dim2/dim2_hal.c | 919 +++++++++++++++++++ drivers/staging/most/hdm-dim2/dim2_hal.h | 124 +++ drivers/staging/most/hdm-dim2/dim2_hdm.c | 964 ++++++++++++++++++++ drivers/staging/most/hdm-dim2/dim2_hdm.h | 26 + drivers/staging/most/hdm-dim2/dim2_reg.h | 176 ++++ drivers/staging/most/hdm-dim2/dim2_sysfs.c | 116 +++ drivers/staging/most/hdm-dim2/dim2_sysfs.h | 39 + 12 files changed, 2454 insertions(+) create mode 100644 drivers/staging/most/hdm-dim2/Kconfig create mode 100644 drivers/staging/most/hdm-dim2/Makefile create mode 100644 drivers/staging/most/hdm-dim2/dim2_errors.h create mode 100644 drivers/staging/most/hdm-dim2/dim2_hal.c create mode 100644 drivers/staging/most/hdm-dim2/dim2_hal.h create mode 100644 drivers/staging/most/hdm-dim2/dim2_hdm.c create mode 100644 drivers/staging/most/hdm-dim2/dim2_hdm.h create mode 100644 drivers/staging/most/hdm-dim2/dim2_reg.h create mode 100644 drivers/staging/most/hdm-dim2/dim2_sysfs.c create mode 100644 drivers/staging/most/hdm-dim2/dim2_sysfs.h diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig index 458291841588..659c40261720 100644 --- a/drivers/staging/most/Kconfig +++ b/drivers/staging/most/Kconfig @@ -21,4 +21,6 @@ source "drivers/staging/most/aim-sound/Kconfig" source "drivers/staging/most/aim-v4l2/Kconfig" +source "drivers/staging/most/hdm-dim2/Kconfig" + endif diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile index 6e319c499d19..7c68b3b50b10 100644 --- a/drivers/staging/most/Makefile +++ b/drivers/staging/most/Makefile @@ -3,3 +3,4 @@ obj-$(CONFIG_AIM_CDEV) += aim-cdev/ obj-$(CONFIG_AIM_NETWORK) += aim-network/ obj-$(CONFIG_AIM_SOUND) += aim-sound/ obj-$(CONFIG_AIM_V4L2) += aim-v4l2/ +obj-$(CONFIG_HDM_DIM2) += hdm-dim2/ diff --git a/drivers/staging/most/hdm-dim2/Kconfig b/drivers/staging/most/hdm-dim2/Kconfig new file mode 100644 index 000000000000..4abeb545955e --- /dev/null +++ b/drivers/staging/most/hdm-dim2/Kconfig @@ -0,0 +1,15 @@ +# +# MediaLB configuration +# + +config HDM_DIM2 + tristate "DIM2 HDM" + + ---help--- + Say Y here if you want to connect via MediaLB to network tranceiver. + This device driver is platform dependent and needs an addtional + platform driver to be installed. For more information contact + maintainer of this driver. + + To compile this driver as a module, choose M here: the + module will be called hdm_dim2. diff --git a/drivers/staging/most/hdm-dim2/Makefile b/drivers/staging/most/hdm-dim2/Makefile new file mode 100644 index 000000000000..6bbee879a8ea --- /dev/null +++ b/drivers/staging/most/hdm-dim2/Makefile @@ -0,0 +1,5 @@ +obj-$(CONFIG_HDM_DIM2) += hdm_dim2.o + +hdm_dim2-objs := dim2_hdm.o dim2_hal.o dim2_sysfs.o +ccflags-y += -Idrivers/staging/most/mostcore/ +ccflags-y += -Idrivers/staging/most/aim-network/ diff --git a/drivers/staging/most/hdm-dim2/dim2_errors.h b/drivers/staging/most/hdm-dim2/dim2_errors.h new file mode 100644 index 000000000000..314f7de2be73 --- /dev/null +++ b/drivers/staging/most/hdm-dim2/dim2_errors.h @@ -0,0 +1,67 @@ +/* + * dim2_errors.h - Definitions of errors for DIM2 HAL API + * (MediaLB, Device Interface Macro IP, OS62420) + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#ifndef _MOST_DIM_ERRORS_H +#define _MOST_DIM_ERRORS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * MOST DIM errors. + */ +enum dim_errors_t { + /** Not an error */ + DIM_NO_ERROR = 0, + + /** Bad base address for DIM2 IP */ + DIM_INIT_ERR_DIM_ADDR = 0x10, + + /**< Bad MediaLB clock */ + DIM_INIT_ERR_MLB_CLOCK, + + /** Bad channel address */ + DIM_INIT_ERR_CHANNEL_ADDRESS, + + /** Out of DBR memory */ + DIM_INIT_ERR_OUT_OF_MEMORY, + + /** DIM API is called while DIM is not initialized successfully */ + DIM_ERR_DRIVER_NOT_INITIALIZED = 0x20, + + /** + * Configuration does not respect hardware limitations + * for isochronous or synchronous channels + */ + DIM_ERR_BAD_CONFIG, + + /** + * Buffer size does not respect hardware limitations + * for isochronous or synchronous channels + */ + DIM_ERR_BAD_BUFFER_SIZE, + + DIM_ERR_UNDERFLOW, + + DIM_ERR_OVERFLOW, +}; + + +#ifdef __cplusplus +} +#endif + +#endif /* _MOST_DIM_ERRORS_H */ diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c new file mode 100644 index 000000000000..01b748944ee4 --- /dev/null +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -0,0 +1,919 @@ +/* + * dim2_hal.c - DIM2 HAL implementation + * (MediaLB, Device Interface Macro IP, OS62420) + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +/* Author: Andrey Shvetsov */ + +#include "dim2_hal.h" +#include "dim2_errors.h" +#include "dim2_reg.h" +#include + + +/* + * The number of frames per sub-buffer for synchronous channels. + * Allowed values: 1, 2, 4, 8, 16, 32, 64. + */ +#define FRAMES_PER_SUBBUFF 16 + +/* + * Size factor for synchronous DBR buffer. + * Minimal value is 4*FRAMES_PER_SUBBUFF. + */ +#define SYNC_DBR_FACTOR (4u * (u16)FRAMES_PER_SUBBUFF) + +/* + * Size factor for isochronous DBR buffer. + * Minimal value is 3. + */ +#define ISOC_DBR_FACTOR 3u + +/* + * Number of 32-bit units for DBR map. + * + * 1: block size is 512, max allocation is 16K + * 2: block size is 256, max allocation is 8K + * 4: block size is 128, max allocation is 4K + * 8: block size is 64, max allocation is 2K + * + * Min allocated space is block size. + * Max possible allocated space is 32 blocks. + */ +#define DBR_MAP_SIZE 2 + + +/* -------------------------------------------------------------------------- */ +/* not configurable area */ + +#define CDT 0x00 +#define ADT 0x40 +#define MLB_CAT 0x80 +#define AHB_CAT 0x88 + +#define DBR_SIZE (16*1024) /* specified by IP */ +#define DBR_BLOCK_SIZE (DBR_SIZE / 32 / DBR_MAP_SIZE) + + +/* -------------------------------------------------------------------------- */ +/* generic helper functions and macros */ + +#define MLBC0_FCNT_VAL_MACRO(n) MLBC0_FCNT_VAL_ ## n ## FPSB +#define MLBC0_FCNT_VAL(fpsb) MLBC0_FCNT_VAL_MACRO(fpsb) + +static inline u32 bit_mask(u8 position) +{ + return (u32)1 << position; +} + +static inline bool dim_on_error(u8 error_id, const char *error_message) +{ + DIMCB_OnError(error_id, error_message); + return false; +} + + +/* -------------------------------------------------------------------------- */ +/* types and local variables */ + +struct lld_global_vars_t { + bool dim_is_initialized; + bool mcm_is_initialized; + struct dim2_regs *dim2; /* DIM2 core base address */ + u32 dbr_map[DBR_MAP_SIZE]; +}; + +static struct lld_global_vars_t g = { false }; + + +/* -------------------------------------------------------------------------- */ + +static int dbr_get_mask_size(u16 size) +{ + int i; + + for (i = 0; i < 6; i++) + if (size <= (DBR_BLOCK_SIZE << i)) + return 1 << i; + return 0; +} + +/** + * Allocates DBR memory. + * @param size Allocating memory size. + * @return Offset in DBR memory by success or DBR_SIZE if out of memory. + */ +static int alloc_dbr(u16 size) +{ + int mask_size; + int i, block_idx = 0; + + if (size <= 0) + return DBR_SIZE; /* out of memory */ + + mask_size = dbr_get_mask_size(size); + if (mask_size == 0) + return DBR_SIZE; /* out of memory */ + + for (i = 0; i < DBR_MAP_SIZE; i++) { + u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE; + u32 mask = ~((~(u32)0) << blocks); + + do { + if ((g.dbr_map[i] & mask) == 0) { + g.dbr_map[i] |= mask; + return block_idx * DBR_BLOCK_SIZE; + } + block_idx += mask_size; + /* do shift left with 2 steps for case mask_size == 32 */ + mask <<= mask_size - 1; + } while ((mask <<= 1) != 0); + } + + return DBR_SIZE; /* out of memory */ +} + +static void free_dbr(int offs, int size) +{ + int block_idx = offs / DBR_BLOCK_SIZE; + u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE; + u32 mask = ~((~(u32)0) << blocks); + + mask <<= block_idx % 32; + g.dbr_map[block_idx / 32] &= ~mask; +} + +/* -------------------------------------------------------------------------- */ + +static u32 dim2_read_ctr(u32 ctr_addr, u16 mdat_idx) +{ + DIMCB_IoWrite(&g.dim2->MADR, ctr_addr); + + /* wait till transfer is completed */ + while ((DIMCB_IoRead(&g.dim2->MCTL) & 1) != 1) + continue; + + DIMCB_IoWrite(&g.dim2->MCTL, 0); /* clear transfer complete */ + + return DIMCB_IoRead((&g.dim2->MDAT0) + mdat_idx); +} + +static void dim2_write_ctr_mask(u32 ctr_addr, const u32 *mask, const u32 *value) +{ + enum { MADR_WNR_BIT = 31 }; + + DIMCB_IoWrite(&g.dim2->MCTL, 0); /* clear transfer complete */ + + if (mask[0] != 0) + DIMCB_IoWrite(&g.dim2->MDAT0, value[0]); + if (mask[1] != 0) + DIMCB_IoWrite(&g.dim2->MDAT1, value[1]); + if (mask[2] != 0) + DIMCB_IoWrite(&g.dim2->MDAT2, value[2]); + if (mask[3] != 0) + DIMCB_IoWrite(&g.dim2->MDAT3, value[3]); + + DIMCB_IoWrite(&g.dim2->MDWE0, mask[0]); + DIMCB_IoWrite(&g.dim2->MDWE1, mask[1]); + DIMCB_IoWrite(&g.dim2->MDWE2, mask[2]); + DIMCB_IoWrite(&g.dim2->MDWE3, mask[3]); + + DIMCB_IoWrite(&g.dim2->MADR, bit_mask(MADR_WNR_BIT) | ctr_addr); + + /* wait till transfer is completed */ + while ((DIMCB_IoRead(&g.dim2->MCTL) & 1) != 1) + continue; + + DIMCB_IoWrite(&g.dim2->MCTL, 0); /* clear transfer complete */ +} + +static inline void dim2_write_ctr(u32 ctr_addr, const u32 *value) +{ + u32 const mask[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; + + dim2_write_ctr_mask(ctr_addr, mask, value); +} + +static inline void dim2_clear_ctr(u32 ctr_addr) +{ + u32 const value[4] = { 0, 0, 0, 0 }; + + dim2_write_ctr(ctr_addr, value); +} + +static void dim2_configure_cat(u8 cat_base, u8 ch_addr, u8 ch_type, + bool read_not_write, bool sync_mfe) +{ + u16 const cat = + (read_not_write << CAT_RNW_BIT) | + (ch_type << CAT_CT_SHIFT) | + (ch_addr << CAT_CL_SHIFT) | + (sync_mfe << CAT_MFE_BIT) | + (false << CAT_MT_BIT) | + (true << CAT_CE_BIT); + u8 const ctr_addr = cat_base + ch_addr / 8; + u8 const idx = (ch_addr % 8) / 2; + u8 const shift = (ch_addr % 2) * 16; + u32 mask[4] = { 0, 0, 0, 0 }; + u32 value[4] = { 0, 0, 0, 0 }; + + mask[idx] = (u32)0xFFFF << shift; + value[idx] = cat << shift; + dim2_write_ctr_mask(ctr_addr, mask, value); +} + +static void dim2_clear_cat(u8 cat_base, u8 ch_addr) +{ + u8 const ctr_addr = cat_base + ch_addr / 8; + u8 const idx = (ch_addr % 8) / 2; + u8 const shift = (ch_addr % 2) * 16; + u32 mask[4] = { 0, 0, 0, 0 }; + u32 value[4] = { 0, 0, 0, 0 }; + + mask[idx] = (u32)0xFFFF << shift; + dim2_write_ctr_mask(ctr_addr, mask, value); +} + +static void dim2_configure_cdt(u8 ch_addr, u16 dbr_address, u16 hw_buffer_size, + u16 packet_length) +{ + u32 cdt[4] = { 0, 0, 0, 0 }; + + if (packet_length) + cdt[1] = ((packet_length - 1) << CDT1_BS_ISOC_SHIFT); + + cdt[3] = + ((hw_buffer_size - 1) << CDT3_BD_SHIFT) | + (dbr_address << CDT3_BA_SHIFT); + dim2_write_ctr(CDT + ch_addr, cdt); +} + +static void dim2_clear_cdt(u8 ch_addr) +{ + u32 cdt[4] = { 0, 0, 0, 0 }; + + dim2_write_ctr(CDT + ch_addr, cdt); +} + +static void dim2_configure_adt(u8 ch_addr) +{ + u32 adt[4] = { 0, 0, 0, 0 }; + + adt[0] = + (true << ADT0_CE_BIT) | + (true << ADT0_LE_BIT) | + (0 << ADT0_PG_BIT); + + dim2_write_ctr(ADT + ch_addr, adt); +} + +static void dim2_clear_adt(u8 ch_addr) +{ + u32 adt[4] = { 0, 0, 0, 0 }; + + dim2_write_ctr(ADT + ch_addr, adt); +} + +static void dim2_start_ctrl_async(u8 ch_addr, u8 idx, u32 buf_addr, + u16 buffer_size) +{ + u8 const shift = idx * 16; + + u32 mask[4] = { 0, 0, 0, 0 }; + u32 adt[4] = { 0, 0, 0, 0 }; + + mask[1] = + bit_mask(ADT1_PS_BIT + shift) | + bit_mask(ADT1_RDY_BIT + shift) | + (ADT1_CTRL_ASYNC_BD_MASK << (ADT1_BD_SHIFT + shift)); + adt[1] = + (true << (ADT1_PS_BIT + shift)) | + (true << (ADT1_RDY_BIT + shift)) | + ((buffer_size - 1) << (ADT1_BD_SHIFT + shift)); + + mask[idx + 2] = 0xFFFFFFFF; + adt[idx + 2] = buf_addr; + + dim2_write_ctr_mask(ADT + ch_addr, mask, adt); +} + +static void dim2_start_isoc_sync(u8 ch_addr, u8 idx, u32 buf_addr, + u16 buffer_size) +{ + u8 const shift = idx * 16; + + u32 mask[4] = { 0, 0, 0, 0 }; + u32 adt[4] = { 0, 0, 0, 0 }; + + mask[1] = + bit_mask(ADT1_RDY_BIT + shift) | + (ADT1_ISOC_SYNC_BD_MASK << (ADT1_BD_SHIFT + shift)); + adt[1] = + (true << (ADT1_RDY_BIT + shift)) | + ((buffer_size - 1) << (ADT1_BD_SHIFT + shift)); + + mask[idx + 2] = 0xFFFFFFFF; + adt[idx + 2] = buf_addr; + + dim2_write_ctr_mask(ADT + ch_addr, mask, adt); +} + + +static void dim2_clear_ctram(void) +{ + u32 ctr_addr; + + for (ctr_addr = 0; ctr_addr < 0x90; ctr_addr++) + dim2_clear_ctr(ctr_addr); +} + +static void dim2_configure_channel( + u8 ch_addr, u8 type, u8 is_tx, u16 dbr_address, u16 hw_buffer_size, + u16 packet_length, bool sync_mfe) +{ + dim2_configure_cdt(ch_addr, dbr_address, hw_buffer_size, packet_length); + dim2_configure_cat(MLB_CAT, ch_addr, type, is_tx ? 1 : 0, sync_mfe); + + dim2_configure_adt(ch_addr); + dim2_configure_cat(AHB_CAT, ch_addr, type, is_tx ? 0 : 1, sync_mfe); + + /* unmask interrupt for used channel, enable mlb_sys_int[0] interrupt */ + DIMCB_IoWrite(&g.dim2->ACMR0, + DIMCB_IoRead(&g.dim2->ACMR0) | bit_mask(ch_addr)); +} + +static void dim2_clear_channel(u8 ch_addr) +{ + /* mask interrupt for used channel, disable mlb_sys_int[0] interrupt */ + DIMCB_IoWrite(&g.dim2->ACMR0, + DIMCB_IoRead(&g.dim2->ACMR0) & ~bit_mask(ch_addr)); + + dim2_clear_cat(AHB_CAT, ch_addr); + dim2_clear_adt(ch_addr); + + dim2_clear_cat(MLB_CAT, ch_addr); + dim2_clear_cdt(ch_addr); +} + +/* -------------------------------------------------------------------------- */ +/* channel state helpers */ + +static void state_init(struct int_ch_state *state) +{ + state->request_counter = 0; + state->service_counter = 0; + + state->idx1 = 0; + state->idx2 = 0; + state->level = 0; +} + +/* -------------------------------------------------------------------------- */ +/* macro helper functions */ + +static inline bool check_channel_address(u32 ch_address) +{ + return ch_address > 0 && (ch_address % 2) == 0 && + (ch_address / 2) <= (u32)CAT_CL_MASK; +} + +static inline bool check_packet_length(u32 packet_length) +{ + u16 const max_size = ((u16)CDT3_BD_ISOC_MASK + 1u) / ISOC_DBR_FACTOR; + + if (packet_length <= 0) + return false; /* too small */ + + if (packet_length > max_size) + return false; /* too big */ + + if (packet_length - 1u > (u32)CDT1_BS_ISOC_MASK) + return false; /* too big */ + + return true; +} + +static inline bool check_bytes_per_frame(u32 bytes_per_frame) +{ + u16 const max_size = ((u16)CDT3_BD_MASK + 1u) / SYNC_DBR_FACTOR; + + if (bytes_per_frame <= 0) + return false; /* too small */ + + if (bytes_per_frame > max_size) + return false; /* too big */ + + return true; +} + +static inline u16 norm_ctrl_async_buffer_size(u16 buf_size) +{ + u16 const max_size = (u16)ADT1_CTRL_ASYNC_BD_MASK + 1u; + + if (buf_size > max_size) + return max_size; + + return buf_size; +} + +static inline u16 norm_isoc_buffer_size(u16 buf_size, u16 packet_length) +{ + u16 n; + u16 const max_size = (u16)ADT1_ISOC_SYNC_BD_MASK + 1u; + + if (buf_size > max_size) + buf_size = max_size; + + n = buf_size / packet_length; + + if (n < 2u) + return 0; /* too small buffer for given packet_length */ + + return packet_length * n; +} + +static inline u16 norm_sync_buffer_size(u16 buf_size, u16 bytes_per_frame) +{ + u16 n; + u16 const max_size = (u16)ADT1_ISOC_SYNC_BD_MASK + 1u; + u32 const unit = bytes_per_frame * (u16)FRAMES_PER_SUBBUFF; + + if (buf_size > max_size) + buf_size = max_size; + + n = buf_size / unit; + + if (n < 1u) + return 0; /* too small buffer for given bytes_per_frame */ + + return unit * n; +} + +static void dim2_cleanup(void) +{ + /* disable MediaLB */ + DIMCB_IoWrite(&g.dim2->MLBC0, false << MLBC0_MLBEN_BIT); + + dim2_clear_ctram(); + + /* disable mlb_int interrupt */ + DIMCB_IoWrite(&g.dim2->MIEN, 0); + + /* clear status for all dma channels */ + DIMCB_IoWrite(&g.dim2->ACSR0, 0xFFFFFFFF); + DIMCB_IoWrite(&g.dim2->ACSR1, 0xFFFFFFFF); + + /* mask interrupts for all channels */ + DIMCB_IoWrite(&g.dim2->ACMR0, 0); + DIMCB_IoWrite(&g.dim2->ACMR1, 0); +} + +static void dim2_initialize(bool enable_6pin, u8 mlb_clock) +{ + dim2_cleanup(); + + /* configure and enable MediaLB */ + DIMCB_IoWrite(&g.dim2->MLBC0, + enable_6pin << MLBC0_MLBPEN_BIT | + mlb_clock << MLBC0_MLBCLK_SHIFT | + MLBC0_FCNT_VAL(FRAMES_PER_SUBBUFF) << MLBC0_FCNT_SHIFT | + true << MLBC0_MLBEN_BIT); + + /* activate all HBI channels */ + DIMCB_IoWrite(&g.dim2->HCMR0, 0xFFFFFFFF); + DIMCB_IoWrite(&g.dim2->HCMR1, 0xFFFFFFFF); + + /* enable HBI */ + DIMCB_IoWrite(&g.dim2->HCTL, bit_mask(HCTL_EN_BIT)); + + /* configure DMA */ + DIMCB_IoWrite(&g.dim2->ACTL, + ACTL_DMA_MODE_VAL_DMA_MODE_1 << ACTL_DMA_MODE_BIT | + true << ACTL_SCE_BIT); + +#if 0 + DIMCB_IoWrite(&g.dim2->MIEN, + bit_mask(MIEN_CTX_BREAK_BIT) | + bit_mask(MIEN_CTX_PE_BIT) | + bit_mask(MIEN_CTX_DONE_BIT) | + bit_mask(MIEN_CRX_BREAK_BIT) | + bit_mask(MIEN_CRX_PE_BIT) | + bit_mask(MIEN_CRX_DONE_BIT) | + bit_mask(MIEN_ATX_BREAK_BIT) | + bit_mask(MIEN_ATX_PE_BIT) | + bit_mask(MIEN_ATX_DONE_BIT) | + bit_mask(MIEN_ARX_BREAK_BIT) | + bit_mask(MIEN_ARX_PE_BIT) | + bit_mask(MIEN_ARX_DONE_BIT)); +#endif +} + +static bool dim2_is_mlb_locked(void) +{ + u32 const mask0 = bit_mask(MLBC0_MLBLK_BIT); + u32 const mask1 = bit_mask(MLBC1_CLKMERR_BIT) | + bit_mask(MLBC1_LOCKERR_BIT); + u32 const c1 = DIMCB_IoRead(&g.dim2->MLBC1); + u32 const nda_mask = (u32)MLBC1_NDA_MASK << MLBC1_NDA_SHIFT; + + DIMCB_IoWrite(&g.dim2->MLBC1, c1 & nda_mask); + return (DIMCB_IoRead(&g.dim2->MLBC1) & mask1) == 0 && + (DIMCB_IoRead(&g.dim2->MLBC0) & mask0) != 0; +} + + +/* -------------------------------------------------------------------------- */ +/* channel help routines */ + +static inline bool service_channel(u8 ch_addr, u8 idx) +{ + u8 const shift = idx * 16; + u32 const adt1 = dim2_read_ctr(ADT + ch_addr, 1); + + if (((adt1 >> (ADT1_DNE_BIT + shift)) & 1) == 0) + return false; + + { + u32 mask[4] = { 0, 0, 0, 0 }; + u32 adt_w[4] = { 0, 0, 0, 0 }; + + mask[1] = + bit_mask(ADT1_DNE_BIT + shift) | + bit_mask(ADT1_ERR_BIT + shift) | + bit_mask(ADT1_RDY_BIT + shift); + dim2_write_ctr_mask(ADT + ch_addr, mask, adt_w); + } + + /* clear channel status bit */ + DIMCB_IoWrite(&g.dim2->ACSR0, bit_mask(ch_addr)); + + return true; +} + + +/* -------------------------------------------------------------------------- */ +/* channel init routines */ + +static void isoc_init(struct dim_channel *ch, u8 ch_addr, u16 packet_length) +{ + state_init(&ch->state); + + ch->addr = ch_addr; + + ch->packet_length = packet_length; + ch->bytes_per_frame = 0; + ch->done_sw_buffers_number = 0; +} + +static void sync_init(struct dim_channel *ch, u8 ch_addr, u16 bytes_per_frame) +{ + state_init(&ch->state); + + ch->addr = ch_addr; + + ch->packet_length = 0; + ch->bytes_per_frame = bytes_per_frame; + ch->done_sw_buffers_number = 0; +} + +static void channel_init(struct dim_channel *ch, u8 ch_addr) +{ + state_init(&ch->state); + + ch->addr = ch_addr; + + ch->packet_length = 0; + ch->bytes_per_frame = 0; + ch->done_sw_buffers_number = 0; +} + +/* returns true if channel interrupt state is cleared */ +static bool channel_service_interrupt(struct dim_channel *ch) +{ + struct int_ch_state *const state = &ch->state; + + if (!service_channel(ch->addr, state->idx2)) + return false; + + state->idx2 ^= 1; + state->request_counter++; + return true; +} + +static bool channel_start(struct dim_channel *ch, u32 buf_addr, u16 buf_size) +{ + struct int_ch_state *const state = &ch->state; + + if (buf_size <= 0) + return dim_on_error(DIM_ERR_BAD_BUFFER_SIZE, "Bad buffer size"); + + if (ch->packet_length == 0 && ch->bytes_per_frame == 0 && + buf_size != norm_ctrl_async_buffer_size(buf_size)) + return dim_on_error(DIM_ERR_BAD_BUFFER_SIZE, + "Bad control/async buffer size"); + + if (ch->packet_length && + buf_size != norm_isoc_buffer_size(buf_size, ch->packet_length)) + return dim_on_error(DIM_ERR_BAD_BUFFER_SIZE, + "Bad isochronous buffer size"); + + if (ch->bytes_per_frame && + buf_size != norm_sync_buffer_size(buf_size, ch->bytes_per_frame)) + return dim_on_error(DIM_ERR_BAD_BUFFER_SIZE, + "Bad synchronous buffer size"); + + if (state->level >= 2u) + return dim_on_error(DIM_ERR_OVERFLOW, "Channel overflow"); + + ++state->level; + + if (ch->packet_length || ch->bytes_per_frame) + dim2_start_isoc_sync(ch->addr, state->idx1, buf_addr, buf_size); + else + dim2_start_ctrl_async(ch->addr, state->idx1, buf_addr, buf_size); + state->idx1 ^= 1; + + return true; +} + +static u8 channel_service(struct dim_channel *ch) +{ + struct int_ch_state *const state = &ch->state; + + if (state->service_counter != state->request_counter) { + state->service_counter++; + if (state->level == 0) + return DIM_ERR_UNDERFLOW; + + --state->level; + ch->done_sw_buffers_number++; + } + + return DIM_NO_ERROR; +} + +static bool channel_detach_buffers(struct dim_channel *ch, u16 buffers_number) +{ + if (buffers_number > ch->done_sw_buffers_number) + return dim_on_error(DIM_ERR_UNDERFLOW, "Channel underflow"); + + ch->done_sw_buffers_number -= buffers_number; + return true; +} + + +/* -------------------------------------------------------------------------- */ +/* API */ + +u8 DIM_Startup(void *dim_base_address, u32 mlb_clock) +{ + g.dim_is_initialized = false; + + if (!dim_base_address) + return DIM_INIT_ERR_DIM_ADDR; + + /* MediaLB clock: 0 - 256 fs, 1 - 512 fs, 2 - 1024 fs, 3 - 2048 fs */ + /* MediaLB clock: 4 - 3072 fs, 5 - 4096 fs, 6 - 6144 fs, 7 - 8192 fs */ + if (mlb_clock >= 8) + return DIM_INIT_ERR_MLB_CLOCK; + + g.dim2 = dim_base_address; + g.dbr_map[0] = g.dbr_map[1] = 0; + + dim2_initialize(mlb_clock >= 3, mlb_clock); + + g.dim_is_initialized = true; + + return DIM_NO_ERROR; +} + +void DIM_Shutdown(void) +{ + g.dim_is_initialized = false; + dim2_cleanup(); +} + +bool DIM_GetLockState(void) +{ + return dim2_is_mlb_locked(); +} + +static u8 init_ctrl_async(struct dim_channel *ch, u8 type, u8 is_tx, + u16 ch_address, u16 hw_buffer_size) +{ + if (!g.dim_is_initialized || !ch) + return DIM_ERR_DRIVER_NOT_INITIALIZED; + + if (!check_channel_address(ch_address)) + return DIM_INIT_ERR_CHANNEL_ADDRESS; + + ch->dbr_size = hw_buffer_size; + ch->dbr_addr = alloc_dbr(ch->dbr_size); + if (ch->dbr_addr >= DBR_SIZE) + return DIM_INIT_ERR_OUT_OF_MEMORY; + + channel_init(ch, ch_address / 2); + + dim2_configure_channel(ch->addr, type, is_tx, + ch->dbr_addr, ch->dbr_size, 0, false); + + return DIM_NO_ERROR; +} + +u16 DIM_NormCtrlAsyncBufferSize(u16 buf_size) +{ + return norm_ctrl_async_buffer_size(buf_size); +} + +/** + * Retrieves maximal possible correct buffer size for isochronous data type + * conform to given packet length and not bigger than given buffer size. + * + * Returns non-zero correct buffer size or zero by error. + */ +u16 DIM_NormIsocBufferSize(u16 buf_size, u16 packet_length) +{ + if (!check_packet_length(packet_length)) + return 0; + + return norm_isoc_buffer_size(buf_size, packet_length); +} + +/** + * Retrieves maximal possible correct buffer size for synchronous data type + * conform to given bytes per frame and not bigger than given buffer size. + * + * Returns non-zero correct buffer size or zero by error. + */ +u16 DIM_NormSyncBufferSize(u16 buf_size, u16 bytes_per_frame) +{ + if (!check_bytes_per_frame(bytes_per_frame)) + return 0; + + return norm_sync_buffer_size(buf_size, bytes_per_frame); +} + +u8 DIM_InitControl(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 max_buffer_size) +{ + return init_ctrl_async(ch, CAT_CT_VAL_CONTROL, is_tx, ch_address, + max_buffer_size * 2); +} + +u8 DIM_InitAsync(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 max_buffer_size) +{ + return init_ctrl_async(ch, CAT_CT_VAL_ASYNC, is_tx, ch_address, + max_buffer_size * 2); +} + +u8 DIM_InitIsoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 packet_length) +{ + if (!g.dim_is_initialized || !ch) + return DIM_ERR_DRIVER_NOT_INITIALIZED; + + if (!check_channel_address(ch_address)) + return DIM_INIT_ERR_CHANNEL_ADDRESS; + + if (!check_packet_length(packet_length)) + return DIM_ERR_BAD_CONFIG; + + ch->dbr_size = packet_length * ISOC_DBR_FACTOR; + ch->dbr_addr = alloc_dbr(ch->dbr_size); + if (ch->dbr_addr >= DBR_SIZE) + return DIM_INIT_ERR_OUT_OF_MEMORY; + + isoc_init(ch, ch_address / 2, packet_length); + + dim2_configure_channel(ch->addr, CAT_CT_VAL_ISOC, is_tx, ch->dbr_addr, + ch->dbr_size, packet_length, false); + + return DIM_NO_ERROR; +} + +u8 DIM_InitSync(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 bytes_per_frame) +{ + if (!g.dim_is_initialized || !ch) + return DIM_ERR_DRIVER_NOT_INITIALIZED; + + if (!check_channel_address(ch_address)) + return DIM_INIT_ERR_CHANNEL_ADDRESS; + + if (!check_bytes_per_frame(bytes_per_frame)) + return DIM_ERR_BAD_CONFIG; + + ch->dbr_size = bytes_per_frame * SYNC_DBR_FACTOR; + ch->dbr_addr = alloc_dbr(ch->dbr_size); + if (ch->dbr_addr >= DBR_SIZE) + return DIM_INIT_ERR_OUT_OF_MEMORY; + + sync_init(ch, ch_address / 2, bytes_per_frame); + + dim2_configure_channel(ch->addr, CAT_CT_VAL_SYNC, is_tx, + ch->dbr_addr, ch->dbr_size, 0, true); + + return DIM_NO_ERROR; +} + +u8 DIM_DestroyChannel(struct dim_channel *ch) +{ + if (!g.dim_is_initialized || !ch) + return DIM_ERR_DRIVER_NOT_INITIALIZED; + + dim2_clear_channel(ch->addr); + if (ch->dbr_addr < DBR_SIZE) + free_dbr(ch->dbr_addr, ch->dbr_size); + ch->dbr_addr = DBR_SIZE; + + return DIM_NO_ERROR; +} + +void DIM_ServiceIrq(struct dim_channel *const *channels) +{ + bool state_changed; + + if (!g.dim_is_initialized) { + dim_on_error(DIM_ERR_DRIVER_NOT_INITIALIZED, + "DIM is not initialized"); + return; + } + + if (!channels) { + dim_on_error(DIM_ERR_DRIVER_NOT_INITIALIZED, "Bad channels"); + return; + } + + /* + * Use while-loop and a flag to make sure the age is changed back at least once, + * otherwise the interrupt may never come if CPU generates interrupt on changing age. + * + * This cycle runs not more than number of channels, because service_interrupts + * routine doesn't start the channel again. + */ + do { + struct dim_channel *const *ch = channels; + + state_changed = false; + + while (*ch) { + state_changed |= channel_service_interrupt(*ch); + ++ch; + } + } while (state_changed); + + /* clear pending Interrupts */ + DIMCB_IoWrite(&g.dim2->MS0, 0); + DIMCB_IoWrite(&g.dim2->MS1, 0); +} + +u8 DIM_ServiceChannel(struct dim_channel *ch) +{ + if (!g.dim_is_initialized || !ch) + return DIM_ERR_DRIVER_NOT_INITIALIZED; + + return channel_service(ch); +} + +struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, + struct dim_ch_state_t *state_ptr) +{ + if (!ch || !state_ptr) + return 0; + + state_ptr->ready = ch->state.level < 2; + state_ptr->done_buffers = ch->done_sw_buffers_number; + + return state_ptr; +} + +bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, u16 buffer_size) +{ + if (!ch) + return dim_on_error(DIM_ERR_DRIVER_NOT_INITIALIZED, "Bad channel"); + + return channel_start(ch, buffer_addr, buffer_size); +} + +bool DIM_DetachBuffers(struct dim_channel *ch, u16 buffers_number) +{ + if (!ch) + return dim_on_error(DIM_ERR_DRIVER_NOT_INITIALIZED, "Bad channel"); + + return channel_detach_buffers(ch, buffers_number); +} + +u32 DIM_ReadRegister(u8 register_index) +{ + return DIMCB_IoRead((u32 *)g.dim2 + register_index); +} diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h new file mode 100644 index 000000000000..d88b5a0e3244 --- /dev/null +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -0,0 +1,124 @@ +/* + * dim2_hal.h - DIM2 HAL interface + * (MediaLB, Device Interface Macro IP, OS62420) + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#ifndef _DIM2_HAL_H +#define _DIM2_HAL_H + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The values below are specified in the hardware specification. + * So, they should not be changed until the hardware specification changes. + */ +enum mlb_clk_speed { + CLK_256FS = 0, + CLK_512FS = 1, + CLK_1024FS = 2, + CLK_2048FS = 3, + CLK_3072FS = 4, + CLK_4096FS = 5, + CLK_6144FS = 6, + CLK_8192FS = 7, +}; + +struct dim_ch_state_t { + bool ready; /* Shows readiness to enqueue next buffer */ + u16 done_buffers; /* Number of completed buffers */ +}; + +typedef int atomic_counter_t; + +struct int_ch_state { + /* changed only in interrupt context */ + volatile atomic_counter_t request_counter; + + /* changed only in task context */ + volatile atomic_counter_t service_counter; + + u8 idx1; + u8 idx2; + u8 level; /* [0..2], buffering level */ +}; + +struct dim_channel { + struct int_ch_state state; + u8 addr; + u16 dbr_addr; + u16 dbr_size; + u16 packet_length; /*< Isochronous packet length in bytes. */ + u16 bytes_per_frame; /*< Synchronous bytes per frame. */ + u16 done_sw_buffers_number; /*< Done software buffers number. */ +}; + + +u8 DIM_Startup(void *dim_base_address, u32 mlb_clock); + +void DIM_Shutdown(void); + +bool DIM_GetLockState(void); + +u16 DIM_NormCtrlAsyncBufferSize(u16 buf_size); + +u16 DIM_NormIsocBufferSize(u16 buf_size, u16 packet_length); + +u16 DIM_NormSyncBufferSize(u16 buf_size, u16 bytes_per_frame); + +u8 DIM_InitControl(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 max_buffer_size); + +u8 DIM_InitAsync(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 max_buffer_size); + +u8 DIM_InitIsoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 packet_length); + +u8 DIM_InitSync(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 bytes_per_frame); + +u8 DIM_DestroyChannel(struct dim_channel *ch); + +void DIM_ServiceIrq(struct dim_channel *const *channels); + +u8 DIM_ServiceChannel(struct dim_channel *ch); + +struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, + struct dim_ch_state_t *dim_ch_state_ptr); + +bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, + u16 buffer_size); + +bool DIM_DetachBuffers(struct dim_channel *ch, u16 buffers_number); + +u32 DIM_ReadRegister(u8 register_index); + + +extern u32 DIMCB_IoRead(u32 *ptr32); + +extern void DIMCB_IoWrite(u32 *ptr32, u32 value); + +extern void DIMCB_OnError(u8 error_id, const char *error_message); + +extern void DIMCB_OnFail(const char *filename, int linenum); + + +#ifdef __cplusplus +} +#endif + +#endif /* _DIM2_HAL_H */ diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c new file mode 100644 index 000000000000..6a5a3a2775f3 --- /dev/null +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -0,0 +1,964 @@ +/* + * dim2_hdm.c - MediaLB DIM2 Hardware Dependent Module + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "dim2_hal.h" +#include "dim2_hdm.h" +#include "dim2_errors.h" +#include "dim2_sysfs.h" + +#define DMA_CHANNELS (32 - 1) /* channel 0 is a system channel */ + +#define MAX_BUFFERS_PACKET 32 +#define MAX_BUFFERS_STREAMING 32 +#define MAX_BUF_SIZE_PACKET 2048 +#define MAX_BUF_SIZE_STREAMING (8*1024) + +/* command line parameter to select clock speed */ +static char *clock_speed; +module_param(clock_speed, charp, 0); +MODULE_PARM_DESC(clock_speed, "MediaLB Clock Speed"); + +/* + * ############################################################################# + * + * The define below activates an utility function used by HAL-simu + * for calling DIM interrupt handler. + * It is used only for TEST PURPOSE and shall be commented before release. + * + * ############################################################################# + */ +/* #define ENABLE_HDM_TEST */ + +static DEFINE_SPINLOCK(dim_lock); + +static void dim2_tasklet_fn(unsigned long data); +static DECLARE_TASKLET(dim2_tasklet, dim2_tasklet_fn, 0); + +/** + * struct hdm_channel - private structure to keep channel specific data + * @is_initialized: identifier to know whether the channel is initialized + * @ch: HAL specific channel data + * @pending_list: list to keep MBO's before starting transfer + * @started_list: list to keep MBO's after starting transfer + * @direction: channel direction (TX or RX) + * @data_type: channel data type + */ +struct hdm_channel { + char name[sizeof "caNNN"]; + bool is_initialized; + struct dim_channel ch; + struct list_head pending_list; /* before DIM_EnqueueBuffer() */ + struct list_head started_list; /* after DIM_EnqueueBuffer() */ + enum most_channel_direction direction; + enum most_channel_data_type data_type; +}; + +/** + * struct dim2_hdm - private structure to keep interface specific data + * @hch: an array of channel specific data + * @most_iface: most interface structure + * @capabilities: an array of channel capability data + * @io_base: I/O register base address + * @irq_ahb0: dim2 AHB0 irq number + * @clk_speed: user selectable (through command line parameter) clock speed + * @netinfo_task: thread to deliver network status + * @netinfo_waitq: waitq for the thread to sleep + * @deliver_netinfo: to identify whether network status received + * @mac_addrs: INIC mac address + * @link_state: network link state + * @atx_idx: index of async tx channel + */ +struct dim2_hdm { + struct hdm_channel hch[DMA_CHANNELS]; + struct most_channel_capability capabilities[DMA_CHANNELS]; + struct most_interface most_iface; + char name[16 + sizeof "dim2-"]; + void *io_base; + unsigned int irq_ahb0; + int clk_speed; + struct task_struct *netinfo_task; + wait_queue_head_t netinfo_waitq; + int deliver_netinfo; + unsigned char mac_addrs[6]; + unsigned char link_state; + int atx_idx; + struct medialb_bus bus; +}; + +#define iface_to_hdm(iface) container_of(iface, struct dim2_hdm, most_iface) + +/* Macro to identify a network status message */ +#define PACKET_IS_NET_INFO(p) \ + (((p)[1] == 0x18) && ((p)[2] == 0x05) && ((p)[3] == 0x0C) && \ + ((p)[13] == 0x3C) && ((p)[14] == 0x00) && ((p)[15] == 0x0A)) + +#if defined(ENABLE_HDM_TEST) +static struct dim2_hdm *test_dev; +#endif + +bool dim2_sysfs_get_state_cb(void) +{ + bool state; + unsigned long flags; + + spin_lock_irqsave(&dim_lock, flags); + state = DIM_GetLockState(); + spin_unlock_irqrestore(&dim_lock, flags); + + return state; +} + +/** + * DIMCB_IoRead - callback from HAL to read an I/O register + * @ptr32: register address + */ +u32 DIMCB_IoRead(u32 *ptr32) +{ + return __raw_readl(ptr32); +} + +/** + * DIMCB_IoWrite - callback from HAL to write value to an I/O register + * @ptr32: register address + * @value: value to write + */ +void DIMCB_IoWrite(u32 *ptr32, u32 value) +{ + __raw_writel(value, ptr32); +} + +/** + * DIMCB_OnError - callback from HAL to report miscommunication between + * HDM and HAL + * @error_id: Error ID + * @error_message: Error message. Some text in a free format + */ +void DIMCB_OnError(u8 error_id, const char *error_message) +{ + pr_err("DIMCB_OnError: error_id - %d, error_message - %s\n", error_id, + error_message); +} + +/** + * DIMCB_OnFail - callback from HAL to report unrecoverable errors + * @filename: Source file where the error happened + * @linenum: Line number of the file where the error happened + */ +void DIMCB_OnFail(const char *filename, int linenum) +{ + pr_err("DIMCB_OnFail: file - %s, line no. - %d\n", filename, linenum); +} + +/** + * startup_dim - initialize the dim2 interface + * @pdev: platform device + * + * Get the value of command line parameter "clock_speed" if given or use the + * default value, enable the clock and PLL, and initialize the dim2 interface. + */ +static int startup_dim(struct platform_device *pdev) +{ + struct dim2_hdm *dev = platform_get_drvdata(pdev); + struct dim2_platform_data *pdata = pdev->dev.platform_data; + u8 hal_ret; + + dev->clk_speed = -1; + + if (clock_speed) { + if (!strcmp(clock_speed, "256fs")) + dev->clk_speed = CLK_256FS; + else if (!strcmp(clock_speed, "512fs")) + dev->clk_speed = CLK_512FS; + else if (!strcmp(clock_speed, "1024fs")) + dev->clk_speed = CLK_1024FS; + else if (!strcmp(clock_speed, "2048fs")) + dev->clk_speed = CLK_2048FS; + else if (!strcmp(clock_speed, "3072fs")) + dev->clk_speed = CLK_3072FS; + else if (!strcmp(clock_speed, "4096fs")) + dev->clk_speed = CLK_4096FS; + else if (!strcmp(clock_speed, "6144fs")) + dev->clk_speed = CLK_6144FS; + else if (!strcmp(clock_speed, "8192fs")) + dev->clk_speed = CLK_8192FS; + } + + if (dev->clk_speed == -1) { + pr_info("Bad or missing clock speed parameter," + " using default value: 3072fs\n"); + dev->clk_speed = CLK_3072FS; + } else + pr_info("Selected clock speed: %s\n", clock_speed); + + if (pdata && pdata->init) { + int ret = pdata->init(pdata, dev->io_base, dev->clk_speed); + + if (ret) + return ret; + } + + hal_ret = DIM_Startup(dev->io_base, dev->clk_speed); + if (hal_ret != DIM_NO_ERROR) { + pr_err("DIM_Startup failed: %d\n", hal_ret); + if (pdata && pdata->destroy) + pdata->destroy(pdata); + return -ENODEV; + } + + return 0; +} + +/** + * try_start_dim_transfer - try to transfer a buffer on a channel + * @hdm_ch: channel specific data + * + * Transfer a buffer from pending_list if the channel is ready + */ +static int try_start_dim_transfer(struct hdm_channel *hdm_ch) +{ + u16 buf_size; + struct list_head *head = &hdm_ch->pending_list; + struct mbo *mbo; + unsigned long flags; + struct dim_ch_state_t st; + + BUG_ON(hdm_ch == 0); + BUG_ON(!hdm_ch->is_initialized); + + spin_lock_irqsave(&dim_lock, flags); + if (list_empty(head)) { + spin_unlock_irqrestore(&dim_lock, flags); + return -EAGAIN; + } + + if (!DIM_GetChannelState(&hdm_ch->ch, &st)->ready) { + spin_unlock_irqrestore(&dim_lock, flags); + return -EAGAIN; + } + + mbo = list_entry(head->next, struct mbo, list); + buf_size = mbo->buffer_length; + + BUG_ON(mbo->bus_address == 0); + if (!DIM_EnqueueBuffer(&hdm_ch->ch, mbo->bus_address, buf_size)) { + list_del(head->next); + spin_unlock_irqrestore(&dim_lock, flags); + mbo->processed_length = 0; + mbo->status = MBO_E_INVAL; + mbo->complete(mbo); + return -EFAULT; + } + + list_move_tail(head->next, &hdm_ch->started_list); + spin_unlock_irqrestore(&dim_lock, flags); + + return 0; +} + +/** + * deliver_netinfo_thread - thread to deliver network status to mostcore + * @data: private data + * + * Wait for network status and deliver it to mostcore once it is received + */ +static int deliver_netinfo_thread(void *data) +{ + struct dim2_hdm *dev = (struct dim2_hdm *)data; + + while (!kthread_should_stop()) { + wait_event_interruptible(dev->netinfo_waitq, + dev->deliver_netinfo || + kthread_should_stop()); + + if (dev->deliver_netinfo) { + dev->deliver_netinfo--; + most_deliver_netinfo(&dev->most_iface, dev->link_state, + dev->mac_addrs); + } + } + + return 0; +} + +/** + * retrieve_netinfo - retrieve network status from received buffer + * @dev: private data + * @mbo: received MBO + * + * Parse the message in buffer and get node address, link state, MAC address. + * Wake up a thread to deliver this status to mostcore + */ +static void retrieve_netinfo(struct dim2_hdm *dev, struct mbo *mbo) +{ + u8 *data = mbo->virt_address; + u8 *mac = dev->mac_addrs; + + pr_info("Node Address: 0x%03x\n", (u16)data[16] << 8 | data[17]); + dev->link_state = data[18]; + pr_info("NIState: %d\n", dev->link_state); + memcpy(mac, data + 19, 6); + pr_info("MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + dev->deliver_netinfo++; + wake_up_interruptible(&dev->netinfo_waitq); +} + +/** + * service_done_flag - handle completed buffers + * @dev: private data + * @ch_idx: channel index + * + * Return back the completed buffers to mostcore, using completion callback + */ +static void service_done_flag(struct dim2_hdm *dev, int ch_idx) +{ + struct hdm_channel *hdm_ch = dev->hch + ch_idx; + struct dim_ch_state_t st; + struct list_head *head; + struct mbo *mbo; + int done_buffers; + unsigned long flags; + u8 *data; + + BUG_ON(hdm_ch == 0); + BUG_ON(!hdm_ch->is_initialized); + + spin_lock_irqsave(&dim_lock, flags); + + done_buffers = DIM_GetChannelState(&hdm_ch->ch, &st)->done_buffers; + if (!done_buffers) { + spin_unlock_irqrestore(&dim_lock, flags); + return; + } + + if (!DIM_DetachBuffers(&hdm_ch->ch, done_buffers)) { + spin_unlock_irqrestore(&dim_lock, flags); + return; + } + spin_unlock_irqrestore(&dim_lock, flags); + + head = &hdm_ch->started_list; + + while (done_buffers) { + spin_lock_irqsave(&dim_lock, flags); + if (list_empty(head)) { + spin_unlock_irqrestore(&dim_lock, flags); + pr_crit("hard error: started_mbo list is empty " + "whereas DIM2 has sent buffers\n"); + break; + } + + mbo = list_entry(head->next, struct mbo, list); + list_del(head->next); + spin_unlock_irqrestore(&dim_lock, flags); + + data = mbo->virt_address; + + if (hdm_ch->data_type == MOST_CH_ASYNC && + hdm_ch->direction == MOST_CH_RX && + PACKET_IS_NET_INFO(data)) { + + retrieve_netinfo(dev, mbo); + + spin_lock_irqsave(&dim_lock, flags); + list_add_tail(&mbo->list, &hdm_ch->pending_list); + spin_unlock_irqrestore(&dim_lock, flags); + } else { + if (hdm_ch->data_type == MOST_CH_CONTROL || + hdm_ch->data_type == MOST_CH_ASYNC) { + + u32 const data_size = + (u32)data[0] * 256 + data[1] + 2; + + mbo->processed_length = + min(data_size, (u32)mbo->buffer_length); + } else { + mbo->processed_length = mbo->buffer_length; + } + mbo->status = MBO_SUCCESS; + mbo->complete(mbo); + } + + done_buffers--; + } +} + +static struct dim_channel **get_active_channels(struct dim2_hdm *dev, + struct dim_channel **buffer) +{ + int idx = 0; + int ch_idx; + + for (ch_idx = 0; ch_idx < DMA_CHANNELS; ch_idx++) { + if (dev->hch[ch_idx].is_initialized) + buffer[idx++] = &dev->hch[ch_idx].ch; + } + buffer[idx++] = 0; + + return buffer; +} + +/** + * dim2_tasklet_fn - tasklet function + * @data: private data + * + * Service each initialized channel, if needed + */ +static void dim2_tasklet_fn(unsigned long data) +{ + struct dim2_hdm *dev = (struct dim2_hdm *)data; + unsigned long flags; + int ch_idx; + + for (ch_idx = 0; ch_idx < DMA_CHANNELS; ch_idx++) { + if (!dev->hch[ch_idx].is_initialized) + continue; + + spin_lock_irqsave(&dim_lock, flags); + DIM_ServiceChannel(&(dev->hch[ch_idx].ch)); + spin_unlock_irqrestore(&dim_lock, flags); + + service_done_flag(dev, ch_idx); + while (!try_start_dim_transfer(dev->hch + ch_idx)) + continue; + } +} + +/** + * dim2_ahb_isr - interrupt service routine + * @irq: irq number + * @_dev: private data + * + * Acknowledge the interrupt and schedule a tasklet to service channels. + * Return IRQ_HANDLED. + */ +static irqreturn_t dim2_ahb_isr(int irq, void *_dev) +{ + struct dim2_hdm *dev = (struct dim2_hdm *)_dev; + struct dim_channel *buffer[DMA_CHANNELS + 1]; + unsigned long flags; + + spin_lock_irqsave(&dim_lock, flags); + DIM_ServiceIrq(get_active_channels(dev, buffer)); + spin_unlock_irqrestore(&dim_lock, flags); + +#if !defined(ENABLE_HDM_TEST) + dim2_tasklet.data = (unsigned long)dev; + tasklet_schedule(&dim2_tasklet); +#else + dim2_tasklet_fn((unsigned long)dev); +#endif + return IRQ_HANDLED; +} + +#if defined(ENABLE_HDM_TEST) + +/* + * Utility function used by HAL-simu for calling DIM interrupt handler. + * It is used only for TEST PURPOSE. + */ +void raise_dim_interrupt(void) +{ + (void)dim2_ahb_isr(0, test_dev); +} +#endif + +/** + * complete_all_mbos - complete MBO's in a list + * @head: list head + * + * Delete all the entries in list and return back MBO's to mostcore using + * completion call back. + */ +static void complete_all_mbos(struct list_head *head) +{ + unsigned long flags; + struct mbo *mbo; + + for (;;) { + spin_lock_irqsave(&dim_lock, flags); + if (list_empty(head)) { + spin_unlock_irqrestore(&dim_lock, flags); + break; + } + + mbo = list_entry(head->next, struct mbo, list); + list_del(head->next); + spin_unlock_irqrestore(&dim_lock, flags); + + mbo->processed_length = 0; + mbo->status = MBO_E_CLOSE; + mbo->complete(mbo); + } +} + +/** + * configure_channel - initialize a channel + * @iface: interface the channel belongs to + * @channel: channel to be configured + * @channel_config: structure that holds the configuration information + * + * Receives configuration information from mostcore and initialize + * the corresponding channel. Return 0 on success, negative on failure. + */ +static int configure_channel(struct most_interface *most_iface, int ch_idx, + struct most_channel_config *ccfg) +{ + struct dim2_hdm *dev = iface_to_hdm(most_iface); + bool const is_tx = ccfg->direction == MOST_CH_TX; + u16 const sub_size = ccfg->subbuffer_size; + u16 const buf_size = ccfg->buffer_size; + u16 new_size; + unsigned long flags; + u8 hal_ret; + int const ch_addr = ch_idx * 2 + 2; + struct hdm_channel *const hdm_ch = dev->hch + ch_idx; + + BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS); + + if (hdm_ch->is_initialized) + return -EPERM; + + switch (ccfg->data_type) { + case MOST_CH_CONTROL: + new_size = DIM_NormCtrlAsyncBufferSize(buf_size); + if (new_size == 0) { + pr_err("%s: too small buffer size\n", hdm_ch->name); + return -EINVAL; + } + ccfg->buffer_size = new_size; + if (new_size != buf_size) + pr_warn("%s: fixed buffer size (%d -> %d)\n", + hdm_ch->name, buf_size, new_size); + spin_lock_irqsave(&dim_lock, flags); + hal_ret = DIM_InitControl(&hdm_ch->ch, is_tx, ch_addr, buf_size); + break; + case MOST_CH_ASYNC: + new_size = DIM_NormCtrlAsyncBufferSize(buf_size); + if (new_size == 0) { + pr_err("%s: too small buffer size\n", hdm_ch->name); + return -EINVAL; + } + ccfg->buffer_size = new_size; + if (new_size != buf_size) + pr_warn("%s: fixed buffer size (%d -> %d)\n", + hdm_ch->name, buf_size, new_size); + spin_lock_irqsave(&dim_lock, flags); + hal_ret = DIM_InitAsync(&hdm_ch->ch, is_tx, ch_addr, buf_size); + break; + case MOST_CH_ISOC_AVP: + new_size = DIM_NormIsocBufferSize(buf_size, sub_size); + if (new_size == 0) { + pr_err("%s: invalid sub-buffer size or " + "too small buffer size\n", hdm_ch->name); + return -EINVAL; + } + ccfg->buffer_size = new_size; + if (new_size != buf_size) + pr_warn("%s: fixed buffer size (%d -> %d)\n", + hdm_ch->name, buf_size, new_size); + spin_lock_irqsave(&dim_lock, flags); + hal_ret = DIM_InitIsoc(&hdm_ch->ch, is_tx, ch_addr, sub_size); + break; + case MOST_CH_SYNC: + new_size = DIM_NormSyncBufferSize(buf_size, sub_size); + if (new_size == 0) { + pr_err("%s: invalid sub-buffer size or " + "too small buffer size\n", hdm_ch->name); + return -EINVAL; + } + ccfg->buffer_size = new_size; + if (new_size != buf_size) + pr_warn("%s: fixed buffer size (%d -> %d)\n", + hdm_ch->name, buf_size, new_size); + spin_lock_irqsave(&dim_lock, flags); + hal_ret = DIM_InitSync(&hdm_ch->ch, is_tx, ch_addr, sub_size); + break; + default: + pr_err("%s: configure failed, bad channel type: %d\n", + hdm_ch->name, ccfg->data_type); + return -EINVAL; + } + + if (hal_ret != DIM_NO_ERROR) { + spin_unlock_irqrestore(&dim_lock, flags); + pr_err("%s: configure failed (%d), type: %d, is_tx: %d\n", + hdm_ch->name, hal_ret, ccfg->data_type, (int)is_tx); + return -ENODEV; + } + + hdm_ch->data_type = ccfg->data_type; + hdm_ch->direction = ccfg->direction; + hdm_ch->is_initialized = true; + + if (hdm_ch->data_type == MOST_CH_ASYNC && + hdm_ch->direction == MOST_CH_TX && + dev->atx_idx < 0) + dev->atx_idx = ch_idx; + + spin_unlock_irqrestore(&dim_lock, flags); + + return 0; +} + +/** + * enqueue - enqueue a buffer for data transfer + * @iface: intended interface + * @channel: ID of the channel the buffer is intended for + * @mbo: pointer to the buffer object + * + * Push the buffer into pending_list and try to transfer one buffer from + * pending_list. Return 0 on success, negative on failure. + */ +static int enqueue(struct most_interface *most_iface, int ch_idx, + struct mbo *mbo) +{ + struct dim2_hdm *dev = iface_to_hdm(most_iface); + struct hdm_channel *hdm_ch = dev->hch + ch_idx; + unsigned long flags; + + BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS); + + if (!hdm_ch->is_initialized) + return -EPERM; + + if (mbo->bus_address == 0) + return -EFAULT; + + spin_lock_irqsave(&dim_lock, flags); + list_add_tail(&mbo->list, &hdm_ch->pending_list); + spin_unlock_irqrestore(&dim_lock, flags); + + (void)try_start_dim_transfer(hdm_ch); + + return 0; +} + +/** + * request_netinfo - triggers retrieving of network info + * @iface: pointer to the interface + * @channel_id: corresponding channel ID + * + * Send a command to INIC which triggers retrieving of network info by means of + * "Message exchange over MDP/MEP". Return 0 on success, negative on failure. + */ +static void request_netinfo(struct most_interface *most_iface, int ch_idx) +{ + struct dim2_hdm *dev = iface_to_hdm(most_iface); + struct mbo *mbo; + u8 *data; + + if (dev->atx_idx < 0) { + pr_err("Async Tx Not initialized\n"); + return; + } + + mbo = most_get_mbo(&dev->most_iface, dev->atx_idx); + if (!mbo) + return; + + mbo->buffer_length = 5; + + data = mbo->virt_address; + + data[0] = 0x00; /* PML High byte */ + data[1] = 0x03; /* PML Low byte */ + data[2] = 0x02; /* PMHL */ + data[3] = 0x08; /* FPH */ + data[4] = 0x40; /* FMF (FIFO cmd msg - Triggers NAOverMDP) */ + + most_submit_mbo(mbo); +} + +/** + * poison_channel - poison buffers of a channel + * @iface: pointer to the interface the channel to be poisoned belongs to + * @channel_id: corresponding channel ID + * + * Destroy a channel and complete all the buffers in both started_list & + * pending_list. Return 0 on success, negative on failure. + */ +static int poison_channel(struct most_interface *most_iface, int ch_idx) +{ + struct dim2_hdm *dev = iface_to_hdm(most_iface); + struct hdm_channel *hdm_ch = dev->hch + ch_idx; + unsigned long flags; + u8 hal_ret; + int ret = 0; + + BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS); + + if (!hdm_ch->is_initialized) + return -EPERM; + + spin_lock_irqsave(&dim_lock, flags); + hal_ret = DIM_DestroyChannel(&hdm_ch->ch); + hdm_ch->is_initialized = false; + if (ch_idx == dev->atx_idx) + dev->atx_idx = -1; + spin_unlock_irqrestore(&dim_lock, flags); + if (hal_ret != DIM_NO_ERROR) { + pr_err("HAL Failed to close channel %s\n", hdm_ch->name); + ret = -EFAULT; + } + + complete_all_mbos(&hdm_ch->started_list); + complete_all_mbos(&hdm_ch->pending_list); + + return ret; +} + +/* + * dim2_probe - dim2 probe handler + * @pdev: platform device structure + * + * Register the dim2 interface with mostcore and initialize it. + * Return 0 on success, negative on failure. + */ +static int dim2_probe(struct platform_device *pdev) +{ + struct dim2_hdm *dev; + struct resource *res; + int ret, i; + struct kobject *kobj; + + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (!dev) + return -ENOMEM; + + dev->atx_idx = -1; + + platform_set_drvdata(pdev, dev); +#if defined(ENABLE_HDM_TEST) + test_dev = dev; +#else + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + pr_err("no memory region defined\n"); + ret = -ENOENT; + goto err_free_dev; + } + + if (!request_mem_region(res->start, resource_size(res), pdev->name)) { + pr_err("failed to request mem region\n"); + ret = -EBUSY; + goto err_free_dev; + } + + dev->io_base = ioremap(res->start, resource_size(res)); + if (!dev->io_base) { + pr_err("failed to ioremap\n"); + ret = -ENOMEM; + goto err_release_mem; + } + + ret = platform_get_irq(pdev, 0); + if (ret < 0) { + pr_err("failed to get irq\n"); + goto err_unmap_io; + } + dev->irq_ahb0 = ret; + + ret = request_irq(dev->irq_ahb0, dim2_ahb_isr, 0, "mlb_ahb0", dev); + if (ret) { + pr_err("failed to request IRQ: %d, err: %d\n", dev->irq_ahb0, ret); + goto err_unmap_io; + } +#endif + init_waitqueue_head(&dev->netinfo_waitq); + dev->deliver_netinfo = 0; + dev->netinfo_task = kthread_run(&deliver_netinfo_thread, (void *)dev, + "dim2_netinfo"); + if (IS_ERR(dev->netinfo_task)) { + ret = PTR_ERR(dev->netinfo_task); + goto err_free_irq; + } + + for (i = 0; i < DMA_CHANNELS; i++) { + struct most_channel_capability *cap = dev->capabilities + i; + struct hdm_channel *hdm_ch = dev->hch + i; + + INIT_LIST_HEAD(&hdm_ch->pending_list); + INIT_LIST_HEAD(&hdm_ch->started_list); + hdm_ch->is_initialized = false; + snprintf(hdm_ch->name, sizeof(hdm_ch->name), "ca%d", i * 2 + 2); + + cap->name_suffix = hdm_ch->name; + cap->direction = MOST_CH_RX | MOST_CH_TX; + cap->data_type = MOST_CH_CONTROL | MOST_CH_ASYNC | + MOST_CH_ISOC_AVP | MOST_CH_SYNC; + cap->num_buffers_packet = MAX_BUFFERS_PACKET; + cap->buffer_size_packet = MAX_BUF_SIZE_PACKET; + cap->num_buffers_streaming = MAX_BUFFERS_STREAMING; + cap->buffer_size_streaming = MAX_BUF_SIZE_STREAMING; + } + + { + const char *fmt; + + if (sizeof(res->start) == sizeof(long long)) + fmt = "dim2-%016llx"; + else if (sizeof(res->start) == sizeof(long)) + fmt = "dim2-%016lx"; + else + fmt = "dim2-%016x"; + + snprintf(dev->name, sizeof(dev->name), fmt, res->start); + } + + dev->most_iface.interface = ITYPE_MEDIALB_DIM2; + dev->most_iface.description = dev->name; + dev->most_iface.num_channels = DMA_CHANNELS; + dev->most_iface.channel_vector = dev->capabilities; + dev->most_iface.configure = configure_channel; + dev->most_iface.enqueue = enqueue; + dev->most_iface.poison_channel = poison_channel; + dev->most_iface.request_netinfo = request_netinfo; + + kobj = most_register_interface(&dev->most_iface); + if (IS_ERR(kobj)) { + ret = PTR_ERR(kobj); + pr_err("failed to register MOST interface\n"); + goto err_stop_thread; + } + + ret = dim2_sysfs_probe(&dev->bus, kobj); + if (ret) + goto err_unreg_iface; + + ret = startup_dim(pdev); + if (ret) { + pr_err("failed to initialize DIM2\n"); + goto err_destroy_bus; + } + + return 0; + +err_destroy_bus: + dim2_sysfs_destroy(&dev->bus); +err_unreg_iface: + most_deregister_interface(&dev->most_iface); +err_stop_thread: + kthread_stop(dev->netinfo_task); +err_free_irq: +#if !defined(ENABLE_HDM_TEST) + free_irq(dev->irq_ahb0, dev); +err_unmap_io: + iounmap(dev->io_base); +err_release_mem: + release_mem_region(res->start, resource_size(res)); +err_free_dev: +#endif + kfree(dev); + + return ret; +} + +/** + * dim2_remove - dim2 remove handler + * @pdev: platform device structure + * + * Unregister the interface from mostcore + */ +static int dim2_remove(struct platform_device *pdev) +{ + struct dim2_hdm *dev = platform_get_drvdata(pdev); + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct dim2_platform_data *pdata = pdev->dev.platform_data; + unsigned long flags; + + spin_lock_irqsave(&dim_lock, flags); + DIM_Shutdown(); + spin_unlock_irqrestore(&dim_lock, flags); + + if (pdata && pdata->destroy) + pdata->destroy(pdata); + + dim2_sysfs_destroy(&dev->bus); + most_deregister_interface(&dev->most_iface); + kthread_stop(dev->netinfo_task); +#if !defined(ENABLE_HDM_TEST) + free_irq(dev->irq_ahb0, dev); + iounmap(dev->io_base); + release_mem_region(res->start, resource_size(res)); +#endif + kfree(dev); + platform_set_drvdata(pdev, NULL); + + /* + * break link to local platform_device_id struct + * to prevent crash by unload platform device module + */ + pdev->id_entry = 0; + + return 0; +} + +static struct platform_device_id dim2_id[] = { + { "medialb_dim2" }, + { }, /* Terminating entry */ +}; + +MODULE_DEVICE_TABLE(platform, dim2_id); + +static struct platform_driver dim2_driver = { + .probe = dim2_probe, + .remove = dim2_remove, + .id_table = dim2_id, + .driver = { + .name = "hdm_dim2", + .owner = THIS_MODULE, + }, +}; + +/** + * dim2_hdm_init - Driver Registration Routine + */ +static int __init dim2_hdm_init(void) +{ + pr_info("dim2_hdm_init()\n"); + return platform_driver_register(&dim2_driver); +} + +/** + * dim2_hdm_exit - Driver Cleanup Routine + **/ +static void __exit dim2_hdm_exit(void) +{ + pr_info("dim2_hdm_exit()\n"); + platform_driver_unregister(&dim2_driver); +} + +module_init(dim2_hdm_init); +module_exit(dim2_hdm_exit); + +MODULE_AUTHOR("Jain Roy Ambi "); +MODULE_AUTHOR("Andrey Shvetsov "); +MODULE_DESCRIPTION("MediaLB DIM2 Hardware Dependent Module"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.h b/drivers/staging/most/hdm-dim2/dim2_hdm.h new file mode 100644 index 000000000000..6e6883232809 --- /dev/null +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.h @@ -0,0 +1,26 @@ +/* + * dim2_hdm.h - MediaLB DIM2 HDM Header + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#ifndef DIM2_HDM_H +#define DIM2_HDM_H + +struct device; + +/* platform dependent data for dim2 interface */ +struct dim2_platform_data { + int (*init)(struct dim2_platform_data *pd, void *io_base, int clk_speed); + void (*destroy)(struct dim2_platform_data *pd); + void *priv; +}; + +#endif /* DIM2_HDM_H */ diff --git a/drivers/staging/most/hdm-dim2/dim2_reg.h b/drivers/staging/most/hdm-dim2/dim2_reg.h new file mode 100644 index 000000000000..476f66f4c566 --- /dev/null +++ b/drivers/staging/most/hdm-dim2/dim2_reg.h @@ -0,0 +1,176 @@ +/* + * dim2_reg.h - Definitions for registers of DIM2 + * (MediaLB, Device Interface Macro IP, OS62420) + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#ifndef DIM2_OS62420_H +#define DIM2_OS62420_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +struct dim2_regs { + /* 0x00 */ u32 MLBC0; + /* 0x01 */ u32 rsvd0[1]; + /* 0x02 */ u32 MLBPC0; + /* 0x03 */ u32 MS0; + /* 0x04 */ u32 rsvd1[1]; + /* 0x05 */ u32 MS1; + /* 0x06 */ u32 rsvd2[2]; + /* 0x08 */ u32 MSS; + /* 0x09 */ u32 MSD; + /* 0x0A */ u32 rsvd3[1]; + /* 0x0B */ u32 MIEN; + /* 0x0C */ u32 rsvd4[1]; + /* 0x0D */ u32 MLBPC2; + /* 0x0E */ u32 MLBPC1; + /* 0x0F */ u32 MLBC1; + /* 0x10 */ u32 rsvd5[0x10]; + /* 0x20 */ u32 HCTL; + /* 0x21 */ u32 rsvd6[1]; + /* 0x22 */ u32 HCMR0; + /* 0x23 */ u32 HCMR1; + /* 0x24 */ u32 HCER0; + /* 0x25 */ u32 HCER1; + /* 0x26 */ u32 HCBR0; + /* 0x27 */ u32 HCBR1; + /* 0x28 */ u32 rsvd7[8]; + /* 0x30 */ u32 MDAT0; + /* 0x31 */ u32 MDAT1; + /* 0x32 */ u32 MDAT2; + /* 0x33 */ u32 MDAT3; + /* 0x34 */ u32 MDWE0; + /* 0x35 */ u32 MDWE1; + /* 0x36 */ u32 MDWE2; + /* 0x37 */ u32 MDWE3; + /* 0x38 */ u32 MCTL; + /* 0x39 */ u32 MADR; + /* 0x3A */ u32 rsvd8[0xB6]; + /* 0xF0 */ u32 ACTL; + /* 0xF1 */ u32 rsvd9[3]; + /* 0xF4 */ u32 ACSR0; + /* 0xF5 */ u32 ACSR1; + /* 0xF6 */ u32 ACMR0; + /* 0xF7 */ u32 ACMR1; +}; + + +#define DIM2_MASK(n) (~((~(u32)0)<<(n))) + +enum { + MLBC0_MLBLK_BIT = 7, + + MLBC0_MLBPEN_BIT = 5, + + MLBC0_MLBCLK_SHIFT = 2, + MLBC0_MLBCLK_VAL_256FS = 0, + MLBC0_MLBCLK_VAL_512FS = 1, + MLBC0_MLBCLK_VAL_1024FS = 2, + MLBC0_MLBCLK_VAL_2048FS = 3, + + MLBC0_FCNT_SHIFT = 15, + MLBC0_FCNT_MASK = 7, + MLBC0_FCNT_VAL_1FPSB = 0, + MLBC0_FCNT_VAL_2FPSB = 1, + MLBC0_FCNT_VAL_4FPSB = 2, + MLBC0_FCNT_VAL_8FPSB = 3, + MLBC0_FCNT_VAL_16FPSB = 4, + MLBC0_FCNT_VAL_32FPSB = 5, + MLBC0_FCNT_VAL_64FPSB = 6, + + MLBC0_MLBEN_BIT = 0, + + MIEN_CTX_BREAK_BIT = 29, + MIEN_CTX_PE_BIT = 28, + MIEN_CTX_DONE_BIT = 27, + + MIEN_CRX_BREAK_BIT = 26, + MIEN_CRX_PE_BIT = 25, + MIEN_CRX_DONE_BIT = 24, + + MIEN_ATX_BREAK_BIT = 22, + MIEN_ATX_PE_BIT = 21, + MIEN_ATX_DONE_BIT = 20, + + MIEN_ARX_BREAK_BIT = 19, + MIEN_ARX_PE_BIT = 18, + MIEN_ARX_DONE_BIT = 17, + + MIEN_SYNC_PE_BIT = 16, + + MIEN_ISOC_BUFO_BIT = 1, + MIEN_ISOC_PE_BIT = 0, + + MLBC1_NDA_SHIFT = 8, + MLBC1_NDA_MASK = 0xFF, + + MLBC1_CLKMERR_BIT = 7, + MLBC1_LOCKERR_BIT = 6, + + ACTL_DMA_MODE_BIT = 2, + ACTL_DMA_MODE_VAL_DMA_MODE_0 = 0, + ACTL_DMA_MODE_VAL_DMA_MODE_1 = 1, + ACTL_SCE_BIT = 0, + + HCTL_EN_BIT = 15 +}; + +enum { + CDT1_BS_ISOC_SHIFT = 0, + CDT1_BS_ISOC_MASK = DIM2_MASK(9), + + CDT3_BD_SHIFT = 0, + CDT3_BD_MASK = DIM2_MASK(12), + CDT3_BD_ISOC_MASK = DIM2_MASK(13), + CDT3_BA_SHIFT = 16, + + ADT0_CE_BIT = 15, + ADT0_LE_BIT = 14, + ADT0_PG_BIT = 13, + + ADT1_RDY_BIT = 15, + ADT1_DNE_BIT = 14, + ADT1_ERR_BIT = 13, + ADT1_PS_BIT = 12, + ADT1_MEP_BIT = 11, + ADT1_BD_SHIFT = 0, + ADT1_CTRL_ASYNC_BD_MASK = DIM2_MASK(11), + ADT1_ISOC_SYNC_BD_MASK = DIM2_MASK(13), + + CAT_MFE_BIT = 14, + + CAT_MT_BIT = 13, + + CAT_RNW_BIT = 12, + + CAT_CE_BIT = 11, + + CAT_CT_SHIFT = 8, + CAT_CT_VAL_SYNC = 0, + CAT_CT_VAL_CONTROL = 1, + CAT_CT_VAL_ASYNC = 2, + CAT_CT_VAL_ISOC = 3, + + CAT_CL_SHIFT = 0, + CAT_CL_MASK = DIM2_MASK(6) +}; + + +#ifdef __cplusplus +} +#endif + +#endif /* DIM2_OS62420_H */ diff --git a/drivers/staging/most/hdm-dim2/dim2_sysfs.c b/drivers/staging/most/hdm-dim2/dim2_sysfs.c new file mode 100644 index 000000000000..8e331a286fc3 --- /dev/null +++ b/drivers/staging/most/hdm-dim2/dim2_sysfs.c @@ -0,0 +1,116 @@ +/* + * dim2_sysfs.c - MediaLB sysfs information + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +/* Author: Andrey Shvetsov */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include "dim2_sysfs.h" + +struct bus_attr { + struct attribute attr; + ssize_t (*show)(struct medialb_bus *bus, char *buf); + ssize_t (*store)(struct medialb_bus *bus, const char *buf, size_t count); +}; + +static ssize_t state_show(struct medialb_bus *bus, char *buf) +{ + bool state = dim2_sysfs_get_state_cb(); + + return sprintf(buf, "%s\n", state ? "locked" : ""); +} + +static struct bus_attr state_attr = __ATTR_RO(state); + +static struct attribute *bus_default_attrs[] = { + &state_attr.attr, + NULL, +}; + +static struct attribute_group bus_attr_group = { + .attrs = bus_default_attrs, +}; + +static void bus_kobj_release(struct kobject *kobj) +{ +} + +static ssize_t bus_kobj_attr_show(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + struct medialb_bus *bus = + container_of(kobj, struct medialb_bus, kobj_group); + struct bus_attr *xattr = container_of(attr, struct bus_attr, attr); + + if (!xattr->show) + return -EIO; + + return xattr->show(bus, buf); +} + +static ssize_t bus_kobj_attr_store(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t count) +{ + ssize_t ret; + struct medialb_bus *bus = + container_of(kobj, struct medialb_bus, kobj_group); + struct bus_attr *xattr = container_of(attr, struct bus_attr, attr); + + if (!xattr->store) + return -EIO; + + ret = xattr->store(bus, buf, count); + return ret; +} + +static struct sysfs_ops const bus_kobj_sysfs_ops = { + .show = bus_kobj_attr_show, + .store = bus_kobj_attr_store, +}; + +static struct kobj_type bus_ktype = { + .release = bus_kobj_release, + .sysfs_ops = &bus_kobj_sysfs_ops, +}; + +int dim2_sysfs_probe(struct medialb_bus *bus, struct kobject *parent_kobj) +{ + int err; + + kobject_init(&bus->kobj_group, &bus_ktype); + err = kobject_add(&bus->kobj_group, parent_kobj, "bus"); + if (err) { + pr_err("kobject_add() failed: %d\n", err); + goto err_kobject_add; + } + + err = sysfs_create_group(&bus->kobj_group, &bus_attr_group); + if (err) { + pr_err("sysfs_create_group() failed: %d\n", err); + goto err_create_group; + } + + return 0; + +err_create_group: + kobject_put(&bus->kobj_group); + +err_kobject_add: + return err; +} + +void dim2_sysfs_destroy(struct medialb_bus *bus) +{ + kobject_put(&bus->kobj_group); +} diff --git a/drivers/staging/most/hdm-dim2/dim2_sysfs.h b/drivers/staging/most/hdm-dim2/dim2_sysfs.h new file mode 100644 index 000000000000..e719691035b0 --- /dev/null +++ b/drivers/staging/most/hdm-dim2/dim2_sysfs.h @@ -0,0 +1,39 @@ +/* + * dim2_sysfs.h - MediaLB sysfs information + * + * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +/* Author: Andrey Shvetsov */ + +#ifndef DIM2_SYSFS_H +#define DIM2_SYSFS_H + + +#include + + +struct medialb_bus { + struct kobject kobj_group; +}; + +struct dim2_hdm; + +int dim2_sysfs_probe(struct medialb_bus *bus, struct kobject *parent_kobj); +void dim2_sysfs_destroy(struct medialb_bus *bus); + +/* + * callback, + * must deliver MediaLB state as true if locked or false if unlocked + */ +bool dim2_sysfs_get_state_cb(void); + + +#endif /* DIM2_SYSFS_H */ From 91a450ada852f8cb5fc8b9c7242a856cc7b31643 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:54 +0200 Subject: [PATCH 489/912] Staging: most: add MOST driver's hdm-i2c module This patch adds the hdm-i2c module of the MOST driver to the kernel's driver staging area. This module is part of the MOST driver and handles the I2C interface of the MOST network interface controller. This patch is needed in order to use the I2C peripheral interface of the network interface controller. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/Kconfig | 2 + drivers/staging/most/Makefile | 1 + drivers/staging/most/hdm-i2c/Kconfig | 12 + drivers/staging/most/hdm-i2c/Makefile | 3 + drivers/staging/most/hdm-i2c/hdm_i2c.c | 451 +++++++++++++++++++++++++ 5 files changed, 469 insertions(+) create mode 100644 drivers/staging/most/hdm-i2c/Kconfig create mode 100644 drivers/staging/most/hdm-i2c/Makefile create mode 100644 drivers/staging/most/hdm-i2c/hdm_i2c.c diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig index 659c40261720..2a9f92669161 100644 --- a/drivers/staging/most/Kconfig +++ b/drivers/staging/most/Kconfig @@ -23,4 +23,6 @@ source "drivers/staging/most/aim-v4l2/Kconfig" source "drivers/staging/most/hdm-dim2/Kconfig" +source "drivers/staging/most/hdm-i2c/Kconfig" + endif diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile index 7c68b3b50b10..5056f2c8672a 100644 --- a/drivers/staging/most/Makefile +++ b/drivers/staging/most/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_AIM_NETWORK) += aim-network/ obj-$(CONFIG_AIM_SOUND) += aim-sound/ obj-$(CONFIG_AIM_V4L2) += aim-v4l2/ obj-$(CONFIG_HDM_DIM2) += hdm-dim2/ +obj-$(CONFIG_HDM_I2C) += hdm-i2c/ diff --git a/drivers/staging/most/hdm-i2c/Kconfig b/drivers/staging/most/hdm-i2c/Kconfig new file mode 100644 index 000000000000..6fd7983668ad --- /dev/null +++ b/drivers/staging/most/hdm-i2c/Kconfig @@ -0,0 +1,12 @@ +# +# MOST I2C configuration +# + +config HDM_I2C + tristate "I2C HDM" + depends on I2C + ---help--- + Say Y here if you want to connect via I2C to network tranceiver. + + To compile this driver as a module, choose M here: the + module will be called hdm_i2c. diff --git a/drivers/staging/most/hdm-i2c/Makefile b/drivers/staging/most/hdm-i2c/Makefile new file mode 100644 index 000000000000..03a4a59b1f9f --- /dev/null +++ b/drivers/staging/most/hdm-i2c/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_HDM_I2C) += hdm_i2c.o + +ccflags-y += -Idrivers/staging/most/mostcore/ diff --git a/drivers/staging/most/hdm-i2c/hdm_i2c.c b/drivers/staging/most/hdm-i2c/hdm_i2c.c new file mode 100644 index 000000000000..029ded3f250b --- /dev/null +++ b/drivers/staging/most/hdm-i2c/hdm_i2c.c @@ -0,0 +1,451 @@ +/* + * hdm_i2c.c - Hardware Dependent Module for I2C Interface + * + * Copyright (C) 2013-2015, Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include + +#include + +enum { CH_RX, CH_TX, NUM_CHANNELS }; + +#define MAX_BUFFERS_CONTROL 32 +#define MAX_BUF_SIZE_CONTROL 256 + +/** + * list_first_mbo - get the first mbo from a list + * @ptr: the list head to take the mbo from. + */ +#define list_first_mbo(ptr) \ + list_first_entry(ptr, struct mbo, list) + + +/* IRQ / Polling option */ +static bool polling_req; +module_param(polling_req, bool, S_IRUGO); +MODULE_PARM_DESC(polling_req, "Request Polling. Default = 0 (use irq)"); + +/* Polling Rate */ +static int scan_rate = 100; +module_param(scan_rate, int, 0644); +MODULE_PARM_DESC(scan_rate, "Polling rate in times/sec. Default = 100"); + +struct hdm_i2c { + bool is_open[NUM_CHANNELS]; + bool polling_mode; + struct most_interface most_iface; + struct most_channel_capability capabilities[NUM_CHANNELS]; + struct i2c_client *client; + struct rx { + struct delayed_work dwork; + wait_queue_head_t waitq; + struct list_head list; + struct mutex list_mutex; + } rx; + char name[64]; +}; + +#define to_hdm(iface) container_of(iface, struct hdm_i2c, most_iface) + +/** + * configure_channel - called from MOST core to configure a channel + * @iface: interface the channel belongs to + * @channel: channel to be configured + * @channel_config: structure that holds the configuration information + * + * Return 0 on success, negative on failure. + * + * Receives configuration information from MOST core and initialize the + * corresponding channel. + */ +static int configure_channel(struct most_interface *most_iface, + int ch_idx, + struct most_channel_config *channel_config) +{ + struct hdm_i2c *dev = to_hdm(most_iface); + + BUG_ON(ch_idx < 0 || ch_idx >= NUM_CHANNELS); + BUG_ON(dev->is_open[ch_idx]); + + if (channel_config->data_type != MOST_CH_CONTROL) { + pr_err("bad data type for channel %d\n", ch_idx); + return -EPERM; + } + + if (channel_config->direction != dev->capabilities[ch_idx].direction) { + pr_err("bad direction for channel %d\n", ch_idx); + return -EPERM; + } + + if (channel_config->direction == MOST_CH_RX) { + if (dev->polling_mode) + schedule_delayed_work(&dev->rx.dwork, + msecs_to_jiffies(MSEC_PER_SEC / 4)); + } + dev->is_open[ch_idx] = true; + + return 0; +} + +/** + * enqueue - called from MOST core to enqueue a buffer for data transfer + * @iface: intended interface + * @channel: ID of the channel the buffer is intended for + * @mbo: pointer to the buffer object + * + * Return 0 on success, negative on failure. + * + * Transmit the data over I2C if it is a "write" request or push the buffer into + * list if it is an "read" request + */ +static int enqueue(struct most_interface *most_iface, + int ch_idx, struct mbo *mbo) +{ + struct hdm_i2c *dev = to_hdm(most_iface); + int ret; + + BUG_ON(ch_idx < 0 || ch_idx >= NUM_CHANNELS); + BUG_ON(!dev->is_open[ch_idx]); + + if (ch_idx == CH_RX) { + /* RX */ + mutex_lock(&dev->rx.list_mutex); + list_add_tail(&mbo->list, &dev->rx.list); + mutex_unlock(&dev->rx.list_mutex); + wake_up_interruptible(&dev->rx.waitq); + } else { + /* TX */ + ret = i2c_master_send(dev->client, mbo->virt_address, + mbo->buffer_length); + if (ret <= 0) { + mbo->processed_length = 0; + mbo->status = MBO_E_INVAL; + } else { + mbo->processed_length = mbo->buffer_length; + mbo->status = MBO_SUCCESS; + } + mbo->complete(mbo); + } + + return 0; +} + +/** + * poison_channel - called from MOST core to poison buffers of a channel + * @iface: pointer to the interface the channel to be poisoned belongs to + * @channel_id: corresponding channel ID + * + * Return 0 on success, negative on failure. + * + * If channel direction is RX, complete the buffers in list with + * status MBO_E_CLOSE + */ +static int poison_channel(struct most_interface *most_iface, + int ch_idx) +{ + struct hdm_i2c *dev = to_hdm(most_iface); + struct mbo *mbo; + + BUG_ON(ch_idx < 0 || ch_idx >= NUM_CHANNELS); + BUG_ON(!dev->is_open[ch_idx]); + + dev->is_open[ch_idx] = false; + + if (ch_idx == CH_RX) { + mutex_lock(&dev->rx.list_mutex); + while (!list_empty(&dev->rx.list)) { + mbo = list_first_mbo(&dev->rx.list); + list_del(&mbo->list); + mutex_unlock(&dev->rx.list_mutex); + + mbo->processed_length = 0; + mbo->status = MBO_E_CLOSE; + mbo->complete(mbo); + + mutex_lock(&dev->rx.list_mutex); + } + mutex_unlock(&dev->rx.list_mutex); + wake_up_interruptible(&dev->rx.waitq); + } + + return 0; +} + +static void request_netinfo(struct most_interface *most_iface, + int ch_idx) +{ + pr_info("request_netinfo()\n"); +} + +static void do_rx_work(struct hdm_i2c *dev) +{ + struct mbo *mbo; + unsigned char msg[MAX_BUF_SIZE_CONTROL]; + int ret, ch_idx = CH_RX; + uint16_t pml, data_size; + + /* Read PML (2 bytes) */ + ret = i2c_master_recv(dev->client, msg, 2); + if (ret <= 0) { + pr_err("Failed to receive PML\n"); + return; + } + + pml = (msg[0] << 8) | msg[1]; + if (!pml) + return; + + data_size = pml + 2; + + /* Read the whole message, including PML */ + ret = i2c_master_recv(dev->client, msg, data_size); + if (ret <= 0) { + pr_err("Failed to receive a Port Message\n"); + return; + } + + for (;;) { + /* Conditions to wait for: poisoned channel or free buffer + available for reading */ + if (wait_event_interruptible(dev->rx.waitq, + !dev->is_open[ch_idx] || + !list_empty(&dev->rx.list))) { + pr_err("wait_event_interruptible() failed\n"); + return; + } + + if (!dev->is_open[ch_idx]) + return; + + mutex_lock(&dev->rx.list_mutex); + + /* list may be empty if poison or remove is called */ + if (!list_empty(&dev->rx.list)) + break; + + mutex_unlock(&dev->rx.list_mutex); + } + + mbo = list_first_mbo(&dev->rx.list); + list_del(&mbo->list); + mutex_unlock(&dev->rx.list_mutex); + + mbo->processed_length = min(data_size, mbo->buffer_length); + memcpy(mbo->virt_address, msg, mbo->processed_length); + mbo->status = MBO_SUCCESS; + mbo->complete(mbo); +} + +/** + * pending_rx_work - Read pending messages through I2C + * @work: definition of this work item + * + * Invoked by the Interrupt Service Routine, most_irq_handler() + */ +static void pending_rx_work(struct work_struct *work) +{ + struct hdm_i2c *dev = container_of(work, struct hdm_i2c, rx.dwork.work); + + do_rx_work(dev); + + if (dev->polling_mode) { + if (dev->is_open[CH_RX]) + schedule_delayed_work(&dev->rx.dwork, + msecs_to_jiffies(MSEC_PER_SEC + / scan_rate)); + } else + enable_irq(dev->client->irq); +} + +/* + * most_irq_handler - Interrupt Service Routine + * @irq: irq number + * @_dev: private data + * + * Schedules a delayed work + * + * By default the interrupt line behavior is Active Low. Once an interrupt is + * generated by the device, until driver clears the interrupt (by reading + * the PMP message), device keeps the interrupt line in low state. Since i2c + * read is done in work queue, the interrupt line must be disabled temporarily + * to avoid ISR being called repeatedly. Re-enable the interrupt in workqueue, + * after reading the message. + * + * Note: If we use the interrupt line in Falling edge mode, there is a + * possibility to miss interrupts when ISR is getting executed. + * + */ +static irqreturn_t most_irq_handler(int irq, void *_dev) +{ + struct hdm_i2c *dev = _dev; + + disable_irq_nosync(irq); + + schedule_delayed_work(&dev->rx.dwork, 0); + + return IRQ_HANDLED; +} + +/* + * i2c_probe - i2c probe handler + * @client: i2c client device structure + * @id: i2c client device id + * + * Return 0 on success, negative on failure. + * + * Register the i2c client device as a MOST interface + */ +static int i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct hdm_i2c *dev; + int ret, i; + struct kobject *kobj; + + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (!dev) + return -ENOMEM; + + /* ID format: i2c--
*/ + snprintf(dev->name, sizeof(dev->name), "i2c-%d-%04x", + client->adapter->nr, client->addr); + + for (i = 0; i < NUM_CHANNELS; i++) { + dev->is_open[i] = false; + dev->capabilities[i].data_type = MOST_CH_CONTROL; + dev->capabilities[i].num_buffers_packet = MAX_BUFFERS_CONTROL; + dev->capabilities[i].buffer_size_packet = MAX_BUF_SIZE_CONTROL; + } + dev->capabilities[CH_RX].direction = MOST_CH_RX; + dev->capabilities[CH_RX].name_suffix = "rx"; + dev->capabilities[CH_TX].direction = MOST_CH_TX; + dev->capabilities[CH_TX].name_suffix = "tx"; + + dev->most_iface.interface = ITYPE_I2C; + dev->most_iface.description = dev->name; + dev->most_iface.num_channels = NUM_CHANNELS; + dev->most_iface.channel_vector = dev->capabilities; + dev->most_iface.configure = configure_channel; + dev->most_iface.enqueue = enqueue; + dev->most_iface.poison_channel = poison_channel; + dev->most_iface.request_netinfo = request_netinfo; + + INIT_LIST_HEAD(&dev->rx.list); + mutex_init(&dev->rx.list_mutex); + init_waitqueue_head(&dev->rx.waitq); + + INIT_DELAYED_WORK(&dev->rx.dwork, pending_rx_work); + + dev->client = client; + i2c_set_clientdata(client, dev); + + kobj = most_register_interface(&dev->most_iface); + if (IS_ERR(kobj)) { + pr_err("Failed to register i2c as a MOST interface\n"); + kfree(dev); + return PTR_ERR(kobj); + } + + dev->polling_mode = polling_req || client->irq <= 0; + if (!dev->polling_mode) { + pr_info("Requesting IRQ: %d\n", client->irq); + ret = request_irq(client->irq, most_irq_handler, IRQF_SHARED, + client->name, dev); + if (ret) { + pr_info("IRQ request failed: %d, " + "falling back to polling\n", ret); + dev->polling_mode = true; + } + } + + if (dev->polling_mode) + pr_info("Using polling at rate: %d times/sec\n", scan_rate); + + return 0; +} + +/* + * i2c_remove - i2c remove handler + * @client: i2c client device structure + * + * Return 0 on success. + * + * Unregister the i2c client device as a MOST interface + */ +static int i2c_remove(struct i2c_client *client) +{ + struct hdm_i2c *dev = i2c_get_clientdata(client); + int i; + + if (!dev->polling_mode) + free_irq(client->irq, dev); + + most_deregister_interface(&dev->most_iface); + + for (i = 0 ; i < NUM_CHANNELS; i++) + if (dev->is_open[i]) + poison_channel(&dev->most_iface, i); + cancel_delayed_work_sync(&dev->rx.dwork); + kfree(dev); + + return 0; +} + +static const struct i2c_device_id i2c_id[] = { + { "most_i2c", 0 }, + { }, /* Terminating entry */ +}; + +MODULE_DEVICE_TABLE(i2c, i2c_id); + +static struct i2c_driver i2c_driver = { + .driver = { + .name = "hdm_i2c", + .owner = THIS_MODULE, + }, + .probe = i2c_probe, + .remove = i2c_remove, + .id_table = i2c_id, +}; + +/** + * hdm_i2c_init - Driver Registration Routine + */ +static int __init hdm_i2c_init(void) +{ + pr_info("hdm_i2c_init()\n"); + + return i2c_add_driver(&i2c_driver); +} + +/** + * hdm_i2c_exit - Driver Cleanup Routine + **/ +static void __exit hdm_i2c_exit(void) +{ + i2c_del_driver(&i2c_driver); + pr_info("hdm_i2c_exit()\n"); +} + +module_init(hdm_i2c_init); +module_exit(hdm_i2c_exit); + +MODULE_AUTHOR("Jain Roy Ambi "); +MODULE_AUTHOR("Andrey Shvetsov "); +MODULE_DESCRIPTION("I2C Hardware Dependent Module"); +MODULE_LICENSE("GPL"); From a4198cdf0c3460d767d0d36979cd633021c127a2 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:55 +0200 Subject: [PATCH 490/912] Staging: most: add MOST driver's hdm-usb module This patch adds the hdm-usb module of the MOST driver to the kernel's driver staging area. This module is part of the MOST driver and handles the USB interface of the MOST network interface controller. This patch is needed in order to use the USB peripheral interface of the network interface controller. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/Kconfig | 2 + drivers/staging/most/Makefile | 1 + drivers/staging/most/hdm-usb/Kconfig | 14 + drivers/staging/most/hdm-usb/Makefile | 4 + drivers/staging/most/hdm-usb/hdm_usb.c | 1442 ++++++++++++++++++++++++ 5 files changed, 1463 insertions(+) create mode 100644 drivers/staging/most/hdm-usb/Kconfig create mode 100644 drivers/staging/most/hdm-usb/Makefile create mode 100644 drivers/staging/most/hdm-usb/hdm_usb.c diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig index 2a9f92669161..d50de03de7b9 100644 --- a/drivers/staging/most/Kconfig +++ b/drivers/staging/most/Kconfig @@ -25,4 +25,6 @@ source "drivers/staging/most/hdm-dim2/Kconfig" source "drivers/staging/most/hdm-i2c/Kconfig" +source "drivers/staging/most/hdm-usb/Kconfig" + endif diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile index 5056f2c8672a..9ee981c7786b 100644 --- a/drivers/staging/most/Makefile +++ b/drivers/staging/most/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_AIM_SOUND) += aim-sound/ obj-$(CONFIG_AIM_V4L2) += aim-v4l2/ obj-$(CONFIG_HDM_DIM2) += hdm-dim2/ obj-$(CONFIG_HDM_I2C) += hdm-i2c/ +obj-$(CONFIG_HDM_USB) += hdm-usb/ diff --git a/drivers/staging/most/hdm-usb/Kconfig b/drivers/staging/most/hdm-usb/Kconfig new file mode 100644 index 000000000000..a482c3fdf34b --- /dev/null +++ b/drivers/staging/most/hdm-usb/Kconfig @@ -0,0 +1,14 @@ +# +# MOST USB configuration +# + +config HDM_USB + tristate "USB HDM" + depends on USB + select AIM_NETWORK + ---help--- + Say Y here if you want to connect via USB to network tranceiver. + This device driver depends on the networking AIM. + + To compile this driver as a module, choose M here: the + module will be called hdm_usb. diff --git a/drivers/staging/most/hdm-usb/Makefile b/drivers/staging/most/hdm-usb/Makefile new file mode 100644 index 000000000000..6bbacb41e94b --- /dev/null +++ b/drivers/staging/most/hdm-usb/Makefile @@ -0,0 +1,4 @@ +obj-$(CONFIG_HDM_USB) += hdm_usb.o + +ccflags-y += -Idrivers/staging/most/mostcore/ +ccflags-y += -Idrivers/staging/most/aim-network/ diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c new file mode 100644 index 000000000000..a4a3e266b3ef --- /dev/null +++ b/drivers/staging/most/hdm-usb/hdm_usb.c @@ -0,0 +1,1442 @@ +/* + * hdm_usb.c - Hardware dependent module for USB + * + * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This file is licensed under GPLv2. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mostcore.h" +#include "networking.h" + +#define USB_MTU 512 +#define NO_ISOCHRONOUS_URB 0 +#define AV_PACKETS_PER_XACT 2 +#define BUF_CHAIN_SIZE 0xFFFF +#define MAX_NUM_ENDPOINTS 30 +#define MAX_SUFFIX_LEN 10 +#define MAX_STRING_LEN 80 +#define MAX_BUF_SIZE 0xFFFF +#define CEILING(x, y) (((x) + (y) - 1) / (y)) + +#define USB_VENDOR_ID_SMSC 0x0424 /* VID: SMSC */ +#define USB_DEV_ID_BRDG 0xC001 /* PID: USB Bridge */ +#define USB_DEV_ID_INIC 0xCF18 /* PID: USB INIC */ +/* DRCI Addresses */ +#define DRCI_REG_NI_STATE 0x0100 +#define DRCI_REG_PACKET_BW 0x0101 +#define DRCI_REG_NODE_ADDR 0x0102 +#define DRCI_REG_NODE_POS 0x0103 +#define DRCI_REG_MEP_FILTER 0x0140 +#define DRCI_REG_HASH_TBL0 0x0141 +#define DRCI_REG_HASH_TBL1 0x0142 +#define DRCI_REG_HASH_TBL2 0x0143 +#define DRCI_REG_HASH_TBL3 0x0144 +#define DRCI_REG_HW_ADDR_HI 0x0145 +#define DRCI_REG_HW_ADDR_MI 0x0146 +#define DRCI_REG_HW_ADDR_LO 0x0147 +#define DRCI_READ_REQ 0xA0 +#define DRCI_WRITE_REQ 0xA1 + +/** + * struct buf_anchor - used to create a list of pending URBs + * @urb: pointer to USB request block + * @clear_work_obj: + * @list: linked list + * @urb_completion: + */ +struct buf_anchor { + struct urb *urb; + struct work_struct clear_work_obj; + struct list_head list; + struct completion urb_compl; +}; +#define to_buf_anchor(w) container_of(w, struct buf_anchor, clear_work_obj) + +/** + * struct most_dci_obj - Direct Communication Interface + * @kobj:position in sysfs + * @usb_device: pointer to the usb device + */ +struct most_dci_obj { + struct kobject kobj; + struct usb_device *usb_device; +}; +#define to_dci_obj(p) container_of(p, struct most_dci_obj, kobj) + +/** + * struct most_dev - holds all usb interface specific stuff + * @parent: parent object in sysfs + * @usb_device: pointer to usb device + * @iface: hardware interface + * @cap: channel capabilities + * @conf: channel configuration + * @dci: direct communication interface of hardware + * @hw_addr: MAC address of hardware + * @ep_address: endpoint address table + * @link_stat: link status of hardware + * @description: device description + * @suffix: suffix for channel name + * @anchor_list_lock: locks list access + * @padding_active: indicates channel uses padding + * @is_channel_healthy: health status table of each channel + * @anchor_list: list of anchored items + * @io_mutex: synchronize I/O with disconnect + * @link_stat_timer: timer for link status reports + * @poll_work_obj: work for polling link status + */ +struct most_dev { + struct kobject *parent; + struct usb_device *usb_device; + struct most_interface iface; + struct most_channel_capability *cap; + struct most_channel_config *conf; + struct most_dci_obj *dci; + u8 hw_addr[6]; + u8 *ep_address; + u16 link_stat; + char description[MAX_STRING_LEN]; + char suffix[MAX_NUM_ENDPOINTS][MAX_SUFFIX_LEN]; + spinlock_t anchor_list_lock[MAX_NUM_ENDPOINTS]; + bool padding_active[MAX_NUM_ENDPOINTS]; + bool is_channel_healthy[MAX_NUM_ENDPOINTS]; + struct list_head *anchor_list; + struct mutex io_mutex; + struct timer_list link_stat_timer; + struct work_struct poll_work_obj; +}; +#define to_mdev(d) container_of(d, struct most_dev, iface) +#define to_mdev_from_work(w) container_of(w, struct most_dev, poll_work_obj) + +static struct workqueue_struct *schedule_usb_work; +static void wq_clear_halt(struct work_struct *wq_obj); +static void wq_netinfo(struct work_struct *wq_obj); + +/** + * trigger_resync_vr - Vendor request to trigger HW re-sync mechanism + * @dev: usb device + * + */ +static inline void trigger_resync_vr(struct usb_device *dev) +{ + int data = 0; + + if (0 > usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, + 0, + 0, + &data, + 0, + 5 * HZ)) + pr_info("Vendor request \"stall\" failed\n"); +} + +/** + * drci_rd_reg - read a DCI register + * @dev: usb device + * @reg: register address + * @buf: buffer to store data + * + * This is reads data from INIC's direct register communication interface + */ +static inline int drci_rd_reg(struct usb_device *dev, u16 reg, void *buf) +{ + return usb_control_msg(dev, + usb_rcvctrlpipe(dev, 0), + DRCI_READ_REQ, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0x0000, + reg, + buf, + 2, + 5 * HZ); +} + +/** + * drci_wr_reg - write a DCI register + * @dev: usb device + * @reg: register address + * @data: data to write + * + * This is writes data to INIC's direct register communication interface + */ +static inline int drci_wr_reg(struct usb_device *dev, u16 reg, u16 data) +{ + return usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + DRCI_WRITE_REQ, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + data, + reg, + NULL, + 0, + 5 * HZ); +} + +/** + * free_anchored_buffers - free device's anchored items + * @mdev: the device + * @channel: channel ID + */ +static void free_anchored_buffers(struct most_dev *mdev, unsigned int channel) +{ + struct mbo *mbo; + struct buf_anchor *anchor, *tmp; + unsigned long flags; + + spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags); + list_for_each_entry_safe(anchor, tmp, &mdev->anchor_list[channel], list) { + struct urb *urb = anchor->urb; + + spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags); + if (likely(urb)) { + mbo = urb->context; + if (!irqs_disabled()) { + usb_kill_urb(urb); + } else { + usb_unlink_urb(urb); + wait_for_completion(&anchor->urb_compl); + } + if ((mbo) && (mbo->complete)) { + mbo->status = MBO_E_CLOSE; + mbo->processed_length = 0; + mbo->complete(mbo); + } + usb_free_urb(urb); + } + spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags); + list_del(&anchor->list); + kfree(anchor); + } + spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags); +} + +/** + * get_stream_frame_size - calculate frame size of current configuration + * @cfg: channel configuration + */ +static unsigned int get_stream_frame_size(struct most_channel_config *cfg) +{ + unsigned int frame_size = 0; + unsigned int sub_size = cfg->subbuffer_size; + + if (!sub_size) { + pr_info("Misconfig: Subbuffer size zero.\n"); + return frame_size; + } + switch (cfg->data_type) { + case MOST_CH_ISOC_AVP: + frame_size = AV_PACKETS_PER_XACT * sub_size; + break; + case MOST_CH_SYNC: + if (cfg->packets_per_xact == 0) { + pr_info("Misconfig: Packets per XACT zero\n"); + frame_size = 0; + } else if (cfg->packets_per_xact == 0xFF) + frame_size = (USB_MTU / sub_size) * sub_size; + else + frame_size = cfg->packets_per_xact * sub_size; + break; + default: + pr_warn("Query frame size of non-streaming channel\n"); + break; + } + return frame_size; +} + +/** + * hdm_poison_channel - mark buffers of this channel as invalid + * @iface: pointer to the interface + * @channel: channel ID + * + * This unlinks all URBs submitted to the HCD, + * calls the associated completion function of the core and removes + * them from the list. + * + * Returns 0 on success or error code otherwise. + */ +int hdm_poison_channel(struct most_interface *iface, int channel) +{ + struct most_dev *mdev; + + if (unlikely(!iface)) { + pr_info("Poison: Bad interface.\n"); + return -EIO; + } + if (unlikely((channel < 0) || (channel >= iface->num_channels))) { + pr_info("Channel ID out of range.\n"); + return -ECHRNG; + } + + mdev = to_mdev(iface); + mdev->is_channel_healthy[channel] = false; + + mutex_lock(&mdev->io_mutex); + free_anchored_buffers(mdev, channel); + if (mdev->padding_active[channel] == true) + mdev->padding_active[channel] = false; + + if (mdev->conf[channel].data_type == MOST_CH_ASYNC) { + del_timer_sync(&mdev->link_stat_timer); + cancel_work_sync(&mdev->poll_work_obj); + } + mutex_unlock(&mdev->io_mutex); + return 0; +} + +/** + * hdm_add_padding - add padding bytes + * @mdev: most device + * @channel: channel ID + * @mbo: buffer object + * + * This inserts the INIC hardware specific padding bytes into a streaming + * channel's buffer + */ +int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo) +{ + struct most_channel_config *conf = &mdev->conf[channel]; + unsigned int j, num_frames, frame_size; + u16 rd_addr, wr_addr; + + frame_size = get_stream_frame_size(conf); + if (!frame_size) + return -EIO; + num_frames = mbo->buffer_length / frame_size; + + if (num_frames < 1) { + pr_err("Missed minimal transfer unit.\n"); + return -EIO; + } + + for (j = 1; j < num_frames; j++) { + wr_addr = (num_frames - j) * USB_MTU; + rd_addr = (num_frames - j) * frame_size; + memmove(mbo->virt_address + wr_addr, + mbo->virt_address + rd_addr, + frame_size); + } + mbo->buffer_length = num_frames * USB_MTU; + return 0; +} + +/** + * hdm_remove_padding - remove padding bytes + * @mdev: most device + * @channel: channel ID + * @mbo: buffer object + * + * This takes the INIC hardware specific padding bytes off a streaming + * channel's buffer. + */ +int hdm_remove_padding(struct most_dev *mdev, int channel, struct mbo *mbo) +{ + unsigned int j, num_frames, frame_size; + struct most_channel_config *const conf = &mdev->conf[channel]; + + frame_size = get_stream_frame_size(conf); + if (!frame_size) + return -EIO; + num_frames = mbo->processed_length / USB_MTU; + + for (j = 1; j < num_frames; j++) + memmove(mbo->virt_address + frame_size * j, + mbo->virt_address + USB_MTU * j, + frame_size); + + mbo->processed_length = frame_size * num_frames; + return 0; +} + +/** + * hdm_write_completion - completion function for submitted Tx URBs + * @urb: the URB that has been completed + * + * This checks the status of the completed URB. In case the URB has been + * unlinked before, it is immediately freed. On any other error the MBO + * transfer flag is set. On success it frees allocated resources and calls + * the completion function. + * + * Context: interrupt! + */ +static void hdm_write_completion(struct urb *urb) +{ + struct mbo *mbo; + struct buf_anchor *anchor; + struct most_dev *mdev; + unsigned int channel; + unsigned long flags; + + mbo = urb->context; + anchor = mbo->priv; + mdev = to_mdev(mbo->ifp); + channel = mbo->hdm_channel_id; + + if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) || + (mdev->is_channel_healthy[channel] == false)) { + complete(&anchor->urb_compl); + return; + } + + if (unlikely(urb->status && !(urb->status == -ENOENT || + urb->status == -ECONNRESET || + urb->status == -ESHUTDOWN))) { + mbo->processed_length = 0; + switch (urb->status) { + case -EPIPE: + pr_info("Broken OUT pipe detected\n"); + most_stop_enqueue(&mdev->iface, channel); + mbo->status = MBO_E_INVAL; + usb_unlink_urb(urb); + INIT_WORK(&anchor->clear_work_obj, wq_clear_halt); + queue_work(schedule_usb_work, &anchor->clear_work_obj); + return; + case -ENODEV: + case -EPROTO: + mbo->status = MBO_E_CLOSE; + break; + default: + mbo->status = MBO_E_INVAL; + break; + } + } else { + mbo->status = MBO_SUCCESS; + mbo->processed_length = urb->actual_length; + } + + spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags); + list_del(&anchor->list); + spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags); + kfree(anchor); + + if (likely(mbo->complete)) + mbo->complete(mbo); + usb_free_urb(urb); +} + +/** + * hdm_read_completion - completion funciton for submitted Rx URBs + * @urb: the URB that has been completed + * + * This checks the status of the completed URB. In case the URB has been + * unlinked before it is immediately freed. On any other error the MBO transfer + * flag is set. On success it frees allocated resources, removes + * padding bytes -if necessary- and calls the completion function. + * + * Context: interrupt! + * + * ************************************************************************** + * Error codes returned by in urb->status + * or in iso_frame_desc[n].status (for ISO) + * ************************************************************************* + * + * USB device drivers may only test urb status values in completion handlers. + * This is because otherwise there would be a race between HCDs updating + * these values on one CPU, and device drivers testing them on another CPU. + * + * A transfer's actual_length may be positive even when an error has been + * reported. That's because transfers often involve several packets, so that + * one or more packets could finish before an error stops further endpoint I/O. + * + * For isochronous URBs, the urb status value is non-zero only if the URB is + * unlinked, the device is removed, the host controller is disabled or the total + * transferred length is less than the requested length and the URB_SHORT_NOT_OK + * flag is set. Completion handlers for isochronous URBs should only see + * urb->status set to zero, -ENOENT, -ECONNRESET, -ESHUTDOWN, or -EREMOTEIO. + * Individual frame descriptor status fields may report more status codes. + * + * + * 0 Transfer completed successfully + * + * -ENOENT URB was synchronously unlinked by usb_unlink_urb + * + * -EINPROGRESS URB still pending, no results yet + * (That is, if drivers see this it's a bug.) + * + * -EPROTO (*, **) a) bitstuff error + * b) no response packet received within the + * prescribed bus turn-around time + * c) unknown USB error + * + * -EILSEQ (*, **) a) CRC mismatch + * b) no response packet received within the + * prescribed bus turn-around time + * c) unknown USB error + * + * Note that often the controller hardware does not + * distinguish among cases a), b), and c), so a + * driver cannot tell whether there was a protocol + * error, a failure to respond (often caused by + * device disconnect), or some other fault. + * + * -ETIME (**) No response packet received within the prescribed + * bus turn-around time. This error may instead be + * reported as -EPROTO or -EILSEQ. + * + * -ETIMEDOUT Synchronous USB message functions use this code + * to indicate timeout expired before the transfer + * completed, and no other error was reported by HC. + * + * -EPIPE (**) Endpoint stalled. For non-control endpoints, + * reset this status with usb_clear_halt(). + * + * -ECOMM During an IN transfer, the host controller + * received data from an endpoint faster than it + * could be written to system memory + * + * -ENOSR During an OUT transfer, the host controller + * could not retrieve data from system memory fast + * enough to keep up with the USB data rate + * + * -EOVERFLOW (*) The amount of data returned by the endpoint was + * greater than either the max packet size of the + * endpoint or the remaining buffer size. "Babble". + * + * -EREMOTEIO The data read from the endpoint did not fill the + * specified buffer, and URB_SHORT_NOT_OK was set in + * urb->transfer_flags. + * + * -ENODEV Device was removed. Often preceded by a burst of + * other errors, since the hub driver doesn't detect + * device removal events immediately. + * + * -EXDEV ISO transfer only partially completed + * (only set in iso_frame_desc[n].status, not urb->status) + * + * -EINVAL ISO madness, if this happens: Log off and go home + * + * -ECONNRESET URB was asynchronously unlinked by usb_unlink_urb + * + * -ESHUTDOWN The device or host controller has been disabled due + * to some problem that could not be worked around, + * such as a physical disconnect. + * + * + * (*) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate + * hardware problems such as bad devices (including firmware) or cables. + * + * (**) This is also one of several codes that different kinds of host + * controller use to indicate a transfer has failed because of device + * disconnect. In the interval before the hub driver starts disconnect + * processing, devices may receive such fault reports for every request. + * + * See + */ +static void hdm_read_completion(struct urb *urb) +{ + struct mbo *mbo; + struct buf_anchor *anchor; + struct most_dev *mdev; + unsigned long flags; + unsigned int channel; + struct most_channel_config *conf; + + mbo = urb->context; + anchor = mbo->priv; + mdev = to_mdev(mbo->ifp); + channel = mbo->hdm_channel_id; + + if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) || + (mdev->is_channel_healthy[channel] == false)) { + complete(&anchor->urb_compl); + return; + } + + conf = &mdev->conf[channel]; + + if (unlikely(urb->status && !(urb->status == -ENOENT || + urb->status == -ECONNRESET || + urb->status == -ESHUTDOWN))) { + mbo->processed_length = 0; + switch (urb->status) { + case -EPIPE: + pr_info("Broken IN pipe detected\n"); + mbo->status = MBO_E_INVAL; + usb_unlink_urb(urb); + INIT_WORK(&anchor->clear_work_obj, wq_clear_halt); + queue_work(schedule_usb_work, &anchor->clear_work_obj); + return; + case -ENODEV: + case -EPROTO: + mbo->status = MBO_E_CLOSE; + break; + case -EOVERFLOW: + pr_info("Babble on IN pipe detected\n"); + default: + mbo->status = MBO_E_INVAL; + break; + } + } else { + mbo->processed_length = urb->actual_length; + if (mdev->padding_active[channel] == false) { + mbo->status = MBO_SUCCESS; + } else { + if (hdm_remove_padding(mdev, channel, mbo)) { + mbo->processed_length = 0; + mbo->status = MBO_E_INVAL; + } else { + mbo->status = MBO_SUCCESS; + } + } + } + spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags); + list_del(&anchor->list); + spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags); + kfree(anchor); + + if (likely(mbo->complete)) + mbo->complete(mbo); + usb_free_urb(urb); +} + +/** + * hdm_enqueue - receive a buffer to be used for data transfer + * @iface: interface to enqueue to + * @channel: ID of the channel + * @mbo: pointer to the buffer object + * + * This allocates a new URB and fills it according to the channel + * that is being used for transmission of data. Before the URB is + * submitted it is stored in the private anchor list. + * + * Returns 0 on success. On any error the URB is freed and a error code + * is returned. + * + * Context: Could in _some_ cases be interrupt! + */ +int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo) +{ + struct most_dev *mdev; + struct buf_anchor *anchor; + struct most_channel_config *conf; + int retval = 0; + struct urb *urb; + unsigned long flags; + unsigned long length; + void *virt_address; + + if (unlikely(!iface || !mbo)) { + pr_info("Bad interface or MBO\n"); + return -EIO; + } + if (unlikely(iface->num_channels <= channel) || (channel < 0)) { + pr_info("Channel ID out of range\n"); + return -ECHRNG; + } + + mdev = to_mdev(iface); + conf = &mdev->conf[channel]; + + if (!mdev->usb_device) + return -ENODEV; + + urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_ATOMIC); + if (!urb) { + pr_info("Failed to allocate URB\n"); + return -ENOMEM; + } + + anchor = kzalloc(sizeof(*anchor), GFP_ATOMIC); + if (!anchor) { + retval = -ENOMEM; + goto _error; + } + + anchor->urb = urb; + init_completion(&anchor->urb_compl); + mbo->priv = anchor; + + spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags); + list_add_tail(&anchor->list, &mdev->anchor_list[channel]); + spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags); + + if ((mdev->padding_active[channel] == true) && + (conf->direction & MOST_CH_TX)) + if (hdm_add_padding(mdev, channel, mbo)) { + retval = -EIO; + goto _error_1; + } + + urb->transfer_dma = mbo->bus_address; + virt_address = mbo->virt_address; + length = mbo->buffer_length; + + if (conf->direction & MOST_CH_TX) { + usb_fill_bulk_urb(urb, mdev->usb_device, + usb_sndbulkpipe(mdev->usb_device, + mdev->ep_address[channel]), + virt_address, + length, + hdm_write_completion, + mbo); + if (conf->data_type != MOST_CH_ISOC_AVP) + urb->transfer_flags |= URB_ZERO_PACKET; + } else { + usb_fill_bulk_urb(urb, mdev->usb_device, + usb_rcvbulkpipe(mdev->usb_device, + mdev->ep_address[channel]), + virt_address, + length, + hdm_read_completion, + mbo); + } + urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + + retval = usb_submit_urb(urb, GFP_KERNEL); + if (retval) { + pr_info("URB submit failed with error %d.\n", retval); + goto _error_1; + } + return 0; + +_error_1: + spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags); + list_del(&anchor->list); + spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags); + kfree(anchor); +_error: + usb_free_urb(urb); + return retval; +} + +/** + * hdm_configure_channel - receive channel configuration from core + * @iface: interface + * @channel: channel ID + * @conf: structure that holds the configuration information + */ +int hdm_configure_channel(struct most_interface *iface, int channel, + struct most_channel_config *conf) +{ + unsigned int num_frames; + unsigned int frame_size; + unsigned int temp_size; + unsigned int tail_space; + struct most_dev *mdev; + + if (unlikely(!iface || !conf)) { + pr_info("Bad interface or config pointer.\n"); + return -EINVAL; + } + if (unlikely((channel < 0) || (channel >= iface->num_channels))) { + pr_info("Channel ID out of range.\n"); + return -EINVAL; + } + if ((!conf->num_buffers) || (!conf->buffer_size)) { + pr_info("Misconfig: buffer size or number of buffers zero.\n"); + return -EINVAL; + } + + mdev = to_mdev(iface); + mdev->is_channel_healthy[channel] = true; + + if (!(conf->data_type == MOST_CH_SYNC) && + !((conf->data_type == MOST_CH_ISOC_AVP) && + (conf->packets_per_xact != 0xFF))) { + mdev->padding_active[channel] = false; + goto exit; + } + + mdev->padding_active[channel] = true; + temp_size = conf->buffer_size; + + if ((conf->data_type != MOST_CH_SYNC) && + (conf->data_type != MOST_CH_ISOC_AVP)) { + pr_info("Unsupported data type\n"); + return -EINVAL; + } + + frame_size = get_stream_frame_size(conf); + if ((frame_size == 0) || (frame_size > USB_MTU)) { + pr_info("Misconfig: frame size wrong\n"); + return -EINVAL; + } + + if (conf->buffer_size % frame_size) { + u16 tmp_val; + + tmp_val = conf->buffer_size / frame_size; + conf->buffer_size = tmp_val * frame_size; + pr_info("Channel %d - rouding buffer size to %d bytes," + " channel config says %d bytes", + channel, + conf->buffer_size, + temp_size); + } + + num_frames = conf->buffer_size / frame_size; + tail_space = num_frames * (USB_MTU - frame_size); + temp_size += tail_space; + + /* calculate extra length to comply w/ HW padding */ + conf->extra_len = (CEILING(temp_size, USB_MTU) * USB_MTU) + - conf->buffer_size; +exit: + mdev->conf[channel] = *conf; + return 0; +} + +/** + * hdm_update_netinfo - retrieve latest networking information + * @mdev: device interface + * + * This triggers the USB vendor requests to read the hardware address and + * the current link status of the attached device. + */ +int hdm_update_netinfo(struct most_dev *mdev) +{ + int i; + u16 link; + u8 addr[6]; + + if (!is_valid_ether_addr(mdev->hw_addr)) { + if (0 > drci_rd_reg(mdev->usb_device, + DRCI_REG_HW_ADDR_HI, addr)) { + pr_info("Vendor request \"hw_addr_hi\" failed\n"); + return -1; + } + if (0 > drci_rd_reg(mdev->usb_device, + DRCI_REG_HW_ADDR_MI, addr + 2)) { + pr_info("Vendor request \"hw_addr_mid\" failed\n"); + return -1; + } + if (0 > drci_rd_reg(mdev->usb_device, + DRCI_REG_HW_ADDR_LO, addr + 4)) { + pr_info("Vendor request \"hw_addr_low\" failed\n"); + return -1; + } + mutex_lock(&mdev->io_mutex); + for (i = 0; i < 6; i++) + mdev->hw_addr[i] = addr[i]; + mutex_unlock(&mdev->io_mutex); + + } + if (0 > drci_rd_reg(mdev->usb_device, DRCI_REG_NI_STATE, &link)) { + pr_info("Vendor request \"link status\" failed\n"); + return -1; + } + le16_to_cpus(&link); + mutex_lock(&mdev->io_mutex); + mdev->link_stat = link; + mutex_unlock(&mdev->io_mutex); + return 0; +} + +/** + * hdm_request_netinfo - request network information + * @iface: pointer to interface + * @channel: channel ID + * + * This is used as trigger to set up the link status timer that + * polls for the NI state of the INIC every 2 seconds. + * + */ +void hdm_request_netinfo(struct most_interface *iface, int channel) +{ + struct most_dev *mdev; + + BUG_ON(!iface); + mdev = to_mdev(iface); + mdev->link_stat_timer.expires = jiffies + HZ; + mod_timer(&mdev->link_stat_timer, mdev->link_stat_timer.expires); +} + +/** + * link_stat_timer_handler - add work to link_stat work queue + * @data: pointer to USB device instance + * + * The handler runs in interrupt context. That's why we need to defer the + * tasks to a work queue. + */ +static void link_stat_timer_handler(unsigned long data) +{ + struct most_dev *mdev = (struct most_dev *)data; + + queue_work(schedule_usb_work, &mdev->poll_work_obj); + mdev->link_stat_timer.expires = jiffies + (2 * HZ); + add_timer(&mdev->link_stat_timer); +} + +/** + * wq_netinfo - work queue function + * @wq_obj: object that holds data for our deferred work to do + * + * This retrieves the network interface status of the USB INIC + * and compares it with the current status. If the status has + * changed, it updates the status of the core. + */ +static void wq_netinfo(struct work_struct *wq_obj) +{ + struct most_dev *mdev; + int i, prev_link_stat; + u8 prev_hw_addr[6]; + + mdev = to_mdev_from_work(wq_obj); + prev_link_stat = mdev->link_stat; + + for (i = 0; i < 6; i++) + prev_hw_addr[i] = mdev->hw_addr[i]; + + if (0 > hdm_update_netinfo(mdev)) + return; + if ((prev_link_stat != mdev->link_stat) || + (prev_hw_addr[0] != mdev->hw_addr[0]) || + (prev_hw_addr[1] != mdev->hw_addr[1]) || + (prev_hw_addr[2] != mdev->hw_addr[2]) || + (prev_hw_addr[3] != mdev->hw_addr[3]) || + (prev_hw_addr[4] != mdev->hw_addr[4]) || + (prev_hw_addr[5] != mdev->hw_addr[5])) + most_deliver_netinfo(&mdev->iface, mdev->link_stat, + &mdev->hw_addr[0]); +} + +/** + * wq_clear_halt - work queue function + * @wq_obj: work_struct object to execute + * + * This sends a clear_halt to the given USB pipe. + */ +static void wq_clear_halt(struct work_struct *wq_obj) +{ + struct buf_anchor *anchor; + struct most_dev *mdev; + struct mbo *mbo; + struct urb *urb; + unsigned int channel; + unsigned long flags; + + anchor = to_buf_anchor(wq_obj); + urb = anchor->urb; + mbo = urb->context; + mdev = to_mdev(mbo->ifp); + channel = mbo->hdm_channel_id; + + if (usb_clear_halt(urb->dev, urb->pipe)) + pr_info("Failed to reset endpoint.\n"); + + usb_free_urb(urb); + spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags); + list_del(&anchor->list); + spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags); + + if (likely(mbo->complete)) + mbo->complete(mbo); + if (mdev->conf[channel].direction & MOST_CH_TX) + most_resume_enqueue(&mdev->iface, channel); + + kfree(anchor); +} + +/** + * hdm_usb_fops - file operation table for USB driver + */ +static const struct file_operations hdm_usb_fops = { + .owner = THIS_MODULE, +}; + +/** + * usb_device_id - ID table for HCD device probing + */ +static struct usb_device_id usbid[] = { + { USB_DEVICE(USB_VENDOR_ID_SMSC, USB_DEV_ID_BRDG), }, + { USB_DEVICE(USB_VENDOR_ID_SMSC, USB_DEV_ID_INIC), }, + { } /* Terminating entry */ +}; + +#define MOST_DCI_RO_ATTR(_name) \ + struct most_dci_attribute most_dci_attr_##_name = \ + __ATTR(_name, S_IRUGO, show_value, NULL) + +#define MOST_DCI_ATTR(_name) \ + struct most_dci_attribute most_dci_attr_##_name = \ + __ATTR(_name, S_IRUGO | S_IWUSR, show_value, store_value) + +/** + * struct most_dci_attribute - to access the attributes of a dci object + * @attr: attributes of a dci object + * @show: pointer to the show function + * @store: pointer to the store function + */ +struct most_dci_attribute { + struct attribute attr; + ssize_t (*show)(struct most_dci_obj *d, + struct most_dci_attribute *attr, + char *buf); + ssize_t (*store)(struct most_dci_obj *d, + struct most_dci_attribute *attr, + const char *buf, + size_t count); +}; +#define to_dci_attr(a) container_of(a, struct most_dci_attribute, attr) + + +/** + * dci_attr_show - show function for dci object + * @kobj: pointer to kobject + * @attr: pointer to attribute struct + * @buf: buffer + */ +static ssize_t dci_attr_show(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + struct most_dci_attribute *dci_attr = to_dci_attr(attr); + struct most_dci_obj *dci_obj = to_dci_obj(kobj); + + if (!dci_attr->show) + return -EIO; + + return dci_attr->show(dci_obj, dci_attr, buf); +} + +/** + * dci_attr_store - store function for dci object + * @kobj: pointer to kobject + * @attr: pointer to attribute struct + * @buf: buffer + * @len: length of buffer + */ +static ssize_t dci_attr_store(struct kobject *kobj, + struct attribute *attr, + const char *buf, + size_t len) +{ + struct most_dci_attribute *dci_attr = to_dci_attr(attr); + struct most_dci_obj *dci_obj = to_dci_obj(kobj); + + if (!dci_attr->store) + return -EIO; + + return dci_attr->store(dci_obj, dci_attr, buf, len); +} + +static const struct sysfs_ops most_dci_sysfs_ops = { + .show = dci_attr_show, + .store = dci_attr_store, +}; + +/** + * most_dci_release - release function for dci object + * @kobj: pointer to kobject + * + * This frees the memory allocated for the dci object + */ +static void most_dci_release(struct kobject *kobj) +{ + struct most_dci_obj *dci_obj = to_dci_obj(kobj); + + kfree(dci_obj); +} + +static ssize_t show_value(struct most_dci_obj *dci_obj, + struct most_dci_attribute *attr, char *buf) +{ + u16 tmp_val; + u16 reg_addr; + int err; + + if (!strcmp(attr->attr.name, "ni_state")) + reg_addr = DRCI_REG_NI_STATE; + else if (!strcmp(attr->attr.name, "packet_bandwidth")) + reg_addr = DRCI_REG_PACKET_BW; + else if (!strcmp(attr->attr.name, "node_address")) + reg_addr = DRCI_REG_NODE_ADDR; + else if (!strcmp(attr->attr.name, "node_position")) + reg_addr = DRCI_REG_NODE_POS; + else if (!strcmp(attr->attr.name, "mep_filter")) + reg_addr = DRCI_REG_MEP_FILTER; + else if (!strcmp(attr->attr.name, "mep_hash0")) + reg_addr = DRCI_REG_HASH_TBL0; + else if (!strcmp(attr->attr.name, "mep_hash1")) + reg_addr = DRCI_REG_HASH_TBL1; + else if (!strcmp(attr->attr.name, "mep_hash2")) + reg_addr = DRCI_REG_HASH_TBL2; + else if (!strcmp(attr->attr.name, "mep_hash3")) + reg_addr = DRCI_REG_HASH_TBL3; + else if (!strcmp(attr->attr.name, "mep_eui48_hi")) + reg_addr = DRCI_REG_HW_ADDR_HI; + else if (!strcmp(attr->attr.name, "mep_eui48_mi")) + reg_addr = DRCI_REG_HW_ADDR_MI; + else if (!strcmp(attr->attr.name, "mep_eui48_lo")) + reg_addr = DRCI_REG_HW_ADDR_LO; + else + return -EIO; + + err = drci_rd_reg(dci_obj->usb_device, reg_addr, &tmp_val); + if (err < 0) + return err; + + return snprintf(buf, PAGE_SIZE, "%04x\n", le16_to_cpu(tmp_val)); +} + +static ssize_t store_value(struct most_dci_obj *dci_obj, + struct most_dci_attribute *attr, + const char *buf, size_t count) +{ + u16 v16; + u16 reg_addr; + int err; + + if (!strcmp(attr->attr.name, "mep_filter")) + reg_addr = DRCI_REG_MEP_FILTER; + else if (!strcmp(attr->attr.name, "mep_hash0")) + reg_addr = DRCI_REG_HASH_TBL0; + else if (!strcmp(attr->attr.name, "mep_hash1")) + reg_addr = DRCI_REG_HASH_TBL1; + else if (!strcmp(attr->attr.name, "mep_hash2")) + reg_addr = DRCI_REG_HASH_TBL2; + else if (!strcmp(attr->attr.name, "mep_hash3")) + reg_addr = DRCI_REG_HASH_TBL3; + else if (!strcmp(attr->attr.name, "mep_eui48_hi")) + reg_addr = DRCI_REG_HW_ADDR_HI; + else if (!strcmp(attr->attr.name, "mep_eui48_mi")) + reg_addr = DRCI_REG_HW_ADDR_MI; + else if (!strcmp(attr->attr.name, "mep_eui48_lo")) + reg_addr = DRCI_REG_HW_ADDR_LO; + else + return -EIO; + + err = kstrtou16(buf, 16, &v16); + if (err) + return err; + + err = drci_wr_reg(dci_obj->usb_device, reg_addr, cpu_to_le16(v16)); + if (err < 0) + return err; + + return count; +} + +static MOST_DCI_RO_ATTR(ni_state); +static MOST_DCI_RO_ATTR(packet_bandwidth); +static MOST_DCI_RO_ATTR(node_address); +static MOST_DCI_RO_ATTR(node_position); +static MOST_DCI_ATTR(mep_filter); +static MOST_DCI_ATTR(mep_hash0); +static MOST_DCI_ATTR(mep_hash1); +static MOST_DCI_ATTR(mep_hash2); +static MOST_DCI_ATTR(mep_hash3); +static MOST_DCI_ATTR(mep_eui48_hi); +static MOST_DCI_ATTR(mep_eui48_mi); +static MOST_DCI_ATTR(mep_eui48_lo); + +/** + * most_dci_def_attrs - array of default attribute files of the dci object + */ +static struct attribute *most_dci_def_attrs[] = { + &most_dci_attr_ni_state.attr, + &most_dci_attr_packet_bandwidth.attr, + &most_dci_attr_node_address.attr, + &most_dci_attr_node_position.attr, + &most_dci_attr_mep_filter.attr, + &most_dci_attr_mep_hash0.attr, + &most_dci_attr_mep_hash1.attr, + &most_dci_attr_mep_hash2.attr, + &most_dci_attr_mep_hash3.attr, + &most_dci_attr_mep_eui48_hi.attr, + &most_dci_attr_mep_eui48_mi.attr, + &most_dci_attr_mep_eui48_lo.attr, + NULL, +}; + +/** + * DCI ktype + */ +static struct kobj_type most_dci_ktype = { + .sysfs_ops = &most_dci_sysfs_ops, + .release = most_dci_release, + .default_attrs = most_dci_def_attrs, +}; + +/** + * create_most_dci_obj - allocates a dci object + * @parent: parent kobject + * + * This creates a dci object and registers it with sysfs. + * Returns a pointer to the object or NULL when something went wrong. + */ +static struct +most_dci_obj *create_most_dci_obj(struct kobject *parent) +{ + struct most_dci_obj *most_dci; + int retval; + + most_dci = kzalloc(sizeof(*most_dci), GFP_KERNEL); + if (!most_dci) + return NULL; + + retval = kobject_init_and_add(&most_dci->kobj, &most_dci_ktype, parent, + "dci"); + if (retval) { + kobject_put(&most_dci->kobj); + return NULL; + } + return most_dci; +} + +/** + * destroy_most_dci_obj - DCI object release function + * @p: pointer to dci object + */ +static void destroy_most_dci_obj(struct most_dci_obj *p) +{ + kobject_put(&p->kobj); +} + +/** + * hdm_probe - probe function of USB device driver + * @interface: Interface of the attached USB device + * @id: Pointer to the USB ID table. + * + * This allocates and initializes the device instance, adds the new + * entry to the internal list, scans the USB descriptors and registers + * the interface with the core. + * Additionally, the DCI objects are created and the hardware is sync'd. + * + * Return 0 on success. In case of an error a negative number is returned. + */ +static int +hdm_probe(struct usb_interface *interface, const struct usb_device_id *id) +{ + unsigned int i; + unsigned int num_endpoints; + struct most_channel_capability *tmp_cap; + struct most_dev *mdev; + struct usb_device *usb_dev; + struct usb_host_interface *usb_iface_desc; + struct usb_endpoint_descriptor *ep_desc; + int ret = 0; + + usb_iface_desc = interface->cur_altsetting; + usb_dev = interface_to_usbdev(interface); + mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + if (!mdev) + goto exit_ENOMEM; + + usb_set_intfdata(interface, mdev); + num_endpoints = usb_iface_desc->desc.bNumEndpoints; + mutex_init(&mdev->io_mutex); + INIT_WORK(&mdev->poll_work_obj, wq_netinfo); + init_timer(&mdev->link_stat_timer); + + mdev->usb_device = usb_dev; + mdev->link_stat_timer.function = link_stat_timer_handler; + mdev->link_stat_timer.data = (unsigned long)mdev; + mdev->link_stat_timer.expires = jiffies + (2 * HZ); + + mdev->iface.mod = hdm_usb_fops.owner; + mdev->iface.interface = ITYPE_USB; + mdev->iface.configure = hdm_configure_channel; + mdev->iface.request_netinfo = hdm_request_netinfo; + mdev->iface.enqueue = hdm_enqueue; + mdev->iface.poison_channel = hdm_poison_channel; + mdev->iface.description = mdev->description; + mdev->iface.num_channels = num_endpoints; + + snprintf(mdev->description, sizeof(mdev->description), + "usb_device %d-%s:%d.%d", + usb_dev->bus->busnum, + usb_dev->devpath, + usb_dev->config->desc.bConfigurationValue, + usb_iface_desc->desc.bInterfaceNumber); + + mdev->conf = kcalloc(num_endpoints, sizeof(*mdev->conf), GFP_KERNEL); + if (!mdev->conf) + goto exit_free; + + mdev->cap = kcalloc(num_endpoints, sizeof(*mdev->cap), GFP_KERNEL); + if (!mdev->cap) + goto exit_free1; + + mdev->iface.channel_vector = mdev->cap; + mdev->iface.priv = NULL; + + mdev->ep_address = + kcalloc(num_endpoints, sizeof(*mdev->ep_address), GFP_KERNEL); + if (!mdev->ep_address) + goto exit_free2; + + mdev->anchor_list = + kcalloc(num_endpoints, sizeof(*mdev->anchor_list), GFP_KERNEL); + if (!mdev->anchor_list) + goto exit_free3; + + tmp_cap = mdev->cap; + for (i = 0; i < num_endpoints; i++) { + ep_desc = &usb_iface_desc->endpoint[i].desc; + mdev->ep_address[i] = ep_desc->bEndpointAddress; + mdev->padding_active[i] = false; + mdev->is_channel_healthy[i] = true; + + snprintf(&mdev->suffix[i][0], MAX_SUFFIX_LEN, "ep%02x", + mdev->ep_address[i]); + + tmp_cap->name_suffix = &mdev->suffix[i][0]; + tmp_cap->buffer_size_packet = MAX_BUF_SIZE; + tmp_cap->buffer_size_streaming = MAX_BUF_SIZE; + tmp_cap->num_buffers_packet = BUF_CHAIN_SIZE; + tmp_cap->num_buffers_streaming = BUF_CHAIN_SIZE; + tmp_cap->data_type = MOST_CH_CONTROL | MOST_CH_ASYNC | + MOST_CH_ISOC_AVP | MOST_CH_SYNC; + if (ep_desc->bEndpointAddress & USB_DIR_IN) + tmp_cap->direction = MOST_CH_RX; + else + tmp_cap->direction = MOST_CH_TX; + tmp_cap++; + INIT_LIST_HEAD(&mdev->anchor_list[i]); + spin_lock_init(&mdev->anchor_list_lock[i]); + } + pr_info("claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x If#=%d Alt=%d\n", + le16_to_cpu(usb_dev->descriptor.idVendor), + le16_to_cpu(usb_dev->descriptor.idProduct), + usb_dev->bus->busnum, + usb_dev->devnum, + usb_iface_desc->desc.bInterfaceNumber, + usb_iface_desc->desc.bAlternateSetting); + + pr_info("device path: /sys/bus/usb/devices/%d-%s:%d.%d\n", + usb_dev->bus->busnum, + usb_dev->devpath, + usb_dev->config->desc.bConfigurationValue, + usb_iface_desc->desc.bInterfaceNumber); + + mdev->parent = most_register_interface(&mdev->iface); + if (IS_ERR(mdev->parent)) { + ret = PTR_ERR(mdev->parent); + goto exit_free4; + } + + mutex_lock(&mdev->io_mutex); + if (le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_INIC) { + /* this increments the reference count of the instance + * object of the core + */ + mdev->dci = create_most_dci_obj(mdev->parent); + if (!mdev->dci) { + mutex_unlock(&mdev->io_mutex); + most_deregister_interface(&mdev->iface); + ret = -ENOMEM; + goto exit_free4; + } + + kobject_uevent(&mdev->dci->kobj, KOBJ_ADD); + mdev->dci->usb_device = mdev->usb_device; + trigger_resync_vr(usb_dev); + } + mutex_unlock(&mdev->io_mutex); + return 0; + +exit_free4: + kfree(mdev->anchor_list); +exit_free3: + kfree(mdev->ep_address); +exit_free2: + kfree(mdev->cap); +exit_free1: + kfree(mdev->conf); +exit_free: + kfree(mdev); +exit_ENOMEM: + if (ret == 0 || ret == -ENOMEM) { + ret = -ENOMEM; + pr_info("out of memory\n"); + } + return ret; +} + +/** + * hdm_disconnect - disconnect function of USB device driver + * @interface: Interface of the attached USB device + * + * This deregisters the interface with the core, removes the kernel timer + * and frees resources. + * + * Context: hub kernel thread + */ +static void hdm_disconnect(struct usb_interface *interface) +{ + struct most_dev *mdev; + + mdev = usb_get_intfdata(interface); + if (unlikely(!mdev)) { + pr_info("failed to retrieve interface data\n"); + return; + } + + mutex_lock(&mdev->io_mutex); + usb_set_intfdata(interface, NULL); + mdev->usb_device = NULL; + mutex_unlock(&mdev->io_mutex); + + del_timer_sync(&mdev->link_stat_timer); + cancel_work_sync(&mdev->poll_work_obj); + + destroy_most_dci_obj(mdev->dci); + most_deregister_interface(&mdev->iface); + + kfree(mdev->anchor_list); + kfree(mdev->cap); + kfree(mdev->conf); + kfree(mdev->ep_address); + kfree(mdev); +} + +static struct usb_driver hdm_usb = { + .name = "hdm_usb", + .id_table = usbid, + .probe = hdm_probe, + .disconnect = hdm_disconnect, +}; + +static int __init hdm_usb_init(void) +{ + pr_info("hdm_usb_init()\n"); + if (usb_register(&hdm_usb)) { + pr_info("could not register hdm_usb driver\n"); + return -EIO; + } + schedule_usb_work = create_workqueue("hdmu_work"); + if (schedule_usb_work == NULL) { + pr_info("could not create workqueue\n"); + usb_deregister(&hdm_usb); + return -ENOMEM; + } + return 0; +} + +static void __exit hdm_usb_exit(void) +{ + pr_info("hdm_usb_exit()\n"); + destroy_workqueue(schedule_usb_work); + usb_deregister(&hdm_usb); +} + +module_init(hdm_usb_init); +module_exit(hdm_usb_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Christian Gromm "); +MODULE_DESCRIPTION("HDM_4_USB"); From 59cc3399efd61fabb7f4aa23d4498bd9b01e5f6d Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 24 Jul 2015 16:11:56 +0200 Subject: [PATCH 491/912] Staging: most: add MOST driver's documentation This patch adds the documentation to the MOST driver that describes its ABI interface and the basic usage. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- .../Documentation/ABI/sysfs-class-most.txt | 181 ++++++++++++++++++ .../most/Documentation/driver_usage.txt | 180 +++++++++++++++++ 2 files changed, 361 insertions(+) create mode 100644 drivers/staging/most/Documentation/ABI/sysfs-class-most.txt create mode 100644 drivers/staging/most/Documentation/driver_usage.txt diff --git a/drivers/staging/most/Documentation/ABI/sysfs-class-most.txt b/drivers/staging/most/Documentation/ABI/sysfs-class-most.txt new file mode 100644 index 000000000000..380c137089d0 --- /dev/null +++ b/drivers/staging/most/Documentation/ABI/sysfs-class-most.txt @@ -0,0 +1,181 @@ +What: /sys/class/most/mostcore/aims +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + List of AIMs that have been loaded. +Users: + +What: /sys/class/most/mostcore/aims//add_link +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + This is used to establish a connection of a channel and the + current AIM. +Users: + +What: /sys/class/most/mostcore/aims//remove_link +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + This is used to remove a connected channel from the + current AIM. +Users: + +What: /sys/class/most/mostcore/devices +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + List of attached MOST interfaces. +Users: + +What: /sys/class/most/mostcore/devices//description +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Provides information about the interface type and the physical + location of the device. Hardware attached via USB, for instance, + might return +Users: + +What: /sys/class/most/mostcore/devices//interface +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Indicates the type of peripherial interface the current device + uses. +Users: + +What: /sys/class/most/mostcore/devices/// +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + For every channel of the device a directory is created, whose + name is dictated by the HDM. This enables an application to + collect information about the channel's capabilities and + configure it. +Users: + +What: /sys/class/most/mostcore/devices///available_datatypes +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Indicates the data types the current channel can transport. +Users: + +What: /sys/class/most/mostcore/devices///available_directions +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Indicates the directions the current channel is capable of. +Users: + +What: /sys/class/most/mostcore/devices///number_of_packet_buffers +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Indicates the number of packet buffers the current channel can + handle. +Users: + +What: /sys/class/most/mostcore/devices///number_of_stream_buffers +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Indicates the number of streaming buffers the current channel can + handle. +Users: + +What: /sys/class/most/mostcore/devices///size_of_packet_buffer +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Indicates the size of a packet buffer the current channel can + handle. +Users: + +What: /sys/class/most/mostcore/devices///size_of_stream_buffer +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Indicates the size of a streaming buffer the current channel can + handle. +Users: + +What: /sys/class/most/mostcore/devices///set_number_of_buffers +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + This is to configure the number of buffers of the current channel. +Users: + +What: /sys/class/most/mostcore/devices///set_buffer_size +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + This is to configure the size of a buffer of the current channel. +Users: + +What: /sys/class/most/mostcore/devices///set_direction +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + This is to configure the direction of the current channel. + The following strings will be accepted: + 'dir_tx', + 'dir_rx' +Users: + +What: /sys/class/most/mostcore/devices///set_datatype +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + This is to configure the data type of the current channel. + The following strings will be accepted: + 'control', + 'async', + 'sync', + 'isoc_avp' +Users: + +What: /sys/class/most/mostcore/devices///set_subbuffer_size +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + This is to configure the subbuffer size of the current channel. +Users: + +What: /sys/class/most/mostcore/devices///set_packets_per_xact +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + This is to configure the number of packets per transaction of + the current channel. This is only needed network interface + controller is attached via USB. +Users: + +What: /sys/class/most/mostcore/devices///channel_starving +Date: June 2015 +KernelVersion: 4.3 +Contact: Christian Gromm +Description: + Indicates whether current channel ran out of buffers. +Users: diff --git a/drivers/staging/most/Documentation/driver_usage.txt b/drivers/staging/most/Documentation/driver_usage.txt new file mode 100644 index 000000000000..a4dc0c348fbc --- /dev/null +++ b/drivers/staging/most/Documentation/driver_usage.txt @@ -0,0 +1,180 @@ + + Section 1 Overview + +The Media Oriented Systems Transport (MOST) driver gives Linux applications +access a MOST network: The Automotive Information Backbone and the de-facto +standard for high-bandwidth automotive multimedia networking. + +MOST defines the protocol, hardware and software layers necessary to allow +for the efficient and low-cost transport of control, real-time and packet +data using a single medium (physical layer). Media currently in use are +fiber optics, unshielded twisted pair cables (UTP) and coax cables. MOST +also supports various speed grades up to 150 Mbps. +For more information on MOST, visit the MOST Cooperation website: +www.mostcooperation.com. + +Cars continue to evolve into sophisticated consumer electronics platforms, +increasing the demand for reliable and simple solutions to support audio, +video and data communications. MOST can be used to connect multiple +consumer devices via optical or electrical physical layers directly to one +another or in a network configuration. As a synchronous network, MOST +provides excellent Quality of Service and seamless connectivity for +audio/video streaming. Therefore, the driver perfectly fits to the mission +of Automotive Grade Linux to create open source software solutions for +automotive applications. + +The driver consists basically of three layers. The hardware layer, the +core layer and the application layer. The core layer consists of the core +module only. This module handles the communication flow through all three +layers, the configuration of the driver, the configuration interface +representation in sysfs, and the buffer management. +For each of the other two layers a selection of modules is provided. These +modules can arbitrarily be combined to meet the needs of the desired +system architecture. A module of the hardware layer is referred to as an +HDM (hardware dependent module). Each module of this layer handles exactly +one of the peripheral interfaces of a network interface controller (e.g. +USB, MediaLB, I2C). A module of the application layer is referred to as an +AIM (application interfacing module). The modules of this layer give access +to MOST via one the following ways: character devices, ALSA, Networking or +V4L2. + +To physically access MOST, an Intelligent Network Interface Controller +(INIC) is needed. For more information on available controllers visit: +www.microchip.com + + + + Section 1.1 Hardware Layer + +The hardware layer contains so called hardware dependent modules (HDM). For each +peripheral interface the hardware supports the driver has a suitable module +that handles the interface. + +The HDMs encapsulate the peripheral interface specific knowledge of the driver +and provides an easy way of extending the number of supported interfaces. +Currently the following HDMs are available: + + 1) MediaLB (DIM2) + Host wants to communicate with hardware via MediaLB. + + 2) I2C + Host wants to communicate with the hardware via I2C. + + 3) USB + Host wants to communicate with the hardware via USB. + + + Section 1.2 Core Layer + +The core layer contains the mostcore module only, which processes the driver +configuration via sysfs, buffer management and data forwarding. + + + + Section 1.2 Application Layer + +The application layer contains so called application interfacing modules (AIM). +Depending on how the driver should interface to the application, one or more +suitable modules can be selected. + +The AIMs encapsulate the application interface specific knowledge of the driver +and provides access to user space or other kernel subsystems. +Currently the following AIMs are available + + 1) Character Device + Applications can access the driver by means of character devices. + + 2) Networking + Standard networking applications (e.g. iperf) can by used to access + the driver via the networking subsystem. + + 3) Video4Linux (v4l2) + Standard video applications (e.g. VLC) can by used to access the + driver via the V4L subsystem. + + 4) Advanced Linux Sound Architecture (ALSA) + Standard sound applications (e.g. aplay, arecord, audacity) can by + used to access the driver via the ALSA subsystem. + + + + Section 2 Configuration + +See ABI/sysfs-class-most.txt + + + + Section 3 USB Padding + +When transceiving synchronous or isochronous data, the number of packets per USB +transaction and the sub-buffer size need to be configured. These values +are needed for the driver to process buffer padding, as expected by hardware, +which is for performance optimization purposes of the USB transmission. + +When transmitting synchronous data the allocated channel width needs to be +written to 'set_subbuffer_size'. Additionally, the number of MOST frames that +should travel to the host within one USB transaction need to be written to +'packets_per_xact'. + +Internally the synchronous threshold is calculated as follows: + + frame_size = set_subbuffer_size * packets_per_xact + +In case 'packets_per_xact' is set to 0xFF the maximum number of packets, +allocated within one MOST frame, is calculated that fit into _one_ 512 byte +USB full packet. + + frame_size = floor(MTU_USB / bandwidth_sync) * bandwidth_sync + +This frame_size is the number of synchronous data within an USB transaction, +which renders MTU_USB - frame_size bytes for padding. + +When transmitting isochronous AVP data the desired packet size needs to be +written to 'set_subbuffer_size' and hardware will always expect two isochronous +packets within one USB transaction. This renders + + MTU_USB - (2 * set_subbuffer_size) + +bytes for padding. + +Note that at least 2 times set_subbuffer_size bytes for isochronous data or +set_subbuffer_size times packts_per_xact bytes for synchronous data need to be +put in the transmission buffer and passed to the driver. + +Since HDMs are allowed to change a chosen configuration to best fit its +constraints, it is recommended to always double check the configuration and read +back the previously written files. + + + + Section 4 Routing Channels + +To connect a channel that has been configured as outlined above to an AIM and +make it accessible to user space applications, the attribute file 'add_link' is +used. To actually bind a channel to the AIM a string needs to be written to the +file that complies with the following syntax: + + "most_device:channel_name:link_name[.param]" + +The example above links the channel "channel_name" of the device "most_device" +to the AIM. In case the AIM interfaces the VFS this would also create a device +node "link_name" in the /dev directory. The parameter "param" is an AIM dependent +string, which can be omitted in case the used AIM does not make any use of it. + +Cdev AIM example: + $ echo "mdev0:ep_81:my_rx_channel" >add_link + $ echo "mdev0:ep_81" >add_link + + +Sound/ALSA AIM example: + +The sound/ALSA AIM needs an additional parameter to determine the audio resolution +that is going to be used. The following strings can be used: + + - "1x8" (Mono) + - "2x16" (16-bit stereo) + - "2x24" (24-bit stereo) + - "2x32" (32-bit stereo) + + $ echo "mdev0:ep_81:audio_rx.2x16" >add_link + $ echo "mdev0:ep_81" >add_link From 4ad2adc98f113d6c21d7bd365cd45ba88d4f7470 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Fri, 24 Jul 2015 09:37:14 -0700 Subject: [PATCH 492/912] staging: lustre: Replace strtoul with simple_strtoul Defining and using strtoul in lustre code results in the following compile warnings (arm64:allmodconfig). include/linux/libcfs/libcfs_string.h:105:0: warning: "strtoul" redefined #define strtoul(str, endp, base) simple_strtoul(str, endp, base) include/acpi/platform/aclinux.h:122:0: note: this is the location of the previous definition #define strtoul simple_strtoul Remove the definition and use simple_strtoul() directly. Note that we can not replace simple_strtoul with kstrtoul since the end pointer is used by the code. Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_string.h | 2 -- drivers/staging/lustre/lustre/include/obd.h | 2 +- drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h index 509dc1e5c3b1..478e9582ff54 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h @@ -102,6 +102,4 @@ int cfs_ip_addr_parse(char *str, int len, struct list_head *list); int cfs_ip_addr_match(__u32 addr, struct list_head *list); void cfs_ip_addr_free(struct list_head *list); -#define strtoul(str, endp, base) simple_strtoul(str, endp, base) - #endif diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 55452e562bd4..9ad8c268da10 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -1472,7 +1472,7 @@ static inline bool filename_is_volatile(const char *name, int namelen, int *idx) } /* we have an idx, read it */ start = name + LUSTRE_VOLATILE_HDR_LEN + 1; - *idx = strtoul(start, &end, 0); + *idx = simple_strtoul(start, &end, 0); /* error cases: * no digit, no trailing :, negative value */ diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index 76d4392bd282..4dde8e08c0ba 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -231,7 +231,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num, char *endp; str = cfs_trimwhite(str); - *num = strtoul(str, &endp, 0); + *num = simple_strtoul(str, &endp, 0); if (endp == str) return 0; From add04a9854106a724b9fbf8bc9925781e5b0059e Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 27 Jul 2015 10:31:09 +0900 Subject: [PATCH 493/912] staging: most: core.c: remove semicolon at the end of define statement Remove semicolon at the end of define statement to fix checkpatch warning. WARNING: macros should not use a trailing semicolon Signed-off-by: Chaehyun Lim Acked-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/mostcore/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index f4f903404f1b..98a4c900d1c2 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -328,7 +328,7 @@ static ssize_t show_channel_starving(struct most_c_obj *c, #define create_show_channel_attribute(val) \ - static MOST_CHNL_ATTR(val, S_IRUGO, show_##val, NULL); + static MOST_CHNL_ATTR(val, S_IRUGO, show_##val, NULL) create_show_channel_attribute(available_directions); create_show_channel_attribute(available_datatypes); From 7ac5c9f0a0228fff35c0ea85008ff642b07e6db3 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Tue, 28 Jul 2015 17:16:09 +0200 Subject: [PATCH 494/912] Staging: most: fix snprintf() is printing too much This patch prevents snprintf from exceeding a given buffer size. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/mostcore/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index 98a4c900d1c2..49d03af599d5 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -983,7 +983,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj, return ret; if (mdev_devnod == 0 || *mdev_devnod == 0) { - snprintf(devnod_buf, PAGE_SIZE, "%s-%s", mdev, mdev_ch); + snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, mdev_ch); mdev_devnod = devnod_buf; } From 2e4c30458e31e5f6487d1393254f2ab347cfb02c Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Tue, 28 Jul 2015 17:16:10 +0200 Subject: [PATCH 495/912] Staging: most: fix dereferencing freed memory This patch fixes the dereferencing of freed memory. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-cdev/cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c index d5fb4a0e0818..cfc32dff6512 100644 --- a/drivers/staging/most/aim-cdev/cdev.c +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -124,9 +124,9 @@ static int aim_close(struct inode *inode, struct file *filp) cdev_del(&channel->cdev); kfifo_free(&channel->fifo); list_del(&channel->list); - kfree(channel); ida_simple_remove(&minor_id, MINOR(channel->devno)); wake_up_interruptible(&channel->wq); + kfree(channel); return 0; } mutex_unlock(&channel->io_mutex); From a11442fe87d63994816cf2edde4450410df397af Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Tue, 28 Jul 2015 17:16:11 +0200 Subject: [PATCH 496/912] Staging: most: fix passing a potential null pointer This patch fixes passing of a potential null pointer. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-cdev/cdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c index cfc32dff6512..252a17cf153c 100644 --- a/drivers/staging/most/aim-cdev/cdev.c +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -204,7 +204,8 @@ static ssize_t aim_write(struct file *filp, const char __user *buf, } return actual_len - retval; error: - most_put_mbo(mbo); + if (mbo) + most_put_mbo(mbo); return err; } From d10e0a6332fdea740fa74f541e354788903878a1 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Tue, 28 Jul 2015 10:45:07 -0700 Subject: [PATCH 497/912] staging: most: fix aim-network build errors Fix build errors when CONFIG_NET is not enabled by making the driver depend on NET. Also correct the loadable module name. ERROR: "__netdev_alloc_skb" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "netif_rx" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "netif_tx_wake_queue" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "free_netdev" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "register_netdev" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "kfree_skb" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "alloc_netdev_mqs" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "eth_type_trans" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "ether_setup" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "unregister_netdev" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "skb_put" [drivers/staging/most/aim-network/aim_network.ko] undefined! ERROR: "eth_mac_addr" [drivers/staging/most/aim-network/aim_network.ko] undefined! Signed-off-by: Randy Dunlap Cc: Andrey Shvetsov Cc: Michael Fabry Acked-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/most/aim-network/Kconfig b/drivers/staging/most/aim-network/Kconfig index 507232a7f7ee..4c66b24cf73c 100644 --- a/drivers/staging/most/aim-network/Kconfig +++ b/drivers/staging/most/aim-network/Kconfig @@ -4,9 +4,10 @@ config AIM_NETWORK tristate "Networking AIM" + depends on NET ---help--- Say Y here if you want to commumicate via a networking device. To compile this driver as a module, choose M here: the - module will be called aim_networking. + module will be called aim_network. From 1625d2166cbcace6fff3b4413be78522f4137f57 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:20 +0900 Subject: [PATCH 498/912] staging: wilc1000: remove unnecessary files This patch removes the following files which are not used anymore. - fifo_buffer.c - fifo_buffer.h - coreconfigsimulator.h - wilc_wfi_netdevice.c Signed-off-by: Robin Hwang Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 4 +- .../staging/wilc1000/coreconfigsimulator.h | 17 - drivers/staging/wilc1000/fifo_buffer.c | 132 --- drivers/staging/wilc1000/fifo_buffer.h | 26 - drivers/staging/wilc1000/host_interface.h | 1 - drivers/staging/wilc1000/wilc_wfi_netdevice.c | 909 ------------------ 6 files changed, 2 insertions(+), 1087 deletions(-) delete mode 100644 drivers/staging/wilc1000/coreconfigsimulator.h delete mode 100644 drivers/staging/wilc1000/fifo_buffer.c delete mode 100644 drivers/staging/wilc1000/fifo_buffer.h delete mode 100644 drivers/staging/wilc1000/wilc_wfi_netdevice.c diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index a78c4d529a58..5ca8fa253306 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -25,10 +25,10 @@ ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC -wilc1000-objs := wilc_wfi_netdevice.o wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ +wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ wilc_memory.o wilc_msgqueue.o wilc_sleep.o wilc_strutils.o \ wilc_timer.o coreconfigurator.o host_interface.o \ - fifo_buffer.o wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o + wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o diff --git a/drivers/staging/wilc1000/coreconfigsimulator.h b/drivers/staging/wilc1000/coreconfigsimulator.h deleted file mode 100644 index 5e01f8e4a41d..000000000000 --- a/drivers/staging/wilc1000/coreconfigsimulator.h +++ /dev/null @@ -1,17 +0,0 @@ - -/*! - * @file coreconfigsimulator.h - * @brief - * @author - * @sa coreconfigsimulator.c - * @date 1 Mar 2012 - * @version 1.0 - */ - -#ifndef CORECONFIGSIMULATOR_H -#define CORECONFIGSIMULATOR_H - -extern s32 CoreConfigSimulatorInit(void); -extern s32 CoreConfigSimulatorDeInit(void); - -#endif diff --git a/drivers/staging/wilc1000/fifo_buffer.c b/drivers/staging/wilc1000/fifo_buffer.c deleted file mode 100644 index 86eb82e36be0..000000000000 --- a/drivers/staging/wilc1000/fifo_buffer.c +++ /dev/null @@ -1,132 +0,0 @@ - - -#include "fifo_buffer.h" - - - -u32 FIFO_InitBuffer(tHANDLE *hBuffer, u32 u32BufferLength) -{ - u32 u32Error = 0; - tstrFifoHandler *pstrFifoHandler = WILC_MALLOC (sizeof (tstrFifoHandler)); - if (pstrFifoHandler) { - WILC_memset (pstrFifoHandler, 0, sizeof (tstrFifoHandler)); - pstrFifoHandler->pu8Buffer = WILC_MALLOC (u32BufferLength); - if (pstrFifoHandler->pu8Buffer) { - pstrFifoHandler->u32BufferLength = u32BufferLength; - WILC_memset (pstrFifoHandler->pu8Buffer, 0, u32BufferLength); - /* create semaphore */ - sema_init(&pstrFifoHandler->SemBuffer, 1); - *hBuffer = pstrFifoHandler; - } else { - *hBuffer = NULL; - u32Error = 1; - } - } else { - u32Error = 1; - } - return u32Error; -} -u32 FIFO_DeInit(tHANDLE hFifo) -{ - u32 u32Error = 0; - tstrFifoHandler *pstrFifoHandler = (tstrFifoHandler *) hFifo; - if (pstrFifoHandler) { - if (pstrFifoHandler->pu8Buffer) - WILC_FREE (pstrFifoHandler->pu8Buffer); - else - u32Error = 1; - - WILC_FREE (pstrFifoHandler); - } else { - u32Error = 1; - } - return u32Error; -} - -u32 FIFO_ReadBytes(tHANDLE hFifo, u8 *pu8Buffer, u32 u32BytesToRead, u32 *pu32BytesRead) -{ - u32 u32Error = 0; - tstrFifoHandler *pstrFifoHandler = (tstrFifoHandler *) hFifo; - if (pstrFifoHandler && pu32BytesRead) { - if (pstrFifoHandler->u32TotalBytes) { - down(&pstrFifoHandler->SemBuffer); - - if (u32BytesToRead > pstrFifoHandler->u32TotalBytes) - *pu32BytesRead = pstrFifoHandler->u32TotalBytes; - else - *pu32BytesRead = u32BytesToRead; - - if ((pstrFifoHandler->u32ReadOffset + u32BytesToRead) <= pstrFifoHandler->u32BufferLength) { - WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset, - *pu32BytesRead); - /* update read offset and total bytes */ - pstrFifoHandler->u32ReadOffset += u32BytesToRead; - pstrFifoHandler->u32TotalBytes -= u32BytesToRead; - - } else { - u32 u32FirstPart = - pstrFifoHandler->u32BufferLength - pstrFifoHandler->u32ReadOffset; - WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset, - u32FirstPart); - WILC_memcpy(pu8Buffer + u32FirstPart, pstrFifoHandler->pu8Buffer, - u32BytesToRead - u32FirstPart); - /* update read offset and total bytes */ - pstrFifoHandler->u32ReadOffset = u32BytesToRead - u32FirstPart; - pstrFifoHandler->u32TotalBytes -= u32BytesToRead; - } - up(&pstrFifoHandler->SemBuffer); - } else { - u32Error = 1; - } - } else { - u32Error = 1; - } - return u32Error; -} - -u32 FIFO_WriteBytes(tHANDLE hFifo, u8 *pu8Buffer, u32 u32BytesToWrite, bool bForceOverWrite) -{ - u32 u32Error = 0; - tstrFifoHandler *pstrFifoHandler = (tstrFifoHandler *) hFifo; - if (pstrFifoHandler) { - if (u32BytesToWrite < pstrFifoHandler->u32BufferLength) { - if ((pstrFifoHandler->u32TotalBytes + u32BytesToWrite) <= pstrFifoHandler->u32BufferLength || - bForceOverWrite) { - down(&pstrFifoHandler->SemBuffer); - if ((pstrFifoHandler->u32WriteOffset + u32BytesToWrite) <= pstrFifoHandler->u32BufferLength) { - WILC_memcpy(pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32WriteOffset, pu8Buffer, - u32BytesToWrite); - /* update read offset and total bytes */ - pstrFifoHandler->u32WriteOffset += u32BytesToWrite; - pstrFifoHandler->u32TotalBytes += u32BytesToWrite; - - } else { - u32 u32FirstPart = - pstrFifoHandler->u32BufferLength - pstrFifoHandler->u32WriteOffset; - WILC_memcpy(pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32WriteOffset, pu8Buffer, - u32FirstPart); - WILC_memcpy(pstrFifoHandler->pu8Buffer, pu8Buffer + u32FirstPart, - u32BytesToWrite - u32FirstPart); - /* update read offset and total bytes */ - pstrFifoHandler->u32WriteOffset = u32BytesToWrite - u32FirstPart; - pstrFifoHandler->u32TotalBytes += u32BytesToWrite; - } - /* if data overwriten */ - if (pstrFifoHandler->u32TotalBytes > pstrFifoHandler->u32BufferLength) { - /* adjust read offset to the oldest data available */ - pstrFifoHandler->u32ReadOffset = pstrFifoHandler->u32WriteOffset; - /* data availabe is the buffer length */ - pstrFifoHandler->u32TotalBytes = pstrFifoHandler->u32BufferLength; - } - up(&pstrFifoHandler->SemBuffer); - } else { - u32Error = 1; - } - } else { - u32Error = 1; - } - } else { - u32Error = 1; - } - return u32Error; -} diff --git a/drivers/staging/wilc1000/fifo_buffer.h b/drivers/staging/wilc1000/fifo_buffer.h deleted file mode 100644 index 7b76998e4238..000000000000 --- a/drivers/staging/wilc1000/fifo_buffer.h +++ /dev/null @@ -1,26 +0,0 @@ - -#include -#include -#include "wilc_memory.h" -#include "wilc_strutils.h" - - -#define tHANDLE void * - -typedef struct { - u8 *pu8Buffer; - u32 u32BufferLength; - u32 u32WriteOffset; - u32 u32ReadOffset; - u32 u32TotalBytes; - struct semaphore SemBuffer; -} tstrFifoHandler; - - -extern u32 FIFO_InitBuffer(tHANDLE *hBuffer, - u32 u32BufferLength); -extern u32 FIFO_DeInit(tHANDLE hFifo); -extern u32 FIFO_ReadBytes(tHANDLE hFifo, u8 *pu8Buffer, - u32 u32BytesToRead, u32 *pu32BytesRead); -extern u32 FIFO_WriteBytes(tHANDLE hFifo, u8 *pu8Buffer, - u32 u32BytesToWrite, bool bForceOverWrite); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 38db740745cd..cdfb43a2b144 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -11,7 +11,6 @@ #define HOST_INT_H #include "coreconfigurator.h" -#include "coreconfigsimulator.h" /*****************************************************************************/ /* Macros */ /*****************************************************************************/ diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c deleted file mode 100644 index af9b85822ced..000000000000 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ /dev/null @@ -1,909 +0,0 @@ -/*! - * @file wilc_wfi_netdevice.c - * @brief File Operations OS wrapper functionality - * @author mdaftedar - * @sa wilc_wfi_netdevice.h - * @date 01 MAR 2012 - * @version 1.0 - */ - -#ifdef SIMULATION - -#include "wilc_wfi_cfgoperations.h" -#include "host_interface.h" - -MODULE_AUTHOR("Mai Daftedar"); -MODULE_LICENSE("Dual BSD/GPL"); - -struct net_device *WILC_WFI_devs[2]; - -/* - * Transmitter lockup simulation, normally disabled. - */ -static int lockup; -module_param(lockup, int, 0); - -static int timeout = WILC_WFI_TIMEOUT; -module_param(timeout, int, 0); - -/* - * Do we run in NAPI mode? - */ -static int use_napi; -module_param(use_napi, int, 0); - -/* - * A structure representing an in-flight packet. - */ -struct WILC_WFI_packet { - struct WILC_WFI_packet *next; - struct net_device *dev; - int datalen; - u8 data[ETH_DATA_LEN]; -}; - -int pool_size = 8; -module_param(pool_size, int, 0); - -static void WILC_WFI_TxTimeout(struct net_device *dev); -static void (*WILC_WFI_Interrupt)(int, void *, struct pt_regs *); - -/** - * @brief WILC_WFI_SetupPool - * @details Set up a device's packet pool. - * @param[in] struct net_device *dev : Network Device Pointer - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_SetupPool(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - int i; - struct WILC_WFI_packet *pkt; - - priv->ppool = NULL; - for (i = 0; i < pool_size; i++) { - pkt = kmalloc(sizeof(struct WILC_WFI_packet), GFP_KERNEL); - if (pkt == NULL) { - PRINT_D(RX_DBG, "Ran out of memory allocating packet pool\n"); - return; - } - pkt->dev = dev; - pkt->next = priv->ppool; - priv->ppool = pkt; - } -} - -/** - * @brief WILC_WFI_TearDownPool - * @details Internal cleanup function that's called after the network device - * driver is unregistered - * @param[in] struct net_device *dev : Network Device Driver - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_TearDownPool(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - struct WILC_WFI_packet *pkt; - - while ((pkt = priv->ppool)) { - priv->ppool = pkt->next; - kfree(pkt); - /* FIXME - in-flight packets ? */ - } -} - -/** - * @brief WILC_WFI_GetTxBuffer - * @details Buffer/pool management - * @param[in] net_device *dev : Network Device Driver Structure - * @return struct WILC_WFI_packet - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -struct WILC_WFI_packet *WILC_WFI_GetTxBuffer(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - unsigned long flags; - struct WILC_WFI_packet *pkt; - - spin_lock_irqsave(&priv->lock, flags); - pkt = priv->ppool; - priv->ppool = pkt->next; - if (priv->ppool == NULL) { - PRINT_INFO(RX_DBG, "Pool empty\n"); - netif_stop_queue(dev); - } - spin_unlock_irqrestore(&priv->lock, flags); - return pkt; -} -/** - * @brief WILC_WFI_ReleaseBuffer - * @details Buffer/pool management - * @param[in] WILC_WFI_packet *pkt : Structure holding in-flight packet - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_ReleaseBuffer(struct WILC_WFI_packet *pkt) -{ - unsigned long flags; - struct WILC_WFI_priv *priv = netdev_priv(pkt->dev); - - spin_lock_irqsave(&priv->lock, flags); - pkt->next = priv->ppool; - priv->ppool = pkt; - spin_unlock_irqrestore(&priv->lock, flags); - if (netif_queue_stopped(pkt->dev) && pkt->next == NULL) - netif_wake_queue(pkt->dev); -} - -/** - * @brief WILC_WFI_EnqueueBuf - * @details Enqueuing packets in an RX buffer queue - * @param[in] WILC_WFI_packet *pkt : Structure holding in-flight packet - * @param[in] net_device *dev : Network Device Driver Structure - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_EnqueueBuf(struct net_device *dev, struct WILC_WFI_packet *pkt) -{ - unsigned long flags; - struct WILC_WFI_priv *priv = netdev_priv(dev); - - spin_lock_irqsave(&priv->lock, flags); - pkt->next = priv->rx_queue; /* FIXME - misorders packets */ - priv->rx_queue = pkt; - spin_unlock_irqrestore(&priv->lock, flags); -} - -/** - * @brief WILC_WFI_DequeueBuf - * @details Dequeuing packets from the RX buffer queue - * @param[in] net_device *dev : Network Device Driver Structure - * @return WILC_WFI_packet *pkt : Structure holding in-flight pac - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -struct WILC_WFI_packet *WILC_WFI_DequeueBuf(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - struct WILC_WFI_packet *pkt; - unsigned long flags; - - spin_lock_irqsave(&priv->lock, flags); - pkt = priv->rx_queue; - if (pkt != NULL) - priv->rx_queue = pkt->next; - spin_unlock_irqrestore(&priv->lock, flags); - return pkt; -} -/** - * @brief WILC_WFI_RxInts - * @details Enable and disable receive interrupts. - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] enable : Enable/Disable flag - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -static void WILC_WFI_RxInts(struct net_device *dev, int enable) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - - priv->rx_int_enabled = enable; -} - -/** - * @brief WILC_WFI_Open - * @details Open Network Device Driver, called when the network - * interface is opened. It starts the interface's transmit queue. - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] enable : Enable/Disable flag - * @return int : Returns 0 upon success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Open(struct net_device *dev) -{ - /* request_region(), request_irq(), .... (like fops->open) */ - /* - * Assign the hardware address of the board: use "\0SNULx", where - * x is 0 or 1. The first byte is '\0' to avoid being a multicast - * address (the first byte of multicast addrs is odd). - */ - memcpy(dev->dev_addr, "\0WLAN0", ETH_ALEN); - if (dev == WILC_WFI_devs[1]) - dev->dev_addr[ETH_ALEN - 1]++; /* \0SNUL1 */ - - WILC_WFI_InitHostInt(dev); - netif_start_queue(dev); - return 0; -} -/** - * @brief WILC_WFI_Release - * @details Release Network Device Driver, called when the network - * interface is stopped or brought down. This function marks - * the network driver as not being able to transmit - * @param[in] net_device *dev : Network Device Driver Structure - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Release(struct net_device *dev) -{ - /* release ports, irq and such -- like fops->close */ - netif_stop_queue(dev); /* can't transmit any more */ - - return 0; -} -/** - * @brief WILC_WFI_Config - * @details Configuration changes (passed on by ifconfig) - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] struct ifmap *map : Contains the ioctl implementation for the - * network driver. - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Config(struct net_device *dev, struct ifmap *map) -{ - if (dev->flags & IFF_UP) /* can't act on a running interface */ - return -EBUSY; - - /* Don't allow changing the I/O address */ - if (map->base_addr != dev->base_addr) { - PRINT_D(RX_DBG, KERN_WARNING "WILC_WFI: Can't change I/O address\n"); - return -EOPNOTSUPP; - } - - /* Allow changing the IRQ */ - if (map->irq != dev->irq) { - dev->irq = map->irq; - /* request_irq() is delayed to open-time */ - } - - /* ignore other fields */ - return 0; -} -/** - * @brief WILC_WFI_Rx - * @details Receive a packet: retrieve, encapsulate and pass over to upper - * levels - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] WILC_WFI_packet : - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_Rx(struct net_device *dev, struct WILC_WFI_packet *pkt) -{ - int i; - struct sk_buff *skb; - struct WILC_WFI_priv *priv = netdev_priv(dev); - s8 rssi; - /* - * The packet has been retrieved from the transmission - * medium. Build an skb around it, so upper layers can handle it - */ - - - skb = dev_alloc_skb(pkt->datalen + 2); - if (!skb) { - if (printk_ratelimit()) - PRINT_D(RX_DBG, "WILC_WFI rx: low on mem - packet dropped\n"); - priv->stats.rx_dropped++; - goto out; - } - skb_reserve(skb, 2); /* align IP on 16B boundary */ - memcpy(skb_put(skb, pkt->datalen), pkt->data, pkt->datalen); - - if (priv->monitor_flag) { - PRINT_INFO(RX_DBG, "In monitor device name %s\n", dev->name); - priv = wiphy_priv(priv->dev->ieee80211_ptr->wiphy); - PRINT_D(RX_DBG, "VALUE PASSED IN OF HRWD %p\n", priv->hWILCWFIDrv); - if (INFO) { - for (i = 14; i < skb->len; i++) - PRINT_INFO(RX_DBG, "RXdata[%d] %02x\n", i, skb->data[i]); - } - WILC_WFI_monitor_rx(dev, skb); - return; - } -out: - return; -} - -/** - * @brief WILC_WFI_Poll - * @details The poll implementation - * @param[in] struct napi_struct *napi : - * @param[in] int budget : - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -static int WILC_WFI_Poll(struct napi_struct *napi, int budget) -{ - int npackets = 0; - struct sk_buff *skb; - struct WILC_WFI_priv *priv = container_of(napi, struct WILC_WFI_priv, napi); - struct net_device *dev = priv->dev; - struct WILC_WFI_packet *pkt; - - while (npackets < budget && priv->rx_queue) { - pkt = WILC_WFI_DequeueBuf(dev); - skb = dev_alloc_skb(pkt->datalen + 2); - if (!skb) { - if (printk_ratelimit()) - PRINT_D(RX_DBG, "WILC_WFI: packet dropped\n"); - priv->stats.rx_dropped++; - WILC_WFI_ReleaseBuffer(pkt); - continue; - } - skb_reserve(skb, 2); /* align IP on 16B boundary */ - memcpy(skb_put(skb, pkt->datalen), pkt->data, pkt->datalen); - skb->dev = dev; - skb->protocol = eth_type_trans(skb, dev); - skb->ip_summed = CHECKSUM_UNNECESSARY; /* don't check it */ - netif_receive_skb(skb); - /* Maintain stats */ - npackets++; - WILC_WFI_update_stats(priv->dev->ieee80211_ptr->wiphy, pkt->datalen, WILC_WFI_RX_PKT); - WILC_WFI_ReleaseBuffer(pkt); - } - /* If we processed all packets, we're done; tell the kernel and re-enable ints */ - if (npackets < budget) { - napi_complete(napi); - WILC_WFI_RxInts(dev, 1); - } - return npackets; -} - -/** - * @brief WILC_WFI_Poll - * @details The typical interrupt entry point - * @param[in] struct napi_struct *napi : - * @param[in] int budget : - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -static void WILC_WFI_RegularInterrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - int statusword; - struct WILC_WFI_priv *priv; - struct WILC_WFI_packet *pkt = NULL; - /* - * As usual, check the "device" pointer to be sure it is - * really interrupting. - * Then assign "struct device *dev" - */ - struct net_device *dev = (struct net_device *)dev_id; - /* ... and check with hw if it's really ours */ - - /* paranoid */ - if (!dev) - return; - - /* Lock the device */ - priv = netdev_priv(dev); - spin_lock(&priv->lock); - - /* retrieve statusword: real netdevices use I/O instructions */ - statusword = priv->status; - priv->status = 0; - if (statusword & WILC_WFI_RX_INTR) { - /* send it to WILC_WFI_rx for handling */ - pkt = priv->rx_queue; - if (pkt) { - priv->rx_queue = pkt->next; - WILC_WFI_Rx(dev, pkt); - } - } - if (statusword & WILC_WFI_TX_INTR) { - /* a transmission is over: free the skb */ - WILC_WFI_update_stats(priv->dev->ieee80211_ptr->wiphy, priv->tx_packetlen, WILC_WFI_TX_PKT); - dev_kfree_skb(priv->skb); - } - - /* Unlock the device and we are done */ - spin_unlock(&priv->lock); - if (pkt) - WILC_WFI_ReleaseBuffer(pkt); /* Do this outside the lock! */ - return; -} -/** - * @brief WILC_WFI_NapiInterrupt - * @details A NAPI interrupt handler - * @param[in] irq: - * @param[in] dev_id: - * @param[in] pt_regs: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -static void WILC_WFI_NapiInterrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - int statusword; - struct WILC_WFI_priv *priv; - - /* - * As usual, check the "device" pointer for shared handlers. - * Then assign "struct device *dev" - */ - struct net_device *dev = (struct net_device *)dev_id; - /* ... and check with hw if it's really ours */ - - /* paranoid */ - if (!dev) - return; - - /* Lock the device */ - priv = netdev_priv(dev); - spin_lock(&priv->lock); - - /* retrieve statusword: real netdevices use I/O instructions */ - statusword = priv->status; - priv->status = 0; - if (statusword & WILC_WFI_RX_INTR) { - WILC_WFI_RxInts(dev, 0); /* Disable further interrupts */ - napi_schedule(&priv->napi); - } - if (statusword & WILC_WFI_TX_INTR) { - /* a transmission is over: free the skb */ - - WILC_WFI_update_stats(priv->dev->ieee80211_ptr->wiphy, priv->tx_packetlen, WILC_WFI_TX_PKT); - dev_kfree_skb(priv->skb); - } - - /* Unlock the device and we are done */ - spin_unlock(&priv->lock); - return; -} - -/** - * @brief MI_WFI_HwTx - * @details Transmit a packet (low level interface) - * @param[in] buf: - * @param[in] len: - * @param[in] net_device *dev: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_HwTx(char *buf, int len, struct net_device *dev) -{ - /* - * This function deals with hw details. This interface loops - * back the packet to the other WILC_WFI interface (if any). - * In other words, this function implements the WILC_WFI behaviour, - * while all other procedures are rather device-independent - */ - struct iphdr *ih; - struct net_device *dest; - struct WILC_WFI_priv *priv; - u32 *saddr, *daddr; - struct WILC_WFI_packet *tx_buffer; - - /* I am paranoid. Ain't I? */ - if (len < sizeof(struct ethhdr) + sizeof(struct iphdr)) { - PRINT_D(RX_DBG, "WILC_WFI: Hmm... packet too short (%i octets)\n", - len); - return; - } - - if (0) { /* enable this conditional to look at the data */ - int i; - - PRINT_D(RX_DBG, "len is %i", len); - for (i = 14; i < len; i++) - PRINT_D(RX_DBG, "TXdata[%d] %02x\n", i, buf[i] & 0xff); - /* PRINT_D(RX_DBG, "\n"); */ - } - /* - * Ethhdr is 14 bytes, but the kernel arranges for iphdr - * to be aligned (i.e., ethhdr is unaligned) - */ - ih = (struct iphdr *)(buf + sizeof(struct ethhdr)); - saddr = &ih->saddr; - daddr = &ih->daddr; - - ((u8 *)saddr)[2] ^= 1; /* change the third octet (class C) */ - ((u8 *)daddr)[2] ^= 1; - - ih->check = 0; /* and rebuild the checksum (ip needs it) */ - ih->check = ip_fast_csum((unsigned char *)ih, ih->ihl); - - - if (dev == WILC_WFI_devs[0]) - PRINT_D(RX_DBG, "%08x:%05i --> %08x:%05i\n", - ntohl(ih->saddr), ntohs(((struct tcphdr *)(ih + 1))->source), - ntohl(ih->daddr), ntohs(((struct tcphdr *)(ih + 1))->dest)); - else - PRINT_D(RX_DBG, "%08x:%05i <-- %08x:%05i\n", - ntohl(ih->daddr), ntohs(((struct tcphdr *)(ih + 1))->dest), - ntohl(ih->saddr), ntohs(((struct tcphdr *)(ih + 1))->source)); - - /* - * Ok, now the packet is ready for transmission: first simulate a - * receive interrupt on the twin device, then a - * transmission-done on the transmitting device - */ - dest = WILC_WFI_devs[dev == WILC_WFI_devs[0] ? 1 : 0]; - priv = netdev_priv(dest); - - tx_buffer = WILC_WFI_GetTxBuffer(dev); - tx_buffer->datalen = len; - memcpy(tx_buffer->data, buf, len); - WILC_WFI_EnqueueBuf(dest, tx_buffer); - if (priv->rx_int_enabled) { - priv->status |= WILC_WFI_RX_INTR; - WILC_WFI_Interrupt(0, dest, NULL); - } - - priv = netdev_priv(dev); - priv->tx_packetlen = len; - priv->tx_packetdata = buf; - priv->status |= WILC_WFI_TX_INTR; - if (lockup && ((priv->stats.tx_packets + 1) % lockup) == 0) { - /* Simulate a dropped transmit interrupt */ - netif_stop_queue(dev); - PRINT_D(RX_DBG, "Simulate lockup at %ld, txp %ld\n", jiffies, - (unsigned long) priv->stats.tx_packets); - } else - WILC_WFI_Interrupt(0, dev, NULL); -} - -/** - * @brief WILC_WFI_Tx - * @details Transmit a packet (called by the kernel) - * @param[in] sk_buff *skb: - * @param[in] net_device *dev: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Tx(struct sk_buff *skb, struct net_device *dev) -{ - int len; - char *data, shortpkt[ETH_ZLEN]; - struct WILC_WFI_priv *priv = netdev_priv(dev); - - data = skb->data; - len = skb->len; - - if (len < ETH_ZLEN) { - memset(shortpkt, 0, ETH_ZLEN); - memcpy(shortpkt, skb->data, skb->len); - len = ETH_ZLEN; - data = shortpkt; - } - dev->trans_start = jiffies; /* save the timestamp */ - - /* Remember the skb, so we can free it at interrupt time */ - priv->skb = skb; - - /* actual deliver of data is device-specific, and not shown here */ - WILC_WFI_HwTx(data, len, dev); - - return 0; /* Our simple device can not fail */ -} - -/** - * @brief WILC_WFI_TxTimeout - * @details Deal with a transmit timeout. - * @param[in] net_device *dev: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_TxTimeout(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - - PRINT_D(RX_DBG, "Transmit timeout at %ld, latency %ld\n", jiffies, - jiffies - dev->trans_start); - /* Simulate a transmission interrupt to get things moving */ - priv->status = WILC_WFI_TX_INTR; - WILC_WFI_Interrupt(0, dev, NULL); - priv->stats.tx_errors++; - netif_wake_queue(dev); - return; -} - -/** - * @brief WILC_WFI_Ioctl - * @details Ioctl commands - * @param[in] net_device *dev: - * @param[in] ifreq *rq - * @param[in] cmd: - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - PRINT_D(RX_DBG, "ioctl\n"); - return 0; -} - -/** - * @brief WILC_WFI_Stat - * @details Return statistics to the caller - * @param[in] net_device *dev: - * @return WILC_WFI_Stats : Return net_device_stats stucture with the - * network device driver private data contents. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -struct net_device_stats *WILC_WFI_Stats(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - - return &priv->stats; -} - -/** - * @brief WILC_WFI_RebuildHeader - * @details This function is called to fill up an eth header, since arp is not - * available on the interface - * @param[in] sk_buff *skb: - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_RebuildHeader(struct sk_buff *skb) -{ - struct ethhdr *eth = (struct ethhdr *) skb->data; - struct net_device *dev = skb->dev; - - memcpy(eth->h_source, dev->dev_addr, dev->addr_len); - memcpy(eth->h_dest, dev->dev_addr, dev->addr_len); - eth->h_dest[ETH_ALEN - 1] ^= 0x01; /* dest is us xor 1 */ - return 0; -} -/** - * @brief WILC_WFI_RebuildHeader - * @details This function is called to fill up an eth header, since arp is not - * available on the interface - * @param[in] sk_buff *skb: - * @param[in] struct net_device *dev: - * @param[in] unsigned short type: - * @param[in] const void *saddr, - * @param[in] const void *daddr: - * @param[in] unsigned int len - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Header(struct sk_buff *skb, struct net_device *dev, - unsigned short type, const void *daddr, const void *saddr, - unsigned int len) -{ - struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); - - eth->h_proto = htons(type); - memcpy(eth->h_source, saddr ? saddr : dev->dev_addr, dev->addr_len); - memcpy(eth->h_dest, daddr ? daddr : dev->dev_addr, dev->addr_len); - eth->h_dest[ETH_ALEN - 1] ^= 0x01; /* dest is us xor 1 */ - return dev->hard_header_len; -} - -/** - * @brief WILC_WFI_ChangeMtu - * @details The "change_mtu" method is usually not needed. - * If you need it, it must be like this. - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] new_mtu : - * @return int : Returns 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_ChangeMtu(struct net_device *dev, int new_mtu) -{ - unsigned long flags; - struct WILC_WFI_priv *priv = netdev_priv(dev); - spinlock_t *lock = &priv->lock; - - /* check ranges */ - if ((new_mtu < 68) || (new_mtu > 1500)) - return -EINVAL; - /* - * Do anything you need, and the accept the value - */ - spin_lock_irqsave(lock, flags); - dev->mtu = new_mtu; - spin_unlock_irqrestore(lock, flags); - return 0; /* success */ -} - -static const struct header_ops WILC_WFI_header_ops = { - .create = WILC_WFI_Header, - .rebuild = WILC_WFI_RebuildHeader, - .cache = NULL, /* disable caching */ -}; - - -static const struct net_device_ops WILC_WFI_netdev_ops = { - .ndo_open = WILC_WFI_Open, - .ndo_stop = WILC_WFI_Release, - .ndo_set_config = WILC_WFI_Config, - .ndo_start_xmit = WILC_WFI_Tx, - .ndo_do_ioctl = WILC_WFI_Ioctl, - .ndo_get_stats = WILC_WFI_Stats, - .ndo_change_mtu = WILC_WFI_ChangeMtu, - .ndo_tx_timeout = WILC_WFI_TxTimeout, -}; - -/** - * @brief WILC_WFI_Init - * @details The init function (sometimes called probe). - * It is invoked by register_netdev() - * @param[in] net_device *dev: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_Init(struct net_device *dev) -{ - struct WILC_WFI_priv *priv; - - /* - * Then, assign other fields in dev, using ether_setup() and some - * hand assignments - */ - ether_setup(dev); /* assign some of the fields */ - /* 1- Allocate space */ - - dev->netdev_ops = &WILC_WFI_netdev_ops; - dev->header_ops = &WILC_WFI_header_ops; - dev->watchdog_timeo = timeout; - /* keep the default flags, just add NOARP */ - dev->flags |= IFF_NOARP; - dev->features |= NETIF_F_NO_CSUM; - /* - * Then, initialize the priv field. This encloses the statistics - * and a few private fields. - */ - priv = netdev_priv(dev); - memset(priv, 0, sizeof(struct WILC_WFI_priv)); - priv->dev = dev; - netif_napi_add(dev, &priv->napi, WILC_WFI_Poll, 2); - /* The last parameter above is the NAPI "weight". */ - spin_lock_init(&priv->lock); - WILC_WFI_RxInts(dev, 1); /* enable receive interrupts */ - WILC_WFI_SetupPool(dev); -} - -/** - * @brief WILC_WFI_Stat - * @details Return statistics to the caller - * @param[in] net_device *dev: - * @return WILC_WFI_Stats : Return net_device_stats stucture with the - * network device driver private data contents. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ - -void WILC_WFI_Cleanup(void) -{ - int i; - struct WILC_WFI_priv *priv[2]; - - for (i = 0; i < 2; i++) { - priv[i] = netdev_priv(WILC_WFI_devs[i]); - - if (WILC_WFI_devs[i]) { - PRINT_D(RX_DBG, "Unregistering\n"); - unregister_netdev(WILC_WFI_devs[i]); - WILC_WFI_TearDownPool(WILC_WFI_devs[i]); - free_netdev(WILC_WFI_devs[i]); - PRINT_D(RX_DBG, "[NETDEV]Stopping interface\n"); - WILC_WFI_DeInitHostInt(WILC_WFI_devs[i]); - WILC_WFI_WiphyFree(WILC_WFI_devs[i]); - } - - } - /* unregister_netdev(hwsim_mon); */ - WILC_WFI_deinit_mon_interface(); - return; -} - - -void StartConfigSim(void); - -/** - * @brief WILC_WFI_Stat - * @details Return statistics to the caller - * @param[in] net_device *dev: - * @return WILC_WFI_Stats : Return net_device_stats stucture with the - * network device driver private data contents. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_InitModule(void) -{ - - int result, i, ret = -ENOMEM; - struct WILC_WFI_priv *priv[2], *netpriv; - struct wireless_dev *wdev; - - WILC_WFI_Interrupt = use_napi ? WILC_WFI_NapiInterrupt : WILC_WFI_RegularInterrupt; - - for (i = 0; i < 2; i++) { - /* Allocate the net devices */ - WILC_WFI_devs[i] = alloc_netdev(sizeof(struct WILC_WFI_priv), "wlan%d", - WILC_WFI_Init); - if (WILC_WFI_devs[i] == NULL) - goto out; - - wdev = WILC_WFI_WiphyRegister(WILC_WFI_devs[i]); - WILC_WFI_devs[i]->ieee80211_ptr = wdev; - netpriv = netdev_priv(WILC_WFI_devs[i]); - netpriv->dev->ieee80211_ptr = wdev; - netpriv->dev->ml_priv = netpriv; - wdev->netdev = netpriv->dev; - - /*Registering the net device*/ - result = register_netdev(WILC_WFI_devs[i]); - if (result) - PRINT_D(RX_DBG, "WILC_WFI: error %i registering device \"%s\"\n", - result, WILC_WFI_devs[i]->name); - else - ret = 0; - } - - /*init atmel driver */ - priv[0] = netdev_priv(WILC_WFI_devs[0]); - priv[1] = netdev_priv(WILC_WFI_devs[1]); - - priv[0]->bCfgScanning = false; - priv[0]->u32RcvdChCount = 0; - - WILC_memset(priv[0]->au8AssociatedBss, 0xFF, ETH_ALEN); - - if (ret) - PRINT_ER("Error Init Driver\n"); - -out: - if (ret) - WILC_WFI_Cleanup(); - return ret; - - -} - -module_init(WILC_WFI_InitModule); -module_exit(WILC_WFI_Cleanup); - -#endif From 5f8966d91e2e87ac9455aa5b2c10fccefa6d59a4 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:21 +0900 Subject: [PATCH 499/912] staging: wilc1000: describe the config symbol fully This patch removes the warnings reported by checkpatch.pl on the short description for the config symbol in the Kconfig by adding more comments to describe the config symbol in more detail. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Kconfig | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig index 062d9c5ca4bd..51bbf468fe45 100644 --- a/drivers/staging/wilc1000/Kconfig +++ b/drivers/staging/wilc1000/Kconfig @@ -37,17 +37,26 @@ choice bool "SDIO support" depends on MMC ---help--- - This module adds support for the SDIO interface - of adapters using WILC chipset. Select this if - your platform is using the SDIO bus. + This module adds support for the SDIO interface of adapters using + WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface. + It meets SDIO card specification version 2.0. The interface supports + the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz. + The host can use this interface to read and write from any register + within the chip as well as configure the WILC1000 for data DMA. + To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select + this if your platform is using the SDIO bus. config WILC1000_SPI depends on SPI bool "SPI support" ---help--- - This module adds support for the SPI interface - of adapters using WILC chipset. Select this if - your platform is using the SPI bus. + This module adds support for the SPI interface of adapters using + WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral + Interface (SPI) that operates as a SPI slave. This SPI interface can + be used for control and for serial I/O of 802.11 data. The SPI is a + full-duplex slave synchronous serial interface that is available + immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to + VDDIO. Select this if your platform is using the SPI bus. endchoice config WILC1000_HW_OOB_INTR @@ -55,5 +64,8 @@ config WILC1000_HW_OOB_INTR depends on WILC1000 && WILC1000_SDIO default n ---help--- - If your platform don't recognize SDIO IRQ, connect chipset external IRQ pin - and check this option. Or, Use this to get all interrupts including SDIO interrupts. + This option enables out-of-band interrupt support for the WILC1000 + chipset. This OOB interrupt is intended to provide a faster interrupt + mechanism for SDIO host controllers that don't support SDIO interrupt. + Select this option If the SDIO host controller in your platform + doesn't support SDIO time devision interrupt. From 9690df3f9de3689e7d2e916189761fff4754cd72 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:22 +0900 Subject: [PATCH 500/912] staging: wilc1000: remove dead codes related to SIMULATION This patch removes preprocessor conditionals (#ifdef or #ifndef) related to SIMULATION definition from the codes becasue that SIMULATION feature is not used anymore. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 86 ------------------- drivers/staging/wilc1000/host_interface.c | 23 ----- drivers/staging/wilc1000/linux_mon.c | 15 +--- drivers/staging/wilc1000/linux_wlan.c | 2 - .../staging/wilc1000/wilc_wfi_cfgoperations.c | 13 --- 5 files changed, 3 insertions(+), 136 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index b0696141e10f..8bacd8cfd945 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1877,89 +1877,6 @@ s32 ConfigWaitResponse(char *pcRespBuffer, s32 s32MaxRespBuffLen, s32 *ps32Bytes return s32Error; } -/** - * @brief sends certain Configuration Packet based on the input WIDs pstrWIDs - * and retrieves the packet response pu8RxResp - * @details - * @param[in] pstrWIDs WIDs to be sent in the configuration packet - * @param[in] u32WIDsCount number of WIDs to be sent in the configuration packet - * @param[out] pu8RxResp The received Packet Response - * @param[out] ps32RxRespLen Length of the received Packet Response - * @return Error code indicating success/failure - * @note - * @author mabubakr - * @date 1 Mar 2012 - * @version 1.0 - */ -#ifdef SIMULATION -s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - u32 u32WIDsCount, bool bRespRequired, u32 drvHandler) -{ - s32 s32Error = WILC_SUCCESS; - s32 err = WILC_SUCCESS; - s32 s32ConfigPacketLen = 0; - s32 s32RcvdRespLen = 0; - - down(&SemHandleSendPkt); - - /*set the packet mode*/ - g_oper_mode = u8Mode; - - WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); - - if (CreateConfigPacket(gps8ConfigPacket, &s32ConfigPacketLen, pstrWIDs, u32WIDsCount) != WILC_SUCCESS) { - s32Error = WILC_FAIL; - goto End_ConfigPkt; - } - /*bug 3878*/ - gstrConfigPktInfo.pcRespBuffer = gps8ConfigPacket; - gstrConfigPktInfo.s32MaxRespBuffLen = MAX_PACKET_BUFF_SIZE; - PRINT_INFO(CORECONFIG_DBG, "GLOBAL =bRespRequired =%d\n", bRespRequired); - gstrConfigPktInfo.bRespRequired = bRespRequired; - - s32Error = SendRawPacket(gps8ConfigPacket, s32ConfigPacketLen); - if (s32Error != WILC_SUCCESS) { - goto End_ConfigPkt; - } - - WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); - - ConfigWaitResponse(gps8ConfigPacket, MAX_PACKET_BUFF_SIZE, &s32RcvdRespLen, bRespRequired); - - - if (bRespRequired) { - /* If the operating Mode is GET, then we expect a response frame from */ - /* the driver. Hence start listening to the port for response */ - if (g_oper_mode == GET_CFG) { - #if 1 - err = ParseResponse(gps8ConfigPacket, pstrWIDs); - if (err != 0) { - s32Error = WILC_FAIL; - goto End_ConfigPkt; - } else { - s32Error = WILC_SUCCESS; - } - #endif - } else { - err = ParseWriteResponse(gps8ConfigPacket); - if (err != WRITE_RESP_SUCCESS) { - s32Error = WILC_FAIL; - goto End_ConfigPkt; - } else { - s32Error = WILC_SUCCESS; - } - } - - - } - - -End_ConfigPkt: - up(&SemHandleSendPkt); - - return s32Error; -} -#endif s32 ConfigProvideResponse(char *pcRespBuffer, s32 s32RespLen) { s32 s32Error = WILC_SUCCESS; @@ -2052,8 +1969,6 @@ s32 CoreConfiguratorDeInit(void) return s32Error; } - -#ifndef SIMULATION /*Using the global handle of the driver*/ extern wilc_wlan_oup_t *gpstrWlanOps; /** @@ -2127,4 +2042,3 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, return ret; } -#endif diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c089e739465a..02aaf39bf28d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -570,9 +570,7 @@ static u8 gs8GetIP[2][4]; static u32 gu32InactiveTime; static u8 gu8DelBcn; #endif -#ifndef SIMULATION static u32 gu32WidConnRstHack; -#endif /*BugID_5137*/ u8 *gu8FlushedJoinReq; @@ -1626,14 +1624,12 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon strWIDList[u32WidsCount].ps8WidVal = (s8 *)&u8bssDscListIndex; u32WidsCount++; - #ifndef SIMULATION /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the * firmware at chip reset when processing the WIDs of the Connect Request. * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ /* ////////////////////// */ gu32WidConnRstHack = 0; /* ////////////////////// */ - #endif s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv); if (s32Error) { @@ -1936,14 +1932,12 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/ u32WidsCount++; - #ifndef SIMULATION /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the * firmware at chip reset when processing the WIDs of the Connect Request. * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ /* ////////////////////// */ gu32WidConnRstHack = 0; /* ////////////////////// */ - #endif /*BugID_5137*/ if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { @@ -6586,12 +6580,6 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); down(&(pstrWFIDrv->gtOsCfgValuesSem)); - - -#ifdef SIMULATION - TransportInit(); -#endif - pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; /* gWFiDrvHandle->bPendingConnRequest = false; */ @@ -6627,11 +6615,6 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) goto _fail_mem_; } -#ifdef SIMULATION - /*Initialize Simulaor*/ - CoreConfigSimulatorInit(); -#endif - u32Intialized = 1; clients_count++; /* increase number of created entities */ @@ -6731,13 +6714,7 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; } /*deinit configurator and simulator*/ -#ifdef SIMULATION - CoreConfigSimulatorDeInit(); -#endif CoreConfiguratorDeInit(); -#ifdef SIMULATION - TransportDeInit(); -#endif pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index d812a3b194f3..aa20421021fa 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -6,20 +6,15 @@ * @date 01 MAR 2012 * @version 1.0 */ - -#ifndef SIMULATION #include "wilc_wfi_cfgoperations.h" #include "linux_wlan_common.h" #include "wilc_wlan_if.h" #include "wilc_wlan.h" -#endif + #ifdef WILC_FULLY_HOSTING_AP #include "wilc_host_ap.h" #endif #ifdef WILC_AP_EXTERNAL_MLME -#ifdef SIMULATION -#include "wilc_wfi_cfgoperations.h" -#endif struct wilc_wfi_radiotap_hdr { struct ieee80211_radiotap_header hdr; @@ -39,9 +34,7 @@ extern linux_wlan_t *g_linux_wlan; static struct net_device *wilc_wfi_mon; /* global monitor netdev */ -#ifdef SIMULATION -extern int WILC_WFI_Tx(struct sk_buff *skb, struct net_device *dev); -#elif USE_WIRELESS +#if USE_WIRELESS extern int mac_xmit(struct sk_buff *skb, struct net_device *dev); #endif @@ -374,9 +367,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, PRINT_INFO(HOSTAPD_DBG, "SKB netdevice name = %s\n", skb->dev->name); PRINT_INFO(HOSTAPD_DBG, "MONITOR real dev name = %s\n", mon_priv->real_ndev->name); - #ifdef SIMULATION - ret = WILC_WFI_Tx(skb, mon_priv->real_ndev); - #elif USE_WIRELESS + #if USE_WIRELESS /* Identify if Ethernet or MAC header (data or mgmt) */ memcpy(srcAdd, &skb->data[10], 6); memcpy(bssid, &skb->data[16], 6); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 5a794df0da4d..10ea53a60a06 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1,4 +1,3 @@ -#ifndef SIMULATION #include "wilc_wfi_cfgoperations.h" #include "linux_wlan_common.h" #include "wilc_wlan_if.h" @@ -2778,4 +2777,3 @@ static void __exit exit_wilc_driver(void) module_exit(exit_wilc_driver); MODULE_LICENSE("GPL"); -#endif diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 1d0b7f87b100..c2ef46f4740b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2875,7 +2875,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev /*Remove the enteries of the previously connected clients*/ memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA * ETH_ALEN); - #ifndef SIMULATION #ifdef WILC_P2P interface_type = nic->iftype; nic->iftype = STATION_MODE; @@ -2953,7 +2952,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev host_int_set_power_mgmt(priv->hWILCWFIDrv, 1, 0); } #endif - #endif break; case NL80211_IFTYPE_P2P_CLIENT: @@ -2968,7 +2966,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev priv->wdev->iftype = type; nic->monitor_flag = 0; - #ifndef SIMULATION #ifdef WILC_P2P PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n"); @@ -3042,7 +3039,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev } } #endif - #endif break; case NL80211_IFTYPE_AP: @@ -3053,7 +3049,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev nic->iftype = AP_MODE; PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); - #ifndef SIMULATION PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n"); linux_wlan_get_firmware(nic); #ifdef WILC_P2P @@ -3075,7 +3070,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev } } #endif - #endif break; case NL80211_IFTYPE_P2P_GO: @@ -3099,7 +3093,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); - #ifndef SIMULATION #ifdef WILC_P2P PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n"); @@ -3174,7 +3167,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev } } #endif - #endif break; default: @@ -3570,13 +3562,8 @@ struct wireless_dev *WILC_WFI_add_virt_intf(struct wiphy *wiphy, const char *nam new_ifc = WILC_WFI_init_mon_interface(name, nic->wilc_netdev); if (new_ifc != NULL) { PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n"); - #ifdef SIMULATION - priv = netdev_priv(priv->wdev->netdev); - priv->monitor_flag = 1; - #else nic = netdev_priv(priv->wdev->netdev); nic->monitor_flag = 1; - #endif } else PRINT_ER("Error in initializing monitor interface\n "); } From 0dff54785f92f832663d2af77cdd5b198fd90bb6 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:23 +0900 Subject: [PATCH 501/912] staging: wilc1000: remove warnings on the multiple line uses This patch removes the warnings reported by checkpatch.pl for using multiple blank lines. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 897e47e317ff..632b2b081fc6 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -10,7 +10,6 @@ #include "wilc_wlan_if.h" #include "wilc_wlan.h" - #ifdef WILC1000_SINGLE_TRANSFER #define WILC_SDIO_BLOCK_SIZE 256 #else @@ -90,7 +89,6 @@ static int sdio_set_func0_csa_address_byte0(uint32_t adr) { sdio_cmd52_t cmd; - /** * Review: BIG ENDIAN **/ @@ -222,8 +220,6 @@ uint32_t sdio_xfer_cnt(void) cnt |= (cmd.data << 16); return cnt; - - } /******************************************** @@ -412,7 +408,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) } - if (rest > 0) { cmd.block_mode = 1; cmd.increment = 1; @@ -458,7 +453,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) #endif /* platform */ } - if (nleft > 0) { cmd.block_mode = 0; cmd.increment = 1; @@ -622,7 +616,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) cmd.buffer = buf; cmd.block_size = block_size; - if (addr > 0) { if (!sdio_set_func0_csa_address(addr)) goto _fail_; @@ -639,7 +632,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) } - if (rest > 0) { cmd.block_mode = 1; cmd.increment = 1; @@ -898,7 +890,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) } g_sdio.dPrint(N_ERR, "[wilc sdio]: has_thrpt_enh3 = %d...\n", g_sdio.has_thrpt_enh3); - return 1; _fail_: @@ -1097,7 +1088,6 @@ static int sdio_clear_int_ext(uint32_t val) } #endif /* WILC_SDIO_IRQ_GPIO */ - { uint32_t vmm_ctl; @@ -1138,7 +1128,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) { uint32_t reg; - if (nint > MAX_NUM_INT) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Too many interupts (%d)...\n", nint); return 0; @@ -1148,7 +1137,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 0; } - g_sdio.nint = nint; /** @@ -1170,7 +1158,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) uint32_t reg; int ret, i; - /** * interrupt pin mux select **/ @@ -1225,7 +1212,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 1; } - /******************************************** * * Global sdio HIF function table From 9c844693eaf31eb8587a3bba37bbc8601ac4e5ca Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:24 +0900 Subject: [PATCH 502/912] staging: wilc1000: remove the warnings on missing blank line This patch removes the warnings reported by checkpatch.pl on missing a blank line after declaration. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 632b2b081fc6..6e865d417efb 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -168,6 +168,7 @@ static int sdio_clear_int(void) #ifndef WILC_SDIO_IRQ_GPIO /* uint32_t sts; */ sdio_cmd52_t cmd; + cmd.read_write = 0; cmd.function = 1; cmd.raw = 0; @@ -179,6 +180,7 @@ static int sdio_clear_int(void) return cmd.data; #else uint32_t reg; + if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) { g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); return 0; @@ -195,6 +197,7 @@ uint32_t sdio_xfer_cnt(void) { uint32_t cnt = 0; sdio_cmd52_t cmd; + cmd.read_write = 0; cmd.function = 1; cmd.raw = 0; @@ -259,6 +262,7 @@ static int sdio_write_reg(uint32_t addr, uint32_t data) if ((addr >= 0xf0) && (addr <= 0xff)) { sdio_cmd52_t cmd; + cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; @@ -482,6 +486,7 @@ static int sdio_read_reg(uint32_t addr, uint32_t *data) { if ((addr >= 0xf0) && (addr <= 0xff)) { sdio_cmd52_t cmd; + cmd.read_write = 0; cmd.function = 0; cmd.raw = 0; @@ -776,6 +781,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) sdio_cmd52_t cmd; int loop; uint32_t chipid; + memset(&g_sdio, 0, sizeof(wilc_sdio_t)); g_sdio.dPrint = func; @@ -977,6 +983,7 @@ static int sdio_read_int(uint32_t *int_status) } { int i; + for (i = g_sdio.nint; i < MAX_NUM_INT; i++) { if ((tmp >> (IRG_FLAGS_OFFSET + i)) & 0x1) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt (1) : tmp=%x, data=%x\n", tmp, cmd.data); @@ -1015,6 +1022,7 @@ static int sdio_clear_int_ext(uint32_t val) #ifdef WILC_SDIO_IRQ_GPIO { uint32_t flags; + flags = val & ((1 << MAX_NUN_INT_THRPT_ENH2) - 1); reg = flags; } @@ -1032,6 +1040,7 @@ static int sdio_clear_int_ext(uint32_t val) reg |= (1 << 7); if (reg) { sdio_cmd52_t cmd; + cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; @@ -1051,6 +1060,7 @@ static int sdio_clear_int_ext(uint32_t val) /* see below. has_thrpt_enh2 uses register 0xf8 to clear interrupts. */ /* Cannot clear multiple interrupts. Must clear each interrupt individually */ uint32_t flags; + flags = val & ((1 << MAX_NUM_INT) - 1); if (flags) { int i; @@ -1059,6 +1069,7 @@ static int sdio_clear_int_ext(uint32_t val) for (i = 0; i < g_sdio.nint; i++) { if (flags & 1) { sdio_cmd52_t cmd; + cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; From 4aa85772e3fa98646ce3b2a18b12c6474b853104 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:25 +0900 Subject: [PATCH 503/912] staging: wilc1000: remove the warnings on unnecessary braces This patch removes the warnings reported by checkpatch.pl on {} not necessary for the single statement blocks. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 6e865d417efb..967df95a4e02 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -106,6 +106,7 @@ static int sdio_set_func0_csa_address_byte0(uint32_t adr) _fail_: return 0; } + static int sdio_set_func0_block_size(uint32_t block_size) { sdio_cmd52_t cmd; @@ -963,24 +964,18 @@ static int sdio_read_int(uint32_t *int_status) cmd.data = 0; g_sdio.sdio_cmd52(&cmd); - if (cmd.data & (1 << 0)) { + if (cmd.data & (1 << 0)) tmp |= INT_0; - } - if (cmd.data & (1 << 2)) { + if (cmd.data & (1 << 2)) tmp |= INT_1; - } - if (cmd.data & (1 << 3)) { + if (cmd.data & (1 << 3)) tmp |= INT_2; - } - if (cmd.data & (1 << 4)) { + if (cmd.data & (1 << 4)) tmp |= INT_3; - } - if (cmd.data & (1 << 5)) { + if (cmd.data & (1 << 5)) tmp |= INT_4; - } - if (cmd.data & (1 << 6)) { + if (cmd.data & (1 << 6)) tmp |= INT_5; - } { int i; @@ -1087,9 +1082,8 @@ static int sdio_clear_int_ext(uint32_t val) break; flags >>= 1; } - if (!ret) { + if (!ret) goto _fail_; - } for (i = g_sdio.nint; i < MAX_NUM_INT; i++) { if (flags & 1) g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt cleared %d...\n", i); @@ -1193,9 +1187,8 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 0; } - for (i = 0; (i < 5) && (nint > 0); i++, nint--) { + for (i = 0; (i < 5) && (nint > 0); i++, nint--) reg |= (1 << (27 + i)); - } ret = sdio_write_reg(WILC_INTR_ENABLE, reg); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); @@ -1208,9 +1201,8 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 0; } - for (i = 0; (i < 3) && (nint > 0); i++, nint--) { + for (i = 0; (i < 3) && (nint > 0); i++, nint--) reg |= (1 << i); - } ret = sdio_read_reg(WILC_INTR2_ENABLE, ®); if (!ret) { From 229d7402bd8ffc58cacc22115011693257c21215 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:26 +0900 Subject: [PATCH 504/912] staging: wilc1000: remove preprocessor conditionals unused This patch removes unused preprocessor conditionals for the PLAT_AML8726_M3_BACKUP and PLAT_AML8726_M3 which are not used and so dead codes. They are also platform-dependent codes. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 174 +-------------------------- 1 file changed, 1 insertion(+), 173 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 967df95a4e02..ea545c9bf935 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -13,12 +13,7 @@ #ifdef WILC1000_SINGLE_TRANSFER #define WILC_SDIO_BLOCK_SIZE 256 #else - #if defined(PLAT_AML8726_M3) /* johnny */ - #define WILC_SDIO_BLOCK_SIZE 512 - #define MAX_SEG_SIZE (1 << 12) /* 4096 */ - #else - #define WILC_SDIO_BLOCK_SIZE 512 - #endif +#define WILC_SDIO_BLOCK_SIZE 512 #endif typedef struct { @@ -356,88 +351,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) nleft = size % block_size; if (nblk > 0) { - -#if defined(PLAT_AML8726_M3_BACKUP) /* johnny */ - int i; - - for (i = 0; i < nblk; i++) { - cmd.block_mode = 0; /* 1; */ - cmd.increment = 1; - cmd.count = block_size; /* nblk; */ - cmd.buffer = buf; - cmd.block_size = block_size; - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += block_size; /* addr += nblk*block_size; */ - - buf += block_size; /* buf += nblk*block_size; */ - } - -#elif defined(PLAT_AML8726_M3) /* johnny */ - - int i; - int rest; - int seg_cnt; - - seg_cnt = (nblk * block_size) / MAX_SEG_SIZE; - rest = (nblk * block_size) & (MAX_SEG_SIZE - 1); - - for (i = 0; i < seg_cnt; i++) { - cmd.block_mode = 1; - cmd.increment = 1; - cmd.count = MAX_SEG_SIZE / block_size; - cmd.buffer = buf; - cmd.block_size = block_size; - - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += MAX_SEG_SIZE; - - buf += MAX_SEG_SIZE; - - } - - if (rest > 0) { - cmd.block_mode = 1; - cmd.increment = 1; - cmd.count = rest / block_size; - cmd.buffer = buf; - cmd.block_size = block_size; /* johnny : prevent it from setting unexpected value */ - - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += rest; - - buf += rest; - - } - -#else - cmd.block_mode = 1; cmd.increment = 1; cmd.count = nblk; @@ -454,8 +367,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) if (addr > 0) addr += nblk * block_size; buf += nblk * block_size; - -#endif /* platform */ } if (nleft > 0) { @@ -582,87 +493,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) nleft = size % block_size; if (nblk > 0) { - -#if defined(PLAT_AML8726_M3_BACKUP) /* johnny */ - - int i; - - for (i = 0; i < nblk; i++) { - cmd.block_mode = 0; /* 1; */ - cmd.increment = 1; - cmd.count = block_size; /* nblk; */ - cmd.buffer = buf; - cmd.block_size = block_size; - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); - goto _fail_; - } - if (addr > 0) - addr += block_size; /* addr += nblk*block_size; */ - buf += block_size; /* buf += nblk*block_size; */ - } - -#elif defined(PLAT_AML8726_M3) /* johnny */ - - int i; - int rest; - int seg_cnt; - - seg_cnt = (nblk * block_size) / MAX_SEG_SIZE; - rest = (nblk * block_size) & (MAX_SEG_SIZE - 1); - - for (i = 0; i < seg_cnt; i++) { - cmd.block_mode = 1; - cmd.increment = 1; - cmd.count = MAX_SEG_SIZE / block_size; - cmd.buffer = buf; - cmd.block_size = block_size; - - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += MAX_SEG_SIZE; - - buf += MAX_SEG_SIZE; - - } - - if (rest > 0) { - cmd.block_mode = 1; - cmd.increment = 1; - cmd.count = rest / block_size; - cmd.buffer = buf; - cmd.block_size = block_size; /* johnny : prevent it from setting unexpected value */ - - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += rest; - - buf += rest; - - } - -#else - cmd.block_mode = 1; cmd.increment = 1; cmd.count = nblk; @@ -679,8 +509,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) if (addr > 0) addr += nblk * block_size; buf += nblk * block_size; - -#endif /* platform */ } /* if (nblk > 0) */ if (nleft > 0) { From 51a5fcaf718788b11e767640dc65c40f409de1a8 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:27 +0900 Subject: [PATCH 505/912] staging: wilc1000: remove a dead preprocessor conditionals This patch removes the preprocessor conditionals which are related to the WILC1000_SINGLE_TRANSFER definition becasue this is not used. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index ea545c9bf935..8f674adbdfee 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -10,11 +10,7 @@ #include "wilc_wlan_if.h" #include "wilc_wlan.h" -#ifdef WILC1000_SINGLE_TRANSFER -#define WILC_SDIO_BLOCK_SIZE 256 -#else #define WILC_SDIO_BLOCK_SIZE 512 -#endif typedef struct { void *os_context; @@ -321,16 +317,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) cmd.function = 0; cmd.address = 0x10f; } else { -#ifdef WILC1000_SINGLE_TRANSFER - /** - * has to be block aligned... - **/ - nleft = size % block_size; - if (nleft > 0) { - size += block_size; - size &= ~(block_size - 1); - } -#else /** * has to be word aligned... **/ @@ -338,7 +324,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) size += 4; size &= ~0x3; } -#endif /** * func 1 access @@ -463,16 +448,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) cmd.function = 0; cmd.address = 0x10f; } else { -#ifdef WILC1000_SINGLE_TRANSFER - /** - * has to be block aligned... - **/ - nleft = size % block_size; - if (nleft > 0) { - size += block_size; - size &= ~(block_size - 1); - } -#else /** * has to be word aligned... **/ @@ -480,7 +455,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) size += 4; size &= ~0x3; } -#endif /** * func 1 access From 232ced3d8fde6221231d5d541326cdb5e7afc50a Mon Sep 17 00:00:00 2001 From: "Jude.Lee" Date: Tue, 28 Jul 2015 17:47:30 +0900 Subject: [PATCH 506/912] staging: wilc1000: remove multiple blank lines This patch removes the warnings reported by checkpatch.pl for using multiple blank lines. Signed-off-by: Jude.Lee Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 9059c8df7ce5..3b4b01b26dd0 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -8,7 +8,6 @@ * @version 1.0 */ - #ifndef CORECONFIGURATOR_H #define CORECONFIGURATOR_H @@ -42,7 +41,6 @@ extern u16 g_num_total_switches; #define AID_LEN 2 #define IE_HDR_LEN 2 - /* Operating Mode: SET */ #define SET_CFG 0 /* Operating Mode: GET */ @@ -59,15 +57,12 @@ extern u16 g_num_total_switches; #define MAC_CONNECTED 1 #define MAC_DISCONNECTED 0 - - /*****************************************************************************/ /* Function Macros */ /*****************************************************************************/ #define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb)) #define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw)) - /*****************************************************************************/ /* Type Definitions */ /*****************************************************************************/ @@ -140,7 +135,6 @@ typedef struct { u16 u16RespIEsLen; } tstrConnectRespInfo; - typedef struct { u8 au8bssid[6]; u8 *pu8ReqIEs; @@ -150,8 +144,6 @@ typedef struct { u16 u16ConnectStatus; } tstrConnectInfo; - - typedef struct { u16 u16reason; u8 *ie; From 1e553d542bf9bb4bfb39ba6f130e2b62a356db57 Mon Sep 17 00:00:00 2001 From: "Jude.Lee" Date: Tue, 28 Jul 2015 17:47:31 +0900 Subject: [PATCH 507/912] staging: wilc1000: alignment should match open parenthesis This patch fixes the checks reported by checkpatch.pl alignment should match open parenthesis Signed-off-by: Jude.Lee Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 3b4b01b26dd0..56ff2ba139ed 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -167,17 +167,18 @@ extern s32 CoreConfiguratorInit(void); extern s32 CoreConfiguratorDeInit(void); extern s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - u32 u32WIDsCount, bool bRespRequired, u32 drvHandler); + u32 u32WIDsCount, bool bRespRequired, u32 drvHandler); extern s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); extern s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); extern s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, - tstrConnectRespInfo **ppstrConnectRespInfo); + tstrConnectRespInfo **ppstrConnectRespInfo); extern s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo); #ifndef CONNECT_DIRECT extern s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], - wid_site_survey_reslts_s **ppstrSurveyResults, u32 *pu32SurveyResultsCount); + wid_site_survey_reslts_s **ppstrSurveyResults, + u32 *pu32SurveyResultsCount); extern s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults); #endif From a0261e0b136b3535a5940179bdb95a8cc89eebd5 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:33 +0900 Subject: [PATCH 508/912] staging: wilc1000: remove warnings on unnecessary braces This patch removes the warnings reported by checkpatch.pl on the braces {} not necessary for any arm of this statement. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 8f674adbdfee..fd87add7c4cb 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -692,11 +692,10 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) goto _fail_; } g_sdio.dPrint(N_ERR, "[wilc sdio]: chipid (%08x)\n", chipid); - if ((chipid & 0xfff) > 0x2a0) { + if ((chipid & 0xfff) > 0x2a0) g_sdio.has_thrpt_enh3 = 1; - } else { + else g_sdio.has_thrpt_enh3 = 0; - } g_sdio.dPrint(N_ERR, "[wilc sdio]: has_thrpt_enh3 = %d...\n", g_sdio.has_thrpt_enh3); return 1; From 202f66a8169a2ab8c92656914867d56ff6510a44 Mon Sep 17 00:00:00 2001 From: Tony Cho Date: Tue, 28 Jul 2015 17:47:35 +0900 Subject: [PATCH 509/912] staging: wilc1000: remove unnecessary inner braces This patch removes unnecessary inner braces. Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 30 +++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index fd87add7c4cb..5a18148a593e 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -724,23 +724,21 @@ static int sdio_read_size(uint32_t *size) /** * Read DMA count in words **/ - { - cmd.read_write = 0; - cmd.function = 0; - cmd.raw = 0; - cmd.address = 0xf2; - cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); - tmp = cmd.data; + cmd.read_write = 0; + cmd.function = 0; + cmd.raw = 0; + cmd.address = 0xf2; + cmd.data = 0; + g_sdio.sdio_cmd52(&cmd); + tmp = cmd.data; - /* cmd.read_write = 0; */ - /* cmd.function = 0; */ - /* cmd.raw = 0; */ - cmd.address = 0xf3; - cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); - tmp |= (cmd.data << 8); - } + /* cmd.read_write = 0; */ + /* cmd.function = 0; */ + /* cmd.raw = 0; */ + cmd.address = 0xf3; + cmd.data = 0; + g_sdio.sdio_cmd52(&cmd); + tmp |= (cmd.data << 8); *size = tmp; return 1; From fc4b95d69c603668331d1edb92e3fb0dbcb1d959 Mon Sep 17 00:00:00 2001 From: "Kim, Leo" Date: Tue, 28 Jul 2015 17:47:37 +0900 Subject: [PATCH 510/912] staging: wilc1000: remove braces {} for single statement blocks This patch removes the warnings reported by checkpatch.pl on braces {} not necessary for the single statement blocks. Signed-off-by: Kim, Leo Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 78 +++++++++------------------ 1 file changed, 26 insertions(+), 52 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 10ea53a60a06..a4589b799db9 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -207,9 +207,8 @@ void printk_later(const char *format, ...) va_start (args, format); ps8current += vsprintf (ps8current, format, args); va_end (args); - if ((ps8current - DebugBuffer) > DEGUG_BUFFER_LENGTH) { + if ((ps8current - DebugBuffer) > DEGUG_BUFFER_LENGTH) ps8current = DebugBuffer; - } } @@ -779,9 +778,8 @@ struct net_device *GetIfHandler(uint8_t *pMacHeader) } } PRINT_INFO(INIT_DBG, "Invalide handle\n"); - for (i = 0; i < 25; i++) { + for (i = 0; i < 25; i++) PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]); - } Bssid = pMacHeader + 18; Bssid1 = pMacHeader + 12; for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) { @@ -821,9 +819,8 @@ int linux_wlan_get_num_conn_ifcs(void) uint8_t ret_val = 0; for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) { - if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, null_bssid, 6)) { + if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, null_bssid, 6)) ret_val++; - } } return ret_val; } @@ -912,15 +909,13 @@ static int linux_wlan_txq_task(void *vp) msleep(TX_BACKOFF_WEIGHT_UNIT_MS << backoff_weight); } while (/*timeout*/ 0); backoff_weight += TX_BACKOFF_WEIGHT_INCR_STEP; - if (backoff_weight > TX_BACKOFF_WEIGHT_MAX) { + if (backoff_weight > TX_BACKOFF_WEIGHT_MAX) backoff_weight = TX_BACKOFF_WEIGHT_MAX; - } } else { if (backoff_weight > TX_BACKOFF_WEIGHT_MIN) { backoff_weight -= TX_BACKOFF_WEIGHT_DECR_STEP; - if (backoff_weight < TX_BACKOFF_WEIGHT_MIN) { + if (backoff_weight < TX_BACKOFF_WEIGHT_MIN) backoff_weight = TX_BACKOFF_WEIGHT_MIN; - } } } /*TODO: drop packets after a certain time/number of retry count. */ @@ -1051,9 +1046,8 @@ static int linux_wlan_firmware_download(linux_wlan_t *p_nic) **/ PRINT_D(INIT_DBG, "Downloading Firmware ...\n"); ret = g_linux_wlan->oup.wlan_firmware_download(g_linux_wlan->wilc_firmware->data, g_linux_wlan->wilc_firmware->size); - if (ret < 0) { + if (ret < 0) goto _FAIL_; - } /* Freeing FW buffer */ PRINT_D(INIT_DBG, "Freeing FW buffer ...\n"); @@ -1384,13 +1378,11 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) /* not sure if the following unlocks are needed or not*/ - if (&g_linux_wlan->rxq_event != NULL) { + if (&g_linux_wlan->rxq_event != NULL) linux_wlan_unlock(&g_linux_wlan->rxq_event); - } - if (&g_linux_wlan->txq_event != NULL) { + if (&g_linux_wlan->txq_event != NULL) linux_wlan_unlock(&g_linux_wlan->txq_event); - } #if (RX_BH_TYPE == RX_BH_WORK_QUEUE) @@ -1744,14 +1736,12 @@ static int linux_wlan_read_mac_addr(void *vp) } } - if (index == array_size) { + if (index == array_size) PRINT_ER("random MAC\n"); - } exit: - if (fp && !IS_ERR(fp)) { + if (fp && !IS_ERR(fp)) filp_close(fp, NULL); - } set_fs(old_fs); @@ -1783,9 +1773,8 @@ uint8_t wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, wilc_wlan_oup_t *nwo, li sdio_register_driver(&wilc_bus); - while (!probe) { + while (!probe) msleep(100); - } probe = 0; g_linux_wlan->wilc_sdio_func = local_sdio_func; linux_to_wlan(nwi, nic); @@ -1817,9 +1806,8 @@ int repeat_power_cycle(perInterface_wlan_t *nic) sdio_register_driver(&wilc_bus); /* msleep(1000); */ - while (!probe) { + while (!probe) msleep(100); - } probe = 0; g_linux_wlan->wilc_sdio_func = local_sdio_func; linux_to_wlan(&nwi, g_linux_wlan); @@ -1844,9 +1832,8 @@ int repeat_power_cycle(perInterface_wlan_t *nic) } /* Start firmware*/ ret = linux_wlan_start_firmware(nic); - if (ret < 0) { + if (ret < 0) PRINT_ER("Failed to start firmware\n"); - } __fail__: return ret; } @@ -1868,9 +1855,8 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) #ifdef STATIC_MACADDRESS wilc_mac_thread = kthread_run(linux_wlan_read_mac_addr, NULL, "wilc_mac_thread"); - if (wilc_mac_thread < 0) { + if (wilc_mac_thread < 0) PRINT_ER("couldn't create Mac addr thread\n"); - } #endif linux_to_wlan(&nwi, g_linux_wlan); @@ -2234,18 +2220,16 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) tx_data->skb = skb; eth_h = (struct ethhdr *)(skb->data); - if (eth_h->h_proto == 0x8e88) { + if (eth_h->h_proto == 0x8e88) PRINT_D(INIT_DBG, "EAPOL transmitted\n"); - } /*get source and dest ip addresses*/ ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr)); pu8UdpBuffer = (char *)ih + sizeof(struct iphdr); - if ((pu8UdpBuffer[1] == 68 && pu8UdpBuffer[3] == 67) || (pu8UdpBuffer[1] == 67 && pu8UdpBuffer[3] == 68)) { + if ((pu8UdpBuffer[1] == 68 && pu8UdpBuffer[3] == 67) || (pu8UdpBuffer[1] == 67 && pu8UdpBuffer[3] == 68)) PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n", pu8UdpBuffer[248], pu8UdpBuffer[249], pu8UdpBuffer[250]); - } PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb); /* Send packet to MAC HW - for now the tx_complete function will be just status @@ -2419,9 +2403,8 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) done: - if (buff != NULL) { + if (buff != NULL) kfree(buff); - } return s32Error; } @@ -2462,14 +2445,12 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) skb_reserve(skb, (unsigned int)skb->data & 0x3); - if (g_linux_wlan == NULL || wilc_netdev == NULL) { + if (g_linux_wlan == NULL || wilc_netdev == NULL) PRINT_ER("wilc_netdev in g_linux_wlan is NULL"); - } skb->dev = wilc_netdev; - if (skb->dev == NULL) { + if (skb->dev == NULL) PRINT_ER("skb->dev is NULL\n"); - } /* * for(i=0;i<40;i++) @@ -2499,9 +2480,8 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr)); pu8UdpBuffer = (char *)ih + sizeof(struct iphdr); - if (buff_to_send[35] == 67 && buff_to_send[37] == 68) { + if (buff_to_send[35] == 67 && buff_to_send[37] == 68) PRINT_D(RX_DBG, "DHCP Message received\n"); - } if (buff_to_send[12] == 0x88 && buff_to_send[13] == 0x8e) PRINT_D(GENERIC_DBG, "eapol received\n"); #endif @@ -2513,9 +2493,8 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) PRINT_D(RX_DBG, "netif_rx ret value is: %d\n", stats); } #ifndef TCP_ENHANCEMENTS - else { + else PRINT_ER("Discard sending packet with len = %d\n", size); - } #endif } @@ -2538,9 +2517,8 @@ void WILC_WFI_mgmt_rx(uint8_t *buff, uint32_t size) #ifdef WILC_P2P nic = netdev_priv(g_linux_wlan->strInterfaceInfo[1].wilc_netdev); /* p2p0 */ if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) || - (buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg)) { + (buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg)) WILC_WFI_p2p_rx(g_linux_wlan->strInterfaceInfo[1].wilc_netdev, buff, size); - } #endif } @@ -2671,17 +2649,15 @@ static int __init init_wilc_driver(void) int ret; ret = sdio_register_driver(&wilc_bus); - if (ret < 0) { + if (ret < 0) PRINT_D(INIT_DBG, "init_wilc_driver: Failed register sdio driver\n"); - } return ret; } #else PRINT_D(INIT_DBG, "Initializing netdev\n"); - if (wilc_netdev_init()) { + if (wilc_netdev_init()) PRINT_ER("Couldn't initialize netdev\n"); - } return 0; #endif } @@ -2699,9 +2675,8 @@ static void __exit exit_wilc_driver(void) unregister_inetaddr_notifier(&g_dev_notifier); #endif - for (i = 0; i < NUM_CONCURRENT_IFC; i++) { + for (i = 0; i < NUM_CONCURRENT_IFC; i++) nic[i] = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev); - } } @@ -2724,9 +2699,8 @@ static void __exit exit_wilc_driver(void) for (i = 0; i < NUM_CONCURRENT_IFC; i++) { /* close all opened interfaces */ if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev != NULL) { - if (nic[i]->mac_opened) { + if (nic[i]->mac_opened) mac_close(g_linux_wlan->strInterfaceInfo[i].wilc_netdev); - } } } for (i = 0; i < NUM_CONCURRENT_IFC; i++) { From 4423f3b0d96a40ff7f1c2552b1e23c3c3eadcbe8 Mon Sep 17 00:00:00 2001 From: "Kim, Leo" Date: Tue, 28 Jul 2015 17:47:38 +0900 Subject: [PATCH 511/912] staging: wilc1000: remove warnings on the multiple blank lines uses This patch removes the warnings reported by checkpatch.pl for using multiple blank lines. Signed-off-by: Kim, Leo Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 69 --------------------------- 1 file changed, 69 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index a4589b799db9..d012af5f1fb5 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -102,7 +102,6 @@ static int linux_wlan_device_detection(int on_off) return 0; } - #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr); @@ -115,7 +114,6 @@ static struct notifier_block g_dev_notifier = { if (g_linux_wlan->oup.wlan_cleanup != NULL) \ g_linux_wlan->oup.wlan_cleanup(); } - #ifndef STA_FIRMWARE #define STA_FIRMWARE "wifi_firmware.bin" #endif @@ -128,15 +126,12 @@ static struct notifier_block g_dev_notifier = { #define P2P_CONCURRENCY_FIRMWARE "wifi_firmware_p2p_concurrency.bin" #endif - - typedef struct android_wifi_priv_cmd { char *buf; int used_len; int total_len; } android_wifi_priv_cmd; - #define IRQ_WAIT 1 #define IRQ_NO_WAIT 0 /* @@ -157,7 +152,6 @@ void linux_wlan_unlock(void *vp); extern void WILC_WFI_monitor_rx(uint8_t *buff, uint32_t size); extern void WILC_WFI_p2p_rx(struct net_device *dev, uint8_t *buff, uint32_t size); - static void *internal_alloc(uint32_t size, uint32_t flag); static void linux_wlan_tx_complete(void *priv, int status); void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset); @@ -169,8 +163,6 @@ static struct net_device_stats *mac_stats(struct net_device *dev); static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd); static void wilc_set_multicast_list(struct net_device *dev); - - /* * for now - in frmw_to_linux there should be private data to be passed to it * and this data should be pointer to net device @@ -199,8 +191,6 @@ volatile int WatchDogdebuggerCounter; char DebugBuffer[DEGUG_BUFFER_LENGTH + 20] = {0}; static char *ps8current = DebugBuffer; - - void printk_later(const char *format, ...) { va_list args; @@ -212,7 +202,6 @@ void printk_later(const char *format, ...) } - void dump_logs() { if (DebugBuffer[0]) { @@ -244,11 +233,8 @@ static int DebuggingThreadTask(void *vp) WatchDogdebuggerCounter = 0; } } - - #endif - #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr) { @@ -296,7 +282,6 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n"); - /*If we are in station mode or client mode*/ if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { pstrWFIDrv->IFC_UP = 1; @@ -305,8 +290,6 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n"); } - - if (bEnablePS) host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 1, 0); @@ -332,7 +315,6 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event resolve_disconnect_aberration(pstrWFIDrv); - PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label); pIP_Add_buff = null_ip; @@ -385,8 +367,6 @@ void linux_wlan_disable_irq(int wait) #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) static irqreturn_t isr_uh_routine(int irq, void *user_data) { - - int_rcvdU++; #if (RX_BH_TYPE != RX_BH_THREADED_IRQ) linux_wlan_disable_irq(IRQ_NO_WAIT); @@ -438,9 +418,6 @@ static void isr_bh_routine(struct work_struct *work) #else return; #endif - - - } int_rcvdB++; @@ -451,7 +428,6 @@ static void isr_bh_routine(struct work_struct *work) PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n"); } - #if (RX_BH_TYPE == RX_BH_THREADED_IRQ) return IRQ_HANDLED; #endif @@ -485,7 +461,6 @@ static int isr_bh_routine(void *vp) } #endif - #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) static int init_irq(linux_wlan_t *p_nic) { @@ -516,7 +491,6 @@ static int init_irq(linux_wlan_t *p_nic) PRINT_ER("could not obtain gpio for WILC_INTR\n"); } - #if (RX_BH_TYPE == RX_BH_THREADED_IRQ) if ((ret != -1) && (request_threaded_irq(nic->dev_irq_num, isr_uh_routine, isr_bh_routine, IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/ @@ -552,7 +526,6 @@ static void deinit_irq(linux_wlan_t *nic) #endif } - /* * OS functions */ @@ -599,7 +572,6 @@ void linux_wlan_free(void *vp) } } - static void *internal_alloc(uint32_t size, uint32_t flag) { char *pntr = NULL; @@ -608,7 +580,6 @@ static void *internal_alloc(uint32_t size, uint32_t flag) return (void *)pntr; } - static void linux_wlan_init_lock(char *lockName, void *plock, int count) { sema_init((struct semaphore *)plock, count); @@ -654,7 +625,6 @@ void linux_wlan_unlock(void *vp) } } - static void linux_wlan_init_mutex(char *lockName, void *plock, int count) { mutex_init((struct mutex *)plock); @@ -700,7 +670,6 @@ static void linux_wlan_unlock_mutex(void *vp) } } - /*Added by Amr - BugID_4720*/ static void linux_wlan_init_spin_lock(char *lockName, void *plock, int count) { @@ -938,7 +907,6 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic) const struct firmware *wilc_firmware; char *firmware; - if (nic->iftype == AP_MODE) firmware = AP_FIRMWARE; else if (nic->iftype == STATION_MODE) @@ -950,8 +918,6 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic) firmware = P2P_CONCURRENCY_FIRMWARE; } - - if (nic == NULL) { PRINT_ER("NIC is NULL\n"); goto _fail_; @@ -962,7 +928,6 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic) goto _fail_; } - /* the firmare should be located in /lib/firmware in * root file system with the name specified above */ @@ -1061,7 +1026,6 @@ _FAIL_: return ret; } - /* startup configuration - could be changed later using iconfig*/ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_nic) { @@ -1087,7 +1051,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n", mac_add[0], mac_add[1], mac_add[2], mac_add[3], mac_add[4], mac_add[5]); wilc_get_chipid(0); - if (g_linux_wlan->oup.wlan_cfg_set == NULL) { PRINT_D(INIT_DBG, "Null p[ointer\n"); goto _fail_; @@ -1107,7 +1070,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0)) goto _fail_; - /* c_val[0] = RATE_AUTO; / * bug 4275: Enable autorate and limit it to 24Mbps * / */ c_val[0] = RATE_AUTO; if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) @@ -1342,7 +1304,6 @@ _fail_: return -1; } - /**************************/ void wilc1000_wlan_deinit(linux_wlan_t *nic) { @@ -1376,7 +1337,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) #endif #endif - /* not sure if the following unlocks are needed or not*/ if (&g_linux_wlan->rxq_event != NULL) linux_wlan_unlock(&g_linux_wlan->rxq_event); @@ -1384,7 +1344,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) if (&g_linux_wlan->txq_event != NULL) linux_wlan_unlock(&g_linux_wlan->txq_event); - #if (RX_BH_TYPE == RX_BH_WORK_QUEUE) /*Removing the work struct from the linux kernel workqueue*/ if (&g_linux_wlan->rx_work_queue != NULL) @@ -1401,7 +1360,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) PRINT_D(INIT_DBG, "Deinitializing IRQ\n"); deinit_irq(g_linux_wlan); - if (&g_linux_wlan->oup != NULL) { if (g_linux_wlan->oup.wlan_stop != NULL) g_linux_wlan->oup.wlan_stop(); @@ -1662,17 +1620,14 @@ static void wlan_deinitialize_threads(linux_wlan_t *nic) if (&g_linux_wlan->rxq_event != NULL) linux_wlan_unlock(&g_linux_wlan->rxq_event); - if (g_linux_wlan->rxq_thread != NULL) { kthread_stop(g_linux_wlan->rxq_thread); g_linux_wlan->rxq_thread = NULL; } - if (&g_linux_wlan->txq_event != NULL) linux_wlan_unlock(&g_linux_wlan->txq_event); - if (g_linux_wlan->txq_thread != NULL) { kthread_stop(g_linux_wlan->txq_thread); g_linux_wlan->txq_thread = NULL; @@ -1872,7 +1827,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) /*Save the oup structre into global pointer*/ gpstrWlanOps = &g_linux_wlan->oup; - ret = wlan_initialize_threads(nic); if (ret < 0) { PRINT_ER("Initializing Threads FAILED\n"); @@ -1910,7 +1864,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_irq_enable_; } - /*Download firmware*/ ret = linux_wlan_firmware_download(g_linux_wlan); if (ret < 0) { @@ -1950,7 +1903,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) g_linux_wlan->wilc1000_initialized = 1; return 0; /*success*/ - _fail_fw_start_: if (&g_linux_wlan->oup != NULL) { if (g_linux_wlan->oup.wlan_stop != NULL) @@ -1979,7 +1931,6 @@ _fail_locks_: return ret; } - /* * - this function will be called automatically by OS when module inserted. */ @@ -2011,7 +1962,6 @@ int mac_init_fn(struct net_device *ndev) } #endif - void WILC_WFI_frame_register(struct wiphy *wiphy, struct net_device *dev, u16 frame_type, bool reg); @@ -2075,7 +2025,6 @@ int mac_open(struct net_device *ndev) goto _err_; } - WILC_WFI_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev, nic->g_struct_frame_reg[0].frame_type, nic->g_struct_frame_reg[0].reg); WILC_WFI_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev, @@ -2114,7 +2063,6 @@ struct net_device_stats *mac_stats(struct net_device *dev) { perInterface_wlan_t *nic = netdev_priv(dev); - return &nic->netstats; } @@ -2129,7 +2077,6 @@ static void wilc_set_multicast_list(struct net_device *dev) priv = wiphy_priv(dev->ieee80211_ptr->wiphy); pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv; - if (!dev) return; @@ -2250,7 +2197,6 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) QueueCount = WILC_Xmit_data((void *)tx_data, HOST_TO_WLAN); #endif /* WILC_FULLY_HOSTING_AP */ - if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) { netif_stop_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev); netif_stop_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev); @@ -2259,7 +2205,6 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) return 0; } - int mac_close(struct net_device *ndev) { struct WILC_WFI_priv *priv; @@ -2282,8 +2227,6 @@ int mac_close(struct net_device *ndev) pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv; - - PRINT_D(GENERIC_DBG, "Mac close\n"); if (g_linux_wlan == NULL) { @@ -2329,7 +2272,6 @@ int mac_close(struct net_device *ndev) return 0; } - int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) { @@ -2340,8 +2282,6 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) struct WILC_WFI_priv *priv; s32 s32Error = WILC_SUCCESS; - - /* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */ #ifdef USE_WIRELESS nic = netdev_priv(ndev); @@ -2435,7 +2375,6 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) frame_len = size; buff_to_send = buff; - /* Need to send the packet up to the host, allocate a skb buffer */ skb = dev_alloc_skb(frame_len); if (skb == NULL) { @@ -2600,7 +2539,6 @@ int wilc_netdev_init(void) } #endif - if (register_netdev(ndev)) { PRINT_ER("Device couldn't be registered - %s\n", ndev->name); return -1; /* ERROR */ @@ -2624,12 +2562,9 @@ int wilc_netdev_init(void) return 0; } - /*The 1st function called after module inserted*/ static int __init init_wilc_driver(void) { - - #if defined (WILC_DEBUGFS) if (wilc_debugfs_init() < 0) { PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n"); @@ -2679,13 +2614,11 @@ static void __exit exit_wilc_driver(void) nic[i] = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev); } - if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) { release_firmware(g_linux_wlan->wilc_firmware); g_linux_wlan->wilc_firmware = NULL; } - if ((g_linux_wlan != NULL) && (((g_linux_wlan->strInterfaceInfo[0].wilc_netdev) != NULL) || ((g_linux_wlan->strInterfaceInfo[1].wilc_netdev) != NULL))) { PRINT_D(INIT_DBG, "Waiting for mac_close ....\n"); @@ -2695,7 +2628,6 @@ static void __exit exit_wilc_driver(void) else PRINT_D(INIT_DBG, "mac_closed\n"); - for (i = 0; i < NUM_CONCURRENT_IFC; i++) { /* close all opened interfaces */ if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev != NULL) { @@ -2715,7 +2647,6 @@ static void __exit exit_wilc_driver(void) } } - #ifdef USE_WIRELESS #ifdef WILC_AP_EXTERNAL_MLME /* Bug 4600 : WILC_WFI_deinit_mon_interface was already called at mac_close */ From 3369463284cff3adafb49914a4dffe608421848a Mon Sep 17 00:00:00 2001 From: "Kim, Leo" Date: Tue, 28 Jul 2015 17:47:39 +0900 Subject: [PATCH 512/912] staging: wilc1000: remove unnecessary spcae This patch removes the warnings reported by checkpatch.pl on space prohibited between function name and open parenthesis '(' Signed-off-by: Kim, Leo Signed-off-by: Tony Cho Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d012af5f1fb5..3e55a8ac2966 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -194,9 +194,9 @@ static char *ps8current = DebugBuffer; void printk_later(const char *format, ...) { va_list args; - va_start (args, format); - ps8current += vsprintf (ps8current, format, args); - va_end (args); + va_start(args, format); + ps8current += vsprintf(ps8current, format, args); + va_end(args); if ((ps8current - DebugBuffer) > DEGUG_BUFFER_LENGTH) ps8current = DebugBuffer; @@ -477,9 +477,9 @@ static int init_irq(linux_wlan_t *p_nic) * * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM); */ -#elif defined (NM73131_0_BOARD) +#elif defined(NM73131_0_BOARD) nic->dev_irq_num = IRQ_WILC1000; -#elif defined (PANDA_BOARD) +#elif defined(PANDA_BOARD) gpio_export(GPIO_NUM, 1); nic->dev_irq_num = OMAP_GPIO_IRQ(GPIO_NUM); irq_set_irq_type(nic->dev_irq_num, IRQ_TYPE_LEVEL_LOW); @@ -1483,7 +1483,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_context.txq_wait_event = (void *)&g_linux_wlan->txq_event; -#if defined (MEMORY_STATIC) +#if defined(MEMORY_STATIC) nwi->os_context.rx_buffer_size = LINUX_RX_SIZE; #endif nwi->os_context.rxq_critical_section = (void *)&g_linux_wlan->rxq_cs; @@ -1935,7 +1935,7 @@ _fail_locks_: * - this function will be called automatically by OS when module inserted. */ -#if !defined (NM73131_0_BOARD) +#if !defined(NM73131_0_BOARD) int mac_init_fn(struct net_device *ndev) { @@ -1966,7 +1966,7 @@ void WILC_WFI_frame_register(struct wiphy *wiphy, struct net_device *dev, u16 frame_type, bool reg); /* This fn is called, when this device is setup using ifconfig */ -#if !defined (NM73131_0_BOARD) +#if !defined(NM73131_0_BOARD) int mac_open(struct net_device *ndev) { perInterface_wlan_t *nic; @@ -2565,7 +2565,7 @@ int wilc_netdev_init(void) /*The 1st function called after module inserted*/ static int __init init_wilc_driver(void) { -#if defined (WILC_DEBUGFS) +#if defined(WILC_DEBUGFS) if (wilc_debugfs_init() < 0) { PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n"); return -1; @@ -2671,7 +2671,7 @@ static void __exit exit_wilc_driver(void) } printk("Module_exit Done.\n"); -#if defined (WILC_DEBUGFS) +#if defined(WILC_DEBUGFS) wilc_debugfs_remove(); #endif From 29edbe5e29d0ba3f619723f964724adab168f6f8 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Wed, 29 Jul 2015 12:18:58 +0530 Subject: [PATCH 513/912] Staging : wilc1000: Remove braces for single statement blocks This patch fixes the following checkpatch.pl warning: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 8bacd8cfd945..342a3368d4a2 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -855,9 +855,8 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) /* Get DTIM Period */ pu8TimElm = get_tim_elm(pu8msa, (u16RxLen + FCS_LEN), u8index); - if (pu8TimElm != 0) { + if (pu8TimElm != 0) pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3]; - } pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN]; u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN); From 648d6e6ce4457f9558e1c9d5a8ed73e2baace312 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 27 Jul 2015 13:48:10 +0800 Subject: [PATCH 514/912] staging: lustre: Replace spaces at the start of a line. Replace the spaces at the start of a line with tab for indent. Signed-off-by: Pan Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_page.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 282ae734fba2..4def88106d3a 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -52,12 +52,12 @@ static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg, int radix); # define PASSERT(env, page, expr) \ - do { \ + do { \ if (unlikely(!(expr))) { \ CL_PAGE_DEBUG(D_ERROR, (env), (page), #expr "\n"); \ LASSERT(0); \ } \ - } while (0) + } while (0) # define PINVRNT(env, page, exp) \ ((void)sizeof(env), (void)sizeof(page), (void)sizeof !!(exp)) From b16d335ddf0b89eae6b65d7c2e0c360846fc4846 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 27 Jul 2015 13:49:11 +0800 Subject: [PATCH 515/912] staging: lustre: Adjust code indent for macro and tail blackslash Adjust code indent for macro with tab, as well as tail blackslash. Signed-off-by: Pan Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_page.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 4def88106d3a..7c8643786205 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -51,12 +51,12 @@ static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg, int radix); -# define PASSERT(env, page, expr) \ - do { \ - if (unlikely(!(expr))) { \ - CL_PAGE_DEBUG(D_ERROR, (env), (page), #expr "\n"); \ - LASSERT(0); \ - } \ +# define PASSERT(env, page, expr) \ + do { \ + if (unlikely(!(expr))) { \ + CL_PAGE_DEBUG(D_ERROR, (env), (page), #expr "\n"); \ + LASSERT(0); \ + } \ } while (0) # define PINVRNT(env, page, exp) \ From 8de056a13fcd09a85a79f52f7fe72b3fa95ccd66 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 27 Jul 2015 13:50:09 +0800 Subject: [PATCH 516/912] staging: lustre: Add a blank line after declarations. Add a blank line after local variable declarations. Signed-off-by: Pan Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 7c8643786205..ec21f2b64d7b 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -169,6 +169,7 @@ int cl_page_gang_lookup(const struct lu_env *env, struct cl_object *obj, while ((nr = radix_tree_gang_lookup(&hdr->coh_tree, (void **)pvec, idx, CLT_PVEC_SIZE)) > 0) { int end_of_region = 0; + idx = pvec[nr - 1]->cp_index + 1; for (i = 0, j = 0; i < nr; ++i) { page = pvec[i]; @@ -286,6 +287,7 @@ static struct cl_page *cl_page_alloc(const struct lu_env *env, GFP_NOFS); if (page != NULL) { int result = 0; + atomic_set(&page->cp_ref, 1); if (type == CPT_CACHEABLE) /* for radix tree */ atomic_inc(&page->cp_ref); From 437dffebadd5cf22403505528f35b0c1b3aa34e2 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 27 Jul 2015 13:50:34 +0800 Subject: [PATCH 517/912] staging: lustre: Remove a trailing */ of a separate line. Remove a trailing */ of a separate comments block line. Signed-off-by: Pan Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_page.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index ec21f2b64d7b..1f6ca7c7978f 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -354,8 +354,10 @@ static struct cl_page *cl_page_find0(const struct lu_env *env, idx, PFID(&hdr->coh_lu.loh_fid), vmpage, vmpage->private, type); /* fast path. */ if (type == CPT_CACHEABLE) { - /* vmpage lock is used to protect the child/parent - * relationship */ + /* + * vmpage lock is used to protect the child/parent + * relationship + */ KLASSERT(PageLocked(vmpage)); /* * cl_vmpage_page() can be called here without any locks as From 585d84b4838ac061f935b5d5c84550ec9f5dee82 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 27 Jul 2015 13:52:48 +0800 Subject: [PATCH 518/912] staging: lustre: Remove unnecessary braces {} for single statement blocks Remove unnecessary braces {} for single line statement blocks. Signed-off-by: Pan Li Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_page.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 1f6ca7c7978f..0f3417159fc1 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -376,9 +376,8 @@ static struct cl_page *cl_page_find0(const struct lu_env *env, idx) == page)); } - if (page != NULL) { + if (page != NULL) return page; - } /* allocate and initialize cl_page */ page = cl_page_alloc(env, o, idx, vmpage, type); From f926cac2f70e5dc62e9a11d8e599206c0ad357ba Mon Sep 17 00:00:00 2001 From: Mario Bambagini Date: Tue, 28 Jul 2015 22:08:48 +0200 Subject: [PATCH 519/912] staging: lustre: fixed lines longer than 80 chars this set of patches fixes several code style problems: -patch 1: lines with more than 80 chars -patch 2: comments without */ on a separate line -patch 3: bad alignment of lines split on more than one line -patch 4: modified comparisons against NULL -patch 5: added spaces between concatenated strings This patch fixes 2 lines longer than 80 chars The first one is a function whose argument has been moved to next line. The second one is a comment split on two lines Signed-off-by: Mario Bambagini Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_capa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c b/drivers/staging/lustre/lustre/llite/llite_capa.c index a6268718b76e..9c9e48285b6a 100644 --- a/drivers/staging/lustre/lustre/llite/llite_capa.c +++ b/drivers/staging/lustre/lustre/llite/llite_capa.c @@ -70,7 +70,8 @@ static unsigned long long ll_capa_renewal_retries; static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa); -static inline void update_capa_timer(struct obd_capa *ocapa, unsigned long expiry) +static inline void update_capa_timer(struct obd_capa *ocapa, + unsigned long expiry) { if (time_before(expiry, ll_capa_timer.expires) || !timer_pending(&ll_capa_timer)) { @@ -165,7 +166,8 @@ static void ll_delete_capa(struct obd_capa *ocapa) /* three places where client capa is deleted: * 1. capa_thread_main(), main place to delete expired capa. * 2. ll_clear_inode_capas() in ll_clear_inode(). - * 3. ll_truncate_free_capa() delete truncate capa explicitly in ll_setattr_ost(). + * 3. ll_truncate_free_capa() delete truncate capa explicitly in + * ll_setattr_ost(). */ static int capa_thread_main(void *unused) { From e28e92b6d18199ad304f076fb24293d8c384cf1b Mon Sep 17 00:00:00 2001 From: Mario Bambagini Date: Tue, 28 Jul 2015 22:08:49 +0200 Subject: [PATCH 520/912] staging: lustre: fixed comments without */ on a new line This patch fixes 4 comments without */ on a new line Signed-off-by: Mario Bambagini Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_capa.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c b/drivers/staging/lustre/lustre/llite/llite_capa.c index 9c9e48285b6a..4432a64447bb 100644 --- a/drivers/staging/lustre/lustre/llite/llite_capa.c +++ b/drivers/staging/lustre/lustre/llite/llite_capa.c @@ -208,7 +208,8 @@ static int capa_thread_main(void *unused) * lock. */ /* ibits may be changed by ll_have_md_lock() so we have - * to set it each time */ + * to set it each time + */ ibits = MDS_INODELOCK_LOOKUP; if (capa_for_mds(&ocapa->c_capa) && !S_ISDIR(ocapa->u.cli.inode->i_mode) && @@ -227,7 +228,8 @@ static int capa_thread_main(void *unused) if (capa_for_oss(&ocapa->c_capa) && obd_capa_open_count(ocapa) == 0) { /* oss capa with open count == 0 won't renew, - * move to idle list */ + * move to idle list + */ sort_add_capa(ocapa, &ll_idle_capas); continue; } @@ -449,7 +451,8 @@ static inline void inode_add_oss_capa(struct inode *inode, struct list_head *next = NULL; /* capa is sorted in lli_oss_capas so lookup can always find the - * latest one */ + * latest one + */ list_for_each_entry(tmp, &lli->lli_oss_capas, u.cli.lli_list) { if (cfs_time_after(ocapa->c_expiry, tmp->c_expiry)) { next = &tmp->u.cli.lli_list; @@ -539,7 +542,8 @@ static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa) ll_capa_renewal_failed++; /* failed capa won't be renewed any longer, but if -EIO, - * client might be doing recovery, retry in 2 min. */ + * client might be doing recovery, retry in 2 min. + */ if (rc == -EIO && !capa_is_expired(ocapa)) { delay_capa_renew(ocapa, 120); DEBUG_CAPA(D_ERROR, &ocapa->c_capa, From 6b0e2d6232e9a0b98d39647f3cc6ff5fd8f1cd92 Mon Sep 17 00:00:00 2001 From: Mario Bambagini Date: Tue, 28 Jul 2015 22:08:50 +0200 Subject: [PATCH 521/912] staging: lustre: fixed bad alignment This patch fixes 7 bad alignments. When a line is split on more than one line, the other lines must be aligned with paranthesis. Signed-off-by: Mario Bambagini Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_capa.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c b/drivers/staging/lustre/lustre/llite/llite_capa.c index 4432a64447bb..a3b3c46e08a3 100644 --- a/drivers/staging/lustre/lustre/llite/llite_capa.c +++ b/drivers/staging/lustre/lustre/llite/llite_capa.c @@ -103,13 +103,13 @@ static inline int have_expired_capa(void) spin_lock(&capa_lock); if (!list_empty(ll_capa_list)) { ocapa = list_entry(ll_capa_list->next, struct obd_capa, - c_list); + c_list); expired = capa_is_to_expire(ocapa); if (!expired) update_capa_timer(ocapa, capa_renewal_time(ocapa)); } else if (!list_empty(&ll_idle_capas)) { ocapa = list_entry(ll_idle_capas.next, struct obd_capa, - c_list); + c_list); expired = capa_is_expired(ocapa); if (!expired) update_capa_timer(ocapa, ocapa->c_expiry); @@ -259,7 +259,7 @@ static int capa_thread_main(void *unused) update_capa_timer(next, capa_renewal_time(next)); list_for_each_entry_safe(ocapa, tmp, &ll_idle_capas, - c_list) { + c_list) { if (!capa_is_expired(ocapa)) { if (!next) update_capa_timer(ocapa, @@ -303,11 +303,11 @@ int ll_capa_thread_start(void) task = kthread_run(capa_thread_main, NULL, "ll_capa"); if (IS_ERR(task)) { CERROR("cannot start expired capa thread: rc %ld\n", - PTR_ERR(task)); + PTR_ERR(task)); return PTR_ERR(task); } wait_event(ll_capa_thread.t_ctl_waitq, - thread_is_running(&ll_capa_thread)); + thread_is_running(&ll_capa_thread)); return 0; } @@ -317,7 +317,7 @@ void ll_capa_thread_stop(void) thread_set_flags(&ll_capa_thread, SVC_STOPPING); wake_up(&ll_capa_thread.t_ctl_waitq); wait_event(ll_capa_thread.t_ctl_waitq, - thread_is_stopped(&ll_capa_thread)); + thread_is_stopped(&ll_capa_thread)); } struct obd_capa *ll_osscapa_get(struct inode *inode, __u64 opc) @@ -644,7 +644,7 @@ void ll_clear_inode_capas(struct inode *inode) ll_delete_capa(ocapa); list_for_each_entry_safe(ocapa, tmp, &lli->lli_oss_capas, - u.cli.lli_list) + u.cli.lli_list) ll_delete_capa(ocapa); spin_unlock(&capa_lock); } From 911677393b13a3f2fc6db2e297b336fb2669f0f1 Mon Sep 17 00:00:00 2001 From: Mario Bambagini Date: Tue, 28 Jul 2015 22:08:51 +0200 Subject: [PATCH 522/912] staging: lustre: modified comparisons against NULL The explicit comparisons against NULL has been modified to be shorter. Signed-off-by: Mario Bambagini Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_capa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c b/drivers/staging/lustre/lustre/llite/llite_capa.c index a3b3c46e08a3..7768c6d8d1a8 100644 --- a/drivers/staging/lustre/lustre/llite/llite_capa.c +++ b/drivers/staging/lustre/lustre/llite/llite_capa.c @@ -236,7 +236,7 @@ static int capa_thread_main(void *unused) /* NB iput() is in ll_update_capa() */ inode = igrab(ocapa->u.cli.inode); - if (inode == NULL) { + if (!inode) { DEBUG_CAPA(D_ERROR, &ocapa->c_capa, "igrab failed for"); continue; @@ -380,7 +380,7 @@ struct obd_capa *ll_mdscapa_get(struct inode *inode) struct ll_inode_info *lli = ll_i2info(inode); struct obd_capa *ocapa; - LASSERT(inode != NULL); + LASSERT(inode); if ((ll_i2sbi(inode)->ll_flags & LL_SBI_MDS_CAPA) == 0) return NULL; From 01eb73d53070ca2c7a75c272291a79613604cd97 Mon Sep 17 00:00:00 2001 From: Mario Bambagini Date: Tue, 28 Jul 2015 22:08:52 +0200 Subject: [PATCH 523/912] staging: lustre: added a space between concatenated strings A space has been inserted between two concatenated strings as required from checkpatch.pl These two updates do not lead to any problem as DFID is defined as a string in ./drivers/staging/lustre/lustre/include/lustre/lustre_user.h The script checkpatch.pl does not return any other warning/error. Signed-off-by: Mario Bambagini Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_capa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c b/drivers/staging/lustre/lustre/llite/llite_capa.c index 7768c6d8d1a8..24590ae36090 100644 --- a/drivers/staging/lustre/lustre/llite/llite_capa.c +++ b/drivers/staging/lustre/lustre/llite/llite_capa.c @@ -364,7 +364,7 @@ struct obd_capa *ll_osscapa_get(struct inode *inode, __u64 opc) ocapa = NULL; if (atomic_read(&ll_capa_debug)) { - CERROR("no capability for "DFID" opc %#llx\n", + CERROR("no capability for " DFID " opc %#llx\n", PFID(&lli->lli_fid), opc); atomic_set(&ll_capa_debug, 0); } @@ -389,7 +389,7 @@ struct obd_capa *ll_mdscapa_get(struct inode *inode) ocapa = capa_get(lli->lli_mds_capa); spin_unlock(&capa_lock); if (!ocapa && atomic_read(&ll_capa_debug)) { - CERROR("no mds capability for "DFID"\n", PFID(&lli->lli_fid)); + CERROR("no mds capability for " DFID "\n", PFID(&lli->lli_fid)); atomic_set(&ll_capa_debug, 0); } From 0d749519f0441144f7da53e157d11f0680c15313 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Mon, 27 Jul 2015 22:20:35 +0530 Subject: [PATCH 524/912] Staging: lustre: Drop unnecessary cast This patch does away with the cast on void * as it is unnecessary. Semantic patch used is as follows: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (T *) e ) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c index aa3fffed1519..fbbc8a7e308d 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c @@ -114,7 +114,7 @@ int cfs_crypto_hash_digest(unsigned char alg_id, crypto_free_hash(hdesc.tfm); return -ENOSPC; } - sg_init_one(&sl, (void *)buf, buf_len); + sg_init_one(&sl, buf, buf_len); hdesc.flags = 0; err = crypto_hash_digest(&hdesc, &sl, sl.length, hash); @@ -165,7 +165,7 @@ int cfs_crypto_hash_update(struct cfs_crypto_hash_desc *hdesc, { struct scatterlist sl; - sg_init_one(&sl, (void *)buf, buf_len); + sg_init_one(&sl, buf, buf_len); return crypto_hash_update((struct hash_desc *)hdesc, &sl, sl.length); } From b921ecea84a3f137f7c585af079f86922aa15aa4 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:27:52 -0400 Subject: [PATCH 525/912] staging/lustre: Remove unused ll_vfs_* compat defines Lustre defines quite a bit of those compatibility defines duplicating kernel vfs api, but they are not actually used in the client so remove them all and also ll_dirty_inode, ll_security_inode_unlink and cfs_path_put Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/lustre_compat25.h | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 513c81f43d6e..622bc933122f 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -74,22 +74,9 @@ #define FS_HAS_FIEMAP (0) #endif -#define ll_vfs_rmdir(dir, entry, mnt) vfs_rmdir(dir, entry) -#define ll_vfs_mkdir(inode, dir, mnt, mode) vfs_mkdir(inode, dir, mode) -#define ll_vfs_link(old, mnt, dir, new, mnt1) vfs_link(old, dir, new) -#define ll_vfs_unlink(inode, entry, mnt) vfs_unlink(inode, entry) -#define ll_vfs_mknod(dir, entry, mnt, mode, dev) \ - vfs_mknod(dir, entry, mode, dev) -#define ll_security_inode_unlink(dir, entry, mnt) \ - security_inode_unlink(dir, entry) -#define ll_vfs_rename(old, old_dir, mnt, new, new_dir, mnt1) \ - vfs_rename(old, old_dir, new, new_dir, NULL, 0) - #define cfs_bio_io_error(a, b) bio_io_error((a)) #define cfs_bio_endio(a, b, c) bio_endio((a), (c)) -#define cfs_path_put(nd) path_put(&(nd)->path) - #ifndef SLAB_DESTROY_BY_RCU #define SLAB_DESTROY_BY_RCU 0 @@ -127,14 +114,6 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) } -# define ll_vfs_dq_init dquot_initialize -# define ll_vfs_dq_drop dquot_drop -# define ll_vfs_dq_transfer dquot_transfer -# define ll_vfs_dq_off(sb, remount) dquot_suspend(sb, -1) - - - - #define queue_max_phys_segments(rq) queue_max_segments(rq) #define queue_max_hw_segments(rq) queue_max_segments(rq) @@ -194,8 +173,4 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) # define ll_umode_t umode_t -#include - -# define ll_dirty_inode(inode, flag) (inode)->i_sb->s_op->dirty_inode((inode), flag) - #endif /* _COMPAT25_H */ From 5109ea606f9d9d26d2d69a0457d17267b8bfd629 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:27:53 -0400 Subject: [PATCH 526/912] staging/lustre: get rid of cfs_bio_* compat macroses This replaces cfs_bio_io_error with direct calls to bio_io_error and cfs_bio_end_io with bio_end_io Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 4 ---- drivers/staging/lustre/lustre/llite/lloop.c | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 622bc933122f..e7d57e8b0a4b 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -74,10 +74,6 @@ #define FS_HAS_FIEMAP (0) #endif -#define cfs_bio_io_error(a, b) bio_io_error((a)) -#define cfs_bio_endio(a, b, c) bio_endio((a), (c)) - - #ifndef SLAB_DESTROY_BY_RCU #define SLAB_DESTROY_BY_RCU 0 #endif diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index cc00fd10fbcf..56938d2446bf 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -365,7 +365,7 @@ static void loop_make_request(struct request_queue *q, struct bio *old_bio) loop_add_bio(lo, old_bio); return; err: - cfs_bio_io_error(old_bio, old_bio->bi_iter.bi_size); + bio_io_error(old_bio); } @@ -376,7 +376,7 @@ static inline void loop_handle_bio(struct lloop_device *lo, struct bio *bio) while (bio) { struct bio *tmp = bio->bi_next; bio->bi_next = NULL; - cfs_bio_endio(bio, bio->bi_iter.bi_size, ret); + bio_endio(bio, ret); bio = tmp; } } From 5c8eae72ff46f0e70d03ae2e86e631d7a1ca4fe6 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:27:54 -0400 Subject: [PATCH 527/912] staging/lustre: Drop FS_HAS_FIEMAP compat macro FS_HAS_FIEMAP was some sort of old RHEL5 construct that's not really important anymore Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/linux/lustre_compat25.h | 5 ----- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index e7d57e8b0a4b..1a6b2fb5da86 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -69,11 +69,6 @@ # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count) /* inode_dio_done(i) use as-is for read unlock */ - -#ifndef FS_HAS_FIEMAP -#define FS_HAS_FIEMAP (0) -#endif - #ifndef SLAB_DESTROY_BY_RCU #define SLAB_DESTROY_BY_RCU 0 #endif diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 3e0b8a4b6486..40ab7b272d03 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -1281,7 +1281,7 @@ struct file_system_type lustre_fs_type = { .mount = lustre_mount, .kill_sb = lustre_kill_super, .fs_flags = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV | - FS_HAS_FIEMAP | FS_RENAME_DOES_D_MOVE, + FS_RENAME_DOES_D_MOVE, }; MODULE_ALIAS_FS("lustre"); From 629819c7dedbbd6f38c075bb8aba1fe554be4cdb Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:27:55 -0400 Subject: [PATCH 528/912] staging/lustre: Drop SLAB_DESTROY_BY_RCU redefine, it's always defined SLAB_DESTROY_BY_RCU is always defined in kernel slab.h, so no point in checking for it. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/linux/lustre_compat25.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 1a6b2fb5da86..38eda2391182 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -69,12 +69,6 @@ # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count) /* inode_dio_done(i) use as-is for read unlock */ -#ifndef SLAB_DESTROY_BY_RCU -#define SLAB_DESTROY_BY_RCU 0 -#endif - - - static inline int ll_quota_on(struct super_block *sb, int off, int ver, char *name, int remount) { From 6e74468da6965ca473a46a83f88e89c88d9811cc Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:27:56 -0400 Subject: [PATCH 529/912] staging/lustre: remove *hw_segments compat defines queue_max_phys_segments, queue_max_hw_segments and bio_hw_segments are not used anywhere in the client code, so remove them Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/linux/lustre_compat25.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 38eda2391182..d0e8f3c813a1 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -100,10 +100,6 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) -#define queue_max_phys_segments(rq) queue_max_segments(rq) -#define queue_max_hw_segments(rq) queue_max_segments(rq) - - #define ll_d_hlist_node hlist_node #define ll_d_hlist_empty(list) hlist_empty(list) #define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name) @@ -112,8 +108,6 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) p = NULL; hlist_for_each_entry(dentry, i_dentry, alias) -#define bio_hw_segments(q, bio) 0 - #define ll_pagevec_init(pv, cold) do {} while (0) #define ll_pagevec_add(pv, pg) (0) From e3befdc7579eee51407ad162a5614ba30c97a405 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:27:59 -0400 Subject: [PATCH 530/912] staging/lustre: replace ll_umode_t with umode_t umode_t is what we need anyway, so replace all users and drop the define. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/linux/lustre_compat25.h | 6 ------ drivers/staging/lustre/lustre/llite/namei.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index d0e8f3c813a1..1dcd78b9c5e5 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -146,10 +146,4 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) # define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET) #endif - -#include -#include - -# define ll_umode_t umode_t - #endif /* _COMPAT25_H */ diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 72ce6e72845f..2ed1e0ac5553 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -1008,7 +1008,7 @@ static int ll_unlink(struct inode *dir, struct dentry *dentry) return rc; } -static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode) +static int ll_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) { int err; From b81f9b6db644c2ca0fbce1ac2eda8e74860e8c63 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:28:02 -0400 Subject: [PATCH 531/912] staging/lustre: ATTR_TIMES_SET is always defined, so don't check it Remove ATTR_TIMES_SET check as it's always present, move the mask of times define close to where it's used. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/linux/lustre_compat25.h | 6 ------ drivers/staging/lustre/lustre/llite/llite_lib.c | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 1dcd78b9c5e5..f16ba9c8b214 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -140,10 +140,4 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) # define ext2_find_next_zero_bit find_next_zero_bit_le #endif -#ifdef ATTR_TIMES_SET -# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) -#else -# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET) -#endif - #endif /* _COMPAT25_H */ diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index ab4839cad939..39f0b2a07aec 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1150,6 +1150,8 @@ void ll_clear_inode(struct inode *inode) lli->lli_has_smd = false; } +#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) + static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data, struct md_open_data **mod) { From e56e17ea935a66fe3a6cd2445649a0d9365a8449 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:28:04 -0400 Subject: [PATCH 532/912] staging/lustre: use ATTR_OPEN directly, remove ATTR_RAW ATTR_RAW is unused. No point in redefining ATTR_OPEN as ATTR_FROM_OPEN Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/lustre_patchless_compat.h | 12 ------------ drivers/staging/lustre/lustre/mdc/mdc_lib.c | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h index 14562788e4e0..ebe8d68ed813 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h @@ -60,18 +60,6 @@ truncate_complete_page(struct address_space *mapping, struct page *page) ll_delete_from_page_cache(page); } -#ifdef ATTR_OPEN -# define ATTR_FROM_OPEN ATTR_OPEN -#else -# ifndef ATTR_FROM_OPEN -# define ATTR_FROM_OPEN 0 -# endif -#endif /* ATTR_OPEN */ - -#ifndef ATTR_RAW -#define ATTR_RAW 0 -#endif - #ifndef ATTR_CTIME_SET /* * set ATTR_CTIME_SET to a high value to avoid any risk of collision with other diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index d3234cb1ea22..1a850ea26849 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -286,7 +286,7 @@ static inline __u64 attr_pack(unsigned int ia_valid) sa_valid |= MDS_ATTR_KILL_SGID; if (ia_valid & ATTR_CTIME_SET) sa_valid |= MDS_ATTR_CTIME_SET; - if (ia_valid & ATTR_FROM_OPEN) + if (ia_valid & ATTR_OPEN) sa_valid |= MDS_ATTR_FROM_OPEN; if (ia_valid & ATTR_BLOCKS) sa_valid |= MDS_ATTR_BLOCKS; From 208bf77049a95cd023c8e884a28449a9182f1c1a Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Fri, 31 Jul 2015 16:32:43 +0530 Subject: [PATCH 533/912] staging: lustre: drop redundant check There is no need to verify that its an error, as we are anyway going to match the error value to -ENOENT. Drop the redundant check. Reported-by: "Kirill A. Shutemov" Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 4d9b6333eeae..9469a250d8dc 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -674,7 +674,7 @@ static struct lu_object *lu_object_find_try(const struct lu_env *env, cfs_hash_bd_lock(hs, &bd, 1); shadow = htable_lookup(s, &bd, f, waiter, &version); - if (likely(IS_ERR(shadow) && PTR_ERR(shadow) == -ENOENT)) { + if (likely(PTR_ERR(shadow) == -ENOENT)) { struct lu_site_bkt_data *bkt; bkt = cfs_hash_bd_extra_get(hs, &bd); From 176d1b96436dee996f5bd7b36429e6068a848478 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 30 Jul 2015 18:49:55 -0400 Subject: [PATCH 534/912] staging/lustre/llite: Don't set page writeback on non-dirty page New writeback changes in 4.2-RC1 have exposed that we incorrectly set page_writeback on a page that is being written synchronously, which aside from this new crash (dereference of NULL inode->i_wb from set_page_writeback) likely threw off some related page statistics in the past. BUG: unable to handle kernel NULL pointer dereference at 0000000000000138 IP: [] __percpu_counter_add+0x1a/0x80 PGD 0 Oops: 0000 [#1] SMP DEBUG_PAGEALLOC Modules linked in: osc(C) lmv(C) fld(C) mgc(C) lustre(C) mdc(C) fid(C) lov(C) ksocklnd(C) ptlrpc(C) obdclass(C) lnet(C) libcfs(C) loop sha512_generic crc32 rpcsec_gss_krb5 microcode joydev i2c_piix4 acpi_cpufreq pcspkr nfsd syscopyarea sysfillrect sysimgblt drm_kms_helper ttm drm serio_raw virtio_blk [last unloaded: libcfs] CPU: 0 PID: 13328 Comm: cvs Tainted: G C 4.2.0-rc1-vm-nfs+ #30 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 task: ffff8800cc98a400 ti: ffff8801157e8000 task.ti: ffff8801157e8000 RIP: 0010:[] [] __percpu_counter_add+0x1a/0x80 RSP: 0018:ffff8801157eb698 EFLAGS: 00010086 RAX: 0000000000000003 RBX: ffffea0002b91cc0 RCX: 000000000000001a RDX: 0000000000000020 RSI: 0000000000000001 RDI: 00000000000000e8 RBP: ffff8801157eb6b8 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 00000000000000e8 R13: 0000000000000001 R14: ffff8800673587a8 R15: ffff8800673589b0 FS: 00007f6718b89800(0000) GS:ffff88011f400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000138 CR3: 000000009d51c000 CR4: 00000000000007f0 Stack: ffffffff811919e2 ffffea0002b91cc0 ffff880067358998 ffff880119419800 ffff8801157eb718 ffffffff81191a58 ffff8801157eb788 0000000000000282 ffff8800ce5ce920 0000000000000000 ffff8800a525af80 ffff880053f68f10 Call Trace: [] ? __test_set_page_writeback+0x72/0x240 [] __test_set_page_writeback+0xe8/0x240 [] vvp_page_prep_write+0x33/0xb0 [lustre] [] cl_page_invoke+0x57/0x90 [obdclass] [] cl_page_prep+0x2d/0x180 [obdclass] [] osc_io_submit+0x134/0x4a0 [osc] [] cl_io_submit_rw+0x53/0xb0 [obdclass] [] lov_io_submit+0x3a5/0x570 [lov] [] ? lockdep_init_map+0x5b/0x6d0 [] cl_io_submit_rw+0x53/0xb0 [obdclass] [] cl_io_submit_sync+0xed/0x1c0 [obdclass] [] vvp_page_sync_io.isra.15+0x4d/0x100 [lustre] [] ? cl_page_clip+0xff/0x130 [obdclass] [] vvp_io_commit_write+0x448/0x500 [lustre] [] cl_io_commit_write+0x9a/0x130 [obdclass] [] ll_commit_write+0xc2/0x230 [lustre] [] ll_write_end+0x2a/0x50 [lustre] [] generic_perform_write+0xfa/0x1b0 [] ? dentry_needs_remove_privs.part.16+0x1e/0x30 [] __generic_file_write_iter+0x190/0x1f0 [] generic_file_write_iter+0xea/0x1e0 [] vvp_io_write_start+0xa0/0x1e0 [lustre] [] cl_io_start+0x49/0x80 [obdclass] [] cl_io_loop+0x73/0xd0 [obdclass] [] ll_file_io_generic+0x45f/0x4b0 [lustre] [] ll_file_write_iter+0x6c/0xc0 [lustre] [] __vfs_write+0xaa/0xe0 [] vfs_write+0xa9/0x190 [] SyS_write+0x49/0xa0 [] entry_SYSCALL_64_fastpath+0x16/0x7a Code: 5b 41 5c 41 5d 41 5e 5d c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 55 41 54 53 49 89 fc 49 89 f5 48 83 ec 08 65 ff 05 8e d1 bf 7e <48> 8b 47 50 48 63 ca 65 8b 18 48 63 db 48 01 f3 48 39 cb 7d 0a Signed-off-by: Jinshan Xiong Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/15610 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6854 Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/llite/vvp_page.c | 27 ++++++++++++------- .../staging/lustre/lustre/obdclass/cl_page.c | 3 --- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/vvp_page.c b/drivers/staging/lustre/lustre/llite/vvp_page.c index 954ed08c6af2..a3cf5ad20c60 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_page.c +++ b/drivers/staging/lustre/lustre/llite/vvp_page.c @@ -227,11 +227,16 @@ static int vvp_page_prep_write(const struct lu_env *env, struct cl_io *unused) { struct page *vmpage = cl2vm_page(slice); + struct cl_page *pg = slice->cpl_page; LASSERT(PageLocked(vmpage)); LASSERT(!PageDirty(vmpage)); - set_page_writeback(vmpage); + /* ll_writepage path is not a sync write, so need to set page writeback + * flag */ + if (!pg->cp_sync_io) + set_page_writeback(vmpage); + vvp_write_pending(cl2ccc(slice->cpl_obj), cl2ccc_page(slice)); return 0; @@ -298,9 +303,6 @@ static void vvp_page_completion_write(const struct lu_env *env, struct cl_page *pg = slice->cpl_page; struct page *vmpage = cp->cpg_page; - LASSERT(ergo(pg->cp_sync_io != NULL, PageLocked(vmpage))); - LASSERT(PageWriteback(vmpage)); - CL_PAGE_HEADER(D_PAGE, env, pg, "completing WRITE with %d\n", ioret); /* @@ -316,14 +318,19 @@ static void vvp_page_completion_write(const struct lu_env *env, cp->cpg_write_queued = 0; vvp_write_complete(cl2ccc(slice->cpl_obj), cp); - /* - * Only mark the page error only when it's an async write because - * applications won't wait for IO to finish. - */ - if (pg->cp_sync_io == NULL) + if (pg->cp_sync_io != NULL) { + LASSERT(PageLocked(vmpage)); + LASSERT(!PageWriteback(vmpage)); + } else { + LASSERT(PageWriteback(vmpage)); + /* + * Only mark the page error only when it's an async write + * because applications won't wait for IO to finish. + */ vvp_vmpage_error(ccc_object_inode(pg->cp_obj), vmpage, ioret); - end_page_writeback(vmpage); + end_page_writeback(vmpage); + } } /** diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 0f3417159fc1..d5fb81f84cd4 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -1192,9 +1192,6 @@ int cl_page_prep(const struct lu_env *env, struct cl_io *io, if (result == 0) cl_page_io_start(env, pg, crt); - KLASSERT(ergo(crt == CRT_WRITE && pg->cp_type == CPT_CACHEABLE, - equi(result == 0, - PageWriteback(cl_page_vmpage(env, pg))))); CL_PAGE_HEADER(D_TRACE, env, pg, "%d %d\n", crt, result); return result; } From be3d2e0fe154f9da9098d59477ef08230a533426 Mon Sep 17 00:00:00 2001 From: Dave Perez Date: Wed, 29 Jul 2015 21:50:30 -0400 Subject: [PATCH 535/912] Staging: rtl8188eu: fixed newlines after declarations This is a patch to the rtw_debug.c file that fixes styling errors relating to new lines after variable declarations. Signed-off-by: Dave Perez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/rtl8188eu/core/rtw_debug.c b/drivers/staging/rtl8188eu/core/rtw_debug.c index bc3fe10ff247..12beab046a4a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_debug.c +++ b/drivers/staging/rtl8188eu/core/rtw_debug.c @@ -219,6 +219,7 @@ int proc_get_ht_option(char *page, char **start, struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); int len = 0; + len += snprintf(page + len, count - len, "ht_option=%d\n", pmlmepriv->htpriv.ht_option); *eof = 1; return len; @@ -588,6 +589,7 @@ int proc_set_rx_signal(struct file *file, const char __user *buffer, if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%u %u", &is_signal_dbg, &signal_strength); + is_signal_dbg = is_signal_dbg == 0 ? 0 : 1; if (is_signal_dbg && num != 2) return count; From 35cf0b5596c6936588726bd9fbc9789cac371561 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Wed, 29 Jul 2015 10:15:15 +0200 Subject: [PATCH 536/912] staging: rtl8188eu: don't duplicate ieee80211 WLAN_EID_* constants linux/ieee80211.h already defines constants for information element IDs. Resolve discrepancies in naming and remove the duplicated definitions. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8188eu/core/rtw_ieee80211.c | 2 +- drivers/staging/rtl8188eu/include/ieee80211.h | 38 ------------------- .../staging/rtl8188eu/os_dep/ioctl_linux.c | 2 +- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index d43e8672d86e..c3c582881a09 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -1044,7 +1044,7 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, elems->timeout_int = pos; elems->timeout_int_len = elen; break; - case WLAN_EID_HT_CAP: + case WLAN_EID_HT_CAPABILITY: elems->ht_capabilities = pos; elems->ht_capabilities_len = elen; break; diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index fabb95917e8b..cf3f64db34d2 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -486,44 +486,6 @@ struct ieee80211_snap_hdr { /* Non standard? Not in */ #define WLAN_REASON_EXPIRATION_CHK 65535 -/* Information Element IDs */ -#define WLAN_EID_SSID 0 -#define WLAN_EID_SUPP_RATES 1 -#define WLAN_EID_FH_PARAMS 2 -#define WLAN_EID_DS_PARAMS 3 -#define WLAN_EID_CF_PARAMS 4 -#define WLAN_EID_TIM 5 -#define WLAN_EID_IBSS_PARAMS 6 -#define WLAN_EID_CHALLENGE 16 -/* EIDs defined by IEEE 802.11h - START */ -#define WLAN_EID_PWR_CONSTRAINT 32 -#define WLAN_EID_PWR_CAPABILITY 33 -#define WLAN_EID_TPC_REQUEST 34 -#define WLAN_EID_TPC_REPORT 35 -#define WLAN_EID_SUPPORTED_CHANNELS 36 -#define WLAN_EID_CHANNEL_SWITCH 37 -#define WLAN_EID_MEASURE_REQUEST 38 -#define WLAN_EID_MEASURE_REPORT 39 -#define WLAN_EID_QUITE 40 -#define WLAN_EID_IBSS_DFS 41 -/* EIDs defined by IEEE 802.11h - END */ -#define WLAN_EID_ERP_INFO 42 -#define WLAN_EID_HT_CAP 45 -#define WLAN_EID_RSN 48 -#define WLAN_EID_EXT_SUPP_RATES 50 -#define WLAN_EID_MOBILITY_DOMAIN 54 -#define WLAN_EID_FAST_BSS_TRANSITION 55 -#define WLAN_EID_TIMEOUT_INTERVAL 56 -#define WLAN_EID_RIC_DATA 57 -#define WLAN_EID_HT_OPERATION 61 -#define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62 -#define WLAN_EID_20_40_BSS_COEXISTENCE 72 -#define WLAN_EID_20_40_BSS_INTOLERANT 73 -#define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74 -#define WLAN_EID_MMIE 76 -#define WLAN_EID_VENDOR_SPECIFIC 221 -#define WLAN_EID_GENERIC (WLAN_EID_VENDOR_SPECIFIC) - #define IEEE80211_MGMT_HDR_LEN 24 #define IEEE80211_DATA_HDR3_LEN 24 #define IEEE80211_DATA_HDR4_LEN 30 diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index 2db86fbe29d2..554c04d56fd3 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -2666,7 +2666,7 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) psta = rtw_get_stainfo(pstapriv, param->sta_addr); if (psta) { - if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_GENERIC)) { + if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC)) { int wpa_ie_len; int copy_len; From 63d6c969b7424b014fc3cc43b549f63db166aa2a Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Wed, 29 Jul 2015 10:15:16 +0200 Subject: [PATCH 537/912] staging: rtl8188eu: wrap a long if condition and remove extra parenthesis Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index 554c04d56fd3..844ed6f3263a 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -2666,7 +2666,8 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) psta = rtw_get_stainfo(pstapriv, param->sta_addr); if (psta) { - if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC)) { + if (psta->wpa_ie[0] == WLAN_EID_RSN || + psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC) { int wpa_ie_len; int copy_len; From b5efb33e5c6ea76d1f413bfd8e5d0a9811b958d0 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Wed, 29 Jul 2015 10:15:17 +0200 Subject: [PATCH 538/912] staging: rtl8188eu: don't duplicate ieee80211 WLAN_AUTH_* constants linux/ieee80211.h already defines constants for authentication algorithms. Remove the duplicated definitions. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/ieee80211.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index cf3f64db34d2..6400f75707bd 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -477,12 +477,6 @@ struct ieee80211_snap_hdr { #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTW_IEEE80211_SCTL_FRAG) #define WLAN_GET_SEQ_SEQ(seq) ((seq) & RTW_IEEE80211_SCTL_SEQ) -/* Authentication algorithms */ -#define WLAN_AUTH_OPEN 0 -#define WLAN_AUTH_SHARED_KEY 1 - -#define WLAN_AUTH_CHALLENGE_LEN 128 - /* Non standard? Not in */ #define WLAN_REASON_EXPIRATION_CHK 65535 From 26589720620e8fe429681f599fdc145c8f57a8c6 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Wed, 29 Jul 2015 10:15:18 +0200 Subject: [PATCH 539/912] staging: rtl8188eu: don't duplicate ieee80211 WLAN_HT_CAP_SM_PS_* constants linux/ieee80211.h already defines constants for spatial multiplexing power save modes. Remove the duplicated definitions. Signed-off-by: Jakub Sitnicki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/wifi.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index a08a2e045e59..dba8af1ec41e 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -649,13 +649,6 @@ enum ht_cap_ampdu_factor { #define IEEE80211_MAX_AMPDU_BUF 0x40 -/* Spatial Multiplexing Power Save Modes */ -#define WLAN_HT_CAP_SM_PS_STATIC 0 -#define WLAN_HT_CAP_SM_PS_DYNAMIC 1 -#define WLAN_HT_CAP_SM_PS_INVALID 2 -#define WLAN_HT_CAP_SM_PS_DISABLED 3 - - #define OP_MODE_PURE 0 #define OP_MODE_MAY_BE_LEGACY_STAS 1 #define OP_MODE_20MHZ_HT_STA_ASSOCED 2 From f523c7d7a66d97d0584182eb3ff4b2425219f9d8 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Mon, 27 Jul 2015 19:07:57 +0530 Subject: [PATCH 540/912] Staging : rtl8188eu : os_dep : Compression of lines for immediate return This patch compresses two lines into a single line if immediate return is found. Also remove variable ret as it is no longer needed. Semantic patch used for this is as follows: @@ type T; identifier i,f; constant C; @@ - T i; ...when != i when strict ( return -C; | - i = + return f(...); - return i; ) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index 844ed6f3263a..969574926e21 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -2485,16 +2485,13 @@ static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int static int rtw_hostapd_sta_flush(struct net_device *dev) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); DBG_88E("%s\n", __func__); flush_all_cam_entry(padapter); /* clear CAM */ - ret = rtw_sta_flush(padapter); - - return ret; + return rtw_sta_flush(padapter); } static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) @@ -2810,7 +2807,6 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -2821,13 +2817,11 @@ static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *p param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) return -EINVAL; - ret = rtw_acl_remove_sta(padapter, param->sta_addr); - return ret; + return rtw_acl_remove_sta(padapter, param->sta_addr); } static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -2838,8 +2832,7 @@ static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *para param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) return -EINVAL; - ret = rtw_acl_add_sta(padapter, param->sta_addr); - return ret; + return rtw_acl_add_sta(padapter, param->sta_addr); } static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param *param, int len) From cfa48d936a22928060c7f9d401e927af3d5f87cf Mon Sep 17 00:00:00 2001 From: Mayank Bareja Date: Tue, 28 Jul 2015 05:50:12 +0000 Subject: [PATCH 541/912] Staging: rtl8188eu/hal: Fixed code indentation warning detected with checkpatch.pl fixed code indentation warning as reported by checkpatch.pl. Replaced Spaces with Tabs. Signed-off-by: Mayank Bareja Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/bb_cfg.c | 6 +++--- drivers/staging/rtl8188eu/hal/rf.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c b/drivers/staging/rtl8188eu/hal/bb_cfg.c index 8eb2b39a0b67..9c7e626aa703 100644 --- a/drivers/staging/rtl8188eu/hal/bb_cfg.c +++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c @@ -24,9 +24,9 @@ #define read_next_pair(array, v1, v2, i) \ do { \ - i += 2; \ - v1 = array[i]; \ - v2 = array[i+1]; \ + i += 2; \ + v1 = array[i]; \ + v2 = array[i+1]; \ } while (0) diff --git a/drivers/staging/rtl8188eu/hal/rf.c b/drivers/staging/rtl8188eu/hal/rf.c index 097092772a86..38845d17d593 100644 --- a/drivers/staging/rtl8188eu/hal/rf.c +++ b/drivers/staging/rtl8188eu/hal/rf.c @@ -102,7 +102,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter *adapt, u8 *powerlevel) } } rtl88eu_dm_txpower_track_adjust(&hal_data->odmpriv, 1, &direction, - &pwrtrac_value); + &pwrtrac_value); if (direction == 1) { /* Increase TX power */ From 4cc38b0849d68c5a43b1b57f771fa8c6fb779081 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Fri, 24 Jul 2015 12:06:51 -0400 Subject: [PATCH 542/912] drivers, staging, unisys, cleanup channel_guid.h This file has a lot of dead comments and needs to be cleaned up. Signed-off-by: Prarit Bhargava Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/channel_guid.h | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/staging/unisys/include/channel_guid.h b/drivers/staging/unisys/include/channel_guid.h index 706363fc3e9a..2cc4b0b465a1 100644 --- a/drivers/staging/unisys/include/channel_guid.h +++ b/drivers/staging/unisys/include/channel_guid.h @@ -17,35 +17,27 @@ * CHANNEL Guids */ -/* Used in IOChannel - * {414815ed-c58c-11da-95a9-00e08161165f} - */ +/* {414815ed-c58c-11da-95a9-00e08161165f} */ #define SPAR_VHBA_CHANNEL_PROTOCOL_UUID \ UUID_LE(0x414815ed, 0xc58c, 0x11da, \ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) static const uuid_le spar_vhba_channel_protocol_uuid = SPAR_VHBA_CHANNEL_PROTOCOL_UUID; -/* Used in IOChannel - * {8cd5994d-c58e-11da-95a9-00e08161165f} - */ +/* {8cd5994d-c58e-11da-95a9-00e08161165f} */ #define SPAR_VNIC_CHANNEL_PROTOCOL_UUID \ UUID_LE(0x8cd5994d, 0xc58e, 0x11da, \ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) static const uuid_le spar_vnic_channel_protocol_uuid = SPAR_VNIC_CHANNEL_PROTOCOL_UUID; -/* Used in IOChannel - * {72120008-4AAB-11DC-8530-444553544200} - */ +/* {72120008-4AAB-11DC-8530-444553544200} */ #define SPAR_SIOVM_UUID \ UUID_LE(0x72120008, 0x4AAB, 0x11DC, \ 0x85, 0x30, 0x44, 0x45, 0x53, 0x54, 0x42, 0x00) static const uuid_le spar_siovm_uuid = SPAR_SIOVM_UUID; -/* Used in visornoop/visornoop_main.c - * {5b52c5ac-e5f5-4d42-8dff-429eaecd221f} - */ +/* {5b52c5ac-e5f5-4d42-8dff-429eaecd221f} */ #define SPAR_CONTROLDIRECTOR_CHANNEL_PROTOCOL_UUID \ UUID_LE(0x5b52c5ac, 0xe5f5, 0x4d42, \ 0x8d, 0xff, 0x42, 0x9e, 0xae, 0xcd, 0x22, 0x1f) @@ -53,9 +45,7 @@ static const uuid_le spar_siovm_uuid = SPAR_SIOVM_UUID; static const uuid_le spar_controldirector_channel_protocol_uuid = SPAR_CONTROLDIRECTOR_CHANNEL_PROTOCOL_UUID; -/* Used in visorchipset/visorchipset_main.c - * {B4E79625-AEDE-4EAA-9E11-D3EDDCD4504C} - */ +/* {b4e79625-aede-4eAA-9e11-D3eddcd4504c} */ #define SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID \ UUID_LE(0xb4e79625, 0xaede, 0x4eaa, \ 0x9e, 0x11, 0xd3, 0xed, 0xdc, 0xd4, 0x50, 0x4c) From f93b0cbfdf919c956ce8cdd1fff10068004ff3a5 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Fri, 24 Jul 2015 12:06:52 -0400 Subject: [PATCH 543/912] staging: unisys: add UUID strings to channel_guid.h Define additional strings for module loading code ease of use. Signed-off-by: Prarit Bhargava Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/channel_guid.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/unisys/include/channel_guid.h b/drivers/staging/unisys/include/channel_guid.h index 2cc4b0b465a1..17cb499cb53c 100644 --- a/drivers/staging/unisys/include/channel_guid.h +++ b/drivers/staging/unisys/include/channel_guid.h @@ -23,6 +23,8 @@ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) static const uuid_le spar_vhba_channel_protocol_uuid = SPAR_VHBA_CHANNEL_PROTOCOL_UUID; +#define SPAR_VHBA_CHANNEL_PROTOCOL_UUID_STR \ + "414815ed-c58c-11da-95a9-00e08161165f" /* {8cd5994d-c58e-11da-95a9-00e08161165f} */ #define SPAR_VNIC_CHANNEL_PROTOCOL_UUID \ @@ -30,6 +32,8 @@ static const uuid_le spar_vhba_channel_protocol_uuid = 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) static const uuid_le spar_vnic_channel_protocol_uuid = SPAR_VNIC_CHANNEL_PROTOCOL_UUID; +#define SPAR_VNIC_CHANNEL_PROTOCOL_UUID_STR \ + "8cd5994d-c58e-11da-95a9-00e08161165f" /* {72120008-4AAB-11DC-8530-444553544200} */ #define SPAR_SIOVM_UUID \ From 59fd2c8bd11ff1cc9e8fd84f69d8047e63fad0a3 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Fri, 24 Jul 2015 12:06:53 -0400 Subject: [PATCH 544/912] drivers, staging, unisys Add modalias files to visorbus devices This patch adds modalias files that export the device UUID type to sysfs so that udev can autoload the appropriate device driver on demand. Note that is required a minor name change to the channel device sysfs files which are currently named visorbus_dev_groups, and are now named visorbus_channel_groups. Signed-off-by: Prarit Bhargava Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorbus/visorbus_main.c | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 403c13b7864b..cc4a0292c287 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -69,6 +69,38 @@ static const struct attribute_group *visorbus_bus_groups[] = { NULL, }; +/* + * DEVICE type attributes + * + * The modalias file will contain the guid of the device. + */ +static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct visor_device *vdev; + uuid_le guid; + + vdev = to_visor_device(dev); + guid = visorchannel_get_uuid(vdev->visorchannel); + return snprintf(buf, PAGE_SIZE, "visorbus:%pUl\n", &guid); +} +static DEVICE_ATTR_RO(modalias); + +static struct attribute *visorbus_dev_attrs[] = { + &dev_attr_modalias.attr, + NULL, +}; + +/* sysfs example for bridge-only sysfs files using device_type's */ +static const struct attribute_group visorbus_dev_group = { + .attrs = visorbus_dev_attrs, +}; + +const struct attribute_group *visorbus_dev_groups[] = { + &visorbus_dev_group, + NULL, +}; + /** This describes the TYPE of bus. * (Don't confuse this with an INSTANCE of the bus.) */ @@ -76,6 +108,7 @@ struct bus_type visorbus_type = { .name = "visorbus", .match = visorbus_match, .uevent = visorbus_uevent, + .dev_groups = visorbus_dev_groups, .bus_groups = visorbus_bus_groups, }; @@ -128,7 +161,13 @@ static LIST_HEAD(list_all_device_instances); static int visorbus_uevent(struct device *xdev, struct kobj_uevent_env *env) { - if (add_uevent_var(env, "VERSION=%s", VERSION)) + struct visor_device *dev; + uuid_le guid; + + dev = to_visor_device(xdev); + guid = visorchannel_get_uuid(dev->visorchannel); + + if (add_uevent_var(env, "MODALIAS=visorbus:%pUl", &guid)) return -ENOMEM; return 0; } @@ -477,7 +516,7 @@ static struct attribute_group channel_attr_grp = { .attrs = channel_attrs, }; -static const struct attribute_group *visorbus_dev_groups[] = { +static const struct attribute_group *visorbus_channel_groups[] = { &channel_attr_grp, NULL }; @@ -936,7 +975,7 @@ create_visor_device(struct visor_device *dev) sema_init(&dev->visordriver_callback_lock, 1); /* unlocked */ dev->device.bus = &visorbus_type; - dev->device.groups = visorbus_dev_groups; + dev->device.groups = visorbus_channel_groups; device_initialize(&dev->device); dev->device.release = visorbus_release_device; /* keep a reference just for us (now 2) */ From 30948df80c1d17a7dfe5f4efba7e8f4880fc7662 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 28 Jul 2015 12:29:06 -0400 Subject: [PATCH 545/912] staging: unisys: avoid format string parsing This makes sure the kthread name can't be parsed as a format string. Signed-off-by: Kees Cook Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 2a9b055dcc51..f4c0c9fd077b 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -316,7 +316,7 @@ static int visor_thread_start(struct visor_thread_info *thrinfo, void *thrcontext, char *name) { /* used to stop the thread */ - thrinfo->task = kthread_run(threadfn, thrcontext, name); + thrinfo->task = kthread_run(threadfn, thrcontext, "%s", name); if (IS_ERR(thrinfo->task)) { pr_debug("%s failed (%ld)\n", __func__, PTR_ERR(thrinfo->task)); From 6f562b21612d938cf43202ca3fe29636893aa5df Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Fri, 31 Jul 2015 13:21:33 -0400 Subject: [PATCH 546/912] staging: unisys: visornic - prevent lock recursion after IO recovery In the patch which changed the serverdown logic to by synchronous, we were mistakenly holding on to devdata->priv_lock in the call to visornic_serverdown_complete(), which ultimately ended up recursively attempting to grab the same lock via the path: --> dev_close --> visornic_close() --> visornic_disable_with_timeout() Evidence: BUG: spinlock recursion on CPU#0, kworker/u2:0/1567 lock: 0xffff88002d7e4c90, .magic: dead4ead, .owner: kworker/ .owner_cpu: 0 CPU: 0 PID: 1567 Comm: kworker/u2:0 Tainted: G WC 4.2.0-rc3-ARCH+ #60 Hardware name: Dell Inc. PowerEdge T110/ , BIOS 1.23 12/15/2009 Workqueue: visorchipset_controlvm controlvm_periodic_work [visorbus] ffff8800216a9380 ffff88002d167878 ffffffff81476874 000000000000061f ffff88002d7e4c90 ffff88002d167898 ffffffff8109e2bc ffff88002d7e4c90 ffffffff81763d7c ffff88002d1678b8 ffffffff8109e330 ffff88002d7e4c90 Call Trace: [] dump_stack+0x4f/0x73 [] spin_dump+0x7c/0xc0 [] spin_bug+0x30/0x40 [] do_raw_spin_lock+0x127/0x140 [] _raw_spin_lock_irqsave+0x4b/0x60 [] ? visornic_disable_with_timeout.clone.2+0x3c/ [visornic] [] ? _raw_spin_unlock_bh+0x39/0x40 [] visornic_disable_with_timeout.clone.2+0x3c/ [visornic] [] visornic_close+0xe/0x20 [visornic] [] __dev_close_many+0x92/0xe0 [] dev_close_many+0x7a/0x110 [] ? down+0x16/0x50 [] dev_close+0x3f/0x50 [] visornic_serverdown+0x91/0x1a0 [visornic] [] ? device_changestate_responder.clone. [visorbus] [] visornic_pause+0x15/0x20 [visornic] [] initiate_chipset_device_pause_resume+0x9f/0xe0 [visorbus] [] chipset_device_pause+0x13/0x20 [visorbus] [] device_epilog+0x12b/0x1a0 [visorbus] [] handle_command+0x72b/0x970 [visorbus] [] ? visorchannel_signalremove+0x6e/0x80 [visorbus] [] controlvm_periodic_work+0x271/0x420 [visorbus] [] process_one_work+0x1d2/0x540 [] ? process_one_work+0x139/0x540 [] ? __schedule+0x807/0xc30 [] worker_thread+0x57/0x4c0 [] ? process_scheduled_works+0x40/0x40 [] ? process_scheduled_works+0x40/0x40 [] kthread+0xe9/0x110 [] ? __init_kthread_worker+0x70/0x70 [] ret_from_fork+0x3f/0x70 [] ? __init_kthread_worker+0x70/0x70 BUG: spinlock lockup suspected on CPU#0, kworker/u2:0/1567 Fixes: f2b70efaf48f ("staging: unisys: Make serverdown synchronous") Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index f4c0c9fd077b..801e66abf58e 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -416,14 +416,15 @@ visornic_serverdown(struct visornic_devdata *devdata, } devdata->server_change_state = true; devdata->server_down_complete_func = complete_func; + spin_unlock_irqrestore(&devdata->priv_lock, flags); visornic_serverdown_complete(devdata); } else if (devdata->server_change_state) { dev_dbg(&devdata->dev->device, "%s changing state\n", __func__); spin_unlock_irqrestore(&devdata->priv_lock, flags); return -EINVAL; - } - spin_unlock_irqrestore(&devdata->priv_lock, flags); + } else + spin_unlock_irqrestore(&devdata->priv_lock, flags); return 0; } From 6483783d24afc22248f3051326681a4327e29e72 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Tue, 28 Jul 2015 12:29:08 -0400 Subject: [PATCH 547/912] staging: unisys: visornic - correctly reset flag prior to send_enbdis() Because devdata->enab_dis_acked is the flag used to determine whether an enable/disable operation to the IO partition has completed, it should always be cleared prior to initiating the operation. The call added to visornic_enable_with_timeout() added in this patch makes the usage there consistent with visornic_disable_with_timeout(). Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 801e66abf58e..02906ef6c4c6 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -680,6 +680,7 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) spin_lock_irqsave(&devdata->priv_lock, flags); devdata->enabled = 1; + devdata->enab_dis_acked = 0; /* now we're ready, let's send an ENB to uisnic but until we get * an ACK back from uisnic, we'll drop the packets From c847020e7ae07c6a3d68c9a617815b9d4f8a1e10 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Tue, 28 Jul 2015 12:29:09 -0400 Subject: [PATCH 548/912] staging: unisys: visornic_resume needs to mirror _serverdown_complete Previously we simplified the serverdown function to basically turn it into a dev_close(), but missed the analogous logic in visornic_resume() (which is essentially the "book-end" of visornic_serverdown_complete()). As a result, during IO partition recovery, the nic would go closed when the IO partition went away, but would never be opened again when the IO partition came back. This patch changes visornic_resume() to use dev_open(), so that it once again plays nicely with visornic_serverdown_complete(). Because dev_open() forces us into the visornic_open() path, other logic in visornic_resume() was no longer necessary, and lended to simplifying visornic_resume() even more. Fixes: 36645d72a377 ("staging: unisys: simplify visornic_serverdown_complete") Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 02906ef6c4c6..dd908b8f40ef 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -2071,39 +2071,35 @@ static int visornic_resume(struct visor_device *dev, netdev = devdata->netdev; - if (devdata->server_down && !devdata->server_change_state) { - devdata->server_change_state = true; - /* Must transition channel to ATTACHED state BEFORE - * we can start using the device again. - * TODO: State transitions - */ - if (!devdata->threadinfo.id) - visor_thread_start(&devdata->threadinfo, - process_incoming_rsps, - devdata, "vnic_incoming"); - else - pr_warn("vnic_incoming already running!\n"); - - init_rcv_bufs(netdev, devdata); - spin_lock_irqsave(&devdata->priv_lock, flags); - devdata->enabled = 1; - - /* Now we're ready, let's send an ENB to uisnic but until - * we get an ACK back from uisnic, we'll drop the packets - */ - devdata->enab_dis_acked = 0; + spin_lock_irqsave(&devdata->priv_lock, flags); + if (devdata->server_change_state) { spin_unlock_irqrestore(&devdata->priv_lock, flags); - - /* send enable and wait for ack - don't hold lock when - * sending enable because if the queue if sull, insert - * might sleep. - */ - send_enbdis(netdev, 1, devdata); - } else if (devdata->server_change_state) { - dev_err(&dev->device, "%s server_change_state\n", + dev_err(&dev->device, "%s server already changing state\n", __func__); - return -EIO; + return -EINVAL; } + if (!devdata->server_down) { + spin_unlock_irqrestore(&devdata->priv_lock, flags); + dev_err(&dev->device, "%s server not down\n", __func__); + complete_func(dev, 0); + return 0; + } + devdata->server_change_state = true; + spin_unlock_irqrestore(&devdata->priv_lock, flags); + /* Must transition channel to ATTACHED state BEFORE + * we can start using the device again. + * TODO: State transitions + */ + if (!devdata->threadinfo.id) + visor_thread_start(&devdata->threadinfo, + process_incoming_rsps, + devdata, "vnic_incoming"); + else + pr_warn("vnic_incoming already running!\n"); + + rtnl_lock(); + dev_open(netdev); + rtnl_unlock(); complete_func(dev, 0); return 0; From cb84fca03d99ec1bb8d370b575aa2984b60a8374 Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Tue, 28 Jul 2015 12:29:10 -0400 Subject: [PATCH 549/912] staging: unisys: visornic: enable skb->len error-check, remove DEBUG blocks * A skb->len error-check was enabled (removed from a "#ifdef DEBUG" block). * Several unneeded "#ifdef DEBUG" blocks were removed. * A dev_err() was converted to the more-appropriate netdev_err(). Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index dd908b8f40ef..14563afb3c70 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1169,9 +1169,6 @@ visornic_rx(struct uiscmdrsp *cmdrsp) int cc, currsize, off, status; struct ethhdr *eth; unsigned long flags; -#ifdef DEBUG - struct phys_info testfrags[MAX_PHYS_INFO]; -#endif /* post new rcv buf to the other end using the cmdrsp we have at hand * post it without holding lock - but we'll use the signal lock to @@ -1282,29 +1279,12 @@ visornic_rx(struct uiscmdrsp *cmdrsp) curr->data_len = 0; off += currsize; } -#ifdef DEBUG /* assert skb->len == off */ if (skb->len != off) { - dev_err(&devdata->netdev->dev, - "%s something wrong; skb->len:%d != off:%d\n", - netdev->name, skb->len, off); + netdev_err(devdata->netdev, + "something wrong; skb->len:%d != off:%d\n", + skb->len, off); } - /* test code */ - cc = util_copy_fragsinfo_from_skb("rcvchaintest", skb, - RCVPOST_BUF_SIZE, - MAX_PHYS_INFO, testfrags); - if (cc != cmdrsp->net.rcv.numrcvbufs) { - dev_err(&devdata->netdev->dev, - "**** %s Something wrong; rcvd chain length %d different from one we calculated %d\n", - netdev->name, cmdrsp->net.rcv.numrcvbufs, cc); - } - for (i = 0; i < cc; i++) { - dev_inf(&devdata->netdev->dev, - "test:RCVPOST_BUF_SIZE:%d[%d] pfn:%llu off:0x%x len:%d\n", - RCVPOST_BUF_SIZE, i, testfrags[i].pi_pfn, - testfrags[i].pi_off, testfrags[i].pi_len); - } -#endif } /* set up packet's protocl type using ethernet header - this From 36927c1828c526c571973758b2d3a4bad051bc3f Mon Sep 17 00:00:00 2001 From: Tim Sell Date: Tue, 28 Jul 2015 12:29:11 -0400 Subject: [PATCH 550/912] staging: unisys: visornic - consolidate+simplify xmit watermark checks The code that tests for high and low xmit watermarks was consolidatedand simplified. The output behavior should be identical, with the exception of an off-by-one error being corrected in the tests done when the counters overflowed. Signed-off-by: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 114 ++++++++++++------ 1 file changed, 75 insertions(+), 39 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 14563afb3c70..7d4602973bbb 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -135,15 +135,16 @@ struct visornic_devdata { atomic_t num_rcvbuf_in_iovm; unsigned long alloc_failed_in_if_needed_cnt; unsigned long alloc_failed_in_repost_rtn_cnt; - int max_outstanding_net_xmits; /* absolute max number of outstanding - * xmits - should never hit this - */ - int upper_threshold_net_xmits; /* high water mark for calling - * netif_stop_queue() - */ - int lower_threshold_net_xmits; /* high water mark for calling - * netif_wake_queue() - */ + unsigned long max_outstanding_net_xmits; /* absolute max number of + * outstanding xmits - should + * never hit this + */ + unsigned long upper_threshold_net_xmits; /* high water mark for + * calling netif_stop_queue() + */ + unsigned long lower_threshold_net_xmits; /* high water mark for calling + * netif_wake_queue() + */ struct sk_buff_head xmitbufhead; /* xmitbufhead is the head of the * xmit buffer list that have been * sent to the IOPART end @@ -794,6 +795,53 @@ visornic_close(struct net_device *netdev) return 0; } +/** + * devdata_xmits_outstanding - compute outstanding xmits + * @devdata: visornic_devdata for device + * + * Return value is the number of outstanding xmits. + */ +static unsigned long devdata_xmits_outstanding(struct visornic_devdata *devdata) +{ + if (devdata->chstat.sent_xmit >= devdata->chstat.got_xmit_done) + return devdata->chstat.sent_xmit - + devdata->chstat.got_xmit_done; + else + return (ULONG_MAX - devdata->chstat.got_xmit_done + + devdata->chstat.sent_xmit + 1); +} + +/** + * vnic_hit_high_watermark + * @devdata: indicates visornic device we are checking + * @high_watermark: max num of unacked xmits we will tolerate, + * before we will start throttling + * + * Returns true iff the number of unacked xmits sent to + * the IO partition is >= high_watermark. + */ +static inline bool vnic_hit_high_watermark(struct visornic_devdata *devdata, + ulong high_watermark) +{ + return (devdata_xmits_outstanding(devdata) >= high_watermark); +} + +/** + * vnic_hit_low_watermark + * @devdata: indicates visornic device we are checking + * @low_watermark: we will wait until the num of unacked xmits + * drops to this value or lower before we start + * transmitting again + * + * Returns true iff the number of unacked xmits sent to + * the IO partition is <= low_watermark. + */ +static inline bool vnic_hit_low_watermark(struct visornic_devdata *devdata, + ulong low_watermark) +{ + return (devdata_xmits_outstanding(devdata) <= low_watermark); +} + /** * visornic_xmit - send a packet to the IO Partition * @skb: Packet to be sent @@ -869,13 +917,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) /* save the pointer to skb -- we'll need it for completion */ cmdrsp->net.buf = skb; - if (((devdata->chstat.sent_xmit >= devdata->chstat.got_xmit_done) && - (devdata->chstat.sent_xmit - devdata->chstat.got_xmit_done >= - devdata->max_outstanding_net_xmits)) || - ((devdata->chstat.sent_xmit < devdata->chstat.got_xmit_done) && - (ULONG_MAX - devdata->chstat.got_xmit_done + - devdata->chstat.sent_xmit >= - devdata->max_outstanding_net_xmits))) { + if (vnic_hit_high_watermark(devdata, + devdata->max_outstanding_net_xmits)) { /* too many NET_XMITs queued over to IOVM - need to wait */ devdata->chstat.reject_count++; @@ -957,13 +1000,8 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev) /* check to see if we have hit the high watermark for * netif_stop_queue() */ - if (((devdata->chstat.sent_xmit >= devdata->chstat.got_xmit_done) && - (devdata->chstat.sent_xmit - devdata->chstat.got_xmit_done >= - devdata->upper_threshold_net_xmits)) || - ((devdata->chstat.sent_xmit < devdata->chstat.got_xmit_done) && - (ULONG_MAX - devdata->chstat.got_xmit_done + - devdata->chstat.sent_xmit >= - devdata->upper_threshold_net_xmits))) { + if (vnic_hit_high_watermark(devdata, + devdata->upper_threshold_net_xmits)) { /* too many NET_XMITs queued over to IOVM - need to wait */ netif_stop_queue(netdev); /* calling stop queue - call * netif_wake_queue() after lower @@ -1457,13 +1495,13 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, " num_rcv_bufs = %d\n", devdata->num_rcv_bufs); str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " max_oustanding_next_xmits = %d\n", + " max_oustanding_next_xmits = %lu\n", devdata->max_outstanding_net_xmits); str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " upper_threshold_net_xmits = %d\n", + " upper_threshold_net_xmits = %lu\n", devdata->upper_threshold_net_xmits); str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " lower_threshold_net_xmits = %d\n", + " lower_threshold_net_xmits = %lu\n", devdata->lower_threshold_net_xmits); str_pos += scnprintf(vbuf + str_pos, len - str_pos, " queuefullmsg_logged = %d\n", @@ -1562,6 +1600,9 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, " netif_queue = %s\n", netif_queue_stopped(devdata->netdev) ? "stopped" : "running"); + str_pos += scnprintf(vbuf + str_pos, len - str_pos, + " xmits_outstanding = %lu\n", + devdata_xmits_outstanding(devdata)); } rcu_read_unlock(); bytes_read = simple_read_from_buffer(buf, len, offset, vbuf, str_pos); @@ -1655,16 +1696,8 @@ drain_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata) * the lower watermark for * netif_wake_queue() */ - if (((devdata->chstat.sent_xmit >= - devdata->chstat.got_xmit_done) && - (devdata->chstat.sent_xmit - - devdata->chstat.got_xmit_done <= - devdata->lower_threshold_net_xmits)) || - ((devdata->chstat.sent_xmit < - devdata->chstat.got_xmit_done) && - (ULONG_MAX - devdata->chstat.got_xmit_done - + devdata->chstat.sent_xmit <= - devdata->lower_threshold_net_xmits))) { + if (vnic_hit_low_watermark(devdata, + devdata->lower_threshold_net_xmits)) { /* enough NET_XMITs completed * so can restart netif queue */ @@ -1834,12 +1867,15 @@ static int visornic_probe(struct visor_device *dev) /* set the net_xmit outstanding threshold */ /* always leave two slots open but you should have 3 at a minimum */ + /* note that max_outstanding_net_xmits must be > 0 */ devdata->max_outstanding_net_xmits = - max(3, ((devdata->num_rcv_bufs / 3) - 2)); + max_t(unsigned long, 3, ((devdata->num_rcv_bufs / 3) - 2)); devdata->upper_threshold_net_xmits = - max(2, devdata->max_outstanding_net_xmits - 1); + max_t(unsigned long, + 2, (devdata->max_outstanding_net_xmits - 1)); devdata->lower_threshold_net_xmits = - max(1, devdata->max_outstanding_net_xmits / 2); + max_t(unsigned long, + 1, (devdata->max_outstanding_net_xmits / 2)); skb_queue_head_init(&devdata->xmitbufhead); From f3c709b8fc1bbdeddd9b9c1f7785b9b35d2301d9 Mon Sep 17 00:00:00 2001 From: Navy Cheng Date: Mon, 27 Jul 2015 16:09:35 +0800 Subject: [PATCH 551/912] Staging: dgnc: dgnc_driver.h: remove unnecessary comments The public headers is well known by others and the redundant commits make the code mess. Remove the comments of the public headers to make the code tidy. Signed-off-by: Navy Cheng Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index d04671fa4b75..06ece5151fe4 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -21,9 +21,9 @@ #ifndef __DGNC_DRIVER_H #define __DGNC_DRIVER_H -#include /* To pick up the varions Linux types */ -#include /* To pick up the various tty structs/defines */ -#include /* For irqreturn_t type */ +#include +#include +#include #include "digi.h" /* Digi specific ioctl header */ #include "dgnc_sysfs.h" /* Support for SYSFS */ From 4bc8ff7479c57f2e0332d8b8dc7ba44b31b6839c Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Sat, 25 Jul 2015 10:48:28 +0100 Subject: [PATCH 552/912] staging: octeon: add missing blank line after declarations Fixes checkpatch.pl WARNING: Missing a blank line after delarations Signed-off-by: Kevin Darbyshire-Bryant Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index f9dba23a3759..0718b35f7335 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -157,6 +157,7 @@ static void cvm_oct_configure_common_hw(void) #ifdef __LITTLE_ENDIAN { union cvmx_ipd_ctl_status ipd_ctl_status; + ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS); ipd_ctl_status.s.pkt_lend = 1; ipd_ctl_status.s.wqe_lend = 1; From 5a3a3f64cabe1590d76d6e8bc1b24c11219ab61e Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Sat, 25 Jul 2015 01:59:08 +0200 Subject: [PATCH 553/912] staging/xgifb: fix dumpVGAReg compile error if DEBUG is set If DEBUG is set dumpVGAReg is called and tries to access XGISR which is defined as (xgifb_info->dev_info.P3c4) which is not known within this function. -> add as parameter to dumpVGAReg so xgifb_info becomes known Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xgifb/XGI_main_26.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 5bfe151ea328..5a6251a45112 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -29,7 +29,7 @@ static unsigned int refresh_rate; /* -------------------- Macro definitions ---------------------------- */ #ifdef DEBUG -static void dumpVGAReg(void) +static void dumpVGAReg(struct xgifb_video_info *xgifb_info) { u8 i, reg; @@ -48,7 +48,7 @@ static void dumpVGAReg(void) } } #else -static inline void dumpVGAReg(void) +static inline void dumpVGAReg(struct xgifb_video_info *xgifb_info) { } #endif @@ -1073,7 +1073,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, } XGIfb_bpp_to_var(xgifb_info, var); /*update ARGB info*/ - dumpVGAReg(); + dumpVGAReg(xgifb_info); return 0; } @@ -2019,7 +2019,7 @@ static int xgifb_probe(struct pci_dev *pdev, goto error_mtrr; } - dumpVGAReg(); + dumpVGAReg(xgifb_info); return 0; From 740d6c17c8fe25b917273195db8d49d33b87e6ae Mon Sep 17 00:00:00 2001 From: Ciprian Manea Date: Sun, 26 Jul 2015 22:26:18 +0100 Subject: [PATCH 554/912] staging: slicoss: Add blank line after variable declarations. This patch fixes the checkpatch.pl warning: WARNING: Missing a blank line after declarations + unsigned long flags; + pshmem = (struct slic_shmem *)(unsigned long) Signed-off-by: Ciprian Manea Signed-off-by: Greg Kroah-Hartman --- drivers/staging/slicoss/slicoss.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index a609f3e67256..858597087ba7 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2329,6 +2329,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) if (!adapter->isp_initialized) { unsigned long flags; + pshmem = (struct slic_shmem *)(unsigned long) adapter->phys_shmem; From 61c854f510505177e95b0f2bc88249c4ed68f501 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Mon, 27 Jul 2015 15:36:26 +0530 Subject: [PATCH 555/912] Staging : android :Replace comma with a semicolon Replace comma between expression statements by a semicolon. The semantic patch used is as follows: @@ expression e1,e2; @@ e1 - , + ; e2; Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index c5c037ccf32c..7958d5c9663f 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -660,7 +660,7 @@ restart: if (page_range_subsumed_by_range(range, pgstart, pgend)) return 0; if (page_range_in_range(range, pgstart, pgend)) { - pgstart = min_t(size_t, range->pgstart, pgstart), + pgstart = min_t(size_t, range->pgstart, pgstart); pgend = max_t(size_t, range->pgend, pgend); purged |= range->purged; range_del(range); From bd1ccd33150261f0e58be6de615e4b14389ac208 Mon Sep 17 00:00:00 2001 From: Freeman Zhang Date: Mon, 27 Jul 2015 14:37:25 +0800 Subject: [PATCH 556/912] staging: rtl8192u: Fix checkpatch issue with comma in r819xU_firmware.c Add space after ',' to fix the error message provided by checkpatch.pl: ERROR: space required after that ',' Signed-off-by: Freeman Zhang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_firmware.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index 742725e9bfc1..a7d30339390b 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -91,7 +91,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, if (!priv->ieee80211->check_nic_enough_desc(dev, index) || (!skb_queue_empty(&priv->ieee80211->skb_waitQ[index])) || (priv->ieee80211->queue_stop)) { - RT_TRACE(COMP_FIRMWARE,"=====================================================> tx full!\n"); + RT_TRACE(COMP_FIRMWARE, "=====================================================> tx full!\n"); skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); } else { priv->ieee80211->softmac_hard_start_xmit(skb, dev); @@ -242,7 +242,7 @@ bool init_firmware(struct net_device *dev) * or read image file from array. Default load from IMG file */ if (rst_opt == OPT_SYSTEM_RESET) { - rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev); + rc = request_firmware(&fw_entry, fw_name[init_step], &priv->udev->dev); if (rc < 0) { RT_TRACE(COMP_ERR, "request firmware fail!\n"); goto download_firmware_fail; @@ -254,12 +254,12 @@ bool init_firmware(struct net_device *dev) } if (init_step != FW_INIT_STEP1_MAIN) { - memcpy(pfirmware->firmware_buf,fw_entry->data,fw_entry->size); + memcpy(pfirmware->firmware_buf, fw_entry->data, fw_entry->size); mapped_file = pfirmware->firmware_buf; file_length = fw_entry->size; } else { memset(pfirmware->firmware_buf, 0, 128); - memcpy(&pfirmware->firmware_buf[128],fw_entry->data,fw_entry->size); + memcpy(&pfirmware->firmware_buf[128], fw_entry->data, fw_entry->size); mapped_file = pfirmware->firmware_buf; file_length = fw_entry->size + 128; } @@ -319,7 +319,7 @@ bool init_firmware(struct net_device *dev) rt_status = CPUcheck_firmware_ready(dev); if (!rt_status) { - RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status); + RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n", rt_status); goto download_firmware_fail; } From 6ba4df24bb87246472be90b11fcecb720c2a15ba Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Mon, 27 Jul 2015 23:30:52 +0530 Subject: [PATCH 557/912] Staging:dgap :Compression of lines for immediate return This patch compresses two lines into a single line if immediate return statement is found. Remove variable rc as it is no longer needed. It is done using script Coccinelle. And coccinelle uses the following semantic patch for this compression function: @@ type T; identifier i,f; constant C; @@ - T i; ...when != i when strict ( return -C; | - i = + return f(...); - return i; ) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index b344e035b0ef..9112dd2bf4d7 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -4953,9 +4953,8 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, spin_unlock_irqrestore(&ch->ch_lock, lock_flags2); spin_unlock_irqrestore(&bd->bd_lock, lock_flags); - rc = put_user(C_CLOCAL(tty) ? 1 : 0, + return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) arg); - return rc; case TIOCSSOFTCAR: spin_unlock_irqrestore(&ch->ch_lock, lock_flags2); From 936d61eeac71504b52977cc9f9339cb86866c531 Mon Sep 17 00:00:00 2001 From: Jignesh R Patel Date: Tue, 28 Jul 2015 16:19:36 +0530 Subject: [PATCH 558/912] staging: android: Fixed line over 80 char Fixes the following checkpatch warning: Warning: Line over 80 characters Signed-off-by: Jignesh R Patel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_cma_heap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c index 86b91fd53852..0b2448c32495 100644 --- a/drivers/staging/android/ion/ion_cma_heap.c +++ b/drivers/staging/android/ion/ion_cma_heap.c @@ -73,7 +73,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, if (!info->table) goto free_mem; - if (dma_get_sgtable(dev, info->table, info->cpu_addr, info->handle, len)) + if (dma_get_sgtable(dev, info->table, info->cpu_addr, info->handle, + len)) goto free_table; /* keep this for memory release */ buffer->priv_virt = info; From 6852ac9acbb8f11fe736116f7cc819891021404f Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Thu, 30 Jul 2015 15:31:37 +0200 Subject: [PATCH 559/912] Staging: most: fix double unlock This patch fixes double unlocking of a spinlock the aim-v4l2 module. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Andrey Shvetsov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-v4l2/video.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/most/aim-v4l2/video.c b/drivers/staging/most/aim-v4l2/video.c index a977b883ee36..d9687910e4a4 100644 --- a/drivers/staging/most/aim-v4l2/video.c +++ b/drivers/staging/most/aim-v4l2/video.c @@ -619,6 +619,7 @@ static void __exit aim_exit(void) aim_unregister_videodev(mdev); v4l2_device_disconnect(&mdev->v4l2_dev); v4l2_device_put(&mdev->v4l2_dev); + spin_lock(&list_lock); } spin_unlock(&list_lock); From 3f78f6116d581e1342f56a4dacdd576d79b054c4 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Thu, 30 Jul 2015 15:31:39 +0200 Subject: [PATCH 560/912] Staging: most: replace min() by min_t() This patch fixes wrong casting. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/mostcore/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index 49d03af599d5..f872dc0bc118 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -973,7 +973,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj, char *mdev_devnod; char devnod_buf[STRING_SIZE]; int ret; - unsigned int max_len = min((int)len + 1, STRING_SIZE); + size_t max_len = min_t(size_t, len + 1, STRING_SIZE); strlcpy(buffer, buf, max_len); strlcpy(aim_obj->add_link, buf, max_len); @@ -1036,7 +1036,7 @@ static ssize_t store_remove_link(struct most_aim_obj *aim_obj, char *mdev; char *mdev_ch; int ret; - unsigned int max_len = min((int)len + 1, STRING_SIZE); + size_t max_len = min_t(size_t, len + 1, STRING_SIZE); strlcpy(buffer, buf, max_len); strlcpy(aim_obj->remove_link, buf, max_len); From 412c8232edfac024ed22bd1424f37f68fcbb555c Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Thu, 30 Jul 2015 18:18:55 +0200 Subject: [PATCH 561/912] Staging: most: fix doing DMA on stack This patch fixes error "doing DMA on the stack" by using kzalloc for buffer allocation. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-usb/hdm_usb.c | 34 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c index a4a3e266b3ef..feb4c821d3a9 100644 --- a/drivers/staging/most/hdm-usb/hdm_usb.c +++ b/drivers/staging/most/hdm-usb/hdm_usb.c @@ -45,6 +45,7 @@ #define USB_VENDOR_ID_SMSC 0x0424 /* VID: SMSC */ #define USB_DEV_ID_BRDG 0xC001 /* PID: USB Bridge */ #define USB_DEV_ID_INIC 0xCF18 /* PID: USB INIC */ +#define HW_RESYNC 0x0000 /* DRCI Addresses */ #define DRCI_REG_NI_STATE 0x0100 #define DRCI_REG_PACKET_BW 0x0101 @@ -140,20 +141,29 @@ static void wq_netinfo(struct work_struct *wq_obj); * @dev: usb device * */ -static inline void trigger_resync_vr(struct usb_device *dev) +static void trigger_resync_vr(struct usb_device *dev) { - int data = 0; + int retval; + u8 request_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; + int *data = kzalloc(sizeof(*data), GFP_KERNEL); - if (0 > usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), - 0, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, - 0, - 0, - &data, - 0, - 5 * HZ)) - pr_info("Vendor request \"stall\" failed\n"); + if (!data) + goto error; + *data = HW_RESYNC; + retval = usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0, + request_type, + 0, + 0, + data, + 0, + 5 * HZ); + kfree(data); + if (retval >= 0) + return; +error: + pr_info("Vendor request \"stall\" failed\n"); } /** From 59ed0480b95032418be6960375a13201c35364f7 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Thu, 30 Jul 2015 18:19:41 +0200 Subject: [PATCH 562/912] Staging: most: replace pr_*() functions by dev_*() This patch replaces pr_*() functions with dev_*(). Reported-by: Greg Kroah-Hartman Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-usb/hdm_usb.c | 128 +++++++++++++------------ 1 file changed, 65 insertions(+), 63 deletions(-) diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c index feb4c821d3a9..514ce3529b7a 100644 --- a/drivers/staging/most/hdm-usb/hdm_usb.c +++ b/drivers/staging/most/hdm-usb/hdm_usb.c @@ -163,7 +163,7 @@ static void trigger_resync_vr(struct usb_device *dev) if (retval >= 0) return; error: - pr_info("Vendor request \"stall\" failed\n"); + dev_err(&dev->dev, "Vendor request \"stall\" failed\n"); } /** @@ -256,7 +256,7 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg) unsigned int sub_size = cfg->subbuffer_size; if (!sub_size) { - pr_info("Misconfig: Subbuffer size zero.\n"); + pr_warn("Misconfig: Subbuffer size zero.\n"); return frame_size; } switch (cfg->data_type) { @@ -265,7 +265,7 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg) break; case MOST_CH_SYNC: if (cfg->packets_per_xact == 0) { - pr_info("Misconfig: Packets per XACT zero\n"); + pr_warn("Misconfig: Packets per XACT zero\n"); frame_size = 0; } else if (cfg->packets_per_xact == 0xFF) frame_size = (USB_MTU / sub_size) * sub_size; @@ -294,16 +294,16 @@ int hdm_poison_channel(struct most_interface *iface, int channel) { struct most_dev *mdev; + mdev = to_mdev(iface); if (unlikely(!iface)) { - pr_info("Poison: Bad interface.\n"); + dev_warn(&mdev->usb_device->dev, "Poison: Bad interface.\n"); return -EIO; } if (unlikely((channel < 0) || (channel >= iface->num_channels))) { - pr_info("Channel ID out of range.\n"); + dev_warn(&mdev->usb_device->dev, "Channel ID out of range.\n"); return -ECHRNG; } - mdev = to_mdev(iface); mdev->is_channel_healthy[channel] = false; mutex_lock(&mdev->io_mutex); @@ -340,7 +340,8 @@ int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo) num_frames = mbo->buffer_length / frame_size; if (num_frames < 1) { - pr_err("Missed minimal transfer unit.\n"); + dev_err(&mdev->usb_device->dev, + "Missed minimal transfer unit.\n"); return -EIO; } @@ -399,6 +400,7 @@ static void hdm_write_completion(struct urb *urb) struct mbo *mbo; struct buf_anchor *anchor; struct most_dev *mdev; + struct device *dev; unsigned int channel; unsigned long flags; @@ -406,6 +408,7 @@ static void hdm_write_completion(struct urb *urb) anchor = mbo->priv; mdev = to_mdev(mbo->ifp); channel = mbo->hdm_channel_id; + dev = &mdev->usb_device->dev; if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) || (mdev->is_channel_healthy[channel] == false)) { @@ -419,7 +422,7 @@ static void hdm_write_completion(struct urb *urb) mbo->processed_length = 0; switch (urb->status) { case -EPIPE: - pr_info("Broken OUT pipe detected\n"); + dev_warn(dev, "Broken OUT pipe detected\n"); most_stop_enqueue(&mdev->iface, channel); mbo->status = MBO_E_INVAL; usb_unlink_urb(urb); @@ -562,6 +565,7 @@ static void hdm_read_completion(struct urb *urb) struct mbo *mbo; struct buf_anchor *anchor; struct most_dev *mdev; + struct device *dev; unsigned long flags; unsigned int channel; struct most_channel_config *conf; @@ -570,6 +574,7 @@ static void hdm_read_completion(struct urb *urb) anchor = mbo->priv; mdev = to_mdev(mbo->ifp); channel = mbo->hdm_channel_id; + dev = &mdev->usb_device->dev; if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) || (mdev->is_channel_healthy[channel] == false)) { @@ -585,7 +590,7 @@ static void hdm_read_completion(struct urb *urb) mbo->processed_length = 0; switch (urb->status) { case -EPIPE: - pr_info("Broken IN pipe detected\n"); + dev_warn(dev, "Broken IN pipe detected\n"); mbo->status = MBO_E_INVAL; usb_unlink_urb(urb); INIT_WORK(&anchor->clear_work_obj, wq_clear_halt); @@ -596,7 +601,7 @@ static void hdm_read_completion(struct urb *urb) mbo->status = MBO_E_CLOSE; break; case -EOVERFLOW: - pr_info("Babble on IN pipe detected\n"); + dev_warn(dev, "Babble on IN pipe detected\n"); default: mbo->status = MBO_E_INVAL; break; @@ -644,30 +649,28 @@ int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo) struct most_dev *mdev; struct buf_anchor *anchor; struct most_channel_config *conf; + struct device *dev; int retval = 0; struct urb *urb; unsigned long flags; unsigned long length; void *virt_address; - if (unlikely(!iface || !mbo)) { - pr_info("Bad interface or MBO\n"); + if (unlikely(!iface || !mbo)) return -EIO; - } - if (unlikely(iface->num_channels <= channel) || (channel < 0)) { - pr_info("Channel ID out of range\n"); + if (unlikely(iface->num_channels <= channel) || (channel < 0)) return -ECHRNG; - } mdev = to_mdev(iface); conf = &mdev->conf[channel]; + dev = &mdev->usb_device->dev; if (!mdev->usb_device) return -ENODEV; urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_ATOMIC); if (!urb) { - pr_info("Failed to allocate URB\n"); + dev_err(dev, "Failed to allocate URB\n"); return -ENOMEM; } @@ -719,7 +722,7 @@ int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo) retval = usb_submit_urb(urb, GFP_KERNEL); if (retval) { - pr_info("URB submit failed with error %d.\n", retval); + dev_err(dev, "URB submit failed with error %d.\n", retval); goto _error_1; } return 0; @@ -748,22 +751,24 @@ int hdm_configure_channel(struct most_interface *iface, int channel, unsigned int temp_size; unsigned int tail_space; struct most_dev *mdev; - - if (unlikely(!iface || !conf)) { - pr_info("Bad interface or config pointer.\n"); - return -EINVAL; - } - if (unlikely((channel < 0) || (channel >= iface->num_channels))) { - pr_info("Channel ID out of range.\n"); - return -EINVAL; - } - if ((!conf->num_buffers) || (!conf->buffer_size)) { - pr_info("Misconfig: buffer size or number of buffers zero.\n"); - return -EINVAL; - } + struct device *dev; mdev = to_mdev(iface); mdev->is_channel_healthy[channel] = true; + dev = &mdev->usb_device->dev; + + if (unlikely(!iface || !conf)) { + dev_err(dev, "Bad interface or config pointer.\n"); + return -EINVAL; + } + if (unlikely((channel < 0) || (channel >= iface->num_channels))) { + dev_err(dev, "Channel ID out of range.\n"); + return -EINVAL; + } + if ((!conf->num_buffers) || (!conf->buffer_size)) { + dev_err(dev, "Misconfig: buffer size or #buffers zero.\n"); + return -EINVAL; + } if (!(conf->data_type == MOST_CH_SYNC) && !((conf->data_type == MOST_CH_ISOC_AVP) && @@ -777,13 +782,13 @@ int hdm_configure_channel(struct most_interface *iface, int channel, if ((conf->data_type != MOST_CH_SYNC) && (conf->data_type != MOST_CH_ISOC_AVP)) { - pr_info("Unsupported data type\n"); + dev_warn(dev, "Unsupported data type\n"); return -EINVAL; } frame_size = get_stream_frame_size(conf); if ((frame_size == 0) || (frame_size > USB_MTU)) { - pr_info("Misconfig: frame size wrong\n"); + dev_warn(dev, "Misconfig: frame size wrong\n"); return -EINVAL; } @@ -792,11 +797,12 @@ int hdm_configure_channel(struct most_interface *iface, int channel, tmp_val = conf->buffer_size / frame_size; conf->buffer_size = tmp_val * frame_size; - pr_info("Channel %d - rouding buffer size to %d bytes," - " channel config says %d bytes", - channel, - conf->buffer_size, - temp_size); + dev_notice(dev, + "Channel %d - rouding buffer size to %d bytes, " + "channel config says %d bytes\n", + channel, + conf->buffer_size, + temp_size); } num_frames = conf->buffer_size / frame_size; @@ -820,6 +826,7 @@ exit: */ int hdm_update_netinfo(struct most_dev *mdev) { + struct device *dev = &mdev->usb_device->dev; int i; u16 link; u8 addr[6]; @@ -827,17 +834,17 @@ int hdm_update_netinfo(struct most_dev *mdev) if (!is_valid_ether_addr(mdev->hw_addr)) { if (0 > drci_rd_reg(mdev->usb_device, DRCI_REG_HW_ADDR_HI, addr)) { - pr_info("Vendor request \"hw_addr_hi\" failed\n"); + dev_err(dev, "Vendor request \"hw_addr_hi\" failed\n"); return -1; } if (0 > drci_rd_reg(mdev->usb_device, DRCI_REG_HW_ADDR_MI, addr + 2)) { - pr_info("Vendor request \"hw_addr_mid\" failed\n"); + dev_err(dev, "Vendor request \"hw_addr_mid\" failed\n"); return -1; } if (0 > drci_rd_reg(mdev->usb_device, DRCI_REG_HW_ADDR_LO, addr + 4)) { - pr_info("Vendor request \"hw_addr_low\" failed\n"); + dev_err(dev, "Vendor request \"hw_addr_low\" failed\n"); return -1; } mutex_lock(&mdev->io_mutex); @@ -847,7 +854,7 @@ int hdm_update_netinfo(struct most_dev *mdev) } if (0 > drci_rd_reg(mdev->usb_device, DRCI_REG_NI_STATE, &link)) { - pr_info("Vendor request \"link status\" failed\n"); + dev_err(dev, "Vendor request \"link status\" failed\n"); return -1; } le16_to_cpus(&link); @@ -947,7 +954,7 @@ static void wq_clear_halt(struct work_struct *wq_obj) channel = mbo->hdm_channel_id; if (usb_clear_halt(urb->dev, urb->pipe)) - pr_info("Failed to reset endpoint.\n"); + dev_warn(&mdev->usb_device->dev, "Failed to reset endpoint.\n"); usb_free_urb(urb); spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags); @@ -1237,12 +1244,14 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id) struct most_channel_capability *tmp_cap; struct most_dev *mdev; struct usb_device *usb_dev; + struct device *dev; struct usb_host_interface *usb_iface_desc; struct usb_endpoint_descriptor *ep_desc; int ret = 0; usb_iface_desc = interface->cur_altsetting; usb_dev = interface_to_usbdev(interface); + dev = &usb_dev->dev; mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); if (!mdev) goto exit_ENOMEM; @@ -1320,19 +1329,17 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id) INIT_LIST_HEAD(&mdev->anchor_list[i]); spin_lock_init(&mdev->anchor_list_lock[i]); } - pr_info("claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x If#=%d Alt=%d\n", - le16_to_cpu(usb_dev->descriptor.idVendor), - le16_to_cpu(usb_dev->descriptor.idProduct), - usb_dev->bus->busnum, - usb_dev->devnum, - usb_iface_desc->desc.bInterfaceNumber, - usb_iface_desc->desc.bAlternateSetting); + dev_notice(dev, "claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x\n", + le16_to_cpu(usb_dev->descriptor.idVendor), + le16_to_cpu(usb_dev->descriptor.idProduct), + usb_dev->bus->busnum, + usb_dev->devnum); - pr_info("device path: /sys/bus/usb/devices/%d-%s:%d.%d\n", - usb_dev->bus->busnum, - usb_dev->devpath, - usb_dev->config->desc.bConfigurationValue, - usb_iface_desc->desc.bInterfaceNumber); + dev_notice(dev, "device path: /sys/bus/usb/devices/%d-%s:%d.%d\n", + usb_dev->bus->busnum, + usb_dev->devpath, + usb_dev->config->desc.bConfigurationValue, + usb_iface_desc->desc.bInterfaceNumber); mdev->parent = most_register_interface(&mdev->iface); if (IS_ERR(mdev->parent)) { @@ -1373,7 +1380,7 @@ exit_free: exit_ENOMEM: if (ret == 0 || ret == -ENOMEM) { ret = -ENOMEM; - pr_info("out of memory\n"); + dev_err(dev, "out of memory\n"); } return ret; } @@ -1392,11 +1399,6 @@ static void hdm_disconnect(struct usb_interface *interface) struct most_dev *mdev; mdev = usb_get_intfdata(interface); - if (unlikely(!mdev)) { - pr_info("failed to retrieve interface data\n"); - return; - } - mutex_lock(&mdev->io_mutex); usb_set_intfdata(interface, NULL); mdev->usb_device = NULL; @@ -1426,12 +1428,12 @@ static int __init hdm_usb_init(void) { pr_info("hdm_usb_init()\n"); if (usb_register(&hdm_usb)) { - pr_info("could not register hdm_usb driver\n"); + pr_err("could not register hdm_usb driver\n"); return -EIO; } schedule_usb_work = create_workqueue("hdmu_work"); if (schedule_usb_work == NULL) { - pr_info("could not create workqueue\n"); + pr_err("could not create workqueue\n"); usb_deregister(&hdm_usb); return -ENOMEM; } From b3c1a61744d02ca2c249dae04c8eb8f5b0822bc3 Mon Sep 17 00:00:00 2001 From: Michael Hornung Date: Fri, 31 Jul 2015 22:18:17 +0200 Subject: [PATCH 563/912] linux-next: drivers: staging: most: Fix return value * Fix sparse warning "Using plain integer as NULL pointer" Signed-off-by: Michael Hornung Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index 4639c49240f1..c8ab2399faad 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -311,7 +311,7 @@ static struct net_dev_context *get_net_dev_context( } } spin_unlock(&list_lock); - return 0; + return NULL; } static int aim_probe_channel(struct most_interface *iface, int channel_idx, From 7f44cb0ba88b40c09c5bdfc46186e09f42b1a9b0 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Fri, 31 Jul 2015 14:08:30 +0530 Subject: [PATCH 564/912] drivers: staging: Drop unlikely before IS_ERR(_OR_NULL) IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there is no need to do that again from its callers. Drop it. This also replaces an IS_ERR(x) + (x == NULL) check to IS_ERR_OR_NULL check. Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ashmem.c | 2 +- drivers/staging/lustre/include/linux/libcfs/libcfs.h | 2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 7958d5c9663f..cefc208c313a 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -388,7 +388,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) /* ... and allocate the backing shmem file */ vmfile = shmem_file_setup(name, asma->size, vma->vm_flags); - if (unlikely(IS_ERR(vmfile))) { + if (IS_ERR(vmfile)) { ret = PTR_ERR(vmfile); goto out; } diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 5dd9cdfae30c..d585041041c7 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -134,7 +134,7 @@ void cfs_get_random_bytes(void *buf, int size); /* container_of depends on "likely" which is defined in libcfs_private.h */ static inline void *__container_of(void *ptr, unsigned long shift) { - if (unlikely(IS_ERR(ptr) || ptr == NULL)) + if (IS_ERR_OR_NULL(ptr)) return ptr; return (char *)ptr - shift; } diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 9469a250d8dc..8e472327c880 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -602,7 +602,7 @@ static struct lu_object *lu_object_new(const struct lu_env *env, struct lu_site_bkt_data *bkt; o = lu_object_alloc(env, dev, f, conf); - if (unlikely(IS_ERR(o))) + if (IS_ERR(o)) return o; hs = dev->ld_site->ls_obj_hash; @@ -666,7 +666,7 @@ static struct lu_object *lu_object_find_try(const struct lu_env *env, * operations, including fld queries, inode loading, etc. */ o = lu_object_alloc(env, dev, f, conf); - if (unlikely(IS_ERR(o))) + if (IS_ERR(o)) return o; LASSERT(lu_fid_eq(lu_object_fid(o), f)); @@ -1558,7 +1558,7 @@ static int keys_fill(struct lu_context *ctx) LINVRNT(key->lct_index == i); value = key->lct_init(ctx, key); - if (unlikely(IS_ERR(value))) + if (IS_ERR(value)) return PTR_ERR(value); if (!(ctx->lc_tags & LCT_NOREF)) From 881bf281237c3eaf7759040653e779c6cc6c2e00 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Fri, 31 Jul 2015 11:08:29 -0600 Subject: [PATCH 565/912] staging: panel: fix block comment usage Fixed two coding style warnings concerning multiline comments. Signed-off-by: Alex Wilson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/panel/panel.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index bda208da514e..3e9ee7ee6be2 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -781,14 +781,18 @@ static void long_sleep(int ms) schedule_timeout_interruptible(msecs_to_jiffies(ms)); } -/* send a serial byte to the LCD panel. The caller is responsible for locking - if needed. */ +/* + * send a serial byte to the LCD panel. The caller is responsible for locking + * if needed. + */ static void lcd_send_serial(int byte) { int bit; - /* the data bit is set on D0, and the clock on STROBE. - * LCD reads D0 on STROBE's rising edge. */ + /* + * the data bit is set on D0, and the clock on STROBE. + * LCD reads D0 on STROBE's rising edge. + */ for (bit = 0; bit < 8; bit++) { bits.cl = BIT_CLR; /* CLK low */ panel_set_bits(); From d1f0f3118e55ad80136d19dd4afdb32ccba26a42 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 28 Jul 2015 18:48:21 +0300 Subject: [PATCH 566/912] Staging: rtl8192e: array overflow in rtl92e_set_swcam() "EntryNo" is comes from the user in the ioctl and it's a number between 0-255. The ieee->swcamtable[] array only has 32 elements so it can result in memory corruption. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index dc8c7a86bf93..c146b7e720a9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -78,6 +78,10 @@ void rtl92e_set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, RT_TRACE(COMP_DBG, "===========>%s():EntryNo is %d,KeyIndex is %d,KeyType is %d,is_mesh is %d\n", __func__, EntryNo, KeyIndex, KeyType, is_mesh); + + if (EntryNo >= TOTAL_CAM_ENTRY) + return; + if (!is_mesh) { ieee->swcamtable[EntryNo].bused = true; ieee->swcamtable[EntryNo].key_index = KeyIndex; From a9cf7250ba85427a372225067d57cf3ff4471047 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 28 Jul 2015 18:49:25 +0300 Subject: [PATCH 567/912] staging: rtl8192e: don't just print an error and continue I was looking at how TOTAL_CAM_ENTRY is used and I saw this code. We print an error but continue writing "EntryNo" to a register as if it were valid. "EntryNo" is controlled by the user in rtl8192_ioctl() so it definitely can be invalid. I'm not positive what happens with the invalid data but it can't be good. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index c146b7e720a9..29dd93ac5e93 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -117,8 +117,10 @@ void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex, } } priv->rtllib->is_set_key = true; - if (EntryNo >= TOTAL_CAM_ENTRY) + if (EntryNo >= TOTAL_CAM_ENTRY) { netdev_info(dev, "%s(): Invalid CAM entry\n", __func__); + return; + } RT_TRACE(COMP_SEC, "====>to rtl92e_set_key(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n", From c15a7009325b84adac2eb0f3919d9c3ff8d5ed11 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 30 Jul 2015 00:36:32 +0300 Subject: [PATCH 568/912] staging: comedi: das16: remove a duplicate condition We checked that "it->options[3]" was non-zero on the line before so there is no need to check again. Signed-off-by: Dan Carpenter Reviewed-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das16.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index d7cf4b153f7c..056bca9c67d5 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* check that clock setting is valid */ if (it->options[3]) { - if (it->options[3] != 0 && - it->options[3] != 1 && it->options[3] != 10) { + if (it->options[3] != 1 && it->options[3] != 10) { dev_err(dev->class_dev, "Invalid option. Master clock must be set to 1 or 10 (MHz)\n"); return -EINVAL; From 74214e526e605f155ba2609c516cf866ae965316 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:37 +0200 Subject: [PATCH 569/912] staging: rtl8192e: Remove rtl8192_phy_updateInitGain Function is empty and called only once. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 1 - drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 ---- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - 3 files changed, 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 1013101309e8..6d6060390182 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -872,7 +872,6 @@ start: } RT_TRACE(COMP_INIT, "RF Config Finished!\n"); } - rtl8192_phy_updateInitGain(dev); rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bCCKEn, 0x1); rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bOFDMEn, 0x1); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 7acae7d49c91..3a15a0f5b479 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -712,10 +712,6 @@ bool rtl92e_config_phy(struct net_device *dev) return rtStatus; } -void rtl8192_phy_updateInitGain(struct net_device *dev) -{ -} - u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index da25cba6aeb6..350d3063df72 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -86,7 +86,6 @@ extern bool rtl92e_config_bb(struct net_device *dev); extern void rtl92e_get_tx_power(struct net_device *dev); extern void rtl92e_set_tx_power(struct net_device *dev, u8 channel); extern bool rtl92e_config_phy(struct net_device *dev); -extern void rtl8192_phy_updateInitGain(struct net_device *dev); extern u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath); From 45f57357f2a4ac71e4df7d3ca1a4ea234856d399 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:38 +0200 Subject: [PATCH 570/912] staging: rtl8192e: Remove ActUpdateChannelAccessSetting Function is empty and called only once. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 6 ------ drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 --- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ---- 3 files changed, 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 6d6060390182..f8ad81e8fb1f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2388,9 +2388,3 @@ bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev) return Reval; } - -void ActUpdateChannelAccessSetting(struct net_device *dev, - enum wireless_mode WirelessMode, - struct channel_access_setting *ChnlAccessSetting) -{ -} diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index f0e175def6a4..584b78cd90b7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -737,9 +737,6 @@ void rtl92e_set_wireless_mode(struct net_device *dev, u8 wireless_mode) priv->rtllib->mode = wireless_mode; - ActUpdateChannelAccessSetting(dev, wireless_mode, - &priv->ChannelAccessSetting); - if ((wireless_mode == WIRELESS_MODE_N_24G) || (wireless_mode == WIRELESS_MODE_N_5G)) { priv->rtllib->pHTInfo->bEnableHT = 1; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 20df4e20edf2..bdb50323f61b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -619,8 +619,4 @@ bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state StateToSet, RT_RF_CHANGE_SOURCE ChangeSource, bool ProtectOrNot); -void ActUpdateChannelAccessSetting(struct net_device *dev, - enum wireless_mode WirelessMode, - struct channel_access_setting *ChnlAccessSetting); - #endif From f971e9f3ba70eac49ab9fbaa4f5bd5dfbaf9fe7b Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:39 +0200 Subject: [PATCH 571/912] staging: rtl8192e: Remove rtl8192_data_hard_stop Function is empty; rtllib checks if handler is NULL. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 584b78cd90b7..14fc2785b5a4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -90,7 +90,6 @@ static struct pci_driver rtl8192_pci_driver = { static short rtl8192_is_tx_queue_empty(struct net_device *dev); static void rtl819x_watchdog_wqcallback(void *data); static void watch_dog_timer_callback(unsigned long data); -static void rtl8192_data_hard_stop(struct net_device *dev); static void rtl8192_data_hard_resume(struct net_device *dev); static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate); @@ -866,7 +865,6 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->set_chan = rtl8192_set_chan; priv->rtllib->link_change = priv->ops->link_change; priv->rtllib->softmac_data_hard_start_xmit = rtl8192_hard_data_xmit; - priv->rtllib->data_hard_stop = rtl8192_data_hard_stop; priv->rtllib->data_hard_resume = rtl8192_data_hard_resume; priv->rtllib->check_nic_enough_desc = rtl8192_check_nic_enough_desc; priv->rtllib->handle_assoc_response = rtl8192_handle_assoc_response; @@ -1641,10 +1639,6 @@ static void rtl8192_free_tx_ring(struct net_device *dev, unsigned int prio) ring->desc = NULL; } -static void rtl8192_data_hard_stop(struct net_device *dev) -{ -} - static void rtl8192_data_hard_resume(struct net_device *dev) { } From f2d4d4e1e203a242e98ee4038db0af37d5ac107b Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:40 +0200 Subject: [PATCH 572/912] staging: rtl8192e: Remove rtl8192_data_hard_resume Function is empty; rtllib checks if handler is NULL. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 14fc2785b5a4..4157f8a58409 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -90,7 +90,6 @@ static struct pci_driver rtl8192_pci_driver = { static short rtl8192_is_tx_queue_empty(struct net_device *dev); static void rtl819x_watchdog_wqcallback(void *data); static void watch_dog_timer_callback(unsigned long data); -static void rtl8192_data_hard_resume(struct net_device *dev); static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate); static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); @@ -865,7 +864,6 @@ static void rtl8192_init_priv_handler(struct net_device *dev) priv->rtllib->set_chan = rtl8192_set_chan; priv->rtllib->link_change = priv->ops->link_change; priv->rtllib->softmac_data_hard_start_xmit = rtl8192_hard_data_xmit; - priv->rtllib->data_hard_resume = rtl8192_data_hard_resume; priv->rtllib->check_nic_enough_desc = rtl8192_check_nic_enough_desc; priv->rtllib->handle_assoc_response = rtl8192_handle_assoc_response; priv->rtllib->handle_beacon = rtl8192_handle_beacon; @@ -1365,8 +1363,6 @@ RESET_START: rtllib_start_send_beacons(ieee); - if (ieee->data_hard_resume) - ieee->data_hard_resume(ieee->dev); netif_carrier_on(ieee->dev); } else if (ieee->iw_mode == IW_MODE_MESH) { rtl819x_silentreset_mesh_bk(dev, IsPortal); @@ -1639,10 +1635,6 @@ static void rtl8192_free_tx_ring(struct net_device *dev, unsigned int prio) ring->desc = NULL; } -static void rtl8192_data_hard_resume(struct net_device *dev) -{ -} - static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) { From 2937a5d272031eb3e189d4383587bc9f62621c43 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:41 +0200 Subject: [PATCH 573/912] staging: rtl8192e: MgntActSet_RF_State: remove ProtectOrNot parameter It is set at the very beginning of function to a constant value. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 8 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 58 ++++++++----------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 3 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 3 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 7 +-- 6 files changed, 35 insertions(+), 48 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f8ad81e8fb1f..b2f307f3a442 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -882,19 +882,17 @@ start: RT_TRACE((COMP_INIT | COMP_RF | COMP_POWER), "%s(): Turn off RF for RegRfOff ----------\n", __func__); - rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_SW, true); + rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_SW); } else if (priv->rtllib->RfOffReason > RF_CHANGE_BY_PS) { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for RfOffReason(%d) ----------\n", __func__, priv->rtllib->RfOffReason); - rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason, - true); + rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason); } else if (priv->rtllib->RfOffReason >= RF_CHANGE_BY_IPS) { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for RfOffReason(%d) ----------\n", __func__, priv->rtllib->RfOffReason); - rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason, - true); + rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason); } else { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): RF-ON\n", __func__); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 4157f8a58409..0033cfb21351 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -149,8 +149,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y) *****************************************************************************/ bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state StateToSet, - RT_RF_CHANGE_SOURCE ChangeSource, - bool ProtectOrNot) + RT_RF_CHANGE_SOURCE ChangeSource) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; @@ -163,37 +162,32 @@ bool rtl92e_set_rf_state(struct net_device *dev, RT_TRACE((COMP_PS | COMP_RF), "===>rtl92e_set_rf_state(): StateToSet(%d)\n", StateToSet); - ProtectOrNot = false; + while (true) { + spin_lock_irqsave(&priv->rf_ps_lock, flag); + if (priv->RFChangeInProgress) { + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); + RT_TRACE((COMP_PS | COMP_RF), + "rtl92e_set_rf_state(): RF Change in progress! Wait to set..StateToSet(%d).\n", + StateToSet); - - if (!ProtectOrNot) { - while (true) { - spin_lock_irqsave(&priv->rf_ps_lock, flag); - if (priv->RFChangeInProgress) { - spin_unlock_irqrestore(&priv->rf_ps_lock, flag); + while (priv->RFChangeInProgress) { + RFWaitCounter++; RT_TRACE((COMP_PS | COMP_RF), - "rtl92e_set_rf_state(): RF Change in progress! Wait to set..StateToSet(%d).\n", - StateToSet); + "rtl92e_set_rf_state(): Wait 1 ms (%d times)...\n", + RFWaitCounter); + mdelay(1); - while (priv->RFChangeInProgress) { - RFWaitCounter++; - RT_TRACE((COMP_PS | COMP_RF), - "rtl92e_set_rf_state(): Wait 1 ms (%d times)...\n", - RFWaitCounter); - mdelay(1); - - if (RFWaitCounter > 100) { - netdev_warn(dev, - "%s(): Timeout waiting for RF change.\n", - __func__); - return false; - } + if (RFWaitCounter > 100) { + netdev_warn(dev, + "%s(): Timeout waiting for RF change.\n", + __func__); + return false; } - } else { - priv->RFChangeInProgress = true; - spin_unlock_irqrestore(&priv->rf_ps_lock, flag); - break; } + } else { + priv->RFChangeInProgress = true; + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); + break; } } @@ -270,11 +264,9 @@ bool rtl92e_set_rf_state(struct net_device *dev, StateToSet, ChangeSource, priv->rtllib->RfOffReason); } - if (!ProtectOrNot) { - spin_lock_irqsave(&priv->rf_ps_lock, flag); - priv->RFChangeInProgress = false; - spin_unlock_irqrestore(&priv->rf_ps_lock, flag); - } + spin_lock_irqsave(&priv->rf_ps_lock, flag); + priv->RFChangeInProgress = false; + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); RT_TRACE((COMP_PS | COMP_RF), "<===rtl92e_set_rf_state()\n"); return bActionAllowed; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index bdb50323f61b..cd948bb13840 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -617,6 +617,5 @@ bool rtl92e_disable_nic(struct net_device *dev); bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state StateToSet, - RT_RF_CHANGE_SOURCE ChangeSource, - bool ProtectOrNot); + RT_RF_CHANGE_SOURCE ChangeSource); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 458097ee09e7..1a0c690bfa07 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1888,8 +1888,7 @@ static void dm_CheckRfCtrlGPIO(void *data) if (bActuallySet) { mdelay(1000); priv->bHwRfOffAction = 1; - rtl92e_set_rf_state(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW, - true); + rtl92e_set_rf_state(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW); if (priv->bHwRadioOff) argv[1] = "RFOFF"; else diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index c224adedaf62..b0268fdc100f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -45,7 +45,7 @@ int rtl92e_suspend(struct pci_dev *pdev, pm_message_t state) netif_device_detach(dev); if (!priv->rtllib->bSupportRemoteWakeUp) { - rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_INIT, true); + rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_INIT); ulRegRead = rtl92e_readl(dev, CPU_GEN); ulRegRead |= CPU_GEN_SYSTEM_RESET; rtl92e_writel(dev, CPU_GEN, ulRegRead); @@ -108,7 +108,7 @@ int rtl92e_resume(struct pci_dev *pdev) dev->netdev_ops->ndo_open(dev); if (!priv->rtllib->bSupportRemoteWakeUp) - rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_INIT, true); + rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_INIT); out: RT_TRACE(COMP_POWER, "<================r8192E resume call.\n"); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 38addad24f18..f09560d60dc4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -45,7 +45,7 @@ static void rtl8192_hw_sleep_down(struct net_device *dev) spin_unlock_irqrestore(&priv->rf_ps_lock, flags); RT_TRACE(COMP_DBG, "%s()============>come to sleep down\n", __func__); - rtl92e_set_rf_state(dev, eRfSleep, RF_CHANGE_BY_PS, false); + rtl92e_set_rf_state(dev, eRfSleep, RF_CHANGE_BY_PS); } void rtl92e_hw_sleep_wq(void *data) @@ -74,7 +74,7 @@ void rtl92e_hw_wakeup(struct net_device *dev) } spin_unlock_irqrestore(&priv->rf_ps_lock, flags); RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __func__); - rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_PS, false); + rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_PS); } void rtl92e_hw_wakeup_wq(void *data) @@ -133,8 +133,7 @@ static void InactivePsWorkItemCallback(struct net_device *dev) RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n", pPSC->eInactivePowerState == eRfOff ? "OFF" : "ON"); - rtl92e_set_rf_state(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS, - false); + rtl92e_set_rf_state(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS); pPSC->bSwRfProcessing = false; RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <---------\n"); From 99d4f5d236eb6a1eaaddb7179a251f385f7e4c2b Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:42 +0200 Subject: [PATCH 574/912] staging: rtl8192e: Simplify rtl92e_is_halfn_supported_by_ap Function should return struct member - no extra logic is needed. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index b2f307f3a442..c28cabc23fc0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2375,14 +2375,8 @@ bool rtl92e_get_nmode_support_by_sec(struct net_device *dev) bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev) { - bool Reval; struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; - if (ieee->bHalfWirelessN24GMode == true) - Reval = true; - else - Reval = false; - - return Reval; + return ieee->bHalfWirelessN24GMode; } From 72f1f75257de812137ee5110822370fadc4927f6 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:43 +0200 Subject: [PATCH 575/912] staging: rtl8192e: Simplify rtl92e_set_bandwidth Move phy version check outside of the loop. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../rtl8192e/rtl8192e/r8190P_rtl8256.c | 53 +++++++------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index e5f4c2df69fd..85f9341ac281 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -28,49 +28,32 @@ void rtl92e_set_bandwidth(struct net_device *dev, u8 eRFPath; struct r8192_priv *priv = rtllib_priv(dev); + if (priv->card_8192_version != VERSION_8190_BD && + priv->card_8192_version != VERSION_8190_BE) { + netdev_warn(dev, "%s(): Unknown HW version.\n", __func__); + return; + } + for (eRFPath = 0; eRFPath < priv->NumTotalRFPath; eRFPath++) { if (!rtl92e_is_legal_rf_path(dev, eRFPath)) continue; switch (Bandwidth) { case HT_CHANNEL_WIDTH_20: - if (priv->card_8192_version == VERSION_8190_BD || - priv->card_8192_version == VERSION_8190_BE) { - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x0b, bMask12Bits, 0x100); - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x2c, bMask12Bits, 0x3d7); - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x0e, bMask12Bits, 0x021); - - } else { - netdev_warn(dev, "%s(): Unknown HW version.\n", - __func__); - } - + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x0b, bMask12Bits, 0x100); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x2c, bMask12Bits, 0x3d7); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x0e, bMask12Bits, 0x021); break; case HT_CHANNEL_WIDTH_20_40: - if (priv->card_8192_version == VERSION_8190_BD || - priv->card_8192_version == VERSION_8190_BE) { - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x0b, bMask12Bits, 0x300); - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x2c, bMask12Bits, 0x3ff); - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x0e, bMask12Bits, 0x0e1); - - } else { - netdev_warn(dev, "%s(): Unknown HW version.\n", - __func__); - } - - + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x0b, bMask12Bits, 0x300); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x2c, bMask12Bits, 0x3ff); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x0e, bMask12Bits, 0x0e1); break; default: netdev_err(dev, "%s(): Unknown bandwidth: %#X\n", From 90959c3dfcb66cd8467ba0921469b62e42d7879c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:44 +0200 Subject: [PATCH 576/912] staging: rtl8192e: Remove phy_RF8256_Config_ParaFile Merge function into rtl92e_config_rf as having them separated gives no benefit. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 85f9341ac281..194d64cf24ea 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -64,7 +64,7 @@ void rtl92e_set_bandwidth(struct net_device *dev, } } -static bool phy_RF8256_Config_ParaFile(struct net_device *dev) +bool rtl92e_config_rf(struct net_device *dev) { u32 u4RegValue = 0; u8 eRFPath; @@ -77,6 +77,8 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) u8 ConstRetryTimes = 5, RetryTimes = 5; u8 ret = 0; + priv->NumTotalRFPath = RTL819X_TOTAL_RF_PATH; + for (eRFPath = (enum rf90_radio_path)RF90_PATH_A; eRFPath < priv->NumTotalRFPath; eRFPath++) { if (!rtl92e_is_legal_rf_path(dev, eRFPath)) @@ -115,7 +117,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) if (!rtStatus) { netdev_err(dev, "%s(): Failed to check RF Path %d.\n", __func__, eRFPath); - goto phy_RF8256_Config_ParaFile_Fail; + goto fail; } RetryTimes = ConstRetryTimes; @@ -203,7 +205,7 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) netdev_err(dev, "%s(): Failed to initialize RF Path %d.\n", __func__, eRFPath); - goto phy_RF8256_Config_ParaFile_Fail; + goto fail; } } @@ -211,18 +213,10 @@ static bool phy_RF8256_Config_ParaFile(struct net_device *dev) RT_TRACE(COMP_PHY, "PHY Initialization Success\n"); return true; -phy_RF8256_Config_ParaFile_Fail: +fail: return false; } -bool rtl92e_config_rf(struct net_device *dev) -{ - struct r8192_priv *priv = rtllib_priv(dev); - - priv->NumTotalRFPath = RTL819X_TOTAL_RF_PATH; - return phy_RF8256_Config_ParaFile(dev); -} - void rtl92e_set_cck_tx_power(struct net_device *dev, u8 powerlevel) { u32 TxAGC = 0; From 976a06cc89e817e94b0d87cf55bb46134c494060 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:45 +0200 Subject: [PATCH 577/912] staging: rtl8192e: Fix IW_IOCTL macro Macro caused checkpatch complaints - replace [] braces with () and use [] braces as array initializers. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 183d1b2e64f1..7e3ca7ef997b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -1115,41 +1115,41 @@ static int r8192_wx_get_PromiscuousMode(struct net_device *dev, } -#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] +#define IW_IOCTL(x) ((x) - SIOCSIWCOMMIT) static iw_handler r8192_wx_handlers[] = { - IW_IOCTL(SIOCGIWNAME) = r8192_wx_get_name, - IW_IOCTL(SIOCSIWFREQ) = r8192_wx_set_freq, - IW_IOCTL(SIOCGIWFREQ) = r8192_wx_get_freq, - IW_IOCTL(SIOCSIWMODE) = r8192_wx_set_mode, - IW_IOCTL(SIOCGIWMODE) = r8192_wx_get_mode, - IW_IOCTL(SIOCSIWSENS) = r8192_wx_set_sens, - IW_IOCTL(SIOCGIWSENS) = r8192_wx_get_sens, - IW_IOCTL(SIOCGIWRANGE) = rtl8192_wx_get_range, - IW_IOCTL(SIOCSIWAP) = r8192_wx_set_wap, - IW_IOCTL(SIOCGIWAP) = r8192_wx_get_wap, - IW_IOCTL(SIOCSIWSCAN) = r8192_wx_set_scan, - IW_IOCTL(SIOCGIWSCAN) = r8192_wx_get_scan, - IW_IOCTL(SIOCSIWESSID) = r8192_wx_set_essid, - IW_IOCTL(SIOCGIWESSID) = r8192_wx_get_essid, - IW_IOCTL(SIOCSIWNICKN) = r8192_wx_set_nick, - IW_IOCTL(SIOCGIWNICKN) = r8192_wx_get_nick, - IW_IOCTL(SIOCSIWRATE) = r8192_wx_set_rate, - IW_IOCTL(SIOCGIWRATE) = r8192_wx_get_rate, - IW_IOCTL(SIOCSIWRTS) = r8192_wx_set_rts, - IW_IOCTL(SIOCGIWRTS) = r8192_wx_get_rts, - IW_IOCTL(SIOCSIWFRAG) = r8192_wx_set_frag, - IW_IOCTL(SIOCGIWFRAG) = r8192_wx_get_frag, - IW_IOCTL(SIOCSIWRETRY) = r8192_wx_set_retry, - IW_IOCTL(SIOCGIWRETRY) = r8192_wx_get_retry, - IW_IOCTL(SIOCSIWENCODE) = r8192_wx_set_enc, - IW_IOCTL(SIOCGIWENCODE) = r8192_wx_get_enc, - IW_IOCTL(SIOCSIWPOWER) = r8192_wx_set_power, - IW_IOCTL(SIOCGIWPOWER) = r8192_wx_get_power, - IW_IOCTL(SIOCSIWGENIE) = r8192_wx_set_gen_ie, - IW_IOCTL(SIOCGIWGENIE) = r8192_wx_get_gen_ie, - IW_IOCTL(SIOCSIWMLME) = r8192_wx_set_mlme, - IW_IOCTL(SIOCSIWAUTH) = r8192_wx_set_auth, - IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext, + [IW_IOCTL(SIOCGIWNAME)] = r8192_wx_get_name, + [IW_IOCTL(SIOCSIWFREQ)] = r8192_wx_set_freq, + [IW_IOCTL(SIOCGIWFREQ)] = r8192_wx_get_freq, + [IW_IOCTL(SIOCSIWMODE)] = r8192_wx_set_mode, + [IW_IOCTL(SIOCGIWMODE)] = r8192_wx_get_mode, + [IW_IOCTL(SIOCSIWSENS)] = r8192_wx_set_sens, + [IW_IOCTL(SIOCGIWSENS)] = r8192_wx_get_sens, + [IW_IOCTL(SIOCGIWRANGE)] = rtl8192_wx_get_range, + [IW_IOCTL(SIOCSIWAP)] = r8192_wx_set_wap, + [IW_IOCTL(SIOCGIWAP)] = r8192_wx_get_wap, + [IW_IOCTL(SIOCSIWSCAN)] = r8192_wx_set_scan, + [IW_IOCTL(SIOCGIWSCAN)] = r8192_wx_get_scan, + [IW_IOCTL(SIOCSIWESSID)] = r8192_wx_set_essid, + [IW_IOCTL(SIOCGIWESSID)] = r8192_wx_get_essid, + [IW_IOCTL(SIOCSIWNICKN)] = r8192_wx_set_nick, + [IW_IOCTL(SIOCGIWNICKN)] = r8192_wx_get_nick, + [IW_IOCTL(SIOCSIWRATE)] = r8192_wx_set_rate, + [IW_IOCTL(SIOCGIWRATE)] = r8192_wx_get_rate, + [IW_IOCTL(SIOCSIWRTS)] = r8192_wx_set_rts, + [IW_IOCTL(SIOCGIWRTS)] = r8192_wx_get_rts, + [IW_IOCTL(SIOCSIWFRAG)] = r8192_wx_set_frag, + [IW_IOCTL(SIOCGIWFRAG)] = r8192_wx_get_frag, + [IW_IOCTL(SIOCSIWRETRY)] = r8192_wx_set_retry, + [IW_IOCTL(SIOCGIWRETRY)] = r8192_wx_get_retry, + [IW_IOCTL(SIOCSIWENCODE)] = r8192_wx_set_enc, + [IW_IOCTL(SIOCGIWENCODE)] = r8192_wx_get_enc, + [IW_IOCTL(SIOCSIWPOWER)] = r8192_wx_set_power, + [IW_IOCTL(SIOCGIWPOWER)] = r8192_wx_get_power, + [IW_IOCTL(SIOCSIWGENIE)] = r8192_wx_set_gen_ie, + [IW_IOCTL(SIOCGIWGENIE)] = r8192_wx_get_gen_ie, + [IW_IOCTL(SIOCSIWMLME)] = r8192_wx_set_mlme, + [IW_IOCTL(SIOCSIWAUTH)] = r8192_wx_set_auth, + [IW_IOCTL(SIOCSIWENCODEEXT)] = r8192_wx_set_enc_ext, }; /* the following rule need to be following, From cb7cca3ae8f152151104252298d2e1e91db6df92 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:46 +0200 Subject: [PATCH 578/912] staging: rtl8192e: Drop large switch in rtl92e_config_rf The same steps were made for each RF path independently. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../rtl8192e/rtl8192e/r8190P_rtl8256.c | 69 +++---------------- 1 file changed, 9 insertions(+), 60 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 194d64cf24ea..c8f25ade2535 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -122,70 +122,19 @@ bool rtl92e_config_rf(struct net_device *dev) RetryTimes = ConstRetryTimes; RF3_Final_Value = 0; - switch (eRFPath) { - case RF90_PATH_A: - while (RF3_Final_Value != RegValueToBeCheck && - RetryTimes != 0) { - ret = rtl92e_config_rf_path(dev, + while (RF3_Final_Value != RegValueToBeCheck && + RetryTimes != 0) { + ret = rtl92e_config_rf_path(dev, (enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl92e_get_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - RegOffSetToBeCheck, - bMask12Bits); - RT_TRACE(COMP_RF, - "RF %d %d register final value: %x\n", - eRFPath, RegOffSetToBeCheck, - RF3_Final_Value); - RetryTimes--; - } - break; - case RF90_PATH_B: - while (RF3_Final_Value != RegValueToBeCheck && - RetryTimes != 0) { - ret = rtl92e_config_rf_path(dev, - (enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl92e_get_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - RegOffSetToBeCheck, - bMask12Bits); - RT_TRACE(COMP_RF, - "RF %d %d register final value: %x\n", - eRFPath, RegOffSetToBeCheck, - RF3_Final_Value); - RetryTimes--; - } - break; - case RF90_PATH_C: - while (RF3_Final_Value != RegValueToBeCheck && - RetryTimes != 0) { - ret = rtl92e_config_rf_path(dev, - (enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl92e_get_rf_reg(dev, + RF3_Final_Value = rtl92e_get_rf_reg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, - "RF %d %d register final value: %x\n", - eRFPath, RegOffSetToBeCheck, - RF3_Final_Value); - RetryTimes--; - } - break; - case RF90_PATH_D: - while (RF3_Final_Value != RegValueToBeCheck && - RetryTimes != 0) { - ret = rtl92e_config_rf_path(dev, - (enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl92e_get_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, - "RF %d %d register final value: %x\n", - eRFPath, RegOffSetToBeCheck, - RF3_Final_Value); - RetryTimes--; - } - break; + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); + RetryTimes--; } switch (eRFPath) { From 948fa942dc6bb4000bdf94901e99570b7636ed7c Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:47 +0200 Subject: [PATCH 579/912] staging: rtl8192e: probe: iounmap mmio when probe fails In case of probe failure, io memory was not released properly. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 0033cfb21351..c868cb373a4b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2642,12 +2642,12 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, pci_read_config_byte(pdev, 0x08, &revision_id); /* If the revisionid is 0x10, the device uses rtl8192se. */ if (pdev->device == 0x8192 && revision_id == 0x10) - goto err_rel_mem; + goto err_unmap; priv->ops = ops; if (rtl92e_check_adapter(pdev, dev) == false) - goto err_rel_mem; + goto err_unmap; dev->irq = pdev->irq; priv->irq = 0; @@ -2688,6 +2688,8 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, err_free_irq: free_irq(dev->irq, dev); priv->irq = 0; +err_unmap: + iounmap((void __iomem *)ioaddr); err_rel_mem: release_mem_region(pmem_start, pmem_len); err_rel_rtllib: From 58e446fcc69436988fdab4a81981f44193f064f7 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 30 Jul 2015 18:18:28 +0200 Subject: [PATCH 580/912] iio: Export I2C module alias information in missing drivers The I2C core always reports the MODALIAS uevent as "i2c: Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 1 + drivers/iio/accel/stk8ba50.c | 1 + drivers/iio/light/stk3310.c | 1 + 3 files changed, 3 insertions(+) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index c2bd1444d6da..a553736b6e51 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -662,6 +662,7 @@ static const struct i2c_device_id stk8312_i2c_id[] = { {"STK8312", 0}, {} }; +MODULE_DEVICE_TABLE(i2c, stk8312_i2c_id); static const struct acpi_device_id stk8312_acpi_id[] = { {"STK8312", 0}, diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c index 16cee637109b..80f77d8704b5 100644 --- a/drivers/iio/accel/stk8ba50.c +++ b/drivers/iio/accel/stk8ba50.c @@ -572,6 +572,7 @@ static const struct i2c_device_id stk8ba50_i2c_id[] = { {"stk8ba50", 0}, {} }; +MODULE_DEVICE_TABLE(i2c, stk8ba50_i2c_id); static const struct acpi_device_id stk8ba50_acpi_id[] = { {"STK8BA50", 0}, diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index fee4297d7c8f..d26b931730ee 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -695,6 +695,7 @@ static const struct i2c_device_id stk3310_i2c_id[] = { {"STK3311", 0}, {} }; +MODULE_DEVICE_TABLE(i2c, stk3310_i2c_id); static const struct acpi_device_id stk3310_acpi_id[] = { {"STK3310", 0}, From 119c4fce683a22a2fdbe343e00bc1a20cc1dd11c Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 30 Jul 2015 18:18:42 +0200 Subject: [PATCH 581/912] iio: Export OF module alias information in missing drivers The I2C core always reports the MODALIAS uevent as "i2c: Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 1 + drivers/iio/light/cm32181.c | 1 + drivers/iio/light/cm3232.c | 1 + drivers/iio/light/cm36651.c | 1 + drivers/iio/light/gp2ap020a00f.c | 1 + 5 files changed, 5 insertions(+) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index e8e2077c7244..3c4ad1563ca4 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -968,6 +968,7 @@ static const struct of_device_id mma8452_dt_ids[] = { { .compatible = "fsl,mma8452" }, { } }; +MODULE_DEVICE_TABLE(of, mma8452_dt_ids); static struct i2c_driver mma8452_driver = { .driver = { diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c index 1c0de2f8885d..d6fd0dace74f 100644 --- a/drivers/iio/light/cm32181.c +++ b/drivers/iio/light/cm32181.c @@ -353,6 +353,7 @@ static const struct of_device_id cm32181_of_match[] = { { .compatible = "capella,cm32181" }, { } }; +MODULE_DEVICE_TABLE(of, cm32181_of_match); static struct i2c_driver cm32181_driver = { .driver = { diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c index 1b508c65877c..fe89b6823217 100644 --- a/drivers/iio/light/cm3232.c +++ b/drivers/iio/light/cm3232.c @@ -417,6 +417,7 @@ static const struct of_device_id cm3232_of_match[] = { {.compatible = "capella,cm3232"}, {} }; +MODULE_DEVICE_TABLE(of, cm3232_of_match); static struct i2c_driver cm3232_driver = { .driver = { diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index 2a39e141e90c..c8d7b5ea7e78 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c @@ -731,6 +731,7 @@ static const struct of_device_id cm36651_of_match[] = { { .compatible = "capella,cm36651" }, { } }; +MODULE_DEVICE_TABLE(of, cm36651_of_match); static struct i2c_driver cm36651_driver = { .driver = { diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c index 0334a814b5eb..6d41086f7c64 100644 --- a/drivers/iio/light/gp2ap020a00f.c +++ b/drivers/iio/light/gp2ap020a00f.c @@ -1634,6 +1634,7 @@ static const struct of_device_id gp2ap020a00f_of_match[] = { { .compatible = "sharp,gp2ap020a00f" }, { } }; +MODULE_DEVICE_TABLE(of, gp2ap020a00f_of_match); #endif static struct i2c_driver gp2ap020a00f_driver = { From 9e35d366a1e8bd710fbebcf9af90d3fafbc55e36 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Fri, 31 Jul 2015 17:27:24 +0300 Subject: [PATCH 582/912] iio: mmc35240: minor change to improve code readibility This patch changes two variables to arrays to improve code readibility. Signed-off-by: Teodora Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/mmc35240.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index 9bc542daa732..fa4ccd070e56 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c @@ -308,31 +308,31 @@ static int mmc35240_read_measurement(struct mmc35240_data *data, __le16 buf[3]) static int mmc35240_raw_to_mgauss(struct mmc35240_data *data, int index, __le16 buf[], int *val) { - int raw_x, raw_y, raw_z; - int sens_x, sens_y, sens_z; + int raw[3]; + int sens[3]; int nfo; - raw_x = le16_to_cpu(buf[AXIS_X]); - raw_y = le16_to_cpu(buf[AXIS_Y]); - raw_z = le16_to_cpu(buf[AXIS_Z]); + raw[AXIS_X] = le16_to_cpu(buf[AXIS_X]); + raw[AXIS_Y] = le16_to_cpu(buf[AXIS_Y]); + raw[AXIS_Z] = le16_to_cpu(buf[AXIS_Z]); - sens_x = mmc35240_props_table[data->res].sens[AXIS_X]; - sens_y = mmc35240_props_table[data->res].sens[AXIS_Y]; - sens_z = mmc35240_props_table[data->res].sens[AXIS_Z]; + sens[AXIS_X] = mmc35240_props_table[data->res].sens[AXIS_X]; + sens[AXIS_Y] = mmc35240_props_table[data->res].sens[AXIS_Y]; + sens[AXIS_Z] = mmc35240_props_table[data->res].sens[AXIS_Z]; nfo = mmc35240_props_table[data->res].nfo; switch (index) { case AXIS_X: - *val = (raw_x - nfo) * 1000 / sens_x; + *val = (raw[AXIS_X] - nfo) * 1000 / sens[AXIS_X]; break; case AXIS_Y: - *val = (raw_y - nfo) * 1000 / sens_y - - (raw_z - nfo) * 1000 / sens_z; + *val = (raw[AXIS_Y] - nfo) * 1000 / sens[AXIS_Y] - + (raw[AXIS_Z] - nfo) * 1000 / sens[AXIS_Z]; break; case AXIS_Z: - *val = (raw_y - nfo) * 1000 / sens_y + - (raw_z - nfo) * 1000 / sens_z; + *val = (raw[AXIS_Y] - nfo) * 1000 / sens[AXIS_Y] + + (raw[AXIS_Z] - nfo) * 1000 / sens[AXIS_Z]; break; default: return -EINVAL; From f9ba1ab4d19a79b4bef4baf21f559f9dd8ba33f9 Mon Sep 17 00:00:00 2001 From: Crt Mori Date: Mon, 20 Jul 2015 21:38:27 +0200 Subject: [PATCH 583/912] iio: mlx90614: Define magic numbers Translates the magic constant numbers to named macros and add some additional comments about their meaning. The diff is made towards togreg branch as that branch seems to have the most recent updates of mlx90614 driver (many are yet to be merged). Signed-off-by: Crt Mori Acked-by: Peter Meerwald Signed-off-by: Jonathan Cameron --- drivers/iio/temperature/mlx90614.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c index 90f70b461567..5d033a5af615 100644 --- a/drivers/iio/temperature/mlx90614.c +++ b/drivers/iio/temperature/mlx90614.c @@ -65,6 +65,13 @@ #define MLX90614_AUTOSLEEP_DELAY 5000 /* default autosleep delay */ +/* Magic constants */ +#define MLX90614_CONST_OFFSET_DEC -13657 /* decimal part of the Kelvin offset */ +#define MLX90614_CONST_OFFSET_REM 500000 /* remainder of offset (273.15*50) */ +#define MLX90614_CONST_SCALE 20 /* Scale in milliKelvin (0.02 * 1000) */ +#define MLX90614_CONST_RAW_EMISSIVITY_MAX 65535 /* max value for emissivity */ +#define MLX90614_CONST_EMISSIVITY_RESOLUTION 15259 /* 1/65535 ~ 0.000015259 */ + struct mlx90614_data { struct i2c_client *client; struct mutex lock; /* for EEPROM access only */ @@ -204,11 +211,11 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev, *val = ret; return IIO_VAL_INT; case IIO_CHAN_INFO_OFFSET: - *val = 13657; - *val2 = 500000; + *val = MLX90614_CONST_OFFSET_DEC; + *val2 = MLX90614_CONST_OFFSET_REM; return IIO_VAL_INT_PLUS_MICRO; case IIO_CHAN_INFO_SCALE: - *val = 20; + *val = MLX90614_CONST_SCALE; return IIO_VAL_INT; case IIO_CHAN_INFO_CALIBEMISSIVITY: /* 1/65535 / LSB */ mlx90614_power_get(data, false); @@ -221,12 +228,12 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev, if (ret < 0) return ret; - if (ret == 65535) { + if (ret == MLX90614_CONST_RAW_EMISSIVITY_MAX) { *val = 1; *val2 = 0; } else { *val = 0; - *val2 = ret * 15259; /* 1/65535 ~ 0.000015259 */ + *val2 = ret * MLX90614_CONST_EMISSIVITY_RESOLUTION; } return IIO_VAL_INT_PLUS_NANO; default: @@ -245,7 +252,8 @@ static int mlx90614_write_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_CALIBEMISSIVITY: /* 1/65535 / LSB */ if (val < 0 || val2 < 0 || val > 1 || (val == 1 && val2 != 0)) return -EINVAL; - val = val * 65535 + val2 / 15259; /* 1/65535 ~ 0.000015259 */ + val = val * MLX90614_CONST_RAW_EMISSIVITY_MAX + + val2 / MLX90614_CONST_EMISSIVITY_RESOLUTION; mlx90614_power_get(data, false); mutex_lock(&data->lock); From 3021678a94cdb942bea4e634a37e91fe341b27b0 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Fri, 17 Jul 2015 10:52:30 +0200 Subject: [PATCH 584/912] iio:magnetometer:bmc150_magn: expand mutex in trigger_handler Keep the mutex locked, until the content of data->buffer has been pushed out. Signed-off-by: Hartmut Knaack Acked-by: Irina Tirdea Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/bmc150_magn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index 074a99da7367..324412d51cf8 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -664,7 +664,6 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p) mutex_lock(&data->mutex); ret = bmc150_magn_read_xyz(data, data->buffer); - mutex_unlock(&data->mutex); if (ret < 0) goto err; @@ -672,6 +671,7 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p) pf->timestamp); err: + mutex_unlock(&data->mutex); iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; From 1506f3cd0b8169773188a080d367c2ed019373a3 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Fri, 17 Jul 2015 10:52:31 +0200 Subject: [PATCH 585/912] iio:magnetometer:bmc150_magn: use descriptive name for mask Define and use a descriptive name for the repetition registers data mask, instead of a 'magic' value. Signed-off-by: Hartmut Knaack Acked-by: Irina Tirdea Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/bmc150_magn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index 324412d51cf8..9ae6479b8d84 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -85,6 +85,7 @@ #define BMC150_MAGN_REG_HIGH_THRESH 0x50 #define BMC150_MAGN_REG_REP_XY 0x51 #define BMC150_MAGN_REG_REP_Z 0x52 +#define BMC150_MAGN_REG_REP_DATAMASK GENMASK(7, 0) #define BMC150_MAGN_REG_TRIM_START 0x5D #define BMC150_MAGN_REG_TRIM_END 0x71 @@ -559,7 +560,7 @@ static int bmc150_magn_write_raw(struct iio_dev *indio_dev, } ret = regmap_update_bits(data->regmap, BMC150_MAGN_REG_REP_XY, - 0xFF, + BMC150_MAGN_REG_REP_DATAMASK, BMC150_MAGN_REPXY_TO_REGVAL (val)); mutex_unlock(&data->mutex); @@ -575,7 +576,7 @@ static int bmc150_magn_write_raw(struct iio_dev *indio_dev, } ret = regmap_update_bits(data->regmap, BMC150_MAGN_REG_REP_Z, - 0xFF, + BMC150_MAGN_REG_REP_DATAMASK, BMC150_MAGN_REPZ_TO_REGVAL (val)); mutex_unlock(&data->mutex); From 019cc46d0a5c559bca6c7e949cc277f529a51296 Mon Sep 17 00:00:00 2001 From: Irina Tirdea Date: Thu, 23 Jul 2015 20:15:01 +0300 Subject: [PATCH 586/912] iio: magn: bmc150_magn: add locking comment for runtime resume Runtime resume function is called with the data->mutex lock held. Add a comment to indicate this. Signed-off-by: Irina Tirdea Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/bmc150_magn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index 9ae6479b8d84..57f21fe10dd7 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -1044,6 +1044,9 @@ static int bmc150_magn_runtime_suspend(struct device *dev) return 0; } +/* + * Should be called with data->mutex held. + */ static int bmc150_magn_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); From 5ab744d0d6e7fc90572250239ac796cd79b0ed77 Mon Sep 17 00:00:00 2001 From: Irina Tirdea Date: Thu, 23 Jul 2015 20:15:02 +0300 Subject: [PATCH 587/912] iio: magn: bmc150_magn: do not set power state twice when setting trigger state When setting the trigger state, the device power state is set through buffer preenable and postdisable hooks. There is no need to also set it in the trigger set state call. Remove duplicate set power state from the trigger set state call. Signed-off-by: Irina Tirdea Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/bmc150_magn.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index 57f21fe10dd7..bf47c8838b49 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -784,29 +784,23 @@ static int bmc150_magn_data_rdy_trigger_set_state(struct iio_trigger *trig, if (state == data->dready_trigger_on) goto err_unlock; - ret = bmc150_magn_set_power_state(data, state); - if (ret < 0) - goto err_unlock; - ret = regmap_update_bits(data->regmap, BMC150_MAGN_REG_INT_DRDY, BMC150_MAGN_MASK_DRDY_EN, state << BMC150_MAGN_SHIFT_DRDY_EN); if (ret < 0) - goto err_poweroff; + goto err_unlock; data->dready_trigger_on = state; if (state) { ret = bmc150_magn_reset_intr(data); if (ret < 0) - goto err_poweroff; + goto err_unlock; } mutex_unlock(&data->mutex); return 0; -err_poweroff: - bmc150_magn_set_power_state(data, false); err_unlock: mutex_unlock(&data->mutex); return ret; From 2498dcf6e09b3ecce2b32ed6434bd02fc4219d5b Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 24 Jul 2015 16:16:19 +0300 Subject: [PATCH 588/912] iio: core: Add function params for kernel docs This patch adds the missing fields in kernel docs to remove some warnings that appear when the IIO Documentation DocBook is generated. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-core.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index d8051cdcbdc2..b3fcc2c449d8 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -406,10 +406,16 @@ EXPORT_SYMBOL_GPL(iio_enum_write); /** * iio_format_value() - Formats a IIO value into its string representation - * @buf: The buffer to which the formated value gets written - * @type: One of the IIO_VAL_... constants. This decides how the val and val2 - * parameters are formatted. - * @vals: pointer to the values, exact meaning depends on the type parameter. + * @buf: The buffer to which the formatted value gets written + * @type: One of the IIO_VAL_... constants. This decides how the val + * and val2 parameters are formatted. + * @size: Number of IIO value entries contained in vals + * @vals: Pointer to the values, exact meaning depends on the + * type parameter. + * + * Return: 0 by default, a negative number on failure or the + * total number of characters written for a type that belongs + * to the IIO_VAL_... constant. */ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals) { @@ -1096,6 +1102,11 @@ EXPORT_SYMBOL_GPL(devm_iio_device_free); /** * iio_chrdev_open() - chrdev file open for buffer access and ioctls + * @inode: Inode structure for identifying the device in the file system + * @filp: File structure for iio device used to keep and later access + * private data + * + * Return: 0 on success or -EBUSY if the device is already opened **/ static int iio_chrdev_open(struct inode *inode, struct file *filp) { @@ -1114,7 +1125,11 @@ static int iio_chrdev_open(struct inode *inode, struct file *filp) /** * iio_chrdev_release() - chrdev file close buffer access and ioctls - **/ + * @inode: Inode structure pointer for the char device + * @filp: File structure pointer for the char device + * + * Return: 0 for successful release + */ static int iio_chrdev_release(struct inode *inode, struct file *filp) { struct iio_dev *indio_dev = container_of(inode->i_cdev, From 0123635a77f72e0787f6f8b3ac796a40f796fcc4 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 24 Jul 2015 16:18:09 +0300 Subject: [PATCH 589/912] iio: buffer: Fix kernel docs warnings Fix kernel docs for structures and functions in order to remove some warnings when the documentation gets generated. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-buffer.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index f72be48e650c..faed6efa49ec 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -91,9 +91,16 @@ static bool iio_buffer_ready(struct iio_dev *indio_dev, struct iio_buffer *buf, /** * iio_buffer_read_first_n_outer() - chrdev read for buffer access + * @filp: File structure pointer for the char device + * @buf: Destination buffer for iio buffer read + * @n: First n bytes to read + * @f_ps: Long offset provided by the user as a seek position * * This function relies on all buffer implementations having an * iio_buffer as their first element. + * + * Return: negative values corresponding to error codes or ret != 0 + * for ending the reading activity **/ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, size_t n, loff_t *f_ps) @@ -143,6 +150,12 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, /** * iio_buffer_poll() - poll the buffer to find out if it has data + * @filp: File structure pointer for device access + * @wait: Poll table structure pointer for which the driver adds + * a wait queue + * + * Return: (POLLIN | POLLRDNORM) if data is available for reading + * or 0 for other cases */ unsigned int iio_buffer_poll(struct file *filp, struct poll_table_struct *wait) @@ -1136,7 +1149,7 @@ int iio_scan_mask_query(struct iio_dev *indio_dev, EXPORT_SYMBOL_GPL(iio_scan_mask_query); /** - * struct iio_demux_table() - table describing demux memcpy ops + * struct iio_demux_table - table describing demux memcpy ops * @from: index to copy from * @to: index to copy to * @length: how many bytes to copy From a316c01d59e9d45ede1083a81ae82eb15ae7eab3 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 24 Jul 2015 16:21:50 +0300 Subject: [PATCH 590/912] iio: event: Add missing fields in kernel docs Fix kernel docs warnings by adding the missing fields, each with its associated description. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-event.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index 894d8137c4cf..b2f63f919cc4 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -32,6 +32,7 @@ * @dev_attr_list: list of event interface sysfs attribute * @flags: file operations related flags including busy flag. * @group: event interface sysfs attribute group + * @read_lock: lock to protect kfifo read operations */ struct iio_event_interface { wait_queue_head_t wait; @@ -75,6 +76,11 @@ EXPORT_SYMBOL(iio_push_event); /** * iio_event_poll() - poll the event queue to find out if it has data + * @filep: File structure pointer to identify the device + * @wait: Poll table pointer to add the wait queue on + * + * Return: (POLLIN | POLLRDNORM) if data is available for reading + * or a negative error code on failure */ static unsigned int iio_event_poll(struct file *filep, struct poll_table_struct *wait) From e52e95199d0c1aa8a06dbbc07b30562fded8b298 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 24 Jul 2015 16:23:43 +0300 Subject: [PATCH 591/912] include: linux: iio: Fix function parameter name in kernel doc Fix buffer name from kernel doc according to the function parameter. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- include/linux/iio/consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h index 26fb8f6342bb..fad58671c49e 100644 --- a/include/linux/iio/consumer.h +++ b/include/linux/iio/consumer.h @@ -100,7 +100,7 @@ void iio_channel_stop_all_cb(struct iio_cb_buffer *cb_buff); /** * iio_channel_cb_get_channels() - get access to the underlying channels. - * @cb_buff: The callback buffer from whom we want the channel + * @cb_buffer: The callback buffer from whom we want the channel * information. * * This function allows one to obtain information about the channels. From 2854c098e222a706b91cc83b4a91dbfd97212765 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 24 Jul 2015 16:26:09 +0300 Subject: [PATCH 592/912] include: linux: iio: Add missing kernel doc field Fix kernel doc for the iio_dev_attr structure by adding its missing field. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- include/linux/iio/sysfs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h index 8a1d18640ab9..9cd8f747212f 100644 --- a/include/linux/iio/sysfs.h +++ b/include/linux/iio/sysfs.h @@ -18,7 +18,8 @@ struct iio_chan_spec; * struct iio_dev_attr - iio specific device attribute * @dev_attr: underlying device attribute * @address: associated register address - * @l: list head for maintaining list of dynamically created attrs. + * @l: list head for maintaining list of dynamically created attrs + * @c: specification for the underlying channel */ struct iio_dev_attr { struct device_attribute dev_attr; From ae067cb68d2ef42d4a84eeaf07411fe2936f48c4 Mon Sep 17 00:00:00 2001 From: Irina Tirdea Date: Fri, 24 Jul 2015 16:28:05 +0300 Subject: [PATCH 593/912] tools: iio: fix mask for 32 bit sensor data When the the sensor data uses 32 bits out of 32, generic_buffer prints the value 0 for all data read. In this case, the mask is shifted 32 bits, which is beyond the size of an integer. This will lead to the mask always being 0. Before printing, the mask is applied to the raw value, thus generating a final value of 0. Fix the mask by shifting a 64 bit value instead of an integer. Signed-off-by: Irina Tirdea Acked-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 1dcdf03955cb..a95270f33353 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -168,7 +168,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, if (*bits_used == 64) *mask = ~0; else - *mask = (1 << *bits_used) - 1; + *mask = (1ULL << *bits_used) - 1; *is_signed = (signchar == 's'); if (fclose(sysfsfp)) { From e7231491ce6ae2053569166f60835a5594b3c0af Mon Sep 17 00:00:00 2001 From: Irina Tirdea Date: Fri, 24 Jul 2015 16:28:06 +0300 Subject: [PATCH 594/912] tools: iio: print error message when buffer enable fails Running generic_buffer without enabling any channel of the sensor will fail without printing any error message. Add an error message that indicates buffer enable failed. Signed-off-by: Irina Tirdea Acked-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/generic_buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 32f389ebb94d..9f7b85bf6ada 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -364,8 +364,11 @@ int main(int argc, char **argv) /* Enable the buffer */ ret = write_sysfs_int("enable", buf_dir_name, 1); - if (ret < 0) + if (ret < 0) { + fprintf(stderr, + "Failed to enable buffer: %s\n", strerror(-ret)); goto error_free_buf_dir_name; + } scan_size = size_from_channelarray(channels, num_channels); data = malloc(scan_size * buf_len); From 280f09256ab6f6180132da193b9f2e0b2fa61c51 Mon Sep 17 00:00:00 2001 From: Joo Aun Saw Date: Wed, 29 Jul 2015 01:12:24 +1000 Subject: [PATCH 595/912] tools: iio: iio_utils: remove unnecessary define guard Signed-off-by: Joo Aun Saw Acked-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index a95270f33353..31aca9ab078b 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -6,9 +6,6 @@ * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ -#ifndef _IIO_UTILS_H -#define _IIO_UTILS_H - #include #include #include @@ -990,5 +987,3 @@ error_free: return ret; } - -#endif /* _IIO_UTILS_H */ From 5e37c523921480093323c06529ab854f0635c59d Mon Sep 17 00:00:00 2001 From: Joo Aun Saw Date: Tue, 28 Jul 2015 11:46:13 +1000 Subject: [PATCH 596/912] tools: iio: iio_utils: Make calc_digits static Signed-off-by: Joo Aun Saw Acked-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 31aca9ab078b..4bbd6e7959cd 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -537,7 +537,7 @@ error_free_name: return ret; } -int calc_digits(int num) +static int calc_digits(int num) { int count = 0; From 19d566420b8c5a26d4f9666ef665e088173d3df3 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Tue, 28 Jul 2015 00:38:58 +0200 Subject: [PATCH 597/912] iio:adc:berlin2-adc: pass up real error code Pass up the real error code returned by platform_get_irq_byname(). Signed-off-by: Hartmut Knaack Acked-by: Antoine Tenart Signed-off-by: Jonathan Cameron --- drivers/iio/adc/berlin2-adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c index aecc9ad995ad..30e2090df96d 100644 --- a/drivers/iio/adc/berlin2-adc.c +++ b/drivers/iio/adc/berlin2-adc.c @@ -301,11 +301,11 @@ static int berlin2_adc_probe(struct platform_device *pdev) irq = platform_get_irq_byname(pdev, "adc"); if (irq < 0) - return -ENODEV; + return irq; tsen_irq = platform_get_irq_byname(pdev, "tsen"); if (tsen_irq < 0) - return -ENODEV; + return tsen_irq; ret = devm_request_irq(&pdev->dev, irq, berlin2_adc_irq, 0, pdev->dev.driver->name, indio_dev); From 688febbd168c52ab54ad29c210aceecb72386398 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Tue, 28 Jul 2015 00:39:00 +0200 Subject: [PATCH 598/912] iio:adc:berlin2-adc: constify iio_chan_spec Mark berlin2_adc_channels array as constant. Signed-off-by: Hartmut Knaack Acked-by: Antoine Tenart Signed-off-by: Jonathan Cameron --- drivers/iio/adc/berlin2-adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c index 30e2090df96d..2084b0b66ea0 100644 --- a/drivers/iio/adc/berlin2-adc.c +++ b/drivers/iio/adc/berlin2-adc.c @@ -86,7 +86,7 @@ struct berlin2_adc_priv { .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ } -static struct iio_chan_spec berlin2_adc_channels[] = { +static const struct iio_chan_spec berlin2_adc_channels[] = { BERLIN2_ADC_CHANNEL(0, IIO_VOLTAGE), /* external input */ BERLIN2_ADC_CHANNEL(1, IIO_VOLTAGE), /* external input */ BERLIN2_ADC_CHANNEL(2, IIO_VOLTAGE), /* external input */ From 609e9d88f277bfe83392595745cc3976d42125b2 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Tue, 28 Jul 2015 00:39:01 +0200 Subject: [PATCH 599/912] iio:adc:berlin2-adc: use short operator format Use augmented assignment to subtract the offset for negative temperature values. Specify the amount of private data to be allocated through devm_iio_device_alloc() with sizeof(*priv), as it is shorter and common practice in IIO. Signed-off-by: Hartmut Knaack Acked-by: Antoine Tenart Signed-off-by: Jonathan Cameron --- drivers/iio/adc/berlin2-adc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c index 2084b0b66ea0..e04b7734df1d 100644 --- a/drivers/iio/adc/berlin2-adc.c +++ b/drivers/iio/adc/berlin2-adc.c @@ -221,7 +221,7 @@ static int berlin2_adc_read_raw(struct iio_dev *indio_dev, return temp; if (temp > 2047) - temp = -(4096 - temp); + temp -= 4096; /* Convert to milli Celsius */ *val = ((temp * 100000) / 264 - 270000); @@ -286,8 +286,7 @@ static int berlin2_adc_probe(struct platform_device *pdev) int irq, tsen_irq; int ret; - indio_dev = devm_iio_device_alloc(&pdev->dev, - sizeof(struct berlin2_adc_priv)); + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); if (!indio_dev) return -ENOMEM; From 546384c968383b512ba50f77c76ae7bdfa321f31 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Tue, 28 Jul 2015 00:39:02 +0200 Subject: [PATCH 600/912] iio:adc:berlin2-adc: use channel-array size directly Drop the otherwise unused definition of the channel-array size and use it directly in _probe - makes it a bit more obvious. Signed-off-by: Hartmut Knaack Acked-by: Antoine Tenart Signed-off-by: Jonathan Cameron --- drivers/iio/adc/berlin2-adc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c index e04b7734df1d..3aaf3a975c79 100644 --- a/drivers/iio/adc/berlin2-adc.c +++ b/drivers/iio/adc/berlin2-adc.c @@ -103,7 +103,6 @@ static const struct iio_chan_spec berlin2_adc_channels[] = { BERLIN2_ADC_CHANNEL(7, IIO_VOLTAGE), /* reserved */ IIO_CHAN_SOFT_TIMESTAMP(8), /* timestamp */ }; -#define BERLIN2_N_CHANNELS ARRAY_SIZE(berlin2_adc_channels) static int berlin2_adc_read(struct iio_dev *indio_dev, int channel) { @@ -324,8 +323,8 @@ static int berlin2_adc_probe(struct platform_device *pdev) indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->info = &berlin2_adc_info; - indio_dev->num_channels = BERLIN2_N_CHANNELS; indio_dev->channels = berlin2_adc_channels; + indio_dev->num_channels = ARRAY_SIZE(berlin2_adc_channels); /* Power up the ADC */ regmap_update_bits(priv->regmap, BERLIN2_SM_CTRL, From 946448e08e2f693ff21418d92a598b7aa296816d Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Tue, 28 Jul 2015 00:49:21 +0200 Subject: [PATCH 601/912] iio:accel:stk8312: add triggered buffer dependency Add the still missing dependencies for triggered buffer support. Fixes: 95c12bba51c37 ("iio: accel: Add buffer mode for Sensortek STK8312") Signed-off-by: Hartmut Knaack Reviewed-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index 00e7bcbdbe24..c99d8e242218 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -140,6 +140,8 @@ config MMA9553 config STK8312 tristate "Sensortek STK8312 3-Axis Accelerometer Driver" depends on I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to get support for the Sensortek STK8312 3-axis accelerometer. From b41e63cf83affa50a6141eba52be1fbd05f29b21 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Tue, 28 Jul 2015 00:49:22 +0200 Subject: [PATCH 602/912] iio:accel:stk8312: check for invalid value Revision 1.2 of the datasheet recommends on page 22 to only write non-zero values read from OTP register 0x70 into AFECTRL register. Signed-off-by: Hartmut Knaack Reviewed-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index a553736b6e51..8280a37e0068 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -150,6 +150,8 @@ static int stk8312_otp_init(struct stk8312_data *data) goto exit_err; ret = i2c_smbus_read_byte_data(client, STK8312_REG_OTPDATA); + if (ret == 0) + ret = -EINVAL; if (ret < 0) goto exit_err; From 2ae0751007cdf2deaa87e160f28c50a00b478883 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Mon, 3 Aug 2015 13:44:30 +0200 Subject: [PATCH 603/912] Staging: most: avoid possible integer overflow This patch prevents a potential integer overlow. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/mostcore/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index f872dc0bc118..f4fea8cf5560 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -1260,7 +1260,7 @@ int arm_mbo_chain(struct most_c_obj *c, int dir, void (*compl)(struct mbo *)) unsigned int i; int retval; struct mbo *mbo; - u16 coherent_buf_size = c->cfg.buffer_size + c->cfg.extra_len; + u32 coherent_buf_size = c->cfg.buffer_size + c->cfg.extra_len; atomic_set(&c->mbo_nq_level, 0); From f8ff8db038273c9b356c64857f396f037adaefca Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 3 Aug 2015 11:35:47 -0700 Subject: [PATCH 604/912] staging: most: fix aim-sound build errors Fix build errors: driver uses snd_pcm*() interfaces, so select SND_PCM. drivers/built-in.o: In function `audio_rx_completion': sound.c:(.text+0x3cd376): undefined reference to `snd_pcm_period_elapsed' drivers/built-in.o: In function `pcm_prepare': sound.c:(.text+0x3cd3b0): undefined reference to `snd_pcm_format_physical_width' sound.c:(.text+0x3cd3ce): undefined reference to `snd_pcm_format_big_endian' sound.c:(.text+0x3cd42c): undefined reference to `snd_pcm_format_big_endian' drivers/built-in.o: In function `pcm_hw_free': sound.c:(.text+0x3cd50a): undefined reference to `snd_pcm_lib_free_vmalloc_buffer' drivers/built-in.o: In function `pcm_hw_params': sound.c:(.text+0x3cd54c): undefined reference to `_snd_pcm_lib_alloc_vmalloc_buffer' drivers/built-in.o: In function `playback_thread': sound.c:(.text+0x3cd6a0): undefined reference to `snd_pcm_period_elapsed' drivers/built-in.o: In function `audio_probe_channel': sound.c:(.text+0x3cdc0b): undefined reference to `snd_pcm_new' sound.c:(.text+0x3cdc2b): undefined reference to `snd_pcm_set_ops' drivers/built-in.o:(.data+0x952d0): undefined reference to `snd_pcm_lib_ioctl' drivers/built-in.o:(.data+0x95318): undefined reference to `snd_pcm_lib_get_vmalloc_page' Signed-off-by: Randy Dunlap Acked-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-sound/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/most/aim-sound/Kconfig b/drivers/staging/most/aim-sound/Kconfig index b9e499c77d00..3194c219ff14 100644 --- a/drivers/staging/most/aim-sound/Kconfig +++ b/drivers/staging/most/aim-sound/Kconfig @@ -5,6 +5,7 @@ config AIM_SOUND tristate "ALSA AIM" depends on SND + select SND_PCM ---help--- Say Y here if you want to commumicate via ALSA/sound devices. From bc7ac432536710193adfb7a05488f8c2e20fbbc2 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 3 Aug 2015 11:35:51 -0700 Subject: [PATCH 605/912] staging: most: fix hdm-dim2 build error Fix build of hdm-dim2. Since it calls a function that is provided by AIM_NETWORK, make it depend on that symbol. Also fix a misspelling in the Kconfig file. drivers/built-in.o: In function `deliver_netinfo_thread': dim2_hdm.c:(.text+0x3a9563): undefined reference to `most_deliver_netinfo' Signed-off-by: Randy Dunlap Cc: Jain Roy Ambi Cc: Andrey Shvetsov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/most/hdm-dim2/Kconfig b/drivers/staging/most/hdm-dim2/Kconfig index 4abeb545955e..1d4ad1d67758 100644 --- a/drivers/staging/most/hdm-dim2/Kconfig +++ b/drivers/staging/most/hdm-dim2/Kconfig @@ -4,9 +4,10 @@ config HDM_DIM2 tristate "DIM2 HDM" + depends on AIM_NETWORK ---help--- - Say Y here if you want to connect via MediaLB to network tranceiver. + Say Y here if you want to connect via MediaLB to network transceiver. This device driver is platform dependent and needs an addtional platform driver to be installed. For more information contact maintainer of this driver. From ad6d8812aa9574b11d5f7a0d322d3b42be24206d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 30 Jul 2015 19:55:01 +0200 Subject: [PATCH 606/912] staging: fbtft: core: Don't set device platform_data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass platform_data as an argument to fbtft_framebuffer_alloc() instead of using dev->platform_data. This fixes an issue where the device comes from Device Tree and fbtft_probe_common() sets dev->platform_data to allocated memory. When the module is reloaded, dev->platform_data points to freed memory. Signed-off-by: Noralf Trønnes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 12 +++++------- drivers/staging/fbtft/fbtft.h | 5 +++-- drivers/staging/fbtft/flexfb.c | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index f04128fb0693..23392eb6799e 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -677,13 +677,13 @@ static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src) * */ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, - struct device *dev) + struct device *dev, + struct fbtft_platform_data *pdata) { struct fb_info *info; struct fbtft_par *par; struct fb_ops *fbops = NULL; struct fb_deferred_io *fbdefio = NULL; - struct fbtft_platform_data *pdata = dev->platform_data; u8 *vmem = NULL; void *txbuf = NULL; void *buf = NULL; @@ -828,7 +828,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, par = info->par; par->info = info; - par->pdata = dev->platform_data; + par->pdata = pdata; par->debug = display->debug; par->buf = buf; spin_lock_init(&par->dirty_lock); @@ -1265,12 +1265,11 @@ EXPORT_SYMBOL(fbtft_init_display); */ static int fbtft_verify_gpios(struct fbtft_par *par) { - struct fbtft_platform_data *pdata; + struct fbtft_platform_data *pdata = par->pdata; int i; fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); - pdata = par->info->device->platform_data; if (pdata->display.buswidth != 9 && par->startbyte == 0 && par->gpio.dc < 0) { dev_err(par->info->device, @@ -1388,10 +1387,9 @@ int fbtft_probe_common(struct fbtft_display *display, pdata = fbtft_probe_dt(dev); if (IS_ERR(pdata)) return PTR_ERR(pdata); - dev->platform_data = pdata; } - info = fbtft_framebuffer_alloc(display, dev); + info = fbtft_framebuffer_alloc(display, dev, pdata); if (!info) return -ENOMEM; diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 7d817eb26eab..ab4a65818786 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -264,8 +264,9 @@ struct fbtft_par { /* fbtft-core.c */ extern void fbtft_dbg_hex(const struct device *dev, int groupsize, void *buf, size_t len, const char *fmt, ...); -extern struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, - struct device *dev); +struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, + struct device *dev, + struct fbtft_platform_data *pdata); extern void fbtft_framebuffer_release(struct fb_info *info); extern int fbtft_register_framebuffer(struct fb_info *fb_info); extern int fbtft_unregister_framebuffer(struct fb_info *fb_info); diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index ce6e3ae30a2e..5b4c7124a6ee 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -379,7 +379,7 @@ static int flexfb_probe_common(struct spi_device *sdev, fbtft_init_dbg(dev, "regwidth = %d\n", regwidth); fbtft_init_dbg(dev, "buswidth = %d\n", buswidth); - info = fbtft_framebuffer_alloc(&flex_display, dev); + info = fbtft_framebuffer_alloc(&flex_display, dev, dev->platform_data); if (!info) return -ENOMEM; From 24b7d011a65042a8bd2f3b93c812c7eae3ead2d8 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 2 Aug 2015 11:09:52 +0200 Subject: [PATCH 607/912] staging: fbtft: Allow compile test of GPIO consumers if !GPIOLIB The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer functionality only, can still be compiled if GPIOLIB is not enabled. Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where appropriate. Signed-off-by: Geert Uytterhoeven Acked-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig index f7e68fdd9904..d473010fa474 100644 --- a/drivers/staging/fbtft/Kconfig +++ b/drivers/staging/fbtft/Kconfig @@ -1,6 +1,7 @@ menuconfig FB_TFT tristate "Support for small TFT LCD display modules" - depends on FB && SPI && GPIOLIB + depends on FB && SPI + depends on GPIOLIB || COMPILE_TEST select FB_SYS_FILLRECT select FB_SYS_COPYAREA select FB_SYS_IMAGEBLIT From fd93b8059294146a1c3dc9cf6b5616c22b7b47f7 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 2 Aug 2015 11:09:51 +0200 Subject: [PATCH 608/912] staging: android: Allow compile test of GPIO consumers if !GPIOLIB The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer functionality only, can still be compiled if GPIOLIB is not enabled. Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where appropriate. Signed-off-by: Geert Uytterhoeven Acked-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 24d657b3ab99..68307121c9c1 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -20,7 +20,8 @@ config ANDROID_TIMED_OUTPUT config ANDROID_TIMED_GPIO tristate "Android timed gpio driver" - depends on GPIOLIB && ANDROID_TIMED_OUTPUT + depends on GPIOLIB || COMPILE_TEST + depends on ANDROID_TIMED_OUTPUT default n ---help--- Unlike generic gpio is to allow programs to access and manipulate gpio From fdc792cd1b5c86cb34770707aa1b04edce5288cf Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Fri, 31 Jul 2015 18:56:32 -0400 Subject: [PATCH 609/912] staging: unisys: visorchannel: Add peek function According to unisys, the s_par hypervisor has a bug in which it never triggers an interrupt. That makes the visornic effectively a 2ms poll loop. In order to just have the rx thread shceduling a napi poll every 2ms, lets instead give it the chance to check the response queue for data before we schedule. This helper provides that functionality Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/visorbus.h | 2 ++ .../staging/unisys/visorbus/visorchannel.c | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index a0144c6a8ad1..9235536fa75f 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -201,6 +201,8 @@ bool visorchannel_signalremove(struct visorchannel *channel, u32 queue, void *msg); bool visorchannel_signalinsert(struct visorchannel *channel, u32 queue, void *msg); +bool visorchannel_signalempty(struct visorchannel *channel, u32 queue); + int visorchannel_signalqueue_slots_avail(struct visorchannel *channel, u32 queue); int visorchannel_signalqueue_max_slots(struct visorchannel *channel, u32 queue); diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 242246492b7a..6da7e49a6627 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -430,6 +430,27 @@ visorchannel_signalremove(struct visorchannel *channel, u32 queue, void *msg) } EXPORT_SYMBOL_GPL(visorchannel_signalremove); +bool +visorchannel_signalempty(struct visorchannel *channel, u32 queue) +{ + unsigned long flags = 0; + struct signal_queue_header sig_hdr; + bool rc = false; + + if (channel->needs_lock) + spin_lock_irqsave(&channel->remove_lock, flags); + + if (!sig_read_header(channel, queue, &sig_hdr)) + rc = true; + if (sig_hdr.head == sig_hdr.tail) + rc = true; + if (channel->needs_lock) + spin_unlock_irqrestore(&channel->remove_lock, flags); + + return rc; +} +EXPORT_SYMBOL_GPL(visorchannel_signalempty); + static bool signalinsert_inner(struct visorchannel *channel, u32 queue, void *msg) { From 08582d83e5a23aa2f6316421a4f14a44be3c8e32 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Thu, 30 Jul 2015 23:48:50 +0200 Subject: [PATCH 610/912] staging: rtl8192e: Rework EEPROM handling code Card configuration is stored in SPI EEPROM (93c46 or 93c56) working in 128|256x16 mode. Communication is handled using GPIO bitbang. >From behaviour perspective, delay after read was removed. It is not needed as we wait after reading GPIO mapped to PCI-E register - it should have no side effects. According to sample EEPROM datasheet (AT93Cx6), max frequency for worst case scenario (1.8V supply) is 250kHZ (vs. 1MHz for 5V). Driver generates ~50kHZ clock - margin should be big enough even for devices from other vendors. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h | 8 +- .../staging/rtl8192e/rtl8192e/rtl_eeprom.c | 124 ++++++------------ 2 files changed, 45 insertions(+), 87 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h index 43c3fb859d10..c81832dcf181 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h @@ -119,10 +119,10 @@ enum _RTL8192Pci_HW { #define EPROM_CMD_NORMAL 0 #define EPROM_CMD_LOAD 1 #define EPROM_CMD_PROGRAM 2 -#define EPROM_CS_SHIFT 3 -#define EPROM_CK_SHIFT 2 -#define EPROM_W_SHIFT 1 -#define EPROM_R_SHIFT 0 +#define EPROM_CS_BIT 3 +#define EPROM_CK_BIT 2 +#define EPROM_W_BIT 1 +#define EPROM_R_BIT 0 AFR = 0x010, #define AFR_CardBEn (1<<0) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c index ed54193b019a..039ccfd41230 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c @@ -25,115 +25,73 @@ #include "rtl_core.h" #include "rtl_eeprom.h" -static void eprom_cs(struct net_device *dev, short bit) +static void _rtl92e_gpio_write_bit(struct net_device *dev, int no, bool val) { - if (bit) - rtl92e_writeb(dev, EPROM_CMD, - (1 << EPROM_CS_SHIFT) | - rtl92e_readb(dev, EPROM_CMD)); + u8 reg = rtl92e_readb(dev, EPROM_CMD); + + if (val) + reg |= 1 << no; else - rtl92e_writeb(dev, EPROM_CMD, - rtl92e_readb(dev, EPROM_CMD) & - ~(1<> no) & 0x1; } - -static void eprom_w(struct net_device *dev, short bit) +static void _rtl92e_eeprom_ck_cycle(struct net_device *dev) { - if (bit) - rtl92e_writeb(dev, EPROM_CMD, (1<> tx_len) & 0x1); + _rtl92e_eeprom_ck_cycle(dev); } + + _rtl92e_gpio_write_bit(dev, EPROM_W_BIT, 0); + + while (rx_len--) { + _rtl92e_eeprom_ck_cycle(dev); + ret |= _rtl92e_gpio_get_bit(dev, EPROM_R_BIT) << rx_len; + } + + _rtl92e_gpio_write_bit(dev, EPROM_CS_BIT, 0); + _rtl92e_eeprom_ck_cycle(dev); + + return ret; } u32 rtl92e_eeprom_read(struct net_device *dev, u32 addr) { struct r8192_priv *priv = rtllib_priv(dev); - short read_cmd[] = {1, 1, 0}; - short addr_str[8]; - int i; - int addr_len; - u32 ret; + u32 ret = 0; - ret = 0; rtl92e_writeb(dev, EPROM_CMD, (EPROM_CMD_PROGRAM << EPROM_CMD_OPERATING_MODE_SHIFT)); udelay(EPROM_DELAY); - if (priv->epromtype == EEPROM_93C56) { - addr_str[7] = addr & 1; - addr_str[6] = addr & (1<<1); - addr_str[5] = addr & (1<<2); - addr_str[4] = addr & (1<<3); - addr_str[3] = addr & (1<<4); - addr_str[2] = addr & (1<<5); - addr_str[1] = addr & (1<<6); - addr_str[0] = addr & (1<<7); - addr_len = 8; - } else { - addr_str[5] = addr & 1; - addr_str[4] = addr & (1<<1); - addr_str[3] = addr & (1<<2); - addr_str[2] = addr & (1<<3); - addr_str[1] = addr & (1<<4); - addr_str[0] = addr & (1<<5); - addr_len = 6; - } - eprom_cs(dev, 1); - eprom_ck_cycle(dev); - eprom_send_bits_string(dev, read_cmd, 3); - eprom_send_bits_string(dev, addr_str, addr_len); - - eprom_w(dev, 0); - - for (i = 0; i < 16; i++) { - eprom_ck_cycle(dev); - ret |= (eprom_r(dev)<<(15-i)); - } - - eprom_cs(dev, 0); - eprom_ck_cycle(dev); + /* EEPROM is configured as x16 */ + if (priv->epromtype == EEPROM_93C56) + ret = _rtl92e_eeprom_xfer(dev, (addr & 0xFF) | (0x6 << 8), 11); + else + ret = _rtl92e_eeprom_xfer(dev, (addr & 0x3F) | (0x6 << 6), 9); rtl92e_writeb(dev, EPROM_CMD, (EPROM_CMD_NORMAL< Date: Fri, 31 Jul 2015 19:42:54 -0400 Subject: [PATCH 611/912] staging/lustre: Drop SEEK_* definition checks SEEK_DATA and SEEK_HOLE are always defined in the kernel, drop the definition checks Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/linux/lustre_compat25.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index f16ba9c8b214..502c7cce7e27 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -121,13 +121,6 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) # define NO_QUOTA (-EDQUOT) #endif -#ifndef SEEK_DATA -#define SEEK_DATA 3 /* seek to the next data */ -#endif -#ifndef SEEK_HOLE -#define SEEK_HOLE 4 /* seek to the next hole */ -#endif - #ifndef FMODE_UNSIGNED_OFFSET #define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) #endif From 1a3555cd3245b3204189a1118364ad41467b73ca Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Fri, 31 Jul 2015 19:42:55 -0400 Subject: [PATCH 612/912] staging/lustre: remove unused ll_quota_on and ll_quota_off They are not used anywhere, so safe to drop. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/lustre_compat25.h | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 502c7cce7e27..9739611091aa 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -69,37 +69,6 @@ # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count) /* inode_dio_done(i) use as-is for read unlock */ -static inline int -ll_quota_on(struct super_block *sb, int off, int ver, char *name, int remount) -{ - int rc; - - if (sb->s_qcop->quota_on) { - struct path path; - - rc = kern_path(name, LOOKUP_FOLLOW, &path); - if (!rc) - return rc; - rc = sb->s_qcop->quota_on(sb, off, ver - , &path - ); - path_put(&path); - return rc; - } else - return -ENOSYS; -} - -static inline int ll_quota_off(struct super_block *sb, int off, int remount) -{ - if (sb->s_qcop->quota_off) { - return sb->s_qcop->quota_off(sb, off - ); - } else - return -ENOSYS; -} - - - #define ll_d_hlist_node hlist_node #define ll_d_hlist_empty(list) hlist_empty(list) #define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name) From 56ea686bb749d06bdb67cb95a873a87c5d1fc243 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Fri, 31 Jul 2015 19:42:56 -0400 Subject: [PATCH 613/912] staging/lustre: Drop FMODE_UNSIGNED_OFFSET define It's not really used anywhere. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 9739611091aa..b37856c66f03 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -90,10 +90,6 @@ # define NO_QUOTA (-EDQUOT) #endif -#ifndef FMODE_UNSIGNED_OFFSET -#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) -#endif - #if !defined(_ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_) && !defined(ext2_set_bit) # define ext2_set_bit __test_and_set_bit_le # define ext2_clear_bit __test_and_clear_bit_le From 9d5be52f985b3d0b0b6d0dcae8eb896418bd0d3a Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Fri, 31 Jul 2015 19:42:57 -0400 Subject: [PATCH 614/912] staging/lustre: Use hlist primitives directly Get rid of ll_d_hlist* compat defines. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/lustre/include/linux/lustre_compat25.h | 9 --------- drivers/staging/lustre/lustre/llite/dcache.c | 3 +-- drivers/staging/lustre/lustre/llite/namei.c | 10 ++++------ 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index b37856c66f03..43fa2a954f03 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -69,15 +69,6 @@ # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count) /* inode_dio_done(i) use as-is for read unlock */ -#define ll_d_hlist_node hlist_node -#define ll_d_hlist_empty(list) hlist_empty(list) -#define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name) -#define ll_d_hlist_for_each(tmp, i_dentry) hlist_for_each(tmp, i_dentry) -#define ll_d_hlist_for_each_entry(dentry, p, i_dentry, alias) \ - p = NULL; hlist_for_each_entry(dentry, i_dentry, alias) - - - #define ll_pagevec_init(pv, cold) do {} while (0) #define ll_pagevec_add(pv, pg) (0) #define ll_pagevec_lru_add_file(pv) do {} while (0) diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 7b008a64707d..b86685912d28 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -250,7 +250,6 @@ void ll_intent_release(struct lookup_intent *it) void ll_invalidate_aliases(struct inode *inode) { struct dentry *dentry; - struct ll_d_hlist_node *p; LASSERT(inode != NULL); @@ -258,7 +257,7 @@ void ll_invalidate_aliases(struct inode *inode) inode->i_ino, inode->i_generation, inode); ll_lock_dcache(inode); - ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.d_alias) { + hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p inode %p flags %d\n", dentry, dentry, dentry->d_parent, d_inode(dentry), dentry->d_flags); diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 2ed1e0ac5553..05e7dc85989e 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -144,10 +144,9 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, static void ll_invalidate_negative_children(struct inode *dir) { struct dentry *dentry, *tmp_subdir; - struct ll_d_hlist_node *p; ll_lock_dcache(dir); - ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) { + hlist_for_each_entry(dentry, &dir->i_dentry, d_u.d_alias) { spin_lock(&dentry->d_lock); if (!list_empty(&dentry->d_subdirs)) { struct dentry *child; @@ -334,15 +333,14 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2) static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) { struct dentry *alias, *discon_alias, *invalid_alias; - struct ll_d_hlist_node *p; - if (ll_d_hlist_empty(&inode->i_dentry)) + if (hlist_empty(&inode->i_dentry)) return NULL; discon_alias = invalid_alias = NULL; ll_lock_dcache(inode); - ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_u.d_alias) { + hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) { LASSERT(alias != dentry); spin_lock(&alias->d_lock); @@ -690,7 +688,7 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it) goto out; } - LASSERT(ll_d_hlist_empty(&inode->i_dentry)); + LASSERT(hlist_empty(&inode->i_dentry)); /* We asked for a lock on the directory, but were granted a * lock on the inode. Since we finally have an inode pointer, From 66a23f0cc28b6257328aa2e17499a1f3bd0bd18d Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Fri, 31 Jul 2015 19:42:58 -0400 Subject: [PATCH 615/912] staging/lustre: Get rid of ll_pagevec_ macros They are noop anyways. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/linux/lustre_compat25.h | 5 ----- drivers/staging/lustre/lustre/llite/dir.c | 4 ---- 2 files changed, 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 43fa2a954f03..157bafb08a5b 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -69,11 +69,6 @@ # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count) /* inode_dio_done(i) use as-is for read unlock */ -#define ll_pagevec_init(pv, cold) do {} while (0) -#define ll_pagevec_add(pv, pg) (0) -#define ll_pagevec_lru_add_file(pv) do {} while (0) - - #ifndef QUOTA_OK # define QUOTA_OK 0 #endif diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 3d746a94f92e..769b61193d87 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -203,7 +203,6 @@ static int ll_dir_filler(void *_hash, struct page *page0) CDEBUG(D_VFSTRACE, "read %d/%d pages\n", nrdpgs, npages); - ll_pagevec_init(&lru_pvec, 0); for (i = 1; i < npages; i++) { unsigned long offset; int ret; @@ -228,15 +227,12 @@ static int ll_dir_filler(void *_hash, struct page *page0) GFP_KERNEL); if (ret == 0) { unlock_page(page); - if (ll_pagevec_add(&lru_pvec, page) == 0) - ll_pagevec_lru_add_file(&lru_pvec); } else { CDEBUG(D_VFSTRACE, "page %lu add to page cache failed: %d\n", offset, ret); } page_cache_release(page); } - ll_pagevec_lru_add_file(&lru_pvec); if (page_pool != &page0) kfree(page_pool); From 81e053c75a216573bbb10a0325832ca64bcb0404 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Fri, 31 Jul 2015 19:42:59 -0400 Subject: [PATCH 616/912] staging/lustre: Get rid of inode_dio_write_done and inode_dio_read These primitives are long deprecated and unused. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/linux/lustre_compat25.h | 5 ----- drivers/staging/lustre/lustre/llite/llite_lib.c | 5 +---- drivers/staging/lustre/lustre/llite/vvp_io.c | 5 ++--- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h index 157bafb08a5b..6b14406b2920 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h @@ -64,11 +64,6 @@ #define LTIME_S(time) (time.tv_sec) -/* inode_dio_wait(i) use as-is for write lock */ -# define inode_dio_write_done(i) do {} while (0) /* for write unlock */ -# define inode_dio_read(i) atomic_inc(&(i)->i_dio_count) -/* inode_dio_done(i) use as-is for read unlock */ - #ifndef QUOTA_OK # define QUOTA_OK 0 #endif diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 39f0b2a07aec..55e2dc6c1fbf 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1356,11 +1356,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) if (!op_data) return -ENOMEM; - if (!S_ISDIR(inode->i_mode)) { - if (attr->ia_valid & ATTR_SIZE) - inode_dio_write_done(inode); + if (!S_ISDIR(inode->i_mode)) mutex_unlock(&inode->i_mutex); - } memcpy(&op_data->op_attr, attr, sizeof(*attr)); diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 91bba79678cf..a659962e09c8 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -455,12 +455,11 @@ static void vvp_io_setattr_end(const struct lu_env *env, struct cl_io *io = ios->cis_io; struct inode *inode = ccc_object_inode(io->ci_obj); - if (cl_io_is_trunc(io)) { + if (cl_io_is_trunc(io)) /* Truncate in memory pages - they must be clean pages * because osc has already notified to destroy osc_extents. */ vvp_do_vmtruncate(inode, io->u.ci_setattr.sa_attr.lvb_size); - inode_dio_write_done(inode); - } + mutex_unlock(&inode->i_mutex); } From 5bb546f755380aa5129e480fb0cf04c0655ce13a Mon Sep 17 00:00:00 2001 From: Kent Gustavsson Date: Sun, 2 Aug 2015 18:14:50 +0200 Subject: [PATCH 617/912] staging: rtl8192u: r819xU_firmware: fix coding style Line over 80 characters. This is for Eudyptula Challenge Signed-off-by: Kent Gustavsson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_firmware.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index a7d30339390b..08302dfb0d90 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -144,7 +144,8 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) /* Turn On CPU */ read_nic_dword(dev, CPU_GEN, &CPU_status); - write_nic_byte(dev, CPU_GEN, (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff)); + write_nic_byte(dev, CPU_GEN, + (u8)((CPU_status | CPU_GEN_PWR_STB_CPU) & 0xff)); mdelay(1000); /* Check whether CPU boot OK */ From 5b34cd299319584f9fd342a5c01af83440d512bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Lajos=20Kis?= Date: Sun, 2 Aug 2015 19:22:30 +0200 Subject: [PATCH 618/912] staging: lustre: echo_client: fix sparse declaration warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following sparse warnings: drivers/staging/lustre/lustre/obdecho/echo_client.c:2142:5: warning: symbol 'echo_client_init' was not declared. Should it be static? drivers/staging/lustre/lustre/obdecho/echo_client.c:2157:6: warning: symbol 'echo_client_exit' was not declared. Should it be static? Signed-off-by: Zoltán Lajos Kis " Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdecho/echo_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index de6f795e05d1..27bd170c3a28 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -2139,7 +2139,7 @@ static struct obd_ops echo_client_obd_ops = { .o_disconnect = echo_client_disconnect }; -int echo_client_init(void) +static int echo_client_init(void) { int rc; @@ -2154,7 +2154,7 @@ int echo_client_init(void) return rc; } -void echo_client_exit(void) +static void echo_client_exit(void) { class_unregister_type(LUSTRE_ECHO_CLIENT_NAME); lu_kmem_fini(echo_caches); From a96389d9add1bc9e32b73ead10cf255f7d598a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Lajos=20Kis?= Date: Sun, 2 Aug 2015 22:36:31 +0200 Subject: [PATCH 619/912] staging: lustre: service.c: make local functions static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes functions that are not used outside the file in which they are defined static, as reported by sparse: drivers/staging/lustre/lustre/ptlrpc/service.c:72:35: warning: symbol 'ptlrpc_alloc_rqbd' was not declared. Should it be static? 1065 drivers/staging/lustre/lustre/ptlrpc/service.c:105:1: warning: symbol 'ptlrpc_free_rqbd' was not declared. Should it be static? 1066 drivers/staging/lustre/lustre/ptlrpc/service.c:122:1: warning: symbol 'ptlrpc_grow_req_bufs' was not declared. Should it be static? 1067 drivers/staging/lustre/lustre/ptlrpc/service.c:3055:5: warning: symbol 'ptlrpc_svcpt_health_check' was not declared. Should it be static? Signed-off-by: Zoltán Lajos Kis " Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/service.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index cf9477d4749b..d3265a89538a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -69,7 +69,7 @@ LIST_HEAD(ptlrpc_all_services); /** Used to protect the \e ptlrpc_all_services list */ struct mutex ptlrpc_all_services_mutex; -struct ptlrpc_request_buffer_desc * +static struct ptlrpc_request_buffer_desc * ptlrpc_alloc_rqbd(struct ptlrpc_service_part *svcpt) { struct ptlrpc_service *svc = svcpt->scp_service; @@ -101,7 +101,7 @@ ptlrpc_alloc_rqbd(struct ptlrpc_service_part *svcpt) return rqbd; } -void +static void ptlrpc_free_rqbd(struct ptlrpc_request_buffer_desc *rqbd) { struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt; @@ -118,7 +118,7 @@ ptlrpc_free_rqbd(struct ptlrpc_request_buffer_desc *rqbd) kfree(rqbd); } -int +static int ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, int post) { struct ptlrpc_service *svc = svcpt->scp_service; @@ -3052,7 +3052,7 @@ EXPORT_SYMBOL(ptlrpc_unregister_service); * Right now, it just checks to make sure that requests aren't languishing * in the queue. We'll use this health check to govern whether a node needs * to be shot, so it's intentionally non-aggressive. */ -int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt) +static int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt) { struct ptlrpc_request *request = NULL; struct timeval right_now; From 66e6d70df20046d3e2b04d9455dd68acfc5c61ef Mon Sep 17 00:00:00 2001 From: Yash Shah Date: Mon, 3 Aug 2015 11:18:31 +0000 Subject: [PATCH 620/912] Staging: rts5208: Fix code indentation warning as detected by checkpatch.pl Fixed code indentation warning as detected by checkpatch.pl. Signed-off-by: Yash Shah Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/ms.c | 5 ++--- drivers/staging/rts5208/sd.c | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index ee818b0dc401..cdaa1aba50ed 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -1121,11 +1121,10 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) #ifdef SUPPORT_MSXC if ((buf[cur_addr_off + 8] == 0x10) || - (buf[cur_addr_off + 8] == 0x13)) + (buf[cur_addr_off + 8] == 0x13)) { #else - if (buf[cur_addr_off + 8] == 0x10) + if (buf[cur_addr_off + 8] == 0x10) { #endif - { sys_info_addr = ((u32)buf[cur_addr_off + 0] << 24) | ((u32)buf[cur_addr_off + 1] << 16) | ((u32)buf[cur_addr_off + 2] << 8) | diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index cb4157960fad..d6c498209b2c 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -246,11 +246,10 @@ RTY_SEND_CMD: } } #ifdef SUPPORT_SD_LOCK - if (ptr[1] & 0x7D) + if (ptr[1] & 0x7D) { #else - if (ptr[1] & 0x7F) + if (ptr[1] & 0x7F) { #endif - { dev_dbg(rtsx_dev(chip), "ptr[1]: 0x%02x\n", ptr[1]); rtsx_trace(chip); @@ -4148,11 +4147,10 @@ RTY_SEND_CMD: } } #ifdef SUPPORT_SD_LOCK - if (ptr[1] & 0x7D) + if (ptr[1] & 0x7D) { #else - if (ptr[1] & 0x7F) + if (ptr[1] & 0x7F) { #endif - { rtsx_trace(chip); return STATUS_FAIL; } From 4e0fa71c934287c160e264b3d5dd0e5c0824f6f9 Mon Sep 17 00:00:00 2001 From: Mayank Bareja Date: Mon, 3 Aug 2015 11:23:01 +0000 Subject: [PATCH 621/912] Staging: rtl8188eu/core: fixed code indentation warning as reported by checkpatch.pl fixed code indentation warning as detected with checkpatch.pl. Replaced spaces with tabs. Signed-off-by: Mayank Bareja Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_debug.c | 4 +-- drivers/staging/rtl8188eu/core/rtw_efuse.c | 2 +- drivers/staging/rtl8188eu/core/rtw_mlme.c | 4 +-- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 8 ++--- drivers/staging/rtl8188eu/core/rtw_security.c | 2 +- drivers/staging/rtl8188eu/core/rtw_xmit.c | 36 +++++++++---------- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_debug.c b/drivers/staging/rtl8188eu/core/rtw_debug.c index 12beab046a4a..993c7db87a1a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_debug.c +++ b/drivers/staging/rtl8188eu/core/rtw_debug.c @@ -919,7 +919,7 @@ int proc_get_best_channel(char *page, char **start, /* 5G */ if (pmlmeext->channel_set[i].ChannelNum >= 36 && pmlmeext->channel_set[i].ChannelNum < 140) { - /* Find primary channel */ + /* Find primary channel */ if (((pmlmeext->channel_set[i].ChannelNum - 36) % 8 == 0) && (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_5G].rx_count)) { index_5G = i; @@ -929,7 +929,7 @@ int proc_get_best_channel(char *page, char **start, if (pmlmeext->channel_set[i].ChannelNum >= 149 && pmlmeext->channel_set[i].ChannelNum < 165) { - /* find primary channel */ + /* find primary channel */ if (((pmlmeext->channel_set[i].ChannelNum - 149) % 8 == 0) && (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_5G].rx_count)) { index_5G = i; diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index dbaba2c6cce5..7b99ea91a9e6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c @@ -551,7 +551,7 @@ int Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data) bContinual = false; } } else if (ReadState & PG_STATE_DATA) { - /* Data section Read ------------- */ + /* Data section Read ------------- */ efuse_WordEnableDataRead(hworden, tmpdata, data); efuse_addr = efuse_addr + (word_cnts*2)+1; ReadState = PG_STATE_HEADER; diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index 71a7a85571aa..2b917a18e228 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -693,8 +693,8 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) pmlmepriv->to_join = false; s_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv); if (_SUCCESS == s_ret) { - mod_timer(&pmlmepriv->assoc_timer, - jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); } else if (s_ret == 2) { /* there is no need to wait for join */ _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); rtw_indicate_connect(adapter); diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index ba8f9aa5d259..935b48eef8b1 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -1096,7 +1096,7 @@ static void issue_assocreq(struct adapter *padapter) /* Check if the AP's supported rates are also supported by STA. */ for (j = 0; j < sta_bssrate_len; j++) { - /* Avoid the proprietary data rate (22Mbps) of Handlink WSG-4000 AP */ + /* Avoid the proprietary data rate (22Mbps) of Handlink WSG-4000 AP */ if ((pmlmeinfo->network.SupportedRates[i]|IEEE80211_BASIC_RATE_MASK) == (sta_bssrate[j]|IEEE80211_BASIC_RATE_MASK)) break; @@ -2932,7 +2932,7 @@ static unsigned int OnAuthClient(struct adapter *padapter, if (seq == 2) { if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) { - /* legendary shared system */ + /* legendary shared system */ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&len, pkt_len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_); @@ -4155,8 +4155,8 @@ static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptabl u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 *pframe = precv_frame->rx_data; - if (ptable->func) { - /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ + if (ptable->func) { + /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) && memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) return; diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c b/drivers/staging/rtl8188eu/core/rtw_security.c index d870a5ce8585..22839d57dc8c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_security.c +++ b/drivers/staging/rtl8188eu/core/rtw_security.c @@ -1330,7 +1330,7 @@ static int aes_decipher(u8 *key, uint hdrlen, bitwise_xor(aes_out, &pframe[payload_index], chain_buffer); for (j = 0; j < 16; j++) - pframe[payload_index++] = chain_buffer[j]; + pframe[payload_index++] = chain_buffer[j]; } if (payload_remainder > 0) { /* If there is a short final block, then pad it,*/ diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index fda169d37771..5dc0b90e8ab5 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -868,7 +868,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr /* check if enable ampdu */ if (pattrib->ht_en && psta->htpriv.ampdu_enable) { if (psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) - pattrib->ampdu_en = true; + pattrib->ampdu_en = true; } /* re-check if enable ampdu by BA_starting_seqctrl */ @@ -1026,22 +1026,22 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct /* adding icv, if necessary... */ if (pattrib->iv_len) { switch (pattrib->encrypt) { - case _WEP40_: - case _WEP104_: - WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - break; - case _TKIP_: - if (bmcst) - TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - else - TKIP_IV(pattrib->iv, psta->dot11txpn, 0); - break; - case _AES_: - if (bmcst) - AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - else - AES_IV(pattrib->iv, psta->dot11txpn, 0); - break; + case _WEP40_: + case _WEP104_: + WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); + break; + case _TKIP_: + if (bmcst) + TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); + else + TKIP_IV(pattrib->iv, psta->dot11txpn, 0); + break; + case _AES_: + if (bmcst) + AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); + else + AES_IV(pattrib->iv, psta->dot11txpn, 0); + break; } memcpy(pframe, pattrib->iv, pattrib->iv_len); @@ -1769,7 +1769,7 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fra int bmcst = IS_MCAST(pattrib->ra); if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == false) - return ret; + return ret; if (pattrib->psta) psta = pattrib->psta; From 2537468cee9ff2b9d4c425e2f8141aaa274dc495 Mon Sep 17 00:00:00 2001 From: Jandy Gou Date: Wed, 5 Aug 2015 10:09:02 +0800 Subject: [PATCH 622/912] Staging: android: timed_gpio.c: fix coding style errors remove extra space and replace tab to space after a variable Signed-off-by: Jandy Gou Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/timed_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index 938a35cd99bb..ce11726f1a6c 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -61,9 +61,9 @@ static int gpio_get_time(struct timed_output_dev *dev) static void gpio_enable(struct timed_output_dev *dev, int value) { - struct timed_gpio_data *data = + struct timed_gpio_data *data = container_of(dev, struct timed_gpio_data, dev); - unsigned long flags; + unsigned long flags; spin_lock_irqsave(&data->lock, flags); From 1a59adb222bc4758241eb4ff253faa5b1ebd4cab Mon Sep 17 00:00:00 2001 From: Ted Chen Date: Wed, 5 Aug 2015 01:18:46 +0800 Subject: [PATCH 623/912] staging: comedi: do not return -ENOSYS. fixed coding style issue by replacing ENOSYS with EIO because it means 'invalid syscall nr' and nothing else. Signed-off-by: Ted Chen Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index ed0b60c925de..b03bc6639f79 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -820,7 +820,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) "driver '%s' does not support attach using comedi_config\n", driv->driver_name); module_put(driv->module); - ret = -ENOSYS; + ret = -EIO; goto out; } dev->driver = driv; From d27da4dae5f487d64ba52c3d505cc587c19af578 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 5 Aug 2015 18:13:26 +0100 Subject: [PATCH 624/912] staging: comedi: improve comedi_check_chanlist() documentation Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/range.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/range.c b/drivers/staging/comedi/range.c index 6a393b24bdd9..ce3a58a7a171 100644 --- a/drivers/staging/comedi/range.c +++ b/drivers/staging/comedi/range.c @@ -102,7 +102,18 @@ int do_rangeinfo_ioctl(struct comedi_device *dev, * @s: comedi_subdevice struct * @n: number of elements in the chanlist * @chanlist: the chanlist to validate -*/ + * + * Each element consists of a channel number, a range index, an analog + * reference type and some flags, all packed into an unsigned int. + * + * This checks that the channel number and range index are supported by + * the comedi subdevice. It does not check whether the analog reference + * type and the flags are supported. Drivers that care should check those + * themselves. + * + * Return: %0 if all @chanlist elements are valid (success), + * %-EINVAL if one or more elements are invalid. + */ int comedi_check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist) { From 967ef593bf26bdd9ddabef8eb8c1ddd8f5d2074a Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 3 Aug 2015 21:57:44 -0400 Subject: [PATCH 625/912] staging/lustre/ptlrpc: Remove stray cfs_daemonize comment Ever since daemonize was removed in 3.18, there are no longer any flags passed to kthread_run. Most of the comments were deleted, but this one lingered on until now. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index d05c37c1fd30..f8edb791a998 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -318,8 +318,6 @@ int ptlrpc_start_pinger(void) strcpy(pinger_thread.t_name, "ll_ping"); - /* CLONE_VM and CLONE_FILES just avoid a needless copy, because we - * just drop the VM and FILES in cfs_daemonize_ctxt() right away. */ rc = PTR_ERR(kthread_run(ptlrpc_pinger_main, &pinger_thread, "%s", pinger_thread.t_name)); if (IS_ERR_VALUE(rc)) { From f72f130d87ff05144553af4894c0c52c57d60930 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 3 Aug 2015 21:57:45 -0400 Subject: [PATCH 626/912] staging/lustre: Properly reference kthread_run instead of cfs_daemonize cfs_daemonize is long gone and replaced by a proper call to kthread_run, so update the comment to reflect that fact. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 77a7de98fc8e..3bb2f8b0c309 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -2183,7 +2183,7 @@ struct ptlrpcd_ctl { */ struct ptlrpc_request_set *pc_set; /** - * Thread name used in cfs_daemonize() + * Thread name used in kthread_run() */ char pc_name[16]; /** From c9a47627f7988470ad391091ed9334018e5144a2 Mon Sep 17 00:00:00 2001 From: Ting-Chih Hsiao Date: Tue, 4 Aug 2015 11:21:10 +0800 Subject: [PATCH 627/912] staging: rtl8723au: fix up coding style warnings reported by checkpatch.pl. remove spaces at the start of a line align enum variable with other parameters Signed-off-by: Ting-Chih Hsiao Acked-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c b/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c index 342dec3e939f..a63c6cb88bc9 100644 --- a/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c +++ b/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c @@ -21,7 +21,7 @@ odm_ConfigRFReg_8723A( struct dm_odm_t *pDM_Odm, u32 Addr, u32 Data, - enum RF_RADIO_PATH RF_PATH, + enum RF_RADIO_PATH RF_PATH, u32 RegAddr ) { From fce7f39356c511e263e97094bd18dee40fca6511 Mon Sep 17 00:00:00 2001 From: Lior Pugatch Date: Tue, 4 Aug 2015 22:18:04 +0300 Subject: [PATCH 628/912] staging: vt6655: Fixed C99 style comment to C89 style. Patch created to satisfy checkpatch.pl Signed-off-by: Lior Pugatch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h index b9bd1639b13e..54694df14e44 100644 --- a/drivers/staging/vt6655/rxtx.h +++ b/drivers/staging/vt6655/rxtx.h @@ -197,4 +197,4 @@ int vnt_beacon_make(struct vnt_private *, struct ieee80211_vif *); int vnt_beacon_enable(struct vnt_private *, struct ieee80211_vif *, struct ieee80211_bss_conf *); -#endif // __RXTX_H__ +#endif /* __RXTX_H__ */ From 2cb1df7ebd8b8807a204ffb0692751b15d4cb1bf Mon Sep 17 00:00:00 2001 From: Lars Svensson Date: Wed, 5 Aug 2015 14:15:12 +0200 Subject: [PATCH 629/912] staging: iio_simple_dummy: Fix indentation errors Fixing indentation errors in drivers/staging/iio/iio_simple_dummy_events.c. Signed-off-by: Lars Svensson Acked-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_simple_dummy_events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/iio_simple_dummy_events.c b/drivers/staging/iio/iio_simple_dummy_events.c index ecc563cb6cb9..73108baf80ad 100644 --- a/drivers/staging/iio/iio_simple_dummy_events.c +++ b/drivers/staging/iio/iio_simple_dummy_events.c @@ -120,7 +120,7 @@ int iio_simple_dummy_read_event_value(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, enum iio_event_type type, enum iio_event_direction dir, - enum iio_event_info info, + enum iio_event_info info, int *val, int *val2) { struct iio_dummy_state *st = iio_priv(indio_dev); @@ -143,7 +143,7 @@ int iio_simple_dummy_write_event_value(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, enum iio_event_type type, enum iio_event_direction dir, - enum iio_event_info info, + enum iio_event_info info, int val, int val2) { struct iio_dummy_state *st = iio_priv(indio_dev); From eeb1c0629539b1393d0b5ffea9cc2d71e6e933bf Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Wed, 5 Aug 2015 01:29:22 +0530 Subject: [PATCH 630/912] Staging: wilc1000: Remove typedefs for struct The Linux kernel coding style guidelines suggest not using typedefs for structure and enum types. This patch gets rid of the typedefs for Ack_session_info_t. The following Coccinelle semantic patch detects the cases for struct type: @tn@ identifier i; type td; @@ -typedef struct i { ... } -td ; @@ type tn.td; identifier tn.i; @@ -td + struct i Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index def72fd1236d..1eb13f90d0e4 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -291,13 +291,13 @@ uint32_t Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0; #ifdef TCP_ACK_FILTER struct Ack_session_info; -typedef struct Ack_session_info { +struct Ack_session_info { uint32_t Ack_seq_num; uint32_t Bigger_Ack_num; uint16_t src_port; uint16_t dst_port; uint16_t status; -} Ack_session_info_t; +}; typedef struct { uint32_t ack_num; @@ -318,7 +318,7 @@ struct Ack_session_info *Alloc_head; #define MAX_TCP_SESSION 25 #define MAX_PENDING_ACKS 256 -Ack_session_info_t Acks_keep_track_info[2 * MAX_TCP_SESSION]; +struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION]; Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS]; uint32_t PendingAcks_arrBase; From 1913221c0e3025a93c3c106ec0167f8240df4d35 Mon Sep 17 00:00:00 2001 From: Daniel Machon Date: Wed, 5 Aug 2015 08:18:31 +0200 Subject: [PATCH 631/912] staging: wilc1000: wilc_cfgoperations.c: Fixed coding styles issues. Fixed coding styles issues with braces. Signed-off-by: Daniel Machon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index c2ef46f4740b..d261e599f13d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1205,8 +1205,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k - if (!pairwise) - { + if (!pairwise) { if (params->cipher == WLAN_CIPHER_SUITE_TKIP) u8gmode = ENCRYPT_ENABLED | WPA | TKIP; else @@ -1304,8 +1303,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k { u8mode = 0; - if (!pairwise) - { + if (!pairwise) { if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { /* swap the tx mic by rx mic */ pu8RxMic = params->key + 24; From a96c47e1978a874e87e7fea3ebb178eaf8730d46 Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Wed, 5 Aug 2015 22:11:55 +0530 Subject: [PATCH 632/912] drivers: staging: wilc1000: use 'void' for no arguments functions Added 'void' keyword in the paranthesis of function definitions, when there are no arguments to the functions. This fixes the checkpatch.pl error - "Bad function definition 'function()' should probably be function(void)". Signed-off-by: Chandra S Gorentla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_mon.c | 2 +- drivers/staging/wilc1000/linux_wlan.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index aa20421021fa..123468a9582f 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -558,7 +558,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi * @date 12 JUL 2012 * @version 1.0 */ -int WILC_WFI_deinit_mon_interface() +int WILC_WFI_deinit_mon_interface(void) { bool rollback_lock = false; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 3e55a8ac2966..0a8052e717c2 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -202,7 +202,7 @@ void printk_later(const char *format, ...) } -void dump_logs() +void dump_logs(void) { if (DebugBuffer[0]) { DebugBuffer[DEGUG_BUFFER_LENGTH] = 0; @@ -216,7 +216,7 @@ void dump_logs() } } -void Reset_WatchDogdebugger() +void Reset_WatchDogdebugger(void) { WatchDogdebuggerCounter = 0; } From 6212990a87588869aa9a93fa5b861d3abf1be783 Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Wed, 5 Aug 2015 22:11:57 +0530 Subject: [PATCH 633/912] drivers: staging: wilc1000: remove space after '(' The character ' ' is removed after the character '('. This fixes the checkpatch.pl error - "space prohibited after that open parenthesis '('". Signed-off-by: Chandra S Gorentla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index d261e599f13d..da9c12f9b443 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1676,7 +1676,7 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev, * kernel version 3.0.0 */ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) | - BIT( NL80211_STA_INFO_RX_PACKETS) | + BIT(NL80211_STA_INFO_RX_PACKETS) | BIT(NL80211_STA_INFO_TX_PACKETS) | BIT(NL80211_STA_INFO_TX_FAILED) | BIT(NL80211_STA_INFO_TX_BITRATE); From 946b254697655f0ea0c54b1b0e20fb3b9aab99da Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 4 Aug 2015 15:09:47 -0400 Subject: [PATCH 634/912] staging: unisys: visornic: Convert to using napi Switch the visornic over to use napi. Currently there is a kernel thread that sits and waits on a wait queue to get notified of incoming virtual interrupts. It would be nice if we could handle frame reception using the standard napi processing instead. This patch creates our napi instance and has the rx thread schedule it Given that the unisys hypervisor currently requires that queue servicing be done by a polling loop that wakes up every 2ms, lets instead also convert that to a timer, which is simpler, and allows us to remove all the thread starting and stopping code. Signed-off-by: Neil Horman Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visornic/visornic_main.c | 202 +++++++----------- 1 file changed, 82 insertions(+), 120 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 7d4602973bbb..63d90f599158 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -89,11 +89,6 @@ static struct visor_driver visornic_driver = { .channel_interrupt = NULL, }; -struct visor_thread_info { - struct task_struct *task; - int id; -}; - struct chanstat { unsigned long got_rcv; unsigned long got_enbdisack; @@ -110,7 +105,6 @@ struct chanstat { struct visornic_devdata { int devnum; - int thread_wait_ms; unsigned short enabled; /* 0 disabled 1 enabled to receive */ unsigned short enab_dis_acked; /* NET_RCV_ENABLE/DISABLE acked by * IOPART @@ -162,7 +156,6 @@ struct visornic_devdata { bool server_change_state; /* Processing SERVER_CHANGESTATE msg */ bool going_away; /* device is being torn down */ struct dentry *eth_debugfs_dir; - struct visor_thread_info threadinfo; u64 interrupts_rcvd; u64 interrupts_notme; u64 interrupts_disabled; @@ -194,6 +187,9 @@ struct visornic_devdata { int queuefullmsg_logged; struct chanstat chstat; + struct timer_list irq_poll_timer; + struct napi_struct napi; + struct uiscmdrsp cmdrsp[SIZEOF_CMDRSP]; }; @@ -202,6 +198,8 @@ struct visornic_devdata { */ static LIST_HEAD(list_all_devices); static DEFINE_SPINLOCK(lock_all_devices); +static int visornic_poll(struct napi_struct *napi, int budget); +static void poll_for_irq(unsigned long v); /** * visor_copy_fragsinfo_from_skb( @@ -301,49 +299,6 @@ visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen, return count; } -/** - * visort_thread_start - starts thread for the device - * @thrinfo: The thread to start - * @threadfn: Function the thread starts - * @thrcontext: Context to pass to the thread, i.e. devdata - * @name: string describing name of thread - * - * Starts a thread for the device, currently only thread is - * process_incoming_rsps - * Returns 0 on success; - */ -static int visor_thread_start(struct visor_thread_info *thrinfo, - int (*threadfn)(void *), - void *thrcontext, char *name) -{ - /* used to stop the thread */ - thrinfo->task = kthread_run(threadfn, thrcontext, "%s", name); - if (IS_ERR(thrinfo->task)) { - pr_debug("%s failed (%ld)\n", - __func__, PTR_ERR(thrinfo->task)); - thrinfo->id = 0; - return -EINVAL; - } - thrinfo->id = thrinfo->task->pid; - return 0; -} - -/** - * visor_thread_stop - stop a thread for the device - * @thrinfo: The thread to stop - * - * Stop the thread and wait for completion for a minute - * Returns void. - */ -static void visor_thread_stop(struct visor_thread_info *thrinfo) -{ - if (!thrinfo->id) - return; /* thread not running */ - - BUG_ON(kthread_stop(thrinfo->task)); - thrinfo->id = 0; -} - static ssize_t enable_ints_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) @@ -373,8 +328,8 @@ visornic_serverdown_complete(struct visornic_devdata *devdata) netdev = devdata->netdev; - /* Stop using datachan */ - visor_thread_stop(&devdata->threadinfo); + /* Stop polling for interrupts */ + del_timer_sync(&devdata->irq_poll_timer); rtnl_lock(); dev_close(netdev); @@ -538,9 +493,6 @@ visornic_disable_with_timeout(struct net_device *netdev, const int timeout) unsigned long flags; int wait = 0; - /* stop the transmit queue so nothing more can be transmitted */ - netif_stop_queue(netdev); - /* send a msg telling the other end we are stopping incoming pkts */ spin_lock_irqsave(&devdata->priv_lock, flags); devdata->enabled = 0; @@ -586,10 +538,14 @@ visornic_disable_with_timeout(struct net_device *netdev, const int timeout) break; } } - /* we've set enabled to 0, so we can give up the lock. */ spin_unlock_irqrestore(&devdata->priv_lock, flags); + /* stop the transmit queue so nothing more can be transmitted */ + netif_stop_queue(netdev); + + napi_disable(&devdata->napi); + skb_queue_purge(&devdata->xmitbufhead); /* Free rcv buffers - other end has automatically unposed them on @@ -692,6 +648,7 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) /* send enable and wait for ack -- don't hold lock when sending enable * because if the queue is full, insert might sleep. */ + napi_enable(&devdata->napi); send_enbdis(netdev, 1, devdata); spin_lock_irqsave(&devdata->priv_lock, flags); @@ -719,6 +676,7 @@ visornic_enable_with_timeout(struct net_device *netdev, const int timeout) } netif_start_queue(netdev); + return 0; } @@ -1198,15 +1156,16 @@ repost_return(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata, * it up the stack. * Returns void */ -static void +static int visornic_rx(struct uiscmdrsp *cmdrsp) { struct visornic_devdata *devdata; struct sk_buff *skb, *prev, *curr; struct net_device *netdev; - int cc, currsize, off, status; + int cc, currsize, off; struct ethhdr *eth; unsigned long flags; + int rx_count = 0; /* post new rcv buf to the other end using the cmdrsp we have at hand * post it without holding lock - but we'll use the signal lock to @@ -1238,7 +1197,7 @@ visornic_rx(struct uiscmdrsp *cmdrsp) */ spin_unlock_irqrestore(&devdata->priv_lock, flags); repost_return(cmdrsp, devdata, skb, netdev); - return; + return rx_count; } spin_unlock_irqrestore(&devdata->priv_lock, flags); @@ -1257,7 +1216,7 @@ visornic_rx(struct uiscmdrsp *cmdrsp) if (repost_return(cmdrsp, devdata, skb, netdev) < 0) dev_err(&devdata->netdev->dev, "repost_return failed"); - return; + return rx_count; } /* length rcvd is greater than firstfrag in this skb rcv buf */ skb->tail += RCVPOST_BUF_SIZE; /* amount in skb->data */ @@ -1272,7 +1231,7 @@ visornic_rx(struct uiscmdrsp *cmdrsp) if (repost_return(cmdrsp, devdata, skb, netdev) < 0) dev_err(&devdata->netdev->dev, "repost_return failed"); - return; + return rx_count; } skb->tail += skb->len; skb->data_len = 0; /* nothing rcvd in frag_list */ @@ -1291,7 +1250,7 @@ visornic_rx(struct uiscmdrsp *cmdrsp) if (cmdrsp->net.rcv.rcvbuf[0] != skb) { if (repost_return(cmdrsp, devdata, skb, netdev) < 0) dev_err(&devdata->netdev->dev, "repost_return failed"); - return; + return rx_count; } if (cmdrsp->net.rcv.numrcvbufs > 1) { @@ -1374,10 +1333,11 @@ visornic_rx(struct uiscmdrsp *cmdrsp) /* drop packet - don't forward it up to OS */ devdata->n_rcv_packets_not_accepted++; repost_return(cmdrsp, devdata, skb, netdev); - return; + return rx_count; } while (0); - status = netif_rx(skb); + rx_count++; + netif_receive_skb(skb); /* netif_rx returns various values, but "in practice most drivers * ignore the return value */ @@ -1389,6 +1349,7 @@ visornic_rx(struct uiscmdrsp *cmdrsp) * new rcv buffer. */ repost_return(cmdrsp, devdata, skb, netdev); + return rx_count; } /** @@ -1593,9 +1554,6 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, str_pos += scnprintf(vbuf + str_pos, len - str_pos, " flow_control_lower_hits = %llu\n", devdata->flow_control_lower_hits); - str_pos += scnprintf(vbuf + str_pos, len - str_pos, - " thread_wait_ms = %d\n", - devdata->thread_wait_ms); str_pos += scnprintf(vbuf + str_pos, len - str_pos, " netif_queue = %s\n", netif_queue_stopped(devdata->netdev) ? @@ -1663,7 +1621,8 @@ send_rcv_posts_if_needed(struct visornic_devdata *devdata) * Returns when response queue is empty or when the threadd stops. */ static void -drain_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata) +service_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata, + int *rx_work_done) { unsigned long flags; struct net_device *netdev; @@ -1680,7 +1639,7 @@ drain_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata) case NET_RCV: devdata->chstat.got_rcv++; /* process incoming packet */ - visornic_rx(cmdrsp); + *rx_work_done += visornic_rx(cmdrsp); break; case NET_XMIT_DONE: spin_lock_irqsave(&devdata->priv_lock, flags); @@ -1717,8 +1676,6 @@ drain_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata) devdata->enab_dis_acked = 1; spin_unlock_irqrestore(&devdata->priv_lock, flags); - if (kthread_should_stop()) - break; if (devdata->server_down && devdata->server_change_state) { /* Inform Linux that the link is up */ @@ -1753,42 +1710,48 @@ drain_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata) } } +static int visornic_poll(struct napi_struct *napi, int budget) +{ + struct visornic_devdata *devdata = container_of(napi, + struct visornic_devdata, + napi); + int rx_count = 0; + + send_rcv_posts_if_needed(devdata); + service_resp_queue(devdata->cmdrsp, devdata, &rx_count); + + /* + * If there aren't any more packets to receive + * stop the poll + */ + if (rx_count < budget) + napi_complete(napi); + + return rx_count; +} + /** - * process_incoming_rsps - Checks the status of the response queue. + * poll_for_irq - Checks the status of the response queue. * @v: void pointer to the visronic devdata * * Main function of the vnic_incoming thread. Peridocially check the * response queue and drain it if needed. * Returns when thread has stopped. */ -static int -process_incoming_rsps(void *v) +static void +poll_for_irq(unsigned long v) { - struct visornic_devdata *devdata = v; - struct uiscmdrsp *cmdrsp = NULL; - const int SZ = SIZEOF_CMDRSP; + struct visornic_devdata *devdata = (struct visornic_devdata *)v; - cmdrsp = kmalloc(SZ, GFP_ATOMIC); - if (!cmdrsp) - return 0; + if (!visorchannel_signalempty( + devdata->dev->visorchannel, + IOCHAN_FROM_IOPART)) + napi_schedule(&devdata->napi); - while (!kthread_should_stop()) { - wait_event_interruptible_timeout( - devdata->rsp_queue, (atomic_read( - &devdata->interrupt_rcvd) == 1), - msecs_to_jiffies(devdata->thread_wait_ms)); + atomic_set(&devdata->interrupt_rcvd, 0); - /* periodically check to see if there are any rcf bufs which - * need to get sent to the IOSP. This can only happen if - * we run out of memory when trying to allocate skbs. - */ - atomic_set(&devdata->interrupt_rcvd, 0); - send_rcv_posts_if_needed(devdata); - drain_queue(cmdrsp, devdata); - } + mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2)); - kfree(cmdrsp); - return 0; } /** @@ -1907,6 +1870,17 @@ static int visornic_probe(struct visor_device *dev) /* TODO: Setup Interrupt information */ /* Let's start our threads to get responses */ + netif_napi_add(netdev, &devdata->napi, visornic_poll, 64); + + setup_timer(&devdata->irq_poll_timer, poll_for_irq, + (unsigned long)devdata); + /* + * Note: This time has to start running before the while + * loop below because the napi routine is responsible for + * setting enab_dis_acked + */ + mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2)); + channel_offset = offsetof(struct spar_io_channel_protocol, channel_header.features); err = visorbus_read_channel(dev, channel_offset, &features, 8); @@ -1914,7 +1888,7 @@ static int visornic_probe(struct visor_device *dev) dev_err(&dev->device, "%s failed to get features from chan (%d)\n", __func__, err); - goto cleanup_xmit_cmdrsp; + goto cleanup_napi_add; } features |= ULTRA_IO_CHANNEL_IS_POLLING; @@ -1923,14 +1897,14 @@ static int visornic_probe(struct visor_device *dev) dev_err(&dev->device, "%s failed to set features in chan (%d)\n", __func__, err); - goto cleanup_xmit_cmdrsp; + goto cleanup_napi_add; } err = register_netdev(netdev); if (err) { dev_err(&dev->device, "%s register_netdev failed (%d)\n", __func__, err); - goto cleanup_xmit_cmdrsp; + goto cleanup_napi_add; } /* create debgug/sysfs directories */ @@ -1944,14 +1918,14 @@ static int visornic_probe(struct visor_device *dev) goto cleanup_xmit_cmdrsp; } - devdata->thread_wait_ms = 2; - visor_thread_start(&devdata->threadinfo, process_incoming_rsps, - devdata, "vnic_incoming"); - dev_info(&dev->device, "%s success netdev=%s\n", __func__, netdev->name); return 0; +cleanup_napi_add: + del_timer_sync(&devdata->irq_poll_timer); + netif_napi_del(&devdata->napi); + cleanup_xmit_cmdrsp: kfree(devdata->xmit_cmdrsp); @@ -2021,18 +1995,8 @@ static void visornic_remove(struct visor_device *dev) unregister_netdev(netdev); /* this will call visornic_close() */ - /* this had to wait until last because visornic_close() / - * visornic_disable_with_timeout() polls waiting for state that is - * only updated by the thread - */ - if (devdata->threadinfo.id) { - visor_thread_stop(&devdata->threadinfo); - if (devdata->threadinfo.id) { - dev_err(&dev->device, "%s cannot stop worker thread\n", - __func__); - return; - } - } + del_timer_sync(&devdata->irq_poll_timer); + netif_napi_del(&devdata->napi); dev_set_drvdata(&dev->device, NULL); host_side_disappeared(devdata); @@ -2102,16 +2066,14 @@ static int visornic_resume(struct visor_device *dev, } devdata->server_change_state = true; spin_unlock_irqrestore(&devdata->priv_lock, flags); + /* Must transition channel to ATTACHED state BEFORE * we can start using the device again. * TODO: State transitions */ - if (!devdata->threadinfo.id) - visor_thread_start(&devdata->threadinfo, - process_incoming_rsps, - devdata, "vnic_incoming"); - else - pr_warn("vnic_incoming already running!\n"); + mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2)); + + init_rcv_bufs(netdev, devdata); rtnl_lock(); dev_open(netdev); From a12aaa92f3ccd15015e01373c2b60a3841aaebbb Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Tue, 4 Aug 2015 23:02:33 +0530 Subject: [PATCH 635/912] Staging: lustre: libcfs: Drop unnecessary cast on void* This patch does away with the cast on void * as it is unnecessary. Semantic patch used is as follows: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (T *) e ) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c index e962f89683a6..78acff068217 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c @@ -49,7 +49,7 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg) hdr = (struct libcfs_ioctl_hdr *)buf; data = (struct libcfs_ioctl_data *)buf; - if (copy_from_user(buf, (void *)arg, sizeof(*hdr))) + if (copy_from_user(buf, arg, sizeof(*hdr))) return -EFAULT; if (hdr->ioc_version != LIBCFS_IOCTL_VERSION) { @@ -69,7 +69,7 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg) } orig_len = hdr->ioc_len; - if (copy_from_user(buf, (void *)arg, hdr->ioc_len)) + if (copy_from_user(buf, arg, hdr->ioc_len)) return -EFAULT; if (orig_len != data->ioc_len) return -EINVAL; From 45b30514a34fa7fcb7a84be799ca5fc53d33a4d7 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Tue, 4 Aug 2015 23:02:35 +0530 Subject: [PATCH 636/912] Staging: lustre: lov: Drop unnecessary cast on void * This patch does away with the cast on void * as it is unnecessary. Semantic patch used is as follows: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (T *) e ) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_obd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 5f4c115f4ff4..c5c67d982ef2 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -1440,7 +1440,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, __u32 *genp; len = 0; - if (obd_ioctl_getdata(&buf, &len, (void *)uarg)) + if (obd_ioctl_getdata(&buf, &len, uarg)) return -EINVAL; data = (struct obd_ioctl_data *)buf; @@ -1473,7 +1473,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, *genp = lov->lov_tgts[i]->ltd_gen; } - if (copy_to_user((void *)uarg, buf, len)) + if (copy_to_user(uarg, buf, len)) rc = -EFAULT; obd_ioctl_freedata(buf, len); break; From b7856753856b4e6a20c1c91c6db03852e90de273 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Tue, 4 Aug 2015 23:02:34 +0530 Subject: [PATCH 637/912] Staging: lustre: osc: Drop unnecessary cast on void * This patch does away with the cast on void * as it is unnecessary. Semantic patch used is as follows: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (T *) e ) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 96c80e9bf92d..12113dfd87b8 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -2665,7 +2665,7 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, buf = NULL; len = 0; - if (obd_ioctl_getdata(&buf, &len, (void *)uarg)) { + if (obd_ioctl_getdata(&buf, &len, uarg)) { err = -EINVAL; goto out; } @@ -2695,7 +2695,7 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, memcpy(data->ioc_inlbuf2, &obd->obd_uuid, sizeof(uuid)); - err = copy_to_user((void *)uarg, buf, len); + err = copy_to_user(uarg, buf, len); if (err) err = -EFAULT; obd_ioctl_freedata(buf, len); From 9b37465e40915a657e60593e068aa3ab447931b1 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Tue, 4 Aug 2015 23:20:50 +0530 Subject: [PATCH 638/912] Staging: lustre: libcfs: Replace comma with a semicolon Replace comma between expression statements by a semicolon. The semantic patch used is as follows: @@ expression e1,e2; @@ e1 - , + ; e2; Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index 4dde8e08c0ba..efe5e667a2e5 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -400,7 +400,7 @@ cfs_expr_list_free(struct cfs_expr_list *expr_list) struct cfs_range_expr *expr; expr = list_entry(expr_list->el_exprs.next, - struct cfs_range_expr, re_link), + struct cfs_range_expr, re_link); list_del(&expr->re_link); LIBCFS_FREE(expr, sizeof(*expr)); } From 48177898f05916b64935118633353dbc448d3c24 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Tue, 4 Aug 2015 23:20:52 +0530 Subject: [PATCH 639/912] Staging: netlogic: Replace comma with a semicolon Replace comma between expression statements by a semicolon. The semantic patch used is as follows: @@ expression e1,e2; @@ e1 - , + ; e2; Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/netlogic/platform_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/netlogic/platform_net.c b/drivers/staging/netlogic/platform_net.c index 77c3c3522afa..e914147d7379 100644 --- a/drivers/staging/netlogic/platform_net.c +++ b/drivers/staging/netlogic/platform_net.c @@ -163,7 +163,7 @@ static void xls_gmac_init(void) switch (nlm_prom_info.board_major_version) { case 12: /* first block RGMII or XAUI, use RGMII */ - ndata0.phy_interface = PHY_INTERFACE_MODE_RGMII, + ndata0.phy_interface = PHY_INTERFACE_MODE_RGMII; ndata0.tx_stnid[0] = FMN_STNID_GMAC0_TX0; ndata0.phy_addr[0] = 0; From 91f2208c37ab08343b118601eaa0d9bb76fc8762 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Tue, 4 Aug 2015 23:20:51 +0530 Subject: [PATCH 640/912] Staging: lustre: mgc: Replace comma with a semicolon Replace comma between expression statements by a semicolon. The semantic patch used is as follows: @@ expression e1,e2; @@ e1 - , + ; e2; Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 562bd95bdcb9..019ee2f256aa 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1232,7 +1232,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, pos += sprintf(obdname + pos, "-%s%04x", is_ost ? "OST" : "MDT", entry->mne_index); - cname = is_ost ? "osc" : "mdc", + cname = is_ost ? "osc" : "mdc"; pos += sprintf(obdname + pos, "-%s-%s", cname, inst); lustre_cfg_bufs_reset(&bufs, obdname); From 4f016420d368480762061632f9a9254fd3a89239 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Wed, 5 Aug 2015 01:52:45 +0530 Subject: [PATCH 641/912] Staging: lustre: obdclass: Use kasprintf This patch uses kasprintf which combines kzalloc and sprintf. kasprintf also takes care of the size calculation. Semantic patch used is as follows: @@ expression a,flag; expression list args; statement S; @@ a = - \(kmalloc\|kzalloc\)(...,flag) + kasprintf (flag,args) <... when != a if (a == NULL || ...) S ...> - sprintf(a,args); Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 40ab7b272d03..7c5bab377f5c 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -247,13 +247,13 @@ int lustre_start_mgc(struct super_block *sb) mutex_lock(&mgc_start_lock); len = strlen(LUSTRE_MGC_OBDNAME) + strlen(libcfs_nid2str(nid)) + 1; - mgcname = kzalloc(len, GFP_NOFS); - niduuid = kzalloc(len + 2, GFP_NOFS); + mgcname = kasprintf(GFP_NOFS, + "%s%s", LUSTRE_MGC_OBDNAME, libcfs_nid2str(nid)); + niduuid = kasprintf(GFP_NOFS, "%s_%x", mgcname, i); if (!mgcname || !niduuid) { rc = -ENOMEM; goto out_free; } - sprintf(mgcname, "%s%s", LUSTRE_MGC_OBDNAME, libcfs_nid2str(nid)); mgssec = lsi->lsi_lmd->lmd_mgssec ? lsi->lsi_lmd->lmd_mgssec : ""; @@ -326,7 +326,6 @@ int lustre_start_mgc(struct super_block *sb) /* Add the primary nids for the MGS */ i = 0; - sprintf(niduuid, "%s_%x", mgcname, i); if (IS_SERVER(lsi)) { ptr = lsi->lsi_lmd->lmd_mgs; if (IS_MGS(lsi)) { @@ -1120,10 +1119,9 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) /* Remove leading /s from fsname */ while (*++s1 == '/') ; /* Freed in lustre_free_lsi */ - lmd->lmd_profile = kzalloc(strlen(s1) + 8, GFP_NOFS); + lmd->lmd_profile = kasprintf(GFP_NOFS, "%s-client", s1); if (!lmd->lmd_profile) return -ENOMEM; - sprintf(lmd->lmd_profile, "%s-client", s1); } /* Freed in lustre_free_lsi */ From 6255049d397b28fdedab0b6c5f85072b3177e4a4 Mon Sep 17 00:00:00 2001 From: Miguel Bernabeu Diaz Date: Wed, 5 Aug 2015 22:33:23 +0200 Subject: [PATCH 642/912] staging: lustre: Fix style warning on header Fix checkpatch.pl warning: WARNING: Use #include instead of Signed-off-by: Miguel Bernabeu Diaz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 0d8fa3a62c83..8bc05770382c 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -48,7 +48,7 @@ #include #include -#include +#include #include #include From 7fc80964e80bcf93cff0f7ba2aa8095d48f940d6 Mon Sep 17 00:00:00 2001 From: Daniel Machon Date: Wed, 5 Aug 2015 00:09:35 +0200 Subject: [PATCH 643/912] wilc1000: wilc_wfi_cfgoperations.c: Fixed initialization of global boolean. Globals are initialized to zero or NULL by GCC. No need to explicitly initialize them. Signed-off-by: Daniel Machon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index da9c12f9b443..2c0789e499d4 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -112,7 +112,7 @@ u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09}; u8 u8P2Plocalrandom = 0x01; u8 u8P2Precvrandom = 0x00; u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; -bool bWilc_ie = false; +bool bWilc_ie; #endif static struct ieee80211_supported_band WILC_WFI_band_2ghz = { @@ -135,9 +135,9 @@ struct add_key_params g_add_ptk_key_params; struct wilc_wfi_key g_key_ptk_params; struct wilc_wfi_wep_key g_key_wep_params; u8 g_flushing_in_progress; -bool g_ptk_keys_saved = false; -bool g_gtk_keys_saved = false; -bool g_wep_keys_saved = false; +bool g_ptk_keys_saved; +bool g_gtk_keys_saved; +bool g_wep_keys_saved; #define AGING_TIME (9 * 1000) #define duringIP_TIME 15000 From d855370186564b2dbfeb82547248a5e1f5f200b4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:38 -0700 Subject: [PATCH 644/912] staging: comedi: me4000: remove 'dio_nchan' boardinfo All the boards supported by this driver have 32 digital I/O channels. Remove the unnecessary boardinfo. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 38 ++++++------------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index a8f3ca48784b..2b37c5354a33 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -194,7 +194,6 @@ struct me4000_board { int ai_diff_nchan; int ai_sh_nchan; int ex_trig_analog; - int dio_nchan; int has_counter; }; @@ -202,20 +201,17 @@ static const struct me4000_board me4000_boards[] = { [BOARD_ME4650] = { .name = "ME-4650", .ai_nchan = 16, - .dio_nchan = 32, }, [BOARD_ME4660] = { .name = "ME-4660", .ai_nchan = 32, .ai_diff_nchan = 16, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4660I] = { .name = "ME-4660i", .ai_nchan = 32, .ai_diff_nchan = 16, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4660S] = { @@ -223,7 +219,6 @@ static const struct me4000_board me4000_boards[] = { .ai_nchan = 32, .ai_diff_nchan = 16, .ai_sh_nchan = 8, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4660IS] = { @@ -231,7 +226,6 @@ static const struct me4000_board me4000_boards[] = { .ai_nchan = 32, .ai_diff_nchan = 16, .ai_sh_nchan = 8, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4670] = { @@ -240,7 +234,6 @@ static const struct me4000_board me4000_boards[] = { .ai_nchan = 32, .ai_diff_nchan = 16, .ex_trig_analog = 1, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4670I] = { @@ -249,7 +242,6 @@ static const struct me4000_board me4000_boards[] = { .ai_nchan = 32, .ai_diff_nchan = 16, .ex_trig_analog = 1, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4670S] = { @@ -259,7 +251,6 @@ static const struct me4000_board me4000_boards[] = { .ai_diff_nchan = 16, .ai_sh_nchan = 8, .ex_trig_analog = 1, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4670IS] = { @@ -269,7 +260,6 @@ static const struct me4000_board me4000_boards[] = { .ai_diff_nchan = 16, .ai_sh_nchan = 8, .ex_trig_analog = 1, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4680] = { @@ -279,7 +269,6 @@ static const struct me4000_board me4000_boards[] = { .ai_nchan = 32, .ai_diff_nchan = 16, .ex_trig_analog = 1, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4680I] = { @@ -289,7 +278,6 @@ static const struct me4000_board me4000_boards[] = { .ai_nchan = 32, .ai_diff_nchan = 16, .ex_trig_analog = 1, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4680S] = { @@ -300,7 +288,6 @@ static const struct me4000_board me4000_boards[] = { .ai_diff_nchan = 16, .ai_sh_nchan = 8, .ex_trig_analog = 1, - .dio_nchan = 32, .has_counter = 1, }, [BOARD_ME4680IS] = { @@ -311,7 +298,6 @@ static const struct me4000_board me4000_boards[] = { .ai_diff_nchan = 16, .ai_sh_nchan = 8, .ex_trig_analog = 1, - .dio_nchan = 32, .has_counter = 1, }, }; @@ -1343,23 +1329,15 @@ static int me4000_auto_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - /*========================================================================= - Digital I/O subdevice - ========================================================================*/ - + /* Digital I/O subdevice */ s = &dev->subdevices[2]; - - if (board->dio_nchan) { - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = board->dio_nchan; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = me4000_dio_insn_bits; - s->insn_config = me4000_dio_insn_config; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 32; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = me4000_dio_insn_bits; + s->insn_config = me4000_dio_insn_config; /* * Check for optoisolated ME-4000 version. If one the first From 14aa4789f0519d0d97f6bf672a077582b08f2cf6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:39 -0700 Subject: [PATCH 645/912] staging: comedi: me4000: all board types have analog inputs All the boards supported by this driver have analog inputs. They just differ in the number of channels (32 or 16). Always initialize the analog input subdevice in me4000_auto_attach(). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 37 ++++++++++--------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 2b37c5354a33..3d45217e9e18 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1281,31 +1281,22 @@ static int me4000_auto_attach(struct comedi_device *dev, if (result) return result; - /*========================================================================= - Analog input subdevice - ========================================================================*/ - + /* Analog Input subdevice */ s = &dev->subdevices[0]; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; + s->n_chan = board->ai_nchan; + s->maxdata = 0xffff; + s->len_chanlist = ME4000_AI_CHANNEL_LIST_COUNT; + s->range_table = &me4000_ai_range; + s->insn_read = me4000_ai_insn_read; - if (board->ai_nchan) { - s->type = COMEDI_SUBD_AI; - s->subdev_flags = - SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; - s->n_chan = board->ai_nchan; - s->maxdata = 0xFFFF; /* 16 bit ADC */ - s->len_chanlist = ME4000_AI_CHANNEL_LIST_COUNT; - s->range_table = &me4000_ai_range; - s->insn_read = me4000_ai_insn_read; - - if (dev->irq) { - dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->cancel = me4000_ai_cancel; - s->do_cmdtest = me4000_ai_do_cmd_test; - s->do_cmd = me4000_ai_do_cmd; - } - } else { - s->type = COMEDI_SUBD_UNUSED; + if (dev->irq) { + dev->read_subdev = s; + s->subdev_flags |= SDF_CMD_READ; + s->cancel = me4000_ai_cancel; + s->do_cmdtest = me4000_ai_do_cmd_test; + s->do_cmd = me4000_ai_do_cmd; } /*========================================================================= From 31bebc030fb2a6e2e7e7ea19ce58a0f196280281 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:40 -0700 Subject: [PATCH 646/912] staging: comedi: me4000: only set SDF_DIFF when supported Some of the boards supported by this driver do not have differential analog inputs. Only set the SDF_DIFF subdev_flag when the board supports it. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 3d45217e9e18..171749b06ef2 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1284,7 +1284,9 @@ static int me4000_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND; + if (board->ai_diff_nchan) + s->subdev_flags |= SDF_DIFF; s->n_chan = board->ai_nchan; s->maxdata = 0xffff; s->len_chanlist = ME4000_AI_CHANNEL_LIST_COUNT; From 03611e5491e488f30a5b7653e02ee65032cfba14 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:41 -0700 Subject: [PATCH 647/912] staging: comedi: me4000: remove 'chan' check in me4000_ai_insn_read() The comedi core validates that the 'chan' is valid for the subdevice before calling the (*insn_read) operation. Remove the unnecessary check. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 171749b06ef2..d6b7adc19056 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -477,11 +477,6 @@ static int me4000_ai_insn_read(struct comedi_device *dev, switch (aref) { case AREF_GROUND: case AREF_COMMON: - if (chan >= board->ai_nchan) { - dev_err(dev->class_dev, - "Analog input is not available\n"); - return -EINVAL; - } entry |= ME4000_AI_LIST_INPUT_SINGLE_ENDED | chan; break; From 1a02387063fbd32f51c98540499b90acc8b4317f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:42 -0700 Subject: [PATCH 648/912] staging: comedi: me4000: remove 'board' from me4000_ai_insn_read() The 'board' pointer is only used in this function to verify that the 'chan' is valid for an aref of AREF_DIFF. For differential inputs, the maximum channel is half the subdevice 'n_chan'. Use that instead and remove the 'board' variable. Also, the comedi core does not validate the aref flags. Add a check to ensure that the subdevice actually supports the AREF_DIFF mode. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index d6b7adc19056..335fafc73a94 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -436,10 +436,10 @@ static void me4000_reset(struct comedi_device *dev) ===========================================================================*/ static int me4000_ai_insn_read(struct comedi_device *dev, - struct comedi_subdevice *subdevice, - struct comedi_insn *insn, unsigned int *data) + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { - const struct me4000_board *board = dev->board_ptr; int chan = CR_CHAN(insn->chanspec); int rang = CR_RANGE(insn->chanspec); int aref = CR_AREF(insn->chanspec); @@ -481,13 +481,19 @@ static int me4000_ai_insn_read(struct comedi_device *dev, break; case AREF_DIFF: + if (!(s->subdev_flags && SDF_DIFF)) { + dev_err(dev->class_dev, + "Differential inputs are not available\n"); + return -EINVAL; + } + if (rang == 0 || rang == 1) { dev_err(dev->class_dev, "Range must be bipolar when aref = diff\n"); return -EINVAL; } - if (chan >= board->ai_diff_nchan) { + if (chan >= (s->n_chan / 2)) { dev_err(dev->class_dev, "Analog input is not available\n"); return -EINVAL; From 4ec85dadb7c7bb6cf84f18b7207f60efe0095d72 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:43 -0700 Subject: [PATCH 649/912] staging: comedi: me4000: remove 'board' from me4000_ai_check_chanlist() The maximum differential channel is half the subdevice 'n_chan'. Use that instead and remove the need for the 'board' variable. Also, the comedi core does no validate the aref flags. Add a check to ensure that the subdevice actually supports the AREF_DIFF mode. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 335fafc73a94..008929e8d3fe 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -568,8 +568,6 @@ static int me4000_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - const struct me4000_board *board = dev->board_ptr; - unsigned int max_diff_chan = board->ai_diff_nchan; unsigned int aref0 = CR_AREF(cmd->chanlist[0]); int i; @@ -585,7 +583,13 @@ static int me4000_ai_check_chanlist(struct comedi_device *dev, } if (aref == AREF_DIFF) { - if (chan >= max_diff_chan) { + if (!(s->subdev_flags && SDF_DIFF)) { + dev_err(dev->class_dev, + "Differential inputs are not available\n"); + return -EINVAL; + } + + if (chan >= (s->n_chan / 2)) { dev_dbg(dev->class_dev, "Channel number to high\n"); return -EINVAL; From 13a463ae576d2e238647b2e2bbfda0512b22dabf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:44 -0700 Subject: [PATCH 650/912] staging: comedi: me4000: make boardinfo flags bit-fields Change the boardinfo 'has_counter' and 'ai_trig_analog' flags into bit-fields to save a bit of space. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 008929e8d3fe..cc05c88bf13e 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -193,8 +193,8 @@ struct me4000_board { int ai_nchan; int ai_diff_nchan; int ai_sh_nchan; - int ex_trig_analog; - int has_counter; + unsigned int ex_trig_analog:1; + unsigned int has_counter:1; }; static const struct me4000_board me4000_boards[] = { From 56f71de601468efc12d90db9cad6ccec062b74b8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:45 -0700 Subject: [PATCH 651/912] staging: comedi: me4000: refactor 'ai_diff_nchan' boardinfo This member of the boardinfo is only used as a flag indicating that the board supports differential analog inputs. Convert the member to a bit- field to save a bit of space. For aesthetics, rename the member to 'can_do_diff_ai'. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index cc05c88bf13e..7eade91a04f6 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -191,8 +191,8 @@ struct me4000_board { int ao_nchan; int ao_fifo; int ai_nchan; - int ai_diff_nchan; int ai_sh_nchan; + unsigned int can_do_diff_ai:1; unsigned int ex_trig_analog:1; unsigned int has_counter:1; }; @@ -205,34 +205,34 @@ static const struct me4000_board me4000_boards[] = { [BOARD_ME4660] = { .name = "ME-4660", .ai_nchan = 32, - .ai_diff_nchan = 16, + .can_do_diff_ai = 1, .has_counter = 1, }, [BOARD_ME4660I] = { .name = "ME-4660i", .ai_nchan = 32, - .ai_diff_nchan = 16, + .can_do_diff_ai = 1, .has_counter = 1, }, [BOARD_ME4660S] = { .name = "ME-4660s", .ai_nchan = 32, - .ai_diff_nchan = 16, .ai_sh_nchan = 8, + .can_do_diff_ai = 1, .has_counter = 1, }, [BOARD_ME4660IS] = { .name = "ME-4660is", .ai_nchan = 32, - .ai_diff_nchan = 16, .ai_sh_nchan = 8, + .can_do_diff_ai = 1, .has_counter = 1, }, [BOARD_ME4670] = { .name = "ME-4670", .ao_nchan = 4, .ai_nchan = 32, - .ai_diff_nchan = 16, + .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_counter = 1, }, @@ -240,7 +240,7 @@ static const struct me4000_board me4000_boards[] = { .name = "ME-4670i", .ao_nchan = 4, .ai_nchan = 32, - .ai_diff_nchan = 16, + .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_counter = 1, }, @@ -248,8 +248,8 @@ static const struct me4000_board me4000_boards[] = { .name = "ME-4670s", .ao_nchan = 4, .ai_nchan = 32, - .ai_diff_nchan = 16, .ai_sh_nchan = 8, + .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_counter = 1, }, @@ -257,8 +257,8 @@ static const struct me4000_board me4000_boards[] = { .name = "ME-4670is", .ao_nchan = 4, .ai_nchan = 32, - .ai_diff_nchan = 16, .ai_sh_nchan = 8, + .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_counter = 1, }, @@ -267,7 +267,7 @@ static const struct me4000_board me4000_boards[] = { .ao_nchan = 4, .ao_fifo = 4, .ai_nchan = 32, - .ai_diff_nchan = 16, + .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_counter = 1, }, @@ -276,7 +276,7 @@ static const struct me4000_board me4000_boards[] = { .ao_nchan = 4, .ao_fifo = 4, .ai_nchan = 32, - .ai_diff_nchan = 16, + .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_counter = 1, }, @@ -285,8 +285,8 @@ static const struct me4000_board me4000_boards[] = { .ao_nchan = 4, .ao_fifo = 4, .ai_nchan = 32, - .ai_diff_nchan = 16, .ai_sh_nchan = 8, + .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_counter = 1, }, @@ -295,8 +295,8 @@ static const struct me4000_board me4000_boards[] = { .ao_nchan = 4, .ao_fifo = 4, .ai_nchan = 32, - .ai_diff_nchan = 16, .ai_sh_nchan = 8, + .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_counter = 1, }, @@ -1290,7 +1290,7 @@ static int me4000_auto_attach(struct comedi_device *dev, s = &dev->subdevices[0]; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND; - if (board->ai_diff_nchan) + if (board->can_do_diff_ai) s->subdev_flags |= SDF_DIFF; s->n_chan = board->ai_nchan; s->maxdata = 0xffff; From aed9b66316d2c6eb22c2a80a8af4d1f7beffe309 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:46 -0700 Subject: [PATCH 652/912] staging: comedi: me4000: refactor 'ao_nchan' boardinfo For the boards that have analog output capability, there are always 4 analog output channels. Convert the 'ao_nchan' member of the boardinfo into a bit-field, 'has_ao', to save a bit of space and set the analog output subdevice 'n_chan' to 4 when supported. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 7eade91a04f6..2f11cdd3eefb 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -188,12 +188,12 @@ enum me4000_boardid { struct me4000_board { const char *name; - int ao_nchan; int ao_fifo; int ai_nchan; int ai_sh_nchan; unsigned int can_do_diff_ai:1; unsigned int ex_trig_analog:1; + unsigned int has_ao:1; unsigned int has_counter:1; }; @@ -230,74 +230,74 @@ static const struct me4000_board me4000_boards[] = { }, [BOARD_ME4670] = { .name = "ME-4670", - .ao_nchan = 4, .ai_nchan = 32, .can_do_diff_ai = 1, .ex_trig_analog = 1, + .has_ao = 1, .has_counter = 1, }, [BOARD_ME4670I] = { .name = "ME-4670i", - .ao_nchan = 4, .ai_nchan = 32, .can_do_diff_ai = 1, .ex_trig_analog = 1, + .has_ao = 1, .has_counter = 1, }, [BOARD_ME4670S] = { .name = "ME-4670s", - .ao_nchan = 4, .ai_nchan = 32, .ai_sh_nchan = 8, .can_do_diff_ai = 1, .ex_trig_analog = 1, + .has_ao = 1, .has_counter = 1, }, [BOARD_ME4670IS] = { .name = "ME-4670is", - .ao_nchan = 4, .ai_nchan = 32, .ai_sh_nchan = 8, .can_do_diff_ai = 1, .ex_trig_analog = 1, + .has_ao = 1, .has_counter = 1, }, [BOARD_ME4680] = { .name = "ME-4680", - .ao_nchan = 4, .ao_fifo = 4, .ai_nchan = 32, .can_do_diff_ai = 1, .ex_trig_analog = 1, + .has_ao = 1, .has_counter = 1, }, [BOARD_ME4680I] = { .name = "ME-4680i", - .ao_nchan = 4, .ao_fifo = 4, .ai_nchan = 32, .can_do_diff_ai = 1, .ex_trig_analog = 1, + .has_ao = 1, .has_counter = 1, }, [BOARD_ME4680S] = { .name = "ME-4680s", - .ao_nchan = 4, .ao_fifo = 4, .ai_nchan = 32, .ai_sh_nchan = 8, .can_do_diff_ai = 1, .ex_trig_analog = 1, + .has_ao = 1, .has_counter = 1, }, [BOARD_ME4680IS] = { .name = "ME-4680is", - .ao_nchan = 4, .ao_fifo = 4, .ai_nchan = 32, .ai_sh_nchan = 8, .can_do_diff_ai = 1, .ex_trig_analog = 1, + .has_ao = 1, .has_counter = 1, }, }; @@ -1312,10 +1312,10 @@ static int me4000_auto_attach(struct comedi_device *dev, s = &dev->subdevices[1]; - if (board->ao_nchan) { + if (board->has_ao) { s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_COMMON | SDF_GROUND; - s->n_chan = board->ao_nchan; + s->n_chan = 4; s->maxdata = 0xFFFF; /* 16 bit DAC */ s->range_table = &range_bipolar10; s->insn_write = me4000_ao_insn_write; From 77714d31f6cd6886dadbdb34cf32eddc2853eb50 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:47 -0700 Subject: [PATCH 653/912] staging: comedi: me4000: refactor 'ao_fifo' boardinfo This member of the boardinfo is always '4' for the boards that have an analog output FIFO. Covert it to a bit-field, 'has_ao_fifo', to save a bit of space. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 2f11cdd3eefb..1d88c7172347 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -188,12 +188,12 @@ enum me4000_boardid { struct me4000_board { const char *name; - int ao_fifo; int ai_nchan; int ai_sh_nchan; unsigned int can_do_diff_ai:1; unsigned int ex_trig_analog:1; unsigned int has_ao:1; + unsigned int has_ao_fifo:1; unsigned int has_counter:1; }; @@ -264,40 +264,40 @@ static const struct me4000_board me4000_boards[] = { }, [BOARD_ME4680] = { .name = "ME-4680", - .ao_fifo = 4, .ai_nchan = 32, .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_ao = 1, + .has_ao_fifo = 1, .has_counter = 1, }, [BOARD_ME4680I] = { .name = "ME-4680i", - .ao_fifo = 4, .ai_nchan = 32, .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_ao = 1, + .has_ao_fifo = 1, .has_counter = 1, }, [BOARD_ME4680S] = { .name = "ME-4680s", - .ao_fifo = 4, .ai_nchan = 32, .ai_sh_nchan = 8, .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_ao = 1, + .has_ao_fifo = 1, .has_counter = 1, }, [BOARD_ME4680IS] = { .name = "ME-4680is", - .ao_fifo = 4, .ai_nchan = 32, .ai_sh_nchan = 8, .can_do_diff_ai = 1, .ex_trig_analog = 1, .has_ao = 1, + .has_ao_fifo = 1, .has_counter = 1, }, }; From e5f663502228edd9c540c9d550dea59cbdb13d3a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:48 -0700 Subject: [PATCH 654/912] staging: comedi: me4000: refactor 'ai_sh_nchan' boardinfo Some of the boards supported by this driver can do analog input sample & hold on 8 of the channels. The 'ai_sh_nchan' member of the boardinfo is used to indicate which boards support this feature. To save a bit of space, convert this member to a bit-field, 'can_do_sh_ai'. Note, this feature is not currently supported. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 1d88c7172347..2a975e6f9e2a 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -189,8 +189,8 @@ enum me4000_boardid { struct me4000_board { const char *name; int ai_nchan; - int ai_sh_nchan; unsigned int can_do_diff_ai:1; + unsigned int can_do_sh_ai:1; /* sample & hold (8 channels) */ unsigned int ex_trig_analog:1; unsigned int has_ao:1; unsigned int has_ao_fifo:1; @@ -217,15 +217,15 @@ static const struct me4000_board me4000_boards[] = { [BOARD_ME4660S] = { .name = "ME-4660s", .ai_nchan = 32, - .ai_sh_nchan = 8, .can_do_diff_ai = 1, + .can_do_sh_ai = 1, .has_counter = 1, }, [BOARD_ME4660IS] = { .name = "ME-4660is", .ai_nchan = 32, - .ai_sh_nchan = 8, .can_do_diff_ai = 1, + .can_do_sh_ai = 1, .has_counter = 1, }, [BOARD_ME4670] = { @@ -247,8 +247,8 @@ static const struct me4000_board me4000_boards[] = { [BOARD_ME4670S] = { .name = "ME-4670s", .ai_nchan = 32, - .ai_sh_nchan = 8, .can_do_diff_ai = 1, + .can_do_sh_ai = 1, .ex_trig_analog = 1, .has_ao = 1, .has_counter = 1, @@ -256,8 +256,8 @@ static const struct me4000_board me4000_boards[] = { [BOARD_ME4670IS] = { .name = "ME-4670is", .ai_nchan = 32, - .ai_sh_nchan = 8, .can_do_diff_ai = 1, + .can_do_sh_ai = 1, .ex_trig_analog = 1, .has_ao = 1, .has_counter = 1, @@ -283,8 +283,8 @@ static const struct me4000_board me4000_boards[] = { [BOARD_ME4680S] = { .name = "ME-4680s", .ai_nchan = 32, - .ai_sh_nchan = 8, .can_do_diff_ai = 1, + .can_do_sh_ai = 1, .ex_trig_analog = 1, .has_ao = 1, .has_ao_fifo = 1, @@ -293,8 +293,8 @@ static const struct me4000_board me4000_boards[] = { [BOARD_ME4680IS] = { .name = "ME-4680is", .ai_nchan = 32, - .ai_sh_nchan = 8, .can_do_diff_ai = 1, + .can_do_sh_ai = 1, .ex_trig_analog = 1, .has_ao = 1, .has_ao_fifo = 1, From 3674a87ebe73be57fe412b8906b0004c6372bac4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:49 -0700 Subject: [PATCH 655/912] staging: comedi: me4000: rename local variables used for 'dev->private' In comedi drivers the local variable used for the dev->private pointer is normally named 'devpriv'. For aesthetics, rename the variables in this driver. Also, rename the struct to follow the norm. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 2a975e6f9e2a..0a85ea5ccdca 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -166,7 +166,7 @@ broken. #define ME4000_AI_CHANNEL_LIST_COUNT 1024 -struct me4000_info { +struct me4000_private { unsigned long plx_regbase; }; @@ -316,7 +316,7 @@ static int me4000_xilinx_download(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - struct me4000_info *info = dev->private; + struct me4000_private *devpriv = dev->private; unsigned long xilinx_iobase = pci_resource_start(pcidev, 5); unsigned int file_length; unsigned int val; @@ -329,28 +329,28 @@ static int me4000_xilinx_download(struct comedi_device *dev, * Set PLX local interrupt 2 polarity to high. * Interrupt is thrown by init pin of xilinx. */ - outl(PLX9052_INTCSR_LI2POL, info->plx_regbase + PLX9052_INTCSR); + outl(PLX9052_INTCSR_LI2POL, devpriv->plx_regbase + PLX9052_INTCSR); /* Set /CS and /WRITE of the Xilinx */ - val = inl(info->plx_regbase + PLX9052_CNTRL); + val = inl(devpriv->plx_regbase + PLX9052_CNTRL); val |= PLX9052_CNTRL_UIO2_DATA; - outl(val, info->plx_regbase + PLX9052_CNTRL); + outl(val, devpriv->plx_regbase + PLX9052_CNTRL); /* Init Xilinx with CS1 */ inb(xilinx_iobase + 0xC8); /* Wait until /INIT pin is set */ udelay(20); - val = inl(info->plx_regbase + PLX9052_INTCSR); + val = inl(devpriv->plx_regbase + PLX9052_INTCSR); if (!(val & PLX9052_INTCSR_LI2STAT)) { dev_err(dev->class_dev, "Can't init Xilinx\n"); return -EIO; } /* Reset /CS and /WRITE of the Xilinx */ - val = inl(info->plx_regbase + PLX9052_CNTRL); + val = inl(devpriv->plx_regbase + PLX9052_CNTRL); val &= ~PLX9052_CNTRL_UIO2_DATA; - outl(val, info->plx_regbase + PLX9052_CNTRL); + outl(val, devpriv->plx_regbase + PLX9052_CNTRL); /* Download Xilinx firmware */ file_length = (((unsigned int)data[0] & 0xff) << 24) + @@ -364,7 +364,7 @@ static int me4000_xilinx_download(struct comedi_device *dev, udelay(10); /* Check if BUSY flag is low */ - val = inl(info->plx_regbase + PLX9052_CNTRL); + val = inl(devpriv->plx_regbase + PLX9052_CNTRL); if (val & PLX9052_CNTRL_UIO1_DATA) { dev_err(dev->class_dev, "Xilinx is still busy (i = %d)\n", i); @@ -373,7 +373,7 @@ static int me4000_xilinx_download(struct comedi_device *dev, } /* If done flag is high download was successful */ - val = inl(info->plx_regbase + PLX9052_CNTRL); + val = inl(devpriv->plx_regbase + PLX9052_CNTRL); if (!(val & PLX9052_CNTRL_UIO0_DATA)) { dev_err(dev->class_dev, "DONE flag is not set\n"); dev_err(dev->class_dev, "Download not successful\n"); @@ -381,25 +381,25 @@ static int me4000_xilinx_download(struct comedi_device *dev, } /* Set /CS and /WRITE */ - val = inl(info->plx_regbase + PLX9052_CNTRL); + val = inl(devpriv->plx_regbase + PLX9052_CNTRL); val |= PLX9052_CNTRL_UIO2_DATA; - outl(val, info->plx_regbase + PLX9052_CNTRL); + outl(val, devpriv->plx_regbase + PLX9052_CNTRL); return 0; } static void me4000_reset(struct comedi_device *dev) { - struct me4000_info *info = dev->private; + struct me4000_private *devpriv = dev->private; unsigned int val; int chan; /* Make a hardware reset */ - val = inl(info->plx_regbase + PLX9052_CNTRL); + val = inl(devpriv->plx_regbase + PLX9052_CNTRL); val |= PLX9052_CNTRL_PCI_RESET; - outl(val, info->plx_regbase + PLX9052_CNTRL); + outl(val, devpriv->plx_regbase + PLX9052_CNTRL); val &= ~PLX9052_CNTRL_PCI_RESET; - outl(val, info->plx_regbase + PLX9052_CNTRL); + outl(val, devpriv->plx_regbase + PLX9052_CNTRL); /* 0x8000 to the DACs means an output voltage of 0V */ for (chan = 0; chan < 4; chan++) @@ -417,7 +417,7 @@ static void me4000_reset(struct comedi_device *dev) /* Enable interrupts on the PLX */ outl(PLX9052_INTCSR_LI1ENAB | PLX9052_INTCSR_LI1POL | - PLX9052_INTCSR_PCIENAB, info->plx_regbase + PLX9052_INTCSR); + PLX9052_INTCSR_PCIENAB, devpriv->plx_regbase + PLX9052_INTCSR); /* Set the adustment register for AO demux */ outl(ME4000_AO_DEMUX_ADJUST_VALUE, @@ -1244,7 +1244,7 @@ static int me4000_auto_attach(struct comedi_device *dev, { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct me4000_board *board = NULL; - struct me4000_info *info; + struct me4000_private *devpriv; struct comedi_subdevice *s; int result; @@ -1255,17 +1255,17 @@ static int me4000_auto_attach(struct comedi_device *dev, dev->board_ptr = board; dev->board_name = board->name; - info = comedi_alloc_devpriv(dev, sizeof(*info)); - if (!info) + devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); + if (!devpriv) return -ENOMEM; result = comedi_pci_enable(dev); if (result) return result; - info->plx_regbase = pci_resource_start(pcidev, 1); + devpriv->plx_regbase = pci_resource_start(pcidev, 1); dev->iobase = pci_resource_start(pcidev, 2); - if (!info->plx_regbase || !dev->iobase) + if (!devpriv->plx_regbase || !dev->iobase) return -ENODEV; result = comedi_load_firmware(dev, &pcidev->dev, ME4000_FIRMWARE, From 271f5aa04be0ff3d0c6fc8ccc31a6b0d3294461b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:50 -0700 Subject: [PATCH 656/912] staging: comedi: me4000: remove unnecessary ME4000_AI_LIST_INPUT_SINGLE_ENDED This define evaluates to 0 and is OR'ed with the 'entry' value that is written to the ME4000_AI_CHANNEL_LIST_REG when the channel aref is a single-ended type (AREF_GROUND or AREF_COMMON). OR'ing a zero value is pretty silly, just remove it. Remove the switch() in me4000_ai_insn_read() to simplify the code. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 0a85ea5ccdca..ba3313c069d0 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -110,7 +110,6 @@ broken. #define ME4000_AI_STATUS_BIT_FSM (1 << 29) #define ME4000_AI_CTRL_BIT_EX_TRIG_BOTH (1 << 31) #define ME4000_AI_CHANNEL_LIST_REG 0x78 -#define ME4000_AI_LIST_INPUT_SINGLE_ENDED (0 << 5) #define ME4000_AI_LIST_INPUT_DIFFERENTIAL (1 << 5) #define ME4000_AI_LIST_RANGE_BIPOLAR_10 (0 << 6) #define ME4000_AI_LIST_RANGE_BIPOLAR_2_5 (1 << 6) @@ -474,13 +473,8 @@ static int me4000_ai_insn_read(struct comedi_device *dev, return -EINVAL; } - switch (aref) { - case AREF_GROUND: - case AREF_COMMON: - entry |= ME4000_AI_LIST_INPUT_SINGLE_ENDED | chan; - break; - - case AREF_DIFF: + entry |= chan; + if (aref == AREF_DIFF) { if (!(s->subdev_flags && SDF_DIFF)) { dev_err(dev->class_dev, "Differential inputs are not available\n"); @@ -498,11 +492,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev, "Analog input is not available\n"); return -EINVAL; } - entry |= ME4000_AI_LIST_INPUT_DIFFERENTIAL | chan; - break; - default: - dev_err(dev->class_dev, "Invalid aref specified\n"); - return -EINVAL; + entry |= ME4000_AI_LIST_INPUT_DIFFERENTIAL; } entry |= ME4000_AI_LIST_LAST_ENTRY; @@ -703,8 +693,6 @@ static int ai_write_chanlist(struct comedi_device *dev, if (aref == AREF_DIFF) entry |= ME4000_AI_LIST_INPUT_DIFFERENTIAL; - else - entry |= ME4000_AI_LIST_INPUT_SINGLE_ENDED; outl(entry, dev->iobase + ME4000_AI_CHANNEL_LIST_REG); } From 245bd462440ca5914286c71051fdc5af506e76cb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:51 -0700 Subject: [PATCH 657/912] staging: comedi: me4000: simplify analog input range programming The comedi_lrange table for the analog inputs is inverted compared to the values that need to be written to the ME4000_AI_CHANNEL_LIST_REG to select the range. Create a macro, ME4000_AI_LIST_RANGE(), to handle the inversion. Remove the old defines and simplify the code a bit. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 41 ++++++------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index ba3313c069d0..1001d6379480 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -111,10 +111,7 @@ broken. #define ME4000_AI_CTRL_BIT_EX_TRIG_BOTH (1 << 31) #define ME4000_AI_CHANNEL_LIST_REG 0x78 #define ME4000_AI_LIST_INPUT_DIFFERENTIAL (1 << 5) -#define ME4000_AI_LIST_RANGE_BIPOLAR_10 (0 << 6) -#define ME4000_AI_LIST_RANGE_BIPOLAR_2_5 (1 << 6) -#define ME4000_AI_LIST_RANGE_UNIPOLAR_10 (2 << 6) -#define ME4000_AI_LIST_RANGE_UNIPOLAR_2_5 (3 << 6) +#define ME4000_AI_LIST_RANGE(x) ((3 - ((x) & 3)) << 6) #define ME4000_AI_LIST_LAST_ENTRY (1 << 8) #define ME4000_AI_DATA_REG 0x7c #define ME4000_AI_CHAN_TIMER_REG 0x80 @@ -301,6 +298,12 @@ static const struct me4000_board me4000_boards[] = { }, }; +/* + * NOTE: the ranges here are inverted compared to the values + * written to the ME4000_AI_CHANNEL_LIST_REG, + * + * The ME4000_AI_LIST_RANGE() macro handles the inversion. + */ static const struct comedi_lrange me4000_ai_range = { 4, { UNI_RANGE(2.5), @@ -455,24 +458,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev, return -EINVAL; } - switch (rang) { - case 0: - entry |= ME4000_AI_LIST_RANGE_UNIPOLAR_2_5; - break; - case 1: - entry |= ME4000_AI_LIST_RANGE_UNIPOLAR_10; - break; - case 2: - entry |= ME4000_AI_LIST_RANGE_BIPOLAR_2_5; - break; - case 3: - entry |= ME4000_AI_LIST_RANGE_BIPOLAR_10; - break; - default: - dev_err(dev->class_dev, "Invalid range specified\n"); - return -EINVAL; - } - + entry |= ME4000_AI_LIST_RANGE(rang); entry |= chan; if (aref == AREF_DIFF) { if (!(s->subdev_flags && SDF_DIFF)) { @@ -680,16 +666,7 @@ static int ai_write_chanlist(struct comedi_device *dev, rang = CR_RANGE(cmd->chanlist[i]); aref = CR_AREF(cmd->chanlist[i]); - entry = chan; - - if (rang == 0) - entry |= ME4000_AI_LIST_RANGE_UNIPOLAR_2_5; - else if (rang == 1) - entry |= ME4000_AI_LIST_RANGE_UNIPOLAR_10; - else if (rang == 2) - entry |= ME4000_AI_LIST_RANGE_BIPOLAR_2_5; - else - entry |= ME4000_AI_LIST_RANGE_BIPOLAR_10; + entry = chan | ME4000_AI_LIST_RANGE(rang); if (aref == AREF_DIFF) entry |= ME4000_AI_LIST_INPUT_DIFFERENTIAL; From 518c5b64f6014192e5f9bc3bb1ebf2311e14b621 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:52 -0700 Subject: [PATCH 658/912] staging: comedi: me4000: fix ai_write_chanlist() Rename this function so it has namespace associated with the driver. The last entry of the chanlist needs the ME4000_AI_LIST_LAST_ENTRY bit set to end the list. Fix the function and tidy if up a bit. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 1001d6379480..5b798a63589b 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -652,25 +652,26 @@ static void ai_write_timer(struct comedi_device *dev, outl(chan_ticks - 1, dev->iobase + ME4000_AI_CHAN_TIMER_REG); } -static int ai_write_chanlist(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) +static int me4000_ai_write_chanlist(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd) { - unsigned int entry; - unsigned int chan; - unsigned int rang; - unsigned int aref; int i; for (i = 0; i < cmd->chanlist_len; i++) { - chan = CR_CHAN(cmd->chanlist[i]); - rang = CR_RANGE(cmd->chanlist[i]); - aref = CR_AREF(cmd->chanlist[i]); + unsigned int chan = CR_CHAN(cmd->chanlist[i]); + unsigned int range = CR_RANGE(cmd->chanlist[i]); + unsigned int aref = CR_AREF(cmd->chanlist[i]); + unsigned int entry; - entry = chan | ME4000_AI_LIST_RANGE(rang); + entry = chan | ME4000_AI_LIST_RANGE(range); if (aref == AREF_DIFF) entry |= ME4000_AI_LIST_INPUT_DIFFERENTIAL; + if (i == (cmd->chanlist_len - 1)) + entry |= ME4000_AI_LIST_LAST_ENTRY; + outl(entry, dev->iobase + ME4000_AI_CHANNEL_LIST_REG); } @@ -738,7 +739,7 @@ static int ai_prepare(struct comedi_device *dev, outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); /* Write the channel list */ - ai_write_chanlist(dev, s, cmd); + me4000_ai_write_chanlist(dev, s, cmd); return 0; } From a0861f87185a51b44c972a01bfc9730cb9cbbc2d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:53 -0700 Subject: [PATCH 659/912] staging: comedi: me4000: tidy up ME4000_AI_CHANNEL_LIST_REG bit defines Use the BIT() macro to define the bits of this register. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 5b798a63589b..39dbdafdc953 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -110,9 +110,9 @@ broken. #define ME4000_AI_STATUS_BIT_FSM (1 << 29) #define ME4000_AI_CTRL_BIT_EX_TRIG_BOTH (1 << 31) #define ME4000_AI_CHANNEL_LIST_REG 0x78 -#define ME4000_AI_LIST_INPUT_DIFFERENTIAL (1 << 5) +#define ME4000_AI_LIST_INPUT_DIFFERENTIAL BIT(5) #define ME4000_AI_LIST_RANGE(x) ((3 - ((x) & 3)) << 6) -#define ME4000_AI_LIST_LAST_ENTRY (1 << 8) +#define ME4000_AI_LIST_LAST_ENTRY BIT(8) #define ME4000_AI_DATA_REG 0x7c #define ME4000_AI_CHAN_TIMER_REG 0x80 #define ME4000_AI_CHAN_PRE_TIMER_REG 0x84 From 023c129f0a90edf1a9cf2c7ba9086f029f56d488 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:54 -0700 Subject: [PATCH 660/912] staging: comedi: me4000: use comedi_timeout() to wait for ai (*insn_read) Use the comedi_timeout() helper to busy-wait for the analog input end-of- conversion instead of the udelay(). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 27 +++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 39dbdafdc953..4231e393c577 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -433,9 +433,18 @@ static void me4000_reset(struct comedi_device *dev) outl(0x1, dev->iobase + ME4000_DIO_CTRL_REG); } -/*============================================================================= - Analog input section - ===========================================================================*/ +static int me4000_ai_eoc(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned long context) +{ + unsigned int status; + + status = inl(dev->iobase + ME4000_AI_STATUS_REG); + if (status & ME4000_AI_STATUS_BIT_EF_DATA) + return 0; + return -EBUSY; +} static int me4000_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, @@ -445,10 +454,10 @@ static int me4000_ai_insn_read(struct comedi_device *dev, int chan = CR_CHAN(insn->chanspec); int rang = CR_RANGE(insn->chanspec); int aref = CR_AREF(insn->chanspec); - unsigned int entry = 0; unsigned int tmp; unsigned int lval; + int ret; if (insn->n == 0) { return 0; @@ -509,13 +518,9 @@ static int me4000_ai_insn_read(struct comedi_device *dev, /* Start conversion by dummy read */ inl(dev->iobase + ME4000_AI_START_REG); - /* Wait until ready */ - udelay(10); - if (!(inl(dev->iobase + ME4000_AI_STATUS_REG) & - ME4000_AI_STATUS_BIT_EF_DATA)) { - dev_err(dev->class_dev, "Value not available after wait\n"); - return -EIO; - } + ret = comedi_timeout(dev, s, insn, me4000_ai_eoc, 0); + if (ret) + return ret; /* Read value from data fifo */ lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; From fb7891e48fc2eac16f615e81df06b7510981ef73 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:55 -0700 Subject: [PATCH 661/912] staging: comedi: me4000: fix me4000_ai_insn_read() The coemdi (*insn_read) functions are supposed to read insn->n values from the hardware. Make this function work like the core expects. Use the comedi_offset_munge() helper to munge the two's complement values to offset binary. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 32 +++++++++++-------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 4231e393c577..c15e731db6c0 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -456,16 +456,8 @@ static int me4000_ai_insn_read(struct comedi_device *dev, int aref = CR_AREF(insn->chanspec); unsigned int entry = 0; unsigned int tmp; - unsigned int lval; int ret; - - if (insn->n == 0) { - return 0; - } else if (insn->n > 1) { - dev_err(dev->class_dev, "Invalid instruction length %d\n", - insn->n); - return -EINVAL; - } + int i; entry |= ME4000_AI_LIST_RANGE(rang); entry |= chan; @@ -515,18 +507,22 @@ static int me4000_ai_insn_read(struct comedi_device *dev, outl(ME4000_AI_MIN_TICKS, dev->iobase + ME4000_AI_CHAN_TIMER_REG); outl(ME4000_AI_MIN_TICKS, dev->iobase + ME4000_AI_CHAN_PRE_TIMER_REG); - /* Start conversion by dummy read */ - inl(dev->iobase + ME4000_AI_START_REG); + for (i = 0; i < insn->n; i++) { + unsigned int val; - ret = comedi_timeout(dev, s, insn, me4000_ai_eoc, 0); - if (ret) - return ret; + /* start conversion by dummy read */ + inl(dev->iobase + ME4000_AI_START_REG); - /* Read value from data fifo */ - lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; - data[0] = lval ^ 0x8000; + ret = comedi_timeout(dev, s, insn, me4000_ai_eoc, 0); + if (ret) + return ret; - return 1; + /* read two's complement value and munge to offset binary */ + val = inl(dev->iobase + ME4000_AI_DATA_REG); + data[i] = comedi_offset_munge(s, val); + } + + return insn->n; } static int me4000_ai_cancel(struct comedi_device *dev, From 959717a3f67a7b7ce0bded0ec7d0e7e2e74c786c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:56 -0700 Subject: [PATCH 662/912] staging: comedi: me4000: use correct types for extracted chanspec values The chanspec channel, range, and aref are unsigned int values. Use the correct types when extracting them. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index c15e731db6c0..c7136c572a8a 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -451,9 +451,9 @@ static int me4000_ai_insn_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - int chan = CR_CHAN(insn->chanspec); - int rang = CR_RANGE(insn->chanspec); - int aref = CR_AREF(insn->chanspec); + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int rang = CR_RANGE(insn->chanspec); + unsigned int aref = CR_AREF(insn->chanspec); unsigned int entry = 0; unsigned int tmp; int ret; @@ -1107,7 +1107,7 @@ static int me4000_ao_insn_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - int chan = CR_CHAN(insn->chanspec); + unsigned int chan = CR_CHAN(insn->chanspec); unsigned int tmp; /* Stop any running conversion */ From e978426116ba68069b8dd1a6492ec8a958f27218 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:57 -0700 Subject: [PATCH 663/912] staging: comedi: me4000: use comedi_range_is_bipolar() in ai (*insn_read) Use the helper function to check the range type instead of relying on the value. For aesthetics, rename the local variable used for the range. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index c7136c572a8a..c5a677a3d0da 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -452,15 +452,14 @@ static int me4000_ai_insn_read(struct comedi_device *dev, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int rang = CR_RANGE(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); unsigned int aref = CR_AREF(insn->chanspec); - unsigned int entry = 0; + unsigned int entry; unsigned int tmp; int ret; int i; - entry |= ME4000_AI_LIST_RANGE(rang); - entry |= chan; + entry = chan | ME4000_AI_LIST_RANGE(range); if (aref == AREF_DIFF) { if (!(s->subdev_flags && SDF_DIFF)) { dev_err(dev->class_dev, @@ -468,7 +467,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev, return -EINVAL; } - if (rang == 0 || rang == 1) { + if (!comedi_range_is_bipolar(s, range)) { dev_err(dev->class_dev, "Range must be bipolar when aref = diff\n"); return -EINVAL; From a9b586a52a97ca537882a879de583002d74d9e27 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:58 -0700 Subject: [PATCH 664/912] staging: comedi: me4000: tidy up ME4000_AI_STATUS_REG bit defines Use the BIT() marco to define the bits of this register. For aesthetics, rename all the defines to remove the '_BIT' from the name. Also, use ME4000_AI_STATUS_REG instead of ME4000_AI_CTRL_REG when reading the register (they happen to be the same). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index c5a677a3d0da..e31efa473f00 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -100,14 +100,14 @@ broken. #define ME4000_AI_CTRL_BIT_SC_IRQ (1 << 19) #define ME4000_AI_CTRL_BIT_SC_IRQ_RESET (1 << 20) #define ME4000_AI_CTRL_BIT_SC_RELOAD (1 << 21) -#define ME4000_AI_STATUS_BIT_EF_CHANNEL (1 << 22) -#define ME4000_AI_STATUS_BIT_HF_CHANNEL (1 << 23) -#define ME4000_AI_STATUS_BIT_FF_CHANNEL (1 << 24) -#define ME4000_AI_STATUS_BIT_EF_DATA (1 << 25) -#define ME4000_AI_STATUS_BIT_HF_DATA (1 << 26) -#define ME4000_AI_STATUS_BIT_FF_DATA (1 << 27) -#define ME4000_AI_STATUS_BIT_LE (1 << 28) -#define ME4000_AI_STATUS_BIT_FSM (1 << 29) +#define ME4000_AI_STATUS_EF_CHANNEL BIT(22) +#define ME4000_AI_STATUS_HF_CHANNEL BIT(23) +#define ME4000_AI_STATUS_FF_CHANNEL BIT(24) +#define ME4000_AI_STATUS_EF_DATA BIT(25) +#define ME4000_AI_STATUS_HF_DATA BIT(26) +#define ME4000_AI_STATUS_FF_DATA BIT(27) +#define ME4000_AI_STATUS_LE BIT(28) +#define ME4000_AI_STATUS_FSM BIT(29) #define ME4000_AI_CTRL_BIT_EX_TRIG_BOTH (1 << 31) #define ME4000_AI_CHANNEL_LIST_REG 0x78 #define ME4000_AI_LIST_INPUT_DIFFERENTIAL BIT(5) @@ -441,7 +441,7 @@ static int me4000_ai_eoc(struct comedi_device *dev, unsigned int status; status = inl(dev->iobase + ME4000_AI_STATUS_REG); - if (status & ME4000_AI_STATUS_BIT_EF_DATA) + if (status & ME4000_AI_STATUS_EF_DATA) return 0; return -EBUSY; } @@ -998,11 +998,11 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & ME4000_IRQ_STATUS_BIT_AI_HF) { /* Read status register to find out what happened */ - tmp = inl(dev->iobase + ME4000_AI_CTRL_REG); + tmp = inl(dev->iobase + ME4000_AI_STATUS_REG); - if (!(tmp & ME4000_AI_STATUS_BIT_FF_DATA) && - !(tmp & ME4000_AI_STATUS_BIT_HF_DATA) && - (tmp & ME4000_AI_STATUS_BIT_EF_DATA)) { + if (!(tmp & ME4000_AI_STATUS_FF_DATA) && + !(tmp & ME4000_AI_STATUS_HF_DATA) && + (tmp & ME4000_AI_STATUS_EF_DATA)) { c = ME4000_AI_FIFO_COUNT; /* @@ -1017,9 +1017,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) s->async->events |= COMEDI_CB_ERROR; dev_err(dev->class_dev, "FIFO overflow\n"); - } else if ((tmp & ME4000_AI_STATUS_BIT_FF_DATA) - && !(tmp & ME4000_AI_STATUS_BIT_HF_DATA) - && (tmp & ME4000_AI_STATUS_BIT_EF_DATA)) { + } else if ((tmp & ME4000_AI_STATUS_FF_DATA) && + !(tmp & ME4000_AI_STATUS_HF_DATA) && + (tmp & ME4000_AI_STATUS_EF_DATA)) { c = ME4000_AI_FIFO_COUNT / 2; } else { dev_err(dev->class_dev, @@ -1079,8 +1079,8 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); /* Poll data until fifo empty */ - while (inl(dev->iobase + ME4000_AI_CTRL_REG) & - ME4000_AI_STATUS_BIT_EF_DATA) { + while (inl(dev->iobase + ME4000_AI_STATUS_REG) & + ME4000_AI_STATUS_EF_DATA) { /* Read value from data fifo */ lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; lval ^= 0x8000; From da772ad9a83ef3db24be12f355a4a90a21c1f209 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:44:59 -0700 Subject: [PATCH 665/912] staging: comedi: me4000: tidy up ME4000_AI_CTRL_REG bit defines Use the BIT() marco to define the bits of this register. For aesthetics, rename all the defines to remove the '_BIT' from the name. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 123 ++++++++++++------------ 1 file changed, 61 insertions(+), 62 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index e31efa473f00..b54f1deb7089 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -78,28 +78,28 @@ broken. #define ME4000_AO_TIMER_REG(x) (0x10 + ME4000_AO_CHAN(x)) #define ME4000_AI_CTRL_REG 0x74 #define ME4000_AI_STATUS_REG 0x74 -#define ME4000_AI_CTRL_BIT_MODE_0 (1 << 0) -#define ME4000_AI_CTRL_BIT_MODE_1 (1 << 1) -#define ME4000_AI_CTRL_BIT_MODE_2 (1 << 2) -#define ME4000_AI_CTRL_BIT_SAMPLE_HOLD (1 << 3) -#define ME4000_AI_CTRL_BIT_IMMEDIATE_STOP (1 << 4) -#define ME4000_AI_CTRL_BIT_STOP (1 << 5) -#define ME4000_AI_CTRL_BIT_CHANNEL_FIFO (1 << 6) -#define ME4000_AI_CTRL_BIT_DATA_FIFO (1 << 7) -#define ME4000_AI_CTRL_BIT_FULLSCALE (1 << 8) -#define ME4000_AI_CTRL_BIT_OFFSET (1 << 9) -#define ME4000_AI_CTRL_BIT_EX_TRIG_ANALOG (1 << 10) -#define ME4000_AI_CTRL_BIT_EX_TRIG (1 << 11) -#define ME4000_AI_CTRL_BIT_EX_TRIG_FALLING (1 << 12) -#define ME4000_AI_CTRL_BIT_EX_IRQ (1 << 13) -#define ME4000_AI_CTRL_BIT_EX_IRQ_RESET (1 << 14) -#define ME4000_AI_CTRL_BIT_LE_IRQ (1 << 15) -#define ME4000_AI_CTRL_BIT_LE_IRQ_RESET (1 << 16) -#define ME4000_AI_CTRL_BIT_HF_IRQ (1 << 17) -#define ME4000_AI_CTRL_BIT_HF_IRQ_RESET (1 << 18) -#define ME4000_AI_CTRL_BIT_SC_IRQ (1 << 19) -#define ME4000_AI_CTRL_BIT_SC_IRQ_RESET (1 << 20) -#define ME4000_AI_CTRL_BIT_SC_RELOAD (1 << 21) +#define ME4000_AI_CTRL_MODE_0 BIT(0) +#define ME4000_AI_CTRL_MODE_1 BIT(1) +#define ME4000_AI_CTRL_MODE_2 BIT(2) +#define ME4000_AI_CTRL_SAMPLE_HOLD BIT(3) +#define ME4000_AI_CTRL_IMMEDIATE_STOP BIT(4) +#define ME4000_AI_CTRL_STOP BIT(5) +#define ME4000_AI_CTRL_CHANNEL_FIFO BIT(6) +#define ME4000_AI_CTRL_DATA_FIFO BIT(7) +#define ME4000_AI_CTRL_FULLSCALE BIT(8) +#define ME4000_AI_CTRL_OFFSET BIT(9) +#define ME4000_AI_CTRL_EX_TRIG_ANALOG BIT(10) +#define ME4000_AI_CTRL_EX_TRIG BIT(11) +#define ME4000_AI_CTRL_EX_TRIG_FALLING BIT(12) +#define ME4000_AI_CTRL_EX_IRQ BIT(13) +#define ME4000_AI_CTRL_EX_IRQ_RESET BIT(14) +#define ME4000_AI_CTRL_LE_IRQ BIT(15) +#define ME4000_AI_CTRL_LE_IRQ_RESET BIT(16) +#define ME4000_AI_CTRL_HF_IRQ BIT(17) +#define ME4000_AI_CTRL_HF_IRQ_RESET BIT(18) +#define ME4000_AI_CTRL_SC_IRQ BIT(19) +#define ME4000_AI_CTRL_SC_IRQ_RESET BIT(20) +#define ME4000_AI_CTRL_SC_RELOAD BIT(21) #define ME4000_AI_STATUS_EF_CHANNEL BIT(22) #define ME4000_AI_STATUS_HF_CHANNEL BIT(23) #define ME4000_AI_STATUS_FF_CHANNEL BIT(24) @@ -108,7 +108,7 @@ broken. #define ME4000_AI_STATUS_FF_DATA BIT(27) #define ME4000_AI_STATUS_LE BIT(28) #define ME4000_AI_STATUS_FSM BIT(29) -#define ME4000_AI_CTRL_BIT_EX_TRIG_BOTH (1 << 31) +#define ME4000_AI_CTRL_EX_TRIG_BOTH BIT(31) #define ME4000_AI_CHANNEL_LIST_REG 0x78 #define ME4000_AI_LIST_INPUT_DIFFERENTIAL BIT(5) #define ME4000_AI_LIST_RANGE(x) ((3 - ((x) & 3)) << 6) @@ -408,7 +408,7 @@ static void me4000_reset(struct comedi_device *dev) outl(0x8000, dev->iobase + ME4000_AO_SINGLE_REG(chan)); /* Set both stop bits in the analog input control register */ - outl(ME4000_AI_CTRL_BIT_IMMEDIATE_STOP | ME4000_AI_CTRL_BIT_STOP, + outl(ME4000_AI_CTRL_IMMEDIATE_STOP | ME4000_AI_CTRL_STOP, dev->iobase + ME4000_AI_CTRL_REG); /* Set both stop bits in the analog output control register */ @@ -485,18 +485,17 @@ static int me4000_ai_insn_read(struct comedi_device *dev, /* Clear channel list, data fifo and both stop bits */ tmp = inl(dev->iobase + ME4000_AI_CTRL_REG); - tmp &= ~(ME4000_AI_CTRL_BIT_CHANNEL_FIFO | - ME4000_AI_CTRL_BIT_DATA_FIFO | - ME4000_AI_CTRL_BIT_STOP | ME4000_AI_CTRL_BIT_IMMEDIATE_STOP); + tmp &= ~(ME4000_AI_CTRL_CHANNEL_FIFO | ME4000_AI_CTRL_DATA_FIFO | + ME4000_AI_CTRL_STOP | ME4000_AI_CTRL_IMMEDIATE_STOP); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); /* Set the acquisition mode to single */ - tmp &= ~(ME4000_AI_CTRL_BIT_MODE_0 | ME4000_AI_CTRL_BIT_MODE_1 | - ME4000_AI_CTRL_BIT_MODE_2); + tmp &= ~(ME4000_AI_CTRL_MODE_0 | ME4000_AI_CTRL_MODE_1 | + ME4000_AI_CTRL_MODE_2); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); /* Enable channel list and data fifo */ - tmp |= ME4000_AI_CTRL_BIT_CHANNEL_FIFO | ME4000_AI_CTRL_BIT_DATA_FIFO; + tmp |= ME4000_AI_CTRL_CHANNEL_FIFO | ME4000_AI_CTRL_DATA_FIFO; outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); /* Generate channel list entry */ @@ -531,7 +530,7 @@ static int me4000_ai_cancel(struct comedi_device *dev, /* Stop any running conversion */ tmp = inl(dev->iobase + ME4000_AI_CTRL_REG); - tmp &= ~(ME4000_AI_CTRL_BIT_STOP | ME4000_AI_CTRL_BIT_IMMEDIATE_STOP); + tmp &= ~(ME4000_AI_CTRL_STOP | ME4000_AI_CTRL_IMMEDIATE_STOP); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); /* Clear the control register */ @@ -699,40 +698,40 @@ static int ai_prepare(struct comedi_device *dev, (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_TIMER)) { - tmp = ME4000_AI_CTRL_BIT_MODE_1 | - ME4000_AI_CTRL_BIT_CHANNEL_FIFO | - ME4000_AI_CTRL_BIT_DATA_FIFO; + tmp = ME4000_AI_CTRL_MODE_1 | + ME4000_AI_CTRL_CHANNEL_FIFO | + ME4000_AI_CTRL_DATA_FIFO; } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_TIMER) { - tmp = ME4000_AI_CTRL_BIT_MODE_2 | - ME4000_AI_CTRL_BIT_CHANNEL_FIFO | - ME4000_AI_CTRL_BIT_DATA_FIFO; + tmp = ME4000_AI_CTRL_MODE_2 | + ME4000_AI_CTRL_CHANNEL_FIFO | + ME4000_AI_CTRL_DATA_FIFO; } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_EXT) { - tmp = ME4000_AI_CTRL_BIT_MODE_0 | - ME4000_AI_CTRL_BIT_MODE_1 | - ME4000_AI_CTRL_BIT_CHANNEL_FIFO | - ME4000_AI_CTRL_BIT_DATA_FIFO; + tmp = ME4000_AI_CTRL_MODE_0 | + ME4000_AI_CTRL_MODE_1 | + ME4000_AI_CTRL_CHANNEL_FIFO | + ME4000_AI_CTRL_DATA_FIFO; } else { - tmp = ME4000_AI_CTRL_BIT_MODE_0 | - ME4000_AI_CTRL_BIT_CHANNEL_FIFO | - ME4000_AI_CTRL_BIT_DATA_FIFO; + tmp = ME4000_AI_CTRL_MODE_0 | + ME4000_AI_CTRL_CHANNEL_FIFO | + ME4000_AI_CTRL_DATA_FIFO; } /* Stop triggers */ if (cmd->stop_src == TRIG_COUNT) { outl(cmd->chanlist_len * cmd->stop_arg, dev->iobase + ME4000_AI_SAMPLE_COUNTER_REG); - tmp |= ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ; + tmp |= ME4000_AI_CTRL_HF_IRQ | ME4000_AI_CTRL_SC_IRQ; } else if (cmd->stop_src == TRIG_NONE && cmd->scan_end_src == TRIG_COUNT) { outl(cmd->scan_end_arg, dev->iobase + ME4000_AI_SAMPLE_COUNTER_REG); - tmp |= ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ; + tmp |= ME4000_AI_CTRL_HF_IRQ | ME4000_AI_CTRL_SC_IRQ; } else { - tmp |= ME4000_AI_CTRL_BIT_HF_IRQ; + tmp |= ME4000_AI_CTRL_HF_IRQ; } /* Write the setup to the control register */ @@ -1009,9 +1008,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) * FIFO overflow, so stop conversion * and disable all interrupts */ - tmp |= ME4000_AI_CTRL_BIT_IMMEDIATE_STOP; - tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | - ME4000_AI_CTRL_BIT_SC_IRQ); + tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP; + tmp &= ~(ME4000_AI_CTRL_HF_IRQ | + ME4000_AI_CTRL_SC_IRQ); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); s->async->events |= COMEDI_CB_ERROR; @@ -1030,9 +1029,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) * Undefined state, so stop conversion * and disable all interrupts */ - tmp |= ME4000_AI_CTRL_BIT_IMMEDIATE_STOP; - tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | - ME4000_AI_CTRL_BIT_SC_IRQ); + tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP; + tmp &= ~(ME4000_AI_CTRL_HF_IRQ | + ME4000_AI_CTRL_SC_IRQ); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); s->async->events |= COMEDI_CB_ERROR; @@ -1050,18 +1049,18 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) * Buffer overflow, so stop conversion * and disable all interrupts */ - tmp |= ME4000_AI_CTRL_BIT_IMMEDIATE_STOP; - tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | - ME4000_AI_CTRL_BIT_SC_IRQ); + tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP; + tmp &= ~(ME4000_AI_CTRL_HF_IRQ | + ME4000_AI_CTRL_SC_IRQ); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); break; } } /* Work is done, so reset the interrupt */ - tmp |= ME4000_AI_CTRL_BIT_HF_IRQ_RESET; + tmp |= ME4000_AI_CTRL_HF_IRQ_RESET; outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); - tmp &= ~ME4000_AI_CTRL_BIT_HF_IRQ_RESET; + tmp &= ~ME4000_AI_CTRL_HF_IRQ_RESET; outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); } @@ -1074,8 +1073,8 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) * conversion and disable all interrupts */ tmp = inl(dev->iobase + ME4000_AI_CTRL_REG); - tmp |= ME4000_AI_CTRL_BIT_IMMEDIATE_STOP; - tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ); + tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP; + tmp &= ~(ME4000_AI_CTRL_HF_IRQ | ME4000_AI_CTRL_SC_IRQ); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); /* Poll data until fifo empty */ @@ -1090,9 +1089,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) } /* Work is done, so reset the interrupt */ - tmp |= ME4000_AI_CTRL_BIT_SC_IRQ_RESET; + tmp |= ME4000_AI_CTRL_SC_IRQ_RESET; outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); - tmp &= ~ME4000_AI_CTRL_BIT_SC_IRQ_RESET; + tmp &= ~ME4000_AI_CTRL_SC_IRQ_RESET; outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); } From 2ec0019a2f7605aad91b7684ca404757446ea1ad Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:00 -0700 Subject: [PATCH 666/912] staging: comedi: me4000: tidy up ME4000_IRQ_STATUS_REG bit defines Use the BIT() marco to define the bits of this register. For aesthetics, rename all the defines to remove the '_BIT' from the name. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index b54f1deb7089..e6e1d636cd49 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -122,14 +122,14 @@ broken. #define ME4000_AI_SCAN_PRE_TIMER_HIGH_REG 0x94 #define ME4000_AI_START_REG 0x98 #define ME4000_IRQ_STATUS_REG 0x9c -#define ME4000_IRQ_STATUS_BIT_EX (1 << 0) -#define ME4000_IRQ_STATUS_BIT_LE (1 << 1) -#define ME4000_IRQ_STATUS_BIT_AI_HF (1 << 2) -#define ME4000_IRQ_STATUS_BIT_AO_0_HF (1 << 3) -#define ME4000_IRQ_STATUS_BIT_AO_1_HF (1 << 4) -#define ME4000_IRQ_STATUS_BIT_AO_2_HF (1 << 5) -#define ME4000_IRQ_STATUS_BIT_AO_3_HF (1 << 6) -#define ME4000_IRQ_STATUS_BIT_SC (1 << 7) +#define ME4000_IRQ_STATUS_EX BIT(0) +#define ME4000_IRQ_STATUS_LE BIT(1) +#define ME4000_IRQ_STATUS_AI_HF BIT(2) +#define ME4000_IRQ_STATUS_AO_0_HF BIT(3) +#define ME4000_IRQ_STATUS_AO_1_HF BIT(4) +#define ME4000_IRQ_STATUS_AO_2_HF BIT(5) +#define ME4000_IRQ_STATUS_AO_3_HF BIT(6) +#define ME4000_IRQ_STATUS_SC BIT(7) #define ME4000_DIO_PORT_0_REG 0xa0 #define ME4000_DIO_PORT_1_REG 0xa4 #define ME4000_DIO_PORT_2_REG 0xa8 @@ -995,7 +995,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) return IRQ_NONE; if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & - ME4000_IRQ_STATUS_BIT_AI_HF) { + ME4000_IRQ_STATUS_AI_HF) { /* Read status register to find out what happened */ tmp = inl(dev->iobase + ME4000_AI_STATUS_REG); @@ -1065,7 +1065,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) } if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & - ME4000_IRQ_STATUS_BIT_SC) { + ME4000_IRQ_STATUS_SC) { s->async->events |= COMEDI_CB_EOA; /* From 4831748e7001b998adc209241f2d1fe9cd5c55c8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:01 -0700 Subject: [PATCH 667/912] staging: comedi: me4000: tidy up ME4000_AO_STATUS_REG bit defines Use the BIT() marco to define the bits of this register. For aesthetics, rename all the defines to remove the '_BIT' from the name. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index e6e1d636cd49..a38ad886d802 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -69,10 +69,10 @@ broken. #define ME4000_AO_CTRL_BIT_ENABLE_IRQ (1 << 9) #define ME4000_AO_CTRL_BIT_RESET_IRQ (1 << 10) #define ME4000_AO_STATUS_REG(x) (0x04 + ME4000_AO_CHAN(x)) -#define ME4000_AO_STATUS_BIT_FSM (1 << 0) -#define ME4000_AO_STATUS_BIT_FF (1 << 1) -#define ME4000_AO_STATUS_BIT_HF (1 << 2) -#define ME4000_AO_STATUS_BIT_EF (1 << 3) +#define ME4000_AO_STATUS_FSM BIT(0) +#define ME4000_AO_STATUS_FF BIT(1) +#define ME4000_AO_STATUS_HF BIT(2) +#define ME4000_AO_STATUS_EF BIT(3) #define ME4000_AO_FIFO_REG(x) (0x08 + ME4000_AO_CHAN(x)) #define ME4000_AO_SINGLE_REG(x) (0x0c + ME4000_AO_CHAN(x)) #define ME4000_AO_TIMER_REG(x) (0x10 + ME4000_AO_CHAN(x)) From 7e92a5eba35e801c2af07814d400858e8f290cb9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:02 -0700 Subject: [PATCH 668/912] staging: comedi: me4000: tidy up ME4000_AO_CTRL_REG bit defines Use the BIT() marco to define the bits of this register. For aesthetics, rename all the defines to remove the '_BIT' from the name. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index a38ad886d802..a40b3017183f 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -57,17 +57,16 @@ broken. #define ME4000_AO_CHAN(x) ((x) * 0x18) #define ME4000_AO_CTRL_REG(x) (0x00 + ME4000_AO_CHAN(x)) -#define ME4000_AO_CTRL_BIT_MODE_0 (1 << 0) -#define ME4000_AO_CTRL_BIT_MODE_1 (1 << 1) -#define ME4000_AO_CTRL_MASK_MODE (3 << 0) -#define ME4000_AO_CTRL_BIT_STOP (1 << 2) -#define ME4000_AO_CTRL_BIT_ENABLE_FIFO (1 << 3) -#define ME4000_AO_CTRL_BIT_ENABLE_EX_TRIG (1 << 4) -#define ME4000_AO_CTRL_BIT_EX_TRIG_EDGE (1 << 5) -#define ME4000_AO_CTRL_BIT_IMMEDIATE_STOP (1 << 7) -#define ME4000_AO_CTRL_BIT_ENABLE_DO (1 << 8) -#define ME4000_AO_CTRL_BIT_ENABLE_IRQ (1 << 9) -#define ME4000_AO_CTRL_BIT_RESET_IRQ (1 << 10) +#define ME4000_AO_CTRL_MODE_0 BIT(0) +#define ME4000_AO_CTRL_MODE_1 BIT(1) +#define ME4000_AO_CTRL_STOP BIT(2) +#define ME4000_AO_CTRL_ENABLE_FIFO BIT(3) +#define ME4000_AO_CTRL_ENABLE_EX_TRIG BIT(4) +#define ME4000_AO_CTRL_EX_TRIG_EDGE BIT(5) +#define ME4000_AO_CTRL_IMMEDIATE_STOP BIT(7) +#define ME4000_AO_CTRL_ENABLE_DO BIT(8) +#define ME4000_AO_CTRL_ENABLE_IRQ BIT(9) +#define ME4000_AO_CTRL_RESET_IRQ BIT(10) #define ME4000_AO_STATUS_REG(x) (0x04 + ME4000_AO_CHAN(x)) #define ME4000_AO_STATUS_FSM BIT(0) #define ME4000_AO_STATUS_FF BIT(1) @@ -412,7 +411,7 @@ static void me4000_reset(struct comedi_device *dev) dev->iobase + ME4000_AI_CTRL_REG); /* Set both stop bits in the analog output control register */ - val = ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP; + val = ME4000_AO_CTRL_IMMEDIATE_STOP | ME4000_AO_CTRL_STOP; for (chan = 0; chan < 4; chan++) outl(val, dev->iobase + ME4000_AO_CTRL_REG(chan)); @@ -1110,7 +1109,7 @@ static int me4000_ao_insn_write(struct comedi_device *dev, /* Stop any running conversion */ tmp = inl(dev->iobase + ME4000_AO_CTRL_REG(chan)); - tmp |= ME4000_AO_CTRL_BIT_IMMEDIATE_STOP; + tmp |= ME4000_AO_CTRL_IMMEDIATE_STOP; outl(tmp, dev->iobase + ME4000_AO_CTRL_REG(chan)); /* Clear control register and set to single mode */ From 55fb972ee8881e665c9251fa6cb806ab6e1bcadc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:03 -0700 Subject: [PATCH 669/912] staging: comedi: me4000: tidy up ME4000_DIO_CTRL_REG bit defines Use the BIT() marco to define the bits of this register. For aesthetics, rename all the defines to remove the '_BIT' from the name. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 51 ++++++++++++------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index a40b3017183f..97c243fbaba0 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -136,20 +136,20 @@ broken. #define ME4000_DIO_DIR_REG 0xb0 #define ME4000_AO_LOADSETREG_XX 0xb4 #define ME4000_DIO_CTRL_REG 0xb8 -#define ME4000_DIO_CTRL_BIT_MODE_0 (1 << 0) -#define ME4000_DIO_CTRL_BIT_MODE_1 (1 << 1) -#define ME4000_DIO_CTRL_BIT_MODE_2 (1 << 2) -#define ME4000_DIO_CTRL_BIT_MODE_3 (1 << 3) -#define ME4000_DIO_CTRL_BIT_MODE_4 (1 << 4) -#define ME4000_DIO_CTRL_BIT_MODE_5 (1 << 5) -#define ME4000_DIO_CTRL_BIT_MODE_6 (1 << 6) -#define ME4000_DIO_CTRL_BIT_MODE_7 (1 << 7) -#define ME4000_DIO_CTRL_BIT_FUNCTION_0 (1 << 8) -#define ME4000_DIO_CTRL_BIT_FUNCTION_1 (1 << 9) -#define ME4000_DIO_CTRL_BIT_FIFO_HIGH_0 (1 << 10) -#define ME4000_DIO_CTRL_BIT_FIFO_HIGH_1 (1 << 11) -#define ME4000_DIO_CTRL_BIT_FIFO_HIGH_2 (1 << 12) -#define ME4000_DIO_CTRL_BIT_FIFO_HIGH_3 (1 << 13) +#define ME4000_DIO_CTRL_MODE_0 BIT(0) +#define ME4000_DIO_CTRL_MODE_1 BIT(1) +#define ME4000_DIO_CTRL_MODE_2 BIT(2) +#define ME4000_DIO_CTRL_MODE_3 BIT(3) +#define ME4000_DIO_CTRL_MODE_4 BIT(4) +#define ME4000_DIO_CTRL_MODE_5 BIT(5) +#define ME4000_DIO_CTRL_MODE_6 BIT(6) +#define ME4000_DIO_CTRL_MODE_7 BIT(7) +#define ME4000_DIO_CTRL_FUNCTION_0 BIT(8) +#define ME4000_DIO_CTRL_FUNCTION_1 BIT(9) +#define ME4000_DIO_CTRL_FIFO_HIGH_0 BIT(10) +#define ME4000_DIO_CTRL_FIFO_HIGH_1 BIT(11) +#define ME4000_DIO_CTRL_FIFO_HIGH_2 BIT(12) +#define ME4000_DIO_CTRL_FIFO_HIGH_3 BIT(13) #define ME4000_AO_DEMUX_ADJUST_REG 0xbc #define ME4000_AO_DEMUX_ADJUST_VALUE 0x4c #define ME4000_AI_SAMPLE_COUNTER_REG 0xc0 @@ -1172,18 +1172,18 @@ static int me4000_dio_insn_config(struct comedi_device *dev, return ret; tmp = inl(dev->iobase + ME4000_DIO_CTRL_REG); - tmp &= ~(ME4000_DIO_CTRL_BIT_MODE_0 | ME4000_DIO_CTRL_BIT_MODE_1 | - ME4000_DIO_CTRL_BIT_MODE_2 | ME4000_DIO_CTRL_BIT_MODE_3 | - ME4000_DIO_CTRL_BIT_MODE_4 | ME4000_DIO_CTRL_BIT_MODE_5 | - ME4000_DIO_CTRL_BIT_MODE_6 | ME4000_DIO_CTRL_BIT_MODE_7); + tmp &= ~(ME4000_DIO_CTRL_MODE_0 | ME4000_DIO_CTRL_MODE_1 | + ME4000_DIO_CTRL_MODE_2 | ME4000_DIO_CTRL_MODE_3 | + ME4000_DIO_CTRL_MODE_4 | ME4000_DIO_CTRL_MODE_5 | + ME4000_DIO_CTRL_MODE_6 | ME4000_DIO_CTRL_MODE_7); if (s->io_bits & 0x000000ff) - tmp |= ME4000_DIO_CTRL_BIT_MODE_0; + tmp |= ME4000_DIO_CTRL_MODE_0; if (s->io_bits & 0x0000ff00) - tmp |= ME4000_DIO_CTRL_BIT_MODE_2; + tmp |= ME4000_DIO_CTRL_MODE_2; if (s->io_bits & 0x00ff0000) - tmp |= ME4000_DIO_CTRL_BIT_MODE_4; + tmp |= ME4000_DIO_CTRL_MODE_4; if (s->io_bits & 0xff000000) - tmp |= ME4000_DIO_CTRL_BIT_MODE_6; + tmp |= ME4000_DIO_CTRL_MODE_6; /* * Check for optoisolated ME-4000 version. @@ -1193,9 +1193,8 @@ static int me4000_dio_insn_config(struct comedi_device *dev, if (inl(dev->iobase + ME4000_DIO_DIR_REG)) { s->io_bits |= 0x000000ff; s->io_bits &= ~0x0000ff00; - tmp |= ME4000_DIO_CTRL_BIT_MODE_0; - tmp &= ~(ME4000_DIO_CTRL_BIT_MODE_2 | - ME4000_DIO_CTRL_BIT_MODE_3); + tmp |= ME4000_DIO_CTRL_MODE_0; + tmp &= ~(ME4000_DIO_CTRL_MODE_2 | ME4000_DIO_CTRL_MODE_3); } outl(tmp, dev->iobase + ME4000_DIO_CTRL_REG); @@ -1307,7 +1306,7 @@ static int me4000_auto_attach(struct comedi_device *dev, */ if (!inl(dev->iobase + ME4000_DIO_DIR_REG)) { s->io_bits |= 0xFF; - outl(ME4000_DIO_CTRL_BIT_MODE_0, + outl(ME4000_DIO_CTRL_MODE_0, dev->iobase + ME4000_DIO_DIR_REG); } From c72c4c6e3ab4e1a280ab21fd2a6063b4d37fd4ff Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:04 -0700 Subject: [PATCH 670/912] staging: comedi: me4000: return void from ai_round_cmd_args() This function always succeeds. Change the return type to void and remove the unnecessary error check in me4000_ai_do_cmd(). Move the function call in me4000_ai_do_cmd_test() from before Step 1 to Step 3 where the arguments are validated. There is no reason to get the values if the previous steps fail. Rename the function so it has namespace associated with the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 97c243fbaba0..cd7dbb6dd281 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -580,11 +580,12 @@ static int me4000_ai_check_chanlist(struct comedi_device *dev, return 0; } -static int ai_round_cmd_args(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd, - unsigned int *init_ticks, - unsigned int *scan_ticks, unsigned int *chan_ticks) +static void me4000_ai_round_cmd_args(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd, + unsigned int *init_ticks, + unsigned int *scan_ticks, + unsigned int *chan_ticks) { int rest; @@ -630,8 +631,6 @@ static int ai_round_cmd_args(struct comedi_device *dev, (*chan_ticks)++; } } - - return 0; } static void ai_write_timer(struct comedi_device *dev, @@ -757,10 +756,8 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, return err; /* Round the timer arguments */ - err = ai_round_cmd_args(dev, - s, cmd, &init_ticks, &scan_ticks, &chan_ticks); - if (err) - return err; + me4000_ai_round_cmd_args(dev, s, cmd, + &init_ticks, &scan_ticks, &chan_ticks); /* Prepare the AI for acquisition */ err = ai_prepare(dev, s, cmd, init_ticks, scan_ticks, chan_ticks); @@ -782,9 +779,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, unsigned int scan_ticks; int err = 0; - /* Round the timer arguments */ - ai_round_cmd_args(dev, s, cmd, &init_ticks, &scan_ticks, &chan_ticks); - /* Step 1 : check if triggers are trivially valid */ err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); @@ -842,6 +836,11 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, cmd->chanlist_len = 1; err |= -EINVAL; } + + /* Round the timer arguments */ + me4000_ai_round_cmd_args(dev, s, cmd, + &init_ticks, &scan_ticks, &chan_ticks); + if (init_ticks < 66) { cmd->start_arg = 2000; err |= -EINVAL; From 0f97f5c92d4dcd561df1c9c064243fedf328177b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:05 -0700 Subject: [PATCH 671/912] staging: comedi: me4000: move ai command timing values into private data The ai (*do_cmd_test) calls me4000_ai_round_cmd_args() to calculate the timing values needed to the command. The the command test passes, the core will then call the ai (*do_cmd) which then has to call me4000_ai_round_cmd_args() again in order to get the same values to pass to ai_prepare() in order to program the timing. Add members to the private data to allow the (*do_cmd_test) to calculate and save to values needed by ai_prepare(). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 109 +++++++++++------------- 1 file changed, 52 insertions(+), 57 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index cd7dbb6dd281..ebc4307bbf17 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -163,6 +163,9 @@ broken. struct me4000_private { unsigned long plx_regbase; + unsigned int ai_init_ticks; + unsigned int ai_scan_ticks; + unsigned int ai_chan_ticks; }; enum me4000_boardid { @@ -582,71 +585,73 @@ static int me4000_ai_check_chanlist(struct comedi_device *dev, static void me4000_ai_round_cmd_args(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd, - unsigned int *init_ticks, - unsigned int *scan_ticks, - unsigned int *chan_ticks) + struct comedi_cmd *cmd) { + struct me4000_private *devpriv = dev->private; int rest; - *init_ticks = 0; - *scan_ticks = 0; - *chan_ticks = 0; + devpriv->ai_init_ticks = 0; + devpriv->ai_scan_ticks = 0; + devpriv->ai_chan_ticks = 0; if (cmd->start_arg) { - *init_ticks = (cmd->start_arg * 33) / 1000; + devpriv->ai_init_ticks = (cmd->start_arg * 33) / 1000; rest = (cmd->start_arg * 33) % 1000; if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_NEAREST) { if (rest > 33) - (*init_ticks)++; + devpriv->ai_init_ticks++; } else if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_UP) { if (rest) - (*init_ticks)++; + devpriv->ai_init_ticks++; } } if (cmd->scan_begin_arg) { - *scan_ticks = (cmd->scan_begin_arg * 33) / 1000; + devpriv->ai_scan_ticks = (cmd->scan_begin_arg * 33) / 1000; rest = (cmd->scan_begin_arg * 33) % 1000; if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_NEAREST) { if (rest > 33) - (*scan_ticks)++; + devpriv->ai_scan_ticks++; } else if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_UP) { if (rest) - (*scan_ticks)++; + devpriv->ai_scan_ticks++; } } if (cmd->convert_arg) { - *chan_ticks = (cmd->convert_arg * 33) / 1000; + devpriv->ai_chan_ticks = (cmd->convert_arg * 33) / 1000; rest = (cmd->convert_arg * 33) % 1000; if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_NEAREST) { if (rest > 33) - (*chan_ticks)++; + devpriv->ai_chan_ticks++; } else if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_UP) { if (rest) - (*chan_ticks)++; + devpriv->ai_chan_ticks++; } } } -static void ai_write_timer(struct comedi_device *dev, - unsigned int init_ticks, - unsigned int scan_ticks, unsigned int chan_ticks) +static void ai_write_timer(struct comedi_device *dev) { - outl(init_ticks - 1, dev->iobase + ME4000_AI_SCAN_PRE_TIMER_LOW_REG); + struct me4000_private *devpriv = dev->private; + + outl(devpriv->ai_init_ticks - 1, + dev->iobase + ME4000_AI_SCAN_PRE_TIMER_LOW_REG); outl(0x0, dev->iobase + ME4000_AI_SCAN_PRE_TIMER_HIGH_REG); - if (scan_ticks) { - outl(scan_ticks - 1, dev->iobase + ME4000_AI_SCAN_TIMER_LOW_REG); + if (devpriv->ai_scan_ticks) { + outl(devpriv->ai_scan_ticks - 1, + dev->iobase + ME4000_AI_SCAN_TIMER_LOW_REG); outl(0x0, dev->iobase + ME4000_AI_SCAN_TIMER_HIGH_REG); } - outl(chan_ticks - 1, dev->iobase + ME4000_AI_CHAN_PRE_TIMER_REG); - outl(chan_ticks - 1, dev->iobase + ME4000_AI_CHAN_TIMER_REG); + outl(devpriv->ai_chan_ticks - 1, + dev->iobase + ME4000_AI_CHAN_PRE_TIMER_REG); + outl(devpriv->ai_chan_ticks - 1, + dev->iobase + ME4000_AI_CHAN_TIMER_REG); } static int me4000_ai_write_chanlist(struct comedi_device *dev, @@ -677,14 +682,12 @@ static int me4000_ai_write_chanlist(struct comedi_device *dev, static int ai_prepare(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd, - unsigned int init_ticks, - unsigned int scan_ticks, unsigned int chan_ticks) + struct comedi_cmd *cmd) { unsigned int tmp = 0; /* Write timer arguments */ - ai_write_timer(dev, init_ticks, scan_ticks, chan_ticks); + ai_write_timer(dev); /* Reset control register */ outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); @@ -745,9 +748,6 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { int err; - unsigned int init_ticks = 0; - unsigned int scan_ticks = 0; - unsigned int chan_ticks = 0; struct comedi_cmd *cmd = &s->async->cmd; /* Reset the analog input */ @@ -755,12 +755,8 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, if (err) return err; - /* Round the timer arguments */ - me4000_ai_round_cmd_args(dev, s, cmd, - &init_ticks, &scan_ticks, &chan_ticks); - /* Prepare the AI for acquisition */ - err = ai_prepare(dev, s, cmd, init_ticks, scan_ticks, chan_ticks); + err = ai_prepare(dev, s, cmd); if (err) return err; @@ -774,9 +770,7 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - unsigned int init_ticks; - unsigned int chan_ticks; - unsigned int scan_ticks; + struct me4000_private *devpriv = dev->private; int err = 0; /* Step 1 : check if triggers are trivially valid */ @@ -838,18 +832,17 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, } /* Round the timer arguments */ - me4000_ai_round_cmd_args(dev, s, cmd, - &init_ticks, &scan_ticks, &chan_ticks); + me4000_ai_round_cmd_args(dev, s, cmd); - if (init_ticks < 66) { + if (devpriv->ai_init_ticks < 66) { cmd->start_arg = 2000; err |= -EINVAL; } - if (scan_ticks && scan_ticks < 67) { + if (devpriv->ai_scan_ticks && devpriv->ai_scan_ticks < 67) { cmd->scan_begin_arg = 2031; err |= -EINVAL; } - if (chan_ticks < 66) { + if (devpriv->ai_chan_ticks < 66) { cmd->convert_arg = 2000; err |= -EINVAL; } @@ -869,17 +862,18 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, cmd->scan_begin_src == TRIG_TIMER && cmd->convert_src == TRIG_TIMER) { /* Check timer arguments */ - if (init_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); cmd->start_arg = 2000; /* 66 ticks at least */ err++; } - if (chan_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_chan_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid convert arg\n"); cmd->convert_arg = 2000; /* 66 ticks at least */ err++; } - if (scan_ticks <= cmd->chanlist_len * chan_ticks) { + if (devpriv->ai_scan_ticks <= + cmd->chanlist_len * devpriv->ai_chan_ticks) { dev_err(dev->class_dev, "Invalid scan end arg\n"); /* At least one tick more */ @@ -890,12 +884,12 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_TIMER) { /* Check timer arguments */ - if (init_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); cmd->start_arg = 2000; /* 66 ticks at least */ err++; } - if (chan_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_chan_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid convert arg\n"); cmd->convert_arg = 2000; /* 66 ticks at least */ err++; @@ -904,17 +898,18 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, cmd->scan_begin_src == TRIG_TIMER && cmd->convert_src == TRIG_TIMER) { /* Check timer arguments */ - if (init_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); cmd->start_arg = 2000; /* 66 ticks at least */ err++; } - if (chan_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_chan_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid convert arg\n"); cmd->convert_arg = 2000; /* 66 ticks at least */ err++; } - if (scan_ticks <= cmd->chanlist_len * chan_ticks) { + if (devpriv->ai_scan_ticks <= + cmd->chanlist_len * devpriv->ai_chan_ticks) { dev_err(dev->class_dev, "Invalid scan end arg\n"); /* At least one tick more */ @@ -925,12 +920,12 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_TIMER) { /* Check timer arguments */ - if (init_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); cmd->start_arg = 2000; /* 66 ticks at least */ err++; } - if (chan_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_chan_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid convert arg\n"); cmd->convert_arg = 2000; /* 66 ticks at least */ err++; @@ -939,12 +934,12 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_TIMER) { /* Check timer arguments */ - if (init_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); cmd->start_arg = 2000; /* 66 ticks at least */ err++; } - if (chan_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_chan_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid convert arg\n"); cmd->convert_arg = 2000; /* 66 ticks at least */ err++; @@ -953,7 +948,7 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_EXT) { /* Check timer arguments */ - if (init_ticks < ME4000_AI_MIN_TICKS) { + if (devpriv->ai_init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); cmd->start_arg = 2000; /* 66 ticks at least */ err++; From 272e426ebca118cf202e4cf43dddf65ff358e953 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:06 -0700 Subject: [PATCH 672/912] staging: comedi: me4000: simplify ai_prepare() The ai (*do_cmd_test) validates the trigger sources in Step 2b to ensure that they are compatible. Save the 'ai_ctrl_mode' that will be used in the private data so that ai_prepare(), which is called by the ai (*do_cmd), does not have to recheck the sources in order to figure it out. Also, tidy up the stop trigger checks so that the ME4000_AI_CTRL_HF_IRQ bit is set in the common code path. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 52 +++++++++---------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index ebc4307bbf17..60f62f3d434a 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -163,6 +163,7 @@ broken. struct me4000_private { unsigned long plx_regbase; + unsigned int ai_ctrl_mode; unsigned int ai_init_ticks; unsigned int ai_scan_ticks; unsigned int ai_chan_ticks; @@ -684,59 +685,35 @@ static int ai_prepare(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - unsigned int tmp = 0; + struct me4000_private *devpriv = dev->private; + unsigned int ctrl; /* Write timer arguments */ ai_write_timer(dev); /* Reset control register */ - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); + outl(0, dev->iobase + ME4000_AI_CTRL_REG); /* Start sources */ - if ((cmd->start_src == TRIG_EXT && - cmd->scan_begin_src == TRIG_TIMER && - cmd->convert_src == TRIG_TIMER) || - (cmd->start_src == TRIG_EXT && - cmd->scan_begin_src == TRIG_FOLLOW && - cmd->convert_src == TRIG_TIMER)) { - tmp = ME4000_AI_CTRL_MODE_1 | - ME4000_AI_CTRL_CHANNEL_FIFO | - ME4000_AI_CTRL_DATA_FIFO; - } else if (cmd->start_src == TRIG_EXT && - cmd->scan_begin_src == TRIG_EXT && - cmd->convert_src == TRIG_TIMER) { - tmp = ME4000_AI_CTRL_MODE_2 | - ME4000_AI_CTRL_CHANNEL_FIFO | - ME4000_AI_CTRL_DATA_FIFO; - } else if (cmd->start_src == TRIG_EXT && - cmd->scan_begin_src == TRIG_EXT && - cmd->convert_src == TRIG_EXT) { - tmp = ME4000_AI_CTRL_MODE_0 | - ME4000_AI_CTRL_MODE_1 | - ME4000_AI_CTRL_CHANNEL_FIFO | - ME4000_AI_CTRL_DATA_FIFO; - } else { - tmp = ME4000_AI_CTRL_MODE_0 | - ME4000_AI_CTRL_CHANNEL_FIFO | - ME4000_AI_CTRL_DATA_FIFO; - } + ctrl = devpriv->ai_ctrl_mode | + ME4000_AI_CTRL_CHANNEL_FIFO | + ME4000_AI_CTRL_DATA_FIFO; /* Stop triggers */ if (cmd->stop_src == TRIG_COUNT) { outl(cmd->chanlist_len * cmd->stop_arg, dev->iobase + ME4000_AI_SAMPLE_COUNTER_REG); - tmp |= ME4000_AI_CTRL_HF_IRQ | ME4000_AI_CTRL_SC_IRQ; + ctrl |= ME4000_AI_CTRL_SC_IRQ; } else if (cmd->stop_src == TRIG_NONE && cmd->scan_end_src == TRIG_COUNT) { outl(cmd->scan_end_arg, dev->iobase + ME4000_AI_SAMPLE_COUNTER_REG); - tmp |= ME4000_AI_CTRL_HF_IRQ | ME4000_AI_CTRL_SC_IRQ; - } else { - tmp |= ME4000_AI_CTRL_HF_IRQ; + ctrl |= ME4000_AI_CTRL_SC_IRQ; } + ctrl |= ME4000_AI_CTRL_HF_IRQ; /* Write the setup to the control register */ - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); + outl(ctrl, dev->iobase + ME4000_AI_CTRL_REG); /* Write the channel list */ me4000_ai_write_chanlist(dev, s, cmd); @@ -800,21 +777,28 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, if (cmd->start_src == TRIG_NOW && cmd->scan_begin_src == TRIG_TIMER && cmd->convert_src == TRIG_TIMER) { + devpriv->ai_ctrl_mode = ME4000_AI_CTRL_MODE_0; } else if (cmd->start_src == TRIG_NOW && cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_TIMER) { + devpriv->ai_ctrl_mode = ME4000_AI_CTRL_MODE_0; } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_TIMER && cmd->convert_src == TRIG_TIMER) { + devpriv->ai_ctrl_mode = ME4000_AI_CTRL_MODE_1; } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_TIMER) { + devpriv->ai_ctrl_mode = ME4000_AI_CTRL_MODE_1; } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_TIMER) { + devpriv->ai_ctrl_mode = ME4000_AI_CTRL_MODE_2; } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_EXT) { + devpriv->ai_ctrl_mode = ME4000_AI_CTRL_MODE_0 | + ME4000_AI_CTRL_MODE_1; } else { err |= -EINVAL; } From 11e480c3a64355b55ac23aaa3250fcc85f260530 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:07 -0700 Subject: [PATCH 673/912] staging: comedi: me4000: absorb ai_prepare() This function never fails and it's only called by me4000_ai_do_cmd(). Absorb it and remove the unnecessary failure check. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 31 +++++++------------------ 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 60f62f3d434a..c467eb75b17f 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -681,12 +681,18 @@ static int me4000_ai_write_chanlist(struct comedi_device *dev, return 0; } -static int ai_prepare(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) +static int me4000_ai_do_cmd(struct comedi_device *dev, + struct comedi_subdevice *s) { struct me4000_private *devpriv = dev->private; + struct comedi_cmd *cmd = &s->async->cmd; unsigned int ctrl; + int err; + + /* Reset the analog input */ + err = me4000_ai_cancel(dev, s); + if (err) + return err; /* Write timer arguments */ ai_write_timer(dev); @@ -718,25 +724,6 @@ static int ai_prepare(struct comedi_device *dev, /* Write the channel list */ me4000_ai_write_chanlist(dev, s, cmd); - return 0; -} - -static int me4000_ai_do_cmd(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - int err; - struct comedi_cmd *cmd = &s->async->cmd; - - /* Reset the analog input */ - err = me4000_ai_cancel(dev, s); - if (err) - return err; - - /* Prepare the AI for acquisition */ - err = ai_prepare(dev, s, cmd); - if (err) - return err; - /* Start acquistion by dummy read */ inl(dev->iobase + ME4000_AI_START_REG); From 576694d83e4b014f66e673fced80fb40be3c35b9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:08 -0700 Subject: [PATCH 674/912] staging: comedi: me4000: absorb ai_write_timer() This function is only called by me4000_ai_do_cmd(). Absorb it. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 35 ++++++++++--------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index c467eb75b17f..ecdf6738ab02 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -635,26 +635,6 @@ static void me4000_ai_round_cmd_args(struct comedi_device *dev, } } -static void ai_write_timer(struct comedi_device *dev) -{ - struct me4000_private *devpriv = dev->private; - - outl(devpriv->ai_init_ticks - 1, - dev->iobase + ME4000_AI_SCAN_PRE_TIMER_LOW_REG); - outl(0x0, dev->iobase + ME4000_AI_SCAN_PRE_TIMER_HIGH_REG); - - if (devpriv->ai_scan_ticks) { - outl(devpriv->ai_scan_ticks - 1, - dev->iobase + ME4000_AI_SCAN_TIMER_LOW_REG); - outl(0x0, dev->iobase + ME4000_AI_SCAN_TIMER_HIGH_REG); - } - - outl(devpriv->ai_chan_ticks - 1, - dev->iobase + ME4000_AI_CHAN_PRE_TIMER_REG); - outl(devpriv->ai_chan_ticks - 1, - dev->iobase + ME4000_AI_CHAN_TIMER_REG); -} - static int me4000_ai_write_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) @@ -695,7 +675,20 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, return err; /* Write timer arguments */ - ai_write_timer(dev); + outl(devpriv->ai_init_ticks - 1, + dev->iobase + ME4000_AI_SCAN_PRE_TIMER_LOW_REG); + outl(0x0, dev->iobase + ME4000_AI_SCAN_PRE_TIMER_HIGH_REG); + + if (devpriv->ai_scan_ticks) { + outl(devpriv->ai_scan_ticks - 1, + dev->iobase + ME4000_AI_SCAN_TIMER_LOW_REG); + outl(0x0, dev->iobase + ME4000_AI_SCAN_TIMER_HIGH_REG); + } + + outl(devpriv->ai_chan_ticks - 1, + dev->iobase + ME4000_AI_CHAN_PRE_TIMER_REG); + outl(devpriv->ai_chan_ticks - 1, + dev->iobase + ME4000_AI_CHAN_TIMER_REG); /* Reset control register */ outl(0, dev->iobase + ME4000_AI_CTRL_REG); From ffaeab349d0c5c28019ed395dac2c962560c34f6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:09 -0700 Subject: [PATCH 675/912] staging: comedi: me4000: return void from me4000_ai_write_chanlist() This function always returns 0 and the return value is never checked. Just return void. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index ecdf6738ab02..b30305b44300 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -635,9 +635,9 @@ static void me4000_ai_round_cmd_args(struct comedi_device *dev, } } -static int me4000_ai_write_chanlist(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) +static void me4000_ai_write_chanlist(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd) { int i; @@ -657,8 +657,6 @@ static int me4000_ai_write_chanlist(struct comedi_device *dev, outl(entry, dev->iobase + ME4000_AI_CHANNEL_LIST_REG); } - - return 0; } static int me4000_ai_do_cmd(struct comedi_device *dev, From 6847df631faedfef33170eed8d81430a4917b8b0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:10 -0700 Subject: [PATCH 676/912] staging: comedi: me4000: fix me4000_ai_cancel() The STOP and IMMEDIATE_STOP bits in the ME4000_AI_CTRL_REG should be set, not cleared, to stop any running conversions. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index b30305b44300..a171971b6a87 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -529,12 +529,12 @@ static int me4000_ai_insn_read(struct comedi_device *dev, static int me4000_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { - unsigned int tmp; + unsigned int ctrl; /* Stop any running conversion */ - tmp = inl(dev->iobase + ME4000_AI_CTRL_REG); - tmp &= ~(ME4000_AI_CTRL_STOP | ME4000_AI_CTRL_IMMEDIATE_STOP); - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); + ctrl = inl(dev->iobase + ME4000_AI_CTRL_REG); + ctrl |= ME4000_AI_CTRL_STOP | ME4000_AI_CTRL_IMMEDIATE_STOP; + outl(ctrl, dev->iobase + ME4000_AI_CTRL_REG); /* Clear the control register */ outl(0x0, dev->iobase + ME4000_AI_CTRL_REG); From 78e4a573bfb01c287af8b81cd9d0a7329cbae7ca Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:11 -0700 Subject: [PATCH 677/912] staging: comedi: me4000: remove unnecessary ai control register reset The me4000_ai_cancel() already reset this register. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index a171971b6a87..4a051b86100a 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -688,9 +688,6 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, outl(devpriv->ai_chan_ticks - 1, dev->iobase + ME4000_AI_CHAN_TIMER_REG); - /* Reset control register */ - outl(0, dev->iobase + ME4000_AI_CTRL_REG); - /* Start sources */ ctrl = devpriv->ai_ctrl_mode | ME4000_AI_CTRL_CHANNEL_FIFO | From 2ff848c3be2d066ec0dc05f8477f97d9daa24e0d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:12 -0700 Subject: [PATCH 678/912] staging: comedi: me4000: remove unnecessary me4000_ai_cancel() The comedi core ensures that the subdevice is not busy before it allows starting a new command. The subdevice (*cancel) is called when the subdevice is set to not busy. In this driver the me4000_ai_cancel() is the ai (*cancel) so the extra call in the ai (*do_cmd) is not necessary. Remove it. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 4a051b86100a..b3d871b2b6a1 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -665,12 +665,6 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, struct me4000_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; unsigned int ctrl; - int err; - - /* Reset the analog input */ - err = me4000_ai_cancel(dev, s); - if (err) - return err; /* Write timer arguments */ outl(devpriv->ai_init_ticks - 1, From a31b50ed1b600ed198252acccf6ec570fabcfc03 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:13 -0700 Subject: [PATCH 679/912] staging: comedi: me4000: clear the ME4000_AI_CTRL_REG in me4000_reset() Reset the analog input control register after ensuring that any active conversions have been stopped. This mimics what the ai subdevice (*cancel) does. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index b3d871b2b6a1..3d4a9c841192 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -414,6 +414,9 @@ static void me4000_reset(struct comedi_device *dev) outl(ME4000_AI_CTRL_IMMEDIATE_STOP | ME4000_AI_CTRL_STOP, dev->iobase + ME4000_AI_CTRL_REG); + /* Clear the analog input control register */ + outl(0x0, dev->iobase + ME4000_AI_CTRL_REG); + /* Set both stop bits in the analog output control register */ val = ME4000_AO_CTRL_IMMEDIATE_STOP | ME4000_AO_CTRL_STOP; for (chan = 0; chan < 4; chan++) From b047d9ccc3a40b672594b4eab1eac91d7efebcd9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:14 -0700 Subject: [PATCH 680/912] staging: comedi: me4000: introduce me4000_ai_reset() Introduce a helper function to stop any ai conversions and reset the ai control register. This consolidates the common code in me4000_reset() and me4000_ai_cancel(). Use the new helper in the ai (*insn_read) to ensure that the ai control register is set to a known state after reading the samples. The ai control register will now always be '0' after the (*cancel) of a command or doing an (*insn_read). Knowing this the programming of the register for single acquisition mode in the (*insn_read) can be simplified. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 56 ++++++++++--------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 3d4a9c841192..da0075b926a5 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -393,6 +393,19 @@ static int me4000_xilinx_download(struct comedi_device *dev, return 0; } +static void me4000_ai_reset(struct comedi_device *dev) +{ + unsigned int ctrl; + + /* Stop any running conversion */ + ctrl = inl(dev->iobase + ME4000_AI_CTRL_REG); + ctrl |= ME4000_AI_CTRL_STOP | ME4000_AI_CTRL_IMMEDIATE_STOP; + outl(ctrl, dev->iobase + ME4000_AI_CTRL_REG); + + /* Clear the control register */ + outl(0x0, dev->iobase + ME4000_AI_CTRL_REG); +} + static void me4000_reset(struct comedi_device *dev) { struct me4000_private *devpriv = dev->private; @@ -410,12 +423,7 @@ static void me4000_reset(struct comedi_device *dev) for (chan = 0; chan < 4; chan++) outl(0x8000, dev->iobase + ME4000_AO_SINGLE_REG(chan)); - /* Set both stop bits in the analog input control register */ - outl(ME4000_AI_CTRL_IMMEDIATE_STOP | ME4000_AI_CTRL_STOP, - dev->iobase + ME4000_AI_CTRL_REG); - - /* Clear the analog input control register */ - outl(0x0, dev->iobase + ME4000_AI_CTRL_REG); + me4000_ai_reset(dev); /* Set both stop bits in the analog output control register */ val = ME4000_AO_CTRL_IMMEDIATE_STOP | ME4000_AO_CTRL_STOP; @@ -461,8 +469,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev, unsigned int range = CR_RANGE(insn->chanspec); unsigned int aref = CR_AREF(insn->chanspec); unsigned int entry; - unsigned int tmp; - int ret; + int ret = 0; int i; entry = chan | ME4000_AI_LIST_RANGE(range); @@ -489,20 +496,9 @@ static int me4000_ai_insn_read(struct comedi_device *dev, entry |= ME4000_AI_LIST_LAST_ENTRY; - /* Clear channel list, data fifo and both stop bits */ - tmp = inl(dev->iobase + ME4000_AI_CTRL_REG); - tmp &= ~(ME4000_AI_CTRL_CHANNEL_FIFO | ME4000_AI_CTRL_DATA_FIFO | - ME4000_AI_CTRL_STOP | ME4000_AI_CTRL_IMMEDIATE_STOP); - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); - - /* Set the acquisition mode to single */ - tmp &= ~(ME4000_AI_CTRL_MODE_0 | ME4000_AI_CTRL_MODE_1 | - ME4000_AI_CTRL_MODE_2); - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); - - /* Enable channel list and data fifo */ - tmp |= ME4000_AI_CTRL_CHANNEL_FIFO | ME4000_AI_CTRL_DATA_FIFO; - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); + /* Enable channel list and data fifo for single acquisition mode */ + outl(ME4000_AI_CTRL_CHANNEL_FIFO | ME4000_AI_CTRL_DATA_FIFO, + dev->iobase + ME4000_AI_CTRL_REG); /* Generate channel list entry */ outl(entry, dev->iobase + ME4000_AI_CHANNEL_LIST_REG); @@ -519,28 +515,22 @@ static int me4000_ai_insn_read(struct comedi_device *dev, ret = comedi_timeout(dev, s, insn, me4000_ai_eoc, 0); if (ret) - return ret; + break; /* read two's complement value and munge to offset binary */ val = inl(dev->iobase + ME4000_AI_DATA_REG); data[i] = comedi_offset_munge(s, val); } - return insn->n; + me4000_ai_reset(dev); + + return ret ? ret : insn->n; } static int me4000_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { - unsigned int ctrl; - - /* Stop any running conversion */ - ctrl = inl(dev->iobase + ME4000_AI_CTRL_REG); - ctrl |= ME4000_AI_CTRL_STOP | ME4000_AI_CTRL_IMMEDIATE_STOP; - outl(ctrl, dev->iobase + ME4000_AI_CTRL_REG); - - /* Clear the control register */ - outl(0x0, dev->iobase + ME4000_AI_CTRL_REG); + me4000_ai_reset(dev); return 0; } From 8f3f3eb7a264630a73c23cecfa2af2235775e09a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:15 -0700 Subject: [PATCH 681/912] staging: comedi: me4000: only enable PLX interrupt if we have and irq Currently me4000_reset() always enables the PLX interrupt. Move the enable of the interrupt into me4000_auto_attach() and only do the enable if we actually have and irq. Make sure the PLX interrupt is disabled in me4000_reset() before we try to request the irq. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index da0075b926a5..a4c28fa90759 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -412,7 +412,10 @@ static void me4000_reset(struct comedi_device *dev) unsigned int val; int chan; - /* Make a hardware reset */ + /* Disable interrupts on the PLX */ + outl(0, devpriv->plx_regbase + PLX9052_INTCSR); + + /* Software reset the PLX */ val = inl(devpriv->plx_regbase + PLX9052_CNTRL); val |= PLX9052_CNTRL_PCI_RESET; outl(val, devpriv->plx_regbase + PLX9052_CNTRL); @@ -430,11 +433,6 @@ static void me4000_reset(struct comedi_device *dev) for (chan = 0; chan < 4; chan++) outl(val, dev->iobase + ME4000_AO_CTRL_REG(chan)); - /* Enable interrupts on the PLX */ - outl(PLX9052_INTCSR_LI1ENAB | - PLX9052_INTCSR_LI1POL | - PLX9052_INTCSR_PCIENAB, devpriv->plx_regbase + PLX9052_INTCSR); - /* Set the adustment register for AO demux */ outl(ME4000_AO_DEMUX_ADJUST_VALUE, dev->iobase + ME4000_AO_DEMUX_ADJUST_REG); @@ -1181,8 +1179,14 @@ static int me4000_auto_attach(struct comedi_device *dev, if (pcidev->irq > 0) { result = request_irq(pcidev->irq, me4000_ai_isr, IRQF_SHARED, dev->board_name, dev); - if (result == 0) + if (result == 0) { dev->irq = pcidev->irq; + + /* Enable interrupts on the PLX */ + outl(PLX9052_INTCSR_LI1ENAB | PLX9052_INTCSR_LI1POL | + PLX9052_INTCSR_PCIENAB, + devpriv->plx_regbase + PLX9052_INTCSR); + } } result = comedi_alloc_subdevices(dev, 4); From 607d993942512f6b005b0465be85f21db7725ecc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:16 -0700 Subject: [PATCH 682/912] staging: comedi: me4000: fix me4000_detach() There is no real reason to reset the board when detaching. The comedi core will ensure that any commands are canceled before the detach. But the PLX interrupts should be disabled. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index a4c28fa90759..4f2ff860cf63 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1276,8 +1276,12 @@ static int me4000_auto_attach(struct comedi_device *dev, static void me4000_detach(struct comedi_device *dev) { - if (dev->iobase) - me4000_reset(dev); + if (dev->irq) { + struct me4000_private *devpriv = dev->private; + + /* Disable interrupts on the PLX */ + outl(0, devpriv->plx_regbase + PLX9052_INTCSR); + } comedi_pci_detach(dev); } From b36e4fa78ddbb342480031beec5fc63473b340e0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:17 -0700 Subject: [PATCH 683/912] staging: comedi: me4000: tidy up analog output subdevice init For aesthetics, add some white space to the analog output subdevice initialization. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 4f2ff860cf63..b2d9d61a6173 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1213,25 +1213,21 @@ static int me4000_auto_attach(struct comedi_device *dev, s->do_cmd = me4000_ai_do_cmd; } - /*========================================================================= - Analog output subdevice - ========================================================================*/ - + /* Analog Output subdevice */ s = &dev->subdevices[1]; - if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_COMMON | SDF_GROUND; - s->n_chan = 4; - s->maxdata = 0xFFFF; /* 16 bit DAC */ - s->range_table = &range_bipolar10; - s->insn_write = me4000_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_COMMON | SDF_GROUND; + s->n_chan = 4; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = me4000_ao_insn_write; result = comedi_alloc_subdev_readback(s); if (result) return result; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital I/O subdevice */ From 36d59d70babc9ad4275d0c7c5e63241a077f572c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:18 -0700 Subject: [PATCH 684/912] staging: comedi: me4000: comedi_handle_events() will stop conversions The irq handler does not need to manually stop conversions and disable interrupts when "end-of-acquisition", "error", or "overflow" events are detected. The comedi_handle_events() will call the subdevice (*cancel) when these are detected and stop the acquisition. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 54 ++++--------------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index b2d9d61a6173..b17183dee7fb 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -939,41 +939,17 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) if (!(tmp & ME4000_AI_STATUS_FF_DATA) && !(tmp & ME4000_AI_STATUS_HF_DATA) && (tmp & ME4000_AI_STATUS_EF_DATA)) { - c = ME4000_AI_FIFO_COUNT; - - /* - * FIFO overflow, so stop conversion - * and disable all interrupts - */ - tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP; - tmp &= ~(ME4000_AI_CTRL_HF_IRQ | - ME4000_AI_CTRL_SC_IRQ); - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); - - s->async->events |= COMEDI_CB_ERROR; - dev_err(dev->class_dev, "FIFO overflow\n"); + s->async->events |= COMEDI_CB_ERROR; + c = ME4000_AI_FIFO_COUNT; } else if ((tmp & ME4000_AI_STATUS_FF_DATA) && !(tmp & ME4000_AI_STATUS_HF_DATA) && (tmp & ME4000_AI_STATUS_EF_DATA)) { c = ME4000_AI_FIFO_COUNT / 2; } else { - dev_err(dev->class_dev, - "Can't determine state of fifo\n"); - c = 0; - - /* - * Undefined state, so stop conversion - * and disable all interrupts - */ - tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP; - tmp &= ~(ME4000_AI_CTRL_HF_IRQ | - ME4000_AI_CTRL_SC_IRQ); - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); - - s->async->events |= COMEDI_CB_ERROR; - dev_err(dev->class_dev, "Undefined FIFO state\n"); + s->async->events |= COMEDI_CB_ERROR; + c = 0; } for (i = 0; i < c; i++) { @@ -981,17 +957,8 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; lval ^= 0x8000; - if (!comedi_buf_write_samples(s, &lval, 1)) { - /* - * Buffer overflow, so stop conversion - * and disable all interrupts - */ - tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP; - tmp &= ~(ME4000_AI_CTRL_HF_IRQ | - ME4000_AI_CTRL_SC_IRQ); - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); + if (!comedi_buf_write_samples(s, &lval, 1)) break; - } } /* Work is done, so reset the interrupt */ @@ -1003,17 +970,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & ME4000_IRQ_STATUS_SC) { + /* Acquisition is complete */ s->async->events |= COMEDI_CB_EOA; - /* - * Acquisition is complete, so stop - * conversion and disable all interrupts - */ - tmp = inl(dev->iobase + ME4000_AI_CTRL_REG); - tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP; - tmp &= ~(ME4000_AI_CTRL_HF_IRQ | ME4000_AI_CTRL_SC_IRQ); - outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); - /* Poll data until fifo empty */ while (inl(dev->iobase + ME4000_AI_STATUS_REG) & ME4000_AI_STATUS_EF_DATA) { @@ -1026,6 +985,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) } /* Work is done, so reset the interrupt */ + tmp = inl(dev->iobase + ME4000_AI_CTRL_REG); tmp |= ME4000_AI_CTRL_SC_IRQ_RESET; outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); tmp &= ~ME4000_AI_CTRL_SC_IRQ_RESET; From 7022781c460290687b374dab1c230c06091bba10 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:19 -0700 Subject: [PATCH 685/912] staging: comedi: me4000: introduce me4000_ai_get_sample() The hardware returns two's complement values for the analog input samples. These need to be converted to the unsigned binary format that the comedi core expects. Introduce a helper function to handle this. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index b17183dee7fb..3974f59c0478 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -445,6 +445,16 @@ static void me4000_reset(struct comedi_device *dev) outl(0x1, dev->iobase + ME4000_DIO_CTRL_REG); } +static unsigned int me4000_ai_get_sample(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + unsigned int val; + + /* read two's complement value and munge to offset binary */ + val = inl(dev->iobase + ME4000_AI_DATA_REG); + return comedi_offset_munge(s, val); +} + static int me4000_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -515,8 +525,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev, if (ret) break; - /* read two's complement value and munge to offset binary */ - val = inl(dev->iobase + ME4000_AI_DATA_REG); + val = me4000_ai_get_sample(dev, s); data[i] = comedi_offset_munge(s, val); } @@ -953,10 +962,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) } for (i = 0; i < c; i++) { - /* Read value from data fifo */ - lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; - lval ^= 0x8000; - + lval = me4000_ai_get_sample(dev, s); if (!comedi_buf_write_samples(s, &lval, 1)) break; } @@ -976,10 +982,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) /* Poll data until fifo empty */ while (inl(dev->iobase + ME4000_AI_STATUS_REG) & ME4000_AI_STATUS_EF_DATA) { - /* Read value from data fifo */ - lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; - lval ^= 0x8000; - + lval = me4000_ai_get_sample(dev, s); if (!comedi_buf_write_samples(s, &lval, 1)) break; } From 3fe6929bbbca11b015d182d4864d92d0bf5c244d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:20 -0700 Subject: [PATCH 686/912] staging: comedi: me4000: usleep_range is preferred over udelay Fix checkpatch issue: "CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt". `udelay()` is only used in the firmware upload process. Replace them with `usleep_range()` with a reasonable upper limit. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 3974f59c0478..74c16dbd1f8b 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -345,7 +345,7 @@ static int me4000_xilinx_download(struct comedi_device *dev, inb(xilinx_iobase + 0xC8); /* Wait until /INIT pin is set */ - udelay(20); + usleep_range(20, 1000); val = inl(devpriv->plx_regbase + PLX9052_INTCSR); if (!(val & PLX9052_INTCSR_LI2STAT)) { dev_err(dev->class_dev, "Can't init Xilinx\n"); @@ -362,11 +362,11 @@ static int me4000_xilinx_download(struct comedi_device *dev, (((unsigned int)data[1] & 0xff) << 16) + (((unsigned int)data[2] & 0xff) << 8) + ((unsigned int)data[3] & 0xff); - udelay(10); + usleep_range(10, 1000); for (i = 0; i < file_length; i++) { outb(data[16 + i], xilinx_iobase); - udelay(10); + usleep_range(10, 1000); /* Check if BUSY flag is low */ val = inl(devpriv->plx_regbase + PLX9052_CNTRL); From 751dcb48c7ec8585644d2e62d81ce54228e92c8b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:21 -0700 Subject: [PATCH 687/912] staging: comedi: me4000: cleanup multi-line comments Format the multi-line comments in the kernel CodingStyle. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 74 ++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 74c16dbd1f8b..56da64d25b86 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1,43 +1,43 @@ /* - comedi/drivers/me4000.c - Source code for the Meilhaus ME-4000 board family. - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2000 David A. Schleef - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + * me4000.c + * Source code for the Meilhaus ME-4000 board family. + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. */ + /* -Driver: me4000 -Description: Meilhaus ME-4000 series boards -Devices: [Meilhaus] ME-4650 (me4000), ME-4670i, ME-4680, ME-4680i, ME-4680is -Author: gg (Guenter Gebhardt ) -Updated: Mon, 18 Mar 2002 15:34:01 -0800 -Status: broken (no support for loading firmware) - -Supports: - - - Analog Input - - Analog Output - - Digital I/O - - Counter - -Configuration Options: not applicable, uses PCI auto config - -The firmware required by these boards is available in the -comedi_nonfree_firmware tarball available from -http://www.comedi.org. However, the driver's support for -loading the firmware through comedi_config is currently -broken. - + * Driver: me4000 + * Description: Meilhaus ME-4000 series boards + * Devices: [Meilhaus] ME-4650 (me4000), ME-4670i, ME-4680, ME-4680i, + * ME-4680is + * Author: gg (Guenter Gebhardt ) + * Updated: Mon, 18 Mar 2002 15:34:01 -0800 + * Status: broken (no support for loading firmware) + * + * Supports: + * - Analog Input + * - Analog Output + * - Digital I/O + * - Counter + * + * Configuration Options: not applicable, uses PCI auto config + * + * The firmware required by these boards is available in the + * comedi_nonfree_firmware tarball available from + * http://www.comedi.org. However, the driver's support for + * loading the firmware through comedi_config is currently + * broken. */ #include From 4627c547c031459ad9f504d95c6a56a1d7a1e079 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:22 -0700 Subject: [PATCH 688/912] staging: comedi: me4000: updata driver status in comedi comment Firmware loading was fixed by: Commit: ac584af5 "staging: comedi: me4000: fix firmware downloading" Change the driver status to "untested" and remove the comments about the driver being broken, Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 56da64d25b86..ac6931acb039 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -23,7 +23,7 @@ * ME-4680is * Author: gg (Guenter Gebhardt ) * Updated: Mon, 18 Mar 2002 15:34:01 -0800 - * Status: broken (no support for loading firmware) + * Status: untested * * Supports: * - Analog Input @@ -35,9 +35,7 @@ * * The firmware required by these boards is available in the * comedi_nonfree_firmware tarball available from - * http://www.comedi.org. However, the driver's support for - * loading the firmware through comedi_config is currently - * broken. + * http://www.comedi.org. */ #include From b96e53df92ab6ed1ca58639f0bbfacaf717e285b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Aug 2015 10:45:23 -0700 Subject: [PATCH 689/912] staging: comedi: me4000: update MODULE_DESCRIPTION Change the MODULE_DESCRIPTION to something more useful than "Comedi low- level driver" Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index ac6931acb039..5aa1780cf42b 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -1282,6 +1282,6 @@ static struct pci_driver me4000_pci_driver = { module_comedi_pci_driver(me4000_driver, me4000_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); -MODULE_DESCRIPTION("Comedi low-level driver"); +MODULE_DESCRIPTION("Comedi driver for Meilhaus ME-4000 series boards"); MODULE_LICENSE("GPL"); MODULE_FIRMWARE(ME4000_FIRMWARE); From 1461d66728648540a043ba69ace1081ed5006faf Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 18:31:13 +0530 Subject: [PATCH 690/912] staging: sm7xxfb: merge sm712fb with fbdev Now since all cleanups are done and the code is ready to be merged lets move it out of staging into fbdev location. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 -- drivers/staging/Makefile | 1 - drivers/staging/sm7xxfb/Kconfig | 13 ------------- drivers/staging/sm7xxfb/Makefile | 1 - drivers/staging/sm7xxfb/TODO | 12 ------------ drivers/video/fbdev/Kconfig | 14 ++++++++++++++ drivers/video/fbdev/Makefile | 1 + .../sm7xxfb/sm7xx.h => video/fbdev/sm712.h} | 0 .../sm7xxfb/sm7xxfb.c => video/fbdev/sm712fb.c} | 2 +- 9 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 drivers/staging/sm7xxfb/Kconfig delete mode 100644 drivers/staging/sm7xxfb/Makefile delete mode 100644 drivers/staging/sm7xxfb/TODO rename drivers/{staging/sm7xxfb/sm7xx.h => video/fbdev/sm712.h} (100%) rename drivers/{staging/sm7xxfb/sm7xxfb.c => video/fbdev/sm712fb.c} (99%) diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 4f0b12d88fdc..39c5df6154aa 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -56,8 +56,6 @@ source "drivers/staging/vt6656/Kconfig" source "drivers/staging/iio/Kconfig" -source "drivers/staging/sm7xxfb/Kconfig" - source "drivers/staging/sm750fb/Kconfig" source "drivers/staging/xgifb/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 37149ca6a331..018093d60e85 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -22,7 +22,6 @@ obj-$(CONFIG_VT6655) += vt6655/ obj-$(CONFIG_VT6656) += vt6656/ obj-$(CONFIG_VME_BUS) += vme/ obj-$(CONFIG_IIO) += iio/ -obj-$(CONFIG_FB_SM7XX) += sm7xxfb/ obj-$(CONFIG_FB_SM750) += sm750fb/ obj-$(CONFIG_FB_XGI) += xgifb/ obj-$(CONFIG_USB_EMXX) += emxx_udc/ diff --git a/drivers/staging/sm7xxfb/Kconfig b/drivers/staging/sm7xxfb/Kconfig deleted file mode 100644 index e2922ae3a3ee..000000000000 --- a/drivers/staging/sm7xxfb/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -config FB_SM7XX - tristate "Silicon Motion SM7XX framebuffer support" - depends on FB && PCI - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - help - Frame buffer driver for the Silicon Motion SM710, SM712, SM721 - and SM722 chips. - - This driver is also available as a module. The module will be - called sm7xxfb. If you want to compile it as a module, say M - here and read . diff --git a/drivers/staging/sm7xxfb/Makefile b/drivers/staging/sm7xxfb/Makefile deleted file mode 100644 index 48f471cf9f36..000000000000 --- a/drivers/staging/sm7xxfb/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-$(CONFIG_FB_SM7XX) += sm7xxfb.o diff --git a/drivers/staging/sm7xxfb/TODO b/drivers/staging/sm7xxfb/TODO deleted file mode 100644 index 7cb0b242f204..000000000000 --- a/drivers/staging/sm7xxfb/TODO +++ /dev/null @@ -1,12 +0,0 @@ -TODO: -- Dual head support -- 2D acceleration support -- use kernel coding style -- refine the code and remove unused code -- move it to drivers/video/fbdev/sm7xxfb.c - -Please send any patches to - Greg Kroah-Hartman - Sudip Mukherjee - Teddy Wang - Sudip Mukherjee diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 2d98de535e0f..230790984088 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2475,3 +2475,17 @@ config FB_SSD1307 help This driver implements support for the Solomon SSD1307 OLED controller over I2C. + +config FB_SM712 + tristate "Silicon Motion SM712 framebuffer support" + depends on FB && PCI + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + help + Frame buffer driver for the Silicon Motion SM710, SM712, SM721 + and SM722 chips. + + This driver is also available as a module. The module will be + called sm712fb. If you want to compile it as a module, say M + here and read . diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile index cecea5063a80..50ed1b4fc2bf 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -131,6 +131,7 @@ obj-$(CONFIG_FB_JZ4740) += jz4740_fb.o obj-$(CONFIG_FB_PUV3_UNIGFX) += fb-puv3.o obj-$(CONFIG_FB_HYPERV) += hyperv_fb.o obj-$(CONFIG_FB_OPENCORES) += ocfb.o +obj-$(CONFIG_FB_SM712) += sm712fb.o # Platform or fallback drivers go here obj-$(CONFIG_FB_UVESA) += uvesafb.o diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/video/fbdev/sm712.h similarity index 100% rename from drivers/staging/sm7xxfb/sm7xx.h rename to drivers/video/fbdev/sm712.h diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/video/fbdev/sm712fb.c similarity index 99% rename from drivers/staging/sm7xxfb/sm7xxfb.c rename to drivers/video/fbdev/sm712fb.c index 07c2199c9ac7..629bfa2d2f51 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/video/fbdev/sm712fb.c @@ -32,7 +32,7 @@ #include #endif -#include "sm7xx.h" +#include "sm712.h" /* * Private structure From 5b55f52d13d3643e7d62ad2f37f55d8e7f5f0c8e Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 18:31:14 +0530 Subject: [PATCH 691/912] Documentation/fb: add documentation for sm712fb Create the documentation for SM712. Mention all the supported modes and how to use. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- Documentation/fb/sm712fb.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Documentation/fb/sm712fb.txt diff --git a/Documentation/fb/sm712fb.txt b/Documentation/fb/sm712fb.txt new file mode 100644 index 000000000000..c388442edf51 --- /dev/null +++ b/Documentation/fb/sm712fb.txt @@ -0,0 +1,31 @@ +What is sm712fb? +================= + +This is a graphics framebuffer driver for Silicon Motion SM712 based processors. + +How to use it? +============== + +Switching modes is done using the video=sm712fb:... boot parameter. + +If you want, for example, enable a resolution of 1280x1024x24bpp you should +pass to the kernel this command line: "video=sm712fb:0x31B". + +You should not compile-in vesafb. + +Currently supported video modes are: + +[Graphic modes] + +bpp | 640x480 800x600 1024x768 1280x1024 +----+-------------------------------------------- + 8 | 0x301 0x303 0x305 0x307 + 16 | 0x311 0x314 0x317 0x31A + 24 | 0x312 0x315 0x318 0x31B + +Missing Features +================ +(alias TODO list) + + * 2D acceleratrion + * dual-head support From 3a6779f564bf2f2748a9960a563b5b606d4bedc7 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 18:31:15 +0530 Subject: [PATCH 692/912] MAINTAINERS: update maintainers list Now since sm712fb has moved out of staging update the maintainers list accordingly. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 9289ecb57b68..ba6c53742d2b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9324,6 +9324,15 @@ S: Maintained F: drivers/media/i2c/ov2659.c F: include/media/ov2659.h +SILICON MOTION SM712 FRAME BUFFER DRIVER +M: Sudip Mukherjee +M: Teddy Wang +M: Sudip Mukherjee +L: linux-fbdev@vger.kernel.org +S: Maintained +F: drivers/video/fbdev/sm712* +F: Documentation/fb/sm712fb.txt + SIS 190 ETHERNET DRIVER M: Francois Romieu L: netdev@vger.kernel.org @@ -9744,14 +9753,6 @@ L: linux-wireless@vger.kernel.org S: Maintained F: drivers/staging/rtl8723au/ -STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER -M: Sudip Mukherjee -M: Teddy Wang -M: Sudip Mukherjee -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/staging/sm7xxfb/ - STAGING - SILICON MOTION SM750 FRAME BUFFER DRIVER M: Sudip Mukherjee M: Teddy Wang From 8fc8cf4482fa1b983a5e971aa037aaa76179b28c Mon Sep 17 00:00:00 2001 From: Johannes Postma Date: Thu, 6 Aug 2015 12:21:52 +0100 Subject: [PATCH 693/912] staging: rtl8723au: Fix sparse warning: cast to restricted __le16 usPtr is used as __le16 *, but was defined as u16 *. This was reported by sparse as: drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c:1850:29: warning: cast to restricted __le16 This patch fixes the type of usPtr. Signed-off-by: Johannes Postma Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index cb5076abda8b..eb76ac473630 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -1838,7 +1838,7 @@ Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter, static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc) { - u16 *usPtr = (u16 *) ptxdesc; + __le16 *usPtr = (__le16 *)ptxdesc; u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */ u32 index; u16 checksum = 0; From 25e66320167117d428d2c99076be5e5de557b7d1 Mon Sep 17 00:00:00 2001 From: Johannes Postma Date: Fri, 7 Aug 2015 14:04:34 +0100 Subject: [PATCH 694/912] staging: rtl8723au: rtl8723a_hal_init: Improve code readability This patch improves code readability in the function rtl8723a_cal_txdesc_chksum. It improves the readability of the argument of the function le16_to_cpu. Signed-off-by: Johannes Postma Acked-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index eb76ac473630..cf2388f4f6e7 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -1847,7 +1847,7 @@ static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc) ptxdesc->txdw7 &= cpu_to_le32(0xffff0000); for (index = 0; index < count; index++) - checksum ^= le16_to_cpu(*(usPtr + index)); + checksum ^= le16_to_cpu(usPtr[index]); ptxdesc->txdw7 |= cpu_to_le32(checksum & 0x0000ffff); } From dbb588a4f7bf5dd8ad871f5d5dec228295cc4b7e Mon Sep 17 00:00:00 2001 From: Fabio Falzoi Date: Sun, 2 Aug 2015 22:30:14 +0200 Subject: [PATCH 695/912] Staging: fbtft: Use a struct to describe each LCD controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a struct flexfb_lcd_controller to holds chip properties, instead of relying on a long 'if - else if' chain. This allows to: - use a simple linear search to verify if a certain LCD controller model is supported or not. - add support for a new LCD chip controller simply defining a new flexfb_lcd_controller struct. Signed-off-by: Fabio Falzoi Acked-by: Noralf Trønnes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/flexfb.c | 232 +++++++++++++++++++-------------- 1 file changed, 136 insertions(+), 96 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 5b4c7124a6ee..c763efc5de7d 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -126,6 +126,109 @@ static int ssd1351_init[] = { -1, 0xfd, 0x12, -1, 0xfd, 0xb1, -1, 0xae, -1, 0xb3 -1, 0xab, 0x01, -1, 0xb1, 0x32, -1, 0xb4, 0xa0, 0xb5, 0x55, -1, 0xbb, 0x17, -1, 0xbe, 0x05, -1, 0xc1, 0xc8, 0x80, 0xc8, -1, 0xc7, 0x0f, -1, 0xb6, 0x01, -1, 0xa6, -1, 0xaf, -3 }; +/** + * struct flexfb_lcd_controller - Describes the LCD controller properties + * @name: Model name of the chip + * @width: Width of display in pixels + * @height: Height of display in pixels + * @setaddrwin: Which set_addr_win() implementation to use + * @regwidth: LCD Controller Register width in bits + * @init_seq: LCD initialization sequence + * @init_seq_sz: Size of LCD initialization sequence + */ +struct flexfb_lcd_controller { + const char *name; + unsigned int width; + unsigned int height; + unsigned int setaddrwin; + unsigned int regwidth; + int *init_seq; + int init_seq_sz; +}; + +static const struct flexfb_lcd_controller flexfb_chip_table[] = { + { + .name = "st7735r", + .width = 120, + .height = 160, + .init_seq = st7735r_init, + .init_seq_sz = ARRAY_SIZE(st7735r_init), + }, + { + .name = "hx8340bn", + .width = 176, + .height = 220, + .init_seq = hx8340bn_init, + .init_seq_sz = ARRAY_SIZE(hx8340bn_init), + }, + { + .name = "ili9225", + .width = 176, + .height = 220, + .regwidth = 16, + .init_seq = ili9225_init, + .init_seq_sz = ARRAY_SIZE(ili9225_init), + }, + { + .name = "ili9225", + .width = 176, + .height = 220, + .regwidth = 16, + .init_seq = ili9225_init, + .init_seq_sz = ARRAY_SIZE(ili9225_init), + }, + { + .name = "ili9225", + .width = 176, + .height = 220, + .regwidth = 16, + .init_seq = ili9225_init, + .init_seq_sz = ARRAY_SIZE(ili9225_init), + }, + { + .name = "ili9320", + .width = 240, + .height = 320, + .setaddrwin = 1, + .regwidth = 16, + .init_seq = ili9320_init, + .init_seq_sz = ARRAY_SIZE(ili9320_init), + }, + { + .name = "ili9325", + .width = 240, + .height = 320, + .setaddrwin = 1, + .regwidth = 16, + .init_seq = ili9325_init, + .init_seq_sz = ARRAY_SIZE(ili9325_init), + }, + { + .name = "ili9341", + .width = 240, + .height = 320, + .init_seq = ili9341_init, + .init_seq_sz = ARRAY_SIZE(ili9341_init), + }, + { + .name = "ssd1289", + .width = 240, + .height = 320, + .setaddrwin = 2, + .regwidth = 16, + .init_seq = ssd1289_init, + .init_seq_sz = ARRAY_SIZE(ssd1289_init), + }, + { + .name = "ssd1351", + .width = 128, + .height = 128, + .setaddrwin = 3, + .init_seq = ssd1351_init, + .init_seq_sz = ARRAY_SIZE(ssd1351_init), + }, +}; + /* ili9320, ili9325 */ static void flexfb_set_addr_win_1(struct fbtft_par *par, int xs, int ys, int xe, int ye) @@ -247,8 +350,38 @@ static int flexfb_verify_gpios_db(struct fbtft_par *par) return 0; } +static void flexfb_chip_load_param(const struct flexfb_lcd_controller *chip) +{ + if (!width) + width = chip->width; + if (!height) + height = chip->height; + setaddrwin = chip->setaddrwin; + if (chip->regwidth) + regwidth = chip->regwidth; + if (!init_num) { + initp = chip->init_seq; + initp_num = chip->init_seq_sz; + } +} + static struct fbtft_display flex_display = { }; +static int flexfb_chip_init(const struct device *dev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(flexfb_chip_table); i++) + if (!strcmp(chip, flexfb_chip_table[i].name)) { + flexfb_chip_load_param(&flexfb_chip_table[i]); + return 0; + } + + dev_err(dev, "chip=%s is not supported\n", chip); + + return -EINVAL; +} + static int flexfb_probe_common(struct spi_device *sdev, struct platform_device *pdev) { @@ -269,102 +402,9 @@ static int flexfb_probe_common(struct spi_device *sdev, sdev ? "'SPI device'" : "'Platform device'"); if (chip) { - - if (!strcmp(chip, "st7735r")) { - if (!width) - width = 128; - if (!height) - height = 160; - if (init_num == 0) { - initp = st7735r_init; - initp_num = ARRAY_SIZE(st7735r_init); - } - - } else if (!strcmp(chip, "hx8340bn")) { - if (!width) - width = 176; - if (!height) - height = 220; - setaddrwin = 0; - if (init_num == 0) { - initp = hx8340bn_init; - initp_num = ARRAY_SIZE(hx8340bn_init); - } - - } else if (!strcmp(chip, "ili9225")) { - if (!width) - width = 176; - if (!height) - height = 220; - setaddrwin = 0; - regwidth = 16; - if (init_num == 0) { - initp = ili9225_init; - initp_num = ARRAY_SIZE(ili9225_init); - } - - } else if (!strcmp(chip, "ili9320")) { - if (!width) - width = 240; - if (!height) - height = 320; - setaddrwin = 1; - regwidth = 16; - if (init_num == 0) { - initp = ili9320_init; - initp_num = ARRAY_SIZE(ili9320_init); - } - - } else if (!strcmp(chip, "ili9325")) { - if (!width) - width = 240; - if (!height) - height = 320; - setaddrwin = 1; - regwidth = 16; - if (init_num == 0) { - initp = ili9325_init; - initp_num = ARRAY_SIZE(ili9325_init); - } - - } else if (!strcmp(chip, "ili9341")) { - if (!width) - width = 240; - if (!height) - height = 320; - setaddrwin = 0; - regwidth = 8; - if (init_num == 0) { - initp = ili9341_init; - initp_num = ARRAY_SIZE(ili9341_init); - } - - } else if (!strcmp(chip, "ssd1289")) { - if (!width) - width = 240; - if (!height) - height = 320; - setaddrwin = 2; - regwidth = 16; - if (init_num == 0) { - initp = ssd1289_init; - initp_num = ARRAY_SIZE(ssd1289_init); - } - - } else if (!strcmp(chip, "ssd1351")) { - if (!width) - width = 128; - if (!height) - height = 128; - setaddrwin = 3; - if (init_num == 0) { - initp = ssd1351_init; - initp_num = ARRAY_SIZE(ssd1351_init); - } - } else { - dev_err(dev, "chip=%s is not supported\n", chip); - return -EINVAL; - } + ret = flexfb_chip_init(dev); + if (ret) + return ret; } if (width == 0 || height == 0) { From e2622fb31635d3ffd8a2aa3d7f253d2c13c71ad3 Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Wed, 5 Aug 2015 21:13:52 +0100 Subject: [PATCH 696/912] staging: octeon: fix coding style warnings for block comments The Linux kernel coding style suggests starting every line in a block comment with an asterisk and finishing the block comment with */ on a separate line. This patch fixes those warnings, clearing all warnings and errors in this file, as reported by the checkpatch script. Signed-off-by: Okash Khawaja Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-rgmii.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c index beb7aac9c289..51dcb611702f 100644 --- a/drivers/staging/octeon/ethernet-rgmii.c +++ b/drivers/staging/octeon/ethernet-rgmii.c @@ -118,9 +118,10 @@ static void cvm_oct_rgmii_poll(struct net_device *dev) } /* Since the 10Mbps preamble workaround is allowed we need to enable - preamble checking, FCS stripping, and clear error bits on - every speed change. If errors occur during 10Mbps operation - the above code will change this stuff */ + * preamble checking, FCS stripping, and clear error bits on + * every speed change. If errors occur during 10Mbps operation + * the above code will change this stuff + */ cvm_oct_set_hw_preamble(priv, true); if (priv->phydev == NULL) { From 44ae5443ef9fac059a2892cbb3f7e4d95f7f8d12 Mon Sep 17 00:00:00 2001 From: Navy Cheng Date: Thu, 6 Aug 2015 09:47:57 +0800 Subject: [PATCH 697/912] Staging: vme: remove an unnecessary and wrong warning message The wrong warning message in vme_user_probe() will mislead developers and users. As the error message which prompt cdev_add() error already exists, just remove the unnecessary and wrong message. Signed-off-by: Navy Cheng Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index b3e3c2d546a1..8e61a3b3e7e4 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -561,10 +561,8 @@ static int vme_user_probe(struct vme_dev *vdev) vme_user_cdev->ops = &vme_user_fops; vme_user_cdev->owner = THIS_MODULE; err = cdev_add(vme_user_cdev, MKDEV(VME_MAJOR, 0), VME_DEVS); - if (err) { - dev_warn(&vdev->dev, "cdev_all failed\n"); + if (err) goto err_char; - } /* Request slave resources and allocate buffers (128kB wide) */ for (i = SLAVE_MINOR; i < (SLAVE_MAX + 1); i++) { From c9eda12565a7df27bf67af99830923d4887c74b5 Mon Sep 17 00:00:00 2001 From: Stuart Yoder Date: Thu, 6 Aug 2015 20:09:24 -0500 Subject: [PATCH 698/912] staging: fsl-mc: add DPAA2 overview readme add README file providing an overview of the DPAA2 architecture and how it is integrated in Linux Signed-off-by: Stuart Yoder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/README.txt | 364 ++++++++++++++++++++++++++++++ drivers/staging/fsl-mc/TODO | 4 - 2 files changed, 364 insertions(+), 4 deletions(-) create mode 100644 drivers/staging/fsl-mc/README.txt diff --git a/drivers/staging/fsl-mc/README.txt b/drivers/staging/fsl-mc/README.txt new file mode 100644 index 000000000000..8214102f104b --- /dev/null +++ b/drivers/staging/fsl-mc/README.txt @@ -0,0 +1,364 @@ +Copyright (C) 2015 Freescale Semiconductor Inc. + +DPAA2 (Data Path Acceleration Architecture Gen2) +------------------------------------------------ + +This document provides an overview of the Freescale DPAA2 architecture +and how it is integrated into the Linux kernel. + +Contents summary + -DPAA2 overview + -Overview of DPAA2 objects + -DPAA2 Linux driver architecture overview + -bus driver + -dprc driver + -allocator + -dpio driver + -Ethernet + -mac + +DPAA2 Overview +-------------- + +DPAA2 is a hardware architecture designed for high-speeed network +packet processing. DPAA2 consists of sophisticated mechanisms for +processing Ethernet packets, queue management, buffer management, +autonomous L2 switching, virtual Ethernet bridging, and accelerator +(e.g. crypto) sharing. + +A DPAA2 hardware component called the Management Complex (or MC) manages the +DPAA2 hardware resources. The MC provides an object-based abstraction for +software drivers to use the DPAA2 hardware. + +The MC uses DPAA2 hardware resources such as queues, buffer pools, and +network ports to create functional objects/devices such as network +interfaces, an L2 switch, or accelerator instances. + +The MC provides memory-mapped I/O command interfaces (MC portals) +which DPAA2 software drivers use to operate on DPAA2 objects: + + +--------------------------------------+ + | OS | + | DPAA2 drivers | + | | | + +-----------------------------|--------+ + | + | (create,discover,connect + | config,use,destroy) + | + DPAA2 | + +------------------------| mc portal |-+ + | | | + | +- - - - - - - - - - - - -V- - -+ | + | | | | + | | Management Complex (MC) | | + | | | | + | +- - - - - - - - - - - - - - - -+ | + | | + | Hardware Hardware | + | Resources Objects | + | --------- ------- | + | -queues -DPRC | + | -buffer pools -DPMCP | + | -Eth MACs/ports -DPIO | + | -network interface -DPNI | + | profiles -DPMAC | + | -queue portals -DPBP | + | -MC portals ... | + | ... | + | | + +--------------------------------------+ + +The MC mediates operations such as create, discover, +connect, configuration, and destroy. Fast-path operations +on data, such as packet transmit/receive, are not mediated by +the MC and are done directly using memory mapped regions in +DPIO objects. + +Overview of DPAA2 Objects +------------------------- +The section provides a brief overview of some key objects +in the DPAA2 hardware. A simple scenario is described illustrating +the objects involved in creating a network interfaces. + +-DPRC (Datapath Resource Container) + + A DPRC is an container object that holds all the other + types of DPAA2 objects. In the example diagram below there + are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC) + in the container. + + +---------------------------------------------------------+ + | DPRC | + | | + | +-------+ +-------+ +-------+ +-------+ +-------+ | + | | DPMCP | | DPIO | | DPBP | | DPNI | | DPMAC | | + | +-------+ +-------+ +-------+ +---+---+ +---+---+ | + | | DPMCP | | DPIO | | + | +-------+ +-------+ | + | | DPMCP | | + | +-------+ | + | | + +---------------------------------------------------------+ + + From the point of view of an OS, a DPRC is bus-like. Like + a plug-and-play bus, such as PCI, DPRC commands can be used to + enumerate the contents of the DPRC, discover the hardware + objects present (including mappable regions and interrupts). + + dprc.1 (bus) + | + +--+--------+-------+-------+-------+ + | | | | | + dpmcp.1 dpio.1 dpbp.1 dpni.1 dpmac.1 + dpmcp.2 dpio.2 + dpmcp.3 + + Hardware objects can be created and destroyed dynamically, providing + the ability to hot plug/unplug objects in and out of the DPRC. + + A DPRC has a mappable mmio region (an MC portal) that can be used + to send MC commands. It has an interrupt for status events (like + hotplug). + + All objects in a container share the same hardware "isolation context". + This means that with respect to an IOMMU the isolation granularity + is at the DPRC (container) level, not at the individual object + level. + + DPRCs can be defined statically and populated with objects + via a config file passed to the MC when firmware starts + it. There is also a Linux user space tool called "restool" + that can be used to create/destroy containers and objects + dynamically. + +-DPAA2 Objects for an Ethernet Network Interface + + A typical Ethernet NIC is monolithic-- the NIC device contains TX/RX + queuing mechanisms, configuration mechanisms, buffer management, + physical ports, and interrupts. DPAA2 uses a more granular approach + utilizing multiple hardware objects. Each object has specialized + functions, and are used together by software to provide Ethernet network + interface functionality. This approach provides efficient use of finite + hardware resources, flexibility, and performance advantages. + + The diagram below shows the objects needed for a simple + network interface configuration on a system with 2 CPUs. + + +---+---+ +---+---+ + CPU0 CPU1 + +---+---+ +---+---+ + | | + +---+---+ +---+---+ + DPIO DPIO + +---+---+ +---+---+ + \ / + \ / + \ / + +---+---+ + DPNI --- DPBP,DPMCP + +---+---+ + | + | + +---+---+ + DPMAC + +---+---+ + | + port/PHY + + Below the objects are described. For each object a brief description + is provided along with a summary of the kinds of operations the object + supports and a summary of key resources of the object (mmio regions + and irqs). + + -DPMAC (Datapath Ethernet MAC): represents an Ethernet MAC, a + hardware device that connects to an Ethernet PHY and allows + physical transmission and reception of Ethernet frames. + -mmio regions: none + -irqs: dpni link change + -commands: set link up/down, link config, get stats, + irq config, enable, reset + + -DPNI (Datapath Network Interface): contains TX/RX queues, + network interface configuration, and rx buffer pool configuration + mechanisms. + -mmio regions: none + -irqs: link state + -commands: port config, offload config, queue config, + parse/classify config, irq config, enable, reset + + -DPIO (Datapath I/O): provides interfaces to enqueue and dequeue + packets and do hardware buffer pool management operations. For + optimum performance there is typically DPIO per CPU. This allows + each CPU to perform simultaneous enqueue/dequeue operations. + -mmio regions: queue operations, buffer mgmt + -irqs: data availability, congestion notification, buffer + pool depletion + -commands: irq config, enable, reset + + -DPBP (Datapath Buffer Pool): represents a hardware buffer + pool. + -mmio regions: none + -irqs: none + -commands: enable, reset + + -DPMCP (Datapath MC Portal): provides an MC command portal. + Used by drivers to send commands to the MC to manage + objects. + -mmio regions: MC command portal + -irqs: command completion + -commands: irq config, enable, reset + + Object Connections + ------------------ + Some objects have explicit relationships that must + be configured: + + -DPNI <--> DPMAC + -DPNI <--> DPNI + -DPNI <--> L2-switch-port + A DPNI must be connected to something such as a DPMAC, + another DPNI, or L2 switch port. The DPNI connection + is made via a DPRC command. + + +-------+ +-------+ + | DPNI | | DPMAC | + +---+---+ +---+---+ + | | + +==========+ + + -DPNI <--> DPBP + A network interface requires a 'buffer pool' (DPBP + object) which provides a list of pointers to memory + where received Ethernet data is to be copied. The + Ethernet driver configures the DPBPs associated with + the network interface. + + Interrupts + ---------- + All interrupts generated by DPAA2 objects are message + interrupts. At the hardware level message interrupts + generated by devices will normally have 3 components-- + 1) a non-spoofable 'device-id' expressed on the hardware + bus, 2) an address, 3) a data value. + + In the case of DPAA2 devices/objects, all objects in the + same container/DPRC share the same 'device-id'. + For ARM-based SoC this is the same as the stream ID. + + +DPAA2 Linux Driver Overview +--------------------------- + +This section provides an overview of the Linux kernel drivers for +DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure" +drivers and 2) functional object drivers (such as Ethernet). + +As described previously, a DPRC is a container that holds the other +types of DPAA2 objects. It is functionally similar to a plug-and-play +bus controller. + +Each object in the DPRC is a Linux "device" and is bound to a driver. +The diagram below shows the Linux drivers involved in a networking +scenario and the objects bound to each driver. A brief description +of each driver follows. + + +------------+ + | OS Network | + | Stack | + +------------+ +------------+ + | Allocator |. . . . . . . | Ethernet | + |(dpmcp,dpbp)| | (dpni) | + +-.----------+ +---+---+----+ + . . ^ | + . . | | dequeue> + +-------------+ . | | + | DPRC driver | . +---+---V----+ +---------+ + | (dprc) | . . . . . .| DPIO driver| | MAC | + +----------+--+ | (dpio) | | (dpmac) | + | +------+-----+ +-----+---+ + | | | + | | | + +----+--------------+ | +--+---+ + | mc-bus driver | | | PHY | + | | | |driver| + | /fsl-mc@80c000000 | | +--+---+ + +-------------------+ | | + | | + ================================ HARDWARE =========|=================|====== + DPIO | + | | + DPNI---DPBP | + | | + DPMAC | + | | + PHY ---------------+ + ===================================================|======================== + +A brief description of each driver is provided below. + + mc-bus driver + ------------- + The mc-bus driver is a platform driver and is probed from an + "/fsl-mc@xxxx" node in the device tree passed in by boot firmware. + It is responsible for bootstrapping the DPAA2 kernel infrastructure. + Key functions include: + -registering a new bus type named "fsl-mc" with the kernel, + and implementing bus call-backs (e.g. match/uevent/dev_groups) + -implemeting APIs for DPAA2 driver registration and for device + add/remove + -creates an MSI irq domain + -do a device add of the 'root' DPRC device, which is needed + to bootstrap things + + DPRC driver + ----------- + The dprc-driver is bound DPRC objects and does runtime management + of a bus instance. It performs the initial bus scan of the DPRC + and handles interrupts for container events such as hot plug. + + Allocator + ---------- + Certain objects such as DPMCP and DPBP are generic and fungible, + and are intended to be used by other drivers. For example, + the DPAA2 Ethernet driver needs: + -DPMCPs to send MC commands, to configure network interfaces + -DPBPs for network buffer pools + + The allocator driver registers for these allocatable object types + and those objects are bound to the allocator when the bus is probed. + The allocator maintains a pool of objects that are available for + allocation by other DPAA2 drivers. + + DPIO driver + ----------- + The DPIO driver is bound to DPIO objects and provides services that allow + other drivers such as the Ethernet driver to receive and transmit data. + Key services include: + -data availability notifications + -hardware queuing operations (enqueue and dequeue of data) + -hardware buffer pool management + + There is typically one DPIO object per physical CPU for optimum + performance, allowing each CPU to simultaneously enqueue + and dequeue data. + + The DPIO driver operates on behalf of all DPAA2 drivers + active in the kernel-- Ethernet, crypto, compression, + etc. + + Ethernet + -------- + The Ethernet driver is bound to a DPNI and implements the kernel + interfaces needed to connect the DPAA2 network interface to + the network stack. + + Each DPNI corresponds to a Linux network interface. + + MAC driver + ---------- + An Ethernet PHY is an off-chip, board specific component and is managed + by the appropriate PHY driver via an mdio bus. The MAC driver + plays a role of being a proxy between the PHY driver and the + MC. It does this proxy via the MC commands to a DPMAC object. diff --git a/drivers/staging/fsl-mc/TODO b/drivers/staging/fsl-mc/TODO index c29516b4b9b6..389436891b93 100644 --- a/drivers/staging/fsl-mc/TODO +++ b/drivers/staging/fsl-mc/TODO @@ -1,7 +1,3 @@ -* Add README file (with ASCII art) describing relationships between - DPAA2 objects and how combine them to make a NIC, an LS2 switch, etc. - Also, define all acronyms used. - * Decide if multiple root fsl-mc buses will be supported per Linux instance, and if so add support for this. From 66a84f8ae131a7111ce8a6b0a77edf42b2c01d6c Mon Sep 17 00:00:00 2001 From: Miguel Bernabeu Diaz Date: Wed, 5 Aug 2015 23:43:08 +0200 Subject: [PATCH 699/912] staging: lustre: Unnecessary line continuation Fix checkpatch.pl warning: WARNING: Avoid unnecessary line continuations Signed-off-by: Miguel Bernabeu Diaz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 477aa8b76f32..5a8ebe1b3c84 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -3133,8 +3133,7 @@ kiblnd_connd(void *arg) dropped_lock = 0; if (!list_empty(&kiblnd_data.kib_connd_zombies)) { - conn = list_entry(kiblnd_data. \ - kib_connd_zombies.next, + conn = list_entry(kiblnd_data.kib_connd_zombies.next, kib_conn_t, ibc_list); list_del(&conn->ibc_list); From e39f6efaa1d9203527683213a1cf039c4d6c29aa Mon Sep 17 00:00:00 2001 From: Miguel Bernabeu Diaz Date: Wed, 5 Aug 2015 23:44:36 +0200 Subject: [PATCH 700/912] staging: lustre: Fix code indent error Fix checkpatch.pl error: ERROR: code indent should use tabs where possible Signed-off-by: Miguel Bernabeu Diaz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index f429d25306c1..24b2c978dfb6 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1390,7 +1390,7 @@ static int kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, .max_pages_per_fmr = LNET_MAX_PAYLOAD/PAGE_SIZE, .page_shift = PAGE_SHIFT, .access = (IB_ACCESS_LOCAL_WRITE | - IB_ACCESS_REMOTE_WRITE), + IB_ACCESS_REMOTE_WRITE), .pool_size = fps->fps_pool_size, .dirty_watermark = fps->fps_flush_trigger, .flush_function = NULL, From 83b912c67b0b42af7bb7cbcb9d4fdb64bcd8dc65 Mon Sep 17 00:00:00 2001 From: Miguel Bernabeu Diaz Date: Wed, 5 Aug 2015 23:45:50 +0200 Subject: [PATCH 701/912] staging: lustre: Fix space before '++' error Fix checkpatch.pl error: ERROR: space prohibited before that '++' (ctx:WxO) Signed-off-by: Miguel Bernabeu Diaz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 8bc05770382c..e676e8adfc33 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -887,7 +887,7 @@ kiblnd_rd_consume_frag(kib_rdma_desc_t *rd, int index, __u32 nob) rd->rd_frags[index].rf_addr += nob; rd->rd_frags[index].rf_nob -= nob; } else { - index ++; + index++; } return index; From 270f0c31b47eeedee7d6c538c0f5753df24a7726 Mon Sep 17 00:00:00 2001 From: Miguel Bernabeu Diaz Date: Wed, 5 Aug 2015 23:47:41 +0200 Subject: [PATCH 702/912] staging: lustre: Fix space before '(' warnings Fix several instances of checkpatch.pl warning: WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Miguel Bernabeu Diaz Signed-off-by: Greg Kroah-Hartman --- .../lustre/lnet/klnds/o2iblnd/o2iblnd.h | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index e676e8adfc33..71c37e476c9b 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -519,7 +519,7 @@ typedef struct kib_rx /* receive message */ enum ib_wc_status rx_status; /* completion status */ kib_msg_t *rx_msg; /* message buffer (host vaddr) */ __u64 rx_msgaddr; /* message buffer (I/O addr) */ - DECLARE_PCI_UNMAP_ADDR (rx_msgunmap); /* for dma_unmap_single() */ + DECLARE_PCI_UNMAP_ADDR(rx_msgunmap); /* for dma_unmap_single() */ struct ib_recv_wr rx_wrq; /* receive work item... */ struct ib_sge rx_sge; /* ...and its memory */ } kib_rx_t; @@ -546,7 +546,7 @@ typedef struct kib_tx /* transmit message */ * completion */ kib_msg_t *tx_msg; /* message buffer (host vaddr) */ __u64 tx_msgaddr; /* message buffer (I/O addr) */ - DECLARE_PCI_UNMAP_ADDR (tx_msgunmap); /* for dma_unmap_single() */ + DECLARE_PCI_UNMAP_ADDR(tx_msgunmap); /* for dma_unmap_single() */ int tx_nwrq; /* # send work items */ struct ib_send_wr *tx_wrq; /* send work items... */ struct ib_sge *tx_sge; /* ...and their memory */ @@ -647,14 +647,14 @@ extern void kiblnd_hdev_destroy(kib_hca_dev_t *hdev); static inline void kiblnd_hdev_addref_locked(kib_hca_dev_t *hdev) { - LASSERT (atomic_read(&hdev->ibh_ref) > 0); + LASSERT(atomic_read(&hdev->ibh_ref) > 0); atomic_inc(&hdev->ibh_ref); } static inline void kiblnd_hdev_decref(kib_hca_dev_t *hdev) { - LASSERT (atomic_read(&hdev->ibh_ref) > 0); + LASSERT(atomic_read(&hdev->ibh_ref) > 0); if (atomic_dec_and_test(&hdev->ibh_ref)) kiblnd_hdev_destroy(hdev); } @@ -701,7 +701,7 @@ do { \ do { \ CDEBUG(D_NET, "peer[%p] -> %s (%d)++\n", \ (peer), libcfs_nid2str((peer)->ibp_nid), \ - atomic_read (&(peer)->ibp_refcount)); \ + atomic_read(&(peer)->ibp_refcount)); \ atomic_inc(&(peer)->ibp_refcount); \ } while (0) @@ -709,14 +709,14 @@ do { \ do { \ CDEBUG(D_NET, "peer[%p] -> %s (%d)--\n", \ (peer), libcfs_nid2str((peer)->ibp_nid), \ - atomic_read (&(peer)->ibp_refcount)); \ + atomic_read(&(peer)->ibp_refcount)); \ LASSERT_ATOMIC_POS(&(peer)->ibp_refcount); \ if (atomic_dec_and_test(&(peer)->ibp_refcount)) \ kiblnd_destroy_peer(peer); \ } while (0) static inline struct list_head * -kiblnd_nid2peerlist (lnet_nid_t nid) +kiblnd_nid2peerlist(lnet_nid_t nid) { unsigned int hash = ((unsigned int)nid) % kiblnd_data.kib_peer_hash_size; @@ -725,16 +725,16 @@ kiblnd_nid2peerlist (lnet_nid_t nid) } static inline int -kiblnd_peer_active (kib_peer_t *peer) +kiblnd_peer_active(kib_peer_t *peer) { /* Am I in the peer hash table? */ return (!list_empty(&peer->ibp_list)); } static inline kib_conn_t * -kiblnd_get_conn_locked (kib_peer_t *peer) +kiblnd_get_conn_locked(kib_peer_t *peer) { - LASSERT (!list_empty(&peer->ibp_conns)); + LASSERT(!list_empty(&peer->ibp_conns)); /* just return the first connection */ return list_entry(peer->ibp_conns.next, kib_conn_t, ibc_list); @@ -751,7 +751,7 @@ kiblnd_send_keepalive(kib_conn_t *conn) static inline int kiblnd_need_noop(kib_conn_t *conn) { - LASSERT (conn->ibc_state >= IBLND_CONN_ESTABLISHED); + LASSERT(conn->ibc_state >= IBLND_CONN_ESTABLISHED); if (conn->ibc_outstanding_credits < IBLND_CREDITS_HIGHWATER(conn->ibc_version) && @@ -788,7 +788,7 @@ kiblnd_abort_receives(kib_conn_t *conn) } static inline const char * -kiblnd_queue2str (kib_conn_t *conn, struct list_head *q) +kiblnd_queue2str(kib_conn_t *conn, struct list_head *q) { if (q == &conn->ibc_tx_queue) return "tx_queue"; @@ -815,43 +815,43 @@ kiblnd_queue2str (kib_conn_t *conn, struct list_head *q) #define IBLND_WID_MASK 3UL static inline __u64 -kiblnd_ptr2wreqid (void *ptr, int type) +kiblnd_ptr2wreqid(void *ptr, int type) { unsigned long lptr = (unsigned long)ptr; - LASSERT ((lptr & IBLND_WID_MASK) == 0); - LASSERT ((type & ~IBLND_WID_MASK) == 0); + LASSERT((lptr & IBLND_WID_MASK) == 0); + LASSERT((type & ~IBLND_WID_MASK) == 0); return (__u64)(lptr | type); } static inline void * -kiblnd_wreqid2ptr (__u64 wreqid) +kiblnd_wreqid2ptr(__u64 wreqid) { return (void *)(((unsigned long)wreqid) & ~IBLND_WID_MASK); } static inline int -kiblnd_wreqid2type (__u64 wreqid) +kiblnd_wreqid2type(__u64 wreqid) { return (wreqid & IBLND_WID_MASK); } static inline void -kiblnd_set_conn_state (kib_conn_t *conn, int state) +kiblnd_set_conn_state(kib_conn_t *conn, int state) { conn->ibc_state = state; mb(); } static inline void -kiblnd_init_msg (kib_msg_t *msg, int type, int body_nob) +kiblnd_init_msg(kib_msg_t *msg, int type, int body_nob) { msg->ibm_type = type; msg->ibm_nob = offsetof(kib_msg_t, ibm_u) + body_nob; } static inline int -kiblnd_rd_size (kib_rdma_desc_t *rd) +kiblnd_rd_size(kib_rdma_desc_t *rd) { int i; int size; @@ -896,8 +896,8 @@ kiblnd_rd_consume_frag(kib_rdma_desc_t *rd, int index, __u32 nob) static inline int kiblnd_rd_msg_size(kib_rdma_desc_t *rd, int msgtype, int n) { - LASSERT (msgtype == IBLND_MSG_GET_REQ || - msgtype == IBLND_MSG_PUT_ACK); + LASSERT(msgtype == IBLND_MSG_GET_REQ || + msgtype == IBLND_MSG_PUT_ACK); return msgtype == IBLND_MSG_GET_REQ ? offsetof(kib_get_msg_t, ibgm_rd.rd_frags[n]) : @@ -982,53 +982,53 @@ int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr); void kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr); -int kiblnd_startup (lnet_ni_t *ni); -void kiblnd_shutdown (lnet_ni_t *ni); -int kiblnd_ctl (lnet_ni_t *ni, unsigned int cmd, void *arg); -void kiblnd_query (struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when); +int kiblnd_startup(lnet_ni_t *ni); +void kiblnd_shutdown(lnet_ni_t *ni); +int kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg); +void kiblnd_query(struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when); int kiblnd_tunables_init(void); void kiblnd_tunables_fini(void); -int kiblnd_connd (void *arg); +int kiblnd_connd(void *arg); int kiblnd_scheduler(void *arg); int kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name); -int kiblnd_failover_thread (void *arg); +int kiblnd_failover_thread(void *arg); int kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages); -void kiblnd_free_pages (kib_pages_t *p); +void kiblnd_free_pages(kib_pages_t *p); int kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event); int kiblnd_translate_mtu(int value); int kiblnd_dev_failover(kib_dev_t *dev); -int kiblnd_create_peer (lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid); -void kiblnd_destroy_peer (kib_peer_t *peer); -void kiblnd_destroy_dev (kib_dev_t *dev); -void kiblnd_unlink_peer_locked (kib_peer_t *peer); -void kiblnd_peer_alive (kib_peer_t *peer); -kib_peer_t *kiblnd_find_peer_locked (lnet_nid_t nid); -void kiblnd_peer_connect_failed (kib_peer_t *peer, int active, int error); -int kiblnd_close_stale_conns_locked (kib_peer_t *peer, +int kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid); +void kiblnd_destroy_peer(kib_peer_t *peer); +void kiblnd_destroy_dev(kib_dev_t *dev); +void kiblnd_unlink_peer_locked(kib_peer_t *peer); +void kiblnd_peer_alive(kib_peer_t *peer); +kib_peer_t *kiblnd_find_peer_locked(lnet_nid_t nid); +void kiblnd_peer_connect_failed(kib_peer_t *peer, int active, int error); +int kiblnd_close_stale_conns_locked(kib_peer_t *peer, int version, __u64 incarnation); -int kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why); +int kiblnd_close_peer_conns_locked(kib_peer_t *peer, int why); void kiblnd_connreq_done(kib_conn_t *conn, int status); -kib_conn_t *kiblnd_create_conn (kib_peer_t *peer, struct rdma_cm_id *cmid, +kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, int state, int version); -void kiblnd_destroy_conn (kib_conn_t *conn); -void kiblnd_close_conn (kib_conn_t *conn, int error); -void kiblnd_close_conn_locked (kib_conn_t *conn, int error); +void kiblnd_destroy_conn(kib_conn_t *conn); +void kiblnd_close_conn(kib_conn_t *conn, int error); +void kiblnd_close_conn_locked(kib_conn_t *conn, int error); -int kiblnd_init_rdma (kib_conn_t *conn, kib_tx_t *tx, int type, +int kiblnd_init_rdma(kib_conn_t *conn, kib_tx_t *tx, int type, int nob, kib_rdma_desc_t *dstrd, __u64 dstcookie); -void kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid); -void kiblnd_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn); -void kiblnd_queue_tx (kib_tx_t *tx, kib_conn_t *conn); -void kiblnd_init_tx_msg (lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob); -void kiblnd_txlist_done (lnet_ni_t *ni, struct list_head *txlist, +void kiblnd_launch_tx(lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid); +void kiblnd_queue_tx_locked(kib_tx_t *tx, kib_conn_t *conn); +void kiblnd_queue_tx(kib_tx_t *tx, kib_conn_t *conn); +void kiblnd_init_tx_msg(lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob); +void kiblnd_txlist_done(lnet_ni_t *ni, struct list_head *txlist, int status); void kiblnd_check_sends (kib_conn_t *conn); @@ -1036,10 +1036,10 @@ void kiblnd_qp_event(struct ib_event *event, void *arg); void kiblnd_cq_event(struct ib_event *event, void *arg); void kiblnd_cq_completion(struct ib_cq *cq, void *arg); -void kiblnd_pack_msg (lnet_ni_t *ni, kib_msg_t *msg, int version, +void kiblnd_pack_msg(lnet_ni_t *ni, kib_msg_t *msg, int version, int credits, lnet_nid_t dstnid, __u64 dststamp); int kiblnd_unpack_msg(kib_msg_t *msg, int nob); -int kiblnd_post_rx (kib_rx_t *rx, int credit); +int kiblnd_post_rx(kib_rx_t *rx, int credit); int kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg); int kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, From 276479ff684792fefadec795afd1cb84a81dc8e5 Mon Sep 17 00:00:00 2001 From: Miguel Bernabeu Diaz Date: Wed, 5 Aug 2015 23:48:48 +0200 Subject: [PATCH 703/912] staging: lustre: Fix space before '[' error Fix checkpatch.pl error: ERROR: space prohibited before open square bracket '[' Signed-off-by: Miguel Bernabeu Diaz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 71c37e476c9b..92fbd6d3c7a9 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -721,7 +721,7 @@ kiblnd_nid2peerlist(lnet_nid_t nid) unsigned int hash = ((unsigned int)nid) % kiblnd_data.kib_peer_hash_size; - return (&kiblnd_data.kib_peers [hash]); + return (&kiblnd_data.kib_peers[hash]); } static inline int From 8a1d7b09e7e3c2c7097712331ac64ccfdbcf8f6d Mon Sep 17 00:00:00 2001 From: Miguel Bernabeu Diaz Date: Wed, 5 Aug 2015 23:49:57 +0200 Subject: [PATCH 704/912] Staging: lustre: lnet: Remove unnecessary parentheses on return Removed three instances of parentheses in return calls that are unnecessary and do not contribute to readability. Signed-off-by: Miguel Bernabeu Diaz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 92fbd6d3c7a9..2991be85d8b3 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -721,14 +721,14 @@ kiblnd_nid2peerlist(lnet_nid_t nid) unsigned int hash = ((unsigned int)nid) % kiblnd_data.kib_peer_hash_size; - return (&kiblnd_data.kib_peers[hash]); + return &kiblnd_data.kib_peers[hash]; } static inline int kiblnd_peer_active(kib_peer_t *peer) { /* Am I in the peer hash table? */ - return (!list_empty(&peer->ibp_list)); + return !list_empty(&peer->ibp_list); } static inline kib_conn_t * @@ -833,7 +833,7 @@ kiblnd_wreqid2ptr(__u64 wreqid) static inline int kiblnd_wreqid2type(__u64 wreqid) { - return (wreqid & IBLND_WID_MASK); + return wreqid & IBLND_WID_MASK; } static inline void From 5dab10f444774dd119e3c370cd332df9c1c646c7 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:14 -0700 Subject: [PATCH 705/912] staging: rtl8712: fix buggy size calculation r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)" where the underlying struct has a 6 * unsigned char. Simplify the calculation by just subtracting the variable part from the size of the struct. This also gets rid of a use of typedef NDIS_802_11_RATES_EX Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_mlme.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index c044b0e55ba9..6b3451f7017b 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss) uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss) { - uint t_len; - - t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 2 + - sizeof(struct ndis_802_11_ssid) + sizeof(u32) + - sizeof(s32) + - sizeof(enum NDIS_802_11_NETWORK_TYPE) + - sizeof(struct NDIS_802_11_CONFIGURATION) + - sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) + - sizeof(NDIS_802_11_RATES_EX) + - sizeof(u32) + bss->IELength; - return t_len; + return sizeof(*bss) + bss->IELength - MAX_IE_SZ; } u8 *r8712_get_capability_from_ie(u8 *ie) From 5fd93ddf32f3ae77e66bee9c341036e03dd389ae Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 17:34:02 +0530 Subject: [PATCH 706/912] staging: sm750fb: remove multiple blank line Multiple blank lines are not kernel coding style and so checkpatch complains. Remove them. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index c7ab8189671f..8990ff499332 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -26,7 +26,6 @@ int smi_indent; - /* * #ifdef __BIG_ENDIAN * ssize_t lynxfb_ops_write(struct fb_info *info, const char __user *buf, @@ -40,7 +39,6 @@ typedef void (*PROC_SPEC_SETUP)(struct lynx_share*, char *); typedef int (*PROC_SPEC_MAP)(struct lynx_share*, struct pci_dev*); typedef int (*PROC_SPEC_INITHW)(struct lynx_share*, struct pci_dev*); - /* common var for all device */ static int g_hwcursor = 1; static int g_noaccel; @@ -51,7 +49,6 @@ static char *g_settings; static int g_dualview; static char *g_option; - static const struct fb_videomode lynx750_ext[] = { /* 1024x600-60 VESA [1.71:1] */ {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3, @@ -115,8 +112,6 @@ static const struct fb_videomode lynx750_ext[] = { }; - - /* no hardware cursor supported under version 2.6.10, kernel bug */ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) { @@ -160,7 +155,6 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) cursor->setColor(cursor, fg, bg); } - if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) { cursor->setData(cursor, fbcursor->rop, @@ -300,7 +294,6 @@ static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, struct lynxfb_crtc *crtc; int ret; - if (!info) return -EINVAL; @@ -466,7 +459,6 @@ static int lynxfb_resume(struct pci_dev *pdev) int ret; - ret = 0; share = pci_get_drvdata(pdev); @@ -478,7 +470,6 @@ static int lynxfb_resume(struct pci_dev *pdev) return ret; } - if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { pci_restore_state(pdev); ret = pci_enable_device(pdev); @@ -493,7 +484,6 @@ static int lynxfb_resume(struct pci_dev *pdev) hw_sm750_inithw(share, pdev); - info = share->fbinfo[0]; if (info) { @@ -518,7 +508,6 @@ static int lynxfb_resume(struct pci_dev *pdev) fb_set_suspend(info, 0); } - console_unlock(); return ret; } @@ -534,7 +523,6 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, int ret; resource_size_t request; - par = info->par; crtc = &par->crtc; output = &par->output; @@ -546,7 +534,6 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, var->yres, var->bits_per_pixel); - switch (var->bits_per_pixel) { case 8: case 16: @@ -617,7 +604,6 @@ exit: return ret; } - static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, unsigned green, @@ -652,7 +638,6 @@ static int lynxfb_ops_setcolreg(unsigned regno, goto exit; } - if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256) { u32 val; @@ -782,7 +767,6 @@ static struct fb_ops lynxfb_ops = { .fb_cursor = lynxfb_ops_cursor, }; - static int lynxfb_set_fbinfo(struct fb_info *info, int index) { int i; @@ -803,7 +787,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) "kernel HELPERS prepared vesa_modes", }; - static const char *fixId[2] = { "sm750_fb1", "sm750_fb2", }; @@ -824,7 +807,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) sm750fb_set_drv(par); lynxfb_ops.fb_pan_display = lynxfb_ops_pan_display; - /* set current cursor variable and proc pointer, * must be set after crtc member initialized */ crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024; @@ -841,7 +823,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) crtc->cursor.setData = hw_cursor_setData; crtc->cursor.vstart = share->pvMem + crtc->cursor.offset; - crtc->cursor.share = share; memset_io(crtc->cursor.vstart, 0, crtc->cursor.size); if (!g_hwcursor) { @@ -849,7 +830,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) crtc->cursor.disable(&crtc->cursor); } - /* set info->fbops, must be set before fb_find_mode */ if (!share->accel_off) { /* use 2d acceleration */ @@ -865,7 +845,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) g_fbmode[index] = g_fbmode[0]; } - for (i = 0; i < 3; i++) { ret = fb_find_mode(var, info, g_fbmode[index], @@ -935,7 +914,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) strlcpy(fix->id, fixId[index], sizeof(fix->id)); - fix->smem_start = crtc->oScreen + share->vidmem_start; pr_info("fix->smem_start = %lx\n", fix->smem_start); /* according to mmap experiment from user space application, @@ -998,7 +976,6 @@ static void sm750fb_setup(struct lynx_share *share, char *src) #endif int swap; - spec_share = container_of(share, struct sm750_share, share); #ifdef CAP_EXPENSIION exp_res = NULL; @@ -1096,7 +1073,6 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, size_t spec_offset = 0; int fbidx; - /* enable device */ if (pci_enable_device(pdev)) { pr_err("can not enable device.\n"); @@ -1268,7 +1244,6 @@ static int __init lynxfb_setup(char *options) int len; char *opt, *tmp; - if (!options || !*options) { pr_warn("no options.\n"); return 0; @@ -1332,7 +1307,6 @@ static struct pci_driver lynxfb_driver = { #endif }; - static int __init lynxfb_init(void) { char *option; From 13ef3458227d4095a4f86270b1f29690dfc248bd Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 17:34:03 +0530 Subject: [PATCH 707/912] staging: sm750fb: space around operator Kernel coding style says to have a space around the operators. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 8990ff499332..c16b2934fec7 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -144,12 +144,12 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) /* get the 16bit color of kernel means */ u16 fg, bg; - fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800))| - ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5)| + fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800)) | + ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5) | ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11); - bg = ((info->cmap.red[fbcursor->image.bg_color] & 0xf800))| - ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5)| + bg = ((info->cmap.red[fbcursor->image.bg_color] & 0xf800)) | + ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5) | ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11); cursor->setColor(cursor, fg, bg); @@ -188,8 +188,9 @@ static void lynxfb_ops_fillrect(struct fb_info *info, pitch = info->fix.line_length; Bpp = info->var.bits_per_pixel >> 3; - color = (Bpp == 1)?region->color:((u32 *)info->pseudo_palette)[region->color]; - rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR:HW_ROP2_COPY; + color = (Bpp == 1) ? region->color : + ((u32 *)info->pseudo_palette)[region->color]; + rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR : HW_ROP2_COPY; /* * If not use spin_lock,system will die if user load driver @@ -278,7 +279,7 @@ _do_work: spin_lock(&share->slock); share->accel.de_imageblit(&share->accel, - image->data, image->width>>3, 0, + image->data, image->width >> 3, 0, base, pitch, Bpp, image->dx, image->dy, image->width, image->height, @@ -684,7 +685,8 @@ static int sm750fb_set_drv(struct lynxfb_par *par) output = &par->output; crtc = &par->crtc; - crtc->vidmem_size = (share->dual)?share->vidmem_size>>1:share->vidmem_size; + crtc->vidmem_size = (share->dual) ? share->vidmem_size >> 1 : + share->vidmem_size; /* setup crtc and output member */ spec_share->hwCursor = g_hwcursor; @@ -701,10 +703,12 @@ static int sm750fb_set_drv(struct lynxfb_par *par) output->proc_setMode = hw_sm750_output_setMode; output->proc_checkMode = hw_sm750_output_checkMode; - output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_setBLANK:hw_sm750_setBLANK; + output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID) ? + hw_sm750le_setBLANK : hw_sm750_setBLANK; output->clear = hw_sm750_output_clear; /* chip specific phase */ - share->accel.de_wait = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_deWait : hw_sm750_deWait; + share->accel.de_wait = (share->revid == SM750LE_REVISION_ID) ? + hw_sm750le_deWait : hw_sm750_deWait; switch (spec_share->state.dataflow) { case sm750_simul_pri: output->paths = sm750_pnc; @@ -814,7 +818,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio); crtc->cursor.maxH = crtc->cursor.maxW = 64; - crtc->cursor.size = crtc->cursor.maxH*crtc->cursor.maxW*2/8; + crtc->cursor.size = crtc->cursor.maxH * crtc->cursor.maxW * 2 / 8; crtc->cursor.disable = hw_cursor_disable; crtc->cursor.enable = hw_cursor_enable; crtc->cursor.setColor = hw_cursor_setColor; @@ -896,13 +900,13 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) /* set info */ line_length = PADDING(crtc->line_pad, - (var->xres_virtual * var->bits_per_pixel/8)); + (var->xres_virtual * var->bits_per_pixel / 8)); info->pseudo_palette = &par->pseudo_palette[0]; info->screen_base = crtc->vScreen; pr_debug("screen_base vaddr = %p\n", info->screen_base); info->screen_size = line_length * var->yres_virtual; - info->flags = FBINFO_FLAG_DEFAULT|0; + info->flags = FBINFO_FLAG_DEFAULT | 0; /* set info->fix */ fix->type = FB_TYPE_PACKED_PIXELS; From d11ac7cbcc266c6c2a6ae504e070b6dc4536c1f7 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 17:34:04 +0530 Subject: [PATCH 708/912] staging: sm750fb: fix multiline comment Multiline comments are edited to be in the kernel coding style. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 63 ++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index c16b2934fec7..fa2183d33bda 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -182,8 +182,10 @@ static void lynxfb_ops_fillrect(struct fb_info *info, par = info->par; share = par->share; - /* each time 2d function begin to work,below three variable always need - * be set, seems we can put them together in some place */ + /* + * each time 2d function begin to work,below three variable always need + * be set, seems we can put them together in some place + */ base = par->crtc.oScreen; pitch = info->fix.line_length; Bpp = info->var.bits_per_pixel >> 3; @@ -218,8 +220,10 @@ static void lynxfb_ops_copyarea(struct fb_info *info, par = info->par; share = par->share; - /* each time 2d function begin to work,below three variable always need - * be set, seems we can put them together in some place */ + /* + * each time 2d function begin to work,below three variable always need + * be set, seems we can put them together in some place + */ base = par->crtc.oScreen; pitch = info->fix.line_length; Bpp = info->var.bits_per_pixel >> 3; @@ -249,8 +253,10 @@ static void lynxfb_ops_imageblit(struct fb_info *info, par = info->par; share = par->share; - /* each time 2d function begin to work,below three variable always need - * be set, seems we can put them together in some place */ + /* + * each time 2d function begin to work,below three variable always need + * be set, seems we can put them together in some place + */ base = par->crtc.oScreen; pitch = info->fix.line_length; Bpp = info->var.bits_per_pixel >> 3; @@ -334,9 +340,10 @@ static int lynxfb_ops_set_par(struct fb_info *info) fix->line_length = line_length; pr_info("fix->line_length = %d\n", fix->line_length); - /* var->red,green,blue,transp are need to be set by driver + /* + * var->red,green,blue,transp are need to be set by driver * and these data should be set before setcolreg routine - * */ + */ switch (var->bits_per_pixel) { case 8: @@ -811,8 +818,10 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) sm750fb_set_drv(par); lynxfb_ops.fb_pan_display = lynxfb_ops_pan_display; - /* set current cursor variable and proc pointer, - * must be set after crtc member initialized */ + /* + * set current cursor variable and proc pointer, + * must be set after crtc member initialized + */ crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024; crtc->cursor.mmio = share->pvReg + 0x800f0 + (int)crtc->channel * 0x140; @@ -920,12 +929,13 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) fix->smem_start = crtc->oScreen + share->vidmem_start; pr_info("fix->smem_start = %lx\n", fix->smem_start); - /* according to mmap experiment from user space application, + /* + * according to mmap experiment from user space application, * fix->mmio_len should not larger than virtual size * (xres_virtual x yres_virtual x ByPP) * Below line maybe buggy when user mmap fb dev node and write * data into the bound over virtual size - * */ + */ fix->smem_len = crtc->vidmem_size; pr_info("fix->smem_len = %x\n", fix->smem_len); info->screen_size = fix->smem_len; @@ -1083,8 +1093,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, goto err_enable; } - /* though offset of share in sm750_share is 0, - * we use this marcro as the same */ + /* + * though offset of share in sm750_share is 0, + * we use this marcro as the same + */ spec_offset = offsetof(struct sm750_share, share); spec_share = kzalloc(sizeof(*spec_share), GFP_KERNEL); @@ -1108,10 +1120,12 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, spin_lock_init(&share->slock); if (!share->accel_off) { - /* hook deInit and 2d routines, notes that below hw_xxx + /* + * hook deInit and 2d routines, notes that below hw_xxx * routine can work on most of lynx chips * if some chip need specific function, - * please hook it in smXXX_set_drv routine */ + * please hook it in smXXX_set_drv routine + */ share->accel.de_init = hw_de_init; share->accel.de_fillrect = hw_fillrect; share->accel.de_copyarea = hw_copyarea; @@ -1262,14 +1276,15 @@ static int __init lynxfb_setup(char *options) tmp = g_settings; - /* Notes: - char * strsep(char **s,const char * ct); - @s: the string to be searched - @ct :the characters to search for - - strsep() updates @options to pointer after the first found token - it also returns the pointer ahead the token. - */ + /* + * Notes: + * char * strsep(char **s,const char * ct); + * @s: the string to be searched + * @ct :the characters to search for + * + * strsep() updates @options to pointer after the first found token + * it also returns the pointer ahead the token. + */ while ((opt = strsep(&options, ":")) != NULL) { /* options that mean for any lynx chips are configured here */ if (!strncmp(opt, "noaccel", strlen("noaccel"))) From f8fbc838f4b2cd72da11568b09b956806b98c29e Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 17:34:05 +0530 Subject: [PATCH 709/912] staging: sm750fb: rearrange code Rearrange the code to remove one exit label which also makes the code less indented and more readable. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index fa2183d33bda..e7fad0f2cdf8 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -261,22 +261,21 @@ static void lynxfb_ops_imageblit(struct fb_info *info, pitch = info->fix.line_length; Bpp = info->var.bits_per_pixel >> 3; - if (image->depth == 1) { - if (info->fix.visual == FB_VISUAL_TRUECOLOR || - info->fix.visual == FB_VISUAL_DIRECTCOLOR) { - fgcol = ((u32 *)info->pseudo_palette)[image->fg_color]; - bgcol = ((u32 *)info->pseudo_palette)[image->bg_color]; - } else { - fgcol = image->fg_color; - bgcol = image->bg_color; - } - goto _do_work; - } /* TODO: Implement hardware acceleration for image->depth > 1 */ - cfb_imageblit(info, image); - return; + if (image->depth != 1) { + cfb_imageblit(info, image); + return; + } + + if (info->fix.visual == FB_VISUAL_TRUECOLOR || + info->fix.visual == FB_VISUAL_DIRECTCOLOR) { + fgcol = ((u32 *)info->pseudo_palette)[image->fg_color]; + bgcol = ((u32 *)info->pseudo_palette)[image->bg_color]; + } else { + fgcol = image->fg_color; + bgcol = image->bg_color; + } -_do_work: /* * If not use spin_lock, system will die if user load driver * and immediately unload driver frequently (dual) From 4063ea9af6d287975732a0c992e7fe870591d365 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 17:34:06 +0530 Subject: [PATCH 710/912] staging: sm750fb: simplify return Lets return the return value directly instead of using a variable to store the result. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index e7fad0f2cdf8..07f8afd2defe 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -298,17 +298,13 @@ static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, { struct lynxfb_par *par; struct lynxfb_crtc *crtc; - int ret; if (!info) return -EINVAL; - ret = 0; par = info->par; crtc = &par->crtc; - ret = crtc->proc_panDisplay(crtc, var, info); - - return ret; + return crtc->proc_panDisplay(crtc, var, info); } static int lynxfb_ops_set_par(struct fb_info *info) From 881edf67b26813f91288790bbb575c570b9de901 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:15 -0700 Subject: [PATCH 711/912] staging: rtl8712: simplify size calculation replace item-by-item size calculation of a struct with the size of the struct. This gets rid of a use of typedef NDIS_802_11_RATES_EX Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_cmd.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index e35854d28f90..f07050ddd82d 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter) u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) { - uint t_len = 0; struct ndis_wlan_bssid_ex *psecnetwork; struct cmd_obj *pcmd; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; @@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC); if (pcmd == NULL) return _FAIL; - t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 + - sizeof(struct ndis_802_11_ssid) + sizeof(u32) + - sizeof(s32) + - sizeof(enum NDIS_802_11_NETWORK_TYPE) + - sizeof(struct NDIS_802_11_CONFIGURATION) + - sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) + - sizeof(NDIS_802_11_RATES_EX) + - sizeof(u32) + MAX_IE_SZ; /* for hidden ap to set fw_state here */ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != @@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) kfree(pcmd); return _FAIL; } - memcpy(psecnetwork, &pnetwork->network, t_len); + memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork)); psecuritypriv->authenticator_ie[0] = (unsigned char) psecnetwork->IELength; if ((psecnetwork->IELength-12) < (256 - 1)) From 9bdb70ecddd4441be8818ab2f6cbea269c84b3fb Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:16 -0700 Subject: [PATCH 712/912] staging: rtl8712: fix comment The old comment refers to a typedef name which is being removed, and to a style of calculation which is no longer being used. It falsely states that IELength is variable length, instead of IEs. Change comment to simply state that the IEs field is a buffer of variable size and that IELength refers to the current size. Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/wlan_bssdef.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/staging/rtl8712/wlan_bssdef.h b/drivers/staging/rtl8712/wlan_bssdef.h index 2ea8a3d6b705..8c5d6e7f82d2 100644 --- a/drivers/staging/rtl8712/wlan_bssdef.h +++ b/drivers/staging/rtl8712/wlan_bssdef.h @@ -83,17 +83,6 @@ struct NDIS_802_11_FIXED_IEs { u16 Capabilities; }; -/* - * Length is the 4 bytes multiples of the sume of - * 6 * sizeof (unsigned char) + 2 + sizeof (ndis_802_11_ssid) + sizeof (u32) - * + sizeof (s32) + sizeof (NDIS_802_11_NETWORK_TYPE) - * + sizeof (struct NDIS_802_11_CONFIGURATION) - * + sizeof (NDIS_802_11_RATES_EX) + IELength - - * Except the IELength, all other fields are fixed length. Therefore, we can - * define a macro to present the partial sum. - */ - struct ndis_wlan_bssid_ex { u32 Length; unsigned char MacAddress[6]; @@ -105,6 +94,7 @@ struct ndis_wlan_bssid_ex { struct NDIS_802_11_CONFIGURATION Configuration; enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; NDIS_802_11_RATES_EX SupportedRates; + /* number of content bytes in EIs, which varies */ u32 IELength; /*(timestamp, beacon interval, and capability information) */ u8 IEs[MAX_IE_SZ]; From ebe92393cac834c89c774f93d92c8118b69e6016 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:17 -0700 Subject: [PATCH 713/912] staging: rtl8712: removed unused wrapper structs Remove wrapper structs that just wrap struct ndis_wlan_bssid_ex, and are unused. Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_cmd.h | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index cb8225b94cf1..818cd8807a38 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -122,15 +122,6 @@ struct usb_suspend_parm { u32 action; /* 1: sleep, 0:resume */ }; -/* - * Caller Mode: Infra, Ad-Hoc - * Notes: To join the specified bss - * Command Event Mode - */ -struct joinbss_parm { - struct ndis_wlan_bssid_ex network; -}; - /* * Caller Mode: Infra, Ad-HoC(C) * Notes: To disconnect the current associated BSS @@ -140,15 +131,6 @@ struct disconnect_parm { u32 rsvd; }; -/* - * Caller Mode: AP, Ad-HoC(M) - * Notes: To create a BSS - * Command Mode - */ -struct createbss_parm { - struct ndis_wlan_bssid_ex network; -}; - /* * Caller Mode: AP, Ad-HoC, Infra * Notes: To set the NIC mode of RTL8711 From 44367877c6c5048ac352c529c63ce0698c1ddd5c Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:18 -0700 Subject: [PATCH 714/912] staging: rtl8712: remove duplicate struct struct ndis_wlan_bssid_ex is a doppelganger of struct wlan_bssid_ex, and is used about a third as often. Switch all instances to wlan_bssid_ex, and remove ndis_wlan_bssid_ex This also gets rid of a use of typedef NDIS_802_11_RATES_EX Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_cmd.c | 11 ++++----- drivers/staging/rtl8712/rtl871x_event.h | 2 +- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 10 ++++---- drivers/staging/rtl8712/rtl871x_mlme.c | 23 +++++++++---------- drivers/staging/rtl8712/rtl871x_mlme.h | 2 +- drivers/staging/rtl8712/rtl871x_mp_ioctl.c | 4 ++-- drivers/staging/rtl8712/wlan_bssdef.h | 23 ++----------------- 7 files changed, 26 insertions(+), 49 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index f07050ddd82d..06d9844ac722 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -456,9 +456,7 @@ u8 r8712_createbss_cmd(struct _adapter *padapter) INIT_LIST_HEAD(&pcmd->list); pcmd->cmdcode = _CreateBss_CMD_; pcmd->parmbuf = (unsigned char *)pdev_network; - pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz(( - struct ndis_wlan_bssid_ex *) - pdev_network); + pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz(pdev_network); pcmd->rsp = NULL; pcmd->rspsz = 0; /* notes: translate IELength & Length after assign to cmdsz; */ @@ -471,7 +469,7 @@ u8 r8712_createbss_cmd(struct _adapter *padapter) u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) { - struct ndis_wlan_bssid_ex *psecnetwork; + struct wlan_bssid_ex *psecnetwork; struct cmd_obj *pcmd; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -502,7 +500,7 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) break; } } - psecnetwork = (struct ndis_wlan_bssid_ex *)&psecuritypriv->sec_bss; + psecnetwork = &psecuritypriv->sec_bss; if (psecnetwork == NULL) { kfree(pcmd); return _FAIL; @@ -894,8 +892,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter, struct sta_info *psta = NULL; struct wlan_network *pwlan = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pnetwork = (struct ndis_wlan_bssid_ex *) - pcmd->parmbuf; + struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf; struct wlan_network *tgt_network = &(pmlmepriv->cur_network); if (pcmd->res != H2C_SUCCESS) diff --git a/drivers/staging/rtl8712/rtl871x_event.h b/drivers/staging/rtl8712/rtl871x_event.h index e03ee90d2870..697c8d735150 100644 --- a/drivers/staging/rtl8712/rtl871x_event.h +++ b/drivers/staging/rtl8712/rtl871x_event.h @@ -36,7 +36,7 @@ * Used to report a bss has been scanned */ struct survey_event { - struct ndis_wlan_bssid_ex bss; + struct wlan_bssid_ex bss; }; /* diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 3388f971fb48..4f5f69c950cc 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -634,7 +634,7 @@ static int r8711_wx_get_name(struct net_device *dev, char *p; u8 ht_cap = false; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; NDIS_802_11_RATES_EX *prates = NULL; if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == @@ -723,7 +723,7 @@ static int r8711_wx_get_freq(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { wrqu->freq.m = ieee80211_wlan_frequencies[ @@ -1111,7 +1111,7 @@ static int r8711_wx_get_wap(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; wrqu->ap_addr.sa_family = ARPHRD_ETHER; if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE | @@ -1327,7 +1327,7 @@ static int r8711_wx_get_essid(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; u32 len, ret = 0; if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) { @@ -1419,7 +1419,7 @@ static int r8711_wx_get_rate(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; struct ieee80211_ht_cap *pht_capie; unsigned char rf_type = padapter->registrypriv.rf_config; int i; diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 6b3451f7017b..7af96993c6a5 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -208,7 +208,7 @@ void r8712_generate_random_ibss(u8 *pibss) pibss[5] = (u8)((curtime>>16) & 0xff); } -uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss) +uint r8712_get_ndis_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss) { return sizeof(*bss) + bss->IELength - MAX_IE_SZ; } @@ -276,8 +276,8 @@ int r8712_is_same_ibss(struct _adapter *adapter, struct wlan_network *pnetwork) } -static int is_same_network(struct ndis_wlan_bssid_ex *src, - struct ndis_wlan_bssid_ex *dst) +static int is_same_network(struct wlan_bssid_ex *src, + struct wlan_bssid_ex *dst) { u16 s_cap, d_cap; @@ -322,8 +322,8 @@ struct wlan_network *r8712_get_oldest_wlan_network( return oldest; } -static void update_network(struct ndis_wlan_bssid_ex *dst, - struct ndis_wlan_bssid_ex *src, +static void update_network(struct wlan_bssid_ex *dst, + struct wlan_bssid_ex *src, struct _adapter *padapter) { u32 last_evm = 0, tmpVal; @@ -360,7 +360,7 @@ static void update_network(struct ndis_wlan_bssid_ex *dst, } static void update_current_network(struct _adapter *adapter, - struct ndis_wlan_bssid_ex *pnetwork) + struct wlan_bssid_ex *pnetwork) { struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -378,7 +378,7 @@ static void update_current_network(struct _adapter *adapter, Caller must hold pmlmepriv->lock first. */ static void update_scanned_network(struct _adapter *adapter, - struct ndis_wlan_bssid_ex *target) + struct wlan_bssid_ex *target) { struct list_head *plist, *phead; @@ -441,7 +441,7 @@ static void update_scanned_network(struct _adapter *adapter, } static void rtl8711_add_network(struct _adapter *adapter, - struct ndis_wlan_bssid_ex *pnetwork) + struct wlan_bssid_ex *pnetwork) { unsigned long irqL; struct mlme_priv *pmlmepriv = &(((struct _adapter *)adapter)->mlmepriv); @@ -497,10 +497,10 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf) { unsigned long flags; u32 len; - struct ndis_wlan_bssid_ex *pnetwork; + struct wlan_bssid_ex *pnetwork; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - pnetwork = (struct ndis_wlan_bssid_ex *)pbuf; + pnetwork = (struct wlan_bssid_ex *)pbuf; #ifdef __BIG_ENDIAN /* endian_convert */ pnetwork->Length = le32_to_cpu(pnetwork->Length); @@ -1658,8 +1658,7 @@ void r8712_update_registrypriv_dev_network(struct _adapter *adapter) */ sz = r8712_generate_ie(pregistrypriv); pdev_network->IELength = sz; - pdev_network->Length = r8712_get_ndis_wlan_bssid_ex_sz( - (struct ndis_wlan_bssid_ex *)pdev_network); + pdev_network->Length = r8712_get_ndis_wlan_bssid_ex_sz(pdev_network); } /*the function is at passive_level*/ diff --git a/drivers/staging/rtl8712/rtl871x_mlme.h b/drivers/staging/rtl8712/rtl871x_mlme.h index 42bd0bf8a816..47bb9c5e9708 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.h +++ b/drivers/staging/rtl8712/rtl871x_mlme.h @@ -202,7 +202,7 @@ sint r8712_set_key(struct _adapter *adapter, struct security_priv *psecuritypriv, sint keyid); sint r8712_set_auth(struct _adapter *adapter, struct security_priv *psecuritypriv); -uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss); +uint r8712_get_ndis_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss); void r8712_generate_random_ibss(u8 *pibss); u8 *r8712_get_capability_from_ie(u8 *ie); struct wlan_network *r8712_get_oldest_wlan_network( diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c index 0b5461208eb9..c77b63affdc5 100644 --- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c +++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c @@ -160,13 +160,13 @@ static int mp_start_test(struct _adapter *padapter) struct mp_priv *pmppriv = &padapter->mppriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *tgt_network = &pmlmepriv->cur_network; - struct ndis_wlan_bssid_ex bssid; + struct wlan_bssid_ex bssid; struct sta_info *psta; unsigned long length; unsigned long irqL; int res = _SUCCESS; - /* 3 1. initialize a new struct ndis_wlan_bssid_ex */ + /* 3 1. initialize a new struct wlan_bssid_ex */ memcpy(bssid.MacAddress, pmppriv->network_macaddr, ETH_ALEN); bssid.Ssid.SsidLength = 16; memcpy(bssid.Ssid.Ssid, (unsigned char *)"mp_pseudo_adhoc", diff --git a/drivers/staging/rtl8712/wlan_bssdef.h b/drivers/staging/rtl8712/wlan_bssdef.h index 8c5d6e7f82d2..cd3e62a20161 100644 --- a/drivers/staging/rtl8712/wlan_bssdef.h +++ b/drivers/staging/rtl8712/wlan_bssdef.h @@ -83,7 +83,7 @@ struct NDIS_802_11_FIXED_IEs { u16 Capabilities; }; -struct ndis_wlan_bssid_ex { +struct wlan_bssid_ex { u32 Length; unsigned char MacAddress[6]; u8 Reserved[2]; @@ -203,7 +203,7 @@ struct wlan_network { unsigned int last_scanned; /*timestamp for the network */ int aid; /*will only be valid when a BSS is joined. */ int join_res; - struct ndis_wlan_bssid_ex network; /*must be the last item */ + struct wlan_bssid_ex network; /*must be the last item */ }; enum VRTL_CARRIER_SENSE { @@ -234,24 +234,5 @@ enum UAPSD_MAX_SP { #define NUM_PRE_AUTH_KEY 16 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY -/* - * WPA2 - */ -struct wlan_bssid_ex { - u32 Length; - unsigned char MacAddress[6]; - u8 Reserved[2]; - struct ndis_802_11_ssid Ssid; - u32 Privacy; - s32 Rssi; - enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - struct NDIS_802_11_CONFIGURATION Configuration; - enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - NDIS_802_11_RATES_EX SupportedRates; - u32 IELength; - u8 IEs[MAX_IE_SZ]; /* (timestamp, beacon interval, and capability - * information) */ -}; - #endif /* #ifndef WLAN_BSSDEF_H_ */ From 986fc8e7410d65fe5adfee787ce14d56f72b4c4c Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:19 -0700 Subject: [PATCH 715/912] staging: rtl8712: rename function Rename r8712_get_ndis_wlan_bssid_ex_sz() to r8712_get_wlan_bssid_ex_sz(), which corresponds to the struct whose size it measures. Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_cmd.c | 8 ++++---- drivers/staging/rtl8712/rtl871x_mlme.c | 16 ++++++++-------- drivers/staging/rtl8712/rtl871x_mlme.h | 2 +- drivers/staging/rtl8712/rtl871x_mp_ioctl.c | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 06d9844ac722..ef7182961002 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -456,7 +456,7 @@ u8 r8712_createbss_cmd(struct _adapter *padapter) INIT_LIST_HEAD(&pcmd->list); pcmd->cmdcode = _CreateBss_CMD_; pcmd->parmbuf = (unsigned char *)pdev_network; - pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz(pdev_network); + pcmd->cmdsz = r8712_get_wlan_bssid_ex_sz(pdev_network); pcmd->rsp = NULL; pcmd->rspsz = 0; /* notes: translate IELength & Length after assign to cmdsz; */ @@ -564,7 +564,7 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) memcpy(&psecuritypriv->supplicant_ie[1], &psecnetwork->IEs[0], 255); /* get cmdsz before endian conversion */ - pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz(psecnetwork); + pcmd->cmdsz = r8712_get_wlan_bssid_ex_sz(psecnetwork); #ifdef __BIG_ENDIAN /* wlan_network endian conversion */ psecnetwork->Length = cpu_to_le32(psecnetwork->Length); @@ -946,11 +946,11 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter, } else list_add_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue); - pnetwork->Length = r8712_get_ndis_wlan_bssid_ex_sz(pnetwork); + pnetwork->Length = r8712_get_wlan_bssid_ex_sz(pnetwork); memcpy(&(pwlan->network), pnetwork, pnetwork->Length); pwlan->fixed = true; memcpy(&tgt_network->network, pnetwork, - (r8712_get_ndis_wlan_bssid_ex_sz(pnetwork))); + (r8712_get_wlan_bssid_ex_sz(pnetwork))); if (pmlmepriv->fw_state & _FW_UNDER_LINKING) pmlmepriv->fw_state ^= _FW_UNDER_LINKING; /* we will set _FW_LINKED when there is one more sat to diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 7af96993c6a5..fc5dbea08cb4 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -208,7 +208,7 @@ void r8712_generate_random_ibss(u8 *pibss) pibss[5] = (u8)((curtime>>16) & 0xff); } -uint r8712_get_ndis_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss) +uint r8712_get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss) { return sizeof(*bss) + bss->IELength - MAX_IE_SZ; } @@ -356,7 +356,7 @@ static void update_network(struct wlan_bssid_ex *dst, src->Rssi = padapter->recvpriv.signal; } else src->Rssi = (src->Rssi + dst->Rssi) / 2; - memcpy((u8 *)dst, (u8 *)src, r8712_get_ndis_wlan_bssid_ex_sz(src)); + memcpy((u8 *)dst, (u8 *)src, r8712_get_wlan_bssid_ex_sz(src)); } static void update_current_network(struct _adapter *adapter, @@ -416,7 +416,7 @@ static void update_scanned_network(struct _adapter *adapter, target->Rssi = (pnetwork->network.Rssi + target->Rssi) / 2; memcpy(&pnetwork->network, target, - r8712_get_ndis_wlan_bssid_ex_sz(target)); + r8712_get_wlan_bssid_ex_sz(target)); pnetwork->last_scanned = jiffies; } else { /* Otherwise just pull from the free list */ @@ -424,7 +424,7 @@ static void update_scanned_network(struct _adapter *adapter, pnetwork = alloc_network(pmlmepriv); if (pnetwork == NULL) return; - bssid_ex_sz = r8712_get_ndis_wlan_bssid_ex_sz(target); + bssid_ex_sz = r8712_get_wlan_bssid_ex_sz(target); target->Length = bssid_ex_sz; memcpy(&pnetwork->network, target, bssid_ex_sz); list_add_tail(&pnetwork->list, &queue->queue); @@ -528,7 +528,7 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf) le32_to_cpu(pnetwork->InfrastructureMode); pnetwork->IELength = le32_to_cpu(pnetwork->IELength); #endif - len = r8712_get_ndis_wlan_bssid_ex_sz(pnetwork); + len = r8712_get_wlan_bssid_ex_sz(pnetwork); if (len > sizeof(struct wlan_bssid_ex)) return; spin_lock_irqsave(&pmlmepriv->lock2, flags); @@ -759,7 +759,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) the_same_macaddr = !memcmp(pnetwork->network.MacAddress, cur_network->network.MacAddress, ETH_ALEN); pnetwork->network.Length = - r8712_get_ndis_wlan_bssid_ex_sz(&pnetwork->network); + r8712_get_wlan_bssid_ex_sz(&pnetwork->network); spin_lock_irqsave(&pmlmepriv->lock, irqL); if (pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) goto ignore_joinbss_callback; @@ -991,7 +991,7 @@ void r8712_stadel_event_callback(struct _adapter *adapter, u8 *pbuf) pdev_network = &(adapter->registrypriv.dev_network); pibss = adapter->registrypriv.dev_network.MacAddress; memcpy(pdev_network, &tgt_network->network, - r8712_get_ndis_wlan_bssid_ex_sz(&tgt_network-> + r8712_get_wlan_bssid_ex_sz(&tgt_network-> network)); memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, @@ -1658,7 +1658,7 @@ void r8712_update_registrypriv_dev_network(struct _adapter *adapter) */ sz = r8712_generate_ie(pregistrypriv); pdev_network->IELength = sz; - pdev_network->Length = r8712_get_ndis_wlan_bssid_ex_sz(pdev_network); + pdev_network->Length = r8712_get_wlan_bssid_ex_sz(pdev_network); } /*the function is at passive_level*/ diff --git a/drivers/staging/rtl8712/rtl871x_mlme.h b/drivers/staging/rtl8712/rtl871x_mlme.h index 47bb9c5e9708..08d6c986c11e 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.h +++ b/drivers/staging/rtl8712/rtl871x_mlme.h @@ -202,7 +202,7 @@ sint r8712_set_key(struct _adapter *adapter, struct security_priv *psecuritypriv, sint keyid); sint r8712_set_auth(struct _adapter *adapter, struct security_priv *psecuritypriv); -uint r8712_get_ndis_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss); +uint r8712_get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss); void r8712_generate_random_ibss(u8 *pibss); u8 *r8712_get_capability_from_ie(u8 *ie); struct wlan_network *r8712_get_oldest_wlan_network( diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c index c77b63affdc5..77f01bf1ca3c 100644 --- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c +++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c @@ -174,7 +174,7 @@ static int mp_start_test(struct _adapter *padapter) bssid.InfrastructureMode = Ndis802_11IBSS; bssid.NetworkTypeInUse = Ndis802_11DS; bssid.IELength = 0; - length = r8712_get_ndis_wlan_bssid_ex_sz(&bssid); + length = r8712_get_wlan_bssid_ex_sz(&bssid); if (length % 4) { /*round up to multiple of 4 bytes.*/ bssid.Length = ((length >> 2) + 1) << 2; From db55b1652e5b126d0dbfd1ce0bcbaacddac8f36e Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:20 -0700 Subject: [PATCH 716/912] staging: rtl8712: remove typedefs Coding style fix. Get rid of typedefs NDIS_802_11_RATES and NDIS_802_11_RATES_EX Undo any casting that was done as a result of the typedef. Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 12 ++++++------ drivers/staging/rtl8712/wlan_bssdef.h | 7 +------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 4f5f69c950cc..83d4bca006a2 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -203,13 +203,13 @@ static inline char *translate_scan(struct _adapter *padapter, } /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; - if ((r8712_is_cckratesonly_included((u8 *)&pnetwork->network. + if ((r8712_is_cckratesonly_included(pnetwork->network. SupportedRates)) == true) { if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b"); - } else if ((r8712_is_cckrates_included((u8 *)&pnetwork->network. + } else if ((r8712_is_cckrates_included(pnetwork->network. SupportedRates)) == true) { if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bgn"); @@ -635,7 +635,7 @@ static int r8711_wx_get_name(struct net_device *dev, u8 ht_cap = false; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; - NDIS_802_11_RATES_EX *prates = NULL; + u8 *prates; if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == true) { @@ -644,15 +644,15 @@ static int r8711_wx_get_name(struct net_device *dev, &ht_ielen, pcur_bss->IELength - 12); if (p && ht_ielen > 0) ht_cap = true; - prates = &pcur_bss->SupportedRates; - if (r8712_is_cckratesonly_included((u8 *)prates) == true) { + prates = pcur_bss->SupportedRates; + if (r8712_is_cckratesonly_included(prates) == true) { if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b"); - } else if ((r8712_is_cckrates_included((u8 *)prates)) == true) { + } else if ((r8712_is_cckrates_included(prates)) == true) { if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bgn"); diff --git a/drivers/staging/rtl8712/wlan_bssdef.h b/drivers/staging/rtl8712/wlan_bssdef.h index cd3e62a20161..ff86fbd1d52b 100644 --- a/drivers/staging/rtl8712/wlan_bssdef.h +++ b/drivers/staging/rtl8712/wlan_bssdef.h @@ -32,11 +32,6 @@ #define NDIS_802_11_LENGTH_RATES 8 #define NDIS_802_11_LENGTH_RATES_EX 16 -/* Set of 8 data rates*/ -typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; -/* Set of 16 data rates */ -typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; - struct ndis_802_11_ssid { u32 SsidLength; u8 Ssid[32]; @@ -93,7 +88,7 @@ struct wlan_bssid_ex { enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; struct NDIS_802_11_CONFIGURATION Configuration; enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - NDIS_802_11_RATES_EX SupportedRates; + u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX]; /* number of content bytes in EIs, which varies */ u32 IELength; /*(timestamp, beacon interval, and capability information) */ From 7fb539eda2be9fce93b7f1cc933ef318e9c3771b Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:21 -0700 Subject: [PATCH 717/912] staging: rtl8712: change SupportedRates to rates Change the value to a name that conforms to Linux coding style. "rates" is equally expressive in this context, and I have left alone a comment and function name that describe the rates as supported rates. Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/ieee80211.c | 25 ++++++++----------- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 18 ++++++------- drivers/staging/rtl8712/wlan_bssdef.h | 2 +- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c index 57868085ce58..c5527c1ccaa6 100644 --- a/drivers/staging/rtl8712/ieee80211.c +++ b/drivers/staging/rtl8712/ieee80211.c @@ -134,22 +134,20 @@ u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit) return NULL; } -static void set_supported_rate(u8 *SupportedRates, uint mode) +static void set_supported_rate(u8 *rates, uint mode) { - memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX); + memset(rates, 0, NDIS_802_11_LENGTH_RATES_EX); switch (mode) { case WIRELESS_11B: - memcpy(SupportedRates, WIFI_CCKRATES, - IEEE80211_CCK_RATE_LEN); + memcpy(rates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN); break; case WIRELESS_11G: case WIRELESS_11A: - memcpy(SupportedRates, WIFI_OFDMRATES, - IEEE80211_NUM_OFDM_RATESLEN); + memcpy(rates, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN); break; case WIRELESS_11BG: - memcpy(SupportedRates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN); - memcpy(SupportedRates + IEEE80211_CCK_RATE_LEN, WIFI_OFDMRATES, + memcpy(rates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN); + memcpy(rates + IEEE80211_CCK_RATE_LEN, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN); break; } @@ -195,17 +193,16 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv) ie = r8712_set_ie(ie, _SSID_IE_, pdev_network->Ssid.SsidLength, pdev_network->Ssid.Ssid, &sz); /*supported rates*/ - set_supported_rate(pdev_network->SupportedRates, - pregistrypriv->wireless_mode); - rateLen = r8712_get_rateset_len(pdev_network->SupportedRates); + set_supported_rate(pdev_network->rates, pregistrypriv->wireless_mode); + rateLen = r8712_get_rateset_len(pdev_network->rates); if (rateLen > 8) { ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_, 8, - pdev_network->SupportedRates, &sz); + pdev_network->rates, &sz); ie = r8712_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), - (pdev_network->SupportedRates + 8), &sz); + (pdev_network->rates + 8), &sz); } else ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_, - rateLen, pdev_network->SupportedRates, &sz); + rateLen, pdev_network->rates, &sz); /*DS parameter set*/ ie = r8712_set_ie(ie, _DSSET_IE_, 1, (u8 *)&(pdev_network->Configuration.DSConfig), &sz); diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 83d4bca006a2..143be0fdc578 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -203,14 +203,12 @@ static inline char *translate_scan(struct _adapter *padapter, } /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; - if ((r8712_is_cckratesonly_included(pnetwork->network. - SupportedRates)) == true) { + if (r8712_is_cckratesonly_included(pnetwork->network.rates)) { if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b"); - } else if ((r8712_is_cckrates_included(pnetwork->network. - SupportedRates)) == true) { + } else if (r8712_is_cckrates_included(pnetwork->network.rates)) { if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bgn"); else @@ -270,9 +268,9 @@ static inline char *translate_scan(struct _adapter *padapter, iwe.u.bitrate.disabled = 0; iwe.u.bitrate.value = 0; i = 0; - while (pnetwork->network.SupportedRates[i] != 0) { + while (pnetwork->network.rates[i] != 0) { /* Bit rate given in 500 kb/s units */ - iwe.u.bitrate.value = (pnetwork->network.SupportedRates[i++] & + iwe.u.bitrate.value = (pnetwork->network.rates[i++] & 0x7F) * 500000; current_val = iwe_stream_add_value(info, start, current_val, stop, &iwe, IW_EV_PARAM_LEN); @@ -644,7 +642,7 @@ static int r8711_wx_get_name(struct net_device *dev, &ht_ielen, pcur_bss->IELength - 12); if (p && ht_ielen > 0) ht_cap = true; - prates = pcur_bss->SupportedRates; + prates = pcur_bss->rates; if (r8712_is_cckratesonly_included(prates) == true) { if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, @@ -1444,9 +1442,9 @@ static int r8711_wx_get_rate(struct net_device *dev, (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; } - while ((pcur_bss->SupportedRates[i] != 0) && - (pcur_bss->SupportedRates[i] != 0xFF)) { - rate = pcur_bss->SupportedRates[i] & 0x7F; + while ((pcur_bss->rates[i] != 0) && + (pcur_bss->rates[i] != 0xFF)) { + rate = pcur_bss->rates[i] & 0x7F; if (rate > max_rate) max_rate = rate; wrqu->bitrate.fixed = 0; /* no auto select */ diff --git a/drivers/staging/rtl8712/wlan_bssdef.h b/drivers/staging/rtl8712/wlan_bssdef.h index ff86fbd1d52b..fda5707c4acd 100644 --- a/drivers/staging/rtl8712/wlan_bssdef.h +++ b/drivers/staging/rtl8712/wlan_bssdef.h @@ -88,7 +88,7 @@ struct wlan_bssid_ex { enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; struct NDIS_802_11_CONFIGURATION Configuration; enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX]; + u8 rates[NDIS_802_11_LENGTH_RATES_EX]; /* number of content bytes in EIs, which varies */ u32 IELength; /*(timestamp, beacon interval, and capability information) */ From 741a3b0745596f18a20da30b167e46c11bb3ce53 Mon Sep 17 00:00:00 2001 From: Andrzej Hajda Date: Fri, 7 Aug 2015 09:59:25 +0200 Subject: [PATCH 718/912] staging/lustre: use kmemdup rather than duplicating its implementation The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/acl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c b/drivers/staging/lustre/lustre/obdclass/acl.c index bc3fc4780cb9..933456c502d1 100644 --- a/drivers/staging/lustre/lustre/obdclass/acl.c +++ b/drivers/staging/lustre/lustre/obdclass/acl.c @@ -104,11 +104,10 @@ static int lustre_posix_acl_xattr_reduce_space(posix_acl_xattr_header **header, if (unlikely(old_count <= new_count)) return old_size; - new = kzalloc(new_size, GFP_NOFS); + new = kmemdup(*header, new_size, GFP_NOFS); if (unlikely(new == NULL)) return -ENOMEM; - memcpy(new, *header, new_size); kfree(*header); *header = new; return new_size; @@ -125,11 +124,10 @@ static int lustre_ext_acl_xattr_reduce_space(ext_acl_xattr_header **header, if (unlikely(old_count <= ext_count)) return 0; - new = kzalloc(ext_size, GFP_NOFS); + new = kmemdup(*header, ext_size, GFP_NOFS); if (unlikely(new == NULL)) return -ENOMEM; - memcpy(new, *header, ext_size); kfree(*header); *header = new; return 0; From 2cc468378a4f8dd3517d9fc1d613c2f328e070c4 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 7 Aug 2015 09:02:01 +0900 Subject: [PATCH 719/912] staging: wilc1000: use memset instead of WILC_memset Use memset instead of WILC_memset. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 16 +-- drivers/staging/wilc1000/host_interface.c | 134 +++++++++--------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 16 +-- 3 files changed, 83 insertions(+), 83 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 342a3368d4a2..93942b211fcd 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -681,9 +681,9 @@ s32 CoreConfiguratorInit(void) goto _fail_; } - WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); + memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); - WILC_memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); + memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); _fail_: return s32Error; } @@ -812,7 +812,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) u32 u32Tsf_Hi; pstrNetworkInfo = (tstrNetworkInfo *)WILC_MALLOC(sizeof(tstrNetworkInfo)); - WILC_memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo)); + memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo)); pstrNetworkInfo->s8rssi = pu8WidVal[0]; @@ -862,7 +862,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) if (u16IEsLen > 0) { pstrNetworkInfo->pu8IEs = (u8 *)WILC_MALLOC(u16IEsLen); - WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); + memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); } @@ -929,7 +929,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, u16 u16IEsLen = 0; pstrConnectRespInfo = (tstrConnectRespInfo *)WILC_MALLOC(sizeof(tstrConnectRespInfo)); - WILC_memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo)); + memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo)); /* u16AssocRespLen = pu8Buffer[0]; */ u16AssocRespLen = (u16)u32BufferLen; @@ -949,7 +949,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN); pstrConnectRespInfo->pu8RespIEs = (u8 *)WILC_MALLOC(u16IEsLen); - WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); + memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); pstrConnectRespInfo->u16RespIEsLen = u16IEsLen; @@ -1023,7 +1023,7 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ WILC_ERRORREPORT(s32Error, WILC_NO_MEM); } - WILC_memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); + memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); u32SurveyResultsCount = 0; @@ -1871,7 +1871,7 @@ s32 ConfigWaitResponse(char *pcRespBuffer, s32 s32MaxRespBuffLen, s32 *ps32Bytes *ps32BytesRead = gstrConfigPktInfo.s32BytesRead; } - WILC_memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); + memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); return s32Error; } diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 02aaf39bf28d..0c06ac27b4a7 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1494,8 +1494,8 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(GENERIC_DBG, "Handling connect request\n"); #ifndef CONNECT_DIRECT - WILC_memset(gapu8RcvdSurveyResults[0], 0, MAX_SURVEY_RESULT_FRAG_SIZE); - WILC_memset(gapu8RcvdSurveyResults[1], 0, MAX_SURVEY_RESULT_FRAG_SIZE); + memset(gapu8RcvdSurveyResults[0], 0, MAX_SURVEY_RESULT_FRAG_SIZE); + memset(gapu8RcvdSurveyResults[1], 0, MAX_SURVEY_RESULT_FRAG_SIZE); PRINT_D(HOSTINF_DBG, "Getting site survey results\n"); @@ -1972,7 +1972,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); - WILC_memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); + memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); if (pstrHostIFconnectAttr->pfConnectResult != NULL) { if (pstrHostIFconnectAttr->pu8bssid != NULL) @@ -2124,7 +2124,7 @@ static s32 Handle_ConnectTimeout(void *drvHandler) gbScanWhileConnected = false; - WILC_memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); + memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, @@ -2190,7 +2190,7 @@ static s32 Handle_ConnectTimeout(void *drvHandler) pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); /*BugID_5213*/ /*Freeing flushed join request params on connect timeout*/ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { @@ -2399,10 +2399,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); - WILC_memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); + memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); if (u8MacStatus == MAC_CONNECTED) { - WILC_memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); + memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); host_int_get_assoc_res_info((WILC_WFIDrvHandle)pstrWFIDrv, gapu8RcvdAssocResp, @@ -2449,11 +2449,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); } else if (u8MacStatus == MAC_DISCONNECTED) { PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); } /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ @@ -2554,7 +2554,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* Disassociation or Deauthentication frame has been received */ PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); - WILC_memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); + memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); @@ -2583,7 +2583,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst PRINT_ER("Connect result callback function is NULL\n"); } - WILC_memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); + memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); /* Deallocation */ @@ -2791,7 +2791,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) goto _WPARxGtk_end_case_; } - WILC_memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); + memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); /*|----------------------------------------------------------------------------| @@ -2842,7 +2842,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) goto _WPARxGtk_end_case_; } - WILC_memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); + memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); /*|----------------------------------------------------------------------------| @@ -3053,7 +3053,7 @@ static void Handle_Disconnect(void *drvHandler) host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); #endif - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv); @@ -3063,7 +3063,7 @@ static void Handle_Disconnect(void *drvHandler) } else { tstrDisconnectNotifInfo strDisconnectNotifInfo; - WILC_memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); + memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); strDisconnectNotifInfo.u16reason = 0; strDisconnectNotifInfo.ie = NULL; @@ -3096,7 +3096,7 @@ static void Handle_Disconnect(void *drvHandler) pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; - WILC_memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); + memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); /* Deallocation */ @@ -3990,7 +3990,7 @@ static void ListenTimerCB(void *pvArg) WILC_TimerStop(&(pstrWFIDrv->hRemainOnChannel), NULL); /* prepare the Timer Callback message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; strHostIFmsg.drvHandler = pstrWFIDrv; strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; @@ -4329,7 +4329,7 @@ static int hostIFthread(void *pvArg) tstrHostIFmsg strHostIFmsg; tstrWILC_WFIDrv *pstrWFIDrv; - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); while (1) { WILC_MsgQueueRecv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret, NULL); @@ -4551,7 +4551,7 @@ static void TimerCB_Scan(void *pvArg) tstrHostIFmsg strHostIFmsg; /* prepare the Timer Callback message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.drvHandler = pvArg; strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN_TIMER_FIRED; @@ -4564,7 +4564,7 @@ static void TimerCB_Connect(void *pvArg) tstrHostIFmsg strHostIFmsg; /* prepare the Timer Callback message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.drvHandler = pvArg; strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT_TIMER_FIRED; @@ -4626,7 +4626,7 @@ s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8keyIdx) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /* prepare the Remove Wep Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; @@ -4675,7 +4675,7 @@ s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; @@ -4732,7 +4732,7 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; @@ -4798,7 +4798,7 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); if (INFO) { for (i = 0; i < u8WepKeylen; i++) @@ -4877,7 +4877,7 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen u8KeyLen += TX_MIC_KEY_LEN; /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; @@ -4972,7 +4972,7 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); if (pu8RxMic != NULL) @@ -5079,7 +5079,7 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = PMKSA; @@ -5194,7 +5194,7 @@ s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) /* prepare the Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_MAC_ADDRESS; strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress; @@ -5229,7 +5229,7 @@ s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); /* prepare setting mac address message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MAC_ADDRESS; WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); strHostIFmsg.drvHandler = hWFIDrv; @@ -5448,7 +5448,7 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, * } */ /* prepare the Connect Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT; @@ -5575,7 +5575,7 @@ s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode) } /* prepare the Disconnect Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_DISCONNECT; strHostIFmsg.drvHandler = hWFIDrv; @@ -5765,7 +5765,7 @@ s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /* prepare the set channel message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_CHANNEL; strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan.u8SetChan = u8ChNum; strHostIFmsg.drvHandler = hWFIDrv; @@ -5790,7 +5790,7 @@ s32 host_int_wait_msg_queue_idle(void) /* prepare the set driver handler message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_Q_IDLE; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); if (s32Error) @@ -5816,7 +5816,7 @@ s32 host_int_set_wfi_drv_handler(u32 u32address) /* prepare the set driver handler message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_WFIDRV_HANDLER; strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = u32address; /* strHostIFmsg.drvHandler=hWFIDrv; */ @@ -5843,7 +5843,7 @@ s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode) /* prepare the set driver handler message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_OPERATION_MODE; strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode.u32Mode = u32mode; strHostIFmsg.drvHandler = hWFIDrv; @@ -5886,7 +5886,7 @@ s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo) } /* prepare the Get Channel Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_CHNL; strHostIFmsg.drvHandler = hWFIDrv; @@ -5978,7 +5978,7 @@ s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac, @@ -6070,7 +6070,7 @@ s32 host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv, s8 *ps8Rssi) /* prepare the Get RSSI Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; strHostIFmsg.drvHandler = hWFIDrv; @@ -6107,7 +6107,7 @@ s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd) /* prepare the Get LINKSPEED Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_LINKSPEED; strHostIFmsg.drvHandler = hWFIDrv; @@ -6141,7 +6141,7 @@ s32 host_int_get_statistics(WILC_WFIDrvHandle hWFIDrv, tstrStatistics *pstrStati /* prepare the Get RSSI Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_STATISTICS; strHostIFmsg.uniHostIFmsgBody.pUserData = (char *)pstrStatistics; @@ -6190,7 +6190,7 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, /* prepare the Scan Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN; @@ -6259,7 +6259,7 @@ s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /* prepare the WiphyParams Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_CFG_PARAMS; strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal; strHostIFmsg.drvHandler = hWFIDrv; @@ -6437,7 +6437,7 @@ void GetPeriodicRSSI(void *pvArg) tstrHostIFmsg strHostIFmsg; /* prepare the Get RSSI Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; strHostIFmsg.drvHandler = pstrWFIDrv; @@ -6497,7 +6497,7 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) PRINT_ER("Failed to allocate memory\n"); goto _fail_timer_2; } - WILC_memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); + memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); /*return driver handle to user*/ *phWFIDrv = (WILC_WFIDrvHandle)pstrWFIDrv; /*save into globl handle*/ @@ -6720,7 +6720,7 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) gbScanWhileConnected = false; - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); if (clients_count == 1) { if (WILC_TimerDestroy(&g_hPeriodicRSSI, NULL)) { @@ -6791,7 +6791,7 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) } /* prepare the Asynchronous Network Info message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_NTWRK_INFO; strHostIFmsg.drvHandler = pstrWFIDrv; @@ -6852,7 +6852,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) } /* prepare the General Asynchronous Info message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; @@ -6902,7 +6902,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) /*if there is an ongoing scan request*/ if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { /* prepare theScan Done message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_SCAN_COMPLETE; strHostIFmsg.drvHandler = pstrWFIDrv; @@ -6952,7 +6952,7 @@ s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /* prepare the remainonchan Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_REMAIN_ON_CHAN; @@ -7002,7 +7002,7 @@ s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID) WILC_TimerStop(&(pstrWFIDrv->hRemainOnChannel), NULL); /* prepare the timer fire Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; strHostIFmsg.drvHandler = hWFIDrv; strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; @@ -7034,7 +7034,7 @@ s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bR if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_REGISTER_FRAME; @@ -7096,7 +7096,7 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); @@ -7194,7 +7194,7 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); @@ -7243,7 +7243,7 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); @@ -7255,7 +7255,7 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) /*BugID_4795: Handling situation of deleting all stations*/ if (pu8MacAddr == NULL) - WILC_memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); + memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); else WILC_memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); @@ -7291,7 +7291,7 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); @@ -7351,7 +7351,7 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ @@ -7392,7 +7392,7 @@ s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32T PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ @@ -7426,7 +7426,7 @@ s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ @@ -7479,7 +7479,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pNewJoinBssParam = WILC_MALLOC(sizeof(tstrJoinBssParam)); if (pNewJoinBssParam != NULL) { - WILC_memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); + memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; @@ -7488,8 +7488,8 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ WILC_memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; - WILC_memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); - WILC_memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); + memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); + memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); /*for(i=0; issidLen;i++) * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ @@ -7693,7 +7693,7 @@ static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char T if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BA_SESSION; @@ -7726,7 +7726,7 @@ s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BA_SESSION; @@ -7759,7 +7759,7 @@ s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; @@ -7802,7 +7802,7 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_IPADDRESS; @@ -7841,7 +7841,7 @@ s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_IPADDRESS; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 2c0789e499d4..e38aad049ac7 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -574,7 +574,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, * = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */ u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE; linux_wlan_set_bssid(priv->dev, NullBssid); - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); /*BugID_5457*/ /*Invalidate u8WLANChannel value on wlan0 disconnect*/ @@ -640,9 +640,9 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, u8P2Plocalrandom = 0x01; u8P2Precvrandom = 0x00; bWilc_ie = false; - WILC_memset(priv->au8AssociatedBss, 0, ETH_ALEN); + memset(priv->au8AssociatedBss, 0, ETH_ALEN); linux_wlan_set_bssid(priv->dev, NullBssid); - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); /*BugID_5457*/ /*Invalidate u8WLANChannel value on wlan0 disconnect*/ @@ -887,8 +887,8 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, } priv->WILC_WFI_wep_default = 0; - WILC_memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key)); - WILC_memset(priv->WILC_WFI_wep_key_len, 0, sizeof(priv->WILC_WFI_wep_key_len)); + memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key)); + memset(priv->WILC_WFI_wep_key_len, 0, sizeof(priv->WILC_WFI_wep_key_len)); PRINT_INFO(CFG80211_DBG, "sme->crypto.wpa_versions=%x\n", sme->crypto.wpa_versions); PRINT_INFO(CFG80211_DBG, "sme->crypto.cipher_group=%x\n", sme->crypto.cipher_group); @@ -1490,7 +1490,7 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev, } if (key_index >= 0 && key_index <= 3) { - WILC_memset(priv->WILC_WFI_wep_key[key_index], 0, priv->WILC_WFI_wep_key_len[key_index]); + memset(priv->WILC_WFI_wep_key[key_index], 0, priv->WILC_WFI_wep_key_len[key_index]); priv->WILC_WFI_wep_key_len[key_index] = 0; PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index); @@ -1950,7 +1950,7 @@ static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, ETH_ALEN)) { /*If bssid is found, reset the values*/ PRINT_D(CFG80211_DBG, "Reseting PMKID values\n"); - WILC_memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(tstrHostIFpmkid)); + memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(tstrHostIFpmkid)); flag = PMKID_FOUND; break; } @@ -1989,7 +1989,7 @@ static int WILC_WFI_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) PRINT_D(CFG80211_DBG, "Flushing PMKID key values\n"); /*Get cashed Pmkids and set all with zeros*/ - WILC_memset(&priv->pmkid_list, 0, sizeof(tstrHostIFpmkidAttr)); + memset(&priv->pmkid_list, 0, sizeof(tstrHostIFpmkidAttr)); return 0; } From 70b801cb539ae812662927bb327668aa3c7c21ab Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 7 Aug 2015 09:02:02 +0900 Subject: [PATCH 720/912] staging: wilc1000: remove WILC_memset function Remove WILC_memset function because it is changed to memset. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_strutils.c | 9 --------- drivers/staging/wilc1000/wilc_strutils.h | 12 ------------ 2 files changed, 21 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c index e0145953ceef..c15375eaef81 100644 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ b/drivers/staging/wilc1000/wilc_strutils.c @@ -25,15 +25,6 @@ void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count) memcpy(pvTarget, pvSource, u32Count); } -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void *WILC_memset(void *pvTarget, u8 u8SetValue, u32 u32Count) -{ - return memset(pvTarget, u8SetValue, u32Count); -} /*! * @author syounan diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h index d1445575a25e..acc0ca4a447d 100644 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ b/drivers/staging/wilc1000/wilc_strutils.h @@ -71,18 +71,6 @@ static WILC_ErrNo WILC_memcpy(void *pvTarget, const void *pvSource, u32 u32Count } } -/*! - * @brief Sets the contents of a memory buffer with the given value - * @param[in] pvTarget the target buffer which contsnts will be set - * @param[in] u8SetValue the value to be used - * @param[in] u32Count the size of the memory buffer - * @return value of pvTarget - * @note this function repeats the functionality of standard memset - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void *WILC_memset(void *pvTarget, u8 u8SetValue, u32 u32Count); /*! * @brief copies the contents of source string into the target string From 1a646e7e9e4227d4eeb9ccbbc2d976b3b256a1e6 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 7 Aug 2015 09:02:03 +0900 Subject: [PATCH 721/912] staging: wilc1000: use memcmp instead of WILC_memcmp Use memcmp instead of WILC_memcmp. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 20 ++++++------ .../staging/wilc1000/wilc_wfi_cfgoperations.c | 32 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0c06ac27b4a7..bc06d56ebaf5 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -801,7 +801,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) /*get the value by searching the local copy*/ WILC_FREE(strWID.ps8WidVal); - if (WILC_memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) + if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, gs8SetIP[idx], idx); if (s32Error != WILC_SUCCESS) { @@ -1527,7 +1527,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { - if (WILC_memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, + if (memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen) == 0) { PRINT_INFO(HOSTINF_DBG, "Network with required SSID is found %s\n", pstrHostIFconnectAttr->pu8ssid); @@ -1540,7 +1540,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /* BSSID is also passed from the user, so decision of matching * should consider also this passed BSSID */ - if (WILC_memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, + if (memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, pstrHostIFconnectAttr->pu8bssid, 6) == 0) { PRINT_INFO(HOSTINF_DBG, "BSSID is passed from the user and matched\n"); @@ -1648,7 +1648,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /* if we try to connect to an already connected AP then discard the request */ - if (WILC_memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { + if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { s32Error = WILC_SUCCESS; PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); @@ -1720,7 +1720,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon u32WidsCount++; /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; gu8FlushedInfoElemAsoc = WILC_MALLOC(gu32FlushedInfoElemAsocSize); @@ -1735,7 +1735,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon u32WidsCount++; /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); @@ -1748,7 +1748,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon u32WidsCount++; /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); @@ -1803,7 +1803,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize); /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; gu8FlushedJoinReq = WILC_MALLOC(gu32FlushedJoinReqSize); } @@ -1940,7 +1940,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /* ////////////////////// */ /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); gu8FlushedJoinReqDrvHandler = (u32)pstrWFIDrv; } @@ -2246,7 +2246,7 @@ static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdN if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && (pstrNetworkInfo->au8bssid != NULL)) { - if (WILC_memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, + if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { /*we have already found this network with better rssi, so keep the old cached one and don't diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index e38aad049ac7..060288a3460d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -202,7 +202,7 @@ void refresh_scan(void *pUserVoid, uint8_t all, bool bDirectScan) channel = ieee80211_get_channel(wiphy, s32Freq); rssi = get_rssi_avg(pstrNetworkInfo); - if (WILC_memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7) || bDirectScan) { + if (memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7) || bDirectScan) { bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs, (size_t)pstrNetworkInfo->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL); @@ -283,7 +283,7 @@ int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) } else { /* Linear search for now */ for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { - if (WILC_memcmp(astrLastScannedNtwrksShadow[i].au8bssid, + if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { state = i; break; @@ -414,7 +414,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo /*P2P peers are sent to WPA supplicant and added to shadow table*/ - if (!(WILC_memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7))) { + if (!(memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7))) { bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs, (size_t)pstrNetworkInfo->u16IEsLen, (((s32)pstrNetworkInfo->s8rssi) * 100), GFP_KERNEL); @@ -429,7 +429,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo u32 i; /* So this network is discovered before, we'll just update its RSSI */ for (i = 0; i < priv->u32RcvdChCount; i++) { - if (WILC_memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { + if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { PRINT_D(CFG80211_DBG, "Update RSSI of %s \n", astrLastScannedNtwrksShadow[i].au8ssid); astrLastScannedNtwrksShadow[i].s8rssi = pstrNetworkInfo->s8rssi; @@ -503,7 +503,7 @@ int WILC_WFI_Set_PMKSA(u8 *bssid, struct WILC_WFI_priv *priv) for (i = 0; i < priv->pmkid_list.numpmkid; i++) { - if (!WILC_memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid, + if (!memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { PRINT_D(CFG80211_DBG, "PMKID successful comparison"); @@ -599,7 +599,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, * Linux kernel warning generated at the nl80211 layer */ for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { - if (WILC_memcmp(astrLastScannedNtwrksShadow[i].au8bssid, + if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrConnectInfo->au8bssid, ETH_ALEN) == 0) { unsigned long now = jiffies; @@ -845,7 +845,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { if ((sme->ssid_len == astrLastScannedNtwrksShadow[i].u8SsidLen) && - WILC_memcmp(astrLastScannedNtwrksShadow[i].au8ssid, + memcmp(astrLastScannedNtwrksShadow[i].au8ssid, sme->ssid, sme->ssid_len) == 0) { PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid); @@ -857,7 +857,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, } else { /* BSSID is also passed from the user, so decision of matching * should consider also this passed BSSID */ - if (WILC_memcmp(astrLastScannedNtwrksShadow[i].au8bssid, + if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, sme->bssid, ETH_ALEN) == 0) { PRINT_INFO(CFG80211_DBG, "BSSID is passed from the user and matched\n"); @@ -1170,7 +1170,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k break; } #endif - if (WILC_memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { + if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { priv->WILC_WFI_wep_default = key_index; priv->WILC_WFI_wep_key_len[key_index] = params->key_len; WILC_memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); @@ -1896,7 +1896,7 @@ static int WILC_WFI_set_pmksa(struct wiphy *wiphy, struct net_device *netdev, for (i = 0; i < priv->pmkid_list.numpmkid; i++) { - if (!WILC_memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, + if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { /*If bssid already exists and pmkid value needs to reset*/ flag = PMKID_FOUND; @@ -1946,7 +1946,7 @@ static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, PRINT_D(CFG80211_DBG, "Deleting PMKSA keys\n"); for (i = 0; i < priv->pmkid_list.numpmkid; i++) { - if (!WILC_memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, + if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { /*If bssid is found, reset the values*/ PRINT_D(CFG80211_DBG, "Reseting PMKID values\n"); @@ -2257,11 +2257,11 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size) case PUBLIC_ACT_VENDORSPEC: /*Now we have a public action vendor specific action frame, check if its a p2p public action frame * based on the standard its should have the p2p_oui attribute with the following values 50 6f 9A 09*/ - if (!WILC_memcmp(u8P2P_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) { + if (!memcmp(u8P2P_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) { if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { if (!bWilc_ie) { for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) { - if (!WILC_memcmp(u8P2P_vendorspec, &buff[i], 6)) { + if (!memcmp(u8P2P_vendorspec, &buff[i], 6)) { u8P2Precvrandom = buff[i + 6]; bWilc_ie = true; PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", u8P2Precvrandom); @@ -2274,7 +2274,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size) if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) { - if (buff[i] == P2PELEM_ATTR_ID && !(WILC_memcmp(u8P2P_oui, &buff[i + 2], 4))) { + if (buff[i] == P2PELEM_ATTR_ID && !(memcmp(u8P2P_oui, &buff[i + 2], 4))) { WILC_WFI_CfgParseRxAction(&buff[i + 6], size - (i + 6)); break; } @@ -2570,7 +2570,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy, { /*Now we have a public action vendor specific action frame, check if its a p2p public action frame * based on the standard its should have the p2p_oui attribute with the following values 50 6f 9A 09*/ - if (!WILC_memcmp(u8P2P_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { + if (!memcmp(u8P2P_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { /*For the connection of two WILC's connection generate a rand number to determine who will be a GO*/ if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { if (u8P2Plocalrandom == 1 && u8P2Precvrandom < u8P2Plocalrandom) { @@ -2587,7 +2587,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy, /*Search for the p2p information information element , after the Public action subtype theres a byte for teh dialog token, skip that*/ for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { - if (buf[i] == P2PELEM_ATTR_ID && !(WILC_memcmp(u8P2P_oui, &buf[i + 2], 4))) { + if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(u8P2P_oui, &buf[i + 2], 4))) { if (buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP) WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), true, nic->iftype); From f6356a9617cbaebf1159fe50f2e05d57e7e4242e Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 7 Aug 2015 09:02:04 +0900 Subject: [PATCH 722/912] staging: wilc1000: remove WILC_memcmp function Remove WILC_memcmp function because it is changed to memcmp. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_strutils.c | 9 --------- drivers/staging/wilc1000/wilc_strutils.h | 13 ------------- 2 files changed, 22 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c index c15375eaef81..3600706ed231 100644 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ b/drivers/staging/wilc1000/wilc_strutils.c @@ -4,15 +4,6 @@ #include "wilc_strutils.h" -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -s32 WILC_memcmp(const void *pvArg1, const void *pvArg2, u32 u32Count) -{ - return memcmp(pvArg1, pvArg2, u32Count); -} /*! diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h index acc0ca4a447d..9e3c5d9c5001 100644 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ b/drivers/staging/wilc1000/wilc_strutils.h @@ -14,19 +14,6 @@ #include #include "wilc_errorsupport.h" -/*! - * @brief Compares two memory buffers - * @param[in] pvArg1 pointer to the first memory location - * @param[in] pvArg2 pointer to the second memory location - * @param[in] u32Count the size of the memory buffers - * @return 0 if the 2 buffers are equal, 1 if pvArg1 is bigger than pvArg2, - * -1 if pvArg1 smaller than pvArg2 - * @note this function repeats the functionality of standard memcmp - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -s32 WILC_memcmp(const void *pvArg1, const void *pvArg2, u32 u32Count); /*! * @brief Internal implementation for memory copy From 1695cd29b24eca077fa8ae467f1184009ceb9d05 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 16:06:28 +0530 Subject: [PATCH 723/912] staging: rtl8188eu: remove unused argument The function rtw_os_recv_resource_alloc() only uses the argument struct recv_frame *. So remove the other unused argument. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_recv.c | 2 +- drivers/staging/rtl8188eu/include/recv_osdep.h | 3 +-- drivers/staging/rtl8188eu/os_dep/recv_linux.c | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 8501eb898824..cce07463efb6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -89,7 +89,7 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) list_add_tail(&(precvframe->list), &(precvpriv->free_recv_queue.queue)); - res = rtw_os_recv_resource_alloc(padapter, precvframe); + res = rtw_os_recv_resource_alloc(precvframe); precvframe->len = 0; diff --git a/drivers/staging/rtl8188eu/include/recv_osdep.h b/drivers/staging/rtl8188eu/include/recv_osdep.h index 0809963ce6aa..0f3200567758 100644 --- a/drivers/staging/rtl8188eu/include/recv_osdep.h +++ b/drivers/staging/rtl8188eu/include/recv_osdep.h @@ -38,8 +38,7 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup); int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter); void rtw_free_recv_priv(struct recv_priv *precvpriv); -int rtw_os_recv_resource_alloc(struct adapter *adapt, - struct recv_frame *recvfr); +int rtw_os_recv_resource_alloc(struct recv_frame *recvfr); int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf); diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index 05701328dce4..4849e6b87a21 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -29,8 +29,7 @@ #include /* alloc os related resource in struct recv_frame */ -int rtw_os_recv_resource_alloc(struct adapter *padapter, - struct recv_frame *precvframe) +int rtw_os_recv_resource_alloc(struct recv_frame *precvframe) { precvframe->pkt_newalloc = NULL; precvframe->pkt = NULL; From 0b47649c78c09afa43e93e902027d211cd1c6991 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 16:06:29 +0530 Subject: [PATCH 724/912] staging: rtl8188eu: make function void The return value of rtw_os_recv_resource_alloc() is never checked, so make it as void. Moreover as of now the function can not fail. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_recv.c | 2 +- drivers/staging/rtl8188eu/include/recv_osdep.h | 2 +- drivers/staging/rtl8188eu/os_dep/recv_linux.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index cce07463efb6..b347a8190274 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -89,7 +89,7 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) list_add_tail(&(precvframe->list), &(precvpriv->free_recv_queue.queue)); - res = rtw_os_recv_resource_alloc(precvframe); + rtw_os_recv_resource_alloc(precvframe); precvframe->len = 0; diff --git a/drivers/staging/rtl8188eu/include/recv_osdep.h b/drivers/staging/rtl8188eu/include/recv_osdep.h index 0f3200567758..fdeb603b6cc1 100644 --- a/drivers/staging/rtl8188eu/include/recv_osdep.h +++ b/drivers/staging/rtl8188eu/include/recv_osdep.h @@ -38,7 +38,7 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup); int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter); void rtw_free_recv_priv(struct recv_priv *precvpriv); -int rtw_os_recv_resource_alloc(struct recv_frame *recvfr); +void rtw_os_recv_resource_alloc(struct recv_frame *recvfr); int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf); diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index 4849e6b87a21..49d88455dbb4 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -29,11 +29,10 @@ #include /* alloc os related resource in struct recv_frame */ -int rtw_os_recv_resource_alloc(struct recv_frame *precvframe) +void rtw_os_recv_resource_alloc(struct recv_frame *precvframe) { precvframe->pkt_newalloc = NULL; precvframe->pkt = NULL; - return _SUCCESS; } /* alloc os related resource in struct recv_buf */ From 469d3807e7f99f950348af5f031a580f13863263 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 16:06:30 +0530 Subject: [PATCH 725/912] staging: rtl8188eu: rearrange code Re-arrange the code to directly return success or failure, thus removing the variable used in the function. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/recv_linux.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index 49d88455dbb4..3350bf35fb28 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -39,14 +39,12 @@ void rtw_os_recv_resource_alloc(struct recv_frame *precvframe) int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, struct recv_buf *precvbuf) { - int res = _SUCCESS; - - precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL); - if (precvbuf->purb == NULL) - res = _FAIL; precvbuf->pskb = NULL; precvbuf->reuse = false; - return res; + precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL); + if (!precvbuf->purb) + return _FAIL; + return _SUCCESS; } void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) From ea31f616b630723bc220ff4daa123774532f96ea Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 16:06:31 +0530 Subject: [PATCH 726/912] staging: rtl8188eu: remove unused define _RECV_OSDEP_C_ was only defined here but never checked anywhere. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/recv_linux.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index 3350bf35fb28..3ebb8b206e46 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -17,8 +17,6 @@ * * ******************************************************************************/ -#define _RECV_OSDEP_C_ - #include #include From fbd0968708c5e6a4811e62b103fa3d8c165f65c3 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 16:06:32 +0530 Subject: [PATCH 727/912] staging: rtl8188eu: remove exit label An exit label which does nothing except return, is not worth having. So remove it. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_recv.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index b347a8190274..c011dc85436d 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -74,10 +74,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ); - if (precvpriv->pallocated_frame_buf == NULL) { - res = _FAIL; - goto exit; - } + if (!precvpriv->pallocated_frame_buf) + return _FAIL; precvpriv->precv_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ); @@ -107,8 +105,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) precvpriv->signal_stat_sampling_interval = 1000; /* ms */ rtw_set_signal_stat_timer(precvpriv); -exit: - return res; } From a45515f3838328334cfac3d1fcddca9f67fb9172 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 16:06:33 +0530 Subject: [PATCH 728/912] staging: rtl8188eu: remove unused function The function rtw_init_recvframe() was not being used. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_recv.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index c011dc85436d..0bb5cccb967b 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -166,14 +166,6 @@ struct recv_frame *rtw_alloc_recvframe(struct __queue *pfree_recv_queue) return precvframe; } -void rtw_init_recvframe(struct recv_frame *precvframe, struct recv_priv *precvpriv) -{ - /* Perry: This can be removed */ - INIT_LIST_HEAD(&precvframe->list); - - precvframe->len = 0; -} - int rtw_free_recvframe(struct recv_frame *precvframe, struct __queue *pfree_recv_queue) { From b17c858def70b03a1652dcb74e061e8077f72c42 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 7 Aug 2015 16:06:34 +0530 Subject: [PATCH 729/912] staging: rtl8188eu: remove multiple blank line Multiple blank lines is against the kernel coding style and checkpatch complains for that. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_recv.c | 26 ----------------------- 1 file changed, 26 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 0bb5cccb967b..44eeb03213e6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -113,7 +113,6 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv) { struct adapter *padapter = precvpriv->adapter; - rtw_free_uc_swdec_pending_queue(padapter); if (precvpriv->pallocated_frame_buf) { @@ -149,7 +148,6 @@ struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue) } } - return (struct recv_frame *)hdr; } @@ -196,7 +194,6 @@ int rtw_free_recvframe(struct recv_frame *precvframe, spin_unlock_bh(&pfree_recv_queue->lock); - return _SUCCESS; } @@ -205,7 +202,6 @@ int _rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue) struct adapter *padapter = precvframe->adapter; struct recv_priv *precvpriv = &padapter->recvpriv; - list_del_init(&(precvframe->list)); list_add_tail(&(precvframe->list), get_list_head(queue)); @@ -214,7 +210,6 @@ int _rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue) precvpriv->free_recvframe_cnt++; } - return _SUCCESS; } @@ -409,7 +404,6 @@ static int recvframe_chkmic(struct adapter *adapter, exit: - return res; } @@ -471,7 +465,6 @@ static struct recv_frame *decryptor(struct adapter *padapter, return_packet = NULL; } - return return_packet; } @@ -490,7 +483,6 @@ static struct recv_frame *portctrl(struct adapter *adapter, struct rx_pkt_attrib *pattrib; __be16 be_tmp; - pstapriv = &adapter->stapriv; auth_alg = adapter->securitypriv.dot11AuthAlgrthm; @@ -549,7 +541,6 @@ static struct recv_frame *portctrl(struct adapter *adapter, prtnframe = precv_frame; } - return prtnframe; } @@ -561,7 +552,6 @@ static int recv_decache(struct recv_frame *precv_frame, u8 bretry, u16 seq_ctrl = ((precv_frame->attrib.seq_num&0xffff) << 4) | (precv_frame->attrib.frag_num & 0xf); - if (tid > 15) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("recv_decache, (tid>15)! seq_ctrl=0x%x, tid=0x%x\n", seq_ctrl, tid)); @@ -578,7 +568,6 @@ static int recv_decache(struct recv_frame *precv_frame, u8 bretry, prxcache->tid_rxseq[tid] = seq_ctrl; - return _SUCCESS; } @@ -715,7 +704,6 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, u8 *sta_addr = NULL; int bmcast = IS_MCAST(pattrib->dst); - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { /* filter packets that SA is myself or multicast or broadcast */ @@ -803,7 +791,6 @@ static int ap2sta_data_frame( u8 *myhwaddr = myid(&adapter->eeprompriv); int bmcast = IS_MCAST(pattrib->dst); - if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) && (check_fwstate(pmlmepriv, _FW_LINKED) == true || check_fwstate(pmlmepriv, _FW_UNDER_LINKING))) { @@ -895,7 +882,6 @@ static int ap2sta_data_frame( exit: - return ret; } @@ -910,7 +896,6 @@ static int sta2ap_data_frame(struct adapter *adapter, unsigned char *mybssid = get_bssid(pmlmepriv); int ret = _SUCCESS; - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { /* For AP mode, RA = BSSID, TX = STA(SRC_ADDR), A3 = DST_ADDR */ if (memcmp(pattrib->bssid, mybssid, ETH_ALEN)) { @@ -955,7 +940,6 @@ static int sta2ap_data_frame(struct adapter *adapter, exit: - return ret; } @@ -1137,7 +1121,6 @@ static int validate_recv_data_frame(struct adapter *adapter, struct security_priv *psecuritypriv = &adapter->securitypriv; int ret = _SUCCESS; - bretry = GetRetry(ptr); pda = get_da(ptr); psa = get_sa(ptr); @@ -1241,7 +1224,6 @@ static int validate_recv_data_frame(struct adapter *adapter, exit: - return ret; } @@ -1261,7 +1243,6 @@ static int validate_recv_frame(struct adapter *adapter, u8 ver = (unsigned char)(*ptr)&0x3; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) { int ch_set_idx = rtw_ch_set_search_ch(pmlmeext->channel_set, rtw_get_oper_ch(adapter)); if (ch_set_idx >= 0) @@ -1350,7 +1331,6 @@ static int validate_recv_frame(struct adapter *adapter, exit: - return retval; } @@ -1433,7 +1413,6 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, struct recv_frame *prframe, *pnextrframe; struct __queue *pfree_recv_queue; - curfragnum = 0; pfree_recv_queue = &adapter->recvpriv.free_recv_queue; @@ -1498,7 +1477,6 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("Performance defrag!!!!!\n")); - return prframe; } @@ -1516,7 +1494,6 @@ struct recv_frame *recvframe_chk_defrag(struct adapter *padapter, struct recv_frame *prtnframe = NULL; struct __queue *pfree_recv_queue, *pdefrag_q; - pstapriv = &padapter->stapriv; pfhdr = precv_frame; @@ -1600,7 +1577,6 @@ struct recv_frame *recvframe_chk_defrag(struct adapter *padapter, } } - return prtnframe; } @@ -2104,7 +2080,6 @@ s32 rtw_recv_entry(struct recv_frame *precvframe) struct recv_priv *precvpriv; s32 ret = _SUCCESS; - padapter = precvframe->adapter; precvpriv = &padapter->recvpriv; @@ -2117,7 +2092,6 @@ s32 rtw_recv_entry(struct recv_frame *precvframe) precvpriv->rx_pkts++; - return ret; _recv_entry_drop: From 18422bb3c1d89b510bb7c590c716dd6ad8e1a1e4 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 29 Jul 2015 23:39:36 +0200 Subject: [PATCH 730/912] iio:accel:stk8312: improve error handling Improve error handling in the following ways: - set return value on error condition to an appropriate error code - return error code immediately in case of an error (slightly changes code structure) - pass up real error code - add missing error handling - return 0 when error have been caught already - put device back in active mode after error occurs Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 60 +++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index 8280a37e0068..82ad283b8c60 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -146,8 +146,10 @@ static int stk8312_otp_init(struct stk8312_data *data) count--; } while (!(ret & 0x80) && count > 0); - if (count == 0) + if (count == 0) { + ret = -ETIMEDOUT; goto exit_err; + } ret = i2c_smbus_read_byte_data(client, STK8312_REG_OTPDATA); if (ret == 0) @@ -161,7 +163,7 @@ static int stk8312_otp_init(struct stk8312_data *data) goto exit_err; msleep(150); - return ret; + return 0; exit_err: dev_err(&client->dev, "failed to initialize sensor\n"); @@ -205,8 +207,11 @@ static int stk8312_set_interrupts(struct stk8312_data *data, u8 int_mask) return ret; ret = i2c_smbus_write_byte_data(client, STK8312_REG_INTSU, int_mask); - if (ret < 0) + if (ret < 0) { dev_err(&client->dev, "failed to set interrupts\n"); + stk8312_set_mode(data, mode); + return ret; + } return stk8312_set_mode(data, mode); } @@ -230,7 +235,7 @@ static int stk8312_data_rdy_trigger_set_state(struct iio_trigger *trig, data->dready_trigger_on = state; - return ret; + return 0; } static const struct iio_trigger_ops stk8312_trigger_ops = { @@ -255,20 +260,24 @@ static int stk8312_set_sample_rate(struct stk8312_data *data, int rate) return ret; ret = i2c_smbus_read_byte_data(client, STK8312_REG_SR); - if (ret < 0) { - dev_err(&client->dev, "failed to set sampling rate\n"); - return ret; - } + if (ret < 0) + goto err_activate; masked_reg = (ret & (~STK8312_SR_MASK)) | rate; ret = i2c_smbus_write_byte_data(client, STK8312_REG_SR, masked_reg); if (ret < 0) - dev_err(&client->dev, "failed to set sampling rate\n"); - else - data->sample_rate_idx = rate; + goto err_activate; + + data->sample_rate_idx = rate; return stk8312_set_mode(data, mode); + +err_activate: + dev_err(&client->dev, "failed to set sampling rate\n"); + stk8312_set_mode(data, mode); + + return ret; } static int stk8312_set_range(struct stk8312_data *data, u8 range) @@ -290,21 +299,25 @@ static int stk8312_set_range(struct stk8312_data *data, u8 range) return ret; ret = i2c_smbus_read_byte_data(client, STK8312_REG_STH); - if (ret < 0) { - dev_err(&client->dev, "failed to change sensor range\n"); - return ret; - } + if (ret < 0) + goto err_activate; masked_reg = ret & (~STK8312_RNG_MASK); masked_reg |= range << STK8312_RNG_SHIFT; ret = i2c_smbus_write_byte_data(client, STK8312_REG_STH, masked_reg); if (ret < 0) - dev_err(&client->dev, "failed to change sensor range\n"); - else - data->range = range; + goto err_activate; + + data->range = range; return stk8312_set_mode(data, mode); + +err_activate: + dev_err(&client->dev, "failed to change sensor range\n"); + stk8312_set_mode(data, mode); + + return ret; } static int stk8312_read_accel(struct stk8312_data *data, u8 address) @@ -337,18 +350,21 @@ static int stk8312_read_raw(struct iio_dev *indio_dev, ret = stk8312_set_mode(data, data->mode | STK8312_MODE_ACTIVE); if (ret < 0) { mutex_unlock(&data->lock); - return -EINVAL; + return ret; } ret = stk8312_read_accel(data, chan->address); if (ret < 0) { stk8312_set_mode(data, data->mode & (~STK8312_MODE_ACTIVE)); mutex_unlock(&data->lock); - return -EINVAL; + return ret; } *val = sign_extend32(ret, 7); - stk8312_set_mode(data, data->mode & (~STK8312_MODE_ACTIVE)); + ret = stk8312_set_mode(data, + data->mode & (~STK8312_MODE_ACTIVE)); mutex_unlock(&data->lock); + if (ret < 0) + return ret; return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: *val = stk8312_scale_table[data->range - 1][0]; @@ -608,7 +624,7 @@ static int stk8312_probe(struct i2c_client *client, goto err_buffer_cleanup; } - return ret; + return 0; err_buffer_cleanup: iio_triggered_buffer_cleanup(indio_dev); From 03ecd50c50450b3e3173c9dda8adab241b46ae1e Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 29 Jul 2015 23:39:37 +0200 Subject: [PATCH 731/912] iio:accel:stk8312: rework macro definitions Make use of BIT to describe register bits, GENMASK for consecutive bitmasks, rename and sort existing definitions, replace magic value with an expressive definition, drop an unused definition. Signed-off-by: Hartmut Knaack Reviewed-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index 82ad283b8c60..d406ad05b8e5 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -37,16 +37,16 @@ #define STK8312_REG_OTPDATA 0x3E #define STK8312_REG_OTPCTRL 0x3F -#define STK8312_MODE_ACTIVE 0x01 +#define STK8312_MODE_ACTIVE BIT(0) #define STK8312_MODE_STANDBY 0x00 -#define STK8312_DREADY_BIT 0x10 -#define STK8312_INT_MODE 0xC0 -#define STK8312_RNG_MASK 0xC0 -#define STK8312_SR_MASK 0x07 -#define STK8312_SR_400HZ_IDX 0 +#define STK8312_MODE_INT_AH_PP 0xC0 /* active-high, push-pull */ +#define STK8312_DREADY_BIT BIT(4) +#define STK8312_RNG_6G 1 #define STK8312_RNG_SHIFT 6 -#define STK8312_READ_RETRIES 16 -#define STK8312_ALL_CHANNEL_MASK 7 +#define STK8312_RNG_MASK GENMASK(7, 6) +#define STK8312_SR_MASK GENMASK(2, 0) +#define STK8312_SR_400HZ_IDX 0 +#define STK8312_ALL_CHANNEL_MASK GENMASK(2, 0) #define STK8312_ALL_CHANNEL_SIZE 3 #define STK8312_DRIVER_NAME "stk8312" @@ -144,7 +144,7 @@ static int stk8312_otp_init(struct stk8312_data *data) if (ret < 0) goto exit_err; count--; - } while (!(ret & 0x80) && count > 0); + } while (!(ret & BIT(7)) && count > 0); if (count == 0) { ret = -ETIMEDOUT; @@ -565,11 +565,12 @@ static int stk8312_probe(struct i2c_client *client, return ret; } data->sample_rate_idx = STK8312_SR_400HZ_IDX; - ret = stk8312_set_range(data, 1); + ret = stk8312_set_range(data, STK8312_RNG_6G); if (ret < 0) return ret; - ret = stk8312_set_mode(data, STK8312_INT_MODE | STK8312_MODE_ACTIVE); + ret = stk8312_set_mode(data, + STK8312_MODE_INT_AH_PP | STK8312_MODE_ACTIVE); if (ret < 0) return ret; @@ -691,7 +692,7 @@ MODULE_DEVICE_TABLE(acpi, stk8312_acpi_id); static struct i2c_driver stk8312_driver = { .driver = { - .name = "stk8312", + .name = STK8312_DRIVER_NAME, .pm = STK8312_PM_OPS, .acpi_match_table = ACPI_PTR(stk8312_acpi_id), }, From 7d73e02c5d11ac1298b0a363b57d713969c02bbd Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 29 Jul 2015 23:39:38 +0200 Subject: [PATCH 732/912] iio:accel:stk8312: use appropriate variable types Adapt some variable types to reduce unnecessary casting. Signed-off-by: Hartmut Knaack Reviewed-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index d406ad05b8e5..4a697446f196 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -69,8 +69,8 @@ static const int stk8312_scale_table[][2] = { }; static const struct { - u16 val; - u32 val2; + int val; + int val2; } stk8312_samp_freq_table[] = { {400, 0}, {200, 0}, {100, 0}, {50, 0}, {25, 0}, {12, 500000}, {6, 250000}, {3, 125000} @@ -103,7 +103,7 @@ static const struct iio_chan_spec stk8312_channels[] = { struct stk8312_data { struct i2c_client *client; struct mutex lock; - int range; + u8 range; u8 sample_rate_idx; u8 mode; struct iio_trigger *dready_trig; @@ -243,7 +243,7 @@ static const struct iio_trigger_ops stk8312_trigger_ops = { .owner = THIS_MODULE, }; -static int stk8312_set_sample_rate(struct stk8312_data *data, int rate) +static int stk8312_set_sample_rate(struct stk8312_data *data, u8 rate) { int ret; u8 masked_reg; From dca5d2846514c0f3d95827d291310a403fc0ebb7 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 29 Jul 2015 23:39:39 +0200 Subject: [PATCH 733/912] iio:accel:stk8312: code style cleanup Adjust some indentation issues to make checkpatch.pl happy in strict mode. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index 4a697446f196..c5a47650b453 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -157,8 +157,7 @@ static int stk8312_otp_init(struct stk8312_data *data) if (ret < 0) goto exit_err; - ret = i2c_smbus_write_byte_data(data->client, - STK8312_REG_AFECTRL, ret); + ret = i2c_smbus_write_byte_data(data->client, STK8312_REG_AFECTRL, ret); if (ret < 0) goto exit_err; msleep(150); @@ -458,7 +457,7 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) data->buffer[2] = buffer[2]; } else { for_each_set_bit(bit, indio_dev->active_scan_mask, - indio_dev->masklength) { + indio_dev->masklength) { ret = stk8312_read_accel(data, bit); if (ret < 0) { mutex_unlock(&data->lock); From 7a9fbd250ce274a1a625b1e2055abfe26328e46b Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 29 Jul 2015 23:39:40 +0200 Subject: [PATCH 734/912] iio:accel:stk8312: drop local buffer Drop the local buffer in stk8312_trigger_handler() and use data->buffer instead for bulk reads. Signed-off-by: Hartmut Knaack Reviewed-by: Tiberiu Breana Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index c5a47650b453..c764af284c94 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -435,7 +435,6 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) struct iio_dev *indio_dev = pf->indio_dev; struct stk8312_data *data = iio_priv(indio_dev); int bit, ret, i = 0; - u8 buffer[STK8312_ALL_CHANNEL_SIZE]; mutex_lock(&data->lock); /* @@ -446,15 +445,12 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) ret = i2c_smbus_read_i2c_block_data(data->client, STK8312_REG_XOUT, STK8312_ALL_CHANNEL_SIZE, - buffer); + data->buffer); if (ret < STK8312_ALL_CHANNEL_SIZE) { dev_err(&data->client->dev, "register read failed\n"); mutex_unlock(&data->lock); goto err; } - data->buffer[0] = buffer[0]; - data->buffer[1] = buffer[1]; - data->buffer[2] = buffer[2]; } else { for_each_set_bit(bit, indio_dev->active_scan_mask, indio_dev->masklength) { From ad30bad3a5474f2585a7f2a35d4705c7f85210f3 Mon Sep 17 00:00:00 2001 From: Pengyu Ma Date: Tue, 4 Aug 2015 16:32:18 +0800 Subject: [PATCH 735/912] iio: declare struct to fix warning When compile iio related driver the following warning shown: include/linux/iio/trigger.h:35:34: warning: 'struct iio_trigger' declared inside parameter list int (*set_trigger_state)(struct iio_trigger *trig, bool state); include/linux/iio/trigger.h:38:18: warning: 'struct iio_dev' declared inside parameter list struct iio_dev *indio_dev); 'struct iio_dev' and 'struct iio_trigger' was used before declaration, forward declaration for these structs to fix warning. Signed-off-by: Pengyu Ma Acked-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- include/linux/iio/trigger.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index fa76c79a52a1..1c9e028e0d4a 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h @@ -18,6 +18,9 @@ struct iio_subirq { bool enabled; }; +struct iio_dev; +struct iio_trigger; + /** * struct iio_trigger_ops - operations structure for an iio_trigger. * @owner: used to monitor usage count of the trigger. From aab978772a4fbe71d8231cb58d0989737db27a36 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Tue, 4 Aug 2015 17:20:08 +0300 Subject: [PATCH 736/912] DocBook: Add initial documentation for IIO This is intended to help developers faster find their way inside the Industrial I/O core and reduce time spent on IIO drivers development. Signed-off-by: Daniel Baluta Acked-by: Crt Mori Reviewed-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- Documentation/DocBook/Makefile | 2 +- Documentation/DocBook/iio.tmpl | 697 +++++++++++++++++++++++++++++++++ 2 files changed, 698 insertions(+), 1 deletion(-) create mode 100644 Documentation/DocBook/iio.tmpl diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index b6a6a2e0dd3b..9e086067b4ae 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -15,7 +15,7 @@ DOCBOOKS := z8530book.xml device-drivers.xml \ 80211.xml debugobjects.xml sh.xml regulator.xml \ alsa-driver-api.xml writing-an-alsa-driver.xml \ tracepoint.xml drm.xml media_api.xml w1.xml \ - writing_musb_glue_layer.xml crypto-API.xml + writing_musb_glue_layer.xml crypto-API.xml iio.xml include Documentation/DocBook/media/Makefile diff --git a/Documentation/DocBook/iio.tmpl b/Documentation/DocBook/iio.tmpl new file mode 100644 index 000000000000..06bb53de5a47 --- /dev/null +++ b/Documentation/DocBook/iio.tmpl @@ -0,0 +1,697 @@ + + + + + + Industrial I/O driver developer's guide + + + + Daniel + Baluta + +
+ daniel.baluta@intel.com +
+
+
+
+ + + 2015 + Intel Corporation + + + + + This documentation is free software; you can redistribute + it and/or modify it under the terms of the GNU General Public + License version 2. + + +
+ + + + + Introduction + + The main purpose of the Industrial I/O subsystem (IIO) is to provide + support for devices that in some sense perform either analog-to-digital + conversion (ADC) or digital-to-analog conversion (DAC) or both. The aim + is to fill the gap between the somewhat similar hwmon and input + subsystems. + Hwmon is directed at low sample rate sensors used to monitor and + control the system itself, like fan speed control or temperature + measurement. Input is, as its name suggests, focused on human interaction + input devices (keyboard, mouse, touchscreen). In some cases there is + considerable overlap between these and IIO. + + + Devices that fall into this category include: + + + analog to digital converters (ADCs) + + + accelerometers + + + capacitance to digital converters (CDCs) + + + digital to analog converters (DACs) + + + gyroscopes + + + inertial measurement units (IMUs) + + + color and light sensors + + + magnetometers + + + pressure sensors + + + proximity sensors + + + temperature sensors + + + Usually these sensors are connected via SPI or I2C. A common use case of the + sensors devices is to have combined functionality (e.g. light plus proximity + sensor). + + + + Industrial I/O core + + The Industrial I/O core offers: + + + a unified framework for writing drivers for many different types of + embedded sensors. + + + a standard interface to user space applications manipulating sensors. + + + The implementation can be found under + drivers/iio/industrialio-* + + + Industrial I/O devices + +!Finclude/linux/iio/iio.h iio_dev +!Fdrivers/iio/industrialio-core.c iio_device_alloc +!Fdrivers/iio/industrialio-core.c iio_device_free +!Fdrivers/iio/industrialio-core.c iio_device_register +!Fdrivers/iio/industrialio-core.c iio_device_unregister + + + An IIO device usually corresponds to a single hardware sensor and it + provides all the information needed by a driver handling a device. + Let's first have a look at the functionality embedded in an IIO + device then we will show how a device driver makes use of an IIO + device. + + + There are two ways for a user space application to interact + with an IIO driver. + + + /sys/bus/iio/iio:deviceX/, this + represents a hardware sensor and groups together the data + channels of the same chip. + + + /dev/iio:deviceX, character device node + interface used for buffered data transfer and for events information + retrieval. + + + + A typical IIO driver will register itself as an I2C or SPI driver and will + create two routines, probe and remove + . At probe: + + call iio_device_alloc, which allocates memory + for an IIO device. + + initialize IIO device fields with driver specific information + (e.g. device name, device channels). + + call iio_device_register, this registers the + device with the IIO core. After this call the device is ready to accept + requests from user space applications. + + + At remove, we free the resources allocated in + probe in reverse order: + + iio_device_unregister, unregister the device + from the IIO core. + + iio_device_free, free the memory allocated + for the IIO device. + + + + IIO device sysfs interface + + Attributes are sysfs files used to expose chip info and also allowing + applications to set various configuration parameters. For device + with index X, attributes can be found under + /sys/bus/iio/iio:deviceX/ directory. + Common attributes are: + + name, description of the physical + chip. + + dev, shows the major:minor pair + associated with /dev/iio:deviceX node. + + sampling_frequency_available, + available discrete set of sampling frequency values for + device. + + + Available standard attributes for IIO devices are described in the + Documentation/ABI/testing/sysfs-bus-iio file + in the Linux kernel sources. + + + IIO device channels +!Finclude/linux/iio/iio.h iio_chan_spec structure. + + An IIO device channel is a representation of a data channel. An + IIO device can have one or multiple channels. For example: + + + a thermometer sensor has one channel representing the + temperature measurement. + + + a light sensor with two channels indicating the measurements in + the visible and infrared spectrum. + + + an accelerometer can have up to 3 channels representing + acceleration on X, Y and Z axes. + + + An IIO channel is described by the struct iio_chan_spec + . A thermometer driver for the temperature sensor in the + example above would have to describe its channel as follows: + + static const struct iio_chan_spec temp_channel[] = { + { + .type = IIO_TEMP, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), + }, + }; + + + Channel sysfs attributes exposed to userspace are specified in + the form of bitmasks. Depending on their + shared info, attributes can be set in one of the following masks: + + info_mask_separate, attributes will + be specific to this channel + info_mask_shared_by_type, + attributes are shared by all channels of the same type + info_mask_shared_by_dir, attributes + are shared by all channels of the same direction + info_mask_shared_by_all, + attributes are shared by all channels + + When there are multiple data channels per channel type we have two + ways to distinguish between them: + + set .modified field of + iio_chan_spec to 1. Modifiers are specified using + .channel2 field of the same + iio_chan_spec structure and are used to indicate a + physically unique characteristic of the channel such as its direction + or spectral response. For example, a light sensor can have two channels, + one for infrared light and one for both infrared and visible light. + + set .indexed field of + iio_chan_spec to 1. In this case the channel is + simply another instance with an index specified by the + .channel field. + + + Here is how we can make use of the channel's modifiers: + + static const struct iio_chan_spec light_channels[] = { + { + .type = IIO_INTENSITY, + .modified = 1, + .channel2 = IIO_MOD_LIGHT_IR, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .info_mask_shared = BIT(IIO_CHAN_INFO_SAMP_FREQ), + }, + { + .type = IIO_INTENSITY, + .modified = 1, + .channel2 = IIO_MOD_LIGHT_BOTH, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .info_mask_shared = BIT(IIO_CHAN_INFO_SAMP_FREQ), + }, + { + .type = IIO_LIGHT, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), + .info_mask_shared = BIT(IIO_CHAN_INFO_SAMP_FREQ), + }, + + } + + This channel's definition will generate two separate sysfs files + for raw data retrieval: + + + /sys/bus/iio/iio:deviceX/in_intensity_ir_raw + + + /sys/bus/iio/iio:deviceX/in_intensity_both_raw + + + one file for processed data: + + + /sys/bus/iio/iio:deviceX/in_illuminance_input + + + + and one shared sysfs file for sampling frequency: + + + /sys/bus/iio/iio:deviceX/sampling_frequency. + + + + + + Here is how we can make use of the channel's indexing: + + static const struct iio_chan_spec light_channels[] = { + { + .type = IIO_VOLTAGE, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, + { + .type = IIO_VOLTAGE, + .indexed = 1, + .channel = 1, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, + } + + This will generate two separate attributes files for raw data + retrieval: + + + /sys/bus/iio/devices/iio:deviceX/in_voltage0_raw, + representing voltage measurement for channel 0. + + + /sys/bus/iio/devices/iio:deviceX/in_voltage1_raw, + representing voltage measurement for channel 1. + + + + + + + Industrial I/O buffers +!Finclude/linux/iio/buffer.h iio_buffer +!Edrivers/iio/industrialio-buffer.c + + + The Industrial I/O core offers a way for continuous data capture + based on a trigger source. Multiple data channels can be read at once + from /dev/iio:deviceX character device node, + thus reducing the CPU load. + + + + IIO buffer sysfs interface + + An IIO buffer has an associated attributes directory under + /sys/bus/iio/iio:deviceX/buffer/. Here are the existing + attributes: + + + length, the total number of data samples + (capacity) that can be stored by the buffer. + + + enable, activate buffer capture. + + + + + + IIO buffer setup + The meta information associated with a channel reading + placed in a buffer is called a scan element . + The important bits configuring scan elements are exposed to + userspace applications via the + /sys/bus/iio/iio:deviceX/scan_elements/ directory. This + file contains attributes of the following form: + + enable, used for enabling a channel. + If and only if its attribute is non zero, then a triggered capture + will contain data samples for this channel. + + type, description of the scan element + data storage within the buffer and hence the form in which it is + read from user space. Format is + [be|le]:[s|u]bits/storagebitsXrepeat[>>shift] . + + be or le, specifies + big or little endian. + + + s or u, specifies if + signed (2's complement) or unsigned. + + bits, is the number of valid data + bits. + + storagebits, is the number of bits + (after padding) that it occupies in the buffer. + + + shift, if specified, is the shift that needs + to be applied prior to masking out unused bits. + + + repeat, specifies the number of bits/storagebits + repetitions. When the repeat element is 0 or 1, then the repeat + value is omitted. + + + + + For example, a driver for a 3-axis accelerometer with 12 bit + resolution where data is stored in two 8-bits registers as + follows: + + 7 6 5 4 3 2 1 0 + +---+---+---+---+---+---+---+---+ + |D3 |D2 |D1 |D0 | X | X | X | X | (LOW byte, address 0x06) + +---+---+---+---+---+---+---+---+ + + 7 6 5 4 3 2 1 0 + +---+---+---+---+---+---+---+---+ + |D11|D10|D9 |D8 |D7 |D6 |D5 |D4 | (HIGH byte, address 0x07) + +---+---+---+---+---+---+---+---+ + + + will have the following scan element type for each axis: + + $ cat /sys/bus/iio/devices/iio:device0/scan_elements/in_accel_y_type + le:s12/16>>4 + + A user space application will interpret data samples read from the + buffer as two byte little endian signed data, that needs a 4 bits + right shift before masking out the 12 valid bits of data. + + + For implementing buffer support a driver should initialize the following + fields in iio_chan_spec definition: + + struct iio_chan_spec { + /* other members */ + int scan_index + struct { + char sign; + u8 realbits; + u8 storagebits; + u8 shift; + u8 repeat; + enum iio_endian endianness; + } scan_type; + }; + + The driver implementing the accelerometer described above will + have the following channel definition: + + struct struct iio_chan_spec accel_channels[] = { + { + .type = IIO_ACCEL, + .modified = 1, + .channel2 = IIO_MOD_X, + /* other stuff here */ + .scan_index = 0, + .scan_type = { + .sign = 's', + .realbits = 12, + .storgebits = 16, + .shift = 4, + .endianness = IIO_LE, + }, + } + /* similar for Y (with channel2 = IIO_MOD_Y, scan_index = 1) + * and Z (with channel2 = IIO_MOD_Z, scan_index = 2) axis + */ + } + + + + Here scan_index defines the order in which + the enabled channels are placed inside the buffer. Channels with a lower + scan_index will be placed before channels with a higher index. Each + channel needs to have a unique scan_index. + + + Setting scan_index to -1 can be used to indicate that the specific + channel does not support buffered capture. In this case no entries will + be created for the channel in the scan_elements directory. + + + + + Industrial I/O triggers +!Finclude/linux/iio/trigger.h iio_trigger +!Edrivers/iio/industrialio-trigger.c + + In many situations it is useful for a driver to be able to + capture data based on some external event (trigger) as opposed + to periodically polling for data. An IIO trigger can be provided + by a device driver that also has an IIO device based on hardware + generated events (e.g. data ready or threshold exceeded) or + provided by a separate driver from an independent interrupt + source (e.g. GPIO line connected to some external system, timer + interrupt or user space writing a specific file in sysfs). A + trigger may initiate data capture for a number of sensors and + also it may be completely unrelated to the sensor itself. + + + IIO trigger sysfs interface + There are two locations in sysfs related to triggers: + + /sys/bus/iio/devices/triggerY, + this file is created once an IIO trigger is registered with + the IIO core and corresponds to trigger with index Y. Because + triggers can be very different depending on type there are few + standard attributes that we can describe here: + + + name, trigger name that can be later + used for association with a device. + + + sampling_frequency, some timer based + triggers use this attribute to specify the frequency for + trigger calls. + + + + + /sys/bus/iio/devices/iio:deviceX/trigger/, this + directory is created once the device supports a triggered + buffer. We can associate a trigger with our device by writing + the trigger's name in the current_trigger file. + + + + + IIO trigger setup + + + Let's see a simple example of how to setup a trigger to be used + by a driver. + + + struct iio_trigger_ops trigger_ops = { + .set_trigger_state = sample_trigger_state, + .validate_device = sample_validate_device, + } + + struct iio_trigger *trig; + + /* first, allocate memory for our trigger */ + trig = iio_trigger_alloc(dev, "trig-%s-%d", name, idx); + + /* setup trigger operations field */ + trig->ops = &trigger_ops; + + /* now register the trigger with the IIO core */ + iio_trigger_register(trig); + + + + + IIO trigger ops +!Finclude/linux/iio/trigger.h iio_trigger_ops + + Notice that a trigger has a set of operations attached: + + + set_trigger_state, switch the trigger on/off + on demand. + + + validate_device, function to validate the + device when the current trigger gets changed. + + + + + + + Industrial I/O triggered buffers + + Now that we know what buffers and triggers are let's see how they + work together. + + IIO triggered buffer setup +!Edrivers/iio/industrialio-triggered-buffer.c +!Finclude/linux/iio/iio.h iio_buffer_setup_ops + + + + A typical triggered buffer setup looks like this: + + const struct iio_buffer_setup_ops sensor_buffer_setup_ops = { + .preenable = sensor_buffer_preenable, + .postenable = sensor_buffer_postenable, + .postdisable = sensor_buffer_postdisable, + .predisable = sensor_buffer_predisable, + }; + + irqreturn_t sensor_iio_pollfunc(int irq, void *p) + { + pf->timestamp = iio_get_time_ns(); + return IRQ_WAKE_THREAD; + } + + irqreturn_t sensor_trigger_handler(int irq, void *p) + { + u16 buf[8]; + int i = 0; + + /* read data for each active channel */ + for_each_set_bit(bit, active_scan_mask, masklength) + buf[i++] = sensor_get_data(bit) + + iio_push_to_buffers_with_timestamp(indio_dev, buf, timestamp); + + iio_trigger_notify_done(trigger); + return IRQ_HANDLED; + } + + /* setup triggered buffer, usually in probe function */ + iio_triggered_buffer_setup(indio_dev, sensor_iio_polfunc, + sensor_trigger_handler, + sensor_buffer_setup_ops); + + + The important things to notice here are: + + iio_buffer_setup_ops, the buffer setup + functions to be called at predefined points in the buffer configuration + sequence (e.g. before enable, after disable). If not specified, the + IIO core uses the default iio_triggered_buffer_setup_ops. + + sensor_iio_pollfunc, the function that + will be used as top half of poll function. It should do as little + processing as possible, because it runs in interrupt context. The most + common operation is recording of the current timestamp and for this reason + one can use the IIO core defined iio_pollfunc_store_time + function. + + sensor_trigger_handler, the function that + will be used as bottom half of the poll function. This runs in the + context of a kernel thread and all the processing takes place here. + It usually reads data from the device and stores it in the internal + buffer together with the timestamp recorded in the top half. + + + + + + + Resources + IIO core may change during time so the best documentation to read is the + source code. There are several locations where you should look: + + + drivers/iio/, contains the IIO core plus + and directories for each sensor type (e.g. accel, magnetometer, + etc.) + + + include/linux/iio/, contains the header + files, nice to read for the internal kernel interfaces. + + + include/uapi/linux/iio/, contains files to be + used by user space applications. + + + tools/iio/, contains tools for rapidly + testing buffers, events and device creation. + + + drivers/staging/iio/, contains code for some + drivers or experimental features that are not yet mature enough + to be moved out. + + + + Besides the code, there are some good online documentation sources: + + + Industrial I/O mailing + list + + + + Analog Device IIO wiki page + + + + Using the Linux IIO framework for SDR, Lars-Peter Clausen's + presentation at FOSDEM + + + + +
+ + From 655665d67c8465501a46aa8ffde4e6e29201ba99 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 6 Aug 2015 14:17:53 +0300 Subject: [PATCH 737/912] iio: Documentation: Add trigger name attribute ABI documentation This patch adds an entry in ABI Documentation for the name attribute issued when a trigger is created. Signed-off-by: Cristina Opriceana Acked-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- Documentation/ABI/testing/sysfs-bus-iio-trigger-sysfs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio-trigger-sysfs b/Documentation/ABI/testing/sysfs-bus-iio-trigger-sysfs index 5235e6c749ab..bbb039237a25 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-trigger-sysfs +++ b/Documentation/ABI/testing/sysfs-bus-iio-trigger-sysfs @@ -9,3 +9,12 @@ Description: automated testing or in situations, where other trigger methods are not applicable. For example no RTC or spare GPIOs. X is the IIO index of the trigger. + +What: /sys/bus/iio/devices/triggerX/name +KernelVersion: 2.6.39 +Contact: linux-iio@vger.kernel.org +Description: + The name attribute holds a description string for the current + trigger. In order to associate the trigger with an IIO device + one should write this name string to + /sys/bus/iio/devices/iio:deviceY/trigger/current_trigger. From 8e563b0dabcce7cad80af9bb40b220004f411092 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 6 Aug 2015 14:56:02 +0300 Subject: [PATCH 738/912] iio: trigger: Add missing fields in kernel docs Fix kernel docs warnings by adding the missing description for each of the existing function parameters. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-trigger.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index d31098e0c43f..570606c2adbd 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -40,7 +40,14 @@ static DEFINE_MUTEX(iio_trigger_list_lock); /** * iio_trigger_read_name() - retrieve useful identifying name - **/ + * @dev: device associated with the iio_trigger + * @attr: pointer to the device_attribute structure that is + * being processed + * @buf: buffer to print the name into + * + * Return: a negative number on failure or the number of written + * characters on success. + */ static ssize_t iio_trigger_read_name(struct device *dev, struct device_attribute *attr, char *buf) @@ -288,10 +295,17 @@ EXPORT_SYMBOL_GPL(iio_dealloc_pollfunc); /** * iio_trigger_read_current() - trigger consumer sysfs query current trigger + * @dev: device associated with an industrial I/O device + * @attr: pointer to the device_attribute structure that + * is being processed + * @buf: buffer where the current trigger name will be printed into * * For trigger consumers the current_trigger interface allows the trigger * used by the device to be queried. - **/ + * + * Return: a negative number on failure, the number of characters written + * on success or 0 if no trigger is available + */ static ssize_t iio_trigger_read_current(struct device *dev, struct device_attribute *attr, char *buf) @@ -305,11 +319,18 @@ static ssize_t iio_trigger_read_current(struct device *dev, /** * iio_trigger_write_current() - trigger consumer sysfs set current trigger + * @dev: device associated with an industrial I/O device + * @attr: device attribute that is being processed + * @buf: string buffer that holds the name of the trigger + * @len: length of the trigger name held by buf * * For trigger consumers the current_trigger interface allows the trigger * used for this device to be specified at run time based on the trigger's * name. - **/ + * + * Return: negative error code on failure or length of the buffer + * on success + */ static ssize_t iio_trigger_write_current(struct device *dev, struct device_attribute *attr, const char *buf, From 8166537283b31d7abaae9e56bd48fbbc30cdc579 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:13 +0200 Subject: [PATCH 739/912] iio: adis16400: Fix adis16448 gyroscope scale Use the correct scale for the adis16448 gyroscope output. Signed-off-by: Lars-Peter Clausen Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis16400_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index 2fd68f2219a7..d42e4fe2c7ed 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c @@ -780,7 +780,7 @@ static struct adis16400_chip_info adis16400_chips[] = { .flags = ADIS16400_HAS_PROD_ID | ADIS16400_HAS_SERIAL_NUMBER | ADIS16400_BURST_DIAG_STAT, - .gyro_scale_micro = IIO_DEGREE_TO_RAD(10000), /* 0.01 deg/s */ + .gyro_scale_micro = IIO_DEGREE_TO_RAD(40000), /* 0.04 deg/s */ .accel_scale_micro = IIO_G_TO_M_S_2(833), /* 1/1200 g */ .temp_scale_nano = 73860000, /* 0.07386 C */ .temp_offset = 31000000 / 73860, /* 31 C = 0x00 */ From c689a923c867eac40ed3826c1d9328edea8b6bc7 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:14 +0200 Subject: [PATCH 740/912] iio: Add inverse unit conversion macros Add inverse unit conversion macro to convert from standard IIO units to units that might be used by some devices. Those are useful in combination with scale factors that are specified as IIO_VAL_FRACTIONAL. Typically the denominator for those specifications will contain the maximum raw value the sensor will generate and the numerator the value it maps to in a specific unit. Sometimes datasheets specify those in different units than the standard IIO units (e.g. degree/s instead of rad/s) and so we need to do a unit conversion. From a mathematical point of view it does not make a difference whether we apply the unit conversion to the numerator or the inverse unit conversion to the denominator since (x / y) / z = x / (y * z). But as the denominator is typically a larger value and we are rounding both the numerator and denominator to integer values using the later method gives us a better precision (E.g. the relative error is smaller if we round 8000.3 to 8000 rather than rounding 8.3 to 8). This is where in inverse unit conversion macros will be used. Marked for stable as used by some upcoming fixes. Signed-off-by: Lars-Peter Clausen Cc: Signed-off-by: Jonathan Cameron --- include/linux/iio/iio.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index f79148261d16..7bb7f673cb3f 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -644,6 +644,15 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, */ #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL) +/** + * IIO_RAD_TO_DEGREE() - Convert rad to degree + * @rad: A value in rad + * + * Returns the given value converted from rad to degree + */ +#define IIO_RAD_TO_DEGREE(rad) \ + (((rad) * 18000000ULL + 314159ULL / 2) / 314159ULL) + /** * IIO_G_TO_M_S_2() - Convert g to meter / second**2 * @g: A value in g @@ -652,4 +661,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, */ #define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL) +/** + * IIO_M_S_2_TO_G() - Convert meter / second**2 to g + * @ms2: A value in meter / second**2 + * + * Returns the given value converted from meter / second**2 to g + */ +#define IIO_M_S_2_TO_G(ms2) (((ms2) * 100000ULL + 980665ULL / 2) / 980665ULL) + #endif /* _INDUSTRIAL_IO_H_ */ From 7abad1063deb0f77d275c61f58863ec319c58c5c Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:15 +0200 Subject: [PATCH 741/912] iio: adis16480: Fix scale factors The different devices support by the adis16480 driver have slightly different scales for the gyroscope and accelerometer channels. Signed-off-by: Lars-Peter Clausen Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis16480.c | 39 +++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c index 989605dd6f78..b94bfd3f595b 100644 --- a/drivers/iio/imu/adis16480.c +++ b/drivers/iio/imu/adis16480.c @@ -110,6 +110,10 @@ struct adis16480_chip_info { unsigned int num_channels; const struct iio_chan_spec *channels; + unsigned int gyro_max_val; + unsigned int gyro_max_scale; + unsigned int accel_max_val; + unsigned int accel_max_scale; }; struct adis16480 { @@ -497,19 +501,21 @@ static int adis16480_set_filter_freq(struct iio_dev *indio_dev, static int adis16480_read_raw(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, int *val, int *val2, long info) { + struct adis16480 *st = iio_priv(indio_dev); + switch (info) { case IIO_CHAN_INFO_RAW: return adis_single_conversion(indio_dev, chan, 0, val); case IIO_CHAN_INFO_SCALE: switch (chan->type) { case IIO_ANGL_VEL: - *val = 0; - *val2 = IIO_DEGREE_TO_RAD(20000); /* 0.02 degree/sec */ - return IIO_VAL_INT_PLUS_MICRO; + *val = st->chip_info->gyro_max_scale; + *val2 = st->chip_info->gyro_max_val; + return IIO_VAL_FRACTIONAL; case IIO_ACCEL: - *val = 0; - *val2 = IIO_G_TO_M_S_2(800); /* 0.8 mg */ - return IIO_VAL_INT_PLUS_MICRO; + *val = st->chip_info->accel_max_scale; + *val2 = st->chip_info->accel_max_val; + return IIO_VAL_FRACTIONAL; case IIO_MAGN: *val = 0; *val2 = 100; /* 0.0001 gauss */ @@ -674,18 +680,39 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { [ADIS16375] = { .channels = adis16485_channels, .num_channels = ARRAY_SIZE(adis16485_channels), + /* + * storing the value in rad/degree and the scale in degree + * gives us the result in rad and better precession than + * storing the scale directly in rad. + */ + .gyro_max_val = IIO_RAD_TO_DEGREE(22887), + .gyro_max_scale = 300, + .accel_max_val = IIO_M_S_2_TO_G(21973), + .accel_max_scale = 18, }, [ADIS16480] = { .channels = adis16480_channels, .num_channels = ARRAY_SIZE(adis16480_channels), + .gyro_max_val = IIO_RAD_TO_DEGREE(22500), + .gyro_max_scale = 450, + .accel_max_val = IIO_M_S_2_TO_G(12500), + .accel_max_scale = 5, }, [ADIS16485] = { .channels = adis16485_channels, .num_channels = ARRAY_SIZE(adis16485_channels), + .gyro_max_val = IIO_RAD_TO_DEGREE(22500), + .gyro_max_scale = 450, + .accel_max_val = IIO_M_S_2_TO_G(20000), + .accel_max_scale = 5, }, [ADIS16488] = { .channels = adis16480_channels, .num_channels = ARRAY_SIZE(adis16480_channels), + .gyro_max_val = IIO_RAD_TO_DEGREE(22500), + .gyro_max_scale = 450, + .accel_max_val = IIO_M_S_2_TO_G(22500), + .accel_max_scale = 18, }, }; From bd95a89e7a80cb0ee57e9ccd62de0dd80f98a270 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:16 +0200 Subject: [PATCH 742/912] iio: adis16400: adis16300 has product ID and serial number The ADIS16300 has the product ID and serial number registers, they are just not documented. Set the appropriate flags so the driver makes use of them. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis16400_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index d42e4fe2c7ed..7d612ab79a87 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c @@ -696,7 +696,8 @@ static struct adis16400_chip_info adis16400_chips[] = { [ADIS16300] = { .channels = adis16300_channels, .num_channels = ARRAY_SIZE(adis16300_channels), - .flags = ADIS16400_HAS_SLOW_MODE, + .flags = ADIS16400_HAS_PROD_ID | ADIS16400_HAS_SLOW_MODE | + ADIS16400_HAS_SERIAL_NUMBER, .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ .accel_scale_micro = 5884, .temp_scale_nano = 140000000, /* 0.14 C */ From 3c386760790e3d3d5cb3ac2f0e09f3710eab7f99 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:17 +0200 Subject: [PATCH 743/912] iio: adis16400: Add ADIS16305 support The ADIS16305 is fully register map compatible to the ADIS16300. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis16400_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index 7d612ab79a87..e4cc2ecb42e2 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c @@ -927,6 +927,7 @@ static int adis16400_remove(struct spi_device *spi) static const struct spi_device_id adis16400_id[] = { {"adis16300", ADIS16300}, + {"adis16305", ADIS16300}, {"adis16334", ADIS16334}, {"adis16350", ADIS16350}, {"adis16354", ADIS16350}, From f1afda124badf1cf4b013722d55934536ff0892c Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:18 +0200 Subject: [PATCH 744/912] iio: adis16260: Add ADIS16266 support The ADIS16266 is mostly register compatible to the ADIS16260. The difference is a different gyroscope scale factor as well not having the relative angular displacement channel. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/gyro/adis16260.c | 137 +++++++++++++++++++++++++---------- 1 file changed, 98 insertions(+), 39 deletions(-) diff --git a/drivers/iio/gyro/adis16260.c b/drivers/iio/gyro/adis16260.c index 75fe0edd3d0f..00c6ad9bf35f 100644 --- a/drivers/iio/gyro/adis16260.c +++ b/drivers/iio/gyro/adis16260.c @@ -101,19 +101,24 @@ #define ADIS16260_SCAN_TEMP 3 #define ADIS16260_SCAN_ANGL 4 -/* Power down the device */ -static int adis16260_stop_device(struct iio_dev *indio_dev) -{ - struct adis *adis = iio_priv(indio_dev); - int ret; - u16 val = ADIS16260_SLP_CNT_POWER_OFF; +struct adis16260_chip_info { + unsigned int gyro_max_val; + unsigned int gyro_max_scale; + const struct iio_chan_spec *channels; + unsigned int num_channels; +}; - ret = adis_write_reg_16(adis, ADIS16260_SLP_CNT, val); - if (ret) - dev_err(&indio_dev->dev, "problem with turning device off: SLP_CNT"); +struct adis16260 { + const struct adis16260_chip_info *info; - return ret; -} + struct adis adis; +}; + +enum adis16260_type { + ADIS16251, + ADIS16260, + ADIS16266, +}; static const struct iio_chan_spec adis16260_channels[] = { ADIS_GYRO_CHAN(X, ADIS16260_GYRO_OUT, ADIS16260_SCAN_GYRO, @@ -131,6 +136,55 @@ static const struct iio_chan_spec adis16260_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(5), }; +static const struct iio_chan_spec adis16266_channels[] = { + ADIS_GYRO_CHAN(X, ADIS16260_GYRO_OUT, ADIS16260_SCAN_GYRO, + BIT(IIO_CHAN_INFO_CALIBBIAS) | + BIT(IIO_CHAN_INFO_CALIBSCALE), + BIT(IIO_CHAN_INFO_SAMP_FREQ), 14), + ADIS_TEMP_CHAN(ADIS16260_TEMP_OUT, ADIS16260_SCAN_TEMP, + BIT(IIO_CHAN_INFO_SAMP_FREQ), 12), + ADIS_SUPPLY_CHAN(ADIS16260_SUPPLY_OUT, ADIS16260_SCAN_SUPPLY, + BIT(IIO_CHAN_INFO_SAMP_FREQ), 12), + ADIS_AUX_ADC_CHAN(ADIS16260_AUX_ADC, ADIS16260_SCAN_AUX_ADC, + BIT(IIO_CHAN_INFO_SAMP_FREQ), 12), + IIO_CHAN_SOFT_TIMESTAMP(4), +}; + +static const struct adis16260_chip_info adis16260_chip_info_table[] = { + [ADIS16251] = { + .gyro_max_scale = 80, + .gyro_max_val = IIO_RAD_TO_DEGREE(4368), + .channels = adis16260_channels, + .num_channels = ARRAY_SIZE(adis16260_channels), + }, + [ADIS16260] = { + .gyro_max_scale = 320, + .gyro_max_val = IIO_RAD_TO_DEGREE(4368), + .channels = adis16260_channels, + .num_channels = ARRAY_SIZE(adis16260_channels), + }, + [ADIS16266] = { + .gyro_max_scale = 14000, + .gyro_max_val = IIO_RAD_TO_DEGREE(3357), + .channels = adis16266_channels, + .num_channels = ARRAY_SIZE(adis16266_channels), + }, +}; + +/* Power down the device */ +static int adis16260_stop_device(struct iio_dev *indio_dev) +{ + struct adis16260 *adis16260 = iio_priv(indio_dev); + int ret; + u16 val = ADIS16260_SLP_CNT_POWER_OFF; + + ret = adis_write_reg_16(&adis16260->adis, ADIS16260_SLP_CNT, val); + if (ret) + dev_err(&indio_dev->dev, "problem with turning device off: SLP_CNT"); + + return ret; +} + static const u8 adis16260_addresses[][2] = { [ADIS16260_SCAN_GYRO] = { ADIS16260_GYRO_OFF, ADIS16260_GYRO_SCALE }, }; @@ -140,7 +194,9 @@ static int adis16260_read_raw(struct iio_dev *indio_dev, int *val, int *val2, long mask) { - struct adis *adis = iio_priv(indio_dev); + struct adis16260 *adis16260 = iio_priv(indio_dev); + const struct adis16260_chip_info *info = adis16260->info; + struct adis *adis = &adis16260->adis; int ret; u8 addr; s16 val16; @@ -152,15 +208,9 @@ static int adis16260_read_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_SCALE: switch (chan->type) { case IIO_ANGL_VEL: - *val = 0; - if (spi_get_device_id(adis->spi)->driver_data) { - /* 0.01832 degree / sec */ - *val2 = IIO_DEGREE_TO_RAD(18320); - } else { - /* 0.07326 degree / sec */ - *val2 = IIO_DEGREE_TO_RAD(73260); - } - return IIO_VAL_INT_PLUS_MICRO; + *val = info->gyro_max_scale; + *val2 = info->gyro_max_val; + return IIO_VAL_FRACTIONAL; case IIO_INCLI: *val = 0; *val2 = IIO_DEGREE_TO_RAD(36630); @@ -224,7 +274,8 @@ static int adis16260_write_raw(struct iio_dev *indio_dev, int val2, long mask) { - struct adis *adis = iio_priv(indio_dev); + struct adis16260 *adis16260 = iio_priv(indio_dev); + struct adis *adis = &adis16260->adis; int ret; u8 addr; u8 t; @@ -305,35 +356,42 @@ static const struct adis_data adis16260_data = { static int adis16260_probe(struct spi_device *spi) { + const struct spi_device_id *id; + struct adis16260 *adis16260; struct iio_dev *indio_dev; - struct adis *adis; int ret; + id = spi_get_device_id(spi); + if (!id) + return -ENODEV; + /* setup the industrialio driver allocated elements */ - indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adis)); + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adis16260)); if (!indio_dev) return -ENOMEM; - adis = iio_priv(indio_dev); + adis16260 = iio_priv(indio_dev); /* this is only used for removal purposes */ spi_set_drvdata(spi, indio_dev); - indio_dev->name = spi_get_device_id(spi)->name; + adis16260->info = &adis16260_chip_info_table[id->driver_data]; + + indio_dev->name = id->name; indio_dev->dev.parent = &spi->dev; indio_dev->info = &adis16260_info; - indio_dev->channels = adis16260_channels; - indio_dev->num_channels = ARRAY_SIZE(adis16260_channels); + indio_dev->channels = adis16260->info->channels; + indio_dev->num_channels = adis16260->info->num_channels; indio_dev->modes = INDIO_DIRECT_MODE; - ret = adis_init(adis, indio_dev, spi, &adis16260_data); + ret = adis_init(&adis16260->adis, indio_dev, spi, &adis16260_data); if (ret) return ret; - ret = adis_setup_buffer_and_trigger(adis, indio_dev, NULL); + ret = adis_setup_buffer_and_trigger(&adis16260->adis, indio_dev, NULL); if (ret) return ret; /* Get the device into a sane initial state */ - ret = adis_initial_startup(adis); + ret = adis_initial_startup(&adis16260->adis); if (ret) goto error_cleanup_buffer_trigger; ret = iio_device_register(indio_dev); @@ -343,18 +401,18 @@ static int adis16260_probe(struct spi_device *spi) return 0; error_cleanup_buffer_trigger: - adis_cleanup_buffer_and_trigger(adis, indio_dev); + adis_cleanup_buffer_and_trigger(&adis16260->adis, indio_dev); return ret; } static int adis16260_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct adis *adis = iio_priv(indio_dev); + struct adis16260 *adis16260 = iio_priv(indio_dev); iio_device_unregister(indio_dev); adis16260_stop_device(indio_dev); - adis_cleanup_buffer_and_trigger(adis, indio_dev); + adis_cleanup_buffer_and_trigger(&adis16260->adis, indio_dev); return 0; } @@ -364,11 +422,12 @@ static int adis16260_remove(struct spi_device *spi) * support for the on chip filtering. */ static const struct spi_device_id adis16260_id[] = { - {"adis16260", 0}, - {"adis16265", 0}, - {"adis16250", 0}, - {"adis16255", 0}, - {"adis16251", 1}, + {"adis16260", ADIS16260}, + {"adis16265", ADIS16260}, + {"adis16266", ADIS16266}, + {"adis16250", ADIS16260}, + {"adis16255", ADIS16260}, + {"adis16251", ADIS16251}, {} }; MODULE_DEVICE_TABLE(spi, adis16260_id); From dc8615ce34cf72955f098750eef81a5501c107d1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:19 +0200 Subject: [PATCH 745/912] iio: adis16400: Add ADIS16367 support The ADIS16367 is mostly register compatible to the ADIS16360. The only difference is the scale factor for the gyroscope output. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis16400_core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index e4cc2ecb42e2..a9f4043b409f 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c @@ -139,6 +139,7 @@ enum adis16400_chip_variant { ADIS16360, ADIS16362, ADIS16364, + ADIS16367, ADIS16400, ADIS16448, }; @@ -764,6 +765,18 @@ static struct adis16400_chip_info adis16400_chips[] = { .set_freq = adis16400_set_freq, .get_freq = adis16400_get_freq, }, + [ADIS16367] = { + .channels = adis16350_channels, + .num_channels = ARRAY_SIZE(adis16350_channels), + .flags = ADIS16400_HAS_PROD_ID | ADIS16400_HAS_SLOW_MODE | + ADIS16400_HAS_SERIAL_NUMBER, + .gyro_scale_micro = IIO_DEGREE_TO_RAD(2000), /* 0.2 deg/s */ + .accel_scale_micro = IIO_G_TO_M_S_2(3333), /* 3.333 mg */ + .temp_scale_nano = 136000000, /* 0.136 C */ + .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ + .set_freq = adis16400_set_freq, + .get_freq = adis16400_get_freq, + }, [ADIS16400] = { .channels = adis16400_channels, .num_channels = ARRAY_SIZE(adis16400_channels), @@ -936,6 +949,7 @@ static const struct spi_device_id adis16400_id[] = { {"adis16362", ADIS16362}, {"adis16364", ADIS16364}, {"adis16365", ADIS16360}, + {"adis16367", ADIS16367}, {"adis16400", ADIS16400}, {"adis16405", ADIS16400}, {"adis16448", ADIS16448}, From 72d9c9869df3149316af6cd70585eee15f643f40 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:20 +0200 Subject: [PATCH 746/912] iio: adis16400: Add ADIS16445 support The ADIS16445 is similar to the ADIS16448, but without the magnetometer and pressure channels as well as different scale factors for the gyroscope and accelerometer outputs. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis16400_core.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index a9f4043b409f..abc4c50de9e8 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c @@ -141,6 +141,7 @@ enum adis16400_chip_variant { ADIS16364, ADIS16367, ADIS16400, + ADIS16445, ADIS16448, }; @@ -623,6 +624,17 @@ static const struct iio_chan_spec adis16400_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP), }; +static const struct iio_chan_spec adis16445_channels[] = { + ADIS16400_GYRO_CHAN(X, ADIS16400_XGYRO_OUT, 16), + ADIS16400_GYRO_CHAN(Y, ADIS16400_YGYRO_OUT, 16), + ADIS16400_GYRO_CHAN(Z, ADIS16400_ZGYRO_OUT, 16), + ADIS16400_ACCEL_CHAN(X, ADIS16400_XACCL_OUT, 16), + ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 16), + ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 16), + ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12), + IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP), +}; + static const struct iio_chan_spec adis16448_channels[] = { ADIS16400_GYRO_CHAN(X, ADIS16400_XGYRO_OUT, 16), ADIS16400_GYRO_CHAN(Y, ADIS16400_YGYRO_OUT, 16), @@ -788,6 +800,19 @@ static struct adis16400_chip_info adis16400_chips[] = { .set_freq = adis16400_set_freq, .get_freq = adis16400_get_freq, }, + [ADIS16445] = { + .channels = adis16445_channels, + .num_channels = ARRAY_SIZE(adis16445_channels), + .flags = ADIS16400_HAS_PROD_ID | + ADIS16400_HAS_SERIAL_NUMBER | + ADIS16400_BURST_DIAG_STAT, + .gyro_scale_micro = IIO_DEGREE_TO_RAD(10000), /* 0.01 deg/s */ + .accel_scale_micro = IIO_G_TO_M_S_2(250), /* 1/4000 g */ + .temp_scale_nano = 73860000, /* 0.07386 C */ + .temp_offset = 31000000 / 73860, /* 31 C = 0x00 */ + .set_freq = adis16334_set_freq, + .get_freq = adis16334_get_freq, + }, [ADIS16448] = { .channels = adis16448_channels, .num_channels = ARRAY_SIZE(adis16448_channels), @@ -952,6 +977,7 @@ static const struct spi_device_id adis16400_id[] = { {"adis16367", ADIS16367}, {"adis16400", ADIS16400}, {"adis16405", ADIS16400}, + {"adis16445", ADIS16445}, {"adis16448", ADIS16448}, {} }; From 5450c360d4608b70ebd85f4ae2f2ce779a296a93 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Aug 2015 15:38:21 +0200 Subject: [PATCH 747/912] iio: adis16136: Add ADIS16137 support The ADIS16137 is register map compatible to the ADIS16136, but has a different scale factor for the gyroscope output. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/gyro/adis16136.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c index 591bd555e1f3..26de876b223d 100644 --- a/drivers/iio/gyro/adis16136.c +++ b/drivers/iio/gyro/adis16136.c @@ -473,6 +473,7 @@ enum adis16136_id { ID_ADIS16133, ID_ADIS16135, ID_ADIS16136, + ID_ADIS16137, }; static const struct adis16136_chip_info adis16136_chip_info[] = { @@ -488,6 +489,10 @@ static const struct adis16136_chip_info adis16136_chip_info[] = { .precision = IIO_DEGREE_TO_RAD(450), .fullscale = 24623, }, + [ID_ADIS16137] = { + .precision = IIO_DEGREE_TO_RAD(1000), + .fullscale = 24609, + }, }; static int adis16136_probe(struct spi_device *spi) @@ -557,6 +562,7 @@ static const struct spi_device_id adis16136_ids[] = { { "adis16133", ID_ADIS16133 }, { "adis16135", ID_ADIS16135 }, { "adis16136", ID_ADIS16136 }, + { "adis16137", ID_ADIS16137 }, { } }; MODULE_DEVICE_TABLE(spi, adis16136_ids); From ee33ddd2915cca51ce9acb1e5584631b74d92b3c Mon Sep 17 00:00:00 2001 From: Lars Svensson Date: Wed, 5 Aug 2015 14:15:12 +0200 Subject: [PATCH 748/912] staging: iio_simple_dummy: Fix indentation errors Fixing indentation errors in drivers/staging/iio/iio_simple_dummy_events.c. Signed-off-by: Lars Svensson Acked-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/staging/iio/iio_simple_dummy_events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/iio_simple_dummy_events.c b/drivers/staging/iio/iio_simple_dummy_events.c index ecc563cb6cb9..73108baf80ad 100644 --- a/drivers/staging/iio/iio_simple_dummy_events.c +++ b/drivers/staging/iio/iio_simple_dummy_events.c @@ -120,7 +120,7 @@ int iio_simple_dummy_read_event_value(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, enum iio_event_type type, enum iio_event_direction dir, - enum iio_event_info info, + enum iio_event_info info, int *val, int *val2) { struct iio_dummy_state *st = iio_priv(indio_dev); @@ -143,7 +143,7 @@ int iio_simple_dummy_write_event_value(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, enum iio_event_type type, enum iio_event_direction dir, - enum iio_event_info info, + enum iio_event_info info, int val, int val2) { struct iio_dummy_state *st = iio_priv(indio_dev); From c4eaab798bd459f0c3f8917e74abf1851f3e1cb5 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 23 Jul 2015 17:20:59 +0200 Subject: [PATCH 749/912] iio:accel:bmc150-accel: Move bmc150_accel_chip_init() Move bmc150_accel_chip_init() so that we can use bmc150_accel_chip_info_tbl[] in it. Signed-off-by: Bastien Nocera Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bmc150-accel.c | 114 +++++++++++++++---------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index 21b665fc0739..5be65e2cb244 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c @@ -345,63 +345,6 @@ static int bmc150_accel_any_motion_setup(struct bmc150_accel_trigger *t, return 0; } -static int bmc150_accel_chip_init(struct bmc150_accel_data *data) -{ - int ret; - - ret = i2c_smbus_read_byte_data(data->client, BMC150_ACCEL_REG_CHIP_ID); - if (ret < 0) { - dev_err(&data->client->dev, "Error: Reading chip id\n"); - return ret; - } - - dev_dbg(&data->client->dev, "Chip Id %x\n", ret); - if (ret != data->chip_info->chip_id) { - dev_err(&data->client->dev, "Invalid chip %x\n", ret); - return -ENODEV; - } - - ret = bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_NORMAL, 0); - if (ret < 0) - return ret; - - /* Set Bandwidth */ - ret = bmc150_accel_set_bw(data, BMC150_ACCEL_DEF_BW, 0); - if (ret < 0) - return ret; - - /* Set Default Range */ - ret = i2c_smbus_write_byte_data(data->client, - BMC150_ACCEL_REG_PMU_RANGE, - BMC150_ACCEL_DEF_RANGE_4G); - if (ret < 0) { - dev_err(&data->client->dev, "Error writing reg_pmu_range\n"); - return ret; - } - - data->range = BMC150_ACCEL_DEF_RANGE_4G; - - /* Set default slope duration and thresholds */ - data->slope_thres = BMC150_ACCEL_DEF_SLOPE_THRESHOLD; - data->slope_dur = BMC150_ACCEL_DEF_SLOPE_DURATION; - ret = bmc150_accel_update_slope(data); - if (ret < 0) - return ret; - - /* Set default as latched interrupts */ - ret = i2c_smbus_write_byte_data(data->client, - BMC150_ACCEL_REG_INT_RST_LATCH, - BMC150_ACCEL_INT_MODE_LATCH_INT | - BMC150_ACCEL_INT_MODE_LATCH_RESET); - if (ret < 0) { - dev_err(&data->client->dev, - "Error writing reg_int_rst_latch\n"); - return ret; - } - - return 0; -} - static int bmc150_accel_get_bw(struct bmc150_accel_data *data, int *val, int *val2) { @@ -1618,6 +1561,63 @@ static const struct iio_buffer_setup_ops bmc150_accel_buffer_ops = { .postdisable = bmc150_accel_buffer_postdisable, }; +static int bmc150_accel_chip_init(struct bmc150_accel_data *data) +{ + int ret; + + ret = i2c_smbus_read_byte_data(data->client, BMC150_ACCEL_REG_CHIP_ID); + if (ret < 0) { + dev_err(&data->client->dev, "Error: Reading chip id\n"); + return ret; + } + + dev_dbg(&data->client->dev, "Chip Id %x\n", ret); + if (ret != data->chip_info->chip_id) { + dev_err(&data->client->dev, "Invalid chip %x\n", ret); + return -ENODEV; + } + + ret = bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_NORMAL, 0); + if (ret < 0) + return ret; + + /* Set Bandwidth */ + ret = bmc150_accel_set_bw(data, BMC150_ACCEL_DEF_BW, 0); + if (ret < 0) + return ret; + + /* Set Default Range */ + ret = i2c_smbus_write_byte_data(data->client, + BMC150_ACCEL_REG_PMU_RANGE, + BMC150_ACCEL_DEF_RANGE_4G); + if (ret < 0) { + dev_err(&data->client->dev, "Error writing reg_pmu_range\n"); + return ret; + } + + data->range = BMC150_ACCEL_DEF_RANGE_4G; + + /* Set default slope duration and thresholds */ + data->slope_thres = BMC150_ACCEL_DEF_SLOPE_THRESHOLD; + data->slope_dur = BMC150_ACCEL_DEF_SLOPE_DURATION; + ret = bmc150_accel_update_slope(data); + if (ret < 0) + return ret; + + /* Set default as latched interrupts */ + ret = i2c_smbus_write_byte_data(data->client, + BMC150_ACCEL_REG_INT_RST_LATCH, + BMC150_ACCEL_INT_MODE_LATCH_INT | + BMC150_ACCEL_INT_MODE_LATCH_RESET); + if (ret < 0) { + dev_err(&data->client->dev, + "Error writing reg_int_rst_latch\n"); + return ret; + } + + return 0; +} + static int bmc150_accel_probe(struct i2c_client *client, const struct i2c_device_id *id) { From 0ad4bf37017621e25fe157fa095fd8849779a873 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 23 Jul 2015 17:21:07 +0200 Subject: [PATCH 750/912] iio:accel:bmc150-accel: Use the chip ID to detect sensor variant Instead of using the I2C or ACPI ID to determine which variant of the chipset to use, determine that from the chip ID. Under Windows, the same driver is used for those variants and, despite incorrect ACPI data, it is able to load and operate the accelerometer. Fixes the accelerometer failing with: bmc150_accel i2c-BMA250E:00: Invalid chip f8 on the WinBook TW100 Signed-off-by: Bastien Nocera Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bmc150-accel.c | 46 +++++++++++++------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index 5be65e2cb244..a7b66edf2a38 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c @@ -151,6 +151,7 @@ struct bmc150_scale_info { }; struct bmc150_accel_chip_info { + const char *name; u8 chip_id; const struct iio_chan_spec *channels; int num_channels; @@ -1062,6 +1063,7 @@ enum { static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { [bmc150] = { + .name = "BMC150A", .chip_id = 0xFA, .channels = bmc150_accel_channels, .num_channels = ARRAY_SIZE(bmc150_accel_channels), @@ -1071,6 +1073,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {76590, BMC150_ACCEL_DEF_RANGE_16G} }, }, [bmi055] = { + .name = "BMI055A", .chip_id = 0xFA, .channels = bmc150_accel_channels, .num_channels = ARRAY_SIZE(bmc150_accel_channels), @@ -1080,6 +1083,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {76590, BMC150_ACCEL_DEF_RANGE_16G} }, }, [bma255] = { + .name = "BMA0255", .chip_id = 0xFA, .channels = bmc150_accel_channels, .num_channels = ARRAY_SIZE(bmc150_accel_channels), @@ -1089,6 +1093,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {76590, BMC150_ACCEL_DEF_RANGE_16G} }, }, [bma250e] = { + .name = "BMA250E", .chip_id = 0xF9, .channels = bma250e_accel_channels, .num_channels = ARRAY_SIZE(bma250e_accel_channels), @@ -1098,6 +1103,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {306457, BMC150_ACCEL_DEF_RANGE_16G} }, }, [bma222e] = { + .name = "BMA222E", .chip_id = 0xF8, .channels = bma222e_accel_channels, .num_channels = ARRAY_SIZE(bma222e_accel_channels), @@ -1107,6 +1113,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {1225831, BMC150_ACCEL_DEF_RANGE_16G} }, }, [bma280] = { + .name = "BMA0280", .chip_id = 0xFB, .channels = bma280_accel_channels, .num_channels = ARRAY_SIZE(bma280_accel_channels), @@ -1353,20 +1360,6 @@ static irqreturn_t bmc150_accel_irq_handler(int irq, void *private) return IRQ_NONE; } -static const char *bmc150_accel_match_acpi_device(struct device *dev, int *data) -{ - const struct acpi_device_id *id; - - id = acpi_match_device(dev->driver->acpi_match_table, dev); - - if (!id) - return NULL; - - *data = (int)id->driver_data; - - return dev_name(dev); -} - static int bmc150_accel_gpio_probe(struct i2c_client *client, struct bmc150_accel_data *data) { @@ -1563,7 +1556,7 @@ static const struct iio_buffer_setup_ops bmc150_accel_buffer_ops = { static int bmc150_accel_chip_init(struct bmc150_accel_data *data) { - int ret; + int ret, i; ret = i2c_smbus_read_byte_data(data->client, BMC150_ACCEL_REG_CHIP_ID); if (ret < 0) { @@ -1572,8 +1565,15 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data) } dev_dbg(&data->client->dev, "Chip Id %x\n", ret); - if (ret != data->chip_info->chip_id) { - dev_err(&data->client->dev, "Invalid chip %x\n", ret); + for (i = 0; i < ARRAY_SIZE(bmc150_accel_chip_info_tbl); i++) { + if (bmc150_accel_chip_info_tbl[i].chip_id == ret) { + data->chip_info = &bmc150_accel_chip_info_tbl[i]; + break; + } + } + + if (!data->chip_info) { + dev_err(&data->client->dev, "Unsupported chip %x\n", ret); return -ENODEV; } @@ -1625,7 +1625,6 @@ static int bmc150_accel_probe(struct i2c_client *client, struct iio_dev *indio_dev; int ret; const char *name = NULL; - int chip_id = 0; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!indio_dev) @@ -1635,15 +1634,8 @@ static int bmc150_accel_probe(struct i2c_client *client, i2c_set_clientdata(client, indio_dev); data->client = client; - if (id) { + if (id) name = id->name; - chip_id = id->driver_data; - } - - if (ACPI_HANDLE(&client->dev)) - name = bmc150_accel_match_acpi_device(&client->dev, &chip_id); - - data->chip_info = &bmc150_accel_chip_info_tbl[chip_id]; ret = bmc150_accel_chip_init(data); if (ret < 0) @@ -1654,7 +1646,7 @@ static int bmc150_accel_probe(struct i2c_client *client, indio_dev->dev.parent = &client->dev; indio_dev->channels = data->chip_info->channels; indio_dev->num_channels = data->chip_info->num_channels; - indio_dev->name = name; + indio_dev->name = name ? name : data->chip_info->name; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->info = &bmc150_accel_info; From 001fceb9c64a39aebb85d31134182d39c1628a21 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sun, 2 Aug 2015 22:43:46 +0200 Subject: [PATCH 751/912] iio:accel:mma8452: fix _get_hp_filter_index To iterate through the available frequencies of mma8452_hp_filter_cutoff[], the array size of a row of that table needs to be provided to _get_int_plus_micros_index(). Fixes: 1e79841a00e46 ("iio: mma8452: Add highpass filter configuration.") Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 3c4ad1563ca4..d78d4a97d753 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -229,7 +229,7 @@ static int mma8452_get_hp_filter_index(struct mma8452_data *data, int i = mma8452_get_odr_index(data); return mma8452_get_int_plus_micros_index(mma8452_hp_filter_cutoff[i], - ARRAY_SIZE(mma8452_scales[0]), val, val2); + ARRAY_SIZE(mma8452_hp_filter_cutoff[0]), val, val2); } static int mma8452_read_hp_filter(struct mma8452_data *data, int *hz, int *uHz) From 8337455296385b45822dc46c2b25db4c361d734c Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sun, 2 Aug 2015 22:43:47 +0200 Subject: [PATCH 752/912] iio:accel:mma8452: drop double include One inclusion of linux/iio/trigger_consumer.h is sufficient. Fixes: ae6d9ce05691b ("iio: mma8452: Add support for interrupt driven triggers.") Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index d78d4a97d753..d87799fe7161 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include From b9fddcdb44c2e274193b119dd6c3af3a9324640a Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sun, 2 Aug 2015 22:43:48 +0200 Subject: [PATCH 753/912] iio:accel:mma8452: pass up real error code Pass up the error code provided by functions. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index d87799fe7161..9607f830a13b 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -343,7 +343,7 @@ static int mma8452_set_hp_filter_frequency(struct mma8452_data *data, i = mma8452_get_hp_filter_index(data, val, val2); if (i < 0) - return -EINVAL; + return i; reg = i2c_smbus_read_byte_data(data->client, MMA8452_HP_FILTER_CUTOFF); @@ -369,7 +369,7 @@ static int mma8452_write_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_SAMP_FREQ: i = mma8452_get_samp_freq_index(data, val, val2); if (i < 0) - return -EINVAL; + return i; data->ctrl_reg1 &= ~MMA8452_CTRL_DR_MASK; data->ctrl_reg1 |= i << MMA8452_CTRL_DR_SHIFT; @@ -378,7 +378,7 @@ static int mma8452_write_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_SCALE: i = mma8452_get_scale_index(data, val, val2); if (i < 0) - return -EINVAL; + return i; data->data_cfg &= ~MMA8452_DATA_CFG_FS_MASK; data->data_cfg |= i; return mma8452_change_config(data, MMA8452_DATA_CFG, From 11218226184b6b2be5cde4bf16f647dda225d4f3 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sun, 2 Aug 2015 22:43:49 +0200 Subject: [PATCH 754/912] iio:accel:mma8452: check values to be written Check values to be written to the device for valid lower and upper bounds. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 9607f830a13b..42640b1df870 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -471,15 +471,17 @@ static int mma8452_write_thresh(struct iio_dev *indio_dev, switch (info) { case IIO_EV_INFO_VALUE: - return mma8452_change_config(data, MMA8452_TRANSIENT_THS, - val & MMA8452_TRANSIENT_THS_MASK); + if (val < 0 || val > MMA8452_TRANSIENT_THS_MASK) + return -EINVAL; + + return mma8452_change_config(data, MMA8452_TRANSIENT_THS, val); case IIO_EV_INFO_PERIOD: steps = (val * USEC_PER_SEC + val2) / mma8452_transient_time_step_us[ mma8452_get_odr_index(data)]; - if (steps > 0xff) + if (steps < 0 || steps > 0xff) return -EINVAL; return mma8452_change_config(data, MMA8452_TRANSIENT_COUNT, From 69abff81d7fa59a0dfca5c72a7f1006f17a06d11 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sun, 2 Aug 2015 22:43:50 +0200 Subject: [PATCH 755/912] iio:accel:mma8452: rework register definitions Rework register definitions to be sorted by register and bit number, with bit definitions cascaded under the appropriate register, use GENMASK for consecutive bitmasks and realign properly. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 87 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 42640b1df870..2d5ee4607081 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -23,54 +23,51 @@ #include #include -#define MMA8452_STATUS 0x00 -#define MMA8452_OUT_X 0x01 /* MSB first, 12-bit */ -#define MMA8452_OUT_Y 0x03 -#define MMA8452_OUT_Z 0x05 -#define MMA8452_INT_SRC 0x0c -#define MMA8452_WHO_AM_I 0x0d -#define MMA8452_DATA_CFG 0x0e -#define MMA8452_HP_FILTER_CUTOFF 0x0f -#define MMA8452_HP_FILTER_CUTOFF_SEL_MASK (BIT(0) | BIT(1)) -#define MMA8452_TRANSIENT_CFG 0x1d -#define MMA8452_TRANSIENT_CFG_ELE BIT(4) -#define MMA8452_TRANSIENT_CFG_CHAN(chan) BIT(chan + 1) -#define MMA8452_TRANSIENT_CFG_HPF_BYP BIT(0) -#define MMA8452_TRANSIENT_SRC 0x1e -#define MMA8452_TRANSIENT_SRC_XTRANSE BIT(1) -#define MMA8452_TRANSIENT_SRC_YTRANSE BIT(3) -#define MMA8452_TRANSIENT_SRC_ZTRANSE BIT(5) -#define MMA8452_TRANSIENT_THS 0x1f -#define MMA8452_TRANSIENT_THS_MASK 0x7f -#define MMA8452_TRANSIENT_COUNT 0x20 -#define MMA8452_OFF_X 0x2f -#define MMA8452_OFF_Y 0x30 -#define MMA8452_OFF_Z 0x31 -#define MMA8452_CTRL_REG1 0x2a -#define MMA8452_CTRL_REG2 0x2b -#define MMA8452_CTRL_REG2_RST BIT(6) -#define MMA8452_CTRL_REG4 0x2d -#define MMA8452_CTRL_REG5 0x2e +#define MMA8452_STATUS 0x00 +#define MMA8452_STATUS_DRDY (BIT(2) | BIT(1) | BIT(0)) +#define MMA8452_OUT_X 0x01 /* MSB first, 12-bit */ +#define MMA8452_OUT_Y 0x03 +#define MMA8452_OUT_Z 0x05 +#define MMA8452_INT_SRC 0x0c +#define MMA8452_WHO_AM_I 0x0d +#define MMA8452_DATA_CFG 0x0e +#define MMA8452_DATA_CFG_FS_MASK GENMASK(1, 0) +#define MMA8452_DATA_CFG_FS_2G 0 +#define MMA8452_DATA_CFG_FS_4G 1 +#define MMA8452_DATA_CFG_FS_8G 2 +#define MMA8452_DATA_CFG_HPF_MASK BIT(4) +#define MMA8452_HP_FILTER_CUTOFF 0x0f +#define MMA8452_HP_FILTER_CUTOFF_SEL_MASK GENMASK(1, 0) +#define MMA8452_TRANSIENT_CFG 0x1d +#define MMA8452_TRANSIENT_CFG_HPF_BYP BIT(0) +#define MMA8452_TRANSIENT_CFG_CHAN(chan) BIT(chan + 1) +#define MMA8452_TRANSIENT_CFG_ELE BIT(4) +#define MMA8452_TRANSIENT_SRC 0x1e +#define MMA8452_TRANSIENT_SRC_XTRANSE BIT(1) +#define MMA8452_TRANSIENT_SRC_YTRANSE BIT(3) +#define MMA8452_TRANSIENT_SRC_ZTRANSE BIT(5) +#define MMA8452_TRANSIENT_THS 0x1f +#define MMA8452_TRANSIENT_THS_MASK GENMASK(6, 0) +#define MMA8452_TRANSIENT_COUNT 0x20 +#define MMA8452_CTRL_REG1 0x2a +#define MMA8452_CTRL_ACTIVE BIT(0) +#define MMA8452_CTRL_DR_MASK GENMASK(5, 3) +#define MMA8452_CTRL_DR_SHIFT 3 +#define MMA8452_CTRL_DR_DEFAULT 0x4 /* 50 Hz sample frequency */ +#define MMA8452_CTRL_REG2 0x2b +#define MMA8452_CTRL_REG2_RST BIT(6) +#define MMA8452_CTRL_REG4 0x2d +#define MMA8452_CTRL_REG5 0x2e +#define MMA8452_OFF_X 0x2f +#define MMA8452_OFF_Y 0x30 +#define MMA8452_OFF_Z 0x31 -#define MMA8452_MAX_REG 0x31 +#define MMA8452_MAX_REG 0x31 -#define MMA8452_STATUS_DRDY (BIT(2) | BIT(1) | BIT(0)) +#define MMA8452_INT_DRDY BIT(0) +#define MMA8452_INT_TRANS BIT(5) -#define MMA8452_CTRL_DR_MASK (BIT(5) | BIT(4) | BIT(3)) -#define MMA8452_CTRL_DR_SHIFT 3 -#define MMA8452_CTRL_DR_DEFAULT 0x4 /* 50 Hz sample frequency */ -#define MMA8452_CTRL_ACTIVE BIT(0) - -#define MMA8452_DATA_CFG_FS_MASK (BIT(1) | BIT(0)) -#define MMA8452_DATA_CFG_FS_2G 0 -#define MMA8452_DATA_CFG_FS_4G 1 -#define MMA8452_DATA_CFG_FS_8G 2 -#define MMA8452_DATA_CFG_HPF_MASK BIT(4) - -#define MMA8452_INT_DRDY BIT(0) -#define MMA8452_INT_TRANS BIT(5) - -#define MMA8452_DEVICE_ID 0x2a +#define MMA8452_DEVICE_ID 0x2a struct mma8452_data { struct i2c_client *client; From 686027fbc602e715aae2d1b7987daefc2ff82a8a Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sun, 2 Aug 2015 22:43:51 +0200 Subject: [PATCH 756/912] iio:accel:mma8452: coding style cleanup Some coding style cleanups, mainly indicated by checkpatch.pl, which includes indentation changes, drop spaces after casts and befor tabs. Also insert empty lines after logical blocks and before unconditional returns. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 106 +++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 2d5ee4607081..85283eab2ea7 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -87,30 +87,34 @@ static int mma8452_drdy(struct mma8452_data *data) return ret; if ((ret & MMA8452_STATUS_DRDY) == MMA8452_STATUS_DRDY) return 0; + msleep(20); } dev_err(&data->client->dev, "data not ready\n"); + return -EIO; } static int mma8452_read(struct mma8452_data *data, __be16 buf[3]) { int ret = mma8452_drdy(data); + if (ret < 0) return ret; - return i2c_smbus_read_i2c_block_data(data->client, - MMA8452_OUT_X, 3 * sizeof(__be16), (u8 *) buf); + + return i2c_smbus_read_i2c_block_data(data->client, MMA8452_OUT_X, + 3 * sizeof(__be16), (u8 *)buf); } -static ssize_t mma8452_show_int_plus_micros(char *buf, - const int (*vals)[2], int n) +static ssize_t mma8452_show_int_plus_micros(char *buf, const int (*vals)[2], + int n) { size_t len = 0; while (n-- > 0) - len += scnprintf(buf + len, PAGE_SIZE - len, - "%d.%06d ", vals[n][0], vals[n][1]); + len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06d ", + vals[n][0], vals[n][1]); /* replace trailing space by newline */ buf[len - 1] = '\n'; @@ -119,7 +123,7 @@ static ssize_t mma8452_show_int_plus_micros(char *buf, } static int mma8452_get_int_plus_micros_index(const int (*vals)[2], int n, - int val, int val2) + int val, int val2) { while (n-- > 0) if (val == vals[n][0] && val2 == vals[n][1]) @@ -143,7 +147,7 @@ static const int mma8452_samp_freq[8][2] = { * Hardware has fullscale of -2G, -4G, -8G corresponding to raw value -2048 * The userspace interface uses m/s^2 and we declare micro units * So scale factor is given by: - * g * N * 1000000 / 2048 for N = 2, 4, 8 and g=9.80665 + * g * N * 1000000 / 2048 for N = 2, 4, 8 and g = 9.80665 */ static const int mma8452_scales[3][2] = { {0, 9577}, {0, 19154}, {0, 38307} @@ -174,17 +178,19 @@ static const int mma8452_hp_filter_cutoff[8][4][2] = { }; static ssize_t mma8452_show_samp_freq_avail(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, + char *buf) { return mma8452_show_int_plus_micros(buf, mma8452_samp_freq, - ARRAY_SIZE(mma8452_samp_freq)); + ARRAY_SIZE(mma8452_samp_freq)); } static ssize_t mma8452_show_scale_avail(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, + char *buf) { return mma8452_show_int_plus_micros(buf, mma8452_scales, - ARRAY_SIZE(mma8452_scales)); + ARRAY_SIZE(mma8452_scales)); } static ssize_t mma8452_show_hp_cutoff_avail(struct device *dev, @@ -201,22 +207,23 @@ static ssize_t mma8452_show_hp_cutoff_avail(struct device *dev, static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(mma8452_show_samp_freq_avail); static IIO_DEVICE_ATTR(in_accel_scale_available, S_IRUGO, - mma8452_show_scale_avail, NULL, 0); + mma8452_show_scale_avail, NULL, 0); static IIO_DEVICE_ATTR(in_accel_filter_high_pass_3db_frequency_available, - S_IRUGO, mma8452_show_hp_cutoff_avail, NULL, 0); + S_IRUGO, mma8452_show_hp_cutoff_avail, NULL, 0); static int mma8452_get_samp_freq_index(struct mma8452_data *data, - int val, int val2) + int val, int val2) { return mma8452_get_int_plus_micros_index(mma8452_samp_freq, - ARRAY_SIZE(mma8452_samp_freq), val, val2); + ARRAY_SIZE(mma8452_samp_freq), + val, val2); } -static int mma8452_get_scale_index(struct mma8452_data *data, - int val, int val2) +static int mma8452_get_scale_index(struct mma8452_data *data, int val, int val2) { return mma8452_get_int_plus_micros_index(mma8452_scales, - ARRAY_SIZE(mma8452_scales), val, val2); + ARRAY_SIZE(mma8452_scales), + val, val2); } static int mma8452_get_hp_filter_index(struct mma8452_data *data, @@ -262,25 +269,31 @@ static int mma8452_read_raw(struct iio_dev *indio_dev, mutex_unlock(&data->lock); if (ret < 0) return ret; - *val = sign_extend32( - be16_to_cpu(buffer[chan->scan_index]) >> 4, 11); + + *val = sign_extend32(be16_to_cpu(buffer[chan->scan_index]) >> 4, + 11); + return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: i = data->data_cfg & MMA8452_DATA_CFG_FS_MASK; *val = mma8452_scales[i][0]; *val2 = mma8452_scales[i][1]; + return IIO_VAL_INT_PLUS_MICRO; case IIO_CHAN_INFO_SAMP_FREQ: i = mma8452_get_odr_index(data); *val = mma8452_samp_freq[i][0]; *val2 = mma8452_samp_freq[i][1]; + return IIO_VAL_INT_PLUS_MICRO; case IIO_CHAN_INFO_CALIBBIAS: - ret = i2c_smbus_read_byte_data(data->client, MMA8452_OFF_X + - chan->scan_index); + ret = i2c_smbus_read_byte_data(data->client, + MMA8452_OFF_X + chan->scan_index); if (ret < 0) return ret; + *val = sign_extend32(ret, 7); + return IIO_VAL_INT; case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY: if (data->data_cfg & MMA8452_DATA_CFG_HPF_MASK) { @@ -291,21 +304,23 @@ static int mma8452_read_raw(struct iio_dev *indio_dev, *val = 0; *val2 = 0; } + return IIO_VAL_INT_PLUS_MICRO; } + return -EINVAL; } static int mma8452_standby(struct mma8452_data *data) { return i2c_smbus_write_byte_data(data->client, MMA8452_CTRL_REG1, - data->ctrl_reg1 & ~MMA8452_CTRL_ACTIVE); + data->ctrl_reg1 & ~MMA8452_CTRL_ACTIVE); } static int mma8452_active(struct mma8452_data *data) { return i2c_smbus_write_byte_data(data->client, MMA8452_CTRL_REG1, - data->ctrl_reg1); + data->ctrl_reg1); } static int mma8452_change_config(struct mma8452_data *data, u8 reg, u8 val) @@ -330,6 +345,7 @@ static int mma8452_change_config(struct mma8452_data *data, u8 reg, u8 val) ret = 0; fail: mutex_unlock(&data->lock); + return ret; } @@ -346,6 +362,7 @@ static int mma8452_set_hp_filter_frequency(struct mma8452_data *data, MMA8452_HP_FILTER_CUTOFF); if (reg < 0) return reg; + reg &= ~MMA8452_HP_FILTER_CUTOFF_SEL_MASK; reg |= i; @@ -370,21 +387,26 @@ static int mma8452_write_raw(struct iio_dev *indio_dev, data->ctrl_reg1 &= ~MMA8452_CTRL_DR_MASK; data->ctrl_reg1 |= i << MMA8452_CTRL_DR_SHIFT; + return mma8452_change_config(data, MMA8452_CTRL_REG1, - data->ctrl_reg1); + data->ctrl_reg1); case IIO_CHAN_INFO_SCALE: i = mma8452_get_scale_index(data, val, val2); if (i < 0) return i; + data->data_cfg &= ~MMA8452_DATA_CFG_FS_MASK; data->data_cfg |= i; + return mma8452_change_config(data, MMA8452_DATA_CFG, - data->data_cfg); + data->data_cfg); case IIO_CHAN_INFO_CALIBBIAS: if (val < -128 || val > 127) return -EINVAL; - return mma8452_change_config(data, MMA8452_OFF_X + - chan->scan_index, val); + + return mma8452_change_config(data, + MMA8452_OFF_X + chan->scan_index, + val); case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY: if (val == 0 && val2 == 0) { @@ -395,8 +417,9 @@ static int mma8452_write_raw(struct iio_dev *indio_dev, if (ret < 0) return ret; } + return mma8452_change_config(data, MMA8452_DATA_CFG, - data->data_cfg); + data->data_cfg); default: return -EINVAL; @@ -421,6 +444,7 @@ static int mma8452_read_thresh(struct iio_dev *indio_dev, return ret; *val = ret & MMA8452_TRANSIENT_THS_MASK; + return IIO_VAL_INT; case IIO_EV_INFO_PERIOD: @@ -433,6 +457,7 @@ static int mma8452_read_thresh(struct iio_dev *indio_dev, mma8452_get_odr_index(data)]; *val = us / USEC_PER_SEC; *val2 = us % USEC_PER_SEC; + return IIO_VAL_INT_PLUS_MICRO; case IIO_EV_INFO_HIGH_PASS_FILTER_3DB: @@ -449,6 +474,7 @@ static int mma8452_read_thresh(struct iio_dev *indio_dev, if (ret < 0) return ret; } + return IIO_VAL_INT_PLUS_MICRO; default: @@ -483,6 +509,7 @@ static int mma8452_write_thresh(struct iio_dev *indio_dev, return mma8452_change_config(data, MMA8452_TRANSIENT_COUNT, steps); + case IIO_EV_INFO_HIGH_PASS_FILTER_3DB: reg = i2c_smbus_read_byte_data(data->client, MMA8452_TRANSIENT_CFG); @@ -497,6 +524,7 @@ static int mma8452_write_thresh(struct iio_dev *indio_dev, if (ret < 0) return ret; } + return mma8452_change_config(data, MMA8452_TRANSIENT_CFG, reg); default: @@ -606,15 +634,16 @@ static irqreturn_t mma8452_trigger_handler(int irq, void *p) u8 buffer[16]; /* 3 16-bit channels + padding + ts */ int ret; - ret = mma8452_read(data, (__be16 *) buffer); + ret = mma8452_read(data, (__be16 *)buffer); if (ret < 0) goto done; iio_push_to_buffers_with_timestamp(indio_dev, buffer, - iio_get_time_ns()); + iio_get_time_ns()); done: iio_trigger_notify_done(indio_dev->trig); + return IRQ_HANDLED; } @@ -672,10 +701,10 @@ static struct attribute_group mma8452_event_attribute_group = { .modified = 1, \ .channel2 = IIO_MOD_##axis, \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ - BIT(IIO_CHAN_INFO_CALIBBIAS), \ + BIT(IIO_CHAN_INFO_CALIBBIAS), \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \ - BIT(IIO_CHAN_INFO_SCALE) | \ - BIT(IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY), \ + BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY), \ .scan_index = idx, \ .scan_type = { \ .sign = 's', \ @@ -778,6 +807,7 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev) return ret; indio_dev->trig = trig; + return 0; } @@ -847,7 +877,7 @@ static int mma8452_probe(struct i2c_client *client, data->data_cfg = MMA8452_DATA_CFG_FS_2G; ret = i2c_smbus_write_byte_data(client, MMA8452_DATA_CFG, - data->data_cfg); + data->data_cfg); if (ret < 0) return ret; @@ -889,14 +919,14 @@ static int mma8452_probe(struct i2c_client *client, } data->ctrl_reg1 = MMA8452_CTRL_ACTIVE | - (MMA8452_CTRL_DR_DEFAULT << MMA8452_CTRL_DR_SHIFT); + (MMA8452_CTRL_DR_DEFAULT << MMA8452_CTRL_DR_SHIFT); ret = i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG1, data->ctrl_reg1); if (ret < 0) goto trigger_cleanup; ret = iio_triggered_buffer_setup(indio_dev, NULL, - mma8452_trigger_handler, NULL); + mma8452_trigger_handler, NULL); if (ret < 0) goto trigger_cleanup; From 8838cc7f3c584d6aaf56c66577f8a2bfb21081ec Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Sun, 2 Aug 2015 22:43:52 +0200 Subject: [PATCH 757/912] iio:accel:mma8452: reorder Kconfig entry Move the entry in Kconfig to its alphabetically correct position. Signed-off-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- drivers/iio/accel/Kconfig | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index c99d8e242218..a59047d7657e 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -86,18 +86,6 @@ config KXSD9 To compile this driver as a module, choose M here: the module will be called kxsd9. -config MMA8452 - tristate "Freescale MMA8452Q Accelerometer Driver" - depends on I2C - select IIO_BUFFER - select IIO_TRIGGERED_BUFFER - help - Say yes here to build support for the Freescale MMA8452Q 3-axis - accelerometer. - - To compile this driver as a module, choose M here: the module - will be called mma8452. - config KXCJK1013 tristate "Kionix 3-Axis Accelerometer Driver" depends on I2C @@ -111,6 +99,18 @@ config KXCJK1013 To compile this driver as a module, choose M here: the module will be called kxcjk-1013. +config MMA8452 + tristate "Freescale MMA8452Q Accelerometer Driver" + depends on I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the Freescale MMA8452Q 3-axis + accelerometer. + + To compile this driver as a module, choose M here: the module + will be called mma8452. + config MMA9551_CORE tristate From bdb25b0af8bd225ddf82083d767fada56fb2c1ae Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Wed, 29 Jul 2015 15:57:41 +0300 Subject: [PATCH 758/912] iio: Fix typos in ABI documentation Fix typos in ABI documentation Signed-off-by: Vladimir Barinov Signed-off-by: Jonathan Cameron --- Documentation/ABI/testing/sysfs-bus-iio | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 400d23441a61..abe228dc0dac 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -493,7 +493,7 @@ Contact: linux-iio@vger.kernel.org Description: Specifies the output powerdown mode. DAC output stage is disconnected from the amplifier and - 1kohm_to_gnd: connected to ground via an 1kOhm resistor, + 1kohm_to_gnd: connected to ground via an 1kOhm resistor, 6kohm_to_gnd: connected to ground via a 6kOhm resistor, 20kohm_to_gnd: connected to ground via a 20kOhm resistor, 100kohm_to_gnd: connected to ground via an 100kOhm resistor, @@ -503,9 +503,9 @@ Description: outX_powerdown_mode_available. If Y is not present the mode is shared across all outputs. -What: /sys/.../iio:deviceX/out_votlageY_powerdown_mode_available +What: /sys/.../iio:deviceX/out_voltageY_powerdown_mode_available What: /sys/.../iio:deviceX/out_voltage_powerdown_mode_available -What: /sys/.../iio:deviceX/out_altvotlageY_powerdown_mode_available +What: /sys/.../iio:deviceX/out_altvoltageY_powerdown_mode_available What: /sys/.../iio:deviceX/out_altvoltage_powerdown_mode_available KernelVersion: 2.6.38 Contact: linux-iio@vger.kernel.org From 6b20f40679108e3c04e9bdb3d719e364ec29289e Mon Sep 17 00:00:00 2001 From: Joo Aun Saw Date: Sat, 25 Jul 2015 01:23:28 +1000 Subject: [PATCH 759/912] tools: iio: Set caller's ci_array pointer to NULL after free On error, caller's ci_array is freed and set to NULL to avoid potential double free if some other user of this code is not sufficiently careful. Counter is reset to zero for consistency. Signed-off-by: Joo Aun Saw Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 4bbd6e7959cd..8475b832ee39 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -526,6 +526,8 @@ error_cleanup_array: free((*ci_array)[i].generic_name); } free(*ci_array); + *ci_array = NULL; + *counter = 0; error_close_dir: if (dp) if (closedir(dp) == -1) From 95ddd3f4b17e1df20b5e23d7b81614e7c8a643da Mon Sep 17 00:00:00 2001 From: Joo Aun Saw Date: Sat, 25 Jul 2015 01:23:29 +1000 Subject: [PATCH 760/912] tools: iio: remove unnecessary double pointer Remove unnecessary double pointer from channel sorting function. Signed-off-by: Joo Aun Saw Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 12 ++++++------ tools/iio/iio_utils.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 8475b832ee39..5eb6793f3972 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -286,17 +286,17 @@ error_free_builtname: * @cnt: the amount of array elements **/ -void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt) +void bsort_channel_array_by_index(struct iio_channel_info *ci_array, int cnt) { struct iio_channel_info temp; int x, y; for (x = 0; x < cnt; x++) for (y = 0; y < (cnt - 1); y++) - if ((*ci_array)[y].index > (*ci_array)[y + 1].index) { - temp = (*ci_array)[y + 1]; - (*ci_array)[y + 1] = (*ci_array)[y]; - (*ci_array)[y] = temp; + if (ci_array[y].index > ci_array[y + 1].index) { + temp = ci_array[y + 1]; + ci_array[y + 1] = ci_array[y]; + ci_array[y] = temp; } } @@ -516,7 +516,7 @@ int build_channel_array(const char *device_dir, free(scan_el_dir); /* reorder so that the array is in index order */ - bsort_channel_array_by_index(ci_array, *counter); + bsort_channel_array_by_index(*ci_array, *counter); return 0; diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h index f30a1091b53e..e3503bfe538b 100644 --- a/tools/iio/iio_utils.h +++ b/tools/iio/iio_utils.h @@ -60,7 +60,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, int iioutils_get_param_float(float *output, const char *param_name, const char *device_dir, const char *name, const char *generic_name); -void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt); +void bsort_channel_array_by_index(struct iio_channel_info *ci_array, int cnt); int build_channel_array(const char *device_dir, struct iio_channel_info **ci_array, int *counter); int find_type_by_name(const char *name, const char *type); From a2b4041ab6ec8b6f07d2da2c993b003dd39f0868 Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Sat, 8 Aug 2015 17:41:33 +0530 Subject: [PATCH 761/912] staging: wilc1000: Add space between the braces Inserted space between nested braces. This fixes the checkpatch.pl error - space required after that close brace '}'. Signed-off-by: Chandra S Gorentla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 060288a3460d..3d5210b726d0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3332,7 +3332,7 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev, { s32 s32Error = WILC_SUCCESS; struct WILC_WFI_priv *priv; - tstrWILC_AddStaParam strStaParams = {{0}}; + tstrWILC_AddStaParam strStaParams = { {0} }; perInterface_wlan_t *nic; @@ -3463,7 +3463,7 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev, { s32 s32Error = WILC_SUCCESS; struct WILC_WFI_priv *priv; - tstrWILC_AddStaParam strStaParams = {{0}}; + tstrWILC_AddStaParam strStaParams = { {0} }; perInterface_wlan_t *nic; From 1bff1fe8c9dbb1a35d3129caaea9e91d4368b36a Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Sat, 8 Aug 2015 17:41:34 +0530 Subject: [PATCH 762/912] staging: wilc1000: Remove unused extern declarations 'extern' declarations which are not referenced within the file are removed. Signed-off-by: Chandra S Gorentla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 1 - drivers/staging/wilc1000/linux_wlan_sdio.c | 1 - drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 -- drivers/staging/wilc1000/wilc_wlan.c | 3 --- 4 files changed, 7 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index bc06d56ebaf5..8b36683ef335 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -9,7 +9,6 @@ extern u8 connecting; extern WILC_TimerHandle hDuringIpTimer; #endif -extern bool bEnablePS; /*BugID_5137*/ extern u8 g_wilc_initialized; /*****************************************************************************/ diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 858e3a191bce..37f31f4558b5 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -31,7 +31,6 @@ struct sdio_func *local_sdio_func; extern linux_wlan_t *g_linux_wlan; extern int wilc_netdev_init(void); -extern int sdio_clear_int(void); extern void wilc_handle_isr(void); static unsigned int sdio_default_speed; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 3d5210b726d0..2361a80857cd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -22,7 +22,6 @@ #define IS_MGMT_STATUS_SUCCES 0x040 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff) -extern void linux_wlan_free(void *vp); extern int linux_wlan_get_firmware(perInterface_wlan_t *p_nic); extern void linux_wlan_unlock(void *vp); extern u16 Set_machw_change_vir_if(bool bValue); @@ -1620,7 +1619,6 @@ static int WILC_WFI_dump_survey(struct wiphy *wiphy, struct net_device *netdev, * @version 1.0 */ -extern uint32_t Statisitcs_totalAcks, Statisitcs_DroppedAcks; static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_info *sinfo) { diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 1eb13f90d0e4..75782a2c36ea 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -16,7 +16,6 @@ * Global * ********************************************/ -extern unsigned int int_clrd; extern wilc_hif_func_t hif_sdio; extern wilc_hif_func_t hif_spi; extern wilc_cfg_func_t mac_cfg; @@ -24,8 +23,6 @@ extern wilc_cfg_func_t mac_cfg; extern u8 g_wilc_initialized; /* AMR : 0422 RK3026 Crash issue */ #endif extern void WILC_WFI_mgmt_rx(uint8_t *buff, uint32_t size); -extern void frmw_to_linux(uint8_t *buff, uint32_t size); -int sdio_xfer_cnt(void); uint32_t wilc_get_chipid(uint8_t update); u16 Set_machw_change_vir_if(bool bValue); From 17aacd43c8d4e733d77f093a18de9d8d2b115407 Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Sat, 8 Aug 2015 17:41:35 +0530 Subject: [PATCH 763/912] staging: wilc1000: Remove ' ' before quoted '\n' Fixes the checkpatch.pl warning - 'unnecessary whitespace before a quoted newline'. Signed-off-by: Chandra S Gorentla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 20 ++++----- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 42 +++++++++---------- drivers/staging/wilc1000/wilc_wlan.c | 10 ++--- drivers/staging/wilc1000/wilc_wlan_cfg.c | 8 ++-- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 0a8052e717c2..92aa671ab1fd 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -296,7 +296,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label); pIP_Add_buff = (char *) (&(dev_iface->ifa_address)); - PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d \n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); + PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); break; @@ -318,7 +318,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label); pIP_Add_buff = null_ip; - PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d \n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); + PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); @@ -1020,7 +1020,7 @@ static int linux_wlan_firmware_download(linux_wlan_t *p_nic) release_firmware(g_linux_wlan->wilc_firmware); g_linux_wlan->wilc_firmware = NULL; - PRINT_D(INIT_DBG, "Download Succeeded \n"); + PRINT_D(INIT_DBG, "Download Succeeded\n"); _FAIL_: return ret; @@ -1774,7 +1774,7 @@ int repeat_power_cycle(perInterface_wlan_t *nic) #endif if (linux_wlan_get_firmware(nic)) { - PRINT_ER("Can't get firmware \n"); + PRINT_ER("Can't get firmware\n"); ret = -1; goto __fail__; } @@ -1859,7 +1859,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) #endif if (linux_wlan_get_firmware(nic)) { - PRINT_ER("Can't get firmware \n"); + PRINT_ER("Can't get firmware\n"); ret = -EIO; goto _fail_irq_enable_; } @@ -2080,13 +2080,13 @@ static void wilc_set_multicast_list(struct net_device *dev) if (!dev) return; - PRINT_D(INIT_DBG, "Setting Multicast List with count = %d. \n", dev->mc.count); + PRINT_D(INIT_DBG, "Setting Multicast List with count = %d.\n", dev->mc.count); if (dev->flags & IFF_PROMISC) { /* Normally, we should configure the chip to retrive all packets * but we don't wanna support this right now */ /* TODO: add promiscuous mode support */ - PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets \n"); + PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets\n"); return; } @@ -2145,7 +2145,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) struct ethhdr *eth_h; nic = netdev_priv(ndev); - PRINT_D(INT_DBG, "\n========\n IntUH: %d - IntBH: %d - IntCld: %d \n========\n", int_rcvdU, int_rcvdB, int_clrd); + PRINT_D(INT_DBG, "\n========\n IntUH: %d - IntBH: %d - IntCld: %d\n========\n", int_rcvdU, int_rcvdB, int_clrd); PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n"); /* Stop the network interface queue */ @@ -2551,7 +2551,7 @@ int wilc_netdev_init(void) #ifndef WILC_SDIO if (!linux_spi_init(&g_linux_wlan->wilc_spidev)) { - PRINT_ER("Can't initialize SPI \n"); + PRINT_ER("Can't initialize SPI\n"); return -1; /* ERROR */ } g_linux_wlan->wilc_spidev = wilc_spi_dev; @@ -2636,7 +2636,7 @@ static void __exit exit_wilc_driver(void) } } for (i = 0; i < NUM_CONCURRENT_IFC; i++) { - PRINT_D(INIT_DBG, "Unregistering netdev %p \n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev); + PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev); unregister_netdev(g_linux_wlan->strInterfaceInfo[i].wilc_netdev); #ifdef USE_WIRELESS PRINT_D(INIT_DBG, "Freeing Wiphy...\n"); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 2361a80857cd..97df19393e7f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -239,7 +239,7 @@ void remove_network_from_shadow(void *pUserVoid) for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { if (time_after(now, astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan + (unsigned long)(SCAN_RESULT_EXPIRE))) { - PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s \n", astrLastScannedNtwrksShadow[i].au8ssid); + PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", astrLastScannedNtwrksShadow[i].au8ssid); if (astrLastScannedNtwrksShadow[i].pu8IEs != NULL) { WILC_FREE(astrLastScannedNtwrksShadow[i].pu8IEs); @@ -393,7 +393,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo WILC_NULLCHECK(s32Error, channel); PRINT_INFO(CFG80211_DBG, "Network Info:: CHANNEL Frequency: %d, RSSI: %d, CapabilityInfo: %d," - "BeaconPeriod: %d \n", channel->center_freq, (((s32)pstrNetworkInfo->s8rssi) * 100), + "BeaconPeriod: %d\n", channel->center_freq, (((s32)pstrNetworkInfo->s8rssi) * 100), pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod); if (pstrNetworkInfo->bNewNetwork == true) { @@ -429,7 +429,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo /* So this network is discovered before, we'll just update its RSSI */ for (i = 0; i < priv->u32RcvdChCount; i++) { if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { - PRINT_D(CFG80211_DBG, "Update RSSI of %s \n", astrLastScannedNtwrksShadow[i].au8ssid); + PRINT_D(CFG80211_DBG, "Update RSSI of %s\n", astrLastScannedNtwrksShadow[i].au8ssid); astrLastScannedNtwrksShadow[i].s8rssi = pstrNetworkInfo->s8rssi; astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies; @@ -439,14 +439,14 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo } } } else if (enuScanEvent == SCAN_EVENT_DONE) { - PRINT_D(CFG80211_DBG, "Scan Done[%p] \n", priv->dev); - PRINT_D(CFG80211_DBG, "Refreshing Scan ... \n"); + PRINT_D(CFG80211_DBG, "Scan Done[%p]\n", priv->dev); + PRINT_D(CFG80211_DBG, "Refreshing Scan ...\n"); refresh_scan(priv, 1, false); if (priv->u32RcvdChCount > 0) { - PRINT_D(CFG80211_DBG, "%d Network(s) found \n", priv->u32RcvdChCount); + PRINT_D(CFG80211_DBG, "%d Network(s) found\n", priv->u32RcvdChCount); } else { - PRINT_D(CFG80211_DBG, "No networks found \n"); + PRINT_D(CFG80211_DBG, "No networks found\n"); } down(&(priv->hSemScanReq)); @@ -464,7 +464,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo else if (enuScanEvent == SCAN_EVENT_ABORTED) { down(&(priv->hSemScanReq)); - PRINT_D(CFG80211_DBG, "Scan Aborted \n"); + PRINT_D(CFG80211_DBG, "Scan Aborted\n"); if (priv->pstrScanReq != NULL) { update_scan_time(priv); @@ -582,7 +582,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, u8WLANChannel = INVALID_CHANNEL; #endif - PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d \n", u16ConnectStatus, u8MacStatus); + PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d\n", u16ConnectStatus, u8MacStatus); } if (u16ConnectStatus == WLAN_STATUS_SUCCESS) { @@ -768,17 +768,17 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r WILC_memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = request->ssids[i].ssid_len; } else { - PRINT_D(CFG80211_DBG, "Received one NULL SSID \n"); + PRINT_D(CFG80211_DBG, "Received one NULL SSID\n"); strHiddenNetwork.u8ssidnum -= 1; } } - PRINT_D(CFG80211_DBG, "Trigger Scan Request \n"); + PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, (const u8 *)request->ie, request->ie_len, CfgScanResult, (void *)priv, &strHiddenNetwork); } else { - PRINT_D(CFG80211_DBG, "Trigger Scan Request \n"); + PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, (const u8 *)request->ie, request->ie_len, @@ -787,7 +787,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r } else { PRINT_ER("Requested num of scanned channels is greater than the max, supported" - " channels \n"); + " channels\n"); } if (s32Error != WILC_SUCCESS) { @@ -840,7 +840,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, } else pstrWFIDrv->u8P2PConnect = 0; #endif - PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d \n", sme->ssid, sme->auth_type); + PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d\n", sme->ssid, sme->auth_type); for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { if ((sme->ssid_len == astrLastScannedNtwrksShadow[i].u8SsidLen) && @@ -1045,7 +1045,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, tenuAuth_type, pstrNetworkInfo->u8channel, pstrNetworkInfo->pJoinParams); if (s32Error != WILC_SUCCESS) { - PRINT_ER("host_int_set_join_req(): Error(%d) \n", s32Error); + PRINT_ER("host_int_set_join_req(): Error(%d)\n", s32Error); s32Error = -ENOENT; goto done; } @@ -1574,7 +1574,7 @@ static int WILC_WFI_set_default_key(struct wiphy *wiphy, struct net_device *netd priv = wiphy_priv(wiphy); - PRINT_D(CFG80211_DBG, "Setting default key with idx = %d \n", key_index); + PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index); if (key_index != priv->WILC_WFI_wep_default) { @@ -1811,7 +1811,7 @@ static int WILC_WFI_set_wiphy_params(struct wiphy *wiphy, u32 changed) priv = wiphy_priv(wiphy); pstrCfgParamVal.u32SetCfgFlag = 0; - PRINT_D(CFG80211_DBG, "Setting Wiphy params \n"); + PRINT_D(CFG80211_DBG, "Setting Wiphy params\n"); if (changed & WIPHY_PARAM_RETRY_SHORT) { PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_RETRY_SHORT %d\n", @@ -2336,7 +2336,7 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid) struct WILC_WFI_priv *priv; priv = (struct WILC_WFI_priv *)pUserVoid; - PRINT_D(HOSTINF_DBG, "Remain on channel ready \n"); + PRINT_D(HOSTINF_DBG, "Remain on channel ready\n"); priv->bInP2PlistenState = true; @@ -2364,7 +2364,7 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID) /*BugID_5477*/ if (u32SessionID == priv->strRemainOnChanParams.u32ListenSessionID) { - PRINT_D(GENERIC_DBG, "Remain on channel expired \n"); + PRINT_D(GENERIC_DBG, "Remain on channel expired\n"); priv->bInP2PlistenState = false; @@ -3211,7 +3211,7 @@ static int WILC_WFI_start_ap(struct wiphy *wiphy, struct net_device *dev, priv = wiphy_priv(wiphy); PRINT_D(HOSTAPD_DBG, "Starting ap\n"); - PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = %zu Tail length = %zu\n", + PRINT_D(HOSTAPD_DBG, "Interval = %d\n DTIM period = %d\n Head length = %zu Tail length = %zu\n", settings->beacon_interval, settings->dtim_period, beacon->head_len, beacon->tail_len); s32Error = WILC_WFI_CfgSetChannel(wiphy, &settings->chandef); @@ -3427,7 +3427,7 @@ static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev, if (mac == NULL) { - PRINT_D(HOSTAPD_DBG, "All associated stations \n"); + PRINT_D(HOSTAPD_DBG, "All associated stations\n"); s32Error = host_int_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); } else { PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 75782a2c36ea..bd5c2564f313 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -447,7 +447,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void) for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) { if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) { struct txq_entry_t *tqe; - PRINT_D(TCP_ENH, "DROP ACK: %u \n", Pending_Acks_info[i].ack_num); + PRINT_D(TCP_ENH, "DROP ACK: %u\n", Pending_Acks_info[i].ack_num); tqe = Pending_Acks_info[i].txqe; if (tqe) { wilc_wlan_txq_remove(tqe); @@ -992,7 +992,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount) /** * wait for vmm table is ready **/ - PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait... \n"); + PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); release_bus(RELEASE_ALLOW_SLEEP); p->os_func.os_sleep(3); /* wait 3 ms */ acquire_bus(ACQUIRE_AND_WAKEUP); @@ -1059,7 +1059,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount) } if (entries == 0) { - PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]] \n", reg, i, vmm_table[i - 1]); + PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]); /* undo the transaction. */ ret = p->hif_func.hif_read_reg(WILC_HOST_TX_CTRL, ®); @@ -1209,7 +1209,7 @@ static void wilc_wlan_handle_rxq(void) do { if (p->quit) { - PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function \n"); + PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n"); p->os_func.os_signal(p->cfg_wait); break; } @@ -1326,7 +1326,7 @@ static void wilc_wlan_handle_rxq(void) } while (1); p->rxq_exit = 1; - PRINT_D(RX_DBG, "THREAD: Exiting RX thread \n"); + PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n"); return; } diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 04d032783dae..c10dffe4633e 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -551,7 +551,7 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r case 'L': #ifndef SWITCH_LOG_TERMINAL - PRINT_ER("Unexpected firmware log message received \n"); + PRINT_ER("Unexpected firmware log message received\n"); #else PRINT_D(FIRM_DBG, "\nFIRMWARE LOGS :\n<<\n%s\n>>\n", frame); break; @@ -566,18 +566,18 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r #endif /*bug3819:*/ case 'S': - PRINT_INFO(RX_DBG, "Scan Notification Received \n"); + PRINT_INFO(RX_DBG, "Scan Notification Received\n"); host_int_ScanCompleteReceived(frame - 4, size + 4); break; #ifdef WILC_FULLY_HOSTING_AP case 'T': - PRINT_INFO(RX_DBG, "TBTT Notification Received \n"); + PRINT_INFO(RX_DBG, "TBTT Notification Received\n"); process_tbtt_isr(); break; case 'A': - PRINT_INFO(RX_DBG, "HOSTAPD ACK Notification Received \n"); + PRINT_INFO(RX_DBG, "HOSTAPD ACK Notification Received\n"); WILC_mgm_HOSTAPD_ACK(ptru32Frame, bStatus); break; #endif From 78174adaf59e85274bb3dde5c5084619ed06020b Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Sat, 8 Aug 2015 17:41:36 +0530 Subject: [PATCH 764/912] staging: wilc1000: Remove braces for single statement 'if' and 'else' Fixes the checkpatch.pl warning - braces {} are not necessary for any arm of this statement Signed-off-by: Chandra S Gorentla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 10 +++----- drivers/staging/wilc1000/host_interface.c | 19 ++++++-------- drivers/staging/wilc1000/linux_wlan.c | 25 ++++++++----------- drivers/staging/wilc1000/wilc_debugfs.c | 10 +++----- drivers/staging/wilc1000/wilc_memory.c | 5 ++-- drivers/staging/wilc1000/wilc_spi.c | 15 +++++------ drivers/staging/wilc1000/wilc_strutils.c | 5 ++-- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 20 ++++++--------- drivers/staging/wilc1000/wilc_wlan.c | 20 ++++++--------- 9 files changed, 52 insertions(+), 77 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 93942b211fcd..72ff7d42377e 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -706,11 +706,10 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset) /* Search for the TIM Element Field and return if the element is found */ while (u16index < (u16RxLen - FCS_LEN)) { - if (pu8msa[u16index] == ITIM) { + if (pu8msa[u16index] == ITIM) return &pu8msa[u16index]; - } else { + else u16index += (IE_HDR_LEN + pu8msa[u16index + 1]); - } } return 0; @@ -1527,11 +1526,10 @@ s32 further_process_response(u8 *resp, u8 cfg_str[256] = {0}; tenuWIDtype enuWIDtype = WID_UNDEF; - if (process_wid_num) { + if (process_wid_num) enuWIDtype = get_wid_type(g_wid_num); - } else { + else enuWIDtype = gastrWIDs[cnt].enuWIDtype; - } switch (enuWIDtype) { diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8b36683ef335..cc549c2c5213 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1350,11 +1350,10 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) /*keep the state as is , no need to change it*/ /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ - if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { + if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) gbScanWhileConnected = true; - } else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) { + else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) gbScanWhileConnected = false; - } s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv); @@ -2849,11 +2848,10 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) * |------------|---------|-------|------------|---------------|----------------| | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ - if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { + if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) WILC_memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); - } else { + else PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n"); - } WILC_memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); @@ -4024,11 +4022,10 @@ static void Handle_PowerManagement(void *drvHandler, tstrHostIfPowerMgmtParam *s strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; - if (strPowerMgmtParam->bIsEnabled == true) { + if (strPowerMgmtParam->bIsEnabled == true) s8PowerMode = MIN_FAST_PS; - } else { + else s8PowerMode = NO_POWERSAVE; - } PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); strWID.ps8WidVal = &s8PowerMode; strWID.s32ValueSize = sizeof(char); @@ -5479,9 +5476,9 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, pu8IEs, IEsLen); } - if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) { + if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; - } else + else PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); /* send the message */ diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 92aa671ab1fd..1384846a5d01 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -422,11 +422,10 @@ static void isr_bh_routine(struct work_struct *work) int_rcvdB++; PRINT_D(INT_DBG, "Interrupt received BH\n"); - if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) { + if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) g_linux_wlan->oup.wlan_handle_rx_isr(); - } else { + else PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n"); - } #if (RX_BH_TYPE == RX_BH_THREADED_IRQ) return IRQ_HANDLED; @@ -450,11 +449,10 @@ static int isr_bh_routine(void *vp) } int_rcvdB++; PRINT_D(INT_DBG, "Interrupt received BH\n"); - if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) { + if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) g_linux_wlan->oup.wlan_handle_rx_isr(); - } else { + else PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n"); - } } return 0; @@ -607,22 +605,20 @@ static int linux_wlan_lock_timeout(void *vp, u32 timeout) { int error = -1; PRINT_D(LOCK_DBG, "Locking %p\n", vp); - if (vp != NULL) { + if (vp != NULL) error = down_timeout((struct semaphore *)vp, msecs_to_jiffies(timeout)); - } else { + else PRINT_ER("Failed, mutex is NULL\n"); - } return error; } void linux_wlan_unlock(void *vp) { PRINT_D(LOCK_DBG, "Unlocking %p\n", vp); - if (vp != NULL) { + if (vp != NULL) up((struct semaphore *)vp); - } else { + else PRINT_ER("Failed, mutex is NULL\n"); - } } static void linux_wlan_init_mutex(char *lockName, void *plock, int count) @@ -2125,11 +2121,10 @@ static void linux_wlan_tx_complete(void *priv, int status) { struct tx_complete_data *pv_data = (struct tx_complete_data *)priv; - if (status == 1) { + if (status == 1) PRINT_D(TX_DBG, "Packet sent successfully - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb); - } else { + else PRINT_D(TX_DBG, "Couldn't send packet - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb); - } /* Free the SK Buffer, its work is done */ dev_kfree_skb(pv_data->skb); linux_wlan_free(pv_data); diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index c328208cda29..be2e901b448d 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -62,11 +62,10 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, size_t flag = buffer[0] - '0'; - if (flag > 0) { + if (flag > 0) flag = DEBUG | ERR; - } else if (flag < 0) { + else if (flag < 0) flag = 100; - } if (flag > DBG_LEVEL_ALL) { printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL)); @@ -75,11 +74,10 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, size_t atomic_set(&DEBUG_LEVEL, (int)flag); - if (flag == 0) { + if (flag == 0) printk("Debug-level disabled\n"); - } else { + else printk("Debug-level enabled\n"); - } return count; } diff --git a/drivers/staging/wilc1000/wilc_memory.c b/drivers/staging/wilc1000/wilc_memory.c index c70707fefb66..34ef13e8e243 100644 --- a/drivers/staging/wilc1000/wilc_memory.c +++ b/drivers/staging/wilc1000/wilc_memory.c @@ -9,11 +9,10 @@ void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo) { - if (u32Size > 0) { + if (u32Size > 0) return kmalloc(u32Size, GFP_ATOMIC); - } else { + else return NULL; - } } /*! diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index abea5df656d7..1bf7d314ae34 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -374,11 +374,10 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz, return result; } - if (!g_spi.crc_off) { + if (!g_spi.crc_off) wb[len - 1] = (crc7(0x7f, (const uint8_t *)&wb[0], len - 1)) << 1; - } else { + else len -= 1; - } #define NUM_SKIP_BYTES (1) #define NUM_RSP_BYTES (2) @@ -522,11 +521,10 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz, if (sz > 0) { int nbytes; - if (sz <= (DATA_PKT_SZ - ix)) { + if (sz <= (DATA_PKT_SZ - ix)) nbytes = sz; - } else { + else nbytes = DATA_PKT_SZ - ix; - } /** * Read bytes @@ -557,11 +555,10 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz, while (sz > 0) { int nbytes; - if (sz <= DATA_PKT_SZ) { + if (sz <= DATA_PKT_SZ) nbytes = sz; - } else { + else nbytes = DATA_PKT_SZ; - } /** * read data response only on the next DMA cycles not diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c index 3600706ed231..a32b9c13e872 100644 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ b/drivers/staging/wilc1000/wilc_strutils.c @@ -41,11 +41,10 @@ s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, s32Result = 1; } else { s32Result = strncmp(pcStr1, pcStr2, u32Count); - if (s32Result < 0) { + if (s32Result < 0) s32Result = -1; - } else if (s32Result > 0) { + else if (s32Result > 0) s32Result = 1; - } } return s32Result; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 97df19393e7f..5c459679aa5a 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -443,11 +443,10 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo PRINT_D(CFG80211_DBG, "Refreshing Scan ...\n"); refresh_scan(priv, 1, false); - if (priv->u32RcvdChCount > 0) { + if (priv->u32RcvdChCount > 0) PRINT_D(CFG80211_DBG, "%d Network(s) found\n", priv->u32RcvdChCount); - } else { + else PRINT_D(CFG80211_DBG, "No networks found\n"); - } down(&(priv->hSemScanReq)); @@ -1686,11 +1685,10 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->txrate.legacy = strStatistics.u8LinkSpeed * 10; #ifdef TCP_ENHANCEMENTS - if ((strStatistics.u8LinkSpeed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED)) { + if ((strStatistics.u8LinkSpeed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED)) Enable_TCP_ACK_Filter(true); - } else if (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED) { + else if (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED) Enable_TCP_ACK_Filter(false); - } #endif PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets, @@ -2059,11 +2057,10 @@ void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) } #endif /* USE_SUPPLICANT_GO_INTENT */ - if (buf[index] == CHANLIST_ATTR_ID) { + if (buf[index] == CHANLIST_ATTR_ID) channel_list_attr_index = index; - } else if (buf[index] == OPERCHAN_ATTR_ID) { + else if (buf[index] == OPERCHAN_ATTR_ID) op_channel_attr_index = index; - } index += buf[index + 1] + 3; /* ID,Length byte */ } @@ -2145,11 +2142,10 @@ void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype) } #endif - if (buf[index] == CHANLIST_ATTR_ID) { + if (buf[index] == CHANLIST_ATTR_ID) channel_list_attr_index = index; - } else if (buf[index] == OPERCHAN_ATTR_ID) { + else if (buf[index] == OPERCHAN_ATTR_ID) op_channel_attr_index = index; - } index += buf[index + 1] + 3; /* ID,Length byte */ } diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index bd5c2564f313..192f36cde59e 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -463,11 +463,10 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void) Pending_Acks = 0; Opened_TCP_session = 0; - if (PendingAcks_arrBase == 0) { + if (PendingAcks_arrBase == 0) PendingAcks_arrBase = MAX_TCP_SESSION; - } else { + else PendingAcks_arrBase = 0; - } p->os_func.os_spin_unlock(p->txq_spinlock, &p->txq_spinlock_flags); @@ -1110,11 +1109,10 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount) /*Bug3959: transmitting mgmt frames received from host*/ /*setting bit 30 in the host header to indicate mgmt frame*/ #ifdef WILC_AP_EXTERNAL_MLME - if (tqe->type == WILC_MGMT_PKT) { + if (tqe->type == WILC_MGMT_PKT) header |= (1 << 30); - } else { + else header &= ~(1 << 30); - } #endif #ifdef BIG_ENDIAN @@ -1541,11 +1539,10 @@ static int wilc_wlan_firmware_download(const uint8_t *buffer, uint32_t buffer_si acquire_bus(ACQUIRE_ONLY); offset += 8; while (((int)size) && (offset < buffer_size)) { - if (size <= blksz) { + if (size <= blksz) size2 = size; - } else { + else size2 = blksz; - } /* Copy firmware into a DMA coherent buffer */ memcpy(dma_buffer, &buffer[offset], size2); ret = p->hif_func.hif_block_tx(addr, dma_buffer, size2); @@ -2302,11 +2299,10 @@ u16 Set_machw_change_vir_if(bool bValue) PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n"); } - if (bValue) { + if (bValue) reg |= (BIT31); - } else { + else reg &= ~(BIT31); - } ret = (&g_wlan)->hif_func.hif_write_reg(WILC_CHANGING_VIR_IF, reg); From c915aadb5d5ffddfd59170931873a5b102aa7d31 Mon Sep 17 00:00:00 2001 From: Daniel Machon Date: Sat, 8 Aug 2015 20:00:07 +0200 Subject: [PATCH 765/912] Staging: wilc1000: wilc_platform.h: Fixed include guard spelling error Fixed spelling error Signed-off-by: Daniel Machon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_platform.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index d03532cc3af2..ccceaae212a5 100644 --- a/drivers/staging/wilc1000/wilc_platform.h +++ b/drivers/staging/wilc1000/wilc_platform.h @@ -1,5 +1,5 @@ -#ifndef __WILC_platfrom_H__ -#define __WILC_platfrom_H__ +#ifndef __WILC_platform_H__ +#define __WILC_platform_H__ #include #include From 550d35d816da2ad141cf05f176118df6f2c75cdb Mon Sep 17 00:00:00 2001 From: Daniel Machon Date: Sat, 8 Aug 2015 20:34:59 +0200 Subject: [PATCH 766/912] Staging: lustre/lnet/selftest: framework.c: Fixed coding style issues Fixed coding style issues where statement should be on the next line Signed-off-by: Daniel Machon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/framework.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 7c5185a2a795..257de3537671 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -203,7 +203,8 @@ sfw_deactivate_session(void) sfw_batch_t *tsb; sfw_test_case_t *tsc; - if (sn == NULL) return; + if (sn == NULL) + return; LASSERT(!sn->sn_timer_active); @@ -613,7 +614,8 @@ sfw_destroy_test_instance(sfw_test_instance_t *tsi) srpc_client_rpc_t *rpc; sfw_test_unit_t *tsu; - if (!tsi->tsi_is_client) goto clean; + if (!tsi->tsi_is_client) + goto clean; tsi->tsi_ops->tso_fini(tsi); @@ -1700,7 +1702,8 @@ sfw_startup(void) for (i = 0; ; i++) { sv = &sfw_services[i]; - if (sv->sv_name == NULL) break; + if (sv->sv_name == NULL) + break; sv->sv_bulk_ready = NULL; sv->sv_handler = sfw_handle_server_rpc; @@ -1717,7 +1720,8 @@ sfw_startup(void) } /* about to sfw_shutdown, no need to add buffer */ - if (error) continue; + if (error) + continue; rc = srpc_service_add_buffers(sv, sv->sv_wi_total); if (rc != 0) { From b963e7223cb3278dda35a6550a8df08ff2be2ee5 Mon Sep 17 00:00:00 2001 From: Daniel Machon Date: Sat, 8 Aug 2015 20:43:25 +0200 Subject: [PATCH 767/912] Staging: lustre/lustre/ptlrpc: service.c: Fixed issue with global integer being initialized to 0 Fixed global integer initialization issue. Global variables should not be explicitly initialized to 0 or NULL. Signed-off-by: Daniel Machon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index d3265a89538a..003344ccfffc 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -43,7 +43,7 @@ #include "ptlrpc_internal.h" /* The following are visible and mutable through /sys/module/ptlrpc */ -int test_req_buffer_pressure = 0; +int test_req_buffer_pressure; module_param(test_req_buffer_pressure, int, 0444); MODULE_PARM_DESC(test_req_buffer_pressure, "set non-zero to put pressure on request buffer pools"); module_param(at_min, int, 0644); From a73e99cb67e7438e5ab0c524ae63a8a27616c839 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 10 Aug 2015 17:49:51 +0200 Subject: [PATCH 768/912] staging: ozwpan: Remove from tree Ozwpan is completely unmaintained and potentially a security problem. As this is a staging driver, it should be removed, since it has been abandoned. Cc: Shigekatsu Tateno Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 5 - drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/ozwpan/Kconfig | 9 - drivers/staging/ozwpan/Makefile | 16 - drivers/staging/ozwpan/README | 25 - drivers/staging/ozwpan/TODO | 14 - drivers/staging/ozwpan/ozappif.h | 36 - drivers/staging/ozwpan/ozcdev.c | 554 ------ drivers/staging/ozwpan/ozcdev.h | 17 - drivers/staging/ozwpan/ozdbg.h | 54 - drivers/staging/ozwpan/ozeltbuf.c | 252 --- drivers/staging/ozwpan/ozeltbuf.h | 65 - drivers/staging/ozwpan/ozhcd.c | 2301 ------------------------ drivers/staging/ozwpan/ozhcd.h | 15 - drivers/staging/ozwpan/ozmain.c | 71 - drivers/staging/ozwpan/ozpd.c | 886 --------- drivers/staging/ozwpan/ozpd.h | 134 -- drivers/staging/ozwpan/ozproto.c | 813 --------- drivers/staging/ozwpan/ozproto.h | 62 - drivers/staging/ozwpan/ozprotocol.h | 375 ---- drivers/staging/ozwpan/ozurbparanoia.c | 54 - drivers/staging/ozwpan/ozurbparanoia.h | 19 - drivers/staging/ozwpan/ozusbif.h | 43 - drivers/staging/ozwpan/ozusbsvc.c | 263 --- drivers/staging/ozwpan/ozusbsvc.h | 32 - drivers/staging/ozwpan/ozusbsvc1.c | 472 ----- 27 files changed, 6590 deletions(-) delete mode 100644 drivers/staging/ozwpan/Kconfig delete mode 100644 drivers/staging/ozwpan/Makefile delete mode 100644 drivers/staging/ozwpan/README delete mode 100644 drivers/staging/ozwpan/TODO delete mode 100644 drivers/staging/ozwpan/ozappif.h delete mode 100644 drivers/staging/ozwpan/ozcdev.c delete mode 100644 drivers/staging/ozwpan/ozcdev.h delete mode 100644 drivers/staging/ozwpan/ozdbg.h delete mode 100644 drivers/staging/ozwpan/ozeltbuf.c delete mode 100644 drivers/staging/ozwpan/ozeltbuf.h delete mode 100644 drivers/staging/ozwpan/ozhcd.c delete mode 100644 drivers/staging/ozwpan/ozhcd.h delete mode 100644 drivers/staging/ozwpan/ozmain.c delete mode 100644 drivers/staging/ozwpan/ozpd.c delete mode 100644 drivers/staging/ozwpan/ozpd.h delete mode 100644 drivers/staging/ozwpan/ozproto.c delete mode 100644 drivers/staging/ozwpan/ozproto.h delete mode 100644 drivers/staging/ozwpan/ozprotocol.h delete mode 100644 drivers/staging/ozwpan/ozurbparanoia.c delete mode 100644 drivers/staging/ozwpan/ozurbparanoia.h delete mode 100644 drivers/staging/ozwpan/ozusbif.h delete mode 100644 drivers/staging/ozwpan/ozusbsvc.c delete mode 100644 drivers/staging/ozwpan/ozusbsvc.h delete mode 100644 drivers/staging/ozwpan/ozusbsvc1.c diff --git a/MAINTAINERS b/MAINTAINERS index 5ac00cb37256..fb7d3b6acd70 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9734,11 +9734,6 @@ W: http://wiki.laptop.org/go/DCON S: Maintained F: drivers/staging/olpc_dcon/ -STAGING - OZMO DEVICES USB OVER WIFI DRIVER -M: Shigekatsu Tateno -S: Maintained -F: drivers/staging/ozwpan/ - STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER M: Willy Tarreau S: Odd Fixes diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 39c5df6154aa..e29293c0c71e 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -76,8 +76,6 @@ source "drivers/staging/android/Kconfig" source "drivers/staging/board/Kconfig" -source "drivers/staging/ozwpan/Kconfig" - source "drivers/staging/gdm72xx/Kconfig" source "drivers/staging/gdm724x/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 018093d60e85..50824dde2c09 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -31,7 +31,6 @@ obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/ obj-$(CONFIG_MFD_NVEC) += nvec/ obj-$(CONFIG_ANDROID) += android/ obj-$(CONFIG_STAGING_BOARD) += board/ -obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/ obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/ obj-$(CONFIG_LTE_GDM724X) += gdm724x/ obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/ diff --git a/drivers/staging/ozwpan/Kconfig b/drivers/staging/ozwpan/Kconfig deleted file mode 100644 index 7904caec546a..000000000000 --- a/drivers/staging/ozwpan/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config USB_WPAN_HCD - tristate "USB over WiFi Host Controller" - depends on USB && NET - help - A driver for USB Host Controllers that are compatible with - Ozmo Devices USB over WiFi technology. - - To compile this driver a module, choose M here: the module - will be called "ozwpan". diff --git a/drivers/staging/ozwpan/Makefile b/drivers/staging/ozwpan/Makefile deleted file mode 100644 index 29529c1a8e3c..000000000000 --- a/drivers/staging/ozwpan/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# ----------------------------------------------------------------------------- -# Copyright (c) 2011 Ozmo Inc -# Released under the GNU General Public License Version 2 (GPLv2). -# ----------------------------------------------------------------------------- - -obj-$(CONFIG_USB_WPAN_HCD) += ozwpan.o -ozwpan-y := \ - ozmain.o \ - ozpd.o \ - ozusbsvc.o \ - ozusbsvc1.o \ - ozhcd.o \ - ozeltbuf.o \ - ozproto.o \ - ozcdev.o \ - ozurbparanoia.o diff --git a/drivers/staging/ozwpan/README b/drivers/staging/ozwpan/README deleted file mode 100644 index 7c055ec99544..000000000000 --- a/drivers/staging/ozwpan/README +++ /dev/null @@ -1,25 +0,0 @@ -OZWPAN USB Host Controller Driver ---------------------------------- -This driver is a USB HCD driver that does not have an associated a physical -device but instead uses Wi-Fi to communicate with the wireless peripheral. -The USB requests are converted into a layer 2 network protocol and transmitted -on the network using an ethertype (0x892e) regestered to Ozmo Device Inc. -This driver is compatible with existing wireless devices that use Ozmo Devices -technology. - -To operate the driver must be bound to a suitable network interface. This can -be done when the module is loaded (specifying the name of the network interface -as a parameter - e.g. 'insmod ozwpan g_net_dev=go0') or can be bound after -loading using an ioctl call. See the ozappif.h file and the ioctls -OZ_IOCTL_ADD_BINDING and OZ_IOCTL_REMOVE_BINDING. - -The devices connect to the host use Wi-Fi Direct so a network card that supports -Wi-Fi direct is required. A recent version (0.8.x or later) version of the -wpa_supplicant can be used to setup the network interface to create a persistent -autonomous group (for older pre-WFD peripherals) or put in a listen state to -allow group negotiation to occur for more recent devices that support WFD. - -The protocol used over the network does not directly mimic the USB bus -transactions as this would be rather busy and inefficient. Instead the chapter 9 -requests are converted into a request/response pair of messages. (See -ozprotocol.h for data structures used in the protocol). diff --git a/drivers/staging/ozwpan/TODO b/drivers/staging/ozwpan/TODO deleted file mode 100644 index f32c1c0bc875..000000000000 --- a/drivers/staging/ozwpan/TODO +++ /dev/null @@ -1,14 +0,0 @@ -TODO: - - Convert event tracing code to in-kernel tracing infrastructure - - Check for remaining ioctl & check if that can be converted into - sysfs entries - - Convert debug prints to appropriate dev_debug or something better - - Modify Kconfig to add CONFIG option for enabling/disabling event - tracing. - - check USB HCD implementation is complete and correct. - - code review by USB developer community. - - testing with as many devices as possible. - -Please send any patches for this driver to -Shigekatsu Tateno -and Greg Kroah-Hartman . diff --git a/drivers/staging/ozwpan/ozappif.h b/drivers/staging/ozwpan/ozappif.h deleted file mode 100644 index ea1b271fdcda..000000000000 --- a/drivers/staging/ozwpan/ozappif.h +++ /dev/null @@ -1,36 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#ifndef _OZAPPIF_H -#define _OZAPPIF_H - -#define OZ_IOCTL_MAGIC 0xf4 - -struct oz_mac_addr { - __u8 a[6]; -}; - -#define OZ_MAX_PDS 8 - -struct oz_pd_list { - __u32 count; - struct oz_mac_addr addr[OZ_MAX_PDS]; -}; - -#define OZ_MAX_BINDING_LEN 32 - -struct oz_binding_info { - char name[OZ_MAX_BINDING_LEN]; -}; - -#define OZ_IOCTL_GET_PD_LIST _IOR(OZ_IOCTL_MAGIC, 0, struct oz_pd_list) -#define OZ_IOCTL_SET_ACTIVE_PD _IOW(OZ_IOCTL_MAGIC, 1, struct oz_mac_addr) -#define OZ_IOCTL_GET_ACTIVE_PD _IOR(OZ_IOCTL_MAGIC, 2, struct oz_mac_addr) -#define OZ_IOCTL_ADD_BINDING _IOW(OZ_IOCTL_MAGIC, 3, struct oz_binding_info) -#define OZ_IOCTL_REMOVE_BINDING _IOW(OZ_IOCTL_MAGIC, 4, struct oz_binding_info) -#define OZ_IOCTL_MAX 5 - - -#endif /* _OZAPPIF_H */ diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c deleted file mode 100644 index da0e1fd50f26..000000000000 --- a/drivers/staging/ozwpan/ozcdev.c +++ /dev/null @@ -1,554 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "ozdbg.h" -#include "ozprotocol.h" -#include "ozappif.h" -#include "ozeltbuf.h" -#include "ozpd.h" -#include "ozproto.h" -#include "ozcdev.h" - -#define OZ_RD_BUF_SZ 256 -struct oz_cdev { - dev_t devnum; - struct cdev cdev; - wait_queue_head_t rdq; - spinlock_t lock; - u8 active_addr[ETH_ALEN]; - struct oz_pd *active_pd; -}; - -/* Per PD context for the serial service stored in the PD. */ -struct oz_serial_ctx { - atomic_t ref_count; - u8 tx_seq_num; - u8 rx_seq_num; - u8 rd_buf[OZ_RD_BUF_SZ]; - int rd_in; - int rd_out; -}; - -static struct oz_cdev g_cdev; -static struct class *g_oz_class; - -/* - * Context: process and softirq - */ -static struct oz_serial_ctx *oz_cdev_claim_ctx(struct oz_pd *pd) -{ - struct oz_serial_ctx *ctx; - - spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL]); - ctx = (struct oz_serial_ctx *) pd->app_ctx[OZ_APPID_SERIAL]; - if (ctx) - atomic_inc(&ctx->ref_count); - spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL]); - return ctx; -} - -/* - * Context: softirq or process - */ -static void oz_cdev_release_ctx(struct oz_serial_ctx *ctx) -{ - if (atomic_dec_and_test(&ctx->ref_count)) { - oz_dbg(ON, "Dealloc serial context\n"); - kfree(ctx); - } -} - -/* - * Context: process - */ -static int oz_cdev_open(struct inode *inode, struct file *filp) -{ - struct oz_cdev *dev = container_of(inode->i_cdev, struct oz_cdev, cdev); - - oz_dbg(ON, "major = %d minor = %d\n", imajor(inode), iminor(inode)); - - filp->private_data = dev; - return 0; -} - -/* - * Context: process - */ -static int oz_cdev_release(struct inode *inode, struct file *filp) -{ - return 0; -} - -/* - * Context: process - */ -static ssize_t oz_cdev_read(struct file *filp, char __user *buf, size_t count, - loff_t *fpos) -{ - int n; - int ix; - - struct oz_pd *pd; - struct oz_serial_ctx *ctx; - - spin_lock_bh(&g_cdev.lock); - pd = g_cdev.active_pd; - if (pd) - oz_pd_get(pd); - spin_unlock_bh(&g_cdev.lock); - if (pd == NULL) - return -1; - ctx = oz_cdev_claim_ctx(pd); - if (ctx == NULL) - goto out2; - n = ctx->rd_in - ctx->rd_out; - if (n < 0) - n += OZ_RD_BUF_SZ; - if (count > n) - count = n; - ix = ctx->rd_out; - n = OZ_RD_BUF_SZ - ix; - if (n > count) - n = count; - if (copy_to_user(buf, &ctx->rd_buf[ix], n)) { - count = 0; - goto out1; - } - ix += n; - if (ix == OZ_RD_BUF_SZ) - ix = 0; - if (n < count) { - if (copy_to_user(&buf[n], ctx->rd_buf, count-n)) { - count = 0; - goto out1; - } - ix = count-n; - } - ctx->rd_out = ix; -out1: - oz_cdev_release_ctx(ctx); -out2: - oz_pd_put(pd); - return count; -} - -/* - * Context: process - */ -static ssize_t oz_cdev_write(struct file *filp, const char __user *buf, - size_t count, loff_t *fpos) -{ - struct oz_pd *pd; - struct oz_elt_buf *eb; - struct oz_elt_info *ei; - struct oz_elt *elt; - struct oz_app_hdr *app_hdr; - struct oz_serial_ctx *ctx; - - if (count > sizeof(ei->data) - sizeof(*elt) - sizeof(*app_hdr)) - return -EINVAL; - - spin_lock_bh(&g_cdev.lock); - pd = g_cdev.active_pd; - if (pd) - oz_pd_get(pd); - spin_unlock_bh(&g_cdev.lock); - if (pd == NULL) - return -ENXIO; - if (!(pd->state & OZ_PD_S_CONNECTED)) - return -EAGAIN; - eb = &pd->elt_buff; - ei = oz_elt_info_alloc(eb); - if (ei == NULL) { - count = 0; - goto out; - } - elt = (struct oz_elt *)ei->data; - app_hdr = (struct oz_app_hdr *)(elt+1); - elt->length = sizeof(struct oz_app_hdr) + count; - elt->type = OZ_ELT_APP_DATA; - ei->app_id = OZ_APPID_SERIAL; - ei->length = elt->length + sizeof(struct oz_elt); - app_hdr->app_id = OZ_APPID_SERIAL; - if (copy_from_user(app_hdr+1, buf, count)) - goto out; - spin_lock_bh(&pd->app_lock[OZ_APPID_USB]); - ctx = (struct oz_serial_ctx *) pd->app_ctx[OZ_APPID_SERIAL]; - if (ctx) { - app_hdr->elt_seq_num = ctx->tx_seq_num++; - if (ctx->tx_seq_num == 0) - ctx->tx_seq_num = 1; - spin_lock(&eb->lock); - if (oz_queue_elt_info(eb, 0, 0, ei) == 0) - ei = NULL; - spin_unlock(&eb->lock); - } - spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]); -out: - if (ei) { - count = 0; - spin_lock_bh(&eb->lock); - oz_elt_info_free(eb, ei); - spin_unlock_bh(&eb->lock); - } - oz_pd_put(pd); - return count; -} - -/* - * Context: process - */ -static int oz_set_active_pd(const u8 *addr) -{ - int rc = 0; - struct oz_pd *pd; - struct oz_pd *old_pd; - - pd = oz_pd_find(addr); - if (pd) { - spin_lock_bh(&g_cdev.lock); - ether_addr_copy(g_cdev.active_addr, addr); - old_pd = g_cdev.active_pd; - g_cdev.active_pd = pd; - spin_unlock_bh(&g_cdev.lock); - if (old_pd) - oz_pd_put(old_pd); - } else { - if (is_zero_ether_addr(addr)) { - spin_lock_bh(&g_cdev.lock); - pd = g_cdev.active_pd; - g_cdev.active_pd = NULL; - memset(g_cdev.active_addr, 0, - sizeof(g_cdev.active_addr)); - spin_unlock_bh(&g_cdev.lock); - if (pd) - oz_pd_put(pd); - } else { - rc = -1; - } - } - return rc; -} - -/* - * Context: process - */ -static long oz_cdev_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) -{ - int rc = 0; - - if (_IOC_TYPE(cmd) != OZ_IOCTL_MAGIC) - return -ENOTTY; - if (_IOC_NR(cmd) > OZ_IOCTL_MAX) - return -ENOTTY; - if (_IOC_DIR(cmd) & _IOC_READ) - rc = !access_ok(VERIFY_WRITE, (void __user *)arg, - _IOC_SIZE(cmd)); - else if (_IOC_DIR(cmd) & _IOC_WRITE) - rc = !access_ok(VERIFY_READ, (void __user *)arg, - _IOC_SIZE(cmd)); - if (rc) - return -EFAULT; - switch (cmd) { - case OZ_IOCTL_GET_PD_LIST: { - struct oz_pd_list list; - - oz_dbg(ON, "OZ_IOCTL_GET_PD_LIST\n"); - memset(&list, 0, sizeof(list)); - list.count = oz_get_pd_list(list.addr, OZ_MAX_PDS); - if (copy_to_user((void __user *)arg, &list, - sizeof(list))) - return -EFAULT; - } - break; - case OZ_IOCTL_SET_ACTIVE_PD: { - u8 addr[ETH_ALEN]; - - oz_dbg(ON, "OZ_IOCTL_SET_ACTIVE_PD\n"); - if (copy_from_user(addr, (void __user *)arg, ETH_ALEN)) - return -EFAULT; - rc = oz_set_active_pd(addr); - } - break; - case OZ_IOCTL_GET_ACTIVE_PD: { - u8 addr[ETH_ALEN]; - - oz_dbg(ON, "OZ_IOCTL_GET_ACTIVE_PD\n"); - spin_lock_bh(&g_cdev.lock); - ether_addr_copy(addr, g_cdev.active_addr); - spin_unlock_bh(&g_cdev.lock); - if (copy_to_user((void __user *)arg, addr, ETH_ALEN)) - return -EFAULT; - } - break; - case OZ_IOCTL_ADD_BINDING: - case OZ_IOCTL_REMOVE_BINDING: { - struct oz_binding_info b; - - if (copy_from_user(&b, (void __user *)arg, - sizeof(struct oz_binding_info))) { - return -EFAULT; - } - /* Make sure name is null terminated. */ - b.name[OZ_MAX_BINDING_LEN-1] = 0; - if (cmd == OZ_IOCTL_ADD_BINDING) - oz_binding_add(b.name); - else - oz_binding_remove(b.name); - } - break; - } - return rc; -} - -/* - * Context: process - */ -static unsigned int oz_cdev_poll(struct file *filp, poll_table *wait) -{ - unsigned int ret = 0; - struct oz_cdev *dev = filp->private_data; - - oz_dbg(ON, "Poll called wait = %p\n", wait); - spin_lock_bh(&dev->lock); - if (dev->active_pd) { - struct oz_serial_ctx *ctx = oz_cdev_claim_ctx(dev->active_pd); - - if (ctx) { - if (ctx->rd_in != ctx->rd_out) - ret |= POLLIN | POLLRDNORM; - oz_cdev_release_ctx(ctx); - } - } - spin_unlock_bh(&dev->lock); - if (wait) - poll_wait(filp, &dev->rdq, wait); - return ret; -} - -/* - */ -static const struct file_operations oz_fops = { - .owner = THIS_MODULE, - .open = oz_cdev_open, - .release = oz_cdev_release, - .read = oz_cdev_read, - .write = oz_cdev_write, - .unlocked_ioctl = oz_cdev_ioctl, - .poll = oz_cdev_poll -}; - -/* - * Context: process - */ -int oz_cdev_register(void) -{ - int err; - struct device *dev; - - memset(&g_cdev, 0, sizeof(g_cdev)); - err = alloc_chrdev_region(&g_cdev.devnum, 0, 1, "ozwpan"); - if (err < 0) - return err; - oz_dbg(ON, "Alloc dev number %d:%d\n", - MAJOR(g_cdev.devnum), MINOR(g_cdev.devnum)); - cdev_init(&g_cdev.cdev, &oz_fops); - g_cdev.cdev.owner = THIS_MODULE; - spin_lock_init(&g_cdev.lock); - init_waitqueue_head(&g_cdev.rdq); - err = cdev_add(&g_cdev.cdev, g_cdev.devnum, 1); - if (err < 0) { - oz_dbg(ON, "Failed to add cdev\n"); - goto unregister; - } - g_oz_class = class_create(THIS_MODULE, "ozmo_wpan"); - if (IS_ERR(g_oz_class)) { - oz_dbg(ON, "Failed to register ozmo_wpan class\n"); - err = PTR_ERR(g_oz_class); - goto delete; - } - dev = device_create(g_oz_class, NULL, g_cdev.devnum, NULL, "ozwpan"); - if (IS_ERR(dev)) { - oz_dbg(ON, "Failed to create sysfs entry for cdev\n"); - err = PTR_ERR(dev); - goto delete; - } - return 0; - -delete: - cdev_del(&g_cdev.cdev); -unregister: - unregister_chrdev_region(g_cdev.devnum, 1); - return err; -} - -/* - * Context: process - */ -int oz_cdev_deregister(void) -{ - cdev_del(&g_cdev.cdev); - unregister_chrdev_region(g_cdev.devnum, 1); - if (g_oz_class) { - device_destroy(g_oz_class, g_cdev.devnum); - class_destroy(g_oz_class); - } - return 0; -} - -/* - * Context: process - */ -int oz_cdev_init(void) -{ - oz_app_enable(OZ_APPID_SERIAL, 1); - return 0; -} - -/* - * Context: process - */ -void oz_cdev_term(void) -{ - oz_app_enable(OZ_APPID_SERIAL, 0); -} - -/* - * Context: softirq-serialized - */ -int oz_cdev_start(struct oz_pd *pd, int resume) -{ - struct oz_serial_ctx *ctx; - struct oz_serial_ctx *old_ctx; - - if (resume) { - oz_dbg(ON, "Serial service resumed\n"); - return 0; - } - ctx = kzalloc(sizeof(struct oz_serial_ctx), GFP_ATOMIC); - if (ctx == NULL) - return -ENOMEM; - atomic_set(&ctx->ref_count, 1); - ctx->tx_seq_num = 1; - spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL]); - old_ctx = pd->app_ctx[OZ_APPID_SERIAL]; - if (old_ctx) { - spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL]); - kfree(ctx); - } else { - pd->app_ctx[OZ_APPID_SERIAL] = ctx; - spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL]); - } - spin_lock(&g_cdev.lock); - if ((g_cdev.active_pd == NULL) && - ether_addr_equal(pd->mac_addr, g_cdev.active_addr)) { - oz_pd_get(pd); - g_cdev.active_pd = pd; - oz_dbg(ON, "Active PD arrived\n"); - } - spin_unlock(&g_cdev.lock); - oz_dbg(ON, "Serial service started\n"); - return 0; -} - -/* - * Context: softirq or process - */ -void oz_cdev_stop(struct oz_pd *pd, int pause) -{ - struct oz_serial_ctx *ctx; - - if (pause) { - oz_dbg(ON, "Serial service paused\n"); - return; - } - spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL]); - ctx = (struct oz_serial_ctx *) pd->app_ctx[OZ_APPID_SERIAL]; - pd->app_ctx[OZ_APPID_SERIAL] = NULL; - spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL]); - if (ctx) - oz_cdev_release_ctx(ctx); - spin_lock(&g_cdev.lock); - if (pd == g_cdev.active_pd) - g_cdev.active_pd = NULL; - else - pd = NULL; - spin_unlock(&g_cdev.lock); - if (pd) { - oz_pd_put(pd); - oz_dbg(ON, "Active PD departed\n"); - } - oz_dbg(ON, "Serial service stopped\n"); -} - -/* - * Context: softirq-serialized - */ -void oz_cdev_rx(struct oz_pd *pd, struct oz_elt *elt) -{ - struct oz_serial_ctx *ctx; - struct oz_app_hdr *app_hdr; - u8 *data; - int len; - int space; - int copy_sz; - int ix; - - ctx = oz_cdev_claim_ctx(pd); - if (ctx == NULL) { - oz_dbg(ON, "Cannot claim serial context\n"); - return; - } - - app_hdr = (struct oz_app_hdr *)(elt+1); - /* If sequence number is non-zero then check it is not a duplicate. - */ - if (app_hdr->elt_seq_num != 0) { - if (((ctx->rx_seq_num - app_hdr->elt_seq_num) & 0x80) == 0) { - /* Reject duplicate element. */ - oz_dbg(ON, "Duplicate element:%02x %02x\n", - app_hdr->elt_seq_num, ctx->rx_seq_num); - goto out; - } - } - ctx->rx_seq_num = app_hdr->elt_seq_num; - len = elt->length - sizeof(struct oz_app_hdr); - data = ((u8 *)(elt+1)) + sizeof(struct oz_app_hdr); - if (len <= 0) - goto out; - space = ctx->rd_out - ctx->rd_in - 1; - if (space < 0) - space += OZ_RD_BUF_SZ; - if (len > space) { - oz_dbg(ON, "Not enough space:%d %d\n", len, space); - len = space; - } - ix = ctx->rd_in; - copy_sz = OZ_RD_BUF_SZ - ix; - if (copy_sz > len) - copy_sz = len; - memcpy(&ctx->rd_buf[ix], data, copy_sz); - len -= copy_sz; - ix += copy_sz; - if (ix == OZ_RD_BUF_SZ) - ix = 0; - if (len) { - memcpy(ctx->rd_buf, data+copy_sz, len); - ix = len; - } - ctx->rd_in = ix; - wake_up(&g_cdev.rdq); -out: - oz_cdev_release_ctx(ctx); -} diff --git a/drivers/staging/ozwpan/ozcdev.h b/drivers/staging/ozwpan/ozcdev.h deleted file mode 100644 index dd11935a093f..000000000000 --- a/drivers/staging/ozwpan/ozcdev.h +++ /dev/null @@ -1,17 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#ifndef _OZCDEV_H -#define _OZCDEV_H - -int oz_cdev_register(void); -int oz_cdev_deregister(void); -int oz_cdev_init(void); -void oz_cdev_term(void); -int oz_cdev_start(struct oz_pd *pd, int resume); -void oz_cdev_stop(struct oz_pd *pd, int pause); -void oz_cdev_rx(struct oz_pd *pd, struct oz_elt *elt); - -#endif /* _OZCDEV_H */ diff --git a/drivers/staging/ozwpan/ozdbg.h b/drivers/staging/ozwpan/ozdbg.h deleted file mode 100644 index b86a2b7e0178..000000000000 --- a/drivers/staging/ozwpan/ozdbg.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ---------------------------------------------------------------------------*/ - -#ifndef _OZDBG_H -#define _OZDBG_H - -#define OZ_WANT_DBG 0 -#define OZ_WANT_VERBOSE_DBG 1 - -#define OZ_DBG_ON 0x0 -#define OZ_DBG_STREAM 0x1 -#define OZ_DBG_URB 0x2 -#define OZ_DBG_CTRL_DETAIL 0x4 -#define OZ_DBG_HUB 0x8 -#define OZ_DBG_RX_FRAMES 0x10 -#define OZ_DBG_TX_FRAMES 0x20 - -#define OZ_DEFAULT_DBG_MASK \ - ( \ - /* OZ_DBG_STREAM | */ \ - /* OZ_DBG_URB | */ \ - /* OZ_DBG_CTRL_DETAIL | */ \ - OZ_DBG_HUB | \ - /* OZ_DBG_RX_FRAMES | */ \ - /* OZ_DBG_TX_FRAMES | */ \ - 0) - -extern unsigned int oz_dbg_mask; - -#define oz_want_dbg(mask) \ - ((OZ_WANT_DBG && (OZ_DBG_##mask == OZ_DBG_ON)) || \ - (OZ_WANT_VERBOSE_DBG && (OZ_DBG_##mask & oz_dbg_mask))) - -#define oz_dbg(mask, fmt, ...) \ -do { \ - if (oz_want_dbg(mask)) \ - pr_debug(fmt, ##__VA_ARGS__); \ -} while (0) - -#define oz_cdev_dbg(cdev, mask, fmt, ...) \ -do { \ - if (oz_want_dbg(mask)) \ - netdev_dbg((cdev)->dev, fmt, ##__VA_ARGS__); \ -} while (0) - -#define oz_pd_dbg(pd, mask, fmt, ...) \ -do { \ - if (oz_want_dbg(mask)) \ - pr_debug(fmt, ##__VA_ARGS__); \ -} while (0) - -#endif /* _OZDBG_H */ diff --git a/drivers/staging/ozwpan/ozeltbuf.c b/drivers/staging/ozwpan/ozeltbuf.c deleted file mode 100644 index 01b25da44241..000000000000 --- a/drivers/staging/ozwpan/ozeltbuf.c +++ /dev/null @@ -1,252 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#include -#include -#include "ozdbg.h" -#include "ozprotocol.h" -#include "ozeltbuf.h" -#include "ozpd.h" - -/* - * Context: softirq-serialized - */ -void oz_elt_buf_init(struct oz_elt_buf *buf) -{ - memset(buf, 0, sizeof(struct oz_elt_buf)); - INIT_LIST_HEAD(&buf->stream_list); - INIT_LIST_HEAD(&buf->order_list); - INIT_LIST_HEAD(&buf->isoc_list); - spin_lock_init(&buf->lock); -} - -/* - * Context: softirq or process - */ -void oz_elt_buf_term(struct oz_elt_buf *buf) -{ - struct oz_elt_info *ei, *n; - - list_for_each_entry_safe(ei, n, &buf->isoc_list, link_order) - kfree(ei); - list_for_each_entry_safe(ei, n, &buf->order_list, link_order) - kfree(ei); -} - -/* - * Context: softirq or process - */ -struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf) -{ - struct oz_elt_info *ei; - - ei = kmem_cache_zalloc(oz_elt_info_cache, GFP_ATOMIC); - if (ei) { - INIT_LIST_HEAD(&ei->link); - INIT_LIST_HEAD(&ei->link_order); - } - return ei; -} - -/* - * Precondition: oz_elt_buf.lock must be held. - * Context: softirq or process - */ -void oz_elt_info_free(struct oz_elt_buf *buf, struct oz_elt_info *ei) -{ - if (ei) - kmem_cache_free(oz_elt_info_cache, ei); -} - -/*------------------------------------------------------------------------------ - * Context: softirq - */ -void oz_elt_info_free_chain(struct oz_elt_buf *buf, struct list_head *list) -{ - struct oz_elt_info *ei, *n; - - spin_lock_bh(&buf->lock); - list_for_each_entry_safe(ei, n, list->next, link) - oz_elt_info_free(buf, ei); - spin_unlock_bh(&buf->lock); -} - -int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count) -{ - struct oz_elt_stream *st; - - oz_dbg(ON, "%s: (0x%x)\n", __func__, id); - - st = kzalloc(sizeof(struct oz_elt_stream), GFP_ATOMIC); - if (st == NULL) - return -ENOMEM; - atomic_set(&st->ref_count, 1); - st->id = id; - st->max_buf_count = max_buf_count; - INIT_LIST_HEAD(&st->elt_list); - spin_lock_bh(&buf->lock); - list_add_tail(&st->link, &buf->stream_list); - spin_unlock_bh(&buf->lock); - return 0; -} - -int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id) -{ - struct list_head *e, *n; - struct oz_elt_stream *st = NULL; - - oz_dbg(ON, "%s: (0x%x)\n", __func__, id); - spin_lock_bh(&buf->lock); - list_for_each(e, &buf->stream_list) { - st = list_entry(e, struct oz_elt_stream, link); - if (st->id == id) { - list_del(e); - break; - } - st = NULL; - } - if (!st) { - spin_unlock_bh(&buf->lock); - return -1; - } - list_for_each_safe(e, n, &st->elt_list) { - struct oz_elt_info *ei = - list_entry(e, struct oz_elt_info, link); - list_del_init(&ei->link); - list_del_init(&ei->link_order); - st->buf_count -= ei->length; - oz_dbg(STREAM, "Stream down: %d %d %d\n", - st->buf_count, ei->length, atomic_read(&st->ref_count)); - oz_elt_stream_put(st); - oz_elt_info_free(buf, ei); - } - spin_unlock_bh(&buf->lock); - oz_elt_stream_put(st); - return 0; -} - -void oz_elt_stream_get(struct oz_elt_stream *st) -{ - atomic_inc(&st->ref_count); -} - -void oz_elt_stream_put(struct oz_elt_stream *st) -{ - if (atomic_dec_and_test(&st->ref_count)) { - oz_dbg(ON, "Stream destroyed\n"); - kfree(st); - } -} - -/* - * Precondition: Element buffer lock must be held. - * If this function fails the caller is responsible for deallocating the elt - * info structure. - */ -int oz_queue_elt_info(struct oz_elt_buf *buf, u8 isoc, u8 id, - struct oz_elt_info *ei) -{ - struct oz_elt_stream *st = NULL; - struct list_head *e; - - if (id) { - list_for_each(e, &buf->stream_list) { - st = list_entry(e, struct oz_elt_stream, link); - if (st->id == id) - break; - } - if (e == &buf->stream_list) { - /* Stream specified but stream not known so fail. - * Caller deallocates element info. */ - return -1; - } - } - if (st) { - /* If this is an ISOC fixed element that needs a frame number - * then insert that now. Earlier we stored the unit count in - * this field. - */ - struct oz_isoc_fixed *body = (struct oz_isoc_fixed *) - &ei->data[sizeof(struct oz_elt)]; - if ((body->app_id == OZ_APPID_USB) && (body->type - == OZ_USB_ENDPOINT_DATA) && - (body->format == OZ_DATA_F_ISOC_FIXED)) { - u8 unit_count = body->frame_number; - - body->frame_number = st->frame_number; - st->frame_number += unit_count; - } - /* Claim stream and update accounts */ - oz_elt_stream_get(st); - ei->stream = st; - st->buf_count += ei->length; - /* Add to list in stream. */ - list_add_tail(&ei->link, &st->elt_list); - oz_dbg(STREAM, "Stream up: %d %d\n", st->buf_count, ei->length); - /* Check if we have too much buffered for this stream. If so - * start dropping elements until we are back in bounds. - */ - while ((st->buf_count > st->max_buf_count) && - !list_empty(&st->elt_list)) { - struct oz_elt_info *ei2 = - list_first_entry(&st->elt_list, - struct oz_elt_info, link); - list_del_init(&ei2->link); - list_del_init(&ei2->link_order); - st->buf_count -= ei2->length; - oz_elt_info_free(buf, ei2); - oz_elt_stream_put(st); - } - } - list_add_tail(&ei->link_order, isoc ? - &buf->isoc_list : &buf->order_list); - return 0; -} - -int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len, - unsigned max_len, struct list_head *list) -{ - int count = 0; - struct list_head *el; - struct oz_elt_info *ei, *n; - - spin_lock_bh(&buf->lock); - if (isoc) - el = &buf->isoc_list; - else - el = &buf->order_list; - - list_for_each_entry_safe(ei, n, el, link_order) { - if ((*len + ei->length) <= max_len) { - struct oz_app_hdr *app_hdr = (struct oz_app_hdr *) - &ei->data[sizeof(struct oz_elt)]; - app_hdr->elt_seq_num = buf->tx_seq_num[ei->app_id]++; - if (buf->tx_seq_num[ei->app_id] == 0) - buf->tx_seq_num[ei->app_id] = 1; - *len += ei->length; - list_del(&ei->link); - list_del(&ei->link_order); - if (ei->stream) { - ei->stream->buf_count -= ei->length; - oz_dbg(STREAM, "Stream down: %d %d\n", - ei->stream->buf_count, ei->length); - oz_elt_stream_put(ei->stream); - ei->stream = NULL; - } - INIT_LIST_HEAD(&ei->link_order); - list_add_tail(&ei->link, list); - count++; - } else { - break; - } - } - spin_unlock_bh(&buf->lock); - return count; -} - -int oz_are_elts_available(struct oz_elt_buf *buf) -{ - return !list_empty(&buf->order_list); -} diff --git a/drivers/staging/ozwpan/ozeltbuf.h b/drivers/staging/ozwpan/ozeltbuf.h deleted file mode 100644 index f09f5fe3ffbe..000000000000 --- a/drivers/staging/ozwpan/ozeltbuf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#ifndef _OZELTBUF_H -#define _OZELTBUF_H - -#include "ozprotocol.h" - -/*----------------------------------------------------------------------------- - */ -struct oz_pd; -typedef void (*oz_elt_callback_t)(struct oz_pd *pd, long context); - -struct oz_elt_stream { - struct list_head link; - struct list_head elt_list; - atomic_t ref_count; - unsigned buf_count; - unsigned max_buf_count; - u8 frame_number; - u8 id; -}; - -#define OZ_MAX_ELT_PAYLOAD 255 -struct oz_elt_info { - struct list_head link; - struct list_head link_order; - u8 flags; - u8 app_id; - oz_elt_callback_t callback; - long context; - struct oz_elt_stream *stream; - u8 data[sizeof(struct oz_elt) + OZ_MAX_ELT_PAYLOAD]; - int length; -}; -/* Flags values */ -#define OZ_EI_F_MARKED 0x1 - -struct oz_elt_buf { - spinlock_t lock; - struct list_head stream_list; - struct list_head order_list; - struct list_head isoc_list; - u8 tx_seq_num[OZ_NB_APPS]; -}; - -void oz_elt_buf_init(struct oz_elt_buf *buf); -void oz_elt_buf_term(struct oz_elt_buf *buf); -struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf); -void oz_elt_info_free(struct oz_elt_buf *buf, struct oz_elt_info *ei); -void oz_elt_info_free_chain(struct oz_elt_buf *buf, struct list_head *list); -int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count); -int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id); -void oz_elt_stream_get(struct oz_elt_stream *st); -void oz_elt_stream_put(struct oz_elt_stream *st); -int oz_queue_elt_info(struct oz_elt_buf *buf, u8 isoc, u8 id, - struct oz_elt_info *ei); -int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len, - unsigned max_len, struct list_head *list); -int oz_are_elts_available(struct oz_elt_buf *buf); - -#endif /* _OZELTBUF_H */ - diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c deleted file mode 100644 index 784b5ecfa849..000000000000 --- a/drivers/staging/ozwpan/ozhcd.c +++ /dev/null @@ -1,2301 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * - * This file provides the implementation of a USB host controller device that - * does not have any associated hardware. Instead the virtual device is - * connected to the WiFi network and emulates the operation of a USB hcd by - * receiving and sending network frames. - * Note: - * We take great pains to reduce the amount of code where interrupts need to be - * disabled and in this respect we are different from standard HCD's. In - * particular we don't want in_irq() code bleeding over to the protocol side of - * the driver. - * The troublesome functions are the urb enqueue and dequeue functions both of - * which can be called in_irq(). So for these functions we put the urbs into a - * queue and request a tasklet to process them. This means that a spinlock with - * interrupts disabled must be held for insertion and removal but most code is - * is in tasklet or soft irq context. The lock that protects this list is called - * the tasklet lock and serves the purpose of the 'HCD lock' which must be held - * when calling the following functions. - * usb_hcd_link_urb_to_ep() - * usb_hcd_unlink_urb_from_ep() - * usb_hcd_flush_endpoint() - * usb_hcd_check_unlink_urb() - * ----------------------------------------------------------------------------- - */ -#include -#include -#include -#include -#include "linux/usb/hcd.h" -#include -#include "ozdbg.h" -#include "ozusbif.h" -#include "ozurbparanoia.h" -#include "ozhcd.h" - -/* - * Number of units of buffering to capture for an isochronous IN endpoint before - * allowing data to be indicated up. - */ -#define OZ_IN_BUFFERING_UNITS 100 - -/* Name of our platform device. - */ -#define OZ_PLAT_DEV_NAME "ozwpan" - -/*EP0 timeout before ep0 request is again added to TX queue. (13*8 = 98mSec) - */ -#define EP0_TIMEOUT_COUNTER 13 - -/* Debounce time HCD driver should wait before unregistering. - */ -#define OZ_HUB_DEBOUNCE_TIMEOUT 1500 - -/* - * Used to link urbs together and also store some status information for each - * urb. - * A cache of these are kept in a pool to reduce number of calls to kmalloc. - */ -struct oz_urb_link { - struct list_head link; - struct urb *urb; - struct oz_port *port; - u8 req_id; - u8 ep_num; - unsigned submit_counter; -}; - -static struct kmem_cache *oz_urb_link_cache; - -/* Holds state information about a USB endpoint. - */ -#define OZ_EP_BUFFER_SIZE_ISOC (1024 * 24) -#define OZ_EP_BUFFER_SIZE_INT 512 -struct oz_endpoint { - struct list_head urb_list; /* List of oz_urb_link items. */ - struct list_head link; /* For isoc ep, links in to isoc - lists of oz_port. */ - struct timespec timestamp; - int credit; - int credit_ceiling; - u8 ep_num; - u8 attrib; - u8 *buffer; - int buffer_size; - int in_ix; - int out_ix; - int buffered_units; - unsigned flags; - int start_frame; -}; - -/* Bits in the flags field. */ -#define OZ_F_EP_BUFFERING 0x1 -#define OZ_F_EP_HAVE_STREAM 0x2 - -/* Holds state information about a USB interface. - */ -struct oz_interface { - unsigned ep_mask; - u8 alt; -}; - -/* Holds state information about an hcd port. - */ -#define OZ_NB_ENDPOINTS 16 -struct oz_port { - unsigned flags; - unsigned status; - void *hpd; - struct oz_hcd *ozhcd; - spinlock_t port_lock; - u8 bus_addr; - u8 next_req_id; - u8 config_num; - int num_iface; - struct oz_interface *iface; - struct oz_endpoint *out_ep[OZ_NB_ENDPOINTS]; - struct oz_endpoint *in_ep[OZ_NB_ENDPOINTS]; - struct list_head isoc_out_ep; - struct list_head isoc_in_ep; -}; - -#define OZ_PORT_F_PRESENT 0x1 -#define OZ_PORT_F_CHANGED 0x2 -#define OZ_PORT_F_DYING 0x4 - -/* Data structure in the private context area of struct usb_hcd. - */ -#define OZ_NB_PORTS 8 -struct oz_hcd { - spinlock_t hcd_lock; - struct list_head urb_pending_list; - struct list_head urb_cancel_list; - struct list_head orphanage; - int conn_port; /* Port that is currently connecting, -1 if none.*/ - struct oz_port ports[OZ_NB_PORTS]; - uint flags; - struct usb_hcd *hcd; -}; - -/* Bits in flags field. - */ -#define OZ_HDC_F_SUSPENDED 0x1 - -/* - * Static function prototypes. - */ -static int oz_hcd_start(struct usb_hcd *hcd); -static void oz_hcd_stop(struct usb_hcd *hcd); -static void oz_hcd_shutdown(struct usb_hcd *hcd); -static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, - gfp_t mem_flags); -static int oz_hcd_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status); -static void oz_hcd_endpoint_disable(struct usb_hcd *hcd, - struct usb_host_endpoint *ep); -static void oz_hcd_endpoint_reset(struct usb_hcd *hcd, - struct usb_host_endpoint *ep); -static int oz_hcd_get_frame_number(struct usb_hcd *hcd); -static int oz_hcd_hub_status_data(struct usb_hcd *hcd, char *buf); -static int oz_hcd_hub_control(struct usb_hcd *hcd, u16 req_type, u16 wvalue, - u16 windex, char *buf, u16 wlength); -static int oz_hcd_bus_suspend(struct usb_hcd *hcd); -static int oz_hcd_bus_resume(struct usb_hcd *hcd); -static int oz_plat_probe(struct platform_device *dev); -static int oz_plat_remove(struct platform_device *dev); -static void oz_plat_shutdown(struct platform_device *dev); -static int oz_plat_suspend(struct platform_device *dev, pm_message_t msg); -static int oz_plat_resume(struct platform_device *dev); -static void oz_urb_process_tasklet(unsigned long unused); -static int oz_build_endpoints_for_config(struct usb_hcd *hcd, - struct oz_port *port, struct usb_host_config *config, - gfp_t mem_flags); -static void oz_clean_endpoints_for_config(struct usb_hcd *hcd, - struct oz_port *port); -static int oz_build_endpoints_for_interface(struct usb_hcd *hcd, - struct oz_port *port, - struct usb_host_interface *intf, gfp_t mem_flags); -static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd, - struct oz_port *port, int if_ix); -static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb, - gfp_t mem_flags); -static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep, - struct urb *urb); -static void oz_hcd_clear_orphanage(struct oz_hcd *ozhcd, int status); - -/* - * Static external variables. - */ -static struct platform_device *g_plat_dev; -static struct oz_hcd *g_ozhcd; -static DEFINE_SPINLOCK(g_hcdlock); /* Guards g_ozhcd. */ -static const char g_hcd_name[] = "Ozmo WPAN"; -static DEFINE_SPINLOCK(g_tasklet_lock); -static struct tasklet_struct g_urb_process_tasklet; -static struct tasklet_struct g_urb_cancel_tasklet; -static atomic_t g_pending_urbs = ATOMIC_INIT(0); -static atomic_t g_usb_frame_number = ATOMIC_INIT(0); -static const struct hc_driver g_oz_hc_drv = { - .description = g_hcd_name, - .product_desc = "Ozmo Devices WPAN", - .hcd_priv_size = sizeof(struct oz_hcd), - .flags = HCD_USB11, - .start = oz_hcd_start, - .stop = oz_hcd_stop, - .shutdown = oz_hcd_shutdown, - .urb_enqueue = oz_hcd_urb_enqueue, - .urb_dequeue = oz_hcd_urb_dequeue, - .endpoint_disable = oz_hcd_endpoint_disable, - .endpoint_reset = oz_hcd_endpoint_reset, - .get_frame_number = oz_hcd_get_frame_number, - .hub_status_data = oz_hcd_hub_status_data, - .hub_control = oz_hcd_hub_control, - .bus_suspend = oz_hcd_bus_suspend, - .bus_resume = oz_hcd_bus_resume, -}; - -static struct platform_driver g_oz_plat_drv = { - .probe = oz_plat_probe, - .remove = oz_plat_remove, - .shutdown = oz_plat_shutdown, - .suspend = oz_plat_suspend, - .resume = oz_plat_resume, - .driver = { - .name = OZ_PLAT_DEV_NAME, - }, -}; - -/* - * Gets our private context area (which is of type struct oz_hcd) from the - * usb_hcd structure. - * Context: any - */ -static inline struct oz_hcd *oz_hcd_private(struct usb_hcd *hcd) -{ - return (struct oz_hcd *)hcd->hcd_priv; -} - -/* - * Searches list of ports to find the index of the one with a specified USB - * bus address. If none of the ports has the bus address then the connection - * port is returned, if there is one or -1 otherwise. - * Context: any - */ -static int oz_get_port_from_addr(struct oz_hcd *ozhcd, u8 bus_addr) -{ - int i; - - for (i = 0; i < OZ_NB_PORTS; i++) { - if (ozhcd->ports[i].bus_addr == bus_addr) - return i; - } - return ozhcd->conn_port; -} - -/* - * Context: any - */ -static struct oz_urb_link *oz_alloc_urb_link(void) -{ - return kmem_cache_alloc(oz_urb_link_cache, GFP_ATOMIC); -} - -/* - * Context: any - */ -static void oz_free_urb_link(struct oz_urb_link *urbl) -{ - if (!urbl) - return; - - kmem_cache_free(oz_urb_link_cache, urbl); -} - -/* - * Allocates endpoint structure and optionally a buffer. If a buffer is - * allocated it immediately follows the endpoint structure. - * Context: softirq - */ -static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags) -{ - struct oz_endpoint *ep; - - ep = kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); - if (!ep) - return NULL; - - INIT_LIST_HEAD(&ep->urb_list); - INIT_LIST_HEAD(&ep->link); - ep->credit = -1; - if (buffer_size) { - ep->buffer_size = buffer_size; - ep->buffer = (u8 *)(ep+1); - } - - return ep; -} - -/* - * Pre-condition: Must be called with g_tasklet_lock held and interrupts - * disabled. - * Context: softirq or process - */ -static struct oz_urb_link *oz_uncancel_urb(struct oz_hcd *ozhcd, - struct urb *urb) -{ - struct oz_urb_link *urbl; - - list_for_each_entry(urbl, &ozhcd->urb_cancel_list, link) { - if (urb == urbl->urb) { - list_del_init(&urbl->link); - return urbl; - } - } - return NULL; -} - -/* - * This is called when we have finished processing an urb. It unlinks it from - * the ep and returns it to the core. - * Context: softirq or process - */ -static void oz_complete_urb(struct usb_hcd *hcd, struct urb *urb, - int status) -{ - struct oz_hcd *ozhcd = oz_hcd_private(hcd); - unsigned long irq_state; - struct oz_urb_link *cancel_urbl; - - spin_lock_irqsave(&g_tasklet_lock, irq_state); - usb_hcd_unlink_urb_from_ep(hcd, urb); - /* Clear hcpriv which will prevent it being put in the cancel list - * in the event that an attempt is made to cancel it. - */ - urb->hcpriv = NULL; - /* Walk the cancel list in case the urb is already sitting there. - * Since we process the cancel list in a tasklet rather than in - * the dequeue function this could happen. - */ - cancel_urbl = oz_uncancel_urb(ozhcd, urb); - /* Note: we release lock but do not enable local irqs. - * It appears that usb_hcd_giveback_urb() expects irqs to be disabled, - * or at least other host controllers disable interrupts at this point - * so we do the same. We must, however, release the lock otherwise a - * deadlock will occur if an urb is submitted to our driver in the urb - * completion function. Because we disable interrupts it is possible - * that the urb_enqueue function can be called with them disabled. - */ - spin_unlock(&g_tasklet_lock); - if (oz_forget_urb(urb)) { - oz_dbg(ON, "ERROR Unknown URB %p\n", urb); - } else { - atomic_dec(&g_pending_urbs); - usb_hcd_giveback_urb(hcd, urb, status); - } - spin_lock(&g_tasklet_lock); - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - oz_free_urb_link(cancel_urbl); -} - -/* - * Deallocates an endpoint including deallocating any associated stream and - * returning any queued urbs to the core. - * Context: softirq - */ -static void oz_ep_free(struct oz_port *port, struct oz_endpoint *ep) -{ - if (port) { - LIST_HEAD(list); - struct oz_hcd *ozhcd = port->ozhcd; - - if (ep->flags & OZ_F_EP_HAVE_STREAM) - oz_usb_stream_delete(port->hpd, ep->ep_num); - /* Transfer URBs to the orphanage while we hold the lock. */ - spin_lock_bh(&ozhcd->hcd_lock); - /* Note: this works even if ep->urb_list is empty.*/ - list_replace_init(&ep->urb_list, &list); - /* Put the URBs in the orphanage. */ - list_splice_tail(&list, &ozhcd->orphanage); - spin_unlock_bh(&ozhcd->hcd_lock); - } - oz_dbg(ON, "Freeing endpoint memory\n"); - kfree(ep); -} - -/* - * Context: softirq - */ -static void oz_complete_buffered_urb(struct oz_port *port, - struct oz_endpoint *ep, - struct urb *urb) -{ - int data_len, available_space, copy_len; - - data_len = ep->buffer[ep->out_ix]; - if (data_len <= urb->transfer_buffer_length) - available_space = data_len; - else - available_space = urb->transfer_buffer_length; - - if (++ep->out_ix == ep->buffer_size) - ep->out_ix = 0; - copy_len = ep->buffer_size - ep->out_ix; - if (copy_len >= available_space) - copy_len = available_space; - memcpy(urb->transfer_buffer, &ep->buffer[ep->out_ix], copy_len); - - if (copy_len < available_space) { - memcpy((urb->transfer_buffer + copy_len), ep->buffer, - (available_space - copy_len)); - ep->out_ix = available_space - copy_len; - } else { - ep->out_ix += copy_len; - } - urb->actual_length = available_space; - if (ep->out_ix == ep->buffer_size) - ep->out_ix = 0; - - ep->buffered_units--; - oz_dbg(ON, "Trying to give back buffered frame of size=%d\n", - available_space); - oz_complete_urb(port->ozhcd->hcd, urb, 0); -} - -/* - * Context: softirq - */ -static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir, - struct urb *urb, u8 req_id) -{ - struct oz_urb_link *urbl; - struct oz_endpoint *ep = NULL; - int err = 0; - - if (ep_addr >= OZ_NB_ENDPOINTS) { - oz_dbg(ON, "%s: Invalid endpoint number\n", __func__); - return -EINVAL; - } - urbl = oz_alloc_urb_link(); - if (!urbl) - return -ENOMEM; - urbl->submit_counter = 0; - urbl->urb = urb; - urbl->req_id = req_id; - urbl->ep_num = ep_addr; - /* Hold lock while we insert the URB into the list within the - * endpoint structure. - */ - spin_lock_bh(&port->ozhcd->hcd_lock); - /* If the urb has been unlinked while out of any list then - * complete it now. - */ - if (urb->unlinked) { - spin_unlock_bh(&port->ozhcd->hcd_lock); - oz_dbg(ON, "urb %p unlinked so complete immediately\n", urb); - oz_complete_urb(port->ozhcd->hcd, urb, 0); - oz_free_urb_link(urbl); - return 0; - } - - if (in_dir) - ep = port->in_ep[ep_addr]; - else - ep = port->out_ep[ep_addr]; - if (!ep) { - err = -ENOMEM; - goto out; - } - - /*For interrupt endpoint check for buffered data - * & complete urb - */ - if (((ep->attrib & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) - && ep->buffered_units > 0) { - oz_free_urb_link(urbl); - spin_unlock_bh(&port->ozhcd->hcd_lock); - oz_complete_buffered_urb(port, ep, urb); - return 0; - } - - if (port->hpd) { - list_add_tail(&urbl->link, &ep->urb_list); - if (!in_dir && ep_addr && (ep->credit < 0)) { - getrawmonotonic(&ep->timestamp); - ep->credit = 0; - } - } else { - err = -EPIPE; - } -out: - spin_unlock_bh(&port->ozhcd->hcd_lock); - if (err) - oz_free_urb_link(urbl); - return err; -} - -/* - * Removes an urb from the queue in the endpoint. - * Returns 0 if it is found and -EIDRM otherwise. - * Context: softirq - */ -static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir, - struct urb *urb) -{ - struct oz_urb_link *urbl = NULL; - struct oz_endpoint *ep; - - spin_lock_bh(&port->ozhcd->hcd_lock); - if (in_dir) - ep = port->in_ep[ep_addr]; - else - ep = port->out_ep[ep_addr]; - if (ep) { - struct list_head *e; - - list_for_each(e, &ep->urb_list) { - urbl = list_entry(e, struct oz_urb_link, link); - if (urbl->urb == urb) { - list_del_init(e); - break; - } - urbl = NULL; - } - } - spin_unlock_bh(&port->ozhcd->hcd_lock); - oz_free_urb_link(urbl); - return urbl ? 0 : -EIDRM; -} - -/* - * Finds an urb given its request id. - * Context: softirq - */ -static struct urb *oz_find_urb_by_id(struct oz_port *port, int ep_ix, - u8 req_id) -{ - struct oz_hcd *ozhcd = port->ozhcd; - struct urb *urb = NULL; - struct oz_urb_link *urbl; - struct oz_endpoint *ep; - - spin_lock_bh(&ozhcd->hcd_lock); - ep = port->out_ep[ep_ix]; - if (ep) { - struct list_head *e; - - list_for_each(e, &ep->urb_list) { - urbl = list_entry(e, struct oz_urb_link, link); - if (urbl->req_id == req_id) { - urb = urbl->urb; - list_del_init(e); - break; - } - } - } - spin_unlock_bh(&ozhcd->hcd_lock); - /* If urb is non-zero then we we must have an urb link to delete. - */ - if (urb) - oz_free_urb_link(urbl); - return urb; -} - -/* - * Pre-condition: Port lock must be held. - * Context: softirq - */ -static void oz_acquire_port(struct oz_port *port, void *hpd) -{ - INIT_LIST_HEAD(&port->isoc_out_ep); - INIT_LIST_HEAD(&port->isoc_in_ep); - port->flags |= OZ_PORT_F_PRESENT | OZ_PORT_F_CHANGED; - port->status |= USB_PORT_STAT_CONNECTION | - (USB_PORT_STAT_C_CONNECTION << 16); - oz_usb_get(hpd); - port->hpd = hpd; -} - -/* - * Context: softirq - */ -static struct oz_hcd *oz_hcd_claim(void) -{ - struct oz_hcd *ozhcd; - - spin_lock_bh(&g_hcdlock); - ozhcd = g_ozhcd; - if (ozhcd) - usb_get_hcd(ozhcd->hcd); - spin_unlock_bh(&g_hcdlock); - return ozhcd; -} - -/* - * Context: softirq - */ -static inline void oz_hcd_put(struct oz_hcd *ozhcd) -{ - if (ozhcd) - usb_put_hcd(ozhcd->hcd); -} - -/* - * This is called by the protocol handler to notify that a PD has arrived. - * We allocate a port to associate with the PD and create a structure for - * endpoint 0. This port is made the connection port. - * In the event that one of the other port is already a connection port then - * we fail. - * TODO We should be able to do better than fail and should be able remember - * that this port needs configuring and make it the connection port once the - * current connection port has been assigned an address. Collisions here are - * probably very rare indeed. - * Context: softirq - */ -struct oz_port *oz_hcd_pd_arrived(void *hpd) -{ - int i; - struct oz_port *hport; - struct oz_hcd *ozhcd; - struct oz_endpoint *ep; - - ozhcd = oz_hcd_claim(); - if (!ozhcd) - return NULL; - /* Allocate an endpoint object in advance (before holding hcd lock) to - * use for out endpoint 0. - */ - ep = oz_ep_alloc(0, GFP_ATOMIC); - if (!ep) - goto err_put; - - spin_lock_bh(&ozhcd->hcd_lock); - if (ozhcd->conn_port >= 0) - goto err_unlock; - - for (i = 0; i < OZ_NB_PORTS; i++) { - struct oz_port *port = &ozhcd->ports[i]; - - spin_lock(&port->port_lock); - if (!(port->flags & (OZ_PORT_F_PRESENT | OZ_PORT_F_CHANGED))) { - oz_acquire_port(port, hpd); - spin_unlock(&port->port_lock); - break; - } - spin_unlock(&port->port_lock); - } - if (i == OZ_NB_PORTS) - goto err_unlock; - - ozhcd->conn_port = i; - hport = &ozhcd->ports[i]; - hport->out_ep[0] = ep; - spin_unlock_bh(&ozhcd->hcd_lock); - if (ozhcd->flags & OZ_HDC_F_SUSPENDED) - usb_hcd_resume_root_hub(ozhcd->hcd); - usb_hcd_poll_rh_status(ozhcd->hcd); - oz_hcd_put(ozhcd); - - return hport; - -err_unlock: - spin_unlock_bh(&ozhcd->hcd_lock); - oz_ep_free(NULL, ep); -err_put: - oz_hcd_put(ozhcd); - return NULL; -} - -/* - * This is called by the protocol handler to notify that the PD has gone away. - * We need to deallocate all resources and then request that the root hub is - * polled. We release the reference we hold on the PD. - * Context: softirq - */ -void oz_hcd_pd_departed(struct oz_port *port) -{ - struct oz_hcd *ozhcd; - void *hpd; - struct oz_endpoint *ep = NULL; - - if (port == NULL) { - oz_dbg(ON, "%s: port = 0\n", __func__); - return; - } - ozhcd = port->ozhcd; - if (ozhcd == NULL) - return; - /* Check if this is the connection port - if so clear it. - */ - spin_lock_bh(&ozhcd->hcd_lock); - if ((ozhcd->conn_port >= 0) && - (port == &ozhcd->ports[ozhcd->conn_port])) { - oz_dbg(ON, "Clearing conn_port\n"); - ozhcd->conn_port = -1; - } - spin_lock(&port->port_lock); - port->flags |= OZ_PORT_F_DYING; - spin_unlock(&port->port_lock); - spin_unlock_bh(&ozhcd->hcd_lock); - - oz_clean_endpoints_for_config(ozhcd->hcd, port); - spin_lock_bh(&port->port_lock); - hpd = port->hpd; - port->hpd = NULL; - port->bus_addr = 0xff; - port->config_num = 0; - port->flags &= ~(OZ_PORT_F_PRESENT | OZ_PORT_F_DYING); - port->flags |= OZ_PORT_F_CHANGED; - port->status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE); - port->status |= (USB_PORT_STAT_C_CONNECTION << 16); - /* If there is an endpont 0 then clear the pointer while we hold - * the spinlock be we deallocate it after releasing the lock. - */ - if (port->out_ep[0]) { - ep = port->out_ep[0]; - port->out_ep[0] = NULL; - } - spin_unlock_bh(&port->port_lock); - if (ep) - oz_ep_free(port, ep); - usb_hcd_poll_rh_status(ozhcd->hcd); - oz_usb_put(hpd); -} - -/* - * Context: softirq - */ -void oz_hcd_pd_reset(void *hpd, void *hport) -{ - /* Cleanup the current configuration and report reset to the core. - */ - struct oz_port *port = hport; - struct oz_hcd *ozhcd = port->ozhcd; - - oz_dbg(ON, "PD Reset\n"); - spin_lock_bh(&port->port_lock); - port->flags |= OZ_PORT_F_CHANGED; - port->status |= USB_PORT_STAT_RESET; - port->status |= (USB_PORT_STAT_C_RESET << 16); - spin_unlock_bh(&port->port_lock); - oz_clean_endpoints_for_config(ozhcd->hcd, port); - usb_hcd_poll_rh_status(ozhcd->hcd); -} - -/* - * Context: softirq - */ -void oz_hcd_get_desc_cnf(void *hport, u8 req_id, u8 status, const u8 *desc, - u8 length, u16 offset, u16 total_size) -{ - struct oz_port *port = hport; - struct urb *urb; - int err = 0; - - oz_dbg(ON, "oz_hcd_get_desc_cnf length = %d offs = %d tot_size = %d\n", - length, offset, total_size); - urb = oz_find_urb_by_id(port, 0, req_id); - if (!urb) - return; - if (status == 0) { - unsigned int copy_len; - unsigned int required_size = urb->transfer_buffer_length; - - if (required_size > total_size) - required_size = total_size; - copy_len = required_size-offset; - if (length <= copy_len) - copy_len = length; - memcpy(urb->transfer_buffer+offset, desc, copy_len); - offset += copy_len; - if (offset < required_size) { - struct usb_ctrlrequest *setup = - (struct usb_ctrlrequest *)urb->setup_packet; - unsigned wvalue = le16_to_cpu(setup->wValue); - - if (oz_enqueue_ep_urb(port, 0, 0, urb, req_id)) - err = -ENOMEM; - else if (oz_usb_get_desc_req(port->hpd, req_id, - setup->bRequestType, (u8)(wvalue>>8), - (u8)wvalue, setup->wIndex, offset, - required_size-offset)) { - oz_dequeue_ep_urb(port, 0, 0, urb); - err = -ENOMEM; - } - if (err == 0) - return; - } - } - urb->actual_length = total_size; - oz_complete_urb(port->ozhcd->hcd, urb, 0); -} - -/* - * Context: softirq - */ -static void oz_display_conf_type(u8 t) -{ - switch (t) { - case USB_REQ_GET_STATUS: - oz_dbg(ON, "USB_REQ_GET_STATUS - cnf\n"); - break; - case USB_REQ_CLEAR_FEATURE: - oz_dbg(ON, "USB_REQ_CLEAR_FEATURE - cnf\n"); - break; - case USB_REQ_SET_FEATURE: - oz_dbg(ON, "USB_REQ_SET_FEATURE - cnf\n"); - break; - case USB_REQ_SET_ADDRESS: - oz_dbg(ON, "USB_REQ_SET_ADDRESS - cnf\n"); - break; - case USB_REQ_GET_DESCRIPTOR: - oz_dbg(ON, "USB_REQ_GET_DESCRIPTOR - cnf\n"); - break; - case USB_REQ_SET_DESCRIPTOR: - oz_dbg(ON, "USB_REQ_SET_DESCRIPTOR - cnf\n"); - break; - case USB_REQ_GET_CONFIGURATION: - oz_dbg(ON, "USB_REQ_GET_CONFIGURATION - cnf\n"); - break; - case USB_REQ_SET_CONFIGURATION: - oz_dbg(ON, "USB_REQ_SET_CONFIGURATION - cnf\n"); - break; - case USB_REQ_GET_INTERFACE: - oz_dbg(ON, "USB_REQ_GET_INTERFACE - cnf\n"); - break; - case USB_REQ_SET_INTERFACE: - oz_dbg(ON, "USB_REQ_SET_INTERFACE - cnf\n"); - break; - case USB_REQ_SYNCH_FRAME: - oz_dbg(ON, "USB_REQ_SYNCH_FRAME - cnf\n"); - break; - } -} - -/* - * Context: softirq - */ -static void oz_hcd_complete_set_config(struct oz_port *port, struct urb *urb, - u8 rcode, u8 config_num) -{ - int rc = 0; - struct usb_hcd *hcd = port->ozhcd->hcd; - - if (rcode == 0) { - port->config_num = config_num; - oz_clean_endpoints_for_config(hcd, port); - if (oz_build_endpoints_for_config(hcd, port, - &urb->dev->config[port->config_num-1], GFP_ATOMIC)) { - rc = -ENOMEM; - } - } else { - rc = -ENOMEM; - } - oz_complete_urb(hcd, urb, rc); -} - -/* - * Context: softirq - */ -static void oz_hcd_complete_set_interface(struct oz_port *port, struct urb *urb, - u8 rcode, u8 if_num, u8 alt) -{ - struct usb_hcd *hcd = port->ozhcd->hcd; - int rc = 0; - - if ((rcode == 0) && (port->config_num > 0)) { - struct usb_host_config *config; - struct usb_host_interface *intf; - - oz_dbg(ON, "Set interface %d alt %d\n", if_num, alt); - oz_clean_endpoints_for_interface(hcd, port, if_num); - config = &urb->dev->config[port->config_num-1]; - intf = &config->intf_cache[if_num]->altsetting[alt]; - if (oz_build_endpoints_for_interface(hcd, port, intf, - GFP_ATOMIC)) - rc = -ENOMEM; - else - port->iface[if_num].alt = alt; - } else { - rc = -ENOMEM; - } - oz_complete_urb(hcd, urb, rc); -} - -/* - * Context: softirq - */ -void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, const u8 *data, - int data_len) -{ - struct oz_port *port = hport; - struct urb *urb; - struct usb_ctrlrequest *setup; - struct usb_hcd *hcd = port->ozhcd->hcd; - unsigned windex; - unsigned wvalue; - - oz_dbg(ON, "oz_hcd_control_cnf rcode=%u len=%d\n", rcode, data_len); - urb = oz_find_urb_by_id(port, 0, req_id); - if (!urb) { - oz_dbg(ON, "URB not found\n"); - return; - } - setup = (struct usb_ctrlrequest *)urb->setup_packet; - windex = le16_to_cpu(setup->wIndex); - wvalue = le16_to_cpu(setup->wValue); - if ((setup->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { - /* Standard requests */ - oz_display_conf_type(setup->bRequest); - switch (setup->bRequest) { - case USB_REQ_SET_CONFIGURATION: - oz_hcd_complete_set_config(port, urb, rcode, - (u8)wvalue); - break; - case USB_REQ_SET_INTERFACE: - oz_hcd_complete_set_interface(port, urb, rcode, - (u8)windex, (u8)wvalue); - break; - default: - oz_complete_urb(hcd, urb, 0); - } - - } else { - int copy_len; - - oz_dbg(ON, "VENDOR-CLASS - cnf\n"); - if (data_len) { - if (data_len <= urb->transfer_buffer_length) - copy_len = data_len; - else - copy_len = urb->transfer_buffer_length; - memcpy(urb->transfer_buffer, data, copy_len); - urb->actual_length = copy_len; - } - oz_complete_urb(hcd, urb, 0); - } -} - -/* - * Context: softirq-serialized - */ -static int oz_hcd_buffer_data(struct oz_endpoint *ep, const u8 *data, - int data_len) -{ - int space; - int copy_len; - - if (!ep->buffer) - return -1; - space = ep->out_ix-ep->in_ix-1; - if (space < 0) - space += ep->buffer_size; - if (space < (data_len+1)) { - oz_dbg(ON, "Buffer full\n"); - return -1; - } - ep->buffer[ep->in_ix] = (u8)data_len; - if (++ep->in_ix == ep->buffer_size) - ep->in_ix = 0; - copy_len = ep->buffer_size - ep->in_ix; - if (copy_len > data_len) - copy_len = data_len; - memcpy(&ep->buffer[ep->in_ix], data, copy_len); - - if (copy_len < data_len) { - memcpy(ep->buffer, data+copy_len, data_len-copy_len); - ep->in_ix = data_len-copy_len; - } else { - ep->in_ix += copy_len; - } - if (ep->in_ix == ep->buffer_size) - ep->in_ix = 0; - ep->buffered_units++; - return 0; -} - -/* - * Context: softirq-serialized - */ -void oz_hcd_data_ind(void *hport, u8 endpoint, const u8 *data, int data_len) -{ - struct oz_port *port = (struct oz_port *)hport; - struct oz_endpoint *ep; - struct oz_hcd *ozhcd = port->ozhcd; - - spin_lock_bh(&ozhcd->hcd_lock); - ep = port->in_ep[endpoint & USB_ENDPOINT_NUMBER_MASK]; - if (ep == NULL) - goto done; - switch (ep->attrib & USB_ENDPOINT_XFERTYPE_MASK) { - case USB_ENDPOINT_XFER_INT: - case USB_ENDPOINT_XFER_BULK: - if (!list_empty(&ep->urb_list)) { - struct oz_urb_link *urbl = - list_first_entry(&ep->urb_list, - struct oz_urb_link, link); - struct urb *urb; - int copy_len; - - list_del_init(&urbl->link); - spin_unlock_bh(&ozhcd->hcd_lock); - urb = urbl->urb; - oz_free_urb_link(urbl); - if (data_len <= urb->transfer_buffer_length) - copy_len = data_len; - else - copy_len = urb->transfer_buffer_length; - memcpy(urb->transfer_buffer, data, copy_len); - urb->actual_length = copy_len; - oz_complete_urb(port->ozhcd->hcd, urb, 0); - return; - } - oz_dbg(ON, "buffering frame as URB is not available\n"); - oz_hcd_buffer_data(ep, data, data_len); - break; - case USB_ENDPOINT_XFER_ISOC: - oz_hcd_buffer_data(ep, data, data_len); - break; - } -done: - spin_unlock_bh(&ozhcd->hcd_lock); -} - -/* - * Context: unknown - */ -static inline int oz_usb_get_frame_number(void) -{ - return atomic_inc_return(&g_usb_frame_number); -} - -/* - * Context: softirq - */ -int oz_hcd_heartbeat(void *hport) -{ - int rc = 0; - struct oz_port *port = hport; - struct oz_hcd *ozhcd = port->ozhcd; - struct oz_urb_link *urbl, *n; - LIST_HEAD(xfr_list); - struct urb *urb; - struct oz_endpoint *ep; - struct timespec ts, delta; - - getrawmonotonic(&ts); - /* Check the OUT isoc endpoints to see if any URB data can be sent. - */ - spin_lock_bh(&ozhcd->hcd_lock); - list_for_each_entry(ep, &port->isoc_out_ep, link) { - if (ep->credit < 0) - continue; - delta = timespec_sub(ts, ep->timestamp); - ep->credit += div_u64(timespec_to_ns(&delta), NSEC_PER_MSEC); - if (ep->credit > ep->credit_ceiling) - ep->credit = ep->credit_ceiling; - ep->timestamp = ts; - while (ep->credit && !list_empty(&ep->urb_list)) { - urbl = list_first_entry(&ep->urb_list, - struct oz_urb_link, link); - urb = urbl->urb; - if ((ep->credit + 1) < urb->number_of_packets) - break; - ep->credit -= urb->number_of_packets; - if (ep->credit < 0) - ep->credit = 0; - list_move_tail(&urbl->link, &xfr_list); - } - } - spin_unlock_bh(&ozhcd->hcd_lock); - /* Send to PD and complete URBs. - */ - list_for_each_entry_safe(urbl, n, &xfr_list, link) { - urb = urbl->urb; - list_del_init(&urbl->link); - urb->error_count = 0; - urb->start_frame = oz_usb_get_frame_number(); - oz_usb_send_isoc(port->hpd, urbl->ep_num, urb); - oz_free_urb_link(urbl); - oz_complete_urb(port->ozhcd->hcd, urb, 0); - } - /* Check the IN isoc endpoints to see if any URBs can be completed. - */ - spin_lock_bh(&ozhcd->hcd_lock); - list_for_each_entry(ep, &port->isoc_in_ep, link) { - if (ep->flags & OZ_F_EP_BUFFERING) { - if (ep->buffered_units >= OZ_IN_BUFFERING_UNITS) { - ep->flags &= ~OZ_F_EP_BUFFERING; - ep->credit = 0; - ep->timestamp = ts; - ep->start_frame = 0; - } - continue; - } - delta = timespec_sub(ts, ep->timestamp); - ep->credit += div_u64(timespec_to_ns(&delta), NSEC_PER_MSEC); - ep->timestamp = ts; - list_for_each_entry_safe(urbl, n, &ep->urb_list, link) { - struct urb *urb = urbl->urb; - int len = 0; - int copy_len; - int i; - - if (ep->credit < urb->number_of_packets) - break; - if (ep->buffered_units < urb->number_of_packets) - break; - urb->actual_length = 0; - for (i = 0; i < urb->number_of_packets; i++) { - len = ep->buffer[ep->out_ix]; - if (++ep->out_ix == ep->buffer_size) - ep->out_ix = 0; - copy_len = ep->buffer_size - ep->out_ix; - if (copy_len > len) - copy_len = len; - memcpy(urb->transfer_buffer, - &ep->buffer[ep->out_ix], copy_len); - if (copy_len < len) { - memcpy(urb->transfer_buffer+copy_len, - ep->buffer, len-copy_len); - ep->out_ix = len-copy_len; - } else - ep->out_ix += copy_len; - if (ep->out_ix == ep->buffer_size) - ep->out_ix = 0; - urb->iso_frame_desc[i].offset = - urb->actual_length; - urb->actual_length += len; - urb->iso_frame_desc[i].actual_length = len; - urb->iso_frame_desc[i].status = 0; - } - ep->buffered_units -= urb->number_of_packets; - urb->error_count = 0; - urb->start_frame = ep->start_frame; - ep->start_frame += urb->number_of_packets; - list_move_tail(&urbl->link, &xfr_list); - ep->credit -= urb->number_of_packets; - } - } - if (!list_empty(&port->isoc_out_ep) || !list_empty(&port->isoc_in_ep)) - rc = 1; - spin_unlock_bh(&ozhcd->hcd_lock); - /* Complete the filled URBs. - */ - list_for_each_entry_safe(urbl, n, &xfr_list, link) { - urb = urbl->urb; - list_del_init(&urbl->link); - oz_free_urb_link(urbl); - oz_complete_urb(port->ozhcd->hcd, urb, 0); - } - /* Check if there are any ep0 requests that have timed out. - * If so resent to PD. - */ - ep = port->out_ep[0]; - if (ep) { - spin_lock_bh(&ozhcd->hcd_lock); - list_for_each_entry_safe(urbl, n, &ep->urb_list, link) { - if (urbl->submit_counter > EP0_TIMEOUT_COUNTER) { - oz_dbg(ON, "Request 0x%p timeout\n", urbl->urb); - list_move_tail(&urbl->link, &xfr_list); - urbl->submit_counter = 0; - } else { - urbl->submit_counter++; - } - } - if (!list_empty(&ep->urb_list)) - rc = 1; - spin_unlock_bh(&ozhcd->hcd_lock); - list_for_each_entry_safe(urbl, n, &xfr_list, link) { - oz_dbg(ON, "Resending request to PD\n"); - oz_process_ep0_urb(ozhcd, urbl->urb, GFP_ATOMIC); - oz_free_urb_link(urbl); - } - } - return rc; -} - -/* - * Context: softirq - */ -static int oz_build_endpoints_for_interface(struct usb_hcd *hcd, - struct oz_port *port, - struct usb_host_interface *intf, gfp_t mem_flags) -{ - struct oz_hcd *ozhcd = port->ozhcd; - int i; - int if_ix = intf->desc.bInterfaceNumber; - int request_heartbeat = 0; - - oz_dbg(ON, "interface[%d] = %p\n", if_ix, intf); - if (if_ix >= port->num_iface || port->iface == NULL) - return -ENOMEM; - for (i = 0; i < intf->desc.bNumEndpoints; i++) { - struct usb_host_endpoint *hep = &intf->endpoint[i]; - u8 ep_addr = hep->desc.bEndpointAddress; - u8 ep_num = ep_addr & USB_ENDPOINT_NUMBER_MASK; - struct oz_endpoint *ep; - int buffer_size = 0; - - oz_dbg(ON, "%d bEndpointAddress = %x\n", i, ep_addr); - if (ep_addr & USB_ENDPOINT_DIR_MASK) { - switch (hep->desc.bmAttributes & - USB_ENDPOINT_XFERTYPE_MASK) { - case USB_ENDPOINT_XFER_ISOC: - buffer_size = OZ_EP_BUFFER_SIZE_ISOC; - break; - case USB_ENDPOINT_XFER_INT: - buffer_size = OZ_EP_BUFFER_SIZE_INT; - break; - } - } - - ep = oz_ep_alloc(buffer_size, mem_flags); - if (!ep) { - oz_clean_endpoints_for_interface(hcd, port, if_ix); - return -ENOMEM; - } - ep->attrib = hep->desc.bmAttributes; - ep->ep_num = ep_num; - if ((ep->attrib & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_ISOC) { - oz_dbg(ON, "wMaxPacketSize = %d\n", - usb_endpoint_maxp(&hep->desc)); - ep->credit_ceiling = 200; - if (ep_addr & USB_ENDPOINT_DIR_MASK) { - ep->flags |= OZ_F_EP_BUFFERING; - } else { - ep->flags |= OZ_F_EP_HAVE_STREAM; - if (oz_usb_stream_create(port->hpd, ep_num)) - ep->flags &= ~OZ_F_EP_HAVE_STREAM; - } - } - spin_lock_bh(&ozhcd->hcd_lock); - if (ep_addr & USB_ENDPOINT_DIR_MASK) { - port->in_ep[ep_num] = ep; - port->iface[if_ix].ep_mask |= - (1<<(ep_num+OZ_NB_ENDPOINTS)); - if ((ep->attrib & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_ISOC) { - list_add_tail(&ep->link, &port->isoc_in_ep); - request_heartbeat = 1; - } - } else { - port->out_ep[ep_num] = ep; - port->iface[if_ix].ep_mask |= (1<attrib & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_ISOC) { - list_add_tail(&ep->link, &port->isoc_out_ep); - request_heartbeat = 1; - } - } - spin_unlock_bh(&ozhcd->hcd_lock); - if (request_heartbeat && port->hpd) - oz_usb_request_heartbeat(port->hpd); - } - return 0; -} - -/* - * Context: softirq - */ -static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd, - struct oz_port *port, int if_ix) -{ - struct oz_hcd *ozhcd = port->ozhcd; - unsigned mask; - int i; - LIST_HEAD(ep_list); - struct oz_endpoint *ep, *n; - - oz_dbg(ON, "Deleting endpoints for interface %d\n", if_ix); - if (if_ix >= port->num_iface) - return; - spin_lock_bh(&ozhcd->hcd_lock); - mask = port->iface[if_ix].ep_mask; - port->iface[if_ix].ep_mask = 0; - for (i = 0; i < OZ_NB_ENDPOINTS; i++) { - struct list_head *e; - /* Gather OUT endpoints. - */ - if ((mask & (1<out_ep[i]) { - e = &port->out_ep[i]->link; - port->out_ep[i] = NULL; - /* Remove from isoc list if present. - */ - list_move_tail(e, &ep_list); - } - /* Gather IN endpoints. - */ - if ((mask & (1<<(i+OZ_NB_ENDPOINTS))) && port->in_ep[i]) { - e = &port->in_ep[i]->link; - port->in_ep[i] = NULL; - list_move_tail(e, &ep_list); - } - } - spin_unlock_bh(&ozhcd->hcd_lock); - list_for_each_entry_safe(ep, n, &ep_list, link) { - list_del_init(&ep->link); - oz_ep_free(port, ep); - } -} - -/* - * Context: softirq - */ -static int oz_build_endpoints_for_config(struct usb_hcd *hcd, - struct oz_port *port, struct usb_host_config *config, - gfp_t mem_flags) -{ - struct oz_hcd *ozhcd = port->ozhcd; - int i; - int num_iface = config->desc.bNumInterfaces; - - if (num_iface) { - struct oz_interface *iface; - - iface = kmalloc_array(num_iface, sizeof(struct oz_interface), - mem_flags | __GFP_ZERO); - if (!iface) - return -ENOMEM; - spin_lock_bh(&ozhcd->hcd_lock); - port->iface = iface; - port->num_iface = num_iface; - spin_unlock_bh(&ozhcd->hcd_lock); - } - for (i = 0; i < num_iface; i++) { - struct usb_host_interface *intf = - &config->intf_cache[i]->altsetting[0]; - if (oz_build_endpoints_for_interface(hcd, port, intf, - mem_flags)) - goto fail; - } - return 0; -fail: - oz_clean_endpoints_for_config(hcd, port); - return -1; -} - -/* - * Context: softirq - */ -static void oz_clean_endpoints_for_config(struct usb_hcd *hcd, - struct oz_port *port) -{ - struct oz_hcd *ozhcd = port->ozhcd; - int i; - - oz_dbg(ON, "Deleting endpoints for configuration\n"); - for (i = 0; i < port->num_iface; i++) - oz_clean_endpoints_for_interface(hcd, port, i); - spin_lock_bh(&ozhcd->hcd_lock); - if (port->iface) { - oz_dbg(ON, "Freeing interfaces object\n"); - kfree(port->iface); - port->iface = NULL; - } - port->num_iface = 0; - spin_unlock_bh(&ozhcd->hcd_lock); -} - -/* - * Context: tasklet - */ -static void *oz_claim_hpd(struct oz_port *port) -{ - void *hpd; - struct oz_hcd *ozhcd = port->ozhcd; - - spin_lock_bh(&ozhcd->hcd_lock); - hpd = port->hpd; - if (hpd) - oz_usb_get(hpd); - spin_unlock_bh(&ozhcd->hcd_lock); - return hpd; -} - -/* - * Context: tasklet - */ -static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb, - gfp_t mem_flags) -{ - struct usb_ctrlrequest *setup; - unsigned windex; - unsigned wvalue; - unsigned wlength; - void *hpd; - u8 req_id; - int rc = 0; - unsigned complete = 0; - - int port_ix = -1; - struct oz_port *port = NULL; - - oz_dbg(URB, "[%s]:(%p)\n", __func__, urb); - port_ix = oz_get_port_from_addr(ozhcd, urb->dev->devnum); - if (port_ix < 0) { - rc = -EPIPE; - goto out; - } - port = &ozhcd->ports[port_ix]; - if (((port->flags & OZ_PORT_F_PRESENT) == 0) - || (port->flags & OZ_PORT_F_DYING)) { - oz_dbg(ON, "Refusing URB port_ix = %d devnum = %d\n", - port_ix, urb->dev->devnum); - rc = -EPIPE; - goto out; - } - /* Store port in private context data. - */ - urb->hcpriv = port; - setup = (struct usb_ctrlrequest *)urb->setup_packet; - windex = le16_to_cpu(setup->wIndex); - wvalue = le16_to_cpu(setup->wValue); - wlength = le16_to_cpu(setup->wLength); - oz_dbg(CTRL_DETAIL, "bRequestType = %x\n", setup->bRequestType); - oz_dbg(CTRL_DETAIL, "bRequest = %x\n", setup->bRequest); - oz_dbg(CTRL_DETAIL, "wValue = %x\n", wvalue); - oz_dbg(CTRL_DETAIL, "wIndex = %x\n", windex); - oz_dbg(CTRL_DETAIL, "wLength = %x\n", wlength); - - req_id = port->next_req_id++; - hpd = oz_claim_hpd(port); - if (hpd == NULL) { - oz_dbg(ON, "Cannot claim port\n"); - rc = -EPIPE; - goto out; - } - - if ((setup->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { - /* Standard requests - */ - switch (setup->bRequest) { - case USB_REQ_GET_DESCRIPTOR: - oz_dbg(ON, "USB_REQ_GET_DESCRIPTOR - req\n"); - break; - case USB_REQ_SET_ADDRESS: - oz_dbg(ON, "USB_REQ_SET_ADDRESS - req\n"); - oz_dbg(ON, "Port %d address is 0x%x\n", - ozhcd->conn_port, - (u8)le16_to_cpu(setup->wValue)); - spin_lock_bh(&ozhcd->hcd_lock); - if (ozhcd->conn_port >= 0) { - ozhcd->ports[ozhcd->conn_port].bus_addr = - (u8)le16_to_cpu(setup->wValue); - oz_dbg(ON, "Clearing conn_port\n"); - ozhcd->conn_port = -1; - } - spin_unlock_bh(&ozhcd->hcd_lock); - complete = 1; - break; - case USB_REQ_SET_CONFIGURATION: - oz_dbg(ON, "USB_REQ_SET_CONFIGURATION - req\n"); - break; - case USB_REQ_GET_CONFIGURATION: - /* We short circuit this case and reply directly since - * we have the selected configuration number cached. - */ - oz_dbg(ON, "USB_REQ_GET_CONFIGURATION - reply now\n"); - if (urb->transfer_buffer_length >= 1) { - urb->actual_length = 1; - *((u8 *)urb->transfer_buffer) = - port->config_num; - complete = 1; - } else { - rc = -EPIPE; - } - break; - case USB_REQ_GET_INTERFACE: - /* We short circuit this case and reply directly since - * we have the selected interface alternative cached. - */ - oz_dbg(ON, "USB_REQ_GET_INTERFACE - reply now\n"); - if (urb->transfer_buffer_length >= 1) { - urb->actual_length = 1; - *((u8 *)urb->transfer_buffer) = - port->iface[(u8)windex].alt; - oz_dbg(ON, "interface = %d alt = %d\n", - windex, port->iface[(u8)windex].alt); - complete = 1; - } else { - rc = -EPIPE; - } - break; - case USB_REQ_SET_INTERFACE: - oz_dbg(ON, "USB_REQ_SET_INTERFACE - req\n"); - break; - } - } - if (!rc && !complete) { - int data_len = 0; - - if ((setup->bRequestType & USB_DIR_IN) == 0) - data_len = wlength; - urb->actual_length = data_len; - if (oz_usb_control_req(port->hpd, req_id, setup, - urb->transfer_buffer, data_len)) { - rc = -ENOMEM; - } else { - /* Note: we are queuing the request after we have - * submitted it to be transmitted. If the request were - * to complete before we queued it then it would not - * be found in the queue. It seems impossible for - * this to happen but if it did the request would - * be resubmitted so the problem would hopefully - * resolve itself. Putting the request into the - * queue before it has been sent is worse since the - * urb could be cancelled while we are using it - * to build the request. - */ - if (oz_enqueue_ep_urb(port, 0, 0, urb, req_id)) - rc = -ENOMEM; - } - } - oz_usb_put(hpd); -out: - if (rc || complete) { - oz_dbg(ON, "Completing request locally\n"); - oz_complete_urb(ozhcd->hcd, urb, rc); - } else { - oz_usb_request_heartbeat(port->hpd); - } -} - -/* - * Context: tasklet - */ -static int oz_urb_process(struct oz_hcd *ozhcd, struct urb *urb) -{ - int rc = 0; - struct oz_port *port = urb->hcpriv; - u8 ep_addr; - - /* When we are paranoid we keep a list of urbs which we check against - * before handing one back. This is just for debugging during - * development and should be turned off in the released driver. - */ - oz_remember_urb(urb); - /* Check buffer is valid. - */ - if (!urb->transfer_buffer && urb->transfer_buffer_length) - return -EINVAL; - /* Check if there is a device at the port - refuse if not. - */ - if ((port->flags & OZ_PORT_F_PRESENT) == 0) - return -EPIPE; - ep_addr = usb_pipeendpoint(urb->pipe); - if (ep_addr) { - /* If the request is not for EP0 then queue it. - */ - if (oz_enqueue_ep_urb(port, ep_addr, usb_pipein(urb->pipe), - urb, 0)) - rc = -EPIPE; - } else { - oz_process_ep0_urb(ozhcd, urb, GFP_ATOMIC); - } - return rc; -} - -/* - * Context: tasklet - */ -static void oz_urb_process_tasklet(unsigned long unused) -{ - unsigned long irq_state; - struct urb *urb; - struct oz_hcd *ozhcd = oz_hcd_claim(); - struct oz_urb_link *urbl, *n; - int rc = 0; - - if (ozhcd == NULL) - return; - /* This is called from a tasklet so is in softirq context but the urb - * list is filled from any context so we need to lock - * appropriately while removing urbs. - */ - spin_lock_irqsave(&g_tasklet_lock, irq_state); - list_for_each_entry_safe(urbl, n, &ozhcd->urb_pending_list, link) { - list_del_init(&urbl->link); - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - urb = urbl->urb; - oz_free_urb_link(urbl); - rc = oz_urb_process(ozhcd, urb); - if (rc) - oz_complete_urb(ozhcd->hcd, urb, rc); - spin_lock_irqsave(&g_tasklet_lock, irq_state); - } - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - oz_hcd_put(ozhcd); -} - -/* - * This function searches for the urb in any of the lists it could be in. - * If it is found it is removed from the list and completed. If the urb is - * being processed then it won't be in a list so won't be found. However, the - * call to usb_hcd_check_unlink_urb() will set the value of the unlinked field - * to a non-zero value. When an attempt is made to put the urb back in a list - * the unlinked field will be checked and the urb will then be completed. - * Context: tasklet - */ -static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb) -{ - struct oz_urb_link *urbl = NULL; - struct list_head *e; - struct oz_hcd *ozhcd; - unsigned long irq_state; - u8 ix; - - if (port == NULL) { - oz_dbg(ON, "%s: ERROR: (%p) port is null\n", __func__, urb); - return; - } - ozhcd = port->ozhcd; - if (ozhcd == NULL) { - oz_dbg(ON, "%s; ERROR: (%p) ozhcd is null\n", __func__, urb); - return; - } - - /* Look in the tasklet queue. - */ - spin_lock_irqsave(&g_tasklet_lock, irq_state); - list_for_each(e, &ozhcd->urb_cancel_list) { - urbl = list_entry(e, struct oz_urb_link, link); - if (urb == urbl->urb) { - list_del_init(e); - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - goto out2; - } - } - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - urbl = NULL; - - /* Look in the orphanage. - */ - spin_lock_irqsave(&ozhcd->hcd_lock, irq_state); - list_for_each(e, &ozhcd->orphanage) { - urbl = list_entry(e, struct oz_urb_link, link); - if (urbl->urb == urb) { - list_del(e); - oz_dbg(ON, "Found urb in orphanage\n"); - goto out; - } - } - ix = (ep_num & 0xf); - urbl = NULL; - if ((ep_num & USB_DIR_IN) && ix) - urbl = oz_remove_urb(port->in_ep[ix], urb); - else - urbl = oz_remove_urb(port->out_ep[ix], urb); -out: - spin_unlock_irqrestore(&ozhcd->hcd_lock, irq_state); -out2: - if (urbl) { - urb->actual_length = 0; - oz_free_urb_link(urbl); - oz_complete_urb(ozhcd->hcd, urb, -EPIPE); - } -} - -/* - * Context: tasklet - */ -static void oz_urb_cancel_tasklet(unsigned long unused) -{ - unsigned long irq_state; - struct urb *urb; - struct oz_urb_link *urbl, *n; - struct oz_hcd *ozhcd = oz_hcd_claim(); - - if (ozhcd == NULL) - return; - spin_lock_irqsave(&g_tasklet_lock, irq_state); - list_for_each_entry_safe(urbl, n, &ozhcd->urb_cancel_list, link) { - list_del_init(&urbl->link); - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - urb = urbl->urb; - if (urb->unlinked) - oz_urb_cancel(urbl->port, urbl->ep_num, urb); - oz_free_urb_link(urbl); - spin_lock_irqsave(&g_tasklet_lock, irq_state); - } - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - oz_hcd_put(ozhcd); -} - -/* - * Context: unknown - */ -static void oz_hcd_clear_orphanage(struct oz_hcd *ozhcd, int status) -{ - if (ozhcd) { - struct oz_urb_link *urbl, *n; - - list_for_each_entry_safe(urbl, n, &ozhcd->orphanage, link) { - list_del(&urbl->link); - oz_complete_urb(ozhcd->hcd, urbl->urb, status); - oz_free_urb_link(urbl); - } - } -} - -/* - * Context: unknown - */ -static int oz_hcd_start(struct usb_hcd *hcd) -{ - hcd->power_budget = 200; - hcd->state = HC_STATE_RUNNING; - hcd->uses_new_polling = 1; - return 0; -} - -/* - * Context: unknown - */ -static void oz_hcd_stop(struct usb_hcd *hcd) -{ -} - -/* - * Context: unknown - */ -static void oz_hcd_shutdown(struct usb_hcd *hcd) -{ -} - -/* - * Called to queue an urb for the device. - * This function should return a non-zero error code if it fails the urb but - * should not call usb_hcd_giveback_urb(). - * Context: any - */ -static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, - gfp_t mem_flags) -{ - struct oz_hcd *ozhcd = oz_hcd_private(hcd); - int rc; - int port_ix; - struct oz_port *port; - unsigned long irq_state; - struct oz_urb_link *urbl; - - oz_dbg(URB, "%s: (%p)\n", __func__, urb); - if (unlikely(ozhcd == NULL)) { - oz_dbg(URB, "Refused urb(%p) not ozhcd\n", urb); - return -EPIPE; - } - if (unlikely(hcd->state != HC_STATE_RUNNING)) { - oz_dbg(URB, "Refused urb(%p) not running\n", urb); - return -EPIPE; - } - port_ix = oz_get_port_from_addr(ozhcd, urb->dev->devnum); - if (port_ix < 0) - return -EPIPE; - port = &ozhcd->ports[port_ix]; - if (port == NULL) - return -EPIPE; - if (!(port->flags & OZ_PORT_F_PRESENT) || - (port->flags & OZ_PORT_F_CHANGED)) { - oz_dbg(ON, "Refusing URB port_ix = %d devnum = %d\n", - port_ix, urb->dev->devnum); - return -EPIPE; - } - urb->hcpriv = port; - /* Put request in queue for processing by tasklet. - */ - urbl = oz_alloc_urb_link(); - if (unlikely(urbl == NULL)) - return -ENOMEM; - urbl->urb = urb; - spin_lock_irqsave(&g_tasklet_lock, irq_state); - rc = usb_hcd_link_urb_to_ep(hcd, urb); - if (unlikely(rc)) { - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - oz_free_urb_link(urbl); - return rc; - } - list_add_tail(&urbl->link, &ozhcd->urb_pending_list); - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - tasklet_schedule(&g_urb_process_tasklet); - atomic_inc(&g_pending_urbs); - return 0; -} - -/* - * Context: tasklet - */ -static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep, - struct urb *urb) -{ - struct oz_urb_link *urbl; - - if (unlikely(ep == NULL)) - return NULL; - - list_for_each_entry(urbl, &ep->urb_list, link) { - if (urbl->urb == urb) { - list_del_init(&urbl->link); - if (usb_pipeisoc(urb->pipe)) { - ep->credit -= urb->number_of_packets; - if (ep->credit < 0) - ep->credit = 0; - } - return urbl; - } - } - return NULL; -} - -/* - * Called to dequeue a previously submitted urb for the device. - * Context: any - */ -static int oz_hcd_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) -{ - struct oz_hcd *ozhcd = oz_hcd_private(hcd); - struct oz_urb_link *urbl; - int rc; - unsigned long irq_state; - - oz_dbg(URB, "%s: (%p)\n", __func__, urb); - urbl = oz_alloc_urb_link(); - if (unlikely(urbl == NULL)) - return -ENOMEM; - spin_lock_irqsave(&g_tasklet_lock, irq_state); - /* The following function checks the urb is still in the queue - * maintained by the core and that the unlinked field is zero. - * If both are true the function sets the unlinked field and returns - * zero. Otherwise it returns an error. - */ - rc = usb_hcd_check_unlink_urb(hcd, urb, status); - /* We have to check we haven't completed the urb or are about - * to complete it. When we do we set hcpriv to 0 so if this has - * already happened we don't put the urb in the cancel queue. - */ - if ((rc == 0) && urb->hcpriv) { - urbl->urb = urb; - urbl->port = (struct oz_port *)urb->hcpriv; - urbl->ep_num = usb_pipeendpoint(urb->pipe); - if (usb_pipein(urb->pipe)) - urbl->ep_num |= USB_DIR_IN; - list_add_tail(&urbl->link, &ozhcd->urb_cancel_list); - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - tasklet_schedule(&g_urb_cancel_tasklet); - } else { - spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - oz_free_urb_link(urbl); - } - return rc; -} - -/* - * Context: unknown - */ -static void oz_hcd_endpoint_disable(struct usb_hcd *hcd, - struct usb_host_endpoint *ep) -{ -} - -/* - * Context: unknown - */ -static void oz_hcd_endpoint_reset(struct usb_hcd *hcd, - struct usb_host_endpoint *ep) -{ -} - -/* - * Context: unknown - */ -static int oz_hcd_get_frame_number(struct usb_hcd *hcd) -{ - oz_dbg(ON, "oz_hcd_get_frame_number\n"); - return oz_usb_get_frame_number(); -} - -/* - * Context: softirq - * This is called as a consquence of us calling usb_hcd_poll_rh_status() and we - * always do that in softirq context. - */ -static int oz_hcd_hub_status_data(struct usb_hcd *hcd, char *buf) -{ - struct oz_hcd *ozhcd = oz_hcd_private(hcd); - int i; - - buf[0] = 0; - buf[1] = 0; - - spin_lock_bh(&ozhcd->hcd_lock); - for (i = 0; i < OZ_NB_PORTS; i++) { - if (ozhcd->ports[i].flags & OZ_PORT_F_CHANGED) { - oz_dbg(HUB, "Port %d changed\n", i); - ozhcd->ports[i].flags &= ~OZ_PORT_F_CHANGED; - if (i < 7) - buf[0] |= 1 << (i + 1); - else - buf[1] |= 1 << (i - 7); - } - } - spin_unlock_bh(&ozhcd->hcd_lock); - if (buf[0] != 0 || buf[1] != 0) - return 2; - return 0; -} - -/* - * Context: process - */ -static void oz_get_hub_descriptor(struct usb_hcd *hcd, - struct usb_hub_descriptor *desc) -{ - memset(desc, 0, sizeof(*desc)); - desc->bDescriptorType = 0x29; - desc->bDescLength = 9; - desc->wHubCharacteristics = cpu_to_le16(0x0001); - desc->bNbrPorts = OZ_NB_PORTS; -} - -/* - * Context: process - */ -static int oz_set_port_feature(struct usb_hcd *hcd, u16 wvalue, u16 windex) -{ - struct oz_port *port; - u8 port_id = (u8)windex; - struct oz_hcd *ozhcd = oz_hcd_private(hcd); - unsigned set_bits = 0; - unsigned clear_bits = 0; - - if ((port_id < 1) || (port_id > OZ_NB_PORTS)) - return -EPIPE; - port = &ozhcd->ports[port_id-1]; - switch (wvalue) { - case USB_PORT_FEAT_CONNECTION: - oz_dbg(HUB, "USB_PORT_FEAT_CONNECTION\n"); - break; - case USB_PORT_FEAT_ENABLE: - oz_dbg(HUB, "USB_PORT_FEAT_ENABLE\n"); - break; - case USB_PORT_FEAT_SUSPEND: - oz_dbg(HUB, "USB_PORT_FEAT_SUSPEND\n"); - break; - case USB_PORT_FEAT_OVER_CURRENT: - oz_dbg(HUB, "USB_PORT_FEAT_OVER_CURRENT\n"); - break; - case USB_PORT_FEAT_RESET: - oz_dbg(HUB, "USB_PORT_FEAT_RESET\n"); - set_bits = USB_PORT_STAT_ENABLE | (USB_PORT_STAT_C_RESET<<16); - clear_bits = USB_PORT_STAT_RESET; - ozhcd->ports[port_id-1].bus_addr = 0; - break; - case USB_PORT_FEAT_POWER: - oz_dbg(HUB, "USB_PORT_FEAT_POWER\n"); - set_bits |= USB_PORT_STAT_POWER; - break; - case USB_PORT_FEAT_LOWSPEED: - oz_dbg(HUB, "USB_PORT_FEAT_LOWSPEED\n"); - break; - case USB_PORT_FEAT_C_CONNECTION: - oz_dbg(HUB, "USB_PORT_FEAT_C_CONNECTION\n"); - break; - case USB_PORT_FEAT_C_ENABLE: - oz_dbg(HUB, "USB_PORT_FEAT_C_ENABLE\n"); - break; - case USB_PORT_FEAT_C_SUSPEND: - oz_dbg(HUB, "USB_PORT_FEAT_C_SUSPEND\n"); - break; - case USB_PORT_FEAT_C_OVER_CURRENT: - oz_dbg(HUB, "USB_PORT_FEAT_C_OVER_CURRENT\n"); - break; - case USB_PORT_FEAT_C_RESET: - oz_dbg(HUB, "USB_PORT_FEAT_C_RESET\n"); - break; - case USB_PORT_FEAT_TEST: - oz_dbg(HUB, "USB_PORT_FEAT_TEST\n"); - break; - case USB_PORT_FEAT_INDICATOR: - oz_dbg(HUB, "USB_PORT_FEAT_INDICATOR\n"); - break; - default: - oz_dbg(HUB, "Other %d\n", wvalue); - break; - } - if (set_bits || clear_bits) { - spin_lock_bh(&port->port_lock); - port->status &= ~clear_bits; - port->status |= set_bits; - spin_unlock_bh(&port->port_lock); - } - oz_dbg(HUB, "Port[%d] status = 0x%x\n", port_id, port->status); - return 0; -} - -/* - * Context: process - */ -static int oz_clear_port_feature(struct usb_hcd *hcd, u16 wvalue, u16 windex) -{ - struct oz_port *port; - u8 port_id = (u8)windex; - struct oz_hcd *ozhcd = oz_hcd_private(hcd); - unsigned clear_bits = 0; - - if ((port_id < 1) || (port_id > OZ_NB_PORTS)) - return -EPIPE; - port = &ozhcd->ports[port_id-1]; - switch (wvalue) { - case USB_PORT_FEAT_CONNECTION: - oz_dbg(HUB, "USB_PORT_FEAT_CONNECTION\n"); - break; - case USB_PORT_FEAT_ENABLE: - oz_dbg(HUB, "USB_PORT_FEAT_ENABLE\n"); - clear_bits = USB_PORT_STAT_ENABLE; - break; - case USB_PORT_FEAT_SUSPEND: - oz_dbg(HUB, "USB_PORT_FEAT_SUSPEND\n"); - break; - case USB_PORT_FEAT_OVER_CURRENT: - oz_dbg(HUB, "USB_PORT_FEAT_OVER_CURRENT\n"); - break; - case USB_PORT_FEAT_RESET: - oz_dbg(HUB, "USB_PORT_FEAT_RESET\n"); - break; - case USB_PORT_FEAT_POWER: - oz_dbg(HUB, "USB_PORT_FEAT_POWER\n"); - clear_bits |= USB_PORT_STAT_POWER; - break; - case USB_PORT_FEAT_LOWSPEED: - oz_dbg(HUB, "USB_PORT_FEAT_LOWSPEED\n"); - break; - case USB_PORT_FEAT_C_CONNECTION: - oz_dbg(HUB, "USB_PORT_FEAT_C_CONNECTION\n"); - clear_bits = USB_PORT_STAT_C_CONNECTION << 16; - break; - case USB_PORT_FEAT_C_ENABLE: - oz_dbg(HUB, "USB_PORT_FEAT_C_ENABLE\n"); - clear_bits = USB_PORT_STAT_C_ENABLE << 16; - break; - case USB_PORT_FEAT_C_SUSPEND: - oz_dbg(HUB, "USB_PORT_FEAT_C_SUSPEND\n"); - break; - case USB_PORT_FEAT_C_OVER_CURRENT: - oz_dbg(HUB, "USB_PORT_FEAT_C_OVER_CURRENT\n"); - break; - case USB_PORT_FEAT_C_RESET: - oz_dbg(HUB, "USB_PORT_FEAT_C_RESET\n"); - clear_bits = USB_PORT_FEAT_C_RESET << 16; - break; - case USB_PORT_FEAT_TEST: - oz_dbg(HUB, "USB_PORT_FEAT_TEST\n"); - break; - case USB_PORT_FEAT_INDICATOR: - oz_dbg(HUB, "USB_PORT_FEAT_INDICATOR\n"); - break; - default: - oz_dbg(HUB, "Other %d\n", wvalue); - break; - } - if (clear_bits) { - spin_lock_bh(&port->port_lock); - port->status &= ~clear_bits; - spin_unlock_bh(&port->port_lock); - } - oz_dbg(HUB, "Port[%d] status = 0x%x\n", - port_id, ozhcd->ports[port_id-1].status); - return 0; -} - -/* - * Context: process - */ -static int oz_get_port_status(struct usb_hcd *hcd, u16 windex, char *buf) -{ - struct oz_hcd *ozhcd; - u32 status; - - if ((windex < 1) || (windex > OZ_NB_PORTS)) - return -EPIPE; - ozhcd = oz_hcd_private(hcd); - oz_dbg(HUB, "GetPortStatus windex = %d\n", windex); - status = ozhcd->ports[windex-1].status; - put_unaligned(cpu_to_le32(status), (__le32 *)buf); - oz_dbg(HUB, "Port[%d] status = %x\n", windex, status); - return 0; -} - -/* - * Context: process - */ -static int oz_hcd_hub_control(struct usb_hcd *hcd, u16 req_type, u16 wvalue, - u16 windex, char *buf, u16 wlength) -{ - int err = 0; - - switch (req_type) { - case ClearHubFeature: - oz_dbg(HUB, "ClearHubFeature: %d\n", req_type); - break; - case ClearPortFeature: - err = oz_clear_port_feature(hcd, wvalue, windex); - break; - case GetHubDescriptor: - oz_get_hub_descriptor(hcd, (struct usb_hub_descriptor *)buf); - break; - case GetHubStatus: - oz_dbg(HUB, "GetHubStatus: req_type = 0x%x\n", req_type); - put_unaligned(cpu_to_le32(0), (__le32 *)buf); - break; - case GetPortStatus: - err = oz_get_port_status(hcd, windex, buf); - break; - case SetHubFeature: - oz_dbg(HUB, "SetHubFeature: %d\n", req_type); - break; - case SetPortFeature: - err = oz_set_port_feature(hcd, wvalue, windex); - break; - default: - oz_dbg(HUB, "Other: %d\n", req_type); - break; - } - return err; -} - -/* - * Context: process - */ -static int oz_hcd_bus_suspend(struct usb_hcd *hcd) -{ - struct oz_hcd *ozhcd; - - ozhcd = oz_hcd_private(hcd); - spin_lock_bh(&ozhcd->hcd_lock); - hcd->state = HC_STATE_SUSPENDED; - ozhcd->flags |= OZ_HDC_F_SUSPENDED; - spin_unlock_bh(&ozhcd->hcd_lock); - return 0; -} - -/* - * Context: process - */ -static int oz_hcd_bus_resume(struct usb_hcd *hcd) -{ - struct oz_hcd *ozhcd; - - ozhcd = oz_hcd_private(hcd); - spin_lock_bh(&ozhcd->hcd_lock); - ozhcd->flags &= ~OZ_HDC_F_SUSPENDED; - hcd->state = HC_STATE_RUNNING; - spin_unlock_bh(&ozhcd->hcd_lock); - return 0; -} - -static void oz_plat_shutdown(struct platform_device *dev) -{ -} - -/* - * Context: process - */ -static int oz_plat_probe(struct platform_device *dev) -{ - int i; - int err; - struct usb_hcd *hcd; - struct oz_hcd *ozhcd; - - hcd = usb_create_hcd(&g_oz_hc_drv, &dev->dev, dev_name(&dev->dev)); - if (hcd == NULL) { - oz_dbg(ON, "Failed to created hcd object OK\n"); - return -ENOMEM; - } - ozhcd = oz_hcd_private(hcd); - memset(ozhcd, 0, sizeof(*ozhcd)); - INIT_LIST_HEAD(&ozhcd->urb_pending_list); - INIT_LIST_HEAD(&ozhcd->urb_cancel_list); - INIT_LIST_HEAD(&ozhcd->orphanage); - ozhcd->hcd = hcd; - ozhcd->conn_port = -1; - spin_lock_init(&ozhcd->hcd_lock); - for (i = 0; i < OZ_NB_PORTS; i++) { - struct oz_port *port = &ozhcd->ports[i]; - - port->ozhcd = ozhcd; - port->flags = 0; - port->status = 0; - port->bus_addr = 0xff; - spin_lock_init(&port->port_lock); - } - err = usb_add_hcd(hcd, 0, 0); - if (err) { - oz_dbg(ON, "Failed to add hcd object OK\n"); - usb_put_hcd(hcd); - return -1; - } - device_wakeup_enable(hcd->self.controller); - - spin_lock_bh(&g_hcdlock); - g_ozhcd = ozhcd; - spin_unlock_bh(&g_hcdlock); - return 0; -} - -/* - * Context: unknown - */ -static int oz_plat_remove(struct platform_device *dev) -{ - struct usb_hcd *hcd = platform_get_drvdata(dev); - struct oz_hcd *ozhcd; - - if (hcd == NULL) - return -1; - ozhcd = oz_hcd_private(hcd); - spin_lock_bh(&g_hcdlock); - if (ozhcd == g_ozhcd) - g_ozhcd = NULL; - spin_unlock_bh(&g_hcdlock); - oz_dbg(ON, "Clearing orphanage\n"); - oz_hcd_clear_orphanage(ozhcd, -EPIPE); - oz_dbg(ON, "Removing hcd\n"); - usb_remove_hcd(hcd); - usb_put_hcd(hcd); - return 0; -} - -/* - * Context: unknown - */ -static int oz_plat_suspend(struct platform_device *dev, pm_message_t msg) -{ - return 0; -} - - -/* - * Context: unknown - */ -static int oz_plat_resume(struct platform_device *dev) -{ - return 0; -} - -/* - * Context: process - */ -int oz_hcd_init(void) -{ - int err; - - if (usb_disabled()) - return -ENODEV; - - oz_urb_link_cache = KMEM_CACHE(oz_urb_link, 0); - if (!oz_urb_link_cache) - return -ENOMEM; - - tasklet_init(&g_urb_process_tasklet, oz_urb_process_tasklet, 0); - tasklet_init(&g_urb_cancel_tasklet, oz_urb_cancel_tasklet, 0); - err = platform_driver_register(&g_oz_plat_drv); - oz_dbg(ON, "platform_driver_register() returned %d\n", err); - if (err) - goto error; - g_plat_dev = platform_device_alloc(OZ_PLAT_DEV_NAME, -1); - if (g_plat_dev == NULL) { - err = -ENOMEM; - goto error1; - } - oz_dbg(ON, "platform_device_alloc() succeeded\n"); - err = platform_device_add(g_plat_dev); - if (err) - goto error2; - oz_dbg(ON, "platform_device_add() succeeded\n"); - return 0; -error2: - platform_device_put(g_plat_dev); -error1: - platform_driver_unregister(&g_oz_plat_drv); -error: - tasklet_disable(&g_urb_process_tasklet); - tasklet_disable(&g_urb_cancel_tasklet); - oz_dbg(ON, "oz_hcd_init() failed %d\n", err); - return err; -} - -/* - * Context: process - */ -void oz_hcd_term(void) -{ - msleep(OZ_HUB_DEBOUNCE_TIMEOUT); - tasklet_kill(&g_urb_process_tasklet); - tasklet_kill(&g_urb_cancel_tasklet); - platform_device_unregister(g_plat_dev); - platform_driver_unregister(&g_oz_plat_drv); - oz_dbg(ON, "Pending urbs:%d\n", atomic_read(&g_pending_urbs)); - kmem_cache_destroy(oz_urb_link_cache); -} diff --git a/drivers/staging/ozwpan/ozhcd.h b/drivers/staging/ozwpan/ozhcd.h deleted file mode 100644 index 55e97b1c7079..000000000000 --- a/drivers/staging/ozwpan/ozhcd.h +++ /dev/null @@ -1,15 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ---------------------------------------------------------------------------*/ -#ifndef _OZHCD_H -#define _OZHCD_H - -int oz_hcd_init(void); -void oz_hcd_term(void); -struct oz_port *oz_hcd_pd_arrived(void *ctx); -void oz_hcd_pd_departed(struct oz_port *hport); -void oz_hcd_pd_reset(void *hpd, void *hport); - -#endif /* _OZHCD_H */ - diff --git a/drivers/staging/ozwpan/ozmain.c b/drivers/staging/ozwpan/ozmain.c deleted file mode 100644 index 74ef34815b98..000000000000 --- a/drivers/staging/ozwpan/ozmain.c +++ /dev/null @@ -1,71 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include "ozdbg.h" -#include "ozpd.h" -#include "ozproto.h" -#include "ozcdev.h" - -unsigned int oz_dbg_mask = OZ_DEFAULT_DBG_MASK; - -/* - * The name of the 802.11 mac device. Empty string is the default value but a - * value can be supplied as a parameter to the module. An empty string means - * bind to nothing. '*' means bind to all netcards - this includes non-802.11 - * netcards. Bindings can be added later using an IOCTL. - */ -static char *g_net_dev = ""; -module_param(g_net_dev, charp, S_IRUGO); -MODULE_PARM_DESC(g_net_dev, "The device(s) to bind to; " - "'*' means all, '' (empty string; default) means none."); - -/* - * Context: process - */ -static int __init ozwpan_init(void) -{ - int err; - - err = oz_cdev_register(); - if (err) - return err; - err = oz_protocol_init(g_net_dev); - if (err) - goto err_protocol; - oz_app_enable(OZ_APPID_USB, 1); - oz_apps_init(); - return 0; - -err_protocol: - oz_cdev_deregister(); - return err; -} - -/* - * Context: process - */ -static void __exit ozwpan_exit(void) -{ - oz_protocol_term(); - oz_apps_term(); - oz_cdev_deregister(); -} - -module_init(ozwpan_init); -module_exit(ozwpan_exit); - -MODULE_AUTHOR("Chris Kelly"); -MODULE_DESCRIPTION("Ozmo Devices USB over WiFi hcd driver"); -MODULE_VERSION("1.0.13"); -MODULE_LICENSE("GPL"); - diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c deleted file mode 100644 index 021d74a132dd..000000000000 --- a/drivers/staging/ozwpan/ozpd.c +++ /dev/null @@ -1,886 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include "ozdbg.h" -#include "ozprotocol.h" -#include "ozeltbuf.h" -#include "ozpd.h" -#include "ozproto.h" -#include "ozcdev.h" -#include "ozusbsvc.h" -#include -#include -#include - -static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd); -static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f); -static void oz_tx_isoc_free(struct oz_pd *pd, struct oz_tx_frame *f); -static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f); -static int oz_send_isoc_frame(struct oz_pd *pd); -static void oz_retire_frame(struct oz_pd *pd, struct oz_tx_frame *f); -static void oz_isoc_stream_free(struct oz_isoc_stream *st); -static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data); -static void oz_isoc_destructor(struct sk_buff *skb); - -/* - * Counts the uncompleted isoc frames submitted to netcard. - */ -static atomic_t g_submitted_isoc = ATOMIC_INIT(0); - -/* Application handler functions. - */ -static const struct oz_app_if g_app_if[OZ_NB_APPS] = { - [OZ_APPID_USB] = { - .init = oz_usb_init, - .term = oz_usb_term, - .start = oz_usb_start, - .stop = oz_usb_stop, - .rx = oz_usb_rx, - .heartbeat = oz_usb_heartbeat, - .farewell = oz_usb_farewell, - }, - [OZ_APPID_SERIAL] = { - .init = oz_cdev_init, - .term = oz_cdev_term, - .start = oz_cdev_start, - .stop = oz_cdev_stop, - .rx = oz_cdev_rx, - }, -}; - - -/* - * Context: softirq or process - */ -void oz_pd_set_state(struct oz_pd *pd, unsigned state) -{ - pd->state = state; - switch (state) { - case OZ_PD_S_IDLE: - oz_pd_dbg(pd, ON, "PD State: OZ_PD_S_IDLE\n"); - break; - case OZ_PD_S_CONNECTED: - oz_pd_dbg(pd, ON, "PD State: OZ_PD_S_CONNECTED\n"); - break; - case OZ_PD_S_STOPPED: - oz_pd_dbg(pd, ON, "PD State: OZ_PD_S_STOPPED\n"); - break; - case OZ_PD_S_SLEEP: - oz_pd_dbg(pd, ON, "PD State: OZ_PD_S_SLEEP\n"); - break; - } -} - -/* - * Context: softirq or process - */ -void oz_pd_get(struct oz_pd *pd) -{ - atomic_inc(&pd->ref_count); -} - -/* - * Context: softirq or process - */ -void oz_pd_put(struct oz_pd *pd) -{ - if (atomic_dec_and_test(&pd->ref_count)) - oz_pd_destroy(pd); -} - -/* - * Context: softirq-serialized - */ -struct oz_pd *oz_pd_alloc(const u8 *mac_addr) -{ - struct oz_pd *pd; - int i; - - pd = kzalloc(sizeof(struct oz_pd), GFP_ATOMIC); - if (!pd) - return NULL; - - atomic_set(&pd->ref_count, 2); - for (i = 0; i < OZ_NB_APPS; i++) - spin_lock_init(&pd->app_lock[i]); - pd->last_rx_pkt_num = 0xffffffff; - oz_pd_set_state(pd, OZ_PD_S_IDLE); - pd->max_tx_size = OZ_MAX_TX_SIZE; - ether_addr_copy(pd->mac_addr, mac_addr); - oz_elt_buf_init(&pd->elt_buff); - spin_lock_init(&pd->tx_frame_lock); - INIT_LIST_HEAD(&pd->tx_queue); - INIT_LIST_HEAD(&pd->farewell_list); - pd->last_sent_frame = &pd->tx_queue; - spin_lock_init(&pd->stream_lock); - INIT_LIST_HEAD(&pd->stream_list); - tasklet_init(&pd->heartbeat_tasklet, oz_pd_heartbeat_handler, - (unsigned long)pd); - tasklet_init(&pd->timeout_tasklet, oz_pd_timeout_handler, - (unsigned long)pd); - hrtimer_init(&pd->heartbeat, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - hrtimer_init(&pd->timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - pd->heartbeat.function = oz_pd_heartbeat_event; - pd->timeout.function = oz_pd_timeout_event; - - return pd; -} - -/* - * Context: softirq or process - */ -static void oz_pd_free(struct work_struct *work) -{ - struct list_head *e, *n; - struct oz_pd *pd; - - oz_pd_dbg(pd, ON, "Destroying PD\n"); - pd = container_of(work, struct oz_pd, workitem); - /*Disable timer tasklets*/ - tasklet_kill(&pd->heartbeat_tasklet); - tasklet_kill(&pd->timeout_tasklet); - - /* Free streams, queued tx frames and farewells. */ - - list_for_each_safe(e, n, &pd->stream_list) - oz_isoc_stream_free(list_entry(e, struct oz_isoc_stream, link)); - - list_for_each_safe(e, n, &pd->tx_queue) { - struct oz_tx_frame *f = list_entry(e, struct oz_tx_frame, link); - - if (f->skb != NULL) - kfree_skb(f->skb); - oz_retire_frame(pd, f); - } - - oz_elt_buf_term(&pd->elt_buff); - - list_for_each_safe(e, n, &pd->farewell_list) - kfree(list_entry(e, struct oz_farewell, link)); - - if (pd->net_dev) - dev_put(pd->net_dev); - kfree(pd); -} - -/* - * Context: softirq or Process - */ -void oz_pd_destroy(struct oz_pd *pd) -{ - if (hrtimer_active(&pd->timeout)) - hrtimer_cancel(&pd->timeout); - if (hrtimer_active(&pd->heartbeat)) - hrtimer_cancel(&pd->heartbeat); - - INIT_WORK(&pd->workitem, oz_pd_free); - if (!schedule_work(&pd->workitem)) - oz_pd_dbg(pd, ON, "failed to schedule workitem\n"); -} - -/* - * Context: softirq-serialized - */ -int oz_services_start(struct oz_pd *pd, u16 apps, int resume) -{ - int i, rc = 0; - - oz_pd_dbg(pd, ON, "%s: (0x%x) resume(%d)\n", __func__, apps, resume); - for (i = 0; i < OZ_NB_APPS; i++) { - if (g_app_if[i].start && (apps & (1 << i))) { - if (g_app_if[i].start(pd, resume)) { - rc = -1; - oz_pd_dbg(pd, ON, - "Unable to start service %d\n", i); - break; - } - spin_lock_bh(&g_polling_lock); - pd->total_apps |= (1 << i); - if (resume) - pd->paused_apps &= ~(1 << i); - spin_unlock_bh(&g_polling_lock); - } - } - return rc; -} - -/* - * Context: softirq or process - */ -void oz_services_stop(struct oz_pd *pd, u16 apps, int pause) -{ - int i; - - oz_pd_dbg(pd, ON, "%s: (0x%x) pause(%d)\n", __func__, apps, pause); - for (i = 0; i < OZ_NB_APPS; i++) { - if (g_app_if[i].stop && (apps & (1 << i))) { - spin_lock_bh(&g_polling_lock); - if (pause) { - pd->paused_apps |= (1 << i); - } else { - pd->total_apps &= ~(1 << i); - pd->paused_apps &= ~(1 << i); - } - spin_unlock_bh(&g_polling_lock); - g_app_if[i].stop(pd, pause); - } - } -} - -/* - * Context: softirq - */ -void oz_pd_heartbeat(struct oz_pd *pd, u16 apps) -{ - int i, more = 0; - - for (i = 0; i < OZ_NB_APPS; i++) { - if (g_app_if[i].heartbeat && (apps & (1 << i))) { - if (g_app_if[i].heartbeat(pd)) - more = 1; - } - } - if ((!more) && (hrtimer_active(&pd->heartbeat))) - hrtimer_cancel(&pd->heartbeat); - if (pd->mode & OZ_F_ISOC_ANYTIME) { - int count = 8; - - while (count-- && (oz_send_isoc_frame(pd) >= 0)) - ; - } -} - -/* - * Context: softirq or process - */ -void oz_pd_stop(struct oz_pd *pd) -{ - u16 stop_apps; - - oz_dbg(ON, "oz_pd_stop() State = 0x%x\n", pd->state); - oz_pd_indicate_farewells(pd); - spin_lock_bh(&g_polling_lock); - stop_apps = pd->total_apps; - pd->total_apps = 0; - pd->paused_apps = 0; - spin_unlock_bh(&g_polling_lock); - oz_services_stop(pd, stop_apps, 0); - spin_lock_bh(&g_polling_lock); - oz_pd_set_state(pd, OZ_PD_S_STOPPED); - /* Remove from PD list.*/ - list_del(&pd->link); - spin_unlock_bh(&g_polling_lock); - oz_dbg(ON, "pd ref count = %d\n", atomic_read(&pd->ref_count)); - oz_pd_put(pd); -} - -/* - * Context: softirq - */ -int oz_pd_sleep(struct oz_pd *pd) -{ - int do_stop = 0; - u16 stop_apps; - - spin_lock_bh(&g_polling_lock); - if (pd->state & (OZ_PD_S_SLEEP | OZ_PD_S_STOPPED)) { - spin_unlock_bh(&g_polling_lock); - return 0; - } - if (pd->keep_alive && pd->session_id) - oz_pd_set_state(pd, OZ_PD_S_SLEEP); - else - do_stop = 1; - - stop_apps = pd->total_apps; - spin_unlock_bh(&g_polling_lock); - if (do_stop) { - oz_pd_stop(pd); - } else { - oz_services_stop(pd, stop_apps, 1); - oz_timer_add(pd, OZ_TIMER_STOP, pd->keep_alive); - } - return do_stop; -} - -/* - * Context: softirq - */ -static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd) -{ - struct oz_tx_frame *f; - - f = kmem_cache_alloc(oz_tx_frame_cache, GFP_ATOMIC); - if (f) { - f->total_size = sizeof(struct oz_hdr); - INIT_LIST_HEAD(&f->link); - INIT_LIST_HEAD(&f->elt_list); - } - return f; -} - -/* - * Context: softirq or process - */ -static void oz_tx_isoc_free(struct oz_pd *pd, struct oz_tx_frame *f) -{ - pd->nb_queued_isoc_frames--; - list_del_init(&f->link); - - kmem_cache_free(oz_tx_frame_cache, f); - - oz_dbg(TX_FRAMES, "Releasing ISOC Frame isoc_nb= %d\n", - pd->nb_queued_isoc_frames); -} - -/* - * Context: softirq or process - */ -static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f) -{ - kmem_cache_free(oz_tx_frame_cache, f); -} - -/* - * Context: softirq-serialized - */ -static void oz_set_more_bit(struct sk_buff *skb) -{ - struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb); - - oz_hdr->control |= OZ_F_MORE_DATA; -} - -/* - * Context: softirq-serialized - */ -static void oz_set_last_pkt_nb(struct oz_pd *pd, struct sk_buff *skb) -{ - struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb); - - oz_hdr->last_pkt_num = pd->trigger_pkt_num & OZ_LAST_PN_MASK; -} - -/* - * Context: softirq - */ -int oz_prepare_frame(struct oz_pd *pd, int empty) -{ - struct oz_tx_frame *f; - - if ((pd->mode & OZ_MODE_MASK) != OZ_MODE_TRIGGERED) - return -1; - if (pd->nb_queued_frames >= OZ_MAX_QUEUED_FRAMES) - return -1; - if (!empty && !oz_are_elts_available(&pd->elt_buff)) - return -1; - f = oz_tx_frame_alloc(pd); - if (f == NULL) - return -1; - f->skb = NULL; - f->hdr.control = - (OZ_PROTOCOL_VERSION<last_tx_pkt_num; - put_unaligned(cpu_to_le32(pd->last_tx_pkt_num), &f->hdr.pkt_num); - if (empty == 0) { - oz_select_elts_for_tx(&pd->elt_buff, 0, &f->total_size, - pd->max_tx_size, &f->elt_list); - } - spin_lock(&pd->tx_frame_lock); - list_add_tail(&f->link, &pd->tx_queue); - pd->nb_queued_frames++; - spin_unlock(&pd->tx_frame_lock); - return 0; -} - -/* - * Context: softirq-serialized - */ -static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f) -{ - struct sk_buff *skb; - struct net_device *dev = pd->net_dev; - struct oz_hdr *oz_hdr; - struct oz_elt *elt; - struct oz_elt_info *ei; - - /* Allocate skb with enough space for the lower layers as well - * as the space we need. - */ - skb = alloc_skb(f->total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC); - if (skb == NULL) - return NULL; - /* Reserve the head room for lower layers. - */ - skb_reserve(skb, LL_RESERVED_SPACE(dev)); - skb_reset_network_header(skb); - skb->dev = dev; - skb->protocol = htons(OZ_ETHERTYPE); - if (dev_hard_header(skb, dev, OZ_ETHERTYPE, pd->mac_addr, - dev->dev_addr, skb->len) < 0) - goto fail; - /* Push the tail to the end of the area we are going to copy to. - */ - oz_hdr = (struct oz_hdr *)skb_put(skb, f->total_size); - f->hdr.last_pkt_num = pd->trigger_pkt_num & OZ_LAST_PN_MASK; - memcpy(oz_hdr, &f->hdr, sizeof(struct oz_hdr)); - /* Copy the elements into the frame body. - */ - elt = (struct oz_elt *)(oz_hdr+1); - list_for_each_entry(ei, &f->elt_list, link) { - memcpy(elt, ei->data, ei->length); - elt = oz_next_elt(elt); - } - return skb; -fail: - kfree_skb(skb); - return NULL; -} - -/* - * Context: softirq or process - */ -static void oz_retire_frame(struct oz_pd *pd, struct oz_tx_frame *f) -{ - struct oz_elt_info *ei, *n; - - list_for_each_entry_safe(ei, n, &f->elt_list, link) { - list_del_init(&ei->link); - if (ei->callback) - ei->callback(pd, ei->context); - spin_lock_bh(&pd->elt_buff.lock); - oz_elt_info_free(&pd->elt_buff, ei); - spin_unlock_bh(&pd->elt_buff.lock); - } - oz_tx_frame_free(pd, f); -} - -/* - * Context: softirq-serialized - */ -static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data) -{ - struct sk_buff *skb; - struct oz_tx_frame *f; - struct list_head *e; - - spin_lock(&pd->tx_frame_lock); - e = pd->last_sent_frame->next; - if (e == &pd->tx_queue) { - spin_unlock(&pd->tx_frame_lock); - return -1; - } - f = list_entry(e, struct oz_tx_frame, link); - - if (f->skb != NULL) { - skb = f->skb; - oz_tx_isoc_free(pd, f); - spin_unlock(&pd->tx_frame_lock); - if (more_data) - oz_set_more_bit(skb); - oz_set_last_pkt_nb(pd, skb); - if ((int)atomic_read(&g_submitted_isoc) < - OZ_MAX_SUBMITTED_ISOC) { - if (dev_queue_xmit(skb) < 0) { - oz_dbg(TX_FRAMES, "Dropping ISOC Frame\n"); - return -1; - } - atomic_inc(&g_submitted_isoc); - oz_dbg(TX_FRAMES, "Sending ISOC Frame, nb_isoc= %d\n", - pd->nb_queued_isoc_frames); - return 0; - } - kfree_skb(skb); - oz_dbg(TX_FRAMES, "Dropping ISOC Frame>\n"); - return -1; - } - - pd->last_sent_frame = e; - skb = oz_build_frame(pd, f); - spin_unlock(&pd->tx_frame_lock); - if (!skb) - return -1; - if (more_data) - oz_set_more_bit(skb); - oz_dbg(TX_FRAMES, "TX frame PN=0x%x\n", f->hdr.pkt_num); - if (dev_queue_xmit(skb) < 0) - return -1; - - return 0; -} - -/* - * Context: softirq-serialized - */ -void oz_send_queued_frames(struct oz_pd *pd, int backlog) -{ - while (oz_prepare_frame(pd, 0) >= 0) - backlog++; - - switch (pd->mode & (OZ_F_ISOC_NO_ELTS | OZ_F_ISOC_ANYTIME)) { - - case OZ_F_ISOC_NO_ELTS: { - backlog += pd->nb_queued_isoc_frames; - if (backlog <= 0) - goto out; - if (backlog > OZ_MAX_SUBMITTED_ISOC) - backlog = OZ_MAX_SUBMITTED_ISOC; - break; - } - case OZ_NO_ELTS_ANYTIME: { - if ((backlog <= 0) && (pd->isoc_sent == 0)) - goto out; - break; - } - default: { - if (backlog <= 0) - goto out; - break; - } - } - while (backlog--) { - if (oz_send_next_queued_frame(pd, backlog) < 0) - break; - } - return; - -out: oz_prepare_frame(pd, 1); - oz_send_next_queued_frame(pd, 0); -} - -/* - * Context: softirq - */ -static int oz_send_isoc_frame(struct oz_pd *pd) -{ - struct sk_buff *skb; - struct net_device *dev = pd->net_dev; - struct oz_hdr *oz_hdr; - struct oz_elt *elt; - struct oz_elt_info *ei; - LIST_HEAD(list); - int total_size = sizeof(struct oz_hdr); - - oz_select_elts_for_tx(&pd->elt_buff, 1, &total_size, - pd->max_tx_size, &list); - if (list_empty(&list)) - return 0; - skb = alloc_skb(total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC); - if (skb == NULL) { - oz_dbg(ON, "Cannot alloc skb\n"); - oz_elt_info_free_chain(&pd->elt_buff, &list); - return -1; - } - skb_reserve(skb, LL_RESERVED_SPACE(dev)); - skb_reset_network_header(skb); - skb->dev = dev; - skb->protocol = htons(OZ_ETHERTYPE); - if (dev_hard_header(skb, dev, OZ_ETHERTYPE, pd->mac_addr, - dev->dev_addr, skb->len) < 0) { - kfree_skb(skb); - return -1; - } - oz_hdr = (struct oz_hdr *)skb_put(skb, total_size); - oz_hdr->control = (OZ_PROTOCOL_VERSION<last_pkt_num = pd->trigger_pkt_num & OZ_LAST_PN_MASK; - elt = (struct oz_elt *)(oz_hdr+1); - - list_for_each_entry(ei, &list, link) { - memcpy(elt, ei->data, ei->length); - elt = oz_next_elt(elt); - } - dev_queue_xmit(skb); - oz_elt_info_free_chain(&pd->elt_buff, &list); - return 0; -} - -/* - * Context: softirq-serialized - */ -void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn) -{ - struct oz_tx_frame *f, *tmp = NULL; - u8 diff; - u32 pkt_num; - - LIST_HEAD(list); - - spin_lock(&pd->tx_frame_lock); - list_for_each_entry(f, &pd->tx_queue, link) { - pkt_num = le32_to_cpu(get_unaligned(&f->hdr.pkt_num)); - diff = (lpn - (pkt_num & OZ_LAST_PN_MASK)) & OZ_LAST_PN_MASK; - if ((diff > OZ_LAST_PN_HALF_CYCLE) || (pkt_num == 0)) - break; - oz_dbg(TX_FRAMES, "Releasing pkt_num= %u, nb= %d\n", - pkt_num, pd->nb_queued_frames); - tmp = f; - pd->nb_queued_frames--; - } - if (tmp) - list_cut_position(&list, &pd->tx_queue, &tmp->link); - pd->last_sent_frame = &pd->tx_queue; - spin_unlock(&pd->tx_frame_lock); - - list_for_each_entry_safe(f, tmp, &list, link) - oz_retire_frame(pd, f); -} - -/* - * Precondition: stream_lock must be held. - * Context: softirq - */ -static struct oz_isoc_stream *pd_stream_find(struct oz_pd *pd, u8 ep_num) -{ - struct oz_isoc_stream *st; - - list_for_each_entry(st, &pd->stream_list, link) { - if (st->ep_num == ep_num) - return st; - } - return NULL; -} - -/* - * Context: softirq - */ -int oz_isoc_stream_create(struct oz_pd *pd, u8 ep_num) -{ - struct oz_isoc_stream *st; - - st = kzalloc(sizeof(struct oz_isoc_stream), GFP_ATOMIC); - if (!st) - return -ENOMEM; - st->ep_num = ep_num; - spin_lock_bh(&pd->stream_lock); - if (!pd_stream_find(pd, ep_num)) { - list_add(&st->link, &pd->stream_list); - st = NULL; - } - spin_unlock_bh(&pd->stream_lock); - kfree(st); - return 0; -} - -/* - * Context: softirq or process - */ -static void oz_isoc_stream_free(struct oz_isoc_stream *st) -{ - kfree_skb(st->skb); - kfree(st); -} - -/* - * Context: softirq - */ -int oz_isoc_stream_delete(struct oz_pd *pd, u8 ep_num) -{ - struct oz_isoc_stream *st; - - spin_lock_bh(&pd->stream_lock); - st = pd_stream_find(pd, ep_num); - if (st) - list_del(&st->link); - spin_unlock_bh(&pd->stream_lock); - if (st) - oz_isoc_stream_free(st); - return 0; -} - -/* - * Context: any - */ -static void oz_isoc_destructor(struct sk_buff *skb) -{ - atomic_dec(&g_submitted_isoc); -} - -/* - * Context: softirq - */ -int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, const u8 *data, int len) -{ - struct net_device *dev = pd->net_dev; - struct oz_isoc_stream *st; - u8 nb_units = 0; - struct sk_buff *skb = NULL; - struct oz_hdr *oz_hdr = NULL; - int size = 0; - - spin_lock_bh(&pd->stream_lock); - st = pd_stream_find(pd, ep_num); - if (st) { - skb = st->skb; - st->skb = NULL; - nb_units = st->nb_units; - st->nb_units = 0; - oz_hdr = st->oz_hdr; - size = st->size; - } - spin_unlock_bh(&pd->stream_lock); - if (!st) - return 0; - if (!skb) { - /* Allocate enough space for max size frame. */ - skb = alloc_skb(pd->max_tx_size + OZ_ALLOCATED_SPACE(dev), - GFP_ATOMIC); - if (skb == NULL) - return 0; - /* Reserve the head room for lower layers. */ - skb_reserve(skb, LL_RESERVED_SPACE(dev)); - skb_reset_network_header(skb); - skb->dev = dev; - skb->protocol = htons(OZ_ETHERTYPE); - /* For audio packet set priority to AC_VO */ - skb->priority = 0x7; - size = sizeof(struct oz_hdr) + sizeof(struct oz_isoc_large); - oz_hdr = (struct oz_hdr *)skb_put(skb, size); - } - memcpy(skb_put(skb, len), data, len); - size += len; - if (++nb_units < pd->ms_per_isoc) { - spin_lock_bh(&pd->stream_lock); - st->skb = skb; - st->nb_units = nb_units; - st->oz_hdr = oz_hdr; - st->size = size; - spin_unlock_bh(&pd->stream_lock); - } else { - struct oz_hdr oz; - struct oz_isoc_large iso; - - spin_lock_bh(&pd->stream_lock); - iso.frame_number = st->frame_num; - st->frame_num += nb_units; - spin_unlock_bh(&pd->stream_lock); - oz.control = - (OZ_PROTOCOL_VERSION<trigger_pkt_num & OZ_LAST_PN_MASK; - oz.pkt_num = 0; - iso.endpoint = ep_num; - iso.format = OZ_DATA_F_ISOC_LARGE; - iso.ms_data = nb_units; - memcpy(oz_hdr, &oz, sizeof(oz)); - memcpy(oz_hdr+1, &iso, sizeof(iso)); - if (dev_hard_header(skb, dev, OZ_ETHERTYPE, pd->mac_addr, - dev->dev_addr, skb->len) < 0) - goto out; - - skb->destructor = oz_isoc_destructor; - /*Queue for Xmit if mode is not ANYTIME*/ - if (!(pd->mode & OZ_F_ISOC_ANYTIME)) { - struct oz_tx_frame *isoc_unit = NULL; - int nb = pd->nb_queued_isoc_frames; - - if (nb >= pd->isoc_latency) { - struct oz_tx_frame *f; - - oz_dbg(TX_FRAMES, "Dropping ISOC Unit nb= %d\n", - nb); - spin_lock(&pd->tx_frame_lock); - list_for_each_entry(f, &pd->tx_queue, link) { - if (f->skb != NULL) { - oz_tx_isoc_free(pd, f); - break; - } - } - spin_unlock(&pd->tx_frame_lock); - } - isoc_unit = oz_tx_frame_alloc(pd); - if (isoc_unit == NULL) - goto out; - isoc_unit->hdr = oz; - isoc_unit->skb = skb; - spin_lock_bh(&pd->tx_frame_lock); - list_add_tail(&isoc_unit->link, &pd->tx_queue); - pd->nb_queued_isoc_frames++; - spin_unlock_bh(&pd->tx_frame_lock); - oz_dbg(TX_FRAMES, - "Added ISOC Frame to Tx Queue isoc_nb= %d, nb= %d\n", - pd->nb_queued_isoc_frames, pd->nb_queued_frames); - return 0; - } - - /*In ANYTIME mode Xmit unit immediately*/ - if (atomic_read(&g_submitted_isoc) < OZ_MAX_SUBMITTED_ISOC) { - atomic_inc(&g_submitted_isoc); - if (dev_queue_xmit(skb) < 0) - return -1; - return 0; - } - -out: kfree_skb(skb); - return -1; - - } - return 0; -} - -/* - * Context: process - */ -void oz_apps_init(void) -{ - int i; - - for (i = 0; i < OZ_NB_APPS; i++) { - if (g_app_if[i].init) - g_app_if[i].init(); - } -} - -/* - * Context: process - */ -void oz_apps_term(void) -{ - int i; - - /* Terminate all the apps. */ - for (i = 0; i < OZ_NB_APPS; i++) { - if (g_app_if[i].term) - g_app_if[i].term(); - } -} - -/* - * Context: softirq-serialized - */ -void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt) -{ - if (app_id < OZ_NB_APPS && g_app_if[app_id].rx) - g_app_if[app_id].rx(pd, elt); -} - -/* - * Context: softirq or process - */ -void oz_pd_indicate_farewells(struct oz_pd *pd) -{ - struct oz_farewell *f; - const struct oz_app_if *ai = &g_app_if[OZ_APPID_USB]; - - while (1) { - spin_lock_bh(&g_polling_lock); - if (list_empty(&pd->farewell_list)) { - spin_unlock_bh(&g_polling_lock); - break; - } - f = list_first_entry(&pd->farewell_list, - struct oz_farewell, link); - list_del(&f->link); - spin_unlock_bh(&g_polling_lock); - if (ai->farewell) - ai->farewell(pd, f->ep_num, f->report, f->len); - kfree(f); - } -} diff --git a/drivers/staging/ozwpan/ozpd.h b/drivers/staging/ozwpan/ozpd.h deleted file mode 100644 index 212fab0d807a..000000000000 --- a/drivers/staging/ozwpan/ozpd.h +++ /dev/null @@ -1,134 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#ifndef _OZPD_H_ -#define _OZPD_H_ - -#include -#include "ozeltbuf.h" - -/* PD state - */ -#define OZ_PD_S_IDLE 0x1 -#define OZ_PD_S_CONNECTED 0x2 -#define OZ_PD_S_SLEEP 0x4 -#define OZ_PD_S_STOPPED 0x8 - -/* Timer event types. - */ -#define OZ_TIMER_TOUT 1 -#define OZ_TIMER_HEARTBEAT 2 -#define OZ_TIMER_STOP 3 - -/* - *External spinlock variable - */ -extern spinlock_t g_polling_lock; - -/* Data structure that hold information on a frame for transmisson. This is - * built when the frame is first transmitted and is used to rebuild the frame - * if a re-transmission is required. - */ -struct oz_tx_frame { - struct list_head link; - struct list_head elt_list; - struct oz_hdr hdr; - struct sk_buff *skb; - int total_size; -}; - -struct oz_isoc_stream { - struct list_head link; - u8 ep_num; - u8 frame_num; - u8 nb_units; - int size; - struct sk_buff *skb; - struct oz_hdr *oz_hdr; -}; - -struct oz_farewell { - struct list_head link; - u8 ep_num; - u8 index; - u8 len; - u8 report[0]; -}; - -/* Data structure that holds information on a specific peripheral device (PD). - */ -struct oz_pd { - struct list_head link; - atomic_t ref_count; - u8 mac_addr[ETH_ALEN]; - unsigned state; - unsigned state_flags; - unsigned send_flags; - u16 total_apps; - u16 paused_apps; - u8 session_id; - u8 param_rsp_status; - u8 pd_info; - u8 isoc_sent; - u32 last_rx_pkt_num; - u32 last_tx_pkt_num; - struct timespec last_rx_timestamp; - u32 trigger_pkt_num; - unsigned long pulse_time; - unsigned long pulse_period; - unsigned long presleep; - unsigned long keep_alive; - struct oz_elt_buf elt_buff; - void *app_ctx[OZ_NB_APPS]; - spinlock_t app_lock[OZ_NB_APPS]; - int max_tx_size; - u8 mode; - u8 ms_per_isoc; - unsigned isoc_latency; - unsigned max_stream_buffering; - int nb_queued_frames; - int nb_queued_isoc_frames; - spinlock_t tx_frame_lock; - struct list_head *last_sent_frame; - struct list_head tx_queue; - struct list_head farewell_list; - spinlock_t stream_lock; - struct list_head stream_list; - struct net_device *net_dev; - struct hrtimer heartbeat; - struct hrtimer timeout; - u8 timeout_type; - struct tasklet_struct heartbeat_tasklet; - struct tasklet_struct timeout_tasklet; - struct work_struct workitem; -}; - -#define OZ_MAX_QUEUED_FRAMES 4 - -struct oz_pd *oz_pd_alloc(const u8 *mac_addr); -void oz_pd_destroy(struct oz_pd *pd); -void oz_pd_get(struct oz_pd *pd); -void oz_pd_put(struct oz_pd *pd); -void oz_pd_set_state(struct oz_pd *pd, unsigned state); -void oz_pd_indicate_farewells(struct oz_pd *pd); -int oz_pd_sleep(struct oz_pd *pd); -void oz_pd_stop(struct oz_pd *pd); -void oz_pd_heartbeat(struct oz_pd *pd, u16 apps); -int oz_services_start(struct oz_pd *pd, u16 apps, int resume); -void oz_services_stop(struct oz_pd *pd, u16 apps, int pause); -int oz_prepare_frame(struct oz_pd *pd, int empty); -void oz_send_queued_frames(struct oz_pd *pd, int backlog); -void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn); -int oz_isoc_stream_create(struct oz_pd *pd, u8 ep_num); -int oz_isoc_stream_delete(struct oz_pd *pd, u8 ep_num); -int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, const u8 *data, int len); -void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt); -void oz_apps_init(void); -void oz_apps_term(void); - -extern struct kmem_cache *oz_elt_info_cache; -extern struct kmem_cache *oz_tx_frame_cache; - -#endif /* Sentry */ diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c deleted file mode 100644 index 1ba24a2aef83..000000000000 --- a/drivers/staging/ozwpan/ozproto.c +++ /dev/null @@ -1,813 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "ozdbg.h" -#include "ozprotocol.h" -#include "ozeltbuf.h" -#include "ozpd.h" -#include "ozproto.h" -#include "ozusbsvc.h" - -#include "ozappif.h" -#include -#include -#include - -#define OZ_CF_CONN_SUCCESS 1 -#define OZ_CF_CONN_FAILURE 2 - -#define OZ_DO_STOP 1 -#define OZ_DO_SLEEP 2 - -struct oz_binding { - struct packet_type ptype; - char name[OZ_MAX_BINDING_LEN]; - struct list_head link; -}; - -/* - * External variable - */ - -DEFINE_SPINLOCK(g_polling_lock); -/* - * Static external variables. - */ -static LIST_HEAD(g_pd_list); -static LIST_HEAD(g_binding); -static DEFINE_SPINLOCK(g_binding_lock); -static struct sk_buff_head g_rx_queue; -static u8 g_session_id; -static u16 g_apps = 0x1; -static int g_processing_rx; - -struct kmem_cache *oz_elt_info_cache; -struct kmem_cache *oz_tx_frame_cache; - -/* - * Context: softirq-serialized - */ -static u8 oz_get_new_session_id(u8 exclude) -{ - if (++g_session_id == 0) - g_session_id = 1; - if (g_session_id == exclude) { - if (++g_session_id == 0) - g_session_id = 1; - } - return g_session_id; -} - -/* - * Context: softirq-serialized - */ -static void oz_send_conn_rsp(struct oz_pd *pd, u8 status) -{ - struct sk_buff *skb; - struct net_device *dev = pd->net_dev; - struct oz_hdr *oz_hdr; - struct oz_elt *elt; - struct oz_elt_connect_rsp *body; - - int sz = sizeof(struct oz_hdr) + sizeof(struct oz_elt) + - sizeof(struct oz_elt_connect_rsp); - skb = alloc_skb(sz + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC); - if (skb == NULL) - return; - skb_reserve(skb, LL_RESERVED_SPACE(dev)); - skb_reset_network_header(skb); - oz_hdr = (struct oz_hdr *)skb_put(skb, sz); - elt = (struct oz_elt *)(oz_hdr+1); - body = (struct oz_elt_connect_rsp *)(elt+1); - skb->dev = dev; - skb->protocol = htons(OZ_ETHERTYPE); - /* Fill in device header */ - if (dev_hard_header(skb, dev, OZ_ETHERTYPE, pd->mac_addr, - dev->dev_addr, skb->len) < 0) { - kfree_skb(skb); - return; - } - oz_hdr->control = OZ_PROTOCOL_VERSION<last_pkt_num = 0; - put_unaligned(0, &oz_hdr->pkt_num); - elt->type = OZ_ELT_CONNECT_RSP; - elt->length = sizeof(struct oz_elt_connect_rsp); - memset(body, 0, sizeof(struct oz_elt_connect_rsp)); - body->status = status; - if (status == 0) { - body->mode = pd->mode; - body->session_id = pd->session_id; - put_unaligned(cpu_to_le16(pd->total_apps), &body->apps); - } - oz_dbg(ON, "TX: OZ_ELT_CONNECT_RSP %d", status); - dev_queue_xmit(skb); -} - -/* - * Context: softirq-serialized - */ -static void pd_set_keepalive(struct oz_pd *pd, u8 kalive) -{ - unsigned long keep_alive = kalive & OZ_KALIVE_VALUE_MASK; - - switch (kalive & OZ_KALIVE_TYPE_MASK) { - case OZ_KALIVE_SPECIAL: - pd->keep_alive = keep_alive * 1000*60*60*24*20; - break; - case OZ_KALIVE_SECS: - pd->keep_alive = keep_alive*1000; - break; - case OZ_KALIVE_MINS: - pd->keep_alive = keep_alive*1000*60; - break; - case OZ_KALIVE_HOURS: - pd->keep_alive = keep_alive*1000*60*60; - break; - default: - pd->keep_alive = 0; - } - oz_dbg(ON, "Keepalive = %lu mSec\n", pd->keep_alive); -} - -/* - * Context: softirq-serialized - */ -static void pd_set_presleep(struct oz_pd *pd, u8 presleep, u8 start_timer) -{ - if (presleep) - pd->presleep = presleep*100; - else - pd->presleep = OZ_PRESLEEP_TOUT; - if (start_timer) { - spin_unlock(&g_polling_lock); - oz_timer_add(pd, OZ_TIMER_TOUT, pd->presleep); - spin_lock(&g_polling_lock); - } - oz_dbg(ON, "Presleep time = %lu mSec\n", pd->presleep); -} - -/* - * Context: softirq-serialized - */ -static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt, - const u8 *pd_addr, struct net_device *net_dev) -{ - struct oz_pd *pd; - struct oz_elt_connect_req *body = - (struct oz_elt_connect_req *)(elt+1); - u8 rsp_status = OZ_STATUS_SUCCESS; - u8 stop_needed = 0; - u16 new_apps = g_apps; - struct net_device *old_net_dev = NULL; - struct oz_pd *free_pd = NULL; - - if (cur_pd) { - pd = cur_pd; - spin_lock_bh(&g_polling_lock); - } else { - struct oz_pd *pd2 = NULL; - struct list_head *e; - - pd = oz_pd_alloc(pd_addr); - if (pd == NULL) - return NULL; - getnstimeofday(&pd->last_rx_timestamp); - spin_lock_bh(&g_polling_lock); - list_for_each(e, &g_pd_list) { - pd2 = list_entry(e, struct oz_pd, link); - if (ether_addr_equal(pd2->mac_addr, pd_addr)) { - free_pd = pd; - pd = pd2; - break; - } - } - if (pd != pd2) - list_add_tail(&pd->link, &g_pd_list); - } - if (pd == NULL) { - spin_unlock_bh(&g_polling_lock); - return NULL; - } - if (pd->net_dev != net_dev) { - old_net_dev = pd->net_dev; - dev_hold(net_dev); - pd->net_dev = net_dev; - } - oz_dbg(ON, "Host vendor: %d\n", body->host_vendor); - pd->max_tx_size = OZ_MAX_TX_SIZE; - pd->mode = body->mode; - pd->pd_info = body->pd_info; - if (pd->mode & OZ_F_ISOC_NO_ELTS) { - pd->ms_per_isoc = body->ms_per_isoc; - if (!pd->ms_per_isoc) - pd->ms_per_isoc = 4; - - switch (body->ms_isoc_latency & OZ_LATENCY_MASK) { - case OZ_ONE_MS_LATENCY: - pd->isoc_latency = (body->ms_isoc_latency & - ~OZ_LATENCY_MASK) / pd->ms_per_isoc; - break; - case OZ_TEN_MS_LATENCY: - pd->isoc_latency = ((body->ms_isoc_latency & - ~OZ_LATENCY_MASK) * 10) / pd->ms_per_isoc; - break; - default: - pd->isoc_latency = OZ_MAX_TX_QUEUE_ISOC; - } - } - if (body->max_len_div16) - pd->max_tx_size = ((u16)body->max_len_div16)<<4; - oz_dbg(ON, "Max frame:%u Ms per isoc:%u\n", - pd->max_tx_size, pd->ms_per_isoc); - pd->max_stream_buffering = 3*1024; - pd->pulse_period = OZ_QUANTUM; - pd_set_presleep(pd, body->presleep, 0); - pd_set_keepalive(pd, body->keep_alive); - - new_apps &= le16_to_cpu(get_unaligned(&body->apps)); - if ((new_apps & 0x1) && (body->session_id)) { - if (pd->session_id) { - if (pd->session_id != body->session_id) { - rsp_status = OZ_STATUS_SESSION_MISMATCH; - goto done; - } - } else { - new_apps &= ~0x1; /* Resume not permitted */ - pd->session_id = - oz_get_new_session_id(body->session_id); - } - } else { - if (pd->session_id && !body->session_id) { - rsp_status = OZ_STATUS_SESSION_TEARDOWN; - stop_needed = 1; - } else { - new_apps &= ~0x1; /* Resume not permitted */ - pd->session_id = - oz_get_new_session_id(body->session_id); - } - } -done: - if (rsp_status == OZ_STATUS_SUCCESS) { - u16 start_apps = new_apps & ~pd->total_apps & ~0x1; - u16 stop_apps = pd->total_apps & ~new_apps & ~0x1; - u16 resume_apps = new_apps & pd->paused_apps & ~0x1; - - spin_unlock_bh(&g_polling_lock); - oz_pd_set_state(pd, OZ_PD_S_CONNECTED); - oz_dbg(ON, "new_apps=0x%x total_apps=0x%x paused_apps=0x%x\n", - new_apps, pd->total_apps, pd->paused_apps); - if (start_apps) { - if (oz_services_start(pd, start_apps, 0)) - rsp_status = OZ_STATUS_TOO_MANY_PDS; - } - if (resume_apps) - if (oz_services_start(pd, resume_apps, 1)) - rsp_status = OZ_STATUS_TOO_MANY_PDS; - if (stop_apps) - oz_services_stop(pd, stop_apps, 0); - oz_pd_request_heartbeat(pd); - } else { - spin_unlock_bh(&g_polling_lock); - } - oz_send_conn_rsp(pd, rsp_status); - if (rsp_status != OZ_STATUS_SUCCESS) { - if (stop_needed) - oz_pd_stop(pd); - oz_pd_put(pd); - pd = NULL; - } - if (old_net_dev) - dev_put(old_net_dev); - if (free_pd) - oz_pd_destroy(free_pd); - return pd; -} - -/* - * Context: softirq-serialized - */ -static void oz_add_farewell(struct oz_pd *pd, u8 ep_num, u8 index, - const u8 *report, u8 len) -{ - struct oz_farewell *f; - struct oz_farewell *f2; - int found = 0; - - f = kmalloc(sizeof(struct oz_farewell) + len, GFP_ATOMIC); - if (!f) - return; - f->ep_num = ep_num; - f->index = index; - f->len = len; - memcpy(f->report, report, len); - oz_dbg(ON, "RX: Adding farewell report\n"); - spin_lock(&g_polling_lock); - list_for_each_entry(f2, &pd->farewell_list, link) { - if ((f2->ep_num == ep_num) && (f2->index == index)) { - found = 1; - list_del(&f2->link); - break; - } - } - list_add_tail(&f->link, &pd->farewell_list); - spin_unlock(&g_polling_lock); - if (found) - kfree(f2); -} - -/* - * Context: softirq-serialized - */ -static void oz_rx_frame(struct sk_buff *skb) -{ - u8 *mac_hdr; - u8 *src_addr; - struct oz_elt *elt; - int length; - struct oz_pd *pd = NULL; - struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb); - struct timespec current_time; - int dup = 0; - u32 pkt_num; - - oz_dbg(RX_FRAMES, "RX frame PN=0x%x LPN=0x%x control=0x%x\n", - oz_hdr->pkt_num, oz_hdr->last_pkt_num, oz_hdr->control); - mac_hdr = skb_mac_header(skb); - src_addr = &mac_hdr[ETH_ALEN]; - length = skb->len; - - /* Check the version field */ - if (oz_get_prot_ver(oz_hdr->control) != OZ_PROTOCOL_VERSION) { - oz_dbg(ON, "Incorrect protocol version: %d\n", - oz_get_prot_ver(oz_hdr->control)); - goto done; - } - - pkt_num = le32_to_cpu(get_unaligned(&oz_hdr->pkt_num)); - - pd = oz_pd_find(src_addr); - if (pd) { - if (!(pd->state & OZ_PD_S_CONNECTED)) - oz_pd_set_state(pd, OZ_PD_S_CONNECTED); - getnstimeofday(¤t_time); - if ((current_time.tv_sec != pd->last_rx_timestamp.tv_sec) || - (pd->presleep < MSEC_PER_SEC)) { - oz_timer_add(pd, OZ_TIMER_TOUT, pd->presleep); - pd->last_rx_timestamp = current_time; - } - if (pkt_num != pd->last_rx_pkt_num) { - pd->last_rx_pkt_num = pkt_num; - } else { - dup = 1; - oz_dbg(ON, "Duplicate frame\n"); - } - } - - if (pd && !dup && ((pd->mode & OZ_MODE_MASK) == OZ_MODE_TRIGGERED)) { - oz_dbg(RX_FRAMES, "Received TRIGGER Frame\n"); - pd->last_sent_frame = &pd->tx_queue; - if (oz_hdr->control & OZ_F_ACK) { - /* Retire completed frames */ - oz_retire_tx_frames(pd, oz_hdr->last_pkt_num); - } - if ((oz_hdr->control & OZ_F_ACK_REQUESTED) && - (pd->state == OZ_PD_S_CONNECTED)) { - int backlog = pd->nb_queued_frames; - - pd->trigger_pkt_num = pkt_num; - /* Send queued frames */ - oz_send_queued_frames(pd, backlog); - } - } - - length -= sizeof(struct oz_hdr); - elt = (struct oz_elt *)((u8 *)oz_hdr + sizeof(struct oz_hdr)); - - while (length >= sizeof(struct oz_elt)) { - length -= sizeof(struct oz_elt) + elt->length; - if (length < 0) - break; - switch (elt->type) { - case OZ_ELT_CONNECT_REQ: - oz_dbg(ON, "RX: OZ_ELT_CONNECT_REQ\n"); - pd = oz_connect_req(pd, elt, src_addr, skb->dev); - break; - case OZ_ELT_DISCONNECT: - oz_dbg(ON, "RX: OZ_ELT_DISCONNECT\n"); - if (pd) - oz_pd_sleep(pd); - break; - case OZ_ELT_UPDATE_PARAM_REQ: { - struct oz_elt_update_param *body = - (struct oz_elt_update_param *)(elt + 1); - oz_dbg(ON, "RX: OZ_ELT_UPDATE_PARAM_REQ\n"); - if (pd && (pd->state & OZ_PD_S_CONNECTED)) { - spin_lock(&g_polling_lock); - pd_set_keepalive(pd, body->keepalive); - pd_set_presleep(pd, body->presleep, 1); - spin_unlock(&g_polling_lock); - } - } - break; - case OZ_ELT_FAREWELL_REQ: { - struct oz_elt_farewell *body = - (struct oz_elt_farewell *)(elt + 1); - oz_dbg(ON, "RX: OZ_ELT_FAREWELL_REQ\n"); - oz_add_farewell(pd, body->ep_num, - body->index, body->report, - elt->length + 1 - sizeof(*body)); - } - break; - case OZ_ELT_APP_DATA: - if (pd && (pd->state & OZ_PD_S_CONNECTED)) { - struct oz_app_hdr *app_hdr = - (struct oz_app_hdr *)(elt+1); - if (dup) - break; - oz_handle_app_elt(pd, app_hdr->app_id, elt); - } - break; - default: - oz_dbg(ON, "RX: Unknown elt %02x\n", elt->type); - } - elt = oz_next_elt(elt); - } -done: - if (pd) - oz_pd_put(pd); - consume_skb(skb); -} - -/* - * Context: process - */ -void oz_protocol_term(void) -{ - struct oz_binding *b, *t; - - /* Walk the list of bindings and remove each one. - */ - spin_lock_bh(&g_binding_lock); - list_for_each_entry_safe(b, t, &g_binding, link) { - list_del(&b->link); - spin_unlock_bh(&g_binding_lock); - dev_remove_pack(&b->ptype); - if (b->ptype.dev) - dev_put(b->ptype.dev); - kfree(b); - spin_lock_bh(&g_binding_lock); - } - spin_unlock_bh(&g_binding_lock); - /* Walk the list of PDs and stop each one. This causes the PD to be - * removed from the list so we can just pull each one from the head - * of the list. - */ - spin_lock_bh(&g_polling_lock); - while (!list_empty(&g_pd_list)) { - struct oz_pd *pd = - list_first_entry(&g_pd_list, struct oz_pd, link); - oz_pd_get(pd); - spin_unlock_bh(&g_polling_lock); - oz_pd_stop(pd); - oz_pd_put(pd); - spin_lock_bh(&g_polling_lock); - } - spin_unlock_bh(&g_polling_lock); - oz_dbg(ON, "Protocol stopped\n"); - - kmem_cache_destroy(oz_tx_frame_cache); - kmem_cache_destroy(oz_elt_info_cache); -} - -/* - * Context: softirq - */ -void oz_pd_heartbeat_handler(unsigned long data) -{ - struct oz_pd *pd = (struct oz_pd *)data; - u16 apps = 0; - - spin_lock_bh(&g_polling_lock); - if (pd->state & OZ_PD_S_CONNECTED) - apps = pd->total_apps; - spin_unlock_bh(&g_polling_lock); - if (apps) - oz_pd_heartbeat(pd, apps); - oz_pd_put(pd); -} - -/* - * Context: softirq - */ -void oz_pd_timeout_handler(unsigned long data) -{ - int type; - struct oz_pd *pd = (struct oz_pd *)data; - - spin_lock_bh(&g_polling_lock); - type = pd->timeout_type; - spin_unlock_bh(&g_polling_lock); - switch (type) { - case OZ_TIMER_TOUT: - oz_pd_sleep(pd); - break; - case OZ_TIMER_STOP: - oz_pd_stop(pd); - break; - } - oz_pd_put(pd); -} - -/* - * Context: Interrupt - */ -enum hrtimer_restart oz_pd_heartbeat_event(struct hrtimer *timer) -{ - struct oz_pd *pd; - - pd = container_of(timer, struct oz_pd, heartbeat); - hrtimer_forward_now(timer, ktime_set(pd->pulse_period / - MSEC_PER_SEC, (pd->pulse_period % MSEC_PER_SEC) * NSEC_PER_MSEC)); - oz_pd_get(pd); - tasklet_schedule(&pd->heartbeat_tasklet); - return HRTIMER_RESTART; -} - -/* - * Context: Interrupt - */ -enum hrtimer_restart oz_pd_timeout_event(struct hrtimer *timer) -{ - struct oz_pd *pd; - - pd = container_of(timer, struct oz_pd, timeout); - oz_pd_get(pd); - tasklet_schedule(&pd->timeout_tasklet); - return HRTIMER_NORESTART; -} - -/* - * Context: softirq or process - */ -void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time) -{ - spin_lock_bh(&g_polling_lock); - switch (type) { - case OZ_TIMER_TOUT: - case OZ_TIMER_STOP: - if (hrtimer_active(&pd->timeout)) { - hrtimer_set_expires(&pd->timeout, ktime_set(due_time / - MSEC_PER_SEC, (due_time % MSEC_PER_SEC) * - NSEC_PER_MSEC)); - hrtimer_start_expires(&pd->timeout, HRTIMER_MODE_REL); - } else { - hrtimer_start(&pd->timeout, ktime_set(due_time / - MSEC_PER_SEC, (due_time % MSEC_PER_SEC) * - NSEC_PER_MSEC), HRTIMER_MODE_REL); - } - pd->timeout_type = type; - break; - case OZ_TIMER_HEARTBEAT: - if (!hrtimer_active(&pd->heartbeat)) - hrtimer_start(&pd->heartbeat, ktime_set(due_time / - MSEC_PER_SEC, (due_time % MSEC_PER_SEC) * - NSEC_PER_MSEC), HRTIMER_MODE_REL); - break; - } - spin_unlock_bh(&g_polling_lock); -} - -/* - * Context: softirq or process - */ -void oz_pd_request_heartbeat(struct oz_pd *pd) -{ - oz_timer_add(pd, OZ_TIMER_HEARTBEAT, pd->pulse_period > 0 ? - pd->pulse_period : OZ_QUANTUM); -} - -/* - * Context: softirq or process - */ -struct oz_pd *oz_pd_find(const u8 *mac_addr) -{ - struct oz_pd *pd; - - spin_lock_bh(&g_polling_lock); - list_for_each_entry(pd, &g_pd_list, link) { - if (ether_addr_equal(pd->mac_addr, mac_addr)) { - oz_pd_get(pd); - spin_unlock_bh(&g_polling_lock); - return pd; - } - } - spin_unlock_bh(&g_polling_lock); - return NULL; -} - -/* - * Context: process - */ -void oz_app_enable(int app_id, int enable) -{ - if (app_id < OZ_NB_APPS) { - spin_lock_bh(&g_polling_lock); - if (enable) - g_apps |= (1<ptype.type = htons(OZ_ETHERTYPE); - binding->ptype.func = oz_pkt_recv; - if (net_dev && *net_dev) { - memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN); - oz_dbg(ON, "Adding binding: %s\n", net_dev); - binding->ptype.dev = dev_get_by_name(&init_net, net_dev); - if (binding->ptype.dev == NULL) { - oz_dbg(ON, "Netdev %s not found\n", net_dev); - kfree(binding); - return; - } - } - dev_add_pack(&binding->ptype); - spin_lock_bh(&g_binding_lock); - list_add_tail(&binding->link, &g_binding); - spin_unlock_bh(&g_binding_lock); -} - -/* - * Context: process - */ -static void pd_stop_all_for_device(struct net_device *net_dev) -{ - LIST_HEAD(h); - struct oz_pd *pd; - struct oz_pd *n; - - spin_lock_bh(&g_polling_lock); - list_for_each_entry_safe(pd, n, &g_pd_list, link) { - if (pd->net_dev == net_dev) { - list_move(&pd->link, &h); - oz_pd_get(pd); - } - } - spin_unlock_bh(&g_polling_lock); - while (!list_empty(&h)) { - pd = list_first_entry(&h, struct oz_pd, link); - oz_pd_stop(pd); - oz_pd_put(pd); - } -} - -/* - * Context: process - */ -void oz_binding_remove(const char *net_dev) -{ - struct oz_binding *binding; - int found = 0; - - oz_dbg(ON, "Removing binding: %s\n", net_dev); - spin_lock_bh(&g_binding_lock); - list_for_each_entry(binding, &g_binding, link) { - if (strncmp(binding->name, net_dev, OZ_MAX_BINDING_LEN) == 0) { - oz_dbg(ON, "Binding '%s' found\n", net_dev); - found = 1; - break; - } - } - spin_unlock_bh(&g_binding_lock); - if (found) { - dev_remove_pack(&binding->ptype); - if (binding->ptype.dev) { - dev_put(binding->ptype.dev); - pd_stop_all_for_device(binding->ptype.dev); - } - list_del(&binding->link); - kfree(binding); - } -} - -/* - * Context: process - */ -static char *oz_get_next_device_name(char *s, char *dname, int max_size) -{ - while (*s == ',') - s++; - while (*s && (*s != ',') && max_size > 1) { - *dname++ = *s++; - max_size--; - } - *dname = 0; - return s; -} - -/* - * Context: process - */ -int oz_protocol_init(char *devs) -{ - oz_elt_info_cache = KMEM_CACHE(oz_elt_info, 0); - if (!oz_elt_info_cache) - return -ENOMEM; - - oz_tx_frame_cache = KMEM_CACHE(oz_tx_frame, 0); - if (!oz_tx_frame_cache) { - kmem_cache_destroy(oz_elt_info_cache); - return -ENOMEM; - } - - skb_queue_head_init(&g_rx_queue); - if (devs[0] == '*') { - oz_binding_add(NULL); - } else { - char d[32]; - - while (*devs) { - devs = oz_get_next_device_name(devs, d, sizeof(d)); - if (d[0]) - oz_binding_add(d); - } - } - return 0; -} - -/* - * Context: process - */ -int oz_get_pd_list(struct oz_mac_addr *addr, int max_count) -{ - struct oz_pd *pd; - int count = 0; - - spin_lock_bh(&g_polling_lock); - list_for_each_entry(pd, &g_pd_list, link) { - if (count >= max_count) - break; - ether_addr_copy((u8 *)&addr[count++], pd->mac_addr); - } - spin_unlock_bh(&g_polling_lock); - return count; -} - diff --git a/drivers/staging/ozwpan/ozproto.h b/drivers/staging/ozwpan/ozproto.h deleted file mode 100644 index 30c2db91c000..000000000000 --- a/drivers/staging/ozwpan/ozproto.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#ifndef _OZPROTO_H -#define _OZPROTO_H - -#include -#include "ozdbg.h" -#include "ozappif.h" - -#define OZ_ALLOCATED_SPACE(__x) (LL_RESERVED_SPACE(__x)+(__x)->needed_tailroom) - -/* Quantum in MS */ -#define OZ_QUANTUM 8 -/* Default timeouts. - */ -#define OZ_PRESLEEP_TOUT 11 - -/* Maximun sizes of tx frames. */ -#define OZ_MAX_TX_SIZE 760 - -/* Maximum number of uncompleted isoc frames that can be pending in network. */ -#define OZ_MAX_SUBMITTED_ISOC 16 - -/* Maximum number of uncompleted isoc frames that can be pending in Tx Queue. */ -#define OZ_MAX_TX_QUEUE_ISOC 32 - -/* Application handler functions. - */ -struct oz_app_if { - int (*init)(void); - void (*term)(void); - int (*start)(struct oz_pd *pd, int resume); - void (*stop)(struct oz_pd *pd, int pause); - void (*rx)(struct oz_pd *pd, struct oz_elt *elt); - int (*heartbeat)(struct oz_pd *pd); - void (*farewell)(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len); -}; - -int oz_protocol_init(char *devs); -void oz_protocol_term(void); -int oz_get_pd_list(struct oz_mac_addr *addr, int max_count); -void oz_app_enable(int app_id, int enable); -struct oz_pd *oz_pd_find(const u8 *mac_addr); -void oz_binding_add(const char *net_dev); -void oz_binding_remove(const char *net_dev); -void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time); -void oz_timer_delete(struct oz_pd *pd, int type); -void oz_pd_request_heartbeat(struct oz_pd *pd); -void oz_pd_heartbeat_handler(unsigned long data); -void oz_pd_timeout_handler(unsigned long data); -enum hrtimer_restart oz_pd_heartbeat_event(struct hrtimer *timer); -enum hrtimer_restart oz_pd_timeout_event(struct hrtimer *timer); -int oz_get_pd_status_list(char *pd_list, int max_count); -int oz_get_binding_list(char *buf, int max_if); - -extern struct kmem_cache *oz_elt_info_cache; -extern struct kmem_cache *oz_tx_frame_cache; - -#endif /* _OZPROTO_H */ diff --git a/drivers/staging/ozwpan/ozprotocol.h b/drivers/staging/ozwpan/ozprotocol.h deleted file mode 100644 index 4642072596da..000000000000 --- a/drivers/staging/ozwpan/ozprotocol.h +++ /dev/null @@ -1,375 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#ifndef _OZPROTOCOL_H -#define _OZPROTOCOL_H - -#define PACKED __packed - -#define OZ_ETHERTYPE 0x892e - -/* Status codes - */ -#define OZ_STATUS_SUCCESS 0 -#define OZ_STATUS_INVALID_PARAM 1 -#define OZ_STATUS_TOO_MANY_PDS 2 -#define OZ_STATUS_NOT_ALLOWED 4 -#define OZ_STATUS_SESSION_MISMATCH 5 -#define OZ_STATUS_SESSION_TEARDOWN 6 - -/* This is the generic element header. - Every element starts with this. - */ -struct oz_elt { - u8 type; - u8 length; -} PACKED; - -#define oz_next_elt(__elt) \ - (struct oz_elt *)((u8 *)((__elt) + 1) + (__elt)->length) - -/* Protocol element IDs. - */ -#define OZ_ELT_CONNECT_REQ 0x06 -#define OZ_ELT_CONNECT_RSP 0x07 -#define OZ_ELT_DISCONNECT 0x08 -#define OZ_ELT_UPDATE_PARAM_REQ 0x11 -#define OZ_ELT_FAREWELL_REQ 0x12 -#define OZ_ELT_APP_DATA 0x31 - -/* This is the Ozmo header which is the first Ozmo specific part - * of a frame and comes after the MAC header. - */ -struct oz_hdr { - u8 control; - u8 last_pkt_num; - u32 pkt_num; -} PACKED; - -#define OZ_PROTOCOL_VERSION 0x1 -/* Bits in the control field. */ -#define OZ_VERSION_MASK 0xc -#define OZ_VERSION_SHIFT 2 -#define OZ_F_ACK 0x10 -#define OZ_F_ISOC 0x20 -#define OZ_F_MORE_DATA 0x40 -#define OZ_F_ACK_REQUESTED 0x80 - -#define oz_get_prot_ver(__x) (((__x) & OZ_VERSION_MASK) >> OZ_VERSION_SHIFT) - -/* Used to select the bits of packet number to put in the last_pkt_num. - */ -#define OZ_LAST_PN_MASK 0x00ff - -#define OZ_LAST_PN_HALF_CYCLE 127 - -#define OZ_LATENCY_MASK 0xc0 -#define OZ_ONE_MS_LATENCY 0x40 -#define OZ_TEN_MS_LATENCY 0x80 - -/* Connect request data structure. - */ -struct oz_elt_connect_req { - u8 mode; - u8 resv1[16]; - u8 pd_info; - u8 session_id; - u8 presleep; - u8 ms_isoc_latency; - u8 host_vendor; - u8 keep_alive; - u16 apps; - u8 max_len_div16; - u8 ms_per_isoc; - u8 resv3[2]; -} PACKED; - -/* mode field bits. - */ -#define OZ_MODE_POLLED 0x0 -#define OZ_MODE_TRIGGERED 0x1 -#define OZ_MODE_MASK 0xf -#define OZ_F_ISOC_NO_ELTS 0x40 -#define OZ_F_ISOC_ANYTIME 0x80 -#define OZ_NO_ELTS_ANYTIME 0xc0 - -/* Keep alive field. - */ -#define OZ_KALIVE_TYPE_MASK 0xc0 -#define OZ_KALIVE_VALUE_MASK 0x3f -#define OZ_KALIVE_SPECIAL 0x00 -#define OZ_KALIVE_SECS 0x40 -#define OZ_KALIVE_MINS 0x80 -#define OZ_KALIVE_HOURS 0xc0 - -/* Connect response data structure. - */ -struct oz_elt_connect_rsp { - u8 mode; - u8 status; - u8 resv1[3]; - u8 session_id; - u16 apps; - u32 resv2; -} PACKED; - -struct oz_elt_farewell { - u8 ep_num; - u8 index; - u8 report[1]; -} PACKED; - -struct oz_elt_update_param { - u8 resv1[16]; - u8 presleep; - u8 resv2; - u8 host_vendor; - u8 keepalive; -} PACKED; - -/* Header common to all application elements. - */ -struct oz_app_hdr { - u8 app_id; - u8 elt_seq_num; -} PACKED; - -/* Values for app_id. - */ -#define OZ_APPID_USB 0x1 -#define OZ_APPID_SERIAL 0x4 -#define OZ_APPID_MAX OZ_APPID_SERIAL -#define OZ_NB_APPS (OZ_APPID_MAX+1) - -/* USB header common to all elements for the USB application. - * This header extends the oz_app_hdr and comes directly after - * the element header in a USB application. - */ -struct oz_usb_hdr { - u8 app_id; - u8 elt_seq_num; - u8 type; -} PACKED; - - - -/* USB requests element subtypes (type field of hs_usb_hdr). - */ -#define OZ_GET_DESC_REQ 1 -#define OZ_GET_DESC_RSP 2 -#define OZ_SET_CONFIG_REQ 3 -#define OZ_SET_CONFIG_RSP 4 -#define OZ_SET_INTERFACE_REQ 5 -#define OZ_SET_INTERFACE_RSP 6 -#define OZ_VENDOR_CLASS_REQ 7 -#define OZ_VENDOR_CLASS_RSP 8 -#define OZ_GET_STATUS_REQ 9 -#define OZ_GET_STATUS_RSP 10 -#define OZ_CLEAR_FEATURE_REQ 11 -#define OZ_CLEAR_FEATURE_RSP 12 -#define OZ_SET_FEATURE_REQ 13 -#define OZ_SET_FEATURE_RSP 14 -#define OZ_GET_CONFIGURATION_REQ 15 -#define OZ_GET_CONFIGURATION_RSP 16 -#define OZ_GET_INTERFACE_REQ 17 -#define OZ_GET_INTERFACE_RSP 18 -#define OZ_SYNCH_FRAME_REQ 19 -#define OZ_SYNCH_FRAME_RSP 20 -#define OZ_USB_ENDPOINT_DATA 23 - -#define OZ_REQD_D2H 0x80 - -struct oz_get_desc_req { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u16 offset; - u16 size; - u8 req_type; - u8 desc_type; - __le16 w_index; - u8 index; -} PACKED; - -/* Values for desc_type field. -*/ -#define OZ_DESC_DEVICE 0x01 -#define OZ_DESC_CONFIG 0x02 -#define OZ_DESC_STRING 0x03 - -/* Values for req_type field. - */ -#define OZ_RECP_MASK 0x1F -#define OZ_RECP_DEVICE 0x00 -#define OZ_RECP_INTERFACE 0x01 -#define OZ_RECP_ENDPOINT 0x02 - -#define OZ_REQT_MASK 0x60 -#define OZ_REQT_STD 0x00 -#define OZ_REQT_CLASS 0x20 -#define OZ_REQT_VENDOR 0x40 - -struct oz_get_desc_rsp { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - __le16 offset; - __le16 total_size; - u8 rcode; - u8 data[1]; -} PACKED; - -struct oz_feature_req { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 recipient; - u8 index; - u16 feature; -} PACKED; - -struct oz_feature_rsp { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 rcode; -} PACKED; - -struct oz_set_config_req { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 index; -} PACKED; - -struct oz_set_config_rsp { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 rcode; -} PACKED; - -struct oz_set_interface_req { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 index; - u8 alternative; -} PACKED; - -struct oz_set_interface_rsp { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 rcode; -} PACKED; - -struct oz_get_interface_req { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 index; -} PACKED; - -struct oz_get_interface_rsp { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 rcode; - u8 alternative; -} PACKED; - -struct oz_vendor_class_req { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 req_type; - u8 request; - u16 value; - u16 index; - u8 data[1]; -} PACKED; - -struct oz_vendor_class_rsp { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 req_id; - u8 rcode; - u8 data[1]; -} PACKED; - -struct oz_data { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 endpoint; - u8 format; -} PACKED; - -struct oz_isoc_fixed { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 endpoint; - u8 format; - u8 unit_size; - u8 frame_number; - u8 data[1]; -} PACKED; - -struct oz_multiple_fixed { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 endpoint; - u8 format; - u8 unit_size; - u8 data[1]; -} PACKED; - -struct oz_fragmented { - u8 app_id; - u8 elt_seq_num; - u8 type; - u8 endpoint; - u8 format; - u16 total_size; - u16 offset; - u8 data[1]; -} PACKED; - -/* Note: the following does not get packaged in an element in the same way - * that other data formats are packaged. Instead the data is put in a frame - * directly after the oz_header and is the only permitted data in such a - * frame. The length of the data is directly determined from the frame size. - */ -struct oz_isoc_large { - u8 endpoint; - u8 format; - u8 ms_data; - u8 frame_number; -} PACKED; - -#define OZ_DATA_F_TYPE_MASK 0xF -#define OZ_DATA_F_MULTIPLE_FIXED 0x1 -#define OZ_DATA_F_MULTIPLE_VAR 0x2 -#define OZ_DATA_F_ISOC_FIXED 0x3 -#define OZ_DATA_F_ISOC_VAR 0x4 -#define OZ_DATA_F_FRAGMENTED 0x5 -#define OZ_DATA_F_ISOC_LARGE 0x7 - -#endif /* _OZPROTOCOL_H */ diff --git a/drivers/staging/ozwpan/ozurbparanoia.c b/drivers/staging/ozwpan/ozurbparanoia.c deleted file mode 100644 index cf6278a198a8..000000000000 --- a/drivers/staging/ozwpan/ozurbparanoia.c +++ /dev/null @@ -1,54 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#include -#include "ozdbg.h" - -#ifdef WANT_URB_PARANOIA - -#include "ozurbparanoia.h" - -#define OZ_MAX_URBS 1000 -struct urb *g_urb_memory[OZ_MAX_URBS]; -int g_nb_urbs; -DEFINE_SPINLOCK(g_urb_mem_lock); - -void oz_remember_urb(struct urb *urb) -{ - unsigned long irq_state; - - spin_lock_irqsave(&g_urb_mem_lock, irq_state); - if (g_nb_urbs < OZ_MAX_URBS) { - g_urb_memory[g_nb_urbs++] = urb; - oz_dbg(ON, "urb up = %d %p\n", g_nb_urbs, urb); - } else { - oz_dbg(ON, "ERROR urb buffer full\n"); - } - spin_unlock_irqrestore(&g_urb_mem_lock, irq_state); -} - -/* - */ -int oz_forget_urb(struct urb *urb) -{ - unsigned long irq_state; - int i; - int rc = -1; - - spin_lock_irqsave(&g_urb_mem_lock, irq_state); - for (i = 0; i < g_nb_urbs; i++) { - if (g_urb_memory[i] == urb) { - rc = 0; - if (--g_nb_urbs > i) - memcpy(&g_urb_memory[i], &g_urb_memory[i+1], - (g_nb_urbs - i) * sizeof(struct urb *)); - oz_dbg(ON, "urb down = %d %p\n", g_nb_urbs, urb); - } - } - spin_unlock_irqrestore(&g_urb_mem_lock, irq_state); - return rc; -} -#endif /* #ifdef WANT_URB_PARANOIA */ - diff --git a/drivers/staging/ozwpan/ozurbparanoia.h b/drivers/staging/ozwpan/ozurbparanoia.h deleted file mode 100644 index 5080ea76f507..000000000000 --- a/drivers/staging/ozwpan/ozurbparanoia.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _OZURBPARANOIA_H -#define _OZURBPARANOIA_H -/* ----------------------------------------------------------------------------- - * Released under the GNU General Public License Version 2 (GPLv2). - * Copyright (c) 2011 Ozmo Inc - * ----------------------------------------------------------------------------- - */ - -#ifdef WANT_URB_PARANOIA -void oz_remember_urb(struct urb *urb); -int oz_forget_urb(struct urb *urb); -#else -static inline void oz_remember_urb(struct urb *urb) {} -static inline int oz_forget_urb(struct urb *urb) { return 0; } -#endif /* WANT_URB_PARANOIA */ - - -#endif /* _OZURBPARANOIA_H */ - diff --git a/drivers/staging/ozwpan/ozusbif.h b/drivers/staging/ozwpan/ozusbif.h deleted file mode 100644 index d2a6085345be..000000000000 --- a/drivers/staging/ozwpan/ozusbif.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#ifndef _OZUSBIF_H -#define _OZUSBIF_H - -#include - -/* Reference counting functions. - */ -void oz_usb_get(void *hpd); -void oz_usb_put(void *hpd); - -/* Stream functions. - */ -int oz_usb_stream_create(void *hpd, u8 ep_num); -int oz_usb_stream_delete(void *hpd, u8 ep_num); - -/* Request functions. - */ -int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup, - const u8 *data, int data_len); -int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type, - u8 index, __le16 windex, int offset, int len); -int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb); -void oz_usb_request_heartbeat(void *hpd); - -/* Confirmation functions. - */ -void oz_hcd_get_desc_cnf(void *hport, u8 req_id, u8 status, - const u8 *desc, u8 length, u16 offset, u16 total_size); -void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, - const u8 *data, int data_len); - -/* Indication functions. - */ -void oz_hcd_data_ind(void *hport, u8 endpoint, const u8 *data, int data_len); - -int oz_hcd_heartbeat(void *hport); - -#endif /* _OZUSBIF_H */ diff --git a/drivers/staging/ozwpan/ozusbsvc.c b/drivers/staging/ozwpan/ozusbsvc.c deleted file mode 100644 index bf15dc301cb5..000000000000 --- a/drivers/staging/ozwpan/ozusbsvc.c +++ /dev/null @@ -1,263 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * - * This file provides protocol independent part of the implementation of the USB - * service for a PD. - * The implementation of this service is split into two parts the first of which - * is protocol independent and the second contains protocol specific details. - * This split is to allow alternative protocols to be defined. - * The implementation of this service uses ozhcd.c to implement a USB HCD. - * ----------------------------------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include "ozdbg.h" -#include "ozprotocol.h" -#include "ozeltbuf.h" -#include "ozpd.h" -#include "ozproto.h" -#include "ozusbif.h" -#include "ozhcd.h" -#include "ozusbsvc.h" - -/* - * This is called once when the driver is loaded to initialise the USB service. - * Context: process - */ -int oz_usb_init(void) -{ - return oz_hcd_init(); -} - -/* - * This is called once when the driver is unloaded to terminate the USB service. - * Context: process - */ -void oz_usb_term(void) -{ - oz_hcd_term(); -} - -/* - * This is called when the USB service is started or resumed for a PD. - * Context: softirq - */ -int oz_usb_start(struct oz_pd *pd, int resume) -{ - int rc = 0; - struct oz_usb_ctx *usb_ctx; - struct oz_usb_ctx *old_ctx; - - if (resume) { - oz_dbg(ON, "USB service resumed\n"); - return 0; - } - oz_dbg(ON, "USB service started\n"); - /* Create a USB context in case we need one. If we find the PD already - * has a USB context then we will destroy it. - */ - usb_ctx = kzalloc(sizeof(struct oz_usb_ctx), GFP_ATOMIC); - if (usb_ctx == NULL) - return -ENOMEM; - atomic_set(&usb_ctx->ref_count, 1); - usb_ctx->pd = pd; - usb_ctx->stopped = 0; - /* Install the USB context if the PD doesn't already have one. - * If it does already have one then destroy the one we have just - * created. - */ - spin_lock_bh(&pd->app_lock[OZ_APPID_USB]); - old_ctx = pd->app_ctx[OZ_APPID_USB]; - if (old_ctx == NULL) - pd->app_ctx[OZ_APPID_USB] = usb_ctx; - oz_usb_get(pd->app_ctx[OZ_APPID_USB]); - spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]); - if (old_ctx) { - oz_dbg(ON, "Already have USB context\n"); - kfree(usb_ctx); - usb_ctx = old_ctx; - } else if (usb_ctx) { - /* Take a reference to the PD. This will be released when - * the USB context is destroyed. - */ - oz_pd_get(pd); - } - /* If we already had a USB context and had obtained a port from - * the USB HCD then just reset the port. If we didn't have a port - * then report the arrival to the USB HCD so we get one. - */ - if (usb_ctx->hport) { - oz_hcd_pd_reset(usb_ctx, usb_ctx->hport); - } else { - usb_ctx->hport = oz_hcd_pd_arrived(usb_ctx); - if (usb_ctx->hport == NULL) { - oz_dbg(ON, "USB hub returned null port\n"); - spin_lock_bh(&pd->app_lock[OZ_APPID_USB]); - pd->app_ctx[OZ_APPID_USB] = NULL; - spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]); - oz_usb_put(usb_ctx); - rc = -1; - } - } - oz_usb_put(usb_ctx); - return rc; -} - -/* - * This is called when the USB service is stopped or paused for a PD. - * Context: softirq or process - */ -void oz_usb_stop(struct oz_pd *pd, int pause) -{ - struct oz_usb_ctx *usb_ctx; - - if (pause) { - oz_dbg(ON, "USB service paused\n"); - return; - } - spin_lock_bh(&pd->app_lock[OZ_APPID_USB]); - usb_ctx = (struct oz_usb_ctx *) pd->app_ctx[OZ_APPID_USB]; - pd->app_ctx[OZ_APPID_USB] = NULL; - spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]); - if (usb_ctx) { - struct timespec ts, now; - - getnstimeofday(&ts); - oz_dbg(ON, "USB service stopping...\n"); - usb_ctx->stopped = 1; - /* At this point the reference count on the usb context should - * be 2 - one from when we created it and one from the hcd - * which claims a reference. Since stopped = 1 no one else - * should get in but someone may already be in. So wait - * until they leave but timeout after 1 second. - */ - while ((atomic_read(&usb_ctx->ref_count) > 2)) { - getnstimeofday(&now); - /*Approx 1 Sec. this is not perfect calculation*/ - if (now.tv_sec != ts.tv_sec) - break; - } - oz_dbg(ON, "USB service stopped\n"); - oz_hcd_pd_departed(usb_ctx->hport); - /* Release the reference taken in oz_usb_start. - */ - oz_usb_put(usb_ctx); - } -} - -/* - * This increments the reference count of the context area for a specific PD. - * This ensures this context area does not disappear while still in use. - * Context: softirq - */ -void oz_usb_get(void *hpd) -{ - struct oz_usb_ctx *usb_ctx = (struct oz_usb_ctx *)hpd; - - atomic_inc(&usb_ctx->ref_count); -} - -/* - * This decrements the reference count of the context area for a specific PD - * and destroys the context area if the reference count becomes zero. - * Context: irq or process - */ -void oz_usb_put(void *hpd) -{ - struct oz_usb_ctx *usb_ctx = (struct oz_usb_ctx *)hpd; - - if (atomic_dec_and_test(&usb_ctx->ref_count)) { - oz_dbg(ON, "Dealloc USB context\n"); - oz_pd_put(usb_ctx->pd); - kfree(usb_ctx); - } -} - -/* - * Context: softirq - */ -int oz_usb_heartbeat(struct oz_pd *pd) -{ - struct oz_usb_ctx *usb_ctx; - int rc = 0; - - spin_lock_bh(&pd->app_lock[OZ_APPID_USB]); - usb_ctx = (struct oz_usb_ctx *) pd->app_ctx[OZ_APPID_USB]; - if (usb_ctx) - oz_usb_get(usb_ctx); - spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]); - if (usb_ctx == NULL) - return rc; - if (usb_ctx->stopped) - goto done; - if (usb_ctx->hport) - if (oz_hcd_heartbeat(usb_ctx->hport)) - rc = 1; -done: - oz_usb_put(usb_ctx); - return rc; -} - -/* - * Context: softirq - */ -int oz_usb_stream_create(void *hpd, u8 ep_num) -{ - struct oz_usb_ctx *usb_ctx = (struct oz_usb_ctx *)hpd; - struct oz_pd *pd = usb_ctx->pd; - - oz_dbg(ON, "%s: (0x%x)\n", __func__, ep_num); - if (pd->mode & OZ_F_ISOC_NO_ELTS) { - oz_isoc_stream_create(pd, ep_num); - } else { - oz_pd_get(pd); - if (oz_elt_stream_create(&pd->elt_buff, ep_num, - 4*pd->max_tx_size)) { - oz_pd_put(pd); - return -1; - } - } - return 0; -} - -/* - * Context: softirq - */ -int oz_usb_stream_delete(void *hpd, u8 ep_num) -{ - struct oz_usb_ctx *usb_ctx = (struct oz_usb_ctx *)hpd; - - if (usb_ctx) { - struct oz_pd *pd = usb_ctx->pd; - - if (pd) { - oz_dbg(ON, "%s: (0x%x)\n", __func__, ep_num); - if (pd->mode & OZ_F_ISOC_NO_ELTS) { - oz_isoc_stream_delete(pd, ep_num); - } else { - if (oz_elt_stream_delete(&pd->elt_buff, ep_num)) - return -1; - oz_pd_put(pd); - } - } - } - return 0; -} - -/* - * Context: softirq or process - */ -void oz_usb_request_heartbeat(void *hpd) -{ - struct oz_usb_ctx *usb_ctx = (struct oz_usb_ctx *)hpd; - - if (usb_ctx && usb_ctx->pd) - oz_pd_request_heartbeat(usb_ctx->pd); -} diff --git a/drivers/staging/ozwpan/ozusbsvc.h b/drivers/staging/ozwpan/ozusbsvc.h deleted file mode 100644 index 58e05a59be31..000000000000 --- a/drivers/staging/ozwpan/ozusbsvc.h +++ /dev/null @@ -1,32 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * ----------------------------------------------------------------------------- - */ -#ifndef _OZUSBSVC_H -#define _OZUSBSVC_H - -/*------------------------------------------------------------------------------ - * Per PD context info stored in application context area of PD. - * This object is reference counted to ensure it doesn't disappear while - * still in use. - */ -struct oz_usb_ctx { - atomic_t ref_count; - u8 tx_seq_num; - u8 rx_seq_num; - struct oz_pd *pd; - void *hport; - int stopped; -}; - -int oz_usb_init(void); -void oz_usb_term(void); -int oz_usb_start(struct oz_pd *pd, int resume); -void oz_usb_stop(struct oz_pd *pd, int pause); -void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt); -int oz_usb_heartbeat(struct oz_pd *pd); -void oz_usb_farewell(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len); - -#endif /* _OZUSBSVC_H */ - diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c deleted file mode 100644 index b6cfecbeabf7..000000000000 --- a/drivers/staging/ozwpan/ozusbsvc1.c +++ /dev/null @@ -1,472 +0,0 @@ -/* ----------------------------------------------------------------------------- - * Copyright (c) 2011 Ozmo Inc - * Released under the GNU General Public License Version 2 (GPLv2). - * - * This file implements the protocol specific parts of the USB service for a PD. - * ----------------------------------------------------------------------------- - */ -#include -#include -#include -#include -#include -#include -#include -#include "ozdbg.h" -#include "ozprotocol.h" -#include "ozeltbuf.h" -#include "ozpd.h" -#include "ozproto.h" -#include "ozusbif.h" -#include "ozhcd.h" -#include "ozusbsvc.h" - -#define MAX_ISOC_FIXED_DATA (253-sizeof(struct oz_isoc_fixed)) - -/* - * Context: softirq - */ -static int oz_usb_submit_elt(struct oz_elt_buf *eb, struct oz_elt_info *ei, - struct oz_usb_ctx *usb_ctx, u8 strid, u8 isoc) -{ - int ret; - struct oz_elt *elt = (struct oz_elt *)ei->data; - struct oz_app_hdr *app_hdr = (struct oz_app_hdr *)(elt+1); - - elt->type = OZ_ELT_APP_DATA; - ei->app_id = OZ_APPID_USB; - ei->length = elt->length + sizeof(struct oz_elt); - app_hdr->app_id = OZ_APPID_USB; - spin_lock_bh(&eb->lock); - if (isoc == 0) { - app_hdr->elt_seq_num = usb_ctx->tx_seq_num++; - if (usb_ctx->tx_seq_num == 0) - usb_ctx->tx_seq_num = 1; - } - ret = oz_queue_elt_info(eb, isoc, strid, ei); - if (ret) - oz_elt_info_free(eb, ei); - spin_unlock_bh(&eb->lock); - return ret; -} - -/* - * Context: softirq - */ -int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type, - u8 index, __le16 windex, int offset, int len) -{ - struct oz_usb_ctx *usb_ctx = hpd; - struct oz_pd *pd = usb_ctx->pd; - struct oz_elt *elt; - struct oz_get_desc_req *body; - struct oz_elt_buf *eb = &pd->elt_buff; - struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); - - oz_dbg(ON, " req_type = 0x%x\n", req_type); - oz_dbg(ON, " desc_type = 0x%x\n", desc_type); - oz_dbg(ON, " index = 0x%x\n", index); - oz_dbg(ON, " windex = 0x%x\n", windex); - oz_dbg(ON, " offset = 0x%x\n", offset); - oz_dbg(ON, " len = 0x%x\n", len); - if (len > 200) - len = 200; - if (ei == NULL) - return -1; - elt = (struct oz_elt *)ei->data; - elt->length = sizeof(struct oz_get_desc_req); - body = (struct oz_get_desc_req *)(elt+1); - body->type = OZ_GET_DESC_REQ; - body->req_id = req_id; - put_unaligned(cpu_to_le16(offset), &body->offset); - put_unaligned(cpu_to_le16(len), &body->size); - body->req_type = req_type; - body->desc_type = desc_type; - body->w_index = windex; - body->index = index; - return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0); -} - -/* - * Context: tasklet - */ -static int oz_usb_set_config_req(void *hpd, u8 req_id, u8 index) -{ - struct oz_usb_ctx *usb_ctx = hpd; - struct oz_pd *pd = usb_ctx->pd; - struct oz_elt *elt; - struct oz_elt_buf *eb = &pd->elt_buff; - struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); - struct oz_set_config_req *body; - - if (ei == NULL) - return -1; - elt = (struct oz_elt *)ei->data; - elt->length = sizeof(struct oz_set_config_req); - body = (struct oz_set_config_req *)(elt+1); - body->type = OZ_SET_CONFIG_REQ; - body->req_id = req_id; - body->index = index; - return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0); -} - -/* - * Context: tasklet - */ -static int oz_usb_set_interface_req(void *hpd, u8 req_id, u8 index, u8 alt) -{ - struct oz_usb_ctx *usb_ctx = hpd; - struct oz_pd *pd = usb_ctx->pd; - struct oz_elt *elt; - struct oz_elt_buf *eb = &pd->elt_buff; - struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); - struct oz_set_interface_req *body; - - if (ei == NULL) - return -1; - elt = (struct oz_elt *)ei->data; - elt->length = sizeof(struct oz_set_interface_req); - body = (struct oz_set_interface_req *)(elt+1); - body->type = OZ_SET_INTERFACE_REQ; - body->req_id = req_id; - body->index = index; - body->alternative = alt; - return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0); -} - -/* - * Context: tasklet - */ -static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type, - u8 recipient, u8 index, __le16 feature) -{ - struct oz_usb_ctx *usb_ctx = hpd; - struct oz_pd *pd = usb_ctx->pd; - struct oz_elt *elt; - struct oz_elt_buf *eb = &pd->elt_buff; - struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); - struct oz_feature_req *body; - - if (ei == NULL) - return -1; - elt = (struct oz_elt *)ei->data; - elt->length = sizeof(struct oz_feature_req); - body = (struct oz_feature_req *)(elt+1); - body->type = type; - body->req_id = req_id; - body->recipient = recipient; - body->index = index; - put_unaligned(feature, &body->feature); - return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0); -} - -/* - * Context: tasklet - */ -static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type, - u8 request, __le16 value, __le16 index, const u8 *data, int data_len) -{ - struct oz_usb_ctx *usb_ctx = hpd; - struct oz_pd *pd = usb_ctx->pd; - struct oz_elt *elt; - struct oz_elt_buf *eb = &pd->elt_buff; - struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); - struct oz_vendor_class_req *body; - - if (ei == NULL) - return -1; - elt = (struct oz_elt *)ei->data; - elt->length = sizeof(struct oz_vendor_class_req) - 1 + data_len; - body = (struct oz_vendor_class_req *)(elt+1); - body->type = OZ_VENDOR_CLASS_REQ; - body->req_id = req_id; - body->req_type = req_type; - body->request = request; - put_unaligned(value, &body->value); - put_unaligned(index, &body->index); - if (data_len) - memcpy(body->data, data, data_len); - return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0); -} - -/* - * Context: tasklet - */ -int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup, - const u8 *data, int data_len) -{ - unsigned wvalue = le16_to_cpu(setup->wValue); - unsigned windex = le16_to_cpu(setup->wIndex); - unsigned wlength = le16_to_cpu(setup->wLength); - int rc = 0; - - if ((setup->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { - switch (setup->bRequest) { - case USB_REQ_GET_DESCRIPTOR: - rc = oz_usb_get_desc_req(hpd, req_id, - setup->bRequestType, (u8)(wvalue>>8), - (u8)wvalue, setup->wIndex, 0, wlength); - break; - case USB_REQ_SET_CONFIGURATION: - rc = oz_usb_set_config_req(hpd, req_id, (u8)wvalue); - break; - case USB_REQ_SET_INTERFACE: { - u8 if_num = (u8)windex; - u8 alt = (u8)wvalue; - - rc = oz_usb_set_interface_req(hpd, req_id, - if_num, alt); - } - break; - case USB_REQ_SET_FEATURE: - rc = oz_usb_set_clear_feature_req(hpd, req_id, - OZ_SET_FEATURE_REQ, - setup->bRequestType & 0xf, (u8)windex, - setup->wValue); - break; - case USB_REQ_CLEAR_FEATURE: - rc = oz_usb_set_clear_feature_req(hpd, req_id, - OZ_CLEAR_FEATURE_REQ, - setup->bRequestType & 0xf, - (u8)windex, setup->wValue); - break; - } - } else { - rc = oz_usb_vendor_class_req(hpd, req_id, setup->bRequestType, - setup->bRequest, setup->wValue, setup->wIndex, - data, data_len); - } - return rc; -} - -/* - * Context: softirq - */ -int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb) -{ - struct oz_usb_ctx *usb_ctx = hpd; - struct oz_pd *pd = usb_ctx->pd; - struct oz_elt_buf *eb; - int i; - int hdr_size; - u8 *data; - struct usb_iso_packet_descriptor *desc; - - if (pd->mode & OZ_F_ISOC_NO_ELTS) { - for (i = 0; i < urb->number_of_packets; i++) { - u8 *data; - - desc = &urb->iso_frame_desc[i]; - data = ((u8 *)urb->transfer_buffer)+desc->offset; - oz_send_isoc_unit(pd, ep_num, data, desc->length); - } - return 0; - } - - hdr_size = sizeof(struct oz_isoc_fixed) - 1; - eb = &pd->elt_buff; - i = 0; - while (i < urb->number_of_packets) { - struct oz_elt_info *ei = oz_elt_info_alloc(eb); - struct oz_elt *elt; - struct oz_isoc_fixed *body; - int unit_count; - int unit_size; - int rem; - - if (ei == NULL) - return -1; - rem = MAX_ISOC_FIXED_DATA; - elt = (struct oz_elt *)ei->data; - body = (struct oz_isoc_fixed *)(elt + 1); - body->type = OZ_USB_ENDPOINT_DATA; - body->endpoint = ep_num; - body->format = OZ_DATA_F_ISOC_FIXED; - unit_size = urb->iso_frame_desc[i].length; - body->unit_size = (u8)unit_size; - data = ((u8 *)(elt+1)) + hdr_size; - unit_count = 0; - while (i < urb->number_of_packets) { - desc = &urb->iso_frame_desc[i]; - if ((unit_size == desc->length) && - (desc->length <= rem)) { - memcpy(data, ((u8 *)urb->transfer_buffer) + - desc->offset, unit_size); - data += unit_size; - rem -= unit_size; - unit_count++; - desc->status = 0; - desc->actual_length = desc->length; - i++; - } else { - break; - } - } - elt->length = hdr_size + MAX_ISOC_FIXED_DATA - rem; - /* Store the number of units in body->frame_number for the - * moment. This field will be correctly determined before - * the element is sent. */ - body->frame_number = (u8)unit_count; - oz_usb_submit_elt(eb, ei, usb_ctx, ep_num, - pd->mode & OZ_F_ISOC_ANYTIME); - } - return 0; -} - -/* - * Context: softirq-serialized - */ -static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx, - struct oz_usb_hdr *usb_hdr, int len) -{ - struct oz_data *data_hdr = (struct oz_data *)usb_hdr; - - switch (data_hdr->format) { - case OZ_DATA_F_MULTIPLE_FIXED: { - struct oz_multiple_fixed *body = - (struct oz_multiple_fixed *)data_hdr; - u8 *data = body->data; - unsigned int n; - - if (!body->unit_size || - len < sizeof(struct oz_multiple_fixed) - 1) - break; - n = (len - (sizeof(struct oz_multiple_fixed) - 1)) - / body->unit_size; - while (n--) { - oz_hcd_data_ind(usb_ctx->hport, body->endpoint, - data, body->unit_size); - data += body->unit_size; - } - } - break; - case OZ_DATA_F_ISOC_FIXED: { - struct oz_isoc_fixed *body = - (struct oz_isoc_fixed *)data_hdr; - int data_len; - int unit_size = body->unit_size; - u8 *data = body->data; - int count; - int i; - - if (len < sizeof(struct oz_isoc_fixed) - 1) - break; - data_len = len - (sizeof(struct oz_isoc_fixed) - 1); - - if (!unit_size) - break; - count = data_len/unit_size; - for (i = 0; i < count; i++) { - oz_hcd_data_ind(usb_ctx->hport, - body->endpoint, data, unit_size); - data += unit_size; - } - } - break; - } - -} - -/* - * This is called when the PD has received a USB element. The type of element - * is determined and is then passed to an appropriate handler function. - * Context: softirq-serialized - */ -void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt) -{ - struct oz_usb_hdr *usb_hdr = (struct oz_usb_hdr *)(elt + 1); - struct oz_usb_ctx *usb_ctx; - - spin_lock_bh(&pd->app_lock[OZ_APPID_USB]); - usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB]; - if (usb_ctx) - oz_usb_get(usb_ctx); - spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]); - if (usb_ctx == NULL) - return; /* Context has gone so nothing to do. */ - if (usb_ctx->stopped) - goto done; - /* If sequence number is non-zero then check it is not a duplicate. - * Zero sequence numbers are always accepted. - */ - if (usb_hdr->elt_seq_num != 0) { - if (((usb_ctx->rx_seq_num - usb_hdr->elt_seq_num) & 0x80) == 0) - /* Reject duplicate element. */ - goto done; - } - usb_ctx->rx_seq_num = usb_hdr->elt_seq_num; - switch (usb_hdr->type) { - case OZ_GET_DESC_RSP: { - struct oz_get_desc_rsp *body = - (struct oz_get_desc_rsp *)usb_hdr; - u16 offs, total_size; - u8 data_len; - - if (elt->length < sizeof(struct oz_get_desc_rsp) - 1) - break; - data_len = elt->length - - (sizeof(struct oz_get_desc_rsp) - 1); - offs = le16_to_cpu(get_unaligned(&body->offset)); - total_size = - le16_to_cpu(get_unaligned(&body->total_size)); - oz_dbg(ON, "USB_REQ_GET_DESCRIPTOR - cnf\n"); - oz_hcd_get_desc_cnf(usb_ctx->hport, body->req_id, - body->rcode, body->data, - data_len, offs, total_size); - } - break; - case OZ_SET_CONFIG_RSP: { - struct oz_set_config_rsp *body = - (struct oz_set_config_rsp *)usb_hdr; - oz_hcd_control_cnf(usb_ctx->hport, body->req_id, - body->rcode, NULL, 0); - } - break; - case OZ_SET_INTERFACE_RSP: { - struct oz_set_interface_rsp *body = - (struct oz_set_interface_rsp *)usb_hdr; - oz_hcd_control_cnf(usb_ctx->hport, - body->req_id, body->rcode, NULL, 0); - } - break; - case OZ_VENDOR_CLASS_RSP: { - struct oz_vendor_class_rsp *body = - (struct oz_vendor_class_rsp *)usb_hdr; - - if (elt->length < - sizeof(struct oz_vendor_class_rsp) - 1) - break; - - oz_hcd_control_cnf(usb_ctx->hport, body->req_id, - body->rcode, body->data, elt->length- - sizeof(struct oz_vendor_class_rsp)+1); - } - break; - case OZ_USB_ENDPOINT_DATA: - oz_usb_handle_ep_data(usb_ctx, usb_hdr, elt->length); - break; - } -done: - oz_usb_put(usb_ctx); -} - -/* - * Context: softirq, process - */ -void oz_usb_farewell(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len) -{ - struct oz_usb_ctx *usb_ctx; - - spin_lock_bh(&pd->app_lock[OZ_APPID_USB]); - usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB]; - if (usb_ctx) - oz_usb_get(usb_ctx); - spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]); - if (usb_ctx == NULL) - return; /* Context has gone so nothing to do. */ - if (!usb_ctx->stopped) { - oz_dbg(ON, "Farewell indicated ep = 0x%x\n", ep_num); - oz_hcd_data_ind(usb_ctx->hport, ep_num, data, len); - } - oz_usb_put(usb_ctx); -} From 57cb06762d5e587d58005b17b0fa99bd1e391c29 Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Tue, 28 Jul 2015 00:38:57 +0200 Subject: [PATCH 769/912] iio:adc:berlin2-adc: Fix register definition Active channel number is stored in BERLIN2_SM_CTRL as value, instead of a bit map. The masks for channel interrupts and data ready are a 16 bits wide bit map each, instead of just 4 bits. Also correct the data mask for the temperature sensor, which was Reported-by: Antoine Tenart Signed-off-by: Hartmut Knaack Acked-by: Antoine Tenart Signed-off-by: Jonathan Cameron --- drivers/iio/adc/berlin2-adc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c index 3aaf3a975c79..4946d9bf1764 100644 --- a/drivers/iio/adc/berlin2-adc.c +++ b/drivers/iio/adc/berlin2-adc.c @@ -26,7 +26,7 @@ #define BERLIN2_SM_CTRL 0x14 #define BERLIN2_SM_CTRL_SM_SOC_INT BIT(1) #define BERLIN2_SM_CTRL_SOC_SM_INT BIT(2) -#define BERLIN2_SM_CTRL_ADC_SEL(x) (BIT(x) << 5) /* 0-15 */ +#define BERLIN2_SM_CTRL_ADC_SEL(x) ((x) << 5) /* 0-15 */ #define BERLIN2_SM_CTRL_ADC_SEL_MASK (0xf << 5) #define BERLIN2_SM_CTRL_ADC_POWER BIT(9) #define BERLIN2_SM_CTRL_ADC_CLKSEL_DIV2 (0x0 << 10) @@ -53,14 +53,14 @@ #define BERLIN2_SM_ADC_MASK 0x3ff #define BERLIN2_SM_ADC_STATUS 0x1c #define BERLIN2_SM_ADC_STATUS_DATA_RDY(x) BIT(x) /* 0-15 */ -#define BERLIN2_SM_ADC_STATUS_DATA_RDY_MASK 0xf +#define BERLIN2_SM_ADC_STATUS_DATA_RDY_MASK GENMASK(15, 0) #define BERLIN2_SM_ADC_STATUS_INT_EN(x) (BIT(x) << 16) /* 0-15 */ -#define BERLIN2_SM_ADC_STATUS_INT_EN_MASK (0xf << 16) +#define BERLIN2_SM_ADC_STATUS_INT_EN_MASK GENMASK(31, 16) #define BERLIN2_SM_TSEN_STATUS 0x24 #define BERLIN2_SM_TSEN_STATUS_DATA_RDY BIT(0) #define BERLIN2_SM_TSEN_STATUS_INT_EN BIT(1) #define BERLIN2_SM_TSEN_DATA 0x28 -#define BERLIN2_SM_TSEN_MASK 0xfff +#define BERLIN2_SM_TSEN_MASK GENMASK(9, 0) #define BERLIN2_SM_TSEN_CTRL 0x74 #define BERLIN2_SM_TSEN_CTRL_START BIT(8) #define BERLIN2_SM_TSEN_CTRL_SETTLING_4 (0x0 << 21) /* 4 us */ From 06d2f6ca5a38abe92f1f3a132b331eee773868c3 Mon Sep 17 00:00:00 2001 From: Markus Pargmann Date: Wed, 29 Jul 2015 15:46:03 +0200 Subject: [PATCH 770/912] iio: bmg160: IIO_BUFFER and IIO_TRIGGERED_BUFFER are required This patch adds selects for IIO_BUFFER and IIO_TRIGGERED_BUFFER. Without IIO_BUFFER, the driver does not compile. Signed-off-by: Markus Pargmann Reviewed-by: Srinivas Pandruvada Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/gyro/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig index b3d0e94f72eb..8d2439345673 100644 --- a/drivers/iio/gyro/Kconfig +++ b/drivers/iio/gyro/Kconfig @@ -53,7 +53,8 @@ config ADXRS450 config BMG160 tristate "BOSCH BMG160 Gyro Sensor" depends on I2C - select IIO_TRIGGERED_BUFFER if IIO_BUFFER + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Bosch BMG160 Tri-axis Gyro Sensor driver. This driver also supports BMI055 gyroscope. From af255cd562aaa72455f9022a26afacd68f3fbf73 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 4 Aug 2015 16:21:49 +0200 Subject: [PATCH 771/912] iio: lsiio: fix error code handling error commit acf50b3586f8d8a7530b905e111dda41876d38f4 "tools:iio:lsiio: add error handling" introduced error handling of errors returned from read_sysfs_string(), but with a simple if (retval), missing the fact that these functions return a positive value if the read was successful. As a result lsiio regresses and does not show any devices on my filesystem. Fix this by checking for only negative error codes. Cc: Hartmut Knaack Signed-off-by: Linus Walleij Acked-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/lsiio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c index b271a9a796d2..3d650e668252 100644 --- a/tools/iio/lsiio.c +++ b/tools/iio/lsiio.c @@ -69,7 +69,7 @@ static int dump_one_device(const char *dev_dir_name) return -EINVAL; ret = read_sysfs_string("name", dev_dir_name, name); - if (ret) + if (ret < 0) return ret; printf("Device %03d: %s\n", dev_idx, name); @@ -92,7 +92,7 @@ static int dump_one_trigger(const char *dev_dir_name) return -EINVAL; ret = read_sysfs_string("name", dev_dir_name, name); - if (ret) + if (ret < 0) return ret; printf("Trigger %03d: %s\n", dev_idx, name); From 1bdc0293901cbea23c6dc29432e81919d4719844 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 3 Aug 2015 13:37:40 +0300 Subject: [PATCH 772/912] iio: industrialio-buffer: Fix iio_buffer_poll return value Change return value to 0 if no device is bound since unsigned int cannot support negative error codes. Fixes: f18e7a068 ("iio: Return -ENODEV for file operations if the device has been unregistered") Signed-off-by: Cristina Opriceana Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index faed6efa49ec..d7e908acb480 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -164,7 +164,7 @@ unsigned int iio_buffer_poll(struct file *filp, struct iio_buffer *rb = indio_dev->buffer; if (!indio_dev->info) - return -ENODEV; + return 0; poll_wait(filp, &rb->pollq, wait); if (iio_buffer_ready(indio_dev, rb, rb->watermark, 0)) From 41d903c00051d8f31c98a8136edbac67e6f8688f Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 3 Aug 2015 13:00:47 +0300 Subject: [PATCH 773/912] iio: event: Remove negative error code from iio_event_poll Negative return values are not supported by iio_event_poll since its return type is unsigned int. Fixes: f18e7a068a0a3 ("iio: Return -ENODEV for file operations if the device has been unregistered") Signed-off-by: Cristina Opriceana Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index b2f63f919cc4..cae332b1d7ea 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -90,7 +90,7 @@ static unsigned int iio_event_poll(struct file *filep, unsigned int events = 0; if (!indio_dev->info) - return -ENODEV; + return events; poll_wait(filep, &ev_int->wait, wait); From 365741e6a6ab7f31ff885c26dd173d9590d1e8ca Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 10 Aug 2015 10:28:08 -0700 Subject: [PATCH 774/912] staging: comedi: ni_usb6501: fix possible out-of-bounds access Coverity reports a possible Out-of-bounds access (ARRAY_VS_SINGLETON) with the 'const u8 *port' parameter passed to ni6501_port_command(). This param is an actual array for the SET_PORT_DIR operation, called by ni6501_dio_insn_config(). But for the WRITE_PORT and READ_PORT operations, called by ni6501_dio_insn_bits(), it is just the address of an u8 local variable. Fix the coverity issue by changing the parameter to an unsigned int and pass the raw values from ni6501_dio_insn_config() and ni6501_dio_insn_bits(). ni6501_port_command() then handles the masking and shifting needed to load the value into the u8 transmit buffer. For consistency, change the access of the 'bitmap' parameter from an array access to a pointer operation. Reported-by: coverity (CID 1248624) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_usb6501.c | 27 +++++++++------------ 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_usb6501.c b/drivers/staging/comedi/drivers/ni_usb6501.c index 5f649f88d55c..88de8da3eff3 100644 --- a/drivers/staging/comedi/drivers/ni_usb6501.c +++ b/drivers/staging/comedi/drivers/ni_usb6501.c @@ -172,7 +172,7 @@ struct ni6501_private { }; static int ni6501_port_command(struct comedi_device *dev, int command, - const u8 *port, u8 *bitmap) + unsigned int val, u8 *bitmap) { struct usb_device *usb = comedi_to_usb_dev(dev); struct ni6501_private *devpriv = dev->private; @@ -190,22 +190,22 @@ static int ni6501_port_command(struct comedi_device *dev, int command, request_size = sizeof(READ_PORT_REQUEST); response_size = sizeof(READ_PORT_RESPONSE); memcpy(tx, READ_PORT_REQUEST, request_size); - tx[14] = port[0]; + tx[14] = val & 0xff; break; case WRITE_PORT: request_size = sizeof(WRITE_PORT_REQUEST); response_size = sizeof(GENERIC_RESPONSE); memcpy(tx, WRITE_PORT_REQUEST, request_size); - tx[14] = port[0]; - tx[17] = bitmap[0]; + tx[14] = val & 0xff; + tx[17] = *bitmap; break; case SET_PORT_DIR: request_size = sizeof(SET_PORT_DIR_REQUEST); response_size = sizeof(GENERIC_RESPONSE); memcpy(tx, SET_PORT_DIR_REQUEST, request_size); - tx[14] = port[0]; - tx[15] = port[1]; - tx[16] = port[2]; + tx[14] = val & 0xff; + tx[15] = (val >> 8) & 0xff; + tx[16] = (val >> 16) & 0xff; break; default: ret = -EINVAL; @@ -235,7 +235,7 @@ static int ni6501_port_command(struct comedi_device *dev, int command, /* Check if results are valid */ if (command == READ_PORT) { - bitmap[0] = devpriv->usb_rx_buf[14]; + *bitmap = devpriv->usb_rx_buf[14]; /* mask bitmap for comparing */ devpriv->usb_rx_buf[14] = 0x00; @@ -349,17 +349,12 @@ static int ni6501_dio_insn_config(struct comedi_device *dev, unsigned int *data) { int ret; - u8 port[3]; ret = comedi_dio_insn_config(dev, s, insn, data, 0); if (ret) return ret; - port[0] = (s->io_bits) & 0xff; - port[1] = (s->io_bits >> 8) & 0xff; - port[2] = (s->io_bits >> 16) & 0xff; - - ret = ni6501_port_command(dev, SET_PORT_DIR, port, NULL); + ret = ni6501_port_command(dev, SET_PORT_DIR, s->io_bits, NULL); if (ret) return ret; @@ -382,7 +377,7 @@ static int ni6501_dio_insn_bits(struct comedi_device *dev, if (mask & (0xFF << port * 8)) { bitmap = (s->state >> port * 8) & 0xFF; ret = ni6501_port_command(dev, WRITE_PORT, - &port, &bitmap); + port, &bitmap); if (ret) return ret; } @@ -391,7 +386,7 @@ static int ni6501_dio_insn_bits(struct comedi_device *dev, data[1] = 0; for (port = 0; port < 3; port++) { - ret = ni6501_port_command(dev, READ_PORT, &port, &bitmap); + ret = ni6501_port_command(dev, READ_PORT, port, &bitmap); if (ret) return ret; data[1] |= bitmap << port * 8; From d38c59e9ab203427f14ab6691529bac098adbacd Mon Sep 17 00:00:00 2001 From: Abhilash Jindal Date: Tue, 11 Aug 2015 10:31:53 -0400 Subject: [PATCH 775/912] staging: comedi: serial2002: Use monotonic clock Wall time obtained from do_gettimeofday is susceptible to sudden jumps due to user setting the time or due to NTP. Monotonic time is constantly increasing time better suited for comparing two timestamps. Signed-off-by: Abhilash Jindal Reviewed-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/serial2002.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index 83da162deb52..5f19374c460d 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -32,6 +32,7 @@ Status: in development #include #include #include +#include #include #include @@ -121,9 +122,9 @@ static int serial2002_tty_write(struct file *f, unsigned char *buf, int count) static void serial2002_tty_read_poll_wait(struct file *f, int timeout) { struct poll_wqueues table; - struct timeval start, now; + ktime_t start, now; - do_gettimeofday(&start); + start = ktime_get(); poll_initwait(&table); while (1) { long elapsed; @@ -134,9 +135,8 @@ static void serial2002_tty_read_poll_wait(struct file *f, int timeout) POLLHUP | POLLERR)) { break; } - do_gettimeofday(&now); - elapsed = 1000000 * (now.tv_sec - start.tv_sec) + - now.tv_usec - start.tv_usec; + now = ktime_get(); + elapsed = ktime_us_delta(now, start); if (elapsed > timeout) break; set_current_state(TASK_INTERRUPTIBLE); From ad88aae057b9f952f1cbd2f5df8325b95ba7bb75 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Sat, 8 Aug 2015 20:09:06 -0400 Subject: [PATCH 776/912] staging/lustre/llite: get rid of unused ll_super_blocks list ll_super_blocks became unused quite a while ago with switch to the new CLIO code. So this patch removes the list, ll_sb_lock spinlock that guards it and superblock info ll_list linkage. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/llite/llite_internal.h | 1 - drivers/staging/lustre/lustre/llite/llite_lib.c | 14 +------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index f097d4d167d5..ec2797478350 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -456,7 +456,6 @@ struct eacl_table { }; struct ll_sb_info { - struct list_head ll_list; /* this protects pglist and ra_info. It isn't safe to * grab from interrupt contexts */ spinlock_t ll_lock; diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 55e2dc6c1fbf..b4ed6c89af3d 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -60,9 +60,6 @@ struct kmem_cache *ll_file_data_slab; struct dentry *llite_root; struct kset *llite_kset; -static LIST_HEAD(ll_super_blocks); -static DEFINE_SPINLOCK(ll_sb_lock); - #ifndef log2 #define log2(n) ffz(~(n)) #endif @@ -112,10 +109,6 @@ static struct ll_sb_info *ll_init_sbi(struct super_block *sb) class_uuid_unparse(uuid, &sbi->ll_sb_uuid); CDEBUG(D_CONFIG, "generated uuid: %s\n", sbi->ll_sb_uuid.uuid); - spin_lock(&ll_sb_lock); - list_add_tail(&sbi->ll_list, &ll_super_blocks); - spin_unlock(&ll_sb_lock); - sbi->ll_flags |= LL_SBI_VERBOSE; sbi->ll_flags |= LL_SBI_CHECKSUM; @@ -144,12 +137,7 @@ static void ll_free_sbi(struct super_block *sb) { struct ll_sb_info *sbi = ll_s2sbi(sb); - if (sbi != NULL) { - spin_lock(&ll_sb_lock); - list_del(&sbi->ll_list); - spin_unlock(&ll_sb_lock); - kfree(sbi); - } + kfree(sbi); } static int client_common_fill_super(struct super_block *sb, char *md, char *dt, From 910bf1efe6f7f74b10e918768ddea3ad8b863f8b Mon Sep 17 00:00:00 2001 From: Tomas Melin Date: Sun, 9 Aug 2015 17:08:41 +0300 Subject: [PATCH 777/912] staging/most: fix return value for DIM_GetChannelState Return NULL instead of 0 for invalid input. Signed-off-by: Tomas Melin Acked-by: Christian Gromm Signed-off-by: Andrey Shvetsov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 01b748944ee4..a54cf2cedac3 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -889,7 +889,7 @@ struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, struct dim_ch_state_t *state_ptr) { if (!ch || !state_ptr) - return 0; + return NULL; state_ptr->ready = ch->state.level < 2; state_ptr->done_buffers = ch->done_sw_buffers_number; From ddb98ce16158cb979f025eb73eaa44dce4cb1b36 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:22 -0700 Subject: [PATCH 778/912] staging: most: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index d88b5a0e3244..8929af9712ef 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -108,13 +108,13 @@ bool DIM_DetachBuffers(struct dim_channel *ch, u16 buffers_number); u32 DIM_ReadRegister(u8 register_index); -extern u32 DIMCB_IoRead(u32 *ptr32); +u32 DIMCB_IoRead(u32 *ptr32); -extern void DIMCB_IoWrite(u32 *ptr32, u32 value); +void DIMCB_IoWrite(u32 *ptr32, u32 value); -extern void DIMCB_OnError(u8 error_id, const char *error_message); +void DIMCB_OnError(u8 error_id, const char *error_message); -extern void DIMCB_OnFail(const char *filename, int linenum); +void DIMCB_OnFail(const char *filename, int linenum); #ifdef __cplusplus From c942ea7a377edfde7a154f2edd8fde7cfea24de1 Mon Sep 17 00:00:00 2001 From: Adrian Remonda Date: Fri, 14 Aug 2015 12:18:00 +0200 Subject: [PATCH 779/912] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings This is a patch to the mostcore/core.c file. It makes several local functions and structures static to prevent global visibility. Signed-off-by: Adrian Remonda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/mostcore/core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index f4fea8cf5560..fa9c19b65a5c 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -178,7 +178,7 @@ static void most_free_mbo_coherent(struct mbo *mbo) * flush_channel_fifos - clear the channel fifos * @c: pointer to channel object */ -void flush_channel_fifos(struct most_c_obj *c) +static void flush_channel_fifos(struct most_c_obj *c) { unsigned long flags, hf_flags; struct mbo *mbo, *tmp; @@ -888,7 +888,7 @@ static ssize_t show_add_link(struct most_aim_obj *aim_obj, * Input: "mdev0:ch0@ep_81" * Output: *a -> "mdev0", *b -> "ch0@ep_81", *c == NULL */ -int split_string(char *buf, char **a, char **b, char **c) +static int split_string(char *buf, char **a, char **b, char **c) { *a = strsep(&buf, ":"); if (!*a) @@ -1006,7 +1006,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj, return len; } -struct most_aim_attribute most_aim_attr_add_link = +static struct most_aim_attribute most_aim_attr_add_link = __ATTR(add_link, S_IRUGO | S_IWUSR, show_add_link, store_add_link); static ssize_t show_remove_link(struct most_aim_obj *aim_obj, @@ -1057,7 +1057,7 @@ static ssize_t store_remove_link(struct most_aim_obj *aim_obj, return len; } -struct most_aim_attribute most_aim_attr_remove_link = +static struct most_aim_attribute most_aim_attr_remove_link = __ATTR(remove_link, S_IRUGO | S_IWUSR, show_remove_link, store_remove_link); static struct attribute *most_aim_def_attrs[] = { @@ -1121,14 +1121,14 @@ static void destroy_most_aim_obj(struct most_aim_obj *p) /** * Instantiation of the MOST bus */ -struct bus_type most_bus = { +static struct bus_type most_bus = { .name = "most", }; /** * Instantiation of the core driver */ -struct device_driver mostcore = { +static struct device_driver mostcore = { .name = "mostcore", .bus = &most_bus, }; @@ -1255,7 +1255,8 @@ static void arm_mbo(struct mbo *mbo) * * Returns the number of allocated and enqueued MBOs. */ -int arm_mbo_chain(struct most_c_obj *c, int dir, void (*compl)(struct mbo *)) +static int arm_mbo_chain(struct most_c_obj *c, int dir, + void (*compl)(struct mbo *)) { unsigned int i; int retval; From 04ca58372c5e4922d7463450ffdb5cdc3d0dd596 Mon Sep 17 00:00:00 2001 From: Adrian Remonda Date: Fri, 14 Aug 2015 12:18:01 +0200 Subject: [PATCH 780/912] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings This patch fixes the warning generated by sparse: "Using plain integer as NULL pointer" by replacing the pointer test against 0 with a logical test. Signed-off-by: Adrian Remonda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/mostcore/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index fa9c19b65a5c..7bb16db42893 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -982,7 +982,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj, if (ret) return ret; - if (mdev_devnod == 0 || *mdev_devnod == 0) { + if (!mdev_devnod || *mdev_devnod == 0) { snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, mdev_ch); mdev_devnod = devnod_buf; } From 23fe15fadf708c562140cd99e4dfd400afc5db8a Mon Sep 17 00:00:00 2001 From: Adrian Remonda Date: Fri, 14 Aug 2015 12:18:02 +0200 Subject: [PATCH 781/912] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings This is a patch to the most/hdm-usb/hdm_usb.c file. It makes several local functions and structures static to prevent global visibility. Signed-off-by: Adrian Remonda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-usb/hdm_usb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c index 514ce3529b7a..305303f2f17c 100644 --- a/drivers/staging/most/hdm-usb/hdm_usb.c +++ b/drivers/staging/most/hdm-usb/hdm_usb.c @@ -290,7 +290,7 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg) * * Returns 0 on success or error code otherwise. */ -int hdm_poison_channel(struct most_interface *iface, int channel) +static int hdm_poison_channel(struct most_interface *iface, int channel) { struct most_dev *mdev; @@ -328,7 +328,7 @@ int hdm_poison_channel(struct most_interface *iface, int channel) * This inserts the INIC hardware specific padding bytes into a streaming * channel's buffer */ -int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo) +static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo) { struct most_channel_config *conf = &mdev->conf[channel]; unsigned int j, num_frames, frame_size; @@ -365,7 +365,7 @@ int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo) * This takes the INIC hardware specific padding bytes off a streaming * channel's buffer. */ -int hdm_remove_padding(struct most_dev *mdev, int channel, struct mbo *mbo) +static int hdm_remove_padding(struct most_dev *mdev, int channel, struct mbo *mbo) { unsigned int j, num_frames, frame_size; struct most_channel_config *const conf = &mdev->conf[channel]; @@ -644,7 +644,7 @@ static void hdm_read_completion(struct urb *urb) * * Context: Could in _some_ cases be interrupt! */ -int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo) +static int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo) { struct most_dev *mdev; struct buf_anchor *anchor; @@ -743,8 +743,8 @@ _error: * @channel: channel ID * @conf: structure that holds the configuration information */ -int hdm_configure_channel(struct most_interface *iface, int channel, - struct most_channel_config *conf) +static int hdm_configure_channel(struct most_interface *iface, int channel, + struct most_channel_config *conf) { unsigned int num_frames; unsigned int frame_size; @@ -824,7 +824,7 @@ exit: * This triggers the USB vendor requests to read the hardware address and * the current link status of the attached device. */ -int hdm_update_netinfo(struct most_dev *mdev) +static int hdm_update_netinfo(struct most_dev *mdev) { struct device *dev = &mdev->usb_device->dev; int i; @@ -873,7 +873,7 @@ int hdm_update_netinfo(struct most_dev *mdev) * polls for the NI state of the INIC every 2 seconds. * */ -void hdm_request_netinfo(struct most_interface *iface, int channel) +static void hdm_request_netinfo(struct most_interface *iface, int channel) { struct most_dev *mdev; From 5132fcd1fb55eddf04c7a06ede75723d7870b797 Mon Sep 17 00:00:00 2001 From: Adrian Remonda Date: Fri, 14 Aug 2015 12:18:04 +0200 Subject: [PATCH 782/912] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings This is a patch to the most/aim_cdev.c file. It makes several local functions and structures static to prevent global visibility. Signed-off-by: Adrian Remonda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-cdev/cdev.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c index 252a17cf153c..0a13d8d0fa39 100644 --- a/drivers/staging/most/aim-cdev/cdev.c +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -49,7 +49,7 @@ static struct list_head channel_list; static spinlock_t ch_list_lock; -struct aim_channel *get_channel(struct most_interface *iface, int id) +static struct aim_channel *get_channel(struct most_interface *iface, int id) { struct aim_channel *channel, *tmp; unsigned long flags; @@ -289,7 +289,7 @@ static const struct file_operations channel_fops = { * This frees allocated memory and removes the cdev that represents this * channel in user space. */ -int aim_disconnect_channel(struct most_interface *iface, int channel_id) +static int aim_disconnect_channel(struct most_interface *iface, int channel_id) { struct aim_channel *channel; unsigned long flags; @@ -329,7 +329,7 @@ int aim_disconnect_channel(struct most_interface *iface, int channel_id) * This searches for the channel linked to this MBO and stores it in the local * fifo buffer. */ -int aim_rx_completion(struct mbo *mbo) +static int aim_rx_completion(struct mbo *mbo) { struct aim_channel *channel; @@ -356,7 +356,7 @@ int aim_rx_completion(struct mbo *mbo) * * This wakes sleeping processes in the wait-queue. */ -int aim_tx_completion(struct most_interface *iface, int channel_id) +static int aim_tx_completion(struct most_interface *iface, int channel_id) { struct aim_channel *channel; @@ -376,7 +376,7 @@ int aim_tx_completion(struct most_interface *iface, int channel_id) return 0; } -struct most_aim cdev_aim; +static struct most_aim cdev_aim; /** * aim_probe - probe function of the driver module @@ -390,9 +390,9 @@ struct most_aim cdev_aim; * * Returns 0 on success or error code otherwise. */ -int aim_probe(struct most_interface *iface, int channel_id, - struct most_channel_config *cfg, - struct kobject *parent, char *name) +static int aim_probe(struct most_interface *iface, int channel_id, + struct most_channel_config *cfg, + struct kobject *parent, char *name) { struct aim_channel *channel; unsigned long cl_flags; @@ -463,7 +463,7 @@ error_alloc_channel: return retval; } -struct most_aim cdev_aim = { +static struct most_aim cdev_aim = { .name = "cdev", .probe_channel = aim_probe, .disconnect_channel = aim_disconnect_channel, From d98d2ccb4ceb4f28408299d1cc3846ab6be7ec52 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:20 -0700 Subject: [PATCH 783/912] staging: iio: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Acked-by: Lars-Peter Clausen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7854.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/meter/ade7854.h b/drivers/staging/iio/meter/ade7854.h index 52ca5412a18d..52f4195cf6f4 100644 --- a/drivers/staging/iio/meter/ade7854.h +++ b/drivers/staging/iio/meter/ade7854.h @@ -168,7 +168,7 @@ struct ade7854_state { }; -extern int ade7854_probe(struct iio_dev *indio_dev, struct device *dev); -extern int ade7854_remove(struct iio_dev *indio_dev); +int ade7854_probe(struct iio_dev *indio_dev, struct device *dev); +int ade7854_remove(struct iio_dev *indio_dev); #endif From 2f3403ac2cdd7d76c531c5b3cf16b05d7a554f18 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 11 Aug 2015 13:18:18 +0300 Subject: [PATCH 784/912] Staging: iio: trigger: Alignment should match open parenthesis Fix alignment for function parameters as suggested by checkpatch.pl. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 7 ++++--- drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c index 3c1c8c6c4a6c..9fe48ef11473 100644 --- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c +++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c @@ -79,7 +79,8 @@ static int iio_bfin_tmr_set_state(struct iio_trigger *trig, bool state) } static ssize_t iio_bfin_tmr_frequency_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) + struct device_attribute *attr, + const char *buf, size_t count) { struct iio_trigger *trig = to_iio_trigger(dev); struct bfin_tmr_state *st = iio_trigger_get_drvdata(trig); @@ -116,8 +117,8 @@ static ssize_t iio_bfin_tmr_frequency_store(struct device *dev, } static ssize_t iio_bfin_tmr_frequency_show(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { struct iio_trigger *trig = to_iio_trigger(dev); struct bfin_tmr_state *st = iio_trigger_get_drvdata(trig); diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c index 0c1976ddee74..a2a42c292211 100644 --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c @@ -37,7 +37,7 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state) if (trig_info->frequency == 0 && state) return -EINVAL; dev_dbg(&trig_info->rtc->dev, "trigger frequency is %u\n", - trig_info->frequency); + trig_info->frequency); ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, state); if (ret == 0) trig_info->state = state; From c71e16ef7a2b4c5251cef74b1065fbb76bb14d09 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 11 Aug 2015 13:20:53 +0300 Subject: [PATCH 785/912] Staging: iio: trigger: Use braces on both branches of if statement Fix style issue related to missing braces, detected by checkpatch.pl. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c index a2a42c292211..2db885750fb8 100644 --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c @@ -74,8 +74,9 @@ static ssize_t iio_trig_periodic_write_freq(struct device *dev, if (ret == 0 && trig_info->state && trig_info->frequency == 0) ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, 1); - } else + } else { ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, 0); + } if (ret) goto error_ret; From d30649a8b61843bed98f772954e490b75cae2713 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:16 -0700 Subject: [PATCH 786/912] staging: android: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/sync.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index a21b79fb4c8e..61f8a3aede96 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -337,11 +337,11 @@ int sync_fence_wait(struct sync_fence *fence, long timeout); #ifdef CONFIG_DEBUG_FS -extern void sync_timeline_debug_add(struct sync_timeline *obj); -extern void sync_timeline_debug_remove(struct sync_timeline *obj); -extern void sync_fence_debug_add(struct sync_fence *fence); -extern void sync_fence_debug_remove(struct sync_fence *fence); -extern void sync_dump(void); +void sync_timeline_debug_add(struct sync_timeline *obj); +void sync_timeline_debug_remove(struct sync_timeline *obj); +void sync_fence_debug_add(struct sync_fence *fence); +void sync_fence_debug_remove(struct sync_fence *fence); +void sync_dump(void); #else # define sync_timeline_debug_add(obj) From f0f621ca7bac142ecc0516f91ed1199d9c374ff8 Mon Sep 17 00:00:00 2001 From: Mike Rapoport Date: Wed, 12 Aug 2015 21:08:50 +0300 Subject: [PATCH 787/912] staging: android: update TODO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove "make sure things build as modules properly" - remove kuid_t related remarks, they were relevant for logger, but it is gone half year ago - remove dead e-mail address of Brian Swetland - add e-mail addresses of Arve Hjønnevåg and Riley Andrews Signed-off-by: Mike Rapoport Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/TODO | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO index 06954cdf3dba..20288fc53946 100644 --- a/drivers/staging/android/TODO +++ b/drivers/staging/android/TODO @@ -2,16 +2,8 @@ TODO: - checkpatch.pl cleanups - sparse fixes - rename files to be not so "generic" - - make sure things build as modules properly - add proper arch dependencies as needed - audit userspace interfaces to make sure they are sane - - kuid_t should never be exposed to user space as it is - kernel internal type. Data structure for this kuid_t is: - typedef struct { - uid_t val; - } kuid_t; - - This bug is introduced by Xiong Zhou in the patch bd471258f2e09 - - ("staging: android: logger: use kuid_t instead of uid_t") Please send patches to Greg Kroah-Hartman and Cc: -Brian Swetland +Arve Hjønnevåg and Riley Andrews From f7f2c183043a79e1c6115c69314e3d0d2c5e061f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:24 -0700 Subject: [PATCH 788/912] staging: netlogic: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/netlogic/xlr_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/netlogic/xlr_net.h b/drivers/staging/netlogic/xlr_net.h index 13e03f0a0a46..2f65ec5a615c 100644 --- a/drivers/staging/netlogic/xlr_net.h +++ b/drivers/staging/netlogic/xlr_net.h @@ -1102,4 +1102,4 @@ struct xlr_net_priv { u64 *class_3_spill; }; -extern void xlr_set_gmac_speed(struct xlr_net_priv *priv); +void xlr_set_gmac_speed(struct xlr_net_priv *priv); From e4fde76b1667e86bf016f33c3ada33332e586b0d Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:27 -0700 Subject: [PATCH 789/912] staging: olpc_dcon: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/olpc_dcon/olpc_dcon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/olpc_dcon/olpc_dcon.h b/drivers/staging/olpc_dcon/olpc_dcon.h index aec98958f795..d06e19db1b80 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.h +++ b/drivers/staging/olpc_dcon/olpc_dcon.h @@ -98,7 +98,7 @@ struct dcon_platform_data { #include -extern irqreturn_t dcon_interrupt(int irq, void *id); +irqreturn_t dcon_interrupt(int irq, void *id); #ifdef CONFIG_FB_OLPC_DCON_1 extern struct dcon_platform_data dcon_pdata_xo_1; From ad9f92d2700d19cd680dbfdb5da3859d10f534d1 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:32 -0700 Subject: [PATCH 790/912] staging: speakup: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignments Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/i18n.h | 12 +++--- drivers/staging/speakup/speakup.h | 68 +++++++++++++++---------------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/drivers/staging/speakup/i18n.h b/drivers/staging/speakup/i18n.h index 326d086f9d5a..8fcce566653f 100644 --- a/drivers/staging/speakup/i18n.h +++ b/drivers/staging/speakup/i18n.h @@ -224,11 +224,11 @@ struct msg_group_t { enum msg_index_t end; }; -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); +char *spk_msg_get(enum msg_index_t index); +ssize_t spk_msg_set(enum msg_index_t index, char *text, size_t length); +struct msg_group_t *spk_find_msg_group(const char *group_name); +void spk_reset_msg_group(struct msg_group_t *group); +void spk_initialize_msgs(void); +void spk_free_user_msgs(void); #endif diff --git a/drivers/staging/speakup/speakup.h b/drivers/staging/speakup/speakup.h index a7f4962427f3..df74c912da72 100644 --- a/drivers/staging/speakup/speakup.h +++ b/drivers/staging/speakup/speakup.h @@ -42,46 +42,44 @@ #define IS_CHAR(x, type) (spk_chartab[((u_char)x)]&type) #define IS_TYPE(x, type) ((spk_chartab[((u_char)x)]&type) == type) -extern int speakup_thread(void *data); -extern void spk_reset_default_chars(void); -extern void spk_reset_default_chartab(void); -extern void synth_start(void); +int speakup_thread(void *data); +void spk_reset_default_chars(void); +void spk_reset_default_chartab(void); +void synth_start(void); void synth_insert_next_index(int sent_num); 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 *spk_s2uchar(char *start, char *dest); -extern int speakup_kobj_init(void); -extern void speakup_kobj_exit(void); -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 *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); +int spk_set_key_info(const u_char *key_info, u_char *k_buffer); +char *spk_strlwr(char *s); +char *spk_s2uchar(char *start, char *dest); +int speakup_kobj_init(void); +void speakup_kobj_exit(void); +int spk_chartab_get_value(char *keyword); +void speakup_register_var(struct var_t *var); +void speakup_unregister_var(enum var_id_t var_id); +struct st_var_header *spk_get_var_header(enum var_id_t var_id); +struct st_var_header *spk_var_header_by_name(const char *name); +struct punc_var_t *spk_get_punc_var(enum var_id_t var_id); +int spk_set_num_var(int val, struct st_var_header *var, int how); +int spk_set_string_var(const char *page, struct st_var_header *var, int len); +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); +int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key); +int synth_init(char *name); +void synth_release(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); -extern void speakup_clear_selection(void); -extern int speakup_set_selection(struct tty_struct *tty); -extern int speakup_paste_selection(struct tty_struct *tty); -extern void speakup_cancel_paste(void); -extern void speakup_register_devsynth(void); -extern void speakup_unregister_devsynth(void); -extern void synth_write(const char *buf, size_t count); -extern int synth_supports_indexing(void); +void spk_do_flush(void); +void speakup_start_ttys(void); +void synth_buffer_add(char ch); +void synth_buffer_clear(void); +void speakup_clear_selection(void); +int speakup_set_selection(struct tty_struct *tty); +int speakup_paste_selection(struct tty_struct *tty); +void speakup_cancel_paste(void); +void speakup_register_devsynth(void); +void speakup_unregister_devsynth(void); +void synth_write(const char *buf, size_t count); +int synth_supports_indexing(void); extern struct vc_data *spk_sel_cons; extern unsigned short spk_xs, spk_ys, spk_xe, spk_ye; /* our region points */ From 13d825edd4441dd3453de58d1bd2ade44d5ad2ab Mon Sep 17 00:00:00 2001 From: Aleksei Fedotov Date: Fri, 14 Aug 2015 22:34:37 +0300 Subject: [PATCH 791/912] staging: speakup: Fix warning reported by checkpatch This patch fixes the checkpatch.pl warnings: WARNING: Block comments use a trailing */ on a separate line WARNING: Block comments use * on subsequent lines Signed-off-by: Aleksey Fedotov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/buffers.c | 3 +- drivers/staging/speakup/i18n.c | 3 +- drivers/staging/speakup/kobjects.c | 3 +- drivers/staging/speakup/main.c | 15 ++++--- drivers/staging/speakup/selection.c | 3 +- drivers/staging/speakup/serialio.c | 10 +++-- drivers/staging/speakup/speakup_acnt.h | 8 ++-- drivers/staging/speakup/speakup_decpc.c | 6 +-- drivers/staging/speakup/speakup_dtlk.h | 52 ++++++++++++++----------- drivers/staging/speakup/speakup_soft.c | 1 - drivers/staging/speakup/thread.c | 3 +- drivers/staging/speakup/varhandlers.c | 3 +- 12 files changed, 66 insertions(+), 44 deletions(-) diff --git a/drivers/staging/speakup/buffers.c b/drivers/staging/speakup/buffers.c index d45c8afb041d..d4d45989b605 100644 --- a/drivers/staging/speakup/buffers.c +++ b/drivers/staging/speakup/buffers.c @@ -63,7 +63,8 @@ void synth_buffer_add(char ch) { if (!synth->alive) { /* This makes sure that we won't stop TTYs if there is no synth - * to restart them */ + * to restart them + */ return; } if (synth_buffer_free() <= 100) { diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c index 9ea16c5b4d6c..f061747546a6 100644 --- a/drivers/staging/speakup/i18n.c +++ b/drivers/staging/speakup/i18n.c @@ -1,5 +1,6 @@ /* Internationalization implementation. Includes definitions of English - * string arrays, and the i18n pointer. */ + * string arrays, and the i18n pointer. + */ #include /* For kmalloc. */ #include diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 0211df60004a..958add4839bc 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -240,7 +240,8 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr, cp += sprintf(cp, "%d, %d, %d,\n", KEY_MAP_VER, num_keys, nstates); cp1 += 2; /* now pointing at shift states */ /* dump num_keys+1 as first row is shift states + flags, - * each subsequent row is key + states */ + * each subsequent row is key + states + */ for (n = 0; n <= num_keys; n++) { for (i = 0; i <= nstates; i++) { ch = *cp1++; diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index 6c4f9a1ed07f..63c59bc89b04 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -128,7 +128,8 @@ static char *phonetic[] = { /* array of 256 char pointers (one for each character description) * initialized to default_chars and user selectable via - * /proc/speakup/characters */ + * /proc/speakup/characters + */ char *spk_characters[256]; char *spk_default_chars[256] = { @@ -194,7 +195,8 @@ char *spk_default_chars[256] = { /* array of 256 u_short (one for each character) * initialized to default_chartab and user selectable via - * /sys/module/speakup/parameters/chartab */ + * /sys/module/speakup/parameters/chartab + */ u_short spk_chartab[256]; static u_short default_chartab[256] = { @@ -540,7 +542,8 @@ static void say_next_char(struct vc_data *vc) * 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 - * beginning off the line whichever comes first.. */ + * beginning off the line whichever comes first.. + */ static u_long get_word(struct vc_data *vc) { @@ -1113,7 +1116,8 @@ static void spkup_write(const char *in_buf, int count) * suppress multiple to get rid of long pauses and * clear repeat count * so if someone has - * repeats on you don't get nothing repeated count */ + * repeats on you don't get nothing repeated count + */ if (ch != old_ch) synth_printf("%c", ch); else @@ -1509,7 +1513,8 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) 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 */ + * moves regardless of no_inter state + */ is_cursor = value + 1; old_cursor_pos = vc->vc_pos; old_cursor_x = vc->vc_x; diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c index a0315701c7d9..98af3b1f2d2a 100644 --- a/drivers/staging/speakup/selection.c +++ b/drivers/staging/speakup/selection.c @@ -114,7 +114,8 @@ int speakup_set_selection(struct tty_struct *tty) obp = bp; if (!((i + 2) % vc->vc_size_row)) { /* strip trailing blanks from line and add newline, - unless non-space at end of line. */ + * unless non-space at end of line. + */ if (obp != bp) { bp = obp; *bp++ = '\r'; diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index 1d9d51bdf517..66ac999a0323 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -51,7 +51,8 @@ const struct old_serial_port *spk_serial_init(int index) } /* Disable UART interrupts, set DTR and RTS high - * and set speed. */ + * and set speed. + */ outb(cval | UART_LCR_DLAB, ser->port + UART_LCR); /* set DLAB */ outb(quot & 0xff, ser->port + UART_DLL); /* LS of divisor */ outb(quot >> 8, ser->port + UART_DLM); /* MS of divisor */ @@ -145,7 +146,8 @@ int spk_wait_for_xmitr(void) synth->alive = 0; /* No synth any more, so nobody will restart TTYs, and we thus * need to do it ourselves. Now that there is no synth we can - * let application flood anyway */ + * let application flood anyway + */ speakup_start_ttys(); timeouts = 0; return 0; @@ -163,7 +165,8 @@ int spk_wait_for_xmitr(void) /* CTS */ if (--tmout == 0) { /* pr_warn("%s: timed out (cts)\n", - * synth->long_name); */ + * synth->long_name); + */ timeouts++; return 0; } @@ -217,4 +220,3 @@ void spk_serial_release(void) speakup_info.port_tts = 0; } EXPORT_SYMBOL_GPL(spk_serial_release); - diff --git a/drivers/staging/speakup/speakup_acnt.h b/drivers/staging/speakup/speakup_acnt.h index 6376fca9e0e1..107ec1155f51 100644 --- a/drivers/staging/speakup/speakup_acnt.h +++ b/drivers/staging/speakup/speakup_acnt.h @@ -6,10 +6,12 @@ /* Port Status Flags */ #define SYNTH_READABLE 0x01 /* mask for bit which is nonzero if a - byte can be read from the data port */ + * byte can be read from the data port + */ #define SYNTH_WRITABLE 0x02 /* mask for RDY bit, which when set to - 1, indicates the data port is ready - to accept a byte of data. */ + * 1, indicates the data port is ready + * to accept a byte of data. + */ #define SYNTH_QUIET 'S' /* synth is not speaking */ #define SYNTH_FULL 'F' /* synth is full. */ #define SYNTH_ALMOST_EMPTY 'M' /* synth has less than 2 seconds of text left */ diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c index 437e13a85943..4893fef3f894 100644 --- a/drivers/staging/speakup/speakup_decpc.c +++ b/drivers/staging/speakup/speakup_decpc.c @@ -88,8 +88,9 @@ #define CTRL_last_index 0x0b00 /* get last index spoken */ #define CTRL_io_priority 0x0c00 /* change i/o priority */ #define CTRL_free_mem 0x0d00 /* get free paragraphs on module */ -#define CTRL_get_lang 0x0e00 /* return bit mask of loaded - * languages */ +#define CTRL_get_lang 0x0e00 /* return bit mask of loaded + * languages + */ #define CMD_test 0x2000 /* self-test request */ #define TEST_mask 0x0F00 /* isolate test field */ #define TEST_null 0x0000 /* no test requested */ @@ -500,4 +501,3 @@ MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for DECtalk PC synthesizers"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); - diff --git a/drivers/staging/speakup/speakup_dtlk.h b/drivers/staging/speakup/speakup_dtlk.h index d951d18c5792..46d885fcfb20 100644 --- a/drivers/staging/speakup/speakup_dtlk.h +++ b/drivers/staging/speakup/speakup_dtlk.h @@ -4,31 +4,37 @@ #define SYNTH_CLEAR 0x18 /* stops speech */ /* TTS Port Status Flags */ #define TTS_READABLE 0x80 /* mask for bit which is nonzero if a - byte can be read from the TTS port */ + * byte can be read from the TTS port + */ #define TTS_SPEAKING 0x40 /* mask for SYNC bit, which is nonzero - while DoubleTalk is producing - output with TTS, PCM or CVSD - synthesizers or tone generators - (that is, all but LPC) */ + * while DoubleTalk is producing + * output with TTS, PCM or CVSD + * synthesizers or tone generators + * (that is, all but LPC) + */ #define TTS_SPEAKING2 0x20 /* mask for SYNC2 bit, - which falls to zero up to 0.4 sec - before speech stops */ + * which falls to zero up to 0.4 sec + * before speech stops + */ #define TTS_WRITABLE 0x10 /* mask for RDY bit, which when set to - 1, indicates the TTS port is ready - to accept a byte of data. The RDY - bit goes zero 2-3 usec after - writing, and goes 1 again 180-190 - usec later. */ + * 1, indicates the TTS port is ready + * to accept a byte of data. The RDY + * bit goes zero 2-3 usec after + * writing, and goes 1 again 180-190 + * usec later. + */ #define TTS_ALMOST_FULL 0x08 /* mask for AF bit: When set to 1, - indicates that less than 300 bytes - are available in the TTS input - buffer. AF is always 0 in the PCM, - TGN and CVSD modes. */ + * indicates that less than 300 bytes + * are available in the TTS input + * buffer. AF is always 0 in the PCM, + * TGN and CVSD modes. + */ #define TTS_ALMOST_EMPTY 0x04 /* mask for AE bit: When set to 1, - indicates that less than 300 bytes - are remaining in DoubleTalk's input - (TTS or PCM) buffer. AE is always 1 - in the TGN and CVSD modes. */ + * indicates that less than 300 bytes + * are remaining in DoubleTalk's input + * (TTS or PCM) buffer. AE is always 1 + * in the TGN and CVSD modes. + */ /* data returned by Interrogate command */ struct synth_settings { @@ -45,10 +51,12 @@ struct synth_settings { u_char ext_dict_loaded; /* 1=exception dictionary loaded */ u_char ext_dict_status; /* 1=exception dictionary enabled */ u_char free_ram; /* # pages (truncated) remaining for - * text buffer */ + * text buffer + */ u_char articulation; /* nA; 0-9 */ u_char reverb; /* nR; 0-9 */ u_char eob; /* 7Fh value indicating end of - * parameter block */ + * parameter block + */ u_char has_indexing; /* nonzero if indexing is implemented */ }; diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c index fb31bb95d83a..366358b600a1 100644 --- a/drivers/staging/speakup/speakup_soft.c +++ b/drivers/staging/speakup/speakup_soft.c @@ -356,4 +356,3 @@ MODULE_AUTHOR("Kirk Reiser "); MODULE_DESCRIPTION("Speakup userspace software synthesizer support"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); - diff --git a/drivers/staging/speakup/thread.c b/drivers/staging/speakup/thread.c index d95efb702fe4..90c383ee7c3f 100644 --- a/drivers/staging/speakup/thread.c +++ b/drivers/staging/speakup/thread.c @@ -48,7 +48,8 @@ int speakup_thread(void *data) kd_mksound(our_sound.freq, our_sound.jiffies); if (synth && synth->catch_up && synth->alive) { /* It is up to the callee to take the lock, so that it - * can sleep whenever it likes */ + * can sleep whenever it likes + */ synth->catch_up(synth); } diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index 1b0d1c08741f..75bf40c14c79 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c @@ -269,7 +269,8 @@ int spk_set_string_var(const char *page, struct st_var_header *var, int len) /* 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 */ + * 1 clears allk, 2 sets bits for chars + */ int spk_set_mask_bits(const char *input, const int which, const int how) { u_char *cp; From 2afc5d49d03ffcd36ef5a50a52709539911ceb00 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:01 -0700 Subject: [PATCH 792/912] staging: comedi: addi_tcw.h: prefer using the BIT macro Use the BIT macro to define the register bits. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_tcw.h | 48 +++++++++++------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_tcw.h b/drivers/staging/comedi/drivers/addi_tcw.h index 8794d4cbbfb0..547f503e82b7 100644 --- a/drivers/staging/comedi/drivers/addi_tcw.h +++ b/drivers/staging/comedi/drivers/addi_tcw.h @@ -10,44 +10,44 @@ #define ADDI_TCW_VAL_REG 0x00 #define ADDI_TCW_SYNC_REG 0x00 -#define ADDI_TCW_SYNC_CTR_TRIG (1 << 8) -#define ADDI_TCW_SYNC_CTR_DIS (1 << 7) -#define ADDI_TCW_SYNC_CTR_ENA (1 << 6) -#define ADDI_TCW_SYNC_TIMER_TRIG (1 << 5) -#define ADDI_TCW_SYNC_TIMER_DIS (1 << 4) -#define ADDI_TCW_SYNC_TIMER_ENA (1 << 3) -#define ADDI_TCW_SYNC_WDOG_TRIG (1 << 2) -#define ADDI_TCW_SYNC_WDOG_DIS (1 << 1) -#define ADDI_TCW_SYNC_WDOG_ENA (1 << 0) +#define ADDI_TCW_SYNC_CTR_TRIG BIT(8) +#define ADDI_TCW_SYNC_CTR_DIS BIT(7) +#define ADDI_TCW_SYNC_CTR_ENA BIT(6) +#define ADDI_TCW_SYNC_TIMER_TRIG BIT(5) +#define ADDI_TCW_SYNC_TIMER_DIS BIT(4) +#define ADDI_TCW_SYNC_TIMER_ENA BIT(3) +#define ADDI_TCW_SYNC_WDOG_TRIG BIT(2) +#define ADDI_TCW_SYNC_WDOG_DIS BIT(1) +#define ADDI_TCW_SYNC_WDOG_ENA BIT(0) #define ADDI_TCW_RELOAD_REG 0x04 #define ADDI_TCW_TIMEBASE_REG 0x08 #define ADDI_TCW_CTRL_REG 0x0c -#define ADDI_TCW_CTRL_EXT_CLK_STATUS (1 << 21) -#define ADDI_TCW_CTRL_CASCADE (1 << 20) -#define ADDI_TCW_CTRL_CNTR_ENA (1 << 19) -#define ADDI_TCW_CTRL_CNT_UP (1 << 18) +#define ADDI_TCW_CTRL_EXT_CLK_STATUS BIT(21) +#define ADDI_TCW_CTRL_CASCADE BIT(20) +#define ADDI_TCW_CTRL_CNTR_ENA BIT(19) +#define ADDI_TCW_CTRL_CNT_UP BIT(18) #define ADDI_TCW_CTRL_EXT_CLK(x) ((x) << 16) #define ADDI_TCW_CTRL_OUT(x) ((x) << 11) -#define ADDI_TCW_CTRL_GATE (1 << 10) -#define ADDI_TCW_CTRL_TRIG (1 << 9) +#define ADDI_TCW_CTRL_GATE BIT(10) +#define ADDI_TCW_CTRL_TRIG BIT(9) #define ADDI_TCW_CTRL_EXT_GATE(x) ((x) << 7) #define ADDI_TCW_CTRL_EXT_TRIG(x) ((x) << 5) -#define ADDI_TCW_CTRL_TIMER_ENA (1 << 4) -#define ADDI_TCW_CTRL_RESET_ENA (1 << 3) -#define ADDI_TCW_CTRL_WARN_ENA (1 << 2) -#define ADDI_TCW_CTRL_IRQ_ENA (1 << 1) -#define ADDI_TCW_CTRL_ENA (1 << 0) +#define ADDI_TCW_CTRL_TIMER_ENA BIT(4) +#define ADDI_TCW_CTRL_RESET_ENA BIT(3) +#define ADDI_TCW_CTRL_WARN_ENA BIT(2) +#define ADDI_TCW_CTRL_IRQ_ENA BIT(1) +#define ADDI_TCW_CTRL_ENA BIT(0) #define ADDI_TCW_STATUS_REG 0x10 -#define ADDI_TCW_STATUS_SOFT_CLR (1 << 3) -#define ADDI_TCW_STATUS_SOFT_TRIG (1 << 1) -#define ADDI_TCW_STATUS_OVERFLOW (1 << 0) +#define ADDI_TCW_STATUS_SOFT_CLR BIT(3) +#define ADDI_TCW_STATUS_SOFT_TRIG BIT(1) +#define ADDI_TCW_STATUS_OVERFLOW BIT(0) #define ADDI_TCW_IRQ_REG 0x14 -#define ADDI_TCW_IRQ (1 << 0) +#define ADDI_TCW_IRQ BIT(0) #define ADDI_TCW_WARN_TIMEVAL_REG 0x18 From d5387751c34a6a02d715e4885239a05563a418b8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:02 -0700 Subject: [PATCH 793/912] staging: comedi: hwdrv_apci1564: remove unused defines These defines are not used. Remove them. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index fa99c8ca4f95..9c19648b003a 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -12,11 +12,6 @@ #define APCI1564_DO_CC_INT_ENABLE 0x2 #define APCI1564_DO_CC_INT_DISABLE 0xfffffffd -/* TIMER COUNTER WATCHDOG DEFINES */ -#define ADDIDATA_TIMER 0 -#define ADDIDATA_COUNTER 1 -#define ADDIDATA_WATCHDOG 2 - static int apci1564_timer_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, From 59c8f0dd76ac1358086ac79e177791683b1823d0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:03 -0700 Subject: [PATCH 794/912] staging: comedi: addi_apci_1564: define the APCI1564_DO_INT_CTRL_REG bits Define the bits in this register. Remove the old defines in hwdrv_apci1564.c. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 6 ------ drivers/staging/comedi/drivers/addi_apci_1564.c | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 9c19648b003a..42a87b789f53 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -6,12 +6,6 @@ #define APCI1564_DI_INT_ENABLE 0x4 #define APCI1564_DI_INT_DISABLE 0xfffffffb -/* Digital Output Interrupt Enable Disable. */ -#define APCI1564_DO_VCC_INT_ENABLE 0x1 -#define APCI1564_DO_VCC_INT_DISABLE 0xfffffffe -#define APCI1564_DO_CC_INT_ENABLE 0x2 -#define APCI1564_DO_CC_INT_DISABLE 0xfffffffd - static int apci1564_timer_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index 33e58b9a21b2..873e329f4bfd 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -81,6 +81,8 @@ #define APCI1564_DI_IRQ_REG 0x10 #define APCI1564_DO_REG 0x14 #define APCI1564_DO_INT_CTRL_REG 0x18 +#define APCI1564_DO_INT_CTRL_CC_INT_ENA BIT(1) +#define APCI1564_DO_INT_CTRL_VCC_INT_ENA BIT(0) #define APCI1564_DO_INT_STATUS_REG 0x1c #define APCI1564_DO_IRQ_REG 0x20 #define APCI1564_WDOG_REG 0x24 From fa1219e03e73fb1ebba87eeb2aa1edbea518622d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:04 -0700 Subject: [PATCH 795/912] staging: comedi: addi_apci_1564: define the APCI1564_DO_INT_STATUS_REG bits Define the bits in this register. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1564.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index 873e329f4bfd..3e8377a3b67b 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -84,6 +84,8 @@ #define APCI1564_DO_INT_CTRL_CC_INT_ENA BIT(1) #define APCI1564_DO_INT_CTRL_VCC_INT_ENA BIT(0) #define APCI1564_DO_INT_STATUS_REG 0x1c +#define APCI1564_DO_INT_STATUS_CC BIT(1) +#define APCI1564_DO_INT_STATUS_VCC BIT(0) #define APCI1564_DO_IRQ_REG 0x20 #define APCI1564_WDOG_REG 0x24 #define APCI1564_WDOG_RELOAD_REG 0x28 From dbaa1490f989380b2e7a492d324441cc917628cb Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:05 -0700 Subject: [PATCH 796/912] staging: comedi: addi_apci_1564: define the APCI1564_DO_IRQ_REG bits Define the bits in this register. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1564.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index 3e8377a3b67b..2664bfa7b8f1 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -87,6 +87,7 @@ #define APCI1564_DO_INT_STATUS_CC BIT(1) #define APCI1564_DO_INT_STATUS_VCC BIT(0) #define APCI1564_DO_IRQ_REG 0x20 +#define APCI1564_DO_IRQ_INTR BIT(0) #define APCI1564_WDOG_REG 0x24 #define APCI1564_WDOG_RELOAD_REG 0x28 #define APCI1564_WDOG_TIMEBASE_REG 0x2c From 9f750d15a1d8387605745c89c21cf46d4ddd4cd0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:06 -0700 Subject: [PATCH 797/912] staging: comedi: addi_apci_1564: define the APCI1564_DI_IRQ_REG bits Define the bits in this register. Remove the old defines in hwdrv_apci1564.c. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci1564.c | 8 -------- .../staging/comedi/drivers/addi_apci_1564.c | 20 +++++++++---------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 42a87b789f53..0fd77054e9b0 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -1,11 +1,3 @@ -/* Digital Input IRQ Function Selection */ -#define APCI1564_DI_INT_OR (0 << 1) -#define APCI1564_DI_INT_AND (1 << 1) - -/* Digital Input Interrupt Enable Disable. */ -#define APCI1564_DI_INT_ENABLE 0x4 -#define APCI1564_DI_INT_DISABLE 0xfffffffb - static int apci1564_timer_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index 2664bfa7b8f1..ae8446ec213e 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -79,6 +79,8 @@ #define APCI1564_DI_INT_MODE2_REG 0x08 #define APCI1564_DI_INT_STATUS_REG 0x0c #define APCI1564_DI_IRQ_REG 0x10 +#define APCI1564_DI_IRQ_ENA BIT(2) +#define APCI1564_DI_IRQ_MODE BIT(1) /* 1=AND, 0=OR */ #define APCI1564_DO_REG 0x14 #define APCI1564_DO_INT_CTRL_REG 0x18 #define APCI1564_DO_INT_CTRL_CC_INT_ENA BIT(1) @@ -164,9 +166,9 @@ static irqreturn_t apci1564_interrupt(int irq, void *d) unsigned int chan; status = inl(dev->iobase + APCI1564_DI_IRQ_REG); - if (status & APCI1564_DI_INT_ENABLE) { + if (status & APCI1564_DI_IRQ_ENA) { /* disable the interrupt */ - outl(status & APCI1564_DI_INT_DISABLE, + outl(status & ~APCI1564_DI_IRQ_ENA, dev->iobase + APCI1564_DI_IRQ_REG); s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG) & @@ -305,11 +307,9 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, outl(0x0, dev->iobase + APCI1564_DI_INT_MODE2_REG); break; case COMEDI_DIGITAL_TRIG_ENABLE_EDGES: - if (devpriv->ctrl != (APCI1564_DI_INT_ENABLE | - APCI1564_DI_INT_OR)) { + if (devpriv->ctrl != APCI1564_DI_IRQ_ENA) { /* switching to 'OR' mode */ - devpriv->ctrl = APCI1564_DI_INT_ENABLE | - APCI1564_DI_INT_OR; + devpriv->ctrl = APCI1564_DI_IRQ_ENA; /* wipe old channels */ devpriv->mode1 = 0; devpriv->mode2 = 0; @@ -323,11 +323,11 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, devpriv->mode2 |= data[5] << shift; break; case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: - if (devpriv->ctrl != (APCI1564_DI_INT_ENABLE | - APCI1564_DI_INT_AND)) { + if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA | + APCI1564_DI_IRQ_MODE)) { /* switching to 'AND' mode */ - devpriv->ctrl = APCI1564_DI_INT_ENABLE | - APCI1564_DI_INT_AND; + devpriv->ctrl = APCI1564_DI_IRQ_ENA | + APCI1564_DI_IRQ_MODE; /* wipe old channels */ devpriv->mode1 = 0; devpriv->mode2 = 0; From 836b8f2304a0363e98631f8cbccbe962d7dc23ab Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:07 -0700 Subject: [PATCH 798/912] staging: comedi: addi_apci_1564: tidy up APCI1564_EEPROM_REG bit defines Use the BIT() macro to define the bits. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1564.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index ae8446ec213e..f1ccfbd4c578 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -44,12 +44,12 @@ * 0x48 - 0x64 Timer 12-Bit */ #define APCI1564_EEPROM_REG 0x00 -#define APCI1564_EEPROM_VCC_STATUS (1 << 8) +#define APCI1564_EEPROM_VCC_STATUS BIT(8) #define APCI1564_EEPROM_TO_REV(x) (((x) >> 4) & 0xf) -#define APCI1564_EEPROM_DI (1 << 3) -#define APCI1564_EEPROM_DO (1 << 2) -#define APCI1564_EEPROM_CS (1 << 1) -#define APCI1564_EEPROM_CLK (1 << 0) +#define APCI1564_EEPROM_DI BIT(3) +#define APCI1564_EEPROM_DO BIT(2) +#define APCI1564_EEPROM_CS BIT(1) +#define APCI1564_EEPROM_CLK BIT(0) #define APCI1564_REV1_TIMER_IOBASE 0x04 #define APCI1564_REV2_MAIN_IOBASE 0x04 #define APCI1564_REV2_TIMER_IOBASE 0x48 From d9fca73c8014cbc971baa980c87caab8004b7c8c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:08 -0700 Subject: [PATCH 799/912] staging: comedi: hwdrv_apci1564: use addi_tcw.h defines Use the ADDI_TCW_CTRL_REG bit defines in addi_tcw.h to remove the "magic" numbers. Add some missing bit defines and mask defines to addi_tcw.h to help cleanup the code. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci1564.c | 66 ++++++++++--------- drivers/staging/comedi/drivers/addi_tcw.h | 14 ++-- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 0fd77054e9b0..3a02eaeee5c8 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -8,15 +8,16 @@ static int apci1564_timer_insn_config(struct comedi_device *dev, devpriv->tsk_current = current; - /* First Stop The Timer */ + /* Stop the timer */ ctrl = inl(devpriv->timer + ADDI_TCW_CTRL_REG); - ctrl &= 0xfffff9fe; - /* Stop The Timer */ + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_ENA); outl(ctrl, devpriv->timer + ADDI_TCW_CTRL_REG); if (data[1] == 1) { /* Enable timer int & disable all the other int sources */ - outl(0x02, devpriv->timer + ADDI_TCW_CTRL_REG); + outl(ADDI_TCW_CTRL_IRQ_ENA, + devpriv->timer + ADDI_TCW_CTRL_REG); outl(0x0, dev->iobase + APCI1564_DI_IRQ_REG); outl(0x0, dev->iobase + APCI1564_DO_IRQ_REG); outl(0x0, dev->iobase + APCI1564_WDOG_IRQ_REG); @@ -40,9 +41,11 @@ static int apci1564_timer_insn_config(struct comedi_device *dev, outl(data[3], devpriv->timer + ADDI_TCW_RELOAD_REG); ctrl = inl(devpriv->timer + ADDI_TCW_CTRL_REG); - ctrl &= 0xfff719e2; - ctrl |= (2 << 13) | 0x10; - /* mode 2 */ + ctrl &= ~(ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_MODE_MASK | + ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_TIMER_ENA | ADDI_TCW_CTRL_RESET_ENA | + ADDI_TCW_CTRL_WARN_ENA | ADDI_TCW_CTRL_ENA); + ctrl |= ADDI_TCW_CTRL_MODE(2) | ADDI_TCW_CTRL_TIMER_ENA; outl(ctrl, devpriv->timer + ADDI_TCW_CTRL_REG); return insn->n; @@ -59,11 +62,12 @@ static int apci1564_timer_insn_write(struct comedi_device *dev, ctrl = inl(devpriv->timer + ADDI_TCW_CTRL_REG); switch (data[1]) { case 0: /* Stop The Timer */ - ctrl &= 0xfffff9fe; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_ENA); break; case 1: /* Enable the Timer */ - ctrl &= 0xfffff9ff; - ctrl |= 0x1; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); + ctrl |= ADDI_TCW_CTRL_ENA; break; } outl(ctrl, devpriv->timer + ADDI_TCW_CTRL_REG); @@ -99,35 +103,35 @@ static int apci1564_counter_insn_config(struct comedi_device *dev, devpriv->tsk_current = current; - /* First Stop The Counter */ - ctrl = inl(iobase + ADDI_TCW_CTRL_REG); - ctrl &= 0xfffff9fe; /* Stop The Timer */ + ctrl = inl(iobase + ADDI_TCW_CTRL_REG); + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_ENA); outl(ctrl, iobase + ADDI_TCW_CTRL_REG); /* Set the reload value */ outl(data[3], iobase + ADDI_TCW_RELOAD_REG); - /* Set the mode : */ - /* - Disable the hardware */ - /* - Disable the counter mode */ - /* - Disable the warning */ - /* - Disable the reset */ - /* - Disable the timer mode */ - /* - Enable the counter mode */ - - ctrl &= 0xfffc19e2; - ctrl |= 0x80000 | (data[4] << 16); + /* Set the mode */ + ctrl &= ~(ADDI_TCW_CTRL_EXT_CLK_MASK | ADDI_TCW_CTRL_MODE_MASK | + ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_TIMER_ENA | ADDI_TCW_CTRL_RESET_ENA | + ADDI_TCW_CTRL_WARN_ENA | ADDI_TCW_CTRL_ENA); + ctrl |= ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_EXT_CLK(data[4]); outl(ctrl, iobase + ADDI_TCW_CTRL_REG); /* Enable or Disable Interrupt */ - ctrl &= 0xfffff9fd; - ctrl |= (data[1] << 1); + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_IRQ_ENA); + if (data[1]) + ctrl |= ADDI_TCW_CTRL_IRQ_ENA; outl(ctrl, iobase + ADDI_TCW_CTRL_REG); /* Set the Up/Down selection */ - ctrl &= 0xfffbf9ff; - ctrl |= (data[6] << 18); + ctrl &= ~(ADDI_TCW_CTRL_CNT_UP | ADDI_TCW_CTRL_GATE | + ADDI_TCW_CTRL_TRIG); + if (data[6]) + ctrl |= ADDI_TCW_CTRL_CNT_UP; outl(ctrl, iobase + ADDI_TCW_CTRL_REG); return insn->n; @@ -149,12 +153,12 @@ static int apci1564_counter_insn_write(struct comedi_device *dev, ctrl = 0; break; case 1: /* Start the Counter subdevice */ - ctrl &= 0xfffff9ff; - ctrl |= 0x1; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); + ctrl |= ADDI_TCW_CTRL_ENA; break; case 2: /* Clears the Counter subdevice */ - ctrl &= 0xfffff9ff; - ctrl |= 0x400; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); + ctrl |= ADDI_TCW_CTRL_GATE; break; } outl(ctrl, iobase + ADDI_TCW_CTRL_REG); diff --git a/drivers/staging/comedi/drivers/addi_tcw.h b/drivers/staging/comedi/drivers/addi_tcw.h index 547f503e82b7..f6f0175a0d79 100644 --- a/drivers/staging/comedi/drivers/addi_tcw.h +++ b/drivers/staging/comedi/drivers/addi_tcw.h @@ -29,12 +29,18 @@ #define ADDI_TCW_CTRL_CASCADE BIT(20) #define ADDI_TCW_CTRL_CNTR_ENA BIT(19) #define ADDI_TCW_CTRL_CNT_UP BIT(18) -#define ADDI_TCW_CTRL_EXT_CLK(x) ((x) << 16) -#define ADDI_TCW_CTRL_OUT(x) ((x) << 11) +#define ADDI_TCW_CTRL_EXT_CLK(x) (((x) & 3) << 16) +#define ADDI_TCW_CTRL_EXT_CLK_MASK ADDI_TCW_CTRL_EXT_CLK(3) +#define ADDI_TCW_CTRL_MODE(x) (((x) & 7) << 13) +#define ADDI_TCW_CTRL_MODE_MASK ADDI_TCW_CTRL_MODE(7) +#define ADDI_TCW_CTRL_OUT(x) (((x) & 3) << 11) +#define ADDI_TCW_CTRL_OUT_MASK ADDI_TCW_CTRL_OUT(3) #define ADDI_TCW_CTRL_GATE BIT(10) #define ADDI_TCW_CTRL_TRIG BIT(9) -#define ADDI_TCW_CTRL_EXT_GATE(x) ((x) << 7) -#define ADDI_TCW_CTRL_EXT_TRIG(x) ((x) << 5) +#define ADDI_TCW_CTRL_EXT_GATE(x) (((x) & 3) << 7) +#define ADDI_TCW_CTRL_EXT_GATE_MASK ADDI_TCW_CTRL_EXT_GATE(3) +#define ADDI_TCW_CTRL_EXT_TRIG(x) (((x) & 3) << 5) +#define ADDI_TCW_CTRL_EXT_TRIG_MASK ADDI_TCW_CTRL_EXT_TRIG(3) #define ADDI_TCW_CTRL_TIMER_ENA BIT(4) #define ADDI_TCW_CTRL_RESET_ENA BIT(3) #define ADDI_TCW_CTRL_WARN_ENA BIT(2) From 9a2d58c7f87bb5a92b4be9fd61af77baa2c832ba Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:09 -0700 Subject: [PATCH 800/912] staging: comedi: hwdrv_apci1564: tidy up apci1564_timer_insn_write() Clear the gate and trig bits in the common code path. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 3a02eaeee5c8..c4650db82f0e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -60,13 +60,12 @@ static int apci1564_timer_insn_write(struct comedi_device *dev, unsigned int ctrl; ctrl = inl(devpriv->timer + ADDI_TCW_CTRL_REG); + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); switch (data[1]) { case 0: /* Stop The Timer */ - ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | - ADDI_TCW_CTRL_ENA); + ctrl &= ~ADDI_TCW_CTRL_ENA; break; case 1: /* Enable the Timer */ - ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); ctrl |= ADDI_TCW_CTRL_ENA; break; } From 18543b13fc99f0e90aead12ca9fc64145341278c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:10 -0700 Subject: [PATCH 801/912] staging: comedi: hwdrv_apci1564: remove magic number in apci1564_timer_insn_read() Use the bit define from addi_tcw.h to remove the magic number. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index c4650db82f0e..a3e3a34d7e86 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -82,7 +82,8 @@ static int apci1564_timer_insn_read(struct comedi_device *dev, struct apci1564_private *devpriv = dev->private; /* Stores the status of the Timer */ - data[0] = inl(devpriv->timer + ADDI_TCW_STATUS_REG) & 0x1; + data[0] = inl(devpriv->timer + ADDI_TCW_STATUS_REG) & + ADDI_TCW_STATUS_OVERFLOW; /* Stores the Actual value of the Timer */ data[1] = inl(devpriv->timer + ADDI_TCW_VAL_REG); From 835f8fe9527b826d23b223fb5347ee2c3e670cee Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:11 -0700 Subject: [PATCH 802/912] staging: comedi: hwdrv_apci1564: remove useless code in apci1564_counter_insn_config() The gate, trig, and ena, bits in the 'ctrl' are cleared at the start of the function. There is no reason clear these bits for each step. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index a3e3a34d7e86..a1f4ae19c024 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -114,24 +114,23 @@ static int apci1564_counter_insn_config(struct comedi_device *dev, /* Set the mode */ ctrl &= ~(ADDI_TCW_CTRL_EXT_CLK_MASK | ADDI_TCW_CTRL_MODE_MASK | - ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | ADDI_TCW_CTRL_TIMER_ENA | ADDI_TCW_CTRL_RESET_ENA | - ADDI_TCW_CTRL_WARN_ENA | ADDI_TCW_CTRL_ENA); + ADDI_TCW_CTRL_WARN_ENA); ctrl |= ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_EXT_CLK(data[4]); outl(ctrl, iobase + ADDI_TCW_CTRL_REG); /* Enable or Disable Interrupt */ - ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | - ADDI_TCW_CTRL_IRQ_ENA); if (data[1]) ctrl |= ADDI_TCW_CTRL_IRQ_ENA; + else + ctrl &= ~ADDI_TCW_CTRL_IRQ_ENA; outl(ctrl, iobase + ADDI_TCW_CTRL_REG); /* Set the Up/Down selection */ - ctrl &= ~(ADDI_TCW_CTRL_CNT_UP | ADDI_TCW_CTRL_GATE | - ADDI_TCW_CTRL_TRIG); if (data[6]) ctrl |= ADDI_TCW_CTRL_CNT_UP; + else + ctrl &= ~ADDI_TCW_CTRL_CNT_UP; outl(ctrl, iobase + ADDI_TCW_CTRL_REG); return insn->n; From 1f5d767fab593659cbebc91197c3f182f6e0d84a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:12 -0700 Subject: [PATCH 803/912] staging: comedi: hwdrv_apci1564: fix counter "mode" setting According to the (broken) original driver, data[4] passed to this function is the "timer mode". It appears the original code used the wrong shift to set the bits. Use the ADDI_TCW_CTRL_MODE() macro so that the correct bits get set. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index a1f4ae19c024..dc738b26c60a 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -116,7 +116,7 @@ static int apci1564_counter_insn_config(struct comedi_device *dev, ctrl &= ~(ADDI_TCW_CTRL_EXT_CLK_MASK | ADDI_TCW_CTRL_MODE_MASK | ADDI_TCW_CTRL_TIMER_ENA | ADDI_TCW_CTRL_RESET_ENA | ADDI_TCW_CTRL_WARN_ENA); - ctrl |= ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_EXT_CLK(data[4]); + ctrl |= ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_MODE(data[4]); outl(ctrl, iobase + ADDI_TCW_CTRL_REG); /* Enable or Disable Interrupt */ From c6288a3bebd8a59364f9ca9871f0fd2ac11963b4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:13 -0700 Subject: [PATCH 804/912] staging: comedi: hwdrv_apci1564: tidy up apci1564_counter_insn_write() Clear the gate and trig bits in the common code path. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index dc738b26c60a..1315554fb096 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -147,16 +147,15 @@ static int apci1564_counter_insn_write(struct comedi_device *dev, unsigned int ctrl; ctrl = inl(iobase + ADDI_TCW_CTRL_REG); + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); switch (data[1]) { case 0: /* Stops the Counter subdevice */ ctrl = 0; break; case 1: /* Start the Counter subdevice */ - ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); ctrl |= ADDI_TCW_CTRL_ENA; break; case 2: /* Clears the Counter subdevice */ - ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); ctrl |= ADDI_TCW_CTRL_GATE; break; } From 5babc1bc4d18f780200e3a794d2d553c6684554c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Aug 2015 11:45:14 -0700 Subject: [PATCH 805/912] staging: comedi: hwdrv_apci1564: remove magic numbers in apci1564_counter_insn_read() Use the bit defines from addi_tcw.h to remove the magic numbers in this function. Add the missing define for ADDI_TCW_STATUS_HARDWARE_TRIG. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 8 ++++---- drivers/staging/comedi/drivers/addi_tcw.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 1315554fb096..f0c0d58383ca 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -178,10 +178,10 @@ static int apci1564_counter_insn_read(struct comedi_device *dev, data[0] = inl(iobase + ADDI_TCW_VAL_REG); status = inl(iobase + ADDI_TCW_STATUS_REG); - data[1] = (status >> 1) & 1; /* software trigger status */ - data[2] = (status >> 2) & 1; /* hardware trigger status */ - data[3] = (status >> 3) & 1; /* software clear status */ - data[4] = (status >> 0) & 1; /* overflow status */ + data[1] = (status & ADDI_TCW_STATUS_SOFT_TRIG) ? 1 : 0; + data[2] = (status & ADDI_TCW_STATUS_HARDWARE_TRIG) ? 1 : 0; + data[3] = (status & ADDI_TCW_STATUS_SOFT_CLR) ? 1 : 0; + data[4] = (status & ADDI_TCW_STATUS_OVERFLOW) ? 1 : 0; return insn->n; } diff --git a/drivers/staging/comedi/drivers/addi_tcw.h b/drivers/staging/comedi/drivers/addi_tcw.h index f6f0175a0d79..db6d5a4e8889 100644 --- a/drivers/staging/comedi/drivers/addi_tcw.h +++ b/drivers/staging/comedi/drivers/addi_tcw.h @@ -49,6 +49,7 @@ #define ADDI_TCW_STATUS_REG 0x10 #define ADDI_TCW_STATUS_SOFT_CLR BIT(3) +#define ADDI_TCW_STATUS_HARDWARE_TRIG BIT(2) #define ADDI_TCW_STATUS_SOFT_TRIG BIT(1) #define ADDI_TCW_STATUS_OVERFLOW BIT(0) From 0bb6419ccf5b2548ade321d5337e9d3252a3d4a1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 10 Aug 2015 13:14:03 -0700 Subject: [PATCH 806/912] staging: comedi: comedi_fops: remove remaining BUG_ON() checks The BUG_ON() checks in comedi_subdevice_from_minor() and comedi_dev_get_from_subdevice_minor() are not necessary. The 'minor' numbers for a given comedi driver are setup by comedi_dev_get_from_subdevice_minor() and will always be in the correct range. Drivers should not crash the kernel, remove the BUG_ON() checks. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 4820ab6d0aa8..62526ddcb48c 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -215,7 +215,6 @@ static struct comedi_subdevice struct comedi_subdevice *s; unsigned int i = minor - COMEDI_NUM_BOARD_MINORS; - BUG_ON(i >= COMEDI_NUM_SUBDEVICE_MINORS); mutex_lock(&comedi_subdevice_minor_table_lock); s = comedi_subdevice_minor_table[i]; if (s && s->device != dev) @@ -241,7 +240,6 @@ static struct comedi_device *comedi_dev_get_from_subdevice_minor(unsigned minor) struct comedi_subdevice *s; unsigned int i = minor - COMEDI_NUM_BOARD_MINORS; - BUG_ON(i >= COMEDI_NUM_SUBDEVICE_MINORS); mutex_lock(&comedi_subdevice_minor_table_lock); s = comedi_subdevice_minor_table[i]; dev = comedi_dev_get(s ? s->device : NULL); From 6b3703f4cb763d57ab26f2ad262a30cc7f87093c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 10 Aug 2015 13:14:02 -0700 Subject: [PATCH 807/912] staging: comedi: comedi_fops: remove BUG_ON() in comedi_cleanup() The BUG_ON() checks in this function are not necessary. comedi_cleanup_board_minors() clears all the entries in the comedi_board_minor_table array and will call comedi_device_cleanup() for all attached devices. comedi_device_cleanup() will then clear the entries in the comedi_subdevice_minor_table array with comedi_free_subdevice_minor(). Remove the BUG_ON(), drivers should not crash the kernel. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 62526ddcb48c..93b37e245f96 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2930,14 +2930,7 @@ module_init(comedi_init); static void __exit comedi_cleanup(void) { - int i; - comedi_cleanup_board_minors(); - for (i = 0; i < COMEDI_NUM_BOARD_MINORS; ++i) - BUG_ON(comedi_board_minor_table[i]); - for (i = 0; i < COMEDI_NUM_SUBDEVICE_MINORS; ++i) - BUG_ON(comedi_subdevice_minor_table[i]); - class_destroy(comedi_class); cdev_del(&comedi_cdev); unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); From 5104a8988723b405c9e033b7e57267ebdd387d4d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 10 Aug 2015 13:14:01 -0700 Subject: [PATCH 808/912] staging: comedi: comedi_fops: remove BUG_ON() in comedi_free_subdevice_minor() Drivers should not crash the kernel. This function is only called by comedi_device_detach_cleanup() and the s->minor will always be valid or the device wouldn't have attached in the first place. Leave the checks for safety in accessing the comedi_subdevice_minor_table array but remove the BUG_ON() calls. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 93b37e245f96..2e69f5a4e7ec 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2836,12 +2836,10 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s) if (!s) return; - if (s->minor < 0) + if (s->minor < COMEDI_NUM_BOARD_MINORS || + s->minor >= COMEDI_NUM_MINORS) return; - BUG_ON(s->minor >= COMEDI_NUM_MINORS); - BUG_ON(s->minor < COMEDI_NUM_BOARD_MINORS); - i = s->minor - COMEDI_NUM_BOARD_MINORS; mutex_lock(&comedi_subdevice_minor_table_lock); if (s == comedi_subdevice_minor_table[i]) From c4237a2b59432a6ebf73f813ad9e94ab408bb8f1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 10 Aug 2015 13:14:00 -0700 Subject: [PATCH 809/912] staging: comedi: comedi_fops: remove BUG_ON() in comedi_dev_get_from_board_minor() This function is only called by comedi_dev_get_from_minor() and the 'minor' value will always be < COMEDI_NUM_BOARD_MINORS. Remove the unnecessary BUG_ON(). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 2e69f5a4e7ec..f7db91ca974e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -227,7 +227,6 @@ static struct comedi_device *comedi_dev_get_from_board_minor(unsigned minor) { struct comedi_device *dev; - BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS); mutex_lock(&comedi_board_minor_table_lock); dev = comedi_dev_get(comedi_board_minor_table[minor]); mutex_unlock(&comedi_board_minor_table_lock); From 2be8ae5898af956560e9f722b327add05574a1f7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 10 Aug 2015 13:13:59 -0700 Subject: [PATCH 810/912] staging: comedi: comedi_fops: absorb comedi_free_board_minor() This function is only called by comedi_cleanup_board_minors() and the 'minor' parameter will always be < COMEDI_NUM_BOARD_MINORS. For aesthetics, absorb the function and remove the unnecessary BUG_ON(). Split the comedi_clear_board_minor() out to clarify that the return value is a comedi_device pointer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index f7db91ca974e..fd54d098ab02 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2774,12 +2774,6 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device) return dev; } -static void comedi_free_board_minor(unsigned minor) -{ - BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS); - comedi_free_board_dev(comedi_clear_board_minor(minor)); -} - void comedi_release_hardware_device(struct device *hardware_device) { int minor; @@ -2852,10 +2846,13 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s) static void comedi_cleanup_board_minors(void) { + struct comedi_device *dev; unsigned i; - for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) - comedi_free_board_minor(i); + for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { + dev = comedi_clear_board_minor(i); + comedi_free_board_dev(dev); + } } static int __init comedi_init(void) From a66f2017ec2daebfef9e7cdf4edeca7a362c7303 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:36 -0700 Subject: [PATCH 811/912] staging: comedi: hwdrv_apci3501: remove useless read/mask to stop watchdog The watchdog is stopped in apci3501_write_insn_timer() by writing a 0 to the timer control register. There is no need to read the register first and mask it (as done when the timer is used as a timer). Reported-by: coverity (CID 1227052) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 1f2f78186d58..e12b2bc61ca3 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -102,8 +102,6 @@ static int apci3501_write_insn_timer(struct comedi_device *dev, /* Enable the Watchdog */ outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); } else if (data[1] == 0) { /* Stop The Watchdog */ - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = ul_Command1 & 0xFFFFF9FEUL; outl(0x0, dev->iobase + APCI3501_TIMER_CTRL_REG); } else if (data[1] == 2) { ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); From 4434a99eaab2cb3b214201d05f396c940033a6fe Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:37 -0700 Subject: [PATCH 812/912] staging: comedi: addi_apci_3501: rename private data 'b_TimerSelectMode' Rename this CamelCase member of the private data. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 16 ++++++++-------- drivers/staging/comedi/drivers/addi_apci_3501.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index e12b2bc61ca3..33fcd19b0a75 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -27,7 +27,7 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, devpriv->tsk_Current = current; if (data[0] == ADDIDATA_WATCHDOG) { - devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG; + devpriv->timer_mode = ADDIDATA_WATCHDOG; /* Disable the watchdog */ outl(0x0, dev->iobase + APCI3501_TIMER_CTRL_REG); @@ -52,7 +52,7 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); ul_Command1 = ul_Command1 & 0xFFFFF9FEUL; outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); - devpriv->b_TimerSelectMode = ADDIDATA_TIMER; + devpriv->timer_mode = ADDIDATA_TIMER; if (data[1] == 1) { /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ outl(0x02, dev->iobase + APCI3501_TIMER_CTRL_REG); @@ -94,7 +94,7 @@ static int apci3501_write_insn_timer(struct comedi_device *dev, struct apci3501_private *devpriv = dev->private; unsigned int ul_Command1 = 0; - if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { + if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { if (data[1] == 1) { ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); @@ -110,7 +110,7 @@ static int apci3501_write_insn_timer(struct comedi_device *dev, } } - if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { + if (devpriv->timer_mode == ADDIDATA_TIMER) { if (data[1] == 1) { ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); @@ -153,18 +153,18 @@ static int apci3501_read_insn_timer(struct comedi_device *dev, { struct apci3501_private *devpriv = dev->private; - if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { + if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1; data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG); } - else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { + else if (devpriv->timer_mode == ADDIDATA_TIMER) { data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1; data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG); } - else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER) - && (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)) { + else if (devpriv->timer_mode != ADDIDATA_TIMER && + devpriv->timer_mode != ADDIDATA_WATCHDOG) { dev_err(dev->class_dev, "Invalid subdevice.\n"); } return insn->n; diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index 73786a3f3df9..6dd7e3d22dc5 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -74,7 +74,7 @@ struct apci3501_private { int i_IobaseAmcc; struct task_struct *tsk_Current; - unsigned char b_TimerSelectMode; + unsigned char timer_mode; }; static struct comedi_lrange apci3501_ao_range = { From e078d25639c0f8a5d97c879e276a2eba877dce62 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:38 -0700 Subject: [PATCH 813/912] staging: comedi: hwdrv_apci3501: rename 'ul_Command1' in apci3501_write_insn_timer() Rename this CamelCase local variable. For aesthetics, split the mask/set operations. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 33fcd19b0a75..306309ed9637 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -92,43 +92,45 @@ static int apci3501_write_insn_timer(struct comedi_device *dev, unsigned int *data) { struct apci3501_private *devpriv = dev->private; - unsigned int ul_Command1 = 0; + unsigned int ctrl = 0; if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { - if (data[1] == 1) { - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9ff; + ctrl |= 0x1; /* Enable the Watchdog */ - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } else if (data[1] == 0) { /* Stop The Watchdog */ outl(0x0, dev->iobase + APCI3501_TIMER_CTRL_REG); } else if (data[1] == 2) { - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x200UL; - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9ff; + ctrl |= 0x200; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } } if (devpriv->timer_mode == ADDIDATA_TIMER) { if (data[1] == 1) { - - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9ff; + ctrl |= 0x1; /* Enable the Timer */ - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } else if (data[1] == 0) { /* Stop The Timer */ - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9fe; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } else if (data[1] == 2) { /* Trigger the Timer */ - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x200UL; - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9ff; + ctrl |= 0x200; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } } From 626bb280d0516c7b4adee50cdd2b8ea377183f46 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:39 -0700 Subject: [PATCH 814/912] staging: comedi: hwdrv_apci3501: refactor apci3501_write_insn_timer() The handling of the ADDIDATA_WATCHDOG and ADDIDATA_TIMER is identical except for the "stop" operation. Refactor this function to use a common code path for both timer modes. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 50 ++++++------------- 1 file changed, 14 insertions(+), 36 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 306309ed9637..6d0cf6dbca49 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -92,46 +92,24 @@ static int apci3501_write_insn_timer(struct comedi_device *dev, unsigned int *data) { struct apci3501_private *devpriv = dev->private; - unsigned int ctrl = 0; + unsigned int ctrl; - if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { - if (data[1] == 1) { - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ctrl &= 0xfffff9ff; + if (devpriv->timer_mode == ADDIDATA_WATCHDOG || + devpriv->timer_mode == ADDIDATA_TIMER) { + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9ff; + + if (data[1] == 1) { /* enable */ ctrl |= 0x1; - /* Enable the Watchdog */ - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - } else if (data[1] == 0) { /* Stop The Watchdog */ - outl(0x0, dev->iobase + APCI3501_TIMER_CTRL_REG); - } else if (data[1] == 2) { - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ctrl &= 0xfffff9ff; + } else if (data[1] == 0) { /* stop */ + if (devpriv->timer_mode == ADDIDATA_WATCHDOG) + ctrl = 0; + else + ctrl &= ~0x1; + } else if (data[1] == 2) { /* trigger */ ctrl |= 0x200; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - } - } - - if (devpriv->timer_mode == ADDIDATA_TIMER) { - if (data[1] == 1) { - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ctrl &= 0xfffff9ff; - ctrl |= 0x1; - /* Enable the Timer */ - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - } else if (data[1] == 0) { - /* Stop The Timer */ - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ctrl &= 0xfffff9fe; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - } - - else if (data[1] == 2) { - /* Trigger the Timer */ - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ctrl &= 0xfffff9ff; - ctrl |= 0x200; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } inl(dev->iobase + APCI3501_TIMER_STATUS_REG); From f7f909e09fd0cc22499913933c9caee3000423e3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:40 -0700 Subject: [PATCH 815/912] staging: comedi: hwdrv_apci3501: refactor apci3501_read_insn_timer() The handling of the ADDIDATA_WATCHDOG and ADDIDATA_TIMER is identical. Refactor this function to use a common code path for both timer modes. Remove the incorrect dev_err() noise. The subdevice is valid but the timer_mode is not supported. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 6d0cf6dbca49..4828c7370e6b 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -133,19 +133,12 @@ static int apci3501_read_insn_timer(struct comedi_device *dev, { struct apci3501_private *devpriv = dev->private; - if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { - data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1; - data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG); - } + if (devpriv->timer_mode != ADDIDATA_TIMER && + devpriv->timer_mode != ADDIDATA_WATCHDOG) + return -EINVAL; - else if (devpriv->timer_mode == ADDIDATA_TIMER) { - data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1; - data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG); - } + data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1; + data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG); - else if (devpriv->timer_mode != ADDIDATA_TIMER && - devpriv->timer_mode != ADDIDATA_WATCHDOG) { - dev_err(dev->class_dev, "Invalid subdevice.\n"); - } return insn->n; } From bde879ae6ef93cdaa927d1637995256277844239 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:41 -0700 Subject: [PATCH 816/912] staging: comedi: hwdrv_apci3501: rename 'ul_Command1' in apci3501_config_insn_timer() Rename this CamelCase local variable. For aesthetics, split the mask/set operations. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 4828c7370e6b..47c6bc1bbb29 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -22,7 +22,7 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, unsigned int *data) { struct apci3501_private *devpriv = dev->private; - unsigned int ul_Command1 = 0; + unsigned int ctrl = 0; devpriv->tsk_Current = current; if (data[0] == ADDIDATA_WATCHDOG) { @@ -43,15 +43,16 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, outl(data[3], dev->iobase + APCI3501_TIMER_RELOAD_REG); /* Set the mode (e2->e0) */ - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG) | 0xFFF819E0UL; - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl |= 0xfff819e0; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } else if (data[0] == ADDIDATA_TIMER) { /* First Stop The Timer */ - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9fe; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); devpriv->timer_mode = ADDIDATA_TIMER; if (data[1] == 1) { /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ @@ -65,10 +66,10 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, outl(data[3], dev->iobase + APCI3501_TIMER_RELOAD_REG); /* mode 2 */ - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = - (ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL; - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfff719e2; + ctrl |= (2 << 13) | 0x10; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } return insn->n; From c85c26b8d0242da14732312dd99a8595d7a46e2c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:42 -0700 Subject: [PATCH 817/912] staging: comedi: hwdrv_apci3501: refactor apci3501_config_insn_timer() The handling for the watchdog and timer modes is very similar. Refactor this function to use a common code path for both modes. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 61 ++++++++----------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 47c6bc1bbb29..e5209eb591f2 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -22,55 +22,42 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, unsigned int *data) { struct apci3501_private *devpriv = dev->private; - unsigned int ctrl = 0; + unsigned int ctrl; + + if (data[0] != ADDIDATA_WATCHDOG && + data[0] != ADDIDATA_TIMER) + return -EINVAL; devpriv->tsk_Current = current; - if (data[0] == ADDIDATA_WATCHDOG) { - devpriv->timer_mode = ADDIDATA_WATCHDOG; - /* Disable the watchdog */ - outl(0x0, dev->iobase + APCI3501_TIMER_CTRL_REG); + devpriv->timer_mode = data[0]; - if (data[1] == 1) { - /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ - outl(0x02, dev->iobase + APCI3501_TIMER_CTRL_REG); - } else { - /* disable Timer interrupt */ - outl(0x0, dev->iobase + APCI3501_TIMER_CTRL_REG); - } - - outl(data[2], dev->iobase + APCI3501_TIMER_TIMEBASE_REG); - outl(data[3], dev->iobase + APCI3501_TIMER_RELOAD_REG); - - /* Set the mode (e2->e0) */ - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ctrl |= 0xfff819e0; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - } - - else if (data[0] == ADDIDATA_TIMER) { - /* First Stop The Timer */ + /* first, disable the watchdog or stop the timer */ + if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { + ctrl = 0; + } else { ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); ctrl &= 0xfffff9fe; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - devpriv->timer_mode = ADDIDATA_TIMER; - if (data[1] == 1) { - /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ - outl(0x02, dev->iobase + APCI3501_TIMER_CTRL_REG); - } else { - /* disable Timer interrupt */ - outl(0x0, dev->iobase + APCI3501_TIMER_CTRL_REG); - } + } + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - outl(data[2], dev->iobase + APCI3501_TIMER_TIMEBASE_REG); - outl(data[3], dev->iobase + APCI3501_TIMER_RELOAD_REG); + /* enable/disable the timer interrupt */ + ctrl = (data[1] == 1) ? 0x2 : 0; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); + outl(data[2], dev->iobase + APCI3501_TIMER_TIMEBASE_REG); + outl(data[3], dev->iobase + APCI3501_TIMER_RELOAD_REG); + + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { + /* Set the mode (e2->e0) NOTE: this doesn't look correct */ + ctrl |= 0xfff819e0; + } else { /* mode 2 */ - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); ctrl &= 0xfff719e2; ctrl |= (2 << 13) | 0x10; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); } + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); return insn->n; } From cd07fbf27b91c3c71812528ce39f9043ee1352e3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:43 -0700 Subject: [PATCH 818/912] staging: comedi: addi_apci_3501: rename private data 'i_IobaseAmcc' Rename this CamelCase member of the private data. Also, fix the type of the member, it holds a pci_resource_start() address and should be an unsigned long. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3501.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index 6dd7e3d22dc5..c3a1acdd3070 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -72,7 +72,7 @@ #define EEPROM_TIMER_WATCHDOG_COUNTER 10 struct apci3501_private { - int i_IobaseAmcc; + unsigned long amcc; struct task_struct *tsk_Current; unsigned char timer_mode; }; @@ -222,11 +222,10 @@ static unsigned short apci3501_eeprom_readw(unsigned long iobase, static int apci3501_eeprom_get_ao_n_chan(struct comedi_device *dev) { struct apci3501_private *devpriv = dev->private; - unsigned long iobase = devpriv->i_IobaseAmcc; unsigned char nfuncs; int i; - nfuncs = apci3501_eeprom_readw(iobase, 10) & 0xff; + nfuncs = apci3501_eeprom_readw(devpriv->amcc, 10) & 0xff; /* Read functionality details */ for (i = 0; i < nfuncs; i++) { @@ -235,11 +234,11 @@ static int apci3501_eeprom_get_ao_n_chan(struct comedi_device *dev) unsigned char func; unsigned short val; - func = apci3501_eeprom_readw(iobase, 12 + offset) & 0x3f; - addr = apci3501_eeprom_readw(iobase, 14 + offset); + func = apci3501_eeprom_readw(devpriv->amcc, 12 + offset) & 0x3f; + addr = apci3501_eeprom_readw(devpriv->amcc, 14 + offset); if (func == EEPROM_ANALOGOUTPUT) { - val = apci3501_eeprom_readw(iobase, addr + 10); + val = apci3501_eeprom_readw(devpriv->amcc, addr + 10); return (val >> 4) & 0x3ff; } } @@ -254,7 +253,7 @@ static int apci3501_eeprom_insn_read(struct comedi_device *dev, struct apci3501_private *devpriv = dev->private; unsigned short addr = CR_CHAN(insn->chanspec); - data[0] = apci3501_eeprom_readw(devpriv->i_IobaseAmcc, 2 * addr); + data[0] = apci3501_eeprom_readw(devpriv->amcc, 2 * addr); return insn->n; } @@ -335,7 +334,7 @@ static int apci3501_auto_attach(struct comedi_device *dev, return ret; dev->iobase = pci_resource_start(pcidev, 1); - devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0); + devpriv->amcc = pci_resource_start(pcidev, 0); ao_n_chan = apci3501_eeprom_get_ao_n_chan(dev); From 63316aae9102a3f7d0d94e32a43dad3b7b752cfe Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:44 -0700 Subject: [PATCH 819/912] staging: comedi: addi_apci_3501: prefer using the BIT macro Change the register bit defines to use the BIT macro. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3501.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index c3a1acdd3070..17b17947c556 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -33,12 +33,12 @@ * PCI bar 1 register I/O map */ #define APCI3501_AO_CTRL_STATUS_REG 0x00 -#define APCI3501_AO_CTRL_BIPOLAR (1 << 0) -#define APCI3501_AO_STATUS_READY (1 << 8) +#define APCI3501_AO_CTRL_BIPOLAR BIT(0) +#define APCI3501_AO_STATUS_READY BIT(8) #define APCI3501_AO_DATA_REG 0x04 #define APCI3501_AO_DATA_CHAN(x) ((x) << 0) #define APCI3501_AO_DATA_VAL(x) ((x) << 8) -#define APCI3501_AO_DATA_BIPOLAR (1 << 31) +#define APCI3501_AO_DATA_BIPOLAR BIT(31) #define APCI3501_AO_TRIG_SCS_REG 0x08 #define APCI3501_TIMER_SYNC_REG 0x20 #define APCI3501_TIMER_RELOAD_REG 0x24 From f821bf57a41f4aaab5c3306fd81e729208ca1404 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:45 -0700 Subject: [PATCH 820/912] staging: comedi: addi_apci_3501: rename CamelCase vars in apci3501_interrupt() Rename the CamelCase local variables. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi_apci_3501.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index 17b17947c556..16684c01cfd6 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -262,25 +262,26 @@ static irqreturn_t apci3501_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct apci3501_private *devpriv = dev->private; - unsigned int ui_Timer_AOWatchdog; - unsigned long ul_Command1; + unsigned int status; + unsigned int ctrl; /* Disable Interrupt */ - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = ul_Command1 & 0xFFFFF9FDul; - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9fd; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - ui_Timer_AOWatchdog = inl(dev->iobase + APCI3501_TIMER_IRQ_REG) & 0x1; - if ((!ui_Timer_AOWatchdog)) { + status = inl(dev->iobase + APCI3501_TIMER_IRQ_REG) & 0x1; + if (!status) { dev_err(dev->class_dev, "IRQ from unknown source\n"); return IRQ_NONE; } /* Enable Interrupt Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = (ul_Command1 & 0xFFFFF9FDul) | 1 << 1; - outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl &= 0xfffff9fd; + ctrl |= 1 << 1; + outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); inl(dev->iobase + APCI3501_TIMER_STATUS_REG); return IRQ_HANDLED; From cd5d0ae4814f4f943c97c83f7f2f393a99b4d3a0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:46 -0700 Subject: [PATCH 821/912] staging: comedi: addi_apci_3501: use addi_tcw.h for the timer registers The APCI3501_TIMER_* register defines in this driver are that same as the ADDI_TCW_* defines with an additional offset. Add a 'tcw' (timer/counter/watchdog) member to the private data to hold the address for the iobase of the registers. Use that and the defines from addi_tcw.h to address the registers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 24 ++++++++--------- .../staging/comedi/drivers/addi_apci_3501.c | 26 ++++++++----------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index e5209eb591f2..8ba094cc31f4 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -36,19 +36,19 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { ctrl = 0; } else { - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); ctrl &= 0xfffff9fe; } - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); + outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); /* enable/disable the timer interrupt */ ctrl = (data[1] == 1) ? 0x2 : 0; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); + outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); - outl(data[2], dev->iobase + APCI3501_TIMER_TIMEBASE_REG); - outl(data[3], dev->iobase + APCI3501_TIMER_RELOAD_REG); + outl(data[2], devpriv->tcw + ADDI_TCW_TIMEBASE_REG); + outl(data[3], devpriv->tcw + ADDI_TCW_RELOAD_REG); - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { /* Set the mode (e2->e0) NOTE: this doesn't look correct */ ctrl |= 0xfff819e0; @@ -57,7 +57,7 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, ctrl &= 0xfff719e2; ctrl |= (2 << 13) | 0x10; } - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); + outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); return insn->n; } @@ -84,7 +84,7 @@ static int apci3501_write_insn_timer(struct comedi_device *dev, if (devpriv->timer_mode == ADDIDATA_WATCHDOG || devpriv->timer_mode == ADDIDATA_TIMER) { - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); ctrl &= 0xfffff9ff; if (data[1] == 1) { /* enable */ @@ -97,10 +97,10 @@ static int apci3501_write_insn_timer(struct comedi_device *dev, } else if (data[1] == 2) { /* trigger */ ctrl |= 0x200; } - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); + outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); } - inl(dev->iobase + APCI3501_TIMER_STATUS_REG); + inl(devpriv->tcw + ADDI_TCW_STATUS_REG); return insn->n; } @@ -125,8 +125,8 @@ static int apci3501_read_insn_timer(struct comedi_device *dev, devpriv->timer_mode != ADDIDATA_WATCHDOG) return -EINVAL; - data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1; - data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG); + data[0] = inl(devpriv->tcw + ADDI_TCW_STATUS_REG) & 0x1; + data[1] = inl(devpriv->tcw + ADDI_TCW_VAL_REG); return insn->n; } diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index 16684c01cfd6..4faa23bcdcd5 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -27,6 +27,7 @@ #include #include "../comedi_pci.h" +#include "addi_tcw.h" #include "amcc_s5933.h" /* @@ -40,14 +41,7 @@ #define APCI3501_AO_DATA_VAL(x) ((x) << 8) #define APCI3501_AO_DATA_BIPOLAR BIT(31) #define APCI3501_AO_TRIG_SCS_REG 0x08 -#define APCI3501_TIMER_SYNC_REG 0x20 -#define APCI3501_TIMER_RELOAD_REG 0x24 -#define APCI3501_TIMER_TIMEBASE_REG 0x28 -#define APCI3501_TIMER_CTRL_REG 0x2c -#define APCI3501_TIMER_STATUS_REG 0x30 -#define APCI3501_TIMER_IRQ_REG 0x34 -#define APCI3501_TIMER_WARN_RELOAD_REG 0x38 -#define APCI3501_TIMER_WARN_TIMEBASE_REG 0x3c +#define APCI3501_TIMER_BASE 0x20 #define APCI3501_DO_REG 0x40 #define APCI3501_DI_REG 0x50 @@ -73,6 +67,7 @@ struct apci3501_private { unsigned long amcc; + unsigned long tcw; struct task_struct *tsk_Current; unsigned char timer_mode; }; @@ -266,11 +261,11 @@ static irqreturn_t apci3501_interrupt(int irq, void *d) unsigned int ctrl; /* Disable Interrupt */ - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); ctrl &= 0xfffff9fd; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); + outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); - status = inl(dev->iobase + APCI3501_TIMER_IRQ_REG) & 0x1; + status = inl(devpriv->tcw + ADDI_TCW_IRQ_REG) & 0x1; if (!status) { dev_err(dev->class_dev, "IRQ from unknown source\n"); return IRQ_NONE; @@ -278,11 +273,11 @@ static irqreturn_t apci3501_interrupt(int irq, void *d) /* Enable Interrupt Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); + ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); ctrl &= 0xfffff9fd; ctrl |= 1 << 1; - outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG); - inl(dev->iobase + APCI3501_TIMER_STATUS_REG); + outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); + inl(devpriv->tcw + ADDI_TCW_STATUS_REG); return IRQ_HANDLED; } @@ -334,8 +329,9 @@ static int apci3501_auto_attach(struct comedi_device *dev, if (ret) return ret; - dev->iobase = pci_resource_start(pcidev, 1); devpriv->amcc = pci_resource_start(pcidev, 0); + dev->iobase = pci_resource_start(pcidev, 1); + devpriv->tcw = dev->iobase + APCI3501_TIMER_BASE; ao_n_chan = apci3501_eeprom_get_ao_n_chan(dev); From 020e05e74d49fc4c5cecee1b779247ec8a243b1f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:47 -0700 Subject: [PATCH 822/912] staging: comedi: addi_apci_3501: remove "magic" numbers in apci3501_interrupt() Use register bit defines from addi_tcw.h to remove the "magic" numbers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3501.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index 4faa23bcdcd5..40ff91411139 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -262,11 +262,12 @@ static irqreturn_t apci3501_interrupt(int irq, void *d) /* Disable Interrupt */ ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); - ctrl &= 0xfffff9fd; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_IRQ_ENA); outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); - status = inl(devpriv->tcw + ADDI_TCW_IRQ_REG) & 0x1; - if (!status) { + status = inl(devpriv->tcw + ADDI_TCW_IRQ_REG); + if (!(status & ADDI_TCW_IRQ)) { dev_err(dev->class_dev, "IRQ from unknown source\n"); return IRQ_NONE; } @@ -274,8 +275,9 @@ static irqreturn_t apci3501_interrupt(int irq, void *d) /* Enable Interrupt Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); - ctrl &= 0xfffff9fd; - ctrl |= 1 << 1; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_IRQ_ENA); + ctrl |= ADDI_TCW_CTRL_IRQ_ENA; outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); inl(devpriv->tcw + ADDI_TCW_STATUS_REG); From 7dc68e350460c4c1620f79f23be70739845994ff Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:48 -0700 Subject: [PATCH 823/912] staging: comedi: hwdrv_apci3501: remove "magic" numbers in apci3501_config_insn_timer() Use register bit defines from addi_tcw.h to remove the "magic" numbers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 8ba094cc31f4..c4a72a5b343f 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -37,12 +37,13 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, ctrl = 0; } else { ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); - ctrl &= 0xfffff9fe; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_ENA); } outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); /* enable/disable the timer interrupt */ - ctrl = (data[1] == 1) ? 0x2 : 0; + ctrl = (data[1] == 1) ? ADDI_TCW_CTRL_IRQ_ENA : 0; outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); outl(data[2], devpriv->tcw + ADDI_TCW_TIMEBASE_REG); @@ -51,11 +52,18 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { /* Set the mode (e2->e0) NOTE: this doesn't look correct */ - ctrl |= 0xfff819e0; + ctrl |= ~(ADDI_TCW_CTRL_CNT_UP | ADDI_TCW_CTRL_EXT_CLK_MASK | + ADDI_TCW_CTRL_MODE_MASK | ADDI_TCW_CTRL_GATE | + ADDI_TCW_CTRL_TRIG | ADDI_TCW_CTRL_TIMER_ENA | + ADDI_TCW_CTRL_RESET_ENA | ADDI_TCW_CTRL_WARN_ENA | + ADDI_TCW_CTRL_IRQ_ENA | ADDI_TCW_CTRL_ENA); } else { /* mode 2 */ - ctrl &= 0xfff719e2; - ctrl |= (2 << 13) | 0x10; + ctrl &= ~(ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_MODE_MASK | + ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_TIMER_ENA | ADDI_TCW_CTRL_RESET_ENA | + ADDI_TCW_CTRL_WARN_ENA | ADDI_TCW_CTRL_ENA); + ctrl |= ADDI_TCW_CTRL_MODE(2) | ADDI_TCW_CTRL_TIMER_ENA; } outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); From 0d5e03079de3332b9c3dbb5be24631502d0d676b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:49 -0700 Subject: [PATCH 824/912] staging: comedi: hwdrv_apci3501: remove "magic" numbers in apci3501_write_insn_timer() Use register bit defines from addi_tcw.h to remove the "magic" numbers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index c4a72a5b343f..d971f7a0926f 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -93,17 +93,17 @@ static int apci3501_write_insn_timer(struct comedi_device *dev, if (devpriv->timer_mode == ADDIDATA_WATCHDOG || devpriv->timer_mode == ADDIDATA_TIMER) { ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); - ctrl &= 0xfffff9ff; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG); if (data[1] == 1) { /* enable */ - ctrl |= 0x1; + ctrl |= ADDI_TCW_CTRL_ENA; } else if (data[1] == 0) { /* stop */ if (devpriv->timer_mode == ADDIDATA_WATCHDOG) ctrl = 0; else - ctrl &= ~0x1; + ctrl &= ~ADDI_TCW_CTRL_ENA; } else if (data[1] == 2) { /* trigger */ - ctrl |= 0x200; + ctrl |= ADDI_TCW_CTRL_TRIG; } outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); } From 1c38d03ea9b7b92f958ce6b3c2337413227bcb6b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Aug 2015 13:25:50 -0700 Subject: [PATCH 825/912] staging: comedi: hwdrv_apci3501: remove "magic" numbers in apci3501_read_insn_timer() Use register bit defines from addi_tcw.h to remove the "magic" numbers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index d971f7a0926f..375707497896 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -133,7 +133,8 @@ static int apci3501_read_insn_timer(struct comedi_device *dev, devpriv->timer_mode != ADDIDATA_WATCHDOG) return -EINVAL; - data[0] = inl(devpriv->tcw + ADDI_TCW_STATUS_REG) & 0x1; + data[0] = inl(devpriv->tcw + ADDI_TCW_STATUS_REG) & + ADDI_TCW_STATUS_OVERFLOW; data[1] = inl(devpriv->tcw + ADDI_TCW_VAL_REG); return insn->n; From ad83dbd974feb2e2a8cc071a1d28782bd4d2c70e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 11 Aug 2015 13:05:10 +0100 Subject: [PATCH 826/912] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 The "adl_pci7x3x" driver replaced the "adl_pci7230" and "adl_pci7432" drivers in commits 8f567c373c4b ("staging: comedi: new adl_pci7x3x driver") and 657f77d173d3 ("staging: comedi: remove adl_pci7230 and adl_pci7432 drivers"). Although the new driver code agrees with the user manuals for the respective boards, digital outputs stopped working on the PCI-7230. This has 16 digital output channels and the previous adl_pci7230 driver shifted the 16 bit output state left by 16 bits before writing to the hardware register. The new adl_pci7x3x driver doesn't do that. Fix it in `adl_pci7x3x_do_insn_bits()` by checking for the special case of the subdevice having only 16 channels and duplicating the 16 bit output state into both halves of the 32-bit register. That should work both for what the board actually does and for what the user manual says it should do. Fixes: 8f567c373c4b ("staging: comedi: new adl_pci7x3x driver") Signed-off-by: Ian Abbott Cc: # 3.13+, needs backporting for 3.7 to 3.12 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci7x3x.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci7x3x.c b/drivers/staging/comedi/drivers/adl_pci7x3x.c index 934af3ff7897..b0fc027cf485 100644 --- a/drivers/staging/comedi/drivers/adl_pci7x3x.c +++ b/drivers/staging/comedi/drivers/adl_pci7x3x.c @@ -120,8 +120,20 @@ static int adl_pci7x3x_do_insn_bits(struct comedi_device *dev, { unsigned long reg = (unsigned long)s->private; - if (comedi_dio_update_state(s, data)) - outl(s->state, dev->iobase + reg); + if (comedi_dio_update_state(s, data)) { + unsigned int val = s->state; + + if (s->n_chan == 16) { + /* + * It seems the PCI-7230 needs the 16-bit DO state + * to be shifted left by 16 bits before being written + * to the 32-bit register. Set the value in both + * halves of the register to be sure. + */ + val |= val << 16; + } + outl(val, dev->iobase + reg); + } data[1] = s->state; From 358d577ce1a7c56c4300a5b773dbf98cf9c76ae2 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 14 Aug 2015 11:54:05 +0300 Subject: [PATCH 827/912] staging: comedi: me4000: use bitwise AND instead of logical This was supposed to bitwise AND but there is a typo. Fixes: 1a02387063fb ('staging: comedi: me4000: remove 'board' from me4000_ai_insn_read()') Signed-off-by: Dan Carpenter Reviewed-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 5aa1780cf42b..15a53204a36a 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -480,7 +480,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev, entry = chan | ME4000_AI_LIST_RANGE(range); if (aref == AREF_DIFF) { - if (!(s->subdev_flags && SDF_DIFF)) { + if (!(s->subdev_flags & SDF_DIFF)) { dev_err(dev->class_dev, "Differential inputs are not available\n"); return -EINVAL; @@ -559,7 +559,7 @@ static int me4000_ai_check_chanlist(struct comedi_device *dev, } if (aref == AREF_DIFF) { - if (!(s->subdev_flags && SDF_DIFF)) { + if (!(s->subdev_flags & SDF_DIFF)) { dev_err(dev->class_dev, "Differential inputs are not available\n"); return -EINVAL; From 7d2b212f88c369b11fc7c791d02d915ad0121d58 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:12 +0900 Subject: [PATCH 828/912] staging: wilc1000: remove commented code Remove commented code that is not used. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 1 - drivers/staging/wilc1000/host_interface.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 72ff7d42377e..a88b796fb6c9 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1332,7 +1332,6 @@ void ProcessStrWid(char *pcPacket, s32 *ps32PktLen, if (g_oper_mode == SET_CFG) { /* Message Length */ - /* u16MsgLen = WILC_strlen(pu8val); */ u16MsgLen = (u16)s32ValueSize; /* Length */ diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index cc549c2c5213..31790a3d0f36 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -5159,9 +5159,7 @@ s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassP { s32 s32Error = WILC_SUCCESS; tstrWID strWID; - /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ - /* u8 u8Psklength = WILC_strlen(pu8PassPhrase); */ /*validating psk length*/ if ((u8Psklength > 7) && (u8Psklength < 65)) { strWID.u16WIDid = (u16)WID_11I_PSK; From ff96dfb5b1739c84587be23f113078850a0cef4c Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:13 +0900 Subject: [PATCH 829/912] staging: wilc1000: use strlen instead of WILC_strlen Use strlen instead of WILC_strlen that is a custom function. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index a88b796fb6c9..c59d9ba298cc 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1577,8 +1577,8 @@ s32 further_process_response(u8 *resp, case WID_ADR: create_mac_addr(cfg_str, resp + idx); - WILC_strncpy(pstrWIDresult->ps8WidVal, cfg_str, WILC_strlen(cfg_str)); - pstrWIDresult->ps8WidVal[WILC_strlen(cfg_str)] = '\0'; + WILC_strncpy(pstrWIDresult->ps8WidVal, cfg_str, strlen(cfg_str)); + pstrWIDresult->ps8WidVal[strlen(cfg_str)] = '\0'; break; case WID_IP: From 1799cb6188beeff1b36c8968f942e9a15759b773 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:14 +0900 Subject: [PATCH 830/912] staging: wilc1000: remove WILC_strlen function Remove WILC_strlen function that is changed to strlen. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_strutils.c | 9 --------- drivers/staging/wilc1000/wilc_strutils.h | 10 ---------- 2 files changed, 19 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c index a32b9c13e872..205a06a5a116 100644 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ b/drivers/staging/wilc1000/wilc_strutils.c @@ -50,12 +50,3 @@ s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, return s32Result; } -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -u32 WILC_strlen(const char *pcStr) -{ - return (u32)strlen(pcStr); -} diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h index 9e3c5d9c5001..7c38e14fc397 100644 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ b/drivers/staging/wilc1000/wilc_strutils.h @@ -95,15 +95,5 @@ char *WILC_strncpy(char *pcTarget, const char *pcSource, s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, u32 u32Count); -/*! - * @brief gets the length of a string - * @param[in] pcStr the string - * @return the length - * @note this function repeats the functionality of standard strlen - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -u32 WILC_strlen(const char *pcStr); #endif From 85b509f18a7f27d6cc296d62e96e4632c83161fd Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:15 +0900 Subject: [PATCH 831/912] staging: wilc1000: Use strncpy instead of WILC_strncpy Use strncpy instead of WILC_strncpy that is a custom function Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index c59d9ba298cc..a950d4054e38 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1577,7 +1577,7 @@ s32 further_process_response(u8 *resp, case WID_ADR: create_mac_addr(cfg_str, resp + idx); - WILC_strncpy(pstrWIDresult->ps8WidVal, cfg_str, strlen(cfg_str)); + strncpy(pstrWIDresult->ps8WidVal, cfg_str, strlen(cfg_str)); pstrWIDresult->ps8WidVal[strlen(cfg_str)] = '\0'; break; From 24e326ea2946863ea79d3b3af29815f5d49092b0 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:16 +0900 Subject: [PATCH 832/912] staging: wilc1000: remove WILC_strncpy function Remove WILC_strncpy function that is changed to strncpy. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_strutils.c | 10 ---------- drivers/staging/wilc1000/wilc_strutils.h | 14 -------------- 2 files changed, 24 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c index 205a06a5a116..337e62ff3c79 100644 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ b/drivers/staging/wilc1000/wilc_strutils.c @@ -17,16 +17,6 @@ void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count) } -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -char *WILC_strncpy(char *pcTarget, const char *pcSource, - u32 u32Count) -{ - return strncpy(pcTarget, pcSource, u32Count); -} s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, u32 u32Count) diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h index 7c38e14fc397..86728d203f71 100644 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ b/drivers/staging/wilc1000/wilc_strutils.h @@ -59,20 +59,6 @@ static WILC_ErrNo WILC_memcpy(void *pvTarget, const void *pvSource, u32 u32Count } -/*! - * @brief copies the contents of source string into the target string - * @param[in] pcTarget the target string buffer - * @param[in] pcSource the source string the will be copied - * @param[in] u32Count copying will proceed until a null character in pcSource - * is encountered or u32Count of bytes copied - * @return value of pcTarget - * @note this function repeats the functionality of standard strncpy - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -char *WILC_strncpy(char *pcTarget, const char *pcSource, - u32 u32Count); /*! * @brief Compares two strings up to u32Count characters From 3f882895c717ec107820d7a53919110af702652d Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:17 +0900 Subject: [PATCH 833/912] staging: wilc1000: use strncmp instead of WILC_strncmp Use strncmp instead of WILC_strncmp. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 5c459679aa5a..9e589a0c7b73 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -833,7 +833,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv); #ifdef WILC_P2P - if (!(WILC_strncmp(sme->ssid, "DIRECT-", 7))) { + if (!(strncmp(sme->ssid, "DIRECT-", 7))) { PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n"); pstrWFIDrv->u8P2PConnect = 1; } else From 31126a478fcc9020234d45576b432e7789081e0d Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:18 +0900 Subject: [PATCH 834/912] staging: wilc1000: remove WILC_strncmp function Remove WILC_strncmp function that is changed to strncmp. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_strutils.c | 21 --------------------- drivers/staging/wilc1000/wilc_strutils.h | 20 -------------------- 2 files changed, 41 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c index 337e62ff3c79..cc4e9fe0e7ce 100644 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ b/drivers/staging/wilc1000/wilc_strutils.c @@ -18,25 +18,4 @@ void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count) -s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, - u32 u32Count) -{ - s32 s32Result; - - if (pcStr1 == NULL && pcStr2 == NULL) { - s32Result = 0; - } else if (pcStr1 == NULL) { - s32Result = -1; - } else if (pcStr2 == NULL) { - s32Result = 1; - } else { - s32Result = strncmp(pcStr1, pcStr2, u32Count); - if (s32Result < 0) - s32Result = -1; - else if (s32Result > 0) - s32Result = 1; - } - - return s32Result; -} diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h index 86728d203f71..03f4938a81e1 100644 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ b/drivers/staging/wilc1000/wilc_strutils.h @@ -60,26 +60,6 @@ static WILC_ErrNo WILC_memcpy(void *pvTarget, const void *pvSource, u32 u32Count -/*! - * @brief Compares two strings up to u32Count characters - * @details Compares 2 strings reporting which is bigger, NULL is considered - * the smallest string, then a zero length string then all other - * strings depending on thier ascii characters order with small case - * converted to uppder case - * @param[in] pcStr1 the first string, NULL is valid and considered smaller - * than any other non-NULL string (incliding zero lenght strings) - * @param[in] pcStr2 the second string, NULL is valid and considered smaller - * than any other non-NULL string (incliding zero lenght strings) - * @param[in] u32Count copying will proceed until a null character in pcStr1 or - * pcStr2 is encountered or u32Count of bytes copied - * @return 0 if the 2 strings are equal, 1 if pcStr1 is bigger than pcStr2, - * -1 if pcStr1 smaller than pcStr2 - * @author aabozaeid - * @date 7 Dec 2010 - * @version 1.0 - */ -s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, - u32 u32Count); #endif From d00d2ba33351007c752ed0e95adaa0d7728ec1b8 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:19 +0900 Subject: [PATCH 835/912] staging: wilc1000: use memcpy instead of WILC_memcpy Use memcpy instead of WILC_memcpy that is a custom function. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 22 +- drivers/staging/wilc1000/host_interface.c | 200 +++++++++--------- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_msgqueue.c | 4 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 52 ++--- 5 files changed, 140 insertions(+), 140 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index a950d4054e38..5bb1b1550f98 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -544,21 +544,21 @@ INLINE u8 get_from_ds(u8 *header) /* header and updates the MAC Address in the allocated 'addr' variable. */ INLINE void get_address1(u8 *pu8msa, u8 *addr) { - WILC_memcpy(addr, pu8msa + 4, 6); + memcpy(addr, pu8msa + 4, 6); } /* This function extracts the MAC Address in 'address2' field of the MAC */ /* header and updates the MAC Address in the allocated 'addr' variable. */ INLINE void get_address2(u8 *pu8msa, u8 *addr) { - WILC_memcpy(addr, pu8msa + 10, 6); + memcpy(addr, pu8msa + 10, 6); } /* This function extracts the MAC Address in 'address3' field of the MAC */ /* header and updates the MAC Address in the allocated 'addr' variable. */ INLINE void get_address3(u8 *pu8msa, u8 *addr) { - WILC_memcpy(addr, pu8msa + 16, 6); + memcpy(addr, pu8msa + 16, 6); } /* This function extracts the BSSID from the incoming WLAN packet based on */ @@ -863,7 +863,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) pstrNetworkInfo->pu8IEs = (u8 *)WILC_MALLOC(u16IEsLen); memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); - WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); + memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); } pstrNetworkInfo->u16IEsLen = u16IEsLen; @@ -950,7 +950,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, pstrConnectRespInfo->pu8RespIEs = (u8 *)WILC_MALLOC(u16IEsLen); memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); - WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); + memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); pstrConnectRespInfo->u16RespIEsLen = u16IEsLen; } @@ -1037,7 +1037,7 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ pu8BufferPtr += 2; for (j = 0; j < u32SurveyBytesLength; j += SURVEY_RESULT_LENGTH) { - WILC_memcpy(&pstrSurveyResults[u32SurveyResultsCount], pu8BufferPtr, SURVEY_RESULT_LENGTH); + memcpy(&pstrSurveyResults[u32SurveyResultsCount], pu8BufferPtr, SURVEY_RESULT_LENGTH); pu8BufferPtr += SURVEY_RESULT_LENGTH; u32SurveyResultsCount++; } @@ -1562,10 +1562,10 @@ s32 further_process_response(u8 *resp, } case WID_STR: - WILC_memcpy(cfg_str, resp + idx, cfg_len); + memcpy(cfg_str, resp + idx, cfg_len); /* cfg_str[cfg_len] = '\0'; //mostafa: no need currently for NULL termination */ if (pstrWIDresult->s32ValueSize >= cfg_len) { - WILC_memcpy(pstrWIDresult->ps8WidVal, cfg_str, cfg_len); /* mostafa: no need currently for the extra NULL byte */ + memcpy(pstrWIDresult->ps8WidVal, cfg_str, cfg_len); /* mostafa: no need currently for the extra NULL byte */ pstrWIDresult->s32ValueSize = cfg_len; } else { PRINT_ER("allocated WID buffer length is smaller than the received WID Length\n"); @@ -1591,7 +1591,7 @@ s32 further_process_response(u8 *resp, case WID_BIN_DATA: if (pstrWIDresult->s32ValueSize >= cfg_len) { - WILC_memcpy(pstrWIDresult->ps8WidVal, resp + idx, cfg_len); + memcpy(pstrWIDresult->ps8WidVal, resp + idx, cfg_len); pstrWIDresult->s32ValueSize = cfg_len; } else { PRINT_ER("Allocated WID buffer length is smaller than the received WID Length Err(%d)\n", retval); @@ -1879,10 +1879,10 @@ s32 ConfigProvideResponse(char *pcRespBuffer, s32 s32RespLen) if (gstrConfigPktInfo.bRespRequired) { if (s32RespLen <= gstrConfigPktInfo.s32MaxRespBuffLen) { - WILC_memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, s32RespLen); + memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, s32RespLen); gstrConfigPktInfo.s32BytesRead = s32RespLen; } else { - WILC_memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, gstrConfigPktInfo.s32MaxRespBuffLen); + memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, gstrConfigPktInfo.s32MaxRespBuffLen); gstrConfigPktInfo.s32BytesRead = gstrConfigPktInfo.s32MaxRespBuffLen; PRINT_ER("BusProvideResponse() Response greater than the prepared Buffer Size\n"); } diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 31790a3d0f36..dedba7fe998c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -739,7 +739,7 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr); - WILC_memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); + memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); /*prepare configuration packet*/ strWID.u16WIDid = (u16)WID_IP_ADDRESS; @@ -795,7 +795,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); - WILC_memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); + memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); /*get the value by searching the local copy*/ WILC_FREE(strWID.ps8WidVal); @@ -843,7 +843,7 @@ static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrH PRINT_ER("No buffer to send mac address\n"); return WILC_FAIL; } - WILC_memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); + memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); /*prepare configuration packet*/ strWID.u16WIDid = (u16)WID_MAC_ADDR; @@ -1293,7 +1293,7 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; - WILC_memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); + memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; } @@ -1513,7 +1513,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /* use the parsed info in pstrSurveyResults, then deallocate it */ PRINT_D(HOSTINF_DBG, "Copying site survey results in global structure, then deallocate\n"); for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { - WILC_memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], + memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], sizeof(wid_site_survey_reslts_s)); } @@ -1559,13 +1559,13 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon if (pstrHostIFconnectAttr->pu8bssid != NULL) { pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = (u8 *)WILC_MALLOC(6); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; if (pstrHostIFconnectAttr->pu8ssid != NULL) { pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; } @@ -1573,7 +1573,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; if (pstrHostIFconnectAttr->pu8IEs != NULL) { pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -1666,13 +1666,13 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon if (pstrHostIFconnectAttr->pu8bssid != NULL) { pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = (u8 *)WILC_MALLOC(6); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; if (pstrHostIFconnectAttr->pu8ssid != NULL) { pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; } @@ -1680,7 +1680,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; if (pstrHostIFconnectAttr->pu8IEs != NULL) { pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -1774,7 +1774,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; } pu8CurrByte += MAX_SSID_LEN; @@ -1785,7 +1785,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon *(pu8CurrByte++) = 0xFF; } if (pstrHostIFconnectAttr->pu8bssid != NULL) - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); pu8CurrByte += 6; /* keep the buffer at the start of the allocated pointer to use it with the free*/ @@ -1812,7 +1812,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon if (pstrHostIFconnectAttr->pu8ssid != NULL) { - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; } pu8CurrByte += MAX_SSID_LEN; @@ -1833,12 +1833,12 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /* sa*/ if (pstrHostIFconnectAttr->pu8bssid != NULL) - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); pu8CurrByte += 6; /* bssid*/ if (pstrHostIFconnectAttr->pu8bssid != NULL) - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); pu8CurrByte += 6; /* Beacon Period*/ @@ -1849,7 +1849,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); /* Supported rates*/ - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); + memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); pu8CurrByte += (MAX_RATES_SUPPORTED + 1); /* wmm cap*/ @@ -1873,15 +1873,15 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); /* rsn pcip policy*/ - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); + memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); /* rsn auth policy*/ - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); + memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); /* rsn auth policy*/ - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); + memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); /*BugID_5137*/ @@ -1906,15 +1906,15 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); + memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); + memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); + memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); @@ -1946,7 +1946,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); if (pstrHostIFconnectAttr->pu8bssid != NULL) { - WILC_memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); + memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); PRINT_D(GENERIC_DBG, "save Bssid = %x:%x:%x:%x:%x:%x\n", (pstrHostIFconnectAttr->pu8bssid[0]), (pstrHostIFconnectAttr->pu8bssid[1]), (pstrHostIFconnectAttr->pu8bssid[2]), (pstrHostIFconnectAttr->pu8bssid[3]), (pstrHostIFconnectAttr->pu8bssid[4]), (pstrHostIFconnectAttr->pu8bssid[5])); PRINT_D(GENERIC_DBG, "save bssid = %x:%x:%x:%x:%x:%x\n", (u8ConnectedSSID[0]), (u8ConnectedSSID[1]), (u8ConnectedSSID[2]), (u8ConnectedSSID[3]), (u8ConnectedSSID[4]), (u8ConnectedSSID[5])); @@ -1974,12 +1974,12 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon if (pstrHostIFconnectAttr->pfConnectResult != NULL) { if (pstrHostIFconnectAttr->pu8bssid != NULL) - WILC_memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); + memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); if (pstrHostIFconnectAttr->pu8IEs != NULL) { strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); - WILC_memcpy(strConnectInfo.pu8ReqIEs, + memcpy(strConnectInfo.pu8ReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -2130,14 +2130,14 @@ static s32 Handle_ConnectTimeout(void *drvHandler) * WID_DISCONNECT} */ if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_memcpy(strConnectInfo.au8bssid, + memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); } if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); - WILC_memcpy(strConnectInfo.pu8ReqIEs, + memcpy(strConnectInfo.pu8ReqIEs, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); } @@ -2274,7 +2274,7 @@ static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdN if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) && (pstrNetworkInfo->au8bssid != NULL)) { - WILC_memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, + memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, pstrNetworkInfo->au8bssid, 6); pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; @@ -2427,7 +2427,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst strConnectInfo.pu8RespIEs = (u8 *)WILC_MALLOC(pstrConnectRespInfo->u16RespIEsLen); - WILC_memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, + memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, pstrConnectRespInfo->u16RespIEsLen); } } @@ -2458,11 +2458,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* through a structure of type tstrConnectRespInfo */ if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); - WILC_memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); + memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { - WILC_memcpy(pstrWFIDrv->au8AssociatedBSSID, + memcpy(pstrWFIDrv->au8AssociatedBSSID, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); } } @@ -2471,7 +2471,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); - WILC_memcpy(strConnectInfo.pu8ReqIEs, + memcpy(strConnectInfo.pu8ReqIEs, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); } @@ -2713,7 +2713,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) return -1; } - WILC_memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, + memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); @@ -2741,9 +2741,9 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) } pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; - WILC_memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); + memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); - WILC_memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, + memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); @@ -2800,14 +2800,14 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) - WILC_memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); + memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); - WILC_memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); + memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); - WILC_memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); + memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); - WILC_memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ strWIDList[0].u16WIDid = (u16)WID_11I_MODE; @@ -2849,16 +2849,16 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) - WILC_memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); + memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); else PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n"); - WILC_memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); + memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); - WILC_memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); + memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); - WILC_memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); - WILC_memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); + memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); strWID.u16WIDid = (u16)WID_ADD_RX_GTK; @@ -2904,12 +2904,12 @@ _WPARxGtk_end_case_: | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |-----------------------------------------------------------------------------|*/ - WILC_memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ + memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ - WILC_memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); - WILC_memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); + memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); + memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); /*16 byte TK*/ - WILC_memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); @@ -2951,11 +2951,11 @@ _WPARxGtk_end_case_: | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |-----------------------------------------------------------------------------|*/ - WILC_memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ + memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ - WILC_memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); + memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); /*16 byte TK*/ - WILC_memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); @@ -2994,8 +2994,8 @@ _WPAPtk_end_case_: for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { - WILC_memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); - WILC_memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, PMKID_LEN); + memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); + memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, PMKID_LEN); } strWID.u16WIDid = (u16)WID_PMKID_INFO; @@ -3377,7 +3377,7 @@ static s32 Handle_Get_InActiveTime(void *drvHandler, tstrHostIfStaInactiveT *str stamac = strWID.ps8WidVal; - WILC_memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); + memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); @@ -3552,7 +3552,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta pu8CurrByte = pu8Buffer; PRINT_D(HOSTINF_DBG, "Packing STA params\n"); - WILC_memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); + memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); pu8CurrByte += ETH_ALEN; *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; @@ -3560,7 +3560,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta *pu8CurrByte++ = pstrStationParam->u8NumRates; if (pstrStationParam->u8NumRates > 0) - WILC_memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); + memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); pu8CurrByte += pstrStationParam->u8NumRates; *pu8CurrByte++ = pstrStationParam->bIsHTSupported; @@ -3568,7 +3568,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->u8AmpduParams; - WILC_memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); + memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; @@ -3668,7 +3668,7 @@ static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllSt for (i = 0; i < MAX_NUM_STA; i++) { if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) - WILC_memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); + memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); else continue; @@ -3720,7 +3720,7 @@ static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaPara pu8CurrByte = strWID.ps8WidVal; - WILC_memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); + memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); /*Sending Cfg*/ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv); @@ -3890,7 +3890,7 @@ static int Handle_RegisterFrame(void *drvHandler, tstrHostIfRegisterFrame *pstrH *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; - WILC_memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); + memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); strWID.s32ValueSize = sizeof(u16) + 2; @@ -4133,7 +4133,7 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos *ptr++ = 0x14; *ptr++ = 0x3; *ptr++ = 0x0; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; /* BA Policy*/ @@ -4165,7 +4165,7 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos *ptr++ = 15; *ptr++ = 7; *ptr++ = 0x2; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; /* TID*/ *ptr++ = strHostIfBASessionInfo->u8Ted; @@ -4218,7 +4218,7 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos *ptr++ = 0x14; *ptr++ = 0x3; *ptr++ = 0x2; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; /* BA direction = recipent*/ @@ -4239,7 +4239,7 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos *ptr++ = 15; *ptr++ = 7; *ptr++ = 0x3; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; /* TID*/ *ptr++ = strHostIfBASessionInfo->u8Ted; @@ -4287,7 +4287,7 @@ static s32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessionInfo * *ptr++ = 0x14; *ptr++ = 0x3; *ptr++ = 0x2; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; /* BA direction = recipent*/ @@ -4740,7 +4740,7 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = (u8 *)WILC_MALLOC(u8WepKeylen); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pu8WepKey, u8WepKeylen); @@ -4810,7 +4810,7 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = (u8 *)WILC_MALLOC((u8WepKeylen)); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pu8WepKey, (u8WepKeylen)); @@ -4893,12 +4893,12 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = (u8 *)WILC_MALLOC(u8PtkKeylen); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pu8Ptk, u8PtkKeylen); if (pu8RxMic != NULL) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, pu8RxMic, RX_MIC_KEY_LEN); if (INFO) { for (i = 0; i < RX_MIC_KEY_LEN; i++) @@ -4907,7 +4907,7 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen } if (pu8TxMic != NULL) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, pu8TxMic, TX_MIC_KEY_LEN); if (INFO) { for (i = 0; i < TX_MIC_KEY_LEN; i++) @@ -4979,7 +4979,7 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = (u8 *)WILC_MALLOC(u32KeyRSClen); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, KeyRSC, u32KeyRSClen); } @@ -5001,18 +5001,18 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = (u8 *)WILC_MALLOC(u8KeyLen); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pu8RxGtk, u8GtkKeylen); if (pu8RxMic != NULL) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, pu8RxMic, RX_MIC_KEY_LEN); } if (pu8TxMic != NULL) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, pu8TxMic, TX_MIC_KEY_LEN); } @@ -5084,10 +5084,10 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, ETH_ALEN); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, PMKID_LEN); } @@ -5225,7 +5225,7 @@ s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) /* prepare setting mac address message */ memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MAC_ADDRESS; - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); strHostIFmsg.drvHandler = hWFIDrv; s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); @@ -5456,14 +5456,14 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, if (pu8bssid != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = (u8 *)WILC_MALLOC(6); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, pu8bssid, 6); } if (pu8ssid != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.ssidLen = ssidLen; strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = (u8 *)WILC_MALLOC(ssidLen); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, pu8ssid, ssidLen); } @@ -5471,7 +5471,7 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, if (pu8IEs != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.IEsLen = IEsLen; strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = (u8 *)WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, pu8IEs, IEsLen); } if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) @@ -5975,7 +5975,7 @@ s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac, mac, ETH_ALEN); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_INACTIVETIME; @@ -6203,12 +6203,12 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = (u8 *)WILC_MALLOC(u8ChnlListLen); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, pu8ChnlFreqList, u8ChnlListLen); strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.IEsLen = IEsLen; strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = (u8 *)WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, pu8IEs, IEsLen); /* send the message */ @@ -6792,7 +6792,7 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.u32Length = u32Length; strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = (u8 *)WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, + memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, pu8Buffer, u32Length); /* send the message */ @@ -6855,7 +6855,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.u32Length = u32Length; strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = (u8 *)WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, + memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, pu8Buffer, u32Length); /* send the message */ @@ -6907,7 +6907,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) /*strHostIFmsg.uniHostIFmsgBody.strScanComplete.u32Length = u32Length; * strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); - * WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer, + * memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer, * pu8Buffer, u32Length); */ /* send the message */ @@ -7104,7 +7104,7 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, pstrSetBeaconParam->pu8Head = (u8 *)WILC_MALLOC(u32HeadLen); if (pstrSetBeaconParam->pu8Head == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - WILC_memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); + memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); pstrSetBeaconParam->u32TailLen = u32TailLen; /* Bug 4599 : if tail length = 0 skip allocating & copying */ @@ -7112,7 +7112,7 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); if (pstrSetBeaconParam->pu8Tail == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - WILC_memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); + memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); } else { pstrSetBeaconParam->pu8Tail = NULL; } @@ -7197,13 +7197,13 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_STATION; strHostIFmsg.drvHandler = hWFIDrv; - WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); + memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); WILC_NULLCHECK(s32Error, rates); - WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); pstrAddStationMsg->pu8Rates = rates; } @@ -7251,7 +7251,7 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) if (pu8MacAddr == NULL) memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); else - WILC_memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); + memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); if (s32Error) @@ -7296,7 +7296,7 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] /* Handling situation of deauthenticing all associated stations*/ for (i = 0; i < MAX_NUM_STA; i++) { if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { - WILC_memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); + memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", pstrDelAllStationMsg->au8Sta_DelAllSta[i][0], pstrDelAllStationMsg->au8Sta_DelAllSta[i][1], pstrDelAllStationMsg->au8Sta_DelAllSta[i][2], pstrDelAllStationMsg->au8Sta_DelAllSta[i][3], pstrDelAllStationMsg->au8Sta_DelAllSta[i][4], pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); u8AssocNumb++; @@ -7352,12 +7352,12 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS strHostIFmsg.u16MsgId = HOST_IF_MSG_EDIT_STATION; strHostIFmsg.drvHandler = hWFIDrv; - WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); + memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); WILC_NULLCHECK(s32Error, rates); - WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); pstrAddStationMsg->pu8Rates = rates; } @@ -7477,10 +7477,10 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; - WILC_memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); + memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); /*for(i=0; i<6;i++) * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ - WILC_memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); + memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); @@ -7568,13 +7568,13 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pNewJoinBssParam->u8Count = pu8IEs[index + 11]; u16P2P_count = index + 12; - WILC_memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); + memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); u16P2P_count += 4; - WILC_memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); + memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); u16P2P_count += 4; - WILC_memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); + memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); index += pu8IEs[index + 1] + 2; continue; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 1384846a5d01..4b5e5b264e85 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2105,7 +2105,7 @@ static void wilc_set_multicast_list(struct net_device *dev) /* Store all of the multicast addresses in the hardware filter */ netdev_for_each_mc_addr(ha, dev) { - WILC_memcpy(gau8MulticastMacAddrList[i], ha->addr, ETH_ALEN); + memcpy(gau8MulticastMacAddrList[i], ha->addr, ETH_ALEN); PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i, gau8MulticastMacAddrList[i][0], gau8MulticastMacAddrList[i][1], gau8MulticastMacAddrList[i][2], gau8MulticastMacAddrList[i][3], gau8MulticastMacAddrList[i][4], gau8MulticastMacAddrList[i][5]); i++; diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index 16bcef4b5c00..2b083525af47 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -77,7 +77,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, pstrMessage->pstrNext = NULL; pstrMessage->pvBuffer = WILC_MALLOC(u32SendBufferSize); WILC_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer); - WILC_memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize); + memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize); /* add it to the message queue */ @@ -170,7 +170,7 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, /* consume the message */ pHandle->u32ReceiversCount--; - WILC_memcpy(pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length); + memcpy(pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length); *pu32ReceivedLength = pstrMessage->u32Length; pHandle->pstrMessageList = pstrMessage->pstrNext; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 9e589a0c7b73..99d859dd6177 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -321,10 +321,10 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo astrLastScannedNtwrksShadow[ap_index].u16CapInfo = pstrNetworkInfo->u16CapInfo; astrLastScannedNtwrksShadow[ap_index].u8SsidLen = pstrNetworkInfo->u8SsidLen; - WILC_memcpy(astrLastScannedNtwrksShadow[ap_index].au8ssid, + memcpy(astrLastScannedNtwrksShadow[ap_index].au8ssid, pstrNetworkInfo->au8ssid, pstrNetworkInfo->u8SsidLen); - WILC_memcpy(astrLastScannedNtwrksShadow[ap_index].au8bssid, + memcpy(astrLastScannedNtwrksShadow[ap_index].au8bssid, pstrNetworkInfo->au8bssid, ETH_ALEN); astrLastScannedNtwrksShadow[ap_index].u16BeaconPeriod = pstrNetworkInfo->u16BeaconPeriod; @@ -337,7 +337,7 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo WILC_FREE(astrLastScannedNtwrksShadow[ap_index].pu8IEs); astrLastScannedNtwrksShadow[ap_index].pu8IEs = (u8 *)WILC_MALLOC(pstrNetworkInfo->u16IEsLen); /* will be deallocated by the WILC_WFI_CfgScan() function */ - WILC_memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs, + memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs, pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen); astrLastScannedNtwrksShadow[ap_index].u32TimeRcvdInScan = jiffies; @@ -590,7 +590,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, PRINT_INFO(CFG80211_DBG, "Connection Successful:: BSSID: %x%x%x%x%x%x\n", pstrConnectInfo->au8bssid[0], pstrConnectInfo->au8bssid[1], pstrConnectInfo->au8bssid[2], pstrConnectInfo->au8bssid[3], pstrConnectInfo->au8bssid[4], pstrConnectInfo->au8bssid[5]); - WILC_memcpy(priv->au8AssociatedBss, pstrConnectInfo->au8bssid, ETH_ALEN); + memcpy(priv->au8AssociatedBss, pstrConnectInfo->au8bssid, ETH_ALEN); /* BugID_4209: if this network has expired in the scan results in the above nl80211 layer, refresh them here by calling * cfg80211_inform_bss() with the last Scan results before calling cfg80211_connect_result() to avoid @@ -764,7 +764,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r if (request->ssids[i].ssid != NULL && request->ssids[i].ssid_len != 0) { strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = WILC_MALLOC(request->ssids[i].ssid_len); - WILC_memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); + memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = request->ssids[i].ssid_len; } else { PRINT_D(CFG80211_DBG, "Received one NULL SSID\n"); @@ -915,7 +915,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, } priv->WILC_WFI_wep_default = sme->key_idx; priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len; - WILC_memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); + memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); /*BugID_5137*/ g_key_wep_params.key_len = sme->key_len; @@ -933,7 +933,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, priv->WILC_WFI_wep_default = sme->key_idx; priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len; - WILC_memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); + memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); /*BugID_5137*/ g_key_wep_params.key_len = sme->key_len; @@ -1149,7 +1149,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k priv->WILC_WFI_wep_default = key_index; priv->WILC_WFI_wep_key_len[key_index] = params->key_len; - WILC_memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); + memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); PRINT_D(CFG80211_DBG, "Adding AP WEP Default key Idx = %d\n", key_index); PRINT_D(CFG80211_DBG, "Adding AP WEP Key len= %d\n", params->key_len); @@ -1171,7 +1171,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { priv->WILC_WFI_wep_default = key_index; priv->WILC_WFI_wep_key_len[key_index] = params->key_len; - WILC_memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); + memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); PRINT_D(CFG80211_DBG, "Adding WEP Default key Idx = %d\n", key_index); PRINT_D(CFG80211_DBG, "Adding WEP Key length = %d\n", params->key_len); @@ -1222,7 +1222,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k WILC_FREE(priv->wilc_gtk[key_index]->key); priv->wilc_gtk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len); - WILC_memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len); + memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len); /* if there has been previous allocation for the same index through its seq, free that memory and allocate again*/ if (priv->wilc_gtk[key_index]->seq) @@ -1230,7 +1230,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k if ((params->seq_len) > 0) { priv->wilc_gtk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len); - WILC_memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len); + memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len); } priv->wilc_gtk[key_index]->cipher = params->cipher; @@ -1283,10 +1283,10 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k PRINT_INFO(CFG80211_DBG, "Adding group seq value[%d] = %x\n", i, params->seq[i]); } - WILC_memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len); + memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len); if ((params->seq_len) > 0) - WILC_memcpy(priv->wilc_ptk[key_index]->seq, params->seq, params->seq_len); + memcpy(priv->wilc_ptk[key_index]->seq, params->seq, params->seq_len); priv->wilc_ptk[key_index]->cipher = params->cipher; priv->wilc_ptk[key_index]->key_len = params->key_len; @@ -1902,9 +1902,9 @@ static int WILC_WFI_set_pmksa(struct wiphy *wiphy, struct net_device *netdev, } if (i < WILC_MAX_NUM_PMKIDS) { PRINT_D(CFG80211_DBG, "Setting PMKID in private structure\n"); - WILC_memcpy(priv->pmkid_list.pmkidlist[i].bssid, pmksa->bssid, + memcpy(priv->pmkid_list.pmkidlist[i].bssid, pmksa->bssid, ETH_ALEN); - WILC_memcpy(priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid, + memcpy(priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid, PMKID_LEN); if (!(flag == PMKID_FOUND)) priv->pmkid_list.numpmkid++; @@ -1954,10 +1954,10 @@ static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, if (i < priv->pmkid_list.numpmkid && priv->pmkid_list.numpmkid > 0) { for (; i < (priv->pmkid_list.numpmkid - 1); i++) { - WILC_memcpy(priv->pmkid_list.pmkidlist[i].bssid, + memcpy(priv->pmkid_list.pmkidlist[i].bssid, priv->pmkid_list.pmkidlist[i + 1].bssid, ETH_ALEN); - WILC_memcpy(priv->pmkid_list.pmkidlist[i].pmkid, + memcpy(priv->pmkid_list.pmkidlist[i].pmkid, priv->pmkid_list.pmkidlist[i].pmkid, PMKID_LEN); } @@ -2199,7 +2199,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size) pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv; /* Get WILC header */ - WILC_memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET); + memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET); /* The packet offset field conain info about what type of managment frame */ /* we are dealing with and ack status */ @@ -2466,7 +2466,7 @@ static int WILC_WFI_cancel_remain_on_channel(struct wiphy *wiphy, */ void WILC_WFI_add_wilcvendorspec(u8 *buff) { - WILC_memcpy(buff, u8P2P_vendorspec, sizeof(u8P2P_vendorspec)); + memcpy(buff, u8P2P_vendorspec, sizeof(u8P2P_vendorspec)); } /** * @brief WILC_WFI_mgmt_tx_frame @@ -2519,7 +2519,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy, PRINT_ER("Failed to allocate memory for mgmt_tx buff\n"); return WILC_FAIL; } - WILC_memcpy(mgmt_tx->buff, buf, len); + memcpy(mgmt_tx->buff, buf, len); mgmt_tx->size = len; @@ -3338,8 +3338,8 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev, if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { #ifndef WILC_FULLY_HOSTING_AP - WILC_memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); - WILC_memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); + memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); + memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); strStaParams.u16AssocID = params->aid; strStaParams.u8NumRates = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; @@ -3357,7 +3357,7 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.bIsHTSupported = true; strStaParams.u16HTCapInfo = params->ht_capa->cap_info; strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; - WILC_memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); + memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; @@ -3380,7 +3380,7 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev, #else PRINT_D(CFG80211_DBG, "Adding station parameters %d\n", params->aid); - WILC_memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); + memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][0], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][1], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][2], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][3], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][4], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][5]); @@ -3471,7 +3471,7 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev, if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { #ifndef WILC_FULLY_HOSTING_AP - WILC_memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); + memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); strStaParams.u16AssocID = params->aid; strStaParams.u8NumRates = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; @@ -3487,7 +3487,7 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.bIsHTSupported = true; strStaParams.u16HTCapInfo = params->ht_capa->cap_info; strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; - WILC_memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); + memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; From f78d5f809ee248bea66fad9fa14fe62b8aec57af Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:20 +0900 Subject: [PATCH 836/912] staging: wilc1000: remove WILC_memcpy function Remove WILC_memcpy function that is changed to memcpy. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_strutils.h | 30 ------------------------ 1 file changed, 30 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h index 03f4938a81e1..dbca73d86439 100644 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ b/drivers/staging/wilc1000/wilc_strutils.h @@ -27,36 +27,6 @@ */ void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count); -/*! - * @brief Copies the contents of a memory buffer into another - * @param[in] pvTarget the target buffer to which the data is copied into - * @param[in] pvSource pointer to the second memory location - * @param[in] u32Count the size of the data to copy - * @return WILC_SUCCESS if copy is successfully handeled - * WILC_FAIL if copy failed - * @note this function repeats the functionality of standard memcpy, - * however memcpy is undefined if the two buffers overlap but this - * implementation will check for overlap and report error - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -static WILC_ErrNo WILC_memcpy(void *pvTarget, const void *pvSource, u32 u32Count) -{ - if ( - (((u8 *)pvTarget <= (u8 *)pvSource) - && (((u8 *)pvTarget + u32Count) > (u8 *)pvSource)) - - || (((u8 *)pvSource <= (u8 *)pvTarget) - && (((u8 *)pvSource + u32Count) > (u8 *)pvTarget)) - ) { - /* ovelapped memory, return Error */ - return WILC_FAIL; - } else { - WILC_memcpy_INTERNAL(pvTarget, pvSource, u32Count); - return WILC_SUCCESS; - } -} From 9504f96492f477b20b97ec92d480f646b7e7a488 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:21 +0900 Subject: [PATCH 837/912] staging: wilc1000: remove WILC_memcpy_INTERNAL Remove WILC_memcpy_INTERNAL that is used in the WILC_memcpy because WILC_memcpy is replaced by memcpy. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_strutils.c | 9 --------- drivers/staging/wilc1000/wilc_strutils.h | 11 ----------- 2 files changed, 20 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c index cc4e9fe0e7ce..ebc8668a7ab9 100644 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ b/drivers/staging/wilc1000/wilc_strutils.c @@ -6,15 +6,6 @@ -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count) -{ - memcpy(pvTarget, pvSource, u32Count); -} diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h index dbca73d86439..bb7b61d619d2 100644 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ b/drivers/staging/wilc1000/wilc_strutils.h @@ -15,17 +15,6 @@ #include "wilc_errorsupport.h" -/*! - * @brief Internal implementation for memory copy - * @param[in] pvTarget the target buffer to which the data is copied into - * @param[in] pvSource pointer to the second memory location - * @param[in] u32Count the size of the data to copy - * @note this function should not be used directly, use WILC_memcpy instead - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count); From 071c19e73b605086a26d83ff911cdc6e6af0b3b8 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 10 Aug 2015 11:33:22 +0900 Subject: [PATCH 838/912] staging: wilc1000: remove wilc_strutils.c and wilc_strutils.h Remove wilc_strutils.c and wilc_strutils.h that are not needed. wilc_strutils.o is also removed in Makefile. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 2 +- drivers/staging/wilc1000/wilc_msgqueue.h | 1 - drivers/staging/wilc1000/wilc_oswrapper.h | 2 -- drivers/staging/wilc1000/wilc_strutils.c | 12 ------------ drivers/staging/wilc1000/wilc_strutils.h | 24 ----------------------- 5 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_strutils.c delete mode 100644 drivers/staging/wilc1000/wilc_strutils.h diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 5ca8fa253306..ec4b8778ba04 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -26,7 +26,7 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ - wilc_memory.o wilc_msgqueue.o wilc_sleep.o wilc_strutils.o \ + wilc_memory.o wilc_msgqueue.o wilc_sleep.o \ wilc_timer.o coreconfigurator.o host_interface.o \ wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h b/drivers/staging/wilc1000/wilc_msgqueue.h index 35b10019eebd..de374ac76bc6 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.h +++ b/drivers/staging/wilc1000/wilc_msgqueue.h @@ -13,7 +13,6 @@ #include "wilc_platform.h" #include "wilc_errorsupport.h" #include "wilc_memory.h" -#include "wilc_strutils.h" /*! * @struct tstrWILC_MsgQueueAttrs diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index e97aa96006e0..652c882dbb28 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -32,8 +32,6 @@ /* Memory support */ #include "wilc_memory.h" -/* String Utilities */ -#include "wilc_strutils.h" /* Message Queue */ #include "wilc_msgqueue.h" diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c deleted file mode 100644 index ebc8668a7ab9..000000000000 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ /dev/null @@ -1,12 +0,0 @@ - -#define _CRT_SECURE_NO_DEPRECATE - -#include "wilc_strutils.h" - - - - - - - - diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h deleted file mode 100644 index bb7b61d619d2..000000000000 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __WILC_STRUTILS_H__ -#define __WILC_STRUTILS_H__ - -/*! - * @file wilc_strutils.h - * @brief Basic string utilities - * @author syounan - * @sa wilc_oswrapper.h top level OS wrapper file - * @date 16 Aug 2010 - * @version 1.0 - */ - -#include -#include -#include "wilc_errorsupport.h" - - - - - - - - -#endif From 772a6e1fff9a8c942e982598632cfc41451e2e9a Mon Sep 17 00:00:00 2001 From: Jacob Kiefer Date: Sun, 9 Aug 2015 15:20:28 -0400 Subject: [PATCH 839/912] staging: rtl8723au: Fix Sparse errors in rtw_security.c This patch fixes the following sparse errors: CHECK drivers/staging/rtl8723au/core/rtw_security.c drivers/staging/rtl8723au/core/rtw_security.c:189:39: \ warning: incorrect type in assignment (different base types) drivers/staging/rtl8723au/core/rtw_security.c:189:39: \ expected unsigned int [unsigned] [usertype] drivers/staging/rtl8723au/core/rtw_security.c:189:39: \ got restricted __le32 [usertype] drivers/staging/rtl8723au/core/rtw_security.c:197:39: \ warning: incorrect type in assignment (different base types) drivers/staging/rtl8723au/core/rtw_security.c:197:39: \ expected unsigned int [unsigned] [usertype] drivers/staging/rtl8723au/core/rtw_security.c:197:39: \ got restricted __le32 [usertype] drivers/staging/rtl8723au/core/rtw_security.c:682:39: \ warning: incorrect type in assignment (different base types) drivers/staging/rtl8723au/core/rtw_security.c:682:39: \ expected unsigned int [unsigned] [usertype] drivers/staging/rtl8723au/core/rtw_security.c:682:39: \ got restricted __le32 [usertype] drivers/staging/rtl8723au/core/rtw_security.c:694:39: \ warning: incorrect type in assignment (different base types) drivers/staging/rtl8723au/core/rtw_security.c:694:39: \ expected unsigned int [unsigned] [usertype] drivers/staging/rtl8723au/core/rtw_security.c:694:39: \ got restricted __le32 [usertype] Signed-off-by: Jacob Kiefer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index af53c92fc3a2..3d40bab1d9c8 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -148,7 +148,7 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe) { /* exclude ICV */ - unsigned char crc[4]; + __le32 crc; struct arc4context mycontext; int curfragnum, length, index; u32 keylength; @@ -186,18 +186,20 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter, length = pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + crc = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, wepkey, 3 + keylength); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, + (char *)&crc, 4); } else { length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + crc = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, wepkey, 3 + keylength); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, + (char *)&crc, 4); pframe += pxmitpriv->frag_len; pframe = PTR_ALIGN(pframe, 4); @@ -602,7 +604,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, u32 pnh; u8 rc4key[16]; u8 ttkey[16]; - u8 crc[4]; + __le32 crc; u8 hw_hdr_offset = 0; struct arc4context mycontext; int curfragnum, length; @@ -679,11 +681,12 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, "pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len, pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + crc = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, + (char *)&crc, 4); } else { length = (pxmitpriv->frag_len - @@ -691,10 +694,11 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, pattrib->iv_len - pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + crc = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, + (char *)&crc, 4); pframe += pxmitpriv->frag_len; pframe = PTR_ALIGN(pframe, 4); From 642ac6c0dceb6292065d08925e6ffd6ef1fbc7e1 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Mon, 10 Aug 2015 13:30:33 +0530 Subject: [PATCH 840/912] Staging: wilc1000: Remove null check before kfree kfree on NULL pointer is a no-op. This patch uses the following semantic patch to find such an instance where NULL check is present before kfree. // @@ expression E; @@ - if (E != NULL) { kfree(E); } + kfree(E); @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // smpl> Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 4b5e5b264e85..e295e4ccad11 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2338,8 +2338,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) done: - if (buff != NULL) - kfree(buff); + kfree(buff); return s32Error; } From 94858feccaada3f1810ff50dd21d33b1d4d95d56 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Mon, 10 Aug 2015 13:30:34 +0530 Subject: [PATCH 841/912] Staging: lustre: libcfs: Remove unnecessary cast on void* This patch does away with the cast on void * as it is unnecessary. Semantic patch used is as follows: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (void *) e ) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 1ab4232e0705..ef8f12693051 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -335,7 +335,7 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *a return -ENOMEM; /* 'cmd' and permissions get checked in our arch-specific caller */ - if (libcfs_ioctl_getdata(buf, buf + 800, (void *)arg)) { + if (libcfs_ioctl_getdata(buf, buf + 800, arg)) { CERROR("PORTALS ioctl: data error\n"); err = -EINVAL; goto out; From 0df4e3e9bbf8968d5ff079b0ace3de9c0b971021 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Mon, 10 Aug 2015 13:30:35 +0530 Subject: [PATCH 842/912] Staging: unisys: Remove useless cast on void pointer void pointers do not need to be cast to other pointer types. The semantic patch used to find this: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (T *) e ) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index cc4a0292c287..ac39febdac55 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -716,7 +716,7 @@ unregister_driver_attributes(struct visor_driver *drv) static void dev_periodic_work(void *xdev) { - struct visor_device *dev = (struct visor_device *)xdev; + struct visor_device *dev = xdev; struct visor_driver *drv = to_visor_driver(dev->device.driver); down(&dev->visordriver_callback_lock); From 25bbe418f89bec661bcc0dfebcacd6705ed79de6 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Mon, 10 Aug 2015 10:25:08 +0200 Subject: [PATCH 843/912] staging: lustre-libcfs: fix sparse warning Fix sparse warnings of the following type: warning: symbol '....' was not declared. Should it be static? Signed-off-by: Patrick Boettcher Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/include/linux/libcfs/libcfs.h | 13 +++++++++++++ .../lustre/lustre/libcfs/linux/linux-module.c | 2 -- drivers/staging/lustre/lustre/libcfs/module.c | 11 +---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index d585041041c7..01961d9e6c36 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -148,4 +148,17 @@ void *libcfs_kvzalloc(size_t size, gfp_t flags); void *libcfs_kvzalloc_cpt(struct cfs_cpt_table *cptab, int cpt, size_t size, gfp_t flags); +extern struct miscdevice libcfs_dev; +/** + * The path of debug log dump upcall script. + */ +extern char lnet_upcall[1024]; +extern char lnet_debug_log_upcall[1024]; + +extern void libcfs_init_nidstrings(void); + +extern struct cfs_psdev_ops libcfs_psdev_ops; + +extern struct cfs_wi_sched *cfs_sched_rehash; + #endif /* _LIBCFS_H */ diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c index 78acff068217..64a984b42845 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c @@ -96,8 +96,6 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size) return 0; } -extern struct cfs_psdev_ops libcfs_psdev_ops; - static int libcfs_psdev_open(struct inode *inode, struct file *file) { diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index ef8f12693051..663f25bf5df8 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -66,19 +66,10 @@ MODULE_AUTHOR("Peter J. Braam "); MODULE_DESCRIPTION("Portals v3.1"); MODULE_LICENSE("GPL"); -extern struct miscdevice libcfs_dev; -extern struct cfs_wi_sched *cfs_sched_rehash; -extern void libcfs_init_nidstrings(void); - static void insert_debugfs(void); static void remove_debugfs(void); static struct dentry *lnet_debugfs_root; -extern char lnet_upcall[1024]; -/** - * The path of debug log dump upcall script. - */ -extern char lnet_debug_log_upcall[1024]; static void kportal_memhog_free(struct libcfs_device_userstate *ldu) { @@ -716,7 +707,7 @@ struct lnet_debugfs_symlink_def { char *target; }; -struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { +static struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { { "console_ratelimit", "/sys/module/libcfs/parameters/libcfs_console_ratelimit"}, { "debug_path", From a8365826553dc5f3d0cd4e05211b752a6f951fc8 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Mon, 10 Aug 2015 10:25:09 +0200 Subject: [PATCH 844/912] staging: lustre-libcfs: make static-variable constant This static can be made constant as it is never modified. Found during sparse-cleanup. Signed-off-by: Patrick Boettcher Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 663f25bf5df8..0128268f0251 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -707,7 +707,7 @@ struct lnet_debugfs_symlink_def { char *target; }; -static struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { +static const struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { { "console_ratelimit", "/sys/module/libcfs/parameters/libcfs_console_ratelimit"}, { "debug_path", @@ -762,7 +762,7 @@ static void insert_debugfs(void) { struct ctl_table *table; struct dentry *entry; - struct lnet_debugfs_symlink_def *symlinks; + const struct lnet_debugfs_symlink_def *symlinks; if (lnet_debugfs_root == NULL) lnet_debugfs_root = debugfs_create_dir("lnet", NULL); From 1b680a81814cebeafe7e01495d064188a3f2fa2f Mon Sep 17 00:00:00 2001 From: Swee Hua Law Date: Mon, 10 Aug 2015 21:54:15 +0800 Subject: [PATCH 845/912] staging: lustre: checkpatch: do not init global to NULL Fix checkpatch problem: remove NULL assignment fro global variable Signed-off-by: Swee Hua Law Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/remote_perm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c index a58182600dae..c9a78161bf5b 100644 --- a/drivers/staging/lustre/lustre/llite/remote_perm.c +++ b/drivers/staging/lustre/lustre/llite/remote_perm.c @@ -54,8 +54,8 @@ #include "../include/lustre_param.h" #include "llite_internal.h" -struct kmem_cache *ll_remote_perm_cachep = NULL; -struct kmem_cache *ll_rmtperm_hash_cachep = NULL; +struct kmem_cache *ll_remote_perm_cachep; +struct kmem_cache *ll_rmtperm_hash_cachep; static inline struct ll_remote_perm *alloc_ll_remote_perm(void) { From bcffa060c1dfda25dc8a5b1244330de939550f10 Mon Sep 17 00:00:00 2001 From: Swee Hua Law Date: Mon, 10 Aug 2015 21:54:16 +0800 Subject: [PATCH 846/912] staging: lustre: checkpatch: symbol == NULL should be !symbol Fix checkpatch problem: change == NULL comparison to !symbol Signed-off-by: Swee Hua Law Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/remote_perm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c index c9a78161bf5b..aeda91af0152 100644 --- a/drivers/staging/lustre/lustre/llite/remote_perm.c +++ b/drivers/staging/lustre/lustre/llite/remote_perm.c @@ -184,7 +184,7 @@ int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm) if (!lli->lli_remote_perms) { perm_hash = alloc_rmtperm_hash(); - if (perm_hash == NULL) { + if (!perm_hash) { CERROR("alloc lli_remote_perms failed!\n"); return -ENOMEM; } @@ -287,7 +287,7 @@ int lustre_check_remote_perm(struct inode *inode, int mask) perm = req_capsule_server_swab_get(&req->rq_pill, &RMF_ACL, lustre_swab_mdt_remote_perm); - if (unlikely(perm == NULL)) { + if (unlikely(!perm)) { mutex_unlock(&lli->lli_rmtperm_mutex); rc = -EPROTO; break; From aa62a8415e77c7c46be483cba7b650e1748dcb44 Mon Sep 17 00:00:00 2001 From: Swee Hua Law Date: Mon, 10 Aug 2015 21:54:17 +0800 Subject: [PATCH 847/912] staging: lustre: checkpatch: move */ block comment to next line Fix checkpatch problem: move */ from end of line to new line Signed-off-by: Swee Hua Law Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/remote_perm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c index aeda91af0152..49d78a373219 100644 --- a/drivers/staging/lustre/lustre/llite/remote_perm.c +++ b/drivers/staging/lustre/lustre/llite/remote_perm.c @@ -117,7 +117,8 @@ static inline int remote_perm_hashfunc(uid_t uid) } /* NB: setxid permission is not checked here, instead it's done on - * MDT when client get remote permission. */ + * MDT when client get remote permission. + */ static int do_check_remote_perm(struct ll_inode_info *lli, int mask) { struct hlist_head *head; From 049fbd9fcc848b667d9658618a4c09c706410813 Mon Sep 17 00:00:00 2001 From: Swee Hua Law Date: Mon, 10 Aug 2015 21:54:18 +0800 Subject: [PATCH 848/912] staging: lustre: checkpatch: argument alignment for readability Fix checkpatch problem: move last argument of the hlist..() back to same line Signed-off-by: Swee Hua Law Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/remote_perm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c index 49d78a373219..39022ea88b5f 100644 --- a/drivers/staging/lustre/lustre/llite/remote_perm.c +++ b/drivers/staging/lustre/lustre/llite/remote_perm.c @@ -104,8 +104,7 @@ void free_rmtperm_hash(struct hlist_head *hash) return; for (i = 0; i < REMOTE_PERM_HASHSIZE; i++) - hlist_for_each_entry_safe(lrp, next, hash + i, - lrp_list) + hlist_for_each_entry_safe(lrp, next, hash + i, lrp_list) free_ll_remote_perm(lrp); OBD_SLAB_FREE(hash, ll_rmtperm_hash_cachep, REMOTE_PERM_HASHSIZE * sizeof(*hash)); @@ -322,8 +321,7 @@ void ll_free_remote_perms(struct inode *inode) spin_lock(&lli->lli_lock); for (i = 0; i < REMOTE_PERM_HASHSIZE; i++) { - hlist_for_each_entry_safe(lrp, node, next, hash + i, - lrp_list) + hlist_for_each_entry_safe(lrp, node, next, hash + i, lrp_list) free_ll_remote_perm(lrp); } From 8150a97fdd095d0468fe75d0d5ce4c9e0cbaf3a3 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:21 -0700 Subject: [PATCH 849/912] staging: lustre: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignments Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- .../lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- .../lustre/lnet/klnds/socklnd/socklnd.h | 131 ++++---- .../staging/lustre/lnet/selftest/console.h | 90 +++--- .../lustre/lustre/include/lprocfs_status.h | 305 +++++++++--------- .../lustre/lustre/include/lustre/lustre_idl.h | 133 ++++---- .../lustre/include/lustre/lustre_user.h | 2 +- .../lustre/lustre/include/lustre_dlm.h | 2 +- .../lustre/lustre/include/lustre_export.h | 4 +- .../lustre/lustre/include/lustre_import.h | 4 +- .../lustre/lustre/include/lustre_net.h | 16 +- .../staging/lustre/lustre/include/obd_class.h | 16 +- .../lustre/lustre/include/obd_support.h | 6 +- .../lustre/lustre/ldlm/ldlm_internal.h | 2 +- .../staging/lustre/lustre/libcfs/tracefile.h | 32 +- .../lustre/lustre/llite/llite_internal.h | 16 +- 15 files changed, 378 insertions(+), 383 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 2991be85d8b3..8d4580244c26 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -642,7 +642,7 @@ typedef struct kib_peer { extern kib_data_t kiblnd_data; -extern void kiblnd_hdev_destroy(kib_hca_dev_t *hdev); +void kiblnd_hdev_destroy(kib_hca_dev_t *hdev); static inline void kiblnd_hdev_addref_locked(kib_hca_dev_t *hdev) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index cb91e68919d0..a0fcbc39f86b 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -520,8 +520,8 @@ ksocknal_conn_addref(ksock_conn_t *conn) atomic_inc(&conn->ksnc_conn_refcount); } -extern void ksocknal_queue_zombie_conn(ksock_conn_t *conn); -extern void ksocknal_finalize_zcreq(ksock_conn_t *conn); +void ksocknal_queue_zombie_conn(ksock_conn_t *conn); +void ksocknal_finalize_zcreq(ksock_conn_t *conn); static inline void ksocknal_conn_decref(ksock_conn_t *conn) @@ -566,8 +566,8 @@ ksocknal_tx_addref(ksock_tx_t *tx) atomic_inc(&tx->tx_refcount); } -extern void ksocknal_tx_prep(ksock_conn_t *, ksock_tx_t *tx); -extern void ksocknal_tx_done(lnet_ni_t *ni, ksock_tx_t *tx); +void ksocknal_tx_prep(ksock_conn_t *, ksock_tx_t *tx); +void ksocknal_tx_done(lnet_ni_t *ni, ksock_tx_t *tx); static inline void ksocknal_tx_decref(ksock_tx_t *tx) @@ -584,7 +584,7 @@ ksocknal_route_addref(ksock_route_t *route) atomic_inc(&route->ksnr_refcount); } -extern void ksocknal_destroy_route(ksock_route_t *route); +void ksocknal_destroy_route(ksock_route_t *route); static inline void ksocknal_route_decref(ksock_route_t *route) @@ -601,7 +601,7 @@ ksocknal_peer_addref(ksock_peer_t *peer) atomic_inc(&peer->ksnp_refcount); } -extern void ksocknal_destroy_peer(ksock_peer_t *peer); +void ksocknal_destroy_peer(ksock_peer_t *peer); static inline void ksocknal_peer_decref(ksock_peer_t *peer) @@ -621,70 +621,69 @@ int ksocknal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, unsigned int offset, unsigned int mlen, unsigned int rlen); int ksocknal_accept(lnet_ni_t *ni, struct socket *sock); -extern int ksocknal_add_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip, int port); -extern ksock_peer_t *ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id); -extern ksock_peer_t *ksocknal_find_peer(lnet_ni_t *ni, lnet_process_id_t id); -extern void ksocknal_peer_failed(ksock_peer_t *peer); -extern int ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, - struct socket *sock, int type); -extern void ksocknal_close_conn_locked(ksock_conn_t *conn, int why); -extern void ksocknal_terminate_conn(ksock_conn_t *conn); -extern void ksocknal_destroy_conn(ksock_conn_t *conn); -extern int ksocknal_close_peer_conns_locked(ksock_peer_t *peer, - __u32 ipaddr, int why); -extern int ksocknal_close_conn_and_siblings(ksock_conn_t *conn, int why); -extern int ksocknal_close_matching_conns(lnet_process_id_t id, __u32 ipaddr); -extern ksock_conn_t *ksocknal_find_conn_locked(ksock_peer_t *peer, - ksock_tx_t *tx, int nonblk); +int ksocknal_add_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip, int port); +ksock_peer_t *ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id); +ksock_peer_t *ksocknal_find_peer(lnet_ni_t *ni, lnet_process_id_t id); +void ksocknal_peer_failed(ksock_peer_t *peer); +int ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, + struct socket *sock, int type); +void ksocknal_close_conn_locked(ksock_conn_t *conn, int why); +void ksocknal_terminate_conn(ksock_conn_t *conn); +void ksocknal_destroy_conn(ksock_conn_t *conn); +int ksocknal_close_peer_conns_locked(ksock_peer_t *peer, + __u32 ipaddr, int why); +int ksocknal_close_conn_and_siblings(ksock_conn_t *conn, int why); +int ksocknal_close_matching_conns(lnet_process_id_t id, __u32 ipaddr); +ksock_conn_t *ksocknal_find_conn_locked(ksock_peer_t *peer, + ksock_tx_t *tx, int nonblk); -extern int ksocknal_launch_packet(lnet_ni_t *ni, ksock_tx_t *tx, - lnet_process_id_t id); -extern ksock_tx_t *ksocknal_alloc_tx(int type, int size); -extern void ksocknal_free_tx(ksock_tx_t *tx); -extern ksock_tx_t *ksocknal_alloc_tx_noop(__u64 cookie, int nonblk); -extern void ksocknal_next_tx_carrier(ksock_conn_t *conn); -extern void ksocknal_queue_tx_locked(ksock_tx_t *tx, ksock_conn_t *conn); -extern void ksocknal_txlist_done(lnet_ni_t *ni, struct list_head *txlist, - int error); -extern void ksocknal_notify(lnet_ni_t *ni, lnet_nid_t gw_nid, int alive); -extern void ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when); -extern int ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name); -extern void ksocknal_thread_fini(void); -extern void ksocknal_launch_all_connections_locked(ksock_peer_t *peer); -extern ksock_route_t *ksocknal_find_connectable_route_locked(ksock_peer_t *peer); -extern ksock_route_t *ksocknal_find_connecting_route_locked(ksock_peer_t *peer); -extern int ksocknal_new_packet(ksock_conn_t *conn, int skip); -extern int ksocknal_scheduler(void *arg); -extern int ksocknal_connd(void *arg); -extern int ksocknal_reaper(void *arg); -extern int ksocknal_send_hello(lnet_ni_t *ni, ksock_conn_t *conn, - lnet_nid_t peer_nid, ksock_hello_msg_t *hello); -extern int ksocknal_recv_hello(lnet_ni_t *ni, ksock_conn_t *conn, - ksock_hello_msg_t *hello, lnet_process_id_t *id, - __u64 *incarnation); -extern void ksocknal_read_callback(ksock_conn_t *conn); -extern void ksocknal_write_callback(ksock_conn_t *conn); +int ksocknal_launch_packet(lnet_ni_t *ni, ksock_tx_t *tx, + lnet_process_id_t id); +ksock_tx_t *ksocknal_alloc_tx(int type, int size); +void ksocknal_free_tx(ksock_tx_t *tx); +ksock_tx_t *ksocknal_alloc_tx_noop(__u64 cookie, int nonblk); +void ksocknal_next_tx_carrier(ksock_conn_t *conn); +void ksocknal_queue_tx_locked(ksock_tx_t *tx, ksock_conn_t *conn); +void ksocknal_txlist_done(lnet_ni_t *ni, struct list_head *txlist, int error); +void ksocknal_notify(lnet_ni_t *ni, lnet_nid_t gw_nid, int alive); +void ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when); +int ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name); +void ksocknal_thread_fini(void); +void ksocknal_launch_all_connections_locked(ksock_peer_t *peer); +ksock_route_t *ksocknal_find_connectable_route_locked(ksock_peer_t *peer); +ksock_route_t *ksocknal_find_connecting_route_locked(ksock_peer_t *peer); +int ksocknal_new_packet(ksock_conn_t *conn, int skip); +int ksocknal_scheduler(void *arg); +int ksocknal_connd(void *arg); +int ksocknal_reaper(void *arg); +int ksocknal_send_hello(lnet_ni_t *ni, ksock_conn_t *conn, + lnet_nid_t peer_nid, ksock_hello_msg_t *hello); +int ksocknal_recv_hello(lnet_ni_t *ni, ksock_conn_t *conn, + ksock_hello_msg_t *hello, lnet_process_id_t *id, + __u64 *incarnation); +void ksocknal_read_callback(ksock_conn_t *conn); +void ksocknal_write_callback(ksock_conn_t *conn); -extern int ksocknal_lib_zc_capable(ksock_conn_t *conn); -extern void ksocknal_lib_save_callback(struct socket *sock, ksock_conn_t *conn); -extern void ksocknal_lib_set_callback(struct socket *sock, ksock_conn_t *conn); -extern void ksocknal_lib_reset_callback(struct socket *sock, ksock_conn_t *conn); -extern void ksocknal_lib_push_conn(ksock_conn_t *conn); -extern int ksocknal_lib_get_conn_addrs(ksock_conn_t *conn); -extern int ksocknal_lib_setup_sock(struct socket *so); -extern int ksocknal_lib_send_iov(ksock_conn_t *conn, ksock_tx_t *tx); -extern int ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx); -extern void ksocknal_lib_eager_ack(ksock_conn_t *conn); -extern int ksocknal_lib_recv_iov(ksock_conn_t *conn); -extern int ksocknal_lib_recv_kiov(ksock_conn_t *conn); -extern int ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, - int *rxmem, int *nagle); +int ksocknal_lib_zc_capable(ksock_conn_t *conn); +void ksocknal_lib_save_callback(struct socket *sock, ksock_conn_t *conn); +void ksocknal_lib_set_callback(struct socket *sock, ksock_conn_t *conn); +void ksocknal_lib_reset_callback(struct socket *sock, ksock_conn_t *conn); +void ksocknal_lib_push_conn(ksock_conn_t *conn); +int ksocknal_lib_get_conn_addrs(ksock_conn_t *conn); +int ksocknal_lib_setup_sock(struct socket *so); +int ksocknal_lib_send_iov(ksock_conn_t *conn, ksock_tx_t *tx); +int ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx); +void ksocknal_lib_eager_ack(ksock_conn_t *conn); +int ksocknal_lib_recv_iov(ksock_conn_t *conn); +int ksocknal_lib_recv_kiov(ksock_conn_t *conn); +int ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, + int *rxmem, int *nagle); -extern int ksocknal_tunables_init(void); +int ksocknal_tunables_init(void); -extern void ksocknal_lib_csum_tx(ksock_tx_t *tx); +void ksocknal_lib_csum_tx(ksock_tx_t *tx); -extern int ksocknal_lib_memory_pressure(ksock_conn_t *conn); -extern int ksocknal_lib_bind_thread_to_cpu(int id); +int ksocknal_lib_memory_pressure(ksock_conn_t *conn); +int ksocknal_lib_bind_thread_to_cpu(int id); #endif /* _SOCKLND_SOCKLND_H_ */ diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index c4cf0aed80e1..cdce2dd6be7c 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -187,51 +187,49 @@ lstcon_id2hash (lnet_process_id_t id, struct list_head *hash) int lstcon_console_init(void); int lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data); int lstcon_console_fini(void); -extern int lstcon_session_match(lst_sid_t sid); -extern int lstcon_session_new(char *name, int key, unsigned version, - int timeout, int flags, lst_sid_t *sid_up); -extern int lstcon_session_info(lst_sid_t *sid_up, int *key, unsigned *verp, - lstcon_ndlist_ent_t *entp, char *name_up, int len); -extern int lstcon_session_end(void); -extern int lstcon_session_debug(int timeout, struct list_head *result_up); -extern int lstcon_session_feats_check(unsigned feats); -extern int lstcon_batch_debug(int timeout, char *name, - int client, struct list_head *result_up); -extern int lstcon_group_debug(int timeout, char *name, - struct list_head *result_up); -extern int lstcon_nodes_debug(int timeout, int nnd, lnet_process_id_t *nds_up, - struct list_head *result_up); -extern int lstcon_group_add(char *name); -extern int lstcon_group_del(char *name); -extern int lstcon_group_clean(char *name, int args); -extern int lstcon_group_refresh(char *name, struct list_head *result_up); -extern int lstcon_nodes_add(char *name, int nnd, lnet_process_id_t *nds_up, - unsigned *featp, struct list_head *result_up); -extern int lstcon_nodes_remove(char *name, int nnd, lnet_process_id_t *nds_up, - struct list_head *result_up); -extern int lstcon_group_info(char *name, lstcon_ndlist_ent_t *gent_up, - int *index_p, int *ndent_p, lstcon_node_ent_t *ndents_up); -extern int lstcon_group_list(int idx, int len, char *name_up); -extern int lstcon_batch_add(char *name); -extern int lstcon_batch_run(char *name, int timeout, +int lstcon_session_match(lst_sid_t sid); +int lstcon_session_new(char *name, int key, unsigned version, + int timeout, int flags, lst_sid_t *sid_up); +int lstcon_session_info(lst_sid_t *sid_up, int *key, unsigned *verp, + lstcon_ndlist_ent_t *entp, char *name_up, int len); +int lstcon_session_end(void); +int lstcon_session_debug(int timeout, struct list_head *result_up); +int lstcon_session_feats_check(unsigned feats); +int lstcon_batch_debug(int timeout, char *name, + int client, struct list_head *result_up); +int lstcon_group_debug(int timeout, char *name, + struct list_head *result_up); +int lstcon_nodes_debug(int timeout, int nnd, lnet_process_id_t *nds_up, + struct list_head *result_up); +int lstcon_group_add(char *name); +int lstcon_group_del(char *name); +int lstcon_group_clean(char *name, int args); +int lstcon_group_refresh(char *name, struct list_head *result_up); +int lstcon_nodes_add(char *name, int nnd, lnet_process_id_t *nds_up, + unsigned *featp, struct list_head *result_up); +int lstcon_nodes_remove(char *name, int nnd, lnet_process_id_t *nds_up, + struct list_head *result_up); +int lstcon_group_info(char *name, lstcon_ndlist_ent_t *gent_up, + int *index_p, int *ndent_p, lstcon_node_ent_t *ndents_up); +int lstcon_group_list(int idx, int len, char *name_up); +int lstcon_batch_add(char *name); +int lstcon_batch_run(char *name, int timeout, struct list_head *result_up); +int lstcon_batch_stop(char *name, int force, struct list_head *result_up); +int lstcon_test_batch_query(char *name, int testidx, + int client, int timeout, struct list_head *result_up); -extern int lstcon_batch_stop(char *name, int force, - struct list_head *result_up); -extern int lstcon_test_batch_query(char *name, int testidx, - int client, int timeout, - struct list_head *result_up); -extern int lstcon_batch_del(char *name); -extern int lstcon_batch_list(int idx, int namelen, char *name_up); -extern int lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, - int server, int testidx, int *index_p, - int *ndent_p, lstcon_node_ent_t *dents_up); -extern int lstcon_group_stat(char *grp_name, int timeout, - struct list_head *result_up); -extern int lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, - int timeout, struct list_head *result_up); -extern int lstcon_test_add(char *batch_name, int type, int loop, - int concur, int dist, int span, - char *src_name, char *dst_name, - void *param, int paramlen, int *retp, - struct list_head *result_up); +int lstcon_batch_del(char *name); +int lstcon_batch_list(int idx, int namelen, char *name_up); +int lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, + int server, int testidx, int *index_p, + int *ndent_p, lstcon_node_ent_t *dents_up); +int lstcon_group_stat(char *grp_name, int timeout, + struct list_head *result_up); +int lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, + int timeout, struct list_head *result_up); +int lstcon_test_add(char *batch_name, int type, int loop, + int concur, int dist, int span, + char *src_name, char *dst_name, + void *param, int paramlen, int *retp, + struct list_head *result_up); #endif diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 8ede2a00ca4f..fd3c4df319c2 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -375,12 +375,11 @@ static inline void s2dhms(struct dhms *ts, time_t secs) #define JOBSTATS_PROCNAME_UID "procname_uid" #define JOBSTATS_NODELOCAL "nodelocal" -extern int lprocfs_write_frac_helper(const char __user *buffer, - unsigned long count, int *val, int mult); -extern int lprocfs_read_frac_helper(char *buffer, unsigned long count, - long val, int mult); -extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, - unsigned int cpuid); +int lprocfs_write_frac_helper(const char __user *buffer, + unsigned long count, int *val, int mult); +int lprocfs_read_frac_helper(char *buffer, unsigned long count, + long val, int mult); +int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, unsigned int cpuid); /* * \return value * < 0 : on error (only possible for opc as LPROCFS_GET_SMP_ID) @@ -497,20 +496,18 @@ lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid, * count itself to reside within a single cache line. */ -extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, - long amount); -extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, - long amount); +void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount); +void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount); #define lprocfs_counter_incr(stats, idx) \ lprocfs_counter_add(stats, idx, 1) #define lprocfs_counter_decr(stats, idx) \ lprocfs_counter_sub(stats, idx, 1) -extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc, - struct lprocfs_counter_header *header, - enum lprocfs_stats_flags flags, - enum lprocfs_fields_flags field); +__s64 lprocfs_read_helper(struct lprocfs_counter *lc, + struct lprocfs_counter_header *header, + enum lprocfs_stats_flags flags, + enum lprocfs_fields_flags field); static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, enum lprocfs_fields_flags field) @@ -537,107 +534,103 @@ static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, extern struct lprocfs_stats * lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags); -extern void lprocfs_clear_stats(struct lprocfs_stats *stats); -extern void lprocfs_free_stats(struct lprocfs_stats **stats); -extern void lprocfs_init_ops_stats(int num_private_stats, - struct lprocfs_stats *stats); -extern void lprocfs_init_mps_stats(int num_private_stats, - struct lprocfs_stats *stats); -extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats); -extern int lprocfs_alloc_obd_stats(struct obd_device *obddev, - unsigned int num_private_stats); -extern int lprocfs_alloc_md_stats(struct obd_device *obddev, - unsigned int num_private_stats); -extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index, - unsigned conf, const char *name, - const char *units); -extern void lprocfs_free_obd_stats(struct obd_device *obddev); -extern void lprocfs_free_md_stats(struct obd_device *obddev); +void lprocfs_clear_stats(struct lprocfs_stats *stats); +void lprocfs_free_stats(struct lprocfs_stats **stats); +void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats); +void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats); +void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats); +int lprocfs_alloc_obd_stats(struct obd_device *obddev, + unsigned int num_private_stats); +int lprocfs_alloc_md_stats(struct obd_device *obddev, + unsigned int num_private_stats); +void lprocfs_counter_init(struct lprocfs_stats *stats, int index, + unsigned conf, const char *name, const char *units); +void lprocfs_free_obd_stats(struct obd_device *obddev); +void lprocfs_free_md_stats(struct obd_device *obddev); struct obd_export; -extern int lprocfs_exp_cleanup(struct obd_export *exp); -extern struct dentry *ldebugfs_add_simple(struct dentry *root, - char *name, - void *data, - struct file_operations *fops); -extern struct dentry * +int lprocfs_exp_cleanup(struct obd_export *exp); +struct dentry *ldebugfs_add_simple(struct dentry *root, + char *name, + void *data, + struct file_operations *fops); +struct dentry * ldebugfs_add_symlink(const char *name, struct dentry *parent, - const char *format, ...); + const char *format, ...); -extern int ldebugfs_register_stats(struct dentry *parent, - const char *name, - struct lprocfs_stats *stats); +int ldebugfs_register_stats(struct dentry *parent, + const char *name, + struct lprocfs_stats *stats); /* lprocfs_status.c */ -extern int ldebugfs_add_vars(struct dentry *parent, - struct lprocfs_vars *var, - void *data); +int ldebugfs_add_vars(struct dentry *parent, + struct lprocfs_vars *var, + void *data); -extern struct dentry *ldebugfs_register(const char *name, - struct dentry *parent, - struct lprocfs_vars *list, - void *data); +struct dentry *ldebugfs_register(const char *name, + struct dentry *parent, + struct lprocfs_vars *list, + void *data); -extern void ldebugfs_remove(struct dentry **entryp); +void ldebugfs_remove(struct dentry **entryp); -extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list, - struct attribute_group *attrs); -extern int lprocfs_obd_cleanup(struct obd_device *obd); +int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list, + struct attribute_group *attrs); +int lprocfs_obd_cleanup(struct obd_device *obd); -extern int ldebugfs_seq_create(struct dentry *parent, - const char *name, - umode_t mode, - const struct file_operations *seq_fops, - void *data); -extern int ldebugfs_obd_seq_create(struct obd_device *dev, - const char *name, - umode_t mode, - const struct file_operations *seq_fops, - void *data); +int ldebugfs_seq_create(struct dentry *parent, + const char *name, + umode_t mode, + const struct file_operations *seq_fops, + void *data); +int ldebugfs_obd_seq_create(struct obd_device *dev, + const char *name, + umode_t mode, + const struct file_operations *seq_fops, + void *data); /* Generic callbacks */ -extern int lprocfs_rd_u64(struct seq_file *m, void *data); -extern int lprocfs_rd_atomic(struct seq_file *m, void *data); -extern int lprocfs_wr_atomic(struct file *file, const char __user *buffer, - unsigned long count, void *data); -extern int lprocfs_rd_uint(struct seq_file *m, void *data); -extern int lprocfs_wr_uint(struct file *file, const char __user *buffer, - unsigned long count, void *data); -extern int lprocfs_rd_name(struct seq_file *m, void *data); -extern int lprocfs_rd_server_uuid(struct seq_file *m, void *data); -extern int lprocfs_rd_conn_uuid(struct seq_file *m, void *data); -extern int lprocfs_rd_import(struct seq_file *m, void *data); -extern int lprocfs_rd_state(struct seq_file *m, void *data); -extern int lprocfs_rd_connect_flags(struct seq_file *m, void *data); +int lprocfs_rd_u64(struct seq_file *m, void *data); +int lprocfs_rd_atomic(struct seq_file *m, void *data); +int lprocfs_wr_atomic(struct file *file, const char __user *buffer, + unsigned long count, void *data); +int lprocfs_rd_uint(struct seq_file *m, void *data); +int lprocfs_wr_uint(struct file *file, const char __user *buffer, + unsigned long count, void *data); +int lprocfs_rd_name(struct seq_file *m, void *data); +int lprocfs_rd_server_uuid(struct seq_file *m, void *data); +int lprocfs_rd_conn_uuid(struct seq_file *m, void *data); +int lprocfs_rd_import(struct seq_file *m, void *data); +int lprocfs_rd_state(struct seq_file *m, void *data); +int lprocfs_rd_connect_flags(struct seq_file *m, void *data); struct adaptive_timeout; -extern int lprocfs_at_hist_helper(struct seq_file *m, - struct adaptive_timeout *at); -extern int lprocfs_rd_timeouts(struct seq_file *m, void *data); -extern int lprocfs_wr_timeouts(struct file *file, const char __user *buffer, - unsigned long count, void *data); -extern int lprocfs_wr_evict_client(struct file *file, const char __user *buffer, +int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at); +int lprocfs_rd_timeouts(struct seq_file *m, void *data); +int lprocfs_wr_timeouts(struct file *file, const char __user *buffer, + unsigned long count, void *data); +int lprocfs_wr_evict_client(struct file *file, const char __user *buffer, size_t count, loff_t *off); -extern int lprocfs_wr_ping(struct file *file, const char __user *buffer, - size_t count, loff_t *off); -extern int lprocfs_wr_import(struct file *file, const char __user *buffer, +int lprocfs_wr_ping(struct file *file, const char __user *buffer, + size_t count, loff_t *off); +int lprocfs_wr_import(struct file *file, const char __user *buffer, size_t count, loff_t *off); -extern int lprocfs_rd_pinger_recov(struct seq_file *m, void *n); -extern int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer, - size_t count, loff_t *off); +int lprocfs_rd_pinger_recov(struct seq_file *m, void *n); +int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer, + size_t count, loff_t *off); /* Statfs helpers */ -extern int lprocfs_write_helper(const char __user *buffer, unsigned long count, - int *val); -extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult); -extern int lprocfs_write_u64_helper(const char __user *buffer, - unsigned long count, __u64 *val); -extern int lprocfs_write_frac_u64_helper(const char *buffer, - unsigned long count, - __u64 *val, int mult); -extern char *lprocfs_find_named_value(const char *buffer, const char *name, - size_t *count); +int lprocfs_write_helper(const char __user *buffer, unsigned long count, + int *val); +int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult); +int lprocfs_write_u64_helper(const char __user *buffer, + unsigned long count, __u64 *val); +int lprocfs_write_frac_u64_helper(const char *buffer, + unsigned long count, + __u64 *val, int mult); +char *lprocfs_find_named_value(const char *buffer, const char *name, + size_t *count); void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value); void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value); void lprocfs_oh_clear(struct obd_histogram *oh); @@ -646,8 +639,8 @@ unsigned long lprocfs_oh_sum(struct obd_histogram *oh); void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, struct lprocfs_counter *cnt); -extern int lprocfs_single_release(struct inode *, struct file *); -extern int lprocfs_seq_release(struct inode *, struct file *); +int lprocfs_single_release(struct inode *, struct file *); +int lprocfs_seq_release(struct inode *, struct file *); /* You must use these macros when you want to refer to * the import in a client obd_device for a lprocfs entry */ @@ -746,7 +739,7 @@ extern const struct sysfs_ops lustre_sysfs_ops; /* lproc_ptlrpc.c */ struct ptlrpc_request; -extern void target_print_req(void *seq_file, struct ptlrpc_request *req); +void target_print_req(void *seq_file, struct ptlrpc_request *req); /* lproc_status.c */ int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data); @@ -754,62 +747,62 @@ int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer, size_t count, loff_t *off); /* all quota proc functions */ -extern int lprocfs_quota_rd_bunit(char *page, char **start, - loff_t off, int count, - int *eof, void *data); -extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_btune(char *page, char **start, - loff_t off, int count, - int *eof, void *data); -extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_iunit(char *page, char **start, - loff_t off, int count, - int *eof, void *data); -extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_itune(char *page, char **start, - loff_t off, int count, - int *eof, void *data); -extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_type(char *page, char **start, loff_t off, int count, - int *eof, void *data); -extern int lprocfs_quota_wr_type(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, loff_t off, - int count, int *eof, void *data); -extern int lprocfs_quota_wr_switch_seconds(struct file *file, - const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_sync_blk(char *page, char **start, loff_t off, +int lprocfs_quota_rd_bunit(char *page, char **start, + loff_t off, int count, + int *eof, void *data); +int lprocfs_quota_wr_bunit(struct file *file, const char *buffer, + unsigned long count, void *data); +int lprocfs_quota_rd_btune(char *page, char **start, + loff_t off, int count, + int *eof, void *data); +int lprocfs_quota_wr_btune(struct file *file, const char *buffer, + unsigned long count, void *data); +int lprocfs_quota_rd_iunit(char *page, char **start, + loff_t off, int count, + int *eof, void *data); +int lprocfs_quota_wr_iunit(struct file *file, const char *buffer, + unsigned long count, void *data); +int lprocfs_quota_rd_itune(char *page, char **start, + loff_t off, int count, + int *eof, void *data); +int lprocfs_quota_wr_itune(struct file *file, const char *buffer, + unsigned long count, void *data); +int lprocfs_quota_rd_type(char *page, char **start, loff_t off, int count, + int *eof, void *data); +int lprocfs_quota_wr_type(struct file *file, const char *buffer, + unsigned long count, void *data); +int lprocfs_quota_rd_switch_seconds(char *page, char **start, loff_t off, + int count, int *eof, void *data); +int lprocfs_quota_wr_switch_seconds(struct file *file, + const char *buffer, + unsigned long count, void *data); +int lprocfs_quota_rd_sync_blk(char *page, char **start, loff_t off, + int count, int *eof, void *data); +int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer, + unsigned long count, void *data); +int lprocfs_quota_rd_switch_qs(char *page, char **start, loff_t off, + int count, int *eof, void *data); +int lprocfs_quota_wr_switch_qs(struct file *file, + const char *buffer, unsigned long count, + void *data); +int lprocfs_quota_rd_boundary_factor(char *page, char **start, loff_t off, int count, int *eof, void *data); -extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_switch_qs(char *page, char **start, loff_t off, - int count, int *eof, void *data); -extern int lprocfs_quota_wr_switch_qs(struct file *file, - const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, loff_t off, - int count, int *eof, void *data); -extern int lprocfs_quota_wr_boundary_factor(struct file *file, - const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_least_bunit(char *page, char **start, loff_t off, - int count, int *eof, void *data); -extern int lprocfs_quota_wr_least_bunit(struct file *file, - const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_least_iunit(char *page, char **start, loff_t off, - int count, int *eof, void *data); -extern int lprocfs_quota_wr_least_iunit(struct file *file, - const char *buffer, - unsigned long count, void *data); -extern int lprocfs_quota_rd_qs_factor(char *page, char **start, loff_t off, - int count, int *eof, void *data); -extern int lprocfs_quota_wr_qs_factor(struct file *file, - const char *buffer, - unsigned long count, void *data); +int lprocfs_quota_wr_boundary_factor(struct file *file, + const char *buffer, unsigned long count, + void *data); +int lprocfs_quota_rd_least_bunit(char *page, char **start, loff_t off, + int count, int *eof, void *data); +int lprocfs_quota_wr_least_bunit(struct file *file, + const char *buffer, unsigned long count, + void *data); +int lprocfs_quota_rd_least_iunit(char *page, char **start, loff_t off, + int count, int *eof, void *data); +int lprocfs_quota_wr_least_iunit(struct file *file, + const char *buffer, unsigned long count, + void *data); +int lprocfs_quota_rd_qs_factor(char *page, char **start, loff_t off, + int count, int *eof, void *data); +int lprocfs_quota_wr_qs_factor(struct file *file, + const char *buffer, unsigned long count, + void *data); #endif /* LPROCFS_SNMP_H */ diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 4d72d6ed26b0..ac78dbc38b9f 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -747,7 +747,7 @@ static inline ino_t lu_igif_ino(const struct lu_fid *fid) return fid_seq(fid); } -extern void lustre_swab_ost_id(struct ost_id *oid); +void lustre_swab_ost_id(struct ost_id *oid); /** * Get inode generation from a igif. @@ -814,8 +814,8 @@ static inline int fid_is_zero(const struct lu_fid *fid) return fid_seq(fid) == 0 && fid_oid(fid) == 0; } -extern void lustre_swab_lu_fid(struct lu_fid *fid); -extern void lustre_swab_lu_seq_range(struct lu_seq_range *range); +void lustre_swab_lu_fid(struct lu_fid *fid); +void lustre_swab_lu_seq_range(struct lu_seq_range *range); static inline int lu_fid_eq(const struct lu_fid *f0, const struct lu_fid *f1) { @@ -1131,7 +1131,7 @@ struct ptlrpc_body_v2 { __u64 pb_padding[4]; }; -extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); +void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); /* message body offset for lustre_msg_v2 */ /* ptlrpc body offset in all request/reply messages */ @@ -1395,7 +1395,7 @@ struct obd_connect_data { * reserve the flag for future use. */ -extern void lustre_swab_connect(struct obd_connect_data *ocd); +void lustre_swab_connect(struct obd_connect_data *ocd); /* * Supported checksum algorithms. Up to 32 checksum types are supported. @@ -1737,10 +1737,10 @@ struct hsm_state_set { __u64 hss_clearmask; }; -extern void lustre_swab_hsm_user_state(struct hsm_user_state *hus); -extern void lustre_swab_hsm_state_set(struct hsm_state_set *hss); +void lustre_swab_hsm_user_state(struct hsm_user_state *hus); +void lustre_swab_hsm_state_set(struct hsm_state_set *hss); -extern void lustre_swab_obd_statfs (struct obd_statfs *os); +void lustre_swab_obd_statfs(struct obd_statfs *os); /* ost_body.data values for OST_BRW */ @@ -1780,7 +1780,7 @@ struct obd_ioobj { #define ioobj_max_brw_set(ioo, num) \ do { (ioo)->ioo_max_brw = ((num) - 1) << IOOBJ_MAX_BRW_BITS; } while (0) -extern void lustre_swab_obd_ioobj (struct obd_ioobj *ioo); +void lustre_swab_obd_ioobj(struct obd_ioobj *ioo); /* multiple of 8 bytes => can array */ struct niobuf_remote { @@ -1789,7 +1789,7 @@ struct niobuf_remote { __u32 flags; }; -extern void lustre_swab_niobuf_remote (struct niobuf_remote *nbr); +void lustre_swab_niobuf_remote(struct niobuf_remote *nbr); /* lock value block communicated between the filter and llite */ @@ -1811,7 +1811,7 @@ struct ost_lvb_v1 { __u64 lvb_blocks; }; -extern void lustre_swab_ost_lvb_v1(struct ost_lvb_v1 *lvb); +void lustre_swab_ost_lvb_v1(struct ost_lvb_v1 *lvb); struct ost_lvb { __u64 lvb_size; @@ -1825,7 +1825,7 @@ struct ost_lvb { __u32 lvb_padding; }; -extern void lustre_swab_ost_lvb(struct ost_lvb *lvb); +void lustre_swab_ost_lvb(struct ost_lvb *lvb); /* * lquota data structures @@ -1864,7 +1864,7 @@ struct obd_quotactl { struct obd_dqblk qc_dqblk; }; -extern void lustre_swab_obd_quotactl(struct obd_quotactl *q); +void lustre_swab_obd_quotactl(struct obd_quotactl *q); #define Q_QUOTACHECK 0x800100 /* deprecated as of 2.4 */ #define Q_INITQUOTA 0x800101 /* deprecated as of 2.4 */ @@ -1913,7 +1913,7 @@ struct quota_body { #define QUOTA_DQACQ_FL_REL 0x4 /* release quota */ #define QUOTA_DQACQ_FL_REPORT 0x8 /* report usage */ -extern void lustre_swab_quota_body(struct quota_body *b); +void lustre_swab_quota_body(struct quota_body *b); /* Quota types currently supported */ enum { @@ -1993,7 +1993,7 @@ struct lquota_lvb { __u64 lvb_pad1; }; -extern void lustre_swab_lquota_lvb(struct lquota_lvb *lvb); +void lustre_swab_lquota_lvb(struct lquota_lvb *lvb); /* LVB used with global quota lock */ #define lvb_glb_ver lvb_id_may_rel /* current version of the global index */ @@ -2072,7 +2072,7 @@ typedef enum { REINT_MAX } mds_reint_t, mdt_reint_t; -extern void lustre_swab_generic_32s (__u32 *val); +void lustre_swab_generic_32s(__u32 *val); /* the disposition of the intent outlines what was executed */ #define DISP_IT_EXECD 0x00000001 @@ -2112,7 +2112,7 @@ extern void lustre_swab_generic_32s (__u32 *val); /* This FULL lock is useful to take on unlink sort of operations */ #define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1) -extern void lustre_swab_ll_fid (struct ll_fid *fid); +void lustre_swab_ll_fid(struct ll_fid *fid); /* NOTE: until Lustre 1.8.7/2.1.1 the fid_ver() was packed into name[2], * but was moved into name[1] along with the OID to avoid consuming the @@ -2231,7 +2231,7 @@ struct mdt_body { __u64 padding_10; }; /* 216 */ -extern void lustre_swab_mdt_body (struct mdt_body *b); +void lustre_swab_mdt_body(struct mdt_body *b); struct mdt_ioepoch { struct lustre_handle handle; @@ -2240,7 +2240,7 @@ struct mdt_ioepoch { __u32 padding; }; -extern void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b); +void lustre_swab_mdt_ioepoch(struct mdt_ioepoch *b); /* permissions for md_perm.mp_perm */ enum { @@ -2264,7 +2264,7 @@ struct mdt_remote_perm { __u32 rp_padding; }; -extern void lustre_swab_mdt_remote_perm(struct mdt_remote_perm *p); +void lustre_swab_mdt_remote_perm(struct mdt_remote_perm *p); struct mdt_rec_setattr { __u32 sa_opcode; @@ -2294,7 +2294,7 @@ struct mdt_rec_setattr { __u32 sa_padding_5; }; -extern void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa); +void lustre_swab_mdt_rec_setattr(struct mdt_rec_setattr *sa); /* * Attribute flags used in mdt_rec_setattr::sa_valid. @@ -2584,7 +2584,7 @@ struct mdt_rec_reint { __u32 rr_padding_4; /* also fix lustre_swab_mdt_rec_reint */ }; -extern void lustre_swab_mdt_rec_reint(struct mdt_rec_reint *rr); +void lustre_swab_mdt_rec_reint(struct mdt_rec_reint *rr); struct lmv_desc { __u32 ld_tgt_count; /* how many MDS's */ @@ -2600,7 +2600,7 @@ struct lmv_desc { struct obd_uuid ld_uuid; }; -extern void lustre_swab_lmv_desc (struct lmv_desc *ld); +void lustre_swab_lmv_desc(struct lmv_desc *ld); /* TODO: lmv_stripe_md should contain mds capabilities for all slave fids */ struct lmv_stripe_md { @@ -2612,7 +2612,7 @@ struct lmv_stripe_md { struct lu_fid mea_ids[0]; }; -extern void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea); +void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea); /* lmv structures */ #define MEA_MAGIC_LAST_CHAR 0xb2221ca1 @@ -2670,7 +2670,7 @@ struct lov_desc { #define ld_magic ld_active_tgt_count /* for swabbing from llogs */ -extern void lustre_swab_lov_desc (struct lov_desc *ld); +void lustre_swab_lov_desc(struct lov_desc *ld); /* * LDLM requests: @@ -2697,7 +2697,7 @@ struct ldlm_res_id { #define PLDLMRES(res) (res)->lr_name.name[0], (res)->lr_name.name[1], \ (res)->lr_name.name[2], (res)->lr_name.name[3] -extern void lustre_swab_ldlm_res_id (struct ldlm_res_id *id); +void lustre_swab_ldlm_res_id(struct ldlm_res_id *id); static inline int ldlm_res_eq(const struct ldlm_res_id *res0, const struct ldlm_res_id *res1) @@ -2774,19 +2774,19 @@ typedef union { struct ldlm_inodebits l_inodebits; } ldlm_wire_policy_data_t; -extern void lustre_swab_ldlm_policy_data (ldlm_wire_policy_data_t *d); +void lustre_swab_ldlm_policy_data(ldlm_wire_policy_data_t *d); union ldlm_gl_desc { struct ldlm_gl_lquota_desc lquota_desc; }; -extern void lustre_swab_gl_desc(union ldlm_gl_desc *); +void lustre_swab_gl_desc(union ldlm_gl_desc *); struct ldlm_intent { __u64 opc; }; -extern void lustre_swab_ldlm_intent (struct ldlm_intent *i); +void lustre_swab_ldlm_intent(struct ldlm_intent *i); struct ldlm_resource_desc { ldlm_type_t lr_type; @@ -2794,7 +2794,7 @@ struct ldlm_resource_desc { struct ldlm_res_id lr_name; }; -extern void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r); +void lustre_swab_ldlm_resource_desc(struct ldlm_resource_desc *r); struct ldlm_lock_desc { struct ldlm_resource_desc l_resource; @@ -2803,7 +2803,7 @@ struct ldlm_lock_desc { ldlm_wire_policy_data_t l_policy_data; }; -extern void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l); +void lustre_swab_ldlm_lock_desc(struct ldlm_lock_desc *l); #define LDLM_LOCKREQ_HANDLES 2 #define LDLM_ENQUEUE_CANCEL_OFF 1 @@ -2815,7 +2815,7 @@ struct ldlm_request { struct lustre_handle lock_handle[LDLM_LOCKREQ_HANDLES]; }; -extern void lustre_swab_ldlm_request (struct ldlm_request *rq); +void lustre_swab_ldlm_request(struct ldlm_request *rq); /* If LDLM_ENQUEUE, 1 slot is already occupied, 1 is available. * Otherwise, 2 are available. */ @@ -2837,7 +2837,7 @@ struct ldlm_reply { __u64 lock_policy_res2; }; -extern void lustre_swab_ldlm_reply (struct ldlm_reply *r); +void lustre_swab_ldlm_reply(struct ldlm_reply *r); #define ldlm_flags_to_wire(flags) ((__u32)(flags)) #define ldlm_flags_from_wire(flags) ((__u64)(flags)) @@ -2881,7 +2881,8 @@ struct mgs_target_info { __u64 mti_nids[MTI_NIDS_MAX]; /* host nids (lnet_nid_t)*/ char mti_params[MTI_PARAM_MAXLEN]; }; -extern void lustre_swab_mgs_target_info(struct mgs_target_info *oinfo); + +void lustre_swab_mgs_target_info(struct mgs_target_info *oinfo); struct mgs_nidtbl_entry { __u64 mne_version; /* table version of this entry */ @@ -2896,7 +2897,8 @@ struct mgs_nidtbl_entry { lnet_nid_t nids[0]; /* variable size buffer for NIDs. */ } u; }; -extern void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *oinfo); + +void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *oinfo); struct mgs_config_body { char mcb_name[MTI_NAME_MAXLEN]; /* logname */ @@ -2906,13 +2908,15 @@ struct mgs_config_body { __u8 mcb_bits; /* bits unit size of config log */ __u32 mcb_units; /* # of units for bulk transfer */ }; -extern void lustre_swab_mgs_config_body(struct mgs_config_body *body); + +void lustre_swab_mgs_config_body(struct mgs_config_body *body); struct mgs_config_res { __u64 mcr_offset; /* index of last config log */ __u64 mcr_size; /* size of the log */ }; -extern void lustre_swab_mgs_config_res(struct mgs_config_res *body); + +void lustre_swab_mgs_config_res(struct mgs_config_res *body); /* Config marker flags (in config log) */ #define CM_START 0x01 @@ -2933,8 +2937,7 @@ struct cfg_marker { char cm_comment[MTI_NAME_MAXLEN]; }; -extern void lustre_swab_cfg_marker(struct cfg_marker *marker, - int swab, int size); +void lustre_swab_cfg_marker(struct cfg_marker *marker, int swab, int size); /* * Opcodes for multiple servers. @@ -3334,7 +3337,7 @@ static inline void lustre_get_wire_obdo(struct obd_connect_data *ocd, } } -extern void lustre_swab_obdo (struct obdo *o); +void lustre_swab_obdo(struct obdo *o); /* request structure for OST's */ struct ost_body { @@ -3348,25 +3351,25 @@ struct ll_fiemap_info_key { struct ll_user_fiemap fiemap; }; -extern void lustre_swab_ost_body (struct ost_body *b); -extern void lustre_swab_ost_last_id(__u64 *id); -extern void lustre_swab_fiemap(struct ll_user_fiemap *fiemap); +void lustre_swab_ost_body(struct ost_body *b); +void lustre_swab_ost_last_id(__u64 *id); +void lustre_swab_fiemap(struct ll_user_fiemap *fiemap); -extern void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum); -extern void lustre_swab_lov_user_md_v3(struct lov_user_md_v3 *lum); -extern void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod, - int stripe_count); -extern void lustre_swab_lov_mds_md(struct lov_mds_md *lmm); +void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum); +void lustre_swab_lov_user_md_v3(struct lov_user_md_v3 *lum); +void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod, + int stripe_count); +void lustre_swab_lov_mds_md(struct lov_mds_md *lmm); /* llog_swab.c */ -extern void lustre_swab_llogd_body (struct llogd_body *d); -extern void lustre_swab_llog_hdr (struct llog_log_hdr *h); -extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d); -extern void lustre_swab_llog_rec(struct llog_rec_hdr *rec); -extern void lustre_swab_llog_id(struct llog_logid *lid); +void lustre_swab_llogd_body(struct llogd_body *d); +void lustre_swab_llog_hdr(struct llog_log_hdr *h); +void lustre_swab_llogd_conn_body(struct llogd_conn_body *d); +void lustre_swab_llog_rec(struct llog_rec_hdr *rec); +void lustre_swab_llog_id(struct llog_logid *lid); struct lustre_cfg; -extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg); +void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg); /* Functions for dumping PTLRPC fields */ void dump_rniobuf(struct niobuf_remote *rnb); @@ -3418,7 +3421,8 @@ struct idx_info { __u64 ii_pad2; __u64 ii_pad3; }; -extern void lustre_swab_idx_info(struct idx_info *ii); + +void lustre_swab_idx_info(struct idx_info *ii); #define II_END_OFF MDS_DIR_END_OFF /* all entries have been read */ @@ -3450,7 +3454,8 @@ struct lu_idxpage { * For the time being, we only support fixed-size key & record. */ char lip_entries[0]; }; -extern void lustre_swab_lip_header(struct lu_idxpage *lip); + +void lustre_swab_lip_header(struct lu_idxpage *lip); #define LIP_HDR_SIZE (offsetof(struct lu_idxpage, lip_entries)) @@ -3490,7 +3495,7 @@ struct lustre_capa { __u8 lc_hmac[CAPA_HMAC_MAX_LEN]; /** HMAC */ } __attribute__((packed)); -extern void lustre_swab_lustre_capa(struct lustre_capa *c); +void lustre_swab_lustre_capa(struct lustre_capa *c); /** lustre_capa::lc_opc */ enum { @@ -3548,7 +3553,7 @@ struct lustre_capa_key { __u8 lk_key[CAPA_HMAC_KEY_MAX_LEN]; /**< key */ } __attribute__((packed)); -extern void lustre_swab_lustre_capa_key(struct lustre_capa_key *k); +void lustre_swab_lustre_capa_key(struct lustre_capa_key *k); /** The link ea holds 1 \a link_ea_entry for each hardlink */ #define LINK_EA_MAGIC 0x11EAF1DFUL @@ -3620,12 +3625,12 @@ struct hsm_progress_kernel { __u64 hpk_padding2; } __attribute__((packed)); -extern void lustre_swab_hsm_user_state(struct hsm_user_state *hus); -extern void lustre_swab_hsm_current_action(struct hsm_current_action *action); -extern void lustre_swab_hsm_progress_kernel(struct hsm_progress_kernel *hpk); -extern void lustre_swab_hsm_user_state(struct hsm_user_state *hus); -extern void lustre_swab_hsm_user_item(struct hsm_user_item *hui); -extern void lustre_swab_hsm_request(struct hsm_request *hr); +void lustre_swab_hsm_user_state(struct hsm_user_state *hus); +void lustre_swab_hsm_current_action(struct hsm_current_action *action); +void lustre_swab_hsm_progress_kernel(struct hsm_progress_kernel *hpk); +void lustre_swab_hsm_user_state(struct hsm_user_state *hus); +void lustre_swab_hsm_user_item(struct hsm_user_item *hui); +void lustre_swab_hsm_request(struct hsm_request *hr); /** * These are object update opcode under UPDATE_OBJ, which is currently diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index e095ada40ed2..9b1bb23c4d3c 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -406,7 +406,7 @@ static inline int lmv_user_md_size(int stripes, int lmm_magic) stripes * sizeof(struct lmv_user_mds_data); } -extern void lustre_swab_lmv_user_md(struct lmv_user_md *lum); +void lustre_swab_lmv_user_md(struct lmv_user_md *lum); struct ll_recreate_obj { __u64 lrc_id; diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index f6f4c037fb30..355254689dee 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1017,7 +1017,7 @@ extern struct obd_ops ldlm_obd_ops; extern char *ldlm_lockname[]; extern char *ldlm_typename[]; -extern char *ldlm_it2str(int it); +char *ldlm_it2str(int it); /** * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG. diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 3b992b42fd91..5189fad0b73c 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -368,8 +368,8 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp) return ocd->ocd_connect_flags & OBD_CONNECT_DISP_STRIPE; } -extern struct obd_export *class_conn2export(struct lustre_handle *conn); -extern struct obd_device *class_conn2obd(struct lustre_handle *conn); +struct obd_export *class_conn2export(struct lustre_handle *conn); +struct obd_device *class_conn2obd(struct lustre_handle *conn); /** @} export */ diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h index dcc807676c49..5a38f3d5e011 100644 --- a/drivers/staging/lustre/lustre/include/lustre_import.h +++ b/drivers/staging/lustre/lustre/include/lustre_import.h @@ -375,8 +375,8 @@ extern unsigned int at_max; /* genops.c */ struct obd_export; -extern struct obd_import *class_exp2cliimp(struct obd_export *); -extern struct obd_import *class_conn2cliimp(struct lustre_handle *); +struct obd_import *class_exp2cliimp(struct obd_export *); +struct obd_import *class_conn2cliimp(struct lustre_handle *); /** @} import */ diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 3bb2f8b0c309..48ad60b22122 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -2277,18 +2277,18 @@ static inline bool nrs_policy_compat_one(const struct ptlrpc_service *svc, /* ptlrpc/events.c */ extern lnet_handle_eq_t ptlrpc_eq_h; -extern int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, - lnet_process_id_t *peer, lnet_nid_t *self); +int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, + lnet_process_id_t *peer, lnet_nid_t *self); /** * These callbacks are invoked by LNet when something happened to * underlying buffer * @{ */ -extern void request_out_callback(lnet_event_t *ev); -extern void reply_in_callback(lnet_event_t *ev); -extern void client_bulk_callback(lnet_event_t *ev); -extern void request_in_callback(lnet_event_t *ev); -extern void reply_out_callback(lnet_event_t *ev); +void request_out_callback(lnet_event_t *ev); +void reply_in_callback(lnet_event_t *ev); +void client_bulk_callback(lnet_event_t *ev); +void request_in_callback(lnet_event_t *ev); +void reply_out_callback(lnet_event_t *ev); /** @} */ /* ptlrpc/connection.c */ @@ -2299,7 +2299,7 @@ int ptlrpc_connection_put(struct ptlrpc_connection *c); struct ptlrpc_connection *ptlrpc_connection_addref(struct ptlrpc_connection *); int ptlrpc_connection_init(void); void ptlrpc_connection_fini(void); -extern lnet_pid_t ptl_get_pid(void); +lnet_pid_t ptl_get_pid(void); /* ptlrpc/niobuf.c */ /** diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index e1f8b15753f9..87bb2cedca7d 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -64,10 +64,10 @@ extern struct obd_device *obd_devs[MAX_OBD_DEVICES]; extern rwlock_t obd_dev_lock; /* OBD Operations Declarations */ -extern struct obd_device *class_conn2obd(struct lustre_handle *); -extern struct obd_device *class_exp2obd(struct obd_export *); -extern int class_handle_ioctl(unsigned int cmd, unsigned long arg); -extern int lustre_get_jobid(char *jobid); +struct obd_device *class_conn2obd(struct lustre_handle *); +struct obd_device *class_exp2obd(struct obd_export *); +int class_handle_ioctl(unsigned int cmd, unsigned long arg); +int lustre_get_jobid(char *jobid); struct lu_device_type; @@ -139,7 +139,7 @@ int class_add_conn(struct obd_device *obd, struct lustre_cfg *lcfg); int class_add_uuid(const char *uuid, __u64 nid); /*obdecho*/ -extern void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars); +void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars); #define CFG_F_START 0x01 /* Set when we start updating from a log */ #define CFG_F_MARKER 0x02 /* We are within a maker */ @@ -1823,8 +1823,8 @@ static inline int md_revalidate_lock(struct obd_export *exp, /* OBD Metadata Support */ -extern int obd_init_caches(void); -extern void obd_cleanup_caches(void); +int obd_init_caches(void); +void obd_cleanup_caches(void); /* support routines */ extern struct kmem_cache *obdo_cachep; @@ -1869,7 +1869,7 @@ extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c); /* obd_mount.c */ /* sysctl.c */ -extern int obd_sysctl_init(void); +int obd_sysctl_init(void); /* uuid.c */ typedef __u8 class_uuid_t[16]; diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index 88e16717e854..18aec796a724 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -501,7 +501,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, #define OBD_FAIL_ONCE CFS_FAIL_ONCE #define OBD_FAILED CFS_FAILED -extern void obd_update_maxusage(void); +void obd_update_maxusage(void); #define obd_memory_add(size) \ lprocfs_counter_add(obd_memory, OBD_MEMORY_STAT, (long)(size)) @@ -520,8 +520,8 @@ extern void obd_update_maxusage(void); lprocfs_stats_collector(obd_memory, OBD_MEMORY_PAGES_STAT, \ LPROCFS_FIELDS_FLAGS_SUM) -extern __u64 obd_memory_max(void); -extern __u64 obd_pages_max(void); +__u64 obd_memory_max(void); +__u64 obd_pages_max(void); #define OBD_DEBUG_MEMUSAGE (1) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 6601e6b12c32..fa4b7c760d49 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -209,7 +209,7 @@ struct ldlm_state { /* interval tree, for LDLM_EXTENT. */ extern struct kmem_cache *ldlm_interval_slab; /* slab cache for ldlm_interval */ -extern void ldlm_interval_attach(struct ldlm_interval *n, struct ldlm_lock *l); +void ldlm_interval_attach(struct ldlm_interval *n, struct ldlm_lock *l); struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l); struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock); void ldlm_interval_free(struct ldlm_interval *node); diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h b/drivers/staging/lustre/lustre/libcfs/tracefile.h index 8d993f4d24c8..e931f6d98de9 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.h +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h @@ -47,7 +47,7 @@ extern char cfs_tracefile[TRACEFILE_NAME_SIZE]; extern long long cfs_tracefile_size; -extern void libcfs_run_debug_log_upcall(char *file); +void libcfs_run_debug_log_upcall(char *file); int cfs_tracefile_init_arch(void); void cfs_tracefile_fini_arch(void); @@ -79,11 +79,11 @@ int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob); int cfs_trace_set_debug_mb(int mb); int cfs_trace_get_debug_mb(void); -extern void libcfs_debug_dumplog_internal(void *arg); -extern void libcfs_register_panic_notifier(void); -extern void libcfs_unregister_panic_notifier(void); +void libcfs_debug_dumplog_internal(void *arg); +void libcfs_register_panic_notifier(void); +void libcfs_unregister_panic_notifier(void); extern int libcfs_panic_in_progress; -extern int cfs_trace_max_debug_mb(void); +int cfs_trace_max_debug_mb(void); #define TCD_MAX_PAGES (5 << (20 - PAGE_CACHE_SHIFT)) #define TCD_STOCK_PAGES (TCD_MAX_PAGES) @@ -252,15 +252,15 @@ struct cfs_trace_page { unsigned short type; }; -extern void cfs_set_ptldebug_header(struct ptldebug_header *header, - struct libcfs_debug_msg_data *m, - unsigned long stack); -extern void cfs_print_to_console(struct ptldebug_header *hdr, int mask, - const char *buf, int len, const char *file, - const char *fn); +void cfs_set_ptldebug_header(struct ptldebug_header *header, + struct libcfs_debug_msg_data *m, + unsigned long stack); +void cfs_print_to_console(struct ptldebug_header *hdr, int mask, + const char *buf, int len, const char *file, + const char *fn); -extern int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking); -extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking); +int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking); +void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking); /** * trace_buf_type_t, trace_buf_idx_get() and trace_console_buffers[][] @@ -270,7 +270,7 @@ extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking); */ extern char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX]; -extern cfs_trace_buf_type_t cfs_trace_buf_idx_get(void); +cfs_trace_buf_type_t cfs_trace_buf_idx_get(void); static inline char * cfs_trace_get_console_buffer(void) @@ -313,8 +313,8 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp, int cfs_tcd_owns_tage(struct cfs_trace_cpu_data *tcd, struct cfs_trace_page *tage); -extern void cfs_trace_assertion_failed(const char *str, - struct libcfs_debug_msg_data *m); +void cfs_trace_assertion_failed(const char *str, + struct libcfs_debug_msg_data *m); /* ASSERTION that is safe to use within the debug system */ #define __LASSERT(cond) \ diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index ec2797478350..ec8fff463208 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -710,11 +710,11 @@ extern struct file_operations ll_file_operations; extern struct file_operations ll_file_operations_flock; extern struct file_operations ll_file_operations_noflock; extern struct inode_operations ll_file_inode_operations; -extern int ll_have_md_lock(struct inode *inode, __u64 *bits, - ldlm_mode_t l_req_mode); -extern ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits, - struct lustre_handle *lockh, __u64 flags, - ldlm_mode_t mode); +int ll_have_md_lock(struct inode *inode, __u64 *bits, + ldlm_mode_t l_req_mode); +ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits, + struct lustre_handle *lockh, __u64 flags, + ldlm_mode_t mode); int ll_file_open(struct inode *inode, struct file *file); int ll_file_release(struct inode *inode, struct file *file); int ll_glimpse_ioctl(struct ll_sb_info *sbi, @@ -1375,9 +1375,9 @@ static inline void cl_stats_tally(struct cl_device *dev, enum cl_req_type crt, ll_stats_ops_tally(ll_s2sbi(cl2ccc_dev(dev)->cdv_sb), opc, rc); } -extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, - int rw, struct inode *inode, - struct ll_dio_pages *pv); +ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, + int rw, struct inode *inode, + struct ll_dio_pages *pv); static inline int ll_file_nolock(const struct file *file) { From 94a99b46116e82aee359265a1ce48ebffe37a479 Mon Sep 17 00:00:00 2001 From: Swee Hua Law Date: Tue, 11 Aug 2015 21:32:29 +0800 Subject: [PATCH 850/912] staging: lustre: Do not init global to NULL Remove "= NULL" in global variable Signed-off-by: Swee Hua Law Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/lloop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index 56938d2446bf..06f5e51ecd9e 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -162,7 +162,7 @@ static int max_loop = MAX_LOOP_DEFAULT; static struct lloop_device *loop_dev; static struct gendisk **disks; static struct mutex lloop_mutex; -static void *ll_iocontrol_magic = NULL; +static void *ll_iocontrol_magic; static loff_t get_loop_size(struct lloop_device *lo, struct file *file) { From f157d807b9fe44afa19e476b52d791a7377d9ad2 Mon Sep 17 00:00:00 2001 From: Ioan-Adrian Ratiu Date: Fri, 14 Aug 2015 12:57:06 +0300 Subject: [PATCH 851/912] staging: lustre: ptlrpc: add missing include directive Without including ptlrpc_internal.h, GCC gives prototype warnings "pack_generic.c:642:5: warning: no previous prototype for ..." and sparse also complains "pack_generic.c:642:5: warning: symbol 'lustre_unpack_req_ptlrpc_body' was not declared. ..." Signed-off-by: Ioan-Adrian Ratiu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 2787bfd67165..84937ad90570 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -52,6 +52,8 @@ #include "../include/obd_cksum.h" #include "../include/lustre/ll_fiemap.h" +#include "ptlrpc_internal.h" + static inline int lustre_msg_hdr_size_v2(int count) { return cfs_size_round(offsetof(struct lustre_msg_v2, From e075de610913d43d9d4682888cbee7856217103a Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:34 -0700 Subject: [PATCH 852/912] staging: xgifb: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignments Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xgifb/vb_init.h | 4 ++-- drivers/staging/xgifb/vb_setmode.h | 34 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/staging/xgifb/vb_init.h b/drivers/staging/xgifb/vb_init.h index 24573026a7c0..500cabe41a3c 100644 --- a/drivers/staging/xgifb/vb_init.h +++ b/drivers/staging/xgifb/vb_init.h @@ -1,6 +1,6 @@ #ifndef _VBINIT_ #define _VBINIT_ -extern unsigned char XGIInitNew(struct pci_dev *pdev); -extern void XGIRegInit(struct vb_device_info *, unsigned long); +unsigned char XGIInitNew(struct pci_dev *pdev); +void XGIRegInit(struct vb_device_info *, unsigned long); #endif diff --git a/drivers/staging/xgifb/vb_setmode.h b/drivers/staging/xgifb/vb_setmode.h index 5301bec6440d..6f082a7a5a4a 100644 --- a/drivers/staging/xgifb/vb_setmode.h +++ b/drivers/staging/xgifb/vb_setmode.h @@ -1,23 +1,23 @@ #ifndef _VBSETMODE_ #define _VBSETMODE_ -extern void InitTo330Pointer(unsigned char, struct vb_device_info *); -extern void XGI_UnLockCRT2(struct vb_device_info *); -extern void XGI_LockCRT2(struct vb_device_info *); -extern void XGI_DisplayOff(struct xgifb_video_info *, - struct xgi_hw_device_info *, - struct vb_device_info *); -extern void XGI_GetVBType(struct vb_device_info *); -extern void XGI_SenseCRT1(struct vb_device_info *); -extern unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *HwDeviceExtension, - unsigned short ModeNo); +void InitTo330Pointer(unsigned char, struct vb_device_info *); +void XGI_UnLockCRT2(struct vb_device_info *); +void XGI_LockCRT2(struct vb_device_info *); +void XGI_DisplayOff(struct xgifb_video_info *, + struct xgi_hw_device_info *, + struct vb_device_info *); +void XGI_GetVBType(struct vb_device_info *); +void XGI_SenseCRT1(struct vb_device_info *); +unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *HwDeviceExtension, + unsigned short ModeNo); -extern unsigned char XGI_SearchModeID(unsigned short ModeNo, - unsigned short *ModeIdIndex); -extern unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, - unsigned short ModeNo, - unsigned short ModeIdIndex, - struct vb_device_info *); +unsigned char XGI_SearchModeID(unsigned short ModeNo, + unsigned short *ModeIdIndex); +unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, + unsigned short ModeNo, + unsigned short ModeIdIndex, + struct vb_device_info *); #endif From a5ee4695ec03ce8f7c236f568dc99b5366af1ce8 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:31 -0700 Subject: [PATCH 853/912] staging: rtl8712: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl.h | 28 +++++++++++-------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_ioctl.h b/drivers/staging/rtl8712/rtl871x_ioctl.h index 8e6ef5d49fbf..c9218be5bb4f 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl.h +++ b/drivers/staging/rtl8712/rtl871x_ioctl.h @@ -76,22 +76,18 @@ uint oid_null_function(struct oid_par_priv *poid_par_priv); extern struct iw_handler_def r871x_handlers_def; -extern uint drv_query_info( - struct net_device *MiniportAdapterContext, - uint Oid, - void *InformationBuffer, - u32 InformationBufferLength, - u32 *BytesWritten, - u32 *BytesNeeded -); +uint drv_query_info(struct net_device *MiniportAdapterContext, + uint Oid, + void *InformationBuffer, + u32 InformationBufferLength, + u32 *BytesWritten, + u32 *BytesNeeded); -extern uint drv_set_info( - struct net_device *MiniportAdapterContext, - uint Oid, - void *InformationBuffer, - u32 InformationBufferLength, - u32 *BytesRead, - u32 *BytesNeeded -); +uint drv_set_info(struct net_device *MiniportAdapterContext, + uint Oid, + void *InformationBuffer, + u32 InformationBufferLength, + u32 *BytesRead, + u32 *BytesNeeded); #endif From b239904d8f2bfa09956b1ac95009136e452f0923 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:26 -0700 Subject: [PATCH 854/912] staging: octeon: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Acked-by: David Daney Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-mdio.h | 2 +- drivers/staging/octeon/octeon-ethernet.h | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/octeon/ethernet-mdio.h b/drivers/staging/octeon/ethernet-mdio.h index a530b55f27d8..5ed8483fc24d 100644 --- a/drivers/staging/octeon/ethernet-mdio.h +++ b/drivers/staging/octeon/ethernet-mdio.h @@ -25,7 +25,7 @@ extern const struct ethtool_ops cvm_oct_ethtool_ops; -extern void octeon_mdiobus_force_mod_depencency(void); +void octeon_mdiobus_force_mod_depencency(void); int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int cvm_oct_phy_setup_device(struct net_device *dev); diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h index e9d3e9a7e8a7..a242c700bc53 100644 --- a/drivers/staging/octeon/octeon-ethernet.h +++ b/drivers/staging/octeon/octeon-ethernet.h @@ -53,20 +53,20 @@ struct octeon_ethernet { int cvm_oct_free_work(void *work_queue_entry); -extern int cvm_oct_rgmii_init(struct net_device *dev); -extern void cvm_oct_rgmii_uninit(struct net_device *dev); -extern int cvm_oct_rgmii_open(struct net_device *dev); +int cvm_oct_rgmii_init(struct net_device *dev); +void cvm_oct_rgmii_uninit(struct net_device *dev); +int cvm_oct_rgmii_open(struct net_device *dev); -extern int cvm_oct_sgmii_init(struct net_device *dev); -extern int cvm_oct_sgmii_open(struct net_device *dev); +int cvm_oct_sgmii_init(struct net_device *dev); +int cvm_oct_sgmii_open(struct net_device *dev); -extern int cvm_oct_spi_init(struct net_device *dev); -extern void cvm_oct_spi_uninit(struct net_device *dev); -extern int cvm_oct_xaui_init(struct net_device *dev); -extern int cvm_oct_xaui_open(struct net_device *dev); +int cvm_oct_spi_init(struct net_device *dev); +void cvm_oct_spi_uninit(struct net_device *dev); +int cvm_oct_xaui_init(struct net_device *dev); +int cvm_oct_xaui_open(struct net_device *dev); -extern int cvm_oct_common_init(struct net_device *dev); -extern void cvm_oct_common_uninit(struct net_device *dev); +int cvm_oct_common_init(struct net_device *dev); +void cvm_oct_common_uninit(struct net_device *dev); void cvm_oct_adjust_link(struct net_device *dev); int cvm_oct_common_stop(struct net_device *dev); int cvm_oct_common_open(struct net_device *dev, From cd951ddc2d70e67ee0fc48181bedc27a9515ba78 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:18 -0700 Subject: [PATCH 855/912] staging: fbtft: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignments Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft.h | 52 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index ab4a65818786..7e9a506d65f9 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -262,40 +262,38 @@ struct fbtft_par { par->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__) /* fbtft-core.c */ -extern void fbtft_dbg_hex(const struct device *dev, - int groupsize, void *buf, size_t len, const char *fmt, ...); +void fbtft_dbg_hex(const struct device *dev, int groupsize, + void *buf, size_t len, const char *fmt, ...); struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, struct device *dev, struct fbtft_platform_data *pdata); -extern void fbtft_framebuffer_release(struct fb_info *info); -extern int fbtft_register_framebuffer(struct fb_info *fb_info); -extern int fbtft_unregister_framebuffer(struct fb_info *fb_info); -extern void fbtft_register_backlight(struct fbtft_par *par); -extern void fbtft_unregister_backlight(struct fbtft_par *par); -extern int fbtft_init_display(struct fbtft_par *par); -extern int fbtft_probe_common(struct fbtft_display *display, - struct spi_device *sdev, struct platform_device *pdev); -extern int fbtft_remove_common(struct device *dev, struct fb_info *info); +void fbtft_framebuffer_release(struct fb_info *info); +int fbtft_register_framebuffer(struct fb_info *fb_info); +int fbtft_unregister_framebuffer(struct fb_info *fb_info); +void fbtft_register_backlight(struct fbtft_par *par); +void fbtft_unregister_backlight(struct fbtft_par *par); +int fbtft_init_display(struct fbtft_par *par); +int fbtft_probe_common(struct fbtft_display *display, struct spi_device *sdev, + struct platform_device *pdev); +int fbtft_remove_common(struct device *dev, struct fb_info *info); /* fbtft-io.c */ -extern int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len); -extern int fbtft_write_spi_emulate_9(struct fbtft_par *par, - void *buf, size_t len); -extern int fbtft_read_spi(struct fbtft_par *par, void *buf, size_t len); -extern int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len); -extern int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len); -extern int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, - void *buf, size_t len); +int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len); +int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len); +int fbtft_read_spi(struct fbtft_par *par, void *buf, size_t len); +int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len); +int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len); +int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, void *buf, size_t len); /* fbtft-bus.c */ -extern int fbtft_write_vmem8_bus8(struct fbtft_par *par, size_t offset, size_t len); -extern int fbtft_write_vmem16_bus16(struct fbtft_par *par, size_t offset, size_t len); -extern int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len); -extern int fbtft_write_vmem16_bus9(struct fbtft_par *par, size_t offset, size_t len); -extern void fbtft_write_reg8_bus8(struct fbtft_par *par, int len, ...); -extern void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...); -extern void fbtft_write_reg16_bus8(struct fbtft_par *par, int len, ...); -extern void fbtft_write_reg16_bus16(struct fbtft_par *par, int len, ...); +int fbtft_write_vmem8_bus8(struct fbtft_par *par, size_t offset, size_t len); +int fbtft_write_vmem16_bus16(struct fbtft_par *par, size_t offset, size_t len); +int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len); +int fbtft_write_vmem16_bus9(struct fbtft_par *par, size_t offset, size_t len); +void fbtft_write_reg8_bus8(struct fbtft_par *par, int len, ...); +void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...); +void fbtft_write_reg16_bus8(struct fbtft_par *par, int len, ...); +void fbtft_write_reg16_bus16(struct fbtft_par *par, int len, ...); #define FBTFT_REGISTER_DRIVER(_name, _compatible, _display) \ From ddc9bceb4c128aeec8107df816df1ceba4c68f8b Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:25 -0700 Subject: [PATCH 856/912] staging: nvec: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignments Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h index e271375053fa..2ec9de906ca3 100644 --- a/drivers/staging/nvec/nvec.h +++ b/drivers/staging/nvec/nvec.h @@ -165,19 +165,18 @@ struct nvec_chip { int state; }; -extern int nvec_write_async(struct nvec_chip *nvec, const unsigned char *data, - short size); +int nvec_write_async(struct nvec_chip *nvec, const unsigned char *data, + short size); -extern struct nvec_msg *nvec_write_sync(struct nvec_chip *nvec, - const unsigned char *data, short size); +struct nvec_msg *nvec_write_sync(struct nvec_chip *nvec, + const unsigned char *data, short size); -extern int nvec_register_notifier(struct nvec_chip *nvec, - struct notifier_block *nb, - unsigned int events); +int nvec_register_notifier(struct nvec_chip *nvec, + struct notifier_block *nb, + unsigned int events); -extern int nvec_unregister_notifier(struct nvec_chip *dev, - struct notifier_block *nb); +int nvec_unregister_notifier(struct nvec_chip *dev, struct notifier_block *nb); -extern void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg); +void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg); #endif From ebea63f66388e4bad2bce39cd12e5b77dc08c1a9 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:28 -0700 Subject: [PATCH 857/912] staging: rtl8188eu: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8188eu/include/osdep_service.h | 2 +- .../staging/rtl8188eu/include/rtw_mlme_ext.h | 8 ++++---- drivers/staging/rtl8188eu/include/sta_info.h | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index 00472e0c00a0..cf9ca685eb77 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -123,7 +123,7 @@ static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) #define BIT35 0x0800000000 #define BIT36 0x1000000000 -extern int RTW_STATUS_CODE(int error_code); +int RTW_STATUS_CODE(int error_code); #define rtw_update_mem_stat(flag, sz) do {} while (0) u8 *_rtw_malloc(u32 sz); diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h index 2417809f3aef..9093a5f94d32 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h @@ -457,9 +457,9 @@ struct mlme_ext_priv { int init_mlme_ext_priv(struct adapter *adapter); int init_hw_mlme_ext(struct adapter *padapter); void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext); -extern void init_mlme_ext_timer(struct adapter *padapter); -extern void init_addba_retry_timer(struct adapter *adapt, struct sta_info *sta); -extern struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv); +void init_mlme_ext_timer(struct adapter *padapter); +void init_addba_retry_timer(struct adapter *adapt, struct sta_info *sta); +struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv); unsigned char networktype_to_raid(unsigned char network_type); u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int len); @@ -554,7 +554,7 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *addr, int cam_idx); void beacon_timing_control(struct adapter *padapter); -extern u8 set_tx_beacon_cmd(struct adapter *padapter); +u8 set_tx_beacon_cmd(struct adapter *padapter); unsigned int setup_beacon_frame(struct adapter *padapter, unsigned char *beacon_frame); void update_mgnt_tx_rate(struct adapter *padapter, u8 rate); diff --git a/drivers/staging/rtl8188eu/include/sta_info.h b/drivers/staging/rtl8188eu/include/sta_info.h index 7bbeedfc49aa..d4e78326fc8d 100644 --- a/drivers/staging/rtl8188eu/include/sta_info.h +++ b/drivers/staging/rtl8188eu/include/sta_info.h @@ -350,19 +350,19 @@ static inline u32 wifi_mac_hash(u8 *mac) return x; } -extern u32 _rtw_init_sta_priv(struct sta_priv *pstapriv); -extern u32 _rtw_free_sta_priv(struct sta_priv *pstapriv); +u32 _rtw_init_sta_priv(struct sta_priv *pstapriv); +u32 _rtw_free_sta_priv(struct sta_priv *pstapriv); #define stainfo_offset_valid(offset) (offset < NUM_STA && offset >= 0) int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta); struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int off); -extern struct sta_info *rtw_alloc_stainfo(struct sta_priv *stapriv, u8 *hwaddr); -extern u32 rtw_free_stainfo(struct adapter *adapt, struct sta_info *psta); -extern void rtw_free_all_stainfo(struct adapter *adapt); -extern struct sta_info *rtw_get_stainfo(struct sta_priv *stapriv, u8 *hwaddr); -extern u32 rtw_init_bcmc_stainfo(struct adapter *adapt); -extern struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter); -extern u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr); +struct sta_info *rtw_alloc_stainfo(struct sta_priv *stapriv, u8 *hwaddr); +u32 rtw_free_stainfo(struct adapter *adapt, struct sta_info *psta); +void rtw_free_all_stainfo(struct adapter *adapt); +struct sta_info *rtw_get_stainfo(struct sta_priv *stapriv, u8 *hwaddr); +u32 rtw_init_bcmc_stainfo(struct adapter *adapt); +struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter); +u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr); #endif /* _STA_INFO_H_ */ From ee233d3e19d7a5624e872710b1a6f629a0e8ef4f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:29 -0700 Subject: [PATCH 858/912] staging: rtl8192e: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignments Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- .../rtl8192e/rtl8192e/r8190P_rtl8256.h | 10 +- .../staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h | 4 +- .../rtl8192e/rtl8192e/r8192E_firmware.h | 2 +- .../staging/rtl8192e/rtl8192e/r8192E_phy.h | 52 ++- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 22 +- drivers/staging/rtl8192e/rtllib.h | 337 ++++++++---------- 6 files changed, 197 insertions(+), 230 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h index 5af837f969b8..3e4363f41728 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h @@ -21,10 +21,10 @@ #define RTL8225H #define RTL819X_TOTAL_RF_PATH 2 -extern void rtl92e_set_bandwidth(struct net_device *dev, - enum ht_channel_width Bandwidth); -extern bool rtl92e_config_rf(struct net_device *dev); -extern void rtl92e_set_cck_tx_power(struct net_device *dev, u8 powerlevel); -extern void rtl92e_set_ofdm_tx_power(struct net_device *dev, u8 powerlevel); +void rtl92e_set_bandwidth(struct net_device *dev, + enum ht_channel_width Bandwidth); +bool rtl92e_config_rf(struct net_device *dev); +void rtl92e_set_cck_tx_power(struct net_device *dev, u8 powerlevel); +void rtl92e_set_ofdm_tx_power(struct net_device *dev, u8 powerlevel); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h index 5718fd8fd118..2a8b165cb8e1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h @@ -19,6 +19,6 @@ #ifndef R819XUSB_CMDPKT_H #define R819XUSB_CMDPKT_H -extern bool rtl92e_send_cmd_pkt(struct net_device *dev, u8 *codevirtualaddress, - u32 packettype, u32 buffer_len); +bool rtl92e_send_cmd_pkt(struct net_device *dev, u8 *codevirtualaddress, + u32 packettype, u32 buffer_len); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h index 4c464eaee69f..fa760f7ac145 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h @@ -60,6 +60,6 @@ struct rt_firmware { }; bool rtl92e_init_fw(struct net_device *dev); -extern void rtl92e_init_fw_param(struct net_device *dev); +void rtl92e_init_fw_param(struct net_device *dev); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 350d3063df72..96015d342009 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -67,40 +67,36 @@ enum rf90_radio_path { #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff -extern u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath); -extern void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, - u32 dwBitMask, u32 dwData); -extern u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, - u32 dwBitMask); -extern void rtl92e_set_rf_reg(struct net_device *dev, - enum rf90_radio_path eRFPath, u32 RegAddr, - u32 BitMask, u32 Data); -extern u32 rtl92e_get_rf_reg(struct net_device *dev, - enum rf90_radio_path eRFPath, u32 RegAddr, - u32 BitMask); -extern void rtl92e_config_mac(struct net_device *dev); -extern bool rtl92e_check_bb_and_rf(struct net_device *dev, - enum hw90_block CheckBlock, - enum rf90_radio_path eRFPath); -extern bool rtl92e_config_bb(struct net_device *dev); -extern void rtl92e_get_tx_power(struct net_device *dev); -extern void rtl92e_set_tx_power(struct net_device *dev, u8 channel); -extern bool rtl92e_config_phy(struct net_device *dev); -extern u8 rtl92e_config_rf_path(struct net_device *dev, - enum rf90_radio_path eRFPath); +u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath); +void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, + u32 dwBitMask, u32 dwData); +u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask); +void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, + u32 RegAddr, u32 BitMask, u32 Data); +u32 rtl92e_get_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, + u32 RegAddr, u32 BitMask); +void rtl92e_config_mac(struct net_device *dev); +bool rtl92e_check_bb_and_rf(struct net_device *dev, + enum hw90_block CheckBlock, + enum rf90_radio_path eRFPath); +bool rtl92e_config_bb(struct net_device *dev); +void rtl92e_get_tx_power(struct net_device *dev); +void rtl92e_set_tx_power(struct net_device *dev, u8 channel); +bool rtl92e_config_phy(struct net_device *dev); +u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath); -extern u8 rtl92e_set_channel(struct net_device *dev, u8 channel); -extern void rtl92e_set_bw_mode(struct net_device *dev, - enum ht_channel_width Bandwidth, - enum ht_extchnl_offset Offset); -extern void rtl92e_init_gain(struct net_device *dev, u8 Operation); +u8 rtl92e_set_channel(struct net_device *dev, u8 channel); +void rtl92e_set_bw_mode(struct net_device *dev, + enum ht_channel_width Bandwidth, + enum ht_extchnl_offset Offset); +void rtl92e_init_gain(struct net_device *dev, u8 Operation); -extern void rtl92e_set_rf_off(struct net_device *dev); +void rtl92e_set_rf_off(struct net_device *dev); bool rtl92e_set_rf_power_state(struct net_device *dev, enum rt_rf_power_state eRFPowerState); #define PHY_SetRFPowerState rtl92e_set_rf_power_state -extern void rtl92e_scan_op_backup(struct net_device *dev, u8 Operation); +void rtl92e_scan_op_backup(struct net_device *dev, u8 Operation); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index e16502d12cdc..097f0dc2056d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -188,20 +188,20 @@ extern const u8 dm_cck_tx_bb_gain_ch14[CCKTxBBGainTableLength][8]; /*--------------------------Exported Function prototype---------------------*/ /*--------------------------Exported Function prototype---------------------*/ -extern void rtl92e_dm_init(struct net_device *dev); -extern void rtl92e_dm_deinit(struct net_device *dev); +void rtl92e_dm_init(struct net_device *dev); +void rtl92e_dm_deinit(struct net_device *dev); -extern void rtl92e_dm_watchdog(struct net_device *dev); +void rtl92e_dm_watchdog(struct net_device *dev); -extern void rtl92e_init_adaptive_rate(struct net_device *dev); -extern void rtl92e_dm_txpower_tracking_wq(void *data); +void rtl92e_init_adaptive_rate(struct net_device *dev); +void rtl92e_dm_txpower_tracking_wq(void *data); -extern void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14); +void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14); -extern void rtl92e_dm_restore_state(struct net_device *dev); -extern void rtl92e_dm_backup_state(struct net_device *dev); -extern void rtl92e_dm_init_edca_turbo(struct net_device *dev); -extern void rtl92e_dm_rf_pathcheck_wq(void *data); -extern void rtl92e_dm_init_txpower_tracking(struct net_device *dev); +void rtl92e_dm_restore_state(struct net_device *dev); +void rtl92e_dm_backup_state(struct net_device *dev); +void rtl92e_dm_init_edca_turbo(struct net_device *dev); +void rtl92e_dm_rf_pathcheck_wq(void *data); +void rtl92e_dm_init_txpower_tracking(struct net_device *dev); #endif /*__R8192UDM_H__ */ diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 617f79efe4ca..563ac12f0b2c 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1984,228 +1984,199 @@ static inline int rtllib_is_cck_rate(u8 rate) /* rtllib.c */ -extern void free_rtllib(struct net_device *dev); -extern struct net_device *alloc_rtllib(int sizeof_priv); +void free_rtllib(struct net_device *dev); +struct net_device *alloc_rtllib(int sizeof_priv); /* rtllib_tx.c */ -extern int rtllib_encrypt_fragment( +int rtllib_encrypt_fragment( struct rtllib_device *ieee, struct sk_buff *frag, int hdr_len); -extern int rtllib_xmit(struct sk_buff *skb, struct net_device *dev); -extern void rtllib_txb_free(struct rtllib_txb *); +int rtllib_xmit(struct sk_buff *skb, struct net_device *dev); +void rtllib_txb_free(struct rtllib_txb *); /* rtllib_rx.c */ -extern int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, - struct rtllib_rx_stats *rx_stats); -extern void rtllib_rx_probe_rq(struct rtllib_device *ieee, - struct sk_buff *skb); -extern int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel); +int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, + struct rtllib_rx_stats *rx_stats); +void rtllib_rx_probe_rq(struct rtllib_device *ieee, + struct sk_buff *skb); +int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel); /* rtllib_wx.c */ -extern int rtllib_wx_get_scan(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int rtllib_wx_set_encode(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int rtllib_wx_get_encode(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_set_auth(struct rtllib_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra); -extern int rtllib_wx_set_mlme(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len); +int rtllib_wx_get_scan(struct rtllib_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +int rtllib_wx_set_encode(struct rtllib_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +int rtllib_wx_get_encode(struct rtllib_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +int rtllib_wx_set_auth(struct rtllib_device *ieee, + struct iw_request_info *info, + struct iw_param *data, char *extra); +int rtllib_wx_set_mlme(struct rtllib_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len); /* rtllib_softmac.c */ -extern int rtllib_rx_frame_softmac(struct rtllib_device *ieee, - struct sk_buff *skb, - struct rtllib_rx_stats *rx_stats, u16 type, - u16 stype); -extern void rtllib_softmac_new_net(struct rtllib_device *ieee, - struct rtllib_network *net); +int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb, + struct rtllib_rx_stats *rx_stats, u16 type, + u16 stype); +void rtllib_softmac_new_net(struct rtllib_device *ieee, + struct rtllib_network *net); void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn); -extern void rtllib_softmac_xmit(struct rtllib_txb *txb, - struct rtllib_device *ieee); +void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee); -extern void rtllib_stop_send_beacons(struct rtllib_device *ieee); -extern void notify_wx_assoc_event(struct rtllib_device *ieee); -extern void rtllib_start_ibss(struct rtllib_device *ieee); -extern void rtllib_softmac_init(struct rtllib_device *ieee); -extern void rtllib_softmac_free(struct rtllib_device *ieee); -extern void rtllib_disassociate(struct rtllib_device *ieee); -extern void rtllib_stop_scan(struct rtllib_device *ieee); -extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan); -extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee); -extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); -extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, - short pwr); -extern void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee); -extern void rtllib_start_protocol(struct rtllib_device *ieee); -extern void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown); +void rtllib_stop_send_beacons(struct rtllib_device *ieee); +void notify_wx_assoc_event(struct rtllib_device *ieee); +void rtllib_start_ibss(struct rtllib_device *ieee); +void rtllib_softmac_init(struct rtllib_device *ieee); +void rtllib_softmac_free(struct rtllib_device *ieee); +void rtllib_disassociate(struct rtllib_device *ieee); +void rtllib_stop_scan(struct rtllib_device *ieee); +bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan); +void rtllib_stop_scan_syncro(struct rtllib_device *ieee); +void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); +void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr); +void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee); +void rtllib_start_protocol(struct rtllib_device *ieee); +void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown); -extern void rtllib_EnableNetMonitorMode(struct net_device *dev, +void rtllib_EnableNetMonitorMode(struct net_device *dev, bool bInitState); +void rtllib_DisableNetMonitorMode(struct net_device *dev, bool bInitState); +void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, bool bInitState); +void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, bool bInitState); -extern void rtllib_DisableNetMonitorMode(struct net_device *dev, - bool bInitState); -extern void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, - bool bInitState); -extern void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, - bool bInitState); -extern void rtllib_softmac_stop_protocol(struct rtllib_device *ieee, - u8 mesh_flag, u8 shutdown); -extern void rtllib_softmac_start_protocol(struct rtllib_device *ieee, - u8 mesh_flag); +void rtllib_softmac_stop_protocol(struct rtllib_device *ieee, + u8 mesh_flag, u8 shutdown); +void rtllib_softmac_start_protocol(struct rtllib_device *ieee, u8 mesh_flag); -extern void rtllib_reset_queue(struct rtllib_device *ieee); -extern void rtllib_wake_all_queues(struct rtllib_device *ieee); -extern void rtllib_stop_all_queues(struct rtllib_device *ieee); -extern struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee); -extern void rtllib_start_send_beacons(struct rtllib_device *ieee); -extern void rtllib_stop_send_beacons(struct rtllib_device *ieee); -extern int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, - struct iw_point *p, u8 is_mesh); +void rtllib_reset_queue(struct rtllib_device *ieee); +void rtllib_wake_all_queues(struct rtllib_device *ieee); +void rtllib_stop_all_queues(struct rtllib_device *ieee); +struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee); +void rtllib_start_send_beacons(struct rtllib_device *ieee); +void rtllib_stop_send_beacons(struct rtllib_device *ieee); +int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, + struct iw_point *p, u8 is_mesh); -extern void notify_wx_assoc_event(struct rtllib_device *ieee); -extern void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success); +void notify_wx_assoc_event(struct rtllib_device *ieee); +void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success); -extern void softmac_mgmt_xmit(struct sk_buff *skb, - struct rtllib_device *ieee); -extern u8 rtllib_ap_sec_type(struct rtllib_device *ieee); +void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee); +u8 rtllib_ap_sec_type(struct rtllib_device *ieee); /* rtllib_softmac_wx.c */ -extern int rtllib_wx_get_wap(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *ext); +int rtllib_wx_get_wap(struct rtllib_device *ieee, struct iw_request_info *info, + union iwreq_data *wrqu, char *ext); -extern int rtllib_wx_set_wap(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *awrq, - char *extra); +int rtllib_wx_set_wap(struct rtllib_device *ieee, struct iw_request_info *info, + union iwreq_data *awrq, char *extra); -extern int rtllib_wx_get_essid(struct rtllib_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int rtllib_wx_get_essid(struct rtllib_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int rtllib_wx_set_rate(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_set_rate(struct rtllib_device *ieee, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_get_rate(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_get_rate(struct rtllib_device *ieee, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_set_mode(struct rtllib_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int rtllib_wx_set_scan(struct rtllib_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int rtllib_wx_set_essid(struct rtllib_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_set_essid(struct rtllib_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_get_mode(struct rtllib_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int rtllib_wx_set_freq(struct rtllib_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int rtllib_wx_get_freq(struct rtllib_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *b); -extern void rtllib_wx_sync_scan_wq(void *data); +int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); +void rtllib_wx_sync_scan_wq(void *data); -extern int rtllib_wx_set_rawtx(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_set_rawtx(struct rtllib_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_get_name(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_get_name(struct rtllib_device *ieee, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_set_power(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_set_power(struct rtllib_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_get_power(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_get_power(struct rtllib_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_set_rts(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_set_rts(struct rtllib_device *ieee, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int rtllib_wx_get_rts(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int rtllib_wx_get_rts(struct rtllib_device *ieee, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); #define MAX_RECEIVE_BUFFER_SIZE 9100 void HTSetConnectBwMode(struct rtllib_device *ieee, enum ht_channel_width Bandwidth, enum ht_extchnl_offset Offset); -extern void HTUpdateDefaultSetting(struct rtllib_device *ieee); -extern void HTConstructCapabilityElement(struct rtllib_device *ieee, - u8 *posHTCap, u8 *len, - u8 isEncrypt, bool bAssoc); -extern void HTConstructInfoElement(struct rtllib_device *ieee, - u8 *posHTInfo, u8 *len, u8 isEncrypt); -extern void HTConstructRT2RTAggElement(struct rtllib_device *ieee, - u8 *posRT2RTAgg, u8 *len); -extern void HTOnAssocRsp(struct rtllib_device *ieee); -extern void HTInitializeHTInfo(struct rtllib_device *ieee); -extern void HTInitializeBssDesc(struct bss_ht *pBssHT); -extern void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee, - struct rtllib_network *pNetwork); -extern void HT_update_self_and_peer_setting(struct rtllib_device *ieee, - struct rtllib_network *pNetwork); -extern u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, - u8 *pMCSFilter); +void HTUpdateDefaultSetting(struct rtllib_device *ieee); +void HTConstructCapabilityElement(struct rtllib_device *ieee, + u8 *posHTCap, u8 *len, + u8 isEncrypt, bool bAssoc); +void HTConstructInfoElement(struct rtllib_device *ieee, + u8 *posHTInfo, u8 *len, u8 isEncrypt); +void HTConstructRT2RTAggElement(struct rtllib_device *ieee, + u8 *posRT2RTAgg, u8 *len); +void HTOnAssocRsp(struct rtllib_device *ieee); +void HTInitializeHTInfo(struct rtllib_device *ieee); +void HTInitializeBssDesc(struct bss_ht *pBssHT); +void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee, + struct rtllib_network *pNetwork); +void HT_update_self_and_peer_setting(struct rtllib_device *ieee, + struct rtllib_network *pNetwork); +u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, + u8 *pMCSFilter); extern u8 MCS_FILTER_ALL[]; extern u16 MCS_DATA_RATE[2][2][77]; -extern u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame); -extern void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo); -extern bool IsHTHalfNmodeAPs(struct rtllib_device *ieee); -extern u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate); -extern int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb); -extern int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb); -extern int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb); -extern void TsInitAddBA(struct rtllib_device *ieee, struct tx_ts_record *pTS, - u8 Policy, u8 bOverwritePending); -extern void TsInitDelBA(struct rtllib_device *ieee, - struct ts_common_info *pTsCommonInfo, - enum tr_select TxRxSelect); -extern void BaSetupTimeOut(unsigned long data); -extern void TxBaInactTimeout(unsigned long data); -extern void RxBaInactTimeout(unsigned long data); -extern void ResetBaEntry(struct ba_record *pBA); -extern bool GetTs( - struct rtllib_device *ieee, - struct ts_common_info **ppTS, - u8 *Addr, - u8 TID, - enum tr_select TxRxSelect, - bool bAddNewTs -); -extern void TSInitialize(struct rtllib_device *ieee); -extern void TsStartAddBaProcess(struct rtllib_device *ieee, - struct tx_ts_record *pTxTS); -extern void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr); -extern void RemoveAllTS(struct rtllib_device *ieee); +u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame); +void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo); +bool IsHTHalfNmodeAPs(struct rtllib_device *ieee); +u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate); +int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb); +int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb); +int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb); +void TsInitAddBA(struct rtllib_device *ieee, struct tx_ts_record *pTS, + u8 Policy, u8 bOverwritePending); +void TsInitDelBA(struct rtllib_device *ieee, + struct ts_common_info *pTsCommonInfo, + enum tr_select TxRxSelect); +void BaSetupTimeOut(unsigned long data); +void TxBaInactTimeout(unsigned long data); +void RxBaInactTimeout(unsigned long data); +void ResetBaEntry(struct ba_record *pBA); +bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *Addr, + u8 TID, enum tr_select TxRxSelect, bool bAddNewTs); +void TSInitialize(struct rtllib_device *ieee); +void TsStartAddBaProcess(struct rtllib_device *ieee, + struct tx_ts_record *pTxTS); +void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr); +void RemoveAllTS(struct rtllib_device *ieee); extern const long rtllib_wlan_frequencies[]; @@ -2229,17 +2200,17 @@ bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn); /* For the function is more related to hardware setting, it's better to use the * ieee handler to refer to it. */ -extern void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, - struct rx_ts_record *pTS); -extern int rtllib_parse_info_param(struct rtllib_device *ieee, - struct rtllib_info_element *info_element, - u16 length, - struct rtllib_network *network, - struct rtllib_rx_stats *stats); +void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, + struct rx_ts_record *pTS); +int rtllib_parse_info_param(struct rtllib_device *ieee, + struct rtllib_info_element *info_element, + u16 length, + struct rtllib_network *network, + struct rtllib_rx_stats *stats); void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prxbIndicateArray, u8 index); -extern void HTUseDefaultSetting(struct rtllib_device *ieee); +void HTUseDefaultSetting(struct rtllib_device *ieee); #define RT_ASOC_RETRY_LIMIT 5 u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee); #define SEM_DOWN_IEEE_WX(psem) down(psem) From b3ff291009c21ff1276a6470325ff6a5149c3b5f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:33 -0700 Subject: [PATCH 859/912] staging: wilc1000: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignments Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.h | 30 +++++++++---------- drivers/staging/wilc1000/linux_wlan_common.h | 4 +-- .../staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 56ff2ba139ed..3af193543cdb 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -163,27 +163,27 @@ typedef struct wid_site_survey_reslts { } wid_site_survey_reslts_s; #endif -extern s32 CoreConfiguratorInit(void); -extern s32 CoreConfiguratorDeInit(void); +s32 CoreConfiguratorInit(void); +s32 CoreConfiguratorDeInit(void); -extern s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - u32 u32WIDsCount, bool bRespRequired, u32 drvHandler); -extern s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); -extern s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); +s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, + u32 u32WIDsCount, bool bRespRequired, u32 drvHandler); +s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); +s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); -extern s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, - tstrConnectRespInfo **ppstrConnectRespInfo); -extern s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo); +s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, + tstrConnectRespInfo **ppstrConnectRespInfo); +s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo); #ifndef CONNECT_DIRECT -extern s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], - wid_site_survey_reslts_s **ppstrSurveyResults, - u32 *pu32SurveyResultsCount); -extern s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults); +s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], + wid_site_survey_reslts_s **ppstrSurveyResults, + u32 *pu32SurveyResultsCount); +s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults); #endif -extern s32 SendRawPacket(s8 *pspacket, s32 s32PacketLen); -extern void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length); +s32 SendRawPacket(s8 *pspacket, s32 s32PacketLen); +void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length); void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length); void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length); diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h index 2476bfda1b46..e6ebf3e89129 100644 --- a/drivers/staging/wilc1000/linux_wlan_common.h +++ b/drivers/staging/wilc1000/linux_wlan_common.h @@ -39,8 +39,8 @@ enum debug_region { #define FIRM_DBG (1 << Firmware_debug) #if defined (WILC_DEBUGFS) -extern int wilc_debugfs_init(void); -extern void wilc_debugfs_remove(void); +int wilc_debugfs_init(void); +void wilc_debugfs_remove(void); extern atomic_t REGION; extern atomic_t DEBUG_LEVEL; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index c25350cb58c8..97b663b7fd14 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -123,7 +123,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi #ifdef TCP_ENHANCEMENTS #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 #define DEFAULT_LINK_SPEED 72 -extern void Enable_TCP_ACK_Filter(bool value); +void Enable_TCP_ACK_Filter(bool value); #endif #endif From fd8c5cb5ac30f26902b130f46e1180c18f006b2a Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:19 -0700 Subject: [PATCH 860/912] staging: ft1000: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignment Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 19 +++++++++---------- .../staging/ft1000/ft1000-usb/ft1000_usb.h | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h index 5992670f7747..e1861cf5de73 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h @@ -42,17 +42,16 @@ struct ft1000_pcmcia { struct pcmcia_device; struct net_device; -extern struct net_device *init_ft1000_card(struct pcmcia_device *link, - void *ft1000_reset); -extern void stop_ft1000_card(struct net_device *dev); -extern int card_download(struct net_device *dev, const u8 *pFileStart, - size_t FileLength); +struct net_device *init_ft1000_card(struct pcmcia_device *link, + void *ft1000_reset); +void stop_ft1000_card(struct net_device *dev); +int card_download(struct net_device *dev, const u8 *pFileStart, + size_t FileLength); -extern u16 ft1000_read_dpram(struct net_device *dev, int offset); -extern void card_bootload(struct net_device *dev); -extern u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, - int Index); -extern u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset); +u16 ft1000_read_dpram(struct net_device *dev, int offset); +void card_bootload(struct net_device *dev); +u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index); +u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset); void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value); /* Read the value of a given ASIC register. */ diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index fea60d5651a7..9b5050fcbb66 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -134,8 +134,8 @@ extern spinlock_t free_buff_lock; int ft1000_create_dev(struct ft1000_usb *dev); void ft1000_destroy_dev(struct net_device *dev); -extern int card_send_command(struct ft1000_usb *ft1000dev, - void *ptempbuffer, int size); +int 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); From 35bb99bf6579f04981830d3275dcffd8b2b17edb Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:17 -0700 Subject: [PATCH 861/912] staging: dgnc: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_sysfs.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_sysfs.h b/drivers/staging/dgnc/dgnc_sysfs.h index be0f90a6768b..7be7d55bc49e 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.h +++ b/drivers/staging/dgnc/dgnc_sysfs.h @@ -25,16 +25,16 @@ struct un_t; struct pci_driver; struct class_device; -extern void dgnc_create_ports_sysfiles(struct dgnc_board *bd); -extern void dgnc_remove_ports_sysfiles(struct dgnc_board *bd); +void dgnc_create_ports_sysfiles(struct dgnc_board *bd); +void dgnc_remove_ports_sysfiles(struct dgnc_board *bd); -extern void dgnc_create_driver_sysfiles(struct pci_driver *); -extern void dgnc_remove_driver_sysfiles(struct pci_driver *); +void dgnc_create_driver_sysfiles(struct pci_driver *); +void dgnc_remove_driver_sysfiles(struct pci_driver *); -extern int dgnc_tty_class_init(void); -extern int dgnc_tty_class_destroy(void); +int dgnc_tty_class_init(void); +int dgnc_tty_class_destroy(void); -extern void dgnc_create_tty_sysfs(struct un_t *un, struct device *c); -extern void dgnc_remove_tty_sysfs(struct device *c); +void dgnc_create_tty_sysfs(struct un_t *un, struct device *c); +void dgnc_remove_tty_sysfs(struct device *c); #endif From ec9a0ffa494c7f9c6dbffea7f073ec72a77f1cdb Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:23 -0700 Subject: [PATCH 862/912] staging: mt29f_spinand: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt29f_spinand/mt29f_spinand.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.h b/drivers/staging/mt29f_spinand/mt29f_spinand.h index 7f2c24dc51b4..6c8e413b5b63 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.h +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.h @@ -101,7 +101,7 @@ struct spinand_cmd { u8 *rx_buf; /* Rx buf */ }; -extern int spinand_mtd(struct mtd_info *mtd); -extern void spinand_mtd_release(struct mtd_info *mtd); +int spinand_mtd(struct mtd_info *mtd); +void spinand_mtd_release(struct mtd_info *mtd); #endif /* __LINUX_MTD_SPI_NAND_H */ From beb12167080146c8cbaa204daae52b102c066166 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 10 Aug 2015 14:51:30 -0700 Subject: [PATCH 863/912] staging: rtl8192u: Remove unnecessary externs Using 'extern' is not necessary for function prototypes. Miscellanea: o Reflow alignments Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/ieee80211.h | 337 +++++++++--------- drivers/staging/rtl8192u/r8190_rtl8256.h | 11 +- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_dm.h | 36 +- drivers/staging/rtl8192u/r8192U_wx.h | 2 +- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 8 +- drivers/staging/rtl8192u/r819xU_phy.h | 55 ++- 7 files changed, 232 insertions(+), 219 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 23af2aad458e..d481a26c25ae 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -2169,98 +2169,99 @@ static inline int ieee80211_is_cck_rate(u8 rate) /* ieee80211.c */ -extern void free_ieee80211(struct net_device *dev); -extern struct net_device *alloc_ieee80211(int sizeof_priv); +void free_ieee80211(struct net_device *dev); +struct net_device *alloc_ieee80211(int sizeof_priv); -extern int ieee80211_set_encryption(struct ieee80211_device *ieee); +int ieee80211_set_encryption(struct ieee80211_device *ieee); /* ieee80211_tx.c */ -extern int ieee80211_encrypt_fragment( - struct ieee80211_device *ieee, - struct sk_buff *frag, - int hdr_len); +int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, + struct sk_buff *frag, int hdr_len); -extern int ieee80211_xmit(struct sk_buff *skb, - struct net_device *dev); -extern void ieee80211_txb_free(struct ieee80211_txb *); +int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); +void ieee80211_txb_free(struct ieee80211_txb *); /* ieee80211_rx.c */ -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats); -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, - struct rtl_80211_hdr_4addr *header, - struct ieee80211_rx_stats *stats); +int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats); +void ieee80211_rx_mgt(struct ieee80211_device *ieee, + struct rtl_80211_hdr_4addr *header, + struct ieee80211_rx_stats *stats); /* ieee80211_wx.c */ -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, +int ieee80211_wx_get_scan(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +int ieee80211_wx_set_encode(struct ieee80211_device *ieee, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, + union iwreq_data *wrqu, char *key); +int ieee80211_wx_get_encode(struct ieee80211_device *ieee, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra); -extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); + union iwreq_data *wrqu, char *key); +int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_auth(struct ieee80211_device *ieee, + struct iw_request_info *info, + struct iw_param *data, char *extra); +int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); /* ieee80211_softmac.c */ -extern short ieee80211_is_54g(const struct ieee80211_network *net); -extern short ieee80211_is_shortslot(const struct ieee80211_network *net); -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats, u16 type, - u16 stype); -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); +short ieee80211_is_54g(const struct ieee80211_network *net); +short ieee80211_is_shortslot(const struct ieee80211_network *net); +int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, + struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, + u16 type, u16 stype); +void ieee80211_softmac_new_net(struct ieee80211_device *ieee, + struct ieee80211_network *net); void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, u8 asRsn); -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); +void ieee80211_softmac_xmit(struct ieee80211_txb *txb, + struct ieee80211_device *ieee); -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); -extern void notify_wx_assoc_event(struct ieee80211_device *ieee); -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); -extern void ieee80211_start_bss(struct ieee80211_device *ieee); -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); -extern void ieee80211_start_ibss(struct ieee80211_device *ieee); -extern void ieee80211_softmac_init(struct ieee80211_device *ieee); -extern void ieee80211_softmac_free(struct ieee80211_device *ieee); -extern void ieee80211_associate_abort(struct ieee80211_device *ieee); -extern void ieee80211_disassociate(struct ieee80211_device *ieee); -extern void ieee80211_stop_scan(struct ieee80211_device *ieee); -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); -extern void ieee80211_start_protocol(struct ieee80211_device *ieee); -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); -extern void ieee80211_reset_queue(struct ieee80211_device *ieee); -extern void ieee80211_wake_queue(struct ieee80211_device *ieee); -extern void ieee80211_stop_queue(struct ieee80211_device *ieee); -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); -extern void notify_wx_assoc_event(struct ieee80211_device *ieee); -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); +void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); +void notify_wx_assoc_event(struct ieee80211_device *ieee); +void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); +void ieee80211_start_bss(struct ieee80211_device *ieee); +void ieee80211_start_master_bss(struct ieee80211_device *ieee); +void ieee80211_start_ibss(struct ieee80211_device *ieee); +void ieee80211_softmac_init(struct ieee80211_device *ieee); +void ieee80211_softmac_free(struct ieee80211_device *ieee); +void ieee80211_associate_abort(struct ieee80211_device *ieee); +void ieee80211_disassociate(struct ieee80211_device *ieee); +void ieee80211_stop_scan(struct ieee80211_device *ieee); +void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); +void ieee80211_check_all_nets(struct ieee80211_device *ieee); +void ieee80211_start_protocol(struct ieee80211_device *ieee); +void ieee80211_stop_protocol(struct ieee80211_device *ieee); +void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); +void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); +void ieee80211_reset_queue(struct ieee80211_device *ieee); +void ieee80211_wake_queue(struct ieee80211_device *ieee); +void ieee80211_stop_queue(struct ieee80211_device *ieee); +struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); +void ieee80211_start_send_beacons(struct ieee80211_device *ieee); +void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); +int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, + struct iw_point *p); +void notify_wx_assoc_event(struct ieee80211_device *ieee); +void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); -extern void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); +void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); /* ieee80211_crypt_ccmp&tkip&wep.c */ -extern void ieee80211_tkip_null(void); -extern void ieee80211_wep_null(void); -extern void ieee80211_ccmp_null(void); +void ieee80211_tkip_null(void); +void ieee80211_wep_null(void); +void ieee80211_ccmp_null(void); int ieee80211_crypto_init(void); void ieee80211_crypto_deinit(void); @@ -2273,116 +2274,128 @@ void ieee80211_crypto_wep_exit(void); /* ieee80211_softmac_wx.c */ -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *ext); +int ieee80211_wx_get_wap(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *ext); -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, +int ieee80211_wx_set_wap(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *awrq, char *extra); -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); +int ieee80211_wx_get_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_get_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_set_mode(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_set_scan(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_get_mode(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_set_freq(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_get_freq(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); /* ieee80211_module.c */ -extern int ieee80211_debug_init(void); -extern void ieee80211_debug_exit(void); +int ieee80211_debug_init(void); +void ieee80211_debug_exit(void); //extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); +void ieee80211_wx_sync_scan_wq(struct work_struct *work); -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, - struct iw_request_info *info, +int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_get_name(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_get_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_get_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); //HT #define MAX_RECEIVE_BUFFER_SIZE 9100 // -extern void HTDebugHTCapability(u8 *CapIE, u8 *TitleString ); -extern void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString); +void HTDebugHTCapability(u8 *CapIE, u8 *TitleString); +void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString); -void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); -extern void HTUpdateDefaultSetting(struct ieee80211_device *ieee); -extern void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u8 *len, u8 isEncrypt); -extern void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *len, u8 isEncrypt); -extern void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, u8 *len); -extern void HTOnAssocRsp(struct ieee80211_device *ieee); -extern void HTInitializeHTInfo(struct ieee80211_device *ieee); -extern void HTInitializeBssDesc(PBSS_HT pBssHT); -extern void HTResetSelfAndSavePeerSetting(struct ieee80211_device *ieee, struct ieee80211_network *pNetwork); -extern void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, struct ieee80211_network *pNetwork); -extern u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSFilter); +void HTSetConnectBwMode(struct ieee80211_device *ieee, + HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); +void HTUpdateDefaultSetting(struct ieee80211_device *ieee); +void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, + u8 *len, u8 isEncrypt); +void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, + u8 *len, u8 isEncrypt); +void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, + u8 *len); +void HTOnAssocRsp(struct ieee80211_device *ieee); +void HTInitializeHTInfo(struct ieee80211_device *ieee); +void HTInitializeBssDesc(PBSS_HT pBssHT); +void HTResetSelfAndSavePeerSetting(struct ieee80211_device *ieee, + struct ieee80211_network *pNetwork); +void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, + struct ieee80211_network *pNetwork); +u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, + u8 *pMCSRateSet, u8 *pMCSFilter); extern u8 MCS_FILTER_ALL[]; extern u16 MCS_DATA_RATE[2][2][77] ; -extern u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame); +u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame); //extern void HTSetConnectBwModeCallback(unsigned long data); -extern void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo); -extern bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee); -extern u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); -extern u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); -extern u16 TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate); +void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo); +bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee); +u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); +u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); +u16 TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate); //function in BAPROC.c -extern int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, - struct sk_buff *skb); -extern int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, - struct sk_buff *skb); -extern int ieee80211_rx_DELBA(struct ieee80211_device *ieee,struct sk_buff *skb); -extern void TsInitAddBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTS, - u8 Policy, u8 bOverwritePending); -extern void TsInitDelBA(struct ieee80211_device *ieee, - PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect); -extern void BaSetupTimeOut(unsigned long data); -extern void TxBaInactTimeout(unsigned long data); -extern void RxBaInactTimeout(unsigned long data); -extern void ResetBaEntry(PBA_RECORD pBA); +int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb); +int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb); +int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb); +void TsInitAddBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTS, + u8 Policy, u8 bOverwritePending); +void TsInitDelBA(struct ieee80211_device *ieee, + PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect); +void BaSetupTimeOut(unsigned long data); +void TxBaInactTimeout(unsigned long data); +void RxBaInactTimeout(unsigned long data); +void ResetBaEntry(PBA_RECORD pBA); //function in TS.c -extern bool GetTs( +bool GetTs( struct ieee80211_device *ieee, PTS_COMMON_INFO *ppTS, u8 *Addr, @@ -2390,10 +2403,10 @@ extern bool GetTs( TR_SELECT TxRxSelect, //Rx:1, Tx:0 bool bAddNewTs ); -extern void TSInitialize(struct ieee80211_device *ieee); -extern void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS); -extern void RemovePeerTS(struct ieee80211_device *ieee, u8 *Addr); -extern void RemoveAllTS(struct ieee80211_device *ieee); +void TSInitialize(struct ieee80211_device *ieee); +void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS); +void RemovePeerTS(struct ieee80211_device *ieee, u8 *Addr); +void RemoveAllTS(struct ieee80211_device *ieee); void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee); extern const long ieee80211_wlan_frequencies[]; @@ -2423,14 +2436,16 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) { /* For the function is more related to hardware setting, it's better to use the * ieee handler to refer to it. */ -extern short check_nic_enough_desc(struct net_device *dev, int queue_index); -extern int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev); -extern int ieee80211_parse_info_param(struct ieee80211_device *ieee, - struct ieee80211_info_element *info_element, - u16 length, - struct ieee80211_network *network, - struct ieee80211_rx_stats *stats); +short check_nic_enough_desc(struct net_device *dev, int queue_index); +int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev); +int ieee80211_parse_info_param(struct ieee80211_device *ieee, + struct ieee80211_info_element *info_element, + u16 length, + struct ieee80211_network *network, + struct ieee80211_rx_stats *stats); -void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_rxb **prxbIndicateArray,u8 index); +void ieee80211_indicate_packets(struct ieee80211_device *ieee, + struct ieee80211_rxb **prxbIndicateArray, + u8 index); #define RT_ASOC_RETRY_LIMIT 5 #endif /* IEEE80211_H */ diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index 6e5662f7951c..1ba4f83b520e 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -14,11 +14,10 @@ #define RTL8225H #define RTL819X_TOTAL_RF_PATH 2 /* for 8192U */ -extern void PHY_SetRF8256Bandwidth(struct net_device *dev, - HT_CHANNEL_WIDTH Bandwidth); -extern void PHY_RF8256_Config(struct net_device *dev); -extern void phy_RF8256_Config_ParaFile(struct net_device *dev); -extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); -extern void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel); +void PHY_SetRF8256Bandwidth(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth); +void PHY_RF8256_Config(struct net_device *dev); +void phy_RF8256_Config_ParaFile(struct net_device *dev); +void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); +void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel); #endif diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 6c2e438c9af4..785fd027a00d 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1187,7 +1187,7 @@ void write_phy_cck(struct net_device *dev, u8 adr, u32 data); void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data); void rtl8185_tx_antenna(struct net_device *dev, u8 ant); void rtl8192_set_rxconf(struct net_device *dev); -extern void rtl819xusb_beacon_tx(struct net_device *dev, u16 tx_rate); +void rtl819xusb_beacon_tx(struct net_device *dev, u16 tx_rate); void EnableHWSecurityConfig8192(struct net_device *dev); void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index 6cd32eb44085..2d0232fb3f9b 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -212,24 +212,24 @@ extern struct dynamic_rx_path_sel DM_RxPathSelTable; /*--------------------------Exported Function prototype---------------------*/ -extern void init_hal_dm(struct net_device *dev); -extern void deinit_hal_dm(struct net_device *dev); -extern void hal_dm_watchdog(struct net_device *dev); -extern void init_rate_adaptive(struct net_device *dev); -extern void dm_txpower_trackingcallback(struct work_struct *work); -extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); -extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); -extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, - u32 dm_type, u32 dm_value); -extern void dm_force_tx_fw_info(struct net_device *dev, - u32 force_type, u32 force_value); -extern void dm_init_edca_turbo(struct net_device *dev); -extern void dm_rf_operation_test_callback(unsigned long data); -extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); -extern void dm_fsync_timer_callback(unsigned long data); -extern void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); -extern void dm_shadow_init(struct net_device *dev); -extern void dm_initialize_txpower_tracking(struct net_device *dev); +void init_hal_dm(struct net_device *dev); +void deinit_hal_dm(struct net_device *dev); +void hal_dm_watchdog(struct net_device *dev); +void init_rate_adaptive(struct net_device *dev); +void dm_txpower_trackingcallback(struct work_struct *work); +void dm_restore_dynamic_mechanism_state(struct net_device *dev); +void dm_backup_dynamic_mechanism_state(struct net_device *dev); +void dm_change_dynamic_initgain_thresh(struct net_device *dev, + u32 dm_type, u32 dm_value); +void dm_force_tx_fw_info(struct net_device *dev, + u32 force_type, u32 force_value); +void dm_init_edca_turbo(struct net_device *dev); +void dm_rf_operation_test_callback(unsigned long data); +void dm_rf_pathcheck_workitemcallback(struct work_struct *work); +void dm_fsync_timer_callback(unsigned long data); +void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); +void dm_shadow_init(struct net_device *dev); +void dm_initialize_txpower_tracking(struct net_device *dev); /*--------------------------Exported Function prototype---------------------*/ diff --git a/drivers/staging/rtl8192u/r8192U_wx.h b/drivers/staging/rtl8192u/r8192U_wx.h index d6a2d9756531..fb5f808433d1 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.h +++ b/drivers/staging/rtl8192u/r8192U_wx.h @@ -19,6 +19,6 @@ extern struct iw_handler_def r8192_wx_handlers_def; /* Enable the rtl819x_core.c to share this function, david 2008.9.22 */ -extern struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev); +struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev); #endif diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h index 52cd437ef7bb..cc8029a15df4 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.h +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h @@ -182,10 +182,10 @@ typedef enum _rt_status { RT_STATUS_RESOURCE } rt_status, *prt_status; -extern u32 cmpk_message_handle_rx(struct net_device *dev, - struct ieee80211_rx_stats *pstats); -extern rt_status SendTxCommandPacket(struct net_device *dev, - void *pData, u32 DataLen); +u32 cmpk_message_handle_rx(struct net_device *dev, + struct ieee80211_rx_stats *pstats); +rt_status SendTxCommandPacket(struct net_device *dev, + void *pData, u32 DataLen); #endif diff --git a/drivers/staging/rtl8192u/r819xU_phy.h b/drivers/staging/rtl8192u/r819xU_phy.h index 66cbe3f9cafd..e672126330f3 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.h +++ b/drivers/staging/rtl8192u/r819xU_phy.h @@ -57,36 +57,35 @@ typedef enum _RF90_RADIO_PATH { #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff -extern u8 rtl8192_phy_CheckIsLegalRFPath(struct net_device *dev, u32 eRFPath); -extern void rtl8192_setBBreg(struct net_device *dev, u32 reg_addr, - u32 bitmask, u32 data); -extern u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, - u32 bitmask); -extern void rtl8192_phy_SetRFReg(struct net_device *dev, - RF90_RADIO_PATH_E eRFPath, u32 reg_addr, u32 bitmask, u32 data); -extern u32 rtl8192_phy_QueryRFReg(struct net_device *dev, - RF90_RADIO_PATH_E eRFPath, u32 reg_addr, u32 bitmask); -extern void rtl8192_phy_configmac(struct net_device *dev); -extern void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType); -extern u8 rtl8192_phy_checkBBAndRF(struct net_device *dev, - HW90_BLOCK_E CheckBlock, RF90_RADIO_PATH_E eRFPath); -extern void rtl8192_BBConfig(struct net_device *dev); -extern void rtl8192_phy_getTxPower(struct net_device *dev); -extern void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel); -extern void rtl8192_phy_RFConfig(struct net_device *dev); -extern void rtl8192_phy_updateInitGain(struct net_device *dev); -extern u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev, - RF90_RADIO_PATH_E eRFPath); +u8 rtl8192_phy_CheckIsLegalRFPath(struct net_device *dev, u32 eRFPath); +void rtl8192_setBBreg(struct net_device *dev, u32 reg_addr, + u32 bitmask, u32 data); +u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, u32 bitmask); +void rtl8192_phy_SetRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, + u32 reg_addr, u32 bitmask, u32 data); +u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, + u32 reg_addr, u32 bitmask); +void rtl8192_phy_configmac(struct net_device *dev); +void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType); +u8 rtl8192_phy_checkBBAndRF(struct net_device *dev, + HW90_BLOCK_E CheckBlock, RF90_RADIO_PATH_E eRFPath); +void rtl8192_BBConfig(struct net_device *dev); +void rtl8192_phy_getTxPower(struct net_device *dev); +void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel); +void rtl8192_phy_RFConfig(struct net_device *dev); +void rtl8192_phy_updateInitGain(struct net_device *dev); +u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev, + RF90_RADIO_PATH_E eRFPath); -extern u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel); -extern void rtl8192_SetBWMode(struct net_device *dev, - HT_CHANNEL_WIDTH bandwidth, HT_EXTCHNL_OFFSET offset); -extern void rtl8192_SwChnl_WorkItem(struct net_device *dev); +u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel); +void rtl8192_SetBWMode(struct net_device *dev, HT_CHANNEL_WIDTH bandwidth, + HT_EXTCHNL_OFFSET offset); +void rtl8192_SwChnl_WorkItem(struct net_device *dev); void rtl8192_SetBWModeWorkItem(struct net_device *dev); -extern bool rtl8192_SetRFPowerState(struct net_device *dev, - RT_RF_POWER_STATE eRFPowerState); -extern void InitialGain819xUsb(struct net_device *dev, u8 Operation); +bool rtl8192_SetRFPowerState(struct net_device *dev, + RT_RF_POWER_STATE eRFPowerState); +void InitialGain819xUsb(struct net_device *dev, u8 Operation); -extern void InitialGainOperateWorkItemCallBack(struct work_struct *work); +void InitialGainOperateWorkItemCallBack(struct work_struct *work); #endif From 110a66be3a26fe05318121412e3c36f7f1e80a12 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Mon, 10 Aug 2015 18:34:10 -0400 Subject: [PATCH 864/912] drivers: staging: unisys: add MODULE_DEVICE_TABLE and temporary MODULE_ALIAS lines to visornic This patch adds an module alias and a MODULE_DEVICE_TABLE to autoload the visornic driver when an appropriate device is created by the visorbus. Note, the correct way of fixing this is adding functionality to scripts/mod/file2alias.c for the visorbus bus type. Signed-off-by: Prarit Bhargava Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 63d90f599158..8c9da7ea7845 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -71,6 +71,15 @@ static struct visor_channeltype_descriptor visornic_channel_types[] = { { SPAR_VNIC_CHANNEL_PROTOCOL_UUID, "ultravnic" }, { NULL_UUID_LE, NULL } }; +MODULE_DEVICE_TABLE(visorbus, visornic_channel_types); +/* + * FIXME XXX: This next line of code must be fixed and removed before + * acceptance into the 'normal' part of the kernel. It is only here as a place + * holder to get module autoloading functionality working for visorbus. Code + * must be added to scripts/mode/file2alias.c, etc., to get this working + * properly. + */ +MODULE_ALIAS("visorbus:" SPAR_VNIC_CHANNEL_PROTOCOL_UUID_STR); /* This is used to tell the visor bus driver which types of visor devices * we support, and what functions to call when a visor device that we support From cf7281c9ae9a5f0435630f8e972bb4c6204565bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Tue, 11 Aug 2015 14:07:00 +0200 Subject: [PATCH 865/912] staging: unisys: make visorbus_dev_groups static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit visorbus_dev_groups is not referenced outside visorbus_main.c, so it can be declared static. Found using sparse. Signed-off-by: Michał Kępień Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index ac39febdac55..2309f5f2b238 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -96,7 +96,7 @@ static const struct attribute_group visorbus_dev_group = { .attrs = visorbus_dev_attrs, }; -const struct attribute_group *visorbus_dev_groups[] = { +static const struct attribute_group *visorbus_dev_groups[] = { &visorbus_dev_group, NULL, }; From d5f0a90e60643fa63fffa88828c5552f3902a5bf Mon Sep 17 00:00:00 2001 From: Junsu Shin Date: Tue, 11 Aug 2015 15:02:07 -0500 Subject: [PATCH 866/912] staging: vme: devices: remove multiple blank lines This is a patch to vm2_pio2_core.c that removes multiple blanks lines. Signed-off-by: Junsu Shin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_core.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index eabbcc710a20..05b90674b2bc 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -24,7 +24,6 @@ #include "vme_pio2.h" - static const char driver_name[] = "pio2"; static int bus[PIO2_CARDS_MAX]; @@ -118,7 +117,6 @@ static void pio2_int(int level, int vector, void *ptr) } } - /* * We return whether this has been successful - this is used in the probe to * ensure we have a valid card. @@ -158,7 +156,6 @@ static struct vme_driver pio2_driver = { .remove = pio2_remove, }; - static int __init pio2_init(void) { if (bus_num == 0) { @@ -481,7 +478,6 @@ static void __exit pio2_exit(void) vme_unregister_driver(&pio2_driver); } - /* These are required for each board */ MODULE_PARM_DESC(bus, "Enumeration of VMEbus to which the board is connected"); module_param_array(bus, int, &bus_num, S_IRUGO); From 6c37e7445700fd49a0b86db86b5f2c20bc963fd5 Mon Sep 17 00:00:00 2001 From: Junsu Shin Date: Tue, 11 Aug 2015 16:36:05 -0500 Subject: [PATCH 867/912] staging: vme: devices: remove blank line after open brace This is a patch to the vme_pio2_core.c that removes blank line after open brace '{'. Signed-off-by: Junsu Shin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 05b90674b2bc..767b2efb3f1c 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -175,7 +175,6 @@ static int __init pio2_init(void) static int pio2_match(struct vme_dev *vdev) { - if (vdev->num >= bus_num) { dev_err(&vdev->dev, "The enumeration of the VMEbus to which the board is connected must be specified\n"); @@ -231,7 +230,6 @@ static int pio2_probe(struct vme_dev *vdev) card->vdev = vdev; for (i = 0; i < PIO2_VARIANT_LENGTH; i++) { - if (isdigit(card->variant[i]) == 0) { dev_err(&card->vdev->dev, "Variant invalid\n"); retval = -EINVAL; From a8f401f9e751eb5d1f6e9f66e45c84e390bc75bb Mon Sep 17 00:00:00 2001 From: Junsu Shin Date: Tue, 11 Aug 2015 17:07:14 -0500 Subject: [PATCH 868/912] staging: vme: devices: fix NULL comparison style This is a patch to vme_pio2_core.c that fixes up the NULL comparison style. Signed-off-by: Junsu Shin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 767b2efb3f1c..934115477f98 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -216,7 +216,7 @@ static int pio2_probe(struct vme_dev *vdev) int vec; card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL); - if (card == NULL) { + if (!card) { retval = -ENOMEM; goto err_struct; } @@ -281,7 +281,7 @@ static int pio2_probe(struct vme_dev *vdev) /* Get a master window and position over regs */ card->window = vme_master_request(vdev, VME_A24, VME_SCT, VME_D16); - if (card->window == NULL) { + if (!card->window) { dev_err(&card->vdev->dev, "Unable to assign VME master resource\n"); retval = -EIO; From bda9e24909b58c90adb4dd03663d250a5c872fb8 Mon Sep 17 00:00:00 2001 From: Junsu Shin Date: Tue, 11 Aug 2015 17:44:56 -0500 Subject: [PATCH 869/912] staging: vme: devices: add spaces around '-' This is a patch to the vme_pio2_core.c that adds spaces around '-'. Signed-off-by: Junsu Shin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 934115477f98..35c6ce5047de 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -259,22 +259,22 @@ static int pio2_probe(struct vme_dev *vdev) for (i = 1; i < PIO2_VARIANT_LENGTH; i++) { switch (card->variant[i]) { case '0': - card->bank[i-1].config = NOFIT; + card->bank[i - 1].config = NOFIT; break; case '1': case '2': case '3': case '4': - card->bank[i-1].config = INPUT; + card->bank[i - 1].config = INPUT; break; case '5': - card->bank[i-1].config = OUTPUT; + card->bank[i - 1].config = OUTPUT; break; case '6': case '7': case '8': case '9': - card->bank[i-1].config = BOTH; + card->bank[i - 1].config = BOTH; break; } } From 435009bba4d0449b611bc24ae5c9636ac5b2a00e Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 12 Aug 2015 21:54:49 +0200 Subject: [PATCH 870/912] staging: rtl8192e: Fix log spamming in rtl8192_hard_data_xmit This patch fixes issue generated by commit ca93dcba3a92 ("staging: rtl8192e: Remove assert() macro") One negation was missed in conversion, therefore asserted message was always printed. For 1MB file downloaded via http, ~500 messages were generated. Signed-off-by: Mateusz Kulikowski Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index c868cb373a4b..d6b46dfd01e1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1642,8 +1642,8 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, return; } - if (queue_index != TXCMD_QUEUE) - netdev_warn(dev, "%s(): queue index != TXCMD_QUEUE\n", + if (queue_index == TXCMD_QUEUE) + netdev_warn(dev, "%s(): queue index == TXCMD_QUEUE\n", __func__); memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); From 5a447f4c732e1eca3232effb354e1b18ae38215d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Fri, 14 Aug 2015 13:08:32 -0400 Subject: [PATCH 871/912] Staging: gdm72xx: usb_ids: fix a macro coding style error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a macro with complex value coding style error. Signed-off-by: Raphaël Beamonte Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/usb_ids.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/gdm72xx/usb_ids.h b/drivers/staging/gdm72xx/usb_ids.h index 8ce544de7342..7afb9ba5fdba 100644 --- a/drivers/staging/gdm72xx/usb_ids.h +++ b/drivers/staging/gdm72xx/usb_ids.h @@ -32,7 +32,9 @@ #define BL_PID_MASK 0xffc0 #define USB_DEVICE_BOOTLOADER(vid, pid) \ - {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)}, \ + {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)} + +#define USB_DEVICE_BOOTLOADER_DRV(vid, pid) \ {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD|B_DIFF_DL_DRV)} #define USB_DEVICE_CDC_DATA(vid, pid) \ @@ -40,6 +42,7 @@ static const struct usb_device_id id_table[] = { USB_DEVICE_BOOTLOADER(GCT_VID, GCT_PID1), + USB_DEVICE_BOOTLOADER_DRV(GCT_VID, GCT_PID1), USB_DEVICE_CDC_DATA(GCT_VID, GCT_PID1), USB_DEVICE_CDC_DATA(GCT_VID, GCT_PID1+0x1), USB_DEVICE_CDC_DATA(GCT_VID, GCT_PID1+0x2), @@ -58,6 +61,7 @@ static const struct usb_device_id id_table[] = { USB_DEVICE_CDC_DATA(GCT_VID, GCT_PID1+0xf), USB_DEVICE_BOOTLOADER(GCT_VID, GCT_PID2), + USB_DEVICE_BOOTLOADER_DRV(GCT_VID, GCT_PID2), USB_DEVICE_CDC_DATA(GCT_VID, GCT_PID2), USB_DEVICE_CDC_DATA(GCT_VID, GCT_PID2+0x1), USB_DEVICE_CDC_DATA(GCT_VID, GCT_PID2+0x2), From 96ac283d6490932ff5097259c18a4d03bdddb010 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Tue, 11 Aug 2015 10:32:39 +0900 Subject: [PATCH 872/912] staging: wilc1000: wilc_memory.h: remove unused define Remove unused define macro that is never used. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_memory.h | 51 -------------------------- 1 file changed, 51 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h index 372d7053e873..e3be5674db38 100644 --- a/drivers/staging/wilc1000/wilc_memory.h +++ b/drivers/staging/wilc1000/wilc_memory.h @@ -126,19 +126,7 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, (WILC_MemoryAlloc( \ (__size__), __attrs__, NULL, 0)) -/*! - * @brief standrad calloc wrapper with custom attributes - */ - #define WILC_CALLOC_EX(__size__, __attrs__) \ - (WILC_MemoryCalloc( \ - (__size__), __attrs__, NULL, 0)) -/*! - * @brief standrad realloc wrapper with custom attributes - */ - #define WILC_REALLOC_EX(__ptr__, __new_size__, __attrs__) \ - (WILC_MemoryRealloc( \ - (__ptr__), (__new_size__), __attrs__, NULL, 0)) /*! * @brief standrad free wrapper with custom attributes */ @@ -154,24 +142,7 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, ((__struct_type__ *)WILC_MALLOC_EX( \ sizeof(__struct_type__) * (u32)(__n_structs__), __attrs__)) -/*! - * @brief Allocates a block (with custom attributes) of given type and number of - * elements and Zero-fills it - */ -#define WILC_NEW_0_EX(__struct_type__, __n_structs__, __attrs__) \ - ((__struct_type__ *)WILC_CALLOC_EX( \ - sizeof(__struct_type__) * (u32)(__n_structs__), __attrs__)) -/*! - * @brief Frees a block (with custom attributes), also setting the original pointer - * to NULL - */ -#define WILC_FREE_SET_NULL_EX(__ptr__, __attrs__) do { \ - if (__ptr__ != NULL) { \ - WILC_FREE_EX(__ptr__, __attrs__); \ - __ptr__ = NULL; \ - } \ -} while (0) /*! * @brief Frees a block (with custom attributes) if the pointer expression evaluates @@ -189,17 +160,7 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, #define WILC_MALLOC(__size__) \ WILC_MALLOC_EX(__size__, NULL) -/*! - * @brief standrad calloc wrapper with default attributes - */ -#define WILC_CALLOC(__size__) \ - WILC_CALLOC_EX(__size__, NULL) -/*! - * @brief standrad realloc wrapper with default attributes - */ -#define WILC_REALLOC(__ptr__, __new_size__) \ - WILC_REALLOC_EX(__ptr__, __new_size__, NULL) /*! * @brief standrad free wrapper with default attributes @@ -214,19 +175,7 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, #define WILC_NEW(__struct_type__, __n_structs__) \ WILC_NEW_EX(__struct_type__, __n_structs__, NULL) -/*! - * @brief Allocates a block (with default attributes) of given type and number of - * elements and Zero-fills it - */ -#define WILC_NEW_0(__struct_type__, __n_structs__) \ - WILC_NEW_O_EX(__struct_type__, __n_structs__, NULL) -/*! - * @brief Frees a block (with default attributes), also setting the original pointer - * to NULL - */ -#define WILC_FREE_SET_NULL(__ptr__) \ - WILC_FREE_SET_NULL_EX(__ptr__, NULL) /*! * @brief Frees a block (with default attributes) if the pointer expression evaluates From 9b45891aef5904c2a1e76881f3b44fe646d84b54 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Tue, 11 Aug 2015 10:32:40 +0900 Subject: [PATCH 873/912] staging: wilc1000: remove unused memory functions This patch remove unused memory functions because some macros with this memory function are deleted. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_memory.c | 28 --------------- drivers/staging/wilc1000/wilc_memory.h | 50 -------------------------- 2 files changed, 78 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_memory.c b/drivers/staging/wilc1000/wilc_memory.c index 34ef13e8e243..53ba1d01632d 100644 --- a/drivers/staging/wilc1000/wilc_memory.c +++ b/drivers/staging/wilc1000/wilc_memory.c @@ -15,35 +15,7 @@ void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, return NULL; } -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void *WILC_MemoryCalloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, - char *pcFileName, u32 u32LineNo) -{ - return kcalloc(u32Size, 1, GFP_KERNEL); -} -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void *WILC_MemoryRealloc(void *pvOldBlock, u32 u32NewSize, - tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo) -{ - if (u32NewSize == 0) { - kfree(pvOldBlock); - return NULL; - } else if (pvOldBlock == NULL) { - return kmalloc(u32NewSize, GFP_KERNEL); - } else { - return krealloc(pvOldBlock, u32NewSize, GFP_KERNEL); - } - -} /*! * @author syounan diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h index e3be5674db38..1c0cb82218a7 100644 --- a/drivers/staging/wilc1000/wilc_memory.h +++ b/drivers/staging/wilc1000/wilc_memory.h @@ -47,57 +47,7 @@ typedef struct { void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo); -/*! - * @brief Allocates a given size of bytes and zero filling it - * @param[in] u32Size size of memory in bytes to be allocated - * @param[in] strAttrs Optional attributes, NULL for default - * if not NULL, pAllocationPool should point to the pool to use for - * this allocation. if NULL memory will be allocated directly from - * the system - * @param[in] pcFileName file name of the calling code for debugging - * @param[in] u32LineNo line number of the calling code for debugging - * @return The new allocated block, NULL if allocation fails - * @note It is recommended to use of of the wrapper macros instead of - * calling this function directly - * @sa sttrWILC_MemoryAttrs - * @sa WILC_CALLOC - * @sa WILC_CALLOC_EX - * @sa WILC_NEW_0 - * @sa WILC_NEW_0_EX - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -void *WILC_MemoryCalloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, - char *pcFileName, u32 u32LineNo); -/*! - * @brief Reallocates a given block to a new size - * @param[in] pvOldBlock the old memory block, if NULL then this function - * behaves as a new allocation function - * @param[in] u32NewSize size of the new memory block in bytes, if zero then - * this function behaves as a free function - * @param[in] strAttrs Optional attributes, NULL for default - * if pAllocationPool!=NULL and pvOldBlock==NULL, pAllocationPool - * should point to the pool to use for this allocation. - * if pAllocationPool==NULL and pvOldBlock==NULL memory will be - * allocated directly from the system - * if and pvOldBlock!=NULL, pAllocationPool will not be inspected - * and reallocation is done from the same pool as the original block - * @param[in] pcFileName file name of the calling code for debugging - * @param[in] u32LineNo line number of the calling code for debugging - * @return The new allocated block, possibly same as pvOldBlock - * @note It is recommended to use of of the wrapper macros instead of - * calling this function directly - * @sa sttrWILC_MemoryAttrs - * @sa WILC_REALLOC - * @sa WILC_REALLOC_EX - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -void *WILC_MemoryRealloc(void *pvOldBlock, u32 u32NewSize, - tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo); /*! * @brief Frees given block From 49188af27211b218fffacb26df5e96bf4b7e616c Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Tue, 11 Aug 2015 10:32:41 +0900 Subject: [PATCH 874/912] staging: wilc1000: use kfree instead of WILC_FREE Use kfree instead of WILC_FREE. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 12 +- drivers/staging/wilc1000/host_interface.c | 112 +++++++++--------- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_msgqueue.c | 10 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 36 +++--- 5 files changed, 86 insertions(+), 86 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 5bb1b1550f98..ef7f3b40f96d 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -891,13 +891,13 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo) if (pstrNetworkInfo != NULL) { if (pstrNetworkInfo->pu8IEs != NULL) { - WILC_FREE(pstrNetworkInfo->pu8IEs); + kfree(pstrNetworkInfo->pu8IEs); pstrNetworkInfo->pu8IEs = NULL; } else { s32Error = WILC_FAIL; } - WILC_FREE(pstrNetworkInfo); + kfree(pstrNetworkInfo); pstrNetworkInfo = NULL; } else { @@ -976,13 +976,13 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo) if (pstrConnectRespInfo != NULL) { if (pstrConnectRespInfo->pu8RespIEs != NULL) { - WILC_FREE(pstrConnectRespInfo->pu8RespIEs); + kfree(pstrConnectRespInfo->pu8RespIEs); pstrConnectRespInfo->pu8RespIEs = NULL; } else { s32Error = WILC_FAIL; } - WILC_FREE(pstrConnectRespInfo); + kfree(pstrConnectRespInfo); pstrConnectRespInfo = NULL; } else { @@ -1056,7 +1056,7 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults) s32 s32Error = WILC_SUCCESS; if (pstrSurveyResults != NULL) { - WILC_FREE(pstrSurveyResults); + kfree(pstrSurveyResults); } return s32Error; @@ -1958,7 +1958,7 @@ s32 CoreConfiguratorDeInit(void) if (gps8ConfigPacket != NULL) { - WILC_FREE(gps8ConfigPacket); + kfree(gps8ConfigPacket); gps8ConfigPacket = NULL; } diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dedba7fe998c..6d19d8256209 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -798,7 +798,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); /*get the value by searching the local copy*/ - WILC_FREE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, gs8SetIP[idx], idx); @@ -862,7 +862,7 @@ static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrH { } - WILC_FREE(mac_buf); + kfree(mac_buf); return s32Error; } @@ -1373,28 +1373,28 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { - WILC_FREE(pstrHostIFscanAttr->pu8ChnlFreqList); + kfree(pstrHostIFscanAttr->pu8ChnlFreqList); pstrHostIFscanAttr->pu8ChnlFreqList = NULL; } /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ if (pstrHostIFscanAttr->pu8IEs != NULL) { - WILC_FREE(pstrHostIFscanAttr->pu8IEs); + kfree(pstrHostIFscanAttr->pu8IEs); pstrHostIFscanAttr->pu8IEs = NULL; } if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { - WILC_FREE(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); + kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; } /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { - WILC_FREE(pstrHostIFscanAttr->pu8ChnlFreqList); + kfree(pstrHostIFscanAttr->pu8ChnlFreqList); pstrHostIFscanAttr->pu8ChnlFreqList = NULL; } if (pu8HdnNtwrksWidVal != NULL) - WILC_FREE(pu8HdnNtwrksWidVal); + kfree(pu8HdnNtwrksWidVal); return s32Error; } @@ -1993,7 +1993,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; /* Deallocation */ if (strConnectInfo.pu8ReqIEs != NULL) { - WILC_FREE(strConnectInfo.pu8ReqIEs); + kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; } @@ -2005,24 +2005,24 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ if (pstrHostIFconnectAttr->pu8bssid != NULL) { - WILC_FREE(pstrHostIFconnectAttr->pu8bssid); + kfree(pstrHostIFconnectAttr->pu8bssid); pstrHostIFconnectAttr->pu8bssid = NULL; } /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ if (pstrHostIFconnectAttr->pu8ssid != NULL) { - WILC_FREE(pstrHostIFconnectAttr->pu8ssid); + kfree(pstrHostIFconnectAttr->pu8ssid); pstrHostIFconnectAttr->pu8ssid = NULL; } /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ if (pstrHostIFconnectAttr->pu8IEs != NULL) { - WILC_FREE(pstrHostIFconnectAttr->pu8IEs); + kfree(pstrHostIFconnectAttr->pu8IEs); pstrHostIFconnectAttr->pu8IEs = NULL; } if (pu8CurrByte != NULL) - WILC_FREE(pu8CurrByte); + kfree(pu8CurrByte); return s32Error; } @@ -2150,7 +2150,7 @@ static s32 Handle_ConnectTimeout(void *drvHandler) /* Deallocation of strConnectInfo.pu8ReqIEs */ if (strConnectInfo.pu8ReqIEs != NULL) { - WILC_FREE(strConnectInfo.pu8ReqIEs); + kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; } } else { @@ -2173,18 +2173,18 @@ static s32 Handle_ConnectTimeout(void *drvHandler) /* Deallocation of the Saved Connect Request in the global Handle */ pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; } if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } @@ -2192,11 +2192,11 @@ static s32 Handle_ConnectTimeout(void *drvHandler) /*BugID_5213*/ /*Freeing flushed join request params on connect timeout*/ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedJoinReq); + kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedInfoElemAsoc); + kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -2312,7 +2312,7 @@ static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdN done: /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { - WILC_FREE(pstrRcvdNetworkInfo->pu8Buffer); + kfree(pstrRcvdNetworkInfo->pu8Buffer); pstrRcvdNetworkInfo->pu8Buffer = NULL; } @@ -2520,30 +2520,30 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* Deallocation */ if (strConnectInfo.pu8RespIEs != NULL) { - WILC_FREE(strConnectInfo.pu8RespIEs); + kfree(strConnectInfo.pu8RespIEs); strConnectInfo.pu8RespIEs = NULL; } if (strConnectInfo.pu8ReqIEs != NULL) { - WILC_FREE(strConnectInfo.pu8ReqIEs); + kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; } if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } @@ -2591,25 +2591,25 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* * if(strDisconnectNotifInfo.ie != NULL) * { - * WILC_FREE(strDisconnectNotifInfo.ie); + * kfree(strDisconnectNotifInfo.ie); * strDisconnectNotifInfo.ie = NULL; * } */ pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; } if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } @@ -2617,11 +2617,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /*Freeing flushed join request params on receiving*/ /*MAC_DISCONNECTED while connected*/ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedJoinReq); + kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedInfoElemAsoc); + kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -2648,7 +2648,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { - WILC_FREE(pstrRcvdGnrlAsyncInfo->pu8Buffer); + kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; } @@ -2717,7 +2717,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; strWIDList[3].enuWIDtype = WID_STR; @@ -2726,7 +2726,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); } @@ -2746,7 +2746,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; strWID.enuWIDtype = WID_STR; @@ -2754,7 +2754,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { PRINT_D(HOSTINF_DBG, "Removing key\n"); @@ -2822,7 +2822,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); /* ////////////////////////// */ up(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -2868,15 +2868,15 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); /* ////////////////////////// */ up(&(pstrWFIDrv->hSemTestKeyBlock)); /* ///////////////////////// */ } _WPARxGtk_end_case_: - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); if (ret == -1) return ret; @@ -2924,7 +2924,7 @@ _WPARxGtk_end_case_: strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); /* ////////////////////////// */ up(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -2965,7 +2965,7 @@ _WPARxGtk_end_case_: strWID.s32ValueSize = PTK_KEY_MSG_LEN; s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); /* ////////////////////////// */ up(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -2973,7 +2973,7 @@ _WPARxGtk_end_case_: } _WPAPtk_end_case_: - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); if (ret == -1) return ret; @@ -3005,7 +3005,7 @@ _WPAPtk_end_case_: s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); break; } @@ -3099,29 +3099,29 @@ static void Handle_Disconnect(void *drvHandler) /* Deallocation */ pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; } if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } /*BugID_5137*/ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedJoinReq); + kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedInfoElemAsoc); + kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -4179,7 +4179,7 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); if (strWID.ps8WidVal != NULL) - WILC_FREE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); return s32Error; @@ -4247,7 +4247,7 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); if (strWID.ps8WidVal != NULL) - WILC_FREE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); /*BugID_5222*/ up(&hWaitResponse); @@ -4301,7 +4301,7 @@ static s32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessionInfo * if (strWID.ps8WidVal != NULL) - WILC_FREE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); /*BugID_5222*/ up(&hWaitResponse); @@ -6617,7 +6617,7 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) _fail_mem_: if (pstrWFIDrv != NULL) - WILC_FREE(pstrWFIDrv); + kfree(pstrWFIDrv); #ifdef WILC_P2P _fail_timer_3: WILC_TimerDestroy(&(pstrWFIDrv->hRemainOnChannel), NULL); @@ -6743,7 +6743,7 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) u32Intialized = 0; /* gWFiDrvHandle = NULL; */ if (pstrWFIDrv != NULL) { - WILC_FREE(pstrWFIDrv); + kfree(pstrWFIDrv); /* pstrWFIDrv=NULL; */ } @@ -7124,10 +7124,10 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, WILC_CATCH(s32Error) { if (pstrSetBeaconParam->pu8Head != NULL) - WILC_FREE(pstrSetBeaconParam->pu8Head); + kfree(pstrSetBeaconParam->pu8Head); if (pstrSetBeaconParam->pu8Tail != NULL) - WILC_FREE(pstrSetBeaconParam->pu8Tail); + kfree(pstrSetBeaconParam->pu8Tail); } return s32Error; @@ -7660,7 +7660,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) void host_int_freeJoinParams(void *pJoinParams) { if ((tstrJoinBssParam *)pJoinParams != NULL) - WILC_FREE((tstrJoinBssParam *)pJoinParams); + kfree((tstrJoinBssParam *)pJoinParams); else PRINT_ER("Unable to FREE null pointer\n"); } diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index e295e4ccad11..0ba5c59e82c3 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2660,7 +2660,7 @@ static void __exit exit_wilc_driver(void) linux_wlan_deinit_lock(&close_exit_sync); if (g_linux_wlan != NULL) { - WILC_FREE(g_linux_wlan); + kfree(g_linux_wlan); g_linux_wlan = NULL; } printk("Module_exit Done.\n"); diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index 2b083525af47..81f584da0023 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -39,7 +39,7 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, while (pHandle->pstrMessageList != NULL) { Message *pstrMessge = pHandle->pstrMessageList->pstrNext; - WILC_FREE(pHandle->pstrMessageList); + kfree(pHandle->pstrMessageList); pHandle->pstrMessageList = pstrMessge; } @@ -100,9 +100,9 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, /* error occured, free any allocations */ if (pstrMessage != NULL) { if (pstrMessage->pvBuffer != NULL) { - WILC_FREE(pstrMessage->pvBuffer); + kfree(pstrMessage->pvBuffer); } - WILC_FREE(pstrMessage); + kfree(pstrMessage); } } @@ -175,8 +175,8 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, pHandle->pstrMessageList = pstrMessage->pstrNext; - WILC_FREE(pstrMessage->pvBuffer); - WILC_FREE(pstrMessage); + kfree(pstrMessage->pvBuffer); + kfree(pstrMessage); spin_unlock_irqrestore(&pHandle->strCriticalSection, flags); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 99d859dd6177..fa780424c8ef 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -150,7 +150,7 @@ void clear_shadow_scan(void *pUserVoid) for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { if (astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs != NULL) { - WILC_FREE(astrLastScannedNtwrksShadow[i].pu8IEs); + kfree(astrLastScannedNtwrksShadow[i].pu8IEs); astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs = NULL; } @@ -242,7 +242,7 @@ void remove_network_from_shadow(void *pUserVoid) PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", astrLastScannedNtwrksShadow[i].au8ssid); if (astrLastScannedNtwrksShadow[i].pu8IEs != NULL) { - WILC_FREE(astrLastScannedNtwrksShadow[i].pu8IEs); + kfree(astrLastScannedNtwrksShadow[i].pu8IEs); astrLastScannedNtwrksShadow[i].pu8IEs = NULL; } @@ -334,7 +334,7 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo astrLastScannedNtwrksShadow[ap_index].u16IEsLen = pstrNetworkInfo->u16IEsLen; astrLastScannedNtwrksShadow[ap_index].u64Tsf = pstrNetworkInfo->u64Tsf; if (ap_found != -1) - WILC_FREE(astrLastScannedNtwrksShadow[ap_index].pu8IEs); + kfree(astrLastScannedNtwrksShadow[ap_index].pu8IEs); astrLastScannedNtwrksShadow[ap_index].pu8IEs = (u8 *)WILC_MALLOC(pstrNetworkInfo->u16IEsLen); /* will be deallocated by the WILC_WFI_CfgScan() function */ memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs, @@ -1219,14 +1219,14 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k } /* if there has been previous allocation for the same index through its key, free that memory and allocate again*/ if (priv->wilc_gtk[key_index]->key) - WILC_FREE(priv->wilc_gtk[key_index]->key); + kfree(priv->wilc_gtk[key_index]->key); priv->wilc_gtk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len); memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len); /* if there has been previous allocation for the same index through its seq, free that memory and allocate again*/ if (priv->wilc_gtk[key_index]->seq) - WILC_FREE(priv->wilc_gtk[key_index]->seq); + kfree(priv->wilc_gtk[key_index]->seq); if ((params->seq_len) > 0) { priv->wilc_gtk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len); @@ -1265,12 +1265,12 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k } if (priv->wilc_ptk[key_index]->key) - WILC_FREE(priv->wilc_ptk[key_index]->key); + kfree(priv->wilc_ptk[key_index]->key); priv->wilc_ptk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len); if (priv->wilc_ptk[key_index]->seq) - WILC_FREE(priv->wilc_ptk[key_index]->seq); + kfree(priv->wilc_ptk[key_index]->seq); if ((params->seq_len) > 0) priv->wilc_ptk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len); @@ -1422,7 +1422,7 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev, /*Delete saved WEP keys params, if any*/ if (g_key_wep_params.key != NULL) { - WILC_FREE(g_key_wep_params.key); + kfree(g_key_wep_params.key); g_key_wep_params.key = NULL; } @@ -1433,16 +1433,16 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev, if (priv->wilc_gtk[key_index]->key != NULL) { - WILC_FREE(priv->wilc_gtk[key_index]->key); + kfree(priv->wilc_gtk[key_index]->key); priv->wilc_gtk[key_index]->key = NULL; } if (priv->wilc_gtk[key_index]->seq) { - WILC_FREE(priv->wilc_gtk[key_index]->seq); + kfree(priv->wilc_gtk[key_index]->seq); priv->wilc_gtk[key_index]->seq = NULL; } - WILC_FREE(priv->wilc_gtk[key_index]); + kfree(priv->wilc_gtk[key_index]); priv->wilc_gtk[key_index] = NULL; } @@ -1451,35 +1451,35 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev, if (priv->wilc_ptk[key_index]->key) { - WILC_FREE(priv->wilc_ptk[key_index]->key); + kfree(priv->wilc_ptk[key_index]->key); priv->wilc_ptk[key_index]->key = NULL; } if (priv->wilc_ptk[key_index]->seq) { - WILC_FREE(priv->wilc_ptk[key_index]->seq); + kfree(priv->wilc_ptk[key_index]->seq); priv->wilc_ptk[key_index]->seq = NULL; } - WILC_FREE(priv->wilc_ptk[key_index]); + kfree(priv->wilc_ptk[key_index]); priv->wilc_ptk[key_index] = NULL; } #endif /*Delete saved PTK and GTK keys params, if any*/ if (g_key_ptk_params.key != NULL) { - WILC_FREE(g_key_ptk_params.key); + kfree(g_key_ptk_params.key); g_key_ptk_params.key = NULL; } if (g_key_ptk_params.seq != NULL) { - WILC_FREE(g_key_ptk_params.seq); + kfree(g_key_ptk_params.seq); g_key_ptk_params.seq = NULL; } if (g_key_gtk_params.key != NULL) { - WILC_FREE(g_key_gtk_params.key); + kfree(g_key_gtk_params.key); g_key_gtk_params.key = NULL; } if (g_key_gtk_params.seq != NULL) { - WILC_FREE(g_key_gtk_params.seq); + kfree(g_key_gtk_params.seq); g_key_gtk_params.seq = NULL; } From 598f85bfaeeaac0272c8e79f314076e48d445bcf Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Tue, 11 Aug 2015 10:32:42 +0900 Subject: [PATCH 875/912] staging: wilc1000: remove WILC_FREE Remove WILC_FREE that is replaced by kfree. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_memory.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h index 1c0cb82218a7..5ec4ef303c9c 100644 --- a/drivers/staging/wilc1000/wilc_memory.h +++ b/drivers/staging/wilc1000/wilc_memory.h @@ -112,11 +112,6 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, -/*! - * @brief standrad free wrapper with default attributes - */ -#define WILC_FREE(__ptr__) \ - WILC_FREE_EX(__ptr__, NULL) /*! * @brief Allocates a block (with default attributes) of given type and number of From 218dc407d4b275a6f96311ff8c4b70dd998fcf24 Mon Sep 17 00:00:00 2001 From: Johnny Kim Date: Thu, 13 Aug 2015 13:41:19 +0900 Subject: [PATCH 876/912] staging: wilc1000: replace WILC_WFIDrvHandle by tstrWILC_WFIDrv The structure, WILC_WFIDrvHandle is used to save the pointer address for the driver handler which is used throughout the driver but it's not easy to understand what it means. In addition, it doesn't support the 64 bit machine and also causes the warnings for the 64 bit build. This patch replaces the WILC_WFIDrvHandle by the tstrWILC_WFIDrv because the tstrWILC_WFIDrv is real structure to represent the driver handler and reduces the 64 bit compile warnings. Also, typecasting to WILC_WFIDrvHandle is not needed by using tstrWILC_WFIDrv as is. Signed-off-by: Johnny Kim Signed-off-by: Tony Cho Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 126 +++++++++--------- drivers/staging/wilc1000/host_interface.h | 104 +++++++-------- drivers/staging/wilc1000/linux_wlan.c | 16 +-- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 22 +-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 +- 5 files changed, 136 insertions(+), 136 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6d19d8256209..11b1cf704b50 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -751,7 +751,7 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) - host_int_get_ipaddress((WILC_WFIDrvHandle)drvHandler, firmwareIPAddress, idx); + host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx); if (s32Error) { PRINT_D(HOSTINF_DBG, "Failed to set IP address\n"); @@ -801,7 +801,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) kfree(strWID.ps8WidVal); if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) - host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, gs8SetIP[idx], idx); + host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx); if (s32Error != WILC_SUCCESS) { PRINT_ER("Failed to get IP address\n"); @@ -1497,7 +1497,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(HOSTINF_DBG, "Getting site survey results\n"); - s32Err = host_int_get_site_survey_results((WILC_WFIDrvHandle)pstrWFIDrv, + s32Err = host_int_get_site_survey_results(pstrWFIDrv, gapu8RcvdSurveyResults, MAX_SURVEY_RESULT_FRAG_SIZE); if (s32Err) { @@ -2402,7 +2402,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst if (u8MacStatus == MAC_CONNECTED) { memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); - host_int_get_assoc_res_info((WILC_WFIDrvHandle)pstrWFIDrv, + host_int_get_assoc_res_info(pstrWFIDrv, gapu8RcvdAssocResp, MAX_ASSOC_RESP_FRAME_SIZE, &u32RcvdAssocRespInfoLen); @@ -2492,7 +2492,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(pstrWFIDrv, 0, 0); #endif PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); @@ -2568,7 +2568,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = false; - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(pstrWFIDrv, 0, 0); #endif pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, @@ -3047,7 +3047,7 @@ static void Handle_Disconnect(void *drvHandler) #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = false; - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(pstrWFIDrv, 0, 0); #endif memset(u8ConnectedSSID, 0, ETH_ALEN); @@ -3148,7 +3148,7 @@ void resolve_disconnect_aberration(void *drvHandler) return; if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); - host_int_disconnect((WILC_WFIDrvHandle)pstrWFIDrv, 1); + host_int_disconnect(pstrWFIDrv, 1); } } static s32 Switch_Log_Terminal(void *drvHandler) @@ -4582,7 +4582,7 @@ static void TimerCB_Connect(void *pvArg) * @version 1.0 */ /* Check implementation in core adding 9 bytes to the input! */ -s32 host_int_remove_key(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8StaAddress) +s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -4611,7 +4611,7 @@ s32 host_int_remove_key(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8StaAddress) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8keyIdx) +s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -4660,7 +4660,7 @@ s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8keyIdx) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index) +s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -4716,7 +4716,7 @@ s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx) +s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx) { s32 s32Error = WILC_SUCCESS; @@ -4781,7 +4781,7 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, * @date 28 FEB 2013 * @version 1.0 */ -s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type) +s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type) { s32 s32Error = WILC_SUCCESS; @@ -4856,7 +4856,7 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, +s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) { s32 s32Error = WILC_SUCCESS; @@ -4956,7 +4956,7 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, +s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) { @@ -5063,7 +5063,7 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) +s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -5125,7 +5125,7 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PmkidInfoArray, +s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, u32 u32PmkidInfoLen) { s32 s32Error = WILC_SUCCESS; @@ -5154,7 +5154,7 @@ s32 host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PmkidInfoArray, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassPhrase, +s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength) { s32 s32Error = WILC_SUCCESS; @@ -5181,7 +5181,7 @@ s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassP * @date 19 April 2012 * @version 1.0 */ -s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) +s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -5215,7 +5215,7 @@ s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) * @date 16 July 2012 * @version 1.0 */ -s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) +s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -5256,7 +5256,7 @@ s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, +s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength) { s32 s32Error = WILC_SUCCESS; @@ -5303,7 +5303,7 @@ s32 host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, * @version 1.0 */ #ifndef CONNECT_DIRECT -s32 host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv, +s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], u32 u32MaxSiteSrvyFragLen) { @@ -5353,7 +5353,7 @@ s32 host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 scanSource) +s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -5383,7 +5383,7 @@ s32 host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 scanSource) * @version 1.0 */ -s32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ScanSource) +s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -5408,7 +5408,7 @@ s32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ScanSource) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, +s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, tWILCpfConnectResult pfConnectResult, void *pvUserArg, @@ -5509,7 +5509,7 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, * @version 8.0 */ -s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv) +s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -5552,7 +5552,7 @@ s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode) +s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -5601,7 +5601,7 @@ s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv, u8 assoc_id) +s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -5641,7 +5641,7 @@ s32 host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv, u8 assoc_id) * @version 1.0 */ -s32 host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocReqInfo, +s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, u32 u32AssocReqInfoLen) { s32 s32Error = WILC_SUCCESS; @@ -5668,7 +5668,7 @@ s32 host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocReqInfo, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, +s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) { s32 s32Error = WILC_SUCCESS; @@ -5718,7 +5718,7 @@ s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv, u8 *pu8RxPowerLevel, +s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, u32 u32RxPowerLevelLen) { s32 s32Error = WILC_SUCCESS; @@ -5749,7 +5749,7 @@ s32 host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv, u8 *pu8RxPowerLevel, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum) +s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -5801,7 +5801,7 @@ s32 host_int_wait_msg_queue_idle(void) } -s32 host_int_set_wfi_drv_handler(u32 u32address) +s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) { s32 s32Error = WILC_SUCCESS; @@ -5828,7 +5828,7 @@ s32 host_int_set_wfi_drv_handler(u32 u32address) -s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode) +s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) { s32 s32Error = WILC_SUCCESS; @@ -5868,7 +5868,7 @@ s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo) +s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -5914,7 +5914,7 @@ s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr) +s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -5961,7 +5961,7 @@ s32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr) * @date * @version 1.0 */ -s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu32InactiveTime) +s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -6007,7 +6007,7 @@ s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu * @date 8 March 2012 * @version 1.0 */ -s32 host_int_test_get_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 *pu32TestMemAddr) +s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) { s32 s32Error = WILC_SUCCESS; @@ -6056,7 +6056,7 @@ s32 host_int_test_get_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 *pu32TestMemAddr) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv, s8 *ps8Rssi) +s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -6091,7 +6091,7 @@ s32 host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv, s8 *ps8Rssi) return s32Error; } -s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd) +s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) { tstrHostIFmsg strHostIFmsg; s32 s32Error = WILC_SUCCESS; @@ -6128,7 +6128,7 @@ s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd) return s32Error; } -s32 host_int_get_statistics(WILC_WFIDrvHandle hWFIDrv, tstrStatistics *pstrStatistics) +s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -6168,7 +6168,7 @@ s32 host_int_get_statistics(WILC_WFIDrvHandle hWFIDrv, tstrStatistics *pstrStati * @date 8 March 2012 * @version 1.0 */ -s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, +s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, size_t IEsLen, tWILCpfScanResult ScanResult, @@ -6241,7 +6241,7 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, * @date 8 March 2012 * @version 1.0 */ -s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) +s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) { s32 s32Error = WILC_SUCCESS; @@ -6282,7 +6282,7 @@ s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) * @date 8 March 2012 * @version 1.0 */ -s32 hif_get_cfg(WILC_WFIDrvHandle hWFIDrv, u16 u16WID, u16 *pu16WID_Value) +s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -6464,7 +6464,7 @@ static u32 u32Intialized; static u32 msgQ_created; static u32 clients_count; -s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) +s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv; @@ -6493,7 +6493,7 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) } memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); /*return driver handle to user*/ - *phWFIDrv = (WILC_WFIDrvHandle)pstrWFIDrv; + *phWFIDrv = pstrWFIDrv; /*save into globl handle*/ #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP @@ -6646,7 +6646,7 @@ _fail_: * @version 1.0 */ -s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) +s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -6696,7 +6696,7 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) WILC_TimerDestroy(&(pstrWFIDrv->hRemainOnChannel), NULL); #endif - host_int_set_wfi_drv_handler((u32)NULL); + host_int_set_wfi_drv_handler(NULL); down(&hSemDeinitDrvHandle); @@ -6936,7 +6936,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) * @date * @version 1.0 */ -s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg) +s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -6983,7 +6983,7 @@ s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 * @date * @version 1.0 */ -s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID) +s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7019,7 +7019,7 @@ s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID) * @author * @date * @version 1.0*/ -s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bReg) +s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7077,7 +7077,7 @@ s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bR * @date * @version 1.0 */ -s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, +s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail) @@ -7144,7 +7144,7 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, * @date * @version 1.0 */ -s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv) +s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7177,7 +7177,7 @@ s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv) * @date * @version 1.0 */ -s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) +s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7227,7 +7227,7 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt * @date * @version 1.0 */ -s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) +s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7271,7 +7271,7 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) * @date * @version 1.0 */ -s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) +s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7333,7 +7333,7 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] * @date * @version 1.0 */ -s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) +s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7372,7 +7372,7 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS #endif /*WILC_AP_EXTERNAL_MLME*/ uint32_t wilc_get_chipid(uint8_t); -s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout) +s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7406,7 +7406,7 @@ s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32T return s32Error; } -s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32count) +s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count) { s32 s32Error = WILC_SUCCESS; @@ -7710,7 +7710,7 @@ static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char T } -s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) +s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7743,7 +7743,7 @@ s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) return s32Error; } -s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) +s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7784,7 +7784,7 @@ s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char * @author Abdelrahman Sobhy * @date * @version 1.0*/ -s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) +s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7826,7 +7826,7 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) * @author Abdelrahman Sobhy * @date * @version 1.0*/ -s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) +s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index cdfb43a2b144..2d97e9f1f40b 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -432,7 +432,7 @@ typedef struct { * @date 8 March 2012 * @version 1.0 */ -s32 host_int_remove_key(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8StaAddress); +s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress); /** * @brief removes WEP key * @details valid only in BSS STA mode if External Supplicant support is enabled. @@ -447,7 +447,7 @@ s32 host_int_remove_key(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8StaAddress); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8Index); +s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index); /** * @brief sets WEP deafault key * @details Sets the index of the WEP encryption key in use, @@ -460,7 +460,7 @@ s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8Index); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index); +s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index); /** * @brief sets WEP deafault key @@ -481,7 +481,7 @@ s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx); +s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx); /** * @brief host_int_add_wep_key_bss_ap * @details valid only in AP mode if External Supplicant support is enabled. @@ -496,7 +496,7 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, * @date 28 Feb 2013 * @version 1.0 */ -s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type); +s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type); /** * @brief adds ptk Key @@ -514,7 +514,7 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, +s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); /** @@ -529,7 +529,7 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen * @date 15 April 2013 * @version 1.0 */ -s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); +s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); /** * @brief adds Rx GTk Key @@ -547,7 +547,7 @@ s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, +s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); @@ -568,7 +568,7 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_tx_gtk(WILC_WFIDrvHandle hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); +s32 host_int_add_tx_gtk(tstrWILC_WFIDrv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); /** * @brief caches the pmkid @@ -591,7 +591,7 @@ s32 host_int_add_tx_gtk(WILC_WFIDrvHandle hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 * @version 1.0 */ -s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray); +s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray); /** * @brief gets the cached the pmkid info * @details valid only in BSS STA mode if External Supplicant @@ -615,7 +615,7 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P * @version 1.0 */ -s32 host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PmkidInfoArray, +s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, u32 u32PmkidInfoLen); /** @@ -632,7 +632,7 @@ s32 host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PmkidInfoArray, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassPhrase, +s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength); /** * @brief gets the pass phrase @@ -648,7 +648,7 @@ s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassP * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, +s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength); /** @@ -662,7 +662,7 @@ s32 host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, * @date 19 April 2012 * @version 1.0 */ -s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress); +s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress); /** * @brief sets mac address @@ -675,7 +675,7 @@ s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress); * @date 16 July 2012 * @version 1.0 */ -s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress); +s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress); /** * @brief wait until msg q is empty @@ -720,7 +720,7 @@ s32 host_int_wait_msg_queue_idle(void); * @version 1.0 */ #ifndef CONNECT_DIRECT -s32 host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv, +s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], u32 u32MaxSiteSrvyFragLen); #endif @@ -741,7 +741,7 @@ s32 host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv, * @version 1.0 */ -s32 host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 scanSource); +s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource); /** * @brief gets scan source of the last scan * @details @@ -757,7 +757,7 @@ s32 host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 scanSource); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ScanSource); +s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource); /** * @brief sets a join request @@ -771,7 +771,7 @@ s32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ScanSource); * @version 1.0 */ -s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, +s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, tWILCpfConnectResult pfConnectResult, void *pvUserArg, @@ -791,7 +791,7 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, * @version 8.0 */ -s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv); +s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv); /** @@ -805,7 +805,7 @@ s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode); +s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode); /** * @brief disconnects a sta @@ -818,7 +818,7 @@ s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv, u8 assoc_id); +s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id); /** * @brief gets a Association request info * @details @@ -845,7 +845,7 @@ s32 host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv, u8 assoc_id); * @version 1.0 */ -s32 host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocReqInfo, +s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, u32 u32AssocReqInfoLen); /** * @brief gets a Association Response info @@ -859,7 +859,7 @@ s32 host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocReqInfo, * @version 1.0 */ -s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, +s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen); /** * @brief gets a Association Response info @@ -876,7 +876,7 @@ s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv, u8 *pu8RxPowerLevel, +s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, u32 u32RxPowerLevelLen); /** @@ -894,7 +894,7 @@ s32 host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv, u8 *pu8RxPowerLevel, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum); +s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum); /** * @brief gets the current channel index @@ -911,7 +911,7 @@ s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo); +s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo); /** * @brief gets the sta rssi * @details gets the currently maintained RSSI value for the station. @@ -925,8 +925,8 @@ s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv, s8 *ps8Rssi); -s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd); +s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi); +s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd); /** * @brief scans a set of channels * @details @@ -944,7 +944,7 @@ s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, +s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, size_t IEsLen, tWILCpfScanResult ScanResult, @@ -960,7 +960,7 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, * @date 8 March 2012 * @version 1.0 */ -s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal); +s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal); /** * @brief gets configuration wids values @@ -974,7 +974,7 @@ s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal); * @date 8 March 2012 * @version 1.0 */ -s32 hif_get_cfg(WILC_WFIDrvHandle hWFIDrv, u16 u16WID, u16 *pu16WID_Value); +s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value); /*****************************************************************************/ /* Notification Functions */ /*****************************************************************************/ @@ -1021,7 +1021,7 @@ void host_int_send_network_info_to_host * @date 8 March 2012 * @version 1.0 */ -s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv); +s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv); /** * @brief host interface initialization function @@ -1032,7 +1032,7 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv); +s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv); /*! @@ -1057,7 +1057,7 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv); * @version 1.0 Description * */ -s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, +s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8tail); @@ -1075,7 +1075,7 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, * @date 10 Julys 2012 * @version 1.0 Description */ -s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv); +s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv); /*! * @fn s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam strStaParams) @@ -1090,7 +1090,7 @@ s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv); * @date 12 July 2012 * @version 1.0 Description */ -s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams); +s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams); /*! * @fn s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr) @@ -1105,7 +1105,7 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt * @date 09 April 2014 * @version 1.0 Description */ -s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); +s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); /*! * @fn s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr) @@ -1120,7 +1120,7 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] * @date 15 July 2012 * @version 1.0 Description */ -s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr); +s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr); /*! * @fn s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam strStaParams) @@ -1135,7 +1135,7 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr); * @date 15 July 2012 * @version 1.0 Description */ -s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams); +s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams); /*! * @fn s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout) @@ -1152,7 +1152,7 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS * @date 24 November 2012 * @version 1.0 Description */ -s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout); +s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout); /* @param[in,out] hWFIDrv handle to the wifi driver * @param[in] bIsEnabled TRUE if enabled, FALSE otherwise * @param[in] u8count count of mac address entries in the filter table @@ -1164,7 +1164,7 @@ s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32T * @date 24 November 2012 * @version 1.0 Description */ -s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32count); +s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count); /** * @brief host_int_setup_ipaddress * @details set IP address on firmware @@ -1174,7 +1174,7 @@ s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, * @date * @version 1.0 */ -s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8IPAddr, u8 idx); +s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8IPAddr, u8 idx); /** @@ -1186,7 +1186,7 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8IPAddr, u8 idx); * @date * @version 1.0 */ -s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID); +s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID); /** * @brief host_int_delBASession @@ -1197,7 +1197,7 @@ s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID); * @date * @version 1.0 */ -s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID); +s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID); /** @@ -1209,7 +1209,7 @@ s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char * @date * @version 1.0 */ -s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8IPAddr, u8 idx); +s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8IPAddr, u8 idx); #ifdef WILC_P2P /** @@ -1221,7 +1221,7 @@ s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8IPAddr, u8 idx); * @date * @version 1.0 */ -s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg); +s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg); /** * @brief host_int_ListenStateExpired @@ -1237,7 +1237,7 @@ s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 * @date * @version 1.0 */ -s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID); +s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID); /** * @brief host_int_frame_register @@ -1248,7 +1248,7 @@ s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID); * @date * @version 1.0 */ -s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bReg); +s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg); #endif /** * @brief host_int_set_wfi_drv_handler @@ -1259,8 +1259,8 @@ s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bR * @date * @version 1.0 */ -s32 host_int_set_wfi_drv_handler(u32 u32address); -s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode); +s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address); +s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode); static s32 Handle_ScanDone(void *drvHandler, tenuScanEvent enuEvent); @@ -1270,7 +1270,7 @@ static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char T void host_int_freeJoinParams(void *pJoinParams); -s32 host_int_get_statistics(WILC_WFIDrvHandle hWFIDrv, tstrStatistics *pstrStatistics); +s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics); /*****************************************************************************/ /* */ diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 0ba5c59e82c3..f8ef8e295f11 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -291,13 +291,13 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } if (bEnablePS) - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 1, 0); + host_int_set_power_mgmt(pstrWFIDrv, 1, 0); PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label); pIP_Add_buff = (char *) (&(dev_iface->ifa_address)); PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); - host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); + host_int_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); break; @@ -311,7 +311,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0) - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(pstrWFIDrv, 0, 0); resolve_disconnect_aberration(pstrWFIDrv); @@ -320,7 +320,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event pIP_Add_buff = null_ip; PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); - host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); + host_int_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); break; @@ -2007,7 +2007,7 @@ int mac_open(struct net_device *ndev) for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) { if (ndev == g_linux_wlan->strInterfaceInfo[i].wilc_netdev) { memcpy(g_linux_wlan->strInterfaceInfo[i].aSrcAddress, mac_add, ETH_ALEN); - g_linux_wlan->strInterfaceInfo[i].drvHandler = (u32)priv->hWILCWFIDrv; + g_linux_wlan->strInterfaceInfo[i].drvHandler = priv->hWILCWFIDrv; break; } } @@ -2091,14 +2091,14 @@ static void wilc_set_multicast_list(struct net_device *dev) if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); /* get all multicast packets */ - host_int_setup_multicast_filter((WILC_WFIDrvHandle)pstrWFIDrv, false, 0); + host_int_setup_multicast_filter(pstrWFIDrv, false, 0); return; } /* No multicast? Just get our own stuff */ if ((dev->mc.count) == 0) { PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n"); - host_int_setup_multicast_filter((WILC_WFIDrvHandle)pstrWFIDrv, true, 0); + host_int_setup_multicast_filter(pstrWFIDrv, true, 0); return; } @@ -2111,7 +2111,7 @@ static void wilc_set_multicast_list(struct net_device *dev) i++; } - host_int_setup_multicast_filter((WILC_WFIDrvHandle)pstrWFIDrv, true, (dev->mc.count)); + host_int_setup_multicast_filter(pstrWFIDrv, true, (dev->mc.count)); return; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index fa780424c8ef..568c2a742d36 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -734,7 +734,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r priv->u32RcvdChCount = 0; - host_int_set_wfi_drv_handler((u32)priv->hWILCWFIDrv); + host_int_set_wfi_drv_handler(priv->hWILCWFIDrv); reset_shadow_found(priv); @@ -829,7 +829,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, priv = wiphy_priv(wiphy); pstrWFIDrv = (tstrWILC_WFIDrv *)(priv->hWILCWFIDrv); - host_int_set_wfi_drv_handler((u32)priv->hWILCWFIDrv); + host_int_set_wfi_drv_handler(priv->hWILCWFIDrv); PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv); #ifdef WILC_P2P @@ -2887,15 +2887,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler); - host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_linux_wlan->strInterfaceInfo[0].aSrcAddress); host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2973,15 +2973,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev g_wilc_initialized = 1; host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler); - host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_linux_wlan->strInterfaceInfo[0].aSrcAddress); host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -3101,15 +3101,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler); - host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_linux_wlan->strInterfaceInfo[0].aSrcAddress); host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 0dfe108e7cf8..77f320d125e8 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -144,7 +144,7 @@ struct WILC_WFI_priv { spinlock_t lock; struct net_device *dev; struct napi_struct napi; - WILC_WFIDrvHandle hWILCWFIDrv; + tstrWILC_WFIDrv *hWILCWFIDrv; WILC_WFIDrvHandle hWILCWFIDrv_2; tstrHostIFpmkidAttr pmkid_list; struct WILC_WFI_stats netstats; @@ -176,7 +176,7 @@ typedef struct { typedef struct { uint8_t aSrcAddress[ETH_ALEN]; uint8_t aBSSID[ETH_ALEN]; - uint32_t drvHandler; + tstrWILC_WFIDrv *drvHandler; struct net_device *wilc_netdev; } tstrInterfaceInfo; typedef struct { From 11f58c88ddf8613dde976e0fe18afecefaf04195 Mon Sep 17 00:00:00 2001 From: Johnny Kim Date: Thu, 13 Aug 2015 13:41:20 +0900 Subject: [PATCH 877/912] staging: wilc1000: change void pointer type to real type This patch changes the void pointer member of the tstrHostIFmsg to the real data type because the void pointer type is ambiguous and not readable. Signed-off-by: Johnny Kim Signed-off-by: Tony Cho Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 11b1cf704b50..ecab76ea44b9 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -466,7 +466,7 @@ typedef union _tuniHostIFmsgBody { typedef struct _tstrHostIFmsg { u16 u16MsgId; /*!< Message ID */ tuniHostIFmsgBody uniHostIFmsgBody; /*!< Message body */ - void *drvHandler; + tstrWILC_WFIDrv *drvHandler; } tstrHostIFmsg; #ifdef CONNECT_DIRECT From 2b05df556e01f846fd67f8888add9919af55f35c Mon Sep 17 00:00:00 2001 From: Johnny Kim Date: Thu, 13 Aug 2015 13:41:21 +0900 Subject: [PATCH 878/912] staging: wilc1000: clarify the argument type This patch replaces the void pointer type in the host interface functions which process the message from host thread by the real data type, tstrWILC_WFIDrv because the void pointer type as the arguments is not clear and concise. In addition, typecasting to the void pointer type is removed becasue it is not necessary. Signed-off-by: Johnny Kim Signed-off-by: Tony Cho Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 78 +++++++++++------------ drivers/staging/wilc1000/host_interface.h | 4 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ecab76ea44b9..e50b65082cd6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -601,7 +601,7 @@ extern int linux_wlan_get_num_conn_ifcs(void); * @date * @version 1.0 */ -static s32 Handle_SetChannel(void *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan) +static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan) { s32 s32Error = WILC_SUCCESS; @@ -681,7 +681,7 @@ static s32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSetDrvHand * @date * @version 1.0 */ -static s32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode) +static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode) { s32 s32Error = WILC_SUCCESS; @@ -726,7 +726,7 @@ static s32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperationMode * @date * @version 1.0 */ -s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) +s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) { s32 s32Error = WILC_SUCCESS; @@ -778,7 +778,7 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) * @date * @version 1.0 */ -s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) +s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) { s32 s32Error = WILC_SUCCESS; @@ -831,7 +831,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) * @date November 2013 * @version 7.0 */ -static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress) +static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress) { s32 s32Error = WILC_SUCCESS; @@ -877,7 +877,7 @@ static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrH * @date JAN 2013 * @version 8.0 */ -static s32 Handle_GetMacAddress(void *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) +static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) { s32 s32Error = WILC_SUCCESS; @@ -914,7 +914,7 @@ static s32 Handle_GetMacAddress(void *drvHandler, tstrHostIfGetMacAddress *pstrH * @date * @version 1.0 */ -static s32 Handle_CfgParam(void *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr) +static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr) { s32 s32Error = WILC_SUCCESS; tstrWID strWIDList[32]; @@ -1238,7 +1238,7 @@ static s32 Handle_wait_msg_q_empty(void) * @date * @version 1.0 */ -static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) +static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) { s32 s32Error = WILC_SUCCESS; tstrWID strWIDList[5]; @@ -1408,7 +1408,7 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) * @date * @version 1.0 */ -static s32 Handle_ScanDone(void *drvHandler, tenuScanEvent enuEvent) +static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) { s32 s32Error = WILC_SUCCESS; @@ -1468,7 +1468,7 @@ static s32 Handle_ScanDone(void *drvHandler, tenuScanEvent enuEvent) * @version 1.0 */ u8 u8ConnectedSSID[6] = {0}; -static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFconnectAttr) +static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *pstrHostIFconnectAttr) { tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; s32 s32Error = WILC_SUCCESS; @@ -2037,7 +2037,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon * @version 8.0 */ -static s32 Handle_FlushConnect(void *drvHandler) +static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrWID strWIDList[5]; @@ -2104,7 +2104,7 @@ static s32 Handle_FlushConnect(void *drvHandler) * @date * @version 1.0 */ -static s32 Handle_ConnectTimeout(void *drvHandler) +static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrConnectInfo strConnectInfo; @@ -2212,7 +2212,7 @@ static s32 Handle_ConnectTimeout(void *drvHandler) * @date * @version 1.0 */ -static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdNetworkInfo) +static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdNetworkInfo *pstrRcvdNetworkInfo) { u32 i; bool bNewNtwrkFound; @@ -2334,7 +2334,7 @@ done: * @date * @version 1.0 */ -static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pstrRcvdGnrlAsyncInfo) +static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsyncInfo *pstrRcvdGnrlAsyncInfo) { /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ /* which carries only 1 WID which have WID ID = WID_STATUS */ @@ -2635,7 +2635,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /*Abort the running scan*/ WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) - Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); + Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); } @@ -2664,7 +2664,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst * @date * @version 1.0 */ -static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) +static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3026,7 +3026,7 @@ _WPAPtk_end_case_: * @date * @version 1.0 */ -static void Handle_Disconnect(void *drvHandler) +static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) { tstrWID strWID; @@ -3139,7 +3139,7 @@ static void Handle_Disconnect(void *drvHandler) } -void resolve_disconnect_aberration(void *drvHandler) +void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) { tstrWILC_WFIDrv *pstrWFIDrv; @@ -3151,7 +3151,7 @@ void resolve_disconnect_aberration(void *drvHandler) host_int_disconnect(pstrWFIDrv, 1); } } -static s32 Switch_Log_Terminal(void *drvHandler) +static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler) { @@ -3195,7 +3195,7 @@ static s32 Switch_Log_Terminal(void *drvHandler) * @date * @version 1.0 */ -static s32 Handle_GetChnl(void *drvHandler) +static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; @@ -3240,7 +3240,7 @@ static s32 Handle_GetChnl(void *drvHandler) * @date * @version 1.0 */ -static void Handle_GetRssi(void *drvHandler) +static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3270,7 +3270,7 @@ static void Handle_GetRssi(void *drvHandler) } -static void Handle_GetLinkspeed(void *drvHandler) +static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3300,7 +3300,7 @@ static void Handle_GetLinkspeed(void *drvHandler) } -s32 Handle_GetStatistics(void *drvHandler, tstrStatistics *pstrStatistics) +s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) { tstrWID strWIDList[5]; uint32_t u32WidsCount = 0, s32Error = 0; @@ -3361,7 +3361,7 @@ s32 Handle_GetStatistics(void *drvHandler, tstrStatistics *pstrStatistics) * @date * @version 1.0 */ -static s32 Handle_Get_InActiveTime(void *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT) +static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT) { s32 s32Error = WILC_SUCCESS; @@ -3430,7 +3430,7 @@ static s32 Handle_Get_InActiveTime(void *drvHandler, tstrHostIfStaInactiveT *str * @date * @version 1.0 */ -static void Handle_AddBeacon(void *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam) +static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3502,7 +3502,7 @@ static void Handle_AddBeacon(void *drvHandler, tstrHostIFSetBeacon *pstrSetBeaco * @date * @version 1.0 */ -static void Handle_DelBeacon(void *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon) +static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3599,7 +3599,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta * @date * @version 1.0 */ -static void Handle_AddStation(void *drvHandler, tstrWILC_AddStaParam *pstrStationParam) +static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3642,7 +3642,7 @@ static void Handle_AddStation(void *drvHandler, tstrWILC_AddStaParam *pstrStatio * @date * @version 1.0 */ -static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) +static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) { s32 s32Error = WILC_SUCCESS; @@ -3701,7 +3701,7 @@ static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllSt * @date * @version 1.0 */ -static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaParam) +static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pstrDelStaParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3746,7 +3746,7 @@ static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaPara * @date * @version 1.0 */ -static void Handle_EditStation(void *drvHandler, tstrWILC_AddStaParam *pstrStationParam) +static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3791,7 +3791,7 @@ static void Handle_EditStation(void *drvHandler, tstrWILC_AddStaParam *pstrStati * @date * @version 1.0 */ -static int Handle_RemainOnChan(void *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) +static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) { s32 s32Error = WILC_SUCCESS; u8 u8remain_on_chan_flag; @@ -3870,7 +3870,7 @@ static int Handle_RemainOnChan(void *drvHandler, tstrHostIfRemainOnChan *pstrHos * @date * @version 1.0 */ -static int Handle_RegisterFrame(void *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) +static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3922,7 +3922,7 @@ static int Handle_RegisterFrame(void *drvHandler, tstrHostIfRegisterFrame *pstrH * @version 1.0 */ #define FALSE_FRMWR_CHANNEL 100 -static u32 Handle_ListenStateExpired(void *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) +static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) { u8 u8remain_on_chan_flag; tstrWID strWID; @@ -4013,7 +4013,7 @@ static void ListenTimerCB(void *pvArg) * @date * @version 1.0 */ -static void Handle_PowerManagement(void *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam) +static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -4054,7 +4054,7 @@ static void Handle_PowerManagement(void *drvHandler, tstrHostIfPowerMgmtParam *s * @date * @version 1.0 */ -static void Handle_SetMulticastFilter(void *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti) +static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -4108,7 +4108,7 @@ static void Handle_SetMulticastFilter(void *drvHandler, tstrHostIFSetMulti *strH * @date Feb. 2014 * @version 9.0 */ -static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) +static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -4196,7 +4196,7 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos * @date Feb. 2013 * @version 9.0 */ -static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) +static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -4266,7 +4266,7 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos * @date Feb. 2013 * @version 9.0 */ -static s32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) +static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -7676,7 +7676,7 @@ void host_int_freeJoinParams(void *pJoinParams) * @date * @version 1.0**/ -static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID, short int BufferSize, +static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize, short int SessionTimeout, void *drvHandler) { s32 s32Error = WILC_SUCCESS; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 2d97e9f1f40b..5ac5563dac89 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -1262,9 +1262,9 @@ s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bRe s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address); s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode); -static s32 Handle_ScanDone(void *drvHandler, tenuScanEvent enuEvent); +static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent); -static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID, short int BufferSize, +static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize, short int SessionTimeout, void *drvHandler); From f1126b1d0d7c0daf48f50e566c498912b31c459f Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 14 Aug 2015 21:57:51 +0530 Subject: [PATCH 879/912] staging: rtl8188eu: fix possible NULL dereference dm_odm was being checked for NULL after dereferencing it. Lets check for NULL first before derefenrencing it. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c index 15a176596305..2633a13b4e58 100644 --- a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c @@ -659,11 +659,11 @@ void ODM_RA_UpdateRateInfo_8188E(struct odm_dm_struct *dm_odm, u8 macid, u8 Rate { struct odm_ra_info *pRaInfo = NULL; + if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM)) + return; ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("macid =%d RateID = 0x%x RateMask = 0x%x SGIEnable =%d\n", macid, RateID, RateMask, SGIEnable)); - if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM)) - return; pRaInfo = &(dm_odm->RAInfo[macid]); pRaInfo->RateID = RateID; @@ -676,10 +676,10 @@ void ODM_RA_SetRSSI_8188E(struct odm_dm_struct *dm_odm, u8 macid, u8 Rssi) { struct odm_ra_info *pRaInfo = NULL; - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, - (" macid =%d Rssi =%d\n", macid, Rssi)); if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM)) return; + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + (" macid =%d Rssi =%d\n", macid, Rssi)); pRaInfo = &(dm_odm->RAInfo[macid]); pRaInfo->RssiStaRA = Rssi; From cc6c16df806f3c263b7cde7d6961d80415f9aba8 Mon Sep 17 00:00:00 2001 From: Yash Shah Date: Fri, 14 Aug 2015 06:06:13 +0000 Subject: [PATCH 880/912] Staging: sm750fb: Fix "foo* bar" should be "foo *bar" errors Fix "foo* bar" should be "foo *bar" errors as detected by checkpatch.pl Signed-off-by: Yash Shah Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.h | 14 +++++++------- drivers/staging/sm750fb/sm750_cursor.c | 4 ++-- drivers/staging/sm750fb/sm750_cursor.h | 4 ++-- drivers/staging/sm750fb/sm750_hw.h | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 9b101a937964..5bc445571b48 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -16,9 +16,9 @@ extern int smi_indent; struct lynx_accel { /* base virtual address of DPR registers */ - volatile unsigned char __iomem * dprBase; + volatile unsigned char __iomem *dprBase; /* base virtual address of de data port */ - volatile unsigned char __iomem * dpPortBase; + volatile unsigned char __iomem *dpPortBase; /* function fointers */ void (*de_init)(struct lynx_accel *); @@ -64,8 +64,8 @@ struct lynx_share { /* locks*/ spinlock_t slock; /* function pointers */ - void (*suspend)(struct lynx_share*); - void (*resume)(struct lynx_share*); + void (*suspend)(struct lynx_share *); + void (*resume)(struct lynx_share *); }; struct lynx_cursor { @@ -80,7 +80,7 @@ struct lynx_cursor { char __iomem *vstart; int offset; /* mmio addr of hw cursor */ - volatile char __iomem * mmio; + volatile char __iomem *mmio; /* the lynx_share of this adaptor */ struct lynx_share *share; /* proc_routines */ @@ -114,7 +114,7 @@ struct lynxfb_crtc { int (*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); int (*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); - void (*clear)(struct lynxfb_crtc*); + void (*clear)(struct lynxfb_crtc *); /* pan display */ int (*proc_panDisplay)(struct lynxfb_crtc *, const struct fb_var_screeninfo *, @@ -146,7 +146,7 @@ struct lynxfb_output { int (*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*); int (*proc_setBLANK)(struct lynxfb_output*, int); - void (*clear)(struct lynxfb_output*); + void (*clear)(struct lynxfb_output *); }; struct lynxfb_par { diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 2400c6c75863..a94a4bbff450 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -95,7 +95,7 @@ void hw_cursor_setColor(struct lynx_cursor *cursor, } void hw_cursor_setData(struct lynx_cursor *cursor, - u16 rop, const u8* pcol, const u8* pmsk) + u16 rop, const u8 *pcol, const u8 *pmsk) { int i, j, count, pitch, offset; u8 color, mask, opr; @@ -184,7 +184,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, void hw_cursor_setData2(struct lynx_cursor *cursor, - u16 rop, const u8* pcol, const u8* pmsk) + u16 rop, const u8 *pcol, const u8 *pmsk) { int i, j, count, pitch, offset; u8 color, mask; diff --git a/drivers/staging/sm750fb/sm750_cursor.h b/drivers/staging/sm750fb/sm750_cursor.h index e1716a600239..6c4fc9b73489 100644 --- a/drivers/staging/sm750fb/sm750_cursor.h +++ b/drivers/staging/sm750fb/sm750_cursor.h @@ -11,7 +11,7 @@ void hw_cursor_setPos(struct lynx_cursor *cursor, void hw_cursor_setColor(struct lynx_cursor *cursor, u32 fg, u32 bg); void hw_cursor_setData(struct lynx_cursor *cursor, - u16 rop, const u8* data, const u8* mask); + u16 rop, const u8 *data, const u8 *mask); void hw_cursor_setData2(struct lynx_cursor *cursor, - u16 rop, const u8* data, const u8* mask); + u16 rop, const u8 *data, const u8 *mask); #endif diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h index ef0a16f27936..3781a1a11c68 100644 --- a/drivers/staging/sm750fb/sm750_hw.h +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -78,7 +78,7 @@ struct sm750_share { */ }; -int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev); +int hw_sm750_map(struct lynx_share *share, struct pci_dev *pdev); int hw_sm750_inithw(struct lynx_share*, struct pci_dev *); void hw_sm750_initAccel(struct lynx_share *); int hw_sm750_deWait(void); @@ -92,8 +92,8 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc*, struct fb_var_screeninfo*, struct int hw_sm750_setColReg(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); int hw_sm750_setBLANK(struct lynxfb_output*, int); int hw_sm750le_setBLANK(struct lynxfb_output*, int); -void hw_sm750_crtc_clear(struct lynxfb_crtc*); -void hw_sm750_output_clear(struct lynxfb_output*); +void hw_sm750_crtc_clear(struct lynxfb_crtc *); +void hw_sm750_output_clear(struct lynxfb_output *); int hw_sm750_pan_display(struct lynxfb_crtc *crtc, const struct fb_var_screeninfo *var, const struct fb_info *info); From 969effe9dcdccab865c7f57790f647ebc59df457 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 19:15:34 -0700 Subject: [PATCH 881/912] staging: wilc1000: remove WILC_FREE_IF_TRUE macro Just use kfree, as that's all it resolves itself to. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 20 ++++++++++---------- drivers/staging/wilc1000/wilc_memory.h | 23 ----------------------- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index e50b65082cd6..ea75c5fd447c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3487,9 +3487,9 @@ static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *p WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(strWID.ps8WidVal); - WILC_FREE_IF_TRUE(pstrSetBeaconParam->pu8Head); - WILC_FREE_IF_TRUE(pstrSetBeaconParam->pu8Tail); + kfree(strWID.ps8WidVal); + kfree(pstrSetBeaconParam->pu8Head); + kfree(pstrSetBeaconParam->pu8Tail); } @@ -3629,8 +3629,8 @@ static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(pstrStationParam->pu8Rates); - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(pstrStationParam->pu8Rates); + kfree(strWID.ps8WidVal); } /** @@ -3686,7 +3686,7 @@ static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *p WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); up(&hWaitResponse); } @@ -3733,7 +3733,7 @@ static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pst WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); } @@ -3776,8 +3776,8 @@ static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(pstrStationParam->pu8Rates); - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(pstrStationParam->pu8Rates); + kfree(strWID.ps8WidVal); } #endif /*WILC_AP_EXTERNAL_MLME*/ @@ -4093,7 +4093,7 @@ static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSet WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); } diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h index 5ec4ef303c9c..78b9d5828779 100644 --- a/drivers/staging/wilc1000/wilc_memory.h +++ b/drivers/staging/wilc1000/wilc_memory.h @@ -61,7 +61,6 @@ void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, * @sa WILC_FREE * @sa WILC_FREE_EX * @sa WILC_FREE_SET_NULL - * @sa WILC_FREE_IF_TRUE * @author syounan * @date 16 Aug 2010 * @version 1.0 @@ -92,18 +91,6 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, ((__struct_type__ *)WILC_MALLOC_EX( \ sizeof(__struct_type__) * (u32)(__n_structs__), __attrs__)) - - -/*! - * @brief Frees a block (with custom attributes) if the pointer expression evaluates - * to true - */ -#define WILC_FREE_IF_TRUE_EX(__ptr__, __attrs__) do { \ - if (__ptr__ != NULL) { \ - WILC_FREE_EX(__ptr__, __attrs__); \ - } \ -} while (0) - /*! * @brief standrad malloc wrapper with default attributes */ @@ -120,14 +107,4 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, #define WILC_NEW(__struct_type__, __n_structs__) \ WILC_NEW_EX(__struct_type__, __n_structs__, NULL) - - -/*! - * @brief Frees a block (with default attributes) if the pointer expression evaluates - * to true - */ -#define WILC_FREE_IF_TRUE(__ptr__) \ - WILC_FREE_IF_TRUE_EX(__ptr__, NULL) - - #endif From b6d9e0cb142bdae60872a9be392ed8b6e5dde243 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 19:19:19 -0700 Subject: [PATCH 882/912] staging: wilc1000: remove WILC_MemoryFree It's no longer needed, so remove the empty wrapper function. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_memory.c | 13 ------------ drivers/staging/wilc1000/wilc_memory.h | 29 -------------------------- 2 files changed, 42 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_memory.c b/drivers/staging/wilc1000/wilc_memory.c index 53ba1d01632d..e90a95705a7d 100644 --- a/drivers/staging/wilc1000/wilc_memory.c +++ b/drivers/staging/wilc1000/wilc_memory.c @@ -14,16 +14,3 @@ void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, else return NULL; } - - - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, - char *pcFileName, u32 u32LineNo) -{ - kfree(pvBlock); -} diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h index 78b9d5828779..877617c5307f 100644 --- a/drivers/staging/wilc1000/wilc_memory.h +++ b/drivers/staging/wilc1000/wilc_memory.h @@ -47,27 +47,6 @@ typedef struct { void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo); - - -/*! - * @brief Frees given block - * @param[in] pvBlock the memory block to be freed - * @param[in] strAttrs Optional attributes, NULL for default - * @param[in] pcFileName file name of the calling code for debugging - * @param[in] u32LineNo line number of the calling code for debugging - * @note It is recommended to use of of the wrapper macros instead of - * calling this function directly - * @sa sttrWILC_MemoryAttrs - * @sa WILC_FREE - * @sa WILC_FREE_EX - * @sa WILC_FREE_SET_NULL - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, - char *pcFileName, u32 u32LineNo); - /*! * @brief standrad malloc wrapper with custom attributes */ @@ -75,14 +54,6 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, (WILC_MemoryAlloc( \ (__size__), __attrs__, NULL, 0)) - -/*! - * @brief standrad free wrapper with custom attributes - */ - #define WILC_FREE_EX(__ptr__, __attrs__) \ - (WILC_MemoryFree( \ - (__ptr__), __attrs__, NULL, 0)) - /*! * @brief Allocates a block (with custom attributes) of given type and number of * elements From 36a24b4eb60eb8644394e319b2e5afc32be8c3a1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 19:26:20 -0700 Subject: [PATCH 883/912] staging: wilc1000: delete wilc_type.h The .h file isn't needed at all, so just remove it. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_type.h | 34 ------------------------- drivers/staging/wilc1000/wilc_wlan.h | 2 +- drivers/staging/wilc1000/wilc_wlan_if.h | 2 +- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_type.h diff --git a/drivers/staging/wilc1000/wilc_type.h b/drivers/staging/wilc1000/wilc_type.h deleted file mode 100644 index 5f36e7f92cd1..000000000000 --- a/drivers/staging/wilc1000/wilc_type.h +++ /dev/null @@ -1,34 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////// */ -/* */ -/* Copyright (c) Atmel Corporation. All rights reserved. */ -/* */ -/* Module Name: wilc_type.h */ -/* */ -/* */ -/* //////////////////////////////////////////////////////////////////////////// */ -#ifndef WILC_TYPE_H -#define WILC_TYPE_H - -/******************************************** - * - * Type Defines - * - ********************************************/ -#ifdef WIN32 -typedef char int8_t; -typedef short int16_t; -typedef long int32_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned long uint32_t; -#else -#ifdef _linux_ -/*typedef unsigned char uint8_t; - * typedef unsigned short uint16_t; - * typedef unsigned long uint32_t;*/ -#include -#else -#include "wilc_oswrapper.h" -#endif -#endif -#endif diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 0ba7ec69e2b4..244f7108ae92 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -1,7 +1,7 @@ #ifndef WILC_WLAN_H #define WILC_WLAN_H -#include "wilc_type.h" +#include "wilc_oswrapper.h" #define ISWILC1000(id) (((id & 0xfffff000) == 0x100000) ? 1 : 0) diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 8735a6a64d89..5cf74e4c4a70 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -20,7 +20,7 @@ /* #define USE_OLD_SPI_SW */ -#include "wilc_type.h" +#include "wilc_oswrapper.h" #include "linux_wlan_common.h" From 5235ff6a1df6fb0883f1a9020ab36e0db1c68064 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Fri, 14 Aug 2015 22:58:46 +0100 Subject: [PATCH 884/912] staging: vt6655: desc.h replace typedef struct tagTDES0 create struct vnt_tdes0 replacing used members byTSR0 -> tsr0 byTSR1 -> tsr1 f1Owner -> owner Narrowing endian differences to inside structure. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/card.c | 4 ++-- drivers/staging/vt6655/desc.h | 36 ++++++++++------------------ drivers/staging/vt6655/device_main.c | 8 +++---- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index ae8fd7f491a3..e3ff4ad2e317 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -525,12 +525,12 @@ CARDvSafeResetTx( for (uu = 0; uu < pDevice->sOpts.nTxDescs[0]; uu++) { pCurrTD = &(pDevice->apTD0Rings[uu]); - pCurrTD->m_td0TD0.f1Owner = OWNED_BY_HOST; + pCurrTD->td0.owner = OWNED_BY_HOST; /* init all Tx Packet pointer to NULL */ } for (uu = 0; uu < pDevice->sOpts.nTxDescs[1]; uu++) { pCurrTD = &(pDevice->apTD1Rings[uu]); - pCurrTD->m_td0TD0.f1Owner = OWNED_BY_HOST; + pCurrTD->td0.owner = OWNED_BY_HOST; /* init all Tx Packet pointer to NULL */ } diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index c9162149eb61..00fa348f4669 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -216,33 +216,23 @@ typedef struct tagSRxDesc { SRxDesc, *PSRxDesc; typedef const SRxDesc *PCSRxDesc; +struct vnt_tdes0 { + volatile u8 tsr0; + volatile u8 tsr1; #ifdef __BIG_ENDIAN - -typedef struct tagTDES0 { - volatile unsigned char byTSR0; - volatile unsigned char byTSR1; union { - volatile u16 f15Txtime; + volatile u16 f15_txtime; struct { - volatile u8 f8Reserved1; - volatile u8 f1Owner:1; - volatile u8 f7Reserved:7; - } __attribute__ ((__packed__)); - } __attribute__ ((__packed__)); -} __attribute__ ((__packed__)) -STDES0, PSTDES0; - + volatile u8 f8_reserved; + volatile u8 owner:1; + volatile u8 f7_reserved:7; + } __packed; + } __packed; #else - -typedef struct tagTDES0 { - volatile unsigned char byTSR0; - volatile unsigned char byTSR1; - volatile unsigned short f15Txtime:15; - volatile unsigned short f1Owner:1; -} __attribute__ ((__packed__)) -STDES0; - + volatile u16 f15_txtime:15; + volatile u16 owner:1; #endif +} __packed; typedef struct tagTDES1 { volatile __le16 wReqCount; @@ -263,7 +253,7 @@ typedef struct tagDEVICE_TD_INFO { /* transmit descriptor */ typedef struct tagSTxDesc { - volatile STDES0 m_td0TD0; + volatile struct vnt_tdes0 td0; volatile STDES1 m_td1TD1; volatile __le32 buff_addr; volatile __le32 next_desc; diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index b74af8d89fe6..842e0524a31f 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -906,13 +906,13 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) unsigned char byTsr1; for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] > 0; pTD = pTD->next) { - if (pTD->m_td0TD0.f1Owner == OWNED_BY_NIC) + if (pTD->td0.owner == OWNED_BY_NIC) break; if (works++ > 15) break; - byTsr0 = pTD->m_td0TD0.byTSR0; - byTsr1 = pTD->m_td0TD0.byTSR1; + byTsr0 = pTD->td0.tsr0; + byTsr1 = pTD->td0.tsr1; /* Only the status of first TD in the chain is correct */ if (pTD->m_td1TD1.byTCR & TCR_STP) { @@ -1200,7 +1200,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) /* Poll Transmit the adapter */ wmb(); - head_td->m_td0TD0.f1Owner = OWNED_BY_NIC; + head_td->td0.owner = OWNED_BY_NIC; wmb(); /* second memory barrier */ if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) From 9cc8eac99c98000a414f916c1c58dab22c29474d Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Fri, 14 Aug 2015 22:58:47 +0100 Subject: [PATCH 885/912] staging: vt6655: replaced typedef struct tagTDES1 Create struct vnt_tdes1 that replaces members wReqCount -> req_count byTCR -> tcr byReserved -> reserved Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 13 ++++++------- drivers/staging/vt6655/device_main.c | 9 ++++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 00fa348f4669..6efe825f7710 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -234,12 +234,11 @@ struct vnt_tdes0 { #endif } __packed; -typedef struct tagTDES1 { - volatile __le16 wReqCount; - volatile unsigned char byTCR; - volatile unsigned char byReserved; -} __attribute__ ((__packed__)) -STDES1; +struct vnt_tdes1 { + volatile __le16 req_count; + volatile u8 tcr; + volatile u8 reserved; +} __packed; typedef struct tagDEVICE_TD_INFO { void *mic_hdr; @@ -254,7 +253,7 @@ typedef struct tagDEVICE_TD_INFO { /* transmit descriptor */ typedef struct tagSTxDesc { volatile struct vnt_tdes0 td0; - volatile STDES1 m_td1TD1; + volatile struct vnt_tdes1 td1; volatile __le32 buff_addr; volatile __le32 next_desc; struct tagSTxDesc *next __aligned(8); diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 842e0524a31f..947e8685db55 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -915,7 +915,7 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) byTsr1 = pTD->td0.tsr1; /* Only the status of first TD in the chain is correct */ - if (pTD->m_td1TD1.byTCR & TCR_STP) { + if (pTD->td1.tcr & TCR_STP) { if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) { if (!(byTsr1 & TSR1_TERR)) { if (byTsr0 != 0) { @@ -1174,7 +1174,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) head_td = priv->apCurrTD[dma_idx]; - head_td->m_td1TD1.byTCR = 0; + head_td->td1.tcr = 0; head_td->pTDInfo->skb = skb; @@ -1192,9 +1192,8 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) priv->bPWBitOn = false; /* Set TSR1 & ReqCount in TxDescHead */ - head_td->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU); - head_td->m_td1TD1.wReqCount = - cpu_to_le16((u16)head_td->pTDInfo->dwReqCount); + head_td->td1.tcr |= (TCR_STP | TCR_EDP | EDMSDU); + head_td->td1.req_count = cpu_to_le16((u16)head_td->pTDInfo->dwReqCount); head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->buf_dma); From 531a9c524a54b7d232b6bf6631c460450dd41dbf Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Fri, 14 Aug 2015 22:58:48 +0100 Subject: [PATCH 886/912] staging: vt6655: struct tagDEVICE_TD_INFO resize dwReqCount. dwReqCount is no bigger than u16 Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 2 +- drivers/staging/vt6655/device_main.c | 2 +- drivers/staging/vt6655/rxtx.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 6efe825f7710..ab52c5623235 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -245,7 +245,7 @@ typedef struct tagDEVICE_TD_INFO { struct sk_buff *skb; unsigned char *buf; dma_addr_t buf_dma; - unsigned long dwReqCount; + u16 dwReqCount; unsigned long dwHeaderLength; unsigned char byFlags; } DEVICE_TD_INFO, *PDEVICE_TD_INFO; diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 947e8685db55..c3b7bd40dc06 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1193,7 +1193,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) /* Set TSR1 & ReqCount in TxDescHead */ head_td->td1.tcr |= (TCR_STP | TCR_EDP | EDMSDU); - head_td->td1.req_count = cpu_to_le16((u16)head_td->pTDInfo->dwReqCount); + head_td->td1.req_count = cpu_to_le16(head_td->pTDInfo->dwReqCount); head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->buf_dma); diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 380b879c05db..f3f6b15b7251 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1200,7 +1200,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, ptdCurr = (PSTxDesc)pHeadTD; - ptdCurr->pTDInfo->dwReqCount = cbReqCount; + ptdCurr->pTDInfo->dwReqCount = (u16)cbReqCount; ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; return cbHeaderLength; From 3a0989bb6cacb1f40273d4c397ea91cabe73bad8 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Fri, 14 Aug 2015 22:58:49 +0100 Subject: [PATCH 887/912] staging: vt6655: struct tagDEVICE_TD_INFO remove dwHeaderLength dwHeaderLength is assigned a value but that is never used. Remove variable. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 1 - drivers/staging/vt6655/rxtx.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index ab52c5623235..0b786cfaa9ab 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -246,7 +246,6 @@ typedef struct tagDEVICE_TD_INFO { unsigned char *buf; dma_addr_t buf_dma; u16 dwReqCount; - unsigned long dwHeaderLength; unsigned char byFlags; } DEVICE_TD_INFO, *PDEVICE_TD_INFO; diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index f3f6b15b7251..c9182487c390 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1201,7 +1201,6 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, ptdCurr = (PSTxDesc)pHeadTD; ptdCurr->pTDInfo->dwReqCount = (u16)cbReqCount; - ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; return cbHeaderLength; } From 543828599afc9cdd9012e363c7393e5ed102aa2a Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Fri, 14 Aug 2015 22:58:50 +0100 Subject: [PATCH 888/912] staging: vt6655: replace typedef struct tagDEVICE_TD_INFO and structure Create struct vnt_td_info with members mic_hdr skb buf buf_dma dwReqCount -> req_count byFlags -> flags In struct tagSTxDesc volatile is removed because it will generate a warning (in any case this member is not) and renaming td_info. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/desc.h | 12 ++++---- drivers/staging/vt6655/device.h | 4 +-- drivers/staging/vt6655/device_main.c | 42 ++++++++++++++-------------- drivers/staging/vt6655/rxtx.c | 8 +++--- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 0b786cfaa9ab..452971cb209e 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -240,14 +240,14 @@ struct vnt_tdes1 { volatile u8 reserved; } __packed; -typedef struct tagDEVICE_TD_INFO { +struct vnt_td_info { void *mic_hdr; struct sk_buff *skb; unsigned char *buf; - dma_addr_t buf_dma; - u16 dwReqCount; - unsigned char byFlags; -} DEVICE_TD_INFO, *PDEVICE_TD_INFO; + dma_addr_t buf_dma; + u16 req_count; + u8 flags; +}; /* transmit descriptor */ typedef struct tagSTxDesc { @@ -256,7 +256,7 @@ typedef struct tagSTxDesc { volatile __le32 buff_addr; volatile __le32 next_desc; struct tagSTxDesc *next __aligned(8); - volatile PDEVICE_TD_INFO pTDInfo __aligned(8); + struct vnt_td_info *td_info __aligned(8); } __attribute__ ((__packed__)) STxDesc, *PSTxDesc; typedef const STxDesc *PCSTxDesc; diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index 6aebb495fa8d..a31769a184d0 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -415,8 +415,8 @@ static inline PDEVICE_RD_INFO alloc_rd_info(void) return kzalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC); } -static inline PDEVICE_TD_INFO alloc_td_info(void) +static inline struct vnt_td_info *alloc_td_info(void) { - return kzalloc(sizeof(DEVICE_TD_INFO), GFP_ATOMIC); + return kzalloc(sizeof(struct vnt_td_info), GFP_ATOMIC); } #endif diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index c3b7bd40dc06..f3d81787c98c 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -702,11 +702,11 @@ static void device_init_td0_ring(struct vnt_private *pDevice) curr = pDevice->td0_pool_dma; for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++, curr += sizeof(STxDesc)) { pDesc = &(pDevice->apTD0Rings[i]); - pDesc->pTDInfo = alloc_td_info(); + pDesc->td_info = alloc_td_info(); if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) { - pDesc->pTDInfo->buf = pDevice->tx0_bufs + (i)*PKT_BUF_SZ; - pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma0 + (i)*PKT_BUF_SZ; + pDesc->td_info->buf = pDevice->tx0_bufs + (i)*PKT_BUF_SZ; + pDesc->td_info->buf_dma = pDevice->tx_bufs_dma0 + (i)*PKT_BUF_SZ; } pDesc->next = &(pDevice->apTD0Rings[(i+1) % pDevice->sOpts.nTxDescs[0]]); pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc)); @@ -727,11 +727,11 @@ static void device_init_td1_ring(struct vnt_private *pDevice) curr = pDevice->td1_pool_dma; for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++, curr += sizeof(STxDesc)) { pDesc = &(pDevice->apTD1Rings[i]); - pDesc->pTDInfo = alloc_td_info(); + pDesc->td_info = alloc_td_info(); if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) { - pDesc->pTDInfo->buf = pDevice->tx1_bufs + (i) * PKT_BUF_SZ; - pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma1 + (i) * PKT_BUF_SZ; + pDesc->td_info->buf = pDevice->tx1_bufs + (i) * PKT_BUF_SZ; + pDesc->td_info->buf_dma = pDevice->tx_bufs_dma1 + (i) * PKT_BUF_SZ; } pDesc->next = &(pDevice->apTD1Rings[(i + 1) % pDevice->sOpts.nTxDescs[1]]); pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc)); @@ -748,10 +748,10 @@ static void device_free_td0_ring(struct vnt_private *pDevice) for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++) { PSTxDesc pDesc = &(pDevice->apTD0Rings[i]); - PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; + struct vnt_td_info *pTDInfo = pDesc->td_info; dev_kfree_skb(pTDInfo->skb); - kfree(pDesc->pTDInfo); + kfree(pDesc->td_info); } } @@ -761,10 +761,10 @@ static void device_free_td1_ring(struct vnt_private *pDevice) for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++) { PSTxDesc pDesc = &(pDevice->apTD1Rings[i]); - PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; + struct vnt_td_info *pTDInfo = pDesc->td_info; dev_kfree_skb(pTDInfo->skb); - kfree(pDesc->pTDInfo); + kfree(pDesc->td_info); } } @@ -839,7 +839,7 @@ static const u8 fallback_rate1[5][5] = { }; static int vnt_int_report_rate(struct vnt_private *priv, - PDEVICE_TD_INFO context, u8 tsr0, u8 tsr1) + struct vnt_td_info *context, u8 tsr0, u8 tsr1) { struct vnt_tx_fifo_head *fifo_head; struct ieee80211_tx_info *info; @@ -916,7 +916,7 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) /* Only the status of first TD in the chain is correct */ if (pTD->td1.tcr & TCR_STP) { - if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) { + if ((pTD->td_info->flags & TD_FLAGS_NETIF_SKB) != 0) { if (!(byTsr1 & TSR1_TERR)) { if (byTsr0 != 0) { pr_debug(" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X]\n", @@ -930,13 +930,13 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) } if (byTsr1 & TSR1_TERR) { - if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) { + if ((pTD->td_info->flags & TD_FLAGS_PRIV_SKB) != 0) { pr_debug(" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X]\n", (int)uIdx, byTsr1, byTsr0); } } - vnt_int_report_rate(pDevice, pTD->pTDInfo, byTsr0, byTsr1); + vnt_int_report_rate(pDevice, pTD->td_info, byTsr0, byTsr1); device_free_tx_buf(pDevice, pTD); pDevice->iTDUsed[uIdx]--; @@ -960,14 +960,14 @@ static void device_error(struct vnt_private *pDevice, unsigned short status) static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) { - PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; + struct vnt_td_info *pTDInfo = pDesc->td_info; struct sk_buff *skb = pTDInfo->skb; if (skb) ieee80211_tx_status_irqsafe(pDevice->hw, skb); pTDInfo->skb = NULL; - pTDInfo->byFlags = 0; + pTDInfo->flags = 0; } static void vnt_check_bb_vga(struct vnt_private *priv) @@ -1176,10 +1176,10 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) head_td->td1.tcr = 0; - head_td->pTDInfo->skb = skb; + head_td->td_info->skb = skb; if (dma_idx == TYPE_AC0DMA) - head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; + head_td->td_info->flags = TD_FLAGS_NETIF_SKB; priv->apCurrTD[dma_idx] = head_td->next; @@ -1193,16 +1193,16 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) /* Set TSR1 & ReqCount in TxDescHead */ head_td->td1.tcr |= (TCR_STP | TCR_EDP | EDMSDU); - head_td->td1.req_count = cpu_to_le16(head_td->pTDInfo->dwReqCount); + head_td->td1.req_count = cpu_to_le16(head_td->td_info->req_count); - head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->buf_dma); + head_td->buff_addr = cpu_to_le32(head_td->td_info->buf_dma); /* Poll Transmit the adapter */ wmb(); head_td->td0.owner = OWNED_BY_NIC; wmb(); /* second memory barrier */ - if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) + if (head_td->td_info->flags & TD_FLAGS_NETIF_SKB) MACvTransmitAC0(priv->PortOffset); else MACvTransmit0(priv->PortOffset); diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index c9182487c390..8d0ae80709d3 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1030,7 +1030,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, unsigned int uDMAIdx, PSTxDesc pHeadTD, unsigned int is_pspoll) { - PDEVICE_TD_INFO td_info = pHeadTD->pTDInfo; + struct vnt_td_info *td_info = pHeadTD->td_info; struct sk_buff *skb = td_info->skb; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; @@ -1192,7 +1192,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, hdr->duration_id = uDuration; cbReqCount = cbHeaderLength + uPadding + skb->len; - pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf; + pbyBuffer = (unsigned char *)pHeadTD->td_info->buf; uLength = cbHeaderLength + uPadding; /* Copy the Packet into a tx Buffer */ @@ -1200,7 +1200,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, ptdCurr = (PSTxDesc)pHeadTD; - ptdCurr->pTDInfo->dwReqCount = (u16)cbReqCount; + ptdCurr->td_info->req_count = (u16)cbReqCount; return cbHeaderLength; } @@ -1275,7 +1275,7 @@ static void vnt_fill_txkey(struct ieee80211_hdr *hdr, u8 *key_buffer, int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx, PSTxDesc head_td, struct sk_buff *skb) { - PDEVICE_TD_INFO td_info = head_td->pTDInfo; + struct vnt_td_info *td_info = head_td->td_info; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_rate *tx_rate = &info->control.rates[0]; struct ieee80211_rate *rate; From e235727173626edf87c63b415d0363b411da299e Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Fri, 14 Aug 2015 22:58:51 +0100 Subject: [PATCH 889/912] staging: vt6655: Replace typedef struct tagSTxDesc Replace with struct vnt_tx_desc with all members the same. volatile is removed from pointers as this generates warning message. Only the first four members of vnt_tx_desc need to be volatile. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/card.c | 2 +- drivers/staging/vt6655/desc.h | 12 ++++---- drivers/staging/vt6655/device.h | 8 +++--- drivers/staging/vt6655/device_main.c | 43 +++++++++++++++------------- drivers/staging/vt6655/rxtx.c | 10 +++---- drivers/staging/vt6655/rxtx.h | 2 +- 6 files changed, 39 insertions(+), 38 deletions(-) diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index e3ff4ad2e317..c7b75dfc2d5f 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -514,7 +514,7 @@ CARDvSafeResetTx( ) { unsigned int uu; - PSTxDesc pCurrTD; + struct vnt_tx_desc *pCurrTD; /* initialize TD index */ pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]); diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index 452971cb209e..3c9007e34c0f 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -250,16 +250,14 @@ struct vnt_td_info { }; /* transmit descriptor */ -typedef struct tagSTxDesc { +struct vnt_tx_desc { volatile struct vnt_tdes0 td0; volatile struct vnt_tdes1 td1; - volatile __le32 buff_addr; - volatile __le32 next_desc; - struct tagSTxDesc *next __aligned(8); + volatile __le32 buff_addr; + volatile __le32 next_desc; + struct vnt_tx_desc *next __aligned(8); struct vnt_td_info *td_info __aligned(8); -} __attribute__ ((__packed__)) -STxDesc, *PSTxDesc; -typedef const STxDesc *PCSTxDesc; +} __packed; /* Length, Service, and Signal fields of Phy for Tx */ struct vnt_phy_field { diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index a31769a184d0..c9fa6ef42d34 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -252,11 +252,11 @@ struct vnt_private { int nTxQueues; volatile int iTDUsed[TYPE_MAXTD]; - volatile PSTxDesc apCurrTD[TYPE_MAXTD]; - volatile PSTxDesc apTailTD[TYPE_MAXTD]; + struct vnt_tx_desc *apCurrTD[TYPE_MAXTD]; + struct vnt_tx_desc *apTailTD[TYPE_MAXTD]; - volatile PSTxDesc apTD0Rings; - volatile PSTxDesc apTD1Rings; + struct vnt_tx_desc *apTD0Rings; + struct vnt_tx_desc *apTD1Rings; volatile PSRxDesc aRD0Ring; volatile PSRxDesc aRD1Ring; diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index f3d81787c98c..0d8f123c57fe 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -157,7 +157,7 @@ static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx); static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx); static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pDesc); static void device_init_registers(struct vnt_private *pDevice); -static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc); +static void device_free_tx_buf(struct vnt_private *, struct vnt_tx_desc *); static void device_free_td0_ring(struct vnt_private *pDevice); static void device_free_td1_ring(struct vnt_private *pDevice); static void device_free_rd0_ring(struct vnt_private *pDevice); @@ -522,8 +522,8 @@ static bool device_init_rings(struct vnt_private *pDevice) vir_pool = dma_zalloc_coherent(&pDevice->pcid->dev, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + - pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + - pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc), + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) + + pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc), &pDevice->pool_dma, GFP_ATOMIC); if (vir_pool == NULL) { dev_err(&pDevice->pcid->dev, "allocate desc dma memory failed\n"); @@ -551,8 +551,8 @@ static bool device_init_rings(struct vnt_private *pDevice) dma_free_coherent(&pDevice->pcid->dev, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + - pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + - pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc), + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) + + pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc), vir_pool, pDevice->pool_dma ); return false; @@ -562,7 +562,7 @@ static bool device_init_rings(struct vnt_private *pDevice) pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc); pDevice->td1_pool_dma = pDevice->td0_pool_dma + - pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc); + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc); /* vir_pool: pvoid type */ pDevice->apTD0Rings = vir_pool @@ -572,7 +572,7 @@ static bool device_init_rings(struct vnt_private *pDevice) pDevice->apTD1Rings = vir_pool + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) - + pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc); + + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc); pDevice->tx1_bufs = pDevice->tx0_bufs + pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ; @@ -597,8 +597,8 @@ static void device_free_rings(struct vnt_private *pDevice) dma_free_coherent(&pDevice->pcid->dev, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + - pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + - pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc) + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) + + pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc) , pDevice->aRD0Ring, pDevice->pool_dma ); @@ -697,10 +697,11 @@ static void device_init_td0_ring(struct vnt_private *pDevice) { int i; dma_addr_t curr; - PSTxDesc pDesc; + struct vnt_tx_desc *pDesc; curr = pDevice->td0_pool_dma; - for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++, curr += sizeof(STxDesc)) { + for (i = 0; i < pDevice->sOpts.nTxDescs[0]; + i++, curr += sizeof(struct vnt_tx_desc)) { pDesc = &(pDevice->apTD0Rings[i]); pDesc->td_info = alloc_td_info(); @@ -709,7 +710,7 @@ static void device_init_td0_ring(struct vnt_private *pDevice) pDesc->td_info->buf_dma = pDevice->tx_bufs_dma0 + (i)*PKT_BUF_SZ; } pDesc->next = &(pDevice->apTD0Rings[(i+1) % pDevice->sOpts.nTxDescs[0]]); - pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc)); + pDesc->next_desc = cpu_to_le32(curr + sizeof(struct vnt_tx_desc)); } if (i > 0) @@ -721,11 +722,12 @@ static void device_init_td1_ring(struct vnt_private *pDevice) { int i; dma_addr_t curr; - PSTxDesc pDesc; + struct vnt_tx_desc *pDesc; /* Init the TD ring entries */ curr = pDevice->td1_pool_dma; - for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++, curr += sizeof(STxDesc)) { + for (i = 0; i < pDevice->sOpts.nTxDescs[1]; + i++, curr += sizeof(struct vnt_tx_desc)) { pDesc = &(pDevice->apTD1Rings[i]); pDesc->td_info = alloc_td_info(); @@ -734,7 +736,7 @@ static void device_init_td1_ring(struct vnt_private *pDevice) pDesc->td_info->buf_dma = pDevice->tx_bufs_dma1 + (i) * PKT_BUF_SZ; } pDesc->next = &(pDevice->apTD1Rings[(i + 1) % pDevice->sOpts.nTxDescs[1]]); - pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc)); + pDesc->next_desc = cpu_to_le32(curr + sizeof(struct vnt_tx_desc)); } if (i > 0) @@ -747,7 +749,7 @@ static void device_free_td0_ring(struct vnt_private *pDevice) int i; for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++) { - PSTxDesc pDesc = &(pDevice->apTD0Rings[i]); + struct vnt_tx_desc *pDesc = &pDevice->apTD0Rings[i]; struct vnt_td_info *pTDInfo = pDesc->td_info; dev_kfree_skb(pTDInfo->skb); @@ -760,7 +762,7 @@ static void device_free_td1_ring(struct vnt_private *pDevice) int i; for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++) { - PSTxDesc pDesc = &(pDevice->apTD1Rings[i]); + struct vnt_tx_desc *pDesc = &pDevice->apTD1Rings[i]; struct vnt_td_info *pTDInfo = pDesc->td_info; dev_kfree_skb(pTDInfo->skb); @@ -900,7 +902,7 @@ static int vnt_int_report_rate(struct vnt_private *priv, static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) { - PSTxDesc pTD; + struct vnt_tx_desc *pTD; int works = 0; unsigned char byTsr0; unsigned char byTsr1; @@ -958,7 +960,8 @@ static void device_error(struct vnt_private *pDevice, unsigned short status) } } -static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) +static void device_free_tx_buf(struct vnt_private *pDevice, + struct vnt_tx_desc *pDesc) { struct vnt_td_info *pTDInfo = pDesc->td_info; struct sk_buff *skb = pTDInfo->skb; @@ -1156,7 +1159,7 @@ static irqreturn_t vnt_interrupt(int irq, void *arg) static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - PSTxDesc head_td; + struct vnt_tx_desc *head_td; u32 dma_idx; unsigned long flags; diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 8d0ae80709d3..5875d655dd55 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -130,7 +130,7 @@ s_vGenerateTxParameter( static unsigned int s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr, - unsigned int uDMAIdx, PSTxDesc pHeadTD, + unsigned int uDMAIdx, struct vnt_tx_desc *pHeadTD, unsigned int uNodeIndex); static @@ -1027,7 +1027,7 @@ s_vGenerateTxParameter( static unsigned int s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr, - unsigned int uDMAIdx, PSTxDesc pHeadTD, + unsigned int uDMAIdx, struct vnt_tx_desc *pHeadTD, unsigned int is_pspoll) { struct vnt_td_info *td_info = pHeadTD->td_info; @@ -1047,7 +1047,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, unsigned int cbReqCount = 0; bool bNeedACK = (bool)(fifo_ctl & FIFOCTL_NEEDACK); bool bRTS = (bool)(fifo_ctl & FIFOCTL_RTS); - PSTxDesc ptdCurr; + struct vnt_tx_desc *ptdCurr; unsigned int cbHeaderLength = 0; void *pvRrvTime; struct vnt_mic_hdr *pMICHDR; @@ -1198,7 +1198,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, /* Copy the Packet into a tx Buffer */ memcpy((pbyBuffer + uLength), skb->data, skb->len); - ptdCurr = (PSTxDesc)pHeadTD; + ptdCurr = pHeadTD; ptdCurr->td_info->req_count = (u16)cbReqCount; @@ -1273,7 +1273,7 @@ static void vnt_fill_txkey(struct ieee80211_hdr *hdr, u8 *key_buffer, } int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx, - PSTxDesc head_td, struct sk_buff *skb) + struct vnt_tx_desc *head_td, struct sk_buff *skb) { struct vnt_td_info *td_info = head_td->td_info; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h index 54694df14e44..1e30ecb5c63c 100644 --- a/drivers/staging/vt6655/rxtx.h +++ b/drivers/staging/vt6655/rxtx.h @@ -192,7 +192,7 @@ struct vnt_tx_short_buf_head { } __packed; int vnt_generate_fifo_header(struct vnt_private *, u32, - PSTxDesc head_td, struct sk_buff *); + struct vnt_tx_desc *head_td, struct sk_buff *); int vnt_beacon_make(struct vnt_private *, struct ieee80211_vif *); int vnt_beacon_enable(struct vnt_private *, struct ieee80211_vif *, struct ieee80211_bss_conf *); From bb7b1a76aad831d2c92998de928fdd8d987e00f8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 19:34:43 -0700 Subject: [PATCH 890/912] staging: wilc1000: remove commented out WILC_Sleep calls It's not being called, so delete these lines. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 1 - drivers/staging/wilc1000/host_interface.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index ef7f3b40f96d..c81c41d77c30 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -2014,7 +2014,6 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, /** * get the value **/ - /* WILC_Sleep(1000); */ counter = 0; for (counter = 0; counter < u32WIDsCount; counter++) { pstrWIDs[counter].s32ValueSize = gpstrWlanOps->wlan_cfg_get_value( diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ea75c5fd447c..c36479318662 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4932,7 +4932,6 @@ s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, /* ////////////// */ down(&(pstrWFIDrv->hSemTestKeyBlock)); - /* WILC_Sleep(100); */ /* /////// */ WILC_CATCH(s32Error) @@ -5033,7 +5032,6 @@ s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKe PRINT_ER("Error in sending message queue: RX GTK\n"); /* ////////////// */ down(&(pstrWFIDrv->hSemTestKeyBlock)); - /* WILC_Sleep(100); */ /* /////// */ WILC_CATCH(s32Error) From 80e29c7a8045005e1a146d86aa4e4a8cce13688c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 19:42:23 -0700 Subject: [PATCH 891/912] staging: wilc1000: remove WILC_Sleep() It was just a wrapper around usleep_range() so call that directly instead and remove the now-empty file. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 2 +- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/wilc_oswrapper.h | 3 --- drivers/staging/wilc1000/wilc_sleep.c | 18 ------------------ drivers/staging/wilc1000/wilc_sleep.h | 20 -------------------- drivers/staging/wilc1000/wilc_wlan.c | 6 +++--- 6 files changed, 6 insertions(+), 47 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_sleep.c delete mode 100644 drivers/staging/wilc1000/wilc_sleep.h diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index ec4b8778ba04..a6bfb838c431 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -26,7 +26,7 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ - wilc_memory.o wilc_msgqueue.o wilc_sleep.o \ + wilc_memory.o wilc_msgqueue.o \ wilc_timer.o coreconfigurator.o host_interface.o \ wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c36479318662..aee35d2a2302 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4339,7 +4339,7 @@ static int hostIFthread(void *pvArg) /*Re-Queue HIF message*/ if ((!g_wilc_initialized)) { PRINT_D(GENERIC_DBG, "--WAIT--"); - WILC_Sleep(200); + usleep_range(200 * 1000, 200 * 1000); WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); continue; } @@ -4347,7 +4347,7 @@ static int hostIFthread(void *pvArg) if (strHostIFmsg.u16MsgId == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - WILC_Sleep(2); + usleep_range(2 * 1000, 2 * 1000); continue; } diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index 652c882dbb28..374e33b528b7 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -23,9 +23,6 @@ /* Error reporting and handling support */ #include "wilc_errorsupport.h" -/* Sleep support */ -#include "wilc_sleep.h" - /* Timer support */ #include "wilc_timer.h" diff --git a/drivers/staging/wilc1000/wilc_sleep.c b/drivers/staging/wilc1000/wilc_sleep.c deleted file mode 100644 index adab3cac64f9..000000000000 --- a/drivers/staging/wilc1000/wilc_sleep.c +++ /dev/null @@ -1,18 +0,0 @@ - -#include "wilc_sleep.h" - -/* - * @author mdaftedar - * @date 10 Aug 2010 - * @version 1.0 - */ -void WILC_Sleep(u32 u32TimeMilliSec) -{ - if (u32TimeMilliSec <= 4000000) { - u32 u32Temp = u32TimeMilliSec * 1000; - usleep_range(u32Temp, u32Temp); - } else { - msleep(u32TimeMilliSec); - } - -} diff --git a/drivers/staging/wilc1000/wilc_sleep.h b/drivers/staging/wilc1000/wilc_sleep.h deleted file mode 100644 index cf9047f707a7..000000000000 --- a/drivers/staging/wilc1000/wilc_sleep.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __WILC_SLEEP_H__ -#define __WILC_SLEEP_H__ - -#include -#include - -/*! - * @brief forces the current thread to sleep until the given time has elapsed - * @param[in] u32TimeMilliSec Time to sleep in Milli seconds - * @sa WILC_SleepMicrosec - * @author syounan - * @date 10 Aug 2010 - * @version 1.0 - * @note This function offers a relatively innacurate and low resolution - * sleep, for accurate high resolution sleep use u32TimeMicoSec - */ -/* TODO: remove and open-code in callers */ -void WILC_Sleep(u32 u32TimeMilliSec); - -#endif diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 192f36cde59e..fac16db5ff6a 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -730,7 +730,7 @@ INLINE void chip_wakeup(void) do { /* Wait for the chip to stabilize*/ - WILC_Sleep(2); + usleep_range(2 * 1000, 2 * 1000); /* Make sure chip is awake. This is an extra step that can be removed */ /* later to avoid the bus access overhead */ if ((wilc_get_chipid(true) == 0)) { @@ -753,7 +753,7 @@ INLINE void chip_wakeup(void) /* If still off, redo the wake up sequence */ while (((clk_status_reg & 0x1) == 0) && (((++trials) % 3) == 0)) { /* Wait for the chip to stabilize*/ - WILC_Sleep(2); + usleep_range(2 * 1000, 2 * 1000); /* Make sure chip is awake. This is an extra step that can be removed */ /* later to avoid the bus access overhead */ @@ -1408,7 +1408,7 @@ static void wilc_wlan_handle_isr_ext(uint32_t int_status) buffer = p->os_func.os_malloc(size); if (buffer == NULL) { wilc_debug(N_ERR, "[wilc isr]: fail alloc host memory...drop the packets (%d)\n", size); - WILC_Sleep(100); + usleep_range(100 * 1000, 100 * 1000); goto _end_; } #endif From da711eb68e6f91b271a465cbcef3e96759840148 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 19:46:06 -0700 Subject: [PATCH 892/912] staging: wilc1000: remove WILC_TimerHandle typedef Use the proper structure (struct timer_list) instead, which makes things much more readable. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 6 +++--- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_platform.h | 4 ---- drivers/staging/wilc1000/wilc_timer.c | 8 ++++---- drivers/staging/wilc1000/wilc_timer.h | 8 ++++---- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index aee35d2a2302..8086b8b24fb8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -6,7 +6,7 @@ extern s32 TransportDeInit(void); extern u8 connecting; #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP -extern WILC_TimerHandle hDuringIpTimer; +extern struct timer_list hDuringIpTimer; #endif /*BugID_5137*/ @@ -546,7 +546,7 @@ static struct semaphore hSemHostIFthrdEnd; struct semaphore hSemDeinitDrvHandle; static struct semaphore hWaitResponse; struct semaphore hSemHostIntDeinit; -WILC_TimerHandle g_hPeriodicRSSI; +struct timer_list g_hPeriodicRSSI; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 5ac5563dac89..e66dee9af5da 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -367,10 +367,10 @@ typedef struct { struct semaphore hSemGetCHNL; struct semaphore hSemInactiveTime; /* timer handlers */ - WILC_TimerHandle hScanTimer; - WILC_TimerHandle hConnectTimer; + struct timer_list hScanTimer; + struct timer_list hConnectTimer; #ifdef WILC_P2P - WILC_TimerHandle hRemainOnChannel; + struct timer_list hRemainOnChannel; #endif bool IFC_UP; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index f8ef8e295f11..5b6f698445fa 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -71,7 +71,7 @@ extern void resolve_disconnect_aberration(void *drvHandler); extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; void wilc1000_wlan_deinit(linux_wlan_t *nic); #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP -extern WILC_TimerHandle hDuringIpTimer; +extern struct timer_list hDuringIpTimer; #endif static int linux_wlan_device_power(int on_off) diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index ccceaae212a5..1e56973f2f93 100644 --- a/drivers/staging/wilc1000/wilc_platform.h +++ b/drivers/staging/wilc1000/wilc_platform.h @@ -16,10 +16,6 @@ * OS specific types *******************************************************************/ -typedef struct timer_list WILC_TimerHandle; - - - /* Message Queue type is a structure */ typedef struct __Message_struct { void *pvBuffer; diff --git a/drivers/staging/wilc1000/wilc_timer.c b/drivers/staging/wilc1000/wilc_timer.c index dc71157f9c3e..995f9c841f67 100644 --- a/drivers/staging/wilc1000/wilc_timer.c +++ b/drivers/staging/wilc1000/wilc_timer.c @@ -1,7 +1,7 @@ #include "wilc_timer.h" -WILC_ErrNo WILC_TimerCreate(WILC_TimerHandle *pHandle, +WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, tpfWILC_TimerFunction pfCallback, tstrWILC_TimerAttrs *pstrAttrs) { WILC_ErrNo s32RetStatus = WILC_SUCCESS; @@ -10,7 +10,7 @@ WILC_ErrNo WILC_TimerCreate(WILC_TimerHandle *pHandle, return s32RetStatus; } -WILC_ErrNo WILC_TimerDestroy(WILC_TimerHandle *pHandle, +WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle, tstrWILC_TimerAttrs *pstrAttrs) { WILC_ErrNo s32RetStatus = WILC_FAIL; @@ -23,7 +23,7 @@ WILC_ErrNo WILC_TimerDestroy(WILC_TimerHandle *pHandle, } -WILC_ErrNo WILC_TimerStart(WILC_TimerHandle *pHandle, u32 u32Timeout, +WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvArg, tstrWILC_TimerAttrs *pstrAttrs) { WILC_ErrNo s32RetStatus = WILC_FAIL; @@ -34,7 +34,7 @@ WILC_ErrNo WILC_TimerStart(WILC_TimerHandle *pHandle, u32 u32Timeout, return s32RetStatus; } -WILC_ErrNo WILC_TimerStop(WILC_TimerHandle *pHandle, +WILC_ErrNo WILC_TimerStop(struct timer_list *pHandle, tstrWILC_TimerAttrs *pstrAttrs) { WILC_ErrNo s32RetStatus = WILC_FAIL; diff --git a/drivers/staging/wilc1000/wilc_timer.h b/drivers/staging/wilc1000/wilc_timer.h index 931269db3194..c56ab9b62cc1 100644 --- a/drivers/staging/wilc1000/wilc_timer.h +++ b/drivers/staging/wilc1000/wilc_timer.h @@ -58,7 +58,7 @@ typedef struct { * @date 16 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_TimerCreate(WILC_TimerHandle *pHandle, +WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, tpfWILC_TimerFunction pfCallback, tstrWILC_TimerAttrs *pstrAttrs); @@ -77,7 +77,7 @@ WILC_ErrNo WILC_TimerCreate(WILC_TimerHandle *pHandle, * @date 16 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_TimerDestroy(WILC_TimerHandle *pHandle, +WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle, tstrWILC_TimerAttrs *pstrAttrs); /*! @@ -99,7 +99,7 @@ WILC_ErrNo WILC_TimerDestroy(WILC_TimerHandle *pHandle, * @date 16 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_TimerStart(WILC_TimerHandle *pHandle, u32 u32Timeout, void *pvArg, +WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvArg, tstrWILC_TimerAttrs *pstrAttrs); @@ -121,7 +121,7 @@ WILC_ErrNo WILC_TimerStart(WILC_TimerHandle *pHandle, u32 u32Timeout, void *pvAr * @date 16 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_TimerStop(WILC_TimerHandle *pHandle, +WILC_ErrNo WILC_TimerStop(struct timer_list *pHandle, tstrWILC_TimerAttrs *pstrAttrs); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 568c2a742d36..138d188adf56 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -32,9 +32,9 @@ extern int mac_close(struct net_device *ndev); tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; u32 u32LastScannedNtwrksCountShadow; #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP -WILC_TimerHandle hDuringIpTimer; +struct timer_list hDuringIpTimer; #endif -WILC_TimerHandle hAgingTimer; +struct timer_list hAgingTimer; static u8 op_ifcs; extern u8 u8ConnectedSSID[6]; From 334e1a5777290e118abcbb5aa5488c55961609b6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 20:00:01 -0700 Subject: [PATCH 893/912] staging: wilc1000: remove tstrWILC_TimerAttrs typedef It was not used for anything, so remove it, and the variables in wilc_timer.c that were being passed of its type. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 56 +++++++++---------- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_timer.c | 10 ++-- drivers/staging/wilc1000/wilc_timer.h | 28 ++-------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 16 +++--- 5 files changed, 45 insertions(+), 67 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8086b8b24fb8..1184327228ad 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1366,7 +1366,7 @@ static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHost WILC_CATCH(s32Error) { - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + WILC_TimerStop(&pstrWFIDrv->hScanTimer); /*if there is an ongoing scan request*/ Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); } @@ -1966,7 +1966,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps { tstrConnectInfo strConnectInfo; - WILC_TimerStop(&(pstrWFIDrv->hConnectTimer), NULL); + WILC_TimerStop(&pstrWFIDrv->hConnectTimer); PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); @@ -2477,7 +2477,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy } - WILC_TimerStop(&(pstrWFIDrv->hConnectTimer), NULL); + WILC_TimerStop(&pstrWFIDrv->hConnectTimer); pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, &strConnectInfo, u8MacStatus, @@ -2501,7 +2501,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); g_obtainingIP = true; - WILC_TimerStart(&hDuringIpTimer, 10000, NULL, NULL); + WILC_TimerStart(&hDuringIpTimer, 10000, NULL); #endif #ifdef WILC_PARSE_SCAN_IN_HOST @@ -2556,7 +2556,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + WILC_TimerStop(&pstrWFIDrv->hScanTimer); Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); } @@ -2633,7 +2633,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n"); PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); /*Abort the running scan*/ - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + WILC_TimerStop(&pstrWFIDrv->hScanTimer); if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); @@ -3067,7 +3067,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) strDisconnectNotifInfo.ie_len = 0; if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + WILC_TimerStop(&pstrWFIDrv->hScanTimer); pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); @@ -3080,7 +3080,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) /*Stop connect timer, if connection in progress*/ if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); - WILC_TimerStop(&(pstrWFIDrv->hConnectTimer), NULL); + WILC_TimerStop(&pstrWFIDrv->hConnectTimer); } pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, @@ -3849,7 +3849,7 @@ static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnCh WILC_CATCH(-1) { P2P_LISTEN_STATE = 1; - WILC_TimerStart(&(pstrWFIDrv->hRemainOnChannel), pstrHostIfRemainOnChan->u32duration, (void *)pstrWFIDrv, NULL); + WILC_TimerStart(&(pstrWFIDrv->hRemainOnChannel), pstrHostIfRemainOnChan->u32duration, (void *)pstrWFIDrv); /*Calling CFG ready_on_channel*/ if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) @@ -3984,7 +3984,7 @@ static void ListenTimerCB(void *pvArg) tstrHostIFmsg strHostIFmsg; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)pvArg; /*Stopping remain-on-channel timer*/ - WILC_TimerStop(&(pstrWFIDrv->hRemainOnChannel), NULL); + WILC_TimerStop(&pstrWFIDrv->hRemainOnChannel); /* prepare the Timer Callback message */ memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -4395,7 +4395,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_RCVD_SCAN_COMPLETE: - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + WILC_TimerStop(&pstrWFIDrv->hScanTimer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); /*BugID_5213*/ @@ -5485,7 +5485,7 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, } enuScanConnTimer = CONNECT_TIMER; - WILC_TimerStart(&(pstrWFIDrv->hConnectTimer), HOST_IF_CONNECT_TIMEOUT, (void *) hWFIDrv, NULL); + WILC_TimerStart(&(pstrWFIDrv->hConnectTimer), HOST_IF_CONNECT_TIMEOUT, (void *) hWFIDrv); WILC_CATCH(s32Error) { @@ -6218,7 +6218,7 @@ s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, enuScanConnTimer = SCAN_TIMER; PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); - WILC_TimerStart(&(pstrWFIDrv->hScanTimer), HOST_IF_SCAN_TIMEOUT, (void *) hWFIDrv, NULL); + WILC_TimerStart(&(pstrWFIDrv->hScanTimer), HOST_IF_SCAN_TIMEOUT, (void *) hWFIDrv); WILC_CATCH(s32Error) @@ -6441,7 +6441,7 @@ void GetPeriodicRSSI(void *pvArg) return; } } - WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv, NULL); + WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv); } @@ -6537,23 +6537,23 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) s32Error = WILC_FAIL; goto _fail_mq_; } - s32Error = WILC_TimerCreate(&(g_hPeriodicRSSI), GetPeriodicRSSI, NULL); + s32Error = WILC_TimerCreate(&(g_hPeriodicRSSI), GetPeriodicRSSI); if (s32Error < 0) { PRINT_ER("Failed to creat Timer\n"); goto _fail_timer_1; } - WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv, NULL); + WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv); } - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hScanTimer), TimerCB_Scan, NULL); + s32Error = WILC_TimerCreate(&(pstrWFIDrv->hScanTimer), TimerCB_Scan); if (s32Error < 0) { PRINT_ER("Failed to creat Timer\n"); goto _fail_thread_; } - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hConnectTimer), TimerCB_Connect, NULL); + s32Error = WILC_TimerCreate(&(pstrWFIDrv->hConnectTimer), TimerCB_Connect); if (s32Error < 0) { PRINT_ER("Failed to creat Timer\n"); goto _fail_timer_1; @@ -6562,7 +6562,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) #ifdef WILC_P2P /*Remain on channel timer*/ - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hRemainOnChannel), ListenTimerCB, NULL); + s32Error = WILC_TimerCreate(&(pstrWFIDrv->hRemainOnChannel), ListenTimerCB); if (s32Error < 0) { PRINT_ER("Failed to creat Remain-on-channel Timer\n"); goto _fail_timer_3; @@ -6618,13 +6618,13 @@ _fail_mem_: kfree(pstrWFIDrv); #ifdef WILC_P2P _fail_timer_3: - WILC_TimerDestroy(&(pstrWFIDrv->hRemainOnChannel), NULL); + WILC_TimerDestroy(&pstrWFIDrv->hRemainOnChannel); #endif _fail_timer_2: up(&(pstrWFIDrv->gtOsCfgValuesSem)); - WILC_TimerDestroy(&(pstrWFIDrv->hConnectTimer), NULL); + WILC_TimerDestroy(&pstrWFIDrv->hConnectTimer); _fail_timer_1: - WILC_TimerDestroy(&(pstrWFIDrv->hScanTimer), NULL); + WILC_TimerDestroy(&pstrWFIDrv->hScanTimer); _fail_thread_: kthread_stop(HostIFthreadHandler); _fail_mq_: @@ -6673,25 +6673,25 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) /*BugID_5348*/ /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ /*to guarantee handling all messages befor proceeding*/ - if (WILC_TimerDestroy(&(pstrWFIDrv->hScanTimer), NULL)) { + if (WILC_TimerDestroy(&pstrWFIDrv->hScanTimer)) { PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ } - if (WILC_TimerDestroy(&(pstrWFIDrv->hConnectTimer), NULL)) { + if (WILC_TimerDestroy(&pstrWFIDrv->hConnectTimer)) { PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } - if (WILC_TimerDestroy(&(g_hPeriodicRSSI), NULL)) { + if (WILC_TimerDestroy(&g_hPeriodicRSSI)) { PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } #ifdef WILC_P2P /*Destroy Remain-onchannel Timer*/ - WILC_TimerDestroy(&(pstrWFIDrv->hRemainOnChannel), NULL); + WILC_TimerDestroy(&pstrWFIDrv->hRemainOnChannel); #endif host_int_set_wfi_drv_handler(NULL); @@ -6715,7 +6715,7 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); if (clients_count == 1) { - if (WILC_TimerDestroy(&g_hPeriodicRSSI, NULL)) { + if (WILC_TimerDestroy(&g_hPeriodicRSSI)) { PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } @@ -6991,7 +6991,7 @@ s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /*Stopping remain-on-channel timer*/ - WILC_TimerStop(&(pstrWFIDrv->hRemainOnChannel), NULL); + WILC_TimerStop(&pstrWFIDrv->hRemainOnChannel); /* prepare the timer fire Message */ memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 5b6f698445fa..22053e57aa15 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -286,7 +286,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { pstrWFIDrv->IFC_UP = 1; g_obtainingIP = false; - WILC_TimerStop(&hDuringIpTimer, NULL); + WILC_TimerStop(&hDuringIpTimer); PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n"); } diff --git a/drivers/staging/wilc1000/wilc_timer.c b/drivers/staging/wilc1000/wilc_timer.c index 995f9c841f67..5b2a527f1d94 100644 --- a/drivers/staging/wilc1000/wilc_timer.c +++ b/drivers/staging/wilc1000/wilc_timer.c @@ -2,7 +2,7 @@ #include "wilc_timer.h" WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, - tpfWILC_TimerFunction pfCallback, tstrWILC_TimerAttrs *pstrAttrs) + tpfWILC_TimerFunction pfCallback) { WILC_ErrNo s32RetStatus = WILC_SUCCESS; setup_timer(pHandle, (void(*)(unsigned long))pfCallback, 0); @@ -10,8 +10,7 @@ WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, return s32RetStatus; } -WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle, - tstrWILC_TimerAttrs *pstrAttrs) +WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle) { WILC_ErrNo s32RetStatus = WILC_FAIL; if (pHandle != NULL) { @@ -24,7 +23,7 @@ WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle, WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, - void *pvArg, tstrWILC_TimerAttrs *pstrAttrs) + void *pvArg) { WILC_ErrNo s32RetStatus = WILC_FAIL; if (pHandle != NULL) { @@ -34,8 +33,7 @@ WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, return s32RetStatus; } -WILC_ErrNo WILC_TimerStop(struct timer_list *pHandle, - tstrWILC_TimerAttrs *pstrAttrs) +WILC_ErrNo WILC_TimerStop(struct timer_list *pHandle) { WILC_ErrNo s32RetStatus = WILC_FAIL; if (pHandle != NULL) diff --git a/drivers/staging/wilc1000/wilc_timer.h b/drivers/staging/wilc1000/wilc_timer.h index c56ab9b62cc1..529f299880a7 100644 --- a/drivers/staging/wilc1000/wilc_timer.h +++ b/drivers/staging/wilc1000/wilc_timer.h @@ -15,18 +15,6 @@ typedef void (*tpfWILC_TimerFunction)(void *); -/*! - * @struct tstrWILC_TimerAttrs - * @brief Timer API options - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -typedef struct { - /* a dummy member to avoid compiler errors*/ - u8 dummy; -} tstrWILC_TimerAttrs; - /*! * @brief Creates a new timer * @details Timers are a useful utility to execute some callback function @@ -51,7 +39,6 @@ typedef struct { * and only flags other threads to do the actual work * also it should be noted that the underlaying OS maynot give any * guarentees on which contect this callback will execute in - * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure * @sa WILC_TimerAttrs * @author syounan @@ -59,7 +46,7 @@ typedef struct { * @version 1.0 */ WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, - tpfWILC_TimerFunction pfCallback, tstrWILC_TimerAttrs *pstrAttrs); + tpfWILC_TimerFunction pfCallback); /*! @@ -70,15 +57,13 @@ WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, * if the timer was EXECUTING then the callback will be allowed to * finish first then all resources are freed * @param[in] pHandle handle to the timer object - * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure * @sa WILC_TimerAttrs * @author syounan * @date 16 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle, - tstrWILC_TimerAttrs *pstrAttrs); +WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle); /*! * @brief Starts a given timer @@ -91,16 +76,13 @@ WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle, * @param[in] u32Timeout timeout value in msec after witch the callback * function will be executed. Timeout value of 0 is not allowed for * periodic timers - * @param[in] pstrAttrs Optional attributes, NULL for default, - * set bPeriodicTimer to run this timer as a periodic timer * @return Error code indicating sucess/failure * @sa WILC_TimerAttrs * @author syounan * @date 16 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvArg, - tstrWILC_TimerAttrs *pstrAttrs); +WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvArg); /*! @@ -114,15 +96,13 @@ WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvA * done then move the timer to the IDLE state (which is trivial * work if the timer is non periodic) * @param[in] pHandle handle to the timer object - * @param[in] pstrAttrs Optional attributes, NULL for default, * @return Error code indicating sucess/failure * @sa WILC_TimerAttrs * @author syounan * @date 16 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_TimerStop(struct timer_list *pHandle, - tstrWILC_TimerAttrs *pstrAttrs); +WILC_ErrNo WILC_TimerStop(struct timer_list *pHandle); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 138d188adf56..a505677d47d8 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -145,7 +145,7 @@ void clear_shadow_scan(void *pUserVoid) { int i; if (op_ifcs == 0) { - WILC_TimerDestroy(&hAgingTimer, NULL); + WILC_TimerDestroy(&hAgingTimer); PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n"); for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { @@ -257,7 +257,7 @@ void remove_network_from_shadow(void *pUserVoid) PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", u32LastScannedNtwrksCountShadow); if (u32LastScannedNtwrksCountShadow != 0) - WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid, NULL); + WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid); else PRINT_D(CFG80211_DBG, "No need to restart Aging timer\n"); } @@ -277,7 +277,7 @@ int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) if (u32LastScannedNtwrksCountShadow == 0) { PRINT_D(CFG80211_DBG, "Starting Aging timer\n"); - WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid, NULL); + WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid); state = -1; } else { /* Linear search for now */ @@ -2843,7 +2843,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = false; - WILC_TimerStop(&hDuringIpTimer, NULL); + WILC_TimerStop(&hDuringIpTimer); PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n"); #endif /*BugID_5137*/ @@ -3069,7 +3069,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = true; - WILC_TimerStart(&hDuringIpTimer, duringIP_TIME, NULL, NULL); + WILC_TimerStart(&hDuringIpTimer, duringIP_TIME, NULL); #endif host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); /*BugID_5222*/ @@ -3824,9 +3824,9 @@ int WILC_WFI_InitHostInt(struct net_device *net) PRINT_D(INIT_DBG, "Host[%p][%p]\n", net, net->ieee80211_ptr); priv = wdev_priv(net->ieee80211_ptr); if (op_ifcs == 0) { - s32Error = WILC_TimerCreate(&(hAgingTimer), remove_network_from_shadow, NULL); + s32Error = WILC_TimerCreate(&(hAgingTimer), remove_network_from_shadow); #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP - s32Error = WILC_TimerCreate(&(hDuringIpTimer), clear_duringIP, NULL); + s32Error = WILC_TimerCreate(&(hDuringIpTimer), clear_duringIP); #endif } op_ifcs++; @@ -3876,7 +3876,7 @@ int WILC_WFI_DeInitHostInt(struct net_device *net) #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP if (op_ifcs == 0) { PRINT_D(CORECONFIG_DBG, "destroy during ip\n"); - WILC_TimerDestroy(&hDuringIpTimer, NULL); + WILC_TimerDestroy(&hDuringIpTimer); } #endif From 8972d0fe41e1869b0c7f4c164ea7bffc073dd6b8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 20:04:13 -0700 Subject: [PATCH 894/912] staging: wilc1000: remove WILC_TimerStop() It was just a wrapper around del_timer() so call that instead. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 20 ++++++++--------- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_timer.c | 9 -------- drivers/staging/wilc1000/wilc_timer.h | 22 ------------------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 5 files changed, 12 insertions(+), 43 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 1184327228ad..ca806902ebb7 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1366,7 +1366,7 @@ static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHost WILC_CATCH(s32Error) { - WILC_TimerStop(&pstrWFIDrv->hScanTimer); + del_timer(&pstrWFIDrv->hScanTimer); /*if there is an ongoing scan request*/ Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); } @@ -1966,7 +1966,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps { tstrConnectInfo strConnectInfo; - WILC_TimerStop(&pstrWFIDrv->hConnectTimer); + del_timer(&pstrWFIDrv->hConnectTimer); PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); @@ -2477,7 +2477,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy } - WILC_TimerStop(&pstrWFIDrv->hConnectTimer); + del_timer(&pstrWFIDrv->hConnectTimer); pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, &strConnectInfo, u8MacStatus, @@ -2556,7 +2556,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); - WILC_TimerStop(&pstrWFIDrv->hScanTimer); + del_timer(&pstrWFIDrv->hScanTimer); Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); } @@ -2633,7 +2633,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n"); PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); /*Abort the running scan*/ - WILC_TimerStop(&pstrWFIDrv->hScanTimer); + del_timer(&pstrWFIDrv->hScanTimer); if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); @@ -3067,7 +3067,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) strDisconnectNotifInfo.ie_len = 0; if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { - WILC_TimerStop(&pstrWFIDrv->hScanTimer); + del_timer(&pstrWFIDrv->hScanTimer); pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); @@ -3080,7 +3080,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) /*Stop connect timer, if connection in progress*/ if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); - WILC_TimerStop(&pstrWFIDrv->hConnectTimer); + del_timer(&pstrWFIDrv->hConnectTimer); } pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, @@ -3984,7 +3984,7 @@ static void ListenTimerCB(void *pvArg) tstrHostIFmsg strHostIFmsg; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)pvArg; /*Stopping remain-on-channel timer*/ - WILC_TimerStop(&pstrWFIDrv->hRemainOnChannel); + del_timer(&pstrWFIDrv->hRemainOnChannel); /* prepare the Timer Callback message */ memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); @@ -4395,7 +4395,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_RCVD_SCAN_COMPLETE: - WILC_TimerStop(&pstrWFIDrv->hScanTimer); + del_timer(&pstrWFIDrv->hScanTimer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); /*BugID_5213*/ @@ -6991,7 +6991,7 @@ s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); /*Stopping remain-on-channel timer*/ - WILC_TimerStop(&pstrWFIDrv->hRemainOnChannel); + del_timer(&pstrWFIDrv->hRemainOnChannel); /* prepare the timer fire Message */ memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 22053e57aa15..7eacc2f326df 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -286,7 +286,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { pstrWFIDrv->IFC_UP = 1; g_obtainingIP = false; - WILC_TimerStop(&hDuringIpTimer); + del_timer(&hDuringIpTimer); PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n"); } diff --git a/drivers/staging/wilc1000/wilc_timer.c b/drivers/staging/wilc1000/wilc_timer.c index 5b2a527f1d94..3617093f58f2 100644 --- a/drivers/staging/wilc1000/wilc_timer.c +++ b/drivers/staging/wilc1000/wilc_timer.c @@ -32,12 +32,3 @@ WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, } return s32RetStatus; } - -WILC_ErrNo WILC_TimerStop(struct timer_list *pHandle) -{ - WILC_ErrNo s32RetStatus = WILC_FAIL; - if (pHandle != NULL) - s32RetStatus = del_timer(pHandle); - - return s32RetStatus; -} diff --git a/drivers/staging/wilc1000/wilc_timer.h b/drivers/staging/wilc1000/wilc_timer.h index 529f299880a7..870a6950f6cd 100644 --- a/drivers/staging/wilc1000/wilc_timer.h +++ b/drivers/staging/wilc1000/wilc_timer.h @@ -84,26 +84,4 @@ WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle); */ WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvArg); - -/*! - * @brief Stops a given timer - * @details This function will move the timer to the IDLE state cancelling - * any sheduled callback execution. - * if this function is called on a timer already in the IDLE state - * it will have no effect. - * if this function is called on a timer in EXECUTING state - * (callback has already started) it will wait until executing is - * done then move the timer to the IDLE state (which is trivial - * work if the timer is non periodic) - * @param[in] pHandle handle to the timer object - * @return Error code indicating sucess/failure - * @sa WILC_TimerAttrs - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_TimerStop(struct timer_list *pHandle); - - - #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index a505677d47d8..0e79bd3f964f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2843,7 +2843,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = false; - WILC_TimerStop(&hDuringIpTimer); + del_timer(&hDuringIpTimer); PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n"); #endif /*BugID_5137*/ From 4183e9794c751c5139e4599a0c512c7804575a82 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 20:11:16 -0700 Subject: [PATCH 895/912] staging: wilc1000: remove WILC_TimerDestroy() It was just a wrapper around del_timer_sync() so call that instead. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 16 ++++++++-------- drivers/staging/wilc1000/wilc_timer.c | 12 ------------ drivers/staging/wilc1000/wilc_timer.h | 17 ----------------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ca806902ebb7..887aec27192f 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -6618,13 +6618,13 @@ _fail_mem_: kfree(pstrWFIDrv); #ifdef WILC_P2P _fail_timer_3: - WILC_TimerDestroy(&pstrWFIDrv->hRemainOnChannel); + del_timer_sync(&pstrWFIDrv->hRemainOnChannel); #endif _fail_timer_2: up(&(pstrWFIDrv->gtOsCfgValuesSem)); - WILC_TimerDestroy(&pstrWFIDrv->hConnectTimer); + del_timer_sync(&pstrWFIDrv->hConnectTimer); _fail_timer_1: - WILC_TimerDestroy(&pstrWFIDrv->hScanTimer); + del_timer_sync(&pstrWFIDrv->hScanTimer); _fail_thread_: kthread_stop(HostIFthreadHandler); _fail_mq_: @@ -6673,25 +6673,25 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) /*BugID_5348*/ /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ /*to guarantee handling all messages befor proceeding*/ - if (WILC_TimerDestroy(&pstrWFIDrv->hScanTimer)) { + if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ } - if (WILC_TimerDestroy(&pstrWFIDrv->hConnectTimer)) { + if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } - if (WILC_TimerDestroy(&g_hPeriodicRSSI)) { + if (del_timer_sync(&g_hPeriodicRSSI)) { PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } #ifdef WILC_P2P /*Destroy Remain-onchannel Timer*/ - WILC_TimerDestroy(&pstrWFIDrv->hRemainOnChannel); + del_timer_sync(&pstrWFIDrv->hRemainOnChannel); #endif host_int_set_wfi_drv_handler(NULL); @@ -6715,7 +6715,7 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); if (clients_count == 1) { - if (WILC_TimerDestroy(&g_hPeriodicRSSI)) { + if (del_timer_sync(&g_hPeriodicRSSI)) { PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } diff --git a/drivers/staging/wilc1000/wilc_timer.c b/drivers/staging/wilc1000/wilc_timer.c index 3617093f58f2..49e3419d7114 100644 --- a/drivers/staging/wilc1000/wilc_timer.c +++ b/drivers/staging/wilc1000/wilc_timer.c @@ -10,18 +10,6 @@ WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, return s32RetStatus; } -WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle) -{ - WILC_ErrNo s32RetStatus = WILC_FAIL; - if (pHandle != NULL) { - s32RetStatus = del_timer_sync(pHandle); - pHandle = NULL; - } - - return s32RetStatus; -} - - WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvArg) { diff --git a/drivers/staging/wilc1000/wilc_timer.h b/drivers/staging/wilc1000/wilc_timer.h index 870a6950f6cd..925c613598d5 100644 --- a/drivers/staging/wilc1000/wilc_timer.h +++ b/drivers/staging/wilc1000/wilc_timer.h @@ -48,23 +48,6 @@ typedef void (*tpfWILC_TimerFunction)(void *); WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, tpfWILC_TimerFunction pfCallback); - -/*! - * @brief Destroys a given timer - * @details This will destroy a given timer freeing any resources used by it - * if the timer was PENDING Then must be cancelled as well(i.e. - * goes to IDLE, same effect as calling WILC_TimerCancel first) - * if the timer was EXECUTING then the callback will be allowed to - * finish first then all resources are freed - * @param[in] pHandle handle to the timer object - * @return Error code indicating sucess/failure - * @sa WILC_TimerAttrs - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_TimerDestroy(struct timer_list *pHandle); - /*! * @brief Starts a given timer * @details This function will move the timer to the PENDING state until the diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 0e79bd3f964f..b29ea90da56f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -145,7 +145,7 @@ void clear_shadow_scan(void *pUserVoid) { int i; if (op_ifcs == 0) { - WILC_TimerDestroy(&hAgingTimer); + del_timer_sync(&hAgingTimer); PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n"); for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { @@ -3876,7 +3876,7 @@ int WILC_WFI_DeInitHostInt(struct net_device *net) #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP if (op_ifcs == 0) { PRINT_D(CORECONFIG_DBG, "destroy during ip\n"); - WILC_TimerDestroy(&hDuringIpTimer); + del_timer_sync(&hDuringIpTimer); } #endif From 93dee8eea02aefebe2d21128b5f742afe6671f23 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 14 Aug 2015 20:28:32 -0700 Subject: [PATCH 896/912] staging: wilc1000: remove WILC_TimerCreate() It was just a wrapper around setup_timer() and could never fail, so just call the real function, and fix up the function arguments of the callbacks to be proper timer callback functions. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 42 ++++++------------- drivers/staging/wilc1000/wilc_timer.c | 9 ---- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++--- 3 files changed, 17 insertions(+), 44 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 887aec27192f..bab53195edfb 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3978,11 +3978,11 @@ _done_: * @date * @version 1.0 */ -static void ListenTimerCB(void *pvArg) +static void ListenTimerCB(unsigned long arg) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; - tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)pvArg; + tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; /*Stopping remain-on-channel timer*/ del_timer(&pstrWFIDrv->hRemainOnChannel); @@ -4542,8 +4542,9 @@ static int hostIFthread(void *pvArg) return 0; } -static void TimerCB_Scan(void *pvArg) +static void TimerCB_Scan(unsigned long arg) { + void *pvArg = (void *)arg; tstrHostIFmsg strHostIFmsg; /* prepare the Timer Callback message */ @@ -4555,8 +4556,9 @@ static void TimerCB_Scan(void *pvArg) WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); } -static void TimerCB_Connect(void *pvArg) +static void TimerCB_Connect(unsigned long arg) { + void *pvArg = (void *)arg; tstrHostIFmsg strHostIFmsg; /* prepare the Timer Callback message */ @@ -6415,9 +6417,9 @@ void host_int_send_join_leave_info_to_host * @version 1.0 */ -void GetPeriodicRSSI(void *pvArg) +static void GetPeriodicRSSI(unsigned long arg) { - tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)pvArg; + tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; if (pstrWFIDrv == NULL) { PRINT_ER("Driver handler is NULL\n"); @@ -6537,36 +6539,19 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) s32Error = WILC_FAIL; goto _fail_mq_; } - s32Error = WILC_TimerCreate(&(g_hPeriodicRSSI), GetPeriodicRSSI); - if (s32Error < 0) { - PRINT_ER("Failed to creat Timer\n"); - goto _fail_timer_1; - } + setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, 0); WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv); } - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hScanTimer), TimerCB_Scan); - if (s32Error < 0) { - PRINT_ER("Failed to creat Timer\n"); - goto _fail_thread_; - } - - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hConnectTimer), TimerCB_Connect); - if (s32Error < 0) { - PRINT_ER("Failed to creat Timer\n"); - goto _fail_timer_1; - } + setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); + setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); #ifdef WILC_P2P /*Remain on channel timer*/ - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hRemainOnChannel), ListenTimerCB); - if (s32Error < 0) { - PRINT_ER("Failed to creat Remain-on-channel Timer\n"); - goto _fail_timer_3; - } + setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); #endif sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); @@ -6617,15 +6602,12 @@ _fail_mem_: if (pstrWFIDrv != NULL) kfree(pstrWFIDrv); #ifdef WILC_P2P -_fail_timer_3: del_timer_sync(&pstrWFIDrv->hRemainOnChannel); #endif _fail_timer_2: up(&(pstrWFIDrv->gtOsCfgValuesSem)); del_timer_sync(&pstrWFIDrv->hConnectTimer); -_fail_timer_1: del_timer_sync(&pstrWFIDrv->hScanTimer); -_fail_thread_: kthread_stop(HostIFthreadHandler); _fail_mq_: WILC_MsgQueueDestroy(&gMsgQHostIF, NULL); diff --git a/drivers/staging/wilc1000/wilc_timer.c b/drivers/staging/wilc1000/wilc_timer.c index 49e3419d7114..775e38bda944 100644 --- a/drivers/staging/wilc1000/wilc_timer.c +++ b/drivers/staging/wilc1000/wilc_timer.c @@ -1,15 +1,6 @@ #include "wilc_timer.h" -WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, - tpfWILC_TimerFunction pfCallback) -{ - WILC_ErrNo s32RetStatus = WILC_SUCCESS; - setup_timer(pHandle, (void(*)(unsigned long))pfCallback, 0); - - return s32RetStatus; -} - WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvArg) { diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index b29ea90da56f..c2f8d605c176 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -231,7 +231,7 @@ void update_scan_time(void *pUserVoid) } } -void remove_network_from_shadow(void *pUserVoid) +static void remove_network_from_shadow(unsigned long arg) { unsigned long now = jiffies; int i, j; @@ -257,13 +257,13 @@ void remove_network_from_shadow(void *pUserVoid) PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", u32LastScannedNtwrksCountShadow); if (u32LastScannedNtwrksCountShadow != 0) - WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid); + WILC_TimerStart(&(hAgingTimer), AGING_TIME, (void *)arg); else PRINT_D(CFG80211_DBG, "No need to restart Aging timer\n"); } #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP -void clear_duringIP(void *pUserVoid) +static void clear_duringIP(unsigned long arg) { PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n"); g_obtainingIP = false; @@ -3824,9 +3824,9 @@ int WILC_WFI_InitHostInt(struct net_device *net) PRINT_D(INIT_DBG, "Host[%p][%p]\n", net, net->ieee80211_ptr); priv = wdev_priv(net->ieee80211_ptr); if (op_ifcs == 0) { - s32Error = WILC_TimerCreate(&(hAgingTimer), remove_network_from_shadow); + setup_timer(&hAgingTimer, remove_network_from_shadow, 0); #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP - s32Error = WILC_TimerCreate(&(hDuringIpTimer), clear_duringIP); + setup_timer(&hDuringIpTimer, clear_duringIP, 0); #endif } op_ifcs++; From 9eb066438b01bc70ef915987f881d3e57e698a30 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2015 11:10:55 -0700 Subject: [PATCH 897/912] staging: wilc1000: remove WILC_TimerStart() It was a wrapper around mod_timer() so replace it with the real timer call and remove wilc_timer.c as it's now empty. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 2 +- drivers/staging/wilc1000/host_interface.c | 25 ++++++++++++------- drivers/staging/wilc1000/wilc_timer.c | 13 ---------- drivers/staging/wilc1000/wilc_timer.h | 20 --------------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 13 ++++++---- 5 files changed, 25 insertions(+), 48 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_timer.c diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index a6bfb838c431..6be8a920706a 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -27,7 +27,7 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ wilc_memory.o wilc_msgqueue.o \ - wilc_timer.o coreconfigurator.o host_interface.o \ + coreconfigurator.o host_interface.o \ wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index bab53195edfb..0060b13c9d25 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2501,7 +2501,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); g_obtainingIP = true; - WILC_TimerStart(&hDuringIpTimer, 10000, NULL); + mod_timer(&hDuringIpTimer, + jiffies + msecs_to_jiffies(10000)); #endif #ifdef WILC_PARSE_SCAN_IN_HOST @@ -3849,7 +3850,10 @@ static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnCh WILC_CATCH(-1) { P2P_LISTEN_STATE = 1; - WILC_TimerStart(&(pstrWFIDrv->hRemainOnChannel), pstrHostIfRemainOnChan->u32duration, (void *)pstrWFIDrv); + pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; + mod_timer(&pstrWFIDrv->hRemainOnChannel, + jiffies + + msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); /*Calling CFG ready_on_channel*/ if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) @@ -5487,7 +5491,9 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, } enuScanConnTimer = CONNECT_TIMER; - WILC_TimerStart(&(pstrWFIDrv->hConnectTimer), HOST_IF_CONNECT_TIMEOUT, (void *) hWFIDrv); + pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; + mod_timer(&pstrWFIDrv->hConnectTimer, + jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); WILC_CATCH(s32Error) { @@ -6220,8 +6226,9 @@ s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, enuScanConnTimer = SCAN_TIMER; PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); - WILC_TimerStart(&(pstrWFIDrv->hScanTimer), HOST_IF_SCAN_TIMEOUT, (void *) hWFIDrv); - + pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; + mod_timer(&pstrWFIDrv->hScanTimer, + jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); WILC_CATCH(s32Error) { @@ -6443,7 +6450,8 @@ static void GetPeriodicRSSI(unsigned long arg) return; } } - WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv); + g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; + mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); } @@ -6539,9 +6547,8 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) s32Error = WILC_FAIL; goto _fail_mq_; } - setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, 0); - WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv); - + setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, pstrWFIDrv); + mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); } diff --git a/drivers/staging/wilc1000/wilc_timer.c b/drivers/staging/wilc1000/wilc_timer.c deleted file mode 100644 index 775e38bda944..000000000000 --- a/drivers/staging/wilc1000/wilc_timer.c +++ /dev/null @@ -1,13 +0,0 @@ - -#include "wilc_timer.h" - -WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, - void *pvArg) -{ - WILC_ErrNo s32RetStatus = WILC_FAIL; - if (pHandle != NULL) { - pHandle->data = (unsigned long)pvArg; - s32RetStatus = mod_timer(pHandle, (jiffies + msecs_to_jiffies(u32Timeout))); - } - return s32RetStatus; -} diff --git a/drivers/staging/wilc1000/wilc_timer.h b/drivers/staging/wilc1000/wilc_timer.h index 925c613598d5..dbf34e4497ec 100644 --- a/drivers/staging/wilc1000/wilc_timer.h +++ b/drivers/staging/wilc1000/wilc_timer.h @@ -47,24 +47,4 @@ typedef void (*tpfWILC_TimerFunction)(void *); */ WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, tpfWILC_TimerFunction pfCallback); - -/*! - * @brief Starts a given timer - * @details This function will move the timer to the PENDING state until the - * given time expires (in msec) then the callback function will be - * executed (timer in EXECUTING state) after execution is dene the - * timer either goes to IDLE (if bPeriodicTimer==false) or - * PENDING with same timeout value (if bPeriodicTimer==true) - * @param[in] pHandle handle to the timer object - * @param[in] u32Timeout timeout value in msec after witch the callback - * function will be executed. Timeout value of 0 is not allowed for - * periodic timers - * @return Error code indicating sucess/failure - * @sa WILC_TimerAttrs - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_TimerStart(struct timer_list *pHandle, u32 u32Timeout, void *pvArg); - #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index c2f8d605c176..c3355c0dcd53 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -256,10 +256,12 @@ static void remove_network_from_shadow(unsigned long arg) } PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", u32LastScannedNtwrksCountShadow); - if (u32LastScannedNtwrksCountShadow != 0) - WILC_TimerStart(&(hAgingTimer), AGING_TIME, (void *)arg); - else + if (u32LastScannedNtwrksCountShadow != 0) { + hAgingTimer.data = arg; + mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); + } else { PRINT_D(CFG80211_DBG, "No need to restart Aging timer\n"); + } } #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP @@ -277,7 +279,8 @@ int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) if (u32LastScannedNtwrksCountShadow == 0) { PRINT_D(CFG80211_DBG, "Starting Aging timer\n"); - WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid); + hAgingTimer.data = (unsigned long)pUserVoid; + mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); state = -1; } else { /* Linear search for now */ @@ -3069,7 +3072,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = true; - WILC_TimerStart(&hDuringIpTimer, duringIP_TIME, NULL); + mod_timer(&hDuringIpTimer, jiffies + msecs_to_jiffies(duringIP_TIME)); #endif host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); /*BugID_5222*/ From 97fd0f07d4d3f71c20ef4a4f5a65eb461290ca1c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2015 11:12:49 -0700 Subject: [PATCH 898/912] staging: wilc1000: delete wilc_timer.h It is no longer needed at all, so remove this header file. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_oswrapper.h | 3 -- drivers/staging/wilc1000/wilc_timer.h | 50 ----------------------- 2 files changed, 53 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_timer.h diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index 374e33b528b7..456a8bb60835 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -23,9 +23,6 @@ /* Error reporting and handling support */ #include "wilc_errorsupport.h" -/* Timer support */ -#include "wilc_timer.h" - /* Memory support */ #include "wilc_memory.h" diff --git a/drivers/staging/wilc1000/wilc_timer.h b/drivers/staging/wilc1000/wilc_timer.h deleted file mode 100644 index dbf34e4497ec..000000000000 --- a/drivers/staging/wilc1000/wilc_timer.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef __WILC_TIMER_H__ -#define __WILC_TIMER_H__ - -/*! - * @file wilc_timer.h - * @brief Timer (One Shot and Periodic) OS wrapper functionality - * @author syounan - * @sa wilc_oswrapper.h top level OS wrapper file - * @date 16 Aug 2010 - * @version 1.0 - */ - -#include "wilc_platform.h" -#include "wilc_errorsupport.h" - -typedef void (*tpfWILC_TimerFunction)(void *); - -/*! - * @brief Creates a new timer - * @details Timers are a useful utility to execute some callback function - * in the future. - * A timer object has 3 states : IDLE, PENDING and EXECUTING - * IDLE : initial timer state after creation, no execution for the - * callback function is planned - * PENDING : a request to execute the callback function is made - * using WILC_TimerStart. - * EXECUTING : the timer has expired and its callback is now - * executing, when execution is done the timer returns to PENDING - * if the feature CONFIG_WILC_TIMER_PERIODIC is enabled and - * the flag tstrWILC_TimerAttrs.bPeriodicTimer is set. otherwise the - * timer will return to IDLE - * @param[out] pHandle handle to the newly created timer object - * @param[in] pfEntry pointer to the callback function to be called when the - * timer expires - * the underlaying OS may put many restrictions on what can be - * called inside a timer's callback, as a general rule no blocking - * operations (IO or semaphore Acquision) should be perfomred - * It is recommended that the callback will be as short as possible - * and only flags other threads to do the actual work - * also it should be noted that the underlaying OS maynot give any - * guarentees on which contect this callback will execute in - * @return Error code indicating sucess/failure - * @sa WILC_TimerAttrs - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_TimerCreate(struct timer_list *pHandle, - tpfWILC_TimerFunction pfCallback); -#endif From 6e53191d6e15b7afb71dfbd3134c567fcc4eb2cd Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2015 11:17:57 -0700 Subject: [PATCH 899/912] staging: wilc1000: delete wilc_log.h The macros are not used in the driver at all, except in one commented out line, so just remove the .h file so that no one thinks it is a good idea to add any code to use them in the future. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 2 - drivers/staging/wilc1000/wilc_log.h | 47 --------------------- drivers/staging/wilc1000/wilc_oswrapper.h | 3 -- 3 files changed, 52 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_log.h diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index c81c41d77c30..1a5b16577fd5 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1438,8 +1438,6 @@ void ProcessAdrWid(char *pcPacket, s32 *ps32PktLen, void ProcessBinWid(char *pcPacket, s32 *ps32PktLen, tstrWID *pstrWID, u8 *pu8val, s32 s32ValueSize) { - /* WILC_ERROR("processing Binary WIDs is not supported\n"); */ - u16 u16MsgLen = 0; u16 idx = 0; s32 s32PktLen = *ps32PktLen; diff --git a/drivers/staging/wilc1000/wilc_log.h b/drivers/staging/wilc1000/wilc_log.h deleted file mode 100644 index 2269ebdec129..000000000000 --- a/drivers/staging/wilc1000/wilc_log.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __WILC_LOG_H__ -#define __WILC_LOG_H__ - -/* Errors will always get printed */ -#define WILC_ERROR(...) do { WILC_PRINTF("(ERR)(%s:%d) ", __WILC_FUNCTION__, __WILC_LINE__); \ - WILC_PRINTF(__VA_ARGS__); \ - } while (0) - -/* Wraning only printed if verbosity is 1 or more */ -#if (WILC_LOG_VERBOSITY_LEVEL > 0) -#define WILC_WARN(...) do { WILC_PRINTF("(WRN)"); \ - WILC_PRINTF(__VA_ARGS__); \ - } while (0) -#else -#define WILC_WARN(...) (0) -#endif - -/* Info only printed if verbosity is 2 or more */ -#if (WILC_LOG_VERBOSITY_LEVEL > 1) -#define WILC_INFO(...) do { WILC_PRINTF("(INF)"); \ - WILC_PRINTF(__VA_ARGS__); \ - } while (0) -#else -#define WILC_INFO(...) (0) -#endif - -/* Debug is only printed if verbosity is 3 or more */ -#if (WILC_LOG_VERBOSITY_LEVEL > 2) -#define WILC_DBG(...) do { WILC_PRINTF("(DBG)(%s:%d) ", __WILC_FUNCTION__, __WILC_LINE__); \ - WILC_PRINTF(__VA_ARGS__); \ - } while (0) - -#else -#define WILC_DBG(...) (0) -#endif - -/* Function In/Out is only printed if verbosity is 4 or more */ -#if (WILC_LOG_VERBOSITY_LEVEL > 3) -#define WILC_FN_IN do { WILC_PRINTF("(FIN) (%s:%d) \n", __WILC_FUNCTION__, __WILC_LINE__); } while (0) -#define WILC_FN_OUT(ret) do { WILC_PRINTF("(FOUT) (%s:%d) %d.\n", __WILC_FUNCTION__, __WILC_LINE__, (ret)); } while (0) -#else -#define WILC_FN_IN (0) -#define WILC_FN_OUT(ret) (0) -#endif - - -#endif \ No newline at end of file diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index 456a8bb60835..ca575c9abd35 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -17,9 +17,6 @@ #include "wilc_osconfig.h" #include "wilc_platform.h" -/* Logging Functions */ -#include "wilc_log.h" - /* Error reporting and handling support */ #include "wilc_errorsupport.h" From 2b5f12eac0ce4e6ffa5788400750da0a60fe8678 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2015 11:20:57 -0700 Subject: [PATCH 900/912] staging: wilc1000: delete wilc_osconfig.h This .h file isn't needed at all, so delete it, and the one line that added it to the build. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_osconfig.h | 9 --------- drivers/staging/wilc1000/wilc_oswrapper.h | 1 - 2 files changed, 10 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_osconfig.h diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h deleted file mode 100644 index f9c25140393e..000000000000 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Logs options */ -#define WILC_LOGS_NOTHING 0 -#define WILC_LOGS_WARN 1 -#define WILC_LOGS_WARN_INFO 2 -#define WILC_LOGS_WARN_INFO_DBG 3 -#define WILC_LOGS_WARN_INFO_DBG_FN 4 -#define WILC_LOGS_ALL 5 - -#define WILC_LOG_VERBOSITY_LEVEL WILC_LOGS_ALL diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index ca575c9abd35..cb483253e788 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -14,7 +14,6 @@ #define WILC_OSW_INTERFACE_VER 2 /* Os Configuration File */ -#include "wilc_osconfig.h" #include "wilc_platform.h" /* Error reporting and handling support */ From c4f83a5571981c92b028c8e9a9da827598905059 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2015 11:32:38 -0700 Subject: [PATCH 901/912] staging: wilc1000: remove unneeded tstrWILC_MsgQueueAttrs typedef No one uses it, so remove it and all of the NULL parameters being used to pass it into the msg code. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 110 +++++++++++----------- drivers/staging/wilc1000/wilc_msgqueue.c | 12 +-- drivers/staging/wilc1000/wilc_msgqueue.h | 34 +------ 3 files changed, 61 insertions(+), 95 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0060b13c9d25..c473877246cc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3997,7 +3997,7 @@ static void ListenTimerCB(unsigned long arg) strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -4332,7 +4332,7 @@ static int hostIFthread(void *pvArg) memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); while (1) { - WILC_MsgQueueRecv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret, NULL); + WILC_MsgQueueRecv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret); pstrWFIDrv = (tstrWILC_WFIDrv *)strHostIFmsg.drvHandler; if (strHostIFmsg.u16MsgId == HOST_IF_MSG_EXIT) { PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); @@ -4344,13 +4344,13 @@ static int hostIFthread(void *pvArg) if ((!g_wilc_initialized)) { PRINT_D(GENERIC_DBG, "--WAIT--"); usleep_range(200 * 1000, 200 * 1000); - WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); continue; } if (strHostIFmsg.u16MsgId == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); - WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); usleep_range(2 * 1000, 2 * 1000); continue; } @@ -4557,7 +4557,7 @@ static void TimerCB_Scan(unsigned long arg) strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN_TIMER_FIRED; /* send the message */ - WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); } static void TimerCB_Connect(unsigned long arg) @@ -4571,7 +4571,7 @@ static void TimerCB_Connect(unsigned long arg) strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT_TIMER_FIRED; /* send the message */ - WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); } @@ -4642,7 +4642,7 @@ s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); down(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -4690,7 +4690,7 @@ s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue : Default key index\n"); down(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -4757,7 +4757,7 @@ s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue :WEP Key\n"); down(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -4832,7 +4832,7 @@ s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue :WEP Key\n"); @@ -4931,7 +4931,7 @@ s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue: PTK Key\n"); @@ -5033,7 +5033,7 @@ s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKe /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue: RX GTK\n"); /* ////////////// */ @@ -5096,7 +5096,7 @@ s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8Pm } /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); @@ -5198,7 +5198,7 @@ s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send get mac address\n"); return WILC_FAIL; @@ -5232,7 +5232,7 @@ s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send message queue: Set mac address\n"); WILC_ERRORREPORT(s32Error, s32Error); @@ -5484,7 +5484,7 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send message queue: Set join request\n"); WILC_ERRORREPORT(s32Error, WILC_FAIL); @@ -5534,7 +5534,7 @@ s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send message queue: Flush join request\n"); WILC_ERRORREPORT(s32Error, WILC_FAIL); @@ -5581,7 +5581,7 @@ s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Failed to send message queue: disconnect\n"); /* ////////////// */ @@ -5770,7 +5770,7 @@ s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan.u8SetChan = u8ChNum; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -5792,7 +5792,7 @@ s32 host_int_wait_msg_queue_idle(void) memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_Q_IDLE; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -5821,7 +5821,7 @@ s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = u32address; /* strHostIFmsg.drvHandler=hWFIDrv; */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -5848,7 +5848,7 @@ s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode.u32Mode = u32mode; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -5892,7 +5892,7 @@ s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Failed to send get host channel param's message queue "); down(&(pstrWFIDrv->hSemGetCHNL)); @@ -5988,7 +5988,7 @@ s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu3 strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Failed to send get host channel param's message queue "); @@ -6076,7 +6076,7 @@ s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send get host channel param's message queue "); return WILC_FAIL; @@ -6113,7 +6113,7 @@ s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send GET_LINKSPEED to message queue "); return WILC_FAIL; @@ -6147,7 +6147,7 @@ s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatis strHostIFmsg.uniHostIFmsgBody.pUserData = (char *)pstrStatistics; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send get host channel param's message queue "); return WILC_FAIL; @@ -6218,7 +6218,7 @@ s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, pu8IEs, IEsLen); /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Error in sending message queue scanning parameters: Error(%d)\n", s32Error); WILC_ERRORREPORT(s32Error, WILC_FAIL); @@ -6265,7 +6265,7 @@ s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); WILC_CATCH(s32Error) { @@ -6444,7 +6444,7 @@ static void GetPeriodicRSSI(unsigned long arg) strHostIFmsg.drvHandler = pstrWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send get host channel param's message queue "); return; @@ -6532,9 +6532,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); if (clients_count == 0) { - - s32Error = WILC_MsgQueueCreate(&gMsgQHostIF, NULL); - + s32Error = WILC_MsgQueueCreate(&gMsgQHostIF); if (s32Error < 0) { PRINT_ER("Failed to creat MQ\n"); @@ -6617,7 +6615,7 @@ _fail_timer_2: del_timer_sync(&pstrWFIDrv->hScanTimer); kthread_stop(HostIFthreadHandler); _fail_mq_: - WILC_MsgQueueDestroy(&gMsgQHostIF, NULL); + WILC_MsgQueueDestroy(&gMsgQHostIF); _fail_: return s32Error; @@ -6712,15 +6710,13 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error != WILC_SUCCESS) PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error); down(&hSemHostIFthrdEnd); - - - WILC_MsgQueueDestroy(&gMsgQHostIF, NULL); + WILC_MsgQueueDestroy(&gMsgQHostIF); msgQ_created = 0; } @@ -6783,7 +6779,7 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) pu8Buffer, u32Length); /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error); @@ -6846,7 +6842,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) pu8Buffer, u32Length); /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error); @@ -6898,7 +6894,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) * pu8Buffer, u32Length); */ /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error); } @@ -6945,7 +6941,7 @@ s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -6988,7 +6984,7 @@ s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) strHostIFmsg.drvHandler = hWFIDrv; strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7038,7 +7034,7 @@ s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bRe strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.bReg = bReg; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7104,7 +7100,7 @@ s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, pstrSetBeaconParam->pu8Tail = NULL; } - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); @@ -7145,7 +7141,7 @@ s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) strHostIFmsg.drvHandler = hWFIDrv; PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); WILC_ERRORCHECK(s32Error); WILC_CATCH(s32Error) @@ -7195,7 +7191,7 @@ s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSta } - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); @@ -7240,7 +7236,7 @@ s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) else memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); @@ -7295,7 +7291,7 @@ s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) } pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) @@ -7348,7 +7344,7 @@ s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSt pstrAddStationMsg->pu8Rates = rates; } - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7384,7 +7380,7 @@ s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Ti pstrPowerMgmtParam->u32Timeout = u32Timeout; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7417,7 +7413,7 @@ s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u pstrMulticastFilterParam->bIsEnabled = bIsEnabled; pstrMulticastFilterParam->u32count = u32count; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7685,7 +7681,7 @@ static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TI pBASessionInfo->u16SessionTimeout = SessionTimeout; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7716,7 +7712,7 @@ s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) pBASessionInfo->u8Ted = TID; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7749,7 +7745,7 @@ s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char T pBASessionInfo->u8Ted = TID; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7792,7 +7788,7 @@ s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) strHostIFmsg.drvHandler = hWFIDrv; strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) @@ -7831,7 +7827,7 @@ s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) strHostIFmsg.drvHandler = hWFIDrv; strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); WILC_CATCH(s32Error) diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index 81f584da0023..d9035482ecd2 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -8,8 +8,7 @@ * @note copied from FLO glue implementatuion * @version 1.0 */ -WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, - tstrWILC_MsgQueueAttrs *pstrAttrs) +WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle) { spin_lock_init(&pHandle->strCriticalSection); sema_init(&pHandle->hSem, 0); @@ -25,8 +24,7 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, * @note copied from FLO glue implementatuion * @version 1.0 */ -WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, - tstrWILC_MsgQueueAttrs *pstrAttrs) +WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle) { pHandle->bExiting = true; @@ -53,8 +51,7 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, * @version 1.0 */ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, - const void *pvSendBuffer, u32 u32SendBufferSize, - tstrWILC_MsgQueueAttrs *pstrAttrs) + const void *pvSendBuffer, u32 u32SendBufferSize) { WILC_ErrNo s32RetStatus = WILC_SUCCESS; unsigned long flags; @@ -119,8 +116,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, */ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, void *pvRecvBuffer, u32 u32RecvBufferSize, - u32 *pu32ReceivedLength, - tstrWILC_MsgQueueAttrs *pstrAttrs) + u32 *pu32ReceivedLength) { Message *pstrMessage; diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h b/drivers/staging/wilc1000/wilc_msgqueue.h index de374ac76bc6..ef1d2fa20c50 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.h +++ b/drivers/staging/wilc1000/wilc_msgqueue.h @@ -14,19 +14,6 @@ #include "wilc_errorsupport.h" #include "wilc_memory.h" -/*! - * @struct tstrWILC_MsgQueueAttrs - * @brief Message Queue API options - * @author syounan - * @date 30 Aug 2010 - * @version 1.0 - */ -typedef struct { - /* a dummy member to avoid compiler errors*/ - u8 dummy; - -} tstrWILC_MsgQueueAttrs; - /*! * @brief Creates a new Message queue * @details Creates a new Message queue, if the feature @@ -36,14 +23,11 @@ typedef struct { * @param[in,out] pHandle handle to the message queue object * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure - * @sa tstrWILC_MsgQueueAttrs * @author syounan * @date 30 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, - tstrWILC_MsgQueueAttrs *pstrAttrs); - +WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle); /*! * @brief Sends a message @@ -56,15 +40,12 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, * @param[in] u32SendBufferSize the size of the data to send * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure - * @sa tstrWILC_MsgQueueAttrs * @author syounan * @date 30 Aug 2010 * @version 1.0 */ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, - const void *pvSendBuffer, u32 u32SendBufferSize, - tstrWILC_MsgQueueAttrs *pstrAttrs); - + const void *pvSendBuffer, u32 u32SendBufferSize); /*! * @brief Receives a message @@ -78,30 +59,23 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, * @param[out] pu32ReceivedLength the length of received data * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure - * @sa tstrWILC_MsgQueueAttrs * @author syounan * @date 30 Aug 2010 * @version 1.0 */ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, void *pvRecvBuffer, u32 u32RecvBufferSize, - u32 *pu32ReceivedLength, - tstrWILC_MsgQueueAttrs *pstrAttrs); - + u32 *pu32ReceivedLength); /*! * @brief Destroys an existing Message queue * @param[in] pHandle handle to the message queue object * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure - * @sa tstrWILC_MsgQueueAttrs * @author syounan * @date 30 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, - tstrWILC_MsgQueueAttrs *pstrAttrs); - - +WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle); #endif From 6e3f05bfc02b61adf50709c4a96f07314addeeb6 Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Sat, 15 Aug 2015 12:23:31 +0530 Subject: [PATCH 902/912] staging: wilc1000: Process WARN, INFO options of debug levels from user This patch enables setting the module's debug options WARN and INFO in the debugfs file 'wilc_debug_level'. This functionality allows the user to enable logging of warnings and other information. Before this change, writes to this debugfs file set only one option - DEBUG. Another option that is enabled by default is ERR. As a side effect, this patch removes the 'sparse' warning - 'warning: incorrect type in argument 2 (different address spaces)'. Signed-off-by: Chandra S Gorentla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_debugfs.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index be2e901b448d..ae111862e7a9 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -48,28 +48,19 @@ static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, si return simple_read_from_buffer(userbuf, count, ppos, buf, res); } -static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, size_t count, loff_t *ppos) +static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf, + size_t count, loff_t *ppos) { - char buffer[128] = {}; int flag = 0; + int ret; - if (count > sizeof(buffer)) - return -EINVAL; - - if (copy_from_user(buffer, buf, count)) { - return -EFAULT; - } - - flag = buffer[0] - '0'; - - if (flag > 0) - flag = DEBUG | ERR; - else if (flag < 0) - flag = 100; + ret = kstrtouint_from_user(buf, count, 16, &flag); + if (ret) + return ret; if (flag > DBG_LEVEL_ALL) { printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL)); - return -EFAULT; + return -EINVAL; } atomic_set(&DEBUG_LEVEL, (int)flag); @@ -78,6 +69,7 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, size_t printk("Debug-level disabled\n"); else printk("Debug-level enabled\n"); + return count; } From 5c07828f5db4c620a4f574b3a4bb0a0bba82826b Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 17 Aug 2015 11:05:10 +0900 Subject: [PATCH 903/912] staging: wilc1000: use kmalloc instead of WILC_NEW WILC_NEW is replaced by kmallo with GFP_ATOMIC. This kmalloc is inside a spin_lock_irqsave region. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index d9035482ecd2..70e4fa6a07a6 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -68,7 +68,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, spin_lock_irqsave(&pHandle->strCriticalSection, flags); /* construct a new message */ - pstrMessage = WILC_NEW(Message, 1); + pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC); WILC_NULLCHECK(s32RetStatus, pstrMessage); pstrMessage->u32Length = u32SendBufferSize; pstrMessage->pstrNext = NULL; From 636dcf9716306bc93afffe8f968a3f232c42f6d7 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 17 Aug 2015 11:05:11 +0900 Subject: [PATCH 904/912] staging: wilc1000: remove WILC_NEW and WILC_NEW_EX This patch removes WILC_NEW and WILC_NEW_EX defines that are not used anywhere. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_memory.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h index 877617c5307f..f19cec11a69a 100644 --- a/drivers/staging/wilc1000/wilc_memory.h +++ b/drivers/staging/wilc1000/wilc_memory.h @@ -38,8 +38,6 @@ typedef struct { * @sa sttrWILC_MemoryAttrs * @sa WILC_MALLOC * @sa WILC_MALLOC_EX - * @sa WILC_NEW - * @sa WILC_NEW_EX * @author syounan * @date 16 Aug 2010 * @version 1.0 @@ -54,13 +52,6 @@ void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, (WILC_MemoryAlloc( \ (__size__), __attrs__, NULL, 0)) -/*! - * @brief Allocates a block (with custom attributes) of given type and number of - * elements - */ -#define WILC_NEW_EX(__struct_type__, __n_structs__, __attrs__) \ - ((__struct_type__ *)WILC_MALLOC_EX( \ - sizeof(__struct_type__) * (u32)(__n_structs__), __attrs__)) /*! * @brief standrad malloc wrapper with default attributes @@ -71,11 +62,5 @@ void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, -/*! - * @brief Allocates a block (with default attributes) of given type and number of - * elements - */ -#define WILC_NEW(__struct_type__, __n_structs__) \ - WILC_NEW_EX(__struct_type__, __n_structs__, NULL) #endif From dc0ad74bc432eccb96f3249de20f3b2b468d0919 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 17 Aug 2015 11:05:12 +0900 Subject: [PATCH 905/912] staging: wilc1000: remove unnecessary void pointer cast This patch removes unnecessary void pointer cast of WILC_MALLOC. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 12 +-- drivers/staging/wilc1000/host_interface.c | 78 +++++++++---------- drivers/staging/wilc1000/linux_wlan.c | 2 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 18 ++--- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 1a5b16577fd5..4e9fc657b9d5 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -674,7 +674,7 @@ s32 CoreConfiguratorInit(void) sema_init(&SemHandleSendPkt, 1); sema_init(&SemHandlePktResp, 0); - gps8ConfigPacket = (s8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE); + gps8ConfigPacket = WILC_MALLOC(MAX_PACKET_BUFF_SIZE); if (gps8ConfigPacket == NULL) { PRINT_ER("failed in gps8ConfigPacket allocation\n"); s32Error = WILC_NO_MEM; @@ -810,7 +810,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) u32 u32Tsf_Lo; u32 u32Tsf_Hi; - pstrNetworkInfo = (tstrNetworkInfo *)WILC_MALLOC(sizeof(tstrNetworkInfo)); + pstrNetworkInfo = WILC_MALLOC(sizeof(tstrNetworkInfo)); memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo)); pstrNetworkInfo->s8rssi = pu8WidVal[0]; @@ -860,7 +860,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN); if (u16IEsLen > 0) { - pstrNetworkInfo->pu8IEs = (u8 *)WILC_MALLOC(u16IEsLen); + pstrNetworkInfo->pu8IEs = WILC_MALLOC(u16IEsLen); memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); @@ -927,7 +927,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, u8 *pu8IEs = 0; u16 u16IEsLen = 0; - pstrConnectRespInfo = (tstrConnectRespInfo *)WILC_MALLOC(sizeof(tstrConnectRespInfo)); + pstrConnectRespInfo = WILC_MALLOC(sizeof(tstrConnectRespInfo)); memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo)); /* u16AssocRespLen = pu8Buffer[0]; */ @@ -947,7 +947,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN]; u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN); - pstrConnectRespInfo->pu8RespIEs = (u8 *)WILC_MALLOC(u16IEsLen); + pstrConnectRespInfo->pu8RespIEs = WILC_MALLOC(u16IEsLen); memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); @@ -1016,7 +1016,7 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ } } - pstrSurveyResults = (wid_site_survey_reslts_s *)WILC_MALLOC(u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); + pstrSurveyResults = WILC_MALLOC(u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); if (pstrSurveyResults == NULL) { u32SurveyResultsCount = 0; WILC_ERRORREPORT(s32Error, WILC_NO_MEM); diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c473877246cc..ec7059282adf 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -788,7 +788,7 @@ s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) /*prepare configuration packet*/ strWID.u16WIDid = (u16)WID_IP_ADDRESS; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(IP_ALEN); + strWID.ps8WidVal = WILC_MALLOC(IP_ALEN); strWID.s32ValueSize = IP_ALEN; s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); @@ -837,7 +837,7 @@ static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAdd s32 s32Error = WILC_SUCCESS; tstrWID strWID; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - u8 *mac_buf = (u8 *)WILC_MALLOC(ETH_ALEN); + u8 *mac_buf = WILC_MALLOC(ETH_ALEN); if (mac_buf == NULL) { PRINT_ER("No buffer to send mac address\n"); @@ -1558,13 +1558,13 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); if (pstrHostIFconnectAttr->pu8bssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = (u8 *)WILC_MALLOC(6); + pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); + pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; @@ -1572,7 +1572,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; if (pstrHostIFconnectAttr->pu8IEs != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -1665,13 +1665,13 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps #endif /*WILC_PARSE_SCAN_IN_HOST*/ if (pstrHostIFconnectAttr->pu8bssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = (u8 *)WILC_MALLOC(6); + pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); + pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; @@ -1679,7 +1679,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; if (pstrHostIFconnectAttr->pu8IEs != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -1978,7 +1978,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps if (pstrHostIFconnectAttr->pu8IEs != NULL) { strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; - strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); memcpy(strConnectInfo.pu8ReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); @@ -2136,7 +2136,7 @@ static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; - strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); + strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); memcpy(strConnectInfo.pu8ReqIEs, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); @@ -2426,7 +2426,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; - strConnectInfo.pu8RespIEs = (u8 *)WILC_MALLOC(pstrConnectRespInfo->u16RespIEsLen); + strConnectInfo.pu8RespIEs = WILC_MALLOC(pstrConnectRespInfo->u16RespIEsLen); memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, pstrConnectRespInfo->u16RespIEsLen); } @@ -2470,7 +2470,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; - strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); + strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); memcpy(strConnectInfo.pu8ReqIEs, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); @@ -2706,7 +2706,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF strWIDList[2].s32ValueSize = sizeof(char); - pu8keybuf = (u8 *)WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); + pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); if (pu8keybuf == NULL) { @@ -2735,7 +2735,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); - pu8keybuf = (u8 *)WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2); + pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send Key\n"); return -1; @@ -2783,7 +2783,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF case WPARxGtk: #ifdef WILC_AP_EXTERNAL_MLME if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { - pu8keybuf = (u8 *)WILC_MALLOC(RX_MIC_KEY_MSG_LEN); + pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send RxGTK Key\n"); ret = -1; @@ -2834,7 +2834,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); - pu8keybuf = (u8 *)WILC_MALLOC(RX_MIC_KEY_MSG_LEN); + pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send RxGTK Key\n"); ret = -1; @@ -2888,7 +2888,7 @@ _WPARxGtk_end_case_: if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { - pu8keybuf = (u8 *)WILC_MALLOC(PTK_KEY_MSG_LEN + 1); + pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN + 1); @@ -2935,7 +2935,7 @@ _WPARxGtk_end_case_: if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { - pu8keybuf = (u8 *)WILC_MALLOC(PTK_KEY_MSG_LEN); + pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN); @@ -2985,7 +2985,7 @@ _WPAPtk_end_case_: PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); - pu8keybuf = (u8 *)WILC_MALLOC((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1); + pu8keybuf = WILC_MALLOC((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send PMKSA Key\n"); return -1; @@ -3374,7 +3374,7 @@ static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaIna strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = ETH_ALEN; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); stamac = strWID.ps8WidVal; @@ -3834,7 +3834,7 @@ static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnCh strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = 2; - strWID.ps8WidVal = (s8 *)WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -4130,7 +4130,7 @@ static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; /* *ptr++ = 0x14; */ @@ -4215,7 +4215,7 @@ static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; /* *ptr++ = 0x14; */ @@ -4285,7 +4285,7 @@ static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASe strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; *ptr++ = 0x14; @@ -4744,7 +4744,7 @@ s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = (u8 *)WILC_MALLOC(u8WepKeylen); + uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC(u8WepKeylen); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pu8WepKey, u8WepKeylen); @@ -4813,7 +4813,7 @@ s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = (u8 *)WILC_MALLOC((u8WepKeylen)); + uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC((u8WepKeylen)); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, @@ -4896,7 +4896,7 @@ s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = (u8 *)WILC_MALLOC(u8PtkKeylen); + uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8PtkKeylen); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, @@ -4982,7 +4982,7 @@ s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKe u8KeyLen += TX_MIC_KEY_LEN; if (KeyRSC != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = (u8 *)WILC_MALLOC(u32KeyRSClen); + uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = WILC_MALLOC(u32KeyRSClen); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, KeyRSC, u32KeyRSClen); @@ -5004,7 +5004,7 @@ s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKe strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = (u8 *)WILC_MALLOC(u8KeyLen); + uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8KeyLen); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pu8RxGtk, u8GtkKeylen); @@ -5459,14 +5459,14 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, strHostIFmsg.drvHandler = hWFIDrv; if (pu8bssid != NULL) { - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = (u8 *)WILC_MALLOC(6); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = WILC_MALLOC(6); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, pu8bssid, 6); } if (pu8ssid != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.ssidLen = ssidLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = (u8 *)WILC_MALLOC(ssidLen); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = WILC_MALLOC(ssidLen); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, pu8ssid, ssidLen); @@ -5474,7 +5474,7 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, if (pu8IEs != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.IEsLen = IEsLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = (u8 *)WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, pu8IEs, IEsLen); } @@ -6208,12 +6208,12 @@ s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pvUserArg = pvUserArg; strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = (u8 *)WILC_MALLOC(u8ChnlListLen); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = WILC_MALLOC(u8ChnlListLen); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, pu8ChnlFreqList, u8ChnlListLen); strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.IEsLen = IEsLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = (u8 *)WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, pu8IEs, IEsLen); @@ -6492,7 +6492,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) /*Allocate host interface private structure*/ - pstrWFIDrv = (tstrWILC_WFIDrv *)WILC_MALLOC(sizeof(tstrWILC_WFIDrv)); + pstrWFIDrv = WILC_MALLOC(sizeof(tstrWILC_WFIDrv)); if (pstrWFIDrv == NULL) { /* WILC_ERRORREPORT(s32Error,WILC_NO_MEM); */ s32Error = WILC_NO_MEM; @@ -6774,7 +6774,7 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) strHostIFmsg.drvHandler = pstrWFIDrv; strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.u32Length = u32Length; - strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = (u8 *)WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, pu8Buffer, u32Length); @@ -6837,7 +6837,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.u32Length = u32Length; - strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = (u8 *)WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, pu8Buffer, u32Length); @@ -7084,7 +7084,7 @@ s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, pstrSetBeaconParam->u32Interval = u32Interval; pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; pstrSetBeaconParam->u32HeadLen = u32HeadLen; - pstrSetBeaconParam->pu8Head = (u8 *)WILC_MALLOC(u32HeadLen); + pstrSetBeaconParam->pu8Head = WILC_MALLOC(u32HeadLen); if (pstrSetBeaconParam->pu8Head == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); @@ -7092,7 +7092,7 @@ s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, /* Bug 4599 : if tail length = 0 skip allocating & copying */ if (u32TailLen > 0) { - pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); + pstrSetBeaconParam->pu8Tail = WILC_MALLOC(u32TailLen); if (pstrSetBeaconParam->pu8Tail == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 7eacc2f326df..ed71a9d017b8 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2465,7 +2465,7 @@ int wilc_netdev_init(void) linux_wlan_init_lock("close_exit_sync", &close_exit_sync, 0); /*create the common structure*/ - g_linux_wlan = (linux_wlan_t *)WILC_MALLOC(sizeof(linux_wlan_t)); + g_linux_wlan = WILC_MALLOC(sizeof(linux_wlan_t)); memset(g_linux_wlan, 0, sizeof(linux_wlan_t)); /*Reset interrupt count debug*/ diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index c3355c0dcd53..a6edc973f636 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -339,7 +339,7 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo if (ap_found != -1) kfree(astrLastScannedNtwrksShadow[ap_index].pu8IEs); astrLastScannedNtwrksShadow[ap_index].pu8IEs = - (u8 *)WILC_MALLOC(pstrNetworkInfo->u16IEsLen); /* will be deallocated by the WILC_WFI_CfgScan() function */ + WILC_MALLOC(pstrNetworkInfo->u16IEsLen); /* will be deallocated by the WILC_WFI_CfgScan() function */ memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs, pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen); @@ -1193,13 +1193,13 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) { if (priv->wilc_gtk[key_index] == NULL) { - priv->wilc_gtk[key_index] = (struct wilc_wfi_key *)WILC_MALLOC(sizeof(struct wilc_wfi_key)); + priv->wilc_gtk[key_index] = WILC_MALLOC(sizeof(struct wilc_wfi_key)); priv->wilc_gtk[key_index]->key = NULL; priv->wilc_gtk[key_index]->seq = NULL; } if (priv->wilc_ptk[key_index] == NULL) { - priv->wilc_ptk[key_index] = (struct wilc_wfi_key *)WILC_MALLOC(sizeof(struct wilc_wfi_key)); + priv->wilc_ptk[key_index] = WILC_MALLOC(sizeof(struct wilc_wfi_key)); priv->wilc_ptk[key_index]->key = NULL; priv->wilc_ptk[key_index]->seq = NULL; } @@ -1224,7 +1224,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k if (priv->wilc_gtk[key_index]->key) kfree(priv->wilc_gtk[key_index]->key); - priv->wilc_gtk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len); + priv->wilc_gtk[key_index]->key = WILC_MALLOC(params->key_len); memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len); /* if there has been previous allocation for the same index through its seq, free that memory and allocate again*/ @@ -1232,7 +1232,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k kfree(priv->wilc_gtk[key_index]->seq); if ((params->seq_len) > 0) { - priv->wilc_gtk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len); + priv->wilc_gtk[key_index]->seq = WILC_MALLOC(params->seq_len); memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len); } @@ -1270,13 +1270,13 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k if (priv->wilc_ptk[key_index]->key) kfree(priv->wilc_ptk[key_index]->key); - priv->wilc_ptk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len); + priv->wilc_ptk[key_index]->key = WILC_MALLOC(params->key_len); if (priv->wilc_ptk[key_index]->seq) kfree(priv->wilc_ptk[key_index]->seq); if ((params->seq_len) > 0) - priv->wilc_ptk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len); + priv->wilc_ptk[key_index]->seq = WILC_MALLOC(params->seq_len); if (INFO) { for (i = 0; i < params->key_len; i++) @@ -2512,12 +2512,12 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy, if (ieee80211_is_mgmt(mgmt->frame_control)) { /*mgmt frame allocation*/ - mgmt_tx = (struct p2p_mgmt_data *)WILC_MALLOC(sizeof(struct p2p_mgmt_data)); + mgmt_tx = WILC_MALLOC(sizeof(struct p2p_mgmt_data)); if (mgmt_tx == NULL) { PRINT_ER("Failed to allocate memory for mgmt_tx structure\n"); return WILC_FAIL; } - mgmt_tx->buff = (char *)WILC_MALLOC(buf_len); + mgmt_tx->buff = WILC_MALLOC(buf_len); if (mgmt_tx->buff == NULL) { PRINT_ER("Failed to allocate memory for mgmt_tx buff\n"); return WILC_FAIL; From 280f1fa0808ea6e3b6bd5b39d67a0bb0a35a6761 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 17 Aug 2015 11:05:13 +0900 Subject: [PATCH 906/912] staging: wilc1000: remove unused codes of gps8ConfigPacket This patch removes unused codes of gps8ConfigPacket declared by global variable. It is allocated and freed memory within CoreConfiguratorInit and CoreConfiguratorDeInit. There is no used anywhere except within two functions. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 4e9fc657b9d5..20044872ee74 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -167,7 +167,6 @@ extern void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length); static struct semaphore SemHandleSendPkt; static struct semaphore SemHandlePktResp; -static s8 *gps8ConfigPacket; static tstrConfigPktInfo gstrConfigPktInfo; @@ -674,17 +673,8 @@ s32 CoreConfiguratorInit(void) sema_init(&SemHandleSendPkt, 1); sema_init(&SemHandlePktResp, 0); - gps8ConfigPacket = WILC_MALLOC(MAX_PACKET_BUFF_SIZE); - if (gps8ConfigPacket == NULL) { - PRINT_ER("failed in gps8ConfigPacket allocation\n"); - s32Error = WILC_NO_MEM; - goto _fail_; - } - - memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); -_fail_: return s32Error; } @@ -1954,11 +1944,6 @@ s32 CoreConfiguratorDeInit(void) PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n"); - if (gps8ConfigPacket != NULL) { - - kfree(gps8ConfigPacket); - gps8ConfigPacket = NULL; - } return s32Error; } From 0ac87998784e261e1080907da912afb562737c69 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 17 Aug 2015 11:05:14 +0900 Subject: [PATCH 907/912] staging: wilc1000: coreconfigurator.c: use kmalloc instead of WILC_MALLOC The kmalloc is used to handle host interface message within kernel thread. The manipulation of host interface message is not called on IRQ context and I could not find any spinlock inside function. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 20044872ee74..fd899140b16f 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -800,7 +800,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) u32 u32Tsf_Lo; u32 u32Tsf_Hi; - pstrNetworkInfo = WILC_MALLOC(sizeof(tstrNetworkInfo)); + pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL); memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo)); pstrNetworkInfo->s8rssi = pu8WidVal[0]; @@ -850,7 +850,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN); if (u16IEsLen > 0) { - pstrNetworkInfo->pu8IEs = WILC_MALLOC(u16IEsLen); + pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, GFP_KERNEL); memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); @@ -917,7 +917,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, u8 *pu8IEs = 0; u16 u16IEsLen = 0; - pstrConnectRespInfo = WILC_MALLOC(sizeof(tstrConnectRespInfo)); + pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL); memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo)); /* u16AssocRespLen = pu8Buffer[0]; */ @@ -937,7 +937,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN]; u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN); - pstrConnectRespInfo->pu8RespIEs = WILC_MALLOC(u16IEsLen); + pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, GFP_KERNEL); memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); @@ -1006,7 +1006,8 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ } } - pstrSurveyResults = WILC_MALLOC(u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); + pstrSurveyResults = kmalloc_array(u32SurveyResultsCount, + sizeof(wid_site_survey_reslts_s), GFP_KERNEL); if (pstrSurveyResults == NULL) { u32SurveyResultsCount = 0; WILC_ERRORREPORT(s32Error, WILC_NO_MEM); From a78d9a38a52fc0660e6efb8eaf6540f975db87c6 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 17 Aug 2015 11:05:15 +0900 Subject: [PATCH 908/912] staging: wilc1000: coreconfigurator.c: fix kmalloc error check It is added and fixed error check when kmalloc is failed. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index fd899140b16f..16a0abc970c0 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -801,6 +801,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) u32 u32Tsf_Hi; pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL); + if (!pstrNetworkInfo) + return -ENOMEM; + memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo)); pstrNetworkInfo->s8rssi = pu8WidVal[0]; @@ -851,6 +854,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) if (u16IEsLen > 0) { pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, GFP_KERNEL); + if (!pstrNetworkInfo->pu8IEs) + return -ENOMEM; + memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); @@ -918,6 +924,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, u16 u16IEsLen = 0; pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL); + if (!pstrConnectRespInfo) + return -ENOMEM; + memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo)); /* u16AssocRespLen = pu8Buffer[0]; */ @@ -938,6 +947,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN); pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, GFP_KERNEL); + if (!pstrConnectRespInfo->pu8RespIEs) + return -ENOMEM; + memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); @@ -1008,10 +1020,8 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ pstrSurveyResults = kmalloc_array(u32SurveyResultsCount, sizeof(wid_site_survey_reslts_s), GFP_KERNEL); - if (pstrSurveyResults == NULL) { - u32SurveyResultsCount = 0; - WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } + if (!pstrSurveyResults) + return -ENOMEM; memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); From dec180c86425e4ffcf9699c6cbc6682a63e8d11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Mon, 17 Aug 2015 15:28:26 -0400 Subject: [PATCH 909/912] staging: wilc1000: remove void function return statements that are not useful MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Beamonte Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ---- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_exported_buf.c | 4 +--- drivers/staging/wilc1000/wilc_wlan.c | 3 --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 2 -- 5 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ec7059282adf..078b7d5a128c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -6782,9 +6782,6 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error); - - - return; } /** @@ -6848,7 +6845,6 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) /*BugID_5348*/ up(&hSemHostIntDeinit); - return; } /** diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index ed71a9d017b8..b3cc9f5c7937 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1385,7 +1385,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) } else { PRINT_D(INIT_DBG, "wilc1000 is not initialized\n"); } - return; } int wlan_init_locks(linux_wlan_t *p_nic) diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index 529457816f65..deba6bd37ab0 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -65,12 +65,10 @@ static void __exit wilc_module_deinit(void) FREE_WILC_BUFFER(g_tx_buf) FREE_WILC_BUFFER(g_rx_buf) FREE_WILC_BUFFER(g_fw_buf) - - return; } MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Tony Cho"); MODULE_DESCRIPTION("WILC1xxx Memory Manager"); pure_initcall(wilc_module_init); -module_exit(wilc_module_deinit); \ No newline at end of file +module_exit(wilc_module_deinit); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index fac16db5ff6a..7c53a2bd0381 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -124,8 +124,6 @@ static void wilc_debug(uint32_t flag, char *fmt, ...) if (g_wlan.os_func.os_debug) g_wlan.os_func.os_debug(buf); } - - return; } static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP; @@ -1325,7 +1323,6 @@ static void wilc_wlan_handle_rxq(void) p->rxq_exit = 1; PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n"); - return; } /******************************************** diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index c10dffe4633e..e2842d37b078 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -363,8 +363,6 @@ static void wilc_wlan_parse_response_frame(uint8_t *info, int size) size -= (2 + len); info += (2 + len); } - - return; } static int wilc_wlan_parse_info_frame(uint8_t *info, int size) From db93ec4f30f1826cc64560ffdf9cc6f2f4eff49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Mon, 17 Aug 2015 15:28:28 -0400 Subject: [PATCH 910/912] staging: wilc1000: remove DECLARE_WILC_BUFFER() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was just a wrapper to initialize a variable. Initialize it directly instead. Signed-off-by: Raphaël Beamonte Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_exported_buf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index deba6bd37ab0..c3f6a0a1c9ad 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -8,9 +8,6 @@ #define LINUX_TX_SIZE (64 * 1024) #define WILC1000_FW_SIZE (4 * 1024) -#define DECLARE_WILC_BUFFER(name) \ - void *exported_ ## name = NULL; - #define MALLOC_WILC_BUFFER(name, size) \ exported_ ## name = kmalloc(size, GFP_KERNEL); \ if (!exported_ ## name) { \ @@ -24,9 +21,9 @@ /* * Add necessary buffer pointers */ -DECLARE_WILC_BUFFER(g_tx_buf) -DECLARE_WILC_BUFFER(g_rx_buf) -DECLARE_WILC_BUFFER(g_fw_buf) +void *exported_g_tx_buf; +void *exported_g_rx_buf; +void *exported_g_fw_buf; void *get_tx_buffer(void) { From 507d7fc56154031a1d023d74e02ed9d3c4f4da31 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2015 12:59:42 -0700 Subject: [PATCH 911/912] staging: wilc1000: fix build warning with setup_timer() I forgot to properly cast a pointer to unsigned long in a conversion to setup_timer() which resulted in a build warning. Fix that up. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 078b7d5a128c..66fa677015db 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -6545,7 +6545,8 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) s32Error = WILC_FAIL; goto _fail_mq_; } - setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, pstrWFIDrv); + setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, + (unsigned long)pstrWFIDrv); mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); } From 415bcb5c6eff630967baa4e671cebe883d83ee79 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Tue, 18 Aug 2015 21:04:35 -0400 Subject: [PATCH 912/912] staging/lustre/o2iblnd: remove references to ib_reg_phsy_mr() Removed references to ib_reg_phsy_mr() and PMR which was added to deal with some Chelsio specific scenario, but no longer needed now. Reported-by: Stephen Rothwell Signed-off-by: Amir Shehata Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/lnet/klnds/o2iblnd/o2iblnd.c | 251 +----------------- .../lustre/lnet/klnds/o2iblnd/o2iblnd.h | 32 +-- .../lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 55 +--- .../lnet/klnds/o2iblnd/o2iblnd_modparams.c | 6 - 4 files changed, 19 insertions(+), 325 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 24b2c978dfb6..c29d2ced258c 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1789,140 +1789,6 @@ struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps) goto again; } -void kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr) -{ - kib_pmr_pool_t *ppo = pmr->pmr_pool; - struct ib_mr *mr = pmr->pmr_mr; - - pmr->pmr_mr = NULL; - kiblnd_pool_free_node(&ppo->ppo_pool, &pmr->pmr_list); - if (mr != NULL) - ib_dereg_mr(mr); -} - -int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, - kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr) -{ - kib_phys_mr_t *pmr; - struct list_head *node; - int rc; - int i; - - node = kiblnd_pool_alloc_node(&pps->pps_poolset); - if (node == NULL) { - CERROR("Failed to allocate PMR descriptor\n"); - return -ENOMEM; - } - - pmr = container_of(node, kib_phys_mr_t, pmr_list); - if (pmr->pmr_pool->ppo_hdev != hdev) { - kiblnd_pool_free_node(&pmr->pmr_pool->ppo_pool, node); - return -EAGAIN; - } - - for (i = 0; i < rd->rd_nfrags; i++) { - pmr->pmr_ipb[i].addr = rd->rd_frags[i].rf_addr; - pmr->pmr_ipb[i].size = rd->rd_frags[i].rf_nob; - } - - pmr->pmr_mr = ib_reg_phys_mr(hdev->ibh_pd, - pmr->pmr_ipb, rd->rd_nfrags, - IB_ACCESS_LOCAL_WRITE | - IB_ACCESS_REMOTE_WRITE, - iova); - if (!IS_ERR(pmr->pmr_mr)) { - pmr->pmr_iova = *iova; - *pp_pmr = pmr; - return 0; - } - - rc = PTR_ERR(pmr->pmr_mr); - CERROR("Failed ib_reg_phys_mr: %d\n", rc); - - pmr->pmr_mr = NULL; - kiblnd_pool_free_node(&pmr->pmr_pool->ppo_pool, node); - - return rc; -} - -static void kiblnd_destroy_pmr_pool(kib_pool_t *pool) -{ - kib_pmr_pool_t *ppo = container_of(pool, kib_pmr_pool_t, ppo_pool); - kib_phys_mr_t *pmr; - kib_phys_mr_t *tmp; - - LASSERT(pool->po_allocated == 0); - - list_for_each_entry_safe(pmr, tmp, &pool->po_free_list, pmr_list) { - LASSERT(pmr->pmr_mr == NULL); - list_del(&pmr->pmr_list); - - if (pmr->pmr_ipb != NULL) { - LIBCFS_FREE(pmr->pmr_ipb, - IBLND_MAX_RDMA_FRAGS * - sizeof(struct ib_phys_buf)); - } - - LIBCFS_FREE(pmr, sizeof(kib_phys_mr_t)); - } - - kiblnd_fini_pool(pool); - if (ppo->ppo_hdev != NULL) - kiblnd_hdev_decref(ppo->ppo_hdev); - - LIBCFS_FREE(ppo, sizeof(kib_pmr_pool_t)); -} - -static inline int kiblnd_pmr_pool_size(int ncpts) -{ - int size = *kiblnd_tunables.kib_pmr_pool_size / ncpts; - - return max(IBLND_PMR_POOL, size); -} - -static int kiblnd_create_pmr_pool(kib_poolset_t *ps, int size, - kib_pool_t **pp_po) -{ - struct kib_pmr_pool *ppo; - struct kib_pool *pool; - kib_phys_mr_t *pmr; - int i; - - LIBCFS_CPT_ALLOC(ppo, lnet_cpt_table(), - ps->ps_cpt, sizeof(kib_pmr_pool_t)); - if (ppo == NULL) { - CERROR("Failed to allocate PMR pool\n"); - return -ENOMEM; - } - - pool = &ppo->ppo_pool; - kiblnd_init_pool(ps, pool, size); - - for (i = 0; i < size; i++) { - LIBCFS_CPT_ALLOC(pmr, lnet_cpt_table(), - ps->ps_cpt, sizeof(kib_phys_mr_t)); - if (pmr == NULL) - break; - - pmr->pmr_pool = ppo; - LIBCFS_CPT_ALLOC(pmr->pmr_ipb, lnet_cpt_table(), ps->ps_cpt, - IBLND_MAX_RDMA_FRAGS * sizeof(*pmr->pmr_ipb)); - if (pmr->pmr_ipb == NULL) - break; - - list_add(&pmr->pmr_list, &pool->po_free_list); - } - - if (i < size) { - ps->ps_pool_destroy(pool); - return -ENOMEM; - } - - ppo->ppo_hdev = kiblnd_current_hdev(ps->ps_net->ibn_dev); - *pp_po = pool; - return 0; -} - static void kiblnd_destroy_tx_pool(kib_pool_t *pool) { kib_tx_pool_t *tpo = container_of(pool, kib_tx_pool_t, tpo_pool); @@ -2078,7 +1944,6 @@ static void kiblnd_net_fini_pools(kib_net_t *net) cfs_cpt_for_each(i, lnet_cpt_table()) { kib_tx_poolset_t *tps; kib_fmr_poolset_t *fps; - kib_pmr_poolset_t *pps; if (net->ibn_tx_ps != NULL) { tps = net->ibn_tx_ps[i]; @@ -2089,11 +1954,6 @@ static void kiblnd_net_fini_pools(kib_net_t *net) fps = net->ibn_fmr_ps[i]; kiblnd_fini_fmr_poolset(fps); } - - if (net->ibn_pmr_ps != NULL) { - pps = net->ibn_pmr_ps[i]; - kiblnd_fini_poolset(&pps->pps_poolset); - } } if (net->ibn_tx_ps != NULL) { @@ -2105,18 +1965,13 @@ static void kiblnd_net_fini_pools(kib_net_t *net) cfs_percpt_free(net->ibn_fmr_ps); net->ibn_fmr_ps = NULL; } - - if (net->ibn_pmr_ps != NULL) { - cfs_percpt_free(net->ibn_pmr_ps); - net->ibn_pmr_ps = NULL; - } } static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) { unsigned long flags; int cpt; - int rc; + int rc = 0; int i; read_lock_irqsave(&kiblnd_data.kib_global_lock, flags); @@ -2137,12 +1992,16 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) goto failed; } - /* TX pool must be created later than FMR/PMR, see LU-2268 - * for details */ + /* + * TX pool must be created later than FMR, see LU-2268 + * for details + */ LASSERT(net->ibn_tx_ps == NULL); - /* premapping can fail if ibd_nmr > 1, so we always create - * FMR/PMR pool and map-on-demand if premapping failed */ + /* + * premapping can fail if ibd_nmr > 1, so we always create + * FMR pool and map-on-demand if premapping failed + */ net->ibn_fmr_ps = cfs_percpt_alloc(lnet_cpt_table(), sizeof(kib_fmr_poolset_t)); @@ -2158,7 +2017,7 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) kiblnd_fmr_pool_size(ncpts), kiblnd_fmr_flush_trigger(ncpts)); if (rc == -ENOSYS && i == 0) /* no FMR */ - break; /* create PMR pool */ + break; if (rc != 0) { /* a real error */ CERROR("Can't initialize FMR pool for CPT %d: %d\n", @@ -2175,38 +2034,8 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) cfs_percpt_free(net->ibn_fmr_ps); net->ibn_fmr_ps = NULL; - CWARN("Device does not support FMR, failing back to PMR\n"); - - if (*kiblnd_tunables.kib_pmr_pool_size < - *kiblnd_tunables.kib_ntx / 4) { - CERROR("Can't set pmr pool size (%d) < ntx / 4(%d)\n", - *kiblnd_tunables.kib_pmr_pool_size, - *kiblnd_tunables.kib_ntx / 4); - rc = -EINVAL; - goto failed; - } - - net->ibn_pmr_ps = cfs_percpt_alloc(lnet_cpt_table(), - sizeof(kib_pmr_poolset_t)); - if (net->ibn_pmr_ps == NULL) { - CERROR("Failed to allocate PMR pool array\n"); - rc = -ENOMEM; - goto failed; - } - - for (i = 0; i < ncpts; i++) { - cpt = (cpts == NULL) ? i : cpts[i]; - rc = kiblnd_init_poolset(&net->ibn_pmr_ps[cpt]->pps_poolset, - cpt, net, "PMR", - kiblnd_pmr_pool_size(ncpts), - kiblnd_create_pmr_pool, - kiblnd_destroy_pmr_pool, NULL, NULL); - if (rc != 0) { - CERROR("Can't initialize PMR pool for CPT %d: %d\n", - cpt, rc); + CWARN("Device does not support FMR\n"); goto failed; - } - } create_tx_pool: net->ibn_tx_ps = cfs_percpt_alloc(lnet_cpt_table(), @@ -2318,17 +2147,13 @@ void kiblnd_hdev_destroy(kib_hca_dev_t *hdev) static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) { struct ib_mr *mr; - int i; int rc; - __u64 mm_size; - __u64 mr_size; int acflags = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_WRITE; rc = kiblnd_hdev_get_attr(hdev); if (rc != 0) return rc; - if (hdev->ibh_mr_shift == 64) { LIBCFS_ALLOC(hdev->ibh_mrs, 1 * sizeof(*hdev->ibh_mrs)); if (hdev->ibh_mrs == NULL) { CERROR("Failed to allocate MRs table\n"); @@ -2347,53 +2172,6 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) hdev->ibh_mrs[0] = mr; - goto out; - } - - mr_size = 1ULL << hdev->ibh_mr_shift; - mm_size = (unsigned long)high_memory - PAGE_OFFSET; - - hdev->ibh_nmrs = (int)((mm_size + mr_size - 1) >> hdev->ibh_mr_shift); - - if (hdev->ibh_mr_shift < 32 || hdev->ibh_nmrs > 1024) { - /* it's 4T..., assume we will re-code at that time */ - CERROR("Can't support memory size: x%#llx with MR size: x%#llx\n", - mm_size, mr_size); - return -EINVAL; - } - - /* create an array of MRs to cover all memory */ - LIBCFS_ALLOC(hdev->ibh_mrs, sizeof(*hdev->ibh_mrs) * hdev->ibh_nmrs); - if (hdev->ibh_mrs == NULL) { - CERROR("Failed to allocate MRs' table\n"); - return -ENOMEM; - } - - for (i = 0; i < hdev->ibh_nmrs; i++) { - struct ib_phys_buf ipb; - __u64 iova; - - ipb.size = hdev->ibh_mr_size; - ipb.addr = i * mr_size; - iova = ipb.addr; - - mr = ib_reg_phys_mr(hdev->ibh_pd, &ipb, 1, acflags, &iova); - if (IS_ERR(mr)) { - CERROR("Failed ib_reg_phys_mr addr %#llx size %#llx : %ld\n", - ipb.addr, ipb.size, PTR_ERR(mr)); - kiblnd_hdev_cleanup_mrs(hdev); - return PTR_ERR(mr); - } - - LASSERT(iova == ipb.addr); - - hdev->ibh_mrs[i] = mr; - } - -out: - if (hdev->ibh_mr_size != ~0ULL || hdev->ibh_nmrs != 1) - LCONSOLE_INFO("Register global MR array, MR size: %#llx, array size: %d\n", - hdev->ibh_mr_size, hdev->ibh_nmrs); return 0; } @@ -2564,14 +2342,9 @@ int kiblnd_dev_failover(kib_dev_t *dev) kiblnd_fail_poolset(&net->ibn_tx_ps[i]->tps_poolset, &zombie_tpo); - if (net->ibn_fmr_ps != NULL) { + if (net->ibn_fmr_ps) kiblnd_fail_fmr_poolset(net->ibn_fmr_ps[i], &zombie_fpo); - - } else if (net->ibn_pmr_ps != NULL) { - kiblnd_fail_poolset(&net->ibn_pmr_ps[i]-> - pps_poolset, &zombie_ppo); - } } } diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 8d4580244c26..f4b6c33ac318 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -104,7 +104,6 @@ typedef struct { int *kib_map_on_demand; /* map-on-demand if RD has more * fragments than this value, 0 * disable map-on-demand */ - int *kib_pmr_pool_size; /* # physical MR in pool */ int *kib_fmr_pool_size; /* # FMRs in pool */ int *kib_fmr_flush_trigger; /* When to trigger FMR flush */ int *kib_fmr_cache; /* enable FMR pool cache? */ @@ -163,7 +162,6 @@ kiblnd_concurrent_sends_v1(void) /* Pools (shared by connections on each CPT) */ /* These pools can grow at runtime, so don't need give a very large value */ #define IBLND_TX_POOL 256 -#define IBLND_PMR_POOL 256 #define IBLND_FMR_POOL 256 #define IBLND_FMR_POOL_FLUSH 192 @@ -232,17 +230,6 @@ typedef struct { struct page *ibp_pages[0]; /* page array */ } kib_pages_t; -struct kib_pmr_pool; - -typedef struct { - struct list_head pmr_list; /* chain node */ - struct ib_phys_buf *pmr_ipb; /* physical buffer */ - struct ib_mr *pmr_mr; /* IB MR */ - struct kib_pmr_pool *pmr_pool; /* owner of this MR */ - __u64 pmr_iova; /* Virtual I/O address */ - int pmr_refcount; /* reference count */ -} kib_phys_mr_t; - struct kib_pool; struct kib_poolset; @@ -298,15 +285,6 @@ typedef struct { kib_pages_t *tpo_tx_pages; /* premapped tx msg pages */ } kib_tx_pool_t; -typedef struct { - kib_poolset_t pps_poolset; /* pool-set */ -} kib_pmr_poolset_t; - -typedef struct kib_pmr_pool { - struct kib_hca_dev *ppo_hdev; /* device for this pool */ - kib_pool_t ppo_pool; /* pool */ -} kib_pmr_pool_t; - typedef struct { spinlock_t fps_lock; /* serialize */ struct kib_net *fps_net; /* IB network */ @@ -347,7 +325,6 @@ typedef struct kib_net { kib_tx_poolset_t **ibn_tx_ps; /* tx pool-set */ kib_fmr_poolset_t **ibn_fmr_ps; /* fmr pool-set */ - kib_pmr_poolset_t **ibn_pmr_ps; /* pmr pool-set */ kib_dev_t *ibn_dev; /* underlying IB device */ } kib_net_t; @@ -554,10 +531,7 @@ typedef struct kib_tx /* transmit message */ int tx_nfrags; /* # entries in... */ struct scatterlist *tx_frags; /* dma_map_sg descriptor */ __u64 *tx_pages; /* rdma phys page addrs */ - union { - kib_phys_mr_t *pmr; /* MR for physical buffer */ - kib_fmr_t fmr; /* FMR */ - } tx_u; + kib_fmr_t fmr; /* FMR */ int tx_dmadir; /* dma direction */ } kib_tx_t; @@ -978,10 +952,6 @@ int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, __u64 iov, kib_fmr_t *fmr); void kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status); -int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, - kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr); -void kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr); - int kiblnd_startup(lnet_ni_t *ni); void kiblnd_shutdown(lnet_ni_t *ni); int kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 5a8ebe1b3c84..a23a6d956a4d 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -121,7 +121,6 @@ kiblnd_get_idle_tx(lnet_ni_t *ni, lnet_nid_t target) LASSERT(tx->tx_conn == NULL); LASSERT(tx->tx_lntmsg[0] == NULL); LASSERT(tx->tx_lntmsg[1] == NULL); - LASSERT(tx->tx_u.pmr == NULL); LASSERT(tx->tx_nfrags == 0); return tx; @@ -575,7 +574,7 @@ kiblnd_fmr_map_tx(kib_net_t *net, kib_tx_t *tx, kib_rdma_desc_t *rd, int nob) cpt = tx->tx_pool->tpo_pool.po_owner->ps_cpt; fps = net->ibn_fmr_ps[cpt]; - rc = kiblnd_fmr_pool_map(fps, pages, npages, 0, &tx->tx_u.fmr); + rc = kiblnd_fmr_pool_map(fps, pages, npages, 0, &tx->fmr); if (rc != 0) { CERROR("Can't map %d pages: %d\n", npages, rc); return rc; @@ -583,8 +582,8 @@ kiblnd_fmr_map_tx(kib_net_t *net, kib_tx_t *tx, kib_rdma_desc_t *rd, int nob) /* If rd is not tx_rd, it's going to get sent to a peer, who will need * the rkey */ - rd->rd_key = (rd != tx->tx_rd) ? tx->tx_u.fmr.fmr_pfmr->fmr->rkey : - tx->tx_u.fmr.fmr_pfmr->fmr->lkey; + rd->rd_key = (rd != tx->tx_rd) ? tx->fmr.fmr_pfmr->fmr->rkey : + tx->fmr.fmr_pfmr->fmr->lkey; rd->rd_frags[0].rf_addr &= ~hdev->ibh_page_mask; rd->rd_frags[0].rf_nob = nob; rd->rd_nfrags = 1; @@ -592,42 +591,6 @@ kiblnd_fmr_map_tx(kib_net_t *net, kib_tx_t *tx, kib_rdma_desc_t *rd, int nob) return 0; } -static int -kiblnd_pmr_map_tx(kib_net_t *net, kib_tx_t *tx, kib_rdma_desc_t *rd, int nob) -{ - kib_hca_dev_t *hdev; - kib_pmr_poolset_t *pps; - __u64 iova; - int cpt; - int rc; - - LASSERT(tx->tx_pool != NULL); - LASSERT(tx->tx_pool->tpo_pool.po_owner != NULL); - - hdev = tx->tx_pool->tpo_hdev; - - iova = rd->rd_frags[0].rf_addr & ~hdev->ibh_page_mask; - - cpt = tx->tx_pool->tpo_pool.po_owner->ps_cpt; - - pps = net->ibn_pmr_ps[cpt]; - rc = kiblnd_pmr_pool_map(pps, hdev, rd, &iova, &tx->tx_u.pmr); - if (rc != 0) { - CERROR("Failed to create MR by phybuf: %d\n", rc); - return rc; - } - - /* If rd is not tx_rd, it's going to get sent to a peer, who will need - * the rkey */ - rd->rd_key = (rd != tx->tx_rd) ? tx->tx_u.pmr->pmr_mr->rkey : - tx->tx_u.pmr->pmr_mr->lkey; - rd->rd_nfrags = 1; - rd->rd_frags[0].rf_addr = iova; - rd->rd_frags[0].rf_nob = nob; - - return 0; -} - void kiblnd_unmap_tx(lnet_ni_t *ni, kib_tx_t *tx) { @@ -635,13 +598,9 @@ kiblnd_unmap_tx(lnet_ni_t *ni, kib_tx_t *tx) LASSERT(net != NULL); - if (net->ibn_fmr_ps != NULL && tx->tx_u.fmr.fmr_pfmr != NULL) { - kiblnd_fmr_pool_unmap(&tx->tx_u.fmr, tx->tx_status); - tx->tx_u.fmr.fmr_pfmr = NULL; - - } else if (net->ibn_pmr_ps != NULL && tx->tx_u.pmr != NULL) { - kiblnd_pmr_pool_unmap(tx->tx_u.pmr); - tx->tx_u.pmr = NULL; + if (net->ibn_fmr_ps && tx->fmr.fmr_pfmr) { + kiblnd_fmr_pool_unmap(&tx->fmr, tx->tx_status); + tx->fmr.fmr_pfmr = NULL; } if (tx->tx_nfrags != 0) { @@ -687,8 +646,6 @@ kiblnd_map_tx(lnet_ni_t *ni, kib_tx_t *tx, if (net->ibn_fmr_ps != NULL) return kiblnd_fmr_map_tx(net, tx, rd, nob); - else if (net->ibn_pmr_ps != NULL) - return kiblnd_pmr_map_tx(net, tx, rd, nob); return -EINVAL; } diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c index b0e00361cfce..b3d1b5d627cb 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c @@ -126,11 +126,6 @@ static int fmr_cache = 1; module_param(fmr_cache, int, 0444); MODULE_PARM_DESC(fmr_cache, "non-zero to enable FMR caching"); -/* NB: this value is shared by all CPTs, it can grow at runtime */ -static int pmr_pool_size = 512; -module_param(pmr_pool_size, int, 0444); -MODULE_PARM_DESC(pmr_pool_size, "size of MR cache pmr pool on each CPT"); - /* * 0: disable failover * 1: enable failover if necessary @@ -170,7 +165,6 @@ kib_tunables_t kiblnd_tunables = { .kib_fmr_pool_size = &fmr_pool_size, .kib_fmr_flush_trigger = &fmr_flush_trigger, .kib_fmr_cache = &fmr_cache, - .kib_pmr_pool_size = &pmr_pool_size, .kib_require_priv_port = &require_privileged_port, .kib_use_priv_port = &use_privileged_port, .kib_nscheds = &nscheds