Let's move on to the second debugfs file. We will create it using an interesting shortcut helper debugfs API named debugfs_create_u32(). This API automatically sets up internal callbacks, allowing you to read/write upon the specified unsigned 32-bit global variable within the driver. The main advantage of this "helper" routine is that you don't need to explicitly provide a file_operations structure or even any callback routines. The debugfs layer "understands" and internally sets things up so that reading or writing the numeric (global) variable will always just work! Take a look at the following code in the init codepath, which creates and sets up our second debugfs file:
static int debug_level; /* 'off' (0) by default ... */
[...]
/* 3. Create the debugfs file for the debug_level global; we use the
* helper routine to make it simple! There is a downside: we have no
* chance to perform a validity...