public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Samuel Ortiz <sameo@openedhand.com>, Liam Girdwood <lrg@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 14/14] mfd: Add WM8350 subdevice registration helper
Date: Fri, 10 Oct 2008 15:58:16 +0100	[thread overview]
Message-ID: <1223650696-15552-14-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1223650696-15552-13-git-send-email-broonie@opensource.wolfsonmicro.com>

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: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm8350-core.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index 9a1a0b2..cd1f76e 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -1130,6 +1130,32 @@ out:
 }
 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,
 		       struct wm8350_platform_data *pdata)
 {
-- 
1.5.6.5


  reply	other threads:[~2008-10-10 15:01 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-06 12:32 [PATCH 0/13] WM8350 support Mark Brown
2008-10-06 12:37 ` [PATCH 01/13] mfd: Add WM8350 audio register definitions Mark Brown
2008-10-06 12:37   ` [PATCH 02/13] mfd: Add WM8350 GPIO " Mark Brown
2008-10-06 12:37     ` [PATCH 03/13] mfd: Add WM8350 PMIC " Mark Brown
2008-10-06 12:37       ` [PATCH 04/13] mfd: Add WM8350 PMU " Mark Brown
2008-10-06 12:38         ` [PATCH 05/13] mfd: Add WM8350 comparator " Mark Brown
2008-10-06 12:38           ` [PATCH 06/13] mfd: Add WM8350 RTC " Mark Brown
2008-10-06 12:38             ` [PATCH 07/13] mfd: Add WM8350 watchdog " Mark Brown
2008-10-06 12:38               ` [PATCH 08/13] mfd: Core support for the WM8350 AudioPlus PMIC Mark Brown
2008-10-06 12:38                 ` [PATCH 09/13] mfd: Add I2C control support for WM8350 Mark Brown
2008-10-06 12:38                   ` [PATCH 10/13] mfd: Add GPIO pin configuration " Mark Brown
2008-10-06 12:38                     ` [PATCH 11/13] mfd: Add initialisation callback " Mark Brown
2008-10-06 12:38                       ` [PATCH 12/13] mfd: Add WM8350 interrupt support Mark Brown
2008-10-06 12:38                         ` [PATCH 13/13] regulator: Add WM8350 regulator support Mark Brown
2008-10-09 12:05                 ` [PATCH 08/13] mfd: Core support for the WM8350 AudioPlus PMIC Liam Girdwood
2008-10-09 12:53                   ` Mark Brown
2008-10-10 14:24 ` [PATCH 0/13] WM8350 support Liam Girdwood
2008-10-10 14:31   ` Samuel Ortiz
2008-10-10 14:38     ` Mark Brown
2008-10-10 14:45       ` Liam Girdwood
2008-10-10 14:58         ` [PATCH 01/14] mfd: Add WM8350 audio register definitions Mark Brown
2008-10-10 14:58           ` [PATCH 02/14] mfd: Add WM8350 GPIO " Mark Brown
2008-10-10 14:58             ` [PATCH 03/14] mfd: Add WM8350 PMIC " Mark Brown
2008-10-10 14:58               ` [PATCH 04/14] mfd: Add WM8350 PMU " Mark Brown
2008-10-10 14:58                 ` [PATCH 05/14] mfd: Add WM8350 comparator " Mark Brown
2008-10-10 14:58                   ` [PATCH 06/14] mfd: Add WM8350 RTC " Mark Brown
2008-10-10 14:58                     ` [PATCH 07/14] mfd: Add WM8350 watchdog " Mark Brown
2008-10-10 14:58                       ` [PATCH 08/14] mfd: Core support for the WM8350 AudioPlus PMIC Mark Brown
2008-10-10 14:58                         ` [PATCH 09/14] mfd: Add I2C control support for WM8350 Mark Brown
2008-10-10 14:58                           ` [PATCH 10/14] mfd: Add GPIO pin configuration " Mark Brown
2008-10-10 14:58                             ` [PATCH 11/14] mfd: Add initialisation callback " Mark Brown
2008-10-10 14:58                               ` [PATCH 12/14] mfd: Add WM8350 interrupt support Mark Brown
2008-10-10 14:58                                 ` [PATCH 13/14] regulator: Add WM8350 regulator support Mark Brown
2008-10-10 14:58                                   ` Mark Brown [this message]
2008-10-11 14:18                                     ` [PATCH 14/14] mfd: Add WM8350 subdevice registration helper Samuel Ortiz
2008-10-11 15:38                                       ` Mark Brown
2008-10-11 14:09                             ` [PATCH 10/14] mfd: Add GPIO pin configuration support for WM8350 Samuel Ortiz
2008-10-11 14:46                               ` Mark Brown
2008-10-11 14:23         ` [PATCH 0/13] WM8350 support Samuel Ortiz
2008-10-10 14:48       ` Samuel Ortiz
2008-10-10 14:38     ` Liam Girdwood

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=1223650696-15552-14-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@kernel.org \
    --cc=sameo@openedhand.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox