Received: by 2002:ac8:5349:0:b0:427:7d78:cd45 with SMTP id d9csp814128qto; Wed, 20 Dec 2023 04:53:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiLDA0FkeknkW5brEqhO7LIHQNX9JSGf2AkqFdczo1gSaqpp9JigMSqKac7RXdL2+zloO4 X-Received: by 2002:a05:6512:220f:b0:50e:44a8:6628 with SMTP id h15-20020a056512220f00b0050e44a86628mr1275496lfu.103.1703076810606; Wed, 20 Dec 2023 04:53:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703076810; cv=none; d=google.com; s=arc-20160816; b=AqOpAyp0ZMWezm/CVK6n8RzKwwOaD1f400j5G+hmxQecEzf/p2NWKIxDjFmvP9GN3y aYyIT7MWjTaBbyVzGdadfX72W6UcaDVhCNOBrtND4zen2vxiwSnfytY5n4bQ1JciEIQC iTJNNEbbqBdUozngafO//1R48MKDO1IMnpLDEcvZXaofAeX63veGndk11H/g/n+1AE2L Lkb/BwobDHyrfUfVK1se5fibQrKIG7G/0ayRNLtiU/rFFhbUHQY/GBZhn0B8+nPkWK1z buEd0XT/Kta3lFl7pux9r1Lne/iLDqwo5qqIN8XJgQrgKcEQHt1Z59WZKjCuOfVAFTsL tX8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Pu8CMU1xj5S1tt+nhGWIOxnMNYsHDR3R1vbW4Tx+XZQ=; fh=2Hmk2+MVViEF0KjzxYUiDLGjhYOS+yeUz+iu1Qazwnc=; b=DOhpEK0FUgyZVwMMaVOMYIub/76Id3UiM7lbiHQ7OwtoKHV386NFiiqNEcxNU8i1Md QV8186bXZNdzBpjYm0xBd2ImvIiEF1bVN0bDUpoW5TSDKRJfBDlLllXkPWkj1SpHySK6 WjlRxu67HKes8ma+GjaWTwf3GZwchRwVQegwdpe/sGncXb2xeyUZiBx42zIVLCVe53qs sstlTaQG2B7rGQO3a5+gfUstML6VnE5sqji+JuC7SWS8dayZjeOCi5DwDQRnemZeHwXt kdkBcnrnw6PUdHIC0PpB56+NzBpPRbQwhEPW1p8JO8rFRG6KXKtFrkzvy5VlljDxiBjc b27w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LmpEuSg1; spf=pass (google.com: domain of linux-kernel+bounces-6920-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6920-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dd20-20020a056402313400b00553f03a77ebsi281772edb.13.2023.12.20.04.53.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 04:53:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6920-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LmpEuSg1; spf=pass (google.com: domain of linux-kernel+bounces-6920-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6920-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 3D4641F22C5A for ; Wed, 20 Dec 2023 12:53:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0AFED25545; Wed, 20 Dec 2023 12:53:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LmpEuSg1" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 25C592D612; Wed, 20 Dec 2023 12:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d3eae5c1d7so4756445ad.2; Wed, 20 Dec 2023 04:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703076800; x=1703681600; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Pu8CMU1xj5S1tt+nhGWIOxnMNYsHDR3R1vbW4Tx+XZQ=; b=LmpEuSg1s65xBah0P2p5jhGetQvOUSFRpyiKEKbAL2tetG9NWbwkxY11W6zc+A6vWU xax86P7aYUiwjyTlkcPnlXDhG44qSNRvkUPMyp8/LJrBKKFD+kohYn4HnmLZCsg0DNGz C//2nwjsvhSG+dv9h5PTbh+OqGy0S/DUZaZ7BYTdfJQlMmkFkxBxMS0KoQ71ovKFR8zr t4AKjHryjNeR1KX3Aw6Qpi9nNNEouf2XSq+r7W5h+17FjE7NHQg0HhYfkukOW9zW6bFj NE85p5emncSdrGDfiCb1Z6QryB3qf9y7PNRyYEmRPUI2RiXa4GLiAAJYKmwnEqRWZZod 9eeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703076800; x=1703681600; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Pu8CMU1xj5S1tt+nhGWIOxnMNYsHDR3R1vbW4Tx+XZQ=; b=b+F7BbWYpanqc5zqurK2yiP0wOErVJTKaPvwNP6MfGNMhBFyeR97IpK/Rd9RJ3tBj2 ySs+pHjUGxIuMviniOnSj0UmZZmg5NrESs3UDD0jSgWPq5Pb8YcxME0BxUw860/766jS 3/EJlvvve2zMMtk7EhP62WQNWhm9aCDmjTfZ7XJJjP0a7p8uKXzFz6Cliwa80+mKEIdL xdhLbmeoH6TL2ZIIWSCs/if5G4pdfgM95hVPVcJfz9SQ/ZKOm3PjYe3y4DwBAReQSrn/ e6VWxQ6DfRvWNH0XSwS1ZNIsKxzn2iX4Uum2sQ+3hAafxZtjnxhoFlwWTAYeNGj+tLg5 LOMQ== X-Gm-Message-State: AOJu0YzscyOjzizwmnVoCUkQhqnnAGwywVhqO0oXrxfdHRwE/vZbijCy vI6A/WOvcz3lJWjVcpSKnxLwebHflhA= X-Received: by 2002:a17:902:e80b:b0:1d3:c21c:9400 with SMTP id u11-20020a170902e80b00b001d3c21c9400mr3354182plg.40.1703076800268; Wed, 20 Dec 2023 04:53:20 -0800 (PST) Received: from rigel (60-241-235-125.tpgi.com.au. [60.241.235.125]) by smtp.gmail.com with ESMTPSA id ju17-20020a170903429100b001d0cd48e08fsm1295481plb.179.2023.12.20.04.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 04:53:20 -0800 (PST) Date: Wed, 20 Dec 2023 20:53:14 +0800 From: Kent Gibson To: Bartosz Golaszewski Cc: Linus Walleij , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, andy@kernel.org Subject: Re: [PATCH 4/4] gpiolib: cdev: replace locking wrappers for gpio_device with guards Message-ID: References: <20231220015106.16732-1-warthog618@gmail.com> <20231220015106.16732-5-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Dec 20, 2023 at 01:30:57PM +0100, Bartosz Golaszewski wrote: > On Wed, Dec 20, 2023 at 1:23 PM Kent Gibson wrote: > > > > > > > > > It would be read and write guards for the gpio_device. > > cdev would only be using the read flavour. > > And possibly named something other than read/write as the purpose is to > > prevent (read) or allow (write) object removal. > > > > I though that would be clearer than having to reference gpiolib.h to see > > what gdev->sem covers, and allow you to change the locking > > mechanism later and not have to update cdev. > > > > I still prefer open-coded guards here for clarity. I hope that with > SRCU in gpiolib.c, we'll get rid of locking in cdev entirely anyway. > Ok, it is your object so I should use it the way you want it used. Btw, before I go pushing out a v2, do you have an answer on whether gpio_ioctl() requires a guard, as mentioned in the cover letter? Is the fact there is an active ioctl on the chardev sufficient in itself to keep the gpio_device alive? Cheers, Kent.