dm: virtio: change return type to bool

Change return type to bool when returning int is not necessary.

Tracked-On: #2763
Signed-off-by: Peter Fang <peter.fang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
Peter Fang 2019-03-17 01:53:40 -07:00 committed by wenlingz
parent 8b192b1583
commit 6be9f15aa6

View File

@ -454,24 +454,24 @@ struct virtio_vq_info {
* *
* @param vq Pointer to struct virtio_vq_info. * @param vq Pointer to struct virtio_vq_info.
* *
* @return 0 on not ready and 1 on ready. * @return false on not ready and true on ready.
*/ */
static inline int static inline bool
vq_ring_ready(struct virtio_vq_info *vq) vq_ring_ready(struct virtio_vq_info *vq)
{ {
return (vq->flags & VQ_ALLOC); return ((vq->flags & VQ_ALLOC) == VQ_ALLOC);
} }
/** /**
* @brief Are there "available" descriptors? * @brief Are there "available" descriptors?
* *
* This does not count how many, just returns 1 if there is any. * This does not count how many, just returns true if there is any.
* *
* @param vq Pointer to struct virtio_vq_info. * @param vq Pointer to struct virtio_vq_info.
* *
* @return 0 on no available and 1 on available. * @return false on not available and true on available.
*/ */
static inline int static inline bool
vq_has_descs(struct virtio_vq_info *vq) vq_has_descs(struct virtio_vq_info *vq)
{ {
return (vq_ring_ready(vq) && vq->last_avail != return (vq_ring_ready(vq) && vq->last_avail !=