linux-mips
[Top] [All Lists]

Re: [PATCH v3 4/7] MIPS: ath79: add a common PCI registration function

To: Gabor Juhos <juhosg@openwrt.org>
Subject: Re: [PATCH v3 4/7] MIPS: ath79: add a common PCI registration function
From: Sergei Shtylyov <sshtylyov@mvista.com>
Date: Mon, 21 Nov 2011 14:17:50 +0400
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org, Rene Bolldorf <xsecute@googlemail.com>
In-reply-to: <1321825151-16053-5-git-send-email-juhosg@openwrt.org>
References: <1321825151-16053-1-git-send-email-juhosg@openwrt.org> <1321825151-16053-5-git-send-email-juhosg@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
Hello.

On 21-11-2011 1:39, Gabor Juhos wrote:

The current code unconditionally registers the AR724X
specific PCI controller, even if the kernel is running
on a different SoC.

Add a common function for PCI controller registration,
and only register the AR724X PCI controller if the kernel
is running on an AR724X SoC.

Signed-off-by: Gabor Juhos<juhosg@openwrt.org>
---
v3: - fix compile error if CONFIG_PCI is not defined
     - add __init annotation to ath79_register_pci

v2: - no changes
[...]

diff --git a/arch/mips/ath79/pci.c b/arch/mips/ath79/pci.c
index 4957428..342363b 100644
--- a/arch/mips/ath79/pci.c
+++ b/arch/mips/ath79/pci.c

@@ -44,3 +46,15 @@ int pcibios_plat_dev_init(struct pci_dev *dev)

        return PCIBIOS_SUCCESSFUL;
  }
+
+int __init ath79_register_pci(void)
+{
+       int ret;
+
+       if (soc_is_ar724x())
+               ret = ath724x_pcibios_init();
+       else
+               ret = -ENODEV;

   Why not return right away and save 4 lines of code?

+
+       return ret;
+}

WBR, Sergei

<Prev in Thread] Current Thread [Next in Thread>