Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5524964rdb; Wed, 13 Dec 2023 11:04:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGs+A59YTsY3s5UfKzIUuOLoV4VT0JH7L4Zx7q4lJXPOCS/6DnH7HZsOru6UeCCvNonEXVD X-Received: by 2002:a17:902:704c:b0:1d0:6ffd:9e23 with SMTP id h12-20020a170902704c00b001d06ffd9e23mr8729952plt.117.1702494253544; Wed, 13 Dec 2023 11:04:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702494253; cv=none; d=google.com; s=arc-20160816; b=R4BrVqKAcpnN1CDgvrXb0v0EJ7wZVbEeG1jMtFHzJhvZZTXwE65yD43SQk7vUAJrQe gEsrImcleL8UMGZ9KpNYVWR9x2ntdH7FBH5gMcPYzQSSCfd86vkfPvOLtCstpq0q6+Lo H1qxlh+k7ZBE9uvLiOlEI1v5nnDftuy6HrMJGkcK/1BSwYsa+oWWNY7ZxNBAh4FMNoz7 OXIrCpe1lyYyFfPY3a2YH3FbOQG0wzk3XZPrvDEj66Vrd8Es0Qtcf0yXUzVv9tUHVI64 qcJwEdVv30BgLGVZCFpp5GxUEB9R/a71h+GZ3IwNmS0+h0Eb49zPq3Ej7JNNQbNJtIWK HU5A== 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=M6EvQbWBxIRTsH6Y2Z/isMaFnqNg9G4sCjqKAgEN8tY=; fh=zVDxrptoeZ9MRfn7koif1R2qpCu1LNNm0XkfV9+WS24=; b=r6Ig0AUI1BuLArfhHW5Atp5UoAwdbgvl8HHevBN3O1fKp2x/Kdz5fdrfFBA0HUYJ/R gRHqdv1UJgP7LpUD6fH1RcDUlJUwJOjsPWRN/tSjD8PBaZja+vAA1A4CY/v2NJJOTOuq 2XvS4NckjyxnaUVS5oPQC/mRbzY1ZATxYNpTC1sZLTMRz4fmg/gaT061zmAwLScbtpiP yvgVDXqe4VBX99AsYf+0BkI4hCxJrCbkRROT9azCvn+hmAPNwxPOqaDxwAketgnetJAc 2mPA2xTXZi7j6+Pb1SRfaJM84kpXXGdE+5yWJMAuw3oFtiSzfH8zCzj2Pb0WiFD85hPG Rt9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=fhhcjdo9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e8-20020a170902b78800b001d3554bb524si1022150pls.74.2023.12.13.11.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:04:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=fhhcjdo9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 13804802D23B; Wed, 13 Dec 2023 11:04:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233779AbjLMTD7 (ORCPT + 99 others); Wed, 13 Dec 2023 14:03:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235447AbjLMTDu (ORCPT ); Wed, 13 Dec 2023 14:03:50 -0500 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE7610E for ; Wed, 13 Dec 2023 11:03:55 -0800 (PST) Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3b9df0a6560so4927933b6e.2 for ; Wed, 13 Dec 2023 11:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1702494235; x=1703099035; 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=M6EvQbWBxIRTsH6Y2Z/isMaFnqNg9G4sCjqKAgEN8tY=; b=fhhcjdo9Tq9yixiokiX9xYW9EcVOlK5JBJC6XC7+xVd9JFVXMDyMk6TC/al6KSlYaM sbbi8bMwEaX7Foyb4NYeK7Mvyija56QeYwxwCmyuen+pHTkwGFd7A27wN98i7SUifbqU xwcp6RUndUEsWYojYQat8EnDxXkljlOsR96EBW7mi40TezYGpmiZSjg/DDgbdqz1g8J0 3PrcxO0x/fESsQow/ZKgKy50/j6FAnOwVm45Cf2noJAg1KmPNeMcSf9L+gHfwQRVKEqT 0U3JfPSOdxsU45oUUwNB5jWoVsB1ppwGsckb3lTxuFBlkmcSIeu4e62H9GMULqTu8EdM 1fTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702494235; x=1703099035; 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=M6EvQbWBxIRTsH6Y2Z/isMaFnqNg9G4sCjqKAgEN8tY=; b=E/neDLp+ioRQVmd8/EAhmesp7iFcoOYUd3hpelptvWumHGDZkeefwLm87yEYUdqn39 QybfxEz/oPqqdIweS1s60ObcBWwCW59AFVqagcUmXVL0pmqFKBkuWz5mAwkIAhm20dsH hT7Y7pKZd52Ecfvj/pNfT8S4060LytCJ0r3pBBfqRVCUNlE/4/oXBTih1frp9cQMJ7cq R2LlEEVuuUH++73bxXdXKM3yqfDCtYmtCj2deEt6Uw9o5JR7Emu6S4m3BIPgOb5kbbCu jC5hl64CRp82aqK0kZDDXL7h0yUM5UzJhh1IGID4Svi47AEsgjzX6tUzKwnVrXm0OWo7 y2sg== X-Gm-Message-State: AOJu0YxT+menPU4jEiEX5kzvW17c1bcylLU42K+h9VpzyEVnZBZ8gbyF c1731C4Nx36gy0mg/uCRsedeNN+/9C4hoZq59rFn3w== X-Received: by 2002:a05:6870:5486:b0:203:e6e:c730 with SMTP id f6-20020a056870548600b002030e6ec730mr2666570oan.101.1702494235199; Wed, 13 Dec 2023 11:03:55 -0800 (PST) MIME-Version: 1.0 References: <20231212054253.50094-1-warthog618@gmail.com> <20231212054253.50094-2-warthog618@gmail.com> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 13 Dec 2023 20:03:44 +0100 Message-ID: Subject: Re: [PATCH 1/4] gpiolib: cdev: relocate debounce_period_us from struct gpio_desc To: Andy Shevchenko Cc: Kent Gibson , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linus.walleij@linaro.org 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, T_SCC_BODY_TEXT_LINE 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 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 11:04:12 -0800 (PST) On Wed, Dec 13, 2023 at 5:29=E2=80=AFPM Andy Shevchenko w= rote: > > On Wed, Dec 13, 2023 at 05:15:38PM +0100, Bartosz Golaszewski wrote: > > On Wed, Dec 13, 2023 at 5:12=E2=80=AFPM Andy Shevchenko wrote: > > > On Wed, Dec 13, 2023 at 11:59:26PM +0800, Kent Gibson wrote: > > > > On Wed, Dec 13, 2023 at 04:40:12PM +0100, Bartosz Golaszewski wrote= : > > > > > On Wed, Dec 13, 2023 at 3:27=E2=80=AFPM Kent Gibson wrote: > > > > > > On Wed, Dec 13, 2023 at 03:54:53PM +0200, Andy Shevchenko wrote= : > > > > > > > On Tue, Dec 12, 2023 at 01:42:50PM +0800, Kent Gibson wrote: > > ... > > > > > > > > > +static struct supinfo supinfo; > > > > > > > > > > > > > > Why supinfo should be a struct to begin with? Seems to me as = an unneeded > > > > > > > complication. > > > > > > > > > > I think we should keep it as a struct but defined the following w= ay: > > > > > > > > > > struct { > > > > > spinlock_t lock; > > > > > struct rb_root tree; > > > > > } supinfo; > > > > > > > > That is what I meant be merging the struct definition with the vari= able > > > > definition. Or is there some other way to completely do away with = the > > > > struct that I'm missing? > > > > > > Look at the top of gpiolib.c: > > > > > > static DEFINE_MUTEX(gpio_lookup_lock); > > > static LIST_HEAD(gpio_lookup_list); > > > > > > In the similar way you can simply do > > > > > > static DEFINE_SPINLOCK(gpio_sup_lock); > > > static struct rb_root gpio_sup_tree; > > > > The fact that this has been like this, doesn't mean it's the only > > right way. IMO putting these into the same structure makes logical > > sense. > > I disagree on the struct like this on the grounds: > - it's global > - it's one time use > - it adds complications for no benefit > - it makes code uglier and longer > It boils down to supinfo.lock vs supinfo_lock. I do prefer the former but it's a weak opinion, I won't die on that hill. Bart > What we probably want to have is a singleton objects in C language or at = least > inside Linux kernel project. But I'm not sure it's feasible. > > > > > > > Yeah, that is a hangover from an earlier iteration where supinf= o was > > > > > > contained in other object rather than being a global. > > > > > > Could merge the struct definition into the variable now. > > -- > With Best Regards, > Andy Shevchenko > >