linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@gmail.com>
To: Christoph Hellwig <hch@infradead.org>,
	Jon Smirl <jonsmirl@gmail.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH} Trivial - fix drm_agp symbol export
Date: Sun, 24 Oct 2004 00:28:18 +1000	[thread overview]
Message-ID: <21d7e99704102307287a08247@mail.gmail.com> (raw)
In-Reply-To: <20041023095644.GC30137@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

> 
> Sorry, wrong API.  At least export the individual functions and use them
> directly (and without the symbol_get abnomination that's not any better
> than inter_module_*).

I wonder what the reasoning behind the old drm_agp structure was in
the first place?

What about this patch?

The 2.6 kernel module stuff should sort out the dependencies itself, I
haven't had a chance to test this yet....

Dave.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: new_drm_agp.patch --]
[-- Type: text/x-patch; name="new_drm_agp.patch", Size: 5437 bytes --]

===== drivers/char/drm/drm_agpsupport.h 1.29 vs edited =====
--- 1.29/drivers/char/drm/drm_agpsupport.h	2004-09-05 09:22:42 +10:00
+++ edited/drivers/char/drm/drm_agpsupport.h	2004-10-24 00:21:46 +10:00
@@ -36,14 +36,6 @@
 
 #if __OS_HAS_AGP
 
-#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
-#define DRM_AGP_PUT inter_module_put("drm_agp")
-
-/**
- * Pointer to the drm_agp_t structure made available by the agpgart module.
- */
-static const drm_agp_t *drm_agp = NULL;
-
 /**
  * AGP information ioctl.
  *
@@ -64,7 +56,7 @@
 	DRM_AGP_KERN     *kern;
 	drm_agp_info_t   info;
 
-	if (!dev->agp || !dev->agp->acquired || !drm_agp->copy_info)
+	if (!dev->agp || !dev->agp->acquired)
 		return -EINVAL;
 
 	kern                   = &dev->agp->agp_info;
@@ -93,7 +85,7 @@
  * \return zero on success or a negative number on failure. 
  *
  * Verifies the AGP device hasn't been acquired before and calls
- * drm_agp->acquire().
+ * agp_backend_acquire().
  */
 int DRM(agp_acquire)(struct inode *inode, struct file *filp,
 		     unsigned int cmd, unsigned long arg)
@@ -106,9 +98,7 @@
 		return -ENODEV;
 	if (dev->agp->acquired)
 		return -EBUSY;
-	if (!drm_agp->acquire)
-		return -EINVAL;
-	if ((retcode = drm_agp->acquire()))
+	if ((retcode = agp_backend_acquire()))
 		return retcode;
 	dev->agp->acquired = 1;
 	return 0;
@@ -123,7 +113,7 @@
  * \param arg user argument.
  * \return zero on success or a negative number on failure.
  *
- * Verifies the AGP device has been acquired and calls drm_agp->release().
+ * Verifies the AGP device has been acquired and calls agp_backend_release().
  */
 int DRM(agp_release)(struct inode *inode, struct file *filp,
 		     unsigned int cmd, unsigned long arg)
@@ -131,9 +121,9 @@
 	drm_file_t	 *priv	 = filp->private_data;
 	drm_device_t	 *dev	 = priv->dev;
 
-	if (!dev->agp || !dev->agp->acquired || !drm_agp->release)
+	if (!dev->agp || !dev->agp->acquired)
 		return -EINVAL;
-	drm_agp->release();
+	agp_backend_release();
 	dev->agp->acquired = 0;
 	return 0;
 
