Commit 91d5bb57 authored by Uwe Kleine-König's avatar Uwe Kleine-König

siox: Provide a devm variant of siox_master_register()

This allows to simplify siox master drivers in the next step.
Acked-by: default avatarThorsten Scherer <t.scherer@eckelmann.de>
Link: https://lore.kernel.org/r/e961dfb3e94f106b16f5eacff2110fc7fa0cab13.1708328466.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 9ecfbf70
......@@ -795,6 +795,25 @@ void siox_master_unregister(struct siox_master *smaster)
}
EXPORT_SYMBOL_GPL(siox_master_unregister);
static void devm_siox_master_unregister(void *data)
{
struct siox_master *smaster = data;
siox_master_unregister(smaster);
}
int devm_siox_master_register(struct device *dev, struct siox_master *smaster)
{
int ret;
ret = siox_master_register(smaster);
if (ret)
return ret;
return devm_add_action_or_reset(dev, devm_siox_master_unregister, smaster);
}
EXPORT_SYMBOL_GPL(devm_siox_master_register);
static struct siox_device *siox_device_add(struct siox_master *smaster,
const char *type, size_t inbytes,
size_t outbytes, u8 statustype)
......
......@@ -49,3 +49,5 @@ struct siox_master *devm_siox_master_alloc(struct device *dev, size_t size);
int siox_master_register(struct siox_master *smaster);
void siox_master_unregister(struct siox_master *smaster);
int devm_siox_master_register(struct device *dev, struct siox_master *smaster);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment