Skip to contentSkip to conversation

drm/radeon/kms: Shorten buffers in radeon_ddc_probe

PATCH In review Jean Delvare 1 participant 2 messages Jun 27, 2011 – Jul 12, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon/kms: Shorten buffers in radeon_ddc_probe

No need for 2-byte buffers, we only send one byte and receive one byte.

Cc David Airlie <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/radeon/radeon_i2c.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_i2c.c +3 -4
@@ -34,21 +34,20 @@
  */
 bool radeon_ddc_probe(struct radeon_connector *radeon_connector)
 {
-	u8 out_buf[] = { 0x0, 0x0};
-	u8 buf[2];
+	u8 out = 0x0, in;
 	int ret;
 	struct i2c_msg msgs[] = {
 		{
 			.addr = 0x50,
 			.flags = 0,
 			.len = 1,
-			.buf = out_buf,
+			.buf = &out,
 		},
 		{
 			.addr = 0x50,
 			.flags = I2C_M_RD,
 			.len = 1,
-			.buf = buf,
+			.buf = &in,
 		}
 	};
 
Signature · 1 line
Jean Delvare
#1 lore raw
Quoted 26 lines · Jean Delvare

No need for 2-byte buffers, we only send one byte and receive one byte.

Cc David Airlie <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/radeon/radeon_i2c.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_i2c.c +1 -3
@@ -34,21 +34,20 @@
  */
 bool radeon_ddc_probe(struct radeon_connector *radeon_connector)
 {
-	u8 out_buf[] = { 0x0, 0x0};
-	u8 buf[2];
+	u8 out = 0x0, in;
 	int ret;
 	struct i2c_msg msgs[] = {
 		{
 			.addr = 0x50,
 			.flags = 0,
 			.len = 1,
-			.buf = out_buf,

drivers/gpu/drm/radeon/radeon_i2c.c line 52

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_i2c.c +2 -1
+			.buf = &out,
 		},
 		{
 			.addr = 0x50,
 			.flags = I2C_M_RD,
 			.len = 1,
-			.buf = buf,
+			.buf = &in,
 		}
 	};

Please disregard this patch, it is superseded by a more important workaround by Thomas Reim.

Signature · 1 line
Jean Delvare