[patch 06/20] chardev: GPIO for SCx200: refactor shadow-register init to function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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>
---
[jimc@harpo gpio-scx]$ diffstat patch.init-refactor
scx200.c |   15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)


diff -ruNp -X dontdiff -X exclude-diffs ab-6/arch/i386/kernel/scx200.c ab-7/arch/i386/kernel/scx200.c
--- ab-6/arch/i386/kernel/scx200.c	2006-06-02 13:36:42.000000000 -0600
+++ ab-7/arch/i386/kernel/scx200.c	2006-06-02 13:36:58.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 */



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux