All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/4] drm/{mga,mgag200}: drop use of drmP.h
@ 2019-06-08  8:19 Sam Ravnborg
  2019-06-08  8:19 ` [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h Sam Ravnborg
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Sam Ravnborg @ 2019-06-08  8:19 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, Sam Ravnborg, Thomas Zimmermann

Drop use of the deprecated drmP.h header file.
Also drop use of drm_os_linux.h as it is deprecated too,
and was pulled in via drmP.h

Build tested with allmodconfig, allyesconfig on
various architectures.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Sam Ravnborg (4):
      drm/mga: drop dependency on drm_os_linux.h
      drm/mga: make header file self contained
      drm/mga: drop use of drmP.h
      drm/mgag200: drop use of drmP.h

 drivers/gpu/drm/mga/mga_dma.c            | 14 ++++++++------
 drivers/gpu/drm/mga/mga_drv.c            |  7 +++----
 drivers/gpu/drm/mga/mga_drv.h            | 25 +++++++++++++++++++++----
 drivers/gpu/drm/mga/mga_ioc32.c          |  3 +--
 drivers/gpu/drm/mga/mga_irq.c            | 10 ++++------
 drivers/gpu/drm/mga/mga_state.c          |  8 +++-----
 drivers/gpu/drm/mga/mga_warp.c           |  4 +---
 drivers/gpu/drm/mgag200/mgag200_cursor.c |  3 ++-
 drivers/gpu/drm/mgag200/mgag200_drv.c    | 10 +++++++---
 drivers/gpu/drm/mgag200/mgag200_drv.h    |  8 +++-----
 drivers/gpu/drm/mgag200/mgag200_fb.c     |  8 +++++---
 drivers/gpu/drm/mgag200/mgag200_i2c.c    |  6 ++++--
 drivers/gpu/drm/mgag200/mgag200_main.c   |  4 +++-
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  3 ++-
 drivers/gpu/drm/mgag200/mgag200_ttm.c    |  3 ++-
 15 files changed, 69 insertions(+), 47 deletions(-)


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h
  2019-06-08  8:19 [PATCH v1 0/4] drm/{mga,mgag200}: drop use of drmP.h Sam Ravnborg
@ 2019-06-08  8:19 ` Sam Ravnborg
  2019-06-11  7:48   ` Thomas Zimmermann
  2019-06-08  8:19 ` [PATCH v1 2/4] drm/mga: make header file self contained Sam Ravnborg
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Sam Ravnborg @ 2019-06-08  8:19 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, Sam Ravnborg, Thomas Zimmermann

Opencode all macros used from the deprecated drm_os_linux.h header file.
The DRM_WAIT_ON used 3 * HZ as timeout.
This was translated to 30 msec.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/mga/mga_dma.c   | 12 ++++++++----
 drivers/gpu/drm/mga/mga_drv.h   | 12 ++++++++----
 drivers/gpu/drm/mga/mga_irq.c   |  8 ++++----
 drivers/gpu/drm/mga/mga_state.c |  6 +++---
 4 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index 1ffdafea27e4..123be2f3a151 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -35,6 +35,8 @@
  * \author Gareth Hughes <gareth@valinux.com>
  */
 
+#include <linux/delay.h>
+
 #include <drm/drmP.h>
 #include <drm/mga_drm.h>
 #include "mga_drv.h"
@@ -62,7 +64,7 @@ int mga_do_wait_for_idle(drm_mga_private_t *dev_priv)
 			MGA_WRITE8(MGA_CRTC_INDEX, 0);
 			return 0;
 		}
-		DRM_UDELAY(1);
+		udelay(1);
 	}
 
 #if MGA_DMA_DEBUG
@@ -114,7 +116,7 @@ void mga_do_dma_flush(drm_mga_private_t *dev_priv)
 		status = MGA_READ(MGA_STATUS) & MGA_ENGINE_IDLE_MASK;
 		if (status == MGA_ENDPRDMASTS)
 			break;
-		DRM_UDELAY(1);
+		udelay(1);
 	}
 
 	if (primary->tail == primary->last_flush) {
@@ -1120,7 +1122,7 @@ int mga_dma_buffers(struct drm_device *dev, void *data,
 	 */
 	if (d->send_count != 0) {
 		DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
-			  DRM_CURRENTPID, d->send_count);
+			  task_pid_nr(current), d->send_count);
 		return -EINVAL;
 	}
 
@@ -1128,7 +1130,9 @@ int mga_dma_buffers(struct drm_device *dev, void *data,
 	 */
 	if (d->request_count < 0 || d->request_count > dma->buf_count) {
 		DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
-			  DRM_CURRENTPID, d->request_count, dma->buf_count);
+			  task_pid_nr(current),
+			  d->request_count,
+			  dma->buf_count);
 		return -EINVAL;
 	}
 
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index a45bb22275a7..7844a9e463f6 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -199,10 +199,14 @@ extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
 
 #define mga_flush_write_combine()	wmb()
 
-#define MGA_READ8(reg)		DRM_READ8(dev_priv->mmio, (reg))
-#define MGA_READ(reg)		DRM_READ32(dev_priv->mmio, (reg))
-#define MGA_WRITE8(reg, val)	DRM_WRITE8(dev_priv->mmio, (reg), (val))
-#define MGA_WRITE(reg, val)	DRM_WRITE32(dev_priv->mmio, (reg), (val))
+#define MGA_READ8(reg) \
+	readb(((void __iomem *)dev_priv->mmio->handle) + (reg))
+#define MGA_READ(reg) \
+	readl(((void __iomem *)dev_priv->mmio->handle) + (reg))
+#define MGA_WRITE8(reg, val) \
+	writeb(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
+#define MGA_WRITE(reg, val) \
+	writel(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
 
 #define DWGREG0		0x1c00
 #define DWGREG0_END	0x1dff
diff --git a/drivers/gpu/drm/mga/mga_irq.c b/drivers/gpu/drm/mga/mga_irq.c
index 693ba708cfed..c6a3fab5b0c4 100644
--- a/drivers/gpu/drm/mga/mga_irq.c
+++ b/drivers/gpu/drm/mga/mga_irq.c
@@ -122,19 +122,19 @@ int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence)
 {
 	drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
 	unsigned int cur_fence;
-	int ret = 0;
 
 	/* Assume that the user has missed the current sequence number
 	 * by about a day rather than she wants to wait for years
 	 * using fences.
 	 */
-	DRM_WAIT_ON(ret, dev_priv->fence_queue, 3 * HZ,
+	wait_event_timeout(dev_priv->fence_queue,
 		    (((cur_fence = atomic_read(&dev_priv->last_fence_retired))
-		      - *sequence) <= (1 << 23)));
+		      - *sequence) <= (1 << 23)),
+		    msecs_to_jiffies(30));
 
 	*sequence = cur_fence;
 
