Module Name: src Committed By: thorpej Date: Wed Jan 27 02:28:37 UTC 2021
Modified Files: src/sys/dev/i2c: twl4030.c Log Message: Replace 2 uses of of_match_compatible(). Also use DEVICE_COMPAT_EOL. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/twl4030.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/i2c/twl4030.c diff -u src/sys/dev/i2c/twl4030.c:1.4 src/sys/dev/i2c/twl4030.c:1.5 --- src/sys/dev/i2c/twl4030.c:1.4 Sun Jan 17 21:42:35 2021 +++ src/sys/dev/i2c/twl4030.c Wed Jan 27 02:28:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: twl4030.c,v 1.4 2021/01/17 21:42:35 thorpej Exp $ */ +/* $NetBSD: twl4030.c,v 1.5 2021/01/27 02:28:37 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill <jmcne...@invisible.ca> @@ -29,7 +29,7 @@ #include "opt_fdt.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: twl4030.c,v 1.4 2021/01/17 21:42:35 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: twl4030.c,v 1.5 2021/01/27 02:28:37 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -100,13 +100,19 @@ struct twl_pin { static const struct device_compatible_entry compat_data[] = { { .compat = "ti,twl4030" }, - - { 0 } + DEVICE_COMPAT_EOL }; #ifdef FDT -static const char * const rtc_compatible[] = { "ti,twl4030-rtc", NULL }; -static const char * const gpio_compatible[] = { "ti,twl4030-gpio", NULL }; +static const struct device_compatible_entry rtc_compat_data[] = { + { .compat = "ti,twl4030-rtc" }, + DEVICE_COMPAT_EOL +}; + +static const struct device_compatible_entry gpio_compat_data[] = { + { .compat = "ti,twl4030-gpio" }, + DEVICE_COMPAT_EOL +}; #endif static uint8_t @@ -384,10 +390,10 @@ twl_attach(device_t parent, device_t sel #ifdef FDT for (int child = OF_child(sc->sc_phandle); child; child = OF_peer(child)) { - if (of_match_compatible(child, gpio_compatible)) { + if (of_match_compat_data(child, gpio_compat_data)) { aprint_normal(", GPIO"); twl_gpio_attach(sc, child); - } else if (of_match_compatible(child, rtc_compatible)) { + } else if (of_match_compat_data(child, rtc_compat_data)) { aprint_normal(", RTC"); twl_rtc_attach(sc, child); }