From patchwork Tue Oct 22 16:32:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 3083911 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1D5B29F2B7 for ; Tue, 22 Oct 2013 16:34:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22A3220498 for ; Tue, 22 Oct 2013 16:34:53 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E664820497 for ; Tue, 22 Oct 2013 16:34:51 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYeu6-0001Qp-Uv; Tue, 22 Oct 2013 16:33:59 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYetw-00083k-Jp; Tue, 22 Oct 2013 16:33:48 +0000 Received: from mail-la0-x231.google.com ([2a00:1450:4010:c03::231]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYetd-00080f-BR for linux-arm-kernel@lists.infradead.org; Tue, 22 Oct 2013 16:33:30 +0000 Received: by mail-la0-f49.google.com with SMTP id eh20so1977216lab.8 for ; Tue, 22 Oct 2013 09:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kDGhNHNv4lEw4BtItC/VsTdVtjHZcbSmuspDpWbrQXw=; b=wwQbhzDyar9nwWbSnuU6mCMZ/owlfRCFDAv80UQDQJm+XG1NHmBpnpKPqOE4YBnKA5 QmWRdBVV/xG5EQNSSz+OARzeNuqORg8WWcUNWsnUelYAWQdw1CEn/4S2KElO4fyG3vR6 8JMfMd2/D+PyuM9EsMZJKMnqOD9mz/AbllTTJl0Rc2kP6g5WMjM+9T3g4BwM8i1dpZoc 43g0lp+QdneyqBP6kt3mje/ZU6vltx9Jn3UOyH9i8qB4SNYAS7XjcP7uGADU3N82fTOK f9IIVsV7529McwqhwhLUFMN0FNT6dUG5BC4T2ZqFzpBwZ6f2YCRflh7y4Co+FrVKlSIv PT6g== X-Received: by 10.152.88.20 with SMTP id bc20mr2366970lab.37.1382459586619; Tue, 22 Oct 2013 09:33:06 -0700 (PDT) Received: from xi.terra (c193-14-141-227.cust.tele2.se. [193.14.141.227]) by mx.google.com with ESMTPSA id kx1sm21740270lac.7.2013.10.22.09.33.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 22 Oct 2013 09:33:05 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.80.1) (envelope-from ) id 1VYetD-0006vz-DW; Tue, 22 Oct 2013 18:33:03 +0200 From: Johan Hovold To: Greg Kroah-Hartman Subject: [PATCH 1/2] misc: atmel_pwm: add deferred-probing support Date: Tue, 22 Oct 2013 18:32:39 +0200 Message-Id: <1382459560-26596-2-git-send-email-jhovold@gmail.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1382459560-26596-1-git-send-email-jhovold@gmail.com> References: <1382459560-26596-1-git-send-email-jhovold@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131022_123329_581889_F3065364 X-CRM114-Status: GOOD ( 12.66 ) X-Spam-Score: -2.0 (--) Cc: linux-arm-kernel@lists.infradead.org, Johan Hovold , Nicolas Ferre , linux-kernel@vger.kernel.org, Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)