* [PATCH 1/1] ad5820: Use bool for boolean values
@ 2016-09-05 7:47 Sakari Ailus
0 siblings, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2016-09-05 7:47 UTC (permalink / raw)
To: linux-media; +Cc: mchehab, pavel
The driver used integers for what boolean would have been a better fit.
Use boolean instead.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/ad5820.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c
index d7ad5c1..a9382d1 100644
--- a/drivers/media/i2c/ad5820.c
+++ b/drivers/media/i2c/ad5820.c
@@ -58,7 +58,7 @@ struct ad5820_device {
struct mutex power_lock;
int power_count;
- unsigned int standby : 1;
+ bool standby;
};
static int ad5820_write(struct ad5820_device *coil, u16 data)
@@ -108,7 +108,7 @@ static int ad5820_update_hw(struct ad5820_device *coil)
/*
* Power handling
*/
-static int ad5820_power_off(struct ad5820_device *coil, int standby)
+static int ad5820_power_off(struct ad5820_device *coil, bool standby)
{
int ret = 0, ret2;
@@ -117,7 +117,7 @@ static int ad5820_power_off(struct ad5820_device *coil, int standby)
* (single power line control for both coil and sensor).
*/
if (standby) {
- coil->standby = 1;
+ coil->standby = true;
ret = ad5820_update_hw(coil);
}
@@ -127,7 +127,7 @@ static int ad5820_power_off(struct ad5820_device *coil, int standby)
return ret2;
}
-static int ad5820_power_on(struct ad5820_device *coil, int restore)
+static int ad5820_power_on(struct ad5820_device *coil, bool restore)
{
int ret;
@@ -137,7 +137,7 @@ static int ad5820_power_on(struct ad5820_device *coil, int restore)
if (restore) {
/* Restore the hardware settings. */
- coil->standby = 0;
+ coil->standby = false;
ret = ad5820_update_hw(coil);
if (ret)
goto fail;
@@ -145,7 +145,7 @@ static int ad5820_power_on(struct ad5820_device *coil, int restore)
return 0;
fail:
- coil->standby = 1;
+ coil->standby = true;
regulator_disable(coil->vana);
return ret;
@@ -227,7 +227,8 @@ ad5820_set_power(struct v4l2_subdev *subdev, int on)
* update the power state.
*/
if (coil->power_count == !on) {
- ret = on ? ad5820_power_on(coil, 1) : ad5820_power_off(coil, 1);
+ ret = on ? ad5820_power_on(coil, true) :
+ ad5820_power_off(coil, false);
if (ret < 0)
goto done;
}
@@ -279,7 +280,7 @@ static int ad5820_suspend(struct device *dev)
if (!coil->power_count)
return 0;
- return ad5820_power_off(coil, 0);
+ return ad5820_power_off(coil, false);
}
static int ad5820_resume(struct device *dev)
@@ -291,7 +292,7 @@ static int ad5820_resume(struct device *dev)
if (!coil->power_count)
return 0;
- return ad5820_power_on(coil, 1);
+ return ad5820_power_on(coil, true);
}
#else
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/1] ad5820: Use bool for boolean values
@ 2016-09-06 9:35 Sakari Ailus
2016-09-07 19:00 ` Pavel Machek
0 siblings, 1 reply; 3+ messages in thread
From: Sakari Ailus @ 2016-09-06 9:35 UTC (permalink / raw)
To: linux-media; +Cc: pavel, mchehab, Sakari Ailus
The driver used integers for what boolean would have been a better fit.
Use boolean instead.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/ad5820.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c
index d7ad5c1..fd4c5f6 100644
--- a/drivers/media/i2c/ad5820.c
+++ b/drivers/media/i2c/ad5820.c
@@ -58,7 +58,7 @@ struct ad5820_device {
struct mutex power_lock;
int power_count;
- unsigned int standby : 1;
+ bool standby;
};
static int ad5820_write(struct ad5820_device *coil, u16 data)
@@ -108,7 +108,7 @@ static int ad5820_update_hw(struct ad5820_device *coil)
/*
* Power handling
*/
-static int ad5820_power_off(struct ad5820_device *coil, int standby)
+static int ad5820_power_off(struct ad5820_device *coil, bool standby)
{
int ret = 0, ret2;
@@ -117,7 +117,7 @@ static int ad5820_power_off(struct ad5820_device *coil, int standby)
* (single power line control for both coil and sensor).
*/
if (standby) {
- coil->standby = 1;
+ coil->standby = true;
ret = ad5820_update_hw(coil);
}
@@ -127,7 +127,7 @@ static int ad5820_power_off(struct ad5820_device *coil, int standby)
return ret2;
}
-static int ad5820_power_on(struct ad5820_device *coil, int restore)
+static int ad5820_power_on(struct ad5820_device *coil, bool restore)
{
int ret;
@@ -137,7 +137,7 @@ static int ad5820_power_on(struct ad5820_device *coil, int restore)
if (restore) {
/* Restore the hardware settings. */
- coil->standby = 0;
+ coil->standby = false;
ret = ad5820_update_hw(coil);
if (ret)
goto fail;
@@ -145,7 +145,7 @@ static int ad5820_power_on(struct ad5820_device *coil, int restore)
return 0;
fail:
- coil->standby = 1;
+ coil->standby = true;
regulator_disable(coil->vana);
return ret;
@@ -227,7 +227,8 @@ ad5820_set_power(struct v4l2_subdev *subdev, int on)
* update the power state.
*/
if (coil->power_count == !on) {
- ret = on ? ad5820_power_on(coil, 1) : ad5820_power_off(coil, 1);
+ ret = on ? ad5820_power_on(coil, true) :
+ ad5820_power_off(coil, true);
if (ret < 0)
goto done;
}
@@ -279,7 +280,7 @@ static int ad5820_suspend(struct device *dev)
if (!coil->power_count)
return 0;
- return ad5820_power_off(coil, 0);
+ return ad5820_power_off(coil, false);
}
static int ad5820_resume(struct device *dev)
@@ -291,7 +292,7 @@ static int ad5820_resume(struct device *dev)
if (!coil->power_count)
return 0;
- return ad5820_power_on(coil, 1);
+ return ad5820_power_on(coil, true);
}
#else
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] ad5820: Use bool for boolean values
2016-09-06 9:35 [PATCH 1/1] ad5820: Use bool for boolean values Sakari Ailus
@ 2016-09-07 19:00 ` Pavel Machek
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2016-09-07 19:00 UTC (permalink / raw)
To: Sakari Ailus; +Cc: linux-media, mchehab
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
Hi!
> The driver used integers for what boolean would have been a better fit.
> Use boolean instead.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
And... thanks :-).
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-08 9:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-06 9:35 [PATCH 1/1] ad5820: Use bool for boolean values Sakari Ailus
2016-09-07 19:00 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2016-09-05 7:47 Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).