[PATCH openEuler-1.0-LTS] device core: Consolidate locking and unlocking of parent and device