A good device driver should support neither more than one peripheral and (possibly) not a fixed number of them! However, even if we decide to restrict driver usage to just one peripheral, it may happen that we need to manage a variable number of data chunks so, in any case, we need to be able to manage dynamic memory allocation.
In this recipe, we will see how we can dynamically (and safely) allocate chunks of memory in the kernel space.