Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp255437rdb; Mon, 22 Jan 2024 03:14:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQ4FK+hszW6/vRqYNpJES1lsNVQ1ugu6RUbw2S3ekEuPjMBuDX2gBa2WZ/lZCCr8mwwa7F X-Received: by 2002:a17:906:fe02:b0:a2d:5256:1df with SMTP id wy2-20020a170906fe0200b00a2d525601dfmr2522859ejb.24.1705922092852; Mon, 22 Jan 2024 03:14:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705922092; cv=pass; d=google.com; s=arc-20160816; b=Sb9lRBpJ+c6jkdpCgk3JUIbjXX3cO0gOuH+Ovnw8eTR/CIbFPq8ACEboqCE8q1AbjV tozIiws9THxgre7VzWi8vhaDPwKxjZQbYOoXRoAnpOfrqNJ5mo/eo5SRfeHNU7uJz+Nd ZNj+K08AEEfLIBV5euw1WKrS8NiZ25E5L02iOl66hO9e42IRxZYjCi34fk7NUVaMAMDg yu1H0oBGqv/bq0ow1Y3JrnkZgRrecZ1TpiGEk2Lhw34Rv3F7WbTcgB7mT/Vx8uBOoSxP hP0Rtey/kZiJML3V6UZ75R2PFVG0wKzSEvTH4oyuTBGJhLO0oay45mCMXd9xMBDFBW5b X6jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YGNPnOF4rcbQHk/VDCknkmHIza9GKf7rhk0l91NJAFI=; fh=cQOMYobONKxFdlosEW8c9IBBsR5VQyuD7Pr/2ffdaP4=; b=V+jwsh8+MIwo8ZJZCGuurqFmP+mV3uqdAkdwFVD8qQzcK/LWrub5U/4waRsZm+AN4s h5zhrQEgYgq4jjuzrVBEuCv08rjK7+IdefvlU0UNgJQxCx3/brjldKcR5NgbeFfXoeOA W3O9r2zE6tBiGqVBjSQdLOgqVU6FeReB8Xo03psj0uDVd0ccykw7IPQUfd7R4wvBHx42 Lg0/N9/bohtPfGlAQ3bLLezv48HQLPcrFBNYcMCDC+4KlA0eDLLySRTNzN64Z9d+DDRh 7Iv6sDCNMDs246C0pXDTKnI5zTQ12+6wXYGng1xejzLhjkQ33hlOw80NeL7GNAchRzn8 JrbQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Iw3O6aWP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p24-20020a1709060e9800b00a286018179fsi9957697ejf.222.2024.01.22.03.14.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:14:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Iw3O6aWP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 772D91F23672 for ; Mon, 22 Jan 2024 11:14:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B9EE3B29A; Mon, 22 Jan 2024 11:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Iw3O6aWP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A1D1941742; Mon, 22 Jan 2024 11:05:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705921501; cv=none; b=p95+SFrUwXOhK35E6GJ4Sy2LI+TpRKyIl6qWFw1W42xrLQTnxSKrGUVeZGboAxEJRzxI3oIWXB1pCJpmG/LNvtQzOIZVbZRCYn0Tv+fZtgQNwTJLKKHn8ZADy7/aJe40sNCQTQZmWnBL4lQPkdjDKyzpWsNX+pQfDQplpcRLzI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705921501; c=relaxed/simple; bh=6xvbnww7JlLBYTWi11QyGdS/O6ZiCkP8ssfXGVVStMk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZWyEasNFK1d/G1nRfIr9y0SKTLmkwOybwbqmaWHZD83+/qjuKWcy4hF2WuP8pLD3UCp7hySx1UI2lZLghzaqo5GegxKfy4xppb0u+MbPNKer8lWVY66Fo+g3znY6nOvDkWOiUm42xOuFTJpG2BBs5EF/mkI3fvaPzVi3oYsduf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Iw3O6aWP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 441FCC433C7; Mon, 22 Jan 2024 11:04:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705921501; bh=6xvbnww7JlLBYTWi11QyGdS/O6ZiCkP8ssfXGVVStMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iw3O6aWPvhy9GIEKKDrzmNgcJj/uA8/+BQWIb9xQ9NDjnOUO2iEgpgfNt+JbbBWAL 7fgFxiB/NCes1NiW5GNZJwdy8wCXTcvuWfuRLJ28EF8D/uBeoJOv8jlfEFeLb70AtZ MTBet8I4ji4zv01H/aRKE8BMyJMzLOW/r+ObiklW4+N+VdTmB+DWdjPwiAzpF9Ep3G HgYeA4RbVsdKMz4o3op6pEDyxJhkU+dayQ4ZTheeb138j9D5Y1Es+eF4R2/K8crdzN 1VZIeanuz28tEuUGtMkLDj0Xna2EaTpUgZmyN7IpWQU3I19sF+p6tjffa+y+tGJREm fP0WH2ZIpHYZQ== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Daniel Vetter , Helge Deller , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 28/47] fbdev/core: simplify cursor_state setting in fbcon_ops::cursor() Date: Mon, 22 Jan 2024 12:03:42 +0100 Message-ID: <20240122110401.7289-29-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122110401.7289-1-jirislaby@kernel.org> References: <20240122110401.7289-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There is a switch decicing if cursor should be drawn or not. The whole switch can be simplified to one line. Do this cleanup as a preparatory work for the next patch. There, all the CM_* constants are removed. Signed-off-by: Jiri Slaby (SUSE) Cc: Daniel Vetter Cc: Helge Deller Cc: linux-fbdev@vger.kernel.org Cc: dri-devel@lists.freedesktop.org --- drivers/video/fbdev/core/bitblit.c | 11 +---------- drivers/video/fbdev/core/fbcon_ccw.c | 11 +---------- drivers/video/fbdev/core/fbcon_cw.c | 11 +---------- drivers/video/fbdev/core/fbcon_ud.c | 11 +---------- 4 files changed, 4 insertions(+), 40 deletions(-) diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c index 8587c9da0670..daff152f4c22 100644 --- a/drivers/video/fbdev/core/bitblit.c +++ b/drivers/video/fbdev/core/bitblit.c @@ -348,16 +348,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, mask[i++] = msk; } - switch (mode) { - case CM_ERASE: - ops->cursor_state.enable = 0; - break; - case CM_DRAW: - case CM_MOVE: - default: - ops->cursor_state.enable = (use_sw) ? 0 : 1; - break; - } + ops->cursor_state.enable = (mode != CM_ERASE) && !use_sw; cursor.image.data = src; cursor.image.fg_color = ops->cursor_state.image.fg_color; diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c index 2789ace79634..889423d580bc 100644 --- a/drivers/video/fbdev/core/fbcon_ccw.c +++ b/drivers/video/fbdev/core/fbcon_ccw.c @@ -349,16 +349,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, kfree(tmp); } - switch (mode) { - case CM_ERASE: - ops->cursor_state.enable = 0; - break; - case CM_DRAW: - case CM_MOVE: - default: - ops->cursor_state.enable = (use_sw) ? 0 : 1; - break; - } + ops->cursor_state.enable = (mode != CM_ERASE) && !use_sw; cursor.image.data = src; cursor.image.fg_color = ops->cursor_state.image.fg_color; diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c index 86a254c1b2b7..a306ca5802e8 100644 --- a/drivers/video/fbdev/core/fbcon_cw.c +++ b/drivers/video/fbdev/core/fbcon_cw.c @@ -332,16 +332,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, kfree(tmp); } - switch (mode) { - case CM_ERASE: - ops->cursor_state.enable = 0; - break; - case CM_DRAW: - case CM_MOVE: - default: - ops->cursor_state.enable = (use_sw) ? 0 : 1; - break; - } + ops->cursor_state.enable = (mode != CM_ERASE) && !use_sw; cursor.image.data = src; cursor.image.fg_color = ops->cursor_state.image.fg_color; diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c index 23bc045769d0..f6fc458b46c7 100644 --- a/drivers/video/fbdev/core/fbcon_ud.c +++ b/drivers/video/fbdev/core/fbcon_ud.c @@ -372,16 +372,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode, mask[i++] = ~msk; } - switch (mode) { - case CM_ERASE: - ops->cursor_state.enable = 0; - break; - case CM_DRAW: - case CM_MOVE: - default: - ops->cursor_state.enable = (use_sw) ? 0 : 1; - break; - } + ops->cursor_state.enable = (mode != CM_ERASE) && !use_sw; cursor.image.data = src; cursor.image.fg_color = ops->cursor_state.image.fg_color; -- 2.43.0