From patchwork Wed Aug 16 10:55:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 714321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97EF4C04E69 for ; Wed, 16 Aug 2023 10:56:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243026AbjHPK4H (ORCPT ); Wed, 16 Aug 2023 06:56:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243690AbjHPKzh (ORCPT ); Wed, 16 Aug 2023 06:55:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B55C13E; Wed, 16 Aug 2023 03:55:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8DBED64FFF; Wed, 16 Aug 2023 10:55:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF26FC433C8; Wed, 16 Aug 2023 10:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692183335; bh=f0NgofJBUmSnyOLLGLK1G2U+0vgQxZe+PafjYAMnUsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFFno7RU8fFroRTlwyEv3dE4wmWHidBnWnAJI52ytxIlo9XxakgTjA+X9oEe1YDmU VU5OpHYDSbL15lY55l4UPHmzjMwx3/GGRmORxWqU+H+yGT8rYNqUt+1VDhl31dXIOz seXik9e5dJVoSpekD9EhKHJlYZoK20CLZBsPM28Mdjq9hrWSqYVoIHBpwOXgEmYoPE hr8zW01IHvSZTI65sICvPQz50zq4WRf6VtN08eI3sSexLCm8GPgHMQZFqTatTUg4ug qsum1XLGYaIKdvthtOG02RcY8TNOPKbw48ynoHcDHcXz4DPiFQLch6ZxrGopT7YGps P/AiSAFjvejfg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" Subject: [PATCH 01/10] tty: tty_buffer: switch data type to u8 Date: Wed, 16 Aug 2023 12:55:21 +0200 Message-ID: <20230816105530.3335-2-jirislaby@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230816105530.3335-1-jirislaby@kernel.org> References: <20230816105530.3335-1-jirislaby@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org There is no reason to have tty_buffer::data typed as unsigned long. Switch to u8, but preserve the ulong alignment using __aligned. This allows for the cast removal from char_buf_ptr(). And for use of struct_size() in the allocation in tty_buffer_alloc() -- in the next patch. Signed-off-by: Jiri Slaby (SUSE) --- include/linux/tty_buffer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/tty_buffer.h b/include/linux/tty_buffer.h index e45cba81d0e9..31125e3be3c5 100644 --- a/include/linux/tty_buffer.h +++ b/include/linux/tty_buffer.h @@ -19,12 +19,12 @@ struct tty_buffer { unsigned int read; bool flags; /* Data points here */ - unsigned long data[]; + u8 data[] __aligned(sizeof(unsigned long)); }; static inline u8 *char_buf_ptr(struct tty_buffer *b, unsigned int ofs) { - return ((u8 *)b->data) + ofs; + return b->data + ofs; } static inline u8 *flag_buf_ptr(struct tty_buffer *b, unsigned int ofs)