All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/legacy: remove some pci legacy code if not needed.
Date: Wed, 24 Apr 2019 08:39:57 +0200	[thread overview]
Message-ID: <20190424063957.GK9857@phenom.ffwll.local> (raw)
In-Reply-To: <20190424034256.27998-1-airlied@gmail.com>

On Wed, Apr 24, 2019 at 01:42:56PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> The legacy device list and pci legacy init/exit don't need to
> be built if not supporting legacy.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/drm_pci.c |  8 ++++++--
>  include/drm/drm_device.h  | 10 +++-------
>  include/drm/drm_pci.h     |  2 ++
>  3 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 693748ad8b88..a61ef7baba72 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -265,9 +265,10 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
>  
>  	/* No locking needed since shadow-attach is single-threaded since it may
>  	 * only be called from the per-driver module init hook. */
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  	if (drm_core_check_feature(dev, DRIVER_LEGACY))
>  		list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list);
> -
> +#endif
>  	return 0;
>  
>  err_agp:
> @@ -279,6 +280,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
>  }
>  EXPORT_SYMBOL(drm_get_pci_dev);
>  
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  /**
>   * drm_legacy_pci_init - shadow-attach a legacy DRM PCI driver
>   * @driver: DRM device driver
> @@ -325,7 +327,7 @@ int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
>  	return 0;
>  }
>  EXPORT_SYMBOL(drm_legacy_pci_init);
> -
> +#endif
>  #else
>  
>  void drm_pci_agp_destroy(struct drm_device *dev) {}
> @@ -337,6 +339,7 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
>  }
>  #endif
>  
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  /**
>   * drm_legacy_pci_exit - unregister shadow-attach legacy DRM driver
>   * @driver: DRM device driver
> @@ -362,3 +365,4 @@ void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
>  	DRM_INFO("Module unloaded\n");
>  }
>  EXPORT_SYMBOL(drm_legacy_pci_exit);
> +#endif
> diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> index 7f9ef709b2b6..11daabd8ccbc 100644
> --- a/include/drm/drm_device.h
> +++ b/include/drm/drm_device.h
> @@ -50,13 +50,6 @@ enum switch_power_state {
>   * may contain multiple heads.
>   */
>  struct drm_device {
> -	/**
> -	 * @legacy_dev_list:
> -	 *
> -	 * List of devices per driver for stealth attach cleanup
> -	 */
> -	struct list_head legacy_dev_list;
> -
>  	/** @if_version: Highest interface version set */
>  	int if_version;
>  
> @@ -307,6 +300,9 @@ struct drm_device {
>  	/* Everything below here is for legacy driver, never use! */
>  	/* private: */
>  #if IS_ENABLED(CONFIG_DRM_LEGACY)
> +	/* List of devices per driver for stealth attach cleanup */
> +	struct list_head legacy_dev_list;
> +
>  	/* Context handle management - linked list of context handles */
>  	struct list_head ctxlist;
>  
> diff --git a/include/drm/drm_pci.h b/include/drm/drm_pci.h
> index 8181e9e7cf1d..36b3f2689e16 100644
> --- a/include/drm/drm_pci.h
> +++ b/include/drm/drm_pci.h
> @@ -43,8 +43,10 @@ struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size,
>  				     size_t align);
>  void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
>  
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
>  void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
> +#endif

I think would be prettier if you stuff this into drm_legacy.h and the code
into drm_legacy_misc.c. Out of sight, out of mind and all that :-) With
that:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

>  #ifdef CONFIG_PCI
>  int drm_get_pci_dev(struct pci_dev *pdev,
>  		    const struct pci_device_id *ent,
> -- 
> 2.21.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2019-04-24  6:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24  3:42 [PATCH] drm/legacy: remove some pci legacy code if not needed Dave Airlie
2019-04-24  6:39 ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190424063957.GK9857@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.