Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3725305imu; Tue, 18 Dec 2018 03:11:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xo/cHT7pNIW1J9sgLPDy9b/jUo22/mLgMEpoCX2ABPneQLYJRIppqmjt11UB23oo0kAzDO X-Received: by 2002:a63:4384:: with SMTP id q126mr15240159pga.160.1545131519073; Tue, 18 Dec 2018 03:11:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545131519; cv=none; d=google.com; s=arc-20160816; b=d53AnUJCYKCRSDMeHQbyjDQR43ps9ATg8cYjtXiSoV7r/O3WuPyh3Ff+FsFzlPYw4u T1lIX/fjHxvy1lNO9UgKY2uzzSNJQOTlmAWT8QEeA+73KB1l8DmLyuB3E/jwmA4vB3OR GLb9uNhagL7UQGii3ACb+GcQYg0P36WUkeEYPF+9Z93Lr2X+ZzWpyI8Gg0rRxc7mt0Zp bel813u/lhqv3FSIK9ZrgtWhPI/jom4EHELS3ttxUZpBC4sFbwX/DltAH5i3WxhRsbpE Ph3Nbbqta4MJDjCQhObU/CX0eaa015iESYBh90rsNf6sdem5TAZVsNduK2Mkw7ioSTmQ Nplg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Q8pX42wrj24jWbglSgaxkOqshMnKp4WI7Qxnj5pOWP4=; b=bPOfyK+oxVWSWNRu542l1UFGCmIt90REI9PKni6zSc999St2OwPuDHUejKVFKP2Zmv fWgqdXqlpjRTnAiJLim9pcDCzXFABsb8Un4q6XR43rkL/0Z8k0XXn0i2rHKvrtZ5/mAp rGN5M3nGzxx8OjeAdBGyg0hGrG4hUsUQnWTxofTKz7K47Nao7g3SQAowyyPZU8sZYWEZ zh8+kfuDa4GJM8Zj43eqDweDEyD+LbwiWrJZIWLmyHrHyJGaZsVaZ8vy7cu0jSn+rFDp zOtsB7w1eT2AErKa3FO45n97pEHmayl7o3CO8gj1IisRsBtfTRrx+C6FpUB6hnj9T6L6 sycA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=tBTKpk2m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x66si13785431pfk.73.2018.12.18.03.11.43; Tue, 18 Dec 2018 03:11:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=tBTKpk2m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726584AbeLRLKf (ORCPT + 99 others); Tue, 18 Dec 2018 06:10:35 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:34560 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726364AbeLRLKf (ORCPT ); Tue, 18 Dec 2018 06:10:35 -0500 Received: by mail-lj1-f195.google.com with SMTP id u89-v6so3141321lje.1 for ; Tue, 18 Dec 2018 03:10:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Q8pX42wrj24jWbglSgaxkOqshMnKp4WI7Qxnj5pOWP4=; b=tBTKpk2mg1ln0dcLMUFI+wPLSUtDBSK7csd1pYID6yZHKrerUxBiRDpxxvRb+PzBud 2iPGaQ3f5wgk1EXHm8JvwE1N0cmoccpswFqFMTg1cdxn1gYBbIuLHAlFVfT1+FSxFgeW uyWpoxGJZZhwmtFwJ6iHtHVvrZGt2UckclUBLWs8a8C3HtdYvvHZ/t79rQR2oBlib4Dd y2veaMf3RqbUFrEkVvybhLi/SKty2n6UerFOIlksAhC2q4BYuEvNj+wFzU38zYhoMW5M 3CGxggLJn+pXIpSGClqx9kzKgcy6/IRqhvOtRkUhnCDVe4NQmLdf6L4gFt9k34YAlgMP 2MJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Q8pX42wrj24jWbglSgaxkOqshMnKp4WI7Qxnj5pOWP4=; b=G8w4rsytLKsLbpg9Hr8ID7fP3D/e8GG0WsIzUH1HaTWqt202j/dMHae0fkrliizAKa NtEpvcG+mmkYer1Pvp9Y1jUgyTVI+CjBO/2SJuDN8/w51itWLnuKfqgBYaaV5zyxDYAh 7qAkP947RgewfhQ0BLrEP4bTLyvSBe9pFXB/jM9I6xbq7RKzFmyxENnfnh1yHUpnpTzn 3s6VrNdLFcVwY3ycGBBdioR6nh1T7LgvkdZZ9gyfTnT1erlSxn+8ezYJqCD6ziYpRIwN 63AZgJf9PHW8dZ0V6RrGqOrwAIsqAEOS44QAKbM8Pita8jHBQy9FxH+dgnF7K1dG0ECB 1cOg== X-Gm-Message-State: AA+aEWaOOr3+DqlYdqLXaUlklBVCjqF5XpeSlB3bMCgrc/zJt10BKxix Cp9uXu3nrMVWUHvz8G6xYBE= X-Received: by 2002:a2e:9f56:: with SMTP id v22-v6mr4172069ljk.114.1545131432116; Tue, 18 Dec 2018 03:10:32 -0800 (PST) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id s24sm3047342lfc.30.2018.12.18.03.10.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 03:10:31 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1gZDGk-000402-Gm; Tue, 18 Dec 2018 12:10:34 +0100 Date: Tue, 18 Dec 2018 12:10:34 +0100 From: Johan Hovold To: Nishad Kamdar Cc: Greg Kroah-Hartman , Johan Hovold , Alex Elder , Rui Miguel Silva , greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/3] staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP Message-ID: <20181218111034.GM20658@localhost> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 22, 2018 at 10:37:16PM +0530, Nishad Kamdar wrote: > Convert the GPIO driver to use the GPIO irqchip library > GPIOLIB_IRQCHIP instead of reimplementing the same. > > Signed-off-by: Nishad Kamdar > --- > Changes in v2: > - Retained irq.h and irqdomain.h headers. > - Dropped function gb_gpio_irqchip_add() and > called gpiochip_irqchip_add() from probe(). > - Referred https://lkml.kernel.org/r/1476054589-28422-1-git-send-email-linus.walleij@linaro.org. Thanks for the update, and sorry about the late review. This looks mostly good now, except for a couple minor things pointed out below. You also included the conversion to gpiochip_get_data() (as Linus also did in his patch) although that's really a separate change and should go in its own patch. Please break that bit out in a follow-up patch. Also note that someone did a bunch random white space changes to this file in the staging tree, so it will not apply cleanly any more. > --- > drivers/staging/greybus/Kconfig | 1 + > drivers/staging/greybus/gpio.c | 184 ++++---------------------------- > 2 files changed, 24 insertions(+), 161 deletions(-) > > diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig > index ab096bcef98c..b571e4e8060b 100644 > --- a/drivers/staging/greybus/Kconfig > +++ b/drivers/staging/greybus/Kconfig > @@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY > config GREYBUS_GPIO > tristate "Greybus GPIO Bridged PHY driver" > depends on GPIOLIB > + select GPIOLIB_IRQCHIP > ---help--- > Select this option if you have a device that follows the > Greybus GPIO Bridged PHY Class specification. > diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c > index b1d4698019a1..2ec54744171d 100644 > --- a/drivers/staging/greybus/gpio.c > +++ b/drivers/staging/greybus/gpio.c > @@ -9,9 +9,9 @@ > #include > #include > #include > -#include > #include > #include > +#include > #include > > #include "greybus.h" > @@ -39,15 +39,8 @@ struct gb_gpio_controller { > > struct gpio_chip chip; > struct irq_chip irqc; Turns out struct gpio_chip will have an irqchip whenever CONFIG_GPIOLIB_IRQCHIP is selected so you can drop this one too. > - struct irq_chip *irqchip; > - struct irq_domain *irqdomain; > - unsigned int irq_base; > - irq_flow_handler_t irq_handler; > - unsigned int irq_default_type; > struct mutex irq_lock; > }; > -#define gpio_chip_to_gb_gpio_controller(chip) \ > - container_of(chip, struct gb_gpio_controller, chip) > #define irq_data_to_gpio_chip(d) (d->domain->host_data) > > static int gb_gpio_line_count_operation(struct gb_gpio_controller *ggc) > @@ -276,7 +269,7 @@ static void _gb_gpio_irq_set_type(struct gb_gpio_controller *ggc, > static void gb_gpio_irq_mask(struct irq_data *d) > { > struct gpio_chip *chip = irq_data_to_gpio_chip(d); > - struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip); > + struct gb_gpio_controller *ggc = gpiochip_get_data(chip); So please split these changes into a separate patch as they are not related to the irqchip changes. Oh, and don't forget to update the TODO file now that the conversion is done. :) Thanks, Johan