Hello Mark,
I just spotted a couple of small typos, noted below, and I hope you
won't
mind to apply the fixes by hand before applying this patch, please?
On 2024-09-29 11:21, Dragan Simic wrote:
Some drivers can still provide their functionality to a certain extent
even
s/extent even/extent when/
some of their resource acquisitions eventually fail. In such cases,
emitting
errors isn't the desired action, but warnings should be emitted
instead.
To solve this, introduce dev_warn_probe() as a new device probe log
helper,
which behaves identically as the already existing dev_err_probe(),
while it
produces warnings instead of errors. The intended use is with the
resources
that are actually optional for a particular driver.
While there, copyedit the kerneldoc for dev_err_probe() a bit, to
simplify
its wording a bit, and reuse it as the kerneldoc for dev_warn_probe(),
with
the necessary wording adjustments, of course.
Signed-off-by: Dragan Simic <dsimic@xxxxxxxxxxx>
---
drivers/base/core.c | 129 +++++++++++++++++++++++++++++--------
include/linux/dev_printk.h | 1 +
2 files changed, 102 insertions(+), 28 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8c0733d3aad8..f2e41db0c09f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -4982,71 +4982,144 @@ define_dev_printk_level(_dev_info, KERN_INFO);
#endif
+static void __dev_probe_failed(const struct device *dev, int err, bool
fatal,
+ const char *fmt, va_list vargsp)
+{
+ struct va_format vaf;
+ va_list vargs;
+
+ /*
+ * On x86_64 and possibly on other architectures, va_list is actually
a
+ * size-1 array containing a structure. As a result, function
parameter
+ * vargps decays from T[1] to T*, and &vargsp has type T** rather
than
s/vargps decays/vargsp decays/
+ * T(*)[1], which is expected by its assignment to vaf.va below.
+ *
+ * One standard way to solve this mess is by creating a copy in a
local
+ * variable of type va_list and then using a pointer to that local
copy
+ * instead, which is the approach employed here.
+ */
+ va_copy(vargs, vargsp);
+
+ vaf.fmt = fmt;
+ vaf.va = &vargs;