public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: gbphy: fix up const issue with the match callback
@ 2025-05-21 14:55 Greg Kroah-Hartman
  2025-05-22 12:55 ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2025-05-21 14:55 UTC (permalink / raw)
  To: linux-staging; +Cc: Greg Kroah-Hartman

gbphy_dev_match_id() should be taking a const pointer, as the pointer
passed to it from the container_of() call was const to start with (it
was accidentally cast away with the call.)  Fix this all up by correctly
marking the pointer types.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/greybus/gbphy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
index 6adcad286633..ab8a1af36808 100644
--- a/drivers/staging/greybus/gbphy.c
+++ b/drivers/staging/greybus/gbphy.c
@@ -102,8 +102,8 @@ static int gbphy_dev_uevent(const struct device *dev, struct kobj_uevent_env *en
 }
 
 static const struct gbphy_device_id *
-gbphy_dev_match_id(struct gbphy_device *gbphy_dev,
-		   struct gbphy_driver *gbphy_drv)
+gbphy_dev_match_id(const struct gbphy_device *gbphy_dev,
+		   const struct gbphy_driver *gbphy_drv)
 {
 	const struct gbphy_device_id *id = gbphy_drv->id_table;
 
@@ -119,8 +119,8 @@ gbphy_dev_match_id(struct gbphy_device *gbphy_dev,
 
 static int gbphy_dev_match(struct device *dev, const struct device_driver *drv)
 {
-	struct gbphy_driver *gbphy_drv = to_gbphy_driver(drv);
-	struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
+	const struct gbphy_driver *gbphy_drv = to_gbphy_driver(drv);
+	const struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
 	const struct gbphy_device_id *id;
 
 	id = gbphy_dev_match_id(gbphy_dev, gbphy_drv);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: greybus: gbphy: fix up const issue with the match callback
  2025-05-21 14:55 [PATCH] staging: greybus: gbphy: fix up const issue with the match callback Greg Kroah-Hartman
@ 2025-05-22 12:55 ` Johan Hovold
  2025-05-22 13:10   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2025-05-22 12:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging

On Wed, May 21, 2025 at 04:55:55PM +0200, Greg Kroah-Hartman wrote:
> gbphy_dev_match_id() should be taking a const pointer, as the pointer
> passed to it from the container_of() call was const to start with (it
> was accidentally cast away with the call.)  Fix this all up by correctly
> marking the pointer types.

This one too should have a:

Fixes: d69d80484598 ("driver core: have match() callback in struct bus_type take a const *")

> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/staging/greybus/gbphy.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
> index 6adcad286633..ab8a1af36808 100644
> --- a/drivers/staging/greybus/gbphy.c
> +++ b/drivers/staging/greybus/gbphy.c
> @@ -102,8 +102,8 @@ static int gbphy_dev_uevent(const struct device *dev, struct kobj_uevent_env *en
>  }
>  
>  static const struct gbphy_device_id *
> -gbphy_dev_match_id(struct gbphy_device *gbphy_dev,
> -		   struct gbphy_driver *gbphy_drv)
> +gbphy_dev_match_id(const struct gbphy_device *gbphy_dev,
> +		   const struct gbphy_driver *gbphy_drv)
>  {
>  	const struct gbphy_device_id *id = gbphy_drv->id_table;
>  
> @@ -119,8 +119,8 @@ gbphy_dev_match_id(struct gbphy_device *gbphy_dev,
>  
>  static int gbphy_dev_match(struct device *dev, const struct device_driver *drv)
>  {
> -	struct gbphy_driver *gbphy_drv = to_gbphy_driver(drv);
> -	struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
> +	const struct gbphy_driver *gbphy_drv = to_gbphy_driver(drv);
> +	const struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);

Making the dev pointers const is arguably a separate change, but I guess
it's related enough:

Reviewed-by: Johan Hovold <johan@kernel.org>

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: greybus: gbphy: fix up const issue with the match callback
  2025-05-22 12:55 ` Johan Hovold
@ 2025-05-22 13:10   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2025-05-22 13:10 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-staging

On Thu, May 22, 2025 at 02:55:58PM +0200, Johan Hovold wrote:
> On Wed, May 21, 2025 at 04:55:55PM +0200, Greg Kroah-Hartman wrote:
> > gbphy_dev_match_id() should be taking a const pointer, as the pointer
> > passed to it from the container_of() call was const to start with (it
> > was accidentally cast away with the call.)  Fix this all up by correctly
> > marking the pointer types.
> 
> This one too should have a:
> 
> Fixes: d69d80484598 ("driver core: have match() callback in struct bus_type take a const *")
> 
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  drivers/staging/greybus/gbphy.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
> > index 6adcad286633..ab8a1af36808 100644
> > --- a/drivers/staging/greybus/gbphy.c
> > +++ b/drivers/staging/greybus/gbphy.c
> > @@ -102,8 +102,8 @@ static int gbphy_dev_uevent(const struct device *dev, struct kobj_uevent_env *en
> >  }
> >  
> >  static const struct gbphy_device_id *
> > -gbphy_dev_match_id(struct gbphy_device *gbphy_dev,
> > -		   struct gbphy_driver *gbphy_drv)
> > +gbphy_dev_match_id(const struct gbphy_device *gbphy_dev,
> > +		   const struct gbphy_driver *gbphy_drv)
> >  {
> >  	const struct gbphy_device_id *id = gbphy_drv->id_table;
> >  
> > @@ -119,8 +119,8 @@ gbphy_dev_match_id(struct gbphy_device *gbphy_dev,
> >  
> >  static int gbphy_dev_match(struct device *dev, const struct device_driver *drv)
> >  {
> > -	struct gbphy_driver *gbphy_drv = to_gbphy_driver(drv);
> > -	struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
> > +	const struct gbphy_driver *gbphy_drv = to_gbphy_driver(drv);
> > +	const struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
> 
> Making the dev pointers const is arguably a separate change, but I guess
> it's related enough:

Oops, nope, you are right, the dev pointer should not be const here, or
anywhere else, that's not needed, I got too energetic.  I'll respin this
and add the fixes: tag, thanks!

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-22 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 14:55 [PATCH] staging: greybus: gbphy: fix up const issue with the match callback Greg Kroah-Hartman
2025-05-22 12:55 ` Johan Hovold
2025-05-22 13:10   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox