Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3261152rdh; Thu, 28 Sep 2023 07:09:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBlgsc/g/VflD5F2aI6RZhTL++qMe4/yQwe1r0SjJuuYgxRlpX1Nxh3TZFiiWc5quhmFQT X-Received: by 2002:a17:90a:b885:b0:276:e53e:cad6 with SMTP id o5-20020a17090ab88500b00276e53ecad6mr1234618pjr.4.1695910141544; Thu, 28 Sep 2023 07:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695910141; cv=none; d=google.com; s=arc-20160816; b=wQbrQMGQ2SsMwTFgw4FAQP6tVk/to74/fEXuTrfZA0ja44yl+OaQ1klDM4h6sCegd1 y2inCZHNrP2VDJM1YxsnP522izCchpb1cpty1i/PnML+NHmgb1RgKsBR/nGHYnN/YSA9 eTQG5iuHED7UhHuIp2qkSD1WJzca5Tq7T2R1DcN1esBK3ZzvMsxMqLdZxQyzv9TXXhZR SYV1dGtArAxLh3Bs3k7zuOKj0eKHCq8jaPTo5DqVGBgfD85WaQE8yVLnHpMGS9+06RZl UrYm464pqAw+LKzN9xNGdzuq2IX+oG9S6xFPOhKa5wrTTtUkQ0OQjgqMmEzUnxOBvvV3 TNjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=SA3VqL08oSWHzHoCduLUT3tIm358RwQ0omLNESpvc/E=; fh=0WjC/m0PKq7DkPlkZ1T/dcgYhTvNU0NS7PVcM01xgN4=; b=wFmaepvS4/PRoCM/oWMtdvu7F6hTGO4i8pLB5o8EGG0/VX3dUdte+XWA5wD1btos4Q p6EJPztzTq4Cs2JcbhYqW19KA/Q9SCl+2GdwmFiu2i18TvlSe0PRpPI6O84Zu+qZkE3o XzUP2hhqvd4gRT1jPSrVBz+d7A65YzPXphGPmJHoEw86E23aZkPF8GjPgVJ1AQd/omBr 9rZRbnTR4pprV2T/Li3CWJ4wIjIYWkcqIIqxUUtT+dSRLQym0dOU3S5vNclq1MCwnuKM zPDE8TS+E3Kk5m7zUUE2tSeTKv8VogOsznB4aAOm6nztLFHzZEJMGPFptdot5EE4Hfy8 basg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pU3Eq0ij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e17-20020a17090ac21100b002791baa4729si857558pjt.57.2023.09.28.07.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 07:09:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pU3Eq0ij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 37D4881D7701; Thu, 28 Sep 2023 06:21:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232717AbjI1NUv (ORCPT + 99 others); Thu, 28 Sep 2023 09:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231627AbjI1NUl (ORCPT ); Thu, 28 Sep 2023 09:20:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7321819C; Thu, 28 Sep 2023 06:20:39 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPS id A692BC116D2; Thu, 28 Sep 2023 13:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695907236; bh=037Ze6Oh3D2awDcZtKZjRWRmyXeBya+W4CX5rPaqzIo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=pU3Eq0ijKK73kzmdJ+ylSZryDoz7esCxxiGEWFn0fUyU2pbYj+g3oDo4B2D//OLAZ EAuJqWXLHJcfP/sWHMQ+nq2gXHsF3pmrxsknsc8ipoY9K/BN0UfqX/9i1kOMLV1Gfq UrRqoY6xJOCrvcixf/iiMEBJWk3MIbjU3FQ5Z8bG9O+7EdG9SjPJNzHDhTKSjKYYEP aZBghfVv5ZG9DBNwn9SCgRA9eCm3HTtKRCGg/ekMG4BW0eAP/SYED43uqw/Y2wcHkh nmRagNQKjRUwuozNh1Eh3QCSddVdmyGwZjF7qfCJEWoCpf/ObEWrgp1Z01q+gSHcuI G/cDFVqhlSkVQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C5ADE732D4; Thu, 28 Sep 2023 13:20:36 +0000 (UTC) From: Joel Granados via B4 Relay Date: Thu, 28 Sep 2023 15:21:31 +0200 Subject: [PATCH 06/15] parport: Remove the now superfluous sentinel element from ctl_table array MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230928-jag-sysctl_remove_empty_elem_drivers-v1-6-e59120fca9f9@samsung.com> References: <20230928-jag-sysctl_remove_empty_elem_drivers-v1-0-e59120fca9f9@samsung.com> In-Reply-To: <20230928-jag-sysctl_remove_empty_elem_drivers-v1-0-e59120fca9f9@samsung.com> To: Luis Chamberlain , willy@infradead.org, josh@joshtriplett.org, Kees Cook , Phillip Potter , Clemens Ladisch , Arnd Bergmann , Greg Kroah-Hartman , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Jiri Slaby , "James E.J. Bottomley" , "Martin K. Petersen" , Doug Gilbert , Sudip Mukherjee , Jason Gunthorpe , Leon Romanovsky , Corey Minyard , Theodore Ts'o , "Jason A. Donenfeld" , David Ahern , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Robin Holt , Steve Wahl , Russ Weight , "Rafael J. Wysocki" , Song Liu , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter 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 X-Mailer: b4 0.13-dev-86aa5 X-Developer-Signature: v=1; a=openpgp-sha256; l=4351; i=j.granados@samsung.com; h=from:subject:message-id; bh=WChTYX7s4/WvuQm5SyjCReq4OLhKQc/jMANe9UKK8MA=; b=owEB7QES/pANAwAKAbqXzVK3lkFPAcsmYgBlFX3domrs1Rr8nCLu3I2SozBNrKydcRCbph2hu qHdrIVsBJGJAbMEAAEKAB0WIQSuRwlXJeYxJc7LJ5C6l81St5ZBTwUCZRV93QAKCRC6l81St5ZB T03WDACBmWcNFPTto1zM9apZjylAnDoNPMsUznqyxFf8kY2U9iRHXbIxgeTlIPEo7qZMmu1m5/J sX1nwnUwAdUaji0Q4eLEKLDGEOqU473kX4ysJaOf4v81JMRwF5WvaiFXFgI+XQZI5icxGY+mxuG iSH+hJofoKo2WdHnnDV+xfcFS5Q7F32a0wY705vontJcNmQsaupkws8MxZar0hCVXyMRkmqk8O2 8GrB+kL0MeUKc5ewZtAKuWPCuKSSWXRBOAYXFE9xHFAFAuEucyF++YrG+hYvcLvyHiHl0KXSlft AqUwfJSnjFw/kMt/PkFeXArBwIoc1O+dhwm1NflO2GlT+yNZ2I1mOMZSZlvJX6nedNWzXoXlHPd +RdWZoKt3uKvrhG2SzZ87drY9N7egpXbrqtlklIO0eBmsm2niO6RJX0PariUYYv6Ca2FPBnsj2o 4WEP1Kpo3C5EbdAOfNZiLWtOc0wOabRtggAZzBVqo0lPpwIr5zxOU1TLAXL8njXS696Dg= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 28 Sep 2023 06:21:04 -0700 (PDT) From: Joel Granados 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 --- 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