diff mbox series

[1/6] auxbus: make to_auxiliary_drv accept and return a constant pointer

Message ID 20240611130103.3262749-7-gregkh@linuxfoundation.org (mailing list archive)
State New
Headers show
Series [1/6] auxbus: make to_auxiliary_drv accept and return a constant pointer | expand

Commit Message

Greg KH June 11, 2024, 1:01 p.m. UTC
In the quest to make struct device constant, start by making
to_auziliary_drv() return a constant pointer so that drivers that call
this can be fixed up before the driver core changes.

As the return type previously was not constant, also fix up all callers
that were assuming that the pointer was not going to be a constant one
in order to not break the build.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Dave Ertman <david.m.ertman@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Bingbu Cao <bingbu.cao@intel.com>
Cc: Tianshu Qiu <tian.shu.qiu@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Michael Chan <michael.chan@broadcom.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Tariq Toukan <tariqt@nvidia.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: Daniel Baluta <daniel.baluta@nxp.com>
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: linux-media@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: intel-wired-lan@lists.osuosl.org
Cc: linux-rdma@vger.kernel.org
Cc: sound-open-firmware@alsa-project.org
Cc: linux-sound@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/auxiliary.c                      | 8 ++++----
 drivers/media/pci/intel/ipu6/ipu6-bus.h       | 2 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 4 ++--
 drivers/net/ethernet/intel/ice/ice_ptp.c      | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/dev.c | 4 ++--
 include/linux/auxiliary_bus.h                 | 2 +-
 sound/soc/sof/sof-client.c                    | 4 ++--
 7 files changed, 13 insertions(+), 13 deletions(-)

Comments

Mark Brown June 11, 2024, 1:22 p.m. UTC | #1
On Tue, Jun 11, 2024 at 03:01:04PM +0200, Greg Kroah-Hartman wrote:
> In the quest to make struct device constant, start by making
> to_auziliary_drv() return a constant pointer so that drivers that call
> this can be fixed up before the driver core changes.

Acked-by: Mark Brown <broonie@kernel.org>
Sakari Ailus June 11, 2024, 1:44 p.m. UTC | #2
Hi Greg,

On Tue, Jun 11, 2024 at 03:01:04PM +0200, Greg Kroah-Hartman wrote:
> In the quest to make struct device constant, start by making
> to_auziliary_drv() return a constant pointer so that drivers that call

s/z/s/

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> # drivers/media/pci/intel/ipu6

> this can be fixed up before the driver core changes.
> 
> As the return type previously was not constant, also fix up all callers
> that were assuming that the pointer was not going to be a constant one
> in order to not break the build.
Przemek Kitszel June 11, 2024, 1:50 p.m. UTC | #3
On 6/11/24 15:01, Greg Kroah-Hartman wrote:
> In the quest to make struct device constant, start by making

just curious, how far it will go? eg. do you plan to convert
get/put_device() to accept const? or convert devlink API to accept
consts?

> to_auziliary_drv() return a constant pointer so that drivers that call

typo: s/auz/aux/

> this can be fixed up before the driver core changes.
> 
> As the return type previously was not constant, also fix up all callers
> that were assuming that the pointer was not going to be a constant one
> in order to not break the build.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


[...]

> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
> index 0f17fc1181d2..7341e7c4ef24 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -2784,7 +2784,7 @@ static struct ice_pf *
>   ice_ptp_aux_dev_to_owner_pf(struct auxiliary_device *aux_dev)
>   {
>   	struct ice_ptp_port_owner *ports_owner;
> -	struct auxiliary_driver *aux_drv;
> +	const struct auxiliary_driver *aux_drv;
>   	struct ice_ptp *owner_ptp;
>   
>   	if (!aux_dev->dev.driver)
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> index 47e7c2639774..9a79674d27f1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> @@ -349,7 +349,7 @@ int mlx5_attach_device(struct mlx5_core_dev *dev)
>   {
>   	struct mlx5_priv *priv = &dev->priv;
>   	struct auxiliary_device *adev;
> -	struct auxiliary_driver *adrv;
> +	const struct auxiliary_driver *adrv;

nit: in netdev we do maintain RCT order of initialization

>   	int ret = 0, i;
>   
>   	devl_assert_locked(priv_to_devlink(dev));
> @@ -406,7 +406,7 @@ void mlx5_detach_device(struct mlx5_core_dev *dev, bool suspend)
>   {
>   	struct mlx5_priv *priv = &dev->priv;
>   	struct auxiliary_device *adev;
> -	struct auxiliary_driver *adrv;
> +	const struct auxiliary_driver *adrv;
>   	pm_message_t pm = {};
>   	int i;
>   

[...]
Greg KH June 11, 2024, 1:56 p.m. UTC | #4
On Tue, Jun 11, 2024 at 01:44:07PM +0000, Sakari Ailus wrote:
> Hi Greg,
> 
> On Tue, Jun 11, 2024 at 03:01:04PM +0200, Greg Kroah-Hartman wrote:
> > In the quest to make struct device constant, start by making
> > to_auziliary_drv() return a constant pointer so that drivers that call
> 
> s/z/s/

Ah, good catch, I'll fix that up when applying it!

> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> # drivers/media/pci/intel/ipu6

thanks for the review.

greg k-h
Greg KH June 11, 2024, 1:56 p.m. UTC | #5
On Tue, Jun 11, 2024 at 02:22:37PM +0100, Mark Brown wrote:
> On Tue, Jun 11, 2024 at 03:01:04PM +0200, Greg Kroah-Hartman wrote:
> > In the quest to make struct device constant, start by making
> > to_auziliary_drv() return a constant pointer so that drivers that call
> > this can be fixed up before the driver core changes.
> 
> Acked-by: Mark Brown <broonie@kernel.org>

thanks for the review.
Martin Habets June 12, 2024, 8:15 a.m. UTC | #6
On Tue, Jun 11, 2024 at 03:01:04PM +0200, Greg Kroah-Hartman wrote:
> In the quest to make struct device constant, start by making
> to_auziliary_drv() return a constant pointer so that drivers that call
> this can be fixed up before the driver core changes.
> 
> As the return type previously was not constant, also fix up all callers
> that were assuming that the pointer was not going to be a constant one
> in order to not break the build.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Dave Ertman <david.m.ertman@intel.com>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Bingbu Cao <bingbu.cao@intel.com>
> Cc: Tianshu Qiu <tian.shu.qiu@intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Michael Chan <michael.chan@broadcom.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
> Cc: Saeed Mahameed <saeedm@nvidia.com>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: Tariq Toukan <tariqt@nvidia.com>
> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
> Cc: Bard Liao <yung-chuan.liao@linux.intel.com>
> Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Cc: Daniel Baluta <daniel.baluta@nxp.com>
> Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: linux-media@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Cc: intel-wired-lan@lists.osuosl.org
> Cc: linux-rdma@vger.kernel.org
> Cc: sound-open-firmware@alsa-project.org
> Cc: linux-sound@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Martin Habets <habetsm.xilinx@gmail.com>

> ---
>  drivers/base/auxiliary.c                      | 8 ++++----
>  drivers/media/pci/intel/ipu6/ipu6-bus.h       | 2 +-
>  drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 4 ++--
>  drivers/net/ethernet/intel/ice/ice_ptp.c      | 2 +-
>  drivers/net/ethernet/mellanox/mlx5/core/dev.c | 4 ++--
>  include/linux/auxiliary_bus.h                 | 2 +-
>  sound/soc/sof/sof-client.c                    | 4 ++--
>  7 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
> index d3a2c40c2f12..5832e31bb77b 100644
> --- a/drivers/base/auxiliary.c
> +++ b/drivers/base/auxiliary.c
> @@ -180,7 +180,7 @@ static const struct auxiliary_device_id *auxiliary_match_id(const struct auxilia
>  static int auxiliary_match(struct device *dev, struct device_driver *drv)
>  {
>  	struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
> -	struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv);
> +	const struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv);
>  
>  	return !!auxiliary_match_id(auxdrv->id_table, auxdev);
>  }
> @@ -203,7 +203,7 @@ static const struct dev_pm_ops auxiliary_dev_pm_ops = {
>  
>  static int auxiliary_bus_probe(struct device *dev)
>  {
> -	struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
> +	const struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
>  	struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
>  	int ret;
>  
> @@ -222,7 +222,7 @@ static int auxiliary_bus_probe(struct device *dev)
>  
>  static void auxiliary_bus_remove(struct device *dev)
>  {
> -	struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
> +	const struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
>  	struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
>  
>  	if (auxdrv->remove)
> @@ -232,7 +232,7 @@ static void auxiliary_bus_remove(struct device *dev)
>  
>  static void auxiliary_bus_shutdown(struct device *dev)
>  {
> -	struct auxiliary_driver *auxdrv = NULL;
> +	const struct auxiliary_driver *auxdrv = NULL;
>  	struct auxiliary_device *auxdev;
>  
>  	if (dev->driver) {
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-bus.h b/drivers/media/pci/intel/ipu6/ipu6-bus.h
> index b26c6aee1621..bb4926dfdf08 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6-bus.h
> +++ b/drivers/media/pci/intel/ipu6/ipu6-bus.h
> @@ -21,7 +21,7 @@ struct ipu6_buttress_ctrl;
>  
>  struct ipu6_bus_device {
>  	struct auxiliary_device auxdev;
> -	struct auxiliary_driver *auxdrv;
> +	const struct auxiliary_driver *auxdrv;
>  	const struct ipu6_auxdrv_data *auxdrv_data;
>  	struct list_head list;
>  	void *pdata;
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
> index ba3fa1c2e5d9..b9e7d3e7b15d 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
> @@ -239,7 +239,7 @@ void bnxt_ulp_stop(struct bnxt *bp)
>  
>  		adev = &aux_priv->aux_dev;
>  		if (adev->dev.driver) {
> -			struct auxiliary_driver *adrv;
> +			const struct auxiliary_driver *adrv;
>  			pm_message_t pm = {};
>  
>  			adrv = to_auxiliary_drv(adev->dev.driver);
> @@ -277,7 +277,7 @@ void bnxt_ulp_start(struct bnxt *bp, int err)
>  
>  		adev = &aux_priv->aux_dev;
>  		if (adev->dev.driver) {
> -			struct auxiliary_driver *adrv;
> +			const struct auxiliary_driver *adrv;
>  
>  			adrv = to_auxiliary_drv(adev->dev.driver);
>  			edev->en_state = bp->state;
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
> index 0f17fc1181d2..7341e7c4ef24 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -2784,7 +2784,7 @@ static struct ice_pf *
>  ice_ptp_aux_dev_to_owner_pf(struct auxiliary_device *aux_dev)
>  {
>  	struct ice_ptp_port_owner *ports_owner;
> -	struct auxiliary_driver *aux_drv;
> +	const struct auxiliary_driver *aux_drv;
>  	struct ice_ptp *owner_ptp;
>  
>  	if (!aux_dev->dev.driver)
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> index 47e7c2639774..9a79674d27f1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> @@ -349,7 +349,7 @@ int mlx5_attach_device(struct mlx5_core_dev *dev)
>  {
>  	struct mlx5_priv *priv = &dev->priv;
>  	struct auxiliary_device *adev;
> -	struct auxiliary_driver *adrv;
> +	const struct auxiliary_driver *adrv;
>  	int ret = 0, i;
>  
>  	devl_assert_locked(priv_to_devlink(dev));
> @@ -406,7 +406,7 @@ void mlx5_detach_device(struct mlx5_core_dev *dev, bool suspend)
>  {
>  	struct mlx5_priv *priv = &dev->priv;
>  	struct auxiliary_device *adev;
> -	struct auxiliary_driver *adrv;
> +	const struct auxiliary_driver *adrv;
>  	pm_message_t pm = {};
>  	int i;
>  
> diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h
> index de21d9d24a95..bdff7b85f2ae 100644
> --- a/include/linux/auxiliary_bus.h
> +++ b/include/linux/auxiliary_bus.h
> @@ -203,7 +203,7 @@ static inline struct auxiliary_device *to_auxiliary_dev(struct device *dev)
>  	return container_of(dev, struct auxiliary_device, dev);
>  }
>  
> -static inline struct auxiliary_driver *to_auxiliary_drv(struct device_driver *drv)
> +static inline const struct auxiliary_driver *to_auxiliary_drv(const struct device_driver *drv)
>  {
>  	return container_of(drv, struct auxiliary_driver, driver);
>  }
> diff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c
> index 99f74def4ab6..5d6005a88e79 100644
> --- a/sound/soc/sof/sof-client.c
> +++ b/sound/soc/sof/sof-client.c
> @@ -357,7 +357,7 @@ EXPORT_SYMBOL_NS_GPL(sof_client_ipc4_find_module, SND_SOC_SOF_CLIENT);
>  
>  int sof_suspend_clients(struct snd_sof_dev *sdev, pm_message_t state)
>  {
> -	struct auxiliary_driver *adrv;
> +	const struct auxiliary_driver *adrv;
>  	struct sof_client_dev *cdev;
>  
>  	mutex_lock(&sdev->ipc_client_mutex);
> @@ -380,7 +380,7 @@ EXPORT_SYMBOL_NS_GPL(sof_suspend_clients, SND_SOC_SOF_CLIENT);
>  
>  int sof_resume_clients(struct snd_sof_dev *sdev)
>  {
> -	struct auxiliary_driver *adrv;
> +	const struct auxiliary_driver *adrv;
>  	struct sof_client_dev *cdev;
>  
>  	mutex_lock(&sdev->ipc_client_mutex);
> -- 
> 2.45.2
>
Greg KH June 12, 2024, 8:20 a.m. UTC | #7
On Tue, Jun 11, 2024 at 03:50:47PM +0200, Przemek Kitszel wrote:
> On 6/11/24 15:01, Greg Kroah-Hartman wrote:
> > In the quest to make struct device constant, start by making
> 
> just curious, how far it will go? eg. do you plan to convert
> get/put_device() to accept const?

Ugh, that should have said "in the quest to make struct device_driver
const", not device.  devices obviously can't be constant everywhere as
they are dynamically created.

> or convert devlink API to accept
> consts?

Again, sorry, no, typo on my part.

> 
> > to_auziliary_drv() return a constant pointer so that drivers that call
> 
> typo: s/auz/aux/

I'll fix this typo up, and the one above, when I commit it.

> 
> > this can be fixed up before the driver core changes.
> > 
> > As the return type previously was not constant, also fix up all callers
> > that were assuming that the pointer was not going to be a constant one
> > in order to not break the build.
> > 
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> 
> [...]
> 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
> > index 0f17fc1181d2..7341e7c4ef24 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> > @@ -2784,7 +2784,7 @@ static struct ice_pf *
> >   ice_ptp_aux_dev_to_owner_pf(struct auxiliary_device *aux_dev)
> >   {
> >   	struct ice_ptp_port_owner *ports_owner;
> > -	struct auxiliary_driver *aux_drv;
> > +	const struct auxiliary_driver *aux_drv;
> >   	struct ice_ptp *owner_ptp;
> >   	if (!aux_dev->dev.driver)
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> > index 47e7c2639774..9a79674d27f1 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> > @@ -349,7 +349,7 @@ int mlx5_attach_device(struct mlx5_core_dev *dev)
> >   {
> >   	struct mlx5_priv *priv = &dev->priv;
> >   	struct auxiliary_device *adev;
> > -	struct auxiliary_driver *adrv;
> > +	const struct auxiliary_driver *adrv;
> 
> nit: in netdev we do maintain RCT order of initialization

what does that mean?  Nothing is being initialized here.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
index d3a2c40c2f12..5832e31bb77b 100644
--- a/drivers/base/auxiliary.c
+++ b/drivers/base/auxiliary.c
@@ -180,7 +180,7 @@  static const struct auxiliary_device_id *auxiliary_match_id(const struct auxilia
 static int auxiliary_match(struct device *dev, struct device_driver *drv)
 {
 	struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
-	struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv);
+	const struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv);
 
 	return !!auxiliary_match_id(auxdrv->id_table, auxdev);
 }
@@ -203,7 +203,7 @@  static const struct dev_pm_ops auxiliary_dev_pm_ops = {
 
 static int auxiliary_bus_probe(struct device *dev)
 {
-	struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
+	const struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
 	struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
 	int ret;
 
@@ -222,7 +222,7 @@  static int auxiliary_bus_probe(struct device *dev)
 
 static void auxiliary_bus_remove(struct device *dev)
 {
-	struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
+	const struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
 	struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
 
 	if (auxdrv->remove)
@@ -232,7 +232,7 @@  static void auxiliary_bus_remove(struct device *dev)
 
 static void auxiliary_bus_shutdown(struct device *dev)
 {
-	struct auxiliary_driver *auxdrv = NULL;
+	const struct auxiliary_driver *auxdrv = NULL;
 	struct auxiliary_device *auxdev;
 
 	if (dev->driver) {
diff --git a/drivers/media/pci/intel/ipu6/ipu6-bus.h b/drivers/media/pci/intel/ipu6/ipu6-bus.h
index b26c6aee1621..bb4926dfdf08 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-bus.h
+++ b/drivers/media/pci/intel/ipu6/ipu6-bus.h
@@ -21,7 +21,7 @@  struct ipu6_buttress_ctrl;
 
 struct ipu6_bus_device {
 	struct auxiliary_device auxdev;
-	struct auxiliary_driver *auxdrv;
+	const struct auxiliary_driver *auxdrv;
 	const struct ipu6_auxdrv_data *auxdrv_data;
 	struct list_head list;
 	void *pdata;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
index ba3fa1c2e5d9..b9e7d3e7b15d 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
@@ -239,7 +239,7 @@  void bnxt_ulp_stop(struct bnxt *bp)
 
 		adev = &aux_priv->aux_dev;
 		if (adev->dev.driver) {
-			struct auxiliary_driver *adrv;
+			const struct auxiliary_driver *adrv;
 			pm_message_t pm = {};
 
 			adrv = to_auxiliary_drv(adev->dev.driver);
@@ -277,7 +277,7 @@  void bnxt_ulp_start(struct bnxt *bp, int err)
 
 		adev = &aux_priv->aux_dev;
 		if (adev->dev.driver) {
-			struct auxiliary_driver *adrv;
+			const struct auxiliary_driver *adrv;
 
 			adrv = to_auxiliary_drv(adev->dev.driver);
 			edev->en_state = bp->state;
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 0f17fc1181d2..7341e7c4ef24 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -2784,7 +2784,7 @@  static struct ice_pf *
 ice_ptp_aux_dev_to_owner_pf(struct auxiliary_device *aux_dev)
 {
 	struct ice_ptp_port_owner *ports_owner;
-	struct auxiliary_driver *aux_drv;
+	const struct auxiliary_driver *aux_drv;
 	struct ice_ptp *owner_ptp;
 
 	if (!aux_dev->dev.driver)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
index 47e7c2639774..9a79674d27f1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
@@ -349,7 +349,7 @@  int mlx5_attach_device(struct mlx5_core_dev *dev)
 {
 	struct mlx5_priv *priv = &dev->priv;
 	struct auxiliary_device *adev;
-	struct auxiliary_driver *adrv;
+	const struct auxiliary_driver *adrv;
 	int ret = 0, i;
 
 	devl_assert_locked(priv_to_devlink(dev));
@@ -406,7 +406,7 @@  void mlx5_detach_device(struct mlx5_core_dev *dev, bool suspend)
 {
 	struct mlx5_priv *priv = &dev->priv;
 	struct auxiliary_device *adev;
-	struct auxiliary_driver *adrv;
+	const struct auxiliary_driver *adrv;
 	pm_message_t pm = {};
 	int i;
 
diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h
index de21d9d24a95..bdff7b85f2ae 100644
--- a/include/linux/auxiliary_bus.h
+++ b/include/linux/auxiliary_bus.h
@@ -203,7 +203,7 @@  static inline struct auxiliary_device *to_auxiliary_dev(struct device *dev)
 	return container_of(dev, struct auxiliary_device, dev);
 }
 
-static inline struct auxiliary_driver *to_auxiliary_drv(struct device_driver *drv)
+static inline const struct auxiliary_driver *to_auxiliary_drv(const struct device_driver *drv)
 {
 	return container_of(drv, struct auxiliary_driver, driver);
 }
diff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c
index 99f74def4ab6..5d6005a88e79 100644
--- a/sound/soc/sof/sof-client.c
+++ b/sound/soc/sof/sof-client.c
@@ -357,7 +357,7 @@  EXPORT_SYMBOL_NS_GPL(sof_client_ipc4_find_module, SND_SOC_SOF_CLIENT);
 
 int sof_suspend_clients(struct snd_sof_dev *sdev, pm_message_t state)
 {
-	struct auxiliary_driver *adrv;
+	const struct auxiliary_driver *adrv;
 	struct sof_client_dev *cdev;
 
 	mutex_lock(&sdev->ipc_client_mutex);
@@ -380,7 +380,7 @@  EXPORT_SYMBOL_NS_GPL(sof_suspend_clients, SND_SOC_SOF_CLIENT);
 
 int sof_resume_clients(struct snd_sof_dev *sdev)
 {
-	struct auxiliary_driver *adrv;
+	const struct auxiliary_driver *adrv;
 	struct sof_client_dev *cdev;
 
 	mutex_lock(&sdev->ipc_client_mutex);