[PATCH v2 4/7] iio: adc: palmas: move eventX_enable into palmas_adc_event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It just makes more sense to have all information regarding adc events in
one place.

Signed-off-by: Patrik Dahlström <risca@xxxxxxxxxxxxxx>
---
 drivers/iio/adc/palmas_gpadc.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c
index fca455a4285e..f7eb445495b6 100644
--- a/drivers/iio/adc/palmas_gpadc.c
+++ b/drivers/iio/adc/palmas_gpadc.c
@@ -77,6 +77,7 @@ static struct palmas_gpadc_info palmas_gpadc_info[] = {
 };
 
 struct palmas_adc_event {
+	bool enabled;
 	int channel;
 	int raw_thresh;
 	enum iio_event_direction direction;
@@ -119,8 +120,6 @@ struct palmas_gpadc {
 	struct completion		conv_completion;
 	struct palmas_adc_event		event0;
 	struct palmas_adc_event		event1;
-	bool				event0_enable;
-	bool				event1_enable;
 	int				auto_conversion_period;
 	struct mutex			lock;
 };
@@ -616,7 +615,7 @@ static int palmas_adc_configure_events(struct palmas_gpadc *adc)
 	}
 
 	conv = 0;
-	if (adc->event0_enable) {
+	if (adc->event0.enabled) {
 		struct palmas_adc_event *ev = &adc->event0;
 		int polarity;
 
@@ -652,7 +651,7 @@ static int palmas_adc_configure_events(struct palmas_gpadc *adc)
 		}
 	}
 
-	if (adc->event1_enable) {
+	if (adc->event1.enabled) {
 		struct palmas_adc_event *ev = &adc->event1;
 		int polarity;
 
@@ -727,7 +726,7 @@ static int palmas_gpadc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct palmas_gpadc *adc = iio_priv(indio_dev);
-	int wakeup = adc->event0_enable || adc->event1_enable;
+	int wakeup = adc->event0.enabled || adc->event1.enabled;
 	int ret;
 
 	if (!device_may_wakeup(dev) || !wakeup)
@@ -737,10 +736,10 @@ static int palmas_gpadc_suspend(struct device *dev)
 	if (ret < 0)
 		return ret;
 
-	if (adc->event0_enable)
+	if (adc->event0.enabled)
 		enable_irq_wake(adc->irq_auto_0);
 
-	if (adc->event1_enable)
+	if (adc->event1.enabled)
 		enable_irq_wake(adc->irq_auto_1);
 
 	return 0;
@@ -750,7 +749,7 @@ static int palmas_gpadc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct palmas_gpadc *adc = iio_priv(indio_dev);
-	int wakeup = adc->event0_enable || adc->event1_enable;
+	int wakeup = adc->event0.enabled || adc->event1.enabled;
 	int ret;
 
 	if (!device_may_wakeup(dev) || !wakeup)
@@ -760,10 +759,10 @@ static int palmas_gpadc_resume(struct device *dev)
 	if (ret < 0)
 		return ret;
 
-	if (adc->event0_enable)
+	if (adc->event0.enabled)
 		disable_irq_wake(adc->irq_auto_0);
 
-	if (adc->event1_enable)
+	if (adc->event1.enabled)
 		disable_irq_wake(adc->irq_auto_1);
 
 	return 0;
-- 
2.25.1





[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux