ntb.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ntb: struct bus_type cleanup
@ 2024-02-04 16:21 Ricardo B. Marliere
  2024-02-04 16:22 ` [PATCH 1/2] ntb: ntb_transport: make ntb_transport_bus const Ricardo B. Marliere
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ricardo B. Marliere @ 2024-02-04 16:21 UTC (permalink / raw)
  To: Jon Mason, Dave Jiang, Allen Hubbe
  Cc: ntb, linux-kernel, Greg Kroah-Hartman, Ricardo B. Marliere

This series is part of an effort to cleanup the users of the driver
core, as can be seen in many recent patches authored by Greg across the
tree (e.g. [1]). Specifically, this series is part of the task of
splitting one of his TODOs [2].

---
[1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=bus_cleanup&id=26105f537f0c60eacfeb430abd2e05d7ddcdd8aa

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

---
Ricardo B. Marliere (2):
      ntb: ntb_transport: make ntb_transport_bus const
      ntb: core: make ntb_bus const

 drivers/ntb/core.c          | 4 ++--
 drivers/ntb/ntb_transport.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 9341b37ec17a8793e8439e9b18354ba69556b786
change-id: 20240204-bus_cleanup-ntb-6038064ed198

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


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

* [PATCH 1/2] ntb: ntb_transport: make ntb_transport_bus const
  2024-02-04 16:21 [PATCH 0/2] ntb: struct bus_type cleanup Ricardo B. Marliere
@ 2024-02-04 16:22 ` Ricardo B. Marliere
  2024-02-05 17:23   ` Dave Jiang
  2024-02-04 16:22 ` [PATCH 2/2] ntb: core: make ntb_bus const Ricardo B. Marliere
  2024-02-05 12:49 ` [PATCH 0/2] ntb: struct bus_type cleanup Greg Kroah-Hartman
  2 siblings, 1 reply; 6+ messages in thread
From: Ricardo B. Marliere @ 2024-02-04 16:22 UTC (permalink / raw)
  To: Jon Mason, Dave Jiang, Allen Hubbe
  Cc: ntb, linux-kernel, Greg Kroah-Hartman, Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type,
move the ntb_transport_bus 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/ntb/ntb_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index f9e7847a378e..0291d80611dc 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -314,7 +314,7 @@ static void ntb_transport_bus_remove(struct device *dev)
 	put_device(dev);
 }
 
-static struct bus_type ntb_transport_bus = {
+static const struct bus_type ntb_transport_bus = {
 	.name = "ntb_transport",
 	.match = ntb_transport_bus_match,
 	.probe = ntb_transport_bus_probe,

-- 
2.43.0


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

* [PATCH 2/2] ntb: core: make ntb_bus const
  2024-02-04 16:21 [PATCH 0/2] ntb: struct bus_type cleanup Ricardo B. Marliere
  2024-02-04 16:22 ` [PATCH 1/2] ntb: ntb_transport: make ntb_transport_bus const Ricardo B. Marliere
@ 2024-02-04 16:22 ` Ricardo B. Marliere
  2024-02-05 17:24   ` Dave Jiang
  2024-02-05 12:49 ` [PATCH 0/2] ntb: struct bus_type cleanup Greg Kroah-Hartman
  2 siblings, 1 reply; 6+ messages in thread
From: Ricardo B. Marliere @ 2024-02-04 16:22 UTC (permalink / raw)
  To: Jon Mason, Dave Jiang, Allen Hubbe
  Cc: ntb, linux-kernel, Greg Kroah-Hartman, Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type,
move the ntb_bus 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/ntb/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ntb/core.c b/drivers/ntb/core.c
index 27dd93deff6e..f32b77c7e00d 100644
--- a/drivers/ntb/core.c
+++ b/drivers/ntb/core.c
@@ -72,7 +72,7 @@ MODULE_VERSION(DRIVER_VERSION);
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESCRIPTION);
 
-static struct bus_type ntb_bus;
+static const struct bus_type ntb_bus;
 static void ntb_dev_release(struct device *dev);
 
 int __ntb_register_client(struct ntb_client *client, struct module *mod,
@@ -292,7 +292,7 @@ static void ntb_dev_release(struct device *dev)
 	complete(&ntb->released);
 }
 
-static struct bus_type ntb_bus = {
+static const struct bus_type ntb_bus = {
 	.name = "ntb",
 	.probe = ntb_probe,
 	.remove = ntb_remove,

-- 
2.43.0


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

* Re: [PATCH 0/2] ntb: struct bus_type cleanup
  2024-02-04 16:21 [PATCH 0/2] ntb: struct bus_type cleanup Ricardo B. Marliere
  2024-02-04 16:22 ` [PATCH 1/2] ntb: ntb_transport: make ntb_transport_bus const Ricardo B. Marliere
  2024-02-04 16:22 ` [PATCH 2/2] ntb: core: make ntb_bus const Ricardo B. Marliere
@ 2024-02-05 12:49 ` Greg Kroah-Hartman
  2 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2024-02-05 12:49 UTC (permalink / raw)
  To: Ricardo B. Marliere; +Cc: Jon Mason, Dave Jiang, Allen Hubbe, ntb, linux-kernel

On Sun, Feb 04, 2024 at 01:21:59PM -0300, Ricardo B. Marliere wrote:
> This series is part of an effort to cleanup the users of the driver
> core, as can be seen in many recent patches authored by Greg across the
> tree (e.g. [1]). Specifically, this series is part of the task of
> splitting one of his TODOs [2].
> 
> ---
> [1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
> [2]: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=bus_cleanup&id=26105f537f0c60eacfeb430abd2e05d7ddcdd8aa
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> 
> ---
> Ricardo B. Marliere (2):
>       ntb: ntb_transport: make ntb_transport_bus const
>       ntb: core: make ntb_bus const

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

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

* Re: [PATCH 1/2] ntb: ntb_transport: make ntb_transport_bus const
  2024-02-04 16:22 ` [PATCH 1/2] ntb: ntb_transport: make ntb_transport_bus const Ricardo B. Marliere
@ 2024-02-05 17:23   ` Dave Jiang
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Jiang @ 2024-02-05 17:23 UTC (permalink / raw)
  To: Ricardo B. Marliere, Jon Mason, Allen Hubbe
  Cc: ntb, linux-kernel, Greg Kroah-Hartman



On 2/4/24 9:22 AM, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the ntb_transport_bus 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/ntb/ntb_transport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index f9e7847a378e..0291d80611dc 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -314,7 +314,7 @@ static void ntb_transport_bus_remove(struct device *dev)
>  	put_device(dev);
>  }
>  
> -static struct bus_type ntb_transport_bus = {
> +static const struct bus_type ntb_transport_bus = {
>  	.name = "ntb_transport",
>  	.match = ntb_transport_bus_match,
>  	.probe = ntb_transport_bus_probe,
> 

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

* Re: [PATCH 2/2] ntb: core: make ntb_bus const
  2024-02-04 16:22 ` [PATCH 2/2] ntb: core: make ntb_bus const Ricardo B. Marliere
@ 2024-02-05 17:24   ` Dave Jiang
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Jiang @ 2024-02-05 17:24 UTC (permalink / raw)
  To: Ricardo B. Marliere, Jon Mason, Allen Hubbe
  Cc: ntb, linux-kernel, Greg Kroah-Hartman



On 2/4/24 9:22 AM, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the ntb_bus 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/ntb/core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ntb/core.c b/drivers/ntb/core.c
> index 27dd93deff6e..f32b77c7e00d 100644
> --- a/drivers/ntb/core.c
> +++ b/drivers/ntb/core.c
> @@ -72,7 +72,7 @@ MODULE_VERSION(DRIVER_VERSION);
>  MODULE_AUTHOR(DRIVER_AUTHOR);
>  MODULE_DESCRIPTION(DRIVER_DESCRIPTION);
>  
> -static struct bus_type ntb_bus;
> +static const struct bus_type ntb_bus;
>  static void ntb_dev_release(struct device *dev);
>  
>  int __ntb_register_client(struct ntb_client *client, struct module *mod,
> @@ -292,7 +292,7 @@ static void ntb_dev_release(struct device *dev)
>  	complete(&ntb->released);
>  }
>  
> -static struct bus_type ntb_bus = {
> +static const struct bus_type ntb_bus = {
>  	.name = "ntb",
>  	.probe = ntb_probe,
>  	.remove = ntb_remove,
> 

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

end of thread, other threads:[~2024-02-05 19:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-04 16:21 [PATCH 0/2] ntb: struct bus_type cleanup Ricardo B. Marliere
2024-02-04 16:22 ` [PATCH 1/2] ntb: ntb_transport: make ntb_transport_bus const Ricardo B. Marliere
2024-02-05 17:23   ` Dave Jiang
2024-02-04 16:22 ` [PATCH 2/2] ntb: core: make ntb_bus const Ricardo B. Marliere
2024-02-05 17:24   ` Dave Jiang
2024-02-05 12:49 ` [PATCH 0/2] ntb: struct bus_type cleanup 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;
as well as URLs for NNTP newsgroup(s).