Received: by 2002:a05:7412:d002:b0:f9:9049:d2ea with SMTP id bd2csp38467rdb; Wed, 20 Dec 2023 03:20:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcWXYlHmPCvdT4hj4I0L5puQ+7PDiuM9CNB7eje9iPz/nWBL64+mH/b91Q/VivNb+91K4W X-Received: by 2002:a50:f61b:0:b0:553:dc27:924a with SMTP id c27-20020a50f61b000000b00553dc27924amr475152edn.18.1703071249699; Wed, 20 Dec 2023 03:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703071249; cv=none; d=google.com; s=arc-20160816; b=lh/f069A8wKsl2ccTHegXVydunpVAI/8gN2UWA3pkmweX3mhbgEg2hNvyElVHj9CW5 Ct+Tb2a3W6Mt+pXVMct45zAPlCQNHVazAFIebPh3WAMWkNe8SVW+bSdugnIZxVx74XK/ x0M8mVqHv4THNLx9JlDJRNeS26mdlxvBLjXBHSVJAq2n4hDh/m9as1LFvqoRHAtFZmBv bm8tRNzBtKdTXnfOvVhUyvnCy0irYlQmTbuPYEVl2TPJB0s2V7V+ZhxTZKzX03mKrvsW a4YFkCi8jhk++IdKZRyuxRgIyrdaEmTIqhk2Fu5wVi+UiPUyCThl7cozXAUxQm4BAbZI MWNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=6Ts19aDh9Y+uEYtwA159YtXFlbdYpuc2+dTBf9e+tLA=; fh=io6VJuNrc9fIDhLXdVzSvtdNVOhxmUrv8yUeXx2PatA=; b=WoAuwFFIfOxruTLfAyOR0n6sIwfsTGtNk1QQwIbHQiK3upMnjEO9tvwASPIn4Ve5ZY 4bVU8GSlNK4wcrBoMJWOuGn6YaGMmuZR68NasOiN0gZqcGaXqNLHgBytzwiR7dRY83Qv rr97abfTr/3By4Z0/7QXF188pLFhwYMx4vH9VeAUPenCnYzotiwbuo0L3jF0CW4oxNWs oC5QRktL1h/nCnoy7rtRWc29dhSzW3B2MniTKn76yviraT1uk/9ZRSnWrqSruo9v8w4x /baSy8tk4kr6I1BJyn6g/FbOPcuztGimPWfBvj3T/JjVQjPCQxiLamiQ033B0E/yNZWF WXcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OBtUPpvz; spf=pass (google.com: domain of linux-kernel+bounces-6810-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6810-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b8-20020a056402350800b0054cae753509si11736847edd.412.2023.12.20.03.20.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 03:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6810-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OBtUPpvz; spf=pass (google.com: domain of linux-kernel+bounces-6810-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6810-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 713861F225EF for ; Wed, 20 Dec 2023 11:20:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9A1221363; Wed, 20 Dec 2023 11:20:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OBtUPpvz" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (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 2EE3D21346 for ; Wed, 20 Dec 2023 11:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-dbdabb23e91so243610276.3 for ; Wed, 20 Dec 2023 03:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703071220; x=1703676020; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6Ts19aDh9Y+uEYtwA159YtXFlbdYpuc2+dTBf9e+tLA=; b=OBtUPpvzJcOjCdf4UgozcJBzxizD68+MeqormSinuYZqaZPyDZygMX7q/6w+Tx26B3 8m3wkVfbUJFpEYGKYjrgCntbCxASogSUfQir5Komc18HZVyNnKq9QKUxGrmrcHu4zyeI qe/++YtyUtoZmXL6TTKtplCvQ2bWtPx5L3TnT39RMQEdKFLxDitbWNPHCzP2bWskym91 apn5dhBzPvaaPWR+8ufHDXZndMQphThwYy+RRR5VVo4ZHJZc3cZMCpsfvSpLSdhO048X qr7GHdlKls9zD3ZGNwTxL2w78a3qOvB41v0+FvMIi5ICs/wEeSDw9OleHEDD57U42Yyh RvcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703071220; x=1703676020; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Ts19aDh9Y+uEYtwA159YtXFlbdYpuc2+dTBf9e+tLA=; b=M2tJA1MMuHx3FbLrOZ9clBQiKhJzx2J8Xr4bpT3+BnbHfEOhu58AaWEEDpVtMQ/97C EGEoO75u4ezjH4a4LV7QQHRQwFagOThiyAKcbx1/fpS9W2mNitNVzPker7xH7HaiYrw1 IOVEX7DPYQvaXKF+z566OWoJnmJE2prYTvXiVtlyRKiU2W3MaX//D/JhO2XwG2RIYUbF AfVkvl6MwIKfVnQ1N3FBK5xDP2sxhyJl0X97d8R3x+gdc9WWUWeF03wQL2t/T3I0z3gg pDyk+fsH7U1anT5AffB8VxdWqj6i+v328tidOoPu7TMYiS+/1Gix4z5kJqx+gUbigGvf ou0g== X-Gm-Message-State: AOJu0YxyQaymW5BL6kxfyQ7dZ1BHs4BhujLxfG2wUfRfy+qy8qHgYSml s+Gjv4SksJlQZSpFjjXQfxYkKMwDn1yu6UTGjRQ2TM9HGrm+mt3J X-Received: by 2002:a05:6902:531:b0:dbd:6584:ca3c with SMTP id y17-20020a056902053100b00dbd6584ca3cmr1126598ybs.35.1703071220041; Wed, 20 Dec 2023 03:20:20 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231215155300.21186-1-brgl@bgdev.pl> <20231215155300.21186-3-brgl@bgdev.pl> In-Reply-To: <20231215155300.21186-3-brgl@bgdev.pl> From: Linus Walleij Date: Wed, 20 Dec 2023 12:20:09 +0100 Message-ID: Subject: Re: [PATCH v3 2/2] gpiolib: use a mutex to protect the list of GPIO devices To: Bartosz Golaszewski Cc: Andy Shevchenko , Kent Gibson , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 15, 2023 at 4:53=E2=80=AFPM Bartosz Golaszewski = wrote: > From: Bartosz Golaszewski > > The global list of GPIO devices is never modified or accessed from > atomic context so it's fine to protect it using a mutex. Add a new > global lock dedicated to the gpio_devices list and use it whenever > accessing or modifying it. > > While at it: fold the sysfs registering of existing devices into > gpiolib.c and make gpio_devices static within its compilation unit. > > Signed-off-by: Bartosz Golaszewski Excellent patch, and a conclusion of the previous discussions on this. Reviewed-by: Linus Walleij Yours, Linus Walleij