xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Joel Granados via B4 Relay <devnull+j.granados.samsung.com@kernel.org>
To: Luis Chamberlain <mcgrof@kernel.org>,
	willy@infradead.org,  josh@joshtriplett.org,
	Kees Cook <keescook@chromium.org>,
	 Phillip Potter <phil@philpotter.co.uk>,
	 Clemens Ladisch <clemens@ladisch.de>,
	Arnd Bergmann <arnd@arndb.de>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Juergen Gross <jgross@suse.com>,
	 Stefano Stabellini <sstabellini@kernel.org>,
	 Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
	 Jiri Slaby <jirislaby@kernel.org>,
	 "James E.J. Bottomley" <jejb@linux.ibm.com>,
	 "Martin K. Petersen" <martin.petersen@oracle.com>,
	 Doug Gilbert <dgilbert@interlog.com>,
	 Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	 Jason Gunthorpe <jgg@ziepe.ca>,
	Leon Romanovsky <leon@kernel.org>,
	 Corey Minyard <minyard@acm.org>, Theodore Ts'o <tytso@mit.edu>,
	 "Jason A. Donenfeld" <Jason@zx2c4.com>,
	David Ahern <dsahern@kernel.org>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	 Robin Holt <robinmholt@gmail.com>,
	Steve Wahl <steve.wahl@hpe.com>,
	 Russ Weight <russell.h.weight@intel.com>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Song Liu <song@kernel.org>,
	 "K. Y. Srinivasan" <kys@microsoft.com>,
	 Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>,  Dexuan Cui <decui@microsoft.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	 Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	 Rodrigo Vivi <rodrigo.vivi@intel.com>,
	 Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	 David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	 linux-serial@vger.kernel.org, linux-scsi@vger.kernel.org,
	 linuxppc-dev@lists.ozlabs.org, linux-rdma@vger.kernel.org,
	 openipmi-developer@lists.sourceforge.net,
	netdev@vger.kernel.org,  linux-raid@vger.kernel.org,
	linux-hyperv@vger.kernel.org,  intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	 Joel Granados <j.granados@samsung.com>
Subject: [PATCH 06/15] parport: Remove the now superfluous sentinel element from ctl_table array
Date: Thu, 28 Sep 2023 15:21:31 +0200	[thread overview]
Message-ID: <20230928-jag-sysctl_remove_empty_elem_drivers-v1-6-e59120fca9f9@samsung.com> (raw)
In-Reply-To: <20230928-jag-sysctl_remove_empty_elem_drivers-v1-0-e59120fca9f9@samsung.com>

From: Joel Granados <j.granados@samsung.com>

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>
---
 drivers/parport/procfs.c | 42 ++++++++++++++++++------------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 4e5b972c3e26..4118b3e52223 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -259,8 +259,12 @@ PARPORT_MAX_SPINTIME_VALUE;
 struct parport_sysctl_table {
 	struct ctl_table_header *port_header;
 	struct ctl_table_header *devices_header;
-	struct ctl_table vars[12];
-	struct ctl_table device_dir[2];
+#ifdef CONFIG_PARPORT_1284
+	struct ctl_table vars[10];
+#else
+	struct ctl_table vars[5];
+#endif /* IEEE 1284 support */
+	struct ctl_table device_dir[1];
 };
 
 static const struct parport_sysctl_table parport_sysctl_template = {
@@ -303,9 +307,9 @@ static const struct parport_sysctl_table parport_sysctl_template = {
 			.maxlen		= 0,
 			.mode		= 0444,
 			.proc_handler	= do_hardware_modes
-		},
+		}
 #ifdef CONFIG_PARPORT_1284
-		{
+		, {
 			.procname	= "autoprobe",
 			.data		= NULL,
 			.maxlen		= 0,
@@ -339,9 +343,8 @@ static const struct parport_sysctl_table parport_sysctl_template = {
 			.maxlen		= 0,
 			.mode		= 0444,
 			.proc_handler	= do_autoprobe
-		},
+		}
 #endif /* IEEE 1284 support */
-		{}
 	},
 	{
 		{
@@ -350,20 +353,15 @@ static const struct parport_sysctl_table parport_sysctl_template = {
 			.maxlen		= 0,
 			.mode		= 0444,
 			.proc_handler	= do_active_device
-		},
-		{}
+		}
 	},
 };
 
 struct parport_device_sysctl_table
 {
 	struct ctl_table_header *sysctl_header;
-	struct ctl_table vars[2];
-	struct ctl_table device_dir[2];
-	struct ctl_table devices_root_dir[2];
-	struct ctl_table port_dir[2];
-	struct ctl_table parport_dir[2];
-	struct ctl_table dev_dir[2];
+	struct ctl_table vars[1];
+	struct ctl_table device_dir[1];
 };
 
 static const struct parport_device_sysctl_table
@@ -378,8 +376,7 @@ parport_device_sysctl_template = {
 			.proc_handler	= proc_doulongvec_ms_jiffies_minmax,
 			.extra1		= (void*) &parport_min_timeslice_value,
 			.extra2		= (void*) &parport_max_timeslice_value
-		},
-		{}
+		}
 	},
 	{
 		{
@@ -387,18 +384,14 @@ parport_device_sysctl_template = {
 			.data		= NULL,
 			.maxlen		= 0,
 			.mode		= 0555,
-		},
-		{}
+		}
 	}
 };
 
 struct parport_default_sysctl_table
 {
 	struct ctl_table_header *sysctl_header;
-	struct ctl_table vars[3];
-	struct ctl_table default_dir[2];
-	struct ctl_table parport_dir[2];
-	struct ctl_table dev_dir[2];
+	struct ctl_table vars[2];
 };
 
 static struct parport_default_sysctl_table
