From: Krzysztof Wilczynski <kw@linux.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
Chuhong Yuan <hslester96@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Takashi Iwai <tiwai@suse.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-pci@vger.kernel.org
Subject: [PATCH v3 2/2] pcmcia: Use resources definitions when freeing CardBus resources
Date: Wed, 20 May 2020 18:34:11 +0000 [thread overview]
Message-ID: <20200520183411.1534621-3-kw@linux.com> (raw)
In-Reply-To: <20200520183411.1534621-1-kw@linux.com>
Remove the loop used to free CardBus resources and replace it with
a yenta_free_res() helper used to release bridge resources explicitly.
Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
---
drivers/pcmcia/yenta_socket.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 76036ccf2106..3f34b49a6f33 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -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);
}
--
2.26.2
next prev parent reply other threads:[~2020-05-20 18:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 21:49 [PATCH] PCI: Reference bridge window resources explicitly Krzysztof Wilczynski
2020-05-20 10:31 ` [PATCH v2 0/3] " Krzysztof Wilczynski
2020-05-20 10:31 ` [PATCH v2 1/3] PCI: Correct the PCI quirk for the ALI M7101 chipset Krzysztof Wilczynski
2020-05-20 17:06 ` Bjorn Helgaas
2020-05-20 18:34 ` [PATCH v3 0/2] PCI: Reference bridge window resources explicitly Krzysztof Wilczynski
2020-05-20 18:34 ` [PATCH v3 1/2] PCI: Move from using PCI_BRIDGE_RESOURCES to bridge resource definitions Krzysztof Wilczynski
2020-05-20 18:34 ` Krzysztof Wilczynski [this message]
2020-05-20 20:30 ` [PATCH v3 0/2] PCI: Reference bridge window resources explicitly Bjorn Helgaas
2020-05-21 8:16 ` Krzysztof Wilczynski
2020-05-21 8:24 ` Dominik Brodowski
2020-05-21 11:20 ` [PATCH v4 " Krzysztof Wilczynski
2020-05-21 11:20 ` [PATCH v4 1/2] PCI: Move from using PCI_BRIDGE_RESOURCES to bridge resource definitions Krzysztof Wilczynski
2020-05-21 11:20 ` [PATCH v4 2/2] pcmcia: Use resources definitions when freeing CardBus resources Krzysztof Wilczynski
2020-05-20 10:31 ` [PATCH v2 2/3] PCI: Move from using PCI_BRIDGE_RESOURCES to bridge resource definitions Krzysztof Wilczynski
2020-05-20 10:31 ` [PATCH v2 3/3] pcmcia: Use resources definitions when freeing CardBus resources Krzysztof Wilczynski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200520183411.1534621-3-kw@linux.com \
--to=kw@linux.com \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hslester96@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=tglx@linutronix.de \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).