| .. | .. |
|---|
| 63 | 63 | |
|---|
| 64 | 64 | static DEFINE_IDA(rndis_ida); |
|---|
| 65 | 65 | |
|---|
| 66 | +static DEFINE_SPINLOCK(resp_lock); |
|---|
| 67 | + |
|---|
| 66 | 68 | /* Driver Version */ |
|---|
| 67 | 69 | static const __le32 rndis_driver_version = cpu_to_le32(1); |
|---|
| 68 | 70 | |
|---|
| .. | .. |
|---|
| 72 | 74 | |
|---|
| 73 | 75 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES |
|---|
| 74 | 76 | |
|---|
| 75 | | -static const struct file_operations rndis_proc_fops; |
|---|
| 77 | +static const struct proc_ops rndis_proc_ops; |
|---|
| 76 | 78 | |
|---|
| 77 | 79 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ |
|---|
| 78 | 80 | |
|---|
| .. | .. |
|---|
| 640 | 642 | BufLength = le32_to_cpu(buf->InformationBufferLength); |
|---|
| 641 | 643 | BufOffset = le32_to_cpu(buf->InformationBufferOffset); |
|---|
| 642 | 644 | if ((BufLength > RNDIS_MAX_TOTAL_SIZE) || |
|---|
| 645 | + (BufOffset > RNDIS_MAX_TOTAL_SIZE) || |
|---|
| 643 | 646 | (BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE)) |
|---|
| 644 | 647 | return -EINVAL; |
|---|
| 645 | 648 | |
|---|
| .. | .. |
|---|
| 905 | 908 | |
|---|
| 906 | 909 | sprintf(name, NAME_TEMPLATE, i); |
|---|
| 907 | 910 | proc_entry = proc_create_data(name, 0660, NULL, |
|---|
| 908 | | - &rndis_proc_fops, params); |
|---|
| 911 | + &rndis_proc_ops, params); |
|---|
| 909 | 912 | if (!proc_entry) { |
|---|
| 910 | 913 | kfree(params); |
|---|
| 911 | 914 | rndis_put_nr(i); |
|---|
| .. | .. |
|---|
| 922 | 925 | params->resp_avail = resp_avail; |
|---|
| 923 | 926 | params->v = v; |
|---|
| 924 | 927 | INIT_LIST_HEAD(¶ms->resp_queue); |
|---|
| 925 | | - spin_lock_init(¶ms->resp_lock); |
|---|
| 926 | 928 | pr_debug("%s: configNr = %d\n", __func__, i); |
|---|
| 927 | 929 | |
|---|
| 928 | 930 | return params; |
|---|
| .. | .. |
|---|
| 1016 | 1018 | { |
|---|
| 1017 | 1019 | rndis_resp_t *r, *n; |
|---|
| 1018 | 1020 | |
|---|
| 1019 | | - spin_lock(¶ms->resp_lock); |
|---|
| 1021 | + spin_lock(&resp_lock); |
|---|
| 1020 | 1022 | list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { |
|---|
| 1021 | 1023 | if (r->buf == buf) { |
|---|
| 1022 | 1024 | list_del(&r->list); |
|---|
| 1023 | 1025 | kfree(r); |
|---|
| 1024 | 1026 | } |
|---|
| 1025 | 1027 | } |
|---|
| 1026 | | - spin_unlock(¶ms->resp_lock); |
|---|
| 1028 | + spin_unlock(&resp_lock); |
|---|
| 1027 | 1029 | } |
|---|
| 1028 | 1030 | EXPORT_SYMBOL_GPL(rndis_free_response); |
|---|
| 1029 | 1031 | |
|---|
| .. | .. |
|---|
| 1033 | 1035 | |
|---|
| 1034 | 1036 | if (!length) return NULL; |
|---|
| 1035 | 1037 | |
|---|
| 1036 | | - spin_lock(¶ms->resp_lock); |
|---|
| 1038 | + spin_lock(&resp_lock); |
|---|
| 1037 | 1039 | list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { |
|---|
| 1038 | 1040 | if (!r->send) { |
|---|
| 1039 | 1041 | r->send = 1; |
|---|
| 1040 | 1042 | *length = r->length; |
|---|
| 1041 | | - spin_unlock(¶ms->resp_lock); |
|---|
| 1043 | + spin_unlock(&resp_lock); |
|---|
| 1042 | 1044 | return r->buf; |
|---|
| 1043 | 1045 | } |
|---|
| 1044 | 1046 | } |
|---|
| 1045 | 1047 | |
|---|
| 1046 | | - spin_unlock(¶ms->resp_lock); |
|---|
| 1048 | + spin_unlock(&resp_lock); |
|---|
| 1047 | 1049 | return NULL; |
|---|
| 1048 | 1050 | } |
|---|
| 1049 | 1051 | EXPORT_SYMBOL_GPL(rndis_get_next_response); |
|---|
| .. | .. |
|---|
| 1060 | 1062 | r->length = length; |
|---|
| 1061 | 1063 | r->send = 0; |
|---|
| 1062 | 1064 | |
|---|
| 1063 | | - spin_lock(¶ms->resp_lock); |
|---|
| 1065 | + spin_lock(&resp_lock); |
|---|
| 1064 | 1066 | list_add_tail(&r->list, ¶ms->resp_queue); |
|---|
| 1065 | | - spin_unlock(¶ms->resp_lock); |
|---|
| 1067 | + spin_unlock(&resp_lock); |
|---|
| 1066 | 1068 | return r; |
|---|
| 1067 | 1069 | } |
|---|
| 1068 | 1070 | |
|---|
| .. | .. |
|---|
| 1175 | 1177 | return single_open(file, rndis_proc_show, PDE_DATA(inode)); |
|---|
| 1176 | 1178 | } |
|---|
| 1177 | 1179 | |
|---|
| 1178 | | -static const struct file_operations rndis_proc_fops = { |
|---|
| 1179 | | - .owner = THIS_MODULE, |
|---|
| 1180 | | - .open = rndis_proc_open, |
|---|
| 1181 | | - .read = seq_read, |
|---|
| 1182 | | - .llseek = seq_lseek, |
|---|
| 1183 | | - .release = single_release, |
|---|
| 1184 | | - .write = rndis_proc_write, |
|---|
| 1180 | +static const struct proc_ops rndis_proc_ops = { |
|---|
| 1181 | + .proc_open = rndis_proc_open, |
|---|
| 1182 | + .proc_read = seq_read, |
|---|
| 1183 | + .proc_lseek = seq_lseek, |
|---|
| 1184 | + .proc_release = single_release, |
|---|
| 1185 | + .proc_write = rndis_proc_write, |
|---|
| 1185 | 1186 | }; |
|---|
| 1186 | 1187 | |
|---|
| 1187 | 1188 | #define NAME_TEMPLATE "driver/rndis-%03d" |
|---|