All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: (abituguru3) Support multiple DMI
Date: Sun, 06 Sep 2009 09:37:11 +0000	[thread overview]
Message-ID: <4AA382C7.4000108@redhat.com> (raw)
In-Reply-To: <1252170780-4141-1-git-send-email-alistair@devzero.co.uk>

Hi,

Looks perfect now.

Acked-by: Hans de Goede<hdegoede@redhat.com>

Regards,

Hans


On 09/06/2009 11:15 AM, Alistair John Strachan wrote:
> Most known Abit motherboards have unique uguru chip IDs. However,
> some "refresh" boards keep the same chip ID but have a different
> DMI string. As our DMI board string matching is (necessarily)
> strict, some boards were failing DMI detection, and as the old
> probe method was also failing, the driver would not load.
>
> The only known boards affected by this problem are the IP35 Pro XE
> (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to
> relax the match criteria, as some boards (e.g. the AB9 Quad GT)
> have different uguru chip IDs.
>
> This patch replaces the dmi_name string with a NULL terminated
> array of strings to be matched per uguru chip ID. It has been
> compile and runtime tested (thanks Rune).
>
> References: https://bugs.launchpad.net/bugs/298798
>
> Signed-off-by: Alistair John Strachan<alistair@devzero.co.uk>
> Tested-by: Rune Svendsen<runesvend@gmail.com>
> Cc: Rune Svendsen<runesvend@gmail.com>
> Cc: Hans de Goede<hdegoede@redhat.com>
> Cc: lm-sensors@lm-sensors.org
>
> ---
>   drivers/hwmon/abituguru3.c |   63 +++++++++++++++++++++++--------------------
>   1 files changed, 34 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
> index 7d3f15d..5203ec2 100644
> --- a/drivers/hwmon/abituguru3.c
> +++ b/drivers/hwmon/abituguru3.c
> @@ -117,9 +117,12 @@ struct abituguru3_sensor_info {
>   	int offset;
>   };
>
> +/* Avoid use of flexible array members */
> +#define ABIT_UGURU3_MAX_DMI_NAMES 2
> +
>   struct abituguru3_motherboard_info {
>   	u16 id;
> -	const char *dmi_name;
> +	const char *dmi_name[ABIT_UGURU3_MAX_DMI_NAMES + 1];
>   	/* + 1 ->  end of sensors indicated by a sensor with name = NULL */
>   	struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS + 1];
>   };
> @@ -164,7 +167,7 @@ struct abituguru3_data {
>
>   /* Constants */
>   static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
> -	{ 0x000C, NULL /* Unknown, need DMI string */, {
> +	{ 0x000C, { NULL } /* Unknown, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 10, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -186,7 +189,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX1 Fan",		35, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x000D, NULL /* Abit AW8, need DMI string */, {
> +	{ 0x000D, { NULL } /* Abit AW8, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 10, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -215,7 +218,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX5 Fan",		39, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x000E, NULL /* AL-8, need DMI string */, {
> +	{ 0x000E, { NULL } /* AL-8, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 10, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -236,7 +239,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "SYS Fan",		34, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x000F, NULL /* Unknown, need DMI string */, {
> +	{ 0x000F, { NULL } /* Unknown, need DMI string */, {
> +
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 10, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -257,7 +261,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "SYS Fan",		34, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, {
> +	{ 0x0010, { NULL } /* Abit NI8 SLI GR, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 10, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -279,7 +283,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "OTES1 Fan",		36, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0011, "AT8 32X", {
> +	{ 0x0011, { "AT8 32X", NULL }, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 20, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -306,7 +310,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX3 Fan",		37, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0012, NULL /* Abit AN8 32X, need DMI string */, {
> +	{ 0x0012, { NULL } /* Abit AN8 32X, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 20, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -328,7 +332,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX1 Fan",		36, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0013, NULL /* Abit AW8D, need DMI string */, {
> +	{ 0x0013, { NULL } /* Abit AW8D, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 10, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -357,7 +361,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX5 Fan",		39, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0014, "AB9", /* + AB9 Pro */ {
> +	{ 0x0014, { "AB9", "AB9 Pro", NULL }, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 10, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -378,7 +382,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "SYS Fan",		34, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0015, NULL /* Unknown, need DMI string */, {
> +	{ 0x0015, { NULL } /* Unknown, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR",		 1, 0, 20, 1, 0 },
>   		{ "DDR VTT",		 2, 0, 10, 1, 0 },
> @@ -402,7 +406,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX3 Fan",		36, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0016, "AW9D-MAX", {
> +	{ 0x0016, { "AW9D-MAX", NULL }, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR2",		 1, 0, 20, 1, 0 },
>   		{ "DDR2 VTT",		 2, 0, 10, 1, 0 },
> @@ -430,7 +434,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "OTES1 Fan",		38, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0017, NULL /* Unknown, need DMI string */, {
> +	{ 0x0017, { NULL } /* Unknown, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR2",		 1, 0, 20, 1, 0 },
>   		{ "DDR2 VTT",		 2, 0, 10, 1, 0 },
> @@ -455,7 +459,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX3 FAN",		37, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0018, "AB9 QuadGT", {
> +	{ 0x0018, { "AB9 QuadGT", NULL }, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR2",		 1, 0, 20, 1, 0 },
>   		{ "DDR2 VTT",		 2, 0, 10, 1, 0 },
> @@ -482,7 +486,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX3 Fan",		36, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0019, "IN9 32X MAX", {
> +	{ 0x0019, { "IN9 32X MAX", NULL }, {
>   		{ "CPU Core",		 7, 0, 10, 1, 0 },
>   		{ "DDR2",		13, 0, 20, 1, 0 },
>   		{ "DDR2 VTT",		14, 0, 10, 1, 0 },
> @@ -509,7 +513,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX3 FAN",		36, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x001A, "IP35 Pro", {
> +	{ 0x001A, { "IP35 Pro", "IP35 Pro XE", NULL }, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR2",		 1, 0, 20, 1, 0 },
>   		{ "DDR2 VTT",		 2, 0, 10, 1, 0 },
> @@ -537,7 +541,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX4 Fan",		37, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x001B, NULL /* Unknown, need DMI string */, {
> +	{ 0x001B, { NULL } /* Unknown, need DMI string */, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR3",		 1, 0, 20, 1, 0 },
>   		{ "DDR3 VTT",		 2, 0, 10, 1, 0 },
> @@ -564,7 +568,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX3 Fan",		36, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x001C, "IX38 QuadGT", {
> +	{ 0x001C, { "IX38 QuadGT", NULL }, {
>   		{ "CPU Core",		 0, 0, 10, 1, 0 },
>   		{ "DDR2",		 1, 0, 20, 1, 0 },
>   		{ "DDR2 VTT",		 2, 0, 10, 1, 0 },
> @@ -591,7 +595,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
>   		{ "AUX3 Fan",		36, 2, 60, 1, 0 },
>   		{ NULL, 0, 0, 0, 0, 0 } }
>   	},
> -	{ 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } }
> +	{ 0x0000, { NULL }, { { NULL, 0, 0, 0, 0, 0 } } }
>   };
>
>
> @@ -947,7 +951,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev)
>   		"ID: %04X\n", (unsigned int)id);
>
>   #ifdef CONFIG_DMI
> -	if (!abituguru3_motherboards[i].dmi_name) {
> +	if (!abituguru3_motherboards[i].dmi_name[0]) {
>   		printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was "
>   			"not detected using DMI. Please send the output of "
>   			"\"dmidecode\" to the abituguru3 maintainer "
> @@ -1131,6 +1135,7 @@ static int __init abituguru3_dmi_detect(void)
>   {
>   	const char *board_vendor, *board_name;
>   	int i, err = (force) ? 1 : -ENODEV;
> +	const char *const *dmi_name;
>   	size_t sublen;
>
>   	board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
> @@ -1151,17 +1156,17 @@ static int __init abituguru3_dmi_detect(void)
>   		sublen--;
>
>   	for (i = 0; abituguru3_motherboards[i].id; i++) {
> -		const char *dmi_name = abituguru3_motherboards[i].dmi_name;
> -		if (!dmi_name || strlen(dmi_name) != sublen)
> -			continue;
> -		if (!strncasecmp(board_name, dmi_name, sublen))
> -			break;
> +		dmi_name = abituguru3_motherboards[i].dmi_name;
> +		for ( ; *dmi_name; dmi_name++) {
> +			if (strlen(*dmi_name) != sublen)
> +				continue;
> +			if (!strncasecmp(board_name, *dmi_name, sublen))
> +				return 0;
> +		}
>   	}
>
> -	if (!abituguru3_motherboards[i].id)
> -		return 1;
> -
> -	return 0;
> +	/* No match found */
> +	return 1;
>   }
>
>   #else /* !CONFIG_DMI */

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2009-09-06  9:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-05 17:13 [lm-sensors] [PATCH] hwmon: (abituguru3) Support multiple DMI Alistair John Strachan
2009-09-06  7:23 ` Hans de Goede
2009-09-06  9:15 ` Alistair John Strachan
2009-09-06  9:37 ` Hans de Goede [this message]
2009-09-06 12:03 ` Jean Delvare
2009-09-06 13:55 ` Alistair John Strachan
2009-09-06 14:06 ` Jean Delvare
2009-09-06 14:15 ` Rune Svendsen
2009-09-06 14:30 ` Alistair John Strachan
2009-09-06 14:41 ` Alistair John Strachan
2009-09-06 15:05 ` Rune Svendsen
2009-09-06 16:23 ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AA382C7.4000108@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.