Lines Matching refs:pdev

131 static struct i2c_adapter *get_i2c_adap(struct platform_device *pdev)
135 mutex_lock(&pdev->dev.mutex);
136 dev = device_find_child(&pdev->dev, NULL, match_i2c_adap);
137 mutex_unlock(&pdev->dev.mutex);
147 static struct spi_controller *get_spi_adap(struct platform_device *pdev)
151 mutex_lock(&pdev->dev.mutex);
152 dev = device_find_child(&pdev->dev, NULL, match_spi_adap);
153 mutex_unlock(&pdev->dev.mutex);
180 struct pci_dev *pdev = mgbdev->pdev;
181 struct device *dev = &pdev->dev;
186 resource_size_t mapbase = pci_resource_start(pdev, MGB4_MGB4_BAR_ID);
193 spi_resources[0].parent = &pdev->resource[MGB4_MGB4_BAR_ID];
199 id = pci_dev_id(pdev);
282 struct pci_dev *pdev = mgbdev->pdev;
283 struct device *dev = &pdev->dev;
287 resource_size_t mapbase = pci_resource_start(pdev, MGB4_MGB4_BAR_ID);
294 i2c_resources[0].parent = &pdev->resource[MGB4_MGB4_BAR_ID];
300 id = pci_dev_id(pdev);
359 struct device *dev = &mgbdev->pdev->dev;
384 struct device *dev = &mgbdev->pdev->dev;
419 static int map_regs(struct pci_dev *pdev, struct resource *res,
423 resource_size_t mapbase = pci_resource_start(pdev, MGB4_MGB4_BAR_ID);
430 dev_err(&pdev->dev, "failed to map %s registers\n", res->name);
442 struct pci_dev *pdev = mgbdev->pdev;
443 struct device *dev = &pdev->dev;
446 res[0].start = pci_resource_start(pdev, MGB4_XDMA_BAR_ID);
447 res[0].end = pci_resource_end(pdev, MGB4_XDMA_BAR_ID);
449 res[0].parent = &pdev->resource[MGB4_XDMA_BAR_ID];
450 res[1].start = pci_irq_vector(pdev, 0);
490 static int mgb4_probe(struct pci_dev *pdev, const struct pci_device_id *id)
506 int irqs = pci_msix_vec_count(pdev);
512 mgbdev->pdev = pdev;
513 pci_set_drvdata(pdev, mgbdev);
516 rv = pci_enable_device(pdev);
518 dev_err(&pdev->dev, "error enabling PCI device\n");
522 rv = pcie_capability_set_word(pdev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN);
524 dev_warn(&pdev->dev, "error enabling PCIe relaxed ordering\n");
525 rv = pcie_capability_set_word(pdev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_EXT_TAG);
527 dev_warn(&pdev->dev, "error enabling PCIe extended tag field\n");
528 rv = pcie_set_readrq(pdev, 512);
530 dev_warn(&pdev->dev, "error setting PCIe max. memory read size\n");
531 pci_set_master(pdev);
533 rv = pci_alloc_irq_vectors(pdev, irqs, irqs, PCI_IRQ_MSIX);
535 dev_err(&pdev->dev, "error allocating MSI-X IRQs\n");
539 rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
541 dev_err(&pdev->dev, "error setting DMA mask\n");
554 rv = map_regs(pdev, &video, &mgbdev->video);
558 rv = map_regs(pdev, &cmt, &mgbdev->cmt);
573 rv = device_add_groups(&pdev->dev, mgb4_pci_groups);
579 mgbdev->hwmon_dev = hwmon_device_register_with_info(&pdev->dev, "mgb4",
586 mgbdev->debugfs = debugfs_create_dir(dev_name(&pdev->dev), NULL);
594 dev_warn(&pdev->dev, "error reading card serial number\n");
631 pci_disable_msix(pdev);
633 pci_disable_device(pdev);
640 static void mgb4_remove(struct pci_dev *pdev)
642 struct mgb4_dev *mgbdev = pci_get_drvdata(pdev);
662 device_remove_groups(&mgbdev->pdev->dev, mgb4_pci_groups);
671 pci_disable_msix(mgbdev->pdev);
672 pci_disable_device(mgbdev->pdev);