linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linuxarm@huawei.com,  mauro.chehab@huawei.com,
	Lee Jones <lee.jones@linaro.org>,
	 Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH v9 2/5] regulator: hi6421v600-regulator: fix platform drvdata
Date: Sat, 26 Jun 2021 11:41:50 +0800	[thread overview]
Message-ID: <CAFRkauBcXDVihxN8MHoStGHjDyx-VyOe6tT8dkY2tAisHoeE8w@mail.gmail.com> (raw)
In-Reply-To: <ef0ff659a875b91b454df12b57888f2b473877fa.1624640087.git.mchehab+huawei@kernel.org>

> @@ -231,7 +228,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
>  {
>         struct device *pmic_dev = pdev->dev.parent;
>         struct regulator_config config = { };
> -       struct hi6421_spmi_reg_priv *priv;
> +       struct hi6421_spmi_reg_info *sreg;
>         struct hi6421_spmi_reg_info *info;
>         struct device *dev = &pdev->dev;
>         struct hi6421_spmi_pmic *pmic;
> @@ -247,18 +244,17 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
>         if (WARN_ON(!pmic))
>                 return -ENODEV;
>
> -       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> -       if (!priv)
> +       sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL);
> +       if (!sreg)
>                 return -ENOMEM;
>
> -       mutex_init(&priv->enable_mutex);
> -       platform_set_drvdata(pdev, priv);
> +       sreg->enable_mutex = &pmic->enable_mutex;
>
>         for (i = 0; i < ARRAY_SIZE(regulator_info); i++) {
>                 info = &regulator_info[i];
>
>                 config.dev = pdev->dev.parent;
> -               config.driver_data = info;
> +               config.driver_data = sreg;

This won't work and that was what my patch fixed.
e.g. When you call
struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev);
sreg->eco_mode_mask and sreg->eco_uA will always be 0.

Regards,
Axel

  reply	other threads:[~2021-06-26  3:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 17:06 [PATCH v9 0/5] Move Hisilicon 6421v600 SPMI and USB drivers out of staging Mauro Carvalho Chehab
2021-06-25 17:06 ` [PATCH v9 1/5] staging: hikey9xx: split hi6421v600 irq into a separate driver Mauro Carvalho Chehab
2021-06-25 17:06 ` [PATCH v9 2/5] regulator: hi6421v600-regulator: fix platform drvdata Mauro Carvalho Chehab
2021-06-26  3:41   ` Axel Lin [this message]
2021-06-29 10:23     ` Mauro Carvalho Chehab
2021-06-25 17:06 ` [PATCH v9 3/5] mfd: hi6421-spmi-pmic: move driver from staging Mauro Carvalho Chehab
2021-06-28  8:13   ` Dan Carpenter

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=CAFRkauBcXDVihxN8MHoStGHjDyx-VyOe6tT8dkY2tAisHoeE8w@mail.gmail.com \
    --to=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linuxarm@huawei.com \
    --cc=mauro.chehab@huawei.com \
    --cc=mchehab+huawei@kernel.org \
    --subject='Re: [PATCH v9 2/5] regulator: hi6421v600-regulator: fix platform drvdata' \
    /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

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).