2024-02-03 14:57:54

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 0/6] s390: 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

Signed-off-by: Ricardo B. Marliere <[email protected]>

---
Ricardo B. Marliere (6):
s390: ccwgroup: make ccwgroup_bus_type const
s390: cio: make css_bus_type const
s390: cio: make ccw_bus_type const
s390: cio: make scm_bus_type const
s390: AP: make ap_bus_type const
s390: vfio-ap: make matrix_bus const

drivers/s390/cio/ccwgroup.c | 4 ++--
drivers/s390/cio/css.c | 4 ++--
drivers/s390/cio/device.c | 4 ++--
drivers/s390/cio/scm.c | 2 +-
drivers/s390/crypto/ap_bus.c | 4 ++--
drivers/s390/crypto/vfio_ap_drv.c | 2 +-
6 files changed, 10 insertions(+), 10 deletions(-)
---
base-commit: 8eb3db95a8c8ecd6f8bb082a99ded3bbc79b023f
change-id: 20240203-bus_cleanup-s390-82062bb32b2f

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



2024-02-03 14:58:47

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 2/6] s390: cio: make css_bus_type const

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

diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 28a88ed2c3aa..094431a62ad5 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -39,7 +39,7 @@ int max_ssid;

#define MAX_CSS_IDX 0
struct channel_subsystem *channel_subsystems[MAX_CSS_IDX + 1];
-static struct bus_type css_bus_type;
+static const struct bus_type css_bus_type;

int
for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *data)
@@ -1409,7 +1409,7 @@ static int css_uevent(const struct device *dev, struct kobj_uevent_env *env)
return ret;
}

-static struct bus_type css_bus_type = {
+static const struct bus_type css_bus_type = {
.name = "css",
.match = css_bus_match,
.probe = css_probe,

--
2.43.0


2024-02-03 14:59:21

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 6/6] s390: vfio-ap: make matrix_bus const

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

diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
index a5ab03e42ff1..4aeb3e1213c7 100644
--- a/drivers/s390/crypto/vfio_ap_drv.c
+++ b/drivers/s390/crypto/vfio_ap_drv.c
@@ -60,7 +60,7 @@ static void vfio_ap_matrix_dev_release(struct device *dev)
kfree(matrix_dev);
}

-static struct bus_type matrix_bus = {
+static const struct bus_type matrix_bus = {
.name = "matrix",
};


--
2.43.0


2024-02-03 14:59:42

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 1/6] s390: ccwgroup: make ccwgroup_bus_type const

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

diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index aa3292e57e38..6eb8bcd948dc 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -31,7 +31,7 @@
* to devices that use multiple subchannels.
*/

-static struct bus_type ccwgroup_bus_type;
+static const struct bus_type ccwgroup_bus_type;

static void __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev)
{
@@ -465,7 +465,7 @@ static void ccwgroup_shutdown(struct device *dev)
gdrv->shutdown(gdev);
}

-static struct bus_type ccwgroup_bus_type = {
+static const struct bus_type ccwgroup_bus_type = {
.name = "ccwgroup",
.dev_groups = ccwgroup_dev_groups,
.remove = ccwgroup_remove,

--
2.43.0


2024-02-03 15:00:14

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 3/6] s390: cio: make ccw_bus_type const

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

diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 0cfb179e1bcb..f95d12345d98 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -49,7 +49,7 @@ static const unsigned long recovery_delay[] = { 3, 30, 300 };

static atomic_t ccw_device_init_count = ATOMIC_INIT(0);
static DECLARE_WAIT_QUEUE_HEAD(ccw_device_init_wq);
-static struct bus_type ccw_bus_type;
+static const struct bus_type ccw_bus_type;

/******************* bus type handling ***********************/

@@ -1776,7 +1776,7 @@ static void ccw_device_shutdown(struct device *dev)
__disable_cmf(cdev);
}

