提交 8c71a1a3 编写于 作者: L Laurent Pinchart 提交者: Kieran Bingham

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: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: NMauro Cavalho Chehab <mchehab@s-opensource.com>
上级 d503a43a
...@@ -53,14 +53,7 @@ struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np) ...@@ -53,14 +53,7 @@ struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np)
if (fcp->dev->of_node != np) if (fcp->dev->of_node != np)
continue; continue;
/* get_device(fcp->dev);
* Make sure the module won't be unloaded behind our back. This
* is a poor man's safety net, the module should really not be
* unloaded while FCP users can be active.
*/
if (!try_module_get(fcp->dev->driver->owner))
fcp = NULL;
goto done; goto done;
} }
...@@ -81,7 +74,7 @@ EXPORT_SYMBOL_GPL(rcar_fcp_get); ...@@ -81,7 +74,7 @@ EXPORT_SYMBOL_GPL(rcar_fcp_get);
void rcar_fcp_put(struct rcar_fcp_device *fcp) void rcar_fcp_put(struct rcar_fcp_device *fcp)
{ {
if (fcp) if (fcp)
module_put(fcp->dev->driver->owner); put_device(fcp->dev);
} }
EXPORT_SYMBOL_GPL(rcar_fcp_put); EXPORT_SYMBOL_GPL(rcar_fcp_put);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册