Skip to content

Commit

Permalink
sparc/ldc: create separate ldc_unbind from ldc_free
Browse files Browse the repository at this point in the history
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dwight Engen authored and David S. Miller committed Dec 12, 2014
1 parent fe47c3c commit 1678c2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions arch/sparc/include/asm/ldc.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void ldc_free(struct ldc_channel *lp);

/* Register TX and RX queues of the link with the hypervisor. */
int ldc_bind(struct ldc_channel *lp);
void ldc_unbind(struct ldc_channel *lp);

/* For non-RAW protocols we need to complete a handshake before
* communication can proceed. ldc_connect() does that, if the
Expand Down
12 changes: 9 additions & 3 deletions arch/sparc/kernel/ldc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,11 +1222,12 @@ struct ldc_channel *ldc_alloc(unsigned long id,
}
EXPORT_SYMBOL(ldc_alloc);

void ldc_free(struct ldc_channel *lp)
void ldc_unbind(struct ldc_channel *lp)
{
if (lp->flags & LDC_FLAG_REGISTERED_IRQS) {
free_irq(lp->cfg.rx_irq, lp);
free_irq(lp->cfg.tx_irq, lp);
lp->flags &= ~LDC_FLAG_REGISTERED_IRQS;
}

if (lp->flags & LDC_FLAG_REGISTERED_QUEUES) {
Expand All @@ -1240,10 +1241,15 @@ void ldc_free(struct ldc_channel *lp)
lp->flags &= ~LDC_FLAG_ALLOCED_QUEUES;
}

hlist_del(&lp->list);
ldc_set_state(lp, LDC_STATE_INIT);
}
EXPORT_SYMBOL(ldc_unbind);

void ldc_free(struct ldc_channel *lp)
{
ldc_unbind(lp);
hlist_del(&lp->list);
kfree(lp->mssbuf);

ldc_iommu_release(lp);

kfree(lp);
Expand Down

0 comments on commit 1678c2b

Please sign in to comment.