From: Rosen Penev Date: Mon, 19 Jan 2026 04:15:04 +0000 (-0800) Subject: treewide: use of_device_get_match_data X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1fa85f6593173fca7d4c26acb3682ccd6756f03;p=thirdparty%2Fopenwrt.git treewide: use of_device_get_match_data Simplifies code slightly. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/21599 Signed-off-by: Hauke Mehrtens --- diff --git a/package/kernel/lantiq/ltq-atm/Makefile b/package/kernel/lantiq/ltq-atm/Makefile index 30f8b4ffd9d..5c03507dbe8 100644 --- a/package/kernel/lantiq/ltq-atm/Makefile +++ b/package/kernel/lantiq/ltq-atm/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-atm -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0+ diff --git a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c index f488aea7331..1ba2dfb3cb8 100644 --- a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c +++ b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -1756,20 +1756,12 @@ MODULE_DEVICE_TABLE(of, ltq_atm_match); static int ltq_atm_probe(struct platform_device *pdev) { - const struct of_device_id *match; - struct ltq_atm_ops *ops = NULL; + const struct ltq_atm_ops *ops; int ret; int port_num; struct port_cell_info port_cell = {0}; char ver_str[256]; - match = of_match_device(ltq_atm_match, &pdev->dev); - if (!match) { - dev_err(&pdev->dev, "failed to find matching device\n"); - return -ENOENT; - } - ops = (struct ltq_atm_ops *) match->data; - check_parameters(); ret = init_priv_data(); @@ -1778,6 +1770,7 @@ static int ltq_atm_probe(struct platform_device *pdev) goto INIT_PRIV_DATA_FAIL; } + ops = of_device_get_match_data(&pdev->dev); ret = ops->init(pdev); if (ret) return ret; diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 33b17cea4f4..c1988defcae 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -2757,23 +2757,18 @@ static const struct of_device_id ar8xxx_mdiodev_of_match[] = { static int ar8xxx_mdiodev_probe(struct mdio_device *mdiodev) { - const struct of_device_id *match; struct ar8xxx_priv *priv; struct switch_dev *swdev; struct device_node *mdio_node; int ret; - match = of_match_device(ar8xxx_mdiodev_of_match, &mdiodev->dev); - if (!match) - return -EINVAL; - priv = ar8xxx_create(); if (priv == NULL) return -ENOMEM; priv->mii_bus = mdiodev->bus; priv->pdev = &mdiodev->dev; - priv->chip = (const struct ar8xxx_chip *) match->data; + priv->chip = of_device_get_match_data(&mdiodev->dev); ret = of_property_read_u32(priv->pdev->of_node, "qca,mib-poll-interval", &priv->mib_poll_interval); diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.c b/target/linux/generic/files/drivers/net/phy/ar8327.c index bf7d7af5b71..ce93bfcd09e 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8327.c +++ b/target/linux/generic/files/drivers/net/phy/ar8327.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/target/linux/qualcommax/patches-6.12/0805-remoteproc-qcom-Add-Hexagon-based-multipd-rproc-driv.patch b/target/linux/qualcommax/patches-6.12/0805-remoteproc-qcom-Add-Hexagon-based-multipd-rproc-driv.patch index fc80d772384..98b49818036 100644 --- a/target/linux/qualcommax/patches-6.12/0805-remoteproc-qcom-Add-Hexagon-based-multipd-rproc-driv.patch +++ b/target/linux/qualcommax/patches-6.12/0805-remoteproc-qcom-Add-Hexagon-based-multipd-rproc-driv.patch @@ -96,7 +96,7 @@ Signed-off-by: Manikanta Mylavarapu obj-$(CONFIG_QCOM_Q6V5_WCSS) += qcom_q6v5_wcss.o --- /dev/null +++ b/drivers/remoteproc/qcom_q6v5_mpd.c -@@ -0,0 +1,801 @@ +@@ -0,0 +1,796 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2016-2018 Linaro Ltd. @@ -788,7 +788,6 @@ Signed-off-by: Manikanta Mylavarapu + +static int q6_wcss_probe(struct platform_device *pdev) +{ -+ const struct wcss_data *desc; + struct q6_wcss *wcss; + struct rproc *rproc; + int ret; @@ -796,10 +795,6 @@ Signed-off-by: Manikanta Mylavarapu + struct device_node *userpd_np; + const struct rproc_ops *ops = &q6_wcss_ops; + -+ desc = of_device_get_match_data(&pdev->dev); -+ if (!desc) -+ return -EINVAL; -+ + firmware = devm_kcalloc(&pdev->dev, MAX_FIRMWARE, + sizeof(*firmware), GFP_KERNEL); + if (!firmware) @@ -817,7 +812,7 @@ Signed-off-by: Manikanta Mylavarapu + + wcss = rproc->priv; + wcss->dev = &pdev->dev; -+ wcss->desc = desc; ++ wcss->desc = of_device_get_match_data(&pdev->dev); + wcss->firmware = firmware; + wcss->version = Q6_IPQ; + diff --git a/target/linux/qualcommax/patches-6.12/0806-rproc-qcom_q6v5_mpd-split-q6_wcss-to-rootpd-and-user.patch b/target/linux/qualcommax/patches-6.12/0806-rproc-qcom_q6v5_mpd-split-q6_wcss-to-rootpd-and-user.patch index 4f09717cf5d..5f403585e0e 100644 --- a/target/linux/qualcommax/patches-6.12/0806-rproc-qcom_q6v5_mpd-split-q6_wcss-to-rootpd-and-user.patch +++ b/target/linux/qualcommax/patches-6.12/0806-rproc-qcom_q6v5_mpd-split-q6_wcss-to-rootpd-and-user.patch @@ -311,9 +311,9 @@ Signed-off-by: George Moussalem return 0; free_rproc: -@@ -720,7 +707,6 @@ static int q6_wcss_probe(struct platform +@@ -715,7 +702,6 @@ static int q6_wcss_probe(struct platform wcss->dev = &pdev->dev; - wcss->desc = desc; + wcss->desc = of_device_get_match_data(&pdev->dev); wcss->firmware = firmware; - wcss->version = Q6_IPQ; diff --git a/target/linux/qualcommax/patches-6.12/0807-remoteproc-qcom_q6v5_mpd-fix-incorrent-use-of-rproc-.patch b/target/linux/qualcommax/patches-6.12/0807-remoteproc-qcom_q6v5_mpd-fix-incorrent-use-of-rproc-.patch index 42ffaab66e5..cd73dd0f1cc 100644 --- a/target/linux/qualcommax/patches-6.12/0807-remoteproc-qcom_q6v5_mpd-fix-incorrent-use-of-rproc-.patch +++ b/target/linux/qualcommax/patches-6.12/0807-remoteproc-qcom_q6v5_mpd-fix-incorrent-use-of-rproc-.patch @@ -191,7 +191,7 @@ Signed-off-by: Ziyang Huang platform_set_drvdata(userpd_pdev, rproc); qcom_add_ssr_subdev(rproc, &upd->ssr_subdev, userpd_pdev->name); return 0; -@@ -729,10 +736,10 @@ static int q6_wcss_probe(struct platform +@@ -724,10 +731,10 @@ static int q6_wcss_probe(struct platform /* Iterate over userpd child's and register with rproc */ for_each_available_child_of_node(pdev->dev.of_node, userpd_np) { diff --git a/target/linux/qualcommax/patches-6.12/0813-remoteproc-qcom_q6v5_mpd-enable-clocks.patch b/target/linux/qualcommax/patches-6.12/0813-remoteproc-qcom_q6v5_mpd-enable-clocks.patch index 7af2567cdab..efa485570f0 100644 --- a/target/linux/qualcommax/patches-6.12/0813-remoteproc-qcom_q6v5_mpd-enable-clocks.patch +++ b/target/linux/qualcommax/patches-6.12/0813-remoteproc-qcom_q6v5_mpd-enable-clocks.patch @@ -19,7 +19,7 @@ Signed-off-by: Ziyang Huang const struct wcss_data *desc; const char **firmware; struct userpd *upd[MAX_UPD]; -@@ -719,6 +721,16 @@ static int q6_wcss_probe(struct platform +@@ -714,6 +716,16 @@ static int q6_wcss_probe(struct platform if (ret) goto free_rproc; diff --git a/target/linux/qualcommax/patches-6.12/0814-remoteproc-qcom_q6v5_mpd-support-ipq5018.patch b/target/linux/qualcommax/patches-6.12/0814-remoteproc-qcom_q6v5_mpd-support-ipq5018.patch index 9cdf59ad21d..e50417fda59 100644 --- a/target/linux/qualcommax/patches-6.12/0814-remoteproc-qcom_q6v5_mpd-support-ipq5018.patch +++ b/target/linux/qualcommax/patches-6.12/0814-remoteproc-qcom_q6v5_mpd-support-ipq5018.patch @@ -88,7 +88,7 @@ Signed-off-by: Ziyang Huang wcss->mem_phys, wcss->mem_size, NULL); } -@@ -776,6 +800,12 @@ static void q6_wcss_remove(struct platfo +@@ -771,6 +795,12 @@ static void q6_wcss_remove(struct platfo rproc_free(rproc); } @@ -101,7 +101,7 @@ Signed-off-by: Ziyang Huang static const struct wcss_data q6_ipq5332_res_init = { .pasid = MPD_WCNSS_PAS_ID, .share_upd_info_to_q6 = true, -@@ -786,6 +816,7 @@ static const struct wcss_data q6_ipq9574 +@@ -781,6 +811,7 @@ static const struct wcss_data q6_ipq9574 }; static const struct of_device_id q6_wcss_of_match[] = { diff --git a/target/linux/qualcommax/patches-6.12/0815-remoteproc-qcom_q6v5_mpd-add-support-for-passing-v1-bootargs.patch b/target/linux/qualcommax/patches-6.12/0815-remoteproc-qcom_q6v5_mpd-add-support-for-passing-v1-bootargs.patch index f601377e474..2c4a7b12df8 100644 --- a/target/linux/qualcommax/patches-6.12/0815-remoteproc-qcom_q6v5_mpd-add-support-for-passing-v1-bootargs.patch +++ b/target/linux/qualcommax/patches-6.12/0815-remoteproc-qcom_q6v5_mpd-add-support-for-passing-v1-bootargs.patch @@ -144,7 +144,7 @@ Signed-off-by: George Moussalem } } -@@ -802,13 +849,15 @@ static void q6_wcss_remove(struct platfo +@@ -797,13 +844,15 @@ static void q6_wcss_remove(struct platfo static const struct wcss_data q6_ipq5018_res_init = { .pasid = MPD_WCNSS_PAS_ID, diff --git a/target/linux/qualcommax/patches-6.12/0900-power-Add-Qualcomm-APM.patch b/target/linux/qualcommax/patches-6.12/0900-power-Add-Qualcomm-APM.patch index f0621919730..c0744d74e25 100644 --- a/target/linux/qualcommax/patches-6.12/0900-power-Add-Qualcomm-APM.patch +++ b/target/linux/qualcommax/patches-6.12/0900-power-Add-Qualcomm-APM.patch @@ -49,7 +49,7 @@ Signed-off-by: Robert Marko +obj-$(CONFIG_QCOM_APM) += apm.o --- /dev/null +++ b/drivers/power/qcom/apm.c -@@ -0,0 +1,941 @@ +@@ -0,0 +1,936 @@ +/* + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. + * @@ -893,7 +893,6 @@ Signed-off-by: Robert Marko +{ + struct device *dev = &pdev->dev; + struct msm_apm_ctrl_dev *ctrl; -+ const struct of_device_id *match; + int ret = 0; + + dev_dbg(dev, "probing MSM Array Power Mux driver\n"); @@ -903,10 +902,6 @@ Signed-off-by: Robert Marko + return -ENODEV; + } + -+ match = of_match_device(msm_apm_match_table, dev); -+ if (!match) -+ return -ENODEV; -+ + ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + if (!ctrl) { + dev_err(dev, "MSM APM controller memory allocation failed\n"); @@ -916,7 +911,7 @@ Signed-off-by: Robert Marko + INIT_LIST_HEAD(&ctrl->list); + spin_lock_init(&ctrl->lock); + ctrl->dev = dev; -+ ctrl->msm_id = (uintptr_t)match->data; ++ ctrl->msm_id = (uintptr_t)of_device_get_match_data(dev); + platform_set_drvdata(pdev, ctrl); + + switch (ctrl->msm_id) { diff --git a/target/linux/qualcommax/patches-6.12/0901-regulator-add-Qualcomm-CPR-regulators.patch b/target/linux/qualcommax/patches-6.12/0901-regulator-add-Qualcomm-CPR-regulators.patch index a6c5c4b1673..dc1b8369b81 100644 --- a/target/linux/qualcommax/patches-6.12/0901-regulator-add-Qualcomm-CPR-regulators.patch +++ b/target/linux/qualcommax/patches-6.12/0901-regulator-add-Qualcomm-CPR-regulators.patch @@ -77,7 +77,7 @@ Signed-off-by: Robert Marko obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o --- /dev/null +++ b/drivers/regulator/cpr3-npu-regulator.c -@@ -0,0 +1,694 @@ +@@ -0,0 +1,689 @@ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * @@ -652,8 +652,7 @@ Signed-off-by: Robert Marko + struct device *dev = &pdev->dev; + struct cpr3_controller *ctrl; + int i, rc; -+ const struct of_device_id *match; -+ struct cpr3_reg_data *cpr_data; ++ const struct cpr3_reg_data *cpr_data; + + if (!dev->of_node) { + dev_err(dev, "Device tree node is missing\n"); @@ -665,11 +664,7 @@ Signed-off-by: Robert Marko + return -ENOMEM; + g_ctrl = ctrl; + -+ match = of_match_device(cpr3_regulator_match_table, &pdev->dev); -+ if (!match) -+ return -ENODEV; -+ -+ cpr_data = (struct cpr3_reg_data *)match->data; ++ cpr_data = of_device_get_match_data(&pdev->dev); + g_valid_npu_fuse_count = cpr_data->cpr_valid_fuse_count; + dev_info(dev, "NPU CPR valid fuse count: %d\n", g_valid_npu_fuse_count); + ctrl->cpr_clock_rate = cpr_data->cpr_clk_rate; @@ -9863,7 +9858,7 @@ Signed-off-by: Robert Marko +} --- /dev/null +++ b/drivers/regulator/cpr4-apss-regulator.c -@@ -0,0 +1,1818 @@ +@@ -0,0 +1,1813 @@ +/* + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. + * @@ -11560,8 +11555,7 @@ Signed-off-by: Robert Marko +{ + struct device *dev = &pdev->dev; + struct cpr3_controller *ctrl; -+ const struct of_device_id *match; -+ struct cpr4_reg_data *cpr_data; ++ const struct cpr4_reg_data *cpr_data; + int i, rc; + + if (!dev->of_node) { @@ -11573,11 +11567,7 @@ Signed-off-by: Robert Marko + if (!ctrl) + return -ENOMEM; + -+ match = of_match_device(cpr4_regulator_match_table, &pdev->dev); -+ if (!match) -+ return -ENODEV; -+ -+ cpr_data = (struct cpr4_reg_data *)match->data; ++ cpr_data = of_device_get_match_data(&pdev->dev); + g_valid_fuse_count = cpr_data->cpr_valid_fuse_count; + dev_info(dev, "CPR valid fuse count: %d\n", g_valid_fuse_count); + ctrl->cpr_clock_rate = cpr_data->cpr_clk_rate; diff --git a/target/linux/ramips/files/drivers/dma/mediatek/hsdma-mt7621.c b/target/linux/ramips/files/drivers/dma/mediatek/hsdma-mt7621.c index 013fa88a0e6..82d6955f8e6 100644 --- a/target/linux/ramips/files/drivers/dma/mediatek/hsdma-mt7621.c +++ b/target/linux/ramips/files/drivers/dma/mediatek/hsdma-mt7621.c @@ -16,7 +16,6 @@ #include #include #include -#include #include "../virt-dma.h" @@ -644,7 +643,6 @@ static const struct of_device_id mtk_hsdma_of_match[] = { static int mtk_hsdma_probe(struct platform_device *pdev) { - const struct of_device_id *match; struct mtk_hsdma_chan *chan; struct mtk_hsdam_engine *hsdma; struct dma_device *dd; @@ -656,10 +654,6 @@ static int mtk_hsdma_probe(struct platform_device *pdev) if (ret) return ret; - match = of_match_device(mtk_hsdma_of_match, &pdev->dev); - if (!match) - return -EINVAL; - hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL); if (!hsdma) return -EINVAL; diff --git a/target/linux/ramips/files/drivers/dma/ralink-gdma.c b/target/linux/ramips/files/drivers/dma/ralink-gdma.c index b6458967a19..d92475e48f2 100644 --- a/target/linux/ramips/files/drivers/dma/ralink-gdma.c +++ b/target/linux/ramips/files/drivers/dma/ralink-gdma.c @@ -15,7 +15,6 @@ #include #include #include -#include #include "virt-dma.h" @@ -118,7 +117,7 @@ struct gdma_dmaengine_chan { struct gdma_dma_dev { struct dma_device ddev; struct device_dma_parameters dma_parms; - struct gdma_data *data; + const struct gdma_data *data; void __iomem *base; struct tasklet_struct task; volatile unsigned long chan_issued; @@ -789,7 +788,6 @@ MODULE_DEVICE_TABLE(of, gdma_of_match_table); static int gdma_dma_probe(struct platform_device *pdev) { - const struct of_device_id *match; struct gdma_dmaengine_chan *chan; struct gdma_dma_dev *dma_dev; struct dma_device *dd; @@ -797,16 +795,13 @@ static int gdma_dma_probe(struct platform_device *pdev) int ret; int irq; void __iomem *base; - struct gdma_data *data; + const struct gdma_data *data; ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (ret) return ret; - match = of_match_device(gdma_of_match_table, &pdev->dev); - if (!match) - return -EINVAL; - data = (struct gdma_data *)match->data; + data = of_device_get_match_data(&pdev->dev); dma_dev = devm_kzalloc(&pdev->dev, struct_size(dma_dev, chan, data->chancnt), diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c index 3bf2c2e83ce..75464adf53e 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c index f45c874eee6..ebb1d44c0ef 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c index 9d40dfb5200..07f092a2f8c 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index f53746eee83..031f0728f69 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -1523,7 +1522,6 @@ static void fe_pending_work(struct work_struct *work) static int fe_probe(struct platform_device *pdev) { - const struct of_device_id *match; struct fe_soc_data *soc; struct net_device *netdev; struct fe_priv *priv; @@ -1534,9 +1532,7 @@ static int fe_probe(struct platform_device *pdev) if (err) dev_err(&pdev->dev, "failed to reset device\n"); - match = of_match_device(of_fe_match, &pdev->dev); - soc = (struct fe_soc_data *)match->data; - + soc = (struct fe_soc_data *)of_device_get_match_data(&pdev->dev); if (soc->reg_table) fe_reg_table = soc->reg_table; else diff --git a/target/linux/ramips/patches-6.12/835-asoc-add-mt7620-support.patch b/target/linux/ramips/patches-6.12/835-asoc-add-mt7620-support.patch index d4027c904ad..08edb5504ae 100644 --- a/target/linux/ramips/patches-6.12/835-asoc-add-mt7620-support.patch +++ b/target/linux/ramips/patches-6.12/835-asoc-add-mt7620-support.patch @@ -59,7 +59,7 @@ Signed-off-by: John Crispin +obj-$(CONFIG_SND_RALINK_SOC_I2S) += snd-soc-ralink-i2s.o --- /dev/null +++ b/sound/soc/ralink/ralink-i2s.c -@@ -0,0 +1,921 @@ +@@ -0,0 +1,916 @@ +/* + * Copyright (C) 2010, Lars-Peter Clausen + * Copyright (C) 2016 Michael Lee @@ -81,7 +81,6 @@ Signed-off-by: John Crispin +#include +#include +#include -+#include +#include +#include + @@ -848,14 +847,13 @@ Signed-off-by: John Crispin + +static int ralink_i2s_probe(struct platform_device *pdev) +{ -+ const struct of_device_id *match; + struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; + struct resource *res; + struct ralink_i2s *i2s; + int irq, ret; + u32 dma_req; -+ struct rt_i2s_data *data; ++ const struct rt_i2s_data *data; + + i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + if (!i2s) @@ -863,10 +861,7 @@ Signed-off-by: John Crispin + + i2s->dev = dev; + -+ match = of_match_device(ralink_i2s_match_table, dev); -+ if (!match) -+ return -EINVAL; -+ data = (struct rt_i2s_data *)match->data; ++ data = of_device_get_match_data(dev); + i2s->flags = data->flags; + /* setup out 12Mhz refclk to codec as mclk */ + if (data->refclk_setup) diff --git a/target/linux/starfive/patches-6.12/0003-pwm-opencores-Add-PWM-driver-support.patch b/target/linux/starfive/patches-6.12/0003-pwm-opencores-Add-PWM-driver-support.patch index 4c0f046dc0e..0cb700409e6 100644 --- a/target/linux/starfive/patches-6.12/0003-pwm-opencores-Add-PWM-driver-support.patch +++ b/target/linux/starfive/patches-6.12/0003-pwm-opencores-Add-PWM-driver-support.patch @@ -49,7 +49,7 @@ Signed-off-by: William Qiu obj-$(CONFIG_PWM_PXA) += pwm-pxa.o --- /dev/null +++ b/drivers/pwm/pwm-ocores.c -@@ -0,0 +1,230 @@ +@@ -0,0 +1,225 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * OpenCores PWM Driver @@ -213,16 +213,11 @@ Signed-off-by: William Qiu + +static int ocores_pwm_probe(struct platform_device *pdev) +{ -+ const struct of_device_id *id; + struct device *dev = &pdev->dev; + struct ocores_pwm_device *ddata; + struct pwm_chip *chip; + int ret; + -+ id = of_match_device(ocores_pwm_of_match, dev); -+ if (!id) -+ return -EINVAL; -+ + chip = devm_pwmchip_alloc(dev, 8, sizeof(*ddata)); + if (IS_ERR(chip)) + return PTR_ERR(chip); @@ -230,7 +225,7 @@ Signed-off-by: William Qiu + chip->ops = &ocores_pwm_ops; + + ddata = chip_to_ocores(chip); -+ ddata->data = id->data; ++ ddata->data = of_device_get_match_data(dev); + + ddata->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(ddata->regs)) diff --git a/target/linux/starfive/patches-6.12/0018-driver-e24-add-e24-driver.patch b/target/linux/starfive/patches-6.12/0018-driver-e24-add-e24-driver.patch index 511e80e9ae1..ca61b4652fc 100644 --- a/target/linux/starfive/patches-6.12/0018-driver-e24-add-e24-driver.patch +++ b/target/linux/starfive/patches-6.12/0018-driver-e24-add-e24-driver.patch @@ -373,7 +373,7 @@ Signed-off-by: shanlong.li +#endif --- /dev/null +++ b/drivers/e24/starfive_e24.c -@@ -0,0 +1,1524 @@ +@@ -0,0 +1,1522 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * e24 driver for StarFive JH7110 SoC @@ -1863,11 +1863,9 @@ Signed-off-by: shanlong.li +static int e24_probe(struct platform_device *pdev) +{ + long ret = -EINVAL; -+ const struct of_device_id *match; -+ e24_init_function *init; ++ const e24_init_function *init; + -+ match = of_match_device(e24_of_match, &pdev->dev); -+ init = match->data; ++ init = of_device_get_match_data(&pdev->dev); + ret = init(pdev); + + return IS_ERR_VALUE(ret) ? ret : 0;