Re: [PATCH V3 3/6] slimbus: Add messaging APIs to slimbus framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, Aug 03, 2015 at 12:59:47AM -0600, Sagar Dharia wrote:

> +	sema_init(&ctrl->tx_sem, (ctrl->tx.n - 1));

This sempahore counts the number of free slots in the statically
allocated list of transfers we have allocated.  It would be good to see
some discussion in the changelog as to why we've got this statically
allocated pool rather than just dynamically allocating them as needed -
I can see a performance argument there but it'd be good to have the
thinking documented.

> +	buf = slim_get_tx(ctrl, txn, need_tid, async);
> +	if (!buf)
> +		return -ENOMEM;
> +
> +	if (need_tid) {
> +		spin_lock_irqsave(&ctrl->txn_lock, flags);
> +		for (i = 0; i < ctrl->last_tid; i++) {
> +			if (ctrl->tid_tbl[i] == NULL)
> +				break;
> +		}
> +		if (i >= ctrl->last_tid) {
> +			if (ctrl->last_tid == (SLIM_MAX_TIDS - 1)) {
> +				spin_unlock_irqrestore(&ctrl->txn_lock, flags);
> +				return -ENOMEM;

We don't undo slim_get_tx() here but the definition looks like we ought
to be returning the buffer we allocated.

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux