Skip to content

Commit

Permalink
lib: fix build error using legacy VIRTIO_DEVICE/DRIVER_ONLY
Browse files Browse the repository at this point in the history
As part of the deprecation process for VIRTIO_DEVICE_ONLY and
VIRTIO_DRIVER_ONLY, we should still support builds without errors when
possible.
For legacy support, define VIRTIO_DRIVER_SUPPORT and VIRTIO_DEVICE_SUPPORT
default values based on VIRTIO_DEVICE_ONLY and VIRTIO_DRIVER_ONLY.

Signed-off-by: Arnaud Pouliquen <[email protected]>
  • Loading branch information
arnopo committed May 22, 2024
1 parent fdef576 commit 0538be5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/include/openamp/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ extern "C" {
#define VIRTIO_DEV_DRIVER 0UL
#define VIRTIO_DEV_DEVICE 1UL

#if !defined(VIRTIO_DRIVER_SUPPORT) && !defined(VIRTIO_DEVICE_SUPPORT)
#ifdef VIRTIO_DRIVER_ONLY
#warning "VIRTIO_DRIVER_ONLY is deprecated, please use VIRTIO_DEVICE_SUPPORT=0"
#endif

#ifdef VIRTIO_DEVICE_ONLY
#define VIRTIO_DRIVER_SUPPORT 1
#define VIRTIO_DEVICE_SUPPORT 0
#elif VIRTIO_DEVICE_ONLY
#warning "VIRTIO_DEVICE_ONLY is deprecated, please use VIRTIO_DRIVER_SUPPORT=0"
#endif
#define VIRTIO_DRIVER_SUPPORT 0
#define VIRTIO_DEVICE_SUPPORT 1
#else
#warning "VIRTIO_DRIVER_SUPPORT and/or VIRTIO_DEVICE_SUPPORT should be defined"
#define VIRTIO_DRIVER_SUPPORT 1
#define VIRTIO_DEVICE_SUPPORT 1
#endif /* VIRTIO_DRIVER_ONLY */
#endif /*!defined(VIRTIO_DRIVER_SUPPORT) && !defined(VIRTIO_DEVICE_SUPPORT)*/

#define VIRTIO_ENABLED(option) (option == 1)

Expand Down

0 comments on commit 0538be5

Please sign in to comment.