Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1386335pxa; Sat, 15 Aug 2020 18:47:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3ZXvdbzJI/BTHniZnLS4JsqUaovS/uET1QZ6u7xg6dD+yp3XRrBLRskEjqS+DU8v8D3Iw X-Received: by 2002:a17:906:7e4e:: with SMTP id z14mr8840426ejr.87.1597542450986; Sat, 15 Aug 2020 18:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597542450; cv=none; d=google.com; s=arc-20160816; b=Px7NcTLM2zi6ksIV+ZkzeM8WB3Bb78EJttr+jw1AACysPc9OGEuxEy3nEKBU0WMtvn PpW4pVSVKlUxwgM06MfISPhkyggrIRzdxOS9Jiy+DWWf4yEeU/5dGdlyGCN5h57iWCEk GuL1C2e8c/j18/7K4UJqVYBKlww9XhM0/IfureVh4KB/l6MGrkFQtgRYXZUj0FH7nzNu zGVVNqHqcEaQ4l+17V064tLSSmPvtOmSCnlIiX2o11k9s0gwp26ntg171sKnxaWPu2Bj lUMTubmDEd3MWlEYgKoiP/Ni9Qgv6f78Dcl0w9/dvV8SYIdXNJyXMnRb2BdscVzphJRr UbrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=1uixVnw4VqVRWBxjLItwqvGPWa+lcvmh4b3cIx3Xb64=; b=EzwnIN5etQleMr9ehwHy5OzhOg2pzy38W2Zh2zMOLOo/DTB4FnNmxFIcChNC0PVapq YjFThJPZtVykmF/yLOyuOoVXhFkHgSc/zZW5cntNhC4YM6jhU4c6nGrvYk2t/s57xguS F8PVooP6gmqrnuo3EyNtxF93S9VFPBB4PeiaaWf8wbLNMkKqFqr5LfMw968oW4v3xVWC BOQ/zwuz5dE+kFSBqO3vlRX0R3nxgt60S9QjRkV829vw+Rv9cSH/F8c+/PBCO/erO7Js /5NroSR4k60uzojkxCKeOunmGaTauDI0rOLmIQtJejPGHFF0IhhLjV2ALV9LRbuKXmr4 t14A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=meBYpFKf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w15si10428707edl.118.2020.08.15.18.47.08; Sat, 15 Aug 2020 18:47:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=meBYpFKf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729277AbgHOV6C (ORCPT + 99 others); Sat, 15 Aug 2020 17:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728915AbgHOVwA (ORCPT ); Sat, 15 Aug 2020 17:52:00 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33334C02B8F5; Sat, 15 Aug 2020 06:21:45 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id f9so5572669pju.4; Sat, 15 Aug 2020 06:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1uixVnw4VqVRWBxjLItwqvGPWa+lcvmh4b3cIx3Xb64=; b=meBYpFKfZGJfoM+cLyqrj1fe3d3boOTYypFqELfkisrmrZVlGPAQBtePqMqyFOrQB3 Cc/nFs46SwiWFIct3N1kx4mlrEdFTHyrFVkoh31I1UKdBvFVtKX61Zkg7tfbovIFYzj/ FFbIUExgZKNdsT+YV+XQZl2wWLbnkJUqV0r1rIqjqJ2ob5rFRN+AcrVzeuOmr6GdJhj4 S0vesbPzZsNQ7iwr09KLeXBDlA5xQ2hs05KaoRPypH9iTrwT/a5XcMEhVurj8+TjYqrh wBxd8uxnA+NhOegQ7gE+XWhloVMCs2ZisXrFrGM0hFEu606nHJAbg3RmstTBcedMC4nP T+3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1uixVnw4VqVRWBxjLItwqvGPWa+lcvmh4b3cIx3Xb64=; b=QD9YKjpgw5N4djevR52pV5pdG1ynKFJn6QRmbbN4ih4yHSzsKjepqq+wlELK79MGRc eluh7JLFTMghreHs7qXY3lb60b9fjcrPgyN9HQKawZmcpEa/tE7LFMx8rylrgWauoMhK E6VWVp5i4pbJRVgdO80ACNpbhkoj2GdZ3CNPUNTc0rCdxk4ZnWy1UkXDEv0NYU369fVc tZ/7IUbJxUgU3C2klR01ByFcO2gYGOF2/7BkgzI5WmNmYGdS5mNBFC06KTfTBhGfa7lH S/pYhHER+WSSMb6GKKJYkFN2SzR3DrBbC4HTCZttt6UB9sMuH87G6IYC3MJfDnE5xvTL 9XCg== X-Gm-Message-State: AOAM532ZDbHhqlk205fDAeonRdEkG1GMIzlSq+upddeCNOxr9t3c17Wp AkujLhMAcM1tbmA9Yfgylsm7CdMmudY= X-Received: by 2002:a17:902:ff16:: with SMTP id f22mr5330256plj.269.1597497697744; Sat, 15 Aug 2020 06:21:37 -0700 (PDT) Received: from sol (106-69-184-100.dyn.iinet.net.au. [106.69.184.100]) by smtp.gmail.com with ESMTPSA id d29sm11068823pgb.54.2020.08.15.06.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Aug 2020 06:21:36 -0700 (PDT) Date: Sat, 15 Aug 2020 21:21:32 +0800 From: Kent Gibson To: Bartosz Golaszewski Cc: LKML , linux-gpio , Linus Walleij Subject: Re: [PATCH v4 07/20] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL Message-ID: <20200815132132.GA26885@sol> References: <20200814030257.135463-1-warthog618@gmail.com> <20200814030257.135463-8-warthog618@gmail.com> <20200815065309.GA13905@sol> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 15, 2020 at 09:21:22AM +0200, Bartosz Golaszewski wrote: > On Sat, Aug 15, 2020 at 8:53 AM Kent Gibson wrote: > > > > On Fri, Aug 14, 2020 at 09:31:29PM +0200, Bartosz Golaszewski wrote: > > > On Fri, Aug 14, 2020 at 5:04 AM Kent Gibson wrote: > > > > > > > > Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and > > > > returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL. > > > > > > > > Signed-off-by: Kent Gibson > > > > --- > > > > > > Hi Kent, > > > > > > not many comments here, just a couple minor details below. > > > > > > > [snip] > > > > > > + > > > > +/** > > > > + * struct line - contains the state of a userspace line request > > > > + * @gdev: the GPIO device the line request pertains to > > > > + * @label: consumer label used to tag descriptors > > > > + * @num_descs: the number of descriptors held in the descs array > > > > + * @descs: the GPIO descriptors held by this line request, with @num_descs > > > > + * elements. > > > > + */ > > > > +struct line { > > > > > > How about line_request, line_request_data or line_req_ctx? Something > > > more intuitive than struct line that doesn't even refer to a single > > > line. Same for relevant functions below. > > > > > > > As I've mentioned previously, I'm not a fan of names that include _data, > > _ctx, _state, or similar that don't really add anything. > > > > I certainly disagree with you on this. I think it's useful to discern > the object itself from data associated with it. Let's consider struct > irq_data and let's imagine it would be called struct irq instead. The > latter would be misleading - as this struct contains a lot additional > fields that form the context for the irq but aren't logically part of > the "irq object". And then you have irq_common_data which is even more > disconnected from the irq. This also would make using the name "irq" > for the variables containing the global irq number confusing. > > I think the same happens here: we may want to use the name "line" for > local variables and then having "struct line_data" (or similar) would > make it easier to read. > My counter example to both points is "struct file *file". > I'll listen to other's suggestions/voices but personally I think that > _ctx, _data etc. suffixes actually make sense. > > > I did consider line_request, but that was too close to the > > gpio_v2_line_request in gpio.d, not just the struct but also the > > resulting local variables, particularly in line_create() where they > > co-exist. > > > > Given the ioctl names, GPIO_V2_GET_LINE_IOCTL and > > GPIO_V2_LINE_GET/SET_xxx, that all create or operate on this struct, and > > that this is within the scope of gpiolib-cdev, the name 'line' seemed the > > best fit. > > > > And that's why line_data or line_request_data do make sense IMO. > > > And how does it not refer to a single line - what are the descs?? > > > > I meant the fact that it can refer to multiple lines while being > called "struct line". I do find this misleading. > And struct line_data isn't? Cheers, Kent.