Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp823400imc; Sun, 10 Mar 2019 23:30:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2EP91srNjSOY81Xw29rYAfL+REic8ep/XDVP9AoPQFkFBx9fOcIPgze284hdSyGteD+QV X-Received: by 2002:a62:574d:: with SMTP id l74mr32147722pfb.9.1552285800441; Sun, 10 Mar 2019 23:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552285800; cv=none; d=google.com; s=arc-20160816; b=QELSo/Bq3PhZJvEx8xJfkJDkQ6LAx4y0mMUF8P5OIgxwOfn8Hi2Gaw851Y2tduj2R5 V9FH7fPImeEFpEdosPt1B2uoS1FJxNoBySS2dFSB5bInsl2T5ZkXhoG1awdoLNPfryWI iry5hvgvy8titWfxRusJlmpTdIAtMqIS4ok3SgrdkEyTHV0W7fT4Z+fFaP1hNmMOTH0Z BvzQMl0rgt/LjbB6bSQB3VFxTJfWcS0NQVGv134T44jPhXBD8wpEyp4k+hgSrlbN4gJh fpKzpW+DXXLm99omUI3NMGjDXBHJmHfdzIPVQ4ll3DQpV0ecUimQh4tOtoicgZANMiso kb6g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W6qZwYmh/1wkXeUwGLD2lVdzV9ZsO6f2x6yJbCanhqA=; b=nxh0iCFkxH5QaFaiMgED6GE8fldC/SJgkphQ2Md1gXpSKXWS75wNSiyU8WJmH3lj09 4Ed8DsRED0jtN7qe+2nIEOfwW06bnVjHmT6YIemhYsRDWBBUVA0pWgeLsIJW5ErZH7If IARJbUHkvhJ5CroqHW5uJJTVp/rjDZYZ5VI8dK7YIi70tat1dlC8ypHU50aBItmrPtN/ +Kc3C5gvuSIApqAN3LNocSrA3CbS9We2M1IIfQyNEsmfiVO+JTRGDVHN+rCBsxgRxi36 vuvUYNI/c5rk+8hEaGlH8vlbnBN2etmDnYex9LLE8yrDL1jycikst90RXwLLFJaSo1PA ARdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pu8JKlJ6; 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 33si4959511plg.3.2019.03.10.23.29.45; Sun, 10 Mar 2019 23:30:00 -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=pu8JKlJ6; 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 S1726767AbfCKG2K (ORCPT + 99 others); Mon, 11 Mar 2019 02:28:10 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:44999 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726646AbfCKG2K (ORCPT ); Mon, 11 Mar 2019 02:28:10 -0400 Received: by mail-pf1-f195.google.com with SMTP id a3so2961905pff.11; Sun, 10 Mar 2019 23:28:09 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=W6qZwYmh/1wkXeUwGLD2lVdzV9ZsO6f2x6yJbCanhqA=; b=pu8JKlJ6a8uQqFuE9jvpNBWeVAJKhl6GHJtKMjwy1lqrm1LodRfAGoQPwIrPxU8uZw 5mqHSNxKW5Nv1T/EzStN9vZzsP2dU3j8z6AQxyfXKTYxc8EkXFhlQ2veXNOmBEKRMznM 5OgKvKdzGjw0kD6HzBpSkDxpxXoVr/bX8OTjE00EQyE/3lemtmECMUG+hp5Qx5Z1Z0Ni 4fiFz5lb0V9kV32rGd7XPZ6Ess2b3CpZQqNeAeuHgug5jFEADbyIk0SI/ofQxtDug8NF yG7G2evrKWc/3Ih6mWjrdVFZrXPh9CvSaUEDCMEjfaj3LW8WEWBPXkYkXp4fCNf9Pd90 abIg== 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:mime-version:content-transfer-encoding; bh=W6qZwYmh/1wkXeUwGLD2lVdzV9ZsO6f2x6yJbCanhqA=; b=p8mgXQGzFvgUiINpXMO/uHjPLpV5U+YGj4Fr1ahad3r4YUhiSIngzveZ+EbSr2p72x mb3otCFhMoGHqdOa+moGWvE5YwPj0jE5OAXUf91pPANu2cjqwcU2pCW5xqFkyxALvpnV c1VskYdda+eac43s4r3+qib+lHje4VdPM1Sk/PmW5eOsmWEzNjlVkeGt+alHvkMhaSb7 7t54sCjkc2v+hehu7HH+nW2SVLFD5+6JWE8qzy/uwNEWYL61XqNDKhhsU4zb/IcKTbBu wz+6AsIEkkuhxrtHPw1L9U6iKOZMHbaNNrvRqlEJdXdXnMifLYJUihi0GnQq2N60CTtO w+YA== X-Gm-Message-State: APjAAAXewvXxmxNpOiYyD+KZa0oxu1dX8RLC1Vi9s9nYtnDqNuR+jU/m EBduSJcqQsCcInmPd7IiJcw3CgR8bBc= X-Received: by 2002:a65:4348:: with SMTP id k8mr28809193pgq.289.1552285688345; Sun, 10 Mar 2019 23:28:08 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id f192sm10241679pfc.180.2019.03.10.23.28.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Mar 2019 23:28:07 -0700 (PDT) From: Andrey Smirnov To: linux-gpio@vger.kernel.org Cc: Andrey Smirnov , Linus Walleij , Bartosz Golaszewski , Chris Healy , Andrew Lunn , Heiner Kallweit , Fabio Estevam , linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 2/7] gpio: vf610: Simplify vf610_gpio_set() Date: Sun, 10 Mar 2019 23:27:32 -0700 Message-Id: <20190311062737.6652-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190311062737.6652-1-andrew.smirnov@gmail.com> References: <20190311062737.6652-1-andrew.smirnov@gmail.com> 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 only difference between two codepaths is register offset used. Simplify the code a bit by replacing explicit calls with a single call with a variable offset. No functional change intended. Signed-off-by: Andrey Smirnov Cc: Linus Walleij Cc: Bartosz Golaszewski Cc: Chris Healy Cc: Andrew Lunn Cc: Heiner Kallweit Cc: Fabio Estevam Cc: linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-imx@nxp.com --- drivers/gpio/gpio-vf610.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 7e9451f47efe..2ea17870e9da 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -102,11 +102,9 @@ static void vf610_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { struct vf610_gpio_port *port = gpiochip_get_data(gc); unsigned long mask = BIT(gpio); + unsigned long offset = val ? GPIO_PSOR : GPIO_PCOR; - if (val) - vf610_gpio_writel(mask, port->gpio_base + GPIO_PSOR); - else - vf610_gpio_writel(mask, port->gpio_base + GPIO_PCOR); + vf610_gpio_writel(mask, port->gpio_base + offset); } static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) -- 2.20.1