-	return ret;
+	return 0;
 }
 
 void mga_driver_irq_preinstall(struct drm_device *dev)
diff --git a/drivers/gpu/drm/mga/mga_state.c b/drivers/gpu/drm/mga/mga_state.c
index e5f6b735f575..296a1db7e5ee 100644
--- a/drivers/gpu/drm/mga/mga_state.c
+++ b/drivers/gpu/drm/mga/mga_state.c
@@ -1016,7 +1016,7 @@ int mga_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv)
 		return -EINVAL;
 	}
 
-	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
+	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
 
 	switch (param->param) {
 	case MGA_PARAM_IRQ_NR:
@@ -1048,7 +1048,7 @@ static int mga_set_fence(struct drm_device *dev, void *data, struct drm_file *fi
 		return -EINVAL;
 	}
 
-	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
+	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
 
 	/* I would normal do this assignment in the declaration of fence,
 	 * but dev_priv may be NULL.
@@ -1077,7 +1077,7 @@ file_priv)
 		return -EINVAL;
 	}
 
-	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
+	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
 
 	mga_driver_fence_wait(dev, fence);
 	return 0;
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v1 2/4] drm/mga: make header file self contained
  2019-06-08  8:19 [PATCH v1 0/4] drm/{mga,mgag200}: drop use of drmP.h Sam Ravnborg
  2019-06-08  8:19 ` [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h Sam Ravnborg
@ 2019-06-08  8:19 ` Sam Ravnborg
  2019-06-08  8:19 ` [PATCH v1 3/4] drm/mga: drop use of drmP.h Sam Ravnborg
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Sam Ravnborg @ 2019-06-08  8:19 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, Sam Ravnborg, Thomas Zimmermann

This makes migration away from drmP.h simple
as we do not need to duplicate dependencies required by mga_drv.h

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/mga/mga_drv.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index 7844a9e463f6..10169ff4669a 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -31,7 +31,20 @@
 #ifndef __MGA_DRV_H__
 #define __MGA_DRV_H__
 
+#include <linux/irqreturn.h>
+#include <linux/slab.h>
+
+#include <drm/drm_agpsupport.h>
+#include <drm/drm_device.h>
+#include <drm/drm_file.h>
+#include <drm/drm_ioctl.h>
+#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
+#include <drm/drm_pci.h>
+#include <drm/drm_print.h>
+#include <drm/drm_sarea.h>
+#include <drm/drm_vblank.h>
+#include <drm/mga_drm.h>
 
 /* General customization:
  */
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v1 3/4] drm/mga: drop use of drmP.h
  2019-06-08  8:19 [PATCH v1 0/4] drm/{mga,mgag200}: drop use of drmP.h Sam Ravnborg
  2019-06-08  8:19 ` [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h Sam Ravnborg
  2019-06-08  8:19 ` [PATCH v1 2/4] drm/mga: make header file self contained Sam Ravnborg
@ 2019-06-08  8:19 ` Sam Ravnborg
  2019-06-11  7:53   ` Thomas Zimmermann
  2019-06-08  8:19 ` [PATCH v1 4/4] drm/mgag200: " Sam Ravnborg
  2019-06-11  7:55 ` [PATCH v1 0/4] drm/{mga,mgag200}: " Thomas Zimmermann
  4 siblings, 1 reply; 12+ messages in thread
From: Sam Ravnborg @ 2019-06-08  8:19 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, Sam Ravnborg, Thomas Zimmermann

Drop the use of the deprecated drmP.h header file.
Clean up list of include files and sort them.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/mga/mga_dma.c   | 2 --
 drivers/gpu/drm/mga/mga_drv.c   | 7 +++----
 drivers/gpu/drm/mga/mga_ioc32.c | 3 +--
 drivers/gpu/drm/mga/mga_irq.c   | 2 --
 drivers/gpu/drm/mga/mga_state.c | 2 --
 drivers/gpu/drm/mga/mga_warp.c  | 4 +---
 6 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index 123be2f3a151..139554a3733d 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -37,8 +37,6 @@
 
 #include <linux/delay.h>
 
-#include <drm/drmP.h>
-#include <drm/mga_drm.h>
 #include "mga_drv.h"
 
 #define MGA_DEFAULT_USEC_TIMEOUT	10000
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index 6e1d1054ad06..71128e6f6ae9 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -31,12 +31,11 @@
 
 #include <linux/module.h>
 
-#include <drm/drmP.h>
-#include <drm/mga_drm.h>
-#include "mga_drv.h"
-
+#include <drm/drm_drv.h>
 #include <drm/drm_pciids.h>
 
+#include "mga_drv.h"
+
 static struct pci_device_id pciidlist[] = {
 	mga_PCI_IDS
 };
diff --git a/drivers/gpu/drm/mga/mga_ioc32.c b/drivers/gpu/drm/mga/mga_ioc32.c
index 245fb2e359cf..6ccd270789c6 100644
--- a/drivers/gpu/drm/mga/mga_ioc32.c
+++ b/drivers/gpu/drm/mga/mga_ioc32.c
@@ -30,10 +30,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+
 #include <linux/compat.h>
 
