From patchwork Tue Apr 14 17:48:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1270607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 491tL23fCWz9sSk for ; Wed, 15 Apr 2020 03:50:02 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502659AbgDNRuA (ORCPT ); Tue, 14 Apr 2020 13:50:00 -0400 Received: from mga06.intel.com ([134.134.136.31]:42046 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502747AbgDNRt5 (ORCPT ); Tue, 14 Apr 2020 13:49:57 -0400 IronPort-SDR: z7RN4BmFrRh1JnEkS4kOAKRGP5hxle8cjeHV3EUiyJfFtGaIi+Z/Px/HjGZBTIDb8aktKdaroq fQ8d4H5xq4dQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 10:49:03 -0700 IronPort-SDR: S44f7z6KIwS1HaI/bWLvhFfp58TPLEYBbaChkFH0f4uPX7bNxZ+ojp6LahhHNJjqSjz/GkN9An X9minEmRgGKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,383,1580803200"; d="scan'208";a="453623129" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 14 Apr 2020 10:49:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 835F243; Tue, 14 Apr 2020 20:49:01 +0300 (EEST) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v2 2/4] gpio: pch: Get rid of unneeded variable in IRQ handler Date: Tue, 14 Apr 2020 20:48:58 +0300 Message-Id: <20200414174900.5099-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200414174900.5099-1-andriy.shevchenko@linux.intel.com> References: <20200414174900.5099-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org There is no need to have an additional variable in IRQ handler. We may simple rely on the fact of having non-zero register value we read from the hardware. While here, drop repetitive messages in time critical function. Signed-off-by: Andy Shevchenko --- v2: no change drivers/gpio/gpio-pch.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index 03eeacdb04fb..708272db6baf 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -303,14 +303,15 @@ static irqreturn_t pch_gpio_handler(int irq, void *dev_id) { struct pch_gpio *chip = dev_id; unsigned long reg_val = ioread32(&chip->reg->istatus); - int i, ret = IRQ_NONE; + int i; - for_each_set_bit(i, ®_val, gpio_pins[chip->ioh]) { - dev_dbg(chip->dev, "[%d]:irq=%d status=0x%lx\n", i, irq, reg_val); + dev_dbg(chip->dev, "irq=%d status=0x%lx\n", irq, reg_val); + + reg_val &= BIT(gpio_pins[chip->ioh]) - 1; + for_each_set_bit(i, ®_val, gpio_pins[chip->ioh]) generic_handle_irq(chip->irq_base + i); - ret = IRQ_HANDLED; - } - return ret; + + return IRQ_RETVAL(reg_val); } static int pch_gpio_alloc_generic_chip(struct pch_gpio *chip,