From nobody Thu Apr 9 16:34:59 2026 Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.167]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3794E35E933 for ; Tue, 3 Mar 2026 12:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.121.94.167 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772542750; cv=none; b=MlmSgmReGGKXJLReNXqn80760bW4jeVICWin/pbraCynpTunmvc2HpzvtTxbHfm8NNglhXMF4c0Vf15uYb5ic51DdH1OpvdKg4g5twqb4l+22XcHEstvJNxHUQ6EuKiuTHh0YEryUdYpAuhON5cG4nwg52U7Lgdef3jGyxbOP6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772542750; c=relaxed/simple; bh=jCkmEf8crPyr76/z5IV3pbKbhmAc8MFwTSLiKtnDMjU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hhrIY/1IeHLHfFjEKrAiD103kK1pe4MjfXq/7U+XwORpbP3xUjFrrSdpXasNeZOI0e8DCqBuveDXKCG+iJnu30Qq6OBlBdVsm+rWGdIeb+NWEj6fCkORYi5Ecva/CtTXWDkilsPTpgcrIVceROe7XAn/LM16cs1peDmJxVxrnmc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xs4all.nl; spf=pass smtp.mailfrom=xs4all.nl; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b=G3F49INs; arc=none smtp.client-ip=195.121.94.167 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xs4all.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xs4all.nl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b="G3F49INs" X-KPN-MessageId: c2469769-1700-11f1-969b-005056abbe64 Received: from smtp.kpnmail.nl (unknown [10.31.155.39]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id c2469769-1700-11f1-969b-005056abbe64; Tue, 03 Mar 2026 13:59:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=xs4all01; h=mime-version:message-id:date:subject:to:from; bh=TxnaUJXOl/lvwlgC9cHqxHBw5mL0eV8RXWHVOARkZuQ=; b=G3F49INszGDNveNcXoHRSmA2hRXx6GlVwcmW6rZgjOY6kkSNM7YZr74PrJhnB6o0M+ou0fLvlTTES vWvz3ynQRbmi/SCRBgmVqWhV/abFTufXVhJyzygWaycW6/zjIuqgt56pp7ZOEeAsf6DtwzsxACj1Qf Pv9D3dVEoY3MFOmrKWoBr5LJ7mq98zXuCwyEEQI8rjruERv2g/6sbw/S215wYf1Zuc6OVAZGs+w0uJ ULzkm1OGLh9pJZhhARuwrkGbX3iS2a3O+hzBTTr39EbEm9++FAFdMuQfAMONF1QoE4V7G1jgg5O+1n Vq1SAEM+Z0LFsfcSZRYSuigLrFldQng== X-KPN-MID: 33|MIhv6Tr+KHyPEw9mxak4PnwrKkm0vwZ/tN+zdTw3URHeK8Zws+lJOKOesJPq+dI F8dPNftYPLtoWhc1iIrlBugXr7Z0anep+oWaSZUikWHM= X-KPN-VerifiedSender: Yes X-CMASSUN: 33|nyki5os/9ZqBUixMOt5dzUw24oacS6lG0IspIKRvKWoYci1xmtjg0yY9TsCbhAW UO4l1t3pnRXYd9PcvCkNFvQ== Received: from daedalus.home (unknown [178.230.196.166]) by smtp.xs4all.nl (Halon) with ESMTPSA id bf0fdb49-1700-11f1-8011-005056ab7447; Tue, 03 Mar 2026 13:59:05 +0100 (CET) From: Jori Koolstra To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi Cc: Jori Koolstra , Greg Kroah-Hartman , linux-pm@vger.kernel.org (open list:DEVICE FREQUENCY (DEVFREQ)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] devfreq: change devfreq_class to a const struct Date: Tue, 3 Mar 2026 13:59:08 +0100 Message-ID: <20260303125909.3523053-1-jkoolstra@xs4all.nl> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The class_create() call has been deprecated in favor of class_register() as the driver core now allows for a struct class to be in read-only memory. Change devfreq_class to be a const struct class and drop the class_create() call. This is compile tested only. Suggested-by: Greg Kroah-Hartman Signed-off-by: Jori Koolstra --- drivers/devfreq/devfreq.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index c0a74091b904..f2298f8e3224 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -36,7 +36,13 @@ #define IS_SUPPORTED_FLAG(f, name) ((f & DEVFREQ_GOV_FLAG_##name) ? true := false) #define IS_SUPPORTED_ATTR(f, name) ((f & DEVFREQ_GOV_ATTR_##name) ? true := false) =20 -static struct class *devfreq_class; +static struct attribute *devfreq_attrs[]; +ATTRIBUTE_GROUPS(devfreq); + +static const struct class devfreq_class =3D { + .name =3D "devfreq", + .dev_groups =3D devfreq_groups +}; static struct dentry *devfreq_debugfs; =20 /* @@ -830,7 +836,7 @@ struct devfreq *devfreq_add_device(struct device *dev, mutex_init(&devfreq->lock); mutex_lock(&devfreq->lock); devfreq->dev.parent =3D dev; - devfreq->dev.class =3D devfreq_class; + devfreq->dev.class =3D &devfreq_class; devfreq->dev.groups =3D profile->dev_groups; devfreq->dev.release =3D devfreq_dev_release; INIT_LIST_HEAD(&devfreq->node); @@ -1807,7 +1813,6 @@ static struct attribute *devfreq_attrs[] =3D { &dev_attr_trans_stat.attr, NULL, }; -ATTRIBUTE_GROUPS(devfreq); =20 static ssize_t polling_interval_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -2019,19 +2024,20 @@ DEFINE_SHOW_ATTRIBUTE(devfreq_summary); =20 static int __init devfreq_init(void) { - devfreq_class =3D class_create("devfreq"); - if (IS_ERR(devfreq_class)) { + int err; + + err =3D class_register(&devfreq_class); + if (err) { pr_err("%s: couldn't create class\n", __FILE__); - return PTR_ERR(devfreq_class); + return err; } =20 devfreq_wq =3D create_freezable_workqueue("devfreq_wq"); if (!devfreq_wq) { - class_destroy(devfreq_class); + class_unregister(&devfreq_class); pr_err("%s: couldn't create workqueue\n", __FILE__); return -ENOMEM; } - devfreq_class->dev_groups =3D devfreq_groups; =20 devfreq_debugfs =3D debugfs_create_dir("devfreq", NULL); debugfs_create_file("devfreq_summary", 0444, base-commit: d466c332e106fe666d1e2f5a24d08e308bebbfa1 --=20 2.53.0