Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1360289rdb; Wed, 20 Sep 2023 07:11:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFzK2lQuG0Jz4sZh2+h/YUb3shwqLK7O4Vu5mcrqfMNb8FLsnB9nVQX4pe3ZsayIhyUgr5 X-Received: by 2002:a05:6a00:2389:b0:68b:fb93:5b4e with SMTP id f9-20020a056a00238900b0068bfb935b4emr3101529pfc.26.1695219094086; Wed, 20 Sep 2023 07:11:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695219094; cv=none; d=google.com; s=arc-20160816; b=WWjKG9yA3TlJERQ3SEjDYgZAyekII4DOSn4ua/BDVyGqTKXj9jUOFfYlX9yuBaw0Cg a/4o+QFhrvfpYvY4XJZFFAJa2KsnMgSK610n7dBEC4pF+vV/l9NUlK0Ybj9hKocf99Pt fHvYpPoruLqHjG7ypFkPkz5qCzLE0f6s6OQy2LPpUySqx37ioaE9BwgJKVQVVIsARHsU XmyThDwCEs/ciz8oVNXiDHS+K/PQRnRYwZqfs7DIoIYK/aSZ2VlSh4Ys+uGWzRaSegkI r822UH2f+1q6F2eGqvJIFl9L1D+XfhtaMVrWe9APOGwcIag97TXurlcX/+sXbU0e81MX +lfw== 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=Vty1xIk4CuQ2B/P6eWEQzTFddTHFTE+WpciZ+JlL/14=; fh=ZCbnr9gO+hyRsVYSYNC1zobm4/NcYBDlrs9F3jIrpX0=; b=jceOZbwQ5imp6YSE3Cz70cuPAzU+Rw9FNmAs6avx95GAFTiK8UKKoyvuqLtVYoZTtA fRS0RNerEYeqQn9BgZBNZAiJt7jJW9ZuvRWn4ElXimpi1rMts5EWwpWgZlWWlv0nmOkd fBLem8IxItPrCjjlE2SEuDptbZOE2X6B9QS8qKzQL4PzCngQsbMWZKJXKeOru5CGihMK 7zK3gNJtDOqWfX3J5hOE9F9Ji8zbPydswAxCdGa1PR1vmrlEzIDj3dE+Cra6IzOgy3Og DUvkRyLQn84WTp0x60aYPmAm60nBAJ4UK+kHRhnRnNVtsl5cN7zsn9V2V1KKdfBkHodA L2CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JLGNhH8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id l2-20020a635702000000b005648d20203dsi11975492pgb.233.2023.09.20.07.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 07:11:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JLGNhH8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 179B98293C92; Wed, 20 Sep 2023 02:13:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233953AbjITJNS (ORCPT + 99 others); Wed, 20 Sep 2023 05:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233556AbjITJNR (ORCPT ); Wed, 20 Sep 2023 05:13:17 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4874BF0 for ; Wed, 20 Sep 2023 02:13:10 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-59c0d002081so50650987b3.2 for ; Wed, 20 Sep 2023 02:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695201189; x=1695805989; 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=Vty1xIk4CuQ2B/P6eWEQzTFddTHFTE+WpciZ+JlL/14=; b=JLGNhH8eye5BhP1iINvONB8EcYkisgTJoAzehcfrM8L1AutSnq29VjZ0MZC24b3Puk lW3wDCGFRtFC60m5V4BGHZnBuRkrWCoCaQpxeaiQTsRLpwPoQbAUp72rss0rms5IDc9O MMaQMr6b42pp6KV3B6y8ql9bMB/LL/aAlUmDOAqMoV1cUDoWQ9ebgLlY+hzzcv1ERURi ho2fBqhFk8VNkSKBVvs1F9v0VrpnMcoMzRI12SdsJyUri+Gfd6xHTXRYGkjeKoComQuI iAUnl6Aun925mIwMMEtpnfuSrVIw+iPUgE9hySnWxpVmxreLjJIoGLcIguvdpj/ztl9g DTzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695201189; x=1695805989; 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=Vty1xIk4CuQ2B/P6eWEQzTFddTHFTE+WpciZ+JlL/14=; b=wbQqlhR56pFgDw7GxUAsfYoDYsR/uISBcy6Dbekf0DY3CzkAv9xROz/zm5fWZUgSBQ ovpiwT13cMUOTGVNIneuI2xeqSeLVTpJN9fws7IlZVCYMIuayzKkMiivUnqIWVsNBtvZ PM4ZeZ7FmS+ropZht9bmHuldnEk5u0TiwA5lCuxgUmniGSxH+ffi7G2EvxFjFQookqWV gT5Op3zjRpXWxt/ExIA/4XebrGTgiNs82Eo811FNsYO0reYA1zK6v4Oy86c0FDjGQWfI jfMC7ITZ95csMedhia7wTK+6GFmArVaXvinHs3EYckJ24ct7d3eqD/uLcqvNqqqs9j01 wjUA== X-Gm-Message-State: AOJu0YxiKGIkh50yc6R/eaGoyGzoYow7SJL/63jdERW9OHa867ngsaGI zgs1bAvMDEFqtCweYuTk65xpk43fRX3yOcluooi8Dg== X-Received: by 2002:a0d:eb4f:0:b0:595:9770:6914 with SMTP id u76-20020a0deb4f000000b0059597706914mr2133189ywe.35.1695201189141; Wed, 20 Sep 2023 02:13:09 -0700 (PDT) MIME-Version: 1.0 References: <20230920085639.152441-1-brgl@bgdev.pl> In-Reply-To: <20230920085639.152441-1-brgl@bgdev.pl> From: Linus Walleij Date: Wed, 20 Sep 2023 11:12:58 +0200 Message-ID: Subject: Re: [PATCH] gpiolib: extend the critical sections of lookup tables To: Bartosz Golaszewski Cc: Andy Shevchenko , 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 20 Sep 2023 02:13:21 -0700 (PDT) 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 using > 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_lookup= _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? Either way: Reviewed-by: Linus Walleij Yours, Linus Walleij