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: 13809797 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E60E219CC1E for ; Mon, 23 Sep 2024 15:57:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107078; cv=none; b=Al67dN1YpFZ2EFeGpdA2LB7h/sMIk7dTK2O2jjwQcqZZFGodm6vUURQjAFRiXFprjHXAKMrH5Q8t0C5vesGntJTHo+q0ln/6WJvxnMvHlqUx7w7chdrGACmnZqpae2XtxaSnW2HZtExIZOQNnrueP+Wtva2YWOtSBdX1gnPZMWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107078; c=relaxed/simple; bh=ChCCXGNH1zxxn2L3QK91w02IPOcPOTRwh6I5wvNjZj4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bInyKsd9cta6fVyO3m5891LRqSOINCRkhFrP/cA4D0Be66SLSHXUu75ThYzn16+k9awzPs0unr9277Ry/mgsHPO4EMoDxnxlXGCpTbZHj2cwrL4C5vMRLCia0opKZ0+QyeVkj7RIKIVgVRKZ3Z5//oXp8CkDCV70CHubMWALgMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=a07yZR44; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="a07yZR44" 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: VwZTe8v9QiOgnYSaPnEXaA== X-CSE-MsgGUID: w3go4IBuRAeWkHVEEfUdpA== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957218" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957218" 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> Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13809798 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E12919CC1E for ; Mon, 23 Sep 2024 15:58:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107081; cv=none; b=T4020yAyfNKU0MDmwh0kFSKn/xHJeHe8WusT8PInAC7vI8qZ2QSVdegYzzeKSSUzChWDQJ9odMFDfNdg1tSqmgI78NqXsEfC4I6UwU+yc8wxxlijHAbuR8L3xyzbQ7QH9D6fshMslt2N5muRP1bIAybsZqTbyN2nZZUTqmSH1FA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107081; c=relaxed/simple; bh=O3g3L/+sKtCko1xwkExrYw48dPoMuF/ASAUzm/24awE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TEkfsDvyDGIgl0r0Kfn8PZZuVCeHpsCl55OcXS6Bu38+WZ0FrHSMkjQlO2dS0bywiGENivjjCxFVK1P+ywf7lEOjiuAPgNfbQ9UdddJgl+RQbVheg1Y/ZB6UxrD3C1mU4BO2qhWjI03OwWXxh4RTJjcPOMB5Xmam72PaNAQE4fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dzy2FtBO; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dzy2FtBO" 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: ylRZeBHhRgeSiKQ8KKlc6Q== X-CSE-MsgGUID: n7Sax7N1Q3ua7cksDQRXfQ== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957223" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957223" 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> Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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ä Reviewed-by: Thomas Zimmermann --- 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: 13809799 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB2DF199EB4 for ; Mon, 23 Sep 2024 15:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107085; cv=none; b=pP9aeKjEG0t5ijIVJtrcQMfLVOLjJv1NZfdN9HZy39OkJY1U3KutflZrclQJLB88OWMSPHweQjggApe7jjgoxrPSvEs+6L/xOtcLXF8MJnHprER8d+KUQGLJCC6g3aYacnH8rDR+5YUXBaqxdzGDEwuffK8WSoYunWfoUWt24Zc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107085; c=relaxed/simple; bh=W5gtcbCYp4vJg4Flsqj3JabmZDfdkYxI+vhYsmZg/pU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Lvivjj00StvL38ROoJbllxBQkDLPr8sdOngLbYk5CZYAIflLiiRWJcJ5NUw2c+QPRLvWolec6gSevKxBEDtpIiVxy8wqvGNiuvLbuHlTD3hcN9xDH3qT9fY3b2HyoybgtuGRwM8DYalNN4k7/toE+SkC186VbJJlzSbt4Dk1QSg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bTwIBCXQ; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bTwIBCXQ" 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: eJxHZbTtR3Ch7OONlcPJKQ== X-CSE-MsgGUID: cqqW5A1TTNWwMyHmsBKEAQ== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957233" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957233" 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> Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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ä Reviewed-by: Thomas Zimmermann --- 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: 13809800 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39F5C19CC0D for ; Mon, 23 Sep 2024 15:58:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107089; cv=none; b=JKvqMQrzwpTQlvS+QPMuoNgKiIDpn7UJj98r9s/MUj5Ob+HJMKnQQ1E27ZSPDN40RLpfq/yzBjfM0F91uDzfFnmBsZQ1+COqOog1LQ4/Azi+VwDKGUPK74EY+eOQDqhZsP2ABLtl8kE6FCfnbnDb0Xc7wC75QVKTkCfol0tbS74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107089; c=relaxed/simple; bh=Dhz4yoGnGvFhypQ5PyRJUXFCPK7llw2F8XmGuSmqvkw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=svjVP/p89V25hY9qu4/9ASJ2MSC6sA3qnrjNUdjUUIBQUGFskXvz/gO62NsU/KoKjIrGg272YzqN4C0OiwESnC63BOPhTIjX6dxG40PgN75C3FeDD28eaQvsAZlPr6w8d6ALCjiNfL+TFJ04tXiu5iWDmza/24d7RAmMEFTtIP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GnJUx3Cc; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GnJUx3Cc" 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: 3+xADbghSpyKPPwN311IIQ== X-CSE-MsgGUID: 17U91C0OTqi2AxcPad65WQ== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957241" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957241" 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> Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Thomas Zimmermann --- 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: 13809801 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA37619E98D for ; Mon, 23 Sep 2024 15:58:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107092; cv=none; b=mVyEid4goVsawZdLjIa5MqnkH+2sjPHdVZGbCi2yVHZZLcKdaL5B/amDA6QE/TrVeycGL3eXSJoPqf3lYcrXqJFFZbctqyno9LC0hpj7E2khIUNH8PAr7BAEuhQw1zT6b/PfPtb1/wIO01xCJRlRGGv/LyVwLpXfZeDBft7lnSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107092; c=relaxed/simple; bh=ioMlxfqrEyEKt60+tus+rcbN4bz1k4k6ASpLmIUzo3M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y+u+S7V3kEf39SKYK+EH+3QvG30DV86iV2yRp3sAep5bjQB9+w+WJevb/mGfREOJr/Y7c8ObUAX3PxfprYeOq7lNhLI41/hA2rBzqJ+hFf84lTQQGNZm2oPZSFqVjQnkzVC5Z6m0gSB1YmoCGpxdE0qpHBwBiKCtAZ1Q6gGjZDo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=a8g+2S3M; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="a8g+2S3M" 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: WpwOd2swTaiboyMvHQ9mdw== X-CSE-MsgGUID: IjT7poGYSzmpXeR2vTffJw== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957248" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957248" 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> Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Thomas Zimmermann --- 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: 13809802 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0C1C19E965 for ; Mon, 23 Sep 2024 15:58:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107095; cv=none; b=UBBnVa231W+wXsPNIomDAUkR92CNISLG1wn969UKzPY8BQsFF69R8zgHfVJFgBWZtk1Yxi2M07Q/2MXb7fToHbn8ly9QlvevLFtiZiUPp7lZAFU00nDkilySoJNpE8pBViKJBBbBbmDuZYONNwV/7UXU1JzmDKtC2/ANvewIVcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727107095; c=relaxed/simple; bh=jQhqhShi45bE3F1tqDpD2eTLJXTwjUT+li1G1Ev3zCQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P5Ol6KwrJ2dPAJsExe+pMzA2yIhqg6oSM5orp8HIMDJeTGCFXGnQ9R6kD9DTlfMAquEuaX1wTWjrotpYTIsMAokxgit1/qY5YOB/2cID3f9v8QLrJwUl5u0qmtfQi016TrN8ChqHbEiu/vI9Z/A/NdwxPG6cjfWiisw939kMdSE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Nj9kgCV1; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Nj9kgCV1" 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: gyp10/z8SUycEaqeZx0k5g== X-CSE-MsgGUID: XjTPlsy3R6CUIAeeOMb6IQ== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="28957253" X-IronPort-AV: E=Sophos;i="6.10,251,1719903600"; d="scan'208";a="28957253" 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> Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Ville Syrjälä Use 'bool' type where it makes more sense than 'int'. Signed-off-by: Ville Syrjälä Acked-by: Helge Deller Reviewed-by: Thomas Zimmermann --- 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);