Skip to contentSkip to conversation

s390: struct bus_type cleanup

PATCH Applied Ricardo B. Marliere 7 participants 13 messages Feb 3, 2024 – Feb 6, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover 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

---
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,

Signature · 1 line
Ricardo B. Marliere <[email protected]>
#1 lore raw

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.

---
 drivers/s390/cio/ccwgroup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/ccwgroup.c +2 -2
index aa3292e57e38..6eb8bcd948dc 100644
@@ -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,
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/6 s390: cio: make css_bus_type const

In reply to Ricardo B. Marliere

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.

---
 drivers/s390/cio/css.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/css.c +2 -2
index 28a88ed2c3aa..094431a62ad5 100644
@@ -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,
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/6 s390: cio: make ccw_bus_type const

In reply to Ricardo B. Marliere

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.

---
 drivers/s390/cio/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/device.c +2 -2
index 0cfb179e1bcb..f95d12345d98 100644
@@ -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,
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/6 s390: cio: make scm_bus_type const

In reply to Ricardo B. Marliere

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.

---
 drivers/s390/cio/scm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/scm.c +1 -1
index 6b21ba68c1fe..375cbfa31b53 100644
@@ -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,
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/6 s390: AP: make ap_bus_type const

In reply to Ricardo B. Marliere

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.

---
 drivers/s390/crypto/ap_bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/crypto/ap_bus.c +2 -2
index f46dd6abacd7..2ecf4d36e78b 100644
@@ -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,
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 5/6
#6 lore raw

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

Quoted 25 lines · Ricardo B. Marliere

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.

---
 drivers/s390/crypto/ap_bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/crypto/ap_bus.c +1 -1
index f46dd6abacd7..2ecf4d36e78b 100644
@@ -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,

drivers/s390/crypto/ap_bus.c static struct attribute *ap_bus_attrs[] = { · line 1609

Quoted 8 lines
drivers/s390/crypto/ap_bus.c +1 -1
@@ -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,
#7 lore raw

PATCH 6/6 s390: vfio-ap: make matrix_bus const

In reply to Ricardo B. Marliere

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.

---
 drivers/s390/crypto/vfio_ap_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/crypto/vfio_ap_drv.c +1 -1
index a5ab03e42ff1..4aeb3e1213c7 100644
@@ -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",
 };
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 6/6
#8 lore raw

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

Quoted 17 lines · Ricardo B. Marliere

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.

---
  drivers/s390/crypto/vfio_ap_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/crypto/vfio_ap_drv.c +0 -0
index a5ab03e42ff1..4aeb3e1213c7 100644

drivers/s390/crypto/vfio_ap_drv.c static void vfio_ap_matrix_dev_release(struct device *dev) · line 66

Quoted 8 lines
drivers/s390/crypto/vfio_ap_drv.c +1 -1
@@ -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",
  };
 
maintainer Reviewed-by on v1 6/6
#9 lore raw

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

In reply to Ricardo B. Marliere
Quoted 25 lines · Ricardo B. Marliere

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.

---
  drivers/s390/crypto/vfio_ap_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/crypto/vfio_ap_drv.c +1 -1
index a5ab03e42ff1..4aeb3e1213c7 100644
@@ -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",
  };
 
maintainer Acked-by on v1 6/6
#10 lore raw

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

In reply to Ricardo B. Marliere
Quoted 7 lines · On Sat, 03 Feb 2024 11:58:03 -0300 "Ricardo B. Marliere"…

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.

Reviewed-by on the v1 series
#11 lore raw
In reply to Ricardo B. Marliere
Quoted 10 lines · 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

Thanks for doing this!

maintainer Applied
#12 lore raw
In reply to Ricardo B. Marliere
Quoted 20 lines · 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

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

Quoted 7 lines
 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!