From patchwork Mon Mar 27 18:02:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baatz X-Patchwork-Id: 9647315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED91A602BF for ; Mon, 27 Mar 2017 18:05:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2393283FF for ; Mon, 27 Mar 2017 18:05:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6C1228408; Mon, 27 Mar 2017 18:05:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B25D283FF for ; Mon, 27 Mar 2017 18:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=IwZAzgplD/DTUIfCjFzYg3VORPn+uQmSxmzJ68NzrT4=; b=g6qMxl+Ei0VxVGuKkI+M6V30Te 5UDCEQ5y8qapSgMMRAsP5PzCnyVO/Fdb1gElLOKzJWC+1HJTa9RE7f9YktXSsm8kgpIMm727S/6BF 86zDPkNu8kaYzWUpIX5X6cEIT21vpWIHPH0xIrTwqCrSuUQPv3qdEIWKVex8105k9Uh75EkJOmd3w NqXSs2RF40pSWXP4SU1H6/EidmEiJbPlLR3axxmasKqY6CeF9jggf89562Y+PE+i4sQ75lbSzR36v df3Nxy1IaaRIJQzwuplXQAuBSkjNsMpeMguLHKAm0EqypN0y6fSjiYfjYMmNbSba8xZ7SkB7pVZmc ZpAlPbKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1csZ17-0006T2-Kr; Mon, 27 Mar 2017 18:05:21 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1csYyi-0004UC-EB; Mon, 27 Mar 2017 18:02:57 +0000 Received: by mail-wr0-x241.google.com with SMTP id p52so12590192wrc.2; Mon, 27 Mar 2017 11:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QtsTV4xJY6vL8x+5xa+wGU22TkS8BTk81LIYaPVG8Og=; b=WmKRZkkTPyXCkxDgKxgz9yBt28vNzZqB74+Nrs61XKUw7OXsvYsWYDziKQb59XVs0I Qe46K0q8ObD2PW4GoJyBtlCOeKj4jAcEsngfiTGkWlLG0hx/pJz2b+q5i/SeD6f4EsBZ erRL5BhiXEJpCL4FF78uMQnfRxvNJH8AF+mNJCl8xI+nYVkPusI+DmjSety5/kYAJ8fN GLNbo+5LOsWUNzKtfJDKlisW5acBDyGmOrp4bQvkomyuQKUiGwt9W00U3oysPBnkgQhC Xqvzf1Ahc0Nxpm4eH7H6hEiIpy9pMj0YJDVp3y8t2++EuEyj8Tjy0UeBr1NuTNMxmVya +kHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QtsTV4xJY6vL8x+5xa+wGU22TkS8BTk81LIYaPVG8Og=; b=Hw0saYE7kFXv7B2hRYT6A3Yh7cz8S2s9auGxsgfx8pATAmWcFm8/5mh+NwH++epxo6 JyVB3S6YqZfSnRgCrdXwDMgPEIz/XGVHMc5Cym1gHS4XfvKCtkilJVWIUd6sx4sldYe0 3vg4As37IZfV6aUV1FnV7m+deTMRWCA7FgKLHocxINv84kEpDDCAp27V4EOaQzm47Jg5 vN+Z/EusL+d/QjA8s3ZpuDsGeHyWAXvflj/gHLvCxPvTLleBmbacl2oLi779XiVbto4B bwdbaKl4Ect2C6wz/xJ1AzgArH++iWELshcot+WJCEVaU1ttTnDfONpthxmdWj8fkGv2 E/lw== X-Gm-Message-State: AFeK/H3+U3yM2FC/siSofNlyoWUPs1k0FKLIwEy29efKsRfefNnxn8Cay/IcKU9b65Budw== X-Received: by 10.28.125.20 with SMTP id y20mr10966401wmc.123.1490637755782; Mon, 27 Mar 2017 11:02:35 -0700 (PDT) Received: from gandalf.schnuecks.de (p57A5677B.dip0.t-ipconnect.de. [87.165.103.123]) by smtp.gmail.com with ESMTPSA id o15sm373345wmd.10.2017.03.27.11.02.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Mar 2017 11:02:35 -0700 (PDT) Received: by gandalf.schnuecks.de (Postfix, from userid 500) id 7E99327195A; Mon, 27 Mar 2017 20:02:34 +0200 (CEST) From: Simon Baatz To: linux-mtd@lists.infradead.org Subject: [PATCH v2 2/2] mtd: nand: orion: improve handling of optional clock Date: Mon, 27 Mar 2017 20:02:08 +0200 Message-Id: <20170327180208.13414-2-gmbnomis@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170327180208.13414-1-gmbnomis@gmail.com> References: <20170327180208.13414-1-gmbnomis@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170327_110253_401728_74C0BBB0 X-CRM114-Status: GOOD ( 14.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, jason@lakedaemon.net, boris.brezillon@free-electrons.com, richard@nod.at, dan.carpenter@oracle.com, u.kleine-koenig@pengutronix.de, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The clock gate used by orion_nand is not available on all platforms. When getting this optional clock gate, the code masked all errors. Let's be more precise here and actually only allow ENOENT. EPROBE_DEFER is handled like any other error code since probe deferral is not supported by drivers using module_platform_driver_probe(). Signed-off-by: Simon Baatz --- Changes in v2: * added patch drivers/mtd/nand/orion_nand.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index 3acdc20485f1..f8e463a97b9e 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c @@ -156,8 +156,17 @@ static int __init orion_nand_probe(struct platform_device *pdev) /* Not all platforms can gate the clock, so it is not an error if the clock does not exists. */ info->clk = devm_clk_get(&pdev->dev, NULL); - if (!IS_ERR(info->clk)) - clk_prepare_enable(info->clk); + if (IS_ERR(info->clk)) { + ret = PTR_ERR(info->clk); + if (ret == -ENOENT) { + info->clk = NULL; + } else { + dev_err(&pdev->dev, "failed to get clock!\n"); + return ret; + } + } + + clk_prepare_enable(info->clk); ret = nand_scan(mtd, 1); if (ret) @@ -173,9 +182,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) return 0; no_dev: - if (!IS_ERR(info->clk)) - clk_disable_unprepare(info->clk); - + clk_disable_unprepare(info->clk); return ret; } @@ -187,8 +194,7 @@ static int orion_nand_remove(struct platform_device *pdev) nand_release(mtd); - if (!IS_ERR(info->clk)) - clk_disable_unprepare(info->clk); + clk_disable_unprepare(info->clk); return 0; }