linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/sysfs: Make kobj_type structure constant
@ 2023-02-16  1:12 Thomas Weißschuh
  2023-02-16 18:01 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2023-02-16  1:12 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, 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/pci/slot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
index a0c67191a8b9..0f87cade10f7 100644
--- a/drivers/pci/slot.c
+++ b/drivers/pci/slot.c
@@ -98,7 +98,7 @@ static struct attribute *pci_slot_default_attrs[] = {
 };
 ATTRIBUTE_GROUPS(pci_slot_default);
 
-static struct kobj_type pci_slot_ktype = {
+static const struct kobj_type pci_slot_ktype = {
 	.sysfs_ops = &pci_slot_sysfs_ops,
 	.release = &pci_slot_release,
 	.default_groups = pci_slot_default_groups,

---
base-commit: 033c40a89f55525139fd5b6342281b09b97d05bf
change-id: 20230216-kobj_type-pci-56120c1c0bcb

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


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

* Re: [PATCH] PCI/sysfs: Make kobj_type structure constant
  2023-02-16  1:12 [PATCH] PCI/sysfs: Make kobj_type structure constant Thomas Weißschuh
@ 2023-02-16 18:01 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2023-02-16 18:01 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: Bjorn Helgaas, linux-pci, linux-kernel

On Thu, Feb 16, 2023 at 01:12:25AM +0000, 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 definition to prevent
> modification at runtime.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Applied to pci/misc for v6.13, thanks, Thomas!

> ---
>  drivers/pci/slot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
> index a0c67191a8b9..0f87cade10f7 100644
> --- a/drivers/pci/slot.c
> +++ b/drivers/pci/slot.c
> @@ -98,7 +98,7 @@ static struct attribute *pci_slot_default_attrs[] = {
>  };
>  ATTRIBUTE_GROUPS(pci_slot_default);
>  
> -static struct kobj_type pci_slot_ktype = {
> +static const struct kobj_type pci_slot_ktype = {
>  	.sysfs_ops = &pci_slot_sysfs_ops,
>  	.release = &pci_slot_release,
>  	.default_groups = pci_slot_default_groups,
> 
> ---
> base-commit: 033c40a89f55525139fd5b6342281b09b97d05bf
> change-id: 20230216-kobj_type-pci-56120c1c0bcb
> 
> Best regards,
> -- 
> Thomas Weißschuh <linux@weissschuh.net>
> 

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16  1:12 [PATCH] PCI/sysfs: Make kobj_type structure constant Thomas Weißschuh
2023-02-16 18:01 ` Bjorn Helgaas

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