16 Oct, 2013

1 commit

  • Usually the active scan mask is freed in __iio_update_buffers() when the buffer
    is disabled. But when the device is still sampling when it is removed we'll end
    up disabling the buffers in iio_disable_all_buffers(). So we also need to free
    the active scan mask here, otherwise it will be leaked.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Jonathan Cameron

    Lars-Peter Clausen
     

21 Sep, 2013

2 commits

  • Make sure to stop sampling when the device is removed, otherwise it will
    continue to sample forever.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Jonathan Cameron

    Lars-Peter Clausen
     
  • if device has available_scan_masks set and the buffer is enabled without
    any scan_elements enabled, in a NULL pointer is dereferenced in iio_compute_scan_bytes()

    [ 18.993713] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    [ 19.002593] pgd = debd4000
    [ 19.005432] [00000000] *pgd=9ebc0831, *pte=00000000, *ppte=00000000
    [ 19.012329] Internal error: Oops: 17 [#1] PREEMPT ARM
    [ 19.017639] Modules linked in:
    [ 19.020843] CPU: 0 Not tainted (3.9.11-00036-g75c888a-dirty #207)
    [ 19.027587] PC is at _find_first_bit_le+0xc/0x2c
    [ 19.032440] LR is at iio_compute_scan_bytes+0x2c/0xf4
    [ 19.037719] pc : [] lr : [] psr: 200d0013
    [ 19.037719] sp : debd9ed0 ip : 00000000 fp : 000802bc
    [ 19.049713] r10: 00000000 r9 : 00000000 r8 : deb67250
    [ 19.055206] r7 : 00000000 r6 : 00000000 r5 : 00000000 r4 : deb67000
    [ 19.062011] r3 : de96ec00 r2 : 00000000 r1 : 00000004 r0 : 00000000
    [ 19.068847] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    [ 19.076324] Control: 10c5387d Table: 9ebd4019 DAC: 00000015

    problem is the rollback code in iio_update_buffers(), old_mask may be NULL (e.g. on first
    call)

    I'm not too confident about the fix; works for me...

    Signed-off-by: Peter Meerwald
    Reviewed-by: Lars-Peter Clausen
    Signed-off-by: Jonathan Cameron

    Peter Meerwald
     

23 May, 2013

1 commit


10 Nov, 2012

1 commit


20 Oct, 2012

1 commit


08 Sep, 2012

1 commit


04 Sep, 2012

1 commit


13 Jul, 2012

1 commit


10 Jul, 2012

2 commits

  • Add a helper function for validating a scan mask for devices where exactly one
    channel must be selected during sampling. This is a common case among devices
    which have scan mask restrictions so it makes sense to provide this function in
    the core.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Jonathan Cameron

    Lars-Peter Clausen
     
  • This is useful for cases where the number of valid scan masks grows
    exponentially, but it is rather easy to check whether a mask is valid or not
    programmatically.

    An example of such a case is a device with multiple ADCs where each ADC has a
    upstream MUX, which allows to select from a number of physical channels.

    +-------+ +-------+
    | | | | --- Channel 1
    | ADC 1 |---| MUX 1 | --- ...
    | | | | --- Channel M
    +-------+ +-------+

    . . .
    . . .
    . . .

    +-------+ +-------+
    | | | | --- Channel M * N + 1
    | ADC N |---| MUX N | --- ...
    | | | | --- Channel M * N + M
    +-------+ +-------+

    The number of necessary scan masks for this case is (M+1)**N - 1, on the other
    hand it is easy to check whether subsets for each ADC of the scanmask have only
    one bit set.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Jonathan Cameron

    Lars-Peter Clausen
     

09 Jul, 2012

1 commit


19 Jun, 2012

1 commit


16 Jun, 2012

1 commit

  • iio_scan_mask_match() returns NULL if the passed in scan mask is empty. This
    will happen if no channel has been selected and buffer is enabled.
    iio_sw_buffer_preenable() will assign NULL to indio_dev->active_scan_mask in
    this case. As a result iio_update_demux() will cause a NULL pointer deref,
    because it expects active_scan_mask to be non-NULL.

    Since it does not make much sense to start data capture if there is no data to
    capture this patch updates the code to fail gracefully in iio_scan_mask_match()
    instead of crashing the kernel.

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Lars-Peter Clausen
     

15 May, 2012

1 commit


26 Apr, 2012

1 commit

  • Take the core support + the kfifo buffer implentation out of
    staging. Whilst we are far from done in improving this subsystem
    it is now at a stage where the userspae interfaces (provided by
    the core) can be considered stable.

    Drivers will follow over a longer time scale.

    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Jonathan Cameron