Message ID | 20220924015616.34293-11-yuancan@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/panel: Use dev_err_probe() to simplify code | expand |
Hi, On Fri, Sep 23, 2022 at 6:59 PM Yuan Can <yuancan@huawei.com> wrote: > > In the probe path, dev_err() can be replaced with dev_err_probe() > which will check if error code is -EPROBE_DEFER and prints the > error name. It also sets the defer probe reason which can be > checked later through debugfs. > > Signed-off-by: Yuan Can <yuancan@huawei.com> > --- > drivers/gpu/drm/panel/panel-simple.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c > index 0cb3be26e2e6..1607824dc2b3 100644 > --- a/drivers/gpu/drm/panel/panel-simple.c > +++ b/drivers/gpu/drm/panel/panel-simple.c > @@ -575,12 +575,9 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) > > panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", > GPIOD_OUT_LOW); > - if (IS_ERR(panel->enable_gpio)) { > - err = PTR_ERR(panel->enable_gpio); > - if (err != -EPROBE_DEFER) > - dev_err(dev, "failed to request GPIO: %d\n", err); > - return err; > - } > + if (IS_ERR(panel->enable_gpio)) > + return dev_err_probe(dev, PTR_ERR(panel->enable_gpio), > + "failed to request GPIO\n"); Reviewed-by: Douglas Anderson <dianders@chromium.org> I'd be happy to land this patch and the panel-edp one into drm-misc just because I've touched those panel drivers in the past. I'd tend to leave the other panel drivers to others unless you really get stuck. For now I'll sit tight because I think you can make a 2nd fix to the panel-edp one and put them into the same patch. -Doug
在 2022/9/29 7:03, Doug Anderson 写道: > Hi, > > On Fri, Sep 23, 2022 at 6:59 PM Yuan Can <yuancan@huawei.com> wrote: >> In the probe path, dev_err() can be replaced with dev_err_probe() >> which will check if error code is -EPROBE_DEFER and prints the >> error name. It also sets the defer probe reason which can be >> checked later through debugfs. >> >> Signed-off-by: Yuan Can <yuancan@huawei.com> >> --- >> drivers/gpu/drm/panel/panel-simple.c | 9 +++------ >> 1 file changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c >> index 0cb3be26e2e6..1607824dc2b3 100644 >> --- a/drivers/gpu/drm/panel/panel-simple.c >> +++ b/drivers/gpu/drm/panel/panel-simple.c >> @@ -575,12 +575,9 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) >> >> panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", >> GPIOD_OUT_LOW); >> - if (IS_ERR(panel->enable_gpio)) { >> - err = PTR_ERR(panel->enable_gpio); >> - if (err != -EPROBE_DEFER) >> - dev_err(dev, "failed to request GPIO: %d\n", err); >> - return err; >> - } >> + if (IS_ERR(panel->enable_gpio)) >> + return dev_err_probe(dev, PTR_ERR(panel->enable_gpio), >> + "failed to request GPIO\n"); > Reviewed-by: Douglas Anderson <dianders@chromium.org> > > I'd be happy to land this patch and the panel-edp one into drm-misc > just because I've touched those panel drivers in the past. I'd tend to > leave the other panel drivers to others unless you really get stuck. > > For now I'll sit tight because I think you can make a 2nd fix to the > panel-edp one and put them into the same patch. Thanks for the notice, I will fix the case in panel_edp_probe in the v2 patch and send it ASAP.
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 0cb3be26e2e6..1607824dc2b3 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -575,12 +575,9 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(panel->enable_gpio)) { - err = PTR_ERR(panel->enable_gpio); - if (err != -EPROBE_DEFER) - dev_err(dev, "failed to request GPIO: %d\n", err); - return err; - } + if (IS_ERR(panel->enable_gpio)) + return dev_err_probe(dev, PTR_ERR(panel->enable_gpio), + "failed to request GPIO\n"); err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation); if (err) {
In the probe path, dev_err() can be replaced with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. It also sets the defer probe reason which can be checked later through debugfs. Signed-off-by: Yuan Can <yuancan@huawei.com> --- drivers/gpu/drm/panel/panel-simple.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)