[patch -mm 07/20] chardev: GPIO for SCx200 & PC-8736x: refactor scx200_probeto better segregate _gpio initialization

From: Jim Cromie
Date: Sat Jun 17 2006 - 14:28:04 EST


7/20. patch.init-refactor

Pull shadow-reg initialization into separate function now, rather than
doing it 2x later (scx200, pc8736x). When we revisit 2nd drvr below,
it will be to reimplement an init function, rather than another
refactor.

Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>

---

diffstat gpio-scx/patch.init-refactor
scx200.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)

diff -ruNp -X dontdiff -X exclude-diffs ax-6/arch/i386/kernel/scx200.c ax-7/arch/i386/kernel/scx200.c
--- ax-6/arch/i386/kernel/scx200.c 2006-06-17 01:13:26.000000000 -0600
+++ ax-7/arch/i386/kernel/scx200.c 2006-06-17 01:17:11.000000000 -0600
@@ -47,9 +47,17 @@ static struct pci_driver scx200_pci_driv

static DEFINE_SPINLOCK(scx200_gpio_config_lock);

-static int __devinit scx200_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+static void __devinit scx200_init_shadow(void)
{
int bank;
+
+ /* read the current values driven on the GPIO signals */
+ for (bank = 0; bank < 2; ++bank)
+ scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank);
+}
+
+static int __devinit scx200_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
unsigned base;

if (pdev->device == PCI_DEVICE_ID_NS_SCx200_BRIDGE ||
@@ -63,10 +71,7 @@ static int __devinit scx200_probe(struct
}

scx200_gpio_base = base;
-
- /* read the current values driven on the GPIO signals */
- for (bank = 0; bank < 2; ++bank)
- scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank);
+ scx200_init_shadow();

} else {
/* find the base of the Configuration Block */


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/