diff options
author | Jonathan Cameron <jic23@kernel.org> | 2017-07-23 17:25:44 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2017-08-22 21:18:32 +0100 |
commit | 035c70aeb64b861aa88a666c61fda8b2ae49aeae (patch) | |
tree | 3c646e32be0254bf61a83d1ef24c90d23abf86d9 /drivers/iio/industrialio-trigger.c | |
parent | 63b19547cc3d96041d7bc7ab8de6292b0ebaf2c9 (diff) | |
download | linux-035c70aeb64b861aa88a666c61fda8b2ae49aeae.tar.gz linux-035c70aeb64b861aa88a666c61fda8b2ae49aeae.tar.bz2 linux-035c70aeb64b861aa88a666c61fda8b2ae49aeae.zip |
iio: triggers: Use macros to avoid boilerplate assignment of owner.
This trig_ops.owner assignment occurs in all trigger drivers and
can be simply automated using a macro as has been done in many
other places in the kernel.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Diffstat (limited to 'drivers/iio/industrialio-trigger.c')
-rw-r--r-- | drivers/iio/industrialio-trigger.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index 9596fedacedb..faf00202915a 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -66,10 +66,13 @@ ATTRIBUTE_GROUPS(iio_trig_dev); static struct iio_trigger *__iio_trigger_find_by_name(const char *name); -int iio_trigger_register(struct iio_trigger *trig_info) +int __iio_trigger_register(struct iio_trigger *trig_info, + struct module *this_mod) { int ret; + trig_info->owner = this_mod; + /* trig_info->ops is required for the module member */ if (!trig_info->ops) return -EINVAL; @@ -105,7 +108,7 @@ error_unregister_id: ida_simple_remove(&iio_trigger_ida, trig_info->id); return ret; } -EXPORT_SYMBOL(iio_trigger_register); +EXPORT_SYMBOL(__iio_trigger_register); void iio_trigger_unregister(struct iio_trigger *trig_info) { @@ -663,9 +666,10 @@ static void devm_iio_trigger_unreg(struct device *dev, void *res) } /** - * devm_iio_trigger_register - Resource-managed iio_trigger_register() + * __devm_iio_trigger_register - Resource-managed iio_trigger_register() * @dev: device this trigger was allocated for * @trig_info: trigger to register + * @this_mod: module registering the trigger * * Managed iio_trigger_register(). The IIO trigger registered with this * function is automatically unregistered on driver detach. This function @@ -678,7 +682,9 @@ static void devm_iio_trigger_unreg(struct device *dev, void *res) * RETURNS: * 0 on success, negative error number on failure. */ -int devm_iio_trigger_register(struct device *dev, struct iio_trigger *trig_info) +int __devm_iio_trigger_register(struct device *dev, + struct iio_trigger *trig_info, + struct module *this_mod) { struct iio_trigger **ptr; int ret; @@ -688,7 +694,7 @@ int devm_iio_trigger_register(struct device *dev, struct iio_trigger *trig_info) return -ENOMEM; *ptr = trig_info; - ret = iio_trigger_register(trig_info); + ret = __iio_trigger_register(trig_info, this_mod); if (!ret) devres_add(dev, ptr); else @@ -696,7 +702,7 @@ int devm_iio_trigger_register(struct device *dev, struct iio_trigger *trig_info) return ret; } -EXPORT_SYMBOL_GPL(devm_iio_trigger_register); +EXPORT_SYMBOL_GPL(__devm_iio_trigger_register); /** * devm_iio_trigger_unregister - Resource-managed iio_trigger_unregister() |