提交 9201d38b 编写于 作者: M Mark Brown 提交者: Liam Girdwood

mfd: Add WM8350 subdevice registration helper

Most of the subdevices for the WM8350 code are registered in the same
fashion so factor out the code to do the initial registration.
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: NSamuel Ortiz <sameo@openedhand.com>
Signed-off-by: NLiam Girdwood <lrg@slimlogic.co.uk>
上级 da09155a
...@@ -1130,6 +1130,32 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int mode) ...@@ -1130,6 +1130,32 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int mode)
} }
EXPORT_SYMBOL_GPL(wm8350_create_cache); EXPORT_SYMBOL_GPL(wm8350_create_cache);
/*
* Register a client device. This is non-fatal since there is no need to
* fail the entire device init due to a single platform device failing.
*/
static void wm8350_client_dev_register(struct wm8350 *wm8350,
const char *name,
struct platform_device **pdev)
{
int ret;
*pdev = platform_device_alloc(name, -1);
if (pdev == NULL) {
dev_err(wm8350->dev, "Failed to allocate %s\n", name);
return;
}
(*pdev)->dev.parent = wm8350->dev;
platform_set_drvdata(*pdev, wm8350);
ret = platform_device_add(*pdev);
if (ret != 0) {
dev_err(wm8350->dev, "Failed to register %s: %d\n", name, ret);
platform_device_put(*pdev);
*pdev = NULL;
}
}
int wm8350_device_init(struct wm8350 *wm8350, int irq, int wm8350_device_init(struct wm8350 *wm8350, int irq,
struct wm8350_platform_data *pdata) struct wm8350_platform_data *pdata)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册