mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-04 05:46:49 +00:00
pcmcia: Use CardBus window names (PCI_CB_BRIDGE_IO_0_WINDOW etc) when freeing
Remove the loop used to free CardBus resources and replace it with a yenta_free_res() helper used to release bridge resources explicitly. Link: https://lore.kernel.org/r/20200520183411.1534621-3-kw@linux.com Signed-off-by: Krzysztof Wilczynski <kw@linux.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
parent
6e0688dbff
commit
11fdcf0503
@ -745,6 +745,18 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void yenta_free_res(struct yenta_socket *socket, int nr)
|
||||
{
|
||||
struct pci_dev *dev = socket->dev;
|
||||
struct resource *res;
|
||||
|
||||
res = &dev->resource[nr];
|
||||
if (res->start != 0 && res->end != 0)
|
||||
release_resource(res);
|
||||
|
||||
res->start = res->end = res->flags = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the bridge mappings for the device..
|
||||
*/
|
||||
@ -773,14 +785,10 @@ static void yenta_allocate_resources(struct yenta_socket *socket)
|
||||
*/
|
||||
static void yenta_free_resources(struct yenta_socket *socket)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
struct resource *res;
|
||||
res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i;
|
||||
if (res->start != 0 && res->end != 0)
|
||||
release_resource(res);
|
||||
res->start = res->end = res->flags = 0;
|
||||
}
|
||||
yenta_free_res(socket, PCI_CB_BRIDGE_IO_0_WINDOW);
|
||||
yenta_free_res(socket, PCI_CB_BRIDGE_IO_1_WINDOW);
|
||||
yenta_free_res(socket, PCI_CB_BRIDGE_MEM_0_WINDOW);
|
||||
yenta_free_res(socket, PCI_CB_BRIDGE_MEM_1_WINDOW);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user