From patchwork Wed Aug 22 20:41:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 144860 Delivered-To: patch@linaro.org Received: by 2002:a2e:164a:0:0:0:0:0 with SMTP id 10-v6csp401701ljw; Wed, 22 Aug 2018 13:41:45 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyJfX5HNIzQqP9Evx/bAMUZnNKbIK4By2gNrFKHvdFtt4q2Csfi2rerFNCLXMTMz1R4Pf0t X-Received: by 2002:a62:41d6:: with SMTP id g83-v6mr59232598pfd.219.1534970505259; Wed, 22 Aug 2018 13:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534970505; cv=none; d=google.com; s=arc-20160816; b=VD8QPm0UpKPmT8xFyGS62ZmXb38SalBRaZdU/ZlYbb/txpH0yLAQTDTiotR+9GC9+H WcQEwq/UZOXHlLu/8FHzNF2NnUjJigh1u6pwixO7flr4XtjroPy6cHDVJ6ZWT8ESQmsP uYFnA0WurtBtt6UGwylGsMn7K+a4OY/LZ2qEFrqRAnJBpJxiorybGKtrVbr/Fc9+FFSu TwaTTS/X3m/jcwzn0oUSuSubX2NFj1RmjZyDadrz4X8tlhJQB58tfv6ohxaFrscg18Ty 1zVSlq8Rn2NaLK+bOjqoa4twxtQ2kNX4sQm7vrtQKT3CCnjIk+iudJUqa8igzvAKe1RC o79A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=RuBTtzm/UACCjyh36nPIVMHxuB2LtQV4+pKeChy29wY=; b=1GGtJvyRgGrqKHlpglNykwNBFuxbm3DRtiX7MPAQnrldzkEZAExpQvbbxgofKE3S8G 8bDZrWmvtMHcJ/N2BCGzWndtNTH76EgiJgfG7zRwXgLhUzpNHNtzhP4iM7+k4c9lT3LW nmfcEHIscRIMua9//Bq+wa0+eoOJ3JqNKkOtGGGhMULWqRbdhdWCWIlOzpoDQ8k2s11B fYHSTNrf2nPyR4rsE285SmfWYCba9kgYENqBENWMWT2RkhwnhKf+T325BKFjmYZHwWrO gKUNASAqNAv4ThdvPGUh2ehskqDRlwN3pXv/RKHe9r+ytNiN5iH67TUjNX+3+4Z14OXC r05w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=El9C+R3N; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23-v6si2559068pgi.301.2018.08.22.13.41.45; Wed, 22 Aug 2018 13:41:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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=@linaro.org header.s=google header.b=El9C+R3N; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727522AbeHWAII (ORCPT + 5 others); Wed, 22 Aug 2018 20:08:08 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41574 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727395AbeHWAIH (ORCPT ); Wed, 22 Aug 2018 20:08:07 -0400 Received: by mail-lf1-f68.google.com with SMTP id l26-v6so2388728lfc.8 for ; Wed, 22 Aug 2018 13:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RuBTtzm/UACCjyh36nPIVMHxuB2LtQV4+pKeChy29wY=; b=El9C+R3N9qsXXXgiWYSqhagvhsffXxkAjPynu3W28+DHZSQoeePZ9pz/nt8VZ0r2VV QPu2+KjQMpgHapuP5Fdik9NXHsypJ3u+s2cTtx83UZgtWDIvlkI4oBp+KJSQik7LmDy/ SCA3aVdpuXg7OZpOhUkbrB7uXb42dV3HhpPig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RuBTtzm/UACCjyh36nPIVMHxuB2LtQV4+pKeChy29wY=; b=fHAYJd+yf5zWa4FuipNQj6jJ3ATNA+VbyGQj0oWyRRMMbttrBZU7g+nnh6wTQAyzi0 PPQ6cD7h+yTSICnTGihENC/bbWNovp/MAPBx8wTsD5M5K3HhJPSgNupZQMYOiewo0a81 lScREHeRAG71SFRtMZ+WIXytBuImkkkIw8nqag08KAQ4yp9D/AlaX7FTUQJ5VofaB95s BalJcs9XIjhO1cUw+2SLVyMeKALWSsFxmDmID06kvD/XqGgJe5smNx2VbdbG1zJt4LsX SR7aS5AXjSWq7W9jlHmZqmz/D+HApZTVu3Il6DySPYmUZdf+c/Bmlg5mF87g+5xi8LJ7 qQeQ== X-Gm-Message-State: AOUpUlGDPBcvm5b4hu6byJL98TBDR99F5iE/na+od5mDztohkvBN3Vbu XJG+myXSFcxDpm+gBsOPGrbGrA== X-Received: by 2002:a19:8f10:: with SMTP id r16-v6mr22306289lfd.1.1534970502674; Wed, 22 Aug 2018 13:41:42 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id q128-v6sm431515ljq.72.2018.08.22.13.41.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Aug 2018 13:41:41 -0700 (PDT) From: Linus Walleij To: H Hartley Sweeten , Alexander Sverdlin Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH 09/11] gpio: ep93xx: Use for_each_set_bit() in IRQ handler Date: Wed, 22 Aug 2018 22:41:09 +0200 Message-Id: <20180822204111.9581-10-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180822204111.9581-1-linus.walleij@linaro.org> References: <20180822204111.9581-1-linus.walleij@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This simplifies and standardizes the AB IRQ handler by using the for_each_set_bit() library function. Signed-off-by: Linus Walleij --- drivers/gpio/gpio-ep93xx.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index b2139ec43ce2..1248d83f860b 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -105,25 +105,21 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc) struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct ep93xx_gpio *epg = gpiochip_get_data(gc); struct irq_chip *irqchip = irq_desc_get_chip(desc); - unsigned char status; - int i; + unsigned long stat; + int offset; chained_irq_enter(irqchip, desc); - status = readb(epg->base + EP93XX_GPIO_A_INT_STATUS); - for (i = 0; i < 8; i++) { - if (status & (1 << i)) { - int gpio_irq = gpio_to_irq(0) + i; - generic_handle_irq(gpio_irq); - } + stat = readb(epg->base + EP93XX_GPIO_A_INT_STATUS); + for_each_set_bit(offset, &stat, 8) { + int gpio_irq = gpio_to_irq(0) + offset; + generic_handle_irq(gpio_irq); } - status = readb(epg->base + EP93XX_GPIO_B_INT_STATUS); - for (i = 0; i < 8; i++) { - if (status & (1 << i)) { - int gpio_irq = gpio_to_irq(8) + i; - generic_handle_irq(gpio_irq); - } + stat = readb(epg->base + EP93XX_GPIO_B_INT_STATUS); + for_each_set_bit(offset, &stat, 8) { + int gpio_irq = gpio_to_irq(8) + offset; + generic_handle_irq(gpio_irq); } chained_irq_exit(irqchip, desc);