Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp121824imm; Mon, 4 Jun 2018 14:14:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKbCMAPBgQU2RJifHXGFSWbhC/L5mCB6AskuYy8we9FeILhusjPzMqK0phRw3SgiqYl98ex X-Received: by 2002:a17:902:8a87:: with SMTP id p7-v6mr23014490plo.278.1528146850561; Mon, 04 Jun 2018 14:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528146850; cv=none; d=google.com; s=arc-20160816; b=l5fTmRitINN8pyTjfb0BPU6MTxCySduFq93FGLz9zF5tYUYHwxdG1YaQlvjMBBbs1x bJ1/o03rSjicWSmHDSLWoOrvSlLR8cL9J29Q9+1abOBI5MshXj2x7319K0n/BkVWe3x1 9hlwvLEh6e/Z2w+LyDPQVIl0qpHuovUx4Frtqj47y8vrpK6L+CuYfTk2d7da+0T40Lay nTytMqdL/hrmhJz6AAM76Fdt3eH8W1CotRpNhhPVjxtvTaYes/LGJzuz5aa2wY6Pgb7R u5GRa8EumnJg+H2CIdHrfOfE4VWfQUlKyMhoCAYhCLWvI4GMsJo6oXm9qPMs3pU1waLx saHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=sAbx1Q/CukiFbmqM6vYQYgs+BHyeveqOtq/L7zy2PjY=; b=QryeNr+32hCxHgLjpPbhVFRKv0lvDT1L3sxkSO4Sud6VnFGS1ETC/XBKqoXFgYAUZp FyqbZZ4q5ln2/esT1Ls7B4ZIzDCMNJ8M1Z/8tJZZOz8IHBT3yIRtJlcJYdGXV1Dxa2Pv PNYKKEBhPWz/M5sPGS7BEaKAuBOrweicuYNg3JgCUdJp3eLFuxAQuIruinRhJe+bI5pP kuRqCXrWw69nORO+2DBo3hgWkadqJedNMOR95pes1WonuvGUsgDKkbHwfNz547uAPjoI OPx5180tryeYto1yu/Q962WWd7Ij6oBQKhMzcpIptsmXCMsjzBlITxBWlFL2HE0UWyC7 s5Kg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g20-v6si4786461pgv.427.2018.06.04.14.13.56; Mon, 04 Jun 2018 14:14:10 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751800AbeFDVM4 (ORCPT + 99 others); Mon, 4 Jun 2018 17:12:56 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:38818 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbeFDVMz (ORCPT ); Mon, 4 Jun 2018 17:12:55 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Mon, 4 Jun 2018 14:12:41 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 8543CB09EA; Mon, 4 Jun 2018 14:12:54 -0700 (PDT) From: Nadav Amit To: Linus Walleij CC: , , Nadav Amit Subject: [PATCH] gpio: Fix wrong rounding in gpio-menz127 Date: Mon, 4 Jun 2018 06:58:14 -0700 Message-ID: <20180604135814.101343-1-namit@vmware.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-001.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org men_z127_debounce() tries to round up and down, but uses functions which are only suitable when the divider is a power of two, which is not the case. Use the appropriate ones. Found by static check. Compile tested. Fixes: f436bc2726c64 ("gpio: add driver for MEN 16Z127 GPIO controller") Signed-off-by: Nadav Amit --- drivers/gpio/gpio-menz127.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-menz127.c b/drivers/gpio/gpio-menz127.c index e1037582e34d..b2635326546e 100644 --- a/drivers/gpio/gpio-menz127.c +++ b/drivers/gpio/gpio-menz127.c @@ -56,9 +56,9 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio, rnd = fls(debounce) - 1; if (rnd && (debounce & BIT(rnd - 1))) - debounce = round_up(debounce, MEN_Z127_DB_MIN_US); + debounce = roundup(debounce, MEN_Z127_DB_MIN_US); else - debounce = round_down(debounce, MEN_Z127_DB_MIN_US); + debounce = rounddown(debounce, MEN_Z127_DB_MIN_US); if (debounce > MEN_Z127_DB_MAX_US) debounce = MEN_Z127_DB_MAX_US; -- 2.17.0