From patchwork Mon May 13 21:18:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baatz X-Patchwork-Id: 2560661 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 69BE53FD4E for ; Mon, 13 May 2013 21:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753966Ab3EMVTl (ORCPT ); Mon, 13 May 2013 17:19:41 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.160]:12356 "EHLO mo-p00-ob.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752912Ab3EMVTl (ORCPT ); Mon, 13 May 2013 17:19:41 -0400 X-RZG-AUTH: :L20Qdkipd/NtQfa28f3iP6nsj1VEm6lxnnjU56eNUnjyVKhsqhnPYh2bEHIh+4rflDg= X-RZG-CLASS-ID: mo00 Received: from gandalf.schnuecks.de (p5DE8E559.dip0.t-ipconnect.de [93.232.229.89]) by smtp.strato.de (jored mo2) (RZmta 31.27 DYNA|AUTH) with (DHE-RSA-AES256-SHA encrypted) ESMTPA id Z01b37p4DKt9B0 ; Mon, 13 May 2013 23:19:39 +0200 (CEST) Received: by gandalf.schnuecks.de (Postfix, from userid 500) id 86E5D4014B; Mon, 13 May 2013 23:19:39 +0200 (CEST) From: Simon Baatz To: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Cc: Jason Cooper , Andrew Lunn , Chris Ball , Guennadi Liakhovetski , Thomas Petazzoni Subject: [PATCH V2 01/10] mmc: return mmc_of_parse() errors to caller Date: Mon, 13 May 2013 23:18:52 +0200 Message-Id: <1368479941-10084-2-git-send-email-gmbnomis@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1368479941-10084-1-git-send-email-gmbnomis@gmail.com> References: <1368479941-10084-1-git-send-email-gmbnomis@gmail.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org In addition to just logging errors encountered during DT parsing or allocating GPIO slots for CD/WP, mmc_of_parse() now returns with an error. Signed-off-by: Simon Baatz Reviewed-by: Ulf Hansson --- drivers/mmc/core/host.c | 24 +++++++++++++++++++----- include/linux/mmc/host.h | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 2a3593d..45122cc 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -306,7 +306,7 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host) * parse the properties and set respective generic mmc-host flags and * parameters. */ -void mmc_of_parse(struct mmc_host *host) +int mmc_of_parse(struct mmc_host *host) { struct device_node *np; u32 bus_width; @@ -315,7 +315,7 @@ void mmc_of_parse(struct mmc_host *host) int len, ret, gpio; if (!host->parent || !host->parent->of_node) - return; + return 0; np = host->parent->of_node; @@ -338,6 +338,7 @@ void mmc_of_parse(struct mmc_host *host) default: dev_err(host->parent, "Invalid \"bus-width\" value %ud!\n", bus_width); + return -EINVAL; } /* f_max is obtained from the optional "max-frequency" property */ @@ -372,13 +373,15 @@ void mmc_of_parse(struct mmc_host *host) gpio_inv_cd = true; ret = mmc_gpio_request_cd(host, gpio); - if (ret < 0) + if (ret < 0) { dev_err(host->parent, "Failed to request CD GPIO #%d: %d!\n", gpio, ret); - else + return ret; + } else { dev_info(host->parent, "Got CD GPIO #%d.\n", gpio); + } } if (explicit_inv_cd ^ gpio_inv_cd) @@ -394,9 +397,14 @@ void mmc_of_parse(struct mmc_host *host) gpio_inv_wp = true; ret = mmc_gpio_request_ro(host, gpio); - if (ret < 0) + if (ret < 0) { dev_err(host->parent, "Failed to request WP GPIO: %d!\n", ret); + goto out; + } else { + dev_info(host->parent, "Got WP GPIO #%d.\n", + gpio); + } } if (explicit_inv_wp ^ gpio_inv_wp) host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; @@ -413,6 +421,12 @@ void mmc_of_parse(struct mmc_host *host) host->pm_caps |= MMC_PM_KEEP_POWER; if (of_find_property(np, "enable-sdio-wakeup", &len)) host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ; + + return 0; + +out: + mmc_gpio_free_cd(host); + return ret; } EXPORT_SYMBOL(mmc_of_parse); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index e326ae2..c8c4fbc 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -369,7 +369,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *); int mmc_add_host(struct mmc_host *); void mmc_remove_host(struct mmc_host *); void mmc_free_host(struct mmc_host *); -void mmc_of_parse(struct mmc_host *host); +int mmc_of_parse(struct mmc_host *host); static inline void *mmc_priv(struct mmc_host *host) {