Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3985871ybl; Tue, 20 Aug 2019 05:26:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw+/eJt6bBAQVE0TG9ugPZgh8ZoCvxIlUOfsMEp/YeYcNJYwDB0GbAePDhzoVd0ltXKdDf X-Received: by 2002:aa7:9907:: with SMTP id z7mr28735410pff.13.1566303976543; Tue, 20 Aug 2019 05:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566303976; cv=none; d=google.com; s=arc-20160816; b=hkiabi/nEo+GFOlzInMh2IpUZ09B+LV+NPtyKFnTwzVVKHAHLs0BboG65/XtMp4cFe E/O3C+dHz0XynKePPgoQKTj7XkWqknJ2osNxMf2mBPfjoM6NotO6om0wJsXwu0PUM+tk 4R9VStBAunP739wwXnCUgw6gLC/fklXsNRhdgHapoV2mRYji45wp5zs1nGuIGPjoMvhF KILkzUQ+vDlWgY4ChRyJlDUkJZT/8x1Ongajgmkc0mh7FAWkOwLx5/ighia3Y0faQN2L lCRntDg1xGzPi5V37e/+4URoRwxPPu/XsYS262aVBK7+c9ra/ZXLlz80CwptZtJkgvI6 7OPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xzCx8rfipqjiXyNq4gJ4Cz+X4TRNhHPHouMg4toUPfA=; b=zpv48QYJH2z93Qkm81fpPda7mhwVLDRwxeULv9WJeYGduibPapkjqmazuae9m1/nSY vf8QXhsKSoI1OcgKweQb9lk/KCzbQypnClW3F2P5retBlJBKA4goCGJY88VnknT/++hT wGiK4KO7F/yLfiP0033Dbgs+gUKxyxupPm1vy8GdjD0gGqQ4tBiVKZztCoGIFfUWFmif bV7K17G7OuIvj4lxLtkuE8okcd9GdnZtJRs05mjYaVXenx4VihQKH/4oi4oN/IDVUmwZ AXZZMIt7rvI4XFdAHqltnjyFQvVd9xuKcM3HFFQU0aMsk9xqZ/KQVjLyrjQxiZIs7W3q q6LQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11si11139969pjv.95.2019.08.20.05.26.01; Tue, 20 Aug 2019 05:26:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729537AbfHTMXt (ORCPT + 99 others); Tue, 20 Aug 2019 08:23:49 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:33276 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727006AbfHTMXt (ORCPT ); Tue, 20 Aug 2019 08:23:49 -0400 Received: by mail-lf1-f66.google.com with SMTP id x3so3977719lfc.0; Tue, 20 Aug 2019 05:23:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xzCx8rfipqjiXyNq4gJ4Cz+X4TRNhHPHouMg4toUPfA=; b=lrm/1a9jKxCdouUR+V3WMek7WebdVClaXa9VmrNGP/wuX4w4UO9PrikfyKMOw2h8Ta lwruLbzAGB12q40g9UdcFG2IRX6seldKYPVq5X5PH/fYc471xa4XPEx7Aj1L6ir4cuow HQpDRbZnRsIgcsK58AWwmHZQjaXkvx4Qfv8aITLVSvOjyqZQ/v0enh+QAQAOn0Y5snDh /DFxrqtkSC85KNrdAcNySXeDeFyq34kMEbXatK5I6jPREFGsFcM3Q8B1MWparcA0IUkB +WAD4fApEX5wU9GCEDGZ7LLgGE2IUkp/JhCbn7BA6st5wAH+iiThmBlirNt1bWucFYy8 SW0w== X-Gm-Message-State: APjAAAXndYK2wWmj6TnvRjFvvTeIqy51s4lLlnlsyEkn6d5/40/qlMTk YqTOt9TT530VNLmG19+pYarZiU9RRkc= X-Received: by 2002:ac2:48b8:: with SMTP id u24mr14915884lfg.170.1566303827572; Tue, 20 Aug 2019 05:23:47 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id q30sm3193284lfd.27.2019.08.20.05.23.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Aug 2019 05:23:46 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92) (envelope-from ) id 1i03Au-0002Fy-JN; Tue, 20 Aug 2019 14:23:44 +0200 Date: Tue, 20 Aug 2019 14:23:44 +0200 From: Johan Hovold To: Lars Poeschel Cc: Allison Randal , Steve Winslow , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Kate Stewart , Thomas Gleixner , "open list:NFC SUBSYSTEM" , open list , Johan Hovold Subject: Re: [PATCH v6 6/7] nfc: pn533: Add autopoll capability Message-ID: <20190820122344.GK32300@localhost> References: <20190820120345.22593-1-poeschel@lemonage.de> <20190820120345.22593-6-poeschel@lemonage.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190820120345.22593-6-poeschel@lemonage.de> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Lars Poeschel > --- > 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