Refactor the code base a bit for the further work to adapt more clients. Signed-off-by: Takashi Iwai <tiwai@suse.de>