mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Replace callse to ioctl() in the OS to file_ioctl()
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
int bchdev_unregister(FAR const char *chardev)
|
||||
{
|
||||
FAR struct bchlib_s *bch;
|
||||
int fd;
|
||||
FAR struct file *filestruct;
|
||||
int ret;
|
||||
|
||||
/* Sanity check */
|
||||
@@ -87,19 +87,20 @@ int bchdev_unregister(FAR const char *chardev)
|
||||
|
||||
/* Open the character driver associated with chardev */
|
||||
|
||||
fd = nx_open(chardev, O_RDONLY);
|
||||
if (fd < 0)
|
||||
ret = file_open(&filestruct, chardev, O_RDONLY);
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to open %s: %d\n", chardev, fd);
|
||||
return fd;
|
||||
_err("ERROR: Failed to open %s: %d\n", chardev, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get a reference to the internal data structure. On success, we
|
||||
* will hold a reference count on the state structure.
|
||||
*/
|
||||
|
||||
ret = ioctl(fd, DIOC_GETPRIV, (unsigned long)((uintptr_t)&bch));
|
||||
(void)close(fd);
|
||||
ret = file_ioctl(&filestruct, DIOC_GETPRIV,
|
||||
(unsigned long)((uintptr_t)&bch));
|
||||
(void)file_close_detached(&filestruct);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user