mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-27 08:14:35 +08:00
siox: Provide a devm variant of siox_master_register()
This allows to simplify siox master drivers in the next step. Acked-by: Thorsten Scherer <t.scherer@eckelmann.de> Link: https://lore.kernel.org/r/e961dfb3e94f106b16f5eacff2110fc7fa0cab13.1708328466.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
This commit is contained in:
parent
9ecfbf7053
commit
91d5bb579c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user