linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jhovold@gmail.com (Johan Hovold)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] misc: atmel_pwm: add deferred-probing support
Date: Tue, 22 Oct 2013 18:32:39 +0200	[thread overview]
Message-ID: <1382459560-26596-2-git-send-email-jhovold@gmail.com> (raw)
In-Reply-To: <1382459560-26596-1-git-send-email-jhovold@gmail.com>

Two drivers (atmel-pwm-bl and leds-atmel-pwm) currently depend on the
atmel_pwm driver to have bound to any pwm-device before their devices
are probed.

Support deferred probing of such devices by making sure to return
-EPROBE_DEFER from pwm_channel_alloc when no pwm-device has yet been
bound.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
---
 drivers/misc/atmel_pwm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/atmel_pwm.c b/drivers/misc/atmel_pwm.c
index 494d050..a6dc56e 100644
--- a/drivers/misc/atmel_pwm.c
+++ b/drivers/misc/atmel_pwm.c
@@ -90,8 +90,10 @@ int pwm_channel_alloc(int index, struct pwm_channel *ch)
 	unsigned long	flags;
 	int		status = 0;
 
-	/* insist on PWM init, with this signal pinned out */
-	if (!pwm || !(pwm->mask & 1 << index))
+	if (!pwm)
+		return -EPROBE_DEFER;
+
+	if (!(pwm->mask & 1 << index))
 		return -ENODEV;
 
 	if (index < 0 || index >= PWM_NCHAN || !ch)
-- 
1.8.4

  reply	other threads:[~2013-10-22 16:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 16:32 [PATCH 0/2] misc: atmel_pwm: fix probe dependencies Johan Hovold
2013-10-22 16:32 ` Johan Hovold [this message]
2013-10-30 11:25   ` [PATCH 1/2] misc: atmel_pwm: add deferred-probing support Johan Hovold
2013-10-30 13:24     ` Greg Kroah-Hartman
2013-10-22 16:32 ` [PATCH 2/2] misc: atmel_pwm: set initcall level to subsys Johan Hovold
2013-10-29 23:22   ` Greg Kroah-Hartman
2013-10-30 11:07     ` Johan Hovold
2013-10-30 20:46       ` Arnd Bergmann
2013-10-31  1:19         ` Bo Shen
2013-10-31  5:30           ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-31 14:07             ` Johan Hovold
2013-10-31 14:01         ` Johan Hovold

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=1382459560-26596-2-git-send-email-jhovold@gmail.com \
    --to=jhovold@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).