Skip to content

Commit 1931cd7

Browse files
krzkstorulf
authored andcommitted
mmc: hi3798mv200: Use syscon_regmap_lookup_by_phandle_args
Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over syscon_regmap_lookup_by_phandle() combined with getting the syscon argument. Except simpler code this annotates within one line that given phandle has arguments, so grepping for code would be easier. There is also no real benefit in printing errors on missing syscon argument, because this is done just too late: runtime check on static/build-time data. Dtschema and Devicetree bindings offer the static/build-time check for this already. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/all/[email protected]>/ Signed-off-by: Ulf Hansson <[email protected]>
1 parent 57a217f commit 1931cd7

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/mmc/host/dw_mmc-hi3798mv200.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ static int dw_mci_hi3798mv200_init(struct dw_mci *host)
181181
{
182182
struct dw_mci_hi3798mv200_priv *priv;
183183
struct device_node *np = host->dev->of_node;
184-
int ret;
185184

186185
priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
187186
if (!priv)
@@ -199,15 +198,12 @@ static int dw_mci_hi3798mv200_init(struct dw_mci *host)
199198
return dev_err_probe(host->dev, PTR_ERR(priv->drive_clk),
200199
"failed to get enabled ciu-drive clock\n");
201200

202-
priv->crg_reg = syscon_regmap_lookup_by_phandle(np, "hisilicon,sap-dll-reg");
201+
priv->crg_reg = syscon_regmap_lookup_by_phandle_args(np, "hisilicon,sap-dll-reg",
202+
1, &priv->sap_dll_offset);
203203
if (IS_ERR(priv->crg_reg))
204204
return dev_err_probe(host->dev, PTR_ERR(priv->crg_reg),
205205
"failed to get CRG reg\n");
206206

207-
ret = of_property_read_u32_index(np, "hisilicon,sap-dll-reg", 1, &priv->sap_dll_offset);
208-
if (ret)
209-
return dev_err_probe(host->dev, ret, "failed to get sample DLL register offset\n");
210-
211207
host->priv = priv;
212208
return 0;
213209
}

0 commit comments

Comments
 (0)