-#include <drm/drmP.h>
-#include <drm/mga_drm.h>
 #include "mga_drv.h"
 
 typedef struct drm32_mga_init {
diff --git a/drivers/gpu/drm/mga/mga_irq.c b/drivers/gpu/drm/mga/mga_irq.c
index c6a3fab5b0c4..7c48f4d090ac 100644
--- a/drivers/gpu/drm/mga/mga_irq.c
+++ b/drivers/gpu/drm/mga/mga_irq.c
@@ -31,8 +31,6 @@
  *    Eric Anholt <anholt@FreeBSD.org>
  */
 
-#include <drm/drmP.h>
-#include <drm/mga_drm.h>
 #include "mga_drv.h"
 
 u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
diff --git a/drivers/gpu/drm/mga/mga_state.c b/drivers/gpu/drm/mga/mga_state.c
index 296a1db7e5ee..77a0b006f066 100644
--- a/drivers/gpu/drm/mga/mga_state.c
+++ b/drivers/gpu/drm/mga/mga_state.c
@@ -32,8 +32,6 @@
  *    Gareth Hughes <gareth@valinux.com>
  */
 
-#include <drm/drmP.h>
-#include <drm/mga_drm.h>
 #include "mga_drv.h"
 
 /* ================================================================
diff --git a/drivers/gpu/drm/mga/mga_warp.c b/drivers/gpu/drm/mga/mga_warp.c
index 0b76352260a9..b5ef1d2c8b1c 100644
--- a/drivers/gpu/drm/mga/mga_warp.c
+++ b/drivers/gpu/drm/mga/mga_warp.c
@@ -29,11 +29,9 @@
 
 #include <linux/firmware.h>
 #include <linux/ihex.h>
-#include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/platform_device.h>
 
-#include <drm/drmP.h>
-#include <drm/mga_drm.h>
 #include "mga_drv.h"
 
 #define FIRMWARE_G200 "matrox/g200_warp.fw"
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v1 4/4] drm/mgag200: drop use of drmP.h
  2019-06-08  8:19 [PATCH v1 0/4] drm/{mga,mgag200}: drop use of drmP.h Sam Ravnborg
                   ` (2 preceding siblings ...)
  2019-06-08  8:19 ` [PATCH v1 3/4] drm/mga: drop use of drmP.h Sam Ravnborg
@ 2019-06-08  8:19 ` Sam Ravnborg
  2019-06-11  7:55 ` [PATCH v1 0/4] drm/{mga,mgag200}: " Thomas Zimmermann
  4 siblings, 0 replies; 12+ messages in thread
From: Sam Ravnborg @ 2019-06-08  8:19 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, Sam Ravnborg, Thomas Zimmermann

Drop use of the deprecated drmP.h header file.
Replace with necessary includ files to fix build.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/mgag200/mgag200_cursor.c |  3 ++-
 drivers/gpu/drm/mgag200/mgag200_drv.c    | 10 +++++++---
 drivers/gpu/drm/mgag200/mgag200_drv.h    |  8 +++-----
 drivers/gpu/drm/mgag200/mgag200_fb.c     |  8 +++++---
 drivers/gpu/drm/mgag200/mgag200_i2c.c    |  6 ++++--
 drivers/gpu/drm/mgag200/mgag200_main.c   |  4 +++-
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  3 ++-
 drivers/gpu/drm/mgag200/mgag200_ttm.c    |  3 ++-
 8 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c
index 06a8c076cb33..786a30d45900 100644
--- a/drivers/gpu/drm/mgag200/mgag200_cursor.c
+++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c
@@ -8,7 +8,8 @@
  * Author: Christopher Harvey <charvey@matrox.com>
  */
 
-#include <drm/drmP.h>
+#include <drm/drm_pci.h>
+
 #include "mgag200_drv.h"
 
 static bool warn_transparent = true;
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 93bd1589e50e..e12a5cab71f2 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -8,14 +8,18 @@
  * Authors: Matthew Garrett
  *          Dave Airlie
  */
+
 #include <linux/module.h>
 #include <linux/console.h>
-#include <drm/drmP.h>
-
-#include "mgag200_drv.h"
 
+#include <drm/drm_drv.h>
+#include <drm/drm_file.h>
+#include <drm/drm_ioctl.h>
+#include <drm/drm_pci.h>
 #include <drm/drm_pciids.h>
 
+#include "mgag200_drv.h"
+
 /*
  * This is the generic driver code. This binds the driver to the drm core,
  * which then performs further device association and calls our graphics init
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h
index 6180acbca7ca..5dc577c9f8e6 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.h
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
@@ -13,19 +13,17 @@
 #ifndef __MGAG200_DRV_H__
 #define __MGAG200_DRV_H__
 
+#include <linux/i2c-algo-bit.h>
+#include <linux/i2c.h>
+
 #include <video/vga.h>
 
 #include <drm/drm_encoder.h>
 #include <drm/drm_fb_helper.h>
-
 #include <drm/drm_gem.h>
 #include <drm/drm_gem_vram_helper.h>
-
 #include <drm/drm_vram_mm_helper.h>
 
-#include <linux/i2c.h>
-#include <linux/i2c-algo-bit.h>
-
 #include "mgag200_reg.h"
 
 #define DRIVER_AUTHOR		"Matthew Garrett"
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 97c575a9a86f..73f37bced134 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -10,11 +10,13 @@
  *          Matt Turner
  *          Dave Airlie
  */
+
 #include <linux/module.h>
-#include <drm/drmP.h>
-#include <drm/drm_util.h>
-#include <drm/drm_fb_helper.h>
+
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_util.h>
 
 #include "mgag200_drv.h"
 
diff --git a/drivers/gpu/drm/mgag200/mgag200_i2c.c b/drivers/gpu/drm/mgag200/mgag200_i2c.c
index 77d1c4771786..51d4037f00d4 100644
--- a/drivers/gpu/drm/mgag200/mgag200_i2c.c
+++ b/drivers/gpu/drm/mgag200/mgag200_i2c.c
@@ -25,10 +25,12 @@
 /*
  * Authors: Dave Airlie <airlied@redhat.com>
  */
+
 #include <linux/export.h>
-#include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
-#include <drm/drmP.h>
+#include <linux/i2c.h>
+
+#include <drm/drm_pci.h>
 
 #include "mgag200_drv.h"
 
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
index f3687fed4075..fcd11ef50bd9 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -10,8 +10,10 @@
  *          Matt Turner
  *          Dave Airlie
  */
-#include <drm/drmP.h>
+
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_pci.h>
+
 #include "mgag200_drv.h"
 
 static void mga_user_framebuffer_destroy(struct drm_framebuffer *fb)
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 1c8e0bfac015..32a6fab44eee 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -13,8 +13,9 @@
 
 #include <linux/delay.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_pci.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 59294c0fd24a..73a6b848601c 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -25,7 +25,8 @@
 /*
  * Authors: Dave Airlie <airlied@redhat.com>
  */
-#include <drm/drmP.h>
+
+#include <drm/drm_pci.h>
 
 #include "mgag200_drv.h"
 
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h
  2019-06-08  8:19 ` [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h Sam Ravnborg
@ 2019-06-11  7:48   ` Thomas Zimmermann
  2019-06-11  8:55     ` Daniel Vetter
  2019-06-11 10:44     ` Sam Ravnborg
  0 siblings, 2 replies; 12+ messages in thread
From: Thomas Zimmermann @ 2019-06-11  7:48 UTC (permalink / raw)
  To: Sam Ravnborg, dri-devel; +Cc: David Airlie


[-- Attachment #1.1.1: Type: text/plain, Size: 5799 bytes --]

Hi

Am 08.06.19 um 10:19 schrieb Sam Ravnborg:
> Opencode all macros used from the deprecated drm_os_linux.h header file.
> The DRM_WAIT_ON used 3 * HZ as timeout.
> This was translated to 30 msec.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> ---
>  drivers/gpu/drm/mga/mga_dma.c   | 12 ++++++++----
>  drivers/gpu/drm/mga/mga_drv.h   | 12 ++++++++----
>  drivers/gpu/drm/mga/mga_irq.c   |  8 ++++----
>  drivers/gpu/drm/mga/mga_state.c |  6 +++---
>  4 files changed, 23 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
> index 1ffdafea27e4..123be2f3a151 100644
> --- a/drivers/gpu/drm/mga/mga_dma.c
> +++ b/drivers/gpu/drm/mga/mga_dma.c
> @@ -35,6 +35,8 @@
>   * \author Gareth Hughes <gareth@valinux.com>
>   */
>  
> +#include <linux/delay.h>
> +
>  #include <drm/drmP.h>
>  #include <drm/mga_drm.h>
>  #include "mga_drv.h"
> @@ -62,7 +64,7 @@ int mga_do_wait_for_idle(drm_mga_private_t *dev_priv)
>  			MGA_WRITE8(MGA_CRTC_INDEX, 0);
>  			return 0;
>  		}
> -		DRM_UDELAY(1);
> +		udelay(1);
>  	}
>  
>  #if MGA_DMA_DEBUG
> @@ -114,7 +116,7 @@ void mga_do_dma_flush(drm_mga_private_t *dev_priv)
>  		status = MGA_READ(MGA_STATUS) & MGA_ENGINE_IDLE_MASK;
>  		if (status == MGA_ENDPRDMASTS)
>  			break;
> -		DRM_UDELAY(1);
> +		udelay(1);
>  	}
>  
>  	if (primary->tail == primary->last_flush) {
> @@ -1120,7 +1122,7 @@ int mga_dma_buffers(struct drm_device *dev, void *data,
>  	 */
>  	if (d->send_count != 0) {
>  		DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
> -			  DRM_CURRENTPID, d->send_count);
> +			  task_pid_nr(current), d->send_count);
>  		return -EINVAL;
>  	}
>  
> @@ -1128,7 +1130,9 @@ int mga_dma_buffers(struct drm_device *dev, void *data,
>  	 */
>  	if (d->request_count < 0 || d->request_count > dma->buf_count) {
>  		DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
> -			  DRM_CURRENTPID, d->request_count, dma->buf_count);
> +			  task_pid_nr(current),
> +			  d->request_count,
> +			  dma->buf_count);
>  		return -EINVAL;
>  	}
>  
> diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
> index a45bb22275a7..7844a9e463f6 100644
> --- a/drivers/gpu/drm/mga/mga_drv.h
> +++ b/drivers/gpu/drm/mga/mga_drv.h
> @@ -199,10 +199,14 @@ extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
>  
>  #define mga_flush_write_combine()	wmb()
>  
> -#define MGA_READ8(reg)		DRM_READ8(dev_priv->mmio, (reg))
> -#define MGA_READ(reg)		DRM_READ32(dev_priv->mmio, (reg))
> -#define MGA_WRITE8(reg, val)	DRM_WRITE8(dev_priv->mmio, (reg), (val))
> -#define MGA_WRITE(reg, val)	DRM_WRITE32(dev_priv->mmio, (reg), (val))
> +#define MGA_READ8(reg) \
> +	readb(((void __iomem *)dev_priv->mmio->handle) + (reg))
> +#define MGA_READ(reg) \
> +	readl(((void __iomem *)dev_priv->mmio->handle) + (reg))
> +#define MGA_WRITE8(reg, val) \
> +	writeb(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
> +#define MGA_WRITE(reg, val) \
> +	writel(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))

