Commit b4dd04ac authored by Bastien Nocera's avatar Bastien Nocera Committed by Darren Hart

thinkpad_acpi: use DEVICE_ATTR_* macros

Use the DEVICE_ATTR_* macros to reduce boiler plate.
Signed-off-by: default avatarBastien Nocera <hadess@hadess.net>
Acked-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
parent 6a68d855
...@@ -2669,9 +2669,7 @@ static ssize_t hotkey_enable_store(struct device *dev, ...@@ -2669,9 +2669,7 @@ static ssize_t hotkey_enable_store(struct device *dev,
return count; return count;
} }
static struct device_attribute dev_attr_hotkey_enable = static DEVICE_ATTR_RW(hotkey_enable);
__ATTR(hotkey_enable, S_IWUSR | S_IRUGO,
hotkey_enable_show, hotkey_enable_store);
/* sysfs hotkey mask --------------------------------------------------- */ /* sysfs hotkey mask --------------------------------------------------- */
static ssize_t hotkey_mask_show(struct device *dev, static ssize_t hotkey_mask_show(struct device *dev,
...@@ -2707,9 +2705,7 @@ static ssize_t hotkey_mask_store(struct device *dev, ...@@ -2707,9 +2705,7 @@ static ssize_t hotkey_mask_store(struct device *dev,
return (res) ? res : count; return (res) ? res : count;
} }
static struct device_attribute dev_attr_hotkey_mask = static DEVICE_ATTR_RW(hotkey_mask);
__ATTR(hotkey_mask, S_IWUSR | S_IRUGO,
hotkey_mask_show, hotkey_mask_store);
/* sysfs hotkey bios_enabled ------------------------------------------- */ /* sysfs hotkey bios_enabled ------------------------------------------- */
static ssize_t hotkey_bios_enabled_show(struct device *dev, static ssize_t hotkey_bios_enabled_show(struct device *dev,
...@@ -2719,8 +2715,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev, ...@@ -2719,8 +2715,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev,
return sprintf(buf, "0\n"); return sprintf(buf, "0\n");
} }
static struct device_attribute dev_attr_hotkey_bios_enabled = static DEVICE_ATTR_RO(hotkey_bios_enabled);
__ATTR(hotkey_bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL);
/* sysfs hotkey bios_mask ---------------------------------------------- */ /* sysfs hotkey bios_mask ---------------------------------------------- */
static ssize_t hotkey_bios_mask_show(struct device *dev, static ssize_t hotkey_bios_mask_show(struct device *dev,
...@@ -2732,8 +2727,7 @@ static ssize_t hotkey_bios_mask_show(struct device *dev, ...@@ -2732,8 +2727,7 @@ static ssize_t hotkey_bios_mask_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "0x%08x\n", hotkey_orig_mask); return snprintf(buf, PAGE_SIZE, "0x%08x\n", hotkey_orig_mask);
} }
static struct device_attribute dev_attr_hotkey_bios_mask = static DEVICE_ATTR_RO(hotkey_bios_mask);
__ATTR(hotkey_bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL);
/* sysfs hotkey all_mask ----------------------------------------------- */ /* sysfs hotkey all_mask ----------------------------------------------- */
static ssize_t hotkey_all_mask_show(struct device *dev, static ssize_t hotkey_all_mask_show(struct device *dev,
...@@ -2744,8 +2738,7 @@ static ssize_t hotkey_all_mask_show(struct device *dev, ...@@ -2744,8 +2738,7 @@ static ssize_t hotkey_all_mask_show(struct device *dev,
hotkey_all_mask | hotkey_source_mask); hotkey_all_mask | hotkey_source_mask);
} }
static struct device_attribute dev_attr_hotkey_all_mask = static DEVICE_ATTR_RO(hotkey_all_mask);
__ATTR(hotkey_all_mask, S_IRUGO, hotkey_all_mask_show, NULL);
/* sysfs hotkey recommended_mask --------------------------------------- */ /* sysfs hotkey recommended_mask --------------------------------------- */
static ssize_t hotkey_recommended_mask_show(struct device *dev, static ssize_t hotkey_recommended_mask_show(struct device *dev,
...@@ -2757,9 +2750,7 @@ static ssize_t hotkey_recommended_mask_show(struct device *dev, ...@@ -2757,9 +2750,7 @@ static ssize_t hotkey_recommended_mask_show(struct device *dev,
& ~hotkey_reserved_mask); & ~hotkey_reserved_mask);
} }
static struct device_attribute dev_attr_hotkey_recommended_mask = static DEVICE_ATTR_RO(hotkey_recommended_mask);
__ATTR(hotkey_recommended_mask, S_IRUGO,
hotkey_recommended_mask_show, NULL);
#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
...@@ -2814,9 +2805,7 @@ static ssize_t hotkey_source_mask_store(struct device *dev, ...@@ -2814,9 +2805,7 @@ static ssize_t hotkey_source_mask_store(struct device *dev,
return (rc < 0) ? rc : count; return (rc < 0) ? rc : count;
} }
static struct device_attribute dev_attr_hotkey_source_mask = static DEVICE_ATTR_RW(hotkey_source_mask);
__ATTR(hotkey_source_mask, S_IWUSR | S_IRUGO,
hotkey_source_mask_show, hotkey_source_mask_store);
/* sysfs hotkey hotkey_poll_freq --------------------------------------- */ /* sysfs hotkey hotkey_poll_freq --------------------------------------- */
static ssize_t hotkey_poll_freq_show(struct device *dev, static ssize_t hotkey_poll_freq_show(struct device *dev,
...@@ -2848,9 +2837,7 @@ static ssize_t hotkey_poll_freq_store(struct device *dev, ...@@ -2848,9 +2837,7 @@ static ssize_t hotkey_poll_freq_store(struct device *dev,
return count; return count;
} }
static struct device_attribute dev_attr_hotkey_poll_freq = static DEVICE_ATTR_RW(hotkey_poll_freq);
__ATTR(hotkey_poll_freq, S_IWUSR | S_IRUGO,
hotkey_poll_freq_show, hotkey_poll_freq_store);
#endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */
...@@ -2871,8 +2858,7 @@ static ssize_t hotkey_radio_sw_show(struct device *dev, ...@@ -2871,8 +2858,7 @@ static ssize_t hotkey_radio_sw_show(struct device *dev,
(res == TPACPI_RFK_RADIO_OFF) ? 0 : 1); (res == TPACPI_RFK_RADIO_OFF) ? 0 : 1);
} }
static struct device_attribute dev_attr_hotkey_radio_sw = static DEVICE_ATTR_RO(hotkey_radio_sw);
__ATTR(hotkey_radio_sw, S_IRUGO, hotkey_radio_sw_show, NULL);
static void hotkey_radio_sw_notify_change(void) static void hotkey_radio_sw_notify_change(void)
{ {
...@@ -2894,8 +2880,7 @@ static ssize_t hotkey_tablet_mode_show(struct device *dev, ...@@ -2894,8 +2880,7 @@ static ssize_t hotkey_tablet_mode_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%d\n", !!s); return snprintf(buf, PAGE_SIZE, "%d\n", !!s);
} }
static struct device_attribute dev_attr_hotkey_tablet_mode = static DEVICE_ATTR_RO(hotkey_tablet_mode);
__ATTR(hotkey_tablet_mode, S_IRUGO, hotkey_tablet_mode_show, NULL);
static void hotkey_tablet_mode_notify_change(void) static void hotkey_tablet_mode_notify_change(void)
{ {
...@@ -2912,8 +2897,7 @@ static ssize_t hotkey_wakeup_reason_show(struct device *dev, ...@@ -2912,8 +2897,7 @@ static ssize_t hotkey_wakeup_reason_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_wakeup_reason); return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_wakeup_reason);
} }
static struct device_attribute dev_attr_hotkey_wakeup_reason = static DEVICE_ATTR_RO(hotkey_wakeup_reason);
__ATTR(wakeup_reason, S_IRUGO, hotkey_wakeup_reason_show, NULL);
static void hotkey_wakeup_reason_notify_change(void) static void hotkey_wakeup_reason_notify_change(void)
{ {
...@@ -2929,9 +2913,7 @@ static ssize_t hotkey_wakeup_hotunplug_complete_show(struct device *dev, ...@@ -2929,9 +2913,7 @@ static ssize_t hotkey_wakeup_hotunplug_complete_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_autosleep_ack); return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_autosleep_ack);
} }
static struct device_attribute dev_attr_hotkey_wakeup_hotunplug_complete = static DEVICE_ATTR_RO(hotkey_wakeup_hotunplug_complete);
__ATTR(wakeup_hotunplug_complete, S_IRUGO,
hotkey_wakeup_hotunplug_complete_show, NULL);
static void hotkey_wakeup_hotunplug_complete_notify_change(void) static void hotkey_wakeup_hotunplug_complete_notify_change(void)
{ {
...@@ -4222,9 +4204,7 @@ static ssize_t bluetooth_enable_store(struct device *dev, ...@@ -4222,9 +4204,7 @@ static ssize_t bluetooth_enable_store(struct device *dev,
attr, buf, count); attr, buf, count);
} }
static struct device_attribute dev_attr_bluetooth_enable = static DEVICE_ATTR_RW(bluetooth_enable);
__ATTR(bluetooth_enable, S_IWUSR | S_IRUGO,
bluetooth_enable_show, bluetooth_enable_store);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -4412,9 +4392,7 @@ static ssize_t wan_enable_store(struct device *dev, ...@@ -4412,9 +4392,7 @@ static ssize_t wan_enable_store(struct device *dev,
attr, buf, count); attr, buf, count);
} }
static struct device_attribute dev_attr_wan_enable = static DEVICE_ATTR_RW(wan_enable);
__ATTR(wwan_enable, S_IWUSR | S_IRUGO,
wan_enable_show, wan_enable_store);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -5191,8 +5169,7 @@ static ssize_t cmos_command_store(struct device *dev, ...@@ -5191,8 +5169,7 @@ static ssize_t cmos_command_store(struct device *dev,
return (res) ? res : count; return (res) ? res : count;
} }
static struct device_attribute dev_attr_cmos_command = static DEVICE_ATTR_WO(cmos_command);
__ATTR(cmos_command, S_IWUSR, NULL, cmos_command_store);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -8160,9 +8137,7 @@ static ssize_t fan_pwm1_enable_store(struct device *dev, ...@@ -8160,9 +8137,7 @@ static ssize_t fan_pwm1_enable_store(struct device *dev,
return count; return count;
} }
static struct device_attribute dev_attr_fan_pwm1_enable = static DEVICE_ATTR_RW(fan_pwm1_enable);
__ATTR(pwm1_enable, S_IWUSR | S_IRUGO,
fan_pwm1_enable_show, fan_pwm1_enable_store);
/* sysfs fan pwm1 ------------------------------------------------------ */ /* sysfs fan pwm1 ------------------------------------------------------ */
static ssize_t fan_pwm1_show(struct device *dev, static ssize_t fan_pwm1_show(struct device *dev,
...@@ -8222,9 +8197,7 @@ static ssize_t fan_pwm1_store(struct device *dev, ...@@ -8222,9 +8197,7 @@ static ssize_t fan_pwm1_store(struct device *dev,
return (rc) ? rc : count; return (rc) ? rc : count;
} }
static struct device_attribute dev_attr_fan_pwm1 = static DEVICE_ATTR_RW(fan_pwm1);
__ATTR(pwm1, S_IWUSR | S_IRUGO,
fan_pwm1_show, fan_pwm1_store);
/* sysfs fan fan1_input ------------------------------------------------ */ /* sysfs fan fan1_input ------------------------------------------------ */
static ssize_t fan_fan1_input_show(struct device *dev, static ssize_t fan_fan1_input_show(struct device *dev,
...@@ -8241,9 +8214,7 @@ static ssize_t fan_fan1_input_show(struct device *dev, ...@@ -8241,9 +8214,7 @@ static ssize_t fan_fan1_input_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%u\n", speed); return snprintf(buf, PAGE_SIZE, "%u\n", speed);
} }
static struct device_attribute dev_attr_fan_fan1_input = static DEVICE_ATTR_RO(fan_fan1_input);
__ATTR(fan1_input, S_IRUGO,
fan_fan1_input_show, NULL);
/* sysfs fan fan2_input ------------------------------------------------ */ /* sysfs fan fan2_input ------------------------------------------------ */
static ssize_t fan_fan2_input_show(struct device *dev, static ssize_t fan_fan2_input_show(struct device *dev,
...@@ -8260,9 +8231,7 @@ static ssize_t fan_fan2_input_show(struct device *dev, ...@@ -8260,9 +8231,7 @@ static ssize_t fan_fan2_input_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%u\n", speed); return snprintf(buf, PAGE_SIZE, "%u\n", speed);
} }
static struct device_attribute dev_attr_fan_fan2_input = static DEVICE_ATTR_RO(fan_fan2_input);
__ATTR(fan2_input, S_IRUGO,
fan_fan2_input_show, NULL);
/* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */ /* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */
static ssize_t fan_fan_watchdog_show(struct device_driver *drv, static ssize_t fan_fan_watchdog_show(struct device_driver *drv,
...@@ -8878,8 +8847,7 @@ static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev, ...@@ -8878,8 +8847,7 @@ static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%s\n", TPACPI_NAME); return snprintf(buf, PAGE_SIZE, "%s\n", TPACPI_NAME);
} }
static struct device_attribute dev_attr_thinkpad_acpi_pdev_name = static DEVICE_ATTR_RO(thinkpad_acpi_pdev_name);
__ATTR(name, S_IRUGO, thinkpad_acpi_pdev_name_show, NULL);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment