[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56F8FF5A.6000405@kernel.org>
Date: Mon, 28 Mar 2016 10:54:34 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Irina Tirdea <irina.tirdea@...el.com>, linux-iio@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald <pmeerw@...erw.net>,
Octavian Purdila <octavian.purdila@...el.com>,
Markus Pargmann <mpa@...gutronix.de>,
Srinivas Pandruvada <srinivas.pandruvada@...el.com>
Subject: Re: [PATCH 3/6] iio: gyro: bmg160: use available_scan_masks
On 24/03/16 09:29, Irina Tirdea wrote:
> Use available_scan_masks to allow the iio core to select
> the data to send to userspace depending on which axes are
> enabled, instead of doing this in the driver's interrupt
> handler.
>
> Signed-off-by: Irina Tirdea <irina.tirdea@...el.com>
Applied,
Thanks,
> ---
> drivers/iio/gyro/bmg160_core.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c
> index bbce3b0..8d6e5b1 100644
> --- a/drivers/iio/gyro/bmg160_core.c
> +++ b/drivers/iio/gyro/bmg160_core.c
> @@ -116,6 +116,7 @@ enum bmg160_axis {
> AXIS_X,
> AXIS_Y,
> AXIS_Z,
> + AXIS_MAX,
> };
>
> static const struct {
> @@ -763,6 +764,10 @@ static const struct iio_info bmg160_info = {
> .driver_module = THIS_MODULE,
> };
>
> +static const unsigned long bmg160_accel_scan_masks[] = {
> + BIT(AXIS_X) | BIT(AXIS_Y) | BIT(AXIS_Z),
> + 0};
> +
> static irqreturn_t bmg160_trigger_handler(int irq, void *p)
> {
> struct iio_poll_func *pf = p;
> @@ -772,8 +777,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
> unsigned int val;
>
> mutex_lock(&data->mutex);
> - for_each_set_bit(bit, indio_dev->active_scan_mask,
> - indio_dev->masklength) {
> + for (bit = 0; bit < AXIS_MAX; bit++) {
> ret = regmap_bulk_read(data->regmap, BMG160_AXIS_TO_REG(bit),
> &val, 2);
> if (ret < 0) {
> @@ -1019,6 +1023,7 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
> indio_dev->channels = bmg160_channels;
> indio_dev->num_channels = ARRAY_SIZE(bmg160_channels);
> indio_dev->name = name;
> + indio_dev->available_scan_masks = bmg160_accel_scan_masks;
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->info = &bmg160_info;
>
>
Powered by blists - more mailing lists