Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754121AbcDYIwg (ORCPT ); Mon, 25 Apr 2016 04:52:36 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:8587 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753976AbcDYIwe (ORCPT ); Mon, 25 Apr 2016 04:52:34 -0400 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Mon, 25 Apr 2016 01:52:16 -0700 Message-ID: <571DD80A.1030409@nvidia.com> Date: Mon, 25 Apr 2016 14:10:42 +0530 From: Laxman Dewangan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Alexandre Courbot CC: Stephen Warren , Linus Walleij , Thierry Reding , "linux-gpio@vger.kernel.org" , "linux-tegra@vger.kernel.org" , Linux Kernel Mailing List Subject: Re: [PATCH V4 4/4] gpio: tegra: Add support for gpio debounce References: <1461319754-12040-1-git-send-email-ldewangan@nvidia.com> <1461319754-12040-4-git-send-email-ldewangan@nvidia.com> In-Reply-To: X-Originating-IP: [10.19.65.30] X-ClientProxiedBy: DRHKMAIL102.nvidia.com (10.25.59.16) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1144 Lines: 30 On Monday 25 April 2016 11:06 AM, Alexandre Courbot wrote: > Sorry, just realized I commented on v3... > > On Fri, Apr 22, 2016 at 7:09 PM, Laxman Dewangan wrote: >> + spinlock_t dbc_lock[4]; /* Lock for updating debounce count register */ > I'm nit'ing here, but maybe one spinlock shared by all ports would be > enough? (the same would apply to lvl_lock, so feel free to do this as > a separate patch) I don't think we expect *that* many concurrent > accesses, do we? Really no, but to make the stuff uniform, it should be fine here. If the registers are not conflicting then do not make under same lock. >> >> >> spin_lock_irqsave(bank->dbc_lock[port], flags); >> if (bank->dbc_cnt[port] < debounce_ms) { >> tegra_gpio_writel(tgi, debounce_ms, GPIO_DBC_CNT(tgi, offset)); >> bank->dbc_cnt[port] = debounce_ms; >> } >> spin_unlock_irqrestore(&bank->dbc_lock[port], flags); >> >> Which is nicer to the eyes. >> OK, this also looks fine. As I am goign to respin this for V5 (for gc as instance rather than pointer), I will take care of it.