Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1249259rdh; Mon, 25 Sep 2023 07:24:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1Fl1Q7VrJZzEDVZtUTleHaQFrALiZsKAraJy9hbduOgFhCOTpBfbH5gOIrdxrChFZVzmP X-Received: by 2002:a05:6870:c227:b0:1bf:787c:411b with SMTP id z39-20020a056870c22700b001bf787c411bmr9411252oae.10.1695651886208; Mon, 25 Sep 2023 07:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695651886; cv=none; d=google.com; s=arc-20160816; b=y1NnUoq0j38k4ci9BARRZ6BMaZthCMoTgrK0XsZq2yA1+dqPLH7immrkz3JALXmbf0 eZ+SJulLiXZhhdR44yfZDRt/2eUg/+JMcXnjJYOG0Yy4P4rzHFFNPpuBlFwZkc7VxJZn 3hbpRLZro1phUgSziuQ6zmfH1uTe9swSma4mmw6KMGpCOOmABwTvtifENBuQSaJA8P+y jBwXFelRy1zPoOfjrgOyeqJIyJ7rC5TT/B5xU5Tv/LzgXgHBhzO+gP1BG5pd31SluXKk 6uqPitwBhPli2sHo988M3xCbcNwmMNPYMOaAMVBD+RqD/ag4SREPOVt8sRSqvtmvZkwZ xdOg== 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=sqqxusyY5ypWGs0jnrBogjXShcemFzSc0iU4IU8sqCE=; fh=+qzbUX1Cy1vKSroLUfYHXeWipfITdGkBg/2KVg/tGCU=; b=J+XfE6wSc7YETPtJa4yfvxk8Shm+9OEDGD8+Og68mwLxqBLbicKxlCfvZomqCv2dBY 6iFkDwfU2jwDSRO5tIzwN/sB6fpvCEyUkAVTQfk5XnJ1YF917+EIADjAXkMMrZID96iP +rnIV61RpNa7YZMS/XnBTDO/Hpafs869op6om6YM5pavduVk4TVuFArcdR+OiFYt8Vyp uQEecUHf+SGVQx8SxbqxwNGH1+Zs1+GnJSeVIJU+yWnmK823axAAxGXJCrE3k4oL8m/M zldmuKqwyBISD/criMMqLUThJObGwAYRlVwvsaWaRkNPa+VrLMCNT0iCtEG24UQJ4LUS evIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=sdsVE52L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id h11-20020a65480b000000b00564a1716ebbsi10107110pgs.697.2023.09.25.07.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 07:24:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=sdsVE52L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 88144808BE6D; Mon, 25 Sep 2023 07:24:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232174AbjIYOYp (ORCPT + 99 others); Mon, 25 Sep 2023 10:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232241AbjIYOYn (ORCPT ); Mon, 25 Sep 2023 10:24:43 -0400 Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9D12103 for ; Mon, 25 Sep 2023 07:24:32 -0700 (PDT) Received: by mail-vs1-xe36.google.com with SMTP id ada2fe7eead31-452527dded1so2562511137.0 for ; Mon, 25 Sep 2023 07:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695651872; x=1696256672; 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=sqqxusyY5ypWGs0jnrBogjXShcemFzSc0iU4IU8sqCE=; b=sdsVE52Lr5f6aIu75J4lPL4owknwLFQ4NTyUAQghb6pQ2PVwRXc0oQw5S3zs2h146h DrrdB67D0t+koY+bP5UgRyBkDDyJgn3tJSUFTaLAD3NaBfDqHeD69598w2s7VSmvm83S xiQ63PFW1OolQbeCDj+U07AP6TNh8MRc43h0Fo/+Zqo0fwD879cJK/HrVjrucdmaORdL sEhufOr7V8BF5+JJGj9ZbFNO+sa8tONArNXhQN/mZrHqpXN+skb7J/eusEP62YbwVsUR C4a6nvNOjWcUFue0UNyegCrfHgKLlTI9Fl+BGFDBKrNByyJl1VFs+XmJWYQ7MDrcksUR PQIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695651872; x=1696256672; 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=sqqxusyY5ypWGs0jnrBogjXShcemFzSc0iU4IU8sqCE=; b=HFTdVdWW2U5v9JkH+Uh8NF8BeiaIGUbk55FsTdn63KRxtwquFj9WSEqTacbB8iSG3q RrKLJFojNxRAWGkSbw5gJ9dTg0UjY9evVePbvYY/Z/tDCEsnwj0HUf02g0GCrxr8Mpm7 4wte/rfs8gDjFcZFvNumlhFD3M8KqOZEnUZJjGJrDftFdd2UrAoMhN62JQn0EzzxiFuC X0MnM9LDzyLPWSY0BYMM8B37rhh8qCDTExiL9+I+yO5I/Rv0KdifoHwQq7kTIzvaZdAJ UP7nCluCr7DhvSKmdPSbH0/4EdsS8oud2DhmhowpDwGIzISYDglhLAEbYEHoRf0a10Lf zs/g== X-Gm-Message-State: AOJu0YznKAX6e7RoIfOiCsj+huZUm2q7F6jaAo8VNCZuBHwemFeIYwOl 2dViiu0KnWQZBy2Ag92fH/VxoTavPFy8GurjL4A+ugjVS0e9IWze X-Received: by 2002:a05:6102:191:b0:452:c0bd:a6b with SMTP id r17-20020a056102019100b00452c0bd0a6bmr4603589vsq.21.1695651871989; Mon, 25 Sep 2023 07:24:31 -0700 (PDT) MIME-Version: 1.0 References: <20230920085639.152441-1-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Mon, 25 Sep 2023 16:24:20 +0200 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 25 Sep 2023 07:24:43 -0700 (PDT) On Wed, Sep 20, 2023 at 2:51=E2=80=AFPM Bartosz Golaszewski = wrote: > > On Wed, 20 Sep 2023 12:58:58 +0200, Linus Walleij said: > > On Wed, Sep 20, 2023 at 11:33=E2=80=AFAM Bartosz Golaszewski wrote: > >> 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: > > > >> > 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 chang= e it > >> will no longer take the lock? > > > > I think the pattern is the one I indicated: *_locked() means the functi= on > > is to be called with the appropriate lock held, cf > > arch/arm64/kvm/hyp/nvhe/mm.c > > > > pkvm_create_mappings() takes a lock and then calls > > pkvm_create_mappings_locked() which even asserts that > > the lock is held. > > > > Ha! I always though the pattern is to call the functions that *DON'T* tak= e > the lock _unlocked(). This is what I used in gpiolib-cdev.c or gpio-sim.c= . > > I guess both conventions make sense in some way. > > Bart I don't think I will be doing it just now. We don't use this convention elsewhere in drivers/gpio/ and we'll have a lot of locking reworked soon anyway. We may get to it when that is done. Bart