All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linuxarm@huawei.com, mauro.chehab@huawei.com,
	Axel Lin <axel.lin@ingics.com>, Lee Jones <lee.jones@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH v10 2/5] regulator: hi6421v600-regulator: fix platform drvdata
Date: Tue, 29 Jun 2021 21:31:56 +0200	[thread overview]
Message-ID: <20210629213156.56e6f126@coco.lan> (raw)
In-Reply-To: <20210629151101.GB4613@sirena.org.uk>

Em Tue, 29 Jun 2021 16:11:01 +0100
Mark Brown <broonie@kernel.org> escreveu:

> On Tue, Jun 29, 2021 at 12:31:28PM +0200, Mauro Carvalho Chehab wrote:
> 
> > platform drvdata can't be used inside the regulator driver,
> > as this is already used by the MFD and SPMI drivers.  
> 
> Can you clarify what exactly is using which platform drvdata already?
> This all feels very confused and I can't tell what the problem that's
> being fixed is, if it's a real issue or how this fixes it.

I don't remember the dirty details anymore... It has been almost a year
since when I started doing that. The SPMI controller driver left staging
8 months ago.

I guess it is related with passing the parent's device to
devm_regulator_register() at the hi6421v600-regulator driver:

	struct regulator_config config = { };
...
	config.dev = pdev->dev.parent;
...
	rdev = devm_regulator_register(dev, &info->desc, &config);

This is needed by SPMI bus and the SPMI controller in order to use the 
right platform data when talking to the hardware.

> >  drivers/misc/hi6421v600-irq.c               |  9 ++--
> >  drivers/regulator/hi6421v600-regulator.c    | 49 +++++++++++----------
> >  drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 18 +++-----
> >  include/linux/mfd/hi6421-spmi-pmic.h        | 25 -----------  
> 
> I'm especially nervous about the core driver still being in staging
> perhaps meaning there's some issue with it doing odd and confusing
> things.

The only missing part in staging is the MFD driver. At the current way,
it is very simple (71 lines in total): it just declares a regmap, and has 
a single function on it:

	static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
	{
		struct device *dev = &pdev->dev;
		int ret;
		struct hi6421_spmi_pmic *ddata;
		ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
		if (!ddata)
			return -ENOMEM;
	
		ddata->regmap = devm_regmap_init_spmi_ext(pdev, &regmap_config);
		if (IS_ERR(ddata->regmap))
			return PTR_ERR(ddata->regmap);
	
		ddata->dev = dev;
	
		dev_set_drvdata(&pdev->dev, ddata);

		ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,
					   hi6421v600_devs, ARRAY_SIZE(hi6421v600_devs),
					   NULL, 0, NULL);
		if (ret < 0)
			dev_err(dev, "Failed to add child devices: %d\n", ret);

		return ret;
	}

You can see the full driver's code at:
	https://lore.kernel.org/lkml/8d871e2ccc544d11959c16d8312dbf03dd01b1c8.1624962269.git.mchehab+huawei@kernel.org/#Z30drivers:mfd:hi6421-spmi-pmic.c

I'm not aware of anything left preventing it to leave staging.

Thanks,
Mauro

  reply	other threads:[~2021-06-29 19:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 10:31 [PATCH v10 0/5] Move Hisilicon 6421v600 SPMI and USB drivers out of staging Mauro Carvalho Chehab
2021-06-29 10:31 ` Mauro Carvalho Chehab
2021-06-29 10:31 ` [PATCH v10 1/5] staging: hikey9xx: split hi6421v600 irq into a separate driver Mauro Carvalho Chehab
2021-06-29 10:31 ` [PATCH v10 2/5] regulator: hi6421v600-regulator: fix platform drvdata Mauro Carvalho Chehab
     [not found]   ` <CAFRkauCzHqUfva+zTRhOyiMMb4WsKPHvYJuqpOPwy+siPMZGOQ@mail.gmail.com>
2021-06-29 11:09     ` Mauro Carvalho Chehab
     [not found]       ` <CAFRkauCPKQyD_Dooqrxvra94RyLXrPDeCSSdfBfvh-o0Zh8q3g@mail.gmail.com>
2021-06-29 13:32         ` Mauro Carvalho Chehab
2021-06-29 15:11   ` Mark Brown
2021-06-29 19:31     ` Mauro Carvalho Chehab [this message]
2021-06-30  8:20     ` Mauro Carvalho Chehab
2021-06-29 10:31 ` [PATCH v10 3/5] mfd: hi6421-spmi-pmic: move driver from staging Mauro Carvalho Chehab
2021-07-01 14:02   ` Rob Herring
2021-06-29 10:31 ` [PATCH v10 4/5] dts: hisilicon: add support for the PMIC found on Hikey 970 Mauro Carvalho Chehab
2021-06-29 10:31   ` Mauro Carvalho Chehab
2021-06-29 10:31 ` [PATCH v10 5/5] dts: hisilicon: add support for USB3 " Mauro Carvalho Chehab
2021-06-29 10:31   ` Mauro Carvalho Chehab
2021-06-29 10:43 ` [PATCH v10 0/5] Move Hisilicon 6421v600 SPMI and USB drivers out of staging Greg Kroah-Hartman
2021-06-29 10:43   ` Greg Kroah-Hartman
2021-06-30  8:28   ` Mauro Carvalho Chehab
2021-06-30  8:28     ` Mauro Carvalho Chehab

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=20210629213156.56e6f126@coco.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=arnd@arndb.de \
    --cc=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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.