From: Jonathan Cameron <jic23@cam.ac.uk>
To: Bryan Freed <bfreed@chromium.org>
Cc: linux-kernel@vger.kernel.org, jbrenner@taosinc.com,
gregkh@suse.de, arnd@arndb.de,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 2/3] light sensor: Fix a panic in the tsl2563 driver.
Date: Wed, 22 Jun 2011 10:07:26 +0100 [thread overview]
Message-ID: <4E01B0CE.4050400@cam.ac.uk> (raw)
In-Reply-To: <1308696897-25161-2-git-send-email-bfreed@chromium.org>
> Add a wrapper for this driver around the IIO_CHAN() wrapper to make channel
> parameters more readable. This fixes a panic caused by the info_masks being
> accidentally passed in as channel2 parameters which easily surpass the size
> of the iio_modifier_names_light array.
Good change (particularly as it's my bug in the first place - oops!).
Thanks,
>
> Signed-off-by: Bryan Freed <bfreed@chromium.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
> drivers/staging/iio/light/tsl2563.c | 17 +++++++++--------
> 1 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c
> index 04aa155..d9be19c 100644
> --- a/drivers/staging/iio/light/tsl2563.c
> +++ b/drivers/staging/iio/light/tsl2563.c
> @@ -570,15 +570,16 @@ error_ret:
> return ret;
> }
>
> +#define INFO_MASK (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE)
> +#define EVENT_MASK (IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) | \
> + IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING))
> +#define IIO_CHAN_2563(type, mod, proc, chan, imask, emask) \
> + IIO_CHAN(type, mod, 1, proc, NULL, chan, 0, imask, 0, 0, {}, emask)
> +
> static const struct iio_chan_spec tsl2563_channels[] = {
> - IIO_CHAN(IIO_LIGHT, 0, 1, 1, NULL, 0, 0, 0, 0, 0, {}, 0),
> - IIO_CHAN(IIO_INTENSITY, 1, 1, 0, "both", 0,
> - (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE), 0, 0, 0, {},
> - IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) |
> - IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING)),
> - IIO_CHAN(IIO_INTENSITY, 1, 1, 0, "ir", 1,
> - (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE), 0, 0, 0, {},
> - 0)
> + IIO_CHAN_2563(IIO_LIGHT, 0, 1, 0, 0, 0),
> + IIO_CHAN_2563(IIO_INTENSITY, 1, 0, 0, INFO_MASK, EVENT_MASK),
> + IIO_CHAN_2563(IIO_INTENSITY, 1, 0, 1, INFO_MASK, 0),
> };
>
> static int tsl2563_read_thresh(struct iio_dev *indio_dev,
next prev parent reply other threads:[~2011-06-22 8:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-21 22:54 [PATCH 1/3] light sensor: Add SMBUS support to the tsl2563 driver Bryan Freed
2011-06-21 22:54 ` [PATCH 2/3] light sensor: Fix a panic in " Bryan Freed
2011-06-22 9:07 ` Jonathan Cameron [this message]
2011-06-21 22:54 ` [PATCH 3/3] " Bryan Freed
2011-06-22 9:09 ` Jonathan Cameron
2011-06-22 9:05 ` [PATCH 1/3] light sensor: Add SMBUS support to " Jonathan Cameron
2011-06-22 14:10 ` Jean Delvare
2011-06-22 15:53 ` Jonathan Cameron
2011-06-22 16:16 ` Jean Delvare
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=4E01B0CE.4050400@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=arnd@arndb.de \
--cc=bfreed@chromium.org \
--cc=gregkh@suse.de \
--cc=jbrenner@taosinc.com \
--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 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.