1. 03 4月, 2016 1 次提交
  2. 12 3月, 2016 1 次提交
    • A
      iio: core: implement iio_device_{claim|release}_direct_mode() · 08a33805
      Alison Schofield 提交于
      It is often the case that the driver wants to be sure a device stays
      in direct mode while it is executing a task or series of tasks.  To
      accomplish this today, the driver performs this sequence: 1) take the
      device state lock, 2) verify it is not in a buffered mode, 3) execute
      some tasks, and 4) release that lock.
      
      This patch introduces a pair of helper functions that simplify these
      steps and make it more semantically expressive.
      
      iio_device_claim_direct_mode()
              If the device is not in any buffered mode it is guaranteed
              to stay that way until iio_release_direct_mode() is called.
      
      iio_device_release_direct_mode()
              Release the claim. Device is no longer guaranteed to stay
              in direct mode.
      Signed-off-by: NAlison Schofield <amsfield22@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      08a33805
  3. 31 1月, 2016 1 次提交
  4. 17 1月, 2016 1 次提交
    • M
      include/linux/kernel.h: change abs() macro so it uses consistent return type · 8f57e4d9
      Michal Nazarewicz 提交于
      Rewrite abs() so that its return type does not depend on the
      architecture and no unexpected type conversion happen inside of it.  The
      only conversion is from unsigned to signed type.  char is left as a
      return type but treated as a signed type regradless of it's actual
      signedness.
      
      With the old version, int arguments were promoted to long and depending
      on architecture a long argument might result in s64 or long return type
      (which may or may not be the same).
      
      This came after some back and forth with Nicolas.  The current macro has
      different return type (for the same input type) depending on
      architecture which might be midly iritating.
      
      An alternative version would promote to int like so:
      
      	#define abs(x)	__abs_choose_expr(x, long long,			\
      			__abs_choose_expr(x, long,			\
      			__builtin_choose_expr(				\
      				sizeof(x) <= sizeof(int),		\
      				({ int __x = (x); __x<0?-__x:__x; }),	\
      				((void)0))))
      
      I have no preference but imagine Linus might.  :] Nicolas argument against
      is that promoting to int causes iconsistent behaviour:
      
      	int main(void) {
      		unsigned short a = 0, b = 1, c = a - b;
      		unsigned short d = abs(a - b);
      		unsigned short e = abs(c);
      		printf("%u %u\n", d, e);  // prints: 1 65535
      	}
      
      Then again, no sane person expects consistent behaviour from C integer
      arithmetic.  ;)
      
      Note:
      
        __builtin_types_compatible_p(unsigned char, char) is always false, and
        __builtin_types_compatible_p(signed char, char) is also always false.
      Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
      Reviewed-by: NNicolas Pitre <nico@linaro.org>
      Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Cc: Wey-Yi Guy <wey-yi.w.guy@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8f57e4d9
  5. 23 12月, 2015 1 次提交
  6. 22 11月, 2015 1 次提交
  7. 15 11月, 2015 1 次提交
  8. 24 9月, 2015 2 次提交
  9. 28 8月, 2015 1 次提交
  10. 16 8月, 2015 1 次提交
  11. 03 8月, 2015 1 次提交
  12. 21 6月, 2015 1 次提交
  13. 23 5月, 2015 1 次提交
  14. 17 5月, 2015 1 次提交
  15. 11 5月, 2015 1 次提交
  16. 09 4月, 2015 1 次提交
  17. 15 3月, 2015 1 次提交
    • M
      iio: core: Fix double free. · c1b03ab5
      Martin Fuzzey 提交于
      When an error occurred during event registration memory was freed twice
      resulting in kernel memory corruption and a crash in unrelated code.
      
      The problem was caused by
      	iio_device_unregister_eventset()
      	iio_device_unregister_sysfs()
      
      being called twice, once on the error path and then
      again via iio_dev_release().
      
      Fix this by making these two functions idempotent so they
      may be called multiple times.
      
      The problem was observed before applying
      	78b33216 iio:core: Handle error when mask type is not separate
      Signed-off-by: NMartin Fuzzey <mfuzzey@parkeon.com>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      c1b03ab5
  18. 30 1月, 2015 1 次提交
  19. 28 1月, 2015 4 次提交
  20. 06 1月, 2015 1 次提交
  21. 26 12月, 2014 1 次提交
  22. 12 12月, 2014 1 次提交
    • L
      iio: Move buffer registration to the core · 3e1b6c95
      Lars-Peter Clausen 提交于
      Originally device and buffer registration were kept as separate operations
      in IIO to allow to register two distinct sets of channels for buffered and
      non-buffered operations. This has since already been further restricted and
      the channel set registered for the buffer needs to be a subset of the
      channel set registered for the device. Additionally the possibility to not
      have a raw (or processed) attribute for a channel which was registered for
      the device was added a while ago. This means it is possible to not register
      any device level attributes for a channel even if it is registered for the
      device. Also if a channel's scan_index is set to -1 and the channel is
      registered for the buffer it is ignored.
      
      So in summary it means it is possible to register the same channel array for
      both the device and the buffer yet still end up with distinctive sets of
      channels for both of them. This makes the argument for having to have to
      manually register the channels for both the device and the buffer invalid.
      Considering that the vast majority of all drivers want to register the same
      set of channels for both the buffer and the device it makes sense to move
      the buffer registration into the core to avoid some boiler-plate code in the
      device driver setup path.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      3e1b6c95
  23. 22 11月, 2014 3 次提交
  24. 20 7月, 2014 1 次提交
  25. 03 5月, 2014 1 次提交
  26. 30 4月, 2014 2 次提交
  27. 17 3月, 2014 1 次提交
    • J
      iio:core: Fix bug in length of event info_mask and catch unhandled bits set in masks. · ef4b4856
      Jonathan Cameron 提交于
      The unhandled bits case was highlighted by smatch:
        CHECK   drivers/iio/industrialio-core.c
      drivers/iio/industrialio-core.c:719 iio_device_add_info_mask_type() error: buffer overflow 'iio_chan_info_postfix' 17 <= 31
        CC [M]  drivers/iio/industrialio-core.o
        CHECK   drivers/iio/industrialio-event.c
      drivers/iio/industrialio-event.c:327 iio_device_add_event() error: buffer overflow 'iio_ev_info_text' 3 <= 3
      
      The incorrect limit for the for_each_set_bit loop was noticed whilst fixing
      this other case.  Note that as we only have 3 possible entries a the moment
      and the value was set to 4, the bug would not have any effect currently.
      It will bite fairly soon though, so best fix it now.
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      ef4b4856
  28. 15 3月, 2014 1 次提交
  29. 18 2月, 2014 3 次提交
  30. 04 12月, 2013 1 次提交
  31. 25 11月, 2013 1 次提交