* [PATCH 32/36] dmaengine: idxd: use const struct bus_type * [not found] <20230313182918.1312597-1-gregkh@linuxfoundation.org> @ 2023-03-13 18:29 ` Greg Kroah-Hartman 2023-03-13 19:07 ` Fenghua Yu ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Greg Kroah-Hartman @ 2023-03-13 18:29 UTC (permalink / raw) To: linux-kernel Cc: rafael, Greg Kroah-Hartman, Fenghua Yu, Dave Jiang, Vinod Koul, dmaengine In the functions unbind_store() and bind_store(), a struct bus_type * should be a const one, as the driver core bus functions used by this variable are expecting the pointer to be constant, and these functions do not modify the pointer at all. Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Vinod Koul <vkoul@kernel.org> Cc: dmaengine@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- Note, this is a patch that is a prepatory cleanup as part of a larger series of patches that is working on resolving some old driver core design mistakes. It will build and apply cleanly on top of 6.3-rc2 on its own, but I'd prefer if I could take it through my driver-core tree so that the driver core changes can be taken through there for 6.4-rc1. drivers/dma/idxd/compat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/idxd/compat.c b/drivers/dma/idxd/compat.c index 3df21615f888..5fd38d1b9d28 100644 --- a/drivers/dma/idxd/compat.c +++ b/drivers/dma/idxd/compat.c @@ -16,7 +16,7 @@ extern void device_driver_detach(struct device *dev); static ssize_t unbind_store(struct device_driver *drv, const char *buf, size_t count) { - struct bus_type *bus = drv->bus; + const struct bus_type *bus = drv->bus; struct device *dev; int rc = -ENODEV; @@ -32,7 +32,7 @@ static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, 0200, NULL, unbind_store); static ssize_t bind_store(struct device_driver *drv, const char *buf, size_t count) { - struct bus_type *bus = drv->bus; + const struct bus_type *bus = drv->bus; struct device *dev; struct device_driver *alt_drv = NULL; int rc = -ENODEV; -- 2.39.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 32/36] dmaengine: idxd: use const struct bus_type * 2023-03-13 18:29 ` [PATCH 32/36] dmaengine: idxd: use const struct bus_type * Greg Kroah-Hartman @ 2023-03-13 19:07 ` Fenghua Yu 2023-03-16 10:16 ` Greg Kroah-Hartman 2023-03-17 17:19 ` Vinod Koul 2023-03-17 17:33 ` Dave Jiang 2 siblings, 1 reply; 7+ messages in thread From: Fenghua Yu @ 2023-03-13 19:07 UTC (permalink / raw) To: Greg Kroah-Hartman, linux-kernel Cc: rafael, Dave Jiang, Vinod Koul, dmaengine Hi, Greg, On 3/13/23 11:29, Greg Kroah-Hartman wrote: > In the functions unbind_store() and bind_store(), a struct bus_type * > should be a const one, as the driver core bus functions used by this > variable are expecting the pointer to be constant, and these functions > do not modify the pointer at all. > > Cc: Fenghua Yu <fenghua.yu@intel.com> > Cc: Dave Jiang <dave.jiang@intel.com> > Cc: Vinod Koul <vkoul@kernel.org> > Cc: dmaengine@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > --- > Note, this is a patch that is a prepatory cleanup as part of a larger > series of patches that is working on resolving some old driver core > design mistakes. It will build and apply cleanly on top of 6.3-rc2 on > its own, but I'd prefer if I could take it through my driver-core tree > so that the driver core changes can be taken through there for 6.4-rc1. > > drivers/dma/idxd/compat.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/dma/idxd/compat.c b/drivers/dma/idxd/compat.c > index 3df21615f888..5fd38d1b9d28 100644 > --- a/drivers/dma/idxd/compat.c > +++ b/drivers/dma/idxd/compat.c > @@ -16,7 +16,7 @@ extern void device_driver_detach(struct device *dev); > > static ssize_t unbind_store(struct device_driver *drv, const char *buf, size_t count) > { > - struct bus_type *bus = drv->bus; > + const struct bus_type *bus = drv->bus; > struct device *dev; > int rc = -ENODEV; > > @@ -32,7 +32,7 @@ static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, 0200, NULL, unbind_store); > > static ssize_t bind_store(struct device_driver *drv, const char *buf, size_t count) > { > - struct bus_type *bus = drv->bus; > + const struct bus_type *bus = drv->bus; > struct device *dev; > struct device_driver *alt_drv = NULL; > int rc = -ENODEV; After applying this patch, warning is reported: drivers/dma/idxd/compat.c: In function ‘bind_store’: drivers/dma/idxd/compat.c:47:47: warning: passing argument 2 of ‘driver_find’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 47 | alt_drv = driver_find("idxd", bus); | ^~~ In file included from ./include/linux/device.h:32, from drivers/dma/idxd/compat.c:6: ./include/linux/device/driver.h:129:59: note: expected ‘struct bus_type *’ but argument is of type ‘const struct bus_type *’ 129 | struct bus_type *bus); | ~~~~~~~~~~~~~~~~~^~~ Should the "bus" parameter in driver_find() definition be changed to const as well to avoid the warning? Thanks. -Fenghua ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 32/36] dmaengine: idxd: use const struct bus_type * 2023-03-13 19:07 ` Fenghua Yu @ 2023-03-16 10:16 ` Greg Kroah-Hartman 2023-03-16 23:57 ` Fenghua Yu 0 siblings, 1 reply; 7+ messages in thread From: Greg Kroah-Hartman @ 2023-03-16 10:16 UTC (permalink / raw) To: Fenghua Yu; +Cc: linux-kernel, rafael, Dave Jiang, Vinod Koul, dmaengine On Mon, Mar 13, 2023 at 12:07:27PM -0700, Fenghua Yu wrote: > Hi, Greg, > > On 3/13/23 11:29, Greg Kroah-Hartman wrote: > > In the functions unbind_store() and bind_store(), a struct bus_type * > > should be a const one, as the driver core bus functions used by this > > variable are expecting the pointer to be constant, and these functions > > do not modify the pointer at all. > > > > Cc: Fenghua Yu <fenghua.yu@intel.com> > > Cc: Dave Jiang <dave.jiang@intel.com> > > Cc: Vinod Koul <vkoul@kernel.org> > > Cc: dmaengine@vger.kernel.org > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > --- > > Note, this is a patch that is a prepatory cleanup as part of a larger > > series of patches that is working on resolving some old driver core > > design mistakes. It will build and apply cleanly on top of 6.3-rc2 on > > its own, but I'd prefer if I could take it through my driver-core tree > > so that the driver core changes can be taken through there for 6.4-rc1. > > > > drivers/dma/idxd/compat.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/dma/idxd/compat.c b/drivers/dma/idxd/compat.c > > index 3df21615f888..5fd38d1b9d28 100644 > > --- a/drivers/dma/idxd/compat.c > > +++ b/drivers/dma/idxd/compat.c > > @@ -16,7 +16,7 @@ extern void device_driver_detach(struct device *dev); > > static ssize_t unbind_store(struct device_driver *drv, const char *buf, size_t count) > > { > > - struct bus_type *bus = drv->bus; > > + const struct bus_type *bus = drv->bus; > > struct device *dev; > > int rc = -ENODEV; > > @@ -32,7 +32,7 @@ static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, 0200, NULL, unbind_store); > > static ssize_t bind_store(struct device_driver *drv, const char *buf, size_t count) > > { > > - struct bus_type *bus = drv->bus; > > + const struct bus_type *bus = drv->bus; > > struct device *dev; > > struct device_driver *alt_drv = NULL; > > int rc = -ENODEV; > > After applying this patch, warning is reported: > > drivers/dma/idxd/compat.c: In function ‘bind_store’: > drivers/dma/idxd/compat.c:47:47: warning: passing argument 2 of > ‘driver_find’ discards ‘const’ qualifier from pointer target type > [-Wdiscarded-qualifiers] > 47 | alt_drv = driver_find("idxd", bus); > | ^~~ > In file included from ./include/linux/device.h:32, > from drivers/dma/idxd/compat.c:6: > ./include/linux/device/driver.h:129:59: note: expected ‘struct bus_type *’ > but argument is of type ‘const struct bus_type *’ > 129 | struct bus_type *bus); > | ~~~~~~~~~~~~~~~~~^~~ > > Should the "bus" parameter in driver_find() definition be changed to const > as well to avoid the warning? Oops, yes, it needs an earlier patch in this series, sorry, I didn't call that out properly in the notes section of the patch. So I can just take this through my tree if that's ok. thanks, greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 32/36] dmaengine: idxd: use const struct bus_type * 2023-03-16 10:16 ` Greg Kroah-Hartman @ 2023-03-16 23:57 ` Fenghua Yu 2023-03-24 8:57 ` Greg Kroah-Hartman 0 siblings, 1 reply; 7+ messages in thread From: Fenghua Yu @ 2023-03-16 23:57 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: linux-kernel, rafael, Dave Jiang, Vinod Koul, dmaengine Hi, Greg, On 3/16/23 03:16, Greg Kroah-Hartman wrote: > On Mon, Mar 13, 2023 at 12:07:27PM -0700, Fenghua Yu wrote: >> Hi, Greg, >> >> On 3/13/23 11:29, Greg Kroah-Hartman wrote: >>> In the functions unbind_store() and bind_store(), a struct bus_type * >>> should be a const one, as the driver core bus functions used by this >>> variable are expecting the pointer to be constant, and these functions >>> do not modify the pointer at all. >>> >>> Cc: Fenghua Yu <fenghua.yu@intel.com> >>> Cc: Dave Jiang <dave.jiang@intel.com> >>> Cc: Vinod Koul <vkoul@kernel.org> >>> Cc: dmaengine@vger.kernel.org >>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> >>> --- >>> Note, this is a patch that is a prepatory cleanup as part of a larger >>> series of patches that is working on resolving some old driver core >>> design mistakes. It will build and apply cleanly on top of 6.3-rc2 on >>> its own, but I'd prefer if I could take it through my driver-core tree >>> so that the driver core changes can be taken through there for 6.4-rc1. >>> >>> drivers/dma/idxd/compat.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/dma/idxd/compat.c b/drivers/dma/idxd/compat.c >>> index 3df21615f888..5fd38d1b9d28 100644 >>> --- a/drivers/dma/idxd/compat.c >>> +++ b/drivers/dma/idxd/compat.c >>> @@ -16,7 +16,7 @@ extern void device_driver_detach(struct device *dev); >>> static ssize_t unbind_store(struct device_driver *drv, const char *buf, size_t count) >>> { >>> - struct bus_type *bus = drv->bus; >>> + const struct bus_type *bus = drv->bus; >>> struct device *dev; >>> int rc = -ENODEV; >>> @@ -32,7 +32,7 @@ static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, 0200, NULL, unbind_store); >>> static ssize_t bind_store(struct device_driver *drv, const char *buf, size_t count) >>> { >>> - struct bus_type *bus = drv->bus; >>> + const struct bus_type *bus = drv->bus; >>> struct device *dev; >>> struct device_driver *alt_drv = NULL; >>> int rc = -ENODEV; >> >> After applying this patch, warning is reported: >> >> drivers/dma/idxd/compat.c: In function ‘bind_store’: >> drivers/dma/idxd/compat.c:47:47: warning: passing argument 2 of >> ‘driver_find’ discards ‘const’ qualifier from pointer target type >> [-Wdiscarded-qualifiers] >> 47 | alt_drv = driver_find("idxd", bus); >> | ^~~ >> In file included from ./include/linux/device.h:32, >> from drivers/dma/idxd/compat.c:6: >> ./include/linux/device/driver.h:129:59: note: expected ‘struct bus_type *’ >> but argument is of type ‘const struct bus_type *’ >> 129 | struct bus_type *bus); >> | ~~~~~~~~~~~~~~~~~^~~ >> >> Should the "bus" parameter in driver_find() definition be changed to const >> as well to avoid the warning? > > Oops, yes, it needs an earlier patch in this series, sorry, I didn't > call that out properly in the notes section of the patch. > > So I can just take this through my tree if that's ok. Sure. Acked-by: Fenghua Yu <fenghua.yu@intel.com> Thanks. -Fenghua ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 32/36] dmaengine: idxd: use const struct bus_type * 2023-03-16 23:57 ` Fenghua Yu @ 2023-03-24 8:57 ` Greg Kroah-Hartman 0 siblings, 0 replies; 7+ messages in thread From: Greg Kroah-Hartman @ 2023-03-24 8:57 UTC (permalink / raw) To: Fenghua Yu; +Cc: linux-kernel, rafael, Dave Jiang, Vinod Koul, dmaengine On Thu, Mar 16, 2023 at 04:57:54PM -0700, Fenghua Yu wrote: > Hi, Greg, > > On 3/16/23 03:16, Greg Kroah-Hartman wrote: > > On Mon, Mar 13, 2023 at 12:07:27PM -0700, Fenghua Yu wrote: > > > Hi, Greg, > > > > > > On 3/13/23 11:29, Greg Kroah-Hartman wrote: > > > > In the functions unbind_store() and bind_store(), a struct bus_type * > > > > should be a const one, as the driver core bus functions used by this > > > > variable are expecting the pointer to be constant, and these functions > > > > do not modify the pointer at all. > > > > > > > > Cc: Fenghua Yu <fenghua.yu@intel.com> > > > > Cc: Dave Jiang <dave.jiang@intel.com> > > > > Cc: Vinod Koul <vkoul@kernel.org> > > > > Cc: dmaengine@vger.kernel.org > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > > --- > > > > Note, this is a patch that is a prepatory cleanup as part of a larger > > > > series of patches that is working on resolving some old driver core > > > > design mistakes. It will build and apply cleanly on top of 6.3-rc2 on > > > > its own, but I'd prefer if I could take it through my driver-core tree > > > > so that the driver core changes can be taken through there for 6.4-rc1. > > > > > > > > drivers/dma/idxd/compat.c | 4 ++-- > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/dma/idxd/compat.c b/drivers/dma/idxd/compat.c > > > > index 3df21615f888..5fd38d1b9d28 100644 > > > > --- a/drivers/dma/idxd/compat.c > > > > +++ b/drivers/dma/idxd/compat.c > > > > @@ -16,7 +16,7 @@ extern void device_driver_detach(struct device *dev); > > > > static ssize_t unbind_store(struct device_driver *drv, const char *buf, size_t count) > > > > { > > > > - struct bus_type *bus = drv->bus; > > > > + const struct bus_type *bus = drv->bus; > > > > struct device *dev; > > > > int rc = -ENODEV; > > > > @@ -32,7 +32,7 @@ static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, 0200, NULL, unbind_store); > > > > static ssize_t bind_store(struct device_driver *drv, const char *buf, size_t count) > > > > { > > > > - struct bus_type *bus = drv->bus; > > > > + const struct bus_type *bus = drv->bus; > > > > struct device *dev; > > > > struct device_driver *alt_drv = NULL; > > > > int rc = -ENODEV; > > > > > > After applying this patch, warning is reported: > > > > > > drivers/dma/idxd/compat.c: In function ‘bind_store’: > > > drivers/dma/idxd/compat.c:47:47: warning: passing argument 2 of > > > ‘driver_find’ discards ‘const’ qualifier from pointer target type > > > [-Wdiscarded-qualifiers] > > > 47 | alt_drv = driver_find("idxd", bus); > > > | ^~~ > > > In file included from ./include/linux/device.h:32, > > > from drivers/dma/idxd/compat.c:6: > > > ./include/linux/device/driver.h:129:59: note: expected ‘struct bus_type *’ > > > but argument is of type ‘const struct bus_type *’ > > > 129 | struct bus_type *bus); > > > | ~~~~~~~~~~~~~~~~~^~~ > > > > > > Should the "bus" parameter in driver_find() definition be changed to const > > > as well to avoid the warning? > > > > Oops, yes, it needs an earlier patch in this series, sorry, I didn't > > call that out properly in the notes section of the patch. > > > > So I can just take this through my tree if that's ok. > > Sure. > > Acked-by: Fenghua Yu <fenghua.yu@intel.com> Great, thanks for this, I've now queued up the series in my tree. greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 32/36] dmaengine: idxd: use const struct bus_type * 2023-03-13 18:29 ` [PATCH 32/36] dmaengine: idxd: use const struct bus_type * Greg Kroah-Hartman 2023-03-13 19:07 ` Fenghua Yu @ 2023-03-17 17:19 ` Vinod Koul 2023-03-17 17:33 ` Dave Jiang 2 siblings, 0 replies; 7+ messages in thread From: Vinod Koul @ 2023-03-17 17:19 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: linux-kernel, rafael, Fenghua Yu, Dave Jiang, dmaengine On 13-03-23, 19:29, Greg Kroah-Hartman wrote: > In the functions unbind_store() and bind_store(), a struct bus_type * > should be a const one, as the driver core bus functions used by this > variable are expecting the pointer to be constant, and these functions > do not modify the pointer at all. Acked-by: Vinod Koul <vkoul@kernel.org> -- ~Vinod ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 32/36] dmaengine: idxd: use const struct bus_type * 2023-03-13 18:29 ` [PATCH 32/36] dmaengine: idxd: use const struct bus_type * Greg Kroah-Hartman 2023-03-13 19:07 ` Fenghua Yu 2023-03-17 17:19 ` Vinod Koul @ 2023-03-17 17:33 ` Dave Jiang 2 siblings, 0 replies; 7+ messages in thread From: Dave Jiang @ 2023-03-17 17:33 UTC (permalink / raw) To: Greg Kroah-Hartman, linux-kernel Cc: rafael, Fenghua Yu, Vinod Koul, dmaengine On 3/13/23 11:29 AM, Greg Kroah-Hartman wrote: > In the functions unbind_store() and bind_store(), a struct bus_type * > should be a const one, as the driver core bus functions used by this > variable are expecting the pointer to be constant, and these functions > do not modify the pointer at all. > > Cc: Fenghua Yu <fenghua.yu@intel.com> > Cc: Dave Jiang <dave.jiang@intel.com> > Cc: Vinod Koul <vkoul@kernel.org> > Cc: dmaengine@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Dave Jiang <dave.jiang@intel.com> > --- > Note, this is a patch that is a prepatory cleanup as part of a larger > series of patches that is working on resolving some old driver core > design mistakes. It will build and apply cleanly on top of 6.3-rc2 on > its own, but I'd prefer if I could take it through my driver-core tree > so that the driver core changes can be taken through there for 6.4-rc1. > > drivers/dma/idxd/compat.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/dma/idxd/compat.c b/drivers/dma/idxd/compat.c > index 3df21615f888..5fd38d1b9d28 100644 > --- a/drivers/dma/idxd/compat.c > +++ b/drivers/dma/idxd/compat.c > @@ -16,7 +16,7 @@ extern void device_driver_detach(struct device *dev); > > static ssize_t unbind_store(struct device_driver *drv, const char *buf, size_t count) > { > - struct bus_type *bus = drv->bus; > + const struct bus_type *bus = drv->bus; > struct device *dev; > int rc = -ENODEV; > > @@ -32,7 +32,7 @@ static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, 0200, NULL, unbind_store); > > static ssize_t bind_store(struct device_driver *drv, const char *buf, size_t count) > { > - struct bus_type *bus = drv->bus; > + const struct bus_type *bus = drv->bus; > struct device *dev; > struct device_driver *alt_drv = NULL; > int rc = -ENODEV; ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-03-24 8:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230313182918.1312597-1-gregkh@linuxfoundation.org>
2023-03-13 18:29 ` [PATCH 32/36] dmaengine: idxd: use const struct bus_type * Greg Kroah-Hartman
2023-03-13 19:07 ` Fenghua Yu
2023-03-16 10:16 ` Greg Kroah-Hartman
2023-03-16 23:57 ` Fenghua Yu
2023-03-24 8:57 ` Greg Kroah-Hartman
2023-03-17 17:19 ` Vinod Koul
2023-03-17 17:33 ` Dave Jiang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox