|
From: Peter K. <pk...@us...> - 2001-03-04 15:55:30
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
sdp.c 1.63 1.64=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Removed unnecessary kmalloc() and memcpy().
The diff of the modified file(s):
--- sdp.c 2001/03/04 13:04:35 1.63
+++ sdp.c 2001/03/04 15:56:54 1.64
@@ -85,12 +85,6 @@
#define D_MISC(fmt...)
#endif
=20
-#if SDP_DEBUG_MEM
-#define D_MEM(fmt...) printk(fmt)
-#else
-#define D_MEM(fmt...)
-#endif
-
#if SDP_DEBUG_PROC
#define D_PROC(fmt...) printk(fmt)
#else
@@ -630,7 +624,7 @@
/*---------------------------------------------------*/
l2cap_send_data(tx_buf, sdp_con_list[sdpIndex].l2cap);
DSYS(__FUNCTION__"Client finished sending data.\n");
- returnValue =3D 1;=20
+ returnValue =3D 0;=20
}
} else {
/*-----------------------------------------------------------*/
@@ -747,7 +741,6 @@
{
sdp_con *sdp;
data_struct *db_hdl;
- s32 tmp_len;
=20
D_REC(__FUNCTION__"\n");
=20
@@ -782,27 +775,20 @@
} else
#endif
{
- tmp_len =3D len + sizeof(data_struct);
-=09
- db_hdl =3D (data_struct*) kmalloc(tmp_len, GFP_ATOMIC);
- D_MEM("---> kmalloc %d bytes at 0x%08x\n", tmp_len, (s32) db_hdl);
+ db_hdl =3D (data_struct*)database_query.query;
=20
db_hdl->sdp_con_id =3D sdp->id;
db_hdl->len =3D len;
memcpy(db_hdl->data, data, len);
-
- database_query.count =3D tmp_len;
- memcpy(database_query.query, db_hdl, tmp_len);
=20
- D_MEM("<--- kfree 0x%08x\n", (s32) db_hdl);
- kfree(db_hdl);
+ database_query.count =3D sizeof(data_struct) + len;
=20
#ifdef __KERNEL__
D_PROC("wake_up process %i (%s) awakening\n", current->pid, current->com=
m);
wake_up_interruptible(&database_wq);
D_PROC("wake_up process %i (%s) woke up\n", current->pid, current->comm);
#else
- sdp_doquery(sdp_sock, (u8*) &database_query.query, tmp_len);
+ sdp_doquery(sdp_sock, database_query.query, database_query.count);
#endif
}
}
@@ -816,8 +802,8 @@
u32 sdp_frame_len;
u32 pdu_len;
=20
- /* Since we not send any error information the pdu length is just the
- size of the error code length, whoch is two bytes */
+ /* Since we do not send any error information the pdu length is just
+ the size of the error code length, which is two bytes */
pdu_len =3D 2;
sdp_frame_len =3D SDP_HDR_SIZE + pdu_len;
=20
@@ -864,8 +850,7 @@
char * buf, s32 count)
#endif
{
-=09
- s32 tmp;
+ s32 len;
=20=09
D_PROC(__FUNCTION__" Someone is trying to read %d bytes from sdp proc-fil=
e\n",
count);
@@ -876,18 +861,23 @@
}
sti();
=20
- tmp =3D MIN(count, database_query.count);
+ len =3D MIN(count, database_query.count);
=20
#ifdef __KERNEL__
- copy_to_user(buf, database_query.query, tmp);
+ copy_to_user(buf, database_query.query, len);
#else
- memcpy(buf, database_query.query, tmp);
+ memcpy(buf, database_query.query, len);
#endif
=20
- database_query.count -=3D tmp;
- D_PROC(__FUNCTION__"Returning %d bytes\n",tmp);
+ if (database_query.count > len) {
+ memmove(database_query.query,
+ database_query.query + len,
+ database_query.count - len);
+ }
+ database_query.count -=3D len;
+ D_PROC(__FUNCTION__ " Returning %d bytes\n", len);
=20
- return tmp;
+ return len;
}
=20
#ifdef USE_NEW_PROC
|