2024-02-04 14:39:57

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 0/2] platform: x86: 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 (2):
platform: x86: wmi: make wmi_bus_type const
platform: x86: ibm_rtl: make rtl_subsys const

drivers/platform/x86/ibm_rtl.c | 2 +-
drivers/platform/x86/wmi.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 682c259a849610c7864cc75d52415c782c78653a
change-id: 20240204-bus_cleanup-platform-drivers-x86-40e6e6b4773a

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



2024-02-04 14:40:17

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 1/2] platform: x86: wmi: make wmi_bus_type const

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

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 7ef1e82dc61c..859dfff515d0 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -219,7 +219,7 @@ static int wmidev_match_guid(struct device *dev, const void *data)
return 0;
}

-static struct bus_type wmi_bus_type;
+static const struct bus_type wmi_bus_type;

static struct wmi_device *wmi_find_device_by_guid(const char *guid_string)
{
@@ -899,7 +899,7 @@ static struct class wmi_bus_class = {
.name = "wmi_bus",
};

-static struct bus_type wmi_bus_type = {
+static const struct bus_type wmi_bus_type = {
.name = "wmi",
.dev_groups = wmi_groups,
.match = wmi_dev_match,

--
2.43.0


2024-02-04 14:40:46

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 2/2] platform: x86: ibm_rtl: make rtl_subsys const

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

diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 2ab7d9ac542d..1d4bbae115f1 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -179,7 +179,7 @@ static ssize_t rtl_set_state(struct device *dev,
return ret;
}

-static struct bus_type rtl_subsys = {
+static const struct bus_type rtl_subsys = {
.name = "ibm_rtl",
.dev_name = "ibm_rtl",
};

--
2.43.0


2024-02-04 14:52:38

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 0/2] platform: x86: struct bus_type cleanup

On Sun, Feb 04, 2024 at 11:40:15AM -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-05 17:03:05

by Armin Wolf

[permalink] [raw]
Subject: Re: [PATCH 1/2] platform: x86: wmi: make wmi_bus_type const

Am 04.02.24 um 15:40 schrieb Ricardo B. Marliere:

> Now that the driver core can properly handle constant struct bus_type,
> move the wmi_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/platform/x86/wmi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 7ef1e82dc61c..859dfff515d0 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -219,7 +219,7 @@ static int wmidev_match_guid(struct device *dev, const void *data)
> return 0;
> }
>
> -static struct bus_type wmi_bus_type;
> +static const struct bus_type wmi_bus_type;
>
> static struct wmi_device *wmi_find_device_by_guid(const char *guid_string)
> {
> @@ -899,7 +899,7 @@ static struct class wmi_bus_class = {
> .name = "wmi_bus",
> };
>
> -static struct bus_type wmi_bus_type = {
> +static const struct bus_type wmi_bus_type = {
> .name = "wmi",
> .dev_groups = wmi_groups,
> .match = wmi_dev_match,
>
Reviewed-by: Armin Wolf <[email protected]>


2024-02-06 10:15:11

by Ilpo Järvinen

[permalink] [raw]
Subject: Re: [PATCH 0/2] platform: x86: struct bus_type cleanup

On Sun, 04 Feb 2024 11:40:15 -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].
>


Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/2] platform: x86: wmi: make wmi_bus_type const
commit: 10fdfd13a35994ac1dcc3003d4046cb1955e66a8
[2/2] platform: x86: ibm_rtl: make rtl_subsys const
commit: 41b43c75121208a9e4e84fd148f918bddb3f5d1f

--
i.