mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Tejun Heo <htejun@gmail.com>,
	Jeff Garzik <jgarzik@redhat.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] DMI: allow omitting ident strings in DMI tables
Date: Fri, 4 Dec 2009 17:19:41 +0100	[thread overview]
Message-ID: <20091204171941.4554fa41@hyperion.delvare> (raw)
In-Reply-To: <20091204073421.GA17012@core.coreip.homeip.net>

> DMI: allow omitting ident strings in DMI tables
> 
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> The purpose of dmi->ident is twofold - it may be used by DMI callback
> functions when composing log messages; it is also used to determine
> end of DMI table in dmi_check_system() and dmi_first_match(). However,
> in case when callbacks are not interested in using ident at all it just
> wastes memory. Let's make enties with empty first match slot serve as
> end-of-table markers instead.
> 
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Looks good to me.

Acked-by: Jean Delvare <khali@linux-fr.org>

> ---
> 
>  drivers/firmware/dmi_scan.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
> index 938100f..3a2ccb0 100644
> --- a/drivers/firmware/dmi_scan.c
> +++ b/drivers/firmware/dmi_scan.c
> @@ -429,7 +429,7 @@ static bool dmi_matches(const struct dmi_system_id *dmi)
>  	for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) {
>  		int s = dmi->matches[i].slot;
>  		if (s == DMI_NONE)
> -			continue;
> +			break;
>  		if (dmi_ident[s]
>  		    && strstr(dmi_ident[s], dmi->matches[i].substr))
>  			continue;
> @@ -440,6 +440,15 @@ static bool dmi_matches(const struct dmi_system_id *dmi)
>  }
>  
>  /**
> + *	dmi_is_end_of_table - check for end-of-table marker
> + *	@dmi: pointer to the dmi_system_id structure to check
> + */
> +static bool dmi_is_end_of_table(const struct dmi_system_id *dmi)
> +{
> +	return dmi->matches[0].slot == DMI_NONE;
> +}
> +
> +/**
>   *	dmi_check_system - check system DMI data
>   *	@list: array of dmi_system_id structures to match against
>   *		All non-null elements of the list must match
> @@ -457,7 +466,7 @@ int dmi_check_system(const struct dmi_system_id *list)
>  	int count = 0;
>  	const struct dmi_system_id *d;
>  
> -	for (d = list; d->ident; d++)
> +	for (d = list; !dmi_is_end_of_table(d); d++)
>  		if (dmi_matches(d)) {
>  			count++;
>  			if (d->callback && d->callback(d))
> @@ -484,7 +493,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list)
>  {
>  	const struct dmi_system_id *d;
>  
> -	for (d = list; d->ident; d++)
> +	for (d = list; !dmi_is_end_of_table(d); d++)
>  		if (dmi_matches(d))
>  			return d;
>  


-- 
Jean Delvare

      reply	other threads:[~2009-12-04 16:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03  3:12 Dmitry Torokhov
2009-12-03  8:30 ` Jean Delvare
2009-12-03  8:56   ` Dmitry Torokhov
2009-12-03  9:25     ` Jean Delvare
2009-12-04  7:34       ` Dmitry Torokhov
2009-12-04 16:19         ` Jean Delvare [this message]

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=20091204171941.4554fa41@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=htejun@gmail.com \
    --cc=jgarzik@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome