From: Johan Hovold <johan@kernel.org>
To: Karoly Pados <pados@pados.hu>
Cc: Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Loic Poulain <loic.poulain@linaro.org>
Subject: [v4] USB: serial: ftdi_sio: implement GPIO support for FT-X devices
Date: Tue, 18 Sep 2018 13:19:12 +0200 [thread overview]
Message-ID: <20180918111912.GE3943@localhost> (raw)
On Tue, Sep 18, 2018 at 10:27:58AM +0000, Karoly Pados wrote:
> >> Does that mean something can call into our module while this method is running?
> >> If not, I'm clueless about the possible race here.
> >
> > Correct, you can get gpio callbacks until the gpio chip has been
> > deregistered (anything coming in after that would be a gpiolib bug).
>
> I'm just puzzled by the fact that this can still happen even while the port
> removal code is running. It also makes me ask the question what else here can
> run in parallel. Don't we need mutexes here-and-there in the ftx gpio functions too
> in this case? Or does gpiolib make sure to serialize multiple pin and direction
> setting calls?
Good point. The old sysfs interface would keep things serialised, but
the new chardev-based one does not (nor does the in-kernel interface).
So yeah, we need to add a mutex protecting the gpio state (i.e.
direction and value).
Thanks,
Johan
WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: Karoly Pados <pados@pados.hu>
Cc: Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Loic Poulain <loic.poulain@linaro.org>
Subject: Re: [PATCH v4] USB: serial: ftdi_sio: implement GPIO support for FT-X devices
Date: Tue, 18 Sep 2018 13:19:12 +0200 [thread overview]
Message-ID: <20180918111912.GE3943@localhost> (raw)
In-Reply-To: <6e1a6550cbf886cb7dcfea641244bdcf@pados.hu>
On Tue, Sep 18, 2018 at 10:27:58AM +0000, Karoly Pados wrote:
> >> Does that mean something can call into our module while this method is running?
> >> If not, I'm clueless about the possible race here.
> >
> > Correct, you can get gpio callbacks until the gpio chip has been
> > deregistered (anything coming in after that would be a gpiolib bug).
>
> I'm just puzzled by the fact that this can still happen even while the port
> removal code is running. It also makes me ask the question what else here can
> run in parallel. Don't we need mutexes here-and-there in the ftx gpio functions too
> in this case? Or does gpiolib make sure to serialize multiple pin and direction
> setting calls?
Good point. The old sysfs interface would keep things serialised, but
the new chardev-based one does not (nor does the in-kernel interface).
So yeah, we need to add a mutex protecting the gpio state (i.e.
direction and value).
Thanks,
Johan
next reply other threads:[~2018-09-18 11:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 11:19 Johan Hovold [this message]
2018-09-18 11:19 ` [PATCH v4] USB: serial: ftdi_sio: implement GPIO support for FT-X devices Johan Hovold
-- strict thread matches above, loose matches on Subject: below --
2018-09-18 10:27 [v4] " Karoly Pados
2018-09-18 10:27 ` [PATCH v4] " Karoly Pados
2018-09-18 9:45 [v4] " Johan Hovold
2018-09-18 9:45 ` [PATCH v4] " Johan Hovold
2018-09-18 9:35 [v4] " Karoly Pados
2018-09-18 9:35 ` [PATCH v4] " Karoly Pados
2018-09-18 9:16 [v4] " Johan Hovold
2018-09-18 9:16 ` [PATCH v4] " Johan Hovold
2018-09-16 17:58 [v4] " Karoly Pados
2018-09-16 17:58 ` [PATCH v4] " Karoly Pados
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=20180918111912.GE3943@localhost \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=pados@pados.hu \
/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.