From: Armin Wolf <W_Armin@gmx.de>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Mark Pearson" <markpearson@lenovo.com>,
"Jorge Lopez" <jorge.lopez2@hp.com>,
"Prasanth Ksr" <prasanth.ksr@dell.com>
Cc: Joshua Grisham <josh@joshuagrisham.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, Dell.Client.Kernel@dell.com
Subject: Re: [PATCH 1/6] platform/x86: firmware_attributes_class: Move include linux/device/class.h
Date: Sat, 4 Jan 2025 07:55:15 +0100 [thread overview]
Message-ID: <119c9e8a-6797-4774-bb08-9f911b6a8243@gmx.de> (raw)
In-Reply-To: <20250104-firmware-attributes-simplify-v1-1-949f9709e405@weissschuh.net>
Am 04.01.25 um 00:05 schrieb Thomas Weißschuh:
> The header firmware_attributes_class.h uses 'struct class'. It should
> also include the necessary dependency header.
Hi,
i like this patch series, but i would prefer that we do not expose the raw class through the header.
Looking at the callers of fw_attributes_class_get(), everywhere the class value is used only to call:
device_create(fw_attr_class, NULL, MKDEV(0, 0), NULL, "%s", <driver name>);
I suggest that we introduce two new functions for that:
struct device *firmware_attributes_device_register(struct device *parent, const char *name);
void firmware_attributes_device_unregister(struct device *dev);
This would have three major benefits:
- the raw class can be made internal
- reduced code size
- drivers would stop copying the flawed use of device_destroy()
Regarding the use of device_destroy(): this is actually an error since device_destroy() cannot be
reliably used when devt is not unique. Since all those drivers are setting devt to MKDEV(0, 0) this
could result in a kernel panic should multiple firmware-attribute class devices exist at the same time.
What do you think?
Thanks,
Armin Wolf
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> drivers/platform/x86/firmware_attributes_class.c | 1 -
> drivers/platform/x86/firmware_attributes_class.h | 2 ++
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/firmware_attributes_class.c b/drivers/platform/x86/firmware_attributes_class.c
> index 182a07d8ae3dfa8925bb5b71a43d0219c3cf0fa0..cbc56e5db59283ba99ac0b915ac5fb2432afbdc9 100644
> --- a/drivers/platform/x86/firmware_attributes_class.c
> +++ b/drivers/platform/x86/firmware_attributes_class.c
> @@ -3,7 +3,6 @@
> /* Firmware attributes class helper module */
>
> #include <linux/mutex.h>
> -#include <linux/device/class.h>
> #include <linux/module.h>
> #include "firmware_attributes_class.h"
>
> diff --git a/drivers/platform/x86/firmware_attributes_class.h b/drivers/platform/x86/firmware_attributes_class.h
> index 363c75f1ac1b89df879a8689b070e6b11d3bb7fd..8e0f47cfdf92eb4dc8722b7d8371916af0d84efa 100644
> --- a/drivers/platform/x86/firmware_attributes_class.h
> +++ b/drivers/platform/x86/firmware_attributes_class.h
> @@ -5,6 +5,8 @@
> #ifndef FW_ATTR_CLASS_H
> #define FW_ATTR_CLASS_H
>
> +#include <linux/device/class.h>
> +
> int fw_attributes_class_get(const struct class **fw_attr_class);
> int fw_attributes_class_put(void);
>
>
next prev parent reply other threads:[~2025-01-04 6:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 23:05 [PATCH 0/6] platform/x86: firmware_attributes_class: Simplify API Thomas Weißschuh
2025-01-03 23:05 ` [PATCH 1/6] platform/x86: firmware_attributes_class: Move include linux/device/class.h Thomas Weißschuh
2025-01-04 6:55 ` Armin Wolf [this message]
2025-01-04 7:06 ` Thomas Weißschuh
2025-01-04 7:20 ` Armin Wolf
2025-01-04 7:37 ` Armin Wolf
2025-01-03 23:05 ` [PATCH 2/6] platform/x86: firmware_attributes_class: Simplify API Thomas Weißschuh
2025-01-03 23:05 ` [PATCH 3/6] platform/x86: think-lmi: Directly use firmware_attributes_class Thomas Weißschuh
2025-01-03 23:05 ` [PATCH 4/6] platform/x86: hp-bioscfg: " Thomas Weißschuh
2025-01-03 23:05 ` [PATCH 5/6] platform/x86: dell-sysman: " Thomas Weißschuh
2025-01-03 23:05 ` [PATCH 6/6] platform/x86: firmware_attributes_class: Drop lifecycle functions Thomas Weißschuh
2025-01-04 5:37 ` [PATCH 0/6] platform/x86: firmware_attributes_class: Simplify API Mario Limonciello
2025-01-07 2:53 ` Mark Pearson
2025-01-08 11:11 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=119c9e8a-6797-4774-bb08-9f911b6a8243@gmx.de \
--to=w_armin@gmx.de \
--cc=Dell.Client.Kernel@dell.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jorge.lopez2@hp.com \
--cc=josh@joshuagrisham.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=markpearson@lenovo.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=prasanth.ksr@dell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®