lkml.org 
[lkml]   [2019]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-04-09 06:57    [W:0.076 / U:8.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site