RFC - organize include/linux/kernel.h, add include/linux/logging.h
Quoted 4 lines
kernel.hhas become a bit disorganized over a long time. Here's an attempt to clean it up a bit.Something for everyone to like or dislike...
You duplicate ALIGN macros all over the place.
Quoted 9 lines
Groups externs and functions by module/function Creates a "
logging.h" for printk, KERN_<level> Changes some macros to statement expressions
DIV_ROUND_UP, roundup and__ALIGN_MASK
Removes the unusedPTR_ALIGNThis one used the ALIGN macro, but I'm not inclined to figure out what it actually does right now, so copy the old macro to this file and renames it.
Which is not acceptable. Ditto for DIV_ROUND_UP.
And you somehow decided that putting statements on one line is more readable than on multiple lines -- typecheck and friends.
Overall impression -- moving code just because you can.
Quoted 8 lines · Alexey Dobriyan
Quoted 3 lines
kernel.hhas become a bit disorganized over a long time. Here's an attempt to clean it up a bit. Something for everyone to like or dislike...You duplicate ALIGN macros all over the place.
Quoted 3 lines
This one used the ALIGN macro, but I'm not inclined to figure out what it actually does right now, so copy the old macro to this file and renames it.
Which is not acceptable. Ditto for
DIV_ROUND_UP.
There were 3 instances where macros were
used to specify an array size. It seems
cleaner to use SEs and direct use of calculations for those 3 instances. (ymmv)
What would you expect this to do?
struct {
unsigned char ha[ALIGN(32,sizeof(unsigned long))];
} foo;A casual reading might suggest 0.
Quoted 2 lines
And you somehow decided that putting statements on one line is more readable than on multiple lines -- typecheck and friends.
That appears to be the generally accepted coding style for macros and statement expressions.
Whatever is agreed to is fine by me.
Quoted 1 line
Overall impression -- moving code just because you can.
Yes. It's definitely a cleanup.
I think creating a separate include for the printk related defines and functions will be useful for possible future improvements to logging.
There are many private logging definitions that could be consolidated in generic way. Things like:
#define MY_PRINTK(fmt, arg) print(PFX fmt, ##arg)
cheers, Joe
Quoted 7 lines · Joe Perches
There are many private logging definitions that could be consolidated in generic way. Things like:
#define MY_PRINTK(fmt, arg) print(PFX fmt, ##arg)cheers, Joe
While you are at that, PFX should probably be KBUILD_MODNAME, for simplicity. Then it will be easy to consolidate since they all use KBUILD_MODNAME rather than their own PFX. Just btw :)
Quoted 4 lines · Jan Engelhardt
While you are at that, PFX should probably be
KBUILD_MODNAME, for simplicity. Then it will be easy to consolidate since they all useKBUILD_MODNAMErather than their own PFX. Just btw :)
I think that nearly all private logging functions
could be eliminated by having a new macro defined
especially for logging.
Something akin to:
#define PRINTK_MODNAME 1
#define PRINTK_FILE 2
#define PRINTK_FUNCTION 4
#define PRINTK_LINE 8
#define PRINTK_PREFIX (your choice)
#include <linux/logging.h>
then all uses of pr_<level> could get modified for free.