Patchwork bios: hdaaudio: skip the test if no BIOS pin config found (LP: #1201903)

login
register
mail settings
Submitter Colin King
Date July 16, 2013, 5:39 p.m.
Message ID <1373996344-13984-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/259477/
State Accepted
Headers show

Comments

Colin King - July 16, 2013, 5:39 p.m.
From: Colin Ian King <colin.king@canonical.com>

We should print out a message and skip the test rather than silently
do nothing if no BIOS audio pin configs are found.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/bios/hdaaudio/hdaaudio.c | 6 ++++++
 1 file changed, 6 insertions(+)
Ivan Hu - July 16, 2013, 11:19 p.m.
On 07/17/2013 01:39 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> We should print out a message and skip the test rather than silently
> do nothing if no BIOS audio pin configs are found.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/bios/hdaaudio/hdaaudio.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/src/bios/hdaaudio/hdaaudio.c b/src/bios/hdaaudio/hdaaudio.c
> index ad482b6..6d47228 100644
> --- a/src/bios/hdaaudio/hdaaudio.c
> +++ b/src/bios/hdaaudio/hdaaudio.c
> @@ -150,6 +150,7 @@ static int hda_audio_test1(fwts_framework *fw)
>   {
>   	DIR *dir;
>   	struct dirent *directory;
> +	bool checked = false;
>
>   	if ((dir = opendir("/sys/class/sound/")) == NULL)
>   		return FWTS_ERROR;
> @@ -157,6 +158,8 @@ static int hda_audio_test1(fwts_framework *fw)
>   	while ((directory = readdir(dir)) != NULL)
>   		if (strncmp(directory->d_name, "hw", 2) == 0) {
>   			char path[PATH_MAX];
> +
> +			checked = true;
>   			snprintf(path, sizeof(path), "/sys/class/sound/%s",
>   				directory->d_name);
>   			fwts_log_info(fw, "Checking '%s':", directory->d_name);
> @@ -166,6 +169,9 @@ static int hda_audio_test1(fwts_framework *fw)
>
>   	closedir(dir);
>
> +	if (!checked)
> +		fwts_skipped(fw, "Cannot find any BIOS set audio pin configurations.");
> +
>   	return FWTS_OK;
>   }
>
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Keng-Yu Lin - July 26, 2013, 4:08 a.m.
On Wed, Jul 17, 2013 at 1:39 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> We should print out a message and skip the test rather than silently
> do nothing if no BIOS audio pin configs are found.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/bios/hdaaudio/hdaaudio.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/bios/hdaaudio/hdaaudio.c b/src/bios/hdaaudio/hdaaudio.c
> index ad482b6..6d47228 100644
> --- a/src/bios/hdaaudio/hdaaudio.c
> +++ b/src/bios/hdaaudio/hdaaudio.c
> @@ -150,6 +150,7 @@ static int hda_audio_test1(fwts_framework *fw)
>  {
>         DIR *dir;
>         struct dirent *directory;
> +       bool checked = false;
>
>         if ((dir = opendir("/sys/class/sound/")) == NULL)
>                 return FWTS_ERROR;
> @@ -157,6 +158,8 @@ static int hda_audio_test1(fwts_framework *fw)
>         while ((directory = readdir(dir)) != NULL)
>                 if (strncmp(directory->d_name, "hw", 2) == 0) {
>                         char path[PATH_MAX];
> +
> +                       checked = true;
>                         snprintf(path, sizeof(path), "/sys/class/sound/%s",
>                                 directory->d_name);
>                         fwts_log_info(fw, "Checking '%s':", directory->d_name);
> @@ -166,6 +169,9 @@ static int hda_audio_test1(fwts_framework *fw)
>
>         closedir(dir);
>
> +       if (!checked)
> +               fwts_skipped(fw, "Cannot find any BIOS set audio pin configurations.");
> +
>         return FWTS_OK;
>  }
>
> --
> 1.8.1.2
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/bios/hdaaudio/hdaaudio.c b/src/bios/hdaaudio/hdaaudio.c
index ad482b6..6d47228 100644
--- a/src/bios/hdaaudio/hdaaudio.c
+++ b/src/bios/hdaaudio/hdaaudio.c
@@ -150,6 +150,7 @@  static int hda_audio_test1(fwts_framework *fw)
 {
 	DIR *dir;
 	struct dirent *directory;
+	bool checked = false;
 
 	if ((dir = opendir("/sys/class/sound/")) == NULL)
 		return FWTS_ERROR;
@@ -157,6 +158,8 @@  static int hda_audio_test1(fwts_framework *fw)
 	while ((directory = readdir(dir)) != NULL)
 		if (strncmp(directory->d_name, "hw", 2) == 0) {
 			char path[PATH_MAX];
+
+			checked = true;
 			snprintf(path, sizeof(path), "/sys/class/sound/%s",
 				directory->d_name);
 			fwts_log_info(fw, "Checking '%s':", directory->d_name);
@@ -166,6 +169,9 @@  static int hda_audio_test1(fwts_framework *fw)
 
 	closedir(dir);
 
+	if (!checked)
+		fwts_skipped(fw, "Cannot find any BIOS set audio pin configurations.");
+
 	return FWTS_OK;
 }