From: Jonathan Cameron <jic23@kernel.org>
To: Martin Kepplinger <martink@posteo.de>,
knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
christoph.muellner@theobroma-systems.com, mfuzzey@parkeon.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Subject: Re: [PATCH 2/3] iio: mma8452: use enum for channel index
Date: Sat, 19 Dec 2015 16:46:15 +0000 [thread overview]
Message-ID: <567589D7.7060609@kernel.org> (raw)
In-Reply-To: <1450197901-9826-3-git-send-email-martink@posteo.de>
On 15/12/15 16:45, Martin Kepplinger wrote:
> This gets rid of some magic numbers by adding an enum.
>
> Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Applied to the togreg branch of iio.git - initially pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/accel/mma8452.c | 39 +++++++++++++++++++++++----------------
> 1 file changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 162bbef..ccc632a 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -143,6 +143,13 @@ struct mma_chip_info {
> u8 ev_count;
> };
>
> +enum {
> + idx_x,
> + idx_y,
> + idx_z,
> + idx_ts,
> +};
> +
> static int mma8452_drdy(struct mma8452_data *data)
> {
> int tries = 150;
> @@ -816,31 +823,31 @@ static struct attribute_group mma8452_event_attribute_group = {
> }
>
> static const struct iio_chan_spec mma8452_channels[] = {
> - MMA8452_CHANNEL(X, 0, 12),
> - MMA8452_CHANNEL(Y, 1, 12),
> - MMA8452_CHANNEL(Z, 2, 12),
> - IIO_CHAN_SOFT_TIMESTAMP(3),
> + MMA8452_CHANNEL(X, idx_x, 12),
> + MMA8452_CHANNEL(Y, idx_y, 12),
> + MMA8452_CHANNEL(Z, idx_z, 12),
> + IIO_CHAN_SOFT_TIMESTAMP(idx_ts),
> };
>
> static const struct iio_chan_spec mma8453_channels[] = {
> - MMA8452_CHANNEL(X, 0, 10),
> - MMA8452_CHANNEL(Y, 1, 10),
> - MMA8452_CHANNEL(Z, 2, 10),
> - IIO_CHAN_SOFT_TIMESTAMP(3),
> + MMA8452_CHANNEL(X, idx_x, 10),
> + MMA8452_CHANNEL(Y, idx_y, 10),
> + MMA8452_CHANNEL(Z, idx_z, 10),
> + IIO_CHAN_SOFT_TIMESTAMP(idx_ts),
> };
>
> static const struct iio_chan_spec mma8652_channels[] = {
> - MMA8652_CHANNEL(X, 0, 12),
> - MMA8652_CHANNEL(Y, 1, 12),
> - MMA8652_CHANNEL(Z, 2, 12),
> - IIO_CHAN_SOFT_TIMESTAMP(3),
> + MMA8652_CHANNEL(X, idx_x, 12),
> + MMA8652_CHANNEL(Y, idx_y, 12),
> + MMA8652_CHANNEL(Z, idx_z, 12),
> + IIO_CHAN_SOFT_TIMESTAMP(idx_ts),
> };
>
> static const struct iio_chan_spec mma8653_channels[] = {
> - MMA8652_CHANNEL(X, 0, 10),
> - MMA8652_CHANNEL(Y, 1, 10),
> - MMA8652_CHANNEL(Z, 2, 10),
> - IIO_CHAN_SOFT_TIMESTAMP(3),
> + MMA8652_CHANNEL(X, idx_x, 10),
> + MMA8652_CHANNEL(Y, idx_y, 10),
> + MMA8652_CHANNEL(Z, idx_z, 10),
> + IIO_CHAN_SOFT_TIMESTAMP(idx_ts),
> };
>
> enum {
>
next prev parent reply other threads:[~2015-12-19 16:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 16:44 [PATCHv2 0/3] iio: mma8452: cleanup and freefall mode Martin Kepplinger
2015-12-15 16:44 ` [PATCH 1/3] iio: mma8452: remove unused register description Martin Kepplinger
2015-12-19 16:45 ` Jonathan Cameron
2015-12-15 16:45 ` [PATCH 2/3] iio: mma8452: use enum for channel index Martin Kepplinger
2015-12-19 16:46 ` Jonathan Cameron [this message]
2015-12-15 16:45 ` [PATCH 3/3] iio: mma8452: add freefall detection for Freescale's accelerometers Martin Kepplinger
2015-12-19 16:59 ` Jonathan Cameron
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=567589D7.7060609@kernel.org \
--to=jic23@kernel.org \
--cc=christoph.muellner@theobroma-systems.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.kepplinger@theobroma-systems.com \
--cc=martink@posteo.de \
--cc=mfuzzey@parkeon.com \
--cc=pmeerw@pmeerw.net \
/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.