virtio-pci: Improve code style for including header files
PATCH 1/1 virtio-pci: Improve code style for including header files
Fix code style related to including header file. Include header files before declaring macro definitions to avoid conflicts.
--- drivers/virtio/virtio_pci_modern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/virtio/virtio_pci_modern.c +2 -1
@@ -15,9 +15,10 @@*/ #include <linux/delay.h> +#include "virtio_pci_common.h" +#define VIRTIO_PCI_NO_LEGACY #define VIRTIO_RING_NO_LEGACY -#include "virtio_pci_common.h" static u64 vp_get_features (struct virtio_device *vdev) {
Signature · 1 line
2.37.1 (Apple Git-137.1)
Michael S. Tsirkin
maintainerQuoted 5 lines · Feng Liu
Fix code style related to including header file. Include header files before declaring macro definitions to avoid conflicts.
Signed-off-by Feng Liu <[email protected]>Reviewed-by Jiri Pirko <[email protected]>
Which conflicts? These macros are there precisely to change how the header behaves.
Quoted 22 lines
--- drivers/virtio/virtio_pci_modern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/virtio/virtio_pci_modern.c +2
-1@@ -15,9 +15,10 @@*/ #include <linux/delay.h> +#include "virtio_pci_common.h" +#define VIRTIO_PCI_NO_LEGACY #define VIRTIO_RING_NO_LEGACY -#include "virtio_pci_common.h" static u64 vp_get_features (struct virtio_device *vdev) {Signature · 1 line
2.37.1 (Apple Git-137.1)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 4 lines · Michael S. Tsirkin
External email: Use caution opening links or attachments
On Mon, May 29, 2023 at 02:17:29PM -0400, Feng Liu wrote:
Quoted 9 lines
Quoted 5 lines
Fix code style related to including header file. Include header files before declaring macro definitions to avoid conflicts.
Signed-off-by Feng Liu <[email protected]>Reviewed-by Jiri Pirko <[email protected]>Which conflicts? These macros are there precisely to change how the header behaves.
Hi Michael
I think including the header files should be placed before the
macro definition.
If VIRTIO_PCI_NO_LEGACY and VIRTIO_RING_NO_LEGACY are needed for
control header file, we should put them at the beginning of virtio_pci_common.h.
What do you think?
Quoted 18 lines
Quoted 18 lines
--- drivers/virtio/virtio_pci_modern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/virtio/virtio_pci_modern.c +2
-1@@ -15,9 +15,10 @@*/ #include <linux/delay.h> +#include "virtio_pci_common.h" +#define VIRTIO_PCI_NO_LEGACY #define VIRTIO_RING_NO_LEGACY -#include "virtio_pci_common.h"
Quoted 5 lines
Quoted 4 lines
drivers/virtio/virtio_pci_modern.c +0
-1static u64 vp_get_features (struct virtio_device *vdev) { --2.37.1 (Apple Git-137.1)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 17 lines · Feng Liu
Quoted 4 lines · Michael S. Tsirkin
External email: Use caution opening links or attachments
On Mon, May 29, 2023 at 02:17:29PM -0400, Feng Liu wrote:
Quoted 9 lines
Quoted 5 lines
Fix code style related to including header file. Include header files before declaring macro definitions to avoid conflicts.
Signed-off-by Feng Liu <[email protected]>Reviewed-by Jiri Pirko <[email protected]>Which conflicts? These macros are there precisely to change how the header behaves.
Quoted 7 lines
Hi Michael
I think including the header files should be placed before the macro
definition.
IfVIRTIO_PCI_NO_LEGACYandVIRTIO_RING_NO_LEGACYare needed for control
header file, we should put them at the beginning ofvirtio_pci_common.h.What do you think?
I think you should read the code in question not make guesses.
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
--- drivers/virtio/virtio_pci_modern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/virtio/virtio_pci_modern.c +2
-1@@ -15,9 +15,10 @@*/ #include <linux/delay.h> +#include "virtio_pci_common.h" +#define VIRTIO_PCI_NO_LEGACY #define VIRTIO_RING_NO_LEGACY -#include "virtio_pci_common.h"
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
drivers/virtio/virtio_pci_modern.c +0
-1static u64 vp_get_features (struct virtio_device *vdev) { --2.37.1 (Apple Git-137.1)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 27 lines · Michael S. Tsirkin
External email: Use caution opening links or attachments
Quoted 23 lines · Feng Liu
Quoted 4 lines · Michael S. Tsirkin
External email: Use caution opening links or attachments
On Mon, May 29, 2023 at 02:17:29PM -0400, Feng Liu wrote:
Quoted 9 lines
Quoted 5 lines
Fix code style related to including header file. Include header files before declaring macro definitions to avoid conflicts.
Signed-off-by Feng Liu <[email protected]>Reviewed-by Jiri Pirko <[email protected]>Which conflicts? These macros are there precisely to change how the header behaves.
Hi Michael
I think including the header files should be placed before the macro
definition.
IfVIRTIO_PCI_NO_LEGACYandVIRTIO_RING_NO_LEGACYare needed for control
header file, we should put them at the beginning ofvirtio_pci_common.h.
Quoted 4 lines
Quoted 1 line
What do you think?
I think you should read the code in question not make guesses.
Okey. I see, thx
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
--- drivers/virtio/virtio_pci_modern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/virtio/virtio_pci_modern.c +2
-1@@ -15,9 +15,10 @@*/ #include <linux/delay.h> +#include "virtio_pci_common.h" +#define VIRTIO_PCI_NO_LEGACY #define VIRTIO_RING_NO_LEGACY -#include "virtio_pci_common.h"
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
drivers/virtio/virtio_pci_modern.c +0
-1static u64 vp_get_features (struct virtio_device *vdev) { --2.37.1 (Apple Git-137.1)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization