Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp962543pxb; Wed, 3 Mar 2021 22:41:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhDzGiu2XLQC2/83QpH9Z5JUaxLhEaPSOVaGjfop849fqkmWXAv/s95XD99hNgTsCjuBgv X-Received: by 2002:a50:fe06:: with SMTP id f6mr2678993edt.349.1614840062190; Wed, 03 Mar 2021 22:41:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614840062; cv=none; d=google.com; s=arc-20160816; b=0Wxqw8RPRFmJnsW0sxQ48VJHk67UyBRaXnp9fKtAQtx78BkpJrMpw2VJkn/9RNhb0I YLvta03fwrauMiXO+fawlyB5hMZTYbZb3XJhjfDGBY8TShpUnpDSQBg27L21dGTb2M2w qJaLizVdTKe/g+ul3kmpr+vZcwBuYGQVqFbseVIoUDMEIxO+NW9Kp/A442qguDtlMUXK rkb4eK4cSL9K3mjeeF/A/XcWT7pSn/RFhSaIZlC9kegT5wB7zcpz5WgssG8I9CkAw2ho 0FSi1/+C9DKRSa6W9FtODBq14MRsTQlf40Mk/6QT/K1o20eEifzYMRWTW2FEpTpHho5T vMPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gnkuHuyViGY8zg3xnjKXTQqrs4pSICO7UYO1lK2VU+Q=; b=l/45cQ9Z/Dh2ugKBrsQ34qaz8PmKGSq809v75zK+HYi2tL4KUDCgFGeS4Ijo04kQkf TrDtZyZNaV0iUEJZSG2HrciHh2nzEVorfEO+RF2lJp/RUnO1t/UsJbK0cc4YyF3rc6wP 5368h88ygDnzSf5/LZaeOPyp5mY0nPJfFQTKaE0IA1EMoG7ilda+iG2NNWvYFgYF5M3n 96RSMNAMonWoEHSWbITo5jChdFn8ogXAch7sfYWtGToAczDhC47LPjfzffw7lLHudeDN Uo4SMLxfAhAFNTFXKqHcHnQnYfWootvgJ4YxE17uQhH/f0KiU8FLH3WwV7S5rYE4RDtp 3TvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AwnopjaX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id z15si13417131edm.187.2021.03.03.22.40.39; Wed, 03 Mar 2021 22:41:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AwnopjaX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1448159AbhCBVIJ (ORCPT + 99 others); Tue, 2 Mar 2021 16:08:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347494AbhCBSHN (ORCPT ); Tue, 2 Mar 2021 13:07:13 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA207C0617AA; Tue, 2 Mar 2021 10:06:04 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id d15so5633667wrv.5; Tue, 02 Mar 2021 10:06:04 -0800 (PST) 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=gnkuHuyViGY8zg3xnjKXTQqrs4pSICO7UYO1lK2VU+Q=; b=AwnopjaXS2hX7IMjcz79ZlfUNKEp2Oxb8rO61mXVKKosI/G7j+5fB9/UKeDKlW6LBm YagB0Xi20yf2qnJUZZv/xg9YKYXnaKgTNuvmihLjvKVPXGJ5CF2G8GCfw8yDI6gIk5iR OhLUh+dZue30YHabqWtWSXUjqBqFw4mmai9uBPg72X78fYUHReUOBJ7FXkmbzo7u3w2X 0Q282JKskkEqTcKPDXfoeKbkIBOWK6qfFl2rySlsbsphIP8CZIzToWMjcrp2KWq4H9wS uI9B5R1e4n2Jde3TTOth4ccq+Xk6ur/KjlmZeylJOwJqI+II59GmgxN5DAtXtIXHvLrX XojA== 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=gnkuHuyViGY8zg3xnjKXTQqrs4pSICO7UYO1lK2VU+Q=; b=g7VKO/MOhYfGxDkEgS2Ix5reC0b4OXZ95hpz5v8HU1ccuXrHyp/9QuFlIMh6ytMgPu Z4f03bj3CuOGsV09T2GGxQPWpNUsFPrHTCaOZofD43ba1NbGpcaZI8R9Rf+OofJXrLVC gPqJbMzmXXQJjfpn4AGbjSAOL6cFv8xbgTm29w11ZU34Dg6cY8xlDIKrIebAIhYZeXS7 uwx7ZSIxYtZQdlqhn87jAISEvic62k0ptDzH7oG4U2ajfUqk5BPf1n4oyfjRPvvqV+GY 8O+A9crA0NHA3Q7Ild2YTodc8opDtIp0JEB9GpaqPpZhlhAp/5Hf9Gvs8R3dPAW6C9Mt YRgg== X-Gm-Message-State: AOAM532AA5ISrGxBv2oYL0tR9iOES/70g4zLMRhtrvpbnQGAqAAxzbjg GC5MDujMqRtWXMdf6je0EoQ= X-Received: by 2002:a5d:4592:: with SMTP id p18mr7576282wrq.244.1614708363488; Tue, 02 Mar 2021 10:06:03 -0800 (PST) Received: from skynet.lan (170.red-88-1-105.dynamicip.rima-tde.net. [88.1.105.170]) by smtp.gmail.com with ESMTPSA id 3sm17136336wry.72.2021.03.02.10.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 10:06:02 -0800 (PST) From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= To: Michael Walle , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Subject: [PATCH] gpio: regmap: move struct gpio_regmap definition Date: Tue, 2 Mar 2021 19:06:01 +0100 Message-Id: <20210302180601.12082-1-noltari@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org struct gpio_regmap should be declared in gpio/regmap.h. This way other drivers can access the structure data when registering a gpio regmap controller. Fixes: ebe363197e52 ("gpio: add a reusable generic gpio_chip using regmap") Signed-off-by: Álvaro Fernández Rojas --- drivers/gpio/gpio-regmap.c | 20 ------------------ include/linux/gpio/regmap.h | 41 ++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c index 5412cb3b0b2a..23b0a8572f53 100644 --- a/drivers/gpio/gpio-regmap.c +++ b/drivers/gpio/gpio-regmap.c @@ -11,26 +11,6 @@ #include #include -struct gpio_regmap { - struct device *parent; - struct regmap *regmap; - struct gpio_chip gpio_chip; - - int reg_stride; - int ngpio_per_reg; - unsigned int reg_dat_base; - unsigned int reg_set_base; - unsigned int reg_clr_base; - unsigned int reg_dir_in_base; - unsigned int reg_dir_out_base; - - int (*reg_mask_xlate)(struct gpio_regmap *gpio, unsigned int base, - unsigned int offset, unsigned int *reg, - unsigned int *mask); - - void *driver_data; -}; - static unsigned int gpio_regmap_addr(unsigned int addr) { if (addr == GPIO_REGMAP_ADDR_ZERO) diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h index ad76f3d0a6ba..ce2fc6e9b62b 100644 --- a/include/linux/gpio/regmap.h +++ b/include/linux/gpio/regmap.h @@ -4,13 +4,52 @@ #define _LINUX_GPIO_REGMAP_H struct device; -struct gpio_regmap; struct irq_domain; struct regmap; #define GPIO_REGMAP_ADDR_ZERO ((unsigned int)(-1)) #define GPIO_REGMAP_ADDR(addr) ((addr) ? : GPIO_REGMAP_ADDR_ZERO) +/** + * struct gpio_regmap - GPIO regmap controller + * @parent: The parent device + * @regmap: The regmap used to access the registers + * given, the name of the device is used + * @gpio_chip: GPIO chip controller + * @ngpio_per_reg: Number of GPIOs per register + * @reg_stride: (Optional) May be set if the registers (of the + * same type, dat, set, etc) are not consecutive. + * @reg_dat_base: (Optional) (in) register base address + * @reg_set_base: (Optional) set register base address + * @reg_clr_base: (Optional) clear register base address + * @reg_dir_in_base: (Optional) in setting register base address + * @reg_dir_out_base: (Optional) out setting register base address + * @reg_mask_xlate: (Optional) Translates base address and GPIO + * offset to a register/bitmask pair. If not + * given the default gpio_regmap_simple_xlate() + * is used. + * @driver_data: (Optional) driver-private data + */ +struct gpio_regmap { + struct device *parent; + struct regmap *regmap; + struct gpio_chip gpio_chip; + + int reg_stride; + int ngpio_per_reg; + unsigned int reg_dat_base; + unsigned int reg_set_base; + unsigned int reg_clr_base; + unsigned int reg_dir_in_base; + unsigned int reg_dir_out_base; + + int (*reg_mask_xlate)(struct gpio_regmap *gpio, unsigned int base, + unsigned int offset, unsigned int *reg, + unsigned int *mask); + + void *driver_data; +}; + /** * struct gpio_regmap_config - Description of a generic regmap gpio_chip. * @parent: The parent device -- 2.20.1