From patchwork Fri Dec 15 15:52:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 18139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9375095dys; Fri, 15 Dec 2023 07:53:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IExOVnZ4CKvSTzxQI3KjRA98xENg8vAyGb2p1roke45kBFsqHtvyOsP/VC/ueEqsVenrAbD X-Received: by 2002:ac8:5fd1:0:b0:425:4043:50e4 with SMTP id k17-20020ac85fd1000000b00425404350e4mr17381306qta.115.1702655612712; Fri, 15 Dec 2023 07:53:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702655612; cv=none; d=google.com; s=arc-20160816; b=dhJYW+yJMwrMOP3O6uC3OevGHD71rqEAJIAyL0IilpywdhGIDeAzIZgD/7KjjDrEti BUr+NH5K3WRqEj3/HXl8QycplnqwDgfLqWrF2Qmn1vJSZjuNMMjWGvyHqN+sSXiKsQPN SJZTVnJJVmppMOO9N4Ao5iFk3STjdoqYq2xZBanweHbGw2g1lgnoOxYSr6qupjls8hOz eKYjxNSF3kDulxDU0I00PgxvANZXYhlP6HUuP/nlbQCkW8+S3eIulhSrFhgvcsutMqxG eg+a0pliCo29gZ0cCrgLTKQkZ+puoEymWWcShy7kCV0P7jWxtN9HaUChy6JPZCS2ohdt oiSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=9SEVXozYauGChgmPl7/rsMQixOhRmREeWdQCs6iv/QU=; fh=u8rLQsUjk/DQ68o09SM+wx8FxqDFcT3zeQdKot9Eyy4=; b=EFR/BC9nwC1u3TFZDozbmWCtyn99T93lC1w0ypn7+Cu0os4CN0AB6e0/Qtjz46/MiU BleZ1f8i2e0XqNOt5EvMg2ChJ+nS2P/CZE4c3j3xZAgPx8wLaBWUPMYtIKP7DmYDTiai RiOqmgmDFuG35asSx+/f80pc4a8P2mahDUmA/60M56V1zrPnVHtIFav/2Z78fKe1Thyw SBwJv2ropgTFI+8L9dxEoKzqgS3M6JC99Wf/oX895BCT2UfdF6XO0WdFQYo19IY2rwvP eJv2x6gNRuCc8d3Jk4xb9h1oo/y1DNulgiDxyrmMtLSO5W7Q8trYxO4365ifSOK4b0YJ F91Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=yA2GZjEL; spf=pass (google.com: domain of linux-kernel+bounces-1234-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1234-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id cc24-20020a05622a411800b00423e91f2f2csi19685350qtb.74.2023.12.15.07.53.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 07:53:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1234-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=yA2GZjEL; spf=pass (google.com: domain of linux-kernel+bounces-1234-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1234-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8079A1C2126A for ; Fri, 15 Dec 2023 15:53:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C19E43A8F4; Fri, 15 Dec 2023 15:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="yA2GZjEL" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B00AE374C4 for ; Fri, 15 Dec 2023 15:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40c38de1ee4so7876855e9.0 for ; Fri, 15 Dec 2023 07:53:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1702655585; x=1703260385; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9SEVXozYauGChgmPl7/rsMQixOhRmREeWdQCs6iv/QU=; b=yA2GZjELHXyNoUXVkdb1EdJeuXUYukm+e+Oe5h7tCIRPSPdLLeDQ++Rv+l7SX0koJI PFa5s2E41uC3qZrPazpmGJC/5SXvglVCxpUYSDnBkPjESaMNEs6Doqqz0Lp7LCOxxu44 emKDLOg0DParHvUjMsg7huwVFtM53cvAZ72BCLpf6CmukdY0ASpw7yK0SCSNJ6ZV15TX T/hcLzz7lpXM2Yh2DHucmL8AZv6a9LDDwJ2nEYabVEd2WZm7w2ARbQypbDYvmtLocp4K a4BZiYD+5/pCMPbRvqt1cUFHxka14CE6+axH0ALtEAf0bFuYQ8hvsEeUtj6xbzYbf43V FpxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702655585; x=1703260385; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9SEVXozYauGChgmPl7/rsMQixOhRmREeWdQCs6iv/QU=; b=ma796/3pMsxuUyhn7/PwydG6gmbdmV3EhX9uF4gJFy2lpKRksIdi74AERmOKqtlyQS IaITgy0F7swoF/uiYavE972QcwiOZw3xW6kO5t8ltxxVtOv/0mFMjbNxCfe5/36YKiil S3rET0kHeyD7bEZyD2ib3KpF9WfoGGgWi5Z2qcjeVDF3EVT5umqXyJUaHtw2nLGt/XL7 4/5yVIEumkB/c1zKn6h4rAzFVK9pKwY8lah5rKCQCc7W5AVcERDm+64n3HawIVU0dJba 2336M3eftjpm2JyvUrMTerTzaipeJU6TwzttOZdXJsn0+Zgm+LQAuX7mju7SDh+ZNDnw aWiw== X-Gm-Message-State: AOJu0YwbMBsC0apoG3KLqnAtNbdDU5f+3PxFAA+r98Q4sZjdeTtxFv7r e/eXewBBS0k8qCXd5sW1Ys0zjA== X-Received: by 2002:a05:600c:1e23:b0:40c:6c74:2382 with SMTP id ay35-20020a05600c1e2300b0040c6c742382mr527296wmb.105.1702655584835; Fri, 15 Dec 2023 07:53:04 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8672:e2c5:37d9:3743]) by smtp.gmail.com with ESMTPSA id bg22-20020a05600c3c9600b0040c6ab53cd2sm3110484wmb.10.2023.12.15.07.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 07:53:04 -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 v3 0/2] gpiolib: protect the list of GPIO devices with a mutex Date: Fri, 15 Dec 2023 16:52:58 +0100 Message-Id: <20231215155300.21186-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785363811659837594 X-GMAIL-MSGID: 1785363811659837594 From: Bartosz Golaszewski I figured that - since the descriptor locking is going to take some more time - we should at least start the conversion and protect the GPIO device list with a mutex. v2 -> v3: - move the new sysfs function into gpiolib-sysfs.c v1 -> v2: - add a patch renaming two functions - protect the list in gpio_device_find() too - coding style tweaks Bartosz Golaszewski (2): gpiolib: rename static functions that are called with the lock taken gpiolib: use a mutex to protect the list of GPIO devices drivers/gpio/gpiolib-sysfs.c | 45 +++++------ drivers/gpio/gpiolib-sysfs.h | 6 ++ drivers/gpio/gpiolib.c | 143 ++++++++++++++++------------------- drivers/gpio/gpiolib.h | 2 + 4 files changed, 93 insertions(+), 103 deletions(-)