From patchwork Wed Nov 8 13:04:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 118255 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5261486qgn; Wed, 8 Nov 2017 05:05:21 -0800 (PST) X-Google-Smtp-Source: ABhQp+Qnv6qEDu2x2yDZFBa86irmmS+SXwFUiRXS4DIxT9BpwUBT8qehlhHsQ8f4SsBwZyrniI0T X-Received: by 10.159.229.136 with SMTP id az8mr386421plb.423.1510146321522; Wed, 08 Nov 2017 05:05:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510146321; cv=none; d=google.com; s=arc-20160816; b=dEXdDayZzD3b8iD6GlnhoSFCdIIUBMWZBBKTelAIDGmdaQbyDlFURbo5qyXJ0DVT6X OxdZVTxj0aZcH0YV5yxyIWiasTc5GM8ud02AYmnfO+nkZdBZ54zSwFf97RSMLhUZs1Up omFfC3RNjnU0a7vMLY4TvUs6YSqClyh5LJJBQI+rEL00A+rIZJjIuwkGa3k9JCVi8MmN 15AVmkidzO6gCSX5yzksfQetikxs5T/lQFuNx4mAI+p5j8ebvUgjncS/A1Gu62HD7BDg XCBirl3uIssT/OTks4hlLHNRJOrsAaixFvAj8+70SXPpK4rWKawO1W4IYkuUJCNyZ4mO PArw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=pevu3aYrUY459GUmZQI/u7TzRr8LpilB38anT1bO2K4=; b=n8uHAZIVvnviMsD4nM4RC0WcwVbc/pVBZ0eZrY7bTbmUuNHfsOeCaloVkc5uQu47Mt hw2WWca4/bLH9pi1Ylggv+BJUfb69sIrEgm2kNGo9npsmWPLTRNp35CwSy8X4ErMyFFs iEfI1DnbXjTh/pOTIm2cF0a0+RZ1rs5aLGM4zT5klrI/dpjNPNZz6o62QRMT+jJFpCJc 8itPjM/ruhI/xKCin5hjm7PtYdM2FrjZqMv1Hwpp1OY41SIsHMBK12B7FcqQImXa/Bob qv+38Mi1c6r+XNqMCT+3MfJqAQ0Dl6QnNvYvZf/wckEbhW5jjjKmAzEIZZ2vDGplfDeG IJhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NF71w/ql; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si3663356plo.114.2017.11.08.05.05.21; Wed, 08 Nov 2017 05:05:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NF71w/ql; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752628AbdKHNFT (ORCPT + 21 others); Wed, 8 Nov 2017 08:05:19 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:47585 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752076AbdKHNFQ (ORCPT ); Wed, 8 Nov 2017 08:05:16 -0500 Received: by mail-wm0-f68.google.com with SMTP id r196so10335136wmf.2 for ; Wed, 08 Nov 2017 05:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=pevu3aYrUY459GUmZQI/u7TzRr8LpilB38anT1bO2K4=; b=NF71w/qlxLDYl0eUk95soGKnsz0qbVQLe3oX5tWJStQJIK0MKJL7Z7lJbK6MjFGtRL 2al0pREAyacS/Zvpzi7Gx44heuhQ+iaRmnslOUgyhINCM3qVVo5fTuzp3raPw1iDsBHF crwzL7CmrIuuKqXM1N1lcl4rQxrQjx3At/nTM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pevu3aYrUY459GUmZQI/u7TzRr8LpilB38anT1bO2K4=; b=mDfz2oMxrI9RpPUuioIWS5YwD3byMT0QFqpSdN4mdaky1hdY/td+MgSM9+U2i/ejW0 2mF9I2BIP0Hkcmyjs2VZemA7h9poJCxhHYVIAgmlGFE6j2RjZcz98YwVZZoLGyCySyV9 4pm9nNSS6w3DTvmYrzQgHvNdlp4IWea7ID0BdmkanQLTkXkAGl89GyjMJbnzHm0/IwXg 8vSqYBpfMa/a5mE1RHrM2KP4UyVp1BmuCzCgDge03vJu65Ib95FS+TpGNxXCD/AiDQLs dLcB+H24MlPQLD8WqUvCdL+DfgcnUHQyxowhoaeKXm1vkFiMHUuxLqszF2zq0vOTXUwl O2Og== X-Gm-Message-State: AJaThX6Ng/Sr82yw9vQl8tTyzFjXtxEo8JgEbsvBKVkmv2kSjIy7UFoc 5rPo5F/USLHEq7z0IFs0CVXUew== X-Received: by 10.28.142.20 with SMTP id q20mr367925wmd.37.1510146315211; Wed, 08 Nov 2017 05:05:15 -0800 (PST) Received: from lmecxl0911.lme.st.com ([80.215.132.71]) by smtp.gmail.com with ESMTPSA id f19sm3599278wrh.64.2017.11.08.05.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 05:05:14 -0800 (PST) From: Benjamin Gaignard To: vincent.abriou@st.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Benjamin Gaignard Subject: [PATCH] drm: sti: remove useless fields from vtg structure Date: Wed, 8 Nov 2017 14:04:14 +0100 Message-Id: <1510146255-24982-1-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drivers are registered on platform bus so the private list could be replace by a call to of_find_device_by_node(). Changing this also makes dev, np and link fields useless in vtg structure. Signed-off-by: Benjamin Gaignard --- drivers/gpu/drm/sti/Kconfig | 1 + drivers/gpu/drm/sti/sti_vtg.c | 32 ++++++++------------------------ 2 files changed, 9 insertions(+), 24 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig index acd7286..cca4b3c 100644 --- a/drivers/gpu/drm/sti/Kconfig +++ b/drivers/gpu/drm/sti/Kconfig @@ -8,5 +8,6 @@ config DRM_STI select DRM_PANEL select FW_LOADER select SND_SOC_HDMI_CODEC if SND_SOC + select OF help Choose this option to enable DRM on STM stiH4xx chipset diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c index 2dcba1d..5f75aea 100644 --- a/drivers/gpu/drm/sti/sti_vtg.c +++ b/drivers/gpu/drm/sti/sti_vtg.c @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -72,8 +73,6 @@ #define AWG_DELAY_ED (-8) #define AWG_DELAY_SD (-7) -static LIST_HEAD(vtg_lookup); - /* * STI VTG register offset structure * @@ -123,42 +122,31 @@ struct sti_vtg_sync_params { /** * STI VTG structure * - * @dev: pointer to device driver - * @np: device node * @regs: register mapping * @sync_params: synchronisation parameters used to generate timings * @irq: VTG irq * @irq_status: store the IRQ status value * @notifier_list: notifier callback * @crtc: the CRTC for vblank event - * @link: List node to link the structure in lookup list */ struct sti_vtg { - struct device *dev; - struct device_node *np; void __iomem *regs; struct sti_vtg_sync_params sync_params[VTG_MAX_SYNC_OUTPUT]; int irq; u32 irq_status; struct raw_notifier_head notifier_list; struct drm_crtc *crtc; - struct list_head link; }; -static void vtg_register(struct sti_vtg *vtg) -{ - list_add_tail(&vtg->link, &vtg_lookup); -} - struct sti_vtg *of_vtg_find(struct device_node *np) { - struct sti_vtg *vtg; + struct platform_device *pdev; - list_for_each_entry(vtg, &vtg_lookup, link) { - if (vtg->np == np) - return vtg; - } - return NULL; + pdev = of_find_device_by_node(np); + if (!pdev) + return NULL; + + return (struct sti_vtg *)platform_get_drvdata(pdev); } static void vtg_reset(struct sti_vtg *vtg) @@ -397,9 +385,6 @@ static int vtg_probe(struct platform_device *pdev) if (!vtg) return -ENOMEM; - vtg->dev = dev; - vtg->np = pdev->dev.of_node; - /* Get Memory ressources */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -428,10 +413,9 @@ static int vtg_probe(struct platform_device *pdev) return ret; } - vtg_register(vtg); platform_set_drvdata(pdev, vtg); - DRM_INFO("%s %s\n", __func__, dev_name(vtg->dev)); + DRM_INFO("%s %s\n", __func__, dev_name(dev)); return 0; }