From: Lars Poeschel <poeschel@lemonage.de>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Jilayne Lovejoy <opensource@jilayne.com>,
Kate Stewart <kstewart@linuxfoundation.org>,
Allison Randal <allison@lohutok.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Steve Winslow <swinslow@gmail.com>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Johan Hovold <johan@kernel.org>,
"open list:NFC SUBSYSTEM" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Claudiu Beznea <Claudiu.Beznea@microchip.com>
Subject: Re: [PATCH v9 4/7] nfc: pn533: Split pn533 init & nfc_register
Date: Wed, 16 Oct 2019 10:42:37 +0200 [thread overview]
Message-ID: <20191016084236.GA6610@lem-wkst-02.lemonage> (raw)
In-Reply-To: <20191015091642.6f49dd8f@cakuba.netronome.com>
On Tue, Oct 15, 2019 at 09:16:42AM -0700, Jakub Kicinski wrote:
> On Tue, 15 Oct 2019 11:51:24 +0200, Lars Poeschel wrote:
> > > > - priv->nfc_dev = nfc_allocate_device(&pn533_nfc_ops, protocols,
> > > > - priv->ops->tx_header_len +
> > > > - PN533_CMD_DATAEXCH_HEAD_LEN,
> > > > - priv->ops->tx_tail_len);
> > > > - if (!priv->nfc_dev) {
> > > > - rc = -ENOMEM;
> > > > - goto destroy_wq;
> > > > - }
> > > > -
> > > > - nfc_set_parent_dev(priv->nfc_dev, parent);
> > > > - nfc_set_drvdata(priv->nfc_dev, priv);
> > > > -
> > > > - rc = nfc_register_device(priv->nfc_dev);
> > > > - if (rc)
> > > > - goto free_nfc_dev;
> > >
> > > Aren't you moving too much out of here? Looking at commit 32ecc75ded72
> > > ("NFC: pn533: change order operations in dev registation") it seems like
> > > IRQ handler may want to access the data structures, do this change not
> > > reintroduce the problem?
> >
> > Yes, you are right, there could be a problem if an irq gets served
> > before the driver is registered to the nfc subsystem.
> > Well, but the purpose of this patch is exactly that: Prevent use of nfc
> > subsystem before the chip is fully initialized.
> > To address this, I would not change the part above, but move the
> > request_threaded_irq to the very bottom in pn533_i2c_probe, after the
> > call to pn53x_register_nfc. So it is not possible to use nfc before the
> > chip is initialized and irqs don't get served before the driver is
> > registered to nfc subsystem.
> > Thank you for this!
> > I will include this in v10 of the patchset.
>
> You can run nfc_allocate_device() etc. early, then allocate the IRQ,
> and then run nfc_register_device(), would that work? Is that what you
> have in mind?
Well, I think my proposed solution above would technically do it, but I
think I will do it like you proposed. I think for someone reading the
code it is far more easier to understand, what the idea behind it is, if
the irq is requested right between nfc_allocate_device and
nfc_register_device.
Thanks again!
next prev parent reply other threads:[~2019-10-16 8:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-08 14:05 [PATCH v9 0/7] nfc: pn533: add uart phy driver Lars Poeschel
2019-10-08 14:05 ` [PATCH v9 1/7] nfc: pn533: i2c: "pn532" as dt compatible string Lars Poeschel
2019-10-08 14:05 ` [PATCH v9 2/7] nfc: pn532: Add uart phy docs and rename it Lars Poeschel
2019-10-09 19:36 ` Rob Herring
2019-10-08 14:05 ` [PATCH v9 3/7] nfc: pn533: Add dev_up/dev_down hooks to phy_ops Lars Poeschel
2019-10-08 14:05 ` [PATCH v9 4/7] nfc: pn533: Split pn533 init & nfc_register Lars Poeschel
2019-10-10 0:40 ` Jakub Kicinski
2019-10-15 9:51 ` Lars Poeschel
2019-10-15 16:16 ` Jakub Kicinski
2019-10-16 8:42 ` Lars Poeschel [this message]
2019-10-08 14:05 ` [PATCH v9 5/7] nfc: pn533: add UART phy driver Lars Poeschel
2019-10-08 14:05 ` [PATCH v9 6/7] nfc: pn533: Add autopoll capability Lars Poeschel
2019-10-08 14:05 ` [PATCH v9 7/7] nfc: pn532_uart: Make use of pn532 autopoll Lars Poeschel
2019-10-10 0:29 ` [PATCH v9 0/7] nfc: pn533: add uart phy driver Jakub Kicinski
2019-10-15 9:54 ` Lars Poeschel
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=20191016084236.GA6610@lem-wkst-02.lemonage \
--to=poeschel@lemonage.de \
--cc=Claudiu.Beznea@microchip.com \
--cc=allison@lohutok.net \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=jakub.kicinski@netronome.com \
--cc=johan@kernel.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opensource@jilayne.com \
--cc=swinslow@gmail.com \
--cc=tglx@linutronix.de \
/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).