From nobody Sat Apr 11 08:26:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1677790031; cv=none; d=zohomail.com; s=zohoarc; b=N47x5IvE+8nDwlK4Sqlis/d2o4WzZcWITvyzp8rH47d0cPFnyGe/JEdGnjYXEMgxY03jWUSXiaY18Rl4eYzex0oX7FI5RLqi2qr+4Kwv6YeKsLcySHHqjr6/f857+mf75/jCK33r1s2QY8xBFFZyR2fyD58HvMNaZY5GimUsqFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677790031; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=71lfCsPo7yFKiIAEzb7+CVhOSJuKqCJLiCYyMEP1nX8=; b=etr4N67gJ7Z1DLXX2ON5MVu1GNkSLwqN9lgZH11y6vrYMgTC7Hv2Gzrumj349cw5X05LaTEmaRjni3FNmG9iI9vUDTBn5wV3hoESaLPUC0P3Ub1JEx68bxG8Pi0ACvnH2GItJ+E/aOlYd9hk+j4AAUhr3la0PWy8HwXPyc2t7mc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16777900312921021.9072987537988; Thu, 2 Mar 2023 12:47:11 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.505400.778159 (Exim 4.92) (envelope-from ) id 1pXpp8-0004t6-Oe; Thu, 02 Mar 2023 20:46:46 +0000 Received: by outflank-mailman (output) from mailman id 505400.778159; Thu, 02 Mar 2023 20:46:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pXpp8-0004qh-IF; Thu, 02 Mar 2023 20:46:46 +0000 Received: by outflank-mailman (input) for mailman id 505400; Thu, 02 Mar 2023 20:46:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pXpp7-0004iE-Rf for xen-devel@lists.xenproject.org; Thu, 02 Mar 2023 20:46:45 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:3::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 56b74eb2-b93b-11ed-96ad-2f268f93b82a; Thu, 02 Mar 2023 21:46:43 +0100 (CET) Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXpoc-003HXU-Mw; Thu, 02 Mar 2023 20:46:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 56b74eb2-b93b-11ed-96ad-2f268f93b82a DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=71lfCsPo7yFKiIAEzb7+CVhOSJuKqCJLiCYyMEP1nX8=; b=p6Yel5Hfld+1FW2EBNV5366POq vJPcZmFCSoBMiHWsnzV+jFaz/uDjYDZKCSMVih6k7yTXZeK0esG+XoqGZm9PRwj7XoUWz1rJk2q/E W+/FxaL2XVpQFgwiqiS/BLSFmuYGCiJ2RytjR/MyXk6RSB5u/Gb6pD9cbTP3FOuh/IUlWNVZg9nlC ae1SW5g3A+R91mMBWyCJsTKqh3vMrYlSFc91+9y4TqjqjC2hXi5zZKAl59br57tm1NS/Si0Gk8WIN 4LHLL8b5jmRCk45aZvhVhNvYHw+agvS23gBr87drZJxFTEPUWGT0jgdOq4ItcyYm6kfRP8hHNOmNG e/bvQgIQ==; From: Luis Chamberlain To: ebiederm@xmission.com, keescook@chromium.org, yzaikin@google.com, jejb@linux.ibm.com, martin.petersen@oracle.com, minyard@acm.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, song@kernel.org, robinmholt@gmail.com, steve.wahl@hpe.com, mike.travis@hpe.com, arnd@arndb.de, gregkh@linuxfoundation.org, jirislaby@kernel.org, jgross@suse.com, sstabellini@kernel.org, oleksandr_tyshchenko@epam.com, xen-devel@lists.xenproject.org Cc: j.granados@samsung.com, zhangpeng362@huawei.com, tangmeng@uniontech.com, willy@infradead.org, nixiaoming@huawei.com, sujiaxun@uniontech.com, patches@lists.linux.dev, linux-fsdevel@vger.kernel.org, apparmor@lists.ubuntu.com, linux-raid@vger.kernel.org, linux-scsi@vger.kernel.org, linux-hyperv@vger.kernel.org, openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH 5/7] sgi-xp: simplify sysctl registration Date: Thu, 2 Mar 2023 12:46:10 -0800 Message-Id: <20230302204612.782387-6-mcgrof@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230302204612.782387-1-mcgrof@kernel.org> References: <20230302204612.782387-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Luis Chamberlain X-ZohoMail-DKIM: pass (identity @infradead.org) X-ZM-MESSAGEID: 1677790032891100003 Content-Type: text/plain; charset="utf-8" Although this driver is a good use case for having a directory that is not other directories and then subdirectories with more entries, the usage of register_sysctl_table() can recurse and increases complexity so to avoid that just split out the registration to each directory with its own entries. register_sysctl_table() is a deprecated compatibility wrapper. register_sysctl() can do the directory creation for you so just use that. Signed-off-by: Luis Chamberlain Reviewed-by: Steve Wahl --- drivers/misc/sgi-xp/xpc_main.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c index b2c3c22fc13c..6da509d692bb 100644 --- a/drivers/misc/sgi-xp/xpc_main.c +++ b/drivers/misc/sgi-xp/xpc_main.c @@ -93,7 +93,7 @@ int xpc_disengage_timelimit =3D XPC_DISENGAGE_DEFAULT_TIM= ELIMIT; static int xpc_disengage_min_timelimit; /* =3D 0 */ static int xpc_disengage_max_timelimit =3D 120; =20 -static struct ctl_table xpc_sys_xpc_hb_dir[] =3D { +static struct ctl_table xpc_sys_xpc_hb[] =3D { { .procname =3D "hb_interval", .data =3D &xpc_hb_interval, @@ -112,11 +112,7 @@ static struct ctl_table xpc_sys_xpc_hb_dir[] =3D { .extra2 =3D &xpc_hb_check_max_interval}, {} }; -static struct ctl_table xpc_sys_xpc_dir[] =3D { - { - .procname =3D "hb", - .mode =3D 0555, - .child =3D xpc_sys_xpc_hb_dir}, +static struct ctl_table xpc_sys_xpc[] =3D { { .procname =3D "disengage_timelimit", .data =3D &xpc_disengage_timelimit, @@ -127,14 +123,9 @@ static struct ctl_table xpc_sys_xpc_dir[] =3D { .extra2 =3D &xpc_disengage_max_timelimit}, {} }; -static struct ctl_table xpc_sys_dir[] =3D { - { - .procname =3D "xpc", - .mode =3D 0555, - .child =3D xpc_sys_xpc_dir}, - {} -}; + static struct ctl_table_header *xpc_sysctl; +static struct ctl_table_header *xpc_sysctl_hb; =20 /* non-zero if any remote partition disengage was timed out */ int xpc_disengage_timedout; @@ -1041,6 +1032,8 @@ xpc_do_exit(enum xp_retval reason) =20 if (xpc_sysctl) unregister_sysctl_table(xpc_sysctl); + if (xpc_sysctl_hb) + unregister_sysctl_table(xpc_sysctl_hb); =20 xpc_teardown_partitions(); =20 @@ -1243,7 +1236,8 @@ xpc_init(void) goto out_1; } =20 - xpc_sysctl =3D register_sysctl_table(xpc_sys_dir); + xpc_sysctl =3D register_sysctl("xpc", xpc_sys_xpc); + xpc_sysctl_hb =3D register_sysctl("xpc/hb", xpc_sys_xpc_hb); =20 /* * Fill the partition reserved page with the information needed by @@ -1308,6 +1302,8 @@ xpc_init(void) (void)unregister_die_notifier(&xpc_die_notifier); (void)unregister_reboot_notifier(&xpc_reboot_notifier); out_2: + if (xpc_sysctl_hb) + unregister_sysctl_table(xpc_sysctl_hb); if (xpc_sysctl) unregister_sysctl_table(xpc_sysctl); =20 --=20 2.39.1