Skip to content

Commit

Permalink
[PATCH] chardev: GPIO for SCx200 & PC-8736x: refactor scx200_probe to…
Browse files Browse the repository at this point in the history
… better segregate _gpio initialization

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@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jim Cromie authored and Linus Torvalds committed Jun 28, 2006
1 parent 9550a33 commit 9b170b8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arch/i386/kernel/scx200.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ static struct pci_driver scx200_pci_driver = {

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 ||
Expand All @@ -63,10 +71,7 @@ static int __devinit scx200_probe(struct pci_dev *pdev, const struct pci_device_
}

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 */
Expand Down

0 comments on commit 9b170b8

Please sign in to comment.