From: David Herrmann <dh.herrmann@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 1/2] drm: remove agp_init() bus callback
Date: Sat, 19 Oct 2013 13:58:19 +0200 [thread overview]
Message-ID: <1382183900-19302-1-git-send-email-dh.herrmann@gmail.com> (raw)
The PCI bus helper is the only user of it. Call it directly before
device-registration to get rid of the callback.
Note that all drm_agp_*() calls are locked with the drm-global-mutex so we
need to explicitly lock it during initialization. It's not really clear
why it's needed, but lets be safe.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
Hi
If someone wants to review drm_agpsupport.c and tell me why _all_ calls to
drm_agp_*() functions currently hold the global mutex, I'd be happy to hear it.
Otherwise, I will just not care for that old stuff and keep the semantics with
the kind of ugly locks around drm_pci_agp_*().
Thanks
David
drivers/gpu/drm/drm_pci.c | 13 +++++++++++--
drivers/gpu/drm/drm_stub.c | 11 +----------
include/drm/drmP.h | 1 -
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index f00d7a9..7d3435c 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -299,7 +299,6 @@ static struct drm_bus drm_pci_bus = {
.set_busid = drm_pci_set_busid,
.set_unique = drm_pci_set_unique,
.irq_by_busid = drm_pci_irq_by_busid,
- .agp_init = drm_pci_agp_init,
.agp_destroy = drm_pci_agp_destroy,
};
@@ -338,16 +337,26 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
if (drm_core_check_feature(dev, DRIVER_MODESET))
pci_set_drvdata(pdev, dev);
- ret = drm_dev_register(dev, ent->driver_data);
+ mutex_lock(&drm_global_mutex);
+ ret = drm_pci_agp_init(dev);
+ mutex_unlock(&drm_global_mutex);
if (ret)
goto err_pci;
+ ret = drm_dev_register(dev, ent->driver_data);
+ if (ret)
+ goto err_agp;
+
DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
driver->name, driver->major, driver->minor, driver->patchlevel,
driver->date, pci_name(pdev), dev->primary->index);
return 0;
+err_agp:
+ mutex_lock(&drm_global_mutex);
+ drm_pci_agp_destroy(dev);
+ mutex_unlock(&drm_global_mutex);
err_pci:
pci_disable_device(pdev);
err_free:
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 26055ab..ac211c3 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -502,16 +502,10 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
mutex_lock(&drm_global_mutex);
- if (dev->driver->bus->agp_init) {
- ret = dev->driver->bus->agp_init(dev);
- if (ret)
- goto out_unlock;
- }
-
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
if (ret)
- goto err_agp;
+ goto out_unlock;
}
if (drm_core_check_feature(dev, DRIVER_RENDER) && drm_rnodes) {
@@ -554,9 +548,6 @@ err_render_node:
err_control_node:
if (dev->control)
drm_put_minor(&dev->control);
-err_agp:
- if (dev->driver->bus->agp_destroy)
- dev->driver->bus->agp_destroy(dev);
out_unlock:
mutex_unlock(&drm_global_mutex);
return ret;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2b954ad..dfc44ae 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -750,7 +750,6 @@ struct drm_bus {
struct drm_unique *unique);
int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
/* hooks that are for PCI */
- int (*agp_init)(struct drm_device *dev);
void (*agp_destroy)(struct drm_device *dev);
};
--
1.8.4.1
next reply other threads:[~2013-10-19 11:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-19 11:58 David Herrmann [this message]
2013-10-19 11:58 ` [PATCH 2/2] drm: rename agp_destroy() bus-cb to destroy() David Herrmann
2013-11-03 11:06 ` [PATCH 1/2] drm: remove agp_init() bus callback David Herrmann
2013-11-03 11:36 ` Daniel Vetter
2013-11-03 11:43 ` David Herrmann
2013-11-03 12:31 ` Daniel Vetter
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=1382183900-19302-1-git-send-email-dh.herrmann@gmail.com \
--to=dh.herrmann@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox