The averaging theory has been extensively employed for studying periodic solutions of smooth and nonsmooth differential systems. Here, we extend the averaging theory for studying periodic solutions a class of regularly perturbed non-autonomous n-dimensional discontinuous piecewise smooth differential system. As a fundamental hypothesis, it is assumed that the unperturbed system has a manifold Z ⊂ R n of periodic solutions satisfying dim(Z) < n. Then, we apply this result to study limit cycles bifurcating from periodic solutions of linear differential systems, x = M x, when they are perturbed inside a class of discontinuous piecewise polynomial differential systems with two zones. More precisely, we study the periodic solutions of the following differential system x = M x + εF n 1 (x) + ε 2 F n 2 (x), in R d+2 where ε is a small parameter, M is a (d+2)×(d+2) matrix having one pair of pure imaginary conjugate eigenvalues, m zeros eigenvalues, and d − m non-zero real eigenvalues.