Date: Wed, 29 Apr 2026 21:42:44 +0000 From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b0168063a83d - stable/15 - linuxkpi: Define `dev_err_probe*()` Message-ID: <69f27b54.18d95.2f7b3636@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=b0168063a83de2312bd53cd4101aaf1b3167766d commit b0168063a83de2312bd53cd4101aaf1b3167766d Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> AuthorDate: 2026-04-11 09:40:39 +0000 Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> CommitDate: 2026-04-29 21:03:05 +0000 linuxkpi: Define `dev_err_probe*()` They differ from other `dev_*()` logging functions by returning the passed error code. The error code is also used to determine if the message should be logged in the first place and at which log level. The DRM generic code started to use it in Linux 6.12. Reviewed by: bz Sponsored by: The FreeBSD Foundation (cherry picked from commit 2357de8ea14f9ee6193eb9e31a9c208e1541163a) --- sys/compat/linuxkpi/common/include/linux/device.h | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 *);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f27b54.18d95.2f7b3636>
