linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] platform/x86: Make kobj_type structures constant
@ 2023-02-07 16:40 Thomas Weißschuh
  2023-02-07 16:40 ` [PATCH 1/3] platform/x86: dell-wmi-sysman: Make kobj_type structure constant Thomas Weißschuh
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2023-02-07 16:40 UTC (permalink / raw)
  To: Divya Bharathi, Prasanth Ksr, Hans de Goede, Mark Gross,
	Mark Pearson, Justin Ernst
  Cc: Dell.Client.Kernel, platform-driver-x86, linux-kernel,
	Thomas Weißschuh

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 <linux@weissschuh.net>
---
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 <linux@weissschuh.net>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] platform/x86: dell-wmi-sysman: Make kobj_type structure constant
  2023-02-07 16:40 [PATCH 0/3] platform/x86: Make kobj_type structures constant Thomas Weißschuh
@ 2023-02-07 16:40 ` Thomas Weißschuh
  2023-02-07 16:40 ` [PATCH 2/3] platform/x86: think-lmi: " Thomas Weißschuh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2023-02-07 16:40 UTC (permalink / raw)
  To: Divya Bharathi, Prasanth Ksr, Hans de Goede, Mark Gross,
	Mark Pearson, Justin Ernst
  Cc: Dell.Client.Kernel, platform-driver-x86, linux-kernel,
	Thomas Weißschuh

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 <linux@weissschuh.net>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] platform/x86: think-lmi: Make kobj_type structure constant
  2023-02-07 16:40 [PATCH 0/3] platform/x86: Make kobj_type structures constant Thomas Weißschuh
  2023-02-07 16:40 ` [PATCH 1/3] platform/x86: dell-wmi-sysman: Make kobj_type structure constant Thomas Weißschuh
@ 2023-02-07 16:40 ` Thomas Weißschuh
  2023-02-07 16:40 ` [PATCH 3/3] x86/platform/uv: " Thomas Weißschuh
  2023-02-10 16:25 ` [PATCH 0/3] platform/x86: Make kobj_type structures constant Hans de Goede
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2023-02-07 16:40 UTC (permalink / raw)
  To: Divya Bharathi, Prasanth Ksr, Hans de Goede, Mark Gross,
	Mark Pearson, Justin Ernst
  Cc: Dell.Client.Kernel, platform-driver-x86, linux-kernel,
	Thomas Weißschuh

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 <linux@weissschuh.net>
---
 drivers/platform/x86/think-lmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index a01a92769c1a..b616e4501cb2 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -1089,12 +1089,12 @@ static void tlmi_pwd_setting_release(struct kobject *kobj)
 	kfree(setting);
 }
 
-static struct kobj_type tlmi_attr_setting_ktype = {
+static const struct kobj_type tlmi_attr_setting_ktype = {
 	.release        = &tlmi_attr_setting_release,
 	.sysfs_ops	= &tlmi_kobj_sysfs_ops,
 };
 
-static struct kobj_type tlmi_pwd_setting_ktype = {
+static const struct kobj_type tlmi_pwd_setting_ktype = {
 	.release        = &tlmi_pwd_setting_release,
 	.sysfs_ops	= &tlmi_kobj_sysfs_ops,
 };

-- 
2.39.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] x86/platform/uv: Make kobj_type structure constant
  2023-02-07 16:40 [PATCH 0/3] platform/x86: Make kobj_type structures constant Thomas Weißschuh
  2023-02-07 16:40 ` [PATCH 1/3] platform/x86: dell-wmi-sysman: Make kobj_type structure constant Thomas Weißschuh
  2023-02-07 16:40 ` [PATCH 2/3] platform/x86: think-lmi: " Thomas Weißschuh
@ 2023-02-07 16:40 ` Thomas Weißschuh
  2023-02-07 19:48   ` Ernst, Justin
  2023-02-10 16:25 ` [PATCH 0/3] platform/x86: Make kobj_type structures constant Hans de Goede
  3 siblings, 1 reply; 6+ messages in thread
From: Thomas Weißschuh @ 2023-02-07 16:40 UTC (permalink / raw)
  To: Divya Bharathi, Prasanth Ksr, Hans de Goede, Mark Gross,
	Mark Pearson, Justin Ernst
  Cc: Dell.Client.Kernel, platform-driver-x86, linux-kernel,
	Thomas Weißschuh

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 <linux@weissschuh.net>
---
 drivers/platform/x86/uv_sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
index 73fc38ee7430..38d1b692d3c0 100644
--- a/drivers/platform/x86/uv_sysfs.c
+++ b/drivers/platform/x86/uv_sysfs.c
@@ -203,7 +203,7 @@ static const struct sysfs_ops hub_sysfs_ops = {
 	.show = hub_type_show,
 };
 
