diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2017-05-16 19:20:03 -0400 |
---|---|---|
committer | Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> | 2017-06-09 07:25:36 -0400 |
commit | 8c71a1a318385ba2354fa7e8adf3d42678edd766 (patch) | |
tree | ea2b4494459954d87a5e6ed2ad01fdc649d763fd | |
parent | d503a43ac06ac0ec66244d565dfc2c54fdb2425c (diff) |
v4l: rcar-fcp: Don't get/put module reference
Direct callers of the FCP API hold a reference to the FCP module due to
module linkage, there's no need to take another one manually. Take a
reference to the device instead to ensure that it won't disappear behind
the caller's back.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: Mauro Cavalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/platform/rcar-fcp.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c index 7146fc5ef168..e9f609edf513 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c | |||
@@ -53,14 +53,7 @@ struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np) | |||
53 | if (fcp->dev->of_node != np) | 53 | if (fcp->dev->of_node != np) |
54 | continue; | 54 | continue; |
55 | 55 | ||
56 | /* | 56 | get_device(fcp->dev); |
57 | * Make sure the module won't be unloaded behind our back. This | ||
58 | * is a poor man's safety net, the module should really not be | ||
59 | * unloaded while FCP users can be active. | ||
60 | */ | ||
61 | if (!try_module_get(fcp->dev->driver->owner)) | ||
62 | fcp = NULL; | ||
63 | |||
64 | goto done; | 57 | goto done; |
65 | } | 58 | } |
66 | 59 | ||
@@ -81,7 +74,7 @@ EXPORT_SYMBOL_GPL(rcar_fcp_get); | |||
81 | void rcar_fcp_put(struct rcar_fcp_device *fcp) | 74 | void rcar_fcp_put(struct rcar_fcp_device *fcp) |
82 | { | 75 | { |
83 | if (fcp) | 76 | if (fcp) |
84 | module_put(fcp->dev->driver->owner); | 77 | put_device(fcp->dev); |
85 | } | 78 | } |
86 | EXPORT_SYMBOL_GPL(rcar_fcp_put); | 79 | EXPORT_SYMBOL_GPL(rcar_fcp_put); |
87 | 80 | ||