mmc: Move code that manages user area and gp partitions into functions