From patchwork Mon Sep 23 15:57:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13809804 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE56ECF9C6F for ; Mon, 23 Sep 2024 15:57:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69B2810E1A6; Mon, 23 Sep 2024 15:57:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="a07yZR44"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 17D7610E1A6 for ; Mon, 23 Sep 2024 15:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727107077; x=1758643077; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ChCCXGNH1zxxn2L3QK91w02IPOcPOTRwh6I5wvNjZj4=; b=a07yZR44RfglUbdTvIpFFsqeE0WXhKUj93skaCdvGQNpR1sDwMi/XnLX 3EGfGbXnWBJjsDGlWNY6jXypSRuhat6rlxizn55uyS3EeUaf7YfY4p3Qx z1k3Vn7zLJHiGLQre58vfajunaZ2u0MqSzUmAttRzYyhaCweZiJR3nckM Je0lcYVPPdo//ZBXVWrRqxrSsDJohKXZjeS0kArVchzGjJ0c4LBthq4B7 0P1vYoZxKpK/d6ULo7Igoqqak7JUX+sAAGMosRkrT+EufnbkMVcqdIYRC XkcM0xw2N3y5ynFk7rVLC/4CokvMq6l5OzeTdY5243TVt9EuPgLn4qWx/ Q==; X-CSE-ConnectionGUID: QK5Y0/OZQIyAU/4/FrDwTg== X-CSE-MsgGUID: nGqg/YquRqSCJ93VX+c8oQ== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957220" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957220" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2024 08:57:57 -0700 X-CSE-ConnectionGUID: QQqXf+AhTnSDQxapkdb7Gg== X-CSE-MsgGUID: OM0jbFf4SJGBZDYpi8tYfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="71250766" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 23 Sep 2024 08:57:54 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 23 Sep 2024 18:57:53 +0300 From: Ville Syrjala To: linux-fbdev@vger.kernel.org Cc: Helge Deller , Simona Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 1/6] fbcon: Make cursor_blink=0 work when configured before fb devices appear Date: Mon, 23 Sep 2024 18:57:44 +0300 Message-ID: <20240923155749.30846-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240923155749.30846-1-ville.syrjala@linux.intel.com> References: <20240923155749.30846-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Currently setting cursor_blink attribute to 0 before any fb devices are around does absolutely nothing. When fb devices appear and fbcon becomes active the cursor starts blinking. Fix the problem by recoding the desired state of the attribute even if no fb devices are present at the time. Also adjust the show() method such that it shows the current state of the attribute even when no fb devices are in use. Note that store_cursor_blink() is still a bit dodgy: - seems to be missing some of the other checks that we do elsewhere when deciding whether the cursor should be blinking or not - when set to 0 when the cursor is currently invisible due to blinking, the cursor will remains invisible. We should either explicitly make it visible here, or wait until the full blink cycle has finished. Signed-off-by: Ville Syrjälä --- drivers/video/fbdev/core/fbcon.c | 34 +++++++------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 2e093535884b..8936fa79b9e0 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3217,26 +3217,7 @@ static ssize_t show_rotate(struct device *device, static ssize_t show_cursor_blink(struct device *device, struct device_attribute *attr, char *buf) { - struct fb_info *info; - struct fbcon_ops *ops; - int idx, blink = -1; - - console_lock(); - idx = con2fb_map[fg_console]; - - if (idx == -1 || fbcon_registered_fb[idx] == NULL) - goto err; - - info = fbcon_registered_fb[idx]; - ops = info->fbcon_par; - - if (!ops) - goto err; - - blink = delayed_work_pending(&ops->cursor_work); -err: - console_unlock(); - return sysfs_emit(buf, "%d\n", blink); + return sysfs_emit(buf, "%d\n", !fbcon_cursor_noblink); } static ssize_t store_cursor_blink(struct device *device, @@ -3247,9 +3228,13 @@ static ssize_t store_cursor_blink(struct device *device, int blink, idx; char **last = NULL; + blink = simple_strtoul(buf, last, 0); + console_lock(); idx = con2fb_map[fg_console]; + fbcon_cursor_noblink = !blink; + if (idx == -1 || fbcon_registered_fb[idx] == NULL) goto err; @@ -3258,15 +3243,10 @@ static ssize_t store_cursor_blink(struct device *device, if (!info->fbcon_par) goto err; - blink = simple_strtoul(buf, last, 0); - - if (blink) { - fbcon_cursor_noblink = 0; + if (blink) fbcon_add_cursor_work(info); - } else { - fbcon_cursor_noblink = 1; + else fbcon_del_cursor_work(info); - } err: console_unlock(); From patchwork Mon Sep 23 15:57:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13809805 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB0A5CF9C6F for ; Mon, 23 Sep 2024 15:58:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61D4910E289; Mon, 23 Sep 2024 15:58:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="dzy2FtBO"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6303210E289 for ; Mon, 23 Sep 2024 15:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727107080; x=1758643080; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O3g3L/+sKtCko1xwkExrYw48dPoMuF/ASAUzm/24awE=; b=dzy2FtBOTGgpNyrn73CD2zvhiI6kiaTIRrokBPLL1XA31pI6xJ+du3K4 Qgi49Zbtk2748UiE3no/ruz7SE9Tn5/QFvd16BblyrFfCqyVYcoAL96jn 9UnV+TGsqCmajc1XMzxOueuv7HHVK4W5K7mbxWO72lsjw9ZgF8VeWKG4i Q2OEYenlhWqg6IXwsZWMbKt0DLOAPLc0XmE/fc6kPluzS03cij7aaYEoX ARQBcGXKwEFOXdt+cWF43Xdzx27PvkX4i3swmByiZHbkAce/HbTOK+ULq s7dHObQrTRxcjWE1fO7uTCxD+O+yAmezFwWKjp1nzS4Lky17lkVeG0VHx w==; X-CSE-ConnectionGUID: sqa/brV4QbmTCKti3pXWtw== X-CSE-MsgGUID: YrKwh0QVSIyyYJoCn+QQEw== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957225" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957225" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2024 08:58:00 -0700 X-CSE-ConnectionGUID: VuxfrVICQsWiU7qbjIvxOQ== X-CSE-MsgGUID: Pkx6592wQjKTeVxgUJYhdw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="71250774" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 23 Sep 2024 08:57:57 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 23 Sep 2024 18:57:56 +0300 From: Ville Syrjala To: linux-fbdev@vger.kernel.org Cc: Helge Deller , Simona Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 2/6] fbcon: Add sysfs attributes before registering the device Date: Mon, 23 Sep 2024 18:57:45 +0300 Message-ID: <20240923155749.30846-3-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240923155749.30846-1-ville.syrjala@linux.intel.com> References: <20240923155749.30846-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Currently fbcon adds the attributes after registering the device, which means the attributes may not be there by the time udev gets the ADD uevent. Fix the race by switching over to device_create_with_groups(). With this one can reliably turn off the power wasting cursor blink with a udev rule such as: ACTION=="add", SUBSYSTEM=="graphics", TEST=="cursor_blink", ATTR{cursor_blink}="0" Signed-off-by: Ville Syrjälä --- drivers/video/fbdev/core/fbcon.c | 73 +++++++++----------------------- 1 file changed, 19 insertions(+), 54 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 8936fa79b9e0..bbe332572ca7 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -160,7 +160,6 @@ static int info_idx = -1; /* console rotation */ static int initial_rotation = -1; -static int fbcon_has_sysfs; static int margin_color; static const struct consw fb_con; @@ -188,8 +187,6 @@ static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, static void fbcon_modechanged(struct fb_info *info); static void fbcon_set_all_vcs(struct fb_info *info); -static struct device *fbcon_device; - #ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION static inline void fbcon_set_rotation(struct fb_info *info) { @@ -3151,7 +3148,7 @@ static const struct consw fb_con = { .con_debug_leave = fbcon_debug_leave, }; -static ssize_t store_rotate(struct device *device, +static ssize_t rotate_store(struct device *device, struct device_attribute *attr, const char *buf, size_t count) { @@ -3173,7 +3170,7 @@ static ssize_t store_rotate(struct device *device, return count; } -static ssize_t store_rotate_all(struct device *device, +static ssize_t rotate_all_store(struct device *device, struct device_attribute *attr,const char *buf, size_t count) { @@ -3195,7 +3192,7 @@ static ssize_t store_rotate_all(struct device *device, return count; } -static ssize_t show_rotate(struct device *device, +static ssize_t rotate_show(struct device *device, struct device_attribute *attr,char *buf) { struct fb_info *info; @@ -3214,13 +3211,13 @@ static ssize_t show_rotate(struct device *device, return sysfs_emit(buf, "%d\n", rotate); } -static ssize_t show_cursor_blink(struct device *device, +static ssize_t cursor_blink_show(struct device *device, struct device_attribute *attr, char *buf) { return sysfs_emit(buf, "%d\n", !fbcon_cursor_noblink); } -static ssize_t store_cursor_blink(struct device *device, +static ssize_t cursor_blink_store(struct device *device, struct device_attribute *attr, const char *buf, size_t count) { @@ -3253,35 +3250,17 @@ static ssize_t store_cursor_blink(struct device *device, return count; } -static struct device_attribute device_attrs[] = { - __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), - __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all), - __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink, - store_cursor_blink), -}; - -static int fbcon_init_device(void) -{ - int i, error = 0; - - fbcon_has_sysfs = 1; - - for (i = 0; i < ARRAY_SIZE(device_attrs); i++) { - error = device_create_file(fbcon_device, &device_attrs[i]); - - if (error) - break; - } - - if (error) { - while (--i >= 0) - device_remove_file(fbcon_device, &device_attrs[i]); - - fbcon_has_sysfs = 0; - } +static DEVICE_ATTR_RW(rotate); +static DEVICE_ATTR_WO(rotate_all); +static DEVICE_ATTR_RW(cursor_blink); - return 0; -} +static struct attribute *device_attrs[] = { + &dev_attr_rotate.attr, + &dev_attr_rotate_all.attr, + &dev_attr_cursor_blink.attr, + NULL, +}; +ATTRIBUTE_GROUPS(device); #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER static void fbcon_register_existing_fbs(struct work_struct *work) @@ -3336,19 +3315,18 @@ static void fbcon_start(void) void __init fb_console_init(void) { + struct device *fbcon_device; int i; console_lock(); - fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, - "fbcon"); + fbcon_device = device_create_with_groups(fb_class, NULL, MKDEV(0, 0), + NULL, device_groups, "fbcon"); if (IS_ERR(fbcon_device)) { printk(KERN_WARNING "Unable to create device " "for fbcon; errno = %ld\n", PTR_ERR(fbcon_device)); - fbcon_device = NULL; - } else - fbcon_init_device(); + } for (i = 0; i < MAX_NR_CONSOLES; i++) con2fb_map[i] = -1; @@ -3359,18 +3337,6 @@ void __init fb_console_init(void) #ifdef MODULE -static void __exit fbcon_deinit_device(void) -{ - int i; - - if (fbcon_has_sysfs) { - for (i = 0; i < ARRAY_SIZE(device_attrs); i++) - device_remove_file(fbcon_device, &device_attrs[i]); - - fbcon_has_sysfs = 0; - } -} - void __exit fb_console_exit(void) { #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER @@ -3383,7 +3349,6 @@ void __exit fb_console_exit(void) #endif console_lock(); - fbcon_deinit_device(); device_destroy(fb_class, MKDEV(0, 0)); do_unregister_con_driver(&fb_con); From patchwork Mon Sep 23 15:57:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13809806 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04297CF9C72 for ; Mon, 23 Sep 2024 15:58:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BF9010E41F; Mon, 23 Sep 2024 15:58:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="bTwIBCXQ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3B0810E41F for ; Mon, 23 Sep 2024 15:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727107084; x=1758643084; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W5gtcbCYp4vJg4Flsqj3JabmZDfdkYxI+vhYsmZg/pU=; b=bTwIBCXQbo+JQhmI+q6vLAOvo+qh8Yd6840IhRk14dwJltn+gNvTEkBl 01f6uJLM7jTA/XOn8ZWqF+ctGWdz83/rIjc/GrZCT3ztURbrScc/FhfEy kZexnyt9jwALLXc1kj2eUJkbJzVIrP1iW4DbB3EnXnsNBRs8zrwh4zxds 3+UwL4/Bi/luEO+MnFPssZ8Vr2bXrSI06273uyrXHhHmHHBrYVdr48CK5 E3paJMm3fFr6shXA9/rqImv20VymcrI/qw8exNgIdsS4dedpaGdb+8oui 3hM9v0wmml3NByAizPtIv32mORmuFkpc03WhrRINCu/a0plXC1VN0TPoU A==; X-CSE-ConnectionGUID: hzEG3tMWQ7mxETFZWat3BA== X-CSE-MsgGUID: Fu+QbjDRRzKD7U8sLh7Q3Q== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957235" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957235" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2024 08:58:04 -0700 X-CSE-ConnectionGUID: +1YXDUogTT+AIac5L1RowA== X-CSE-MsgGUID: e1tmV5n9QKGm46YWyYlpqw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="71250782" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 23 Sep 2024 08:58:01 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 23 Sep 2024 18:58:00 +0300 From: Ville Syrjala To: linux-fbdev@vger.kernel.org Cc: Helge Deller , Simona Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 3/6] fbcon: fbcon_cursor_noblink -> fbcon_cursor_blink Date: Mon, 23 Sep 2024 18:57:46 +0300 Message-ID: <20240923155749.30846-4-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240923155749.30846-1-ville.syrjala@linux.intel.com> References: <20240923155749.30846-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Invert fbcon_cursor_noblink into fbcon_cursor_blink so that: - it matches the sysfs attribute exactly - avoids having to do these NOT operations all over the place Signed-off-by: Ville Syrjälä --- drivers/video/fbdev/core/fbcon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index bbe332572ca7..eb30aa872371 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -166,7 +166,7 @@ static const struct consw fb_con; #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row) -static int fbcon_cursor_noblink; +static int fbcon_cursor_blink; #define divides(a, b) ((!(a) || (b)%(a)) ? 0 : 1) @@ -399,7 +399,7 @@ static void fbcon_add_cursor_work(struct fb_info *info) { struct fbcon_ops *ops = info->fbcon_par; - if (!fbcon_cursor_noblink) + if (fbcon_cursor_blink) queue_delayed_work(system_power_efficient_wq, &ops->cursor_work, ops->cur_blink_jiffies); } @@ -3214,7 +3214,7 @@ static ssize_t rotate_show(struct device *device, static ssize_t cursor_blink_show(struct device *device, struct device_attribute *attr, char *buf) { - return sysfs_emit(buf, "%d\n", !fbcon_cursor_noblink); + return sysfs_emit(buf, "%d\n", fbcon_cursor_blink); } static ssize_t cursor_blink_store(struct device *device, @@ -3230,7 +3230,7 @@ static ssize_t cursor_blink_store(struct device *device, console_lock(); idx = con2fb_map[fg_console]; - fbcon_cursor_noblink = !blink; + fbcon_cursor_blink = blink; if (idx == -1 || fbcon_registered_fb[idx] == NULL) goto err; From patchwork Mon Sep 23 15:57:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13809807 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1FB8CF9C6F for ; Mon, 23 Sep 2024 15:58:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B12010E423; Mon, 23 Sep 2024 15:58:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="GnJUx3Cc"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5F9F610E421 for ; Mon, 23 Sep 2024 15:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727107087; x=1758643087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dhz4yoGnGvFhypQ5PyRJUXFCPK7llw2F8XmGuSmqvkw=; b=GnJUx3CcodTJTPNZW39kxJ1c2mCLstH08NXYnwvttOj3U3q/j/7wC/a2 pM2czrF1YTVYgFdFayNzRHeLgfoDpXPteNr2eUXrzK3dnpWFieSlnb1ux QNWRRTIo/8WFPeQ0+OQ9haysFOHyci79BVYddr7Jajwb1SbP6UEW76Oq8 y4WP3zSJFCK7lRDPMNi1KPeN5d4yOlvhtC2bxEdVV+JzuESA58cmR5ALW muGnNUR0R4rWE5Z/Yf7eiAuGwmbFB/vxVBKNJrkfFpGT0cy/nNYy5NIdL 3aZA7GD0BMBdPJyqKAj2EU7wMeJYrEbhVQUaGmyKVuSwaylLTtRTU+tPV g==; X-CSE-ConnectionGUID: asD+3Yh/RwSIE9y8Yd8/IA== X-CSE-MsgGUID: S07uPtFwSvmtMdcAJfcyBg== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957243" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957243" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2024 08:58:07 -0700 X-CSE-ConnectionGUID: 2sUuxskQQwuC1pJck0EGog== X-CSE-MsgGUID: bnMx7RZVTzOzWa+hp55oXg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="71250790" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 23 Sep 2024 08:58:04 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 23 Sep 2024 18:58:03 +0300 From: Ville Syrjala To: linux-fbdev@vger.kernel.org Cc: Helge Deller , Simona Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 4/6] fbcon: fbcon_is_inactive() -> fbcon_is_active() Date: Mon, 23 Sep 2024 18:57:47 +0300 Message-ID: <20240923155749.30846-5-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240923155749.30846-1-ville.syrjala@linux.intel.com> References: <20240923155749.30846-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Invert fbcon_is_inactive() into fbcon_is_active(). Much easier on the poor brain when you don't have to do dobule negations all over the place. Signed-off-by: Ville Syrjälä Acked-by: Helge Deller --- drivers/video/fbdev/core/fbcon.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index eb30aa872371..2a78cca3e9de 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -281,12 +281,12 @@ static bool fbcon_skip_panic(struct fb_info *info) #endif } -static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) +static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info) { struct fbcon_ops *ops = info->fbcon_par; - return (info->state != FBINFO_STATE_RUNNING || - vc->vc_mode != KD_TEXT || ops->graphics || fbcon_skip_panic(info)); + return info->state == FBINFO_STATE_RUNNING && + vc->vc_mode == KD_TEXT && !ops->graphics && !fbcon_skip_panic(info); } static int get_color(struct vc_data *vc, struct fb_info *info, @@ -1253,7 +1253,7 @@ static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, struct fbcon_display *p = &fb_display[vc->vc_num]; u_int y_break; - if (fbcon_is_inactive(vc, info)) + if (!fbcon_is_active(vc, info)) return; if (!height || !width) @@ -1295,7 +1295,7 @@ static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count, struct fbcon_display *p = &fb_display[vc->vc_num]; struct fbcon_ops *ops = info->fbcon_par; - if (!fbcon_is_inactive(vc, info)) + if (fbcon_is_active(vc, info)) ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, get_color(vc, info, scr_readw(s), 1), get_color(vc, info, scr_readw(s), 0)); @@ -1306,7 +1306,7 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) struct fb_info *info = fbcon_info_from_console(vc->vc_num); struct fbcon_ops *ops = info->fbcon_par; - if (!fbcon_is_inactive(vc, info)) + if (fbcon_is_active(vc, info)) ops->clear_margins(vc, info, margin_color, bottom_only); } @@ -1318,7 +1318,7 @@ static void fbcon_cursor(struct vc_data *vc, bool enable) ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); - if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) + if (!fbcon_is_active(vc, info) || vc->vc_deccm != 1) return; if (vc->vc_cursor_type & CUR_SW) @@ -1724,7 +1724,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, struct fb_info *info = fbcon_info_from_console(vc->vc_num); struct fbcon_display *p = &fb_display[vc->vc_num]; - if (fbcon_is_inactive(vc, info)) + if (!fbcon_is_active(vc, info)) return; if (!width || !height) @@ -1748,7 +1748,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, struct fbcon_display *p = &fb_display[vc->vc_num]; int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK; - if (fbcon_is_inactive(vc, info)) + if (!fbcon_is_active(vc, info)) return true; fbcon_cursor(vc, false); @@ -2132,7 +2132,7 @@ static bool fbcon_switch(struct vc_data *vc) fbcon_del_cursor_work(old_info); } - if (fbcon_is_inactive(vc, info) || + if (!fbcon_is_active(vc, info) || ops->blank_state != FB_BLANK_UNBLANK) fbcon_del_cursor_work(info); else @@ -2172,7 +2172,7 @@ static bool fbcon_switch(struct vc_data *vc) scrollback_max = 0; scrollback_current = 0; - if (!fbcon_is_inactive(vc, info)) { + if (fbcon_is_active(vc, info)) { ops->var.xoffset = ops->var.yoffset = p->yscroll = 0; ops->update_start(info); } @@ -2228,7 +2228,7 @@ static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank, } } - if (!fbcon_is_inactive(vc, info)) { + if (fbcon_is_active(vc, info)) { if (ops->blank_state != blank) { ops->blank_state = blank; fbcon_cursor(vc, !blank); @@ -2242,7 +2242,7 @@ static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank, update_screen(vc); } - if (mode_switch || fbcon_is_inactive(vc, info) || + if (mode_switch || !fbcon_is_active(vc, info) || ops->blank_state != FB_BLANK_UNBLANK) fbcon_del_cursor_work(info); else @@ -2572,7 +2572,7 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) int i, j, k, depth; u8 val; - if (fbcon_is_inactive(vc, info)) + if (!fbcon_is_active(vc, info)) return; if (!con_is_visible(vc)) @@ -2672,7 +2672,7 @@ static void fbcon_modechanged(struct fb_info *info) scrollback_max = 0; scrollback_current = 0; - if (!fbcon_is_inactive(vc, info)) { + if (fbcon_is_active(vc, info)) { ops->var.xoffset = ops->var.yoffset = p->yscroll = 0; ops->update_start(info); } From patchwork Mon Sep 23 15:57:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13809808 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FD55CF9C77 for ; Mon, 23 Sep 2024 15:58:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8984F10E422; Mon, 23 Sep 2024 15:58:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="a8g+2S3M"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id E7EBD10E422 for ; Mon, 23 Sep 2024 15:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727107091; x=1758643091; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ioMlxfqrEyEKt60+tus+rcbN4bz1k4k6ASpLmIUzo3M=; b=a8g+2S3MWNpQmLPNfUaGrHzjugyWPuC+ty7wUltJHte8JqisbIBr+QDA H0UFROLwLlVhM0MOVLku2wtIJfJOhkpNyyEmHEx9uaAARPDykQ2WtQx7a JOVYw8XSdfLXxAcG+eW1kpZfB3Sw41pNgwlIxoLClEaKtjV+gK5/gks9g Vxpv5AEsLsbrC7x9Pub0Z3tWXtpF7ngQZECGyuNIS5Mxq3tGQa3vbbyB3 fJmv7STs8+r+dhmzq3DccVy+tffalMEsGoag+PgjnNdOzi/8U0BL6sNkj dsrKCgCspE+mvAQcVHDQBexXFeZnDwX/wtJ73BQ7oVr2W1p22R9PstvJW g==; X-CSE-ConnectionGUID: Vx/sz0w1ShmTVCU6xY8wFw== X-CSE-MsgGUID: plZ1+fnHSpmaH0syM7yzww== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957250" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957250" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2024 08:58:10 -0700 X-CSE-ConnectionGUID: e2PE3l61Rm6FavEXs0dpCQ== X-CSE-MsgGUID: 7Y3lK0UMSkiai1r3QFe/Dw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="71250798" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 23 Sep 2024 08:58:08 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 23 Sep 2024 18:58:07 +0300 From: Ville Syrjala To: linux-fbdev@vger.kernel.org Cc: Helge Deller , Simona Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 5/6] fbcon: Introduce get_{fg,bg}_color() Date: Mon, 23 Sep 2024 18:57:48 +0300 Message-ID: <20240923155749.30846-6-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240923155749.30846-1-ville.syrjala@linux.intel.com> References: <20240923155749.30846-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Make the code more legible by adding get_{fg,bg}_color() which hide the obscure 'is_fg' parameter of get_color() from the caller. Signed-off-by: Ville Syrjälä Acked-by: Helge Deller --- drivers/video/fbdev/core/fbcon.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 2a78cca3e9de..17540cdf1edf 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -356,6 +356,16 @@ static int get_color(struct vc_data *vc, struct fb_info *info, return color; } +static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c) +{ + return get_color(vc, info, c, 1); +} + +static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c) +{ + return get_color(vc, info, c, 0); +} + static void fb_flashcursor(struct work_struct *work) { struct fbcon_ops *ops = container_of(work, struct fbcon_ops, cursor_work.work); @@ -387,8 +397,9 @@ static void fb_flashcursor(struct work_struct *work) c = scr_readw((u16 *) vc->vc_pos); enable = ops->cursor_flash && !ops->cursor_state.enable; - ops->cursor(vc, info, enable, get_color(vc, info, c, 1), - get_color(vc, info, c, 0)); + ops->cursor(vc, info, enable, + get_fg_color(vc, info, c), + get_bg_color(vc, info, c)); console_unlock(); queue_delayed_work(system_power_efficient_wq, &ops->cursor_work, @@ -1297,8 +1308,8 @@ static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count, if (fbcon_is_active(vc, info)) ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, - get_color(vc, info, scr_readw(s), 1), - get_color(vc, info, scr_readw(s), 0)); + get_fg_color(vc, info, scr_readw(s)), + get_bg_color(vc, info, scr_readw(s))); } static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) @@ -1331,8 +1342,9 @@ static void fbcon_cursor(struct vc_data *vc, bool enable) if (!ops->cursor) return; - ops->cursor(vc, info, enable, get_color(vc, info, c, 1), - get_color(vc, info, c, 0)); + ops->cursor(vc, info, enable, + get_fg_color(vc, info, c), + get_bg_color(vc, info, c)); } static int scrollback_phys_max = 0; From patchwork Mon Sep 23 15:57:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13809809 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E60CECF9C6F for ; Mon, 23 Sep 2024 15:58:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7829010E421; Mon, 23 Sep 2024 15:58:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Nj9kgCV1"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F5EA10E421 for ; Mon, 23 Sep 2024 15:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727107094; x=1758643094; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jQhqhShi45bE3F1tqDpD2eTLJXTwjUT+li1G1Ev3zCQ=; b=Nj9kgCV10esHZFUEBTcYk6N6mE/TGmClNceGkB7FFEayFB8YJ246zxKd BvjjZVIfB/iFfuLcK7/Yhb704CplbWLvzJK9CmKnNG6yJIqs3FZdG0K7S N8ZaoR9UJVd5oeNlTSr/+omu+RkoIDWGlP8mxrgHqMEWzN49tFjEBjgV0 0ZyYtKQB8Dkes74hZRewUqdPHophsFUddOxxUyyMScDTU13j215sufGc2 sRId4JHzn/iI9Ew2LrfPhkzJ92u3Tt7wW6l8mGLNwVEcHexSTJawE2kft 3s4kOeAsvPLIhyq/P9+g0EWmDZcO7liSMLuMsA1FIGFMNCATuuiQsOq2W Q==; X-CSE-ConnectionGUID: iV1BlwqhSJKQ8tt8QQSXyg== X-CSE-MsgGUID: CWqrbaXvTkO/qrybTpOw+w== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957255" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957255" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2024 08:58:14 -0700 X-CSE-ConnectionGUID: Xp0mMn6aTJmrS1RKIK2Sfw== X-CSE-MsgGUID: iLkUdrEDSV6NVfy+IynrUQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="71250804" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 23 Sep 2024 08:58:11 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 23 Sep 2024 18:58:10 +0300 From: Ville Syrjala To: linux-fbdev@vger.kernel.org Cc: Helge Deller , Simona Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 6/6] fbcon: Use 'bool' where appopriate Date: Mon, 23 Sep 2024 18:57:49 +0300 Message-ID: <20240923155749.30846-7-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240923155749.30846-1-ville.syrjala@linux.intel.com> References: <20240923155749.30846-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Use 'bool' type where it makes more sense than 'int'. Signed-off-by: Ville Syrjälä Acked-by: Helge Deller --- drivers/video/fbdev/core/fbcon.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 17540cdf1edf..03d48e665bba 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -129,9 +129,9 @@ static int logo_shown = FBCON_LOGO_CANSHOW; /* console mappings */ static unsigned int first_fb_vc; static unsigned int last_fb_vc = MAX_NR_CONSOLES - 1; -static int fbcon_is_default = 1; +static bool fbcon_is_default = true; static int primary_device = -1; -static int fbcon_has_console_bind; +static bool fbcon_has_console_bind; #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY static int map_override; @@ -166,7 +166,7 @@ static const struct consw fb_con; #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row) -static int fbcon_cursor_blink; +static bool fbcon_cursor_blink; #define divides(a, b) ((!(a) || (b)%(a)) ? 0 : 1) @@ -281,7 +281,7 @@ static bool fbcon_skip_panic(struct fb_info *info) #endif } -static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info) +static inline bool fbcon_is_active(struct vc_data *vc, struct fb_info *info) { struct fbcon_ops *ops = info->fbcon_par; @@ -290,7 +290,7 @@ static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info) } static int get_color(struct vc_data *vc, struct fb_info *info, - u16 c, int is_fg) + u16 c, bool is_fg) { int depth = fb_get_color_depth(&info->var, &info->fix); int color = 0; @@ -358,12 +358,12 @@ static int get_color(struct vc_data *vc, struct fb_info *info, static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c) { - return get_color(vc, info, c, 1); + return get_color(vc, info, c, true); } static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c) { - return get_color(vc, info, c, 0); + return get_color(vc, info, c, false); } static void fb_flashcursor(struct work_struct *work) @@ -467,7 +467,7 @@ static int __init fb_console_setup(char *this_opt) last_fb_vc = simple_strtoul(options, &options, 10) - 1; if (last_fb_vc < first_fb_vc || last_fb_vc >= MAX_NR_CONSOLES) last_fb_vc = MAX_NR_CONSOLES - 1; - fbcon_is_default = 0; + fbcon_is_default = false; continue; } @@ -558,7 +558,7 @@ static int do_fbcon_takeover(int show_logo) con2fb_map[i] = -1; info_idx = -1; } else { - fbcon_has_console_bind = 1; + fbcon_has_console_bind = true; } return err; @@ -2802,7 +2802,7 @@ static void fbcon_unbind(void) fbcon_is_default); if (!ret) - fbcon_has_console_bind = 0; + fbcon_has_console_bind = false; } #else static inline void fbcon_unbind(void) {} @@ -3234,8 +3234,9 @@ static ssize_t cursor_blink_store(struct device *device, const char *buf, size_t count) { struct fb_info *info; - int blink, idx; char **last = NULL; + bool blink; + int idx; blink = simple_strtoul(buf, last, 0);