mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alexander Holler <holler@ahsoftware.de>
Cc: linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>
Subject: Re: [PATCH 2/2 RESEND] rtc: rtc-hid-sensor-time: enable HID input processing early
Date: Thu, 8 Aug 2013 15:11:06 -0700	[thread overview]
Message-ID: <20130808151106.7ccaedd4ea3d4e5faa6aa220@linux-foundation.org> (raw)
In-Reply-To: <1375382342-25454-2-git-send-email-holler@ahsoftware.de>

On Thu,  1 Aug 2013 20:39:02 +0200 Alexander Holler <holler@ahsoftware.de> wrote:

> Enable the processing of HID input records before the RTC will be registered,
> in order to allow the RTC register function to read clock. Without doing
> that the clock can only be read after the probe function has finished.
> 
> Signed-off-by: Alexander Holler <holler@ahsoftware.de>
> ---
>  drivers/rtc/rtc-hid-sensor-time.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c
> index 1ab3d13..1006a62 100644
> --- a/drivers/rtc/rtc-hid-sensor-time.c
> +++ b/drivers/rtc/rtc-hid-sensor-time.c
> @@ -279,11 +279,18 @@ static int hid_time_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	/*
> +	 * Enable HID input processing early in order to be able to read the
> +	 * clock already in devm_rtc_device_register().
> +	 */
> +	hid_device_io_start(hsdev->hdev);
> +
>  	time_state->rtc = devm_rtc_device_register(&pdev->dev,
>  					"hid-sensor-time", &hid_time_rtc_ops,
>  					THIS_MODULE);
>  
>  	if (IS_ERR_OR_NULL(time_state->rtc)) {
> +		hid_device_io_stop(hsdev->hdev);
>  		ret = time_state->rtc ? PTR_ERR(time_state->rtc) : -ENODEV;
>  		time_state->rtc = NULL;
>  		sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME);

Shouldn't now there be a hid_device_io_stop() in hid_time_remove()?

Also, hid_device_io_start() does a weird up() on a
downed-by-someone-else semaphore.  Where was that down() performed in
this case?

Also, your changelog implies that the kernel is already doing this
hid_device_io_start(), only it does it too late.  If that is the case
then will the existing-before-this-patch call to hid_device_io_start()
generate the "io already started" warning?


  reply	other threads:[~2013-08-08 22:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 18:39 [PATCH 1/2 RESEND] rtc: rtc-hid-sensor-time: improve error handling when rtc register fails Alexander Holler
2013-08-01 18:39 ` [PATCH 2/2 RESEND] rtc: rtc-hid-sensor-time: enable HID input processing early Alexander Holler
2013-08-08 22:11   ` Andrew Morton [this message]
2013-08-09  9:45     ` [rtc-linux] " Alexander Holler
2013-08-09 11:12       ` Jiri Kosina
2013-08-09 16:21         ` Alexander Holler
2013-08-09 16:33           ` Alexander Holler
2013-08-09 17:02             ` David Herrmann
2013-08-09 17:10               ` Alexander Holler

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=20130808151106.7ccaedd4ea3d4e5faa6aa220@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.zummo@towertech.it \
    --cc=holler@ahsoftware.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.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

Powered by JetHome