Skip to contentSkip to conversation

drivers: drm: struct bus_type cleanup

PATCH Applied Ricardo B. Marliere 4 participants 9 messages Feb 3, 2024 – Feb 7, 2024

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

cover drivers: drm: 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

To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Daniel Vetter <[email protected]>

---
Ricardo B. Marliere (2):
drm: display: make dp_aux_bus_type const
drm: mipi-dsi: make mipi_dsi_bus_type const

 drivers/gpu/drm/display/drm_dp_aux_bus.c | 2 +-
 drivers/gpu/drm/drm_mipi_dsi.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

---
base-commit: 3d94e7584486f7ac4a44fe215330ae6a1094e492
change-id: 20240203-bus_cleanup-gpu-0f90574bce24

Best regards,

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

PATCH 1/2 drm: display: make dp_aux_bus_type const

Now that the driver core can properly handle constant struct bus_type, move the dp_aux_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 drivers/gpu/drm/display/drm_dp_aux_bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/display/drm_dp_aux_bus.c +1 -1
index 8a165be1a821..5afc26be9d2a 100644
@@ -127,7 +127,7 @@ static void dp_aux_ep_shutdown(struct device *dev)
 		aux_ep_drv->shutdown(to_dp_aux_ep_dev(dev));
 }
 
-static struct bus_type dp_aux_bus_type = {
+static const struct bus_type dp_aux_bus_type = {
 	.name		= "dp-aux",
 	.match		= dp_aux_ep_match,
 	.probe		= dp_aux_ep_probe,
Signature · 1 line
2.43.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] drm: display: make dp_aux_bus_type const

Quoted 8 lines · Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type, move the dp_aux_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Quoted 3 lines
---
 drivers/gpu/drm/display/drm_dp_aux_bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw

Re: [PATCH 1/2] drm: display: make dp_aux_bus_type const

Quoted 11 lines · Dmitry Baryshkov
Quoted 8 lines · Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type, move the dp_aux_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Just to make sure this doesn't fall through cracks, I'm assuming you'll push this to drm-misc-next too, right?
-Sima

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#4 lore raw

Re: [PATCH 1/2] drm: display: make dp_aux_bus_type const

Quoted 8 lines · Daniel Vetter
Quoted 6 lines · Dmitry Baryshkov
Quoted 5 lines · Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type, move the dp_aux_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Just to make sure this doesn't fall through cracks, I'm assuming you'll push this to drm-misc-next too, right?

I was out at FOSDEM, now done.

Signature · 2 lines
With best wishes
Dmitry
#5 lore raw

PATCH 2/2 drm: mipi-dsi: make mipi_dsi_bus_type const

In reply to Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type, move the mipi_dsi_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_mipi_dsi.c +1 -1
index 843a6dbda93a..ef6e416522f8 100644
@@ -89,7 +89,7 @@ static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
 	.restore = pm_generic_restore,
 };
 
-static struct bus_type mipi_dsi_bus_type = {
+static const struct bus_type mipi_dsi_bus_type = {
 	.name = "mipi-dsi",
 	.match = mipi_dsi_device_match,
 	.uevent = mipi_dsi_uevent,
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] drm: mipi-dsi: make mipi_dsi_bus_type const

Quoted 11 lines · Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type, move the mipi_dsi_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on the v1 series
#7 lore raw
In reply to Ricardo B. Marliere
Quoted 19 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

To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Daniel Vetter <[email protected]>

Quoted 5 lines

---
Ricardo B. Marliere (2):
drm: display: make dp_aux_bus_type const
drm: mipi-dsi: make mipi_dsi_bus_type const

#8 lore raw
In reply to Ricardo B. Marliere
Quoted 5 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].

Applied to drm-misc-next, thanks!

[1/2] drm: display: make dp_aux_bus_type const

      commit: 78cb1f1d19b600ed288ed7ad1fd7b9378302cbc5
[2/2] drm: mipi-dsi: make mipi_dsi_bus_type const
      commit: 2c8ba564a42c7418a726367c73d7c88454848fdc

Best regards,

Signature · 1 line
Dmitry Baryshkov <[email protected]>