convert device printf() usages to aprint_xxxx()

This commit is contained in:
plunky 2007-11-11 12:59:02 +00:00
parent 8658057a5d
commit 7cca9485cc
7 changed files with 146 additions and 143 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bcsp.c,v 1.7 2007/11/11 12:54:23 plunky Exp $ */
/* $NetBSD: bcsp.c,v 1.8 2007/11/11 12:59:06 plunky Exp $ */
/*
* Copyright (c) 2007 KIYOHARA Takashi
* All rights reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.7 2007/11/11 12:54:23 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.8 2007/11/11 12:59:06 plunky Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -317,7 +317,7 @@ bcsp_attach(struct device *parent __unused, struct device *self,
return;
err:
printf("%s: sysctl_createv failed (rc = %d)\n", __func__, rc);
aprint_error_dev(self, "sysctl_createv failed (rc = %d)\n", rc);
}
/*
@ -379,7 +379,7 @@ bcspopen(dev_t device __unused, struct tty *tp)
cfdata->cf_unit = unit;
cfdata->cf_fstate = FSTATE_STAR;
printf("%s%d at tty major %d minor %d",
aprint_normal("%s%d at tty major %d minor %d",
name, unit, major(tp->t_dev), minor(tp->t_dev));
sc = (struct bcsp_softc *)config_attach_pseudo(cfdata);
if (sc == NULL) {
@ -593,8 +593,8 @@ bcsp_slip_receive(int c, struct tty *tp)
/* extend mbuf */
MGET(m->m_next, M_DONTWAIT, MT_DATA);
if (m->m_next == NULL) {
printf("%s: out of memory\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"out of memory\n");
++sc->sc_unit.hci_stats.err_rx;
return 0; /* (lost sync) */
}
@ -620,8 +620,8 @@ bcsp_slip_receive(int c, struct tty *tp)
/* new packet */
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
printf("%s: out of memory\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"out of memory\n");
++sc->sc_unit.hci_stats.err_rx;
return 0; /* (lost sync) */
}
@ -907,7 +907,7 @@ bcsp_mux_transmit(struct bcsp_softc *sc)
m = bcsp_create_ackpkt();
if (m != NULL)
goto transmit;
printf("%s: out of memory\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "out of memory\n");
++unit->hci_stats.err_tx;
}
@ -1068,9 +1068,9 @@ bcsp_sequencing_receive(struct bcsp_softc *sc, struct mbuf *m)
case BCSP_CHANNEL_DFU:
case BCSP_CHANNEL_VM:
default:
printf("%s:"
" received reliable packet with not support channel %d\n",
device_xname(sc->sc_dev), hdr.ident);
aprint_error_dev(sc->sc_dev,
"received reliable packet with not support channel %d\n",
hdr.ident);
m_freem(m);
break;
}
@ -1108,7 +1108,7 @@ bcsp_tx_reliable_pkt(struct bcsp_softc *sc, struct mbuf *m, u_int protocol_id)
M_PREPEND(m, sizeof(bcsp_hdr_t), M_DONTWAIT);
if (m == NULL) {
printf("%s: out of memory\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "out of memory\n");
return false;
}
KASSERT(m->m_len >= sizeof(bcsp_hdr_t));
@ -1134,7 +1134,7 @@ bcsp_tx_reliable_pkt(struct bcsp_softc *sc, struct mbuf *m, u_int protocol_id)
sc->sc_seq_winspace--;
_m = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
if (_m == NULL) {
printf("%s: out of memory\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "out of memory\n");
return false;
}
MBUFQ_ENQUEUE(&sc->sc_seq_retryq, _m);
@ -1227,7 +1227,7 @@ bcsp_timer_timeout(void *arg)
m = MBUFQ_NEXT(m)) {
_m = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
if (_m == NULL) {
printf("%s: out of memory\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "out of memory\n");
return;
}
MBUFQ_ENQUEUE(&sc->sc_seqq, _m);
@ -1239,9 +1239,9 @@ bcsp_timer_timeout(void *arg)
if (++sc->sc_seq_retries < sc->sc_seq_retry_limit)
callout_schedule(&sc->sc_seq_timer, sc->sc_seq_timeout);
else {
printf("%s: reached the retry limit."
" restart the link-establishment\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"reached the retry limit."
" restart the link-establishment\n");
bcsp_sequencing_reset(sc);
bcsp_start_le(&sc->sc_unit);
return;
@ -1308,9 +1308,9 @@ bcsp_datagramq_receive(struct bcsp_softc *sc, struct mbuf *m)
break;
default:
printf("%s:"
" received unreliable packet with not support channel %d\n",
device_xname(sc->sc_dev), hdr.ident);
aprint_error_dev(sc->sc_dev,
"received unreliable packet with not support channel %d\n",
hdr.ident);
m_freem(m);
break;
}
@ -1340,7 +1340,7 @@ bcsp_tx_unreliable_pkt(struct bcsp_softc *sc, struct mbuf *m, u_int protocol_id)
M_PREPEND(m, sizeof(bcsp_hdr_t), M_DONTWAIT);
if (m == NULL) {
printf("%s: out of memory\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "out of memory\n");
return false;
}
KASSERT(m->m_len >= sizeof(bcsp_hdr_t));
@ -1408,8 +1408,8 @@ bcsp_start_le(struct hci_unit *unit)
m->m_pkthdr.len = m->m_len = 0;
m_copyback(m, 0, sizeof(sync), sync);
if (!bcsp_tx_unreliable_pkt(sc, m, BCSP_CHANNEL_LE)) {
printf("%s: le-packet transmit failed\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"le-packet transmit failed\n");
return EINVAL;
}
}
@ -1430,14 +1430,14 @@ bcsp_terminate_le(struct hci_unit *unit)
bcsp_set_choke(sc, true);
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
printf("%s: out of memory\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "out of memory\n");
else {
/* length of le packets is 4 */
m->m_pkthdr.len = m->m_len = 0;
m_copyback(m, 0, sizeof(sync), sync);
if (!bcsp_tx_unreliable_pkt(sc, m, BCSP_CHANNEL_LE))
printf("%s: link-establishment terminations failed\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"link-establishment terminations failed\n");
}
}
@ -1475,7 +1475,7 @@ bcsp_input_le(struct hci_unit *unit, struct mbuf *m)
if (*(const uint32_t *)pkt[i].datap == *rcvpkt)
break;
if (m->m_len != sizeof(uint32_t) || pkt[i].type == NULL) {
printf("%s: received unknown packet\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "received unknown packet\n");
m_freem(m);
return;
}
@ -1495,8 +1495,8 @@ bcsp_input_le(struct hci_unit *unit, struct mbuf *m)
BCSP_LE_TCONF_TIMEOUT);
sc->sc_le_state = le_state_curious;
} else
printf("%s: received an unknown packet at shy\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"received an unknown packet at shy\n");
break;
case le_state_curious:
@ -1512,8 +1512,8 @@ bcsp_input_le(struct hci_unit *unit, struct mbuf *m)
callout_stop(&sc->sc_le_timer);
sc->sc_le_state = le_state_garrulous;
} else
printf("%s: received unknown packet at curious\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"received unknown packet at curious\n");
break;
case le_state_garrulous:
@ -1521,15 +1521,15 @@ bcsp_input_le(struct hci_unit *unit, struct mbuf *m)
rplypkt = confresp;
else if (*rcvpkt == *(const uint32_t *)sync) {
/* XXXXX */
printf("%s: received sync!! peer to reset?\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"received sync! peer to reset?\n");
bcsp_sequencing_reset(sc);
rplypkt = sync;
sc->sc_le_state = le_state_shy;
} else
printf("%s: received unknown packet at garrulous\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"received unknown packet at garrulous\n");
break;
}
@ -1538,14 +1538,14 @@ bcsp_input_le(struct hci_unit *unit, struct mbuf *m)
if (rplypkt != NULL) {
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
printf("%s: out of memory\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "out of memory\n");
else {
/* length of le packets is 4 */
m->m_pkthdr.len = m->m_len = 0;
m_copyback(m, 0, 4, rplypkt);
if (!bcsp_tx_unreliable_pkt(sc, m, BCSP_CHANNEL_LE))
printf("%s: le-packet transmit failed\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"le-packet transmit failed\n");
}
}
}
@ -1574,22 +1574,22 @@ bcsp_le_timeout(void *arg)
break;
default:
printf("%s: timeout happen at unknown state %d\n",
device_xname(sc->sc_dev), sc->sc_le_state);
aprint_error_dev(sc->sc_dev,
"timeout happen at unknown state %d\n", sc->sc_le_state);
return;
}
if (sndpkt != NULL) {
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
printf("%s: out of memory\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "out of memory\n");
else {
/* length of le packets is 4 */
m->m_pkthdr.len = m->m_len = 0;
m_copyback(m, 0, 4, sndpkt);
if (!bcsp_tx_unreliable_pkt(sc, m, BCSP_CHANNEL_LE))
printf("%s: le-packet transmit failed\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"le-packet transmit failed\n");
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: bthidev.c,v 1.11 2007/11/03 18:24:01 plunky Exp $ */
/* $NetBSD: bthidev.c,v 1.12 2007/11/11 12:59:04 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.11 2007/11/03 18:24:01 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.12 2007/11/11 12:59:04 plunky Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -69,7 +69,7 @@ struct bthidev_softc {
struct btdev sc_btdev;
uint16_t sc_state;
uint16_t sc_flags;
const char *sc_name; /* our device_xname */
device_t sc_dev;
bdaddr_t sc_laddr; /* local address */
bdaddr_t sc_raddr; /* remote address */
@ -186,6 +186,7 @@ bthidev_attach(device_t parent, device_t self, void *aux)
/*
* Init softc
*/
sc->sc_dev = self;
LIST_INIT(&sc->sc_list);
callout_init(&sc->sc_reconnect, 0);
callout_setfunc(&sc->sc_reconnect, bthidev_timeout, sc);
@ -193,7 +194,6 @@ bthidev_attach(device_t parent, device_t self, void *aux)
sc->sc_flags = BTHID_CONNECTING;
sc->sc_ctlpsm = L2CAP_PSM_HID_CNTL;
sc->sc_intpsm = L2CAP_PSM_HID_INTR;
sc->sc_name = device_xname(self);
/*
* extract config from proplist
@ -509,7 +509,7 @@ bthidev_connect(struct bthidev_softc *sc)
int err;
if (sc->sc_attempts++ > 0)
printf("%s: connect (#%d)\n", sc->sc_name, sc->sc_attempts);
aprint_verbose_dev(sc->sc_dev, "connect (#%d)\n", sc->sc_attempts);
memset(&sa, 0, sizeof(sa));
sa.bt_len = sizeof(sa);
@ -517,7 +517,7 @@ bthidev_connect(struct bthidev_softc *sc)
err = l2cap_attach(&sc->sc_ctl, &bthidev_ctl_proto, sc);
if (err) {
printf("%s: l2cap_attach failed (%d)\n", sc->sc_name, err);
aprint_error_dev(sc->sc_dev, "l2cap_attach failed (%d)\n", err);
return err;
}
@ -528,7 +528,7 @@ bthidev_connect(struct bthidev_softc *sc)
bdaddr_copy(&sa.bt_bdaddr, &sc->sc_laddr);
err = l2cap_bind(sc->sc_ctl, &sa);
if (err) {
printf("%s: l2cap_bind failed (%d)\n", sc->sc_name, err);
aprint_error_dev(sc->sc_dev, "l2cap_bind failed (%d)\n", err);
return err;
}
@ -536,7 +536,7 @@ bthidev_connect(struct bthidev_softc *sc)
bdaddr_copy(&sa.bt_bdaddr, &sc->sc_raddr);
err = l2cap_connect(sc->sc_ctl, &sa);
if (err) {
printf("%s: l2cap_connect failed (%d)\n", sc->sc_name, err);
aprint_error_dev(sc->sc_dev, "l2cap_connect failed (%d)\n", err);
return err;
}
@ -605,7 +605,7 @@ fail:
l2cap_detach(&sc->sc_ctl);
sc->sc_ctl = NULL;
printf("%s: connect failed (%d)\n", sc->sc_name, err);
aprint_error_dev(sc->sc_dev, "connect failed (%d)\n", err);
}
static void
@ -623,7 +623,7 @@ bthidev_int_connected(void *arg)
sc->sc_flags &= ~BTHID_CONNECTING;
sc->sc_state = BTHID_OPEN;
printf("%s: connected\n", sc->sc_name);
aprint_verbose_dev(sc->sc_dev, "connected\n");
}
/*
@ -646,7 +646,7 @@ bthidev_ctl_disconnected(void *arg, int err)
sc->sc_state = BTHID_CLOSED;
if (sc->sc_int == NULL) {
printf("%s: disconnected\n", sc->sc_name);
aprint_verbose_dev(sc->sc_dev, "disconnected\n");
sc->sc_flags &= ~BTHID_CONNECTING;
if (sc->sc_flags & BTHID_RECONNECT)
@ -678,7 +678,7 @@ bthidev_int_disconnected(void *arg, int err)
sc->sc_state = BTHID_CLOSED;
if (sc->sc_ctl == NULL) {
printf("%s: disconnected\n", sc->sc_name);
aprint_verbose_dev(sc->sc_dev, "disconnected\n");
sc->sc_flags &= ~BTHID_CONNECTING;
if (sc->sc_flags & BTHID_RECONNECT)
@ -749,11 +749,11 @@ bthidev_linkmode(void *arg, int new)
struct bthidev_softc *sc = arg;
if ((sc->sc_mode & L2CAP_LM_AUTH) && !(new & L2CAP_LM_AUTH))
printf("%s: auth failed\n", sc->sc_name);
aprint_error_dev(sc->sc_dev, "auth failed\n");
else if ((sc->sc_mode & L2CAP_LM_ENCRYPT) && !(new & L2CAP_LM_ENCRYPT))
printf("%s: encrypt off\n", sc->sc_name);
aprint_error_dev(sc->sc_dev, "encrypt off\n");
else if ((sc->sc_mode & L2CAP_LM_SECURE) && !(new & L2CAP_LM_SECURE))
printf("%s: insecure\n", sc->sc_name);
aprint_error_dev(sc->sc_dev, "insecure\n");
else
return;
@ -779,7 +779,7 @@ bthidev_input(void *arg, struct mbuf *m)
goto release;
if (m->m_pkthdr.len > m->m_len)
printf("%s: truncating HID report\n", sc->sc_name);
aprint_error_dev(sc->sc_dev, "truncating HID report\n");
len = m->m_len;
data = mtod(m, uint8_t *);
@ -811,8 +811,8 @@ bthidev_input(void *arg, struct mbuf *m)
goto release;
}
}
printf("%s: report id %d, len = %d ignored\n",
sc->sc_name, data[1], len - 2);
aprint_error_dev(sc->sc_dev, "report id %d, len = %d ignored\n",
data[1], len - 2);
goto release;
}
@ -822,7 +822,7 @@ bthidev_input(void *arg, struct mbuf *m)
goto release;
if (BTHID_DATA_PARAM(data[0]) == BTHID_CONTROL_UNPLUG) {
printf("%s: unplugged\n", sc->sc_name);
aprint_normal_dev(sc->sc_dev, "unplugged\n");
/* close interrupt channel */
if (sc->sc_int != NULL) {
@ -878,7 +878,8 @@ bthidev_output(struct bthidev *hidev, uint8_t *report, int rlen)
return 0;
if (rlen > MHLEN - 2) {
printf("%s: output report too long (%d)!\n", sc->sc_name, rlen);
aprint_error_dev(sc->sc_dev,
"output report too long (%d)!\n", rlen);
return EMSGSIZE;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: btsco.c,v 1.17 2007/11/07 00:23:18 ad Exp $ */
/* $NetBSD: btsco.c,v 1.18 2007/11/11 12:59:05 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.17 2007/11/07 00:23:18 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.18 2007/11/11 12:59:05 plunky Exp $");
#include <sys/param.h>
#include <sys/audioio.h>
@ -1044,7 +1044,7 @@ btsco_freem(void *hdl, void *addr, struct malloc_type *type)
tsleep(sc, PWAIT, "drain", 1);
if (sc->sc_tx_refcnt > 0) {
printf("%s: ring buffer unreleased!\n", sc->sc_name);
aprint_error("%s: ring buffer unreleased!\n", sc->sc_name);
return;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: btuart.c,v 1.12 2007/11/10 23:12:22 plunky Exp $ */
/* $NetBSD: btuart.c,v 1.13 2007/11/11 12:59:04 plunky Exp $ */
/*
* Copyright (c) 2006, 2007 KIYOHARA Takashi
* All rights reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.12 2007/11/10 23:12:22 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.13 2007/11/11 12:59:04 plunky Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -304,18 +304,18 @@ bth4_firmload(struct btuart_softc *sc, char *filename,
char *buf;
if ((error = firmware_open(cd->cd_name, filename, &fh)) != 0) {
printf("firmware_open failed\n");
aprint_error_dev(sc->sc_dev, "firmware_open failed\n");
return error;
}
size = firmware_get_size(fh);
if ((buf = firmware_malloc(size)) != NULL) {
printf("firmware_malloc failed\n");
aprint_error_dev(sc->sc_dev, "firmware_malloc failed\n");
firmware_close(fh);
return ENOMEM;
}
if ((error = firmware_read(fh, 0, buf, size)) != 0)
printf("firmware_read failed\n");
aprint_error_dev(sc->sc_dev, "firmware_read failed\n");
if (error == 0)
error = (*func_firmload)(sc, size, buf);
@ -390,8 +390,9 @@ init_ericsson(struct btuart_softc *sc)
error = bth4_waitresp(sc, &m, opcode);
if (m != NULL) {
if (error != 0) {
printf("%s: Ericsson_Set_UART_Baud_Rate failed:"
" Status 0x%02x\n", device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"EricssonSetUARTBaudRate failed: Status 0x%02x\n",
error);
error = EFAULT;
}
m_freem(m);
@ -541,8 +542,9 @@ init_csr(struct btuart_softc *sc)
* instance, it might be a different HCI_EVENT_VENDOR packet.
*/
if (error != 0) {
printf("%s: CSR set UART speed failed: Status 0x%02x\n",
device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"CSR set UART speed failed: Status 0x%02x\n",
error);
error = EFAULT;
}
m_freem(m);
@ -602,8 +604,9 @@ init_swave(struct btuart_softc *sc)
if (error != 0) {
if (m != NULL)
m_freem(m);
printf("%s: swave set baud rate command failed:"
" error 0x%02x\n", device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"swave set baud rate command failed: error 0x%02x\n",
error);
return error;
}
if (m != NULL) {
@ -713,9 +716,9 @@ firmload_stlc2500(struct btuart_softc *sc, int size, char *buf)
error = bth4_waitresp(sc, &m, opcode);
if (m != NULL) {
if (error != 0) {
printf("%s: stlc2500 firmware load failed:"
" Status 0x%02x\n",
device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"stlc2500 firmware load failed: Status 0x%02x\n",
error);
error = EFAULT;
break;
}
@ -757,8 +760,9 @@ init_stlc2500(struct btuart_softc *sc)
error = bth4_waitresp(sc, &m, opcode);
if (m != NULL) {
if (error != 0) {
printf("%s: HCI_Read_Local_Version_Information failed:"
" Status 0x%02x\n", device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"HCI_Read_Local_Version_Information failed:"
" Status 0x%02x\n", error);
error = EFAULT;
m_freem(m);
}
@ -788,9 +792,9 @@ init_stlc2500(struct btuart_softc *sc)
error = bth4_waitresp(sc, &m, opcode);
if (m != NULL) {
if (error != 0) {
printf("%s: HCI_Reset (%d) failed:"
" Status 0x%02x\n",
device_xname(sc->sc_dev), i, error);
aprint_error_dev(sc->sc_dev,
"HCI_Reset (%d) failed: Status 0x%02x\n",
i, error);
error = EFAULT;
m_freem(m);
}
@ -813,8 +817,8 @@ init_stlc2500(struct btuart_softc *sc)
error = bth4_waitresp(sc, &m, opcode);
if (m != NULL) {
if (error != 0) {
printf("%s: failed: opcode 0xfc0f Status 0x%02x\n",
device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"failed: opcode 0xfc0f Status 0x%02x\n", error);
error = EFAULT;
m_freem(m);
}
@ -826,7 +830,7 @@ init_stlc2500(struct btuart_softc *sc)
* We do not know the beginning point of this character string.
* Because it doesn't know the event of this packet.
*
* printf("%s: %s\n", device_xname(sc->sc_dev), ???);
* aprint_error_dev(sc->sc_dev, "%s\n", ???);
*/
p = mtod(m, hci_cmd_hdr_t *);
@ -853,8 +857,8 @@ init_stlc2500(struct btuart_softc *sc)
error = bth4_waitresp(sc, &m, opcode);
if (m != NULL) {
if (error != 0) {
printf("%s: failed: opcode 0xfc0f Status 0x%02x\n",
device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"failed: opcode 0xfc0f Status 0x%02x\n", error);
error = EFAULT;
m_freem(m);
}
@ -875,8 +879,8 @@ init_stlc2500(struct btuart_softc *sc)
error = bth4_waitresp(sc, &m, opcode);
if (m != NULL) {
if (error != 0) {
printf("%s: HCI_Reset failed: Status 0x%02x\n",
device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"HCI_Reset failed: Status 0x%02x\n", error);
error = EFAULT;
m_freem(m);
}
@ -931,8 +935,9 @@ init_bcm2035(struct btuart_softc *sc)
error = bth4_waitresp(sc, &m, opcode);
if (m != NULL) {
if (error != 0) {
printf("%s: bcm2035 set baud rate failed:"
" Status 0x%02x\n", device_xname(sc->sc_dev), error);
aprint_error_dev(sc->sc_dev,
"bcm2035 set baud rate failed: Status 0x%02x\n",
error);
error = EFAULT;
}
m_freem(m);
@ -1012,8 +1017,8 @@ bth4init_input(struct hci_unit *unit, struct mbuf *m)
pktstr != NULL) {
aprint_error_dev(unit->hci_dev, "%s:", __FUNCTION__);
for (i = 0; i < m->m_len; i++)
printf(" %02x", *(rptr + i));
printf("\n");
aprint_error(" %02x", *(rptr + i));
aprint_error("\n");
}
if (*rptr == HCI_EVENT_PKT)
@ -1067,7 +1072,7 @@ bth4open(dev_t device __unused, struct tty *tp)
cfdata->cf_unit = unit;
cfdata->cf_fstate = FSTATE_STAR;
printf("%s%d at tty major %d minor %d",
aprint_normal("%s%d at tty major %d minor %d",
name, unit, major(tp->t_dev), minor(tp->t_dev));
sc = (struct btuart_softc *)config_attach_pseudo(cfdata);
if (sc == NULL) {
@ -1106,7 +1111,7 @@ bth4close(struct tty *tp, int flag __unused)
sc->sc_input_event = bth4init_input;
splx(s);
if ((*sc->sc_bth4hci.init)(sc) != 0)
printf("%s: reset speed fail\n", device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "reset speed fail\n");
}
s = spltty();
@ -1190,8 +1195,8 @@ bth4input(int c, struct tty *tp)
/* new packet */
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
printf("%s: out of memory\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"out of memory\n");
++sc->sc_unit.hci_stats.err_rx;
return 0; /* (lost sync) */
}
@ -1206,8 +1211,8 @@ bth4input(int c, struct tty *tp)
/* extend mbuf */
MGET(m->m_next, M_DONTWAIT, MT_DATA);
if (m->m_next == NULL) {
printf("%s: out of memory\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"out of memory\n");
++sc->sc_unit.hci_stats.err_rx;
return 0; /* (lost sync) */
}
@ -1252,8 +1257,8 @@ bth4input(int c, struct tty *tp)
break;
default:
printf("%s: Unknown packet type=%#x!\n",
device_xname(sc->sc_dev), c);
aprint_error_dev(sc->sc_dev,
"Unknown packet type=%#x!\n", c);
sc->sc_unit.hci_stats.err_rx++;
m_freem(sc->sc_rxp);
sc->sc_rxp = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt3c.c,v 1.14 2007/11/10 23:12:22 plunky Exp $ */
/* $NetBSD: bt3c.c,v 1.15 2007/11/11 12:59:02 plunky Exp $ */
/*-
* Copyright (c) 2005 Iain D. Hibbert,
@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bt3c.c,v 1.14 2007/11/10 23:12:22 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: bt3c.c,v 1.15 2007/11/11 12:59:02 plunky Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -279,8 +279,8 @@ bt3c_receive(struct bt3c_softc *sc)
/* new packet */
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
printf("%s: out of memory\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"out of memory\n");
++sc->sc_unit.hci_stats.err_rx;
goto out; /* (lost sync) */
}
@ -295,8 +295,8 @@ bt3c_receive(struct bt3c_softc *sc)
/* extend mbuf */
MGET(m->m_next, M_DONTWAIT, MT_DATA);
if (m->m_next == NULL) {
printf("%s: out of memory\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"out of memory\n");
++sc->sc_unit.hci_stats.err_rx;
goto out; /* (lost sync) */
}
@ -344,8 +344,8 @@ bt3c_receive(struct bt3c_softc *sc)
break;
default:
printf("%s: Unknown packet type=%#x!\n",
device_xname(sc->sc_dev), b);
aprint_error_dev(sc->sc_dev,
"Unknown packet type=%#x!\n", b);
++sc->sc_unit.hci_stats.err_rx;
m_freem(sc->sc_rxp);
sc->sc_rxp = NULL;
@ -476,8 +476,7 @@ bt3c_intr(void *arg)
if (control & BT3C_IOR_CNTL_INTR) {
isr = bt3c_read(sc, BT3C_ISR);
if ((isr & 0xff) == 0x7f) {
printf("%s: bt3c_intr got strange ISR=%04x\n",
device_xname(sc->sc_dev), isr);
aprint_error_dev(sc->sc_dev, "strange ISR=%04x\n", isr);
} else if ((isr & 0xff) != 0xff) {
if (isr & BT3C_ISR_RXRDY)
@ -489,11 +488,11 @@ bt3c_intr(void *arg)
#ifdef DIAGNOSTIC
if (isr & BT3C_ISR_ANTENNA) {
if (bt3c_read(sc, BT3C_CSR) & BT3C_CSR_ANTENNA)
printf("%s: Antenna Out\n",
device_xname(sc->sc_dev));
aprint_verbose_dev(sc->sc_dev,
"Antenna Out\n");
else
printf("%s: Antenna In\n",
device_xname(sc->sc_dev));
aprint_verbose_dev(sc->sc_dev,
"Antenna In\n");
}
#endif
@ -563,16 +562,15 @@ bt3c_load_firmware(struct bt3c_softc *sc)
err = firmware_open(cf->cf_name,
BT3C_FIRMWARE_FILE, &fh);
if (err) {
printf("%s: Cannot open firmware %s/%s\n",
device_xname(sc->sc_dev), cf->cf_name, BT3C_FIRMWARE_FILE);
aprint_error_dev(sc->sc_dev, "Cannot open firmware %s/%s\n",
cf->cf_name, BT3C_FIRMWARE_FILE);
return err;
}
size = (size_t)firmware_get_size(fh);
#ifdef DIAGNOSTIC
if (size > 10 * 1024) { /* sanity check */
printf("%s: firmware file seems WAY too big!\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev, "insane firmware file size!\n");
firmware_close(fh);
return EFBIG;
}
@ -583,8 +581,7 @@ bt3c_load_firmware(struct bt3c_softc *sc)
err = firmware_read(fh, 0, buf, size);
if (err) {
printf("%s: Firmware read failed (%d)\n",
device_xname(sc->sc_dev), err);
aprint_error_dev(sc->sc_dev, "Firmware read failed (%d)\n", err);
goto out;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: btbc.c,v 1.8 2007/11/10 23:12:22 plunky Exp $ */
/* $NetBSD: btbc.c,v 1.9 2007/11/11 12:59:03 plunky Exp $ */
/*
* Copyright (c) 2007 KIYOHARA Takashi
* All rights reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: btbc.c,v 1.8 2007/11/10 23:12:22 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: btbc.c,v 1.9 2007/11/11 12:59:03 plunky Exp $");
#include <sys/param.h>
#include <sys/callout.h>
@ -153,8 +153,7 @@ btbc_attach(device_t parent, device_t self, void *aux)
if ((error = pcmcia_function_configure(pa->pf,
btbc_pcmcia_validate_config)) != 0) {
aprint_error("%s: configure failed, error=%d\n",
self->dv_xname, error);
aprint_error_dev(self, "configure failed, error=%d\n", error);
return;
}
@ -402,8 +401,8 @@ btbc_receive(struct btbc_softc *sc, uint32_t offset)
/* new packet */
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
printf("%s: out of memory\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"out of memory\n");
++sc->sc_unit.hci_stats.err_rx;
return; /* (lost sync) */
}
@ -418,8 +417,8 @@ btbc_receive(struct btbc_softc *sc, uint32_t offset)
/* extend mbuf */
MGET(m->m_next, M_DONTWAIT, MT_DATA);
if (m->m_next == NULL) {
printf("%s: out of memory\n",
device_xname(sc->sc_dev));
aprint_error_dev(sc->sc_dev,
"out of memory\n");
++sc->sc_unit.hci_stats.err_rx;
return; /* (lost sync) */
}
@ -471,8 +470,8 @@ btbc_receive(struct btbc_softc *sc, uint32_t offset)
break;
default:
printf("%s: Unknown packet type=%#x!\n",
device_xname(sc->sc_dev), buf[i]);
aprint_error_dev(sc->sc_dev,
"Unknown packet type=%#x!\n", buf[i]);
++sc->sc_unit.hci_stats.err_rx;
m_freem(sc->sc_rxp);
sc->sc_rxp = NULL;
@ -717,13 +716,14 @@ btbc_intr(void *arg)
}
if (isr & 0x40) { /* card eject ? */
printf("card eject?\n");
aprint_normal_dev(sc->sc_dev, "card eject?\n");
isr &= ~0x40;
bus_space_write_1(sc->sc_pcioh.iot, sc->sc_pcioh.ioh,
BLUECARD_INTERRUPT, 0x40);
}
if (isr != 0x00) {
printf("unknwon intrrupt: isr=0x%x\n", isr);
aprint_error_dev(sc->sc_dev,
"unknown interrupt: isr=0x%x\n", isr);
bus_space_write_1(sc->sc_pcioh.iot, sc->sc_pcioh.ioh,
BLUECARD_INTERRUPT, isr);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ubt.c,v 1.27 2007/11/10 23:12:22 plunky Exp $ */
/* $NetBSD: ubt.c,v 1.28 2007/11/11 12:59:06 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.27 2007/11/10 23:12:22 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.28 2007/11/11 12:59:06 plunky Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -614,7 +614,7 @@ ubt_set_isoc_config(struct ubt_softc *sc)
for (i = 0 ; i < count ; i++) {
ed = usbd_interface2endpoint_descriptor(sc->sc_iface1, i);
if (ed == NULL) {
printf("%s: could not read endpoint descriptor %d\n",
aprint_error("%s: could not read endpoint descriptor %d\n",
USBDEVNAME(sc->sc_dev), i);
return EIO;
@ -656,14 +656,14 @@ ubt_set_isoc_config(struct ubt_softc *sc)
#ifdef DIAGNOSTIC
if (rd_size > MLEN) {
printf("%s: rd_size=%d exceeds MLEN\n",
aprint_error("%s: rd_size=%d exceeds MLEN\n",
USBDEVNAME(sc->sc_dev), rd_size);
return EOVERFLOW;
}
if (wr_size > MLEN) {
printf("%s: wr_size=%d exceeds MLEN\n",
aprint_error("%s: wr_size=%d exceeds MLEN\n",
USBDEVNAME(sc->sc_dev), wr_size);
return EOVERFLOW;
@ -1572,7 +1572,7 @@ ubt_recv_sco_complete(usbd_xfer_handle xfer,
if (m == NULL) {
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
printf("%s: out of memory (xfer halted)\n",
aprint_error("%s: out of memory (xfer halted)\n",
USBDEVNAME(sc->sc_dev));
sc->sc_unit.hci_stats.err_rx++;