Message ID | 20231125-dropcomment-v1-1-15800415aae0@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1607492vqx; Fri, 24 Nov 2023 15:26:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9DBVZ+izb0t/JSPXzneURXnT7fmtjcdqPDsMRbtMSdkgwMiBl6PrliIealJ2Ik2fk/aVB X-Received: by 2002:a17:902:d88b:b0:1cf:7666:4dd0 with SMTP id b11-20020a170902d88b00b001cf76664dd0mr4444737plz.39.1700868362831; Fri, 24 Nov 2023 15:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700868362; cv=none; d=google.com; s=arc-20160816; b=cq1T3h1C+1FhVJOTtKQ/UpNbxcdoeVkLduojGespwfOqhYVXweUJl0DNWxU6e6ZTjE 3nEP7aBWq7gMz6MMaDk69ctfvh6fhFKHThcyQGH6HERb84vhBenrGNS4dajPnra1Xbpp NMKPJeGUXv2trYZcIMeGfAC2aqJjoo3FqtHm3kWxR2HDyqjv4Ol7qWC4HPZTZNo5+ClD qM0XOVgtXXeA2y3fYVOM0ryUfbCBoYyZMMdlVDGe4+OdVAwV+4SkM7mhJhVaQ3g12rfg NU9Er+Ie9CQqABmO/UoqyrHb7pxDG878/BOgqGAHahKlx5yvTGRFVGTXLKPLx5tYdbCB IK1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=JG09yndkEu639f4KTRkyZKsAldPT0yw1/lGIrHycfbc=; fh=01qATVq518JqjGLgJz8RJQZ7lrbsihlMvPX268FN0gI=; b=zbcX3lQUeg9lOguqcIxwoY/eeLpetIqaMLBa6FG1MuiG+igHOEYbsPYxEWRVdHPfyO 5y8ge+lB3/+iueZUZSMhQuSoS0oxvAm7PmXk+9A/qWnoXVcpBateoSoVUkIK97zAeXYX Ia5sa9793YyeT0mJBfFxB7byKadnnQkUkV/omk7+aGcpV/CD7Tf9nff9+hNMv52LZT3v 1ZxDG4COmvRqM1bAvII8OTFiEKJLDA5twyqcnLqtqAyAKPe5yLzOje28nQ0aT2cWlEl1 ySbN1GUS1SYbKGpT+nv2z99bgDd/DAhFXSe+uFqtA/PKja4tDlveUfaR8cqeJwCSgx4H qZow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w7IgrSt8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id bj4-20020a170902850400b001cc53dbf53dsi4251359plb.648.2023.11.24.15.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 15:26:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w7IgrSt8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 6E62880C7121; Fri, 24 Nov 2023 15:26:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbjKXXZp (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Fri, 24 Nov 2023 18:25:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbjKXXZo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 24 Nov 2023 18:25:44 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D7A110DE for <linux-kernel@vger.kernel.org>; Fri, 24 Nov 2023 15:25:50 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50aaaf6e58fso3597557e87.2 for <linux-kernel@vger.kernel.org>; Fri, 24 Nov 2023 15:25:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700868348; x=1701473148; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=JG09yndkEu639f4KTRkyZKsAldPT0yw1/lGIrHycfbc=; b=w7IgrSt823VjG7s3oVAFRbVPz3Tl4EH0Ph8ZLgnYklpviAMiB9sdhYuAt7Prn/q7LH zIOZEtzvqEky3+pDjCXWTJjulkQK18c/YTKDkoS1XWuMndBAZoEkilH01E5gTfLCd9fE zQKZ2WtKpqmKMDu8s+p95NWZulG+evca+BSSwHcIBm4spACmu7VS2ubo6u296Akkd+br ZJZ13MQjbIDz0wSaQDqXV8wo7hqycljr+QokySB4RfQJLYRj5ClxLZ7aHLZhP7wtp8HF +ccxWo0tdmOUIBJeA4WqbSk34fM1t7DnI6z5iBQ6nNUCHCuCv8RoUt8dqL/qBtB5YDrW GK/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700868348; x=1701473148; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JG09yndkEu639f4KTRkyZKsAldPT0yw1/lGIrHycfbc=; b=dg4V3ipX03RbzVQLCTlvazjpltjyJD9+GR101Lldw3z+AbMCIYJDacJs9UGnpFsOUk 7yW+/LFki5R0Lzs/a2kCw3TgPet4krz7vM/aVCH6r3wiFEuX1LvQ3C8AIpSmQcYyiLAZ 20S57K94IJ2uc19d4JJSoZ7kAkRzR8SXID/7jZC8bV1l7gWbi53z5fEwEREuBIYaOJzV h3WH0poxK0I8lD7XcSh/cfWdLmuiuDPKmrS9OSj0cH1iC1di3Gu5qYY4g6LHLG+TjnYv 01AQpftY2s/49uS0Gubh8d6tQAUINxW38R8A6+L4x/jvBjFKQz/8J4YPaPhYerSt6MvI nZrQ== X-Gm-Message-State: AOJu0Yzu/0pE7w1VEfGMrd2KS10+7bVmKcO6UOJWHQUCFxjXhKlGvPr6 jfpJcz//WxAHpZwWCSvcK5b2fhZW3bttHtORmhc= X-Received: by 2002:a05:6512:1314:b0:507:ae8b:a573 with SMTP id x20-20020a056512131400b00507ae8ba573mr4116472lfu.51.1700868348344; Fri, 24 Nov 2023 15:25:48 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id f19-20020a056512361300b0050949e41d36sm635489lfs.253.2023.11.24.15.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 15:25:47 -0800 (PST) From: Linus Walleij <linus.walleij@linaro.org> Date: Sat, 25 Nov 2023 00:25:47 +0100 Subject: [PATCH] gpiolib: Drop cargo-culted comment MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231125-dropcomment-v1-1-15800415aae0@linaro.org> X-B4-Tracking: v=1; b=H4sIAPowYWUC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI2NDQyNT3ZSi/ILk/Nzc1LwSXQvLVNMk8yST5GTjNCWgjoKi1LTMCrBp0bG 1tQDNwiCXXQAAAA== To: Bartosz Golaszewski <brgl@bgdev.pl>, Andy Shevchenko <andy@kernel.org> Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org> X-Mailer: b4 0.12.4 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 howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> 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]); Fri, 24 Nov 2023 15:26:00 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783489744502858094 X-GMAIL-MSGID: 1783489744502858094 |
Series |
gpiolib: Drop cargo-culted comment
|
|
Commit Message
Linus Walleij
Nov. 24, 2023, 11:25 p.m. UTC
This comment about the gpio_lock is just completely confusing and
misleading. This refers to a gpio_desc that would in 2008 be used
to hold the list of gpio_chips, but nowadays gpio_desc refers to
descriptors of individual GPIO lines and this comment is completely
unparseable. Delete it.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpiolib.c | 4 ----
1 file changed, 4 deletions(-)
---
base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
change-id: 20231125-dropcomment-89e5b7b4cc3f
Best regards,
Comments
On Sat, Nov 25, 2023 at 12:25:47AM +0100, Linus Walleij wrote: > This comment about the gpio_lock is just completely confusing and > misleading. This refers to a gpio_desc that would in 2008 be used > to hold the list of gpio_chips, but nowadays gpio_desc refers to > descriptors of individual GPIO lines and this comment is completely > unparseable. Delete it. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > drivers/gpio/gpiolib.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index 95d2a7b2ea3e..1c47af866bf6 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -86,10 +86,6 @@ static struct bus_type gpio_bus_type = { > */ > #define FASTPATH_NGPIO CONFIG_GPIOLIB_FASTPATH_LIMIT > > -/* gpio_lock prevents conflicts during gpio_desc[] table updates. > - * While any GPIO is requested, its gpio_chip is not removable; > - * each GPIO's "requested" flag serves as a lock and refcount. > - */ Perhaps provide a comment as to what the gpio_lock DOES cover? > DEFINE_SPINLOCK(gpio_lock); > > static DEFINE_MUTEX(gpio_lookup_lock); > > --- > base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 > change-id: 20231125-dropcomment-89e5b7b4cc3f > > Best regards, > -- > Linus Walleij <linus.walleij@linaro.org> >
On Sat, Nov 25, 2023 at 3:40 AM Kent Gibson <warthog618@gmail.com> wrote: > On Sat, Nov 25, 2023 at 12:25:47AM +0100, Linus Walleij wrote: > > -/* gpio_lock prevents conflicts during gpio_desc[] table updates. > > - * While any GPIO is requested, its gpio_chip is not removable; > > - * each GPIO's "requested" flag serves as a lock and refcount. > > - */ > > Perhaps provide a comment as to what the gpio_lock DOES cover? Normally yes, but Bartosz just said he is going to replace this spinlock with a mutex so it's better if he adds it then. Yours, Linus Walleij
On Sun, Nov 26, 2023 at 12:05:08AM +0100, Linus Walleij wrote: > On Sat, Nov 25, 2023 at 3:40 AM Kent Gibson <warthog618@gmail.com> wrote: > > On Sat, Nov 25, 2023 at 12:25:47AM +0100, Linus Walleij wrote: > > > > -/* gpio_lock prevents conflicts during gpio_desc[] table updates. > > > - * While any GPIO is requested, its gpio_chip is not removable; > > > - * each GPIO's "requested" flag serves as a lock and refcount. > > > - */ > > > > Perhaps provide a comment as to what the gpio_lock DOES cover? > > Normally yes, but Bartosz just said he is going to replace this spinlock > with a mutex so it's better if he adds it then. > If that is happening soon then leave it to Bart to change both the comment and lock. If not, then we now have an undocumented lock. If the coverage of the spinlock and proposed mutex are the same why not describe what the lock covers now? Then Bart wont have to update the comment. Cheers, Kent.
On Sun, Nov 26, 2023 at 1:14 AM Kent Gibson <warthog618@gmail.com> wrote: > > On Sun, Nov 26, 2023 at 12:05:08AM +0100, Linus Walleij wrote: > > On Sat, Nov 25, 2023 at 3:40 AM Kent Gibson <warthog618@gmail.com> wrote: > > > On Sat, Nov 25, 2023 at 12:25:47AM +0100, Linus Walleij wrote: > > > > > > -/* gpio_lock prevents conflicts during gpio_desc[] table updates. > > > > - * While any GPIO is requested, its gpio_chip is not removable; > > > > - * each GPIO's "requested" flag serves as a lock and refcount. > > > > - */ > > > > > > Perhaps provide a comment as to what the gpio_lock DOES cover? > > > > Normally yes, but Bartosz just said he is going to replace this spinlock > > with a mutex so it's better if he adds it then. > > > > If that is happening soon then leave it to Bart to change both the > comment and lock. > > If not, then we now have an undocumented lock. If the coverage of the > spinlock and proposed mutex are the same why not describe what the lock > covers now? Then Bart wont have to update the comment. > > Cheers, > Kent. > Yeah, I think we should maybe leave some temporary FIXME comment once the mutex patch is in saying this must go as well but it'll take more time because the problem is quite tricky. Bart
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 95d2a7b2ea3e..1c47af866bf6 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -86,10 +86,6 @@ static struct bus_type gpio_bus_type = { */ #define FASTPATH_NGPIO CONFIG_GPIOLIB_FASTPATH_LIMIT -/* gpio_lock prevents conflicts during gpio_desc[] table updates. - * While any GPIO is requested, its gpio_chip is not removable; - * each GPIO's "requested" flag serves as a lock and refcount. - */ DEFINE_SPINLOCK(gpio_lock); static DEFINE_MUTEX(gpio_lookup_lock);