driver core: add probe error check helper
Subsystems (121)
A message that is not in the archive (sent off-list or not yet received): CGME20181016072248eucas1p18943ce87e084797cd597afd4edb65a65@eucas1p1.samsung.com
cover driver core: add probe error check helper
Hi Greg, Rafael,
This patchset proposes probe helper function which should simplify little bit resource acquisition error handling, it also extend it with adding defer probe reason to devices_deferred property:
# cat /sys/kernel/debug/devices_deferred exynos-hdmi 13970000.hdmi: cannot find out bridge arizona-extcon tm2-audio sound: Unable to get codec_dai_name
The last patch was generated by cocci script to show the gain for the most obvious probe_err usage scenarios. Of course there are many more places where it could be used.
If the 1st patch will be accepted I can split 3rd one per subsystems if neccessary.
Regards
Andrzej
Andrzej Hajda (3):
driver core: add probe_err log helper
driver core: add deferring probe reason to devices_deferred property
drivers: use probe_err function in obvious cases
drivers/ata/libahci_platform.c | 7 +- drivers/base/base.h | 3 + drivers/base/core.c | 40 +++++++++++ drivers/base/dd.c | 34 +++++++++- drivers/base/power/domain.c | 10 ++- drivers/bus/fsl-mc/fsl-mc-bus.c | 8 +-- drivers/bus/ts-nbus.c | 8 +-- drivers/clk/qcom/clk-spmi-pmic-div.c | 9 +-- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 16 ++--- drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c | 11 ++-- drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c | 5 +- drivers/cpufreq/qcom-cpufreq-kryo.c | 10 ++- drivers/crypto/caam/caamalg_qi2.c | 3 +- drivers/firmware/arm_scmi/driver.c | 9 +-- drivers/firmware/imx/imx-scu.c | 7 +- drivers/gpio/gpio-pca953x.c | 4 +- drivers/gpio/gpio-pisosr.c | 9 +-- .../gpu/drm/omapdrm/displays/encoder-opa362.c | 8 +-- .../gpu/drm/omapdrm/displays/encoder-tfp410.c | 8 +-- .../drm/omapdrm/displays/encoder-tpd12s015.c | 8 +-- drivers/gpu/drm/omapdrm/dss/dpi.c | 8 +-- drivers/gpu/drm/omapdrm/dss/dsi.c | 8 +-- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 8 +-- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 8 +-- drivers/gpu/drm/omapdrm/dss/sdi.c | 8 +-- drivers/gpu/drm/omapdrm/dss/venc.c | 8 +-- drivers/gpu/drm/panel/panel-lvds.c | 10 ++- drivers/gpu/drm/panel/panel-simple.c | 5 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 +- drivers/gpu/drm/vc4/vc4_dsi.c | 23 +++---- drivers/hid/i2c-hid/i2c-hid-core.c | 9 +-- drivers/hwmon/pwm-fan.c | 7 +- drivers/i2c/busses/i2c-bcm2835.c | 8 +-- drivers/i2c/busses/i2c-rk3x.c | 10 ++- drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 30 +++------ drivers/i2c/muxes/i2c-mux-gpmux.c | 16 ++--- drivers/iio/adc/envelope-detector.c | 23 +++---- drivers/iio/adc/rcar-gyroadc.c | 5 +- drivers/iio/afe/iio-rescale.c | 8 +-- drivers/iio/dac/dpot-dac.c | 16 ++--- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 11 ++-- drivers/iio/multiplexer/iio-mux.c | 16 ++--- drivers/input/keyboard/bcm-keypad.c | 8 +-- drivers/input/misc/pwm-beeper.c | 12 ++-- drivers/input/misc/pwm-vibra.c | 18 ++--- drivers/input/mouse/elan_i2c_core.c | 6 +- drivers/input/touchscreen/bu21029_ts.c | 14 ++-- drivers/input/touchscreen/chipone_icn8318.c | 5 +- drivers/input/touchscreen/ektf2127.c | 5 +- drivers/input/touchscreen/elants_i2c.c | 16 ++--- drivers/input/touchscreen/pixcir_i2c_ts.c | 10 ++- drivers/input/touchscreen/raydium_i2c_ts.c | 20 +++--- .../input/touchscreen/resistive-adc-touch.c | 9 +-- drivers/input/touchscreen/silead.c | 15 ++--- drivers/input/touchscreen/sis_i2c.c | 12 ++-- drivers/input/touchscreen/surface3_spi.c | 9 +-- drivers/leds/leds-pwm.c | 7 +- drivers/media/i2c/ad5820.c | 9 +-- drivers/media/i2c/tc358743.c | 10 ++- drivers/media/platform/omap3isp/isp.c | 3 +- drivers/media/platform/video-mux.c | 4 +- drivers/media/rc/gpio-ir-recv.c | 5 +- drivers/media/rc/gpio-ir-tx.c | 10 ++- drivers/mfd/madera-core.c | 6 +- drivers/mmc/host/bcm2835.c | 3 +- drivers/mmc/host/davinci_mmc.c | 5 +- drivers/mmc/host/dw_mmc-zx.c | 6 +- drivers/mmc/host/jz4740_mmc.c | 5 +- drivers/mmc/host/meson-gx-mmc.c | 17 ++--- drivers/mmc/host/sdhci-of-arasan.c | 8 +-- drivers/mtd/nand/onenand/omap2.c | 5 +- drivers/mtd/nand/raw/atmel/nand-controller.c | 20 +++--- drivers/mux/gpio.c | 9 +-- drivers/net/dsa/lantiq_gswip.c | 8 +-- drivers/net/ethernet/renesas/sh_eth.c | 3 +- .../stmicro/stmmac/dwmac-dwc-qos-eth.c | 10 +-- .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 9 +-- .../ethernet/stmicro/stmmac/stmmac_platform.c | 10 +-- drivers/net/ethernet/ti/cpsw.c | 9 ++- drivers/net/ieee802154/mcr20a.c | 5 +- drivers/net/phy/mdio-mux-mmioreg.c | 9 +-- drivers/opp/core.c | 12 ++-- drivers/pci/controller/pcie-rockchip.c | 66 +++++++------------ drivers/phy/amlogic/phy-meson-gxl-usb2.c | 9 +-- drivers/phy/amlogic/phy-meson-gxl-usb3.c | 9 +-- drivers/phy/lantiq/phy-lantiq-rcu-usb2.c | 8 +-- drivers/phy/qualcomm/phy-qcom-qmp.c | 21 +++--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 19 ++---- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 8 +-- drivers/phy/rockchip/phy-rockchip-pcie.c | 9 +-- drivers/phy/st/phy-stm32-usbphyc.c | 10 ++- drivers/platform/x86/intel_cht_int33fe.c | 8 +-- drivers/power/supply/lego_ev3_battery.c | 24 +++---- drivers/pwm/pwm-rockchip.c | 11 ++-- drivers/regulator/gpio-regulator.c | 7 +- drivers/remoteproc/da8xx_remoteproc.c | 11 ++-- drivers/remoteproc/qcom_q6v5.c | 55 ++++++---------- drivers/remoteproc/qcom_q6v5_adsp.c | 9 +-- drivers/remoteproc/qcom_q6v5_mss.c | 11 ++-- drivers/remoteproc/qcom_q6v5_pas.c | 19 ++---- drivers/remoteproc/qcom_wcnss_iris.c | 8 +-- drivers/reset/reset-meson-audio-arb.c | 8 +-- drivers/rtc/rtc-rk808.c | 10 ++- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 7 +- drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 8 +-- drivers/soc/imx/gpcv2.c | 9 ++- drivers/soc/lantiq/gphy.c | 8 +-- drivers/soc/qcom/rpmh-rsc.c | 9 +-- drivers/soc/qcom/smem.c | 8 +-- drivers/soc/qcom/smp2p.c | 9 +-- drivers/spi/spi-tegra114.c | 6 +- drivers/spi/spi-tegra20-slink.c | 6 +- .../clocking-wizard/clk-xlnx-clock-wizard.c | 16 ++--- drivers/thermal/broadcom/bcm2835_thermal.c | 5 +- drivers/thermal/hisi_thermal.c | 5 +- drivers/tty/serial/8250/8250_dw.c | 7 +- drivers/tty/serial/8250/8250_ingenic.c | 12 ++-- drivers/tty/serial/amba-pl011.c | 7 +- drivers/usb/chipidea/ci_hdrc_imx.c | 5 +- drivers/usb/chipidea/ci_hdrc_msm.c | 3 +- drivers/usb/chipidea/ci_hdrc_usb2.c | 7 +- drivers/usb/dwc3/core.c | 24 +++---- drivers/usb/host/ehci-mv.c | 3 +- drivers/usb/host/ehci-omap.c | 5 +- drivers/usb/host/ohci-da8xx.c | 6 +- drivers/usb/musb/da8xx.c | 8 +-- drivers/usb/musb/musb_cppi41.c | 5 +- drivers/usb/typec/tcpm/fusb302.c | 3 +- drivers/video/backlight/gpio_backlight.c | 12 +--- drivers/video/backlight/pwm_bl.c | 3 +- drivers/watchdog/davinci_wdt.c | 8 +-- include/linux/device.h | 2 + sound/soc/atmel/tse850-pcm5142.c | 32 ++++----- sound/soc/codecs/es7241.c | 13 ++-- sound/soc/codecs/max9759.c | 15 ++--- sound/soc/codecs/max9860.c | 8 +-- sound/soc/codecs/pcm3168a.c | 8 +-- sound/soc/codecs/sgtl5000.c | 5 +- sound/soc/codecs/simple-amplifier.c | 5 +- sound/soc/codecs/ssm2305.c | 6 +- sound/soc/davinci/davinci-mcasp.c | 11 ++-- sound/soc/generic/audio-graph-card.c | 3 +- sound/soc/generic/audio-graph-scu-card.c | 3 +- sound/soc/generic/simple-card.c | 3 +- sound/soc/generic/simple-scu-card.c | 3 +- sound/soc/img/img-i2s-in.c | 8 +-- sound/soc/img/img-i2s-out.c | 24 +++---- sound/soc/img/img-parallel-out.c | 24 +++---- sound/soc/img/img-spdif-in.c | 8 +-- sound/soc/img/img-spdif-out.c | 24 +++---- sound/soc/img/pistachio-internal-dac.c | 6 +- sound/soc/meson/axg-card.c | 7 +- sound/soc/meson/axg-fifo.c | 20 +++--- sound/soc/meson/axg-pdm.c | 12 +--- sound/soc/meson/axg-spdifout.c | 8 +-- sound/soc/meson/axg-tdm-formatter.c | 22 ++----- sound/soc/meson/axg-tdm-interface.c | 8 +-- sound/soc/mxs/mxs-sgtl5000.c | 9 +-- sound/soc/sunxi/sun4i-codec.c | 5 +- 159 files changed, 658 insertions(+), 1031 deletions(-)
Signature · 1 line
2.18.0
PATCH 1/3 driver core: add probe_err log helper
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially. probe_err helps to replace such code seqences with simple call, so code:
if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);
--- drivers/base/core.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 39 insertions(+)
drivers/base/core.c +37 -0
@@ -3067,6 +3067,43 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* probe_err - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print message if the error is not -EPROBE_DEFER and propagate it. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* return err; +* with +* return probe_err(dev, err, ...); +* +* Returns @err. +* +*/ +int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +if (err != -EPROBE_DEFER ) { +va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + +__dev_printk (KERN_ERR , dev, &vaf); +va_end (args); + } + +return err; +} +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode) {return fwnode && !IS_ERR (fwnode->secondary);
include/linux/device.h +2 -0
@@ -1577,6 +1577,8 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +int probe_err(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
Signature · 1 line
2.18.0
Re: [PATCH 1/3] driver core: add probe_err log helper
Hello Andrzej,
Quoted 5 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code seqences with simple call, so code:
Quoted 8 lines
if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Signed-off-by Andrzej Hajda <[email protected]>---
Best regards,
Signature · 3 lines
Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat
Mark Brown
maintainerRe: [PATCH 1/3] driver core: add probe_err log helper
In reply to Andrzej HajdaQuoted 4 lines · Andrzej Hajda
drivers/base/core.c +4
-0+int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args;
...
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3106
Quoted 3 lines
drivers/base/core.c +3
-0+return err; +} +
This will need an EXPORT_SYMBOL for modules won't it?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181016/57827625/attachment-0001.sig>
Greg Kroah-Hartman
maintainerRe: [PATCH 1/3] driver core: add probe_err log helper
Quoted 9 lines · Mark Brown
Quoted 4 lines · Andrzej Hajda
drivers/base/core.c +4
-0+int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args;...
Quoted 5 lines
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3106
Quoted 3 lines
drivers/base/core.c +3
-0+return err; +} +This will need an
EXPORT_SYMBOLfor modules won't it?
EXPORT_SYMBOL_GPL() to be specific, as it is dealing with the driver core.
thanks,
greg k-h
Re: [PATCH 1/3] driver core: add probe_err log helper
In reply to Andrzej HajdaQuoted 42 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code seqences with simple call, so code:if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Signed-off-by Andrzej Hajda <[email protected]>--- drivers/base/core.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 39 insertions(+)drivers/base/core.c +16
-0@@ -3067,6 +3067,43 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* probe_err - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print message if the error is not -EPROBE_DEFER and propagate it. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* return err; +* with +* return probe_err(dev, err, ...); +*
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3095
Quoted 10 lines
drivers/base/core.c +9
-0+* Returns @err. +* +*/ +int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +if (err != -EPROBE_DEFER ) {
Why not
if (err == ...)
return err;
...
return err;
?
Better to read, better to maintain. No?
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3100
Quoted 7 lines
drivers/base/core.c +6
-0+va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + +__dev_printk (KERN_ERR , dev, &vaf);
It would be nice to print an error code as well, wouldn't it?
Quoted 25 lines
drivers/base/core.c +6
-0+va_end (args); + } + +return err; +} +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode){ return fwnode && !IS_ERR(fwnode->secondary);include/linux/device.h +2
-1@@ -1577,6 +1577,8 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +int probe_err(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) --2.18.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 1/3] driver core: add probe_err log helper
Quoted 56 lines · Andy Shevchenko
Quoted 40 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code seqences with simple call, so code:if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Signed-off-by Andrzej Hajda <[email protected]>--- drivers/base/core.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 39 insertions(+)drivers/base/core.c +15
-0@@ -3067,6 +3067,43 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* probe_err - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print message if the error is not -EPROBE_DEFER and propagate it. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* return err; +* with +* return probe_err(dev, err, ...); drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3094
Quoted 10 lines
drivers/base/core.c +10
-0+* +* Returns @err. +* +*/ +int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +if (err != -EPROBE_DEFER ) {Why not
if (err == ...)
return err;
Quoted 6 lines
...
return err;?
Better to read, better to maintain. No?
Yes, anyway next patch will re-factor it anyway.
Quoted 8 lines
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3100
Quoted 7 lines
drivers/base/core.c +6
-0+va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + +__dev_printk (KERN_ERR , dev, &vaf);It would be nice to print an error code as well, wouldn't it?
Hmm, on probe fail error is printed anyway (with exception of EPROBE_DEFER, ENODEV and ENXIO):
??? "probe of %s failed with error %d\n"
On the other side currently some drivers prints the error code anyway via dev_err or similar, so I guess during conversion to probe_err it should be removed then.
If we add error code to probe_err is it OK to report it this way? ??? dev_err(dev, "%V, %d\n", &vaf, err);
Regards
Andrzej
Quoted 27 lines
Quoted 26 lines
drivers/base/core.c +6
-0+va_end (args); + } + +return err; +} +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode) {return fwnode && !IS_ERR (fwnode->secondary);include/linux/device.h +2
-1@@ -1577,6 +1577,8 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +int probe_err(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) --2.18.0
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 1/3] driver core: add probe_err log helper
Quoted 79 lines · Andrzej Hajda
Quoted 56 lines · Andy Shevchenko
Quoted 40 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code seqences with simple call, so code:if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Signed-off-by Andrzej Hajda <[email protected]>--- drivers/base/core.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 39 insertions(+)drivers/base/core.c +15
-0@@ -3067,6 +3067,43 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* probe_err - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print message if the error is not -EPROBE_DEFER and propagate it. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* return err; +* with +* return probe_err(dev, err, ...); drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3094
Quoted 10 lines
drivers/base/core.c +10
-0+* +* Returns @err. +* +*/ +int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +if (err != -EPROBE_DEFER ) {Why not
if (err == ...)
return err;Quoted 6 lines
...
return err;?
Better to read, better to maintain. No?
Yes, anyway next patch will re-factor it anyway.
Quoted 7 lines
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3100
Quoted 6 lines
drivers/base/core.c +6
-0+va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + +__dev_printk (KERN_ERR , dev, &vaf);It would be nice to print an error code as well, wouldn't it?
Hmm, on probe fail error is printed anyway (with exception of
EPROBE_DEFER, ENODEV and ENXIO):
??? "probe of %s failed with error %d\n"
On the other side currently some drivers prints the error code anyway viadev_error similar, so I guess during conversion toprobe_errit should be removed then.
Quoted 2 lines
If we add error code to
probe_erris it OK to report it this way? ???dev_err(dev, "%V, %d\n", &vaf, err);
Ups, I forgot that message passed to probe_err will contain already newline character.
So the err must be before message passed to probe_err, for example:
??? dev_err(dev, "err=%d: %V\n", err, &vaf);
Is it OK? Or better leave this part of the patch as is?
Regards
Andrzej
Quoted 29 lines
Regards
AndrzejQuoted 25 lines
Quoted 25 lines
drivers/base/core.c +6
-0+va_end (args); + } + +return err; +} +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode) {return fwnode && !IS_ERR (fwnode->secondary);include/linux/device.h +2
-1@@ -1577,6 +1577,8 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +int probe_err(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) --2.18.0
Re: [PATCH 1/3] driver core: add probe_err log helper
Quoted 29 lines · Andrzej Hajda
Quoted 28 lines · Andrzej Hajda
Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code seqences with simple call, so code:if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Quoted 8 lines
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3100
Quoted 6 lines
drivers/base/core.c +6
-0+va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + +__dev_printk (KERN_ERR , dev, &vaf);It would be nice to print an error code as well, wouldn't it?
Hmm, on probe fail error is printed anyway (with exception of
EPROBE_DEFER, ENODEV and ENXIO):
"probe of %s failed with error %d\n"
On the other side currently some drivers prints the error code anyway viadev_error similar, so I guess during conversion toprobe_errit should be removed then.
Quoted 5 lines
Quoted 2 lines
If we add error code to
probe_erris it OK to report it this way?dev_err(dev, "%V, %d\n", &vaf, err);Ups, I forgot that message passed to
probe_errwill contain already newline character.
You may consider not to pass it.
Quoted 4 lines
So the err must be before message passed to
probe_err, for example:dev_err(dev, "err=%d: %V\n", err, &vaf);Is it OK?
For me would work either (no \n in the message, or err preceding the message).
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 1/3 driver core: add probe_err log helper
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially. probe_err helps to replace such code sequences with simple call, so code:
if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);
---
v2:
- added error value to log message,
- fixed code style,
- added EXPORT_SYMBOL_GPL,
- Added R-B by Javier (I hope the changes did not invalidate it).
--- drivers/base/core.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 39 insertions(+)
drivers/base/core.c +37 -0
@@ -3067,6 +3067,43 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* probe_err - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string, not ended with newline +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print message if the error is not -EPROBE_DEFER and propagate it. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* return err; +* with +* return probe_err(dev, err, ...); +* +* Returns @err. +* +*/ +int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +if (err == -EPROBE_DEFER ) +return err; + +va_start (args, fmt); + vaf.fmt = fmt; + vaf.va = &args; +dev_err (dev,"%pV, %d\n" , &vaf, err); +va_end (args); + +return err; +} +EXPORT_SYMBOL_GPL (probe_err); +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode) {return fwnode && !IS_ERR (fwnode->secondary);
include/linux/device.h +2 -0
@@ -1577,6 +1577,8 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +int probe_err(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
Signature · 1 line
2.18.0
Mark Brown
maintainerRe: [PATCH v2 1/3] driver core: add probe_err log helper
Quoted 5 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code sequences with simple call, so code:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181017/c8603fbe/attachment.sig>
Re: [PATCH v2 1/3] driver core: add probe_err log helper
In reply to Andrzej HajdaQuoted 6 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code sequences with simple call, so code:
Quoted 9 lines
if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Signed-off-by Andrzej Hajda <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>
Looks good to me,
Quoted 75 lines
---
v2:
- added error value to log message,
- fixed code style,
- addedEXPORT_SYMBOL_GPL,
- Added R-B by Javier (I hope the changes did not invalidate it).--- drivers/base/core.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 39 insertions(+)drivers/base/core.c +37
-0@@ -3067,6 +3067,43 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* probe_err - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string, not ended with newline +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print message if the error is not -EPROBE_DEFER and propagate it. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* return err; +* with +* return probe_err(dev, err, ...); +* +* Returns @err. +* +*/ +int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +if (err == -EPROBE_DEFER ) +return err; + +va_start (args, fmt); + vaf.fmt = fmt; + vaf.va = &args; +dev_err (dev,"%pV, %d\n" , &vaf, err); +va_end (args); + +return err; +} +EXPORT_SYMBOL_GPL (probe_err); +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode) {return fwnode && !IS_ERR (fwnode->secondary);include/linux/device.h +2
-1@@ -1577,6 +1577,8 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +int probe_err(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) --2.18.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
Greg Kroah-Hartman
maintainerRe: [PATCH v2 1/3] driver core: add probe_err log helper
In reply to Andrzej HajdaQuoted 78 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code sequences with simple call, so code:if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Signed-off-by Andrzej Hajda <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>---
v2:
- added error value to log message,
- fixed code style,
- addedEXPORT_SYMBOL_GPL,
- Added R-B by Javier (I hope the changes did not invalidate it).--- drivers/base/core.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 39 insertions(+)drivers/base/core.c +37
-0@@ -3067,6 +3067,43 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* probe_err - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string, not ended with newline +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print message if the error is not -EPROBE_DEFER and propagate it. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* return err; +* with +* return probe_err(dev, err, ...); +* +* Returns @err. +* +*/ +int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +if (err == -EPROBE_DEFER ) +return err; + +va_start (args, fmt); + vaf.fmt = fmt; + vaf.va = &args; +dev_err (dev,"%pV, %d\n" , &vaf, err); +va_end (args); + +return err; +} +EXPORT_SYMBOL_GPL (probe_err); +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode) {return fwnode && !IS_ERR (fwnode->secondary);include/linux/device.h +0
-0
include/linux/device.h do { \ · line 1580
Quoted 4 lines
include/linux/device.h +1
-0@@ -1577,6 +1577,8 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +int probe_err(const struct device *dev, int err, const char *fmt, ...);
__printf(3, 4) ?
Russell King - ARM Linux
maintainerRe: [PATCH 1/3] driver core: add probe_err log helper
In reply to Andy ShevchenkoQuoted 30 lines · Andy Shevchenko
Quoted 29 lines · Andrzej Hajda
Quoted 28 lines · Andrzej Hajda
Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code seqences with simple call, so code:if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Quoted 8 lines
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3100
Quoted 6 lines
drivers/base/core.c +6
-0+va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + +__dev_printk (KERN_ERR , dev, &vaf);It would be nice to print an error code as well, wouldn't it?
Hmm, on probe fail error is printed anyway (with exception of
EPROBE_DEFER, ENODEV and ENXIO):
"probe of %s failed with error %d\n"
On the other side currently some drivers prints the error code anyway viadev_error similar, so I guess during conversion toprobe_errit should be removed then.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
If we add error code to
probe_erris it OK to report it this way?dev_err(dev, "%V, %d\n", &vaf, err);Ups, I forgot that message passed to
probe_errwill contain already newline character.You may consider not to pass it.
It's normal to pass the '\n', so by doing this, we create the situation where this function becomes the exception to the norm. That's not a good idea - we will see people forget that appending '\n' should not be done for this particular function.
While we could add a checkpatch rule, that's hassle (extra rework). In any case, I think the message would be much better formatted if we did:
dev_err(dev, "error %d: %V", err, &vaf);
which means we end up with (eg):
error -5: request_irq failed for irq 9
rather than:
request_irq failed for irq 9, -5
which is more confusing.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up
Re: [PATCH 1/3] driver core: add probe_err log helper
Quoted 52 lines · Russell King - ARM Linux
Quoted 30 lines · Andy Shevchenko
Quoted 29 lines · Andrzej Hajda
Quoted 28 lines · Andrzej Hajda
Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code seqences with simple call, so code:if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);Quoted 8 lines
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3100
Quoted 6 lines
drivers/base/core.c +6
-0+va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + +__dev_printk (KERN_ERR , dev, &vaf);It would be nice to print an error code as well, wouldn't it?
Hmm, on probe fail error is printed anyway (with exception of
EPROBE_DEFER, ENODEV and ENXIO):
"probe of %s failed with error %d\n"
On the other side currently some drivers prints the error code anyway viadev_error similar, so I guess during conversion toprobe_errit should be removed then.Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
If we add error code to
probe_erris it OK to report it this way?dev_err(dev, "%V, %d\n", &vaf, err);Ups, I forgot that message passed to
probe_errwill contain already newline character.You may consider not to pass it.
It's normal to pass the '\n', so by doing this, we create the situation where this function becomes the exception to the norm. That's not a good idea - we will see people forget that appending '\n' should not be done for this particular function.
While we could add a checkpatch rule, that's hassle (extra rework). In any case, I think the message would be much better formatted if we did:
dev_err(dev, "error %d: %V", err, &vaf);which means we end up with (eg):
Quoted 7 lines
error -5:
request_irqfailed for irq 9rather than:
request_irqfailed for irq 9, -5which is more confusing.
As I said earlier, I'm fine to either variant and I see your point here, so, I tend to agree to this variant.
P.S. Andrzej, in any case my Rb tag, which I just gave, stays.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 1/4 driver core: add probe_err log helper
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially. probe_err helps to replace such code sequences with simple call, so code:
if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return probe_err(dev, err, ...);
---
v3:
- added 'extern __printf(3, 4)' decorators to probe_err,
- changed error logging format - newline at the end,
- added empty lines in probe_err around dev_err,
- added R-b by Mark and Andy.
v2:
- added error value to log message,
- fixed code style,
- added EXPORT_SYMBOL_GPL,
- Added R-B by Javier (I hope the changes did not invalidate it).
--- drivers/base/core.c | 39 +++++++++++++++++++++++++++++++++++++++ include/linux/device.h | 3 +++ 2 files changed, 42 insertions(+)
drivers/base/core.c +39 -0
@@ -3067,6 +3067,45 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* probe_err - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print message if the error is not -EPROBE_DEFER and propagate it. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* return err; +* with +* return probe_err(dev, err, ...); +* +* Returns @err. +* +*/ +int probe_err (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +if (err == -EPROBE_DEFER ) +return err; + +va_start (args, fmt); + vaf.fmt = fmt; + vaf.va = &args; + +dev_err (dev,"error %d: %pV" , err, &vaf); + +va_end (args); + +return err; +} +EXPORT_SYMBOL_GPL (probe_err); +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode) {return fwnode && !IS_ERR (fwnode->secondary);
include/linux/device.h +3 -0
@@ -1577,6 +1577,9 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +extern __printf(3, 4) +int probe_err(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
Signature · 1 line
2.18.0
Re: [PATCH 1/3] driver core: add probe_err log helper
In reply to Russell King - ARM LinuxQuoted 35 lines · Russell King - ARM Linux
Quoted 34 lines · Andy Shevchenko
Quoted 32 lines · Andrzej Hajda
Quoted 26 lines · Andrzej Hajda
Quoted 10 lines · Andy Shevchenko
Quoted 9 lines · Andrzej Hajda
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omited or implemented only partially.
probe_errhelps to replace such code seqences with simple call, so code:if (err != -EPROBE_DEFER) dev_err(dev, ...); return err;becomes:
Quoted 8 lines
drivers/base/core.c define_dev_printk_level(_dev_info, KERN_INFO); · line 3100
Quoted 7 lines
return probe_err(dev, err, ...);drivers/base/core.c +6
-0+va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + +__dev_printk (KERN_ERR , dev, &vaf);It would be nice to print an error code as well, wouldn't it?
Hmm, on probe fail error is printed anyway (with exception of
EPROBE_DEFER, ENODEV and ENXIO):
"probe of %s failed with error %d\n"
On the other side currently some drivers prints the error code anyway viadev_error similar, so I guess during conversion toprobe_errit should be removed then.Quoted 2 lines
If we add error code to
probe_erris it OK to report it this way?dev_err(dev, "%V, %d\n", &vaf, err);Ups, I forgot that message passed to
probe_errwill contain already newline character.
Quoted 8 lines
Quoted 1 line
You may consider not to pass it.
It's normal to pass the '\n', so by doing this, we create the situation where this function becomes the exception to the norm. That's not a good idea - we will see people forget that appending '\n' should not be done for this particular function.
While we could add a checkpatch rule, that's hassle (extra rework).
It would not be a simple checkpatch rule with high confidence because of pr_cont uses that may not be in the patch context.
Quoted 3 lines
In I think the message would be much better formatted if we did:
dev_err(dev, "error %d: %V", err, &vaf);
s/%V/%pV/
PATCH 2/3 driver core: add deferring probe reason to devices_deferred property
In reply to Andrzej Hajda/sys/kernel/debug/devices_deferred property contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason is probe_err function introduced recently, ie. if probe_err will be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user read devices_deferred property.
--- drivers/base/base.h | 3 +++ drivers/base/core.c | 15 +++++++++------ drivers/base/dd.c | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 45 insertions(+), 7 deletions(-)
drivers/base/base.h +3 -0
@@ -75,6 +75,7 @@ struct device_private {struct klist_node knode_driver;struct klist_node knode_bus;struct list_head deferred_probe; +char *deferred_probe_msg;struct device *device; };#define to_device_private_parent (obj) \
@@ -113,6 +114,8 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev);extern void driver_deferred_probe_del (struct device *dev); +extern void __deferred_probe_set_msg (const struct device *dev,const char *fmt, +va_list args);static inline int driver_match_device (struct device_driver *drv,struct device *dev) {
drivers/base/core.c +9 -6
@@ -3076,6 +3076,7 @@ define_dev_printk_level(_dev_info, KERN_INFO);* * This helper implements common pattern present in probe functions for error * checking: print message if the error is not -EPROBE_DEFER and propagate it. +* In case of -EPROBE_DEFER it sets defer probe reason. * It replaces code sequence: * if (err != -EPROBE_DEFER) * dev_err(dev, ...);
@@ -3091,15 +3092,17 @@ int probe_err(const struct device *dev, int err, const char *fmt, ...)struct va_format vaf;va_list args; -if (err != -EPROBE_DEFER ) { -va_start (args, fmt); +va_start (args, fmt); - vaf.fmt = fmt; - vaf.va = &args; + vaf.fmt = fmt; + vaf.va = &args; +if (err != -EPROBE_DEFER )__dev_printk (KERN_ERR , dev, &vaf); -va_end (args); - } +else +__deferred_probe_set_msg (dev, fmt, args); + +va_end (args);return err; }
drivers/base/dd.c +33 -1
@@ -27,6 +27,7 @@#include <linux/async.h> #include <linux/pm_runtime.h> #include <linux/pinctrl/devinfo.h> +#include <linux/slab.h> #include "base.h" #include "power/power.h"
@@ -132,6 +133,8 @@ void driver_deferred_probe_del(struct device *dev)if (!list_empty (&dev->p->deferred_probe)) {dev_dbg (dev,"Removed from deferred list\n" );list_del_init (&dev->p->deferred_probe); +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =NULL ; }mutex_unlock (&deferred_probe_mutex); }
@@ -202,6 +205,32 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +/* +* __deferred_probe_set_msg() - Set defer probe reason message for device +*/ +void __deferred_probe_set_msg (const struct device *dev,const char *fmt, +va_list args) +{ +const int size =128 ; +char **p; +int n; + +mutex_lock (&deferred_probe_mutex); + + p = &dev->p->deferred_probe_msg; +if (!*p) { + *p =kmalloc (size,GFP_KERNEL ); +if (!*p) + goto end; + } + n =snprintf (*p, size,"%s %s: " ,dev_driver_string (dev),dev_name (dev)); +if (n < size) +vsnprintf (*p + n, size - n, fmt, args); + +end: +mutex_unlock (&deferred_probe_mutex); +} +/* * deferred_devs_show() - Show the devices in the deferred probe pending list. */
@@ -212,7 +241,10 @@ static int deferred_devs_show(struct seq_file *s, void *data)mutex_lock (&deferred_probe_mutex);list_for_each_entry (curr, &deferred_probe_pending_list, deferred_probe) -seq_printf (s,"%s\n" ,dev_name (curr->device)); +if (curr->device->p->deferred_probe_msg) +seq_puts (s, curr->device->p->deferred_probe_msg); +else +seq_printf (s,"%s\n" ,dev_name (curr->device));mutex_unlock (&deferred_probe_mutex);
Signature · 1 line
2.18.0
Re: [PATCH 2/3] driver core: add deferring probe reason to devices_deferred property
Quoted 7 lines · Andrzej Hajda
/sys/kernel/debug/devices_deferredproperty contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason isprobe_errfunction introduced recently, ie. ifprobe_errwill be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user readdevices_deferredproperty.
Nice!
Re: [PATCH 2/3] driver core: add deferring probe reason to devices_deferred property
In reply to Andrzej HajdaQuoted 108 lines · Andrzej Hajda
/sys/kernel/debug/devices_deferredproperty contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason isprobe_errfunction introduced recently, ie. ifprobe_errwill be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user readdevices_deferredproperty.Signed-off-by Andrzej Hajda <[email protected]>--- drivers/base/base.h | 3 +++ drivers/base/core.c | 15 +++++++++------ drivers/base/dd.c | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 45 insertions(+), 7 deletions(-)drivers/base/base.h +3
-0@@ -75,6 +75,7 @@ struct device_private {struct klist_node knode_driver;struct klist_node knode_bus;struct list_head deferred_probe; +char *deferred_probe_msg;struct device *device; };#define to_device_private_parent (obj) \@@ -113,6 +114,8 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev);extern void driver_deferred_probe_del (struct device *dev); +extern void __deferred_probe_set_msg (const struct device *dev,const char *fmt, +va_list args);static inline int driver_match_device (struct device_driver *drv,struct device *dev) {drivers/base/core.c +9
-6@@ -3076,6 +3076,7 @@ define_dev_printk_level(_dev_info, KERN_INFO);* * This helper implements common pattern present in probe functions for error * checking: print message if the error is not -EPROBE_DEFER and propagate it. +* In case of -EPROBE_DEFER it sets defer probe reason. * It replaces code sequence: * if (err != -EPROBE_DEFER) * dev_err(dev, ...); @@ -3091,15 +3092,17 @@ int probe_err(const struct device *dev, int err, const char *fmt, ...)struct va_format vaf;va_list args; -if (err != -EPROBE_DEFER ) { -va_start (args, fmt); +va_start (args, fmt); - vaf.fmt = fmt; - vaf.va = &args; + vaf.fmt = fmt; + vaf.va = &args; +if (err != -EPROBE_DEFER )__dev_printk (KERN_ERR , dev, &vaf); -va_end (args); - } +else +__deferred_probe_set_msg (dev, fmt, args); + +va_end (args);return err; }drivers/base/dd.c +14
-0@@ -27,6 +27,7 @@#include <linux/async.h> #include <linux/pm_runtime.h> #include <linux/pinctrl/devinfo.h> +#include <linux/slab.h> #include "base.h" #include "power/power.h" @@ -132,6 +133,8 @@ void driver_deferred_probe_del(struct device *dev)if (!list_empty (&dev->p->deferred_probe)) {dev_dbg (dev,"Removed from deferred list\n" );list_del_init (&dev->p->deferred_probe); +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =NULL ; }mutex_unlock (&deferred_probe_mutex); }@@ -202,6 +205,32 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +/* +* __deferred_probe_set_msg() - Set defer probe reason message for device +*/ +void __deferred_probe_set_msg (const struct device *dev,const char *fmt, +va_list args) +{ +const int size =128 ; +char **p; +int n; + +mutex_lock (&deferred_probe_mutex);
drivers/base/dd.c void device_unblock_probing(void) · line 228
Quoted 10 lines
drivers/base/dd.c +10
-0+ + p = &dev->p->deferred_probe_msg; +if (!*p) { + *p =kmalloc (size,GFP_KERNEL ); +if (!*p) + goto end; + } + n =snprintf (*p, size,"%s %s: " ,dev_driver_string (dev),dev_name (dev)); +if (n < size) +vsnprintf (*p + n, size - n, fmt, args);
I wonder if the vsnprintf() return value should be checked and print a warning if the message was truncated. Probably 128 is enough for most error messages?
Best regards,
Signature · 3 lines
Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat
Re: [PATCH 2/3] driver core: add deferring probe reason to devices_deferred property
In reply to Andrzej HajdaQuoted 17 lines · Andrzej Hajda
/sys/kernel/debug/devices_deferredproperty contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason isprobe_errfunction introduced recently, ie. ifprobe_errwill be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user readdevices_deferredproperty.drivers/base/core.c +2
-4-if (err != -EPROBE_DEFER ) { -va_start (args, fmt); +va_start (args, fmt); - vaf.fmt = fmt; - vaf.va = &args; + vaf.fmt = fmt;
drivers/base/core.c int probe_err(const struct device *dev, int err, const char *fmt, ...) · line 3105
Quoted 10 lines
drivers/base/core.c +6
-2+ vaf.va = &args; +if (err != -EPROBE_DEFER )__dev_printk (KERN_ERR , dev, &vaf); -va_end (args); - } +else +__deferred_probe_set_msg (dev, fmt, args); + +va_end (args);
Yeah, ping-pong style of programming (one patch "amends" something which had been introduced by another).
That's why better to follow my comment for the patch 1.
Quoted 13 lines
drivers/base/dd.c +12
-0+/* +* __deferred_probe_set_msg() - Set defer probe reason message for device +*/ +void __deferred_probe_set_msg (const struct device *dev,const char *fmt, +va_list args) +{ +const int size =128 ; +char **p; +int n; + +mutex_lock (&deferred_probe_mutex); +
drivers/base/dd.c void device_unblock_probing(void) · line 228
Quoted 10 lines
drivers/base/dd.c +9
-0+ p = &dev->p->deferred_probe_msg; +if (!*p) { + *p =kmalloc (size,GFP_KERNEL ); +if (!*p) + goto end; + } + n =snprintf (*p, size,"%s %s: " ,dev_driver_string (dev),dev_name (dev)); +if (n < size) +vsnprintf (*p + n, size - n, fmt, args);
Perhaps kasprintf() instead of this huge plays around the size and allocation?
drivers/base/dd.c static int deferred_devs_show(struct seq_file *s, void *data) · line 247
Quoted 6 lines
list_for_each_entry(curr, &deferred_probe_pending_list, deferred_probe)drivers/base/dd.c +4
-1-seq_printf (s,"%s\n" ,dev_name (curr->device)); +if (curr->device->p->deferred_probe_msg) +seq_puts (s, curr->device->p->deferred_probe_msg); +else +seq_printf (s,"%s\n" ,dev_name (curr->device));
I wouldn't care (much) about debugfs, though better to keep some order here, i.e. always print device name.
Something like
seq_printf(s, "%s\t%s\n", dev_name(), deferred_probe_msg ?: "");
and remove that part from above __deferred_probe_set_msg().
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 2/3 driver core: add deferring probe reason to devices_deferred property
/sys/kernel/debug/devices_deferred property contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason is probe_err function introduced recently, ie. if probe_err will be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user read devices_deferred property.
---
v2:
- changed __deferred_probe_set_msg args - like in __dev_printk, fits better,
- use kasprintf instead of bunch of code,
- keep consistent format of devices_deferred lines,
- added R-Bs (again I hope changes above are not against it).
--- drivers/base/base.h | 3 +++ drivers/base/core.c | 11 +++++++---- drivers/base/dd.c | 21 ++++++++++++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-)
drivers/base/base.h +3 -0
@@ -75,6 +75,7 @@ struct device_private {struct klist_node knode_driver;struct klist_node knode_bus;struct list_head deferred_probe; +char *deferred_probe_msg;struct device *device; };#define to_device_private_parent (obj) \
@@ -113,6 +114,8 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev);extern void driver_deferred_probe_del (struct device *dev); +extern void __deferred_probe_set_msg (const struct device *dev, +struct va_format *vaf);static inline int driver_match_device (struct device_driver *drv,struct device *dev) {
drivers/base/core.c +7 -4
@@ -3076,6 +3076,7 @@ define_dev_printk_level(_dev_info, KERN_INFO);* * This helper implements common pattern present in probe functions for error * checking: print message if the error is not -EPROBE_DEFER and propagate it. +* In case of -EPROBE_DEFER it sets defer probe reason. * It replaces code sequence: * if (err != -EPROBE_DEFER) * dev_err(dev, ...);
@@ -3091,13 +3092,15 @@ int probe_err(const struct device *dev, int err, const char *fmt, ...)struct va_format vaf;va_list args; -if (err == -EPROBE_DEFER ) -return err; -va_start (args, fmt); vaf.fmt = fmt; vaf.va = &args; -dev_err (dev,"%pV, %d\n" , &vaf, err); + +if (err != -EPROBE_DEFER ) +dev_err (dev,"%pV, %d\n" , &vaf, err); +else +__deferred_probe_set_msg (dev, &vaf); +va_end (args);return err;
drivers/base/dd.c +20 -1
@@ -27,6 +27,7 @@#include <linux/async.h> #include <linux/pm_runtime.h> #include <linux/pinctrl/devinfo.h> +#include <linux/slab.h> #include "base.h" #include "power/power.h"
@@ -132,6 +133,8 @@ void driver_deferred_probe_del(struct device *dev)if (!list_empty (&dev->p->deferred_probe)) {dev_dbg (dev,"Removed from deferred list\n" );list_del_init (&dev->p->deferred_probe); +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =NULL ; }mutex_unlock (&deferred_probe_mutex); }
@@ -202,6 +205,21 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +/* +* __deferred_probe_set_msg() - Set defer probe reason message for device +*/ +void __deferred_probe_set_msg (const struct device *dev,struct va_format *vaf) +{ +mutex_lock (&deferred_probe_mutex); + +if (dev->p->deferred_probe_msg) +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =kasprintf (GFP_KERNEL ,"%s: %pV" , +dev_driver_string (dev), vaf); + +mutex_unlock (&deferred_probe_mutex); +} +/* * deferred_devs_show() - Show the devices in the deferred probe pending list. */
@@ -212,7 +230,8 @@ static int deferred_devs_show(struct seq_file *s, void *data)mutex_lock (&deferred_probe_mutex);list_for_each_entry (curr, &deferred_probe_pending_list, deferred_probe) -seq_printf (s,"%s\n" ,dev_name (curr->device)); +seq_printf (s,"%s\t%s\n" ,dev_name (curr->device), + curr->device->p->deferred_probe_msg ?:"" );mutex_unlock (&deferred_probe_mutex);
Signature · 1 line
2.18.0
Re: [PATCH v2 2/3] driver core: add deferring probe reason to devices_deferred property
Quoted 9 lines · Andrzej Hajda
/sys/kernel/debug/devices_deferredproperty contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason isprobe_errfunction introduced recently, ie. ifprobe_errwill be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user readdevices_deferredproperty.
Looks good to me (with one comment below since patch 1 will be changed anyway),
Quoted 51 lines
Signed-off-by Andrzej Hajda <[email protected]>Reviewed-by Mark Brown <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>---
v2:
- changed__deferred_probe_set_msgargs - like in__dev_printk, fits better,
- use kasprintf instead of bunch of code,
- keep consistent format ofdevices_deferredlines,
- added R-Bs (again I hope changes above are not against it).--- drivers/base/base.h | 3 +++ drivers/base/core.c | 11 +++++++---- drivers/base/dd.c | 21 ++++++++++++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-)drivers/base/base.h +3
-0@@ -75,6 +75,7 @@ struct device_private {struct klist_node knode_driver;struct klist_node knode_bus;struct list_head deferred_probe; +char *deferred_probe_msg;struct device *device; };#define to_device_private_parent (obj) \@@ -113,6 +114,8 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev);extern void driver_deferred_probe_del (struct device *dev); +extern void __deferred_probe_set_msg (const struct device *dev, +struct va_format *vaf);static inline int driver_match_device (struct device_driver *drv,struct device *dev) {drivers/base/core.c +1
-0@@ -3076,6 +3076,7 @@ define_dev_printk_level(_dev_info, KERN_INFO);* * This helper implements common pattern present in probe functions for error * checking: print message if the error is not -EPROBE_DEFER and propagate it. +* In case of -EPROBE_DEFER it sets defer probe reason. * It replaces code sequence: * if (err != -EPROBE_DEFER) * dev_err(dev, ...); @@ -3091,13 +3092,15 @@ int probe_err(const struct device *dev, int err, const char *fmt, ...)struct va_format vaf;va_list args;
drivers/base/core.c int probe_err(const struct device *dev, int err, const char *fmt, ...) · line 3099
Quoted 10 lines
drivers/base/core.c +1
-4-if (err == -EPROBE_DEFER ) -return err; -va_start (args, fmt); vaf.fmt = fmt; vaf.va = &args; -dev_err (dev,"%pV, %d\n" , &vaf, err); +
This new line can be part of patch 1.
drivers/base/core.c int probe_err(const struct device *dev, int err, const char *fmt, ...) · line 3103
Quoted 5 lines
drivers/base/core.c +5
-0+if (err != -EPROBE_DEFER ) +dev_err (dev,"%pV, %d\n" , &vaf, err); +else +__deferred_probe_set_msg (dev, &vaf); +
Here you may still keep the same, i.e. positive, conditional.
Quoted 59 lines
drivers/base/core.c +0
-0va_end (args);return err;drivers/base/dd.c +20
-2@@ -27,6 +27,7 @@#include <linux/async.h> #include <linux/pm_runtime.h> #include <linux/pinctrl/devinfo.h> +#include <linux/slab.h> #include "base.h" #include "power/power.h" @@ -132,6 +133,8 @@ void driver_deferred_probe_del(struct device *dev)if (!list_empty (&dev->p->deferred_probe)) {dev_dbg (dev,"Removed from deferred list\n" );list_del_init (&dev->p->deferred_probe); +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =NULL ; }mutex_unlock (&deferred_probe_mutex); }@@ -202,6 +205,21 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +/* +* __deferred_probe_set_msg() - Set defer probe reason message for device +*/ +void __deferred_probe_set_msg (const struct device *dev,struct va_format *vaf) +{ +mutex_lock (&deferred_probe_mutex); + +if (dev->p->deferred_probe_msg) +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =kasprintf (GFP_KERNEL ,"%s: %pV" , +dev_driver_string (dev), vaf); + +mutex_unlock (&deferred_probe_mutex); +} +/* * deferred_devs_show() - Show the devices in the deferred probe pending list. */ @@ -212,7 +230,8 @@ static int deferred_devs_show(struct seq_file *s, void *data)mutex_lock (&deferred_probe_mutex);list_for_each_entry (curr, &deferred_probe_pending_list, deferred_probe) -seq_printf (s,"%s\n" ,dev_name (curr->device)); +seq_printf (s,"%s\t%s\n" ,dev_name (curr->device), + curr->device->p->deferred_probe_msg ?:"" );mutex_unlock (&deferred_probe_mutex); --2.18.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 2/4 driver core: add deferring probe reason to devices_deferred property
/sys/kernel/debug/devices_deferred property contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason is probe_err function introduced recently, ie. if probe_err will be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user read devices_deferred property.
---
v3:
- adjusted deferred_devs_show, to accept newline ended messages,
- changed conditonal check to positive,
- added R-b by Andy.
v2:
- changed __deferred_probe_set_msg args - like in __dev_printk, fits better,
- use kasprintf instead of bunch of code,
- keep consistent format of devices_deferred lines,
- added R-Bs (again I hope changes above are not against it).
--- drivers/base/base.h | 3 +++ drivers/base/core.c | 9 +++++---- drivers/base/dd.c | 21 ++++++++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-)
drivers/base/base.h +3 -0
@@ -75,6 +75,7 @@ struct device_private {struct klist_node knode_driver;struct klist_node knode_bus;struct list_head deferred_probe; +char *deferred_probe_msg;struct device *device; };#define to_device_private_parent (obj) \
@@ -113,6 +114,8 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev);extern void driver_deferred_probe_del (struct device *dev); +extern void __deferred_probe_set_msg (const struct device *dev, +struct va_format *vaf);static inline int driver_match_device (struct device_driver *drv,struct device *dev) {
drivers/base/core.c +5 -4
@@ -3076,6 +3076,7 @@ define_dev_printk_level(_dev_info, KERN_INFO);* * This helper implements common pattern present in probe functions for error * checking: print message if the error is not -EPROBE_DEFER and propagate it. +* In case of -EPROBE_DEFER it sets defer probe reason. * It replaces code sequence: * if (err != -EPROBE_DEFER) * dev_err(dev, ...);
@@ -3091,14 +3092,14 @@ int probe_err(const struct device *dev, int err, const char *fmt, ...)struct va_format vaf;va_list args; -if (err == -EPROBE_DEFER ) -return err; -va_start (args, fmt); vaf.fmt = fmt; vaf.va = &args; -dev_err (dev,"error %d: %pV" , err, &vaf); +if (err == -EPROBE_DEFER ) +__deferred_probe_set_msg (dev, &vaf); +else +dev_err (dev,"error %d: %pV" , err, &vaf);va_end (args);
drivers/base/dd.c +20 -1
@@ -27,6 +27,7 @@#include <linux/async.h> #include <linux/pm_runtime.h> #include <linux/pinctrl/devinfo.h> +#include <linux/slab.h> #include "base.h" #include "power/power.h"
@@ -132,6 +133,8 @@ void driver_deferred_probe_del(struct device *dev)if (!list_empty (&dev->p->deferred_probe)) {dev_dbg (dev,"Removed from deferred list\n" );list_del_init (&dev->p->deferred_probe); +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =NULL ; }mutex_unlock (&deferred_probe_mutex); }
@@ -202,6 +205,21 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +/* +* __deferred_probe_set_msg() - Set defer probe reason message for device +*/ +void __deferred_probe_set_msg (const struct device *dev,struct va_format *vaf) +{ +mutex_lock (&deferred_probe_mutex); + +if (dev->p->deferred_probe_msg) +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =kasprintf (GFP_KERNEL ,"%s: %pV" , +dev_driver_string (dev), vaf); + +mutex_unlock (&deferred_probe_mutex); +} +/* * deferred_devs_show() - Show the devices in the deferred probe pending list. */
@@ -212,7 +230,8 @@ static int deferred_devs_show(struct seq_file *s, void *data)mutex_lock (&deferred_probe_mutex);list_for_each_entry (curr, &deferred_probe_pending_list, deferred_probe) -seq_printf (s,"%s\n" ,dev_name (curr->device)); +seq_printf (s,"%s\t%s" ,dev_name (curr->device), + curr->device->p->deferred_probe_msg ?:"\n" );mutex_unlock (&deferred_probe_mutex);
Signature · 1 line
2.18.0
Re: [PATCH v3 2/4] driver core: add deferring probe reason to devices_deferred property
Quoted 105 lines · Andrzej Hajda
/sys/kernel/debug/devices_deferredproperty contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason isprobe_errfunction introduced recently, ie. ifprobe_errwill be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user readdevices_deferredproperty.Signed-off-by Andrzej Hajda <[email protected]>Reviewed-by Mark Brown <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
v3:
- adjusteddeferred_devs_show, to accept newline ended messages,
- changed conditonal check to positive,
- added R-b by Andy.
v2:
- changed__deferred_probe_set_msgargs - like in__dev_printk, fits better,
- use kasprintf instead of bunch of code,
- keep consistent format ofdevices_deferredlines,
- added R-Bs (again I hope changes above are not against it).--- drivers/base/base.h | 3 +++ drivers/base/core.c | 9 +++++---- drivers/base/dd.c | 21 ++++++++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-)drivers/base/base.h +3
-0@@ -75,6 +75,7 @@ struct device_private {struct klist_node knode_driver;struct klist_node knode_bus;struct list_head deferred_probe; +char *deferred_probe_msg;struct device *device; };#define to_device_private_parent (obj) \@@ -113,6 +114,8 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev);extern void driver_deferred_probe_del (struct device *dev); +extern void __deferred_probe_set_msg (const struct device *dev, +struct va_format *vaf);static inline int driver_match_device (struct device_driver *drv,struct device *dev) {drivers/base/core.c +5
-4@@ -3076,6 +3076,7 @@ define_dev_printk_level(_dev_info, KERN_INFO);* * This helper implements common pattern present in probe functions for error * checking: print message if the error is not -EPROBE_DEFER and propagate it. +* In case of -EPROBE_DEFER it sets defer probe reason. * It replaces code sequence: * if (err != -EPROBE_DEFER) * dev_err(dev, ...); @@ -3091,14 +3092,14 @@ int probe_err(const struct device *dev, int err, const char *fmt, ...)struct va_format vaf;va_list args; -if (err == -EPROBE_DEFER ) -return err; -va_start (args, fmt); vaf.fmt = fmt; vaf.va = &args; -dev_err (dev,"error %d: %pV" , err, &vaf); +if (err == -EPROBE_DEFER ) +__deferred_probe_set_msg (dev, &vaf); +else +dev_err (dev,"error %d: %pV" , err, &vaf);va_end (args);drivers/base/dd.c +3
-0@@ -27,6 +27,7 @@#include <linux/async.h> #include <linux/pm_runtime.h> #include <linux/pinctrl/devinfo.h> +#include <linux/slab.h> #include "base.h" #include "power/power.h" @@ -132,6 +133,8 @@ void driver_deferred_probe_del(struct device *dev)if (!list_empty (&dev->p->deferred_probe)) {dev_dbg (dev,"Removed from deferred list\n" );list_del_init (&dev->p->deferred_probe); +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =NULL ; }mutex_unlock (&deferred_probe_mutex); }@@ -202,6 +205,21 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); }
drivers/base/dd.c void device_unblock_probing(void) · line 216
Quoted 10 lines
drivers/base/dd.c +8
-0+/* +* __deferred_probe_set_msg() - Set defer probe reason message for device +*/ +void __deferred_probe_set_msg (const struct device *dev,struct va_format *vaf) +{ +mutex_lock (&deferred_probe_mutex); + +if (dev->p->deferred_probe_msg)
Sorry, I have noticed this a bit late, this check is not needed, since kfree() is NULL-aware.
drivers/base/dd.c void device_unblock_probing(void) · line 218
Quoted 3 lines
drivers/base/dd.c +3
-0+kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =kasprintf (GFP_KERNEL ,"%s: %pV" , +dev_driver_string (dev), vaf);
...and perhaps slightly better looking (up to you):
const char *drv = dev_driver_string(dev);
...
... = kasprintf(..., drv, ...); // it would be exactly oneline
Quoted 20 lines
drivers/base/dd.c +4
-0+ +mutex_unlock (&deferred_probe_mutex); +} +/* * deferred_devs_show() - Show the devices in the deferred probe pending list. */
drivers/base/dd.c +2
-2@@ -212,7 +230,8 @@ static int deferred_devs_show(struct seq_file *s, void *data)mutex_lock (&deferred_probe_mutex);list_for_each_entry (curr, &deferred_probe_pending_list, deferred_probe) -seq_printf (s,"%s\n" ,dev_name (curr->device)); +seq_printf (s,"%s\t%s" ,dev_name (curr->device), + curr->device->p->deferred_probe_msg ?:"\n" );mutex_unlock (&deferred_probe_mutex); --2.18.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v4 2/3 driver core: add deferring probe reason to devices_deferred property
/sys/kernel/debug/devices_deferred property contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it.
The natural place to set the reason is probe_err function introduced recently, ie. if probe_err will be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user read devices_deferred property.
---
v4:
- removed NULL check before kfree,
- coding style tweaking.
v3:
- adjusted deferred_devs_show, to accept newline ended messages,
- changed conditonal check to positive,
- added R-b by Andy.
v2:
- changed __deferred_probe_set_msg args - like in __dev_printk, fits better,
- use kasprintf instead of bunch of code,
- keep consistent format of devices_deferred lines,
- added R-Bs (again I hope changes above are not against it).
---
--- drivers/base/base.h | 3 +++ drivers/base/core.c | 9 +++++---- drivers/base/dd.c | 21 ++++++++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-)
drivers/base/base.h +3 -0
@@ -75,6 +75,7 @@ struct device_private {struct klist_node knode_driver;struct klist_node knode_bus;struct list_head deferred_probe; +char *deferred_probe_msg;struct device *device; };#define to_device_private_parent (obj) \
@@ -113,6 +114,8 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev);extern void driver_deferred_probe_del (struct device *dev); +extern void __deferred_probe_set_msg (const struct device *dev, +struct va_format *vaf);static inline int driver_match_device (struct device_driver *drv,struct device *dev) {
drivers/base/core.c +5 -4
@@ -3076,6 +3076,7 @@ define_dev_printk_level(_dev_info, KERN_INFO);* * This helper implements common pattern present in probe functions for error * checking: print message if the error is not -EPROBE_DEFER and propagate it. +* In case of -EPROBE_DEFER it sets defer probe reason. * It replaces code sequence: * if (err != -EPROBE_DEFER) * dev_err(dev, ...);
@@ -3091,14 +3092,14 @@ int probe_err(const struct device *dev, int err, const char *fmt, ...)struct va_format vaf;va_list args; -if (err == -EPROBE_DEFER ) -return err; -va_start (args, fmt); vaf.fmt = fmt; vaf.va = &args; -dev_err (dev,"error %d: %pV" , err, &vaf); +if (err == -EPROBE_DEFER ) +__deferred_probe_set_msg (dev, &vaf); +else +dev_err (dev,"error %d: %pV" , err, &vaf);va_end (args);
drivers/base/dd.c +20 -1
@@ -27,6 +27,7 @@#include <linux/async.h> #include <linux/pm_runtime.h> #include <linux/pinctrl/devinfo.h> +#include <linux/slab.h> #include "base.h" #include "power/power.h"
@@ -132,6 +133,8 @@ void driver_deferred_probe_del(struct device *dev)if (!list_empty (&dev->p->deferred_probe)) {dev_dbg (dev,"Removed from deferred list\n" );list_del_init (&dev->p->deferred_probe); +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =NULL ; }mutex_unlock (&deferred_probe_mutex); }
@@ -202,6 +205,21 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +/* +* __deferred_probe_set_msg() - Set defer probe reason message for device +*/ +void __deferred_probe_set_msg (const struct device *dev,struct va_format *vaf) +{ +const char *drv =dev_driver_string (dev); + +mutex_lock (&deferred_probe_mutex); + +kfree (dev->p->deferred_probe_msg); + dev->p->deferred_probe_msg =kasprintf (GFP_KERNEL ,"%s: %pV" , drv, vaf); + +mutex_unlock (&deferred_probe_mutex); +} +/* * deferred_devs_show() - Show the devices in the deferred probe pending list. */
@@ -212,7 +230,8 @@ static int deferred_devs_show(struct seq_file *s, void *data)mutex_lock (&deferred_probe_mutex);list_for_each_entry (curr, &deferred_probe_pending_list, deferred_probe) -seq_printf (s,"%s\n" ,dev_name (curr->device)); +seq_printf (s,"%s\t%s" ,dev_name (curr->device), + curr->device->p->deferred_probe_msg ?:"\n" );mutex_unlock (&deferred_probe_mutex);
Signature · 1 line
2.18.0
PATCH 3/3 drivers: use probe_err function in obvious cases
In reply to Andrzej HajdaThe patch replaces obviously matching code with probe_err function. There are many more places where probe_err could be used. The patch shows how the new function should be used, and how it improves the code.
It was generated by cocci script (little bit dirty):
virtual context
virtual patch
@@
expression t, e, dev, err;
expression list l;
@@
- if (t)
- { err = e;
- if (err != -EPROBE_DEFER) \({ dev_err(dev, l, err); }\|dev_err(dev, l, err);\)
- return err; }
+ if (t) { err = e; return probe_err(dev, err, l, err); }@@
expression t, e, dev, err;
expression list l;
@@
- if (t)
- { err = e;
- if (err != -EPROBE_DEFER) \({ dev_err(dev, l); }\|dev_err(dev, l);\)
- return err; }
+ if (t) return probe_err(dev, e, l);@@
expression t, dev, err;
expression list l;
@@
- if (t)
- {
- if (err != -EPROBE_DEFER) \({ dev_err(dev, l); }\|dev_err(dev, l);\)
- return err; }
+ if (t) return probe_err(dev, err, l);@@
expression t, e, dev, err;
expression list l;
@@
- if (t)
- { \(err = e;\|\)
- if (err != ERR_PTR(-EPROBE_DEFER)) \({ dev_err(dev, l); }\|dev_err(dev, l);\)
- return PTR_ERR(err); }
+ if (t) return probe_err(dev, PTR_ERR(err), l);@@
expression err, dev;
expression list l;
identifier errlab;
@@
- if (err != -EPROBE_DEFER) \({ dev_err(dev, l); }\|dev_err(dev, l);\)
+ probe_err(dev, err, l);
goto errlab;--- drivers/ata/libahci_platform.c | 7 +- drivers/base/power/domain.c | 10 ++- drivers/bus/fsl-mc/fsl-mc-bus.c | 8 +-- drivers/bus/ts-nbus.c | 8 +-- drivers/clk/qcom/clk-spmi-pmic-div.c | 9 +-- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 16 ++--- drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c | 11 ++-- drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c | 5 +- drivers/cpufreq/qcom-cpufreq-kryo.c | 10 ++- drivers/crypto/caam/caamalg_qi2.c | 3 +- drivers/firmware/arm_scmi/driver.c | 9 +-- drivers/firmware/imx/imx-scu.c | 7 +- drivers/gpio/gpio-pca953x.c | 4 +- drivers/gpio/gpio-pisosr.c | 9 +-- .../gpu/drm/omapdrm/displays/encoder-opa362.c | 8 +-- .../gpu/drm/omapdrm/displays/encoder-tfp410.c | 8 +-- .../drm/omapdrm/displays/encoder-tpd12s015.c | 8 +-- drivers/gpu/drm/omapdrm/dss/dpi.c | 8 +-- drivers/gpu/drm/omapdrm/dss/dsi.c | 8 +-- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 8 +-- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 8 +-- drivers/gpu/drm/omapdrm/dss/sdi.c | 8 +-- drivers/gpu/drm/omapdrm/dss/venc.c | 8 +-- drivers/gpu/drm/panel/panel-lvds.c | 10 ++- drivers/gpu/drm/panel/panel-simple.c | 5 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 +- drivers/gpu/drm/vc4/vc4_dsi.c | 23 +++---- drivers/hid/i2c-hid/i2c-hid-core.c | 9 +-- drivers/hwmon/pwm-fan.c | 7 +- drivers/i2c/busses/i2c-bcm2835.c | 8 +-- drivers/i2c/busses/i2c-rk3x.c | 10 ++- drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 30 +++------ drivers/i2c/muxes/i2c-mux-gpmux.c | 16 ++--- drivers/iio/adc/envelope-detector.c | 23 +++---- drivers/iio/adc/rcar-gyroadc.c | 5 +- drivers/iio/afe/iio-rescale.c | 8 +-- drivers/iio/dac/dpot-dac.c | 16 ++--- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 11 ++-- drivers/iio/multiplexer/iio-mux.c | 16 ++--- drivers/input/keyboard/bcm-keypad.c | 8 +-- drivers/input/misc/pwm-beeper.c | 12 ++-- drivers/input/misc/pwm-vibra.c | 18 ++--- drivers/input/mouse/elan_i2c_core.c | 6 +- drivers/input/touchscreen/bu21029_ts.c | 14 ++-- drivers/input/touchscreen/chipone_icn8318.c | 5 +- drivers/input/touchscreen/ektf2127.c | 5 +- drivers/input/touchscreen/elants_i2c.c | 16 ++--- drivers/input/touchscreen/pixcir_i2c_ts.c | 10 ++- drivers/input/touchscreen/raydium_i2c_ts.c | 20 +++--- .../input/touchscreen/resistive-adc-touch.c | 9 +-- drivers/input/touchscreen/silead.c | 15 ++--- drivers/input/touchscreen/sis_i2c.c | 12 ++-- drivers/input/touchscreen/surface3_spi.c | 9 +-- drivers/leds/leds-pwm.c | 7 +- drivers/media/i2c/ad5820.c | 9 +-- drivers/media/i2c/tc358743.c | 10 ++- drivers/media/platform/omap3isp/isp.c | 3 +- drivers/media/platform/video-mux.c | 4 +- drivers/media/rc/gpio-ir-recv.c | 5 +- drivers/media/rc/gpio-ir-tx.c | 10 ++- drivers/mfd/madera-core.c | 6 +- drivers/mmc/host/bcm2835.c | 3 +- drivers/mmc/host/davinci_mmc.c | 5 +- drivers/mmc/host/dw_mmc-zx.c | 6 +- drivers/mmc/host/jz4740_mmc.c | 5 +- drivers/mmc/host/meson-gx-mmc.c | 17 ++--- drivers/mmc/host/sdhci-of-arasan.c | 8 +-- drivers/mtd/nand/onenand/omap2.c | 5 +- drivers/mtd/nand/raw/atmel/nand-controller.c | 20 +++--- drivers/mux/gpio.c | 9 +-- drivers/net/dsa/lantiq_gswip.c | 8 +-- drivers/net/ethernet/renesas/sh_eth.c | 3 +- .../stmicro/stmmac/dwmac-dwc-qos-eth.c | 10 +-- .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 9 +-- .../ethernet/stmicro/stmmac/stmmac_platform.c | 10 +-- drivers/net/ethernet/ti/cpsw.c | 9 ++- drivers/net/ieee802154/mcr20a.c | 5 +- drivers/net/phy/mdio-mux-mmioreg.c | 9 +-- drivers/opp/core.c | 12 ++-- drivers/pci/controller/pcie-rockchip.c | 66 +++++++------------ drivers/phy/amlogic/phy-meson-gxl-usb2.c | 9 +-- drivers/phy/amlogic/phy-meson-gxl-usb3.c | 9 +-- drivers/phy/lantiq/phy-lantiq-rcu-usb2.c | 8 +-- drivers/phy/qualcomm/phy-qcom-qmp.c | 21 +++--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 19 ++---- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 8 +-- drivers/phy/rockchip/phy-rockchip-pcie.c | 9 +-- drivers/phy/st/phy-stm32-usbphyc.c | 10 ++- drivers/platform/x86/intel_cht_int33fe.c | 8 +-- drivers/power/supply/lego_ev3_battery.c | 24 +++---- drivers/pwm/pwm-rockchip.c | 11 ++-- drivers/regulator/gpio-regulator.c | 7 +- drivers/remoteproc/da8xx_remoteproc.c | 11 ++-- drivers/remoteproc/qcom_q6v5.c | 55 ++++++---------- drivers/remoteproc/qcom_q6v5_adsp.c | 9 +-- drivers/remoteproc/qcom_q6v5_mss.c | 11 ++-- drivers/remoteproc/qcom_q6v5_pas.c | 19 ++---- drivers/remoteproc/qcom_wcnss_iris.c | 8 +-- drivers/reset/reset-meson-audio-arb.c | 8 +-- drivers/rtc/rtc-rk808.c | 10 ++- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 7 +- drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 8 +-- drivers/soc/imx/gpcv2.c | 9 ++- drivers/soc/lantiq/gphy.c | 8 +-- drivers/soc/qcom/rpmh-rsc.c | 9 +-- drivers/soc/qcom/smem.c | 8 +-- drivers/soc/qcom/smp2p.c | 9 +-- drivers/spi/spi-tegra114.c | 6 +- drivers/spi/spi-tegra20-slink.c | 6 +- .../clocking-wizard/clk-xlnx-clock-wizard.c | 16 ++--- drivers/thermal/broadcom/bcm2835_thermal.c | 5 +- drivers/thermal/hisi_thermal.c | 5 +- drivers/tty/serial/8250/8250_dw.c | 7 +- drivers/tty/serial/8250/8250_ingenic.c | 12 ++-- drivers/tty/serial/amba-pl011.c | 7 +- drivers/usb/chipidea/ci_hdrc_imx.c | 5 +- drivers/usb/chipidea/ci_hdrc_msm.c | 3 +- drivers/usb/chipidea/ci_hdrc_usb2.c | 7 +- drivers/usb/dwc3/core.c | 24 +++---- drivers/usb/host/ehci-mv.c | 3 +- drivers/usb/host/ehci-omap.c | 5 +- drivers/usb/host/ohci-da8xx.c | 6 +- drivers/usb/musb/da8xx.c | 8 +-- drivers/usb/musb/musb_cppi41.c | 5 +- drivers/usb/typec/tcpm/fusb302.c | 3 +- drivers/video/backlight/gpio_backlight.c | 12 +--- drivers/video/backlight/pwm_bl.c | 3 +- drivers/watchdog/davinci_wdt.c | 8 +-- sound/soc/atmel/tse850-pcm5142.c | 32 ++++----- sound/soc/codecs/es7241.c | 13 ++-- sound/soc/codecs/max9759.c | 15 ++--- sound/soc/codecs/max9860.c | 8 +-- sound/soc/codecs/pcm3168a.c | 8 +-- sound/soc/codecs/sgtl5000.c | 5 +- sound/soc/codecs/simple-amplifier.c | 5 +- sound/soc/codecs/ssm2305.c | 6 +- sound/soc/davinci/davinci-mcasp.c | 11 ++-- sound/soc/generic/audio-graph-card.c | 3 +- sound/soc/generic/audio-graph-scu-card.c | 3 +- sound/soc/generic/simple-card.c | 3 +- sound/soc/generic/simple-scu-card.c | 3 +- sound/soc/img/img-i2s-in.c | 8 +-- sound/soc/img/img-i2s-out.c | 24 +++---- sound/soc/img/img-parallel-out.c | 24 +++---- sound/soc/img/img-spdif-in.c | 8 +-- sound/soc/img/img-spdif-out.c | 24 +++---- sound/soc/img/pistachio-internal-dac.c | 6 +- sound/soc/meson/axg-card.c | 7 +- sound/soc/meson/axg-fifo.c | 20 +++--- sound/soc/meson/axg-pdm.c | 12 +--- sound/soc/meson/axg-spdifout.c | 8 +-- sound/soc/meson/axg-tdm-formatter.c | 22 ++----- sound/soc/meson/axg-tdm-interface.c | 8 +-- sound/soc/mxs/mxs-sgtl5000.c | 9 +-- sound/soc/sunxi/sun4i-codec.c | 5 +- 155 files changed, 580 insertions(+), 1030 deletions(-)
drivers/ata/libahci_platform.c +2 -5
@@ -581,11 +581,8 @@ int ahci_platform_init_host(struct platform_device *pdev,int i, irq, n_ports, rc; irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -if (irq != -EPROBE_DEFER ) -dev_err (dev,"no irq\n" ); -return irq; - } +if (irq <=0 ) +return probe_err (dev, irq,"no irq\n" ); hpriv->irq = irq;
drivers/base/power/domain.c +4 -6
@@ -2267,12 +2267,10 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, ret =genpd_add_device (pd, dev,NULL );mutex_unlock (&gpd_list_lock); -if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to add to PM domain %s: %d" , - pd->name, ret); -return ret; - } +if (ret <0 ) +return probe_err (dev, ret, +"failed to add to PM domain %s: %d" , + pd->name, ret); dev->pm_domain->detach = genpd_dev_pm_detach; dev->pm_domain->sync = genpd_dev_pm_sync;
drivers/bus/fsl-mc/fsl-mc-bus.c +3 -5
@@ -239,11 +239,9 @@ static int fsl_mc_driver_probe(struct device *dev) mc_drv =to_fsl_mc_driver (dev->driver); error = mc_drv->probe (mc_dev); -if (error <0 ) { -if (error != -EPROBE_DEFER ) -dev_err (dev,"%s failed: %d\n" , __func__, error); -return error; - } +if (error <0 ) +return probe_err (dev, error,"%s failed: %d\n" , __func__, + error);return 0 ; }
drivers/bus/ts-nbus.c +2 -6
@@ -292,12 +292,8 @@ static int ts_nbus_probe(struct platform_device *pdev)return ret; pwm =devm_pwm_get (dev,NULL ); -if (IS_ERR (pwm)) { - ret =PTR_ERR (pwm); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"unable to request PWM\n" ); -return ret; - } +if (IS_ERR (pwm)) +return probe_err (dev,PTR_ERR (pwm),"unable to request PWM\n" );pwm_get_args (pwm, &pargs);if (!pargs.period) {
drivers/clk/qcom/clk-spmi-pmic-div.c +3 -6
@@ -245,12 +245,9 @@ static int spmi_pmic_clkdiv_probe(struct platform_device *pdev) cc->nclks = nclks; cxo =clk_get (dev,"xo" ); -if (IS_ERR (cxo)) { - ret =PTR_ERR (cxo); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get xo clock\n" ); -return ret; - } +if (IS_ERR (cxo)) +return probe_err (dev,PTR_ERR (cxo), +"failed to get xo clock\n" ); cxo_hz =clk_get_rate (cxo);clk_put (cxo);
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +6 -10
@@ -217,26 +217,22 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev) bus_clk =devm_clk_get (&pdev->dev,"bus" );if (IS_ERR (bus_clk)) { ret =PTR_ERR (bus_clk); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Couldn't get bus clk: %d\n" , ret); -return ret; +return probe_err (&pdev->dev, ret, +"Couldn't get bus clk: %d\n" , ret); } mod_clk =devm_clk_get (&pdev->dev,"mod" );if (IS_ERR (mod_clk)) { ret =PTR_ERR (mod_clk); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Couldn't get mod clk: %d\n" , ret); -return ret; +return probe_err (&pdev->dev, ret, +"Couldn't get mod clk: %d\n" , ret); } rstc =devm_reset_control_get_exclusive (&pdev->dev,NULL );if (IS_ERR (rstc)) { ret =PTR_ERR (rstc); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"Couldn't get reset control: %d\n" , ret); -return ret; +return probe_err (&pdev->dev, ret, +"Couldn't get reset control: %d\n" , ret); }/* The clocks need to be enabled for us to access the registers */
drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c +4 -7
@@ -225,18 +225,15 @@ static int sun9i_a80_de_clk_probe(struct platform_device *pdev) bus_clk =devm_clk_get (&pdev->dev,"bus" );if (IS_ERR (bus_clk)) { ret =PTR_ERR (bus_clk); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Couldn't get bus clk: %d\n" , ret); -return ret; +return probe_err (&pdev->dev, ret, +"Couldn't get bus clk: %d\n" , ret); } rstc =devm_reset_control_get_exclusive (&pdev->dev,NULL );if (IS_ERR (rstc)) { ret =PTR_ERR (rstc); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"Couldn't get reset control: %d\n" , ret); -return ret; +return probe_err (&pdev->dev, ret, +"Couldn't get reset control: %d\n" , ret); }/* The bus clock needs to be enabled for us to access the registers */
drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c +2 -3
@@ -105,9 +105,8 @@ static int sun9i_a80_usb_clk_probe(struct platform_device *pdev) bus_clk =devm_clk_get (&pdev->dev,"bus" );if (IS_ERR (bus_clk)) { ret =PTR_ERR (bus_clk); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Couldn't get bus clk: %d\n" , ret); -return ret; +return probe_err (&pdev->dev, ret, +"Couldn't get bus clk: %d\n" , ret); }/* The bus clock needs to be enabled for us to access the registers */
drivers/cpufreq/qcom-cpufreq-kryo.c +4 -6
@@ -108,12 +108,10 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) speedbin_nvmem =of_nvmem_cell_get (np,NULL );of_node_put (np); -if (IS_ERR (speedbin_nvmem)) { -if (PTR_ERR (speedbin_nvmem) != -EPROBE_DEFER ) -dev_err (cpu_dev,"Could not get nvmem cell: %ld\n" , -PTR_ERR (speedbin_nvmem)); -return PTR_ERR (speedbin_nvmem); - } +if (IS_ERR (speedbin_nvmem)) +return probe_err (cpu_dev,PTR_ERR (speedbin_nvmem), +"Could not get nvmem cell: %ld\n" , +PTR_ERR (speedbin_nvmem)); speedbin =nvmem_cell_read (speedbin_nvmem, &len);nvmem_cell_put (speedbin_nvmem);
drivers/crypto/caam/caamalg_qi2.c +1 -2
@@ -4873,8 +4873,7 @@ static int dpaa2_caam_probe(struct fsl_mc_device *dpseci_dev)/* DPIO */ err =dpaa2_dpseci_dpio_setup (priv);if (err) { -if (err != -EPROBE_DEFER ) -dev_err (dev,"dpaa2_dpseci_dpio_setup() failed\n" ); +probe_err (dev, err,"dpaa2_dpseci_dpio_setup() failed\n" ); goto err_dpio_setup; }
drivers/firmware/arm_scmi/driver.c +3 -6
@@ -742,12 +742,9 @@ scmi_mbox_chan_setup(struct scmi_info *info, struct device *dev, int prot_id)/* Transmit channel is first entry i.e. index 0 */ cinfo->chan =mbox_request_channel (cl,0 ); -if (IS_ERR (cinfo->chan)) { - ret =PTR_ERR (cinfo->chan); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to request SCMI Tx mailbox\n" ); -return ret; - } +if (IS_ERR (cinfo->chan)) +return probe_err (dev,PTR_ERR (cinfo->chan), +"failed to request SCMI Tx mailbox\n" ); idr_alloc: ret =idr_alloc (&info->tx_idr, cinfo, prot_id, prot_id +1 ,GFP_KERNEL );
drivers/firmware/imx/imx-scu.c +3 -4
@@ -229,10 +229,9 @@ static int imx_scu_probe(struct platform_device *pdev) sc_chan->ch =mbox_request_channel_byname (cl, chan_name);if (IS_ERR (sc_chan->ch)) { ret =PTR_ERR (sc_chan->ch); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request mbox chan %s ret %d\n" , - chan_name, ret); -return ret; +return probe_err (dev, ret, +"Failed to request mbox chan %s ret %d\n" , + chan_name, ret); }dev_dbg (dev,"request mbox chan %s\n" , chan_name);
drivers/gpio/gpio-pca953x.c +1 -3
@@ -824,9 +824,7 @@ static int pca953x_probe(struct i2c_client *client, reg =devm_regulator_get (&client->dev,"vcc" );if (IS_ERR (reg)) { ret =PTR_ERR (reg); -if (ret != -EPROBE_DEFER ) -dev_err (&client->dev,"reg get err: %d\n" , ret); -return ret; +return probe_err (&client->dev, ret,"reg get err: %d\n" , ret); } ret =regulator_enable (reg);if (ret) {
drivers/gpio/gpio-pisosr.c +3 -6
@@ -148,12 +148,9 @@ static int pisosr_gpio_probe(struct spi_device *spi)return -ENOMEM ; gpio->load_gpio =devm_gpiod_get_optional (dev,"load" ,GPIOD_OUT_LOW ); -if (IS_ERR (gpio->load_gpio)) { - ret =PTR_ERR (gpio->load_gpio); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Unable to allocate load GPIO\n" ); -return ret; - } +if (IS_ERR (gpio->load_gpio)) +return probe_err (dev,PTR_ERR (gpio->load_gpio), +"Unable to allocate load GPIO\n" );mutex_init (&gpio->lock);
drivers/gpu/drm/omapdrm/displays/encoder-opa362.c +3 -5
@@ -121,11 +121,9 @@ static int opa362_probe(struct platform_device *pdev) dssdev->of_ports =BIT (1 ) |BIT (0 ); dssdev->next =omapdss_of_find_connected_device (pdev->dev.of_node,1 ); -if (IS_ERR (dssdev->next)) { -if (PTR_ERR (dssdev->next) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to find video sink\n" ); -return PTR_ERR (dssdev->next); - } +if (IS_ERR (dssdev->next)) +return probe_err (&pdev->dev,PTR_ERR (dssdev->next), +"failed to find video sink\n" );omapdss_device_register (dssdev);
drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c +3 -5
@@ -115,11 +115,9 @@ static int tfp410_probe(struct platform_device *pdev) | DRM_BUS_FLAG_PIXDATA_POSEDGE; dssdev->next =omapdss_of_find_connected_device (pdev->dev.of_node,1 ); -if (IS_ERR (dssdev->next)) { -if (PTR_ERR (dssdev->next) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to find video sink\n" ); -return PTR_ERR (dssdev->next); - } +if (IS_ERR (dssdev->next)) +return probe_err (&pdev->dev,PTR_ERR (dssdev->next), +"failed to find video sink\n" );omapdss_device_register (dssdev);
drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c +3 -5
@@ -205,11 +205,9 @@ static int tpd_probe(struct platform_device *pdev) | OMAP_DSS_DEVICE_OP_HPD; dssdev->next =omapdss_of_find_connected_device (pdev->dev.of_node,1 ); -if (IS_ERR (dssdev->next)) { -if (PTR_ERR (dssdev->next) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to find video sink\n" ); -return PTR_ERR (dssdev->next); - } +if (IS_ERR (dssdev->next)) +return probe_err (&pdev->dev,PTR_ERR (dssdev->next), +"failed to find video sink\n" );omapdss_device_register (dssdev);
drivers/gpu/drm/omapdrm/dss/dpi.c +3 -5
@@ -658,11 +658,9 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port) out->owner =THIS_MODULE ; out->next =omapdss_of_find_connected_device (out->dev->of_node,0 ); -if (IS_ERR (out->next)) { -if (PTR_ERR (out->next) != -EPROBE_DEFER ) -dev_err (out->dev,"failed to find video sink\n" ); -return PTR_ERR (out->next); - } +if (IS_ERR (out->next)) +return probe_err (out->dev,PTR_ERR (out->next), +"failed to find video sink\n" ); r =omapdss_output_validate (out);if (r) {
drivers/gpu/drm/omapdrm/dss/dsi.c +3 -5
@@ -5140,11 +5140,9 @@ static int dsi_init_output(struct dsi_data *dsi) | DRM_BUS_FLAG_SYNC_NEGEDGE; out->next =omapdss_of_find_connected_device (out->dev->of_node,0 ); -if (IS_ERR (out->next)) { -if (PTR_ERR (out->next) != -EPROBE_DEFER ) -dev_err (out->dev,"failed to find video sink\n" ); -return PTR_ERR (out->next); - } +if (IS_ERR (out->next)) +return probe_err (out->dev,PTR_ERR (out->next), +"failed to find video sink\n" ); r =omapdss_output_validate (out);if (r) {
drivers/gpu/drm/omapdrm/dss/hdmi4.c +3 -5
@@ -699,11 +699,9 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi) out->ops_flags =OMAP_DSS_DEVICE_OP_EDID ; out->next =omapdss_of_find_connected_device (out->dev->of_node,0 ); -if (IS_ERR (out->next)) { -if (PTR_ERR (out->next) != -EPROBE_DEFER ) -dev_err (out->dev,"failed to find video sink\n" ); -return PTR_ERR (out->next); - } +if (IS_ERR (out->next)) +return probe_err (out->dev,PTR_ERR (out->next), +"failed to find video sink\n" ); r =omapdss_output_validate (out);if (r) {
drivers/gpu/drm/omapdrm/dss/hdmi5.c +3 -5
@@ -691,11 +691,9 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi) out->ops_flags =OMAP_DSS_DEVICE_OP_EDID ; out->next =omapdss_of_find_connected_device (out->dev->of_node,0 ); -if (IS_ERR (out->next)) { -if (PTR_ERR (out->next) != -EPROBE_DEFER ) -dev_err (out->dev,"failed to find video sink\n" ); -return PTR_ERR (out->next); - } +if (IS_ERR (out->next)) +return probe_err (out->dev,PTR_ERR (out->next), +"failed to find video sink\n" ); r =omapdss_output_validate (out);if (r) {
drivers/gpu/drm/omapdrm/dss/sdi.c +3 -5
@@ -298,11 +298,9 @@ static int sdi_init_output(struct sdi_device *sdi) | DRM_BUS_FLAG_SYNC_POSEDGE; out->next =omapdss_of_find_connected_device (out->dev->of_node,1 ); -if (IS_ERR (out->next)) { -if (PTR_ERR (out->next) != -EPROBE_DEFER ) -dev_err (out->dev,"failed to find video sink\n" ); -return PTR_ERR (out->next); - } +if (IS_ERR (out->next)) +return probe_err (out->dev,PTR_ERR (out->next), +"failed to find video sink\n" ); r =omapdss_output_validate (out);if (r) {
drivers/gpu/drm/omapdrm/dss/venc.c +3 -5
@@ -784,11 +784,9 @@ static int venc_init_output(struct venc_device *venc) out->of_ports =BIT (0 ); out->next =omapdss_of_find_connected_device (out->dev->of_node,0 ); -if (IS_ERR (out->next)) { -if (PTR_ERR (out->next) != -EPROBE_DEFER ) -dev_err (out->dev,"failed to find video sink\n" ); -return PTR_ERR (out->next); - } +if (IS_ERR (out->next)) +return probe_err (out->dev,PTR_ERR (out->next), +"failed to find video sink\n" ); r =omapdss_output_validate (out);if (r) {
drivers/gpu/drm/panel/panel-lvds.c +4 -6
@@ -212,12 +212,10 @@ static int panel_lvds_probe(struct platform_device *pdev)if (IS_ERR (lvds->supply)) { ret =PTR_ERR (lvds->supply); -if (ret != -ENODEV ) { -if (ret != -EPROBE_DEFER ) -dev_err (lvds->dev,"failed to request regulator: %d\n" , - ret); -return ret; - } +if (ret != -ENODEV ) +return probe_err (lvds->dev, ret, +"failed to request regulator: %d\n" , + ret); lvds->supply =NULL ; }
drivers/gpu/drm/panel/panel-simple.c +2 -3
@@ -313,9 +313,8 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) 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; +return probe_err (dev, err,"failed to request GPIO: %d\n" , + err); } backlight =of_parse_phandle (dev->of_node,"backlight" ,0 );
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2 -3
@@ -492,9 +492,8 @@ static int rcar_du_probe(struct platform_device *pdev) ret =rcar_du_modeset_init (rcdu);if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"failed to initialize DRM/KMS (%d)\n" , ret); +probe_err (&pdev->dev, ret, +"failed to initialize DRM/KMS (%d)\n" , ret); goto error; }
drivers/gpu/drm/vc4/vc4_dsi.c +9 -14
@@ -1580,34 +1580,29 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)else ret =devm_request_irq (dev,platform_get_irq (pdev,0 ), vc4_dsi_irq_handler,0 ,"vc4 dsi" , dsi); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get interrupt: %d\n" , ret); -return ret; - } +if (ret) +return probe_err (dev, ret,"Failed to get interrupt: %d\n" , + ret); dsi->escape_clock =devm_clk_get (dev,"escape" );if (IS_ERR (dsi->escape_clock)) { ret =PTR_ERR (dsi->escape_clock); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get escape clock: %d\n" , ret); -return ret; +return probe_err (dev, ret,"Failed to get escape clock: %d\n" , + ret); } dsi->pll_phy_clock =devm_clk_get (dev,"phy" );if (IS_ERR (dsi->pll_phy_clock)) { ret =PTR_ERR (dsi->pll_phy_clock); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get phy clock: %d\n" , ret); -return ret; +return probe_err (dev, ret,"Failed to get phy clock: %d\n" , + ret); } dsi->pixel_clock =devm_clk_get (dev,"pixel" );if (IS_ERR (dsi->pixel_clock)) { ret =PTR_ERR (dsi->pixel_clock); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get pixel clock: %d\n" , ret); -return ret; +return probe_err (dev, ret,"Failed to get pixel clock: %d\n" , + ret); } ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
drivers/hid/i2c-hid/i2c-hid-core.c +3 -6
@@ -1012,12 +1012,9 @@ static int i2c_hid_probe(struct i2c_client *client,return -EINVAL ; } -if (client->irq <0 ) { -if (client->irq != -EPROBE_DEFER ) -dev_err (&client->dev, -"HID over i2c doesn't have a valid IRQ\n" ); -return client->irq; - } +if (client->irq <0 ) +return probe_err (&client->dev, client->irq, +"HID over i2c doesn't have a valid IRQ\n" ); ihid =devm_kzalloc (&client->dev,sizeof (*ihid),GFP_KERNEL );if (!ihid)
drivers/hwmon/pwm-fan.c +2 -5
@@ -222,11 +222,8 @@ static int pwm_fan_probe(struct platform_device *pdev) ctx->pwm =devm_of_pwm_get (&pdev->dev, pdev->dev.of_node,NULL );if (IS_ERR (ctx->pwm)) { ret =PTR_ERR (ctx->pwm); - -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Could not get PWM: %d\n" , ret); - -return ret; +return probe_err (&pdev->dev, ret,"Could not get PWM: %d\n" , + ret); }platform_set_drvdata (pdev, ctx);
drivers/i2c/busses/i2c-bcm2835.c +3 -5
@@ -348,11 +348,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)return PTR_ERR (i2c_dev->regs); 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,"Could not get clock\n" ); -return PTR_ERR (i2c_dev->clk); - } +if (IS_ERR (i2c_dev->clk)) +return probe_err (&pdev->dev,PTR_ERR (i2c_dev->clk), +"Could not get clock\n" ); ret =of_property_read_u32 (pdev->dev.of_node,"clock-frequency" , &i2c_dev->bus_clk_rate);
drivers/i2c/busses/i2c-rk3x.c +4 -6
@@ -1290,15 +1290,13 @@ static int rk3x_i2c_probe(struct platform_device *pdev)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; +return probe_err (&pdev->dev, ret,"Can't get bus clk: %d\n" , + 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; +return probe_err (&pdev->dev, ret, +"Can't get periph clk: %d\n" , ret); } ret =clk_prepare (i2c->clk);
drivers/i2c/muxes/i2c-arb-gpio-challenge.c +10 -20
@@ -140,38 +140,28 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)/* Request GPIOs */ ret =of_get_named_gpio_flags (np,"our-claim-gpio" ,0 , &gpio_flags); -if (!gpio_is_valid (ret)) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Error getting our-claim-gpio\n" ); -return ret; - } +if (!gpio_is_valid (ret)) +return probe_err (dev, ret,"Error getting our-claim-gpio\n" ); arb->our_gpio = ret; arb->our_gpio_release = !!(gpio_flags &OF_GPIO_ACTIVE_LOW ); out_init = (gpio_flags &OF_GPIO_ACTIVE_LOW ) ?GPIOF_OUT_INIT_HIGH :GPIOF_OUT_INIT_LOW ; ret =devm_gpio_request_one (dev, arb->our_gpio, out_init,"our-claim-gpio" ); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Error requesting our-claim-gpio\n" ); -return ret; - } +if (ret) +return probe_err (dev, ret, +"Error requesting our-claim-gpio\n" ); ret =of_get_named_gpio_flags (np,"their-claim-gpios" ,0 , &gpio_flags); -if (!gpio_is_valid (ret)) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Error getting their-claim-gpio\n" ); -return ret; - } +if (!gpio_is_valid (ret)) +return probe_err (dev, ret,"Error getting their-claim-gpio\n" ); arb->their_gpio = ret; arb->their_gpio_release = !!(gpio_flags &OF_GPIO_ACTIVE_LOW ); ret =devm_gpio_request_one (dev, arb->their_gpio,GPIOF_IN ,"their-claim-gpio" ); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Error requesting their-claim-gpio\n" ); -return ret; - } +if (ret) +return probe_err (dev, ret, +"Error requesting their-claim-gpio\n" );/* At the moment we only support a single two master (us + 1 other) */ if (gpio_is_valid (of_get_named_gpio (np,"their-claim-gpios" ,1 ))) {
drivers/i2c/muxes/i2c-mux-gpmux.c +6 -10
@@ -88,18 +88,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 probe_err (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 probe_err (dev,PTR_ERR (parent), +"failed to get i2c-parent adapter\n" ); children =of_get_child_count (np);
drivers/iio/adc/envelope-detector.c +8 -15
@@ -350,26 +350,19 @@ static int envelope_detector_probe(struct platform_device *pdev) indio_dev->num_channels =1 ; env->dac =devm_iio_channel_get (dev,"dac" ); -if (IS_ERR (env->dac)) { -if (PTR_ERR (env->dac) != -EPROBE_DEFER ) -dev_err (dev,"failed to get dac input channel\n" ); -return PTR_ERR (env->dac); - } +if (IS_ERR (env->dac)) +return probe_err (dev,PTR_ERR (env->dac), +"failed to get dac input channel\n" ); env->comp_irq =platform_get_irq_byname (pdev,"comp" ); -if (env->comp_irq <0 ) { -if (env->comp_irq != -EPROBE_DEFER ) -dev_err (dev,"failed to get compare interrupt\n" ); -return env->comp_irq; - } +if (env->comp_irq <0 ) +return probe_err (dev, env->comp_irq, +"failed to get compare interrupt\n" ); ret =devm_request_irq (dev, env->comp_irq, envelope_detector_comp_isr,0 ,"envelope-detector" , env); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to request interrupt\n" ); -return ret; - } +if (ret) +return probe_err (dev, ret,"failed to request interrupt\n" ); env->comp_irq_trigger =irq_get_trigger_type (env->comp_irq);if (env->comp_irq_trigger &IRQF_TRIGGER_RISING ) env->comp_irq_trigger_inv |=IRQF_TRIGGER_FALLING ;
drivers/iio/adc/rcar-gyroadc.c +2 -3
@@ -510,9 +510,8 @@ static int rcar_gyroadc_probe(struct platform_device *pdev) priv->clk =devm_clk_get (dev,"fck" );if (IS_ERR (priv->clk)) { ret =PTR_ERR (priv->clk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get IF clock (ret=%i)\n" , ret); -return ret; +return probe_err (dev, ret, +"Failed to get IF clock (ret=%i)\n" , ret); } ret =rcar_gyroadc_parse_subdevs (indio_dev);
drivers/iio/afe/iio-rescale.c +3 -5
@@ -276,11 +276,9 @@ static int rescale_probe(struct platform_device *pdev)int ret; source =devm_iio_channel_get (dev,NULL ); -if (IS_ERR (source)) { -if (PTR_ERR (source) != -EPROBE_DEFER ) -dev_err (dev,"failed to get source channel\n" ); -return PTR_ERR (source); - } +if (IS_ERR (source)) +return probe_err (dev,PTR_ERR (source), +"failed to get source channel\n" ); sizeof_ext_info =iio_get_channel_ext_info_count (source);if (sizeof_ext_info) {
drivers/iio/dac/dpot-dac.c +6 -10
@@ -184,18 +184,14 @@ static int dpot_dac_probe(struct platform_device *pdev) indio_dev->num_channels =1 ; dac->vref =devm_regulator_get (dev,"vref" ); -if (IS_ERR (dac->vref)) { -if (PTR_ERR (dac->vref) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to get vref regulator\n" ); -return PTR_ERR (dac->vref); - } +if (IS_ERR (dac->vref)) +return probe_err (&pdev->dev,PTR_ERR (dac->vref), +"failed to get vref regulator\n" ); dac->dpot =devm_iio_channel_get (dev,"dpot" ); -if (IS_ERR (dac->dpot)) { -if (PTR_ERR (dac->dpot) != -EPROBE_DEFER ) -dev_err (dev,"failed to get dpot input channel\n" ); -return PTR_ERR (dac->dpot); - } +if (IS_ERR (dac->dpot)) +return probe_err (dev,PTR_ERR (dac->dpot), +"failed to get dpot input channel\n" ); ret =iio_get_channel_type (dac->dpot, &type);if (ret <0 )
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +4 -7
@@ -1027,13 +1027,10 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, } st->vddio_supply =devm_regulator_get (dev,"vddio" ); -if (IS_ERR (st->vddio_supply)) { -if (PTR_ERR (st->vddio_supply) != -EPROBE_DEFER ) -dev_err (dev,"Failed to get vddio regulator %d\n" , - (int )PTR_ERR (st->vddio_supply)); - -return PTR_ERR (st->vddio_supply); - } +if (IS_ERR (st->vddio_supply)) +return probe_err (dev,PTR_ERR (st->vddio_supply), +"Failed to get vddio regulator %d\n" , + (int )PTR_ERR (st->vddio_supply)); result =inv_mpu_core_enable_regulator (st);if (result)
drivers/iio/multiplexer/iio-mux.c +6 -10
@@ -354,11 +354,9 @@ static int mux_probe(struct platform_device *pdev)return -ENODEV ; parent =devm_iio_channel_get (dev,"parent" ); -if (IS_ERR (parent)) { -if (PTR_ERR (parent) != -EPROBE_DEFER ) -dev_err (dev,"failed to get parent channel\n" ); -return PTR_ERR (parent); - } +if (IS_ERR (parent)) +return probe_err (dev,PTR_ERR (parent), +"failed to get parent channel\n" ); sizeof_ext_info =iio_get_channel_ext_info_count (parent);if (sizeof_ext_info) {
@@ -417,11 +415,9 @@ static int mux_probe(struct platform_device *pdev) } 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 probe_err (dev,PTR_ERR (mux->control), +"failed to get control-mux\n" ); i =0 ;of_property_for_each_string_index (np,"channels" , prop, label, state) {
drivers/input/keyboard/bcm-keypad.c +3 -5
@@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev) kp->clk =devm_clk_get (&pdev->dev,"peri_clk" );if (IS_ERR (kp->clk)) { error =PTR_ERR (kp->clk); -if (error != -ENOENT ) { -if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get clock\n" ); -return error; - } +if (error != -ENOENT ) +return probe_err (&pdev->dev, error, +"Failed to get clock\n" );dev_dbg (&pdev->dev,"No clock specified. Assuming it's enabled\n" ); kp->clk =NULL ;
drivers/input/misc/pwm-beeper.c +4 -8
@@ -143,10 +143,8 @@ static int pwm_beeper_probe(struct platform_device *pdev) beeper->pwm =devm_pwm_get (dev,NULL );if (IS_ERR (beeper->pwm)) { error =PTR_ERR (beeper->pwm); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to request PWM device: %d\n" , - error); -return error; +return probe_err (dev, error, +"Failed to request PWM device: %d\n" , error); }/* Sync up PWM state and ensure it is off. */
@@ -162,10 +160,8 @@ static int pwm_beeper_probe(struct platform_device *pdev) beeper->amplifier =devm_regulator_get (dev,"amp" );if (IS_ERR (beeper->amplifier)) { error =PTR_ERR (beeper->amplifier); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'amp' regulator: %d\n" , - error); -return error; +return probe_err (dev, error, +"Failed to get 'amp' regulator: %d\n" , error); }INIT_WORK (&beeper->work, pwm_beeper_work);
drivers/input/misc/pwm-vibra.c +6 -12
@@ -132,21 +132,15 @@ static int pwm_vibrator_probe(struct platform_device *pdev) vibrator->vcc =devm_regulator_get (&pdev->dev,"vcc" ); err =PTR_ERR_OR_ZERO (vibrator->vcc); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request regulator: %d" , - err); -return err; - } +if (err) +return probe_err (&pdev->dev, err, +"Failed to request regulator: %d" , err); vibrator->pwm =devm_pwm_get (&pdev->dev,"enable" ); err =PTR_ERR_OR_ZERO (vibrator->pwm); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request main pwm: %d" , - err); -return err; - } +if (err) +return probe_err (&pdev->dev, err, +"Failed to request main pwm: %d" , err);INIT_WORK (&vibrator->play_work, pwm_vibrator_play_work);
drivers/input/mouse/elan_i2c_core.c +2 -4
@@ -1142,10 +1142,8 @@ static int elan_probe(struct i2c_client *client, data->vcc =devm_regulator_get (dev,"vcc" );if (IS_ERR (data->vcc)) { error =PTR_ERR (data->vcc); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'vcc' regulator: %d\n" , - error); -return error; +return probe_err (dev, error, +"Failed to get 'vcc' regulator: %d\n" , error); } error =regulator_enable (data->vcc);
drivers/input/touchscreen/bu21029_ts.c +6 -8
@@ -362,20 +362,18 @@ static int bu21029_probe(struct i2c_client *client, bu21029->vdd =devm_regulator_get (&client->dev,"vdd" );if (IS_ERR (bu21029->vdd)) { error =PTR_ERR (bu21029->vdd); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to acquire 'vdd' supply: %d\n" , error); -return error; +return probe_err (&client->dev, error, +"failed to acquire 'vdd' supply: %d\n" , + error); } bu21029->reset_gpios =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_HIGH );if (IS_ERR (bu21029->reset_gpios)) { error =PTR_ERR (bu21029->reset_gpios); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to acquire 'reset' gpio: %d\n" , error); -return error; +return probe_err (&client->dev, error, +"failed to acquire 'reset' gpio: %d\n" , + error); } in_dev =devm_input_allocate_device (&client->dev);
drivers/input/touchscreen/chipone_icn8318.c +2 -3
@@ -200,9 +200,8 @@ static int icn8318_probe(struct i2c_client *client, data->wake_gpio =devm_gpiod_get (dev,"wake" ,GPIOD_OUT_LOW );if (IS_ERR (data->wake_gpio)) { error =PTR_ERR (data->wake_gpio); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Error getting wake gpio: %d\n" , error); -return error; +return probe_err (dev, error,"Error getting wake gpio: %d\n" , + error); } input =devm_input_allocate_device (dev);
drivers/input/touchscreen/ektf2127.c +2 -3
@@ -243,9 +243,8 @@ static int ektf2127_probe(struct i2c_client *client, ts->power_gpios =devm_gpiod_get (dev,"power" ,GPIOD_OUT_HIGH );if (IS_ERR (ts->power_gpios)) { error =PTR_ERR (ts->power_gpios); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Error getting power gpio: %d\n" , error); -return error; +return probe_err (dev, error,"Error getting power gpio: %d\n" , + error); } input =devm_input_allocate_device (dev);
drivers/input/touchscreen/elants_i2c.c +6 -10
@@ -1159,21 +1159,17 @@ static int elants_i2c_probe(struct i2c_client *client, ts->vcc33 =devm_regulator_get (&client->dev,"vcc33" );if (IS_ERR (ts->vcc33)) { error =PTR_ERR (ts->vcc33); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vcc33' regulator: %d\n" , - error); -return error; +return probe_err (&client->dev, error, +"Failed to get 'vcc33' regulator: %d\n" , + error); } ts->vccio =devm_regulator_get (&client->dev,"vccio" );if (IS_ERR (ts->vccio)) { error =PTR_ERR (ts->vccio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vccio' regulator: %d\n" , - error); -return error; +return probe_err (&client->dev, error, +"Failed to get 'vccio' regulator: %d\n" , + error); } ts->reset_gpio =devm_gpiod_get (&client->dev,"reset" ,GPIOD_OUT_LOW );
drivers/input/touchscreen/pixcir_i2c_ts.c +4 -6
@@ -534,18 +534,16 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client, GPIOD_OUT_HIGH);if (IS_ERR (tsdata->gpio_wake)) { error =PTR_ERR (tsdata->gpio_wake); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get wake gpio: %d\n" , error); -return error; +return probe_err (dev, error,"Failed to get wake gpio: %d\n" , + error); } tsdata->gpio_enable =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_HIGH );if (IS_ERR (tsdata->gpio_enable)) { error =PTR_ERR (tsdata->gpio_enable); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get enable gpio: %d\n" , error); -return error; +return probe_err (dev, error, +"Failed to get enable gpio: %d\n" , error); }if (tsdata->gpio_enable)
drivers/input/touchscreen/raydium_i2c_ts.c +8 -12
@@ -1026,29 +1026,25 @@ static int raydium_i2c_probe(struct i2c_client *client, ts->avdd =devm_regulator_get (&client->dev,"avdd" );if (IS_ERR (ts->avdd)) { error =PTR_ERR (ts->avdd); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'avdd' regulator: %d\n" , error); -return error; +return probe_err (&client->dev, error, +"Failed to get 'avdd' regulator: %d\n" , + error); } ts->vccio =devm_regulator_get (&client->dev,"vccio" );if (IS_ERR (ts->vccio)) { error =PTR_ERR (ts->vccio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vccio' regulator: %d\n" , error); -return error; +return probe_err (&client->dev, error, +"Failed to get 'vccio' regulator: %d\n" , + error); } ts->reset_gpio =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (ts->reset_gpio)) { error =PTR_ERR (ts->reset_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to get reset gpio: %d\n" , error); -return error; +return probe_err (&client->dev, error, +"failed to get reset gpio: %d\n" , error); } error =raydium_i2c_power_on (ts);
drivers/input/touchscreen/resistive-adc-touch.c +3 -6
@@ -108,12 +108,9 @@ static int grts_probe(struct platform_device *pdev)/* get the channels from IIO device */ st->iio_chans =devm_iio_channel_get_all (dev); -if (IS_ERR (st->iio_chans)) { - error =PTR_ERR (st->iio_chans); -if (error != -EPROBE_DEFER ) -dev_err (dev,"can't get iio channels.\n" ); -return error; - } +if (IS_ERR (st->iio_chans)) +return probe_err (dev,PTR_ERR (st->iio_chans), +"can't get iio channels.\n" ); chan = &st->iio_chans[0 ]; st->pressure = false;
drivers/input/touchscreen/silead.c +5 -10
@@ -520,11 +520,9 @@ static int silead_ts_probe(struct i2c_client *client,/* Power GPIO pin */ data->gpio_power =devm_gpiod_get_optional (dev,"power" ,GPIOD_OUT_LOW ); -if (IS_ERR (data->gpio_power)) { -if (PTR_ERR (data->gpio_power) != -EPROBE_DEFER ) -dev_err (dev,"Shutdown GPIO request failed\n" ); -return PTR_ERR (data->gpio_power); - } +if (IS_ERR (data->gpio_power)) +return probe_err (dev,PTR_ERR (data->gpio_power), +"Shutdown GPIO request failed\n" ); error =silead_ts_setup (client);if (error)
@@ -537,11 +535,8 @@ static int silead_ts_probe(struct i2c_client *client, error =devm_request_threaded_irq (dev, client->irq,NULL , silead_ts_threaded_irq_handler,IRQF_ONESHOT , client->name, data); -if (error) { -if (error != -EPROBE_DEFER ) -dev_err (dev,"IRQ request failed %d\n" , error); -return error; - } +if (error) +return probe_err (dev, error,"IRQ request failed %d\n" , error);return 0 ; }
drivers/input/touchscreen/sis_i2c.c +4 -8
@@ -321,20 +321,16 @@ static int sis_ts_probe(struct i2c_client *client, "attn", GPIOD_IN);if (IS_ERR (ts->attn_gpio)) { error =PTR_ERR (ts->attn_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get attention GPIO: %d\n" , error); -return error; +return probe_err (&client->dev, error, +"Failed to get attention GPIO: %d\n" , error); } ts->reset_gpio =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (ts->reset_gpio)) { error =PTR_ERR (ts->reset_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get reset GPIO: %d\n" , error); -return error; +return probe_err (&client->dev, error, +"Failed to get reset GPIO: %d\n" , error); }sis_ts_reset (ts);
drivers/input/touchscreen/surface3_spi.c +3 -6
@@ -239,12 +239,9 @@ static int surface3_spi_get_gpio_config(struct surface3_ts_data *data) gpiod =devm_gpiod_get_index (dev,NULL , i,GPIOD_OUT_LOW );if (IS_ERR (gpiod)) { error =PTR_ERR (gpiod); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"Failed to get power GPIO %d: %d\n" , - i, - error); -return error; +return probe_err (dev, error, +"Failed to get power GPIO %d: %d\n" , + i, error); } data->gpiod_rst[i] = gpiod;
drivers/leds/leds-pwm.c +3 -4
@@ -100,10 +100,9 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv, led_data->pwm =devm_pwm_get (dev, led->name);if (IS_ERR (led_data->pwm)) { ret =PTR_ERR (led_data->pwm); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"unable to request PWM for %s: %d\n" , - led->name, ret); -return ret; +return probe_err (dev, ret, +"unable to request PWM for %s: %d\n" , + led->name, ret); } led_data->cdev.brightness_set_blocking = led_pwm_set;
drivers/media/i2c/ad5820.c +3 -6
@@ -305,12 +305,9 @@ static int ad5820_probe(struct i2c_client *client,return -ENOMEM ; coil->vana =devm_regulator_get (&client->dev,"VANA" ); -if (IS_ERR (coil->vana)) { - ret =PTR_ERR (coil->vana); -if (ret != -EPROBE_DEFER ) -dev_err (&client->dev,"could not get regulator for vana\n" ); -return ret; - } +if (IS_ERR (coil->vana)) +return probe_err (&client->dev,PTR_ERR (coil->vana), +"could not get regulator for vana\n" );mutex_init (&coil->power_lock);
drivers/media/i2c/tc358743.c +4 -6
@@ -1902,12 +1902,10 @@ static int tc358743_probe_of(struct tc358743_state *state)int ret; refclk =devm_clk_get (dev,"refclk" ); -if (IS_ERR (refclk)) { -if (PTR_ERR (refclk) != -EPROBE_DEFER ) -dev_err (dev,"failed to get refclk: %ld\n" , -PTR_ERR (refclk)); -return PTR_ERR (refclk); - } +if (IS_ERR (refclk)) +return probe_err (dev,PTR_ERR (refclk), +"failed to get refclk: %ld\n" , +PTR_ERR (refclk)); ep =of_graph_get_next_endpoint (dev->of_node,NULL );if (!ep) {
drivers/media/platform/omap3isp/isp.c +1 -2
@@ -1875,8 +1875,7 @@ static int isp_initialize_modules(struct isp_device *isp) ret =omap3isp_ccp2_init (isp);if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (isp->dev,"CCP2 initialization failed\n" ); +probe_err (isp->dev, ret,"CCP2 initialization failed\n" ); goto error_ccp2; }
drivers/media/platform/video-mux.c +1 -3
@@ -390,9 +390,7 @@ static int video_mux_probe(struct platform_device *pdev) vmux->mux =devm_mux_control_get (dev,NULL );if (IS_ERR (vmux->mux)) { ret =PTR_ERR (vmux->mux); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get mux: %d\n" , ret); -return ret; +return probe_err (dev, ret,"Failed to get mux: %d\n" , ret); }mutex_init (&vmux->lock);
drivers/media/rc/gpio-ir-recv.c +1 -4
@@ -60,10 +60,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) gpio_dev->gpiod =devm_gpiod_get (dev,NULL ,GPIOD_IN );if (IS_ERR (gpio_dev->gpiod)) { rc =PTR_ERR (gpio_dev->gpiod); -/* Just try again if this happens */ -if (rc != -EPROBE_DEFER ) -dev_err (dev,"error getting gpio (%d)\n" , rc); -return rc; +return probe_err (dev, rc,"error getting gpio (%d)\n" , rc); } gpio_dev->irq =gpiod_to_irq (gpio_dev->gpiod);if (gpio_dev->irq <0 )
drivers/media/rc/gpio-ir-tx.c +4 -6
@@ -137,12 +137,10 @@ static int gpio_ir_tx_probe(struct platform_device *pdev)return -ENOMEM ; gpio_ir->gpio =devm_gpiod_get (&pdev->dev,NULL ,GPIOD_OUT_LOW ); -if (IS_ERR (gpio_ir->gpio)) { -if (PTR_ERR (gpio_ir->gpio) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get gpio (%ld)\n" , -PTR_ERR (gpio_ir->gpio)); -return PTR_ERR (gpio_ir->gpio); - } +if (IS_ERR (gpio_ir->gpio)) +return probe_err (&pdev->dev,PTR_ERR (gpio_ir->gpio), +"Failed to get gpio (%ld)\n" , +PTR_ERR (gpio_ir->gpio)); rcdev->priv = gpio_ir; rcdev->driver_name =DRIVER_NAME ;
drivers/mfd/madera-core.c +2 -4
@@ -298,10 +298,8 @@ static int madera_get_reset_gpio(struct madera *madera) reset =devm_gpiod_get_optional (madera->dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (reset)) { ret =PTR_ERR (reset); -if (ret != -EPROBE_DEFER ) -dev_err (madera->dev,"Failed to request /RESET: %d\n" , - ret); -return ret; +return probe_err (madera->dev, ret, +"Failed to request /RESET: %d\n" , ret); }/*
drivers/mmc/host/bcm2835.c +1 -2
@@ -1397,8 +1397,7 @@ static int bcm2835_probe(struct platform_device *pdev) clk =devm_clk_get (dev,NULL );if (IS_ERR (clk)) { ret =PTR_ERR (clk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"could not get clk: %d\n" , ret); +probe_err (dev, ret,"could not get clk: %d\n" , ret); goto err; }
drivers/mmc/host/davinci_mmc.c +2 -3
@@ -1253,9 +1253,8 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) pdev->id_entry = match->data; ret =mmc_of_parse (mmc);if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"could not parse of data: %d\n" , ret); +probe_err (&pdev->dev, ret, +"could not parse of data: %d\n" , ret); goto parse_fail; } }else {
drivers/mmc/host/dw_mmc-zx.c +2 -4
@@ -169,10 +169,8 @@ static int dw_mci_zx_parse_dt(struct dw_mci *host)if (IS_ERR (sysc_base)) { ret =PTR_ERR (sysc_base); -if (ret != -EPROBE_DEFER ) -dev_err (host->dev,"Can't get syscon: %d\n" , - ret); -return ret; +return probe_err (host->dev, ret, +"Can't get syscon: %d\n" , ret); } }else {return 0 ;
drivers/mmc/host/jz4740_mmc.c +2 -3
@@ -1042,9 +1042,8 @@ static int jz4740_mmc_probe(struct platform_device* pdev) host->version = (enum jz4740_mmc_version )match->data; ret =mmc_of_parse (mmc);if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"could not parse of data: %d\n" , ret); +probe_err (&pdev->dev, ret, +"could not parse of data: %d\n" , ret); goto err_free_host; } }else {
drivers/mmc/host/meson-gx-mmc.c +6 -11
@@ -507,11 +507,9 @@ static int meson_mmc_clk_init(struct meson_host *host)snprintf (name,sizeof (name),"clkin%d" , i); clk =devm_clk_get (host->dev, name); -if (IS_ERR (clk)) { -if (clk !=ERR_PTR (-EPROBE_DEFER )) -dev_err (host->dev,"Missing clock %s\n" , name); -return PTR_ERR (clk); - } +if (IS_ERR (clk)) +return probe_err (host->dev,PTR_ERR (clk), +"Missing clock %s\n" , name); mux_parent_names[i] =__clk_get_name (clk); }
@@ -1214,12 +1212,9 @@ static int meson_mmc_probe(struct platform_device *pdev) } ret =device_reset_optional (&pdev->dev); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"device reset failed: %d\n" , ret); - -return ret; - } +if (ret) +return probe_err (&pdev->dev, ret,"device reset failed: %d\n" , + ret); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); host->regs =devm_ioremap_resource (&pdev->dev, res);
drivers/mmc/host/sdhci-of-arasan.c +3 -5
@@ -796,9 +796,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)if (IS_ERR (sdhci_arasan->soc_ctl_base)) { ret =PTR_ERR (sdhci_arasan->soc_ctl_base); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Can't get syscon: %d\n" , - ret); +probe_err (&pdev->dev, ret,"Can't get syscon: %d\n" , + ret); goto err_pltfm_free; } }
@@ -851,8 +850,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"parsing dt failed (%d)\n" , ret); +probe_err (&pdev->dev, ret,"parsing dt failed (%d)\n" , ret); goto unreg_clk; }
drivers/mtd/nand/onenand/omap2.c +1 -4
@@ -507,10 +507,7 @@ static int omap2_onenand_probe(struct platform_device *pdev) c->int_gpiod =devm_gpiod_get_optional (dev,"int" ,GPIOD_IN );if (IS_ERR (c->int_gpiod)) { r =PTR_ERR (c->int_gpiod); -/* Just try again if this happens */ -if (r != -EPROBE_DEFER ) -dev_err (dev,"error getting gpio: %d\n" , r); -return r; +return probe_err (dev, r,"error getting gpio: %d\n" , r); }if (c->int_gpiod) {
drivers/mtd/nand/raw/atmel/nand-controller.c +8 -12
@@ -1929,10 +1929,9 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, nc->pmecc =devm_atmel_pmecc_get (dev);if (IS_ERR (nc->pmecc)) { ret =PTR_ERR (nc->pmecc); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Could not get PMECC object (err = %d)\n" , - ret); -return ret; +return probe_err (dev, ret, +"Could not get PMECC object (err = %d)\n" , + ret); }if (nc->caps->has_dma && !atmel_nand_avoid_dma) {
@@ -2057,9 +2056,8 @@ atmel_hsmc_nand_controller_legacy_init(struct atmel_hsmc_nand_controller *nc) nc->irq =of_irq_get (nand_np,0 );if (nc->irq <=0 ) { ret = nc->irq ?: -ENXIO ; -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get IRQ number (err = %d)\n" , - ret); +probe_err (dev, ret,"Failed to get IRQ number (err = %d)\n" , + ret); goto out; }
@@ -2148,11 +2146,9 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc) nc->irq =of_irq_get (np,0 );of_node_put (np);if (nc->irq <=0 ) { - ret = nc->irq ?: -ENXIO ; -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get IRQ number (err = %d)\n" , - ret); -return ret; + ret = nc->irq ? : -ENXIO ; +return probe_err (dev, ret, +"Failed to get IRQ number (err = %d)\n" , ret); } np =of_parse_phandle (dev->of_node,"atmel,nfc-io" ,0 );
drivers/mux/gpio.c +3 -6
@@ -64,12 +64,9 @@ static int mux_gpio_probe(struct platform_device *pdev) mux_chip->ops = &mux_gpio_ops; mux_gpio->gpios =devm_gpiod_get_array (dev,"mux" ,GPIOD_OUT_LOW ); -if (IS_ERR (mux_gpio->gpios)) { - ret =PTR_ERR (mux_gpio->gpios); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get gpios\n" ); -return ret; - } +if (IS_ERR (mux_gpio->gpios)) +return probe_err (dev,PTR_ERR (mux_gpio->gpios), +"failed to get gpios\n" );WARN_ON (pins != mux_gpio->gpios->ndescs); mux_chip->mux->states =1 << pins;
drivers/net/dsa/lantiq_gswip.c +3 -5
@@ -932,11 +932,9 @@ static int gswip_gphy_fw_probe(struct gswip_priv *priv, } gphy_fw->reset =of_reset_control_array_get_exclusive (gphy_fw_np); -if (IS_ERR (gphy_fw->reset)) { -if (PTR_ERR (gphy_fw->reset) != -EPROBE_DEFER ) -dev_err (dev,"Failed to lookup gphy reset\n" ); -return PTR_ERR (gphy_fw->reset); - } +if (IS_ERR (gphy_fw->reset)) +return probe_err (dev,PTR_ERR (gphy_fw->reset), +"Failed to lookup gphy reset\n" );return gswip_gphy_fw_load (priv, gphy_fw); }
drivers/net/ethernet/renesas/sh_eth.c +1 -2
@@ -3312,8 +3312,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)/* MDIO bus init */ ret =sh_mdio_init (mdp, pd);if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"MDIO init failed: %d\n" , ret); +probe_err (&pdev->dev, ret,"MDIO init failed: %d\n" , ret); goto out_release; }
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +3 -7
@@ -434,13 +434,9 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)* resource initialization is done in the glue logic. */ stmmac_res.irq =platform_get_irq (pdev,0 ); -if (stmmac_res.irq <0 ) { -if (stmmac_res.irq != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"IRQ configuration information not found\n" ); - -return stmmac_res.irq; - } +if (stmmac_res.irq <0 ) +return probe_err (&pdev->dev, stmmac_res.irq, +"IRQ configuration information not found\n" ); stmmac_res.wol_irq = stmmac_res.irq; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +3 -6
@@ -129,12 +129,9 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac)snprintf (name,sizeof (name),"clkin%d" , i); clk =devm_clk_get (dev, name); -if (IS_ERR (clk)) { - ret =PTR_ERR (clk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Missing clock %s\n" , name); -return ret; - } +if (IS_ERR (clk)) +return probe_err (dev,PTR_ERR (clk), +"Missing clock %s\n" , name); mux_parent_names[i] =__clk_get_name (clk); }
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -7
@@ -618,13 +618,9 @@ int stmmac_get_platform_resources(struct platform_device *pdev,* probe if needed before we went too far with resource allocation. */ stmmac_res->irq =platform_get_irq_byname (pdev,"macirq" ); -if (stmmac_res->irq <0 ) { -if (stmmac_res->irq != -EPROBE_DEFER ) { -dev_err (&pdev->dev, -"MAC IRQ configuration information not found\n" ); - } -return stmmac_res->irq; - } +if (stmmac_res->irq <0 ) +return probe_err (&pdev->dev, stmmac_res->irq, +"MAC IRQ configuration information not found\n" );/* On some platforms e.g. SPEAr the wake up irq differs from the mac irq * The external wake up irq can be passed through the platform code
drivers/net/ethernet/ti/cpsw.c +4 -5
@@ -3147,11 +3147,10 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,* to the PHY is the Ethernet MAC DT node. */ ret =of_phy_register_fixed_link (slave_node); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to register fixed-link phy: %d\n" , ret); -return ret; - } +if (ret) +return probe_err (&pdev->dev, ret, +"failed to register fixed-link phy: %d\n" , + ret); slave_data->phy_node =of_node_get (slave_node); }else if (parp) {u32 phyid;
drivers/net/ieee802154/mcr20a.c +2 -3
@@ -1243,9 +1243,8 @@ mcr20a_probe(struct spi_device *spi) rst_b =devm_gpiod_get (&spi->dev,"rst_b" ,GPIOD_OUT_HIGH );if (IS_ERR (rst_b)) { ret =PTR_ERR (rst_b); -if (ret != -EPROBE_DEFER ) -dev_err (&spi->dev,"Failed to get 'rst_b' gpio: %d" , ret); -return ret; +return probe_err (&spi->dev, ret, +"Failed to get 'rst_b' gpio: %d" , ret); }/* reset mcr20a */
drivers/net/phy/mdio-mux-mmioreg.c +3 -6
@@ -162,12 +162,9 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev) ret =mdio_mux_init (&pdev->dev, pdev->dev.of_node, mdio_mux_mmioreg_switch_fn, &s->mux_handle, s,NULL ); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"failed to register mdio-mux bus %pOF\n" , np); -return ret; - } +if (ret) +return probe_err (&pdev->dev, ret, +"failed to register mdio-mux bus %pOF\n" , np); pdev->dev.platform_data = s;
drivers/opp/core.c +5 -7
@@ -1406,9 +1406,9 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, reg =regulator_get_optional (dev, names[i]);if (IS_ERR (reg)) { ret =PTR_ERR (reg); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"%s: no regulator (%s) found: %d\n" , - __func__, names[i], ret); +probe_err (dev, ret, +"%s: no regulator (%s) found: %d\n" , + __func__, names[i], ret); goto free_regulators; }
@@ -1501,10 +1501,8 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name) opp_table->clk =clk_get (dev, name);if (IS_ERR (opp_table->clk)) { ret =PTR_ERR (opp_table->clk); -if (ret != -EPROBE_DEFER ) { -dev_err (dev,"%s: Couldn't find clock: %d\n" , __func__, - ret); - } +probe_err (dev, ret,"%s: Couldn't find clock: %d\n" , __func__, + ret); goto err; }
drivers/pci/controller/pcie-rockchip.c +25 -41
91 lines not on this page · raw message
drivers/phy/amlogic/phy-meson-gxl-usb2.c +2 -7
@@ -274,13 +274,8 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev)return PTR_ERR (priv->reset); phy =devm_phy_create (dev,NULL , &phy_meson_gxl_usb2_ops); -if (IS_ERR (phy)) { - ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); - -return ret; - } +if (IS_ERR (phy)) +return probe_err (dev,PTR_ERR (phy),"failed to create PHY\n" );phy_set_drvdata (phy, priv);
drivers/phy/amlogic/phy-meson-gxl-usb3.c +2 -7
@@ -247,13 +247,8 @@ static int phy_meson_gxl_usb3_probe(struct platform_device *pdev) priv->mode =PHY_MODE_USB_HOST ; phy =devm_phy_create (dev, np, &phy_meson_gxl_usb3_ops); -if (IS_ERR (phy)) { - ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); - -return ret; - } +if (IS_ERR (phy)) +return probe_err (dev,PTR_ERR (phy),"failed to create PHY\n" );phy_set_drvdata (phy, priv);
drivers/phy/lantiq/phy-lantiq-rcu-usb2.c +3 -5
@@ -188,11 +188,9 @@ static int ltq_rcu_usb2_of_parse(struct ltq_rcu_usb2_priv *priv, } priv->ctrl_reset =devm_reset_control_get_shared (dev,"ctrl" ); -if (IS_ERR (priv->ctrl_reset)) { -if (PTR_ERR (priv->ctrl_reset) != -EPROBE_DEFER ) -dev_err (dev,"failed to get 'ctrl' reset\n" ); -return PTR_ERR (priv->ctrl_reset); - } +if (IS_ERR (priv->ctrl_reset)) +return probe_err (dev,PTR_ERR (priv->ctrl_reset), +"failed to get 'ctrl' reset\n" ); priv->phy_reset =devm_reset_control_get_optional (dev,"phy" );
drivers/phy/qualcomm/phy-qcom-qmp.c +8 -13
@@ -1643,14 +1643,11 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id)snprintf (prop_name,sizeof (prop_name),"pipe%d" , id); qphy->pipe_clk =of_clk_get_by_name (np, prop_name);if (IS_ERR (qphy->pipe_clk)) { -if (qmp->cfg->type ==PHY_TYPE_PCIE || - qmp->cfg->type ==PHY_TYPE_USB3 ) { +if (qmp->cfg->type ==PHY_TYPE_PCIE || qmp->cfg->type ==PHY_TYPE_USB3 ) { ret =PTR_ERR (qphy->pipe_clk); -if (ret != -EPROBE_DEFER ) -dev_err (dev, -"failed to get lane%d pipe_clk, %d\n" , - id, ret); -return ret; +return probe_err (dev, ret, +"failed to get lane%d pipe_clk, %d\n" , + id, ret); } qphy->pipe_clk =NULL ; }
@@ -1763,12 +1760,10 @@ static int qcom_qmp_phy_probe(struct platform_device *pdev)return ret; ret =qcom_qmp_phy_vreg_init (dev); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get regulator supplies: %d\n" , - ret); -return ret; - } +if (ret) +return probe_err (dev, ret, +"failed to get regulator supplies: %d\n" , + ret); num =of_get_available_child_count (dev->of_node);/* do we have a rogue child node ? */
drivers/phy/qualcomm/phy-qcom-qusb2.c +7 -12
@@ -766,17 +766,14 @@ static int qusb2_phy_probe(struct platform_device *pdev) qphy->cfg_ahb_clk =devm_clk_get (dev,"cfg_ahb" );if (IS_ERR (qphy->cfg_ahb_clk)) { ret =PTR_ERR (qphy->cfg_ahb_clk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get cfg ahb clk, %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get cfg ahb clk, %d\n" , + ret); } qphy->ref_clk =devm_clk_get (dev,"ref" );if (IS_ERR (qphy->ref_clk)) { ret =PTR_ERR (qphy->ref_clk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get ref clk, %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get ref clk, %d\n" , ret); } qphy->iface_clk =devm_clk_get (dev,"iface" );
@@ -799,12 +796,10 @@ static int qusb2_phy_probe(struct platform_device *pdev) qphy->vregs[i].supply = qusb2_phy_vreg_names[i]; ret =devm_regulator_bulk_get (dev, num, qphy->vregs); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get regulator supplies: %d\n" , - ret); -return ret; - } +if (ret) +return probe_err (dev, ret, +"failed to get regulator supplies: %d\n" , + ret);/* Get the specific init parameters of QMP phy */ qphy->cfg =of_device_get_match_data (dev);
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +3 -5
@@ -385,11 +385,9 @@ static int rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)if (of_property_read_bool (node,"extcon" )) { edev =extcon_get_edev_by_phandle (rphy->dev,0 ); -if (IS_ERR (edev)) { -if (PTR_ERR (edev) != -EPROBE_DEFER ) -dev_err (rphy->dev,"Invalid or missing extcon\n" ); -return PTR_ERR (edev); - } +if (IS_ERR (edev)) +return probe_err (rphy->dev,PTR_ERR (edev), +"Invalid or missing extcon\n" ); }else {/* Initialize extcon device */ edev = devm_extcon_dev_allocate(rphy->dev,
drivers/phy/rockchip/phy-rockchip-pcie.c +3 -6
@@ -397,12 +397,9 @@ static int rockchip_pcie_phy_probe(struct platform_device *pdev)mutex_init (&rk_phy->pcie_mutex); rk_phy->phy_rst =devm_reset_control_get (dev,"phy" ); -if (IS_ERR (rk_phy->phy_rst)) { -if (PTR_ERR (rk_phy->phy_rst) != -EPROBE_DEFER ) -dev_err (dev, -"missing phy property for reset controller\n" ); -return PTR_ERR (rk_phy->phy_rst); - } +if (IS_ERR (rk_phy->phy_rst)) +return probe_err (dev,PTR_ERR (rk_phy->phy_rst), +"missing phy property for reset controller\n" ); rk_phy->clk_pciephy_ref =devm_clk_get (dev,"refclk" );if (IS_ERR (rk_phy->clk_pciephy_ref)) {
drivers/phy/st/phy-stm32-usbphyc.c +4 -6
@@ -365,9 +365,8 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) phy =devm_phy_create (dev, child, &stm32_usbphyc_phy_ops);if (IS_ERR (phy)) { ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create phy%d: %d\n" , - port, ret); +probe_err (dev, ret,"failed to create phy%d: %d\n" , + port, ret); goto put_child; }
@@ -384,9 +383,8 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) ret =devm_regulator_bulk_get (&phy->dev,NUM_SUPPLIES , usbphyc_phy->supplies);if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&phy->dev, -"failed to get regulators: %d\n" , ret); +probe_err (&phy->dev, ret, +"failed to get regulators: %d\n" , ret); goto put_child; }
drivers/platform/x86/intel_cht_int33fe.c +3 -5
@@ -140,11 +140,9 @@ static int cht_int33fe_probe(struct i2c_client *client)/* The FUSB302 uses the irq at index 1 and is the only irq user */ fusb302_irq =acpi_dev_gpio_irq_get (ACPI_COMPANION (dev),1 ); -if (fusb302_irq <0 ) { -if (fusb302_irq != -EPROBE_DEFER ) -dev_err (dev,"Error getting FUSB302 irq\n" ); -return fusb302_irq; - } +if (fusb302_irq <0 ) +return probe_err (dev, fusb302_irq, +"Error getting FUSB302 irq\n" ); data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)
drivers/power/supply/lego_ev3_battery.c +9 -15
@@ -166,27 +166,21 @@ static int lego_ev3_battery_probe(struct platform_device *pdev) batt->iio_v =devm_iio_channel_get (dev,"voltage" ); err =PTR_ERR_OR_ZERO (batt->iio_v); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get voltage iio channel\n" ); -return err; - } +if (err) +return probe_err (dev, err, +"Failed to get voltage iio channel\n" ); batt->iio_i =devm_iio_channel_get (dev,"current" ); err =PTR_ERR_OR_ZERO (batt->iio_i); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get current iio channel\n" ); -return err; - } +if (err) +return probe_err (dev, err, +"Failed to get current iio channel\n" ); batt->rechargeable_gpio =devm_gpiod_get (dev,"rechargeable" ,GPIOD_IN ); err =PTR_ERR_OR_ZERO (batt->rechargeable_gpio); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get rechargeable gpio\n" ); -return err; - } +if (err) +return probe_err (dev, err, +"Failed to get rechargeable gpio\n" );/* * The rechargeable battery indication switch cannot be changed without
drivers/pwm/pwm-rockchip.c +4 -7
@@ -322,10 +322,8 @@ static int rockchip_pwm_probe(struct platform_device *pdev) pc->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (pc->clk)) { ret =PTR_ERR (pc->clk); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Can't get bus clk: %d\n" , - ret); -return ret; +return probe_err (&pdev->dev, ret, +"Can't get bus clk: %d\n" , ret); } }
@@ -338,9 +336,8 @@ static int rockchip_pwm_probe(struct platform_device *pdev)if (IS_ERR (pc->pclk)) { ret =PTR_ERR (pc->pclk); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Can't get APB clk: %d\n" , ret); -return ret; +return probe_err (&pdev->dev, ret,"Can't get APB clk: %d\n" , + ret); } ret =clk_prepare_enable (pc->clk);
drivers/regulator/gpio-regulator.c +3 -4
@@ -288,10 +288,9 @@ static int gpio_regulator_probe(struct platform_device *pdev) drvdata->nr_gpios = config->nr_gpios; ret =gpio_request_array (drvdata->gpios, drvdata->nr_gpios);if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"Could not obtain regulator setting GPIOs: %d\n" , - ret); +probe_err (&pdev->dev, ret, +"Could not obtain regulator setting GPIOs: %d\n" , + ret); goto err_memgpio; } }
drivers/remoteproc/da8xx_remoteproc.c +4 -7
@@ -283,13 +283,10 @@ static int da8xx_rproc_probe(struct platform_device *pdev) } dsp_reset =devm_reset_control_get_exclusive (dev,NULL ); -if (IS_ERR (dsp_reset)) { -if (PTR_ERR (dsp_reset) != -EPROBE_DEFER ) -dev_err (dev,"unable to get reset control: %ld\n" , -PTR_ERR (dsp_reset)); - -return PTR_ERR (dsp_reset); - } +if (IS_ERR (dsp_reset)) +return probe_err (dev,PTR_ERR (dsp_reset), +"unable to get reset control: %ld\n" , +PTR_ERR (dsp_reset));if (dev->of_node) { ret =of_reserved_mem_device_init (dev);
drivers/remoteproc/qcom_q6v5.c +20 -35
85 lines not on this page · raw message
drivers/remoteproc/qcom_q6v5_adsp.c +3 -6
@@ -285,12 +285,9 @@ static int adsp_init_clock(struct qcom_adsp *adsp)int i, ret; adsp->xo =devm_clk_get (adsp->dev,"xo" ); -if (IS_ERR (adsp->xo)) { - ret =PTR_ERR (adsp->xo); -if (ret != -EPROBE_DEFER ) -dev_err (adsp->dev,"failed to get xo clock" ); -return ret; - } +if (IS_ERR (adsp->xo)) +return probe_err (adsp->dev,PTR_ERR (adsp->xo), +"failed to get xo clock" ); adsp->num_clks =ARRAY_SIZE (adsp_clk_id); adsp->clks = devm_kcalloc(adsp->dev, adsp->num_clks,
drivers/remoteproc/qcom_q6v5_mss.c +4 -7
@@ -205,13 +205,10 @@ static int q6v5_regulator_init(struct device *dev, struct reg_info *regs,for (i =0 ; reg_res[i].supply; i++) { regs[i].reg =devm_regulator_get (dev, reg_res[i].supply); -if (IS_ERR (regs[i].reg)) { - rc =PTR_ERR (regs[i].reg); -if (rc != -EPROBE_DEFER ) -dev_err (dev,"Failed to get %s\n regulator" , - reg_res[i].supply); -return rc; - } +if (IS_ERR (regs[i].reg)) +return probe_err (dev,PTR_ERR (regs[i].reg), +"Failed to get %s\n regulator" , + reg_res[i].supply); regs[i].uV = reg_res[i].uV; regs[i].uA = reg_res[i].uA;
drivers/remoteproc/qcom_q6v5_pas.c +6 -13
@@ -192,22 +192,15 @@ static int adsp_init_clock(struct qcom_adsp *adsp)int ret; adsp->xo =devm_clk_get (adsp->dev,"xo" ); -if (IS_ERR (adsp->xo)) { - ret =PTR_ERR (adsp->xo); -if (ret != -EPROBE_DEFER ) -dev_err (adsp->dev,"failed to get xo clock" ); -return ret; - } +if (IS_ERR (adsp->xo)) +return probe_err (adsp->dev,PTR_ERR (adsp->xo), +"failed to get xo clock" );if (adsp->has_aggre2_clk) { adsp->aggre2_clk =devm_clk_get (adsp->dev,"aggre2" ); -if (IS_ERR (adsp->aggre2_clk)) { - ret =PTR_ERR (adsp->aggre2_clk); -if (ret != -EPROBE_DEFER ) -dev_err (adsp->dev, -"failed to get aggre2 clock" ); -return ret; - } +if (IS_ERR (adsp->aggre2_clk)) +return probe_err (adsp->dev,PTR_ERR (adsp->aggre2_clk), +"failed to get aggre2 clock" ); }return 0 ;
drivers/remoteproc/qcom_wcnss_iris.c +3 -5
@@ -117,11 +117,9 @@ static int qcom_iris_probe(struct platform_device *pdev) wcnss =dev_get_drvdata (pdev->dev.parent); iris->xo_clk =devm_clk_get (&pdev->dev,"xo" ); -if (IS_ERR (iris->xo_clk)) { -if (PTR_ERR (iris->xo_clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to acquire xo clk\n" ); -return PTR_ERR (iris->xo_clk); - } +if (IS_ERR (iris->xo_clk)) +return probe_err (&pdev->dev,PTR_ERR (iris->xo_clk), +"failed to acquire xo clk\n" ); iris->num_vregs = data->num_vregs; iris->vregs = devm_kcalloc(&pdev->dev,
drivers/reset/reset-meson-audio-arb.c +3 -5
@@ -114,11 +114,9 @@ static int meson_audio_arb_probe(struct platform_device *pdev)platform_set_drvdata (pdev, arb); arb->clk =devm_clk_get (dev,NULL ); -if (IS_ERR (arb->clk)) { -if (PTR_ERR (arb->clk) != -EPROBE_DEFER ) -dev_err (dev,"failed to get clock\n" ); -return PTR_ERR (arb->clk); - } +if (IS_ERR (arb->clk)) +return probe_err (dev,PTR_ERR (arb->clk), +"failed to get clock\n" ); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); arb->regs =devm_ioremap_resource (dev, res);
drivers/rtc/rtc-rk808.c +4 -6
@@ -412,12 +412,10 @@ static int rk808_rtc_probe(struct platform_device *pdev) rk808_rtc->rtc->ops = &rk808_rtc_ops; rk808_rtc->irq =platform_get_irq (pdev,0 ); -if (rk808_rtc->irq <0 ) { -if (rk808_rtc->irq != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Wake up is not possible as irq = %d\n" , - rk808_rtc->irq); -return rk808_rtc->irq; - } +if (rk808_rtc->irq <0 ) +return probe_err (&pdev->dev, rk808_rtc->irq, +"Wake up is not possible as irq = %d\n" , + rk808_rtc->irq);/* request alarm irq of rk808 */ ret = devm_request_threaded_irq(&pdev->dev, rk808_rtc->irq, NULL,
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +2 -5
@@ -3612,11 +3612,8 @@ static int hisi_sas_v2_probe(struct platform_device *pdev)*/ int ret =platform_get_irq (pdev,0 ); -if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"cannot obtain irq\n" ); -return ret; - } +if (ret <0 ) +return probe_err (&pdev->dev, ret,"cannot obtain irq\n" );return hisi_sas_probe (pdev, &hisi_sas_v2_hw); }
drivers/soc/amlogic/meson-gx-pwrc-vpu.c +3 -5
@@ -183,11 +183,9 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev) } rstc =devm_reset_control_array_get (&pdev->dev, false, false); -if (IS_ERR (rstc)) { -if (PTR_ERR (rstc) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to get reset lines\n" ); -return PTR_ERR (rstc); - } +if (IS_ERR (rstc)) +return probe_err (&pdev->dev,PTR_ERR (rstc), +"failed to get reset lines\n" ); vpu_clk =devm_clk_get (&pdev->dev,"vpu" );if (IS_ERR (vpu_clk)) {
drivers/soc/imx/gpcv2.c +4 -5
@@ -212,11 +212,10 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) domain->regulator =devm_regulator_get_optional (domain->dev,"power" );if (IS_ERR (domain->regulator)) { -if (PTR_ERR (domain->regulator) != -ENODEV ) { -if (PTR_ERR (domain->regulator) != -EPROBE_DEFER ) -dev_err (domain->dev,"Failed to get domain's regulator\n" ); -return PTR_ERR (domain->regulator); - } +if (PTR_ERR (domain->regulator) != -ENODEV ) +return probe_err (domain->dev, +PTR_ERR (domain->regulator), +"Failed to get domain's regulator\n" ); }else {regulator_set_voltage (domain->regulator, domain->voltage, domain->voltage);
drivers/soc/lantiq/gphy.c +3 -5
@@ -123,11 +123,9 @@ static int xway_gphy_of_probe(struct platform_device *pdev,return PTR_ERR (priv->membase); priv->gphy_reset =devm_reset_control_get (dev,"gphy" ); -if (IS_ERR (priv->gphy_reset)) { -if (PTR_ERR (priv->gphy_reset) != -EPROBE_DEFER ) -dev_err (dev,"Failed to lookup gphy reset\n" ); -return PTR_ERR (priv->gphy_reset); - } +if (IS_ERR (priv->gphy_reset)) +return probe_err (dev,PTR_ERR (priv->gphy_reset), +"Failed to lookup gphy reset\n" ); priv->gphy_reset2 =devm_reset_control_get_optional (dev,"gphy2" );if (IS_ERR (priv->gphy_reset2))
drivers/soc/qcom/rpmh-rsc.c +3 -6
@@ -627,12 +627,9 @@ static int rpmh_rsc_probe(struct platform_device *pdev)* do. To avoid adding this check to our children we'll do it now. */ ret =cmd_db_ready (); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Command DB not available (%d)\n" , - ret); -return ret; - } +if (ret) +return probe_err (&pdev->dev, ret, +"Command DB not available (%d)\n" , ret); drv =devm_kzalloc (&pdev->dev,sizeof (*drv),GFP_KERNEL );if (!drv)
drivers/soc/qcom/smem.c +3 -5
@@ -959,11 +959,9 @@ static int qcom_smem_probe(struct platform_device *pdev)return ret; hwlock_id =of_hwspin_lock_get_id (pdev->dev.of_node,0 ); -if (hwlock_id <0 ) { -if (hwlock_id != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to retrieve hwlock\n" ); -return hwlock_id; - } +if (hwlock_id <0 ) +return probe_err (&pdev->dev, hwlock_id, +"failed to retrieve hwlock\n" ); smem->hwlock =hwspin_lock_request_specific (hwlock_id);if (!smem->hwlock)
drivers/soc/qcom/smp2p.c +3 -6
@@ -379,12 +379,9 @@ static int qcom_smp2p_alloc_outbound_item(struct qcom_smp2p *smp2p)int ret; ret =qcom_smem_alloc (pid, smem_id,sizeof (*out)); -if (ret <0 && ret != -EEXIST ) { -if (ret != -EPROBE_DEFER ) -dev_err (smp2p->dev, -"unable to allocate local smp2p item\n" ); -return ret; - } +if (ret <0 && ret != -EEXIST ) +return probe_err (smp2p->dev, ret, +"unable to allocate local smp2p item\n" ); out =qcom_smem_get (pid, smem_id,NULL );if (IS_ERR (out)) {
drivers/spi/spi-tegra114.c +2 -4
@@ -588,10 +588,8 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi, dma_to_memory ? "rx" : "tx");if (IS_ERR (dma_chan)) { ret =PTR_ERR (dma_chan); -if (ret != -EPROBE_DEFER ) -dev_err (tspi->dev, -"Dma channel is not available: %d\n" , ret); -return ret; +return probe_err (tspi->dev, ret, +"Dma channel is not available: %d\n" , ret); } dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size,
drivers/spi/spi-tegra20-slink.c +2 -4
@@ -614,10 +614,8 @@ static int tegra_slink_init_dma_param(struct tegra_slink_data *tspi, dma_to_memory ? "rx" : "tx");if (IS_ERR (dma_chan)) { ret =PTR_ERR (dma_chan); -if (ret != -EPROBE_DEFER ) -dev_err (tspi->dev, -"Dma channel is not available: %d\n" , ret); -return ret; +return probe_err (tspi->dev, ret, +"Dma channel is not available: %d\n" , ret); } dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size,
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +6 -10
@@ -158,18 +158,14 @@ static int clk_wzrd_probe(struct platform_device *pdev) } clk_wzrd->clk_in1 =devm_clk_get (&pdev->dev,"clk_in1" ); -if (IS_ERR (clk_wzrd->clk_in1)) { -if (clk_wzrd->clk_in1 !=ERR_PTR (-EPROBE_DEFER )) -dev_err (&pdev->dev,"clk_in1 not found\n" ); -return PTR_ERR (clk_wzrd->clk_in1); - } +if (IS_ERR (clk_wzrd->clk_in1)) +return probe_err (&pdev->dev,PTR_ERR (clk_wzrd->clk_in1), +"clk_in1 not found\n" ); clk_wzrd->axi_clk =devm_clk_get (&pdev->dev,"s_axi_aclk" ); -if (IS_ERR (clk_wzrd->axi_clk)) { -if (clk_wzrd->axi_clk !=ERR_PTR (-EPROBE_DEFER )) -dev_err (&pdev->dev,"s_axi_aclk not found\n" ); -return PTR_ERR (clk_wzrd->axi_clk); - } +if (IS_ERR (clk_wzrd->axi_clk)) +return probe_err (&pdev->dev,PTR_ERR (clk_wzrd->axi_clk), +"s_axi_aclk not found\n" ); ret =clk_prepare_enable (clk_wzrd->axi_clk);if (ret) {dev_err (&pdev->dev,"enabling s_axi_aclk failed\n" );
drivers/thermal/broadcom/bcm2835_thermal.c +2 -3
@@ -201,9 +201,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) data->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (data->clk)) { err =PTR_ERR (data->clk); -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Could not get clk: %d\n" , err); -return err; +return probe_err (&pdev->dev, err,"Could not get clk: %d\n" , + err); } err =clk_prepare_enable (data->clk);
drivers/thermal/hisi_thermal.c +2 -3
@@ -389,9 +389,8 @@ static int hi6220_thermal_probe(struct hisi_thermal_data *data) data->clk =devm_clk_get (dev,"thermal_clk" );if (IS_ERR (data->clk)) { ret =PTR_ERR (data->clk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get thermal clk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get thermal clk: %d\n" , + ret); } data->irq =platform_get_irq (pdev,0 );
drivers/tty/serial/8250/8250_dw.c +2 -5
@@ -506,11 +506,8 @@ static int dw8250_probe(struct platform_device *pdev)return -EINVAL ; } -if (irq <0 ) { -if (irq != -EPROBE_DEFER ) -dev_err (dev,"cannot get irq\n" ); -return irq; - } +if (irq <0 ) +return probe_err (dev, irq,"cannot get irq\n" );spin_lock_init (&p->lock); p->mapbase = regs->start;
drivers/tty/serial/8250/8250_ingenic.c +4 -8
@@ -258,19 +258,15 @@ static int ingenic_uart_probe(struct platform_device *pdev) data->clk_module =devm_clk_get (&pdev->dev,"module" );if (IS_ERR (data->clk_module)) { err =PTR_ERR (data->clk_module); -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"unable to get module clock: %d\n" , err); -return err; +return probe_err (&pdev->dev, err, +"unable to get module clock: %d\n" , err); } data->clk_baud =devm_clk_get (&pdev->dev,"baud" );if (IS_ERR (data->clk_baud)) { err =PTR_ERR (data->clk_baud); -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"unable to get baud clock: %d\n" , err); -return err; +return probe_err (&pdev->dev, err, +"unable to get baud clock: %d\n" , err); } err =clk_prepare_enable (data->clk_module);
drivers/tty/serial/amba-pl011.c +2 -5
@@ -2718,11 +2718,8 @@ static int sbsa_uart_probe(struct platform_device *pdev)return -ENOMEM ; ret =platform_get_irq (pdev,0 ); -if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"cannot obtain irq\n" ); -return ret; - } +if (ret <0 ) +return probe_err (&pdev->dev, ret,"cannot obtain irq\n" ); uap->port.irq = ret;#ifdef CONFIG_ACPI_SPCR_TABLE
drivers/usb/chipidea/ci_hdrc_imx.c +2 -3
@@ -314,9 +314,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) &pdata);if (IS_ERR (data->ci_pdev)) { ret =PTR_ERR (data->ci_pdev); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"ci_hdrc_add_device failed, err=%d\n" , ret); +probe_err (&pdev->dev, ret, +"ci_hdrc_add_device failed, err=%d\n" , ret); goto err_clk; }
drivers/usb/chipidea/ci_hdrc_msm.c +1 -2
@@ -259,8 +259,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) pdev->num_resources, &ci->pdata);if (IS_ERR (plat_ci)) { ret =PTR_ERR (plat_ci); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"ci_hdrc_add_device failed!\n" ); +probe_err (&pdev->dev, ret,"ci_hdrc_add_device failed!\n" ); goto err_mux; }
drivers/usb/chipidea/ci_hdrc_usb2.c +3 -4
@@ -79,10 +79,9 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) pdev->num_resources, ci_pdata);if (IS_ERR (priv->ci_pdev)) { ret =PTR_ERR (priv->ci_pdev); -if (ret != -EPROBE_DEFER ) -dev_err (dev, -"failed to register ci_hdrc platform device: %d\n" , - ret); +probe_err (dev, ret, +"failed to register ci_hdrc platform device: %d\n" , + ret); goto clk_err; }
drivers/usb/dwc3/core.c +9 -15
@@ -1145,11 +1145,9 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)phy_set_mode (dwc->usb3_generic_phy,PHY_MODE_USB_DEVICE ); ret =dwc3_gadget_init (dwc); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to initialize gadget\n" ); -return ret; - } +if (ret) +return probe_err (dev, ret, +"failed to initialize gadget\n" );break ;case USB_DR_MODE_HOST :dwc3_set_prtcap (dwc,DWC3_GCTL_PRTCAP_HOST );
@@ -1160,21 +1158,17 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)phy_set_mode (dwc->usb3_generic_phy,PHY_MODE_USB_HOST ); ret =dwc3_host_init (dwc); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to initialize host\n" ); -return ret; - } +if (ret) +return probe_err (dev, ret, +"failed to initialize host\n" );phy_calibrate (dwc->usb2_generic_phy);break ;case USB_DR_MODE_OTG :INIT_WORK (&dwc->drd_work, __dwc3_set_mode); ret =dwc3_drd_init (dwc); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to initialize dual-role\n" ); -return ret; - } +if (ret) +return probe_err (dev, ret, +"failed to initialize dual-role\n" );break ;default :dev_err (dev,"Unsupported mode of operation %d\n" , dwc->dr_mode);
drivers/usb/host/ehci-mv.c +1 -2
@@ -119,8 +119,7 @@ static int mv_ehci_probe(struct platform_device *pdev) ehci_mv->phy =devm_phy_get (&pdev->dev,"usb" );if (IS_ERR (ehci_mv->phy)) { retval =PTR_ERR (ehci_mv->phy); -if (retval != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get phy.\n" ); +probe_err (&pdev->dev, retval,"Failed to get phy.\n" ); goto err_put_hcd; }
drivers/usb/host/ehci-omap.c +2 -3
@@ -164,9 +164,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)continue ; ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Can't get PHY for port %d: %d\n" , - i, ret); +probe_err (dev, ret,"Can't get PHY for port %d: %d\n" , + i, ret); goto err_phy; }
drivers/usb/host/ohci-da8xx.c +2 -4
@@ -416,16 +416,14 @@ static int ohci_da8xx_probe(struct platform_device *pdev) da8xx_ohci->usb11_clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (da8xx_ohci->usb11_clk)) { error =PTR_ERR (da8xx_ohci->usb11_clk); -if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get clock.\n" ); +probe_err (&pdev->dev, error,"Failed to get clock.\n" ); goto err; } da8xx_ohci->usb11_phy =devm_phy_get (&pdev->dev,"usb-phy" );if (IS_ERR (da8xx_ohci->usb11_phy)) { error =PTR_ERR (da8xx_ohci->usb11_phy); -if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get phy.\n" ); +probe_err (&pdev->dev, error,"Failed to get phy.\n" ); goto err; }
drivers/usb/musb/da8xx.c +3 -5
@@ -524,11 +524,9 @@ static int da8xx_probe(struct platform_device *pdev) } glue->phy =devm_phy_get (&pdev->dev,"usb-phy" ); -if (IS_ERR (glue->phy)) { -if (PTR_ERR (glue->phy) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to get phy\n" ); -return PTR_ERR (glue->phy); - } +if (IS_ERR (glue->phy)) +return probe_err (&pdev->dev,PTR_ERR (glue->phy), +"failed to get phy\n" ); glue->dev = &pdev->dev; glue->clk = clk;
drivers/usb/musb/musb_cppi41.c +2 -3
@@ -719,9 +719,8 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) dc =dma_request_chan (dev->parent, str);if (IS_ERR (dc)) { ret =PTR_ERR (dc); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request %s: %d.\n" , - str, ret); +probe_err (dev, ret,"Failed to request %s: %d.\n" , + str, ret); goto err; }
drivers/usb/typec/tcpm/fusb302.c +1 -2
@@ -1793,8 +1793,7 @@ static int fusb302_probe(struct i2c_client *client, chip->tcpm_port =tcpm_register_port (&client->dev, &chip->tcpc_dev);if (IS_ERR (chip->tcpm_port)) { ret =PTR_ERR (chip->tcpm_port); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"cannot register tcpm port, ret=%d" , ret); +probe_err (dev, ret,"cannot register tcpm port, ret=%d" , ret); goto destroy_workqueue; }
drivers/video/backlight/gpio_backlight.c +3 -9
@@ -69,15 +69,9 @@ static int gpio_backlight_probe_dt(struct platform_device *pdev, flags = gbl->def_value ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW ; gbl->gpiod =devm_gpiod_get (dev,NULL , flags); -if (IS_ERR (gbl->gpiod)) { - ret =PTR_ERR (gbl->gpiod); - -if (ret != -EPROBE_DEFER ) { -dev_err (dev, -"Error: The gpios parameter is missing or invalid.\n" ); - } -return ret; - } +if (IS_ERR (gbl->gpiod)) +return probe_err (dev,PTR_ERR (gbl->gpiod), +"Error: The gpios parameter is missing or invalid.\n" );return 0 ; }
drivers/video/backlight/pwm_bl.c +1 -2
@@ -536,8 +536,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)if (IS_ERR (pb->pwm)) { ret =PTR_ERR (pb->pwm); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"unable to request PWM\n" ); +probe_err (&pdev->dev, ret,"unable to request PWM\n" ); goto err_alloc; }
drivers/watchdog/davinci_wdt.c +3 -5
@@ -205,11 +205,9 @@ static int davinci_wdt_probe(struct platform_device *pdev) davinci_wdt->clk =devm_clk_get (dev,NULL ); -if (IS_ERR (davinci_wdt->clk)) { -if (PTR_ERR (davinci_wdt->clk) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to get clock node\n" ); -return PTR_ERR (davinci_wdt->clk); - } +if (IS_ERR (davinci_wdt->clk)) +return probe_err (&pdev->dev,PTR_ERR (davinci_wdt->clk), +"failed to get clock node\n" ); ret =clk_prepare_enable (davinci_wdt->clk);if (ret) {
sound/soc/atmel/tse850-pcm5142.c +12 -20
@@ -366,35 +366,27 @@ static int tse850_probe(struct platform_device *pdev) } tse850->add =devm_gpiod_get (dev,"axentia,add" ,GPIOD_OUT_HIGH ); -if (IS_ERR (tse850->add)) { -if (PTR_ERR (tse850->add) != -EPROBE_DEFER ) -dev_err (dev,"failed to get 'add' gpio\n" ); -return PTR_ERR (tse850->add); - } +if (IS_ERR (tse850->add)) +return probe_err (dev,PTR_ERR (tse850->add), +"failed to get 'add' gpio\n" ); tse850->add_cache =1 ; tse850->loop1 =devm_gpiod_get (dev,"axentia,loop1" ,GPIOD_OUT_HIGH ); -if (IS_ERR (tse850->loop1)) { -if (PTR_ERR (tse850->loop1) != -EPROBE_DEFER ) -dev_err (dev,"failed to get 'loop1' gpio\n" ); -return PTR_ERR (tse850->loop1); - } +if (IS_ERR (tse850->loop1)) +return probe_err (dev,PTR_ERR (tse850->loop1), +"failed to get 'loop1' gpio\n" ); tse850->loop1_cache =1 ; tse850->loop2 =devm_gpiod_get (dev,"axentia,loop2" ,GPIOD_OUT_HIGH ); -if (IS_ERR (tse850->loop2)) { -if (PTR_ERR (tse850->loop2) != -EPROBE_DEFER ) -dev_err (dev,"failed to get 'loop2' gpio\n" ); -return PTR_ERR (tse850->loop2); - } +if (IS_ERR (tse850->loop2)) +return probe_err (dev,PTR_ERR (tse850->loop2), +"failed to get 'loop2' gpio\n" ); tse850->loop2_cache =1 ; tse850->ana =devm_regulator_get (dev,"axentia,ana" ); -if (IS_ERR (tse850->ana)) { -if (PTR_ERR (tse850->ana) != -EPROBE_DEFER ) -dev_err (dev,"failed to get 'ana' regulator\n" ); -return PTR_ERR (tse850->ana); - } +if (IS_ERR (tse850->ana)) +return probe_err (dev,PTR_ERR (tse850->ana), +"failed to get 'ana' regulator\n" ); ret =regulator_enable (tse850->ana);if (ret <0 ) {
sound/soc/codecs/es7241.c +4 -9
@@ -273,25 +273,20 @@ static int es7241_probe(struct platform_device *pdev) priv->reset =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (priv->reset)) { err =PTR_ERR (priv->reset); -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'reset' gpio: %d" , err); -return err; +return probe_err (dev, err,"Failed to get 'reset' gpio: %d" , + err); } priv->m0 =devm_gpiod_get_optional (dev,"m0" ,GPIOD_OUT_LOW );if (IS_ERR (priv->m0)) { err =PTR_ERR (priv->m0); -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'm0' gpio: %d" , err); -return err; +return probe_err (dev, err,"Failed to get 'm0' gpio: %d" , err); } priv->m1 =devm_gpiod_get_optional (dev,"m1" ,GPIOD_OUT_LOW );if (IS_ERR (priv->m1)) { err =PTR_ERR (priv->m1); -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'm1' gpio: %d" , err); -return err; +return probe_err (dev, err,"Failed to get 'm1' gpio: %d" , err); } return devm_snd_soc_register_component(&pdev->dev,
sound/soc/codecs/max9759.c +6 -9
@@ -151,26 +151,23 @@ static int max9759_probe(struct platform_device *pdev) priv->gpiod_shutdown =devm_gpiod_get (dev,"shutdown" ,GPIOD_OUT_HIGH );if (IS_ERR (priv->gpiod_shutdown)) { err =PTR_ERR (priv->gpiod_shutdown); -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'shutdown' gpio: %d" , err); -return err; +return probe_err (dev, err, +"Failed to get 'shutdown' gpio: %d" , err); } priv->gpiod_mute =devm_gpiod_get (dev,"mute" ,GPIOD_OUT_HIGH );if (IS_ERR (priv->gpiod_mute)) { err =PTR_ERR (priv->gpiod_mute); -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'mute' gpio: %d" , err); -return err; +return probe_err (dev, err,"Failed to get 'mute' gpio: %d" , + err); } priv->is_mute = true; priv->gpiod_gain =devm_gpiod_get_array (dev,"gain" ,GPIOD_OUT_HIGH );if (IS_ERR (priv->gpiod_gain)) { err =PTR_ERR (priv->gpiod_gain); -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'gain' gpios: %d" , err); -return err; +return probe_err (dev, err,"Failed to get 'gain' gpios: %d" , + err); } priv->gain =0 ;
sound/soc/codecs/max9860.c +3 -5
@@ -608,9 +608,8 @@ static int max9860_probe(struct i2c_client *i2c) max9860->dvddio =devm_regulator_get (dev,"DVDDIO" );if (IS_ERR (max9860->dvddio)) { ret =PTR_ERR (max9860->dvddio); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get DVDDIO supply: %d\n" , ret); -return ret; +return probe_err (dev, ret, +"Failed to get DVDDIO supply: %d\n" , ret); } max9860->dvddio_nb.notifier_call = max9860_dvddio_event;
@@ -642,8 +641,7 @@ static int max9860_probe(struct i2c_client *i2c)if (IS_ERR (mclk)) { ret =PTR_ERR (mclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to get MCLK: %d\n" , ret); +probe_err (dev, ret,"Failed to get MCLK: %d\n" , ret); goto err_regulator; }
sound/soc/codecs/pcm3168a.c +3 -5
@@ -621,9 +621,8 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) pcm3168a->scki =devm_clk_get (dev,"scki" );if (IS_ERR (pcm3168a->scki)) { ret =PTR_ERR (pcm3168a->scki); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to acquire clock 'scki': %d\n" , ret); -return ret; +return probe_err (dev, ret, +"failed to acquire clock 'scki': %d\n" , ret); } ret =clk_prepare_enable (pcm3168a->scki);
@@ -640,8 +639,7 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) ret =devm_regulator_bulk_get (dev,ARRAY_SIZE (pcm3168a->supplies), pcm3168a->supplies);if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to request supplies: %d\n" , ret); +probe_err (dev, ret,"failed to request supplies: %d\n" , ret); goto err_clk; }
sound/soc/codecs/sgtl5000.c +2 -3
@@ -1422,9 +1422,8 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,if (ret == -ENOENT ) ret = -EPROBE_DEFER ; -if (ret != -EPROBE_DEFER ) -dev_err (&client->dev,"Failed to get mclock: %d\n" , - ret); +probe_err (&client->dev, ret,"Failed to get mclock: %d\n" , + ret); goto disable_regs; }
sound/soc/codecs/simple-amplifier.c +2 -3
@@ -88,9 +88,8 @@ static int simple_amp_probe(struct platform_device *pdev) priv->gpiod_enable =devm_gpiod_get (dev,"enable" ,GPIOD_OUT_LOW );if (IS_ERR (priv->gpiod_enable)) { err =PTR_ERR (priv->gpiod_enable); -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'enable' gpio: %d" , err); -return err; +return probe_err (dev, err,"Failed to get 'enable' gpio: %d" , + err); } return devm_snd_soc_register_component(dev,
sound/soc/codecs/ssm2305.c +2 -4
@@ -71,10 +71,8 @@ static int ssm2305_probe(struct platform_device *pdev) GPIOD_OUT_LOW);if (IS_ERR (priv->gpiod_shutdown)) { err =PTR_ERR (priv->gpiod_shutdown); -if (err != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'shutdown' gpio: %d\n" , - err); -return err; +return probe_err (dev, err, +"Failed to get 'shutdown' gpio: %d\n" , err); } return devm_snd_soc_register_component(dev, &ssm2305_component_driver,
sound/soc/davinci/davinci-mcasp.c +4 -7
@@ -1762,13 +1762,10 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp) tmp = mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK ].filter_data; chan =dma_request_slave_channel_reason (mcasp->dev, tmp); -if (IS_ERR (chan)) { -if (PTR_ERR (chan) != -EPROBE_DEFER ) -dev_err (mcasp->dev, -"Can't verify DMA configuration (%ld)\n" , -PTR_ERR (chan)); -return PTR_ERR (chan); - } +if (IS_ERR (chan)) +return probe_err (mcasp->dev,PTR_ERR (chan), +"Can't verify DMA configuration (%ld)\n" , +PTR_ERR (chan));if (WARN_ON (!chan->device || !chan->device->dev))return -EINVAL ;
sound/soc/generic/audio-graph-card.c +1 -2
@@ -352,8 +352,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev) ret =asoc_graph_card_parse_of (priv);if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"parse error %d\n" , ret); +probe_err (dev, ret,"parse error %d\n" , ret); goto err; }
sound/soc/generic/audio-graph-scu-card.c +1 -2
@@ -383,8 +383,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev) ret =asoc_graph_card_parse_of (priv);if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"parse error %d\n" , ret); +probe_err (dev, ret,"parse error %d\n" , ret); goto err; }
sound/soc/generic/simple-card.c +1 -2
@@ -410,8 +410,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) ret =asoc_simple_card_parse_of (priv);if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"parse error %d\n" , ret); +probe_err (dev, ret,"parse error %d\n" , ret); goto err; }
sound/soc/generic/simple-scu-card.c +1 -2
@@ -280,8 +280,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) ret =asoc_simple_card_parse_of (priv);if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"parse error %d\n" , ret); +probe_err (dev, ret,"parse error %d\n" , ret); goto err; }
sound/soc/img/img-i2s-in.c +3 -5
@@ -453,11 +453,9 @@ static int img_i2s_in_probe(struct platform_device *pdev) i2s->channel_base = base + (max_i2s_chan_pow_2 *0x20 ); i2s->clk_sys =devm_clk_get (dev,"sys" ); -if (IS_ERR (i2s->clk_sys)) { -if (PTR_ERR (i2s->clk_sys) != -EPROBE_DEFER ) -dev_err (dev,"Failed to acquire clock 'sys'\n" ); -return PTR_ERR (i2s->clk_sys); - } +if (IS_ERR (i2s->clk_sys)) +return probe_err (dev,PTR_ERR (i2s->clk_sys), +"Failed to acquire clock 'sys'\n" );pm_runtime_enable (&pdev->dev);if (!pm_runtime_enabled (&pdev->dev)) {
sound/soc/img/img-i2s-out.c +9 -15
@@ -459,25 +459,19 @@ static int img_i2s_out_probe(struct platform_device *pdev) i2s->channel_base = base + (max_i2s_chan_pow_2 *0x20 ); i2s->rst =devm_reset_control_get_exclusive (&pdev->dev,"rst" ); -if (IS_ERR (i2s->rst)) { -if (PTR_ERR (i2s->rst) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"No top level reset found\n" ); -return PTR_ERR (i2s->rst); - } +if (IS_ERR (i2s->rst)) +return probe_err (&pdev->dev,PTR_ERR (i2s->rst), +"No top level reset found\n" ); i2s->clk_sys =devm_clk_get (&pdev->dev,"sys" ); -if (IS_ERR (i2s->clk_sys)) { -if (PTR_ERR (i2s->clk_sys) != -EPROBE_DEFER ) -dev_err (dev,"Failed to acquire clock 'sys'\n" ); -return PTR_ERR (i2s->clk_sys); - } +if (IS_ERR (i2s->clk_sys)) +return probe_err (dev,PTR_ERR (i2s->clk_sys), +"Failed to acquire clock 'sys'\n" ); i2s->clk_ref =devm_clk_get (&pdev->dev,"ref" ); -if (IS_ERR (i2s->clk_ref)) { -if (PTR_ERR (i2s->clk_ref) != -EPROBE_DEFER ) -dev_err (dev,"Failed to acquire clock 'ref'\n" ); -return PTR_ERR (i2s->clk_ref); - } +if (IS_ERR (i2s->clk_ref)) +return probe_err (dev,PTR_ERR (i2s->clk_ref), +"Failed to acquire clock 'ref'\n" ); i2s->suspend_ch_ctl =devm_kcalloc (dev, i2s->max_i2s_chan,sizeof (*i2s->suspend_ch_ctl),GFP_KERNEL );
sound/soc/img/img-parallel-out.c +9 -15
@@ -231,25 +231,19 @@ static int img_prl_out_probe(struct platform_device *pdev) prl->base = base; prl->rst =devm_reset_control_get_exclusive (&pdev->dev,"rst" ); -if (IS_ERR (prl->rst)) { -if (PTR_ERR (prl->rst) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"No top level reset found\n" ); -return PTR_ERR (prl->rst); - } +if (IS_ERR (prl->rst)) +return probe_err (&pdev->dev,PTR_ERR (prl->rst), +"No top level reset found\n" ); prl->clk_sys =devm_clk_get (&pdev->dev,"sys" ); -if (IS_ERR (prl->clk_sys)) { -if (PTR_ERR (prl->clk_sys) != -EPROBE_DEFER ) -dev_err (dev,"Failed to acquire clock 'sys'\n" ); -return PTR_ERR (prl->clk_sys); - } +if (IS_ERR (prl->clk_sys)) +return probe_err (dev,PTR_ERR (prl->clk_sys), +"Failed to acquire clock 'sys'\n" ); prl->clk_ref =devm_clk_get (&pdev->dev,"ref" ); -if (IS_ERR (prl->clk_ref)) { -if (PTR_ERR (prl->clk_ref) != -EPROBE_DEFER ) -dev_err (dev,"Failed to acquire clock 'ref'\n" ); -return PTR_ERR (prl->clk_ref); - } +if (IS_ERR (prl->clk_ref)) +return probe_err (dev,PTR_ERR (prl->clk_ref), +"Failed to acquire clock 'ref'\n" ); ret =clk_prepare_enable (prl->clk_sys);if (ret)
sound/soc/img/img-spdif-in.c +3 -5
@@ -743,11 +743,9 @@ static int img_spdif_in_probe(struct platform_device *pdev) spdif->base = base; spdif->clk_sys =devm_clk_get (dev,"sys" ); -if (IS_ERR (spdif->clk_sys)) { -if (PTR_ERR (spdif->clk_sys) != -EPROBE_DEFER ) -dev_err (dev,"Failed to acquire clock 'sys'\n" ); -return PTR_ERR (spdif->clk_sys); - } +if (IS_ERR (spdif->clk_sys)) +return probe_err (dev,PTR_ERR (spdif->clk_sys), +"Failed to acquire clock 'sys'\n" );pm_runtime_enable (&pdev->dev);if (!pm_runtime_enabled (&pdev->dev)) {
sound/soc/img/img-spdif-out.c +9 -15
@@ -346,25 +346,19 @@ static int img_spdif_out_probe(struct platform_device *pdev) spdif->base = base; spdif->rst =devm_reset_control_get_exclusive (&pdev->dev,"rst" ); -if (IS_ERR (spdif->rst)) { -if (PTR_ERR (spdif->rst) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"No top level reset found\n" ); -return PTR_ERR (spdif->rst); - } +if (IS_ERR (spdif->rst)) +return probe_err (&pdev->dev,PTR_ERR (spdif->rst), +"No top level reset found\n" ); spdif->clk_sys =devm_clk_get (&pdev->dev,"sys" ); -if (IS_ERR (spdif->clk_sys)) { -if (PTR_ERR (spdif->clk_sys) != -EPROBE_DEFER ) -dev_err (dev,"Failed to acquire clock 'sys'\n" ); -return PTR_ERR (spdif->clk_sys); - } +if (IS_ERR (spdif->clk_sys)) +return probe_err (dev,PTR_ERR (spdif->clk_sys), +"Failed to acquire clock 'sys'\n" ); spdif->clk_ref =devm_clk_get (&pdev->dev,"ref" ); -if (IS_ERR (spdif->clk_ref)) { -if (PTR_ERR (spdif->clk_ref) != -EPROBE_DEFER ) -dev_err (dev,"Failed to acquire clock 'ref'\n" ); -return PTR_ERR (spdif->clk_ref); - } +if (IS_ERR (spdif->clk_ref)) +return probe_err (dev,PTR_ERR (spdif->clk_ref), +"Failed to acquire clock 'ref'\n" );pm_runtime_enable (&pdev->dev);if (!pm_runtime_enabled (&pdev->dev)) {
sound/soc/img/pistachio-internal-dac.c +3 -3
@@ -166,9 +166,9 @@ static int pistachio_internal_dac_probe(struct platform_device *pdev) dac->supply =devm_regulator_get (dev,"VDD" );if (IS_ERR (dac->supply)) { ret =PTR_ERR (dac->supply); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to acquire supply 'VDD-supply': %d\n" , ret); -return ret; +return probe_err (dev, ret, +"failed to acquire supply 'VDD-supply': %d\n" , + ret); } ret =regulator_enable (dac->supply);
sound/soc/meson/axg-card.c +2 -5
@@ -68,11 +68,8 @@ static int axg_card_parse_dai(struct snd_soc_card *card, ret =of_parse_phandle_with_args (node,"sound-dai" ,"#sound-dai-cells" ,0 , &args); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (card->dev,"can't parse dai %d\n" , ret); -return ret; - } +if (ret) +return probe_err (card->dev, ret,"can't parse dai %d\n" , ret); *dai_of_node = args.np;return snd_soc_get_dai_name (&args, dai_name);
sound/soc/meson/axg-fifo.c +8 -12
@@ -312,20 +312,16 @@ int axg_fifo_probe(struct platform_device *pdev) } fifo->pclk =devm_clk_get (dev,NULL ); -if (IS_ERR (fifo->pclk)) { -if (PTR_ERR (fifo->pclk) != -EPROBE_DEFER ) -dev_err (dev,"failed to get pclk: %ld\n" , -PTR_ERR (fifo->pclk)); -return PTR_ERR (fifo->pclk); - } +if (IS_ERR (fifo->pclk)) +return probe_err (dev,PTR_ERR (fifo->pclk), +"failed to get pclk: %ld\n" , +PTR_ERR (fifo->pclk)); fifo->arb =devm_reset_control_get_exclusive (dev,NULL ); -if (IS_ERR (fifo->arb)) { -if (PTR_ERR (fifo->arb) != -EPROBE_DEFER ) -dev_err (dev,"failed to get arb reset: %ld\n" , -PTR_ERR (fifo->arb)); -return PTR_ERR (fifo->arb); - } +if (IS_ERR (fifo->arb)) +return probe_err (dev,PTR_ERR (fifo->arb), +"failed to get arb reset: %ld\n" , +PTR_ERR (fifo->arb)); fifo->irq =of_irq_get (dev->of_node,0 );if (fifo->irq <=0 ) {
sound/soc/meson/axg-pdm.c +3 -9
@@ -615,25 +615,19 @@ static int axg_pdm_probe(struct platform_device *pdev) priv->pclk =devm_clk_get (dev,"pclk" );if (IS_ERR (priv->pclk)) { ret =PTR_ERR (priv->pclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get pclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get pclk: %d\n" , ret); } priv->dclk =devm_clk_get (dev,"dclk" );if (IS_ERR (priv->dclk)) { ret =PTR_ERR (priv->dclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get dclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get dclk: %d\n" , ret); } priv->sysclk =devm_clk_get (dev,"sysclk" );if (IS_ERR (priv->sysclk)) { ret =PTR_ERR (priv->sysclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get dclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get dclk: %d\n" , ret); } return devm_snd_soc_register_component(dev, &axg_pdm_component_drv,
sound/soc/meson/axg-spdifout.c +2 -6
@@ -425,17 +425,13 @@ static int axg_spdifout_probe(struct platform_device *pdev) priv->pclk =devm_clk_get (dev,"pclk" );if (IS_ERR (priv->pclk)) { ret =PTR_ERR (priv->pclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get pclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get pclk: %d\n" , ret); } priv->mclk =devm_clk_get (dev,"mclk" );if (IS_ERR (priv->mclk)) { ret =PTR_ERR (priv->mclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get mclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get mclk: %d\n" , ret); } return devm_snd_soc_register_component(dev, &axg_spdifout_component_drv,
sound/soc/meson/axg-tdm-formatter.c +7 -15
@@ -263,45 +263,37 @@ int axg_tdm_formatter_probe(struct platform_device *pdev) formatter->pclk =devm_clk_get (dev,"pclk" );if (IS_ERR (formatter->pclk)) { ret =PTR_ERR (formatter->pclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get pclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get pclk: %d\n" , ret); }/* Formatter bit clock */ formatter->sclk =devm_clk_get (dev,"sclk" );if (IS_ERR (formatter->sclk)) { ret =PTR_ERR (formatter->sclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get sclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get sclk: %d\n" , ret); }/* Formatter sample clock */ formatter->lrclk =devm_clk_get (dev,"lrclk" );if (IS_ERR (formatter->lrclk)) { ret =PTR_ERR (formatter->lrclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get lrclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get lrclk: %d\n" , ret); }/* Formatter bit clock input multiplexer */ formatter->sclk_sel =devm_clk_get (dev,"sclk_sel" );if (IS_ERR (formatter->sclk_sel)) { ret =PTR_ERR (formatter->sclk_sel); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get sclk_sel: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get sclk_sel: %d\n" , + ret); }/* Formatter sample clock input multiplexer */ formatter->lrclk_sel =devm_clk_get (dev,"lrclk_sel" );if (IS_ERR (formatter->lrclk_sel)) { ret =PTR_ERR (formatter->lrclk_sel); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get lrclk_sel: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get lrclk_sel: %d\n" , + ret); } return devm_snd_soc_register_component(dev, drv->component_drv,
sound/soc/meson/axg-tdm-interface.c +2 -6
@@ -499,18 +499,14 @@ static int axg_tdm_iface_probe(struct platform_device *pdev) iface->sclk =devm_clk_get (dev,"sclk" );if (IS_ERR (iface->sclk)) { ret =PTR_ERR (iface->sclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get sclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get sclk: %d\n" , ret); }/* Sample clock provided on the pad */ iface->lrclk =devm_clk_get (dev,"lrclk" );if (IS_ERR (iface->lrclk)) { ret =PTR_ERR (iface->lrclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get lrclk: %d\n" , ret); -return ret; +return probe_err (dev, ret,"failed to get lrclk: %d\n" , ret); }/*
sound/soc/mxs/mxs-sgtl5000.c +3 -6
@@ -162,12 +162,9 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev) } ret =devm_snd_soc_register_card (&pdev->dev, card); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"snd_soc_register_card failed (%d)\n" , - ret); -return ret; - } +if (ret) +return probe_err (&pdev->dev, ret, +"snd_soc_register_card failed (%d)\n" , ret);return 0 ; }
sound/soc/sunxi/sun4i-codec.c +2 -3
@@ -1621,9 +1621,8 @@ static int sun4i_codec_probe(struct platform_device *pdev) GPIOD_OUT_LOW);if (IS_ERR (scodec->gpio_pa)) { ret =PTR_ERR (scodec->gpio_pa); -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get pa gpio: %d\n" , ret); -return ret; +return probe_err (&pdev->dev, ret, +"Failed to get pa gpio: %d\n" , ret); }/* reg_field setup */
Signature · 1 line
2.18.0
Re: [PATCH 3/3] drivers: use probe_err function in obvious cases
Hello Andrzej,
Quoted 7 lines · Andrzej Hajda
The patch replaces obviously matching code with
probe_errfunction. There are many more places whereprobe_errcould be used. The patch shows how the new function should be used, and how it improves the code.It was generated by cocci script (little bit dirty):
This is great! I guess the easier would be to split these by kernel releases, maybe patch #1 and #2 can land in one kernel release and then each subsystem can merge the changes for their drivers with the dependency already in place.
Best regards,
Signature · 3 lines
Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat
Re: [PATCH 3/3] drivers: use probe_err function in obvious cases
In reply to Andrzej HajdaQuoted 9 lines · Andrzej Hajda
The patch replaces obviously matching code with
probe_errfunction. There are many more places whereprobe_errcould be used. The patch shows how the new function should be used, and how it improves the code.
drivers/gpio/gpio-pca953x.c static int pca953x_probe(struct i2c_client *client, · line 827
Quoted 7 lines
drivers/gpio/gpio-pca953x.c +1
-3@@ -824,9 +824,7 @@ static int pca953x_probe(struct i2c_client *client, reg =devm_regulator_get (&client->dev,"vcc" );if (IS_ERR (reg)) { ret =PTR_ERR (reg); -if (ret != -EPROBE_DEFER ) -dev_err (&client->dev,"reg get err: %d\n" , ret); -return ret; +return probe_err (&client->dev, ret,"reg get err: %d\n" , ret);
No need to assign ret above.
As I mentioned, better to print a value for everyone.
drivers/gpio/gpio-pca953x.c static int pca953x_probe(struct i2c_client *client, · line 828
Quoted 1 line
drivers/gpio/gpio-pca953x.c +0
-0}
Please, split it at least one patch per subsystem.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 3/3] drivers: use probe_err function in obvious cases
Quoted 17 lines · Andy Shevchenko
Quoted 7 lines · Andrzej Hajda
The patch replaces obviously matching code with
probe_errfunction. There are many more places whereprobe_errcould be used. The patch shows how the new function should be used, and how it improves the code.drivers/gpio/gpio-pca953x.c static int pca953x_probe(struct i2c_client *client, · line 827
Quoted 7 lines
drivers/gpio/gpio-pca953x.c +1
-3@@ -824,9 +824,7 @@ static int pca953x_probe(struct i2c_client *client, reg =devm_regulator_get (&client->dev,"vcc" );if (IS_ERR (reg)) { ret =PTR_ERR (reg); -if (ret != -EPROBE_DEFER ) -dev_err (&client->dev,"reg get err: %d\n" , ret); -return ret; +return probe_err (&client->dev, ret,"reg get err: %d\n" , ret);No need to assign ret above.
As I mentioned, better to print a value for everyone.
OK.
Thanks for all reviews. I have posted v2 of patches 1 and 2 as replies in this thread.
As patch 3 requires splitting, adjusting arguments of probe_err (remove err and newline), and depends on patch 1 I will prepare it and post later, probably next cycle as suggested Javier.
Regards
Andrzej
Quoted 4 lines
drivers/gpio/gpio-pca953x.c static int pca953x_probe(struct i2c_client *client, · line 828
Quoted 2 lines
drivers/gpio/gpio-pca953x.c +0
-0}Please, split it at least one patch per subsystem.