Harald Welte has submitted this change and it was merged.

Change subject: sercomm: Rename sercomm_lock() to sercomm_drv_lock()
......................................................................


sercomm: Rename sercomm_lock() to sercomm_drv_lock()

The user of the code is supposed to provide a "driver" implementing
those calls according to the specific target architecture/hardware.
This only applies to non-host (i.e. embedded) builds

Change-Id: I9a6848f23b70fc32f4de10149d857374f76f000d
---
M src/sercomm.c
1 file changed, 15 insertions(+), 18 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/sercomm.c b/src/sercomm.c
index d33db91..ff6a5a3 100644
--- a/src/sercomm.c
+++ b/src/sercomm.c
@@ -25,31 +25,28 @@
 #include <errno.h>
 
 #include <osmocom/core/msgb.h>
+#include <osmocom/core/utils.h>
 #include <osmocom/core/sercomm.h>
+#include <osmocom/core/linuxlist.h>
 
 #ifdef HOST_BUILD
 
 # define DEFAULT_RX_MSG_SIZE   2048
-# ifndef ARRAY_SIZE
-#  define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-# endif
-
-static inline void sercomm_lock(unsigned long __attribute__((unused)) *flags) 
{}
-static inline void sercomm_unlock(unsigned long __attribute__((unused)) 
*flags) {}
+static inline void sercomm_drv_lock(unsigned long __attribute__((unused)) 
*flags) {}
+static inline void sercomm_drv_unlock(unsigned long __attribute__((unused)) 
*flags) {}
 
 #else
 
 # define DEFAULT_RX_MSG_SIZE   256
 # include <debug.h>
-# include <osmocom/core/linuxlist.h>
 # include <asm/system.h>
 
-static inline void sercomm_lock(unsigned long *flags)
+static inline void sercomm_drv_lock(unsigned long *flags)
 {
        local_firq_save(*flags);
 }
 
-static inline void sercomm_unlock(unsigned long *flags)
+static inline void sercomm_drv_unlock(unsigned long *flags)
 {
        local_irq_restore(*flags);
 }
@@ -106,9 +103,9 @@
 
        /* This functiion can be called from any context: FIQ, IRQ
         * and supervisor context.  Proper locking is important! */
-       sercomm_lock(&flags);
+       sercomm_drv_lock(&flags);
        msgb_enqueue(&sercomm->tx.dlci_queues[dlci], msg);
-       sercomm_unlock(&flags);
+       sercomm_drv_unlock(&flags);
 
 #ifndef HOST_BUILD
        /* tell UART that we have something to send */
@@ -150,14 +147,14 @@
        while (1) {
                /* no messages in the queue, grab the lock to ensure it
                 * stays that way */
-               sercomm_lock(&flags);
+               sercomm_drv_lock(&flags);
                if (!sercomm->tx.msg && !sercomm->tx.next_char) {
                        /* change speed */
                        uart_baudrate(sercomm->uart_id, bdrt);
-                       sercomm_unlock(&flags);
+                       sercomm_drv_unlock(&flags);
                        break;
                }
-                       sercomm_unlock(&flags);
+                       sercomm_drv_unlock(&flags);
        }
 }
 #endif
@@ -173,7 +170,7 @@
        /* we may be called from interrupt context, but we stiff need to lock
         * because sercomm could be accessed from a FIQ context ... */
 
-       sercomm_lock(&flags);
+       sercomm_drv_lock(&flags);
 
        if (!sercomm->tx.msg) {
                unsigned int i;
@@ -187,11 +184,11 @@
                        /* start of a new message, send start flag octet */
                        *ch = HDLC_FLAG;
                        sercomm->tx.next_char = sercomm->tx.msg->data;
-                       sercomm_unlock(&flags);
+                       sercomm_drv_unlock(&flags);
                        return 1;
                } else {
                        /* no more data avilable */
-                       sercomm_unlock(&flags);
+                       sercomm_drv_unlock(&flags);
                        return 0;
                }
        }
@@ -223,7 +220,7 @@
                *ch = *sercomm->tx.next_char++;
        }
 
-       sercomm_unlock(&flags);
+       sercomm_drv_unlock(&flags);
        return 1;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/2641
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a6848f23b70fc32f4de10149d857374f76f000d
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to