mirror of https://gitee.com/openkylin/linux.git
s390/PCI: Use generic pci_enable_resources()
The generic pci_enable_resources() does essentially the same thing as the code in the s390 version of pcibios_enable_device(). There are differences, but I don't think any of them are a problem. The generic code: - Checks everything up to PCI_NUM_RESOURCES, not PCI_BAR_COUNT (6), so we'll now check the ROM resource, IOV resources, and bridge windows. - Checks for res->flags & IORESOURCE_UNSET. The s390 code never sets IORESOURCE_UNSET, so this isn't a problem. - Checks res->parent. The s390 pcibios_add_device() calls pci_claim_resource() on all BARs (except ROM, IOV, and bridge windows) so this isn't a problem either. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
This commit is contained in:
parent
05d58f6075
commit
d753323253
|
@ -686,27 +686,13 @@ int pcibios_add_device(struct pci_dev *pdev)
|
||||||
int pcibios_enable_device(struct pci_dev *pdev, int mask)
|
int pcibios_enable_device(struct pci_dev *pdev, int mask)
|
||||||
{
|
{
|
||||||
struct zpci_dev *zdev = get_zdev(pdev);
|
struct zpci_dev *zdev = get_zdev(pdev);
|
||||||
struct resource *res;
|
|
||||||
u16 cmd;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
zdev->pdev = pdev;
|
zdev->pdev = pdev;
|
||||||
zpci_debug_init_device(zdev);
|
zpci_debug_init_device(zdev);
|
||||||
zpci_fmb_enable_device(zdev);
|
zpci_fmb_enable_device(zdev);
|
||||||
zpci_map_resources(zdev);
|
zpci_map_resources(zdev);
|
||||||
|
|
||||||
pci_read_config_word(pdev, PCI_COMMAND, &cmd);
|
return pci_enable_resources(pdev, mask);
|
||||||
for (i = 0; i < PCI_BAR_COUNT; i++) {
|
|
||||||
res = &pdev->resource[i];
|
|
||||||
|
|
||||||
if (res->flags & IORESOURCE_IO)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (res->flags & IORESOURCE_MEM)
|
|
||||||
cmd |= PCI_COMMAND_MEMORY;
|
|
||||||
}
|
|
||||||
pci_write_config_word(pdev, PCI_COMMAND, cmd);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcibios_disable_device(struct pci_dev *pdev)
|
void pcibios_disable_device(struct pci_dev *pdev)
|
||||||
|
|
Loading…
Reference in New Issue