ACPI: Use DEVICE_ATTR_<RW|RO|WO> macros
[ Upstream commit 0f39ee8324
]
Instead of open coding DEVICE_ATTR(), use the
DEVICE_ATTR_RW(), DEVICE_ATTR_RO() and DEVICE_ATTR_WO()
macros wherever possible.
This required a few functions to be renamed but the
functionality itself is unchanged.
Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d3dd2fe274
commit
3cbe01ac28
@ -484,7 +484,7 @@ int dock_notify(struct acpi_device *adev, u32 event)
|
||||
/*
|
||||
* show_docked - read method for "docked" file in sysfs
|
||||
*/
|
||||
static ssize_t show_docked(struct device *dev,
|
||||
static ssize_t docked_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct dock_station *dock_station = dev->platform_data;
|
||||
@ -493,25 +493,25 @@ static ssize_t show_docked(struct device *dev,
|
||||
acpi_bus_get_device(dock_station->handle, &adev);
|
||||
return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev));
|
||||
}
|
||||
static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
|
||||
static DEVICE_ATTR_RO(docked);
|
||||
|
||||
/*
|
||||
* show_flags - read method for flags file in sysfs
|
||||
*/
|
||||
static ssize_t show_flags(struct device *dev,
|
||||
static ssize_t flags_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct dock_station *dock_station = dev->platform_data;
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags);
|
||||
|
||||
}
|
||||
static DEVICE_ATTR(flags, S_IRUGO, show_flags, NULL);
|
||||
static DEVICE_ATTR_RO(flags);
|
||||
|
||||
/*
|
||||
* write_undock - write method for "undock" file in sysfs
|
||||
*/
|
||||
static ssize_t write_undock(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
static ssize_t undock_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int ret;
|
||||
struct dock_station *dock_station = dev->platform_data;
|
||||
@ -525,13 +525,13 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr,
|
||||
acpi_scan_lock_release();
|
||||
return ret ? ret: count;
|
||||
}
|
||||
static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock);
|
||||
static DEVICE_ATTR_WO(undock);
|
||||
|
||||
/*
|
||||
* show_dock_uid - read method for "uid" file in sysfs
|
||||
*/
|
||||
static ssize_t show_dock_uid(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
static ssize_t uid_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
unsigned long long lbuf;
|
||||
struct dock_station *dock_station = dev->platform_data;
|
||||
@ -542,10 +542,10 @@ static ssize_t show_dock_uid(struct device *dev,
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf);
|
||||
}
|
||||
static DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL);
|
||||
static DEVICE_ATTR_RO(uid);
|
||||
|
||||
static ssize_t show_dock_type(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
static ssize_t type_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct dock_station *dock_station = dev->platform_data;
|
||||
char *type;
|
||||
@ -561,7 +561,7 @@ static ssize_t show_dock_type(struct device *dev,
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", type);
|
||||
}
|
||||
static DEVICE_ATTR(type, S_IRUGO, show_dock_type, NULL);
|
||||
static DEVICE_ATTR_RO(type);
|
||||
|
||||
static struct attribute *dock_attributes[] = {
|
||||
&dev_attr_docked.attr,
|
||||
|
Reference in New Issue
Block a user