linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Andrew de los Reyes <andrew-vger@gizmolabs.org>
Cc: Linux Input <linux-input@vger.kernel.org>, Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH] HID: Separate struct hid_device's driver_lock into two locks.
Date: Mon, 26 Nov 2012 18:56:27 +0100	[thread overview]
Message-ID: <20121126185627.7bff1f84@neptune.home> (raw)
In-Reply-To: <CAG_cf+cXnNSyxcrsZncfr2KKFRhiCJ60vHrTt3_aB-Bc7m5eVw@mail.gmail.com>

Hi Andrew,

[CCing David Herrmann]


On Sun, 25 November 2012 Andrew de los Reyes wrote:
> Benjamin Tissoires and Nestor Lopez Casado have been helping me to add
> Linux support for new Logitech Touch Mice (T620, T400). After running
> into a road-block in hid-core, and solving it with this patch, we
> thought it was good to show the community and see if this is okay, or
> if there's a better solution that we've missed.
> 
> Thanks for your comments,
> -andrew
> 
> This patch separates struct hid_device's driver_lock into two. The
> goal is to allow hid device drivers to receive input during their
> probe() function call. This is necessary because some drivers need to
> communicate with the device to determine parameters needed during
> probe (e.g., size of a multi-touch surface).
> 
> Historically, three functions used driver_lock:
> 
> - hid_device_probe: blocks to acquire lock
> - hid_device_remove: blocks to acquire lock
> - hid_input_report: if locked returns -EBUSY, else acquires lock
> 
> This patch adds another lock (driver_input_lock) which is used to
> block input from occurring. The lock behavior is now:
> 
> - hid_device_probe: blocks to acq. driver_lock, then driver_input_lock
> - hid_device_remove: blocks to acq. driver_lock, then driver_input_lock
> - hid_input_report: if driver_input_lock locked returns -EBUSY, else
>   acquires driver_input_lock
> 
> This results in no behavior change for existing devices and
> drivers. However, during a probe() function call in a driver, that
> driver may now selectively unlock driver_input_lock to let input
> events come through, then re-lock.

That is more or less a new approach to release the restriction added in
commit 4ea5454203d991ec85264f64f89ca8855fce69b0
(HID: Fix race condition between driver core and ll-driver).

>From your suggested change the question could be if releasing the input
lock should be connected to hw_start() / hw_stop() calls...

Though connecting those together would certainly require some review of
existing drivers in order not to reopen the can of worms closed by above
mentioned commit.

Bruno

  reply	other threads:[~2012-11-26 18:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-25 18:48 [PATCH] HID: Separate struct hid_device's driver_lock into two locks Andrew de los Reyes
2012-11-26 17:56 ` Bruno Prémont [this message]
2012-11-26 18:34   ` Benjamin Tissoires
2012-11-26 18:54     ` David Herrmann
2012-11-26 20:50       ` Andrew de los Reyes
2012-12-04  8:04       ` Jiri Kosina
2012-12-03 13:17     ` Jiri Kosina
2012-12-03 17:53       ` Nestor Lopez Casado
2013-02-05 15:07         ` Jiri Kosina
2013-02-05 16:19           ` Nestor Lopez Casado
     [not found]             ` <CAG_cf+ev2y1MHNJFYZycbjQfNgk4hYYRaEoFsKkZyhzAzMgc1A@mail.gmail.com>
2013-02-05 17:22               ` David Herrmann
2013-02-05 17:50                 ` Nestor Lopez Casado
2013-02-06 15:10                 ` Jiri Kosina
2013-02-06 15:21                   ` David Herrmann
  -- strict thread matches above, loose matches on Subject: below --
2013-02-10 17:47 Andrew de los Reyes
2013-02-11 15:42 ` David Herrmann
2013-02-11 17:55   ` Bruno Prémont
2013-02-11 19:13     ` Andrew de los Reyes
2013-02-11 21:05       ` Bruno Prémont
2013-02-14  5:08     ` Andrew de los Reyes
2013-02-14  7:06       ` Bruno Prémont
2013-02-17  1:43         ` Andrew de los Reyes
2013-02-14  5:07 Andrew de los Reyes
2013-02-18 13:08 ` Jiri Kosina
2013-02-25 13:03   ` Jiri Kosina
2013-02-25 13:09     ` David Herrmann
2013-02-25 13:15       ` Jiri Kosina
2013-02-25 17:16         ` Andrew de los Reyes

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=20121126185627.7bff1f84@neptune.home \
    --to=bonbons@linux-vserver.org \
    --cc=andrew-vger@gizmolabs.org \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    /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).