From: Jonathan Cameron <jic23@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: linux-iio@vger.kernel.org, holler@ahsoftware.de
Subject: Re: [PATCH] HID RTC: Open sensor hub open close
Date: Tue, 01 Oct 2013 22:11:12 +0100 [thread overview]
Message-ID: <524B3A70.6000503@kernel.org> (raw)
In-Reply-To: <1380644532-29927-1-git-send-email-srinivas.pandruvada@linux.intel.com>
On 10/01/13 17:22, Srinivas Pandruvada wrote:
> Open sensor hub when module is loaded and close when module is removed.
> This helps saving power by opening HID transport only when there is an
> user.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Applied to the togreg branch of iio.git
Thanks
> ---
> drivers/rtc/rtc-hid-sensor-time.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c
> index 4e2a818..45560ff 100644
> --- a/drivers/rtc/rtc-hid-sensor-time.c
> +++ b/drivers/rtc/rtc-hid-sensor-time.c
> @@ -275,6 +275,12 @@ static int hid_time_probe(struct platform_device *pdev)
> return ret;
> }
>
> + ret = sensor_hub_device_open(hsdev);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to open sensor hub device!\n");
> + goto err_open;
> + }
> +
> time_state->rtc = devm_rtc_device_register(&pdev->dev,
> "hid-sensor-time", &hid_time_rtc_ops,
> THIS_MODULE);
> @@ -282,17 +288,24 @@ static int hid_time_probe(struct platform_device *pdev)
> if (IS_ERR_OR_NULL(time_state->rtc)) {
> ret = time_state->rtc ? PTR_ERR(time_state->rtc) : -ENODEV;
> time_state->rtc = NULL;
> - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME);
> dev_err(&pdev->dev, "rtc device register failed!\n");
> + goto err_rtc;
> }
>
> return ret;
> +
> +err_rtc:
> + sensor_hub_device_close(hsdev);
> +err_open:
> + sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME);
> + return ret;
> }
>
> static int hid_time_remove(struct platform_device *pdev)
> {
> struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
>
> + sensor_hub_device_close(hsdev);
> sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME);
>
> return 0;
>
prev parent reply other threads:[~2013-10-01 20:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-01 16:22 [PATCH] HID RTC: Open sensor hub open close Srinivas Pandruvada
2013-10-01 21:11 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=524B3A70.6000503@kernel.org \
--to=jic23@kernel.org \
--cc=holler@ahsoftware.de \
--cc=linux-iio@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).