@@ -142,12 +132,11 @@
 /**
  * Release the AGP device.
  *
- * Calls drm_agp->release().
+ * Calls agp_backend_release().
  */
 void DRM(agp_do_release)(void)
 {
-	if (drm_agp->release)
-		drm_agp->release();
+	agp_backend_release();
 }
 
 /**
@@ -169,14 +158,14 @@
 	drm_device_t	 *dev	 = priv->dev;
 	drm_agp_mode_t   mode;
 
-	if (!dev->agp || !dev->agp->acquired || !drm_agp->enable)
+	if (!dev->agp || !dev->agp->acquired)
 		return -EINVAL;
 
 	if (copy_from_user(&mode, (drm_agp_mode_t __user *)arg, sizeof(mode)))
 		return -EFAULT;
 
 	dev->agp->mode    = mode.mode;
-	drm_agp->enable(mode.mode);
+	agp_enable(mode.mode);
 	dev->agp->base    = dev->agp->agp_info.aper_base;
 	dev->agp->enabled = 1;
 	return 0;
@@ -325,7 +314,7 @@
 	int               retcode;
 	int               page;
 
-	if (!dev->agp || !dev->agp->acquired || !drm_agp->bind_memory)
+	if (!dev->agp || !dev->agp->acquired)
 		return -EINVAL;
 	if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request)))
 		return -EFAULT;
@@ -399,25 +388,17 @@
 {
 	drm_agp_head_t *head         = NULL;
 
-	drm_agp = DRM_AGP_GET;
-	if (drm_agp) {
-		if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS)))
-			return NULL;
-		memset((void *)head, 0, sizeof(*head));
-		drm_agp->copy_info(&head->agp_info);
-		if (head->agp_info.chipset == NOT_SUPPORTED) {
-			DRM(free)(head, sizeof(*head), DRM_MEM_AGPLISTS);
-			return NULL;
-		}
-		head->memory = NULL;
-#if LINUX_VERSION_CODE <= 0x020408
-		head->cant_use_aperture = 0;
-		head->page_mask = ~(0xfff);
-#else
-		head->cant_use_aperture = head->agp_info.cant_use_aperture;
-		head->page_mask = head->agp_info.page_mask;
-#endif
+	if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS)))
+		return NULL;
+	memset((void *)head, 0, sizeof(*head));
+	agp_copy_info(&head->agp_info);
+	if (head->agp_info.chipset == NOT_SUPPORTED) {
+		DRM(free)(head, sizeof(*head), DRM_MEM_AGPLISTS);
+		return NULL;
 	}
+	head->memory = NULL;
+	head->cant_use_aperture = head->agp_info.cant_use_aperture;
+	head->page_mask = head->agp_info.page_mask;
 	return head;
 }
 
@@ -428,41 +409,37 @@
  */
 void DRM(agp_uninit)(void)
 {
-	DRM_AGP_PUT;
-	drm_agp = NULL;
 }
 
 /** Calls drm_agp->allocate_memory() */
 DRM_AGP_MEM *DRM(agp_allocate_memory)(size_t pages, u32 type)
 {
-	if (!drm_agp->allocate_memory)
-		return NULL;
-	return drm_agp->allocate_memory(pages, type);
+	return agp_allocate_memory(pages, type);
 }
 
 /** Calls drm_agp->free_memory() */
 int DRM(agp_free_memory)(DRM_AGP_MEM *handle)
 {
-	if (!handle || !drm_agp->free_memory)
+	if (!handle)
 		return 0;
-	drm_agp->free_memory(handle);
+	agp_free_memory(handle);
 	return 1;
 }
 
 /** Calls drm_agp->bind_memory() */
 int DRM(agp_bind_memory)(DRM_AGP_MEM *handle, off_t start)
 {
-	if (!handle || !drm_agp->bind_memory)
+	if (!handle)
 		return -EINVAL;
-	return drm_agp->bind_memory(handle, start);
+	return agp_bind_memory(handle, start);
 }
 
 /** Calls drm_agp->unbind_memory() */
 int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle)
 {
-	if (!handle || !drm_agp->unbind_memory)
+	if (!handle)
 		return -EINVAL;
-	return drm_agp->unbind_memory(handle);
+	return agp_unbind_memory(handle);
 }
 
 #endif /* __OS_HAS_AGP */

  reply	other threads:[~2004-10-23 14:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-23  4:45 [PATCH} Trivial - fix drm_agp symbol export Jon Smirl
2004-10-23  9:56 ` Christoph Hellwig
2004-10-23 14:28   ` Dave Airlie [this message]
2004-10-23 14:33     ` Christoph Hellwig
2004-10-23 18:13     ` Jon Smirl
2004-10-23 14:35   ` Jon Smirl
2004-10-23 14:39     ` Christoph Hellwig
2004-10-23 14:44       ` Jon Smirl
2004-10-23 14:48         ` Dave Airlie
2004-10-23 14:54           ` Jon Smirl
2004-10-23 15:00             ` Dave Airlie
2004-10-23 14:46     ` Arjan van de Ven
2004-10-23 18:22   ` Jon Smirl
2004-11-01  6:01     ` Rusty Russell
2004-11-01  6:37       ` Jon Smirl
2004-11-01  7:41         ` Dave Airlie

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=21d7e99704102307287a08247@mail.gmail.com \
    --to=airlied@gmail.com \
    --cc=hch@infradead.org \
    --cc=jonsmirl@gmail.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).