zpa2326.c (0d9c2ff1c9f7f8b339fc42ac9763b28c71f1c115) | zpa2326.c (f61dfff2f5b9fcb087bf5c444bc44b444709588f) |
---|---|
1/* 2 * Murata ZPA2326 pressure and temperature sensor IIO driver 3 * 4 * Copyright (c) 2016 Parrot S.A. 5 * 6 * Author: Gregor Boirie <gregor.boirie@parrot.com> 7 * 8 * This program is free software; you can redistribute it and/or modify it --- 851 unchanged lines hidden (view full) --- 860 * @indio_dev: The IIO device associated with the sampling hardware. 861 * @private: Internal private state related to @indio_dev. 862 * 863 * Return: Zero when successful, a negative error code otherwise. 864 */ 865static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev, 866 struct zpa2326_private *private) 867{ | 1/* 2 * Murata ZPA2326 pressure and temperature sensor IIO driver 3 * 4 * Copyright (c) 2016 Parrot S.A. 5 * 6 * Author: Gregor Boirie <gregor.boirie@parrot.com> 7 * 8 * This program is free software; you can redistribute it and/or modify it --- 851 unchanged lines hidden (view full) --- 860 * @indio_dev: The IIO device associated with the sampling hardware. 861 * @private: Internal private state related to @indio_dev. 862 * 863 * Return: Zero when successful, a negative error code otherwise. 864 */ 865static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev, 866 struct zpa2326_private *private) 867{ |
868 int ret; | |
869 unsigned int val; 870 long timeout; 871 872 zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt"); 873 874 timeout = wait_for_completion_interruptible_timeout( 875 &private->data_ready, ZPA2326_CONVERSION_JIFFIES); 876 if (timeout > 0) --- 5 unchanged lines hidden (view full) --- 882 883 /* Clear all interrupts just to be sure. */ 884 regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val); 885 886 if (!timeout) { 887 /* Timed out. */ 888 zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", 889 timeout); | 868 unsigned int val; 869 long timeout; 870 871 zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt"); 872 873 timeout = wait_for_completion_interruptible_timeout( 874 &private->data_ready, ZPA2326_CONVERSION_JIFFIES); 875 if (timeout > 0) --- 5 unchanged lines hidden (view full) --- 881 882 /* Clear all interrupts just to be sure. */ 883 regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val); 884 885 if (!timeout) { 886 /* Timed out. */ 887 zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", 888 timeout); |
890 ret = -ETIME; 891 } else if (timeout < 0) { 892 zpa2326_warn(indio_dev, 893 "wait for one shot interrupt cancelled"); 894 ret = -ERESTARTSYS; | 889 return -ETIME; |
895 } 896 | 890 } 891 |
897 return ret; | 892 zpa2326_warn(indio_dev, "wait for one shot interrupt cancelled"); 893 return -ERESTARTSYS; |
898} 899 900static int zpa2326_init_managed_irq(struct device *parent, 901 struct iio_dev *indio_dev, 902 struct zpa2326_private *private, 903 int irq) 904{ 905 int err; --- 830 unchanged lines hidden --- | 894} 895 896static int zpa2326_init_managed_irq(struct device *parent, 897 struct iio_dev *indio_dev, 898 struct zpa2326_private *private, 899 int irq) 900{ 901 int err; --- 830 unchanged lines hidden --- |