Linux I2C development
 help / color / mirror / Atom feed
* [PATCH 1/2] i2c: acpi: Use I2C_M_DMA_SAFE in acpi_gsb_i2c_[read|write]_bytes()
@ 2026-09-19 19:36 Hans de Goede
  2026-09-19 19:36 ` [PATCH 2/2] i2c: acpi: Add AttribRawBytes accessor-type support to OpRegion handler Hans de Goede
  2026-09-21  5:17 ` [PATCH 1/2] i2c: acpi: Use I2C_M_DMA_SAFE in acpi_gsb_i2c_[read|write]_bytes() Mika Westerberg
  0 siblings, 2 replies; 4+ messages in thread
From: Hans de Goede @ 2026-09-19 19:36 UTC (permalink / raw)
  To: Andi Shyti, Mika Westerberg; +Cc: Hans de Goede, linux-i2c, linux-acpi

The main read / write "buffer" is kzalloc()ed and as such is safe to
directly use for DMA (unlike stack mem). Add the I2C_M_DMA_SAFE flag
to the transfers using these buffers.

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
---
 drivers/i2c/i2c-core-acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index 8f3bdd50186e..583d89c626e3 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -607,7 +607,7 @@ static int acpi_gsb_i2c_read_bytes(struct i2c_client *client,
 	msgs[0].buf = &cmd;
 
 	msgs[1].addr = client->addr;
-	msgs[1].flags = client->flags | I2C_M_RD;
+	msgs[1].flags = client->flags | I2C_M_RD | I2C_M_DMA_SAFE;
 	msgs[1].len = data_len;
 	msgs[1].buf = buffer;
 
@@ -648,7 +648,7 @@ static int acpi_gsb_i2c_write_bytes(struct i2c_client *client,
 	memcpy(buffer + 1, data, data_len);
 
 	msgs[0].addr = client->addr;
-	msgs[0].flags = client->flags;
+	msgs[0].flags = client->flags | I2C_M_DMA_SAFE;
 	msgs[0].len = data_len + 1;
 	msgs[0].buf = buffer;
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-21  5:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-19 19:36 [PATCH 1/2] i2c: acpi: Use I2C_M_DMA_SAFE in acpi_gsb_i2c_[read|write]_bytes() Hans de Goede
2026-09-19 19:36 ` [PATCH 2/2] i2c: acpi: Add AttribRawBytes accessor-type support to OpRegion handler Hans de Goede
2026-09-21  5:18   ` Mika Westerberg
2026-09-21  5:17 ` [PATCH 1/2] i2c: acpi: Use I2C_M_DMA_SAFE in acpi_gsb_i2c_[read|write]_bytes() Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox