Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3221841ybn; Fri, 27 Sep 2019 03:05:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6bvKwNiJDtrr6n3LBVy3sjVDR2WQHitLgXyhc/F8J9ozhY/xFm4D/D12c93nLAwfyEhXC X-Received: by 2002:a50:b884:: with SMTP id l4mr3463285ede.295.1569578720118; Fri, 27 Sep 2019 03:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569578720; cv=none; d=google.com; s=arc-20160816; b=KCT5G5WjyFGzMUEIVWUELTmL8yN1f05eNpvEmH6mgzv1fyhUBeeIiFYal9cJEecD3n 3bn3LsSdS9wI2R0fCrIQreJePT6FeSw3N9RpjPA4kklN9CAAJ6oFJQzbuK0b4uPd74BF 5gsZ05l0qijXFgTkfPQHbsWzzW/Wr5b6D/6+QHXQwety4SiVOUV9RzSCAFQm3y0WWCNS 8hPcQamygMR/wdOfCnqjklf2T03iMFBz9vyWVtfmQIi33JZmEBTdZzMYIRmgf7A+HTjz fkGr2s3rrlG5SOcsafWJrA/N33SqAJV9OFF0L5lIIukpoLqooS7ctZzq+PEjE5ndLKpS hvvg== 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; bh=f97Rv9YrkYPhaRfqcLc8mtBN1sbye0y8aZIOLVEtNjo=; b=aLcl3/sy7RwEjBgzq45psQffIAdFslHDPKvohMoZWzhrdm+9ClZISQxRw1cQAA78Ms BwpEePgVQi9/D8PNFSFD9hiOFn7sOUS6nfhXLK6chJySgygOydRiyoiRWUV9En1O5yqG B7keetCCZsmFqXsrFL7IaDcQWr0rehUgOr48TTcf+2QPaMhzyr4Y044okM+m4rwQ+IgM r14zW7yXj7kjLrqLtwEkrGSoYIIKuUMRC7j5KaWEQCZLmQnMNB2r+bpausMl5FsePVdV D32N7aw25VNtvhbyP9mTea7KvCsmp/ESz7ftBm1jnSlpSrzRZ9f/2oS57s3HYmMMuVB7 oHgQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v57si1203584edc.171.2019.09.27.03.04.55; Fri, 27 Sep 2019 03:05:20 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727173AbfI0KEX (ORCPT + 99 others); Fri, 27 Sep 2019 06:04:23 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:50263 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726988AbfI0KEV (ORCPT ); Fri, 27 Sep 2019 06:04:21 -0400 Received: from localhost.localdomain (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 7020B24002D; Fri, 27 Sep 2019 10:04:19 +0000 (UTC) From: Paul Kocialkowski To: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Bartosz Golaszewski , Rob Herring , Mark Rutland , Lee Jones , Thomas Petazzoni , Paul Kocialkowski Subject: [PATCH v3 3/5] gpio: syscon: Add support for a custom get operation Date: Fri, 27 Sep 2019 12:04:05 +0200 Message-Id: <20190927100407.1863293-4-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190927100407.1863293-1-paul.kocialkowski@bootlin.com> References: <20190927100407.1863293-1-paul.kocialkowski@bootlin.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 Some drivers might need a custom get operation to match custom behavior implemented in the set operation. Add plumbing for supporting that. Signed-off-by: Paul Kocialkowski --- drivers/gpio/gpio-syscon.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c index 31f332074d7d..05c537ed73f1 100644 --- a/drivers/gpio/gpio-syscon.c +++ b/drivers/gpio/gpio-syscon.c @@ -43,8 +43,9 @@ struct syscon_gpio_data { unsigned int bit_count; unsigned int dat_bit_offset; unsigned int dir_bit_offset; - void (*set)(struct gpio_chip *chip, - unsigned offset, int value); + int (*get)(struct gpio_chip *chip, unsigned offset); + void (*set)(struct gpio_chip *chip, unsigned offset, + int value); }; struct syscon_gpio_priv { @@ -252,7 +253,7 @@ static int syscon_gpio_probe(struct platform_device *pdev) priv->chip.label = dev_name(dev); priv->chip.base = -1; priv->chip.ngpio = priv->data->bit_count; - priv->chip.get = syscon_gpio_get; + priv->chip.get = priv->data->get ? : syscon_gpio_get; if (priv->data->flags & GPIO_SYSCON_FEAT_IN) priv->chip.direction_input = syscon_gpio_dir_in; if (priv->data->flags & GPIO_SYSCON_FEAT_OUT) { -- 2.23.0