From: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
To: Cameron Gutman <aicommander@gmail.com>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH v2 1/3] HID: add driver for Valve Steam Controller
Date: Thu, 22 Feb 2018 23:54:26 +0100 [thread overview]
Message-ID: <20180222225426.GA3726@casa> (raw)
In-Reply-To: <eb75654d-cd83-83a4-edde-6492300e4948@gmail.com>
On Tue, Feb 20, 2018 at 09:32:08PM -0800, Cameron Gutman wrote:
> On 02/20/2018 11:33 AM, Rodrigo Rivas Costa wrote:
> > +static void steam_work_connect_cb(struct work_struct *work)
> > +{
> > + struct steam_device *steam = container_of(work, struct steam_device,
> > + work_connect);
> > + unsigned long flags;
> > + bool connected;
> > + int ret;
> > +
> > + spin_lock_irqsave(&steam->lock, flags);
> > + connected = steam->connected;
> > + spin_unlock_irqrestore(&steam->lock, flags);
> > +
> > + if (connected) {
> > + if (steam->input) {
> > + dbg_hid("%s: already connected\n", __func__);
> > + return;
> > + }
> > + ret = steam_register(steam);
> > + if (ret) {
> > + hid_err(steam->hdev,
> > + "%s:steam_register failed with error %d\n",
> > + __func__, ret);
> > + return;
> > + }
> > + } else {
> > + steam_unregister(steam);
>
> I think you need synchronization here. You don't want to be in the middle of
> processing a HID event or power supply update and have your device freed out
> from underneath you.
>
> xpad uses RCU to avoid this race.
Ah, I see, if we get an input message just after the "disconnect"
packet, (unlikely) it could file. I'll don't know RCU very will but I'll
try and do my best.
Please, stay tuned for v3.
Thanks.
Rodrigo
next prev parent reply other threads:[~2018-02-22 22:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 19:33 [PATCH v2 0/3] new driver for Valve Steam Controller Rodrigo Rivas Costa
2018-02-20 19:33 ` [PATCH v2 1/3] HID: add " Rodrigo Rivas Costa
2018-02-21 5:32 ` Cameron Gutman
2018-02-22 22:54 ` Rodrigo Rivas Costa [this message]
2018-02-21 14:13 ` Benjamin Tissoires
2018-02-20 19:33 ` [PATCH v2 2/3] HID: steam: add serial number information Rodrigo Rivas Costa
2018-02-20 19:33 ` [PATCH v2 3/3] HID: steam: add battery device Rodrigo Rivas Costa
2018-02-20 22:29 ` [PATCH v2 0/3] new driver for Valve Steam Controller Pierre-Loup A. Griffais
2018-02-20 23:20 ` Rodrigo Rivas Costa
2018-02-21 0:09 ` Pierre-Loup A. Griffais
2018-02-21 20:21 ` Rodrigo Rivas Costa
2018-02-22 0:13 ` Pierre-Loup A. Griffais
2018-02-22 9:05 ` Clément VUCHENER
2018-02-22 9:10 ` Benjamin Tissoires
2018-02-22 16:31 ` Rodrigo Rivas Costa
2018-02-22 17:06 ` Benjamin Tissoires
2018-02-22 17:48 ` Rodrigo Rivas Costa
2018-02-23 8:20 ` Benjamin Tissoires
2018-02-21 10:39 ` Clément VUCHENER
2018-02-21 10:57 ` Rodrigo Rivas Costa
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=20180222225426.GA3726@casa \
--to=rodrigorivascosta@gmail.com \
--cc=aicommander@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--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).