From patchwork Tue Feb 28 01:53:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 658289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E685CC64EC7 for ; Tue, 28 Feb 2023 18:59:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjB1S7g (ORCPT ); Tue, 28 Feb 2023 13:59:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbjB1S7f (ORCPT ); Tue, 28 Feb 2023 13:59:35 -0500 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CE6823C57 for ; Tue, 28 Feb 2023 10:59:34 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id ay9so11702921qtb.9 for ; Tue, 28 Feb 2023 10:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677610773; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sX20DEMdu8oJSjxsT7K1yEeUfPB2hQE61Iu5WYRBoz0=; b=K9+YB34Uhyz2pGcyEgqOsYT85XtBc5vhvSAz/jlUXM6mglmYvkXWzsUrfTcbXmxTIu MFjE+SPphPmE728Vqdj86KIRA5NZ46pW5KJ+rq/LJ9Ag/NXFDNsE4Ile2voRai6YBcqh uluR9kTwB72XIyt2GZUAI0U6ZA2T1cR6VcQNAGJKz8AyO0AlSFn1T4wl/cRVK/Vdg9oA pYysVNOUYX+mjM/GkUrBlYXR90I1b80ZNOUpSDdFbSua1Hppcy0evSWIervWRh+kaYNq pvJ8KI3VheM3K/rCJiPGwRyr/JkV2ezMxqwodkyAfScG/FGDYNEEv2mk2u7e4uQeSMJu 0IRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677610773; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sX20DEMdu8oJSjxsT7K1yEeUfPB2hQE61Iu5WYRBoz0=; b=c5yyu4D9n757XAD7VBAGXksFLF5eXZ6HoBTejONrFOBXt8EsKI0kPzx6LHXHM8U+iy MxHfmw1TjDMtllxfxGlepxFyog1usfZe+GfdUowUvOO10AzLpstrGOfypcrOCPwM1WD/ pJ37EkD5I8xPEntzS+59pqSFp7OV0ixvBG2wQq8T3TXxvvHBEKOa2ZGrpLbQ8zpq0AL1 glK+qnGTuV5LOgqoHNFqZwqW2vGw4pB0n6ksn/Zff5DedM/YI5hq0vrR9Z6+Ut5T0yS+ 2yCRtNrsQ6OkIsVDQMAnXfnhhcwJSYnASfO+w0jBoYlW6GUpOLZyTxWsvPEvjogr0IWX dUAw== X-Gm-Message-State: AO0yUKWj9kLj+Gg1RSoP2s+/qe27UQ5kSYlVRdd9Ie7EI+F8DbLz1FUD umL6Dw/zBpScnRU3iNDKhw6+qg== X-Google-Smtp-Source: AK7set/kM0f7kednRF2IBdvHSHI0MGIzLNfZlhh+8jCQELzQiajQ9FkWbJ4tD1PYJGKa7deLSdhNAg== X-Received: by 2002:a05:622a:1a92:b0:3bf:ca4f:9c4c with SMTP id s18-20020a05622a1a9200b003bfca4f9c4cmr6966372qtc.56.1677610773584; Tue, 28 Feb 2023 10:59:33 -0800 (PST) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id e22-20020ac84b56000000b003b646123691sm6905181qts.31.2023.02.28.10.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 10:59:33 -0800 (PST) From: William Breathitt Gray To: linus.walleij@linaro.org, brgl@bgdev.pl Cc: broonie@kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, michael@walle.cc, quarium@gmail.com, jhentges@accesio.com, jay.dolan@accesio.com, William Breathitt Gray Subject: [PATCH 1/3] regmap: Pass regmap and irq_drv_data as parameters for set_type_config() Date: Mon, 27 Feb 2023 20:53:40 -0500 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Allow struct regmap_irq_chip set_type_config() callbacks to access the device regmap and irq_drv_data by passing them as parameters. Signed-off-by: William Breathitt Gray --- drivers/base/regmap/regmap-irq.c | 13 +++++++++---- include/linux/regmap.h | 12 ++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index a8f185430a07..eac55a3af6d9 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -333,8 +333,9 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type) } if (d->chip->set_type_config) { - ret = d->chip->set_type_config(d->config_buf, type, - irq_data, reg); + ret = d->chip->set_type_config(map, d->config_buf, type, + irq_data, reg, + d->chip->irq_drv_data); if (ret) return ret; } @@ -650,18 +651,22 @@ EXPORT_SYMBOL_GPL(regmap_irq_get_irq_reg_linear); /** * regmap_irq_set_type_config_simple() - Simple IRQ type configuration callback. + * @map: The regmap for the device. * @buf: Buffer containing configuration register values, this is a 2D array of * `num_config_bases` rows, each of `num_config_regs` elements. * @type: The requested IRQ type. * @irq_data: The IRQ being configured. * @idx: Index of the irq's config registers within each array `buf[i]` + * @irq_drv_data: Driver specific IRQ data * * This is a &struct regmap_irq_chip->set_type_config callback suitable for * chips with one config register. Register values are updated according to * the &struct regmap_irq_type data associated with an IRQ. */ -int regmap_irq_set_type_config_simple(unsigned int **buf, unsigned int type, - const struct regmap_irq *irq_data, int idx) +int regmap_irq_set_type_config_simple(struct regmap *map, unsigned int **buf, + unsigned int type, + const struct regmap_irq *irq_data, + int idx, void *irq_drv_data) { const struct regmap_irq_type *t = &irq_data->type; diff --git a/include/linux/regmap.h b/include/linux/regmap.h index a3bc695bcca0..49073f5ae87a 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1648,8 +1648,10 @@ struct regmap_irq_chip { unsigned int mask_buf, void *irq_drv_data); int (*set_type_virt)(unsigned int **buf, unsigned int type, unsigned long hwirq, int reg); - int (*set_type_config)(unsigned int **buf, unsigned int type, - const struct regmap_irq *irq_data, int idx); + int (*set_type_config)(struct regmap *map, unsigned int **buf, + unsigned int type, + const struct regmap_irq *irq_data, int idx, + void *irq_drv_data); unsigned int (*get_irq_reg)(struct regmap_irq_chip_data *data, unsigned int base, int index); void *irq_drv_data; @@ -1657,8 +1659,10 @@ struct regmap_irq_chip { unsigned int regmap_irq_get_irq_reg_linear(struct regmap_irq_chip_data *data, unsigned int base, int index); -int regmap_irq_set_type_config_simple(unsigned int **buf, unsigned int type, - const struct regmap_irq *irq_data, int idx); +int regmap_irq_set_type_config_simple(struct regmap *map, unsigned int **buf, + unsigned int type, + const struct regmap_irq *irq_data, + int idx, void *irq_drv_data); int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, int irq_base, const struct regmap_irq_chip *chip,