iio: trigger: move trig->owner init to trigger allocate() stage
authorDmitry Rokosov <DDRokosov@sberdevices.ru>
Wed, 1 Jun 2022 17:48:32 +0000 (17:48 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 16 Jul 2022 15:24:19 +0000 (16:24 +0100)
commitbc72d938c149197688ae3b3ecaa25d4aee8653cb
tree9c13d5002bc85e7b06aba7414bdf4a52501ce71d
parent17b5a7f65c7db1997252b8313dd03f15fbe1f54f
iio: trigger: move trig->owner init to trigger allocate() stage

To provide a new IIO trigger to the IIO core, usually driver executes the
following pipeline: allocate()/register()/get(). Before, IIO core assigned
trig->owner as a pointer to the module which registered this trigger at
the register() stage. But actually the trigger object is owned by the
module earlier, on the allocate() stage, when trigger object is
successfully allocated for the driver.

This patch moves trig->owner initialization from register()
stage of trigger initialization pipeline to allocate() stage to
eliminate all misunderstandings and time gaps between trigger object
creation and owner acquiring.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Link: https://lore.kernel.org/r/20220601174837.20292-1-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-trigger.c
include/linux/iio/iio.h
include/linux/iio/trigger.h