From patchwork Tue Jul 24 14:40:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1231511 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 05B70DFFCE for ; Tue, 24 Jul 2012 14:40:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755266Ab2GXOkm (ORCPT ); Tue, 24 Jul 2012 10:40:42 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:36985 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755199Ab2GXOkm (ORCPT ); Tue, 24 Jul 2012 10:40:42 -0400 Received: from avalon.ideasonboard.com (unknown [91.178.58.188]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6D9CF35A8A; Tue, 24 Jul 2012 16:40:38 +0200 (CEST) From: Laurent Pinchart To: linux-sh@vger.kernel.org Cc: Magnus Damm , Richard Purdie , Simon Horman Subject: [PATCH v2 4/6] pwm_backlight: Add deferred probe support Date: Tue, 24 Jul 2012 16:40:21 +0200 Message-Id: <1343140823-13754-5-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1343140823-13754-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1343140823-13754-1-git-send-email-laurent.pinchart@ideasonboard.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org If the PWM instance is not available yet at probe time, request a deferred probe. A better way to fix might be to create a PWM subsystem (possibly integrated into the GPIO subsystem) to support generic PWM objects, and make sure the subsystem gets initialized first. Signed-off-by: Laurent Pinchart Tested-by: Simon Horman --- drivers/video/backlight/pwm_bl.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 342b7d7..5df8b91 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -121,6 +121,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) if (IS_ERR(pb->pwm)) { dev_err(&pdev->dev, "unable to request PWM for backlight\n"); ret = PTR_ERR(pb->pwm); + if (ret == -ENODEV) + ret = -EPROBE_DEFER; goto err_alloc; } else dev_dbg(&pdev->dev, "got pwm for backlight\n");