Skip to content

Commit

Permalink
Add mutex lock for all EC writes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pastaq authored and Derek J. Clark committed Feb 17, 2024
1 parent 77e536a commit 0a2cd16
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ayaneo-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,13 @@ static int write_to_ec(u8 reg, u8 val)
return ret;
}

static void write_ec_ram(u8 index, u8 val)
static int write_ec_ram(u8 index, u8 val)
{
int ret;

if (!lock_global_acpi_lock())
return -EBUSY;

outb(0x2e, AYANEO_ADDR_PORT);
outb(0x11, AYANEO_DATA_PORT);
outb(0x2f, AYANEO_ADDR_PORT);
Expand All @@ -232,6 +237,11 @@ static void write_ec_ram(u8 index, u8 val)
outb(0x12, AYANEO_DATA_PORT);
outb(0x2f, AYANEO_ADDR_PORT);
outb(val, AYANEO_DATA_PORT);

if (!unlock_global_acpi_lock())
return -EBUSY;

return ret;
}

/* Newer AIR Plus methods */
Expand Down

0 comments on commit 0a2cd16

Please sign in to comment.