lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141119073954.GA3665@jack-ThinkPad-T520>
Date:	Wed, 19 Nov 2014 16:39:54 +0900
From:	Gyungoh Yoo <gyungoh@...il.com>
To:	Mark Brown <broonie@...nel.org>
Cc:	sameo@...ux.intel.com, lee.jones@...aro.org, jg1.han@...sung.com,
	cooloney@...il.com, lgirdwood@...il.com, jack.yoo@...worksinc.com,
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
	grant.likely@...aro.org, robh+dt@...nel.org, mark.rutland@....com,
	ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
	pawel.moll@....com, heiko@...ech.de, jason@...edaemon.net,
	shawn.guo@...escale.com, treding@...dia.com,
	florian.vaussard@...l.ch, trivial@...nel.org, linux@...ck-us.net,
	andrew@...n.ch, jic23@...nel.org
Subject: Re: [RESUBMIT PATCH v7 7/9] regulator: sky81452: Modify Device Tree
 structure

On Tue, Nov 18, 2014 at 11:20:56AM +0000, Mark Brown wrote:
> On Tue, Nov 18, 2014 at 05:04:51PM +0900, Gyungoh Yoo wrote:
> > On Mon, Nov 17, 2014 at 02:18:36PM +0000, Mark Brown wrote:
> 
> > > Don't open code this, use regulators_node and of_match as previously
> > > advised.
> 
> > I think I had a misunderstanding.
> > But I have no idea about regulators_node and of_match.
> > Could you let me know more about them?
> 
> They are fields in regulator_desc, there are documentation and examples
> in current mainline - take a look at that and ask questions if it is
> unclear.

Okay. Thank you.
If of_match and regulators_node are assigned, don't I need to
call of_regulator_match()? Does regulator_register() call it internally?
So can I write code like below?

static const struct regulator_desc sky81452_reg = {
	.name = "LOUT",
	.of_match = of_match_ptr("lout"),
	.regulators_node = of_match_ptr("regulator"),
	.ops = &sky81452_reg_ops,
	...
};

static int sky81452_reg_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	const struct regulator_init_data *init_data = dev_get_platdata(dev);
	struct regulator_config config = { };
	struct regulator_dev *rdev;

	config.dev = dev->parent;
	config.init_data = init_data;
	config.of_node = dev->of_node;
	config.regmap = dev_get_drvdata(dev->parent);

	rdev = devm_regulator_register(dev, &sky81452_reg, &config);
	if (IS_ERR(rdev)) {
		dev_err(dev, "failed to register. err=%ld\n", PTR_ERR(rdev));
		return PTR_ERR(rdev);
	}

	platform_set_drvdata(pdev, rdev);

	return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