mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
drivers/can: enter_critical_section in can_poll
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
247bc10c26
commit
908ee31e7d
+7
-1
@@ -1024,6 +1024,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
FAR struct can_reader_s *reader = NULL;
|
FAR struct can_reader_s *reader = NULL;
|
||||||
pollevent_t eventset;
|
pollevent_t eventset;
|
||||||
int ndx;
|
int ndx;
|
||||||
|
irqstate_t flags;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -1036,6 +1037,8 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
|
||||||
DEBUGASSERT(filep->f_priv != NULL);
|
DEBUGASSERT(filep->f_priv != NULL);
|
||||||
reader = (FAR struct can_reader_s *)filep->f_priv;
|
reader = (FAR struct can_reader_s *)filep->f_priv;
|
||||||
|
|
||||||
@@ -1048,7 +1051,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
* will abort the operation
|
* will abort the operation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return ret;
|
goto return_with_irqdisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Are we setting up the poll? Or tearing it down? */
|
/* Are we setting up the poll? Or tearing it down? */
|
||||||
@@ -1162,6 +1165,9 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
|
|
||||||
errout:
|
errout:
|
||||||
can_givesem(&dev->cd_pollsem);
|
can_givesem(&dev->cd_pollsem);
|
||||||
|
|
||||||
|
return_with_irqdisabled:
|
||||||
|
leave_critical_section(flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user