All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/legacy: remove some pci legacy code if not needed.
@ 2019-04-24  3:42 Dave Airlie
  2019-04-24  6:39 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Airlie @ 2019-04-24  3:42 UTC (permalink / raw)
  To: dri-devel

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
 #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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/legacy: remove some pci legacy code if not needed.
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2019-04-24  6:39 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-24  6:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.