From f54dfdf7c625aad722a7d1508f99e8272bc4800c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 5 Jan 2022 18:56:50 +0100 Subject: firmware: memmap: use default_groups in kobj_type There are currently 2 ways to create a set of sysfs files for a kobj_type, through the default_attrs field, and the default_groups field. Move the firmware memmap sysfs code to use default_groups field which has been the preferred way since aa30f47cf666 ("kobject: Add support for default attribute groups to kobj_type") so that we can soon get rid of the obsolete default_attrs field. Link: https://lore.kernel.org/r/20220105175650.2640758-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/memmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/firmware') diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c index 24945e2da77b..8e59be3782cb 100644 --- a/drivers/firmware/memmap.c +++ b/drivers/firmware/memmap.c @@ -69,6 +69,7 @@ static struct attribute *def_attrs[] = { &memmap_type_attr.attr, NULL }; +ATTRIBUTE_GROUPS(def); static const struct sysfs_ops memmap_attr_ops = { .show = memmap_attr_show, @@ -118,7 +119,7 @@ static void __meminit release_firmware_map_entry(struct kobject *kobj) static struct kobj_type __refdata memmap_ktype = { .release = release_firmware_map_entry, .sysfs_ops = &memmap_attr_ops, - .default_attrs = def_attrs, + .default_groups = def_groups, }; /* -- cgit From ad8a5d1d2f577843dba14e4727c86e952ffbd5f1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 5 Jan 2022 19:31:33 +0100 Subject: qemu_fw_cfg: use default_groups in kobj_type There are currently 2 ways to create a set of sysfs files for a kobj_type, through the default_attrs field, and the default_groups field. Move the firmware qemu_fw_cfg sysfs code to use default_groups field which has been the preferred way since aa30f47cf666 ("kobject: Add support for default attribute groups to kobj_type") so that we can soon get rid of the obsolete default_attrs field. Cc: Gabriel Somlo Cc: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org Acked-by: Michael S. Tsirkin Link: https://lore.kernel.org/r/20220105183133.2812848-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/qemu_fw_cfg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/firmware') diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c index 172c751a4f6c..c62f05420d32 100644 --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c @@ -395,7 +395,7 @@ static void fw_cfg_sysfs_cache_cleanup(void) } } -/* default_attrs: per-entry attributes and show methods */ +/* per-entry attributes and show methods */ #define FW_CFG_SYSFS_ATTR(_attr) \ struct fw_cfg_sysfs_attribute fw_cfg_sysfs_attr_##_attr = { \ @@ -428,6 +428,7 @@ static struct attribute *fw_cfg_sysfs_entry_attrs[] = { &fw_cfg_sysfs_attr_name.attr, NULL, }; +ATTRIBUTE_GROUPS(fw_cfg_sysfs_entry); /* sysfs_ops: find fw_cfg_[entry, attribute] and call appropriate show method */ static ssize_t fw_cfg_sysfs_attr_show(struct kobject *kobj, struct attribute *a, @@ -454,7 +455,7 @@ static void fw_cfg_sysfs_release_entry(struct kobject *kobj) /* kobj_type: ties together all properties required to register an entry */ static struct kobj_type fw_cfg_sysfs_entry_ktype = { - .default_attrs = fw_cfg_sysfs_entry_attrs, + .default_groups = fw_cfg_sysfs_entry_groups, .sysfs_ops = &fw_cfg_sysfs_attr_ops, .release = fw_cfg_sysfs_release_entry, }; -- cgit From ab6d0f57be58c075bd249a97c81c3557b5e3e7cf Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 5 Jan 2022 19:17:19 +0100 Subject: firmware: dmi-sysfs: use default_groups in kobj_type There are currently 2 ways to create a set of sysfs files for a kobj_type, through the default_attrs field, and the default_groups field. Move the firmware dmi-sysfs sysfs code to use default_groups field which has been the preferred way since aa30f47cf666 ("kobject: Add support for default attribute groups to kobj_type") so that we can soon get rid of the obsolete default_attrs field. Link: https://lore.kernel.org/r/20220105181719.2737782-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/dmi-sysfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/firmware') diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c index 8b8127fa8955..3a353776bd34 100644 --- a/drivers/firmware/dmi-sysfs.c +++ b/drivers/firmware/dmi-sysfs.c @@ -302,12 +302,12 @@ static struct attribute *dmi_sysfs_sel_attrs[] = { &dmi_sysfs_attr_sel_per_log_type_descriptor_length.attr, NULL, }; - +ATTRIBUTE_GROUPS(dmi_sysfs_sel); static struct kobj_type dmi_system_event_log_ktype = { .release = dmi_entry_free, .sysfs_ops = &dmi_sysfs_specialize_attr_ops, - .default_attrs = dmi_sysfs_sel_attrs, + .default_groups = dmi_sysfs_sel_groups, }; typedef u8 (*sel_io_reader)(const struct dmi_system_event_log *sel, @@ -518,6 +518,7 @@ static struct attribute *dmi_sysfs_entry_attrs[] = { &dmi_sysfs_attr_entry_position.attr, NULL, }; +ATTRIBUTE_GROUPS(dmi_sysfs_entry); static ssize_t dmi_entry_raw_read_helper(struct dmi_sysfs_entry *entry, const struct dmi_header *dh, @@ -565,7 +566,7 @@ static void dmi_sysfs_entry_release(struct kobject *kobj) static struct kobj_type dmi_sysfs_entry_ktype = { .release = dmi_sysfs_entry_release, .sysfs_ops = &dmi_sysfs_attr_ops, - .default_attrs = dmi_sysfs_entry_attrs, + .default_groups = dmi_sysfs_entry_groups, }; static struct kset *dmi_kset; -- cgit From 3407d826c18d9aed3c51545cc26ff9a2fda65463 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 5 Jan 2022 19:26:34 +0100 Subject: firmware: edd: remove empty default_attrs array The default_attrs array of attributes for the edd sysfs entries is totally empty for some reason, and a list of attributes is added later after the object is created (which should be fixed up later as it's racy). Because this pointer is never used, and is empty, and we are trying to remove all default_attrs usages, just delete it. Link: https://lore.kernel.org/r/20220105182634.2802684-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/edd.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'drivers/firmware') diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c index 14d0970a7198..69353dd0ea22 100644 --- a/drivers/firmware/edd.c +++ b/drivers/firmware/edd.c @@ -574,14 +574,6 @@ static EDD_DEVICE_ATTR(interface, 0444, edd_show_interface, edd_has_edd30); static EDD_DEVICE_ATTR(host_bus, 0444, edd_show_host_bus, edd_has_edd30); static EDD_DEVICE_ATTR(mbr_signature, 0444, edd_show_mbr_signature, edd_has_mbr_signature); - -/* These are default attributes that are added for every edd - * device discovered. There are none. - */ -static struct attribute * def_attrs[] = { - NULL, -}; - /* These attributes are conditional and only added for some devices. */ static struct edd_attribute * edd_attrs[] = { &edd_attr_raw_data, @@ -619,7 +611,6 @@ static void edd_release(struct kobject * kobj) static struct kobj_type edd_ktype = { .release = edd_release, .sysfs_ops = &edd_attr_ops, - .default_attrs = def_attrs, }; static struct kset *edd_kset; -- cgit From 0589e8889dce8e0f0ea5bbf757f38865e2a469c1 Mon Sep 17 00:00:00 2001 From: Miaoqian Lin Date: Fri, 31 Dec 2021 08:04:25 +0000 Subject: drivers/firmware: Add missing platform_device_put() in sysfb_create_simplefb Add the missing platform_device_put() before return from sysfb_create_simplefb() in the error handling case. Fixes: 8633ef82f101 ("drivers/firmware: consolidate EFI framebuffer setup for all arches") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20211231080431.15385-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/sysfb_simplefb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/firmware') diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c index b86761904949..303a491e520d 100644 --- a/drivers/firmware/sysfb_simplefb.c +++ b/drivers/firmware/sysfb_simplefb.c @@ -113,12 +113,16 @@ __init int sysfb_create_simplefb(const struct screen_info *si, sysfb_apply_efi_quirks(pd); ret = platform_device_add_resources(pd, &res, 1); - if (ret) + if (ret) { + platform_device_put(pd); return ret; + } ret = platform_device_add_data(pd, mode, sizeof(*mode)); - if (ret) + if (ret) { + platform_device_put(pd); return ret; + } return platform_device_add(pd); } -- cgit