8
8
#include <linux/io.h>
9
9
#include <linux/dmi.h>
10
10
#include <linux/init.h>
11
- #include <linux/input-polldev .h>
11
+ #include <linux/input.h>
12
12
#include <linux/input/sparse-keymap.h>
13
13
#include <linux/interrupt.h>
14
14
#include <linux/jiffies.h>
@@ -1030,7 +1030,7 @@ static int __init select_keymap(void)
1030
1030
1031
1031
/* Input layer interface */
1032
1032
1033
- static struct input_polled_dev * wistron_idev ;
1033
+ static struct input_dev * wistron_idev ;
1034
1034
static unsigned long jiffies_last_press ;
1035
1035
static bool wifi_enabled ;
1036
1036
static bool bluetooth_enabled ;
@@ -1114,7 +1114,7 @@ static inline void wistron_led_resume(void)
1114
1114
static void handle_key (u8 code )
1115
1115
{
1116
1116
const struct key_entry * key =
1117
- sparse_keymap_entry_from_scancode (wistron_idev -> input , code );
1117
+ sparse_keymap_entry_from_scancode (wistron_idev , code );
1118
1118
1119
1119
if (key ) {
1120
1120
switch (key -> type ) {
@@ -1133,14 +1133,14 @@ static void handle_key(u8 code)
1133
1133
break ;
1134
1134
1135
1135
default :
1136
- sparse_keymap_report_entry (wistron_idev -> input ,
1137
- key , 1 , true);
1136
+ sparse_keymap_report_entry (wistron_idev , key , 1 , true);
1138
1137
break ;
1139
1138
}
1140
1139
jiffies_last_press = jiffies ;
1141
- } else
1140
+ } else {
1142
1141
printk (KERN_NOTICE
1143
1142
"wistron_btns: Unknown key code %02X\n" , code );
1143
+ }
1144
1144
}
1145
1145
1146
1146
static void poll_bios (bool discard )
@@ -1158,21 +1158,23 @@ static void poll_bios(bool discard)
1158
1158
}
1159
1159
}
1160
1160
1161
- static void wistron_flush (struct input_polled_dev * dev )
1161
+ static int wistron_flush (struct input_dev * dev )
1162
1162
{
1163
1163
/* Flush stale event queue */
1164
1164
poll_bios (true);
1165
+
1166
+ return 0 ;
1165
1167
}
1166
1168
1167
- static void wistron_poll (struct input_polled_dev * dev )
1169
+ static void wistron_poll (struct input_dev * dev )
1168
1170
{
1169
1171
poll_bios (false);
1170
1172
1171
1173
/* Increase poll frequency if user is currently pressing keys (< 2s ago) */
1172
1174
if (time_before (jiffies , jiffies_last_press + 2 * HZ ))
1173
- dev -> poll_interval = POLL_INTERVAL_BURST ;
1175
+ input_set_poll_interval ( dev , POLL_INTERVAL_BURST ) ;
1174
1176
else
1175
- dev -> poll_interval = POLL_INTERVAL_DEFAULT ;
1177
+ input_set_poll_interval ( dev , POLL_INTERVAL_DEFAULT ) ;
1176
1178
}
1177
1179
1178
1180
static int wistron_setup_keymap (struct input_dev * dev ,
@@ -1208,35 +1210,37 @@ static int wistron_setup_keymap(struct input_dev *dev,
1208
1210
1209
1211
static int setup_input_dev (void )
1210
1212
{
1211
- struct input_dev * input_dev ;
1212
1213
int error ;
1213
1214
1214
- wistron_idev = input_allocate_polled_device ();
1215
+ wistron_idev = input_allocate_device ();
1215
1216
if (!wistron_idev )
1216
1217
return - ENOMEM ;
1217
1218
1219
+ wistron_idev -> name = "Wistron laptop buttons" ;
1220
+ wistron_idev -> phys = "wistron/input0" ;
1221
+ wistron_idev -> id .bustype = BUS_HOST ;
1222
+ wistron_idev -> dev .parent = & wistron_device -> dev ;
1223
+
1218
1224
wistron_idev -> open = wistron_flush ;
1219
- wistron_idev -> poll = wistron_poll ;
1220
- wistron_idev -> poll_interval = POLL_INTERVAL_DEFAULT ;
1221
1225
1222
- input_dev = wistron_idev -> input ;
1223
- input_dev -> name = "Wistron laptop buttons" ;
1224
- input_dev -> phys = "wistron/input0" ;
1225
- input_dev -> id .bustype = BUS_HOST ;
1226
- input_dev -> dev .parent = & wistron_device -> dev ;
1226
+ error = sparse_keymap_setup (wistron_idev , keymap , wistron_setup_keymap );
1227
+ if (error )
1228
+ goto err_free_dev ;
1227
1229
1228
- error = sparse_keymap_setup ( input_dev , keymap , wistron_setup_keymap );
1230
+ error = input_setup_polling ( wistron_idev , wistron_poll );
1229
1231
if (error )
1230
1232
goto err_free_dev ;
1231
1233
1232
- error = input_register_polled_device (wistron_idev );
1234
+ input_set_poll_interval (wistron_idev , POLL_INTERVAL_DEFAULT );
1235
+
1236
+ error = input_register_device (wistron_idev );
1233
1237
if (error )
1234
1238
goto err_free_dev ;
1235
1239
1236
1240
return 0 ;
1237
1241
1238
1242
err_free_dev :
1239
- input_free_polled_device (wistron_idev );
1243
+ input_free_device (wistron_idev );
1240
1244
return error ;
1241
1245
}
1242
1246
@@ -1285,8 +1289,7 @@ static int wistron_probe(struct platform_device *dev)
1285
1289
static int wistron_remove (struct platform_device * dev )
1286
1290
{
1287
1291
wistron_led_remove ();
1288
- input_unregister_polled_device (wistron_idev );
1289
- input_free_polled_device (wistron_idev );
1292
+ input_unregister_device (wistron_idev );
1290
1293
bios_detach ();
1291
1294
1292
1295
return 0 ;
0 commit comments