1. 04 9月, 2012 1 次提交
  2. 11 7月, 2012 1 次提交
  3. 30 6月, 2012 2 次提交
  4. 07 6月, 2012 1 次提交
  5. 05 6月, 2012 2 次提交
    • L
      iio: Add helper functions for enum style channel attributes · 5212cc8a
      Lars-Peter Clausen 提交于
      We often have the case were we do have a enum style channel attribute. These
      attributes have in common that they are a list of string values which usually
      map in a 1-to-1 fashion to integer values.
      
      This patch implements some common helper code for implementing enum style
      channel attributes using extended channel attributes. The helper functions take
      care of converting between the string and integer values, as well providing a
      function for "_available" attributes which list all available enum items.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Acked-by: NJonathan Cameron <jic23@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5212cc8a
    • L
      iio: Fix potential use after free · e407fd65
      Lars-Peter Clausen 提交于
      There is no guarantee that the last reference to the iio device has already been
      dropped when iio_device_free is called. This means that we can up calling
      iio_dev_release after iio_device_free which will lead to a use after free. As
      the general rule the struct containing the device should always be freed in the
      release callback.
      
      This is what this patch does, it moves freeing the iio device struct as well as
      releasing the idr reference to the release callback. To ensure that the device
      is not freed before calling iio_device_free the device_unregister call in
      iio_device_unregister is broken apart. iio_device_unregister will now only call
      device_del to remove the device from the system and iio_device_free will call
      put_device to drop the reference we obtained in iio_devce_alloc.
      
      We also have to take care that calling iio_device_free without having called
      iio_device_register still works (i.e. this can happen if something failed during
      device initialization). For this to work properly two minor changes were
      necessary: channel_attr_list needs to be initialized in iio_device_alloc and we
      have to check whether the chrdev has been registered before releasing it in
      iio_device_release.
      
      This change also brings iio_device_unregister and iio_device_free more in sync
      with iio_device_register and iio_device_alloc which call device_add and
      device_initialize respectively.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Acked-by: NJonathan Cameron <jic23@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e407fd65
  6. 15 5月, 2012 3 次提交
  7. 09 5月, 2012 2 次提交
  8. 30 4月, 2012 3 次提交
  9. 26 4月, 2012 2 次提交
  10. 19 4月, 2012 3 次提交
  11. 14 4月, 2012 1 次提交
  12. 08 3月, 2012 1 次提交
  13. 03 3月, 2012 3 次提交
  14. 25 2月, 2012 2 次提交
    • L
      staging:iio: Add extended IIO channel info · 5f420b42
      Lars-Peter Clausen 提交于
      Sometimes devices have per channel properties which either do not map nicely to
      the current channel info scheme (e.g. string properties) or are very device
      specific, so it does not make sense to add generic support for them.
      
      Currently drivers define these attributes by hand for each channel. Depending on
      the number of channels this can amount to quite a few lines of boilerplate code.
      Especially if a driver supports multiple variations of a chip with different
      numbers of channels. In this case it becomes necessary to have a individual
      attribute list per chip variation and also a individual iio_info struct.
      
      This patch introduces a new scheme for handling such per channel attributes
      called extended channel info attributes. A extended channel info attribute
      consist of a name, a flag whether it is shared and read and write callbacks.
      The read and write callbacks are similar to the {read,write}_raw callbacks and
      take a IIO device and a channel as their first parameters, but instead of
      pre-parsed integer values they directly get passed the raw string value, which
      has been written to the sysfs file.
      
      It is possible to assign a list of extended channel info attributes to a
      channel. For each extended channel info attribute the IIO core will create a new
      sysfs attribute conforming to the IIO channel naming spec for the channels type,
      similar as for normal info attributes. Read and write access to this sysfs
      attribute will be redirected to the extended channel info attributes read and
      write callbacks.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Acked-by: NJonathan Cameron <jic23@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f420b42
    • J
      staging:iio:core set the iio_dev.info pointer to null on unregister under lock. · ac917a81
      Jonathan Cameron 提交于
      This prevents use of provider callbacks after it has been unregistered.
      Note that all code using this that can be called from a consumer *must*
      check the pointer before using and hold the info_exist_lock throughout
      the usage of the callbacks in info.
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac917a81
  15. 10 2月, 2012 2 次提交
  16. 23 12月, 2011 2 次提交
  17. 09 12月, 2011 1 次提交
  18. 30 11月, 2011 1 次提交
  19. 28 11月, 2011 1 次提交
  20. 27 11月, 2011 6 次提交