Skip to content
Permalink
Browse files
driver: update all the code that use soc_device_match
Update all the code that use soc_device_match because add support for
soc_device_match returning -EPROBE_DEFER.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
  • Loading branch information
Alice Guo authored and intel-lab-lkp committed Apr 19, 2021
1 parent 2b45322 commit 5dc133669083c08a14f24be6e24b5aa1840836c7
Show file tree
Hide file tree
Showing 48 changed files with 131 additions and 52 deletions.
@@ -2834,7 +2834,7 @@ static int sysc_init_soc(struct sysc *ddata)
}

match = soc_device_match(sysc_soc_feat_match);
if (!match)
if (!match || IS_ERR(match))
return 0;

if (match->data)
@@ -439,6 +439,7 @@ static const unsigned int r8a7795es2_mod_nullify[] __initconst = {

static int __init r8a7795_cpg_mssr_init(struct device *dev)
{
const struct soc_device_attribute *match;
const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
u32 cpg_mode;
int error;
@@ -453,7 +454,8 @@ static int __init r8a7795_cpg_mssr_init(struct device *dev)
return -EINVAL;
}

if (soc_device_match(r8a7795es1)) {
match = soc_device_match(r8a7795es1);
if (!IS_ERR(match) && match) {
cpg_core_nullify_range(r8a7795_core_clks,
ARRAY_SIZE(r8a7795_core_clks),
R8A7795_CLK_S0D2, R8A7795_CLK_S0D12);
@@ -383,7 +383,7 @@ int __init rcar_gen2_cpg_init(const struct rcar_gen2_cpg_pll_config *config,
cpg_pll0_div = pll0_div;
cpg_mode = mode;
attr = soc_device_match(cpg_quirks_match);
if (attr)
if (!IS_ERR(attr) && attr)
cpg_quirks = (uintptr_t)attr->data;
pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);

@@ -499,7 +499,7 @@ int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
cpg_clk_extalr = clk_extalr;
cpg_mode = mode;
attr = soc_device_match(cpg_quirks_match);
if (attr)
if (!IS_ERR(attr) && attr)
cpg_quirks = (uintptr_t)attr->data;
pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);

@@ -651,6 +651,7 @@ static int dpaa2_dpdmai_init_channels(struct dpaa2_qdma_engine *dpaa2_qdma)

static int dpaa2_qdma_probe(struct fsl_mc_device *dpdmai_dev)
{
const struct soc_device_attribute *match;
struct device *dev = &dpdmai_dev->dev;
struct dpaa2_qdma_engine *dpaa2_qdma;
struct dpaa2_qdma_priv *priv;
@@ -718,7 +719,11 @@ static int dpaa2_qdma_probe(struct fsl_mc_device *dpdmai_dev)

dpaa2_dpdmai_init_channels(dpaa2_qdma);

if (soc_device_match(soc_fixup_tuning))
match = soc_device_match(soc_fixup_tuning);
if (IS_ERR(match))
return PTR_ERR(match);

if (match)
dpaa2_qdma->qdma_wrtype_fixup = true;
else
dpaa2_qdma->qdma_wrtype_fixup = false;
@@ -33,6 +33,9 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id)
const struct soc_device_attribute *soc;

soc = soc_device_match(k3_soc_devices);
if (IS_ERR(soc))
return PTR_ERR(soc);

if (soc) {
soc_ep_map = soc->data;
} else {
@@ -5188,7 +5188,7 @@ static int udma_probe(struct platform_device *pdev)
ud->match_data = match->data;

soc = soc_device_match(k3_soc_devices);
if (!soc) {
if (!IS_ERR(soc) && !soc) {
dev_err(dev, "No compatible SoC found\n");
return -ENODEV;
}
@@ -1158,7 +1158,7 @@ static int nwl_dsi_probe(struct platform_device *pdev)
}

attr = soc_device_match(nwl_dsi_quirks_match);
if (attr)
if (!IS_ERR(attr) && attr)
dsi->quirks = (uintptr_t)attr->data;

dsi->bridge.driver_private = dsi;
@@ -195,6 +195,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
{
struct platform_device *pdev = to_platform_device(dev);
const struct meson_drm_match_data *match;
const struct soc_device_attribute *attr;
struct meson_drm *priv;
struct drm_device *drm;
struct resource *res;
@@ -291,7 +292,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)

/* Assign limits per soc revision/package */
for (i = 0 ; i < ARRAY_SIZE(meson_drm_soc_attrs) ; ++i) {
if (soc_device_match(meson_drm_soc_attrs[i].attrs)) {
attr = soc_device_match(meson_drm_soc_attrs[i].attrs);
if (!IS_ERR(attr) && attr) {
priv->limits = &meson_drm_soc_attrs[i].limits;
break;
}
@@ -4742,7 +4742,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
* string, use SoC device matching.
*/
soc = soc_device_match(dispc_soc_devices);
if (soc)
if (!IS_ERR(soc) && soc)
dispc->feat = soc->data;
else
dispc->feat = of_match_device(dispc_of_match, &pdev->dev)->data;
@@ -677,12 +677,14 @@ static const struct soc_device_attribute dpi_soc_devices[] = {
static int dpi_init_regulator(struct dpi_data *dpi)
{
struct regulator *vdds_dsi;
struct soc_device_attribute *soc;

/*
* The DPI uses the DSI VDDS on OMAP34xx, OMAP35xx, OMAP36xx, AM37xx and
* DM37xx only.
*/
if (!soc_device_match(dpi_soc_devices))
soc = soc_device_match(dpi_soc_devices);
if (!IS_ERR(soc) && !soc)
return 0;

vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi");
@@ -4950,6 +4950,9 @@ static int dsi_probe(struct platform_device *pdev)
}

soc = soc_device_match(dsi_soc_devices);
if (IS_ERR(soc))
return PTR_ERR(soc);

if (soc)
dsi->data = soc->data;
else
@@ -1446,6 +1446,9 @@ static int dss_probe(struct platform_device *pdev)
* string, use SoC device matching.
*/
soc = soc_device_match(dss_soc_devices);
if (IS_ERR(soc))
return PTR_ERR(soc);

if (soc)
dss->feat = soc->data;
else
@@ -874,6 +874,9 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
const struct soc_device_attribute *soc;

soc = soc_device_match(hdmi4_soc_devices);
if (IS_ERR(soc))
return PTR_ERR(soc);

if (!soc)
return -ENODEV;

@@ -805,6 +805,7 @@ static const struct soc_device_attribute venc_soc_devices[] = {

static int venc_probe(struct platform_device *pdev)
{
const struct soc_device_attribute *match;
struct venc_device *venc;
struct resource *venc_mem;
int r;
@@ -818,7 +819,8 @@ static int venc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, venc);

/* The OMAP34xx, OMAP35xx and AM35xx VENC require the TV DAC clock. */
if (soc_device_match(venc_soc_devices))
match = soc_device_match(venc_soc_devices);
if (!IS_ERR(match) && match)
venc->requires_tv_dac_clk = true;

venc->config = &venc_config_pal_trm;
@@ -575,6 +575,9 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
priv->dss->mgr_ops_priv = priv;

soc = soc_device_match(omapdrm_soc_devices);
if (IS_ERR(soc))
return PTR_ERR(soc);

priv->omaprev = soc ? (unsigned int)soc->data : 0;
priv->wq = alloc_ordered_workqueue("omapdrm", 0);

@@ -215,6 +215,7 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;
struct rcar_du_device *rcdu = rcrtc->dev;
unsigned long mode_clock = mode->clock * 1000;
const struct soc_device_attribute *match;
u32 dsmr;
u32 escr;

@@ -238,7 +239,8 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
* no post-divider when a display PLL is present (as shown by
* the workaround breaking HDMI output on M3-W during testing).
*/
if (soc_device_match(rcar_du_r8a7795_es1)) {
match = soc_device_match(rcar_du_r8a7795_es1);
if (!IS_ERR(match) && match) {
target *= 2;
div = 1;
}
@@ -912,7 +912,7 @@ static int rcar_lvds_probe(struct platform_device *pdev)
lvds->info = of_device_get_match_data(&pdev->dev);

attr = soc_device_match(lvds_quirk_matches);
if (attr)
if (!IS_ERR(attr) && attr)
lvds->info = attr->data;

ret = rcar_lvds_parse_dt(lvds);
@@ -2643,8 +2643,10 @@ static void dispc_init_errata(struct dispc_device *dispc)
{ .family = "AM65X", .revision = "SR1.0" },
{ /* sentinel */ }
};
const struct soc_device_attribute *match;

if (soc_device_match(am65x_sr10_soc_devices)) {
match = soc_device_match(am65x_sr10_soc_devices);
if (!IS_ERR(match) && match) {
dispc->errata.i2000 = true;
dev_info(dispc->dev, "WA for erratum i2000: YUV formats disabled\n");
}
@@ -757,17 +757,20 @@ static const char * const devices_allowlist[] = {

static bool ipmmu_device_is_allowed(struct device *dev)
{
const struct soc_device_attribute *match1, *match2;
unsigned int i;

/*
* R-Car Gen3 and RZ/G2 use the allow list to opt-in devices.
* For Other SoCs, this returns true anyway.
*/
if (!soc_device_match(soc_needs_opt_in))
match1 = soc_device_match(soc_needs_opt_in);
if (!IS_ERR(match1) && !match1)
return true;

/* Check whether this SoC can use the IPMMU correctly or not */
if (soc_device_match(soc_denylist))
match2 = soc_device_match(soc_denylist);
if (!IS_ERR(match2) && !match2)
return false;

/* Check whether this device can work with the IPMMU */
@@ -1413,7 +1413,7 @@ static int rcar_vin_probe(struct platform_device *pdev)
* uses different routing than r8a7795 ES2.0.
*/
attr = soc_device_match(r8a7795es1);
if (attr)
if (!IS_ERR(attr) && attr)
vin->info = attr->data;

vin->base = devm_platform_ioremap_resource(pdev, 0);
@@ -1214,7 +1214,7 @@ static int rcsi2_probe(struct platform_device *pdev)
* share the same compatible string.
*/
attr = soc_device_match(r8a7795);
if (attr)
if (!IS_ERR(attr) && attr)
priv->info = attr->data;

priv->dev = &pdev->dev;
@@ -240,14 +240,16 @@ static const struct soc_device_attribute vsp1_r8a7796[] = {
struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index)
{
struct vsp1_uif *uif;
const struct soc_device_attribute *attr;
char name[6];
int ret;

uif = devm_kzalloc(vsp1->dev, sizeof(*uif), GFP_KERNEL);
if (!uif)
return ERR_PTR(-ENOMEM);

if (soc_device_match(vsp1_r8a7796))
attr = soc_device_match(vsp1_r8a7796);
if (!IS_ERR(attr) && attr)
uif->m3w_quirk = true;

uif->entity.ops = &uif_entity_ops;
@@ -951,7 +951,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
of_data = of_device_get_match_data(&pdev->dev);

attr = soc_device_match(sdhi_quirks_match);
if (attr)
if (!IS_ERR(attr) && attr)
quirks = attr->data;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -408,7 +408,7 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
const struct soc_device_attribute *soc = soc_device_match(soc_dma_quirks);
struct device *dev = &pdev->dev;

if (soc)
if (!IS_ERR(soc) && soc)
global_flags |= (unsigned long)soc->data;

/* value is max of SD_SECCNT. Confirmed by HW engineers */
@@ -1336,6 +1336,7 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
struct sdhci_esdhc *esdhc;
struct device_node *np;
struct clk *clk;
const struct soc_device_attribute *match1, *match2, *match3;
u32 val;
u16 host_ver;

@@ -1346,17 +1347,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
SDHCI_VENDOR_VER_SHIFT;
esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
if (soc_device_match(soc_incorrect_hostver))
match1 = soc_device_match(soc_incorrect_hostver);
if (!IS_ERR(match1) && match1)
esdhc->quirk_incorrect_hostver = true;
else
esdhc->quirk_incorrect_hostver = false;

if (soc_device_match(soc_fixup_sdhc_clkdivs))
match2 = soc_device_match(soc_fixup_sdhc_clkdivs);
if (!IS_ERR(match2) && match2)
esdhc->quirk_limited_clk_division = true;
else
esdhc->quirk_limited_clk_division = false;

if (soc_device_match(soc_unreliable_pulse_detection))
match3 = soc_device_match(soc_unreliable_pulse_detection);
if (!IS_ERR(match3) && match3)
esdhc->quirk_unreliable_pulse_detection = true;
else
esdhc->quirk_unreliable_pulse_detection = false;
@@ -1417,6 +1421,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
struct device_node *np;
struct sdhci_pltfm_host *pltfm_host;
struct sdhci_esdhc *esdhc;
const struct soc_device_attribute *match1, *match2;
int ret;

np = pdev->dev.of_node;
@@ -1443,12 +1448,18 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)

pltfm_host = sdhci_priv(host);
esdhc = sdhci_pltfm_priv(pltfm_host);
if (soc_device_match(soc_tuning_erratum_type1))
match1 = soc_device_match(soc_tuning_erratum_type1);
if (IS_ERR(match1))
return PTR_ERR(match1);
if (match1)
esdhc->quirk_tuning_erratum_type1 = true;
else
esdhc->quirk_tuning_erratum_type1 = false;

if (soc_device_match(soc_tuning_erratum_type2))
match2 = soc_device_match(soc_tuning_erratum_type2);
if (IS_ERR(match2))
return PTR_ERR(match2);
if (match2)
esdhc->quirk_tuning_erratum_type2 = true;
else
esdhc->quirk_tuning_erratum_type2 = false;
@@ -1132,7 +1132,7 @@ static int sdhci_omap_probe(struct platform_device *pdev)
goto err_pltfm_free;

soc = soc_device_match(sdhci_omap_soc_devices);
if (soc) {
if (!IS_ERR(soc) && soc) {
omap_host->version = "rev11";
if (!strcmp(dev_name(dev), "4809c000.mmc"))
mmc->f_max = 96000000;
@@ -787,7 +787,7 @@ static int sdhci_am654_probe(struct platform_device *pdev)

/* Update drvdata based on SoC revision */
soc = soc_device_match(sdhci_am654_devices);
if (soc && soc->data)
if (!IS_ERR(soc) && soc && soc->data)
drvdata = soc->data;

host = sdhci_pltfm_init(pdev, drvdata->pdata, sizeof(*sdhci_am654));

0 comments on commit 5dc1336

Please sign in to comment.