From nobody Wed Dec 17 00:14:53 2025 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 CD05BC4167B for ; Fri, 8 Dec 2023 10:20:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573482AbjLHKU0 (ORCPT ); Fri, 8 Dec 2023 05:20:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573473AbjLHKUW (ORCPT ); Fri, 8 Dec 2023 05:20:22 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47952171F for ; Fri, 8 Dec 2023 02:20:28 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-332c46d5988so2004297f8f.1 for ; Fri, 08 Dec 2023 02:20:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1702030826; x=1702635626; 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=xcBt1H06VnpfQ+udlk19+9Kb0QwElKrjTxgmIfyINVE=; b=EP/4/5PzeliOihBSme+38ywRnGlLD66AtuLseXgTuycU+ECUhwT+OU7b+wfjw6JAEd XJvfgXcFymhoMF377pSpRmjGSZLPDPBwqBZ8K40Hx+EB8vH1ZGN579M03/yLtiXqJ2q7 1vs+86Z0TEDigQOYzWUXxl02ZN7nHxcU1fzzmfVv5+EniOLFMt7t93bdTzDOpHZV7ZK6 HN0y9dNxR2oHi+oDcxShw/k4c4EdDJ2ZxJADcwdHtg/+1z84KbqMsif+MQOlJV4ta4Xe pR1m7HEDJmxu4i3O7h308iqL9Vrp2yrJYj72MoeLZ0AHq0PlugDwrCJlEtJmEh5S7P5t jyTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702030826; x=1702635626; 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=xcBt1H06VnpfQ+udlk19+9Kb0QwElKrjTxgmIfyINVE=; b=K/DpH4K0dJhHTvwVA51glVt3iVj1o3Gd8TGxb/tUpVgw5AIBimmiGxCxgw7afIthuP Jxi4CMNRtxn4YMLps+o+FpRMPDuVLsRwj0PTuouzjqoZlahlu8AeRD62Q6XUcSPSfZ6u y/q/fpxBL3sNOIwZze8fHbuzERqstgWDiPHy8VKvoAIyMPvtv5Yrbwcqa2CvVxwFZOmX n5iVlgkafczywXUBMH6x6Pm167/ZcMCYE4JeN02OsKViPhhvwooJGUVomeuoQw37tSv3 oMupYBgGpGhhFIeye7DMDlwHql+5AYnMI04Swz4Yu2Up4Z8l1Gf/uyOijj5w/1q1ppOK QonQ== X-Gm-Message-State: AOJu0YyO9MBd4pTzz5cztG7dR2Euq4QaYdgazxYjOBEMBjYDMoNwpUZj PxN0SpN7Jb33Tm+BYbixjTVr8A== X-Google-Smtp-Source: AGHT+IEpU9lE4FCaeTWGdOHg5eeTKFEHWPUdBguqaSRXsB3xDodFBETQgvOVjS81LezAfe+3OSSyow== X-Received: by 2002:adf:ed06:0:b0:333:380f:2d2d with SMTP id a6-20020adfed06000000b00333380f2d2dmr2777351wro.92.1702030826702; Fri, 08 Dec 2023 02:20:26 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b162:2510:4488:c0c3]) by smtp.gmail.com with ESMTPSA id n16-20020a5d4850000000b003334926fb81sm1678026wrs.90.2023.12.08.02.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 02:20:24 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Kent Gibson Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 1/2] gpiolib: rename static functions that are called with the lock taken Date: Fri, 8 Dec 2023 11:20:19 +0100 Message-Id: <20231208102020.36390-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208102020.36390-1-brgl@bgdev.pl> References: <20231208102020.36390-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski Rename two functions that read or modify the global GPIO device list but don't take the lock themselves (and need to be called with it already acquired). Use the _unlocked() suffix which seems to be used quite consistently across the kernel despite there also existing the _locked() suffix for the same purpose. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- drivers/gpio/gpiolib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4e190be75dc2..779f8b21bf05 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -290,7 +290,7 @@ struct gpio_chip *gpio_device_get_chip(struct gpio_devi= ce *gdev) EXPORT_SYMBOL_GPL(gpio_device_get_chip); =20 /* dynamic allocation of GPIOs, e.g. on a hotplugged device */ -static int gpiochip_find_base(int ngpio) +static int gpiochip_find_base_unlocked(int ngpio) { struct gpio_device *gdev; int base =3D GPIO_DYNAMIC_BASE; @@ -363,7 +363,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_direction); * Return -EBUSY if the new chip overlaps with some other chip's integer * space. */ -static int gpiodev_add_to_list(struct gpio_device *gdev) +static int gpiodev_add_to_list_unlocked(struct gpio_device *gdev) { struct gpio_device *prev, *next; =20 @@ -907,7 +907,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, vo= id *data, */ base =3D gc->base; if (base < 0) { - base =3D gpiochip_find_base(gc->ngpio); + base =3D gpiochip_find_base_unlocked(gc->ngpio); if (base < 0) { spin_unlock_irqrestore(&gpio_lock, flags); ret =3D base; @@ -927,7 +927,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, vo= id *data, } gdev->base =3D base; =20 - ret =3D gpiodev_add_to_list(gdev); + ret =3D gpiodev_add_to_list_unlocked(gdev); if (ret) { spin_unlock_irqrestore(&gpio_lock, flags); chip_err(gc, "GPIO integer space overlap, cannot add chip\n"); --=20 2.40.1