* [PATCH 19.11] igb_uio: fix build for switch fall through
@ 2021-12-15 19:00 Ferruh Yigit
2021-12-16 12:36 ` [PATCH 19.11 v2] " Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2021-12-15 19:00 UTC (permalink / raw)
To: stable; +Cc: Christian Ehrhardt
Linux is using '-Wimplicit-fallthrough=5' compiler option, which doesn't
take any fall through comments into account but only uses compiler
'fallthrough' attribute to document fall through action is intended.
"falls through" comment was used in the code which is causing a build
error now, this patch converts comment to the 'fallthrough' macro
defined in the Linux.
To cover the case where Linux version doesn't have the macro, defined it
in the compatibility header too.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
kernel/linux/igb_uio/compat.h | 4 ++++
kernel/linux/igb_uio/igb_uio.c | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel/linux/igb_uio/compat.h b/kernel/linux/igb_uio/compat.h
index 8dbb896ae118..04ff7f60031f 100644
--- a/kernel/linux/igb_uio/compat.h
+++ b/kernel/linux/igb_uio/compat.h
@@ -152,3 +152,7 @@ static inline bool igbuio_kernel_is_locked_down(void)
return false;
#endif
}
+
+#ifndef fallthrough
+#define fallthrough do {} while (0) /* fallthrough */
+#endif
diff --git a/kernel/linux/igb_uio/igb_uio.c b/kernel/linux/igb_uio/igb_uio.c
index 039f5a5f6354..57d0c58ab1b8 100644
--- a/kernel/linux/igb_uio/igb_uio.c
+++ b/kernel/linux/igb_uio/igb_uio.c
@@ -236,7 +236,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
}
#endif
- /* falls through - to MSI */
+ fallthrough;
case RTE_INTR_MODE_MSI:
#ifndef HAVE_ALLOC_IRQ_VECTORS
if (pci_enable_msi(udev->pdev) == 0) {
@@ -255,7 +255,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
break;
}
#endif
- /* falls through - to INTX */
+ fallthrough;
case RTE_INTR_MODE_LEGACY:
if (pci_intx_mask_supported(udev->pdev)) {
dev_dbg(&udev->pdev->dev, "using INTX");
@@ -265,7 +265,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
break;
}
dev_notice(&udev->pdev->dev, "PCI INTX mask not supported\n");
- /* falls through - to no IRQ */
+ fallthrough;
case RTE_INTR_MODE_NONE:
udev->mode = RTE_INTR_MODE_NONE;
udev->info.irq = UIO_IRQ_NONE;
--
2.33.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 19.11 v2] igb_uio: fix build for switch fall through
2021-12-15 19:00 [PATCH 19.11] igb_uio: fix build for switch fall through Ferruh Yigit
@ 2021-12-16 12:36 ` Ferruh Yigit
2021-12-17 7:07 ` Christian Ehrhardt
0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2021-12-16 12:36 UTC (permalink / raw)
To: stable; +Cc: Christian Ehrhardt
Linux is using '-Wimplicit-fallthrough=5' compiler option, which doesn't
take any fall through comments into account but only uses compiler
'fallthrough' attribute to document fall through action is intended.
"falls through" comment was used in the code which is causing a build
error now, this patch converts comment to the 'fallthrough' macro
defined in the Linux.
To cover the case where Linux version doesn't have the macro, defined it
in the compatibility header too.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
v2:
* Add both dummy and attribute fallthrough macro definition to
compatibility header.
---
kernel/linux/igb_uio/compat.h | 14 ++++++++++++++
kernel/linux/igb_uio/igb_uio.c | 6 +++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/kernel/linux/igb_uio/compat.h b/kernel/linux/igb_uio/compat.h
index 8dbb896ae118..850b359f3643 100644
--- a/kernel/linux/igb_uio/compat.h
+++ b/kernel/linux/igb_uio/compat.h
@@ -152,3 +152,17 @@ static inline bool igbuio_kernel_is_locked_down(void)
return false;
#endif
}
+
+#ifndef fallthrough
+
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(__fallthrough__)
+#define fallthrough __attribute__((__fallthrough__))
+#else
+#define fallthrough do {} while (0)
+#endif
+
+#endif
diff --git a/kernel/linux/igb_uio/igb_uio.c b/kernel/linux/igb_uio/igb_uio.c
index 039f5a5f6354..57d0c58ab1b8 100644
--- a/kernel/linux/igb_uio/igb_uio.c
+++ b/kernel/linux/igb_uio/igb_uio.c
@@ -236,7 +236,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
}
#endif
- /* falls through - to MSI */
+ fallthrough;
case RTE_INTR_MODE_MSI:
#ifndef HAVE_ALLOC_IRQ_VECTORS
if (pci_enable_msi(udev->pdev) == 0) {
@@ -255,7 +255,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
break;
}
#endif
- /* falls through - to INTX */
+ fallthrough;
case RTE_INTR_MODE_LEGACY:
if (pci_intx_mask_supported(udev->pdev)) {
dev_dbg(&udev->pdev->dev, "using INTX");
@@ -265,7 +265,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
break;
}
dev_notice(&udev->pdev->dev, "PCI INTX mask not supported\n");
- /* falls through - to no IRQ */
+ fallthrough;
case RTE_INTR_MODE_NONE:
udev->mode = RTE_INTR_MODE_NONE;
udev->info.irq = UIO_IRQ_NONE;
--
2.33.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 19.11 v2] igb_uio: fix build for switch fall through
2021-12-16 12:36 ` [PATCH 19.11 v2] " Ferruh Yigit
@ 2021-12-17 7:07 ` Christian Ehrhardt
0 siblings, 0 replies; 3+ messages in thread
From: Christian Ehrhardt @ 2021-12-17 7:07 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: stable
On Thu, Dec 16, 2021 at 1:36 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> Linux is using '-Wimplicit-fallthrough=5' compiler option, which doesn't
> take any fall through comments into account but only uses compiler
> 'fallthrough' attribute to document fall through action is intended.
>
> "falls through" comment was used in the code which is causing a build
> error now, this patch converts comment to the 'fallthrough' macro
> defined in the Linux.
>
> To cover the case where Linux version doesn't have the macro, defined it
> in the compatibility header too.
Thank you Ferruh, I've applied it to the WIP branch for test builds.
If nothing regresses I'll keep it and it will go into -rc2 later.
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
>
> v2:
> * Add both dummy and attribute fallthrough macro definition to
> compatibility header.
> ---
> kernel/linux/igb_uio/compat.h | 14 ++++++++++++++
> kernel/linux/igb_uio/igb_uio.c | 6 +++---
> 2 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/linux/igb_uio/compat.h b/kernel/linux/igb_uio/compat.h
> index 8dbb896ae118..850b359f3643 100644
> --- a/kernel/linux/igb_uio/compat.h
> +++ b/kernel/linux/igb_uio/compat.h
> @@ -152,3 +152,17 @@ static inline bool igbuio_kernel_is_locked_down(void)
> return false;
> #endif
> }
> +
> +#ifndef fallthrough
> +
> +#ifndef __has_attribute
> +#define __has_attribute(x) 0
> +#endif
> +
> +#if __has_attribute(__fallthrough__)
> +#define fallthrough __attribute__((__fallthrough__))
> +#else
> +#define fallthrough do {} while (0)
> +#endif
> +
> +#endif
> diff --git a/kernel/linux/igb_uio/igb_uio.c b/kernel/linux/igb_uio/igb_uio.c
> index 039f5a5f6354..57d0c58ab1b8 100644
> --- a/kernel/linux/igb_uio/igb_uio.c
> +++ b/kernel/linux/igb_uio/igb_uio.c
> @@ -236,7 +236,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
> }
> #endif
>
> - /* falls through - to MSI */
> + fallthrough;
> case RTE_INTR_MODE_MSI:
> #ifndef HAVE_ALLOC_IRQ_VECTORS
> if (pci_enable_msi(udev->pdev) == 0) {
> @@ -255,7 +255,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
> break;
> }
> #endif
> - /* falls through - to INTX */
> + fallthrough;
> case RTE_INTR_MODE_LEGACY:
> if (pci_intx_mask_supported(udev->pdev)) {
> dev_dbg(&udev->pdev->dev, "using INTX");
> @@ -265,7 +265,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
> break;
> }
> dev_notice(&udev->pdev->dev, "PCI INTX mask not supported\n");
> - /* falls through - to no IRQ */
> + fallthrough;
> case RTE_INTR_MODE_NONE:
> udev->mode = RTE_INTR_MODE_NONE;
> udev->info.irq = UIO_IRQ_NONE;
> --
> 2.33.1
>
--
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-17 7:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15 19:00 [PATCH 19.11] igb_uio: fix build for switch fall through Ferruh Yigit
2021-12-16 12:36 ` [PATCH 19.11 v2] " Ferruh Yigit
2021-12-17 7:07 ` Christian Ehrhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).