Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3911764rdh; Tue, 28 Nov 2023 07:06:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGayBfpKanTU3kuxuALD1RCFgsnQWHX6J5NLGP5qDxO36oxQ8iuVvywotxmn/E5O6PsnLSg X-Received: by 2002:a05:6a00:a87:b0:6cb:d2cd:212c with SMTP id b7-20020a056a000a8700b006cbd2cd212cmr15696258pfl.13.1701183990837; Tue, 28 Nov 2023 07:06:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701183990; cv=none; d=google.com; s=arc-20160816; b=EZU6ffNDHb27HK5Zl3XowlHDVRvgi2zQppcla88dC2CGhycIQTM5BAupXJ7iGqPQQ1 SkoQW73KK0a1fE9AYpL9+QoIhxRfYgQGcTtur8Kpa1xbnEjidOtaI+x/jlmKbbyolwrO vEPuH79ZZkZqi20P4Aop6JwCtjyrOhsJl5NiVyc2Ss7pjEK0+EXV4VOFZELTm9JG1X7A U9xJIQYpJ6y+9RAAORDCcBhj7/wV/D4vTP2MwzRweSA1Q+HrgFOaiv7Rh7MAtm4PnLOy w0zdWcOvsBYJPxqkHLBKoeDoyvLSkr1mG5KrCzFO9t9l84zzhdm3otnWf+LwRzPkUg8b HoGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LNbBrvCLKy2IUxXzcxy/eNfeZ8Ee6bkTl+4EYxHiBPg=; fh=io6VJuNrc9fIDhLXdVzSvtdNVOhxmUrv8yUeXx2PatA=; b=LhbPh56usobf1JtqezaMbnXIuMPtipABzYXsKcGXNT6NguDlmWxTx30bH2rX9ItSgj B8xDXfArjqlN55JNnvHFmyxvm5+qnX8rcaSE7uKSLtTzm2KHliWCx901Q/ptvKLz+ngg tfjOUIrXrqOzCkcEwBfLFIsnl2A/lqFDohbshoVuqMtej1lyX6wAsqbfXaTlwwAT9jIU aRicXR2tpMqZaftD7d3Q2mgo20kewuTQKDuOKGhQXW6nJQ8oJHM5qQKbYfNjwOY9qyFr 1V/gEcCaR9i3wNPeeR5OaAzhp0hhoX5PVUxfXgK3SBZCL3K0Tp7jz7dLWXZ+FbF0vL8i E+8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ax9MSrK9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b25-20020a631b59000000b005c1b2ec799fsi12596520pgm.469.2023.11.28.07.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 07:06:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ax9MSrK9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B67F180A3127; Tue, 28 Nov 2023 07:06:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346571AbjK1PGF (ORCPT + 99 others); Tue, 28 Nov 2023 10:06:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346561AbjK1PGA (ORCPT ); Tue, 28 Nov 2023 10:06:00 -0500 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801BDD45 for ; Tue, 28 Nov 2023 07:06:07 -0800 (PST) Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-db498e1132bso2849718276.2 for ; Tue, 28 Nov 2023 07:06:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701183966; x=1701788766; 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=LNbBrvCLKy2IUxXzcxy/eNfeZ8Ee6bkTl+4EYxHiBPg=; b=ax9MSrK9c8D3Gs3u2D2tPc7kgq2HKa1MSUYM1dIs0qL5eEaU2L3RaKB7g+FshL4EsM Okce6hiKkH8z/B2hnENOSlQgtk+5XkXO85ocSbkphEacQRb8ip/jAOoQLq3TR13eGtFl W/Pe6VGyTsmGYE+DyczJMog0e1BLBcY5eLOMtwcUjCWElwCCeutSY7xrZtp0+4vlUGSS Fhw7S/9OsBsUOU6O0fbgXCZ6BY9G4XNwbu7wGKtBXdTZ//avYWyz1dL3ECbsNgIoYV1p BFN8ZEj5SFjwnNEo5H4FaqF/BInUeGSKrblWZm7OWikwN0LsrLM0pHZpyW+D+BOBxWWO WEsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701183966; x=1701788766; 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=LNbBrvCLKy2IUxXzcxy/eNfeZ8Ee6bkTl+4EYxHiBPg=; b=qKEOSkZ2XM0idc1HMg1qvVqOKDjApzuh213eLe31BX4hOjY1cK0U+xuoFXZPH92ok2 DVdxQ7mVmgHr4ydJP+TZbvzfnSeE4RIe1AbvIvTUIqCMC9VkGS/NkmzAMBn4S7KMjUzq LbaOf51d0Zr6JQzFm51kuiV6434gN2WfHT8U6IRDQmtY3dreS/ltRVCyVU5WHBo7bZ4N ybcVHWg9vyY90eeebjMPcYDlDjlcYjP3U0vVchrMwSsKmSMH3jV38JbeZwlO0py4+UHy /ZijirErBxtjxDXBmoQYm8gLPyxJ+BVd2IzF9vCtQZXy6x2UkoLwN1e5Rsb18G/zW2+q BN1Q== X-Gm-Message-State: AOJu0YxgfTheK2zp8fqayMA6Z4eTCw1aYxxSGDjkk4a5+N3D7wQOmLHF sKnpLzeYVONRAc10jE1JwJwM4dZsPhdU9Qw1kcJH1Q== X-Received: by 2002:a25:3795:0:b0:db3:a317:3e9d with SMTP id e143-20020a253795000000b00db3a3173e9dmr15023586yba.61.1701183966065; Tue, 28 Nov 2023 07:06:06 -0800 (PST) MIME-Version: 1.0 References: <20231127193716.63143-1-brgl@bgdev.pl> <20231127193716.63143-2-brgl@bgdev.pl> In-Reply-To: From: Linus Walleij Date: Tue, 28 Nov 2023 16:05:54 +0100 Message-ID: Subject: Re: [PATCH 2/2] gpio: 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 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 07:06:27 -0800 (PST) On Tue, Nov 28, 2023 at 3:52=E2=80=AFPM Bartosz Golaszewski = wrote: > We don't need to lock the GPIO device or chip separately - the > descriptor structs will stay alive as long as there's a live reference > to the GPIO device. GPIO device will have an SRCU cookie for > protecting API calls against removal of the chip. > > To summarize: one mutex for the GPIO device list, one lock per GPIO > descriptor and SRCU protection of the GPIO device's chip. > > Does it make sense? Absolutely, standing by to review, it's gonna look awesome! Linus