All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: Jean Delvare <jdelvare@suse.com>
Cc: linux-kernel@vger.kernel.org
Subject: [RESEND][PATCH 2/2] firmware: dmi: Log board vendor if no system vendor has been given
Date: Sun, 2 Jan 2022 23:24:14 +0000 (GMT)	[thread overview]
Message-ID: <alpine.DEB.2.21.2201020131540.56863@angie.orcam.me.uk> (raw)
In-Reply-To: <alpine.DEB.2.21.2201020127140.56863@angie.orcam.me.uk>

Some systems do not provide any names with System Information, e.g. the 
Tyan Tomcat IV S1564D mainboard reports:

Legacy DMI 2.0 present.
DMI:  /i430HX, BIOS 4.51 PG 05/13/98

This is not unreasonable given that it was retailed as a bare mainboard 
rather that a complete system, so no information could have been known 
about the integrator.  It does have the manufacturer correctly recorded 
with Base Board Information though:

Handle 0x0001
	DMI type 1, 8 bytes.
	System Information
		Manufacturer:
		Product Name:
		Version:
		Serial Number:
Handle 0x0002
	DMI type 2, 8 bytes.
	Base Board Information
		Manufacturer: Tyan Computer Corp
		Product Name: i430HX
		Version:
		Serial Number:

Resort to logging the board manufacturer then if none has been given for 
the system.  Also refrain from including the separating slash if no name 
has been given for the system.

Output is now:

Legacy DMI 2.0 present.
DMI: Tyan Computer Corp i430HX, BIOS 4.51 PG 05/13/98

for said board, surely more informative (of course a better name could 
have been chosen for the product than just "i430HX", but there you go).

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
---
 drivers/firmware/dmi_scan.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

linux-dmi-board-vendor.diff
Index: linux-macro-ide-tty/drivers/firmware/dmi_scan.c
===================================================================
--- linux-macro-ide-tty.orig/drivers/firmware/dmi_scan.c
+++ linux-macro-ide-tty/drivers/firmware/dmi_scan.c
@@ -535,17 +535,23 @@ static int __init print_filtered(char *b
 static void __init dmi_format_ids(char *buf, size_t len)
 {
 	int c = 0;
+	const char *vendor;
 	const char *board;	/* Board Name is optional */
+	const char *name;
 
-	c += print_filtered(buf + c, len - c,
-			    dmi_get_system_info(DMI_SYS_VENDOR));
+	vendor = dmi_get_system_info(DMI_SYS_VENDOR);
+	if (!vendor || !*vendor)
+		vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
+	c += print_filtered(buf + c, len - c, vendor);
 	c += scnprintf(buf + c, len - c, " ");
-	c += print_filtered(buf + c, len - c,
-			    dmi_get_system_info(DMI_PRODUCT_NAME));
+
+	name = dmi_get_system_info(DMI_PRODUCT_NAME);
+	c += print_filtered(buf + c, len - c, name);
 
 	board = dmi_get_system_info(DMI_BOARD_NAME);
 	if (board && *board) {
-		c += scnprintf(buf + c, len - c, "/");
+		if (name && *name)
+			c += scnprintf(buf + c, len - c, "/");
 		c += print_filtered(buf + c, len - c, board);
 	}
 	c += scnprintf(buf + c, len - c, ", BIOS ");

  parent reply	other threads:[~2022-01-02 23:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-02 23:24 [RESEND][PATCH 0/2] firmware: dmi: Avoid (some) empty names in kernel log Maciej W. Rozycki
2022-01-02 23:24 ` [RESEND][PATCH 1/2] firmware: dmi: Prevent empty board name from being logged Maciej W. Rozycki
2022-01-02 23:24 ` Maciej W. Rozycki [this message]
2022-02-01 10:49 ` [PING][PATCH 0/2] firmware: dmi: Avoid (some) empty names in kernel log Maciej W. Rozycki
2022-02-15 21:29 ` [PING^2][PATCH " Maciej W. Rozycki
2022-03-01 20:43 ` [PING^3][PATCH " Maciej W. Rozycki
2022-03-30 12:50 ` [PING^4][PATCH " Maciej W. Rozycki
2022-04-13 22:53 ` [PING^5][PATCH " Maciej W. Rozycki
2022-04-20 19:22 ` [PING^6][PATCH " Maciej W. Rozycki
     [not found]   ` <alpine.DEB.2.21.2204271211090.9383@angie.orcam.me.uk>
2022-04-27 15:19     ` Jean Delvare
2022-04-27 16:53       ` Maciej W. Rozycki

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=alpine.DEB.2.21.2201020131540.56863@angie.orcam.me.uk \
    --to=macro@orcam.me.uk \
    --cc=jdelvare@suse.com \
    --cc=linux-kernel@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.