Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Use acpi_compatible_match().
details: https://anonhg.NetBSD.org/src/rev/163195206e1e
branches: trunk
changeset: 959025:163195206e1e
user: thorpej <thorpej%NetBSD.org@localhost>
date: Fri Jan 29 15:49:55 2021 +0000
description:
Use acpi_compatible_match().
diffstat:
sys/dev/acpi/acpi_cppc.c | 19 +++++++------------
sys/dev/acpi/acpi_ec.c | 15 ++++++---------
sys/dev/acpi/acpi_fan.c | 15 ++++++---------
sys/dev/acpi/acpi_ged.c | 15 ++++++---------
sys/dev/acpi/acpi_lid.c | 15 ++++++---------
sys/dev/acpi/acpi_pcd.c | 15 ++++++---------
sys/dev/acpi/acpi_pmtr.c | 15 ++++++---------
sys/dev/acpi/aibs_acpi.c | 15 ++++++---------
sys/dev/acpi/amdccp_acpi.c | 15 ++++++---------
sys/dev/acpi/apple_smc_acpi.c | 18 ++++++------------
sys/dev/acpi/asus_acpi.c | 15 ++++++---------
sys/dev/acpi/atppc_acpi.c | 15 ++++++---------
sys/dev/acpi/attimer_acpi.c | 15 ++++++---------
sys/dev/acpi/dalb_acpi.c | 15 ++++++---------
sys/dev/acpi/ehci_acpi.c | 21 +++++++++++----------
sys/dev/acpi/fdc_acpi.c | 15 ++++++---------
sys/dev/acpi/fujbp_acpi.c | 15 ++++++---------
sys/dev/acpi/fujhk_acpi.c | 15 ++++++---------
sys/dev/acpi/genet_acpi.c | 15 ++++++---------
sys/dev/acpi/hpacel_acpi.c | 15 ++++++---------
sys/dev/acpi/hpet_acpi.c | 19 +++++++++----------
sys/dev/acpi/hpqlb_acpi.c | 17 +++++++----------
sys/dev/acpi/ipmi_acpi.c | 18 ++++++------------
sys/dev/acpi/joy_acpi.c | 15 ++++++---------
sys/dev/acpi/lpt_acpi.c | 15 ++++++---------
sys/dev/acpi/mpu_acpi.c | 15 ++++++---------
sys/dev/acpi/pcppi_acpi.c | 15 ++++++---------
sys/dev/acpi/plgpio_acpi.c | 15 ++++++---------
sys/dev/acpi/qemufwcfg_acpi.c | 15 ++++++---------
sys/dev/acpi/smbus_acpi.c | 19 +++++++++----------
sys/dev/acpi/sony_acpi.c | 15 ++++++---------
sys/dev/acpi/spic_acpi.c | 15 ++++++---------
sys/dev/acpi/thinkpad_acpi.c | 21 ++++++++++-----------
sys/dev/acpi/ug_acpi.c | 15 ++++++---------
sys/dev/acpi/vald_acpi.c | 15 ++++++---------
sys/dev/acpi/valz_acpi.c | 15 ++++++---------
sys/dev/acpi/virtio_acpi.c | 15 ++++++---------
sys/dev/acpi/vmbus_acpi.c | 21 +++++++++------------
sys/dev/acpi/wmi/wmi_acpi.c | 17 +++++++----------
sys/dev/acpi/xhci_acpi.c | 25 ++++++++++++++-----------
40 files changed, 269 insertions(+), 381 deletions(-)
diffs (truncated from 1801 to 300 lines):
diff -r dec0d7ce0a7a -r 163195206e1e sys/dev/acpi/acpi_cppc.c
--- a/sys/dev/acpi/acpi_cppc.c Fri Jan 29 15:24:00 2021 +0000
+++ b/sys/dev/acpi/acpi_cppc.c Fri Jan 29 15:49:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cppc.c,v 1.1 2020/12/13 20:39:20 jmcneill Exp $ */
+/* $NetBSD: acpi_cppc.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $ */
/*-
* Copyright (c) 2020 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cppc.c,v 1.1 2020/12/13 20:39:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cppc.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -104,9 +104,9 @@
CFATTACH_DECL_NEW(acpicppc, sizeof(struct cppc_softc),
cppc_match, cppc_attach, NULL, NULL);
-static const char * const compatible[] = {
- "ACPI0007", /* ACPI Processor Device */
- NULL
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "ACPI0007" }, /* ACPI Processor Device */
+ DEVICE_COMPAT_EOL
};
static int
@@ -116,13 +116,8 @@
ACPI_HANDLE handle;
ACPI_STATUS rv;
- if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE) {
+ if (acpi_compatible_match(aa, compat_data) == 0)
return 0;
- }
-
- if (acpi_match_hid(aa->aa_node->ad_devinfo, compatible) == 0) {
- return 0;
- }
rv = AcpiGetHandle(aa->aa_node->ad_handle, "_CPC", &handle);
if (ACPI_FAILURE(rv)) {
@@ -134,7 +129,7 @@
}
/* When CPPC and P-states/T-states are both available, prefer CPPC */
- return 20;
+ return ACPI_MATCHSCORE_CID_MAX + 1;
}
static void
diff -r dec0d7ce0a7a -r 163195206e1e sys/dev/acpi/acpi_ec.c
--- a/sys/dev/acpi/acpi_ec.c Fri Jan 29 15:24:00 2021 +0000
+++ b/sys/dev/acpi/acpi_ec.c Fri Jan 29 15:49:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_ec.c,v 1.84 2020/06/15 15:29:46 jdolecek Exp $ */
+/* $NetBSD: acpi_ec.c,v 1.85 2021/01/29 15:49:55 thorpej Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.84 2020/06/15 15:29:46 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.85 2021/01/29 15:49:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/callout.h>
@@ -101,9 +101,9 @@
#define EC_STATUS_SCI 0x20
#define EC_STATUS_SMI 0x40
-static const char * const ec_hid[] = {
- "PNP0C09",
- NULL,
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "PNP0C09" },
+ DEVICE_COMPAT_EOL
};
enum ec_state_t {
@@ -246,10 +246,7 @@
{
struct acpi_attach_args *aa = aux;
- if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
- return 0;
-
- return acpi_match_hid(aa->aa_node->ad_devinfo, ec_hid);
+ return acpi_compatible_match(aa, compat_data);
}
static void
diff -r dec0d7ce0a7a -r 163195206e1e sys/dev/acpi/acpi_fan.c
--- a/sys/dev/acpi/acpi_fan.c Fri Jan 29 15:24:00 2021 +0000
+++ b/sys/dev/acpi/acpi_fan.c Fri Jan 29 15:49:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_fan.c,v 1.8 2015/04/23 23:23:00 pgoyette Exp $ */
+/* $NetBSD: acpi_fan.c,v 1.9 2021/01/29 15:49:55 thorpej Exp $ */
/*-
* Copyright (c) 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_fan.c,v 1.8 2015/04/23 23:23:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_fan.c,v 1.9 2021/01/29 15:49:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/module.h>
@@ -48,9 +48,9 @@
envsys_data_t sc_sensor;
};
-const char * const acpi_fan_ids[] = {
- "PNP0C0B",
- NULL
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "PNP0C0B" },
+ DEVICE_COMPAT_EOL
};
static int acpifan_match(device_t, cfdata_t, void *);
@@ -71,10 +71,7 @@
{
struct acpi_attach_args *aa = aux;
- if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
- return 0;
-
- return acpi_match_hid(aa->aa_node->ad_devinfo, acpi_fan_ids);
+ return acpi_compatible_match(aa, compat_data);
}
static void
diff -r dec0d7ce0a7a -r 163195206e1e sys/dev/acpi/acpi_ged.c
--- a/sys/dev/acpi/acpi_ged.c Fri Jan 29 15:24:00 2021 +0000
+++ b/sys/dev/acpi/acpi_ged.c Fri Jan 29 15:49:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_ged.c,v 1.2 2020/10/23 11:00:09 jmcneill Exp $ */
+/* $NetBSD: acpi_ged.c,v 1.3 2021/01/29 15:49:55 thorpej Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ged.c,v 1.2 2020/10/23 11:00:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ged.c,v 1.3 2021/01/29 15:49:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -52,9 +52,9 @@
CFATTACH_DECL_NEW(acpiged, 0, acpi_ged_match, acpi_ged_attach, NULL, NULL);
-static const char * const compatible[] = {
- "ACPI0013",
- NULL
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "ACPI0013" },
+ DEVICE_COMPAT_EOL
};
static int
@@ -62,10 +62,7 @@
{
struct acpi_attach_args *aa = aux;
- if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
- return 0;
-
- return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
+ return acpi_compatible_match(aa, compat_data);
}
static void
diff -r dec0d7ce0a7a -r 163195206e1e sys/dev/acpi/acpi_lid.c
--- a/sys/dev/acpi/acpi_lid.c Fri Jan 29 15:24:00 2021 +0000
+++ b/sys/dev/acpi/acpi_lid.c Fri Jan 29 15:49:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_lid.c,v 1.44 2015/04/23 23:23:00 pgoyette Exp $ */
+/* $NetBSD: acpi_lid.c,v 1.45 2021/01/29 15:49:55 thorpej Exp $ */
/*
* Copyright 2001, 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.44 2015/04/23 23:23:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.45 2021/01/29 15:49:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -61,9 +61,9 @@
uint64_t sc_status;
};
-static const char * const lid_hid[] = {
- "PNP0C0D",
- NULL
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "PNP0C0D" },
+ DEVICE_COMPAT_EOL
};
static int acpilid_match(device_t, cfdata_t, void *);
@@ -85,10 +85,7 @@
{
struct acpi_attach_args *aa = aux;
- if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
- return 0;
-
- return acpi_match_hid(aa->aa_node->ad_devinfo, lid_hid);
+ return acpi_compatible_match(aa, compat_data);
}
/*
diff -r dec0d7ce0a7a -r 163195206e1e sys/dev/acpi/acpi_pcd.c
--- a/sys/dev/acpi/acpi_pcd.c Fri Jan 29 15:24:00 2021 +0000
+++ b/sys/dev/acpi/acpi_pcd.c Fri Jan 29 15:49:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pcd.c,v 1.1 2020/12/07 10:57:41 jmcneill Exp $ */
+/* $NetBSD: acpi_pcd.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $ */
/*-
* Copyright (c) 2020 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pcd.c,v 1.1 2020/12/07 10:57:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pcd.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -43,9 +43,9 @@
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
-static const char * const compatible[] = {
- "ACPI0010", /* Processor Container Device */
- NULL
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "ACPI0010" }, /* Processor Container Device */
+ DEVICE_COMPAT_EOL
};
static int acpi_pcd_match(device_t, cfdata_t, void *);
@@ -58,10 +58,7 @@
{
struct acpi_attach_args *aa = aux;
- if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
- return 0;
-
- return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
+ return acpi_compatible_match(aa, compat_data);
}
static void
diff -r dec0d7ce0a7a -r 163195206e1e sys/dev/acpi/acpi_pmtr.c
--- a/sys/dev/acpi/acpi_pmtr.c Fri Jan 29 15:24:00 2021 +0000
+++ b/sys/dev/acpi/acpi_pmtr.c Fri Jan 29 15:49:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pmtr.c,v 1.8 2015/04/23 23:23:00 pgoyette Exp $ */
+/* $NetBSD: acpi_pmtr.c,v 1.9 2021/01/29 15:49:55 thorpej Exp $ */
/*-
* Copyright (c) 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pmtr.c,v 1.8 2015/04/23 23:23:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pmtr.c,v 1.9 2021/01/29 15:49:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/module.h>
@@ -83,9 +83,9 @@
kmutex_t sc_mtx;
};
-const char * const acpi_pmtr_ids[] = {
- "ACPI000D",
- NULL
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "ACPI000D" },
+ DEVICE_COMPAT_EOL
};
Home |
Main Index |
Thread Index |
Old Index