| .. | .. |
|---|
| 51 | 51 | */ |
|---|
| 52 | 52 | static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata"; |
|---|
| 53 | 53 | static int appldata_timer_handler(struct ctl_table *ctl, int write, |
|---|
| 54 | | - void __user *buffer, size_t *lenp, loff_t *ppos); |
|---|
| 54 | + void *buffer, size_t *lenp, loff_t *ppos); |
|---|
| 55 | 55 | static int appldata_interval_handler(struct ctl_table *ctl, int write, |
|---|
| 56 | | - void __user *buffer, |
|---|
| 57 | | - size_t *lenp, loff_t *ppos); |
|---|
| 56 | + void *buffer, size_t *lenp, loff_t *ppos); |
|---|
| 58 | 57 | |
|---|
| 59 | 58 | static struct ctl_table_header *appldata_sysctl_header; |
|---|
| 60 | 59 | static struct ctl_table appldata_table[] = { |
|---|
| .. | .. |
|---|
| 137 | 136 | mutex_unlock(&appldata_ops_mutex); |
|---|
| 138 | 137 | } |
|---|
| 139 | 138 | |
|---|
| 139 | +static struct appldata_product_id appldata_id = { |
|---|
| 140 | + .prod_nr = {0xD3, 0xC9, 0xD5, 0xE4, |
|---|
| 141 | + 0xE7, 0xD2, 0xD9}, /* "LINUXKR" */ |
|---|
| 142 | + .prod_fn = 0xD5D3, /* "NL" */ |
|---|
| 143 | + .version_nr = 0xF2F6, /* "26" */ |
|---|
| 144 | + .release_nr = 0xF0F1, /* "01" */ |
|---|
| 145 | +}; |
|---|
| 146 | + |
|---|
| 140 | 147 | /* |
|---|
| 141 | 148 | * appldata_diag() |
|---|
| 142 | 149 | * |
|---|
| .. | .. |
|---|
| 145 | 152 | int appldata_diag(char record_nr, u16 function, unsigned long buffer, |
|---|
| 146 | 153 | u16 length, char *mod_lvl) |
|---|
| 147 | 154 | { |
|---|
| 148 | | - struct appldata_product_id id = { |
|---|
| 149 | | - .prod_nr = {0xD3, 0xC9, 0xD5, 0xE4, |
|---|
| 150 | | - 0xE7, 0xD2, 0xD9}, /* "LINUXKR" */ |
|---|
| 151 | | - .prod_fn = 0xD5D3, /* "NL" */ |
|---|
| 152 | | - .version_nr = 0xF2F6, /* "26" */ |
|---|
| 153 | | - .release_nr = 0xF0F1, /* "01" */ |
|---|
| 154 | | - }; |
|---|
| 155 | + struct appldata_parameter_list *parm_list; |
|---|
| 156 | + struct appldata_product_id *id; |
|---|
| 157 | + int rc; |
|---|
| 155 | 158 | |
|---|
| 156 | | - id.record_nr = record_nr; |
|---|
| 157 | | - id.mod_lvl = (mod_lvl[0]) << 8 | mod_lvl[1]; |
|---|
| 158 | | - return appldata_asm(&id, function, (void *) buffer, length); |
|---|
| 159 | + parm_list = kmalloc(sizeof(*parm_list), GFP_KERNEL); |
|---|
| 160 | + id = kmemdup(&appldata_id, sizeof(appldata_id), GFP_KERNEL); |
|---|
| 161 | + rc = -ENOMEM; |
|---|
| 162 | + if (parm_list && id) { |
|---|
| 163 | + id->record_nr = record_nr; |
|---|
| 164 | + id->mod_lvl = (mod_lvl[0]) << 8 | mod_lvl[1]; |
|---|
| 165 | + rc = appldata_asm(parm_list, id, function, |
|---|
| 166 | + (void *) buffer, length); |
|---|
| 167 | + } |
|---|
| 168 | + kfree(id); |
|---|
| 169 | + kfree(parm_list); |
|---|
| 170 | + return rc; |
|---|
| 159 | 171 | } |
|---|
| 160 | 172 | /************************ timer, work, DIAG <END> ****************************/ |
|---|
| 161 | 173 | |
|---|
| .. | .. |
|---|
| 204 | 216 | */ |
|---|
| 205 | 217 | static int |
|---|
| 206 | 218 | appldata_timer_handler(struct ctl_table *ctl, int write, |
|---|
| 207 | | - void __user *buffer, size_t *lenp, loff_t *ppos) |
|---|
| 219 | + void *buffer, size_t *lenp, loff_t *ppos) |
|---|
| 208 | 220 | { |
|---|
| 209 | 221 | int timer_active = appldata_timer_active; |
|---|
| 210 | | - int zero = 0; |
|---|
| 211 | | - int one = 1; |
|---|
| 212 | 222 | int rc; |
|---|
| 213 | 223 | struct ctl_table ctl_entry = { |
|---|
| 214 | 224 | .procname = ctl->procname, |
|---|
| 215 | 225 | .data = &timer_active, |
|---|
| 216 | 226 | .maxlen = sizeof(int), |
|---|
| 217 | | - .extra1 = &zero, |
|---|
| 218 | | - .extra2 = &one, |
|---|
| 227 | + .extra1 = SYSCTL_ZERO, |
|---|
| 228 | + .extra2 = SYSCTL_ONE, |
|---|
| 219 | 229 | }; |
|---|
| 220 | 230 | |
|---|
| 221 | 231 | rc = proc_douintvec_minmax(&ctl_entry, write, buffer, lenp, ppos); |
|---|
| .. | .. |
|---|
| 239 | 249 | */ |
|---|
| 240 | 250 | static int |
|---|
| 241 | 251 | appldata_interval_handler(struct ctl_table *ctl, int write, |
|---|
| 242 | | - void __user *buffer, size_t *lenp, loff_t *ppos) |
|---|
| 252 | + void *buffer, size_t *lenp, loff_t *ppos) |
|---|
| 243 | 253 | { |
|---|
| 244 | 254 | int interval = appldata_interval; |
|---|
| 245 | | - int one = 1; |
|---|
| 246 | 255 | int rc; |
|---|
| 247 | 256 | struct ctl_table ctl_entry = { |
|---|
| 248 | 257 | .procname = ctl->procname, |
|---|
| 249 | 258 | .data = &interval, |
|---|
| 250 | 259 | .maxlen = sizeof(int), |
|---|
| 251 | | - .extra1 = &one, |
|---|
| 260 | + .extra1 = SYSCTL_ONE, |
|---|
| 252 | 261 | }; |
|---|
| 253 | 262 | |
|---|
| 254 | 263 | rc = proc_dointvec_minmax(&ctl_entry, write, buffer, lenp, ppos); |
|---|
| .. | .. |
|---|
| 270 | 279 | */ |
|---|
| 271 | 280 | static int |
|---|
| 272 | 281 | appldata_generic_handler(struct ctl_table *ctl, int write, |
|---|
| 273 | | - void __user *buffer, size_t *lenp, loff_t *ppos) |
|---|
| 282 | + void *buffer, size_t *lenp, loff_t *ppos) |
|---|
| 274 | 283 | { |
|---|
| 275 | 284 | struct appldata_ops *ops = NULL, *tmp_ops; |
|---|
| 276 | 285 | struct list_head *lh; |
|---|
| 277 | 286 | int rc, found; |
|---|
| 278 | 287 | int active; |
|---|
| 279 | | - int zero = 0; |
|---|
| 280 | | - int one = 1; |
|---|
| 281 | 288 | struct ctl_table ctl_entry = { |
|---|
| 282 | 289 | .data = &active, |
|---|
| 283 | 290 | .maxlen = sizeof(int), |
|---|
| 284 | | - .extra1 = &zero, |
|---|
| 285 | | - .extra2 = &one, |
|---|
| 291 | + .extra1 = SYSCTL_ZERO, |
|---|
| 292 | + .extra2 = SYSCTL_ONE, |
|---|
| 286 | 293 | }; |
|---|
| 287 | 294 | |
|---|
| 288 | 295 | found = 0; |
|---|