From: Cameron Gutman <aicommander@gmail.com>
To: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>,
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: Tue, 20 Feb 2018 21:32:08 -0800 [thread overview]
Message-ID: <eb75654d-cd83-83a4-edde-6492300e4948@gmail.com> (raw)
In-Reply-To: <20180220193306.28748-2-rodrigorivascosta@gmail.com>
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.
> + }
> +}
> +
Regards,
Cameron
next prev parent reply other threads:[~2018-02-21 5:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 19:33 [PATCH v2 0/3] new " Rodrigo Rivas Costa
2018-02-20 19:33 ` [PATCH v2 1/3] HID: add " Rodrigo Rivas Costa
2018-02-21 5:32 ` Cameron Gutman [this message]
2018-02-22 22:54 ` Rodrigo Rivas Costa
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=eb75654d-cd83-83a4-edde-6492300e4948@gmail.com \
--to=aicommander@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigorivascosta@gmail.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