aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2015-03-02 12:40:50 -0500
committerDarren Hart <dvhart@linux.intel.com>2015-03-03 12:03:31 -0500
commitb4dd04ac6ef88259ddb59ca809ca5845c7892139 (patch)
tree0fdf2f431e4f0a67a61bc906ee44610e8d913239 /drivers/platform
parent6a68d855708497c542d57a82a5f8e3a513a65a82 (diff)
thinkpad_acpi: use DEVICE_ATTR_* macros
Use the DEVICE_ATTR_* macros to reduce boiler plate. Signed-off-by: Bastien Nocera <hadess@hadess.net> Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c72
1 files changed, 20 insertions, 52 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 5d76f1812783..56eaddc5f222 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2669,9 +2669,7 @@ static ssize_t hotkey_enable_store(struct device *dev,
2669 return count; 2669 return count;
2670} 2670}
2671 2671
2672static struct device_attribute dev_attr_hotkey_enable = 2672static DEVICE_ATTR_RW(hotkey_enable);
2673 __ATTR(hotkey_enable, S_IWUSR | S_IRUGO,
2674 hotkey_enable_show, hotkey_enable_store);
2675 2673
2676/* sysfs hotkey mask --------------------------------------------------- */ 2674/* sysfs hotkey mask --------------------------------------------------- */
2677static ssize_t hotkey_mask_show(struct device *dev, 2675static ssize_t hotkey_mask_show(struct device *dev,
@@ -2707,9 +2705,7 @@ static ssize_t hotkey_mask_store(struct device *dev,
2707 return (res) ? res : count; 2705 return (res) ? res : count;
2708} 2706}
2709 2707
2710static struct device_attribute dev_attr_hotkey_mask = 2708static DEVICE_ATTR_RW(hotkey_mask);
2711 __ATTR(hotkey_mask, S_IWUSR | S_IRUGO,
2712 hotkey_mask_show, hotkey_mask_store);
2713 2709
2714/* sysfs hotkey bios_enabled ------------------------------------------- */ 2710/* sysfs hotkey bios_enabled ------------------------------------------- */
2715static ssize_t hotkey_bios_enabled_show(struct device *dev, 2711static ssize_t hotkey_bios_enabled_show(struct device *dev,
@@ -2719,8 +2715,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev,
2719 return sprintf(buf, "0\n"); 2715 return sprintf(buf, "0\n");
2720} 2716}
2721 2717
2722static struct device_attribute dev_attr_hotkey_bios_enabled = 2718static DEVICE_ATTR_RO(hotkey_bios_enabled);
2723 __ATTR(hotkey_bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL);
2724 2719
2725/* sysfs hotkey bios_mask ---------------------------------------------- */ 2720/* sysfs hotkey bios_mask ---------------------------------------------- */
2726static ssize_t hotkey_bios_mask_show(struct device *dev, 2721static ssize_t hotkey_bios_mask_show(struct device *dev,
@@ -2732,8 +2727,7 @@ static ssize_t hotkey_bios_mask_show(struct device *dev,
2732 return snprintf(buf, PAGE_SIZE, "0x%08x\n", hotkey_orig_mask); 2727 return snprintf(buf, PAGE_SIZE, "0x%08x\n", hotkey_orig_mask);
2733} 2728}
2734 2729
2735static struct device_attribute dev_attr_hotkey_bios_mask = 2730static DEVICE_ATTR_RO(hotkey_bios_mask);
2736 __ATTR(hotkey_bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL);
2737 2731
2738/* sysfs hotkey all_mask ----------------------------------------------- */ 2732/* sysfs hotkey all_mask ----------------------------------------------- */
2739static ssize_t hotkey_all_mask_show(struct device *dev, 2733static ssize_t hotkey_all_mask_show(struct device *dev,
@@ -2744,8 +2738,7 @@ static ssize_t hotkey_all_mask_show(struct device *dev,
2744 hotkey_all_mask | hotkey_source_mask); 2738 hotkey_all_mask | hotkey_source_mask);
2745} 2739}
2746 2740
2747static struct device_attribute dev_attr_hotkey_all_mask = 2741static DEVICE_ATTR_RO(hotkey_all_mask);
2748 __ATTR(hotkey_all_mask, S_IRUGO, hotkey_all_mask_show, NULL);
2749 2742
2750/* sysfs hotkey recommended_mask --------------------------------------- */ 2743/* sysfs hotkey recommended_mask --------------------------------------- */
2751static ssize_t hotkey_recommended_mask_show(struct device *dev, 2744static ssize_t hotkey_recommended_mask_show(struct device *dev,
@@ -2757,9 +2750,7 @@ static ssize_t hotkey_recommended_mask_show(struct device *dev,
2757 & ~hotkey_reserved_mask); 2750 & ~hotkey_reserved_mask);
2758} 2751}
2759 2752
2760static struct device_attribute dev_attr_hotkey_recommended_mask = 2753static DEVICE_ATTR_RO(hotkey_recommended_mask);
2761 __ATTR(hotkey_recommended_mask, S_IRUGO,
2762 hotkey_recommended_mask_show, NULL);
2763 2754
2764#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2755#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
2765 2756
@@ -2814,9 +2805,7 @@ static ssize_t hotkey_source_mask_store(struct device *dev,
2814 return (rc < 0) ? rc : count; 2805 return (rc < 0) ? rc : count;
2815} 2806}
2816 2807
2817static struct device_attribute dev_attr_hotkey_source_mask = 2808static DEVICE_ATTR_RW(hotkey_source_mask);
2818 __ATTR(hotkey_source_mask, S_IWUSR | S_IRUGO,
2819 hotkey_source_mask_show, hotkey_source_mask_store);
2820 2809
2821/* sysfs hotkey hotkey_poll_freq --------------------------------------- */ 2810/* sysfs hotkey hotkey_poll_freq --------------------------------------- */
2822static ssize_t hotkey_poll_freq_show(struct device *dev, 2811static ssize_t hotkey_poll_freq_show(struct device *dev,
@@ -2848,9 +2837,7 @@ static ssize_t hotkey_poll_freq_store(struct device *dev,
2848 return count; 2837 return count;
2849} 2838}
2850 2839
2851static struct device_attribute dev_attr_hotkey_poll_freq = 2840static DEVICE_ATTR_RW(hotkey_poll_freq);
2852 __ATTR(hotkey_poll_freq, S_IWUSR | S_IRUGO,
2853 hotkey_poll_freq_show, hotkey_poll_freq_store);
2854 2841
2855#endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 2842#endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */
2856 2843
@@ -2871,8 +2858,7 @@ static ssize_t hotkey_radio_sw_show(struct device *dev,
2871 (res == TPACPI_RFK_RADIO_OFF) ? 0 : 1); 2858 (res == TPACPI_RFK_RADIO_OFF) ? 0 : 1);
2872} 2859}
2873 2860
2874static struct device_attribute dev_attr_hotkey_radio_sw = 2861static DEVICE_ATTR_RO(hotkey_radio_sw);
2875 __ATTR(hotkey_radio_sw, S_IRUGO, hotkey_radio_sw_show, NULL);
2876 2862
2877static void hotkey_radio_sw_notify_change(void) 2863static void hotkey_radio_sw_notify_change(void)
2878{ 2864{
@@ -2894,8 +2880,7 @@ static ssize_t hotkey_tablet_mode_show(struct device *dev,
2894 return snprintf(buf, PAGE_SIZE, "%d\n", !!s); 2880 return snprintf(buf, PAGE_SIZE, "%d\n", !!s);
2895} 2881}
2896 2882
2897static struct device_attribute dev_attr_hotkey_tablet_mode = 2883static DEVICE_ATTR_RO(hotkey_tablet_mode);
2898 __ATTR(hotkey_tablet_mode, S_IRUGO, hotkey_tablet_mode_show, NULL);
2899 2884
2900static void hotkey_tablet_mode_notify_change(void) 2885static void hotkey_tablet_mode_notify_change(void)
2901{ 2886{
@@ -2912,8 +2897,7 @@ static ssize_t hotkey_wakeup_reason_show(struct device *dev,
2912 return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_wakeup_reason); 2897 return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_wakeup_reason);
2913} 2898}
2914 2899
2915static struct device_attribute dev_attr_hotkey_wakeup_reason = 2900static DEVICE_ATTR_RO(hotkey_wakeup_reason);
2916 __ATTR(wakeup_reason, S_IRUGO, hotkey_wakeup_reason_show, NULL);
2917 2901
2918static void hotkey_wakeup_reason_notify_change(void) 2902static void hotkey_wakeup_reason_notify_change(void)
2919{ 2903{
@@ -2929,9 +2913,7 @@ static ssize_t hotkey_wakeup_hotunplug_complete_show(struct device *dev,
2929 return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_autosleep_ack); 2913 return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_autosleep_ack);
2930} 2914}
2931 2915
2932static struct device_attribute dev_attr_hotkey_wakeup_hotunplug_complete = 2916static DEVICE_ATTR_RO(hotkey_wakeup_hotunplug_complete);
2933 __ATTR(wakeup_hotunplug_complete, S_IRUGO,
2934 hotkey_wakeup_hotunplug_complete_show, NULL);
2935 2917
2936static void hotkey_wakeup_hotunplug_complete_notify_change(void) 2918static void hotkey_wakeup_hotunplug_complete_notify_change(void)
2937{ 2919{
@@ -4222,9 +4204,7 @@ static ssize_t bluetooth_enable_store(struct device *dev,
4222 attr, buf, count); 4204 attr, buf, count);
4223} 4205}
4224 4206
4225static struct device_attribute dev_attr_bluetooth_enable = 4207static DEVICE_ATTR_RW(bluetooth_enable);
4226 __ATTR(bluetooth_enable, S_IWUSR | S_IRUGO,
4227 bluetooth_enable_show, bluetooth_enable_store);
4228 4208
4229/* --------------------------------------------------------------------- */ 4209/* --------------------------------------------------------------------- */
4230 4210
@@ -4412,9 +4392,7 @@ static ssize_t wan_enable_store(struct device *dev,
4412 attr, buf, count); 4392 attr, buf, count);
4413} 4393}
4414 4394
4415static struct device_attribute dev_attr_wan_enable = 4395static DEVICE_ATTR_RW(wan_enable);
4416 __ATTR(wwan_enable, S_IWUSR | S_IRUGO,
4417 wan_enable_show, wan_enable_store);
4418 4396
4419/* --------------------------------------------------------------------- */ 4397/* --------------------------------------------------------------------- */
4420 4398
@@ -5191,8 +5169,7 @@ static ssize_t cmos_command_store(struct device *dev,
5191 return (res) ? res : count; 5169 return (res) ? res : count;
5192} 5170}
5193 5171
5194static struct device_attribute dev_attr_cmos_command = 5172static DEVICE_ATTR_WO(cmos_command);
5195 __ATTR(cmos_command, S_IWUSR, NULL, cmos_command_store);
5196 5173
5197/* --------------------------------------------------------------------- */ 5174/* --------------------------------------------------------------------- */
5198 5175
@@ -8160,9 +8137,7 @@ static ssize_t fan_pwm1_enable_store(struct device *dev,
8160 return count; 8137 return count;
8161} 8138}
8162 8139
8163static struct device_attribute dev_attr_fan_pwm1_enable = 8140static DEVICE_ATTR_RW(fan_pwm1_enable);
8164 __ATTR(pwm1_enable, S_IWUSR | S_IRUGO,
8165 fan_pwm1_enable_show, fan_pwm1_enable_store);
8166 8141
8167/* sysfs fan pwm1 ------------------------------------------------------ */ 8142/* sysfs fan pwm1 ------------------------------------------------------ */
8168static ssize_t fan_pwm1_show(struct device *dev, 8143static ssize_t fan_pwm1_show(struct device *dev,
@@ -8222,9 +8197,7 @@ static ssize_t fan_pwm1_store(struct device *dev,
8222 return (rc) ? rc : count; 8197 return (rc) ? rc : count;
8223} 8198}
8224 8199
8225static struct device_attribute dev_attr_fan_pwm1 = 8200static DEVICE_ATTR_RW(fan_pwm1);
8226 __ATTR(pwm1, S_IWUSR | S_IRUGO,
8227 fan_pwm1_show, fan_pwm1_store);
8228 8201
8229/* sysfs fan fan1_input ------------------------------------------------ */ 8202/* sysfs fan fan1_input ------------------------------------------------ */
8230static ssize_t fan_fan1_input_show(struct device *dev, 8203static ssize_t fan_fan1_input_show(struct device *dev,
@@ -8241,9 +8214,7 @@ static ssize_t fan_fan1_input_show(struct device *dev,
8241 return snprintf(buf, PAGE_SIZE, "%u\n", speed); 8214 return snprintf(buf, PAGE_SIZE, "%u\n", speed);
8242} 8215}
8243 8216
8244static struct device_attribute dev_attr_fan_fan1_input = 8217static DEVICE_ATTR_RO(fan_fan1_input);
8245 __ATTR(fan1_input, S_IRUGO,
8246 fan_fan1_input_show, NULL);
8247 8218
8248/* sysfs fan fan2_input ------------------------------------------------ */ 8219/* sysfs fan fan2_input ------------------------------------------------ */
8249static ssize_t fan_fan2_input_show(struct device *dev, 8220static ssize_t fan_fan2_input_show(struct device *dev,
@@ -8260,9 +8231,7 @@ static ssize_t fan_fan2_input_show(struct device *dev,
8260 return snprintf(buf, PAGE_SIZE, "%u\n", speed); 8231 return snprintf(buf, PAGE_SIZE, "%u\n", speed);
8261} 8232}
8262 8233
8263static struct device_attribute dev_attr_fan_fan2_input = 8234static DEVICE_ATTR_RO(fan_fan2_input);
8264 __ATTR(fan2_input, S_IRUGO,
8265 fan_fan2_input_show, NULL);
8266 8235
8267/* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */ 8236/* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */
8268static ssize_t fan_fan_watchdog_show(struct device_driver *drv, 8237static 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 return snprintf(buf, PAGE_SIZE, "%s\n", TPACPI_NAME); 8847 return snprintf(buf, PAGE_SIZE, "%s\n", TPACPI_NAME);
8879} 8848}
8880 8849
8881static struct device_attribute dev_attr_thinkpad_acpi_pdev_name = 8850static DEVICE_ATTR_RO(thinkpad_acpi_pdev_name);
8882 __ATTR(name, S_IRUGO, thinkpad_acpi_pdev_name_show, NULL);
8883 8851
8884/* --------------------------------------------------------------------- */ 8852/* --------------------------------------------------------------------- */
8885 8853