mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: linux-kernel@vger.kernel.org, Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang7@gmail.com>,
	Chunyan Zhang <chunyan.zhang@unisoc.com>,
	Freeman Liu <freeman.liu@unisoc.com>
Subject: Re: [PATCH] nvmem: sc27xx: add sc2730 efuse support
Date: Mon, 15 Jun 2020 10:39:21 +0100	[thread overview]
Message-ID: <504216f8-34f6-11a0-d98e-84ff3901ed52@linaro.org> (raw)
In-Reply-To: <20200615032347.10586-1-zhang.lyra@gmail.com>



On 15/06/2020 04:23, Chunyan Zhang wrote:
> From: Freeman Liu <freeman.liu@unisoc.com>
> 
> Add support to the new efuse IP which is integrated in the SC2730
> which includes multiple blocks in a single chip.
> 
> Signed-off-by: Freeman Liu <freeman.liu@unisoc.com>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---
>   drivers/nvmem/sc27xx-efuse.c | 34 +++++++++++++++++++++++++++++++---
>   1 file changed, 31 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvmem/sc27xx-efuse.c b/drivers/nvmem/sc27xx-efuse.c
> index ab5e7e0bc3d8..7d453c9d80da 100644
> --- a/drivers/nvmem/sc27xx-efuse.c
> +++ b/drivers/nvmem/sc27xx-efuse.c

...

>   
> @@ -187,8 +206,15 @@ static int sc27xx_efuse_probe(struct platform_device *pdev)
>   	struct nvmem_config econfig = { };
>   	struct nvmem_device *nvmem;
>   	struct sc27xx_efuse *efuse;
> +	const struct sc27xx_efuse_variant_data *pdata;
>   	int ret;
>   
> +	pdata = of_device_get_match_data(&pdev->dev);
> +	if (!pdata) {

This check is totally unnecessary as you would not end up here unless 
there is a matching compatible!


You could move this after kmalloc and assign efuse->var_data directly!!


--srini

> +		dev_err(&pdev->dev, "No matching driver data found\n");
> +		return -EINVAL;
> +	}
> +
>   	efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL);
>   	if (!efuse)
>   		return -ENOMEM;
> @@ -219,6 +245,7 @@ static int sc27xx_efuse_probe(struct platform_device *pdev)
>   
>   	mutex_init(&efuse->mutex);
>   	efuse->dev = &pdev->dev;
> +	efuse->var_data = pdata;
>   

  reply	other threads:[~2020-06-15  9:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15  3:23 Chunyan Zhang
2020-06-15  9:39 ` Srinivas Kandagatla [this message]
2020-06-15 13:50 ` Baolin Wang

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=504216f8-34f6-11a0-d98e-84ff3901ed52@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=baolin.wang7@gmail.com \
    --cc=chunyan.zhang@unisoc.com \
    --cc=freeman.liu@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=zhang.lyra@gmail.com \
    /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

all inboxes | Powered by JetHome®