[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jEEAidAEn4C6eb0ShG06+UQRaYhsFCF9uOiMuO-Gn3Jg@mail.gmail.com>
Date: Mon, 25 Nov 2024 15:10:28 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Thomas Weißschuh <linux@...ssschuh.net>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Daniel Lezcano <daniel.lezcano@...aro.org>,
Zhang Rui <rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] thermal: int3400: Remove unneeded data_vault attribute_group
On Thu, Nov 21, 2024 at 5:29 PM Thomas Weißschuh <linux@...ssschuh.net> wrote:
>
> The group only contains a single entry and the conditionals around its
> lifecycle make clear that this won't change.
> Remove the unnecessary group.
>
> This saves some memory and it's easier to read.
> The removal of a non-const bin_attribute[] instance is also a
> preparation for the constification of struct bin_attributes.
>
> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
> ---
> drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 16 +++-------------
> 1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index b0c0f0ffdcb046607b4478390f39a77ae316a511..558a08f1727fc48c37181f8d345e236f879dab27 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -75,11 +75,6 @@ struct odvp_attr {
>
> static BIN_ATTR_SIMPLE_RO(data_vault);
>
> -static struct bin_attribute *data_attributes[] = {
> - &bin_attr_data_vault,
> - NULL,
> -};
> -
> static ssize_t imok_store(struct device *dev, struct device_attribute *attr,
> const char *buf, size_t count)
> {
> @@ -108,10 +103,6 @@ static const struct attribute_group imok_attribute_group = {
> .attrs = imok_attr,
> };
>
> -static const struct attribute_group data_attribute_group = {
> - .bin_attrs = data_attributes,
> -};
> -
> static ssize_t available_uuids_show(struct device *dev,
> struct device_attribute *attr,
> char *buf)
> @@ -624,8 +615,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
> }
>
> if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
> - result = sysfs_create_group(&pdev->dev.kobj,
> - &data_attribute_group);
> + result = device_create_bin_file(&pdev->dev, &bin_attr_data_vault);
> if (result)
> goto free_uuid;
> }
> @@ -648,7 +638,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
> free_sysfs:
> cleanup_odvp(priv);
> if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
> - sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
> + device_remove_bin_file(&pdev->dev, &bin_attr_data_vault);
> kfree(priv->data_vault);
> }
> free_uuid:
> @@ -683,7 +673,7 @@ static void int3400_thermal_remove(struct platform_device *pdev)
> acpi_thermal_rel_misc_device_remove(priv->adev->handle);
>
> if (!ZERO_OR_NULL_PTR(priv->data_vault))
> - sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
> + device_remove_bin_file(&pdev->dev, &bin_attr_data_vault);
> sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
> sysfs_remove_group(&pdev->dev.kobj, &imok_attribute_group);
> thermal_zone_device_unregister(priv->thermal);
>
> ---
Applied as 6.13-rc material, thanks!
Powered by blists - more mailing lists