Skip to content

Commit dceed69

Browse files
committed
Merge branch 'pci/devres'
- Export pcim_request_region(), a managed counterpart of pci_request_region(), for use by drivers (Philipp Stanner) - Request the PCI BAR used by xboxvideo (Philipp Stanner) - Export pcim_iomap_region() and deprecate pcim_iomap_regions() (Philipp Stanner) - Request and map drm/ast BARs with pcim_iomap_region() (Philipp Stanner) * pci/devres: drm/ast: Request PCI BAR with devres PCI: Deprecate pcim_iomap_regions() in favor of pcim_iomap_region() drm/vboxvideo: Add PCI region request PCI: Make pcim_request_region() a public function
2 parents 59b748c + 2eb20b9 commit dceed69

5 files changed

Lines changed: 20 additions & 10 deletions

File tree

drivers/gpu/drm/ast/ast_drv.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
287287
if (ret)
288288
return ret;
289289

290-
regs = pcim_iomap(pdev, 1, 0);
291-
if (!regs)
292-
return -EIO;
290+
regs = pcim_iomap_region(pdev, 1, "ast");
291+
if (IS_ERR(regs))
292+
return PTR_ERR(regs);
293293

294294
if (pdev->revision >= 0x40) {
295295
/*
@@ -311,9 +311,9 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
311311

312312
if (len < AST_IO_MM_LENGTH)
313313
return -EIO;
314-
ioregs = pcim_iomap(pdev, 2, 0);
315-
if (!ioregs)
316-
return -EIO;
314+
ioregs = pcim_iomap_region(pdev, 2, "ast");
315+
if (IS_ERR(ioregs))
316+
return PTR_ERR(ioregs);
317317
} else {
318318
/*
319319
* Anything else is best effort.

drivers/gpu/drm/vboxvideo/vbox_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ int vbox_hw_init(struct vbox_private *vbox)
114114

115115
DRM_INFO("VRAM %08x\n", vbox->full_vram_size);
116116

117+
ret = pcim_request_region(pdev, 0, "vboxvideo");
118+
if (ret)
119+
return ret;
120+
117121
/* Map guest-heap at end of vram */
118122
vbox->guest_heap = pcim_iomap_range(pdev, 0,
119123
GUEST_HEAP_OFFSET(vbox), GUEST_HEAP_SIZE);

drivers/pci/devres.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ EXPORT_SYMBOL(pcim_iounmap);
728728
* Mapping and region will get automatically released on driver detach. If
729729
* desired, release manually only with pcim_iounmap_region().
730730
*/
731-
static void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
731+
void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
732732
const char *name)
733733
{
734734
int ret;
@@ -761,6 +761,7 @@ static void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
761761

762762
return IOMEM_ERR_PTR(ret);
763763
}
764+
EXPORT_SYMBOL(pcim_iomap_region);
764765

765766
/**
766767
* pcim_iounmap_region - Unmap and release a PCI BAR
@@ -783,14 +784,17 @@ static void pcim_iounmap_region(struct pci_dev *pdev, int bar)
783784
}
784785

785786
/**
786-
* pcim_iomap_regions - Request and iomap PCI BARs
787+
* pcim_iomap_regions - Request and iomap PCI BARs (DEPRECATED)
787788
* @pdev: PCI device to map IO resources for
788789
* @mask: Mask of BARs to request and iomap
789790
* @name: Name associated with the requests
790791
*
791792
* Returns: 0 on success, negative error code on failure.
792793
*
793794
* Request and iomap regions specified by @mask.
795+
*
796+
* This function is DEPRECATED. Do not use it in new code.
797+
* Use pcim_iomap_region() instead.
794798
*/
795799
int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name)
796800
{
@@ -863,6 +867,7 @@ int pcim_request_region(struct pci_dev *pdev, int bar, const char *name)
863867
{
864868
return _pcim_request_region(pdev, bar, name, 0);
865869
}
870+
EXPORT_SYMBOL(pcim_request_region);
866871

867872
/**
868873
* pcim_request_region_exclusive - Request a PCI BAR exclusively

drivers/pci/pci.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,6 @@ static inline pci_power_t mid_pci_get_power_state(struct pci_dev *pdev)
892892
#endif
893893

894894
int pcim_intx(struct pci_dev *dev, int enable);
895-
896-
int pcim_request_region(struct pci_dev *pdev, int bar, const char *name);
897895
int pcim_request_region_exclusive(struct pci_dev *pdev, int bar,
898896
const char *name);
899897
void pcim_release_region(struct pci_dev *pdev, int bar);

include/linux/pci.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,8 +2291,11 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,
22912291
#endif
22922292

22932293
void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
2294+
void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
2295+
const char *name);
22942296
void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
22952297
void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
2298+
int pcim_request_region(struct pci_dev *pdev, int bar, const char *name);
22962299
int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name);
22972300
int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask,
22982301
const char *name);

0 commit comments

Comments
 (0)