Commit 89da44db authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k mac local_irq*() updates

Convert m68k Mac drivers to new local_irq*() framework:
  - Mac IIfx and Quadra 9x0 ADB
  - Mac II and IIsi ADB
  - Powerbook ADB
parent 9417569f
......@@ -83,15 +83,14 @@ static void adb_iop_complete(struct iop_msg *msg, struct pt_regs *regs)
struct adb_request *req;
uint flags;
save_flags(flags);
cli();
local_irq_save(flags);
req = current_req;
if ((adb_iop_state == sending) && req && req->reply_expected) {
adb_iop_state = awaiting_reply;
}
restore_flags(flags);
local_irq_restore(flags);
}
/*
......@@ -107,8 +106,7 @@ static void adb_iop_listen(struct iop_msg *msg, struct pt_regs *regs)
struct adb_request *req;
uint flags;
save_flags(flags);
cli();
local_irq_save(flags);
req = current_req;
......@@ -150,7 +148,7 @@ static void adb_iop_listen(struct iop_msg *msg, struct pt_regs *regs)
memcpy(msg->reply, msg->message, IOP_MSG_LEN);
}
iop_complete_message(msg);
restore_flags(flags);
local_irq_restore(flags);
}
/*
......@@ -170,8 +168,7 @@ static void adb_iop_start(void)
req = current_req;
if (!req) return;
save_flags(flags);
cli();
local_irq_save(flags);
#ifdef DEBUG_ADB_IOP
printk("adb_iop_start: sending packet, %d bytes:", req->nbytes);
......@@ -192,7 +189,7 @@ static void adb_iop_start(void)
req->sent = 1;
adb_iop_state = sending;
restore_flags(flags);
local_irq_restore(flags);
/* Now send it. The IOP manager will call adb_iop_complete */
/* when the packet has been sent. */
......@@ -236,8 +233,7 @@ static int adb_iop_write(struct adb_request *req)
return -EINVAL;
}
save_flags(flags);
cli();
local_irq_save(flags);
req->next = 0;
req->sent = 0;
......@@ -252,7 +248,7 @@ static int adb_iop_write(struct adb_request *req)
last_req = req;
}
restore_flags(flags);
local_irq_restore(flags);
if (adb_iop_state == idle) adb_iop_start();
return 0;
}
......
......@@ -144,8 +144,7 @@ int macii_init(void)
unsigned long flags;
int err;
save_flags(flags);
cli();
local_irq_save(flags);
err = macii_init_via();
if (err) return err;
......@@ -155,7 +154,7 @@ int macii_init(void)
if (err) return err;
macii_state = idle;
restore_flags(flags);
local_irq_restore(flags);
return 0;
}
......@@ -196,13 +195,12 @@ static void macii_queue_poll(void)
adb_request(&req, NULL, ADBREQ_REPLY|ADBREQ_NOSEND, 1,
ADB_READREG(device, 0));
save_flags(flags);
cli();
local_irq_save(flags);
req.next = current_req;
current_req = &req;
restore_flags(flags);
local_irq_restore(flags);
macii_start();
in_poll--;
}
......@@ -221,8 +219,7 @@ static void macii_retransmit(int device)
adb_request(&rt, NULL, ADBREQ_REPLY|ADBREQ_NOSEND, 1,
ADB_READREG(device, 0));
save_flags(flags);
cli();
local_irq_save(flags);
if (current_req != NULL) {
last_req->next = &rt;
......@@ -234,7 +231,7 @@ static void macii_retransmit(int device)
if (macii_state == idle) macii_start();
restore_flags(flags);
local_irq_restore(flags);
in_retransmit--;
}
......@@ -267,7 +264,7 @@ static int macii_write(struct adb_request *req)
req->complete = 0;
req->reply_len = 0;
save_flags(flags); cli();
local_irq_save(flags);
if (current_req != NULL) {
last_req->next = req;
......@@ -278,7 +275,7 @@ static int macii_write(struct adb_request *req)
if (macii_state == idle) macii_start();
}
restore_flags(flags);
local_irq_restore(flags);
return 0;
}
......@@ -296,9 +293,9 @@ static void macii_poll(void)
{
unsigned long flags;
save_flags(flags); cli();
local_irq_save(flags);
if (via[IFR] & SR_INT) macii_interrupt(0, 0, 0);
restore_flags(flags);
local_irq_restore(flags);
}
/* Reset the bus */
......@@ -328,7 +325,7 @@ static void macii_start(void)
return;
}
save_flags(flags); cli();
local_irq_save(flags);
/*
* IRQ signaled ?? (means ADB controller wants to send, or might
......@@ -356,7 +353,7 @@ static void macii_start(void)
(uint) via[B] & (ST_MASK|TREQ));
retry_req = req;
/* set ADB status here ? */
restore_flags(flags);
local_irq_restore(flags);
return;
} else {
need_poll = 0;
......@@ -385,7 +382,7 @@ static void macii_start(void)
macii_state = sending;
data_index = 2;
restore_flags(flags);
local_irq_restore(flags);
}
/*
......@@ -421,10 +418,10 @@ void macii_interrupt(int irq, void *arg, struct pt_regs *regs)
last_status = status;
/* prevent races due to SCSI enabling ints */
save_flags(flags); cli();
local_irq_save(flags);
if (driver_running) {
restore_flags(flags);
local_irq_restore(flags);
return;
}
......@@ -650,5 +647,5 @@ void macii_interrupt(int irq, void *arg, struct pt_regs *regs)
}
/* reset mutex and interrupts */
driver_running = 0;
restore_flags(flags);
local_irq_restore(flags);
}
......@@ -312,8 +312,7 @@ maciisi_write(struct adb_request* req)
req->complete = 0;
req->reply_len = 0;
save_flags(flags);
cli();
local_irq_save(flags);
if (current_req) {
last_req->next = req;
......@@ -327,7 +326,7 @@ maciisi_write(struct adb_request* req)
i = maciisi_start();
if(i != 0)
{
restore_flags(flags);
local_irq_restore(flags);
return i;
}
}
......@@ -336,11 +335,11 @@ maciisi_write(struct adb_request* req)
#ifdef DEBUG_MACIISI_ADB
printk(KERN_DEBUG "maciisi_write: would start, but state is %d\n", maciisi_state);
#endif
restore_flags(flags);
local_irq_restore(flags);
return -EBUSY;
}
restore_flags(flags);
local_irq_restore(flags);
return 0;
}
......@@ -401,15 +400,14 @@ maciisi_poll(void)
{
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
if (via[IFR] & SR_INT) {
maciisi_interrupt(0, 0, 0);
}
else /* avoid calling this function too quickly in a loop */
udelay(ADB_DELAY);
restore_flags(flags);
local_irq_restore(flags);
}
/* Shift register interrupt - this is *supposed* to mean that the
......@@ -426,8 +424,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs)
int i;
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
status = via[B] & (TIP|TREQ);
#ifdef DEBUG_MACIISI_ADB
......@@ -437,7 +434,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs)
if (!(via[IFR] & SR_INT)) {
/* Shouldn't happen, we hope */
printk(KERN_ERR "maciisi_interrupt: called without interrupt flag set\n");
restore_flags(flags);
local_irq_restore(flags);
return;
}
......@@ -636,7 +633,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs)
default:
printk("maciisi_interrupt: unknown maciisi_state %d?\n", maciisi_state);
}
restore_flags(flags);
local_irq_restore(flags);
}
static void
......
......@@ -495,7 +495,7 @@ pmu_queue_request(struct adb_request *req)
req->next = 0;
req->sent = 0;
req->complete = 0;
save_flags(flags); cli();
local_irq_save(flags);
if (current_req != 0) {
last_req->next = req;
......@@ -507,7 +507,7 @@ pmu_queue_request(struct adb_request *req)
pmu_start();
}
restore_flags(flags);
local_irq_restore(flags);
return 0;
}
......@@ -537,7 +537,7 @@ pmu_start()
/* assert pmu_state == idle */
/* get the packet to send */
save_flags(flags); cli();
local_irq_save(flags);
req = current_req;
if (req == 0 || pmu_state != idle
|| (req->reply_expected && req_awaiting_reply))
......@@ -551,16 +551,15 @@ pmu_start()
send_byte(req->data[0]);
out:
restore_flags(flags);
local_irq_restore(flags);
}
void
pmu_poll()
{
unsigned long cpu_flags;
unsigned long flags;
save_flags(cpu_flags);
cli();
local_irq_save(flags);
if (via1[IFR] & SR_INT) {
via1[IFR] = SR_INT;
pmu_interrupt(IRQ_MAC_ADB_SR, NULL, NULL);
......@@ -569,7 +568,7 @@ pmu_poll()
via1[IFR] = CB1_INT;
pmu_interrupt(IRQ_MAC_ADB_CL, NULL, NULL);
}
restore_flags(cpu_flags);
local_irq_restore(flags);
}
static void
......@@ -963,9 +962,9 @@ int __openfirmware powerbook_sleep(void)
asm volatile("mfspr %0,1008" : "=r" (hid0) :);
hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP;
asm volatile("mtspr 1008,%0" : : "r" (hid0));
save_flags(msr);
local_save_flags(msr);
msr |= MSR_POW | MSR_EE;
restore_flags(msr);
local_irq_restore(msr);
udelay(10);
/* OK, we're awake again, start restoring things */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment