Skip to content

Commit 0a2cd16

Browse files
pastaqDerek J. Clark
authored andcommitted
Add mutex lock for all EC writes.
1 parent 77e536a commit 0a2cd16

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ayaneo-platform.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,13 @@ static int write_to_ec(u8 reg, u8 val)
218218
return ret;
219219
}
220220

221-
static void write_ec_ram(u8 index, u8 val)
221+
static int write_ec_ram(u8 index, u8 val)
222222
{
223+
int ret;
224+
225+
if (!lock_global_acpi_lock())
226+
return -EBUSY;
227+
223228
outb(0x2e, AYANEO_ADDR_PORT);
224229
outb(0x11, AYANEO_DATA_PORT);
225230
outb(0x2f, AYANEO_ADDR_PORT);
@@ -232,6 +237,11 @@ static void write_ec_ram(u8 index, u8 val)
232237
outb(0x12, AYANEO_DATA_PORT);
233238
outb(0x2f, AYANEO_ADDR_PORT);
234239
outb(val, AYANEO_DATA_PORT);
240+
241+
if (!unlock_global_acpi_lock())
242+
return -EBUSY;
243+
244+
return ret;
235245
}
236246

237247
/* Newer AIR Plus methods */

0 commit comments

Comments
 (0)