Branch: refs/heads/main Home: https://github.com/OpenAMP/open-amp Commit: ca56246b19dcf2995dbf5bb75d0b0e596611e8de https://github.com/OpenAMP/open-amp/commit/ca56246b19dcf2995dbf5bb75d0b0e596... Author: Andrew Davis afd@ti.com Date: 2024-04-23 (Tue, 23 Apr 2024)
Changed paths: M cmake/options.cmake M lib/include/openamp/virtio.h M lib/remoteproc/remoteproc.c M lib/remoteproc/remoteproc_virtio.c M lib/rpmsg/rpmsg_virtio.c M lib/virtio/virtio.c M lib/virtio/virtqueue.c
Log Message: ----------- 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
Commit: 7a8c29275460855a997eefbebfb2a2dbe100076b https://github.com/OpenAMP/open-amp/commit/7a8c29275460855a997eefbebfb2a2dbe... Author: Andrew Davis afd@ti.com Date: 2024-04-23 (Tue, 23 Apr 2024)
Changed paths: M lib/include/openamp/virtio.h M lib/remoteproc/remoteproc.c M lib/remoteproc/remoteproc_virtio.c M lib/rpmsg/rpmsg_virtio.c M lib/virtio/virtio.c M lib/virtio/virtqueue.c
Log Message: ----------- lib: Add and use VIRTIO_ENABLED() macro
Checks if this symbol is defined and set to equal 1. Used to make it more clear that a preprocessor level check is intended.
Signed-off-by: Andrew Davis afd@ti.com
Commit: f939a8614392c6a4f216660169ac73f846f1516d https://github.com/OpenAMP/open-amp/commit/f939a8614392c6a4f216660169ac73f84... Author: Andrew Davis afd@ti.com Date: 2024-04-23 (Tue, 23 Apr 2024)
Changed paths: M lib/include/openamp/virtio.h M lib/remoteproc/remoteproc_virtio.c M lib/virtio/virtio.c M lib/virtio/virtqueue.c
Log Message: ----------- lib: Add and use VIRTIO_ROLE_IS_{DRIVER,DEVICE}() macros
There is a common pattern of checking the virtio role while also checking that this role is supported in this build, which can help optimize away unusable code. Add a couple macros for this. This has two main benefits, first being shorter and easier to read if statements, and also makes it easier to not forget to always do both checks.
Use these everywhere except rpmsg_virtio.c which needs one more refactor before we can switch it over.
Signed-off-by: Andrew Davis afd@ti.com
Compare: https://github.com/OpenAMP/open-amp/compare/fd6a6fdda776...f939a8614392
To unsubscribe from these emails, change your notification settings at https://github.com/OpenAMP/open-amp/settings/notifications
openamp-rp@lists.openampproject.org