summaryrefslogtreecommitdiff
path: root/xpp/card_fxs.c
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/card_fxs.c')
-rw-r--r--xpp/card_fxs.c106
1 files changed, 51 insertions, 55 deletions
diff --git a/xpp/card_fxs.c b/xpp/card_fxs.c
index fbbcab4..67cff65 100644
--- a/xpp/card_fxs.c
+++ b/xpp/card_fxs.c
@@ -152,7 +152,7 @@ static int linefeed_control(xbus_t *xbus, xpd_t *xpd, lineno_t chan, enum fxs_st
struct FXS_priv_data *priv;
priv = xpd->priv;
- LINE_DBG(xpd, chan, "value=0x%02X\n", value);
+ LINE_DBG(SIGNAL, xpd, chan, "value=0x%02X\n", value);
priv->lasttxhook[chan] = value;
return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x40, value);
}
@@ -163,7 +163,7 @@ static int do_chan_power(xbus_t *xbus, xpd_t *xpd, lineno_t chan, bool on)
BUG_ON(!xbus);
BUG_ON(!xpd);
- LINE_DBG(xpd, chan, "%s\n", (on) ? "up" : "down");
+ LINE_DBG(SIGNAL, xpd, chan, "%s\n", (on) ? "up" : "down");
return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x42, value);
}
@@ -222,7 +222,7 @@ static int do_led(xpd_t *xpd, lineno_t chan, byte which, bool on)
BIT_CLR(priv->ledstate[which], chan);
}
}
- LINE_DBG(xpd, chan, "LED: which=%d -- %s\n", which, (on) ? "on" : "off");
+ LINE_DBG(LEDS, xpd, chan, "LED: which=%d -- %s\n", which, (on) ? "on" : "off");
value = BIT(2) | BIT(3);
value |= ((BIT(5) | BIT(6) | BIT(7)) & ~led_register_mask[which]);
if(on)
@@ -254,7 +254,7 @@ static void handle_fxs_leds(xpd_t *xpd)
mod_value = DEFAULT_LED_PERIOD; /* safety value */
// led state is toggled
if((timer_count % mod_value) == 0) {
- LINE_DBG(xpd, i, "ledstate=%s\n", (IS_SET(priv->ledstate[color], i))?"ON":"OFF");
+ LINE_DBG(LEDS, xpd, i, "ledstate=%s\n", (IS_SET(priv->ledstate[color], i))?"ON":"OFF");
if(!IS_SET(priv->ledstate[color], i)) {
do_led(xpd, i, color, 1);
} else {
@@ -290,7 +290,7 @@ static int metering_gen(xpd_t *xpd, lineno_t chan, bool on)
{
byte value = (on) ? 0x94 : 0x00;
- LINE_DBG(xpd, chan, "METERING Generate: %s\n", (on)?"ON":"OFF");
+ LINE_DBG(SIGNAL, xpd, chan, "METERING Generate: %s\n", (on)?"ON":"OFF");
return SLIC_DIRECT_REQUEST(xpd->xbus, xpd, chan, SLIC_WRITE, 0x23, value);
}
#endif
@@ -314,7 +314,7 @@ static xpd_t *FXS_card_new(xbus_t *xbus, int unit, int subunit, const xproto_tab
if(!xpd)
return NULL;
if(unit == 0) {
- XBUS_DBG(xbus, "First XPD detected. Initialize digital outputs/inputs\n");
+ XBUS_DBG(GENERAL, xbus, "First XPD detected. Initialize digital outputs/inputs\n");
xpd->digital_outputs = BITMASK(LINES_DIGI_OUT) << regular_channels;
xpd->digital_inputs = BITMASK(LINES_DIGI_INP) << (regular_channels + LINES_DIGI_OUT);
}
@@ -332,21 +332,21 @@ static void clean_proc(xbus_t *xbus, xpd_t *xpd)
priv = xpd->priv;
#ifdef CONFIG_PROC_FS
if(priv->regfile) {
- XPD_DBG(xpd, "Removing xpd SLIC file\n");
+ XPD_DBG(PROC, xpd, "Removing xpd SLIC file\n");
priv->regfile->data = NULL;
remove_proc_entry(PROC_REGISTER_FNAME, xpd->proc_xpd_dir);
priv->regfile = NULL;
}
#ifdef WITH_METERING
if(priv->meteringfile) {
- XPD_DBG(xpd, "Removing xpd metering tone file\n");
+ XPD_DBG(PROC, xpd, "Removing xpd metering tone file\n");
priv->meteringfile->data = NULL;
remove_proc_entry(PROC_METERING_FNAME, xpd->proc_xpd_dir);
priv->meteringfile = NULL;
}
#endif
if(priv->fxs_info) {
- XPD_DBG(xpd, "Removing xpd FXS_INFO file\n");
+ XPD_DBG(PROC, xpd, "Removing xpd FXS_INFO file\n");
remove_proc_entry(PROC_FXS_INFO_FNAME, xpd->proc_xpd_dir);
priv->fxs_info = NULL;
}
@@ -362,7 +362,7 @@ static int FXS_card_init(xbus_t *xbus, xpd_t *xpd)
BUG_ON(!xpd);
priv = xpd->priv;
#ifdef CONFIG_PROC_FS
- XPD_DBG(xpd, "Creating FXS_INFO file\n");
+ XPD_DBG(PROC, xpd, "Creating FXS_INFO file\n");
priv->fxs_info = create_proc_read_entry(PROC_FXS_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_fxs_info_read, xpd);
if(!priv->fxs_info) {
XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_FXS_INFO_FNAME);
@@ -371,7 +371,7 @@ static int FXS_card_init(xbus_t *xbus, xpd_t *xpd)
}
priv->fxs_info->owner = THIS_MODULE;
#ifdef WITH_METERING
- XPD_DBG(xpd, "Creating Metering tone file\n");
+ XPD_DBG(PROC, xpd, "Creating Metering tone file\n");
priv->meteringfile = create_proc_entry(PROC_METERING_FNAME, 0200, xpd->proc_xpd_dir);
if(!priv->meteringfile) {
XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_METERING_FNAME);
@@ -383,7 +383,7 @@ static int FXS_card_init(xbus_t *xbus, xpd_t *xpd)
priv->meteringfile->read_proc = NULL;
priv->meteringfile->data = xpd;
#endif
- XPD_DBG(xpd, "Creating SLICs file\n");
+ XPD_DBG(PROC, xpd, "Creating SLICs file\n");
priv->regfile = create_proc_entry(PROC_REGISTER_FNAME, 0644, xpd->proc_xpd_dir);
if(!priv->regfile) {
XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_REGISTER_FNAME);
@@ -408,7 +408,7 @@ static int FXS_card_init(xbus_t *xbus, xpd_t *xpd)
ret = SLIC_DIRECT_REQUEST(xbus, xpd, ALL_CHANS, SLIC_WRITE, 0x22, 0x00); /* Ringing Oscilator Control */
if(ret < 0)
goto err;
- XPD_DBG(xpd, "done\n");
+ XPD_DBG(GENERAL, xpd, "done\n");
for_each_line(xpd, i) {
do_led(xpd, i, LED_GREEN, 0);
do_led(xpd, i, LED_RED, 0);
@@ -436,7 +436,7 @@ static int FXS_card_remove(xbus_t *xbus, xpd_t *xpd)
BUG_ON(!xpd);
priv = xpd->priv;
- XPD_DBG(xpd, "\n");
+ XPD_DBG(GENERAL, xpd, "\n");
clean_proc(xbus, xpd);
return 0;
}
@@ -452,11 +452,11 @@ static int FXS_card_zaptel_preregistration(xpd_t *xpd, bool on)
BUG_ON(!xbus);
priv = xpd->priv;
BUG_ON(!priv);
- XPD_DBG(xpd, "%s\n", (on)?"on":"off");
+ XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off");
for_each_line(xpd, i) {
struct zt_chan *cur_chan = &xpd->chans[i];
- XPD_DBG(xpd, "setting FXS channel %d\n", i);
+ XPD_DBG(GENERAL, xpd, "setting FXS channel %d\n", i);
if(IS_SET(xpd->digital_outputs, i)) {
snprintf(cur_chan->name, MAX_CHANNAME, "XPP_OUT/%02d/%1d%1d/%d",
xbus->num, xpd->addr.unit, xpd->addr.subunit, i);
@@ -489,7 +489,7 @@ static int FXS_card_zaptel_postregistration(xpd_t *xpd, bool on)
BUG_ON(!xbus);
priv = xpd->priv;
BUG_ON(!priv);
- XPD_DBG(xpd, "%s\n", (on)?"on":"off");
+ XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off");
for_each_line(xpd, i) {
MARK_OFF(priv, i, LED_GREEN);
msleep(2);
@@ -507,11 +507,11 @@ int FXS_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig)
struct zt_chan *chan = NULL;
enum fxs_state txhook;
- LINE_DBG(xpd, pos, "%s\n", txsig2str(txsig));
+ LINE_DBG(SIGNAL, xpd, pos, "%s\n", txsig2str(txsig));
priv = xpd->priv;
BUG_ON(xpd->direction != TO_PHONE);
if (IS_SET(xpd->digital_inputs, pos)) {
- LINE_DBG(xpd, pos, "Ignoring signal sent to digital input line\n");
+ LINE_DBG(SIGNAL, xpd, pos, "Ignoring signal sent to digital input line\n");
return 0;
}
if(SPAN_REGISTERED(xpd))
@@ -523,7 +523,7 @@ int FXS_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig)
BIT_CLR(priv->search_fsk_pattern, pos);
pcm_recompute(xpd, xpd->offhook | xpd->cid_on);
if(IS_SET(xpd->digital_outputs, pos)) {
- LINE_DBG(xpd, pos, "digital output OFF\n");
+ LINE_DBG(SIGNAL, xpd, pos, "digital output OFF\n");
ret = CALL_XMETHOD(RELAY_OUT, xpd->xbus, xpd, pos-8, 0);
return ret;
}
@@ -531,7 +531,7 @@ int FXS_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig)
/*
* Restore state after KEWL hangup.
*/
- LINE_DBG(xpd, pos, "KEWL STOP\n");
+ LINE_DBG(SIGNAL, xpd, pos, "KEWL STOP\n");
linefeed_control(xbus, xpd, pos, FXS_LINE_POL_ACTIVE);
if(IS_SET(xpd->offhook, pos))
MARK_ON(priv, pos, LED_GREEN);
@@ -580,14 +580,14 @@ int FXS_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig)
BIT_CLR(priv->search_fsk_pattern, pos);
pcm_recompute(xpd, xpd->offhook | xpd->cid_on);
if(IS_SET(xpd->digital_outputs, pos)) {
- LINE_DBG(xpd, pos, "%s digital output ON\n", txsig2str(txsig));
+ LINE_DBG(SIGNAL, xpd, pos, "%s digital output ON\n", txsig2str(txsig));
ret = CALL_XMETHOD(RELAY_OUT, xpd->xbus, xpd, pos-8, 1);
return ret;
}
ret = CALL_XMETHOD(RING, xbus, xpd, pos, 1); // RING on
break;
case ZT_TXSIG_KEWL:
- LINE_DBG(xpd, pos, "KEWL START\n");
+ LINE_DBG(SIGNAL, xpd, pos, "KEWL START\n");
linefeed_control(xbus, xpd, pos, FXS_LINE_OPEN);
MARK_OFF(priv, pos, LED_GREEN);
break;
@@ -625,7 +625,7 @@ static int FXS_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long a
case ZT_ONHOOKTRANSFER:
if (get_user(val, (int __user *)arg))
return -EFAULT;
- LINE_DBG(xpd, pos, "ZT_ONHOOKTRANSFER (%d millis)\n", val);
+ LINE_DBG(SIGNAL, xpd, pos, "ZT_ONHOOKTRANSFER (%d millis)\n", val);
BUG_ON(pos == ALL_CHANS);
if (IS_SET(xpd->digital_inputs | xpd->digital_outputs, pos))
return 0; /* Nothing to do */
@@ -638,7 +638,7 @@ static int FXS_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long a
case ZT_TONEDETECT:
if (get_user(val, (int __user *)arg))
return -EFAULT;
- LINE_DBG(xpd, pos, "ZT_TONEDETECT: %s %s (dtmf_detection=%s)\n",
+ LINE_DBG(SIGNAL, xpd, pos, "ZT_TONEDETECT: %s %s (dtmf_detection=%s)\n",
(val & ZT_TONEDETECT_ON) ? "ON" : "OFF",
(val & ZT_TONEDETECT_MUTE) ? "MUTE" : "NO-MUTE",
(dtmf_detection ? "YES" : "NO"));
@@ -670,7 +670,7 @@ static int set_vm_led_mode(xbus_t *xbus, xpd_t *xpd, int pos, int on)
BUG_ON(!xbus);
BUG_ON(!xpd);
- LINE_DBG(xpd, pos, "%s%s\n", (on)?"ON":"OFF", (vmwineon)?"":" (Ignored)");
+ LINE_DBG(SIGNAL, xpd, pos, "%s%s\n", (on)?"ON":"OFF", (vmwineon)?"":" (Ignored)");
if (!vmwineon)
return 0;
if (on) {
@@ -712,7 +712,7 @@ static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos)
return;
priv = xpd->priv;
on = IS_SET(xpd->msg_waiting, pos);
- LINE_DBG(xpd, pos, "%s\n", (on)?"ON":"OFF");
+ LINE_DBG(SIGNAL, xpd, pos, "%s\n", (on)?"ON":"OFF");
set_vm_led_mode(xbus, xpd, pos, on);
do_chan_power(xbus, xpd, pos, on);
linefeed_control(xbus, xpd, pos, (on) ? FXS_LINE_RING : priv->idletxhookstate[pos]);
@@ -726,7 +726,7 @@ static int FXS_card_open(xpd_t *xpd, lineno_t chan)
BUG_ON(!xpd);
priv = xpd->priv;
is_offhook = IS_SET(xpd->offhook, chan);
- LINE_DBG(xpd, chan, "(is %shook)\n", (is_offhook)?"off":"on");
+ LINE_DBG(GENERAL, xpd, chan, "(is %shook)\n", (is_offhook)?"off":"on");
/*
* Delegate updating zaptel to FXS_card_tick():
* The problem is that zt_hooksig() is spinlocking the channel and
@@ -742,7 +742,7 @@ static int FXS_card_close(xpd_t *xpd, lineno_t chan)
struct FXS_priv_data *priv;
BUG_ON(!xpd);
- LINE_DBG(xpd, chan, "\n");
+ LINE_DBG(GENERAL, xpd, chan, "\n");
priv = xpd->priv;
priv->idletxhookstate[chan] = FXS_LINE_POL_ACTIVE;
return 0;
@@ -851,7 +851,7 @@ static void detect_vmwi(xpd_t *xpd)
if(writechunk[0] != 0x7F && writechunk[0] != 0) {
int j;
- LINE_DBG(xpd, pos, "MSG:");
+ LINE_DBG(GENERAL, xpd, pos, "MSG:");
for(j = 0; j < ZT_CHUNKSIZE; j++) {
if(print_dbg)
printk(" %02X", writechunk[j]);
@@ -865,11 +865,11 @@ static void detect_vmwi(xpd_t *xpd)
else if(unlikely(IS_SET(priv->found_fsk_pattern, i))) {
BIT_CLR(priv->found_fsk_pattern, i);
if(unlikely(mem_equal(writechunk, FSK_ON_PATTERN, ZT_CHUNKSIZE))) {
- LINE_DBG(xpd, i, "MSG WAITING ON\n");
+ LINE_DBG(SIGNAL, xpd, i, "MSG WAITING ON\n");
BIT_SET(xpd->msg_waiting, i);
start_stop_vm_led(xbus, xpd, i);
} else if(unlikely(mem_equal(writechunk, FSK_OFF_PATTERN, ZT_CHUNKSIZE))) {
- LINE_DBG(xpd, i, "MSG WAITING OFF\n");
+ LINE_DBG(SIGNAL, xpd, i, "MSG WAITING OFF\n");
BIT_CLR(xpd->msg_waiting, i);
start_stop_vm_led(xbus, xpd, i);
} else {
@@ -940,16 +940,14 @@ static int FXS_card_tick(xbus_t *xbus, xpd_t *xpd)
reg_cmd_t *reg_cmd;
if(!xbus) {
- DBG("NO XBUS\n");
+ DBG(GENERAL, "NO XBUS\n");
return -EINVAL;
}
XFRAME_NEW(xframe, pack, xbus, GLOBAL, REGISTER_REQUEST, xpd->xbus_idx);
-#if 0
- LINE_DBG(xpd, chipsel, "%c%c R%02X S%02X %02X %02X\n",
+ LINE_DBG(REGS, xpd, chipsel, "%c%c R%02X S%02X %02X %02X\n",
(writing)?'W':'R',
(do_subreg)?'S':'D',
regnum, subreg, data_low, data_high);
-#endif
reg_cmd = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REQUEST, reg_cmd);
reg_cmd->bytes = sizeof(*reg_cmd) - 1; // do not count the 'bytes' field
REG_FIELD(reg_cmd, chipsel) = chipsel;
@@ -974,7 +972,7 @@ static /* 0x0F */ HOSTCMD(FXS, XPD_STATE, bool on)
BUG_ON(!xpd);
priv = xpd->priv;
spin_lock_irqsave(&xpd->lock, flags);
- XPD_DBG(xpd, "%s\n", (on)?"on":"off");
+ XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off");
for_each_line(xpd, i)
linefeed_control(xbus, xpd, i, value);
if(on) {
@@ -994,7 +992,7 @@ static /* 0x0F */ HOSTCMD(FXS, RING, lineno_t chan, bool on)
BUG_ON(!xbus);
BUG_ON(!xpd);
- LINE_DBG(xpd, chan, "%s\n", (on)?"on":"off");
+ LINE_DBG(SIGNAL, xpd, chan, "%s\n", (on)?"on":"off");
priv = xpd->priv;
set_vm_led_mode(xbus, xpd, chan, 0);
do_chan_power(xbus, xpd, chan, on); // Power up (for ring)
@@ -1015,7 +1013,7 @@ static /* 0x0F */ HOSTCMD(FXS, RELAY_OUT, byte which, bool on)
BUG_ON(!xbus);
BUG_ON(!xpd);
- XPD_DBG(xpd, "RELAY_OUT: which=%d -- %s\n", which, (on) ? "on" : "off");
+ XPD_DBG(SIGNAL, xpd, "RELAY_OUT: which=%d -- %s\n", which, (on) ? "on" : "off");
which = which % ARRAY_SIZE(relay_channels);
value = BIT(2) | BIT(3);
value |= ((BIT(5) | BIT(6) | BIT(7)) & ~led_register_mask[OUTPUT_RELAY]);
@@ -1037,7 +1035,7 @@ HANDLER_DEF(FXS, SIG_CHANGED)
BUG_ON(!xpd);
BUG_ON(xpd->direction != TO_PHONE);
priv = xpd->priv;
- XPD_DBG(xpd, "(PHONE) sig_toggles=0x%04X sig_status=0x%04X\n", sig_toggles, sig_status);
+ XPD_DBG(SIGNAL, xpd, "(PHONE) sig_toggles=0x%04X sig_status=0x%04X\n", sig_toggles, sig_status);
#if 0
Is this needed?
for_each_line(xpd, i) {
@@ -1057,11 +1055,11 @@ HANDLER_DEF(FXS, SIG_CHANGED)
#endif
MARK_BLINK(priv, i, LED_GREEN, 0);
if(IS_SET(sig_status, i)) {
- LINE_DBG(xpd, i, "OFFHOOK\n");
+ LINE_DBG(SIGNAL, xpd, i, "OFFHOOK\n");
MARK_ON(priv, i, LED_GREEN);
update_line_status(xpd, i, 1);
} else {
- LINE_DBG(xpd, i, "ONHOOK\n");
+ LINE_DBG(SIGNAL, xpd, i, "ONHOOK\n");
MARK_OFF(priv, i, LED_GREEN);
update_line_status(xpd, i, 0);
}
@@ -1089,10 +1087,10 @@ static void process_digital_inputs(xpd_t *xpd, const reg_cmd_t *info)
BIT_SET(lines, newchanno);
xpd->ringing[newchanno] = 0; // Stop ringing. No leds for digital inputs.
if(offhook && !IS_SET(xpd->offhook, newchanno)) { // OFFHOOK
- LINE_DBG(xpd, newchanno, "OFFHOOK\n");
+ LINE_DBG(SIGNAL, xpd, newchanno, "OFFHOOK\n");
update_line_status(xpd, newchanno, 1);
} else if(!offhook && IS_SET(xpd->offhook, newchanno)) { // ONHOOK
- LINE_DBG(xpd, newchanno, "ONHOOK\n");
+ LINE_DBG(SIGNAL, xpd, newchanno, "ONHOOK\n");
update_line_status(xpd, newchanno, 0);
}
}
@@ -1124,12 +1122,12 @@ void process_dtmf(xpd_t *xpd, const reg_cmd_t *info)
for_each_line(xpd, i) {
if(IS_SET(lines, i)) {
if(on && !IS_SET(priv->dtmf_keypressed, i)) {
- LINE_DBG(xpd, i, "DTMF digit %2d PRESSED (%d)\n", digit, val);
+ LINE_DBG(SIGNAL, xpd, i, "DTMF digit %2d PRESSED (%d)\n", digit, val);
BIT_SET(priv->dtmf_keypressed, i);
if(dtmf_detection)
zt_qevent_lock(&xpd->chans[i], ZT_EVENT_DTMFDOWN | digit);
} else if(!on && IS_SET(priv->dtmf_keypressed, i)) {
- LINE_DBG(xpd, i, "DTMF digit %2d RELEASED\n", digit);
+ LINE_DBG(SIGNAL, xpd, i, "DTMF digit %2d RELEASED\n", digit);
BIT_CLR(priv->dtmf_keypressed, i);
if(dtmf_detection)
zt_qevent_lock(&xpd->chans[i], ZT_EVENT_DTMFUP | digit);
@@ -1156,11 +1154,9 @@ HANDLER_DEF(FXS, REGISTER_REPLY)
BUG_ON(!priv);
indirect = (REG_FIELD(info, regnum) == 0x1E);
regnum = (indirect) ? REG_FIELD(info, subreg) : REG_FIELD(info, regnum);
-#if 0
- XPD_DBG(xpd, "REGISTER_REPLY: %s reg_num=0x%X, dataL=0x%X dataH=0x%X\n",
+ XPD_DBG(REGS, xpd, "REGISTER_REPLY: %s reg_num=0x%X, dataL=0x%X dataH=0x%X\n",
(indirect)?"I":"D",
regnum, REG_FIELD(info, data_low), REG_FIELD(info, data_high));
-#endif
if(!SPAN_REGISTERED(xpd))
goto out;
/*
@@ -1217,14 +1213,14 @@ static bool fxs_packet_is_valid(xpacket_t *pack)
{
const xproto_entry_t *xe;
- // DBG("\n");
+ // DBG(GENERAL, "\n");
xe = xproto_card_entry(&PROTO_TABLE(FXS), pack->opcode);
return xe != NULL;
}
static void fxs_packet_dump(const char *msg, xpacket_t *pack)
{
- DBG("%s\n", msg);
+ DBG(GENERAL, "%s\n", msg);
}
/*------------------------- SLIC Handling --------------------------*/
@@ -1331,6 +1327,8 @@ static int handle_register_command(xpd_t *xpd, char *cmdline)
xbus_t *xbus;
int ret;
+ BUG_ON(!xpd);
+ xbus = xpd->xbus;
if((p = strchr(cmdline, '#')) != NULL) /* Truncate comments */
*p = '\0';
if((p = strchr(cmdline, ';')) != NULL) /* Truncate comments */
@@ -1345,7 +1343,7 @@ static int handle_register_command(xpd_t *xpd, char *cmdline)
&op, &reg_type, &reg_num,
&data_low,
&data_high);
- // DBG("'%s': %d %c%c %02X %02X %02X\n", cmdline, chipsel, op, reg_type, reg_num, data_low, data_high);
+ XPD_DBG(REGS, xpd, "'%s': %d %c%c %02X %02X %02X\n", cmdline, chipsel, op, reg_type, reg_num, data_low, data_high);
if(elements < 4) { // At least: chipsel, op, reg_type, reg_num
ERR("Not enough arguments: (%d args) '%s'\n", elements, cmdline);
return -EINVAL;
@@ -1396,10 +1394,8 @@ static int handle_register_command(xpd_t *xpd, char *cmdline)
REG_FIELD(&regcmd, data_low) = data_low;
REG_FIELD(&regcmd, data_high) = data_high;
REG_FIELD(&regcmd, read_request) = writing;
- BUG_ON(!xpd);
- xbus = xpd->xbus;
if(!down_read_trylock(&xbus->in_use)) {
- XBUS_DBG(xbus, "Dropped packet. Is in_use\n");
+ XBUS_DBG(GENERAL, xbus, "Dropped packet. Is in_use\n");
return -EBUSY;
}
xpd->requested_reply = regcmd;