From patchwork Thu Jul 13 21:32:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9839597 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 E6978602A0 for ; Thu, 13 Jul 2017 21:32:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96ABA28830 for ; Thu, 13 Jul 2017 21:32:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B6DD28834; Thu, 13 Jul 2017 21:32:27 +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 334A328831 for ; Thu, 13 Jul 2017 21:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751375AbdGMVc1 (ORCPT ); Thu, 13 Jul 2017 17:32:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32920 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751153AbdGMVc1 (ORCPT ); Thu, 13 Jul 2017 17:32:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 685B8C057FA8; Thu, 13 Jul 2017 21:32:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 685B8C057FA8 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=hdegoede@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 685B8C057FA8 Received: from shalem.localdomain.com (ovpn-117-82.ams2.redhat.com [10.36.117.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6527E70920; Thu, 13 Jul 2017 21:32:25 +0000 (UTC) From: Hans de Goede To: Bartlomiej Zolnierkiewicz , Jean Delvare Cc: Hans de Goede , linux-fbdev@vger.kernel.org Subject: [PATCH v3 1/2] firmware/dmi: Export dmi_system_id_match Date: Thu, 13 Jul 2017 23:32:22 +0200 Message-Id: <20170713213223.28503-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 13 Jul 2017 21:32:26 +0000 (UTC) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In some cases a driver cannot use dmi_check_system because it needs to do more complex checks, involving runtime (non const) variables. In such case the driver will implement its own loop over a dmi_system_id table and to do the dmi matching part of the checks it needs access to dmi_system_id_match. This commit renames dmi_matches to dmi_system_id_match to better reflect what it does and exports it for use in such drivers. Signed-off-by: Hans de Goede --- Changes in v3: -Split out of "video/console: Add dmi quirk table for x86 systems which need fbcon rotation" patch --- drivers/firmware/dmi_scan.c | 9 +++++---- include/linux/dmi.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 783041964439..b48ac837f625 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -777,10 +777,10 @@ void __init dmi_set_dump_stack_arch_desc(void) } /** - * dmi_matches - check if dmi_system_id structure matches system DMI data + * dmi_system_id_match - check if dmi_system_id matches system DMI data * @dmi: pointer to the dmi_system_id structure to check */ -static bool dmi_matches(const struct dmi_system_id *dmi) +bool dmi_system_id_match(const struct dmi_system_id *dmi) { int i; @@ -804,6 +804,7 @@ static bool dmi_matches(const struct dmi_system_id *dmi) } return true; } +EXPORT_SYMBOL(dmi_system_id_match); /** * dmi_is_end_of_table - check for end-of-table marker @@ -833,7 +834,7 @@ int dmi_check_system(const struct dmi_system_id *list) const struct dmi_system_id *d; for (d = list; !dmi_is_end_of_table(d); d++) - if (dmi_matches(d)) { + if (dmi_system_id_match(d)) { count++; if (d->callback && d->callback(d)) break; @@ -860,7 +861,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list) const struct dmi_system_id *d; for (d = list; !dmi_is_end_of_table(d); d++) - if (dmi_matches(d)) + if (dmi_system_id_match(d)) return d; return NULL; diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 9bbf21a516e4..5ee3955607b3 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h @@ -96,6 +96,7 @@ struct dmi_dev_onboard { }; extern struct kobject *dmi_kobj; +extern bool dmi_system_id_match(const struct dmi_system_id *dmi); extern int dmi_check_system(const struct dmi_system_id *list); const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list); extern const char * dmi_get_system_info(int field);