static int command_byte; /* the most recent command byte transmitted */
static int autopoll_devs; /* bits set are device addresses to be polled */
-/* Sanity check for request queue. Doesn't check for cycles. */
-static int request_is_queued(struct adb_request *req) {
- struct adb_request *cur;
- unsigned long flags;
- local_irq_save(flags);
- cur = current_req;
- while (cur) {
- if (cur == req) {
- local_irq_restore(flags);
- return 1;
- }
- cur = cur->next;
- }
- local_irq_restore(flags);
- return 0;
-}
-
/* Check for MacII style ADB */
static int macii_probe(void)
{
else
next_device = ffs(autopoll_devs) - 1;
- BUG_ON(request_is_queued(&req));
-
adb_request(&req, NULL, ADBREQ_NOSEND, 1,
ADB_READREG(next_device, 0));
int err;
unsigned long flags;
- BUG_ON(request_is_queued(req));
-
local_irq_save(flags);
err = macii_write(req);
local_irq_restore(flags);
- if (!err && sync) {
- while (!req->complete) {
+ if (!err && sync)
+ while (!req->complete)
macii_poll();
- }
- BUG_ON(request_is_queued(req));
- }
return err;
}
{
static struct adb_request req;
- if (request_is_queued(&req))
- return 0;
-
/* Command = 0, Address = ignored */
adb_request(&req, NULL, ADBREQ_NOSEND, 1, ADB_BUSRESET);
macii_send_request(&req, 1);
req = current_req;
- BUG_ON(req == NULL);
-
- BUG_ON(macii_state != idle);
-
/* Now send it. Be careful though, that first byte of the request
* is actually ADB_PACKET; the real data begins at index 1!
* And req->nbytes is the number of bytes of real data plus one.
static irqreturn_t macii_interrupt(int irq, void *arg)
{
int x;
- static int entered;
struct adb_request *req;
if (!arg) {
return IRQ_NONE;
}
- BUG_ON(entered++);
-
last_status = status;
status = via[B] & (ST_MASK|CTLR_IRQ);
if (reading_reply) {
reply_ptr = current_req->reply;
} else {
- BUG_ON(current_req != NULL);
+ WARN_ON(current_req);
reply_ptr = reply_buf;
}
case reading:
x = via[SR];
- BUG_ON((status & ST_MASK) == ST_CMD ||
- (status & ST_MASK) == ST_IDLE);
+ WARN_ON((status & ST_MASK) == ST_CMD ||
+ (status & ST_MASK) == ST_IDLE);
/* Bus timeout with SRQ sequence:
* data is "XX FF" while CTLR_IRQ is "L L"
}
}
- if (macii_state == reading) {
- BUG_ON(reply_len > 15);
+ if (macii_state == reading &&
+ reply_len < ARRAY_SIZE(reply_buf)) {
reply_ptr++;
*reply_ptr = x;
reply_len++;
break;
}
- entered--;
return IRQ_HANDLED;
}