From patchwork Mon Jun 12 14:07:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691866 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 190B7C88CBA for ; Mon, 12 Jun 2023 14:14:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237324AbjFLOOB (ORCPT ); Mon, 12 Jun 2023 10:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237238AbjFLON5 (ORCPT ); Mon, 12 Jun 2023 10:13:57 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D3DA19C; Mon, 12 Jun 2023 07:13:56 -0700 (PDT) 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 E923D2271D; Mon, 12 Jun 2023 14:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579234; 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=3sJSCjaVrA7kDwsrSwIFOa10blfEXLpB2Uw9gtvLkjg=; b=hSBd0hsGveWAwWxApwvgqEoJMAbiHbtdo6ToeFC9hidvZd4Dj3dh9eMWiZ9HXxb6304RoF qm+dmkUJq5oihn7VHddM/vf0lwkeUfkKEzMPJvCv6rJkewBDlvJlNBIEPVO/axkFuF5P9/ SlpLfIpSmocHahtOoniSdFfgRnK02Lw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579234; 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=3sJSCjaVrA7kDwsrSwIFOa10blfEXLpB2Uw9gtvLkjg=; b=S1Jgo2ktxPghsHrzmX5ucnsVoDw+3nWTiUxOOv9/3vDPBmzJHmE070HuxLR1cReJdfmdMM tC1mAtvhCy6U1dBQ== 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 7A36A13A67; Mon, 12 Jun 2023 14:13:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kLPCHCIoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:13:54 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann , Laurent Pinchart , stable@vger.kernel.org Subject: [PATCH v2 01/38] backlight/bd6107: Compare against struct fb_info.device Date: Mon, 12 Jun 2023 16:07:39 +0200 Message-ID: <20230612141352.29939-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Struct bd6107_platform_data refers to a platform device within the Linux device hierarchy. The test in bd6107_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device. Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional. v2: * move renames into separate patch (Javier, Sam, Michael) Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver") Signed-off-by: Thomas Zimmermann Cc: Laurent Pinchart Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: dri-devel@lists.freedesktop.org Cc: # v3.12+ Reviewed-by: Javier Martinez Canillas Reviewed-by: Daniel Thompson --- drivers/video/backlight/bd6107.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index f4db6c064635b..e3410444ea235 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -104,7 +104,7 @@ static int bd6107_backlight_check_fb(struct backlight_device *backlight, { struct bd6107 *bd = bl_get_data(backlight); - return bd->pdata->fbdev == NULL || bd->pdata->fbdev == info->dev; + return bd->pdata->fbdev == NULL || bd->pdata->fbdev == info->device; } static const struct backlight_ops bd6107_backlight_ops = { From patchwork Mon Jun 12 14:07:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691865 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 6A742C88CBA for ; Mon, 12 Jun 2023 14:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237346AbjFLOOE (ORCPT ); Mon, 12 Jun 2023 10:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237249AbjFLON6 (ORCPT ); Mon, 12 Jun 2023 10:13:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 849B810E9; Mon, 12 Jun 2023 07:13:57 -0700 (PDT) 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 0393A201D6; Mon, 12 Jun 2023 14:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579236; 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=WCRr3tcfQ+ViTqvRJUG7w6CzJZFM3ZnmBQeGqDoFNyA=; b=B3c7FJ0o7rKovAlVqxsu+Jc3wMWjZdExXH2p5ByRwfcFc+ilXqYes3ifuEtwAiiCrDIhN8 cPt41wJHss0O3oTTg6pLfOWZEbyVZDdAH1WzxWbDAJligcdGIGgmJWO5l3MfvcQSUtUMFl wlaLfObvsRRjCNdzMpHBMhHseFCyxzg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579236; 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=WCRr3tcfQ+ViTqvRJUG7w6CzJZFM3ZnmBQeGqDoFNyA=; b=nP6ok9tGNYJPhTfSJhnOUhfUDt2dDp8Vtejn+3CZPIECp+BZnHlWEb0ubXBjmw/nIr8MW4 sgkJX4ml2AN+WhBw== 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 A2A3C13A67; Mon, 12 Jun 2023 14:13:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kCbcJiMoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:13:55 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann , Rich Felker , John Paul Adrian Glaubitz Subject: [PATCH v2 04/38] backlight/gpio_backlight: Rename field 'fbdev' to 'dev' Date: Mon, 12 Jun 2023 16:07:42 +0200 Message-ID: <20230612141352.29939-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Rename the field 'fbdev' in struct gpio_backlight_platform_data and struct gpio_backlight to 'dev', as they store pointers to the Linux platform device; not the fbdev device. Makes the code easier to understand. Signed-off-by: Thomas Zimmermann Cc: Rich Felker Cc: John Paul Adrian Glaubitz Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: linux-sh@vger.kernel.org Reviewed-by: Daniel Thompson --- arch/sh/boards/mach-ecovec24/setup.c | 2 +- drivers/video/backlight/gpio_backlight.c | 6 +++--- include/linux/platform_data/gpio_backlight.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 674da7ebd8b7f..310513646c9b3 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -386,7 +386,7 @@ static struct property_entry gpio_backlight_props[] = { }; static struct gpio_backlight_platform_data gpio_backlight_data = { - .fbdev = &lcdc_device.dev, + .dev = &lcdc_device.dev, }; static const struct platform_device_info gpio_backlight_device_info = { diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 5c5c99f7979e3..d3bea42407f15 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -17,7 +17,7 @@ #include struct gpio_backlight { - struct device *fbdev; + struct device *dev; struct gpio_desc *gpiod; }; @@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struct backlight_device *bl, { struct gpio_backlight *gbl = bl_get_data(bl); - return gbl->fbdev == NULL || gbl->fbdev == info->device; + return !gbl->dev || gbl->dev == info->device; } static const struct backlight_ops gpio_backlight_ops = { @@ -59,7 +59,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) return -ENOMEM; if (pdata) - gbl->fbdev = pdata->fbdev; + gbl->dev = pdata->dev; def_value = device_property_read_bool(dev, "default-on"); diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h index 1a8b5b1946fe4..323fbf5f76139 100644 --- a/include/linux/platform_data/gpio_backlight.h +++ b/include/linux/platform_data/gpio_backlight.h @@ -8,7 +8,7 @@ struct device; struct gpio_backlight_platform_data { - struct device *fbdev; + struct device *dev; }; #endif From patchwork Mon Jun 12 14:07:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691861 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 5859AC88CBD for ; Mon, 12 Jun 2023 14:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237477AbjFLOOS (ORCPT ); Mon, 12 Jun 2023 10:14:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237252AbjFLON6 (ORCPT ); Mon, 12 Jun 2023 10:13:58 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B95EE10F3; Mon, 12 Jun 2023 07:13:57 -0700 (PDT) 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 6A7B322835; Mon, 12 Jun 2023 14:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579236; 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=/aATnyJ6/OJWvj1ak0QEX6CtbSFf+k3ol6fqKdKcpbY=; b=GKSAR9llpzoRb1YAHGMn59ehs3RdP/qsyIwYHuqykmMy8UbQBJxbWlozUxBV2Kk8ieiXoi CGzfzAWPRp5ZQVdK2jhS3Rwej1/Sdaz9iWMgHT5CNQG7muHGkVW9gOxI579yI1bZDsn6mW w0KEwahMfLFSvNUrsfQpC21kOIjvgXo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579236; 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=/aATnyJ6/OJWvj1ak0QEX6CtbSFf+k3ol6fqKdKcpbY=; b=8C1WsCwEcFOi7n+yF6oBfxuoV7DwqTBh4HrRIW/hb+ocNUoWuqFRkb8AOk4ZB/0HEBLlKu mAMWZRvDycxEyaCQ== 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 0B49B1357F; Mon, 12 Jun 2023 14:13:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IKWnASQoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:13:56 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann , Laurent Pinchart , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , stable@vger.kernel.org Subject: [PATCH v2 05/38] backlight/lv5207lp: Compare against struct fb_info.device Date: Mon, 12 Jun 2023 16:07:43 +0200 Message-ID: <20230612141352.29939-6-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Struct lv5207lp_platform_data refers to a platform device within the Linux device hierarchy. The test in lv5207lp_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device. Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional. v2: * move renames into separate patch (Javier, Sam, Michael) Fixes: 82e5c40d88f9 ("backlight: Add Sanyo LV5207LP backlight driver") Signed-off-by: Thomas Zimmermann Cc: Laurent Pinchart Cc: Yoshinori Sato Cc: Rich Felker Cc: John Paul Adrian Glaubitz Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: linux-sh@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: # v3.12+ Reviewed-by: Javier Martinez Canillas Reviewed-by: Daniel Thompson --- drivers/video/backlight/lv5207lp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c index 00673c8b66ac5..99ba4bc0a500d 100644 --- a/drivers/video/backlight/lv5207lp.c +++ b/drivers/video/backlight/lv5207lp.c @@ -67,7 +67,7 @@ static int lv5207lp_backlight_check_fb(struct backlight_device *backlight, { struct lv5207lp *lv = bl_get_data(backlight); - return lv->pdata->fbdev == NULL || lv->pdata->fbdev == info->dev; + return lv->pdata->fbdev == NULL || lv->pdata->fbdev == info->device; } static const struct backlight_ops lv5207lp_backlight_ops = { From patchwork Mon Jun 12 14:07:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691864 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 0432BC88CBE for ; Mon, 12 Jun 2023 14:14:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237382AbjFLOOI (ORCPT ); Mon, 12 Jun 2023 10:14:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237282AbjFLOOA (ORCPT ); Mon, 12 Jun 2023 10:14:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3967EF0; Mon, 12 Jun 2023 07:13:59 -0700 (PDT) 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 CEFC8203D5; Mon, 12 Jun 2023 14:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579237; 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=EhX11v3xhAS4lpyLHOu95ewhCONPfJzHyC0tG2hvu+8=; b=k0h/AQn3ulq4fJqWuASei26YySfG7Gb9Bc6fXvFyRUCbvcDKnmSK8xz7tIWEQuEFfHXE3/ Uti9k8xKT7AiWbtkfUWSsQj4BL6Vsnhn07J1EHoPFC0uV35XHe6h2nIrRGe1C3QwS7lhji oxmTGnePZMIh4uY+0l+h32XQEMYK1vk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579237; 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=EhX11v3xhAS4lpyLHOu95ewhCONPfJzHyC0tG2hvu+8=; b=DaoKM/63/Zu2UQ3GoGRpA5GROMnfH8KNosfT91Bi9zrS2uPpnAHXPPbhVsQDzvVZ2l7ZbZ kX9uNX25xZ51eLBg== 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 820331357F; Mon, 12 Jun 2023 14:13:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yO/iHiUoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:13:57 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 09/38] fbdev/aty128fb: Reorder backlight and framebuffer init/cleanup Date: Mon, 12 Jun 2023 16:07:47 +0200 Message-ID: <20230612141352.29939-10-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The driver's backlight code requires the framebuffer to be registered. Therefore reorder the init and cleanup calls for both data structures. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/aty/aty128fb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 36a9ac05a340f..b4a49068a522f 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -2028,14 +2028,14 @@ static int aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent) par->asleep = 0; par->lock_blank = 0; + if (register_framebuffer(info) < 0) + return 0; + #ifdef CONFIG_FB_ATY128_BACKLIGHT if (backlight) aty128_bl_init(par); #endif - if (register_framebuffer(info) < 0) - return 0; - fb_info(info, "%s frame buffer device on %s\n", info->fix.id, video_card); @@ -2167,12 +2167,12 @@ static void aty128_remove(struct pci_dev *pdev) par = info->par; - unregister_framebuffer(info); - #ifdef CONFIG_FB_ATY128_BACKLIGHT aty128_bl_exit(info->bl_dev); #endif + unregister_framebuffer(info); + arch_phys_wc_del(par->wc_cookie); iounmap(par->regbase); iounmap(info->screen_base); From patchwork Mon Jun 12 14:07:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691863 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 102E9CA9EA3 for ; Mon, 12 Jun 2023 14:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237401AbjFLOOK (ORCPT ); Mon, 12 Jun 2023 10:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237316AbjFLOOA (ORCPT ); Mon, 12 Jun 2023 10:14:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9215810D9; Mon, 12 Jun 2023 07:13:59 -0700 (PDT) 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 31693203E7; Mon, 12 Jun 2023 14:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579238; 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=6kaVCNj4tgN+z2DdqslCQwj9/KoTXQV8PSRO8egtdwg=; b=TUsdTAYgmS8pspPnsXIEh8X/Q6hFe1+kgCRCx0cJ6HUYwaxplYsxI7KxIcSv2gk1WzxUCM tkixYzDw8TI8VjyqX7mSHAcHknZ+W4XGL4Kb7X5C/W26lmJTdeuW/lu1OwzMfFvh60xGPu TU9c1g6qtcGNROkxe/o0SMuLIJDy9Vs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579238; 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=6kaVCNj4tgN+z2DdqslCQwj9/KoTXQV8PSRO8egtdwg=; b=eB6RqgxueXzNYsaF1Y3a4zr0pkYjM/24cfOxXsOq8/07BOeFZ1+nrTHTM01B4IJuKY+Ls3 9RGhQD0zMxMTIaBg== 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 D4BBE1357F; Mon, 12 Jun 2023 14:13:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mG3+MiUoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:13:57 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 10/38] fbdev/aty128fb: Use hardware device as backlight parent Date: Mon, 12 Jun 2023 16:07:48 +0200 Message-ID: <20230612141352.29939-11-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use the hardware device in struct fb_info.device as parent of the backlight device. Aligns the driver with the rest of the codebase and prepares fbdev for making struct fb_info.dev optional. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/aty/aty128fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index b4a49068a522f..2d9320a52e519 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -1846,7 +1846,7 @@ static void aty128_bl_init(struct aty128fb_par *par) memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = FB_BACKLIGHT_LEVELS - 1; - bd = backlight_device_register(name, info->dev, par, &aty128_bl_data, + bd = backlight_device_register(name, info->device, par, &aty128_bl_data, &props); if (IS_ERR(bd)) { info->bl_dev = NULL; From patchwork Mon Jun 12 14:07:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691862 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 B474FC88CB8 for ; Mon, 12 Jun 2023 14:14:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237465AbjFLOON (ORCPT ); Mon, 12 Jun 2023 10:14:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237341AbjFLOOD (ORCPT ); Mon, 12 Jun 2023 10:14:03 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7658F10C4; Mon, 12 Jun 2023 07:14:00 -0700 (PDT) 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 D2F6920487; Mon, 12 Jun 2023 14:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579238; 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=wgea4CAx5RQUmrYwJYNcyiyGnDDQ3dqg16YEIp4VW1k=; b=piT0tDi1k9GcInx2VZawxHTEUmo2GUSb9G3n/TbHXMhvuQlgrWIbbSpC7QeLwMxNIAN3vk BKMMEeXRYEjhnYn4InzLNw8mNeIFW69LpZJDyVZmXFtHFva0ZIgCP0vBU6pkTiC4UgL7Pb BFmZBmsSL1PCA2RFkGUhpZComRzERy0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579238; 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=wgea4CAx5RQUmrYwJYNcyiyGnDDQ3dqg16YEIp4VW1k=; b=y7enem/ailjQhCZUOs9GcJ2zdJtJLqZ/6l9bBay5RCU9uOv4oi3yhizKOazmW1ooU9Hale IG3q1iWDXJNUIdAQ== 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 86A4113A67; Mon, 12 Jun 2023 14:13:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iKDkHyYoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:13:58 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 12/38] fbdev/ep93xx-fb: Alloc DMA memory from hardware device Date: Mon, 12 Jun 2023 16:07:50 +0200 Message-ID: <20230612141352.29939-13-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Pass the hardware device to the DMA helpers dma_alloc_wc(), dma_mmap_wc() and dma_free_coherent(). The fbdev device that is currently being used is a software device and does not provide DMA memory. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/ep93xx-fb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/ep93xx-fb.c b/drivers/video/fbdev/ep93xx-fb.c index 94fe52928be25..376ee59e925c2 100644 --- a/drivers/video/fbdev/ep93xx-fb.c +++ b/drivers/video/fbdev/ep93xx-fb.c @@ -312,7 +312,7 @@ static int ep93xxfb_mmap(struct fb_info *info, struct vm_area_struct *vma) unsigned int offset = vma->vm_pgoff << PAGE_SHIFT; if (offset < info->fix.smem_len) { - return dma_mmap_wc(info->dev, vma, info->screen_base, + return dma_mmap_wc(info->device, vma, info->screen_base, info->fix.smem_start, info->fix.smem_len); } @@ -423,7 +423,7 @@ static int ep93xxfb_alloc_videomem(struct fb_info *info) /* Maximum 16bpp -> used memory is maximum x*y*2 bytes */ fb_size = EP93XXFB_MAX_XRES * EP93XXFB_MAX_YRES * 2; - virt_addr = dma_alloc_wc(info->dev, fb_size, &phys_addr, GFP_KERNEL); + virt_addr = dma_alloc_wc(info->device, fb_size, &phys_addr, GFP_KERNEL); if (!virt_addr) return -ENOMEM; @@ -440,7 +440,7 @@ static int ep93xxfb_alloc_videomem(struct fb_info *info) "has bit 27 set: cannot init framebuffer\n", phys_addr); - dma_free_coherent(info->dev, fb_size, virt_addr, phys_addr); + dma_free_coherent(info->device, fb_size, virt_addr, phys_addr); return -ENOMEM; } @@ -454,7 +454,7 @@ static int ep93xxfb_alloc_videomem(struct fb_info *info) static void ep93xxfb_dealloc_videomem(struct fb_info *info) { if (info->screen_base) - dma_free_coherent(info->dev, info->fix.smem_len, + dma_free_coherent(info->device, info->fix.smem_len, info->screen_base, info->fix.smem_start); } From patchwork Mon Jun 12 14:07:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691860 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 74838C88CB9 for ; Mon, 12 Jun 2023 14:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237513AbjFLOOT (ORCPT ); Mon, 12 Jun 2023 10:14:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237359AbjFLOOG (ORCPT ); Mon, 12 Jun 2023 10:14:06 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4505B10E7; Mon, 12 Jun 2023 07:14:01 -0700 (PDT) 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 E507620489; Mon, 12 Jun 2023 14:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579239; 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=n/1XN16d/EUe3Vztuo66YMXwHZvuf+6H3H5dWkYxYdo=; b=ZP/yZZWs+DOWuCywBIiAuaobu2jli9K5UE4idFPLrXAl5T0MeoNnOCkgAyY93JjZwwyyum XXopghqrv8jMpgAbGUlFBbW/Sqfkjn87IKeMjuU8Zx5YHOFjyjFYVoBe3i5JKU5BbuuOoB bscf0mozfKpcVnIt+72gLxcD52ws9/Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579239; 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=n/1XN16d/EUe3Vztuo66YMXwHZvuf+6H3H5dWkYxYdo=; b=sMGGv0y9AAQWFLgwOkfLiT4QtCPeUXfL1RUZGdRBEV0WC3NgWjNsOQAKTHMdtSQZDggzPL iRTXmRjpcTxTHUAA== 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 8D0EB13A67; Mon, 12 Jun 2023 14:13:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qI2AIScoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:13:59 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann , Timur Tabi Subject: [PATCH v2 15/38] fbdev/fsl-diu-fb: Output messages with fb_*() helpers Date: Mon, 12 Jun 2023 16:07:53 +0200 Message-ID: <20230612141352.29939-16-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Fix cases were output helpers are called with struct fb_info.dev. Use fb_*() helpers instead. Prepares fbdev for making struct fb_info.dev optional. Signed-off-by: Thomas Zimmermann Cc: Timur Tabi --- drivers/video/fbdev/fsl-diu-fb.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c index 730a07d23fa92..785eb8a06943f 100644 --- a/drivers/video/fbdev/fsl-diu-fb.c +++ b/drivers/video/fbdev/fsl-diu-fb.c @@ -872,7 +872,7 @@ static int map_video_memory(struct fb_info *info) p = alloc_pages_exact(smem_len, GFP_DMA | __GFP_ZERO); if (!p) { - dev_err(info->dev, "unable to allocate fb memory\n"); + fb_err(info, "unable to allocate fb memory\n"); return -ENOMEM; } mutex_lock(&info->mm_lock); @@ -1145,7 +1145,7 @@ static int fsl_diu_set_par(struct fb_info *info) /* Memory allocation for framebuffer */ if (map_video_memory(info)) { - dev_err(info->dev, "unable to allocate fb memory 1\n"); + fb_err(info, "unable to allocate fb memory 1\n"); return -ENOMEM; } } @@ -1277,16 +1277,16 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, if (!arg) return -EINVAL; - dev_dbg(info->dev, "ioctl %08x (dir=%s%s type=%u nr=%u size=%u)\n", cmd, + fb_dbg(info, "ioctl %08x (dir=%s%s type=%u nr=%u size=%u)\n", cmd, _IOC_DIR(cmd) & _IOC_READ ? "R" : "", _IOC_DIR(cmd) & _IOC_WRITE ? "W" : "", _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd)); switch (cmd) { case MFB_SET_PIXFMT_OLD: - dev_warn(info->dev, - "MFB_SET_PIXFMT value of 0x%08x is deprecated.\n", - MFB_SET_PIXFMT_OLD); + fb_warn(info, + "MFB_SET_PIXFMT value of 0x%08x is deprecated.\n", + MFB_SET_PIXFMT_OLD); fallthrough; case MFB_SET_PIXFMT: if (copy_from_user(&pix_fmt, buf, sizeof(pix_fmt))) @@ -1294,9 +1294,9 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, ad->pix_fmt = pix_fmt; break; case MFB_GET_PIXFMT_OLD: - dev_warn(info->dev, - "MFB_GET_PIXFMT value of 0x%08x is deprecated.\n", - MFB_GET_PIXFMT_OLD); + fb_warn(info, + "MFB_GET_PIXFMT value of 0x%08x is deprecated.\n", + MFB_GET_PIXFMT_OLD); fallthrough; case MFB_GET_PIXFMT: pix_fmt = ad->pix_fmt; @@ -1375,7 +1375,7 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, } #endif default: - dev_err(info->dev, "unknown ioctl command (0x%08X)\n", cmd); + fb_err(info, "unknown ioctl command (0x%08X)\n", cmd); return -ENOIOCTLCMD; } @@ -1543,21 +1543,21 @@ static int install_fb(struct fb_info *info) } if (fsl_diu_check_var(&info->var, info)) { - dev_err(info->dev, "fsl_diu_check_var failed\n"); + fb_err(info, "fsl_diu_check_var failed\n"); unmap_video_memory(info); fb_dealloc_cmap(&info->cmap); return -EINVAL; } if (register_framebuffer(info) < 0) { - dev_err(info->dev, "register_framebuffer failed\n"); + fb_err(info, "register_framebuffer failed\n"); unmap_video_memory(info); fb_dealloc_cmap(&info->cmap); return -EINVAL; } mfbi->registered = 1; - dev_info(info->dev, "%s registered successfully\n", mfbi->id); + fb_info(info, "%s registered successfully\n", mfbi->id); return 0; } From patchwork Mon Jun 12 14:07:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691859 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 9CCC0CA9EAD for ; Mon, 12 Jun 2023 14:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237532AbjFLOOV (ORCPT ); Mon, 12 Jun 2023 10:14:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237364AbjFLOOI (ORCPT ); Mon, 12 Jun 2023 10:14:08 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BD6210E9; Mon, 12 Jun 2023 07:14:01 -0700 (PDT) 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 459BC2048A; Mon, 12 Jun 2023 14:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579240; 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=KHaIM1mXVDYd6HDF2qJug1/atoNFlj4bYCqrjFZko5Y=; b=Hfg9XyMWEfJlY7hQ0XQ/MkPgs/keqC+BODstU1pFrBJ20k3oCU2vXIiqhaONvM99eOxkN9 ZTQrDR8dR1nA062/VTXlI1bqE6aExK3nh76QNDGxlBXyuRNKt6mhsQYRjCcz3SquMYySji mAWUnW6DgtT3YnEpA0DiLZfyuhRR3hI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579240; 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=KHaIM1mXVDYd6HDF2qJug1/atoNFlj4bYCqrjFZko5Y=; b=2gstM1tXyQwjgJkTl8TkAoq1ZTddQJBL/3EAyI1iDJduEm0+2MSFbRe4hZUTNVigjw3ixi sVl93A3u8ve2X3Dw== 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 E85621357F; Mon, 12 Jun 2023 14:13:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eEPaNycoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:13:59 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 16/38] fbdev/mb862xxfb: Output messages with fb_dbg() Date: Mon, 12 Jun 2023 16:07:54 +0200 Message-ID: <20230612141352.29939-17-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Fix cases were output helpers are called with struct fb_info.dev. Use fb_dbg() instead. Prepares fbdev for making struct fb_info.dev optional. v2: * fix another reference to struct fb_info.dev (kernel test reobot) * remove fb_err() from commit message Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c index b5c8fcab9940d..119c2a582ecbd 100644 --- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c +++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c @@ -112,8 +112,7 @@ static int mb862xxfb_check_var(struct fb_var_screeninfo *var, { unsigned long tmp; - if (fbi->dev) - dev_dbg(fbi->dev, "%s\n", __func__); + fb_dbg(fbi, "%s\n", __func__); /* check if these values fit into the registers */ if (var->hsync_len > 255 || var->vsync_len > 255) @@ -290,7 +289,7 @@ static int mb862xxfb_blank(int mode, struct fb_info *fbi) struct mb862xxfb_par *par = fbi->par; unsigned long reg; - dev_dbg(fbi->dev, "blank mode=%d\n", mode); + fb_dbg(fbi, "blank mode=%d\n", mode); switch (mode) { case FB_BLANK_POWERDOWN: @@ -791,7 +790,7 @@ static void of_platform_mb862xx_remove(struct platform_device *ofdev) resource_size_t res_size = resource_size(par->res); unsigned long reg; - dev_dbg(fbi->dev, "%s release\n", fbi->fix.id); + fb_dbg(fbi, "%s release\n", fbi->fix.id); /* display off */ reg = inreg(disp, GC_DCM1); @@ -1138,7 +1137,7 @@ static void mb862xx_pci_remove(struct pci_dev *pdev) struct mb862xxfb_par *par = fbi->par; unsigned long reg; - dev_dbg(fbi->dev, "%s release\n", fbi->fix.id); + fb_dbg(fbi, "%s release\n", fbi->fix.id); /* display off */ reg = inreg(disp, GC_DCM1); From patchwork Mon Jun 12 14:07:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691858 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 9244FC88CBC for ; Mon, 12 Jun 2023 14:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237548AbjFLOOW (ORCPT ); Mon, 12 Jun 2023 10:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237377AbjFLOOI (ORCPT ); Mon, 12 Jun 2023 10:14:08 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A90010FC; Mon, 12 Jun 2023 07:14:02 -0700 (PDT) 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 0419C2048C; Mon, 12 Jun 2023 14:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579241; 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=4C46o8uYDdrEdTWuVBPChdiMr7SKVkGgLXmMwmSf+iU=; b=kzIVjaEqce3dAEaknrxPIJZ6lS6+Ya8hqQX3c1byB+YH0jLXNK64oQP4mxcjAaEe17tzMF /54DMlCe520D+fEa1qAjq5ZpYDiXizZMP+q9iTR+wrGBb3fxCyQoMkA6aV8KUqfVjN5sm3 yQTK0xPgy5xeK2MxrsmKWGfCVRJDUjg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579241; 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=4C46o8uYDdrEdTWuVBPChdiMr7SKVkGgLXmMwmSf+iU=; b=YbBVmDjgAzUdv7zuZTl3RcbhtJJDzUBE5FFcKWqKWE9Pvajj1QDa6s5B7Fj0S6k4nIsyW9 BrCZqArWSVN0mNCQ== 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 A20D21357F; Mon, 12 Jun 2023 14:14:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GIuQJigoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:00 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann , Antonino Daplas Subject: [PATCH v2 18/38] fbdev/nvidiafb: Reorder backlight and framebuffer init/cleanup Date: Mon, 12 Jun 2023 16:07:56 +0200 Message-ID: <20230612141352.29939-19-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The driver's backlight code requires the framebuffer to be registered. Therefore reorder the init and cleanup calls for both data structures. Signed-off-by: Thomas Zimmermann Cc: Antonino Daplas Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/nvidia/nvidia.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c index ea4ba3dfb96bb..039e886346fa6 100644 --- a/drivers/video/fbdev/nvidia/nvidia.c +++ b/drivers/video/fbdev/nvidia/nvidia.c @@ -1400,14 +1400,14 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent) pci_set_drvdata(pd, info); - if (backlight) - nvidia_bl_init(par); - if (register_framebuffer(info) < 0) { printk(KERN_ERR PFX "error registering nVidia framebuffer\n"); goto err_out_iounmap_fb; } + if (backlight) + nvidia_bl_init(par); + printk(KERN_INFO PFX "PCI nVidia %s framebuffer (%dMB @ 0x%lX)\n", info->fix.id, @@ -1439,9 +1439,9 @@ static void nvidiafb_remove(struct pci_dev *pd) NVTRACE_ENTER(); + nvidia_bl_exit(par); unregister_framebuffer(info); - nvidia_bl_exit(par); arch_phys_wc_del(par->wc_cookie); iounmap(info->screen_base); fb_destroy_modedb(info->monspecs.modedb); From patchwork Mon Jun 12 14:07:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691857 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 1DE61C88CB8 for ; Mon, 12 Jun 2023 14:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237363AbjFLOO2 (ORCPT ); Mon, 12 Jun 2023 10:14:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237374AbjFLOOI (ORCPT ); Mon, 12 Jun 2023 10:14:08 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAF2910FA; Mon, 12 Jun 2023 07:14:02 -0700 (PDT) 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 6029C22847; Mon, 12 Jun 2023 14:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579241; 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=3bdWYG/63W1BkUsuYHUlm9wE73VCJDKGMcdHIDnt6jY=; b=KZ3kLok9pPyWvpvCFoga7KFYTUq5ufKgeCU6xNPfcJr0CTGOAblmD/p8cLxTMuMOhqgpgR D3mNA8pkz/SYWGpG1dTp18FJeHz18SheYW/fR/3mLXsUdddKRyELjvPfexEnSsh7sDhU/e fPjK6dmlSTu5gMkvRLVFIMSAPlLR5W4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579241; 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=3bdWYG/63W1BkUsuYHUlm9wE73VCJDKGMcdHIDnt6jY=; b=yKEF/6tHn7/Q/JYD/0d3Uqvq4KoB0A0rwyC4GWCcBy/06ClCNz8jAp/q9hTJbXVKtepz1z r4EiGBmruAIE/XAg== 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 0992C1357F; Mon, 12 Jun 2023 14:14:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8JFtASkoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:01 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann , Antonino Daplas Subject: [PATCH v2 19/38] fbdev/nvidiafb: Use hardware device as backlight parent Date: Mon, 12 Jun 2023 16:07:57 +0200 Message-ID: <20230612141352.29939-20-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use the hardware device in struct fb_info.device as parent of the backlight device. Aligns the driver with the rest of the codebase and prepares fbdev for making struct fb_info.dev optional. Signed-off-by: Thomas Zimmermann Cc: Antonino Daplas Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/nvidia/nv_backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/nvidia/nv_backlight.c b/drivers/video/fbdev/nvidia/nv_backlight.c index 503a7a683855a..160da9c50a52c 100644 --- a/drivers/video/fbdev/nvidia/nv_backlight.c +++ b/drivers/video/fbdev/nvidia/nv_backlight.c @@ -98,7 +98,7 @@ void nvidia_bl_init(struct nvidia_par *par) memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = FB_BACKLIGHT_LEVELS - 1; - bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops, + bd = backlight_device_register(name, info->device, par, &nvidia_bl_ops, &props); if (IS_ERR(bd)) { info->bl_dev = NULL; From patchwork Mon Jun 12 14:08: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: 691856 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 5A943CA9EAD for ; Mon, 12 Jun 2023 14:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237366AbjFLOO3 (ORCPT ); Mon, 12 Jun 2023 10:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237397AbjFLOOJ (ORCPT ); Mon, 12 Jun 2023 10:14:09 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDED51708; Mon, 12 Jun 2023 07:14:03 -0700 (PDT) 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 7362F22856; Mon, 12 Jun 2023 14:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579242; 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=UsebDHSV0686iKDtOa3+K4KQd5u0zTEsehYLUTkowCU=; b=md6CS79uOCzoNRJQpJIztowdXlegBRjZ/G6jneCH5LaLc+N5P959eOCA/pCytA0Bgmn8Wa JtXIUDkVeNKlOK2Ej1UYzGnpHyAYuZEoVvbF4D/JtiflnNXW+EZ3s70du9HvVgzIq8sL04 R4ClSMxY01kuR35k0ZYQeibGmlGNxBs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579242; 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=UsebDHSV0686iKDtOa3+K4KQd5u0zTEsehYLUTkowCU=; b=Ml52e9jhZGXtTAT6aarzm32UJgIGjTspVtKTQ049aew4ibgamu8ZNEcxwXzy8k4nT9NYLg lI2vtJQzCuX+gICw== 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 20E1A1357F; Mon, 12 Jun 2023 14:14:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KCwTByooh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:02 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann , Benjamin Herrenschmidt Subject: [PATCH v2 22/38] fbdev/radeonfb: Use hardware device as backlight parent Date: Mon, 12 Jun 2023 16:08:00 +0200 Message-ID: <20230612141352.29939-23-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use the hardware device in struct fb_info.device as parent of the backlight device. Aligns the driver with the rest of the codebase and prepares fbdev for making struct fb_info.dev optional. v2: * add Cc: tag (Dan) Signed-off-by: Thomas Zimmermann Cc: Benjamin Herrenschmidt Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/aty/radeon_backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/aty/radeon_backlight.c b/drivers/video/fbdev/aty/radeon_backlight.c index 427adc838f77e..23a38c3f3977e 100644 --- a/drivers/video/fbdev/aty/radeon_backlight.c +++ b/drivers/video/fbdev/aty/radeon_backlight.c @@ -147,7 +147,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = FB_BACKLIGHT_LEVELS - 1; - bd = backlight_device_register(name, rinfo->info->dev, pdata, + bd = backlight_device_register(name, rinfo->info->device, pdata, &radeon_bl_data, &props); if (IS_ERR(bd)) { rinfo->info->bl_dev = NULL; From patchwork Mon Jun 12 14:08: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: 691855 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 CDB71C88CB4 for ; Mon, 12 Jun 2023 14:14:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237657AbjFLOOg (ORCPT ); Mon, 12 Jun 2023 10:14:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237427AbjFLOOM (ORCPT ); Mon, 12 Jun 2023 10:14:12 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F35EA1718; Mon, 12 Jun 2023 07:14:04 -0700 (PDT) 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 7F7652048D; Mon, 12 Jun 2023 14:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579243; 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=DApq01bMcWPqgYhwuryEu5qdYBZjYFccLYihwSFiAXk=; b=Zora8HfwuVeNq+hm5G6DUqPUKgOtH8m30gUW2OZP6oVeOC0SvWGqgTfYBjKPMAc4pI9aQI 6Ew5qXJjBTM44urrB1/6yhlbyymEG/osTY/bs4iFSYk4d5bxC6F57x56AInpWgVPVsVN+X 4ceLrGintZ/Mib46vhkSzUt+OkIljto= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579243; 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=DApq01bMcWPqgYhwuryEu5qdYBZjYFccLYihwSFiAXk=; b=H/zAlbOtFqKuNb3tKoyQFw3FYtGoeSWfqKSzX2hZ0Cmx54Oz0an5bSEQ+PUQanuJpxb/Pf WQfNEU/GNlTsfLCg== 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 30A641357F; Mon, 12 Jun 2023 14:14:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CFDoCisoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:03 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 25/38] fbdev/sh7760fb: Use fb_dbg() in sh7760fb_get_color_info() Date: Mon, 12 Jun 2023 16:08:03 +0200 Message-ID: <20230612141352.29939-26-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Give struct fb_info to sh7760fb_get_color_info() and use it in call to fb_dbg(). Prepares fbdev for making struct fb_info.dev optional. Signed-off-by: Thomas Zimmermann --- drivers/video/fbdev/sh7760fb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/sh7760fb.c b/drivers/video/fbdev/sh7760fb.c index 4c092c7935027..a2946f06d579e 100644 --- a/drivers/video/fbdev/sh7760fb.c +++ b/drivers/video/fbdev/sh7760fb.c @@ -118,7 +118,7 @@ static int sh7760_setcolreg (u_int regno, return 0; } -static int sh7760fb_get_color_info(struct device *dev, +static int sh7760fb_get_color_info(struct fb_info *info, u16 lddfr, int *bpp, int *gray) { int lbpp, lgray; @@ -150,7 +150,7 @@ static int sh7760fb_get_color_info(struct device *dev, lgray = 0; break; default: - dev_dbg(dev, "unsupported LDDFR bit depth.\n"); + fb_dbg(info, "unsupported LDDFR bit depth.\n"); return -EINVAL; } @@ -170,7 +170,7 @@ static int sh7760fb_check_var(struct fb_var_screeninfo *var, int ret, bpp; /* get color info from register value */ - ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, NULL); + ret = sh7760fb_get_color_info(info, par->pd->lddfr, &bpp, NULL); if (ret) return ret; @@ -222,7 +222,7 @@ static int sh7760fb_set_par(struct fb_info *info) vdln = vm->yres; /* get color info from register value */ - ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, &gray); + ret = sh7760fb_get_color_info(info, par->pd->lddfr, &bpp, &gray); if (ret) return ret; @@ -381,7 +381,7 @@ static int sh7760fb_alloc_mem(struct fb_info *info) return 0; /* get color info from register value */ - ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, NULL); + ret = sh7760fb_get_color_info(info, par->pd->lddfr, &bpp, NULL); if (ret) { printk(KERN_ERR "colinfo\n"); return ret; From patchwork Mon Jun 12 14:08: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: 691854 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 5EB7AC88CB7 for ; Mon, 12 Jun 2023 14:14:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237684AbjFLOOm (ORCPT ); Mon, 12 Jun 2023 10:14:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237434AbjFLOOM (ORCPT ); Mon, 12 Jun 2023 10:14:12 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36951171A; Mon, 12 Jun 2023 07:14:05 -0700 (PDT) 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 D637B2048F; Mon, 12 Jun 2023 14:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579243; 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=TBL4s6EwpQYL8Rm44U2/nmPhozWpkgd0TW9bgt9l7x8=; b=Y71RD0deUbbtqkmKSGPXZNgWh/suxy+0C9JXsCGTXogn4e86Urc78JtJidWBIhbG7LEjWJ pJyfw5AHUq+fveryh9UNyQrzBREDPWr6hxJeyiwGFmTDzEacZSoZwvtN5fpsIc/taBK7Wa dfs3azAcm3QZ58QrmBoH1Ec8Y4OyI+c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579243; 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=TBL4s6EwpQYL8Rm44U2/nmPhozWpkgd0TW9bgt9l7x8=; b=+6M2cZgJ3ORpyFcJC1yeS8svhlpH59J00iB969mWx20wgVEUpwa5onTMHLvm+2flw3RPyF PvDDDQXF0OyqWfDA== 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 852651357F; Mon, 12 Jun 2023 14:14:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uMCKHysoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:03 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 26/38] fbdev/sh7760fb: Output messages with fb_dbg() Date: Mon, 12 Jun 2023 16:08:04 +0200 Message-ID: <20230612141352.29939-27-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Fix cases were output helpers are called with struct fb_info.dev. Use fb_dbg() instead. Prepares fbdev for making struct fb_info.dev optional. Signed-off-by: Thomas Zimmermann --- drivers/video/fbdev/sh7760fb.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/video/fbdev/sh7760fb.c b/drivers/video/fbdev/sh7760fb.c index a2946f06d579e..65e2c71cf5b51 100644 --- a/drivers/video/fbdev/sh7760fb.c +++ b/drivers/video/fbdev/sh7760fb.c @@ -207,7 +207,7 @@ static int sh7760fb_set_par(struct fb_info *info) /* rotate only works with xres <= 320 */ if (par->rot && (vm->xres > 320)) { - dev_dbg(info->dev, "rotation disabled due to display size\n"); + fb_dbg(info, "rotation disabled due to display size\n"); par->rot = 0; } @@ -226,7 +226,7 @@ static int sh7760fb_set_par(struct fb_info *info) if (ret) return ret; - dev_dbg(info->dev, "%dx%d %dbpp %s (orientation %s)\n", hdcn, + fb_dbg(info, "%dx%d %dbpp %s (orientation %s)\n", hdcn, vdln, bpp, gray ? "grayscale" : "color", par->rot ? "rotated" : "normal"); @@ -306,7 +306,7 @@ static int sh7760fb_set_par(struct fb_info *info) if (((ldmtr & 0x003f) >= LDMTR_DSTN_MONO_8) && ((ldmtr & 0x003f) <= LDMTR_DSTN_COLOR_16)) { - dev_dbg(info->dev, " ***** DSTN untested! *****\n"); + fb_dbg(info, " ***** DSTN untested! *****\n"); dstn_off = stride; if (par->rot) @@ -326,17 +326,17 @@ static int sh7760fb_set_par(struct fb_info *info) sh7760fb_blank(FB_BLANK_UNBLANK, info); /* panel on! */ - dev_dbg(info->dev, "hdcn : %6d htcn : %6d\n", hdcn, htcn); - dev_dbg(info->dev, "hsynw : %6d hsynp : %6d\n", hsynw, hsynp); - dev_dbg(info->dev, "vdln : %6d vtln : %6d\n", vdln, vtln); - dev_dbg(info->dev, "vsynw : %6d vsynp : %6d\n", vsynw, vsynp); - dev_dbg(info->dev, "clksrc: %6d clkdiv: %6d\n", + fb_dbg(info, "hdcn : %6d htcn : %6d\n", hdcn, htcn); + fb_dbg(info, "hsynw : %6d hsynp : %6d\n", hsynw, hsynp); + fb_dbg(info, "vdln : %6d vtln : %6d\n", vdln, vtln); + fb_dbg(info, "vsynw : %6d vsynp : %6d\n", vsynw, vsynp); + fb_dbg(info, "clksrc: %6d clkdiv: %6d\n", (par->pd->ldickr >> 12) & 3, par->pd->ldickr & 0x1f); - dev_dbg(info->dev, "ldpmmr: 0x%04x ldpspr: 0x%04x\n", par->pd->ldpmmr, + fb_dbg(info, "ldpmmr: 0x%04x ldpspr: 0x%04x\n", par->pd->ldpmmr, par->pd->ldpspr); - dev_dbg(info->dev, "ldmtr : 0x%04x lddfr : 0x%04x\n", ldmtr, lddfr); - dev_dbg(info->dev, "ldlaor: %ld\n", stride); - dev_dbg(info->dev, "ldsaru: 0x%08lx ldsarl: 0x%08lx\n", sbase, ldsarl); + fb_dbg(info, "ldmtr : 0x%04x lddfr : 0x%04x\n", ldmtr, lddfr); + fb_dbg(info, "ldlaor: %ld\n", stride); + fb_dbg(info, "ldsaru: 0x%08lx ldsarl: 0x%08lx\n", sbase, ldsarl); return 0; } @@ -401,7 +401,7 @@ static int sh7760fb_alloc_mem(struct fb_info *info) } else if (bpp > 8) vram *= 2; if ((vram < 1) || (vram > 1024 * 2048)) { - dev_dbg(info->dev, "too much VRAM required. Check settings\n"); + fb_dbg(info, "too much VRAM required. Check settings\n"); return -ENODEV; } From patchwork Mon Jun 12 14:08: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: 691852 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 EF7E4C88CB7 for ; Mon, 12 Jun 2023 14:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237613AbjFLOPA (ORCPT ); Mon, 12 Jun 2023 10:15:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237444AbjFLOOM (ORCPT ); Mon, 12 Jun 2023 10:14:12 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91C16171B; Mon, 12 Jun 2023 07:14:05 -0700 (PDT) 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 3B9372283A; Mon, 12 Jun 2023 14:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579244; 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=XZq7uuC2nsDif+K+IT1h1suAjzRhQ7TghVnMjkbiuGw=; b=AHI08y1f8JihP03XKNpKbl1vaizBTPI5K43MMdO/TdETU8xB6NxuRhwJTpDwq0L68pX2nh VC76+3s0mLv4yCZnoLFlhiNqXj7b8B33LLwRQh2b4ANcs/laSMCnUm6Xt3MA2TEDLXkuxC uTksYprnh+U652UGBOwucn/rRHqF3pg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579244; 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=XZq7uuC2nsDif+K+IT1h1suAjzRhQ7TghVnMjkbiuGw=; b=hG44xHjYPp/Vn1tfM9aUynY4027Y/5BJBkSD+r6gUlRSZsPJ51SnGX59RBzWorB5BxzLmL vDv0H2vYYTYZhRCQ== 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 DBEFF1357F; Mon, 12 Jun 2023 14:14:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yJ6qNCsoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:03 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 27/38] fbdev/sh7760fb: Alloc DMA memory from hardware device Date: Mon, 12 Jun 2023 16:08:05 +0200 Message-ID: <20230612141352.29939-28-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Pass the hardware device to the DMA helpers dma_alloc_coherent() and dma_free_coherent(). The fbdev device that is currently being used is a software device and does not provide DMA memory. Also update the related dev_*() output statements similarly. Signed-off-by: Thomas Zimmermann --- drivers/video/fbdev/sh7760fb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/sh7760fb.c b/drivers/video/fbdev/sh7760fb.c index 65e2c71cf5b51..74543a1e30314 100644 --- a/drivers/video/fbdev/sh7760fb.c +++ b/drivers/video/fbdev/sh7760fb.c @@ -359,7 +359,7 @@ static void sh7760fb_free_mem(struct fb_info *info) if (!info->screen_base) return; - dma_free_coherent(info->dev, info->screen_size, + dma_free_coherent(info->device, info->screen_size, info->screen_base, par->fbdma); par->fbdma = 0; @@ -408,14 +408,14 @@ static int sh7760fb_alloc_mem(struct fb_info *info) if (vram < PAGE_SIZE) vram = PAGE_SIZE; - fbmem = dma_alloc_coherent(info->dev, vram, &par->fbdma, GFP_KERNEL); + fbmem = dma_alloc_coherent(info->device, vram, &par->fbdma, GFP_KERNEL); if (!fbmem) return -ENOMEM; if ((par->fbdma & SH7760FB_DMA_MASK) != SH7760FB_DMA_MASK) { sh7760fb_free_mem(info); - dev_err(info->dev, "kernel gave me memory at 0x%08lx, which is" + dev_err(info->device, "kernel gave me memory at 0x%08lx, which is" "unusable for the LCDC\n", (unsigned long)par->fbdma); return -ENOMEM; } @@ -486,7 +486,7 @@ static int sh7760fb_probe(struct platform_device *pdev) ret = sh7760fb_alloc_mem(info); if (ret) { - dev_dbg(info->dev, "framebuffer memory allocation failed!\n"); + dev_dbg(info->device, "framebuffer memory allocation failed!\n"); goto out_unmap; } From patchwork Mon Jun 12 14:08:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691851 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 4FD12CA9EA3 for ; Mon, 12 Jun 2023 14:15:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238066AbjFLOPC (ORCPT ); Mon, 12 Jun 2023 10:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237410AbjFLOOc (ORCPT ); Mon, 12 Jun 2023 10:14:32 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C56B1173F; Mon, 12 Jun 2023 07:14:07 -0700 (PDT) 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 822872273A; Mon, 12 Jun 2023 14:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579246; 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=4fsDwK3/MzhO/+4V6RVPaJy4VYKnZ6Si9bcp6FJanXE=; b=sDvYrg4iyDbhOjotPD+QhWNlzon1voO8gd7EwAYGjZxIeKu9rJ3wFjnXUzkRM4+W39OX9S kYLr7T/rr/8WwABgiUpCCkuyfD1gCqFPVyqehITqo54K7MMNCzIgQjQLh+Ftn/ynUb25fL XqTbj66tcWrXrhpVnf8iIN7ZIPv2/hw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579246; 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=4fsDwK3/MzhO/+4V6RVPaJy4VYKnZ6Si9bcp6FJanXE=; b=OW4OfnIAJSd2oORHF0mhf5Gj44hTAaC9fiQJKCsfe1nN99etnHCkyBYWnHZT/BDpPOnL5/ gizTf2JQDsFesvBA== 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 2EABD1357F; Mon, 12 Jun 2023 14:14:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WBPvCS4oh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:06 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 33/38] fbdev/core: Move framebuffer and backlight helpers into separate files Date: Mon, 12 Jun 2023 16:08:11 +0200 Message-ID: <20230612141352.29939-34-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Move framebuffer and backlight helpers into separate files. Leave fbsysfs.c to sysfs-related code. No functional changes. The framebuffer helpers are not in fbmem.c because they are under GPL-2.0-or-later copyright, while fbmem.c is GPL-2.0. v2: * include (Sam) Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg --- drivers/video/fbdev/core/Makefile | 4 +- drivers/video/fbdev/core/fb_backlight.c | 33 +++++++ drivers/video/fbdev/core/fb_info.c | 78 +++++++++++++++++ drivers/video/fbdev/core/fbsysfs.c | 110 +----------------------- 4 files changed, 115 insertions(+), 110 deletions(-) create mode 100644 drivers/video/fbdev/core/fb_backlight.c create mode 100644 drivers/video/fbdev/core/fb_info.c diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index 8f0060160ffb7..eee3295bc2252 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -1,7 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_FB_NOTIFY) += fb_notify.o obj-$(CONFIG_FB) += fb.o -fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ +fb-y := fb_backlight.o \ + fb_info.o \ + fbmem.o fbmon.o fbcmap.o fbsysfs.o \ modedb.o fbcvt.o fb_cmdline.o fb_io_fops.o fb-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o diff --git a/drivers/video/fbdev/core/fb_backlight.c b/drivers/video/fbdev/core/fb_backlight.c new file mode 100644 index 0000000000000..e2d3b3adc870f --- /dev/null +++ b/drivers/video/fbdev/core/fb_backlight.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include + +#if IS_ENABLED(CONFIG_FB_BACKLIGHT) +/* + * This function generates a linear backlight curve + * + * 0: off + * 1-7: min + * 8-127: linear from min to max + */ +void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max) +{ + unsigned int i, flat, count, range = (max - min); + + mutex_lock(&fb_info->bl_curve_mutex); + + fb_info->bl_curve[0] = off; + + for (flat = 1; flat < (FB_BACKLIGHT_LEVELS / 16); ++flat) + fb_info->bl_curve[flat] = min; + + count = FB_BACKLIGHT_LEVELS * 15 / 16; + for (i = 0; i < count; ++i) + fb_info->bl_curve[flat + i] = min + (range * (i + 1) / count); + + mutex_unlock(&fb_info->bl_curve_mutex); +} +EXPORT_SYMBOL_GPL(fb_bl_default_curve); +#endif diff --git a/drivers/video/fbdev/core/fb_info.c b/drivers/video/fbdev/core/fb_info.c new file mode 100644 index 0000000000000..8bdbefdd4b701 --- /dev/null +++ b/drivers/video/fbdev/core/fb_info.c @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include + +/** + * framebuffer_alloc - creates a new frame buffer info structure + * + * @size: size of driver private data, can be zero + * @dev: pointer to the device for this fb, this can be NULL + * + * Creates a new frame buffer info structure. Also reserves @size bytes + * for driver private data (info->par). info->par (if any) will be + * aligned to sizeof(long). + * + * Returns the new structure, or NULL if an error occurred. + * + */ +struct fb_info *framebuffer_alloc(size_t size, struct device *dev) +{ +#define BYTES_PER_LONG (BITS_PER_LONG/8) +#define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG)) + int fb_info_size = sizeof(struct fb_info); + struct fb_info *info; + char *p; + + if (size) + fb_info_size += PADDING; + + p = kzalloc(fb_info_size + size, GFP_KERNEL); + + if (!p) + return NULL; + + info = (struct fb_info *) p; + + if (size) + info->par = p + fb_info_size; + + info->device = dev; + info->fbcon_rotate_hint = -1; + +#if IS_ENABLED(CONFIG_FB_BACKLIGHT) + mutex_init(&info->bl_curve_mutex); +#endif + + return info; +#undef PADDING +#undef BYTES_PER_LONG +} +EXPORT_SYMBOL(framebuffer_alloc); + +/** + * framebuffer_release - marks the structure available for freeing + * + * @info: frame buffer info structure + * + * Drop the reference count of the device embedded in the + * framebuffer info structure. + * + */ +void framebuffer_release(struct fb_info *info) +{ + if (!info) + return; + + if (WARN_ON(refcount_read(&info->count))) + return; + +#if IS_ENABLED(CONFIG_FB_BACKLIGHT) + mutex_destroy(&info->bl_curve_mutex); +#endif + + kfree(info); +} +EXPORT_SYMBOL(framebuffer_release); diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 0c33c4adcd798..849073f1ca067 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -5,93 +5,12 @@ * Copyright (c) 2004 James Simmons */ -/* - * Note: currently there's only stubs for framebuffer_alloc and - * framebuffer_release here. The reson for that is that until all drivers - * are converted to use it a sysfsification will open OOPSable races. - */ - -#include -#include +#include #include #include -#include -#include #define FB_SYSFS_FLAG_ATTR 1 -/** - * framebuffer_alloc - creates a new frame buffer info structure - * - * @size: size of driver private data, can be zero - * @dev: pointer to the device for this fb, this can be NULL - * - * Creates a new frame buffer info structure. Also reserves @size bytes - * for driver private data (info->par). info->par (if any) will be - * aligned to sizeof(long). - * - * Returns the new structure, or NULL if an error occurred. - * - */ -struct fb_info *framebuffer_alloc(size_t size, struct device *dev) -{ -#define BYTES_PER_LONG (BITS_PER_LONG/8) -#define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG)) - int fb_info_size = sizeof(struct fb_info); - struct fb_info *info; - char *p; - - if (size) - fb_info_size += PADDING; - - p = kzalloc(fb_info_size + size, GFP_KERNEL); - - if (!p) - return NULL; - - info = (struct fb_info *) p; - - if (size) - info->par = p + fb_info_size; - - info->device = dev; - info->fbcon_rotate_hint = -1; - -#if IS_ENABLED(CONFIG_FB_BACKLIGHT) - mutex_init(&info->bl_curve_mutex); -#endif - - return info; -#undef PADDING -#undef BYTES_PER_LONG -} -EXPORT_SYMBOL(framebuffer_alloc); - -/** - * framebuffer_release - marks the structure available for freeing - * - * @info: frame buffer info structure - * - * Drop the reference count of the device embedded in the - * framebuffer info structure. - * - */ -void framebuffer_release(struct fb_info *info) -{ - if (!info) - return; - - if (WARN_ON(refcount_read(&info->count))) - return; - -#if IS_ENABLED(CONFIG_FB_BACKLIGHT) - mutex_destroy(&info->bl_curve_mutex); -#endif - - kfree(info); -} -EXPORT_SYMBOL(framebuffer_release); - static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) { int err; @@ -551,30 +470,3 @@ void fb_cleanup_device(struct fb_info *fb_info) fb_info->class_flag &= ~FB_SYSFS_FLAG_ATTR; } } - -#if IS_ENABLED(CONFIG_FB_BACKLIGHT) -/* This function generates a linear backlight curve - * - * 0: off - * 1-7: min - * 8-127: linear from min to max - */ -void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max) -{ - unsigned int i, flat, count, range = (max - min); - - mutex_lock(&fb_info->bl_curve_mutex); - - fb_info->bl_curve[0] = off; - - for (flat = 1; flat < (FB_BACKLIGHT_LEVELS / 16); ++flat) - fb_info->bl_curve[flat] = min; - - count = FB_BACKLIGHT_LEVELS * 15 / 16; - for (i = 0; i < count; ++i) - fb_info->bl_curve[flat + i] = min + (range * (i + 1) / count); - - mutex_unlock(&fb_info->bl_curve_mutex); -} -EXPORT_SYMBOL_GPL(fb_bl_default_curve); -#endif From patchwork Mon Jun 12 14:08:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691848 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 20740C88CBA for ; Mon, 12 Jun 2023 14:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238272AbjFLOS5 (ORCPT ); Mon, 12 Jun 2023 10:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237607AbjFLOOe (ORCPT ); Mon, 12 Jun 2023 10:14:34 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 904531982; Mon, 12 Jun 2023 07:14:08 -0700 (PDT) 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 4CF6620497; Mon, 12 Jun 2023 14:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579247; 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=PjQ0WZPdIw3WWFfN2RUGJfJXUodE1BMieiwQSz+bnM8=; b=ZhGpsGoWoLoCpa4r4d8gggQNXVhJDl8Re5aT378rH/VK4zWs1t5CW+A2r/YhYocOjK++Nd WbFNyL39hQcoG5PXQBL8VZFjeJKG3x4Xlvr+xzfH+VUYA0jhWPcMSuKM6CyWfjivCdAnVR 1m2FTnPlQ6SrhIzllMmLmIrAbEX0oqU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579247; 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=PjQ0WZPdIw3WWFfN2RUGJfJXUodE1BMieiwQSz+bnM8=; b=HVmDNQrInPhLa32Htc4a1d+dAmFldOzp7rhJSpYICAdfkm+6NDb5/R6b36HVkXRWnz7L2s Dq80YBAIEgKT8ECQ== 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 EEA521357F; Mon, 12 Jun 2023 14:14:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kJJYOS4oh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:06 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 35/38] fbdev/core: Move procfs code to separate file Date: Mon, 12 Jun 2023 16:08:13 +0200 Message-ID: <20230612141352.29939-36-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Move fbdev's procfs code into a separate file and contain it in init and cleanup helpers. For the cleanup, replace remove_proc_entry() with proc_remove(). It is equivalent in functionality, but looks more like an inverse of proc_create_seq(). v2: * document proc_remove() usage (Sam) * revert unrelated removal of for_each_registered_fb() Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg --- drivers/video/fbdev/core/Makefile | 1 + drivers/video/fbdev/core/fb_internal.h | 12 ++++- drivers/video/fbdev/core/fb_procfs.c | 62 ++++++++++++++++++++++++++ drivers/video/fbdev/core/fbmem.c | 48 +++----------------- 4 files changed, 80 insertions(+), 43 deletions(-) create mode 100644 drivers/video/fbdev/core/fb_procfs.c diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index eee3295bc2252..665320160f70a 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -3,6 +3,7 @@ obj-$(CONFIG_FB_NOTIFY) += fb_notify.o obj-$(CONFIG_FB) += fb.o fb-y := fb_backlight.o \ fb_info.o \ + fb_procfs.o \ fbmem.o fbmon.o fbcmap.o fbsysfs.o \ modedb.o fbcvt.o fb_cmdline.o fb_io_fops.o fb-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o diff --git a/drivers/video/fbdev/core/fb_internal.h b/drivers/video/fbdev/core/fb_internal.h index 0b9640ae7a3d2..51f7c9f04e45a 100644 --- a/drivers/video/fbdev/core/fb_internal.h +++ b/drivers/video/fbdev/core/fb_internal.h @@ -3,7 +3,17 @@ #ifndef _FB_INTERNAL_H #define _FB_INTERNAL_H -struct fb_info; +#include +#include + +/* fbmem.c */ +extern struct mutex registration_lock; +extern struct fb_info *registered_fb[FB_MAX]; +extern int num_registered_fb; + +/* fb_procfs.c */ +int fb_init_procfs(void); +void fb_cleanup_procfs(void); /* fbsysfs.c */ int fb_device_create(struct fb_info *fb_info); diff --git a/drivers/video/fbdev/core/fb_procfs.c b/drivers/video/fbdev/core/fb_procfs.c new file mode 100644 index 0000000000000..59641142f8aad --- /dev/null +++ b/drivers/video/fbdev/core/fb_procfs.c @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include + +#include "fb_internal.h" + +static struct proc_dir_entry *fb_proc_dir_entry; + +static void *fb_seq_start(struct seq_file *m, loff_t *pos) +{ + mutex_lock(®istration_lock); + + return (*pos < FB_MAX) ? pos : NULL; +} + +static void fb_seq_stop(struct seq_file *m, void *v) +{ + mutex_unlock(®istration_lock); +} + +static void *fb_seq_next(struct seq_file *m, void *v, loff_t *pos) +{ + (*pos)++; + + return (*pos < FB_MAX) ? pos : NULL; +} + +static int fb_seq_show(struct seq_file *m, void *v) +{ + int i = *(loff_t *)v; + struct fb_info *fi = registered_fb[i]; + + if (fi) + seq_printf(m, "%d %s\n", fi->node, fi->fix.id); + + return 0; +} + +static const struct seq_operations __maybe_unused fb_proc_seq_ops = { + .start = fb_seq_start, + .stop = fb_seq_stop, + .next = fb_seq_next, + .show = fb_seq_show, +}; + +int fb_init_procfs(void) +{ + struct proc_dir_entry *proc; + + proc = proc_create_seq("fb", 0, NULL, &fb_proc_seq_ops); + if (!proc) + return -ENOMEM; + + fb_proc_dir_entry = proc; + + return 0; +} + +void fb_cleanup_procfs(void) +{ + proc_remove(fb_proc_dir_entry); +} diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 66532774d351e..536209901e32a 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -24,9 +24,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -48,8 +46,7 @@ #define FBPIXMAPSIZE (1024 * 8) -static DEFINE_MUTEX(registration_lock); - +DEFINE_MUTEX(registration_lock); struct fb_info *registered_fb[FB_MAX] __read_mostly; int num_registered_fb __read_mostly; #define for_each_registered_fb(i) \ @@ -705,40 +702,6 @@ int fb_show_logo(struct fb_info *info, int rotate) { return 0; } EXPORT_SYMBOL(fb_prepare_logo); EXPORT_SYMBOL(fb_show_logo); -static void *fb_seq_start(struct seq_file *m, loff_t *pos) -{ - mutex_lock(®istration_lock); - return (*pos < FB_MAX) ? pos : NULL; -} - -static void *fb_seq_next(struct seq_file *m, void *v, loff_t *pos) -{ - (*pos)++; - return (*pos < FB_MAX) ? pos : NULL; -} - -static void fb_seq_stop(struct seq_file *m, void *v) -{ - mutex_unlock(®istration_lock); -} - -static int fb_seq_show(struct seq_file *m, void *v) -{ - int i = *(loff_t *)v; - struct fb_info *fi = registered_fb[i]; - - if (fi) - seq_printf(m, "%d %s\n", fi->node, fi->fix.id); - return 0; -} - -static const struct seq_operations __maybe_unused proc_fb_seq_ops = { - .start = fb_seq_start, - .next = fb_seq_next, - .stop = fb_seq_stop, - .show = fb_seq_show, -}; - /* * We hold a reference to the fb_info in file->private_data, * but if the current registered fb has changed, we don't @@ -1624,8 +1587,9 @@ fbmem_init(void) { int ret; - if (!proc_create_seq("fb", 0, NULL, &proc_fb_seq_ops)) - return -ENOMEM; + ret = fb_init_procfs(); + if (ret) + return ret; ret = register_chrdev(FB_MAJOR, "fb", &fb_fops); if (ret) { @@ -1648,7 +1612,7 @@ fbmem_init(void) err_class: unregister_chrdev(FB_MAJOR, "fb"); err_chrdev: - remove_proc_entry("fb", NULL); + fb_cleanup_procfs(); return ret; } @@ -1659,7 +1623,7 @@ fbmem_exit(void) { fb_console_exit(); - remove_proc_entry("fb", NULL); + fb_cleanup_procfs(); class_destroy(fb_class); unregister_chrdev(FB_MAJOR, "fb"); } From patchwork Mon Jun 12 14:08:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691849 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 2A96EC88CB2 for ; Mon, 12 Jun 2023 14:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238104AbjFLOPF (ORCPT ); Mon, 12 Jun 2023 10:15:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237632AbjFLOOe (ORCPT ); Mon, 12 Jun 2023 10:14:34 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 267A410C4; Mon, 12 Jun 2023 07:14:09 -0700 (PDT) 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 B32F520106; Mon, 12 Jun 2023 14:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579247; 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=jjB2NNvvawyoKV0vh9kOtZ0Pw05KTdiEhdhszxFcL5o=; b=gtQfHeKGNJSZyqXtf9QAU36DRe3tJrRW/SbfjWudD26h81FJac8DOHwrG9VETgDs16p05O roYKntHdw//mfMX+Qs/MmEyADr4ijlSvdg1CoFlhp2o7DLRx8/V0q4sIZH8I1na+p2EZxQ 59o39ftumHtH3GFBuzFCsPi/pVHG7O8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579247; 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=jjB2NNvvawyoKV0vh9kOtZ0Pw05KTdiEhdhszxFcL5o=; b=xt6OFuMnvZVLoZJatwvlxYskiTkxLf1VsfMDgAxhnZ8aVhe+LZ6qiiMDOr4aPqio4uL7iu qtAVXKnIr5t42CDQ== 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 53E871357F; Mon, 12 Jun 2023 14:14:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GMF8Ey8oh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:07 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 36/38] fbdev/core: Move file-I/O code into separate file Date: Mon, 12 Jun 2023 16:08:14 +0200 Message-ID: <20230612141352.29939-37-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Move fbdev's file-I/O code into a separate file and contain it in init and cleanup helpers. No functional changes. v2: * rename source file (Sam) * include (Javier, kernel test robot) Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg --- drivers/video/fbdev/core/Makefile | 1 + drivers/video/fbdev/core/fb_internal.h | 6 + drivers/video/fbdev/core/fbmem.c | 479 +------------------------ 3 files changed, 13 insertions(+), 473 deletions(-) diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index 665320160f70a..eea5938f74238 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_FB_NOTIFY) += fb_notify.o obj-$(CONFIG_FB) += fb.o fb-y := fb_backlight.o \ + fb_chrdev.o \ fb_info.o \ fb_procfs.o \ fbmem.o fbmon.o fbcmap.o fbsysfs.o \ diff --git a/drivers/video/fbdev/core/fb_internal.h b/drivers/video/fbdev/core/fb_internal.h index 51f7c9f04e45a..abe06c9da36e3 100644 --- a/drivers/video/fbdev/core/fb_internal.h +++ b/drivers/video/fbdev/core/fb_internal.h @@ -6,10 +6,16 @@ #include #include +/* fb_devfs.c */ +int fb_register_chrdev(void); +void fb_unregister_chrdev(void); + /* fbmem.c */ extern struct mutex registration_lock; extern struct fb_info *registered_fb[FB_MAX]; extern int num_registered_fb; +struct fb_info *get_fb_info(unsigned int idx); +void put_fb_info(struct fb_info *fb_info); /* fb_procfs.c */ int fb_init_procfs(void); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 536209901e32a..4edf70241a23c 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -13,11 +13,9 @@ #include -#include #include #include #include -#include #include #include #include @@ -57,7 +55,7 @@ bool fb_center_logo __read_mostly; int fb_logo_count __read_mostly = -1; -static struct fb_info *get_fb_info(unsigned int idx) +struct fb_info *get_fb_info(unsigned int idx) { struct fb_info *fb_info; @@ -73,7 +71,7 @@ static struct fb_info *get_fb_info(unsigned int idx) return fb_info; } -static void put_fb_info(struct fb_info *fb_info) +void put_fb_info(struct fb_info *fb_info) { if (!refcount_dec_and_test(&fb_info->count)) return; @@ -702,59 +700,6 @@ int fb_show_logo(struct fb_info *info, int rotate) { return 0; } EXPORT_SYMBOL(fb_prepare_logo); EXPORT_SYMBOL(fb_show_logo); -/* - * We hold a reference to the fb_info in file->private_data, - * but if the current registered fb has changed, we don't - * actually want to use it. - * - * So look up the fb_info using the inode minor number, - * and just verify it against the reference we have. - */ -static struct fb_info *file_fb_info(struct file *file) -{ - struct inode *inode = file_inode(file); - int fbidx = iminor(inode); - struct fb_info *info = registered_fb[fbidx]; - - if (info != file->private_data) - info = NULL; - return info; -} - -static ssize_t -fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) -{ - struct fb_info *info = file_fb_info(file); - - if (!info) - return -ENODEV; - - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; - - if (info->fbops->fb_read) - return info->fbops->fb_read(info, buf, count, ppos); - - return fb_io_read(info, buf, count, ppos); -} - -static ssize_t -fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) -{ - struct fb_info *info = file_fb_info(file); - - if (!info) - return -ENODEV; - - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; - - if (info->fbops->fb_write) - return info->fbops->fb_write(info, buf, count, ppos); - - return fb_io_write(info, buf, count, ppos); -} - int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) { @@ -954,416 +899,6 @@ fb_blank(struct fb_info *info, int blank) } EXPORT_SYMBOL(fb_blank); -static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unsigned long arg) -{ - const struct fb_ops *fb; - struct fb_var_screeninfo var; - struct fb_fix_screeninfo fix; - struct fb_cmap cmap_from; - struct fb_cmap_user cmap; - void __user *argp = (void __user *)arg; - long ret = 0; - - switch (cmd) { - case FBIOGET_VSCREENINFO: - lock_fb_info(info); - var = info->var; - unlock_fb_info(info); - - ret = copy_to_user(argp, &var, sizeof(var)) ? -EFAULT : 0; - break; - case FBIOPUT_VSCREENINFO: - if (copy_from_user(&var, argp, sizeof(var))) - return -EFAULT; - /* only for kernel-internal use */ - var.activate &= ~FB_ACTIVATE_KD_TEXT; - console_lock(); - lock_fb_info(info); - ret = fbcon_modechange_possible(info, &var); - if (!ret) - ret = fb_set_var(info, &var); - if (!ret) - fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL); - unlock_fb_info(info); - console_unlock(); - if (!ret && copy_to_user(argp, &var, sizeof(var))) - ret = -EFAULT; - break; - case FBIOGET_FSCREENINFO: - lock_fb_info(info); - memcpy(&fix, &info->fix, sizeof(fix)); - if (info->flags & FBINFO_HIDE_SMEM_START) - fix.smem_start = 0; - unlock_fb_info(info); - - ret = copy_to_user(argp, &fix, sizeof(fix)) ? -EFAULT : 0; - break; - case FBIOPUTCMAP: - if (copy_from_user(&cmap, argp, sizeof(cmap))) - return -EFAULT; - ret = fb_set_user_cmap(&cmap, info); - break; - case FBIOGETCMAP: - if (copy_from_user(&cmap, argp, sizeof(cmap))) - return -EFAULT; - lock_fb_info(info); - cmap_from = info->cmap; - unlock_fb_info(info); - ret = fb_cmap_to_user(&cmap_from, &cmap); - break; - case FBIOPAN_DISPLAY: - if (copy_from_user(&var, argp, sizeof(var))) - return -EFAULT; - console_lock(); - lock_fb_info(info); - ret = fb_pan_display(info, &var); - unlock_fb_info(info); - console_unlock(); - if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) - return -EFAULT; - break; - case FBIO_CURSOR: - ret = -EINVAL; - break; - case FBIOGET_CON2FBMAP: - ret = fbcon_get_con2fb_map_ioctl(argp); - break; - case FBIOPUT_CON2FBMAP: - ret = fbcon_set_con2fb_map_ioctl(argp); - break; - case FBIOBLANK: - if (arg > FB_BLANK_POWERDOWN) - return -EINVAL; - console_lock(); - lock_fb_info(info); - ret = fb_blank(info, arg); - /* might again call into fb_blank */ - fbcon_fb_blanked(info, arg); - unlock_fb_info(info); - console_unlock(); - break; - default: - lock_fb_info(info); - fb = info->fbops; - if (fb->fb_ioctl) - ret = fb->fb_ioctl(info, cmd, arg); - else - ret = -ENOTTY; - unlock_fb_info(info); - } - return ret; -} - -static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - struct fb_info *info = file_fb_info(file); - - if (!info) - return -ENODEV; - return do_fb_ioctl(info, cmd, arg); -} - -#ifdef CONFIG_COMPAT -struct fb_fix_screeninfo32 { - char id[16]; - compat_caddr_t smem_start; - u32 smem_len; - u32 type; - u32 type_aux; - u32 visual; - u16 xpanstep; - u16 ypanstep; - u16 ywrapstep; - u32 line_length; - compat_caddr_t mmio_start; - u32 mmio_len; - u32 accel; - u16 reserved[3]; -}; - -struct fb_cmap32 { - u32 start; - u32 len; - compat_caddr_t red; - compat_caddr_t green; - compat_caddr_t blue; - compat_caddr_t transp; -}; - -static int fb_getput_cmap(struct fb_info *info, unsigned int cmd, - unsigned long arg) -{ - struct fb_cmap32 cmap32; - struct fb_cmap cmap_from; - struct fb_cmap_user cmap; - - if (copy_from_user(&cmap32, compat_ptr(arg), sizeof(cmap32))) - return -EFAULT; - - cmap = (struct fb_cmap_user) { - .start = cmap32.start, - .len = cmap32.len, - .red = compat_ptr(cmap32.red), - .green = compat_ptr(cmap32.green), - .blue = compat_ptr(cmap32.blue), - .transp = compat_ptr(cmap32.transp), - }; - - if (cmd == FBIOPUTCMAP) - return fb_set_user_cmap(&cmap, info); - - lock_fb_info(info); - cmap_from = info->cmap; - unlock_fb_info(info); - - return fb_cmap_to_user(&cmap_from, &cmap); -} - -static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix, - struct fb_fix_screeninfo32 __user *fix32) -{ - __u32 data; - int err; - - err = copy_to_user(&fix32->id, &fix->id, sizeof(fix32->id)); - - data = (__u32) (unsigned long) fix->smem_start; - err |= put_user(data, &fix32->smem_start); - - err |= put_user(fix->smem_len, &fix32->smem_len); - err |= put_user(fix->type, &fix32->type); - err |= put_user(fix->type_aux, &fix32->type_aux); - err |= put_user(fix->visual, &fix32->visual); - err |= put_user(fix->xpanstep, &fix32->xpanstep); - err |= put_user(fix->ypanstep, &fix32->ypanstep); - err |= put_user(fix->ywrapstep, &fix32->ywrapstep); - err |= put_user(fix->line_length, &fix32->line_length); - - data = (__u32) (unsigned long) fix->mmio_start; - err |= put_user(data, &fix32->mmio_start); - - err |= put_user(fix->mmio_len, &fix32->mmio_len); - err |= put_user(fix->accel, &fix32->accel); - err |= copy_to_user(fix32->reserved, fix->reserved, - sizeof(fix->reserved)); - - if (err) - return -EFAULT; - return 0; -} - -static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, - unsigned long arg) -{ - struct fb_fix_screeninfo fix; - - lock_fb_info(info); - fix = info->fix; - if (info->flags & FBINFO_HIDE_SMEM_START) - fix.smem_start = 0; - unlock_fb_info(info); - return do_fscreeninfo_to_user(&fix, compat_ptr(arg)); -} - -static long fb_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - struct fb_info *info = file_fb_info(file); - const struct fb_ops *fb; - long ret = -ENOIOCTLCMD; - - if (!info) - return -ENODEV; - fb = info->fbops; - switch(cmd) { - case FBIOGET_VSCREENINFO: - case FBIOPUT_VSCREENINFO: - case FBIOPAN_DISPLAY: - case FBIOGET_CON2FBMAP: - case FBIOPUT_CON2FBMAP: - arg = (unsigned long) compat_ptr(arg); - fallthrough; - case FBIOBLANK: - ret = do_fb_ioctl(info, cmd, arg); - break; - - case FBIOGET_FSCREENINFO: - ret = fb_get_fscreeninfo(info, cmd, arg); - break; - - case FBIOGETCMAP: - case FBIOPUTCMAP: - ret = fb_getput_cmap(info, cmd, arg); - break; - - default: - if (fb->fb_compat_ioctl) - ret = fb->fb_compat_ioctl(info, cmd, arg); - break; - } - return ret; -} -#endif - -static int -fb_mmap(struct file *file, struct vm_area_struct * vma) -{ - struct fb_info *info = file_fb_info(file); - unsigned long mmio_pgoff; - unsigned long start; - u32 len; - - if (!info) - return -ENODEV; - mutex_lock(&info->mm_lock); - - if (info->fbops->fb_mmap) { - int res; - - /* - * The framebuffer needs to be accessed decrypted, be sure - * SME protection is removed ahead of the call - */ - vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); - res = info->fbops->fb_mmap(info, vma); - mutex_unlock(&info->mm_lock); - return res; -#if IS_ENABLED(CONFIG_FB_DEFERRED_IO) - } else if (info->fbdefio) { - /* - * FB deferred I/O wants you to handle mmap in your drivers. At a - * minimum, point struct fb_ops.fb_mmap to fb_deferred_io_mmap(). - */ - dev_warn_once(info->dev, "fbdev mmap not set up for deferred I/O.\n"); - mutex_unlock(&info->mm_lock); - return -ENODEV; -#endif - } - - /* - * Ugh. This can be either the frame buffer mapping, or - * if pgoff points past it, the mmio mapping. - */ - start = info->fix.smem_start; - len = info->fix.smem_len; - mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT; - if (vma->vm_pgoff >= mmio_pgoff) { - if (info->var.accel_flags) { - mutex_unlock(&info->mm_lock); - return -EINVAL; - } - - vma->vm_pgoff -= mmio_pgoff; - start = info->fix.mmio_start; - len = info->fix.mmio_len; - } - mutex_unlock(&info->mm_lock); - - vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); - fb_pgprotect(file, vma, start); - - return vm_iomap_memory(vma, start, len); -} - -static int -fb_open(struct inode *inode, struct file *file) -__acquires(&info->lock) -__releases(&info->lock) -{ - int fbidx = iminor(inode); - struct fb_info *info; - int res = 0; - - info = get_fb_info(fbidx); - if (!info) { - request_module("fb%d", fbidx); - info = get_fb_info(fbidx); - if (!info) - return -ENODEV; - } - if (IS_ERR(info)) - return PTR_ERR(info); - - lock_fb_info(info); - if (!try_module_get(info->fbops->owner)) { - res = -ENODEV; - goto out; - } - file->private_data = info; - if (info->fbops->fb_open) { - res = info->fbops->fb_open(info,1); - if (res) - module_put(info->fbops->owner); - } -#ifdef CONFIG_FB_DEFERRED_IO - if (info->fbdefio) - fb_deferred_io_open(info, inode, file); -#endif -out: - unlock_fb_info(info); - if (res) - put_fb_info(info); - return res; -} - -static int -fb_release(struct inode *inode, struct file *file) -__acquires(&info->lock) -__releases(&info->lock) -{ - struct fb_info * const info = file->private_data; - - lock_fb_info(info); -#if IS_ENABLED(CONFIG_FB_DEFERRED_IO) - if (info->fbdefio) - fb_deferred_io_release(info); -#endif - if (info->fbops->fb_release) - info->fbops->fb_release(info,1); - module_put(info->fbops->owner); - unlock_fb_info(info); - put_fb_info(info); - return 0; -} - -#if defined(CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA) && !defined(CONFIG_MMU) -static unsigned long get_fb_unmapped_area(struct file *filp, - unsigned long addr, unsigned long len, - unsigned long pgoff, unsigned long flags) -{ - struct fb_info * const info = filp->private_data; - unsigned long fb_size = PAGE_ALIGN(info->fix.smem_len); - - if (pgoff > fb_size || len > fb_size - pgoff) - return -EINVAL; - - return (unsigned long)info->screen_base + pgoff; -} -#endif - -static const struct file_operations fb_fops = { - .owner = THIS_MODULE, - .read = fb_read, - .write = fb_write, - .unlocked_ioctl = fb_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = fb_compat_ioctl, -#endif - .mmap = fb_mmap, - .open = fb_open, - .release = fb_release, -#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) || \ - (defined(CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA) && \ - !defined(CONFIG_MMU)) - .get_unmapped_area = get_fb_unmapped_area, -#endif -#ifdef CONFIG_FB_DEFERRED_IO - .fsync = fb_deferred_io_fsync, -#endif - .llseek = default_llseek, -}; - struct class *fb_class; EXPORT_SYMBOL(fb_class); @@ -1591,11 +1126,9 @@ fbmem_init(void) if (ret) return ret; - ret = register_chrdev(FB_MAJOR, "fb", &fb_fops); - if (ret) { - printk("unable to get major %d for fb devs\n", FB_MAJOR); + ret = fb_register_chrdev(); + if (ret) goto err_chrdev; - } fb_class = class_create("graphics"); if (IS_ERR(fb_class)) { @@ -1610,7 +1143,7 @@ fbmem_init(void) return 0; err_class: - unregister_chrdev(FB_MAJOR, "fb"); + fb_unregister_chrdev(); err_chrdev: fb_cleanup_procfs(); return ret; @@ -1625,7 +1158,7 @@ fbmem_exit(void) fb_cleanup_procfs(); class_destroy(fb_class); - unregister_chrdev(FB_MAJOR, "fb"); + fb_unregister_chrdev(); } module_exit(fbmem_exit); From patchwork Mon Jun 12 14:08:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691853 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 03CCCC88CB6 for ; Mon, 12 Jun 2023 14:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237485AbjFLOO5 (ORCPT ); Mon, 12 Jun 2023 10:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237616AbjFLOOe (ORCPT ); Mon, 12 Jun 2023 10:14:34 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D98DF0; Mon, 12 Jun 2023 07:14:09 -0700 (PDT) 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 158B320489; Mon, 12 Jun 2023 14:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579248; 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=yHsYY4KkqinsC3hNy7+x1+/KpZqx4RkXsKhX6dnk4eY=; b=jR2/iHB4qwTW8cw5T8RndhShQGjz/kBlNm/Q3WAMwhn+QzfU9v5sdaHBSQrxdx1EzxnOCV +NBnyuOd14uMP3DedOqR4hSFmwib3XhLgDgsUmQGtTpcpGqKJRMgAkzwQzR3F3DK7tibl9 2IuVxjG5vxgMlQGmm3UC8Kg/FWyhcQI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579248; 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=yHsYY4KkqinsC3hNy7+x1+/KpZqx4RkXsKhX6dnk4eY=; b=+vSEPE0vbjFbT+XQo1OHy/tbA8UN0KCOIbn/7aQErCckAUhWzsaIMk1l6EkKG36SGGfoHQ IzsfneIjYSC1/mCg== 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 B887413A67; Mon, 12 Jun 2023 14:14:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EOQRLC8oh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:07 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 37/38] fbdev/core: Rework fb init code Date: Mon, 12 Jun 2023 16:08:15 +0200 Message-ID: <20230612141352.29939-38-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Init the class "graphics" before the rest of fbdev. Later steps, such as the sysfs code, depend on the class. Also arrange the module's exit code in reverse order. Unexport the global variable fb_class, which is only shared internally within the fbdev core module. Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg --- drivers/video/fbdev/core/fb_internal.h | 1 + drivers/video/fbdev/core/fbcon.c | 1 + drivers/video/fbdev/core/fbmem.c | 52 ++++++++++---------------- include/linux/fb.h | 1 - 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/drivers/video/fbdev/core/fb_internal.h b/drivers/video/fbdev/core/fb_internal.h index abe06c9da36e3..0b43c0cd50968 100644 --- a/drivers/video/fbdev/core/fb_internal.h +++ b/drivers/video/fbdev/core/fb_internal.h @@ -11,6 +11,7 @@ int fb_register_chrdev(void); void fb_unregister_chrdev(void); /* fbmem.c */ +extern struct class *fb_class; extern struct mutex registration_lock; extern struct fb_info *registered_fb[FB_MAX]; extern int num_registered_fb; diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index c6c9d040bdec7..8e76bc246b387 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -78,6 +78,7 @@ #include #include "fbcon.h" +#include "fb_internal.h" /* * FIXME: Locking diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 4edf70241a23c..ee44a46a66be1 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -44,6 +44,8 @@ #define FBPIXMAPSIZE (1024 * 8) +struct class *fb_class; + DEFINE_MUTEX(registration_lock); struct fb_info *registered_fb[FB_MAX] __read_mostly; int num_registered_fb __read_mostly; @@ -899,9 +901,6 @@ fb_blank(struct fb_info *info, int blank) } EXPORT_SYMBOL(fb_blank); -struct class *fb_class; -EXPORT_SYMBOL(fb_class); - static int fb_check_foreignness(struct fb_info *fi) { const bool foreign_endian = fi->flags & FBINFO_FOREIGN_ENDIAN; @@ -1108,59 +1107,48 @@ void fb_set_suspend(struct fb_info *info, int state) } EXPORT_SYMBOL(fb_set_suspend); -/** - * fbmem_init - init frame buffer subsystem - * - * Initialize the frame buffer subsystem. - * - * NOTE: This function is _only_ to be called by drivers/char/mem.c. - * - */ - -static int __init -fbmem_init(void) +static int __init fbmem_init(void) { int ret; + fb_class = class_create("graphics"); + if (IS_ERR(fb_class)) { + ret = PTR_ERR(fb_class); + pr_err("Unable to create fb class; errno = %d\n", ret); + goto err_fb_class; + } + ret = fb_init_procfs(); if (ret) - return ret; + goto err_class_destroy; ret = fb_register_chrdev(); if (ret) - goto err_chrdev; - - fb_class = class_create("graphics"); - if (IS_ERR(fb_class)) { - ret = PTR_ERR(fb_class); - pr_warn("Unable to create fb class; errno = %d\n", ret); - fb_class = NULL; - goto err_class; - } + goto err_fb_cleanup_procfs; fb_console_init(); return 0; -err_class: - fb_unregister_chrdev(); -err_chrdev: +err_fb_cleanup_procfs: fb_cleanup_procfs(); +err_class_destroy: + class_destroy(fb_class); +err_fb_class: + fb_class = NULL; return ret; } #ifdef MODULE -module_init(fbmem_init); -static void __exit -fbmem_exit(void) +static void __exit fbmem_exit(void) { fb_console_exit(); - + fb_unregister_chrdev(); fb_cleanup_procfs(); class_destroy(fb_class); - fb_unregister_chrdev(); } +module_init(fbmem_init); module_exit(fbmem_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Framebuffer base"); diff --git a/include/linux/fb.h b/include/linux/fb.h index 1988d11f78bcb..541a0e3ce21f4 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -609,7 +609,6 @@ extern int fb_new_modelist(struct fb_info *info); extern bool fb_center_logo; extern int fb_logo_count; -extern struct class *fb_class; static inline void lock_fb_info(struct fb_info *info) { From patchwork Mon Jun 12 14:08:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 691850 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 C12E5C88CB9 for ; Mon, 12 Jun 2023 14:15:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238086AbjFLOPD (ORCPT ); Mon, 12 Jun 2023 10:15:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237633AbjFLOOe (ORCPT ); Mon, 12 Jun 2023 10:14:34 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0C0B198D; Mon, 12 Jun 2023 07:14:09 -0700 (PDT) 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 7470722838; Mon, 12 Jun 2023 14:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579248; 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=QGqfM+IVMMvM7bmJQvhd9Ci0kyAq3E3rKtUzog5kgLc=; b=DCVcGuxm+1X0KZMyHU64Zur1DF9Fm3my2LIFQWQLIrvO3ivVEkKBdRVTxuf9w8JsqbnoqD o6rQuyt75Fc80rZW67J1K5QeD/OUFu46NgOLw5m+2uqJ9VAP6bNatf+l197gDuc4R9L/oN HB/xC26gBSelQuEGmidJChzXAVhWiWQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579248; 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=QGqfM+IVMMvM7bmJQvhd9Ci0kyAq3E3rKtUzog5kgLc=; b=BRUI7PQzl8t42AJqp2ObQ3JkW2PckUyqTBMkf8K3mMnZY9NWscZXsrBRNVbyggoMLTRPIS CkHvfogckeBLDJDA== 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 188271357F; Mon, 12 Jun 2023 14:14:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wIsEBTAoh2RwGQAAMHmgww (envelope-from ); Mon, 12 Jun 2023 14:14:08 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann , Greg Kroah-Hartman Subject: [PATCH v2 38/38] fbdev: Make support for userspace interfaces configurable Date: Mon, 12 Jun 2023 16:08:16 +0200 Message-ID: <20230612141352.29939-39-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Add Kconfig option CONFIG_FB_DEVICE and make the virtual fbdev device optional. If the new option has not been selected, fbdev does not create files in devfs, sysfs or procfs. Most modern Linux systems run a DRM-based graphics stack that uses the kernel's framebuffer console, but has otherwise deprecated fbdev support. Yet fbdev userspace interfaces are still present. The option makes it possible to use the fbdev subsystem as console implementation without support for userspace. This closes potential entry points to manipulate kernel or I/O memory via framebuffers. It also prevents the execution of driver code via ioctl or sysfs, both of which might allow malicious software to exploit bugs in the fbdev code. A small number of fbdev drivers require struct fbinfo.dev to be initialized, usually for the support of sysfs interface. Make these drivers depend on FB_DEVICE. They can later be fixed if necessary. v2: * set FB_DEVICE default to y (Geert) * comment on {get,put}_device() (Sam) * Kconfig fixes (Sam) * add TODO item about FB_DEVICE dependencies (Sam) Signed-off-by: Thomas Zimmermann Acked-by: Greg Kroah-Hartman Reviewed-by: Sam Ravnborg --- Documentation/gpu/todo.rst | 13 ++++++++ drivers/staging/fbtft/Kconfig | 1 + drivers/video/fbdev/Kconfig | 13 ++++++++ drivers/video/fbdev/core/Makefile | 7 +++-- drivers/video/fbdev/core/fb_internal.h | 38 ++++++++++++++++++++++++ drivers/video/fbdev/omap2/omapfb/Kconfig | 2 +- include/linux/fb.h | 2 ++ 7 files changed, 72 insertions(+), 4 deletions(-) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index 68bdafa0284f5..f226f934ca5af 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -452,6 +452,19 @@ Contact: Thomas Zimmermann Level: Starter +Remove driver dependencies on FB_DEVICE +--------------------------------------- + +A number of fbdev drivers provide attributes via sysfs and therefore depend +on CONFIG_FB_DEVICE to be selected. Review each driver and attempt to make +any dependencies on CONFIG_FB_DEVICE optional. At the minimum, the respective +code in the driver could be conditionalized via ifdef CONFIG_FB_DEVICE. Not +all drivers might be able to drop CONFIG_FB_DEVICE. + +Contact: Thomas Zimmermann + +Level: Starter + Core refactorings ================= diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig index 4d29e8c1014e0..5dda3c65a38e7 100644 --- a/drivers/staging/fbtft/Kconfig +++ b/drivers/staging/fbtft/Kconfig @@ -2,6 +2,7 @@ menuconfig FB_TFT tristate "Support for small TFT LCD display modules" depends on FB && SPI + depends on FB_DEVICE depends on GPIOLIB || COMPILE_TEST select FB_SYS_FILLRECT select FB_SYS_COPYAREA diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index f82357d4f84da..19eaca5e04283 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -57,6 +57,16 @@ config FIRMWARE_EDID combination with certain motherboards and monitors are known to suffer from this problem. +config FB_DEVICE + bool "Provide legacy /dev/fb* device" + depends on FB + default y + help + Say Y here if you want the legacy /dev/fb* device file and + interfaces within sysfs anc procfs. It is only required if you + have userspace programs that depend on fbdev for graphics output. + This does not effect the framebuffer console. If unsure, say N. + config FB_DDC tristate depends on FB @@ -1545,6 +1555,7 @@ config FB_3DFX_I2C config FB_VOODOO1 tristate "3Dfx Voodoo Graphics (sst1) support" depends on FB && PCI + depends on FB_DEVICE select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT @@ -1863,6 +1874,7 @@ config FB_SH_MOBILE_LCDC tristate "SuperH Mobile LCDC framebuffer support" depends on FB && HAVE_CLK && HAS_IOMEM depends on SUPERH || ARCH_RENESAS || COMPILE_TEST + depends on FB_DEVICE select FB_SYS_FILLRECT select FB_SYS_COPYAREA select FB_SYS_IMAGEBLIT @@ -1932,6 +1944,7 @@ config FB_SMSCUFX config FB_UDL tristate "Displaylink USB Framebuffer support" depends on FB && USB + depends on FB_DEVICE select FB_MODE_HELPERS select FB_SYS_FILLRECT select FB_SYS_COPYAREA diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index eea5938f74238..9150bafd9e899 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -2,12 +2,13 @@ obj-$(CONFIG_FB_NOTIFY) += fb_notify.o obj-$(CONFIG_FB) += fb.o fb-y := fb_backlight.o \ - fb_chrdev.o \ fb_info.o \ - fb_procfs.o \ - fbmem.o fbmon.o fbcmap.o fbsysfs.o \ + fbmem.o fbmon.o fbcmap.o \ modedb.o fbcvt.o fb_cmdline.o fb_io_fops.o fb-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o +fb-$(CONFIG_FB_DEVICE) += fb_chrdev.o \ + fb_procfs.o \ + fbsysfs.o ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE),y) fb-y += fbcon.o bitblit.o softcursor.o diff --git a/drivers/video/fbdev/core/fb_internal.h b/drivers/video/fbdev/core/fb_internal.h index 0b43c0cd50968..4c8d509a00265 100644 --- a/drivers/video/fbdev/core/fb_internal.h +++ b/drivers/video/fbdev/core/fb_internal.h @@ -3,12 +3,22 @@ #ifndef _FB_INTERNAL_H #define _FB_INTERNAL_H +#include #include #include /* fb_devfs.c */ +#if defined(CONFIG_FB_DEVICE) int fb_register_chrdev(void); void fb_unregister_chrdev(void); +#else +static inline int fb_register_chrdev(void) +{ + return 0; +} +static inline void fb_unregister_chrdev(void) +{ } +#endif /* fbmem.c */ extern struct class *fb_class; @@ -19,11 +29,39 @@ struct fb_info *get_fb_info(unsigned int idx); void put_fb_info(struct fb_info *fb_info); /* fb_procfs.c */ +#if defined(CONFIG_FB_DEVICE) int fb_init_procfs(void); void fb_cleanup_procfs(void); +#else +static inline int fb_init_procfs(void) +{ + return 0; +} +static inline void fb_cleanup_procfs(void) +{ } +#endif /* fbsysfs.c */ +#if defined(CONFIG_FB_DEVICE) int fb_device_create(struct fb_info *fb_info); void fb_device_destroy(struct fb_info *fb_info); +#else +static inline int fb_device_create(struct fb_info *fb_info) +{ + /* + * Acquire a reference on the parent device to avoid + * unplug operations behind our back. With the fbdev + * device enabled, this is performed within register_device(). + */ + get_device(fb_info->device); + + return 0; +} +static inline void fb_device_destroy(struct fb_info *fb_info) +{ + /* Undo the get_device() from fb_device_create() */ + put_device(fb_info->device); +} +#endif #endif diff --git a/drivers/video/fbdev/omap2/omapfb/Kconfig b/drivers/video/fbdev/omap2/omapfb/Kconfig index 69f9cb03507ef..21069fdb7cc21 100644 --- a/drivers/video/fbdev/omap2/omapfb/Kconfig +++ b/drivers/video/fbdev/omap2/omapfb/Kconfig @@ -5,9 +5,9 @@ config OMAP2_VRFB menuconfig FB_OMAP2 tristate "OMAP2+ frame buffer support" depends on FB + depends on FB_DEVICE depends on DRM_OMAP = n depends on GPIOLIB - select FB_OMAP2_DSS select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3 select FB_CFB_FILLRECT diff --git a/include/linux/fb.h b/include/linux/fb.h index 541a0e3ce21f4..40ed1028160c0 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -481,7 +481,9 @@ struct fb_info { const struct fb_ops *fbops; struct device *device; /* This is the parent */ +#if defined(CONFIG_FB_DEVICE) struct device *dev; /* This is this fb device */ +#endif int class_flag; /* private sysfs flags */ #ifdef CONFIG_FB_TILEBLITTING struct fb_tile_ops *tileops; /* Tile Blitting */