zpa2326.c (c6a677c6f37bb7abc85ba7e3465e82b9f7eb1d91) | zpa2326.c (e7215fe4d51e69c9d2608ad0c409d48e844d0adc) |
---|---|
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 --- 853 unchanged lines hidden (view full) --- 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; | 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 --- 853 unchanged lines hidden (view full) --- 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; |
|
870 871 zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt"); 872 | 871 872 zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt"); 873 |
873 ret = wait_for_completion_interruptible_timeout( | 874 timeout = wait_for_completion_interruptible_timeout( |
874 &private->data_ready, ZPA2326_CONVERSION_JIFFIES); | 875 &private->data_ready, ZPA2326_CONVERSION_JIFFIES); |
875 if (ret > 0) | 876 if (timeout > 0) |
876 /* 877 * Interrupt handler completed before timeout: return operation 878 * status. 879 */ 880 return private->result; 881 882 /* Clear all interrupts just to be sure. */ 883 regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val); 884 | 877 /* 878 * Interrupt handler completed before timeout: return operation 879 * status. 880 */ 881 return private->result; 882 883 /* Clear all interrupts just to be sure. */ 884 regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val); 885 |
885 if (!ret) | 886 if (!timeout) { |
886 /* Timed out. */ | 887 /* Timed out. */ |
888 zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", 889 timeout); |
|
887 ret = -ETIME; | 890 ret = -ETIME; |
891 } else if (timeout < 0) { 892 zpa2326_warn(indio_dev, 893 "wait for one shot interrupt cancelled"); 894 ret = -ERESTARTSYS; 895 } |
|
888 | 896 |
889 if (ret != -ERESTARTSYS) 890 zpa2326_warn(indio_dev, "no one shot interrupt occurred (%d)", 891 ret); 892 | |
893 return ret; 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{ --- 831 unchanged lines hidden --- | 897 return ret; 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{ --- 831 unchanged lines hidden --- |