Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1044434imm; Wed, 4 Jul 2018 10:24:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdGRykB4eDLi1reGYMxF6h3eFM245eQRRgowdl9iYUfiPDjVR3l7Qeg8NWqDXJUsFWLe6XA X-Received: by 2002:aa7:87d0:: with SMTP id i16-v6mr3078779pfo.82.1530725086327; Wed, 04 Jul 2018 10:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530725086; cv=none; d=google.com; s=arc-20160816; b=a5l9WAg9gN3e/ZvUoLVqnNzCdQsskgleHwDOUa1vAcHbTKWiO2ca3CpTm9F1EIRyzk fu1zY4wBYhyq39PF0BsyHOjMBqxzUqS4IuMY6QsJQDqV1/89XIjkRegrYIrO1vLaP0GV waoVyOMq+9z4TZ9nNG1irTNAo+T+cKhX05k7l9ZPIvs4JWfRKcsJyTAV6W1XaJChf8wx QDJAK8+2I+GyrI0aCoCzxCzRwi5I+DraeKNqy83wAIL0rshJeHyMgrDw9KUF/P+jzifI J2kKldnlL/IclbZ7/JeJ8iLY3qj5Hi+Zec+crfoP6Lrsu1xThN9C1VKyhke4tmXNRpYI cAuQ== 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 :arc-authentication-results; bh=6mEUCAwGEilbfJ/quvX0zpFygHqSVZLrnWMLsGtyjsA=; b=rPHuVgF+c3fNqboYoSsmiXWfqpjufwAfYdVInth0Khj13VxNfZSZoPE+05ZoqZNCkG zZ+aejoJOPVEOlHo6hAv0zP9lgToci7gPVuLIGCIMVqGESGOyp0mR+FJ2T5LMUc80Gf2 hhd6KunS/eV1tiep+GodGYMcji3qPQl175CCNSBavk/B62oGMZeLFCImTF7VY5inRzIW vFkUphaGhTO1BNNITs/v6jwQZA7TNicn0umjKLhHRMlpJdIO0YUziGi5J1rx6uFU4yIf GhCkIhzp5dhCEdiS7JQu8nF4/uFn3jgWNfHPHLAg8Vi/fAAhYwZnvsb3Q+TuicHLpil0 YW3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HRDhoRY9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p83-v6si4209453pfa.180.2018.07.04.10.24.32; Wed, 04 Jul 2018 10:24:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HRDhoRY9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753029AbeGDRXm (ORCPT + 99 others); Wed, 4 Jul 2018 13:23:42 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:53626 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752874AbeGDRXi (ORCPT ); Wed, 4 Jul 2018 13:23:38 -0400 Received: by mail-it0-f65.google.com with SMTP id a195-v6so8649273itd.3 for ; Wed, 04 Jul 2018 10:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6mEUCAwGEilbfJ/quvX0zpFygHqSVZLrnWMLsGtyjsA=; b=HRDhoRY99jgU6cIRv0r4r1StZyo93k7wj0f8qHGtjxqE8HlKcmCJB4Gfbay79s8F++ jGpqNF9nxH1ma/pMlDIHaWRWzP041BtTLUYahsL3WHSJRMkocrHNoEtp/1HGPUWXWHzC bMs+CbubBdUvXfqNBLYpMVukKbvl7j13OD+f4= 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=6mEUCAwGEilbfJ/quvX0zpFygHqSVZLrnWMLsGtyjsA=; b=d/iNmNbM/N2bBF+gAjl5ztp/ahKQ3kDdf9YT756CQZD5dRDdc4xo7tSGtFt8j7XC6P fzh8I5kcOGZxWGofq9z5jKU/31HvyXTf4+azv0Zg7jppwQLDJ5GNc+Smuk1uRB0zUAn1 BryLI9gGE7oIZ6JfuO4z15kS2zDGlE9nZWKQpO51XBWz0gt1d5JMwnD3VVfyLJdU1lpJ 7Q+0QcS6hpK50wek0ZSiQz8trX42x9JPSNWuUwnr7GA4zfxQbj0rc0mzZPiIbh/cQQs7 rtedFy6ld44zRw7dS9fXdO94pi8I1DfS5PPr95/ncfzCJm50EZGixFEo8SYGOvsLg/Bg fkCA== X-Gm-Message-State: APt69E3uZr3/48+bGLo1i2END3431cSyH3RYzzb5pEnpjpryCvm3gVlb 92mEOm82kvun4jTr6dHPJ51AMUSomYnwKRlrYxI5uA== X-Received: by 2002:a24:ad01:: with SMTP id c1-v6mr2392473itf.70.1530725018072; Wed, 04 Jul 2018 10:23:38 -0700 (PDT) MIME-Version: 1.0 References: <7606bdc53c26c332b2bbff0f865380fb0e874b56.1529607879.git.vilhelm.gray@gmail.com> <20180703141620.GB14958@sophia> In-Reply-To: <20180703141620.GB14958@sophia> From: Linus Walleij Date: Wed, 4 Jul 2018 19:23:26 +0200 Message-ID: Subject: Re: [v7,03/10] docs: Add Generic Counter interface documentation To: William Breathitt Gray Cc: David Lechner , Greg KH , Jonathan Cameron , Linux ARM , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" , linux-iio@vger.kernel.org, Fabrice Gasnier , Benjamin Gaignard , Rob Herring , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , Mark Rutland 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 Tue, Jul 3, 2018 at 4:16 PM William Breathitt Gray wrote: > On Mon, Jul 02, 2018 at 02:37:53PM -0500, David Lechner wrote: > >On 06/21/2018 04:07 PM, William Breathitt Gray wrote: > >> +Userspace Interface > >> +=================== > >> + > >> +Several sysfs attributes are generated by the Generic Counter interface, > >> +and reside under the /sys/bus/counter/devices/counterX directory, where > >> +counterX refers to the respective counter device. Please see > >> +Documentation/ABI/testing/sys-bus-counter-generic-sysfs for detailed > >> +information on each Generic Counter interface sysfs attribute. > >> + > >> +Through these sysfs attributes, programs and scripts may interact with > >> +the Generic Counter paradigm Counts, Signals, and Synapses of respective > >> +counter devices. > >> + > > > >Have you considered a character device in addition to the sysfs interface? > > > >I basically have many of the same concerns that resulted in a char dev for > >gpio[1]. > > > >- With sysfs, you *can* technically poll for events, but then you have to > > seek and read or re-open the file. > >- File permissions are annoying if you want a non root user to be able to > > use the device. > >- A single program can't claim exclusive access to a device. > >- There is no automatic cleanup if a userspace program accessing the device > > crashes. > > > >[1]: https://www.elinux.org/images/7/74/Elce2017_new_GPIO_interface.pdf > > Those look like good technical reasons for implementing a character > device for the Generic Counter interface. I chose to implement the sysfs > interface because I was using the IIO code as a reference, but I > personally don't have much opposition to a character device in addition. IIO is also using a character device for outputting events and sensor data. In IIO sysfs is only used for configuring what events and data should come out of the character device. > I'd like to get Jonathan's opinion on this as well if possible -- I > vaguely recall us considering this option briefly last year when the > Generic Counter interface was still in its beginnings. I've CC'd Linus > Walleij as well for input as the GPIO maintainer. The GPIO character device was based on the IIO character device. We have one TODO item: to merge the timestamping format between GPIO and IIO and use the same sysfs file for configuring the time base. Yours, Linus Walleij