{
struct device_node *np = client->dev.of_node, *child;
struct srg_led_ctrl *sysled_ctrl;
+ int err;
sysled_ctrl = devm_kzalloc(&client->dev, sizeof(*sysled_ctrl), GFP_KERNEL);
if (!sysled_ctrl)
sysled_ctrl->client = client;
- mutex_init(&sysled_ctrl->lock);
+ err = devm_mutex_init(&client->dev, &sysled_ctrl->lock);
+ if (err)
+ return err;
i2c_set_clientdata(client, sysled_ctrl);
srg_led_i2c_write(sysled_ctrl, i, 0);
}
-static void
-srg_led_remove(struct i2c_client *client)
-{
- struct srg_led_ctrl *sysled_ctrl = i2c_get_clientdata(client);
-
- srg_led_disable(client);
- mutex_destroy(&sysled_ctrl->lock);
-}
-
static const struct i2c_device_id srg_led_id[] = {
{ "srg-sysled", 0 },
{ }
.of_match_table = of_srg_led_match,
},
.probe = srg_led_probe,
- .remove = srg_led_remove,
+ .remove = srg_led_disable,
.id_table = srg_led_id,
};
module_i2c_driver(srg_sysled_driver);