From patchwork Wed Dec 11 10:34:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 3323961 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EEF4BC0D4A for ; Wed, 11 Dec 2013 10:35:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4BE9200EA for ; Wed, 11 Dec 2013 10:35:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9CBE720108 for ; Wed, 11 Dec 2013 10:35:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FFC8105788; Wed, 11 Dec 2013 02:35:38 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f169.google.com (mail-ea0-f169.google.com [209.85.215.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 6EB35FB4A9 for ; Wed, 11 Dec 2013 02:34:50 -0800 (PST) Received: by mail-ea0-f169.google.com with SMTP id l9so2688757eaj.0 for ; Wed, 11 Dec 2013 02:34:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OekNIrryGhy5ZIcklFgLG+MKINoiwuIS5b5MRdNhpXQ=; b=R9IlK/3py63TpQ4TbFq1YA0GuU3gGlHJ7XyLuvTtvLIapvBrHJxlOQZkQh31xCWtVQ dFCiJmKV08Tq77oirdG5XLxa4TM7PT+gtwsJyYkGVYngYJKjw0K99HSDj20+3fyV2sl/ GY1oFXG97zCbPuuMlVgic4asuVwbkQyEFX2Eg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OekNIrryGhy5ZIcklFgLG+MKINoiwuIS5b5MRdNhpXQ=; b=AG3DYh5HwDXEoUjTf1INbYqjKWK3kdf3OzxCGUNw7vA5xz7ueUj4YdB3UYaCHgfxFo PjNydo7/fhoXIWCDgZNWldH71QHY8B+8g7nRSQTdYEtAIi3YfCO/lcBndy4YP4BAFe0W T70MiEIWWrKH0RiIoz+VF5mwDyp/yen4tpV4MMdoluNBE2cmxqT7G7qff/ib9iZvXgaE QMT69OoZEOd7wF72D14TnirG0JWGr+N661RatfkzNyt28embk0tzJFGoD++UOdaBmTEH oXTDtJH3/Nwq4QfrE1GFRBvXvXEXS2Ae81qZnspS4g9YhojjXZwYHGN4nmEMbTK+25zF YooA== X-Gm-Message-State: ALoCoQlGsHgfO+/IZd6imrufhT5N8S3L7craojSQKyCWmm7A8BmOz+UgyOSX/iN0qH5n82c2lW/u X-Received: by 10.14.209.129 with SMTP id s1mr917303eeo.21.1386758089786; Wed, 11 Dec 2013 02:34:49 -0800 (PST) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id b41sm51932269eef.16.2013.12.11.02.34.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2013 02:34:49 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 15/50] drm: remove agp_init() bus callback Date: Wed, 11 Dec 2013 11:34:36 +0100 Message-Id: <1386758111-3446-16-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> References: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. v2: Rebase on top of the agp_init interface change. v3: Remove the rebase-fail where I've accidentally killed the ->irq_by_busid callback a bit too early. Cc: David Herrmann Signed-off-by: David Herrmann (v1) Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_pci.c | 12 +++++++++--- drivers/gpu/drm/drm_stub.c | 8 +------- include/drm/drmP.h | 1 - 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 626e9cfd8aa5..2211c4d70c2d 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -293,7 +293,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, }; @@ -332,9 +331,13 @@ 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); + mutex_lock(&drm_global_mutex); + drm_pci_agp_init(dev); + mutex_unlock(&drm_global_mutex); + ret = drm_dev_register(dev, ent->driver_data); if (ret) - goto err_pci; + 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, @@ -347,7 +350,10 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, return 0; -err_pci: +err_agp: + mutex_lock(&drm_global_mutex); + drm_pci_agp_destroy(dev); + mutex_unlock(&drm_global_mutex); pci_disable_device(pdev); err_free: drm_dev_free(dev); diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 085eb84a380c..7fca4c6c9a30 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c @@ -521,13 +521,10 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) mutex_lock(&drm_global_mutex); - if (dev->driver->bus->agp_init) - dev->driver->bus->agp_init(dev); - 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) { @@ -566,9 +563,6 @@ err_render_node: drm_put_minor(dev->render); err_control_node: 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 9b53031d04ed..097d93a6138d 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 */ - void (*agp_init)(struct drm_device *dev); void (*agp_destroy)(struct drm_device *dev); };