On Fri, Oct 2, 2015 at 7:38 AM, Daniel Mack <dan...@zonque.org> wrote: > On 10/02/2015 07:19 AM, Matt Ranostay wrote: >> Puts device into DEEP SLEEP when no LEDs are in in the on-state, and no >> input_handlers are in use. Also uses *_autosuspend to prevent a LED >> trigger from constantly suspending and resuming device. >> >> Signed-off-by: Matt Ranostay <mranos...@gmail.com> >> --- >> drivers/input/keyboard/cap11xx.c | 84 >> +++++++++++++++++++++++++++++++--------- >> 1 file changed, 65 insertions(+), 19 deletions(-) >> > > ... > >> +static void cap11xx_shutdown_act(void *data) >> +{ >> + struct i2c_client *i2c_client = data; >> + struct cap11xx_priv *priv = i2c_get_clientdata(i2c_client); >> + >> + cap11xx_set_sleep(priv, true); >> + pm_runtime_disable(&i2c_client->dev); >> + pm_runtime_set_suspended(&i2c_client->dev); >> +} >> + >> static int cap11xx_i2c_probe(struct i2c_client *i2c_client, >> const struct i2c_device_id *id) >> { >> @@ -363,6 +374,14 @@ static int cap11xx_i2c_probe(struct i2c_client >> *i2c_client, >> if (IS_ERR(priv->regmap)) >> return PTR_ERR(priv->regmap); >> >> + error = devm_add_action(dev, cap11xx_shutdown_act, i2c_client); > > Why not implement cap11xx_i2c_driver.remove or .shutdown for this? > > Because of a possible race condition if any leds are registered.
> Otherwise, this looks good to me. > > > Thanks, > Daniel > -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html