2981 printk(KERN_INFO "%s: setting pci latency timer to %d\n",
2982 name, latency);
2983 pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
2984 }
2985 return 0;
2986}
2987
2988int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci)
2989{
2990 if (request_mem_region(pci_resource_start(pci,0),
2991 pci_resource_len(pci,0),
2992 core->name))
2993 return 0;
2994 printk(KERN_ERR
2995 "%s/%d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
2996 core->name, PCI_FUNC(pci->devfn),
2997 (unsigned long long)pci_resource_start(pci, 0),
2998 pci->subsystem_vendor, pci->subsystem_device);
2999 return -EBUSY;
3000}
3001
3002
3003
3004struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
3005{
3006 struct cx88_core *core;
3007 int i;
3008
3009 core = kzalloc(sizeof(*core), GFP_KERNEL);
3010
3011 atomic_inc(&core->refcount);
3012 core->pci_bus = pci->bus->number;
3013 core->pci_slot = PCI_SLOT(pci->devfn);
3014 core->pci_irqmask = PCI_INT_RISC_RD_BERRINT | PCI_INT_RISC_WR_BERRINT |
3015 PCI_INT_BRDG_BERRINT | PCI_INT_SRC_DMA_BERRINT |
3016 PCI_INT_DST_DMA_BERRINT | PCI_INT_IPB_DMA_BERRINT;
3017 mutex_init(&core->lock);
3018
3019 core->nr = nr;
3020 sprintf(core->name, "cx88[%d]", core->nr);
3021 if (0 != cx88_get_resources(core, pci)) {