device: move hotplug handling logic from system-linux.c to device.c