|
From: Peter K. <pk...@us...> - 2001-03-23 13:12:47
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
btmem.c 1.37 1.38=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Allow unsubscribe_bt_buf() to be called with NULL as argument.
The diff of the modified file(s):
--- btmem.c 2001/03/02 21:52:15 1.37
+++ btmem.c 2001/03/23 13:12:45 1.38
@@ -239,12 +239,10 @@
get_bt_buf();
=20
if (bt_buf.free > bt_buf.send) {
-=20=20=20=20
tail_free =3D (bt_buf.tail - bt_buf.free);
head_free =3D (bt_buf.send - bt_buf.head);
=20
if (tail_free >=3D buf_len) {
-
D_MEM(FNC"subscribe in tail at pos %d\n",=20
bt_buf.free - bt_buf.head);
tx =3D (bt_tx_buf *)bt_buf.free;
@@ -253,7 +251,6 @@
bt_buf.count +=3D buf_len;
bt_buf.nbr_bufs++;
} else if (head_free >=3D buf_len) {=20=20
-
D_MEM("No room in tail, subscribe at head (WRAP!)\n");
tx =3D (bt_tx_buf *)bt_buf.head;
=20=09=09=09
@@ -264,7 +261,6 @@
bt_buf.nbr_bufs++;
bt_buf.count +=3D buf_len;
} else {
-
D_ERR(FNC"Cannot subscribe %d bytes !\n", send_len);
D_ERR(FNC"Only %d available (non - fragmented)\n",
buf_write_room());
@@ -277,7 +273,6 @@
return NULL;
}
} else if (bt_buf.free <=3D bt_buf.send) {
-=20=20=20=20
/* 'Wrap' case */
tail_free =3D (bt_buf.send - bt_buf.free);
head_free =3D 0; /* head_free is not interesting since we cannot=20
@@ -286,7 +281,6 @@
buffer! (Fragmentation) */
=20=20=20=20=20
if (tail_free >=3D buf_len) {
-
D_MEM("Wrapped buffer, subscribe at free (pos %d)\n",=20
bt_buf.free - bt_buf.head);
tx =3D (bt_tx_buf *)bt_buf.free;
@@ -294,7 +288,6 @@
bt_buf.count +=3D buf_len;
bt_buf.nbr_bufs++;
} else if (!bt_buf.count) {
-
/* If buffer empty, reset buffer */=20=20=20=20=20=20=20=20=20=20
btmem_reset();
=20=09=09=09
@@ -343,7 +336,6 @@
return bt_buf.nbr_bufs;
}
=20
-
/* Returns total number of bytes in buffer (fragmented) */
=20
s32 buf_byte_count()
@@ -351,7 +343,6 @@
return bt_buf.count;
}
=20
-
/* Returns unfragmented buffer space */=20
=20
#define BTMEM_EXTRASPACE BT_BUF_SIZE/10 /* always an extra 10 % marginal
@@ -412,8 +403,7 @@
=20
tx =3D (bt_tx_buf *)(bt_buf.send);
=20
- if (tx->magic !=3D 0x4321)
- {
+ if (tx->magic !=3D 0x4321) {
D_ERR("get_bt_buf : wrong magic!\n");
#if PANIC_AT_ERROR
panic("lets stop here...\n");
@@ -446,6 +436,9 @@
s32 tail_free; /* for debug */
s32 head_free;
=20=20=20
+ if (!tx)
+ return;
+
D_MEM(FNC"%d bytes (not incl hdrs) at pos %d\n",=20
tx->subscr_len, (u8 *)tx - bt_buf.head);
=20=20=20
@@ -453,10 +446,8 @@
buffers in fifo order ! */
=20
cli();
- if (tx && (bt_buf.send =3D=3D (u8*)tx)) {
-
+ if (bt_buf.send =3D=3D (u8*)tx) {
if ((u8*)(tx->data + tx->subscr_len) <=3D bt_buf.tail) {
-=20=20=20=20=20=20
/* don't touch free, only subscribe_bt_buf change free */
bt_buf.send +=3D (tx->subscr_len + BT_TX_HDRSIZE);
bt_buf.count -=3D (tx->subscr_len + BT_TX_HDRSIZE);
@@ -603,13 +594,11 @@
bt_tx_buf *tx;
=20=20=20=20
for (i =3D 0; i < count; i++) {
-
if (cursize > buf_write_room())
return;
=20=09=20=20=20=20=20
printk("storing %d bytes packets\n", cursize);
while (buf_write_room() >=3D cursize) {
-=09=20=20=20=20=20=20=20
if (!(tx =3D subscribe_bt_buf(cursize))) {
return ;
}
|
|
From: Peter K. <pk...@us...> - 2001-03-23 13:21:59
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
btmem.c 1.38 1.39=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Replaced FNC with __FUNCTION__.
The diff of the modified file(s):
--- btmem.c 2001/03/23 13:12:45 1.38
+++ btmem.c 2001/03/23 13:21:57 1.39
@@ -214,7 +214,6 @@
=20
bt_tx_buf* subscribe_bt_buf(s32 send_len)
{
-#define FNC "subscribe_bt_buf : "
bt_tx_buf *tx;
s32 buf_len; /* Total size of bt_tx_object */
u32 head_free;
@@ -222,7 +221,7 @@
=20
cli();
buf_len =3D send_len + BT_TX_HDRSIZE;=20=20
- D_MEM(FNC"buf_len %d\n", buf_len);
+ D_MEM(__FUNCTION__ ": buf_len %d\n", buf_len);
=20
/*=20=20
'Normal' case
@@ -243,7 +242,7 @@
head_free =3D (bt_buf.send - bt_buf.head);
=20
if (tail_free >=3D buf_len) {
- D_MEM(FNC"subscribe in tail at pos %d\n",=20
+ D_MEM(__FUNCTION__ ": subscribe in tail at pos %d\n",=20
bt_buf.free - bt_buf.head);
tx =3D (bt_tx_buf *)bt_buf.free;
/* Don't touch send, only update free and count */
@@ -261,8 +260,8 @@
bt_buf.nbr_bufs++;
bt_buf.count +=3D buf_len;
} else {
- D_ERR(FNC"Cannot subscribe %d bytes !\n", send_len);
- D_ERR(FNC"Only %d available (non - fragmented)\n",
+ D_ERR(__FUNCTION__ ": Cannot subscribe %d bytes !\n", send_len);
+ D_ERR(__FUNCTION__ ": Only %d available (non - fragmented)\n",
buf_write_room());
=20
#if PANIC_AT_ERROR
@@ -292,8 +291,8 @@
btmem_reset();
=20=09=09=09
if (buf_len > bt_buf.size) {
- D_ERR(FNC"Cannot subscribe %d bytes !\n", send_len);=20
- D_ERR(FNC"Only %d available (non - fragmented)\n",
+ D_ERR(__FUNCTION__ ": Cannot subscribe %d bytes !\n", send_len);=20
+ D_ERR(__FUNCTION__ ": Only %d available (non - fragmented)\n",
buf_write_room());
btmem_get_status(NULL);
sti();
@@ -307,9 +306,9 @@
bt_buf.count +=3D buf_len;
bt_buf.nbr_bufs++;
} else {
- D_ERR(FNC"Cannot subscribe requested size (%d) !\n",=20
+ D_ERR(__FUNCTION__ ": Cannot subscribe requested size (%d) !\n",=20
send_len);
- D_ERR(FNC"Only %d available (non - fragmented)\n",
+ D_ERR(__FUNCTION__ ": Only %d available (non - fragmented)\n",
buf_write_room());
btmem_get_status(NULL);
#if PANIC_AT_ERROR
@@ -326,7 +325,6 @@
=20
sti();
return tx;
-#undef FNC
}
=20
/* Returns number of buffers */
@@ -366,7 +364,6 @@
don't count a tossed tail ! */
space_left =3D (BT_BUF_SIZE -=20
(bt_buf.tail - bt_buf.toss_tail) - bt_buf.count);
-=20=20
}
=20
space_left -=3D (BT_TX_HDRSIZE+BTMEM_EXTRASPACE);
@@ -432,14 +429,13 @@
=20
void unsubscribe_bt_buf(bt_tx_buf *tx)
{
-#define FNC "unsubscribe_bt_buf : "
s32 tail_free; /* for debug */
s32 head_free;
=20
if (!tx)
return;
=20
- D_MEM(FNC"%d bytes (not incl hdrs) at pos %d\n",=20
+ D_MEM(__FUNCTION__ ": %d bytes (not incl hdrs) at pos %d\n",=20
tx->subscr_len, (u8 *)tx - bt_buf.head);
=20=20=20
/* Check that tx is valid for unssubscribe. We must process the=20
@@ -453,12 +449,12 @@
bt_buf.count -=3D (tx->subscr_len + BT_TX_HDRSIZE);
bt_buf.nbr_bufs--;=20=20=20=20=20=20
} else {
- D_ERR(FNC"failed, out of boundary\n");
+ D_ERR(__FUNCTION__ ": failed, out of boundary\n");
}
} else if (bt_buf.count =3D=3D 0)
- D_MEM(FNC"no data in buffer\n");
+ D_MEM(__FUNCTION__ ": no data in buffer\n");
else {
- D_ERR(FNC"invalid data segment!\n");
+ D_ERR(__FUNCTION__ ": invalid data segment!\n");
#ifdef __KERNEL__
=20
D_ERR("pid : %d (tx:0x%x - send:0x%x=3D%d) send:%ld free:%ld\n",
@@ -486,7 +482,7 @@
=20
/* Is also checked done in get_bt_buf */
if (bt_buf.send =3D=3D bt_buf.toss_tail) {
- D_MEM(FNC"toss_tail, now send pos is 0\n");
+ D_MEM(__FUNCTION__ ": toss_tail, now send pos is 0\n");
bt_buf.send =3D bt_buf.head;
bt_buf.toss_tail =3D bt_buf.tail;
=20
|
|
From: Mattias A. <mat...@us...> - 2001-03-30 11:04:31
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
btmem.c 1.39 1.40=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
set buffer head to NULL after deallocating memory
added timestamp in 'buffer meter'
The diff of the modified file(s):
--- btmem.c 2001/03/23 13:21:57 1.39
+++ btmem.c 2001/03/30 11:04:27 1.40
@@ -134,6 +134,7 @@
/* FIXME - Check that the stack is not in use */
/* Deallocate memory area */
kfree(bt_buf.head);
+ bt_buf.head =3D NULL;
}
=20
/* Is run whenever buffer is empty */
@@ -516,7 +517,7 @@
i =3D ((count*BUFFERMETERRESOLUTION)/BT_BUF_SIZE);
memset(buffermeter, '|', i);
buffermeter[i+1] =3D 0; /* null terminate */=20
- printk("%s (%d)\n", buffermeter, count);
+ printk("%s [%s - %d bytes]\n", buffermeter, print_time(0), count);
}
=20
void show_bt_buf(bt_tx_buf *tx, s32 no_data)
|
|
From: Mattias A. <mat...@us...> - 2001-04-25 16:49:25
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
btmem.c 1.40 1.41=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* added call to get_bt_buf in btmem_flushhandle which removes all buffers=
=20
located in queue head
The diff of the modified file(s):
--- btmem.c 2001/03/30 11:04:27 1.40
+++ btmem.c 2001/04/25 16:49:24 1.41
@@ -208,6 +208,9 @@
D_MEM("btmem_flushhandle : flushed %d buffers\n", i);
=20
sti();
+ /* get_bt_buf removes flushed buffers if located in=20
+ queue head */
+ get_bt_buf();
}
=20
=20
@@ -412,7 +415,8 @@
/* Check if chunk is valid */
if (tx->flushed) {
/* This buffer is flushed */
- DSYS("get_bt_buf : Flushing this buffer\n");
+ DSYS("get_bt_buf : Flushing this buffer [handle %d]\n",
+ tx->hci_hdl);
#if BTMEM_FLUSH_ENABLED
unsubscribe_bt_buf(tx);
return get_bt_buf(); /* Yeehaa, more recursion :) */
|
|
From: Mattias A. <mat...@us...> - 2001-06-06 14:57:44
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
btmem.c 1.41 1.42=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added default values of bt_buf struct
The diff of the modified file(s):
--- btmem.c 2001/04/25 16:49:24 1.41
+++ btmem.c 2001/06/06 14:57:44 1.42
@@ -102,7 +102,7 @@
=20
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
=20
-static bt_buf_main bt_buf;
+static bt_buf_main bt_buf =3D {NULL, NULL, NULL, NULL, NULL, 0, 0, 0};
=20
/****************** FUNCTION DEFINITION SECTION **************************=
***/
=20
@@ -133,6 +133,7 @@
DSYS("Shutting down BTMEM\n");
/* FIXME - Check that the stack is not in use */
/* Deallocate memory area */
+ if (bt_buf.head)
kfree(bt_buf.head);
bt_buf.head =3D NULL;
}
|
|
From: Anders J. <and...@us...> - 2002-01-24 12:42:34
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
btmem.c 1.45 1.46=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Check if allocation suceeded before trying to use it :).
The diff of the modified file(s):
--- btmem.c 2001/11/15 11:18:00 1.45
+++ btmem.c 2002/01/24 12:42:33 1.46
@@ -106,12 +106,17 @@
=20
/****************** FUNCTION DEFINITION SECTION **************************=
***/
=20
-void btmem_init(void)
+s32
+btmem_init(void)
{
/* Allocate memory area */
DSYS("Initialising BTMEM [%d bytes]\n", BT_BUF_SIZE);
=20
- bt_buf.head =3D (u8*) kmalloc(BT_BUF_SIZE,GFP_KERNEL);
+ if(!(bt_buf.head =3D (u8*) kmalloc(BT_BUF_SIZE,GFP_KERNEL))) {
+ D_ERR("Can't allocate BT memory buffers");
+ return -1;
+ }
+=09
=20=20=20
/* Initiate main buffer object */
bt_buf.tail =3D bt_buf.head + BT_BUF_SIZE;
|
|
From: Willy S. <sag...@us...> - 2002-04-11 10:30:45
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- btmem.c 1.48 1.49=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added linux version ifdef for malloc.h/slab.h The diff of the modified file(s): --- btmem.c 6 Feb 2002 11:23:15 -0000 1.48 +++ btmem.c 11 Apr 2002 10:15:01 -0000 1.49 @@ -44,7 +44,11 @@ #define __NO_VERSION__ /* don't define kernel_version in module.h */ =20 #ifdef __KERNEL__ +#if LINUX_VERSION_CODE >=3D 0x20200 +#include <linux/slab.h> +#else #include <linux/malloc.h> +#endif #include <linux/bluetooth/btmem.h> #else #include <stdlib.h> |
|
From: Alain P. <apa...@us...> - 2002-04-25 15:09:48
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- btmem.c 1.49 1.50=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added an include mandatory to compile on our platform. The diff of the modified file(s): --- btmem.c 11 Apr 2002 10:15:01 -0000 1.49 +++ btmem.c 25 Apr 2002 15:09:17 -0000 1.50 @@ -55,6 +55,7 @@ #include "include/btmem.h" #include "include/btcommon.h" #include <string.h> /* memset */ +#include <errno.h> #endif =20 /****************** DEBUG CONSTANT AND MACRO SECTION *********************= ***/ |