Addition is not defined or implementation specific for type void* IIRC.
Compilers tend to treat it like u8*. Maybe cast mmio->handle to (u8
__iomem *) instead?

Best regards
Thomas

>  
>  #define DWGREG0		0x1c00
>  #define DWGREG0_END	0x1dff
> diff --git a/drivers/gpu/drm/mga/mga_irq.c b/drivers/gpu/drm/mga/mga_irq.c
> index 693ba708cfed..c6a3fab5b0c4 100644
> --- a/drivers/gpu/drm/mga/mga_irq.c
> +++ b/drivers/gpu/drm/mga/mga_irq.c
> @@ -122,19 +122,19 @@ int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence)
>  {
>  	drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
>  	unsigned int cur_fence;
> -	int ret = 0;
>  
>  	/* Assume that the user has missed the current sequence number
>  	 * by about a day rather than she wants to wait for years
>  	 * using fences.
>  	 */
> -	DRM_WAIT_ON(ret, dev_priv->fence_queue, 3 * HZ,
> +	wait_event_timeout(dev_priv->fence_queue,
>  		    (((cur_fence = atomic_read(&dev_priv->last_fence_retired))
> -		      - *sequence) <= (1 << 23)));
> +		      - *sequence) <= (1 << 23)),
> +		    msecs_to_jiffies(30));
>  
>  	*sequence = cur_fence;
>  
> -	return ret;
> +	return 0;
>  }
>  
>  void mga_driver_irq_preinstall(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/mga/mga_state.c b/drivers/gpu/drm/mga/mga_state.c
> index e5f6b735f575..296a1db7e5ee 100644
> --- a/drivers/gpu/drm/mga/mga_state.c
> +++ b/drivers/gpu/drm/mga/mga_state.c
> @@ -1016,7 +1016,7 @@ int mga_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv)
>  		return -EINVAL;
>  	}
>  
> -	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
> +	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
>  
>  	switch (param->param) {
>  	case MGA_PARAM_IRQ_NR:
> @@ -1048,7 +1048,7 @@ static int mga_set_fence(struct drm_device *dev, void *data, struct drm_file *fi
>  		return -EINVAL;
>  	}
>  
> -	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
> +	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
>  
>  	/* I would normal do this assignment in the declaration of fence,
>  	 * but dev_priv may be NULL.
> @@ -1077,7 +1077,7 @@ file_priv)
>  		return -EINVAL;
>  	}
>  
> -	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
> +	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
>  
>  	mga_driver_fence_wait(dev, fence);
>  	return 0;
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v1 3/4] drm/mga: drop use of drmP.h
  2019-06-08  8:19 ` [PATCH v1 3/4] drm/mga: drop use of drmP.h Sam Ravnborg
@ 2019-06-11  7:53   ` Thomas Zimmermann
  2019-06-11  8:54     ` Daniel Vetter
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Zimmermann @ 2019-06-11  7:53 UTC (permalink / raw)
  To: Sam Ravnborg, dri-devel; +Cc: David Airlie


[-- Attachment #1.1.1: Type: text/plain, Size: 4105 bytes --]

Hi

Am 08.06.19 um 10:19 schrieb Sam Ravnborg:
> Drop the use of the deprecated drmP.h header file.
> Clean up list of include files and sort them.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> ---
>  drivers/gpu/drm/mga/mga_dma.c   | 2 --
>  drivers/gpu/drm/mga/mga_drv.c   | 7 +++----
>  drivers/gpu/drm/mga/mga_ioc32.c | 3 +--
>  drivers/gpu/drm/mga/mga_irq.c   | 2 --
>  drivers/gpu/drm/mga/mga_state.c | 2 --
>  drivers/gpu/drm/mga/mga_warp.c  | 4 +---
>  6 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
> index 123be2f3a151..139554a3733d 100644
> --- a/drivers/gpu/drm/mga/mga_dma.c
> +++ b/drivers/gpu/drm/mga/mga_dma.c
> @@ -37,8 +37,6 @@
>  
>  #include <linux/delay.h>
>  
> -#include <drm/drmP.h>
> -#include <drm/mga_drm.h>
>  #include "mga_drv.h"
>  
>  #define MGA_DEFAULT_USEC_TIMEOUT	10000
> diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
> index 6e1d1054ad06..71128e6f6ae9 100644
> --- a/drivers/gpu/drm/mga/mga_drv.c
> +++ b/drivers/gpu/drm/mga/mga_drv.c
> @@ -31,12 +31,11 @@
>  
>  #include <linux/module.h>
>  
> -#include <drm/drmP.h>
> -#include <drm/mga_drm.h>
> -#include "mga_drv.h"
> -
> +#include <drm/drm_drv.h>
>  #include <drm/drm_pciids.h>
>  
> +#include "mga_drv.h"
> +

Unless it violates an existing convention, I'd suggest the following
order for headers (here and in the other patches):

 c file header ("mga_foo.h" for mga_foo.c)
 driver header ("mga_drv.h")
 public linux/drm headers
 other driver headers ("mga_nonfoo.h", etc)

I know that it's nitpicking, but this maximizes the chance that the
driver's header files include all dependencies they need.

Best regards
Thomas


>  static struct pci_device_id pciidlist[] = {
>  	mga_PCI_IDS
>  };
> diff --git a/drivers/gpu/drm/mga/mga_ioc32.c b/drivers/gpu/drm/mga/mga_ioc32.c
> index 245fb2e359cf..6ccd270789c6 100644
> --- a/drivers/gpu/drm/mga/mga_ioc32.c
> +++ b/drivers/gpu/drm/mga/mga_ioc32.c
> @@ -30,10 +30,9 @@
>   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>   * IN THE SOFTWARE.
>   */
> +
>  #include <linux/compat.h>
>  
> -#include <drm/drmP.h>
> -#include <drm/mga_drm.h>
>  #include "mga_drv.h"
>  
>  typedef struct drm32_mga_init {
> diff --git a/drivers/gpu/drm/mga/mga_irq.c b/drivers/gpu/drm/mga/mga_irq.c
> index c6a3fab5b0c4..7c48f4d090ac 100644
> --- a/drivers/gpu/drm/mga/mga_irq.c
> +++ b/drivers/gpu/drm/mga/mga_irq.c
> @@ -31,8 +31,6 @@
>   *    Eric Anholt <anholt@FreeBSD.org>
>   */
>  
> -#include <drm/drmP.h>
> -#include <drm/mga_drm.h>
>  #include "mga_drv.h"
>  
>  u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> diff --git a/drivers/gpu/drm/mga/mga_state.c b/drivers/gpu/drm/mga/mga_state.c
> index 296a1db7e5ee..77a0b006f066 100644
> --- a/drivers/gpu/drm/mga/mga_state.c
> +++ b/drivers/gpu/drm/mga/mga_state.c
> @@ -32,8 +32,6 @@
>   *    Gareth Hughes <gareth@valinux.com>
>   */
>  
> -#include <drm/drmP.h>
> -#include <drm/mga_drm.h>
>  #include "mga_drv.h"
>  
>  /* ================================================================
> diff --git a/drivers/gpu/drm/mga/mga_warp.c b/drivers/gpu/drm/mga/mga_warp.c
> index 0b76352260a9..b5ef1d2c8b1c 100644
> --- a/drivers/gpu/drm/mga/mga_warp.c
> +++ b/drivers/gpu/drm/mga/mga_warp.c
> @@ -29,11 +29,9 @@
>  
>  #include <linux/firmware.h>
>  #include <linux/ihex.h>
> -#include <linux/platform_device.h>
>  #include <linux/module.h>
> +#include <linux/platform_device.h>
>  
> -#include <drm/drmP.h>
> -#include <drm/mga_drm.h>
>  #include "mga_drv.h"
>  
>  #define FIRMWARE_G200 "matrox/g200_warp.fw"
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v1 0/4] drm/{mga,mgag200}: drop use of drmP.h
  2019-06-08  8:19 [PATCH v1 0/4] drm/{mga,mgag200}: drop use of drmP.h Sam Ravnborg
                   ` (3 preceding siblings ...)
  2019-06-08  8:19 ` [PATCH v1 4/4] drm/mgag200: " Sam Ravnborg
@ 2019-06-11  7:55 ` Thomas Zimmermann
  4 siblings, 0 replies; 12+ messages in thread
From: Thomas Zimmermann @ 2019-06-11  7:55 UTC (permalink / raw)
  To: Sam Ravnborg, dri-devel; +Cc: David Airlie


[-- Attachment #1.1.1: Type: text/plain, Size: 1830 bytes --]

Hi

Thanks a lot. There's some bike shedding in my other replies, but generally

  Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regard
Thomas

Am 08.06.19 um 10:19 schrieb Sam Ravnborg:
> Drop use of the deprecated drmP.h header file.
> Also drop use of drm_os_linux.h as it is deprecated too,
> and was pulled in via drmP.h
> 
> Build tested with allmodconfig, allyesconfig on
> various architectures.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> 
> Sam Ravnborg (4):
>       drm/mga: drop dependency on drm_os_linux.h
>       drm/mga: make header file self contained
>       drm/mga: drop use of drmP.h
>       drm/mgag200: drop use of drmP.h
> 
>  drivers/gpu/drm/mga/mga_dma.c            | 14 ++++++++------
>  drivers/gpu/drm/mga/mga_drv.c            |  7 +++----
>  drivers/gpu/drm/mga/mga_drv.h            | 25 +++++++++++++++++++++----
>  drivers/gpu/drm/mga/mga_ioc32.c          |  3 +--
>  drivers/gpu/drm/mga/mga_irq.c            | 10 ++++------
>  drivers/gpu/drm/mga/mga_state.c          |  8 +++-----
>  drivers/gpu/drm/mga/mga_warp.c           |  4 +---
>  drivers/gpu/drm/mgag200/mgag200_cursor.c |  3 ++-
>  drivers/gpu/drm/mgag200/mgag200_drv.c    | 10 +++++++---
>  drivers/gpu/drm/mgag200/mgag200_drv.h    |  8 +++-----
>  drivers/gpu/drm/mgag200/mgag200_fb.c     |  8 +++++---
>  drivers/gpu/drm/mgag200/mgag200_i2c.c    |  6 ++++--
>  drivers/gpu/drm/mgag200/mgag200_main.c   |  4 +++-
>  drivers/gpu/drm/mgag200/mgag200_mode.c   |  3 ++-
>  drivers/gpu/drm/mgag200/mgag200_ttm.c    |  3 ++-
>  15 files changed, 69 insertions(+), 47 deletions(-)
> 
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v1 3/4] drm/mga: drop use of drmP.h
  2019-06-11  7:53   ` Thomas Zimmermann
@ 2019-06-11  8:54     ` Daniel Vetter
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2019-06-11  8:54 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: David Airlie, Sam Ravnborg, dri-devel

On Tue, Jun 11, 2019 at 09:53:51AM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 08.06.19 um 10:19 schrieb Sam Ravnborg:
> > Drop the use of the deprecated drmP.h header file.
> > Clean up list of include files and sort them.
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: David Airlie <airlied@linux.ie>
> > ---
> >  drivers/gpu/drm/mga/mga_dma.c   | 2 --
> >  drivers/gpu/drm/mga/mga_drv.c   | 7 +++----
> >  drivers/gpu/drm/mga/mga_ioc32.c | 3 +--
> >  drivers/gpu/drm/mga/mga_irq.c   | 2 --
> >  drivers/gpu/drm/mga/mga_state.c | 2 --
> >  drivers/gpu/drm/mga/mga_warp.c  | 4 +---
> >  6 files changed, 5 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
> > index 123be2f3a151..139554a3733d 100644
> > --- a/drivers/gpu/drm/mga/mga_dma.c
> > +++ b/drivers/gpu/drm/mga/mga_dma.c
> > @@ -37,8 +37,6 @@
> >  
> >  #include <linux/delay.h>
> >  
> > -#include <drm/drmP.h>
> > -#include <drm/mga_drm.h>
> >  #include "mga_drv.h"
> >  
> >  #define MGA_DEFAULT_USEC_TIMEOUT	10000
> > diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
> > index 6e1d1054ad06..71128e6f6ae9 100644
> > --- a/drivers/gpu/drm/mga/mga_drv.c
> > +++ b/drivers/gpu/drm/mga/mga_drv.c
> > @@ -31,12 +31,11 @@
> >  
> >  #include <linux/module.h>
> >  
> > -#include <drm/drmP.h>
> > -#include <drm/mga_drm.h>
> > -#include "mga_drv.h"
> > -
> > +#include <drm/drm_drv.h>
> >  #include <drm/drm_pciids.h>
> >  
> > +#include "mga_drv.h"
> > +
> 
> Unless it violates an existing convention, I'd suggest the following
> order for headers (here and in the other patches):
> 
>  c file header ("mga_foo.h" for mga_foo.c)
>  driver header ("mga_drv.h")
>  public linux/drm headers
>  other driver headers ("mga_nonfoo.h", etc)
> 
> I know that it's nitpicking, but this maximizes the chance that the
> driver's header files include all dependencies they need.

Hm I think generally we go the other way round in linux:

#include <asm/*.h>
#include <linux/*.h>
#include <drm/*.h>

#include "*.h"

Cheers, Daniel

> 
> Best regards
> Thomas
> 
> 
> >  static struct pci_device_id pciidlist[] = {
> >  	mga_PCI_IDS
> >  };
> > diff --git a/drivers/gpu/drm/mga/mga_ioc32.c b/drivers/gpu/drm/mga/mga_ioc32.c
> > index 245fb2e359cf..6ccd270789c6 100644
> > --- a/drivers/gpu/drm/mga/mga_ioc32.c
> > +++ b/drivers/gpu/drm/mga/mga_ioc32.c
> > @@ -30,10 +30,9 @@
> >   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> >   * IN THE SOFTWARE.
> >   */
> > +
> >  #include <linux/compat.h>
> >  
> > -#include <drm/drmP.h>
> > -#include <drm/mga_drm.h>
> >  #include "mga_drv.h"
> >  
> >  typedef struct drm32_mga_init {
> > diff --git a/drivers/gpu/drm/mga/mga_irq.c b/drivers/gpu/drm/mga/mga_irq.c
> > index c6a3fab5b0c4..7c48f4d090ac 100644
> > --- a/drivers/gpu/drm/mga/mga_irq.c
> > +++ b/drivers/gpu/drm/mga/mga_irq.c
> > @@ -31,8 +31,6 @@
> >   *    Eric Anholt <anholt@FreeBSD.org>
> >   */
> >  
> > -#include <drm/drmP.h>
> > -#include <drm/mga_drm.h>
> >  #include "mga_drv.h"
> >  
> >  u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> > diff --git a/drivers/gpu/drm/mga/mga_state.c b/drivers/gpu/drm/mga/mga_state.c
> > index 296a1db7e5ee..77a0b006f066 100644
> > --- a/drivers/gpu/drm/mga/mga_state.c
> > +++ b/drivers/gpu/drm/mga/mga_state.c
> > @@ -32,8 +32,6 @@
> >   *    Gareth Hughes <gareth@valinux.com>
> >   */
> >  
> > -#include <drm/drmP.h>
> > -#include <drm/mga_drm.h>
> >  #include "mga_drv.h"
> >  
> >  /* ================================================================
> > diff --git a/drivers/gpu/drm/mga/mga_warp.c b/drivers/gpu/drm/mga/mga_warp.c
> > index 0b76352260a9..b5ef1d2c8b1c 100644
> > --- a/drivers/gpu/drm/mga/mga_warp.c
> > +++ b/drivers/gpu/drm/mga/mga_warp.c
> > @@ -29,11 +29,9 @@
> >  
> >  #include <linux/firmware.h>
> >  #include <linux/ihex.h>
> > -#include <linux/platform_device.h>
> >  #include <linux/module.h>
> > +#include <linux/platform_device.h>
> >  
> > -#include <drm/drmP.h>
> > -#include <drm/mga_drm.h>
> >  #include "mga_drv.h"
> >  
> >  #define FIRMWARE_G200 "matrox/g200_warp.fw"
> > 
> 
> -- 
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
> HRB 21284 (AG Nürnberg)
> 




-- 
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] 12+ messages in thread

* Re: [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h
  2019-06-11  7:48   ` Thomas Zimmermann
@ 2019-06-11  8:55     ` Daniel Vetter
  2019-06-11 10:44     ` Sam Ravnborg
  1 sibling, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2019-06-11  8:55 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: David Airlie, Sam Ravnborg, dri-devel

On Tue, Jun 11, 2019 at 09:48:16AM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 08.06.19 um 10:19 schrieb Sam Ravnborg:
> > Opencode all macros used from the deprecated drm_os_linux.h header file.
> > The DRM_WAIT_ON used 3 * HZ as timeout.
> > This was translated to 30 msec.
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: David Airlie <airlied@linux.ie>
> > ---
> >  drivers/gpu/drm/mga/mga_dma.c   | 12 ++++++++----
> >  drivers/gpu/drm/mga/mga_drv.h   | 12 ++++++++----
> >  drivers/gpu/drm/mga/mga_irq.c   |  8 ++++----
> >  drivers/gpu/drm/mga/mga_state.c |  6 +++---
> >  4 files changed, 23 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
> > index 1ffdafea27e4..123be2f3a151 100644
> > --- a/drivers/gpu/drm/mga/mga_dma.c
> > +++ b/drivers/gpu/drm/mga/mga_dma.c
> > @@ -35,6 +35,8 @@
> >   * \author Gareth Hughes <gareth@valinux.com>
> >   */
> >  
> > +#include <linux/delay.h>
> > +
> >  #include <drm/drmP.h>
> >  #include <drm/mga_drm.h>
> >  #include "mga_drv.h"
> > @@ -62,7 +64,7 @@ int mga_do_wait_for_idle(drm_mga_private_t *dev_priv)
> >  			MGA_WRITE8(MGA_CRTC_INDEX, 0);
> >  			return 0;
> >  		}
> > -		DRM_UDELAY(1);
> > +		udelay(1);
> >  	}
> >  
> >  #if MGA_DMA_DEBUG
> > @@ -114,7 +116,7 @@ void mga_do_dma_flush(drm_mga_private_t *dev_priv)
> >  		status = MGA_READ(MGA_STATUS) & MGA_ENGINE_IDLE_MASK;
> >  		if (status == MGA_ENDPRDMASTS)
> >  			break;
> > -		DRM_UDELAY(1);
> > +		udelay(1);
> >  	}
> >  
> >  	if (primary->tail == primary->last_flush) {
> > @@ -1120,7 +1122,7 @@ int mga_dma_buffers(struct drm_device *dev, void *data,
> >  	 */
> >  	if (d->send_count != 0) {
> >  		DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
> > -			  DRM_CURRENTPID, d->send_count);
> > +			  task_pid_nr(current), d->send_count);
> >  		return -EINVAL;
> >  	}
> >  
> > @@ -1128,7 +1130,9 @@ int mga_dma_buffers(struct drm_device *dev, void *data,
> >  	 */
> >  	if (d->request_count < 0 || d->request_count > dma->buf_count) {
> >  		DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
> > -			  DRM_CURRENTPID, d->request_count, dma->buf_count);
> > +			  task_pid_nr(current),
> > +			  d->request_count,
> > +			  dma->buf_count);
> >  		return -EINVAL;
> >  	}
> >  
> > diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
> > index a45bb22275a7..7844a9e463f6 100644
> > --- a/drivers/gpu/drm/mga/mga_drv.h
> > +++ b/drivers/gpu/drm/mga/mga_drv.h
> > @@ -199,10 +199,14 @@ extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
> >  
> >  #define mga_flush_write_combine()	wmb()
> >  
> > -#define MGA_READ8(reg)		DRM_READ8(dev_priv->mmio, (reg))
> > -#define MGA_READ(reg)		DRM_READ32(dev_priv->mmio, (reg))
> > -#define MGA_WRITE8(reg, val)	DRM_WRITE8(dev_priv->mmio, (reg), (val))
> > -#define MGA_WRITE(reg, val)	DRM_WRITE32(dev_priv->mmio, (reg), (val))
> > +#define MGA_READ8(reg) \
> > +	readb(((void __iomem *)dev_priv->mmio->handle) + (reg))
> > +#define MGA_READ(reg) \
> > +	readl(((void __iomem *)dev_priv->mmio->handle) + (reg))
> > +#define MGA_WRITE8(reg, val) \
> > +	writeb(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
> > +#define MGA_WRITE(reg, val) \
> > +	writel(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
> 
> Addition is not defined or implementation specific for type void* IIRC.
> Compilers tend to treat it like u8*. Maybe cast mmio->handle to (u8
> __iomem *) instead?

drm_os_linux.h has depended upon this gcc-ism since decades by now, I
think it's ok to leave this as-is :-)
-Daniel

> 
> Best regards
> Thomas
> 
> >  
> >  #define DWGREG0		0x1c00
> >  #define DWGREG0_END	0x1dff
> > diff --git a/drivers/gpu/drm/mga/mga_irq.c b/drivers/gpu/drm/mga/mga_irq.c
> > index 693ba708cfed..c6a3fab5b0c4 100644
> > --- a/drivers/gpu/drm/mga/mga_irq.c
> > +++ b/drivers/gpu/drm/mga/mga_irq.c
> > @@ -122,19 +122,19 @@ int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence)
> >  {
> >  	drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
> >  	unsigned int cur_fence;
> > -	int ret = 0;
> >  
> >  	/* Assume that the user has missed the current sequence number
> >  	 * by about a day rather than she wants to wait for years
> >  	 * using fences.
> >  	 */
> > -	DRM_WAIT_ON(ret, dev_priv->fence_queue, 3 * HZ,
> > +	wait_event_timeout(dev_priv->fence_queue,
> >  		    (((cur_fence = atomic_read(&dev_priv->last_fence_retired))
> > -		      - *sequence) <= (1 << 23)));
> > +		      - *sequence) <= (1 << 23)),
> > +		    msecs_to_jiffies(30));
> >  
> >  	*sequence = cur_fence;
> >  
> > -	return ret;
> > +	return 0;
> >  }
> >  
> >  void mga_driver_irq_preinstall(struct drm_device *dev)
> > diff --git a/drivers/gpu/drm/mga/mga_state.c b/drivers/gpu/drm/mga/mga_state.c
> > index e5f6b735f575..296a1db7e5ee 100644
> > --- a/drivers/gpu/drm/mga/mga_state.c
> > +++ b/drivers/gpu/drm/mga/mga_state.c
> > @@ -1016,7 +1016,7 @@ int mga_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv)
> >  		return -EINVAL;
> >  	}
> >  
> > -	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
> > +	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
> >  
> >  	switch (param->param) {
> >  	case MGA_PARAM_IRQ_NR:
> > @@ -1048,7 +1048,7 @@ static int mga_set_fence(struct drm_device *dev, void *data, struct drm_file *fi
> >  		return -EINVAL;
> >  	}
> >  
> > -	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
> > +	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
> >  
> >  	/* I would normal do this assignment in the declaration of fence,
> >  	 * but dev_priv may be NULL.
> > @@ -1077,7 +1077,7 @@ file_priv)
> >  		return -EINVAL;
> >  	}
> >  
> > -	DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
> > +	DRM_DEBUG("pid=%d\n", task_pid_nr(current));
> >  
> >  	mga_driver_fence_wait(dev, fence);
> >  	return 0;
> > 
> 
> -- 
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
> HRB 21284 (AG Nürnberg)
> 




-- 
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] 12+ messages in thread

* Re: [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h
  2019-06-11  7:48   ` Thomas Zimmermann
  2019-06-11  8:55     ` Daniel Vetter
@ 2019-06-11 10:44     ` Sam Ravnborg
  2019-06-11 10:58       ` Thomas Zimmermann
  1 sibling, 1 reply; 12+ messages in thread
From: Sam Ravnborg @ 2019-06-11 10:44 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: David Airlie, dri-devel

Hi Thomas.

> > +#define MGA_READ8(reg) \
> > +	readb(((void __iomem *)dev_priv->mmio->handle) + (reg))
> > +#define MGA_READ(reg) \
> > +	readl(((void __iomem *)dev_priv->mmio->handle) + (reg))
> > +#define MGA_WRITE8(reg, val) \
> > +	writeb(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
> > +#define MGA_WRITE(reg, val) \
> > +	writel(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
> 
> Addition is not defined or implementation specific for type void* IIRC.
> Compilers tend to treat it like u8*. Maybe cast mmio->handle to (u8
> __iomem *) instead?
I briefly looked at changing the type of mmio->handle

Today:

	void *handle;            /**< User-space: "Handle" to pass to mmap() */

Proposal:
	void __iomem *handle;            /**< User-space: "Handle" to pass to mmap() */

This would allow me to drop the cast in the code above, that is only
added to make sparse happy.
But the above triggered other sparse warnings and I ended up dropping
this.

As for (void *) versus (u8 *), then (void *) is what we do today.
[What Daniel also says in another mail].

Should we change the type I would prepfer a follow-up patch to do it.

If you could test it I can type the patch, or you could do so when
working with the driver.

	Sam
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h
  2019-06-11 10:44     ` Sam Ravnborg
@ 2019-06-11 10:58       ` Thomas Zimmermann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Zimmermann @ 2019-06-11 10:58 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, dri-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1961 bytes --]

