]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/bluetooth/bt3c_cs.c
IB/uverbs: Fix lockdep warning when QP is created with 2 CQs
[linux-2.6-omap-h63xx.git] / drivers / bluetooth / bt3c_cs.c
index 7ea8fa350d26c3682333cbd6a0090cb26ed6b039..df7bb016df491bdda5296eeee2b74e60e7713704 100644 (file)
@@ -21,7 +21,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 
 #include <linux/kernel.h>
@@ -88,7 +87,7 @@ typedef struct bt3c_info_t {
 } bt3c_info_t;
 
 
-static void bt3c_config(struct pcmcia_device *link);
+static int bt3c_config(struct pcmcia_device *link);
 static void bt3c_release(struct pcmcia_device *link);
 
 static void bt3c_detach(struct pcmcia_device *p_dev);
@@ -195,7 +194,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
                register struct sk_buff *skb;
                register int len;
 
-               if (!(info->p_dev->state & DEV_PRESENT))
+               if (!pcmcia_dev_present(info->p_dev))
                        break;
 
 
@@ -583,6 +582,7 @@ static int bt3c_open(bt3c_info_t *info)
 
        hdev->type = HCI_PCCARD;
        hdev->driver_data = info;
+       SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
 
        hdev->open     = bt3c_hci_open;
        hdev->close    = bt3c_hci_close;
@@ -645,7 +645,7 @@ static int bt3c_close(bt3c_info_t *info)
        return 0;
 }
 
-static int bt3c_attach(struct pcmcia_device *link)
+static int bt3c_probe(struct pcmcia_device *link)
 {
        bt3c_info_t *info;
 
@@ -668,10 +668,7 @@ static int bt3c_attach(struct pcmcia_device *link)
        link->conf.Attributes = CONF_ENABLE_IRQ;
        link->conf.IntType = INT_MEMORY_AND_IO;
 
-       link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
-       bt3c_config(link);
-
-       return 0;
+       return bt3c_config(link);
 }
 
 
@@ -679,9 +676,7 @@ static void bt3c_detach(struct pcmcia_device *link)
 {
        bt3c_info_t *info = link->priv;
 
-       if (link->state & DEV_CONFIG)
-               bt3c_release(link);
-
+       bt3c_release(link);
        kfree(info);
 }
 
@@ -710,7 +705,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *
        return get_tuple(handle, tuple, parse);
 }
 
-static void bt3c_config(struct pcmcia_device *link)
+static int bt3c_config(struct pcmcia_device *link)
 {
        static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
        bt3c_info_t *info = link->priv;
@@ -735,9 +730,6 @@ static void bt3c_config(struct pcmcia_device *link)
        link->conf.ConfigBase = parse.config.base;
        link->conf.Present = parse.config.rmask[0];
 
-       /* Configure card */
-       link->state |= DEV_CONFIG;
-
        /* First pass: look for a config entry that looks normal. */
        tuple.TupleData = (cisdata_t *)buf;
        tuple.TupleOffset = 0;
@@ -807,15 +799,15 @@ found_port:
 
        strcpy(info->node.dev_name, info->hdev->name);
        link->dev_node = &info->node;
-       link->state &= ~DEV_CONFIG_PENDING;
 
-       return;
+       return 0;
 
 cs_failed:
        cs_error(link, last_fn, last_ret);
 
 failed:
        bt3c_release(link);
+       return -ENODEV;
 }
 
 
@@ -823,8 +815,7 @@ static void bt3c_release(struct pcmcia_device *link)
 {
        bt3c_info_t *info = link->priv;
 
-       if (link->state & DEV_PRESENT)
-               bt3c_close(info);
+       bt3c_close(info);
 
        pcmcia_disable_device(link);
 }
@@ -841,7 +832,7 @@ static struct pcmcia_driver bt3c_driver = {
        .drv            = {
                .name   = "bt3c_cs",
        },
-       .probe          = bt3c_attach,
+       .probe          = bt3c_probe,
        .remove         = bt3c_detach,
        .id_table       = bt3c_ids,
 };