-static struct bus_type ccw_bus_type = {
+static const struct bus_type ccw_bus_type = {
.name = "ccw",
.match = ccw_bus_match,
.uevent = ccw_uevent,

--
2.43.0


2024-02-03 15:00:52

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 5/6] s390: AP: make ap_bus_type const

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

diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index f46dd6abacd7..2ecf4d36e78b 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -135,7 +135,7 @@ static int ap_max_domain_id = 15;
/* Maximum adapter id, if not given via qci */
static int ap_max_adapter_id = 63;

-static struct bus_type ap_bus_type;
+static const struct bus_type ap_bus_type;

/* Adapter interrupt definitions */
static void ap_interrupt_handler(struct airq_struct *airq,
@@ -1603,7 +1603,7 @@ static struct attribute *ap_bus_attrs[] = {
};
ATTRIBUTE_GROUPS(ap_bus);

-static struct bus_type ap_bus_type = {
+static const struct bus_type ap_bus_type = {
.name = "ap",
.bus_groups = ap_bus_groups,
.match = &ap_bus_match,

--
2.43.0


2024-02-03 15:06:15

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 4/6] s390: cio: make scm_bus_type const

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

diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c
index 6b21ba68c1fe..375cbfa31b53 100644
--- a/drivers/s390/cio/scm.c
+++ b/drivers/s390/cio/scm.c
@@ -42,7 +42,7 @@ static int scmdev_uevent(const struct device *dev, struct kobj_uevent_env *env)
return add_uevent_var(env, "MODALIAS=scm:scmdev");
}

-static struct bus_type scm_bus_type = {
+static const struct bus_type scm_bus_type = {
.name = "scm",
.probe = scmdev_probe,
.remove = scmdev_remove,

--
2.43.0


2024-02-03 15:57:57

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 0/6] s390: struct bus_type cleanup

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

Thanks for doing this!

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

2024-02-05 10:48:19

by Harald Freudenberger

[permalink] [raw]
Subject: Re: [PATCH 5/6] s390: AP: make ap_bus_type const

On 2024-02-03 15:58, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the ap_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/s390/crypto/ap_bus.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/s390/crypto/ap_bus.c
> b/drivers/s390/crypto/ap_bus.c
> index f46dd6abacd7..2ecf4d36e78b 100644
> --- a/drivers/s390/crypto/ap_bus.c
> +++ b/drivers/s390/crypto/ap_bus.c
> @@ -135,7 +135,7 @@ static int ap_max_domain_id = 15;
> /* Maximum adapter id, if not given via qci */
> static int ap_max_adapter_id = 63;
>
> -static struct bus_type ap_bus_type;
> +static const struct bus_type ap_bus_type;
>
> /* Adapter interrupt definitions */
> static void ap_interrupt_handler(struct airq_struct *airq,
> @@ -1603,7 +1603,7 @@ static struct attribute *ap_bus_attrs[] = {
> };
> ATTRIBUTE_GROUPS(ap_bus);
>
> -static struct bus_type ap_bus_type = {
> +static const struct bus_type ap_bus_type = {
> .name = "ap",
> .bus_groups = ap_bus_groups,
> .match = &ap_bus_match,

Reviewed-by: Harald Freudenberger <[email protected]>

2024-02-05 14:05:11

by Jason J. Herne

[permalink] [raw]
Subject: Re: [PATCH 6/6] s390: vfio-ap: make matrix_bus const

On 2/3/24 9:58 AM, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the matrix_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/s390/crypto/vfio_ap_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
> index a5ab03e42ff1..4aeb3e1213c7 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -60,7 +60,7 @@ static void vfio_ap_matrix_dev_release(struct device *dev)
> kfree(matrix_dev);
> }
>
> -static struct bus_type matrix_bus = {
> +static const struct bus_type matrix_bus = {
> .name = "matrix",
> };
>
>

Reviewed-by: Jason J. Herne <[email protected]>

2024-02-05 15:28:03

by Anthony Krowiak

[permalink] [raw]
Subject: Re: [PATCH 6/6] s390: vfio-ap: make matrix_bus const

Reviewed-by: Anthony Krowiak <[email protected]>

On 2/3/24 9:58 AM, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the matrix_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/s390/crypto/vfio_ap_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
> index a5ab03e42ff1..4aeb3e1213c7 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -60,7 +60,7 @@ static void vfio_ap_matrix_dev_release(struct device *dev)
> kfree(matrix_dev);
> }
>
> -static struct bus_type matrix_bus = {
> +static const struct bus_type matrix_bus = {
> .name = "matrix",
> };
>
>

2024-02-05 16:10:18

by Halil Pasic

[permalink] [raw]
Subject: Re: [PATCH 6/6] s390: vfio-ap: make matrix_bus const

On Sat, 03 Feb 2024 11:58:03 -0300
"Ricardo B. Marliere" <[email protected]> wrote:

> Now that the driver core can properly handle constant struct bus_type,
> move the matrix_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]>

Acked-by: Halil Pasic <[email protected]>

2024-02-06 08:31:23

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH 0/6] s390: struct bus_type cleanup

On Sat, Feb 03, 2024 at 11:57:57AM -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
>
> Signed-off-by: Ricardo B. Marliere <[email protected]>
>
> ---
> Ricardo B. Marliere (6):
> s390: ccwgroup: make ccwgroup_bus_type const
> s390: cio: make css_bus_type const
> s390: cio: make ccw_bus_type const
> s390: cio: make scm_bus_type const
> s390: AP: make ap_bus_type const
> s390: vfio-ap: make matrix_bus const
>
> drivers/s390/cio/ccwgroup.c | 4 ++--
> drivers/s390/cio/css.c | 4 ++--
> drivers/s390/cio/device.c | 4 ++--
> drivers/s390/cio/scm.c | 2 +-
> drivers/s390/crypto/ap_bus.c | 4 ++--
> drivers/s390/crypto/vfio_ap_drv.c | 2 +-
> 6 files changed, 10 insertions(+), 10 deletions(-)

Applied, thanks!