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

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

 



On 06/06/12 12:52, Denis Kirjanov wrote:
Have you checked that SLIC_FREE_SLIC_HANDLE is not used in the code?

On 6/1/12, Adnan Ali<adnan.ali@xxxxxxxxxxxxxxx>  wrote:
This commit fixes issues including converting macros
into functions.

Signed-off-by: Adnan Ali<adnan.ali@xxxxxxxxxxxxxxx>
---
  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@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Hi Denis

   I know its not been used but i wanted to convert them into function.
Than decide whether to remove this function or stay with it.

Thanks
Adnan Ali
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux