vserver 1.9.5.x5
[linux-2.6.git] / drivers / bluetooth / bt3c_cs.c
index d67d038..f71e5c7 100644 (file)
 #include <linux/ptrace.h>
 #include <linux/ioport.h>
 #include <linux/spinlock.h>
+#include <linux/moduleparam.h>
 
 #include <linux/skbuff.h>
 #include <linux/string.h>
 #include <linux/serial.h>
 #include <linux/serial_reg.h>
+#include <linux/bitops.h>
 #include <asm/system.h>
-#include <asm/bitops.h>
 #include <asm/io.h>
 
 #include <linux/device.h>
 /* ======================== Module parameters ======================== */
 
 
-/* Bit map of interrupts to choose from */
-static u_int irq_mask = 0xffff;
-static int irq_list[4] = { -1 };
-
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
-
 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>, Jose Orlando Pereira <jop@di.uminho.pt>");
 MODULE_DESCRIPTION("Bluetooth driver for the 3Com Bluetooth PCMCIA card");
 MODULE_LICENSE("GPL");
@@ -95,14 +89,14 @@ typedef struct bt3c_info_t {
 } bt3c_info_t;
 
 
-void bt3c_config(dev_link_t *link);
-void bt3c_release(dev_link_t *link);
-int bt3c_event(event_t event, int priority, event_callback_args_t *args);
+static void bt3c_config(dev_link_t *link);
+static void bt3c_release(dev_link_t *link);
+static int bt3c_event(event_t event, int priority, event_callback_args_t *args);
 
 static dev_info_t dev_info = "bt3c_cs";
 
-dev_link_t *bt3c_attach(void);
-void bt3c_detach(dev_link_t *);
+static dev_link_t *bt3c_attach(void);
+static void bt3c_detach(dev_link_t *);
 
 static dev_link_t *dev_list = NULL;
 
@@ -131,28 +125,28 @@ static dev_link_t *dev_list = NULL;
 #define CONTROL  4
 
 
-inline void bt3c_address(unsigned int iobase, unsigned short addr)
+static inline void bt3c_address(unsigned int iobase, unsigned short addr)
 {
        outb(addr & 0xff, iobase + ADDR_L);
        outb((addr >> 8) & 0xff, iobase + ADDR_H);
 }
 
 
-inline void bt3c_put(unsigned int iobase, unsigned short value)
+static inline void bt3c_put(unsigned int iobase, unsigned short value)
 {
        outb(value & 0xff, iobase + DATA_L);
        outb((value >> 8) & 0xff, iobase + DATA_H);
 }
 
 
-inline void bt3c_io_write(unsigned int iobase, unsigned short addr, unsigned short value)
+static inline void bt3c_io_write(unsigned int iobase, unsigned short addr, unsigned short value)
 {
        bt3c_address(iobase, addr);
        bt3c_put(iobase, value);
 }
 
 
-inline unsigned short bt3c_get(unsigned int iobase)
+static inline unsigned short bt3c_get(unsigned int iobase)
 {
        unsigned short value = inb(iobase + DATA_L);
 
@@ -162,7 +156,7 @@ inline unsigned short bt3c_get(unsigned int iobase)
 }
 
 
-inline unsigned short bt3c_read(unsigned int iobase, unsigned short addr)
+static inline unsigned short bt3c_read(unsigned int iobase, unsigned short addr)
 {
        bt3c_address(iobase, addr);
 
@@ -489,13 +483,10 @@ static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long
 
 static struct device *bt3c_device(void)
 {
-       static char *kobj_name = "bt3c";
-
        static struct device dev = {
                .bus_id = "pcmcia",
        };
-       dev.kobj.k_name = kmalloc(strlen(kobj_name) + 1, GFP_KERNEL);
-       strcpy(dev.kobj.k_name, kobj_name);
+       kobject_set_name(&dev.kobj, "bt3c");
        kobject_init(&dev.kobj);
 
        return &dev;
@@ -586,7 +577,7 @@ error:
 }
 
 
-int bt3c_open(bt3c_info_t *info)
+static int bt3c_open(bt3c_info_t *info)
 {
        const struct firmware *firmware;
        struct hci_dev *hdev;
@@ -656,7 +647,7 @@ error:
 }
 
 
-int bt3c_close(bt3c_info_t *info)
+static int bt3c_close(bt3c_info_t *info)
 {
        struct hci_dev *hdev = info->hdev;
 
@@ -673,12 +664,12 @@ int bt3c_close(bt3c_info_t *info)
        return 0;
 }
 
-dev_link_t *bt3c_attach(void)
+static dev_link_t *bt3c_attach(void)
 {
        bt3c_info_t *info;
        client_reg_t client_reg;
        dev_link_t *link;
-       int i, ret;
+       int ret;
 
        /* Create new info device */
        info = kmalloc(sizeof(*info), GFP_KERNEL);
@@ -692,13 +683,7 @@ dev_link_t *bt3c_attach(void)
        link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
        link->io.NumPorts1 = 8;
        link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
-       link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
-
-       if (irq_list[0] == -1)
-               link->irq.IRQInfo2 = irq_mask;
-       else
-               for (i = 0; i < 4; i++)
-                       link->irq.IRQInfo2 |= 1 << irq_list[i];
+       link->irq.IRQInfo1 = IRQ_LEVEL_ID;
 
        link->irq.Handler = bt3c_interrupt;
        link->irq.Instance = info;
@@ -711,7 +696,6 @@ dev_link_t *bt3c_attach(void)
        link->next = dev_list;
        dev_list = link;
        client_reg.dev_info = &dev_info;
-       client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
        client_reg.EventMask =
            CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
            CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
@@ -731,7 +715,7 @@ dev_link_t *bt3c_attach(void)
 }
 
 
-void bt3c_detach(dev_link_t *link)
+static void bt3c_detach(dev_link_t *link)
 {
        bt3c_info_t *info = link->priv;
        dev_link_t **linkp;
@@ -785,9 +769,9 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
        return get_tuple(handle, tuple, parse);
 }
 
-void bt3c_config(dev_link_t *link)
+static void bt3c_config(dev_link_t *link)
 {
-       static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
+       static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
        client_handle_t handle = link->handle;
        bt3c_info_t *info = link->priv;
        tuple_t tuple;
@@ -898,7 +882,7 @@ failed:
 }
 
 
-void bt3c_release(dev_link_t *link)
+static void bt3c_release(dev_link_t *link)
 {
        bt3c_info_t *info = link->priv;
 
@@ -915,7 +899,7 @@ void bt3c_release(dev_link_t *link)
 }
 
 
-int bt3c_event(event_t event, int priority, event_callback_args_t *args)
+static int bt3c_event(event_t event, int priority, event_callback_args_t *args)
 {
        dev_link_t *link = args->client_data;
        bt3c_info_t *info = link->priv;
@@ -969,10 +953,7 @@ static int __init init_bt3c_cs(void)
 static void __exit exit_bt3c_cs(void)
 {
        pcmcia_unregister_driver(&bt3c_driver);
-
-       /* XXX: this really needs to move into generic code.. */
-       while (dev_list != NULL)
-               bt3c_detach(dev_list);
+       BUG_ON(dev_list != NULL);
 }
 
 module_init(init_bt3c_cs);