|
From: Peter K. <pk...@us...> - 2001-11-15 11:18:02
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.211 1.212=20=20=20=20=20=20=20=20=20=20=20
btdebug.c 1.22 1.23=20=20=20=20=20=20=20=20=20=20=20=20
btmem.c 1.44 1.45=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Renamed print_time() to bt_log_time().
The diff of the modified file(s):
--- bluetooth.c 2001/11/13 10:45:31 1.211
+++ bluetooth.c 2001/11/15 11:18:00 1.212
@@ -121,7 +121,7 @@
=20
#if BT_DATA_DEBUG
#if BT_USE_TIMESTAMPS
-#define BT_DATA(fmt...) do {print_time(1);printk(BT_DBG_STR"DATA " fmt);} =
while (0)
+#define BT_DATA(fmt...) do { printk(bt_log_time()); printk(BT_DBG_STR"DATA=
" fmt); } while (0)
#else
#define BT_DATA(fmt...) printk(BT_DBG_STR"DATA " fmt)
#endif
@@ -1284,7 +1284,7 @@
{
/* should simply discard data since ttySx only exists for internal use
*/
- BT_LDISC(__FUNCTION__ ": (%d) done!\n", count);
+ BT_LDISC(__FUNCTION__ ": (%lu) done!\n", (unsigned long)count);
=20=20=20
return tty->driver.write(tty, 1/*from user*/, data, count);
}
@@ -2605,8 +2605,8 @@
=20
init_failed_exit1:=20
hci_shutdown();
-init_failed_exit0:
#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP
+init_failed_exit0:
bcsp_shutdown();
#endif
btmem_shutdown();
--- btdebug.c 2001/06/06 14:57:19 1.22
+++ btdebug.c 2001/11/15 11:18:00 1.23
@@ -63,59 +63,42 @@
=20
/****************** FUNCTION DEFINITION SECTION **************************=
***/
=20
-#ifdef __KERNEL__
-
-static u8 buf[20];
-static struct timeval tv_old =3D {0, 0};
-
-u8* print_time(s32 use_stdout)
+u8*
+bt_log_time(void)
{
- s32 len, diff;
+#if defined(__KERNEL__) && defined(BT_USE_TIMESTAMPS)
+ s32 diff;
struct timeval tv;=20=20
+ static struct timeval tv_old =3D {0, 0};
+ static u8 buf[50];
=20
do_gettimeofday(&tv);
=20=09
- diff =3D ((tv.tv_sec - tv_old.tv_sec)*1000000 + tv.tv_usec) -=20
- tv_old.tv_usec;
+ /* Set tv_old on first call of this function */
+ if (!tv_old.tv_sec && !tv_old.tv_usec)
+ tv_old =3D tv;
=20=09
- if (use_stdout =3D=3D 1) {
- printk("[%03d,%06d<%06d>] ",=20
- (int)tv.tv_sec, (int)tv.tv_usec, diff);
- }
- else
- {
- len =3D sprintf(buf, "[%03d,%06d<%06d>] ",=20
- (int)tv.tv_sec, tv.tv_usec, diff);
- buf[len] =3D 0;
- }
+ diff =3D (tv.tv_sec - tv_old.tv_sec)*1000000 +
+ tv.tv_usec - tv_old.tv_usec;
+
+ sprintf(buf, "[%03ld.%06ld <%03d.%06d>] ", tv.tv_sec, tv.tv_usec, diff / =
1000000, diff % 1000000);
tv_old =3D tv;
- return buf;
-}
=20
+ return buf;
#else
-
-/* No timestamps in usermode yet */
-char* print_time(int use_stdout)
-{
- printf("No timestamps in usermode stack yet\n");
- return "No timestamps in usermode stack yet\n";
-}
+ return "";
#endif
+}
=20
void=20
print_data(const u8 *message, u8 *buf, s32 len)
{=20
s32 t =3D 0;
=20
-#if BT_USE_TIMESTAMPS
- if (message)
- printk("\n%s %s (%d):\n", print_time(0), message, len);
-#else
if (message)
- printk("\n%s (%d):\n", message, len);
-#endif
- while (t < len)
- {
+ printk("\n%s%s (%d):\n", bt_log_time(), message, len);
+
+ while (t < len) {
printk("0x%02x ", buf[t++]);
if (!(t % 16))
printk("\n");
@@ -124,7 +107,8 @@
printk("\n");
}
=20
-const char* bd2str(const unsigned char *bd)
+const char*
+bd2str(const unsigned char *bd)
{
static char buf[20];
=20
--- btmem.c 2001/10/22 13:25:54 1.44
+++ btmem.c 2001/11/15 11:18:00 1.45
@@ -562,11 +562,11 @@
/* Graphical view of buffer size */
void btmem_show_size(s32 count)
{
- u32 i;
- i =3D ((count*BUFFERMETERRESOLUTION)/BT_BUF_SIZE);
+ u32 i =3D ((count*BUFFERMETERRESOLUTION)/BT_BUF_SIZE);
+
memset(buffermeter, '|', i);
buffermeter[i+1] =3D 0; /* null terminate */=20
- printk("%s [%s - %d bytes]\n", buffermeter, print_time(0), count);
+ printk("%s%s [%d bytes]\n", bt_log_time(), buffermeter, count);
}
=20
void show_bt_buf(bt_tx_buf *tx, s32 no_data)
|