treewide: use of_device_get_match_data

Simplifies code slightly.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21599
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Rosen Penev 2026-01-18 20:15:04 -08:00 committed by Hauke Mehrtens
parent 746206df14
commit c1fa85f659
21 changed files with 35 additions and 98 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ltq-atm PKG_NAME:=ltq-atm
PKG_RELEASE:=3 PKG_RELEASE:=4
PKG_MAINTAINER:=John Crispin <john@phrozen.org> PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=GPL-2.0+ PKG_LICENSE:=GPL-2.0+

View File

@ -38,7 +38,7 @@
#include <linux/atmdev.h> #include <linux/atmdev.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of_device.h> #include <linux/of.h>
#include <linux/atm.h> #include <linux/atm.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
@ -1756,20 +1756,12 @@ MODULE_DEVICE_TABLE(of, ltq_atm_match);
static int ltq_atm_probe(struct platform_device *pdev) static int ltq_atm_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match; const struct ltq_atm_ops *ops;
struct ltq_atm_ops *ops = NULL;
int ret; int ret;
int port_num; int port_num;
struct port_cell_info port_cell = {0}; struct port_cell_info port_cell = {0};
char ver_str[256]; 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(); check_parameters();
ret = init_priv_data(); ret = init_priv_data();
@ -1778,6 +1770,7 @@ static int ltq_atm_probe(struct platform_device *pdev)
goto INIT_PRIV_DATA_FAIL; goto INIT_PRIV_DATA_FAIL;
} }
ops = of_device_get_match_data(&pdev->dev);
ret = ops->init(pdev); ret = ops->init(pdev);
if (ret) if (ret)
return ret; return ret;

View File

@ -23,7 +23,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/of_device.h> #include <linux/of.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/bitops.h> #include <linux/bitops.h>
@ -2757,23 +2757,18 @@ static const struct of_device_id ar8xxx_mdiodev_of_match[] = {
static int static int
ar8xxx_mdiodev_probe(struct mdio_device *mdiodev) ar8xxx_mdiodev_probe(struct mdio_device *mdiodev)
{ {
const struct of_device_id *match;
struct ar8xxx_priv *priv; struct ar8xxx_priv *priv;
struct switch_dev *swdev; struct switch_dev *swdev;
struct device_node *mdio_node; struct device_node *mdio_node;
int ret; int ret;
match = of_match_device(ar8xxx_mdiodev_of_match, &mdiodev->dev);
if (!match)
return -EINVAL;
priv = ar8xxx_create(); priv = ar8xxx_create();
if (priv == NULL) if (priv == NULL)
return -ENOMEM; return -ENOMEM;
priv->mii_bus = mdiodev->bus; priv->mii_bus = mdiodev->bus;
priv->pdev = &mdiodev->dev; 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", ret = of_property_read_u32(priv->pdev->of_node, "qca,mib-poll-interval",
&priv->mib_poll_interval); &priv->mib_poll_interval);

View File

@ -23,7 +23,6 @@
#include <linux/lockdep.h> #include <linux/lockdep.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/mdio.h> #include <linux/mdio.h>

View File

@ -96,7 +96,7 @@ Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
obj-$(CONFIG_QCOM_Q6V5_WCSS) += qcom_q6v5_wcss.o obj-$(CONFIG_QCOM_Q6V5_WCSS) += qcom_q6v5_wcss.o
--- /dev/null --- /dev/null
+++ b/drivers/remoteproc/qcom_q6v5_mpd.c +++ b/drivers/remoteproc/qcom_q6v5_mpd.c
@@ -0,0 +1,801 @@ @@ -0,0 +1,796 @@
+// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0
+/* +/*
+ * Copyright (C) 2016-2018 Linaro Ltd. + * Copyright (C) 2016-2018 Linaro Ltd.
@ -788,7 +788,6 @@ Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
+ +
+static int q6_wcss_probe(struct platform_device *pdev) +static int q6_wcss_probe(struct platform_device *pdev)
+{ +{
+ const struct wcss_data *desc;
+ struct q6_wcss *wcss; + struct q6_wcss *wcss;
+ struct rproc *rproc; + struct rproc *rproc;
+ int ret; + int ret;
@ -796,10 +795,6 @@ Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
+ struct device_node *userpd_np; + struct device_node *userpd_np;
+ const struct rproc_ops *ops = &q6_wcss_ops; + 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, + firmware = devm_kcalloc(&pdev->dev, MAX_FIRMWARE,
+ sizeof(*firmware), GFP_KERNEL); + sizeof(*firmware), GFP_KERNEL);
+ if (!firmware) + if (!firmware)
@ -817,7 +812,7 @@ Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
+ +
+ wcss = rproc->priv; + wcss = rproc->priv;
+ wcss->dev = &pdev->dev; + wcss->dev = &pdev->dev;
+ wcss->desc = desc; + wcss->desc = of_device_get_match_data(&pdev->dev);
+ wcss->firmware = firmware; + wcss->firmware = firmware;
+ wcss->version = Q6_IPQ; + wcss->version = Q6_IPQ;
+ +

View File

@ -311,9 +311,9 @@ Signed-off-by: George Moussalem <george.moussalem@outlook.com>
return 0; return 0;
free_rproc: 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->dev = &pdev->dev;
wcss->desc = desc; wcss->desc = of_device_get_match_data(&pdev->dev);
wcss->firmware = firmware; wcss->firmware = firmware;
- wcss->version = Q6_IPQ; - wcss->version = Q6_IPQ;

View File

@ -191,7 +191,7 @@ Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
platform_set_drvdata(userpd_pdev, rproc); platform_set_drvdata(userpd_pdev, rproc);
qcom_add_ssr_subdev(rproc, &upd->ssr_subdev, userpd_pdev->name); qcom_add_ssr_subdev(rproc, &upd->ssr_subdev, userpd_pdev->name);
return 0; 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 */ /* Iterate over userpd child's and register with rproc */
for_each_available_child_of_node(pdev->dev.of_node, userpd_np) { for_each_available_child_of_node(pdev->dev.of_node, userpd_np) {

View File

@ -19,7 +19,7 @@ Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
const struct wcss_data *desc; const struct wcss_data *desc;
const char **firmware; const char **firmware;
struct userpd *upd[MAX_UPD]; 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) if (ret)
goto free_rproc; goto free_rproc;

View File

@ -88,7 +88,7 @@ Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
wcss->mem_phys, wcss->mem_size, wcss->mem_phys, wcss->mem_size,
NULL); 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); rproc_free(rproc);
} }
@ -101,7 +101,7 @@ Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
static const struct wcss_data q6_ipq5332_res_init = { static const struct wcss_data q6_ipq5332_res_init = {
.pasid = MPD_WCNSS_PAS_ID, .pasid = MPD_WCNSS_PAS_ID,
.share_upd_info_to_q6 = true, .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[] = { static const struct of_device_id q6_wcss_of_match[] = {

View File

@ -144,7 +144,7 @@ Signed-off-by: George Moussalem <george.moussalem@outlook.com>
} }
} }
@@ -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 = { static const struct wcss_data q6_ipq5018_res_init = {
.pasid = MPD_WCNSS_PAS_ID, .pasid = MPD_WCNSS_PAS_ID,

View File

@ -49,7 +49,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+obj-$(CONFIG_QCOM_APM) += apm.o +obj-$(CONFIG_QCOM_APM) += apm.o
--- /dev/null --- /dev/null
+++ b/drivers/power/qcom/apm.c +++ b/drivers/power/qcom/apm.c
@@ -0,0 +1,941 @@ @@ -0,0 +1,936 @@
+/* +/*
+ * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+ * + *
@ -893,7 +893,6 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+{ +{
+ struct device *dev = &pdev->dev; + struct device *dev = &pdev->dev;
+ struct msm_apm_ctrl_dev *ctrl; + struct msm_apm_ctrl_dev *ctrl;
+ const struct of_device_id *match;
+ int ret = 0; + int ret = 0;
+ +
+ dev_dbg(dev, "probing MSM Array Power Mux driver\n"); + dev_dbg(dev, "probing MSM Array Power Mux driver\n");
@ -903,10 +902,6 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ return -ENODEV; + return -ENODEV;
+ } + }
+ +
+ match = of_match_device(msm_apm_match_table, dev);
+ if (!match)
+ return -ENODEV;
+
+ ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
+ if (!ctrl) { + if (!ctrl) {
+ dev_err(dev, "MSM APM controller memory allocation failed\n"); + dev_err(dev, "MSM APM controller memory allocation failed\n");
@ -916,7 +911,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ INIT_LIST_HEAD(&ctrl->list); + INIT_LIST_HEAD(&ctrl->list);
+ spin_lock_init(&ctrl->lock); + spin_lock_init(&ctrl->lock);
+ ctrl->dev = dev; + 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); + platform_set_drvdata(pdev, ctrl);
+ +
+ switch (ctrl->msm_id) { + switch (ctrl->msm_id) {

View File

@ -77,7 +77,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o
--- /dev/null --- /dev/null
+++ b/drivers/regulator/cpr3-npu-regulator.c +++ b/drivers/regulator/cpr3-npu-regulator.c
@@ -0,0 +1,694 @@ @@ -0,0 +1,689 @@
+/* +/*
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * + *
@ -652,8 +652,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ struct device *dev = &pdev->dev; + struct device *dev = &pdev->dev;
+ struct cpr3_controller *ctrl; + struct cpr3_controller *ctrl;
+ int i, rc; + int i, rc;
+ const struct of_device_id *match; + const struct cpr3_reg_data *cpr_data;
+ struct cpr3_reg_data *cpr_data;
+ +
+ if (!dev->of_node) { + if (!dev->of_node) {
+ dev_err(dev, "Device tree node is missing\n"); + dev_err(dev, "Device tree node is missing\n");
@ -665,11 +664,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ return -ENOMEM; + return -ENOMEM;
+ g_ctrl = ctrl; + g_ctrl = ctrl;
+ +
+ match = of_match_device(cpr3_regulator_match_table, &pdev->dev); + cpr_data = of_device_get_match_data(&pdev->dev);
+ if (!match)
+ return -ENODEV;
+
+ cpr_data = (struct cpr3_reg_data *)match->data;
+ g_valid_npu_fuse_count = cpr_data->cpr_valid_fuse_count; + 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); + dev_info(dev, "NPU CPR valid fuse count: %d\n", g_valid_npu_fuse_count);
+ ctrl->cpr_clock_rate = cpr_data->cpr_clk_rate; + ctrl->cpr_clock_rate = cpr_data->cpr_clk_rate;
@ -9863,7 +9858,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+} +}
--- /dev/null --- /dev/null
+++ b/drivers/regulator/cpr4-apss-regulator.c +++ 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. + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+ * + *
@ -11560,8 +11555,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+{ +{
+ struct device *dev = &pdev->dev; + struct device *dev = &pdev->dev;
+ struct cpr3_controller *ctrl; + struct cpr3_controller *ctrl;
+ const struct of_device_id *match; + const struct cpr4_reg_data *cpr_data;
+ struct cpr4_reg_data *cpr_data;
+ int i, rc; + int i, rc;
+ +
+ if (!dev->of_node) { + if (!dev->of_node) {
@ -11573,11 +11567,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ if (!ctrl) + if (!ctrl)
+ return -ENOMEM; + return -ENOMEM;
+ +
+ match = of_match_device(cpr4_regulator_match_table, &pdev->dev); + cpr_data = of_device_get_match_data(&pdev->dev);
+ if (!match)
+ return -ENODEV;
+
+ cpr_data = (struct cpr4_reg_data *)match->data;
+ g_valid_fuse_count = cpr_data->cpr_valid_fuse_count; + g_valid_fuse_count = cpr_data->cpr_valid_fuse_count;
+ dev_info(dev, "CPR valid fuse count: %d\n", g_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; + ctrl->cpr_clock_rate = cpr_data->cpr_clk_rate;

View File

@ -16,7 +16,6 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/of_dma.h> #include <linux/of_dma.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/of_device.h>
#include "../virt-dma.h" #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) static int mtk_hsdma_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match;
struct mtk_hsdma_chan *chan; struct mtk_hsdma_chan *chan;
struct mtk_hsdam_engine *hsdma; struct mtk_hsdam_engine *hsdma;
struct dma_device *dd; struct dma_device *dd;
@ -656,10 +654,6 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
if (ret) if (ret)
return 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); hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL);
if (!hsdma) if (!hsdma)
return -EINVAL; return -EINVAL;

View File

@ -15,7 +15,6 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/of_dma.h> #include <linux/of_dma.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/of_device.h>
#include "virt-dma.h" #include "virt-dma.h"
@ -118,7 +117,7 @@ struct gdma_dmaengine_chan {
struct gdma_dma_dev { struct gdma_dma_dev {
struct dma_device ddev; struct dma_device ddev;
struct device_dma_parameters dma_parms; struct device_dma_parameters dma_parms;
struct gdma_data *data; const struct gdma_data *data;
void __iomem *base; void __iomem *base;
struct tasklet_struct task; struct tasklet_struct task;
volatile unsigned long chan_issued; 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) static int gdma_dma_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match;
struct gdma_dmaengine_chan *chan; struct gdma_dmaengine_chan *chan;
struct gdma_dma_dev *dma_dev; struct gdma_dma_dev *dma_dev;
struct dma_device *dd; struct dma_device *dd;
@ -797,16 +795,13 @@ static int gdma_dma_probe(struct platform_device *pdev)
int ret; int ret;
int irq; int irq;
void __iomem *base; void __iomem *base;
struct gdma_data *data; const struct gdma_data *data;
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret) if (ret)
return ret; return ret;
match = of_match_device(gdma_of_match_table, &pdev->dev); data = of_device_get_match_data(&pdev->dev);
if (!match)
return -EINVAL;
data = (struct gdma_data *)match->data;
dma_dev = devm_kzalloc(&pdev->dev, dma_dev = devm_kzalloc(&pdev->dev,
struct_size(dma_dev, chan, data->chancnt), struct_size(dma_dev, chan, data->chancnt),

View File

@ -17,7 +17,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <asm/mach-ralink/ralink_regs.h> #include <asm/mach-ralink/ralink_regs.h>
#include <linux/of_device.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>

View File

@ -17,7 +17,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>

View File

@ -30,7 +30,6 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/lockdep.h> #include <linux/lockdep.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/of_device.h>
#include <linux/of.h> #include <linux/of.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>

View File

@ -21,7 +21,6 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
@ -1523,7 +1522,6 @@ static void fe_pending_work(struct work_struct *work)
static int fe_probe(struct platform_device *pdev) static int fe_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match;
struct fe_soc_data *soc; struct fe_soc_data *soc;
struct net_device *netdev; struct net_device *netdev;
struct fe_priv *priv; struct fe_priv *priv;
@ -1534,9 +1532,7 @@ static int fe_probe(struct platform_device *pdev)
if (err) if (err)
dev_err(&pdev->dev, "failed to reset device\n"); dev_err(&pdev->dev, "failed to reset device\n");
match = of_match_device(of_fe_match, &pdev->dev); soc = (struct fe_soc_data *)of_device_get_match_data(&pdev->dev);
soc = (struct fe_soc_data *)match->data;
if (soc->reg_table) if (soc->reg_table)
fe_reg_table = soc->reg_table; fe_reg_table = soc->reg_table;
else else

View File

@ -59,7 +59,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+obj-$(CONFIG_SND_RALINK_SOC_I2S) += snd-soc-ralink-i2s.o +obj-$(CONFIG_SND_RALINK_SOC_I2S) += snd-soc-ralink-i2s.o
--- /dev/null --- /dev/null
+++ b/sound/soc/ralink/ralink-i2s.c +++ b/sound/soc/ralink/ralink-i2s.c
@@ -0,0 +1,921 @@ @@ -0,0 +1,916 @@
+/* +/*
+ * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> + * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
+ * Copyright (C) 2016 Michael Lee <igvtee@gmail.com> + * Copyright (C) 2016 Michael Lee <igvtee@gmail.com>
@ -81,7 +81,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+#include <linux/regmap.h> +#include <linux/regmap.h>
+#include <linux/reset.h> +#include <linux/reset.h>
+#include <linux/debugfs.h> +#include <linux/debugfs.h>
+#include <linux/of_device.h>
+#include <sound/pcm_params.h> +#include <sound/pcm_params.h>
+#include <sound/dmaengine_pcm.h> +#include <sound/dmaengine_pcm.h>
+ +
@ -848,14 +847,13 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ +
+static int ralink_i2s_probe(struct platform_device *pdev) +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_node *np = pdev->dev.of_node;
+ struct device *dev = &pdev->dev; + struct device *dev = &pdev->dev;
+ struct resource *res; + struct resource *res;
+ struct ralink_i2s *i2s; + struct ralink_i2s *i2s;
+ int irq, ret; + int irq, ret;
+ u32 dma_req; + u32 dma_req;
+ struct rt_i2s_data *data; + const struct rt_i2s_data *data;
+ +
+ i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL);
+ if (!i2s) + if (!i2s)
@ -863,10 +861,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ +
+ i2s->dev = dev; + i2s->dev = dev;
+ +
+ match = of_match_device(ralink_i2s_match_table, dev); + data = of_device_get_match_data(dev);
+ if (!match)
+ return -EINVAL;
+ data = (struct rt_i2s_data *)match->data;
+ i2s->flags = data->flags; + i2s->flags = data->flags;
+ /* setup out 12Mhz refclk to codec as mclk */ + /* setup out 12Mhz refclk to codec as mclk */
+ if (data->refclk_setup) + if (data->refclk_setup)

View File

@ -49,7 +49,7 @@ Signed-off-by: William Qiu <william.qiu@starfivetech.com>
obj-$(CONFIG_PWM_PXA) += pwm-pxa.o obj-$(CONFIG_PWM_PXA) += pwm-pxa.o
--- /dev/null --- /dev/null
+++ b/drivers/pwm/pwm-ocores.c +++ b/drivers/pwm/pwm-ocores.c
@@ -0,0 +1,230 @@ @@ -0,0 +1,225 @@
+// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0
+/* +/*
+ * OpenCores PWM Driver + * OpenCores PWM Driver
@ -213,16 +213,11 @@ Signed-off-by: William Qiu <william.qiu@starfivetech.com>
+ +
+static int ocores_pwm_probe(struct platform_device *pdev) +static int ocores_pwm_probe(struct platform_device *pdev)
+{ +{
+ const struct of_device_id *id;
+ struct device *dev = &pdev->dev; + struct device *dev = &pdev->dev;
+ struct ocores_pwm_device *ddata; + struct ocores_pwm_device *ddata;
+ struct pwm_chip *chip; + struct pwm_chip *chip;
+ int ret; + int ret;
+ +
+ id = of_match_device(ocores_pwm_of_match, dev);
+ if (!id)
+ return -EINVAL;
+
+ chip = devm_pwmchip_alloc(dev, 8, sizeof(*ddata)); + chip = devm_pwmchip_alloc(dev, 8, sizeof(*ddata));
+ if (IS_ERR(chip)) + if (IS_ERR(chip))
+ return PTR_ERR(chip); + return PTR_ERR(chip);
@ -230,7 +225,7 @@ Signed-off-by: William Qiu <william.qiu@starfivetech.com>
+ chip->ops = &ocores_pwm_ops; + chip->ops = &ocores_pwm_ops;
+ +
+ ddata = chip_to_ocores(chip); + 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); + ddata->regs = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(ddata->regs)) + if (IS_ERR(ddata->regs))

View File

@ -373,7 +373,7 @@ Signed-off-by: shanlong.li <shanlong.li@starfivetech.com>
+#endif +#endif
--- /dev/null --- /dev/null
+++ b/drivers/e24/starfive_e24.c +++ b/drivers/e24/starfive_e24.c
@@ -0,0 +1,1524 @@ @@ -0,0 +1,1522 @@
+// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0
+/* +/*
+ * e24 driver for StarFive JH7110 SoC + * e24 driver for StarFive JH7110 SoC
@ -1863,11 +1863,9 @@ Signed-off-by: shanlong.li <shanlong.li@starfivetech.com>
+static int e24_probe(struct platform_device *pdev) +static int e24_probe(struct platform_device *pdev)
+{ +{
+ long ret = -EINVAL; + long ret = -EINVAL;
+ const struct of_device_id *match; + const e24_init_function *init;
+ e24_init_function *init;
+ +
+ match = of_match_device(e24_of_match, &pdev->dev); + init = of_device_get_match_data(&pdev->dev);
+ init = match->data;
+ ret = init(pdev); + ret = init(pdev);
+ +
+ return IS_ERR_VALUE(ret) ? ret : 0; + return IS_ERR_VALUE(ret) ? ret : 0;