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 <firstname.lastname@example.org>
Cc: Stephen Rothwell <email@example.com>
Cc: Sergey Senozhatsky <firstname.lastname@example.org>
Cc: Joe Perches <email@example.com>
Signed-off-by: Brendan Higgins <firstname.lastname@example.org>
Acked-by: Randy Dunlap <email@example.com> # build-tested
Reviewed-by: Petr Mladek <firstname.lastname@example.org>
2 files changed