Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp229118imm; Tue, 24 Jul 2018 17:52:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdhsUc1mhGLmOiHNwZbCPXY6BL2pgCGuyA8PojsCd0arZzCD9tBCXE93XeNI+TGy0l+a3f8 X-Received: by 2002:a17:902:28e9:: with SMTP id f96-v6mr18546024plb.240.1532479977885; Tue, 24 Jul 2018 17:52:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532479977; cv=none; d=google.com; s=arc-20160816; b=HRcmVyvZVsykfwE5D8yfwMYyKOoL9pWkYZassoNW6M+yyuyQVhsokl3ZkND7BN2fwq QJe14xoOSHHjuHI++bjexegxSRbRTEVbobfH0f5svXDTSZr3tbjjBD7+zWvYki2VojIY hA6ncvfWTGiCiMBafH17qFzWcG0DEpUkVnf69GUM3zDF7HsxtmF6gr7Npz2x6Iuch7Wj hWxRIhfNIFjOvOpoC5hEe3dm0W02p1hb3N8t8T89bfX3rmwIs4NuX3215SNS2vZc1ig7 I6wrxoh36FJGjDQ/ReA1LNJMWE2ENEl5/eS6JrSet7cJTY5F1T83Uu6ieW+nsrpqUvfs UqYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references:message-id :in-reply-to:date:mime-version:dkim-signature :arc-authentication-results; bh=44jEWQQm/T28mqKlZG7Ef2B9v8tnrCRDO/QbziHOkyU=; b=D8b1oApjbXprRGiuHX6ncSCuCF9+JZxG7c2rIv5LMO/0WJE1ha3WLZV90ucTIyPzOF aaCnn25JddrwnW6Ipj55wkJoQvJVaigyh25YPgz0NCuN0jzyuoOghuMW/5VfPVXtOaEk Uk6/2V6w4nWj2ItcpSdQ4ybDm2UEtJrqSbz8Cs6jGttLo/NP5TIBp9UX1r/thzGgLghP eA2fOdZnJQMSi3yvsLkunWEl/XSasR7/yojhgQof2r+j0La37qcptc+kuvCGm7nxzLg3 15IZeNOT7Uk7ovCD43K+teuAhERlrkn8mQTbJjC5xE9XfEFDL1XYSi1VOOs44+p5QtTk HPvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="q/t9q3fl"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 138-v6si12754061pga.188.2018.07.24.17.52.43; Tue, 24 Jul 2018 17:52:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="q/t9q3fl"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388546AbeGYCA6 (ORCPT + 99 others); Tue, 24 Jul 2018 22:00:58 -0400 Received: from mail-vk0-f74.google.com ([209.85.213.74]:55728 "EHLO mail-vk0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388420AbeGYCA6 (ORCPT ); Tue, 24 Jul 2018 22:00:58 -0400 Received: by mail-vk0-f74.google.com with SMTP id j80-v6so2242745vke.22 for ; Tue, 24 Jul 2018 17:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=44jEWQQm/T28mqKlZG7Ef2B9v8tnrCRDO/QbziHOkyU=; b=q/t9q3fl42QlVHVu57sUSd19zYH4fdWN4pBnLBMQX28Erop+5DBGWptd2brPQvPPcs 9OKBdJjAGA1cvdgtruB1Y75Olup203NE+GU3PoBYKSQU2wAv0mXXDib77jbowqe31jZi x3XtdLapKL1G9wKrA8iGYOnoA8p3nh/gYdH2e5cKj8J9Gaj+4IKzJHNScIS6840qqRG2 9/JAM2S9qurfnvV3eFdFdRlyKxrrq0v1mZEo0rM2pKIvOgoaL6MznJzs9VAQvrmgG/d3 bO2DaCWnklaZQj0oSj47Gi6lsfjQYQBQSOMeukrYGJrMl1yjsk6d2VMNVxPETKJVfmn6 6mQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=44jEWQQm/T28mqKlZG7Ef2B9v8tnrCRDO/QbziHOkyU=; b=J97UxsLsVuF4HLmozIP2auS/ce7QIPT9GO4aCYACz4xq5xPednqwREVepgE1NPstWs TgsIscB4idPEsNCMXTviBY/2peOxdPJl/JN2YuISMgZN4WNqRhwhi0wv7fTEL8mrmxAp tbyM3mN4+Pk6wmrXdCnoL6zyw0znOOmGq1iMJMrpr7FceFJakcSys6XglJcEQIMzVygc 0ducgF202/+DKReW/OC1YJ8RriWfMQbb7CCzvThx3M0l+tB0HE+rcexaAwY0qQlpKr7Y XOjnls5I191nPfXvj3eJvC3Hz7Hz2Zv72O/r61TxoRVglooXQrQpz3qA2fili5S+C4hN Ujbw== X-Gm-Message-State: AOUpUlH5MXR9o7gWxwdz30bROw167eZU4Lb4Jv15W608O7Ga6bn2rcF2 ZWy1NrBX9Jma3eAH9BZ5MjevI2Ts MIME-Version: 1.0 X-Received: by 2002:a1f:b42:: with SMTP id 63-v6mr9735544vkl.24.1532479912445; Tue, 24 Jul 2018 17:51:52 -0700 (PDT) Date: Tue, 24 Jul 2018 17:51:33 -0700 In-Reply-To: <20180725005133.107823-1-rkir@google.com> Message-Id: <20180725005133.107823-3-rkir@google.com> References: <20180725005133.107823-1-rkir@google.com> X-Mailer: git-send-email 2.18.0.233.g985f88cf7e-goog Subject: [PATCH v2 3/3] tty: Replace goldfish_tty_line_count with a #define From: rkir@google.com To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Roman Kiryanov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Kiryanov The driver never mutates this variable - no benefits of keeping it mutable. Signed-off-by: Roman Kiryanov --- Changes in v2: - Replaced "const u32" with "#define". drivers/tty/goldfish.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c index 173383f2a4c1..eb88db4f243c 100644 --- a/drivers/tty/goldfish.c +++ b/drivers/tty/goldfish.c @@ -49,10 +49,11 @@ struct goldfish_tty { static DEFINE_MUTEX(goldfish_tty_lock); static struct tty_driver *goldfish_tty_driver; -static u32 goldfish_tty_line_count = 8; static u32 goldfish_tty_current_line_count; static struct goldfish_tty *goldfish_ttys; +#define GOLDFISH_TTY_LINE_COUNT 8 + static void do_rw_io(struct goldfish_tty *qtty, unsigned long address, unsigned int count, @@ -225,7 +226,7 @@ static struct tty_driver *goldfish_tty_console_device(struct console *c, static int goldfish_tty_console_setup(struct console *co, char *options) { - if ((unsigned int)co->index >= goldfish_tty_line_count) + if ((unsigned int)co->index >= GOLDFISH_TTY_LINE_COUNT) return -ENODEV; if (!goldfish_ttys[co->index].base) return -ENODEV; @@ -251,14 +252,14 @@ static int goldfish_tty_create_driver(void) int ret; struct tty_driver *tty; - goldfish_ttys = kcalloc(goldfish_tty_line_count, + goldfish_ttys = kcalloc(GOLDFISH_TTY_LINE_COUNT, sizeof(*goldfish_ttys), GFP_KERNEL); if (goldfish_ttys == NULL) { ret = -ENOMEM; goto err_alloc_goldfish_ttys_failed; } - tty = alloc_tty_driver(goldfish_tty_line_count); + tty = alloc_tty_driver(GOLDFISH_TTY_LINE_COUNT); if (tty == NULL) { ret = -ENOMEM; goto err_alloc_tty_driver_failed; @@ -333,7 +334,7 @@ static int goldfish_tty_probe(struct platform_device *pdev) else line = pdev->id; - if (line >= goldfish_tty_line_count) { + if (line >= GOLDFISH_TTY_LINE_COUNT) { pr_err("goldfish_tty: Reached maximum tty number of %d.\n", goldfish_tty_current_line_count); ret = -ENOMEM; -- 2.18.0.233.g985f88cf7e-goog