From patchwork Thu Feb 9 13:54:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13134659 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 6E3CAC636D7 for ; Thu, 9 Feb 2023 13:55:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230392AbjBINzS (ORCPT ); Thu, 9 Feb 2023 08:55:18 -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 S230345AbjBINzQ (ORCPT ); Thu, 9 Feb 2023 08:55:16 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27D5E5ACC6 for ; Thu, 9 Feb 2023 05:55:13 -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 9CE3E229E0; Thu, 9 Feb 2023 13:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675950912; 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; bh=uRXYWe304mkCxYZE0lH4+u8aTbd19nfJc9iHmaY1sNs=; b=rGoNUeHAKyyaOWP1mlyHpoRNo8hh31zgKYmRP6qxRNT8QfNwA6YaXG7rHjRGE1m/ylLMGR g9ejrdOFZJ3NQA7dCMmp65bqYgU2kGtttdHBB326k38YyttBqXNB+ELPB4GiJtmucnSX6G /PrKOuOx9K1EKieAsj2P1/t25VALtC8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675950912; 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; bh=uRXYWe304mkCxYZE0lH4+u8aTbd19nfJc9iHmaY1sNs=; b=fxzGR2USnOzNJy0acLQiboQ/osEf+Oy+1nm5x8+ggn+D4J+XiU1aI6WICQgpe6xViZClJ+ fNNF/22aiuayXkAw== 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 5B3E3138E4; 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 iaZWFUD75GNTfwAAMHmgww (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 00/11] drm,fbdev: Move video= option to drivers/video Date: Thu, 9 Feb 2023 14:54:58 +0100 Message-Id: <20230209135509.7786-1-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The kernel's video= option sets the initial video mode. It is shared by fbdev and DRM, but located within the fbdev code. Move it to drivers/video/ and adapt callers. Allows DRM (and others) to use the option without depending on fbdev. While at it, fix the interface of the lookup functions. This requires a number of changes. First clarify the ownership of the option string in patch 2. The helper fb_get_options() returns the video= parameter's value. It's sometimes a copy and sometimes the original string. Hence callers, mostly fbdev drivers, have just leaked the returned string. Change this to always duplicate the option string in fb_get_options() and transfer ownership of the copy to the caller. We can then start to fix the memory leaks in the fbdev drivers. There's a global video= setting and a number of per-output settings. In patches 3 to 5, support explicit lookup of the global video option and lookup the string in fbdev's modedb and in a PS3 driver. Then avoid exporting the global setting's internal state variable in patch 6. Finally, in patches 7 to 11, move the video= option to drivers/video. It can be used directly in DRM and a PS3 driver. This fixes any memory leaks from the returned option string. For fbdev drivers, the helper fb_get_options() remains as an adapter aroudn the new interface. Tested with DRM and fbdev and built for the PS3. Thomas Zimmermann (11): fbdev: Fix contact info in fb_cmdline.c fbdev: Transfer video= option strings to caller; clarify ownership fbdev: Support NULL for name in option-string lookup drivers/ps3: Read video= option with fb_get_option() fbdev: Read video= option with fb_get_option() in modedb fbdev: Unexport fb_mode_option fbdev: Move option-string lookup into helper fbdev: Handle video= parameter in video/cmdline.c driver/ps3: Include