From patchwork Wed Sep 4 12:23:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 19752 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9826E25AC6 for ; Wed, 4 Sep 2013 12:24:00 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w8sf349283qac.4 for ; Wed, 04 Sep 2013 05:24:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=z/rhpnidT2mD0vtfPy9i4c5K/VT841DJWLh2Fz8jykk=; b=SjIKPYfi8LmT54ywh5cTy2wHzqArQ8nZ2qiTc2P2NGJTkjAupByTuuBseZJ1pbCaWr enC4hk+gHbtHJfuB1Ye3ewC6T7D/q1pq+9RZaQYjMEMAxGaogesIg/EHxAImvSl3QZ+o KxwY2ekWJ3jvNlNsA0n5P5RzX/F30VjYMTfY6cTs17ASac9+MBamGFmbEhz7RIdnNl0c jrMMyqOCYB+aA07FcitehgMHBponUNMbj8CRnlQMscD34j5G8K6/IaPB5rXZzY6j2fIs EzehrZU0s3spupBa2xYZd4eO7tu1w7/ETuDyDUyFk8pO45g2IGLDF/mGC9tgvVtro9l7 aY0w== X-Received: by 10.236.13.36 with SMTP id a24mr911675yha.50.1378297439968; Wed, 04 Sep 2013 05:23:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.108.7 with SMTP id hg7ls93141qeb.95.gmail; Wed, 04 Sep 2013 05:23:59 -0700 (PDT) X-Received: by 10.220.164.202 with SMTP id f10mr937027vcy.25.1378297439811; Wed, 04 Sep 2013 05:23:59 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id bq2si5807239vcb.40.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 05:23:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ib11so167227vcb.0 for ; Wed, 04 Sep 2013 05:23:59 -0700 (PDT) X-Gm-Message-State: ALoCoQnFXort4LzarFlKeb8R26sSWw11VMLtRQ0UNp6MMJLiEEGeAf19NEUQBcRxBL3GMR1edCYk X-Received: by 10.52.165.237 with SMTP id zb13mr1381694vdb.28.1378297439540; Wed, 04 Sep 2013 05:23:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp230879vcz; Wed, 4 Sep 2013 05:23:58 -0700 (PDT) X-Received: by 10.14.224.198 with SMTP id x46mr3204455eep.53.1378297438467; Wed, 04 Sep 2013 05:23:58 -0700 (PDT) Received: from mail-ea0-f179.google.com (mail-ea0-f179.google.com [209.85.215.179]) by mx.google.com with ESMTPS id e49si18978122eep.261.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 05:23:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.179 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.179; Received: by mail-ea0-f179.google.com with SMTP id b10so131790eae.38 for ; Wed, 04 Sep 2013 05:23:57 -0700 (PDT) X-Received: by 10.15.31.12 with SMTP id x12mr687702eeu.75.1378297437846; Wed, 04 Sep 2013 05:23:57 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id j7sm39596637eeo.15.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 04 Sep 2013 05:23:57 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH] gpio: return -ENOTSUPP if debounce cannot be set Date: Wed, 4 Sep 2013 14:23:49 +0200 Message-Id: <1378297429-9299-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , It appears some drivers are using gpio_set_debounce() opportunistically, i.e. without knowing whether it works or not. (Example: input/keyboard/gpio_keys.c) to account for this use case, return -ENOTSUPP and do not print any warnings in this case. Took a round over the other gpio_set_debounce() consumers to make sure that none of them are relying on the returned error code to be something specific. Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 0cbddda..86ef346 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1763,6 +1763,9 @@ EXPORT_SYMBOL_GPL(gpio_direction_output); * gpio_set_debounce - sets @debounce time for a @gpio * @gpio: the gpio to set debounce time * @debounce: debounce time is microseconds + * + * returns -ENOTSUPP if the controller does not support setting + * debounce. */ static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) { @@ -1778,9 +1781,9 @@ static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) chip = desc->chip; if (!chip->set || !chip->set_debounce) { - pr_warn("%s: missing set() or set_debounce() operations\n", + pr_debug("%s: missing set() or set_debounce() operations\n", __func__); - return -EIO; + return -ENOTSUPP; } spin_lock_irqsave(&gpio_lock, flags);