Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp225201ybe; Wed, 4 Sep 2019 18:36:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpES+QKzWCFXRRvaFXOPhx+6n8hcud0hDDlcXZ2sLoo4pWJDGBa91bOTilh2PfqIHUQYaZ X-Received: by 2002:a17:90a:f98e:: with SMTP id cq14mr1175418pjb.52.1567647409565; Wed, 04 Sep 2019 18:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567647409; cv=none; d=google.com; s=arc-20160816; b=alwmzu+aR7Pzevfx1fgNWWgXNfNI3QLb3lVKgpuZxbgUT1nNDrYvWRsRo0Zem1w6Zp yoDgg4XfTlUGOh1dzc3/JP8sjKKlxF4whxkg/Bl85DxJ4DGzsFrJhLk0o05zpORKVYZf NqPr9NBP34jCbG/8Tbf1JrE7a/r40JYfAkkpYY+7g6gfHRD6bJVcrbmbx7ZK2L4X8LIf bTGCxiZemNDB5yVgeqZHm+N3GzOkZ/rc+NMCD5dC2Q4BPDfnT4n6+NjqtxQxM3sxoLg1 vTDiBI+r1Xmm8WCt9YSjrhOH8uVzUehlGC9473p+L1h8Ml2j8vj+8VlqbvSYHwCClv8n Y26Q== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pOasyZt6sdsNwBn8Gt+vfPwKrru431DH9AuzyGk0MuE=; b=V9V1PSU/C6LZ1h67C5wH4gtfX7G1lG5E6XhnqX6tyGoT6LdjIJKKHK8u5AN/KMpoAy FZHaDwhUcsAsD661mjDORBdwgAJDpceMNC3VY9DxGYQW6XSS9+ZRWWfiA9ZWHBjTTEsi Wx3IvQUzCixzN2JapDMOA5k5c9iQOTviC+EEZhAwY7H+q915Pri+/W6Q5H2inWlexWX0 yqINnAmq9kLF9GMdzR3UmLdUs7BFeW1G/WpdefZk/vbWOWOnsgsvpCULgF4glLOXloJJ t/ma8ubplBgo1axBU0SKs+wgJTS3iKhbipeobO85M6yxsxlUTctuLby9/XWWHc2Va9ye T3dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rfio1YTO; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si643437pjn.2.2019.09.04.18.36.18; Wed, 04 Sep 2019 18:36:49 -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=@gmail.com header.s=20161025 header.b=Rfio1YTO; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730273AbfIEBQr (ORCPT + 99 others); Wed, 4 Sep 2019 21:16:47 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42810 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbfIEBQr (ORCPT ); Wed, 4 Sep 2019 21:16:47 -0400 Received: by mail-pf1-f196.google.com with SMTP id w22so564926pfi.9; Wed, 04 Sep 2019 18:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pOasyZt6sdsNwBn8Gt+vfPwKrru431DH9AuzyGk0MuE=; b=Rfio1YTOgo6pg+zve3gTIxmDdPAyguIP5ao4mD3EW1H3R3pwjr/wjhxDn0mTuBoLDb jhkvz2jscbKJ83LdJFeb7QPvgQhC6+fpObLqg4NgUA9c7jsFm2LIixt+nnSoWHrZ16Jp SbXQiJHsCdwbl9tWrbitPt95fQyxPOnAOBeAgasuMLFSE2zmTK/LtD4/1YuX+jb+NBdf vxaCY1HEU2SAvrt+GoBj1klUkN5hJpGfk4sZQRk6OT3mJL7H0BFF8GEsNSxvn8nlcO5h tATs6goGtXHeV6kAGYx0Myl/2uRjs2WWqd+9wLX3SDbN53fZVqqgVRNDWXe2TCeI9GXy KYhg== 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:mime-version :content-transfer-encoding; bh=pOasyZt6sdsNwBn8Gt+vfPwKrru431DH9AuzyGk0MuE=; b=ncATmaUAsYLfsX6iBJvkeasQdMHQxbgsY3bi1oAR8Db4xwRbCyXbfEPvs4hbm8nZtK xB+r6uppBYrX2jYdlkBe1mEzYkDUMbjCS8sRR11npPekC6Gx9zmpxLpjV9tEeddl/jyO D7Cxam5Xd96ZAASdC+NBH7PRnvLHMyRS701BwxohDNBRmfkn9mWPe5vbHzo8IzfMG0HL VOeGyWItClA60ilVZvz55t3WVTqIVL+bBHdOD6rg6ujAP7Zja+ipyAujLdzD7em/dGli /bk0KTyVSHhJsoCWFwAM0px5wTABrKhdqdT5NZuhBfT7zsf2vE+qy+OyIgsnaLQot5up tT9Q== X-Gm-Message-State: APjAAAWK4qY+rCVePmwiUWUE67ebbzjjnOi/hKOLM221XN4i8Oq0GvCj rY1D0vxmnZGsYfbyyPSQLqo= X-Received: by 2002:a17:90a:350:: with SMTP id 16mr1054780pjf.110.1567646206375; Wed, 04 Sep 2019 18:16:46 -0700 (PDT) Received: from rashmica.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id v27sm329968pgn.76.2019.09.04.18.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 18:16:45 -0700 (PDT) From: Rashmica Gupta To: linus.walleij@linaro.org Cc: Rashmica Gupta , Bartosz Golaszewski , Joel Stanley , Andrew Jeffery , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] gpio/aspeed: Fix incorrect number of banks Date: Thu, 5 Sep 2019 11:16:35 +1000 Message-Id: <20190905011635.15902-1-rashmica.g@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current calculation for the number of GPIO banks is only correct if the number of GPIOs is a multiple of 32 (if there were 31 GPIOs we would currently say there are 0 banks, which is incorrect). Fixes: 361b79119a4b7 ('gpio: Add Aspeed driver') Signed-off-by: Rashmica Gupta --- drivers/gpio/gpio-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 9defe25d4721..b83e23aecd18 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -1165,7 +1165,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) gpio->chip.base = -1; /* Allocate a cache of the output registers */ - banks = gpio->config->nr_gpios >> 5; + banks = DIV_ROUND_UP(gpio->config->nr_gpios, 32); gpio->dcache = devm_kcalloc(&pdev->dev, banks, sizeof(u32), GFP_KERNEL); if (!gpio->dcache) -- 2.20.1