|
From: Peter K. <pk...@us...> - 2001-03-04 15:53:40
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.132 1.133=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Corrected the indentation and cleaned up some of the code.
The diff of the modified file(s):
--- bluetooth.c 2001/03/02 21:52:15 1.132
+++ bluetooth.c 2001/03/04 15:55:03 1.133
@@ -110,15 +110,6 @@
=20
/****************** CONSTANT AND MACRO SECTION ***************************=
***/
=20
-#define BT_PORT_0 /* Should be set from Config.in */
-
-#ifdef BT_PORT_0
-#define BT_PORT 0x3F8=20
-#define BT_IRQ 4
-#else
-/* ??? */
-#endif
-
#define BLUETOOTH_TYPE_DATA 1
#define BLUETOOTH_TYPE_DATA_VOICE 2
=20
@@ -131,8 +122,8 @@
=20
#ifdef BT_USEINBUFFER
=20
-/* This buffer is used decrease overruns on serial port. Copies data in in=
terrupt context
- and schedules a task which consumes data at 'safe' time */
+/* This buffer is used decrease overruns on serial port. Copies data in
+ interrupt context and schedules a task which consumes data at 'safe' ti=
me */
=20
#define BT_INBUFFER_SIZE 4000
=20
@@ -163,7 +154,6 @@
static void bt_handle_indata(const __u8 *data, s32 count);
#endif
=20
-
static void bt_init_stack(void);
static s32 bt_ctrl_init(void);
static s32 bt_connect(u8 *bd_addr, u32 con_id);
@@ -189,12 +179,11 @@
/*
* LINUX 2.2.X SPECIFIC CODE
*/
-static ssize_t
-bt_tty_read(struct tty_struct *tty, struct file *file, u8 *buf, size_t nr);
+static ssize_t bt_tty_read(struct tty_struct *tty, struct file *file,
+ u8 *buf, size_t nr);
=20
-static ssize_t
-bt_tty_write(struct tty_struct *tty, struct file *file, const u8 *buf,
- size_t nr);
+static ssize_t bt_tty_write(struct tty_struct *tty, struct file *file,
+ const u8 *buf, size_t nr);
=20
static u32 bt_tty_poll(struct tty_struct *tty, struct file *file,
struct poll_table_struct *wait);
@@ -367,8 +356,6 @@
=20
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -=20
=20
-
-
*/
=20
=20
@@ -379,11 +366,9 @@
static s32
bt_open(struct tty_struct *tty, struct file * filp)
{
- s32 line;
+ s32 line =3D GET_TTYLINE(tty);
s32 ret_val;
=20=09
- line =3D GET_TTYLINE(tty);
-
BT_DRIVER("bt_open on line %d\n", line);=09
=20=09
ret_val =3D bt_register_tty(tty) ;
@@ -400,9 +385,7 @@
static void
bt_close(struct tty_struct *tty, struct file * filp)
{
- s32 line;
-
- line =3D GET_TTYLINE(tty);
+ s32 line =3D GET_TTYLINE(tty);
=20
BT_DRIVER("bt_close on line %d \n", line);
=20
@@ -415,15 +398,11 @@
MOD_DEC_USE_COUNT;
}
=20
-=20
-
static void
bt_put_char(struct tty_struct *tty, u8 ch)
{
- u8 c;
- c =3D ch;
- BT_DRIVER("bt_put_char %c\n", c);
- bt_write_top(tty, 0, &c, 1);
+ BT_DRIVER("bt_put_char %c\n", ch);
+ bt_write_top(tty, 0, &ch, 1);
}
=20
static void
@@ -438,8 +417,8 @@
static s32=20
bt_write_room(struct tty_struct *tty)
{
- s32 n;
- n=3Dbuf_write_room();
+ s32 n =3D buf_write_room();
+
BT_DRIVER("bt_write_room : %d\n", n);
return n;
}
@@ -447,19 +426,19 @@
static s32
bt_chars_in_buffer(struct tty_struct *tty)
{
- u16 n;
- n=3Dbuf_byte_count();
+ u16 n =3D buf_byte_count();
+
BT_DRIVER("bt_chars_in_buffer : %d\n", n);=20=20
return n;
}
=20
-
/* Must flush the buffer, otherwise chars_in_buffer returns nonzero
and pppd hangs on the exit while doing the set line disc ioctl */
static void
bt_flush_buffer(struct tty_struct *tty)
{
bt_tx_buf* tx_buf;
+
BT_DRIVER("bt_flush_buffer\n");
=20=09
while((tx_buf =3D get_bt_buf())){
@@ -509,39 +488,34 @@
}
=20=09
switch (cmd) {
-
case BT_SDP_REQUEST:
{
bt_sdp_request sdpRequest;
int returnValue =3D -1;
=20
- /*---------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
/* Copy arguments to kernel space. */
- /*---------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
BT_DRIVER(FNC"Copying arguments from user to kernel space\n");
copy_from_user(&sdpRequest, (s32*)arg, size);
=20
- /*---------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
/* Now execute the request. */
- /*---------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
BT_DRIVER(FNC"Executing bt_execute_sdp_request\n");
=20=20=20=20=20=20=20
- if ( (returnValue =3D bt_execute_sdp_request(&sdpRequest)) >=3D 0 )
- {
- /*---------------------------------------------------------*/
+ if ((returnValue =3D bt_execute_sdp_request(&sdpRequest)) >=3D 0) {
+ /*---------------------------------------------------*/
/* Copy the data back to user space and return. */
- /*---------------------------------------------------------*/
+ /*---------------------------------------------------*/
BT_DRIVER(FNC"Copying data back to user space\n");
copy_to_user((s32*)arg, &sdpRequest, size);
}
=20
return returnValue;
-
} /* End of BT_SDP_REQUEST */
=20
-
case BTCONNECT:
-
/* argument is an object with all info to start a remote=20
connection */
=20
@@ -559,7 +533,6 @@
return bt_disconnect(con_id);
}
=20
-
case BTWAITFORCONNECTION:
{
s32 line;
@@ -590,10 +563,7 @@
{
s32 line;=09=20=20
copy_from_user(&line, (s32*)arg, size);
- if (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED)
- return 1;
- else
- return 0;
+ return (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED);
}
=20=09
case BTSETSPEED:
@@ -892,8 +862,7 @@
=20
case HCIREAD_AUTHENTICATION_ENABLE:
{
- s32 result;
- result =3D hci_read_authentication_enable();
+ s32 result =3D hci_read_authentication_enable();
put_user(result, (s32*)arg);
break;
}
@@ -913,8 +882,7 @@
=20=09=09
case HCIREAD_ENCRYPTION_MODE:
{
- s32 result=3D0;
- result =3D hci_read_encryption_mode();
+ s32 result =3D hci_read_encryption_mode();
put_user(result, (s32*)arg);
break;
}
@@ -948,6 +916,7 @@
BT_DRIVER(FNC"HCIREADLOCALBDADDR\n");
=20=09=09
hci_read_local_bd(bd_addr);
+
{
BD_ADDR rev_bd;
u16 i;
@@ -1151,7 +1120,6 @@
}
#endif
=20
-
static s32
bt_tty_open (struct tty_struct *tty)
{
@@ -1223,8 +1191,7 @@
{
#define FNC "bt_write_lower_driver: "
=20
- if (len < 0) /* (!) */
- {
+ if (len < 0) { /* (!) */
D_ERR("Can't write neg length...\n");
return 0;
}
@@ -1295,27 +1262,22 @@
const u8 *buf, s32 count)
{
#define FNC "bt_write_top"
- s32 line;
+ s32 line =3D GET_TTYLINE(tty);
s32 bytes_sent;
u32 rfcomm_conid;
struct bt_session *bt;
=20=09
-=09
- line =3D GET_TTYLINE(tty);
-
BT_DATA(" |X|<-- %3d [%d]\n", count, line);
=20
bt =3D (bt_session *)tty->driver_data;
=20=09
- if ((bt->rfcomm !=3D NULL) && (bt->rfcomm->magic !=3D RFCOMM_MAGIC))
- {
+ if ((bt->rfcomm !=3D NULL) && (bt->rfcomm->magic !=3D RFCOMM_MAGIC)) {
D_ERR(FNC": rfcomm magic failed (0x%x !=3D 0x%x)\n",=20
bt->rfcomm->magic, RFCOMM_MAGIC);
return 0;
}
=20
- if (SESSIONSTATE(line) !=3D BT_ACTIVE)
- {
+ if (SESSIONSTATE(line) !=3D BT_ACTIVE) {
D_WARN("bt_write_top : line %d is not in active state\n",
line);
return 0;
@@ -1421,8 +1383,7 @@
}
=20
/* found an active */
- BT_DATA("bt_feedstack : wakeup line %d !\n",=20
- check_line);
+ BT_DATA("bt_feedstack : wakeup line %d !\n", check_line);
upper_tty =3D GET_UPPERTTY(check_line);
bt_ctrl.tty_last_unthrottled =3D check_line;
=20=09=09
@@ -1431,8 +1392,8 @@
return;
}
=20=09
- if ((upper_tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
- && upper_tty->ldisc.write_wakeup) {
+ if ((upper_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
+ upper_tty->ldisc.write_wakeup) {
BT_DATA(" |X|<<*** [%d]\n", check_line);
=20=09=09
/* TTY_DO_WRITE_WAKEUP bit is cleared in=20
@@ -1440,8 +1401,7 @@
will be able to write more data */
=20
(upper_tty->ldisc.write_wakeup)(upper_tty);
- }
- else if (!upper_tty->ldisc.write_wakeup) {=20=20=20=20=20
+ } else if (!upper_tty->ldisc.write_wakeup) {=20=20=20=20=20
/* if no wake_up function is defined (N_TTY ldisc)
wake up wait queue */
BT_DATA(" |X|<<*** [%d] (n_tty)\n", check_line);
@@ -1474,9 +1434,7 @@
/* check for overruns... */
if ( hci_data.put + count - BT_INBUFFER_SIZE >=3D hci_data.get ) {
D_ERR("bt_handle_indata : buffer overrun!\n");
- }
- else
- {
+ } else {
/* Calculate how much space there is left at the end=20
of the buffer */
free =3D hci_data.tail - hci_data.put + 1;
@@ -1484,21 +1442,18 @@
/* normal case, data fits in buffer */
if ( count < free ) {
memcpy(hci_data.put, (u8*)data, count);
- }
+ } else {
/* wrap buffer */
- else {
memcpy(hci_data.put, (u8*)data, free);
memcpy(hci_data.head, (u8*)(data + free), count - free);=20=20=20=20
}
- }
}
- else {=20
+ } else {=20
/* hci_data.put < hci_data.get */
/* check for overruns ... */
if ( hci_data.put + count >=3D hci_data.get ) {
D_ERR("bt_handle_indata: buffer overrun!\n");
- }
- else {
+ } else {
/* Copy the data to the buffer */
memcpy(hci_data.put, (u8*)data, count);
}
@@ -1520,8 +1475,7 @@
if ( hci_data.get =3D=3D hci_data.put ) {
sti();
return;
- }
- else if ( hci_data.get > hci_data.put ) {
+ } else if (hci_data.get > hci_data.put) {
/* buffer is wrapped */
size_end =3D hci_data.tail - hci_data.get + 1;
size_start =3D hci_data.put - hci_data.head;
@@ -1598,51 +1552,48 @@
int sdp_connection_id =3D -1;
int return_value;
=20
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
/* Get the line to use for SDP communication. =
*/
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
line =3D GET_SDPLINE(con_id);
=20=20=20=20=20=20=20
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
/* Check the line to assure no other connections on it. =
*/
- /*------------------------------------------------------------------=
----*/
- if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED)|| (SESSIONSTATE(line) =
=3D=3D BT_ACTIVE))
- {
- D_WARN("already got connection on line %d\n", GET_SDPLINE(con_id));=20
+ /*-----------------------------------------------------------*/
+ if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) ||
+ (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) {
+ D_WARN("already got connection on line %d\n",
+ GET_SDPLINE(con_id));=20
return -1;
}=20
=20
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
/* Initiate the connection. =
*/
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
BT_DRIVER(FNC"Connecting SDP on line %d\n", line);
PRINTPKT("Remote BD : ", bd_addr, 6);
- if ( (sdp_connection_id =3D sdp_connect_req(bd_addr, line)) >=3D 0 )
- {
- /*---------------------------------------------------------------=
--------*/
- /* If here, we've successfully created a SDP connection entry and=
are */
- /* starting the sequence of opening a l2cap connection. =
*/
- /* Allow the bottom half to process the request and get back to u=
s. */
- /*---------------------------------------------------------------=
--------*/
+ if ((sdp_connection_id =3D sdp_connect_req(bd_addr, line)) >=3D 0) {
+ /*---------------------------------------------------*/
+ /* If here, we have successfully created an SDP */
+ /* connection entry and are starting the sequence of */
+ /* opening an l2cap connection. Allow the bottom */
+ /* half to process the request and get back to us. */
+ /*---------------------------------------------------*/
BT_DRIVER(FNC"sleep on line %d\n", line);
interruptible_sleep_on(&bt_ctrl.connect_wq[line]);
=20
- /*---------------------------------------------------------------=
--------*/
- /* If the connect_status is >=3D 0, then the lower stack did not =
have a */
- /* problem handling the request. Therefore return the sdp_connec=
tion_id */
- /*---------------------------------------------------------------=
--------*/
+ /*---------------------------------------------------*/
+ /* If the connect_status is >=3D 0, then the lower */
+ /* stack did not have a problem handling the request.*/
+ /* Therefore return the sdp_connection_id */
+ /*---------------------------------------------------*/
BT_DRIVER(FNC"Wake up - line %d\n", line);
- if ( bt_ctrl.session[line].connect_status >=3D 0 )
- {
+ if (bt_ctrl.session[line].connect_status >=3D 0) {
return_value =3D sdp_connection_id;
- }
- else
- {
+ } else {
return_value =3D bt_ctrl.session[line].connect_status;
- }
}
- else
- {
+ } else {
return_value =3D sdp_connection_id;
}
=20
@@ -1652,6 +1603,7 @@
=20
default:=20=20=20=20
BT_DRIVER(FNC"PSM %d not supported as client\n", GET_PSM(con_id));
+ break;
}
return -1;
#undef FNC
@@ -1659,56 +1611,50 @@
=20
static s32 bt_execute_sdp_request(bt_sdp_request *sdpRequest)
{
- int line, sdpIndex;
- s32 returnValue =3D -1;
+ int line =3D GET_SDPLINE(sdpRequest->conID);
+ int sdpIndex =3D GET_SDPINDEX(sdpRequest->conID);
=20
- /*-------------------------------------------------------------*/
- /* Initiate the request. */
- /*-------------------------------------------------------------*/
- line =3D GET_SDPLINE(sdpRequest -> conID);
- sdpIndex =3D GET_SDPINDEX(sdpRequest -> conID);
- if ( SESSIONSTATE(line) =3D=3D BT_ACTIVE )
- {
- BT_DRIVER("bt_execute_sdp_request: line %d SDP index %d\n", line, sd=
pIndex);
- if ( sdpStartRequest(sdpIndex, sdpRequest->sdpCommand, sdpRequest->p=
duPayload, sdpRequest->pduLength) > 0 )
- {
+ if (SESSIONSTATE(line) !=3D BT_ACTIVE) {
+ /*-----------------------------------------------------------*/
+ /* SDP connection not active! Don't issue the request. */
+ /*-----------------------------------------------------------*/
+ BT_DRIVER("bt_execute_sdp_request: line %d does not have an active conne=
ction!\n", line);
+ return -1;
+ }
+
+ BT_DRIVER("bt_execute_sdp_request: line %d SDP index %d\n",
+ line, sdpIndex);
+ if (sdpStartRequest(sdpIndex,
+ sdpRequest->sdpCommand,
+ sdpRequest->pduPayload,
+ sdpRequest->pduLength) < 0)
+ return -1;
+
/*---------------------------------------------------------------=
----*/
/* Sleep on this line while the response is going through. =
*/
/*---------------------------------------------------------------=
----*/
printk("bt_execute_sdp_request: sleep on line %d\n", line);
interruptible_sleep_on(&bt_ctrl.connect_wq[line]);
=20
- /*---------------------------------------------------------------=
-------*/
- /* If we're back, there may be data to send back. Copy into sdpR=
equest */
- /* and return. =
*/
- /*---------------------------------------------------------------=
-------*/
- if ( bt_ctrl.session[line].sdpRequestResponseData )
- {
+ /*-------------------------------------------------------------------*/
+ /* If we're back, there may be data to send back. */
+ /* Copy into sdpRequest and return. */
+ /*-------------------------------------------------------------------*/
+ if (bt_ctrl.session[line].sdpRequestResponseData) {
BT_DRIVER("bt_execute_sdp_request: sdpRequestResponseData 0x%x=
- copying\n", (int)bt_ctrl.session[line].sdpRequestResponseData);
- memcpy(sdpRequest->requestResponse, bt_ctrl.session[line].sdpR=
equestResponseData,=20
+ memcpy(sdpRequest->requestResponse,
+ bt_ctrl.session[line].sdpRequestResponseData,=20
bt_ctrl.session[line].sdpRequestResponseDataLength);
sdpRequest->responseLength =3D bt_ctrl.session[line].sdpReques=
tResponseDataLength;
}
- returnValue =3D 1;
- }
- }
- else
- {
- /*-----------------------------------------------------------*/
- /* SDP connection not active! Don't issue the request. */
- /*-----------------------------------------------------------*/
- BT_DRIVER("bt_execute_sdp_request: line %d does not have an active c=
onnection!\n", line);
- }
-
- return returnValue;
=20
+ return 0;
} /* End of bt_execute_sdp_request() */
=20
void
bt_connect_ind(u32 con_id)=20
{
- DSYS("Got connect indication on PSM %d\n",=20
- GET_PSM(con_id));
+ DSYS("Got connect indication on PSM %d\n", GET_PSM(con_id));
}
=20
void
@@ -1722,7 +1668,6 @@
=20=09
switch (psm) {
case RFCOMM_LAYER:
- {=09
BT_DRIVER("bt_connect_cfm [%s]\n", psmname(psm));
line =3D GET_RFCOMMLINE(con_id);
CHECK_RFCOMM(con_id);
@@ -1734,30 +1679,28 @@
}
=20
bt_ctrl.session[line].connect_status =3D status;
- BT_DRIVER("bt_connect_cfm, line %d [%s]\n", GET_RFCOMMLINE(con_id), psmn=
ame(psm));
+ BT_DRIVER("bt_connect_cfm, line %d [%s]\n",
+ GET_RFCOMMLINE(con_id), psmname(psm));
release_wq_timer(&bt_timer);
wake_up_interruptible(&bt_ctrl.connect_wq[line]);
wake_up_interruptible(&bt_ctrl.any_wq);
break;
- }
=20=09
case SDP_LAYER:
- {
BT_DRIVER("bt_connect_cfm [%s]\n", psmname(psm));
line =3D GET_SDPLINE(con_id);
=20
- /*---------------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
/* Check incomming line for validity. */
- /*---------------------------------------------------------------*/
- if ( (line < 0) || (line > BT_NBR_DATAPORTS))
- {
+ /*-----------------------------------------------------------*/
+ if ( (line < 0) || (line > BT_NBR_DATAPORTS)) {
D_ERR("bt_connect_cfm on invalid line (%d)\n", line);
return;
}
=20
- /*---------------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
/* Record the connection status for bt_connect() to process. */
- /*---------------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
bt_ctrl.session[line].connect_status =3D status;
BT_DRIVER("bt_connect_cfm, line %d [%s]\n", GET_SDPLINE(con_id), psmname=
(psm));
printk("wake up line %d\n", line);
@@ -1765,11 +1708,11 @@
wake_up_interruptible(&bt_ctrl.connect_wq[line]);
wake_up_interruptible(&bt_ctrl.any_wq);
break;
- }
=20=09=09
case TCS_LAYER:
BT_DRIVER("bt_connect_cfm [%s]\n", psmname(psm));
break;
+
default:
D_ERR("bt_connect_cfm : unknown layer %d\n", psm);
break;
@@ -1781,8 +1724,7 @@
/*----------------------------------------------------------*/
/* Check the line for validity. */
/*----------------------------------------------------------*/
- if (line > BT_NBR_DATAPORTS)=20
- {
+ if (line > BT_NBR_DATAPORTS) {
D_ERR("bt_connect_cfm on invalid line (%d)\n", line);
return;
}
@@ -1796,8 +1738,7 @@
/*----------------------------------------------------------*/
/* If previous data, deallocate it. */
/*----------------------------------------------------------*/
- if ( bt_ctrl.session[line].sdpRequestResponseData )
- {
+ if (bt_ctrl.session[line].sdpRequestResponseData) {
D_WARN("bt_send_sdp_data_received: sdpRequestResponseData set - deal=
locate\n");
kfree(bt_ctrl.session[line].sdpRequestResponseData);
bt_ctrl.session[line].sdpRequestResponseData =3D NULL;
@@ -1808,7 +1749,6 @@
bt_ctrl.session[line].sdpRequestResponseDataLength =3D len;
wake_up_interruptible(&bt_ctrl.connect_wq[line]);
return;
-
} /* End of bt_send_sdp_data_received() */
=20
static s32 bt_disconnect(u32 con_id)
@@ -1832,14 +1772,14 @@
void
bt_disconnect_ind(u32 con_id)=20
{
- DSYS("Got disconnect indication on PSM %d\n",=20
- GET_PSM(con_id));
+ DSYS("Got disconnect indication on PSM %d\n",GET_PSM(con_id));
}
=20
void
bt_disconnect_cfm(u32 con_id, s32 status)=20
{
u32 line =3D GET_RFCOMMLINE(con_id);
+
DSYS("Got disconnect confirm on PSM %d status %d\n",=20
GET_PSM(con_id), status);
wake_up_interruptible(&bt_ctrl.connect_wq[line]);
@@ -1887,7 +1827,6 @@
}
#endif
=20
-
/**********************************/
/* Bluetooth Stack Initialization */
/**********************************/
@@ -1899,7 +1838,6 @@
s32 status;
s32 procfs_status =3D -1;
=20=09
-
show_bt_version();
=20
/* Initialize the tty_driver structure */
@@ -1985,17 +1923,19 @@
sertty =3D NULL;
=20
#ifdef BT_USE_PROC
-
DSYS("Registering BT proc files\n");
=20=20
#ifdef KERNEL_VERSION /* Not defined for kernel 2.0.x */
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
- if ( create_proc_info_entry(bt_status.name, bt_status.mode, &proc_root,=
bt_status.get_info) )
+ if (create_proc_info_entry(bt_status.name,
+ bt_status.mode,
+ &proc_root,
+ bt_status.get_info))
procfs_status =3D 1;
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &bt_status);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &bt_status);
@@ -2014,10 +1954,13 @@
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
- if ( create_proc_info_entry(bt_internal_info.name, bt_internal_info.mod=
e, &proc_root, bt_internal_info.get_info) )
+ if (create_proc_info_entry(bt_internal_info.name,
+ bt_internal_info.mode,
+ &proc_root,
+ bt_internal_info.get_info))
procfs_status =3D 1;
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &bt_internal_info);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &bt_internal_info);
@@ -2036,18 +1979,19 @@
{
struct proc_dir_entry *entry;
procfs_status =3D -1;
- if ( (entry =3D create_proc_entry(sdp_proc_entry.name, sdp_proc_entry.m=
ode, &proc_root)) )
- {
- /*------------------------------------------------------------*/
- /* If the proc entry was registered successfully, then set */
- /* all the necessary structure information. */
- /*------------------------------------------------------------*/
+ if ((entry =3D create_proc_entry(sdp_proc_entry.name,
+ sdp_proc_entry.mode,
+ &proc_root))) {
+ /*---------------------------------------------------*/
+ /* If the proc entry was registered successfully, */
+ /* then set all the necessary structure information. */
+ /*---------------------------------------------------*/
entry->proc_iops =3D sdp_proc_entry.proc_iops;
entry->proc_fops =3D sdp_proc_entry.proc_fops;
procfs_status =3D 1;
}
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &sdp_proc_entry);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &sdp_proc_entry);
@@ -2067,19 +2011,20 @@
{
struct proc_dir_entry *entry;
procfs_status =3D -1;
- if ( (entry =3D create_proc_entry(sec_man_proc_entry.name, sec_man_proc=
_entry.mode, &proc_root)) )
- {
- /*------------------------------------------------------------*/
- /* If the proc entry was registered successfully, then set */
- /* all the necessary structure information. */
- /*------------------------------------------------------------*/
+ if ((entry =3D create_proc_entry(sec_man_proc_entry.name,
+ sec_man_proc_entry.mode,
+ &proc_root))) {
+ /*---------------------------------------------------*/
+ /* If the proc entry was registered successfully, */
+ /* then set all the necessary structure information. */
+ /*---------------------------------------------------*/
entry->proc_iops =3D sec_man_proc_entry.proc_iops;
entry->proc_fops =3D sec_man_proc_entry.proc_fops;
entry->get_info =3D sec_man_proc_entry.get_info;
procfs_status =3D 1;
}
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &sec_man_proc_entry);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &sec_man_proc_entry);
@@ -2098,10 +2043,13 @@
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
- if ( create_proc_info_entry(bt_proc_doit.name, bt_proc_doit.mode, &proc=
_root, bt_proc_doit.get_info) )
+ if (create_proc_info_entry(bt_proc_doit.name,
+ bt_proc_doit.mode,
+ &proc_root,
+ bt_proc_doit.get_info))
procfs_status =3D 1;
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &bt_proc_doit);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &bt_proc_doit);
@@ -2121,10 +2069,13 @@
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
- if ( create_proc_info_entry(tci_proc_entry.name, tci_proc_entry.mode, &=
proc_root, tci_proc_entry.get_info) )
+ if (create_proc_info_entry(tci_proc_entry.name,
+ tci_proc_entry.mode,
+ &proc_root,
+ tci_proc_entry.get_info))
procfs_status =3D 1;
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &tci_proc_entry);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &tci_proc_entry);
@@ -2162,7 +2113,6 @@
return bt_stack_initiated;
}
=20
-
void
bt_init_stack()
{
@@ -2233,8 +2183,7 @@
if ((line!=3Dtty_linebuf.line) && (tty_linebuf.line!=3DTTY_NOLINE)) {
D_ERR("Line %d not active and linebuf busy, silent discard...\n", line);
return;
- }
- else if (tty_linebuf.line =3D=3D TTY_NOLINE)
+ } else if (tty_linebuf.line =3D=3D TTY_NOLINE)
tty_linebuf.line =3D line;
=20
/* is there room for data ? */
@@ -2263,8 +2212,7 @@
NULL, tty_linebuf.cur_len);=20=20
=20
bt_reset_linebuf();
- }
- else
+ } else
DSYS("bt_linebuf_empty : no data sent\n");
}
#endif /* BT_USELINEBUF */
@@ -2329,7 +2277,6 @@
}
}
=20
-
s32 bt_sprintf_status(u8 *buf)
{
s32 pos =3D 0;
@@ -2363,17 +2310,13 @@
s32
bt_register_rfcomm(struct rfcomm_con *rfcomm, u8 dlci)
{
- s32 line;
+ s32 line =3D rfcomm->line;
s32 found =3D -1;
=20
- line =3D rfcomm->line;
-=09
if ((SESSIONSTATE(line) =3D=3D BT_INACTIVE) ||=20
- (SESSIONSTATE(line) =3D=3D BT_UPPERCONNECTED))=20
- {
+ (SESSIONSTATE(line) =3D=3D BT_UPPERCONNECTED)) {
/* now register ! */
- DSYS("bt_register_rfcomm : dlci %d on line %d\n",=20
- dlci, line);
+ DSYS("bt_register_rfcomm : dlci %d on line %d\n", dlci, line);
=20=09=09
bt_ctrl.session[line].rfcomm =3D rfcomm;=20
bt_ctrl.session[line].dlci =3D dlci;
@@ -2397,8 +2340,7 @@
{
s32 found =3D 0;
=20
- if (!bt_stack_initiated)
- {
+ if (!bt_stack_initiated) {
D_WARN("bt_register_sdp : Bluetooth stack not initialized\n");
return -1;=09
}
@@ -2406,13 +2348,11 @@
/*-------------------------------------------------------------*/
/* Better not have any sdp data pending for this connection */
/*-------------------------------------------------------------*/
- if ( bt_ctrl.session[line].sdpRequestResponseData )
- {
+ if (bt_ctrl.session[line].sdpRequestResponseData) {
D_WARN("bt_register_sdp: Pending SDP data for this new connection @ =
line %d\n", line);
}
=20
- if ( SESSIONSTATE(line) =3D=3D BT_INACTIVE )
- {
+ if (SESSIONSTATE(line) =3D=3D BT_INACTIVE) {
/* now register ! */
DSYS("bt_register_sdp : line %d\n", line);
SESSIONSTATE(line) =3D BT_ACTIVE;
@@ -2441,11 +2381,9 @@
BT_DRIVER("Upper tty still open...\n");
SESSIONSTATE(line) =3D BT_UPPERCONNECTED;
NBR_ACTIVE--;
- }
- else if (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) {
+ } else if (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) {
bt_reset_session(line);
- }
- else {
+ } else {
D_WARN("bt_unregister_rfcomm : inactive session\n");
return -1;
}
@@ -2456,26 +2394,24 @@
{
BT_DRIVER("bt_unregister_sdp : line %d\n", line);=09
=20
- if (!bt_stack_initiated)
- {
+ if (!bt_stack_initiated) {
D_WARN("bt_unregister_sdp : Bluetooth stack not initialized\n");
return -1;=09
}
=20
- /*---------------------------------------------------------------------=
*/
- /* Part of unregistering SDP is to deallocate any sdp request response =
*/
- /* data AND clear length and pointer. =
*/=20
- /*---------------------------------------------------------------------=
*/
- if ( bt_ctrl.session[line].sdpRequestResponseData )
- {
- DSYS("bt_unregister_sdp: Free request data 0x%x\n", (unsigned int)bt=
_ctrl.session[line].sdpRequestResponseData);
+ /*-------------------------------------------------------------------*/
+ /* Part of unregistering SDP is to deallocate any sdp request */
+ /* response data AND clear length and pointer. */
+ /*-------------------------------------------------------------------*/
+ if (bt_ctrl.session[line].sdpRequestResponseData) {
+ DSYS("bt_unregister_sdp: Free request data 0x%x\n",
+ (unsigned int)bt_ctrl.session[line].sdpRequestResponseData);
kfree(bt_ctrl.session[line].sdpRequestResponseData);
bt_ctrl.session[line].sdpRequestResponseData =3D NULL;
bt_ctrl.session[line].sdpRequestResponseDataLength =3D 0;
}
=20
- if (SESSIONSTATE(line) =3D=3D BT_ACTIVE)=20
- {
+ if (SESSIONSTATE(line) =3D=3D BT_ACTIVE) {
SESSIONSTATE(line) =3D BT_INACTIVE;
bt_ctrl.session[line].sdpID =3D -1;
}
@@ -2486,15 +2422,12 @@
s32
bt_register_tty(struct tty_struct *tty)
{
- s32 line;
-
- line =3D GET_TTYLINE(tty);
+ s32 line =3D GET_TTYLINE(tty);
=20=20
DSYS("Registering tty on line %d\n", line);
=20=09
/* Allow multiple open for ttyBTC */
if (line =3D=3D (BT_NBR_PORTS-1)) {
-
NBR_CTRL_FDS++;
=20=09=09
DSYS("Now %d open fd:s for ttyBTC\n",=20
@@ -2511,7 +2444,6 @@
=20
if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) ||
(SESSIONSTATE(line) =3D=3D BT_INACTIVE)) {
-=09=09
NBR_UPPER++;
bt_ctrl.session[line].upper_tty =3D tty;
tty->driver_data =3D &bt_ctrl.session[line];
@@ -2581,8 +2513,7 @@
=20
/* disconnect all active connections */
for (i =3D 0; i < BT_NBR_DATAPORTS;i++) {
-=09=09
- bt =3D &(bt_ctrl.session[i]);
+ bt =3D &bt_ctrl.session[i];
if ((bt->state =3D=3D BT_ACTIVE) ||=20
(bt->state =3D=3D BT_LOWERCONNECTED)) {
DSYS("Disconnecting dlci %d on line %d\n",=20
@@ -2593,7 +2524,6 @@
}
}
=20
-=09
rfcomm_close();
sdp_shutdown();
tcs_shutdown();
@@ -2611,7 +2541,6 @@
#endif
}
=20
-
static inline s32
bt_paranoia_check(struct tty_driver *bt_tty, kdev_t device, const u8 *rout=
ine)
{
@@ -2654,7 +2583,8 @@
start_wq_timer(struct timer_list *wq_timer,
u32 timeout, wait_queue_head_t *wq)
#else
-void start_wq_timer(struct timer_list *wq_timer,
+void
+start_wq_timer(struct timer_list *wq_timer,
u32 timeout, struct wait_queue **wq)
#endif /* LINUX_VERSION_CODE */
{
@@ -2684,7 +2614,7 @@
wake_up_interruptible(wq);
}
=20
-/************************ MODULE STUFF ***********************************=
*****/
+/************************ MODULE STUFF ***********************************=
***/
#ifdef MODULE
s32
init_module(void)
|