Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754085AbcDYIlV (ORCPT ); Mon, 25 Apr 2016 04:41:21 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:16016 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753894AbcDYIlT (ORCPT ); Mon, 25 Apr 2016 04:41:19 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 25 Apr 2016 01:40:55 -0700 Message-ID: <571DD56B.9030506@nvidia.com> Date: Mon, 25 Apr 2016 13:59:31 +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: Linus Walleij , Stephen Warren , Thierry Reding , "linux-gpio@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "Linux Kernel Mailing List" Subject: Re: [PATCH V3 4/4] gpio: tegra: Add support for gpio debounce References: <1461159058-1439-1-git-send-email-ldewangan@nvidia.com> <1461159058-1439-5-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: 1435 Lines: 34 On Monday 25 April 2016 10:25 AM, Alexandre Courbot wrote: > On Wed, Apr 20, 2016 at 10:30 PM, Laxman Dewangan wrote: >> bank->int_lvl[p] = tegra_gpio_readl(tgi, >> @@ -550,6 +598,9 @@ static int tegra_gpio_probe(struct platform_device *pdev) >> >> platform_set_drvdata(pdev, tgi); >> >> + if (!config->debounce_supported) >> + tgi->gc->set_debounce = NULL; > This last line is equivalent to doing > > tegra_gpio_chip.set_debounce = NULL > > Which means that after that no one can reinstanciate this driver and > use debounce. Granted, this does not happen in real life, but the > purpose of the previous patch that removes all static variables is > supposedly to make this scenario possible. I think you can easily fix > this though: make tgi->gc a non-pointer member, do tgi->gc = > tegra_gpio_chip to copy the initial data, and then set > tgi->gc.set_debounce to NULL if needed. As there is only single instance of the tegra gpio driver, I avoided the copy of the tegra_gpio_chip. I am not expecting multiple instance of this driver and hence should be fine. When multiple instances are needed, it can be just use as: But let me make this as you suggested. > tegra_gpio_chip can then be made constant, and maybe even __initdata? I have not seen the usage of __initdata now a days. I think it is removed from most of places. Will use the const.