Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4079149pxk; Tue, 8 Sep 2020 10:07:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTKWr4CNrhWMTJsrnssfHyYf4OZnAT9gIk9UBb5NW3tajA6JpvZuqO6rx4wgRk66Stac9U X-Received: by 2002:a17:906:2b97:: with SMTP id m23mr27470772ejg.61.1599584834715; Tue, 08 Sep 2020 10:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599584834; cv=none; d=google.com; s=arc-20160816; b=QPC8YXDeYX4w9nnVW879Zvdrin96E4tOWPUixj/vc/OTDWYfK5rF6/XTIJtQJc7rfR 0SUMxKpkyxsiF0tyniWH15iU6PmhKO5tj93vq38vXQ5H/kYWTLhsJR4xVc9ttqacVb0c NxHf97DyDTYJ8wqV/xUUv/OBDh65OS3EnneylCyN+fUfFrTMzrnOR5xzOFzZT8bFnTaF VFxsBO3VCnBdbmKNxiV+wWYBjTwcBQA456k4e3GJmhaNyNKCTJ9MJVWxNvSXFdGq5t9A vEMzIceqT2c1iP5/IZYUV+1QSJTIoOTezayaxIzUVF8ReXy4thUAECxgQrGllJ6HhFa7 mabQ== 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=ZNS3GRvMOTeZUyA2sVYVT7axCdo6ttiBNGmu42dBjv0=; b=EHNzUHrQMacWCRvDXkMXv7kOTRK4ldrNLgJat4fxYL6czHrbpl/Xe7DsbHljDWx4yQ aKNQPGJlGnkyKsTDDMqHmenI/TGYlYrwfK/iEAlWuhe0n2tL9QSdDuR9oYb7n+saOTpg xaN9u1d9kVOSbYQqAO++HSLy6CkE4PX7myocohEEv3sjhAp5JQxzK7I5iMZKkGc0HWES 4igcomVAD7l/Q7YenI9OByFuTdKJ9tXa5yxKjpF8HSsY+owtwNtOTTI/UFEIYjtjaJnd TKvXMBBV/gr8YpgxzylkmZd75alc/sE7h1avHQyzNAp7fXAI58FtxQGVNkBuAOnt4rjd 2/Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=npjYldHd; 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 dr18si5890906ejc.702.2020.09.08.10.06.50; Tue, 08 Sep 2020 10:07:14 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=npjYldHd; 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 S1732034AbgIHREL (ORCPT + 99 others); Tue, 8 Sep 2020 13:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732081AbgIHRDs (ORCPT ); Tue, 8 Sep 2020 13:03:48 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0449C061757 for ; Tue, 8 Sep 2020 10:03:41 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id h11so16069362ilj.11 for ; Tue, 08 Sep 2020 10:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZNS3GRvMOTeZUyA2sVYVT7axCdo6ttiBNGmu42dBjv0=; b=npjYldHdaKN5sNer+//ioO2vd9ZSVt9HRwo/GOz64WLrI1EApu0/oVVpSTuxBpaETH zdGBQ1cmVWfRfzBpvEygk0e/Fp1/SJWo0V3MDfwI7uOYbujcbc+EgdlnCvoMMGyWdorN Ch0dMop8qmboQmcQ3HM+FjgNWOndFL2BTCgUoiKdJehhEJdoap2e078A90wr5gAxeCsQ /RrrJPONIApVqG45o9UVb+oIhU+db+SXQ4Ek6X1+ay0n5jrwUq9T80W+l/s3tK6L0DpE H3abAhf3ldad3rCQYdZdGwfEWAvIKImuxO/EYXyb1SfmLSaNac6ePbX1OyihycfpogaN 3C+A== 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=ZNS3GRvMOTeZUyA2sVYVT7axCdo6ttiBNGmu42dBjv0=; b=SvrlNk2t+KA+xUNqhJduRrQF3cK+Lnr4LCBqXh/DHPfrHQen6j+nCi6OSvj+jDAaMb 56QvnNVamaoR3QWeSBylZld53/CJSydiuhy1IjB8CYBBN0/ZWXdqFVov6T60ltRZuZFY lSiGX8XYFpkIcaET+s5tHCKFAobrJOrApmFEaHI5MWCf5CD/HlUDO479+RzDl7ye67vF KUkRpw2/dPrzmR9gKIDyn0ASWNcm2vmpq/NMkuwOpCFnmLUYCVD0G5euu5j6EyyTwWB3 9Wl+sxbfw4Oes6Fsw5LQEyexrl+EWU11Q/MgY063Ahhr43eHqrV6uwN2swHbXrTjHd4X wMfw== X-Gm-Message-State: AOAM532lUwAeCv+ciCqeN285RgBYeb2IElEV/HyGhPz0VAcsZwd5UN93 E9Z9sShGRtWmXdb4sx5R0gGnadYMXP669IivnF9IKQ== X-Received: by 2002:a92:1b0b:: with SMTP id b11mr24464248ilb.287.1599584621007; Tue, 08 Sep 2020 10:03:41 -0700 (PDT) MIME-Version: 1.0 References: <20200904154547.3836-1-brgl@bgdev.pl> <20200904154547.3836-24-brgl@bgdev.pl> <26ea1683-da8f-30e7-f004-3616e96d56b3@infradead.org> <20200907095932.GU1891694@smile.fi.intel.com> <20200907115310.GA1891694@smile.fi.intel.com> <20200907122238.GA1849893@kroah.com> In-Reply-To: <20200907122238.GA1849893@kroah.com> From: Bartosz Golaszewski Date: Tue, 8 Sep 2020 19:03:30 +0200 Message-ID: Subject: Re: [PATCH 23/23] Documentation: gpio: add documentation for gpio-mockup To: Greg Kroah-Hartman Cc: Bartosz Golaszewski , Andy Shevchenko , Randy Dunlap , Linus Walleij , Jonathan Corbet , Mika Westerberg , Kent Gibson , linux-gpio , linux-doc , LKML , ACPI Devel Maling List 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 Mon, Sep 7, 2020 at 2:22 PM Greg Kroah-Hartman wrote: > > On Mon, Sep 07, 2020 at 02:06:15PM +0200, Bartosz Golaszewski wrote: > > On Mon, Sep 7, 2020 at 1:53 PM Andy Shevchenko > > wrote: > > > > > > On Mon, Sep 07, 2020 at 12:26:34PM +0200, Bartosz Golaszewski wrote: > > > > On Mon, Sep 7, 2020 at 11:59 AM Andy Shevchenko > > > > wrote: > > > > > > > > > > On Fri, Sep 04, 2020 at 08:15:59PM -0700, Randy Dunlap wrote: > > > > > > On 9/4/20 8:45 AM, Bartosz Golaszewski wrote: > > > > > > > > > > ... > > > > > > > > > > > > +GPIO Testing Driver > > > > > > > +=================== > > > > > > > + > > > > > > > +The GPIO Testing Driver (gpio-mockup) provides a way to create simulated GPIO > > > > > > > +chips for testing purposes. There are two ways of configuring the chips exposed > > > > > > > +by the module. The lines can be accessed using the standard GPIO character > > > > > > > +device interface as well as manipulated using the dedicated debugfs directory > > > > > > > +structure. > > > > > > > > > > > > Could configfs be used for this instead of debugfs? > > > > > > debugfs is ad hoc. > > > > > > > > > > Actually sounds like a good idea. > > > > > > > > > > > > > Well, then we can go on and write an entirely new mockup driver > > > > (ditching module params and dropping any backwards compatibility) > > > > because we're already using debugfs for line values. > > > > > > > > How would we pass the device properties to configfs created GPIO chips > > > > anyway? Devices seem to only be created using mkdir. Am I missing > > > > something? > > > > > > Same way how USB composite works, no? > > > > > > > OK, so create a new chip directory in configfs, configure it using > > some defined configfs attributes and then finally instantiate it from > > sysfs? > > > > Makes sense and is probably the right way to go. Now the question is: > > is it fine to just entirely remove the previous gpio-mockup? Should we > > keep some backwards compatibility? Should we introduce an entirely new > > module and have a transition period before removing previous > > gpio-mockup? > > > > Also: this is a testing module so to me debugfs is just fine. Is > > configfs considered stable ABI like sysfs? > > Yes it is. Or at least until you fix all existing users so that if you > do change it, no one notices it happening :) > Got it. One more question: the current debugfs interface we're using in gpio-mockup exists to allow to read current values of GPIO lines in output mode (check how the user drives dummy lines) and to set their simulated pull-up/pull-down resistors (what values the user reads in input mode). This works like this: in /sys/kernel/debug/gpio-mockup every dummy chip creates its own directory (e.g. /sys/kernel/debug/gpio-mockup/gpiochip0) and inside this directory there's an attribute per line named after the line's offset (e.g. /sys/kernel/debug/gpio-mockup/gpiochip0/4). Writing 0 or 1 to this attribute sets the pull resistor. Reading from it yields the current value (0 or 1 as well). This is pretty non-standard so I proposed to put it in debugfs. If we were to use configfs - is this where something like this should go? Or rather sysfs? Is it even suitable/acceptable for sysfs? Thanks, Bartosz