i2c: stm32: Simplify with dev_err_probe()
Subsystems (11)
PATCH 1/9 i2c: stm32: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/busses/i2c-stm32.c | 11 ++++------- drivers/i2c/busses/i2c-stm32f4.c | 6 ++---- drivers/i2c/busses/i2c-stm32f7.c | 24 +++++++++--------------- 3 files changed, 15 insertions(+), 26 deletions(-)
drivers/i2c/busses/i2c-stm32.c +4 -7
@@ -25,9 +25,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,/* Request and configure I2C TX dma channel */ dma->chan_tx =dma_request_chan (dev,"tx" );if (IS_ERR (dma->chan_tx)) { - ret =PTR_ERR (dma->chan_tx); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"can't request DMA tx channel\n" ); + ret =dev_err_probe (dev,PTR_ERR (dma->chan_tx), +"can't request DMA tx channel\n" ); goto fail_al; }
@@ -45,10 +44,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,/* Request and configure I2C RX dma channel */ dma->chan_rx =dma_request_chan (dev,"rx" );if (IS_ERR (dma->chan_rx)) { - ret =PTR_ERR (dma->chan_rx); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"can't request DMA rx channel\n" ); - + ret =dev_err_probe (dev,PTR_ERR (dma->chan_rx), +"can't request DMA rx channel\n" ); goto fail_tx; }
drivers/i2c/busses/i2c-stm32f4.c +2 -4
@@ -797,10 +797,8 @@ static int stm32f4_i2c_probe(struct platform_device *pdev) rst =devm_reset_control_get_exclusive (&pdev->dev,NULL );if (IS_ERR (rst)) { - ret =PTR_ERR (rst); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Error: Missing reset ctrl\n" ); - + ret =dev_err_probe (&pdev->dev,PTR_ERR (rst), +"Error: Missing reset ctrl\n" ); goto clk_free; }reset_control_assert (rst);
drivers/i2c/busses/i2c-stm32f7.c +9 -15
@@ -1968,11 +1968,9 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) "wakeup-source"); i2c_dev->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (i2c_dev->clk)) { -if (PTR_ERR (i2c_dev->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get controller clock\n" ); -return PTR_ERR (i2c_dev->clk); - } +if (IS_ERR (i2c_dev->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2c_dev->clk), +"Failed to get controller clock\n" ); ret =clk_prepare_enable (i2c_dev->clk);if (ret) {
@@ -1982,10 +1980,8 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) rst =devm_reset_control_get (&pdev->dev,NULL );if (IS_ERR (rst)) { - ret =PTR_ERR (rst); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Error: Missing reset ctrl\n" ); - + ret =dev_err_probe (&pdev->dev,PTR_ERR (rst), +"Error: Missing reset ctrl\n" ); goto clk_free; }reset_control_assert (rst);
@@ -2052,13 +2048,11 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) i2c_dev->dma =stm32_i2c_dma_request (i2c_dev->dev, phy_addr,STM32F7_I2C_TXDR ,STM32F7_I2C_RXDR ); -if (PTR_ERR (i2c_dev->dma) == -ENODEV ) +if (PTR_ERR (i2c_dev->dma) == -ENODEV ) { i2c_dev->dma =NULL ; -else if (IS_ERR (i2c_dev->dma)) { - ret =PTR_ERR (i2c_dev->dma); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"Failed to request dma error %i\n" , ret); + }else if (IS_ERR (i2c_dev->dma)) { + ret =dev_err_probe (&pdev->dev,PTR_ERR (i2c_dev->dma), +"Failed to request dma error\n" ); goto fmp_clear; }
Signature · 7 lines
2.17.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH 2/9 i2c: xiic: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/busses/i2c-xiic.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-xiic.c +4 -5
@@ -787,11 +787,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)init_waitqueue_head (&i2c->wait); i2c->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (i2c->clk)) { -if (PTR_ERR (i2c->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"input clock not found.\n" ); -return PTR_ERR (i2c->clk); - } +if (IS_ERR (i2c->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2c->clk), +"input clock not found.\n" ); + ret =clk_prepare_enable (i2c->clk);if (ret) {dev_err (&pdev->dev,"Unable to enable clock.\n" );
Signature · 7 lines
2.17.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH 2/9] i2c: xiic: Simplify with dev_err_probe()
st 2. 9. 2020 v 17:10 odesílatel Krzysztof Kozlowski <[email protected]> napsal:
Quoted 33 lines
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 <[email protected]>--- drivers/i2c/busses/i2c-xiic.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-xiic.c +4
-6@@ -787,11 +787,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)init_waitqueue_head (&i2c->wait); i2c->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (i2c->clk)) { -if (PTR_ERR (i2c->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"input clock not found.\n" ); -return PTR_ERR (i2c->clk); - } +if (IS_ERR (i2c->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2c->clk), +"input clock not found.\n" ); + ret =clk_prepare_enable (i2c->clk);if (ret) {dev_err (&pdev->dev,"Unable to enable clock.\n" ); --2.17.1
Quoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
I see that this didn't go through.
Wolfram: Can you please apply?
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Wolfram Sang
AppliedRe: [PATCH 2/9] i2c: xiic: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Applied to for-next, thanks!
PATCH 3/9 i2c: bcm2835: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/busses/i2c-bcm2835.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-bcm2835.c +3 -5
@@ -421,11 +421,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)return PTR_ERR (i2c_dev->regs); mclk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (mclk)) { -if (PTR_ERR (mclk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Could not get clock\n" ); -return PTR_ERR (mclk); - } +if (IS_ERR (mclk)) +return dev_err_probe (&pdev->dev,PTR_ERR (mclk), +"Could not get clock\n" ); i2c_dev->bus_clk =bcm2835_i2c_register_div (&pdev->dev, mclk, i2c_dev);
Signature · 7 lines
2.17.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH 3/9] i2c: bcm2835: Simplify with dev_err_probe()
Quoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Signature · 6 lines
Florian _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Wolfram Sang
AppliedRe: [PATCH 3/9] i2c: bcm2835: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Applied to for-next, thanks!
PATCH 4/9 i2c: cadence: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/busses/i2c-cadence.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-cadence.c +4 -5
@@ -1214,11 +1214,10 @@ static int cdns_i2c_probe(struct platform_device *pdev) "Cadence I2C at %08lx", (unsigned long)r_mem->start); id->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (id->clk)) { -if (PTR_ERR (id->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"input clock not found.\n" ); -return PTR_ERR (id->clk); - } +if (IS_ERR (id->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (id->clk), +"input clock not found.\n" ); + ret =clk_prepare_enable (id->clk);if (ret)dev_err (&pdev->dev,"Unable to enable clock.\n" );
Signature · 1 line
2.17.1
Re: [PATCH 4/9] i2c: cadence: Simplify with dev_err_probe()
st 2. 9. 2020 v 17:10 odesílatel Krzysztof Kozlowski <[email protected]> napsal:
Quoted 33 lines
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 <[email protected]>--- drivers/i2c/busses/i2c-cadence.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-cadence.c +4
-6@@ -1214,11 +1214,10 @@ static int cdns_i2c_probe(struct platform_device *pdev) "Cadence I2C at %08lx", (unsigned long)r_mem->start); id->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (id->clk)) { -if (PTR_ERR (id->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"input clock not found.\n" ); -return PTR_ERR (id->clk); - } +if (IS_ERR (id->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (id->clk), +"input clock not found.\n" ); + ret =clk_prepare_enable (id->clk);if (ret)dev_err (&pdev->dev,"Unable to enable clock.\n" ); --2.17.1
Quoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Also this one is pending but still possible to apply without any conflict.
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Wolfram Sang
AppliedRe: [PATCH 4/9] i2c: cadence: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Applied to for-next, thanks!
PATCH 5/9 i2c: davinci: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/busses/i2c-davinci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/i2c/busses/i2c-davinci.c +1 -4
@@ -768,10 +768,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)if (irq <=0 ) {if (!irq) irq = -ENXIO ; -if (irq != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"can't get irq resource ret=%d\n" , irq); -return irq; +return dev_err_probe (&pdev->dev, irq,"can't get irq resource\n" ); } dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev),
Signature · 1 line
2.17.1
Wolfram Sang
AppliedRe: [PATCH 5/9] i2c: davinci: Simplify with dev_err_probe()
Quoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Applied to for-next, thanks!
PATCH 6/9 i2c: imx: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/busses/i2c-imx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-imx.c +3 -5
@@ -1159,11 +1159,9 @@ static int i2c_imx_probe(struct platform_device *pdev)/* Get I2C clock */ i2c_imx->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (i2c_imx->clk)) { -if (PTR_ERR (i2c_imx->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"can't get I2C clock\n" ); -return PTR_ERR (i2c_imx->clk); - } +if (IS_ERR (i2c_imx->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2c_imx->clk), +"can't get I2C clock\n" ); ret =clk_prepare_enable (i2c_imx->clk);if (ret) {
Signature · 1 line
2.17.1
Re: [PATCH 6/9] i2c: imx: Simplify with dev_err_probe()
Quoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Thanks
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH 6/9] i2c: imx: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Quoted 32 lines
--- drivers/i2c/busses/i2c-imx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-imx.c +3
-5@@ -1159,11 +1159,9 @@ static int i2c_imx_probe(struct platform_device *pdev)/* Get I2C clock */ i2c_imx->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (i2c_imx->clk)) { -if (PTR_ERR (i2c_imx->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"can't get I2C clock\n" ); -return PTR_ERR (i2c_imx->clk); - } +if (IS_ERR (i2c_imx->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2c_imx->clk), +"can't get I2C clock\n" ); ret =clk_prepare_enable (i2c_imx->clk);if (ret) {Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 6/9] i2c: imx: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Thanks, but this patch was a bit earlier:
http://patchwork.ozlabs.org/project/linux-i2c/patch/[email protected]/
PATCH 7/9 i2c: rk3x: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/busses/i2c-rk3x.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/i2c/busses/i2c-rk3x.c +7 -12
@@ -1312,18 +1312,13 @@ static int rk3x_i2c_probe(struct platform_device *pdev) i2c->pclk =devm_clk_get (&pdev->dev,"pclk" ); } -if (IS_ERR (i2c->clk)) { - ret =PTR_ERR (i2c->clk); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Can't get bus clk: %d\n" , ret); -return ret; - } -if (IS_ERR (i2c->pclk)) { - ret =PTR_ERR (i2c->pclk); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Can't get periph clk: %d\n" , ret); -return ret; - } +if (IS_ERR (i2c->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2c->clk), +"Can't get bus clk\n" ); + +if (IS_ERR (i2c->pclk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2c->pclk), +"Can't get periph clk\n" ); ret =clk_prepare (i2c->clk);if (ret <0 ) {
Signature · 1 line
2.17.1
Re: [PATCH 7/9] i2c: rk3x: Simplify with dev_err_probe()
Am Mittwoch, 2. September 2020, 17:06:41 CEST schrieb Krzysztof Kozlowski:
Quoted 4 lines
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 <[email protected]>
Wolfram Sang
AppliedRe: [PATCH 7/9] i2c: rk3x: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Applied to for-next, thanks!
PATCH 8/9 i2c: mux: gpmux: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/muxes/i2c-mux-gpmux.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/i2c/muxes/i2c-mux-gpmux.c +6 -10
@@ -85,18 +85,14 @@ static int i2c_mux_probe(struct platform_device *pdev)return -ENOMEM ; mux->control =devm_mux_control_get (dev,NULL ); -if (IS_ERR (mux->control)) { -if (PTR_ERR (mux->control) != -EPROBE_DEFER ) -dev_err (dev,"failed to get control-mux\n" ); -return PTR_ERR (mux->control); - } +if (IS_ERR (mux->control)) +return dev_err_probe (dev,PTR_ERR (mux->control), +"failed to get control-mux\n" ); parent =mux_parent_adapter (dev); -if (IS_ERR (parent)) { -if (PTR_ERR (parent) != -EPROBE_DEFER ) -dev_err (dev,"failed to get i2c-parent adapter\n" ); -return PTR_ERR (parent); - } +if (IS_ERR (parent)) +return dev_err_probe (dev,PTR_ERR (parent), +"failed to get i2c-parent adapter\n" ); children =of_get_child_count (np);
Signature · 1 line
2.17.1
Re: [PATCH 8/9] i2c: mux: gpmux: Simplify with dev_err_probe()
Quoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Cheers,
Peter
Wolfram Sang
AppliedRe: [PATCH 8/9] i2c: mux: gpmux: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Applied to for-next, thanks!
PATCH 9/9 i2c: mux: reg: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.
--- drivers/i2c/muxes/i2c-mux-reg.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/i2c/muxes/i2c-mux-reg.c +3 -7
@@ -171,13 +171,9 @@ static int i2c_mux_reg_probe(struct platform_device *pdev) sizeof(mux->data)); }else { ret =i2c_mux_reg_probe_dt (mux, pdev); -if (ret == -EPROBE_DEFER ) -return ret; - -if (ret <0 ) { -dev_err (&pdev->dev,"Error parsing device tree" ); -return ret; - } +if (ret <0 ) +return dev_err_probe (&pdev->dev, ret, +"Error parsing device tree" ); } parent =i2c_get_adapter (mux->data.parent);
Signature · 1 line
2.17.1
Re: [PATCH 9/9] i2c: mux: reg: Simplify with dev_err_probe()
Quoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Cheers,
Peter
Wolfram Sang
AppliedRe: [PATCH 9/9] i2c: mux: reg: Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Applied to for-next, thanks!
Hi,
Quoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Quoted 105 lines
--- drivers/i2c/busses/i2c-stm32.c | 11 ++++------- drivers/i2c/busses/i2c-stm32f4.c | 6 ++---- drivers/i2c/busses/i2c-stm32f7.c | 24 +++++++++--------------- 3 files changed, 15 insertions(+), 26 deletions(-)drivers/i2c/busses/i2c-stm32.c +4
-7@@ -25,9 +25,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,/* Request and configure I2C TX dma channel */ dma->chan_tx =dma_request_chan (dev,"tx" );if (IS_ERR (dma->chan_tx)) { - ret =PTR_ERR (dma->chan_tx); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"can't request DMA tx channel\n" ); + ret =dev_err_probe (dev,PTR_ERR (dma->chan_tx), +"can't request DMA tx channel\n" ); goto fail_al; }@@ -45,10 +44,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,/* Request and configure I2C RX dma channel */ dma->chan_rx =dma_request_chan (dev,"rx" );if (IS_ERR (dma->chan_rx)) { - ret =PTR_ERR (dma->chan_rx); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"can't request DMA rx channel\n" ); - + ret =dev_err_probe (dev,PTR_ERR (dma->chan_rx), +"can't request DMA rx channel\n" ); goto fail_tx; }drivers/i2c/busses/i2c-stm32f4.c +2
-4@@ -797,10 +797,8 @@ static int stm32f4_i2c_probe(struct platform_device *pdev) rst =devm_reset_control_get_exclusive (&pdev->dev,NULL );if (IS_ERR (rst)) { - ret =PTR_ERR (rst); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Error: Missing reset ctrl\n" ); - + ret =dev_err_probe (&pdev->dev,PTR_ERR (rst), +"Error: Missing reset ctrl\n" ); goto clk_free; }reset_control_assert (rst);drivers/i2c/busses/i2c-stm32f7.c +9
-15@@ -1968,11 +1968,9 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) "wakeup-source"); i2c_dev->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (i2c_dev->clk)) { -if (PTR_ERR (i2c_dev->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get controller clock\n" ); -return PTR_ERR (i2c_dev->clk); - } +if (IS_ERR (i2c_dev->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2c_dev->clk), +"Failed to get controller clock\n" ); ret =clk_prepare_enable (i2c_dev->clk);if (ret) {@@ -1982,10 +1980,8 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) rst =devm_reset_control_get (&pdev->dev,NULL );if (IS_ERR (rst)) { - ret =PTR_ERR (rst); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Error: Missing reset ctrl\n" ); - + ret =dev_err_probe (&pdev->dev,PTR_ERR (rst), +"Error: Missing reset ctrl\n" ); goto clk_free; }reset_control_assert (rst);@@ -2052,13 +2048,11 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) i2c_dev->dma =stm32_i2c_dma_request (i2c_dev->dev, phy_addr,STM32F7_I2C_TXDR ,STM32F7_I2C_RXDR ); -if (PTR_ERR (i2c_dev->dma) == -ENODEV ) +if (PTR_ERR (i2c_dev->dma) == -ENODEV ) { i2c_dev->dma =NULL ; -else if (IS_ERR (i2c_dev->dma)) { - ret =PTR_ERR (i2c_dev->dma); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"Failed to request dma error %i\n" , ret); + }else if (IS_ERR (i2c_dev->dma)) { + ret =dev_err_probe (&pdev->dev,PTR_ERR (i2c_dev->dma), +"Failed to request dma error\n" ); goto fmp_clear; }Signature · 1 line
2.17.1
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip