[coreboot-gerrit] New patch to review for coreboot: 0ec60bb ec/kontron/it8516e: Remove some unsafe bit shifting

Nico Huber (nico.huber@secunet.com) gerrit at coreboot.org
Thu Jul 18 12:35:51 CEST 2013


Nico Huber (nico.huber at secunet.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3785

-gerrit

commit 0ec60bba93ca4fd890770ad9d5300a6f277117ce
Author: Nico Huber <nico.huber at secunet.com>
Date:   Thu Jul 18 11:27:30 2013 +0200

    ec/kontron/it8516e: Remove some unsafe bit shifting
    
    The EC expects the temperature in 64ths degree C. Alter
    it8516e_set_fan_temperature() to just export this interface and
    make the calculation more obvious.
    
    Change-Id: Ibe241b7909f4c02b30b1e1200a1850d47695a765
    Signed-off-by: Nico Huber <nico.huber at secunet.com>
---
 src/ec/kontron/it8516e/ec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ec/kontron/it8516e/ec.c b/src/ec/kontron/it8516e/ec.c
index d4e6019..858ded5 100644
--- a/src/ec/kontron/it8516e/ec.c
+++ b/src/ec/kontron/it8516e/ec.c
@@ -79,15 +79,15 @@ static void it8516e_set_fan_speed(const u8 idx, const u16 speed)
 	send_ec_data(speed >> 8);
 }
 
-static void it8516e_set_fan_temperature(const u8 idx, const u8 temp)
+static void it8516e_set_fan_temperature(const u8 idx, const u16 temp)
 {
 	if (send_ec_command(IT8516E_CMD_SET_FAN_TEMP))
 		return;
 	if (send_ec_data(idx))
 		return;
-	if (send_ec_data((temp << 6) & 0xff))
+	if (send_ec_data(temp & 0xff))
 		return;
-	send_ec_data(((temp << 6) >> 8) & 0xff);
+	send_ec_data(temp >> 8);
 }
 
 static void it8516e_set_fan_limits(const u8 idx, const u8 min, const u8 max)
@@ -147,7 +147,7 @@ static void it8516e_set_fan_from_options(const config_t *const config,
 		printk(BIOS_DEBUG,
 		       "Setting it8516e fan%d control to %d C.\n",
 		       fan_idx + 1, fan_target);
-		it8516e_set_fan_temperature(fan_idx, fan_target);
+		it8516e_set_fan_temperature(fan_idx, fan_target * 64);
 
 		fanX_min[3] = '1' + fan_idx;
 		fanX_max[3] = '1' + fan_idx;



More information about the coreboot-gerrit mailing list