Skip to content

Commit 0829381

Browse files
Joelgranadosmcgrof
authored andcommitted
parport: Remove the now superfluous sentinel element from ctl_table array
This commit comes at the tail end of a greater effort to remove the empty elements at the end of the ctl_table arrays (sentinels) which will reduce the overall build time size of the kernel and run time memory bloat by ~64 bytes per sentinel (further information Link : https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@bombadil.infradead.org/) Remove the unneeded ctl_tables that were used to register intermediate parport directories; only the path is needed at this point. From parport_device_sysctl_table we removed: devices_root_dir, port_dir, parport_dir and dev_dir. From parport_default_sysctl_table we removed: default_dir, parport_dir and dev_dir. Reduce the size by one of the ctl_table arrays that were not removed Assign different sizes to the vars array in parport_sysctl_table depending on CONFIG_PARPORT_1284; this is necessary now that the sysctl register function uses ARRAY_SIZE to calculate the elements within. Remove the sentinel element from parport_sysctl_template, parport_device_sysctl_table and parport_default_sysctl_table. Signed-off-by: Joel Granados <j.granados@samsung.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent b52b716 commit 0829381

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

drivers/parport/procfs.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,12 @@ PARPORT_MAX_SPINTIME_VALUE;
259259
struct parport_sysctl_table {
260260
struct ctl_table_header *port_header;
261261
struct ctl_table_header *devices_header;
262-
struct ctl_table vars[12];
263-
struct ctl_table device_dir[2];
262+
#ifdef CONFIG_PARPORT_1284
263+
struct ctl_table vars[10];
264+
#else
265+
struct ctl_table vars[5];
266+
#endif /* IEEE 1284 support */
267+
struct ctl_table device_dir[1];
264268
};
265269

266270
static const struct parport_sysctl_table parport_sysctl_template = {
@@ -341,7 +345,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
341345
.proc_handler = do_autoprobe
342346
},
343347
#endif /* IEEE 1284 support */
344-
{}
345348
},
346349
{
347350
{
@@ -351,19 +354,14 @@ static const struct parport_sysctl_table parport_sysctl_template = {
351354
.mode = 0444,
352355
.proc_handler = do_active_device
353356
},
354-
{}
355357
},
356358
};
357359

358360
struct parport_device_sysctl_table
359361
{
360362
struct ctl_table_header *sysctl_header;
361-
struct ctl_table vars[2];
362-
struct ctl_table device_dir[2];
363-
struct ctl_table devices_root_dir[2];
364-
struct ctl_table port_dir[2];
365-
struct ctl_table parport_dir[2];
366-
struct ctl_table dev_dir[2];
363+
struct ctl_table vars[1];
364+
struct ctl_table device_dir[1];
367365
};
368366

369367
static const struct parport_device_sysctl_table
@@ -379,7 +377,6 @@ parport_device_sysctl_template = {
379377
.extra1 = (void*) &parport_min_timeslice_value,
380378
.extra2 = (void*) &parport_max_timeslice_value
381379
},
382-
{}
383380
},
384381
{
385382
{
@@ -388,17 +385,13 @@ parport_device_sysctl_template = {
388385
.maxlen = 0,
389386
.mode = 0555,
390387
},
391-
{}
392388
}
393389
};
394390

395391
struct parport_default_sysctl_table
396392
{
397393
struct ctl_table_header *sysctl_header;
398-
struct ctl_table vars[3];
399-
struct ctl_table default_dir[2];
400-
struct ctl_table parport_dir[2];
401-
struct ctl_table dev_dir[2];
394+
struct ctl_table vars[2];
402395
};
403396

404397
static struct parport_default_sysctl_table
@@ -423,7 +416,6 @@ parport_default_sysctl_table = {
423416
.extra1 = (void*) &parport_min_spintime_value,
424417
.extra2 = (void*) &parport_max_spintime_value
425418
},
426-
{}
427419
}
428420
};
429421

@@ -443,7 +435,9 @@ int parport_proc_register(struct parport *port)
443435
t->vars[0].data = &port->spintime;
444436
for (i = 0; i < 5; i++) {
445437
t->vars[i].extra1 = port;
438+
#ifdef CONFIG_PARPORT_1284
446439
t->vars[5 + i].extra2 = &port->probe_info[i];
440+
#endif /* IEEE 1284 support */
447441
}
448442

449443
port_name_len = strnlen(port->name, PARPORT_NAME_MAX_LEN);

0 commit comments

Comments
 (0)