mirror of
https://github.com/OpenAMP/open-amp.git
synced 2026-09-28 16:17:23 +08:00
lib: Use VIRTIO_{DRIVER,DEVICE}_SUPPORT to improve readability
Currently compiler defines are defined when support for driver or device is the only support being built. This is a negative define, it surrounds the code to not be built and we use ifndef. This is confusing. It also leaves ifndefs all throughout the code-base. Instead, define a macro that is set to 1 if support is enabled. Use this inline in if statements where possible. Any sane compiler will optimize away the code in the branch when support is not enabled just the same as when using the preprocessor so we keep the same binary size. Signed-off-by: Andrew Davis <afd@ti.com>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
fd6a6fdda7
commit
ca56246b19
@@ -86,13 +86,19 @@ __deprecated static inline int deprecated_virtio_dev_slave(void)
|
||||
}
|
||||
|
||||
#ifdef VIRTIO_MASTER_ONLY
|
||||
#define VIRTIO_DRIVER_ONLY
|
||||
#warning "VIRTIO_MASTER_ONLY is deprecated, please use VIRTIO_DRIVER_ONLY"
|
||||
#warning "VIRTIO_MASTER_ONLY is deprecated, please use VIRTIO_DEVICE_SUPPORT=0"
|
||||
#endif
|
||||
|
||||
#ifdef VIRTIO_SLAVE_ONLY
|
||||
#define VIRTIO_DEVICE_ONLY
|
||||
#warning "VIRTIO_SLAVE_ONLY is deprecated, please use VIRTIO_DEVICE_ONLY"
|
||||
#warning "VIRTIO_SLAVE_ONLY is deprecated, please use VIRTIO_DRIVER_SUPPORT=0"
|
||||
#endif
|
||||
|
||||
#ifdef VIRTIO_DRIVER_ONLY
|
||||
#warning "VIRTIO_DRIVER_ONLY is deprecated, please use VIRTIO_DEVICE_SUPPORT=0"
|
||||
#endif
|
||||
|
||||
#ifdef VIRTIO_DEVICE_ONLY
|
||||
#warning "VIRTIO_DEVICE_ONLY is deprecated, please use VIRTIO_DRIVER_SUPPORT=0"
|
||||
#endif
|
||||
|
||||
/** @brief Virtio device identifier. */
|
||||
|
||||
Reference in New Issue
Block a user