1. 15 11月, 2013 1 次提交
    • S
      kfifo API type safety · 498d319b
      Stefani Seibold 提交于
      This patch enhances the type safety for the kfifo API.  It is now safe
      to put const data into a non const FIFO and the API will now generate a
      compiler warning when reading from the fifo where the destination
      address is pointing to a const variable.
      
      As a side effect the kfifo_put() does now expect the value of an element
      instead a pointer to the element.  This was suggested Russell King.  It
      make the handling of the kfifo_put easier since there is no need to
      create a helper variable for getting the address of a pointer or to pass
      integers of different sizes.
      
      IMHO the API break is okay, since there are currently only six users of
      kfifo_put().
      
      The code is also cleaner by kicking out the "if (0)" expressions.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: NStefani Seibold <stefani@seibold.net>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Hauke Mehrtens <hauke@hauke-m.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      498d319b
  2. 12 10月, 2013 5 次提交
    • L
      iio: Add a hysteresis event info attribute · ec6670ae
      Lars-Peter Clausen 提交于
      For some devices it is possible to configure a hysteresis for threshold (or
      similar) events. This patch adds a new hysteresis event info type which allows
      for easy creation and read/write handling of the sysfs attribute.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      ec6670ae
    • L
      iio: Extend the event config interface · b4e3ac0a
      Lars-Peter Clausen 提交于
      The event configuration interface of the IIO framework has not been getting the
      same attention as other parts. As a result it has not seen the same improvements
      as e.g. the channel interface has seen with the introduction of the channel spec
      struct. Currently all the event config callbacks take a u64 (the so called event
      code) to pass all the different information about for which event the callback
      is invoked. The callback function then has to extract the information it is
      interested in using some macros with rather long names. Most information encoded
      in the event code comes straight from the iio_chan_spec struct the event was
      registered for. Since we always have a handle to the channel spec when we call
      the event callbacks the first step is to add the channel spec as a parameter to
      the event callbacks. The two remaining things encoded in the event code are the
      type and direction of the event. Instead of passing them in one parameter, add
      one parameter for each of them and remove the eventcode from the event
      callbacks. The patch also adds a new iio_event_info parameter to the
      {read,write}_event_value callbacks. This makes it possible, similar to the
      iio_chan_info_enum for channels, to specify additional properties other than
      just the value for an event. Furthermore the new interface will allow to
      register shared events. This is e.g. useful if a device allows configuring a
      threshold event, but the threshold setting is the same for all channels.
      
      To implement this the patch adds a new iio_event_spec struct which is similar to
      the iio_chan_spec struct. It as two field to specify the type and the direction
      of the event. Furthermore it has a mask field for each one of the different
      iio_shared_by types. These mask fields holds which kind of attributes should be
      registered for the event. Creation of the attributes follows the same rules as
      the for the channel attributes. E.g. for the separate_mask there will be a
      attribute for each channel with this event, for the shared_by_type there will
      only be one attribute per channel type. The iio_chan_spec struct gets two new
      fields, 'event_spec' and 'num_event_specs', which is used to specify which the
      events for this channel. These two fields are going to replace the channel's
      event_mask field.
      
      For now both the old and the new event config interface coexist, but over the
      few patches all drivers will be converted from the old to the new interface.
      Once that is done all code for supporting the old interface will be removed.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      b4e3ac0a
    • L
      iio: Add a helper to free a list of IIO device attributes · 84088ebd
      Lars-Peter Clausen 提交于
      We have the same code to free a IIO device attribute list in multiple place.
      This patch adds a new helper function to take care of this and replaces the
      custom instances with a call to the helper function. Note that we do not need to
      call list_del() for each of the list items since we will never look at any of
      the list items nor the list itself again.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      84088ebd
    • L
      iio: Wakeup poll and blocking reads when the device is unregistered · d2f0a48f
      Lars-Peter Clausen 提交于
      Once the device has been unregistered there won't be any new data no matter how
      long a userspace application waits, so we might as well wake them up and let
      them know.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      d2f0a48f
    • L
      iio: Return -ENODEV for file operations if the device has been unregistered · f18e7a06
      Lars-Peter Clausen 提交于
      If the IIO device has been unregistered return -ENODEV for any further file
      operations like read() and ioctl(). This avoids userspace being able to grab new
      references to the device.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      f18e7a06
  3. 21 9月, 2013 1 次提交
  4. 19 9月, 2013 1 次提交
  5. 16 9月, 2013 1 次提交
  6. 18 3月, 2013 1 次提交
    • L
      iio: events: Make iio_push_event() IRQ context save · 1b9dc91e
      Lars-Peter Clausen 提交于
      Currently it is not save to call iio_push_event() from hard IRQ context since
      the IIO event code uses spin_lock()/spin_unlock() and it is not save to mix
      calls to spin_lock()/spin_unlock() from different contexts on the same lock.
      E.g. if the lock is being held in iio_event_chrdev_read() and an interrupts
      kicks in and the interrupt handler calls iio_push_event() we end uo with a
      deadlock.
      
      This patch updates iio_push_event() to use spin_lock_irqsave()/
      spin_unlock_irqstrestore(), since it can be called from both IRQ and non-IRQ
      context. All other other users of the lock, which are always run in non-IRQ
      context, are updated to spin_lock_irq()/spin_unlock_irq().
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      1b9dc91e
  7. 17 11月, 2012 1 次提交
    • J
      drivers/iio/industrialio-event.c: eliminate possible double free · e3db9ef6
      Julia Lawall 提交于
      The function __iio_add_event_config_attrs is only called once, by the
      function iio_device_register_eventset.  If the call fails,
      iio_device_register_eventset calls __iio_remove_event_config_attrs.  There
      is thus no need for __iio_add_event_config_attrs to also call
      __iio_remove_event_config_attrs on failure.
      
      A simplified version of the semantic match that finds this problem is as
      follows: (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @r@
      identifier f,free,a;
      parameter list[n] ps;
      type T;
      expression e;
      @@
      
      f(ps,T a,...) {
        ... when any
            when != a = e
        if(...) { ... free(a); ... return ...; }
        ... when any
      }
      
      @@
      identifier r.f,r.free;
      expression x,a;
      expression list[r.n] xs;
      @@
      
      * x = f(xs,a,...);
        if (...) { ... free(a); ... return ...; }
      // </smpl>
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      e3db9ef6
  8. 20 10月, 2012 1 次提交
  9. 09 7月, 2012 1 次提交
  10. 15 5月, 2012 1 次提交
  11. 26 4月, 2012 2 次提交
  12. 14 2月, 2012 1 次提交
  13. 10 2月, 2012 5 次提交