Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pwm: pca9685: clarify pca9685_set_sleep_mode() interface.

The function
static void pca9685_set_sleep_mode(struct pca9685 *pca, int sleep)
takes the chip in and out of sleep mode, depending on the value of
sleep, which is interpreted as a boolean.

To clarify that 'int sleep' is a boolean and not a sleep delay,
change the function interface to:
static void pca9685_set_sleep_mode(struct pca9685 *pca, bool enable)

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Sven Van Asbroeck and committed by
Thierry Reding
0829326a 36af66a7

+7 -7
+7 -7
drivers/pwm/pwm-pca9685.c
··· 241 241 } 242 242 #endif 243 243 244 - static void pca9685_set_sleep_mode(struct pca9685 *pca, int sleep) 244 + static void pca9685_set_sleep_mode(struct pca9685 *pca, bool enable) 245 245 { 246 246 regmap_update_bits(pca->regmap, PCA9685_MODE1, 247 - MODE1_SLEEP, sleep ? MODE1_SLEEP : 0); 248 - if (!sleep) { 247 + MODE1_SLEEP, enable ? MODE1_SLEEP : 0); 248 + if (!enable) { 249 249 /* Wait 500us for the oscillator to be back up */ 250 250 udelay(500); 251 251 } ··· 272 272 * state is guaranteed active here. 273 273 */ 274 274 /* Put chip into sleep mode */ 275 - pca9685_set_sleep_mode(pca, 1); 275 + pca9685_set_sleep_mode(pca, true); 276 276 277 277 /* Change the chip-wide output frequency */ 278 278 regmap_write(pca->regmap, PCA9685_PRESCALE, prescale); 279 279 280 280 /* Wake the chip up */ 281 - pca9685_set_sleep_mode(pca, 0); 281 + pca9685_set_sleep_mode(pca, false); 282 282 283 283 pca->period_ns = period_ns; 284 284 } else { ··· 534 534 struct i2c_client *client = to_i2c_client(dev); 535 535 struct pca9685 *pca = i2c_get_clientdata(client); 536 536 537 - pca9685_set_sleep_mode(pca, 1); 537 + pca9685_set_sleep_mode(pca, true); 538 538 return 0; 539 539 } 540 540 ··· 543 543 struct i2c_client *client = to_i2c_client(dev); 544 544 struct pca9685 *pca = i2c_get_clientdata(client); 545 545 546 - pca9685_set_sleep_mode(pca, 0); 546 + pca9685_set_sleep_mode(pca, false); 547 547 return 0; 548 548 } 549 549 #endif