diff options
Diffstat (limited to 'drivers/misc/asus-laptop.c')
-rw-r--r-- | drivers/misc/asus-laptop.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index f75306059971..6b89854bd3ff 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -1067,19 +1067,16 @@ static void asus_backlight_exit(void) | |||
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | #define ASUS_LED_UNREGISTER(object) \ | 1069 | #define ASUS_LED_UNREGISTER(object) \ |
1070 | if(object##_led.class_dev \ | 1070 | led_classdev_unregister(&object##_led) |
1071 | && !IS_ERR(object##_led.class_dev)) \ | ||
1072 | led_classdev_unregister(&object##_led) | ||
1073 | 1071 | ||
1074 | static void asus_led_exit(void) | 1072 | static void asus_led_exit(void) |
1075 | { | 1073 | { |
1074 | destroy_workqueue(led_workqueue); | ||
1076 | ASUS_LED_UNREGISTER(mled); | 1075 | ASUS_LED_UNREGISTER(mled); |
1077 | ASUS_LED_UNREGISTER(tled); | 1076 | ASUS_LED_UNREGISTER(tled); |
1078 | ASUS_LED_UNREGISTER(pled); | 1077 | ASUS_LED_UNREGISTER(pled); |
1079 | ASUS_LED_UNREGISTER(rled); | 1078 | ASUS_LED_UNREGISTER(rled); |
1080 | ASUS_LED_UNREGISTER(gled); | 1079 | ASUS_LED_UNREGISTER(gled); |
1081 | |||
1082 | destroy_workqueue(led_workqueue); | ||
1083 | } | 1080 | } |
1084 | 1081 | ||
1085 | static void __exit asus_laptop_exit(void) | 1082 | static void __exit asus_laptop_exit(void) |
@@ -1135,29 +1132,42 @@ static int asus_led_init(struct device *dev) | |||
1135 | 1132 | ||
1136 | rv = ASUS_LED_REGISTER(mled, dev); | 1133 | rv = ASUS_LED_REGISTER(mled, dev); |
1137 | if (rv) | 1134 | if (rv) |
1138 | return rv; | 1135 | goto out; |
1139 | 1136 | ||
1140 | rv = ASUS_LED_REGISTER(tled, dev); | 1137 | rv = ASUS_LED_REGISTER(tled, dev); |
1141 | if (rv) | 1138 | if (rv) |
1142 | return rv; | 1139 | goto out1; |
1143 | 1140 | ||
1144 | rv = ASUS_LED_REGISTER(rled, dev); | 1141 | rv = ASUS_LED_REGISTER(rled, dev); |
1145 | if (rv) | 1142 | if (rv) |
1146 | return rv; | 1143 | goto out2; |
1147 | 1144 | ||
1148 | rv = ASUS_LED_REGISTER(pled, dev); | 1145 | rv = ASUS_LED_REGISTER(pled, dev); |
1149 | if (rv) | 1146 | if (rv) |
1150 | return rv; | 1147 | goto out3; |
1151 | 1148 | ||
1152 | rv = ASUS_LED_REGISTER(gled, dev); | 1149 | rv = ASUS_LED_REGISTER(gled, dev); |
1153 | if (rv) | 1150 | if (rv) |
1154 | return rv; | 1151 | goto out4; |
1155 | 1152 | ||
1156 | led_workqueue = create_singlethread_workqueue("led_workqueue"); | 1153 | led_workqueue = create_singlethread_workqueue("led_workqueue"); |
1157 | if (!led_workqueue) | 1154 | if (!led_workqueue) |
1158 | return -ENOMEM; | 1155 | goto out5; |
1159 | 1156 | ||
1160 | return 0; | 1157 | return 0; |
1158 | out5: | ||
1159 | rv = -ENOMEM; | ||
1160 | ASUS_LED_UNREGISTER(gled); | ||
1161 | out4: | ||
1162 | ASUS_LED_UNREGISTER(pled); | ||
1163 | out3: | ||
1164 | ASUS_LED_UNREGISTER(rled); | ||
1165 | out2: | ||
1166 | ASUS_LED_UNREGISTER(tled); | ||
1167 | out1: | ||
1168 | ASUS_LED_UNREGISTER(mled); | ||
1169 | out: | ||
1170 | return rv; | ||
1161 | } | 1171 | } |
1162 | 1172 | ||
1163 | static int __init asus_laptop_init(void) | 1173 | static int __init asus_laptop_init(void) |