From patchwork Wed Jan 31 08:40:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 10193551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C0F960383 for ; Wed, 31 Jan 2018 08:40:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DFAF2808F for ; Wed, 31 Jan 2018 08:40:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61E072859E; Wed, 31 Jan 2018 08:40:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C07E2808F for ; Wed, 31 Jan 2018 08:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752009AbeAaIkT (ORCPT ); Wed, 31 Jan 2018 03:40:19 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:38695 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752029AbeAaIkS (ORCPT ); Wed, 31 Jan 2018 03:40: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 1egnw7-0005LU-H2; Wed, 31 Jan 2018 08:40:07 +0000 From: Alex Hung To: rjw@rjwysocki.net, lenb@kernel.org, jdelvare@suse.com, gregkh@linuxfoundation.org, davem@davemloft.net, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, f.fainelli@gmail.com, dmitry.torokhov@gmail.com, kishon@ti.com, karniksayli1995@gmail.com, linux-acpi@vger.kernel.org, alex.hung@canonical.com, Mario.Limonciello@dell.com Subject: [PATCH 1/2] firmware: dmi_scan: add DMI_OEM_STRING support to dmi_matches Date: Wed, 31 Jan 2018 00:40:04 -0800 Message-Id: <1517388005-14852-1-git-send-email-alex.hung@canonical.com> X-Mailer: git-send-email 2.7.4 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 | 8 ++++++++ include/linux/mod_devicetable.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 7830419..e534d1b 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -797,11 +797,19 @@ static bool dmi_matches(const struct dmi_system_id *dmi) else if (dmi->matches[i].exact_match && !strcmp(dmi_ident[s], dmi->matches[i].substr)) continue; + } else if (s == DMI_OEM_STRING) { + const struct dmi_device *valid; + + valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, + dmi->matches[i].substr, NULL); + if (valid) + continue; } /* No match */ return false; } + return true; } diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index abb6dc2..5739c4c 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -482,6 +482,7 @@ enum dmi_field { DMI_CHASSIS_VERSION, DMI_CHASSIS_SERIAL, DMI_CHASSIS_ASSET_TAG, + DMI_OEM_STRING, DMI_STRING_MAX, };