[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210916153241.14416-1-caihuoqing@baidu.com>
Date: Thu, 16 Sep 2021 23:32:40 +0800
From: Cai Huoqing <caihuoqing@...du.com>
To: <caihuoqing@...du.com>
CC: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
"Pengutronix Kernel Team" <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
"NXP Linux Team" <linux-imx@....com>,
<linux-input@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] Input: imx6ul_tsc - Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@...du.com>
---
drivers/input/touchscreen/imx6ul_tsc.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c
index 2d4facf70cdb..47b73b4008ab 100644
--- a/drivers/input/touchscreen/imx6ul_tsc.c
+++ b/drivers/input/touchscreen/imx6ul_tsc.c
@@ -405,12 +405,9 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
init_completion(&tsc->completion);
tsc->xnur_gpio = devm_gpiod_get(&pdev->dev, "xnur", GPIOD_IN);
- if (IS_ERR(tsc->xnur_gpio)) {
- err = PTR_ERR(tsc->xnur_gpio);
- dev_err(&pdev->dev,
- "failed to request GPIO tsc_X- (xnur): %d\n", err);
- return err;
- }
+ if (IS_ERR(tsc->xnur_gpio))
+ return dev_err_probe(&pdev->dev, PTR_ERR(tsc->xnur_gpio),
+ "failed to request GPIO tsc_X- (xnur)\n");
tsc->tsc_regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(tsc->tsc_regs)) {
@@ -427,18 +424,14 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
}
tsc->tsc_clk = devm_clk_get(&pdev->dev, "tsc");
- if (IS_ERR(tsc->tsc_clk)) {
- err = PTR_ERR(tsc->tsc_clk);
- dev_err(&pdev->dev, "failed getting tsc clock: %d\n", err);
- return err;
- }
+ if (IS_ERR(tsc->tsc_clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(tsc->tsc_clk),
+ "failed getting tsc clock\n");
tsc->adc_clk = devm_clk_get(&pdev->dev, "adc");
- if (IS_ERR(tsc->adc_clk)) {
- err = PTR_ERR(tsc->adc_clk);
- dev_err(&pdev->dev, "failed getting adc clock: %d\n", err);
- return err;
- }
+ if (IS_ERR(tsc->adc_clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(tsc->adc_clk),
+ "failed getting adc clock\n");
tsc_irq = platform_get_irq(pdev, 0);
if (tsc_irq < 0)
--
2.25.1
Powered by blists - more mailing lists