mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Jordan Hargrave <jordan_hargrave@dell.com>,
	Narendra K <narendra_k@dell.com>
Subject: [PATCH] firmware: dmi_scan: Optimize dmi_save_extended_devices
Date: Thu, 26 Nov 2015 09:51:24 +0100	[thread overview]
Message-ID: <20151126095124.1ea4226a@endymion.delvare> (raw)

Calling dmi_string_nosave isn't cheap, so avoid calling it twice in a
row for the same string.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Jordan Hargrave <jordan_hargrave@dell.com>
Cc: Narendra K <narendra_k@dell.com>
---
 drivers/firmware/dmi_scan.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- linux-4.3.orig/drivers/firmware/dmi_scan.c	2015-11-25 20:32:26.565009189 +0100
+++ linux-4.3/drivers/firmware/dmi_scan.c	2015-11-26 09:44:34.242605581 +0100
@@ -345,15 +345,17 @@ static void __init dmi_save_dev_onboard(
 
 static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 {
+	const char *name;
 	const u8 *d = (u8 *) dm + 5;
 
 	/* Skip disabled device */
 	if ((*d & 0x80) == 0)
 		return;
 
+	name = dmi_string_nosave(dm, *(d - 1));
 	dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
-			     dmi_string_nosave(dm, *(d-1)));
-	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
+			     name);
+	dmi_save_one_device(*d & 0x7f, name);
 }
 
 static void __init count_mem_devices(const struct dmi_header *dm, void *v)

-- 
Jean Delvare
SUSE L3 Support

             reply	other threads:[~2015-11-26  8:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26  8:51 Jean Delvare [this message]
2015-11-27 12:42 ` [PATCH] firmware: dmi_scan: Clarify dmi_save_extended_devices 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=20151126095124.1ea4226a@endymion.delvare \
    --to=jdelvare@suse.de \
    --cc=jordan_hargrave@dell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narendra_k@dell.com \
    /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

all inboxes | Powered by JetHome®