summaryrefslogtreecommitdiff
path: root/xpp/xbus-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/xbus-core.c')
-rw-r--r--xpp/xbus-core.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/xpp/xbus-core.c b/xpp/xbus-core.c
index b15ab4c..f88e2cd 100644
--- a/xpp/xbus-core.c
+++ b/xpp/xbus-core.c
@@ -119,7 +119,7 @@ int xbus_log(xbus_t *xbus, xpd_t *xpd, int direction, const void *buf, unsigned
spin_lock_irqsave(&d->lock, flags);
if (sizeof(struct log_header) + len > DEBUGFS_BUFSIZ - (d->tail - d->head)) {
ret = -ENOSPC;
- XPD_DBG(xpd, "Dropping debugfs data of len %lu, free space is %lu\n", sizeof(struct log_header) + len,
+ XPD_DBG(GENERAL, xpd, "Dropping debugfs data of len %lu, free space is %lu\n", sizeof(struct log_header) + len,
DEBUGFS_BUFSIZ - (d->tail - d->head));
goto out;
}
@@ -167,7 +167,7 @@ static int debugfs_open(struct inode *inode, struct file *file)
struct log_global_header gheader;
BUG_ON(!xbus);
- XBUS_DBG(xbus, "\n");
+ XBUS_DBG(GENERAL, xbus, "\n");
if (xbus->debugfs_data)
return -EBUSY;
d = kmalloc(sizeof(struct debugfs_data), GFP_KERNEL);
@@ -196,7 +196,7 @@ static ssize_t debugfs_read(struct file *file, char __user *buf, size_t nbytes,
BUG_ON(!d);
BUG_ON(!d->xbus);
- XBUS_DBG(d->xbus, "\n");
+ XBUS_DBG(GENERAL, d->xbus, "\n");
while (d->head == d->tail) {
if (wait_event_interruptible(d->queue, d->head != d->tail))
return -EAGAIN;
@@ -222,7 +222,7 @@ static int debugfs_release(struct inode *inode, struct file *file)
BUG_ON(!d);
BUG_ON(!d->xbus);
- XBUS_DBG(d->xbus, "\n");
+ XBUS_DBG(GENERAL, d->xbus, "\n");
d->xbus->debugfs_data = NULL;
kfree(d);
module_put(THIS_MODULE);
@@ -271,7 +271,7 @@ xpacket_t *xframe_next_packet(xframe_t *frm, int len)
int newlen = atomic_read(&frm->frame_len);
newlen += len;
-// DBG("len=%d, newlen=%d, frm->frame_len=%d\n", len, newlen, XFRAME_LEN(frm));
+// DBG(GENERAL, "len=%d, newlen=%d, frm->frame_len=%d\n", len, newlen, XFRAME_LEN(frm));
if (newlen > XFRAME_DATASIZE) {
return NULL;
}
@@ -287,7 +287,7 @@ static void do_hexdump(const char msg[], byte *data, uint16_t len)
int print_dbg = 1;
for(i = 0; i < len; i++)
- DBG("%s: %3d> %02X\n", msg, i, data[i]);
+ DBG(GENERAL, "%s: %3d> %02X\n", msg, i, data[i]);
}
void dump_xframe(const char msg[], const xbus_t *xbus, const xframe_t *xframe)
@@ -345,9 +345,9 @@ void dump_xframe(const char msg[], const xbus_t *xbus, const xframe_t *xframe)
do_print = 1;
if(do_print) {
if(num == 1)
- XBUS_DBG(xbus, "%s: frame_len=%d.\n",
+ XBUS_DBG(GENERAL, xbus, "%s: frame_len=%d.\n",
msg, frame_len);
- XBUS_DBG(xbus, " %3d. DATALEN=%d OP=0x%02X XPD-%d%d (pos=%d)\n",
+ XBUS_DBG(GENERAL, xbus, " %3d. DATALEN=%d OP=0x%02X XPD-%d%d (pos=%d)\n",
num, pack->datalen, pack->opcode,
pack->addr.unit, pack->addr.subunit, pos);
dump_packet(" ", pack, print_dbg);
@@ -371,16 +371,16 @@ int xframe_send(xbus_t *xbus, xframe_t *xframe)
int ret = -ENODEV;
if(!xframe) {
- DBG("null xframe\n");
+ DBG(GENERAL, "null xframe\n");
return -EINVAL;
}
if(!xbus) {
- DBG("null xbus\n");
+ DBG(GENERAL, "null xbus\n");
ret = -EINVAL;
goto error;
}
if (!xbus->hardware_exists) {
- XBUS_DBG(xbus, "Dropped a xframe -- NO HARDWARE.");
+ XBUS_DBG(GENERAL, xbus, "Dropped a xframe -- NO HARDWARE.");
ret = -ENODEV;
goto error;
}
@@ -389,7 +389,7 @@ int xframe_send(xbus_t *xbus, xframe_t *xframe)
XBUS_COUNTER(xbus, TX_BYTES) += XFRAME_LEN(xframe);
up_read(&xbus->in_use);
} else {
- XBUS_DBG(xbus, "Dropped xframe. Is in_use\n");
+ XBUS_DBG(GENERAL, xbus, "Dropped xframe. Is in_use\n");
}
return ret;
@@ -528,7 +528,7 @@ static void xbus_poll(void *data)
}
msleep(2); /* roundtrip for older polls */
spin_lock_irqsave(&xbus->lock, flags);
- XBUS_DBG(xbus, "\n");
+ XBUS_DBG(GENERAL, xbus, "\n");
poller->is_polling = 1;
/*
@@ -537,7 +537,7 @@ static void xbus_poll(void *data)
for(id = 0; id < MAX_XPDS; id++) {
if(!xbus->hardware_exists)
break;
- // XBUS_DBG(xbus, "Polling slot %d\n", id);
+ // XBUS_DBG(GENERAL, xbus, "Polling slot %d\n", id);
spin_unlock_irqrestore(&xbus->lock, flags);
ret = CALL_PROTO(GLOBAL, DESC_REQ, xbus, NULL, id);
spin_lock_irqsave(&xbus->lock, flags);
@@ -550,7 +550,7 @@ static void xbus_poll(void *data)
/*
* Wait for replies
*/
- XBUS_DBG(xbus, "Polled %d XPD's. Waiting for replies max %d jiffies\n", MAX_XPDS, poll_timeout);
+ XBUS_DBG(GENERAL, xbus, "Polled %d XPD's. Waiting for replies max %d jiffies\n", MAX_XPDS, poll_timeout);
ret = wait_event_interruptible_timeout(poller->wait_for_polls, atomic_read(&poller->count_poll_answers) >= MAX_XPDS, poll_timeout);
if(ret == 0) {
XBUS_ERR(xbus, "Poll timeout. Continuing anyway.\n");
@@ -561,7 +561,7 @@ static void xbus_poll(void *data)
XBUS_ERR(xbus, "Poll interrupted %d\n", ret);
goto out;
} else
- XBUS_DBG(xbus, "Poll finished in %d jiffies.\n", poll_timeout - ret);
+ XBUS_DBG(GENERAL, xbus, "Poll finished in %d jiffies.\n", poll_timeout - ret);
/*
* Build removals/additions lists
*/
@@ -669,11 +669,11 @@ static void poller_destroy(struct xbus_poller *poller)
if(!poller)
return;
if(poller->xbus) {
- XBUS_DBG(poller->xbus, "detach poller\n");
+ XBUS_DBG(GENERAL, poller->xbus, "detach poller\n");
poller->xbus->poller = NULL;
}
if (poller->wq) {
- XBUS_DBG(poller->xbus, "destroy workqueue\n");
+ XBUS_DBG(GENERAL, poller->xbus, "destroy workqueue\n");
flush_workqueue(poller->wq);
destroy_workqueue(poller->wq);
poller->wq = NULL;
@@ -692,7 +692,7 @@ static struct xbus_poller *poller_new(xbus_t *xbus)
BUG_ON(xbus->busname[0] == '\0'); /* No name? */
BUG_ON(xbus->poller); /* Hmmm... overrun pollers? */
- XBUS_DBG(xbus, "\n");
+ XBUS_DBG(GENERAL, xbus, "\n");
poller = kmalloc(sizeof(*poller), GFP_KERNEL);
if(!poller)
goto err;
@@ -756,7 +756,7 @@ void xbus_activate(xbus_t *xbus)
BUG_ON(!ops->xframe_send);
BUG_ON(!ops->xframe_new || !ops->xframe_free);
xbus->hardware_exists = 1;
- XBUS_DBG(xbus, "Activating\n");
+ XBUS_DBG(GENERAL, xbus, "Activating\n");
/* Poll it */
poller_dispatch(xbus);
}
@@ -766,7 +766,7 @@ void xbus_disconnect(xbus_t *xbus)
int i;
BUG_ON(!xbus);
- XBUS_DBG(xbus, "\n");
+ XBUS_DBG(GENERAL, xbus, "\n");
xbus->hardware_exists = 0;
for(i = 0; i < MAX_XPDS; i++) {
xpd_t *xpd = xpd_of(xbus, i);
@@ -778,7 +778,7 @@ void xbus_disconnect(xbus_t *xbus)
}
xpd_disconnect(xpd);
}
- XBUS_DBG(xbus, "Deactivated\n");
+ XBUS_DBG(GENERAL, xbus, "Deactivated\n");
if(xbus->open_counter == 0) {
xbus_remove(xbus);
}
@@ -829,33 +829,33 @@ static void xbus_free(xbus_t *xbus)
#ifdef XPP_DEBUGFS
if(xbus->debugfs_dir) {
if(xbus->debugfs_file) {
- XBUS_DBG(xbus, "Removing debugfs file\n");
+ XBUS_DBG(GENERAL, xbus, "Removing debugfs file\n");
debugfs_remove(xbus->debugfs_file);
}
- XBUS_DBG(xbus, "Removing debugfs directory\n");
+ XBUS_DBG(GENERAL, xbus, "Removing debugfs directory\n");
debugfs_remove(xbus->debugfs_dir);
}
#endif
#ifdef CONFIG_PROC_FS
if(xbus->proc_xbus_dir) {
if(xbus->proc_xbus_summary) {
- XBUS_DBG(xbus, "Removing proc '%s'\n", PROC_XBUS_SUMMARY);
+ XBUS_DBG(PROC, xbus, "Removing proc '%s'\n", PROC_XBUS_SUMMARY);
remove_proc_entry(PROC_XBUS_SUMMARY, xbus->proc_xbus_dir);
xbus->proc_xbus_summary = NULL;
}
if(xbus->proc_xbus_waitfor_xpds) {
- XBUS_DBG(xbus, "Removing proc '%s'\n", PROC_XBUS_WAITFOR_XPDS);
+ XBUS_DBG(PROC, xbus, "Removing proc '%s'\n", PROC_XBUS_WAITFOR_XPDS);
remove_proc_entry(PROC_XBUS_WAITFOR_XPDS, xbus->proc_xbus_dir);
xbus->proc_xbus_waitfor_xpds = NULL;
}
#ifdef PROTOCOL_DEBUG
if(xbus->proc_xbus_command) {
- XBUS_DBG(xbus, "Removing proc '%s'\n", PROC_XBUS_COMMAND);
+ XBUS_DBG(PROC, xbus, "Removing proc '%s'\n", PROC_XBUS_COMMAND);
remove_proc_entry(PROC_XBUS_COMMAND, xbus->proc_xbus_dir);
xbus->proc_xbus_command = NULL;
}
#endif
- XBUS_DBG(xbus, "Removing proc directory\n");
+ XBUS_DBG(PROC, xbus, "Removing proc directory\n");
remove_proc_entry(xbus->busname, xpp_proc_toplevel);
xbus->proc_xbus_dir = NULL;
}
@@ -894,7 +894,7 @@ xbus_t *xbus_new(xbus_ops_t *ops)
init_rwsem(&xbus->in_use);
xbus_reset_counters(xbus);
#ifdef CONFIG_PROC_FS
- XBUS_DBG(xbus, "Creating xbus proc directory\n");
+ XBUS_DBG(PROC, xbus, "Creating xbus proc directory\n");
xbus->proc_xbus_dir = proc_mkdir(xbus->busname, xpp_proc_toplevel);
if(!xbus->proc_xbus_dir) {
XBUS_ERR(xbus, "Failed to create proc directory\n");
@@ -966,10 +966,10 @@ void xbus_remove(xbus_t *xbus)
BUG_ON(!xbus);
if(!xbus_of(xbus->num)) {
- DBG("XBUS #%d was already removed. Skip.\n", xbus->num);
+ DBG(GENERAL, "XBUS #%d was already removed. Skip.\n", xbus->num);
return;
}
- XBUS_DBG(xbus, "\n");
+ XBUS_DBG(GENERAL, xbus, "\n");
/* Block until no one use */
down_write(&xbus->in_use);
@@ -984,7 +984,7 @@ void xbus_remove(xbus_t *xbus)
XBUS_ERR(xbus, "BUG: xpd->xbus_idx=%d != i=%d\n", xpd->xbus_idx, i);
continue;
}
- XBUS_DBG(xbus, " Removing xpd #%d\n", i);
+ XBUS_DBG(GENERAL, xbus, " Removing xpd #%d\n", i);
xpd_remove(xpd);
}
xbus->xpds[i] = NULL;
@@ -1003,7 +1003,7 @@ void xbus_reset_counters(xbus_t *xbus)
{
int i;
- XBUS_DBG(xbus, "Reseting counters\n");
+ XBUS_DBG(GENERAL, xbus, "Reseting counters\n");
for(i = 0; i < XBUS_COUNTER_MAX; i++) {
xbus->counters[i] = 0;
}
@@ -1081,7 +1081,7 @@ static int xbus_read_waitfor_xpds(char *page, char **start, off_t off, int count
if(!xbus)
goto out;
poller = xbus->poller;
- XBUS_DBG(xbus, "Waiting for card initialization of %d XPD's max %d seconds\n", MAX_XPDS, INITIALIZATION_TIMEOUT/HZ);
+ XBUS_DBG(GENERAL, xbus, "Waiting for card initialization of %d XPD's max %d seconds\n", MAX_XPDS, INITIALIZATION_TIMEOUT/HZ);
/*
* xbus_poll sets count_xpds_to_initialize only when polling is finished.
* To prevent race conditions we test both:
@@ -1099,7 +1099,7 @@ static int xbus_read_waitfor_xpds(char *page, char **start, off_t off, int count
XBUS_ERR(xbus, "Card Initialization Interrupted %d\n", ret);
return ret;
}
- XBUS_DBG(xbus, "Finished initialization of %d XPD's in %d seconds.\n", MAX_XPDS, (INITIALIZATION_TIMEOUT - ret)/HZ);
+ XBUS_DBG(GENERAL, xbus, "Finished initialization of %d XPD's in %d seconds.\n", MAX_XPDS, (INITIALIZATION_TIMEOUT - ret)/HZ);
spin_lock_irqsave(&xbus->lock, flags);
len += sprintf(page + len, "XPDS_READY: %s: %d/%d\n",
xbus->busname,
@@ -1147,8 +1147,8 @@ static int proc_xbus_command_write(struct file *file, const char __user *buffer,
if(!(*p))
break;
if(!isxdigit(*p)) {
- ERR("%s: %s: bad hex value ASCII='0x%X' at position %d\n",
- __FUNCTION__, xbus->busname, *p, p - buf);
+ XBUS_ERR(xbus, "%s: bad hex value ASCII='0x%X' at position %ld\n",
+ __FUNCTION__, *p, (long)(p - buf));
return -EINVAL;
}
hexdigit[0] = *p++;
@@ -1157,12 +1157,12 @@ static int proc_xbus_command_write(struct file *file, const char __user *buffer,
if(isxdigit(*p))
hexdigit[1] = *p++;
if(sscanf(hexdigit, "%2X", &val) != 1) {
- ERR("%s: %s: bad hex value '%s' at position %d\n",
- __FUNCTION__, xbus->busname, hexdigit, p - buf);
+ XBUS_ERR(xbus, "%s: bad hex value '%s' at position %ld\n",
+ __FUNCTION__, hexdigit, (long)(p - buf));
return -EINVAL;
}
*q++ = val;
- // XBUS_DBG(xbus, "'%s' val=%d\n", hexdigit, val);
+ // XBUS_DBG(GENERAL, xbus, "'%s' val=%d\n", hexdigit, val);
}
xframe = xbus->ops->xframe_new(xbus, GFP_KERNEL);
if(!xframe)
@@ -1246,20 +1246,20 @@ static void xbus_core_cleanup(void)
{
#ifdef XPP_DEBUGFS
if(debugfs_root) {
- DBG("Removing xpp from debugfs\n");
+ DBG(GENERAL, "Removing xpp from debugfs\n");
debugfs_remove(debugfs_root);
}
#endif
#ifdef CONFIG_PROC_FS
if(proc_xbuses) {
- DBG("Removing " PROC_XBUSES " from proc\n");
+ DBG(PROC, "Removing " PROC_XBUSES " from proc\n");
remove_proc_entry(PROC_XBUSES, xpp_proc_toplevel);
proc_xbuses = NULL;
}
#endif
#ifdef CONFIG_PROC_FS
if(proc_commands) {
- DBG("Removing %s from proc\n", PROC_CMDS);
+ DBG(PROC, "Removing %s from proc\n", PROC_CMDS);
remove_proc_entry(PROC_CMDS, xpp_proc_toplevel);
proc_commands = NULL;
}
@@ -1305,7 +1305,7 @@ int __init xbus_core_init(void)
proc_xbuses->owner = THIS_MODULE;
#endif
#ifdef XPP_DEBUGFS
- DBG("Creating debugfs xpp root\n");
+ DBG(GENERAL, "Creating debugfs xpp root\n");
debugfs_root = debugfs_create_dir("xpp", NULL);
if(!debugfs_root) {
ERR("Failed to create debugfs root\n");