* [PATCH] usb: typec: ucsi: Changing the driver data type to void @ 2024-06-18 12:00 Heikki Krogerus 2024-06-18 12:20 ` Greg Kroah-Hartman 0 siblings, 1 reply; 4+ messages in thread From: Heikki Krogerus @ 2024-06-18 12:00 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: linux-usb Let's use the same data type as struct device. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> --- drivers/usb/typec/ucsi/ucsi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h index 97eda8cd63df..1280cac314fe 100644 --- a/drivers/usb/typec/ucsi/ucsi.h +++ b/drivers/usb/typec/ucsi/ucsi.h @@ -395,7 +395,7 @@ struct ucsi_debugfs_entry { struct ucsi { u16 version; struct device *dev; - struct driver_data *driver_data; + void *driver_data; const struct ucsi_operations *ops; -- 2.43.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: typec: ucsi: Changing the driver data type to void 2024-06-18 12:00 [PATCH] usb: typec: ucsi: Changing the driver data type to void Heikki Krogerus @ 2024-06-18 12:20 ` Greg Kroah-Hartman 2024-06-18 13:14 ` Heikki Krogerus 0 siblings, 1 reply; 4+ messages in thread From: Greg Kroah-Hartman @ 2024-06-18 12:20 UTC (permalink / raw) To: Heikki Krogerus; +Cc: linux-usb On Tue, Jun 18, 2024 at 03:00:24PM +0300, Heikki Krogerus wrote: > Let's use the same data type as struct device. > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/ucsi/ucsi.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h > index 97eda8cd63df..1280cac314fe 100644 > --- a/drivers/usb/typec/ucsi/ucsi.h > +++ b/drivers/usb/typec/ucsi/ucsi.h > @@ -395,7 +395,7 @@ struct ucsi_debugfs_entry { > struct ucsi { > u16 version; > struct device *dev; > - struct driver_data *driver_data; > + void *driver_data; Nice, but why? And how was this building? I don't see a "struct driver_data" defined anywhere here. thanks, greg k-h ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: typec: ucsi: Changing the driver data type to void 2024-06-18 12:20 ` Greg Kroah-Hartman @ 2024-06-18 13:14 ` Heikki Krogerus 2024-06-18 13:58 ` Greg Kroah-Hartman 0 siblings, 1 reply; 4+ messages in thread From: Heikki Krogerus @ 2024-06-18 13:14 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: linux-usb On Tue, Jun 18, 2024 at 02:20:03PM +0200, Greg Kroah-Hartman wrote: > On Tue, Jun 18, 2024 at 03:00:24PM +0300, Heikki Krogerus wrote: > > Let's use the same data type as struct device. > > > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > > --- > > drivers/usb/typec/ucsi/ucsi.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h > > index 97eda8cd63df..1280cac314fe 100644 > > --- a/drivers/usb/typec/ucsi/ucsi.h > > +++ b/drivers/usb/typec/ucsi/ucsi.h > > @@ -395,7 +395,7 @@ struct ucsi_debugfs_entry { > > struct ucsi { > > u16 version; > > struct device *dev; > > - struct driver_data *driver_data; > > + void *driver_data; > > Nice, but why? > > And how was this building? I don't see a "struct driver_data" defined > anywhere here. I had not even thought about that, but that's weird. I can write anything after "struct" there, and it will just build without any warnings or errors. The complier does not seem to even check the type in this case, since the member is always assigned a void pointer. So this is actually a bug, no? thanks, -- heikki ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: typec: ucsi: Changing the driver data type to void 2024-06-18 13:14 ` Heikki Krogerus @ 2024-06-18 13:58 ` Greg Kroah-Hartman 0 siblings, 0 replies; 4+ messages in thread From: Greg Kroah-Hartman @ 2024-06-18 13:58 UTC (permalink / raw) To: Heikki Krogerus; +Cc: linux-usb On Tue, Jun 18, 2024 at 04:14:57PM +0300, Heikki Krogerus wrote: > On Tue, Jun 18, 2024 at 02:20:03PM +0200, Greg Kroah-Hartman wrote: > > On Tue, Jun 18, 2024 at 03:00:24PM +0300, Heikki Krogerus wrote: > > > Let's use the same data type as struct device. > > > > > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > > > --- > > > drivers/usb/typec/ucsi/ucsi.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h > > > index 97eda8cd63df..1280cac314fe 100644 > > > --- a/drivers/usb/typec/ucsi/ucsi.h > > > +++ b/drivers/usb/typec/ucsi/ucsi.h > > > @@ -395,7 +395,7 @@ struct ucsi_debugfs_entry { > > > struct ucsi { > > > u16 version; > > > struct device *dev; > > > - struct driver_data *driver_data; > > > + void *driver_data; > > > > Nice, but why? > > > > And how was this building? I don't see a "struct driver_data" defined > > anywhere here. > > I had not even thought about that, but that's weird. > > I can write anything after "struct" there, and it will just build > without any warnings or errors. The complier does not seem to even > check the type in this case, since the member is always assigned a > void pointer. Ah, I guess the compiler never actually has to look up what 'struct driver_data' is if it is never referenced (i.e. you are only casting void * to it.) > So this is actually a bug, no? Kind of? But it works, so let's just leave it alone :) I'll take this patch as it is "obviously correct" now, but sure looked odd to start with. thanks, greg k-h ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-18 13:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-06-18 12:00 [PATCH] usb: typec: ucsi: Changing the driver data type to void Heikki Krogerus 2024-06-18 12:20 ` Greg Kroah-Hartman 2024-06-18 13:14 ` Heikki Krogerus 2024-06-18 13:58 ` 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