linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Breathitt Gray <vilhelm.gray@gmail.com>
To: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [RFC 1/4] counter: Simplify the count_read and count_write callbacks
Date: Sun, 15 Sep 2019 22:58:23 +0900	[thread overview]
Message-ID: <20190915135823.GA445580@icarus> (raw)
In-Reply-To: <20190915144700.0f7a361d@archlinux>

On Sun, Sep 15, 2019 at 02:47:00PM +0100, Jonathan Cameron wrote:
> On Sun, 15 Sep 2019 14:39:17 +0100
> Jonathan Cameron <jic23@jic23.retrosnub.co.uk> wrote:
> 
> > On Sun, 15 Sep 2019 14:57:56 +0900
> > William Breathitt Gray <vilhelm.gray@gmail.com> wrote:
> > 
> > > The count_read and count_write callbacks are simplified to pass val as
> > > unsigned long rather than as an opaque data structure. The opaque
> > > counter_count_read_value and counter_count_write_value structures,
> > > counter_count_value_type enum, and relevant counter_count_read_value_set
> > > and counter_count_write_value_get functions, are removed as they are no
> > > longer used.
> > > 
> > > Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>  
> > 
> > Seems like a sensible bit of excessive abstraction removal to me.  I'm not
> > totally sure why these got so complex in the first place though.
> Ah. I should have read the cover letter rather than just diving in the code :)
> All explained there I see.
> 
> > 
> > Can you recall the reason as it might help to judge why we no longer
> > think the same?
> > 
> > Thanks,
> > 
> > Jonathan

The cover letter probably explains it well enough, but it may be good
anyway for posterity to add on a bit about the origins of the opaque
structures.

If I recall correctly, it was from early on when I had a dedicated set
of functions for "quadrature counters" as opposed to "simple counters"
-- eventually we abandoned that design and decided instead to keep the
interface simple since devices could be represented robustly enough with
just the core Count, Signal, and Synapse components.

I decided to keep the opaque structures anyway in the hope that they
could be used in the future to restrict the attributes exposed to a
certain set of "counter types" defined for the Counter subsystems; i.e.
"position" counters would only expose spatial coordinates, "tally"
counters would expose tally units, etc.

However, I've come to realized that this type of organization is best
left to the userspace application and that the kernelspace code should
instead be focused on maintaining a simple and robust interface for
representing the core concept of a "counter" device.

William Breathitt Gray

  reply	other threads:[~2019-09-15 13:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-15  5:57 [RFC 0/4] counter: Simplify count_read/count_write/signal_read William Breathitt Gray
2019-09-15  5:57 ` [RFC 1/4] counter: Simplify the count_read and count_write callbacks William Breathitt Gray
2019-09-15 13:39   ` Jonathan Cameron
2019-09-15 13:47     ` Jonathan Cameron
2019-09-15 13:58       ` William Breathitt Gray [this message]
2019-09-15  5:57 ` [RFC 2/4] counter: Simplify the signal_read callback William Breathitt Gray
2019-09-15  5:57 ` [RFC 3/4] docs: driver-api: generic-counter: Update Count and Signal data types William Breathitt Gray
2019-09-15  5:57 ` [RFC 4/4] counter: 104-quad-8: Update count_read/count_write/signal_read callbacks William Breathitt Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190915135823.GA445580@icarus \
    --to=vilhelm.gray@gmail.com \
    --cc=jic23@jic23.retrosnub.co.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).