Message ID | 20230207-kobj_type-cpufreq-v1-1-c7fa2dbd0754@weissschuh.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3058372wrn; Tue, 7 Feb 2023 12:22:54 -0800 (PST) X-Google-Smtp-Source: AK7set9BGAo/5U2JgjlfnR3hOjvSr06hqyMjRebgaMbo84dv2b51GJuD25NIy99htHlJR0bjVlCQ X-Received: by 2002:a17:906:4a48:b0:8aa:c388:5589 with SMTP id a8-20020a1709064a4800b008aac3885589mr182367ejv.76.1675801374164; Tue, 07 Feb 2023 12:22:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675801374; cv=none; d=google.com; s=arc-20160816; b=rkqqhnAq2YHqNBni1cmoR5zicVLVRjIOoicTWBBjkEMiA1yjXi4bi09NXj6CiPoHqv je3GHrN6TuCfcATeLkg+mZPsc+NyGugAwW+FmWrKAVAOgOoFD0Z/Ma6XmkfMg5HuLzqb +FxZHy5JkBCXN9XdwF0K+5jnQGON7ZCEYiCOJ/0BmqGZbq4pMMKNGO94xZ8mcbAy5QAs NTpUHaEW/Ih5Ismv/PzO34R+RU8/hWXTL/Uc9PSoqJzTY7ZZbnpYm63QZbsdWV80IfVR 8H1o0b6/uI+iAviK+/kEP49TjiEYjGA64ZLIiFkZ4rgoZDrWRSkoKLEV1/6GC3WmaVsS Mk7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:dkim-signature:from; bh=sifMZ5nuuZ4nR68FlWgnZVtEzsybz8kIUEU77mc7ij0=; b=TbKS5LCcLNFRpeyOirQFraTcCFZjhr4tQsEwIZZWUu9PznfcYHni1TJ6Lx4utHkluO q94/6Gw5KjmCL8i2vfHLrNA5MH8+u77cgqqa6df/kZckep8fbjp4UQcRYZk4qOv5GMz+ mPXQGue1oBVT4/jBG6Zl5u3umizhRbI4p9eyDX0mycmATrP4VSrNIVXvmqr9ni0AmLCm dvKzz2PLkMRZjHkthY1vS9S5C7dIpqRQ2ImMW43TCl9VTk5dVm/z4ppAeRDcFZiGS5d6 FwLyuXnEJKkI0sGvX9droWBJ8DF4K+TAL01wyFlu86VgeTPd8TihZLH+Qx7JUF9QLB/C 73tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=g4Ed3Zyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fh23-20020a1709073a9700b00887c0163236si17156468ejc.224.2023.02.07.12.22.17; Tue, 07 Feb 2023 12:22:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=g4Ed3Zyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232043AbjBGT62 (ORCPT <rfc822;kmanaouilinux@gmail.com> + 99 others); Tue, 7 Feb 2023 14:58:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231942AbjBGT60 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 7 Feb 2023 14:58:26 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E4821EBF3; Tue, 7 Feb 2023 11:58:24 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <linux@weissschuh.net> DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1675799902; bh=gQIB2oBdFzdMrOmsZZakdwbSbKgg9O/YSolMA4XUr1U=; h=From:Date:Subject:To:Cc:From; b=g4Ed3ZyyQ696wqyDleKSdeI0hjWTXYFovyZVz8/CWkk7n4Hd6VYsZdBRqmpcsdtAv bZhGPUbHmHvxbrT0snImNyA43bIMd2stlpR6TVUfL7KELxv+8DL2MrfkYYb10RPY0k vzBSElGdrbG/I7tJMse21hvzqKKbQNIh9dqmBKw0= Date: Tue, 07 Feb 2023 19:58:18 +0000 Subject: [PATCH] cpufreq: Make kobj_type structure constant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230207-kobj_type-cpufreq-v1-1-c7fa2dbd0754@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAFmt4mMC/x2NWwrCMBAAr1L224WYUBSvIiJ5bOxqSePGilJ69 y79nIFhFmgkTA0u3QJCX248FYXjoYM4+PIg5KQM1lhnrDnhawrP++dfCWOds9Abc/Kpd9mE3p1 Bu+AbYRBf4qBlmcdRZRXK/NtH19u6bv/PHtt4AAAA To: "Rafael J. Wysocki" <rafael@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org> Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas?= =?utf-8?q?_Wei=C3=9Fschuh?= <linux@weissschuh.net> X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675799898; l=1020; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=gQIB2oBdFzdMrOmsZZakdwbSbKgg9O/YSolMA4XUr1U=; b=oSax7r559kqmhMpcuU6FLIVeWeqnoxNwcj7aKLS5irfkVrnnp/ZceW9/4J7YUIGFNDSFOAYt+ BdzEBP0Q/HrBNK+h+fgBac9tE8ij+v5QMPLNT9pNVoI7V0axMiu87BY X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757205101650472319?= X-GMAIL-MSGID: =?utf-8?q?1757205101650472319?= |
Series |
cpufreq: Make kobj_type structure constant
|
|
Commit Message
Thomas Weißschuh
Feb. 7, 2023, 7:58 p.m. UTC
Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.
Take advantage of this to constify the structure definition to prevent
modification at runtime.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/cpufreq/cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
base-commit: 513c1a3d3f1982fb850c910937099525b0d35e24
change-id: 20230207-kobj_type-cpufreq-fdad53f0b538
Best regards,
Comments
On 07-02-23, 19:58, Thomas Weißschuh wrote: > Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.") > the driver core allows the usage of const struct kobj_type. > > Take advantage of this to constify the structure definition to prevent > modification at runtime. > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > --- > drivers/cpufreq/cpufreq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 7e56a42750ea..ceb1574417f9 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -993,7 +993,7 @@ static const struct sysfs_ops sysfs_ops = { > .store = store, > }; > > -static struct kobj_type ktype_cpufreq = { > +static const struct kobj_type ktype_cpufreq = { > .sysfs_ops = &sysfs_ops, > .default_groups = cpufreq_groups, > .release = cpufreq_sysfs_release, > Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
On Wed, Feb 8, 2023 at 6:04 AM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > On 07-02-23, 19:58, Thomas Weißschuh wrote: > > Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.") > > the driver core allows the usage of const struct kobj_type. > > > > Take advantage of this to constify the structure definition to prevent > > modification at runtime. > > > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > > --- > > drivers/cpufreq/cpufreq.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > index 7e56a42750ea..ceb1574417f9 100644 > > --- a/drivers/cpufreq/cpufreq.c > > +++ b/drivers/cpufreq/cpufreq.c > > @@ -993,7 +993,7 @@ static const struct sysfs_ops sysfs_ops = { > > .store = store, > > }; > > > > -static struct kobj_type ktype_cpufreq = { > > +static const struct kobj_type ktype_cpufreq = { > > .sysfs_ops = &sysfs_ops, > > .default_groups = cpufreq_groups, > > .release = cpufreq_sysfs_release, > > > > Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Applied as 6.3 material, thanks!
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 7e56a42750ea..ceb1574417f9 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -993,7 +993,7 @@ static const struct sysfs_ops sysfs_ops = { .store = store, }; -static struct kobj_type ktype_cpufreq = { +static const struct kobj_type ktype_cpufreq = { .sysfs_ops = &sysfs_ops, .default_groups = cpufreq_groups, .release = cpufreq_sysfs_release,