From: Krzysztof Kozlowski <krzk@kernel.org>
To: Bongsu Jeon <bongsu.jeon2@gmail.com>
Cc: linux-nfc@lists.01.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Bongsu Jeon <bongsu.jeon@samsung.com>
Subject: Re: [PATCH net-next] nfc: s3fwrn5: skip the NFC bootloader mode
Date: Thu, 3 Dec 2020 18:19:04 +0200 [thread overview]
Message-ID: <20201203161904.GA16186@kozik-lap> (raw)
In-Reply-To: <20201203153950.13772-1-bongsu.jeon@samsung.com>
On Fri, Dec 04, 2020 at 12:39:50AM +0900, Bongsu Jeon wrote:
> From: Bongsu Jeon <bongsu.jeon@samsung.com>
>
> 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 <bongsu.jeon@samsung.com>
> ---
> 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;
> }
prev parent reply other threads:[~2020-12-03 16:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 15:39 [PATCH net-next] nfc: s3fwrn5: skip the NFC bootloader mode Bongsu Jeon
2020-12-03 16:19 ` Krzysztof Kozlowski [this message]
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=20201203161904.GA16186@kozik-lap \
--to=krzk@kernel.org \
--cc=bongsu.jeon2@gmail.com \
--cc=bongsu.jeon@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfc@lists.01.org \
--cc=netdev@vger.kernel.org \
/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).