You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/01/18 14:20:17 UTC

[incubator-nuttx] 02/04: arch/sim: Rename g_hcitty_ops to g_bthcitty_ops

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 8c8c30b9d7a234a13030e57ae6fbd9ee8476c454
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Jan 18 04:39:47 2021 +0800

    arch/sim: Rename g_hcitty_ops to g_bthcitty_ops
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/sim/src/sim/up_hcitty.c | 43 +++++++++++++++++++------------------------
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/arch/sim/src/sim/up_hcitty.c b/arch/sim/src/sim/up_hcitty.c
index de60e1b..5b29656 100644
--- a/arch/sim/src/sim/up_hcitty.c
+++ b/arch/sim/src/sim/up_hcitty.c
@@ -82,32 +82,32 @@ struct bthcitty_s
  * Private Function Prototypes
  ****************************************************************************/
 
-static int      bthcitty_open  (FAR struct file *filep);
-static int      bthcitty_close (FAR struct file *filep);
-static ssize_t  bthcitty_read  (FAR struct file *filep,
+static int      bthcitty_open (FAR struct file *filep);
+static int      bthcitty_close(FAR struct file *filep);
+static ssize_t  bthcitty_read (FAR struct file *filep,
                                FAR char *buffer, size_t buflen);
-static ssize_t  bthcitty_write (FAR struct file *filep,
+static ssize_t  bthcitty_write(FAR struct file *filep,
                                FAR const char *buffer, size_t buflen);
-static int      bthcitty_ioctl (FAR struct file *filep,
+static int      bthcitty_ioctl(FAR struct file *filep,
                                int cmd, unsigned long arg);
-static int      bthcitty_poll  (FAR struct file *filep,
+static int      bthcitty_poll (FAR struct file *filep,
                                FAR struct pollfd *fds, bool setup);
 
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
-static const struct file_operations g_hcitty_ops =
+static const struct file_operations g_bthcitty_ops =
 {
-  .open   = bthcitty_open,
-  .close  = bthcitty_close,
-  .read   = bthcitty_read,
-  .write  = bthcitty_write,
-  .ioctl  = bthcitty_ioctl,
-  .poll   = bthcitty_poll
+  .open  = bthcitty_open,
+  .close = bthcitty_close,
+  .read  = bthcitty_read,
+  .write = bthcitty_write,
+  .ioctl = bthcitty_ioctl,
+  .poll  = bthcitty_poll
 };
 
-static sq_queue_t g_hcitty_list;
+static sq_queue_t g_bthcitty_list;
 
 /****************************************************************************
  * Private Functions
@@ -159,7 +159,6 @@ static int bthcitty_open(FAR struct file *filep)
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct bthcitty_s *dev = inode->i_private;
-  int ret;
   int fd;
 
   fd = bthcisock_host_open(dev->id);
@@ -186,8 +185,7 @@ static int bthcitty_close(FAR struct file *filep)
   dev->fd = -1;
 
   bthcitty_pollnotify(dev, POLLIN | POLLOUT);
-
-  return 0;
+  return OK;
 }
 
 static ssize_t bthcitty_read(FAR struct file *filep,
@@ -232,7 +230,6 @@ static ssize_t bthcitty_read(FAR struct file *filep,
   dev->recvpos += buflen;
 
   nxsem_post(&dev->recvlock);
-
   return buflen;
 }
 
@@ -392,7 +389,6 @@ static int bthcitty_poll(FAR struct file *filep,
     }
 
   nxsem_post(&dev->fdslock);
-
   return ret;
 }
 
@@ -405,7 +401,7 @@ void bthcitty_loop(void)
   FAR struct bthcitty_s *dev;
   FAR sq_entry_t *entry;
 
-  for (entry = sq_peek(&g_hcitty_list); entry; entry = sq_next(entry))
+  for (entry = sq_peek(&g_bthcitty_list); entry; entry = sq_next(entry))
     {
       dev = container_of(entry, struct bthcitty_s, link);
       if (bthcisock_host_avail(dev->fd))
@@ -439,7 +435,7 @@ int bthcitty_register(int dev_id)
 
   nxsem_set_protocol(&dev->recvsem, SEM_PRIO_NONE);
 
-  ret = register_driver(name, &g_hcitty_ops, 0666, dev);
+  ret = register_driver(name, &g_bthcitty_ops, 0666, dev);
   if (ret < 0)
     {
       nxsem_destroy(&dev->recvlock);
@@ -450,7 +446,6 @@ int bthcitty_register(int dev_id)
       return ret;
     }
 
-  sq_addlast(&dev->link, &g_hcitty_list);
-
-  return 0;
+  sq_addlast(&dev->link, &g_bthcitty_list);
+  return OK;
 }