Received: by 2002:a19:ef0c:0:0:0:0:0 with SMTP id n12csp952163lfh; Tue, 1 Feb 2022 12:56:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyENmCLD8iW+KwvA2wdhPhotTROFT9my20MCIKSq+sIlUfDeLpvgdIcPb0f8wZLBsQ3rOwo X-Received: by 2002:a63:216:: with SMTP id 22mr22297090pgc.89.1643748611933; Tue, 01 Feb 2022 12:50:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748611; cv=none; d=google.com; s=arc-20160816; b=obpUoUFS2u+ungKtU/oEfT0QtA6QVh5B1m+CUJoebMW0BTSRIELH8Xij9GK7CwzN+p iPlKmL7MChMQM0wcflGlIXk2/0e/EO9oUWLpfgyUrKpIylEp7MTVy0jSdhphdx9iGT5x erGqrgyoPPuikgpwAyaw3XYESLh+LOG31olMbcXvhrEaDWMHhTlMtkdXUlkvrKfpPiFC dD72gZf8CWAfDuVNe7L5SoovMCxYTZ7E/tERHBoalEvwpOdSFrqOZJQRiSiNVCtMwJVY GxDo1YkVoErAKSJ9tn6PJKuZuGp3pNFrYCKFn26PNVqgK+Fw0Rs7kD9yHWp6EkpjkCi/ Un1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NgnSdd2AvfoeNcByN2bDHp+PhpIRGYatmO8U9PanFuc=; b=GUZylVYI69/cF8087UMEqSUSpKBrjB8NYdDKfiFirwwYJuXemuP8VQnrRmtXpNePxw xRsKw/5EBYki65PF9w9JdYAD9wsNOknxzV6MHukJ2CIeN3B0/2SEKmbpxhJ+HNI6J+Xm xzBKqaQGzd6Jy65xgC4tAVttQzRXmK97/CmpcWOVZ8ykD0OEnp5zY2B5UhcFg/3uNBBo PL6W6jTCGqsEaPXytZIDzGTr8YTzVQlCaVWjr0NM8qcEz97pRDzaJ2t2yvjdI12Z0V1y IYNBl34/czCkY2/AF6Gzf94MpiUZeuOmW8Qor2dpj5ZeBtRAIDJyToE1mpADibRtfrxK ZyZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=S+8VBUNN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml7si3252619pjb.127.2022.02.01.12.50.00; Tue, 01 Feb 2022 12:50:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=S+8VBUNN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351148AbiAaVIZ (ORCPT + 99 others); Mon, 31 Jan 2022 16:08:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379939AbiAaVGv (ORCPT ); Mon, 31 Jan 2022 16:06:51 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AA76C061768 for ; Mon, 31 Jan 2022 13:06:48 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id m14so27680319wrg.12 for ; Mon, 31 Jan 2022 13:06:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NgnSdd2AvfoeNcByN2bDHp+PhpIRGYatmO8U9PanFuc=; b=S+8VBUNNneiGc1+bGPSnrLBcbuVFkgKSU1F9WHEKGEhoPtQNo9kYEWH32/VdEJ10IN +9JFlSujzOM4Bw11VzRyD+o6Ay/zYtaJDCVsEreNhW23/UsII4y11JSGXkMSZ5oO87vf awGxIE+pHd6B7RDP848NhmOIATd3HdslcGwVw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NgnSdd2AvfoeNcByN2bDHp+PhpIRGYatmO8U9PanFuc=; b=KfpmYCXKVEVAndJDWu269kM4yvq8fCERijkRz/7F5wtSGf211Mfhm+cwc/Ob69F0rf kg1RvofCZdlWMQJxOXVgTL0hrtj8ohKnf5N17KLUPL25L3bA15nGwNMLbQOCeOd5yh7S S/hXALEk4HqmGX7Yb3mOHZSJjsk5jpgLAqExmyrERTwIuNQbXaW/yaRVpemPbUEVqwxD 8subAJYzVv0a1HE/0WxJiaDgF6hNivUMfQHcjzDQW9Pr4U3Bgdw81WQ7YKaMNpCiH7CS h48pC740qKsWSUo8f0qRCbXgFupw8Q5/nc7wt2CZlmm8Em/a1PZaw4YymCqN457R+t85 BU8Q== X-Gm-Message-State: AOAM530WUumfE/g1ElZBcWwM9RCokBaxblqNIZcxMIX63UT6sr5DoIu6 39EXahxkSFtp6N7Vwrd3bLFraA== X-Received: by 2002:a5d:4b4d:: with SMTP id w13mr19360147wrs.640.1643663206862; Mon, 31 Jan 2022 13:06:46 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b11sm314961wmq.46.2022.01.31.13.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 13:06:46 -0800 (PST) From: Daniel Vetter To: DRI Development Cc: Intel Graphics Development , linux-fbdev@vger.kernel.org, LKML , Daniel Vetter , Daniel Vetter , Daniel Vetter , Greg Kroah-Hartman , Tetsuo Handa , Thomas Zimmermann , Claudio Suarez , Du Cheng Subject: [PATCH 13/21] fbcon: move more common code into fb_open() Date: Mon, 31 Jan 2022 22:05:44 +0100 Message-Id: <20220131210552.482606-14-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220131210552.482606-1-daniel.vetter@ffwll.ch> References: <20220131210552.482606-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No idea why con2fb_acquire_newinfo() initializes much less than fbcon_startup(), but so be it. From a quick look most of the un-initialized stuff should be fairly harmless, but who knows. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Tetsuo Handa Cc: Thomas Zimmermann Cc: Claudio Suarez Cc: Du Cheng --- drivers/video/fbdev/core/fbcon.c | 74 +++++++++++++------------------- 1 file changed, 31 insertions(+), 43 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index b83a5a77d8a8..5a3391ff038d 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -680,8 +680,18 @@ static int fbcon_invalid_charcount(struct fb_info *info, unsigned charcount) #endif /* CONFIG_MISC_TILEBLITTING */ +static void fbcon_release(struct fb_info *info) +{ + if (info->fbops->fb_release) + info->fbops->fb_release(info, 0); + + module_put(info->fbops->owner); +} + static int fbcon_open(struct fb_info *info) { + struct fbcon_ops *ops; + if (!try_module_get(info->fbops->owner)) return -ENODEV; @@ -691,19 +701,22 @@ static int fbcon_open(struct fb_info *info) return -ENODEV; } - return 0; -} + ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL); + if (!ops) { + fbcon_release(info); + return -ENOMEM; + } -static void fbcon_release(struct fb_info *info) -{ - if (info->fbops->fb_release) - info->fbops->fb_release(info, 0); + INIT_DELAYED_WORK(&ops->cursor_work, fb_flashcursor); + ops->info = info; + info->fbcon_par = ops; + ops->cur_blink_jiffies = HZ / 5; - module_put(info->fbops->owner); + return 0; } static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, - int unit, int oldidx) + int unit) { struct fbcon_ops *ops = NULL; int err; @@ -712,27 +725,10 @@ static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, if (err) return err; - if (!err) { - ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL); - if (!ops) - err = -ENOMEM; - - INIT_DELAYED_WORK(&ops->cursor_work, fb_flashcursor); - } - - if (!err) { - ops->cur_blink_jiffies = HZ / 5; - ops->info = info; - info->fbcon_par = ops; - - if (vc) - set_blitting_type(vc, info); - } + ops = info->fbcon_par; - if (err) { - con2fb_map[unit] = oldidx; - fbcon_release(info); - } + if (vc) + set_blitting_type(vc, info); return err; } @@ -840,9 +836,11 @@ static int set_con2fb_map(int unit, int newidx, int user) found = search_fb_in_map(newidx); - con2fb_map[unit] = newidx; - if (!err && !found) - err = con2fb_acquire_newinfo(vc, info, unit, oldidx); + if (!err && !found) { + err = con2fb_acquire_newinfo(vc, info, unit); + if (!err) + con2fb_map[unit] = newidx; + } /* * If old fb is not mapped to any of the consoles, @@ -939,20 +937,10 @@ static const char *fbcon_startup(void) if (fbcon_open(info)) return NULL; - ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL); - if (!ops) { - fbcon_release(info); - return NULL; - } - - INIT_DELAYED_WORK(&ops->cursor_work, fb_flashcursor); - + ops = info->fbcon_par; ops->currcon = -1; ops->graphics = 1; ops->cur_rotate = -1; - ops->cur_blink_jiffies = HZ / 5; - ops->info = info; - info->fbcon_par = ops; p->con_rotate = initial_rotation; if (p->con_rotate == -1) @@ -1022,7 +1010,7 @@ static void fbcon_init(struct vc_data *vc, int init) return; if (!info->fbcon_par) - con2fb_acquire_newinfo(vc, info, vc->vc_num, -1); + con2fb_acquire_newinfo(vc, info, vc->vc_num); /* If we are not the first console on this fb, copy the font from that console */ -- 2.33.0