linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Randy Dunlap <rdunlap@infradead.org>, linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org, kernel test robot <lkp@intel.com>,
	Anton Blanchard <anton@samba.org>
Subject: Re: [PATCH v2] powerpc: iommu: fix build when neither PCI or IBMVIO is set
Date: Mon, 5 Apr 2021 11:04:53 +0200	[thread overview]
Message-ID: <135d33bc-5520-d49b-dd1c-582c7d8e3bac@csgroup.eu> (raw)
In-Reply-To: <20210404192623.10697-1-rdunlap@infradead.org>



Le 04/04/2021 à 21:26, Randy Dunlap a écrit :
> When neither CONFIG_PCI nor CONFIG_IBMVIO is set/enabled, iommu.c has a
> build error. The fault injection code is not useful in that kernel config,
> so make the FAIL_IOMMU option depend on PCI || IBMVIO.
> 
> Prevents this build error (warning escalated to error):
> ../arch/powerpc/kernel/iommu.c:178:30: error: 'fail_iommu_bus_notifier' defined but not used [-Werror=unused-variable]
>    178 | static struct notifier_block fail_iommu_bus_notifier = {
> 
> Fixes: d6b9a81b2a45 ("powerpc: IOMMU fault injection")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: Anton Blanchard <anton@samba.org>
> ---
> I was supposed to update this about one month ago, but then I lost
> some email and also took a break for a few weeks, then I remembered,
> so here it is.
> 
>   arch/powerpc/Kconfig.debug |    1 +
>   1 file changed, 1 insertion(+)

Wouldn't it be cleaner to get rid of those two horid #ifdefs ?
Of course we can do both.

diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 216871414434..d691afa8acf8 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -180,12 +180,10 @@ static struct notifier_block fail_iommu_bus_notifier = {

  static int __init fail_iommu_setup(void)
  {
-#ifdef CONFIG_PCI
-	bus_register_notifier(&pci_bus_type, &fail_iommu_bus_notifier);
-#endif
-#ifdef CONFIG_IBMVIO
-	bus_register_notifier(&vio_bus_type, &fail_iommu_bus_notifier);
-#endif
+	if (IS_ENABLED(CONFIG_PCI))
+		bus_register_notifier(&pci_bus_type, &fail_iommu_bus_notifier);
+	if (IS_ENABLED(CONFIG_IBMVIO))
+		bus_register_notifier(&vio_bus_type, &fail_iommu_bus_notifier);

  	return 0;
  }
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 86c799c97b77..361f4f255911 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -964,6 +964,8 @@ enum {
  #define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */
  #define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */

+extern struct bus_type pci_bus_type;
+
  /* These external functions are only available when PCI support is enabled */
  #ifdef CONFIG_PCI

@@ -986,8 +988,6 @@ enum pcie_bus_config_types {

  extern enum pcie_bus_config_types pcie_bus_config;

-extern struct bus_type pci_bus_type;
-
  /* Do NOT directly access these two variables, unless you are arch-specific PCI
   * code, or PCI core code. */
  extern struct list_head pci_root_buses;	/* List of all known PCI buses */

  reply	other threads:[~2021-04-05  9:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04 19:26 [PATCH v2] powerpc: iommu: fix build when neither PCI or IBMVIO is set Randy Dunlap
2021-04-05  9:04 ` Christophe Leroy [this message]
2021-04-05 16:31   ` Randy Dunlap
2021-04-10 14:28 ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=135d33bc-5520-d49b-dd1c-582c7d8e3bac@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lkp@intel.com \
    --cc=rdunlap@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).