Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424588AbdD1HvL (ORCPT ); Fri, 28 Apr 2017 03:51:11 -0400 Received: from mail-io0-f171.google.com ([209.85.223.171]:33433 "EHLO mail-io0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756584AbdD1HvH (ORCPT ); Fri, 28 Apr 2017 03:51:07 -0400 MIME-Version: 1.0 In-Reply-To: <20170424225650.17566-1-drivshin@awxrd.com> References: <20170424225650.17566-1-drivshin@awxrd.com> From: Linus Walleij Date: Fri, 28 Apr 2017 09:51:05 +0200 Message-ID: Subject: Re: [PATCH v2] gpio: omap: return error if requested debounce time is not possible To: David Rivshin Cc: "linux-gpio@vger.kernel.org" , Linux-OMAP , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , Alexandre Courbot , linux-arm@vger.kernel.org, "linux-kernel@vger.kernel.org" , stable Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 967 Lines: 27 On Tue, Apr 25, 2017 at 12:56 AM, David Rivshin wrote: > From: David Rivshin > > omap_gpio_debounce() does not validate that the requested debounce > is within a range it can handle. Instead it lets the register value > wrap silently, and always returns success. > > This can lead to all sorts of unexpected behavior, such as gpio_keys > asking for a too-long debounce, but getting a very short debounce in > practice. > > Fix this by returning -EINVAL if the requested value does not fit into > the register field. If there is no debounce clock available at all, > return -ENOTSUPP. > > Fixes: e85ec6c3047b ("gpio: omap: fix omap2_set_gpio_debounce") > Cc: # 4.3+ > Signed-off-by: David Rivshin > --- > Changes since v1 (https://lkml.org/lkml/2017/3/16/1094): > - Added dev_info() in omap_gpio_debounce() on error. Patch applied with Grygorii's ACK. Yours, Linus Walleij