From patchwork Wed Jun 1 01:30:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9145865 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 51D6A60752 for ; Wed, 1 Jun 2016 01:30:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44E3526240 for ; Wed, 1 Jun 2016 01:30:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 390C026835; Wed, 1 Jun 2016 01:30:15 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 B226426240 for ; Wed, 1 Jun 2016 01:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757056AbcFABaN (ORCPT ); Tue, 31 May 2016 21:30:13 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35754 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757040AbcFABaL (ORCPT ); Tue, 31 May 2016 21:30:11 -0400 Received: by mail-pf0-f195.google.com with SMTP id f144so834454pfa.2; Tue, 31 May 2016 18:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=gPpNZZz+bH3XLvLfP1/zusD9fOvxFEF1KGZeXT9yfzY=; b=j/glF+N3y/QNldbSeObq+5yao7ke3wEEKawjQwo+nuK2bs+T7WVkX2HtV9nPm8VQGH bcoCiEgwAdNjrfhM2spSLPtuYylmRl4DWsYV9NvcpQa4/0FDDD7RQDBonGZDQtPrlwnT IBQ+ABT34g1XQfIMJA0TivRKKitkQG9m43c8AmAQU5aYeo5+pFGPO11tGRp4CFCe1RIp S5w3bDJJ4BtIkFSDwPMPL4WVLT9IZXltbNOmjdUKcuyEZUQvZlHwKhighEmGeWVRet/x s9GXmAwhjsGuh/EJKUD5HOcknmWfBo3VVhFercD/zk8SJrriqsGUTkYyl2l7cmIpUjrs GIEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=gPpNZZz+bH3XLvLfP1/zusD9fOvxFEF1KGZeXT9yfzY=; b=GWDmOyXoMmUavJn5aLyHlcF+YBwbW5+jlXfWEtvdbL8ogP3DGvVxIy4997iQ6lRMdC YD4qjmN6iIXmrQJ5suZEdOL/uJnwJ8sY1EzRdpDRbdGgmVbuMPO4OdMXQEO1R7q9kyL7 41ATjV5kJildrxlYy4W75qDuzTgp5aNXIMo2BtdmTtlACOGrrJ7a2zHU02uO/7cZ137k AnphY3jd+EA+4DEM2F1h6bHmtaJlAJCAg/fO1bdGZJRbhM2cQm7M+PrX3IxDSCt26NLE jZx3+tny1Li8qT+yo2ywSCp2qRRDCWZrVGwaUSiTVt1IPzZPvj6NKBdATYBMoNF6PTkw wGXg== X-Gm-Message-State: ALyK8tIN0E6EnNO42ZrweRzwuL9GPnRZN4F/b1eLWqLgv3M9WRarKd2Wk8UYmMn/153Tgw== X-Received: by 10.98.22.141 with SMTP id 135mr2530352pfw.116.1464744610585; Tue, 31 May 2016 18:30:10 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1311:7492:cad3:56f4:7ddb]) by smtp.gmail.com with ESMTPSA id kb15sm57722167pad.28.2016.05.31.18.30.09 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 31 May 2016 18:30:09 -0700 (PDT) Date: Tue, 31 May 2016 18:30:07 -0700 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Jeffrey Lin , Guenter Roeck , linux-kernel@vger.kernel.org Subject: [PATCH] Input: raydium_i2c_ts - do not ignore EPROBE_DEFER from gpiod_get_optional Message-ID: <20160601013007.GA13021@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We should not be ignoring -EPROBE_DEFER reported by devm_gpiod_get_optional(), but report it as any other error to the upper layers. While we are at it simplify check for the presence of reset GPIO and instead of using IS_ERR_OR_NULL just use boolean. Also do not return -ENOMEM from suspend handler when the device in bootloader mode as that does not make sense and switch to -EBUSY instead. Reported-by: Guenter Roeck Signed-off-by: Dmitry Torokhov Reviewed-by: Guenter Roeck --- drivers/input/touchscreen/raydium_i2c_ts.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c index 1ae65f6..f3076d9 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -930,7 +930,7 @@ static int raydium_i2c_power_on(struct raydium_data *ts) { int error; - if (IS_ERR_OR_NULL(ts->reset_gpio)) + if (!ts->reset_gpio) return 0; gpiod_set_value_cansleep(ts->reset_gpio, 1); @@ -967,7 +967,7 @@ static void raydium_i2c_power_off(void *_data) { struct raydium_data *ts = _data; - if (!IS_ERR_OR_NULL(ts->reset_gpio)) { + if (ts->reset_gpio) { gpiod_set_value_cansleep(ts->reset_gpio, 1); regulator_disable(ts->vccio); regulator_disable(ts->avdd); @@ -1018,11 +1018,10 @@ static int raydium_i2c_probe(struct i2c_client *client, GPIOD_OUT_LOW); if (IS_ERR(ts->reset_gpio)) { error = PTR_ERR(ts->reset_gpio); - if (error != -EPROBE_DEFER) { + if (error != -EPROBE_DEFER) dev_err(&client->dev, "failed to get reset gpio: %d\n", error); - return error; - } + return error; } error = raydium_i2c_power_on(ts); @@ -1138,7 +1137,7 @@ static int __maybe_unused raydium_i2c_suspend(struct device *dev) /* Sleep is not available in BLDR recovery mode */ if (ts->boot_mode != RAYDIUM_TS_MAIN) - return -ENOMEM; + return -EBUSY; disable_irq(client->irq);