提交 29a822bd 编写于 作者: V Vaibhav Agarwal 提交者: Greg Kroah-Hartman

greybus: hd: Add API to release reserved CPorts

It is required to release all unique ids registered via ida_get_simple
to avoid any possible memory leak. cport_release() already exists with
special handling for ES2_CPORT_CDSI1, i.e. updating in_use flag without
removing associated ida.

So, added another API to release reserved cports CDSI0 and CDSI1. This
is intended to  be used only during es2_destroy().
Signed-off-by: NVaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: NJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
上级 cb4c8441
......@@ -54,6 +54,14 @@ int gb_hd_cport_reserve(struct gb_host_device *hd, u16 cport_id)
}
EXPORT_SYMBOL_GPL(gb_hd_cport_reserve);
void gb_hd_cport_release_reserved(struct gb_host_device *hd, u16 cport_id)
{
struct ida *id_map = &hd->cport_id_map;
ida_simple_remove(id_map, cport_id);
}
EXPORT_SYMBOL_GPL(gb_hd_cport_release_reserved);
/* Locking: Caller guarantees serialisation */
int gb_hd_cport_allocate(struct gb_host_device *hd, int cport_id,
unsigned long flags)
......
......@@ -61,6 +61,7 @@ struct gb_host_device {
#define to_gb_host_device(d) container_of(d, struct gb_host_device, dev)
int gb_hd_cport_reserve(struct gb_host_device *hd, u16 cport_id);
void gb_hd_cport_release_reserved(struct gb_host_device *hd, u16 cport_id);
int gb_hd_cport_allocate(struct gb_host_device *hd, int cport_id,
unsigned long flags);
void gb_hd_cport_release(struct gb_host_device *hd, u16 cport_id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册