[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190409045728.GA2842@icarus>
Date: Tue, 9 Apr 2019 13:57:28 +0900
From: William Breathitt Gray <vilhelm.gray@...il.com>
To: Pavel Machek <pavel@....cz>
Cc: gregkh@...uxfoundation.org, jic23@...nel.org,
linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
fabrice.gasnier@...com, benjamin.gaignard@...com, knaack.h@....de,
lars@...afoo.de, pmeerw@...erw.net, akpm@...ux-foundation.org,
david@...hnology.com, robh+dt@...nel.org, mark.rutland@....com,
shawnguo@...nel.org, leoyang.li@....com, daniel.lezcano@...aro.org,
tglx@...utronix.de, thierry.reding@...il.com, esben@...bendal.dk,
linux-pwm@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
patrick.havelange@...ensium.com,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v10 01/18] counter: Introduce the Generic Counter
interface
On Mon, Apr 08, 2019 at 11:55:15PM +0200, Pavel Machek wrote:
> Hi!
>
> > +const char *const counter_count_direction_str[2] = {
> > + [COUNTER_COUNT_DIRECTION_FORWARD] = "forward",
> > + [COUNTER_COUNT_DIRECTION_BACKWARD] = "backward"
> > +};
> > +EXPORT_SYMBOL_GPL(counter_count_direction_str);
> > +
> > +const char *const counter_count_mode_str[4] = {
> > + [COUNTER_COUNT_MODE_NORMAL] = "normal",
> > + [COUNTER_COUNT_MODE_RANGE_LIMIT] = "range limit",
> > + [COUNTER_COUNT_MODE_NON_RECYCLE] = "non-recycle",
> > + [COUNTER_COUNT_MODE_MODULO_N] = "modulo-n"
> > +};
> > +EXPORT_SYMBOL_GPL(counter_count_mode_str);
>
> Dunno. Exporting const tables saying "forward" and "backward". Can we
> ... somehow make it work without need to export this?
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Right now there are only have 4 counter devices supported in this
patchset, but it is expected that support for a greater variety of
devices will be added. For these future cases, new count directions will
be added to match their functionality.
For example, suppose support for a rotary encoder device is added. These
type of devices do not move forward/backward but rather rotate. In these
cases, the following count directions may be added:
[COUNTER_COUNT_DIRECTION_CLOCKWISE] = "clockwise",
[COUNTER_COUNT_DIRECTION_COUNTERCLOCKWISE] = "counterclockwise"
Or as another example, suppose support for a two-axis precision
positioning table is added. These devices support positioning in a
cartesian coordinate system. In these cases, spatial direction may serve
as useful count directions:
[COUNTER_COUNT_DIRECTION_NORTH] = "north",
[COUNTER_COUNT_DIRECTION_NORTHEAST] = "northeast",
[COUNTER_COUNT_DIRECTION_EAST] = "east",
[COUNTER_COUNT_DIRECTION_SOUTHEAST] = "southeast",
[COUNTER_COUNT_DIRECTION_SOUTH] = "south",
[COUNTER_COUNT_DIRECTION_SOUTHWEST] = "southwest",
[COUNTER_COUNT_DIRECTION_WEST] = "west",
[COUNTER_COUNT_DIRECTION_NORTHWEST] = "northwest"
A const table is conveinent in these scenarios because support for new
count directions may be easily added by simple entry into the table.
William Breathitt Gray
Powered by blists - more mailing lists