From patchwork Mon Nov 12 02:30:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10678007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50C8B139B for ; Mon, 12 Nov 2018 02:31:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4218A2A302 for ; Mon, 12 Nov 2018 02:31:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 368A32A303; Mon, 12 Nov 2018 02:31:04 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7E462A304 for ; Mon, 12 Nov 2018 02:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730270AbeKLMVr (ORCPT ); Mon, 12 Nov 2018 07:21:47 -0500 Received: from shell.v3.sk ([90.176.6.54]:59291 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbeKLMVq (ORCPT ); Mon, 12 Nov 2018 07:21:46 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id B486EC6A0B; Mon, 12 Nov 2018 03:30:45 +0100 (CET) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ZpYhbe4TjvBD; Mon, 12 Nov 2018 03:30:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id E2D97C6A0F; Mon, 12 Nov 2018 03:30:37 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Zr5tf_9SJ69F; Mon, 12 Nov 2018 03:30:36 +0100 (CET) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id EA132C6A10; Mon, 12 Nov 2018 03:30:35 +0100 (CET) From: Lubomir Rintel To: Dmitry Torokhov , Michael Turquette , Stephen Boyd , linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Mark Rutland , Lubomir Rintel Subject: [PATCH v2 5/6] Input: olpc_apsp: check FIFO status on open(), not probe() Date: Mon, 12 Nov 2018 03:30:28 +0100 Message-Id: <20181112023029.648408-6-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181112023029.648408-1-lkundrak@v3.sk> References: <20181112023029.648408-1-lkundrak@v3.sk> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Let's defer the FIFO status checking until open(). When we'll get a clk handle, this will allow us to defer clock enablement until the device is actually used. Signed-off-by: Lubomir Rintel --- drivers/input/serio/olpc_apsp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c index 8e9a4209fcad..8b19a47dfa46 100644 --- a/drivers/input/serio/olpc_apsp.c +++ b/drivers/input/serio/olpc_apsp.c @@ -145,8 +145,15 @@ static int olpc_apsp_open(struct serio *port) { struct olpc_apsp *priv = port->port_data; unsigned int tmp; + unsigned long l; if (priv->open_count++ == 0) { + l = readl(priv->base + COMMAND_FIFO_STATUS); + if (!(l & CMD_STS_MASK)) { + dev_err(priv->dev, "SP cannot accept commands.\n"); + return -EIO; + } + /* Enable interrupt 0 by clearing its bit */ tmp = readl(priv->base + PJ_INTERRUPT_MASK); writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK); @@ -173,7 +180,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) struct olpc_apsp *priv; struct resource *res; struct device_node *np; - unsigned long l; int error; priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL); @@ -192,12 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) if (priv->irq < 0) return priv->irq; - l = readl(priv->base + COMMAND_FIFO_STATUS); - if (!(l & CMD_STS_MASK)) { - dev_err(&pdev->dev, "SP cannot accept commands.\n"); - return -EIO; - } - /* KEYBOARD */ kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); if (!kb_serio)