Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2073805iof; Tue, 7 Jun 2022 18:53:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAOW8KMYlwYdjswcHs/MaJaldGWGzM5mo4Q0RDNrqCTb3PZ/li75LgRtxCpxjhbKzJU/Cx X-Received: by 2002:a17:902:ec88:b0:166:33fe:a60c with SMTP id x8-20020a170902ec8800b0016633fea60cmr31639103plg.157.1654653223346; Tue, 07 Jun 2022 18:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654653223; cv=none; d=google.com; s=arc-20160816; b=LQt9IyMBCa1Y/1oYU4zUTDlDHdb+c0nV+KLsM0EvBytq0uWiT81ZVLSpsG+f4aN+Y4 5ZLs+PZLK2oyO8JnSvskayUFwDuX0qaFkr+8sbRRAYb6NcLiBU/vUAGKvaJvoTX6hQo3 CBeQBVAfKU3L6Lx52ZUgXcKliPCySq1gP+CD/sFG0kZvTruGv8JbsJQEqmqHWETff78g F1SEGP7oDt53hEdonq47fEViQXIVeURgnWcFeSs9H1bZc8nWOsYIERJ189qvBVwDX4kK g6SFJ6uFYL9nSKCxzB38A6haFK2zf4OtfGQQbgZvUAdyGjXGNp8ElRY82THKMt77rSkV La7g== 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:dkim-signature; bh=KN17otLLjbmzRJPKwWD60VkplKJ5RSo6F6tvRibcLnE=; b=Li988RzkdOWop9fCdcwYcHEbtYHI5uCsAL/RZkQaxCvP6nI5zHG/+zeFGmCxEg3Mv+ VwP9xnIpq8ttqsfM14EfYLoPUVtSH2GAP5pclAgXr7hpJrqQ0TMpbjQbQ6RwVBkRSr8Q mSqW21PDpH1KBPsI6mucNWUhOz1kVPBxvF/Euc0wt41lRAFv6oqB+eUZlLmBJEBfFEeD AfTj3LAoCRLooqj8p2bMJ9CVelYvtHfC5ST5icfDV57mtcXs1LlIJuqNChvZQeNWSuzY 8ujVwAHAtjqynyQejwvfOg3CYTBQgiRyQLPD24ej4rcIw/E4cYwSzN8APTyA2Wf0C8pk 3xaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Zw9jPq8O; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=vM2NrsQB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g23-20020a170902d5d700b001570d09613esi9547897plh.472.2022.06.07.18.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 18:53:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Zw9jPq8O; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=vM2NrsQB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3771D2E34A8; Tue, 7 Jun 2022 18:38:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241066AbiFGKwY (ORCPT + 99 others); Tue, 7 Jun 2022 06:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242340AbiFGKuN (ORCPT ); Tue, 7 Jun 2022 06:50:13 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76AD8F688D; Tue, 7 Jun 2022 03:49:56 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 82AD61F920; Tue, 7 Jun 2022 10:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654598994; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KN17otLLjbmzRJPKwWD60VkplKJ5RSo6F6tvRibcLnE=; b=Zw9jPq8OlYJgDXk9SvjrORkD9B5CluTSYxUD4IYhYe+qIzw+cQyvctU4J3DVttXPbuU8oF 9V/71+Xa7qpFOzQGCpQuaLYREIP8e+HlB9Ce6aD9IYyNswJOIRGm0E1d+nm+9QZr672BEP MgEivPQvlnXCc2hOZVF1YZulHAg3Rq8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654598994; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KN17otLLjbmzRJPKwWD60VkplKJ5RSo6F6tvRibcLnE=; b=vM2NrsQBjPYjslEnSIf3bv0mLGhI815c4DMJD5r83yU7hJa4t7f87L5lXgVdXd/m4r8ulg U+swfLAmaeb6DrDg== Received: from localhost.localdomain (unknown [10.100.201.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 5AE832C141; Tue, 7 Jun 2022 10:49:54 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 24/36] tty/vt: consolemap: saner variable names in con_do_clear_unimap() Date: Tue, 7 Jun 2022 12:49:34 +0200 Message-Id: <20220607104946.18710-24-jslaby@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607104946.18710-1-jslaby@suse.cz> References: <20220607104946.18710-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function uses too vague variable names like i, j, k for iterators, p, q, p1, p2 for pointers etc. Rename all these, so that it is clear what is going on: - dict: for dictionaries. - d, r, g: for dir, row, glyph iterators -- these are unsigned now. - dir, row: for directory and row pointers. - glyph: for the glyph. - and so on... This is a lot of shuffling, but the result pays off, IMO. Signed-off-by: Jiri Slaby --- drivers/tty/vt/consolemap.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c index cbdc73605148..456aed3f717c 100644 --- a/drivers/tty/vt/consolemap.c +++ b/drivers/tty/vt/consolemap.c @@ -531,24 +531,23 @@ con_insert_unipair(struct uni_pagedict *p, u_short unicode, u_short fontpos) /* Caller must hold the lock */ static int con_do_clear_unimap(struct vc_data *vc) { - struct uni_pagedict *p, *q; + struct uni_pagedict *old = *vc->vc_uni_pagedir_loc; - p = *vc->vc_uni_pagedir_loc; - if (!p || --p->refcount) { - q = kzalloc(sizeof(*p), GFP_KERNEL); - if (!q) { - if (p) - p->refcount++; + if (!old || --old->refcount) { + struct uni_pagedict *new = kzalloc(sizeof(*new), GFP_KERNEL); + if (!new) { + if (old) + old->refcount++; return -ENOMEM; } - q->refcount=1; - *vc->vc_uni_pagedir_loc = q; + new->refcount = 1; + *vc->vc_uni_pagedir_loc = new; } else { - if (p == dflt) + if (old == dflt) dflt = NULL; - p->refcount++; - p->sum = 0; - con_release_unimap(p); + old->refcount++; + old->sum = 0; + con_release_unimap(old); } return 0; } -- 2.36.1