Starting from the equations of collisionless linear gyrokinetics for magnetised plasmas with an imposed inhomogeneous magnetic field, we present the first known analytical, closed-form solution for the resulting velocity-space integrals in the presence of resonances due to both parallel streaming and constant magnetic drifts. These integrals are written in terms of the well-known plasma dispersion function (Faddeeva & Terent'ev, Tables of Values of the Function $w(z)=\exp (-z^2)(1+2i/\sqrt {\pi }\int _0^z \exp (t^2) \,\mathrm {d} t)$ for Complex Argument, 1954. Gostekhizdat. English translation: Pergamon Press, 1961; Fried & Conte, The Plasma Dispersion Function, 1961. Academic Press), rendering the subsequent expressions simpler to treat analytically and more efficient to compute numerically. We demonstrate that our results converge to the well-known ones in the straight-magnetic-field and two-dimensional limits, and show good agreement with the numerical solver by Gürcan (J. Comput. Phys., vol. 269, 2014, p. 156). By way of example, we calculate the exact dispersion relation for a simple electrostatic, ion-temperature-gradient-driven instability, and compare it with approximate kinetic and fluid models.