From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A066BC433E3 for ; Fri, 29 May 2020 07:41:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7FC5B20810 for ; Fri, 29 May 2020 07:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590738104; bh=avUZZeiFwnBe4Z4pzzy8hCj7duyuvdRCzae8vUpghDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=E5XIy+ir7rDHfzW9OwKJfm3ZUFmWUlpfhyGyjRXoOgHVHUBxpc4HdFaPX+bcvWxVL eW0fRqhv3Pk49SCWE38xo52zvNmogKG1wZGuRPoKESJmdb2UL9cRkbrR1S6+6/EQ4W 64a2QPDJixTEROXCtABIRu4N1GpNzu8d3ttAxk1g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727012AbgE2Hlo (ORCPT ); Fri, 29 May 2020 03:41:44 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:47064 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726701AbgE2HlW (ORCPT ); Fri, 29 May 2020 03:41:22 -0400 Received: by mail-pg1-f193.google.com with SMTP id p21so1002669pgm.13 for ; Fri, 29 May 2020 00:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sBgsWCIFjc1dCALH3PIiiJW4ZW3ozJ7JvpAnInxDZto=; b=HPcQBBp7oO+YDRSbRobSBLH5GiQL2bXvX/bbp/BXxAf3Xnb2uJlZc9ibvPMHkfBvtJ 4LxOjOw6XUTZAHLry4UYwR8TWXETHRCHYqc+aBVwBJL1rH7Zli77VPXhYU/DGdC3gKQB LB+IvPdHVJNIDZbZ6zpLKKFo6wgypv73xyQ7zAPKK6JhB2IozS2y0y2A58Ms0pE0fPoj QaVIKrmc/NMic5nNC61HQbY9ZUMWlWDCvBN5YoxHqfaAuV6OpTqjUX3FuHp06wPKT5TX 4wOsLq3BP4uXeCaVXekEAjmx311qYOkMXIT4cYZ8zUqa64bD+RQXkyZihPKmTJmIl9IC 9d/g== X-Gm-Message-State: AOAM532rcEKSB6sIq5QRa7vYVKAquCZ2Baj/qIlWBgcFJ4wQzZpY25bC x1cTgVKaIMCvweK9ssd+lHw= X-Google-Smtp-Source: ABdhPJzuX8lSSg8Aasn2k4DvlaVD+6USysUPj9KRkIoQC5Conauc3KXazu1gR/0/ORcChuqRpyUMwQ== X-Received: by 2002:aa7:9f5a:: with SMTP id h26mr7127671pfr.51.1590738080556; Fri, 29 May 2020 00:41:20 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id p19sm6115830pfn.216.2020.05.29.00.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id C929442341; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Cc: julia.lawall@lip6.fr, akpm@linux-foundation.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH 07/13] test_sysctl: use new sysctl subdir helper register_sysctl_subdir() Date: Fri, 29 May 2020 07:41:02 +0000 Message-Id: <20200529074108.16928-8-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci lib/test_sysctl.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- lib/test_sysctl.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 84eaae22d3a6..b17581307756 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -128,26 +128,6 @@ static struct ctl_table test_table[] = { { } }; -static struct ctl_table test_sysctl_table[] = { - { - .procname = "test_sysctl", - .maxlen = 0, - .mode = 0555, - .child = test_table, - }, - { } -}; - -static struct ctl_table test_sysctl_root_table[] = { - { - .procname = "debug", - .maxlen = 0, - .mode = 0555, - .child = test_sysctl_table, - }, - { } -}; - static struct ctl_table_header *test_sysctl_header; static int __init test_sysctl_init(void) @@ -155,7 +135,8 @@ static int __init test_sysctl_init(void) test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL); if (!test_data.bitmap_0001) return -ENOMEM; - test_sysctl_header = register_sysctl_table(test_sysctl_root_table); + test_sysctl_header = register_sysctl_subdir("debug", "test_sysctl", + test_table); if (!test_sysctl_header) { kfree(test_data.bitmap_0001); return -ENOMEM; -- 2.26.2 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luis Chamberlain Date: Fri, 29 May 2020 07:41:02 +0000 Subject: [Ocfs2-devel] [PATCH 07/13] test_sysctl: use new sysctl subdir helper register_sysctl_subdir() In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> Message-ID: <20200529074108.16928-8-mcgrof@kernel.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci lib/test_sysctl.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- lib/test_sysctl.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 84eaae22d3a6..b17581307756 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -128,26 +128,6 @@ static struct ctl_table test_table[] = { { } }; -static struct ctl_table test_sysctl_table[] = { - { - .procname = "test_sysctl", - .maxlen = 0, - .mode = 0555, - .child = test_table, - }, - { } -}; - -static struct ctl_table test_sysctl_root_table[] = { - { - .procname = "debug", - .maxlen = 0, - .mode = 0555, - .child = test_sysctl_table, - }, - { } -}; - static struct ctl_table_header *test_sysctl_header; static int __init test_sysctl_init(void) @@ -155,7 +135,8 @@ static int __init test_sysctl_init(void) test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL); if (!test_data.bitmap_0001) return -ENOMEM; - test_sysctl_header = register_sysctl_table(test_sysctl_root_table); + test_sysctl_header = register_sysctl_subdir("debug", "test_sysctl", + test_table); if (!test_sysctl_header) { kfree(test_data.bitmap_0001); return -ENOMEM; -- 2.26.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E5CC433E0 for ; Fri, 29 May 2020 07:57:57 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A846207D4 for ; Fri, 29 May 2020 07:57:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A846207D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49YH432BKTzDqfb for ; Fri, 29 May 2020 17:57:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.215.195; helo=mail-pg1-f195.google.com; envelope-from=mcgrof@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49YGhy6pGRzDqQy for ; Fri, 29 May 2020 17:41:22 +1000 (AEST) Received: by mail-pg1-f195.google.com with SMTP id o6so191126pgh.2 for ; Fri, 29 May 2020 00:41:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sBgsWCIFjc1dCALH3PIiiJW4ZW3ozJ7JvpAnInxDZto=; b=UCwx5hxZ2daHjNgWu8a4asDxueDyWW2gHCEDJ/Rg/qLhIs/SUlXC+leSvj5qPBBE9q ggZzYLwKApj1w2Q3QIWkhA5DagxQTVpJbI3YWgj72NbmWrZeg97du/k19GMFp474mmz6 ct5OY7hy1Cna/L09nVhVPW6ScX6UxomVZNaW0vAmXUui5whzIj8Ue5QMCTkKGKIjYSCO iVYQ4hkxUQ0lDWQFMIx3M5UNRv3XylHuHmGxD4VkvrtbhigAOlKIfiU2ZTkzrdRcIOHg iCK9Vb2zTXiZzKVFHDccoOUU3BSla+LgeB4YpuTBc+CpHPjfkSuMz8LBZapuAi/4jjY7 RYKQ== X-Gm-Message-State: AOAM5330OdVNNlGu2sC8sFX9md+dPw3oj7qX9PNM2e2cQVuf07AFOm5Q do+H1MjLNwJ4FdFyHEgp55Q= X-Google-Smtp-Source: ABdhPJzuX8lSSg8Aasn2k4DvlaVD+6USysUPj9KRkIoQC5Conauc3KXazu1gR/0/ORcChuqRpyUMwQ== X-Received: by 2002:aa7:9f5a:: with SMTP id h26mr7127671pfr.51.1590738080556; Fri, 29 May 2020 00:41:20 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id p19sm6115830pfn.216.2020.05.29.00.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id C929442341; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Subject: [PATCH 07/13] test_sysctl: use new sysctl subdir helper register_sysctl_subdir() Date: Fri, 29 May 2020 07:41:02 +0000 Message-Id: <20200529074108.16928-8-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci lib/test_sysctl.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- lib/test_sysctl.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 84eaae22d3a6..b17581307756 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -128,26 +128,6 @@ static struct ctl_table test_table[] = { { } }; -static struct ctl_table test_sysctl_table[] = { - { - .procname = "test_sysctl", - .maxlen = 0, - .mode = 0555, - .child = test_table, - }, - { } -}; - -static struct ctl_table test_sysctl_root_table[] = { - { - .procname = "debug", - .maxlen = 0, - .mode = 0555, - .child = test_sysctl_table, - }, - { } -}; - static struct ctl_table_header *test_sysctl_header; static int __init test_sysctl_init(void) @@ -155,7 +135,8 @@ static int __init test_sysctl_init(void) test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL); if (!test_data.bitmap_0001) return -ENOMEM; - test_sysctl_header = register_sysctl_table(test_sysctl_root_table); + test_sysctl_header = register_sysctl_subdir("debug", "test_sysctl", + test_table); if (!test_sysctl_header) { kfree(test_data.bitmap_0001); return -ENOMEM; -- 2.26.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28D27C433E1 for ; Fri, 29 May 2020 07:41:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0546F2074D for ; Fri, 29 May 2020 07:41:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0546F2074D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D35B6E888; Fri, 29 May 2020 07:41:23 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1AA3C6E88C; Fri, 29 May 2020 07:41:21 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id d10so1018372pgn.4; Fri, 29 May 2020 00:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sBgsWCIFjc1dCALH3PIiiJW4ZW3ozJ7JvpAnInxDZto=; b=S5e1ZrAwMAVs57hU8O5zFmWC5Xq0baiDTVggd89Q2gpKUXEfupBiDvcwgIJckmJKfS dw27e5oMZ4R6CpbjYFjVcHb7ilifFs+gmqOek2porx27YABT7MKO8l5UPxDX09VQz5EN Dey2GKyiIovJSjWOpv0q01cDhOds5wOPBjsPMfEpWVAKh3s7fxZMYC2iuhkkNDWdknKz yzbyWkoDd/0gXiT5UmEl6Ci8T57gA4uZ4xBNN46nHV6IZIGlORoS7UFMpDwV0p8w+4hF vh07mMc0nMtsAQiOiNdw4YaExFQLgZthjscHcp9g0HrLO6mfN98h10GOlA1pa68bWn4V hF7g== X-Gm-Message-State: AOAM531nnaFw5EqyOA23oHKfButbnXbMGzKmaUvbKV77RuPPxFPIva72 y4yHOfh1g1zNj5ovNuUFOaU= X-Google-Smtp-Source: ABdhPJzuX8lSSg8Aasn2k4DvlaVD+6USysUPj9KRkIoQC5Conauc3KXazu1gR/0/ORcChuqRpyUMwQ== X-Received: by 2002:aa7:9f5a:: with SMTP id h26mr7127671pfr.51.1590738080556; Fri, 29 May 2020 00:41:20 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id p19sm6115830pfn.216.2020.05.29.00.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id C929442341; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Subject: [PATCH 07/13] test_sysctl: use new sysctl subdir helper register_sysctl_subdir() Date: Fri, 29 May 2020 07:41:02 +0000 Message-Id: <20200529074108.16928-8-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci lib/test_sysctl.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- lib/test_sysctl.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 84eaae22d3a6..b17581307756 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -128,26 +128,6 @@ static struct ctl_table test_table[] = { { } }; -static struct ctl_table test_sysctl_table[] = { - { - .procname = "test_sysctl", - .maxlen = 0, - .mode = 0555, - .child = test_table, - }, - { } -}; - -static struct ctl_table test_sysctl_root_table[] = { - { - .procname = "debug", - .maxlen = 0, - .mode = 0555, - .child = test_sysctl_table, - }, - { } -}; - static struct ctl_table_header *test_sysctl_header; static int __init test_sysctl_init(void) @@ -155,7 +135,8 @@ static int __init test_sysctl_init(void) test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL); if (!test_data.bitmap_0001) return -ENOMEM; - test_sysctl_header = register_sysctl_table(test_sysctl_root_table); + test_sysctl_header = register_sysctl_subdir("debug", "test_sysctl", + test_table); if (!test_sysctl_header) { kfree(test_data.bitmap_0001); return -ENOMEM; -- 2.26.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DA7DC433EA for ; Fri, 29 May 2020 07:41:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ED8352074D for ; Fri, 29 May 2020 07:41:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED8352074D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 32F4F6E890; Fri, 29 May 2020 07:41:27 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1AA3C6E88C; Fri, 29 May 2020 07:41:21 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id d10so1018372pgn.4; Fri, 29 May 2020 00:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sBgsWCIFjc1dCALH3PIiiJW4ZW3ozJ7JvpAnInxDZto=; b=S5e1ZrAwMAVs57hU8O5zFmWC5Xq0baiDTVggd89Q2gpKUXEfupBiDvcwgIJckmJKfS dw27e5oMZ4R6CpbjYFjVcHb7ilifFs+gmqOek2porx27YABT7MKO8l5UPxDX09VQz5EN Dey2GKyiIovJSjWOpv0q01cDhOds5wOPBjsPMfEpWVAKh3s7fxZMYC2iuhkkNDWdknKz yzbyWkoDd/0gXiT5UmEl6Ci8T57gA4uZ4xBNN46nHV6IZIGlORoS7UFMpDwV0p8w+4hF vh07mMc0nMtsAQiOiNdw4YaExFQLgZthjscHcp9g0HrLO6mfN98h10GOlA1pa68bWn4V hF7g== X-Gm-Message-State: AOAM531nnaFw5EqyOA23oHKfButbnXbMGzKmaUvbKV77RuPPxFPIva72 y4yHOfh1g1zNj5ovNuUFOaU= X-Google-Smtp-Source: ABdhPJzuX8lSSg8Aasn2k4DvlaVD+6USysUPj9KRkIoQC5Conauc3KXazu1gR/0/ORcChuqRpyUMwQ== X-Received: by 2002:aa7:9f5a:: with SMTP id h26mr7127671pfr.51.1590738080556; Fri, 29 May 2020 00:41:20 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id p19sm6115830pfn.216.2020.05.29.00.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id C929442341; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:02 +0000 Message-Id: <20200529074108.16928-8-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 07/13] test_sysctl: use new sysctl subdir helper register_sysctl_subdir() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci lib/test_sysctl.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- lib/test_sysctl.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 84eaae22d3a6..b17581307756 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -128,26 +128,6 @@ static struct ctl_table test_table[] = { { } }; -static struct ctl_table test_sysctl_table[] = { - { - .procname = "test_sysctl", - .maxlen = 0, - .mode = 0555, - .child = test_table, - }, - { } -}; - -static struct ctl_table test_sysctl_root_table[] = { - { - .procname = "debug", - .maxlen = 0, - .mode = 0555, - .child = test_sysctl_table, - }, - { } -}; - static struct ctl_table_header *test_sysctl_header; static int __init test_sysctl_init(void) @@ -155,7 +135,8 @@ static int __init test_sysctl_init(void) test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL); if (!test_data.bitmap_0001) return -ENOMEM; - test_sysctl_header = register_sysctl_table(test_sysctl_root_table); + test_sysctl_header = register_sysctl_subdir("debug", "test_sysctl", + test_table); if (!test_sysctl_header) { kfree(test_data.bitmap_0001); return -ENOMEM; -- 2.26.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx