2024-02-03 18:38:49

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 0/3] drivers: scsi: struct bus_type cleanup

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 <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>

---
Ricardo B. Marliere (3):
scsi: fcoe: make fcoe_bus_type const
scsi: iscsi: make iscsi_flashnode_bus const
scsi: scsi_debug: make pseudo_lld_bus const

drivers/scsi/fcoe/fcoe_sysfs.c | 4 ++--
drivers/scsi/scsi_debug.c | 4 ++--
drivers/scsi/scsi_transport_iscsi.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
---
base-commit: 890d900e7fec7f7956c26bd47b4f0f07a0a507b1
change-id: 20240203-bus_cleanup-scsi-7c22edb73af4

Best regards,
--
Ricardo B. Marliere <[email protected]>



2024-02-03 18:39:07

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 1/3] scsi: fcoe: make fcoe_bus_type const

Now that the driver core can properly handle constant struct bus_type,
move the fcoe_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 <[email protected]>
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
drivers/scsi/fcoe/fcoe_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index c64a085a7ee2..453665ac6020 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -597,7 +597,7 @@ static const struct attribute_group *fcoe_fcf_attr_groups[] = {
NULL,
};

-static struct bus_type fcoe_bus_type;
+static const struct bus_type fcoe_bus_type;

static int fcoe_bus_match(struct device *dev,
struct device_driver *drv)
@@ -664,7 +664,7 @@ static struct attribute *fcoe_bus_attrs[] = {
};
ATTRIBUTE_GROUPS(fcoe_bus);

-static struct bus_type fcoe_bus_type = {
+static const struct bus_type fcoe_bus_type = {
.name = "fcoe",
.match = &fcoe_bus_match,
.bus_groups = fcoe_bus_groups,

--
2.43.0


2024-02-03 18:39:26

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 2/3] scsi: iscsi: make iscsi_flashnode_bus const

Now that the driver core can properly handle constant struct bus_type,
move the iscsi_flashnode_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 <[email protected]>
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
drivers/scsi/scsi_transport_iscsi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 3075b2ddf7a6..af3ac6346796 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1201,7 +1201,7 @@ static const struct device_type iscsi_flashnode_conn_dev_type = {
.release = iscsi_flashnode_conn_release,
};

-static struct bus_type iscsi_flashnode_bus;
+static const struct bus_type iscsi_flashnode_bus;

int iscsi_flashnode_bus_match(struct device *dev,
struct device_driver *drv)
@@ -1212,7 +1212,7 @@ int iscsi_flashnode_bus_match(struct device *dev,
}
EXPORT_SYMBOL_GPL(iscsi_flashnode_bus_match);

-static struct bus_type iscsi_flashnode_bus = {
+static const struct bus_type iscsi_flashnode_bus = {
.name = "iscsi_flashnode",
.match = &iscsi_flashnode_bus_match,
};

--
2.43.0


2024-02-03 18:39:45

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 3/3] scsi: scsi_debug: make pseudo_lld_bus const

Now that the driver core can properly handle constant struct bus_type,
move the pseudo_lld_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 <[email protected]>
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
drivers/scsi/scsi_debug.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index d03d66f11493..914d9c12e741 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -899,7 +899,7 @@ static int poll_queues; /* iouring iopoll interface.*/
static char sdebug_proc_name[] = MY_NAME;
static const char *my_name = MY_NAME;

-static struct bus_type pseudo_lld_bus;
+static const struct bus_type pseudo_lld_bus;

static struct device_driver sdebug_driverfs_driver = {
.name = sdebug_proc_name,
@@ -8405,7 +8405,7 @@ static void sdebug_driver_remove(struct device *dev)
scsi_host_put(sdbg_host->shost);
}

-static struct bus_type pseudo_lld_bus = {
+static const struct bus_type pseudo_lld_bus = {
.name = "pseudo",
.probe = sdebug_driver_probe,
.remove = sdebug_driver_remove,

--
2.43.0


2024-02-03 21:13:12

by Lee Duncan

[permalink] [raw]
Subject: Re: [PATCH 2/3] scsi: iscsi: make iscsi_flashnode_bus const

On Sat, Feb 3, 2024 at 10:38 AM Ricardo B. Marliere
<[email protected]> wrote:
>
> Now that the driver core can properly handle constant struct bus_type,
> move the iscsi_flashnode_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 <[email protected]>
> Suggested-by: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>
> ---
> drivers/scsi/scsi_transport_iscsi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 3075b2ddf7a6..af3ac6346796 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -1201,7 +1201,7 @@ static const struct device_type iscsi_flashnode_conn_dev_type = {
> .release = iscsi_flashnode_conn_release,
> };
>
> -static struct bus_type iscsi_flashnode_bus;
> +static const struct bus_type iscsi_flashnode_bus;
>
> int iscsi_flashnode_bus_match(struct device *dev,
> struct device_driver *drv)
> @@ -1212,7 +1212,7 @@ int iscsi_flashnode_bus_match(struct device *dev,
> }
> EXPORT_SYMBOL_GPL(iscsi_flashnode_bus_match);
>
> -static struct bus_type iscsi_flashnode_bus = {
> +static const struct bus_type iscsi_flashnode_bus = {
> .name = "iscsi_flashnode",
> .match = &iscsi_flashnode_bus_match,
> };
>
> --
> 2.43.0
>

Reviewed-by: Lee Duncan <[email protected]>

2024-02-03 21:23:22

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 0/3] drivers: scsi: struct bus_type cleanup

On Sat, Feb 03, 2024 at 03:38: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 <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>


Reviewed-by: Greg Kroah-Hartman <[email protected]>

2024-02-06 02:01:19

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/3] drivers: scsi: struct bus_type cleanup


Ricardo,

> 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].

Applied to 6.9/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering

2024-02-13 01:58:06

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/3] drivers: scsi: struct bus_type cleanup

On Sat, 03 Feb 2024 15:38:59 -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].
>

Applied to 6.9/scsi-queue, thanks!

[1/3] scsi: fcoe: make fcoe_bus_type const
https://git.kernel.org/mkp/scsi/c/4dbde797b946
[2/3] scsi: iscsi: make iscsi_flashnode_bus const
https://git.kernel.org/mkp/scsi/c/824ec98b1b55
[3/3] scsi: scsi_debug: make pseudo_lld_bus const
https://git.kernel.org/mkp/scsi/c/ac0dd0f33adb

--
Martin K. Petersen Oracle Linux Engineering