struct mutex power_lock;
int power_count;
- unsigned int standby : 1;
+ bool standby;
};
static int ad5820_write(struct ad5820_device *coil, u16 data)
/*
* 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;
* (single power line control for both coil and sensor).
*/
if (standby) {
- coil->standby = 1;
+ coil->standby = true;
ret = ad5820_update_hw(coil);
}
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;
if (restore) {
/* Restore the hardware settings. */
- coil->standby = 0;
+ coil->standby = false;
ret = ad5820_update_hw(coil);
if (ret)
goto fail;
return 0;
fail:
- coil->standby = 1;
+ coil->standby = true;
regulator_disable(coil->vana);
return ret;
* 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;
}
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)
if (!coil->power_count)
return 0;
- return ad5820_power_on(coil, 1);
+ return ad5820_power_on(coil, true);
}
#else