[PATCH] Staging: slicoss: fix converting macros into functions

Denis Kirjanov kirjanov at gmail.com
Wed Jun 6 11:52:55 UTC 2012


Have you checked that SLIC_FREE_SLIC_HANDLE is not used in the code?

On 6/1/12, Adnan Ali <adnan.ali at codethink.co.uk> wrote:
> This commit fixes issues including converting macros
> into functions.
>
> Signed-off-by: Adnan Ali <adnan.ali at codethink.co.uk>
> ---
>  drivers/staging/slicoss/slicoss.c |   49
> ++++++++++++++++++++----------------
>  1 files changed, 27 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/staging/slicoss/slicoss.c
> b/drivers/staging/slicoss/slicoss.c
> index 77a0751..18eaa8a 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -168,30 +168,34 @@ static void slic_assert_fail(void)
>  #endif
>
>
> -#define SLIC_GET_SLIC_HANDLE(_adapter, _pslic_handle)                   \
> -{                                                                       \
> -    spin_lock_irqsave(&_adapter->handle_lock.lock,                      \
> -			_adapter->handle_lock.flags);                   \
> -    _pslic_handle  =  _adapter->pfree_slic_handles;                     \
> -    if (_pslic_handle) {                                                \
> -	ASSERT(_pslic_handle->type == SLIC_HANDLE_FREE);                \
> -	_adapter->pfree_slic_handles = _pslic_handle->next;             \
> -    }                                                                   \
> -    spin_unlock_irqrestore(&_adapter->handle_lock.lock,                 \
> -			_adapter->handle_lock.flags);                   \
> -}
> -
> -#define SLIC_FREE_SLIC_HANDLE(_adapter, _pslic_handle)                  \
> -{                                                                       \
> -    _pslic_handle->type = SLIC_HANDLE_FREE;                             \
> -    spin_lock_irqsave(&_adapter->handle_lock.lock,                      \
> -			_adapter->handle_lock.flags);                   \
> -    _pslic_handle->next = _adapter->pfree_slic_handles;                 \
> -    _adapter->pfree_slic_handles = _pslic_handle;                       \
> -    spin_unlock_irqrestore(&_adapter->handle_lock.lock,                 \
> -			_adapter->handle_lock.flags);                   \
> +
> +static void slic_get_slic_handle(struct adapter *padapter,
> +				struct slic_handle *pslic_handle)
> +{
> +	spin_lock_irqsave(&padapter->handle_lock.lock,
> +			padapter->handle_lock.flags);
> +	pslic_handle  =  padapter->pfree_slic_handles;
> +	if (pslic_handle) {
> +		ASSERT(pslic_handle->type == SLIC_HANDLE_FREE);
> +		padapter->pfree_slic_handles = pslic_handle->next;
> +	}
> +	spin_unlock_irqrestore(&padapter->handle_lock.lock,
> +			padapter->handle_lock.flags);
>  }
>
> +static void slic_free_slic_handle(struct adapter *padapter,
> +				struct slic_handle *pslic_handle)
> +{
> +	pslic_handle->type = SLIC_HANDLE_FREE;
> +	spin_lock_irqsave(&padapter->handle_lock.lock,
> +			padapter->handle_lock.flags);
> +
> +	pslic_handle->next = padapter->pfree_slic_handles;
> +	padapter->pfree_slic_handles = pslic_handle;
> +	spin_unlock_irqrestore(&padapter->handle_lock.lock,
> +			padapter->handle_lock.flags);
> +
> +}
>  static inline void slic_reg32_write(void __iomem *reg, u32 value, bool
> flush)
>  {
>  	writel(value, reg);
> @@ -1593,11 +1597,12 @@ static void slic_cmdq_addcmdpage(struct adapter
> *adapter, u32 *page)
>  	phys_addrh = SLIC_GET_ADDR_HIGH(phys_addr);
>
>  	prev = NULL;
> +	pslic_handle = NULL;
>  	tail = cmd;
>  	while ((cmdcnt < SLIC_CMDQ_CMDSINPAGE) &&
>  	       (adapter->slic_handle_ix < 256)) {
>  		/* Allocate and initialize a SLIC_HANDLE for this command */
> -		SLIC_GET_SLIC_HANDLE(adapter, pslic_handle);
> +		slic_get_slic_handle(adapter, pslic_handle);
>  		if (pslic_handle == NULL)
>  			ASSERT(0);
>  		ASSERT(pslic_handle ==
> --
> 1.7.4.1
>
> _______________________________________________
> devel mailing list
> devel at linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
>


-- 
Regards,
Denis



More information about the devel mailing list