Message ID | 20230924192604.3262187-6-jernej.skrabec@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp873715vqu; Sun, 24 Sep 2023 16:01:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+x6EI8PgB2gATwsfiwoZ27j2VX8rM/dVQPP4QujLyNffnguJp9lbLrZ4TY5BeXqDW54ah X-Received: by 2002:a05:6a21:6da5:b0:159:6b5c:5653 with SMTP id wl37-20020a056a216da500b001596b5c5653mr3752644pzb.37.1695596476772; Sun, 24 Sep 2023 16:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695596476; cv=none; d=google.com; s=arc-20160816; b=CIGbKrRYR1BKU7YLAhVAbo8ebfhZkDDygjkds/an2Ws5Qr1W2iR3G9Te3NsUhhTtSS tq/dVMZmrF+g/Nooq3taamyTDqwC5sB/bitJwx8VxyItwoB7DE376fFocLWpd7fWEYtS +h8uvhZsi6TYoG1ZisTua34DjPcDyF7cUSDo3nVPu3+9zuKMlZVMyIfWP3/g6cwgg1ap JAgvIiXj1TbmrsJtRGhRE6GbpvNxhRd9LCYicJ6Uu0aYTvcNEaBxVfi41FBZ5l9AftZF xOoZWfdaUD/EhgonzAY3+hsHOw7e6JFGxT2uKI/qxdEk9eNhQ+wnsf/VFQ2U/HPNkSEO TFwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MFf1cGltxf8drTRitrLUgd7Y0FznH+yCbskJSQDkt2Q=; fh=ythuQA64SNE7wujD11OFYiH8HaGGRVN0m1KGJA3eIXU=; b=eFAWpkZjwzgXU60hQwVwvDPv6rgsBO1WAyWDKSG1q0h4HRC7Yqm3W3rRs7cAI0gYgb dCXzQCas6aFFI2zP/bRUSh48HbB24UQ4bdxHBp4bscwn+eOQmZmLOErx1KFaA1cEq3Rq CbN4JbgJSRR+1T1A99CaOS9NIiS7iQkiguLsQVB5uIUNtDCR7w1iODVoC+lFWkswcFx5 O96DTtYJmKNHVPE1sKFrJIbP44oxUZXKX//QlnSEPBXx0RkBK7X68vOE8tURZoZr65iZ GY2/WeVMPbIJUA9xzdkfiB0FkgkZ59BZyaN7ltmoBvmMBEAa9zV1bCEnA6Ga5rr0xbbA 7Uzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DZhOtr5j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id pc2-20020a17090b3b8200b0027740943ec2si2884888pjb.158.2023.09.24.16.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 16:01:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DZhOtr5j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D2B0F806A856; Sun, 24 Sep 2023 12:27:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbjIXT0f (ORCPT <rfc822;pusanteemu@gmail.com> + 30 others); Sun, 24 Sep 2023 15:26:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbjIXT0Z (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 24 Sep 2023 15:26:25 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 123D9FB for <linux-kernel@vger.kernel.org>; Sun, 24 Sep 2023 12:26:19 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9ad810be221so635099066b.2 for <linux-kernel@vger.kernel.org>; Sun, 24 Sep 2023 12:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695583577; x=1696188377; darn=vger.kernel.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=DZhOtr5jdCqctyv2RQkA/Pf11FbJKVVQG+oykz40ViA+0ytUCDykLUY0lbChQYNXBC ChptrjhuLCVY1atSVFfZZNGuupHXND97VolFC3cKtwe3Hne5x+dINvcdT0r2R7GNCyxC qukF7Pk9LambNvqKYseRyc5M1dF2H9dPcprR9eI6O1QBe/8pL8U+WAOoH0TlOxoza3RF +iUfqs+62Nx3Ua9v4aubaGimsOcT2QYkA9DxLOME+eNLq2QiUiGJeNqnf9S1Rzbm6ze6 fUnYFOo5gIHOYhzBPIfDTH4hS3Id4BMTnRT8p882I1/FXJyWbjpcKRSYAh5tkSoqbcwg d1gw== 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=XHbqvwzzv426+J6iiwUmBUsd00LkQNwqJHIS1yNiFoWuhu4N5C8/tm1bWLzR8znh30 hBeHseBWEDSCCqve04RVwMWSYAZptslF8w1SSGlN9v7ybRV16uxky8t3RY32Ia2TyH0I 5vR4hJUf5OjoL9e7Y3k+0dRd/E7qbyQOYDcg6FdIE39+wjmhEDzFyfOZnziHVb0UhuOh VKmElUjZQj/VIst3ZgDw3SMTa87qXSMO/I4vyS519Mr0x9aLrNcXBn3thg7sEG/7Yk4D jk28CpTeb9vJuQsk34BGFlzzRaVf/NtGU0VUVG+cmNqfsZZ8Sk4F8/Ee2subvDWVzc3b jsWQ== X-Gm-Message-State: AOJu0YxDIYi7FBwkIBXVopOIMjNz7qnk8e+TIaxJMK4NKR4/aiuuTNS4 470YtJM1Zo134IpNNdJ0iMw= 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 <jernej.skrabec@gmail.com> 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 <jernej.skrabec@gmail.com> 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 24 Sep 2023 12:27:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777961770907181444 X-GMAIL-MSGID: 1777961770907181444 |
Series |
drm/sun4i: dw-hdmi: Fix initialization & refactor
|
|
Commit Message
Jernej Škrabec
Sept. 24, 2023, 7:26 p.m. UTC
There is no reason to register two drivers in same place. Using macro
lowers amount of boilerplate code.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
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(-)
Comments
Hi Jernej, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.6-rc3 next-20230921] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jernej-Skrabec/drm-sun4i-dw-hdmi-Deinit-PHY-in-fail-path/20230925-032818 base: linus/master patch link: https://lore.kernel.org/r/20230924192604.3262187-6-jernej.skrabec%40gmail.com patch subject: [PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration config: parisc-randconfig-002-20230925 (https://download.01.org/0day-ci/archive/20230925/202309251030.rZTXXyFE-lkp@intel.com/config) compiler: hppa-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230925/202309251030.rZTXXyFE-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202309251030.rZTXXyFE-lkp@intel.com/ All errors (new ones prefixed by >>): hppa-linux-ld: drivers/gpu/drm/sun4i/sun8i_hdmi_phy.o: in function `sun8i_hdmi_phy_driver_init': >> (.init.text+0x0): multiple definition of `init_module'; drivers/gpu/drm/sun4i/sun8i_dw_hdmi.o:(.init.text+0x0): first defined here hppa-linux-ld: drivers/gpu/drm/sun4i/sun8i_hdmi_phy.o: in function `sun8i_hdmi_phy_driver_exit': >> (.exit.text+0x0): multiple definition of `cleanup_module'; drivers/gpu/drm/sun4i/sun8i_dw_hdmi.o:(.exit.text+0x0): first defined here
On Sun, Sep 24, 2023 at 09:26:02PM +0200, Jernej Skrabec wrote: > There is no reason to register two drivers in same place. Using macro > lowers amount of boilerplate code. There's one actually: you can't have several module_init functions in the some module, and both files are compiled into the same module. Maxime
Dne ponedeljek, 25. september 2023 ob 09:47:15 CEST je Maxime Ripard napisal(a): > On Sun, Sep 24, 2023 at 09:26:02PM +0200, Jernej Skrabec wrote: > > There is no reason to register two drivers in same place. Using macro > > lowers amount of boilerplate code. > > There's one actually: you can't have several module_init functions in > the some module, and both files are compiled into the same module. Yeah, I figured as much. However, I think code clean up is good enough reason to add hidden option in Kconfig and extra entry in Makefile (in v2). Do you agree? Best regards, Jernej
Hi Jernej, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.6-rc3 next-20230925] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jernej-Skrabec/drm-sun4i-dw-hdmi-Deinit-PHY-in-fail-path/20230925-032818 base: linus/master patch link: https://lore.kernel.org/r/20230924192604.3262187-6-jernej.skrabec%40gmail.com patch subject: [PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20230926/202309260027.aNIjQRBI-lkp@intel.com/config) compiler: s390-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230926/202309260027.aNIjQRBI-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202309260027.aNIjQRBI-lkp@intel.com/ All errors (new ones prefixed by >>): s390-linux-ld: drivers/gpu/drm/sun4i/sun8i_hdmi_phy.o: in function `sun8i_hdmi_phy_driver_init': >> sun8i_hdmi_phy.c:(.init.text+0x0): multiple definition of `init_module'; drivers/gpu/drm/sun4i/sun8i_dw_hdmi.o:sun8i_dw_hdmi.c:(.init.text+0x0): first defined here s390-linux-ld: drivers/gpu/drm/sun4i/sun8i_hdmi_phy.o: in function `sun8i_hdmi_phy_driver_exit': >> sun8i_hdmi_phy.c:(.exit.text+0x0): multiple definition of `cleanup_module'; drivers/gpu/drm/sun4i/sun8i_dw_hdmi.o:sun8i_dw_hdmi.c:(.exit.text+0x0): first defined here
On Mon, Sep 25, 2023 at 05:07:45PM +0200, Jernej Škrabec wrote: > Dne ponedeljek, 25. september 2023 ob 09:47:15 CEST je Maxime Ripard napisal(a): > > On Sun, Sep 24, 2023 at 09:26:02PM +0200, Jernej Skrabec wrote: > > > There is no reason to register two drivers in same place. Using macro > > > lowers amount of boilerplate code. > > > > There's one actually: you can't have several module_init functions in > > the some module, and both files are compiled into the same module. > > Yeah, I figured as much. However, I think code clean up is good enough reason > to add hidden option in Kconfig and extra entry in Makefile (in v2). > > Do you agree? Yeah, I don't know. Adding more modules makes it more difficult to handle (especially autoloading) without a clear argument why. Module_init is simple enough as it is currently, maybe we should just add a comment to make it clearer? Maxime
Dne četrtek, 05. oktober 2023 ob 10:43:14 CEST je Maxime Ripard napisal(a): > On Mon, Sep 25, 2023 at 05:07:45PM +0200, Jernej Škrabec wrote: > > Dne ponedeljek, 25. september 2023 ob 09:47:15 CEST je Maxime Ripard napisal(a): > > > On Sun, Sep 24, 2023 at 09:26:02PM +0200, Jernej Skrabec wrote: > > > > There is no reason to register two drivers in same place. Using macro > > > > lowers amount of boilerplate code. > > > > > > There's one actually: you can't have several module_init functions in > > > the some module, and both files are compiled into the same module. > > > > Yeah, I figured as much. However, I think code clean up is good enough reason > > to add hidden option in Kconfig and extra entry in Makefile (in v2). > > > > Do you agree? > > Yeah, I don't know. Adding more modules makes it more difficult to > handle (especially autoloading) without a clear argument why. > Module_init is simple enough as it is currently, maybe we should just > add a comment to make it clearer? I'll just drop this patch then. While I think autoloading works pretty good these days and cleaner code is nice, it can certainly cause some issues while packaging. Best regards, Jernej
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 <jernej.skrabec@siol.net>"); 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);