kunit: fix failure to build without printk
Previously KUnit assumed that printk would always be present, which is
not a valid assumption to make. Fix that by removing call to
vprintk_emit, and calling printk directly.
This fixes a build error reported by Randy.
For context this change comes after much discussion. My first stab at
this was just to make the KUnit logging code compile out; however, it
was agreed that if we were going to use vprintk_emit, then vprintk_emit
should provide a no-op stub, which lead to my second attempt. In
response to me trying to stub out vprintk_emit, Sergey Senozhatsky
suggested a way for me to remove our usage of vprintk_emit, which led to
my third attempt at solving this.
In my third version of this patch, I completely removed vprintk_emit,
as suggested by Sergey; however, there was a bit of debate over whether
Sergey's solution was the best. The debate arose due to Sergey's version
resulting in a checkpatch warning, which resulted in a debate over
correct printk usage. Joe Perches offered an alternative fix which was
somewhat less far reaching than what Sergey had suggested and
importantly relied on continuing to use %pV. Much of the debated
centered around whether %pV should be widely used, and whether Sergey's
version would result in object size bloat. Ultimately, we decided to go
with Sergey's version.
Reported-by: Randy Dunlap <email@example.com>
Cc: Stephen Rothwell <firstname.lastname@example.org>
Cc: Sergey Senozhatsky <email@example.com>
Cc: Joe Perches <firstname.lastname@example.org>
Signed-off-by: Brendan Higgins <email@example.com>
Acked-by: Randy Dunlap <firstname.lastname@example.org> # build-tested
Reviewed-by: Petr Mladek <email@example.com>
2 files changed