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: 10048475 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 C52D6603FA for ; Wed, 8 Nov 2017 13:05:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7A042A5DB for ; Wed, 8 Nov 2017 13:05:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC8B62A5DF; Wed, 8 Nov 2017 13:05:19 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39C522A5DE for ; Wed, 8 Nov 2017 13:05:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1A926E6C2; Wed, 8 Nov 2017 13:05:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id B20AC6E6C2 for ; Wed, 8 Nov 2017 13:05:16 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id p75so10318770wmg.3 for ; Wed, 08 Nov 2017 05:05:16 -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=EyH/7Qy+lAGz7UfeWgjOKy6k1bp2K1eNYnmE7YxTOukdyiMLNtSCERuY2YcN7ulCeu t2y0qY1oC4jrodbs8yk3gl3v+Lyputuqld32H/OBmbuz13Zw9LG/pZmmFMEkQRfzeEl2 N5Rzlz3XmqlTluxYJn+TP886tigWh2UJ4IIfPYGyBcDJiNfkxct40IJU+RHrx6ysD8qK 3NcRk0FwMfeAl1iGt5zKxFH8eMPz/q15jGmSmL64rJVDAtHFdn2e14zyWR8JOAq0oGd0 iDFFzmT/Vfk46ILtacy7/lrS+XFuutxqfRbDZzuRIPjd69NpIAxJdgYHVosF7z5g13Ti OFkw== X-Gm-Message-State: AJaThX4FzeVxCxTsW+t99qgEFeOYTSsfDDiru8PYobowAuCx7kP5mXrz atNotM58DsJoc+1s76zqRxhuNw== X-Google-Smtp-Source: ABhQp+T+91XknMB1RD24moeGtpAcS7IYNF3TM+Ef7wTF3OgvrcC10rN3oJy09q5HEfZZ0urw4/BsKg== 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 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; }