|
22 | 22 | #include <linux/io.h>
|
23 | 23 | #include <linux/input-polldev.h>
|
24 | 24 | #include <linux/i2c.h>
|
25 |
| -#include <linux/workqueue.h> |
26 | 25 | #include <linux/leds.h>
|
27 | 26 |
|
28 | 27 | #define APANEL_NAME "Fujitsu Application Panel"
|
@@ -59,8 +58,6 @@ struct apanel {
|
59 | 58 | struct i2c_client *client;
|
60 | 59 | unsigned short keymap[MAX_PANEL_KEYS];
|
61 | 60 | u16 nkeys;
|
62 |
| - u16 led_bits; |
63 |
| - struct work_struct led_work; |
64 | 61 | struct led_classdev mail_led;
|
65 | 62 | };
|
66 | 63 |
|
@@ -109,25 +106,13 @@ static void apanel_poll(struct input_polled_dev *ipdev)
|
109 | 106 | report_key(idev, ap->keymap[i]);
|
110 | 107 | }
|
111 | 108 |
|
112 |
| -/* Track state changes of LED */ |
113 |
| -static void led_update(struct work_struct *work) |
114 |
| -{ |
115 |
| - struct apanel *ap = container_of(work, struct apanel, led_work); |
116 |
| - |
117 |
| - i2c_smbus_write_word_data(ap->client, 0x10, ap->led_bits); |
118 |
| -} |
119 |
| - |
120 |
| -static void mail_led_set(struct led_classdev *led, |
| 109 | +static int mail_led_set(struct led_classdev *led, |
121 | 110 | enum led_brightness value)
|
122 | 111 | {
|
123 | 112 | struct apanel *ap = container_of(led, struct apanel, mail_led);
|
| 113 | + u16 led_bits = value != LED_OFF ? 0x8000 : 0x0000; |
124 | 114 |
|
125 |
| - if (value != LED_OFF) |
126 |
| - ap->led_bits |= 0x8000; |
127 |
| - else |
128 |
| - ap->led_bits &= ~0x8000; |
129 |
| - |
130 |
| - schedule_work(&ap->led_work); |
| 115 | + return i2c_smbus_write_word_data(ap->client, 0x10, led_bits); |
131 | 116 | }
|
132 | 117 |
|
133 | 118 | static int apanel_remove(struct i2c_client *client)
|
@@ -179,7 +164,7 @@ static struct apanel apanel = {
|
179 | 164 | },
|
180 | 165 | .mail_led = {
|
181 | 166 | .name = "mail:blue",
|
182 |
| - .brightness_set = mail_led_set, |
| 167 | + .brightness_set_blocking = mail_led_set, |
183 | 168 | },
|
184 | 169 | };
|
185 | 170 |
|
@@ -235,7 +220,6 @@ static int apanel_probe(struct i2c_client *client,
|
235 | 220 | if (err)
|
236 | 221 | goto out3;
|
237 | 222 |
|
238 |
| - INIT_WORK(&ap->led_work, led_update); |
239 | 223 | if (device_chip[APANEL_DEV_LED] != CHIP_NONE) {
|
240 | 224 | err = led_classdev_register(&client->dev, &ap->mail_led);
|
241 | 225 | if (err)
|
|
0 commit comments