mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
drivers/virtio: use virtqueue_nused() to check pending buffers
Replace direct virtqueue internal field access with virtqueue_nused() API to check for pending buffers in interrupt handlers. This improves code maintainability and handles cached memory scenarios correctly. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
parent
1900d4c8fb
commit
3237e25d70
2 changed files with 2 additions and 4 deletions
|
|
@ -755,8 +755,7 @@ static int virtio_mmio_interrupt(int irq, FAR void *context, FAR void *arg)
|
|||
for (i = 0; i < vmdev->vdev.vrings_num; i++)
|
||||
{
|
||||
vq = vrings_info[i].vq;
|
||||
if (vq->vq_used_cons_idx != vq->vq_ring.used->idx &&
|
||||
vq->callback != NULL)
|
||||
if (vq->callback != NULL && virtqueue_nused(vq) > 0)
|
||||
{
|
||||
vq->callback(vq);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,7 @@ static void virtio_pci_vq_callback(FAR struct virtio_pci_device_s *vpdev)
|
|||
for (i = 0; i < vpdev->vdev.vrings_num; i++)
|
||||
{
|
||||
vq = vrings_info[i].vq;
|
||||
if (vq->vq_used_cons_idx != vq->vq_ring.used->idx &&
|
||||
vq->callback != NULL)
|
||||
if (vq->callback != NULL && virtqueue_nused(vq) > 0)
|
||||
{
|
||||
vq->callback(vq);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue