Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3109393rdg; Tue, 17 Oct 2023 05:08:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGb6ggOlJ8wnqlUoLpg8gIfLcVQkL+u6bIotiO8Cl7Iwkukz7IBJScnCBq08pNrOVQZwH/Q X-Received: by 2002:a05:6a00:9385:b0:68f:c7c5:a73a with SMTP id ka5-20020a056a00938500b0068fc7c5a73amr1730155pfb.16.1697544517620; Tue, 17 Oct 2023 05:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697544517; cv=none; d=google.com; s=arc-20160816; b=shHOTsnN1aAFO+G9j0yqF24WWebvX/XymjZSIITjuxMRWUMgsbZ2DbyFdDMmS+gK/L RCYFjZU0MJKSBYY3ME26Zi41KqjApOUi1fm7mFn67/EX6A/1oa4Y4KRzYWjQHEXkJMnR HP9kNcRNt3VlNA7YPerNvoB3B51GlkzYX1C9fjXUfflyud78aRWoXtYGd/FTNCD4r0S6 dYuAfPoiGX2M4O332Vs2dWI5aYG7rm+mqGJN365LQSAptx6ltQegqquxRhxsBi8Wv4Hm MfR28nAQwpnPbahM+DgtuTn54Bemk6ELJ/vZxj6HRpCIcHf2ny9Zo5GiV7Y1N5JcBpgJ PuKA== 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=+4CqFcvuUjz2M/MS1KWCWQlIQoK+ivVHKbPT1o2HxyI=; fh=kOxmq+prcfKKX/dgMaMxTb6TRjzyc//QKXZBiaS/a94=; b=OaEGKeMrhL4d2yOqzB7GVncJkJ1Td2ct4BiNotiRee1dXQBShFQYrRNTi0Z74JQCkO f8Om5UzCbYbXZrGT7T0OY+7CQVwcwGdUdWZ/jTSPWMlrbkddc/pp+cOi6GNBqcADdj96 Lz6Zs0endmyE99YxNYxi2bYmJyDlnc7ty7ILeA9o+ecye8/5aQHMYMJDTMP++VrvPB86 Vc4g1DfoXzG1sv7fsVkKLVUhE7BqXRPbsUbOYzpCmJ0isf+aVT4EPYVHiTBlo/biyN2r 1VK20e5AF8v7V6FZl5wLvmoe58s6d+Ux75BPWwnHd+zPG+IDbuY5v4MpQXhVVW8Cwwt3 Vq4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=r2YnnYNA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u36-20020a056a0009a400b0068e45c6ca3fsi1555085pfg.93.2023.10.17.05.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 05:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=r2YnnYNA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id B2666801BCC0; Tue, 17 Oct 2023 05:08:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343758AbjJQMIL (ORCPT + 99 others); Tue, 17 Oct 2023 08:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235038AbjJQMHW (ORCPT ); Tue, 17 Oct 2023 08:07:22 -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 320442113 for ; Tue, 17 Oct 2023 05:05:39 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40566f89f6eso62512765e9.3 for ; Tue, 17 Oct 2023 05:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1697544337; x=1698149137; 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=+4CqFcvuUjz2M/MS1KWCWQlIQoK+ivVHKbPT1o2HxyI=; b=r2YnnYNAzXjV+8vENDlDrgbbw4SmN+FQLIcKfVfOMecYJJ+U9JNP2vr+DD2GYZhO7Y vTisADJZgwZp8dni6evcu1Lh7HyhTND8J9LcaOY45N6rch/lrd6FLAB1/fH2QZcY6wlD YI2GpyY9Nv7inL4pl3cqhh7kGWwz6tUpTNWoz+Z1h/9DuApjnExqlmfemDYx0m8DVvhT XumA3rz1Ax3OrQXaPh21o2gvT8Yv1kGLGqAW2LcUg40GXQAkp8CEqlK0yt9JGvRTUJPT AxVPhLv5ExvBP5RKksfpKs/tybdq7FnjV/8+x9EyIBSvxK6sI7/PoandWB3utXjXnHD1 RiVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697544337; x=1698149137; 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=+4CqFcvuUjz2M/MS1KWCWQlIQoK+ivVHKbPT1o2HxyI=; b=QfDD8tAGXsPQeSWvsyMRwMMUL8eZr5eyXzBLwg9H80cjzSK92zUSmbPTjLyF0WJXwj TllUN3jAXxJ/d7vgGpCSl3VwMFC335WBoFSDwxeH2Jvpdt8cQu2XCA9x6+KSGU+XUuFv RBFOgN4r9/CfXuPcHXrk01pm+igFqqa4Q3L3XfUqB238cXZwyq4/EdcSWyfWheZ66CUA GP/IAqYG45MuZJfPlHlxs/qo6xyQC1sNa3qkPi8FGKOKfZ1aPjOPqEaqO1AoVoDZ2htz sddHET7UeOHcSJoxj+y5E2mcc/kGVeh6hqclB7lKRgLpGU6Xzot6xNWyWE+LTZIZJ5OE mZ+A== X-Gm-Message-State: AOJu0Yycl61kWYIgwGnaQXreMzTxrQlc9/01HMdtsj/py54fWri6T+aV XjF9bN0WOIpP7d69fmKKvcRCrg== X-Received: by 2002:a05:600c:a47:b0:403:8fb9:8d69 with SMTP id c7-20020a05600c0a4700b004038fb98d69mr1688040wmq.25.1697544337487; Tue, 17 Oct 2023 05:05:37 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:f1ee:b000:ce90:ed14]) by smtp.gmail.com with ESMTPSA id a2-20020a05600c224200b00405442edc69sm1353859wmm.14.2023.10.17.05.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 05:05:36 -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 v3 50/73] pinctrl: change the signature of pinctrl_match_gpio_range() Date: Tue, 17 Oct 2023 14:04:08 +0200 Message-Id: <20231017120431.68847-51-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231017120431.68847-1-brgl@bgdev.pl> References: <20231017120431.68847-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 17 Oct 2023 05:08:13 -0700 (PDT) From: Bartosz Golaszewski Modify pinctrl_match_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 Reviewed-by: Andy Shevchenko --- drivers/pinctrl/core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 80f1db0ec074..ec78a75a5d7c 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -292,13 +292,15 @@ static inline int gpio_to_pin(struct pinctrl_gpio_range *range, /** * pinctrl_match_gpio_range() - check if a certain GPIO pin is in range * @pctldev: pin controller device to check - * @gpio: gpio pin to check taken from the global GPIO pin space + * @gc: GPIO chip structure from the GPIO subsystem + * @offset: hardware offset of the GPIO relative to the controller * * Tries to match a GPIO pin number to the ranges handled by a certain pin * controller, return the range or NULL */ static struct pinctrl_gpio_range * -pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio) +pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, struct gpio_chip *gc, + unsigned int offset) { struct pinctrl_gpio_range *range; @@ -306,8 +308,8 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio) /* Loop over the ranges */ list_for_each_entry(range, &pctldev->gpio_ranges, node) { /* Check if we're in the valid range */ - if (gpio >= range->base && - gpio < range->base + range->npins) { + if ((gc->base + offset) >= range->base && + (gc->base + offset) < range->base + range->npins) { mutex_unlock(&pctldev->mutex); return range; } @@ -395,7 +397,7 @@ static int pinctrl_get_device_gpio_range(struct gpio_chip *gc, list_for_each_entry(pctldev, &pinctrldev_list, node) { struct pinctrl_gpio_range *range; - range = pinctrl_match_gpio_range(pctldev, gc->base + offset); + range = pinctrl_match_gpio_range(pctldev, gc, offset); if (range) { *outdev = pctldev; *outrange = range; -- 2.39.2