From patchwork Tue Nov 5 10:30:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 1189545 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=209.132.180.67; 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=fi.rohmeurope.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 476mBs74Tcz9s4Y for ; Tue, 5 Nov 2019 21:30:13 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388148AbfKEKaN (ORCPT ); Tue, 5 Nov 2019 05:30:13 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:44125 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388022AbfKEKaN (ORCPT ); Tue, 5 Nov 2019 05:30:13 -0500 Received: by mail-lj1-f196.google.com with SMTP id g3so15053057ljl.11; Tue, 05 Nov 2019 02:30:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ob9HSuMhR66NnLGsiN9Kf7XuZxMaGmEbKI+aKByDMTg=; b=V6i7iRvyQfYk5CXR+9oggF0lsXlXe4abklySfsmJUD4SUyoFHFFt0beMTE2R1z8wCO io/kqqOCCesKRGHYtlj5SujyMcohJcl0td92sUF50NQdd8F4HLW/qWc5CMSSz2ikWOHw HfV7OvFRMBCddDHJkMfEDY6UytXKPFMURmbupGpkxtDRqaAshSSkIBx6SUbrfsp6mD+x aqgIylEKi84W1GmOEqfCX8xAHSoaRLJfRMSXfB/EqyFHbfZC+5gh8PO9v72Et7AHTZxh k4k4liJpJW4bIYoSzWxkJIVRRcoxePqdjrs8x8KyL56Lnxr/fwVBjO67UqatAgCmaIdu 3Iyg== X-Gm-Message-State: APjAAAW1/1lvTkt1FKUq8HPj9cOZF/WplpakLB6PSsuHVxct2uRsN7oj 0IBb5acZ1SfcUzMq8IPpkE8= X-Google-Smtp-Source: APXvYqxvQhcdcurNjRxBC9UfcvDV6J3QCVm2KCalMbLgtYz7T3qpYF+zU/YA3H475CTur5xjyyKbTA== X-Received: by 2002:a05:651c:1117:: with SMTP id d23mr7028699ljo.90.1572949810898; Tue, 05 Nov 2019 02:30:10 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id k187sm1285227lfd.54.2019.11.05.02.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 02:30:10 -0800 (PST) Date: Tue, 5 Nov 2019 12:30:01 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 38/62] gpio: gpio-sch311x: Use new GPIO_LINE_DIRECTION Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org It's hard for occasional GPIO code reader/writer to know if values 0/1 equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT to help them out. Signed-off-by: Matti Vaittinen --- drivers/gpio/gpio-sch311x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-sch311x.c b/drivers/gpio/gpio-sch311x.c index 8ecf336c9af4..da01e1cad7cb 100644 --- a/drivers/gpio/gpio-sch311x.c +++ b/drivers/gpio/gpio-sch311x.c @@ -228,7 +228,10 @@ static int sch311x_gpio_get_direction(struct gpio_chip *chip, unsigned offset) data = inb(block->runtime_reg + block->config_regs[offset]); spin_unlock(&block->lock); - return !!(data & SCH311X_GPIO_CONF_DIR); + if (data & SCH311X_GPIO_CONF_DIR) + return GPIO_LINE_DIRECTION_IN; + + return GPIO_LINE_DIRECTION_OUT; } static int sch311x_gpio_set_config(struct gpio_chip *chip, unsigned offset,