Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: use input_device_enabled()

Use the newly added helper in relevant input drivers.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Andrzej Pietrasiewicz and committed by
Dmitry Torokhov
d69f0a43 39be39ce

+96 -90
+1 -1
drivers/input/input-poller.c
··· 166 166 167 167 poller->poll_interval = interval; 168 168 169 - if (input->users) { 169 + if (input_device_enabled(input)) { 170 170 cancel_delayed_work_sync(&poller->work); 171 171 if (poller->poll_interval > 0) 172 172 input_dev_poller_queue_work(poller);
+2 -2
drivers/input/joystick/xpad.c
··· 1902 1902 xpad360w_poweroff_controller(xpad); 1903 1903 } else { 1904 1904 mutex_lock(&input->mutex); 1905 - if (input->users) 1905 + if (input_device_enabled(input)) 1906 1906 xpad_stop_input(xpad); 1907 1907 mutex_unlock(&input->mutex); 1908 1908 } ··· 1922 1922 retval = xpad360w_start_input(xpad); 1923 1923 } else { 1924 1924 mutex_lock(&input->mutex); 1925 - if (input->users) { 1925 + if (input_device_enabled(input)) { 1926 1926 retval = xpad_start_input(xpad); 1927 1927 } else if (xpad->xtype == XTYPE_XBOXONE) { 1928 1928 /*
+1 -1
drivers/input/keyboard/ep93xx_keypad.c
··· 208 208 209 209 mutex_lock(&input_dev->mutex); 210 210 211 - if (input_dev->users) { 211 + if (input_device_enabled(input_dev)) { 212 212 if (!keypad->enabled) { 213 213 ep93xx_keypad_config(keypad); 214 214 clk_enable(keypad->clk);
+2 -2
drivers/input/keyboard/gpio_keys.c
··· 965 965 return error; 966 966 } else { 967 967 mutex_lock(&input->mutex); 968 - if (input->users) 968 + if (input_device_enabled(input)) 969 969 gpio_keys_close(input); 970 970 mutex_unlock(&input->mutex); 971 971 } ··· 983 983 gpio_keys_disable_wakeup(ddata); 984 984 } else { 985 985 mutex_lock(&input->mutex); 986 - if (input->users) 986 + if (input_device_enabled(input)) 987 987 error = gpio_keys_open(input); 988 988 mutex_unlock(&input->mutex); 989 989 }
+2 -2
drivers/input/keyboard/imx_keypad.c
··· 532 532 /* imx kbd can wake up system even clock is disabled */ 533 533 mutex_lock(&input_dev->mutex); 534 534 535 - if (input_dev->users) 535 + if (input_device_enabled(input_dev)) 536 536 clk_disable_unprepare(kbd->clk); 537 537 538 538 mutex_unlock(&input_dev->mutex); ··· 562 562 563 563 mutex_lock(&input_dev->mutex); 564 564 565 - if (input_dev->users) { 565 + if (input_device_enabled(input_dev)) { 566 566 ret = clk_prepare_enable(kbd->clk); 567 567 if (ret) 568 568 goto err_clk;
+1 -1
drivers/input/keyboard/ipaq-micro-keys.c
··· 140 140 141 141 mutex_lock(&input->mutex); 142 142 143 - if (input->users) 143 + if (input_device_enabled(input)) 144 144 micro_key_start(keys); 145 145 146 146 mutex_unlock(&input->mutex);
+2 -2
drivers/input/keyboard/lpc32xx-keys.c
··· 273 273 274 274 mutex_lock(&input->mutex); 275 275 276 - if (input->users) { 276 + if (input_device_enabled(input)) { 277 277 /* Clear IRQ and disable clock */ 278 278 writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); 279 279 clk_disable_unprepare(kscandat->clk); ··· 292 292 293 293 mutex_lock(&input->mutex); 294 294 295 - if (input->users) { 295 + if (input_device_enabled(input)) { 296 296 /* Enable clock and clear IRQ */ 297 297 retval = clk_prepare_enable(kscandat->clk); 298 298 if (retval == 0)
+2 -2
drivers/input/keyboard/pmic8xxx-keypad.c
··· 633 633 } else { 634 634 mutex_lock(&input_dev->mutex); 635 635 636 - if (input_dev->users) 636 + if (input_device_enabled(input_dev)) 637 637 pmic8xxx_kp_disable(kp); 638 638 639 639 mutex_unlock(&input_dev->mutex); ··· 653 653 } else { 654 654 mutex_lock(&input_dev->mutex); 655 655 656 - if (input_dev->users) 656 + if (input_device_enabled(input_dev)) 657 657 pmic8xxx_kp_enable(kp); 658 658 659 659 mutex_unlock(&input_dev->mutex);
+1 -1
drivers/input/keyboard/pxa27x_keypad.c
··· 694 694 } else { 695 695 mutex_lock(&input_dev->mutex); 696 696 697 - if (input_dev->users) { 697 + if (input_device_enabled(input_dev)) { 698 698 /* Enable unit clock */ 699 699 ret = clk_prepare_enable(keypad->clk); 700 700 if (!ret)
+2 -2
drivers/input/keyboard/samsung-keypad.c
··· 536 536 537 537 mutex_lock(&input_dev->mutex); 538 538 539 - if (input_dev->users) 539 + if (input_device_enabled(input_dev)) 540 540 samsung_keypad_stop(keypad); 541 541 542 542 samsung_keypad_toggle_wakeup(keypad, true); ··· 556 556 557 557 samsung_keypad_toggle_wakeup(keypad, false); 558 558 559 - if (input_dev->users) 559 + if (input_device_enabled(input_dev)) 560 560 samsung_keypad_start(keypad); 561 561 562 562 mutex_unlock(&input_dev->mutex);
+4 -4
drivers/input/keyboard/spear-keyboard.c
··· 318 318 writel_relaxed(val, kbd->io_base + MODE_CTL_REG); 319 319 320 320 } else { 321 - if (input_dev->users) { 321 + if (input_device_enabled(input_dev)) { 322 322 writel_relaxed(mode_ctl_reg & ~MODE_CTL_START_SCAN, 323 323 kbd->io_base + MODE_CTL_REG); 324 324 clk_disable(kbd->clk); ··· 326 326 } 327 327 328 328 /* store current configuration */ 329 - if (input_dev->users) 329 + if (input_device_enabled(input_dev)) 330 330 kbd->mode_ctl_reg = mode_ctl_reg; 331 331 332 332 /* restore previous clk state */ ··· 351 351 disable_irq_wake(kbd->irq); 352 352 } 353 353 } else { 354 - if (input_dev->users) 354 + if (input_device_enabled(input_dev)) 355 355 clk_enable(kbd->clk); 356 356 } 357 357 358 358 /* restore current configuration */ 359 - if (input_dev->users) 359 + if (input_device_enabled(input_dev)) 360 360 writel_relaxed(kbd->mode_ctl_reg, kbd->io_base + MODE_CTL_REG); 361 361 362 362 mutex_unlock(&input_dev->mutex);
+2 -2
drivers/input/keyboard/st-keyscan.c
··· 221 221 222 222 if (device_may_wakeup(dev)) 223 223 enable_irq_wake(keypad->irq); 224 - else if (input->users) 224 + else if (input_device_enabled(input)) 225 225 keyscan_stop(keypad); 226 226 227 227 mutex_unlock(&input->mutex); ··· 239 239 240 240 if (device_may_wakeup(dev)) 241 241 disable_irq_wake(keypad->irq); 242 - else if (input->users) 242 + else if (input_device_enabled(input)) 243 243 retval = keyscan_start(keypad); 244 244 245 245 mutex_unlock(&input->mutex);
+2 -2
drivers/input/keyboard/tegra-kbc.c
··· 756 756 enable_irq(kbc->irq); 757 757 enable_irq_wake(kbc->irq); 758 758 } else { 759 - if (kbc->idev->users) 759 + if (input_device_enabled(kbc->idev)) 760 760 tegra_kbc_stop(kbc); 761 761 } 762 762 mutex_unlock(&kbc->idev->mutex); ··· 796 796 input_sync(kbc->idev); 797 797 } 798 798 } else { 799 - if (kbc->idev->users) 799 + if (input_device_enabled(kbc->idev)) 800 800 err = tegra_kbc_start(kbc); 801 801 } 802 802 mutex_unlock(&kbc->idev->mutex);
+2 -2
drivers/input/misc/drv260x.c
··· 580 580 581 581 mutex_lock(&haptics->input_dev->mutex); 582 582 583 - if (haptics->input_dev->users) { 583 + if (input_device_enabled(haptics->input_dev)) { 584 584 ret = regmap_update_bits(haptics->regmap, 585 585 DRV260X_MODE, 586 586 DRV260X_STANDBY_MASK, ··· 612 612 613 613 mutex_lock(&haptics->input_dev->mutex); 614 614 615 - if (haptics->input_dev->users) { 615 + if (input_device_enabled(haptics->input_dev)) { 616 616 ret = regulator_enable(haptics->regulator); 617 617 if (ret) { 618 618 dev_err(dev, "Failed to enable regulator\n");
+2 -2
drivers/input/misc/drv2665.c
··· 230 230 231 231 mutex_lock(&haptics->input_dev->mutex); 232 232 233 - if (haptics->input_dev->users) { 233 + if (input_device_enabled(haptics->input_dev)) { 234 234 ret = regmap_update_bits(haptics->regmap, DRV2665_CTRL_2, 235 235 DRV2665_STANDBY, DRV2665_STANDBY); 236 236 if (ret) { ··· 259 259 260 260 mutex_lock(&haptics->input_dev->mutex); 261 261 262 - if (haptics->input_dev->users) { 262 + if (input_device_enabled(haptics->input_dev)) { 263 263 ret = regulator_enable(haptics->regulator); 264 264 if (ret) { 265 265 dev_err(dev, "Failed to enable regulator\n");
+2 -2
drivers/input/misc/drv2667.c
··· 407 407 408 408 mutex_lock(&haptics->input_dev->mutex); 409 409 410 - if (haptics->input_dev->users) { 410 + if (input_device_enabled(haptics->input_dev)) { 411 411 ret = regmap_update_bits(haptics->regmap, DRV2667_CTRL_2, 412 412 DRV2667_STANDBY, DRV2667_STANDBY); 413 413 if (ret) { ··· 436 436 437 437 mutex_lock(&haptics->input_dev->mutex); 438 438 439 - if (haptics->input_dev->users) { 439 + if (input_device_enabled(haptics->input_dev)) { 440 440 ret = regulator_enable(haptics->regulator); 441 441 if (ret) { 442 442 dev_err(dev, "Failed to enable regulator\n");
+2 -2
drivers/input/misc/kxtj9.c
··· 503 503 504 504 mutex_lock(&input_dev->mutex); 505 505 506 - if (input_dev->users) 506 + if (input_device_enabled(input_dev)) 507 507 kxtj9_disable(tj9); 508 508 509 509 mutex_unlock(&input_dev->mutex); ··· 518 518 519 519 mutex_lock(&input_dev->mutex); 520 520 521 - if (input_dev->users) 521 + if (input_device_enabled(input_dev)) 522 522 kxtj9_enable(tj9); 523 523 524 524 mutex_unlock(&input_dev->mutex);
+1 -1
drivers/input/misc/sirfsoc-onkey.c
··· 181 181 * if users touch X_ONKEY_B, see arch/arm/mach-prima2/pm.c 182 182 */ 183 183 mutex_lock(&input->mutex); 184 - if (input->users) 184 + if (input_device_enabled(input)) 185 185 sirfsoc_pwrc_toggle_interrupts(pwrcdrv, true); 186 186 mutex_unlock(&input->mutex); 187 187
+3 -3
drivers/input/mouse/cyapa.c
··· 526 526 { 527 527 struct input_dev *input = cyapa->input; 528 528 529 - if (!input || !input->users) { 529 + if (!input || !input_device_enabled(input)) { 530 530 /* 531 531 * When input is NULL, TP must be in deep sleep mode. 532 532 * In this mode, later non-power I2C command will always failed ··· 546 546 { 547 547 struct input_dev *input = cyapa->input; 548 548 549 - if (!input || !input->users) { 549 + if (!input || !input_device_enabled(input)) { 550 550 if (cyapa->gen >= CYAPA_GEN5) 551 551 disable_irq(cyapa->client->irq); 552 552 if (!input || cyapa->operational) ··· 652 652 } 653 653 654 654 out: 655 - if (!input || !input->users) { 655 + if (!input || !input_device_enabled(input)) { 656 656 /* Reset to power OFF state to save power when no user open. */ 657 657 if (cyapa->operational) 658 658 cyapa->ops->set_power_mode(cyapa,
+2 -1
drivers/input/mouse/cyapa_gen3.c
··· 952 952 * doing so before issuing the next command may result in errors 953 953 * depending on the command's content. 954 954 */ 955 - if (cyapa->operational && input && input->users && 955 + if (cyapa->operational && 956 + input && input_device_enabled(input) && 956 957 (pm_stage == CYAPA_PM_RUNTIME_SUSPEND || 957 958 pm_stage == CYAPA_PM_RUNTIME_RESUME)) { 958 959 /* Try to polling in 120Hz, read may fail, just ignore it. */
+2 -1
drivers/input/mouse/cyapa_gen5.c
··· 518 518 *len = length; 519 519 /* Response found, success. */ 520 520 return 0; 521 - } else if (cyapa->operational && input && input->users && 521 + } else if (cyapa->operational && 522 + input && input_device_enabled(input) && 522 523 (pm_stage == CYAPA_PM_RUNTIME_RESUME || 523 524 pm_stage == CYAPA_PM_RUNTIME_SUSPEND)) { 524 525 /* Parse the data and report it if it's valid. */
+2 -2
drivers/input/mouse/navpoint.c
··· 322 322 struct input_dev *input = navpoint->input; 323 323 324 324 mutex_lock(&input->mutex); 325 - if (input->users) 325 + if (input_device_enabled(input)) 326 326 navpoint_down(navpoint); 327 327 mutex_unlock(&input->mutex); 328 328 ··· 336 336 struct input_dev *input = navpoint->input; 337 337 338 338 mutex_lock(&input->mutex); 339 - if (input->users) 339 + if (input_device_enabled(input)) 340 340 navpoint_up(navpoint); 341 341 mutex_unlock(&input->mutex); 342 342
+3 -3
drivers/input/touchscreen/ad7879.c
··· 306 306 307 307 mutex_lock(&ts->input->mutex); 308 308 309 - if (!ts->suspended && !ts->disabled && ts->input->users) 309 + if (!ts->suspended && !ts->disabled && input_device_enabled(ts->input)) 310 310 __ad7879_disable(ts); 311 311 312 312 ts->suspended = true; ··· 322 322 323 323 mutex_lock(&ts->input->mutex); 324 324 325 - if (ts->suspended && !ts->disabled && ts->input->users) 325 + if (ts->suspended && !ts->disabled && input_device_enabled(ts->input)) 326 326 __ad7879_enable(ts); 327 327 328 328 ts->suspended = false; ··· 339 339 { 340 340 mutex_lock(&ts->input->mutex); 341 341 342 - if (!ts->suspended && ts->input->users != 0) { 342 + if (!ts->suspended && input_device_enabled(ts->input)) { 343 343 344 344 if (disable) { 345 345 if (ts->disabled)
+2 -2
drivers/input/touchscreen/atmel_mxt_ts.c
··· 3237 3237 3238 3238 mutex_lock(&input_dev->mutex); 3239 3239 3240 - if (input_dev->users) 3240 + if (input_device_enabled(input_dev)) 3241 3241 mxt_stop(data); 3242 3242 3243 3243 mutex_unlock(&input_dev->mutex); ··· 3260 3260 3261 3261 mutex_lock(&input_dev->mutex); 3262 3262 3263 - if (input_dev->users) 3263 + if (input_device_enabled(input_dev)) 3264 3264 mxt_start(data); 3265 3265 3266 3266 mutex_unlock(&input_dev->mutex);
+4 -4
drivers/input/touchscreen/auo-pixcir-ts.c
··· 414 414 */ 415 415 if (device_may_wakeup(&client->dev)) { 416 416 /* need to start device if not open, to be wakeup source */ 417 - if (!input->users) { 417 + if (!input_device_enabled(input)) { 418 418 ret = auo_pixcir_start(ts); 419 419 if (ret) 420 420 goto unlock; ··· 422 422 423 423 enable_irq_wake(client->irq); 424 424 ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_SLEEP); 425 - } else if (input->users) { 425 + } else if (input_device_enabled(input)) { 426 426 ret = auo_pixcir_stop(ts); 427 427 } 428 428 ··· 445 445 disable_irq_wake(client->irq); 446 446 447 447 /* need to stop device if it was not open on suspend */ 448 - if (!input->users) { 448 + if (!input_device_enabled(input)) { 449 449 ret = auo_pixcir_stop(ts); 450 450 if (ret) 451 451 goto unlock; 452 452 } 453 453 454 454 /* device wakes automatically from SLEEP */ 455 - } else if (input->users) { 455 + } else if (input_device_enabled(input)) { 456 456 ret = auo_pixcir_start(ts); 457 457 } 458 458
+2 -2
drivers/input/touchscreen/bu21029_ts.c
··· 430 430 431 431 if (!device_may_wakeup(dev)) { 432 432 mutex_lock(&bu21029->in_dev->mutex); 433 - if (bu21029->in_dev->users) 433 + if (input_device_enabled(bu21029->in_dev)) 434 434 bu21029_stop_chip(bu21029->in_dev); 435 435 mutex_unlock(&bu21029->in_dev->mutex); 436 436 } ··· 445 445 446 446 if (!device_may_wakeup(dev)) { 447 447 mutex_lock(&bu21029->in_dev->mutex); 448 - if (bu21029->in_dev->users) 448 + if (input_device_enabled(bu21029->in_dev)) 449 449 bu21029_start_chip(bu21029->in_dev); 450 450 mutex_unlock(&bu21029->in_dev->mutex); 451 451 }
+2 -2
drivers/input/touchscreen/chipone_icn8318.c
··· 154 154 struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); 155 155 156 156 mutex_lock(&data->input->mutex); 157 - if (data->input->users) 157 + if (input_device_enabled(data->input)) 158 158 icn8318_stop(data->input); 159 159 mutex_unlock(&data->input->mutex); 160 160 ··· 166 166 struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); 167 167 168 168 mutex_lock(&data->input->mutex); 169 - if (data->input->users) 169 + if (input_device_enabled(data->input)) 170 170 icn8318_start(data->input); 171 171 mutex_unlock(&data->input->mutex); 172 172
+2 -2
drivers/input/touchscreen/cyttsp_core.c
··· 479 479 480 480 mutex_lock(&ts->input->mutex); 481 481 482 - if (ts->input->users) { 482 + if (input_device_enabled(ts->input)) { 483 483 retval = cyttsp_disable(ts); 484 484 if (retval == 0) 485 485 ts->suspended = true; ··· 496 496 497 497 mutex_lock(&ts->input->mutex); 498 498 499 - if (ts->input->users) 499 + if (input_device_enabled(ts->input)) 500 500 cyttsp_enable(ts); 501 501 502 502 ts->suspended = false;
+2 -2
drivers/input/touchscreen/eeti_ts.c
··· 241 241 242 242 mutex_lock(&input_dev->mutex); 243 243 244 - if (input_dev->users) 244 + if (input_device_enabled(input_dev)) 245 245 eeti_ts_stop(eeti); 246 246 247 247 mutex_unlock(&input_dev->mutex); ··· 263 263 264 264 mutex_lock(&input_dev->mutex); 265 265 266 - if (input_dev->users) 266 + if (input_device_enabled(input_dev)) 267 267 eeti_ts_start(eeti); 268 268 269 269 mutex_unlock(&input_dev->mutex);
+2 -2
drivers/input/touchscreen/ektf2127.c
··· 182 182 struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev)); 183 183 184 184 mutex_lock(&ts->input->mutex); 185 - if (ts->input->users) 185 + if (input_device_enabled(ts->input)) 186 186 ektf2127_stop(ts->input); 187 187 mutex_unlock(&ts->input->mutex); 188 188 ··· 194 194 struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev)); 195 195 196 196 mutex_lock(&ts->input->mutex); 197 - if (ts->input->users) 197 + if (input_device_enabled(ts->input)) 198 198 ektf2127_start(ts->input); 199 199 mutex_unlock(&ts->input->mutex); 200 200
+2 -2
drivers/input/touchscreen/imx6ul_tsc.c
··· 520 520 521 521 mutex_lock(&input_dev->mutex); 522 522 523 - if (input_dev->users) 523 + if (input_device_enabled(input_dev)) 524 524 imx6ul_tsc_stop(tsc); 525 525 526 526 mutex_unlock(&input_dev->mutex); ··· 537 537 538 538 mutex_lock(&input_dev->mutex); 539 539 540 - if (input_dev->users) 540 + if (input_device_enabled(input_dev)) 541 541 retval = imx6ul_tsc_start(tsc); 542 542 543 543 mutex_unlock(&input_dev->mutex);
+1 -1
drivers/input/touchscreen/ipaq-micro-ts.c
··· 135 135 136 136 mutex_lock(&input->mutex); 137 137 138 - if (input->users) 138 + if (input_device_enabled(input)) 139 139 micro_ts_toggle_receive(ts, true); 140 140 141 141 mutex_unlock(&input->mutex);
+2 -2
drivers/input/touchscreen/iqs5xx.c
··· 1017 1017 1018 1018 mutex_lock(&input->mutex); 1019 1019 1020 - if (input->users) 1020 + if (input_device_enabled(input)) 1021 1021 error = iqs5xx_set_state(iqs5xx->client, IQS5XX_SUSPEND); 1022 1022 1023 1023 mutex_unlock(&input->mutex); ··· 1036 1036 1037 1037 mutex_lock(&input->mutex); 1038 1038 1039 - if (input->users) 1039 + if (input_device_enabled(input)) 1040 1040 error = iqs5xx_set_state(iqs5xx->client, IQS5XX_RESUME); 1041 1041 1042 1042 mutex_unlock(&input->mutex);
+2 -2
drivers/input/touchscreen/lpc32xx_ts.c
··· 334 334 */ 335 335 mutex_lock(&input->mutex); 336 336 337 - if (input->users) { 337 + if (input_device_enabled(input)) { 338 338 if (device_may_wakeup(dev)) 339 339 enable_irq_wake(tsc->irq); 340 340 else ··· 353 353 354 354 mutex_lock(&input->mutex); 355 355 356 - if (input->users) { 356 + if (input_device_enabled(input)) { 357 357 if (device_may_wakeup(dev)) 358 358 disable_irq_wake(tsc->irq); 359 359 else
+4 -4
drivers/input/touchscreen/melfas_mip4.c
··· 1256 1256 if (error) 1257 1257 return error; 1258 1258 1259 - if (ts->input->users) { 1259 + if (input_device_enabled(ts->input)) { 1260 1260 disable_irq(ts->client->irq); 1261 1261 } else { 1262 1262 error = mip4_power_on(ts); ··· 1276 1276 "Failed to flash firmware: %d\n", error); 1277 1277 1278 1278 /* Enable IRQ */ 1279 - if (ts->input->users) 1279 + if (input_device_enabled(ts->input)) 1280 1280 enable_irq(ts->client->irq); 1281 1281 else 1282 1282 mip4_power_off(ts); ··· 1539 1539 1540 1540 if (device_may_wakeup(dev)) 1541 1541 ts->wake_irq_enabled = enable_irq_wake(client->irq) == 0; 1542 - else if (input->users) 1542 + else if (input_device_enabled(input)) 1543 1543 mip4_disable(ts); 1544 1544 1545 1545 mutex_unlock(&input->mutex); ··· 1557 1557 1558 1558 if (ts->wake_irq_enabled) 1559 1559 disable_irq_wake(client->irq); 1560 - else if (input->users) 1560 + else if (input_device_enabled(input)) 1561 1561 mip4_enable(ts); 1562 1562 1563 1563 mutex_unlock(&input->mutex);
+3 -3
drivers/input/touchscreen/mms114.c
··· 199 199 int error; 200 200 201 201 mutex_lock(&input_dev->mutex); 202 - if (!input_dev->users) { 202 + if (!input_device_enabled(input_dev)) { 203 203 mutex_unlock(&input_dev->mutex); 204 204 goto out; 205 205 } ··· 564 564 input_sync(input_dev); 565 565 566 566 mutex_lock(&input_dev->mutex); 567 - if (input_dev->users) 567 + if (input_device_enabled(input_dev)) 568 568 mms114_stop(data); 569 569 mutex_unlock(&input_dev->mutex); 570 570 ··· 579 579 int error; 580 580 581 581 mutex_lock(&input_dev->mutex); 582 - if (input_dev->users) { 582 + if (input_device_enabled(input_dev)) { 583 583 error = mms114_start(data); 584 584 if (error < 0) { 585 585 mutex_unlock(&input_dev->mutex);
+4 -4
drivers/input/touchscreen/pixcir_i2c_ts.c
··· 415 415 mutex_lock(&input->mutex); 416 416 417 417 if (device_may_wakeup(&client->dev)) { 418 - if (!input->users) { 418 + if (!input_device_enabled(input)) { 419 419 ret = pixcir_start(ts); 420 420 if (ret) { 421 421 dev_err(dev, "Failed to start\n"); 422 422 goto unlock; 423 423 } 424 424 } 425 - } else if (input->users) { 425 + } else if (input_device_enabled(input)) { 426 426 ret = pixcir_stop(ts); 427 427 } 428 428 ··· 442 442 mutex_lock(&input->mutex); 443 443 444 444 if (device_may_wakeup(&client->dev)) { 445 - if (!input->users) { 445 + if (!input_device_enabled(input)) { 446 446 ret = pixcir_stop(ts); 447 447 if (ret) { 448 448 dev_err(dev, "Failed to stop\n"); 449 449 goto unlock; 450 450 } 451 451 } 452 - } else if (input->users) { 452 + } else if (input_device_enabled(input)) { 453 453 ret = pixcir_start(ts); 454 454 } 455 455
+2 -2
drivers/input/touchscreen/ucb1400_ts.c
··· 410 410 411 411 mutex_lock(&idev->mutex); 412 412 413 - if (idev->users) 413 + if (input_device_enabled(idev)) 414 414 ucb1400_ts_stop(ucb); 415 415 416 416 mutex_unlock(&idev->mutex); ··· 424 424 425 425 mutex_lock(&idev->mutex); 426 426 427 - if (idev->users) 427 + if (input_device_enabled(idev)) 428 428 ucb1400_ts_start(ucb); 429 429 430 430 mutex_unlock(&idev->mutex);
+9 -5
drivers/input/touchscreen/wm97xx-core.c
··· 806 806 else 807 807 suspend_mode = 0; 808 808 809 - if (wm->input_dev->users) 809 + mutex_lock(&wm->input_dev->mutex); 810 + if (input_device_enabled(wm->input_dev)) 810 811 cancel_delayed_work_sync(&wm->ts_reader); 811 812 812 813 /* Power down the digitiser (bypassing the cache for resume) */ 813 814 reg = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER2); 814 815 reg &= ~WM97XX_PRP_DET_DIG; 815 - if (wm->input_dev->users) 816 + if (input_device_enabled(wm->input_dev)) 816 817 reg |= suspend_mode; 817 818 wm->ac97->bus->ops->write(wm->ac97, AC97_WM97XX_DIGITISER2, reg); 818 819 819 820 /* WM9713 has an additional power bit - turn it off if there 820 821 * are no users or if suspend mode is zero. */ 821 822 if (wm->id == WM9713_ID2 && 822 - (!wm->input_dev->users || !suspend_mode)) { 823 + (!input_device_enabled(wm->input_dev) || !suspend_mode)) { 823 824 reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) | 0x8000; 824 825 wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg); 825 826 } 827 + mutex_unlock(&wm->input_dev->mutex); 826 828 827 829 return 0; 828 830 } ··· 833 831 { 834 832 struct wm97xx *wm = dev_get_drvdata(dev); 835 833 834 + mutex_lock(&wm->input_dev->mutex); 836 835 /* restore digitiser and gpios */ 837 836 if (wm->id == WM9713_ID2) { 838 837 wm97xx_reg_write(wm, AC97_WM9713_DIG1, wm->dig[0]); 839 838 wm97xx_reg_write(wm, 0x5a, wm->misc); 840 - if (wm->input_dev->users) { 839 + if (input_device_enabled(wm->input_dev)) { 841 840 u16 reg; 842 841 reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) & 0x7fff; 843 842 wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg); ··· 855 852 wm97xx_reg_write(wm, AC97_GPIO_STATUS, wm->gpio[4]); 856 853 wm97xx_reg_write(wm, AC97_MISC_AFE, wm->gpio[5]); 857 854 858 - if (wm->input_dev->users && !wm->pen_irq) { 855 + if (input_device_enabled(wm->input_dev) && !wm->pen_irq) { 859 856 wm->ts_reader_interval = wm->ts_reader_min_interval; 860 857 queue_delayed_work(wm->ts_workq, &wm->ts_reader, 861 858 wm->ts_reader_interval); 862 859 } 860 + mutex_unlock(&wm->input_dev->mutex); 863 861 864 862 return 0; 865 863 }
+4 -4
drivers/input/touchscreen/zforce_ts.c
··· 626 626 dev_dbg(&client->dev, "suspend while being a wakeup source\n"); 627 627 628 628 /* Need to start device, if not open, to be a wakeup source. */ 629 - if (!input->users) { 629 + if (!input_device_enabled(input)) { 630 630 ret = zforce_start(ts); 631 631 if (ret) 632 632 goto unlock; 633 633 } 634 634 635 635 enable_irq_wake(client->irq); 636 - } else if (input->users) { 636 + } else if (input_device_enabled(input)) { 637 637 dev_dbg(&client->dev, 638 638 "suspend without being a wakeup source\n"); 639 639 ··· 670 670 disable_irq_wake(client->irq); 671 671 672 672 /* need to stop device if it was not open on suspend */ 673 - if (!input->users) { 673 + if (!input_device_enabled(input)) { 674 674 ret = zforce_stop(ts); 675 675 if (ret) 676 676 goto unlock; 677 677 } 678 - } else if (input->users) { 678 + } else if (input_device_enabled(input)) { 679 679 dev_dbg(&client->dev, "resume without being a wakeup source\n"); 680 680 681 681 enable_irq(client->irq);
+2 -2
drivers/input/touchscreen/zinitix.c
··· 532 532 533 533 mutex_lock(&bt541->input_dev->mutex); 534 534 535 - if (bt541->input_dev->users) 535 + if (input_device_enabled(bt541->input_dev)) 536 536 zinitix_stop(bt541); 537 537 538 538 mutex_unlock(&bt541->input_dev->mutex); ··· 548 548 549 549 mutex_lock(&bt541->input_dev->mutex); 550 550 551 - if (bt541->input_dev->users) 551 + if (input_device_enabled(bt541->input_dev)) 552 552 ret = zinitix_start(bt541); 553 553 554 554 mutex_unlock(&bt541->input_dev->mutex);