[Intel-gfx] [PATCH 01/16] drm/i915: Provide a hook for selftests
Chris Wilson
chris at chris-wilson.co.uk
Thu Dec 8 11:15:35 UTC 2016
On Thu, Dec 08, 2016 at 10:47:52AM +0000, Tvrtko Ursulin wrote:
> On 07/12/2016 13:58, Chris Wilson wrote:
> >- return i915_driver_load(pdev, ent);
> >+ err = i915_driver_load(pdev, ent);
> >+ if (err)
> >+ return err;
> >+
> >+ err = i915_late_selftests(pdev);
> >+ if (err) {
> >+ i915_driver_unload(pci_get_drvdata(pdev));
> >+ return err > 0 ? -ENOTTY : err;
>
> Here ...
>
> >+ }
> >+
> >+ return 0;
> > }
> >
> > static void i915_pci_remove(struct pci_dev *pdev)
> >@@ -520,6 +532,11 @@ static struct pci_driver i915_pci_driver = {
> > static int __init i915_init(void)
> > {
> > bool use_kms = true;
> >+ int err;
> >+
> >+ err = i915_mock_selftests();
> >+ if (err)
> >+ return err > 0 ? 0 : err;
>
> ... and here, the return conversion is different but in the
> implementation is the same. It is probably wrong or at least
> confusing so it would be good to make it the same.
The return convention is tricky because ->probe and module_init want
different things. To cancel the probe, we have to return an error value
(-ENOTTY). But for integration with kselftest we want the module load to
report success (kselftest effectively uses
modprobe i915 mock_selftests=-1 || exit "FAIL"
). Our igt_kselftest has access to the error code from the syscall and
so can differentiate better than the kselftest.sh, but that shell script
is the lowest common demoninator
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list