From patchwork Wed Oct 19 10:55:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 5274 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp276594wrs; Wed, 19 Oct 2022 04:50:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Fh/8yVs5Q//x8cs4w8mhAC2c/kiBnoK5xE99G0de09nXCcL6l6Bfw0aMQqlZQFCyVGi8U X-Received: by 2002:a17:90b:1808:b0:20c:8409:2007 with SMTP id lw8-20020a17090b180800b0020c84092007mr9488760pjb.226.1666180211924; Wed, 19 Oct 2022 04:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180211; cv=none; d=google.com; s=arc-20160816; b=VJQq4EVO3tQstzRjcXXBfljLKR2V4ZN9527H4HJeKeBkuhmMtRO+U5EpH1oYu17Sq/ 3H7XFr+2H8IEJSAV438R0U29cPxyXNr8uXFYWgxiSwVvrpnBz3t1y3RInyRyhVr0s8xT BBXlhccRFAqcIBt8CaQQxRV4A6qIhZC/2iflH9GLVCyHxZ930725cAd0r4xT+9mJi2hl 3Sw5UUFqKns5S1D5z9KLanx4W76+GrespRjjGNOzx9g9DDpAOarTG0ec56hMsliz4BlL 77mahUyC0OirBssWKXvvSJ8moe5On94bfoUVzF5jSxGXBXDUZ2LUCoYsgm6R6Gq0KyK9 QIlw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=DYzb5dmpkLSKwViJCIgtgEF7QjF8b+XUVrcIXPX/YKM=; b=OwdQr8wrz3fA/lHgmz9GpGwWZwmqriJ/tr8MeH2+hrL7VxulihPOPdbnXg45woH4x4 r5bZSxZRaDs8aOhsAIHNAHTuENvYYaIu0/+KhY5Rju1zxC3Y7XN3omeOmwpVlBAwPya/ BEV9bb+QoBNjgvE2MiWvLx4jQbXICwsbVFChMC/CmMdNarR804xXSGGEnbgr6wUccC9P 7iOvwqi7zT3iNU14tW2x7dXYmmjgKFpVAKWkCkcN9ddt9f84pX/4+henBHigoWBYqE21 OJNVX79yeF17AbFt77s68InKtwSFC4+yMMO1hfKmusU6IPGkAZNVGRk7NwFkOpp3q6bW /eiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FZtaWb5+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a636b01000000b00460c67afbd9si17880457pgc.771.2022.10.19.04.49.57; Wed, 19 Oct 2022 04:50:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FZtaWb5+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231348AbiJSLsk (ORCPT + 99 others); Wed, 19 Oct 2022 07:48:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231187AbiJSLsR (ORCPT ); Wed, 19 Oct 2022 07:48:17 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 206B425E84; Wed, 19 Oct 2022 04:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666178859; x=1697714859; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=3qYimSW2UYr0KxKeDsMpOXR+PEhcwfbe9X7/vsmwasQ=; b=FZtaWb5+O+64EKlwoFrRe61JNd07pRCipeJ+jsql7A5vWC8Irhs1vmKF K1MWB1IFdVnhFMMvhsB+FjD6yEL/ddgwoXcNtBkrfA+bOQamnV4jsxNQn UuSLzHEKMQDpDRqZy9t05ynMQzA6dMKYTxm3xWZYajobqgZF6GgUiD3KT pNxwIf7Y4dFg53amVzCR/ZvQRfqCuErJ3y0benMR6Tocp3a9q1Bq8LNCk zJG42Mz2D9uwkBNDMP5cA1FXRAXftgtBYCV7lCSgfN1IAxd3UWtd9B4cC U4O+k9XGdWRqXxTX3AfnhHsFANNgQX+iO/o+ILmYfSFXv5BucdRXBUrrp w==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="392677091" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="392677091" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 03:55:15 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="580282722" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="580282722" Received: from sponnura-mobl1.amr.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.251.214.35]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 03:55:12 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 1/2] tty: Convert tty_buffer flags to bool Date: Wed, 19 Oct 2022 13:55:03 +0300 Message-Id: <20221019105504.16800-1-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747116581956935180?= X-GMAIL-MSGID: =?utf-8?q?1747116581956935180?= The struct tty_buffer has flags which is only used for storing TTYB_NORMAL. There is also a few quite confusing operations for checking the presense of TTYB_NORMAL. Simplify things by converting flags to bool. Despite the name remaining the same, the meaning of "flags" is altered slightly by this change. Previously it referred to flags of the buffer (only TTYB_NORMAL being used as a flag). After this change, flags tell whether the buffer contains/should be allocated with flags array along with character data array. It is much more suitable name that TTYB_NORMAL was for this purpose, thus the name remains. Signed-off-by: Ilpo Järvinen --- v2: - Make it more obvious why flags is not renamed (both in kerneldoc comment and commit message). drivers/tty/tty_buffer.c | 28 ++++++++++++++-------------- include/linux/tty_buffer.h | 5 +---- include/linux/tty_flip.h | 4 ++-- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 5e287dedce01..b408d830fcbc 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -107,7 +107,7 @@ static void tty_buffer_reset(struct tty_buffer *p, size_t size) p->commit = 0; p->lookahead = 0; p->read = 0; - p->flags = 0; + p->flags = true; } /** @@ -249,7 +249,7 @@ void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld) * __tty_buffer_request_room - grow tty buffer if needed * @port: tty port * @size: size desired - * @flags: buffer flags if new buffer allocated (default = 0) + * @flags: buffer has to store flags along character data * * Make at least @size bytes of linear space available for the tty buffer. * @@ -260,19 +260,19 @@ void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld) * Returns: the size we managed to find. */ static int __tty_buffer_request_room(struct tty_port *port, size_t size, - int flags) + bool flags) { struct tty_bufhead *buf = &port->buf; struct tty_buffer *b, *n; int left, change; b = buf->tail; - if (b->flags & TTYB_NORMAL) + if (!b->flags) left = 2 * b->size - b->used; else left = b->size - b->used; - change = (b->flags & TTYB_NORMAL) && (~flags & TTYB_NORMAL); + change = !b->flags && flags; if (change || left < size) { /* This is the slow path - looking for new buffers to use */ n = tty_buffer_alloc(port, size); @@ -300,7 +300,7 @@ static int __tty_buffer_request_room(struct tty_port *port, size_t size, int tty_buffer_request_room(struct tty_port *port, size_t size) { - return __tty_buffer_request_room(port, size, 0); + return __tty_buffer_request_room(port, size, true); } EXPORT_SYMBOL_GPL(tty_buffer_request_room); @@ -320,17 +320,17 @@ int tty_insert_flip_string_fixed_flag(struct tty_port *port, const unsigned char *chars, char flag, size_t size) { int copied = 0; + bool flags = flag != TTY_NORMAL; do { int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); - int flags = (flag == TTY_NORMAL) ? TTYB_NORMAL : 0; int space = __tty_buffer_request_room(port, goal, flags); struct tty_buffer *tb = port->buf.tail; if (unlikely(space == 0)) break; memcpy(char_buf_ptr(tb, tb->used), chars, space); - if (~tb->flags & TTYB_NORMAL) + if (tb->flags) memset(flag_buf_ptr(tb, tb->used), flag, space); tb->used += space; copied += space; @@ -393,13 +393,13 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags); int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag) { struct tty_buffer *tb; - int flags = (flag == TTY_NORMAL) ? TTYB_NORMAL : 0; + bool flags = flag != TTY_NORMAL; if (!__tty_buffer_request_room(port, 1, flags)) return 0; tb = port->buf.tail; - if (~tb->flags & TTYB_NORMAL) + if (tb->flags) *flag_buf_ptr(tb, tb->used) = flag; *char_buf_ptr(tb, tb->used++) = ch; @@ -424,13 +424,13 @@ EXPORT_SYMBOL(__tty_insert_flip_char); int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars, size_t size) { - int space = __tty_buffer_request_room(port, size, TTYB_NORMAL); + int space = __tty_buffer_request_room(port, size, false); if (likely(space)) { struct tty_buffer *tb = port->buf.tail; *chars = char_buf_ptr(tb, tb->used); - if (~tb->flags & TTYB_NORMAL) + if (tb->flags) memset(flag_buf_ptr(tb, tb->used), TTY_NORMAL, space); tb->used += space; } @@ -492,7 +492,7 @@ static void lookahead_bufs(struct tty_port *port, struct tty_buffer *head) unsigned char *p, *f = NULL; p = char_buf_ptr(head, head->lookahead); - if (~head->flags & TTYB_NORMAL) + if (head->flags) f = flag_buf_ptr(head, head->lookahead); port->client_ops->lookahead_buf(port, p, f, count); @@ -509,7 +509,7 @@ receive_buf(struct tty_port *port, struct tty_buffer *head, int count) const char *f = NULL; int n; - if (~head->flags & TTYB_NORMAL) + if (head->flags) f = flag_buf_ptr(head, head->read); n = port->client_ops->receive_buf(port, p, f, count); diff --git a/include/linux/tty_buffer.h b/include/linux/tty_buffer.h index 1796648c2907..6ceb2789e6c8 100644 --- a/include/linux/tty_buffer.h +++ b/include/linux/tty_buffer.h @@ -17,14 +17,11 @@ struct tty_buffer { int commit; int lookahead; /* Lazy update on recv, can become less than "read" */ int read; - int flags; + bool flags; /* Data points here */ unsigned long data[]; }; -/* Values for .flags field of tty_buffer */ -#define TTYB_NORMAL 1 /* buffer has no flags buffer */ - static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs) { return ((unsigned char *)b->data) + ofs; diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index 483d41cbcbb7..bfaaeee61a05 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h @@ -25,9 +25,9 @@ static inline int tty_insert_flip_char(struct tty_port *port, struct tty_buffer *tb = port->buf.tail; int change; - change = (tb->flags & TTYB_NORMAL) && (flag != TTY_NORMAL); + change = !tb->flags && (flag != TTY_NORMAL); if (!change && tb->used < tb->size) { - if (~tb->flags & TTYB_NORMAL) + if (tb->flags) *flag_buf_ptr(tb, tb->used) = flag; *char_buf_ptr(tb, tb->used++) = ch; return 1; From patchwork Wed Oct 19 10:55:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 5275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp276928wrs; Wed, 19 Oct 2022 04:51:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dcRP3+j1cW3fQH0pH2YU2AjkNHy04ZbtIfLdEElXetb1w+OUPDayQVCAbi5NazYsvjZMu X-Received: by 2002:a05:6402:d6c:b0:458:ef3d:5926 with SMTP id ec44-20020a0564020d6c00b00458ef3d5926mr7183961edb.54.1666180275978; Wed, 19 Oct 2022 04:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180275; cv=none; d=google.com; s=arc-20160816; b=S346zcwO4HejYXz2v3z07Zd8Ro5DfiTR+hPZmR4Ev9psJu9LcHlrVKf45kZXVP5O7f 28hIDjAOF8hvZI2vrFDyhDynD5IK5aUMcz6xzQ42m4kb+m4zJGtSWb3e9KF0KeZkyzOr aFcANV4rAvdwzxsKl8hbcxSLJ0HOHvR1y29X1PDDN2dojBlb6eIAZz/CFGQgTaNGySRF u6I/f2lbAkbg8dOpBCtngrVbAh3Lt+f9ZJnZP/WjU8VWrsuPJnsEl3st04i4bs+fMq4h zv7x4sg6CNZZZkMYX/6kn2DT0Ufl/h6WcITMSSd1+97CSsrgCC89T0hOEAnECARwUqkA 9ehw== 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=L4HV2EVCBYTbC4JlI6BgxWbv1qtBYZCmbvVRga6OWoM=; b=UltGPcW884v/1gvYL2g7BScMK1wpQhWQByCBJ8tP0s8IvrtP7XYKrwVBEnXAmObn4E ZgZiDtk45W2Bk0DA7IT2T+jjagFsrvblQSWya2MrdBipgDLVLVKHr/swKY0j6kT3MRmk Ap+EQ/n82DqF6eorHI4a5+nQFIM9ieXTk7w2IrvL/fPEZBhbhszZm6YFs4AFRkn0Wfe1 9pudxxLx5IcW89IbfKP/fgT/T3HRcCrn2DIm9IZ1FLIE9Lnm0OMk2RzVRnLCeT200m/u AOXjjA6R6MdmX7NIq+Va5DbSZv2L1NAD8vZb1I2HPOgw+ZYJQan7rOohLTAsk+JQcixb 5pZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DxSXXWH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a50ff15000000b00459195ae973si11739387edu.414.2022.10.19.04.50.50; Wed, 19 Oct 2022 04:51:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DxSXXWH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbiJSLtq (ORCPT + 99 others); Wed, 19 Oct 2022 07:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231759AbiJSLs1 (ORCPT ); Wed, 19 Oct 2022 07:48:27 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46F0F65246; Wed, 19 Oct 2022 04:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666178859; x=1697714859; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XMFggGUT5rB2EsYur5TAIr34+vLXDytXkSJIKAo1bvg=; b=DxSXXWH4LM/YFHBvb92HeFFZi9Rx+tAQB8SzL0aApKUbM+mpn+OQEgT2 xfTWv1YEon3Oe8xHa/98C1hxlWyn5axdeJfohS/G9PgnXZjXyO2jfPQr4 AVbMdKgNgaY0o4hIosY5SVHfHFkS/4pm4jDS0bquz8jP93OLkvUz9VAr2 2QRmKmveLPHZIvrBezeY+Kqiku2dwfcUjs0L4z3y7Sgh/7meEfbvoDyr7 txKBmhhG2cWGS7wAZb1XE0MnhjM8NV2lw5qmf5g7ZDzUy3pZOtUCqsniY lZ4tTvnMZifatltrXUf1lfm1o5QxHm1esC+GP2NNjnMn8Sv4RVlXFNhsj A==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="392677104" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="392677104" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 03:55:18 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="580282738" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="580282738" Received: from sponnura-mobl1.amr.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.251.214.35]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 03:55:16 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 2/2] tty: Cleanup tty buffer align mask Date: Wed, 19 Oct 2022 13:55:04 +0300 Message-Id: <20221019105504.16800-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221019105504.16800-1-ilpo.jarvinen@linux.intel.com> References: <20221019105504.16800-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747116648812633311?= X-GMAIL-MSGID: =?utf-8?q?1747116648812633311?= Don't use decimal for mask. Don't use literal for aligning. Signed-off-by: Ilpo Järvinen --- drivers/tty/tty_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index b408d830fcbc..2df86ed90574 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -21,7 +21,7 @@ #include "tty.h" #define MIN_TTYB_SIZE 256 -#define TTYB_ALIGN_MASK 255 +#define TTYB_ALIGN_MASK 0xff /* * Byte threshold to limit memory consumption for flip buffers. @@ -37,7 +37,7 @@ * logic this must match. */ -#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) +#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~TTYB_ALIGN_MASK) /** * tty_buffer_lock_exclusive - gain exclusive access to buffer