Merge "Tidy up module-lib API and locks" am: 98ab83c37d am: 779b5c6ee0

Change-Id: If558e1d5f1a438eedefaae4c8b7f8eda7862ee7b