mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
Input: pinephone-keyboard - use devm_regulator_get_enable()
Use devm_regulator_get_enable() instead of hand writing it. It saves some line of code. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/78d7a4719ed7c372a7aa62afb66d4f1561799b5f.1686985515.git.christophe.jaillet@wanadoo.fr Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
59a51ba6e9
commit
3ce6e06202
@ -318,40 +318,22 @@ static void ppkb_close(struct input_dev *input)
|
||||
ppkb_set_scan(client, false);
|
||||
}
|
||||
|
||||
static void ppkb_regulator_disable(void *regulator)
|
||||
{
|
||||
regulator_disable(regulator);
|
||||
}
|
||||
|
||||
static int ppkb_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
unsigned int phys_rows, phys_cols;
|
||||
struct pinephone_keyboard *ppkb;
|
||||
struct regulator *vbat_supply;
|
||||
u8 info[PPKB_MATRIX_SIZE + 1];
|
||||
struct device_node *i2c_bus;
|
||||
int ret;
|
||||
int error;
|
||||
|
||||
vbat_supply = devm_regulator_get(dev, "vbat");
|
||||
error = PTR_ERR_OR_ZERO(vbat_supply);
|
||||
error = devm_regulator_get_enable(dev, "vbat");
|
||||
if (error) {
|
||||
dev_err(dev, "Failed to get VBAT supply: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = regulator_enable(vbat_supply);
|
||||
if (error) {
|
||||
dev_err(dev, "Failed to enable VBAT: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = devm_add_action_or_reset(dev, ppkb_regulator_disable,
|
||||
vbat_supply);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
ret = i2c_smbus_read_i2c_block_data(client, 0, sizeof(info), info);
|
||||
if (ret != sizeof(info)) {
|
||||
error = ret < 0 ? ret : -EIO;
|
||||
|
Loading…
Reference in New Issue
Block a user