From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754998AbcEaGFg (ORCPT ); Tue, 31 May 2016 02:05:36 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:9685 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751288AbcEaGFe (ORCPT ); Tue, 31 May 2016 02:05:34 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 30 May 2016 23:02:50 -0700 Message-ID: <574D26C2.1090502@nvidia.com> Date: Tue, 31 May 2016 11:23:06 +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: Linus Walleij CC: Alexandre Courbot , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/3] gpio: max77620: Implement gpio_get_direction callback References: <1464095626-28424-1-git-send-email-ldewangan@nvidia.com> <1464095626-28424-2-git-send-email-ldewangan@nvidia.com> In-Reply-To: X-Originating-IP: [10.19.65.30] X-ClientProxiedBy: BGMAIL104.nvidia.com (10.25.59.13) 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 On Monday 30 May 2016 08:33 PM, Linus Walleij wrote: > On Tue, May 24, 2016 at 3:13 PM, Laxman Dewangan wrote: > >> Implement gpio_get_direction() callback for MAX77620 GPIO. >> This is useful for debugfs and the userspace ABI. >> >> Signed-off-by: Laxman Dewangan >> #include >> +#include > No. This is a sign that something is wrong, no driver should include > this unless it is using GPIOs as a resource itself. This is just to use the flag GPIOF_* As you said below, we can use the 0 and 1, there is no need to include header. Will post the v2 patch for this. >> + return (val & MAX77620_CNFG_GPIO_DIR_MASK) ? >> + GPIOF_DIR_IN : GPIOF_DIR_OUT; > Just return 0 or 1. The driver-internal API isn't smarter than that. > Thanks, Laxman