We find two new classes of exact solutions for the Einstein-Maxwell equations. The solutions are obtained by considering charged anisotropic matter with a linear equation of state consistent with quark stars. The field equations are integrated by specifying forms for the measure of anisotropy and a gravitational potential which are physically reasonable. The solutions found generalize the Mark-Harko model and the Komathiraj-Maharaj model. A graphical analysis indicates that the matter variables are well behaved.