Linear $q$-difference equations