Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp171871pxb; Wed, 3 Feb 2021 02:37:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYAhn0nr+WbqwKF8HIA6hdT+11AigyPSeeK4FC0c3lN89YTbTUEE4rZFkDopqaWQ+USgmG X-Received: by 2002:a17:906:c00a:: with SMTP id e10mr2545420ejz.501.1612348629362; Wed, 03 Feb 2021 02:37:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612348629; cv=none; d=google.com; s=arc-20160816; b=QC8WB1sDdnNA9cII3qkn6+yu9JFY5shSWWh6tofnBCsE5iF9W67WM+w0fMMRI6yNv/ orTZH6fb4fe8bZOt5Cix2FxKdIWbFSFDZgnrpd/AnFlezLv14gTwwQPn24jZsOZosd8j pVopV77fXsOfeKD7NspcEu09gwNHPihIAajG9IogvjD/wXAaFj3YE0U5O5PVgqqM98+s gIZRMD7HeAUEJF+UZE3vVFDW/ECijog+z/0ZKd/K7jk8RuCHTuUegsFV0+rIrykSjBK6 twq53YoPZnB/2MlWdZ+nfjtbNrXsc1l4U8Dn9Ho4GresChtOZ8giQfZUBGaW4ARgKxY/ wOmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ucutE9tVrKg8bG1XX/lcHYR1DORerY7wTTSfiDErO4Y=; b=G7MSeb6W9yZno9Dl6xjfY5hJV9hQY2BlPJtJn7Pq48uo8fcWtcOVSDNofGbPdu45s9 03eCYIups2e6G+N41GF+v5biBd7L8F4fqAu8jMDS5cQZKQ2CKmhQyVWI88Eao9xgy1ib Mt98ig3Mo6fhXlJhpAyw3cobLU+YEEkw5IxDeZa9iBQIG6SeZZ7Rulw2zu0hWyZDl/cJ HYkzpiwJBX3dkXwmIVEn9GsU+7GhbVzV9SJ/65THICK1qyh27sZQea1EKiq5S2d2wQmE 3NrfjEbvsUTDSSRyU6Rb1o9laOt9l3RJl5d26lDPhNAeJ/DSwNWETCcyez8BmVusgJh7 ECZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=M75pCStw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i24si1048134ejy.153.2021.02.03.02.36.44; Wed, 03 Feb 2021 02:37:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=M75pCStw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233690AbhBCKfh (ORCPT + 99 others); Wed, 3 Feb 2021 05:35:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233587AbhBCKff (ORCPT ); Wed, 3 Feb 2021 05:35:35 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E1B7C06174A for ; Wed, 3 Feb 2021 02:34:55 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id j11so4130546wmi.3 for ; Wed, 03 Feb 2021 02:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=ucutE9tVrKg8bG1XX/lcHYR1DORerY7wTTSfiDErO4Y=; b=M75pCStwd1CD5X+AE8fVhstTS+X4mKfTg66UmMyLV/4dbGEYA6QHxZzUVBaPMOz7xx F9+edfLoc2Vlmx1emXKW6xZgu7oWNOjz1WTgd2M5J2gnXE54FmGLbHHBb8oKBNcpCTS4 6/gH/3v5zILbDOnuxcfqarN4OjvcB8d9ja9AA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=ucutE9tVrKg8bG1XX/lcHYR1DORerY7wTTSfiDErO4Y=; b=YCZ3QaJf93AvObKsTFh4pFJoDx/fqbP8SM9ZU8OGu2/8R2SszhBxCExmwiHZt3JFZp Vp1xV3ZyWfPNyPWt30+r2woKdmQm7hNOOcRwg5hAA3rc/NkC5RHCapRotooJrH1k5U63 RAt0XveepoWlUjTrPPdMmde0thzcT6xHF+GsocpTqIqQ0/32yEB6o1TLy4MM8HRc2NtW s76GHq4K9RhEIhz27Yaq03h+svxx6FyfLkLlQDiHgw3NNbejZkAUL8XKxNs4b1zGjbkh 3bxMJRAQsu7iIipLyJwwSBJTV3anIeCIfrpzDwSbr1td/+KFaw7QuRl404HRo2QBrc2Z GHtg== X-Gm-Message-State: AOAM53262LLxCVpnbyBOlASejpQ6jgsSSVY/RRCVgwKyIyAiCxMZvEvn 0qGj9Kci7kysb/dnjvRnNcJ6WA== X-Received: by 2002:a1c:a90f:: with SMTP id s15mr2203893wme.154.1612348493733; Wed, 03 Feb 2021 02:34:53 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b11sm2957419wrp.60.2021.02.03.02.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 02:34:53 -0800 (PST) Date: Wed, 3 Feb 2021 11:34:50 +0100 From: Daniel Vetter To: Christoph Hellwig Cc: Frederic Barrat , Andrew Donnellan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Jessica Yu , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, dri-devel@lists.freedesktop.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: Re: [PATCH 02/13] drm: remove drm_fb_helper_modinit Message-ID: Mail-Followup-To: Christoph Hellwig , Frederic Barrat , Andrew Donnellan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Jessica Yu , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, dri-devel@lists.freedesktop.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org References: <20210128181421.2279-1-hch@lst.de> <20210128181421.2279-3-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210128181421.2279-3-hch@lst.de> X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 28, 2021 at 07:14:10PM +0100, Christoph Hellwig wrote: > 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). > > Signed-off-by: Christoph Hellwig Hm I thought I've acked this one already somewhere for merging through your tree. Acked-by: Daniel Vetter > --- > 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 | 25 +++++++++++----------- > 3 files changed, 12 insertions(+), 44 deletions(-) > > diff --git a/drivers/gpu/drm/drm_crtc_helper_internal.h b/drivers/gpu/drm/drm_crtc_helper_internal.h > index 25ce42e799952c..61e09f8a8d0ff0 100644 > --- 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); > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 4b81195106875d..0b9f1ae1b7864c 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -2499,24 +2499,3 @@ void drm_fbdev_generic_setup(struct drm_device *dev, > drm_client_register(&fb_helper->client); > } > EXPORT_SYMBOL(drm_fbdev_generic_setup); > - > -/* 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); > diff --git a/drivers/gpu/drm/drm_kms_helper_common.c b/drivers/gpu/drm/drm_kms_helper_common.c > index 221a8528c9937a..f933da1656eb52 100644 > --- a/drivers/gpu/drm/drm_kms_helper_common.c > +++ b/drivers/gpu/drm/drm_kms_helper_common.c > @@ -64,19 +64,18 @@ MODULE_PARM_DESC(edid_firmware, > > static int __init drm_kms_helper_init(void) > { > - int ret; > - > - /* 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; > + /* > + * 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"); > + > + return drm_dp_aux_dev_init(); > } > > static void __exit drm_kms_helper_exit(void) > -- > 2.29.2 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch