trigger->ops structure optional?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When I decided to compile a driver with a trigger as a module, I
realized that I needed to add a trigger ops structure with the .owner
field set to THIS_MODULE.
The reason is iio_trigger_put() calls module_put(trig->ops->owner),
which is a noop if the driver is compiled within the kernel.
Otherwise, trigger->ops is considered optional.

We could add a test there to not call module_put() if ops is NULL, but
we wouldn't have the module refcount protection anymore; the trigger
could be removed while still in use given iio_trigger_unregister()
does not check if the trigger is still in use.

To address that issue, should we make trigger->ops mandatory - its
function members could still be optional?
If we go this way, shall we go even further and fold the ops structure
within iio_trigger?

Gwendal.
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux