From: Lars Poeschel <poeschel@lemonage.de>
To: Johan Hovold <johan@kernel.org>
Cc: Allison Randal <allison@lohutok.net>,
Steve Winslow <swinslow@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Kate Stewart <kstewart@linuxfoundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
"open list:NFC SUBSYSTEM" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 6/7] nfc: pn533: Add autopoll capability
Date: Tue, 20 Aug 2019 16:32:41 +0200 [thread overview]
Message-ID: <20190820143240.GA11301@lem-wkst-02.lemonage> (raw)
In-Reply-To: <20190820122344.GK32300@localhost>
On Tue, Aug 20, 2019 at 02:23:44PM +0200, Johan Hovold wrote:
> On Tue, Aug 20, 2019 at 02:03:43PM +0200, Lars Poeschel wrote:
> > drivers/nfc/pn533/pn533.c | 193 +++++++++++++++++++++++++++++++++++++-
> > drivers/nfc/pn533/pn533.h | 10 +-
> > 2 files changed, 197 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
> > index a8c756caa678..7e915239222b 100644
> > --- a/drivers/nfc/pn533/pn533.c
> > +++ b/drivers/nfc/pn533/pn533.c
> > @@ -185,6 +185,32 @@ struct pn533_cmd_jump_dep_response {
> > u8 gt[];
> > } __packed;
> >
> > +struct pn532_autopoll_resp {
> > + u8 type;
> > + u8 ln;
> > + u8 tg;
> > + u8 tgdata[];
> > +} __packed;
>
> No need for __packed.
I did a quick test without the __packed and indeed: It worked. I'd
sworn that it is needed in this place, because this autopoll response is
data that the nfc chip puts on the serial wire without padding inbetween
and this struct is used to access this data and without the __packed the
compiler should be allowed to put padding bytes between the struct
fields. But it choose to not do it. I am still not shure, why this
happens, but ok. I can remove the __packed.
> > +static int pn533_autopoll_complete(struct pn533 *dev, void *arg,
> > + struct sk_buff *resp)
> > +{
> > + u8 nbtg;
> > + int rc;
> > + struct pn532_autopoll_resp *apr;
> > + struct nfc_target nfc_tgt;
> > +
> > + if (IS_ERR(resp)) {
> > + rc = PTR_ERR(resp);
> > +
> > + nfc_err(dev->dev, "%s autopoll complete error %d\n",
> > + __func__, rc);
> > +
> > + if (rc == -ENOENT) {
> > + if (dev->poll_mod_count != 0)
> > + return rc;
> > + goto stop_poll;
> > + } else if (rc < 0) {
> > + nfc_err(dev->dev,
> > + "Error %d when running autopoll\n", rc);
> > + goto stop_poll;
> > + }
> > + }
> > +
> > + nbtg = resp->data[0];
> > + if ((nbtg > 2) || (nbtg <= 0))
> > + return -EAGAIN;
> > +
> > + apr = (struct pn532_autopoll_resp *)&resp->data[1];
> > + while (nbtg--) {
> > + memset(&nfc_tgt, 0, sizeof(struct nfc_target));
> > + switch (apr->type) {
> > + case PN532_AUTOPOLL_TYPE_ISOA:
> > + dev_dbg(dev->dev, "ISOA");
>
> You forgot the '\n' here and elsewhere (some nfc_err as well).
I can add them. I will wait a bit for more review comments before
posting a new patchset.
Thanks so far for your quick review,
Lars
next prev parent reply other threads:[~2019-08-20 14:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 12:03 [PATCH v6 1/7] nfc: pn533: i2c: "pn532" as dt compatible string Lars Poeschel
2019-08-20 12:03 ` [PATCH v6 3/7] nfc: pn533: Add dev_up/dev_down hooks to phy_ops Lars Poeschel
2019-08-20 12:03 ` [PATCH v6 4/7] nfc: pn533: Split pn533 init & nfc_register Lars Poeschel
2019-08-22 10:08 ` Claudiu.Beznea
2019-08-23 9:07 ` Lars Poeschel
2019-08-20 12:03 ` [PATCH v6 5/7] nfc: pn533: add UART phy driver Lars Poeschel
2019-08-22 10:09 ` Claudiu.Beznea
2019-08-23 10:06 ` Lars Poeschel
2019-08-26 10:31 ` Claudiu.Beznea
2019-08-20 12:03 ` [PATCH v6 6/7] nfc: pn533: Add autopoll capability Lars Poeschel
2019-08-20 12:23 ` Johan Hovold
2019-08-20 14:32 ` Lars Poeschel [this message]
2019-08-20 12:03 ` [PATCH v6 7/7] nfc: pn532_uart: Make use of pn532 autopoll 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=20190820143240.GA11301@lem-wkst-02.lemonage \
--to=poeschel@lemonage.de \
--cc=allison@lohutok.net \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=johan@kernel.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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