Hi

Am 11.06.19 um 12:44 schrieb Sam Ravnborg:
> Hi Thomas.
> 
>>> +#define MGA_READ8(reg) \
>>> +	readb(((void __iomem *)dev_priv->mmio->handle) + (reg))
>>> +#define MGA_READ(reg) \
>>> +	readl(((void __iomem *)dev_priv->mmio->handle) + (reg))
>>> +#define MGA_WRITE8(reg, val) \
>>> +	writeb(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
>>> +#define MGA_WRITE(reg, val) \
>>> +	writel(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
>>
>> Addition is not defined or implementation specific for type void* IIRC.
>> Compilers tend to treat it like u8*. Maybe cast mmio->handle to (u8
>> __iomem *) instead?
> I briefly looked at changing the type of mmio->handle
> 
> Today:
> 
> 	void *handle;            /**< User-space: "Handle" to pass to mmap() */
> 
> Proposal:
> 	void __iomem *handle;            /**< User-space: "Handle" to pass to mmap() */
> 
> This would allow me to drop the cast in the code above, that is only
> added to make sparse happy.
> But the above triggered other sparse warnings and I ended up dropping
> this.
> 
> As for (void *) versus (u8 *), then (void *) is what we do today.
> [What Daniel also says in another mail].
> 
> Should we change the type I would prepfer a follow-up patch to do it.
> 
> If you could test it I can type the patch, or you could do so when
> working with the driver.

I don't really do anything with mga, so my testing is as good as
anyone's. But it's not that important. Don't make this patch set depend
on such mostly cosmetic issues.

Best regards
Thomas


> 
> 	Sam
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-06-11 10:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-08  8:19 [PATCH v1 0/4] drm/{mga,mgag200}: drop use of drmP.h Sam Ravnborg
2019-06-08  8:19 ` [PATCH v1 1/4] drm/mga: drop dependency on drm_os_linux.h Sam Ravnborg
2019-06-11  7:48   ` Thomas Zimmermann
2019-06-11  8:55     ` Daniel Vetter
2019-06-11 10:44     ` Sam Ravnborg
2019-06-11 10:58       ` Thomas Zimmermann
2019-06-08  8:19 ` [PATCH v1 2/4] drm/mga: make header file self contained Sam Ravnborg
2019-06-08  8:19 ` [PATCH v1 3/4] drm/mga: drop use of drmP.h Sam Ravnborg
2019-06-11  7:53   ` Thomas Zimmermann
2019-06-11  8:54     ` Daniel Vetter
2019-06-08  8:19 ` [PATCH v1 4/4] drm/mgag200: " Sam Ravnborg
2019-06-11  7:55 ` [PATCH v1 0/4] drm/{mga,mgag200}: " Thomas Zimmermann

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.