From patchwork Thu Jan 10 17:58:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10756557 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 8537917D2 for ; Thu, 10 Jan 2019 18:00:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 758C229BF0 for ; Thu, 10 Jan 2019 18:00:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69DAF29CDE; Thu, 10 Jan 2019 18:00:26 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 E5E3D29C95 for ; Thu, 10 Jan 2019 18:00:25 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=qkQzWaIKcpx9lmJCkpA9rWRMSDnAdpuwzxKpPTyHsEo=; b=UJjFb+Hmu1+Rmx WF4E0Uqn44ikL6K8HE1baT7kh6L2x/Vw10+oDgBg5RRw14M1mwrVlrHsIqvIqBB5QPG1J4Cu9BcLa NOyoxnJj6isxfuYFFZpic8Ns1nVmu9gjpnMo7dwO7eMLqIcd3/VFOYxK7G5ALAvIkrBKgIe1RHj58 y/W6/BxiQLjfSdl0zCiwzVGEf5z/TWKZPZ9YWjzgRKsBw9TQenm76NmqPOy/6Des2DFDJHwwdToE0 vQVunyntz3AU57v4SGn2SXLCyga/9nhJ22WXUZEwiMW64N8fMal1j7Kz8mqpGO98IcN6c/ZVU+9zg TJhUS30wcISrJgr2Kekg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghecu-0002pE-L7; Thu, 10 Jan 2019 18:00:20 +0000 Received: from shell.v3.sk ([90.176.6.54]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghebu-0000y4-6k for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2019 17:59:21 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 53F7D1002F8; Thu, 10 Jan 2019 18:59:16 +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 9P_664rwX-dS; Thu, 10 Jan 2019 18:59:05 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id E88BB1002F5; Thu, 10 Jan 2019 18:58:58 +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 YswE2QpCw7nS; Thu, 10 Jan 2019 18:58:55 +0100 (CET) Received: from belphegor.brq.redhat.com (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id 4E7B21002F6; Thu, 10 Jan 2019 18:58:54 +0100 (CET) From: Lubomir Rintel To: Andy Shevchenko , Darren Hart Subject: [PATCH v5 04/10] Platform: OLPC: Avoid a warning if the EC didn't register yet Date: Thu, 10 Jan 2019 18:58:39 +0100 Message-Id: <20190110175845.1203986-5-lkundrak@v3.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110175845.1203986-1-lkundrak@v3.sk> References: <20190110175845.1203986-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190110_095918_973934_7B43D93C X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. 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: Mark Rutland , devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Russell King , platform-driver-x86@vger.kernel.org, Lubomir Rintel , Rob Herring , Pavel Machek , linux-arm-kernel@lists.infradead.org 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 Just return EPROBE_DEFER, so that whoever attempted to use the EC call can defer their work. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- Changes since v2: - Adjust the commit message for the s/ENODEV/EPROBE_DEFER/ change Changes since v1: - EPROBE_DEFER instead of ENODEV drivers/platform/olpc/olpc-ec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c index 2a647455a368..a91f78245f5e 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -125,8 +125,11 @@ int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, size_t outlen) struct olpc_ec_priv *ec = ec_priv; struct ec_cmd_desc desc; - /* Ensure a driver and ec hook have been registered */ - if (WARN_ON(!ec_driver || !ec_driver->ec_cmd)) + /* Driver not yet registered. */ + if (!ec_driver) + return -EPROBE_DEFER; + + if (WARN_ON(!ec_driver->ec_cmd)) return -ENODEV; if (!ec)