summaryrefslogtreecommitdiffstats
path: root/resources/libreboot/patch/0013-ec-lenovo-h8-re-factor-handling-of-power_management_.patch
blob: 03f6e272142eea7f2315438bcacbe52f9fd0ac07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From fc3e9f93b5b08abe1a684550d2ddda998657882b Mon Sep 17 00:00:00 2001
From: Francis Rowe <info@gluglug.org.uk>
Date: Fri, 12 Jun 2015 23:10:52 +0100
Subject: [PATCH 13/13] ec/lenovo/h8: re-factor handling of
 power_management_beeps

The current code duplicates the same check unnecessarily,
and has no handling of when the option power_management_beeps
is not set.

Change-Id: I189c5ce382e1a270d24b9b6e897358268b9a141d
Signed-off-by: Francis Rowe <info@gluglug.org.uk>
---
 src/ec/lenovo/h8/h8.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c
index a6cb6b6..6493ec2 100644
--- a/src/ec/lenovo/h8/h8.c
+++ b/src/ec/lenovo/h8/h8.c
@@ -2,6 +2,7 @@
  * This file is part of the coreboot project.
  *
  * Copyright (C) 2011 Sven Schnelle <svens@stackframe.org>
+ * Copyright (C) 2015 Francis Rowe <info@gluglug.org.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -212,14 +213,14 @@ static void h8_enable(struct device *dev)
 	beepmask0 = conf->beepmask0;
 	beepmask1 = conf->beepmask1;
 
-	if (conf->has_power_management_beeps
-	    && get_option(&val, "power_management_beeps") == CB_SUCCESS
-	    && val == 0) {
-		beepmask0 = 0x00;
-		beepmask1 = 0x00;
-	}
-
 	if (conf->has_power_management_beeps) {
+		if (get_option(&val, "power_management_beeps") != CB_SUCCESS)
+			val = 1;
+		if (!val) {
+			beepmask0 = 0x00;
+			beepmask1 = 0x00;
+		}
+
 		if (get_option(&val, "low_battery_beep") != CB_SUCCESS)
 			val = 1;
 		if (val)
-- 
1.9.1