From patchwork Tue May 2 06:08:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 98399 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1725370qgf; Mon, 1 May 2017 23:08:44 -0700 (PDT) X-Received: by 10.98.220.8 with SMTP id t8mr29774671pfg.144.1493705323968; Mon, 01 May 2017 23:08:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y96si17430179plh.19.2017.05.01.23.08.43; Mon, 01 May 2017 23:08:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750920AbdEBGIm (ORCPT + 4 others); Tue, 2 May 2017 02:08:42 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34221 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbdEBGIl (ORCPT ); Tue, 2 May 2017 02:08:41 -0400 Received: by mail-pg0-f68.google.com with SMTP id t7so19385277pgt.1; Mon, 01 May 2017 23:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=+7dJ4BxkRVFu4YEe/rpbZBUwBry7og+Q59+tShAaDs0=; b=oC+UmR181BPeFyV83P6bF59dV/HeMXDhWZIy8Ed+BRs4QzzAYvV/5qN0CiP2pfI3Sj v4KndNME3fZ1LNpyj0or/yM5zPMRnCLM84Vu379tjUoiAXU8zAwaQV1eXE6yNQo4ZfJl S+tmAEDwuJrp3R530s2x93zS9Q0s6PuMXH44+OUmgFQlOFcmy5UI0lhgFqPPUcbju3vH dW7OlMm+5RKbgQZoU9WeDWdCQHoYg9JjEkuW2o0zICYSxrTbCPPYyFEC6OQsLEWiMFU9 K1lRI9eV9f2F5xgN1YfvCXeSiETiCv1osrpS3s4R2OZX3kMtf9Ipq9wHkuKdqAjMv5oz qjYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=+7dJ4BxkRVFu4YEe/rpbZBUwBry7og+Q59+tShAaDs0=; b=Kq7vV3ga6SrFR2Ck+yxvW4abuZDWMnAN86HUY4ZSHInsu7zYdAxgNFU9lCkH+NZTAe fvn7UQpiEgVA4yFVvrDxHL9f9wlJ9xL+nwjSwXggGm1zAiRqyHIA9werx1kyLefeeunx jDyGALUcz7K1sLCdKVB55msJiiaj8gU70QNzXt/nFMor2SAprudAoqaE66ynyJD1mUN5 e1WmRBNWH5r7kFZBMEUep1DVG8pL1EWOAkLY3k1TyoM3vPfCxsUyuimZ0QVwL3f2XAA1 3r3ujY0mnBGX2FuNlC3GdYOKYB5be2KJZdszN9q33CuDHFJaXhlRqsf3OrTp5SKfuzl5 cDXQ== X-Gm-Message-State: AN3rC/44PyGML1pprokfz6BSZFJmnLR31qxisHlqzDz/znuEQ9qfRLly 88V/1Sp2PpfA/A== X-Received: by 10.98.83.4 with SMTP id h4mr546911pfb.241.1493705315799; Mon, 01 May 2017 23:08:35 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id 3sm23618891pfe.20.2017.05.01.23.08.32 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 01 May 2017 23:08:35 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 02 May 2017 15:38:29 +0930 From: Joel Stanley To: Linus Walleij , Alexandre Courbot Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Jeffery Subject: [PATCH] gpio: aspeed: Don't attempt to debounce if disabled Date: Tue, 2 May 2017 15:38:24 +0930 Message-Id: <20170502060824.6457-1-joel@jms.id.au> X-Mailer: git-send-email 2.11.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org We warn the user at driver probe time that debouncing is disabled. However, if they request debouncing later on we print a confusing error message: gpio_aspeed 1e780000.gpio: Failed to convert 5000us to cycles at 0Hz: -524 Instead bail out when the clock is not present. Fixes: 5ae4cb94b3133 (gpio: aspeed: Add debounce support) Signed-off-by: Joel Stanley --- drivers/gpio/gpio-aspeed.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index ccea609676ee..4ca436e66bdb 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -646,6 +646,9 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset, int rc; int i; + if (!gpio->clk) + return -EINVAL; + rc = usecs_to_cycles(gpio, usecs, &requested_cycles); if (rc < 0) { dev_warn(chip->parent, "Failed to convert %luus to cycles at %luHz: %d\n",