Make platform driver implementation simpler by moving common code from sample platform driver into common.c