diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/appldata/appldata.h | 1 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_base.c | 74 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_mem.c | 1 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_net_sum.c | 1 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_os.c | 1 |
5 files changed, 15 insertions, 63 deletions
diff --git a/arch/s390/appldata/appldata.h b/arch/s390/appldata/appldata.h index 4069b81f7f1d..db3ae8505103 100644 --- a/arch/s390/appldata/appldata.h +++ b/arch/s390/appldata/appldata.h | |||
@@ -45,7 +45,6 @@ struct appldata_ops { | |||
45 | int active; /* monitoring status */ | 45 | int active; /* monitoring status */ |
46 | 46 | ||
47 | /* fill in from here */ | 47 | /* fill in from here */ |
48 | unsigned int ctl_nr; /* sysctl ID */ | ||
49 | char name[APPLDATA_PROC_NAME_LENGTH]; /* name of /proc fs node */ | 48 | char name[APPLDATA_PROC_NAME_LENGTH]; /* name of /proc fs node */ |
50 | unsigned char record_nr; /* Record Nr. for Product ID */ | 49 | unsigned char record_nr; /* Record Nr. for Product ID */ |
51 | void (*callback)(void *data); /* callback function */ | 50 | void (*callback)(void *data); /* callback function */ |
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index ac61cf43a7d9..655d52543e2d 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c | |||
@@ -53,29 +53,26 @@ static int appldata_interval_handler(ctl_table *ctl, int write, | |||
53 | static struct ctl_table_header *appldata_sysctl_header; | 53 | static struct ctl_table_header *appldata_sysctl_header; |
54 | static struct ctl_table appldata_table[] = { | 54 | static struct ctl_table appldata_table[] = { |
55 | { | 55 | { |
56 | .ctl_name = CTL_APPLDATA_TIMER, | ||
57 | .procname = "timer", | 56 | .procname = "timer", |
58 | .mode = S_IRUGO | S_IWUSR, | 57 | .mode = S_IRUGO | S_IWUSR, |
59 | .proc_handler = &appldata_timer_handler, | 58 | .proc_handler = &appldata_timer_handler, |
60 | }, | 59 | }, |
61 | { | 60 | { |
62 | .ctl_name = CTL_APPLDATA_INTERVAL, | ||
63 | .procname = "interval", | 61 | .procname = "interval", |
64 | .mode = S_IRUGO | S_IWUSR, | 62 | .mode = S_IRUGO | S_IWUSR, |
65 | .proc_handler = &appldata_interval_handler, | 63 | .proc_handler = &appldata_interval_handler, |
66 | }, | 64 | }, |
67 | { .ctl_name = 0 } | 65 | { }, |
68 | }; | 66 | }; |
69 | 67 | ||
70 | static struct ctl_table appldata_dir_table[] = { | 68 | static struct ctl_table appldata_dir_table[] = { |
71 | { | 69 | { |
72 | .ctl_name = CTL_APPLDATA, | ||
73 | .procname = appldata_proc_name, | 70 | .procname = appldata_proc_name, |
74 | .maxlen = 0, | 71 | .maxlen = 0, |
75 | .mode = S_IRUGO | S_IXUGO, | 72 | .mode = S_IRUGO | S_IXUGO, |
76 | .child = appldata_table, | 73 | .child = appldata_table, |
77 | }, | 74 | }, |
78 | { .ctl_name = 0 } | 75 | { }, |
79 | }; | 76 | }; |
80 | 77 | ||
81 | /* | 78 | /* |
@@ -441,75 +438,38 @@ out: | |||
441 | */ | 438 | */ |
442 | int appldata_register_ops(struct appldata_ops *ops) | 439 | int appldata_register_ops(struct appldata_ops *ops) |
443 | { | 440 | { |
444 | struct list_head *lh; | 441 | if ((ops->size > APPLDATA_MAX_REC_SIZE) || (ops->size < 0)) |
445 | struct appldata_ops *tmp_ops; | 442 | return -EINVAL; |
446 | int i; | ||
447 | |||
448 | i = 0; | ||
449 | 443 | ||
450 | if ((ops->size > APPLDATA_MAX_REC_SIZE) || | 444 | ops->ctl_table = kzalloc(4 * sizeof(struct ctl_table), GFP_KERNEL); |
451 | (ops->size < 0)){ | 445 | if (!ops->ctl_table) |
452 | P_ERROR("Invalid size of %s record = %i, maximum = %i!\n", | ||
453 | ops->name, ops->size, APPLDATA_MAX_REC_SIZE); | ||
454 | return -ENOMEM; | ||
455 | } | ||
456 | if ((ops->ctl_nr == CTL_APPLDATA) || | ||
457 | (ops->ctl_nr == CTL_APPLDATA_TIMER) || | ||
458 | (ops->ctl_nr == CTL_APPLDATA_INTERVAL)) { | ||
459 | P_ERROR("ctl_nr %i already in use!\n", ops->ctl_nr); | ||
460 | return -EBUSY; | ||
461 | } | ||
462 | ops->ctl_table = kzalloc(4*sizeof(struct ctl_table), GFP_KERNEL); | ||
463 | if (ops->ctl_table == NULL) { | ||
464 | P_ERROR("Not enough memory for %s ctl_table!\n", ops->name); | ||
465 | return -ENOMEM; | 446 | return -ENOMEM; |
466 | } | ||
467 | 447 | ||
468 | spin_lock(&appldata_ops_lock); | 448 | spin_lock(&appldata_ops_lock); |
469 | list_for_each(lh, &appldata_ops_list) { | ||
470 | tmp_ops = list_entry(lh, struct appldata_ops, list); | ||
471 | P_DEBUG("register_ops loop: %i) name = %s, ctl = %i\n", | ||
472 | ++i, tmp_ops->name, tmp_ops->ctl_nr); | ||
473 | P_DEBUG("Comparing %s (ctl %i) with %s (ctl %i)\n", | ||
474 | tmp_ops->name, tmp_ops->ctl_nr, ops->name, | ||
475 | ops->ctl_nr); | ||
476 | if (strncmp(tmp_ops->name, ops->name, | ||
477 | APPLDATA_PROC_NAME_LENGTH) == 0) { | ||
478 | P_ERROR("Name \"%s\" already registered!\n", ops->name); | ||
479 | kfree(ops->ctl_table); | ||
480 | spin_unlock(&appldata_ops_lock); | ||
481 | return -EBUSY; | ||
482 | } | ||
483 | if (tmp_ops->ctl_nr == ops->ctl_nr) { | ||
484 | P_ERROR("ctl_nr %i already registered!\n", ops->ctl_nr); | ||
485 | kfree(ops->ctl_table); | ||
486 | spin_unlock(&appldata_ops_lock); | ||
487 | return -EBUSY; | ||
488 | } | ||
489 | } | ||
490 | list_add(&ops->list, &appldata_ops_list); | 449 | list_add(&ops->list, &appldata_ops_list); |
491 | spin_unlock(&appldata_ops_lock); | 450 | spin_unlock(&appldata_ops_lock); |
492 | 451 | ||
493 | ops->ctl_table[0].ctl_name = CTL_APPLDATA; | ||
494 | ops->ctl_table[0].procname = appldata_proc_name; | 452 | ops->ctl_table[0].procname = appldata_proc_name; |
495 | ops->ctl_table[0].maxlen = 0; | 453 | ops->ctl_table[0].maxlen = 0; |
496 | ops->ctl_table[0].mode = S_IRUGO | S_IXUGO; | 454 | ops->ctl_table[0].mode = S_IRUGO | S_IXUGO; |
497 | ops->ctl_table[0].child = &ops->ctl_table[2]; | 455 | ops->ctl_table[0].child = &ops->ctl_table[2]; |
498 | 456 | ||
499 | ops->ctl_table[1].ctl_name = 0; | ||
500 | |||
501 | ops->ctl_table[2].ctl_name = ops->ctl_nr; | ||
502 | ops->ctl_table[2].procname = ops->name; | 457 | ops->ctl_table[2].procname = ops->name; |
503 | ops->ctl_table[2].mode = S_IRUGO | S_IWUSR; | 458 | ops->ctl_table[2].mode = S_IRUGO | S_IWUSR; |
504 | ops->ctl_table[2].proc_handler = appldata_generic_handler; | 459 | ops->ctl_table[2].proc_handler = appldata_generic_handler; |
505 | ops->ctl_table[2].data = ops; | 460 | ops->ctl_table[2].data = ops; |
506 | 461 | ||
507 | ops->ctl_table[3].ctl_name = 0; | ||
508 | |||
509 | ops->sysctl_header = register_sysctl_table(ops->ctl_table); | 462 | ops->sysctl_header = register_sysctl_table(ops->ctl_table); |
510 | 463 | if (!ops->sysctl_header) | |
464 | goto out; | ||
511 | P_INFO("%s-ops registered!\n", ops->name); | 465 | P_INFO("%s-ops registered!\n", ops->name); |
512 | return 0; | 466 | return 0; |
467 | out: | ||
468 | spin_lock(&appldata_ops_lock); | ||
469 | list_del(&ops->list); | ||
470 | spin_unlock(&appldata_ops_lock); | ||
471 | kfree(ops->ctl_table); | ||
472 | return -ENOMEM; | ||
513 | } | 473 | } |
514 | 474 | ||
515 | /* | 475 | /* |
@@ -519,15 +479,11 @@ int appldata_register_ops(struct appldata_ops *ops) | |||
519 | */ | 479 | */ |
520 | void appldata_unregister_ops(struct appldata_ops *ops) | 480 | void appldata_unregister_ops(struct appldata_ops *ops) |
521 | { | 481 | { |
522 | void *table; | ||
523 | spin_lock(&appldata_ops_lock); | 482 | spin_lock(&appldata_ops_lock); |
524 | list_del(&ops->list); | 483 | list_del(&ops->list); |
525 | /* at that point any incoming access will fail */ | ||
526 | table = ops->ctl_table; | ||
527 | ops->ctl_table = NULL; | ||
528 | spin_unlock(&appldata_ops_lock); | 484 | spin_unlock(&appldata_ops_lock); |
529 | unregister_sysctl_table(ops->sysctl_header); | 485 | unregister_sysctl_table(ops->sysctl_header); |
530 | kfree(table); | 486 | kfree(ops->ctl_table); |
531 | P_INFO("%s-ops unregistered!\n", ops->name); | 487 | P_INFO("%s-ops unregistered!\n", ops->name); |
532 | } | 488 | } |
533 | /********************** module-ops management <END> **************************/ | 489 | /********************** module-ops management <END> **************************/ |
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c index 697eb30a68a3..51181ccdb87b 100644 --- a/arch/s390/appldata/appldata_mem.c +++ b/arch/s390/appldata/appldata_mem.c | |||
@@ -147,7 +147,6 @@ static void appldata_get_mem_data(void *data) | |||
147 | 147 | ||
148 | 148 | ||
149 | static struct appldata_ops ops = { | 149 | static struct appldata_ops ops = { |
150 | .ctl_nr = CTL_APPLDATA_MEM, | ||
151 | .name = "mem", | 150 | .name = "mem", |
152 | .record_nr = APPLDATA_RECORD_MEM_ID, | 151 | .record_nr = APPLDATA_RECORD_MEM_ID, |
153 | .size = sizeof(struct appldata_mem_data), | 152 | .size = sizeof(struct appldata_mem_data), |
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c index 6c1815a47714..4d8344336001 100644 --- a/arch/s390/appldata/appldata_net_sum.c +++ b/arch/s390/appldata/appldata_net_sum.c | |||
@@ -142,7 +142,6 @@ static void appldata_get_net_sum_data(void *data) | |||
142 | 142 | ||
143 | 143 | ||
144 | static struct appldata_ops ops = { | 144 | static struct appldata_ops ops = { |
145 | .ctl_nr = CTL_APPLDATA_NET_SUM, | ||
146 | .name = "net_sum", | 145 | .name = "net_sum", |
147 | .record_nr = APPLDATA_RECORD_NET_SUM_ID, | 146 | .record_nr = APPLDATA_RECORD_NET_SUM_ID, |
148 | .size = sizeof(struct appldata_net_sum_data), | 147 | .size = sizeof(struct appldata_net_sum_data), |
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c index 76a15523ae9e..6b3eafe10453 100644 --- a/arch/s390/appldata/appldata_os.c +++ b/arch/s390/appldata/appldata_os.c | |||
@@ -82,7 +82,6 @@ struct appldata_os_data { | |||
82 | static struct appldata_os_data *appldata_os_data; | 82 | static struct appldata_os_data *appldata_os_data; |
83 | 83 | ||
84 | static struct appldata_ops ops = { | 84 | static struct appldata_ops ops = { |
85 | .ctl_nr = CTL_APPLDATA_OS, | ||
86 | .name = "os", | 85 | .name = "os", |
87 | .record_nr = APPLDATA_RECORD_OS_ID, | 86 | .record_nr = APPLDATA_RECORD_OS_ID, |
88 | .owner = THIS_MODULE, | 87 | .owner = THIS_MODULE, |