Skip to content

Commit 13f3cbf

Browse files
t-8chrafaeljw
authored andcommitted
thermal: int3400: Remove unneeded data_vault attribute_group
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@weissschuh.net> Link: https://patch.msgid.link/20241121-sysfs-const-bin_attr-int340x_thermal-v1-1-2436facf9dae@weissschuh.net Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 7082503 commit 13f3cbf

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ struct odvp_attr {
7575

7676
static BIN_ATTR_SIMPLE_RO(data_vault);
7777

78-
static struct bin_attribute *data_attributes[] = {
79-
&bin_attr_data_vault,
80-
NULL,
81-
};
82-
8378
static ssize_t imok_store(struct device *dev, struct device_attribute *attr,
8479
const char *buf, size_t count)
8580
{
@@ -108,10 +103,6 @@ static const struct attribute_group imok_attribute_group = {
108103
.attrs = imok_attr,
109104
};
110105

111-
static const struct attribute_group data_attribute_group = {
112-
.bin_attrs = data_attributes,
113-
};
114-
115106
static ssize_t available_uuids_show(struct device *dev,
116107
struct device_attribute *attr,
117108
char *buf)
@@ -624,8 +615,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
624615
}
625616

626617
if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
627-
result = sysfs_create_group(&pdev->dev.kobj,
628-
&data_attribute_group);
618+
result = device_create_bin_file(&pdev->dev, &bin_attr_data_vault);
629619
if (result)
630620
goto free_uuid;
631621
}
@@ -648,7 +638,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
648638
free_sysfs:
649639
cleanup_odvp(priv);
650640
if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
651-
sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
641+
device_remove_bin_file(&pdev->dev, &bin_attr_data_vault);
652642
kfree(priv->data_vault);
653643
}
654644
free_uuid:
@@ -683,7 +673,7 @@ static void int3400_thermal_remove(struct platform_device *pdev)
683673
acpi_thermal_rel_misc_device_remove(priv->adev->handle);
684674

685675
if (!ZERO_OR_NULL_PTR(priv->data_vault))
686-
sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
676+
device_remove_bin_file(&pdev->dev, &bin_attr_data_vault);
687677
sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
688678
sysfs_remove_group(&pdev->dev.kobj, &imok_attribute_group);
689679
thermal_zone_device_unregister(priv->thermal);

0 commit comments

Comments
 (0)