I actually sometimes write very short helper functions that are actually meant to improve readability by abstracting some details and making the code more self-documenting.
For instance I have this code in my current application (a device driver):
static unsigned get_machine_id(struct manager *mgr)
{
u32 conf = readl(mgr->regs + OFF_MACHINE_ID);
return conf & 0xff;
}
It's called twice in the entire code. By you rule I ought to manually inline it but I think it'd actually make the code worse, not better. It's always a matter of balance, writing good code is an art.>Only noobs avoid copy&paste at all costs
Only noobs rely on rules of thumb indiscriminately.