From patchwork Thu Feb 9 13:54:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134658 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE8DAC05027 for ; Thu, 9 Feb 2023 13:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbjBINzR (ORCPT ); Thu, 9 Feb 2023 08:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbjBINzQ (ORCPT ); Thu, 9 Feb 2023 08:55:16 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3B45ACFF for ; Thu, 9 Feb 2023 05:55:14 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0213B5D030; Thu, 9 Feb 2023 13:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K2/BUPdiD/DSFrLNZwoR2NooKVxr9DAwaBGLRql4mPs=; b=mYlREntyu41T1DaQVnlSCb00Zocdk5dmaMnrt5MKQheBHRoc8HAeYIN+vKkkqHdiPisBE0 qV4P4uTPmaZF2jztXT+rUyPXewprfrvFBPmn8iFJR6AOVMM8AJ8DEg5Oh3ICUbv1ZLhWEC 8NUyQRkI4dzchjaJ0kTQ/VwkDI2TOvI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K2/BUPdiD/DSFrLNZwoR2NooKVxr9DAwaBGLRql4mPs=; b=858j3P5EDKNBQDCG86dhDiJ/ZInrJvm4uqoJ6knYW+RL3ywqfJ3PCtxawAB5EMMmVpy1dX /pPdiSXSlI66k5Aw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9F7E313915; Thu, 9 Feb 2023 13:55:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UBwdJkD75GNTfwAAMHmgww (envelope-from ); Thu, 09 Feb 2023 13:55:12 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geoff@infradead.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Thomas Zimmermann , Daniel Vetter Subject: [PATCH 01/11] fbdev: Fix contact info in fb_cmdline.c Date: Thu, 9 Feb 2023 14:54:59 +0100 Message-Id: <20230209135509.7786-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209135509.7786-1-tzimmermann@suse.de> References: <20230209135509.7786-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Fix Daniel's email address. No functional changes. Signed-off-by: Thomas Zimmermann Cc: Daniel Vetter Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fb_cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c index 3b5bd666b952..6792010d6716 100644 --- a/drivers/video/fbdev/core/fb_cmdline.c +++ b/drivers/video/fbdev/core/fb_cmdline.c @@ -12,7 +12,7 @@ * for more details. * * Authors: - * Vetter + * Daniel Vetter */ #include #include From patchwork Thu Feb 9 13:55:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134661 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4910BC64ED6 for ; Thu, 9 Feb 2023 13:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbjBINzT (ORCPT ); Thu, 9 Feb 2023 08:55:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbjBINzR (ORCPT ); Thu, 9 Feb 2023 08:55:17 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D8805ACD0 for ; Thu, 9 Feb 2023 05:55:15 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 35C8C5D031; Thu, 9 Feb 2023 13:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jRGV1sHWfA7dHKuzbZtPETV56sGZm893xDJqn9cFqAI=; b=ysXmUKmdYXeGDvLEm+JQVP6v7SCD19NlPd+F4LIqlZ5CPgmjMdhcaMGivagmFoyJmPkD3X fllymK0hneVqsFRNk48x7r79fovNMEuuZHHCWc0IZ66Jy7r3iOvggKFmE9cG2Jani52bMh DELoNCZiMwIUkc2gAo4HUoDas3QPwk4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jRGV1sHWfA7dHKuzbZtPETV56sGZm893xDJqn9cFqAI=; b=swXYWmDfLiLpLXZVgBaUGMMoVUFVyi3ll6Vjpk9dJdYBEhGtsxvlSYiq5s+/pkkJWzgV1A bmFCfMPDFVn9lTCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EE117138E4; Thu, 9 Feb 2023 13:55:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UD5MOUD75GNTfwAAMHmgww (envelope-from ); Thu, 09 Feb 2023 13:55:12 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geoff@infradead.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Thomas Zimmermann Subject: [PATCH 02/11] fbdev: Transfer video= option strings to caller; clarify ownership Date: Thu, 9 Feb 2023 14:55:00 +0100 Message-Id: <20230209135509.7786-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209135509.7786-1-tzimmermann@suse.de> References: <20230209135509.7786-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org In fb_get_options(), always duplicate the returned option string and transfer ownership of the memory to the function's caller. Until now, only the global option string got duplicated and transferred to the caller; the per-driver options were owned by fb_get_options(). In the end, it was impossible for the function's caller to detect if it had to release the string's memory buffer. Hence, all calling drivers leak the memory buffer. The leaks have existed ever since, but drivers only call fb_get_option() once as part of module initialization. So the amount of leaked memory is not significant. Fix the semantics of fb_get_option() by unconditionally transferring ownership of the memory buffer to the caller. Later patches can resolve the memory leaks in the fbdev drivers. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fb_cmdline.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c index 6792010d6716..702b00b71870 100644 --- a/drivers/video/fbdev/core/fb_cmdline.c +++ b/drivers/video/fbdev/core/fb_cmdline.c @@ -30,13 +30,17 @@ EXPORT_SYMBOL_GPL(fb_mode_option); * (video=:) * @option: the option will be stored here * + * The caller owns the string returned in @option and is + * responsible for releasing the memory. + * * NOTE: Needed to maintain backwards compatibility */ int fb_get_options(const char *name, char **option) { - char *opt, *options = NULL; + const char *options = NULL; int retval = 0; int name_len = strlen(name), i; + char *opt; if (name_len && ofonly && strncmp(name, "offb", 4)) retval = 1; @@ -55,12 +59,16 @@ int fb_get_options(const char *name, char **option) } /* No match, pass global option */ if (!options && option && fb_mode_option) - options = kstrdup(fb_mode_option, GFP_KERNEL); + options = fb_mode_option; if (options && !strncmp(options, "off", 3)) retval = 1; - if (option) - *option = options; + if (option) { + if (options) + *option = kstrdup(options, GFP_KERNEL); + else + *option = NULL; + } return retval; } From patchwork Thu Feb 9 13:55:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134657 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31B00C61DA4 for ; Thu, 9 Feb 2023 13:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230308AbjBINzR (ORCPT ); Thu, 9 Feb 2023 08:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230347AbjBINzQ (ORCPT ); Thu, 9 Feb 2023 08:55:16 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1819D539 for ; Thu, 9 Feb 2023 05:55:14 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 754C7229FA; Thu, 9 Feb 2023 13:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kgQsjwqOWkegEQwhCA0vXxb8H/G8l/Mn0HdB+pT9yi4=; b=A72ExH9XqqIvCiwkmXutNdzfBj0p26bIsdTaZbdfhsM4lh6uTXKmCMaBbdigKbFZA+RDsE 3bxVscHPBVA/pH3axAiRW3zHWgU8Je09kvWxnUHsJSFAvxF2wAP6qGAk9LN0qdDjtbo1il U1V+0pD2xaDA11ypPqlRZlEwaJ1Y8hI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kgQsjwqOWkegEQwhCA0vXxb8H/G8l/Mn0HdB+pT9yi4=; b=4+HZO7hfNYIRH3XythLS8e3AYkH7hcjPbL7VrBkz8MVPHSF4mxhok29IxxRuEsDedg62I4 5MpN3EUbFqxlu8Bg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3A06613915; Thu, 9 Feb 2023 13:55:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UJdgDUH75GNTfwAAMHmgww (envelope-from ); Thu, 09 Feb 2023 13:55:13 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geoff@infradead.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Thomas Zimmermann Subject: [PATCH 03/11] fbdev: Support NULL for name in option-string lookup Date: Thu, 9 Feb 2023 14:55:01 +0100 Message-Id: <20230209135509.7786-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209135509.7786-1-tzimmermann@suse.de> References: <20230209135509.7786-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Ignore the per-driver video options if no driver name has been specified to fb_get_option(). Return the global options in this case. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fb_cmdline.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c index 702b00b71870..cc8a88e8f308 100644 --- a/drivers/video/fbdev/core/fb_cmdline.c +++ b/drivers/video/fbdev/core/fb_cmdline.c @@ -39,13 +39,18 @@ int fb_get_options(const char *name, char **option) { const char *options = NULL; int retval = 0; - int name_len = strlen(name), i; + size_t name_len; char *opt; + if (name) + name_len = strlen(name); + if (name_len && ofonly && strncmp(name, "offb", 4)) retval = 1; if (name_len && !retval) { + unsigned int i; + for (i = 0; i < FB_MAX; i++) { if (video_options[i] == NULL) continue; From patchwork Thu Feb 9 13:55:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134660 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32A54C64EC7 for ; Thu, 9 Feb 2023 13:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbjBINzT (ORCPT ); Thu, 9 Feb 2023 08:55:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbjBINzR (ORCPT ); Thu, 9 Feb 2023 08:55:17 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DCA25B76B for ; Thu, 9 Feb 2023 05:55:15 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B87BC5D02F; Thu, 9 Feb 2023 13:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fdkZxZ1tj+/TzXlhWq4Mz1qQtxylK1v1bJXhXgBLSpA=; b=MH66V1Az1kpW7k9YAXKTcie6qpNmwWClZuwMgliuDPAjI56M0jtR4gNYlzPRC+neCUkQss 88V0U2sokjiqGIa9oJcCJIxjhQw/vJ0XGHzgRSuAH/T9rtR/FlgWwyPzNw7Z6cW7Y4nJsi GHA+EO9WpV2ZWz3aF46GJ3Uk41s4qmw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fdkZxZ1tj+/TzXlhWq4Mz1qQtxylK1v1bJXhXgBLSpA=; b=FgTBqDZxusuB15BYHZSu+HXrLvTcIJCQcWBG2vF+iJDux84+Zetdu43UT85Ha+BtyyJr/t wZCTqz5yz8pp7QAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7AA26138E4; Thu, 9 Feb 2023 13:55:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MOT7HEH75GNTfwAAMHmgww (envelope-from ); Thu, 09 Feb 2023 13:55:13 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geoff@infradead.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Thomas Zimmermann Subject: [PATCH 04/11] drivers/ps3: Read video= option with fb_get_option() Date: Thu, 9 Feb 2023 14:55:02 +0100 Message-Id: <20230209135509.7786-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209135509.7786-1-tzimmermann@suse.de> References: <20230209135509.7786-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Get the kernel's global video= parameter with fb_get_option(). Done to unexport the internal fbdev state fb_mode_config. No functional changes. Signed-off-by: Thomas Zimmermann Tested-by: Geoff Levand Reviewed-by: Javier Martinez Canillas --- drivers/ps3/ps3av.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c index 516e6d14d32e..8f3e60f1bfe2 100644 --- a/drivers/ps3/ps3av.c +++ b/drivers/ps3/ps3av.c @@ -921,6 +921,9 @@ EXPORT_SYMBOL_GPL(ps3av_audio_mute); static int ps3av_probe(struct ps3_system_bus_device *dev) { +#ifdef CONFIG_FB + char *mode_option = NULL; +#endif int res; int id; @@ -969,8 +972,12 @@ static int ps3av_probe(struct ps3_system_bus_device *dev) ps3av_get_hw_conf(ps3av); #ifdef CONFIG_FB - if (fb_mode_option && !strcmp(fb_mode_option, "safe")) - safe_mode = 1; + fb_get_options(NULL, &mode_option); + if (mode_option) { + if (!strcmp(mode_option, "safe")) + safe_mode = 1; + kfree(mode_option); + } #endif /* CONFIG_FB */ id = ps3av_auto_videomode(&ps3av->av_hw_conf); if (id < 0) { From patchwork Thu Feb 9 13:55:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134662 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AC60C64ED8 for ; Thu, 9 Feb 2023 13:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230409AbjBINzU (ORCPT ); Thu, 9 Feb 2023 08:55:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbjBINzR (ORCPT ); Thu, 9 Feb 2023 08:55:17 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E7E65B770 for ; Thu, 9 Feb 2023 05:55:15 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 057ED22A07; Thu, 9 Feb 2023 13:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8eBCLRr3t1h8753CZ0GUzerEoeVgFt36ay0mIxK/Nlk=; b=RpxPnW2YRMAvdXXvgwtBBFHfVKDfyVoxorZzYEeC2BMCok6Vlbpz/p5i44Q73/+lFUMhGd gUPgsHb6lJ02TEst8GtVA7FBv6we67LZFETHBr+qTUdxIRmVLW9FxU9dC9fhKQD6jXLLa4 IbjMntXxvkFdg/pGDjc+StSWTzG9V6Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8eBCLRr3t1h8753CZ0GUzerEoeVgFt36ay0mIxK/Nlk=; b=8WA+mC44dHmYSPNgW47lM3JP7rmzvxibc9Yk9LKoVTLJvD0QbAxlSlAIB39+Ep+/4U0kl6 YtqCBx7G04oJVABQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BC93113915; Thu, 9 Feb 2023 13:55:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YGQsLUH75GNTfwAAMHmgww (envelope-from ); Thu, 09 Feb 2023 13:55:13 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geoff@infradead.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Thomas Zimmermann Subject: [PATCH 05/11] fbdev: Read video= option with fb_get_option() in modedb Date: Thu, 9 Feb 2023 14:55:03 +0100 Message-Id: <20230209135509.7786-6-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209135509.7786-1-tzimmermann@suse.de> References: <20230209135509.7786-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Get the kernel's global video= parameter with fb_get_option(). Done to unexport the internal fbdev state fb_mode_config. No functional changes. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/core/modedb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c index 6473e0dfe146..23cf8eba785d 100644 --- a/drivers/video/fbdev/core/modedb.c +++ b/drivers/video/fbdev/core/modedb.c @@ -620,6 +620,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, const struct fb_videomode *default_mode, unsigned int default_bpp) { + char *mode_option_buf = NULL; int i; /* Set up defaults */ @@ -635,8 +636,10 @@ int fb_find_mode(struct fb_var_screeninfo *var, default_bpp = 8; /* Did the user specify a video mode? */ - if (!mode_option) - mode_option = fb_mode_option; + if (!mode_option) { + fb_get_options(NULL, &mode_option_buf); + mode_option = mode_option_buf; + } if (mode_option) { const char *name = mode_option; unsigned int namelen = strlen(name); @@ -715,6 +718,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, res_specified = 1; } done: + kfree(mode_option_buf); if (cvt) { struct fb_videomode cvt_mode; int ret; From patchwork Thu Feb 9 13:55:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134663 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48C7DC05027 for ; Thu, 9 Feb 2023 13:55:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230005AbjBINzV (ORCPT ); Thu, 9 Feb 2023 08:55:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230356AbjBINzR (ORCPT ); Thu, 9 Feb 2023 08:55:17 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD86F5ACDD for ; Thu, 9 Feb 2023 05:55:15 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 46E665D034; Thu, 9 Feb 2023 13:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bEwe0REbK3F3oC8Uu9FlEwtuW86iKy9KWXCWyZHO42o=; b=M5N88VL8Ns21zjPvhyeozFeQpsmid4Te8TprjCxeJL4xXa0Ogt5Rkj5d4DTu9Jzc8UFdfZ V4g7WM/oyJecv0HIPvlm2ALSGReYQu2lO2tMUQp65IfgotVxV8r/my1IOCs7U95g6ZEGlL RZCOqryiGQwKU4j+fS0lFl50FSl8N+U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bEwe0REbK3F3oC8Uu9FlEwtuW86iKy9KWXCWyZHO42o=; b=Q2kE1JvwIkwWzaPI6UAI7dWPazGSLygPUmlGy+RdPJPAWZl6vOJH97Anc3XB3TIYaxePLJ VGEiqyBruRJqw5Bw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 096C2138E4; Thu, 9 Feb 2023 13:55:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OK97AUL75GNTfwAAMHmgww (envelope-from ); Thu, 09 Feb 2023 13:55:14 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geoff@infradead.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Thomas Zimmermann Subject: [PATCH 06/11] fbdev: Unexport fb_mode_option Date: Thu, 9 Feb 2023 14:55:04 +0100 Message-Id: <20230209135509.7786-7-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209135509.7786-1-tzimmermann@suse.de> References: <20230209135509.7786-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org There are no external users of fb_mode_option. Unexport the variable and declare it static. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fb_cmdline.c | 4 +--- include/linux/fb.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c index cc8a88e8f308..512da89ff8b5 100644 --- a/drivers/video/fbdev/core/fb_cmdline.c +++ b/drivers/video/fbdev/core/fb_cmdline.c @@ -18,11 +18,9 @@ #include static char *video_options[FB_MAX] __read_mostly; +static const char *fb_mode_option __read_mostly; static int ofonly __read_mostly; -const char *fb_mode_option; -EXPORT_SYMBOL_GPL(fb_mode_option); - /** * fb_get_options - get kernel boot parameters * @name: framebuffer name as it would appear in diff --git a/include/linux/fb.h b/include/linux/fb.h index daf336385613..054e8950b274 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -764,7 +764,6 @@ struct dmt_videomode { const struct fb_videomode *mode; }; -extern const char *fb_mode_option; extern const struct fb_videomode vesa_modes[]; extern const struct dmt_videomode dmt_modes[]; From patchwork Thu Feb 9 13:55:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134665 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7C68C61DA4 for ; Thu, 9 Feb 2023 13:55:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbjBINzX (ORCPT ); Thu, 9 Feb 2023 08:55:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230362AbjBINzR (ORCPT ); Thu, 9 Feb 2023 08:55:17 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F091D5B762 for ; Thu, 9 Feb 2023 05:55:15 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8DDF522A14; Thu, 9 Feb 2023 13:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=msBxcERkKMvLqznzzBGHEc/n4urDGACOz1gYm5JVXyM=; b=0KCsbM2vfZEq/hZEd1ijikGYYKLmz3QW4mX3QoiPifhakbV88MPeJwnWr7CZEkAZefCX93 XISjVI4/ymZEz2RpGDgXW1roscO81qUFpdJSIpb80HOKAm7jaj/jOy/tWuOhTyoAFjJl1i cheGyMNXalyoYNOgKGEy4uFwtDekXb8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=msBxcERkKMvLqznzzBGHEc/n4urDGACOz1gYm5JVXyM=; b=lrX1a/nBCZxBYfRy/HlY71zgBpHjiOcl4uaDA05uQlgm09oXnrLIqjK3gNWjDuYU3K+/oh a8YPYeKjfqdS7/DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4AA8613915; Thu, 9 Feb 2023 13:55:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +PZyEUL75GNTfwAAMHmgww (envelope-from ); Thu, 09 Feb 2023 13:55:14 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geoff@infradead.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Thomas Zimmermann Subject: [PATCH 07/11] fbdev: Move option-string lookup into helper Date: Thu, 9 Feb 2023 14:55:05 +0100 Message-Id: <20230209135509.7786-8-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209135509.7786-1-tzimmermann@suse.de> References: <20230209135509.7786-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Move the lookup of the option string into an internal helper. No functional changes. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fb_cmdline.c | 60 ++++++++++++++++----------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c index 512da89ff8b5..f811c7b679e1 100644 --- a/drivers/video/fbdev/core/fb_cmdline.c +++ b/drivers/video/fbdev/core/fb_cmdline.c @@ -21,6 +21,36 @@ static char *video_options[FB_MAX] __read_mostly; static const char *fb_mode_option __read_mostly; static int ofonly __read_mostly; +static const char *__fb_get_options(const char *name) +{ + const char *options = NULL; + size_t name_len = 0; + + if (name) + name_len = strlen(name); + + if (name_len) { + unsigned int i; + const char *opt; + + for (i = 0; i < ARRAY_SIZE(video_options); ++i) { + if (!video_options[i]) + continue; + if (video_options[i][0] == '\0') + continue; + opt = video_options[i]; + if (!strncmp(opt, name, name_len) && opt[name_len] == ':') + options = opt + name_len + 1; + } + } + + /* No match, return global options */ + if (!options) + options = fb_mode_option; + + return options; +} + /** * fb_get_options - get kernel boot parameters * @name: framebuffer name as it would appear in @@ -35,36 +65,18 @@ static int ofonly __read_mostly; */ int fb_get_options(const char *name, char **option) { - const char *options = NULL; int retval = 0; - size_t name_len; - char *opt; + const char *options; - if (name) - name_len = strlen(name); - - if (name_len && ofonly && strncmp(name, "offb", 4)) + if (name && ofonly && strncmp(name, "offb", 4)) retval = 1; - if (name_len && !retval) { - unsigned int i; + options = __fb_get_options(name); - for (i = 0; i < FB_MAX; i++) { - if (video_options[i] == NULL) - continue; - if (!video_options[i][0]) - continue; - opt = video_options[i]; - if (!strncmp(name, opt, name_len) && - opt[name_len] == ':') - options = opt + name_len + 1; - } + if (options) { + if (!strncmp(options, "off", 3)) + retval = 1; } - /* No match, pass global option */ - if (!options && option && fb_mode_option) - options = fb_mode_option; - if (options && !strncmp(options, "off", 3)) - retval = 1; if (option) { if (options) From patchwork Thu Feb 9 13:55:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134666 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38204C636D7 for ; Thu, 9 Feb 2023 13:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230348AbjBINzY (ORCPT ); Thu, 9 Feb 2023 08:55:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbjBINzU (ORCPT ); Thu, 9 Feb 2023 08:55:20 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21E02D539 for ; Thu, 9 Feb 2023 05:55:16 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DF0E35D032; Thu, 9 Feb 2023 13:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cc/wkb7CTrIJff5YFI4h23UKqUPZFJYr44axR8SHoNs=; b=Gt5F6caPF2qChBJDy5VnxjBO/iiwDrvc+HWHA01om5JijVH0w8mETcvJjcd8qTpv5IhTaf oPBpJACWKJLXcHCXd0ZKUU3C27Li1XyBcbEqmJVevcRkVjldk7oAoCld0Srg/WVy6wEAPp IHCqgz7wduWxeB5MymKRO/R6Tf5+W/Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cc/wkb7CTrIJff5YFI4h23UKqUPZFJYr44axR8SHoNs=; b=IgTwud9Qm7Xo/p2iAptM9D+xs2u5m8g49x6bhlhnCKXJavD6OCPVoVW/EeB7GjF/hst2Js k4UW4L4KgWIYsmDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 92A84138E4; Thu, 9 Feb 2023 13:55:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uCfQIkL75GNTfwAAMHmgww (envelope-from ); Thu, 09 Feb 2023 13:55:14 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geoff@infradead.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Thomas Zimmermann Subject: [PATCH 08/11] fbdev: Handle video= parameter in video/cmdline.c Date: Thu, 9 Feb 2023 14:55:06 +0100 Message-Id: <20230209135509.7786-9-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209135509.7786-1-tzimmermann@suse.de> References: <20230209135509.7786-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Handle the command-line parameter video= in video/cmdline.c. Implement the fbdev helper fb_get_options() on top. Will allows to handle the kernel parameter in DRM without fbdev dependencies. Note that __video_get_options() has the meaning of its return value inverted compared to fb_get_options(). The new helper returns true if the adapter has been enabled, and false otherwise. There is the ofonly parameter, which disables output for non-OF-based framebuffers. It is only for offb and looks like a workaround. The actual purpose it not clear to me. Use 'video=off' or 'nomodeset' instead. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/Kconfig | 2 +- drivers/video/Kconfig | 3 + drivers/video/Makefile | 1 + drivers/video/cmdline.c | 133 ++++++++++++++++++++++++++ drivers/video/fbdev/Kconfig | 5 +- drivers/video/fbdev/core/Makefile | 3 +- drivers/video/fbdev/core/fb_cmdline.c | 93 +++--------------- include/video/cmdline.h | 20 ++++ 8 files changed, 172 insertions(+), 88 deletions(-) create mode 100644 drivers/video/cmdline.c create mode 100644 include/video/cmdline.h diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index dc0f94f02a82..81c8a99c744a 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -10,13 +10,13 @@ menuconfig DRM depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA select DRM_PANEL_ORIENTATION_QUIRKS select HDMI - select FB_CMDLINE select I2C select DMA_SHARED_BUFFER select SYNC_FILE # gallium uses SYS_kcmp for os_same_file_description() to de-duplicate # device and dmabuf fd. Let's make sure that is available for our userspace. select KCMP + select VIDEO_CMDLINE select VIDEO_NOMODESET help Kernel-level support for the Direct Rendering Infrastructure (DRI) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 6d2fde6c5d11..bf05363d8906 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -11,6 +11,9 @@ config APERTURE_HELPERS Support tracking and hand-over of aperture ownership. Required by graphics drivers for firmware-provided framebuffers. +config VIDEO_CMDLINE + bool + config VIDEO_NOMODESET bool default n diff --git a/drivers/video/Makefile b/drivers/video/Makefile index a50eb528ed3c..831c9fa57a6c 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_APERTURE_HELPERS) += aperture.o obj-$(CONFIG_VGASTATE) += vgastate.o +obj-$(CONFIG_VIDEO_CMDLINE) += cmdline.o obj-$(CONFIG_VIDEO_NOMODESET) += nomodeset.o obj-$(CONFIG_HDMI) += hdmi.o diff --git a/drivers/video/cmdline.c b/drivers/video/cmdline.c new file mode 100644 index 000000000000..d3d257489c3d --- /dev/null +++ b/drivers/video/cmdline.c @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Based on the fbdev code in drivers/video/fbdev/core/fb_cmdline: + * + * Copyright (C) 2014 Intel Corp + * Copyright (C) 1994 Martin Schaller + * + * 2001 - Documented with DocBook + * - Brad Douglas + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + * + * Authors: + * Daniel Vetter + */ + +#include /* for FB_MAX */ +#include + +#include