Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d54452... Commit: d54452fbf84500eff77a55a2061f4669441d2cc3 Parent: b8e73fba60414e161d8fd2429b6fb268e34502e2 Author: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> AuthorDate: Sat Apr 26 22:25:21 2008 +0200 Committer: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> CommitDate: Sat Apr 26 22:25:21 2008 +0200 ide: factor out setting PCI bus-mastering from ide_hwif_setup_dma() Factor out setting PCI bus-mastering from ide_hwif_setup_dma() to ide_pci_set_master() helper. While at it: * don't read PCI Command register if not necessary * use PCI device name instead of hwif->name * cleanup ide_hwif_setup_dma() a bit Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> --- drivers/ide/setup-pci.c | 61 ++++++++++++++++++++++++++++------------------ 1 files changed, 37 insertions(+), 24 deletions(-) diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index f8fc972..bf28970 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -132,6 +132,29 @@ static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_ out: return dma_base; } + +/* + * Set up BM-DMA capability (PnP BIOS should have done this) + */ +static int ide_pci_set_master(struct pci_dev *dev, const char *name) +{ + u16 pcicmd; + + pci_read_config_word(dev, PCI_COMMAND, &pcicmd); + + if ((pcicmd & PCI_COMMAND_MASTER) == 0) { + pci_set_master(dev); + + if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || + (pcicmd & PCI_COMMAND_MASTER) == 0) { + printk(KERN_ERR "%s: error updating PCICMD on %s\n", + name, pci_name(dev)); + return -EIO; + } + } + + return 0; +} #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) @@ -340,36 +363,26 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, void ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d) { struct pci_dev *dev = to_pci_dev(hwif->dev); - u16 pcicmd; - - pci_read_config_word(dev, PCI_COMMAND, &pcicmd); if ((d->host_flags & IDE_HFLAG_NO_AUTODMA) == 0 || ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 0x80))) { unsigned long dma_base = ide_get_or_set_dma_base(d, hwif); - if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) { - /* - * Set up BM-DMA capability - * (PnP BIOS should have done this) - */ - pci_set_master(dev); - if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || !(pcicmd & PCI_COMMAND_MASTER)) { - printk(KERN_ERR "%s: %s error updating PCICMD\n", - hwif->name, d->name); - dma_base = 0; - } - } - if (dma_base) { - if (d->init_dma) - d->init_dma(hwif, dma_base); - - ide_setup_dma(hwif, dma_base); - } else { - printk(KERN_INFO "%s: %s Bus-Master DMA disabled " - "(BIOS)\n", hwif->name, d->name); - } + + if (dma_base == 0 || ide_pci_set_master(dev, d->name) < 0) + goto out_disabled; + + if (d->init_dma) + d->init_dma(hwif, dma_base); + + ide_setup_dma(hwif, dma_base); } + + return; + +out_disabled: + printk(KERN_INFO "%s: Bus-Master DMA disabled (BIOS) on %s\n", + d->name, pci_name(dev)); } #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ -- To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Srivatsa Vaddagiri | containers (was Re: -mm merge plans for 2.6.23) |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Benjamin Herrenschmidt | Re: [PATCH] Remove process freezer from suspend to RAM pathway |
git: | |
| Jarek Poplawski | [PATCH take 2] pkt_sched: Protect gen estimators under est_lock. |
| David Miller | [GIT]: Networking |
| Gerhard Pircher | 3c59x: shared interrupt problem |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
