Skip to content

Commit aac840e

Browse files
Finn Thainmpe
authored andcommitted
macintosh/adb-iop: Access current_req and adb_iop_state when inside lock
Drop the redundant local_irq_save/restore() from adb_iop_start() because the caller has to do it anyway. This is the pattern used in via-macii. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Stan Johnson <userm57@yahoo.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/bbe32b087c7e04d68e2425f6a2df4a414d167c32.1590880623.git.fthain@telegraphics.com.au
1 parent 303511e commit aac840e

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎drivers/macintosh/adb-iop.c‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ static void adb_iop_listen(struct iop_msg *msg)
137137

138138
static void adb_iop_start(void)
139139
{
140-
unsigned long flags;
141140
struct adb_request *req;
142141
struct adb_iopmsg amsg;
143142

@@ -146,8 +145,6 @@ static void adb_iop_start(void)
146145
if (!req)
147146
return;
148147

149-
local_irq_save(flags);
150-
151148
/* The IOP takes MacII-style packets, so strip the initial
152149
* ADB_PACKET byte.
153150
*/
@@ -161,7 +158,6 @@ static void adb_iop_start(void)
161158

162159
req->sent = 1;
163160
adb_iop_state = sending;
164-
local_irq_restore(flags);
165161

166162
/* Now send it. The IOP manager will call adb_iop_complete
167163
* when the message has been sent.
@@ -208,13 +204,13 @@ static int adb_iop_write(struct adb_request *req)
208204
return -EINVAL;
209205
}
210206

211-
local_irq_save(flags);
212-
213207
req->next = NULL;
214208
req->sent = 0;
215209
req->complete = 0;
216210
req->reply_len = 0;
217211

212+
local_irq_save(flags);
213+
218214
if (current_req != 0) {
219215
last_req->next = req;
220216
last_req = req;
@@ -223,10 +219,11 @@ static int adb_iop_write(struct adb_request *req)
223219
last_req = req;
224220
}
225221

226-
local_irq_restore(flags);
227-
228222
if (adb_iop_state == idle)
229223
adb_iop_start();
224+
225+
local_irq_restore(flags);
226+
230227
return 0;
231228
}
232229

0 commit comments

Comments
 (0)