From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C7ECC678D5 for ; Wed, 11 Jan 2023 11:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbjAKLal (ORCPT ); Wed, 11 Jan 2023 06:30:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbjAKLad (ORCPT ); Wed, 11 Jan 2023 06:30:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1342F959F; Wed, 11 Jan 2023 03:30:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C407EB819EF; Wed, 11 Jan 2023 11:30:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C46B9C433F0; Wed, 11 Jan 2023 11:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436628; bh=NT+9kgxXbcKs00BnDvnD/WUZhhoZwpAjU6ciWTyu3pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sxSjyavqoosrBfWnDYfgp0fXOcYU02X4gbmzX1NurCIj20jpUuPtnZ3z0RRPonBAq GBmn7bvwZgeKI393bFz7L3CAJ1NACxZZJZtAhSdGaKCzBQad/R+h+Joj07opqkPbhf ic00URaZmYHNBloFrUB3pkwgzqJgThKSPOs9ejd4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , David Airlie , Daniel Vetter , Benjamin Herrenschmidt , Rob Herring , Frank Rowand , Liang He , Thomas Gleixner , Christophe JAILLET , Thomas Zimmermann , Dmitry Baryshkov , Douglas Anderson , Lyude Paul , Corentin Labbe , Zou Wei , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH v2 01/16] of: device: make of_device_uevent_modalias() take a const device * Date: Wed, 11 Jan 2023 12:30:03 +0100 Message-Id: <20230111113018.459199-2-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6990; i=gregkh@linuxfoundation.org; h=from:subject; bh=NT+9kgxXbcKs00BnDvnD/WUZhhoZwpAjU6ciWTyu3pU=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75h6f8XZ5Dz+vkPnp+e0LZPNmVd7QN4paeLrFdENO7CIz kY6IjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIVSzDPF0f/icnJ1hm3l52cqfDvR Mpq9Y4/WeYp3D+0QHd+CuVUyWNX7yY/Sv+0M36UAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" of_device_uevent_modalias() does not modify the device pointer passed to it, so mark it constant. In order to properly do this, a number of busses need to have a modalias function added as they were attempting to just point to of_device_uevent_modalias instead of their bus-specific modalias function. This is fine except if the prototype for a bus and device type modalias function diverges and then problems could happen. To prevent all of that, just wrap the call to of_device_uevent_modalias() directly for each bus and device type individually. Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Chen-Yu Tsai Cc: Jernej Skrabec Cc: Samuel Holland Cc: David Airlie Cc: Daniel Vetter Cc: Benjamin Herrenschmidt Cc: Rob Herring Cc: Frank Rowand Cc: Liang He Cc: Greg Kroah-Hartman Cc: Thomas Gleixner Cc: Christophe JAILLET Cc: Thomas Zimmermann Cc: Dmitry Baryshkov Cc: Douglas Anderson Cc: Lyude Paul Cc: Corentin Labbe Cc: Zou Wei Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-sunxi@lists.linux.dev Cc: dri-devel@lists.freedesktop.org Cc: devicetree@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede --- arch/powerpc/platforms/pseries/ibmebus.c | 7 ++++++- drivers/bus/sunxi-rsb.c | 7 ++++++- drivers/gpu/drm/display/drm_dp_aux_bus.c | 7 ++++++- drivers/macintosh/macio_asic.c | 7 ++++++- drivers/of/device.c | 4 ++-- include/linux/of_device.h | 4 ++-- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platfo= rms/pseries/ibmebus.c index a870cada7acd..58b798a0e879 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c @@ -426,9 +426,14 @@ static struct attribute *ibmebus_bus_device_attrs[] = =3D { }; ATTRIBUTE_GROUPS(ibmebus_bus_device); =20 +static int ibmebus_bus_modalias(struct device *dev, struct kobj_uevent_env= *env) +{ + return of_device_uevent_modalias(dev, env); +} + struct bus_type ibmebus_bus_type =3D { .name =3D "ibmebus", - .uevent =3D of_device_uevent_modalias, + .uevent =3D ibmebus_bus_modalias, .bus_groups =3D ibmbus_bus_groups, .match =3D ibmebus_bus_bus_match, .probe =3D ibmebus_bus_device_probe, diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c index 3aa91aed3bf7..a180af11e034 100644 --- a/drivers/bus/sunxi-rsb.c +++ b/drivers/bus/sunxi-rsb.c @@ -172,12 +172,17 @@ static void sunxi_rsb_device_remove(struct device *de= v) drv->remove(to_sunxi_rsb_device(dev)); } =20 +static int sunxi_rsb_device_modalias(struct device *dev, struct kobj_ueven= t_env *env) +{ + return of_device_uevent_modalias(dev, env); +} + static struct bus_type sunxi_rsb_bus =3D { .name =3D RSB_CTRL_NAME, .match =3D sunxi_rsb_device_match, .probe =3D sunxi_rsb_device_probe, .remove =3D sunxi_rsb_device_remove, - .uevent =3D of_device_uevent_modalias, + .uevent =3D sunxi_rsb_device_modalias, }; =20 static void sunxi_rsb_dev_release(struct device *dev) diff --git a/drivers/gpu/drm/display/drm_dp_aux_bus.c b/drivers/gpu/drm/dis= play/drm_dp_aux_bus.c index f5741b45ca07..e31a0261c53e 100644 --- a/drivers/gpu/drm/display/drm_dp_aux_bus.c +++ b/drivers/gpu/drm/display/drm_dp_aux_bus.c @@ -161,9 +161,14 @@ static void dp_aux_ep_dev_release(struct device *dev) kfree(aux_ep_with_data); } =20 +static int dp_aux_ep_dev_modalias(struct device *dev, struct kobj_uevent_e= nv *env) +{ + return of_device_uevent_modalias(dev, env); +} + static struct device_type dp_aux_device_type_type =3D { .groups =3D dp_aux_ep_dev_groups, - .uevent =3D of_device_uevent_modalias, + .uevent =3D dp_aux_ep_dev_modalias, .release =3D dp_aux_ep_dev_release, }; =20 diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 3bc1f374e657..7f2b0107c733 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -128,12 +128,17 @@ static int macio_device_resume(struct device * dev) return 0; } =20 +static int macio_device_modalias(struct device *dev, struct kobj_uevent_en= v *env) +{ + return of_device_uevent_modalias(dev, env); +} + extern const struct attribute_group *macio_dev_groups[]; =20 struct bus_type macio_bus_type =3D { .name =3D "macio", .match =3D macio_bus_match, - .uevent =3D of_device_uevent_modalias, + .uevent =3D macio_device_modalias, .probe =3D macio_device_probe, .remove =3D macio_device_remove, .shutdown =3D macio_device_shutdown, diff --git a/drivers/of/device.c b/drivers/of/device.c index c674a13c3055..dda51b7ce597 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -248,7 +248,7 @@ const void *of_device_get_match_data(const struct devic= e *dev) } EXPORT_SYMBOL(of_device_get_match_data); =20 -static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize= _t len) +static ssize_t of_device_get_modalias(const struct device *dev, char *str,= ssize_t len) { const char *compat; char *c; @@ -372,7 +372,7 @@ void of_device_uevent(const struct device *dev, struct = kobj_uevent_env *env) mutex_unlock(&of_mutex); } =20 -int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *= env) +int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent= _env *env) { int sl; =20 diff --git a/include/linux/of_device.h b/include/linux/of_device.h index ab7d557d541d..f4b57614979d 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -36,7 +36,7 @@ extern ssize_t of_device_modalias(struct device *dev, cha= r *str, ssize_t len); extern int of_device_request_module(struct device *dev); =20 extern void of_device_uevent(const struct device *dev, struct kobj_uevent_= env *env); -extern int of_device_uevent_modalias(struct device *dev, struct kobj_ueven= t_env *env); +extern int of_device_uevent_modalias(const struct device *dev, struct kobj= _uevent_env *env); =20 static inline struct device_node *of_cpu_device_node_get(int cpu) { @@ -83,7 +83,7 @@ static inline int of_device_request_module(struct device = *dev) return -ENODEV; } =20 -static inline int of_device_uevent_modalias(struct device *dev, +static inline int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env *env) { return -ENODEV; --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 326C0C67871 for ; Wed, 11 Jan 2023 11:32:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232759AbjAKLcB (ORCPT ); Wed, 11 Jan 2023 06:32:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232030AbjAKLbG (ORCPT ); Wed, 11 Jan 2023 06:31:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4952B3884 for ; Wed, 11 Jan 2023 03:31:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EE6F0B81B8D for ; Wed, 11 Jan 2023 11:31:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28793C433D2; Wed, 11 Jan 2023 11:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436660; bh=PUodvLzyboiiTwDvvOkvPeOcnFY8YPv39Q5FU+hy6Nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mvjux6f392wzL/QzluvGE3BmPKwvBLoh40iIF1KrSrua9J+CorAK3WySMiA3jMOMw DzrY7BigHuYZ7GH9GbGigGmJS4a6vGUWXyl0oV6jGsbVuZgUZUykYTwc83OIrhCrZT BIryhBwUAIo53/RsZeGrTKhCduZz4Qb1f2z0GZAw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Alexandre Belloni , linux-i3c@lists.infradead.org Subject: [PATCH v2 02/16] i3c: move dev_to_i3cdev() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:04 +0100 Message-Id: <20230111113018.459199-3-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1981; i=gregkh@linuxfoundation.org; h=from:subject; bh=PUodvLzyboiiTwDvvOkvPeOcnFY8YPv39Q5FU+hy6Nk=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75h5f+eHO+RleNy/2PJ7s5lasfKaFTdjwRe9WkQmsPzwe XYv51xHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQATeXecYUFT6oco2U8syyPndM7nWh fZkr5bUoFhfu1s3/pMQcPSCV9u6CZveu33ebX+SgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move dev_to_i3cdev() to use container_of_const() to handle this change. dev_to_i3cdev() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: Alexandre Belloni Cc: linux-i3c@lists.infradead.org Signed-off-by: Greg Kroah-Hartman Acked-by: Alexandre Belloni Acked-by: Hans de Goede --- drivers/i3c/device.c | 12 ------------ include/linux/i3c/device.h | 9 ++++++++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c index 9762630b917e..d111499061b2 100644 --- a/drivers/i3c/device.c +++ b/drivers/i3c/device.c @@ -208,18 +208,6 @@ struct device *i3cdev_to_dev(struct i3c_device *i3cdev) } EXPORT_SYMBOL_GPL(i3cdev_to_dev); =20 -/** - * dev_to_i3cdev() - Returns the I3C device containing @dev - * @dev: device object - * - * Return: a pointer to an I3C device object. - */ -struct i3c_device *dev_to_i3cdev(struct device *dev) -{ - return container_of(dev, struct i3c_device, dev); -} -EXPORT_SYMBOL_GPL(dev_to_i3cdev); - /** * i3c_device_match_id() - Returns the i3c_device_id entry matching @i3cdev * @i3cdev: I3C device diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h index 1c997abe868c..68b558929aec 100644 --- a/include/linux/i3c/device.h +++ b/include/linux/i3c/device.h @@ -186,7 +186,14 @@ static inline struct i3c_driver *drv_to_i3cdrv(struct = device_driver *drv) } =20 struct device *i3cdev_to_dev(struct i3c_device *i3cdev); -struct i3c_device *dev_to_i3cdev(struct device *dev); + +/** + * dev_to_i3cdev() - Returns the I3C device containing @dev + * @dev: device object + * + * Return: a pointer to an I3C device object. + */ +#define dev_to_i3cdev(__dev) container_of_const(__dev, struct i3c_device, = dev) =20 const struct i3c_device_id * i3c_device_match_id(struct i3c_device *i3cdev, --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2C09C46467 for ; Wed, 11 Jan 2023 11:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236917AbjAKLcE (ORCPT ); Wed, 11 Jan 2023 06:32:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232376AbjAKLbI (ORCPT ); Wed, 11 Jan 2023 06:31:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF879FC0; Wed, 11 Jan 2023 03:31:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5EBF9B81BAE; Wed, 11 Jan 2023 11:31:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F6F0C433F0; Wed, 11 Jan 2023 11:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436664; bh=AOHTskiEf/EAugFIosirnt3UqsWGT4GZR/BBhCBjd6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fNXb2t3AesSrXPfTX4HewBgBh8EPSOATBcb2MUmFQIbs8yr2M+Lodwmqhp0aCUE9M to9ZBuow1oYvIXdyBP89Tl8CqHOv1wJDSSsBEcSLSlaN0Oo5eY9jArYHEUT7w4g+Nn YiWabd8mE8Y6WOPQ6F86VAed1zHzcNfH4RbcEvNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Maximilian Luz , platform-driver-x86@vger.kernel.org Subject: [PATCH v2 03/16] platform/surface: aggregator: move to_ssam_device() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:05 +0100 Message-Id: <20230111113018.459199-4-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1235; i=gregkh@linuxfoundation.org; h=from:subject; bh=AOHTskiEf/EAugFIosirnt3UqsWGT4GZR/BBhCBjd6w=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75h6fqF/OaWkev969+0via23dxdl/Vl0+b+bYP4HPlVP5 pda9jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIewTDgi6X/YxP9ovXmdzTTg2/+s 2IJfhXN8OChfos7xNWBgpHVCbn+fq+kDVycpcGAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move to_ssam_device() to use container_of_const() to handle this change. to_ssam_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: Maximilian Luz Cc: platform-driver-x86@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede Reviewed-by: Maximilian Luz --- include/linux/surface_aggregator/device.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surf= ace_aggregator/device.h index 46c45d1b6368..24151a0e2c96 100644 --- a/include/linux/surface_aggregator/device.h +++ b/include/linux/surface_aggregator/device.h @@ -229,10 +229,7 @@ static inline bool is_ssam_device(struct device *d) * Return: Returns a pointer to the &struct ssam_device wrapping the given * device @d. */ -static inline struct ssam_device *to_ssam_device(struct device *d) -{ - return container_of(d, struct ssam_device, dev); -} +#define to_ssam_device(d) container_of_const(d, struct ssam_device, dev) =20 /** * to_ssam_device_driver() - Casts the given device driver to a SSAM client --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BAE1C46467 for ; Wed, 11 Jan 2023 11:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237591AbjAKLcJ (ORCPT ); Wed, 11 Jan 2023 06:32:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232716AbjAKLbN (ORCPT ); Wed, 11 Jan 2023 06:31:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F11BB4A6 for ; Wed, 11 Jan 2023 03:31:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CC2FEB819EF for ; Wed, 11 Jan 2023 11:31:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E7CFC433F1; Wed, 11 Jan 2023 11:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436668; bh=1vqW6DznMRgbPw/+04VEBpy62SL5hHVRbzL2+kYgjlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0bHQTNZWATOTIKhHpxas2zGuwKFhEEtdCziVt7Dha9I/cPf90pkHFa1KfaFUXQpIG p0WKno6PX/SjuLGYbtxZIfbdJofh0ffuoHNvcdP9VyNBji/Y7bLCBZXOB0zcwpBFse KAalUDkWGTr4hVEX3Zq4/7io5AODAYNnwDup5+fI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Stefan Richter , linux1394-devel@lists.sourceforge.net Subject: [PATCH v2 04/16] firewire: move fw_device() and fw_unit() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:06 +0100 Message-Id: <20230111113018.459199-5-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1932; i=gregkh@linuxfoundation.org; h=from:subject; bh=1vqW6DznMRgbPw/+04VEBpy62SL5hHVRbzL2+kYgjlg=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75h6/+DvosLuUcdHFB+uc9q9K+mzoksivbP/s24YNW3dF 71/U0xHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQATiVBlmGehUVxx6dnKjVutlk7Uvz Q9XrvP7yfDXKlIxQqlYB6ut5z9Z3dorK6ysC90BwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move fw_device() and fw_unit() functions to use container_of_const() to handle this change. fw_device() and fw_unit() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. This also required turning fw_parent_device() into a macro to preserve the const-ness of the pointer passed into it if necessary. Cc: Stefan Richter Cc: linux1394-devel@lists.sourceforge.net Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede --- include/linux/firewire.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 980019053e54..03ac31ada5e6 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -208,10 +208,7 @@ struct fw_device { struct fw_attribute_group attribute_group; }; =20 -static inline struct fw_device *fw_device(struct device *dev) -{ - return container_of(dev, struct fw_device, device); -} +#define fw_device(dev) container_of_const(dev, struct fw_device, device) =20 static inline int fw_device_is_shutdown(struct fw_device *device) { @@ -229,10 +226,7 @@ struct fw_unit { struct fw_attribute_group attribute_group; }; =20 -static inline struct fw_unit *fw_unit(struct device *dev) -{ - return container_of(dev, struct fw_unit, device); -} +#define fw_unit(dev) container_of_const(dev, struct fw_unit, device) =20 static inline struct fw_unit *fw_unit_get(struct fw_unit *unit) { @@ -246,10 +240,7 @@ static inline void fw_unit_put(struct fw_unit *unit) put_device(&unit->device); } =20 -static inline struct fw_device *fw_parent_device(struct fw_unit *unit) -{ - return fw_device(unit->device.parent); -} +#define fw_parent_device(unit) fw_device(unit->device.parent) =20 struct ieee1394_device_id; =20 --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0812C5479D for ; Wed, 11 Jan 2023 11:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237515AbjAKLcQ (ORCPT ); Wed, 11 Jan 2023 06:32:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233279AbjAKLb2 (ORCPT ); Wed, 11 Jan 2023 06:31:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D97D8FD8; Wed, 11 Jan 2023 03:31:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D3739B81BAC; Wed, 11 Jan 2023 11:31:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24DEFC433D2; Wed, 11 Jan 2023 11:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436672; bh=/xh1izJomABNl5qkjtygh0vb+C2Jzn7G+FTNpW6+bx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRQntNaLof/0T9sNSucrCAXxphTm/kOwXCb0QKkASaETEsDTr2nKg11Pgh1mdOhx+ 7FnW2WDLWGxa4vUFiXaL49P0KtcOY6mfDjmQR8FC5sDpVMDw09BwD+QRTwMqHWvUZo aAeJ2nerLBVvGcl1lrcGWCapQMVbDGzPGnXDG3Vg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jens Axboe , Len Brown , Stefan Richter , Wolfram Sang , Alexandre Belloni , Dmitry Torokhov , Sean Young , Rob Herring , Frank Rowand , Maximilian Luz , Hans de Goede , Mark Gross , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Andreas Noever , Michael Jamet , Yehezkel Bernat , Jiri Slaby , Heikki Krogerus , "Matthew Wilcox (Oracle)" , "Martin K. Petersen" , Chaitanya Kulkarni , Ming Lei , Jilin Yuan , Alan Stern , Andy Shevchenko , Sakari Ailus , Jason Gunthorpe , Thomas Gleixner , Ira Weiny , Dan Williams , Won Chung , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-block@vger.kernel.org, linux-i2c@vger.kernel.org, linux-i3c@lists.infradead.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org, linux-serial@vger.kernel.org, linux-usb@vger.kernel.org, linux1394-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, "Rafael J . Wysocki" , Mika Westerberg , Mauro Carvalho Chehab Subject: [PATCH v2 05/16] driver core: make struct device_type.uevent() take a const * Date: Wed, 11 Jan 2023 12:30:07 +0100 Message-Id: <20230111113018.459199-6-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=23701; i=gregkh@linuxfoundation.org; h=from:subject; bh=/xh1izJomABNl5qkjtygh0vb+C2Jzn7G+FTNpW6+bx8=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75h5/MV3eUeFL6OYjOm1rHiwsXHr6uVCZx3OFpOvdWtNf 6RrN7YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJvJVmmF9yylrk/oadayQfJ9pkNb beXrBO5wzD/HgB52+hWsLNz46bXu0/ZHVgdn/2YQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The uevent() callback in struct device_type should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into all relevant subsystems that use this callback. Cc: Jens Axboe Cc: Len Brown Cc: Stefan Richter Cc: Wolfram Sang Cc: Alexandre Belloni Cc: Dmitry Torokhov Cc: Sean Young Cc: Rob Herring Cc: Frank Rowand Cc: Maximilian Luz Cc: Hans de Goede Cc: Mark Gross Cc: Vinod Koul Cc: Bard Liao Cc: Pierre-Louis Bossart Cc: Sanyog Kale Cc: Andreas Noever Cc: Michael Jamet Cc: Yehezkel Bernat Cc: Jiri Slaby Cc: Heikki Krogerus Cc: "Matthew Wilcox (Oracle)" Cc: "Martin K. Petersen" Cc: Chaitanya Kulkarni Cc: Ming Lei Cc: Jilin Yuan Cc: Alan Stern Cc: Andy Shevchenko Cc: Sakari Ailus Cc: Jason Gunthorpe Cc: Thomas Gleixner Cc: Ira Weiny Cc: Dan Williams Cc: Won Chung Cc: alsa-devel@alsa-project.org Cc: devicetree@vger.kernel.org Cc: linux-acpi@vger.kernel.org Cc: linux-block@vger.kernel.org Cc: linux-i2c@vger.kernel.org Cc: linux-i3c@lists.infradead.org Cc: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-media@vger.kernel.org Cc: linux-serial@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: linux1394-devel@lists.sourceforge.net Cc: platform-driver-x86@vger.kernel.org Acked-by: Rafael J. Wysocki Acked-by: Mika Westerberg # for Thunderbo= lt Acked-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Acked-by: Alexandre Belloni Acked-by: Hans de Goede Acked-by: Heikki Krogerus Acked-by: Vinod Koul Acked-by: Wolfram Sang --- block/partitions/core.c | 4 ++-- drivers/acpi/device_sysfs.c | 8 ++++---- drivers/acpi/internal.h | 2 +- drivers/firewire/core-device.c | 8 ++++---- drivers/gpu/drm/display/drm_dp_aux_bus.c | 2 +- drivers/i2c/i2c-core-base.c | 4 ++-- drivers/i3c/device.c | 2 +- drivers/i3c/master.c | 4 ++-- drivers/input/input.c | 16 ++++++++-------- drivers/media/rc/rc-main.c | 2 +- drivers/platform/surface/aggregator/bus.c | 4 ++-- drivers/soundwire/bus_type.c | 4 ++-- drivers/thunderbolt/switch.c | 4 ++-- drivers/thunderbolt/tb.h | 2 +- drivers/thunderbolt/xdomain.c | 6 +++--- drivers/tty/serdev/core.c | 2 +- drivers/usb/core/message.c | 8 ++++---- drivers/usb/core/usb.c | 4 ++-- drivers/usb/phy/phy.c | 6 +++--- drivers/usb/roles/class.c | 3 +-- drivers/usb/typec/class.c | 2 +- include/linux/acpi.h | 4 ++-- include/linux/device.h | 2 +- include/linux/i3c/device.h | 2 +- include/linux/soundwire/sdw_type.h | 2 +- 25 files changed, 53 insertions(+), 54 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index b8112f52d388..7b8ef6296abd 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -254,9 +254,9 @@ static void part_release(struct device *dev) iput(dev_to_bdev(dev)->bd_inode); } =20 -static int part_uevent(struct device *dev, struct kobj_uevent_env *env) +static int part_uevent(const struct device *dev, struct kobj_uevent_env *e= nv) { - struct block_device *part =3D dev_to_bdev(dev); + const struct block_device *part =3D dev_to_bdev(dev); =20 add_uevent_var(env, "PARTN=3D%u", part->bd_partno); if (part->bd_meta_info && part->bd_meta_info->volname[0]) diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c index 120873dad2cc..daff2c0c5c52 100644 --- a/drivers/acpi/device_sysfs.c +++ b/drivers/acpi/device_sysfs.c @@ -133,7 +133,7 @@ static void acpi_hide_nondev_subnodes(struct acpi_devic= e_data *data) * -EINVAL: output error * -ENOMEM: output is truncated */ -static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalia= s, +static int create_pnp_modalias(const struct acpi_device *acpi_dev, char *m= odalias, int size) { int len; @@ -191,7 +191,7 @@ static int create_pnp_modalias(struct acpi_device *acpi= _dev, char *modalias, * only be called for devices having ACPI_DT_NAMESPACE_HID in their list of * ACPI/PNP IDs. */ -static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias, +static int create_of_modalias(const struct acpi_device *acpi_dev, char *mo= dalias, int size) { struct acpi_buffer buf =3D { ACPI_ALLOCATE_BUFFER }; @@ -239,7 +239,7 @@ static int create_of_modalias(struct acpi_device *acpi_= dev, char *modalias, return len; } =20 -int __acpi_device_uevent_modalias(struct acpi_device *adev, +int __acpi_device_uevent_modalias(const struct acpi_device *adev, struct kobj_uevent_env *env) { int len; @@ -277,7 +277,7 @@ int __acpi_device_uevent_modalias(struct acpi_device *a= dev, * Because other buses do not support ACPI HIDs & CIDs, e.g. for a device = with * hid:IBM0001 and cid:ACPI0001 you get: "acpi:IBM0001:ACPI0001". */ -int acpi_device_uevent_modalias(struct device *dev, struct kobj_uevent_env= *env) +int acpi_device_uevent_modalias(const struct device *dev, struct kobj_ueve= nt_env *env) { return __acpi_device_uevent_modalias(acpi_companion_match(dev), env); } diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index ec584442fb29..06ad497067ac 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -120,7 +120,7 @@ int acpi_bus_register_early_device(int type); Device Matching and Notification -----------------------------------------------------------------------= --- */ struct acpi_device *acpi_companion_match(const struct device *dev); -int __acpi_device_uevent_modalias(struct acpi_device *adev, +int __acpi_device_uevent_modalias(const struct acpi_device *adev, struct kobj_uevent_env *env); =20 /* -----------------------------------------------------------------------= --- diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index adddd8c45d0c..aa597cda0d88 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -133,7 +133,7 @@ static void get_ids(const u32 *directory, int *id) } } =20 -static void get_modalias_ids(struct fw_unit *unit, int *id) +static void get_modalias_ids(const struct fw_unit *unit, int *id) { get_ids(&fw_parent_device(unit)->config_rom[5], id); get_ids(unit->directory, id); @@ -195,7 +195,7 @@ static void fw_unit_remove(struct device *dev) driver->remove(fw_unit(dev)); } =20 -static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_= size) +static int get_modalias(const struct fw_unit *unit, char *buffer, size_t b= uffer_size) { int id[] =3D {0, 0, 0, 0}; =20 @@ -206,9 +206,9 @@ static int get_modalias(struct fw_unit *unit, char *buf= fer, size_t buffer_size) id[0], id[1], id[2], id[3]); } =20 -static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env) +static int fw_unit_uevent(const struct device *dev, struct kobj_uevent_env= *env) { - struct fw_unit *unit =3D fw_unit(dev); + const struct fw_unit *unit =3D fw_unit(dev); char modalias[64]; =20 get_modalias(unit, modalias, sizeof(modalias)); diff --git a/drivers/gpu/drm/display/drm_dp_aux_bus.c b/drivers/gpu/drm/dis= play/drm_dp_aux_bus.c index e31a0261c53e..8a165be1a821 100644 --- a/drivers/gpu/drm/display/drm_dp_aux_bus.c +++ b/drivers/gpu/drm/display/drm_dp_aux_bus.c @@ -161,7 +161,7 @@ static void dp_aux_ep_dev_release(struct device *dev) kfree(aux_ep_with_data); } =20 -static int dp_aux_ep_dev_modalias(struct device *dev, struct kobj_uevent_e= nv *env) +static int dp_aux_ep_dev_modalias(const struct device *dev, struct kobj_ue= vent_env *env) { return of_device_uevent_modalias(dev, env); } diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 087e480b624c..51b78a52ab7f 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -136,9 +136,9 @@ static int i2c_device_match(struct device *dev, struct = device_driver *drv) return 0; } =20 -static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int i2c_device_uevent(const struct device *dev, struct kobj_uevent_= env *env) { - struct i2c_client *client =3D to_i2c_client(dev); + const struct i2c_client *client =3D to_i2c_client(dev); int rc; =20 rc =3D of_device_uevent_modalias(dev, env); diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c index d111499061b2..1a6a8703dbc3 100644 --- a/drivers/i3c/device.c +++ b/drivers/i3c/device.c @@ -78,7 +78,7 @@ EXPORT_SYMBOL_GPL(i3c_device_do_setdasa); * * Retrieve I3C dev info. */ -void i3c_device_get_info(struct i3c_device *dev, +void i3c_device_get_info(const struct i3c_device *dev, struct i3c_device_info *info) { if (!info) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index d7e6f6c99aea..7a60e1c5e587 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -273,9 +273,9 @@ static struct attribute *i3c_device_attrs[] =3D { }; ATTRIBUTE_GROUPS(i3c_device); =20 -static int i3c_device_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int i3c_device_uevent(const struct device *dev, struct kobj_uevent_= env *env) { - struct i3c_device *i3cdev =3D dev_to_i3cdev(dev); + const struct i3c_device *i3cdev =3D dev_to_i3cdev(dev); struct i3c_device_info devinfo; u16 manuf, part, ext; =20 diff --git a/drivers/input/input.c b/drivers/input/input.c index ca2e3dd7188b..0336e799d713 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1372,7 +1372,7 @@ INPUT_DEV_STRING_ATTR_SHOW(phys); INPUT_DEV_STRING_ATTR_SHOW(uniq); =20 static int input_print_modalias_bits(char *buf, int size, - char name, unsigned long *bm, + char name, const unsigned long *bm, unsigned int min_bit, unsigned int max_bit) { int len =3D 0, i; @@ -1384,7 +1384,7 @@ static int input_print_modalias_bits(char *buf, int s= ize, return len; } =20 -static int input_print_modalias(char *buf, int size, struct input_dev *id, +static int input_print_modalias(char *buf, int size, const struct input_de= v *id, int add_cr) { int len; @@ -1432,7 +1432,7 @@ static ssize_t input_dev_show_modalias(struct device = *dev, } static DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); =20 -static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitm= ap, +static int input_print_bitmap(char *buf, int buf_size, const unsigned long= *bitmap, int max, int add_cr); =20 static ssize_t input_dev_show_properties(struct device *dev, @@ -1524,7 +1524,7 @@ static const struct attribute_group input_dev_id_attr= _group =3D { .attrs =3D input_dev_id_attrs, }; =20 -static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitm= ap, +static int input_print_bitmap(char *buf, int buf_size, const unsigned long= *bitmap, int max, int add_cr) { int i; @@ -1621,7 +1621,7 @@ static void input_dev_release(struct device *device) * device bitfields. */ static int input_add_uevent_bm_var(struct kobj_uevent_env *env, - const char *name, unsigned long *bitmap, int max) + const char *name, const unsigned long *bitmap, int max) { int len; =20 @@ -1639,7 +1639,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent= _env *env, } =20 static int input_add_uevent_modalias_var(struct kobj_uevent_env *env, - struct input_dev *dev) + const struct input_dev *dev) { int len; =20 @@ -1677,9 +1677,9 @@ static int input_add_uevent_modalias_var(struct kobj_= uevent_env *env, return err; \ } while (0) =20 -static int input_dev_uevent(struct device *device, struct kobj_uevent_env = *env) +static int input_dev_uevent(const struct device *device, struct kobj_ueven= t_env *env) { - struct input_dev *dev =3D to_input_dev(device); + const struct input_dev *dev =3D to_input_dev(device); =20 INPUT_ADD_HOTPLUG_VAR("PRODUCT=3D%x/%x/%x/%x", dev->id.bustype, dev->id.vendor, diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 527d9324742b..6bdad6341844 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1614,7 +1614,7 @@ static void rc_dev_release(struct device *device) kfree(dev); } =20 -static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *en= v) +static int rc_dev_uevent(const struct device *device, struct kobj_uevent_e= nv *env) { struct rc_dev *dev =3D to_rc_dev(device); int ret =3D 0; diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/s= urface/aggregator/bus.c index de539938896e..407eb55050a6 100644 --- a/drivers/platform/surface/aggregator/bus.c +++ b/drivers/platform/surface/aggregator/bus.c @@ -35,9 +35,9 @@ static struct attribute *ssam_device_attrs[] =3D { }; ATTRIBUTE_GROUPS(ssam_device); =20 -static int ssam_device_uevent(struct device *dev, struct kobj_uevent_env *= env) +static int ssam_device_uevent(const struct device *dev, struct kobj_uevent= _env *env) { - struct ssam_device *sdev =3D to_ssam_device(dev); + const struct ssam_device *sdev =3D to_ssam_device(dev); =20 return add_uevent_var(env, "MODALIAS=3Dssam:d%02Xc%02Xt%02Xi%02Xf%02X", sdev->uid.domain, sdev->uid.category, diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index 04b3529f8929..26c9a0a85d49 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -58,9 +58,9 @@ int sdw_slave_modalias(const struct sdw_slave *slave, cha= r *buf, size_t size) slave->id.sdw_version, slave->id.class_id); } =20 -int sdw_slave_uevent(struct device *dev, struct kobj_uevent_env *env) +int sdw_slave_uevent(const struct device *dev, struct kobj_uevent_env *env) { - struct sdw_slave *slave =3D dev_to_sdw_dev(dev); + const struct sdw_slave *slave =3D dev_to_sdw_dev(dev); char modalias[32]; =20 sdw_slave_modalias(slave, modalias, sizeof(modalias)); diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 363d712aa364..cb6c304c445e 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -2176,9 +2176,9 @@ static void tb_switch_release(struct device *dev) kfree(sw); } =20 -static int tb_switch_uevent(struct device *dev, struct kobj_uevent_env *en= v) +static int tb_switch_uevent(const struct device *dev, struct kobj_uevent_e= nv *env) { - struct tb_switch *sw =3D tb_to_switch(dev); + const struct tb_switch *sw =3D tb_to_switch(dev); const char *type; =20 if (sw->config.thunderbolt_version =3D=3D USB4_VERSION_1_0) { diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h index f9786976f5ec..909da0a98134 100644 --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -815,7 +815,7 @@ static inline bool tb_is_switch(const struct device *de= v) return dev->type =3D=3D &tb_switch_type; } =20 -static inline struct tb_switch *tb_to_switch(struct device *dev) +static inline struct tb_switch *tb_to_switch(const struct device *dev) { if (tb_is_switch(dev)) return container_of(dev, struct tb_switch, dev); diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c index cfa83486c9da..7bf1e360b04c 100644 --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c @@ -881,7 +881,7 @@ static ssize_t key_show(struct device *dev, struct devi= ce_attribute *attr, } static DEVICE_ATTR_RO(key); =20 -static int get_modalias(struct tb_service *svc, char *buf, size_t size) +static int get_modalias(const struct tb_service *svc, char *buf, size_t si= ze) { return snprintf(buf, size, "tbsvc:k%sp%08Xv%08Xr%08X", svc->key, svc->prtcid, svc->prtcvers, svc->prtcrevs); @@ -953,9 +953,9 @@ static const struct attribute_group *tb_service_attr_gr= oups[] =3D { NULL, }; =20 -static int tb_service_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int tb_service_uevent(const struct device *dev, struct kobj_uevent_= env *env) { - struct tb_service *svc =3D container_of(dev, struct tb_service, dev); + const struct tb_service *svc =3D container_of_const(dev, struct tb_servic= e, dev); char modalias[64]; =20 get_modalias(svc, modalias, sizeof(modalias)); diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 0180e1e4e75d..aa80de3a8194 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -42,7 +42,7 @@ static struct attribute *serdev_device_attrs[] =3D { }; ATTRIBUTE_GROUPS(serdev_device); =20 -static int serdev_device_uevent(struct device *dev, struct kobj_uevent_env= *env) +static int serdev_device_uevent(const struct device *dev, struct kobj_ueve= nt_env *env) { int rc; =20 diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 127fac1af676..cc404bb7e8f7 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1819,11 +1819,11 @@ void usb_authorize_interface(struct usb_interface *= intf) } } =20 -static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_if_uevent(const struct device *dev, struct kobj_uevent_env = *env) { - struct usb_device *usb_dev; - struct usb_interface *intf; - struct usb_host_interface *alt; + const struct usb_device *usb_dev; + const struct usb_interface *intf; + const struct usb_host_interface *alt; =20 intf =3D to_usb_interface(dev); usb_dev =3D interface_to_usbdev(intf); diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 11b15d7b357a..8527c06b65e6 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -423,9 +423,9 @@ static void usb_release_dev(struct device *dev) kfree(udev); } =20 -static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_dev_uevent(const struct device *dev, struct kobj_uevent_env= *env) { - struct usb_device *usb_dev; + const struct usb_device *usb_dev; =20 usb_dev =3D to_usb_device(dev); =20 diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index 1b24492bb4e5..4b468bde19cf 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c @@ -80,7 +80,7 @@ static struct usb_phy *__of_usb_find_phy(struct device_no= de *node) return ERR_PTR(-EPROBE_DEFER); } =20 -static struct usb_phy *__device_to_usb_phy(struct device *dev) +static struct usb_phy *__device_to_usb_phy(const struct device *dev) { struct usb_phy *usb_phy; =20 @@ -145,9 +145,9 @@ static void usb_phy_notify_charger_work(struct work_str= uct *work) kobject_uevent(&usb_phy->dev->kobj, KOBJ_CHANGE); } =20 -static int usb_phy_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_phy_uevent(const struct device *dev, struct kobj_uevent_env= *env) { - struct usb_phy *usb_phy; + const struct usb_phy *usb_phy; char uchger_state[50] =3D { 0 }; char uchger_type[50] =3D { 0 }; unsigned long flags; diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c index eacb46ec2ab3..56814ef80c24 100644 --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -274,8 +274,7 @@ static const struct attribute_group *usb_role_switch_gr= oups[] =3D { NULL, }; =20 -static int -usb_role_switch_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_role_switch_uevent(const struct device *dev, struct kobj_ue= vent_env *env) { int ret; =20 diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 5897905cb4f0..a89d8fd3f46c 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -1737,7 +1737,7 @@ static const struct attribute_group *typec_groups[] = =3D { NULL }; =20 -static int typec_uevent(struct device *dev, struct kobj_uevent_env *env) +static int typec_uevent(const struct device *dev, struct kobj_uevent_env *= env) { int ret; =20 diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 5e6a876e17ba..564b62f13bd0 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -723,7 +723,7 @@ const struct acpi_device_id *acpi_match_device(const st= ruct acpi_device_id *ids, const void *acpi_device_get_match_data(const struct device *dev); extern bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv); -int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); +int acpi_device_uevent_modalias(const struct device *, struct kobj_uevent_= env *); int acpi_device_modalias(struct device *, char *, int); =20 struct platform_device *acpi_create_platform_device(struct acpi_device *, @@ -958,7 +958,7 @@ static inline union acpi_object *acpi_evaluate_dsm(acpi= _handle handle, return NULL; } =20 -static inline int acpi_device_uevent_modalias(struct device *dev, +static inline int acpi_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env *env) { return -ENODEV; diff --git a/include/linux/device.h b/include/linux/device.h index 44e3acae7b36..dad0614aad96 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -88,7 +88,7 @@ int subsys_virtual_register(struct bus_type *subsys, struct device_type { const char *name; const struct attribute_group **groups; - int (*uevent)(struct device *dev, struct kobj_uevent_env *env); + int (*uevent)(const struct device *dev, struct kobj_uevent_env *env); char *(*devnode)(struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid); void (*release)(struct device *dev); diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h index 68b558929aec..ce115ef08fec 100644 --- a/include/linux/i3c/device.h +++ b/include/linux/i3c/device.h @@ -303,7 +303,7 @@ int i3c_device_do_priv_xfers(struct i3c_device *dev, =20 int i3c_device_do_setdasa(struct i3c_device *dev); =20 -void i3c_device_get_info(struct i3c_device *dev, struct i3c_device_info *i= nfo); +void i3c_device_get_info(const struct i3c_device *dev, struct i3c_device_i= nfo *info); =20 struct i3c_ibi_payload { unsigned int len; diff --git a/include/linux/soundwire/sdw_type.h b/include/linux/soundwire/s= dw_type.h index 52eb66cd11bc..d8c27f1e5559 100644 --- a/include/linux/soundwire/sdw_type.h +++ b/include/linux/soundwire/sdw_type.h @@ -21,7 +21,7 @@ static inline int is_sdw_slave(const struct device *dev) int __sdw_register_driver(struct sdw_driver *drv, struct module *owner); void sdw_unregister_driver(struct sdw_driver *drv); =20 -int sdw_slave_uevent(struct device *dev, struct kobj_uevent_env *env); +int sdw_slave_uevent(const struct device *dev, struct kobj_uevent_env *env= ); =20 /** * module_sdw_driver() - Helper macro for registering a Soundwire driver --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD963C54EBC for ; Wed, 11 Jan 2023 11:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238072AbjAKLc3 (ORCPT ); Wed, 11 Jan 2023 06:32:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233509AbjAKLb3 (ORCPT ); Wed, 11 Jan 2023 06:31:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BCF438A1; Wed, 11 Jan 2023 03:31:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D14C2B81B8D; Wed, 11 Jan 2023 11:31:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB9C5C433EF; Wed, 11 Jan 2023 11:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436675; bh=07TcxooMePyS4B9Y9vjTDSwlSURFf2vzK1ujAXwFgzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ez09IDD+1Xt+5uh7AY5fJ58sffaEvbwpNQbYqJbxhCpp82Hjqu11+yp4CpvrQxyua FpfhEa+sbAQPP6Z7sBs9pX+bryl/7TF2tdYfMzwd813vPhnx0iszeHh3CgiaXE65X8 j5R/YXlbrh3qavzmVuXhaqLLpraNcs5Q0IFE4SHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jens Axboe , Alison Schofield , Vishal Verma , Ira Weiny , Ben Widawsky , Jeremy Kerr , Joel Stanley , Alistar Popple , Eddie James , Alexander Shishkin , Jonathan Cameron , Jilin Yuan , Heikki Krogerus , Alan Stern , Andy Shevchenko , Thomas Gleixner , Jason Gunthorpe , "Rafael J. Wysocki" , Won Chung , linux-block@vger.kernel.org, linux-cxl@vger.kernel.org, linux-fsi@lists.ozlabs.org, linux-usb@vger.kernel.org, Dan Williams Subject: [PATCH v2 06/16] driver core: make struct device_type.devnode() take a const * Date: Wed, 11 Jan 2023 12:30:08 +0100 Message-Id: <20230111113018.459199-7-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6485; i=gregkh@linuxfoundation.org; h=from:subject; bh=07TcxooMePyS4B9Y9vjTDSwlSURFf2vzK1ujAXwFgzI=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p64nFHg2G95V6xMNikuX1rS8kDSZk4769kP2bdKerAt b2bviGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIm8nsUwm4X/Tkt1irLF+af9j0M102 rd4x2UGebKfjixlyef3+Jkvd93kYrmlbse6l4AAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The devnode() callback in struct device_type should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into all relevant subsystems that use this callback. Cc: Jens Axboe Cc: Alison Schofield Cc: Vishal Verma Cc: Ira Weiny Cc: Ben Widawsky Cc: Jeremy Kerr Cc: Joel Stanley Cc: Alistar Popple Cc: Eddie James Cc: Alexander Shishkin Cc: Jonathan Cameron Cc: Jilin Yuan Cc: Heikki Krogerus Cc: Alan Stern Cc: Andy Shevchenko Cc: Thomas Gleixner Cc: Jason Gunthorpe Cc: "Rafael J. Wysocki" Cc: Won Chung Cc: linux-block@vger.kernel.org Cc: linux-cxl@vger.kernel.org Cc: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org Acked-by: Dan Williams Signed-off-by: Greg Kroah-Hartman Acked-by: Alexander Shishkin Acked-by: Hans de Goede --- block/genhd.c | 2 +- drivers/cxl/core/memdev.c | 2 +- drivers/fsi/fsi-core.c | 6 +++--- drivers/hwtracing/intel_th/core.c | 6 +++--- drivers/hwtracing/intel_th/intel_th.h | 4 ++-- drivers/usb/core/usb.c | 4 ++-- include/linux/device.h | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 23cf83b3331c..09f2ac548832 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1201,7 +1201,7 @@ struct class block_class =3D { .dev_uevent =3D block_uevent, }; =20 -static char *block_devnode(struct device *dev, umode_t *mode, +static char *block_devnode(const struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid) { struct gendisk *disk =3D dev_to_disk(dev); diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c index a74a93310d26..a38a0cc20d47 100644 --- a/drivers/cxl/core/memdev.c +++ b/drivers/cxl/core/memdev.c @@ -27,7 +27,7 @@ static void cxl_memdev_release(struct device *dev) kfree(cxlmd); } =20 -static char *cxl_memdev_devnode(struct device *dev, umode_t *mode, kuid_t = *uid, +static char *cxl_memdev_devnode(const struct device *dev, umode_t *mode, k= uid_t *uid, kgid_t *gid) { return kasprintf(GFP_KERNEL, "cxl/%s", dev_name(dev)); diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 694e80c06665..0b927c9f4267 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -897,10 +897,10 @@ static const struct attribute_group *cfam_attr_groups= [] =3D { NULL, }; =20 -static char *cfam_devnode(struct device *dev, umode_t *mode, +static char *cfam_devnode(const struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid) { - struct fsi_slave *slave =3D to_fsi_slave(dev); + const struct fsi_slave *slave =3D to_fsi_slave(dev); =20 #ifdef CONFIG_FSI_NEW_DEV_NODE return kasprintf(GFP_KERNEL, "fsi/cfam%d", slave->cdev_idx); @@ -915,7 +915,7 @@ static const struct device_type cfam_type =3D { .groups =3D cfam_attr_groups }; =20 -static char *fsi_cdev_devnode(struct device *dev, umode_t *mode, +static char *fsi_cdev_devnode(const struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid) { #ifdef CONFIG_FSI_NEW_DEV_NODE diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th= /core.c index 7e753a75d23b..cc7f879bb175 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c @@ -185,11 +185,11 @@ static struct device_type intel_th_source_device_type= =3D { .release =3D intel_th_device_release, }; =20 -static char *intel_th_output_devnode(struct device *dev, umode_t *mode, +static char *intel_th_output_devnode(const struct device *dev, umode_t *mo= de, kuid_t *uid, kgid_t *gid) { - struct intel_th_device *thdev =3D to_intel_th_device(dev); - struct intel_th *th =3D to_intel_th(thdev); + const struct intel_th_device *thdev =3D to_intel_th_device(dev); + const struct intel_th *th =3D to_intel_th(thdev); char *node; =20 if (thdev->id >=3D 0) diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/inte= l_th/intel_th.h index 0ffb42990175..6cbba733f259 100644 --- a/drivers/hwtracing/intel_th/intel_th.h +++ b/drivers/hwtracing/intel_th/intel_th.h @@ -205,7 +205,7 @@ struct intel_th_driver { * INTEL_TH_SWITCH and INTEL_TH_SOURCE are children of the intel_th device. */ static inline struct intel_th_device * -to_intel_th_parent(struct intel_th_device *thdev) +to_intel_th_parent(const struct intel_th_device *thdev) { struct device *parent =3D thdev->dev.parent; =20 @@ -215,7 +215,7 @@ to_intel_th_parent(struct intel_th_device *thdev) return to_intel_th_device(parent); } =20 -static inline struct intel_th *to_intel_th(struct intel_th_device *thdev) +static inline struct intel_th *to_intel_th(const struct intel_th_device *t= hdev) { if (thdev->type =3D=3D INTEL_TH_OUTPUT) thdev =3D to_intel_th_parent(thdev); diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 8527c06b65e6..4df26f4f76e6 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -505,10 +505,10 @@ static const struct dev_pm_ops usb_device_pm_ops =3D { #endif /* CONFIG_PM */ =20 =20 -static char *usb_devnode(struct device *dev, +static char *usb_devnode(const struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid) { - struct usb_device *usb_dev; + const struct usb_device *usb_dev; =20 usb_dev =3D to_usb_device(dev); return kasprintf(GFP_KERNEL, "bus/usb/%03d/%03d", diff --git a/include/linux/device.h b/include/linux/device.h index dad0614aad96..318861000b83 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -89,7 +89,7 @@ struct device_type { const char *name; const struct attribute_group **groups; int (*uevent)(const struct device *dev, struct kobj_uevent_env *env); - char *(*devnode)(struct device *dev, umode_t *mode, + char *(*devnode)(const struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid); void (*release)(struct device *dev); =20 --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25AE7C5479D for ; Wed, 11 Jan 2023 11:32:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237709AbjAKLcX (ORCPT ); Wed, 11 Jan 2023 06:32:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233517AbjAKLb3 (ORCPT ); Wed, 11 Jan 2023 06:31:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D428795AA for ; Wed, 11 Jan 2023 03:31:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7050061C50 for ; Wed, 11 Jan 2023 11:31:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 614B9C433EF; Wed, 11 Jan 2023 11:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436678; bh=u0VY5UwoT2+QL9Z3Dz17VePvzzJgSFHl9JCzw67dyL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nz5K2gpAFAyrqyOSVSux5kKvWuiO9t6VXo21tG4KCohZVpkVPAQ3/UvfAnA62G36m sSj86HDetffFNjIp9ZNRFbafyHfq57OLK5airjkXW7PkPJ8wSs+YCxT4ZC8jr8XCNj OTUlCToAaIXetkyBFcOPz6eaknANgIBjAlojrRe4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Thomas Gleixner , Jason Gunthorpe , Ira Weiny , Dan Williams , Won Chung , "Rafael J . Wysocki" , Andy Shevchenko Subject: [PATCH v2 07/16] driver core: device_get_devnode() should take a const * Date: Wed, 11 Jan 2023 12:30:09 +0100 Message-Id: <20230111113018.459199-8-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2530; i=gregkh@linuxfoundation.org; h=from:subject; bh=u0VY5UwoT2+QL9Z3Dz17VePvzzJgSFHl9JCzw67dyL8=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p44vv235FOPa6d5plXpWzfci+p49WJGz/enaxZrmfbe 2/lApiOWhUGQiUFWTJHlyzaeo/srDil6GdqehpnDygQyhIGLUwAm0mfJMFdmTRNz4MmU+0fy731m/V r/nN2fOYhhfqiKw5tnfBXRf9V2rz+yKPr+9dPHDQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" device_get_devnode() should take a constant * to struct device as it does not modify it in any way, so modify the function definition to do this and move it out of device.h as it does not need to be exposed to the whole kernel tree. Cc: Thomas Gleixner Cc: Jason Gunthorpe Cc: Ira Weiny Cc: Dan Williams Cc: Won Chung Acked-by: Rafael J. Wysocki Reviewed-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede --- drivers/base/base.h | 2 ++ drivers/base/core.c | 2 +- include/linux/device.h | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/base/base.h b/drivers/base/base.h index 7d4803c03d3e..a8a119c36bdc 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -158,6 +158,8 @@ extern void device_block_probing(void); extern void device_unblock_probing(void); extern void deferred_probe_extend_timeout(void); extern void driver_deferred_probe_trigger(void); +const char *device_get_devnode(const struct device *dev, umode_t *mode, + kuid_t *uid, kgid_t *gid, const char **tmp); =20 /* /sys/devices directory */ extern struct kset *devices_kset; diff --git a/drivers/base/core.c b/drivers/base/core.c index a3e14143ec0c..72ec54a8a4e1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3739,7 +3739,7 @@ static struct device *next_device(struct klist_iter *= i) * a name. This memory is returned in tmp and needs to be * freed by the caller. */ -const char *device_get_devnode(struct device *dev, +const char *device_get_devnode(const struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid, const char **tmp) { diff --git a/include/linux/device.h b/include/linux/device.h index 318861000b83..90aaf308c259 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -907,8 +907,6 @@ int device_rename(struct device *dev, const char *new_n= ame); int device_move(struct device *dev, struct device *new_parent, enum dpm_order dpm_order); int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid); -const char *device_get_devnode(struct device *dev, umode_t *mode, kuid_t *= uid, - kgid_t *gid, const char **tmp); int device_is_dependent(struct device *dev, void *target); =20 static inline bool device_supports_offline(struct device *dev) --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D58CC5479D for ; Wed, 11 Jan 2023 11:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238120AbjAKLcf (ORCPT ); Wed, 11 Jan 2023 06:32:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234084AbjAKLb3 (ORCPT ); Wed, 11 Jan 2023 06:31:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26537959F; Wed, 11 Jan 2023 03:31:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7F8BB81B8D; Wed, 11 Jan 2023 11:31:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D567C433D2; Wed, 11 Jan 2023 11:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436681; bh=0Bpc3jZjc4ubxRXEsKaSqd4DQvO/82q+vPfR3P3xTaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r2G5tc8BY8ykHRTD/OsbadLcY1VbAKeAdi6TlC8+3y+LG0eFIpUqlRNPaXjhniqDL ofcdXdlfExzRc5T+fiT8Xz3RLG5A4DfqZyKr1Zs88N17J/jZVrA+gpAkuOLjqrU5tj MpXeAEjbSL302ItcLZrQgjNIM4x0MVe9LfV8AhMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "David S. Miller" , "Gustavo A. R. Silva" , Kees Cook , linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org Subject: [PATCH v2 08/16] vio: move to_vio_dev() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:10 +0100 Message-Id: <20230111113018.459199-9-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2143; i=gregkh@linuxfoundation.org; h=from:subject; bh=0Bpc3jZjc4ubxRXEsKaSqd4DQvO/82q+vPfR3P3xTaU=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p64zvshJ7oi+c3+BtE+i8Apuy+b/guyP3N4Tu78wtP/ ciJtO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAi1VsY5mfKqPws5+bR2mlWnO3iE2 ykzmb3jGGuqNfd0JrDl5b/V425UlEbUj9xSdYrAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move to_vio_dev() to use container_of_const() to handle this change. to_vio_dev() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: "David S. Miller" Cc: "Gustavo A. R. Silva" Cc: Kees Cook Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Cc: sparclinux@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede --- arch/powerpc/include/asm/vio.h | 5 +---- arch/sparc/include/asm/vio.h | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/include/asm/vio.h b/arch/powerpc/include/asm/vio.h index e7479a4abf96..cc9b787627ad 100644 --- a/arch/powerpc/include/asm/vio.h +++ b/arch/powerpc/include/asm/vio.h @@ -161,10 +161,7 @@ static inline struct vio_driver *to_vio_driver(struct = device_driver *drv) return container_of(drv, struct vio_driver, driver); } =20 -static inline struct vio_dev *to_vio_dev(struct device *dev) -{ - return container_of(dev, struct vio_dev, dev); -} +#define to_vio_dev(__dev) container_of_const(__dev, struct vio_dev, dev) =20 #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_VIO_H */ diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h index 2d7bdf665fd3..8a0c3c11c9ce 100644 --- a/arch/sparc/include/asm/vio.h +++ b/arch/sparc/include/asm/vio.h @@ -488,10 +488,7 @@ static inline struct vio_driver *to_vio_driver(struct = device_driver *drv) return container_of(drv, struct vio_driver, driver); } =20 -static inline struct vio_dev *to_vio_dev(struct device *dev) -{ - return container_of(dev, struct vio_dev, dev); -} +#define to_vio_dev(__dev) container_of_const(__dev, struct vio_dev, dev) =20 int vio_ldc_send(struct vio_driver_state *vio, void *data, int len); void vio_link_state_change(struct vio_driver_state *vio, int event); --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23A0CC46467 for ; Wed, 11 Jan 2023 11:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238184AbjAKLci (ORCPT ); Wed, 11 Jan 2023 06:32:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234100AbjAKLb3 (ORCPT ); Wed, 11 Jan 2023 06:31:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B466AE6B; Wed, 11 Jan 2023 03:31:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 647D561C52; Wed, 11 Jan 2023 11:31:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AB18C433EF; Wed, 11 Jan 2023 11:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436684; bh=pM+8n3r7RlbZn8/vOlXhyjyToBZb91WLLHBBqD470gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mfu+dPBTJLWWzZi1+oiqMyofu84JKE5/CwaXEV/175ufzEC0ZX0dke3j4Fg9JYu33 FyXY5k+WRRxfa8FmOYzfQA5sZAlH2YpU9HA6bVwryQ1TWufxu4ifJOtLXvcbZZxg9i ve+5pHGNuhDibmJTyqyI+tB0EXCQscc/iJafnBMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org Subject: [PATCH v2 09/16] platform/x86: wmi: move dev_to_wblock() and dev_to_wdev to use container_of_const() Date: Wed, 11 Jan 2023 12:30:11 +0100 Message-Id: <20230111113018.459199-10-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1435; i=gregkh@linuxfoundation.org; h=from:subject; bh=pM+8n3r7RlbZn8/vOlXhyjyToBZb91WLLHBBqD470gk=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p5o6T/EzfL4f/ZDcd78ffPFLFzmX7r0wmzz1P7wPT8X nlZf3RHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQATWePNMD/0iFnByeRPbjwlRUwnwr pO/mHYt59hnuWBB8387LNn8rLdut6+8uQBGTE+cwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move the dev_to_wdev() and dev_to_wblock() functions to use container_of_const() to handle this change. Both of these functions now properly keep the const-ness of the pointer passed into it, while as before it could be lost. Cc: Hans de Goede Cc: Mark Gross Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede --- drivers/platform/x86/wmi.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 5ffc00480aef..46d1edc08f20 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -693,15 +693,8 @@ char *wmi_get_acpi_device_uid(const char *guid_string) } EXPORT_SYMBOL_GPL(wmi_get_acpi_device_uid); =20 -static struct wmi_block *dev_to_wblock(struct device *dev) -{ - return container_of(dev, struct wmi_block, dev.dev); -} - -static struct wmi_device *dev_to_wdev(struct device *dev) -{ - return container_of(dev, struct wmi_device, dev); -} +#define dev_to_wblock(__dev) container_of_const(__dev, struct wmi_block, d= ev.dev) +#define dev_to_wdev(__dev) container_of_const(__dev, struct wmi_device, de= v) =20 static inline struct wmi_driver *drv_to_wdrv(struct device_driver *drv) { --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EB1CC5479D for ; Wed, 11 Jan 2023 11:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233219AbjAKLbi (ORCPT ); Wed, 11 Jan 2023 06:31:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbjAKLaj (ORCPT ); Wed, 11 Jan 2023 06:30:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4D5B95B3; Wed, 11 Jan 2023 03:30:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8E7E9B81B8D; Wed, 11 Jan 2023 11:30:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D55ADC433EF; Wed, 11 Jan 2023 11:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436635; bh=n8OnoHXUKt8/vexOA9DOw2P/znFEmBc1dMUhPM/P1nE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2sy49pouXHeFMASqr063ewfQj/lTX3SXAOjasByVHYZhWJtGQf+RQpeHziZY54PeY JXq+p19tkWKhMMWJx/E/kp6W25ZORCcL6ZjLRYaGln7pPm8n61zZDJYS4UjHnpI6PH Zz4N6jXJRlr1PtNp9rX+/FZOhZkDRoyUJupRvbEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , linux-hyperv@vger.kernel.org Subject: [PATCH v2 10/16] drivers: hv: move device_to_hv_device to use container_of_const() Date: Wed, 11 Jan 2023 12:30:12 +0100 Message-Id: <20230111113018.459199-11-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1177; i=gregkh@linuxfoundation.org; h=from:subject; bh=n8OnoHXUKt8/vexOA9DOw2P/znFEmBc1dMUhPM/P1nE=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p68dtJ97m/PZ6YrTvN9j4tZYrzO51pEfViqqM8V7m6l c1nnO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiN+4zzHd07zprkHDlNOMpv//hrd tW83MGBTEs2BxmsuBRzpwd6/jnMYrpL0sXlnjlCAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move device_to_hv_device() to use container_of_const() to handle this change. device_to_hv_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Wei Liu Cc: Dexuan Cui Cc: linux-hyperv@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede Acked-by: Wei Liu --- include/linux/hyperv.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 85f7c5a63aa6..8430e27f3c3f 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1309,10 +1309,7 @@ struct hv_device { }; =20 =20 -static inline struct hv_device *device_to_hv_device(struct device *d) -{ - return container_of(d, struct hv_device, device); -} +#define device_to_hv_device(d) container_of_const(d, struct hv_device, dev= ice) =20 static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d) { --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEC0FC46467 for ; Wed, 11 Jan 2023 11:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233204AbjAKLbX (ORCPT ); Wed, 11 Jan 2023 06:31:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232824AbjAKLas (ORCPT ); Wed, 11 Jan 2023 06:30:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 243D0B1ED for ; Wed, 11 Jan 2023 03:30:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B238661C44 for ; Wed, 11 Jan 2023 11:30:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C48ECC433EF; Wed, 11 Jan 2023 11:30:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436642; bh=V+8wEdwTeBfWKOuKLnNsrHjcNV02ld2/uoosp2OJQrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HKFWNtzfVuJdXWx1cZMVTAR+crfJ5Iyil/cRG4A5VSH8HeWe7VWFKbpFF7K+F6Dxp htolbomAiq5o5/KuTntFmmXFTYPB6W5QHFWR4dWxuBcnqVTo/rlSg0jdc6Co6CvrSy K6TS25j4tkxDvqROXKHhjovV2A7CfVhE90m+umTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "Michael S. Tsirkin" , Jason Wang , virtualization@lists.linux-foundation.org Subject: [PATCH v2 11/16] virtio: move dev_to_virtio() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:13 +0100 Message-Id: <20230111113018.459199-12-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1173; i=gregkh@linuxfoundation.org; h=from:subject; bh=V+8wEdwTeBfWKOuKLnNsrHjcNV02ld2/uoosp2OJQrw=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p5cYS1/cl7W7Ky0jzmHgkJS152c8fVvqMYRA1NBqUfB nY93dcSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEjKMZFly4OzXlpOC1ux/2yC74On 11jpuF9lOG+TF7Fd516j3oK7gR3jPnUXVerZHbXQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move dev_to_virtio() to use container_of_const() to handle this change. dev_to_virtio() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: virtualization@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede --- include/linux/virtio.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/virtio.h b/include/linux/virtio.h index dcab9c7e8784..2b472514c49b 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h @@ -127,10 +127,7 @@ struct virtio_device { void *priv; }; =20 -static inline struct virtio_device *dev_to_virtio(struct device *_dev) -{ - return container_of(_dev, struct virtio_device, dev); -} +#define dev_to_virtio(_dev) container_of_const(_dev, struct virtio_device,= dev) =20 void virtio_add_status(struct virtio_device *dev, unsigned int status); int register_virtio_device(struct virtio_device *dev); --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BCBDC54EBC for ; Wed, 11 Jan 2023 11:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232590AbjAKLba (ORCPT ); Wed, 11 Jan 2023 06:31:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232958AbjAKLas (ORCPT ); Wed, 11 Jan 2023 06:30:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4E4ED2FA for ; Wed, 11 Jan 2023 03:30:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7FB9661C44 for ; Wed, 11 Jan 2023 11:30:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E858C433EF; Wed, 11 Jan 2023 11:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436644; bh=PbvUrZFDDqA/zKZJizBhQHcpk8Qr9JjCk+UTHtD7YcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ewFGxEZrPXSDdTzsC5QBHU8HraX6MjPyINJ9nAyCGq07kCKSZDR4oDlB60E/anZW+ EtvVN5R1EYDR6J1RW17ibZspQ37lj+BKZW1maB3ZRKq5DYu5pllTiPiSGNydbC17nl tGGHay/GZ8qsK7cVUkI7wRAfHGDxUJklyN2l7bfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v2 12/16] drm/mipi-dsi: move to_mipi_dsi_device() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:14 +0100 Message-Id: <20230111113018.459199-13-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1332; i=gregkh@linuxfoundation.org; h=from:subject; bh=PbvUrZFDDqA/zKZJizBhQHcpk8Qr9JjCk+UTHtD7YcU=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p60iLoutu7+VnGDkPXPlaIP+P5NOnohIMfi3atDNTop 1bNyOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiLfsZFux54/mgYbZmq1N1yp2Sgz ySv+Y2T2SYZ33tTenjYpd/z//sd7QTbj8kFDY/CgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move to_mipi_dsi_device() to use container_of_const() to handle this change. to_mipi_dsi_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede --- include/drm/drm_mipi_dsi.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 20b21b577dea..56a6557b2f4c 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -197,10 +197,7 @@ struct mipi_dsi_device { =20 #define MIPI_DSI_MODULE_PREFIX "mipi-dsi:" =20 -static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *de= v) -{ - return container_of(dev, struct mipi_dsi_device, dev); -} +#define to_mipi_dsi_device(__dev) container_of_const(__dev, struct mipi_ds= i_device, dev) =20 /** * mipi_dsi_pixel_format_to_bpp - obtain the number of bits per pixel for = any --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3504C54EBC for ; Wed, 11 Jan 2023 11:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234190AbjAKLbn (ORCPT ); Wed, 11 Jan 2023 06:31:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233027AbjAKLat (ORCPT ); Wed, 11 Jan 2023 06:30:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2855642B for ; Wed, 11 Jan 2023 03:30:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A15061C04 for ; Wed, 11 Jan 2023 11:30:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67CCCC433D2; Wed, 11 Jan 2023 11:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436647; bh=ZnUP4QqsUatI7olQqiZo7hbNKpfZIuTcCuvWGE33rjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TO0yaEmzH4zeTp1YVDBAZyhxfsCcf2e2bTgnQ2QV+u/2xqz7G2GsiLC0zvxTMgCnj IItOnihIk3K2u0+zhfapYRZ192mVzi1p3jgzOx3bKIcHQKUfH5FV/hN8Z2FwnPP5dD QEZCSMjx6w1shRPJAJ00pFAlg3hA00k/n1/O34z4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Johannes Thumshirn Subject: [PATCH v2 13/16] mcb: move to_mcb_device() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:15 +0100 Message-Id: <20230111113018.459199-14-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1006; i=gregkh@linuxfoundation.org; h=from:subject; bh=ZnUP4QqsUatI7olQqiZo7hbNKpfZIuTcCuvWGE33rjk=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p4sm7DWzLCxvybA7MaZl/+0eOY4N9upnFp0Y9X/ClUG zZ6dHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRH3EMC852v7mysyylnIf928IGpV sSEes3tTAs2Knc+9R/0xXJiMRH4XeZTNXvSupuAAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move to_mcb_device() to use container_of_const() to handle this change. to_mcb_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: Johannes Thumshirn Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede --- include/linux/mcb.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/mcb.h b/include/linux/mcb.h index f6efb16f9d1b..1e5893138afe 100644 --- a/include/linux/mcb.h +++ b/include/linux/mcb.h @@ -76,10 +76,7 @@ struct mcb_device { struct device *dma_dev; }; =20 -static inline struct mcb_device *to_mcb_device(struct device *dev) -{ - return container_of(dev, struct mcb_device, dev); -} +#define to_mcb_device(__dev) container_of_const(__dev, struct mcb_device, = dev) =20 /** * struct mcb_driver - MEN Chameleon Bus device driver --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 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=pass(p=none dis=none) header.from=linuxfoundation.org ARC-Seal: i=1; a=rsa-sha256; t=1673436685; cv=none; d=zohomail.com; s=zohoarc; b=MZhS3ktJHxOvBioprOM9LmURKQZDF7UgyF1YOpknjufG2xxT+pAwRG7a+Bjx6wNP0/BYQMd+efwqyPwbn87RFGf5iWsh/Sb4yO2onRKvC2m4GU390iP6K67lo1sGkMtwUomPeVwI4oobWFQfOulG1e5BEsSUtBYTfn24mQ53ZaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673436685; 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=U4D9vKB40fpi84ZzrfHn2IUFF8EycxHQMmEywUdPKyc=; b=F1qGnhBAYBnYkY6xOpvtNkU1sUV4HVpcrOTGWWUT5s3ciVaX9Ujucx/PtLxfsw0wbpDnKGXQAPMI9P9Jq3C6iVkBavMjei8qtKIUfSdRTZkDQZ3WgGa3kHNkd60SC5nE6j0zxAZroU7hiw8new3Qvim5AkGBvZaP9Z47GNDGq0Q= 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=pass 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 1673436685210742.0565838989377; Wed, 11 Jan 2023 03:31:25 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.475211.736799 (Exim 4.92) (envelope-from ) id 1pFZJo-0006Vr-D9; Wed, 11 Jan 2023 11:30:56 +0000 Received: by outflank-mailman (output) from mailman id 475211.736799; Wed, 11 Jan 2023 11:30:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFZJo-0006Vk-AU; Wed, 11 Jan 2023 11:30:56 +0000 Received: by outflank-mailman (input) for mailman id 475211; Wed, 11 Jan 2023 11:30:54 +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 1pFZJm-0006Ve-JF for xen-devel@lists.xenproject.org; Wed, 11 Jan 2023 11:30:54 +0000 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 680acd88-91a3-11ed-91b6-6bf2151ebd3b; Wed, 11 Jan 2023 12:30:53 +0100 (CET) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81C1EB81B8D; Wed, 11 Jan 2023 11:30:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D688C433EF; Wed, 11 Jan 2023 11:30:50 +0000 (UTC) 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 Sender: "Xen-devel" X-Inumbo-ID: 680acd88-91a3-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436651; bh=WJ96hH6M2QWhqMqos8NlJvpLqVVBxtYsuEjUoVykxZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X7a5KWZHBLMUkKm8d7N1mA+UILCUqbJnKRAWqBLYnqLFbEiClsPP+hZZV1xghrAa6 /mZHoqJZQ3wMqDA66QoIsvm5lc2i9xyw4j4Qa9qsBNa5/OJ4Pcg7bemhED9vtRGmtJ c/TGi6+t/6rL26PggxIY0N2xBa4fplpGKMUGxUKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , xen-devel@lists.xenproject.org Subject: [PATCH v2 14/16] xen/xenbus: move to_xenbus_device() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:16 +0100 Message-Id: <20230111113018.459199-15-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1111; i=gregkh@linuxfoundation.org; h=from:subject; bh=WJ96hH6M2QWhqMqos8NlJvpLqVVBxtYsuEjUoVykxZs=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p5iDqjYGXvtfmJbfiGLYEh0rmbzkQfMxlmZT6a8f3xz mmVIRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAExEzINhnumZBRPTnvPn53v37j2tLX W4Ri/vPsM8/VuB8089evrezHar0ST1/HL+f+5XAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linuxfoundation.org) X-ZM-MESSAGEID: 1673436686398100001 Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move to_xenbus_device() to use container_of_const() to handle this change. to_xenbus_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: Juergen Gross Cc: Stefano Stabellini Cc: Oleksandr Tyshchenko Cc: xen-devel@lists.xenproject.org Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede Acked-by: Juergen Gross --- include/xen/xenbus.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index eaa932b99d8a..b31f77f9c50c 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -96,10 +96,7 @@ struct xenbus_device { unsigned int spurious_threshold; }; =20 -static inline struct xenbus_device *to_xenbus_device(struct device *dev) -{ - return container_of(dev, struct xenbus_device, dev); -} +#define to_xenbus_device(__dev) container_of_const(__dev, struct xenbus_de= vice, dev) =20 struct xenbus_device_id { --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65337C54EBC for ; Wed, 11 Jan 2023 11:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236100AbjAKLby (ORCPT ); Wed, 11 Jan 2023 06:31:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233150AbjAKLbC (ORCPT ); Wed, 11 Jan 2023 06:31:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 560E02DD6 for ; Wed, 11 Jan 2023 03:30:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A883BB81BAC for ; Wed, 11 Jan 2023 11:30:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C1B2C433F2; Wed, 11 Jan 2023 11:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436654; bh=mu40IxMVys50I0/6KPva+nmYVDWIWyHFe3QS+j23eUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/atS/QMoFwWv/9OvcPxYo4p0MLKktpz2E7P7qvNIGc3OjVfqfx6f0zQVj2NFCydH dX+CfOS9bB8f8xbgwx9DNRYj5IcO3+526BO8LjY4r5BD7s9vUhCOx8h+egvizHUNAy t/pW52gTNrlbE4S535EyEKhSbTdhzs20fReB+ALU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: [PATCH v2 15/16] driver core: make struct bus_type.uevent() take a const * Date: Wed, 11 Jan 2023 12:30:17 +0100 Message-Id: <20230111113018.459199-16-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=57412; i=gregkh@linuxfoundation.org; h=from:subject; bh=mu40IxMVys50I0/6KPva+nmYVDWIWyHFe3QS+j23eUg=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p7qcC+SbtJ/ceeEac8zH/MTu1UjOzm5Zk7L/aRqUqB0 ZUZERywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEykXZdhQZO51cyIaPZvjy+eMjPyje 2+ljtBjmFBW9rqp/bX+T7LnCi96NB4+A7L9ohLAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The uevent() callback in struct bus_type should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into all relevant subsystems that use this callback. Cc: "Rafael J. Wysocki" Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede Acked-by: Rafael J. Wysocki Reported-by: Linux Kernel Functional Testing --- arch/mips/sgi-ip22/ip22-gio.c | 4 ++-- arch/parisc/kernel/drivers.c | 4 ++-- arch/powerpc/platforms/pseries/vio.c | 4 ++-- arch/sparc/kernel/vio.c | 2 +- drivers/acpi/bus.c | 2 +- drivers/amba/bus.c | 4 ++-- drivers/base/auxiliary.c | 2 +- drivers/base/cpu.c | 2 +- drivers/base/platform.c | 4 ++-- drivers/bcma/main.c | 6 +++--- drivers/bus/fsl-mc/fsl-mc-bus.c | 4 ++-- drivers/bus/mhi/ep/main.c | 4 ++-- drivers/bus/mhi/host/init.c | 4 ++-- drivers/bus/mips_cdmm.c | 4 ++-- drivers/bus/sunxi-rsb.c | 2 +- drivers/cxl/core/memdev.c | 2 +- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 4 ++-- drivers/cxl/cxlmem.h | 2 +- drivers/dax/bus.c | 2 +- drivers/eisa/eisa-bus.c | 4 ++-- drivers/firmware/arm_ffa/bus.c | 4 ++-- drivers/fpga/dfl.c | 4 ++-- drivers/gpu/drm/drm_mipi_dsi.c | 4 ++-- drivers/gpu/host1x/bus.c | 2 +- drivers/greybus/core.c | 14 +++++++------- drivers/hid/hid-core.c | 4 ++-- drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +- drivers/hsi/hsi_core.c | 2 +- drivers/hv/vmbus_drv.c | 4 ++-- drivers/input/serio/serio.c | 4 ++-- drivers/ipack/ipack.c | 4 ++-- drivers/macintosh/macio_asic.c | 2 +- drivers/mcb/mcb-core.c | 4 ++-- drivers/memstick/core/memstick.c | 6 +++--- drivers/misc/mei/bus.c | 4 ++-- drivers/misc/tifm_core.c | 4 ++-- drivers/mmc/core/bus.c | 4 ++-- drivers/mmc/core/sdio_bus.c | 4 ++-- drivers/net/phy/mdio_bus.c | 2 +- drivers/net/xen-netback/xenbus.c | 2 +- drivers/nvdimm/bus.c | 4 ++-- drivers/nvdimm/dax_devs.c | 2 +- drivers/nvdimm/dimm_devs.c | 2 +- drivers/nvdimm/nd-core.h | 10 +++++----- drivers/nvdimm/nd.h | 4 ++-- drivers/nvdimm/region_devs.c | 4 ++-- drivers/pci/pci-driver.c | 4 ++-- drivers/pcmcia/ds.c | 4 ++-- drivers/platform/x86/wmi.c | 4 ++-- drivers/rapidio/rio-driver.c | 4 ++-- drivers/rpmsg/rpmsg_core.c | 4 ++-- drivers/s390/cio/css.c | 4 ++-- drivers/s390/cio/device.c | 8 ++++---- drivers/s390/cio/scm.c | 2 +- drivers/s390/crypto/ap_bus.c | 4 ++-- drivers/scsi/scsi_sysfs.c | 4 ++-- drivers/slimbus/core.c | 4 ++-- drivers/soc/qcom/apr.c | 4 ++-- drivers/spi/spi.c | 2 +- drivers/spmi/spmi.c | 2 +- drivers/ssb/main.c | 4 ++-- drivers/staging/greybus/gbphy.c | 14 +++++++------- drivers/tee/tee_core.c | 2 +- drivers/usb/common/ulpi.c | 4 ++-- drivers/usb/core/driver.c | 6 +++--- drivers/usb/typec/bus.c | 4 ++-- drivers/virtio/virtio.c | 4 ++-- drivers/w1/w1.c | 10 +++++----- drivers/xen/pvcalls-back.c | 2 +- drivers/xen/xenbus/xenbus_probe_backend.c | 8 ++++---- drivers/xen/xenbus/xenbus_probe_frontend.c | 4 ++-- drivers/zorro/zorro-driver.c | 4 ++-- include/linux/device/bus.h | 2 +- include/linux/spi/spi.h | 2 +- include/linux/ssb/ssb.h | 2 +- include/sound/hdaudio.h | 2 +- include/xen/xenbus.h | 2 +- sound/aoa/soundbus/core.c | 6 +++--- sound/hda/hda_bus_type.c | 2 +- sound/hda/hdac_device.c | 2 +- 81 files changed, 160 insertions(+), 160 deletions(-) diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c index 8686e8c1c4e5..81c9f0a8880b 100644 --- a/arch/mips/sgi-ip22/ip22-gio.c +++ b/arch/mips/sgi-ip22/ip22-gio.c @@ -199,9 +199,9 @@ static struct attribute *gio_dev_attrs[] =3D { }; ATTRIBUTE_GROUPS(gio_dev); =20 -static int gio_device_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int gio_device_uevent(const struct device *dev, struct kobj_uevent_= env *env) { - struct gio_device *gio_dev =3D to_gio_device(dev); + const struct gio_device *gio_dev =3D to_gio_device(dev); =20 add_uevent_var(env, "MODALIAS=3Dgio:%x", gio_dev->id.id); return 0; diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index e7ee0c0c91d3..28f47285d448 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c @@ -552,7 +552,7 @@ static int parisc_generic_match(struct device *dev, str= uct device_driver *drv) return match_device(to_parisc_driver(drv), to_parisc_device(dev)); } =20 -static ssize_t make_modalias(struct device *dev, char *buf) +static ssize_t make_modalias(const struct device *dev, char *buf) { const struct parisc_device *padev =3D to_parisc_device(dev); const struct parisc_device_id *id =3D &padev->id; @@ -562,7 +562,7 @@ static ssize_t make_modalias(struct device *dev, char *= buf) (u32)id->sversion); } =20 -static int parisc_uevent(struct device *dev, struct kobj_uevent_env *env) +static int parisc_uevent(const struct device *dev, struct kobj_uevent_env = *env) { const struct parisc_device *padev; char modalias[40]; diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/= pseries/vio.c index 00ecac2c205b..770df9351aaa 100644 --- a/arch/powerpc/platforms/pseries/vio.c +++ b/arch/powerpc/platforms/pseries/vio.c @@ -1609,10 +1609,10 @@ static int vio_bus_match(struct device *dev, struct= device_driver *drv) return (ids !=3D NULL) && (vio_match_device(ids, vio_dev) !=3D NULL); } =20 -static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env) +static int vio_hotplug(const struct device *dev, struct kobj_uevent_env *e= nv) { const struct vio_dev *vio_dev =3D to_vio_dev(dev); - struct device_node *dn; + const struct device_node *dn; const char *cp; =20 dn =3D dev->of_node; diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c index 01122a208f94..b78df3a15a72 100644 --- a/arch/sparc/kernel/vio.c +++ b/arch/sparc/kernel/vio.c @@ -46,7 +46,7 @@ static const struct vio_device_id *vio_match_device( return NULL; } =20 -static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env) +static int vio_hotplug(const struct device *dev, struct kobj_uevent_env *e= nv) { const struct vio_dev *vio_dev =3D to_vio_dev(dev); =20 diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 0c05ccde1f7a..9531dd0fef50 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1014,7 +1014,7 @@ static int acpi_bus_match(struct device *dev, struct = device_driver *drv) && !acpi_match_device_ids(acpi_dev, acpi_drv->ids); } =20 -static int acpi_device_uevent(struct device *dev, struct kobj_uevent_env *= env) +static int acpi_device_uevent(const struct device *dev, struct kobj_uevent= _env *env) { return __acpi_device_uevent_modalias(to_acpi_device(dev), env); } diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index ff7454a38058..ce88af9eb562 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -235,9 +235,9 @@ static int amba_match(struct device *dev, struct device= _driver *drv) return amba_lookup(pcdrv->id_table, pcdev) !=3D NULL; } =20 -static int amba_uevent(struct device *dev, struct kobj_uevent_env *env) +static int amba_uevent(const struct device *dev, struct kobj_uevent_env *e= nv) { - struct amba_device *pcdev =3D to_amba_device(dev); + const struct amba_device *pcdev =3D to_amba_device(dev); int retval =3D 0; =20 retval =3D add_uevent_var(env, "AMBA_ID=3D%08x", pcdev->periphid); diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c index 8c5e65930617..4d4c2c8d26c4 100644 --- a/drivers/base/auxiliary.c +++ b/drivers/base/auxiliary.c @@ -185,7 +185,7 @@ static int auxiliary_match(struct device *dev, struct d= evice_driver *drv) return !!auxiliary_match_id(auxdrv->id_table, auxdev); } =20 -static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *en= v) +static int auxiliary_uevent(const struct device *dev, struct kobj_uevent_e= nv *env) { const char *name, *p; =20 diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 4c98849577d4..441eb5bdec7d 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -336,7 +336,7 @@ static ssize_t print_cpu_modalias(struct device *dev, return len; } =20 -static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) +static int cpu_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { char *buf =3D kzalloc(PAGE_SIZE, GFP_KERNEL); if (buf) { diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 968f3d71eeab..d7605e048bd2 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1353,9 +1353,9 @@ static int platform_match(struct device *dev, struct = device_driver *drv) return (strcmp(pdev->name, drv->name) =3D=3D 0); } =20 -static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) +static int platform_uevent(const struct device *dev, struct kobj_uevent_en= v *env) { - struct platform_device *pdev =3D to_platform_device(dev); + const struct platform_device *pdev =3D to_platform_device(dev); int rc; =20 /* Some devices have extra OF data and an OF-style MODALIAS */ diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 0a8469e0b13a..7b39f010bbb3 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -28,7 +28,7 @@ static DEFINE_MUTEX(bcma_buses_mutex); static int bcma_bus_match(struct device *dev, struct device_driver *drv); static int bcma_device_probe(struct device *dev); static void bcma_device_remove(struct device *dev); -static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *= env); +static int bcma_device_uevent(const struct device *dev, struct kobj_uevent= _env *env); =20 static ssize_t manuf_show(struct device *dev, struct device_attribute *att= r, char *buf) { @@ -627,9 +627,9 @@ static void bcma_device_remove(struct device *dev) put_device(dev); } =20 -static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *= env) +static int bcma_device_uevent(const struct device *dev, struct kobj_uevent= _env *env) { - struct bcma_device *core =3D container_of(dev, struct bcma_device, dev); + const struct bcma_device *core =3D container_of_const(dev, struct bcma_de= vice, dev); =20 return add_uevent_var(env, "MODALIAS=3Dbcma:m%04Xid%04Xrev%02Xcl%02X", diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bu= s.c index 774f307844b4..36cb091a33b4 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -124,9 +124,9 @@ static int fsl_mc_bus_match(struct device *dev, struct = device_driver *drv) /* * fsl_mc_bus_uevent - callback invoked when a device is added */ -static int fsl_mc_bus_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int fsl_mc_bus_uevent(const struct device *dev, struct kobj_uevent_= env *env) { - struct fsl_mc_device *mc_dev =3D to_fsl_mc_device(dev); + const struct fsl_mc_device *mc_dev =3D to_fsl_mc_device(dev); =20 if (add_uevent_var(env, "MODALIAS=3Dfsl-mc:v%08Xd%s", mc_dev->obj_desc.vendor, diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c index 1dc8a3557a46..4819369faa8b 100644 --- a/drivers/bus/mhi/ep/main.c +++ b/drivers/bus/mhi/ep/main.c @@ -1543,9 +1543,9 @@ void mhi_ep_driver_unregister(struct mhi_ep_driver *m= hi_drv) } EXPORT_SYMBOL_GPL(mhi_ep_driver_unregister); =20 -static int mhi_ep_uevent(struct device *dev, struct kobj_uevent_env *env) +static int mhi_ep_uevent(const struct device *dev, struct kobj_uevent_env = *env) { - struct mhi_ep_device *mhi_dev =3D to_mhi_ep_device(dev); + const struct mhi_ep_device *mhi_dev =3D to_mhi_ep_device(dev); =20 return add_uevent_var(env, "MODALIAS=3D" MHI_EP_DEVICE_MODALIAS_FMT, mhi_dev->name); diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c index bf672de35131..770fc81b7e96 100644 --- a/drivers/bus/mhi/host/init.c +++ b/drivers/bus/mhi/host/init.c @@ -1395,9 +1395,9 @@ void mhi_driver_unregister(struct mhi_driver *mhi_drv) } EXPORT_SYMBOL_GPL(mhi_driver_unregister); =20 -static int mhi_uevent(struct device *dev, struct kobj_uevent_env *env) +static int mhi_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct mhi_device *mhi_dev =3D to_mhi_device(dev); + const struct mhi_device *mhi_dev =3D to_mhi_device(dev); =20 return add_uevent_var(env, "MODALIAS=3D" MHI_DEVICE_MODALIAS_FMT, mhi_dev->name); diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c index fca0d0669aa9..554e1992edd4 100644 --- a/drivers/bus/mips_cdmm.c +++ b/drivers/bus/mips_cdmm.c @@ -67,9 +67,9 @@ static int mips_cdmm_match(struct device *dev, struct dev= ice_driver *drv) return mips_cdmm_lookup(cdrv->id_table, cdev) !=3D NULL; } =20 -static int mips_cdmm_uevent(struct device *dev, struct kobj_uevent_env *en= v) +static int mips_cdmm_uevent(const struct device *dev, struct kobj_uevent_e= nv *env) { - struct mips_cdmm_device *cdev =3D to_mips_cdmm_device(dev); + const struct mips_cdmm_device *cdev =3D to_mips_cdmm_device(dev); int retval =3D 0; =20 retval =3D add_uevent_var(env, "CDMM_CPU=3D%u", cdev->cpu); diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c index a180af11e034..9aa99c369e48 100644 --- a/drivers/bus/sunxi-rsb.c +++ b/drivers/bus/sunxi-rsb.c @@ -172,7 +172,7 @@ static void sunxi_rsb_device_remove(struct device *dev) drv->remove(to_sunxi_rsb_device(dev)); } =20 -static int sunxi_rsb_device_modalias(struct device *dev, struct kobj_ueven= t_env *env) +static int sunxi_rsb_device_modalias(const struct device *dev, struct kobj= _uevent_env *env) { return of_device_uevent_modalias(dev, env); } diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c index a38a0cc20d47..b75dd77df7ce 100644 --- a/drivers/cxl/core/memdev.c +++ b/drivers/cxl/core/memdev.c @@ -162,7 +162,7 @@ static const struct device_type cxl_memdev_type =3D { .groups =3D cxl_memdev_attribute_groups, }; =20 -bool is_cxl_memdev(struct device *dev) +bool is_cxl_memdev(const struct device *dev) { return dev->type =3D=3D &cxl_memdev_type; } diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index b631a0520456..3f02dc135a12 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -38,7 +38,7 @@ static ssize_t devtype_show(struct device *dev, struct de= vice_attribute *attr, } static DEVICE_ATTR_RO(devtype); =20 -static int cxl_device_id(struct device *dev) +static int cxl_device_id(const struct device *dev) { if (dev->type =3D=3D &cxl_nvdimm_bridge_type) return CXL_DEVICE_NVDIMM_BRIDGE; @@ -523,13 +523,13 @@ static const struct device_type cxl_port_type =3D { .groups =3D cxl_port_attribute_groups, }; =20 -bool is_cxl_port(struct device *dev) +bool is_cxl_port(const struct device *dev) { return dev->type =3D=3D &cxl_port_type; } EXPORT_SYMBOL_NS_GPL(is_cxl_port, CXL); =20 -struct cxl_port *to_cxl_port(struct device *dev) +struct cxl_port *to_cxl_port(const struct device *dev) { if (dev_WARN_ONCE(dev, dev->type !=3D &cxl_port_type, "not a cxl_port device\n")) @@ -1826,7 +1826,7 @@ void cxl_driver_unregister(struct cxl_driver *cxl_drv) } EXPORT_SYMBOL_NS_GPL(cxl_driver_unregister, CXL); =20 -static int cxl_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +static int cxl_bus_uevent(const struct device *dev, struct kobj_uevent_env= *env) { return add_uevent_var(env, "MODALIAS=3D" CXL_MODALIAS_FMT, cxl_device_id(dev)); diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 1b1cf459ac77..c9e1b48a1a53 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -588,8 +588,8 @@ static inline bool is_cxl_root(struct cxl_port *port) return port->uport =3D=3D port->dev.parent; } =20 -bool is_cxl_port(struct device *dev); -struct cxl_port *to_cxl_port(struct device *dev); +bool is_cxl_port(const struct device *dev); +struct cxl_port *to_cxl_port(const struct device *dev); struct pci_bus; int devm_cxl_register_pci_bus(struct device *host, struct device *uport, struct pci_bus *bus); diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index ab138004f644..6749f2afb1b7 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -72,7 +72,7 @@ cxled_to_memdev(struct cxl_endpoint_decoder *cxled) return to_cxl_memdev(port->uport); } =20 -bool is_cxl_memdev(struct device *dev); +bool is_cxl_memdev(const struct device *dev); static inline bool is_cxl_endpoint(struct cxl_port *port) { return is_cxl_memdev(port->uport); diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index 1dad813ee4a6..e3a384182fe7 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -18,7 +18,7 @@ struct dax_id { char dev_name[DAX_NAME_LEN]; }; =20 -static int dax_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +static int dax_bus_uevent(const struct device *dev, struct kobj_uevent_env= *env) { /* * We only ever expect to handle device-dax instances, i.e. the diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index 65bffde137e3..713582cc27d1 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c @@ -127,9 +127,9 @@ static int eisa_bus_match(struct device *dev, struct de= vice_driver *drv) return 0; } =20 -static int eisa_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +static int eisa_bus_uevent(const struct device *dev, struct kobj_uevent_en= v *env) { - struct eisa_device *edev =3D to_eisa_device(dev); + const struct eisa_device *edev =3D to_eisa_device(dev); =20 add_uevent_var(env, "MODALIAS=3D" EISA_DEVICE_MODALIAS_FMT, edev->id.sig); return 0; diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c index 99d439480612..f29d77ecf72d 100644 --- a/drivers/firmware/arm_ffa/bus.c +++ b/drivers/firmware/arm_ffa/bus.c @@ -56,9 +56,9 @@ static void ffa_device_remove(struct device *dev) ffa_drv->remove(to_ffa_dev(dev)); } =20 -static int ffa_device_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int ffa_device_uevent(const struct device *dev, struct kobj_uevent_= env *env) { - struct ffa_device *ffa_dev =3D to_ffa_dev(dev); + const struct ffa_device *ffa_dev =3D to_ffa_dev(dev); =20 return add_uevent_var(env, "MODALIAS=3Darm_ffa:%04x:%pUb", ffa_dev->vm_id, &ffa_dev->uuid); diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index b9aae85ba930..4d32c98c82fc 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -293,9 +293,9 @@ static void dfl_bus_remove(struct device *dev) ddrv->remove(ddev); } =20 -static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +static int dfl_bus_uevent(const struct device *dev, struct kobj_uevent_env= *env) { - struct dfl_device *ddev =3D to_dfl_dev(dev); + const struct dfl_device *ddev =3D to_dfl_dev(dev); =20 return add_uevent_var(env, "MODALIAS=3Ddfl:t%04Xf%04X", ddev->type, ddev->feature_id); diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 497ef4b6a90a..36c24c2b0899 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -62,9 +62,9 @@ static int mipi_dsi_device_match(struct device *dev, stru= ct device_driver *drv) return 0; } =20 -static int mipi_dsi_uevent(struct device *dev, struct kobj_uevent_env *env) +static int mipi_dsi_uevent(const struct device *dev, struct kobj_uevent_en= v *env) { - struct mipi_dsi_device *dsi =3D to_mipi_dsi_device(dev); + const struct mipi_dsi_device *dsi =3D to_mipi_dsi_device(dev); int err; =20 err =3D of_device_uevent_modalias(dev, env); diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index bdee16a0bb8e..bc7271a00a94 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -338,7 +338,7 @@ static int host1x_device_match(struct device *dev, stru= ct device_driver *drv) return strcmp(dev_name(dev), drv->name) =3D=3D 0; } =20 -static int host1x_device_uevent(struct device *dev, +static int host1x_device_uevent(const struct device *dev, struct kobj_uevent_env *env) { struct device_node *np =3D dev->parent->of_node; diff --git a/drivers/greybus/core.c b/drivers/greybus/core.c index e546c6431877..5714be740470 100644 --- a/drivers/greybus/core.c +++ b/drivers/greybus/core.c @@ -78,14 +78,14 @@ static int greybus_match_device(struct device *dev, str= uct device_driver *drv) return 0; } =20 -static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env) +static int greybus_uevent(const struct device *dev, struct kobj_uevent_env= *env) { - struct gb_host_device *hd; - struct gb_module *module =3D NULL; - struct gb_interface *intf =3D NULL; - struct gb_control *control =3D NULL; - struct gb_bundle *bundle =3D NULL; - struct gb_svc *svc =3D NULL; + const struct gb_host_device *hd; + const struct gb_module *module =3D NULL; + const struct gb_interface *intf =3D NULL; + const struct gb_control *control =3D NULL; + const struct gb_bundle *bundle =3D NULL; + const struct gb_svc *svc =3D NULL; =20 if (is_gb_host_device(dev)) { hd =3D to_gb_host_device(dev); diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index bd47628da6be..298a5ca349b1 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2664,9 +2664,9 @@ static const struct attribute_group hid_dev_group =3D= { }; __ATTRIBUTE_GROUPS(hid_dev); =20 -static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) +static int hid_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct hid_device *hdev =3D to_hid_device(dev); + const struct hid_device *hdev =3D to_hid_device(dev); =20 if (add_uevent_var(env, "HID_ID=3D%04X:%08X:%08X", hdev->bus, hdev->vendor, hdev->product)) diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-= hid/ishtp/bus.c index f68aba8794fe..81385ab37fa9 100644 --- a/drivers/hid/intel-ish-hid/ishtp/bus.c +++ b/drivers/hid/intel-ish-hid/ishtp/bus.c @@ -361,7 +361,7 @@ static struct attribute *ishtp_cl_dev_attrs[] =3D { }; ATTRIBUTE_GROUPS(ishtp_cl_dev); =20 -static int ishtp_cl_uevent(struct device *dev, struct kobj_uevent_env *env) +static int ishtp_cl_uevent(const struct device *dev, struct kobj_uevent_en= v *env) { if (add_uevent_var(env, "MODALIAS=3D" ISHTP_MODULE_PREFIX "%s", dev_name(= dev))) return -ENOMEM; diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c index 884066109699..8fda8f1d064d 100644 --- a/drivers/hsi/hsi_core.c +++ b/drivers/hsi/hsi_core.c @@ -30,7 +30,7 @@ static struct attribute *hsi_bus_dev_attrs[] =3D { }; ATTRIBUTE_GROUPS(hsi_bus_dev); =20 -static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +static int hsi_bus_uevent(const struct device *dev, struct kobj_uevent_env= *env) { add_uevent_var(env, "MODALIAS=3Dhsi:%s", dev_name(dev)); =20 diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 3146710d4ac6..f50aaa189df6 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -711,9 +711,9 @@ __ATTRIBUTE_GROUPS(vmbus_bus); * representation of the device guid (each byte of the guid will be * represented with two hex characters. */ -static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env) +static int vmbus_uevent(const struct device *device, struct kobj_uevent_en= v *env) { - struct hv_device *dev =3D device_to_hv_device(device); + const struct hv_device *dev =3D device_to_hv_device(device); const char *format =3D "MODALIAS=3Dvmbus:%*phN"; =20 return add_uevent_var(env, format, UUID_SIZE, &dev->dev_type); diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 15ce3202322f..767fc9efb4a8 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -895,9 +895,9 @@ static int serio_bus_match(struct device *dev, struct d= evice_driver *drv) return err; \ } while (0) =20 -static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) +static int serio_uevent(const struct device *dev, struct kobj_uevent_env *= env) { - struct serio *serio; + const struct serio *serio; =20 if (!dev) return -ENODEV; diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c index 74d449858a61..cc1ecfd49928 100644 --- a/drivers/ipack/ipack.c +++ b/drivers/ipack/ipack.c @@ -76,9 +76,9 @@ static void ipack_bus_remove(struct device *device) drv->ops->remove(dev); } =20 -static int ipack_uevent(struct device *dev, struct kobj_uevent_env *env) +static int ipack_uevent(const struct device *dev, struct kobj_uevent_env *= env) { - struct ipack_device *idev; + const struct ipack_device *idev; =20 if (!dev) return -ENODEV; diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 7f2b0107c733..211ed9aa9edc 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -128,7 +128,7 @@ static int macio_device_resume(struct device * dev) return 0; } =20 -static int macio_device_modalias(struct device *dev, struct kobj_uevent_en= v *env) +static int macio_device_modalias(const struct device *dev, struct kobj_uev= ent_env *env) { return of_device_uevent_modalias(dev, env); } diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c index b8ad4f16b4ac..978fdfc19a06 100644 --- a/drivers/mcb/mcb-core.c +++ b/drivers/mcb/mcb-core.c @@ -41,9 +41,9 @@ static int mcb_match(struct device *dev, struct device_dr= iver *drv) return 0; } =20 -static int mcb_uevent(struct device *dev, struct kobj_uevent_env *env) +static int mcb_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct mcb_device *mdev =3D to_mcb_device(dev); + const struct mcb_device *mdev =3D to_mcb_device(dev); int ret; =20 ret =3D add_uevent_var(env, "MODALIAS=3Dmcb:16z%03d", mdev->id); diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memst= ick.c index 660df7d269fa..bf7667845459 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c @@ -57,10 +57,10 @@ static int memstick_bus_match(struct device *dev, struc= t device_driver *drv) return 0; } =20 -static int memstick_uevent(struct device *dev, struct kobj_uevent_env *env) +static int memstick_uevent(const struct device *dev, struct kobj_uevent_en= v *env) { - struct memstick_dev *card =3D container_of(dev, struct memstick_dev, - dev); + const struct memstick_dev *card =3D container_of_const(dev, struct memsti= ck_dev, + dev); =20 if (add_uevent_var(env, "MEMSTICK_TYPE=3D%02X", card->id.type)) return -ENOMEM; diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 4a08b624910a..096eee478e2e 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -1222,9 +1222,9 @@ ATTRIBUTE_GROUPS(mei_cldev); * * Return: 0 on success -ENOMEM on when add_uevent_var fails */ -static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env= *env) +static int mei_cl_device_uevent(const struct device *dev, struct kobj_ueve= nt_env *env) { - struct mei_cl_device *cldev =3D to_mei_cl_device(dev); + const struct mei_cl_device *cldev =3D to_mei_cl_device(dev); const uuid_le *uuid =3D mei_me_cl_uuid(cldev->me_cl); u8 version =3D mei_me_cl_ver(cldev->me_cl); =20 diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c index a3098fea3bf7..eee9b6581604 100644 --- a/drivers/misc/tifm_core.c +++ b/drivers/misc/tifm_core.c @@ -55,9 +55,9 @@ static int tifm_bus_match(struct device *dev, struct devi= ce_driver *drv) return 0; } =20 -static int tifm_uevent(struct device *dev, struct kobj_uevent_env *env) +static int tifm_uevent(const struct device *dev, struct kobj_uevent_env *e= nv) { - struct tifm_dev *sock =3D container_of(dev, struct tifm_dev, dev); + const struct tifm_dev *sock =3D container_of_const(dev, struct tifm_dev, = dev); =20 if (add_uevent_var(env, "TIFM_CARD_TYPE=3D%s", tifm_media_type_name(sock-= >type, 1))) return -ENOMEM; diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 36679f4e9acc..2c3074a605fc 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -55,9 +55,9 @@ static struct attribute *mmc_dev_attrs[] =3D { ATTRIBUTE_GROUPS(mmc_dev); =20 static int -mmc_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +mmc_bus_uevent(const struct device *dev, struct kobj_uevent_env *env) { - struct mmc_card *card =3D mmc_dev_to_card(dev); + const struct mmc_card *card =3D mmc_dev_to_card(dev); const char *type; unsigned int i; int retval =3D 0; diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index babf21a0adeb..5ec4e4ca52f0 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c @@ -120,9 +120,9 @@ static int sdio_bus_match(struct device *dev, struct de= vice_driver *drv) } =20 static int -sdio_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +sdio_bus_uevent(const struct device *dev, struct kobj_uevent_env *env) { - struct sdio_func *func =3D dev_to_sdio_func(dev); + const struct sdio_func *func =3D dev_to_sdio_func(dev); unsigned int i; =20 if (add_uevent_var(env, diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 1cd604cd1fa1..bca7012b03c1 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -995,7 +995,7 @@ static int mdio_bus_match(struct device *dev, struct de= vice_driver *drv) return 0; } =20 -static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env) +static int mdio_uevent(const struct device *dev, struct kobj_uevent_env *e= nv) { int rc; =20 diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xen= bus.c index c1ba4294f364..4638bb3664c4 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c @@ -200,7 +200,7 @@ static void xenvif_debugfs_delif(struct xenvif *vif) * and vif variables to the environment, for the benefit of the vif-* hotp= lug * scripts. */ -static int netback_uevent(struct xenbus_device *xdev, +static int netback_uevent(const struct xenbus_device *xdev, struct kobj_uevent_env *env) { struct backend_info *be =3D dev_get_drvdata(&xdev->dev); diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index b38d0355b0ac..92ce92fc9932 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -28,7 +28,7 @@ static int nvdimm_bus_major; struct class *nd_class; static DEFINE_IDA(nd_ida); =20 -static int to_nd_device_type(struct device *dev) +static int to_nd_device_type(const struct device *dev) { if (is_nvdimm(dev)) return ND_DEVICE_DIMM; @@ -42,7 +42,7 @@ static int to_nd_device_type(struct device *dev) return 0; } =20 -static int nvdimm_bus_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int nvdimm_bus_uevent(const struct device *dev, struct kobj_uevent_= env *env) { return add_uevent_var(env, "MODALIAS=3D" ND_DEVICE_MODALIAS_FMT, to_nd_device_type(dev)); diff --git a/drivers/nvdimm/dax_devs.c b/drivers/nvdimm/dax_devs.c index 7f4a9d28b670..3bd61f245788 100644 --- a/drivers/nvdimm/dax_devs.c +++ b/drivers/nvdimm/dax_devs.c @@ -38,7 +38,7 @@ static const struct device_type nd_dax_device_type =3D { .groups =3D nd_pfn_attribute_groups, }; =20 -bool is_nd_dax(struct device *dev) +bool is_nd_dax(const struct device *dev) { return dev ? dev->type =3D=3D &nd_dax_device_type : false; } diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index 1fc081dcf631..fb571666d33b 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c @@ -572,7 +572,7 @@ static const struct device_type nvdimm_device_type =3D { .groups =3D nvdimm_attribute_groups, }; =20 -bool is_nvdimm(struct device *dev) +bool is_nvdimm(const struct device *dev) { return dev->type =3D=3D &nvdimm_device_type; } diff --git a/drivers/nvdimm/nd-core.h b/drivers/nvdimm/nd-core.h index cc86ee09d7c0..ca2bbc57e755 100644 --- a/drivers/nvdimm/nd-core.h +++ b/drivers/nvdimm/nd-core.h @@ -82,14 +82,14 @@ static inline void nvdimm_security_overwrite_query(stru= ct work_struct *work) } #endif =20 -bool is_nvdimm(struct device *dev); -bool is_nd_pmem(struct device *dev); -bool is_nd_volatile(struct device *dev); -static inline bool is_nd_region(struct device *dev) +bool is_nvdimm(const struct device *dev); +bool is_nd_pmem(const struct device *dev); +bool is_nd_volatile(const struct device *dev); +static inline bool is_nd_region(const struct device *dev) { return is_nd_pmem(dev) || is_nd_volatile(dev); } -static inline bool is_memory(struct device *dev) +static inline bool is_memory(const struct device *dev) { return is_nd_pmem(dev) || is_nd_volatile(dev); } diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index 85ca5b4da3cf..cc166f99b005 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h @@ -599,7 +599,7 @@ static inline int nd_pfn_validate(struct nd_pfn *nd_pfn= , const char *sig) struct nd_dax *to_nd_dax(struct device *dev); #if IS_ENABLED(CONFIG_NVDIMM_DAX) int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns); -bool is_nd_dax(struct device *dev); +bool is_nd_dax(const struct device *dev); struct device *nd_dax_create(struct nd_region *nd_region); #else static inline int nd_dax_probe(struct device *dev, @@ -608,7 +608,7 @@ static inline int nd_dax_probe(struct device *dev, return -ENODEV; } =20 -static inline bool is_nd_dax(struct device *dev) +static inline bool is_nd_dax(const struct device *dev) { return false; } diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index 83dbf398ea84..8f134d63af13 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -839,12 +839,12 @@ static const struct device_type nd_volatile_device_ty= pe =3D { .groups =3D nd_region_attribute_groups, }; =20 -bool is_nd_pmem(struct device *dev) +bool is_nd_pmem(const struct device *dev) { return dev ? dev->type =3D=3D &nd_pmem_device_type : false; } =20 -bool is_nd_volatile(struct device *dev) +bool is_nd_volatile(const struct device *dev) { return dev ? dev->type =3D=3D &nd_volatile_device_type : false; } diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index a2ceeacc33eb..d934c27491c4 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1545,9 +1545,9 @@ void pci_dev_put(struct pci_dev *dev) } EXPORT_SYMBOL(pci_dev_put); =20 -static int pci_uevent(struct device *dev, struct kobj_uevent_env *env) +static int pci_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct pci_dev *pdev; + const struct pci_dev *pdev; =20 if (!dev) return -ENODEV; diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index ace133b9f7d4..c8087efa5e4a 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -927,9 +927,9 @@ static int pcmcia_bus_match(struct device *dev, struct = device_driver *drv) return 0; } =20 -static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int pcmcia_bus_uevent(const struct device *dev, struct kobj_uevent_= env *env) { - struct pcmcia_device *p_dev; + const struct pcmcia_device *p_dev; int i; u32 hash[4] =3D { 0, 0, 0, 0}; =20 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 46d1edc08f20..4fe7650dd014 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -797,9 +797,9 @@ static struct attribute *wmi_method_attrs[] =3D { }; ATTRIBUTE_GROUPS(wmi_method); =20 -static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env) +static int wmi_dev_uevent(const struct device *dev, struct kobj_uevent_env= *env) { - struct wmi_block *wblock =3D dev_to_wblock(dev); + const struct wmi_block *wblock =3D dev_to_wblock(dev); =20 if (add_uevent_var(env, "MODALIAS=3Dwmi:%pUL", &wblock->gblock.guid)) return -ENOMEM; diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c index a72bb0a40fcf..e60e49769bed 100644 --- a/drivers/rapidio/rio-driver.c +++ b/drivers/rapidio/rio-driver.c @@ -204,9 +204,9 @@ static int rio_match_bus(struct device *dev, struct dev= ice_driver *drv) out:return 0; } =20 -static int rio_uevent(struct device *dev, struct kobj_uevent_env *env) +static int rio_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct rio_dev *rdev; + const struct rio_dev *rdev; =20 if (!dev) return -ENODEV; diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c index d6dde00efdae..a2207c0cf432 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -492,9 +492,9 @@ static int rpmsg_dev_match(struct device *dev, struct d= evice_driver *drv) return of_driver_match_device(dev, drv); } =20 -static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env) +static int rpmsg_uevent(const struct device *dev, struct kobj_uevent_env *= env) { - struct rpmsg_device *rpdev =3D to_rpmsg_device(dev); + const struct rpmsg_device *rpdev =3D to_rpmsg_device(dev); int ret; =20 ret =3D of_device_uevent_modalias(dev, env); diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index c7db95398500..0723921902da 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -1402,9 +1402,9 @@ static void css_shutdown(struct device *dev) sch->driver->shutdown(sch); } =20 -static int css_uevent(struct device *dev, struct kobj_uevent_env *env) +static int css_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct subchannel *sch =3D to_subchannel(dev); + const struct subchannel *sch =3D to_subchannel(dev); int ret; =20 ret =3D add_uevent_var(env, "ST=3D%01X", sch->st); diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 9e0cf44ff9d4..b07ffd9ff117 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -80,7 +80,7 @@ ccw_bus_match (struct device * dev, struct device_driver = * drv) * specified size. Return length of resulting string (excluding trailing '= \0') * even if string doesn't fit buffer (snprintf semantics). */ static int snprint_alias(char *buf, size_t size, - struct ccw_device_id *id, const char *suffix) + const struct ccw_device_id *id, const char *suffix) { int len; =20 @@ -101,10 +101,10 @@ static int snprint_alias(char *buf, size_t size, =20 /* Set up environment variables for ccw device uevent. Return 0 on success, * non-zero otherwise. */ -static int ccw_uevent(struct device *dev, struct kobj_uevent_env *env) +static int ccw_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct ccw_device *cdev =3D to_ccwdev(dev); - struct ccw_device_id *id =3D &(cdev->id); + const struct ccw_device *cdev =3D to_ccwdev(dev); + const struct ccw_device_id *id =3D &(cdev->id); int ret; char modalias_buf[30]; =20 diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c index b6b4589c70bd..6b21ba68c1fe 100644 --- a/drivers/s390/cio/scm.c +++ b/drivers/s390/cio/scm.c @@ -37,7 +37,7 @@ static void scmdev_remove(struct device *dev) scmdrv->remove(scmdev); } =20 -static int scmdev_uevent(struct device *dev, struct kobj_uevent_env *env) +static int scmdev_uevent(const struct device *dev, struct kobj_uevent_env = *env) { return add_uevent_var(env, "MODALIAS=3Dscm:scmdev"); } diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index b02c631f3b71..f4cc1720156f 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c @@ -613,10 +613,10 @@ static int ap_bus_match(struct device *dev, struct de= vice_driver *drv) * It sets up a single environment variable DEV_TYPE which contains the * hardware device type. */ -static int ap_uevent(struct device *dev, struct kobj_uevent_env *env) +static int ap_uevent(const struct device *dev, struct kobj_uevent_env *env) { int rc =3D 0; - struct ap_device *ap_dev =3D to_ap_dev(dev); + const struct ap_device *ap_dev =3D to_ap_dev(dev); =20 /* Uevents from ap bus core don't need extensions to the env */ if (dev =3D=3D ap_root_device) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 981d1bab2120..a0dd711eb408 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -534,9 +534,9 @@ static int scsi_bus_match(struct device *dev, struct de= vice_driver *gendrv) return (sdp->inq_periph_qual =3D=3D SCSI_INQ_PQ_CON)? 1: 0; } =20 -static int scsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +static int scsi_bus_uevent(const struct device *dev, struct kobj_uevent_en= v *env) { - struct scsi_device *sdev; + const struct scsi_device *sdev; =20 if (dev->type !=3D &scsi_dev_type) return 0; diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c index 219483b79c09..d43873bb5fe6 100644 --- a/drivers/slimbus/core.c +++ b/drivers/slimbus/core.c @@ -93,9 +93,9 @@ static void slim_device_remove(struct device *dev) } } =20 -static int slim_device_uevent(struct device *dev, struct kobj_uevent_env *= env) +static int slim_device_uevent(const struct device *dev, struct kobj_uevent= _env *env) { - struct slim_device *sbdev =3D to_slim_device(dev); + const struct slim_device *sbdev =3D to_slim_device(dev); =20 return add_uevent_var(env, "MODALIAS=3Dslim:%s", dev_name(&sbdev->dev)); } diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c index cd44f17dad3d..d0f5cb2dd0ef 100644 --- a/drivers/soc/qcom/apr.c +++ b/drivers/soc/qcom/apr.c @@ -387,9 +387,9 @@ static void apr_device_remove(struct device *dev) spin_unlock(&apr->svcs_lock); } =20 -static int apr_uevent(struct device *dev, struct kobj_uevent_env *env) +static int apr_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct apr_device *adev =3D to_apr_device(dev); + const struct apr_device *adev =3D to_apr_device(dev); int ret; =20 ret =3D of_device_uevent_modalias(dev, env); diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 3cc7bb4d03de..9d5cec65cec8 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -395,7 +395,7 @@ static int spi_match_device(struct device *dev, struct = device_driver *drv) return strcmp(spi->modalias, drv->name) =3D=3D 0; } =20 -static int spi_uevent(struct device *dev, struct kobj_uevent_env *env) +static int spi_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { const struct spi_device *spi =3D to_spi_device(dev); int rc; diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c index 55381592bb5a..73551531ed43 100644 --- a/drivers/spmi/spmi.c +++ b/drivers/spmi/spmi.c @@ -366,7 +366,7 @@ static void spmi_drv_shutdown(struct device *dev) sdrv->shutdown(to_spmi_device(dev)); } =20 -static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env) +static int spmi_drv_uevent(const struct device *dev, struct kobj_uevent_en= v *env) { int ret; =20 diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index 8a93c83cb6f8..ab080cf26c9f 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c @@ -339,9 +339,9 @@ static int ssb_bus_match(struct device *dev, struct dev= ice_driver *drv) return 0; } =20 -static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *e= nv) +static int ssb_device_uevent(const struct device *dev, struct kobj_uevent_= env *env) { - struct ssb_device *ssb_dev =3D dev_to_ssb_dev(dev); + const struct ssb_device *ssb_dev =3D dev_to_ssb_dev(dev); =20 if (!dev) return -ENODEV; diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbph= y.c index 5a5c17a4519b..6a7d8cf2a1eb 100644 --- a/drivers/staging/greybus/gbphy.c +++ b/drivers/staging/greybus/gbphy.c @@ -71,14 +71,14 @@ static const struct device_type greybus_gbphy_dev_type = =3D { .pm =3D &gb_gbphy_pm_ops, }; =20 -static int gbphy_dev_uevent(struct device *dev, struct kobj_uevent_env *en= v) +static int gbphy_dev_uevent(const struct device *dev, struct kobj_uevent_e= nv *env) { - struct gbphy_device *gbphy_dev =3D to_gbphy_dev(dev); - struct greybus_descriptor_cport *cport_desc =3D gbphy_dev->cport_desc; - struct gb_bundle *bundle =3D gbphy_dev->bundle; - struct gb_interface *intf =3D bundle->intf; - struct gb_module *module =3D intf->module; - struct gb_host_device *hd =3D intf->hd; + const struct gbphy_device *gbphy_dev =3D to_gbphy_dev(dev); + const struct greybus_descriptor_cport *cport_desc =3D gbphy_dev->cport_de= sc; + const struct gb_bundle *bundle =3D gbphy_dev->bundle; + const struct gb_interface *intf =3D bundle->intf; + const struct gb_module *module =3D intf->module; + const struct gb_host_device *hd =3D intf->hd; =20 if (add_uevent_var(env, "BUS=3D%u", hd->bus_id)) return -ENOMEM; diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 98da206cd761..452cbb8ad484 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -1207,7 +1207,7 @@ static int tee_client_device_match(struct device *dev, return 0; } =20 -static int tee_client_device_uevent(struct device *dev, +static int tee_client_device_uevent(const struct device *dev, struct kobj_uevent_env *env) { uuid_t *dev_id =3D &to_tee_client_device(dev)->id.uuid; diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index d7c8461976ce..67b780b256a9 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -55,9 +55,9 @@ static int ulpi_match(struct device *dev, struct device_d= river *driver) return 0; } =20 -static int ulpi_uevent(struct device *dev, struct kobj_uevent_env *env) +static int ulpi_uevent(const struct device *dev, struct kobj_uevent_env *e= nv) { - struct ulpi *ulpi =3D to_ulpi_dev(dev); + const struct ulpi *ulpi =3D to_ulpi_dev(dev); int ret; =20 ret =3D of_device_uevent_modalias(dev, env); diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 7e7e119c253f..a0e076c6f3a4 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -899,14 +899,14 @@ static int usb_device_match(struct device *dev, struc= t device_driver *drv) return 0; } =20 -static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { - struct usb_device *usb_dev; + const struct usb_device *usb_dev; =20 if (is_usb_device(dev)) { usb_dev =3D to_usb_device(dev); } else if (is_usb_interface(dev)) { - struct usb_interface *intf =3D to_usb_interface(dev); + const struct usb_interface *intf =3D to_usb_interface(dev); =20 usb_dev =3D interface_to_usbdev(intf); } else { diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c index 31c2a3130cad..dbcb96151558 100644 --- a/drivers/usb/typec/bus.c +++ b/drivers/usb/typec/bus.c @@ -321,9 +321,9 @@ static int typec_match(struct device *dev, struct devic= e_driver *driver) return 0; } =20 -static int typec_uevent(struct device *dev, struct kobj_uevent_env *env) +static int typec_uevent(const struct device *dev, struct kobj_uevent_env *= env) { - struct typec_altmode *altmode =3D to_typec_altmode(dev); + const struct typec_altmode *altmode =3D to_typec_altmode(dev); =20 if (add_uevent_var(env, "SVID=3D%04X", altmode->svid)) return -ENOMEM; diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index b9a80aedee1b..3893dc29eb26 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -95,9 +95,9 @@ static int virtio_dev_match(struct device *_dv, struct de= vice_driver *_dr) return 0; } =20 -static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env) +static int virtio_uevent(const struct device *_dv, struct kobj_uevent_env = *env) { - struct virtio_device *dev =3D dev_to_virtio(_dv); + const struct virtio_device *dev =3D dev_to_virtio(_dv); =20 return add_uevent_var(env, "MODALIAS=3Dvirtio:d%08Xv%08X", dev->id.device, dev->id.vendor); diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index f2ae2e563dc5..3a1018e9415b 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -170,7 +170,7 @@ static struct w1_family w1_default_family =3D { .fops =3D &w1_default_fops, }; =20 -static int w1_uevent(struct device *dev, struct kobj_uevent_env *env); +static int w1_uevent(const struct device *dev, struct kobj_uevent_env *env= ); =20 static struct bus_type w1_bus_type =3D { .name =3D "w1", @@ -577,11 +577,11 @@ void w1_destroy_master_attributes(struct w1_master *m= aster) sysfs_remove_group(&master->dev.kobj, &w1_master_defattr_group); } =20 -static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) +static int w1_uevent(const struct device *dev, struct kobj_uevent_env *env) { - struct w1_master *md =3D NULL; - struct w1_slave *sl =3D NULL; - char *event_owner, *name; + const struct w1_master *md =3D NULL; + const struct w1_slave *sl =3D NULL; + const char *event_owner, *name; int err =3D 0; =20 if (dev->driver =3D=3D &w1_master_driver) { diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c index 28b2a1fa25ab..e46de75096f1 100644 --- a/drivers/xen/pvcalls-back.c +++ b/drivers/xen/pvcalls-back.c @@ -1186,7 +1186,7 @@ static int pvcalls_back_remove(struct xenbus_device *= dev) return 0; } =20 -static int pvcalls_back_uevent(struct xenbus_device *xdev, +static int pvcalls_back_uevent(const struct xenbus_device *xdev, struct kobj_uevent_env *env) { return 0; diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus= /xenbus_probe_backend.c index 9c09f89d8278..da96c260e26b 100644 --- a/drivers/xen/xenbus/xenbus_probe_backend.c +++ b/drivers/xen/xenbus/xenbus_probe_backend.c @@ -92,12 +92,12 @@ static int backend_bus_id(char bus_id[XEN_BUS_ID_SIZE],= const char *nodename) return 0; } =20 -static int xenbus_uevent_backend(struct device *dev, +static int xenbus_uevent_backend(const struct device *dev, struct kobj_uevent_env *env) { - struct xenbus_device *xdev; - struct xenbus_driver *drv; - struct xen_bus_type *bus; + const struct xenbus_device *xdev; + const struct xenbus_driver *drv; + const struct xen_bus_type *bus; =20 DPRINTK(""); =20 diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbu= s/xenbus_probe_frontend.c index f44d5a64351e..3f3836cb7279 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c @@ -73,10 +73,10 @@ static int xenbus_probe_frontend(struct xen_bus_type *b= us, const char *type, return err; } =20 -static int xenbus_uevent_frontend(struct device *_dev, +static int xenbus_uevent_frontend(const struct device *_dev, struct kobj_uevent_env *env) { - struct xenbus_device *dev =3D to_xenbus_device(_dev); + const struct xenbus_device *dev =3D to_xenbus_device(_dev); =20 if (add_uevent_var(env, "MODALIAS=3Dxen:%s", dev->devicetype)) return -ENOMEM; diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c index 96f068830549..025edfccedcf 100644 --- a/drivers/zorro/zorro-driver.c +++ b/drivers/zorro/zorro-driver.c @@ -130,9 +130,9 @@ static int zorro_bus_match(struct device *dev, struct d= evice_driver *drv) return !!zorro_match_device(ids, z); } =20 -static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env) +static int zorro_uevent(const struct device *dev, struct kobj_uevent_env *= env) { - struct zorro_dev *z; + const struct zorro_dev *z; =20 if (!dev) return -ENODEV; diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h index d529f644e92b..53e3cdf18bae 100644 --- a/include/linux/device/bus.h +++ b/include/linux/device/bus.h @@ -90,7 +90,7 @@ struct bus_type { const struct attribute_group **drv_groups; =20 int (*match)(struct device *dev, struct device_driver *drv); - int (*uevent)(struct device *dev, struct kobj_uevent_env *env); + int (*uevent)(const struct device *dev, struct kobj_uevent_env *env); int (*probe)(struct device *dev); void (*sync_state)(struct device *dev); void (*remove)(struct device *dev); diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 9a32495fbb1f..2edf7f09239e 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -223,7 +223,7 @@ struct spi_device { static_assert((SPI_MODE_KERNEL_MASK & SPI_MODE_USER_MASK) =3D=3D 0, "SPI_MODE_USER_MASK & SPI_MODE_KERNEL_MASK must not overlap"); =20 -static inline struct spi_device *to_spi_device(struct device *dev) +static inline struct spi_device *to_spi_device(const struct device *dev) { return dev ? container_of(dev, struct spi_device, dev) : NULL; } diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index f9b53acb4e02..1f326da289d3 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -285,7 +285,7 @@ struct ssb_device { =20 /* Go from struct device to struct ssb_device. */ static inline -struct ssb_device * dev_to_ssb_dev(struct device *dev) +struct ssb_device * dev_to_ssb_dev(const struct device *dev) { struct __ssb_dev_wrapper *wrap; wrap =3D container_of(dev, struct __ssb_dev_wrapper, dev); diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index a6872537724d..1c45664e0e5a 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -123,7 +123,7 @@ void snd_hdac_device_exit(struct hdac_device *dev); int snd_hdac_device_register(struct hdac_device *codec); void snd_hdac_device_unregister(struct hdac_device *codec); int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *n= ame); -int snd_hdac_codec_modalias(struct hdac_device *hdac, char *buf, size_t si= ze); +int snd_hdac_codec_modalias(const struct hdac_device *hdac, char *buf, siz= e_t size); =20 int snd_hdac_refresh_widgets(struct hdac_device *codec); =20 diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index b31f77f9c50c..9adefd9c98d4 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -117,7 +117,7 @@ struct xenbus_driver { int (*remove)(struct xenbus_device *dev); int (*suspend)(struct xenbus_device *dev); int (*resume)(struct xenbus_device *dev); - int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); + int (*uevent)(const struct xenbus_device *, struct kobj_uevent_env *); struct device_driver driver; int (*read_otherend_details)(struct xenbus_device *dev); int (*is_ready)(struct xenbus_device *dev); diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c index c9579d97fbab..39fb8fe4e6ab 100644 --- a/sound/aoa/soundbus/core.c +++ b/sound/aoa/soundbus/core.c @@ -55,10 +55,10 @@ static int soundbus_probe(struct device *dev) } =20 =20 -static int soundbus_uevent(struct device *dev, struct kobj_uevent_env *env) +static int soundbus_uevent(const struct device *dev, struct kobj_uevent_en= v *env) { - struct soundbus_dev * soundbus_dev; - struct platform_device * of; + const struct soundbus_dev * soundbus_dev; + const struct platform_device * of; const char *compat; int retval =3D 0; int cplen, seen =3D 0; diff --git a/sound/hda/hda_bus_type.c b/sound/hda/hda_bus_type.c index eea6b63f8305..4cd94178df9f 100644 --- a/sound/hda/hda_bus_type.c +++ b/sound/hda/hda_bus_type.c @@ -65,7 +65,7 @@ static int hda_bus_match(struct device *dev, struct devic= e_driver *drv) return 1; } =20 -static int hda_uevent(struct device *dev, struct kobj_uevent_env *env) +static int hda_uevent(const struct device *dev, struct kobj_uevent_env *en= v) { char modalias[32]; =20 diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index b7e5032b61c9..accc9d279ce5 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -204,7 +204,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_set_chip_name); * * Returns the size of string, like snprintf(), or a negative error code. */ -int snd_hdac_codec_modalias(struct hdac_device *codec, char *buf, size_t s= ize) +int snd_hdac_codec_modalias(const struct hdac_device *codec, char *buf, si= ze_t size) { return scnprintf(buf, size, "hdaudio:v%08Xr%08Xa%02X\n", codec->vendor_id, codec->revision_id, codec->type); --=20 2.39.0 From nobody Mon Sep 15 17:38:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9024C46467 for ; Wed, 11 Jan 2023 11:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235615AbjAKLbs (ORCPT ); Wed, 11 Jan 2023 06:31:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233184AbjAKLbC (ORCPT ); Wed, 11 Jan 2023 06:31:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D9638A1 for ; Wed, 11 Jan 2023 03:30:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E63F461BB9 for ; Wed, 11 Jan 2023 11:30:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA7DCC433EF; Wed, 11 Jan 2023 11:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436657; bh=AkE/lv0ihMfPjfXKWuy9LtK/5fpHAGwJNbIk/sxtpZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xyH0PdKnpOfo7TCRFHEs08ZqcotuUYyK+WIvRGB/0HjLpnOWomvZh+6GQNsKr7u2p Eq60cri1Ed3vS4oFsO9Bw2x2p77bU0GWyc4g8LtCT1Q8SMjRJMHpSXP5xoinl8NS+w C+UkiM2qPh69fPryXwecghAsegOu7iIWhWuBzRA4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Christine Caulfield , David Teigland , Bob Peterson , Andreas Gruenbacher , cluster-devel@redhat.com Subject: [PATCH v2 16/16] kobject: kset_uevent_ops: make uevent() callback take a const * Date: Wed, 11 Jan 2023 12:30:18 +0100 Message-Id: <20230111113018.459199-17-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3307; i=gregkh@linuxfoundation.org; h=from:subject; bh=AkE/lv0ihMfPjfXKWuy9LtK/5fpHAGwJNbIk/sxtpZA=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p6qlZSdpHHrmcBJ6auiRXqc+nP3tQvs417G8PzQwq+C fzXPd8SyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEit4xLJhktThKvivX6kZh3JRCx2 gDdQPFZQxz+PzNY5+ezc2TFX3zzFfpjHBUSHkpAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The uevent() callback in struct kset_uevent_ops does not modify the kobject passed into it, so make the pointer const to enforce this restriction. When doing so, fix up all existing uevent() callbacks to have the correct signature to preserve the build. Cc: "Rafael J. Wysocki" Cc: Christine Caulfield Cc: David Teigland Cc: Bob Peterson Cc: Andreas Gruenbacher Cc: cluster-devel@redhat.com Signed-off-by: Greg Kroah-Hartman Acked-by: Hans de Goede Acked-by: Rafael J. Wysocki --- drivers/base/core.c | 4 ++-- fs/dlm/lockspace.c | 4 ++-- fs/gfs2/sys.c | 6 +++--- include/linux/kobject.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 72ec54a8a4e1..b0cee0f30d8d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2387,9 +2387,9 @@ static const char *dev_uevent_name(const struct kobje= ct *kobj) return NULL; } =20 -static int dev_uevent(struct kobject *kobj, struct kobj_uevent_env *env) +static int dev_uevent(const struct kobject *kobj, struct kobj_uevent_env *= env) { - struct device *dev =3D kobj_to_dev(kobj); + const struct device *dev =3D kobj_to_dev(kobj); int retval =3D 0; =20 /* add device node properties if present */ diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index d0b4e2181a5f..9b6cfc4c30e3 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c @@ -215,9 +215,9 @@ static int do_uevent(struct dlm_ls *ls, int in) return ls->ls_uevent_result; } =20 -static int dlm_uevent(struct kobject *kobj, struct kobj_uevent_env *env) +static int dlm_uevent(const struct kobject *kobj, struct kobj_uevent_env *= env) { - struct dlm_ls *ls =3D container_of(kobj, struct dlm_ls, ls_kobj); + const struct dlm_ls *ls =3D container_of(kobj, struct dlm_ls, ls_kobj); =20 add_uevent_var(env, "LOCKSPACE=3D%s", ls->ls_name); return 0; diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index d87ea98cf535..d8dfabb0bc12 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c @@ -767,10 +767,10 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp) wait_for_completion(&sdp->sd_kobj_unregister); } =20 -static int gfs2_uevent(struct kobject *kobj, struct kobj_uevent_env *env) +static int gfs2_uevent(const struct kobject *kobj, struct kobj_uevent_env = *env) { - struct gfs2_sbd *sdp =3D container_of(kobj, struct gfs2_sbd, sd_kobj); - struct super_block *s =3D sdp->sd_vfs; + const struct gfs2_sbd *sdp =3D container_of(kobj, struct gfs2_sbd, sd_kob= j); + const struct super_block *s =3D sdp->sd_vfs; =20 add_uevent_var(env, "LOCKTABLE=3D%s", sdp->sd_table_name); add_uevent_var(env, "LOCKPROTO=3D%s", sdp->sd_proto_name); diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 58a5b75612e3..bdab370a24f4 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -137,7 +137,7 @@ struct kobj_uevent_env { struct kset_uevent_ops { int (* const filter)(const struct kobject *kobj); const char *(* const name)(const struct kobject *kobj); - int (* const uevent)(struct kobject *kobj, struct kobj_uevent_env *env); + int (* const uevent)(const struct kobject *kobj, struct kobj_uevent_env *= env); }; =20 struct kobj_attribute { --=20 2.39.0