2023-02-07 16:41:18

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH 0/3] platform/x86: Make kobj_type structures constant

Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definitions to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
Thomas Weißschuh (3):
platform/x86: dell-wmi-sysman: Make kobj_type structure constant
platform/x86: think-lmi: Make kobj_type structure constant
x86/platform/uv: Make kobj_type structure constant

drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
drivers/platform/x86/think-lmi.c | 4 ++--
drivers/platform/x86/uv_sysfs.c | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
---
base-commit: d2d11f342b179f1894a901f143ec7c008caba43e
change-id: 20230207-kobj_type-pdx86-2c60e36c63db

Best regards,
--
Thomas Weißschuh <[email protected]>



2023-02-07 16:41:21

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH 1/3] platform/x86: dell-wmi-sysman: Make kobj_type structure constant

Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definition to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
index 0a6411a8a104..0285b47d99d1 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
@@ -255,7 +255,7 @@ static void attr_name_release(struct kobject *kobj)
kfree(kobj);
}

-static struct kobj_type attr_name_ktype = {
+static const struct kobj_type attr_name_ktype = {
.release = attr_name_release,
.sysfs_ops = &wmi_sysman_kobj_sysfs_ops,
};

--
2.39.1


2023-02-10 16:26:00

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH 0/3] platform/x86: Make kobj_type structures constant

Hi,

On 2/7/23 17:40, Thomas Weißschuh wrote:
> Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
> the driver core allows the usage of const struct kobj_type.
>
> Take advantage of this to constify the structure definitions to prevent
> modification at runtime.
>
> Signed-off-by: Thomas Weißschuh <[email protected]>

Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> ---
> Thomas Weißschuh (3):
> platform/x86: dell-wmi-sysman: Make kobj_type structure constant
> platform/x86: think-lmi: Make kobj_type structure constant
> x86/platform/uv: Make kobj_type structure constant
>
> drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
> drivers/platform/x86/think-lmi.c | 4 ++--
> drivers/platform/x86/uv_sysfs.c | 6 +++---
> 3 files changed, 6 insertions(+), 6 deletions(-)
> ---
> base-commit: d2d11f342b179f1894a901f143ec7c008caba43e
> change-id: 20230207-kobj_type-pdx86-2c60e36c63db
>
> Best regards,