Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp562741pxf; Thu, 8 Apr 2021 08:34:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys6uYxX0GYrOf5sAXQSjZfdhp9O9WCBh9qEjryYtmTSmEGrOYtEBFqJf9Bt+oVJfnEduPz X-Received: by 2002:a17:90a:5b11:: with SMTP id o17mr9452268pji.32.1617896044262; Thu, 08 Apr 2021 08:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617896044; cv=none; d=google.com; s=arc-20160816; b=xsNu3jjCeL0YUftGUxEArvqR651r4r2bC8oA0pWp4IKsM8MjCHOdeY1beGbID/UhE/ FbTFeVBbX7CgkLqqY1fMDa8NRjJybkX1904IcKzJKA4YeesQDy6x+7HQ+6bsLNpL7Gxp iP13TEyxSOgBeCv0ECCUHMPkUxB3SkzW/kETWBGAi4yw2IGFLqi/v0OPad+7/l+XxOFW /F8oN2YSIl2pQdEAY5E1BPLYY3Vo0O4KGKOD3ZNdzw7dqkEru581j1sYzBK8qfy19cxT 7LIZdAvrNmGD94BFn6m+gDDzoK5QhL7OaOMkLd37vd1WJAHNZrVee7bJZc1mTtx5ciGR /erw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=gPVUHd/F+v4Lql21YGeYtLQQk94iMxHyi7eT/Zx+9IA=; b=pHXSCa+i3y0UbIGhxbMDVfL1fIpmpUJ5/Q9nWPmgzJopp52uoWYqqh2t9WKqtbnxlc 5LvjLvLgxMfujuubvuC575Xw3DbXFaf0jQwZz/kQv+zE/pOvY87zQYhQ5LYy10ju0k9W YspOaalqp4vXFZ6E1aziE2si6yJvUeaF1qV/zzD9JyWAUWeBtGBlAf0tLQZClIRwAAnU 4cmr26+fHvz0iivPSj0pgmkKMJWOKu9HxNNS8CRSTuyIQI03bLDRIpS0Zc44NFJjDd5v dd5fGVBqKsXAGN6ThOmCRvOW8RmkBAjUDuJjIam2OcXcOZEU0PZOPwSn08murMtaMuV1 L3Gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si9209026plg.360.2021.04.08.08.33.52; Thu, 08 Apr 2021 08:34:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232241AbhDHPbe (ORCPT + 99 others); Thu, 8 Apr 2021 11:31:34 -0400 Received: from mga06.intel.com ([134.134.136.31]:26865 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232245AbhDHPbb (ORCPT ); Thu, 8 Apr 2021 11:31:31 -0400 IronPort-SDR: 0VPPR/EsZg0ViJ85bCbiX5HlOBSD7Dqax6S0QYdbzXERrFdzY5VOv8kXU5FXae/UbeyW5QS5Qg bT/vlPfPNq/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9948"; a="254903592" X-IronPort-AV: E=Sophos;i="5.82,206,1613462400"; d="scan'208";a="254903592" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2021 08:31:02 -0700 IronPort-SDR: AMoFeEDi9BjzfvhdZSHH6j8m5Z0sEJmZNKIeFJjDniEURWfLQ0S3WyI+m2gfml+P5TqU9xGpeO 33A7tocTJeug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,206,1613462400"; d="scan'208";a="422295421" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 08 Apr 2021 08:30:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id ABBCFFC; Thu, 8 Apr 2021 18:31:12 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Shubhrajyoti Datta , Srinivas Neeli , Michal Simek , Linus Walleij , Bartosz Golaszewski , Syed Nayyar Waris , vilhelm.gray@gmail.com Subject: [PATCH 1/1] drivers/gpio/gpio-xilinx.c (updated): bitmap-fix Date: Thu, 8 Apr 2021 18:31:08 +0300 Message-Id: <20210408153108.81738-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-xilinx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index d5a08dcdd677..109b32104867 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c @@ -75,9 +75,14 @@ struct xgpio_instance { struct clk *clk; }; +static inline int xgpio_from_bit(struct xgpio_instance *chip, int bit) +{ + return bitmap_bitremap(bit, chip->hw_map, chip->sw_map, 64); +} + static inline int xgpio_to_bit(struct xgpio_instance *chip, int gpio) { - return bitmap_bitremap(gpio, chip->sw_map, chip->hw_map, chip->gc.ngpio); + return bitmap_bitremap(gpio, chip->sw_map, chip->hw_map, 64); } static inline u32 xgpio_get_value32(const unsigned long *map, int bit) @@ -207,11 +212,11 @@ static void xgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, spin_lock_irqsave(&chip->gpio_lock, flags); - bitmap_replace(state, chip->state, hw_bits, hw_mask, gc->ngpio); + bitmap_replace(state, chip->state, hw_bits, hw_mask, 64); xgpio_write_ch_all(chip, XGPIO_DATA_OFFSET, state); - bitmap_copy(chip->state, state, gc->ngpio); + bitmap_copy(chip->state, state, 64); spin_unlock_irqrestore(&chip->gpio_lock, flags); } @@ -501,6 +506,7 @@ static void xgpio_irqhandler(struct irq_desc *desc) DECLARE_BITMAP(rising, 64); DECLARE_BITMAP(falling, 64); DECLARE_BITMAP(all, 64); + int irq_offset; u32 status; u32 bit; @@ -530,8 +536,10 @@ static void xgpio_irqhandler(struct irq_desc *desc) dev_dbg(gc->parent, "IRQ rising %*pb falling %*pb\n", 64, rising, 64, falling); - for_each_set_bit(bit, all, 64) - generic_handle_irq(irq_find_mapping(gc->irq.domain, bit)); + for_each_set_bit(bit, all, 64) { + irq_offset = xgpio_from_bit(chip, bit); + generic_handle_irq(irq_find_mapping(gc->irq.domain, irq_offset)); + } chained_irq_exit(irqchip, desc); } -- 2.30.2