Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp234860ybp; Thu, 10 Oct 2019 17:11:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwqVM1tWpdLxJXEdiizMVBFWkckXj0ndEFeDoLW8mUGndFgz58Z4rtWmgUPoTSXdao5aEo X-Received: by 2002:a05:6402:a4f:: with SMTP id bt15mr10927095edb.121.1570752682144; Thu, 10 Oct 2019 17:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570752682; cv=none; d=google.com; s=arc-20160816; b=bJe7moesFVxmsSmd0K1g/0UOPQEdXnjwTrz0gBNtGLe1uUVAOmmgjveDv80ZI0UeYV rRp01hNmGQcNoc+pQYNonB/Gnns55t5lUDv3hfBWct0O1ZL781JdSgRAozERtWRyf36w ovT+EP7SyhksRnP2uUpOQxYefrYeOhTVMZxlIuR/ihdv3GxYfp2phtoxQ2t7e/Agx+VV ztER9qbLrcuvAKiju6RMsiKh+eLnB0w0xOchJVrVIQdhMY+eeZQwdV8IoaLdUEXyE7bR BmfEPZKJrYU7b3crpbf6dlTpuOiiKsEiVUzK/q3tBcd+iU1CHMJgW50545BuvAKaexyV iGGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=CuWkKPMdB1z+o+XfUfQqodALV/gMtOa1+iT3xGY2djM=; b=EWyun9WahsGjRSgN5QFglstVT7KzgtLVemHzXnhOYsAAGQtJkR2mLJ4prOT24lbsCt VFtRc3ONVqBKWWufTKpQ3cCWg5ZF4HPdFpP/SIEGVmSisXFykpIhPTVruODEjmblOjjH oPKy4zb8cunI/Foon/cV0gf38rtfFeoqzVklXDkHYKxxc8qJ9VQfQxkxTpyRMlUuGwo8 eagXBRt9Z9YwvRj3oaEJsKz/yAkQlHD8zG1fU8TVJYkZnJXryDVbgy5s4W0TetzD+ZTR kI5REKwu19s+cNpfmts17QN5C6AvnLkOABlWTZbFU+Dn8OQXbqJvraARfQp8+E6p1Vl4 uafA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="V+/1YHgB"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si4524048edc.96.2019.10.10.17.10.59; Thu, 10 Oct 2019 17:11:22 -0700 (PDT) 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=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="V+/1YHgB"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727163AbfJKAKy (ORCPT + 99 others); Thu, 10 Oct 2019 20:10:54 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:46158 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726474AbfJKAKy (ORCPT ); Thu, 10 Oct 2019 20:10:54 -0400 Received: by mail-ot1-f66.google.com with SMTP id 89so6461877oth.13 for ; Thu, 10 Oct 2019 17:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=CuWkKPMdB1z+o+XfUfQqodALV/gMtOa1+iT3xGY2djM=; b=V+/1YHgBwaJ9G2xcvRbf0wcjQADYe+tc7H7ZIRB7G1sOOk836UV02AeFA/O5/6uGBT 9nDajgKdzPf7ZRtDvF31VQ/FHVVJPLSPoOv22VRoezeLKolwFKGjdfKlG+IlwzA2e8n2 0BW9sJtbOq5sGr4eL8Jh8x9OwG5s2bJ0qO7A9RjB3P3Lz0K+nT2EsqZ2QL3ADcDUbv2P sdm0g5BsD4mHrgJT8Br7uZ9O2tAWROQhhddwUZnJlGb/AC0vtckBaGv9BJqIJXfa4Huc SJNgdhq8vYH/xOX+be8gAGhR7ND7CBqEAEVlFn72LIH0B3Hv8u1e94R8e+YZnU3QUU3d TWCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=CuWkKPMdB1z+o+XfUfQqodALV/gMtOa1+iT3xGY2djM=; b=tnn6WxzO68e9SMaJUqoRQRybjRiQuoNirXJU2IYtr8zKEqUln3/swCHN1gEi/2AnSc uD5AkYDIKO5XVljcAoAmbpFWnLr1A7nFyHcf/B1KQT+CjuTDyS8D0nzNQr6iCgUa9nfb bVt1OYarT4QDXPgRFfb44iaLPdUX90nhoAGsQA5H+T9k4wzhfEAin9kzPp97t9WmrO5E OVV1mZ0DpsOmaJ4w+p5za4Dj1R76C0aAK6IkdOwwE3/V3acXk51rPolSbCsdagpzqLlI OHKB+FvLzbSFFa8lgrnzrfW9QJSXf84GoT/pOnDbmODnmrEwB3X93YoAJUC2oBRqH7OL mPvw== X-Gm-Message-State: APjAAAXWJiEXPNJZ0iPr/JosON4lCMoP+kJ9ygeZrM9aYj6NS/NS/UkC +JYVhJRoiDM1ZM1mg+JcaY4RpIMRHApOdw+uSozFkg== X-Received: by 2002:a05:6830:1685:: with SMTP id k5mr10285631otr.250.1570752651991; Thu, 10 Oct 2019 17:10:51 -0700 (PDT) MIME-Version: 1.0 References: <20191010023205.8071-1-hui.song_1@nxp.com> In-Reply-To: <20191010023205.8071-1-hui.song_1@nxp.com> From: Bartosz Golaszewski Date: Fri, 11 Oct 2019 02:10:41 +0200 Message-ID: Subject: Re: [PATCH v7] gpio/mpc8xxx: change irq handler from chained to normal To: Hui Song Cc: Shawn Guo , Li Yang , Rob Herring , Mark Rutland , Linus Walleij , arm-soc , linux-devicetree , LKML , linux-gpio Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org czw., 10 pa=C5=BA 2019 o 04:42 Hui Song napisa=C5=82(a= ): > > From: Song Hui > > More than one gpio controllers can share one interrupt, change the > driver to request shared irq. > > While this will work, it will mess up userspace accounting of the number > of interrupts per second in tools such as vmstat. The reason is that > for every GPIO interrupt, /proc/interrupts records the count against GIC > interrupt 68 or 69, as well as the GPIO itself. So, for every GPIO > interrupt, the total number of interrupts that the system has seen > increments by two. > > Signed-off-by: Laurentiu Tudor > Signed-off-by: Alex Marginean > Signed-off-by: Song Hui > --- > Changes in v7: > - make unsigned int convert to unsigned long. > Changes in v6: > - change request_irq to devm_request_irq and add commit message. > Changes in v5: > - add traverse every bit function. > Changes in v4: > - convert 'pr_err' to 'dev_err'. > Changes in v3: > - update the patch description. > Changes in v2: > - delete the compatible of ls1088a. > drivers/gpio/gpio-mpc8xxx.c | 29 +++++++++++++++++++---------- > 1 file changed, 19 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c > index 16a47de..5a0f030 100644 > --- a/drivers/gpio/gpio-mpc8xxx.c > +++ b/drivers/gpio/gpio-mpc8xxx.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > #define MPC8XXX_GPIO_PINS 32 > > @@ -127,20 +128,20 @@ static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc= , unsigned offset) > return -ENXIO; > } > > -static void mpc8xxx_gpio_irq_cascade(struct irq_desc *desc) > +static irqreturn_t mpc8xxx_gpio_irq_cascade(int irq, void *data) > { > - struct mpc8xxx_gpio_chip *mpc8xxx_gc =3D irq_desc_get_handler_dat= a(desc); > - struct irq_chip *chip =3D irq_desc_get_chip(desc); > + struct mpc8xxx_gpio_chip *mpc8xxx_gc =3D data; > struct gpio_chip *gc =3D &mpc8xxx_gc->gc; > - unsigned int mask; > + unsigned long mask; > + int i; > > mask =3D gc->read_reg(mpc8xxx_gc->regs + GPIO_IER) > & gc->read_reg(mpc8xxx_gc->regs + GPIO_IMR); > - if (mask) > + for_each_set_bit(i, &mask, 32) > generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq, > - 32 - ffs(mask))); > - if (chip->irq_eoi) > - chip->irq_eoi(&desc->irq_data); > + 31 - i)); This will now fit in 80 characters. Bart > + > + return IRQ_HANDLED; > } > > static void mpc8xxx_irq_unmask(struct irq_data *d) > @@ -409,8 +410,16 @@ static int mpc8xxx_probe(struct platform_device *pde= v) > if (devtype->gpio_dir_in_init) > devtype->gpio_dir_in_init(gc); > > - irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, > - mpc8xxx_gpio_irq_cascade, mpc8xx= x_gc); > + ret =3D devm_request_irq(&pdev->dev, mpc8xxx_gc->irqn, > + mpc8xxx_gpio_irq_cascade, > + IRQF_NO_THREAD | IRQF_SHARED, "gpio-cascad= e", > + mpc8xxx_gc); > + if (ret) { > + dev_err(&pdev->dev, "%s: failed to devm_request_irq(%d), = ret =3D %d\n", > + np->full_name, mpc8xxx_gc->irqn, ret); > + goto err; > + } > + > return 0; > err: > iounmap(mpc8xxx_gc->regs); > -- > 2.9.5 >