From patchwork Sun Sep 24 19:26:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 13397070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2870FCE7A8E for ; Sun, 24 Sep 2023 19:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=87HUBFzA7HiOOQSv9OmP8GTfzvueqV1k85OSyVRDsTo=; b=sIMfhHgZL3Dg1D ZzRrNDpB3Cz2iilmGYnE/PPe9LtXpZzQsgFy7sFB7HvUTwzBSfnW6AphCDtsvMIhwZtK7q/EXrhQh oNYdLH3GS9oEbj9gerVszIrhqjvPqSfpOjYfiKJtaRovCXonMWOg6jXnzemDRppDV9eQ5R62ag5lY pA9AkiKzHng2gQjNwkHElRb6T0yi3nYKnJttxcbyt0oDjkIqqWGc0gy463NFye7MK+Nl3bX+gFSX+ rlelZklEiM7mJ/BAR/kPeXlINAWtK1RayH5SjARvTWSMq1ZfuaaliSULtZfa6ZKZRo8AHoxDKdJg+ y12bgAAsfmN30dMieSMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qkUkM-00CgZ3-08; Sun, 24 Sep 2023 19:26:26 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qkUkE-00CgVb-2a for linux-arm-kernel@lists.infradead.org; Sun, 24 Sep 2023 19:26:20 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9ad8bf9bfabso636086066b.3 for ; Sun, 24 Sep 2023 12:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695583577; x=1696188377; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MFf1cGltxf8drTRitrLUgd7Y0FznH+yCbskJSQDkt2Q=; b=Cgt+QrrXtFqFddL89nx2reS0A0dunJ856MXPoR77C+ECUucFGcrX4MlKtzDgc3bL4T RebScD3Q2RA1bCngL+3oktxNOWj7hADlhTdK/ZfUlJ/eyfN/j2Y3D7NNS374z7GbsEk9 cDSuqCbcI3+mPobHcUos0hDjRc9j76dc6pzznZerda5xA89GaSSLzV8akA5mDQ4ZYgQs cWWW9FNFzVPE4BQe4AykTb7nYE3kCd8mz8Z38G5q1FyzseByr6AasZ8OLJ0IcQ5R4AGY XNTFNMyYh5LTTuaJmL57BDRUYd9x6RX+E2SsSwb+y1fijUDMLlmJrGRKgq6my1CsA2BZ 18Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695583577; x=1696188377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MFf1cGltxf8drTRitrLUgd7Y0FznH+yCbskJSQDkt2Q=; b=OmQqBgACrFst4AK/XbNSin0riOopWbwQy86yX5scvkxOkRoa9NLPr39urqYvJkb+jJ PpxDa/3hAiesQA5y513LIaVFxJ+ZJJyIi97Ak4PNN8rLWBjToCbO3AvkQnOq57G90QgA Jg5axK7TxbLPoc1z6dQ7K3UDamZFi7OpwUUNTgL7qMyfVvPXU3zplno3KoEF3FViRZUl DO8FO1kLrCXRgFoZ4BPtxPXXei917mC8yZ1o3RISrYnwuVdK+9aQdXVPkO/H9yRFZdm1 3Be4NgIXnOX+Jun0Yey7k2qACFq9fEHRwMtP+poxt3zv5FOTwySyyQXi1nwyiRW5abrb 33pQ== X-Gm-Message-State: AOJu0YyO76uP8nbYZjVQjRUzDydJ3S91ZAm6OfRCTfo3pQovm2w7Mz73 UiK+54P24+3XJduzmaLC5yg= X-Google-Smtp-Source: AGHT+IGAhle5kDIIp4WuTj01RyhcLxUc0q31fsjC0IfkTvI/FNrLn/S5IoePIuTCGmzEdhew1ZtvcA== X-Received: by 2002:a17:906:210a:b0:9a3:c4f4:12de with SMTP id 10-20020a170906210a00b009a3c4f412demr4134394ejt.37.1695583577533; Sun, 24 Sep 2023 12:26:17 -0700 (PDT) Received: from localhost.localdomain (82-149-12-148.dynamic.telemach.net. [82.149.12.148]) by smtp.gmail.com with ESMTPSA id z21-20020a1709063a1500b0099d0c0bb92bsm5317632eje.80.2023.09.24.12.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 12:26:17 -0700 (PDT) From: Jernej Skrabec To: mripard@kernel.org, wens@csie.org Cc: airlied@gmail.com, daniel@ffwll.ch, samuel@sholland.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej Skrabec Subject: [PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration Date: Sun, 24 Sep 2023 21:26:02 +0200 Message-ID: <20230924192604.3262187-6-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230924192604.3262187-1-jernej.skrabec@gmail.com> References: <20230924192604.3262187-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230924_122618_840580_E7DC0D63 X-CRM114-Status: GOOD ( 15.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There is no reason to register two drivers in same place. Using macro lowers amount of boilerplate code. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 27 +------------------------- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 -- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 3 ++- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 93831cdf1917..d93e8ff71aae 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -378,32 +378,7 @@ static struct platform_driver sun8i_dw_hdmi_pltfm_driver = { .of_match_table = sun8i_dw_hdmi_dt_ids, }, }; - -static int __init sun8i_dw_hdmi_init(void) -{ - int ret; - - ret = platform_driver_register(&sun8i_dw_hdmi_pltfm_driver); - if (ret) - return ret; - - ret = platform_driver_register(&sun8i_hdmi_phy_driver); - if (ret) { - platform_driver_unregister(&sun8i_dw_hdmi_pltfm_driver); - return ret; - } - - return ret; -} - -static void __exit sun8i_dw_hdmi_exit(void) -{ - platform_driver_unregister(&sun8i_dw_hdmi_pltfm_driver); - platform_driver_unregister(&sun8i_hdmi_phy_driver); -} - -module_init(sun8i_dw_hdmi_init); -module_exit(sun8i_dw_hdmi_exit); +module_platform_driver(sun8i_dw_hdmi_pltfm_driver); MODULE_AUTHOR("Jernej Skrabec "); MODULE_DESCRIPTION("Allwinner DW HDMI bridge"); diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index 18ffc1b4841f..21e010deeb48 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -194,8 +194,6 @@ struct sun8i_dw_hdmi { struct reset_control *rst_ctrl; }; -extern struct platform_driver sun8i_hdmi_phy_driver; - static inline struct sun8i_dw_hdmi * encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder) { diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index 489ea94693ff..f917a979e4a4 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -729,10 +729,11 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev) return 0; } -struct platform_driver sun8i_hdmi_phy_driver = { +static struct platform_driver sun8i_hdmi_phy_driver = { .probe = sun8i_hdmi_phy_probe, .driver = { .name = "sun8i-hdmi-phy", .of_match_table = sun8i_hdmi_phy_of_table, }, }; +module_platform_driver(sun8i_hdmi_phy_driver);