Fixed a bug causing errorneous shutdown

The reason is that ``pci_unregister_driver'' is not called.

Besides, the code skeleton is improved.