Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5210565rdb; Wed, 13 Dec 2023 02:04:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IH07FHqdWSj6f+JRv9IMXNcLd6lb4cOD4vDX5Yu0D7fWWfTmshVfraSTvheQ7gIrqwAlzt7 X-Received: by 2002:a17:90b:3d8:b0:28a:e127:1021 with SMTP id go24-20020a17090b03d800b0028ae1271021mr200834pjb.22.1702461845843; Wed, 13 Dec 2023 02:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702461845; cv=none; d=google.com; s=arc-20160816; b=TilRa+vLekGSoBbFVNCmuccLX74T/mDg61J+r6Zq2v0baL0Jv0zZYSFIqYNBCKJ8p8 95T+6rTtlu+ft4wODkfKiei0P7mlOD2UwaX2H6coB6HwRRJ4t8XbCn0xhM5PWrxwfePD +/HAvr5Xm08Em0tzn2pbj+cB52Dv/WFURy68Bd/kH2bY/TVgk/1U03fna2VR/jHYA/vx ECRE6GZ4gLkBuESxdJdQobPvjhGhGxu2lIUNBzirElkhm7qS2R3q4ny9driq3EQ7xcvH xFZUlmLRwyuXH9KQb4OCp0buxLRusy/iAdvR8ODC3cDmAV0gvB7deYKsIuCVRKKh8klk o9MQ== 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=2/qPaIfmghWpTcqxcVuuhDpPLoLBeCE+kTWvQmM/68A=; fh=erCAZt8TqRv2/z+YQ9HTYE4a5f7Y9g1zasafOXpHI3M=; b=0aCMHq/G7/h6S9ZKfgEPJ74T/nArhuvz3zb5AdPq9X7+srRJyoTnvCB7xKPFZp+rZf jNg39bkQGd+d5YCHi5VtwOozW/LKuh6EsQ9TDITgwhqoRPJNLAT6+zGFqlIXIKJxpoH7 HgnoDebvRUpYXoNy/kEFRznjc9FBdFV74ruJ3BdVrRsrtA//uYBvqRftS8wEGWjpCVDz s5jtDECJAFvbhSCZPIOG5YbCIud20IdVGKeG302NQRk9KkBl95t6uvbShH9G8qp2Z+Bz D7LYA6O/+XuWKc/eeNCQW2YWCx3900fgWWimZ5r2VdmKJRcRMplGnAnRUwg25eK9Hopj 4IVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=mB5aZ8hh; 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 Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y2-20020a17090a86c200b0028675cb4aeasi10531161pjv.47.2023.12.13.02.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 02:04:05 -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=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=mB5aZ8hh; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1BB898225C88; Wed, 13 Dec 2023 02:04:02 -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 S235202AbjLMKDq (ORCPT + 99 others); Wed, 13 Dec 2023 05:03:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjLMKDp (ORCPT ); Wed, 13 Dec 2023 05:03:45 -0500 Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2588D0 for ; Wed, 13 Dec 2023 02:03:51 -0800 (PST) Received: by mail-vs1-xe2a.google.com with SMTP id ada2fe7eead31-46486775ad7so1401700137.2 for ; Wed, 13 Dec 2023 02:03:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1702461831; x=1703066631; 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=2/qPaIfmghWpTcqxcVuuhDpPLoLBeCE+kTWvQmM/68A=; b=mB5aZ8hhw7+zC5YruVNA2JWNN/+81p4tppiYN04VmoiaOKPhbTP09KNO9KKEXxwbvg T0RFtsLYvn5Jy95so7ExV3Sk7DIKpKMT9k7vsTKQGCW693xqNDYMbuFcNfDtlAFIE+y0 ukyxS2VN484hlFKwCIKgDvpvRPjsPIB4De8Vnn6tbxFVvOj+npr2OLN7OceRfxN0pJiV Md0bho/E7IRH79XTo4s08GG5EHJA9YTng6zA0nU0MCiP9qV7BcLpsmRveENws7uKXPUx GxwfIJszvMfK40uilqAUDIEzOPcdmZvg0tfeabXhTGvKOVvxB9B0I8W/26K9KCegsy23 mAkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702461831; x=1703066631; 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=2/qPaIfmghWpTcqxcVuuhDpPLoLBeCE+kTWvQmM/68A=; b=hvgHmIam9Tv1fJJlEv0pGnJADz2mIirwmD+MeWAh9IdB7IAFkUQmIrX8iNtvj+gpy3 YFsM++mdRUBrDqYJUX9mzix5YdwIdor5oKq3STvCYQMix3DVDeekzrvSLDEZjQebB/6h CxvAKOZ5G6l7uxAauLuAh7u4TUeKQAIdIgpEqVCr89BDL/5MmXEynowF6hcFZOI/IhvL wQbnw7fzFBedYxkW0BEHhSBafUNap8bsZCfTLs+bGHiUcqnBHuldqf+nKsBJQSabg3Ti d2l19+cQzeJEzc2BtxsSxkfp6sMiCbp1JRTAKXFZkeR35sGFcACzJsK3xTZASnW3A8Ou VSjA== X-Gm-Message-State: AOJu0YwaKlVf0IVw80Zgw9tMHUp3Nru/ExZA4mjHODxbns9W+wEmogxA HLFKgtKq617OZ5K6OiHp3iiviWuwEIz3HwDaMwjHpQ== X-Received: by 2002:a05:6102:3a0c:b0:464:865e:6aaf with SMTP id b12-20020a0561023a0c00b00464865e6aafmr5265030vsu.1.1702461830883; Wed, 13 Dec 2023 02:03:50 -0800 (PST) MIME-Version: 1.0 References: <20231212054253.50094-1-warthog618@gmail.com> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 13 Dec 2023 11:03:40 +0100 Message-ID: Subject: Re: [PATCH 0/4] gpiolib: cdev: relocate debounce_period_us To: Kent Gibson Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linus.walleij@linaro.org, andy@kernel.org 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,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: 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, 13 Dec 2023 02:04:02 -0800 (PST) On Wed, Dec 13, 2023 at 12:58=E2=80=AFAM Kent Gibson = wrote: > > On Tue, Dec 12, 2023 at 06:09:00PM +0100, Bartosz Golaszewski wrote: [snip] > > > > Patches 2-4 look fine, I was about to review patch 1 in detail but I > > thought I'd just throw this one in here before we commit to a specific > > solution. > > > > For some reason I thought this would not work but I'm now considering > > it as an alternative approach: is there anything wrong with adding > > struct kref to struct line, allocating it separately per-line when > > gpio_chardev_data is created, referencing it from struct linereq when > > the line is being requested, and dropping the reference from > > gpio_chardev_data and linereq when either is being removed? Other than > > the increased number of allocations? > > > > The collection of struct line always has to be global, right, as both > gpio_chardev_data and linereq are ephemeral. e.g. if one process request= s > a line and another checks the lineinfo, those will have distinct > gpio_chardev_data. > Strictly speaking at least the supplemental info has to be globally accessible. But I get your point. > But the key issue is that the linereq and struct line lifetimes are > strictly tied - a struct line does not live beyond the containing linereq= . I was thinking about decoupling one from the other actually. > Leaving the struct line alive after the linereq is released is just wrong= . > The line has been released back to gpiolib so there can be no > supplemental info left. Indeed. > If you want any such info to persist beyond the line release then it > should be located in gpiolib itself, not cdev. > Right, we even zero debounce_period_us anyway on line release - just as if we released struct line. Bart