if GPIB
-config GPIB_KERNEL_DEBUG
- bool "GPIB debugging"
- depends on BROKEN
- help
- This is an option for use by developers; most people should
- say N here.
-
- It enables gpib core and driver debugging
- messages to be printed on the console.
-
config GPIB_COMMON
tristate "GPIB core"
help
-subdir-ccflags-$(CONFIG_GPIB_KERNEL_DEBUG) := -DGPIB_DEBUG
subdir-ccflags-y += -I$(src)/include -I$(src)/uapi
obj-$(CONFIG_GPIB_AGILENT_82350B) += agilent_82350b/
status2 = read_byte(nec_priv, ISR2);
nec7210_interrupt_have_status(board, nec_priv, status1, status2);
- GPIB_DPRINTK("cb7210: status 0x%x, mode 0x%x\n", hs_status, priv->hs_mode_bits);
+ dev_dbg(board->gpib_dev, "cb7210: status 0x%x, mode 0x%x\n", hs_status, priv->hs_mode_bits);
clear_bits = 0;
static int cleanup_open_devices(gpib_file_private_t *file_priv, gpib_board_t *board);
-static int pop_gpib_event_nolock(gpib_event_queue_t *queue, short *event_type);
+static int pop_gpib_event_nolock(gpib_board_t *board, gpib_event_queue_t *queue, short *event_type);
/*
* Timer functions
}
// push status byte onto back of status byte fifo
-int push_status_byte(gpib_status_queue_t *device, u8 poll_byte)
+int push_status_byte(gpib_board_t *board, gpib_status_queue_t *device, u8 poll_byte)
{
struct list_head *head = &device->status_bytes;
status_byte_t *status;
u8 lost_byte;
device->dropped_byte = 1;
- retval = pop_status_byte(device, &lost_byte);
+ retval = pop_status_byte(board, device, &lost_byte);
if (retval < 0)
return retval;
}
device->num_status_bytes++;
- GPIB_DPRINTK("pushed status byte 0x%x, %i in queue\n",
- (int)poll_byte, num_status_bytes(device));
+ dev_dbg(board->gpib_dev, "pushed status byte 0x%x, %i in queue\n",
+ (int)poll_byte, num_status_bytes(device));
return 0;
}
// pop status byte from front of status byte fifo
-int pop_status_byte(gpib_status_queue_t *device, u8 *poll_byte)
+int pop_status_byte(gpib_board_t *board, gpib_status_queue_t *device, u8 *poll_byte)
{
struct list_head *head = &device->status_bytes;
struct list_head *front = head->next;
device->num_status_bytes--;
- GPIB_DPRINTK("popped status byte 0x%x, %i in queue\n",
- (int)*poll_byte, num_status_bytes(device));
+ dev_dbg(board->gpib_dev, "popped status byte 0x%x, %i in queue\n",
+ (int)*poll_byte, num_status_bytes(device));
return 0;
}
{
gpib_status_queue_t *device;
- GPIB_DPRINTK("%s:()\n", __func__);
+ dev_dbg(board->gpib_dev, "%s:()\n", __func__);
device = get_gpib_status_queue(board, pad, sad);
if (num_status_bytes(device))
- return pop_status_byte(device, poll_byte);
+ return pop_status_byte(board, device, poll_byte);
else
return dvrsp(board, pad, sad, usec_timeout, poll_byte);
}
{
int retval;
- GPIB_DPRINTK("entering %s()\n", __func__);
+ dev_dbg(board->gpib_dev, "entering %s()\n", __func__);
if (mutex_lock_interruptible(&board->user_mutex))
return -ERESTARTSYS;
if (mutex_lock_interruptible(&board->big_gpib_mutex)) {
return -ERESTARTSYS;
}
- GPIB_DPRINTK("autopoll has board lock\n");
+ dev_dbg(board->gpib_dev, "autopoll has board lock\n");
retval = serial_poll_all(board, serial_timeout);
if (retval < 0) {
return retval;
}
- GPIB_DPRINTK("%s complete\n", __func__);
+ dev_dbg(board->gpib_dev, "%s complete\n", __func__);
/* need to wake wait queue in case someone is
* waiting on RQS
*/
size_t bytes_written;
int ret;
- GPIB_DPRINTK("entering %s()\n", __func__);
+ dev_dbg(board->gpib_dev, "entering %s()\n", __func__);
os_start_timer(board, usec_timeout);
ret = ibcac(board, 1, 1);
int i;
size_t nbytes;
- GPIB_DPRINTK("entering %s(), pad=%i sad=%i\n", __func__, pad, sad);
+ dev_dbg(board->gpib_dev, "entering %s(), pad=%i sad=%i\n", __func__, pad, sad);
os_start_timer(board, usec_timeout);
ret = ibcac(board, 1, 1);
int ret;
size_t bytes_written;
- GPIB_DPRINTK("entering %s()\n", __func__);
+ dev_dbg(board->gpib_dev, "entering %s()\n", __func__);
os_start_timer(board, usec_timeout);
ret = ibcac(board, 1, 1);
u8 result;
unsigned int num_bytes = 0;
- GPIB_DPRINTK("entering %s()\n", __func__);
+ dev_dbg(board->gpib_dev, "entering %s()\n", __func__);
head = &board->device_list;
if (head->next == head)
if (retval < 0)
continue;
if (result & request_service_bit) {
- retval = push_status_byte(device, result);
+ retval = push_status_byte(board, device, result);
if (retval < 0)
continue;
num_bytes++;
priv = filep->private_data;
init_gpib_file_private((gpib_file_private_t *)filep->private_data);
- GPIB_DPRINTK("pid %i, gpib: opening minor %d\n", current->pid, minor);
+ dev_dbg(board->gpib_dev, "pid %i, gpib: opening minor %d\n", current->pid, minor);
if (board->use_count == 0) {
int retval;
retval = request_module("gpib%i", minor);
if (retval) {
- GPIB_DPRINTK("pid %i, gpib: request module returned %i\n",
- current->pid, retval);
+ dev_dbg(board->gpib_dev, "pid %i, gpib: request module returned %i\n",
+ current->pid, retval);
}
}
if (board->interface) {
return -ENODEV;
}
- GPIB_DPRINTK("pid %i, gpib: closing minor %d\n", current->pid, minor);
-
board = &board_array[minor];
+ dev_dbg(board->gpib_dev, "pid %i, closing minor %d\n", current->pid, minor);
+
if (priv) {
desc = handle_to_descriptor(priv, 0);
if (desc) {
if (desc->autopoll_enabled) {
- GPIB_DPRINTK("pid %i, gpib: decrementing autospollers\n",
- current->pid);
+ dev_dbg(board->gpib_dev, "pid %i, decrementing autospollers\n",
+ current->pid);
if (board->autospollers > 0)
board->autospollers--;
else
if (mutex_lock_interruptible(&board->big_gpib_mutex))
return -ERESTARTSYS;
- GPIB_DPRINTK("pid %i, minor %i, ioctl %d, interface=%s, use=%d, onl=%d\n",
- current->pid, minor, cmd & 0xff,
- board->interface ? board->interface->name : "",
- board->use_count,
- board->online);
+ dev_dbg(board->gpib_dev, "pid %i, ioctl %d, interface=%s, use=%d, onl=%d\n",
+ current->pid, cmd & 0xff,
+ board->interface ? board->interface->name : "",
+ board->use_count,
+ board->online);
switch (cmd) {
case CFCBOARDTYPE:
done:
mutex_unlock(&board->big_gpib_mutex);
- GPIB_DPRINTK("ioctl done status = 0x%lx\n", board->status);
+ dev_dbg(board->gpib_dev, "ioctl done status = 0x%lx\n", board->status);
return retval;
}
return 0;
}
-static int increment_open_device_count(struct list_head *head, unsigned int pad, int sad)
+static int increment_open_device_count(gpib_board_t *board, struct list_head *head,
+ unsigned int pad, int sad)
{
struct list_head *list_ptr;
gpib_status_queue_t *device;
for (list_ptr = head->next; list_ptr != head; list_ptr = list_ptr->next) {
device = list_entry(list_ptr, gpib_status_queue_t, list);
if (gpib_address_equal(device->pad, device->sad, pad, sad)) {
- GPIB_DPRINTK("pid %i, incrementing open count for pad %i, sad %i\n",
- current->pid, device->pad, device->sad);
+ dev_dbg(board->gpib_dev, "pid %i, incrementing open count for pad %i, sad %i\n",
+ current->pid, device->pad, device->sad);
device->reference_count++;
return 0;
}
list_add(&device->list, head);
- GPIB_DPRINTK("pid %i, opened pad %i, sad %i\n",
- current->pid, device->pad, device->sad);
+ dev_dbg(board->gpib_dev, "pid %i, opened pad %i, sad %i\n",
+ current->pid, device->pad, device->sad);
return 0;
}
-static int subtract_open_device_count(struct list_head *head, unsigned int pad, int sad,
- unsigned int count)
+static int subtract_open_device_count(gpib_board_t *board, struct list_head *head,
+ unsigned int pad, int sad, unsigned int count)
{
gpib_status_queue_t *device;
struct list_head *list_ptr;
for (list_ptr = head->next; list_ptr != head; list_ptr = list_ptr->next) {
device = list_entry(list_ptr, gpib_status_queue_t, list);
if (gpib_address_equal(device->pad, device->sad, pad, sad)) {
- GPIB_DPRINTK("pid %i, decrementing open count for pad %i, sad %i\n",
- current->pid, device->pad, device->sad);
+ dev_dbg(board->gpib_dev, "pid %i, decrementing open count for pad %i, sad %i\n",
+ current->pid, device->pad, device->sad);
if (count > device->reference_count) {
pr_err("gpib: bug! in %s()\n", __func__);
return -EINVAL;
}
device->reference_count -= count;
if (device->reference_count == 0) {
- GPIB_DPRINTK("pid %i, closing pad %i, sad %i\n",
- current->pid, device->pad, device->sad);
+ dev_dbg(board->gpib_dev, "pid %i, closing pad %i, sad %i\n",
+ current->pid, device->pad, device->sad);
list_del(list_ptr);
kfree(device);
}
return -EINVAL;
}
-static inline int decrement_open_device_count(struct list_head *head, unsigned int pad, int sad)
+static inline int decrement_open_device_count(gpib_board_t *board, struct list_head *head,
+ unsigned int pad, int sad)
{
- return subtract_open_device_count(head, pad, sad, 1);
+ return subtract_open_device_count(board, head, pad, sad, 1);
}
static int cleanup_open_devices(gpib_file_private_t *file_priv, gpib_board_t *board)
continue;
if (desc->is_board == 0) {
- retval = decrement_open_device_count(&board->device_list, desc->pad,
+ retval = decrement_open_device_count(board, &board->device_list, desc->pad,
desc->sad);
if (retval < 0)
return retval;
file_priv->descriptors[i]->is_board = open_dev_cmd.is_board;
mutex_unlock(&file_priv->descriptors_mutex);
- retval = increment_open_device_count(&board->device_list, open_dev_cmd.pad,
+ retval = increment_open_device_count(board, &board->device_list, open_dev_cmd.pad,
open_dev_cmd.sad);
if (retval < 0)
return retval;
if (!file_priv->descriptors[cmd.handle])
return -EINVAL;
- retval = decrement_open_device_count(&board->device_list,
+ retval = decrement_open_device_count(board, &board->device_list,
file_priv->descriptors[cmd.handle]->pad,
file_priv->descriptors[cmd.handle]->sad);
if (retval < 0)
serial_poll_ioctl_t serial_cmd;
int retval;
- GPIB_DPRINTK("pid %i, entering %s()\n", __func__, current->pid);
+ dev_dbg(board->gpib_dev, "pid %i, entering %s()\n", current->pid, __func__);
retval = copy_from_user(&serial_cmd, (void *)arg, sizeof(serial_cmd));
if (retval)
if (retval < 0)
return retval;
} else {
- retval = decrement_open_device_count(&board->device_list, desc->pad, desc->sad);
+ retval = decrement_open_device_count(board, &board->device_list, desc->pad,
+ desc->sad);
if (retval < 0)
return retval;
desc->pad = cmd.pad;
- retval = increment_open_device_count(&board->device_list, desc->pad, desc->sad);
+ retval = increment_open_device_count(board, &board->device_list, desc->pad,
+ desc->sad);
if (retval < 0)
return retval;
}
if (retval < 0)
return retval;
} else {
- retval = decrement_open_device_count(&board->device_list, desc->pad, desc->sad);
+ retval = decrement_open_device_count(board, &board->device_list, desc->pad,
+ desc->sad);
if (retval < 0)
return retval;
desc->sad = cmd.sad;
- retval = increment_open_device_count(&board->device_list, desc->pad, desc->sad);
+ retval = increment_open_device_count(board, &board->device_list, desc->pad,
+ desc->sad);
if (retval < 0)
return retval;
}
atomic_set(&file_priv->holding_mutex, 1);
- GPIB_DPRINTK("pid %i, locked board %d mutex\n", current->pid, board->minor);
+ dev_dbg(board->gpib_dev, "pid %i, locked board %d mutex\n",
+ current->pid, board->minor);
} else {
spin_lock(&board->locking_pid_spinlock);
if (current->pid != board->locking_pid) {
atomic_set(&file_priv->holding_mutex, 0);
mutex_unlock(&board->user_mutex);
- GPIB_DPRINTK("pid %i, unlocked board %i mutex\n", current->pid, board->minor);
+ dev_dbg(board->gpib_dev, "pid %i, unlocked board %i mutex\n",
+ current->pid, board->minor);
}
return 0;
}
return -EFAULT;
board->usec_timeout = timeout;
- GPIB_DPRINTK("pid %i, timeout set to %i usec\n", current->pid, timeout);
+ dev_dbg(board->gpib_dev, "pid %i, timeout set to %i usec\n", current->pid, timeout);
return 0;
}
short lost_event;
queue->dropped_event = 1;
- retval = pop_gpib_event_nolock(queue, &lost_event);
+ retval = pop_gpib_event_nolock(board, queue, &lost_event);
if (retval < 0)
return retval;
}
queue->num_events++;
- GPIB_DPRINTK("pushed event %i, %i in queue\n",
- (int)event_type, num_gpib_events(queue));
+ dev_dbg(board->gpib_dev, "pushed event %i, %i in queue\n",
+ (int)event_type, num_gpib_events(queue));
return 0;
}
}
EXPORT_SYMBOL(push_gpib_event);
-static int pop_gpib_event_nolock(gpib_event_queue_t *queue, short *event_type)
+static int pop_gpib_event_nolock(gpib_board_t *board, gpib_event_queue_t *queue, short *event_type)
{
struct list_head *head = &queue->event_head;
struct list_head *front = head->next;
queue->num_events--;
- GPIB_DPRINTK("popped event %i, %i in queue\n",
- (int)*event_type, num_gpib_events(queue));
+ dev_dbg(board->gpib_dev, "popped event %i, %i in queue\n",
+ (int)*event_type, num_gpib_events(queue));
return 0;
}
// pop event from front of event queue
-int pop_gpib_event(gpib_event_queue_t *queue, short *event_type)
+int pop_gpib_event(gpib_board_t *board, gpib_event_queue_t *queue, short *event_type)
{
unsigned long flags;
int retval;
spin_lock_irqsave(&queue->lock, flags);
- retval = pop_gpib_event_nolock(queue, event_type);
+ retval = pop_gpib_event_nolock(board, queue, event_type);
spin_unlock_irqrestore(&queue->lock, flags);
return retval;
}
int retval;
short event;
- retval = pop_gpib_event(&board->event_queue, &event);
+ retval = pop_gpib_event(board, &board->event_queue, &event);
if (retval < 0)
return retval;
board->buffer_length = 0;
}
while (num_gpib_events(&board->event_queue))
- pop_gpib_event(&board->event_queue, &dummy);
+ pop_gpib_event(board, &board->event_queue, &dummy);
}
static void init_board_array(gpib_board_t *board_array, unsigned int length)
gpib_board_t *board = board_void;
int retval = 0;
- GPIB_DPRINTK("entering autospoll thread\n");
+ dev_dbg(board->gpib_dev, "entering autospoll thread\n");
while (1) {
wait_event_interruptible(board->wait,
kthread_should_stop() ||
autospoll_wait_should_wake_up(board));
- GPIB_DPRINTK("autospoll wait satisfied\n");
+ dev_dbg(board->gpib_dev, "autospoll wait satisfied\n");
if (kthread_should_stop())
break;
}
#endif
board->online = 1;
- GPIB_DPRINTK("gpib: board online\n");
+ dev_dbg(board->gpib_dev, "gpib: board online\n");
return 0;
}
board->interface->detach(board);
gpib_deallocate_board(board);
board->online = 0;
- GPIB_DPRINTK("gpib: board offline\n");
+ dev_dbg(board->gpib_dev, "gpib: board offline\n");
return 0;
}
pr_warn("gpib: warning, shortening long udelay\n");
}
- GPIB_DPRINTK("sending interface clear\n");
+ dev_dbg(board->gpib_dev, "sending interface clear\n");
board->interface->interface_clear(board, 1);
udelay(usec_duration);
board->interface->interface_clear(board, 0);
board->pad = addr;
if (board->online)
board->interface->primary_address(board, board->pad);
- GPIB_DPRINTK("set primary addr to %i\n", board->pad);
+ dev_dbg(board->gpib_dev, "set primary addr to %i\n", board->pad);
return 0;
}
else
board->interface->secondary_address(board, 0, 0);
}
- GPIB_DPRINTK("set secondary addr to %i\n", board->sad);
+ dev_dbg(board->gpib_dev, "set secondary addr to %i\n", board->sad);
return 0;
}
if (wait_event_interruptible(board->wait, wait_satisfied(&winfo, status_queue,
wait_mask, status, desc))) {
- GPIB_DPRINTK("wait interrupted\n");
+ dev_dbg(board->gpib_dev, "wait interrupted\n");
retval = -ERESTARTSYS;
}
remove_wait_timer(&winfo);
void gpib_deallocate_board(gpib_board_t *board);
unsigned int num_status_bytes(const gpib_status_queue_t *dev);
-int push_status_byte(gpib_status_queue_t *device, uint8_t poll_byte);
-int pop_status_byte(gpib_status_queue_t *device, uint8_t *poll_byte);
+int push_status_byte(gpib_board_t *board, gpib_status_queue_t *device, uint8_t poll_byte);
+int pop_status_byte(gpib_board_t *board, gpib_status_queue_t *device, uint8_t *poll_byte);
gpib_status_queue_t *get_gpib_status_queue(gpib_board_t *board, unsigned int pad, int sad);
int get_serial_poll_byte(gpib_board_t *board, unsigned int pad, int sad,
unsigned int usec_timeout, uint8_t *poll_byte);
test_bit(BUS_ERROR_BN, &nec_priv->state) ||
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib write interrupted!\n");
+ dev_dbg(board->gpib_dev, "gpib write interrupted!\n");
retval = -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status))
test_bit(BUS_ERROR_BN, &nec_priv->state) ||
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib write interrupted!\n");
+ dev_dbg(board->gpib_dev, "gpib write interrupted!\n");
retval = -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status))
test_bit(BUS_ERROR_BN, &nec_priv->state) ||
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib write interrupted!\n");
+ dev_dbg(board->gpib_dev, "gpib write interrupted!\n");
retval = -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status))
unsigned int ss_device, struct pci_dev *from);
unsigned int num_gpib_events(const gpib_event_queue_t *queue);
int push_gpib_event(gpib_board_t *board, short event_type);
-int pop_gpib_event(gpib_event_queue_t *queue, short *event_type);
+int pop_gpib_event(gpib_board_t *board, gpib_event_queue_t *queue, short *event_type);
int gpib_request_pseudo_irq(gpib_board_t *board, irqreturn_t (*handler)(int, void *));
void gpib_free_pseudo_irq(gpib_board_t *board);
int gpib_match_device_path(struct device *dev, const char *device_path_in);
extern struct list_head registered_drivers;
-#ifdef GPIB_DEBUG
-#define GPIB_DPRINTK(format, args...) pr_info("gpib debug: " format, ## args)
-#else
-#define GPIB_DPRINTK(arg...)
-#endif
-
#include <linux/io.h>
void writeb_wrapper(unsigned int value, void *address);
test_bit(BUS_ERROR_BN, &nec_priv->state) ||
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib write interrupted\n");
+ dev_dbg(board->gpib_dev, "gpib write interrupted\n");
return -ERESTARTSYS;
}
if (test_bit(BUS_ERROR_BN, &nec_priv->state))
* At module loading: modprobe lpvo_usb_gpib debug={0,1,2}
* On the fly: echo {0,1,2} > /sys/modules/lpvo_usb_gpib/parameters/debug
*/
-#ifdef GPIB_DEBUG
-static int debug = 1;
-#else
+
static int debug;
-#endif
module_param(debug, int, 0644);
#define DIA_LOG(level, format, ...) \
DIA_LOG(2, "--> %x\n", b->inbuf[b->last - b->nchar]);
return b->inbuf[b->last - b->nchar--];
} else if (b->nchar == 0) {
- pr_alert("%s:%s - read returned EOF\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - read returned EOF\n", NAME, __func__);
return -EIO;
}
- pr_alert("%s:%s - read error %d\n", NAME, __func__, b->nchar);
+ dev_alert(board->gpib_dev, "%s:%s - read error %d\n", NAME, __func__, b->nchar);
TTY_LOG("\n *** %s *** Read Error - %s\n", NAME,
"Reset the adapter with 'gpib_config'\n");
return -EIO;
}
if (val != ACK) {
- pr_alert("%s:%s - error in timeout set: <%s>\n",
- NAME, __func__, command);
+ dev_alert(board->gpib_dev, "%s:%s - error in timeout set: <%s>\n",
+ NAME, __func__, command);
} else {
data->timeout = board->usec_timeout;
}
if (config->device_path) {
/* if config->device_path given, try that first */
- pr_alert("%s:%s - Looking for device_path: %s\n",
- NAME, __func__, config->device_path);
+ dev_alert(board->gpib_dev, "%s:%s - Looking for device_path: %s\n",
+ NAME, __func__, config->device_path);
for (j = 0 ; j < MAX_DEV ; j++) {
if ((assigned_usb_minors & 1 << j) == 0)
continue;
mutex_unlock(&minors_lock);
if (j == MAX_DEV) {
- pr_alert("%s:%s - Requested device is not registered.\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - Requested device is not registered.\n",
+ NAME, __func__);
return -EIO;
}
buffer = send_command((gpib_board_t *)board, USB_GPIB_STATUS, 0);
if (buffer < 0) {
- pr_alert("%s:%s - line status read failed with %d\n", NAME, __func__, buffer);
+ dev_alert(board->gpib_dev, "%s:%s - line status read failed with %d\n",
+ NAME, __func__, buffer);
return -1;
}
retval = set_control_line(board, IB_BUS_EOI, 1);
if (retval != ACK) {
- pr_alert("%s:%s - assert EOI failed\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - assert EOI failed\n", NAME, __func__);
return -EIO;
}
retval = set_control_line(board, IB_BUS_EOI, 0);
if (retval != 0x06) {
- pr_alert("%s:%s - unassert EOI failed\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - unassert EOI failed\n", NAME, __func__);
return -EIO;
}
goto read_return;
if (one_char(board, &b) != DLE || one_char(board, &b) != STX) {
- pr_alert("%s:%s - wrong <DLE><STX> sequence\n",
- NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - wrong <DLE><STX> sequence\n",
+ NAME, __func__);
retval = -EIO;
goto read_return;
}
retval = 0;
goto read_return;
} else {
- pr_alert("%s:%s - %s %x\n",
- NAME, __func__,
- "Wrong end of message", c);
+ dev_alert(board->gpib_dev, "%s:%s - %s %x\n",
+ NAME, __func__,
+ "Wrong end of message", c);
retval = -ETIME;
goto read_return;
}
} else {
- pr_alert("%s:%s - %s\n", NAME, __func__,
- "lone <DLE> in stream");
+ dev_alert(board->gpib_dev, "%s:%s - %s\n", NAME, __func__,
+ "lone <DLE> in stream");
retval = -EIO;
goto read_return;
}
c = one_char(board, &b);
if (c == ACK) {
if (MAX_READ_EXCESS - read_count > 1)
- pr_alert("%s:%s - %s\n", NAME, __func__,
- "small buffer - maybe some data lost");
+ dev_alert(board->gpib_dev, "%s:%s - %s\n", NAME, __func__,
+ "small buffer - maybe some data lost");
retval = 0;
goto read_return;
}
}
}
- pr_alert("%s:%s - no input end - GPIB board in odd state\n",
- NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - no input end - GPIB board in odd state\n",
+ NAME, __func__);
retval = -EIO;
read_return:
retval = set_control_line(board, IB_BUS_REN, enable ? 1 : 0);
if (retval != ACK)
- pr_alert("%s:%s - could not set REN line: %x\n",
- NAME, __func__, retval);
+ dev_alert(board->gpib_dev, "%s:%s - could not set REN line: %x\n",
+ NAME, __func__, retval);
DIA_LOG(1, "done with %x\n", retval);
}
static void usb_gpib_parallel_poll_configure(gpib_board_t *board,
uint8_t configuration)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
}
/* parallel_poll_response */
static void usb_gpib_parallel_poll_response(gpib_board_t *board, int ist)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
}
/* primary_address */
static int usb_gpib_primary_address(gpib_board_t *board, unsigned int address)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
return 0;
}
static void usb_gpib_return_to_local(gpib_board_t *board)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
}
/* secondary_address */
unsigned int address,
int enable)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
return 0;
}
static void usb_gpib_serial_poll_response(gpib_board_t *board, uint8_t status)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
}
/* serial_poll_status */
static uint8_t usb_gpib_serial_poll_status(gpib_board_t *board)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
return 0;
}
static unsigned int usb_gpib_t1_delay(gpib_board_t *board, unsigned int nano_sec)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
return 0;
}
// wait for result FIXME: support timeouts
ret = wait_event_interruptible(board->wait, test_bit(COMMAND_READY_BN, &priv->state));
if (ret) {
- GPIB_DPRINTK("gpib: parallel poll interrupted\n");
+ dev_dbg(board->gpib_dev, "gpib: parallel poll interrupted\n");
return -ERESTARTSYS;
}
*result = read_byte(priv, CPTR);
priv->srq_pending = 0;
set_bit(SPOLL_NUM, &board->status);
}
-// GPIB_DPRINTK("status 0x%x, state 0x%x\n", board->status, priv->state);
+// dev_dbg(board->gpib_dev, "status 0x%x, state 0x%x\n", board->status, priv->state);
/* we rely on the interrupt handler to set the
* rest of the status bits
test_bit(COMMAND_READY_BN, &priv->state) ||
test_bit(BUS_ERROR_BN, &priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib command wait interrupted\n");
+ dev_dbg(board->gpib_dev, "gpib command wait interrupted\n");
retval = -ERESTARTSYS;
break;
}
if (wait_event_interruptible(board->wait, test_bit(COMMAND_READY_BN, &priv->state) ||
test_bit(BUS_ERROR_BN, &priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib command wait interrupted\n");
+ dev_dbg(board->gpib_dev, "gpib command wait interrupted\n");
retval = -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status)) {
- GPIB_DPRINTK("gpib command timed out\n");
+ dev_dbg(board->gpib_dev, "gpib command timed out\n");
retval = -ETIMEDOUT;
}
if (test_and_clear_bit(BUS_ERROR_BN, &priv->state)) {
test_bit(READ_READY_BN, &priv->state) ||
test_bit(DEV_CLEAR_BN, &priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("nec7210: pio read wait interrupted\n");
+ dev_dbg(board->gpib_dev, "nec7210: pio read wait interrupted\n");
retval = -ERESTARTSYS;
break;
}
break;
}
if (test_bit(TIMO_NUM, &board->status)) {
- GPIB_DPRINTK("interrupted by timeout\n");
+ dev_dbg(board->gpib_dev, "interrupted by timeout\n");
retval = -ETIMEDOUT;
break;
}
if (test_bit(DEV_CLEAR_BN, &priv->state)) {
- GPIB_DPRINTK("interrupted by device clear\n");
+ dev_dbg(board->gpib_dev, "interrupted by device clear\n");
retval = -EINTR;
break;
}
test_bit(DMA_READ_IN_PROGRESS_BN, &priv->state) == 0 ||
test_bit(DEV_CLEAR_BN, &priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("nec7210: dma read wait interrupted\n");
+ dev_dbg(board->gpib_dev, "nec7210: dma read wait interrupted\n");
retval = -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status))
(wake_on_lacs && test_bit(LACS_NUM, &board->status)) ||
(wake_on_atn && test_bit(ATN_NUM, &board->status)) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib write interrupted\n");
+ dev_dbg(board->gpib_dev, "gpib write interrupted\n");
return -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status)) {
- GPIB_DPRINTK("nec7210: write timed out\n");
+ dev_dbg(board->gpib_dev, "nec7210: write timed out\n");
return -ETIMEDOUT;
}
if (test_bit(DEV_CLEAR_BN, &priv->state)) {
- GPIB_DPRINTK("nec7210: write interrupted by clear\n");
+ dev_dbg(board->gpib_dev, "nec7210: write interrupted by clear\n");
return -EINTR;
}
if (wake_on_bus_error && test_and_clear_bit(BUS_ERROR_BN, &priv->state)) {
- GPIB_DPRINTK("nec7210: bus error on write\n");
+ dev_dbg(board->gpib_dev, "nec7210: bus error on write\n");
return -EIO;
}
return 0;
if (retval == -EIO) {
/* resend last byte on bus error */
*bytes_written = last_count;
- GPIB_DPRINTK("resending %c\n", buffer[*bytes_written]);
+ dev_dbg(board->gpib_dev, "resending %c\n", buffer[*bytes_written]);
/* we can get unrecoverable bus errors,
* so give up after a while
*/
test_bit(BUS_ERROR_BN, &priv->state) ||
test_bit(DEV_CLEAR_BN, &priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib write interrupted!\n");
+ dev_dbg(board->gpib_dev, "gpib write interrupted!\n");
retval = -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status))
(status2 & (priv->reg_bits[IMR2] & IMR2_ENABLE_INTR_MASK)) ||
nec7210_atn_has_changed(board, priv)) {
nec7210_update_status_nolock(board, priv);
- GPIB_DPRINTK("minor %i, stat %lx, isr1 0x%x, imr1 0x%x, isr2 0x%x, imr2 0x%x\n",
- board->minor, board->status, status1, priv->reg_bits[IMR1], status2,
+ dev_dbg(board->gpib_dev, "minor %i, stat %lx, isr1 0x%x, imr1 0x%x, isr2 0x%x, imr2 0x%x\n",
+ board->minor, board->status, status1, priv->reg_bits[IMR1], status2,
priv->reg_bits[IMR2]);
wake_up_interruptible(&board->wait); /* wake up sleeping process */
retval = IRQ_HANDLED;
clear_bit(SRQI_NUM, &board->status);
}
- GPIB_DPRINTK("status 0x%lx, state 0x%lx\n", board->status, priv->state);
+ dev_dbg(board->gpib_dev, "status 0x%lx, state 0x%lx\n", board->status, priv->state);
return board->status;
}
test_bit(BUS_ERROR_BN, &priv->state) ||
test_bit(DEV_CLEAR_BN, &priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib write interrupted!\n");
+ dev_dbg(board->gpib_dev, "gpib write interrupted!\n");
return -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status))
}
if (status1 & HR_ERR) {
- GPIB_DPRINTK("gpib bus error\n");
+ dev_dbg(board->gpib_dev, "gpib bus error\n");
set_bit(BUS_ERROR_BN, &priv->state);
}
}
if ((status0 & priv->imr0_bits) || (status1 & priv->imr1_bits)) {
-// GPIB_DPRINTK("isr0 0x%x, imr0 0x%x, isr1 0x%x, imr1 0x%x\n",
+// dev_dbg(board->gpib_dev, "isr0 0x%x, imr0 0x%x, isr1 0x%x, imr1 0x%x\n",
// status0, priv->imr0_bits, status1, priv->imr1_bits);
update_status_nolock(board, priv);
wake_up_interruptible(&board->wait);
test_bit(BUS_ERROR_BN, &nec_priv->state) ||
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
test_bit(TIMO_NUM, &board->status))) {
- GPIB_DPRINTK("gpib write interrupted\n");
+ dev_dbg(board->gpib_dev, "gpib write interrupted\n");
return -ERESTARTSYS;
}
if (test_bit(TIMO_NUM, &board->status)) {
if (isr3_bits & HR_DONE)
priv->imr3_bits &= ~HR_DONE;
if (isr3_bits & (HR_INTR | HR_TLCI)) {
- GPIB_DPRINTK("tnt4882: minor %i isr0 0x%x imr0 0x%x isr3 0x%x imr3 0x%x\n",
- board->minor,
- isr0_bits, priv->imr0_bits, isr3_bits, imr3_bits);
+ dev_dbg(board->gpib_dev, "tnt4882: minor %i isr0 0x%x imr0 0x%x isr3 0x%x imr3 0x%x\n",
+ board->minor, isr0_bits, priv->imr0_bits, isr3_bits, imr3_bits);
tnt_writeb(priv, priv->imr3_bits, IMR3);
wake_up_interruptible(&board->wait);
}