linux/arch/s390/appldata
Luis Chamberlain 7db1224630 s390: simplify dynamic sysctl registration for appldata_register_ops
The routine appldata_register_ops() allocates a sysctl table
with 4 entries. The firsts one,   ops->ctl_table[0] is the parent directory
with an empty entry following it, ops->ctl_table[1]. The next entry is
for the ops->name and that is     ops->ctl_table[2]. It needs an empty
entry following that, and that is ops->ctl_table[3]. And so hence the
kcalloc(4, sizeof(struct ctl_table), GFP_KERNEL).

We can simplify this considerably since sysctl_register("foo", table)
can create the parent directory for us if it does not exist. So we
can just remove the first two entries and move back the ops->name to
the first entry, and just use kcalloc(2, ...).

[gor@linux.ibm.com: appldata_generic_handler fixup ctl_table index 2->0]
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20230310234525.3986352-7-mcgrof@kernel.org
Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2023-03-20 10:56:49 +01:00
..
appldata_base.c s390: simplify dynamic sysctl registration for appldata_register_ops 2023-03-20 10:56:49 +01:00
appldata_mem.c Documentation/s390: Update / remove developerWorks web links 2020-05-20 10:22:51 +02:00
appldata_net_sum.c Documentation/s390: Update / remove developerWorks web links 2020-05-20 10:22:51 +02:00
appldata_os.c s390/appldata: use struct_size() helper 2020-06-29 16:32:34 +02:00
appldata.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00