mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
gpio: pca9570: Use devm_mutex_init() for mutex initialization
Use devm_mutex_init() since it brings some benefits when CONFIG_DEBUG_MUTEXES is enabled. Reviewed-by: Linus Walleij <linusw@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20260113111156.188051-2-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
parent
568ea51e61
commit
e05ef046eb
|
|
@ -115,7 +115,9 @@ static int pca9570_set(struct gpio_chip *chip, unsigned int offset, int value)
|
|||
|
||||
static int pca9570_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
struct pca9570 *gpio;
|
||||
int ret;
|
||||
|
||||
gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL);
|
||||
if (!gpio)
|
||||
|
|
@ -132,7 +134,9 @@ static int pca9570_probe(struct i2c_client *client)
|
|||
gpio->chip.ngpio = gpio->chip_data->ngpio;
|
||||
gpio->chip.can_sleep = true;
|
||||
|
||||
mutex_init(&gpio->lock);
|
||||
ret = devm_mutex_init(dev, &gpio->lock);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Read the current output level */
|
||||
pca9570_read(gpio, &gpio->out);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user