@@ -422,8 +415,7 @@ parport_default_sysctl_table = {
 			.proc_handler	= proc_dointvec_minmax,
 			.extra1		= (void*) &parport_min_spintime_value,
 			.extra2		= (void*) &parport_max_spintime_value
-		},
-		{}
+		}
 	}
 };
 
@@ -443,7 +435,9 @@ int parport_proc_register(struct parport *port)
 	t->vars[0].data = &port->spintime;
 	for (i = 0; i < 5; i++) {
 		t->vars[i].extra1 = port;
+#ifdef CONFIG_PARPORT_1284
 		t->vars[5 + i].extra2 = &port->probe_info[i];
+#endif /* IEEE 1284 support */
 	}
 
 	port_name_len = strnlen(port->name, PARPORT_NAME_MAX_LEN);

-- 
2.30.2



  parent reply	other threads:[~2023-09-28 13:22 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 13:21 [PATCH 00/15] sysctl: Remove sentinel elements from drivers Joel Granados via B4 Relay
     [not found] ` <20230928-jag-sysctl_remove_empty_elem_drive>
2023-09-28 13:21 ` [PATCH 01/15] cdrom: Remove now superfluous sentinel element from ctl_table array Joel Granados via B4 Relay
2023-09-28 13:36   ` Greg Kroah-Hartman
2023-09-29 12:17     ` Joel Granados
2023-09-30 16:52       ` Phillip Potter
2023-10-02  7:39         ` Joel Granados
2023-09-28 13:21 ` [PATCH 02/15] hpet: " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 03/15] xen: " Joel Granados via B4 Relay
2023-09-28 13:33   ` Juergen Gross
2023-09-28 13:21 ` [PATCH 04/15] tty: " Joel Granados via B4 Relay
2023-10-02  8:17   ` Jiri Slaby
2023-10-02  8:47     ` Christophe Leroy
2023-10-02  9:02       ` Greg Kroah-Hartman
2023-09-28 13:21 ` [PATCH 05/15] scsi: " Joel Granados via B4 Relay
2023-09-28 13:21 ` Joel Granados via B4 Relay [this message]
2023-09-28 13:21 ` [PATCH 07/15] macintosh: Remove the " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 08/15] infiniband: " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 09/15] char-misc: " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 10/15] vrf: " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 11/15] sgi-xp: " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 12/15] fw loader: " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 13/15] raid: Remove " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 14/15] hyper-v/azure: " Joel Granados via B4 Relay
2023-09-28 13:21 ` [PATCH 15/15] intel drm: " Joel Granados via B4 Relay
     [not found] ` <65157da7.5d0a0220.13b5e.9e95SMTPIN_ADDED_BROKEN@mx.google.com>
2023-09-28 15:20   ` [PATCH 13/15] raid: " Song Liu
     [not found] ` <65157da8.050a0220.fb263.fdb1SMTPIN_ADDED_BROKEN@mx.google.com>
2023-09-28 15:26   ` [PATCH 14/15] hyper-v/azure: " Wei Liu
2023-09-29 12:15     ` Joel Granados
2023-09-29 14:03     ` Joel Granados
2023-09-28 16:31 ` [PATCH 00/15] sysctl: Remove sentinel elements from drivers Christophe Leroy
2023-10-02  8:47   ` Joel Granados
2023-10-02  9:02     ` Christophe Leroy
     [not found] ` <=?utf-8?q?=3C20230928-jag-sysctl=5Fremove=5Fempty=5Felem=5Fdrive?=>
2023-09-28 17:51   ` [PATCH 11/15] sgi-xp: Remove the now superfluous sentinel element from ctl_table array Steve Wahl
2023-09-29 12:14     ` Joel Granados

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230928-jag-sysctl_remove_empty_elem_drivers-v1-6-e59120fca9f9@samsung.com \
    --to=devnull+j.granados.samsung.com@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=airlied@gmail.com \
    --cc=arnd@arndb.de \
    --cc=clemens@ladisch.de \
    --cc=daniel@ffwll.ch \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=dgilbert@interlog.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=j.granados@samsung.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=jejb@linux.ibm.com \
    --cc=jgg@ziepe.ca \
    --cc=jgross@suse.com \
    --cc=jirislaby@kernel.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=josh@joshtriplett.org \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=leon@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=martin.petersen@oracle.com \
    --cc=mcgrof@kernel.org \
    --cc=minyard@acm.org \
    --cc=netdev@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=pabeni@redhat.com \
    --cc=phil@philpotter.co.uk \
    --cc=rafael@kernel.org \
    --cc=robinmholt@gmail.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=russell.h.weight@intel.com \
    --cc=song@kernel.org \
    --cc=sstabellini@kernel.org \
    --cc=steve.wahl@hpe.com \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=tytso@mit.edu \
    --cc=wei.liu@kernel.org \
    --cc=willy@infradead.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).