diff --git a/arch/sim/src/sim/up_hcitty.c b/arch/sim/src/sim/up_hcitty.c index de60e1bd78..5b296569da 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; }