diff options
author | Greg Kroah-Hartman <greg@kroah.com> | 2014-12-24 13:01:40 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2015-01-02 13:05:42 -0800 |
commit | 12a5dfc9acf690504e7266a8f310702bc9e6872c (patch) | |
tree | e08322fe107b8caed9adb4f7a678ea582ea4727f /drivers/staging/greybus/protocol.h | |
parent | greybus: bundle: create GB_DEVICE_ID_BAD (diff) | |
download | linux-12a5dfc9acf690504e7266a8f310702bc9e6872c.tar.gz linux-12a5dfc9acf690504e7266a8f310702bc9e6872c.tar.bz2 linux-12a5dfc9acf690504e7266a8f310702bc9e6872c.zip |
greybus: protocol: add a module owner to a protocol
Now that protocols can be in a module, we need to reference count them
to lock them into memory so they can't be removed while in use. So add
a module owner structure, and have it automatically be assigned when
registering the protocol.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/staging/greybus/protocol.h')
-rw-r--r-- | drivers/staging/greybus/protocol.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/staging/greybus/protocol.h b/drivers/staging/greybus/protocol.h index e2555b75e334..62f024dd71bd 100644 --- a/drivers/staging/greybus/protocol.h +++ b/drivers/staging/greybus/protocol.h @@ -34,11 +34,15 @@ struct gb_protocol { gb_connection_init_t connection_init; gb_connection_exit_t connection_exit; gb_request_recv_t request_recv; + struct module *owner; }; -int gb_protocol_register(struct gb_protocol *protocol); +int __gb_protocol_register(struct gb_protocol *protocol, struct module *module); int gb_protocol_deregister(struct gb_protocol *protocol); +#define gb_protocol_register(protocol) \ + __gb_protocol_register(protocol, THIS_MODULE) + struct gb_protocol *gb_protocol_get(u8 id, u8 major, u8 minor); void gb_protocol_put(struct gb_protocol *protocol); |