-static struct kobj_type hub_attr_type = {
+static const struct kobj_type hub_attr_type = {
 	.release	= hub_release,
 	.sysfs_ops	= &hub_sysfs_ops,
 	.default_groups	= uv_hub_groups,
@@ -356,7 +356,7 @@ static const struct sysfs_ops uv_port_sysfs_ops = {
 	.show = uv_port_type_show,
 };
 
-static struct kobj_type uv_port_attr_type = {
+static const struct kobj_type uv_port_attr_type = {
 	.release	= uv_port_release,
 	.sysfs_ops	= &uv_port_sysfs_ops,
 	.default_groups	= uv_port_groups,
@@ -528,7 +528,7 @@ static const struct sysfs_ops uv_pci_top_sysfs_ops = {
 	.show = pci_top_type_show,
 };
 
-static struct kobj_type uv_pci_top_attr_type = {
+static const struct kobj_type uv_pci_top_attr_type = {
 	.release	= uv_pci_top_release,
 	.sysfs_ops	= &uv_pci_top_sysfs_ops,
 };

-- 
2.39.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH 3/3] x86/platform/uv: Make kobj_type structure constant
  2023-02-07 16:40 ` [PATCH 3/3] x86/platform/uv: " Thomas Weißschuh
@ 2023-02-07 19:48   ` Ernst, Justin
  0 siblings, 0 replies; 6+ messages in thread
From: Ernst, Justin @ 2023-02-07 19:48 UTC (permalink / raw)
  To: Thomas Weißschuh, Divya Bharathi, Prasanth Ksr,
	Hans de Goede, Mark Gross, Mark Pearson
  Cc: Dell.Client.Kernel, platform-driver-x86, linux-kernel

> 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 <linux@weissschuh.net>

Looks good. Thanks for the patch!

Reviewed-by: Justin Ernst <justin.ernst@hpe.com>

> ---
>  drivers/platform/x86/uv_sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
> index 73fc38ee7430..38d1b692d3c0 100644
> --- a/drivers/platform/x86/uv_sysfs.c
> +++ b/drivers/platform/x86/uv_sysfs.c
> @@ -203,7 +203,7 @@ static const struct sysfs_ops hub_sysfs_ops = {
>  	.show = hub_type_show,
>  };
> 
> -static struct kobj_type hub_attr_type = {
> +static const struct kobj_type hub_attr_type = {
>  	.release	= hub_release,
>  	.sysfs_ops	= &hub_sysfs_ops,
>  	.default_groups	= uv_hub_groups,
> @@ -356,7 +356,7 @@ static const struct sysfs_ops uv_port_sysfs_ops = {
>  	.show = uv_port_type_show,
>  };
> 
> -static struct kobj_type uv_port_attr_type = {
> +static const struct kobj_type uv_port_attr_type = {
>  	.release	= uv_port_release,
>  	.sysfs_ops	= &uv_port_sysfs_ops,
>  	.default_groups	= uv_port_groups,
> @@ -528,7 +528,7 @@ static const struct sysfs_ops uv_pci_top_sysfs_ops = {
>  	.show = pci_top_type_show,
>  };
> 
> -static struct kobj_type uv_pci_top_attr_type = {
> +static const struct kobj_type uv_pci_top_attr_type = {
>  	.release	= uv_pci_top_release,
>  	.sysfs_ops	= &uv_pci_top_sysfs_ops,
>  };
> 
> --
> 2.39.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] platform/x86: Make kobj_type structures constant
  2023-02-07 16:40 [PATCH 0/3] platform/x86: Make kobj_type structures constant Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2023-02-07 16:40 ` [PATCH 3/3] x86/platform/uv: " Thomas Weißschuh
@ 2023-02-10 16:25 ` Hans de Goede
  3 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2023-02-10 16:25 UTC (permalink / raw)
  To: Thomas Weißschuh, Divya Bharathi, Prasanth Ksr, Mark Gross,
	Mark Pearson, Justin Ernst
  Cc: Dell.Client.Kernel, platform-driver-x86, linux-kernel

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 <linux@weissschuh.net>

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,


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-10 16:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 16:40 [PATCH 0/3] platform/x86: Make kobj_type structures constant Thomas Weißschuh
2023-02-07 16:40 ` [PATCH 1/3] platform/x86: dell-wmi-sysman: Make kobj_type structure constant Thomas Weißschuh
2023-02-07 16:40 ` [PATCH 2/3] platform/x86: think-lmi: " Thomas Weißschuh
2023-02-07 16:40 ` [PATCH 3/3] x86/platform/uv: " Thomas Weißschuh
2023-02-07 19:48   ` Ernst, Justin
2023-02-10 16:25 ` [PATCH 0/3] platform/x86: Make kobj_type structures constant Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).