diff options
author | Jean Delvare <jdelvare@suse.de> | 2016-01-16 00:08:44 +0300 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2016-01-16 00:08:44 +0300 |
commit | 96e239434c629491e57a359a2f876b6d41476336 (patch) | |
tree | 8392ace0b261fa74908eb9fc857459601bfc3764 /drivers/firmware | |
parent | afd2ff9b7e1b367172f18ba7f693dfb62bdcb2dc (diff) | |
download | linux-96e239434c629491e57a359a2f876b6d41476336.tar.xz |
firmware: dmi_scan: Optimize dmi_save_extended_devices
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>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/dmi_scan.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 0e08e665f715..28b2f0af35fd 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -345,15 +345,17 @@ static void __init dmi_save_dev_onboard(int instance, int segment, int bus, 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) |