public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: make dsa_bus_type const
@ 2024-02-13 14:43 Ricardo B. Marliere
  2024-02-13 15:40 ` Dave Jiang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ricardo B. Marliere @ 2024-02-13 14:43 UTC (permalink / raw)
  To: Fenghua Yu, Dave Jiang, Vinod Koul
  Cc: dmaengine, linux-kernel, Greg Kroah-Hartman, Ricardo B. Marliere

Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the dsa_bus_type variable to be a constant
structure as well, placing it into read-only memory which can not be
modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 drivers/dma/idxd/bus.c  | 2 +-
 drivers/dma/idxd/idxd.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/idxd/bus.c b/drivers/dma/idxd/bus.c
index 0c9e689a2e77..b83b27e04f2a 100644
--- a/drivers/dma/idxd/bus.c
+++ b/drivers/dma/idxd/bus.c
@@ -72,7 +72,7 @@ static int idxd_bus_uevent(const struct device *dev, struct kobj_uevent_env *env
 	return add_uevent_var(env, "MODALIAS=" IDXD_DEVICES_MODALIAS_FMT, 0);
 }
 
-struct bus_type dsa_bus_type = {
+const struct bus_type dsa_bus_type = {
 	.name = "dsa",
 	.match = idxd_config_bus_match,
 	.probe = idxd_config_bus_probe,
diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
index 47de3f93ff1e..f14a660a2a34 100644
--- a/drivers/dma/idxd/idxd.h
+++ b/drivers/dma/idxd/idxd.h
@@ -516,7 +516,7 @@ static inline void idxd_set_user_intr(struct idxd_device *idxd, bool enable)
 	iowrite32(reg.bits, idxd->reg_base + IDXD_GENCFG_OFFSET);
 }
 
-extern struct bus_type dsa_bus_type;
+extern const struct bus_type dsa_bus_type;
 
 extern bool support_enqcmd;
 extern struct ida idxd_ida;

---
base-commit: de7d9cb3b064fdfb2e0e7706d14ffee20b762ad2
change-id: 20240213-bus_cleanup-idxd-8feaf2af5461

Best regards,
-- 
Ricardo B. Marliere <ricardo@marliere.net>


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

* Re: [PATCH] dmaengine: idxd: make dsa_bus_type const
  2024-02-13 14:43 [PATCH] dmaengine: idxd: make dsa_bus_type const Ricardo B. Marliere
@ 2024-02-13 15:40 ` Dave Jiang
  2024-02-13 17:15 ` Fenghua Yu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2024-02-13 15:40 UTC (permalink / raw)
  To: Ricardo B. Marliere, Fenghua Yu, Vinod Koul
  Cc: dmaengine, linux-kernel, Greg Kroah-Hartman



On 2/13/24 7:43 AM, Ricardo B. Marliere wrote:
> Since commit d492cc2573a0 ("driver core: device.h: make struct
> bus_type a const *"), the driver core can properly handle constant
> struct bus_type, move the dsa_bus_type variable to be a constant
> structure as well, placing it into read-only memory which can not be
> modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/dma/idxd/bus.c  | 2 +-
>  drivers/dma/idxd/idxd.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/idxd/bus.c b/drivers/dma/idxd/bus.c
> index 0c9e689a2e77..b83b27e04f2a 100644
> --- a/drivers/dma/idxd/bus.c
> +++ b/drivers/dma/idxd/bus.c
> @@ -72,7 +72,7 @@ static int idxd_bus_uevent(const struct device *dev, struct kobj_uevent_env *env
>  	return add_uevent_var(env, "MODALIAS=" IDXD_DEVICES_MODALIAS_FMT, 0);
>  }
>  
> -struct bus_type dsa_bus_type = {
> +const struct bus_type dsa_bus_type = {
>  	.name = "dsa",
>  	.match = idxd_config_bus_match,
>  	.probe = idxd_config_bus_probe,
> diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
> index 47de3f93ff1e..f14a660a2a34 100644
> --- a/drivers/dma/idxd/idxd.h
> +++ b/drivers/dma/idxd/idxd.h
> @@ -516,7 +516,7 @@ static inline void idxd_set_user_intr(struct idxd_device *idxd, bool enable)
>  	iowrite32(reg.bits, idxd->reg_base + IDXD_GENCFG_OFFSET);
>  }
>  
> -extern struct bus_type dsa_bus_type;
> +extern const struct bus_type dsa_bus_type;
>  
>  extern bool support_enqcmd;
>  extern struct ida idxd_ida;
> 
> ---
> base-commit: de7d9cb3b064fdfb2e0e7706d14ffee20b762ad2
> change-id: 20240213-bus_cleanup-idxd-8feaf2af5461
> 
> Best regards,

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

* Re: [PATCH] dmaengine: idxd: make dsa_bus_type const
  2024-02-13 14:43 [PATCH] dmaengine: idxd: make dsa_bus_type const Ricardo B. Marliere
  2024-02-13 15:40 ` Dave Jiang
