Message ID | 20200828153100.19006-1-krzk@kernel.org |
---|---|
State | Accepted |
Commit | fbf821ec632b4bb93ec9224c1e75c36b01ad16ed |
Headers | show |
Series | devfreq: rk3399_dmc: Simplify with dev_err_probe() | expand |
On Sat, Aug 29, 2020 at 12:31 AM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > Common pattern of handling deferred probe can be simplified with > dev_err_probe(). Less code and the error value gets printed. > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> > --- > drivers/devfreq/rk3399_dmc.c | 20 ++++++-------------- > 1 file changed, 6 insertions(+), 14 deletions(-) > > diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c > index 027769e39f9b..35b3542f1f7b 100644 > --- a/drivers/devfreq/rk3399_dmc.c > +++ b/drivers/devfreq/rk3399_dmc.c > @@ -324,22 +324,14 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) > mutex_init(&data->lock); > > data->vdd_center = devm_regulator_get(dev, "center"); > - if (IS_ERR(data->vdd_center)) { > - if (PTR_ERR(data->vdd_center) == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - > - dev_err(dev, "Cannot get the regulator \"center\"\n"); > - return PTR_ERR(data->vdd_center); > - } > + if (IS_ERR(data->vdd_center)) > + return dev_err_probe(dev, PTR_ERR(data->vdd_center), > + "Cannot get the regulator \"center\"\n"); > > data->dmc_clk = devm_clk_get(dev, "dmc_clk"); > - if (IS_ERR(data->dmc_clk)) { > - if (PTR_ERR(data->dmc_clk) == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - > - dev_err(dev, "Cannot get the clk dmc_clk\n"); > - return PTR_ERR(data->dmc_clk); > - } > + if (IS_ERR(data->dmc_clk)) > + return dev_err_probe(dev, PTR_ERR(data->dmc_clk), > + "Cannot get the clk dmc_clk\n"); > > data->edev = devfreq_event_get_edev_by_phandle(dev, 0); > if (IS_ERR(data->edev)) > -- > 2.17.1 > Applied it. Thanks.
On Sat, 29 Aug 2020 at 15:10, Chanwoo Choi <chanwoo@kernel.org> wrote: > > On Sat, Aug 29, 2020 at 12:31 AM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > > > Common pattern of handling deferred probe can be simplified with > > dev_err_probe(). Less code and the error value gets printed. > > > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> > > --- > > drivers/devfreq/rk3399_dmc.c | 20 ++++++-------------- > > 1 file changed, 6 insertions(+), 14 deletions(-) > > > > diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c > > index 027769e39f9b..35b3542f1f7b 100644 > > --- a/drivers/devfreq/rk3399_dmc.c > > +++ b/drivers/devfreq/rk3399_dmc.c > > @@ -324,22 +324,14 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) > > mutex_init(&data->lock); > > > > data->vdd_center = devm_regulator_get(dev, "center"); > > - if (IS_ERR(data->vdd_center)) { > > - if (PTR_ERR(data->vdd_center) == -EPROBE_DEFER) > > - return -EPROBE_DEFER; > > - > > - dev_err(dev, "Cannot get the regulator \"center\"\n"); > > - return PTR_ERR(data->vdd_center); > > - } > > + if (IS_ERR(data->vdd_center)) > > + return dev_err_probe(dev, PTR_ERR(data->vdd_center), > > + "Cannot get the regulator \"center\"\n"); > > > > data->dmc_clk = devm_clk_get(dev, "dmc_clk"); > > - if (IS_ERR(data->dmc_clk)) { > > - if (PTR_ERR(data->dmc_clk) == -EPROBE_DEFER) > > - return -EPROBE_DEFER; > > - > > - dev_err(dev, "Cannot get the clk dmc_clk\n"); > > - return PTR_ERR(data->dmc_clk); > > - } > > + if (IS_ERR(data->dmc_clk)) > > + return dev_err_probe(dev, PTR_ERR(data->dmc_clk), > > + "Cannot get the clk dmc_clk\n"); > > > > data->edev = devfreq_event_get_edev_by_phandle(dev, 0); > > if (IS_ERR(data->edev)) > > -- > > 2.17.1 > > > > Applied it. Thanks. Hi Chanwoo, Do you know what happened with this patch? You replied that it is applied but I cannot find it in the Linus' or next trees. Best regards, Krzysztof
On 21. 2. 28. 오전 1:35, Krzysztof Kozlowski wrote: > On Sat, 29 Aug 2020 at 15:10, Chanwoo Choi <chanwoo@kernel.org> wrote: >> >> On Sat, Aug 29, 2020 at 12:31 AM Krzysztof Kozlowski <krzk@kernel.org> wrote: >>> >>> Common pattern of handling deferred probe can be simplified with >>> dev_err_probe(). Less code and the error value gets printed. >>> >>> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> >>> --- >>> drivers/devfreq/rk3399_dmc.c | 20 ++++++-------------- >>> 1 file changed, 6 insertions(+), 14 deletions(-) >>> >>> diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c >>> index 027769e39f9b..35b3542f1f7b 100644 >>> --- a/drivers/devfreq/rk3399_dmc.c >>> +++ b/drivers/devfreq/rk3399_dmc.c >>> @@ -324,22 +324,14 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) >>> mutex_init(&data->lock); >>> >>> data->vdd_center = devm_regulator_get(dev, "center"); >>> - if (IS_ERR(data->vdd_center)) { >>> - if (PTR_ERR(data->vdd_center) == -EPROBE_DEFER) >>> - return -EPROBE_DEFER; >>> - >>> - dev_err(dev, "Cannot get the regulator \"center\"\n"); >>> - return PTR_ERR(data->vdd_center); >>> - } >>> + if (IS_ERR(data->vdd_center)) >>> + return dev_err_probe(dev, PTR_ERR(data->vdd_center), >>> + "Cannot get the regulator \"center\"\n"); >>> >>> data->dmc_clk = devm_clk_get(dev, "dmc_clk"); >>> - if (IS_ERR(data->dmc_clk)) { >>> - if (PTR_ERR(data->dmc_clk) == -EPROBE_DEFER) >>> - return -EPROBE_DEFER; >>> - >>> - dev_err(dev, "Cannot get the clk dmc_clk\n"); >>> - return PTR_ERR(data->dmc_clk); >>> - } >>> + if (IS_ERR(data->dmc_clk)) >>> + return dev_err_probe(dev, PTR_ERR(data->dmc_clk), >>> + "Cannot get the clk dmc_clk\n"); >>> >>> data->edev = devfreq_event_get_edev_by_phandle(dev, 0); >>> if (IS_ERR(data->edev)) >>> -- >>> 2.17.1 >>> >> >> Applied it. Thanks. > > Hi Chanwoo, > > Do you know what happened with this patch? You replied that it is > applied but I cannot find it in the Linus' or next trees. > Hi Krzysztof, There was some my mistake. I'm sorry. I applied it again to next branch. -- Best Regards, Samsung Electronics Chanwoo Choi
diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index 027769e39f9b..35b3542f1f7b 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -324,22 +324,14 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) mutex_init(&data->lock); data->vdd_center = devm_regulator_get(dev, "center"); - if (IS_ERR(data->vdd_center)) { - if (PTR_ERR(data->vdd_center) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(dev, "Cannot get the regulator \"center\"\n"); - return PTR_ERR(data->vdd_center); - } + if (IS_ERR(data->vdd_center)) + return dev_err_probe(dev, PTR_ERR(data->vdd_center), + "Cannot get the regulator \"center\"\n"); data->dmc_clk = devm_clk_get(dev, "dmc_clk"); - if (IS_ERR(data->dmc_clk)) { - if (PTR_ERR(data->dmc_clk) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(dev, "Cannot get the clk dmc_clk\n"); - return PTR_ERR(data->dmc_clk); - } + if (IS_ERR(data->dmc_clk)) + return dev_err_probe(dev, PTR_ERR(data->dmc_clk), + "Cannot get the clk dmc_clk\n"); data->edev = devfreq_event_get_edev_by_phandle(dev, 0); if (IS_ERR(data->edev))
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> --- drivers/devfreq/rk3399_dmc.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)