All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hennerich, Michael" <Michael.Hennerich@analog.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: RE: [PATCH 13/16] staging;iio:adc:ad7606 use iio_sw_buffer_preenable rather than local equiv
Date: Mon, 26 Sep 2011 08:42:33 +0100	[thread overview]
Message-ID: <544AC56F16B56944AEC3BD4E3D59177146E7272AE5@LIMKCMBX1.ad.analog.com> (raw)
In-Reply-To: <1316779302-12357-14-git-send-email-jic23@cam.ac.uk>

Jonathan Cameron wrote on 2011-09-23:
> Other than a few slight refactorings the local version was pretty
> standard so replace it and rework to get rid of st->d_size which it
> setup.
>
> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>  drivers/staging/iio/adc/ad7606.h      |    1 -
>  drivers/staging/iio/adc/ad7606_ring.c |   42 +++++--------------------
>  ------- 2 files changed, 7 insertions(+), 36 deletions(-)
> diff --git a/drivers/staging/iio/adc/ad7606.h
> b/drivers/staging/iio/adc/ad7606.h index 8fc259f..bc95f09 100644 ---
> a/drivers/staging/iio/adc/ad7606.h +++
> b/drivers/staging/iio/adc/ad7606.h @@ -68,7 +68,6 @@ struct ad7606_state
> {
>       struct regulator                *reg;   struct work_struct         =
     poll_work;
>       wait_queue_head_t               wq_data_avail; -        size_t     =
                     d_size;         const struct
>  ad7606_bus_ops       *bops;  int                             irq;    uns=
igned                        id;
> diff --git a/drivers/staging/iio/adc/ad7606_ring.c
> b/drivers/staging/iio/adc/ad7606_ring.c index f0742d6..20927fd 100644
> --- a/drivers/staging/iio/adc/ad7606_ring.c +++
> b/drivers/staging/iio/adc/ad7606_ring.c @@ -43,37 +43,6 @@ error_ret:
>  }
>
>  /**
> - * ad7606_ring_preenable() setup the parameters of the ring before
> enabling - * - * The complex nature of the setting of the nuber of bytes
> per datum is due - * to this driver currently ensuring that the
> timestamp is stored at an 8 - * byte boundary. - **/ -static int
> ad7606_ring_preenable(struct iio_dev *indio_dev) -{ - struct
> ad7606_state *st =3D iio_priv(indio_dev); -     struct iio_buffer *ring =
=3D
> indio_dev->buffer; -  size_t d_size; - -      d_size =3D
> st->chip_info->num_channels * -
> st->chip_info->channels[0].scan_type.storagebits / 8; - -     if
> (ring->scan_timestamp) { -            d_size +=3D sizeof(s64); - -       =
       if (d_size %
> sizeof(s64)) -                        d_size +=3D sizeof(s64) - (d_size %=
 sizeof(s64)); -       } -
> -     if (ring->access->set_bytes_per_datum)
> -             ring->access->set_bytes_per_datum(ring, d_size); - -    st-=
>d_size =3D
> d_size; - -   return 0; -} - -/**
>   * ad7606_trigger_handler_th() th/bh of trigger launched polling to
>   ring buffer * **/
> @@ -106,7 +75,8 @@ static void ad7606_poll_bh_to_ring(struct
> work_struct *work_s)
>       __u8 *buf;
>       int ret;
> -     buf =3D kzalloc(st->d_size, GFP_KERNEL);
> +     buf =3D kzalloc(ring->access->get_bytes_per_datum(ring),
> +                   GFP_KERNEL);
>       if (buf =3D=3D NULL)
>               return;
> @@ -137,8 +107,8 @@ static void ad7606_poll_bh_to_ring(struct
> work_struct *work_s)
>       time_ns =3D iio_get_time_ns();
>
>       if (ring->scan_timestamp)
> -             memcpy(buf + st->d_size - sizeof(s64),
> -                     &time_ns, sizeof(time_ns));
> +             *((s64 *)(buf + ring->access->get_bytes_per_datum(ring) -
> +                       sizeof(s64))) =3D time_ns;
>
>       ring->access->store_to(indio_dev->buffer, buf, time_ns); done: @@
>  -148,7 +118,7 @@ done: }
>
>  static const struct iio_buffer_setup_ops ad7606_ring_setup_ops =3D {
> -     .preenable =3D &ad7606_ring_preenable,
> +     .preenable =3D &iio_sw_buffer_preenable,
>       .postenable =3D &iio_triggered_buffer_postenable,
>       .predisable =3D &iio_triggered_buffer_predisable,
>  };
> @@ -166,6 +136,8 @@ int ad7606_register_ring_funcs_and_init(struct
> iio_dev *indio_dev)
>
>       /* Effectively select the ring buffer implementation */
>       indio_dev->buffer->access =3D &ring_sw_access_funcs;
> +     indio_dev->buffer->bpe =3D
> +             st->chip_info->channels[0].scan_type.storagebits / 8;
        indio_dev->pollfunc =3D iio_alloc_pollfunc(&ad7606_trigger_handler_=
th_bh,
                                                 &ad7606_trigger_handler_th=
_bh,                                                  0,

Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Mar=
garet Seif

  reply	other threads:[~2011-09-26  7:42 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23 12:01 [PATCH 00/16] staging:iio:adc cleanups / fixes Jonathan Cameron
2011-09-23 12:01 ` [PATCH 01/16] staging:iio:adc:ad799x fix incorrect scan_type descriptions Jonathan Cameron
2011-09-23 12:01 ` [PATCH 02/16] staging:iio:adc:ad799x stop using IIO_CHAN macro Jonathan Cameron
2011-09-26  7:40   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 03/16] staging:iio:adc:ad799x fix incorrect setting of configuration register on single channel read Jonathan Cameron
2011-09-26  7:24   ` Hennerich, Michael
2011-09-26  8:31     ` Jonathan Cameron
2011-09-23 12:01 ` [PATCH 04/16] staging:iio:adc:ad799x trivial: use the convenient chan struct Jonathan Cameron
2011-09-26  7:32   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 05/16] staging:iio:adc:ad799x use a table for frequency values rather than big switch Jonathan Cameron
2011-09-26  7:25   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 06/16] staging:iio:adc:ad799x avoid bouncing back and forth from iio_priv space Jonathan Cameron
2011-09-26  7:29   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 07/16] staging:iio:adc:ad799x use the core handling for as much of the events as possible Jonathan Cameron
2011-09-26  7:51   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 08/16] staging:iio:adc:ad799x set the device name only once Jonathan Cameron
2011-09-26  7:25   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 09/16] staging:iio:adc:ad799x address and scan_index always match so stop using address Jonathan Cameron
2011-09-26  7:32   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 10/16] staging:iio:adc:ad7606 add local define for chan_spec structures Jonathan Cameron
2011-09-26  7:40   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 11/16] staging:iio:adc:ad7606 trivial code style fix Jonathan Cameron
2011-09-26  7:33   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 12/16] staging:iio:adc:ad7606 make gpio request failures more consistent Jonathan Cameron
2011-09-26  7:37   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 13/16] staging;iio:adc:ad7606 use iio_sw_buffer_preenable rather than local equiv Jonathan Cameron
2011-09-26  7:42   ` Hennerich, Michael [this message]
2011-09-23 12:01 ` [PATCH 14/16] staging:iio:adc:ad7606 refactor to remove st->irq and st->id Jonathan Cameron
2011-09-26  7:38   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 15/16] staging:iio:adc:ad7606 remove unused chip info elements Jonathan Cameron
2011-09-26  7:40   ` Hennerich, Michael
2011-09-23 12:01 ` [PATCH 16/16] staging:iio:adc:ad7887 stop using IIO_CHAN macro Jonathan Cameron
2011-09-26  7:39   ` Hennerich, Michael
2011-09-26  7:55 ` [PATCH 00/16] staging:iio:adc cleanups / fixes Hennerich, Michael
2011-09-26  8:34   ` Jonathan Cameron
2011-09-27  6:17     ` Hennerich, Michael
2011-09-27  8:58 ` 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=544AC56F16B56944AEC3BD4E3D59177146E7272AE5@LIMKCMBX1.ad.analog.com \
    --to=michael.hennerich@analog.com \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@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.