Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

siox: Don't pass the reference on a master in siox_master_register()

While it's technically fine to pass the ownership of the reference on
a struct siox_master from the caller of siox_master_register() to the
framework this is hard to use. Instead let the framework take its own
reference (that is freed in siox_master_unregister()) and drop the bus
driver's reference in its remove callback.

Acked-by: Thorsten Scherer <t.scherer@eckelmann.de>
Link: https://lore.kernel.org/r/1e8d09d17848e58e8fc6a46278b5e8fb0cf4618a.1708328466.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+4
+2
drivers/siox/siox-bus-gpio.c
··· 149 149 150 150 siox_master_unregister(master); 151 151 152 + siox_master_put(master); 153 + 152 154 return 0; 153 155 } 154 156
+2
drivers/siox/siox-core.c
··· 717 717 if (!smaster->pushpull) 718 718 return -EINVAL; 719 719 720 + get_device(&smaster->dev); 721 + 720 722 dev_set_name(&smaster->dev, "siox-%d", smaster->busno); 721 723 722 724 mutex_init(&smaster->lock);