aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-07 01:07:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-07 01:07:58 -0500
commit0b1e73ed225d8f7aeef96b74147215ca8b990dce (patch)
treec362e187e34b8c1302fc1e6e6767b8790d44ed03 /drivers/hid
parent56edff7529d0baa6d7b38b58f46631c7b9f4136e (diff)
parented5d6ca0038f274aada1244358ad89b7941bdcbf (diff)
Merge tag 'staging-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver update from Greg KH: "Here's the big drivers/staging/ update for 3.13-rc1. Nothing major here, just a _ton_ of fixes and cleanups, mostly driven by the new round of OPW applicants, but also there are lots of other people doing staging tree cleanups these days in order to help get the drivers into mergable shape. We also merge, and then revert, the ktap code, as Ingo and the other perf/ftrace developers feel it should go into the "real" part of the kernel with only a bit more work, so no need to put it in staging for now. All of this has been in linux-next for a while with no reported issues" * tag 'staging-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1045 commits) staging: drm/imx: fix return value check in ipu_add_subdevice_pdata() Staging: zram: Fix access of NULL pointer Staging: zram: Fix variable dereferenced before check Staging: rtl8187se: space prohibited before semicolon in r8185b_init.c Staging: rtl8187se: fix space prohibited after that open parenthesis '(' in r8185b_init.c Staging: rtl8187se: fix braces {} are not necessary for single statement blocks in r8185b_init.c Staging: rtl8187se: fix trailing whitespace in r8185b_init.c Staging: rtl8187se: fix please, no space before tabs in r8185b_init.c drivers/staging/nvec/Kconfig: remove trailing whitespace Staging: dwc2: Fix variable dereferenced before check Staging: xgifb: fix braces {} are not necessary for any arm of this statement staging: rtl8192e: remove unneeded semicolons staging: rtl8192e: use true and false for bool variables staging: ft1000: return values corrected in scram_start_dwnld staging: ft1000: change values of status return variable in write_dpram32_and_check staging: bcm: Remove unnecessary pointer casting imx-drm: ipuv3-crtc: Invert IPU DI0 clock polarity staging: r8188eu: Fix sparse warnings in rtl_p2p.c staging: r8188eu: Fix sparse warnings in rtw_mlme_ext.c staging: r8188eu: Fix sparse warnings in rtl8188e.cmd.c ...
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-sensor-hub.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 10e1581022cf..88fc5aefcd96 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -465,6 +465,39 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
465 return 1; 465 return 1;
466} 466}
467 467
468int sensor_hub_device_open(struct hid_sensor_hub_device *hsdev)
469{
470 int ret = 0;
471 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
472
473 mutex_lock(&data->mutex);
474 if (!hsdev->ref_cnt) {
475 ret = hid_hw_open(hsdev->hdev);
476 if (ret) {
477 hid_err(hsdev->hdev, "failed to open hid device\n");
478 mutex_unlock(&data->mutex);
479 return ret;
480 }
481 }
482 hsdev->ref_cnt++;
483 mutex_unlock(&data->mutex);
484
485 return ret;
486}
487EXPORT_SYMBOL_GPL(sensor_hub_device_open);
488
489void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev)
490{
491 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
492
493 mutex_lock(&data->mutex);
494 hsdev->ref_cnt--;
495 if (!hsdev->ref_cnt)
496 hid_hw_close(hsdev->hdev);
497 mutex_unlock(&data->mutex);
498}
499EXPORT_SYMBOL_GPL(sensor_hub_device_close);
500
468static int sensor_hub_probe(struct hid_device *hdev, 501static int sensor_hub_probe(struct hid_device *hdev,
469 const struct hid_device_id *id) 502 const struct hid_device_id *id)
470{ 503{
@@ -506,12 +539,6 @@ static int sensor_hub_probe(struct hid_device *hdev,
506 hid_err(hdev, "hw start failed\n"); 539 hid_err(hdev, "hw start failed\n");
507 return ret; 540 return ret;
508 } 541 }
509 ret = hid_hw_open(hdev);
510 if (ret) {
511 hid_err(hdev, "failed to open input interrupt pipe\n");
512 goto err_stop_hw;
513 }
514
515 INIT_LIST_HEAD(&sd->dyn_callback_list); 542 INIT_LIST_HEAD(&sd->dyn_callback_list);
516 sd->hid_sensor_client_cnt = 0; 543 sd->hid_sensor_client_cnt = 0;
517 report_enum = &hdev->report_enum[HID_INPUT_REPORT]; 544 report_enum = &hdev->report_enum[HID_INPUT_REPORT];
@@ -520,7 +547,7 @@ static int sensor_hub_probe(struct hid_device *hdev,
520 if (dev_cnt > HID_MAX_PHY_DEVICES) { 547 if (dev_cnt > HID_MAX_PHY_DEVICES) {
521 hid_err(hdev, "Invalid Physical device count\n"); 548 hid_err(hdev, "Invalid Physical device count\n");
522 ret = -EINVAL; 549 ret = -EINVAL;
523 goto err_close; 550 goto err_stop_hw;
524 } 551 }
525 sd->hid_sensor_hub_client_devs = kzalloc(dev_cnt * 552 sd->hid_sensor_hub_client_devs = kzalloc(dev_cnt *
526 sizeof(struct mfd_cell), 553 sizeof(struct mfd_cell),
@@ -528,7 +555,7 @@ static int sensor_hub_probe(struct hid_device *hdev,
528 if (sd->hid_sensor_hub_client_devs == NULL) { 555 if (sd->hid_sensor_hub_client_devs == NULL) {
529 hid_err(hdev, "Failed to allocate memory for mfd cells\n"); 556 hid_err(hdev, "Failed to allocate memory for mfd cells\n");
530 ret = -ENOMEM; 557 ret = -ENOMEM;
531 goto err_close; 558 goto err_stop_hw;
532 } 559 }
533 list_for_each_entry(report, &report_enum->report_list, list) { 560 list_for_each_entry(report, &report_enum->report_list, list) {
534 hid_dbg(hdev, "Report id:%x\n", report->id); 561 hid_dbg(hdev, "Report id:%x\n", report->id);
@@ -565,8 +592,6 @@ err_free_names:
565 for (i = 0; i < sd->hid_sensor_client_cnt ; ++i) 592 for (i = 0; i < sd->hid_sensor_client_cnt ; ++i)
566 kfree(sd->hid_sensor_hub_client_devs[i].name); 593 kfree(sd->hid_sensor_hub_client_devs[i].name);
567 kfree(sd->hid_sensor_hub_client_devs); 594 kfree(sd->hid_sensor_hub_client_devs);
568err_close:
569 hid_hw_close(hdev);
570err_stop_hw: 595err_stop_hw:
571 hid_hw_stop(hdev); 596 hid_hw_stop(hdev);
572 597