summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_resource.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-24 17:23:51 +0200
committerDominik Brodowski <linux@dominikbrodowski.net>2010-08-03 09:04:11 +0200
commit90abdc3b973229bae98dd96649d9f7106cc177a4 (patch)
tree5c1a7a131b65560dd73b5103118d8c7631bd76a4 /drivers/pcmcia/pcmcia_resource.c
parent9a017a910346afd88ec2e065989903bf211a7d37 (diff)
downloadop-kernel-dev-90abdc3b973229bae98dd96649d9f7106cc177a4.zip
op-kernel-dev-90abdc3b973229bae98dd96649d9f7106cc177a4.tar.gz
pcmcia: do not use io_req_t when calling pcmcia_request_io()
Instead of io_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[0,1] for up to two ioport ranges. After a call to pcmcia_request_io(), the ports found there are reserved, after calling pcmcia_request_configuration(), they may be used. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-ide@vger.kernel.org CC: linux-usb@vger.kernel.org CC: laforge@gnumonks.org CC: linux-mtd@lists.infradead.org CC: alsa-devel@alsa-project.org CC: linux-serial@vger.kernel.org CC: Michael Buesch <mb@bu3sch.de> Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/) Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r--drivers/pcmcia/pcmcia_resource.c37
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index fcd48da..a48d4a9 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -70,7 +70,8 @@ static int alloc_io_space(struct pcmcia_socket *s, struct resource *res,
res->flags |= IORESOURCE_IO;
- dev_dbg(&s->dev, "alloc_io_space request for %pR\n", res);
+ dev_dbg(&s->dev, "alloc_io_space request for %pR, %d lines\n",
+ res, lines);
align = base ? (lines ? 1<<lines : 0) : 1;
if (align && (align < num)) {
@@ -541,38 +542,25 @@ EXPORT_SYMBOL(pcmcia_request_configuration);
* pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices
*
* pcmcia_request_io() attepts to reserve the IO port ranges specified in
- * struct pcmcia_device *p_dev->resource[0] and *p_dev->resource[1]. The
+ * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The
* "start" value is the requested start of the IO port resource; "end"
- * relfects the number of ports requested.
- *
- * If io_req_t is passed, those values are converted automatically.
+ * reflects the number of ports requested. The number of IO lines requested
+ * is specified in &struct pcmcia_device @p_dev->io_lines.
*/
-int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
+int pcmcia_request_io(struct pcmcia_device *p_dev)
{
struct pcmcia_socket *s = p_dev->socket;
- config_t *c;
+ config_t *c = p_dev->function_config;
int ret = -EINVAL;
- unsigned int lines = req->IOAddrLines;
mutex_lock(&s->ops_mutex);
+ dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]);
if (!(s->state & SOCKET_PRESENT)) {
dev_dbg(&s->dev, "pcmcia_request_io: No card present\n");
goto out;
}
- c = p_dev->function_config;
- if (req) {
- c->io[0].start = req->BasePort1;
- c->io[0].end = req->NumPorts1;
- c->io[0].flags |= req->Attributes1;
- c->io[1].start = req->BasePort2;
- c->io[1].end = req->NumPorts2;
- c->io[1].flags |= req->Attributes2;
- }
-
- dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]);
-
if (c->state & CONFIG_LOCKED) {
dev_dbg(&s->dev, "Configuration is locked\n");
goto out;
@@ -582,12 +570,12 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
goto out;
}
- ret = alloc_io_space(s, &c->io[0], lines);
+ ret = alloc_io_space(s, &c->io[0], p_dev->io_lines);
if (ret)
goto out;
if (c->io[1].end) {
- ret = alloc_io_space(s, &c->io[1], lines);
+ ret = alloc_io_space(s, &c->io[1], p_dev->io_lines);
if (ret) {
release_io_space(s, &c->io[0]);
goto out;
@@ -598,11 +586,6 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
c->state |= CONFIG_IO_REQ;
p_dev->_io = 1;
- if (!ret) {
- req->BasePort1 = c->io[0].start;
- req->BasePort2 = c->io[1].start;
- }
-
dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR",
&c->io[0], &c->io[1]);
out:
OpenPOWER on IntegriCloud