Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4125816ybl; Tue, 20 Aug 2019 07:22:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgNc+ZS1ZTBAqTfCr9uExk51CBZCh8H88kjz1AZMNOJZFTaHyafA8xjkI1KZG/Y25dDe7i X-Received: by 2002:a17:902:45:: with SMTP id 63mr28402337pla.264.1566310933489; Tue, 20 Aug 2019 07:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566310933; cv=none; d=google.com; s=arc-20160816; b=EDYP9YwBff4AplU94gR3A4dtGPmaCaotdsdPnjShrRKs2B4bzdapUJILMJMKRgc6dL duNeHGsZabfTFbdZJbAFYWIx2ir6R9Zw0xLLyyEJTZEtSjpWN2/Q7XJwbJCPb9MckmZH UkQLsJholqoag2st6XVAmbV29i69d7kZP0wdr8IcWeImuPs4qkzwN2XtF8PTWllnLE9r 8mWLPTPZsURjDni1vEnD8iDqo6tmTHIbNZ5DT5Anv3kRSevi/dyiwq2o5yoxJOl++gv8 nYEQE8HSxmZw3jLF7lEXv0Fq+/FyIdNptkB1wfJ2Y8lhlvZtL48ir9MzKnRNgmO31+8s t9pA== 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=0/tz07sGtu0wRsjdwqlIA30XdESu5LfhUs8iMM0WCCU=; b=dP9gEb1KEFtXbACqOSmsb4wAMDRnTNhAymfY86oJQrpxzwI+R31p6Z8Dzt206vbKb0 +4I71wKGWhJ4gWOq2wskSs7Z9HBoNAgnAE2ETw2glQ/zIs+1jthNLgn2HWqhfFwO0J4T 0u33CDpSRRDLLeOqR8nPOEsZbwJ9Fg8yRg/0WT9UnoazqUDzYB/R39r29aQZxrVe9fRL 1ev/5YqaWetBMkuKAix0xXM8opvuCrrYxDebmRQwB9D2jW2IgJglYzAaiQHgKASqNX/w SFpCsua7P0CcvgW8Q+9ItbDGwNpFiU2NwjTr/N5UYbegqfOMiO85GQCNZIim19ti9C3P OZeQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si11973972pgv.541.2019.08.20.07.21.58; Tue, 20 Aug 2019 07:22:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730174AbfHTOTs (ORCPT + 99 others); Tue, 20 Aug 2019 10:19:48 -0400 Received: from smtp3.goneo.de ([85.220.129.37]:58500 "EHLO smtp3.goneo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729853AbfHTOTs (ORCPT ); Tue, 20 Aug 2019 10:19:48 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp3.goneo.de (Postfix) with ESMTP id 9210923FA45; Tue, 20 Aug 2019 16:19:44 +0200 (CEST) X-Virus-Scanned: by goneo X-Spam-Flag: NO X-Spam-Score: -3.042 X-Spam-Level: X-Spam-Status: No, score=-3.042 tagged_above=-999 tests=[ALL_TRUSTED=-1, AWL=-0.142, BAYES_00=-1.9] autolearn=ham Received: from smtp3.goneo.de ([127.0.0.1]) by localhost (smtp3.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ej-nB74Ns0XQ; Tue, 20 Aug 2019 16:19:43 +0200 (CEST) Received: from lem-wkst-02.lemonage (hq.lemonage.de [87.138.178.34]) by smtp3.goneo.de (Postfix) with ESMTPSA id 8ABEA23F9DE; Tue, 20 Aug 2019 16:19:42 +0200 (CEST) Date: Tue, 20 Aug 2019 16:32:41 +0200 From: Lars Poeschel To: Johan Hovold Cc: Allison Randal , Steve Winslow , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Kate Stewart , Thomas Gleixner , "open list:NFC SUBSYSTEM" , open list Subject: Re: [PATCH v6 6/7] nfc: pn533: Add autopoll capability Message-ID: <20190820143240.GA11301@lem-wkst-02.lemonage> References: <20190820120345.22593-1-poeschel@lemonage.de> <20190820120345.22593-6-poeschel@lemonage.de> <20190820122344.GK32300@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190820122344.GK32300@localhost> User-Agent: Mutt/1.10.1 (2018-07-13) 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: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