All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Henrique de Moraes Holschuh
	<hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>,
	Alan Jenkins
	<alan-jenkins-cCz0Lq7MMjm9FHfhHBbuYA@public.gmane.org>,
	ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Len Brown <lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH 10/10] thinkpad-acpi: sync input	device EV_SW state directly
Date: Thu, 10 Dec 2009 23:54:58 -0800	[thread overview]
Message-ID: <20091211075458.GB30274@core.coreip.homeip.net> (raw)
In-Reply-To: <20091211004602.GB24245-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>

On Thu, Dec 10, 2009 at 10:46:02PM -0200, Henrique de Moraes Holschuh wrote:
> On Thu, 10 Dec 2009, Dmitry Torokhov wrote:
> > Right, input_set_abs_params()... No, I don't really want to go through
> > all touchpad, touchscreen and joystick drivers at once, thank you vey
> > much ;) Besides, for the vast majority of uses 0 is the proper initial
> > value for absolute axis.
> 
> Heh.
> 
> > > The only other event that needs initialization are the switches, so I'd
> > > argue that we might as well use my proposed patch, which is specific and
> > > more lightweight, and convert the in-tree drivers to it.  A few might be
> > > missing the before-registering input_event...
> > 
> > As I think about it even more I think we should leave it asd is. You
> 
> It needs to be documented somewhere, at least.
> 

Something like the patch below?

> > > BTW, looking at input.h, wouldn't it be better to force the init functions
> > > to be run before registering the input device, doing a BUG_ON() if they're
> > > misused?
> > 
> > What function are you referring to? Input devices are in useable state
> 
> The ones proposed in this subthread, which shouldn't be used after
> registering.
> 
> > as returned by input_allocate_device().
> 
> Unless, of course, someone screws up verifying if input_alocate_device
> returned NULL...
> 

Then it will crash way before registering, as soon as they try to set
name, phys and so on.. Just not worh it.

-- 
Dmitry

Input: document use of input_event() function

From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Signed-off-by: Dmitry Torokhov <dtor-JGs/UdohzUI@public.gmane.org>
---

 drivers/input/input.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


diff --git a/drivers/input/input.c b/drivers/input/input.c
index e097176..6240c7a 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -302,9 +302,15 @@ static void input_handle_event(struct input_dev *dev,
  * @value: value of the event
  *
  * This function should be used by drivers implementing various input
- * devices. See also input_inject_event().
+ * devices to report input events. See also input_inject_event().
+ *
+ * NOTE: input_event() may be safely used right after input device was
+ * allocated with input_allocate_device(), even before it is registered
+ * with input_register_device(), but the event will not reach any of the
+ * input handlers. Such early invocation of input_event() may be used
+ * to 'seed' initial state of a switch or initial position of absolute
+ * axis, etc.
  */
-
 void input_event(struct input_dev *dev,
 		 unsigned int type, unsigned int code, int value)
 {

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

  parent reply	other threads:[~2009-12-11  7:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09  1:36 [GIT PATCH v2] thinkpad-acpi first set of changes for 2.6.33 (v2) Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 01/10] thinkpad-acpi: fix default brightness_mode for R50e/R51 Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 02/10] thinkpad-acpi: preserve rfkill state across suspend/resume Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 03/10] thinkpad-acpi: fix some version quirks Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 04/10] thinkpad-acpi: issue backlight class events Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 05/10] thinkpad-acpi: silence bogus complain during rmmod Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 06/10] thinkpad-acpi: adopt input device Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 07/10] thinkpad-acpi: expose module parameters Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 08/10] thinkpad-acpi: log temperatures on termal alarm (v2) Henrique de Moraes Holschuh
2009-12-09 10:46   ` Pavel Machek
2009-12-09  1:36 ` [PATCH 09/10] thinkpad-acpi: use input_set_capability Henrique de Moraes Holschuh
2009-12-09  1:36 ` [PATCH 10/10] thinkpad-acpi: sync input device EV_SW state directly Henrique de Moraes Holschuh
     [not found]   ` <1260322590-5571-11-git-send-email-hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
2009-12-09  1:45     ` Dmitry Torokhov
2009-12-09 16:30       ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
     [not found]         ` <20091209163041.GA29575-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2009-12-09 17:21           ` Dmitry Torokhov
2009-12-09 20:32             ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
2009-12-09 20:59               ` Dmitry Torokhov
2009-12-10 13:19                 ` Henrique de Moraes Holschuh
2009-12-10 18:59                   ` Dmitry Torokhov
     [not found]                     ` <20091210185922.GD23717-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
2009-12-11  0:46                       ` Henrique de Moraes Holschuh
     [not found]                         ` <20091211004602.GB24245-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2009-12-11  7:54                           ` Dmitry Torokhov [this message]
2009-12-11 15:02                             ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
2009-12-09 20:47 ` [GIT PATCH v2] thinkpad-acpi first set of changes for 2.6.33 (v2) Len Brown
2009-12-09 22:32   ` Henrique de Moraes Holschuh

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=20091211075458.GB30274@core.coreip.homeip.net \
    --to=dmitry.torokhov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=alan-jenkins-cCz0Lq7MMjm9FHfhHBbuYA@public.gmane.org \
    --cc=hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org \
    --cc=ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org \
    --cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.