Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1301208pxa; Sat, 15 Aug 2020 15:02:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7dTBiYz6Z5qszMGxqXSh0QYa9qpcqyKMxVIdrrTGPy1nsloCy+SXQ1fvpjB0fgXMsFD9K X-Received: by 2002:a50:af83:: with SMTP id h3mr8533904edd.139.1597528949449; Sat, 15 Aug 2020 15:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597528949; cv=none; d=google.com; s=arc-20160816; b=x7ScV1BMrfJQpVupyev2w7/RYl5W42W37qtDGJI/kAU4v9joffgcd1DaqGL2WVdlun V2GMc9sd5PGQlo63cPOopKoAh4wN0utM95SXZDXABWu2krrs9/FVl/g5YoD3C0t0RNvd eyt0QLvLAEGf/UpMCa9DE2yFfHW0nsutXvXMJ+wJ1cy4FACf9RdyFliMMX0T/osGiiuQ ghogklExadsEaPXve4NzJ6G49QkRDkoViI/v+P+FQ/T1Vq07jfqUMtfgzl7Fz1lOn3vi JIWdKP7yVr8y/96O5aKDSTpGIW2Y/rY5bvQlA7uC2llssRdtfD/hH54mEhx4jsb9h3BV Lfrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fwXSXLqjHtnWSytqv0hQ9g9SOxtFMoK5KM1pc94nWWg=; b=hD/pCUCOemZDyLoSFFPE9AEl3AJ68ZrAUtRus/QxOPDKT8WIiUqfJngfKTVhoon2xE eIdtndDP+WWxuLWNnyaKXSsfyKUGraZMJJMKvPKIsABOyB3tmYPf5OvoZaLi3nilO8Gt p6NnDkP8M6bv5qUiWlSHD4Am/s9/9N4hse1tUfZKLWfpbWmfboSu990t5RpaF5TDET+4 h0Xo0Dmqy/m/jrcnxSFNvPJVCFv3DpQAoSB6L02YxnVERFTftYmYC9iFYDpgDMyY0c5A nmONr1ZPf+O+rA8yv+d5iVIJKwkZu26T+fKehyzqoiU4fmhqNALexVSbbDuTOBDH5ZLc e9lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=PjtuBqGR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e11si7930345ejd.431.2020.08.15.15.02.07; Sat, 15 Aug 2020 15:02:29 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=PjtuBqGR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729581AbgHOV7a (ORCPT + 99 others); Sat, 15 Aug 2020 17:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbgHOVvk (ORCPT ); Sat, 15 Aug 2020 17:51:40 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 404D4C06123F for ; Sat, 15 Aug 2020 00:21:34 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id v22so8667381qtq.8 for ; Sat, 15 Aug 2020 00:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fwXSXLqjHtnWSytqv0hQ9g9SOxtFMoK5KM1pc94nWWg=; b=PjtuBqGRj/3IVl7itQUeq2V6N4AEWUAhHgzWW/JM+hKGh8ej0WDEPmKA4qZY6RX4/P Zp4hTtZAvlQVnnBnc/w3VAKHcgYoa08oTD757pn8g3YM0qmKY15c4yB/FI/0VUqHVYyu ZMnERb2M4TdlaXmH+p+LuPrbTZ6ixrVVeMWVW3MezLrK+QlaIzvyRfyFJ22MX1X6Ie14 QPriOVf6waYwccMMTdOcR0lgtox9KLBDR49NuTlFgk1VibSe5JgZQnPeFHgnmLK2o/eK OQz+QLpvcNFiLW5Pu61RW1qPxxG/TEkDsGgjHd82mVWG2moOtToCAGD0GPNQSviumSNV d0xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fwXSXLqjHtnWSytqv0hQ9g9SOxtFMoK5KM1pc94nWWg=; b=ofxu9u+KJzEZTCjPbXQDSoJeAGJmE2guT/frnmDv4/RLWhvEpMs/tSvxIEYiSY6ue3 vGAn7KYdEqgC6C3cBxnzE6d5b+9o05a5MjW/pm+VdzBJISBrEol+2m9qC3m9dxKLAz1f AwBqhanyhowwJj9NVXRPNYnIUdYUwpfzl1I1eqcZBlpntDBaWb/n7ZPKcoj3vq4WUgrf rqDbjnPW41XopAT6BnUr4rOGVGXamMruB1NgF/Xrq6B/OPgVZ8DQoz63V35HnESglx2k /oNjjSg5xk1FFxpEKQCr0HeS18W23arYgFWBFi1JzcU2lIJ7RWJFPH4j27UspPQV8DBt BZZQ== X-Gm-Message-State: AOAM5301iMl5lK1F1fA0KKnd2UGwFNjIfJB+Fxi25/NTZ69bdrtnB8yE 9OgRbVBJhiO9NwSuBQiQ/q3TUcd7VOr5qXxrraBAAg== X-Received: by 2002:ac8:4e39:: with SMTP id d25mr5180769qtw.208.1597476093134; Sat, 15 Aug 2020 00:21:33 -0700 (PDT) MIME-Version: 1.0 References: <20200814030257.135463-1-warthog618@gmail.com> <20200814030257.135463-8-warthog618@gmail.com> <20200815065309.GA13905@sol> In-Reply-To: <20200815065309.GA13905@sol> From: Bartosz Golaszewski Date: Sat, 15 Aug 2020 09:21:22 +0200 Message-ID: Subject: Re: [PATCH v4 07/20] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL To: Kent Gibson Cc: LKML , linux-gpio , Linus Walleij Content-Type: text/plain; charset="UTF-8" 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 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. 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. Bart > No problems with your other comments. > > Cheers, > Kent. >