Received: by 10.223.185.116 with SMTP id b49csp5840494wrg; Tue, 27 Feb 2018 22:50:25 -0800 (PST) X-Google-Smtp-Source: AH8x226Oj1DilS6VHbhXfoU7DbiQpq+auHl5hRcGb9Z1pLJ5VnhNP3pyKiJcp+fbX1xfND5dhmSE X-Received: by 10.99.191.78 with SMTP id i14mr13679282pgo.9.1519800625317; Tue, 27 Feb 2018 22:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519800625; cv=none; d=google.com; s=arc-20160816; b=geli8U7kdEkRk/fsWcgR96WIH4o9NyN8ritl/h5397AWWD+k40tbuiGRs/7M7gADw9 gxgjxW/D6iQ562sngasLfK8R3XJikao04OJFPOQ7sZPRiplZr4f1PkKIBkbo4XS1848h fLzMwK0F8slPjwVa2P4P+C7v1e2q0Jdh5Mg9/mZW5xAlLOhHc1mRfS5Bo3B5GfSa9QKH NOsOjtoCiU7hnUVVDhVl6hIcKff0aU4gdxsLrpdXorZ05JPrLXGrhbp0hWw3bi8VJUg6 KePabcav/fC9hY4Ha4/Qhx/mXWEV2HDlrXvrivlKJVwB3UMPCUtER7xv7NYd0go1NrH9 yIag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :arc-authentication-results; bh=hBhtK92Ec13/bqcyn3R13sl5R7m+WgxB7T3QP0uc5i4=; b=hh6FBduZtHgSOC7TqQSS3EHi7U+KpUrAnPCCFDcagiqfV/RiQz7458P87GqShGPnbS beGYHcVoFiqqzOLpB9gqmAN7O5Hi61oUTgcHBYY2q6ciMVZi/Khw419D0DNxgB1WT/oO pSrugaVMA6J55+eu2BOFtVf6dvltD6KOz+r8GZ6IP67AXBS/uG2UlbE2z4XPKxWyHPy0 vu8KuJozvb5kM9angbWkekxspq6eBWOqwWWqHy8vZ6CnK1mhJktSjEaJGD2sHkvaHBWr xmBPwCZOqk6VKQYD1MR3JfDLNMS7oNQ1uKOkynMWJDfCnhQBNnWHaXY2dvEm9g9lb8fb L1pg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si611407pgv.816.2018.02.27.22.50.10; Tue, 27 Feb 2018 22:50:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752066AbeB1GsT (ORCPT + 99 others); Wed, 28 Feb 2018 01:48:19 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:51918 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751717AbeB1GsS (ORCPT ); Wed, 28 Feb 2018 01:48:18 -0500 Received: from 1.general.alexhung.us.vpn ([10.172.65.254] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1eqvXE-0003Tu-IU; Wed, 28 Feb 2018 06:48:16 +0000 From: Alex Hung To: jdelvare@suse.com, alex.hung@canonical.com, linux-kernel@vger.kernel.org Subject: [PATCH][V2] firmware: dmi_scan: add DMI_OEM_STRING support to dmi_matches Date: Tue, 27 Feb 2018 22:48:14 -0800 Message-Id: <1519800494-32107-1-git-send-email-alex.hung@canonical.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org OEM strings are defined by each OEM and they contain customized and useful OEM information. Supporting it provides more flexible uses of the dmi_matches function. Signed-off-by: Alex Hung --- drivers/firmware/dmi_scan.c | 11 +++++++++-- include/linux/mod_devicetable.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index e763e14..c712e66 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -775,7 +775,15 @@ static bool dmi_matches(const struct dmi_system_id *dmi) int s = dmi->matches[i].slot; if (s == DMI_NONE) break; - if (dmi_ident[s]) { + if (s == DMI_OEM_STRING) { + /* DMI_OEM_STRING must be exact match */ + const struct dmi_device *valid; + + valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, + dmi->matches[i].substr, NULL); + if (valid) + continue; + } else if (dmi_ident[s]) { if (dmi->matches[i].exact_match) { if (!strcmp(dmi_ident[s], dmi->matches[i].substr)) @@ -786,7 +794,6 @@ static bool dmi_matches(const struct dmi_system_id *dmi) continue; } } - /* No match */ return false; } diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 48fb2b4..7d361be 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -502,6 +502,7 @@ enum dmi_field { DMI_CHASSIS_SERIAL, DMI_CHASSIS_ASSET_TAG, DMI_STRING_MAX, + DMI_OEM_STRING, /* special case - will not be in dmi_ident */ }; struct dmi_strmatch { -- 2.7.4