linux/drivers/bluetooth/dtl1_cs.c
<<
/opt.14/spaue= .14/forme= .14a /opt.1 href="../linux+v3.8.2/drivers/b tooth/dtl1_cs.c">/opt.14img src="../.static/gfx/right.png" alt=">>">/o4/spaue=/o4spau class="lxr_search">/opt/opt.14input typ v3hidden" nam v3navtarget" > v3">/opt.14input typ v3text" nam v3search" idv3search">/opt.14butt typ v3submit">Search/opt.1Prefs= .14/a>/o4/spaue=pt.1 14/dive=pt.1 14form acvalu="ajax+*" method="post" onsubmit="return false;">/o4input typ v3hidden" nam v3ajax_lookup" idv3ajax_lookup" > v3">/pt.1 14/forme=/pt.1 14div class="headingbott m">= 4div idv3file_contents"e
1 114/a>4spau class="comment">/*4/spaue=1 124/a>4spau class="comment"> *4/spaue=1 134/a>4spau class="comment"> *  A driver for Nokia Connectivity Card DTL-1 devices4/spaue=1 144/a>4spau class="comment"> *4/spaue=1 154/a>4spau class="comment"> *  Copyright (C) 2001-2002  Marcel Holtmann <marcel@holtmann.org>4/spaue=1 164/a>4spau class="comment"> *4/spaue=1 174/a>4spau class="comment"> *4/spaue=1 184/a>4spau class="comment"> *  This program is free software; you cau redistribute it and/or modify4/spaue=1 194/a>4spau class="comment"> *  it under the terms of the GNU General Public License vers"
	 2 as4/spaue=1 4spau class="comment"> *  published by the Free Software Foundavalu;4/spaue=1 114/a>4spau class="comment"> *4/spaue=1 124/a>4spau class="comment"> *  Software distributed under the License is distributed 
	 au "AS4/spaue=1 134/a>4spau class="comment"> *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or4/spaue=1 144/a>4spau class="comment"> *  implied. See the License for the specific language governing4/spaue=1 154/a>4spau class="comment"> *  rights and limitavalus under the License.4/spaue=1 164/a>4spau class="comment"> *4/spaue=1 174/a>4spau class="comment"> *  The initial developer of the original code is David A. Hinds4/spaue=1 184/a>4spau class="comment"> *  <dahinds@users.sourceforge.net>..1Porvalus created by David A. Hinds4/spaue=1 194/a>4spau class="comment"> *  are Copyright (C) 1999 David A. Hinds..1All Rights Reserved.4/spaue=1 2opta>4spau class="comment"> *4/spaue=1 214/a>4spau class="comment"> */4/spaue=1 224/a>=1 234/a>#include <linux/module.h4/a>>=1 244/a>=1 254/a>#include <linux/kernel.h4/a>>=1 264/a>#include <linux/init.h4/a>>=1 274/a>#include <linux/slab.h4/a>>=1 284/a>#include <linux/typ s.h4/a>>=1 294/a>#include <linux/delay.h4/a>>=1 304/a>#include <linux/errno.h4/a>>=1 314/a>#include <linux/ptrace.h4/a>>=1 324/a>#include <linux/ioporv.h4/a>>=1 334/a>#include <linux/spinlock.h4/a>>=1 344/a>#include <linux/moduleparam.h4/a>>=1 354/a>=1 364/a>#include <linux/skbuff.h4/a>>=1 374/a>#include <linux/string.h4/a>>=1 384/a>#include <linux/serial.h4/a>>=1 394/a>#include <linux/serial_reg.h4/a>>=1 404/a>#include <linux/bitops.h4/a>>=1 414/a>#include <asm/io.h4/a>>=1 424/a>=1 434/a>#include <pcmcia/cistpl.h4/a>>=1 444/a>#include <pcmcia/ciscode.h4/a>>=1 454/a>#include <pcmcia/ds.h4/a>>=1 464/a>#include <pcmcia/cisreg.h4/a>>=1 474/a>=1 484/a>#include <net/b
  tooth/b
  tooth.h4/a>>=1 494/a>#include <net/b
  tooth/hci_core.h4/a>>=1 504/a>=1 514/a>=1 524/a>=1 534/a>4spau class="comment">/* ======================== Module parameters ======================== */4/spaue=1 544/a>=1 554/a>=1 564/a>4a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR4/a>(4spau class="string">"Marcel Holtmann <marcel@holtmann.org>"4/spaue);=1 574/a>4a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION4/a>(4spau class="string">"B
  tooth driver for Nokia Connectivity Card DTL-1"4/spaue);=1 584/a>4a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE4/a>(4spau class="string">"GPL"4/spaue);=1 594/a>=1 604/a>=1 614/a>=1 624/a>4spau class="comment">/* ======================== Local structures ======================== */4/spaue=1 634/a>=1 644/a>=1 654/a>typ def struct 4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> {=1 664/a>        struct 4a href="+code=pcmcia_device" class="sref">pcmcia_device4/a> *4a href="+code=p_dev" class="sref">p_dev4/a>;=1 674/a>=1 684/a>        struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *4a href="+code=hdev" class="sref">hdev4/a>;=1 694/a>=1 704/a>        4a href="+code=spinlock_t" class="sref">spinlock_t4/a> 4a href="+code=lock" class="sref">lock4/a>;                4spau class="comment">/* For serializing operavalus */4/spaue=1 714/a>=1 724/a>        unsigned long 4a href="+code=flowmask" class="sref">flowmask4/a>;         4spau class="comment">/* HCI flow mask */4/spaue=1 734/a>        int 4a href="+code=ri_latch" class="sref">ri_latch4/a>;=1 744/a>=1 754/a>        struct 4a href="+code=sk_buff_head" class="sref">sk_buff_head4/a> 4a href="+code=txq" class="sref">txq4/a>;=1 764/a>        unsigned long 4a href="+code=tx_state" class="sref">tx_state4/a>;=1 774/a>=1 784/a>        unsigned long 4a href="+code=rx_state" class="sref">rx_state4/a>;=1 794/a>        unsigned long 4a href="+code=rx_count" class="sref">rx_count4/a>;=1 804/a>        struct 4a href="+code=sk_buff" class="sref">sk_buff4/a> *4a href="+code=rx_skb" class="sref">rx_skb4/a>;=1 814/a>} 4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a>;=1 824/a>=1 834/a>=1 844/a>static int 4a href="+code=dtl1_config" class="sref">dtl1_config4/a>(struct 4a href="+code=pcmcia_device" class="sref">pcmcia_device4/a> *4a href="+code=link" class="sref">link4/a>);=1 854/a>=1 864/a>=1 874/a>4spau class="comment">/* Transmit states  */4/spaue=1 884/a>#define 4a href="+code=XMIT_SENDING" class="sref">XMIT_SENDING4/a>  1=1 894/a>#define 4a href="+code=XMIT_WAKEUP" class="sref">XMIT_WAKEUP4/a>   2=1 904/a>#define 4a href="+code=XMIT_WAITING" class="sref">XMIT_WAITING4/a>  8=1 914/a>=1 924/a>4spau class="comment">/* Receiver States */4/spaue=1 934/a>#define 4a href="+code=RECV_WAIT_NSH" class="sref">RECV_WAIT_NSH4/a>   0=1 944/a>#define 4a href="+code=RECV_WAIT_DATA" class="sref">RECV_WAIT_DATA4/a>  1=1 954/a>=1 964/a>=1 974/a>typ def struct {=1 984/a>        4a href="+code=u8" class="sref">u84/a> 4a href="+code=typ " class="sref">typ 4/a>;=1 994/a>        4a href="+code=u8" class="sref">u84/a> 4a href="+code=zero" class="sref">zero4/a>;=11004/a>        4a href="+code=u16" class="sref">u164/a> 4a href="+code=len" class="sref">len4/a>;=11014/a>} 4a href="+code=__packed" class="sref">__packed4/a> 4a href="+code=nsh_t" class="sref">nsh_t4/a>;       4spau class="comment">/* Nokia Specific Header */4/spaue=11024/a>=11034/a>#define 4a href="+code=NSHL" class="sref">NSHL4/a>  4                         4spau class="comment">/* Nokia Specific Header Length */4/spaue=11044/a>=11054/a>=11064/a>=11074/a>4spau class="comment">/* ======================== Interrupt handling ======================== */4/spaue=11084/a>=11094/a>=11static int 4a href="+code=dtl1_write" class="sref">dtl1_write4/a>(unsigned int 4a href="+code=iobase" class="sref">iobase4/a>, int 4a href="+code=fifo_size" class="sref">fifo_size4/a>, 4a href="+code=__u8" class="sref">__u84/a> *4a href="+code=buf" class="sref">buf4/a>, int 4a href="+code=len" class="sref">len4/a>)=11114/a>{=11124/a>        int 4a href="+code=actual" class="sref">actual4/a> = 0;=11134/a>=11144/a>        4spau class="comment">/* Tx FIFO should be empty */4/spaue=11154/a>        if (!(4a href="+code=inb" class="sref">inb4/a>(4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_LSR" class="sref">UART_LSR4/a>) & 4a href="+code=UART_LSR_THRE" class="sref">UART_LSR_THRE4/a>))=11164/a>                return 0;=11174/a>=11184/a>        4spau class="comment">/* Fill FIFO with current frame */4/spaue=11194/a>        while ((4a href="+code=fifo_size" class="sref">fifo_size4/a>-- > 0) && (4a href="+code=actual" class="sref">actual4/a> < 4a href="+code=len" class="sref">len4/a>)) {=11204/a>                4spau class="comment">/* Transmit next byte */4/spaue=11214/a>                4a href="+code=outb" class="sref">outb4/a>(4a href="+code=buf" class="sref">buf4/a>[4a href="+code=actual" class="sref">actual4/a>], 4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_TX" class="sref">UART_TX4/a>);=11224/a>                4a href="+code=actual" class="sref">actual4/a>++;=11234/a>        }=11244/a>=11254/a>        return 4a href="+code=actual" class="sref">actual4/a>;=11264/a>}=11274/a>=11284/a>=11294/a>static void 4a href="+code=dtl1_write_wakeup" class="sref">dtl1_write_wakeup4/a>(4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a>)=11304/a>{=11314/a>        if (!4a href="+code=info" class="sref">info4/a>) {=11324/a>                4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"Unknown device"4/spaue);=11334/a>                return;=11344/a>        }=11354/a>=11364/a>        if (4a href="+code=test_bit" class="sref">test_bit4/a>(4a href="+code=XMIT_WAITING" class="sref">XMIT_WAITING4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>))) {=11374/a>                4a href="+code=set_bit" class="sref">set_bit4/a>(4a href="+code=XMIT_WAKEUP" class="sref">XMIT_WAKEUP4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>));=11384/a>                return;=11394/a>        }=11404/a>=11414/a>        if (4a href="+code=test_and_set_bit" class="sref">test_and_set_bit4/a>(4a href="+code=XMIT_SENDING" class="sref">XMIT_SENDING4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>))) {=11424/a>                4a href="+code=set_bit" class="sref">set_bit4/a>(4a href="+code=XMIT_WAKEUP" class="sref">XMIT_WAKEUP4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>));=11434/a>                return;=11444/a>        }=11454/a>=11464/a>        do {=11474/a>                unsigned int 4a href="+code=iobase" class="sref">iobase4/a> = 4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=start" class="sref">start4/a>;=11484/a>                register struct 4a href="+code=sk_buff" class="sref">sk_buff4/a> *4a href="+code=skb" class="sref">skb4/a>;=11494/a>                int 4a href="+code=len" class="sref">len4/a>;=11504/a>=11514/a>                4a href="+code=clear_bit" class="sref">clear_bit4/a>(4a href="+code=XMIT_WAKEUP" class="sref">XMIT_WAKEUP4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>));=11524/a>=11534/a>                if (!4a href="+code=pcmcia_dev_present" class="sref">pcmcia_dev_present4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a>))=11544/a>                        return;=11554/a>=11564/a>                if (!(4a href="+code=skb" class="sref">skb4/a> = 4a href="+code=skb_dequeue" class="sref">skb_dequeue4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=txq" class="sref">txq4/a>))))=11574/a>                        break;=11584/a>=11594/a>                4spau class="comment">/* Send frame */4/spaue=11604/a>                4a href="+code=len" class="sref">len4/a> = 4a href="+code=dtl1_write" class="sref">dtl1_write4/a>(4a href="+code=iobase" class="sref">iobase4/a>, 32, 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=data" class="sref">data4/a>, 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=len" class="sref">len4/a>);=11614/a>=11624/a>                if (4a href="+code=len" class="sref">len4/a> == 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=len" class="sref">len4/a>) {=11634/a>                        4a href="+code=set_bit" class="sref">set_bit4/a>(4a href="+code=XMIT_WAITING" class="sref">XMIT_WAITING4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>));=11644/a>                        4a href="+code=kfree_skb" class="sref">kfree_skb4/a>(4a href="+code=skb" class="sref">skb4/a>);=11654/a>                } else {=11664/a>                        4a href="+code=skb_pull" class="sref">skb_pull4/a>(4a href="+code=skb" class="sref">skb4/a>, 4a href="+code=len" class="sref">len4/a>);=11674/a>                        4a href="+code=skb_queue_head" class="sref">skb_queue_head4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=txq" class="sref">txq4/a>), 4a href="+code=skb" class="sref">skb4/a>);=11684/a>                }=11694/a>=11704/a>                4a href="+code=info" class="sref">info4/a>->4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=stat" class="sref">stat4/a>.4a href="+code=byte_tx" class="sref">byte_tx4/a> += 4a href="+code=len" class="sref">len4/a>;=11714/a>=11724/a>        } while (4a href="+code=test_bit" class="sref">test_bit4/a>(4a href="+code=XMIT_WAKEUP" class="sref">XMIT_WAKEUP4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>)));=11734/a>=11744/a>        4a href="+code=clear_bit" class="sref">clear_bit4/a>(4a href="+code=XMIT_SENDING" class="sref">XMIT_SENDING4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>));=11754/a>}=11764/a>=11774/a>=11784/a>static void 4a href="+code=dtl1_control" class="sref">dtl1_control4/a>(4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a>, struct 4a href="+code=sk_buff" class="sref">sk_buff4/a> *4a href="+code=skb" class="sref">skb4/a>)=11794/a>{=11804/a>        4a href="+code=u8" class="sref">u84/a> 4a href="+code=flowmask" class="sref">flowmask4/a> = *(4a href="+code=u8" class="sref">u84/a> *)4a href="+code=skb" class="sref">skb4/a>->4a href="+code=data" class="sref">data4/a>;=11814/a>        int 4a href="+code=i" class="sref">i4/a>;=11824/a>=11834/a>        4a href="+code=printk" class="sref">printk4/a>(4a href="+code=KERN_INFO" class="sref">KERN_INFO4/a> 4spau class="string">"B
  tooth: Nokia control data ="4/spaue);=11844/a>        for (4a href="+code=i" class="sref">i4/a> = 0; 4a href="+code=i" class="sref">i4/a> < 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=len" class="sref">len4/a>; 4a href="+code=i" class="sref">i4/a>++) {=11854/a>                4a href="+code=printk" class="sref">printk4/a>(4spau class="string">" %02x"4/spaue, 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=data" class="sref">data4/a>[4a href="+code=i" class="sref">i4/a>]);=11864/a>        }=11874/a>        4a href="+code=printk" class="sref">printk4/a>(4spau class="string">"\n"4/spaue);=11884/a>=11894/a>        4spau class="comment">/* transivalu to acvave state */4/spaue=11904/a>        if (((4a href="+code=info" class="sref">info4/a>->4a href="+code=flowmask" class="sref">flowmask4/a> & 0x07) == 0) && ((4a href="+code=flowmask" class="sref">flowmask4/a> & 0x07) != 0)) {=11914/a>                4a href="+code=clear_bit" class="sref">clear_bit4/a>(4a href="+code=XMIT_WAITING" class="sref">XMIT_WAITING4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>));=11924/a>                4a href="+code=dtl1_write_wakeup" class="sref">dtl1_write_wakeup4/a>(4a href="+code=info" class="sref">info4/a>);=11934/a>        }=11944/a>=11954/a>        4a href="+code=info" class="sref">info4/a>->4a href="+code=flowmask" class="sref">flowmask4/a> = 4a href="+code=flowmask" class="sref">flowmask4/a>;=11964/a>=11974/a>        4a href="+code=kfree_skb" class="sref">kfree_skb4/a>(4a href="+code=skb" class="sref">skb4/a>);=11984/a>}=11994/a>=12004/a>=12014/a>static void 4a href="+code=dtl1_receive" class="sref">dtl1_receive4/a>(4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a>)=12024/a>{=12034/a>        unsigned int 4a href="+code=iobase" class="sref">iobase4/a>;=12044/a>        4a href="+code=nsh_t" class="sref">nsh_t4/a> *4a href="+code=nsh" class="sref">nsh4/a>;=12054/a>        int 4a href="+code=boguscount" class="sref">boguscount4/a> = 0;=12064/a>=12074/a>        if (!4a href="+code=info" class="sref">info4/a>) {=12084/a>                4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"Unknown device"4/spaue);=12094/a>                return;=12104/a>        }=12114/a>=12124/a>        4a href="+code=iobase" class="sref">iobase4/a> = 4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=start" class="sref">start4/a>;=12134/a>=12144/a>        do {=12154/a>                4a href="+code=info" class="sref">info4/a>->4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=stat" class="sref">stat4/a>.4a href="+code=byte_rx" class="sref">byte_rx4/a>++;=12164/a>=12174/a>                4spau class="comment">/* Allocate packet */4/spaue=12184/a>                if (4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a> == 4a href="+code=NULL" class="sref">NULL4/a>)=12194/a>                        if (!(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a> = 4a href="+code=bt_skb_alloc" class="sref">bt_skb_alloc4/a>(4a href="+code=HCI_MAX_FRAME_SIZE" class="sref">HCI_MAX_FRAME_SIZE4/a>, 4a href="+code=GFP_ATOMIC" class="sref">GFP_ATOMIC4/a>))) {=12204/a>                                4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"Can't allocate mem for new packet"4/spaue);=12214/a>                                4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_state" class="sref">rx_state4/a> = 4a href="+code=RECV_WAIT_NSH" class="sref">RECV_WAIT_NSH4/a>;=12224/a>                                4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_count" class="sref">rx_count4/a> = 4a href="+code=NSHL" class="sref">NSHL4/a>;=12234/a>                                return;=12244/a>                        }=12254/a>=12264/a>                *4a href="+code=skb_put" class="sref">skb_put4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>, 1) = 4a href="+code=inb" class="sref">inb4/a>(4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_RX" class="sref">UART_RX4/a>);=12274/a>                4a href="+code=nsh" class="sref">nsh4/a> = (4a href="+code=nsh_t" class="sref">nsh_t4/a> *)4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>->4a href="+code=data" class="sref">data4/a>;=12284/a>=12294/a>                4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_count" class="sref">rx_count4/a>--;=12304/a>=12314/a>                if (4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_count" class="sref">rx_count4/a> == 0) {=12324/a>=12334/a>                        switch (4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_state" class="sref">rx_state4/a>) {=12344/a>                        case 4a href="+code=RECV_WAIT_NSH" class="sref">RECV_WAIT_NSH4/a>:=12354/a>                                4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_state" class="sref">rx_state4/a> = 4a href="+code=RECV_WAIT_DATA" class="sref">RECV_WAIT_DATA4/a>;=12364/a>                                4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_count" class="sref">rx_count4/a> = 4a href="+code=nsh" class="sref">nsh4/a>->4a href="+code=len" class="sref">len4/a> + (4a href="+code=nsh" class="sref">nsh4/a>->4a href="+code=len" class="sref">len4/a> & 0x0001);=12374/a>                                break;=12384/a>                        case 4a href="+code=RECV_WAIT_DATA" class="sref">RECV_WAIT_DATA4/a>:=12394/a>                                4a href="+code=bt_cb" class="sref">bt_cb4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>)->4a href="+code=pkt_typ " class="sref">pkt_typ 4/a> = 4a href="+code=nsh" class="sref">nsh4/a>->4a href="+code=typ " class="sref">typ 4/a>;=12404/a>=12414/a>                                4spau class="comment">/* remove PAD byte if it exists */4/spaue=12424/a>                                if (4a href="+code=nsh" class="sref">nsh4/a>->4a href="+code=len" class="sref">len4/a> & 0x0001) {=12434/a>                                        4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>->4a href="+code=tail" class="sref">tail4/a>--;=12444/a>                                        4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>->4a href="+code=len" class="sref">len4/a>--;=12454/a>                                }=12464/a>=12474/a>                                4spau class="comment">/* remove NSH */4/spaue=12484/a>                                4a href="+code=skb_pull" class="sref">skb_pull4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>, 4a href="+code=NSHL" class="sref">NSHL4/a>);=12494/a>=12504/a>                                switch (4a href="+code=bt_cb" class="sref">bt_cb4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>)->4a href="+code=pkt_typ " class="sref">pkt_typ 4/a>) {=12514/a>                                case 0x80:=12524/a>                                        4spau class="comment">/* control data for the Nokia Card */4/spaue=12534/a>                                        4a href="+code=dtl1_control" class="sref">dtl1_control4/a>(4a href="+code=info" class="sref">info4/a>, 4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>);=12544/a>                                        break;=12554/a>                                case 0x82:=12564/a>                                case 0x83:=12574/a>                                case 0x84:=12584/a>                                        4spau class="comment">/* send frame to the HCI layer */4/spaue=12594/a>                                        4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>->4a href="+code=dev" class="sref">dev4/a> = (void *) 4a href="+code=info" class="sref">info4/a>->4a href="+code=hdev" class="sref">hdev4/a>;=12604/a>                                        4a href="+code=bt_cb" class="sref">bt_cb4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>)->4a href="+code=pkt_typ " class="sref">pkt_typ 4/a> &= 0x0f;=12614/a>                                        4a href="+code=hci_recv_frame" class="sref">hci_recv_frame4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>);=12624/a>                                        break;=12634/a>                                default:=12644/a>                                        4spau class="comment">/* unknown packet */4/spaue=12654/a>                                        4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"Unknown HCI packet with typ  0x%02x received"4/spaue, 4a href="+code=bt_cb" class="sref">bt_cb4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>)->4a href="+code=pkt_typ " class="sref">pkt_typ 4/a>);=12664/a>                                        4a href="+code=kfree_skb" class="sref">kfree_skb4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a>);=12674/a>                                        break;=12684/a>                                }=12694/a>=12704/a>                                4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_state" class="sref">rx_state4/a> = 4a href="+code=RECV_WAIT_NSH" class="sref">RECV_WAIT_NSH4/a>;=12714/a>                                4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_count" class="sref">rx_count4/a> = 4a href="+code=NSHL" class="sref">NSHL4/a>;=12724/a>                                4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a> = 4a href="+code=NULL" class="sref">NULL4/a>;=12734/a>                                break;=12744/a>                        }=12754/a>=12764/a>                }=12774/a>=12784/a>                4spau class="comment">/* Make sure we don't stay here too long */4/spaue=12794/a>                if (4a href="+code=boguscount" class="sref">boguscount4/a>++ > 32)=12804/a>                        break;=12814/a>=12824/a>        } while (4a href="+code=inb" class="sref">inb4/a>(4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_LSR" class="sref">UART_LSR4/a>) & 4a href="+code=UART_LSR_DR" class="sref">UART_LSR_DR4/a>);=12834/a>}=12844/a>=12854/a>=12864/a>static 4a href="+code=irqreturn_t" class="sref">irqreturn_t4/a> 4a href="+code=dtl1_interrupt" class="sref">dtl1_interrupt4/a>(int 4a href="+code=irq" class="sref">irq4/a>, void *4a href="+code=dev_inst" class="sref">dev_inst4/a>)=12874/a>{=12884/a>        4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a> = 4a href="+code=dev_inst" class="sref">dev_inst4/a>;=12894/a>        unsigned int 4a href="+code=iobase" class="sref">iobase4/a>;=12904/a>        unsigned char 4a href="+code=msr" class="sref">msr4/a>;=12914/a>        int 4a href="+code=boguscount" class="sref">boguscount4/a> = 0;=12924/a>        int 4a href="+code=iir" class="sref">iir4/a>, 4a href="+code=lsr" class="sref">lsr4/a>;=12934/a>        4a href="+code=irqreturn_t" class="sref">irqreturn_t4/a> 4a href="+code=r" class="sref">r4/a> = 4a href="+code=IRQ_NONE" class="sref">IRQ_NONE4/a>;=12944/a>=12954/a>        if (!4a href="+code=info" class="sref">info4/a> || !4a href="+code=info" class="sref">info4/a>->4a href="+code=hdev" class="sref">hdev4/a>)=12964/a>                4spau class="comment">/* our irq handler is shared */4/spaue=12974/a>                return 4a href="+code=IRQ_NONE" class="sref">IRQ_NONE4/a>;=12984/a>=12994/a>        4a href="+code=iobase" class="sref">iobase4/a> = 4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=start" class="sref">start4/a>;=13004/a>=13014/a>        4a href="+code=spin_lock" class="sref">spin_lock4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=lock" class="sref">lock4/a>));=13024/a>=13034/a>        4a href="+code=iir" class="sref">iir4/a> = 4a href="+code=inb" class="sref">inb4/a>(4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_IIR" class="sref">UART_IIR4/a>) & 4a href="+code=UART_IIR_ID" class="sref">UART_IIR_ID4/a>;=13044/a>        while (4a href="+code=iir" class="sref">iir4/a>) {=13054/a>=13064/a>                4a href="+code=r" class="sref">r4/a> = 4a href="+code=IRQ_HANDLED" class="sref">IRQ_HANDLED4/a>;=13074/a>                4spau class="comment">/* Clear interrupt */4/spaue=13084/a>                4a href="+code=lsr" class="sref">lsr4/a> = 4a href="+code=inb" class="sref">inb4/a>(4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_LSR" class="sref">UART_LSR4/a>);=13094/a>=13104/a>                switch (4a href="+code=iir" class="sref">iir4/a>) {=13114/a>                case 4a href="+code=UART_IIR_RLSI" class="sref">UART_IIR_RLSI4/a>:=13124/a>                        4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"RLSI"4/spaue);=13134/a>                        break;=13144/a>                case 4a href="+code=UART_IIR_RDI" class="sref">UART_IIR_RDI4/a>:=13154/a>                        4spau class="comment">/* Receive interrupt */4/spaue=13164/a>                        4a href="+code=dtl1_receive" class="sref">dtl1_receive4/a>(4a href="+code=info" class="sref">info4/a>);=13174/a>                        break;=13184/a>                case 4a href="+code=UART_IIR_THRI" class="sref">UART_IIR_THRI4/a>:=13194/a>                        if (4a href="+code=lsr" class="sref">lsr4/a> & 4a href="+code=UART_LSR_THRE" class="sref">UART_LSR_THRE4/a>) {=13204/a>                                4spau class="comment">/* Transmitter ready for data */4/spaue=13214/a>                                4a href="+code=dtl1_write_wakeup" class="sref">dtl1_write_wakeup4/a>(4a href="+code=info" class="sref">info4/a>);=13224/a>                        }=13234/a>                        break;=13244/a>                default:=13254/a>                        4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"Unhandled IIR=%#x"4/spaue, 4a href="+code=iir" class="sref">iir4/a>);=13264/a>                        break;=13274/a>                }=13284/a>=13294/a>                4spau class="comment">/* Make sure we don't stay here too long */4/spaue=13304/a>                if (4a href="+code=boguscount" class="sref">boguscount4/a>++ > 100)=13314/a>                        break;=13324/a>=13334/a>                4a href="+code=iir" class="sref">iir4/a> = 4a href="+code=inb" class="sref">inb4/a>(4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_IIR" class="sref">UART_IIR4/a>) & 4a href="+code=UART_IIR_ID" class="sref">UART_IIR_ID4/a>;=13344/a>=13354/a>        }=13364/a>=13374/a>        4a href="+code=msr" class="sref">msr4/a> = 4a href="+code=inb" class="sref">inb4/a>(4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_MSR" class="sref">UART_MSR4/a>);=13384/a>=13394/a>        if (4a href="+code=info" class="sref">info4/a>->4a href="+code=ri_latch" class="sref">ri_latch4/a> ^ (4a href="+code=msr" class="sref">msr4/a> & 4a href="+code=UART_MSR_RI" class="sref">UART_MSR_RI4/a>)) {=13404/a>                4a href="+code=info" class="sref">info4/a>->4a href="+code=ri_latch" class="sref">ri_latch4/a> = 4a href="+code=msr" class="sref">msr4/a> & 4a href="+code=UART_MSR_RI" class="sref">UART_MSR_RI4/a>;=13414/a>                4a href="+code=clear_bit" class="sref">clear_bit4/a>(4a href="+code=XMIT_WAITING" class="sref">XMIT_WAITING4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>));=13424/a>                4a href="+code=dtl1_write_wakeup" class="sref">dtl1_write_wakeup4/a>(4a href="+code=info" class="sref">info4/a>);=13434/a>                4a href="+code=r" class="sref">r4/a> = 4a href="+code=IRQ_HANDLED" class="sref">IRQ_HANDLED4/a>;=13444/a>        }=13454/a>=13464/a>        4a href="+code=spin_unlock" class="sref">spin_unlock4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=lock" class="sref">lock4/a>));=13474/a>=13484/a>        return 4a href="+code=r" class="sref">r4/a>;=13494/a>}=13504/a>=13514/a>=13524/a>=13534/a>4spau class="comment">/* ======================== HCI interface ======================== */4/spaue=13544/a>=13554/a>=13564/a>static int 4a href="+code=dtl1_hci_open" class="sref">dtl1_hci_open4/a>(struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *4a href="+code=hdev" class="sref">hdev4/a>)=13574/a>{=13584/a>        4a href="+code=set_bit" class="sref">set_bit4/a>(4a href="+code=HCI_RUNNING" class="sref">HCI_RUNNING4/a>, &(4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=flags" class="sref">flags4/a>));=13594/a>=13604/a>        return 0;=13614/a>}=13624/a>=13634/a>=13644/a>static int 4a href="+code=dtl1_hci_flush" class="sref">dtl1_hci_flush4/a>(struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *4a href="+code=hdev" class="sref">hdev4/a>)=13654/a>{=13664/a>        4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a> = 4a href="+code=hci_get_drvdata" class="sref">hci_get_drvdata4/a>(4a href="+code=hdev" class="sref">hdev4/a>);=13674/a>=13684/a>        4spau class="comment">/* Drop TX queue */4/spaue=13694/a>        4a href="+code=skb_queue_purge" class="sref">skb_queue_purge4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=txq" class="sref">txq4/a>));=13704/a>=13714/a>        return 0;=13724/a>}=13734/a>=13744/a>=13754/a>static int 4a href="+code=dtl1_hci_close" class="sref">dtl1_hci_close4/a>(struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *4a href="+code=hdev" class="sref">hdev4/a>)=13764/a>{=13774/a>        if (!4a href="+code=test_and_clear_bit" class="sref">test_and_clear_bit4/a>(4a href="+code=HCI_RUNNING" class="sref">HCI_RUNNING4/a>, &(4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=flags" class="sref">flags4/a>)))=13784/a>                return 0;=13794/a>=13804/a>        4a href="+code=dtl1_hci_flush" class="sref">dtl1_hci_flush4/a>(4a href="+code=hdev" class="sref">hdev4/a>);=13814/a>=13824/a>        return 0;=13834/a>}=13844/a>=13854/a>=13864/a>static int 4a href="+code=dtl1_hci_send_frame" class="sref">dtl1_hci_send_frame4/a>(struct 4a href="+code=sk_buff" class="sref">sk_buff4/a> *4a href="+code=skb" class="sref">skb4/a>)=13874/a>{=13884/a>        4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a>;=13894/a>        struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *4a href="+code=hdev" class="sref">hdev4/a> = (struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *)(4a href="+code=skb" class="sref">skb4/a>->4a href="+code=dev" class="sref">dev4/a>);=13904/a>        struct 4a href="+code=sk_buff" class="sref">sk_buff4/a> *4a href="+code=s" class="sref">s4/a>;=13914/a>        4a href="+code=nsh_t" class="sref">nsh_t4/a> 4a href="+code=nsh" class="sref">nsh4/a>;=13924/a>=13934/a>        if (!4a href="+code=hdev" class="sref">hdev4/a>) {=13944/a>                4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"Frame for unknown HCI device (hdev=NULL)"4/spaue);=13954/a>                return -4a href="+code=ENODEV" class="sref">ENODEV4/a>;=13964/a>        }=13974/a>=13984/a>        4a href="+code=info" class="sref">info4/a> = 4a href="+code=hci_get_drvdata" class="sref">hci_get_drvdata4/a>(4a href="+code=hdev" class="sref">hdev4/a>);=13994/a>=14004/a>        switch (4a href="+code=bt_cb" class="sref">bt_cb4/a>(4a href="+code=skb" class="sref">skb4/a>)->4a href="+code=pkt_typ " class="sref">pkt_typ 4/a>) {=14014/a>        case 4a href="+code=HCI_COMMAND_PKT" class="sref">HCI_COMMAND_PKT4/a>:=14024/a>                4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=stat" class="sref">stat4/a>.4a href="+code=cmd_tx" class="sref">cmd_tx4/a>++;=14034/a>                4a href="+code=nsh" class="sref">nsh4/a>.4a href="+code=typ " class="sref">typ 4/a> = 0x81;=14044/a>                break;=14054/a>        case 4a href="+code=HCI_ACLDATA_PKT" class="sref">HCI_ACLDATA_PKT4/a>:=14064/a>                4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=stat" class="sref">stat4/a>.4a href="+code=acl_tx" class="sref">acl_tx4/a>++;=14074/a>                4a href="+code=nsh" class="sref">nsh4/a>.4a href="+code=typ " class="sref">typ 4/a> = 0x82;=14084/a>                break;=14094/a>        case 4a href="+code=HCI_SCODATA_PKT" class="sref">HCI_SCODATA_PKT4/a>:=14104/a>                4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=stat" class="sref">stat4/a>.4a href="+code=sco_tx" class="sref">sco_tx4/a>++;=14114/a>                4a href="+code=nsh" class="sref">nsh4/a>.4a href="+code=typ " class="sref">typ 4/a> = 0x83;=14124/a>                break;=14134/a>        default:=14144/a>                return -4a href="+code=EILSEQ" class="sref">EILSEQ4/a>;=14154/a>        };=14164/a>=14174/a>        4a href="+code=nsh" class="sref">nsh4/a>.4a href="+code=zero" class="sref">zero4/a> = 0;=14184/a>        4a href="+code=nsh" class="sref">nsh4/a>.4a href="+code=len" class="sref">len4/a> = 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=len" class="sref">len4/a>;=14194/a>=14204/a>        4a href="+code=s" class="sref">s4/a> = 4a href="+code=bt_skb_alloc" class="sref">bt_skb_alloc4/a>(4a href="+code=NSHL" class="sref">NSHL4/a> + 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=len" class="sref">len4/a> + 1, 4a href="+code=GFP_ATOMIC" class="sref">GFP_ATOMIC4/a>);=14214/a>        if (!4a href="+code=s" class="sref">s4/a>)=14224/a>                return -4a href="+code=ENOMEM" class="sref">ENOMEM4/a>;=14234/a>=14244/a>        4a href="+code=skb_reserve" class="sref">skb_reserve4/a>(4a href="+code=s" class="sref">s4/a>, 4a href="+code=NSHL" class="sref">NSHL4/a>);=14254/a>        4a href="+code=skb_copy_from_linear_data" class="sref">skb_copy_from_linear_data4/a>(4a href="+code=skb" class="sref">skb4/a>, 4a href="+code=skb_put" class="sref">skb_put4/a>(4a href="+code=s" class="sref">s4/a>, 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=len" class="sref">len4/a>), 4a href="+code=skb" class="sref">skb4/a>->4a href="+code=len" class="sref">len4/a>);=14264/a>        if (4a href="+code=skb" class="sref">skb4/a>->4a href="+code=len" class="sref">len4/a> & 0x0001)=14274/a>                *4a href="+code=skb_put" class="sref">skb_put4/a>(4a href="+code=s" class="sref">s4/a>, 1) = 0;     4spau class="comment">/* PAD */4/spaue=14284/a>=14294/a>        4spau class="comment">/* Prepend skb with Nokia frame header and queue */4/spaue=14304/a>        4a href="+code=memcpy" class="sref">memcpy4/a>(4a href="+code=skb_push" class="sref">skb_push4/a>(4a href="+code=s" class="sref">s4/a>, 4a href="+code=NSHL" class="sref">NSHL4/a>), &4a href="+code=nsh" class="sref">nsh4/a>, 4a href="+code=NSHL" class="sref">NSHL4/a>);=14314/a>        4a href="+code=skb_queue_tail" class="sref">skb_queue_tail4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=txq" class="sref">txq4/a>), 4a href="+code=s" class="sref">s4/a>);=14324/a>=14334/a>        4a href="+code=dtl1_write_wakeup" class="sref">dtl1_write_wakeup4/a>(4a href="+code=info" class="sref">info4/a>);=14344/a>=14354/a>        4a href="+code=kfree_skb" class="sref">kfree_skb4/a>(4a href="+code=skb" class="sref">skb4/a>);=14364/a>=14374/a>        return 0;=14384/a>}=14394/a>=14404/a>=14414/a>static int 4a href="+code=dtl1_hci_ioctl" class="sref">dtl1_hci_ioctl4/a>(struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *4a href="+code=hdev" class="sref">hdev4/a>, unsigned int 4a href="+code=cmd" class="sref">cmd4/a>,  unsigned long 4a href="+code=arg" class="sref">arg4/a>)=14424/a>{=14434/a>        return -4a href="+code=ENOIOCTLCMD" class="sref">ENOIOCTLCMD4/a>;=14444/a>}=14454/a>=14464/a>=14474/a>=14484/a>4spau class="comment">/* ======================== Card services HCI interaction ======================== */4/spaue=14494/a>=14504/a>=14514/a>static int 4a href="+code=dtl1_open" class="sref">dtl1_open4/a>(4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a>)=14524/a>{=14534/a>        unsigned long 4a href="+code=flags" class="sref">flags4/a>;=14544/a>        unsigned int 4a href="+code=iobase" class="sref">iobase4/a> = 4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=start" class="sref">start4/a>;=14554/a>        struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *4a href="+code=hdev" class="sref">hdev4/a>;=14564/a>=14574/a>        4a href="+code=spin_lock_init" class="sref">spin_lock_init4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=lock" class="sref">lock4/a>));=14584/a>=14594/a>        4a href="+code=skb_queue_head_init" class="sref">skb_queue_head_init4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=txq" class="sref">txq4/a>));=14604/a>=14614/a>        4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_state" class="sref">rx_state4/a> = 4a href="+code=RECV_WAIT_NSH" class="sref">RECV_WAIT_NSH4/a>;=14624/a>        4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_count" class="sref">rx_count4/a> = 4a href="+code=NSHL" class="sref">NSHL4/a>;=14634/a>        4a href="+code=info" class="sref">info4/a>->4a href="+code=rx_skb" class="sref">rx_skb4/a> = 4a href="+code=NULL" class="sref">NULL4/a>;=14644/a>=14654/a>        4a href="+code=set_bit" class="sref">set_bit4/a>(4a href="+code=XMIT_WAITING" class="sref">XMIT_WAITING4/a>, &(4a href="+code=info" class="sref">info4/a>->4a href="+code=tx_state" class="sref">tx_state4/a>));=14664/a>=14674/a>        4spau class="comment">/* Initialize HCI device */4/spaue=14684/a>        4a href="+code=hdev" class="sref">hdev4/a> = 4a href="+code=hci_alloc_dev" class="sref">hci_alloc_dev4/a>();=14694/a>        if (!4a href="+code=hdev" class="sref">hdev4/a>) {=14704/a>                4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"Can't allocate HCI device"4/spaue);=14714/a>                return -4a href="+code=ENOMEM" class="sref">ENOMEM4/a>;=14724/a>        }=14734/a>=14744/a>        4a href="+code=info" class="sref">info4/a>->4a href="+code=hdev" class="sref">hdev4/a> = 4a href="+code=hdev" class="sref">hdev4/a>;=14754/a>=14764/a>        4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=bus" class="sref">bus4/a> = 4a href="+code=HCI_PCCARD" class="sref">HCI_PCCARD4/a>;=14774/a>        4a href="+code=hci_set_drvdata" class="sref">hci_set_drvdata4/a>(4a href="+code=hdev" class="sref">hdev4/a>, 4a href="+code=info" class="sref">info4/a>);=14784/a>        4a href="+code=SET_HCIDEV_DEV" class="sref">SET_HCIDEV_DEV4/a>(4a href="+code=hdev" class="sref">hdev4/a>, &4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=dev" class="sref">dev4/a>);=14794/a>=14804/a>        4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=open" class="sref">open4/a>     = 4a href="+code=dtl1_hci_open" class="sref">dtl1_hci_open4/a>;=14814/a>        4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=close" class="sref">close4/a>    = 4a href="+code=dtl1_hci_close" class="sref">dtl1_hci_close4/a>;=14824/a>        4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=flush" class="sref">flush4/a>    = 4a href="+code=dtl1_hci_flush" class="sref">dtl1_hci_flush4/a>;=14834/a>        4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=send" class="sref">send4/a>     = 4a href="+code=dtl1_hci_send_frame" class="sref">dtl1_hci_send_frame4/a>;=14844/a>        4a href="+code=hdev" class="sref">hdev4/a>->4a href="+code=ioctl" class="sref">ioctl4/a>    = 4a href="+code=dtl1_hci_ioctl" class="sref">dtl1_hci_ioctl4/a>;=14854/a>=14864/a>        4a href="+code=spin_lock_irqsave" class="sref">spin_lock_irqsave4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=lock" class="sref">lock4/a>), 4a href="+code=flags" class="sref">flags4/a>);=14874/a>=14884/a>        4spau class="comment">/* Reset UART */4/spaue=14894/a>        4a href="+code=outb" class="sref">outb4/a>(0, 4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_MCR" class="sref">UART_MCR4/a>);=14904/a>=14914/a>        4spau class="comment">/* Turn off interrupts */4/spaue=14924/a>        4a href="+code=outb" class="sref">outb4/a>(0, 4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_IER" class="sref">UART_IER4/a>);=14934/a>=14944/a>        4spau class="comment">/* Initialize UART */4/spaue=14954/a>        4a href="+code=outb" class="sref">outb4/a>(4a href="+code=UART_LCR_WLEN8" class="sref">UART_LCR_WLEN84/a>, 4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_LCR" class="sref">UART_LCR4/a>);        4spau class="comment">/* Reset DLAB */4/spaue=14964/a>        4a href="+code=outb" class="sref">outb4/a>((4a href="+code=UART_MCR_DTR" class="sref">UART_MCR_DTR4/a> | 4a href="+code=UART_MCR_RTS" class="sref">UART_MCR_RTS4/a> | 4a href="+code=UART_MCR_OUT2" class="sref">UART_MCR_OUT24/a>), 4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_MCR" class="sref">UART_MCR4/a>);=14974/a>=14984/a>        4a href="+code=info" class="sref">info4/a>->4a href="+code=ri_latch" class="sref">ri_latch4/a> = 4a href="+code=inb" class="sref">inb4/a>(4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=start" class="sref">start4/a> + 4a href="+code=UART_MSR" class="sref">UART_MSR4/a>)=14994/a>                                & 4a href="+code=UART_MSR_RI" class="sref">UART_MSR_RI4/a>;=15004/a>=15014/a>        4spau class="comment">/* Turn on interrupts */4/spaue=15024/a>        4a href="+code=outb" class="sref">outb4/a>(4a href="+code=UART_IER_RLSI" class="sref">UART_IER_RLSI4/a> | 4a href="+code=UART_IER_RDI" class="sref">UART_IER_RDI4/a> | 4a href="+code=UART_IER_THRI" class="sref">UART_IER_THRI4/a>, 4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_IER" class="sref">UART_IER4/a>);=15034/a>=15044/a>        4a href="+code=spin_unlock_irqrestore" class="sref">spin_unlock_irqrestore4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=lock" class="sref">lock4/a>), 4a href="+code=flags" class="sref">flags4/a>);=15054/a>=15064/a>        4spau class="comment">/* Timeout before it is safe to send the first HCI packet */4/spaue=15074/a>        4a href="+code=msleep" class="sref">msleep4/a>(2000);=15084/a>=15094/a>        4spau class="comment">/* Register HCI device */4/spaue=15104/a>        if (4a href="+code=hci_register_dev" class="sref">hci_register_dev4/a>(4a href="+code=hdev" class="sref">hdev4/a>) < 0) {=15114/a>                4a href="+code=BT_ERR" class="sref">BT_ERR4/a>(4spau class="string">"Can't register HCI device"4/spaue);=15124/a>                4a href="+code=info" class="sref">info4/a>->4a href="+code=hdev" class="sref">hdev4/a> = 4a href="+code=NULL" class="sref">NULL4/a>;=15134/a>                4a href="+code=hci_free_dev" class="sref">hci_free_dev4/a>(4a href="+code=hdev" class="sref">hdev4/a>);=15144/a>                return -4a href="+code=ENODEV" class="sref">ENODEV4/a>;=15154/a>        }=15164/a>=15174/a>        return 0;=15184/a>}=15194/a>=15204/a>=15214/a>static int 4a href="+code=dtl1_close" class="sref">dtl1_close4/a>(4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a>)=15224/a>{=15234/a>        unsigned long 4a href="+code=flags" class="sref">flags4/a>;=15244/a>        unsigned int 4a href="+code=iobase" class="sref">iobase4/a> = 4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=start" class="sref">start4/a>;=15254/a>        struct 4a href="+code=hci_dev" class="sref">hci_dev4/a> *4a href="+code=hdev" class="sref">hdev4/a> = 4a href="+code=info" class="sref">info4/a>->4a href="+code=hdev" class="sref">hdev4/a>;=15264/a>=15274/a>        if (!4a href="+code=hdev" class="sref">hdev4/a>)=15284/a>                return -4a href="+code=ENODEV" class="sref">ENODEV4/a>;=15294/a>=15304/a>        4a href="+code=dtl1_hci_close" class="sref">dtl1_hci_close4/a>(4a href="+code=hdev" class="sref">hdev4/a>);=15314/a>=15324/a>        4a href="+code=spin_lock_irqsave" class="sref">spin_lock_irqsave4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=lock" class="sref">lock4/a>), 4a href="+code=flags" class="sref">flags4/a>);=15334/a>=15344/a>        4spau class="comment">/* Reset UART */4/spaue=15354/a>        4a href="+code=outb" class="sref">outb4/a>(0, 4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_MCR" class="sref">UART_MCR4/a>);=15364/a>=15374/a>        4spau class="comment">/* Turn off interrupts */4/spaue=15384/a>        4a href="+code=outb" class="sref">outb4/a>(0, 4a href="+code=iobase" class="sref">iobase4/a> + 4a href="+code=UART_IER" class="sref">UART_IER4/a>);=15394/a>=15404/a>        4a href="+code=spin_unlock_irqrestore" class="sref">spin_unlock_irqrestore4/a>(&(4a href="+code=info" class="sref">info4/a>->4a href="+code=lock" class="sref">lock4/a>), 4a href="+code=flags" class="sref">flags4/a>);=15414/a>=15424/a>        4a href="+code=hci_unregister_dev" class="sref">hci_unregister_dev4/a>(4a href="+code=hdev" class="sref">hdev4/a>);=15434/a>        4a href="+code=hci_free_dev" class="sref">hci_free_dev4/a>(4a href="+code=hdev" class="sref">hdev4/a>);=15444/a>=15454/a>        return 0;=15464/a>}=15474/a>=15484/a>static int 4a href="+code=dtl1_probe" class="sref">dtl1_probe4/a>(struct 4a href="+code=pcmcia_device" class="sref">pcmcia_device4/a> *4a href="+code=link" class="sref">link4/a>)=15494/a>{=15504/a>        4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a>;=15514/a>=15524/a>        4spau class="comment">/* Create new info device */4/spaue=15534/a>        4a href="+code=info" class="sref">info4/a> = 4a href="+code=devm_kzalloc" class="sref">devm_kzalloc4/a>(&4a href="+code=link" class="sref">link4/a>->4a href="+code=dev" class="sref">dev4/a>, sizeof(*4a href="+code=info" class="sref">info4/a>), 4a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL4/a>);=15544/a>        if (!4a href="+code=info" class="sref">info4/a>)=15554/a>                return -4a href="+code=ENOMEM" class="sref">ENOMEM4/a>;=15564/a>=15574/a>        4a href="+code=info" class="sref">info4/a>->4a href="+code=p_dev" class="sref">p_dev4/a> = 4a href="+code=link" class="sref">link4/a>;=15584/a>        4a href="+code=link" class="sref">link4/a>->4a href="+code=priv" class="sref">priv4/a> = 4a href="+code=info" class="sref">info4/a>;=15594/a>=15604/a>        4a href="+code=link" class="sref">link4/a>->4a href="+code=config_flags" class="sref">config_flags4/a> |= 4a href="+code=CONF_ENABLE_IRQ" class="sref">CONF_ENABLE_IRQ4/a> | 4a href="+code=CONF_AUTO_SET_IO" class="sref">CONF_AUTO_SET_IO4/a>;=15614/a>=15624/a>        return 4a href="+code=dtl1_config" class="sref">dtl1_config4/a>(4a href="+code=link" class="sref">link4/a>);=15634/a>}=15644/a>=15654/a>=15664/a>static void 4a href="+code=dtl1_detach" class="sref">dtl1_detach4/a>(struct 4a href="+code=pcmcia_device" class="sref">pcmcia_device4/a> *4a href="+code=link" class="sref">link4/a>)=15674/a>{=15684/a>        4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a> = 4a href="+code=link" class="sref">link4/a>->4a href="+code=priv" class="sref">priv4/a>;=15694/a>=15704/a>        4a href="+code=dtl1_close" class="sref">dtl1_close4/a>(4a href="+code=info" class="sref">info4/a>);=15714/a>        4a href="+code=pcmcia_disable_device" class="sref">pcmcia_disable_device4/a>(4a href="+code=link" class="sref">link4/a>);=15724/a>}=15734/a>=15744/a>static int 4a href="+code=dtl1_confcheck" class="sref">dtl1_confcheck4/a>(struct 4a href="+code=pcmcia_device" class="sref">pcmcia_device4/a> *4a href="+code=p_dev" class="sref">p_dev4/a>, void *4a href="+code=priv_data" class="sref">priv_data4/a>)=15754/a>{=15764/a>        if ((4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[1]->4a href="+code=end" class="sref">end4/a>) || (4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[1]->4a href="+code=end" class="sref">end4/a> < 8))=15774/a>                return -4a href="+code=ENODEV" class="sref">ENODEV4/a>;=15784/a>=15794/a>        4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=flags" class="sref">flags4/a> &= ~4a href="+code=IO_DATA_PATH_WIDTH" class="sref">IO_DATA_PATH_WIDTH4/a>;=15804/a>        4a href="+code=p_dev" class="sref">p_dev4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=flags" class="sref">flags4/a> |= 4a href="+code=IO_DATA_PATH_WIDTH_8" class="sref">IO_DATA_PATH_WIDTH_84/a>;=15814/a>=15824/a>        return 4a href="+code=pcmcia_request_io" class="sref">pcmcia_request_io4/a>(4a href="+code=p_dev" class="sref">p_dev4/a>);=15834/a>}=15844/a>=15854/a>static int 4a href="+code=dtl1_config" class="sref">dtl1_config4/a>(struct 4a href="+code=pcmcia_device" class="sref">pcmcia_device4/a> *4a href="+code=link" class="sref">link4/a>)=15864/a>{=15874/a>        4a href="+code=dtl1_info_t" class="sref">dtl1_info_t4/a> *4a href="+code=info" class="sref">info4/a> = 4a href="+code=link" class="sref">link4/a>->4a href="+code=priv" class="sref">priv4/a>;=15884/a>        int 4a href="+code=ret" class="sref">ret4/a>;=15894/a>=15904/a>        4spau class="comment">/* Look for a generic full-sized window */4/spaue=15914/a>        4a href="+code=link" class="sref">link4/a>->4a href="+code=resource" class="sref">resource4/a>[0]->4a href="+code=end" class="sref">end4/a> = 8;=15924/a>        4a href="+code=ret" class="sref">ret4/a> = 4a href="+code=pcmcia_loop_config" class="sref">pcmcia_loop_config4/a>(4a href="+code=link" class="sref">link4/a>, 4a href="+code=dtl1_confcheck" class="sref">dtl1_confcheck4/a>, 4a href="+code=NULL" class="sref">NULL4/a>);=15934/a>        if (4a href="+code=ret" class="sref">ret4/a>)=15944/a>                goto 4a href="+code=failed" class="sref">failed4/a>;=15954/a>=15964/a>        4a href="+code=ret" class="sref">ret4/a> = 4a href="+code=pcmcia_request_irq" class="sref">pcmcia_request_irq4/a>(4a href="+code=link" class="sref">link4/a>, 4a href="+code=dtl1_interrupt" class="sref">dtl1_interrupt4/a>);=15974/a>        if (4a href="+code=ret" class="sref">ret4/a>)=15984/a>                goto 4a href="+code=failed" class="sref">failed4/a>;=15994/a>=16004/a>        4a href="+code=ret" class="sref">ret4/a> = 4a href="+code=pcmcia_enable_device" class="sref">pcmcia_enable_device4/a>(4a href="+code=link" class="sref">link4/a>);=16014/a>        if (4a href="+code=ret" class="sref">ret4/a>)=16024/a>                goto 4a href="+code=failed" class="sref">failed4/a>;=16034/a>=16044/a>        4a href="+code=ret" class="sref">ret4/a> = 4a href="+code=dtl1_open" class="sref">dtl1_open4/a>(4a href="+code=info" class="sref">info4/a>);=16054/a>        if (4a href="+code=ret" class="sref">ret4/a>)=16064/a>                goto 4a href="+code=failed" class="sref">failed4/a>;=16074/a>=16084/a>        return 0;=16094/a>=16104/a>4a href="+code=failed" class="sref">failed4/a>:=16114/a>        4a href="+code=dtl1_detach" class="sref">dtl1_detach4/a>(4a href="+code=link" class="sref">link4/a>);=16124/a>        return 4a href="+code=ret" class="sref">ret4/a>;=16134/a>}=16144/a>=16154/a>static const struct 4a href="+code=pcmcia_device_id" class="sref">pcmcia_device_id4/a> 4a href="+code=dtl1_ids" class="sref">dtl1_ids4/a>[] = {=16164/a>        4a href="+code=PCMCIA_DEVICE_PROD_ID12" class="sref">PCMCIA_DEVICE_PROD_ID124/a>(4spau class="string">"Nokia Mobile Phones"4/spaue, 4spau class="string">"DTL-1"4/spaue, 0xe1bfdd64, 0xe168480d),=16174/a>        4a href="+code=PCMCIA_DEVICE_PROD_ID12" class="sref">PCMCIA_DEVICE_PROD_ID124/a>(4spau class="string">"Nokia Mobile Phones"4/spaue, 4spau class="string">"DTL-4"4/spaue, 0xe1bfdd64, 0x9102bc82),=16184/a>        4a href="+code=PCMCIA_DEVICE_PROD_ID12" class="sref">PCMCIA_DEVICE_PROD_ID124/a>(4spau class="string">"Socket"4/spaue, 4spau class="string">"CF"4/spaue, 0xb38bcc2e, 0x44ebf863),=16194/a>        4a href="+code=PCMCIA_DEVICE_PROD_ID12" class="sref">PCMCIA_DEVICE_PROD_ID124/a>(4spau class="string">"Socket"4/spaue, 4spau class="string">"CF+ Personal Network Card"4/spaue, 0xb38bcc2e, 0xe732bae3),=16204/a>        4a href="+code=PCMCIA_DEVICE_NULL" class="sref">PCMCIA_DEVICE_NULL4/a>=16214/a>};=16224/a>4a href="+code=MODULE_DEVICE_TABLE" class="sref">MODULE_DEVICE_TABLE4/a>(4a href="+code=pcmcia" class="sref">pcmcia4/a>, 4a href="+code=dtl1_ids" class="sref">dtl1_ids4/a>);=16234/a>=16244/a>static struct 4a href="+code=pcmcia_driver" class="sref">pcmcia_driver4/a> 4a href="+code=dtl1_driver" class="sref">dtl1_driver4/a> = {=16254/a>        .4a href="+code=owner" class="sref">owner4/a>          = 4a href="+code=THIS_MODULE" class="sref">THIS_MODULE4/a>,=16264/a>        .4a href="+code=nam " class="sref">nam 4/a>           = 4spau class="string">"dtl1_cs"4/spaue,=16274/a>        .4a href="+code=probe" class="sref">probe4/a>          = 4a href="+code=dtl1_probe" class="sref">dtl1_probe4/a>,=16284/a>        .4a href="+code=remove" class="sref">remove4/a>         = 4a href="+code=dtl1_detach" class="sref">dtl1_detach4/a>,=16294/a>        .4a href="+code=id_table" class="sref">id_table4/a>       = 4a href="+code=dtl1_ids" class="sref">dtl1_ids4/a>,=16304/a>};=16314/a>=16324/a>static int 4a href="+code=__init" class="sref">__init4/a> 4a href="+code=init_dtl1_cs" class="sref">init_dtl1_cs4/a>(void)=16334/a>{=16344/a>        return 4a href="+code=pcmcia_register_driver" class="sref">pcmcia_register_driver4/a>(&4a href="+code=dtl1_driver" class="sref">dtl1_driver4/a>);=16354/a>}=16364/a>=16374/a>=16384/a>static void 4a href="+code=__exit" class="sref">__exit4/a> 4a href="+code=exit_dtl1_cs" class="sref">exit_dtl1_cs4/a>(void)=16394/a>{=16404/a>        4a href="+code=pcmcia_unregister_driver" class="sref">pcmcia_unregister_driver4/a>(&4a href="+code=dtl1_driver" class="sref">dtl1_driver4/a>);=16414/a>}=16424/a>=16434/a>4a href="+code=module_init" class="sref">module_init4/a>(4a href="+code=init_dtl1_cs" class="sref">init_dtl1_cs4/a>);=16444/a>4a href="+code=module_exit" class="sref">module_exit4/a>(4a href="+code=exit_dtl1_cs" class="sref">exit_dtl1_cs4/a>);=16454/a>
lxr.linux.no kindly hosted by Redpill Linpro AS4/a>, provider of Linux consulting and operations services since 1995.