Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1363442rdb; Wed, 20 Sep 2023 07:15:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdH3vqzWJXgpmpP77fto4uSSrmYRXJgIht6S9RFFwx+qfz/pToFECvzReaTfxuNRQZPoBH X-Received: by 2002:a17:90a:ca0d:b0:25b:c454:a366 with SMTP id x13-20020a17090aca0d00b0025bc454a366mr2791332pjt.5.1695219352942; Wed, 20 Sep 2023 07:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695219352; cv=none; d=google.com; s=arc-20160816; b=S2MeNV3yA3nGX6fVY/06A+BH2sHIBNvxNyMKh+yV+sGejMBl4xBI8kDtBtKloTJh0z pBY128S9/pJJdcoTV7ltqCsehGpTS/ou0Nl0GKYD53fvLJlU8jcT+P3V/9veBIrJggUP 18amFeKl6bNPJnqL+TIGh4qIZlfFy+VjWEuR8RcFSyjOl+lnmxjDpgPFV05chBT3Ad6z Qy/3+XMTavw4a7AGJJ2z9kAvhOcKs42MSD3VD9XpEfJQdv6rHfxHMU2494OAKD5la/9o myfzv0n99WEiZ0L91xYhXX3S5fZZ4BMK9uZ3rFx1L6wWU8sN5x/JgM2/cgQFd5swbAvf hu1Q== 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:references:mime-version:in-reply-to:from :dkim-signature; bh=nfNqK8L6q1PlFEDhklDZAwbggIZ8KkG1jYC1QEAOeOw=; fh=TliOclcX+iASwraFXA368rKc0I+PbUzoNOcoodApUHY=; b=LMoFxG9E1vdsYEvYDCO2kZ9cQbMWoGVTwEUFsLWTHU/AgKqEFSd7b7sIKKJ6KqE923 3FKDLdJf928okanAHqLHq5TJR7FFhElC5h62zqeFSFkorqRUzAtlFJgpZfZTHD8r6Bby 7kb40hyZR1JcumewCsc8Cdt5DqumpP7UXXFBc66loSAqeHqgMLMA0F02cl8LnvYvT+Tr Qthjhc7h1nR7Go7i3Y706mrnp+eB0jHIS8xHut32t33y/ihc62xtC6BluDmzSqRRaRja 5ZcHAwXQwviD1it/Nx/GPy3Y2zVZNMLDstppIQ8S2Z8BpATAG3uD664ktVeqMW2XKRZp rk0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b="Qc/RZnL8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id v11-20020a17090a898b00b0027383ac5ebcsi1644882pjn.130.2023.09.20.07.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 07:15:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b="Qc/RZnL8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 15F028036E92; Wed, 20 Sep 2023 02:33:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234173AbjITJdN (ORCPT + 99 others); Wed, 20 Sep 2023 05:33:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234093AbjITJdL (ORCPT ); Wed, 20 Sep 2023 05:33:11 -0400 Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ADD293 for ; Wed, 20 Sep 2023 02:33:06 -0700 (PDT) Received: by mail-ua1-x932.google.com with SMTP id a1e0cc1a2514c-7a8b839fc0aso1262078241.3 for ; Wed, 20 Sep 2023 02:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695202385; x=1695807185; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:references :mime-version:in-reply-to:from:from:to:cc:subject:date:message-id :reply-to; bh=nfNqK8L6q1PlFEDhklDZAwbggIZ8KkG1jYC1QEAOeOw=; b=Qc/RZnL8jExlx7TEwzF61YWwIL6Jh0gGwreTZ3eUic1Le/NQuqGnwxIXq24UIzfuFn J8z+fQVDDlTqG0qRC06JdB76MczdWIuPaDpRFRKzBuarKrohH/09/UkhPGtiIRQ/SHSv 9n8BYo1h9pHSURW7aue4n7i2pp/j5gwot3vmSbvbkgs4BBU4sSJysogbsgRolrv63pMq uw0FHLROq6Zfnu2ZjwvKGRY0u/ML4ZOhOxUv3g17S579BM+OZSmUoeEzKfiNCGDjeXgv xTPvxzI0/rC+HvH9XthprxZmBz5OvcQgA+9V+GBlOn1MWl12R09tl6k438ElTC+OF/8C 5Cjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695202385; x=1695807185; h=content-transfer-encoding:cc:to:subject:message-id:date:references :mime-version:in-reply-to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=nfNqK8L6q1PlFEDhklDZAwbggIZ8KkG1jYC1QEAOeOw=; b=pr0r23mEwqxmaeXpuo9oOaAyXet+rTwIHnUMXLhlCHHeqcnIgjrl0pPOAFq2zPzvhW Nx8aHf3FrbIz15KSPDu21lQ/jeB5l21AQGFciQ1FO8xCTJO58dPTYZct0R5j/5OKWlC+ y1Jr6qJCrJm3uWeoTjkoRd5HantArkf2pRV/ESe8T8Yu0VJ0Qs7ztgFzI1PPpbZkPoNH rbcD0AunKqDVTHsZnpxjbPUSxUnaipsEcmSezrgCurTo97vsi+BkOw0I7kYJC3akKus6 FWPZh4ETVET0zqnqZjK8ghmORCI/OeJsGLgFAyDcbBGvlCziK4suVY8qyDF7EY34nrI9 FmFA== X-Gm-Message-State: AOJu0YxCLRdi5QLbOS9cW9ojGtMuKsdxzE5pHKWXPHKq84b2Cim3ssLZ /vts4UAJ/pBXsgNkdcRxGTWWlwMYslABTZ4rXi6jmg== X-Received: by 2002:a67:ebc1:0:b0:452:6fc1:a3e5 with SMTP id y1-20020a67ebc1000000b004526fc1a3e5mr1806673vso.1.1695202385114; Wed, 20 Sep 2023 02:33:05 -0700 (PDT) Received: from 969154062570 named unknown by gmailapi.google.com with HTTPREST; Wed, 20 Sep 2023 02:33:04 -0700 From: Bartosz Golaszewski In-Reply-To: MIME-Version: 1.0 References: <20230920085639.152441-1-brgl@bgdev.pl> Date: Wed, 20 Sep 2023 02:33:04 -0700 Message-ID: Subject: Re: [PATCH] gpiolib: extend the critical sections of lookup tables To: Linus Walleij Cc: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Wed, 20 Sep 2023 02:33:27 -0700 (PDT) On Wed, 20 Sep 2023 11:12:58 +0200, Linus Walleij said: > On Wed, Sep 20, 2023 at 10:56=E2=80=AFAM Bartosz Golaszewski wrote: > >> From: Bartosz Golaszewski >> >> There are two places in the code where we retrieve a lookup table using >> gpiod_find_lookup_table() (which protects the table list with the lookup >> table lock) and then use it after the lock is released. >> >> We need to keep the lookup table mutex locked the entire time we're usin= g >> the tables. Remove the locking from gpiod_find_lookup_table() and use >> guards to protect the code actually using the table objects. >> >> Signed-off-by: Bartosz Golaszewski > > I convinced myself that this change is correct, good find! > >> @@ -3822,8 +3822,6 @@ static struct gpiod_lookup_table *gpiod_find_looku= p_table(struct device *dev) > > Can we rename this function gpiod_find_lookup_table_locked() > as per precedents in the kernel, to indicate that it needs to be > called with a lock held? > I think you mean gpiod_find_lookup_table_unlocked() as with this change it will no longer take the lock? Bart > Either way: > Reviewed-by: Linus Walleij > > Yours, > Linus Walleij >