From patchwork Wed Nov 15 15:24:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 10059735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 48FE46019D for ; Wed, 15 Nov 2017 15:25:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3833E29C0B for ; Wed, 15 Nov 2017 15:25:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D29F29FCC; Wed, 15 Nov 2017 15:25:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C6C6129C0B for ; Wed, 15 Nov 2017 15:25:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=OKO2vs7+FhiQISkCXt2gmMCXQMLPzVkkMOVc4RBY1oI=; b=VQbRqM8m106XMthXs2/HQrCrP5 We4aJaCg3/NjpEEny/YWaozZ3U4xyLgYpby17FeWieXRuIiA50BgqyaEjDa+aJNd89z//xjA2HIQe M5+Jacj3f0zUKyaE1sxYFKtdueWnbh9Qobdo2/y48dtKtA7oTjYM61F6eH5APlGmbrqeSLBVp8ldE mMUvFx8MLuZSMxlDlz1XYOxO6fRKcBaw8Q+6dPWehQm/lnwDl9Pa4F363Bn9t8EWYvxCJGma1FsWf E5pFDii4qqK3nqXgmB8BX+zi+pDPwXCBmrff6gGbOoEl/DwIyaLOTXdFkZBiv4upAeusucmqG9WfH KRI/QS2g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eEzYu-0004J2-V9; Wed, 15 Nov 2017 15:25:12 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEzYl-0003IP-9v for linux-mediatek@lists.infradead.org; Wed, 15 Nov 2017 15:25:06 +0000 Received: by mail-wm0-x243.google.com with SMTP id z3so3765760wme.5 for ; Wed, 15 Nov 2017 07:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+kxXKykFF/Yd6mrIn9/q2ENop15+E7SWPc6hK9e/zPs=; b=cDd24RGbhNMZsn2vntw86LgOFf3QjZjILibOp0f9hdl5uOo4u90xnB+e6VzODQS5Gf IRBFqEGzeMR4huV/hnNbXCQ4Iu09r6Lskz7x6KalImQM1F1QS3v/nMRYuNfPF+1RK9er cEWHeFD8MvEAC/uvacQEXo+zdfNxf21SpK9vWTjGubP/tpcc7QfsoKgjH6d0del7RiE3 6pmc6hwu4SAIucFkwtP/BiH7ZAbUhrUfohdPOGP/yDE57TF7f7jXDGfg8isQMjI5SLxn P/9gmpBPRNOq6kUcET6D2h7/e6J7dngrNN6aueWmz4YIjly07q9BcCJ/cRHHU/Jw/dUO 1FLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+kxXKykFF/Yd6mrIn9/q2ENop15+E7SWPc6hK9e/zPs=; b=Hb9gxvRe92yaG37eXzOQ79X3T1YDcCVThRGO11agm3zKh/FWGfzMgwRh8aiv81035F zf4fNeC1kfV6MltW2Jk4Q73C3cF/LkmXmXLV3pbSnLHGTLxMo8JZcIXGd7ylBCJLih5k Z2kH7uRR996a8x73dlX52BoWUeWegpCKreH77z5vl60MYs2tJiMei8NR3xt3FQoRSM52 AT1yIpb4Rb5Eu4gdNofFyvNwo1UBZegMf3PRDuj4aJL7NmCPmLVrt+/I8wKP1S2A5ZsC 66JFDdI9ZJ/O3z6mFJPWMx7byzb1QpcelRn/xZ65G1e7fBNT0DVOYIgxwxvPKKrWBhrU krPA== X-Gm-Message-State: AJaThX4Iyaxf7e3CVtCsSdDIq2HeFJRYCtmGBBvARAj7Fiybg1mMoQWm hoezbU095FzSHjlNVNTcJyZZKaA= X-Google-Smtp-Source: AGs4zMY8T1N5uU5DH6SNyK16OD2dhg2oyVWjKtHOq7qB4XSjT8R/fiLiYN7YAdg9wbfr9ZyDxZweRw== X-Received: by 10.28.14.195 with SMTP id 186mr2394760wmo.56.1510759485720; Wed, 15 Nov 2017 07:24:45 -0800 (PST) Received: from groucho.site (ipbcc0ce42.dynamic.kabel-deutschland.de. [188.192.206.66]) by smtp.gmail.com with ESMTPSA id s12sm51547104wrc.89.2017.11.15.07.24.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Nov 2017 07:24:45 -0800 (PST) From: Ulrich Hecht To: linux-mediatek@lists.infradead.org Subject: [POC 11/16] drm/img-rogue: replace call to obsolete drm_platform_init() Date: Wed, 15 Nov 2017 16:24:18 +0100 Message-Id: <1510759463-30201-12-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510759463-30201-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1510759463-30201-1-git-send-email-ulrich.hecht+renesas@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171115_072503_719201_738141FA X-CRM114-Status: GOOD ( 11.02 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulrich Hecht , mbrugger@suse.com, magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use drm_dev_alloc(), drm_dev_register() and remove the .load and .unload methods from drm_driver. Signed-off-by: Ulrich Hecht --- drivers/gpu/drm/img-rogue/1.6/mt8173/mtk_module.c | 14 +++++++++++-- drivers/gpu/drm/img-rogue/1.6/pvr_drm.c | 24 +---------------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/img-rogue/1.6/mt8173/mtk_module.c b/drivers/gpu/drm/img-rogue/1.6/mt8173/mtk_module.c index 5df3a15..1ef75bb 100644 --- a/drivers/gpu/drm/img-rogue/1.6/mt8173/mtk_module.c +++ b/drivers/gpu/drm/img-rogue/1.6/mt8173/mtk_module.c @@ -109,7 +109,7 @@ static struct platform_driver powervr_driver = { *****************************************************************************/ int PVRSRVSystemInit(struct drm_device *pDrmDevice) { - struct platform_device *pDevice = pDrmDevice->platformdev; + struct platform_device *pDevice = to_platform_device(pDrmDevice->dev); PVRSRV_ERROR err; PVR_TRACE(("%s (pDevice=%p)", __func__, pDevice)); @@ -160,8 +160,10 @@ void PVRSRVSystemDeInit(struct platform_device *pDevice) @Return 0 for success or <0 for an error. *****************************************************************************/ +int PVRSRVDRMLoad(struct drm_device *dev, unsigned long flags); static int PVRSRVDriverProbe(struct platform_device *pDevice) { + struct drm_device *drm; int result; PVR_TRACE(("%s (pDevice=%p)", __func__, pDevice)); @@ -172,13 +174,21 @@ static int PVRSRVDriverProbe(struct platform_device *pDevice) return result; } - result = drm_platform_init(&sPVRDRMDriver, pDevice); + drm = drm_dev_alloc(&sPVRDRMDriver, &pDevice->dev); + if (IS_ERR(drm)) + return PTR_ERR(drm); + + platform_set_drvdata(pDevice, drm); + + result = PVRSRVDRMLoad(drm, 0); dma_set_mask(&pDevice->dev, DMA_BIT_MASK(33)); if (result == 0) PVRSRVDeviceInit(); + result = drm_dev_register(drm, 0); + return result; } diff --git a/drivers/gpu/drm/img-rogue/1.6/pvr_drm.c b/drivers/gpu/drm/img-rogue/1.6/pvr_drm.c index 7439a6f..36c5a76 100644 --- a/drivers/gpu/drm/img-rogue/1.6/pvr_drm.c +++ b/drivers/gpu/drm/img-rogue/1.6/pvr_drm.c @@ -107,17 +107,12 @@ DECLARE_WAIT_QUEUE_HEAD(sWaitForInit); IMG_BOOL bInitComplete; IMG_BOOL bInitFailed; -static int PVRSRVDRMLoad(struct drm_device *dev, unsigned long flags) +int PVRSRVDRMLoad(struct drm_device *dev, unsigned long flags) { int iRes; PVR_TRACE(("PVRSRVDRMLoad")); -#if defined(LDM_PLATFORM) - /* The equivalent is done for PCI modesetting drivers by drm_get_pci_dev() */ - platform_set_drvdata(dev->platformdev, dev); -#endif - /* Module initialisation */ iRes = PVRSRVSystemInit(dev); if (iRes != 0) @@ -141,21 +136,6 @@ static int PVRSRVDRMLoad(struct drm_device *dev, unsigned long flags) return iRes; } -static int PVRSRVDRMUnload(struct drm_device *dev) -{ -#if defined(LDM_PLATFORM) - LDM_DEV *pDevice = dev->platformdev; -#elif defined(LDM_PCI) - LDM_DEV *pDevice = dev->pdev; -#endif - - PVR_TRACE(("PVRSRVDRMUnload")); - - PVRSRVSystemDeInit(pDevice); - - return 0; -} - static int PVRSRVDRMOpen(struct drm_device *dev, struct drm_file *file) { while (!bInitComplete) @@ -306,8 +286,6 @@ struct drm_driver sPVRDRMDriver = .driver_features = DRIVER_MODESET | DRIVER_RENDER, .dev_priv_size = 0, - .load = PVRSRVDRMLoad, - .unload = PVRSRVDRMUnload, .open = PVRSRVDRMOpen, .postclose = PVRSRVRelease,