Skip to content

Commit a9c4cf2

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: sysfs: Use __ATTR_RO() and __ATTR_RW() macros
We have a few open-coded __ATTR_RO() and __ATTR_RW() macros. Replace the custom code with generic macros. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 44497fa commit a9c4cf2

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

drivers/acpi/sysfs.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -909,27 +909,22 @@ static void __exit interrupt_stats_exit(void)
909909
delete_gpe_attr_array();
910910
}
911911

912-
static ssize_t
913-
acpi_show_profile(struct kobject *kobj, struct kobj_attribute *attr,
914-
char *buf)
912+
static ssize_t pm_profile_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
915913
{
916914
return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile);
917915
}
918916

919-
static const struct kobj_attribute pm_profile_attr =
920-
__ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
917+
static const struct kobj_attribute pm_profile_attr = __ATTR_RO(pm_profile);
921918

922-
static ssize_t hotplug_enabled_show(struct kobject *kobj,
923-
struct kobj_attribute *attr, char *buf)
919+
static ssize_t enabled_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
924920
{
925921
struct acpi_hotplug_profile *hotplug = to_acpi_hotplug_profile(kobj);
926922

927923
return sprintf(buf, "%d\n", hotplug->enabled);
928924
}
929925

930-
static ssize_t hotplug_enabled_store(struct kobject *kobj,
931-
struct kobj_attribute *attr,
932-
const char *buf, size_t size)
926+
static ssize_t enabled_store(struct kobject *kobj, struct kobj_attribute *attr,
927+
const char *buf, size_t size)
933928
{
934929
struct acpi_hotplug_profile *hotplug = to_acpi_hotplug_profile(kobj);
935930
unsigned int val;
@@ -941,9 +936,7 @@ static ssize_t hotplug_enabled_store(struct kobject *kobj,
941936
return size;
942937
}
943938

944-
static struct kobj_attribute hotplug_enabled_attr =
945-
__ATTR(enabled, S_IRUGO | S_IWUSR, hotplug_enabled_show,
946-
hotplug_enabled_store);
939+
static struct kobj_attribute hotplug_enabled_attr = __ATTR_RW(enabled);
947940

948941
static struct attribute *hotplug_profile_attrs[] = {
949942
&hotplug_enabled_attr.attr,
@@ -1001,9 +994,7 @@ static ssize_t force_remove_store(struct kobject *kobj,
1001994
return size;
1002995
}
1003996

1004-
static const struct kobj_attribute force_remove_attr =
1005-
__ATTR(force_remove, S_IRUGO | S_IWUSR, force_remove_show,
1006-
force_remove_store);
997+
static const struct kobj_attribute force_remove_attr = __ATTR_RW(force_remove);
1007998

1008999
int __init acpi_sysfs_init(void)
10091000
{

0 commit comments

Comments
 (0)