@ 2024-02-13 17:15 ` Fenghua Yu
  2024-02-13 17:29 ` Greg Kroah-Hartman
  2024-02-16 12:35 ` Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Fenghua Yu @ 2024-02-13 17:15 UTC (permalink / raw)
  To: Ricardo B. Marliere, Dave Jiang, Vinod Koul
  Cc: dmaengine, linux-kernel, Greg Kroah-Hartman



On 2/13/24 06:43, Ricardo B. Marliere wrote:
> Since commit d492cc2573a0 ("driver core: device.h: make struct
> bus_type a const *"), the driver core can properly handle constant
> struct bus_type, move the dsa_bus_type variable to be a constant

nit: s/, move/. Change/

> structure as well, placing it into read-only memory which can not be
> modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>

> ---
>   drivers/dma/idxd/bus.c  | 2 +-
>   drivers/dma/idxd/idxd.h | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/idxd/bus.c b/drivers/dma/idxd/bus.c
> index 0c9e689a2e77..b83b27e04f2a 100644
> --- a/drivers/dma/idxd/bus.c
> +++ b/drivers/dma/idxd/bus.c
> @@ -72,7 +72,7 @@ static int idxd_bus_uevent(const struct device *dev, struct kobj_uevent_env *env
>   	return add_uevent_var(env, "MODALIAS=" IDXD_DEVICES_MODALIAS_FMT, 0);
>   }
>   
> -struct bus_type dsa_bus_type = {
> +const struct bus_type dsa_bus_type = {
>   	.name = "dsa",
>   	.match = idxd_config_bus_match,
>   	.probe = idxd_config_bus_probe,
> diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
> index 47de3f93ff1e..f14a660a2a34 100644
> --- a/drivers/dma/idxd/idxd.h
> +++ b/drivers/dma/idxd/idxd.h
> @@ -516,7 +516,7 @@ static inline void idxd_set_user_intr(struct idxd_device *idxd, bool enable)
>   	iowrite32(reg.bits, idxd->reg_base + IDXD_GENCFG_OFFSET);
>   }
>   
> -extern struct bus_type dsa_bus_type;
> +extern const struct bus_type dsa_bus_type;
>   
>   extern bool support_enqcmd;
>   extern struct ida idxd_ida;
> 
> ---
> base-commit: de7d9cb3b064fdfb2e0e7706d14ffee20b762ad2
> change-id: 20240213-bus_cleanup-idxd-8feaf2af5461
> 
> Best regards,

Thanks.

-Fenghua

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

* Re: [PATCH] dmaengine: idxd: make dsa_bus_type const
  2024-02-13 14:43 [PATCH] dmaengine: idxd: make dsa_bus_type const Ricardo B. Marliere
  2024-02-13 15:40 ` Dave Jiang
  2024-02-13 17:15 ` Fenghua Yu
@ 2024-02-13 17:29 ` Greg Kroah-Hartman
  2024-02-16 12:35 ` Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2024-02-13 17:29 UTC (permalink / raw)
  To: Ricardo B. Marliere
  Cc: Fenghua Yu, Dave Jiang, Vinod Koul, dmaengine, linux-kernel

On Tue, Feb 13, 2024 at 11:43:15AM -0300, Ricardo B. Marliere wrote:
> Since commit d492cc2573a0 ("driver core: device.h: make struct
> bus_type a const *"), the driver core can properly handle constant
> struct bus_type, move the dsa_bus_type variable to be a constant
> structure as well, placing it into read-only memory which can not be
> modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] dmaengine: idxd: make dsa_bus_type const
  2024-02-13 14:43 [PATCH] dmaengine: idxd: make dsa_bus_type const Ricardo B. Marliere
                   ` (2 preceding siblings ...)
  2024-02-13 17:29 ` Greg Kroah-Hartman
@ 2024-02-16 12:35 ` Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2024-02-16 12:35 UTC (permalink / raw)
  To: Fenghua Yu, Dave Jiang, Ricardo B. Marliere
  Cc: dmaengine, linux-kernel, Greg Kroah-Hartman


On Tue, 13 Feb 2024 11:43:15 -0300, Ricardo B. Marliere wrote:
> Since commit d492cc2573a0 ("driver core: device.h: make struct
> bus_type a const *"), the driver core can properly handle constant
> struct bus_type, move the dsa_bus_type variable to be a constant
> structure as well, placing it into read-only memory which can not be
> modified at runtime.
> 
> 
> [...]

Applied, thanks!

[1/1] dmaengine: idxd: make dsa_bus_type const
      commit: cf497f3585f944ff42cc2c84453569f37a1bd6b9

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2024-02-16 12:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13 14:43 [PATCH] dmaengine: idxd: make dsa_bus_type const Ricardo B. Marliere
2024-02-13 15:40 ` Dave Jiang
2024-02-13 17:15 ` Fenghua Yu
2024-02-13 17:29 ` Greg Kroah-Hartman
2024-02-16 12:35 ` Vinod Koul

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