public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru•mvista.com>
To: Paul Mackerras <paulus@samba•org>,
	Kumar Gala <galak@kernel•crashing.org>
Cc: linuxppc-dev@ozlabs•org
Subject: [PATCH] powerpc: implement OF PCI address accessors stubs for CONFIG_PCI=n
Date: Wed, 11 Jun 2008 02:31:00 +0400	[thread overview]
Message-ID: <20080610223100.GA3359@polina.dev.rtsoft.ru> (raw)

To avoid "#ifdef CONFIG_PCI" in the drivers we should provide stubs in
place of OF PCI address accessors.

Without these stubs build breaks for drivers not strictly requiring PCI,
for example CONFIG_FB_OF=y without CONFIG_PCI:

  LD      .tmp_vmlinux1
drivers/built-in.o: In function `offb_map_reg':
offb.c:(.text+0x6e7c): undefined reference to `of_get_pci_address'

OF PCI IRQ accessors require pci_dev argument, so drivers using PCI
IRQs should depend on CONFIG_PCI anyway.

Signed-off-by: Anton Vorontsov <avorontsov@ru•mvista.com>
---

Other option is to patch offb.c with #ifdef CONFIG_PCI. Though, I think
stubs looks better.

 include/asm-powerpc/prom.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 78b7b0d..eb3bd2e 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -212,8 +212,16 @@ extern u64 of_translate_dma_address(struct device_node *dev,
  */
 extern const u32 *of_get_address(struct device_node *dev, int index,
 			   u64 *size, unsigned int *flags);
+#ifdef CONFIG_PCI
 extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
 			       u64 *size, unsigned int *flags);
+#else
+static inline const u32 *of_get_pci_address(struct device_node *dev,
+		int bar_no, u64 *size, unsigned int *flags)
+{
+	return NULL;
+}
+#endif /* CONFIG_PCI */
 
 /* Get an address as a resource. Note that if your address is
  * a PIO address, the conversion will fail if the physical address
@@ -223,8 +231,16 @@ extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
  */
 extern int of_address_to_resource(struct device_node *dev, int index,
 				  struct resource *r);
+#ifdef CONFIG_PCI
 extern int of_pci_address_to_resource(struct device_node *dev, int bar,
 				      struct resource *r);
+#else
+static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
+		struct resource *r)
+{
+	return -ENOSYS;
+}
+#endif /* CONFIG_PCI */
 
 /* Parse the ibm,dma-window property of an OF node into the busno, phys and
  * size parameters.
-- 
1.5.5.4

                 reply	other threads:[~2008-06-10 22:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080610223100.GA3359@polina.dev.rtsoft.ru \
    --to=avorontsov@ru$(echo .)mvista.com \
    --cc=galak@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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