Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp774659rdg; Wed, 11 Oct 2023 05:22:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+bnSAG8lTKO2XJMod3Xhjgu1cb5OThWldbX5xHVTrhtYEIWVAY+BKTJbRV0bq0Xxb8rmr X-Received: by 2002:a05:6a20:258d:b0:14d:e075:fc5d with SMTP id k13-20020a056a20258d00b0014de075fc5dmr20928150pzd.40.1697026929234; Wed, 11 Oct 2023 05:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697026929; cv=none; d=google.com; s=arc-20160816; b=zSvfMIZpQ7H6WYeMJYls7Vsow+r+nQPRBbC6gvP/280oAOKeXKzZsm64SyonyXsdJ+ osbldO9etKsIATtEpbtKW2DXpu6Eod9+pnTopqBZV2G3ZrYje7qLcvmVcX8nQIIrsMSO 1gJTSgBRqT/vBp8HhInMKKhb1V++qazqyV8UZpl7jnifxLrbhYTMNS+62I8qaWHxM3Sk w9CsHGoYxUh5d9RF8uQmoaImnIzC8dCc/OxQbsuRXLuT3BG8b9aHjpawVwBXji4u8tZa S8pgIdWEgP43SgAxrC++z35FYUkuqTtP02ZcwxlYjizik+Ez6p70U7bzveCn6G2DVWQb Os1w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W1TfGq9ZUTHjJHsNkCdZo3V3ZE8dSm/Gv302pfRQaqA=; fh=kOxmq+prcfKKX/dgMaMxTb6TRjzyc//QKXZBiaS/a94=; b=nEQXVwoyXqcT8A6krSys5/fOjwFLEC4JDei3WPXj08YOtVlAzYasmR3JjTes+hBRRl /XtB5+tCWTVZ6OlKbOjL5yvw/ospGR+2k5gVlJS4+rbvxFHzkT4u7kEwNlLE82gVaYes EpM7MmkGe+mTjkKbqW4IfU+kC2czWSr7QT3nmmLO939dEDURQl8grzkAQBY5qtZstOkL TadhMqQLqdawYjkZKMBRwUe3VzzwIvqw5y09J3VmpbGqQt1ZRvyIYOAJkWyXxYJ8g1rz RuwJlkYa3OR+czNU+lLTTglnHc7xn8qPSFETelFMDppByMIejUcDFqeRzAXAmFk+uhf9 /qPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=eTfCMhyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id y193-20020a638aca000000b0057851fc2b4asi11789475pgd.55.2023.10.11.05.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 05:22:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=eTfCMhyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8BAF18022ADF; Wed, 11 Oct 2023 05:22:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346884AbjJKMVJ (ORCPT + 99 others); Wed, 11 Oct 2023 08:21:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234984AbjJKMUa (ORCPT ); Wed, 11 Oct 2023 08:20:30 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B33612C for ; Wed, 11 Oct 2023 05:10:12 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4066241289bso63791895e9.0 for ; Wed, 11 Oct 2023 05:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1697026187; x=1697630987; darn=vger.kernel.org; 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=W1TfGq9ZUTHjJHsNkCdZo3V3ZE8dSm/Gv302pfRQaqA=; b=eTfCMhyDUcQLjBLy+jSp2B5rBlewXmVneO9QPMu1GvTK3jUhamVCGHTa8WAmGC4oYw RDI8nZ7qJVgHN5d8JhJznilTxrZLIgBOX5ow3Ezp2mVUlAgXNMyfKeeF25YgP4lJhjxH g3gXLQxRjSE1ANX0w6ZgFxHEQD79RvCeULl6bsfAOgHA3yaylm8+8v1yLrjcGen4YpOc sfCOirtNzw/WMPJWQ9eAVxBetAmheyp9lyAUNaH6X6Lb3i1Z5nVUkCWk8muwcs0w9YCG PT9gtepLCZNAfHVP+5/HjJHSN3KFIAKP7FyIaYGujY6Z17GCVATakDco1Oj6Nd5NNMQe 5h2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697026187; x=1697630987; 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=W1TfGq9ZUTHjJHsNkCdZo3V3ZE8dSm/Gv302pfRQaqA=; b=GKn2eAfX3Wzy+W1GTZpnAL6DkfEaUpPHOZdSlGDOmlnrpljtIYJxBEM8NwCpdbYeBT jSlsSRw/vX8dTUGK9zNWuybJzM/UGGZDjL8pcXTxIibBi302S9ij3ETOWLlQ+DemovKa wkyRBoXarkQru3cRClXBHaR9LbQtFTCnjdlmf9du81YFCR0J01+BDDaYzAuZYybk6U8K MtJszu1p1ZoaZKy66i/yPN0lRgKEKmFmsQFs0O019sQgAYgpD1/oThk9hgT/0k8Mo3TS EtawJCzPT3piNQtx22n9PPxZhkrcogZOvpiJyDl+78eh08BhO8N1mq+gYCMAlEjLicBc 5uaA== X-Gm-Message-State: AOJu0YxbmCatjnmdkHQMAqa/JALoXA6z4nFqVXlj52rm+BekPqSZOEFD HuQSqvTmmqtDSErfL1slYMCJTA== X-Received: by 2002:a05:600c:2218:b0:3f7:cb42:fa28 with SMTP id z24-20020a05600c221800b003f7cb42fa28mr17715760wml.28.1697026187109; Wed, 11 Oct 2023 05:09:47 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e551:3946:26fc:f94]) by smtp.gmail.com with ESMTPSA id w21-20020a05600c015500b0040652e8ca13sm19012253wmm.43.2023.10.11.05.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 05:09:46 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 43/62] pinctrl: change the signature of pinctrl_get_device_gpio_range() Date: Wed, 11 Oct 2023 14:08:11 +0200 Message-Id: <20231011120830.49324-44-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011120830.49324-1-brgl@bgdev.pl> References: <20231011120830.49324-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 11 Oct 2023 05:22:00 -0700 (PDT) X-Spam-Level: ** From: Bartosz Golaszewski Modify pinctrl_get_device_gpio_range() to be in line with public GPIO helpers and take a pair of GPIO chip & offset as arguments. Signed-off-by: Bartosz Golaszewski --- drivers/pinctrl/core.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 24cc075044e9..2eebd86ca2bc 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -372,7 +372,8 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio) { return true; } /** * pinctrl_get_device_gpio_range() - find device for GPIO range - * @gpio: the pin to locate the pin controller for + * @gc: GPIO chip structure from the GPIO subsystem + * @offset: hardware offset of the GPIO relative to the controller * @outdev: the pin control device if found * @outrange: the GPIO range if found * @@ -381,7 +382,8 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio) { return true; } * -EPROBE_DEFER if the GPIO range could not be found in any device since it * may still have not been registered. */ -static int pinctrl_get_device_gpio_range(unsigned gpio, +static int pinctrl_get_device_gpio_range(struct gpio_chip *gc, + unsigned int offset, struct pinctrl_dev **outdev, struct pinctrl_gpio_range **outrange) { @@ -393,7 +395,7 @@ static int pinctrl_get_device_gpio_range(unsigned gpio, list_for_each_entry(pctldev, &pinctrldev_list, node) { struct pinctrl_gpio_range *range; - range = pinctrl_match_gpio_range(pctldev, gpio); + range = pinctrl_match_gpio_range(pctldev, gc->base + offset); if (range) { *outdev = pctldev; *outrange = range; @@ -767,7 +769,7 @@ bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset) * we're probably dealing with GPIO driver * without a backing pin controller - bail out. */ - if (pinctrl_get_device_gpio_range(gc->base + offset, &pctldev, &range)) + if (pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range)) return true; mutex_lock(&pctldev->mutex); @@ -798,8 +800,7 @@ int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset) struct pinctrl_dev *pctldev; int ret, pin; - ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev, - &range); + ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range); if (ret) { if (pinctrl_ready_for_gpio_range(gc->base + offset)) ret = 0; @@ -834,8 +835,7 @@ void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset) struct pinctrl_dev *pctldev; int ret, pin; - ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev, - &range); + ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range); if (ret) return; @@ -858,8 +858,7 @@ static int pinctrl_gpio_direction(struct gpio_chip *gc, unsigned int offset, int ret; int pin; - ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev, - &range); + ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range); if (ret) { return ret; } @@ -923,8 +922,7 @@ int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset, struct pinctrl_dev *pctldev; int ret, pin; - ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev, - &range); + ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range); if (ret) return ret; -- 2.39.2