All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Alison Schofield <amsfield22@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	gregkh@linuxfoundation.org
Cc: outreachy-kernel@googlegroups.com, linux-iio@vger.kernel.org
Subject: Re: [PATCH] staging: iio: dummy: clean up the define and usage of dummy_scan_elements
Date: Mon, 26 Oct 2015 07:21:49 +0000	[thread overview]
Message-ID: <9FFA453E-8F87-4B4C-9E10-D0641523A032@jic23.retrosnub.co.uk> (raw)
In-Reply-To: <20151026032945.GD2104@Ubuntu-D830>



On 26 October 2015 03:29:46 GMT+00:00, Alison Schofield <amsfield22@gmail.com> wrote:
>On Sun, Oct 25, 2015 at 10:54:29AM +0000, Jonathan Cameron wrote:
>> On 23/10/15 17:54, Alison Schofield wrote:
>> > Cleanups related to the usage of dummy_scan_elements in the
>> > iio dummy driver:
>> > - change enum names to upper case INDEX_*
>> > - use the enum for IIO_CHAN_SOFT_TIMESTAMP (rm hard coded value)
>> > - comment edited to match changes & follow preferred kernel style
>> > 
>> As Greg observed this would be better as three separate patches.
>> Comment inline as well.
>> 
>> Jonathan
>
>Greg, Jonathan,
>
>Thanks for the review.  I understand it needs to be a set. 
>
>I only see 2 patches:
>1) change enum names to be upper case.
>2) replace hardcoded scan_index in IIO_CHAN_SOFT_TIMESTAMP
>
>I don't see the comments as a 3rd, they go with each change.
>ie. when I change the enum names, I update the comments
>right above it to match.  Same with Patch 2.
>
>OK?
There are a few other comment syntax changes that should really be in a third patch, trivial though they are.
>
>alison
>
>> > Signed-off-by: Alison Schofield <amsfield22@gmail.com>
>> > ---
>> >  drivers/staging/iio/iio_simple_dummy.c        | 22
>++++++++++++----------
>> >  drivers/staging/iio/iio_simple_dummy.h        | 20
>+++++++++++---------
>> >  drivers/staging/iio/iio_simple_dummy_buffer.c |  9 +++++----
>> >  3 files changed, 28 insertions(+), 23 deletions(-)
>> > 
>> > diff --git a/drivers/staging/iio/iio_simple_dummy.c
>b/drivers/staging/iio/iio_simple_dummy.c
>> > index 381f90f..5e19068 100644
>> > --- a/drivers/staging/iio/iio_simple_dummy.c
>> > +++ b/drivers/staging/iio/iio_simple_dummy.c
>> > @@ -1,4 +1,4 @@
>> > -/**
>> > +/*
>> >   * Copyright (c) 2011 Jonathan Cameron
>> >   *
>> >   * This program is free software; you can redistribute it and/or
>modify it
>> > @@ -137,7 +137,7 @@ static const struct iio_chan_spec
>iio_dummy_channels[] = {
>> >  		 */
>> >  		.info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ),
>> >  		/* The ordering of elements in the buffer via an enum */
>> > -		.scan_index = voltage0,
>> > +		.scan_index = INDEX_VOLTAGE_0,
>> >  		.scan_type = { /* Description of storage in buffer */
>> >  			.sign = 'u', /* unsigned */
>> >  			.realbits = 13, /* 13 bits */
>> > @@ -176,7 +176,7 @@ static const struct iio_chan_spec
>iio_dummy_channels[] = {
>> >  		 * sampling_frequency
>> >  		 * The frequency in Hz at which the channels are sampled
>> >  		 */
>> > -		.scan_index = diffvoltage1m2,
>> > +		.scan_index = INDEX_DIFFVOLTAGE_1M2,
>> >  		.scan_type = { /* Description of storage in buffer */
>> >  			.sign = 's', /* signed */
>> >  			.realbits = 12, /* 12 bits */
>> > @@ -194,7 +194,7 @@ static const struct iio_chan_spec
>iio_dummy_channels[] = {
>> >  		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>> >  		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
>> >  		.info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ),
>> > -		.scan_index = diffvoltage3m4,
>> > +		.scan_index = INDEX_DIFFVOLTAGE_3M4,
>> >  		.scan_type = {
>> >  			.sign = 's',
>> >  			.realbits = 11,
>> > @@ -221,7 +221,7 @@ static const struct iio_chan_spec
>iio_dummy_channels[] = {
>> >  		BIT(IIO_CHAN_INFO_CALIBSCALE) |
>> >  		BIT(IIO_CHAN_INFO_CALIBBIAS),
>> >  		.info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ),
>> > -		.scan_index = accelx,
>> > +		.scan_index = INDEX_ACCELX,
>> >  		.scan_type = { /* Description of storage in buffer */
>> >  			.sign = 's', /* signed */
>> >  			.realbits = 16, /* 16 bits */
>> > @@ -230,10 +230,10 @@ static const struct iio_chan_spec
>iio_dummy_channels[] = {
>> >  		},
>> >  	},
>> >  	/*
>> > -	 * Convenience macro for timestamps. 4 is the index in
>> > -	 * the buffer.
>> > +	 * Convenience macro for timestamps.
>> > +	 * INDEX_TIMESTAMP is the index in the buffer.
>> >  	 */
>> > -	IIO_CHAN_SOFT_TIMESTAMP(4),
>> > +	IIO_CHAN_SOFT_TIMESTAMP(INDEX_TIMESTAMP),
>> >  	/* DAC channel out_voltage0_raw */
>> >  	{
>> >  		.type = IIO_VOLTAGE,
>> > @@ -364,8 +364,10 @@ static int iio_dummy_read_raw(struct iio_dev
>*indio_dev,
>> >  				ret = IIO_VAL_INT_PLUS_MICRO;
>> >  				break;
>> >  			case 1:
>> > -				/* all differential adc channels ->
>> > -				 * 0.000001344 */
>> > +				/*
>> > +				 * all differential adc
>> > +				 * channels -> 0.000001344
>> > +				 */
>> >  				*val = 0;
>> >  				*val2 = 1344;
>> >  				ret = IIO_VAL_INT_PLUS_NANO;
>> > diff --git a/drivers/staging/iio/iio_simple_dummy.h
>b/drivers/staging/iio/iio_simple_dummy.h
>> > index 5c2f4d0..31b62ad 100644
>> > --- a/drivers/staging/iio/iio_simple_dummy.h
>> > +++ b/drivers/staging/iio/iio_simple_dummy.h
>> > @@ -96,20 +96,22 @@ iio_simple_dummy_events_unregister(struct
>iio_dev *indio_dev)
>> >  
>> >  #endif /* CONFIG_IIO_SIMPLE_DUMMY_EVENTS*/
>> >  
>> > -/**
>> > +/*
>> >   * enum iio_simple_dummy_scan_elements - scan index enum
>> > - * @voltage0:		the single ended voltage channel
>> > - * @diffvoltage1m2:	first differential channel
>> > - * @diffvoltage3m4:	second differenial channel
>> > - * @accelx:		acceleration channel
>> > + * @INDEX_VOLTAGE_0:		the single ended voltage channel
>> > + * @INDEX_DIFFVOLTAGE_1M2:	first differential channel
>> > + * @INDEX_DIFFVOLTAGE_3M4:	second differential channel
>> > + * @INDEX_ACCELX:		acceleration channel
>> > + * @INDEX_TIMESTAMP:		timestamp channel
>> >   *
>> >   * Enum provides convenient numbering for the scan index.
>> >   */
>> >  enum iio_simple_dummy_scan_elements {
>> > -	voltage0,
>> > -	diffvoltage1m2,
>> > -	diffvoltage3m4,
>> > -	accelx,
>> > +	INDEX_VOLTAGE_0,
>> Even better would be to prefix these to make it clear they
>> are driver specific.  With such generic names one might
>> suspect they come from somewhere in the core.
>> 
>> Perhaps
>> DUMMY_INDEX_...
>> ?
>> > +	INDEX_DIFFVOLTAGE_1M2,
>> > +	INDEX_DIFFVOLTAGE_3M4,
>> > +	INDEX_ACCELX,
>> > +	INDEX_TIMESTAMP,
>> >  };
>> >  
>> >  #ifdef CONFIG_IIO_SIMPLE_DUMMY_BUFFER
>> > diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c
>b/drivers/staging/iio/iio_simple_dummy_buffer.c
>> > index 00ed774..7516835 100644
>> > --- a/drivers/staging/iio/iio_simple_dummy_buffer.c
>> > +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c
>> > @@ -27,10 +27,11 @@
>> >  /* Some fake data */
>> >  
>> >  static const s16 fakedata[] = {
>> > -	[voltage0] = 7,
>> > -	[diffvoltage1m2] = -33,
>> > -	[diffvoltage3m4] = -2,
>> > -	[accelx] = 344,
>> > +	[INDEX_VOLTAGE_0] = 7,
>> > +	[INDEX_DIFFVOLTAGE_1M2] = -33,
>> > +	[INDEX_DIFFVOLTAGE_3M4] = -2,
>> > +	[INDEX_ACCELX] = 344,
>> > +	[INDEX_TIMESTAMP] = 50,
>> >  };
>> >  
>> >  /**
>> > 
>> 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

  reply	other threads:[~2015-10-26  7:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23 16:54 [PATCH] staging: iio: dummy: clean up the define and usage of dummy_scan_elements Alison Schofield
2015-10-25  2:33 ` [Outreachy kernel] " Greg KH
2015-10-25 10:54 ` Jonathan Cameron
2015-10-26  3:29   ` Alison Schofield
2015-10-26  7:21     ` Jonathan Cameron [this message]
2015-10-26  8:11 ` Daniel Baluta
2015-10-26 17:20   ` Alison Schofield
2015-10-26 17:32     ` Jonathan Cameron
2015-10-26 20:46 ` [PATCH 0/3] iio: dummy: scan index enum update and clean up Alison Schofield
2015-10-26 20:48   ` [PATCH 1/3] staging: iio: dummy: use uppercase descriptors for enum names Alison Schofield
2015-10-26 20:49   ` [PATCH 2/3] staging: iio: dummy: add the timestamp buffer to the scan index enum Alison Schofield
2015-10-27  5:48     ` [Outreachy kernel] " Greg KH
2015-10-26 20:50   ` [PATCH 3/3] staging: iio: dummy: replace block comment with single line comment Alison Schofield

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=9FFA453E-8F87-4B4C-9E10-D0641523A032@jic23.retrosnub.co.uk \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=amsfield22@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.