Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp666811iog; Thu, 30 Jun 2022 08:01:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s6XkC2SOnFlffoLJEfErkBiPHk9USVBUVlQznl04yzTnaHcvMSeSDhTr1uYSbWA9p4lz+Y X-Received: by 2002:a62:f846:0:b0:51c:17b2:60de with SMTP id c6-20020a62f846000000b0051c17b260demr16388502pfm.76.1656601277468; Thu, 30 Jun 2022 08:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656601277; cv=none; d=google.com; s=arc-20160816; b=shf8mPz2neBt1FfSeqhg4zgKC17r9Lwt9wPSOA+ACReCMMfTagJACgUCGKcDe5SGAU sv+hFU/R5el6VUckTnB+gsdKj1Kcvr6jxAEIrDRh5YGs16yIyqTHnZ4Ksh5BciTDYss7 PVdwGS4E6xJGWHUTKkXOhYalQlH3smn0KIagCDmyxx1Sxt3yrfqX1/StUFI6ZX09UciM yuTHLRQtvBeFWXfDmVjaJ7XaRn6SoeJr7pFv2YEBH/heRvK7fUm6JT9jgQWDVgqq6Q87 fEvhMAQJc5qTOiZrsUE5h3fMSlGGe21rN+AsmcbUkMtXOn3t4p2eu0dUX1VPiNtTsFBa QahA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+ooe4hbx7C6Yy4EL5rlsmfgJ9Dxlz+kBFTYJkl/U/Gc=; b=mM+In0z7GiIL1Xn933j6c3MgswmNbSJQTWUSCE18ZFky01pfylE3iMPE6QLFvpzgtD E4qrFH+c0IAZt7JPGvcP9hFkIWGNnovM+0dnj4lM/LW//j5U1maKIdiKrt4PnZ6a/Xyg 6c0em3rLSATxHjhYuGrsJRMOQyWDCfHEXK3oq2W7D/mQtr/rAtzjjXUIuNFIww3N7Y6E J/icGweEgakHg7Rjp5vyhO7+sB9pAaSBDIphHWS5BHGiRe+2701pwf2EMfpHebEyug2r uptPCiUBKkXll6/9HOVbkU0w81hHDJ6nXREhyz3VAhyb8GMH/9+KHSv2G4t6Df9/H27P exkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pNg0vYEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020aa7948b000000b0052542fa57d5si22496109pfk.297.2022.06.30.08.01.00; Thu, 30 Jun 2022 08:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pNg0vYEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235903AbiF3Nyv (ORCPT + 99 others); Thu, 30 Jun 2022 09:54:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235716AbiF3NyU (ORCPT ); Thu, 30 Jun 2022 09:54:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DE752380; Thu, 30 Jun 2022 06:50:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1ED9461FD8; Thu, 30 Jun 2022 13:50:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29582C34115; Thu, 30 Jun 2022 13:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656597014; bh=DuigcMx0DqVCBIG2n4mSaG34J8iwHHjFkHvYhh4Vh9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNg0vYEIXhaNR/qzJc5VqMRqznETE0SJh8YEKW+WnOhwA1MkbnAOd5ZfMZaph4f09 tJJ1iDNbJnUux8Zu4rv76iCP2Vc3EnfKs5wxm/fgaDQp6eqIk6V36CFx1xo+SwOXUh ydGgRujznGqP14Upo7v4A39+lu6uFovYQU7xpqo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Christoph Hellwig , Jessica Yu Subject: [PATCH 4.14 31/35] drm: remove drm_fb_helper_modinit Date: Thu, 30 Jun 2022 15:46:42 +0200 Message-Id: <20220630133233.355081013@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220630133232.433955678@linuxfoundation.org> References: <20220630133232.433955678@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig commit bf22c9ec39da90ce866d5f625d616f28bc733dc1 upstream. drm_fb_helper_modinit has a lot of boilerplate for what is not very simple functionality. Just open code it in the only caller using IS_ENABLED and IS_MODULE, and skip the find_module check as a request_module is harmless if the module is already loaded (and not other caller has this find_module check either). Acked-by: Daniel Vetter Signed-off-by: Christoph Hellwig Signed-off-by: Jessica Yu Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_crtc_helper_internal.h | 10 ---------- drivers/gpu/drm/drm_fb_helper.c | 21 --------------------- drivers/gpu/drm/drm_kms_helper_common.c | 23 +++++++++++------------ 3 files changed, 11 insertions(+), 43 deletions(-) --- a/drivers/gpu/drm/drm_crtc_helper_internal.h +++ b/drivers/gpu/drm/drm_crtc_helper_internal.h @@ -32,16 +32,6 @@ #include #include -/* drm_fb_helper.c */ -#ifdef CONFIG_DRM_FBDEV_EMULATION -int drm_fb_helper_modinit(void); -#else -static inline int drm_fb_helper_modinit(void) -{ - return 0; -} -#endif - /* drm_dp_aux_dev.c */ #ifdef CONFIG_DRM_DP_AUX_CHARDEV int drm_dp_aux_dev_init(void); --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2612,24 +2612,3 @@ int drm_fb_helper_hotplug_event(struct d return 0; } EXPORT_SYMBOL(drm_fb_helper_hotplug_event); - -/* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT) - * but the module doesn't depend on any fb console symbols. At least - * attempt to load fbcon to avoid leaving the system without a usable console. - */ -int __init drm_fb_helper_modinit(void) -{ -#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT) - const char name[] = "fbcon"; - struct module *fbcon; - - mutex_lock(&module_mutex); - fbcon = find_module(name); - mutex_unlock(&module_mutex); - - if (!fbcon) - request_module_nowait(name); -#endif - return 0; -} -EXPORT_SYMBOL(drm_fb_helper_modinit); --- a/drivers/gpu/drm/drm_kms_helper_common.c +++ b/drivers/gpu/drm/drm_kms_helper_common.c @@ -35,19 +35,18 @@ MODULE_LICENSE("GPL and additional right static int __init drm_kms_helper_init(void) { - int ret; + /* + * The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT) + * but the module doesn't depend on any fb console symbols. At least + * attempt to load fbcon to avoid leaving the system without a usable + * console. + */ + if (IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) && + IS_MODULE(CONFIG_FRAMEBUFFER_CONSOLE) && + !IS_ENABLED(CONFIG_EXPERT)) + request_module_nowait("fbcon"); - /* Call init functions from specific kms helpers here */ - ret = drm_fb_helper_modinit(); - if (ret < 0) - goto out; - - ret = drm_dp_aux_dev_init(); - if (ret < 0) - goto out; - -out: - return ret; + return drm_dp_aux_dev_init(); } static void __exit drm_kms_helper_exit(void)