Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp612129pxu; Thu, 3 Dec 2020 08:25:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIsq4nCuGQafiskohdjavN/t0gb5AKkn9QCaiyMl2TIOiCjOUkQoYs9c6GDDHEXNUv/hVB X-Received: by 2002:a50:8a44:: with SMTP id i62mr785216edi.97.1607012703931; Thu, 03 Dec 2020 08:25:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607012703; cv=none; d=google.com; s=arc-20160816; b=r5l7H7PKsUTws8yX1x390exGzmXjx5q/1c0fftUZShrP7/5MiHJl79odOKIbBBsp21 96jYTRPOLEnpFfqbq6LnuJTJKmSEEK+JHUhrs4i5ty369ho091OXM6RrNFGU5SAUWNhR jYAciBFjmhg7DYNv0keZUPUTWXfw8rRb9zkj9u0gUjY7bPNrKZR08eY8mQz+Qi5jYn7s pLaAK8UQ9XLMcypKjmTBDeEVp4w6XeC/4KCwiBZvl615q5fCrHUe4mRvcGHLpz5R0/eZ xZxt19W1XXuKeYsgi6qDKe4GiuxwZDyswSqcBVS4fa3fI2QZnw2ghqaJ99fFGuVoZD6M 29zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ODKylo1ARO1Guvyudvma49X5O/saBDRUYXjRotR9i2w=; b=Z1HpuzAPYOyvpEQVG0pv2y+5vZdIBZKCFTUOFYMpQ2bGMvAOoVkZjBcSjOW7SOJ2gt bzwIzDBZDK1iMuSdUx5aSvyWd0ZE1tsudQEv6b7/1wl8o/dA+K3HDl8Nu7d1ll5Jqvzb h6aWKTlQMUFjuCHGY30F3hf1AcHygMbLoniRDjdSFMMw0bEM8ZcqFBlWIRTLjHOBfXmy zsyDrCqrWikt5BRwRRIHWm0fK4b5t10bbNtEe6czsEJrBoE3z1C54SVaDrr38Wr1fsYV ReG3NVNYXV4Cef/p9rLB/Zv28LIjBvMGC5BWafLWTmDO5eZIh9gWrknlnqgfvfeaaw+u 1CRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si1201952edw.310.2020.12.03.08.24.38; Thu, 03 Dec 2020 08:25:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436714AbgLCQTt (ORCPT + 99 others); Thu, 3 Dec 2020 11:19:49 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38135 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436640AbgLCQTt (ORCPT ); Thu, 3 Dec 2020 11:19:49 -0500 Received: by mail-ed1-f66.google.com with SMTP id cw27so2705570edb.5; Thu, 03 Dec 2020 08:19:32 -0800 (PST) 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; bh=ODKylo1ARO1Guvyudvma49X5O/saBDRUYXjRotR9i2w=; b=X2XUucHKqYOxi60reNaj65uKVcUrEGR6RmOhxzIZ5mhZt7/WVVsdE2vAINUmSMr7Ju SmZIuLy/fnXZf1ArJxrYaMje5nSRop65mS7Kh4RO+/pRdML8RsQhGFRWHjVQuuZNsy5t nCr2rw9wsANz/MiUR6mUuEU//n5T+7v0cnk3iQr5Ft7Fwsv8S1seWr3lIvxndf3JrbQ2 cmcBkEXLVYfECzVpmAkjTuilgVBQWEPzYaXTU4eRpZndUfS6zIbBc63UWS5/bmQWk0HC NMtc4302NsMEsONssJ12cqv55Gz8HJmwM6tSTyTPAAozlMRCWKfko4Wl2rOn8CAnwMan t8mw== X-Gm-Message-State: AOAM530mFjINRGEaBVgGGCk/K9bKy0wmLOgMrHIPJ6zRzAnZZJQL3fVS xRQgwqFiixyU7NUZHVbk+UcNufXZwWY= X-Received: by 2002:a50:c19a:: with SMTP id m26mr3518773edf.302.1607012347188; Thu, 03 Dec 2020 08:19:07 -0800 (PST) Received: from kozik-lap (adsl-84-226-167-205.adslplus.ch. [84.226.167.205]) by smtp.googlemail.com with ESMTPSA id ga11sm1116662ejb.34.2020.12.03.08.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 08:19:05 -0800 (PST) Date: Thu, 3 Dec 2020 18:19:04 +0200 From: Krzysztof Kozlowski To: Bongsu Jeon Cc: linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bongsu Jeon Subject: Re: [PATCH net-next] nfc: s3fwrn5: skip the NFC bootloader mode Message-ID: <20201203161904.GA16186@kozik-lap> References: <20201203153950.13772-1-bongsu.jeon@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201203153950.13772-1-bongsu.jeon@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 04, 2020 at 12:39:50AM +0900, Bongsu Jeon wrote: > From: Bongsu Jeon > > If there isn't proper NFC firmware image, > Bootloader mode will be skipped. Wrap your commit msg as described in submitting patches (so at 75 character). > > Signed-off-by: Bongsu Jeon > --- > drivers/nfc/s3fwrn5/core.c | 44 ++++++++++++++++++++++++---------- > drivers/nfc/s3fwrn5/firmware.c | 11 +-------- > drivers/nfc/s3fwrn5/firmware.h | 1 + > 3 files changed, 33 insertions(+), 23 deletions(-) > > diff --git a/drivers/nfc/s3fwrn5/core.c b/drivers/nfc/s3fwrn5/core.c > index f8e5d78d9078..df89bc5d7338 100644 > --- a/drivers/nfc/s3fwrn5/core.c > +++ b/drivers/nfc/s3fwrn5/core.c > @@ -20,13 +20,26 @@ > NFC_PROTO_ISO14443_B_MASK | \ > NFC_PROTO_ISO15693_MASK) > > +static int s3fwrn5_firmware_init(struct s3fwrn5_info *info) > +{ > + struct s3fwrn5_fw_info *fw_info = &info->fw_info; > + int ret; > + > + s3fwrn5_fw_init(fw_info, "sec_s3fwrn5_firmware.bin"); > + > + /* Get firmware data */ > + ret = s3fwrn5_fw_request_firmware(fw_info); > + if (ret < 0) > + dev_err(&fw_info->ndev->nfc_dev->dev, > + "Failed to get fw file, ret=%02x\n", ret); > + return ret; > +} > + > static int s3fwrn5_firmware_update(struct s3fwrn5_info *info) > { > bool need_update; > int ret; > > - s3fwrn5_fw_init(&info->fw_info, "sec_s3fwrn5_firmware.bin"); > - > /* Update firmware */ > > s3fwrn5_set_wake(info, false); > @@ -109,21 +122,26 @@ static int s3fwrn5_nci_post_setup(struct nci_dev *ndev) > struct s3fwrn5_info *info = nci_get_drvdata(ndev); > int ret; > > - ret = s3fwrn5_firmware_update(info); > - if (ret < 0) > - goto out; > + if (s3fwrn5_firmware_init(info) == 0) { if (s3fwrn5_firmware_init(info)) { // skip bootloader mode ret = 0; goto out; } so entire next block won't have to be indented. This follows usual pattern of error handling. Best regards, Krzysztof > + ret = s3fwrn5_firmware_update(info); > + if (ret < 0) > + goto out; > > - /* NCI core reset */ > - > - s3fwrn5_set_mode(info, S3FWRN5_MODE_NCI); > - s3fwrn5_set_wake(info, true); > + /* NCI core reset */ > > - ret = nci_core_reset(info->ndev); > - if (ret < 0) > - goto out; > + s3fwrn5_set_mode(info, S3FWRN5_MODE_NCI); > + s3fwrn5_set_wake(info, true); > > - ret = nci_core_init(info->ndev); > + ret = nci_core_reset(info->ndev); > + if (ret < 0) > + goto out; > > + ret = nci_core_init(info->ndev); > + } else { > + dev_info(&info->ndev->nfc_dev->dev, > + "skip bootloader mode\n"); > + ret = 0; > + } > out: > return ret; > }