From patchwork Tue Nov 20 14:04:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12998 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id F282823FC0 for ; Tue, 20 Nov 2012 14:04:50 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 7747FA18F8A for ; Tue, 20 Nov 2012 14:04:50 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so1718418iag.11 for ; Tue, 20 Nov 2012 06:04:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=5mOR4oRcg5zDicVZnoRmbMphMHL6REYbzkgyy5wgb7s=; b=KoCg22ybZFPEIm4SpXrCmYHKlI9gjr/cGWM7FpohTYjNgO+soPEEMisUYJ5EZwP3uo 5BtDuQxnaXsMatAjaL6g1x81pVt6pTQT9ShBuhcgdmqU9ILTDW1FeVoTalzhkvwF7qCq OPM1hI5PP0Ix4YNX03C21q1KyfexdUQ/u+bs0hrK8C4JSkmsY7xK559ibeUUtIXRLFCl 1EbPhqWmSB/sIqEf+8KldixH8snSxUjTsfwEaEtnZJbNwGV2TjU/JjWq0yOExQQVfIlA 4JbEbu74VY2qAEsfuZSlF+3pNocJJ1jV/r5eDhpp/CtQ4uoSyzDIDsOPn/ACCZU2Cj7X +Xbw== Received: by 10.50.186.199 with SMTP id fm7mr9870246igc.62.1353420289921; Tue, 20 Nov 2012 06:04:49 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp322279igt; Tue, 20 Nov 2012 06:04:49 -0800 (PST) Received: by 10.14.194.72 with SMTP id l48mr34637278een.9.1353420288792; Tue, 20 Nov 2012 06:04:48 -0800 (PST) Received: from eu1sys200aog113.obsmtp.com (eu1sys200aog113.obsmtp.com [207.126.144.135]) by mx.google.com with SMTP id j5si21762975eeo.50.2012.11.20.06.04.40 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 06:04:48 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.135; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob113.postini.com ([207.126.147.11]) with SMTP ID DSNKUKuN+HnKJyl8HM3X8SeF5lBw8iBY4TM4@postini.com; Tue, 20 Nov 2012 14:04:48 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 86F4E191; Tue, 20 Nov 2012 14:04:38 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BAA4024AE; Tue, 20 Nov 2012 14:04:37 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 6F6AB24C2F1; Tue, 20 Nov 2012 15:04:30 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 20 Nov 2012 15:04:36 +0100 From: Linus Walleij To: , , Shiraz Hashim , Viresh Kumar Cc: Stephen Warren , Anmar Oueja , Grant Likely , Linus Walleij Subject: [PATCH 3/7] pinctrl: make range registration defer properly Date: Tue, 20 Nov 2012 15:04:31 +0100 Message-ID: <1353420271-18029-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlxYXCaJt668lbhf2gzCiRLpvOCLnAxxOY1kormPKpNOV2WYXQexN8wwOOHDKwvcA5U6niN From: Linus Walleij This makes the pinctrl_find_and_add_gpio_range() return -EPROBE_DEFER if the range hosting pin controller cannot be located. We may assume that the common case for why adding a range fails is that the targe pin controller device has not probed yet. Signed-off-by: Linus Walleij --- drivers/pinctrl/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 15f5ac8..33af811 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -350,8 +350,13 @@ struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname, { struct pinctrl_dev *pctldev = get_pinctrl_dev_from_devname(devname); + /* + * If we can't find this device, let's assume that is because + * it has not probed yet, so the driver trying to register this + * range need to defer probing. + */ if (!pctldev) - return NULL; + return ERR_PTR(-EPROBE_DEFER); pinctrl_add_gpio_range(pctldev, range); return pctldev;