device: move config apply handling to a helper function