/* This function enables software control of a WM8400 regulator via the regulator API. It is intended to be called from the platform_init() callback of the WM8400 MFD driver. */
int wm8400_register_regulator(struct device *dev, int reg, struct regulator_init_data *initdata)
/* This function enables software control of a WM8400 regulator via the regulator API. It is intended to be called from the platform_init() callback of the WM8400 MFD driver. */
int wm8400_register_regulator(struct device *dev, int reg, struct regulator_init_data *initdata)
{
	struct wm8400 *wm8400 = dev_get_drvdata(dev);
	if (wm8400->regulators[reg].name)
		return -EBUSY;
	initdata->driver_data = wm8400;
	wm8400->regulators[reg].name = "wm8400-regulator";
	wm8400->regulators[reg].id = reg;
	wm8400->regulators[reg].dev.parent = dev;
	wm8400->regulators[reg].dev.platform_data = initdata;
	dev_set_drvdata(&wm8400->regulators[reg].dev, wm8400);
	return platform_device_register(&wm8400->regulators[reg]);
}