Re: [PATCH 14/14] drm: IRQ midlayer is now legacy

2021-07-28 Thread Sam Ravnborg
Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:21PM +0200, Thomas Zimmermann wrote:
> Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
> the prefix drm_legacy_, and move declarations to drm_legacy.h.
> In struct drm_device, move the fields irq and irq_enabled behind
> CONFIG_DRM_LEGACY.
> 
> All callers have been updated.
> 
> Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 

> ---
>  drivers/gpu/drm/drm_irq.c | 63 ---

You could have pulled it all into drm_legacy_misc.c.


>  drivers/gpu/drm/drm_legacy_misc.c |  3 +-
>  drivers/gpu/drm/drm_vblank.c  |  8 ++--
>  drivers/gpu/drm/i810/i810_dma.c   |  3 +-
>  drivers/gpu/drm/mga/mga_dma.c |  2 +-
>  drivers/gpu/drm/mga/mga_drv.h |  1 -
>  drivers/gpu/drm/r128/r128_cce.c   |  3 +-
>  drivers/gpu/drm/via/via_mm.c  |  3 +-
>  include/drm/drm_device.h  | 18 ++---
>  include/drm/drm_drv.h | 44 ++---
>  include/drm/drm_irq.h | 31 ---
>  include/drm/drm_legacy.h  |  3 ++
>  12 files changed, 27 insertions(+), 155 deletions(-)
>  delete mode 100644 include/drm/drm_irq.h

Nice cleanup.

Sam
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 14/14] drm: IRQ midlayer is now legacy

2021-07-27 Thread Thomas Zimmermann
Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
the prefix drm_legacy_, and move declarations to drm_legacy.h.
In struct drm_device, move the fields irq and irq_enabled behind
CONFIG_DRM_LEGACY.

All callers have been updated.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_irq.c | 63 ---
 drivers/gpu/drm/drm_legacy_misc.c |  3 +-
 drivers/gpu/drm/drm_vblank.c  |  8 ++--
 drivers/gpu/drm/i810/i810_dma.c   |  3 +-
 drivers/gpu/drm/mga/mga_dma.c |  2 +-
 drivers/gpu/drm/mga/mga_drv.h |  1 -
 drivers/gpu/drm/r128/r128_cce.c   |  3 +-
 drivers/gpu/drm/via/via_mm.c  |  3 +-
 include/drm/drm_device.h  | 18 ++---
 include/drm/drm_drv.h | 44 ++---
 include/drm/drm_irq.h | 31 ---
 include/drm/drm_legacy.h  |  3 ++
 12 files changed, 27 insertions(+), 155 deletions(-)
 delete mode 100644 include/drm/drm_irq.h

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index dc6e38fa8a48..13e1d5c4ec82 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -60,46 +60,14 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
 #include "drm_internal.h"
 
-/**
- * DOC: irq helpers
- *
- * The DRM core provides very simple support helpers to enable IRQ handling on 
a
- * device through the drm_irq_install() and drm_irq_uninstall() functions. This
- * only supports devices with a single interrupt on the main device stored in
- * _device.dev and set as the device paramter in drm_dev_alloc().
- *
- * These IRQ helpers are strictly optional. Since these helpers don't 
automatically
- * clean up the requested interrupt like e.g. devm_request_irq() they're not 
really
- * recommended.
- */
-
-/**
- * drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * Initializes the IRQ related data. Installs the handler, calling the driver
- * _driver.irq_preinstall and _driver.irq_postinstall functions before
- * and after the installation.
- *
- * This is the simplified helper interface provided for drivers with no special
- * needs.
- *
- * @irq must match the interrupt number that would be passed to request_irq(),
- * if called directly instead of using this helper function.
- *
- * _driver.irq_handler is called to handle the registered interrupt.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_install(struct drm_device *dev, int irq)
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+static int drm_legacy_irq_install(struct drm_device *dev, int irq)
 {
int ret;
unsigned long sh_flags = 0;
@@ -144,24 +112,8 @@ int drm_irq_install(struct drm_device *dev, int irq)
 
return ret;
 }
-EXPORT_SYMBOL(drm_irq_install);
 
-/**
- * drm_irq_uninstall - uninstall the IRQ handler
- * @dev: DRM device
- *
- * Calls the driver's _driver.irq_uninstall function and unregisters the 
IRQ
- * handler.  This should only be called by drivers which used drm_irq_install()
- * to set up their interrupt handler.
- *
- * Note that for kernel modesetting drivers it is a bug if this function fails.
- * The sanity checks are only to catch buggy user modesetting drivers which 
call
- * the same function through an ioctl.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_uninstall(struct drm_device *dev)
+int drm_legacy_irq_uninstall(struct drm_device *dev)
 {
unsigned long irqflags;
bool irq_enabled;
@@ -207,9 +159,8 @@ int drm_irq_uninstall(struct drm_device *dev)
 
return 0;
 }
-EXPORT_SYMBOL(drm_irq_uninstall);
+EXPORT_SYMBOL(drm_legacy_irq_uninstall);
 
-#if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
   struct drm_file *file_priv)
 {
@@ -238,13 +189,13 @@ int drm_legacy_irq_control(struct drm_device *dev, void 
*data,
ctl->irq != irq)
return -EINVAL;
mutex_lock(>struct_mutex);
-   ret = drm_irq_install(dev, irq);
+   ret = drm_legacy_irq_install(dev, irq);
mutex_unlock(>struct_mutex);
 
return ret;
case DRM_UNINST_HANDLER:
mutex_lock(>struct_mutex);
-   ret = drm_irq_uninstall(dev);
+   ret = drm_legacy_irq_uninstall(dev);
mutex_unlock(>struct_mutex);
 
return ret;
diff --git a/drivers/gpu/drm/drm_legacy_misc.c 
b/drivers/gpu/drm/drm_legacy_misc.c
index 83db43b7a25e..d4c5434062d7 100644
--- a/drivers/gpu/drm/drm_legacy_misc.c
+++ b/drivers/gpu/drm/drm_legacy_misc.c
@@ -35,7 +35,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 #include "drm_internal.h"
@@ -78,7 +77,7 @@ int drm_legacy_setup(struct drm_device * dev)
 void drm_legacy_dev_reinit(struct drm_device *dev)
 {
if (dev->irq_enabled)
-