From: Johan Hovold <johan@kernel.org>
To: Lars Poeschel <poeschel@lemonage.de>
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>,
Johan Hovold <johan@kernel.org>
Subject: Re: [PATCH v6 6/7] nfc: pn533: Add autopoll capability
Date: Tue, 20 Aug 2019 14:23:44 +0200 [thread overview]
Message-ID: <20190820122344.GK32300@localhost> (raw)
In-Reply-To: <20190820120345.22593-6-poeschel@lemonage.de>
On Tue, Aug 20, 2019 at 02:03:43PM +0200, Lars Poeschel wrote:
> pn532 devices support an autopoll command, that lets the chip
> automatically poll for selected nfc technologies instead of manually
> looping through every single nfc technology the user is interested in.
> This is faster and less cpu and bus intensive than manually polling.
> This adds this autopoll capability to the pn533 driver.
>
> Cc: Johan Hovold <johan@kernel.org>
> Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
> ---
> Changes in v6:
> - Rebased the patch series on v5.3-rc5
Just two drive-by comments below.
> 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.
> +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).
Johan
next prev parent reply other threads:[~2019-08-20 12:23 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 [this message]
2019-08-20 14:32 ` Lars Poeschel
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=20190820122344.GK32300@localhost \
--to=johan@kernel.org \
--cc=allison@lohutok.net \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=poeschel@lemonage.de \
--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).