ALSA: sis7019: Use pcim_iomap_region() for MMIO BAR
PATCH 1/1 ALSA: sis7019: Use pcim_iomap_region() for MMIO BAR
Replace the open-coded pcim_request_all_regions() + devm_ioremap() pair with per-BAR pcim helpers: reserve BAR0 (the I/O port region, used via inl/outl) with pcim_request_region(), and reserve + iomap BAR1 (MMIO) with a single pcim_iomap_region() call.
This folds the BAR1 reserve and iomap into one managed call. The error check moves from a NULL test to IS_ERR(), since pcim_iomap_region() returns an IOMEM_ERR_PTR on failure.
--- sound/pci/sis7019.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/pci/sis7019.c +5 -5
@@ -1260,16 +1260,16 @@ static int sis_chip_create(struct snd_card *card, sis->irq =-1 ; sis->ioport =pci_resource_start (pci,0 ); - rc =pcim_request_all_regions (pci,"SiS7019" ); + rc =pcim_request_region (pci,0 ,"SiS7019" );if (rc) { -dev_err (&pci->dev,"unable request regions\n" ); +dev_err (&pci->dev,"unable request I/O region\n" );return rc; } - sis->ioaddr =devm_ioremap (&pci->dev,pci_resource_start (pci,1 ),0x4000 ); -if (!sis->ioaddr) { + sis->ioaddr =pcim_iomap_region (pci,1 ,"SiS7019" ); +if (IS_ERR (sis->ioaddr)) {dev_err (&pci->dev,"unable to remap MMIO, aborting\n" ); -return -EIO ; +return PTR_ERR (sis->ioaddr); } rc =sis_alloc_suspend (sis);
Signature · 1 line
2.55.0
Quoted 6 lines · Rosen Penev
Replace the open-coded
pcim_request_all_regions()+devm_ioremap()pair with per-BAR pcim helpers: reserve BAR0 (the I/O port region, used via inl/outl) withpcim_request_region(), and reserve + iomap BAR1 (MMIO) with a singlepcim_iomap_region()call.
Quoted 6 lines
This folds the BAR1 reserve and iomap into one managed call. The error check moves from a NULL test to
IS_ERR(), sincepcim_iomap_region()returns anIOMEM_ERR_PTRon failure.Assisted-by opencode:hy3-freeSigned-off-by Rosen Penev <[email protected]>
The original code had a fixed BAR size, but let's hope that it was just a lazy code and not a workaround.
Applied now to for-next branch. Thanks.
Takashi