dect
/
libdect
Archived
13
0
Fork 0

mm: add function to get an existing or allocate a new MM endpoint

Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
Patrick McHardy 2010-10-10 19:57:04 +02:00
parent ce4da27071
commit 00cc8509b8
2 changed files with 16 additions and 0 deletions

View File

@ -232,6 +232,8 @@ struct dect_mm_endpoint;
extern struct dect_mm_endpoint *dect_mm_endpoint_alloc(struct dect_handle *dh,
const struct dect_ipui *ipui);
extern struct dect_mm_endpoint *dect_mm_endpoint_get(struct dect_handle *dh,
const struct dect_ipui *ipui);
extern void dect_mm_endpoint_destroy(struct dect_handle *dh,
struct dect_mm_endpoint *mme);
extern void *dect_mm_priv(struct dect_mm_endpoint *mme);

View File

@ -522,6 +522,20 @@ dect_mm_endpoint_get_by_link(const struct dect_handle *dh,
return NULL;
}
struct dect_mm_endpoint *dect_mm_endpoint_get(struct dect_handle *dh,
const struct dect_ipui *ipui)
{
struct dect_mm_endpoint *mme;
list_for_each_entry(mme, &dh->mme_list, list) {
if (!dect_ipui_cmp(&mme->link->ipui, ipui))
return mme;
}
return dect_mm_endpoint_alloc(dh, ipui);
}
EXPORT_SYMBOL(dect_mm_endpoint_get);
struct dect_mm_endpoint *dect_mm_endpoint_alloc(struct dect_handle *dh,
const struct dect_ipui *ipui)
{