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

From: Arnd Bergmann
Date: Thu Apr 28 2016 - 05:53:33 EST


On Wednesday 27 April 2016 17:58:06 Sagar Dharia wrote:

> + ctrl->tx.base = dma_alloc_coherent(ctrl->dev.parent,
> + (ctrl->tx.sl_sz * ctrl->tx.n),
> + &ctrl->tx.phy, GFP_KERNEL);
> + if (!ctrl->tx.base) {
> + ret = -ENOMEM;
> + goto tx_alloc_failed;
> + }

This looks controller specific, and hints that some parts of the "common"
framework should actually be part of the controller driver instead.

In particular, the use of "ctrl->dev.parent" suggests that this should
have been allocated by the controller.

> @@ -162,6 +279,15 @@ struct slim_controller {
> struct slim_addrt *addrt;
> u8 num_dev;
> struct workqueue_struct *wq;
> + struct slim_val_inf *tid_tbl[SLIM_MAX_TIDS];
> + u8 last_tid;
> + spinlock_t txn_lock;
> + struct slim_ctrl_buf tx;
> + struct slim_ctrl_buf rx;
> + struct slim_pending *pending_wr;
> + struct semaphore tx_sem;

Please try to avoid the use of semaphores in new code.

Arnd