Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ofw Remove "struct of_compat_data" and replace its u...
details: https://anonhg.NetBSD.org/src/rev/af469a9c0c7d
branches: trunk
changeset: 949843:af469a9c0c7d
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon Jan 18 02:35:48 2021 +0000
description:
Remove "struct of_compat_data" and replace its usage with
"struct device_compatible_entry"; they are ABI-compatible.
Fix several "loses const qualifier" bugs encountered during
this conversion.
diffstat:
sys/arch/arm/amlogic/meson_pinctrl.c | 34 ++++++++++------
sys/arch/arm/amlogic/meson_pwm.c | 15 ++++---
sys/arch/arm/amlogic/meson_thermal.c | 17 ++++----
sys/arch/arm/amlogic/meson_usbctrl.c | 15 ++++---
sys/arch/arm/amlogic/meson_usbphy.c | 17 +++++---
sys/arch/arm/amlogic/mesong12_clkc.c | 15 ++++---
sys/arch/arm/amlogic/mesongx_mmc.c | 17 ++++----
sys/arch/arm/amlogic/mesongxbb_clkc.c | 15 ++++---
sys/arch/arm/broadcom/bcm2835_emmc.c | 13 +++---
sys/arch/arm/fdt/pcihost_fdt.c | 15 ++++---
sys/arch/arm/nvidia/tegra_ahcisata.c | 18 ++++----
sys/arch/arm/nvidia/tegra_nouveau.c | 18 ++++----
sys/arch/arm/nvidia/tegra_pinmux.c | 12 +++---
sys/arch/arm/nvidia/tegra_soctherm.c | 14 ++++---
sys/arch/arm/nvidia/tegra_xusb.c | 18 ++++----
sys/arch/arm/nxp/if_enet_imx.c | 15 ++++---
sys/arch/arm/nxp/imx6_pcie.c | 16 ++++---
sys/arch/arm/nxp/imx6_spi.c | 14 ++++---
sys/arch/arm/nxp/imx8mq_usbphy.c | 11 +++--
sys/arch/arm/nxp/imx_sdhc.c | 15 ++++---
sys/arch/arm/rockchip/rk3328_iomux.c | 13 +++---
sys/arch/arm/rockchip/rk3399_iomux.c | 10 ++--
sys/arch/arm/rockchip/rk_gmac.c | 15 ++++---
sys/arch/arm/rockchip/rk_i2s.c | 19 +++++----
sys/arch/arm/rockchip/rk_pwm.c | 11 +++--
sys/arch/arm/rockchip/rk_usb.c | 15 ++++---
sys/arch/arm/rockchip/rk_v1crypto.c | 11 +++--
sys/arch/arm/rockchip/rk_vop.c | 20 ++++++----
sys/arch/arm/samsung/exynos_gpio.c | 7 ++-
sys/arch/arm/samsung/exynos_pinctrl.c | 19 +++++----
sys/arch/arm/samsung/exynos_pinctrl.h | 4 +-
sys/arch/arm/samsung/exynos_platform.c | 21 ++++++----
sys/arch/arm/samsung/exynos_usbdrdphy.c | 11 +++--
sys/arch/arm/samsung/exynos_usbphy.c | 11 +++--
sys/arch/arm/samsung/exynos_var.h | 4 +-
sys/arch/arm/sociox/if_ave.c | 21 +++++-----
sys/arch/arm/sunxi/sun4i_a10_ccu.c | 15 ++++---
sys/arch/arm/sunxi/sun4i_dma.c | 11 +++--
sys/arch/arm/sunxi/sun6i_dma.c | 23 +++++++----
sys/arch/arm/sunxi/sun8i_crypto.c | 11 +++--
sys/arch/arm/sunxi/sunxi_can.c | 11 +++--
sys/arch/arm/sunxi/sunxi_codec.c | 11 +++--
sys/arch/arm/sunxi/sunxi_codec.h | 22 ++++++----
sys/arch/arm/sunxi/sunxi_de2_ccu.c | 20 ++++++----
sys/arch/arm/sunxi/sunxi_debe.c | 16 ++++---
sys/arch/arm/sunxi/sunxi_dep.c | 13 +++---
sys/arch/arm/sunxi/sunxi_emac.c | 19 +++++----
sys/arch/arm/sunxi/sunxi_gpio.c | 65 +++++++++++++++++++++-----------
sys/arch/arm/sunxi/sunxi_hdmi.c | 16 ++++---
sys/arch/arm/sunxi/sunxi_hdmiphy.c | 17 +++++---
sys/arch/arm/sunxi/sunxi_i2s.c | 20 +++++-----
sys/arch/arm/sunxi/sunxi_lcdc.c | 17 ++++----
sys/arch/arm/sunxi/sunxi_lradc.c | 11 +++--
sys/arch/arm/sunxi/sunxi_mixer.c | 20 ++++++----
sys/arch/arm/sunxi/sunxi_mmc.c | 38 ++++++++++++-------
sys/arch/arm/sunxi/sunxi_musb.c | 19 +++++----
sys/arch/arm/sunxi/sunxi_nmi.c | 20 ++++++----
sys/arch/arm/sunxi/sunxi_pwm.c | 11 +++--
sys/arch/arm/sunxi/sunxi_rsb.c | 15 ++++---
sys/arch/arm/sunxi/sunxi_rtc.c | 38 ++++++++++++-------
sys/arch/arm/sunxi/sunxi_sid.c | 21 +++++-----
sys/arch/arm/sunxi/sunxi_tcon.c | 16 ++++---
sys/arch/arm/sunxi/sunxi_thermal.c | 21 +++++-----
sys/arch/arm/sunxi/sunxi_ts.c | 17 ++++----
sys/arch/arm/sunxi/sunxi_twi.c | 15 ++++---
sys/arch/arm/sunxi/sunxi_usb3phy.c | 13 +++---
sys/arch/arm/sunxi/sunxi_usbphy.c | 27 +++++++------
sys/arch/arm/sunxi/sunxi_wdt.c | 15 ++++---
sys/arch/arm/ti/ti_dpll_clock.c | 20 ++++++----
sys/arch/arm/ti/ti_gpio.c | 15 ++++---
sys/arch/arm/ti/ti_iic.c | 17 ++++----
sys/arch/arm/ti/ti_omapintc.c | 15 ++++---
sys/arch/arm/ti/ti_omaptimer.c | 17 ++++----
sys/arch/arm/ti/ti_sdhc.c | 23 +++++++----
sys/arch/mips/cavium/dev/octeon_cib.c | 11 +++--
sys/arch/mips/cavium/dev/octeon_intc.c | 13 +++---
sys/dev/fdt/amdccp_fdt.c | 11 +++--
sys/dev/fdt/arasan_sdhc_fdt.c | 14 ++++---
sys/dev/fdt/connector_fdt.c | 19 +++++----
sys/dev/fdt/dwc2_fdt.c | 23 +++++++----
sys/dev/fdt/dwcmmc_fdt.c | 13 +++---
sys/dev/fdt/i2cmux_fdt.c | 13 +++---
sys/dev/fdt/ns8250_uart.c | 25 ++++++------
sys/dev/fdt/panel_fdt.c | 15 ++++---
sys/dev/fdt/pinctrl_single.c | 15 ++++---
sys/dev/fdt/vmt_fdt.c | 11 +++--
sys/dev/ofw/ofw_subr.c | 13 ++++--
sys/dev/ofw/openfirm.h | 15 +++----
88 files changed, 821 insertions(+), 657 deletions(-)
diffs (truncated from 3915 to 300 lines):
diff -r 884f334cb5d2 -r af469a9c0c7d sys/arch/arm/amlogic/meson_pinctrl.c
--- a/sys/arch/arm/amlogic/meson_pinctrl.c Mon Jan 18 01:38:44 2021 +0000
+++ b/sys/arch/arm/amlogic/meson_pinctrl.c Mon Jan 18 02:35:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_pinctrl.c,v 1.7 2021/01/01 07:21:58 ryo Exp $ */
+/* $NetBSD: meson_pinctrl.c,v 1.8 2021/01/18 02:35:48 thorpej Exp $ */
/*-
* Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
#include "opt_soc.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.7 2021/01/01 07:21:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.8 2021/01/18 02:35:48 thorpej Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -71,24 +71,32 @@
bool pin_actlo;
};
-static const struct of_compat_data compat_data[] = {
+static const struct device_compatible_entry compat_data[] = {
#ifdef SOC_MESON8B
- { "amlogic,meson8b-aobus-pinctrl", (uintptr_t)&meson8b_aobus_pinctrl_config },
- { "amlogic,meson8b-cbus-pinctrl", (uintptr_t)&meson8b_cbus_pinctrl_config },
+ { .compat = "amlogic,meson8b-aobus-pinctrl",
+ .data = &meson8b_aobus_pinctrl_config },
+ { .compat = "amlogic,meson8b-cbus-pinctrl",
+ .data = &meson8b_cbus_pinctrl_config },
#endif
#ifdef SOC_MESONGXBB
- { "amlogic,meson-gxbb-aobus-pinctrl", (uintptr_t)&mesongxbb_aobus_pinctrl_config },
- { "amlogic,meson-gxbb-periphs-pinctrl", (uintptr_t)&mesongxbb_periphs_pinctrl_config },
+ { .compat = "amlogic,meson-gxbb-aobus-pinctrl",
+ .data = &mesongxbb_aobus_pinctrl_config },
+ { .compat = "amlogic,meson-gxbb-periphs-pinctrl",
+ .data = &mesongxbb_periphs_pinctrl_config },
#endif
#ifdef SOC_MESONGXL
- { "amlogic,meson-gxl-aobus-pinctrl", (uintptr_t)&mesongxl_aobus_pinctrl_config },
- { "amlogic,meson-gxl-periphs-pinctrl", (uintptr_t)&mesongxl_periphs_pinctrl_config },
+ { .compat = "amlogic,meson-gxl-aobus-pinctrl",
+ .data = &mesongxl_aobus_pinctrl_config },
+ { .compat = "amlogic,meson-gxl-periphs-pinctrl",
+ .data = &mesongxl_periphs_pinctrl_config },
#endif
#ifdef SOC_MESONG12
- { "amlogic,meson-g12a-aobus-pinctrl", (uintptr_t)&mesong12a_aobus_pinctrl_config },
- { "amlogic,meson-g12a-periphs-pinctrl", (uintptr_t)&mesong12a_periphs_pinctrl_config },
+ { .compat = "amlogic,meson-g12a-aobus-pinctrl",
+ .data = &mesong12a_aobus_pinctrl_config },
+ { .compat = "amlogic,meson-g12a-periphs-pinctrl",
+ .data = &mesong12a_periphs_pinctrl_config },
#endif
- { NULL, 0 }
+ { 0 }
};
#define MUX_READ(sc, reg) \
@@ -578,7 +586,7 @@
sc->sc_dev = self;
sc->sc_phandle = faa->faa_phandle;
sc->sc_bst = faa->faa_bst;
- sc->sc_conf = (void *)of_search_compatible(sc->sc_phandle, compat_data)->data;
+ sc->sc_conf = of_search_compatible(sc->sc_phandle, compat_data)->data;
mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM);
if (meson_pinctrl_initres(sc) != 0)
diff -r 884f334cb5d2 -r af469a9c0c7d sys/arch/arm/amlogic/meson_pwm.c
--- a/sys/arch/arm/amlogic/meson_pwm.c Mon Jan 18 01:38:44 2021 +0000
+++ b/sys/arch/arm/amlogic/meson_pwm.c Mon Jan 18 02:35:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_pwm.c,v 1.1 2021/01/01 07:21:58 ryo Exp $ */
+/* $NetBSD: meson_pwm.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $ */
/*
* Copyright (c) 2021 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_pwm.c,v 1.1 2021/01/01 07:21:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_pwm.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -65,11 +65,12 @@
#define PWM_WRITE_REG(sc, reg, val) \
bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg) * 4, (val))
-static const struct of_compat_data compat_data[] = {
- { "amlogic,meson-g12a-ao-pwm-ab", 0 },
- { "amlogic,meson-g12a-ao-pwm-cd", 0 },
- { "amlogic,meson-g12a-ee-pwm", 0 },
- { NULL }
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "amlogic,meson-g12a-ao-pwm-ab" },
+ { .compat = "amlogic,meson-g12a-ao-pwm-cd" },
+ { .compat = "amlogic,meson-g12a-ee-pwm" },
+
+ { 0 }
};
#define MESON_PWM_NCHAN 2
diff -r 884f334cb5d2 -r af469a9c0c7d sys/arch/arm/amlogic/meson_thermal.c
--- a/sys/arch/arm/amlogic/meson_thermal.c Mon Jan 18 01:38:44 2021 +0000
+++ b/sys/arch/arm/amlogic/meson_thermal.c Mon Jan 18 02:35:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_thermal.c,v 1.2 2021/01/08 00:13:20 macallan Exp $ */
+/* $NetBSD: meson_thermal.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $ */
/*
* Copyright (c) 2021 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_thermal.c,v 1.2 2021/01/08 00:13:20 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_thermal.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -87,10 +87,11 @@
.aosec_reg = 0xf0
};
-static const struct of_compat_data compat_data[] = {
- { "amlogic,g12a-cpu-thermal", (uintptr_t)&thermal_cpu_conf },
- { "amlogic,g12a-ddr-thermal", (uintptr_t)&thermal_ddr_conf },
- { NULL }
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "amlogic,g12a-cpu-thermal", .data = &thermal_cpu_conf },
+ { .compat = "amlogic,g12a-ddr-thermal", .data = &thermal_ddr_conf },
+
+ { 0 }
};
struct meson_thermal_softc {
@@ -98,7 +99,7 @@
bus_space_tag_t sc_bst;
bus_space_handle_t sc_bsh;
bus_space_handle_t sc_bsh_ao;
- struct meson_thermal_config *sc_conf;
+ const struct meson_thermal_config *sc_conf;
int sc_phandle;
int sc_ao_calib;
@@ -187,7 +188,7 @@
sc->sc_dev = self;
sc->sc_bst = faa->faa_bst;
sc->sc_phandle = phandle = faa->faa_phandle;
- sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data;
+ sc->sc_conf = of_search_compatible(phandle, compat_data)->data;
if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n");
diff -r 884f334cb5d2 -r af469a9c0c7d sys/arch/arm/amlogic/meson_usbctrl.c
--- a/sys/arch/arm/amlogic/meson_usbctrl.c Mon Jan 18 01:38:44 2021 +0000
+++ b/sys/arch/arm/amlogic/meson_usbctrl.c Mon Jan 18 02:35:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_usbctrl.c,v 1.1 2021/01/01 07:21:58 ryo Exp $ */
+/* $NetBSD: meson_usbctrl.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $ */
/*
* Copyright (c) 2021 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_usbctrl.c,v 1.1 2021/01/01 07:21:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_usbctrl.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -110,16 +110,17 @@
.num_phys = 3
};
-static const struct of_compat_data compat_data[] = {
- { "amlogic,meson-g12a-usb-ctrl", (uintptr_t)&mesong12_conf },
- { NULL }
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "amlogic,meson-g12a-usb-ctrl", .data = &mesong12_conf },
+
+ { 0 }
};
struct meson_usbctrl_softc {
device_t sc_dev;
bus_space_tag_t sc_bst;
bus_space_handle_t sc_bsh;
- struct meson_usbctrl_config *sc_conf;
+ const struct meson_usbctrl_config *sc_conf;
struct fdtbus_regulator *sc_supply;
int sc_phandle;
};
@@ -267,7 +268,7 @@
sc->sc_dev = self;
sc->sc_bst = faa->faa_bst;
sc->sc_phandle = phandle = faa->faa_phandle;
- sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data;
+ sc->sc_conf = of_search_compatible(phandle, compat_data)->data;
if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n");
diff -r 884f334cb5d2 -r af469a9c0c7d sys/arch/arm/amlogic/meson_usbphy.c
--- a/sys/arch/arm/amlogic/meson_usbphy.c Mon Jan 18 01:38:44 2021 +0000
+++ b/sys/arch/arm/amlogic/meson_usbphy.c Mon Jan 18 02:35:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_usbphy.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: meson_usbphy.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $ */
/*-
* Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_usbphy.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_usbphy.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -59,10 +59,13 @@
USBPHY_MESON8B,
};
-static const struct of_compat_data compat_data[] = {
- { "amlogic,meson8b-usb2-phy", USBPHY_MESON8B },
- { "amlogic,meson-gxbb-usb2-phy", USBPHY_MESON8B },
- { NULL }
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "amlogic,meson8b-usb2-phy",
+ .value = USBPHY_MESON8B },
+ { .compat = "amlogic,meson-gxbb-usb2-phy",
+ .value = USBPHY_MESON8B },
+
+ { 0 }
};
struct meson_usbphy_softc {
@@ -202,7 +205,7 @@
sc->sc_dev = self;
sc->sc_bst = faa->faa_bst;
sc->sc_phandle = phandle;
- sc->sc_type = of_search_compatible(phandle, compat_data)->data;
+ sc->sc_type = of_search_compatible(phandle, compat_data)->value;
if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n");
diff -r 884f334cb5d2 -r af469a9c0c7d sys/arch/arm/amlogic/mesong12_clkc.c
--- a/sys/arch/arm/amlogic/mesong12_clkc.c Mon Jan 18 01:38:44 2021 +0000
+++ b/sys/arch/arm/amlogic/mesong12_clkc.c Mon Jan 18 02:35:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mesong12_clkc.c,v 1.1 2021/01/01 07:21:58 ryo Exp $ */
+/* $NetBSD: mesong12_clkc.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $ */
/*-
* Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mesong12_clkc.c,v 1.1 2021/01/01 07:21:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mesong12_clkc.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -1489,10 +1489,11 @@
.nclks = __arraycount(mesong12b_clkc_clks),
};
-static const struct of_compat_data compat_data[] = {
- { "amlogic,g12a-clkc", (uintptr_t)&g12a_config },
- { "amlogic,g12b-clkc", (uintptr_t)&g12b_config },
- { NULL }
+static const struct device_compatible_entry compat_data[] = {
+ { .compat = "amlogic,g12a-clkc", .data = &g12a_config },
+ { .compat = "amlogic,g12b-clkc", .data = &g12b_config },
+
+ { 0 }
};
CFATTACH_DECL_NEW(mesong12_clkc, sizeof(struct meson_clk_softc),
@@ -1522,7 +1523,7 @@
return;
}
- conf = (const void *)of_search_compatible(phandle, compat_data)->data;
+ conf = of_search_compatible(phandle, compat_data)->data;
sc->sc_clks = conf->clks;
sc->sc_nclks = conf->nclks;
diff -r 884f334cb5d2 -r af469a9c0c7d sys/arch/arm/amlogic/mesongx_mmc.c
--- a/sys/arch/arm/amlogic/mesongx_mmc.c Mon Jan 18 01:38:44 2021 +0000
+++ b/sys/arch/arm/amlogic/mesongx_mmc.c Mon Jan 18 02:35:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mesongx_mmc.c,v 1.9 2021/01/15 18:42:40 ryo Exp $ */
Home |
Main Index |
Thread Index |
Old Index