ACPI: Use DEVICE_ATTR_<RW|RO|WO> macros
[ Upstream commit 0f39ee8324e75c9d370e84a61323ceb194641a18 ] 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
@@ -325,11 +325,11 @@ int acpi_device_modalias(struct device *dev, char *buf, int size)
|
||||
EXPORT_SYMBOL_GPL(acpi_device_modalias);
|
||||
|
||||
static ssize_t
|
||||
acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return __acpi_device_modalias(to_acpi_device(dev), buf, 1024);
|
||||
}
|
||||
static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
|
||||
static DEVICE_ATTR_RO(modalias);
|
||||
|
||||
static ssize_t real_power_state_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
@@ -358,8 +358,8 @@ static ssize_t power_state_show(struct device *dev,
|
||||
static DEVICE_ATTR_RO(power_state);
|
||||
|
||||
static ssize_t
|
||||
acpi_eject_store(struct device *d, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
eject_store(struct device *d, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct acpi_device *acpi_device = to_acpi_device(d);
|
||||
acpi_object_type not_used;
|
||||
@@ -387,28 +387,28 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
|
||||
return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store);
|
||||
static DEVICE_ATTR_WO(eject);
|
||||
|
||||
static ssize_t
|
||||
acpi_device_hid_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
hid_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct acpi_device *acpi_dev = to_acpi_device(dev);
|
||||
|
||||
return sprintf(buf, "%s\n", acpi_device_hid(acpi_dev));
|
||||
}
|
||||
static DEVICE_ATTR(hid, 0444, acpi_device_hid_show, NULL);
|
||||
static DEVICE_ATTR_RO(hid);
|
||||
|
||||
static ssize_t acpi_device_uid_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
static ssize_t uid_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct acpi_device *acpi_dev = to_acpi_device(dev);
|
||||
|
||||
return sprintf(buf, "%s\n", acpi_dev->pnp.unique_id);
|
||||
}
|
||||
static DEVICE_ATTR(uid, 0444, acpi_device_uid_show, NULL);
|
||||
static DEVICE_ATTR_RO(uid);
|
||||
|
||||
static ssize_t acpi_device_adr_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
static ssize_t adr_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct acpi_device *acpi_dev = to_acpi_device(dev);
|
||||
|
||||
@@ -417,16 +417,16 @@ static ssize_t acpi_device_adr_show(struct device *dev,
|
||||
else
|
||||
return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
|
||||
}
|
||||
static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
|
||||
static DEVICE_ATTR_RO(adr);
|
||||
|
||||
static ssize_t acpi_device_path_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
static ssize_t path_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct acpi_device *acpi_dev = to_acpi_device(dev);
|
||||
|
||||
return acpi_object_path(acpi_dev->handle, buf);
|
||||
}
|
||||
static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL);
|
||||
static DEVICE_ATTR_RO(path);
|
||||
|
||||
/* sysfs file that shows description text from the ACPI _STR method */
|
||||
static ssize_t description_show(struct device *dev,
|
||||
@@ -455,8 +455,8 @@ static ssize_t description_show(struct device *dev,
|
||||
static DEVICE_ATTR_RO(description);
|
||||
|
||||
static ssize_t
|
||||
acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf) {
|
||||
sun_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf) {
|
||||
struct acpi_device *acpi_dev = to_acpi_device(dev);
|
||||
acpi_status status;
|
||||
unsigned long long sun;
|
||||
@@ -467,11 +467,11 @@ acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
|
||||
|
||||
return sprintf(buf, "%llu\n", sun);
|
||||
}
|
||||
static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
|
||||
static DEVICE_ATTR_RO(sun);
|
||||
|
||||
static ssize_t
|
||||
acpi_device_hrv_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf) {
|
||||
hrv_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf) {
|
||||
struct acpi_device *acpi_dev = to_acpi_device(dev);
|
||||
acpi_status status;
|
||||
unsigned long long hrv;
|
||||
@@ -482,7 +482,7 @@ acpi_device_hrv_show(struct device *dev, struct device_attribute *attr,
|
||||
|
||||
return sprintf(buf, "%llu\n", hrv);
|
||||
}
|
||||
static DEVICE_ATTR(hrv, 0444, acpi_device_hrv_show, NULL);
|
||||
static DEVICE_ATTR_RO(hrv);
|
||||
|
||||
static ssize_t status_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf) {
|
||||
|
||||
Reference in New Issue
Block a user