linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Henrik Rydberg" <rydberg@euromail.se>
To: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jiri Kosina <jkosina@suse.cz>,
	Stephane Chatty <chatty@lii-enac.fr>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] hid-multitouch: Auto detection of maxcontacts
Date: Wed, 9 Mar 2011 14:16:44 +0100	[thread overview]
Message-ID: <20110309131643.GA10925@polaris.bitmath.org> (raw)
In-Reply-To: <AANLkTimU0dt_XJVvnD+-JxEhVXMb0pzar0kip56zs11u@mail.gmail.com>

> > if (td->mtclass->maxcontacts > td->maxcontacts)
> >
> >> +                     /* check if the maxcontacts is given by the class */
> >> +                     td->maxcontacts = td->mtclass->maxcontacts;
> >> +
> >> +             if (!td->maxcontacts)
> >> +                     td->maxcontacts = MT_CONTACTMAX_DEFAULT;
> >
> > this part can be then dropped
> 
> Well, it works the way you are suggesting. BTW this let the corner
> case where someone adds a device (MT_CLS) that does not send the
> contact max and does not initialize the .maxcontact field.

Yes, the patch changes the current, perfectly reasonable assumption
that maxcontact is set. If that change is removed from the patch, it
makes the logic simpler, without changing the semantics of the current
code.

> >> +     td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
> >> +                             GFP_KERNEL);
> >> +
> >
> > Don't we have a race problem here?  It seems the device is started at
> > this point, so I worry that events will be handled when slots is still
> > NULL.
> 
> I tried again yesterday: if I put this line above the hid_hw_start ->
> kernel oops at first touch.
> The point is that hid_hw_start calls hid_connect that do the actual
> calls to input_mapping and feature_mapping.

Yes, that is clear, but the urbs are running, and as fas as I can see,
irqs can be delivered to mt_event(). Minute time window, testing is
not likely to hit this. Adding a test for completed initialization in
mt_event() would make sure.

Oh, and there is no test for failed memory allocation.

Thanks.
Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-03-09 13:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 16:32 [PATCH 0/4] Migrations to hid-multitouch Benjamin Tissoires
2011-03-08 16:32 ` [PATCH 1/4] hid-multitouch: Auto detection of maxcontacts Benjamin Tissoires
2011-03-09  8:42   ` Henrik Rydberg
2011-03-09  9:03     ` Benjamin Tissoires
2011-03-09  9:38       ` Henrik Rydberg
2011-03-09 10:14         ` Benjamin Tissoires
2011-03-09 11:12           ` Henrik Rydberg
2011-03-09 11:22   ` Henrik Rydberg
2011-03-09 12:35     ` Benjamin Tissoires
2011-03-09 13:16       ` Henrik Rydberg [this message]
2011-03-08 16:32 ` [PATCH 2/4] hid-multitouch: migrate support for Stantum panels to the unified driver Benjamin Tissoires
2011-03-08 16:32 ` [PATCH 3/4] hid-multitouch: migrate 3M PCT touch screens " Benjamin Tissoires
2011-03-09  8:46   ` Henrik Rydberg
2011-03-09  9:13     ` Benjamin Tissoires
2011-03-09  9:47       ` Henrik Rydberg
2011-03-09 10:17         ` Benjamin Tissoires
2011-03-08 16:32 ` [PATCH 4/4] hid-multitouch: migrate Cando dual touch panels " Benjamin Tissoires

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=20110309131643.GA10925@polaris.bitmath.org \
    --to=rydberg@euromail.se \
    --cc=benjamin.tissoires@enac.fr \
    --cc=chatty@lii-enac.fr \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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).