Re: [PATCH] drm/i915: Fix module unloading with DRM_I915_UMS=n

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 15, 2013 at 08:58:12PM +0000, Chris Wilson wrote:
> On Fri, Nov 15, 2013 at 05:16:33PM +0100, Daniel Vetter wrote:
> > Oops, makes testing early boot failures in i915.ko a bit more pain, so
> > let's fix it.
> > 
> > v2: We already have a bit of static storage to track this (Chris).
> > 
> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
> 
> How about just fixing the core not to die?

This is for the disabled UMS code where we silently don't register
anything. So there's also nothing to clean up, i.e. we've called
drm_pci_exit without drm_pci_init. I don't think this is something we
should allow in the core.
-Daniel
> 
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index f00d7a9..3b9c7ce 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -375,13 +375,13 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
>  
>         DRM_DEBUG("\n");
>  
> +       if (driver->driver_features & DRIVER_MODESET)
> +               return pci_register_driver(pdriver);
> +
>         INIT_LIST_HEAD(&driver->device_list);
>         driver->kdriver.pci = pdriver;
>         driver->bus = &drm_pci_bus;
>  
> -       if (driver->driver_features & DRIVER_MODESET)
> -               return pci_register_driver(pdriver);
> -
>         /* If not using KMS, fall back to stealth mode manual scanning. */
>         for (i = 0; pdriver->id_table[i].vendor != 0; i++) {
>                 pid = &pdriver->id_table[i];
> @@ -462,6 +462,11 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
>         struct drm_device *dev, *tmp;
>         DRM_DEBUG("\n");
>  
> +       if (!driver->kdriver.pci)
> +               return;
> +
> +       WARN_ON(driver->kdriver.pci != pdriver);
> +
>         if (driver->driver_features & DRIVER_MODESET) {
>                 pci_unregister_driver(pdriver);
>         } else {
> 
> We can drop the redundant pdriver later.
> -Chris
> 
> -- 
> Chris Wilson, Intel Open Source Technology Centre

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux