diff options
| author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2026-04-11 09:40:39 +0000 |
|---|---|---|
| committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2026-04-21 22:18:24 +0000 |
| commit | 2357de8ea14f9ee6193eb9e31a9c208e1541163a (patch) | |
| tree | 16b95f827e5a5917995955c2331077aa46ea1be1 /sys/compat/linuxkpi/common/include/linux | |
| parent | ad528a6b174e7090cb06062867e9a146b017205d (diff) | |
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux')
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/device.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 030e9b127540..2913810923f1 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -267,6 +267,30 @@ show_class_attr_string(struct class *class, dev_dbg(dev, __VA_ARGS__); \ } while (0) +static inline int +dev_err_probe(const struct device *dev, int err, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + /* + * On Linux, they look at the error code to determine if the message + * should be logged (not logged if -ENOMEM) and at which log level. + */ + device_printf(dev->bsddev, fmt, args); + + va_end(args); + + return (err); +} + +#define dev_err_ptr_probe(dev, err, fmt, ...) \ + ERR_PTR(dev_err_probe((dev), (err), fmt, ##__VA_ARGS__) + +#define dev_err_cast_probe(dev, err, fmt, ...) \ + ERR_PTR(dev_err_probe((dev), PTR_ERR(err), fmt, ##__VA_ARGS__) + /* Public and LinuxKPI internal devres functions. */ void *lkpi_devres_alloc(void(*release)(struct device *, void *), size_t, gfp_t); void lkpi_devres_add(struct device *, void *); |
